{"version":3,"file":"CardStack.CxCUGesV.mjs","names":["React.useState","React.useMemo"],"sources":["https:/framerusercontent.com/modules/p5m7w9x1LtAkp5Rlyn7X/Jz0VwQdY5liIzMZW1Zdw/CardStack.js"],"sourcesContent":["// Rewrite: Ensure all images fit and show the full image in the CardStack component\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * CardStack\n *\n * A stack of cards with images, offset, scale, dim, and drag-to-front interaction.\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 387\n * @framerIntrinsicHeight 218\n */const placeholderImage={src:\"data:image/svg+xml;utf8,\"+encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'><rect fill='#ddd' width='160' height='90'/><path d='M0 0L160 90M160 0L0 90' stroke='#aaa' stroke-width='4'/></svg>`),alt:\"Placeholder\"};function toObjList(arr){return(arr.length?arr:[placeholderImage]).map(img=>{if(typeof img===\"string\")return{src:img,alt:\"\"};if(img&&typeof img===\"object\"&&img.src)return{...img};return{src:placeholderImage.src,alt:placeholderImage.alt};});}export default function CardStack(props){const{images=[],offset=8,scaleStep=.06,dimStep=.15,borderRadius=8,ratio=\"16 / 9\",customRatio=\"1.5\",style={}}=props;const[cards,setCards]=React.useState(toObjList(images));React.useEffect(()=>{setCards(toObjList(images));},[JSON.stringify(images)]);const moveToEnd=i=>setCards(prev=>[...prev.slice(i+1),prev[i]]);const aspect=React.useMemo(()=>{if(ratio!==\"custom\")return ratio;// Try to parse customRatio as a number or as a fraction\nif(customRatio.includes(\"/\")){const[a,b]=customRatio.split(\"/\").map(v=>parseFloat(v.trim()));if(!isNaN(a)&&!isNaN(b)&&b!==0)return`${a} / ${b}`;}const num=parseFloat(customRatio);if(!isNaN(num)&&num>0)return`${num} / 1`;return\"16 / 9\";},[ratio,customRatio]);const wrapperStyle={...style,position:\"relative\",width:style.width??600,aspectRatio:aspect,overflow:\"visible\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:0};return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsx(\"ul\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",margin:0,padding:0},children:cards.map(({src,alt},i)=>{const y=i*offset;const scale=1-i*scaleStep;const opacity=1-i*dimStep;return /*#__PURE__*/_jsx(motion.li,{style:{position:\"absolute\",width:\"100%\",height:\"100%\",borderRadius:borderRadius,listStyle:\"none\",overflow:\"hidden\",zIndex:cards.length-i,boxShadow:\"0 6px 32px rgba(0,0,0,0.13)\",marginBottom:16,y,scale,opacity,background:\"#fff\",cursor:\"grab\",touchAction:\"none\"},drag:true,dragElastic:.18,dragConstraints:{left:0,right:0,top:0,bottom:0},whileTap:{scale:scale*.97},onDragEnd:()=>moveToEnd(i),children:/*#__PURE__*/_jsx(\"img\",{src:src,alt:alt||\"Card image\",style:{width:\"100%\",height:\"100%\",objectFit:\"contain\",objectPosition:\"center\",pointerEvents:\"none\",display:\"block\",background:\"#f5f5f5\"}})},src+i);})})});}addPropertyControls(CardStack,{images:{title:\"Cards\",type:ControlType.Array,control:{type:ControlType.ResponsiveImage},maxCount:10,defaultValue:[{src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Gradient 1 - Blue\"},{src:\"https://framerusercontent.com/images/aNsAT3jCvt4zglbWCUoFe33Q.jpg\",alt:\"Gradient 2 - Purple\"}]},ratio:{title:\"Aspect Ratio\",type:ControlType.Enum,options:[\"16 / 9\",\"4 / 3\",\"1 / 1\",\"3 / 4\",\"9 / 16\",\"custom\"],optionTitles:[\"16:9\",\"4:3\",\"1:1\",\"3:4\",\"9:16\",\"Custom\"],defaultValue:\"16 / 9\"},customRatio:{title:\"Custom Ratio\",type:ControlType.String,defaultValue:\"1.5\",placeholder:\"e.g. 1.5 or 3 / 2\",hidden:props=>props.ratio!==\"custom\"},borderRadius:{title:\"Corner Radius\",type:ControlType.Number,defaultValue:8,min:0,max:64,step:1,displayStepper:true},offset:{title:\"Offset\",type:ControlType.Number,defaultValue:8,min:0,max:60,step:1,displayStepper:true,unit:\"%\",description:\"Vertical shift between cards\"},scaleStep:{title:\"Scale\",type:ControlType.Number,defaultValue:.06,min:0,max:.2,step:.005,displayStepper:true},dimStep:{title:\"Dim\",type:ControlType.Number,defaultValue:.15,min:0,max:1,step:.02,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CardStack\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CardStack.map"],"mappings":"oOAUmR,SAAS,EAAU,EAAI,CAAC,OAAO,EAAI,OAAO,EAAI,CAAC,EAAiB,EAAE,IAAI,GAAS,OAAO,GAAM,SAAe,CAAC,IAAI,EAAI,IAAI,GAAG,CAAI,GAAK,OAAO,GAAM,UAAU,EAAI,IAAU,CAAC,GAAG,EAAI,CAAO,CAAC,IAAI,EAAiB,IAAI,IAAI,EAAiB,IAAI,CAAG,CAAE,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,SAAO,EAAE,CAAC,SAAO,EAAE,YAAU,IAAI,UAAQ,IAAI,eAAa,EAAE,QAAM,SAAS,cAAY,MAAM,QAAM,EAAE,EAAE,EAAW,CAAC,EAAM,GAAUA,EAAe,EAAU,EAAO,CAAC,CAAC,MAAoB,CAAC,EAAS,EAAU,EAAO,CAAC,EAAG,CAAC,KAAK,UAAU,EAAO,CAAC,CAAC,CAAC,IAAM,EAAU,GAAG,EAAS,GAAM,CAAC,GAAG,EAAK,MAAM,EAAE,EAAE,CAAC,EAAK,GAAG,CAAC,CAAO,EAAOC,MAAkB,CAAC,GAAG,IAAQ,SAAS,OAAO,EAC/5B,GAAG,EAAY,SAAS,IAAI,CAAC,CAAC,GAAK,CAAC,EAAE,GAAG,EAAY,MAAM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