jaguar-form 1.0.0 → 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.
Files changed (39) hide show
  1. package/README.md +18 -0
  2. package/dist/{Control-fWNQOzmu.js → Control-C6d18GL4.js} +2 -2
  3. package/dist/{Select-DUPUVAXB.js → Select-DTSlMsRZ.js} +7 -5
  4. package/dist/{TreeSelect-CBxoAWvp.js → TreeSelect-Dl_uTfIf.js} +139 -135
  5. package/dist/compound-Cw0juTQp.js +320 -0
  6. package/dist/compound.js +1 -0
  7. package/dist/core.js +3 -1
  8. package/dist/date-time.js +1 -1
  9. package/dist/form-Cih4H8PU.js +412 -0
  10. package/dist/form.js +4 -3
  11. package/dist/{icons-KmLuj5v3.js → icons-BDtmWaBt.js} +1 -1
  12. package/dist/{image-upload-CkX8vlWK.js → image-upload-Cm_41Fcr.js} +2 -2
  13. package/dist/image-upload.js +1 -1
  14. package/dist/index.js +14 -12
  15. package/dist/input.js +1 -1
  16. package/dist/{inputs-DNNFmj2K.js → inputs-dLfnlXTx.js} +3 -3
  17. package/dist/{pickers-CBW5Lzgr.js → pickers-g2TPgXFC.js} +4 -4
  18. package/dist/select.js +1 -1
  19. package/dist/selection-CIEa1uce.js +146 -0
  20. package/dist/{slider-BwDcSnnI.js → slider-CNwkLMmo.js} +1 -1
  21. package/dist/slider.js +1 -1
  22. package/dist/{store-DmlIFdPW.js → store-DOn9K-EA.js} +171 -229
  23. package/dist/style.css +1 -1
  24. package/dist/tree-select.js +1 -1
  25. package/dist/types/components/compound/ControlGroup.d.ts +29 -0
  26. package/dist/types/components/compound/context.d.ts +5 -0
  27. package/dist/types/components/compound/index.d.ts +40 -0
  28. package/dist/types/components/compound/model.d.ts +14 -0
  29. package/dist/types/components/compound/types.d.ts +24 -0
  30. package/dist/types/config/index.d.ts +2 -0
  31. package/dist/types/entries/compound.d.ts +1 -0
  32. package/dist/types/index.d.ts +1 -0
  33. package/dist/types/primitives/Popup.d.ts +1 -0
  34. package/dist/{useControllable-Dl8gno_5.js → useControllable-Zax42z2F.js} +6 -1
  35. package/dist/{useSelection-B85KkHB9.js → useSelection-BX5VFNcj.js} +53 -43
  36. package/dist/validation-D6vk5NAv.js +61 -0
  37. package/package.json +5 -1
  38. package/dist/form-D0JeWv6M.js +0 -407
  39. package/dist/selection-9OQvyjyD.js +0 -135
package/README.md CHANGED
@@ -111,3 +111,21 @@ The release check includes dependency audits, syntax, core checks, TypeScript, V
111
111
  ## License
112
112
 
113
113
  MIT.
114
+
115
+ ## Compound controls (1.0.2)
116
+
117
+ ```tsx
118
+ import { ControlGroup, NumberInput, Select, NumberUnit } from 'jaguar-form';
119
+ import 'jaguar-form/style.css';
120
+
121
+ <ControlGroup radius={10} focusMode="group">
122
+ <NumberInput defaultValue={5.5} />
123
+ <ControlGroup.Item width={90}>
124
+ <Select defaultValue="kW" options={[{value:'W',label:'W'},{value:'kW',label:'kW'}]} />
125
+ </ControlGroup.Item>
126
+ </ControlGroup>
127
+
128
+ <NumberUnit units={['W','kW','MW']} defaultValue={{value:5.5,unit:'kW'}} />
129
+ ```
130
+
131
+ `ControlGroup` controls layout only. `CompoundField` stores an object, supports conditional parts and parent-level validation in `Form` / `Form.Field`, and works with schema `transform`. Use `outlined`, `filled`, `underlined` or `borderless` (the existing control variants). Connected and inset default to group focus; separated defaults to individual focus. See [Compound controls](docs/compound.md) for the API and limitations.
@@ -1,5 +1,5 @@
1
- import { i as e, s as t } from "./useControllable-Dl8gno_5.js";
2
- import { t as n } from "./icons-KmLuj5v3.js";
1
+ import { i as e, s as t } from "./useControllable-Zax42z2F.js";
2
+ import { t as n } from "./icons-BDtmWaBt.js";
3
3
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  // src/primitives/Control.tsx
5
5
  function a({ children: a, actions: o, prefix: s, suffix: c, prefixIcon: l, suffixIcon: u, size: d, variant: f, status: p, disabled: m, readOnly: h, className: g, style: _, "aria-invalid": v }) {
@@ -1,9 +1,9 @@
1
1
  import { useEffect as e, useId as t, useMemo as n, useState as r } from "react";
2
- import { n as i, t as ee } from "./Control-fWNQOzmu.js";
3
- import { n as a, r as o } from "./selection-9OQvyjyD.js";
4
- import { c as s, l as c, o as l, s as te, t as u } from "./useSelection-B85KkHB9.js";
5
- import { t as d } from "./icons-KmLuj5v3.js";
6
- import { a as f } from "./useControllable-Dl8gno_5.js";
2
+ import { n as i, t as ee } from "./Control-C6d18GL4.js";
3
+ import { n as a, r as o } from "./selection-CIEa1uce.js";
4
+ import { c as s, l as c, o as l, s as te, t as u } from "./useSelection-BX5VFNcj.js";
5
+ import { t as d } from "./icons-BDtmWaBt.js";
6
+ import { a as f } from "./useControllable-Zax42z2F.js";
7
7
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
8
8
  // src/components/select/Select.tsx
9
9
  function g(e) {
@@ -55,6 +55,7 @@ function y(g) {
55
55
  };
56
56
  return /* @__PURE__ */ m(o, {
57
57
  ...g,
58
+ layout: "selection",
58
59
  open: b,
59
60
  onOpenChange: x,
60
61
  label: L,
@@ -110,6 +111,7 @@ function y(g) {
110
111
  })
111
112
  }),
112
113
  children: /* @__PURE__ */ h("div", {
114
+ className: "rfe-selection-body",
113
115
  onKeyDown: ie,
114
116
  "data-selection-style": g.selectionStyle ?? (g.multiple ? "subtle" : "accent"),
115
117
  children: [g.multiple && A ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("button", {
@@ -1,15 +1,15 @@
1
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, t as s } from "./Control-fWNQOzmu.js";
3
- import { n as c, r as l } from "./selection-9OQvyjyD.js";
4
- import { a as u, c as d, i as f, l as ee, n as te, o as ne, r as re, s as ie, t as ae } from "./useSelection-B85KkHB9.js";
5
- import { t as p } from "./icons-KmLuj5v3.js";
6
- import { a as oe } from "./useControllable-Dl8gno_5.js";
7
- import { Fragment as se, jsx as m, jsxs as h } from "react/jsx-runtime";
2
+ import { n as o, t as s } from "./Control-C6d18GL4.js";
3
+ import { n as c, r as l } from "./selection-CIEa1uce.js";
4
+ import { a as u, c as d, i as f, l as ee, n as te, o as p, r as ne, s as re, t as ie } from "./useSelection-BX5VFNcj.js";
5
+ import { t as m } from "./icons-BDtmWaBt.js";
6
+ import { a as ae } from "./useControllable-Zax42z2F.js";
7
+ import { Fragment as oe, jsx as h, jsxs as g } from "react/jsx-runtime";
8
8
  // src/utils/lazy-tree.ts
9
- var g = (e) => e.hasChildren === !0 && e.children === void 0, _ = (e) => !!(e.children?.length || g(e));
10
- function ce(e, t, n) {
9
+ var _ = (e) => e.hasChildren === !0 && e.children === void 0, v = (e) => !!(e.children?.length || _(e));
10
+ function se(e, t, n) {
11
11
  let r = u(e), i = r.map.get(t);
12
- if (!i || !g(i)) return e;
12
+ if (!i || !_(i)) return e;
13
13
  let a = {
14
14
  ...i,
15
15
  children: n,
@@ -25,7 +25,7 @@ function ce(e, t, n) {
25
25
  let s = e.map((e) => Object.is(e.value, o) ? a : e);
26
26
  return u(s), s;
27
27
  }
28
- function v(e, t) {
28
+ function y(e, t) {
29
29
  let n = e, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = () => t(n, new Map(i)), o = () => {
30
30
  for (let e of r.values()) e.abort();
31
31
  r.clear(), i.clear();
@@ -38,7 +38,7 @@ function v(e, t) {
38
38
  async load(e, t) {
39
39
  if (r.has(e)) return !1;
40
40
  let o = u(n).map.get(e);
41
- if (!o || !g(o)) return !1;
41
+ if (!o || !_(o)) return !1;
42
42
  let s = new AbortController();
43
43
  r.set(e, s), i.set(e, "loading"), a();
44
44
  let c = () => r.get(e) === s && !s.signal.aborted;
@@ -46,14 +46,14 @@ function v(e, t) {
46
46
  let l = await t(o, { signal: s.signal });
47
47
  if (!c()) return !1;
48
48
  if (!Array.isArray(l)) throw TypeError("loadChildren must return an array");
49
- return n = ce(n, e, l), r.delete(e), i.delete(e), a(), !0;
49
+ return n = se(n, e, l), r.delete(e), i.delete(e), a(), !0;
50
50
  } catch {
51
51
  return c() && (r.delete(e), i.set(e, "error"), a()), !1;
52
52
  }
53
53
  }
54
54
  };
55
55
  }
56
- function le(e, t, n, r) {
56
+ function ce(e, t, n, r) {
57
57
  let i = n.trim().toLocaleLowerCase(), a = [], o = e.map((t, n) => ({
58
58
  node: t,
59
59
  depth: 0,
@@ -99,12 +99,12 @@ function le(e, t, n, r) {
99
99
  });
100
100
  }
101
101
  // src/components/select/TreeSelect.tsx
102
- var y = (e) => e.searchText ?? (typeof e.label == "string" ? e.label : String(e.value));
102
+ var le = (e) => e.node.value, b = (e) => e.searchText ?? (typeof e.label == "string" ? e.label : String(e.value));
103
103
  function ue(t) {
104
104
  let [r, o] = a({
105
105
  nodes: t,
106
106
  status: /* @__PURE__ */ new Map()
107
- }), [s] = a(() => v(t, (e, t) => o({
107
+ }), [s] = a(() => y(t, (e, t) => o({
108
108
  nodes: e,
109
109
  status: t
110
110
  }))), c = i(t);
@@ -115,69 +115,69 @@ function ue(t) {
115
115
  loader: s
116
116
  };
117
117
  }
118
- function b(n) {
119
- let { text: i, t: ce, direction: v } = oe(), { nodes: b, status: x, loader: S } = ue(n.options), C = r(() => u(b), [b]), { open: w, changeOpen: T, committed: E, selected: D, update: O, confirm: de, blocked: k, triggerReadOnly: fe } = ae(n), [A, pe] = a(() => new Set(n.defaultExpandAll ? [...C.map.values()].filter((e) => e.children?.length).map((e) => e.value) : [])), [j, M] = a(""), [N, P] = a(!1), [me, F] = a(null), I = t(), L = `${I}-tree`, R = (e) => `${I}-node-${e}`, z = n["aria-label"] ?? i.choose, B = n.multiple && n.checkStrategy !== "independent", V = r(() => new Set(D), [D]), H = r(() => new Set(E), [E]), U = r(() => f(C.leaves, C.ranges, V, C.incomplete), [C, V]), he = r(() => f(C.leaves, C.ranges, H, C.incomplete), [C, H]), ge = r(() => /* @__PURE__ */ new Map(), [C]), _e = (e) => {
120
- let t = ge.get(e);
118
+ function x(n) {
119
+ let { text: i, t: se, direction: y } = ae(), { nodes: x, status: S, loader: C } = ue(n.options), w = r(() => u(x), [x]), { open: T, changeOpen: E, committed: D, selected: O, update: k, confirm: de, blocked: A, triggerReadOnly: fe } = ie(n), [j, pe] = a(() => new Set(n.defaultExpandAll ? [...w.map.values()].filter((e) => e.children?.length).map((e) => e.value) : [])), [M, me] = a(""), [N, P] = a(!1), [he, F] = a(null), I = t(), L = `${I}-tree`, R = (e) => `${I}-node-${e}`, z = n["aria-label"] ?? i.choose, B = n.multiple && n.checkStrategy !== "independent", V = r(() => new Set(O), [O]), H = r(() => new Set(D), [D]), U = r(() => f(w.leaves, w.ranges, V, w.incomplete), [w, V]), ge = r(() => f(w.leaves, w.ranges, H, w.incomplete), [w, H]), _e = r(() => /* @__PURE__ */ new Map(), [w]), ve = (e) => {
120
+ let t = _e.get(e);
121
121
  if (t !== void 0) return t;
122
122
  let n = [], r = e;
123
123
  for (; r !== void 0;) {
124
- let e = C.map.get(r);
125
- n.push(e ? y(e) : String(r)), r = C.parent.get(r);
124
+ let e = w.map.get(r);
125
+ n.push(e ? b(e) : String(r)), r = w.parent.get(r);
126
126
  }
127
127
  let i = n.reverse().join(" / ");
128
- return ge.set(e, i), i;
129
- }, ve = (e, t = !1) => {
130
- let r = C.map.get(e);
128
+ return _e.set(e, i), i;
129
+ }, ye = (e, t = !1) => {
130
+ let r = w.map.get(e);
131
131
  return {
132
132
  ...r,
133
133
  value: e,
134
- disabled: C.blockedKeys.has(e) || r?.disabled,
135
- label: n.displayPath === "full" ? _e(e) : r?.label ?? String(e),
136
- searchText: t || n.displayPath === "full" ? _e(e) : r ? y(r) : String(e)
134
+ disabled: w.blockedKeys.has(e) || r?.disabled,
135
+ label: n.displayPath === "full" ? ve(e) : r?.label ?? String(e),
136
+ searchText: t || n.displayPath === "full" ? ve(e) : r ? b(r) : String(e)
137
137
  };
138
- }, ye = r(() => B && n.showCheckedStrategy !== "leaf" ? [...re(b, he), ...E.filter((e) => !C.map.has(e))] : E, [
138
+ }, be = r(() => B && n.showCheckedStrategy !== "leaf" ? [...ne(x, ge), ...D.filter((e) => !w.map.has(e))] : D, [
139
139
  B,
140
140
  n.showCheckedStrategy,
141
- b,
142
- he,
143
- E,
144
- C
145
- ]), W = r(() => ye.map((e) => ve(e)), [
146
- ye,
147
- C,
148
- n.displayPath
149
- ]), be = r(() => w && (N || n.panelLayout === "dual") ? D.map((e) => ve(e, !0)) : [], [
141
+ x,
142
+ ge,
143
+ D,
144
+ w
145
+ ]), W = r(() => be.map((e) => ye(e)), [
146
+ be,
150
147
  w,
148
+ n.displayPath
149
+ ]), xe = r(() => T && (N || n.panelLayout === "dual") ? O.map((e) => ye(e, !0)) : [], [
150
+ T,
151
151
  N,
152
152
  n.panelLayout,
153
- D,
154
- C,
155
- n.displayPath
156
- ]), G = r(() => w ? le(b, A, j, y) : [], [
153
+ O,
157
154
  w,
158
- b,
159
- A,
160
- j
161
- ]), K = Math.max(0, G.findIndex((e) => e.node.value === me)), q = G[K], J = (e) => !C.blockedKeys.has(e.value) && e.selectable !== !1 && (n.selectable !== "leaf" || !_(e)) && (!B || U.total(e.value) > 0), xe = (e) => B ? C.leafMap.get(e.value) ?? [] : [e.value], Se = r(() => new Set(G.map((e) => e.node.value)), [G]), Ce = (e) => n.selectAllScope === "all" || !j.trim() || Se.has(e), Y = B ? C.leaves.filter(Ce) : [...C.map.values()].filter((e) => Ce(e.value) && J(e)).map((e) => e.value), X = Y.filter((e) => V.has(e)).length, Z = Y.length > 0 && Y.length === X, we = !Z && V.size + Y.length - X > (n.maxCount ?? 1e400);
155
+ n.displayPath
156
+ ]), G = r(() => T ? ce(x, j, M, b) : [], [
157
+ T,
158
+ x,
159
+ j,
160
+ M
161
+ ]), K = Math.max(0, G.findIndex((e) => e.node.value === he)), q = G[K], J = (e) => !w.blockedKeys.has(e.value) && e.selectable !== !1 && (n.selectable !== "leaf" || !v(e)) && (!B || U.total(e.value) > 0), Se = (e) => B ? w.leafMap.get(e.value) ?? [] : [e.value], Ce = r(() => new Set(G.map((e) => e.node.value)), [G]), we = (e) => n.selectAllScope === "all" || !M.trim() || Ce.has(e), Y = B ? w.leaves.filter(we) : [...w.map.values()].filter((e) => we(e.value) && J(e)).map((e) => e.value), X = Y.filter((e) => V.has(e)).length, Z = Y.length > 0 && Y.length === X, Te = !Z && V.size + Y.length - X > (n.maxCount ?? 1e400);
162
162
  e(() => {
163
- w || (M(""), P(!1), F(null));
164
- }, [w]);
163
+ T || (me(""), P(!1), F(null));
164
+ }, [T]);
165
165
  let Q = (e) => {
166
- k || n.readOnly || !J(e) || (n.multiple ? O(ne(D, xe(e), n.maxCount)) : (O([e.value]), n.needConfirm || T(!1)));
167
- }, Te = (e) => {
168
- if (C.blockedKeys.has(e)) return;
169
- let t = C.map.get(e), n = new Set(t ? xe(t) : [e]);
170
- O(D.filter((e) => !n.has(e)));
171
- }, Ee = () => O(D.filter((e) => C.blockedKeys.has(e))), $ = (e, t) => {
172
- _(e) && (t && g(e) && n.loadChildren && S.load(e.value, n.loadChildren), pe((n) => {
166
+ A || n.readOnly || !J(e) || (n.multiple ? k(p(O, Se(e), n.maxCount)) : (k([e.value]), n.needConfirm || E(!1)));
167
+ }, Ee = (e) => {
168
+ if (w.blockedKeys.has(e)) return;
169
+ let t = w.map.get(e), n = new Set(t ? Se(t) : [e]);
170
+ k(O.filter((e) => !n.has(e)));
171
+ }, De = () => k(O.filter((e) => w.blockedKeys.has(e))), $ = (e, t) => {
172
+ v(e) && (t && _(e) && n.loadChildren && C.load(e.value, n.loadChildren), pe((n) => {
173
173
  let r = new Set(n);
174
174
  return t ? r.add(e.value) : r.delete(e.value), r;
175
175
  }));
176
- }, De = (e) => {
177
- x.get(e.value) === "error" && n.loadChildren ? S.load(e.value, n.loadChildren) : $(e, !A.has(e.value));
178
176
  }, Oe = (e) => {
179
- !e.nativeEvent.isComposing && e.target instanceof HTMLElement && e.target.matches(".rfe-trigger-arrow") && ["ArrowDown", "ArrowUp"].includes(e.key) && (e.preventDefault(), T(!0));
177
+ S.get(e.value) === "error" && n.loadChildren ? C.load(e.value, n.loadChildren) : $(e, !j.has(e.value));
180
178
  }, ke = (e) => {
179
+ !e.nativeEvent.isComposing && e.target instanceof HTMLElement && e.target.matches(".rfe-trigger-arrow") && ["ArrowDown", "ArrowUp"].includes(e.key) && (e.preventDefault(), E(!0));
180
+ }, Ae = (e) => {
181
181
  if (e.nativeEvent.isComposing || e.keyCode === 229 || N && n.panelLayout !== "dual") return;
182
182
  let t = e.target;
183
183
  if (!(t instanceof HTMLElement) || !t.matches(".rfe-tree-search,.rfe-tree-list,.rfe-tree-row") || t instanceof HTMLInputElement && [
@@ -201,80 +201,81 @@ function b(n) {
201
201
  if (!q) return;
202
202
  let r = q.node;
203
203
  if (["Enter", " "].includes(e.key)) e.preventDefault(), Q(r);
204
- else if (e.key === (v === "rtl" ? "ArrowLeft" : "ArrowRight")) e.preventDefault(), _(r) && (!A.has(r.value) || g(r)) ? $(r, !0) : G[K + 1]?.depth > q.depth && F(G[K + 1].node.value);
205
- else if (e.key === (v === "rtl" ? "ArrowRight" : "ArrowLeft")) {
206
- if (e.preventDefault(), A.has(r.value) && _(r)) $(r, !1);
204
+ else if (e.key === (y === "rtl" ? "ArrowLeft" : "ArrowRight")) e.preventDefault(), v(r) && (!j.has(r.value) || _(r)) ? $(r, !0) : G[K + 1]?.depth > q.depth && F(G[K + 1].node.value);
205
+ else if (e.key === (y === "rtl" ? "ArrowRight" : "ArrowLeft")) {
206
+ if (e.preventDefault(), j.has(r.value) && v(r)) $(r, !1);
207
207
  else {
208
- let e = C.parent.get(r.value);
208
+ let e = w.parent.get(r.value);
209
209
  e !== void 0 && F(e);
210
210
  }
211
211
  }
212
212
  };
213
- return /* @__PURE__ */ h(l, {
213
+ return /* @__PURE__ */ g(l, {
214
214
  ...n,
215
- open: w,
216
- onOpenChange: T,
215
+ layout: "selection",
216
+ open: T,
217
+ onOpenChange: E,
217
218
  label: z,
218
- trigger: (e, t) => /* @__PURE__ */ m("div", {
219
+ trigger: (e, t) => /* @__PURE__ */ h("div", {
219
220
  ref: t,
220
- onKeyDown: Oe,
221
+ onKeyDown: ke,
221
222
  onBlur: (e) => {
222
- !w && !e.currentTarget.contains(e.relatedTarget) && n.onBlur?.();
223
+ !T && !e.currentTarget.contains(e.relatedTarget) && n.onBlur?.();
223
224
  },
224
- children: /* @__PURE__ */ m(o, {
225
+ children: /* @__PURE__ */ h(o, {
225
226
  ...n,
226
- actions: /* @__PURE__ */ h(se, { children: [n.clearable !== !1 && /* @__PURE__ */ m(s, {
227
+ actions: /* @__PURE__ */ g(oe, { children: [n.clearable !== !1 && /* @__PURE__ */ h(s, {
227
228
  name: "clear",
228
229
  source: n.icons?.clear,
229
230
  label: i.clear,
230
- hidden: !E.length,
231
+ hidden: !D.length,
231
232
  disabled: fe,
232
- onClick: Ee
233
- }), /* @__PURE__ */ m("button", {
233
+ onClick: De
234
+ }), /* @__PURE__ */ h("button", {
234
235
  ...e,
235
236
  type: "button",
236
237
  id: n.id ?? I,
237
- disabled: k,
238
+ disabled: A,
238
239
  "aria-invalid": n["aria-invalid"] ?? n.status === "error",
239
240
  "aria-describedby": n["aria-describedby"],
240
241
  "aria-label": z,
241
242
  className: "rfe-trigger-arrow",
242
- "data-open": w,
243
- onClick: () => T(!w),
244
- children: /* @__PURE__ */ m(p, {
243
+ "data-open": T,
244
+ onClick: () => E(!T),
245
+ children: /* @__PURE__ */ h(m, {
245
246
  name: "dropdown",
246
247
  source: n.icons?.dropdown
247
248
  })
248
249
  })] }),
249
- children: /* @__PURE__ */ m("div", {
250
+ children: /* @__PURE__ */ h("div", {
250
251
  className: "rfe-value",
251
- onClick: () => T(!w),
252
- children: n.multiple ? /* @__PURE__ */ m(d, {
252
+ onClick: () => E(!T),
253
+ children: n.multiple ? /* @__PURE__ */ h(d, {
253
254
  options: W,
254
255
  mode: n.displayMode,
255
256
  maxTagCount: n.maxTagCount,
256
257
  maxTagRows: n.maxTagRows,
257
- onRemove: Te,
258
+ onRemove: Ee,
258
259
  onInspect: () => {
259
- k || (w || T(!0), P(!0));
260
+ A || (T || E(!0), P(!0));
260
261
  },
261
262
  readOnly: fe,
262
263
  placeholder: n.placeholder
263
- }) : /* @__PURE__ */ m("span", {
264
+ }) : /* @__PURE__ */ h("span", {
264
265
  className: W.length ? "rfe-single-value" : "rfe-placeholder",
265
266
  children: W[0]?.label ?? n.placeholder ?? i.choose
266
267
  })
267
268
  })
268
269
  })
269
270
  }),
270
- children: [/* @__PURE__ */ h("div", {
271
+ children: [/* @__PURE__ */ g("div", {
271
272
  "data-selection-style": n.selectionStyle ?? (n.multiple ? "subtle" : "accent"),
272
- className: n.panelLayout === "dual" ? "rfe-dual" : "",
273
- onKeyDown: ke,
274
- children: [(!N || n.panelLayout === "dual") && /* @__PURE__ */ h("div", {
273
+ className: `rfe-selection-body${n.panelLayout === "dual" ? " rfe-dual" : ""}`,
274
+ onKeyDown: Ae,
275
+ children: [(!N || n.panelLayout === "dual") && /* @__PURE__ */ g("div", {
275
276
  className: "rfe-tree-main",
276
277
  children: [
277
- n.searchable !== !1 && /* @__PURE__ */ m("input", {
278
+ n.searchable !== !1 && /* @__PURE__ */ h("input", {
278
279
  className: "rfe-search rfe-tree-search",
279
280
  role: "combobox",
280
281
  "aria-expanded": "true",
@@ -284,42 +285,42 @@ function b(n) {
284
285
  "aria-autocomplete": "list",
285
286
  placeholder: i.search,
286
287
  "aria-label": i.search,
287
- value: j,
288
+ value: M,
288
289
  onChange: (e) => {
289
- M(e.target.value), F(null);
290
+ me(e.target.value), F(null);
290
291
  }
291
292
  }),
292
- /* @__PURE__ */ h("div", {
293
+ /* @__PURE__ */ g("div", {
293
294
  className: "rfe-toolbar",
294
- children: [/* @__PURE__ */ m("button", {
295
+ children: [/* @__PURE__ */ h("button", {
295
296
  type: "button",
296
297
  className: "rfe-link",
297
- onClick: () => pe(A.size ? /* @__PURE__ */ new Set() : new Set([...C.map.values()].filter((e) => e.children?.length).map((e) => e.value))),
298
- children: A.size ? i.collapseAll : i.expandAll
299
- }), n.multiple && n.showSelectAll && !n.readOnly && /* @__PURE__ */ h("button", {
298
+ onClick: () => pe(j.size ? /* @__PURE__ */ new Set() : new Set([...w.map.values()].filter((e) => e.children?.length).map((e) => e.value))),
299
+ children: j.size ? i.collapseAll : i.expandAll
300
+ }), n.multiple && n.showSelectAll && !n.readOnly && /* @__PURE__ */ g("button", {
300
301
  type: "button",
301
302
  className: "rfe-select-all",
302
303
  role: "checkbox",
303
304
  "aria-checked": Z ? !0 : X ? "mixed" : !1,
304
305
  "aria-label": i.all,
305
- title: we ? ce("max", { max: n.maxCount ?? 0 }) : void 0,
306
- disabled: !Y.length || we,
307
- onClick: () => O(ne(D, Y, n.maxCount)),
308
- children: [/* @__PURE__ */ m("span", {
306
+ title: Te ? se("max", { max: n.maxCount ?? 0 }) : void 0,
307
+ disabled: !Y.length || Te,
308
+ onClick: () => k(p(O, Y, n.maxCount)),
309
+ children: [/* @__PURE__ */ h("span", {
309
310
  className: "rfe-option-check",
310
311
  "data-checked": X > 0,
311
- children: X > 0 && /* @__PURE__ */ m(p, { name: Z ? "check" : "minus" })
312
+ children: X > 0 && /* @__PURE__ */ h(m, { name: Z ? "check" : "minus" })
312
313
  }), Z ? i.deselectAll : i.all]
313
314
  })]
314
315
  }),
315
- n.optionsLoading && /* @__PURE__ */ h("div", {
316
+ n.optionsLoading && /* @__PURE__ */ g("div", {
316
317
  className: "rfe-options-loading",
317
318
  role: "status",
318
- children: [/* @__PURE__ */ m(p, { name: "loading" }), i.loading]
319
+ children: [/* @__PURE__ */ h(m, { name: "loading" }), i.loading]
319
320
  }),
320
- G.length ? /* @__PURE__ */ m(ee, {
321
+ G.length ? /* @__PURE__ */ h(ee, {
321
322
  items: G,
322
- getKey: (e) => e.node.value,
323
+ getKey: le,
323
324
  id: L,
324
325
  className: "rfe-tree-list",
325
326
  role: "tree",
@@ -330,13 +331,13 @@ function b(n) {
330
331
  activeId: q ? R(K) : void 0,
331
332
  variableHeight: n.variableHeight,
332
333
  render: ({ node: e, depth: t, position: r, setSize: a }, o) => {
333
- let s = _(e), c = A.has(e.value) || !!(j.trim() && e.children?.length), l = B ? U.state(e.value) : te([e.value], V), u = k || n.readOnly || !J(e), d = x.get(e.value);
334
- return /* @__PURE__ */ h("div", {
334
+ let s = v(e), c = j.has(e.value) || !!(M.trim() && e.children?.length), l = B ? U.state(e.value) : te([e.value], V), u = A || n.readOnly || !J(e), d = S.get(e.value);
335
+ return /* @__PURE__ */ g("div", {
335
336
  id: R(o),
336
337
  className: "rfe-tree-row",
337
338
  role: "treeitem",
338
339
  tabIndex: -1,
339
- "aria-label": y(e),
340
+ "aria-label": b(e),
340
341
  "aria-level": t + 1,
341
342
  "aria-posinset": r,
342
343
  "aria-setsize": a,
@@ -348,34 +349,34 @@ function b(n) {
348
349
  "data-active": K === o || void 0,
349
350
  style: { paddingInlineStart: t * 16 + 4 },
350
351
  onMouseEnter: () => F(e.value),
351
- children: [/* @__PURE__ */ m("span", {
352
+ children: [/* @__PURE__ */ h("span", {
352
353
  className: "rfe-tree-expand",
353
354
  "aria-hidden": "true",
354
355
  title: d === "error" ? i.retry : c ? i.collapse : i.expand,
355
356
  "data-expanded": c,
356
357
  "data-load": d,
357
358
  style: s ? void 0 : { visibility: "hidden" },
358
- onClick: () => De(e),
359
- children: /* @__PURE__ */ m(p, { name: d === "loading" ? "loading" : d === "error" ? "error" : "next" })
360
- }), /* @__PURE__ */ h("div", {
359
+ onClick: () => Oe(e),
360
+ children: /* @__PURE__ */ h(m, { name: d === "loading" ? "loading" : d === "error" ? "error" : "next" })
361
+ }), /* @__PURE__ */ g("div", {
361
362
  className: "rfe-option",
362
363
  "data-disabled": u || void 0,
363
364
  "data-active": K === o || void 0,
364
365
  "data-selected": l === "all" || void 0,
365
366
  onClick: () => Q(e),
366
367
  children: [
367
- n.multiple && /* @__PURE__ */ m("span", {
368
+ n.multiple && /* @__PURE__ */ h("span", {
368
369
  className: "rfe-option-check",
369
370
  "data-checked": l !== "none",
370
- children: l !== "none" && /* @__PURE__ */ m(p, { name: l === "partial" ? "minus" : "check" })
371
+ children: l !== "none" && /* @__PURE__ */ h(m, { name: l === "partial" ? "minus" : "check" })
371
372
  }),
372
- n.showIcon && /* @__PURE__ */ m(p, { name: s ? c ? "folderOpen" : "folder" : "leaf" }),
373
- /* @__PURE__ */ m("span", {
373
+ n.showIcon && /* @__PURE__ */ h(m, { name: s ? c ? "folderOpen" : "folder" : "leaf" }),
374
+ /* @__PURE__ */ h("span", {
374
375
  className: "rfe-option-label",
375
376
  children: e.label
376
377
  }),
377
- !n.multiple && l === "all" && /* @__PURE__ */ m(p, { name: "check" }),
378
- d === "error" && /* @__PURE__ */ m("span", {
378
+ !n.multiple && l === "all" && /* @__PURE__ */ h(m, { name: "check" }),
379
+ d === "error" && /* @__PURE__ */ h("span", {
379
380
  role: "status",
380
381
  className: "rfe-tree-error",
381
382
  children: i.retry
@@ -384,44 +385,47 @@ function b(n) {
384
385
  })]
385
386
  });
386
387
  }
387
- }) : !n.optionsLoading && /* @__PURE__ */ m("div", {
388
+ }) : !n.optionsLoading && /* @__PURE__ */ h("div", {
388
389
  className: "rfe-empty",
389
390
  role: "status",
390
391
  children: i.empty
391
392
  })
392
393
  ]
393
- }), (N || n.panelLayout === "dual") && /* @__PURE__ */ h("div", { children: [n.panelLayout !== "dual" && /* @__PURE__ */ h("button", {
394
- type: "button",
395
- className: "rfe-link",
396
- onClick: () => P(!1),
397
- children: [/* @__PURE__ */ m(p, { name: "previous" }), i.choose]
398
- }), /* @__PURE__ */ m(ie, {
399
- options: be,
400
- onRemove: Te,
401
- onClear: Ee,
402
- readOnly: n.readOnly
403
- })] })]
404
- }), (n.multiple || n.needConfirm) && /* @__PURE__ */ h("div", {
394
+ }), (N || n.panelLayout === "dual") && /* @__PURE__ */ g("div", {
395
+ className: "rfe-selection-inspect",
396
+ children: [n.panelLayout !== "dual" && /* @__PURE__ */ g("button", {
397
+ type: "button",
398
+ className: "rfe-link",
399
+ onClick: () => P(!1),
400
+ children: [/* @__PURE__ */ h(m, { name: "previous" }), i.choose]
401
+ }), /* @__PURE__ */ h(re, {
402
+ options: xe,
403
+ onRemove: Ee,
404
+ onClear: De,
405
+ readOnly: n.readOnly
406
+ })]
407
+ })]
408
+ }), (n.multiple || n.needConfirm) && /* @__PURE__ */ g("div", {
405
409
  className: "rfe-footer",
406
410
  children: [
407
- /* @__PURE__ */ h("button", {
411
+ /* @__PURE__ */ g("button", {
408
412
  type: "button",
409
413
  className: "rfe-link",
410
414
  onClick: () => P(!N),
411
415
  children: [
412
416
  i.selected,
413
417
  " ",
414
- D.length
418
+ O.length
415
419
  ]
416
420
  }),
417
- /* @__PURE__ */ m("span", { className: "rfe-spacer" }),
418
- n.needConfirm && /* @__PURE__ */ m("button", {
421
+ /* @__PURE__ */ h("span", { className: "rfe-spacer" }),
422
+ n.needConfirm && /* @__PURE__ */ h("button", {
419
423
  type: "button",
420
424
  className: "rfe-link",
421
- onClick: () => T(!1),
425
+ onClick: () => E(!1),
422
426
  children: i.cancel
423
427
  }),
424
- /* @__PURE__ */ m("button", {
428
+ /* @__PURE__ */ h("button", {
425
429
  type: "button",
426
430
  className: "rfe-button",
427
431
  "data-variant": "primary",
@@ -432,4 +436,4 @@ function b(n) {
432
436
  })]
433
437
  });
434
438
  }
435
- export { b as t };
439
+ export { x as t };