@wirecore/wirelayer-react 0.5.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.
- package/dist/Button-Cd7lufvJ.js +60 -0
- package/dist/{ContextMenu-qh-bB9Lw.js → ContextMenu-CjDI7Jy5.js} +459 -451
- package/dist/{Field-hc416yJx.js → Field-DkYxlVar.js} +5 -2
- package/dist/{Highlight-DdTridk2.js → Highlight-CX30-nP7.js} +22 -18
- package/dist/{Input-OPRvjIYt.js → Input-D8U-Auys.js} +20 -19
- package/dist/{InputStatus-DS38XEkX.js → InputStatus-hVzkU_4q.js} +4 -1
- package/dist/{PasswordInput-B9k0GuSx.js → PasswordInput-DivSjtN8.js} +1 -1
- package/dist/{Select-PbxrUYi1.js → Select-Cx3KwSzU.js} +84 -83
- package/dist/{Tree-eqv4DIQn.js → Tree-BiPIkmwT.js} +2 -2
- package/dist/chart/Chart.d.ts +11 -5
- package/dist/chart/Chart.d.ts.map +1 -1
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart.js +43 -36
- package/dist/code.js +1 -1
- package/dist/components/Badge/Badge.d.ts +3 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +6 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/ChipGroup/ChipGroup.d.ts +1 -1
- package/dist/components/ChipGroup/ChipGroup.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +7 -2
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePickerBase.d.ts +3 -1
- package/dist/components/DatePicker/DatePickerBase.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +5 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Field/context.d.ts +3 -1
- package/dist/components/Field/context.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +9 -2
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +3 -1
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/MonthPicker/MonthPicker.d.ts +2 -0
- package/dist/components/MonthPicker/MonthPicker.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +7 -2
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +9 -2
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Toast/Toaster.d.ts +10 -2
- package/dist/components/Toast/Toaster.d.ts.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts +7 -1
- package/dist/components/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/dist/components/YearPicker/YearPicker.d.ts +2 -0
- package/dist/components/YearPicker/YearPicker.d.ts.map +1 -1
- package/dist/data-table/DataTable.d.ts +20 -2
- package/dist/data-table/DataTable.d.ts.map +1 -1
- package/dist/data-table/FilterMenu.d.ts +7 -1
- package/dist/data-table/FilterMenu.d.ts.map +1 -1
- package/dist/data-table/ValueInput.d.ts +8 -1
- package/dist/data-table/ValueInput.d.ts.map +1 -1
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.d.ts.map +1 -1
- package/dist/data-table/types.d.ts +29 -1
- package/dist/data-table/types.d.ts.map +1 -1
- package/dist/data-table.js +1214 -1139
- package/dist/editor.js +1 -1
- package/dist/form.js +3 -3
- package/dist/index.js +2606 -2578
- package/dist/pdf.js +5 -5
- package/dist/virtual.js +2 -2
- package/llms-full.txt +35 -11
- package/package.json +2 -2
- 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-
|
|
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: {
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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 ?
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
+
u,
|
|
142
|
+
d
|
|
143
|
+
]), m = _(() => a(p, n, r), [
|
|
144
|
+
p,
|
|
141
145
|
n,
|
|
142
146
|
r
|
|
143
|
-
]),
|
|
147
|
+
]), h = _(() => o(m), [m]);
|
|
144
148
|
return {
|
|
145
|
-
options:
|
|
146
|
-
visible:
|
|
147
|
-
groups:
|
|
148
|
-
ordered: _(() =>
|
|
149
|
-
firstFor: (e) => o(a(
|
|
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-
|
|
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,
|
|
11
|
-
let
|
|
12
|
-
variant:
|
|
13
|
-
color: i(
|
|
14
|
-
size:
|
|
15
|
-
shape:
|
|
16
|
-
}),
|
|
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
|
-
...
|
|
19
|
-
className:
|
|
20
|
-
type:
|
|
21
|
-
disabled:
|
|
22
|
-
"aria-label":
|
|
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
|
-
|
|
24
|
+
...r,
|
|
25
|
+
className: b.icon(),
|
|
25
26
|
"aria-hidden": "true"
|
|
26
|
-
}),
|
|
27
|
-
className:
|
|
27
|
+
}), x ? /* @__PURE__ */ p("span", {
|
|
28
|
+
className: b.badge(),
|
|
28
29
|
"aria-hidden": "true",
|
|
29
|
-
children: a(
|
|
30
|
-
}) :
|
|
31
|
-
className:
|
|
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({
|
|
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-
|
|
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-
|
|
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:
|
|
64
|
-
let
|
|
65
|
-
size:
|
|
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
|
-
}),
|
|
68
|
-
itemValue:
|
|
69
|
-
itemLabel:
|
|
70
|
-
itemDisabled:
|
|
67
|
+
}), L = e(), R = L.select, z = {
|
|
68
|
+
itemValue: ce,
|
|
69
|
+
itemLabel: le,
|
|
70
|
+
itemDisabled: S,
|
|
71
71
|
itemGroup: ue,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
itemKeywords: de,
|
|
73
|
+
valueKey: fe
|
|
74
|
+
}, [B, V] = ee(""), H = r({
|
|
74
75
|
items: v,
|
|
75
76
|
source: O,
|
|
76
|
-
accessors:
|
|
77
|
-
pageSize:
|
|
78
|
-
minSearchLength:
|
|
79
|
-
}), { options:
|
|
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:
|
|
84
|
-
items:
|
|
84
|
+
accessors: z,
|
|
85
|
+
items: G,
|
|
85
86
|
onChange: re
|
|
86
|
-
}), Ce =
|
|
87
|
+
}), Ce = q.join("\0");
|
|
87
88
|
d(() => {
|
|
88
|
-
|
|
89
|
+
H.resolve(q, G);
|
|
89
90
|
}, [Ce, O]);
|
|
90
|
-
let
|
|
91
|
-
items:
|
|
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
|
-
}), [
|
|
96
|
-
item:
|
|
97
|
-
itemText:
|
|
98
|
-
icon:
|
|
99
|
-
itemIndicator:
|
|
100
|
-
itemBody:
|
|
101
|
-
itemDescription:
|
|
102
|
-
group:
|
|
103
|
-
groupLabel:
|
|
104
|
-
loading:
|
|
105
|
-
loadingIcon:
|
|
106
|
-
sentinel:
|
|
107
|
-
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:
|
|
112
|
-
loading:
|
|
113
|
-
loadingText:
|
|
114
|
-
hasMore:
|
|
115
|
-
onLoadMore: () => O ?
|
|
116
|
-
emptyText:
|
|
117
|
-
renderItem:
|
|
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
|
|
120
|
-
|
|
120
|
+
function Ee(e) {
|
|
121
|
+
P?.(e), C && K.length && (e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), J([]));
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
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:
|
|
129
|
-
style:
|
|
130
|
-
collection:
|
|
131
|
-
value:
|
|
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 &&
|
|
135
|
+
e.open && H.open(), !e.open && B && (V(""), D?.(""), O && H.search(""));
|
|
135
136
|
},
|
|
136
|
-
disabled:
|
|
137
|
-
invalid:
|
|
138
|
-
required:
|
|
139
|
-
name:
|
|
140
|
-
...
|
|
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:
|
|
151
|
+
...C ? { className: I.control() } : {},
|
|
151
152
|
children: [/* @__PURE__ */ g(_.Trigger, {
|
|
152
|
-
...
|
|
153
|
-
className:
|
|
153
|
+
...F,
|
|
154
|
+
className: I.trigger(),
|
|
154
155
|
"aria-busy": w || void 0,
|
|
155
|
-
onKeyDown:
|
|
156
|
+
onKeyDown: Ee,
|
|
156
157
|
children: [/* @__PURE__ */ h("span", {
|
|
157
|
-
className:
|
|
158
|
-
children:
|
|
159
|
-
className:
|
|
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:
|
|
163
|
-
children:
|
|
163
|
+
placeholder: x ?? L.common.placeholder,
|
|
164
|
+
children: X?.label || void 0
|
|
164
165
|
})] })
|
|
165
166
|
}), /* @__PURE__ */ h(_.Indicator, {
|
|
166
|
-
className:
|
|
167
|
+
className: I.indicator(),
|
|
167
168
|
children: w ? /* @__PURE__ */ h(l, {
|
|
168
|
-
className:
|
|
169
|
+
className: I.spinner(),
|
|
169
170
|
"aria-hidden": "true"
|
|
170
171
|
}) : /* @__PURE__ */ h(c, {
|
|
171
|
-
className:
|
|
172
|
+
className: I.indicatorIcon(),
|
|
172
173
|
"aria-hidden": "true"
|
|
173
174
|
})
|
|
174
175
|
})]
|
|
175
|
-
}), C && /* @__PURE__ */ h(_.Context, { children: (e) =>
|
|
176
|
+
}), C && /* @__PURE__ */ h(_.Context, { children: (e) => X && !e.disabled && /* @__PURE__ */ h("button", {
|
|
176
177
|
type: "button",
|
|
177
178
|
tabIndex: -1,
|
|
178
|
-
className:
|
|
179
|
-
"aria-label":
|
|
179
|
+
className: I.clear(),
|
|
180
|
+
"aria-label": R.clear,
|
|
180
181
|
onClick: () => {
|
|
181
|
-
|
|
182
|
+
J([]), e.focus();
|
|
182
183
|
},
|
|
183
184
|
children: /* @__PURE__ */ h(u, {
|
|
184
|
-
className:
|
|
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:
|
|
191
|
-
"aria-busy":
|
|
192
|
-
"aria-label": T ?
|
|
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:
|
|
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":
|
|
205
|
-
placeholder:
|
|
206
|
-
value:
|
|
207
|
-
className:
|
|
208
|
-
onChange: (t) =>
|
|
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:
|
|
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:
|
|
227
|
-
children:
|
|
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-
|
|
4
|
-
import { t as i } from "./Highlight-
|
|
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";
|
package/dist/chart/Chart.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
8
|
-
|
|
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;
|
|
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"}
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -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,
|
|
10
|
-
let
|
|
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
|
-
}),
|
|
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(
|
|
18
|
+
let t = l(A.current);
|
|
17
19
|
return {
|
|
18
|
-
data: _(a,
|
|
19
|
-
options: v(a, t,
|
|
20
|
+
data: _(a, j.current.data, t),
|
|
21
|
+
options: v(a, t, j.current.options, e.matches, b)
|
|
20
22
|
};
|
|
21
|
-
}, 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
|
-
|
|
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
|
-
}, [
|
|
33
|
-
|
|
35
|
+
}, [
|
|
36
|
+
a,
|
|
37
|
+
b,
|
|
38
|
+
L
|
|
39
|
+
]), x(() => {
|
|
40
|
+
j.current = {
|
|
34
41
|
data: o,
|
|
35
42
|
options: s
|
|
36
|
-
},
|
|
43
|
+
}, M.current?.();
|
|
37
44
|
}, [o, s]), /* @__PURE__ */ E("figure", {
|
|
38
|
-
className:
|
|
39
|
-
style:
|
|
45
|
+
className: y.base({ class: h }),
|
|
46
|
+
style: g,
|
|
40
47
|
children: [
|
|
41
48
|
/* @__PURE__ */ T("figcaption", {
|
|
42
|
-
id: `${
|
|
43
|
-
className:
|
|
44
|
-
children:
|
|
49
|
+
id: `${k}title`,
|
|
50
|
+
className: d ? y.caption() : y.title(),
|
|
51
|
+
children: u
|
|
45
52
|
}),
|
|
46
53
|
/* @__PURE__ */ T("div", {
|
|
47
|
-
className:
|
|
48
|
-
style: { height:
|
|
54
|
+
className: y.canvasBox(),
|
|
55
|
+
style: { height: f },
|
|
49
56
|
children: /* @__PURE__ */ T("canvas", {
|
|
50
|
-
ref:
|
|
57
|
+
ref: A,
|
|
51
58
|
role: "img",
|
|
52
|
-
"aria-labelledby": `${
|
|
59
|
+
"aria-labelledby": `${k}title`
|
|
53
60
|
})
|
|
54
61
|
}),
|
|
55
|
-
|
|
56
|
-
className:
|
|
62
|
+
p && /* @__PURE__ */ E("details", {
|
|
63
|
+
className: y.details(),
|
|
57
64
|
children: [/* @__PURE__ */ T("summary", {
|
|
58
|
-
className:
|
|
59
|
-
children:
|
|
65
|
+
className: y.summary(),
|
|
66
|
+
children: O.chart.showTable
|
|
60
67
|
}), /* @__PURE__ */ T("div", {
|
|
61
|
-
className:
|
|
68
|
+
className: y.scroll(),
|
|
62
69
|
children: /* @__PURE__ */ E("table", {
|
|
63
|
-
className:
|
|
70
|
+
className: y.table(),
|
|
64
71
|
children: [
|
|
65
72
|
/* @__PURE__ */ T("caption", {
|
|
66
|
-
className:
|
|
67
|
-
children:
|
|
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:
|
|
72
|
-
children:
|
|
73
|
-
}),
|
|
78
|
+
className: y.th(),
|
|
79
|
+
children: O.chart.category
|
|
80
|
+
}), N.columns.map((e) => /* @__PURE__ */ T("th", {
|
|
74
81
|
scope: "col",
|
|
75
|
-
className:
|
|
82
|
+
className: y.th(),
|
|
76
83
|
children: e
|
|
77
84
|
}, e))] }) }),
|
|
78
|
-
/* @__PURE__ */ T("tbody", { children:
|
|
85
|
+
/* @__PURE__ */ T("tbody", { children: N.rows.map((e) => /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ T("th", {
|
|
79
86
|
scope: "row",
|
|
80
|
-
className:
|
|
87
|
+
className: y.rowHeader(),
|
|
81
88
|
children: e.label
|
|
82
89
|
}), e.values.map((e, t) => /* @__PURE__ */ T("td", {
|
|
83
|
-
className:
|
|
90
|
+
className: y.td(),
|
|
84
91
|
children: e
|
|
85
92
|
}, t))] }, e.label)) })
|
|
86
93
|
]
|