{"version":3,"file":"QuantitySelector.DTLheeI2.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/V8PQWPputF8mpZbTcxxz/StRJHnNY76OH9I8D8NPp/QuantitySelector.js"],"sourcesContent":["// Quantity selector with per-quantity colors and button text options\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Quantity Selector with per-quantity colour & button text flexibility\n *\n * @framerIntrinsicWidth 250\n * @framerIntrinsicHeight 140\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function QuantitySelector(props){const{options=[{label:\"1\",link:\"https://framer.com/one\",buttonLabel:\"Buy 1\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"},{label:\"2\",link:\"https://framer.com/two\",buttonLabel:\"Buy 2\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"},{label:\"3\",link:\"https://framer.com/three\",buttonLabel:\"Buy 3\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"}],defaultButtonLabel,mainBg,selectorBorderRadius,selectorFont,buttonBg,buttonTextColor,buttonFont,buttonBorderRadius,style}=props;const[selected,setSelected]=useState(0);// Always pull buttonLabel from prop directly to ensure reactivity\nconst current=options[selected]||options[0];// Directly derive buttonLabel from current option so it's always up-to-date\nconst buttonLabel=current&&current.buttonLabel&&current.buttonLabel.length>0?current.buttonLabel:defaultButtonLabel;function handleSelect(i){startTransition(()=>setSelected(i));}function handleButton(){if(typeof window!==\"undefined\"&&current?.link){window.open(current.link,\"_blank\",\"noopener,noreferrer\");}}return /*#__PURE__*/_jsxs(\"div\",{style:{...style,background:mainBg,padding:20,borderRadius:12,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:18,width:\"100%\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:10,width:\"100%\",justifyContent:\"center\"},children:options.map((opt,i)=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":`Select ${opt.label}`,onClick:()=>handleSelect(i),style:{minWidth:36,minHeight:36,borderRadius:selectorBorderRadius,border:selected===i?`2px solid ${opt.selectorActiveBg}`:`1px solid #DDD`,background:selected===i?opt.selectorActiveBg:opt.selectorBg,color:selected===i?opt.selectorActiveTextColor:opt.selectorTextColor,cursor:\"pointer\",fontWeight:\"bold\",outline:\"none\",...selectorFont,transition:\"all 0.15s cubic-bezier(.5,1.6,.2,1)\"},children:opt.label},i))}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:handleButton,style:{marginTop:10,minWidth:120,padding:\"10px 22px\",borderRadius:buttonBorderRadius,border:\"none\",background:buttonBg,color:buttonTextColor,cursor:\"pointer\",...buttonFont,transition:\"all 0.15s cubic-bezier(.5,1.6,.2,1)\"},\"aria-label\":current.link?`Go to: ${current.link}`:\"Go\",children:buttonLabel})]});}addPropertyControls(QuantitySelector,{options:{type:ControlType.Array,title:\"Quantities\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"1\"},link:{type:ControlType.String,title:\"Button Link\",defaultValue:\"https://framer.com\"},buttonLabel:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Buy\"},selectorBg:{type:ControlType.Color,title:\"Selector BG\",defaultValue:\"#FFFFFF\"},selectorActiveBg:{type:ControlType.Color,title:\"Selector Active BG\",defaultValue:\"#222222\"},selectorTextColor:{type:ControlType.Color,title:\"Selector Text\",defaultValue:\"#222222\"},selectorActiveTextColor:{type:ControlType.Color,title:\"Selector Active Text\",defaultValue:\"#FFFFFF\"}}},maxCount:5,defaultValue:[{label:\"1\",link:\"https://framer.com/one\",buttonLabel:\"Buy 1\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"},{label:\"2\",link:\"https://framer.com/two\",buttonLabel:\"Buy 2\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"},{label:\"3\",link:\"https://framer.com/three\",buttonLabel:\"Buy 3\",selectorBg:\"#FFFFFF\",selectorActiveBg:\"#222222\",selectorTextColor:\"#222222\",selectorActiveTextColor:\"#FFFFFF\"}]},defaultButtonLabel:{type:ControlType.String,title:\"Default Button Text\",defaultValue:\"Buy\",placeholder:\"Edit button text here\"},mainBg:{type:ControlType.Color,title:\"Main BG\",defaultValue:\"#FFFFFF\"},selectorBorderRadius:{type:ControlType.Number,title:\"Selector Radius\",defaultValue:8,min:0,max:20},selectorFont:{type:ControlType.Font,title:\"Selector Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:18,variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},buttonBg:{type:ControlType.Color,title:\"Button BG\",defaultValue:\"#222222\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:17,variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},buttonBorderRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:10,min:0,max:30}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"QuantitySelector\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"250\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"140\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./QuantitySelector.map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