@wirecore/wirelayer-react 0.4.0 → 0.6.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 (76) hide show
  1. package/README.md +3 -1
  2. package/dist/Button-Cd7lufvJ.js +60 -0
  3. package/dist/{ContextMenu-qh-bB9Lw.js → ContextMenu-CjDI7Jy5.js} +459 -451
  4. package/dist/{Field-hc416yJx.js → Field-DkYxlVar.js} +5 -2
  5. package/dist/{Highlight-DdTridk2.js → Highlight-CX30-nP7.js} +22 -18
  6. package/dist/{Input-OPRvjIYt.js → Input-D8U-Auys.js} +20 -19
  7. package/dist/{InputStatus-DS38XEkX.js → InputStatus-hVzkU_4q.js} +4 -1
  8. package/dist/{PasswordInput-B9k0GuSx.js → PasswordInput-DivSjtN8.js} +1 -1
  9. package/dist/{Select-PbxrUYi1.js → Select-Cx3KwSzU.js} +84 -83
  10. package/dist/{Tree-eqv4DIQn.js → Tree-BiPIkmwT.js} +2 -2
  11. package/dist/chart/Chart.d.ts +11 -5
  12. package/dist/chart/Chart.d.ts.map +1 -1
  13. package/dist/chart/index.d.ts +2 -0
  14. package/dist/chart/index.d.ts.map +1 -1
  15. package/dist/chart.js +43 -36
  16. package/dist/code.js +1 -1
  17. package/dist/components/Avatar/Avatar.d.ts +1 -0
  18. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  19. package/dist/components/Badge/Badge.d.ts +3 -1
  20. package/dist/components/Badge/Badge.d.ts.map +1 -1
  21. package/dist/components/Button/Button.d.ts +6 -1
  22. package/dist/components/Button/Button.d.ts.map +1 -1
  23. package/dist/components/ChipGroup/ChipGroup.d.ts +1 -1
  24. package/dist/components/ChipGroup/ChipGroup.d.ts.map +1 -1
  25. package/dist/components/Combobox/Combobox.d.ts +7 -2
  26. package/dist/components/Combobox/Combobox.d.ts.map +1 -1
  27. package/dist/components/DatePicker/DatePicker.d.ts +2 -0
  28. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  29. package/dist/components/DatePicker/DatePickerBase.d.ts +3 -1
  30. package/dist/components/DatePicker/DatePickerBase.d.ts.map +1 -1
  31. package/dist/components/DateRangePicker/DateRangePicker.d.ts +2 -0
  32. package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  33. package/dist/components/Dialog/Dialog.d.ts +5 -1
  34. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  35. package/dist/components/Field/context.d.ts +3 -1
  36. package/dist/components/Field/context.d.ts.map +1 -1
  37. package/dist/components/FileUpload/FileUpload.d.ts +9 -2
  38. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  39. package/dist/components/IconButton/IconButton.d.ts +3 -1
  40. package/dist/components/IconButton/IconButton.d.ts.map +1 -1
  41. package/dist/components/MonthPicker/MonthPicker.d.ts +2 -0
  42. package/dist/components/MonthPicker/MonthPicker.d.ts.map +1 -1
  43. package/dist/components/MultiSelect/MultiSelect.d.ts +7 -2
  44. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  45. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  46. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  47. package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -3
  48. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  49. package/dist/components/Select/Select.d.ts +9 -2
  50. package/dist/components/Select/Select.d.ts.map +1 -1
  51. package/dist/components/Toast/Toaster.d.ts +10 -2
  52. package/dist/components/Toast/Toaster.d.ts.map +1 -1
  53. package/dist/components/ToggleButton/ToggleButton.d.ts +7 -1
  54. package/dist/components/ToggleButton/ToggleButton.d.ts.map +1 -1
  55. package/dist/components/YearPicker/YearPicker.d.ts +2 -0
  56. package/dist/components/YearPicker/YearPicker.d.ts.map +1 -1
  57. package/dist/data-table/DataTable.d.ts +20 -2
  58. package/dist/data-table/DataTable.d.ts.map +1 -1
  59. package/dist/data-table/FilterMenu.d.ts +7 -1
  60. package/dist/data-table/FilterMenu.d.ts.map +1 -1
  61. package/dist/data-table/ValueInput.d.ts +8 -1
  62. package/dist/data-table/ValueInput.d.ts.map +1 -1
  63. package/dist/data-table/index.d.ts +1 -1
  64. package/dist/data-table/index.d.ts.map +1 -1
  65. package/dist/data-table/types.d.ts +29 -1
  66. package/dist/data-table/types.d.ts.map +1 -1
  67. package/dist/data-table.js +1214 -1139
  68. package/dist/editor.js +1 -1
  69. package/dist/form.js +3 -3
  70. package/dist/index.js +2606 -2578
  71. package/dist/pdf.js +5 -5
  72. package/dist/virtual.js +2 -2
  73. package/llms-full.txt +6239 -0
  74. package/llms.txt +311 -0
  75. package/package.json +6 -4
  76. package/dist/Button-DFVVqBuY.js +0 -58
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
- import { n } from "./InputStatus-DS38XEkX.js";
3
+ import { n } from "./InputStatus-hVzkU_4q.js";
4
4
  import { field as r, toggletip as i } from "@wirecore/wirelayer-recipes";
5
5
  import { CircleCheck as a, Info as o } from "lucide-react";
6
6
  import { useEffect as s, useRef as c, useState as l } from "react";
@@ -63,7 +63,10 @@ function m({ classes: i, label: o, helperText: s, error: c, invalid: l = !1, suc
63
63
  ]
64
64
  });
65
65
  return /* @__PURE__ */ u(n.Provider, {
66
- value: { success: O },
66
+ value: {
67
+ success: O,
68
+ labelled: !!o
69
+ },
67
70
  children: /* @__PURE__ */ d(f.Root, {
68
71
  ...C,
69
72
  className: E.base({ class: x }),
@@ -89,24 +89,26 @@ function D({ items: t, source: n, accessors: r, pageSize: i, minSearchLength: a
89
89
  source: n,
90
90
  pageSize: i,
91
91
  minSearchLength: a
92
- }), { itemValue: c, itemLabel: l, itemDisabled: u, itemGroup: d, valueKey: p } = r, m = _(() => f(s.resolved, {
92
+ }), { itemValue: c, itemLabel: l, itemDisabled: u, itemGroup: d, itemKeywords: p, valueKey: m } = r, h = _(() => f(s.resolved, {
93
93
  itemValue: c,
94
94
  itemLabel: l,
95
95
  itemDisabled: u,
96
96
  itemGroup: d,
97
- valueKey: p
97
+ itemKeywords: p,
98
+ valueKey: m
98
99
  }), [
99
100
  s.resolved,
100
101
  c,
101
102
  l,
102
103
  u,
103
104
  d,
104
- p
105
- ]), h = o.dataSource;
105
+ p,
106
+ m
107
+ ]), g = o.dataSource;
106
108
  return {
107
109
  ...s,
108
110
  items: s.active ? s.state.items : t,
109
- resolvedOptions: m,
111
+ resolvedOptions: h,
110
112
  resolve(e, t) {
111
113
  if (!s.active) return;
112
114
  let n = new Set(t.map((e) => e.key));
@@ -114,7 +116,7 @@ function D({ items: t, source: n, accessors: r, pageSize: i, minSearchLength: a
114
116
  },
115
117
  loading: s.active && s.state.status === "loading",
116
118
  hasMore: s.active && s.state.hasMore,
117
- emptyText: s.active ? s.state.tooShort ? h.minSearch(a ?? 0) : s.state.status === "error" ? h.error : void 0 : void 0
119
+ emptyText: s.active ? s.state.tooShort ? g.minSearch(a ?? 0) : s.state.status === "error" ? g.error : void 0 : void 0
118
120
  };
119
121
  }
120
122
  //#endregion
@@ -123,34 +125,36 @@ function O(e, t, n = "") {
123
125
  let { contains: r } = b({
124
126
  sensitivity: "base",
125
127
  usage: "sort"
126
- }), { itemValue: i, itemLabel: s, itemDisabled: c, itemGroup: l, valueKey: u } = t, d = _(() => f(e, {
128
+ }), { itemValue: i, itemLabel: s, itemDisabled: c, itemGroup: l, itemKeywords: u, valueKey: d } = t, p = _(() => f(e, {
127
129
  itemValue: i,
128
130
  itemLabel: s,
129
131
  itemDisabled: c,
130
132
  itemGroup: l,
131
- valueKey: u
133
+ itemKeywords: u,
134
+ valueKey: d
132
135
  }), [
133
136
  e,
134
137
  i,
135
138
  s,
136
139
  c,
137
140
  l,
138
- u
139
- ]), p = _(() => a(d, n, r), [
140
- d,
141
+ u,
142
+ d
143
+ ]), m = _(() => a(p, n, r), [
144
+ p,
141
145
  n,
142
146
  r
143
- ]), m = _(() => o(p), [p]);
147
+ ]), h = _(() => o(m), [m]);
144
148
  return {
145
- options: d,
146
- visible: p,
147
- groups: m,
148
- ordered: _(() => m.flatMap((e) => e.options), [m]),
149
- firstFor: (e) => o(a(d, e, r)).flatMap((e) => e.options).find((e) => !e.disabled)
149
+ options: p,
150
+ visible: m,
151
+ groups: h,
152
+ ordered: _(() => h.flatMap((e) => e.options), [h]),
153
+ firstFor: (e) => o(a(p, e, r)).flatMap((e) => e.options).find((e) => !e.disabled)
150
154
  };
151
155
  }
152
156
  function k({ multiple: e, value: t, defaultValue: n, accessors: r, items: i, onChange: a }) {
153
- let [o, s] = y(n ?? (e ? [] : null)), [c, f] = y([]), p = t === void 0 ? o : t, m = u(e ? p ?? [] : d(p), l(i, c), r), h = m.map((e) => e.key);
157
+ let [o, s] = y(n ?? (e ? [] : null)), [c, f] = y([]), p = t === void 0 ? o : t, m = u(e ? p ?? [] : d(p, i), l(i, c), r), h = m.map((e) => e.key);
154
158
  function g(t) {
155
159
  f(t);
156
160
  let n = t.map((e) => e.value), r = e ? n : n[0] ?? null;
@@ -1,34 +1,35 @@
1
1
  "use client";
2
2
  import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
- import { r as n, t as r } from "./InputStatus-DS38XEkX.js";
3
+ import { r as n, t as r } from "./InputStatus-hVzkU_4q.js";
4
4
  import { buttonColorKey as i, formatCount as a, iconButton as o, input as s, setTextControlValue as c } from "@wirecore/wirelayer-recipes";
5
5
  import { CircleAlert as l } from "lucide-react";
6
6
  import { useId as u, useRef as d, useState as f } from "react";
7
7
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
8
8
  import { Field as h, useFieldContext as g } from "@ark-ui/react/field";
9
9
  //#region src/components/IconButton/IconButton.tsx
10
- function _({ classes: e, icon: n, label: r, variant: s, color: c, size: l, shape: u, disabled: d = !1, type: f = "button", badge: h = !1, badgeLabel: g = (e) => e === null ? "new" : `${e} new`, className: _, ...v }) {
11
- let y = t("iconButton", o, e)({
12
- variant: s,
13
- color: i(c),
14
- size: l,
15
- shape: u
16
- }), b = typeof h == "number" && h > 0 ? h : 0, x = b ? `${r}, ${g(a(b))}` : h === !0 ? `${r}, ${g(null)}` : r;
10
+ function _({ classes: e, icon: n, iconProps: r, label: s, variant: c, color: l, size: u, shape: d, disabled: f = !1, type: h = "button", badge: g = !1, badgeLabel: _ = (e) => e === null ? "new" : `${e} new`, className: v, ...y }) {
11
+ let b = t("iconButton", o, e)({
12
+ variant: c,
13
+ color: i(l),
14
+ size: u,
15
+ shape: d
16
+ }), x = typeof g == "number" && g > 0 ? g : 0, S = x ? `${s}, ${_(a(x))}` : g === !0 ? `${s}, ${_(null)}` : s;
17
17
  return /* @__PURE__ */ m("button", {
18
- ...v,
19
- className: y.base({ class: _ }),
20
- type: f,
21
- disabled: d,
22
- "aria-label": x,
18
+ ...y,
19
+ className: b.base({ class: v }),
20
+ type: h,
21
+ disabled: f,
22
+ "aria-label": S,
23
23
  children: [/* @__PURE__ */ p(n, {
24
- className: y.icon(),
24
+ ...r,
25
+ className: b.icon(),
25
26
  "aria-hidden": "true"
26
- }), b ? /* @__PURE__ */ p("span", {
27
- className: y.badge(),
27
+ }), x ? /* @__PURE__ */ p("span", {
28
+ className: b.badge(),
28
29
  "aria-hidden": "true",
29
- children: a(b)
30
- }) : h === !0 && /* @__PURE__ */ p("span", {
31
- className: y.dot(),
30
+ children: a(x)
31
+ }) : g === !0 && /* @__PURE__ */ p("span", {
32
+ className: b.dot(),
32
33
  "aria-hidden": "true"
33
34
  })]
34
35
  });
@@ -3,7 +3,10 @@ import { CircleAlert as e, CircleCheck as t, LoaderCircle as n, X as r } from "l
3
3
  import { createContext as i, useContext as a } from "react";
4
4
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
5
5
  //#region src/components/Field/context.ts
6
- var l = i({ success: !1 }), u = () => a(l);
6
+ var l = i({
7
+ success: !1,
8
+ labelled: !1
9
+ }), u = () => a(l);
7
10
  //#endregion
8
11
  //#region src/components/Input/InputStatus.tsx
9
12
  function d({ loading: i, clear: a, clearLabel: l, onClear: u, invalid: d, success: f, invalidIcon: p, classes: m }) {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
- import { r as n, t as r } from "./InputStatus-DS38XEkX.js";
3
+ import { r as n, t as r } from "./InputStatus-hVzkU_4q.js";
4
4
  import { checkPasswordRequirements as i, clampDialogOffset as a, closeTab as o, dialog as s, dialogMoveForKey as c, dialogMoveKeys as l, passwordInput as u, passwordStrength as d, scrollEdges as f, setTextControlValue as p, tabs as m } from "@wirecore/wirelayer-recipes";
5
5
  import { Check as h, ChevronLeft as g, ChevronRight as _, Circle as v, Eye as y, EyeOff as b, Maximize2 as x, Minimize2 as S, X as C } from "lucide-react";
6
6
  import { createContext as w, useContext as T, useEffect as E, useId as D, useRef as O, useState as k } from "react";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
- import { a as n, c as r, n as i, o as a } from "./Highlight-DdTridk2.js";
3
+ import { a as n, c as r, n as i, o as a } from "./Highlight-CX30-nP7.js";
4
4
  import { select as o, spinner as s } from "@wirecore/wirelayer-recipes";
5
5
  import { ChevronDown as c, LoaderCircle as l, X as u } from "lucide-react";
6
6
  import { useEffect as d, useId as f, useMemo as p, useState as ee } from "react";
@@ -60,84 +60,85 @@ function y({ classes: n, size: r, label: i, value: a, className: o, ...c }) {
60
60
  }
61
61
  //#endregion
62
62
  //#region src/components/Select/Select.tsx
63
- function b({ classes: s, items: v, value: y, defaultValue: b, onValueChange: re, placeholder: ie, disabled: ae, invalid: x, required: S, name: oe, itemValue: se, itemLabel: ce, itemDisabled: le, itemGroup: ue, valueKey: de, clearable: C, loading: w, loadingText: fe, size: pe, filter: T, manualFilter: E, onFilterChange: D, emptyText: me, hasMore: he, onLoadMore: ge, dataSource: O, minSearchLength: _e, pageSize: ve, standalone: ye, renderItem: k, renderValue: A, className: j, style: M, onKeyDown: N, ...P }) {
64
- let F = t("select", o, s)({
65
- size: pe,
63
+ function b({ classes: s, items: v, value: y, defaultValue: b, onValueChange: re, placeholder: x, disabled: ie, invalid: ae, required: oe, name: se, itemValue: ce, itemLabel: le, itemDisabled: S, itemGroup: ue, itemKeywords: de, valueKey: fe, clearable: C, loading: w, loadingText: pe, size: me, filter: T, manualFilter: E, onFilterChange: D, emptyText: he, hasMore: ge, onLoadMore: _e, dataSource: O, minSearchLength: ve, pageSize: ye, standalone: k, renderItem: A, renderValue: j, className: M, style: N, onKeyDown: P, ...F }) {
64
+ let I = t("select", o, s)({
65
+ size: me,
66
66
  clearable: C
67
- }), I = e(), L = I.select, R = {
68
- itemValue: se,
69
- itemLabel: ce,
70
- itemDisabled: le,
67
+ }), L = e(), R = L.select, z = {
68
+ itemValue: ce,
69
+ itemLabel: le,
70
+ itemDisabled: S,
71
71
  itemGroup: ue,
72
- valueKey: de
73
- }, [z, B] = ee(""), V = r({
72
+ itemKeywords: de,
73
+ valueKey: fe
74
+ }, [B, V] = ee(""), H = r({
74
75
  items: v,
75
76
  source: O,
76
- accessors: R,
77
- pageSize: ve,
78
- minSearchLength: _e
79
- }), { options: H, groups: be, ordered: U, firstFor: xe } = n(V.items, R, T && !E && !O ? z : ""), W = p(() => [...H, ...V.resolvedOptions], [H, V.resolvedOptions]), { selected: G, keys: K, commit: q, commitKeys: Se } = a({
77
+ accessors: z,
78
+ pageSize: ye,
79
+ minSearchLength: ve
80
+ }), { options: U, groups: be, ordered: W, firstFor: xe } = n(H.items, z, T && !E && !O ? B : ""), G = p(() => [...U, ...H.resolvedOptions], [U, H.resolvedOptions]), { selected: K, keys: q, commit: J, commitKeys: Se } = a({
80
81
  multiple: !1,
81
82
  value: y,
82
83
  defaultValue: b,
83
- accessors: R,
84
- items: W,
84
+ accessors: z,
85
+ items: G,
85
86
  onChange: re
86
- }), Ce = K.join("\0");
87
+ }), Ce = q.join("\0");
87
88
  d(() => {
88
- V.resolve(K, W);
89
+ H.resolve(q, G);
89
90
  }, [Ce, O]);
90
- let J = w || V.loading, Y = G[0], X = p(() => ne({
91
- items: U,
91
+ let Y = w || H.loading, X = K[0], we = p(() => ne({
92
+ items: W,
92
93
  itemToString: (e) => e.label,
93
94
  itemToValue: (e) => e.key,
94
95
  isItemDisabled: (e) => e.disabled
95
- }), [U]), Z = f(), Q = Y?.icon, we = {
96
- item: F.item(),
97
- itemText: F.itemText(),
98
- icon: F.icon(),
99
- itemIndicator: F.itemIndicator(),
100
- itemBody: F.itemBody(),
101
- itemDescription: F.itemDescription(),
102
- group: F.group(),
103
- groupLabel: F.groupLabel(),
104
- loading: F.loading(),
105
- loadingIcon: F.loadingIcon(),
106
- sentinel: F.sentinel(),
107
- empty: F.empty()
96
+ }), [W]), Z = f(), Q = X?.icon, Te = {
97
+ item: I.item(),
98
+ itemText: I.itemText(),
99
+ icon: I.icon(),
100
+ itemIndicator: I.itemIndicator(),
101
+ itemBody: I.itemBody(),
102
+ itemDescription: I.itemDescription(),
103
+ group: I.group(),
104
+ groupLabel: I.groupLabel(),
105
+ loading: I.loading(),
106
+ loadingIcon: I.loadingIcon(),
107
+ sentinel: I.sentinel(),
108
+ empty: I.empty()
108
109
  }, $ = /* @__PURE__ */ h(i, {
109
110
  parts: _,
110
111
  groups: be,
111
- classes: we,
112
- loading: J,
113
- loadingText: fe ?? I.common.loading,
114
- hasMore: he || V.hasMore,
115
- onLoadMore: () => O ? V.loadMore() : ge?.(),
116
- emptyText: me ?? V.emptyText ?? (z ? I.common.noResults : I.common.empty),
117
- renderItem: k
112
+ classes: Te,
113
+ loading: Y,
114
+ loadingText: pe ?? L.common.loading,
115
+ hasMore: ge || H.hasMore,
116
+ onLoadMore: () => O ? H.loadMore() : _e?.(),
117
+ emptyText: he ?? H.emptyText ?? (B ? L.common.noResults : L.common.empty),
118
+ renderItem: A
118
119
  });
119
- function Te(e) {
120
- N?.(e), C && G.length && (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), q([]));
120
+ function Ee(e) {
121
+ P?.(e), C && K.length && (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), J([]));
121
122
  }
122
- function Ee(e, t) {
123
- B(t), D?.(t), O && V.search(t);
123
+ function De(e, t) {
124
+ V(t), D?.(t), O && H.search(t);
124
125
  let n = E || O ? void 0 : xe(t);
125
126
  n && requestAnimationFrame(() => e.setHighlightValue(n.key));
126
127
  }
127
128
  return /* @__PURE__ */ g(_.Root, {
128
- className: F.base({ class: j }),
129
- style: M,
130
- collection: X,
131
- value: K,
129
+ className: I.base({ class: M }),
130
+ style: N,
131
+ collection: we,
132
+ value: q,
132
133
  onValueChange: (e) => Se(e.value, e.items),
133
134
  onOpenChange: (e) => {
134
- e.open && V.open(), !e.open && z && (B(""), D?.(""), O && V.search(""));
135
+ e.open && H.open(), !e.open && B && (V(""), D?.(""), O && H.search(""));
135
136
  },
136
- disabled: ae,
137
- invalid: x,
138
- required: S,
139
- name: oe,
140
- ...ye ? { ids: {} } : {},
137
+ disabled: ie,
138
+ invalid: ae,
139
+ required: oe,
140
+ name: se,
141
+ ...k ? { ids: {} } : {},
141
142
  positioning: {
142
143
  sameWidth: !0,
143
144
  gutter: 4
@@ -147,51 +148,51 @@ function b({ classes: s, items: v, value: y, defaultValue: b, onValueChange: re,
147
148
  unmountOnExit: !0,
148
149
  children: [
149
150
  /* @__PURE__ */ g(_.Control, {
150
- ...C ? { className: F.control() } : {},
151
+ ...C ? { className: I.control() } : {},
151
152
  children: [/* @__PURE__ */ g(_.Trigger, {
152
- ...P,
153
- className: F.trigger(),
153
+ ...F,
154
+ className: I.trigger(),
154
155
  "aria-busy": w || void 0,
155
- onKeyDown: Te,
156
+ onKeyDown: Ee,
156
157
  children: [/* @__PURE__ */ h("span", {
157
- className: F.value(),
158
- children: A && Y ? A(Y.item) : /* @__PURE__ */ g(m, { children: [Q && /* @__PURE__ */ h(Q, {
159
- className: F.icon(),
158
+ className: I.value(),
159
+ children: j && X ? j(X.item) : /* @__PURE__ */ g(m, { children: [Q && /* @__PURE__ */ h(Q, {
160
+ className: I.icon(),
160
161
  "aria-hidden": "true"
161
162
  }), /* @__PURE__ */ h(_.ValueText, {
162
- placeholder: ie ?? I.common.placeholder,
163
- children: Y?.label || void 0
163
+ placeholder: x ?? L.common.placeholder,
164
+ children: X?.label || void 0
164
165
  })] })
165
166
  }), /* @__PURE__ */ h(_.Indicator, {
166
- className: F.indicator(),
167
+ className: I.indicator(),
167
168
  children: w ? /* @__PURE__ */ h(l, {
168
- className: F.spinner(),
169
+ className: I.spinner(),
169
170
  "aria-hidden": "true"
170
171
  }) : /* @__PURE__ */ h(c, {
171
- className: F.indicatorIcon(),
172
+ className: I.indicatorIcon(),
172
173
  "aria-hidden": "true"
173
174
  })
174
175
  })]
175
- }), C && /* @__PURE__ */ h(_.Context, { children: (e) => Y && !e.disabled && /* @__PURE__ */ h("button", {
176
+ }), C && /* @__PURE__ */ h(_.Context, { children: (e) => X && !e.disabled && /* @__PURE__ */ h("button", {
176
177
  type: "button",
177
178
  tabIndex: -1,
178
- className: F.clear(),
179
- "aria-label": L.clear,
179
+ className: I.clear(),
180
+ "aria-label": R.clear,
180
181
  onClick: () => {
181
- q([]), e.focus();
182
+ J([]), e.focus();
182
183
  },
183
184
  children: /* @__PURE__ */ h(u, {
184
- className: F.clearIcon(),
185
+ className: I.clearIcon(),
185
186
  "aria-hidden": "true"
186
187
  })
187
188
  }) })]
188
189
  }),
189
190
  /* @__PURE__ */ h(te, { children: /* @__PURE__ */ h(_.Positioner, { children: /* @__PURE__ */ h(_.Content, {
190
- className: F.content(),
191
- "aria-busy": J || void 0,
192
- "aria-label": T ? P["aria-label"] : void 0,
191
+ className: I.content(),
192
+ "aria-busy": Y || void 0,
193
+ "aria-label": T ? F["aria-label"] : void 0,
193
194
  children: T ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
194
- className: F.header(),
195
+ className: I.header(),
195
196
  children: /* @__PURE__ */ h(_.Context, { children: (e) => /* @__PURE__ */ h("input", {
196
197
  type: "text",
197
198
  role: "combobox",
@@ -201,11 +202,11 @@ function b({ classes: s, items: v, value: y, defaultValue: b, onValueChange: re,
201
202
  "data-autofocus": "",
202
203
  "aria-controls": Z,
203
204
  "aria-activedescendant": e.highlightedItem ? e.getItemProps({ item: e.highlightedItem }).id : void 0,
204
- "aria-label": L.filter,
205
- placeholder: I.combobox.search,
206
- value: z,
207
- className: F.search(),
208
- onChange: (t) => Ee(e, t.target.value),
205
+ "aria-label": R.filter,
206
+ placeholder: L.combobox.search,
207
+ value: B,
208
+ className: I.search(),
209
+ onChange: (t) => De(e, t.target.value),
209
210
  onKeyDown: (e) => {
210
211
  [
211
212
  " ",
@@ -216,15 +217,15 @@ function b({ classes: s, items: v, value: y, defaultValue: b, onValueChange: re,
216
217
  }) })
217
218
  }), /* @__PURE__ */ h(_.List, {
218
219
  id: Z,
219
- className: F.list(),
220
+ className: I.list(),
220
221
  children: $
221
222
  })] }) : $
222
223
  }) }) }),
223
224
  /* @__PURE__ */ h(_.HiddenSelect, {}),
224
225
  O && /* @__PURE__ */ h("span", {
225
226
  role: "status",
226
- className: F.status(),
227
- children: V.announcement
227
+ className: I.status(),
228
+ children: H.announcement
228
229
  })
229
230
  ]
230
231
  });
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { a as e, i as t, n } from "./RecipesProvider-0idafuGm.js";
3
- import { t as r } from "./Button-DFVVqBuY.js";
4
- import { t as i } from "./Highlight-DdTridk2.js";
3
+ import { t as r } from "./Button-Cd7lufvJ.js";
4
+ import { t as i } from "./Highlight-CX30-nP7.js";
5
5
  import { ChildrenLoader as a, filterTree as o, isLazyNode as s, locateTreeNode as c, moveTreeNode as l, pluralText as u, pruneTree as d, toggleTreeChecked as f, tree as p, treeBranchIds as ee, treeCheckStates as te, treeCheckedValue as m, treeDropMove as h, treeInsertPosition as g, treeKeyboardMove as _, treeMoveAnchor as v, treeRetryId as y, treeRetryParent as b, walkTree as x, withLoadedChildren as S } from "@wirecore/wirelayer-recipes";
6
6
  import { Check as C, ChevronRight as w, LoaderCircle as T, Minus as E, RotateCw as ne } from "lucide-react";
7
7
  import { createContext as D, useContext as O, useEffect as k, useImperativeHandle as A, useMemo as j, useRef as M, useState as N, useSyncExternalStore as re } from "react";
@@ -1,11 +1,17 @@
1
1
  import { chart as chartRecipe, type RecipeClasses } from '@wirecore/wirelayer-recipes';
2
- import { type ChartData, type ChartOptions, type ChartType } from 'chart.js/auto';
2
+ import { type ChartData, type ChartOptions, type ChartType, type Plugin } from 'chart.js/auto';
3
3
  import { type CSSProperties } from 'react';
4
4
  export interface ChartProps<TType extends ChartType> {
5
+ /** Chart.js chart type – it alone decides the types of `data`, `options` and `plugins` */
5
6
  type: TType;
6
- data: ChartData<TType>;
7
- /** Chart.js options – merged over the WireLayer defaults (colours, font, no fixed aspect ratio) */
8
- options?: ChartOptions<TType>;
7
+ data: ChartData<NoInfer<TType>>;
8
+ /**
9
+ * Chart.js options – merged over the WireLayer defaults (colours, font, no fixed aspect ratio). Options kept in
10
+ * a variable need their type, e.g. `computed<ChartOptions<'bar'>>(…)`, or `indexAxis: 'y'` becomes a string
11
+ */
12
+ options?: ChartOptions<NoInfer<TType>>;
13
+ /** Inline Chart.js plugins of this chart (global ones: `Chart.register`) – changing them re-creates the chart */
14
+ plugins?: Plugin<NoInfer<TType>>[];
9
15
  /** Title of the chart, also its accessible name */
10
16
  title: string;
11
17
  /** Keep the title for screen readers only, e.g. inside a card that already has a heading */
@@ -21,5 +27,5 @@ export interface ChartProps<TType extends ChartType> {
21
27
  classes?: RecipeClasses<typeof chartRecipe>;
22
28
  }
23
29
  /** Canvas with role="img" named by the title; the data table is its text alternative (WCAG 1.1.1) */
24
- export declare function Chart<TType extends ChartType>({ classes, type, data, options, title, hideTitle, height, table, formatValue, className, style, }: ChartProps<TType>): import("react").JSX.Element;
30
+ export declare function Chart<TType extends ChartType>({ classes, type, data, options, plugins, title, hideTitle, height, table, formatValue, className, style, }: ChartProps<TType>): import("react").JSX.Element;
25
31
  //# sourceMappingURL=Chart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/chart/Chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,IAAI,WAAW,EACpB,KAAK,aAAa,EAKrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIrE,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,SAAS;IAC/C,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACvB,mGAAmG;IACnG,OAAO,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC9B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mFAAmF;IACnF,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,WAAW,CAAC,CAAC;CAC/C;AAED,qGAAqG;AACrG,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EAAE,EAC3C,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,KAAK,EACL,SAAiB,EACjB,MAAgB,EAChB,KAAY,EACZ,WAAW,EACX,SAAS,EACT,KAAK,GACR,EAAE,UAAU,CAAC,KAAK,CAAC,+BAqGnB"}
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/chart/Chart.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,IAAI,WAAW,EACpB,KAAK,aAAa,EAKrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAsC,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAI/E,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,SAAS;IAC/C,0FAA0F;IAC1F,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,iHAAiH;IACjH,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;IACnC,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mFAAmF;IACnF,OAAO,CAAC,EAAE,aAAa,CAAC,OAAO,WAAW,CAAC,CAAC;CAC/C;AAED,qGAAqG;AACrG,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EAAE,EAC3C,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,KAAK,EACL,SAAiB,EACjB,MAAgB,EAChB,KAAY,EACZ,WAAW,EACX,SAAS,EACT,KAAK,GACR,EAAE,UAAU,CAAC,KAAK,CAAC,+BA8GnB"}
@@ -6,5 +6,7 @@ export { CompositeChart, type CompositeChartProps } from './CompositeChart.js';
6
6
  export { WaterfallChart, type WaterfallChartProps } from './WaterfallChart.js';
7
7
  export { PieChart, type PieChartProps } from './PieChart.js';
8
8
  export type { SeriesChartBaseProps } from './types.js';
9
+ /** Chart.js types for options and data kept in variables, e.g. `computed<ChartOptions<'bar'>>(…)` */
10
+ export type { ChartData, ChartOptions, ChartType, Plugin as ChartPlugin } from 'chart.js/auto';
9
11
  export type { ChartReference, ChartRow, ChartSeries, ChartTone, PieSlice, WaterfallStep, } from '@wirecore/wirelayer-recipes';
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chart/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EACR,cAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,GAChB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chart/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,qGAAqG;AACrG,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/F,YAAY,EACR,cAAc,EACd,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,aAAa,GAChB,MAAM,6BAA6B,CAAC"}
package/dist/chart.js CHANGED
@@ -6,81 +6,88 @@ import { useEffect as x, useId as S, useRef as C, useState as w } from "react";
6
6
  import { jsx as T, jsxs as E } from "react/jsx-runtime";
7
7
  import { Chart as D } from "chart.js/auto";
8
8
  //#region src/chart/Chart.tsx
9
- function O({ classes: n, type: a, data: o, options: s, title: c, hideTitle: u = !1, height: d = "18rem", table: f = !0, formatValue: p, className: m, style: h }) {
10
- let g = t("chart", r, n)(), { locale: y, translations: b } = e(), w = S(), O = C(null), k = C({
9
+ function O({ classes: n, type: a, data: o, options: s, plugins: c, title: u, hideTitle: d = !1, height: f = "18rem", table: p = !0, formatValue: m, className: h, style: g }) {
10
+ let y = t("chart", r, n)(), { locale: b, translations: O } = e(), k = S(), A = C(null), j = C({
11
11
  data: o,
12
12
  options: s
13
- }), A = C(void 0), j = i(o, p ?? ((e) => e.toLocaleString(y)), b.chart);
13
+ }), M = C(void 0), N = i(o, m ?? ((e) => e.toLocaleString(b)), O.chart), [P, F] = w(c), I = P === c || P?.length === c?.length && !!c?.every((e, t) => e === P[t]);
14
+ I || F(c);
15
+ let L = I ? P : c;
14
16
  return x(() => {
15
17
  let e = matchMedia("(prefers-reduced-motion: reduce)"), t = matchMedia("(prefers-color-scheme: dark)"), n = () => {
16
- let t = l(O.current);
18
+ let t = l(A.current);
17
19
  return {
18
- data: _(a, k.current.data, t),
19
- options: v(a, t, k.current.options, e.matches, y)
20
+ data: _(a, j.current.data, t),
21
+ options: v(a, t, j.current.options, e.matches, b)
20
22
  };
21
- }, r = O.current?.getContext("2d"), i = r ? new D(r, {
23
+ }, r = A.current?.getContext("2d"), i = r ? new D(r, {
22
24
  type: a,
23
- ...n()
25
+ ...n(),
26
+ plugins: L ? [...L] : []
24
27
  }) : void 0, o = () => {
25
28
  i && (Object.assign(i, n()), i.update());
26
29
  };
27
- A.current = o;
30
+ M.current = o;
28
31
  let s = new MutationObserver(o);
29
32
  return s.observe(document.documentElement, { attributes: !0 }), e.addEventListener("change", o), t.addEventListener("change", o), () => {
30
33
  s.disconnect(), e.removeEventListener("change", o), t.removeEventListener("change", o), i?.destroy();
31
34
  };
32
- }, [a, y]), x(() => {
33
- k.current = {
35
+ }, [
36
+ a,
37
+ b,
38
+ L
39
+ ]), x(() => {
40
+ j.current = {
34
41
  data: o,
35
42
  options: s
36
- }, A.current?.();
43
+ }, M.current?.();
37
44
  }, [o, s]), /* @__PURE__ */ E("figure", {
38
- className: g.base({ class: m }),
39
- style: h,
45
+ className: y.base({ class: h }),
46
+ style: g,
40
47
  children: [
41
48
  /* @__PURE__ */ T("figcaption", {
42
- id: `${w}title`,
43
- className: u ? g.caption() : g.title(),
44
- children: c
49
+ id: `${k}title`,
50
+ className: d ? y.caption() : y.title(),
51
+ children: u
45
52
  }),
46
53
  /* @__PURE__ */ T("div", {
47
- className: g.canvasBox(),
48
- style: { height: d },
54
+ className: y.canvasBox(),
55
+ style: { height: f },
49
56
  children: /* @__PURE__ */ T("canvas", {
50
- ref: O,
57
+ ref: A,
51
58
  role: "img",
52
- "aria-labelledby": `${w}title`
59
+ "aria-labelledby": `${k}title`
53
60
  })
54
61
  }),
55
- f && /* @__PURE__ */ E("details", {
56
- className: g.details(),
62
+ p && /* @__PURE__ */ E("details", {
63
+ className: y.details(),
57
64
  children: [/* @__PURE__ */ T("summary", {
58
- className: g.summary(),
59
- children: b.chart.showTable
65
+ className: y.summary(),
66
+ children: O.chart.showTable
60
67
  }), /* @__PURE__ */ T("div", {
61
- className: g.scroll(),
68
+ className: y.scroll(),
62
69
  children: /* @__PURE__ */ E("table", {
63
- className: g.table(),
70
+ className: y.table(),
64
71
  children: [
65
72
  /* @__PURE__ */ T("caption", {
66
- className: g.caption(),
67
- children: c
73
+ className: y.caption(),
74
+ children: u
68
75
  }),
69
76
  /* @__PURE__ */ T("thead", { children: /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ T("th", {
70
77
  scope: "col",
71
- className: g.th(),
72
- children: b.chart.category
73
- }), j.columns.map((e) => /* @__PURE__ */ T("th", {
78
+ className: y.th(),
79
+ children: O.chart.category
80
+ }), N.columns.map((e) => /* @__PURE__ */ T("th", {
74
81
  scope: "col",
75
- className: g.th(),
82
+ className: y.th(),
76
83
  children: e
77
84
  }, e))] }) }),
78
- /* @__PURE__ */ T("tbody", { children: j.rows.map((e) => /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ T("th", {
85
+ /* @__PURE__ */ T("tbody", { children: N.rows.map((e) => /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ T("th", {
79
86
  scope: "row",
80
- className: g.rowHeader(),
87
+ className: y.rowHeader(),
81
88
  children: e.label
82
89
  }), e.values.map((e, t) => /* @__PURE__ */ T("td", {
83
- className: g.td(),
90
+ className: y.td(),
84
91
  children: e
85
92
  }, t))] }, e.label)) })
86
93
  ]