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

{"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 inputClassname,\n placeholderClass,\n activePlaceholderClass,\n type,\n maxLength,\n max,\n min,\n register,\n onClick,\n icon,\n iconClassName,\n}) => {\n const [value, setValue] = useState(defaultValue);\n console.log(value);\n return (\n <div\n onClick={onClick}\n className={\n \"h-full w-full flex flex-row items-center rounded relative bg-[#F9F9F9] \" +\n borderClassname +\n (value ? \" bg-white border rounded \" : \" bg-white \")\n }\n >\n <div\n className={\n \"text-xs absolute transition-all duration-300 pointer-events-none px-3 transform -translate-x-[4px]\" +\n (value\n ? ` ${activePlaceholderClass} + top-[-10px]`\n : ` ${placeholderClass} + top-[10px]`)\n }\n >\n {label}\n </div>\n {type !== \"textarea\" ? (\n <input\n {...register}\n maxLength={maxLength}\n value={value}\n type={\"text\"}\n onInput={(e) => {\n let value = e.target.value;\n if (type === \"number\")\n value = fixNumbers(value).replace(/[^\\d.-]/g, \"\");\n if (maxLength && value.length > maxLength)\n 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 />\n ) : (\n <textarea\n {...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 ${\n !value ? \"bg-[#F9F9F9] \" : \"bg-white\"\n }`}\n onChange={(e) => setValue(e.target.value)}\n >\n {value}\n </textarea>\n )}\n {icon && (\n <img src={icon} alt=\"calender\" className={`ml-2 ${iconClassName}`} />\n )}\n </div>\n );\n};\n\nexport default Input;\n\nInput.defaultProps = {\n inputClassname: \"\",\n iconClassName: \"\",\n placeholderClass: \"text-[#bdc3c7]\",\n activePlaceholderClass: \"text-blue-600 bg-white\",\n icon: false,\n};\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,UAAP,MAAuB,cAAvB;;;AAEA,MAAMC,KAAK,GAAG,QAgBR;EAAA;;EAAA,IAhBS;IACbC,YADa;IAEbC,GA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