{"version":3,"file":"GSInputStepper.CJyllRdR.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/UCS6bWFDmnKtHezQGqP2/nnyI41g86chMstmsI9Y2/GSInputStepper.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{BASE,BORDER_DEFAULT,BORDER_FOCUS,FILL,INPUT_MIN_HEIGHT,PADDING,BORDER_RADIUS_FALLBACK,FONT_INPUT,FONT_SIZE,fontStackOrFallback,cssFontSize,cssLetterSpacing,cssLineHeight}from\"https://framerusercontent.com/modules/xLLZXEXaEBlPyFlEiPAk/8MP9gw1UQ24Z3D2RvBzL/GSInputHelpers.js\";import{useStore,gsStepperFieldKeys,gsStepperFieldTitles}from\"https://framerusercontent.com/modules/coQ7sWY5qKwbci5MWUR2/rsxioBdlHOMro5tCJlWs/GuidedSellingStore.js\";GSInputStepper.defaultProps={defaultValue:1,min:1,padding:`${PADDING}px`,gap:12,colorValue:BASE,colorButton:BASE};addPropertyControls(GSInputStepper,{fieldKey:{type:ControlType.Enum,title:\"Field key\",options:[undefined,...gsStepperFieldKeys],optionTitles:[\"None (local only)\",...gsStepperFieldKeys.map(k=>gsStepperFieldTitles[k])],defaultValue:undefined},defaultValue:{type:ControlType.Number,title:\"Default value\",min:0,step:1,displayStepper:true,defaultValue:1},min:{type:ControlType.Number,title:\"Min\",step:1,displayStepper:true,defaultValue:1},max:{type:ControlType.Number,title:\"Max\",step:1,displayStepper:true},gap:{type:ControlType.Number,title:\"Gap\",min:0,step:1,displayStepper:true,defaultValue:3},valueFont:{type:ControlType.Font,title:\"Value font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:FONT_SIZE,letterSpacing:0,lineHeight:1.2,textAlign:\"center\"}},buttonFont:{type:ControlType.Font,title:\"Button font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:FONT_SIZE,letterSpacing:0,lineHeight:1,textAlign:\"center\"}},colorValue:{type:ControlType.Color,title:\"Value color\",defaultValue:BASE},colorButton:{type:ControlType.Color,title:\"Button color\",defaultValue:BASE},buttonsBorderDefault:{type:ControlType.Border,title:\"Button border default\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_DEFAULT}},buttonsBorderFocus:{type:ControlType.Border,title:\"Button border focus\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_FOCUS}},buttonsBorderHover:{type:ControlType.Border,title:\"Button border hover\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_DEFAULT}},buttonsBorderRadius:{type:ControlType.BorderRadius,title:\"Button border radius\",defaultValue:\"10px\"},padding:{type:ControlType.Padding,title:\"Button padding\",defaultValue:`${PADDING}px`}});function clampQuantity(value,min,max){let next=value;if(Number.isFinite(min))next=Math.max(min,next);if(max!=null&&Number.isFinite(max))next=Math.min(max,next);return next;}/**\n * Quantity stepper with minus / value / plus in a single row.\n * Buttons carry the fill and border; the value is plain text between them.\n * Local state only — store wiring comes later.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n */export default function GSInputStepper(props){const{fieldKey,defaultValue=1,min=1,max,style,valueFont,buttonFont,buttonsBorderDefault,buttonsBorderFocus,buttonsBorderHover,buttonsBorderRadius,padding=`${PADDING}px`,gap=3,colorValue=BASE,colorButton=BASE}=props;const[store,setStore]=useStore();const[quantity,setQuantity]=useState(()=>{if(fieldKey){const storeVal=store[fieldKey];if(typeof storeVal===\"number\"&&Number.isFinite(storeVal)){return clampQuantity(storeVal,min,max);}}return clampQuantity(defaultValue,min,max);});useEffect(()=>{if(fieldKey)setStore({[fieldKey]:quantity});},[fieldKey]);const[focusedButton,setFocusedButton]=useState(null);const[hoveredButton,setHoveredButton]=useState(null);const BORDER_FB_DEFAULT={borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_DEFAULT};const BORDER_FB_FOCUS={borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_FOCUS};const buttonBorder=(which,disabled)=>{if(focusedButton===which)return{...BORDER_FB_FOCUS,...buttonsBorderFocus};if(!disabled&&hoveredButton===which)return{...BORDER_FB_DEFAULT,...buttonsBorderHover};return{...BORDER_FB_DEFAULT,...buttonsBorderDefault};};const rootStyle={position:\"relative\",display:\"flex\",flexDirection:\"row\",alignItems:\"center\",justifyContent:\"center\",gap,width:\"100%\",height:\"100%\",boxSizing:\"border-box\",minHeight:0,...style};const valueStyle={...valueFont,flexShrink:0,margin:0,textAlign:\"center\",fontFamily:fontStackOrFallback(valueFont,FONT_INPUT),fontSize:cssFontSize(valueFont?.fontSize,FONT_SIZE),lineHeight:cssLineHeight(valueFont?.lineHeight,1.2),letterSpacing:cssLetterSpacing(valueFont?.letterSpacing),color:colorValue};const baseButtonStyle=(which,disabled)=>({...buttonFont,flexShrink:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",minHeight:INPUT_MIN_HEIGHT,boxSizing:\"border-box\",margin:0,padding,backgroundColor:FILL,borderRadius:buttonsBorderRadius??BORDER_RADIUS_FALLBACK,transition:\"border 0.15s ease, opacity 0.15s ease\",boxShadow:\"none\",outline:\"none\",cursor:\"pointer\",fontFamily:fontStackOrFallback(buttonFont,FONT_INPUT),fontSize:cssFontSize(buttonFont?.fontSize,FONT_SIZE),lineHeight:cssLineHeight(buttonFont?.lineHeight,1),letterSpacing:cssLetterSpacing(buttonFont?.letterSpacing),color:colorButton,WebkitAppearance:\"none\",appearance:\"none\",...buttonBorder(which,disabled)});const handleDecrease=()=>{setQuantity(current=>{const clamped=clampQuantity(current-1,min,max);if(fieldKey)setStore({[fieldKey]:clamped});return clamped;});};const handleIncrease=()=>{setQuantity(current=>{const clamped=clampQuantity(current+1,min,max);if(fieldKey)setStore({[fieldKey]:clamped});return clamped;});};const atMin=quantity<=min;const atMax=max!=null&&Number.isFinite(max)&&quantity>=max;return /*#__PURE__*/_jsxs(\"div\",{style:rootStyle,children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Decrease quantity\",disabled:atMin,onClick:handleDecrease,onFocus:()=>setFocusedButton(\"decrease\"),onBlur:()=>setFocusedButton(null),onMouseEnter:()=>setHoveredButton(\"decrease\"),onMouseLeave:()=>setHoveredButton(null),style:{...baseButtonStyle(\"decrease\",atMin),cursor:atMin?\"not-allowed\":\"pointer\",opacity:atMin?.4:1},children:\"−\"}),/*#__PURE__*/_jsx(\"label\",{style:valueStyle,children:quantity}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Increase quantity\",disabled:atMax,onClick:handleIncrease,onFocus:()=>setFocusedButton(\"increase\"),onBlur:()=>setFocusedButton(null),onMouseEnter:()=>setHoveredButton(\"increase\"),onMouseLeave:()=>setHoveredButton(null),style:{...baseButtonStyle(\"increase\",atMax),cursor:atMax?\"not-allowed\":\"pointer\",opacity:atMax?.4:1},children:\"+\"})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GSInputStepper\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"yYAA25E,SAAS,EAAc,EAAM,EAAI,EAAI,CAAC,IAAI,EAAK,EAAiH,OAAxG,OAAO,SAAS,EAAI,GAAC,EAAK,KAAK,IAAI,EAAI,EAAK,EAAI,GAAK,MAAM,OAAO,SAAS,EAAI,GAAC,EAAK,KAAK,IAAI,EAAI,EAAK,EAAQ,EAO/jF,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,WAAS,eAAa,EAAE,MAAI,EAAE,MAAI,QAAM,YAAU,aAAW,uBAAqB,qBAAmB,qBAAmB,sBAAoB,UAAQ,GAAG,EAAQ,IAAI,MAAI,EAAE,aAAW,EAAK,cAAY,GAAM,EAAW,CAAC,EAAM,GAAU,GAAU,CAAM,CAAC,EAAS,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