wimui 0.59.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
- package/dist/components/ai/SourceCitation/SourceCitation.d.ts +5 -1
- package/dist/components/ai/SourceCitation/SourceCitation.js +10 -8
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.d.ts +5 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +54 -53
- package/dist/components/data-display/FAQSection/FAQSection.cjs +1 -1
- package/dist/components/data-display/FAQSection/FAQSection.d.ts +5 -1
- package/dist/components/data-display/FAQSection/FAQSection.js +5 -3
- package/dist/components/data-display/TreeView/TreeView.cjs +1 -1
- package/dist/components/data-display/TreeView/TreeView.d.ts +5 -1
- package/dist/components/data-display/TreeView/TreeView.js +87 -87
- package/dist/components/feedback/Notification/Notification.cjs +1 -1
- package/dist/components/feedback/Notification/Notification.d.ts +5 -1
- package/dist/components/feedback/Notification/Notification.js +10 -8
- package/dist/components/feedback/Toast/Toast.cjs +1 -1
- package/dist/components/feedback/Toast/Toast.d.ts +5 -1
- package/dist/components/feedback/Toast/Toast.js +11 -9
- package/dist/components/form/SignaturePad/SignaturePad.cjs +1 -1
- package/dist/components/form/SignaturePad/SignaturePad.d.ts +5 -1
- package/dist/components/form/SignaturePad/SignaturePad.js +47 -47
- package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.d.ts +5 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.js +11 -6
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.d.ts +5 -1
- package/dist/components/navigation/Pagination/Pagination.js +65 -63
- package/dist/components/overlay/Menu/Menu.cjs +1 -1
- package/dist/components/overlay/Menu/Menu.d.ts +4 -0
- package/dist/components/overlay/Menu/Menu.js +23 -21
- package/dist/llms-full.txt +19 -1
- package/dist/llms.txt +1 -1
- package/dist/wimui.umd.js +2 -2
- package/package.json +1 -1
|
@@ -52,17 +52,17 @@ function C(e, t) {
|
|
|
52
52
|
}
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ne(e, t, n = []) {
|
|
56
56
|
for (let r of e) {
|
|
57
57
|
if (r.value === t) return n;
|
|
58
58
|
if (r.children) {
|
|
59
|
-
let e =
|
|
59
|
+
let e = ne(r.children, t, [...n, r.value]);
|
|
60
60
|
if (e !== null) return e;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function w(e, t) {
|
|
66
66
|
let n = [], r = new Set(t);
|
|
67
67
|
function i(e) {
|
|
68
68
|
if (!e.children?.length) return r.has(e.value) ? "checked" : "unchecked";
|
|
@@ -75,49 +75,49 @@ function T(e, t) {
|
|
|
75
75
|
effectiveCheckedSet: r
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
var
|
|
79
|
-
let { t:
|
|
78
|
+
var T = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable: S = !1, checkStrategy: T = "cascade", searchable: E = !1, defaultExpandedValues: D = [], defaultSelectedValues: O = [], defaultCheckedValues: re = [], onCheckedChange: k, onSelectedChange: A, width: ie, virtualThreshold: j = y, labels: M = {}, labelId: N, styles: P, "aria-label": F, "aria-labelledby": I }) => {
|
|
79
|
+
let { t: L } = e(t), { searchPlaceholder: ae, searchAriaLabel: R = L("treeview.search_aria"), expandLabel: z = (e) => L("treeview.expand", { label: e }), collapseLabel: B = (e) => L("treeview.collapse", { label: e }) } = M, [V, oe] = p(D), [H, se] = p(O), [U, ce] = p(re), [W, le] = p(""), [G, K] = p(O[0] || null), q = c.useRef(null), { indeterminateValues: J, effectiveCheckedSet: ue } = f(() => !l || T !== "cascade" ? {
|
|
80
80
|
indeterminateValues: [],
|
|
81
81
|
effectiveCheckedSet: new Set(U)
|
|
82
|
-
} :
|
|
82
|
+
} : w(l, new Set(U)), [
|
|
83
83
|
l,
|
|
84
|
-
|
|
84
|
+
T,
|
|
85
85
|
U
|
|
86
86
|
]), Y = u((e) => {
|
|
87
|
-
|
|
87
|
+
oe((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
88
88
|
}, []), X = u((e) => {
|
|
89
|
-
if (v)
|
|
89
|
+
if (v) se((t) => {
|
|
90
90
|
let n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
|
|
91
|
-
return
|
|
91
|
+
return A?.(n), n;
|
|
92
92
|
});
|
|
93
93
|
else {
|
|
94
94
|
let t = [e];
|
|
95
|
-
|
|
95
|
+
se(t), A?.(t);
|
|
96
96
|
}
|
|
97
|
-
}, [v,
|
|
98
|
-
|
|
97
|
+
}, [v, A]), Z = u((e) => {
|
|
98
|
+
ce((t) => {
|
|
99
99
|
let n;
|
|
100
|
-
if (!l) return n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e],
|
|
101
|
-
if (
|
|
102
|
-
let { indeterminateValues: r } =
|
|
100
|
+
if (!l) return n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e], k?.(n), n;
|
|
101
|
+
if (T === "cascade") {
|
|
102
|
+
let { indeterminateValues: r } = w(l, new Set(t)), i = t.includes(e) && !r.includes(e), a = [e, ...C(l, e) ?? []];
|
|
103
103
|
n = i ? t.filter((e) => !a.includes(e)) : [...t, ...a.filter((e) => !t.includes(e))];
|
|
104
|
-
let { indeterminateValues: o, effectiveCheckedSet: s } =
|
|
105
|
-
|
|
104
|
+
let { indeterminateValues: o, effectiveCheckedSet: s } = w(l, new Set(n));
|
|
105
|
+
k?.([...s].filter((e) => !o.includes(e)));
|
|
106
106
|
} else {
|
|
107
107
|
if (t.includes(e)) n = t.filter((t) => t !== e);
|
|
108
108
|
else {
|
|
109
|
-
let r =
|
|
109
|
+
let r = ne(l, e) ?? [], i = C(l, e) ?? [], a = /* @__PURE__ */ new Set([...r, ...i]);
|
|
110
110
|
n = [...t.filter((e) => !a.has(e)), e];
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
k?.(n);
|
|
113
113
|
}
|
|
114
114
|
return n;
|
|
115
115
|
});
|
|
116
116
|
}, [
|
|
117
|
-
|
|
117
|
+
T,
|
|
118
118
|
l,
|
|
119
|
-
|
|
120
|
-
]),
|
|
119
|
+
k
|
|
120
|
+
]), de = f(() => ({
|
|
121
121
|
expandedValues: V,
|
|
122
122
|
selectedValues: H,
|
|
123
123
|
checkedValues: U,
|
|
@@ -130,7 +130,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
130
130
|
containerRef: q,
|
|
131
131
|
multiSelect: v,
|
|
132
132
|
checkable: S,
|
|
133
|
-
checkStrategy:
|
|
133
|
+
checkStrategy: T,
|
|
134
134
|
searchQuery: W,
|
|
135
135
|
labels: {
|
|
136
136
|
expandLabel: z,
|
|
@@ -147,7 +147,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
147
147
|
Z,
|
|
148
148
|
v,
|
|
149
149
|
S,
|
|
150
|
-
|
|
150
|
+
T,
|
|
151
151
|
W,
|
|
152
152
|
z,
|
|
153
153
|
B
|
|
@@ -155,7 +155,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
155
155
|
l,
|
|
156
156
|
V,
|
|
157
157
|
W
|
|
158
|
-
]),
|
|
158
|
+
]), fe = !!l && Q.length >= j, $ = u((e) => {
|
|
159
159
|
let t = q.current;
|
|
160
160
|
if (!t || !e) return;
|
|
161
161
|
let n = Array.from(t.querySelectorAll("[role=\"treeitem\"]")).find((t) => t.getAttribute("data-value") === e);
|
|
@@ -170,7 +170,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
170
170
|
G,
|
|
171
171
|
$
|
|
172
172
|
]);
|
|
173
|
-
let
|
|
173
|
+
let pe = u((e, t, n) => {
|
|
174
174
|
switch (e.key) {
|
|
175
175
|
case "Enter":
|
|
176
176
|
case " ":
|
|
@@ -204,10 +204,10 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
204
204
|
S,
|
|
205
205
|
Z,
|
|
206
206
|
Y
|
|
207
|
-
]),
|
|
208
|
-
let a = H.includes(e.value), s =
|
|
207
|
+
]), me = u((e, t) => {
|
|
208
|
+
let a = H.includes(e.value), s = ue.has(e.value), c = J.includes(e.value), l = V.includes(e.value), u = G === e.value, d = b(e.label);
|
|
209
209
|
return /* @__PURE__ */ h("div", {
|
|
210
|
-
className: m(o.item, a && o.selected, e.disabled && o.disabled,
|
|
210
|
+
className: m(o.item, a && o.selected, e.disabled && o.disabled, P?.item),
|
|
211
211
|
role: "treeitem",
|
|
212
212
|
"aria-expanded": e.hasChildren ? l : void 0,
|
|
213
213
|
"aria-selected": a,
|
|
@@ -221,22 +221,22 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
221
221
|
t.stopPropagation(), K(e.value), e.disabled || (v && S ? Z(e.value) : X(e.value));
|
|
222
222
|
},
|
|
223
223
|
onKeyDown: (n) => {
|
|
224
|
-
n.key !== "Tab" && n.key !== "Escape" && n.stopPropagation(),
|
|
224
|
+
n.key !== "Tab" && n.key !== "Escape" && n.stopPropagation(), pe(n, e, t);
|
|
225
225
|
},
|
|
226
226
|
onFocus: (t) => {
|
|
227
227
|
t.stopPropagation(), K(e.value);
|
|
228
228
|
},
|
|
229
229
|
style: { paddingLeft: e.depth * 20 },
|
|
230
230
|
children: /* @__PURE__ */ h(i, {
|
|
231
|
-
className: m(o.labelContainer,
|
|
231
|
+
className: m(o.labelContainer, P?.labelContainer),
|
|
232
232
|
active: a,
|
|
233
233
|
disabled: e.disabled,
|
|
234
234
|
icon: /* @__PURE__ */ g("div", {
|
|
235
|
-
className: m(o.iconWrapper,
|
|
235
|
+
className: m(o.iconWrapper, P?.iconWrapper),
|
|
236
236
|
children: [
|
|
237
237
|
e.hasChildren ? /* @__PURE__ */ h("button", {
|
|
238
238
|
type: "button",
|
|
239
|
-
className: m(o.expandBtn, l && o.expanded,
|
|
239
|
+
className: m(o.expandBtn, l && o.expanded, P?.expandBtn),
|
|
240
240
|
onClick: (t) => {
|
|
241
241
|
t.stopPropagation(), e.disabled || Y(e.value);
|
|
242
242
|
},
|
|
@@ -250,7 +250,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
250
250
|
}) : /* @__PURE__ */ h("span", { className: o.spacer }),
|
|
251
251
|
S && /* @__PURE__ */ h("input", {
|
|
252
252
|
type: "checkbox",
|
|
253
|
-
className: m(o.checkbox,
|
|
253
|
+
className: m(o.checkbox, P?.checkbox),
|
|
254
254
|
checked: s && !c,
|
|
255
255
|
ref: (e) => {
|
|
256
256
|
e && (e.indeterminate = c);
|
|
@@ -264,7 +264,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
264
264
|
tabIndex: -1
|
|
265
265
|
}),
|
|
266
266
|
e.icon && /* @__PURE__ */ h("span", {
|
|
267
|
-
className: m(o.icon,
|
|
267
|
+
className: m(o.icon, P?.icon),
|
|
268
268
|
children: e.icon
|
|
269
269
|
})
|
|
270
270
|
]
|
|
@@ -274,7 +274,7 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
274
274
|
}, e.value);
|
|
275
275
|
}, [
|
|
276
276
|
H,
|
|
277
|
-
|
|
277
|
+
ue,
|
|
278
278
|
J,
|
|
279
279
|
V,
|
|
280
280
|
G,
|
|
@@ -284,77 +284,77 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
284
284
|
X,
|
|
285
285
|
Z,
|
|
286
286
|
Y,
|
|
287
|
-
|
|
287
|
+
pe,
|
|
288
288
|
z,
|
|
289
289
|
B,
|
|
290
|
-
|
|
290
|
+
P
|
|
291
291
|
]);
|
|
292
292
|
return /* @__PURE__ */ h(_.Provider, {
|
|
293
|
-
value:
|
|
293
|
+
value: de,
|
|
294
294
|
children: /* @__PURE__ */ g("div", {
|
|
295
295
|
ref: q,
|
|
296
296
|
"data-testid": "tree-view-root",
|
|
297
|
-
className: m("wim-tree-view", o.root, !!l && o.dataDriven, d,
|
|
297
|
+
className: m("wim-tree-view", o.root, !!l && o.dataDriven, d, P?.root),
|
|
298
298
|
role: "tree",
|
|
299
|
-
"aria-label":
|
|
300
|
-
"aria-labelledby":
|
|
299
|
+
"aria-label": I ? void 0 : F ?? M.treeAriaLabel,
|
|
300
|
+
"aria-labelledby": I ?? (!F && !M.treeAriaLabel ? N : void 0),
|
|
301
301
|
style: {
|
|
302
|
-
width:
|
|
302
|
+
width: ie,
|
|
303
303
|
maxWidth: "100%"
|
|
304
304
|
},
|
|
305
305
|
tabIndex: G ? -1 : 0,
|
|
306
306
|
onFocus: (e) => {
|
|
307
307
|
e.target === q.current && (l ? G ? $(G) : Q.length > 0 && (K(Q[0].value), $(Q[0].value)) : G ? (q.current?.querySelector(`[role="treeitem"][data-value="${G}"]`))?.focus() : (q.current?.querySelector("[role=\"treeitem\"]"))?.focus());
|
|
308
308
|
},
|
|
309
|
-
children: [
|
|
310
|
-
className: m(o.search,
|
|
309
|
+
children: [E && /* @__PURE__ */ h("div", {
|
|
310
|
+
className: m(o.search, P?.search),
|
|
311
311
|
children: /* @__PURE__ */ h("input", {
|
|
312
312
|
type: "text",
|
|
313
313
|
"data-testid": "tree-view-search-input",
|
|
314
|
-
className: m(o.searchInput,
|
|
315
|
-
placeholder:
|
|
314
|
+
className: m(o.searchInput, P?.searchInput),
|
|
315
|
+
placeholder: ae,
|
|
316
316
|
value: W,
|
|
317
|
-
onChange: (e) =>
|
|
317
|
+
onChange: (e) => le(e.target.value),
|
|
318
318
|
"aria-label": R
|
|
319
319
|
})
|
|
320
|
-
}), l ?
|
|
320
|
+
}), l ? fe ? /* @__PURE__ */ h(a, {
|
|
321
321
|
items: Q,
|
|
322
322
|
itemHeight: te,
|
|
323
323
|
height: 400,
|
|
324
|
-
renderItem:
|
|
324
|
+
renderItem: me,
|
|
325
325
|
itemRole: "none",
|
|
326
326
|
role: "presentation"
|
|
327
|
-
}) : Q.map((e, t) =>
|
|
327
|
+
}) : Q.map((e, t) => me(e, t)) : s]
|
|
328
328
|
})
|
|
329
329
|
});
|
|
330
|
-
},
|
|
331
|
-
let { expandedValues: ee, selectedValues: f, checkedValues: p, indeterminateValues: _, focusedValue: te, toggleExpand: y, select: x, toggleCheck: S, setFocusedValue: C, containerRef:
|
|
332
|
-
if (!
|
|
330
|
+
}, E = ({ value: e, label: t, icon: a, children: l, className: u, disabled: d = !1 }) => {
|
|
331
|
+
let { expandedValues: ee, selectedValues: f, checkedValues: p, indeterminateValues: _, focusedValue: te, toggleExpand: y, select: x, toggleCheck: S, setFocusedValue: C, containerRef: ne, multiSelect: w, checkable: T, searchQuery: D } = v(), O = c.useId(), re = `wim-tree-view-item-checkbox-${O}`, k = `wim-tree-view-item-label-${O}`, A = b(t), ie = !D || A.toLowerCase().includes(D.toLowerCase()), j = c.useMemo(() => {
|
|
332
|
+
if (!D || !l) return !1;
|
|
333
333
|
let e = (t) => c.Children.toArray(t).some((t) => {
|
|
334
|
-
if (!c.isValidElement(t) || t.type !==
|
|
334
|
+
if (!c.isValidElement(t) || t.type !== E) return !1;
|
|
335
335
|
let n = t.props, r = n.label;
|
|
336
|
-
return b(r).toLowerCase().includes(
|
|
336
|
+
return b(r).toLowerCase().includes(D.toLowerCase()) ? !0 : n.children ? e(n.children) : !1;
|
|
337
337
|
});
|
|
338
338
|
return e(l);
|
|
339
|
-
}, [l,
|
|
340
|
-
return
|
|
341
|
-
className: m(o.item,
|
|
339
|
+
}, [l, D]), M = !!D && j, N = ee.includes(e) || M, P = f.includes(e), F = p.includes(e), I = _.includes(e), L = !!c.Children.count(l), { shouldRender: ae, isVisualExpanded: R, handleTransitionEnd: z } = s(N);
|
|
340
|
+
return D && !ie && !j ? null : /* @__PURE__ */ g("div", {
|
|
341
|
+
className: m(o.item, P && o.selected, d && o.disabled, u),
|
|
342
342
|
role: "treeitem",
|
|
343
|
-
"aria-expanded":
|
|
344
|
-
"aria-selected":
|
|
343
|
+
"aria-expanded": L ? N : void 0,
|
|
344
|
+
"aria-selected": P,
|
|
345
345
|
"aria-disabled": d,
|
|
346
346
|
"data-value": e,
|
|
347
347
|
onClick: (t) => {
|
|
348
|
-
t.stopPropagation(), C(e), d || (
|
|
348
|
+
t.stopPropagation(), C(e), d || (w && T ? S(e) : x(e));
|
|
349
349
|
},
|
|
350
350
|
onKeyDown: (t) => {
|
|
351
351
|
if (d) return;
|
|
352
352
|
t.key !== "Tab" && t.key !== "Escape" && t.stopPropagation();
|
|
353
|
-
let n = Array.from(
|
|
353
|
+
let n = Array.from(ne.current?.querySelectorAll("[role=\"treeitem\"]:not([aria-disabled=\"true\"])") || []), r = n.indexOf(t.currentTarget);
|
|
354
354
|
switch (t.key) {
|
|
355
355
|
case "Enter":
|
|
356
356
|
case " ":
|
|
357
|
-
t.preventDefault(), x(e),
|
|
357
|
+
t.preventDefault(), x(e), T && S(e);
|
|
358
358
|
break;
|
|
359
359
|
case "ArrowDown":
|
|
360
360
|
t.preventDefault(), r < n.length - 1 && n[r + 1].focus();
|
|
@@ -369,9 +369,9 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
369
369
|
t.preventDefault(), n.length > 0 && n[n.length - 1].focus();
|
|
370
370
|
break;
|
|
371
371
|
case "ArrowRight":
|
|
372
|
-
|
|
372
|
+
L && (N ? (t.preventDefault(), r < n.length - 1 && n[r + 1].focus()) : (t.preventDefault(), y(e)));
|
|
373
373
|
break;
|
|
374
|
-
case "ArrowLeft": if (
|
|
374
|
+
case "ArrowLeft": if (L && N) t.preventDefault(), y(e);
|
|
375
375
|
else {
|
|
376
376
|
t.preventDefault();
|
|
377
377
|
let e = t.currentTarget.parentElement?.closest("[role=\"treeitem\"]");
|
|
@@ -384,42 +384,42 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
384
384
|
},
|
|
385
385
|
tabIndex: te === e ? 0 : -1,
|
|
386
386
|
children: [/* @__PURE__ */ h(i, {
|
|
387
|
-
id:
|
|
387
|
+
id: k,
|
|
388
388
|
className: o.labelContainer,
|
|
389
|
-
active:
|
|
389
|
+
active: P,
|
|
390
390
|
disabled: d,
|
|
391
391
|
icon: /* @__PURE__ */ g("div", {
|
|
392
392
|
className: o.iconWrapper,
|
|
393
393
|
children: [
|
|
394
|
-
|
|
394
|
+
L && /* @__PURE__ */ h("button", {
|
|
395
395
|
type: "button",
|
|
396
|
-
className: m(o.expandBtn,
|
|
396
|
+
className: m(o.expandBtn, N && o.expanded),
|
|
397
397
|
onClick: (t) => {
|
|
398
|
-
t.stopPropagation(), !d &&
|
|
398
|
+
t.stopPropagation(), !d && L && y(e);
|
|
399
399
|
},
|
|
400
400
|
disabled: d,
|
|
401
|
-
"aria-label":
|
|
401
|
+
"aria-label": N ? `Collapse ${typeof t == "string" ? t : ""}` : `Expand ${typeof t == "string" ? t : ""}`,
|
|
402
402
|
tabIndex: -1,
|
|
403
403
|
children: /* @__PURE__ */ h(r, {
|
|
404
404
|
component: n,
|
|
405
405
|
size: "sm"
|
|
406
406
|
})
|
|
407
407
|
}),
|
|
408
|
-
!
|
|
409
|
-
|
|
410
|
-
id:
|
|
408
|
+
!L && /* @__PURE__ */ h("span", { className: o.spacer }),
|
|
409
|
+
T && /* @__PURE__ */ h("input", {
|
|
410
|
+
id: re,
|
|
411
411
|
type: "checkbox",
|
|
412
412
|
className: o.checkbox,
|
|
413
|
-
checked:
|
|
413
|
+
checked: F && !I,
|
|
414
414
|
ref: (e) => {
|
|
415
|
-
e && (e.indeterminate =
|
|
415
|
+
e && (e.indeterminate = I);
|
|
416
416
|
},
|
|
417
417
|
onChange: (t) => {
|
|
418
418
|
t.stopPropagation(), d || S(e);
|
|
419
419
|
},
|
|
420
420
|
disabled: d,
|
|
421
421
|
onClick: (e) => e.stopPropagation(),
|
|
422
|
-
"aria-labelledby":
|
|
422
|
+
"aria-labelledby": k,
|
|
423
423
|
tabIndex: -1
|
|
424
424
|
}),
|
|
425
425
|
a && /* @__PURE__ */ h("span", {
|
|
@@ -429,10 +429,10 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
429
429
|
]
|
|
430
430
|
}),
|
|
431
431
|
children: t
|
|
432
|
-
}),
|
|
433
|
-
className: m(o.children,
|
|
434
|
-
onTransitionEnd:
|
|
435
|
-
style: { gridTemplateRows:
|
|
432
|
+
}), L && ae && /* @__PURE__ */ h("div", {
|
|
433
|
+
className: m(o.children, R && o.expanded),
|
|
434
|
+
onTransitionEnd: z,
|
|
435
|
+
style: { gridTemplateRows: R ? "1fr" : "0fr" },
|
|
436
436
|
children: /* @__PURE__ */ h("div", {
|
|
437
437
|
className: o.childrenInner,
|
|
438
438
|
role: "group",
|
|
@@ -441,8 +441,8 @@ var E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable:
|
|
|
441
441
|
})]
|
|
442
442
|
});
|
|
443
443
|
};
|
|
444
|
-
|
|
445
|
-
var
|
|
446
|
-
|
|
444
|
+
T.displayName = "TreeView", E.displayName = "TreeView.Item";
|
|
445
|
+
var D = T;
|
|
446
|
+
D.Item = E;
|
|
447
447
|
//#endregion
|
|
448
|
-
export {
|
|
448
|
+
export { D as TreeView, D as default, E as TreeViewItem };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../_internal/FeedbackIcon.cjs"),n=require("../../_internal/FeedbackCloseButton.cjs"),r=require("./notification.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=({id:e,title:s,description:c,icon:l,intent:u=`default`,onClose:d,closable:f=!0,className:p})=>{let[
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../_internal/FeedbackIcon.cjs"),n=require("../../_internal/FeedbackCloseButton.cjs"),r=require("./notification.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=({id:e,title:s,description:c,icon:l,intent:u=`default`,onClose:d,closable:f=!0,className:p,"aria-label":m,"aria-labelledby":h})=>{let[g,_]=i.default.useState(!0);if(!g)return null;let v=()=>{_(!1),d&&d(e)},y=l!==void 0||u===`success`||u===`warning`||u===`danger`||u===`info`;return(0,o.jsx)(`div`,{className:(0,a.default)(`wim-notification`,r.default.root,r.default[u],p),role:`alert`,"aria-label":h?void 0:m,"aria-labelledby":h,children:(0,o.jsxs)(`div`,{className:r.default.content,children:[y&&(0,o.jsx)(`div`,{className:r.default.icon,children:(0,o.jsx)(t.FeedbackIcon,{intent:u,icon:l,size:`md`,tinted:!0})}),(0,o.jsxs)(`div`,{className:r.default.messageContainer,children:[(0,o.jsx)(`div`,{className:r.default.title,children:s}),c&&(0,o.jsx)(`div`,{className:r.default.description,children:c})]}),(0,o.jsx)(n.FeedbackCloseButton,{onClose:f?v:void 0,className:r.default.close,size:`sm`})]})})},c=(0,i.createContext)(void 0),l=({children:e,placement:t=`topRight`})=>{let[n,l]=(0,i.useState)([]),u=(0,i.useCallback)(e=>{let t=Math.random().toString(36).substr(2,9);l(n=>[...n,{...e,id:t}])},[]),d=(0,i.useCallback)(e=>{l(t=>t.filter(t=>t.id!==e))},[]);return(0,o.jsxs)(c.Provider,{value:{show:u,remove:d},children:[e,(0,o.jsx)(`div`,{className:(0,a.default)(r.default.container,r.default[t]),children:n.map(e=>(0,o.jsx)(s,{...e,onClose:()=>d(e.id)},e.id))})]})},u=()=>{let e=(0,i.useContext)(c);if(!e)throw Error(`useNotification must be used within a NotificationProvider`);return e};exports.Notification=s,exports.NotificationProvider=l,exports.useNotification=u;
|
|
@@ -35,8 +35,12 @@ export type NotificationProps = {
|
|
|
35
35
|
* Additional class name
|
|
36
36
|
*/
|
|
37
37
|
className?: string;
|
|
38
|
+
/** Accessible name for the notification. */
|
|
39
|
+
"aria-label"?: string;
|
|
40
|
+
/** ID of the element that labels the notification. Takes precedence over `aria-label`. */
|
|
41
|
+
"aria-labelledby"?: string;
|
|
38
42
|
};
|
|
39
|
-
export declare const Notification: ({ id, title, description, icon, intent, onClose, closable, className, }: NotificationProps) => React.JSX.Element | null;
|
|
43
|
+
export declare const Notification: ({ id, title, description, icon, intent, onClose, closable, className, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: NotificationProps) => React.JSX.Element | null;
|
|
40
44
|
type NotificationItem = Omit<NotificationProps, "onClose"> & {
|
|
41
45
|
id: string;
|
|
42
46
|
};
|
|
@@ -6,19 +6,21 @@ import r, { createContext as i, useCallback as a, useContext as o, useState as s
|
|
|
6
6
|
import c from "classnames";
|
|
7
7
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/feedback/Notification/Notification.tsx
|
|
9
|
-
var d = ({ id: i, title: a, description: o, icon: s, intent: d = "default", onClose: f, closable: p = !0, className: m }) => {
|
|
10
|
-
let [
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
},
|
|
9
|
+
var d = ({ id: i, title: a, description: o, icon: s, intent: d = "default", onClose: f, closable: p = !0, className: m, "aria-label": h, "aria-labelledby": g }) => {
|
|
10
|
+
let [_, v] = r.useState(!0);
|
|
11
|
+
if (!_) return null;
|
|
12
|
+
let y = () => {
|
|
13
|
+
v(!1), f && f(i);
|
|
14
|
+
}, b = s !== void 0 || d === "success" || d === "warning" || d === "danger" || d === "info";
|
|
15
15
|
return /* @__PURE__ */ l("div", {
|
|
16
16
|
className: c("wim-notification", n.root, n[d], m),
|
|
17
17
|
role: "alert",
|
|
18
|
+
"aria-label": g ? void 0 : h,
|
|
19
|
+
"aria-labelledby": g,
|
|
18
20
|
children: /* @__PURE__ */ u("div", {
|
|
19
21
|
className: n.content,
|
|
20
22
|
children: [
|
|
21
|
-
|
|
23
|
+
b && /* @__PURE__ */ l("div", {
|
|
22
24
|
className: n.icon,
|
|
23
25
|
children: /* @__PURE__ */ l(e, {
|
|
24
26
|
intent: d,
|
|
@@ -38,7 +40,7 @@ var d = ({ id: i, title: a, description: o, icon: s, intent: d = "default", onCl
|
|
|
38
40
|
})]
|
|
39
41
|
}),
|
|
40
42
|
/* @__PURE__ */ l(t, {
|
|
41
|
-
onClose: p ?
|
|
43
|
+
onClose: p ? y : void 0,
|
|
42
44
|
className: n.close,
|
|
43
45
|
size: "sm"
|
|
44
46
|
})
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../_internal/FeedbackIcon.cjs"),r=require("../../_internal/FeedbackCloseButton.cjs"),i=require("./toast.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=({id:e,title:c,description:l,intent:u=`default`,duration:d=3e3,open:f=!0,onClose:p,className:m})=>{let[
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../layout/Transition/Transition.cjs"),n=require("../../_internal/FeedbackIcon.cjs"),r=require("../../_internal/FeedbackCloseButton.cjs"),i=require("./toast.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=({id:e,title:c,description:l,intent:u=`default`,duration:d=3e3,open:f=!0,onClose:p,className:m,"aria-label":h,"aria-labelledby":g})=>{let[_,v]=(0,a.useState)(!0),y=(0,a.useCallback)(()=>{v(!1),p&&p(e)},[p,e]);return(0,a.useEffect)(()=>{if(f&&d>0&&_){let e=setTimeout(()=>{y()},d+300);return()=>clearTimeout(e)}},[f,d,e,p,_,y]),(0,s.jsxs)(t.Transition,{show:f&&_,enter:i.default.enter,enterFrom:i.default.enterFrom,enterTo:i.default.enterTo,leave:i.default.leave,leaveFrom:i.default.leaveFrom,leaveTo:i.default.leaveTo,className:(0,o.default)(`wim-toast`,i.default.root,i.default[u],m),role:`status`,"aria-live":`polite`,"aria-label":g?void 0:h,"aria-labelledby":g,children:[(u===`success`||u===`warning`||u===`danger`||u===`info`)&&(0,s.jsx)(`div`,{className:i.default.icon,children:(0,s.jsx)(n.FeedbackIcon,{intent:u,size:`sm`})}),(0,s.jsxs)(`div`,{className:i.default.content,children:[c&&(0,s.jsx)(`div`,{className:i.default.title,children:c}),l&&(0,s.jsx)(`p`,{className:i.default.description,children:l})]}),(0,s.jsx)(r.FeedbackCloseButton,{onClose:p?y:void 0,id:e,className:i.default.closeButton,size:`md`})]})},l=(0,a.createContext)(void 0),u=({children:e,position:t=`top-right`})=>{let[n,r]=(0,a.useState)([]),u=(0,a.useCallback)(e=>{let t=Math.random().toString(36).substr(2,9);r(n=>[...n,{...e,id:t}])},[]),d=(0,a.useCallback)(e=>{r(t=>t.filter(t=>t.id!==e))},[]);return(0,s.jsxs)(l.Provider,{value:{show:u,remove:d},children:[e,(0,s.jsx)(`div`,{className:(0,o.default)(i.default.container,i.default[t]),children:n.map(e=>(0,s.jsx)(c,{...e,onClose:()=>d(e.id)},e.id))})]})},d=()=>{let e=(0,a.useContext)(l);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e};exports.Toast=c,exports.ToastProvider=u,exports.useToast=d;
|
|
@@ -37,11 +37,15 @@ export type ToastProps = {
|
|
|
37
37
|
* Additional CSS class name.
|
|
38
38
|
*/
|
|
39
39
|
className?: string;
|
|
40
|
+
/** Accessible name for the toast. */
|
|
41
|
+
"aria-label"?: string;
|
|
42
|
+
/** ID of the element that labels the toast. Takes precedence over `aria-label`. */
|
|
43
|
+
"aria-labelledby"?: string;
|
|
40
44
|
};
|
|
41
45
|
/**
|
|
42
46
|
* Toast for communicating notifications and feedback to the user.
|
|
43
47
|
*/
|
|
44
|
-
export declare const Toast: ({ id, title, description, intent, duration, open, onClose, className, }: ToastProps) => React.JSX.Element;
|
|
48
|
+
export declare const Toast: ({ id, title, description, intent, duration, open, onClose, className, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: ToastProps) => React.JSX.Element;
|
|
45
49
|
type ToastItem = {
|
|
46
50
|
id: string;
|
|
47
51
|
title?: string;
|
|
@@ -7,14 +7,14 @@ import { createContext as i, useCallback as a, useContext as o, useEffect as s,
|
|
|
7
7
|
import l from "classnames";
|
|
8
8
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/feedback/Toast/Toast.tsx
|
|
10
|
-
var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m = 3e3, open: h = !0, onClose: g, className: _ }) => {
|
|
11
|
-
let [
|
|
12
|
-
|
|
10
|
+
var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m = 3e3, open: h = !0, onClose: g, className: _, "aria-label": v, "aria-labelledby": y }) => {
|
|
11
|
+
let [b, x] = c(!0), S = a(() => {
|
|
12
|
+
x(!1), g && g(i);
|
|
13
13
|
}, [g, i]);
|
|
14
14
|
return s(() => {
|
|
15
|
-
if (h && m > 0 &&
|
|
15
|
+
if (h && m > 0 && b) {
|
|
16
16
|
let e = setTimeout(() => {
|
|
17
|
-
|
|
17
|
+
S();
|
|
18
18
|
}, m + 300);
|
|
19
19
|
return () => clearTimeout(e);
|
|
20
20
|
}
|
|
@@ -23,10 +23,10 @@ var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m =
|
|
|
23
23
|
m,
|
|
24
24
|
i,
|
|
25
25
|
g,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
b,
|
|
27
|
+
S
|
|
28
28
|
]), /* @__PURE__ */ d(e, {
|
|
29
|
-
show: h &&
|
|
29
|
+
show: h && b,
|
|
30
30
|
enter: r.enter,
|
|
31
31
|
enterFrom: r.enterFrom,
|
|
32
32
|
enterTo: r.enterTo,
|
|
@@ -36,6 +36,8 @@ var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m =
|
|
|
36
36
|
className: l("wim-toast", r.root, r[p], _),
|
|
37
37
|
role: "status",
|
|
38
38
|
"aria-live": "polite",
|
|
39
|
+
"aria-label": y ? void 0 : v,
|
|
40
|
+
"aria-labelledby": y,
|
|
39
41
|
children: [
|
|
40
42
|
(p === "success" || p === "warning" || p === "danger" || p === "info") && /* @__PURE__ */ u("div", {
|
|
41
43
|
className: r.icon,
|
|
@@ -55,7 +57,7 @@ var f = ({ id: i, title: o, description: f, intent: p = "default", duration: m =
|
|
|
55
57
|
})]
|
|
56
58
|
}),
|
|
57
59
|
/* @__PURE__ */ u(n, {
|
|
58
|
-
onClose: g ?
|
|
60
|
+
onClose: g ? S : void 0,
|
|
59
61
|
id: i,
|
|
60
62
|
className: r.closeButton,
|
|
61
63
|
size: "md"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../../i18n/generated/components.cjs"),i=require("../Button/Button.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../FieldTemplate/FieldTemplate.cjs"),s=require("./signature-pad.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=({width:e=400,height:d=200,penColor:f=`var(--wim-color-text-primary)`,penWidth:p=2,onChange:m,clearLabel:h,disabled:g=!1,className:_,style:v,label:y,error:b,required:x,layout:S=`vertical`,canvasAriaLabel:C})=>{let{t:
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../../i18n/generated/components.cjs"),i=require("../Button/Button.cjs"),a=require("../../../i18n/generated/form.cjs"),o=require("../FieldTemplate/FieldTemplate.cjs"),s=require("./signature-pad.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=({width:e=400,height:d=200,penColor:f=`var(--wim-color-text-primary)`,penWidth:p=2,onChange:m,clearLabel:h,disabled:g=!1,className:_,style:v,label:y,error:b,required:x,layout:S=`vertical`,canvasAriaLabel:C,"aria-label":w,"aria-labelledby":T})=>{let{t:E}=t.useWimTranslation([n.commonNs,r.componentsNs,a.formNs]),D=h??E(`signature.clear`,{ns:`components`,defaultValue:E(`button.clear`)}),O=C??E(`a11y.signature_canvas`),k=(0,c.useRef)(null),A=(0,c.useRef)(!1),[j,M]=(0,c.useState)(!0),N=`wim-signature-pad-${(0,c.useId)()}`,P=y?`${N}-label`:void 0,F=b?`${N}-error`:void 0,I=(0,c.useCallback)(e=>{if(e.startsWith(`var(`)&&k.current){let t=e.match(/var\((--[^)]+)\)/)?.[1];if(t)return getComputedStyle(k.current).getPropertyValue(t).trim()||`#000`}return e},[]);(0,c.useLayoutEffect)(()=>{if(!k.current)return;let t=k.current,n=t.getContext(`2d`);if(!n)return;let r=window.devicePixelRatio||1;t.width=e*r,t.height=d*r,n.scale(r,r),n.lineCap=`round`,n.lineJoin=`round`},[e,d]);let L=(0,c.useCallback)(t=>{if(!k.current)return null;let n=k.current.getBoundingClientRect(),r,i;if(`touches`in t){if(t.touches.length===0)return null;r=t.touches[0].clientX,i=t.touches[0].clientY}else r=t.clientX,i=t.clientY;let a=r-n.left,o=i-n.top,s=e/n.width,c=d/n.height;return{x:a*s,y:o*c}},[e,d]),R=e=>{if(g)return;let t=L(e);if(!t||!k.current)return;let n=k.current.getContext(`2d`);n&&(A.current=!0,n.beginPath(),n.moveTo(t.x,t.y),n.strokeStyle=I(f),n.lineWidth=p)},z=e=>{if(!A.current||g||!k.current)return;let t=L(e);if(!t)return;let n=k.current.getContext(`2d`);n&&(n.lineTo(t.x,t.y),n.stroke(),M(!1))},B=()=>{if(A.current&&(A.current=!1,m&&k.current)){let e=k.current,t=e.getContext(`2d`);m(!t||t.getImageData(0,0,e.width,e.height).data.every((e,t)=>t%4!=3||e===0)?null:e.toDataURL())}},V=(0,c.useRef)(B);(0,c.useLayoutEffect)(()=>{V.current=B}),(0,c.useEffect)(()=>{let e=()=>V.current();return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[]);let H=(0,c.useRef)(!1);return(0,u.jsx)(o.FieldTemplate,{label:y,error:b,required:x,layout:S,labelId:P,errorId:F,className:_,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`wim-signature-pad`,s.default.root,g&&s.default.disabled,b&&s.default.danger),style:v,children:[(0,u.jsx)(`div`,{className:s.default.canvasContainer,style:{width:e,maxWidth:`100%`,aspectRatio:`${e} / ${d}`,height:`auto`},children:(0,u.jsx)(`canvas`,{ref:k,"data-testid":`signature-canvas`,className:s.default.canvas,style:{width:`100%`,height:`100%`,display:`block`},onMouseDown:R,onMouseMove:z,onMouseUp:B,onTouchStart:R,onTouchMove:z,onTouchEnd:B,"aria-labelledby":y?P:T,"aria-describedby":F,role:`img`,"aria-label":y||T?void 0:w??O})}),(0,u.jsx)(`div`,{className:s.default.footer,children:(0,u.jsx)(i.Button,{variant:`outline`,size:`sm`,"data-testid":`signature-clear`,onMouseDown:()=>{H.current=!0},onClick:()=>{if(!H.current||(H.current=!1,g||!k.current))return;let e=k.current,t=e.getContext(`2d`);t&&(t.clearRect(0,0,e.width,e.height),M(!0),m&&m(null))},disabled:g||j,children:D})})]})})};exports.SignaturePad=d;
|
|
@@ -28,8 +28,12 @@ export type SignaturePadProps = {
|
|
|
28
28
|
layout?: "vertical" | "horizontal";
|
|
29
29
|
/** Aria label for the canvas */
|
|
30
30
|
canvasAriaLabel?: string;
|
|
31
|
+
/** Accessible name for the canvas when no visible `label` is provided. Takes precedence over `canvasAriaLabel`. */
|
|
32
|
+
"aria-label"?: string;
|
|
33
|
+
/** ID of the element that labels the canvas when no visible `label` is provided. */
|
|
34
|
+
"aria-labelledby"?: string;
|
|
31
35
|
};
|
|
32
36
|
/**
|
|
33
37
|
* Component for entering a handwritten signature with mouse or touch.
|
|
34
38
|
*/
|
|
35
|
-
export declare const SignaturePad: ({ width, height, penColor, penWidth, onChange, clearLabel, disabled, className, style, label, error, required, layout, canvasAriaLabel, }: SignaturePadProps) => React.JSX.Element;
|
|
39
|
+
export declare const SignaturePad: ({ width, height, penColor, penWidth, onChange, clearLabel, disabled, className, style, label, error, required, layout, canvasAriaLabel, "aria-label": ariaLabelAttr, "aria-labelledby": ariaLabelledBy, }: SignaturePadProps) => React.JSX.Element;
|