{"version":3,"file":"AreaSlider.DfjDIput.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/umY0hyTk2C9SbBLSi4Mn/ISYSsfobdzP4unTtGXEq/AreaSlider.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{calculatorStore,setArea,subscribeToCalc}from\"https://framerusercontent.com/modules/Ev7DBUcheUudtixI61L5/ARMoRucR4oHFCntQB125/CalculatorStore.js\";export default function AreaSlider(props){const{min,max,label,defaultArea,accentColor,hideLabels,initMode}=props;const[localArea,setLocalArea]=React.useState(defaultArea);// Preklad: Ak je vybraté \"Áno (Master)\", tak isMaster = true\nconst isMaster=initMode===\"master\";// --- INICIALIZÁCIA ---\nReact.useLayoutEffect(()=>{// Ak som MASTER (Áno): Vezmem defaultArea a vnútim ju do obchodu\nif(isMaster&&typeof defaultArea===\"number\"){setLocalArea(defaultArea);setArea(defaultArea);}else if(!isMaster){setLocalArea(calculatorStore.area);}},[defaultArea,isMaster]);// --- SYNCHRONIZÁCIA ---\nReact.useEffect(()=>{const unsubscribe=subscribeToCalc(()=>{if(calculatorStore.area!==localArea){setLocalArea(calculatorStore.area);}});return unsubscribe;},[localArea]);const handleChange=e=>{const val=Number(e.target.value);setLocalArea(val);setArea(val);};const percentage=(localArea-min)/(max-min)*100;return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                input[type=range].custom-slider {\n                    -webkit-appearance: none;\n                    width: 100%;\n                    background: transparent;\n                    cursor: pointer;\n                    /* FIX POSUNU DO STRANY */\n                    margin: 0;\n                    padding: 0;\n                    display: block;\n                }\n                \n                input[type=range].custom-slider:focus {\n                    outline: none;\n                }\n\n                input[type=range].custom-slider::-webkit-slider-runnable-track {\n                    width: 100%;\n                    height: 10px;\n                    cursor: pointer;\n                    background: linear-gradient(to right, ${accentColor} 0%, ${accentColor} ${percentage}%, rgba(0,0,0,0.1) ${percentage}%, rgba(0,0,0,0.1) 100%);\n                    border-radius: 6px;\n                    border: none;\n                }\n\n                input[type=range].custom-slider::-webkit-slider-thumb {\n                    height: 32px;\n                    width: 32px;\n                    border-radius: 50%;\n                    background: ${accentColor};\n                    cursor: grab;\n                    -webkit-appearance: none;\n                    /* FIX VERTIK\\xc1LNEHO POSUNU: Zmenen\\xe9 z -10px na -11px */\n                    margin-top: -11px;\n                    box-shadow: 0 2px 6px rgba(0,0,0,0.2);\n                    border: none;\n                    transition: transform 0.1s ease;\n                }\n                \n                input[type=range].custom-slider::-webkit-slider-thumb:hover {\n                    transform: scale(1.1);\n                }\n\n                input[type=range].custom-slider::-moz-range-track {\n                    width: 100%;\n                    height: 12px;\n                    cursor: pointer;\n                    background: linear-gradient(to right, ${accentColor} 0%, ${accentColor} ${percentage}%, rgba(0,0,0,0.1) ${percentage}%, rgba(0,0,0,0.1) 100%);\n                    border-radius: 6px;\n                    border: none;\n                }\n\n                input[type=range].custom-slider::-moz-range-thumb {\n                    height: 32px;\n                    width: 32px;\n                    border: none;\n                    border-radius: 50%;\n                    background: ${accentColor};\n                    cursor: grab;\n                    box-shadow: 0 2px 6px rgba(0,0,0,0.2);\n                    transition: transform 0.1s ease;\n                }\n\n                input[type=range].custom-slider::-moz-range-thumb:hover {\n                    transform: scale(1.1);\n                }\n            `}),!hideLabels&&/*#__PURE__*/_jsxs(\"div\",{style:labelStyle,children:[/*#__PURE__*/_jsx(\"span\",{children:label}),/*#__PURE__*/_jsxs(\"span\",{children:[localArea,\" m\\xb2\"]})]}),/*#__PURE__*/_jsx(\"input\",{type:\"range\",min:min,max:max,value:localArea,onChange:handleChange,className:\"custom-slider\"})]});}addPropertyControls(AreaSlider,{// DROPDOWN S PÔVODNÝMI TEXTAMI\ninitMode:{type:ControlType.Enum,title:\"Inicializovať?\",options:[\"master\",\"slave\"],optionTitles:[\"\\xc1no (Master)\",\"Nie (Slave)\"],defaultValue:\"master\",description:\"Zapnite iba na hlavnom Slidri (CMS). Na duplik\\xe1toch vypnite.\"},hideLabels:{type:ControlType.Boolean,title:\"Iba slider\",defaultValue:false,enabledTitle:\"\\xc1no\",disabledTitle:\"Nie\"},label:{type:ControlType.String,defaultValue:\"Zastavan\\xe1 plocha\",hidden:props=>props.hideLabels===true},defaultArea:{type:ControlType.Number,title:\"Plocha (m\\xb2)\",defaultValue:100,min:0,max:1e3,// Skryjeme, ak je nastavené \"Nie (Slave)\", lebo vtedy sa plocha ignoruje\nhidden:props=>props.initMode===\"slave\"},min:{type:ControlType.Number,defaultValue:50,title:\"Minimum\"},max:{type:ControlType.Number,defaultValue:500,title:\"Maximum\"},accentColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#0099ff\"}});const containerStyle={padding:\"10px 0\",fontFamily:\"Archivo, sans-serif\",width:\"100%\"};const labelStyle={display:\"flex\",justifyContent:\"space-between\",marginBottom:15,fontSize:16,fontWeight:600,color:\"#333\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AreaSlider\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"mQAAiS,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,MAAI,MAAI,QAAM,cAAY,cAAY,aAAW,YAAU,EAAW,CAAC,EAAU,GAAcA,EAAe,EAAY,CACrc,EAAS,IAAW,SAC1B,MAA0B,CACvB,GAAU,OAAO,GAAc,UAAU,EAAa,EAAY,CAAC,EAAQ,EAAY,EAAW,GAAU,EAAa,EAAgB,KAAK,EAAI,CAAC,EAAY,EAAS,CAAC,CAC5K,MAAuC,MAAoB,CAAI,EAAgB,OAAO,GAAW,EAAa,EAAgB,KAAK,EAAI,CAAsB,CAAC,EAAU,CAAC,CAAC,IAAM,EAAa,GAAG,CAAC,IAAM,EAAI,OAAO,EAAE,OAAO,MAAM,CAAC,EAAa,EAAI,CAAC,EAAQ,EAAI,EAAS,G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