{"version":3,"file":"Slider.EVsDAnND.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/LLEq54aHhsZdY00ja9ye/53RI0AWF7S000bwQZraF/Slider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useState}from\"react\";import{useInstanceId}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/p64C0n6xNEFY9NovSiJw/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 400\n * @framerDisableUnlink\n */export default function Slider(props){var _handle_border,_handle_border1;const{min,max,step,defaultValue,line,handle,label}=props;const id=useInstanceId();const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[value,setValue]=useState(defaultValue);const[focused,setFocused]=useState(false);function onFocus(){var _props_focusEvent;setFocused(true);(_props_focusEvent=props.focusEvent)===null||_props_focusEvent===void 0?void 0:_props_focusEvent.call(props);}function onBlur(){var _props_blurEvent;setFocused(false);(_props_blurEvent=props.blurEvent)===null||_props_blurEvent===void 0?void 0:_props_blurEvent.call(props);}var _handle_border_color;const handleCSS=`appearance: none;\n        -webkit-appearance: none;\n        width: ${handle.size}px;\n        height: ${handle.size}px;\n        border-radius: ${handle.radius};\n        background-color: ${handle.fill};\n        box-sizing: border-box;\n        translate: 0 ${(-handle.size+line.height)/2-(line.border?Math.min(line.border.width,line.height/2):0)}px;\n        border-width: ${((_handle_border=handle.border)===null||_handle_border===void 0?void 0:_handle_border.width)||0}px;\n        border-style: ${handle.border?\"solid\":\"none\"};\n        border-color: ${(_handle_border_color=(_handle_border1=handle.border)===null||_handle_border1===void 0?void 0:_handle_border1.color)!==null&&_handle_border_color!==void 0?_handle_border_color:\"none\"};\n        box-shadow: ${handle.shadows};`;const lineCSS=`appearance: none;\n        -webkit-appearance: none;\n        height: ${line.height}px;`;const finalValue=isCanvas?defaultValue:value;const percent=getPercentage(finalValue,min,max);var _label_gap;return /*#__PURE__*/_jsxs(\"div\",{\"data-framerforms\":true,id:id,style:{display:\"flex\",flexDirection:(label===null||label===void 0?void 0:label.location)==\"right\"?\"row-reverse\":\"row\",gap:(_label_gap=label===null||label===void 0?void 0:label.gap)!==null&&_label_gap!==void 0?_label_gap:0,alignItems:\"center\",...props.style},children:[label&&/*#__PURE__*/_jsxs(\"p\",{style:{margin:0,minWidth:label.minWidth,color:label.fontColor,...label.font},children:[label.prefix,label.formatted?formatNumberToLocale(finalValue,label.locale):finalValue,label.suffix]}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",flex:1,height:Math.max(handle.size,line.height),display:\"flex\",flexDirection:\"row\",alignItems:\"center\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{height:line.height,background:`linear-gradient(to right, ${line.leftFill} ${percent}%, ${line.rightFill} ${percent}%)`,boxShadow:line.shadows,borderRadius:line.radius,flex:1}}),/*#__PURE__*/_jsx(\"input\",{type:\"range\",name:props.name,min:min,max:max,step:step,value:finalValue,onChange:event=>setValue(Number(event.target.value)),onFocus:onFocus,onBlur:onBlur,style:{position:\"absolute\",inset:0,display:\"block\",appearance:\"none\",outline:\"none\",margin:0,cursor:\"pointer\",background:\"none\"}})]}),/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n                    #${id} input[type=range]::-webkit-slider-thumb {${handleCSS}}\n                    #${id} input[type=range]::-moz-range-thumb {${handleCSS}}\n\n                    #${id} input[type=range]::-webkit-slider-runnable-track {${lineCSS}}\n                    #${id} input[type=range]::-moz-range-track {${lineCSS}}\n                    #${id} input[type=range]::-moz-range-progress {${lineCSS}}`}})]});}addPropertyControls(Slider,{name:{type:ControlType.String,defaultValue:\"Slider\",placeholder:\"Name\",preventLocalization:true},defaultValue:{type:ControlType.Number,defaultValue:50,title:\"Default\"},min:{title:\"Min\",type:ControlType.Number,defaultValue:0},max:{title:\"Max\",type:ControlType.Number,defaultValue:100},step:{type:ControlType.Number,defaultValue:1},line:{type:ControlType.Object,buttonTitle:\"Style\",controls:{height:{type:ControlType.Number,defaultValue:4,min:1,step:1,displayStepper:true},leftFill:{type:ControlType.Color,defaultValue:\"#0099FF\"},rightFill:{type:ControlType.Color,defaultValue:\"rgba(187, 187, 187, 0.3)\"},radius:{type:ControlType.BorderRadius,defaultValue:\"2px\"},shadows:{type:ControlType.BoxShadow}}},handle:{type:ControlType.Object,buttonTitle:\"Style\",icon:\"boolean\",controls:{size:{type:ControlType.Number,defaultValue:16,min:0,step:1},fill:{type:ControlType.Color,defaultValue:\"#FFF\"},radius:{type:ControlType.BorderRadius,defaultValue:\"8px\"},border:{type:ControlType.Object,optional:true,controls:{color:{type:ControlType.Color,defaultValue:\"#222\"},width:{type:ControlType.Number,defaultValue:1,min:0,step:1,displayStepper:true},style:{type:ControlType.Enum,defaultValue:\"solid\",options:[\"solid\",\"dashed\",\"dotted\",\"double\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\",\"Double\"]}}},shadows:{type:ControlType.BoxShadow,defaultValue:\"0px 4px 6px 0px rgba(0, 0, 0, 0.2)\"}}},label:{type:ControlType.Object,optional:true,controls:{location:{type:ControlType.Enum,defaultValue:\"left\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],displaySegmentedControl:true},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.2}},fontColor:{type:ControlType.Color,defaultValue:\"#999999\",title:\"Color\"},formatted:{type:ControlType.Boolean,defaultValue:true},locale:{type:ControlType.String,defaultValue:\"\",placeholder:`Auto (${typeof navigator!==\"undefined\"?navigator.language:\"\"})`,hidden:props=>!props.formatted},minWidth:{type:ControlType.Number,defaultValue:24,min:0,step:1},gap:{type:ControlType.Number,defaultValue:10,min:0,step:1},prefix:{type:ControlType.String,defaultValue:\"\"},suffix:{type:ControlType.String,defaultValue:\"\"}}},focusEvent:{type:ControlType.EventHandler,title:\"Focus\"},blurEvent:{type:ControlType.EventHandler,title:\"Blur\"}});function getPercentage(value,min,max){// Ensure min is less than max by swapping if necessary\nif(min>max){[min,max]=[max,min];}// Clamp the value to be within the min and max range\nvalue=Math.max(min,Math.min(value,max));// Handle the edge case where min equals max to avoid division by zero\nif(min===max){return 100;}const percentage=(value-min)/(max-min)*100;return percentage;}function formatNumberToLocale(number,locale){if(typeof Intl!==\"undefined\"){const formatter=new Intl.NumberFormat(locale||typeof navigator!==\"undefined\"?navigator.language:\"en-us\");return formatter.format(number);}else{return number.toString();}}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Slider\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"8PAKG,SAAwB,EAAO,EAAM,CAAoC,GAAK,CAAC,MAAI,MAAI,OAAK,eAAa,OAAK,SAAO,SAAO,EAAY,EAAG,GAAe,CAAO,EAAS,EAAa,SAAS,GAAG,EAAa,OAAY,CAAC,EAAM,GAAUA,EAAS,EAAa,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAAC,SAAS,GAAS,CAAC,IAAI,EAAkB,EAAW,GAAK,EAAE,EAAkB,EAAM,aAAc,MAAwC,EAAkB,KAAK,EAAM,CAAE,SAAS,GAAQ,CAAC,IAAI,EAAiB,EAAW,GAAM,EAAE,EAAiB,EAAM,YAAa,MAAuC,EAAiB,KAAK,EAAM,CAA2B,IAAM,EAAU;;iBAEppB,EAAO,KAAK;kBACX,EAAO,KAAK;yBACL,EAAO,OAAO;4BACX,EAAO,KAAK;;wBAEhB,CAAC,EAAO,KAAK,EAAK,QAAQ,GAAG,EAAK,OAAO,KAAK,IAAI,EAAK,OAAO,MAAM,EAAK,OAAO,EAAE,CAAC,GAAG;wBACrE,EAAO,QAA8D,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