jaguar-form 1.0.1 → 1.0.2
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/README.md +18 -0
- package/dist/{Control-fWNQOzmu.js → Control-C6d18GL4.js} +2 -2
- package/dist/{Select-BFLDNUiq.js → Select-DTSlMsRZ.js} +5 -5
- package/dist/{TreeSelect-D8smQmgp.js → TreeSelect-Dl_uTfIf.js} +5 -5
- package/dist/compound-Cw0juTQp.js +320 -0
- package/dist/compound.js +1 -0
- package/dist/core.js +3 -1
- package/dist/date-time.js +1 -1
- package/dist/form-Cih4H8PU.js +412 -0
- package/dist/form.js +4 -3
- package/dist/{icons-KmLuj5v3.js → icons-BDtmWaBt.js} +1 -1
- package/dist/{image-upload-CkX8vlWK.js → image-upload-Cm_41Fcr.js} +2 -2
- package/dist/image-upload.js +1 -1
- package/dist/index.js +14 -12
- package/dist/input.js +1 -1
- package/dist/{inputs-DNNFmj2K.js → inputs-dLfnlXTx.js} +3 -3
- package/dist/{pickers-BOMKe7vt.js → pickers-g2TPgXFC.js} +4 -4
- package/dist/select.js +1 -1
- package/dist/selection-CIEa1uce.js +146 -0
- package/dist/{slider-BwDcSnnI.js → slider-CNwkLMmo.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/{store-DmlIFdPW.js → store-DOn9K-EA.js} +171 -229
- package/dist/style.css +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/types/components/compound/ControlGroup.d.ts +29 -0
- package/dist/types/components/compound/context.d.ts +5 -0
- package/dist/types/components/compound/index.d.ts +40 -0
- package/dist/types/components/compound/model.d.ts +14 -0
- package/dist/types/components/compound/types.d.ts +24 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/entries/compound.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/{useControllable-Dl8gno_5.js → useControllable-Zax42z2F.js} +6 -1
- package/dist/{useSelection-FYP8nzFQ.js → useSelection-BX5VFNcj.js} +3 -3
- package/dist/validation-D6vk5NAv.js +61 -0
- package/package.json +5 -1
- package/dist/form-zqtJgUQ3.js +0 -407
- package/dist/selection-Bfrk6SoB.js +0 -136
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { c as e, s as t, t as n } from "./compound-Cw0juTQp.js";
|
|
2
|
+
import { a as r } from "./useControllable-Zax42z2F.js";
|
|
3
|
+
import { r as i } from "./locale-yHkdw2xz.js";
|
|
4
|
+
import { n as a, t as o } from "./slider-CNwkLMmo.js";
|
|
5
|
+
import { i as s, t as c } from "./image-upload-Cm_41Fcr.js";
|
|
6
|
+
import { cloneElement as l, createContext as u, isValidElement as d, useCallback as f, useContext as p, useEffect as m, useId as h, useMemo as g, useRef as _, useState as v, useSyncExternalStore as y } from "react";
|
|
7
|
+
import { d as b, n as x, t as S } from "./store-DOn9K-EA.js";
|
|
8
|
+
import { a as C, c as w, d as T, f as E, l as D, n as O, o as k, r as A, s as j, t as M, u as N } from "./inputs-dLfnlXTx.js";
|
|
9
|
+
import { n as P, t as F } from "./Select-DTSlMsRZ.js";
|
|
10
|
+
import { t as I } from "./TreeSelect-Dl_uTfIf.js";
|
|
11
|
+
import { a as L, c as R, i as z, l as B, n as ee, o as te, r as ne, s as re, t as ie, u as ae } from "./pickers-g2TPgXFC.js";
|
|
12
|
+
import { jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
13
|
+
// src/form/index.tsx
|
|
14
|
+
var U = u(null);
|
|
15
|
+
function W(e = {}) {
|
|
16
|
+
let [t] = v(() => {
|
|
17
|
+
let t = e.fields ?? [], n = {
|
|
18
|
+
...Object.fromEntries(t.map((e) => [e.name, Q(e)])),
|
|
19
|
+
...e.defaultValues
|
|
20
|
+
}, r = Object.fromEntries(t.filter((e) => e.transform).map((e) => [e.name, e.transform]));
|
|
21
|
+
return S(n, {
|
|
22
|
+
nested: e.nested,
|
|
23
|
+
initialValues: e.initialValues,
|
|
24
|
+
adapter: {
|
|
25
|
+
...e.adapter,
|
|
26
|
+
fields: {
|
|
27
|
+
...r,
|
|
28
|
+
...e.adapter?.fields
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
function G({ form: e, children: t }) {
|
|
36
|
+
return /* @__PURE__ */ V(U.Provider, {
|
|
37
|
+
value: e,
|
|
38
|
+
children: t
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function K() {
|
|
42
|
+
let e = p(U);
|
|
43
|
+
if (!e) throw Error("FormProvider is required");
|
|
44
|
+
return e;
|
|
45
|
+
}
|
|
46
|
+
function q(e) {
|
|
47
|
+
let t = K(), n = f((n) => t.subscribe(e, n), [t, e]), r = f(() => t.getFieldState(e), [t, e]), i = y(n, r, r);
|
|
48
|
+
return {
|
|
49
|
+
...i,
|
|
50
|
+
value: i.value,
|
|
51
|
+
setValue: (n) => t.setValue(e, n),
|
|
52
|
+
onBlur: () => t.blur(e)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function J(e) {
|
|
56
|
+
let t = K(), n = f((n) => t.subscribe(e, n), [t, e]), r = f(() => t.getValue(e), [t, e]);
|
|
57
|
+
return y(n, r, r);
|
|
58
|
+
}
|
|
59
|
+
function oe(e) {
|
|
60
|
+
let t = K(), n = J(e), r = h(), i = _(0), a = _([]), o = (e) => ({
|
|
61
|
+
key: `${r}-${++i.current}`,
|
|
62
|
+
value: e
|
|
63
|
+
}), s = (e) => {
|
|
64
|
+
let t = [...a.current];
|
|
65
|
+
return e.map((e) => {
|
|
66
|
+
let n = t.findIndex((t) => x(t.value, e));
|
|
67
|
+
return n < 0 ? o(e) : {
|
|
68
|
+
...t.splice(n, 1)[0],
|
|
69
|
+
value: e
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}, c = g(() => s(Array.isArray(n) ? n : []), [n]);
|
|
73
|
+
m(() => {
|
|
74
|
+
a.current = c;
|
|
75
|
+
}, [c]);
|
|
76
|
+
let l = (n) => {
|
|
77
|
+
let r = t.getValue(e), i = s(Array.isArray(r) ? r : []), c = n.type === "insert" ? {
|
|
78
|
+
...n,
|
|
79
|
+
value: o(n.value)
|
|
80
|
+
} : n.type === "update" ? {
|
|
81
|
+
...n,
|
|
82
|
+
value: {
|
|
83
|
+
key: i[n.index]?.key ?? "",
|
|
84
|
+
value: n.value
|
|
85
|
+
}
|
|
86
|
+
} : n, l = b(i, c);
|
|
87
|
+
return a.current = l, t.editFieldArray(e, n);
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
fields: c,
|
|
91
|
+
append: (n) => {
|
|
92
|
+
let r = t.getValue(e);
|
|
93
|
+
return l({
|
|
94
|
+
type: "insert",
|
|
95
|
+
index: Array.isArray(r) ? r.length : 0,
|
|
96
|
+
value: n
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
prepend: (e) => l({
|
|
100
|
+
type: "insert",
|
|
101
|
+
index: 0,
|
|
102
|
+
value: e
|
|
103
|
+
}),
|
|
104
|
+
insert: (e, t) => l({
|
|
105
|
+
type: "insert",
|
|
106
|
+
index: e,
|
|
107
|
+
value: t
|
|
108
|
+
}),
|
|
109
|
+
remove: (e) => l({
|
|
110
|
+
type: "remove",
|
|
111
|
+
index: e
|
|
112
|
+
}),
|
|
113
|
+
move: (e, t) => l({
|
|
114
|
+
type: "move",
|
|
115
|
+
from: e,
|
|
116
|
+
to: t
|
|
117
|
+
}),
|
|
118
|
+
update: (e, t) => l({
|
|
119
|
+
type: "update",
|
|
120
|
+
index: e,
|
|
121
|
+
value: t
|
|
122
|
+
}),
|
|
123
|
+
replace: (n) => t.setValue(e, n)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function se(e = (e) => e) {
|
|
127
|
+
let t = K(), n = _(null), r = f(() => {
|
|
128
|
+
let r = e(t.getFormSummary());
|
|
129
|
+
return n.current && x(n.current.value, r) ? n.current.value : (n.current = { value: r }, r);
|
|
130
|
+
}, [t, e]);
|
|
131
|
+
return y(t.subscribeAll, r, r);
|
|
132
|
+
}
|
|
133
|
+
function ce() {
|
|
134
|
+
let e = K();
|
|
135
|
+
return y(e.subscribeAll, e.getVersion, e.getVersion), {
|
|
136
|
+
values: e.getValues(),
|
|
137
|
+
changedValues: e.getChangedValues()
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
var le = (e) => e, ue = {
|
|
141
|
+
compound: n,
|
|
142
|
+
imageUpload: c,
|
|
143
|
+
input: C,
|
|
144
|
+
number: k,
|
|
145
|
+
password: j,
|
|
146
|
+
textarea: E,
|
|
147
|
+
switch: T,
|
|
148
|
+
checkbox: O,
|
|
149
|
+
radio: w,
|
|
150
|
+
checkboxGroup: A,
|
|
151
|
+
select: P,
|
|
152
|
+
multiSelect: F,
|
|
153
|
+
treeSelect: I,
|
|
154
|
+
date: ie,
|
|
155
|
+
dateRange: ee,
|
|
156
|
+
time: re,
|
|
157
|
+
timeRange: R,
|
|
158
|
+
dateTime: ne,
|
|
159
|
+
dateTimeRange: z,
|
|
160
|
+
month: L,
|
|
161
|
+
year: B,
|
|
162
|
+
monthRange: te,
|
|
163
|
+
yearRange: ae,
|
|
164
|
+
search: D,
|
|
165
|
+
segmented: N,
|
|
166
|
+
slider: a,
|
|
167
|
+
rangeSlider: o
|
|
168
|
+
};
|
|
169
|
+
function Y({ label: e, description: t, error: n, required: r, id: i, children: a, span: o = 1 }) {
|
|
170
|
+
return /* @__PURE__ */ H("div", {
|
|
171
|
+
className: "rfe-field",
|
|
172
|
+
style: { gridColumn: `span ${o}` },
|
|
173
|
+
children: [e && /* @__PURE__ */ H("label", {
|
|
174
|
+
htmlFor: i,
|
|
175
|
+
className: "rfe-field-label",
|
|
176
|
+
children: [e, r && /* @__PURE__ */ V("span", {
|
|
177
|
+
className: "rfe-required",
|
|
178
|
+
children: " *"
|
|
179
|
+
})]
|
|
180
|
+
}), /* @__PURE__ */ H("div", {
|
|
181
|
+
className: "rfe-field-content",
|
|
182
|
+
children: [a, n ? /* @__PURE__ */ V("div", {
|
|
183
|
+
id: i ? `${i}-help` : void 0,
|
|
184
|
+
role: "alert",
|
|
185
|
+
className: "rfe-error",
|
|
186
|
+
children: n
|
|
187
|
+
}) : t && /* @__PURE__ */ V("div", {
|
|
188
|
+
id: i ? `${i}-help` : void 0,
|
|
189
|
+
className: "rfe-description",
|
|
190
|
+
children: t
|
|
191
|
+
})]
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
var X = (e, t) => typeof e.visible == "function" ? e.visible(t) : e.visible !== !1, Z = (e) => e.type === "compound" && Array.isArray(e.componentProps?.fields) ? e.componentProps.fields : void 0, Q = (e) => e.defaultValue === void 0 ? Z(e) ? t(Z(e)) : void 0 : e.defaultValue;
|
|
196
|
+
function de(t) {
|
|
197
|
+
return [
|
|
198
|
+
...t.required && !t.rules?.some((e) => e.required) ? [{ required: !0 }] : [],
|
|
199
|
+
...t.rules ?? [],
|
|
200
|
+
...Z(t) ? [e(Z(t))] : [],
|
|
201
|
+
...t.type === "imageUpload" && t.componentProps?.mode === "upload" ? [s] : []
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
function fe({ field: e, components: t, fields: n, validateOn: a }) {
|
|
205
|
+
let o = K(), s = q(e.name), c = r(), l = h(), u = e.dependsOn, d = g(() => ({
|
|
206
|
+
rules: de(e),
|
|
207
|
+
debounce: e.debounce,
|
|
208
|
+
dependsOn: u,
|
|
209
|
+
validateOn: e.validateOn ?? a,
|
|
210
|
+
defaultValue: Q(e),
|
|
211
|
+
visible: (t) => X(e, t)
|
|
212
|
+
}), [
|
|
213
|
+
e,
|
|
214
|
+
u,
|
|
215
|
+
a
|
|
216
|
+
]);
|
|
217
|
+
m(() => o.registerField(e.name, { ...d }), [o, e.name]), m(() => o.updateField(e.name, d), [
|
|
218
|
+
o,
|
|
219
|
+
e.name,
|
|
220
|
+
d
|
|
221
|
+
]);
|
|
222
|
+
let p = f((t) => {
|
|
223
|
+
if (!u) return typeof e.visible == "function" || typeof e.disabled == "function" ? o.subscribeAll(t) : () => {};
|
|
224
|
+
let n = u.map((e) => o.subscribe(e, t));
|
|
225
|
+
return () => n.forEach((e) => e());
|
|
226
|
+
}, [
|
|
227
|
+
o,
|
|
228
|
+
u,
|
|
229
|
+
e.visible,
|
|
230
|
+
e.disabled
|
|
231
|
+
]);
|
|
232
|
+
y(p, o.getVersion, o.getVersion);
|
|
233
|
+
let _ = typeof e.visible == "function" || typeof e.disabled == "function" ? o.getValues() : $;
|
|
234
|
+
if (!X(e, _)) return null;
|
|
235
|
+
let v = t[e.type] ?? ue[e.type], b = {
|
|
236
|
+
...e.componentProps,
|
|
237
|
+
id: l,
|
|
238
|
+
name: e.name,
|
|
239
|
+
value: s.value ?? ([
|
|
240
|
+
"input",
|
|
241
|
+
"password",
|
|
242
|
+
"textarea",
|
|
243
|
+
"search"
|
|
244
|
+
].includes(e.type) ? "" : e.type === "switch" || e.type === "checkbox" ? !1 : e.type === "imageUpload" || e.type === "multiSelect" || e.type === "checkboxGroup" || e.type === "treeSelect" && e.componentProps?.multiple ? [] : e.type === "slider" ? 0 : e.type === "rangeSlider" ? [0, 100] : null),
|
|
245
|
+
onChange: (t) => {
|
|
246
|
+
o.setValue(e.name, t);
|
|
247
|
+
},
|
|
248
|
+
onBlur: () => {
|
|
249
|
+
o.blur(e.name);
|
|
250
|
+
},
|
|
251
|
+
status: s.error ? "error" : "default",
|
|
252
|
+
"aria-invalid": !!s.error,
|
|
253
|
+
disabled: typeof e.disabled == "function" ? e.disabled(_) : e.disabled ?? e.componentProps?.disabled,
|
|
254
|
+
"aria-describedby": s.error || e.description ? `${l}-help` : void 0
|
|
255
|
+
};
|
|
256
|
+
return /* @__PURE__ */ H(Y, {
|
|
257
|
+
label: e.label,
|
|
258
|
+
required: e.required,
|
|
259
|
+
description: e.description,
|
|
260
|
+
error: i(s.issue, s.error, c),
|
|
261
|
+
id: l,
|
|
262
|
+
span: e.span,
|
|
263
|
+
children: [e.render ? e.render(b) : v ? /* @__PURE__ */ V(v, { ...b }) : /* @__PURE__ */ V("div", {
|
|
264
|
+
className: "rfe-error",
|
|
265
|
+
children: c.t("unknownField", { type: e.type })
|
|
266
|
+
}), s.validating && /* @__PURE__ */ V("small", {
|
|
267
|
+
role: "status",
|
|
268
|
+
className: "rfe-description",
|
|
269
|
+
children: c.t("validating")
|
|
270
|
+
})]
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
var pe = u("blur"), me = [], $ = {}, he = {};
|
|
274
|
+
function ge({ nested: e, initialValues: t, adapter: n, submitHiddenFields: i = !1, validateOn: a = "blur", form: o, fields: s = me, defaultValues: c = $, components: l = he, children: u, columns: d = 1, layout: f = "vertical", onSubmit: p, onError: m, submitText: h, resetText: g, showActions: y = !0 }) {
|
|
275
|
+
let b = r(), x = W(o ? {} : {
|
|
276
|
+
fields: s,
|
|
277
|
+
defaultValues: c,
|
|
278
|
+
initialValues: t,
|
|
279
|
+
adapter: n,
|
|
280
|
+
nested: e
|
|
281
|
+
}), S = o ?? x, [C, w] = v(!1), [T, E] = v(""), D = _(!1), O = _(null);
|
|
282
|
+
return /* @__PURE__ */ V(G, {
|
|
283
|
+
form: S,
|
|
284
|
+
children: /* @__PURE__ */ V(pe.Provider, {
|
|
285
|
+
value: a,
|
|
286
|
+
children: /* @__PURE__ */ H("form", {
|
|
287
|
+
ref: O,
|
|
288
|
+
className: "rfe-form",
|
|
289
|
+
"data-layout": f,
|
|
290
|
+
noValidate: !0,
|
|
291
|
+
onSubmit: async (e) => {
|
|
292
|
+
if (e.preventDefault(), !D.current) {
|
|
293
|
+
D.current = !0, w(!0), E("");
|
|
294
|
+
try {
|
|
295
|
+
let e = S.getDataVersion(), t = await S.validate();
|
|
296
|
+
if (S.getDataVersion() !== e || !t) {
|
|
297
|
+
requestAnimationFrame(() => O.current?.querySelector("input[aria-invalid=\"true\"],button[aria-invalid=\"true\"],textarea[aria-invalid=\"true\"],[tabindex][aria-invalid=\"true\"]")?.focus());
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
await p?.(S.getSubmitValues(i));
|
|
301
|
+
} catch (e) {
|
|
302
|
+
E(e instanceof Error ? e.message : b.t("submitFailed")), m?.(e);
|
|
303
|
+
} finally {
|
|
304
|
+
D.current = !1, w(!1);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ H("div", {
|
|
310
|
+
className: "rfe-form-grid",
|
|
311
|
+
style: { gridTemplateColumns: `repeat(${Math.max(1, d)},minmax(0,1fr))` },
|
|
312
|
+
children: [s.map((e) => /* @__PURE__ */ V(fe, {
|
|
313
|
+
field: e,
|
|
314
|
+
components: l,
|
|
315
|
+
fields: s,
|
|
316
|
+
validateOn: a
|
|
317
|
+
}, e.name)), u]
|
|
318
|
+
}),
|
|
319
|
+
T && /* @__PURE__ */ V("div", {
|
|
320
|
+
role: "alert",
|
|
321
|
+
className: "rfe-error",
|
|
322
|
+
children: T
|
|
323
|
+
}),
|
|
324
|
+
y && /* @__PURE__ */ H("div", {
|
|
325
|
+
className: "rfe-form-actions",
|
|
326
|
+
children: [/* @__PURE__ */ V(M, {
|
|
327
|
+
variant: "secondary",
|
|
328
|
+
disabled: C,
|
|
329
|
+
onClick: () => {
|
|
330
|
+
S.reset(), E("");
|
|
331
|
+
},
|
|
332
|
+
children: g ?? b.t("reset")
|
|
333
|
+
}), /* @__PURE__ */ V(M, {
|
|
334
|
+
type: "submit",
|
|
335
|
+
loading: C,
|
|
336
|
+
children: h ?? b.t("save")
|
|
337
|
+
})]
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
})
|
|
341
|
+
})
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function _e({ children: a, name: o, label: u, description: _, required: v, rules: b, defaultValue: x, dependsOn: S, debounce: C, validateOn: w, span: T, disabled: E, visible: D, componentProps: O }) {
|
|
345
|
+
let k = K(), A = p(pe), j = w ?? A, M = q(o), N = r(), P = h(), F = d(a) && a.type === n ? a.props.fields : void 0, I = d(a) && a.type === c && a.props.mode === "upload", L = g(() => ({
|
|
346
|
+
rules: [
|
|
347
|
+
...v && !b?.some((e) => e.required) ? [{ required: !0 }] : [],
|
|
348
|
+
...b ?? [],
|
|
349
|
+
...I ? [s] : [],
|
|
350
|
+
...F ? [e(F)] : []
|
|
351
|
+
],
|
|
352
|
+
defaultValue: x ?? (F ? t(F) : void 0),
|
|
353
|
+
dependsOn: S,
|
|
354
|
+
debounce: C,
|
|
355
|
+
validateOn: j,
|
|
356
|
+
visible: (e) => typeof D == "function" ? D(e) : D !== !1
|
|
357
|
+
}), [
|
|
358
|
+
v,
|
|
359
|
+
b,
|
|
360
|
+
x,
|
|
361
|
+
S,
|
|
362
|
+
C,
|
|
363
|
+
j,
|
|
364
|
+
D,
|
|
365
|
+
I,
|
|
366
|
+
F
|
|
367
|
+
]);
|
|
368
|
+
m(() => k.registerField(o, { ...L }), [k, o]), m(() => k.updateField(o, L), [
|
|
369
|
+
k,
|
|
370
|
+
o,
|
|
371
|
+
L
|
|
372
|
+
]);
|
|
373
|
+
let R = f((e) => typeof D == "function" || typeof E == "function" ? k.subscribeAll(e) : () => {}, [
|
|
374
|
+
k,
|
|
375
|
+
D,
|
|
376
|
+
E
|
|
377
|
+
]);
|
|
378
|
+
y(R, k.getVersion, k.getVersion);
|
|
379
|
+
let z = typeof D == "function" || typeof E == "function" ? k.getValues() : $;
|
|
380
|
+
if (!L.visible(z)) return null;
|
|
381
|
+
let B = {
|
|
382
|
+
...O,
|
|
383
|
+
id: P,
|
|
384
|
+
name: o,
|
|
385
|
+
value: M.value,
|
|
386
|
+
onChange: (e) => {
|
|
387
|
+
k.setValue(o, e);
|
|
388
|
+
},
|
|
389
|
+
onBlur: () => {
|
|
390
|
+
k.blur(o);
|
|
391
|
+
},
|
|
392
|
+
disabled: typeof E == "function" ? E(z) : E,
|
|
393
|
+
status: M.error ? "error" : "default",
|
|
394
|
+
"aria-invalid": !!M.error,
|
|
395
|
+
"aria-describedby": M.error || _ ? `${P}-help` : void 0
|
|
396
|
+
};
|
|
397
|
+
return /* @__PURE__ */ H(Y, {
|
|
398
|
+
id: P,
|
|
399
|
+
label: u,
|
|
400
|
+
required: v,
|
|
401
|
+
description: _,
|
|
402
|
+
error: i(M.issue, M.error, N),
|
|
403
|
+
span: T,
|
|
404
|
+
children: [typeof a == "function" ? a(B) : d(a) ? l(a, B) : a, M.validating && /* @__PURE__ */ V("small", {
|
|
405
|
+
role: "status",
|
|
406
|
+
className: "rfe-description",
|
|
407
|
+
children: N.t("validating")
|
|
408
|
+
})]
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
var ve = Object.assign(ge, { Field: _e }), ye = (e) => e;
|
|
412
|
+
export { le as a, W as c, se as d, J as f, ye as i, K as l, Y as n, q as o, G as r, oe as s, ve as t, ce as u };
|
package/dist/form.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
1
|
+
import { n as e, r as t, t as n } from "./validation-D6vk5NAv.js";
|
|
2
|
+
import { _ as r, a as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, y as x } from "./store-DOn9K-EA.js";
|
|
3
|
+
import { a as S, c as C, d as w, f as T, i as E, l as D, n as O, o as k, r as A, s as j, t as M, u as N } from "./form-Cih4H8PU.js";
|
|
4
|
+
export { M as Form, O as FormItem, A as FormProvider, m as changedOutputValues, _ as cloneValues, v as createFormStore, g as createPathAdapter, E as defineComponents, S as defineForm, a as defineValueAdapter, o as editArray, p as equalValue, u as expandPaths, s as fieldSegments, i as getPathValue, h as hasPath, d as inputValues, f as isArrayIndex, n as isEmpty, l as isPlainRecord, c as normalizePaths, r as omitPaths, y as outputValues, b as readPath, k as useField, j as useFieldArray, C as useForm, D as useFormContext, N as useFormState, w as useFormSummary, T as useWatch, e as validateRuleIssue, t as validateRules, x as writePath };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect as e, useId as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { a, i as o, s, t as c } from "./useControllable-
|
|
3
|
-
import { t as l } from "./icons-
|
|
2
|
+
import { a, i as o, s, t as c } from "./useControllable-Zax42z2F.js";
|
|
3
|
+
import { t as l } from "./icons-BDtmWaBt.js";
|
|
4
4
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
5
|
// src/components/image-upload/validation.ts
|
|
6
6
|
var f = "image/jpeg,image/png,image/webp";
|
package/dist/image-upload.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ImageUpload, n as createImageUploadTasks, r as isImageUrl, i as uploadedImagesRule } from "./image-upload-
|
|
1
|
+
export { t as ImageUpload, n as createImageUploadTasks, r as isImageUrl, i as uploadedImagesRule } from "./image-upload-Cm_41Fcr.js";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a } from "./useControllable-
|
|
2
|
-
import { n as o, t as s } from "./icons-
|
|
3
|
-
import { a as c, c as l, d as u, f as d, i as f, l as p, n as m, o as h, r as g, s as _, t as v, u as y } from "./inputs-
|
|
4
|
-
import { a as b, c as x, i as S, l as C, n as w, o as T, r as E, s as D, t as O, u as k } from "./pickers-
|
|
5
|
-
import { n as A, t as j } from "./slider-
|
|
6
|
-
import { n as M, t as N } from "./Select-
|
|
7
|
-
import { t as P } from "./TreeSelect-
|
|
8
|
-
import { a as F, c as I, d as L, f as R, i as z, l as B, n as V, o as H, r as U, s as W, t as G, u as K } from "./form-
|
|
9
|
-
import { i as q, n as J, r as Y, t as X } from "./image-upload-
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
12
|
-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a } from "./useControllable-Zax42z2F.js";
|
|
2
|
+
import { n as o, t as s } from "./icons-BDtmWaBt.js";
|
|
3
|
+
import { a as c, c as l, d as u, f as d, i as f, l as p, n as m, o as h, r as g, s as _, t as v, u as y } from "./inputs-dLfnlXTx.js";
|
|
4
|
+
import { a as b, c as x, i as S, l as C, n as w, o as T, r as E, s as D, t as O, u as k } from "./pickers-g2TPgXFC.js";
|
|
5
|
+
import { n as A, t as j } from "./slider-CNwkLMmo.js";
|
|
6
|
+
import { n as M, t as N } from "./Select-DTSlMsRZ.js";
|
|
7
|
+
import { t as P } from "./TreeSelect-Dl_uTfIf.js";
|
|
8
|
+
import { a as F, c as I, d as L, f as R, i as z, l as B, n as V, o as H, r as U, s as W, t as G, u as K } from "./form-Cih4H8PU.js";
|
|
9
|
+
import { i as q, n as J, r as Y, t as X } from "./image-upload-Cm_41Fcr.js";
|
|
10
|
+
import { n as Z, r as Q, t as $ } from "./validation-D6vk5NAv.js";
|
|
11
|
+
import { a as ee, i as te, n as ne, o as re, r as ie, s as ae, t as oe } from "./locale-yHkdw2xz.js";
|
|
12
|
+
import { _ as se, a as ce, c as le, d as ue, f as de, g as fe, h as pe, i as me, l as he, m as ge, n as _e, o as ve, p as ye, r as be, s as xe, t as Se, u as Ce, v as we, y as Te } from "./store-DOn9K-EA.js";
|
|
13
|
+
import { a as Ee, c as De, d as Oe, f as ke, i as Ae, l as je, n as Me, o as Ne, r as Pe, s as Fe, t as Ie, u as Le } from "./compound-Cw0juTQp.js";
|
|
14
|
+
export { v as Button, m as Checkbox, g as CheckboxGroup, Ie as CompoundField, n as ConfigProvider, ke as ControlGroup, O as DatePicker, w as DateRangePicker, E as DateTimePicker, S as DateTimeRangePicker, G as Form, V as FormItem, U as FormProvider, s as Icon, f as IconButton, X as ImageUpload, c as Input, Me as InputRange, Pe as InputSelect, b as MonthPicker, T as MonthRangePicker, N as MultiSelect, h as NumberInput, Ae as NumberSelect, Ee as NumberUnit, _ as Password, l as RadioGroup, j as RangeSlider, Ne as SearchGroup, p as SearchInput, y as Segmented, M as Select, A as Slider, o as SvgIcon, u as Switch, d as Textarea, D as TimePicker, x as TimeRangePicker, P as TreeSelect, C as YearPicker, k as YearRangePicker, ve as changedOutputValues, xe as cloneValues, Fe as compoundDefaults, De as compoundRule, je as compoundValues, Se as createFormStore, J as createImageUploadTasks, be as createPathAdapter, a as cx, z as defineComponents, F as defineForm, oe as defineLocale, le as defineValueAdapter, ue as editArray, ne as enUS, _e as equalValue, me as expandPaths, de as fieldSegments, ie as formatIssue, te as formatPickerValue, ce as getPathValue, ye as hasPath, he as inputValues, ge as isArrayIndex, $ as isEmpty, Y as isImageUrl, pe as isPlainRecord, fe as normalizePaths, se as omitPaths, Ce as outputValues, Le as partDisabled, Oe as partVisible, we as readPath, ee as resolveLocale, i as tokenStyle, re as translate, q as uploadedImagesRule, t as useConfig, H as useField, W as useFieldArray, I as useForm, B as useFormContext, K as useFormState, L as useFormSummary, e as useLocale, r as useText, R as useWatch, Z as validateRuleIssue, Q as validateRules, Te as writePath, ae as zhCN };
|
package/dist/input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as Input, o as NumberInput, s as Password, l as SearchInput, f as Textarea } from "./inputs-
|
|
1
|
+
export { a as Input, o as NumberInput, s as Password, l as SearchInput, f as Textarea } from "./inputs-dLfnlXTx.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect as e, useId as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { n as a, t as o } from "./Control-
|
|
3
|
-
import { t as s } from "./icons-
|
|
4
|
-
import { a as c, i as l, o as u, s as d, t as f } from "./useControllable-
|
|
2
|
+
import { n as a, t as o } from "./Control-C6d18GL4.js";
|
|
3
|
+
import { t as s } from "./icons-BDtmWaBt.js";
|
|
4
|
+
import { a as c, i as l, o as u, s as d, t as f } from "./useControllable-Zax42z2F.js";
|
|
5
5
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
6
6
|
// src/utils/number.ts
|
|
7
7
|
var g = /* @__PURE__ */ new Map();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useLayoutEffect as e, useMemo as t, useRef as n, useState as r } from "react";
|
|
2
2
|
import i from "dayjs";
|
|
3
3
|
import { i as a } from "./locale-yHkdw2xz.js";
|
|
4
|
-
import { a as o, t as s } from "./useControllable-
|
|
5
|
-
import { n as c, t as l } from "./Control-
|
|
6
|
-
import { n as u, r as d } from "./selection-
|
|
7
|
-
import { t as f } from "./icons-
|
|
4
|
+
import { a as o, t as s } from "./useControllable-Zax42z2F.js";
|
|
5
|
+
import { n as c, t as l } from "./Control-C6d18GL4.js";
|
|
6
|
+
import { n as u, r as d } from "./selection-CIEa1uce.js";
|
|
7
|
+
import { t as f } from "./icons-BDtmWaBt.js";
|
|
8
8
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
// src/utils/date.ts
|
|
10
10
|
var g = (e) => String(e).padStart(2, "0");
|
package/dist/select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as MultiSelect, n as Select } from "./Select-
|
|
1
|
+
export { t as MultiSelect, n as Select } from "./Select-DTSlMsRZ.js";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { a as e, i as t, r as n } from "./useControllable-Zax42z2F.js";
|
|
2
|
+
import { createContext as r, useCallback as i, useContext as a, useId as o, useLayoutEffect as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
|
+
import { FloatingFocusManager as ee, FloatingNode as f, FloatingOverlay as p, FloatingPortal as m, FloatingTree as h, autoUpdate as g, flip as _, offset as v, shift as y, size as b, useDismiss as x, useFloating as S, useFloatingNodeId as C, useFloatingTree as w, useInteractions as T, useRole as E, useTransitionStyles as te } from "@floating-ui/react";
|
|
5
|
+
// src/components/compound/context.ts
|
|
6
|
+
var D = r(null), O = () => a(D), k = "(max-width: 560px)", ne = (e) => {
|
|
7
|
+
let t = window.matchMedia(k);
|
|
8
|
+
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
9
|
+
}, A = () => typeof window < "u" && window.matchMedia(k).matches;
|
|
10
|
+
function j(e) {
|
|
11
|
+
return w() ? /* @__PURE__ */ u(M, { ...e }) : /* @__PURE__ */ u(h, { children: /* @__PURE__ */ u(M, { ...e }) });
|
|
12
|
+
}
|
|
13
|
+
function M({ open: r, onOpenChange: a, children: h, trigger: w, placement: D = "bottom-start", popupWidth: k = "trigger", popupMaxHeight: j = 320, portalContainer: M, role: N = "dialog", label: P, popupMode: F, layout: I = "content" }) {
|
|
14
|
+
let L = O(), [R, z] = c(null), B = t(), V = e(), H = o(), U = C(), W = l(ne, A, () => !1), G = F ?? B.popupMode, K = G === "sheet" || G === "auto" && W, [q, J] = c(null), { refs: Y, floatingStyles: X, context: Z, placement: re } = S({
|
|
15
|
+
nodeId: U,
|
|
16
|
+
open: r,
|
|
17
|
+
onOpenChange: a,
|
|
18
|
+
placement: D,
|
|
19
|
+
strategy: K ? "fixed" : "absolute",
|
|
20
|
+
whileElementsMounted: K ? void 0 : g,
|
|
21
|
+
middleware: K ? [] : [
|
|
22
|
+
v(6),
|
|
23
|
+
_(),
|
|
24
|
+
y({ padding: 8 }),
|
|
25
|
+
b({
|
|
26
|
+
padding: 8,
|
|
27
|
+
apply({ availableHeight: e, availableWidth: t, rects: n, elements: r }) {
|
|
28
|
+
Object.assign(r.floating.style, {
|
|
29
|
+
maxHeight: `${Math.max(0, Math.min(e, j))}px`,
|
|
30
|
+
maxWidth: `${Math.max(0, t)}px`,
|
|
31
|
+
width: `${Math.max(0, Math.min(t, k === "trigger" ? n.reference.width : k))}px`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
}), ie = i((e) => {
|
|
37
|
+
Y.setFloating(e), z(e);
|
|
38
|
+
}, [Y.setFloating]);
|
|
39
|
+
s(() => {
|
|
40
|
+
if (r && R) return L?.registerPopup(R);
|
|
41
|
+
}, [
|
|
42
|
+
r,
|
|
43
|
+
R,
|
|
44
|
+
L
|
|
45
|
+
]);
|
|
46
|
+
let ae = i((e) => {
|
|
47
|
+
Y.setReference(e), J(e?.closest("dialog[open]") ?? null);
|
|
48
|
+
}, [Y.setReference]), oe = x(Z, { bubbles: {
|
|
49
|
+
escapeKey: !1,
|
|
50
|
+
outsidePress: !0
|
|
51
|
+
} }), se = E(Z, { role: N }), { getReferenceProps: Q, getFloatingProps: ce } = T([oe, se]), { isMounted: le, styles: ue } = te(Z, {
|
|
52
|
+
duration: B.motion ? {
|
|
53
|
+
open: 160,
|
|
54
|
+
close: 100
|
|
55
|
+
} : 0,
|
|
56
|
+
initial: ({ side: e }) => ({
|
|
57
|
+
opacity: 0,
|
|
58
|
+
transform: K ? "translateY(16px)" : `translateY(${e === "top" ? 4 : -4}px) scale(.985)`
|
|
59
|
+
})
|
|
60
|
+
}), de = {
|
|
61
|
+
lang: V.code,
|
|
62
|
+
dir: V.direction,
|
|
63
|
+
"data-theme": B.theme,
|
|
64
|
+
"data-density": B.density,
|
|
65
|
+
"data-motion": B.motion ? "on" : "off"
|
|
66
|
+
}, $ = /* @__PURE__ */ u(ee, {
|
|
67
|
+
context: Z,
|
|
68
|
+
modal: K,
|
|
69
|
+
initialFocus: 0,
|
|
70
|
+
disabled: !r,
|
|
71
|
+
returnFocus: !0,
|
|
72
|
+
children: /* @__PURE__ */ u("div", {
|
|
73
|
+
...de,
|
|
74
|
+
className: "rfe-scope rfe-popup-position",
|
|
75
|
+
"data-sheet": K || void 0,
|
|
76
|
+
ref: ie,
|
|
77
|
+
style: {
|
|
78
|
+
...n(B.tokens),
|
|
79
|
+
...K ? {
|
|
80
|
+
position: "fixed",
|
|
81
|
+
insetInline: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
width: "100%",
|
|
84
|
+
maxWidth: "100%",
|
|
85
|
+
maxHeight: "85dvh"
|
|
86
|
+
} : X
|
|
87
|
+
},
|
|
88
|
+
...ce({
|
|
89
|
+
id: H,
|
|
90
|
+
"aria-label": P,
|
|
91
|
+
"aria-modal": K || void 0
|
|
92
|
+
}),
|
|
93
|
+
children: /* @__PURE__ */ d("div", {
|
|
94
|
+
className: "rfe-panel",
|
|
95
|
+
"data-layout": I,
|
|
96
|
+
"data-side": re.split("-")[0],
|
|
97
|
+
style: {
|
|
98
|
+
...ue,
|
|
99
|
+
pointerEvents: r ? "auto" : "none"
|
|
100
|
+
},
|
|
101
|
+
inert: !r,
|
|
102
|
+
children: [K && /* @__PURE__ */ u("span", {
|
|
103
|
+
className: "rfe-sheet-handle",
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}), h]
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
return /* @__PURE__ */ d(f, {
|
|
110
|
+
id: U,
|
|
111
|
+
children: [w(Q({
|
|
112
|
+
"aria-expanded": r,
|
|
113
|
+
"aria-controls": r ? H : void 0
|
|
114
|
+
}), ae, H), le && /* @__PURE__ */ u(m, {
|
|
115
|
+
root: M ?? q ?? void 0,
|
|
116
|
+
children: K ? /* @__PURE__ */ u(p, {
|
|
117
|
+
lockScroll: r,
|
|
118
|
+
className: "rfe-sheet-overlay",
|
|
119
|
+
style: n(B.tokens),
|
|
120
|
+
children: $
|
|
121
|
+
}) : $
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// src/utils/selection.ts
|
|
126
|
+
function N(e, t, n, r) {
|
|
127
|
+
if (e <= 0) return -1;
|
|
128
|
+
let i = n === "ArrowUp" || n === "End", a = i ? -1 : 1, o = n === "Home" ? 0 : n === "End" ? e - 1 : t < 0 ? i ? e - 1 : 0 : t + a;
|
|
129
|
+
for (; o >= 0 && o < e;) {
|
|
130
|
+
if (r(o)) return o;
|
|
131
|
+
o += a;
|
|
132
|
+
}
|
|
133
|
+
return t >= 0 && t < e && r(t) ? t : -1;
|
|
134
|
+
}
|
|
135
|
+
function P(e, t, n, r, i = 1, a = 4) {
|
|
136
|
+
if (e <= 0 || i <= 0 || !n) return 0;
|
|
137
|
+
let o = (o) => {
|
|
138
|
+
let s = 1, c = 0, l = t.slice(0, o).map((t) => Math.min(t, e));
|
|
139
|
+
o < n && l.push(Math.min(r, e));
|
|
140
|
+
for (let t of l) if (c && c + a + t > e && (s++, c = 0), c += t + (c ? a : 0), s > i) return !1;
|
|
141
|
+
return !0;
|
|
142
|
+
}, s = Math.min(t.length, n);
|
|
143
|
+
for (; s > 0 && !o(s);) s--;
|
|
144
|
+
return s;
|
|
145
|
+
}
|
|
146
|
+
export { O as a, D as i, N as n, j as r, P as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useId as e, useLayoutEffect as t, useMemo as n, useRef as r, useState as i } from "react";
|
|
2
|
-
import { a, i as o, s, t as c } from "./useControllable-
|
|
2
|
+
import { a, i as o, s, t as c } from "./useControllable-Zax42z2F.js";
|
|
3
3
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
4
|
// src/components/slider/math.ts
|
|
5
5
|
function f(e = 0, t = 100, n = 1) {
|
package/dist/slider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RangeSlider, n as Slider } from "./slider-
|
|
1
|
+
export { t as RangeSlider, n as Slider } from "./slider-CNwkLMmo.js";
|