asterui 0.12.16 → 0.12.17

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 (140) hide show
  1. package/dist/components/Checkbox.d.ts +3 -1
  2. package/dist/components/Form.d.ts +7 -1
  3. package/dist/components/Input.d.ts +10 -2
  4. package/dist/index.d.ts +0 -2
  5. package/dist/index.js +134 -136
  6. package/dist/index.js.map +1 -1
  7. package/dist/index10.js +70 -65
  8. package/dist/index10.js.map +1 -1
  9. package/dist/index100.js +43 -11
  10. package/dist/index100.js.map +1 -1
  11. package/dist/index101.js +11 -44
  12. package/dist/index101.js.map +1 -1
  13. package/dist/index102.js +12 -10
  14. package/dist/index102.js.map +1 -1
  15. package/dist/index103.js +7 -14
  16. package/dist/index103.js.map +1 -1
  17. package/dist/index104.js +12 -7
  18. package/dist/index104.js.map +1 -1
  19. package/dist/index105.js +29 -11
  20. package/dist/index105.js.map +1 -1
  21. package/dist/index106.js +16 -29
  22. package/dist/index106.js.map +1 -1
  23. package/dist/index34.js +198 -158
  24. package/dist/index34.js.map +1 -1
  25. package/dist/index42.js +185 -148
  26. package/dist/index42.js.map +1 -1
  27. package/dist/index43.js +19 -19
  28. package/dist/index43.js.map +1 -1
  29. package/dist/index46.js +134 -18
  30. package/dist/index46.js.map +1 -1
  31. package/dist/index47.js +10 -134
  32. package/dist/index47.js.map +1 -1
  33. package/dist/index48.js +35 -13
  34. package/dist/index48.js.map +1 -1
  35. package/dist/index49.js +34 -35
  36. package/dist/index49.js.map +1 -1
  37. package/dist/index50.js +81 -34
  38. package/dist/index50.js.map +1 -1
  39. package/dist/index51.js +166 -71
  40. package/dist/index51.js.map +1 -1
  41. package/dist/index52.js +144 -167
  42. package/dist/index52.js.map +1 -1
  43. package/dist/index53.js +11 -152
  44. package/dist/index53.js.map +1 -1
  45. package/dist/index54.js +20 -10
  46. package/dist/index54.js.map +1 -1
  47. package/dist/index55.js +14 -22
  48. package/dist/index55.js.map +1 -1
  49. package/dist/index56.js +7 -14
  50. package/dist/index56.js.map +1 -1
  51. package/dist/index57.js +333 -6
  52. package/dist/index57.js.map +1 -1
  53. package/dist/index58.js +47 -334
  54. package/dist/index58.js.map +1 -1
  55. package/dist/index59.js +122 -47
  56. package/dist/index59.js.map +1 -1
  57. package/dist/index60.js +108 -120
  58. package/dist/index60.js.map +1 -1
  59. package/dist/index61.js +167 -107
  60. package/dist/index61.js.map +1 -1
  61. package/dist/index62.js +29 -167
  62. package/dist/index62.js.map +1 -1
  63. package/dist/index63.js +120 -30
  64. package/dist/index63.js.map +1 -1
  65. package/dist/index64.js +80 -116
  66. package/dist/index64.js.map +1 -1
  67. package/dist/index65.js +19 -85
  68. package/dist/index65.js.map +1 -1
  69. package/dist/index66.js +73 -19
  70. package/dist/index66.js.map +1 -1
  71. package/dist/index67.js +54 -71
  72. package/dist/index67.js.map +1 -1
  73. package/dist/index68.js +44 -56
  74. package/dist/index68.js.map +1 -1
  75. package/dist/index69.js +49 -42
  76. package/dist/index69.js.map +1 -1
  77. package/dist/index70.js +121 -50
  78. package/dist/index70.js.map +1 -1
  79. package/dist/index71.js +102 -118
  80. package/dist/index71.js.map +1 -1
  81. package/dist/index72.js +41 -107
  82. package/dist/index72.js.map +1 -1
  83. package/dist/index73.js +68 -41
  84. package/dist/index73.js.map +1 -1
  85. package/dist/index74.js +19 -66
  86. package/dist/index74.js.map +1 -1
  87. package/dist/index75.js +55 -18
  88. package/dist/index75.js.map +1 -1
  89. package/dist/index76.js +251 -55
  90. package/dist/index76.js.map +1 -1
  91. package/dist/index77.js +22 -254
  92. package/dist/index77.js.map +1 -1
  93. package/dist/index78.js +31 -22
  94. package/dist/index78.js.map +1 -1
  95. package/dist/index79.js +93 -30
  96. package/dist/index79.js.map +1 -1
  97. package/dist/index80.js +324 -89
  98. package/dist/index80.js.map +1 -1
  99. package/dist/index81.js +73 -322
  100. package/dist/index81.js.map +1 -1
  101. package/dist/index82.js +39 -79
  102. package/dist/index82.js.map +1 -1
  103. package/dist/index83.js +23 -40
  104. package/dist/index83.js.map +1 -1
  105. package/dist/index84.js +93 -21
  106. package/dist/index84.js.map +1 -1
  107. package/dist/index85.js +148 -87
  108. package/dist/index85.js.map +1 -1
  109. package/dist/index86.js +152 -147
  110. package/dist/index86.js.map +1 -1
  111. package/dist/index87.js +63 -159
  112. package/dist/index87.js.map +1 -1
  113. package/dist/index88.js +35 -65
  114. package/dist/index88.js.map +1 -1
  115. package/dist/index89.js +234 -35
  116. package/dist/index89.js.map +1 -1
  117. package/dist/index90.js +31 -231
  118. package/dist/index90.js.map +1 -1
  119. package/dist/index91.js +210 -34
  120. package/dist/index91.js.map +1 -1
  121. package/dist/index92.js +198 -195
  122. package/dist/index92.js.map +1 -1
  123. package/dist/index93.js +241 -159
  124. package/dist/index93.js.map +1 -1
  125. package/dist/index94.js +166 -283
  126. package/dist/index94.js.map +1 -1
  127. package/dist/index95.js +253 -173
  128. package/dist/index95.js.map +1 -1
  129. package/dist/index96.js +14 -258
  130. package/dist/index96.js.map +1 -1
  131. package/dist/index97.js +31 -12
  132. package/dist/index97.js.map +1 -1
  133. package/dist/index98.js +5 -32
  134. package/dist/index98.js.map +1 -1
  135. package/dist/index99.js +13 -5
  136. package/dist/index99.js.map +1 -1
  137. package/package.json +1 -1
  138. package/dist/components/Label.d.ts +0 -15
  139. package/dist/index107.js +0 -21
  140. package/dist/index107.js.map +0 -1
package/dist/index34.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as t, jsxs as j } from "react/jsx-runtime";
2
- import { createContext as ie, useId as H, useEffect as U, useRef as Y, isValidElement as G, cloneElement as le, useContext as ce } from "react";
3
- import { useForm as Q, useFieldArray as ue, useWatch as de, Controller as me } from "react-hook-form";
4
- const T = ie(void 0), W = {
1
+ import { jsx as t, jsxs as V } from "react/jsx-runtime";
2
+ import { createContext as he, useId as ee, useEffect as te, useRef as re, isValidElement as se, cloneElement as ge, useContext as pe } from "react";
3
+ import { useForm as ne, useFieldArray as ve, useWatch as xe, Controller as ye } from "react-hook-form";
4
+ const J = he(void 0), _ = {
5
5
  email: {
6
6
  value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
7
7
  message: "Please enter a valid email address"
@@ -15,223 +15,263 @@ const T = ie(void 0), W = {
15
15
  message: "Please enter a valid number"
16
16
  }
17
17
  };
18
- function Z() {
19
- const r = ce(T);
18
+ function K() {
19
+ const r = pe(J);
20
20
  if (!r)
21
21
  throw new Error("Form compound components must be used within Form");
22
22
  return r;
23
23
  }
24
- function fe({
24
+ function be({
25
25
  form: r,
26
- onFinish: o,
26
+ onFinish: n,
27
27
  onFinishFailed: s,
28
- initialValues: u,
29
- layout: f = "vertical",
30
- labelWidth: k = 60,
31
- size: h,
32
- disabled: d = !1,
33
- children: l,
34
- className: g = "",
35
- noValidate: p = !0,
36
- ...y
28
+ initialValues: i,
29
+ layout: x = "vertical",
30
+ labelWidth: h = 60,
31
+ size: k,
32
+ disabled: l = !1,
33
+ children: g,
34
+ className: c = "",
35
+ noValidate: y = !0,
36
+ ...b
37
37
  }) {
38
- const i = Q({
39
- defaultValues: u
40
- }), v = r || i, I = async (c) => {
41
- if (c.preventDefault(), await v.trigger())
42
- o && o(v.getValues());
38
+ const d = ne({
39
+ defaultValues: i
40
+ }), m = r || d, L = async (E) => {
41
+ if (E.preventDefault(), await m.trigger())
42
+ n && n(m.getValues());
43
43
  else if (s) {
44
- const P = v.formState.errors, E = [], z = (R, L = "") => {
45
- for (const $ in R) {
46
- const m = L ? `${L}.${$}` : $, b = R[$];
47
- b?.message ? E.push({ name: m, errors: [b.message] }) : typeof b == "object" && b !== null && z(b, m);
44
+ const A = m.formState.errors, u = [], N = (I, M = "") => {
45
+ for (const P in I) {
46
+ const B = M ? `${M}.${P}` : P, $ = I[P];
47
+ $?.message ? u.push({ name: B, errors: [$.message] }) : typeof $ == "object" && $ !== null && N($, B);
48
48
  }
49
49
  };
50
- z(P), s({ values: v.getValues(), errorFields: E });
50
+ N(A), s({ values: m.getValues(), errorFields: u });
51
51
  }
52
- }, M = (c) => {
53
- c.preventDefault(), v.reset(u);
52
+ }, S = (E) => {
53
+ E.preventDefault(), m.reset(i);
54
54
  };
55
- return /* @__PURE__ */ t(T.Provider, { value: { form: v, layout: f, labelWidth: k, size: h, disabled: d }, children: /* @__PURE__ */ t("form", { onSubmit: I, onReset: M, className: g, noValidate: p, ...y, children: l }) });
55
+ return /* @__PURE__ */ t(J.Provider, { value: { form: m, layout: x, labelWidth: h, size: k, disabled: l }, children: /* @__PURE__ */ t("form", { onSubmit: L, onReset: S, className: c, noValidate: y, ...b, children: g }) });
56
56
  }
57
- function he({
57
+ function Ne({
58
58
  name: r,
59
- label: o,
60
- help: s,
61
- required: u = !1,
62
- rules: f,
59
+ label: n,
60
+ floatingLabel: s,
61
+ help: i,
62
+ required: x = !1,
63
+ rules: h,
63
64
  valuePropName: k = "value",
64
- inline: h = !1,
65
- className: d = "",
66
- children: l,
67
- tooltip: g,
68
- extra: p,
69
- hasFeedback: y = !1,
70
- dependencies: i,
71
- validateTrigger: v = "onChange",
72
- initialValue: I,
73
- hidden: M = !1
65
+ inline: l = !1,
66
+ className: g = "",
67
+ children: c,
68
+ tooltip: y,
69
+ extra: b,
70
+ hasFeedback: d = !1,
71
+ dependencies: m,
72
+ validateTrigger: L = "onChange",
73
+ initialValue: S,
74
+ hidden: E = !1,
75
+ addonBefore: j,
76
+ addonAfter: A
74
77
  }) {
75
- const { form: c, size: q, listName: P, layout: E, labelWidth: z, disabled: R } = Z(), L = H(), $ = H();
78
+ const { form: u, size: N, listName: I, layout: M, labelWidth: P, disabled: B } = K(), $ = ee(), q = ee();
76
79
  if (!r)
77
- return /* @__PURE__ */ t("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${d}`, style: M ? { display: "none" } : void 0, children: l });
78
- let m;
79
- Array.isArray(r) ? m = (P ? [P, ...r] : r).join(".") : m = r, U(() => {
80
- I !== void 0 && c.getValues(m) === void 0 && c.setValue(m, I);
80
+ return /* @__PURE__ */ t("div", { className: `form-control ${l ? "w-auto" : "w-full"} ${g}`, style: E ? { display: "none" } : void 0, children: c });
81
+ let p;
82
+ Array.isArray(r) ? p = (I ? [I, ...r] : r).join(".") : p = r, te(() => {
83
+ S !== void 0 && u.getValues(p) === void 0 && u.setValue(p, S);
81
84
  }, []);
82
- const b = de({
83
- control: c.control,
84
- name: i,
85
- disabled: !i || i.length === 0
86
- }), O = Y(c);
87
- O.current = c;
88
- const B = Y(void 0);
89
- U(() => {
90
- if (!i || i.length === 0) return;
91
- if (B.current === void 0) {
92
- B.current = JSON.stringify(b);
85
+ const T = xe({
86
+ control: u.control,
87
+ name: m,
88
+ disabled: !m || m.length === 0
89
+ }), H = re(u);
90
+ H.current = u;
91
+ const W = re(void 0);
92
+ te(() => {
93
+ if (!m || m.length === 0) return;
94
+ if (W.current === void 0) {
95
+ W.current = JSON.stringify(T);
93
96
  return;
94
97
  }
95
- const e = JSON.stringify(b);
96
- B.current !== e && (B.current = e, O.current.trigger(m));
97
- }, [b, i, m]);
98
- const A = ((e) => {
99
- const n = e.split(".");
100
- let a = c.formState.errors;
101
- for (const C of n) {
98
+ const e = JSON.stringify(T);
99
+ W.current !== e && (W.current = e, H.current.trigger(p));
100
+ }, [T, m, p]);
101
+ const z = ((e) => {
102
+ const o = e.split(".");
103
+ let a = u.formState.errors;
104
+ for (const R of o) {
102
105
  if (!a) break;
103
- a = a[C];
106
+ a = a[R];
104
107
  }
105
108
  return a;
106
- })(m), V = A?.message, X = f ? Array.isArray(f) ? f : [f] : [], w = {}, S = [], D = [];
107
- u && (w.required = "This field is required");
108
- for (const e of X) {
109
- if (e.required && (w.required = typeof e.required == "string" ? e.required : e.message || "This field is required"), e.type && W[e.type] && S.push({
110
- pattern: W[e.type].value,
111
- message: e.message || W[e.type].message
109
+ })(p), w = z?.message, oe = h ? Array.isArray(h) ? h : [h] : [], C = {}, D = [], Z = [];
110
+ x && (C.required = "This field is required");
111
+ for (const e of oe) {
112
+ if (e.required && (C.required = typeof e.required == "string" ? e.required : e.message || "This field is required"), e.type && _[e.type] && D.push({
113
+ pattern: _[e.type].value,
114
+ message: e.message || _[e.type].message
112
115
  }), e.min !== void 0) {
113
- const n = typeof e.min == "object" ? e.min.value : e.min, a = typeof e.min == "object" ? e.min.message : e.message || `Minimum length is ${n} characters`;
114
- w.minLength = { value: n, message: a };
116
+ const o = typeof e.min == "object" ? e.min.value : e.min, a = typeof e.min == "object" ? e.min.message : e.message || `Minimum length is ${o} characters`;
117
+ C.minLength = { value: o, message: a };
115
118
  }
116
119
  if (e.max !== void 0) {
117
- const n = typeof e.max == "object" ? e.max.value : e.max, a = typeof e.max == "object" ? e.max.message : e.message || `Maximum length is ${n} characters`;
118
- w.maxLength = { value: n, message: a };
120
+ const o = typeof e.max == "object" ? e.max.value : e.max, a = typeof e.max == "object" ? e.max.message : e.message || `Maximum length is ${o} characters`;
121
+ C.maxLength = { value: o, message: a };
119
122
  }
120
123
  if (e.pattern) {
121
- const n = e.pattern instanceof RegExp ? e.pattern : e.pattern.value, a = e.pattern instanceof RegExp ? e.message || "Invalid format" : e.pattern.message;
122
- S.push({ pattern: n, message: a });
124
+ const o = e.pattern instanceof RegExp ? e.pattern : e.pattern.value, a = e.pattern instanceof RegExp ? e.message || "Invalid format" : e.pattern.message;
125
+ D.push({ pattern: o, message: a });
123
126
  }
124
- e.validate && D.push(e.validate);
127
+ e.validate && Z.push(e.validate);
125
128
  }
126
- (S.length > 0 || D.length > 0) && (w.validate = async (e) => {
127
- if (!e && !w.required) return !0;
128
- for (const { pattern: n, message: a } of S)
129
- if (e && !n.test(e))
129
+ (D.length > 0 || Z.length > 0) && (C.validate = async (e) => {
130
+ if (!e && !C.required) return !0;
131
+ for (const { pattern: o, message: a } of D)
132
+ if (e && !o.test(e))
130
133
  return a;
131
- for (const n of D) {
132
- const a = await n(e);
134
+ for (const o of Z) {
135
+ const a = await o(e);
133
136
  if (a !== !0)
134
137
  return a;
135
138
  }
136
139
  return !0;
137
140
  });
138
- const _ = Array.isArray(v) ? v : [v], J = _.includes("onChange"), ee = _.includes("onBlur"), te = ({ hasError: e, isValidating: n }) => n ? /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-xs text-base-content/50" }) : e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-error", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-success", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), re = () => /* @__PURE__ */ t("div", { className: "tooltip tooltip-top ml-1", "data-tip": g, children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-base-content/50 cursor-help", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
141
+ const U = Array.isArray(L) ? L : [L], Y = U.includes("onChange"), ae = U.includes("onBlur"), ie = ({ hasError: e, isValidating: o }) => o ? /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-xs text-base-content/50" }) : e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-error", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }) : /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-success", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }), le = () => /* @__PURE__ */ t("div", { className: "tooltip tooltip-top ml-1", "data-tip": y, children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-base-content/50 cursor-help", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
139
142
  return /* @__PURE__ */ t(
140
- me,
143
+ ye,
141
144
  {
142
- name: m,
143
- control: c.control,
144
- rules: w,
145
- render: ({ field: e, fieldState: n }) => {
146
- const { value: a, onChange: C, onBlur: se, ref: oe } = e, ne = n.isTouched && c.formState.isValidating, x = {
147
- id: L,
148
- ref: oe,
149
- "aria-invalid": A ? !0 : void 0,
150
- "aria-describedby": A ? $ : void 0
145
+ name: p,
146
+ control: u.control,
147
+ rules: C,
148
+ render: ({ field: e, fieldState: o }) => {
149
+ const { value: a, onChange: R, onBlur: ce, ref: ue } = e, me = o.isTouched && u.formState.isValidating, v = {
150
+ id: $,
151
+ ref: ue,
152
+ "aria-invalid": z ? !0 : void 0,
153
+ "aria-describedby": z ? q : void 0
154
+ };
155
+ v.onBlur = () => {
156
+ ce(), ae && u.trigger(p);
157
+ }, k === "checked" ? (v.checked = a, v.onChange = (f) => {
158
+ R(f.target.checked), Y && u.trigger(p);
159
+ }) : (v.value = a || "", v.onChange = (f) => {
160
+ f && f.target !== void 0 ? R(f.target.value) : R(f), Y && u.trigger(p);
161
+ }), N && se(c) && (c.props.size || (v.size = N)), z && (v.color = "error", v["aria-invalid"] = !0), B && (v.disabled = !0), (j || A) && (v.unstyled = !0);
162
+ const G = se(c) ? ge(c, v) : c, F = M === "horizontal", Q = M === "inline", X = {
163
+ xs: "input-xs",
164
+ sm: "input-sm",
165
+ md: "input-md",
166
+ lg: "input-lg",
167
+ xl: "input-xl"
168
+ }, de = () => {
169
+ const f = /* @__PURE__ */ V("div", { className: `${F ? "flex-1" : ""} ${d ? "relative" : ""}`, children: [
170
+ G,
171
+ d && o.isTouched && /* @__PURE__ */ t("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ t(ie, { hasError: !!z, isValidating: me }) })
172
+ ] });
173
+ if (s) {
174
+ const O = [
175
+ "floating-label",
176
+ N && X[N]
177
+ ].filter(Boolean).join(" ");
178
+ return /* @__PURE__ */ V("label", { className: O, children: [
179
+ G,
180
+ /* @__PURE__ */ V("span", { children: [
181
+ s,
182
+ x && /* @__PURE__ */ t("span", { className: "text-error ml-1", children: "*" })
183
+ ] })
184
+ ] });
185
+ }
186
+ return f;
187
+ }, fe = (f) => {
188
+ if (!j && !A) return f;
189
+ const O = [
190
+ "input",
191
+ "input-bordered",
192
+ "flex",
193
+ "items-center",
194
+ "gap-2",
195
+ N && X[N]
196
+ ].filter(Boolean).join(" ");
197
+ return /* @__PURE__ */ V("label", { className: O, children: [
198
+ j && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: j }),
199
+ f,
200
+ A && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: A })
201
+ ] });
151
202
  };
152
- x.onBlur = () => {
153
- se(), ee && c.trigger(m);
154
- }, k === "checked" ? (x.checked = a, x.onChange = (F) => {
155
- C(F.target.checked), J && c.trigger(m);
156
- }) : (x.value = a || "", x.onChange = (F) => {
157
- F && F.target !== void 0 ? C(F.target.value) : C(F), J && c.trigger(m);
158
- }), q && G(l) && (l.props.size || (x.size = q)), A && (x.color = "error", x["aria-invalid"] = !0), R && (x.disabled = !0);
159
- const ae = G(l) ? le(l, x) : l, N = E === "horizontal", K = E === "inline";
160
- return /* @__PURE__ */ j("div", { className: `form-control ${h ? "w-auto" : "w-full"} ${N ? "mb-4" : ""} ${K ? "inline-flex mr-4" : ""} ${d}`, style: M ? { display: "none" } : void 0, children: [
161
- /* @__PURE__ */ j("div", { className: N ? "flex items-center gap-4" : "", children: [
162
- o && /* @__PURE__ */ t(
203
+ return /* @__PURE__ */ V("div", { className: `form-control ${l ? "w-auto" : "w-full"} ${F ? "mb-4" : ""} ${Q ? "inline-flex mr-4" : ""} ${g}`, style: E ? { display: "none" } : void 0, children: [
204
+ /* @__PURE__ */ V("div", { className: F ? "flex items-center gap-4" : "", children: [
205
+ n && !s && /* @__PURE__ */ t(
163
206
  "label",
164
207
  {
165
- htmlFor: L,
166
- className: `label ${N ? "flex-shrink-0 justify-end py-0" : ""} ${!N && !K ? "pb-1" : ""}`,
167
- style: N ? { width: z } : void 0,
168
- children: /* @__PURE__ */ j("span", { className: "label-text flex items-center", children: [
169
- o,
170
- u && /* @__PURE__ */ t("span", { className: "text-error ml-1", children: "*" }),
171
- g && /* @__PURE__ */ t(re, {})
208
+ htmlFor: $,
209
+ className: `block text-sm font-medium ${F ? "flex-shrink-0 text-right" : ""} ${!F && !Q ? "mb-1" : ""}`,
210
+ style: F ? { width: P } : void 0,
211
+ children: /* @__PURE__ */ V("span", { className: "flex items-center", children: [
212
+ n,
213
+ x && /* @__PURE__ */ t("span", { className: "text-error ml-1", children: "*" }),
214
+ y && /* @__PURE__ */ t(le, {})
172
215
  ] })
173
216
  }
174
217
  ),
175
- /* @__PURE__ */ j("div", { className: `${N ? "flex-1" : ""} ${y ? "relative" : ""}`, children: [
176
- ae,
177
- y && n.isTouched && /* @__PURE__ */ t("span", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", children: /* @__PURE__ */ t(te, { hasError: !!A, isValidating: ne }) })
178
- ] })
218
+ fe(de())
179
219
  ] }),
180
- !N && !h && /* @__PURE__ */ t("p", { id: $, className: `validator-hint ${V ? "!visible text-error" : ""} min-h-[1.25rem]`, role: V ? "alert" : void 0, children: V || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) || " " }),
181
- N && (V || s) && /* @__PURE__ */ t("p", { id: $, className: `validator-hint ${V ? "!visible text-error" : ""} min-h-[1.25rem]`, role: V ? "alert" : void 0, children: V || s && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: s }) }),
182
- p && /* @__PURE__ */ t("div", { className: "text-sm text-base-content/60 mt-1", children: p })
220
+ !F && !l && /* @__PURE__ */ t("p", { id: q, className: `validator-hint ${w ? "!visible text-error" : ""} min-h-[1.25rem]`, role: w ? "alert" : void 0, children: w || i && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: i }) || " " }),
221
+ F && (w || i) && /* @__PURE__ */ t("p", { id: q, className: `validator-hint ${w ? "!visible text-error" : ""} min-h-[1.25rem]`, role: w ? "alert" : void 0, children: w || i && /* @__PURE__ */ t("span", { className: "text-base-content/70", children: i }) }),
222
+ b && /* @__PURE__ */ t("div", { className: "text-sm text-base-content/60 mt-1", children: b })
183
223
  ] });
184
224
  }
185
225
  }
186
226
  );
187
227
  }
188
- function ge({
228
+ function ke({
189
229
  name: r,
190
- children: o
230
+ children: n
191
231
  }) {
192
- const { form: s, layout: u, size: f, disabled: k } = Z(), { fields: h, append: d, remove: l, move: g } = ue({
232
+ const { form: s, layout: i, size: x, disabled: h } = K(), { fields: k, append: l, remove: g, move: c } = ve({
193
233
  control: s.control,
194
234
  name: r
195
- }), p = h.map((y, i) => ({
196
- ...y,
197
- name: i
235
+ }), y = k.map((b, d) => ({
236
+ ...b,
237
+ name: d
198
238
  }));
199
- return /* @__PURE__ */ t(T.Provider, { value: { form: s, layout: u, size: f, listName: r, disabled: k }, children: o(p, {
200
- add: d,
201
- remove: l,
202
- move: g
239
+ return /* @__PURE__ */ t(J.Provider, { value: { form: s, layout: i, size: x, listName: r, disabled: h }, children: n(y, {
240
+ add: l,
241
+ remove: g,
242
+ move: c
203
243
  }) });
204
244
  }
205
- function pe() {
206
- const r = Q(), o = r;
207
- return o.setFieldValue = r.setValue, o.getFieldValue = (s) => r.getValues(s), o.getFieldsValue = r.getValues, o.setFieldsValue = (s) => {
208
- Object.keys(s).forEach((u) => {
209
- r.setValue(u, s[u]);
245
+ function $e() {
246
+ const r = ne(), n = r;
247
+ return n.setFieldValue = r.setValue, n.getFieldValue = (s) => r.getValues(s), n.getFieldsValue = r.getValues, n.setFieldsValue = (s) => {
248
+ Object.keys(s).forEach((i) => {
249
+ r.setValue(i, s[i]);
210
250
  });
211
- }, o.validateFields = r.trigger, o.resetFields = r.reset, o.isFieldTouched = (s) => !!r.formState.touchedFields[s], o.getFieldError = (s) => r.formState.errors[s]?.message, o;
251
+ }, n.validateFields = r.trigger, n.resetFields = r.reset, n.isFieldTouched = (s) => !!r.formState.touchedFields[s], n.getFieldError = (s) => r.formState.errors[s]?.message, n;
212
252
  }
213
- function ve({ fields: r, className: o = "" }) {
214
- const { form: s } = Z(), { errors: u } = s.formState, f = (d, l = "") => {
215
- const g = [];
216
- for (const p in d) {
217
- const y = l ? `${l}.${p}` : p, i = d[p];
218
- i?.message ? g.push({ field: y, message: i.message }) : typeof i == "object" && i !== null && g.push(...f(i, y));
253
+ function Fe({ fields: r, className: n = "" }) {
254
+ const { form: s } = K(), { errors: i } = s.formState, x = (l, g = "") => {
255
+ const c = [];
256
+ for (const y in l) {
257
+ const b = g ? `${g}.${y}` : y, d = l[y];
258
+ d?.message ? c.push({ field: b, message: d.message }) : typeof d == "object" && d !== null && c.push(...x(d, b));
219
259
  }
220
- return g;
221
- }, k = f(u), h = r ? k.filter((d) => r.includes(d.field)) : k;
222
- return h.length === 0 ? null : /* @__PURE__ */ t("ul", { className: `text-error text-sm space-y-1 ${o}`, role: "alert", children: h.map((d, l) => /* @__PURE__ */ j("li", { className: "flex items-start gap-2", children: [
260
+ return c;
261
+ }, h = x(i), k = r ? h.filter((l) => r.includes(l.field)) : h;
262
+ return k.length === 0 ? null : /* @__PURE__ */ t("ul", { className: `text-error text-sm space-y-1 ${n}`, role: "alert", children: k.map((l, g) => /* @__PURE__ */ V("li", { className: "flex items-start gap-2", children: [
223
263
  /* @__PURE__ */ t("svg", { className: "w-4 h-4 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
224
- /* @__PURE__ */ t("span", { children: d.message })
225
- ] }, `${d.field}-${l}`)) });
264
+ /* @__PURE__ */ t("span", { children: l.message })
265
+ ] }, `${l.field}-${g}`)) });
226
266
  }
227
- const Ne = Object.assign(fe, {
228
- Item: he,
229
- List: ge,
230
- ErrorList: ve,
231
- useForm: pe
267
+ const Le = Object.assign(be, {
268
+ Item: Ne,
269
+ List: ke,
270
+ ErrorList: Fe,
271
+ useForm: $e
232
272
  });
233
273
  export {
234
- Ne as Form,
235
- pe as useFormInstance
274
+ Le as Form,
275
+ $e as useFormInstance
236
276
  };
237
277
  //# sourceMappingURL=index34.js.map