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.
- package/dist/components/Checkbox.d.ts +3 -1
- package/dist/components/Form.d.ts +7 -1
- package/dist/components/Input.d.ts +10 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +134 -136
- package/dist/index.js.map +1 -1
- package/dist/index10.js +70 -65
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +43 -11
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +11 -44
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +12 -10
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +7 -14
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +12 -7
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +29 -11
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +16 -29
- package/dist/index106.js.map +1 -1
- package/dist/index34.js +198 -158
- package/dist/index34.js.map +1 -1
- package/dist/index42.js +185 -148
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +19 -19
- package/dist/index43.js.map +1 -1
- package/dist/index46.js +134 -18
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +10 -134
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +35 -13
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +34 -35
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +81 -34
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +166 -71
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +144 -167
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +11 -152
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +20 -10
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +14 -22
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +7 -14
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +333 -6
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +47 -334
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +122 -47
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +108 -120
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +167 -107
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +29 -167
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +120 -30
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +80 -116
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +19 -85
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +73 -19
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +54 -71
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +44 -56
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +49 -42
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +121 -50
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +102 -118
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +41 -107
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +68 -41
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +19 -66
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +55 -18
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +251 -55
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +22 -254
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +31 -22
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +93 -30
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +324 -89
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +73 -322
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +39 -79
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +23 -40
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +93 -21
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +148 -87
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +152 -147
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +63 -159
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +35 -65
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +234 -35
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +31 -231
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +210 -34
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +198 -195
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +241 -159
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +166 -283
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +253 -173
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +14 -258
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +31 -12
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +5 -32
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +13 -5
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Label.d.ts +0 -15
- package/dist/index107.js +0 -21
- package/dist/index107.js.map +0 -1
package/dist/index34.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { useForm as
|
|
4
|
-
const
|
|
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
|
|
19
|
-
const r =
|
|
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
|
|
24
|
+
function be({
|
|
25
25
|
form: r,
|
|
26
|
-
onFinish:
|
|
26
|
+
onFinish: n,
|
|
27
27
|
onFinishFailed: s,
|
|
28
|
-
initialValues:
|
|
29
|
-
layout:
|
|
30
|
-
labelWidth:
|
|
31
|
-
size:
|
|
32
|
-
disabled:
|
|
33
|
-
children:
|
|
34
|
-
className:
|
|
35
|
-
noValidate:
|
|
36
|
-
...
|
|
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
|
|
39
|
-
defaultValues:
|
|
40
|
-
}),
|
|
41
|
-
if (
|
|
42
|
-
|
|
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
|
|
45
|
-
for (const
|
|
46
|
-
const
|
|
47
|
-
|
|
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
|
-
|
|
50
|
+
N(A), s({ values: m.getValues(), errorFields: u });
|
|
51
51
|
}
|
|
52
|
-
},
|
|
53
|
-
|
|
52
|
+
}, S = (E) => {
|
|
53
|
+
E.preventDefault(), m.reset(i);
|
|
54
54
|
};
|
|
55
|
-
return /* @__PURE__ */ t(
|
|
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
|
|
57
|
+
function Ne({
|
|
58
58
|
name: r,
|
|
59
|
-
label:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
label: n,
|
|
60
|
+
floatingLabel: s,
|
|
61
|
+
help: i,
|
|
62
|
+
required: x = !1,
|
|
63
|
+
rules: h,
|
|
63
64
|
valuePropName: k = "value",
|
|
64
|
-
inline:
|
|
65
|
-
className:
|
|
66
|
-
children:
|
|
67
|
-
tooltip:
|
|
68
|
-
extra:
|
|
69
|
-
hasFeedback:
|
|
70
|
-
dependencies:
|
|
71
|
-
validateTrigger:
|
|
72
|
-
initialValue:
|
|
73
|
-
hidden:
|
|
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:
|
|
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 ${
|
|
78
|
-
let
|
|
79
|
-
Array.isArray(r) ?
|
|
80
|
-
|
|
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
|
|
83
|
-
control:
|
|
84
|
-
name:
|
|
85
|
-
disabled: !
|
|
86
|
-
}),
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
if (!
|
|
91
|
-
if (
|
|
92
|
-
|
|
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(
|
|
96
|
-
|
|
97
|
-
}, [
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
let a =
|
|
101
|
-
for (const
|
|
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[
|
|
106
|
+
a = a[R];
|
|
104
107
|
}
|
|
105
108
|
return a;
|
|
106
|
-
})(
|
|
107
|
-
|
|
108
|
-
for (const e of
|
|
109
|
-
if (e.required && (
|
|
110
|
-
pattern:
|
|
111
|
-
message: e.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
|
|
114
|
-
|
|
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
|
|
118
|
-
|
|
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
|
|
122
|
-
|
|
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 &&
|
|
127
|
+
e.validate && Z.push(e.validate);
|
|
125
128
|
}
|
|
126
|
-
(
|
|
127
|
-
if (!e && !
|
|
128
|
-
for (const { pattern:
|
|
129
|
-
if (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
|
|
132
|
-
const a = await
|
|
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
|
|
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
|
-
|
|
143
|
+
ye,
|
|
141
144
|
{
|
|
142
|
-
name:
|
|
143
|
-
control:
|
|
144
|
-
rules:
|
|
145
|
-
render: ({ field: e, fieldState:
|
|
146
|
-
const { value: a, onChange:
|
|
147
|
-
id:
|
|
148
|
-
ref:
|
|
149
|
-
"aria-invalid":
|
|
150
|
-
"aria-describedby":
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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:
|
|
166
|
-
className: `
|
|
167
|
-
style:
|
|
168
|
-
children: /* @__PURE__ */
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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
|
-
!
|
|
181
|
-
|
|
182
|
-
|
|
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
|
|
228
|
+
function ke({
|
|
189
229
|
name: r,
|
|
190
|
-
children:
|
|
230
|
+
children: n
|
|
191
231
|
}) {
|
|
192
|
-
const { form: s, layout:
|
|
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
|
-
}),
|
|
196
|
-
...
|
|
197
|
-
name:
|
|
235
|
+
}), y = k.map((b, d) => ({
|
|
236
|
+
...b,
|
|
237
|
+
name: d
|
|
198
238
|
}));
|
|
199
|
-
return /* @__PURE__ */ t(
|
|
200
|
-
add:
|
|
201
|
-
remove:
|
|
202
|
-
move:
|
|
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
|
|
206
|
-
const r =
|
|
207
|
-
return
|
|
208
|
-
Object.keys(s).forEach((
|
|
209
|
-
r.setValue(
|
|
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
|
-
},
|
|
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
|
|
214
|
-
const { form: s } =
|
|
215
|
-
const
|
|
216
|
-
for (const
|
|
217
|
-
const
|
|
218
|
-
|
|
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
|
|
221
|
-
},
|
|
222
|
-
return
|
|
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:
|
|
225
|
-
] }, `${
|
|
264
|
+
/* @__PURE__ */ t("span", { children: l.message })
|
|
265
|
+
] }, `${l.field}-${g}`)) });
|
|
226
266
|
}
|
|
227
|
-
const
|
|
228
|
-
Item:
|
|
229
|
-
List:
|
|
230
|
-
ErrorList:
|
|
231
|
-
useForm:
|
|
267
|
+
const Le = Object.assign(be, {
|
|
268
|
+
Item: Ne,
|
|
269
|
+
List: ke,
|
|
270
|
+
ErrorList: Fe,
|
|
271
|
+
useForm: $e
|
|
232
272
|
});
|
|
233
273
|
export {
|
|
234
|
-
|
|
235
|
-
|
|
274
|
+
Le as Form,
|
|
275
|
+
$e as useFormInstance
|
|
236
276
|
};
|
|
237
277
|
//# sourceMappingURL=index34.js.map
|