@wirecore/wirelayer-react 0.12.0 → 0.12.1

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 (108) hide show
  1. package/dist/CopyButton-C_LAuCkR.js +47 -0
  2. package/dist/Tree-DLHbcH3-.js +602 -0
  3. package/dist/chart/Chart.d.ts +3 -3
  4. package/dist/chart/Chart.d.ts.map +1 -1
  5. package/dist/chart/PieChart.d.ts +3 -3
  6. package/dist/chart/PieChart.d.ts.map +1 -1
  7. package/dist/chart/SeriesChartView.d.ts +1 -1
  8. package/dist/chart/SeriesChartView.d.ts.map +1 -1
  9. package/dist/chart/Sparkline.d.ts +3 -3
  10. package/dist/chart/Sparkline.d.ts.map +1 -1
  11. package/dist/chart/WaterfallChart.d.ts +3 -3
  12. package/dist/chart/WaterfallChart.d.ts.map +1 -1
  13. package/dist/chart/types.d.ts +2 -2
  14. package/dist/chart/types.d.ts.map +1 -1
  15. package/dist/chart.js +148 -143
  16. package/dist/code.js +1 -1
  17. package/dist/components/AngleSlider/AngleSlider.d.ts +3 -3
  18. package/dist/components/AngleSlider/AngleSlider.d.ts.map +1 -1
  19. package/dist/components/BlockUi/BlockUi.d.ts +3 -3
  20. package/dist/components/BlockUi/BlockUi.d.ts.map +1 -1
  21. package/dist/components/Calendar/Calendar.d.ts +3 -3
  22. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  23. package/dist/components/Carousel/Carousel.d.ts +3 -3
  24. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  25. package/dist/components/CascadeSelect/CascadeSelect.d.ts +4 -3
  26. package/dist/components/CascadeSelect/CascadeSelect.d.ts.map +1 -1
  27. package/dist/components/ColorPicker/ColorPicker.d.ts +4 -4
  28. package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
  29. package/dist/components/CopyButton/CopyButton.d.ts +3 -3
  30. package/dist/components/CopyButton/CopyButton.d.ts.map +1 -1
  31. package/dist/components/DataView/DataView.d.ts +3 -3
  32. package/dist/components/DataView/DataView.d.ts.map +1 -1
  33. package/dist/components/Fieldset/Fieldset.d.ts +5 -3
  34. package/dist/components/Fieldset/Fieldset.d.ts.map +1 -1
  35. package/dist/components/Gallery/Gallery.d.ts +3 -3
  36. package/dist/components/Gallery/Gallery.d.ts.map +1 -1
  37. package/dist/components/JsonViewer/JsonViewer.d.ts +4 -3
  38. package/dist/components/JsonViewer/JsonViewer.d.ts.map +1 -1
  39. package/dist/components/Knob/Knob.d.ts +4 -3
  40. package/dist/components/Knob/Knob.d.ts.map +1 -1
  41. package/dist/components/Listbox/Listbox.d.ts +4 -4
  42. package/dist/components/Listbox/Listbox.d.ts.map +1 -1
  43. package/dist/components/LogViewer/LogViewer.d.ts +3 -3
  44. package/dist/components/LogViewer/LogViewer.d.ts.map +1 -1
  45. package/dist/components/MeterGroup/MeterGroup.d.ts +3 -3
  46. package/dist/components/MeterGroup/MeterGroup.d.ts.map +1 -1
  47. package/dist/components/NavigationMenu/NavigationMenu.d.ts +3 -3
  48. package/dist/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
  49. package/dist/components/OrderList/OrderList.d.ts +3 -3
  50. package/dist/components/OrderList/OrderList.d.ts.map +1 -1
  51. package/dist/components/OrgChart/OrgChart.d.ts +3 -3
  52. package/dist/components/OrgChart/OrgChart.d.ts.map +1 -1
  53. package/dist/components/Panel/Panel.d.ts +3 -3
  54. package/dist/components/Panel/Panel.d.ts.map +1 -1
  55. package/dist/components/PickList/PickList.d.ts +3 -3
  56. package/dist/components/PickList/PickList.d.ts.map +1 -1
  57. package/dist/components/PinInput/PinInput.d.ts +4 -4
  58. package/dist/components/PinInput/PinInput.d.ts.map +1 -1
  59. package/dist/components/ProgressCircle/ProgressCircle.d.ts +3 -3
  60. package/dist/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
  61. package/dist/components/Rating/Rating.d.ts +3 -3
  62. package/dist/components/Rating/Rating.d.ts.map +1 -1
  63. package/dist/components/ScrollPanel/ScrollPanel.d.ts +3 -3
  64. package/dist/components/ScrollPanel/ScrollPanel.d.ts.map +1 -1
  65. package/dist/components/ScrollTop/ScrollTop.d.ts +3 -2
  66. package/dist/components/ScrollTop/ScrollTop.d.ts.map +1 -1
  67. package/dist/components/SidebarNav/SidebarNav.d.ts +3 -3
  68. package/dist/components/SidebarNav/SidebarNav.d.ts.map +1 -1
  69. package/dist/components/SignaturePad/SignaturePad.d.ts +3 -3
  70. package/dist/components/SignaturePad/SignaturePad.d.ts.map +1 -1
  71. package/dist/components/Sortable/Sortable.d.ts +4 -3
  72. package/dist/components/Sortable/Sortable.d.ts.map +1 -1
  73. package/dist/components/SpeedDial/SpeedDial.d.ts +3 -3
  74. package/dist/components/SpeedDial/SpeedDial.d.ts.map +1 -1
  75. package/dist/components/SplitButton/SplitButton.d.ts +3 -3
  76. package/dist/components/SplitButton/SplitButton.d.ts.map +1 -1
  77. package/dist/components/Splitter/Splitter.d.ts +3 -3
  78. package/dist/components/Splitter/Splitter.d.ts.map +1 -1
  79. package/dist/components/Spoiler/Spoiler.d.ts +3 -3
  80. package/dist/components/Spoiler/Spoiler.d.ts.map +1 -1
  81. package/dist/components/Stepper/Stepper.d.ts +3 -3
  82. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  83. package/dist/components/TableOfContents/TableOfContents.d.ts +3 -3
  84. package/dist/components/TableOfContents/TableOfContents.d.ts.map +1 -1
  85. package/dist/components/Timeline/Timeline.d.ts +3 -3
  86. package/dist/components/Timeline/Timeline.d.ts.map +1 -1
  87. package/dist/components/Toolbar/Toolbar.d.ts +3 -3
  88. package/dist/components/Toolbar/Toolbar.d.ts.map +1 -1
  89. package/dist/components/Tree/Tree.d.ts +3 -3
  90. package/dist/components/Tree/Tree.d.ts.map +1 -1
  91. package/dist/components/Tree/useTree.d.ts +2 -0
  92. package/dist/components/Tree/useTree.d.ts.map +1 -1
  93. package/dist/components/TreeSelect/TreeSelect.d.ts +4 -4
  94. package/dist/components/TreeSelect/TreeSelect.d.ts.map +1 -1
  95. package/dist/data-table.js +1 -1
  96. package/dist/editor/Editor.d.ts +4 -4
  97. package/dist/editor/Editor.d.ts.map +1 -1
  98. package/dist/editor.js +184 -183
  99. package/dist/index.js +1272 -1216
  100. package/dist/pdf.js +1 -1
  101. package/dist/virtual/VirtualList.d.ts +3 -3
  102. package/dist/virtual/VirtualList.d.ts.map +1 -1
  103. package/dist/virtual/VirtualTree.d.ts.map +1 -1
  104. package/dist/virtual.js +224 -219
  105. package/llms-full.txt +66 -10
  106. package/package.json +1 -1
  107. package/dist/CopyButton-0e1pHR3f.js +0 -45
  108. package/dist/Tree-DVjwp6FG.js +0 -568
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { a as e, n as t } from "./RecipesProvider-0idafuGm.js";
3
+ import { controlIds as n, copyButton as r, iconButton as i } from "@wirecore/wirelayer-recipes";
4
+ import { Check as a, Copy as o } from "lucide-react";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { Clipboard as l } from "@ark-ui/react/clipboard";
7
+ //#region src/components/CopyButton/CopyButton.tsx
8
+ function u({ classes: u, value: d, showValue: f = !1, label: p, size: m = "sm", className: h, style: g, ..._ }) {
9
+ let v = t("copyButton", r, u), y = t("iconButton", i), b = v(), x = e(), S = p ?? x.copyButton.label, C = y({
10
+ variant: "text",
11
+ size: m
12
+ });
13
+ return /* @__PURE__ */ c(l.Root, {
14
+ ..._,
15
+ ...n(_.id, "root"),
16
+ value: d,
17
+ className: b.base({ class: h }),
18
+ style: g,
19
+ children: [
20
+ f && /* @__PURE__ */ s("span", {
21
+ className: b.value(),
22
+ children: d
23
+ }),
24
+ /* @__PURE__ */ s(l.Trigger, {
25
+ className: C.base(),
26
+ "aria-label": S,
27
+ children: /* @__PURE__ */ s(l.Indicator, {
28
+ copied: /* @__PURE__ */ s(a, {
29
+ className: C.icon(),
30
+ "aria-hidden": "true"
31
+ }),
32
+ children: /* @__PURE__ */ s(o, {
33
+ className: C.icon(),
34
+ "aria-hidden": "true"
35
+ })
36
+ })
37
+ }),
38
+ /* @__PURE__ */ s(l.Context, { children: (e) => /* @__PURE__ */ s("span", {
39
+ role: "status",
40
+ className: b.status(),
41
+ children: e.copied ? x.copyButton.copied : ""
42
+ }) })
43
+ ]
44
+ });
45
+ }
46
+ //#endregion
47
+ export { u as t };
@@ -0,0 +1,602 @@
1
+ "use client";
2
+ import { a as e, i as t, n } from "./RecipesProvider-0idafuGm.js";
3
+ import { t as r } from "./Button-Cd7lufvJ.js";
4
+ import { t as i } from "./Highlight-43-H9459.js";
5
+ import { ChildrenLoader as a, controlIds as o, filterTree as s, isLazyNode as c, locateTreeNode as l, moveTreeNode as u, pluralText as d, pruneTree as f, toggleTreeChecked as ee, tree as p, treeBranchIds as m, treeCheckStates as h, treeCheckedValue as te, treeDropMove as g, treeInsertPosition as _, treeKeyboardMove as v, treeMoveAnchor as y, treeRetryId as b, treeRetryParent as x, walkTree as S, withLoadedChildren as C } from "@wirecore/wirelayer-recipes";
6
+ import { Check as w, ChevronRight as T, LoaderCircle as E, Minus as D, RotateCw as ne } from "lucide-react";
7
+ import { createContext as O, useContext as k, useEffect as A, useImperativeHandle as j, useMemo as M, useRef as N, useState as P, useSyncExternalStore as re } from "react";
8
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
9
+ import { TreeView as R, createTreeCollection as ie } from "@ark-ui/react/tree-view";
10
+ //#region src/components/Tree/types.ts
11
+ var z = null, ae = /* @__PURE__ */ new Set(), B = {
12
+ get: () => z,
13
+ set(e) {
14
+ z = e, ae.forEach((e) => e());
15
+ },
16
+ subscribe(e) {
17
+ return ae.add(e), () => void ae.delete(e);
18
+ }
19
+ }, oe = {
20
+ items: !0,
21
+ selectedValue: !0,
22
+ defaultSelectedValue: !0,
23
+ onSelectionChange: !0,
24
+ expandedValue: !0,
25
+ defaultExpandedValue: !0,
26
+ onExpandedChange: !0,
27
+ checkable: !0,
28
+ checkedValue: !0,
29
+ defaultCheckedValue: !0,
30
+ onCheckedChange: !0,
31
+ checkStrictly: !0,
32
+ checkedStrategy: !0,
33
+ reorderable: !0,
34
+ onMove: !0,
35
+ loadChildren: !0,
36
+ onLoadChildren: !0,
37
+ dataSource: !0,
38
+ filterValue: !0,
39
+ onFilterValueChange: !0,
40
+ filterMode: !0,
41
+ allowDrop: !0,
42
+ group: !0,
43
+ name: !0,
44
+ onTransfer: !0
45
+ };
46
+ function se(e) {
47
+ return Object.fromEntries(Object.entries(e).filter(([e]) => !(e in oe)));
48
+ }
49
+ var V = (e, t) => l(e, t)?.node, ce = (e) => {
50
+ let t = !1;
51
+ return S(e, (e) => {
52
+ c(e) && (t = !0);
53
+ }), t;
54
+ }, le = {
55
+ status: {},
56
+ children: {},
57
+ errors: {}
58
+ };
59
+ function H(e, n) {
60
+ let { translations: r, locale: i, dir: o } = t(), l = r.tree, [p, S] = P(""), [w] = P(() => Symbol("tree")), T = N(e);
61
+ A(() => {
62
+ T.current = e;
63
+ });
64
+ let [E, D] = P(le), ne = N(le), [O, k] = P(() => /* @__PURE__ */ new Set()), j = M(() => C(e.items, E.children), [e.items, E.children]), F = N(j);
65
+ A(() => {
66
+ F.current = j;
67
+ }, [j]);
68
+ let I = (e) => V(F.current, e)?.label ?? e, L = N(void 0), R = () => L.current ??= new a({
69
+ load: (e, t) => T.current.loadChildren ? T.current.loadChildren(e, t) : T.current.dataSource.getChildren(e, t).then((e) => e.items),
70
+ onChange: (e) => {
71
+ let t = ne.current;
72
+ ne.current = e;
73
+ for (let [n, r] of Object.entries(e.status)) t.status[n] !== r && S(r === "loading" ? l.loadingNode(I(n)) : r === "error" ? l.loadError(I(n)) : d(l.loadedNode, e.children[n]?.length ?? 0, i).replace("{label}", I(n)));
74
+ D(e);
75
+ }
76
+ });
77
+ A(() => () => {
78
+ L.current?.dispose(), L.current = void 0;
79
+ }, []);
80
+ let z = !!e.loadChildren || !!e.dataSource?.getChildren, ae = (e) => c(e) && (E.status[e.id] === "loading" || !z && O.has(e.id)), [oe, se] = P(!1), H = ce(e.items);
81
+ H && !oe && se(!0);
82
+ let U = z || oe || H, W = N(O);
83
+ A(() => {
84
+ W.current = O;
85
+ }, [O]);
86
+ function G(e) {
87
+ for (let t of e) {
88
+ let e = V(F.current, t);
89
+ e && c(e) && (T.current.loadChildren || T.current.dataSource?.getChildren ? R().load(e) : W.current.has(t) || (W.current = /* @__PURE__ */ new Set([...W.current, t]), k(W.current), S(l.loadingNode(e.label)), T.current.onLoadChildren?.(e)));
90
+ }
91
+ }
92
+ function de(t) {
93
+ let n = V(F.current, t);
94
+ n && (ze(t), z ? R().load(n, { force: !0 }) : (W.current = /* @__PURE__ */ new Set([...W.current, t]), k(W.current), e.onLoadChildren?.(n)));
95
+ }
96
+ let [fe, pe] = P(e.defaultExpandedValue ?? []), K = e.expandedValue ?? fe, q = (e) => {
97
+ pe(e), T.current.onExpandedChange?.(e);
98
+ }, me = N([]);
99
+ A(() => {
100
+ let e = me.current;
101
+ me.current = K, G(K.filter((t) => !e.includes(t)));
102
+ }, [K]);
103
+ let he = () => q(m(F.current)), ge = () => q([]);
104
+ function _e(e) {
105
+ L.current?.invalidate(e), W.current = e === void 0 ? /* @__PURE__ */ new Set() : new Set([...W.current].filter((t) => t !== e)), k(W.current), ve.current = e === void 0 ? K : K.filter((t) => t === e);
106
+ }
107
+ let ve = N([]);
108
+ A(() => {
109
+ if (!ve.current.length) return;
110
+ let e = ve.current;
111
+ ve.current = [], G(e);
112
+ }, [j]);
113
+ let [ye, be] = P(e.defaultSelectedValue ?? []), xe = e.selectedValue ?? ye;
114
+ function Se(t) {
115
+ let n = t.find((e) => x(e) !== void 0);
116
+ if (n) return de(x(n));
117
+ be(t), e.onSelectionChange?.(t);
118
+ }
119
+ let Ce = !!e.checkable && (!!e.checkStrictly || e.checkedStrategy !== void 0 || U), [we, Te] = P(e.defaultCheckedValue ?? []), Ee = e.checkedValue ?? we, De = M(() => Ce ? h(j, Ee, e.checkStrictly) : void 0, [
120
+ Ce,
121
+ j,
122
+ Ee,
123
+ e.checkStrictly
124
+ ]);
125
+ function Oe(t) {
126
+ let n = ee(j, Ee, t, e.checkStrictly), r = te(j, n, e.checkedStrategy ?? "all", e.checkStrictly);
127
+ Te(r), e.onCheckedChange?.(r);
128
+ }
129
+ function ke(t) {
130
+ Te(t), e.onCheckedChange?.(t);
131
+ }
132
+ let [Ae, je] = P(""), J = e.filterValue ?? Ae, Me = (t) => {
133
+ je(t), e.onFilterValueChange?.(t);
134
+ }, Y = M(() => s(j, J, (e) => e.label, e.filterMode ?? "filter"), [
135
+ j,
136
+ J,
137
+ e.filterMode
138
+ ]), Ne = M(() => new Set(Y.matches), [Y]), X = N(null), Pe = N("");
139
+ A(() => {
140
+ if (J === Pe.current) return;
141
+ if (Pe.current = J, Fe.current = -1, !J.trim()) {
142
+ X.current && q(X.current), X.current = null;
143
+ return;
144
+ }
145
+ X.current ??= K, q([.../* @__PURE__ */ new Set([...X.current, ...Y.expand])]);
146
+ let e = Y.matches.length;
147
+ S(e ? d(l.matches, e, i) : l.noMatches);
148
+ }, [J]);
149
+ let Fe = N(-1);
150
+ function Ie(e = 1) {
151
+ let t = Y.matches;
152
+ t.length && (Fe.current = (Fe.current + e + t.length) % t.length, ze(t[Fe.current]));
153
+ }
154
+ let Le = M(() => {
155
+ let e = (e) => c(e) && E.status[e.id] === "error", t = (n) => n.map((n) => e(n) ? {
156
+ ...n,
157
+ children: [{
158
+ id: b(n.id),
159
+ label: l.retry
160
+ }]
161
+ } : n.children ? {
162
+ ...n,
163
+ children: t(n.children)
164
+ } : n), n = Object.keys(E.errors).length ? t(j) : j;
165
+ return f(n, Y.visible);
166
+ }, [
167
+ j,
168
+ E,
169
+ Y.visible,
170
+ l.retry
171
+ ]), Re = M(() => ie({
172
+ nodeToValue: (e) => e.id,
173
+ nodeToString: (e) => e.label,
174
+ isNodeDisabled: (e) => !!e.disabled,
175
+ nodeToChildrenCount: (e) => c(e) ? 1 : void 0,
176
+ rootNode: {
177
+ id: "ROOT",
178
+ label: "",
179
+ children: Le
180
+ }
181
+ }), [Le]);
182
+ function ze(e) {
183
+ let t = n.current?.querySelector(`[data-node-id="${CSS.escape(e)}"]`);
184
+ (t?.matches("[data-part=branch]") ? t.querySelector(":scope > [data-part=branch-control]") : t)?.focus();
185
+ }
186
+ let Be = N(null);
187
+ A(() => {
188
+ Be.current &&= (ze(Be.current), null);
189
+ }, [e.items]);
190
+ let Ve = (e, t) => (e ? V(j, e)?.children ?? [] : j).filter((e) => e.id !== t).length + 1;
191
+ function He(t) {
192
+ if (!t) return;
193
+ let n = V(j, t.id);
194
+ if (n && e.allowDrop) {
195
+ let r = y(j, t);
196
+ if (!e.allowDrop(n, r.target, r.position)) return S(l.dropDenied);
197
+ }
198
+ let r = t.parentId ? I(t.parentId) : null;
199
+ S(l.moved(I(t.id), r, t.index + 1, Ve(t.parentId, t.id))), Be.current = t.id, e.onMove?.(Object.keys(E.children).length ? {
200
+ ...t,
201
+ items: u(j, t)
202
+ } : t);
203
+ }
204
+ function Ue(t, n, r) {
205
+ let i = r.parentId ? I(r.parentId) : null;
206
+ S(l.moved(t.label, i, r.index + 1, Ve(r.parentId, t.id))), Be.current = t.id, e.onTransfer?.({
207
+ node: t,
208
+ sourceTree: n,
209
+ targetTree: e.name,
210
+ ...r
211
+ });
212
+ }
213
+ let We = re(B.subscribe, B.get, () => null), Z = (t) => {
214
+ let n = B.get();
215
+ return n && n.mode === t && n.tree !== w && e.group !== void 0 && n.group === e.group ? n : null;
216
+ }, Ge = We?.mode === "cut" && We.tree === w ? We.node.id : null;
217
+ function Ke(t) {
218
+ let n = B.get();
219
+ if (!n || n.mode !== "cut") return !1;
220
+ let r = V(j, t);
221
+ if (!r) return !1;
222
+ let i = r.children ? "inside" : "after";
223
+ if (e.allowDrop && !e.allowDrop(n.node, r, i)) return S(l.dropDenied), !0;
224
+ if (n.tree === w) {
225
+ if (!e.reorderable) return !1;
226
+ let r = g(j, n.node.id, t, i);
227
+ r ? He(r) : S(l.dropDenied);
228
+ } else {
229
+ if (!Z("cut")) return !1;
230
+ let e = _(j, t, i);
231
+ e && Ue(n.node, n.name, e);
232
+ }
233
+ return B.set(null), !0;
234
+ }
235
+ let qe = e.reorderable || e.group !== void 0;
236
+ function Je(t) {
237
+ e.checkable && ue(t);
238
+ let n = t.target.closest("[data-node-id]")?.dataset.nodeId;
239
+ if (!n || x(n) !== void 0) return;
240
+ let r = t.ctrlKey || t.metaKey;
241
+ if (qe && r && !t.altKey && (t.key === "x" || t.key === "X")) {
242
+ let r = V(j, n);
243
+ if (!r || r.disabled) return;
244
+ t.preventDefault(), B.set({
245
+ mode: "cut",
246
+ node: r,
247
+ tree: w,
248
+ group: e.group,
249
+ name: e.name
250
+ }), S(l.cut(r.label));
251
+ return;
252
+ }
253
+ if (r && !t.altKey && (t.key === "v" || t.key === "V")) {
254
+ Ke(n) && t.preventDefault();
255
+ return;
256
+ }
257
+ if (t.key === "Escape" && Ge) {
258
+ t.preventDefault(), t.stopPropagation(), B.set(null), S(l.cutCancelled);
259
+ return;
260
+ }
261
+ if (!e.reorderable || !t.altKey) return;
262
+ let i = o === "rtl", a = t.key === "ArrowUp" ? "up" : t.key === "ArrowDown" ? "down" : t.key === "ArrowRight" ? i ? "out" : "in" : t.key === "ArrowLeft" ? i ? "in" : "out" : void 0;
263
+ a && (t.preventDefault(), t.stopPropagation(), He(v(j, n, a)));
264
+ }
265
+ let [Q, Ye] = P(null), [$, Xe] = P(null), Ze = (e, t) => {
266
+ let n = e.currentTarget.getBoundingClientRect(), r = (e.clientY - n.top) / n.height;
267
+ return t ? r < .25 ? "before" : r > .75 ? "after" : "inside" : r < .5 ? "before" : "after";
268
+ }, Qe = {
269
+ reorderable: qe,
270
+ dragging: Q,
271
+ drop: $,
272
+ onDragStart: (t, n) => {
273
+ let r = V(j, t);
274
+ r && (Ye(t), B.set({
275
+ mode: "drag",
276
+ node: r,
277
+ tree: w,
278
+ group: e.group,
279
+ name: e.name
280
+ }), n.dataTransfer.setData("text/plain", r.label), n.dataTransfer.effectAllowed = "move");
281
+ },
282
+ onDragOver: (t, n, r) => {
283
+ let i = Z("drag");
284
+ if ((!Q || !e.reorderable) && !i || Q === t) return;
285
+ let a = V(j, t);
286
+ a && c(a) && G([t]);
287
+ let o = Ze(r, n), s = i ? i.node : V(j, Q), l = i ? _(j, t, o) : g(j, Q, t, o), u = V(j, t) ?? null;
288
+ !l || !s || e.allowDrop && !e.allowDrop(s, u, o) ? Xe(null) : (r.preventDefault(), Xe({
289
+ id: t,
290
+ position: o
291
+ }));
292
+ },
293
+ onDrop: (t) => {
294
+ t.preventDefault();
295
+ let n = Z("drag");
296
+ if ($ && Q && e.reorderable) He(g(j, Q, $.id, $.position));
297
+ else if ($ && n) {
298
+ let e = _(j, $.id, $.position);
299
+ e && Ue(n.node, n.name, e);
300
+ }
301
+ Ye(null), Xe(null);
302
+ },
303
+ onDragEnd: () => {
304
+ Ye(null), Xe(null), B.get()?.mode === "drag" && B.set(null);
305
+ }
306
+ };
307
+ function $e(t) {
308
+ let n = Z("drag");
309
+ !n || e.allowDrop && !e.allowDrop(n.node, null, "inside") || t.preventDefault();
310
+ }
311
+ function et(e) {
312
+ let t = Z("drag");
313
+ t && (e.preventDefault(), Ue(t.node, t.name, {
314
+ parentId: null,
315
+ index: 0
316
+ }));
317
+ }
318
+ return {
319
+ status: p,
320
+ resolved: j,
321
+ view: Le,
322
+ collection: Re,
323
+ expanded: K,
324
+ setExpanded: q,
325
+ expandAll: he,
326
+ collapseAll: ge,
327
+ selected: xe,
328
+ onSelectionChange: Se,
329
+ ownChecks: Ce,
330
+ checkStates: De,
331
+ toggleCheck: Oe,
332
+ onArkCheckedChange: ke,
333
+ query: J,
334
+ setQuery: Me,
335
+ matches: Ne,
336
+ jump: Ie,
337
+ loadingOf: ae,
338
+ lazy: U,
339
+ invalidate: _e,
340
+ onKeyDown: Je,
341
+ drag: Qe,
342
+ cutId: Ge,
343
+ onEmptyDragOver: $e,
344
+ onEmptyDrop: et,
345
+ focusNode: ze
346
+ };
347
+ }
348
+ function ue(e) {
349
+ if (e.key !== " " || e.altKey) return;
350
+ let t = e.target.querySelector(":scope > [data-part=\"node-checkbox\"]");
351
+ t && (e.preventDefault(), e.stopPropagation(), t.click());
352
+ }
353
+ //#endregion
354
+ //#region src/components/Tree/Tree.tsx
355
+ var U = O(null);
356
+ function W({ classes: t, items: r, label: i, "aria-label": a, selectionMode: s = "single", checkable: c = !1, checkStrictly: l = !1, checkedValue: u, defaultCheckedValue: d, reorderable: f = !1, filter: ee = !1, filterMode: m = "filter", expandControls: h = !1, showLines: te = !1, renderNode: g, emptyText: _, empty: v, className: y, style: b, ref: x, ...S }) {
357
+ let C = n("tree", p, t)(), w = e(), T = w.tree, E = N(null), D = H({
358
+ ...S,
359
+ items: r,
360
+ checkable: c,
361
+ checkStrictly: l,
362
+ checkedValue: u,
363
+ defaultCheckedValue: d,
364
+ reorderable: f,
365
+ filterMode: m
366
+ }, E);
367
+ j(x, () => ({
368
+ expandAll: D.expandAll,
369
+ collapseAll: D.collapseAll,
370
+ invalidate: D.invalidate,
371
+ focusNode: D.focusNode
372
+ }));
373
+ let ne = ee || S.filterValue !== void 0, O = _ ?? (D.query.trim() ? T.noMatches : S.group === void 0 ? void 0 : w.common.empty), k = !D.view.length && (O !== void 0 || !!v || S.group !== void 0), A = f || D.lazy || ne || S.group !== void 0;
374
+ return /* @__PURE__ */ L(R.Root, {
375
+ ...se(S),
376
+ ...o(S.id, "root"),
377
+ ref: E,
378
+ className: C.base({ class: y }),
379
+ style: b,
380
+ collection: D.collection,
381
+ selectionMode: s,
382
+ selectedValue: D.selected,
383
+ onSelectionChange: (e) => D.onSelectionChange(e.selectedValue),
384
+ expandedValue: D.expanded,
385
+ onExpandedChange: (e) => D.setExpanded(e.expandedValue),
386
+ ...D.ownChecks ? {} : {
387
+ checkedValue: u,
388
+ defaultCheckedValue: d
389
+ },
390
+ onCheckedChange: (e) => D.ownChecks || D.onArkCheckedChange(e.checkedValue),
391
+ translations: { treeLabel: i ?? a ?? w.tree.treeLabel },
392
+ onKeyDownCapture: (e) => {
393
+ S.onKeyDownCapture?.(e), D.onKeyDown(e);
394
+ },
395
+ children: [
396
+ i && /* @__PURE__ */ I(R.Label, {
397
+ className: C.label(),
398
+ children: i
399
+ }),
400
+ /* @__PURE__ */ I(G, {
401
+ model: D,
402
+ filter: ee,
403
+ filterMode: m,
404
+ expandControls: h,
405
+ classes: t
406
+ }),
407
+ /* @__PURE__ */ I(U, {
408
+ value: {
409
+ model: D,
410
+ checkable: c,
411
+ showLines: te,
412
+ renderNode: g
413
+ },
414
+ children: /* @__PURE__ */ I(R.Tree, {
415
+ className: C.tree(),
416
+ hidden: k || void 0,
417
+ children: D.view.map((e, t) => /* @__PURE__ */ I(K, {
418
+ node: e,
419
+ indexPath: [t]
420
+ }, e.id))
421
+ })
422
+ }),
423
+ k && /* @__PURE__ */ I("div", {
424
+ className: C.empty(),
425
+ onDragOver: D.onEmptyDragOver,
426
+ onDrop: D.onEmptyDrop,
427
+ children: v ?? O
428
+ }),
429
+ A && /* @__PURE__ */ I("p", {
430
+ role: "status",
431
+ className: C.status(),
432
+ children: D.status
433
+ })
434
+ ]
435
+ });
436
+ }
437
+ function G({ model: t, filter: i, filterMode: a, expandControls: o, classes: s }) {
438
+ let c = n("tree", p, s)(), l = e(), u = l.tree;
439
+ return !i && !o ? null : /* @__PURE__ */ L("div", {
440
+ className: c.toolbar(),
441
+ children: [i && /* @__PURE__ */ I("input", {
442
+ type: "search",
443
+ autoComplete: "off",
444
+ className: c.search(),
445
+ "aria-label": u.filter,
446
+ placeholder: l.combobox.search,
447
+ value: t.query,
448
+ onChange: (e) => t.setQuery(e.target.value),
449
+ onKeyDown: (e) => {
450
+ e.key === "Enter" && a === "highlight" && (e.preventDefault(), t.jump(e.shiftKey ? -1 : 1));
451
+ }
452
+ }), o && /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(r, {
453
+ variant: "text",
454
+ size: "sm",
455
+ onClick: t.expandAll,
456
+ children: u.expandAll
457
+ }), /* @__PURE__ */ I(r, {
458
+ variant: "text",
459
+ size: "sm",
460
+ onClick: t.collapseAll,
461
+ children: u.collapseAll
462
+ })] })]
463
+ });
464
+ }
465
+ var de = "Alt+ArrowUp Alt+ArrowDown Alt+ArrowLeft Alt+ArrowRight", fe = (e) => e === "indeterminate" ? "mixed" : e;
466
+ function pe({ own: e, checked: t, onToggle: r }) {
467
+ let i = n("tree", p)();
468
+ return e ? /* @__PURE__ */ I("span", {
469
+ "data-part": "node-checkbox",
470
+ "data-state": t === "indeterminate" ? "indeterminate" : t ? "checked" : "unchecked",
471
+ role: "presentation",
472
+ "aria-hidden": "true",
473
+ className: i.checkbox(),
474
+ onClick: (e) => {
475
+ e.stopPropagation(), r();
476
+ },
477
+ children: t === "indeterminate" ? /* @__PURE__ */ I(D, { className: i.checkboxIcon() }) : t ? /* @__PURE__ */ I(w, { className: i.checkboxIcon() }) : null
478
+ }) : /* @__PURE__ */ I(R.NodeCheckbox, {
479
+ className: i.checkbox(),
480
+ role: "presentation",
481
+ "aria-hidden": "true",
482
+ children: /* @__PURE__ */ I(R.NodeCheckboxIndicator, {
483
+ indeterminate: /* @__PURE__ */ I(D, {
484
+ className: i.checkboxIcon(),
485
+ "aria-hidden": "true"
486
+ }),
487
+ children: /* @__PURE__ */ I(w, {
488
+ className: i.checkboxIcon(),
489
+ "aria-hidden": "true"
490
+ })
491
+ })
492
+ });
493
+ }
494
+ function K({ node: t, indexPath: r, flat: a = !1, posinset: o, setsize: s }) {
495
+ let l = n("tree", p)(), u = e().tree, { model: d, checkable: f, showLines: ee, renderNode: m } = k(U), h = d.drag, te = t.icon, g = !!t.children || c(t), _ = x(t.id) !== void 0, v = d.loadingOf(t), y = d.matches.has(t.id), b = d.ownChecks, S = d.checkStates?.get(t.id) ?? !1, C = (e) => b ? S : e.checked, w = (e) => h.reorderable ? {
496
+ draggable: t.disabled ? void 0 : "true",
497
+ "data-drop": h.drop?.id === t.id ? h.drop.position : void 0,
498
+ "data-dragging": h.dragging === t.id || void 0,
499
+ "data-cut": d.cutId === t.id || void 0,
500
+ onDragStart: (e) => h.onDragStart(t.id, e),
501
+ onDragOver: (n) => h.onDragOver(t.id, e, n),
502
+ onDrop: h.onDrop,
503
+ onDragEnd: h.onDragEnd
504
+ } : {}, D = (e, n) => m ? m(t, {
505
+ level: e.depth,
506
+ selected: e.selected,
507
+ expanded: e.expanded,
508
+ branch: g,
509
+ checked: C(e),
510
+ loading: v,
511
+ match: y,
512
+ query: d.query
513
+ }) : /* @__PURE__ */ L(F, { children: [te && /* @__PURE__ */ I(te, {
514
+ className: l.icon(),
515
+ "aria-hidden": "true"
516
+ }), /* @__PURE__ */ I(n, {
517
+ className: l.text(),
518
+ children: y ? /* @__PURE__ */ I(i, {
519
+ text: t.label,
520
+ query: d.query,
521
+ ignoreAccents: !0
522
+ }) : t.label
523
+ })] });
524
+ return /* @__PURE__ */ I(R.NodeProvider, {
525
+ node: t,
526
+ indexPath: r,
527
+ children: /* @__PURE__ */ I(R.NodeContext, { children: (e) => g ? /* @__PURE__ */ L(R.Branch, {
528
+ "data-node-id": t.id,
529
+ "aria-keyshortcuts": h.reorderable ? de : void 0,
530
+ "aria-checked": f ? fe(C(e)) : void 0,
531
+ "aria-busy": v || void 0,
532
+ "aria-posinset": o,
533
+ "aria-setsize": s,
534
+ "data-match": y || void 0,
535
+ children: [/* @__PURE__ */ L(R.BranchControl, {
536
+ className: l.branch({ class: h.reorderable ? l.dropTarget() : void 0 }),
537
+ ...w(!0),
538
+ children: [
539
+ /* @__PURE__ */ I(R.BranchIndicator, {
540
+ className: l.indicator(),
541
+ children: /* @__PURE__ */ I(T, {
542
+ className: l.indicatorIcon(),
543
+ "aria-hidden": "true"
544
+ })
545
+ }),
546
+ f && /* @__PURE__ */ I(pe, {
547
+ own: b,
548
+ checked: S,
549
+ onToggle: () => d.toggleCheck(t.id)
550
+ }),
551
+ D(e, R.BranchText)
552
+ ]
553
+ }), !a && /* @__PURE__ */ L(R.BranchContent, {
554
+ ...ee ? { className: l.lines() } : {},
555
+ children: [v && /* @__PURE__ */ L("div", {
556
+ className: l.loadingRow(),
557
+ "aria-hidden": "true",
558
+ children: [/* @__PURE__ */ I(E, { className: l.loadingIcon() }), u.loadingRow]
559
+ }), (t.children ?? []).map((e, t) => /* @__PURE__ */ I(K, {
560
+ node: e,
561
+ indexPath: [...r, t]
562
+ }, e.id))]
563
+ })]
564
+ }) : _ ? /* @__PURE__ */ L(R.Item, {
565
+ className: l.item({ class: l.retry() }),
566
+ "data-node-id": t.id,
567
+ "aria-posinset": o,
568
+ "aria-setsize": s,
569
+ children: [/* @__PURE__ */ I(ne, {
570
+ className: l.retryIcon(),
571
+ "aria-hidden": "true"
572
+ }), /* @__PURE__ */ I(R.ItemText, {
573
+ className: l.text(),
574
+ children: t.label
575
+ })]
576
+ }) : /* @__PURE__ */ L(R.Item, {
577
+ className: l.item({ class: h.reorderable ? l.dropTarget() : void 0 }),
578
+ "data-node-id": t.id,
579
+ "aria-keyshortcuts": h.reorderable ? de : void 0,
580
+ "aria-checked": f ? fe(C(e)) : void 0,
581
+ "aria-posinset": o,
582
+ "aria-setsize": s,
583
+ "data-match": y || void 0,
584
+ ...w(!1),
585
+ children: [f && /* @__PURE__ */ I(pe, {
586
+ own: b,
587
+ checked: S,
588
+ onToggle: () => d.toggleCheck(t.id)
589
+ }), D(e, R.ItemText)]
590
+ }) })
591
+ });
592
+ }
593
+ var q = U;
594
+ function me(e, t, n = []) {
595
+ for (let r of e) {
596
+ if ((r.id ?? r.value) === t) return [...n, r];
597
+ let e = r.children && me(r.children, t, [...n, r]);
598
+ if (e) return e;
599
+ }
600
+ }
601
+ //#endregion
602
+ export { me as a, G as i, K as n, se as o, q as r, H as s, W as t };
@@ -1,7 +1,7 @@
1
1
  import { chart as chartRecipe, type RecipeClasses } from '@wirecore/wirelayer-recipes';
2
2
  import { type ChartData, type ChartOptions, type ChartType, type Plugin } from 'chart.js/auto';
3
- import { type CSSProperties } from 'react';
4
- export interface ChartProps<TType extends ChartType> {
3
+ import { type ComponentProps, type CSSProperties } from 'react';
4
+ export interface ChartProps<TType extends ChartType> extends Omit<ComponentProps<'figure'>, 'title' | 'type'> {
5
5
  /** Chart.js chart type – it alone decides the types of `data`, `options` and `plugins` */
6
6
  type: TType;
7
7
  data: ChartData<NoInfer<TType>>;
@@ -27,5 +27,5 @@ export interface ChartProps<TType extends ChartType> {
27
27
  classes?: RecipeClasses<typeof chartRecipe>;
28
28
  }
29
29
  /** Canvas with role="img" named by the title; the data table is its text alternative (WCAG 1.1.1) */
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;
30
+ export declare function Chart<TType extends ChartType>({ classes, type, data, options, plugins, title, hideTitle, height, table, formatValue, className, style, ...rest }: ChartProps<TType>): import("react").JSX.Element;
31
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,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"}
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,EAAE,KAAK,cAAc,EAAsC,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIpG,MAAM,WAAW,UAAU,CAAC,KAAK,SAAS,SAAS,CAAE,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzG,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,EACL,GAAG,IAAI,EACV,EAAE,UAAU,CAAC,KAAK,CAAC,+BA8GnB"}
@@ -1,6 +1,6 @@
1
1
  import { chart as chartRecipe, type RecipeClasses, type PieSlice } from '@wirecore/wirelayer-recipes';
2
- import { type CSSProperties } from 'react';
3
- export interface PieChartProps {
2
+ import { type ComponentProps, type CSSProperties } from 'react';
3
+ export interface PieChartProps extends ComponentProps<'figure'> {
4
4
  /** The slices: label, value, colour */
5
5
  slices: readonly PieSlice[];
6
6
  /** Title of the chart, also its accessible name */
@@ -24,5 +24,5 @@ export interface PieChartProps {
24
24
  classes?: RecipeClasses<typeof chartRecipe>;
25
25
  }
26
26
  /** Pie or doughnut on a canvas named by the title; the legend lists value and share, the table is the text */
27
- export declare function PieChart({ slices, title, hideTitle, donut, height, legend, table, formatValue, options, className, style, classes, }: PieChartProps): import("react").JSX.Element;
27
+ export declare function PieChart({ slices, title, hideTitle, donut, height, legend, table, formatValue, options, className, style, classes, ...rest }: PieChartProps): import("react").JSX.Element;
28
28
  //# sourceMappingURL=PieChart.d.ts.map