{"version":3,"file":"QuantitySelector.CosML7Xa.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/OJQ8s1Dml1seAOW4d2HN/NdqptJyafMkYSJ3clxob/QuantitySelector.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Product Quantity Button\n * \n * A component that allows users to increase or decrease product quantity.\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function QuantitySelector(props){const{initialQuantity=1,minQuantity=0,maxQuantity=99,buttonColor=\"#000000\",disabledButtonColor=\"#CCCCCC\",disabledTextColor=\"#FFFFFF\",textColor=\"#000000\",backgroundColor=\"#FFFFFF\",borderColor=\"#EEEEEE\",borderRadius=8,buttonFont,quantityFont,style}=props;const[quantity,setQuantity]=useState(initialQuantity);const decreaseQuantity=()=>{if(quantity>minQuantity){startTransition(()=>setQuantity(quantity-1));}};const increaseQuantity=()=>{if(quantity<maxQuantity){startTransition(()=>setQuantity(quantity+1));}};const isFixedWidth=style?.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",backgroundColor,border:`1px solid ${borderColor}`,borderRadius,padding:\"8px 12px\",width:isFixedWidth?\"100%\":\"fit-content\",minWidth:\"120px\",boxSizing:\"border-box\",...style},children:[/*#__PURE__*/_jsx(\"button\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:quantity<=minQuantity?disabledButtonColor:buttonColor,color:quantity<=minQuantity?disabledTextColor:\"#FFFFFF\",border:\"none\",borderRadius:borderRadius-2,width:\"28px\",height:\"28px\",cursor:quantity<=minQuantity?\"not-allowed\":\"pointer\",fontSize:\"16px\",fontWeight:\"bold\",padding:0,...buttonFont},onClick:decreaseQuantity,disabled:quantity<=minQuantity,\"aria-label\":\"Decrease quantity\",children:\"-\"}),/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,fontSize:\"16px\",fontWeight:\"medium\",padding:\"0 12px\",...quantityFont},\"aria-live\":\"polite\",\"aria-label\":`Quantity: ${quantity}`,children:quantity}),/*#__PURE__*/_jsx(\"button\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:buttonColor,color:\"#FFFFFF\",border:\"none\",borderRadius:borderRadius-2,width:\"28px\",height:\"28px\",cursor:\"pointer\",fontSize:\"16px\",fontWeight:\"bold\",padding:0,...buttonFont},onClick:increaseQuantity,disabled:quantity>=maxQuantity,\"aria-label\":\"Increase quantity\",children:\"+\"})]});}addPropertyControls(QuantitySelector,{initialQuantity:{type:ControlType.Number,title:\"Initial Quantity\",defaultValue:1,min:0,max:99,step:1},minQuantity:{type:ControlType.Number,title:\"Min Quantity\",defaultValue:0,min:0,max:99,step:1},maxQuantity:{type:ControlType.Number,title:\"Max Quantity\",defaultValue:99,min:1,max:999,step:1},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},disabledButtonColor:{type:ControlType.Color,title:\"Disabled Button\",defaultValue:\"#CCCCCC\"},disabledTextColor:{type:ControlType.Color,title:\"Disabled Text\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#EEEEEE\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:20,step:1},buttonFont:{type:ControlType.Font,title:\"Button Font\",defaultValue:{fontSize:\"16px\",variant:\"Bold\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},quantityFont:{type:ControlType.Font,title:\"Quantity Font\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"QuantitySelector\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./QuantitySelector.map"],"mappings":"yLAOG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,kBAAgB,EAAE,cAAY,EAAE,cAAY,GAAG,cAAY,UAAU,sBAAoB,UAAU,oBAAkB,UAAU,YAAU,UAAU,kBAAgB,UAAU,cAAY,UAAU,eAAa,EAAE,aAAW,eAAa,SAAO,EAAW,CAAC,EAAS,GAAaA,EAAS,CAAe,EAAQ,MAAqB,CAAI,EAAS,GAAa,MAAoB,EAAY,EAAS,CAAC,CAAC,CAAG,EAAQ,MAAqB,CAAI,EAAS,GAAa,MAAoB,EAAY,EAAS,CAAC,CAAC,CAAG,EAAQ,EAAa,GAAO,QAAQ,OAAO,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,QAAQ,OAAO,WAAW,SAAS,eAAe,gBAAgB,kBAAgB,OAAO,aAAa,IAAc,eAAa,QAAQ,WAAW,MAAM,EAAa,OAAO,cAAc,SAAS,QAAQ,UAAU,aAAa,GAAG,CAAK,EAAE,SAAS,CAAc,EAAK,SAAS,CAAC,MAAM,CAAC,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,gBAAgB,GAAU,EAAY,EAAoB,EAAY,MAAM,GAAU,EAAY,EAAkB,UAAU,OAAO,OAAO,aAAa,EAAa,EAAE,MAAM,OAAO,OAAO,OAAO,OAAO,GAAU,EAAY,cAAc,UAAU,SAAS,OAAO,WAAW,OAAO,QAAQ,EAAE,GAAG,CAAU,EAAE,QAAQ,EAAiB,SAAS,GAAU,EAAY,aAAa,oBAAoB,SAAS,GAAG,CAAC,EAAe,EAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAU,SAAS,OAAO,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