anysystem-design 0.0.29 → 0.0.30

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.
Files changed (39) hide show
  1. package/dist/components/AutoComplete/AutoCompleteBase.d.ts +1 -0
  2. package/dist/components/AutoComplete/AutoCompleteBase.js +81 -59
  3. package/dist/components/AutoComplete/AutoCompleteMultiple.js +7 -6
  4. package/dist/components/Checkbox/CheckboxBase.js +55 -30
  5. package/dist/components/Checkbox/FormCheckbox.js +1 -1
  6. package/dist/components/DatePicker/DatePicker.d.ts +2 -2
  7. package/dist/components/DatePicker/DatePicker.js +13 -13
  8. package/dist/components/FormControl/FormComponent.d.ts +5 -3
  9. package/dist/components/FormControl/FormComponent.js +29 -11
  10. package/dist/components/FormControl/FormContent.d.ts +8 -0
  11. package/dist/components/FormControl/FormContent.js +53 -0
  12. package/dist/components/FormControl/FormControl.d.ts +4 -29
  13. package/dist/components/FormControl/FormControl.js +48 -20
  14. package/dist/components/FormControl/helpers.d.ts +9 -0
  15. package/dist/components/FormControl/helpers.js +90 -0
  16. package/dist/components/FormControl/index.d.ts +1 -0
  17. package/dist/components/FormControl/index.js +5 -3
  18. package/dist/components/FormControl/type.d.ts +86 -0
  19. package/dist/components/FormControl/type.js +1 -0
  20. package/dist/components/Input/FormInput.js +9 -9
  21. package/dist/components/Input/Input.d.ts +2 -4
  22. package/dist/components/Input/Input.js +3 -4
  23. package/dist/components/Input/InputTel.d.ts +5 -16
  24. package/dist/components/Input/InputTel.js +24 -25
  25. package/dist/components/Label/FormLabel.js +3 -3
  26. package/dist/components/PasswordInput/FormPasswordInput.js +5 -5
  27. package/dist/components/Selectbox/FormSelectbox.js +1 -1
  28. package/dist/components/Selectbox/SelectboxMultiple.js +18 -17
  29. package/dist/components/TelephoneInput/TelephoneInput.d.ts +17 -0
  30. package/dist/components/TelephoneInput/TelephoneInput.js +68 -0
  31. package/dist/components/TelephoneInput/index.d.ts +2 -2
  32. package/dist/components/TelephoneInput/index.js +1 -1
  33. package/dist/components/index.d.ts +1 -0
  34. package/dist/components/index.js +6 -4
  35. package/dist/{formik.esm-C1r1xebq.js → formik.esm-C4MFRNh0.js} +8 -7
  36. package/dist/index.css +1 -1
  37. package/dist/index.esm-tvWIpiMA.js +1720 -0
  38. package/dist/index.js +12 -10
  39. package/package.json +1 -1
@@ -13,6 +13,7 @@ export type AutoCompleteBaseProps<ListOption extends SelectOption> = {
13
13
  readOnly?: boolean;
14
14
  className?: string;
15
15
  placeholder?: string;
16
+ closeButton?: boolean;
16
17
  onChange?: (value: string) => void;
17
18
  onSearch?: (query: string) => void;
18
19
  valueField?: ValueField<ListOption>;
@@ -1,91 +1,113 @@
1
- import { jsx as a, jsxs as p } from "react/jsx-runtime";
2
- import c, { Fragment as y } from "react";
3
- import { t as h } from "../../bundle-mjs-SHnj3fHy.js";
4
- import { H as x } from "../../index-BVp57yIc.js";
5
- import { c as w } from "../../index-CBEJ8A3p.js";
6
- import { getValue as n } from "../Selectbox/helper.js";
7
- import { N as C, G as E, H as N, z as L, K as H } from "../../combobox-DcjIgW1K.js";
8
- import { X as S } from "../../transition-6o20faRl.js";
9
- const A = (t, r) => r.type === "SEARCH" ? {
1
+ import { jsx as r, jsxs as m } from "react/jsx-runtime";
2
+ import y, { Fragment as h } from "react";
3
+ import { t as f } from "../../bundle-mjs-SHnj3fHy.js";
4
+ import { H as E } from "../../index-BVp57yIc.js";
5
+ import { c as C } from "../../index-CBEJ8A3p.js";
6
+ import { G as w } from "../../iconBase-Bipuk9tK.js";
7
+ import { getValue as c } from "../Selectbox/helper.js";
8
+ import { N, G as A, H as L, z as S, K as H } from "../../combobox-DcjIgW1K.js";
9
+ import { X as T } from "../../transition-6o20faRl.js";
10
+ function R(t) {
11
+ return w({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z" }, child: [] }] })(t);
12
+ }
13
+ const k = (t, a) => a.type === "SEARCH" ? {
10
14
  ...t,
11
- query: r.query,
12
- filterList: t.list.filter((l) => l.label.toLowerCase().includes(r.query.toLowerCase()))
13
- } : r.type === "SETVALUE" ? {
15
+ query: a.query,
16
+ filterList: t.list.filter((l) => l.label.toLowerCase().includes(a.query.toLowerCase()))
17
+ } : a.type === "SETVALUE" ? {
14
18
  ...t,
15
- value: r.value,
16
- selected: t.list.find((l) => n(l, t.valueField) === r.value) || null
17
- } : r.type === "SETSELECT" ? {
19
+ value: a.value,
20
+ selected: t.list.find((l) => c(l, t.valueField) === a.value) || null
21
+ } : a.type === "SETSELECT" ? {
18
22
  ...t,
19
- selected: r.selected,
20
- value: n(r.selected, t.valueField) + ""
21
- } : t, T = ({
23
+ selected: a.selected,
24
+ value: c(a.selected, t.valueField) + ""
25
+ } : t, q = ({
22
26
  id: t,
23
- name: r,
27
+ name: a,
24
28
  options: l,
25
29
  value: i = "",
26
- valueField: o = "value",
27
- onChange: d,
28
- onSearch: f,
29
- placeholder: v
30
- }, g) => {
31
- const [m, s] = c.useReducer(A, {
30
+ valueField: d = "value",
31
+ onChange: u,
32
+ onSearch: p,
33
+ placeholder: v,
34
+ closeButton: g = !0
35
+ }, b) => {
36
+ const [n, s] = y.useReducer(k, {
32
37
  list: l,
33
38
  query: "",
34
39
  filterList: l,
35
40
  value: i,
36
- valueField: o,
41
+ valueField: d,
37
42
  selected: l.find((e) => {
38
- const u = n(e, o);
39
- return i ? u === i : !1;
43
+ const o = c(e, d);
44
+ return i ? o === i : !1;
40
45
  }) || null
41
46
  });
42
- return c.useImperativeHandle(g, () => ({
47
+ return y.useImperativeHandle(b, () => ({
43
48
  search: (e) => s({ type: "SEARCH", query: e }),
44
49
  setValue: (e) => s({ type: "SETVALUE", value: e })
45
- })), /* @__PURE__ */ a(
46
- C,
50
+ })), /* @__PURE__ */ r(
51
+ N,
47
52
  {
48
- value: m.selected,
53
+ value: n.selected,
49
54
  onChange: (e) => {
50
55
  s({
51
56
  type: "SETSELECT",
52
57
  selected: e
53
- }), d && d(e ? n(e, o) : "");
58
+ }), u && u(e ? c(e, d) : "");
54
59
  },
55
- children: /* @__PURE__ */ p("div", { className: "relative", children: [
56
- /* @__PURE__ */ a(
57
- E,
60
+ children: /* @__PURE__ */ m("div", { className: "relative", children: [
61
+ /* @__PURE__ */ r(
62
+ A,
58
63
  {
59
64
  placeholder: v,
60
65
  onChange: (e) => {
61
- s({ type: "SEARCH", query: e.target.value }), f && f(e.target.value);
66
+ s({ type: "SEARCH", query: e.target.value }), p && p(e.target.value);
62
67
  },
63
68
  autoComplete: "off",
64
69
  displayValue: (e) => (e == null ? void 0 : e.label) || ""
65
70
  }
66
71
  ),
67
- /* @__PURE__ */ a(N, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ a(
68
- x,
69
- {
70
- className: "h-5 w-5 text-gray-400",
71
- "aria-hidden": "true"
72
- }
73
- ) }),
74
- /* @__PURE__ */ a(
72
+ /* @__PURE__ */ m("div", { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: [
73
+ /* @__PURE__ */ r(
74
+ "button",
75
+ {
76
+ type: "button",
77
+ className: f(
78
+ "size-5 text-gray-400 hover:text-gray-500 rounded-full hover:bg-gray-200 items-center flex justify-center",
79
+ n.value ? "" : "hidden",
80
+ g ? "" : "!hidden"
81
+ ),
82
+ onClick: () => {
83
+ s({ type: "SETVALUE", value: "" }), s({ type: "SEARCH", query: "" }), u && u("");
84
+ },
85
+ children: /* @__PURE__ */ r(R, {})
86
+ }
87
+ ),
88
+ /* @__PURE__ */ r(L, { className: "items-center", children: /* @__PURE__ */ r(
89
+ E,
90
+ {
91
+ className: "text-gray-400 size-5",
92
+ "aria-hidden": "true"
93
+ }
94
+ ) })
95
+ ] }),
96
+ /* @__PURE__ */ r(
75
97
  "input",
76
98
  {
77
99
  className: "!hidden",
78
100
  type: "text",
79
101
  id: t,
80
- name: r,
102
+ name: a,
81
103
  readOnly: !0,
82
- value: m.value + ""
104
+ value: n.value + ""
83
105
  }
84
106
  ),
85
- /* @__PURE__ */ a(
86
- S,
107
+ /* @__PURE__ */ r(
108
+ T,
87
109
  {
88
- as: y,
110
+ as: h,
89
111
  enter: "transition duration-100 ease-out",
90
112
  enterFrom: "scale-95 transform opacity-0",
91
113
  enterTo: "scale-100 transform opacity-100",
@@ -93,23 +115,23 @@ const A = (t, r) => r.type === "SEARCH" ? {
93
115
  leaveFrom: "scale-100 transform opacity-100",
94
116
  leaveTo: "scale-95 transform opacity-0",
95
117
  afterLeave: () => s({ type: "SEARCH", query: "" }),
96
- children: /* @__PURE__ */ a(L, { className: "absolute z-50 mt-5 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none dark:bg-gray-900 sm:text-sm", children: m.filterList.map((e) => /* @__PURE__ */ a(H, { as: y, value: e, children: ({ selected: u, focus: b }) => /* @__PURE__ */ p(
118
+ children: /* @__PURE__ */ r(S, { className: "absolute z-50 w-full py-1 mt-5 overflow-auto text-base bg-white shadow-lg max-h-60 rounded-md ring-1 ring-black/5 focus:outline-none dark:bg-gray-900 sm:text-sm", children: n.filterList.map((e) => /* @__PURE__ */ r(H, { as: h, value: e, children: ({ selected: o, focus: x }) => /* @__PURE__ */ m(
97
119
  "li",
98
120
  {
99
- className: h(
121
+ className: f(
100
122
  "relative flex cursor-pointer justify-between px-5 py-4 text-black hover:bg-primary-100 dark:text-white",
101
- (u || b) && "bg-primary-100 dark:bg-gray-700",
123
+ (o || x) && "bg-primary-100 dark:bg-gray-700",
102
124
  e.enable === !1 && "cursor-not-allowed opacity-50"
103
125
  ),
104
126
  children: [
105
- /* @__PURE__ */ a("span", { className: "pl-5", children: e.label }),
106
- u ? /* @__PURE__ */ a(
127
+ /* @__PURE__ */ r("span", { className: "pl-5", children: e.label }),
128
+ o ? /* @__PURE__ */ r(
107
129
  "span",
108
130
  {
109
- className: h(
131
+ className: f(
110
132
  "absolute inset-y-0 left-0 flex items-center pl-3 text-primary-600"
111
133
  ),
112
- children: /* @__PURE__ */ a(w, { className: "h-5 w-5", "aria-hidden": "true" })
134
+ children: /* @__PURE__ */ r(C, { className: "w-5 h-5", "aria-hidden": "true" })
113
135
  }
114
136
  ) : null
115
137
  ]
@@ -120,7 +142,7 @@ const A = (t, r) => r.type === "SEARCH" ? {
120
142
  ] })
121
143
  }
122
144
  );
123
- }, B = c.forwardRef(T);
145
+ }, X = y.forwardRef(q);
124
146
  export {
125
- B as default
147
+ X as default
126
148
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as l, jsxs as m } from "react/jsx-runtime";
2
2
  import p, { Fragment as v } from "react";
3
- import { _ as b } from "../../lodash-DH2GRwR5.js";
3
+ import { _ as x } from "../../lodash-DH2GRwR5.js";
4
4
  import { t as E } from "../../bundle-mjs-SHnj3fHy.js";
5
5
  import { H as C } from "../../index-BVp57yIc.js";
6
6
  import { c as w } from "../../index-CBEJ8A3p.js";
@@ -50,7 +50,7 @@ const k = (r, t) => {
50
50
  onChange: f,
51
51
  onSearch: y,
52
52
  placeholder: g
53
- }, x) => {
53
+ }, b) => {
54
54
  var h;
55
55
  const [s, c] = p.useReducer(k, {
56
56
  query: "",
@@ -60,10 +60,10 @@ const k = (r, t) => {
60
60
  valueField: n,
61
61
  selected: u.filter((e) => {
62
62
  const i = o(e, n);
63
- return b.some(a, (d) => d + "" == i + "");
63
+ return x.some(a, (d) => d + "" == i + "");
64
64
  }) || []
65
65
  });
66
- return p.useImperativeHandle(x, () => ({
66
+ return p.useImperativeHandle(b, () => ({
67
67
  search: (e) => {
68
68
  c({ type: "SEARCH", query: e });
69
69
  },
@@ -89,6 +89,7 @@ const k = (r, t) => {
89
89
  /* @__PURE__ */ l(
90
90
  "button",
91
91
  {
92
+ type: "button",
92
93
  onClick: () => c({ type: "REMOVESELECT", selected: e }),
93
94
  children: /* @__PURE__ */ l(N, { fontSize: 12, className: "font-bold" })
94
95
  }
@@ -114,7 +115,7 @@ const k = (r, t) => {
114
115
  /* @__PURE__ */ l(T, { className: "absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ l(
115
116
  C,
116
117
  {
117
- className: "h-5 w-5 text-gray-400",
118
+ className: "w-5 h-5 text-gray-400",
118
119
  "aria-hidden": "true"
119
120
  }
120
121
  ) }),
@@ -140,7 +141,7 @@ const k = (r, t) => {
140
141
  leaveFrom: "scale-100 transform opacity-100",
141
142
  leaveTo: "scale-95 transform opacity-0",
142
143
  afterLeave: () => c({ type: "SEARCH", query: "" }),
143
- children: /* @__PURE__ */ l(q, { className: "absolute mt-10 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none dark:bg-gray-900 sm:text-sm", children: s.filterList.map((e) => /* @__PURE__ */ l(A, { as: v, value: e, children: ({ selected: i, focus: d }) => /* @__PURE__ */ m(
144
+ children: /* @__PURE__ */ l(q, { className: "absolute w-full py-1 mt-10 overflow-auto text-base bg-white shadow-lg max-h-60 rounded-md ring-1 ring-black/5 focus:outline-none dark:bg-gray-900 sm:text-sm", children: s.filterList.map((e) => /* @__PURE__ */ l(A, { as: v, value: e, children: ({ selected: i, focus: d }) => /* @__PURE__ */ m(
144
145
  "li",
145
146
  {
146
147
  className: E(
@@ -1,32 +1,57 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { b as n, c as s } from "../../index-DUypCuzD.js";
3
- import { t as c } from "../../bundle-mjs-SHnj3fHy.js";
4
- const m = ({
5
- className: t,
6
- isError: o,
7
- inputProps: l,
8
- intermediate: a = !1,
9
- ...r
10
- }) => /* @__PURE__ */ d("div", { className: "relative w-5 h-5 overflow-hidden rounded", children: [
11
- /* @__PURE__ */ e(
12
- "input",
13
- {
14
- type: "checkbox",
15
- className: c(
16
- "relative z-10",
17
- "peer block h-full w-full cursor-pointer appearance-none rounded border-2 border-gray-400 focus:outline-4 focus:outline-blue-500",
18
- "checked:border-primary-600",
19
- a && "border-primary-600",
20
- o && "border-red-500",
21
- t
22
- ),
23
- value: (l == null ? void 0 : l.value) || (r == null ? void 0 : r.value) || "",
24
- ...r
25
- }
26
- ),
27
- a === !0 && /* @__PURE__ */ e("span", { className: "absolute left-1/2 top-1/2 flex h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 dark:fill-primary-600", children: /* @__PURE__ */ e(n, { className: "w-full h-full rounded" }) }),
28
- /* @__PURE__ */ e("span", { className: "absolute left-1/2 top-1/2 hidden h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 peer-checked:flex dark:fill-primary-600", children: /* @__PURE__ */ e(s, { className: "w-full h-full rounded" }) })
29
- ] });
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import d from "react";
3
+ import { b as s, c as u } from "../../index-DUypCuzD.js";
4
+ import { t as f } from "../../bundle-mjs-SHnj3fHy.js";
5
+ const w = ({
6
+ className: n,
7
+ isError: c,
8
+ inputProps: t,
9
+ intermediate: o = !1,
10
+ ...l
11
+ }) => {
12
+ const a = d.useRef(null);
13
+ return /* @__PURE__ */ i("div", { className: "relative w-5 h-5 overflow-hidden rounded", children: [
14
+ /* @__PURE__ */ r(
15
+ "input",
16
+ {
17
+ ref: a,
18
+ type: "checkbox",
19
+ className: f(
20
+ "relative ",
21
+ "peer block h-full w-full cursor-pointer appearance-none rounded border-2 border-gray-400 focus:outline-4 focus:outline-blue-500 bg-transparent",
22
+ "checked:border-primary-600",
23
+ o && "border-primary-600",
24
+ c && "border-red-500",
25
+ n
26
+ ),
27
+ value: (t == null ? void 0 : t.value) || (l == null ? void 0 : l.value) || "",
28
+ ...l
29
+ }
30
+ ),
31
+ o === !0 && /* @__PURE__ */ r(
32
+ "span",
33
+ {
34
+ className: "absolute left-1/2 top-1/2 flex h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 dark:fill-primary-600 bg-white cursor-pointer",
35
+ onClick: () => {
36
+ var e;
37
+ return (e = a.current) == null ? void 0 : e.click();
38
+ },
39
+ children: /* @__PURE__ */ r(s, { className: "w-full h-full rounded" })
40
+ }
41
+ ),
42
+ /* @__PURE__ */ r(
43
+ "span",
44
+ {
45
+ className: "absolute left-1/2 top-1/2 hidden h-[150%] w-[150%] -translate-x-1/2 -translate-y-1/2 transform items-center justify-center overflow-hidden rounded font-bold text-primary-600 peer-checked:flex dark:fill-primary-600 bg-white cursor-pointer",
46
+ onClick: () => {
47
+ var e;
48
+ return (e = a.current) == null ? void 0 : e.click();
49
+ },
50
+ children: /* @__PURE__ */ r(u, { className: "w-full h-full rounded" })
51
+ }
52
+ )
53
+ ] });
54
+ };
30
55
  export {
31
- m as CheckboxBase
56
+ w as CheckboxBase
32
57
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { u as i } from "../../formik.esm-C1r1xebq.js";
2
+ import { a as i } from "../../formik.esm-C4MFRNh0.js";
3
3
  import { Checkbox as m } from "./Checkbox.js";
4
4
  const f = ({
5
5
  name: o,
@@ -2,8 +2,8 @@ import { default as React } from 'react';
2
2
 
3
3
  export type DatePickerProps = {
4
4
  name: string;
5
- value: number;
6
- onChange: (value: number) => void;
5
+ value: string;
6
+ onChange: (value: string) => void;
7
7
  showTime?: boolean;
8
8
  readOnly?: boolean;
9
9
  };
@@ -6578,24 +6578,24 @@ const ee = Object.assign(kd, {
6578
6578
  r === !0 ? "!hidden" : "md:hidden"
6579
6579
  ),
6580
6580
  type: r === !0 ? "datetime-local" : "date",
6581
- value: h(new Date(t * 1e3)).format(
6581
+ value: h(new Date(+t * 1e3)).format(
6582
6582
  r === !0 ? "YYYY-MM-DD HH:mm" : "YYYY-MM-DD"
6583
6583
  ),
6584
- onChange: (i) => a(Math.round(new Date(i.target.value).getTime() / 1e3))
6584
+ onChange: (i) => a(Math.round(new Date(i.target.value).getTime() / 1e3) + "")
6585
6585
  }
6586
6586
  ),
6587
6587
  /* @__PURE__ */ j("div", { className: We(r === !0 ? "" : "hidden md:flex"), children: /* @__PURE__ */ Ne(
6588
6588
  ee,
6589
6589
  {
6590
6590
  disabledKeyboardNavigation: !0,
6591
- value: t ? new Date(t * 1e3) : /* @__PURE__ */ new Date(),
6592
- onChange: (i) => a(Math.round(i.getTime() / 1e3)),
6591
+ value: t ? new Date(+t * 1e3) : /* @__PURE__ */ new Date(),
6592
+ onChange: (i) => a(Math.round(i.getTime() / 1e3) + ""),
6593
6593
  children: [
6594
6594
  /* @__PURE__ */ j(
6595
6595
  ee.Input,
6596
6596
  {
6597
6597
  name: e,
6598
- value: new Date(t * 1e3).getTime() / 1e3 || "",
6598
+ value: new Date(+t * 1e3).getTime() / 1e3 || "",
6599
6599
  format: r === !0 ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd",
6600
6600
  id: e
6601
6601
  }
@@ -6607,8 +6607,8 @@ const ee = Object.assign(kd, {
6607
6607
  defaultType: "day",
6608
6608
  className: "xs:max-w-[320px] z-50 rounded-md border border-gray-300 bg-white p-2 shadow-2xl dark:border-gray-700 dark:bg-gray-900 md:p-4",
6609
6609
  children: ({ year: i, monthName: s, month: o, hour: u, minute: l }) => /* @__PURE__ */ Ne("div", { className: "flex w-[320px] flex-col gap-2", children: [
6610
- /* @__PURE__ */ Ne("div", { className: "flex w-full justify-between", children: [
6611
- /* @__PURE__ */ Ne("div", { className: "flex gap-1 text-2xl font-bold text-black dark:text-white", children: [
6610
+ /* @__PURE__ */ Ne("div", { className: "flex justify-between w-full", children: [
6611
+ /* @__PURE__ */ Ne("div", { className: "flex text-2xl font-bold text-black gap-1 dark:text-white", children: [
6612
6612
  /* @__PURE__ */ j(ee.Button, { action: "toggleMonth", children: s }),
6613
6613
  /* @__PURE__ */ j(ee.Button, { action: "toggleYear", children: i })
6614
6614
  ] }),
@@ -6616,7 +6616,7 @@ const ee = Object.assign(kd, {
6616
6616
  /* @__PURE__ */ j(
6617
6617
  ee.Button,
6618
6618
  {
6619
- className: "rounded-md bg-gray-300 p-3 hover:bg-gray-400 dark:bg-gray-700",
6619
+ className: "p-3 bg-gray-300 rounded-md hover:bg-gray-400 dark:bg-gray-700",
6620
6620
  action: "prev",
6621
6621
  children: /* @__PURE__ */ j(Hn, { size: 20 })
6622
6622
  }
@@ -6624,7 +6624,7 @@ const ee = Object.assign(kd, {
6624
6624
  /* @__PURE__ */ j(
6625
6625
  ee.Button,
6626
6626
  {
6627
- className: "rounded-md bg-gray-300 p-3 hover:bg-gray-400 dark:bg-gray-700",
6627
+ className: "p-3 bg-gray-300 rounded-md hover:bg-gray-400 dark:bg-gray-700",
6628
6628
  action: "next",
6629
6629
  children: /* @__PURE__ */ j(In, { size: 20 })
6630
6630
  }
@@ -6671,7 +6671,7 @@ const ee = Object.assign(kd, {
6671
6671
  ee.Button,
6672
6672
  {
6673
6673
  className: We(
6674
- "relative w-full rounded bg-primary-600 p-2 text-white",
6674
+ "relative w-full p-2 text-white rounded bg-primary-600",
6675
6675
  "after:absolute after:right-0 after:top-0 after:h-full after:w-0 after:rounded-l after:bg-gray-400 after:opacity-0 dark:after:bg-gray-600",
6676
6676
  //after:
6677
6677
  "hover:after:w-full hover:after:transform hover:after:opacity-20 hover:after:transition-all hover:after:duration-300"
@@ -6695,14 +6695,14 @@ const ee = Object.assign(kd, {
6695
6695
  /* @__PURE__ */ Ne(
6696
6696
  ee.Picker,
6697
6697
  {
6698
- className: "flex max-h-56 rounded-md border border-gray-300 bg-white py-2 shadow-md dark:border-gray-700 dark:bg-gray-900 dark:text-white",
6698
+ className: "flex py-2 bg-white border border-gray-300 shadow-md max-h-56 rounded-md dark:border-gray-700 dark:bg-gray-900 dark:text-white",
6699
6699
  id: "HourPicker",
6700
6700
  children: [
6701
6701
  /* @__PURE__ */ j(
6702
6702
  ee.Items,
6703
6703
  {
6704
6704
  type: "hour",
6705
- className: "overflow-y-auto scroll-smooth px-4",
6705
+ className: "px-4 overflow-y-auto scroll-smooth",
6706
6706
  disableAutoScroll: !0,
6707
6707
  children: ({ items: f }) => f.map((c) => /* @__PURE__ */ j(
6708
6708
  ee.Item,
@@ -6723,7 +6723,7 @@ const ee = Object.assign(kd, {
6723
6723
  ee.Items,
6724
6724
  {
6725
6725
  type: "minute",
6726
- className: "overflow-y-auto scroll-smooth px-4",
6726
+ className: "px-4 overflow-y-auto scroll-smooth",
6727
6727
  disableAutoScroll: !0,
6728
6728
  children: ({ items: f }) => f.map((c) => /* @__PURE__ */ j(
6729
6729
  ee.Item,
@@ -1,11 +1,13 @@
1
1
  import { default as React } from 'react';
2
- import { FormikHelpers, FormikProps } from 'formik';
2
+ import { FormFieldWithStructure } from './type';
3
+ import { FormikHelpers, FormikProps, useFormikContext } from 'formik';
3
4
 
4
5
  export type FormProps<FormValues extends Record<string, unknown>> = FormikProps<FormValues>;
5
6
  export type FormComponentProps<FormValues extends Record<string, unknown>> = React.FormHTMLAttributes<HTMLFormElement> & {
6
- initialValues: FormValues;
7
+ fields: FormFieldWithStructure;
7
8
  onSubmit: (values: FormValues, helpers: FormikHelpers<FormValues>) => void;
8
9
  children: React.ReactNode;
9
10
  };
10
- declare const FormComponent: <FormValues extends Record<string, unknown>>({ className, children, initialValues, onSubmit, }: FormComponentProps<FormValues>) => import("react/jsx-runtime").JSX.Element;
11
+ declare const FormComponent: <FormValues extends Record<string, unknown>>({ className, children, fields, onSubmit, }: FormComponentProps<FormValues>) => import("react/jsx-runtime").JSX.Element;
11
12
  export default FormComponent;
13
+ export { useFormikContext as useFormContext };
@@ -1,16 +1,34 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import i from "react";
3
- import { t as s } from "../../bundle-mjs-SHnj3fHy.js";
4
- import { F as l, a as f } from "../../formik.esm-C1r1xebq.js";
5
- const F = ({
6
- className: t,
7
- children: o,
8
- initialValues: r,
1
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
+ import e from "react";
3
+ import { t as l } from "../../bundle-mjs-SHnj3fHy.js";
4
+ import { F as u, b as p } from "../../formik.esm-C4MFRNh0.js";
5
+ import { u as R } from "../../formik.esm-C4MFRNh0.js";
6
+ import { getFieldValue as f, getFieldValidation as c } from "./helpers.js";
7
+ import F from "./FormContent.js";
8
+ const b = ({
9
+ className: r,
10
+ children: m,
11
+ fields: o,
9
12
  onSubmit: a
10
13
  }) => {
11
- const [m] = i.useState(r);
12
- return /* @__PURE__ */ e(l, { enableReinitialize: !0, initialValues: m, onSubmit: a, children: /* @__PURE__ */ e(f, { autoComplete: "off", className: s(t), children: o }) });
14
+ const [i] = e.useState(
15
+ f(o)
16
+ ), n = e.useMemo(() => c(o), [o]);
17
+ return /* @__PURE__ */ t(
18
+ u,
19
+ {
20
+ enableReinitialize: !0,
21
+ validationSchema: n,
22
+ initialValues: i,
23
+ onSubmit: a,
24
+ children: /* @__PURE__ */ s(p, { autoComplete: "off", className: l(r), children: [
25
+ /* @__PURE__ */ t(F, { fields: o }),
26
+ m
27
+ ] })
28
+ }
29
+ );
13
30
  };
14
31
  export {
15
- F as default
32
+ b as default,
33
+ R as useFormContext
16
34
  };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { FormFieldWithStructure } from './type';
3
+
4
+ export type FormContentProps = {
5
+ fields: FormFieldWithStructure;
6
+ };
7
+ declare const FormContent: React.FC<FormContentProps>;
8
+ export default FormContent;
@@ -0,0 +1,53 @@
1
+ import { jsx as n, Fragment as s } from "react/jsx-runtime";
2
+ import "react";
3
+ import { u as y } from "../../formik.esm-C4MFRNh0.js";
4
+ import "../../lodash-DH2GRwR5.js";
5
+ import "../../index.esm-tvWIpiMA.js";
6
+ import e from "../Row/Row.js";
7
+ import C from "../Column/Column.js";
8
+ import F from "./FormControl.js";
9
+ const b = ({ fields: c }) => {
10
+ const { values: t, setFieldValue: u, touched: r, errors: m } = y();
11
+ return /* @__PURE__ */ n(s, { children: c.map((o, P) => {
12
+ var p, a;
13
+ return /* @__PURE__ */ n(e, { children: Array.isArray(o) ? /* @__PURE__ */ n(
14
+ e,
15
+ {
16
+ className: "space-y-2 md:space-y-0",
17
+ column: { md: o.length },
18
+ children: /* @__PURE__ */ n(b, { fields: o })
19
+ }
20
+ ) : /* @__PURE__ */ n(C, { children: o != null && o.component ? o == null ? void 0 : o.component(o == null ? void 0 : o.componentProps) : o.componentProps.type && [
21
+ "text",
22
+ "number",
23
+ "date",
24
+ "datetime",
25
+ "tel",
26
+ "email",
27
+ "password",
28
+ "radio",
29
+ "switch",
30
+ "confirm",
31
+ "select",
32
+ "autocomplete"
33
+ ].includes(o.componentProps.type) ? /* @__PURE__ */ n(
34
+ F,
35
+ {
36
+ ...o.componentProps,
37
+ name: o.name,
38
+ value: (t == null ? void 0 : t[o.name]) || "",
39
+ labelProps: {
40
+ ...(p = o.componentProps) != null && p.labelProps ? (a = o.componentProps) == null ? void 0 : a.labelProps : {},
41
+ isError: !!(r != null && r[o.name] && (m != null && m[o.name])),
42
+ errorMessage: (m == null ? void 0 : m[o.name]) || ""
43
+ },
44
+ onChange: (h) => {
45
+ u(o.name, h);
46
+ }
47
+ }
48
+ ) : /* @__PURE__ */ n(s, {}) }) }, P);
49
+ }) });
50
+ };
51
+ export {
52
+ b as default
53
+ };
@@ -1,32 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { InputProps } from '../Input';
3
- import { LabelBaseProps } from '../Label';
4
- import { DatePickerProps } from '../DatePicker';
5
- import { RadioGroupProps } from '../RadioGroup';
6
- import { SwitchProps } from '../Switch';
7
- import { CheckboxProps } from '../Checkbox';
8
2
  import { SelectOption } from '../Selectbox';
3
+ import { FormControlInputProps, FormControlDateTimeProps, FormControlRadioProps, FormControlSwitchProps, FormControlConfirmProps, FormControlTelephoneProps, FormControlSelectboxProps, FormControlAutoCompleteProps } from './type';
9
4
 
10
- export type FormControlProps<ListOption extends SelectOption> = ({
11
- type: "password" | "text" | "tel" | "number" | "email";
12
- labelProps: LabelBaseProps;
13
- } & InputProps<ListOption>) | ({
14
- type: "date";
15
- labelProps: LabelBaseProps;
16
- } & DatePickerProps) | ({
17
- type: "datetime";
18
- labelProps: LabelBaseProps;
19
- } & DatePickerProps) | ({
20
- type: "radio";
21
- labelProps: LabelBaseProps;
22
- } & RadioGroupProps<ListOption>) | ({
23
- type: "switch";
24
- labelProps: LabelBaseProps;
25
- } & SwitchProps) | ({
26
- type: "confirm";
27
- labelProps?: LabelBaseProps;
28
- } & CheckboxProps);
29
- declare const _default: <ListOption extends SelectOption>(props: FormControlProps<ListOption> & {
30
- ref?: React.Ref<HTMLInputElement>;
31
- }) => JSX.Element;
32
- export default _default;
5
+ export type FormControlProps<ListOption extends SelectOption> = FormControlInputProps | FormControlDateTimeProps | FormControlRadioProps<ListOption> | FormControlSwitchProps | FormControlConfirmProps | FormControlTelephoneProps | FormControlSelectboxProps<ListOption> | FormControlAutoCompleteProps<ListOption>;
6
+ declare const FormControl: <ListOption extends SelectOption>({ type, onChange, ...props }: FormControlProps<ListOption>) => React.ReactElement;
7
+ export default FormControl;