You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.8 KiB
1 lines
6.8 KiB
{"ast":null,"code":"var _jsxFileName = \"/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/components/CustomSwitch/index.js\",\n _s = $RefreshSig$();\n\nimport { useState } from \"react\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nimport { Fragment as _Fragment } from \"react/jsx-dev-runtime\";\n\nconst CustomSwitch = _ref => {\n _s();\n\n let {\n defaultValue,\n set,\n values,\n label,\n className,\n register\n } = _ref;\n const [value, setValue] = useState(defaultValue);\n return /*#__PURE__*/_jsxDEV(_Fragment, {\n children: [label && /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"mx-1 text-xs\",\n children: label\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 15,\n columnNumber: 17\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n onClick: () => {\n setValue(!value);\n register.onChange({\n target: {\n name: register.name,\n value: !value\n }\n });\n },\n className: `${className} flex border relative w-full ${values ? \"rounded-md h-full min-h-[35px]\" : \" rounded-md h-9 aspect-[1/2]\"}`,\n children: [/*#__PURE__*/_jsxDEV(\"input\", {\n type: \"checkbox\",\n ...register,\n checked: value ? \"checked\" : \"\",\n className: \"hidden\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n transform: `translateX(${value ? 0 : -100}%)`\n },\n className: `${value || values ? \"bg-blue-500\" : \"bg-gray-300\"} absolute right-[2%] top-[5%] z-0 transition-all duration-300 ${values ? \"h-[90%] rounded w-[48%]\" : \"h-[89%] rounded-full aspect-square\"}`\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 33,\n columnNumber: 9\n }, this), values ? /*#__PURE__*/_jsxDEV(\"div\", {\n className: \" w-[98%] h-[90%] flex flex-row-reverse right-[1%] top-[5%] z-10 absolute text-xs \",\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \" w-1/2 h-full flex items-center justify-center cursor-pointer text-xs text-white \" + (value ? \" text-[#0F0543] \" : \"\"),\n children: values[1]\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 45,\n columnNumber: 13\n }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n className: \" w-1/2 h-full flex items-center justify-center cursor-pointer text-xs text-white \" + (!value ? \" text-[#0F0543] \" : \"\"),\n children: values[0]\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 53,\n columnNumber: 13\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 44,\n columnNumber: 11\n }, this) : null]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 16,\n columnNumber: 7\n }, this)]\n }, void 0, true);\n};\n\n_s(CustomSwitch, \"+di++irDcPspjmhJVP9frUKGzpo=\");\n\n_c = CustomSwitch;\nexport default CustomSwitch;\n\nvar _c;\n\n$RefreshReg$(_c, \"CustomSwitch\");","map":{"version":3,"names":["useState","CustomSwitch","defaultValue","set","values","label","className","register","value","setValue","onChange","target","name","transform"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/components/CustomSwitch/index.js"],"sourcesContent":["import { useState } from \"react\";\n\nconst CustomSwitch = ({\n defaultValue,\n set,\n values,\n label,\n className,\n register,\n}) => {\n const [value, setValue] = useState(defaultValue);\n\n return (\n <>\n {label && <div className={\"mx-1 text-xs\"}>{label}</div>}\n <div\n onClick={() => {\n setValue(!value);\n register.onChange({ target: { name: register.name, value: !value } });\n }}\n className={`${className} flex border relative w-full ${\n values\n ? \"rounded-md h-full min-h-[35px]\"\n : \" rounded-md h-9 aspect-[1/2]\"\n }`}\n >\n <input\n type=\"checkbox\"\n {...register}\n checked={value ? \"checked\" : \"\"}\n className=\"hidden\"\n />\n <div\n style={{ transform: `translateX(${value ? 0 : -100}%)` }}\n className={`${\n value || values ? \"bg-blue-500\" : \"bg-gray-300\"\n } absolute right-[2%] top-[5%] z-0 transition-all duration-300 ${\n values\n ? \"h-[90%] rounded w-[48%]\"\n : \"h-[89%] rounded-full aspect-square\"\n }`}\n ></div>\n {values ? (\n <div className=\" w-[98%] h-[90%] flex flex-row-reverse right-[1%] top-[5%] z-10 absolute text-xs \">\n <div\n className={\n \" w-1/2 h-full flex items-center justify-center cursor-pointer text-xs text-white \" +\n (value ? \" text-[#0F0543] \" : \"\")\n }\n >\n {values[1]}\n </div>\n <div\n className={\n \" w-1/2 h-full flex items-center justify-center cursor-pointer text-xs text-white \" +\n (!value ? \" text-[#0F0543] \" : \"\")\n }\n >\n {values[0]}\n </div>\n </div>\n ) : null}\n </div>\n </>\n );\n};\n\nexport default CustomSwitch;\n"],"mappings":";;;AAAA,SAASA,QAAT,QAAyB,OAAzB;;;;AAEA,MAAMC,YAAY,GAAG,QAOf;EAAA;;EAAA,IAPgB;IACpBC,YADoB;IAEpBC,GAFoB;IAGpBC,MAHoB;IAIpBC,KAJoB;IAKpBC,SALoB;IAMpBC;EANoB,CAOhB;EACJ,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoBT,QAAQ,CAACE,YAAD,CAAlC;EAEA,oBACE;IAAA,WACGG,KAAK,iBAAI;MAAK,SAAS,EAAE,cAAhB;MAAA,UAAiCA;IAAjC;MAAA;MAAA;MAAA;IAAA,QADZ,eAEE;MACE,OAAO,EAAE,MAAM;QACbI,QAAQ,CAAC,CAACD,KAAF,CAAR;QACAD,QAAQ,CAACG,QAAT,CAAkB;UAAEC,MAAM,EAAE;YAAEC,IAAI,EAAEL,QAAQ,CAACK,IAAjB;YAAuBJ,KAAK,EAAE,CAACA;UAA/B;QAAV,CAAlB;MACD,CAJH;MAKE,SAAS,EAAG,GAAEF,SAAU,mCACtBF,MAAM,GACF,iCADE,GAEF,8BACL,EATH;MAAA,wBAWE;QACE,IAAI,EAAC,UADP;QAAA,GAEMG,QAFN;QAGE,OAAO,EAAEC,KAAK,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