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.
Files changed (34) hide show
  1. package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
  2. package/dist/components/ai/SourceCitation/SourceCitation.d.ts +5 -1
  3. package/dist/components/ai/SourceCitation/SourceCitation.js +10 -8
  4. package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
  5. package/dist/components/data-display/DataGrid/DataGrid.d.ts +5 -1
  6. package/dist/components/data-display/DataGrid/DataGrid.js +54 -53
  7. package/dist/components/data-display/FAQSection/FAQSection.cjs +1 -1
  8. package/dist/components/data-display/FAQSection/FAQSection.d.ts +5 -1
  9. package/dist/components/data-display/FAQSection/FAQSection.js +5 -3
  10. package/dist/components/data-display/TreeView/TreeView.cjs +1 -1
  11. package/dist/components/data-display/TreeView/TreeView.d.ts +5 -1
  12. package/dist/components/data-display/TreeView/TreeView.js +87 -87
  13. package/dist/components/feedback/Notification/Notification.cjs +1 -1
  14. package/dist/components/feedback/Notification/Notification.d.ts +5 -1
  15. package/dist/components/feedback/Notification/Notification.js +10 -8
  16. package/dist/components/feedback/Toast/Toast.cjs +1 -1
  17. package/dist/components/feedback/Toast/Toast.d.ts +5 -1
  18. package/dist/components/feedback/Toast/Toast.js +11 -9
  19. package/dist/components/form/SignaturePad/SignaturePad.cjs +1 -1
  20. package/dist/components/form/SignaturePad/SignaturePad.d.ts +5 -1
  21. package/dist/components/form/SignaturePad/SignaturePad.js +47 -47
  22. package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
  23. package/dist/components/navigation/CommandPalette/CommandPalette.d.ts +5 -1
  24. package/dist/components/navigation/CommandPalette/CommandPalette.js +11 -6
  25. package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
  26. package/dist/components/navigation/Pagination/Pagination.d.ts +5 -1
  27. package/dist/components/navigation/Pagination/Pagination.js +65 -63
  28. package/dist/components/overlay/Menu/Menu.cjs +1 -1
  29. package/dist/components/overlay/Menu/Menu.d.ts +4 -0
  30. package/dist/components/overlay/Menu/Menu.js +23 -21
  31. package/dist/llms-full.txt +19 -1
  32. package/dist/llms.txt +1 -1
  33. package/dist/wimui.umd.js +2 -2
  34. package/package.json +1 -1
@@ -52,17 +52,17 @@ function C(e, t) {
52
52
  }
53
53
  return null;
54
54
  }
55
- function w(e, t, n = []) {
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 = w(r.children, t, [...n, r.value]);
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 T(e, t) {
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 E = ({ children: s, nodes: l, className: d, multiSelect: v = !1, checkable: S = !1, checkStrategy: E = "cascade", searchable: D = !1, defaultExpandedValues: O = [], defaultSelectedValues: k = [], defaultCheckedValues: ne = [], onCheckedChange: A, onSelectedChange: j, width: re, virtualThreshold: M = y, labels: N = {}, labelId: P, styles: F }) => {
79
- let { t: I } = e(t), { searchPlaceholder: L, searchAriaLabel: R = I("treeview.search_aria"), expandLabel: z = (e) => I("treeview.expand", { label: e }), collapseLabel: B = (e) => I("treeview.collapse", { label: e }) } = N, [V, ie] = p(O), [H, ae] = p(k), [U, oe] = p(ne), [W, se] = p(""), [G, K] = p(k[0] || null), q = c.useRef(null), { indeterminateValues: J, effectiveCheckedSet: ce } = f(() => !l || E !== "cascade" ? {
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
- } : T(l, new Set(U)), [
82
+ } : w(l, new Set(U)), [
83
83
  l,
84
- E,
84
+ T,
85
85
  U
86
86
  ]), Y = u((e) => {
87
- ie((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
87
+ oe((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
88
88
  }, []), X = u((e) => {
89
- if (v) ae((t) => {
89
+ if (v) se((t) => {
90
90
  let n = t.includes(e) ? t.filter((t) => t !== e) : [...t, e];
91
- return j?.(n), n;
91
+ return A?.(n), n;
92
92
  });
93
93
  else {
94
94
  let t = [e];
95
- ae(t), j?.(t);
95
+ se(t), A?.(t);
96
96
  }
97
- }, [v, j]), Z = u((e) => {
98
- oe((t) => {
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], A?.(n), n;
101
- if (E === "cascade") {
102
- let { indeterminateValues: r } = T(l, new Set(t)), i = t.includes(e) && !r.includes(e), a = [e, ...C(l, e) ?? []];
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 } = T(l, new Set(n));
105
- A?.([...s].filter((e) => !o.includes(e)));
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 = w(l, e) ?? [], i = C(l, e) ?? [], a = /* @__PURE__ */ new Set([...r, ...i]);
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
- A?.(n);
112
+ k?.(n);
113
113
  }
114
114
  return n;
115
115
  });
116
116
  }, [
117
- E,
117
+ T,
118
118
  l,
119
- A
120
- ]), le = f(() => ({
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: E,
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
- E,
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
- ]), ue = !!l && Q.length >= M, $ = u((e) => {
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 de = u((e, t, n) => {
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
- ]), fe = u((e, t) => {
208
- let a = H.includes(e.value), s = ce.has(e.value), c = J.includes(e.value), l = V.includes(e.value), u = G === e.value, d = b(e.label);
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, F?.item),
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(), de(n, e, t);
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, F?.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, F?.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, F?.expandBtn),
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, F?.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, F?.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
- ce,
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
- de,
287
+ pe,
288
288
  z,
289
289
  B,
290
- F
290
+ P
291
291
  ]);
292
292
  return /* @__PURE__ */ h(_.Provider, {
293
- value: le,
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, F?.root),
297
+ className: m("wim-tree-view", o.root, !!l && o.dataDriven, d, P?.root),
298
298
  role: "tree",
299
- "aria-label": N.treeAriaLabel,
300
- "aria-labelledby": N.treeAriaLabel ? void 0 : P,
299
+ "aria-label": I ? void 0 : F ?? M.treeAriaLabel,
300
+ "aria-labelledby": I ?? (!F && !M.treeAriaLabel ? N : void 0),
301
301
  style: {
302
- width: re,
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: [D && /* @__PURE__ */ h("div", {
310
- className: m(o.search, F?.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, F?.searchInput),
315
- placeholder: L,
314
+ className: m(o.searchInput, P?.searchInput),
315
+ placeholder: ae,
316
316
  value: W,
317
- onChange: (e) => se(e.target.value),
317
+ onChange: (e) => le(e.target.value),
318
318
  "aria-label": R
319
319
  })
320
- }), l ? ue ? /* @__PURE__ */ h(a, {
320
+ }), l ? fe ? /* @__PURE__ */ h(a, {
321
321
  items: Q,
322
322
  itemHeight: te,
323
323
  height: 400,
324
- renderItem: fe,
324
+ renderItem: me,
325
325
  itemRole: "none",
326
326
  role: "presentation"
327
- }) : Q.map((e, t) => fe(e, t)) : s]
327
+ }) : Q.map((e, t) => me(e, t)) : s]
328
328
  })
329
329
  });
330
- }, D = ({ 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: w, multiSelect: T, checkable: E, searchQuery: O } = v(), k = c.useId(), ne = `wim-tree-view-item-checkbox-${k}`, A = `wim-tree-view-item-label-${k}`, j = b(t), re = !O || j.toLowerCase().includes(O.toLowerCase()), M = c.useMemo(() => {
332
- if (!O || !l) return !1;
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 !== D) return !1;
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(O.toLowerCase()) ? !0 : n.children ? e(n.children) : !1;
336
+ return b(r).toLowerCase().includes(D.toLowerCase()) ? !0 : n.children ? e(n.children) : !1;
337
337
  });
338
338
  return e(l);
339
- }, [l, O]), N = !!O && M, P = ee.includes(e) || N, F = f.includes(e), I = p.includes(e), L = _.includes(e), R = !!c.Children.count(l), { shouldRender: z, isVisualExpanded: B, handleTransitionEnd: V } = s(P);
340
- return O && !re && !M ? null : /* @__PURE__ */ g("div", {
341
- className: m(o.item, F && o.selected, d && o.disabled, u),
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": R ? P : void 0,
344
- "aria-selected": F,
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 || (T && E ? S(e) : x(e));
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(w.current?.querySelectorAll("[role=\"treeitem\"]:not([aria-disabled=\"true\"])") || []), r = n.indexOf(t.currentTarget);
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), E && S(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
- R && (P ? (t.preventDefault(), r < n.length - 1 && n[r + 1].focus()) : (t.preventDefault(), y(e)));
372
+ L && (N ? (t.preventDefault(), r < n.length - 1 && n[r + 1].focus()) : (t.preventDefault(), y(e)));
373
373
  break;
374
- case "ArrowLeft": if (R && P) t.preventDefault(), y(e);
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: A,
387
+ id: k,
388
388
  className: o.labelContainer,
389
- active: F,
389
+ active: P,
390
390
  disabled: d,
391
391
  icon: /* @__PURE__ */ g("div", {
392
392
  className: o.iconWrapper,
393
393
  children: [
394
- R && /* @__PURE__ */ h("button", {
394
+ L && /* @__PURE__ */ h("button", {
395
395
  type: "button",
396
- className: m(o.expandBtn, P && o.expanded),
396
+ className: m(o.expandBtn, N && o.expanded),
397
397
  onClick: (t) => {
398
- t.stopPropagation(), !d && R && y(e);
398
+ t.stopPropagation(), !d && L && y(e);
399
399
  },
400
400
  disabled: d,
401
- "aria-label": P ? `Collapse ${typeof t == "string" ? t : ""}` : `Expand ${typeof t == "string" ? t : ""}`,
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
- !R && /* @__PURE__ */ h("span", { className: o.spacer }),
409
- E && /* @__PURE__ */ h("input", {
410
- id: ne,
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: I && !L,
413
+ checked: F && !I,
414
414
  ref: (e) => {
415
- e && (e.indeterminate = L);
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": A,
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
- }), R && z && /* @__PURE__ */ h("div", {
433
- className: m(o.children, B && o.expanded),
434
- onTransitionEnd: V,
435
- style: { gridTemplateRows: B ? "1fr" : "0fr" },
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
- E.displayName = "TreeView", D.displayName = "TreeView.Item";
445
- var O = E;
446
- O.Item = D;
444
+ T.displayName = "TreeView", E.displayName = "TreeView.Item";
445
+ var D = T;
446
+ D.Item = E;
447
447
  //#endregion
448
- export { O as TreeView, O as default, D as TreeViewItem };
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[m,h]=i.default.useState(!0);if(!m)return null;let g=()=>{h(!1),d&&d(e)},_=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`,children:(0,o.jsxs)(`div`,{className:r.default.content,children:[_&&(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?g: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;
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 [h, g] = r.useState(!0);
11
- if (!h) return null;
12
- let _ = () => {
13
- g(!1), f && f(i);
14
- }, v = s !== void 0 || d === "success" || d === "warning" || d === "danger" || d === "info";
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
- v && /* @__PURE__ */ l("div", {
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 ? _ : void 0,
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[h,g]=(0,a.useState)(!0),_=(0,a.useCallback)(()=>{g(!1),p&&p(e)},[p,e]);return(0,a.useEffect)(()=>{if(f&&d>0&&h){let e=setTimeout(()=>{_()},d+300);return()=>clearTimeout(e)}},[f,d,e,p,h,_]),(0,s.jsxs)(t.Transition,{show:f&&h,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`,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?_: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;
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 [v, y] = c(!0), b = a(() => {
12
- y(!1), g && g(i);
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 && v) {
15
+ if (h && m > 0 && b) {
16
16
  let e = setTimeout(() => {
17
- b();
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
- v,
27
- b
26
+ b,
27
+ S
28
28
  ]), /* @__PURE__ */ d(e, {
29
- show: h && v,
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 ? b : void 0,
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:w}=t.useWimTranslation([n.commonNs,r.componentsNs,a.formNs]),T=h??w(`signature.clear`,{ns:`components`,defaultValue:w(`button.clear`)}),E=C??w(`a11y.signature_canvas`),D=(0,c.useRef)(null),O=(0,c.useRef)(!1),[k,A]=(0,c.useState)(!0),j=`wim-signature-pad-${(0,c.useId)()}`,M=y?`${j}-label`:void 0,N=b?`${j}-error`:void 0,P=(0,c.useCallback)(e=>{if(e.startsWith(`var(`)&&D.current){let t=e.match(/var\((--[^)]+)\)/)?.[1];if(t)return getComputedStyle(D.current).getPropertyValue(t).trim()||`#000`}return e},[]);(0,c.useLayoutEffect)(()=>{if(!D.current)return;let t=D.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 F=(0,c.useCallback)(t=>{if(!D.current)return null;let n=D.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]),I=e=>{if(g)return;let t=F(e);if(!t||!D.current)return;let n=D.current.getContext(`2d`);n&&(O.current=!0,n.beginPath(),n.moveTo(t.x,t.y),n.strokeStyle=P(f),n.lineWidth=p)},L=e=>{if(!O.current||g||!D.current)return;let t=F(e);if(!t)return;let n=D.current.getContext(`2d`);n&&(n.lineTo(t.x,t.y),n.stroke(),A(!1))},R=()=>{if(O.current&&(O.current=!1,m&&D.current)){let e=D.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())}},z=(0,c.useRef)(R);(0,c.useLayoutEffect)(()=>{z.current=R}),(0,c.useEffect)(()=>{let e=()=>z.current();return window.addEventListener(`mouseup`,e),()=>window.removeEventListener(`mouseup`,e)},[]);let B=(0,c.useRef)(!1);return(0,u.jsx)(o.FieldTemplate,{label:y,error:b,required:x,layout:S,labelId:M,errorId:N,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:D,"data-testid":`signature-canvas`,className:s.default.canvas,style:{width:`100%`,height:`100%`,display:`block`},onMouseDown:I,onMouseMove:L,onMouseUp:R,onTouchStart:I,onTouchMove:L,onTouchEnd:R,"aria-labelledby":y?M:void 0,"aria-describedby":N,role:`img`,"aria-label":y?void 0:E})}),(0,u.jsx)(`div`,{className:s.default.footer,children:(0,u.jsx)(i.Button,{variant:`outline`,size:`sm`,"data-testid":`signature-clear`,onMouseDown:()=>{B.current=!0},onClick:()=>{if(!B.current||(B.current=!1,g||!D.current))return;let e=D.current,t=e.getContext(`2d`);t&&(t.clearRect(0,0,e.width,e.height),A(!0),m&&m(null))},disabled:g||k,children:T})})]})})};exports.SignaturePad=d;
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;