{"version":3,"file":"Shopiframe_ProductVariants.CnOppMqd.mjs","names":["useState","styles","Minus","Plus","useState"],"sources":["https:/framerusercontent.com/modules/2st4DNkNYiQAbMDXhpJ6/D0HG6CrH6cvpeYOdOwoA/Counter.js","https:/framerusercontent.com/modules/wX4sen6GdOvT6ZMLoNql/ZnZ6CCL2x2irhDwwmLB8/Shopiframe_ProductCounter.js","https:/framerusercontent.com/modules/ZbBDqd3qrDWvdSMazPfb/raVticdTDeUXmpX3Gbom/Shopiframe_ProductVariants.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{Plus,Minus}from\"lucide-react\";import{motion}from\"framer-motion\";import{cn}from\"https://framerusercontent.com/modules/q0qjLSJzCbedNd7w0WjB/JGy6EpHStxos0WnSsbPV/_utils.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter({onChange=()=>false,count,min=0,loading=false,styles={}}){const[state,setState]=useState(1);useEffect(()=>{if(count!==state&&count!==undefined)setState(count);},[count]);return /*#__PURE__*/_jsxs(\"div\",{style:cn(style.container,styles,loading&&style.loading),children:[/*#__PURE__*/_jsx(motion.button,{whileHover:{scale:1.15},style:style.button,disabled:loading||state<=min,onClick:()=>{const c=Math.max(state-1,min);setState(c);onChange(c);},children:/*#__PURE__*/_jsx(Minus,{size:styles.iconSize,color:styles.iconColor})}),/*#__PURE__*/_jsx(\"span\",{children:state}),/*#__PURE__*/_jsx(motion.button,{whileHover:{scale:1.15},style:style.button,disabled:loading,onClick:()=>{const c=state+1;setState(c);onChange(c);},children:/*#__PURE__*/_jsx(Plus,{size:styles.iconSize,color:styles.iconColor})})]});}export const CounterPropertyControls={fontSize:{type:ControlType.Number,min:8,max:100,defaultValue:16},gap:{title:\"Gap\",type:ControlType.Number,defaultValue:14,min:0},color:{title:\"Text color\",type:ControlType.Color,defaultValue:\"#000\"},backgroundColor:{title:\"Background color\",type:ControlType.Color,defaultValue:\"transparent\",optional:true},font:{type:ControlType.Font},border:{type:ControlType.Border,defaultValue:{borderWidth:1,borderColor:\"#DBDBDB\"}},borderRadius:{type:ControlType.BorderRadius,defaultValue:\"24px\"},padding:{type:ControlType.Padding,defaultValue:\"6px 14px 6px 14px\"},iconColor:{title:\"Icon color\",type:ControlType.Color,defaultValue:\"#919191\"},iconSize:{title:\"Icon size\",type:ControlType.Number,defaultValue:16,min:0}};addPropertyControls(Counter,{styles:{type:ControlType.Object,controls:CounterPropertyControls}});const style={container:{display:\"flex\",flexDirection:\"row\",alignItems:\"center\",justifyContent:\"center\"},button:{backgroundColor:\"transparent\",border:\"none\",padding:0,margin:0,cursor:\"pointer\"},loading:{opacity:.6,cursor:\"wait\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"CounterPropertyControls\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Counter,{CounterPropertyControls}from\"https://framerusercontent.com/modules/2st4DNkNYiQAbMDXhpJ6/D0HG6CrH6cvpeYOdOwoA/Counter.js\";import WrapperDiv from\"https://framerusercontent.com/modules/hpgMcXVibTnsGEdL78h0/fZ1XDby7m4z4HpTyQtDm/WrapperDiv.js\";import{useShopify}from\"https://framerusercontent.com/modules/agcJAgx0B7xqixXVIWIM/pPWKOyJXdCguncBCbcCI/_hooks.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Shopiframe_ProductCounter(props){const[shopify,setShopify]=useShopify();return /*#__PURE__*/_jsx(WrapperDiv,{children:/*#__PURE__*/_jsx(Counter,{styles:props.styles,onChange:quantity=>{setShopify({quantity});},min:1})});}addPropertyControls(Shopiframe_ProductCounter,{styles:{title:\"Styles\",type:ControlType.Object,controls:CounterPropertyControls}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Shopiframe_ProductCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";import WrapperDiv from\"https://framerusercontent.com/modules/hpgMcXVibTnsGEdL78h0/fZ1XDby7m4z4HpTyQtDm/WrapperDiv.js\";import{useFindProduct,useShopify}from\"https://framerusercontent.com/modules/agcJAgx0B7xqixXVIWIM/pPWKOyJXdCguncBCbcCI/_hooks.js\";import{cn,BaseControls,textProperties}from\"https://framerusercontent.com/modules/q0qjLSJzCbedNd7w0WjB/JGy6EpHStxos0WnSsbPV/_utils.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function Shopiframe_ProductVariants(props){var _product_options;const[selected,setSelected]=useState({});const[shopify,setShopify]=useShopify();const product=useFindProduct(props.productID);var _product_options_filter;// if (!product) return null\nconst options=(_product_options_filter=product===null||product===void 0?void 0:(_product_options=product.options)===null||_product_options===void 0?void 0:_product_options.filter(item=>item.name!==\"Title\"))!==null&&_product_options_filter!==void 0?_product_options_filter:[];useEffect(()=>{if(product){const selectedVariant=product.variants.nodes[0];const selectedOptions={};selectedVariant===null||selectedVariant===void 0?void 0:selectedVariant.selectedOptions.forEach(item=>{selectedOptions[item.name]=item.value;});setSelected(selectedOptions);setShopify({selectedVariant,singleProduct:props.productID,quantity:1});}return()=>{setShopify({selectedVariant:null,singleProduct:null,quantity:1});};},[product]);useEffect(()=>{if(product){const selectedVariant=product.variants.nodes.find(variant=>{let isAllSelected=true;variant.selectedOptions.forEach(i=>{if(!selected[i.name]||selected[i.name]!==i.value){isAllSelected=false;}});return isAllSelected;});if(selectedVariant){setShopify({selectedVariant});}}},[selected,product]);if(!options.length)return null;return /*#__PURE__*/_jsx(WrapperDiv,{style:cn(styles.container,props.styles),children:options.map(option=>/*#__PURE__*/_jsxs(\"div\",{style:styles.optionWrapper,children:[/*#__PURE__*/_jsx(\"span\",{style:cn(props.variantLabel),children:option.name}),/*#__PURE__*/_jsx(\"div\",{style:cn(styles.valuesWrapper),children:option.values.map(value=>/*#__PURE__*/_jsx(motion.button,{type:\"button\",onClick:()=>setSelected(state=>({...state,[option.name]:value})),style:cn(styles.value,props.optionValue),animate:selected[option.name]===value?cn(props.selectedOptionValue):{},transition:{duration:.3},children:value},value))})]},option.id))});}addPropertyControls(Shopiframe_ProductVariants,{...BaseControls,styles:{title:\"Styles\",type:ControlType.Object,controls:{gap:{title:\"Gap\",type:ControlType.Number,defaultValue:12,min:0}}},variantLabel:{title:\"Variant Label Style\",type:ControlType.Object,controls:textProperties(14,\"#919191\")},optionValue:{title:\"Option Style\",type:ControlType.Object,controls:{...textProperties(16,\"#000\"),backgroundColor:{title:\"Background color\",type:ControlType.Color,defaultValue:\"transparent\",optional:true},border:{type:ControlType.Border},borderRadius:{type:ControlType.BorderRadius,defaultValue:\"24px\"},padding:{type:ControlType.Padding,defaultValue:\"10px 30px 10px 30px\"}}},selectedOptionValue:{title:\"Selected Option Style\",type:ControlType.Object,controls:{color:{type:ControlType.Color,defaultValue:\"#fff\"},backgroundColor:{title:\"Background color\",type:ControlType.Color,defaultValue:\"#000\"},border:{type:ControlType.Border}}}});const styles={container:{display:\"flex\",flexDirection:\"column\",flex:1},optionWrapper:{display:\"flex\",flexDirection:\"column\",gap:6},valuesWrapper:{display:\"flex\",gap:8,flexWrap:\"wrap\"},value:{cursor:\"pointer\",fontFamily:\"inherit\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Shopiframe_ProductVariants\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"wkBAIG,SAAwB,EAAQ,CAAC,eAAa,GAAM,QAAM,MAAI,EAAE,UAAQ,GAAM,OAAA,EAAO,EAAE,EAAE,CAAC,GAAK,CAAC,EAAM,GAAUI,EAAS,EAAE,CAA+E,OAA9E,MAAc,CAAI,IAAQ,GAAO,IAAQ,IAAA,IAAU,EAAS,EAAM,EAAG,CAAC,EAAM,CAAC,CAAqB,EAAM,MAAM,CAAC,MAAM,EAAG,EAAM,UAAUH,EAAO,GAAS,EAAM,QAAQ,CAAC,SAAS,CAAc,EAAK,EAAO,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,MAAM,EAAM,OAAO,SAAS,GAAS,GAAO,EAAI,YAAY,CAAC,IAAM,EAAE,KAAK,IAAI,EAAM,EAAE,EAAI,CAAC,EAAS,EAAE,CAAC,EAAS,EAAE,EAAG,SAAsB,EAAKC,EAAM,CAAC,KAAKD,EAAO,SAAS,MAAMA,EAAO,UAAU,CAAC,CAAC,CAAC,CAAc,EAAK,OAAO,CAAC,SAAS,EAAM,CAAC,CAAc,EAAK,EAAO,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,MAAM,EAAM,OAAO,SAAS,EAAQ,YAAY,CAAC,IAAM,EAAE,EAAM,EAAE,EAAS,EAAE,CAAC,EAAS,EAAE,EAAG,SAAsB,EAAKE,EAAK,CAAC,KAAKF,EAAO,SAAS,MAAMA,EAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAJzwB,IAAsC,IAAoD,I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