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
8.6 KiB

2 years ago
{"ast":null,"code":"var _jsxFileName = \"/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/components/AnimatedInput/Input.js\",\n _s = $RefreshSig$();\n\nimport React, { useState } from \"react\";\nimport fixNumbers from \"./fixNumbers\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Input = _ref => {\n _s();\n\n let {\n defaultValue,\n set,\n label,\n borderClassname,\n inputClassname,\n placeholderClass,\n activePlaceholderClass,\n type,\n maxLength,\n max,\n min,\n register,\n onClick,\n icon,\n iconClassName\n } = _ref;\n const [value, setValue] = useState(defaultValue);\n console.log(value);\n return /*#__PURE__*/_jsxDEV(\"div\", {\n onClick: onClick,\n className: \"h-full w-full flex flex-row items-center rounded relative bg-[#F9F9F9] \" + borderClassname + (value ? \" bg-white border rounded \" : \" bg-white \"),\n children: [/*#__PURE__*/_jsxDEV(\"div\", {\n className: \"text-xs absolute transition-all duration-300 pointer-events-none px-3 transform -translate-x-[4px]\" + (value ? ` ${activePlaceholderClass} + top-[-10px]` : ` ${placeholderClass} + top-[10px]`),\n children: label\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 32,\n columnNumber: 7\n }, this), type !== \"textarea\" ? /*#__PURE__*/_jsxDEV(\"input\", { ...register,\n maxLength: maxLength,\n value: value,\n type: \"text\",\n onInput: e => {\n let value = e.target.value;\n if (type === \"number\") value = fixNumbers(value).replace(/[^\\d.-]/g, \"\");\n if (maxLength && value.length > maxLength) value = value.slice(0, maxLength);\n if (!isNaN(max) && +e.target.value > max) value = max;\n if (!isNaN(min) && +e.target.value < min) value = min;\n e.target.value = value;\n },\n className: `rtl w-full h-full outline-0 text-xs rounded-md border-transparent focus:border-transparent focus:ring-transparent ${inputClassname} \n ${!value ? \"bg-[#F9F9F9] \" : \"bg-white\"} `,\n onChange: e => setValue(e.target.value),\n inputMode: type === \"number\" ? \"numeric\" : \"\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 43,\n columnNumber: 9\n }, this) : /*#__PURE__*/_jsxDEV(\"textarea\", { ...register,\n className: `rtl w-full h-full p-4 outline-0 resize-none text-xs rounded-md border-transparent focus:border-transparent focus:ring-transparent ${!value ? \"bg-[#F9F9F9] \" : \"bg-white\"}`,\n onChange: e => setValue(e.target.value),\n children: value\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 64,\n columnNumber: 9\n }, this), icon && /*#__PURE__*/_jsxDEV(\"img\", {\n src: icon,\n alt: \"calender\",\n className: `ml-2 ${iconClassName}`\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 5\n }, this);\n};\n\n_s(Input, \"+di++irDcPspjmhJVP9frUKGzpo=\");\n\n_c = Input;\nexport default Input;\nInput.defaultProps = {\n inputClassname: \"\",\n iconClassName: \"\",\n placeholderClass: \"text-[#bdc3c7]\",\n activePlaceholderClass: \"text-blue-600 bg-white\",\n icon: false\n};\n\nvar _c;\n\n$RefreshReg$(_c, \"Input\");","map":{"version":3,"names":["React","useState","fixNumbers","Input","defaultValue","set","label","borderClassname","inputClassname","placeholderClass","activePlaceholderClass","type","maxLength","max","min","register","onClick","icon","iconClassName","value","setValue","console","log","e","target","replace","length","slice","isNaN","defaultProps"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/src/components/AnimatedInput/Input.js"],"sourcesContent":["import React, { useState } from \"react\";\nimport fixNumbers from \"./fixNumbers\";\n\nconst Input = ({\n defaultValue,\n set,\n label,\n borderClassname,\n input