jaguar-form 1.0.5 → 1.0.7

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 (55) hide show
  1. package/README.md +29 -2
  2. package/dist/Cascader-iWlk7VJR.js +226 -0
  3. package/dist/Select-CoEW4UIq.js +422 -0
  4. package/dist/TreeSelect-BWksr9iW.js +350 -0
  5. package/dist/{compound-BhkceJal.js → compound-BW6G7E_-.js} +95 -84
  6. package/dist/compound.js +1 -1
  7. package/dist/core.js +1 -1
  8. package/dist/date-time.js +1 -1
  9. package/dist/demo-plant.svg +1 -0
  10. package/dist/form-B-BSf2n1.js +599 -0
  11. package/dist/form.js +2 -2
  12. package/dist/{icons-D79FYcGF.js → icons-BwE05e0C.js} +1 -1
  13. package/dist/{image-upload-BstB2jRd.js → image-upload-D9oPG0Eh.js} +252 -183
  14. package/dist/image-upload.js +1 -1
  15. package/dist/index.js +15 -14
  16. package/dist/input.js +1 -1
  17. package/dist/{inputs-Ch4x2nwn.js → inputs-DpZdLaoP.js} +233 -130
  18. package/dist/{useSelection-BUBndjzo.js → lazy-tree-C9l9lzQw.js} +117 -19
  19. package/dist/pickers-Bci1y8cc.js +634 -0
  20. package/dist/select.js +3 -1
  21. package/dist/{selection-9NP9MXSn.js → selection-DCIzhR5q.js} +28 -21
  22. package/dist/{slider-C2T2wII7.js → slider-AM0Egz9P.js} +1 -1
  23. package/dist/slider.js +1 -1
  24. package/dist/store-CFSQW-Fv.js +622 -0
  25. package/dist/style.css +1 -1
  26. package/dist/tree-select.js +1 -1
  27. package/dist/types/components/compound/ControlGroup.d.ts +5 -2
  28. package/dist/types/components/compound/index.d.ts +10 -1
  29. package/dist/types/components/extended-inputs.d.ts +4 -0
  30. package/dist/types/components/image-upload/ManagedImageUpload.d.ts +2 -2
  31. package/dist/types/components/image-upload/index.d.ts +3 -2
  32. package/dist/types/components/image-upload/usePreparation.d.ts +7 -0
  33. package/dist/types/components/image-upload/validation.d.ts +16 -0
  34. package/dist/types/components/inputs.d.ts +19 -4
  35. package/dist/types/components/select/Cascader.d.ts +13 -0
  36. package/dist/types/components/select/types.d.ts +6 -0
  37. package/dist/types/components/select/useRemoteOptions.d.ts +8 -1
  38. package/dist/types/components/select.d.ts +2 -0
  39. package/dist/types/config/index.d.ts +3 -0
  40. package/dist/types/entries/input.d.ts +2 -2
  41. package/dist/types/entries/select.d.ts +2 -0
  42. package/dist/types/form/index.d.ts +54 -10
  43. package/dist/types/form/store.d.ts +12 -1
  44. package/dist/types/primitives/Control.d.ts +3 -1
  45. package/dist/types/types.d.ts +1 -0
  46. package/dist/types/utils/cascader.d.ts +12 -0
  47. package/dist/types/utils/decimal.d.ts +18 -0
  48. package/dist/types/utils/remote-options.d.ts +2 -1
  49. package/dist/{useControllable-Dhp7tTjy.js → useControllable-QDX_UWRh.js} +6 -1
  50. package/package.json +1 -1
  51. package/dist/Select-DiEHlcyU.js +0 -376
  52. package/dist/TreeSelect-1jpd43zZ.js +0 -439
  53. package/dist/form-CnRp3fRw.js +0 -457
  54. package/dist/pickers-D-ymAf_p.js +0 -630
  55. package/dist/store-BvcQ7xcl.js +0 -509
@@ -0,0 +1,350 @@
1
+ import { useEffect as e, useId as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
2
+ import { n as o, o as s, r as c, s as l } from "./selection-DCIzhR5q.js";
3
+ import { a as u, c as d, d as ee, f as te, i as ne, l as re, n as f, o as ie, p as ae, r as p, s as oe, t as m, u as h } from "./lazy-tree-C9l9lzQw.js";
4
+ import { t as g } from "./icons-BwE05e0C.js";
5
+ import { a as se } from "./useControllable-QDX_UWRh.js";
6
+ import { Fragment as ce, jsx as _, jsxs as v } from "react/jsx-runtime";
7
+ // src/components/select/TreeSelect.tsx
8
+ var le = (e) => e.node.value, y = (e) => e.searchText ?? (typeof e.label == "string" ? e.label : String(e.value));
9
+ function ue(t) {
10
+ let [r, o] = a({
11
+ nodes: t,
12
+ status: /* @__PURE__ */ new Map()
13
+ }), [s] = a(() => m(t, (e, t) => o({
14
+ nodes: e,
15
+ status: t
16
+ }))), c = i(t);
17
+ return n(() => {
18
+ c.current !== t && (c.current = t, s.reset(t));
19
+ }, [t, s]), e(() => () => s.dispose(), [s]), {
20
+ ...r,
21
+ loader: s
22
+ };
23
+ }
24
+ function b(n) {
25
+ let { text: i, t: m, direction: b } = se(), { nodes: x, status: S, loader: C } = ue(n.options), w = r(() => re(x), [x]), { open: T, changeOpen: E, committed: D, selected: O, update: k, confirm: de, blocked: A, triggerReadOnly: j } = u(n), [M, N] = a(() => new Set(n.defaultExpandAll ? [...w.map.values()].filter((e) => e.children?.length).map((e) => e.value) : [])), [P, F] = a(""), [I, L] = a(!1), [fe, R] = a(null), z = t(), B = `${z}-tree`, V = (e) => `${z}-node-${e}`, H = n["aria-label"] ?? n.floatingLabel ?? i.choose, U = n.multiple && n.checkStrategy !== "independent", W = r(() => new Set(O), [O]), pe = r(() => new Set(D), [D]), me = r(() => d(w.leaves, w.ranges, W, w.incomplete), [w, W]), he = r(() => d(w.leaves, w.ranges, pe, w.incomplete), [w, pe]), ge = r(() => /* @__PURE__ */ new Map(), [w]), _e = (e) => {
26
+ let t = ge.get(e);
27
+ if (t !== void 0) return t;
28
+ let n = [], r = e;
29
+ for (; r !== void 0;) {
30
+ let e = w.map.get(r);
31
+ n.push(e ? y(e) : String(r)), r = w.parent.get(r);
32
+ }
33
+ let i = n.reverse().join(" / ");
34
+ return ge.set(e, i), i;
35
+ }, ve = (e, t = !1) => {
36
+ let r = w.map.get(e);
37
+ return {
38
+ ...r,
39
+ value: e,
40
+ disabled: w.blockedKeys.has(e) || r?.disabled,
41
+ label: n.displayPath === "full" ? _e(e) : r?.label ?? String(e),
42
+ searchText: t || n.displayPath === "full" ? _e(e) : r ? y(r) : String(e)
43
+ };
44
+ }, ye = r(() => U && n.showCheckedStrategy !== "leaf" ? [...oe(x, he), ...D.filter((e) => !w.map.has(e))] : D, [
45
+ U,
46
+ n.showCheckedStrategy,
47
+ x,
48
+ he,
49
+ D,
50
+ w
51
+ ]), G = r(() => ye.map((e) => ve(e)), [
52
+ ye,
53
+ w,
54
+ n.displayPath
55
+ ]), be = r(() => T && (I || n.panelLayout === "dual") ? O.map((e) => ve(e, !0)) : [], [
56
+ T,
57
+ I,
58
+ n.panelLayout,
59
+ O,
60
+ w,
61
+ n.displayPath
62
+ ]), K = r(() => T ? ne(x, M, P, y) : [], [
63
+ T,
64
+ x,
65
+ M,
66
+ P
67
+ ]), q = Math.max(0, K.findIndex((e) => e.node.value === fe)), J = K[q], Y = (e) => !w.blockedKeys.has(e.value) && e.selectable !== !1 && (n.selectable !== "leaf" || !f(e)) && (!U || me.total(e.value) > 0), xe = (e) => U ? w.leafMap.get(e.value) ?? [] : [e.value], Se = r(() => new Set(K.map((e) => e.node.value)), [K]), Ce = (e) => n.selectAllScope === "all" || !P.trim() || Se.has(e), X = U ? w.leaves.filter(Ce) : [...w.map.values()].filter((e) => Ce(e.value) && Y(e)).map((e) => e.value), Z = X.filter((e) => W.has(e)).length, Q = X.length > 0 && X.length === Z, we = !Q && W.size + X.length - Z > (n.maxCount ?? 1e400);
68
+ e(() => {
69
+ T || (F(""), L(!1), R(null));
70
+ }, [T]);
71
+ let Te = (e) => {
72
+ A || n.readOnly || !Y(e) || (n.multiple ? k(h(O, xe(e), n.maxCount)) : (k([e.value]), n.needConfirm || E(!1)));
73
+ }, Ee = (e) => {
74
+ if (w.blockedKeys.has(e)) return;
75
+ let t = w.map.get(e), n = new Set(t ? xe(t) : [e]);
76
+ k(O.filter((e) => !n.has(e)));
77
+ }, De = () => k(O.filter((e) => w.blockedKeys.has(e))), $ = (e, t) => {
78
+ f(e) && (t && p(e) && n.loadChildren && C.load(e.value, n.loadChildren), N((n) => {
79
+ let r = new Set(n);
80
+ return t ? r.add(e.value) : r.delete(e.value), r;
81
+ }));
82
+ }, Oe = (e) => {
83
+ S.get(e.value) === "error" && n.loadChildren ? C.load(e.value, n.loadChildren) : $(e, !M.has(e.value));
84
+ }, ke = (e) => {
85
+ !e.nativeEvent.isComposing && e.target instanceof HTMLElement && e.target.matches(".rfe-trigger-arrow") && ["ArrowDown", "ArrowUp"].includes(e.key) && (e.preventDefault(), E(!0));
86
+ }, Ae = (e) => {
87
+ if (e.nativeEvent.isComposing || e.keyCode === 229 || I && n.panelLayout !== "dual") return;
88
+ let t = e.target;
89
+ if (!(t instanceof HTMLElement) || !t.matches(".rfe-tree-search,.rfe-tree-list,.rfe-tree-row") || t instanceof HTMLInputElement && [
90
+ "Home",
91
+ "End",
92
+ "ArrowLeft",
93
+ "ArrowRight",
94
+ " "
95
+ ].includes(e.key)) return;
96
+ if ([
97
+ "ArrowUp",
98
+ "ArrowDown",
99
+ "Home",
100
+ "End"
101
+ ].includes(e.key)) {
102
+ e.preventDefault();
103
+ let t = o(K.length, q, e.key, () => !0);
104
+ t >= 0 && R(K[t].node.value);
105
+ return;
106
+ }
107
+ if (!J) return;
108
+ let r = J.node;
109
+ if (["Enter", " "].includes(e.key)) e.preventDefault(), Te(r);
110
+ else if (e.key === (b === "rtl" ? "ArrowLeft" : "ArrowRight")) e.preventDefault(), f(r) && (!M.has(r.value) || p(r)) ? $(r, !0) : K[q + 1]?.depth > J.depth && R(K[q + 1].node.value);
111
+ else if (e.key === (b === "rtl" ? "ArrowRight" : "ArrowLeft")) {
112
+ if (e.preventDefault(), M.has(r.value) && f(r)) $(r, !1);
113
+ else {
114
+ let e = w.parent.get(r.value);
115
+ e !== void 0 && R(e);
116
+ }
117
+ }
118
+ };
119
+ return /* @__PURE__ */ v(c, {
120
+ ...n,
121
+ layout: "selection",
122
+ open: T,
123
+ onOpenChange: E,
124
+ label: H,
125
+ trigger: (e, t) => /* @__PURE__ */ _("div", {
126
+ ref: t,
127
+ className: "rfe-anchor",
128
+ onKeyDown: ke,
129
+ onBlur: (e) => {
130
+ !T && !e.currentTarget.contains(e.relatedTarget) && n.onBlur?.();
131
+ },
132
+ children: /* @__PURE__ */ _(l, {
133
+ ...n,
134
+ id: n.id ?? z,
135
+ disabled: n.disabled || n.loading,
136
+ floatingFilled: D.length > 0,
137
+ floatingOpen: T,
138
+ actions: /* @__PURE__ */ v(ce, { children: [n.clearable !== !1 && /* @__PURE__ */ _(s, {
139
+ name: "clear",
140
+ source: n.icons?.clear,
141
+ label: i.clear,
142
+ hidden: !D.length,
143
+ disabled: j,
144
+ onClick: De
145
+ }), /* @__PURE__ */ _("button", {
146
+ ...e,
147
+ type: "button",
148
+ id: n.id ?? z,
149
+ disabled: A,
150
+ "aria-invalid": n["aria-invalid"] ?? n.status === "error",
151
+ "aria-describedby": n["aria-describedby"],
152
+ "aria-label": H,
153
+ className: "rfe-trigger-arrow",
154
+ "data-open": T,
155
+ onClick: () => E(!T),
156
+ children: /* @__PURE__ */ _(g, {
157
+ name: "dropdown",
158
+ source: n.icons?.dropdown
159
+ })
160
+ })] }),
161
+ children: /* @__PURE__ */ _("div", {
162
+ className: "rfe-value",
163
+ onClick: () => E(!T),
164
+ children: n.multiple ? /* @__PURE__ */ _(te, {
165
+ options: G,
166
+ mode: n.displayMode,
167
+ maxTagCount: n.maxTagCount,
168
+ maxTagRows: n.maxTagRows,
169
+ onRemove: Ee,
170
+ onInspect: () => {
171
+ A || (T || E(!0), L(!0));
172
+ },
173
+ readOnly: j,
174
+ placeholder: n.placeholder
175
+ }) : /* @__PURE__ */ _("span", {
176
+ className: G.length ? "rfe-single-value" : "rfe-placeholder",
177
+ children: G[0]?.label ?? n.placeholder ?? i.choose
178
+ })
179
+ })
180
+ })
181
+ }),
182
+ children: [/* @__PURE__ */ v("div", {
183
+ "data-selection-style": n.selectionStyle ?? (n.multiple ? "subtle" : "accent"),
184
+ className: `rfe-selection-body${n.panelLayout === "dual" ? " rfe-dual" : ""}`,
185
+ onKeyDown: Ae,
186
+ children: [(!I || n.panelLayout === "dual") && /* @__PURE__ */ v("div", {
187
+ className: "rfe-tree-main",
188
+ children: [
189
+ n.searchable !== !1 && /* @__PURE__ */ _("input", {
190
+ className: "rfe-search rfe-tree-search",
191
+ role: "combobox",
192
+ "aria-expanded": "true",
193
+ "aria-haspopup": "tree",
194
+ "aria-controls": K.length ? B : void 0,
195
+ "aria-activedescendant": J ? V(q) : void 0,
196
+ "aria-autocomplete": "list",
197
+ placeholder: i.search,
198
+ "aria-label": i.search,
199
+ value: P,
200
+ onChange: (e) => {
201
+ F(e.target.value), R(null);
202
+ }
203
+ }),
204
+ /* @__PURE__ */ v("div", {
205
+ className: "rfe-toolbar",
206
+ children: [/* @__PURE__ */ _("button", {
207
+ type: "button",
208
+ className: "rfe-link",
209
+ onClick: () => N(M.size ? /* @__PURE__ */ new Set() : new Set([...w.map.values()].filter((e) => e.children?.length).map((e) => e.value))),
210
+ children: M.size ? i.collapseAll : i.expandAll
211
+ }), n.multiple && n.showSelectAll && !n.readOnly && /* @__PURE__ */ v("button", {
212
+ type: "button",
213
+ className: "rfe-select-all",
214
+ role: "checkbox",
215
+ "aria-checked": Q ? !0 : Z ? "mixed" : !1,
216
+ "aria-label": i.all,
217
+ title: we ? m("max", { max: n.maxCount ?? 0 }) : void 0,
218
+ disabled: !X.length || we,
219
+ onClick: () => k(h(O, X, n.maxCount)),
220
+ children: [/* @__PURE__ */ _("span", {
221
+ className: "rfe-option-check",
222
+ "data-checked": Z > 0,
223
+ children: Z > 0 && /* @__PURE__ */ _(g, { name: Q ? "check" : "minus" })
224
+ }), Q ? i.deselectAll : i.all]
225
+ })]
226
+ }),
227
+ n.optionsLoading && /* @__PURE__ */ v("div", {
228
+ className: "rfe-options-loading",
229
+ role: "status",
230
+ children: [/* @__PURE__ */ _(g, { name: "loading" }), i.loading]
231
+ }),
232
+ K.length ? /* @__PURE__ */ _(ae, {
233
+ items: K,
234
+ getKey: le,
235
+ id: B,
236
+ className: "rfe-tree-list",
237
+ role: "tree",
238
+ label: H,
239
+ multiple: n.multiple,
240
+ tabIndex: 0,
241
+ activeIndex: q,
242
+ activeId: J ? V(q) : void 0,
243
+ variableHeight: n.variableHeight,
244
+ render: ({ node: e, depth: t, position: r, setSize: a }, o) => {
245
+ let s = f(e), c = M.has(e.value) || !!(P.trim() && e.children?.length), l = U ? me.state(e.value) : ie([e.value], W), u = A || n.readOnly || !Y(e), d = S.get(e.value);
246
+ return /* @__PURE__ */ v("div", {
247
+ id: V(o),
248
+ className: "rfe-tree-row",
249
+ role: "treeitem",
250
+ tabIndex: -1,
251
+ "aria-label": y(e),
252
+ "aria-level": t + 1,
253
+ "aria-posinset": r,
254
+ "aria-setsize": a,
255
+ "aria-expanded": s ? c : void 0,
256
+ "aria-selected": n.multiple ? void 0 : l === "all",
257
+ "aria-checked": n.multiple ? l === "partial" ? "mixed" : l === "all" : void 0,
258
+ "aria-disabled": u || void 0,
259
+ "aria-busy": d === "loading" || void 0,
260
+ "data-active": q === o || void 0,
261
+ style: { paddingInlineStart: t * 16 + 4 },
262
+ onMouseEnter: () => R(e.value),
263
+ children: [/* @__PURE__ */ _("span", {
264
+ className: "rfe-tree-expand",
265
+ "aria-hidden": "true",
266
+ title: d === "error" ? i.retry : c ? i.collapse : i.expand,
267
+ "data-expanded": c,
268
+ "data-load": d,
269
+ style: s ? void 0 : { visibility: "hidden" },
270
+ onClick: () => Oe(e),
271
+ children: /* @__PURE__ */ _(g, { name: d === "loading" ? "loading" : d === "error" ? "error" : "next" })
272
+ }), /* @__PURE__ */ v("div", {
273
+ className: "rfe-option",
274
+ "data-disabled": u || void 0,
275
+ "data-active": q === o || void 0,
276
+ "data-selected": l === "all" || void 0,
277
+ onClick: () => Te(e),
278
+ children: [
279
+ n.multiple && /* @__PURE__ */ _("span", {
280
+ className: "rfe-option-check",
281
+ "data-checked": l !== "none",
282
+ children: l !== "none" && /* @__PURE__ */ _(g, { name: l === "partial" ? "minus" : "check" })
283
+ }),
284
+ n.showIcon && /* @__PURE__ */ _(g, { name: s ? c ? "folderOpen" : "folder" : "leaf" }),
285
+ /* @__PURE__ */ _("span", {
286
+ className: "rfe-option-label",
287
+ children: e.label
288
+ }),
289
+ !n.multiple && l === "all" && /* @__PURE__ */ _(g, { name: "check" }),
290
+ d === "error" && /* @__PURE__ */ _("span", {
291
+ role: "status",
292
+ className: "rfe-tree-error",
293
+ children: i.retry
294
+ })
295
+ ]
296
+ })]
297
+ });
298
+ }
299
+ }) : !n.optionsLoading && /* @__PURE__ */ _("div", {
300
+ className: "rfe-empty",
301
+ role: "status",
302
+ children: i.empty
303
+ })
304
+ ]
305
+ }), (I || n.panelLayout === "dual") && /* @__PURE__ */ v("div", {
306
+ className: "rfe-selection-inspect",
307
+ children: [n.panelLayout !== "dual" && /* @__PURE__ */ v("button", {
308
+ type: "button",
309
+ className: "rfe-link",
310
+ onClick: () => L(!1),
311
+ children: [/* @__PURE__ */ _(g, { name: "previous" }), i.choose]
312
+ }), /* @__PURE__ */ _(ee, {
313
+ options: be,
314
+ onRemove: Ee,
315
+ onClear: De,
316
+ readOnly: n.readOnly
317
+ })]
318
+ })]
319
+ }), (n.multiple || n.needConfirm) && /* @__PURE__ */ v("div", {
320
+ className: "rfe-footer",
321
+ children: [
322
+ /* @__PURE__ */ v("button", {
323
+ type: "button",
324
+ className: "rfe-link",
325
+ onClick: () => L(!I),
326
+ children: [
327
+ i.selected,
328
+ " ",
329
+ O.length
330
+ ]
331
+ }),
332
+ /* @__PURE__ */ _("span", { className: "rfe-spacer" }),
333
+ n.needConfirm && /* @__PURE__ */ _("button", {
334
+ type: "button",
335
+ className: "rfe-link",
336
+ onClick: () => E(!1),
337
+ children: i.cancel
338
+ }),
339
+ /* @__PURE__ */ _("button", {
340
+ type: "button",
341
+ className: "rfe-button",
342
+ "data-variant": "primary",
343
+ onClick: de,
344
+ children: i.done
345
+ })
346
+ ]
347
+ })]
348
+ });
349
+ }
350
+ export { b as t };
@@ -1,10 +1,10 @@
1
1
  import { Children as e, cloneElement as t, isValidElement as n, useCallback as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
2
- import { i as l, o as u, s as d, t as f } from "./useControllable-Dhp7tTjy.js";
3
- import { c as p, o as m, s as h, t as g } from "./inputs-Ch4x2nwn.js";
4
- import { n as _, t as v } from "./Select-DiEHlcyU.js";
5
- import { t as y } from "./TreeSelect-1jpd43zZ.js";
6
- import { s as b, t as x } from "./pickers-D-ymAf_p.js";
7
- import { a as S, i as C } from "./selection-9NP9MXSn.js";
2
+ import { i as l, o as u, s as d, t as f } from "./useControllable-QDX_UWRh.js";
3
+ import { c as p, o as m, s as h, t as g } from "./inputs-DpZdLaoP.js";
4
+ import { n as _, t as v } from "./Select-CoEW4UIq.js";
5
+ import { t as y } from "./TreeSelect-BWksr9iW.js";
6
+ import { s as b, t as x } from "./pickers-Bci1y8cc.js";
7
+ import { a as S, i as C } from "./selection-DCIzhR5q.js";
8
8
  import { jsx as w, jsxs as T } from "react/jsx-runtime";
9
9
  import { n as E } from "./validation-D6vk5NAv.js";
10
10
  // src/components/compound/ControlGroup.tsx
@@ -15,10 +15,11 @@ var D = (e) => typeof e == "number" ? `${e}px` : {
15
15
  large: "12px",
16
16
  full: "999px"
17
17
  }[e ?? ""] ?? e;
18
- function O({ children: e, width: t, minWidth: n, maxWidth: r, flex: i, radius: a, background: o, padding: s, divider: c, className: l, style: u }) {
18
+ function O({ children: e, width: t, minWidth: n, maxWidth: r, flex: i, radius: a, background: o, padding: s, divider: c, className: l, style: u, fieldName: f }) {
19
19
  return /* @__PURE__ */ w("div", {
20
20
  className: d("rfe-control-group-item", l),
21
21
  "data-divider": c,
22
+ "data-compound-field": f,
22
23
  "data-auto-width": t === "auto" || void 0,
23
24
  style: {
24
25
  width: t,
@@ -34,45 +35,45 @@ function O({ children: e, width: t, minWidth: n, maxWidth: r, flex: i, radius: a
34
35
  children: e
35
36
  });
36
37
  }
37
- function k({ children: a, disabled: u, readOnly: f, error: p, status: m, id: h, className: g, style: _, onFocus: v, onBlur: y, "aria-label": b, "aria-describedby": x, "aria-invalid": T, ...E }) {
38
- let k = l(), A = S(), { layout: j = "connected", direction: M = "horizontal", focusMode: N = j === "separated" ? "individual" : "group", radius: P, gap: F, padding: I, size: L = k.size, variant: R = k.variant, divider: z = !0, block: B = !0 } = {
39
- ...k.controlGroup,
40
- ...E
41
- }, V = s(null), H = s(/* @__PURE__ */ new Set()), U = s(!1), W = s(null), [G, K] = c(!1), q = s({
42
- onFocus: v,
43
- onBlur: y,
38
+ function k({ children: a, disabled: u, readOnly: f, error: p, status: m, id: h, floatingLabel: g, floatingFilled: _, className: v, style: y, onFocus: b, onBlur: x, "aria-label": E, "aria-describedby": k, "aria-invalid": A, ...j }) {
39
+ let M = l(), N = S(), { layout: P = "connected", direction: F = "horizontal", focusMode: I = P === "separated" ? "individual" : "group", radius: L, gap: R, padding: z, size: B = M.size, variant: V = M.variant, divider: H = !0, block: U = !0 } = {
40
+ ...M.controlGroup,
41
+ ...j
42
+ }, W = s(null), G = s(/* @__PURE__ */ new Set()), K = s(!1), q = s(null), [J, ee] = c(!1), Y = s({
43
+ onFocus: b,
44
+ onBlur: x,
44
45
  disabled: u
45
46
  });
46
- q.current = {
47
- onFocus: v,
48
- onBlur: y,
47
+ Y.current = {
48
+ onFocus: b,
49
+ onBlur: x,
49
50
  disabled: u
50
51
  };
51
- let J = r(() => {
52
- let e = V.current;
52
+ let X = r(() => {
53
+ let e = W.current;
53
54
  if (!e) return;
54
- let t = e.ownerDocument.activeElement, n = !q.current.disabled && !!t && (e.contains(t) || [...H.current].some((e) => e.contains(t)));
55
- n !== U.current && (U.current = n, K(n), n ? q.current.onFocus?.() : q.current.onBlur?.());
56
- }, []), Y = r(() => {
57
- W.current !== null && cancelAnimationFrame(W.current), W.current = requestAnimationFrame(() => {
58
- W.current = null, J();
55
+ let t = e.ownerDocument.activeElement, n = !Y.current.disabled && !!t && (e.contains(t) || [...G.current].some((e) => e.contains(t)));
56
+ n !== K.current && (K.current = n, ee(n), n ? Y.current.onFocus?.() : Y.current.onBlur?.());
57
+ }, []), Z = r(() => {
58
+ q.current !== null && cancelAnimationFrame(q.current), q.current = requestAnimationFrame(() => {
59
+ q.current = null, X();
59
60
  });
60
- }, [J]);
61
+ }, [X]);
61
62
  i(() => {
62
- let e = V.current?.ownerDocument;
63
- if (e) return e.addEventListener("focusin", Y), e.addEventListener("focusout", Y), J(), () => {
64
- e.removeEventListener("focusin", Y), e.removeEventListener("focusout", Y), W.current !== null && cancelAnimationFrame(W.current), W.current = null;
63
+ let e = W.current?.ownerDocument;
64
+ if (e) return e.addEventListener("focusin", Z), e.addEventListener("focusout", Z), X(), () => {
65
+ e.removeEventListener("focusin", Z), e.removeEventListener("focusout", Z), q.current !== null && cancelAnimationFrame(q.current), q.current = null;
65
66
  };
66
- }, [J, Y]), i(() => {
67
- J();
68
- }, [u, J]);
69
- let X = r((e) => {
70
- H.current.add(e);
71
- let t = A?.registerPopup(e);
72
- return Y(), () => {
73
- H.current.delete(e), t?.(), Y();
67
+ }, [X, Z]), i(() => {
68
+ X();
69
+ }, [u, X]);
70
+ let Q = r((e) => {
71
+ G.current.add(e);
72
+ let t = N?.registerPopup(e);
73
+ return Z(), () => {
74
+ G.current.delete(e), t?.(), Z();
74
75
  };
75
- }, [A, Y]), Z = o(() => ({ registerPopup: X }), [X]), Q = (e) => {
76
+ }, [N, Z]), te = o(() => ({ registerPopup: Q }), [Q]), $ = (e) => {
76
77
  if (!n(e)) return e;
77
78
  if (typeof e.type == "string") return [
78
79
  "input",
@@ -85,49 +86,54 @@ function k({ children: a, disabled: u, readOnly: f, error: p, status: m, id: h,
85
86
  }) : e;
86
87
  let r = e;
87
88
  return t(r, {
88
- size: j === "separated" ? r.props.size ?? L : L,
89
+ size: P === "separated" ? r.props.size ?? B : B,
89
90
  ...u ? { disabled: !0 } : {},
90
91
  ...f ? { readOnly: !0 } : {}
91
92
  });
92
- }, $ = e.toArray(a).map((r, i) => {
93
+ }, ne = e.toArray(a).map((r, i) => {
93
94
  if (n(r) && r.type === O) {
94
95
  let n = r;
95
- return t(n, { children: e.map(n.props.children, Q) });
96
+ return t(n, { children: e.map(n.props.children, $) });
96
97
  }
97
98
  let a = n(r) ? r.props.style?.width : void 0;
98
99
  return /* @__PURE__ */ w(O, {
99
100
  width: a,
100
- children: Q(r)
101
+ children: $(r)
101
102
  }, n(r) ? r.key ?? i : i);
102
103
  });
103
104
  return /* @__PURE__ */ w(C.Provider, {
104
- value: Z,
105
- children: /* @__PURE__ */ w("div", {
106
- ref: V,
105
+ value: te,
106
+ children: /* @__PURE__ */ T("div", {
107
+ ref: W,
107
108
  id: h,
108
109
  role: "group",
109
- "aria-label": b,
110
- "aria-describedby": x,
111
- "aria-invalid": T || p || m === "error" || void 0,
110
+ "aria-label": E ?? g,
111
+ "aria-describedby": k,
112
+ "aria-invalid": A || p || m === "error" || void 0,
112
113
  "aria-disabled": u || void 0,
113
- className: d("rfe-control-group", g),
114
- "data-layout": j,
115
- "data-direction": M,
116
- "data-focus-mode": N,
117
- "data-focused": G,
118
- "data-status": T || p ? "error" : m ?? "default",
114
+ className: d("rfe-control-group", !!g && "rfe-floating-shell", v),
115
+ "data-layout": P,
116
+ "data-direction": F,
117
+ "data-focus-mode": I,
118
+ "data-focused": J,
119
+ "data-floating-filled": _ || void 0,
120
+ "data-status": A || p ? "error" : m ?? "default",
119
121
  "data-disabled": u || void 0,
120
- "data-size": L,
121
- "data-variant": R,
122
- "data-divider": z,
123
- "data-block": B,
122
+ "data-size": B,
123
+ "data-variant": V,
124
+ "data-divider": H,
125
+ "data-block": U,
124
126
  style: {
125
- "--rfe-group-radius": D(P),
126
- "--rfe-group-gap": typeof F == "number" ? `${F}px` : F,
127
- "--rfe-group-padding": typeof I == "number" ? `${I}px` : I,
128
- ..._
127
+ "--rfe-group-radius": D(L),
128
+ "--rfe-group-gap": typeof R == "number" ? `${R}px` : R,
129
+ "--rfe-group-padding": typeof z == "number" ? `${z}px` : z,
130
+ ...y
129
131
  },
130
- children: $
132
+ children: [ne, g && /* @__PURE__ */ w("span", {
133
+ className: "rfe-shell-label",
134
+ "aria-hidden": "true",
135
+ children: g
136
+ })]
131
137
  })
132
138
  });
133
139
  }
@@ -173,38 +179,43 @@ var I = {
173
179
  date: x,
174
180
  time: b
175
181
  };
176
- function L({ fields: e, value: t, defaultValue: n, onChange: r, name: i, loading: o, disabled: s, id: c, ...l }) {
177
- let u = a(), [d, p] = f(t, M(e, n), r), m = M(e, d);
182
+ function L({ fields: e, value: t, defaultValue: n, onChange: r, name: i, loading: o, disabled: s, id: c, partStates: l, onPartChange: u, onPartBlur: d, ...p }) {
183
+ let m = a(), [h, g] = f(t, M(e, n), r), _ = M(e, h);
178
184
  return /* @__PURE__ */ w(A, {
179
- ...l,
185
+ ...p,
186
+ floatingFilled: Object.values(_).some((e) => e != null && e !== "" && (!Array.isArray(e) || e.length > 0)),
180
187
  disabled: s || o,
181
- "aria-label": l["aria-label"] ?? i,
182
- children: e.filter((e) => N(e, m)).map((e, t) => {
183
- let n = I[e.type], { width: r, minWidth: i, maxWidth: a, flex: d, radius: f, background: h, padding: g, divider: _ } = e, v = {
188
+ "aria-label": p["aria-label"] ?? i,
189
+ children: e.filter((e) => N(e, _)).map((e, t) => {
190
+ let n = I[e.type], { width: r, minWidth: a, maxWidth: f, flex: h, radius: v, background: y, padding: b, divider: x } = e, S = {
184
191
  ...e.componentProps,
185
- id: t === 0 ? c ?? u : `${c ?? u}-${t}`,
192
+ id: t === 0 ? c ?? m : `${c ?? m}-${t}`,
186
193
  name: e.name,
187
194
  "aria-label": e.label ?? e.name,
188
- "aria-describedby": l["aria-describedby"],
189
- "aria-invalid": l.error || l.status === "error" || l["aria-invalid"],
190
- value: m[e.name] ?? (["input", "password"].includes(e.type) ? "" : e.type === "multiSelect" || e.type === "treeSelect" && e.componentProps?.multiple ? [] : null),
191
- onChange: (t) => p({
192
- ...m,
195
+ "aria-describedby": p["aria-describedby"],
196
+ "aria-invalid": l ? !!l[e.name]?.error : p.error || p.status === "error" || p["aria-invalid"],
197
+ value: _[e.name] ?? (["input", "password"].includes(e.type) ? "" : e.type === "multiSelect" || e.type === "treeSelect" && e.componentProps?.multiple ? [] : null),
198
+ onChange: (t) => u ? u(e.name, t) : g({
199
+ ..._,
193
200
  [e.name]: t
194
201
  }),
195
- disabled: s || o || P(e, m) || e.componentProps?.disabled === !0,
196
- readOnly: l.readOnly || (typeof e.readOnly == "function" ? e.readOnly(m) : e.readOnly) || e.componentProps?.readOnly === !0
202
+ onBlur: () => {
203
+ typeof e.componentProps?.onBlur == "function" && e.componentProps.onBlur(), d?.(e.name);
204
+ },
205
+ disabled: s || o || P(e, _) || e.componentProps?.disabled === !0,
206
+ readOnly: p.readOnly || (typeof e.readOnly == "function" ? e.readOnly(_) : e.readOnly) || e.componentProps?.readOnly === !0
197
207
  };
198
208
  return /* @__PURE__ */ w(A.Item, {
209
+ fieldName: i ? `${i}.${e.name}` : void 0,
199
210
  width: r,
200
- minWidth: i,
201
- maxWidth: a,
202
- flex: d,
203
- radius: f,
204
- background: h,
205
- padding: g,
206
- divider: _,
207
- children: e.render ? e.render(v, m) : n ? /* @__PURE__ */ w(n, { ...v }) : null
211
+ minWidth: a,
212
+ maxWidth: f,
213
+ flex: h,
214
+ radius: v,
215
+ background: y,
216
+ padding: b,
217
+ divider: x,
218
+ children: e.render ? e.render(S, _) : n ? /* @__PURE__ */ w(n, { ...S }) : null
208
219
  }, e.name);
209
220
  })
210
221
  });
package/dist/compound.js CHANGED
@@ -1 +1 @@
1
- export { t as CompoundField, f as ControlGroup, n as InputRange, r as InputSelect, i as NumberSelect, a as NumberUnit, o as SearchGroup, s as compoundDefaults, c as compoundRule, l as compoundValues, u as partDisabled, d as partVisible } from "./compound-BhkceJal.js";
1
+ export { t as CompoundField, f as ControlGroup, n as InputRange, r as InputSelect, i as NumberSelect, a as NumberUnit, o as SearchGroup, s as compoundDefaults, c as compoundRule, l as compoundValues, u as partDisabled, d as partVisible } from "./compound-BW6G7E_-.js";
package/dist/core.js CHANGED
@@ -1,3 +1,3 @@
1
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-BvcQ7xcl.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-CFSQW-Fv.js";
3
3
  export { m as changedOutputValues, _ as cloneValues, v as createFormStore, g as createPathAdapter, 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, e as validateRuleIssue, t as validateRules, x as writePath };
package/dist/date-time.js CHANGED
@@ -1 +1 @@
1
- export { t as DatePicker, n as DateRangePicker, r as DateTimePicker, i as DateTimeRangePicker, a as MonthPicker, o as MonthRangePicker, s as TimePicker, c as TimeRangePicker, l as YearPicker, u as YearRangePicker } from "./pickers-D-ymAf_p.js";
1
+ export { t as DatePicker, n as DateRangePicker, r as DateTimePicker, i as DateTimeRangePicker, a as MonthPicker, o as MonthRangePicker, s as TimePicker, c as TimeRangePicker, l as YearPicker, u as YearRangePicker } from "./pickers-Bci1y8cc.js";
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="100" height="100" fill="#dbeafe"/><path d="M0 70L27 28 50 57 72 34 100 72V100H0Z" fill="#6b8899"/><path d="M0 78L40 57 65 75 100 59V100H0Z" fill="#326755"/><path d="M25 68H74L82 88H17Z" fill="#164e63" stroke="#b7def0" stroke-width="2"/><path d="M21 78H78M42 68L39 88M59 68L62 88" stroke="#b7def0" stroke-width="1"/></svg>