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 line
6.8 KiB

2 years ago
{"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