{"version":3,"file":"AddToBag.CyFlFSUF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/3a7ZAEyWwTC4dTVOL0WE/bP2YPdw6pVMfjemAuxNo/AddToBag.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";const IVORY=\"#F2EFE7\";const INK=\"#192126\";const SANS='\"Inter\", \"Helvetica Neue\", Arial, sans-serif';/**\n * KELDA Add To Bag — sends the Shopify variant to the cart engine.\n *\n * Set the Shopify Variant ID control (numeric ID or full gid:// ID).\n * On CMS pages, bind it to the \"Shopify Variant ID\" field so every page\n * sells exactly the same Shopify product. Dispatches kelda:cart:add,\n * which the Cart Drawer placed in the layout template handles.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function AddToBag(props){const{variantId=\"\",quantity=1,label=\"Add to bag\",appearance=\"solid\",fullWidth=false,productTitle=\"\",price=0,size=\"\",image=undefined}=props;const[pending,setPending]=useState(false);useEffect(()=>{if(!pending||typeof window===\"undefined\")return;const done=()=>setPending(false);window.addEventListener(\"kelda:cart:change\",done);const t=window.setTimeout(done,6e3);return()=>{window.removeEventListener(\"kelda:cart:change\",done);window.clearTimeout(t);};},[pending]);const add=()=>{if(typeof window===\"undefined\")return;setPending(true);window.dispatchEvent(new CustomEvent(\"kelda:cart:add\",{detail:{variantId:variantId.trim(),quantity:Math.max(1,quantity),productTitle,price,size,image:image?.src||\"\"}}));};const solid=appearance===\"solid\";const light=appearance===\"light\";return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",width:fullWidth?\"100%\":undefined},children:/*#__PURE__*/_jsx(\"button\",{onClick:add,disabled:pending,\"aria-label\":label,style:{width:fullWidth?\"100%\":undefined,minWidth:\"max-content\",border:solid||light?\"none\":\"1px solid \"+INK,background:light?IVORY:solid?INK:\"transparent\",color:solid?IVORY:INK,fontFamily:SANS,fontSize:13,letterSpacing:\"0.08em\",textTransform:\"uppercase\",padding:\"16px 30px\",cursor:\"pointer\",opacity:pending?.6:1,transition:\"opacity 0.2s ease\"},children:pending?\"Adding…\":label})});}addPropertyControls(AddToBag,{variantId:{type:ControlType.String,title:\"Variant ID\",placeholder:\"e.g. 45678901234567\",defaultValue:\"\"},quantity:{type:ControlType.Number,title:\"Quantity\",defaultValue:1,min:1,max:20,displayStepper:true},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Add to bag\"},productTitle:{type:ControlType.String,title:\"Product Title\",defaultValue:\"\"},price:{type:ControlType.Number,title:\"Price\",defaultValue:0,min:0},size:{type:ControlType.String,title:\"Size\",defaultValue:\"\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},appearance:{type:ControlType.Enum,title:\"Appearance\",options:[\"solid\",\"outline\",\"light\"],optionTitles:[\"Solid\",\"Outline\",\"Light\"],defaultValue:\"solid\",displaySegmentedControl:true},fullWidth:{type:ControlType.Boolean,title:\"Full Width\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AddToBag\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddToBag.map"],"mappings":"+LAUG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,YAAU,GAAG,WAAS,EAAE,QAAM,aAAa,aAAW,QAAQ,YAAU,GAAM,eAAa,GAAG,QAAM,EAAE,OAAK,GAAG,QAAM,IAAA,IAAW,EAAW,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAE,MAAc,CAAC,GAAG,CAAC,GAAgB,IAAS,OAAY,OAAO,IAAM,MAAS,EAAW,EAAK,EAAE,EAAO,iBAAiB,oBAAoB,CAAI,EAAE,IAAM,EAAE,EAAO,WAAW,EAAK,GAAG,EAAE,UAAU,CAAC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