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.
- package/README.md +18 -0
- package/dist/{Control-fWNQOzmu.js → Control-C6d18GL4.js} +2 -2
- package/dist/{Select-DUPUVAXB.js → Select-DTSlMsRZ.js} +7 -5
- package/dist/{TreeSelect-CBxoAWvp.js → TreeSelect-Dl_uTfIf.js} +139 -135
- 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-CBW5Lzgr.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/types/primitives/Popup.d.ts +1 -0
- package/dist/{useControllable-Dl8gno_5.js → useControllable-Zax42z2F.js} +6 -1
- package/dist/{useSelection-B85KkHB9.js → useSelection-BX5VFNcj.js} +53 -43
- package/dist/validation-D6vk5NAv.js +61 -0
- package/package.json +5 -1
- package/dist/form-D0JeWv6M.js +0 -407
- 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-
|
|
2
|
-
import { t as n } from "./icons-
|
|
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-
|
|
3
|
-
import { n as a, r as o } from "./selection-
|
|
4
|
-
import { c as s, l as c, o as l, s as te, t as u } from "./useSelection-
|
|
5
|
-
import { t as d } from "./icons-
|
|
6
|
-
import { a as f } from "./useControllable-
|
|
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-
|
|
3
|
-
import { n as c, r as l } from "./selection-
|
|
4
|
-
import { a as u, c as d, i as f, l as ee, n as te, o as
|
|
5
|
-
import { t as
|
|
6
|
-
import { a as
|
|
7
|
-
import { Fragment as
|
|
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
|
|
10
|
-
function
|
|
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 || !
|
|
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
|
|
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 || !
|
|
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 =
|
|
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
|
|
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
|
|
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(() =>
|
|
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
|
|
119
|
-
let { text: i, t:
|
|
120
|
-
let t =
|
|
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 =
|
|
125
|
-
n.push(e ?
|
|
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
|
|
129
|
-
},
|
|
130
|
-
let r =
|
|
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:
|
|
135
|
-
label: n.displayPath === "full" ?
|
|
136
|
-
searchText: t || n.displayPath === "full" ?
|
|
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
|
-
},
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]), W = r(() =>
|
|
146
|
-
|
|
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
|
-
|
|
154
|
-
C,
|
|
155
|
-
n.displayPath
|
|
156
|
-
]), G = r(() => w ? le(b, A, j, y) : [], [
|
|
153
|
+
O,
|
|
157
154
|
w,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
164
|
-
}, [
|
|
163
|
+
T || (me(""), P(!1), F(null));
|
|
164
|
+
}, [T]);
|
|
165
165
|
let Q = (e) => {
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
if (
|
|
169
|
-
let t =
|
|
170
|
-
O
|
|
171
|
-
},
|
|
172
|
-
|
|
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
|
-
|
|
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 === (
|
|
205
|
-
else if (e.key === (
|
|
206
|
-
if (e.preventDefault(),
|
|
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 =
|
|
208
|
+
let e = w.parent.get(r.value);
|
|
209
209
|
e !== void 0 && F(e);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ g(l, {
|
|
214
214
|
...n,
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
layout: "selection",
|
|
216
|
+
open: T,
|
|
217
|
+
onOpenChange: E,
|
|
217
218
|
label: z,
|
|
218
|
-
trigger: (e, t) => /* @__PURE__ */
|
|
219
|
+
trigger: (e, t) => /* @__PURE__ */ h("div", {
|
|
219
220
|
ref: t,
|
|
220
|
-
onKeyDown:
|
|
221
|
+
onKeyDown: ke,
|
|
221
222
|
onBlur: (e) => {
|
|
222
|
-
!
|
|
223
|
+
!T && !e.currentTarget.contains(e.relatedTarget) && n.onBlur?.();
|
|
223
224
|
},
|
|
224
|
-
children: /* @__PURE__ */
|
|
225
|
+
children: /* @__PURE__ */ h(o, {
|
|
225
226
|
...n,
|
|
226
|
-
actions: /* @__PURE__ */
|
|
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: !
|
|
231
|
+
hidden: !D.length,
|
|
231
232
|
disabled: fe,
|
|
232
|
-
onClick:
|
|
233
|
-
}), /* @__PURE__ */
|
|
233
|
+
onClick: De
|
|
234
|
+
}), /* @__PURE__ */ h("button", {
|
|
234
235
|
...e,
|
|
235
236
|
type: "button",
|
|
236
237
|
id: n.id ?? I,
|
|
237
|
-
disabled:
|
|
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":
|
|
243
|
-
onClick: () =>
|
|
244
|
-
children: /* @__PURE__ */ m
|
|
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__ */
|
|
250
|
+
children: /* @__PURE__ */ h("div", {
|
|
250
251
|
className: "rfe-value",
|
|
251
|
-
onClick: () =>
|
|
252
|
-
children: n.multiple ? /* @__PURE__ */
|
|
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:
|
|
258
|
+
onRemove: Ee,
|
|
258
259
|
onInspect: () => {
|
|
259
|
-
|
|
260
|
+
A || (T || E(!0), P(!0));
|
|
260
261
|
},
|
|
261
262
|
readOnly: fe,
|
|
262
263
|
placeholder: n.placeholder
|
|
263
|
-
}) : /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
274
|
-
children: [(!N || n.panelLayout === "dual") && /* @__PURE__ */
|
|
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__ */
|
|
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:
|
|
288
|
+
value: M,
|
|
288
289
|
onChange: (e) => {
|
|
289
|
-
|
|
290
|
+
me(e.target.value), F(null);
|
|
290
291
|
}
|
|
291
292
|
}),
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ g("div", {
|
|
293
294
|
className: "rfe-toolbar",
|
|
294
|
-
children: [/* @__PURE__ */
|
|
295
|
+
children: [/* @__PURE__ */ h("button", {
|
|
295
296
|
type: "button",
|
|
296
297
|
className: "rfe-link",
|
|
297
|
-
onClick: () => pe(
|
|
298
|
-
children:
|
|
299
|
-
}), n.multiple && n.showSelectAll && !n.readOnly && /* @__PURE__ */
|
|
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:
|
|
306
|
-
disabled: !Y.length ||
|
|
307
|
-
onClick: () =>
|
|
308
|
-
children: [/* @__PURE__ */
|
|
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
|
|
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__ */
|
|
316
|
+
n.optionsLoading && /* @__PURE__ */ g("div", {
|
|
316
317
|
className: "rfe-options-loading",
|
|
317
318
|
role: "status",
|
|
318
|
-
children: [/* @__PURE__ */ m
|
|
319
|
+
children: [/* @__PURE__ */ h(m, { name: "loading" }), i.loading]
|
|
319
320
|
}),
|
|
320
|
-
G.length ? /* @__PURE__ */
|
|
321
|
+
G.length ? /* @__PURE__ */ h(ee, {
|
|
321
322
|
items: G,
|
|
322
|
-
getKey:
|
|
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 =
|
|
334
|
-
return /* @__PURE__ */
|
|
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":
|
|
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__ */
|
|
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: () =>
|
|
359
|
-
children: /* @__PURE__ */ m
|
|
360
|
-
}), /* @__PURE__ */
|
|
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__ */
|
|
368
|
+
n.multiple && /* @__PURE__ */ h("span", {
|
|
368
369
|
className: "rfe-option-check",
|
|
369
370
|
"data-checked": l !== "none",
|
|
370
|
-
children: l !== "none" && /* @__PURE__ */ m
|
|
371
|
+
children: l !== "none" && /* @__PURE__ */ h(m, { name: l === "partial" ? "minus" : "check" })
|
|
371
372
|
}),
|
|
372
|
-
n.showIcon && /* @__PURE__ */ m
|
|
373
|
-
/* @__PURE__ */
|
|
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
|
|
378
|
-
d === "error" && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
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__ */
|
|
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
|
-
|
|
418
|
+
O.length
|
|
415
419
|
]
|
|
416
420
|
}),
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
n.needConfirm && /* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ h("span", { className: "rfe-spacer" }),
|
|
422
|
+
n.needConfirm && /* @__PURE__ */ h("button", {
|
|
419
423
|
type: "button",
|
|
420
424
|
className: "rfe-link",
|
|
421
|
-
onClick: () =>
|
|
425
|
+
onClick: () => E(!1),
|
|
422
426
|
children: i.cancel
|
|
423
427
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
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 {
|
|
439
|
+
export { x as t };
|