@cripty2001/utils 0.0.130 → 0.0.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = FormComponent;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
+ const react_2 = require("react");
9
10
  const button_1 = __importDefault(require("./button"));
10
11
  const input_1 = __importDefault(require("./input"));
11
12
  function FormComponent(props) {
12
- const variants = (0, react_1.useMemo)(() => ({
13
+ const variants = (0, react_2.useMemo)(() => ({
13
14
  default: props.variant
14
15
  }), [props.variant]);
15
16
  return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [props.inputs.map((input, index) => (() => {
@@ -24,7 +25,6 @@ function FormComponent(props) {
24
25
  setValue: setValue,
25
26
  variant: "default",
26
27
  variants: variants,
27
- key: index,
28
28
  required: input.required,
29
29
  icon: input.icon,
30
30
  };
@@ -33,12 +33,12 @@ function FormComponent(props) {
33
33
  case "email":
34
34
  case "password":
35
35
  case "tel":
36
- return (0, jsx_runtime_1.jsx)(input_1.default, { ...baseProps, children: ({ value, setValue, className }) => ((0, jsx_runtime_1.jsx)("input", { type: input.type, value: value, onChange: (e) => setValue(e.target.value), required: input.required, className: className, placeholder: input.label })) });
36
+ return (0, react_1.createElement)(input_1.default, { ...baseProps, key: index }, ({ value, setValue, className }) => ((0, jsx_runtime_1.jsx)("input", { type: input.type, value: value, onChange: (e) => setValue(e.target.value), required: input.required, className: className, placeholder: input.label })));
37
37
  case "select":
38
- return (0, jsx_runtime_1.jsx)(input_1.default, { ...baseProps, required: input.required, validate: (v) => {
38
+ return (0, react_1.createElement)(input_1.default, { ...baseProps, key: index, required: input.required, validate: (v) => {
39
39
  if (!input.options.includes(v))
40
40
  throw new Error("Invalid option");
41
- }, children: ({ value, setValue, className }) => ((0, jsx_runtime_1.jsx)("select", { value: value, onChange: (e) => setValue(e.target.value), required: input.required, className: className, children: input.options.map(option => ((0, jsx_runtime_1.jsx)("option", { value: option, children: option }, option))) })) });
41
+ } }, ({ value, setValue, className }) => ((0, jsx_runtime_1.jsx)("select", { value: value, onChange: (e) => setValue(e.target.value), required: input.required, className: className, children: input.options.map(option => ((0, jsx_runtime_1.jsx)("option", { value: option, children: option }, option))) })));
42
42
  default:
43
43
  return (0, jsx_runtime_1.jsx)("div", { style: { color: '#ef4444', backgroundColor: 'white' }, children: "Unknown input type" });
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.130",
3
+ "version": "0.0.131",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {