{"version":3,"file":"AddSample.Ub5SlrtL.mjs","names":["c","React.useState","__esmMin","init_npm_react_18_3_1","init_jsx_runtime","c","_e","addPropertyControls","init_framer_DKWANagr","init_CartStore","addToCart","AddSample","c$1","colors","done","setDone","add","e","key","sku","slugOf","href","name","image","price","priceText","currency","label","init_AddSample","s","h","ControlType"],"sources":["https:/framerusercontent.com/modules/rweMN21sych1a3o56Wls/9253ub48rVhRfzDIKpxb/AddSample.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{addToCart}from\"https://framerusercontent.com/modules/CYB1TcHqTLXk6Utuhkgj/g5wbM5Jg6IN3QM9pKgOe/CartStore.js\";const slugOf=h=>{const s=String(h||\"\").split(/[?#]/)[0].replace(/[/]+$/,\"\");return s?s.split(\"/\").pop()||\"\":\"\";};/**\n * \"Add sample\" button: adds a sample line (separate from full-box orders) to the cart.\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 48\n */export default function AddSample({name,sku,image,href,price,currency,label,colors}){const c=colors;const[done,setDone]=React.useState(false);const add=e=>{e.preventDefault();e.stopPropagation();const key=sku||slugOf(href)||name;if(!key)return;addToCart({id:\"sample-\"+key,name:name+\" — sample\",sku,image:image?.src||image,href,options:\"Sample piece\",unitPrice:Number(price)||0,qty:1,unitLabel:\"sample\",sample:true});setDone(true);setTimeout(()=>setDone(false),2e3);};const priceText=Number(price)>0?\" \\xb7 \"+currency+Number(price).toFixed(2):\"\";return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:add,\"aria-live\":\"polite\",style:{width:\"100%\",height:\"100%\",borderRadius:4,cursor:\"pointer\",fontFamily:\"Inter, sans-serif\",fontSize:15,fontWeight:500,border:\"1px solid \"+c.text,background:done?c.text:\"transparent\",color:done?c.bg:c.text,transition:\"all .25s cubic-bezier(.22,1,.36,1)\"},children:done?\"✓ Sample added\":label+priceText});}AddSample.defaultProps={name:\"Strata Pearl\",sku:\"PRL-60120-M\",price:4,currency:\"\\xa3\",label:\"Add sample\",colors:{text:\"#111111\",bg:\"#FFFFFF\"}};addPropertyControls(AddSample,{name:{type:ControlType.String},sku:{type:ControlType.String},image:{type:ControlType.ResponsiveImage},href:{type:ControlType.Link},price:{type:ControlType.Number,title:\"Sample price\",min:0,step:.5},currency:{type:ControlType.String},label:{type:ControlType.String},colors:{type:ControlType.Object,controls:{text:{type:ControlType.Color},bg:{type:ControlType.Color}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AddSample\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"48\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddSample.map"],"mappings":"A,6NAMG,SAAwBW,EAAU,CAAC,OAAK,MAAI,QAAM,OAAK,QAAM,WAAS,QAAM,UAAQ,CAAC,IAAMX,EAAEa,EAAY,CAACC,EAAKC,GAASd,EAAe,EAAK,EAAQe,EAAI,GAAG,CAACC,EAAE,eAAe,EAAEA,EAAE,gBAAgB,EAAE,IAAMC,EAAIC,GAAKC,EAAOC,CAAI,GAAGC,EAASJ,IAAWR,EAAU,CAAC,GAAG,UAAUQ,EAAI,KAAKI,EAAK,YAAY,MAAI,MAAMC,GAAO,KAAKA,EAAM,OAAK,QAAQ,eAAe,UAAU,OAAOC,CAAK,GAAG,EAAE,IAAI,EAAE,UAAU,SAAS,OAAO,EAAI,CAAC,EAAET,EAAQ,EAAI,EAAE,eAAeA,EAAQ,EAAK,EAAE,GAAG,EAAE,EAAQU,EAAU,OAAOD,CAAK,EAAE,EAAE,MAASE,EAAS,OAAOF,CAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,MAAoB,gBAAK,SAAS,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