@mechane-ai/elements 0.39.0 → 0.41.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/NOTICE +11 -19
- package/README.md +49 -25
- package/dist/accessibility-P89UG9-r.js +25 -0
- package/dist/agent.js +1 -0
- package/dist/ai.js +50 -44
- package/dist/{categorical-values-BECG-J6R.js → categorical-values-DnGR_pQx.js} +3 -3
- package/dist/{chart-frame-CJFnI39T.js → chart-frame-BsyI1Zc8.js} +58 -57
- package/dist/{chart-input-DwAobO8Y.js → chart-input-r4S3-QCT.js} +2 -2
- package/dist/chart-navigation-D7OkLdSx.js +119 -0
- package/dist/charts/cartesian.js +560 -583
- package/dist/charts/distribution.js +218 -218
- package/dist/charts/graph.js +86 -85
- package/dist/charts/hierarchy.js +4 -4
- package/dist/charts/matrix.js +148 -147
- package/dist/charts/timeline.js +77 -76
- package/dist/charts.js +2 -2
- package/dist/code-block-C4K1sM9O.js +255 -0
- package/dist/collections.js +828 -607
- package/dist/constants.stylex-BILvnwUk.js +84 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +184 -77
- package/dist/{content-link-B3ObdyZY.js → content-link-CBDqSvgP.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/control-styles-D3q_Qyxi.js +179 -0
- package/dist/csp.js +14 -1
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +359 -245
- package/dist/forms-I-WMHTkr.js +139 -0
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +271 -241
- package/dist/navigation/commands.js +87 -76
- package/dist/{navigation-D2_sGy3C.js → navigation-CveMIuXI.js} +1 -1
- package/dist/navigation.js +2 -2
- package/dist/overlays.js +1 -1
- package/dist/packages/ai/src/message-action.d.ts +1 -1
- package/dist/packages/charts/src/chart-navigation.d.ts +18 -2
- package/dist/packages/charts/src/chart-surface.d.ts +23 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -2
- package/dist/packages/collections/src/data-table.d.ts +7 -2
- package/dist/packages/collections/src/index.d.ts +4 -1
- package/dist/packages/collections/src/query-controls.d.ts +18 -0
- package/dist/packages/collections/src/table-query.d.ts +64 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +3 -8
- package/dist/packages/content/src/pierre-theme.d.ts +0 -1
- package/dist/packages/core/src/actions.d.ts +15 -13
- package/dist/packages/core/src/copy-value.d.ts +3 -2
- package/dist/packages/core/src/disclosure.d.ts +14 -11
- package/dist/packages/feedback/src/notifications.d.ts +15 -15
- package/dist/packages/feedback/src/toast.d.ts +9 -3
- package/dist/packages/forms/src/combobox.d.ts +31 -41
- package/dist/packages/forms/src/dates/event-month.d.ts +17 -0
- package/dist/packages/forms/src/dates/index.d.ts +2 -0
- package/dist/packages/forms/src/field-styles.d.ts +0 -19
- package/dist/packages/forms/src/form-controls.d.ts +26 -24
- package/dist/packages/forms/src/forms.d.ts +17 -14
- package/dist/packages/forms/src/select-control.d.ts +6 -4
- package/dist/packages/forms/src/select.d.ts +14 -18
- package/dist/packages/forms/src/selection-state.d.ts +11 -0
- package/dist/packages/forms/src/selection-styles.d.ts +3 -0
- package/dist/packages/forms/src/selection.d.ts +21 -19
- package/dist/packages/foundations/src/agent/index.d.ts +2 -0
- package/dist/packages/foundations/src/control-state.d.ts +2 -3
- package/dist/packages/foundations/src/control-styles.d.ts +19 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +3 -0
- package/dist/packages/foundations/src/style-composition.d.ts +4 -1
- package/dist/packages/layout/src/app-shell.d.ts +12 -1
- package/dist/packages/layout/src/index.d.ts +1 -1
- package/dist/packages/layout/src/navigation-rail.d.ts +15 -2
- package/dist/packages/layout/src/resizable.d.ts +2 -2
- package/dist/packages/layout/src/sidebar.d.ts +4 -3
- package/dist/packages/navigation/src/tab-styles.d.ts +1 -1
- package/dist/packages/navigation/src/tabs.d.ts +12 -10
- package/dist/packages/overlays/src/alert-dialog.d.ts +19 -13
- package/dist/packages/overlays/src/dialog.d.ts +39 -24
- package/dist/packages/overlays/src/drawer.d.ts +16 -26
- package/dist/packages/overlays/src/menu.d.ts +37 -44
- package/dist/packages/overlays/src/overlay-root.d.ts +10 -0
- package/dist/packages/overlays/src/popover.d.ts +11 -20
- package/dist/packages/overlays/src/preview.d.ts +6 -13
- package/dist/packages/overlays/src/tooltip.d.ts +12 -15
- package/dist/{pierre-diff-CaPsfQRo.js → pierre-diff-DJ3oOfPX.js} +5 -5
- package/dist/{src-DPRmO-JY.js → src-CNV1ewzb.js} +379 -407
- package/dist/{src-CSWIG_op.js → src-CQQvXi7a.js} +58 -81
- package/dist/{src-DWjAoOyd.js → src-D2OHco8V.js} +42 -41
- package/dist/src-DfOAlAd2.js +750 -0
- package/dist/src-na2DdkKI.js +561 -0
- package/dist/{src-C-Sx37kz.js → src-s3tWwnN4.js} +361 -518
- package/dist/styles.js +3 -0
- package/dist/{elements.css → styles2.css} +195 -97
- package/dist/tokens.js +3 -1
- package/dist/{tokens.stylex-CJbIDPB9.js → tokens.stylex-dF5CACEJ.js} +13 -93
- package/package.json +8 -9
- package/skills/elements-workspace/SKILL.md +12 -0
- package/dist/accessibility-C-aIZ1Yx.js +0 -15
- package/dist/chart-navigation-CBIeNtJq.js +0 -67
- package/dist/code-block-aC0Htt4N.js +0 -184
- package/dist/forms-BQQFas9g.js +0 -118
- package/dist/foundations.css +0 -7
- package/dist/packages/content/src/tree/pierre-tree.d.ts +0 -3
- package/dist/pierre-theme-BpNaWn1x.js +0 -126
- package/dist/pierre-tree-CYCRjdGG.js +0 -106
- package/dist/src-d7EAi61b.js +0 -617
- package/dist/src-nkgFDl-g.js +0 -1171
- package/dist/style-composition-uYlczSsB.js +0 -9
- package/styles.css +0 -2
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as e } from "./header-styles-COxCYFZx.js";
|
|
2
|
-
import { c as t, f as n, h as r } from "./src-
|
|
2
|
+
import { c as t, f as n, h as r } from "./src-DfOAlAd2.js";
|
|
3
3
|
import * as i from "@stylexjs/stylex";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Button as a } from "@ui-sdk/react/button";
|
|
5
|
+
import { Children as o, useId as s } from "react";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
7
|
// packages/charts/src/chart-heading.tsx
|
|
7
|
-
var
|
|
8
|
+
var d = { root: {
|
|
8
9
|
k1C7PZ: "x8zbtdt",
|
|
9
10
|
khm7nJ: "x1gkm1c7",
|
|
10
11
|
kMwMTN: "xbixft",
|
|
@@ -13,28 +14,28 @@ var u = { root: {
|
|
|
13
14
|
kLWn49: "x1778rvt",
|
|
14
15
|
$$css: !0
|
|
15
16
|
} };
|
|
16
|
-
function
|
|
17
|
-
let s =
|
|
17
|
+
function f({ title: t, id: n, meta: r, actions: a }) {
|
|
18
|
+
let s = o.toArray(r).length > 0, c = o.toArray(a).length > 0, f = s || c, p = s && /* @__PURE__ */ l("div", {
|
|
18
19
|
...i.props(e.meta),
|
|
19
20
|
children: r
|
|
20
|
-
}), m =
|
|
21
|
+
}), m = c && /* @__PURE__ */ l("div", {
|
|
21
22
|
...i.props(e.actions),
|
|
22
|
-
children:
|
|
23
|
+
children: a
|
|
23
24
|
});
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
...i.props(e.row, e.reportRow,
|
|
26
|
-
children: [/* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ u("div", {
|
|
26
|
+
...i.props(e.row, e.reportRow, d.root),
|
|
27
|
+
children: [/* @__PURE__ */ l("p", {
|
|
27
28
|
id: n,
|
|
28
29
|
...i.props(e.title),
|
|
29
30
|
children: t
|
|
30
|
-
}), f && /* @__PURE__ */
|
|
31
|
+
}), f && /* @__PURE__ */ u("div", {
|
|
31
32
|
...i.props(e.trailing),
|
|
32
33
|
children: [p, m]
|
|
33
34
|
})]
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
// packages/charts/src/chart-series-marker.tsx
|
|
37
|
-
var
|
|
38
|
+
var p = {
|
|
38
39
|
root: {
|
|
39
40
|
k1xSpc: "x3nfvp2",
|
|
40
41
|
kGNEyG: "x6s0dn4",
|
|
@@ -58,124 +59,124 @@ var f = {
|
|
|
58
59
|
$$css: !0
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
|
-
function
|
|
62
|
-
let r =
|
|
63
|
-
return /* @__PURE__ */
|
|
62
|
+
function m({ tone: e, children: n }) {
|
|
63
|
+
let r = o.toArray(n).length > 0;
|
|
64
|
+
return /* @__PURE__ */ l("span", {
|
|
64
65
|
"aria-hidden": !0,
|
|
65
66
|
inert: !0,
|
|
66
|
-
...i.props(
|
|
67
|
+
...i.props(p.root, p.color(t[e]), r ? p.icon : p.swatch),
|
|
67
68
|
children: n
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
// packages/charts/src/chart-series-summary.tsx
|
|
71
|
-
function
|
|
72
|
-
return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */
|
|
72
|
+
function h({ series: e, values: t }) {
|
|
73
|
+
return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */ l("dl", {
|
|
73
74
|
"aria-label": "Period summary",
|
|
74
75
|
className: "x78zum5 x1a02dak xaml1ju x1ghz6dp xeuugli",
|
|
75
|
-
children: e.map((e, r) => /* @__PURE__ */
|
|
76
|
+
children: e.map((e, r) => /* @__PURE__ */ u("div", {
|
|
76
77
|
...{
|
|
77
78
|
0: { className: "xeuugli" },
|
|
78
79
|
1: { className: "xeuugli xo02m6d xpilrb4 x1t7ytsu x97x49r" }
|
|
79
80
|
}[r > 0 | 0],
|
|
80
|
-
children: [/* @__PURE__ */
|
|
81
|
+
children: [/* @__PURE__ */ u("dt", {
|
|
81
82
|
className: "x78zum5 x6s0dn4 xunmzkg x153jb6y xy8obcc",
|
|
82
|
-
children: [/* @__PURE__ */
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
|
|
84
|
+
}), /* @__PURE__ */ l("dd", {
|
|
84
85
|
className: "x1ghz6dp xbixft x71lla1 xgkpprq xk4h15q x1wjjqco xss6m8b xj0a0fe",
|
|
85
|
-
children: t[e.id] === void 0 ? /* @__PURE__ */
|
|
86
|
+
children: t[e.id] === void 0 ? /* @__PURE__ */ l(n, { width: "6ch" }) : t[e.id]
|
|
86
87
|
})]
|
|
87
88
|
}, e.id))
|
|
88
|
-
}) : /* @__PURE__ */
|
|
89
|
+
}) : /* @__PURE__ */ l(r, {
|
|
89
90
|
hasError: !0,
|
|
90
91
|
children: "Period values must match the chart series identifiers."
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
// packages/charts/src/chart-frame.tsx
|
|
94
|
-
function
|
|
95
|
-
let g =
|
|
95
|
+
function g({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
|
|
96
|
+
let g = s();
|
|
96
97
|
if (p !== void 0) {
|
|
97
|
-
let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */
|
|
98
|
-
series:
|
|
98
|
+
let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(h, {
|
|
99
|
+
series: m,
|
|
99
100
|
values: p.seriesValues
|
|
100
|
-
}), i = e != null && e !== !1,
|
|
101
|
-
return /* @__PURE__ */
|
|
101
|
+
}), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, _ = /* @__PURE__ */ u(c, { children: [p.actions, a] });
|
|
102
|
+
return /* @__PURE__ */ u("figure", {
|
|
102
103
|
"aria-labelledby": g,
|
|
103
104
|
className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt xmkeg23 x1y0btm7 x1ey3b81",
|
|
104
|
-
children: [/* @__PURE__ */
|
|
105
|
+
children: [/* @__PURE__ */ l("figcaption", { children: /* @__PURE__ */ l(f, {
|
|
105
106
|
id: g,
|
|
106
107
|
title: t,
|
|
107
108
|
meta: p.meta,
|
|
108
|
-
actions:
|
|
109
|
-
}) }), /* @__PURE__ */
|
|
109
|
+
actions: s && _
|
|
110
|
+
}) }), /* @__PURE__ */ u("div", {
|
|
110
111
|
className: "xeuugli xg7ukam",
|
|
111
112
|
children: [
|
|
112
|
-
i && /* @__PURE__ */
|
|
113
|
+
i && /* @__PURE__ */ l("div", {
|
|
113
114
|
className: "x1xxlxpq xeuugli",
|
|
114
115
|
children: e
|
|
115
116
|
}),
|
|
116
|
-
n !== void 0 && /* @__PURE__ */
|
|
117
|
+
n !== void 0 && /* @__PURE__ */ l("p", {
|
|
117
118
|
className: "x1ghz6dp x1c87qhr x153jb6y xy8obcc xas2l8k",
|
|
118
119
|
children: n
|
|
119
120
|
}),
|
|
120
121
|
r,
|
|
121
|
-
|
|
122
|
+
d !== void 0 && /* @__PURE__ */ l("div", {
|
|
122
123
|
className: "x1xxf3xd xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
123
|
-
children:
|
|
124
|
+
children: d
|
|
124
125
|
})
|
|
125
126
|
]
|
|
126
127
|
})]
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ u("figure", {
|
|
130
131
|
"aria-labelledby": g,
|
|
131
132
|
className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt",
|
|
132
133
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ u("figcaption", {
|
|
134
135
|
className: "x78zum5 x1a02dak x1qughib x7a106z x1n8ia3y x1wv5www",
|
|
135
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ u("div", {
|
|
136
137
|
className: "x1cqoux5 xeuugli xj0a0fe",
|
|
137
|
-
children: [/* @__PURE__ */
|
|
138
|
+
children: [/* @__PURE__ */ l("p", {
|
|
138
139
|
id: g,
|
|
139
140
|
className: "x1ghz6dp x12myhf4 x1778rvt xk4h15q",
|
|
140
141
|
children: t
|
|
141
|
-
}), n !== void 0 && /* @__PURE__ */
|
|
142
|
+
}), n !== void 0 && /* @__PURE__ */ l("p", {
|
|
142
143
|
className: "x1ghz6dp x1c87qhr x153jb6y xy8obcc xas2l8k",
|
|
143
144
|
children: n
|
|
144
145
|
})]
|
|
145
|
-
}),
|
|
146
|
+
}), a !== void 0 && /* @__PURE__ */ l("div", {
|
|
146
147
|
...i.props(e.actions),
|
|
147
|
-
children:
|
|
148
|
+
children: a
|
|
148
149
|
})]
|
|
149
150
|
}),
|
|
150
151
|
r,
|
|
151
|
-
|
|
152
|
+
d !== void 0 && /* @__PURE__ */ l("div", {
|
|
152
153
|
className: "x1xxf3xd xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
153
|
-
children:
|
|
154
|
+
children: d
|
|
154
155
|
})
|
|
155
156
|
]
|
|
156
157
|
});
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
-
return /* @__PURE__ */
|
|
159
|
+
function _({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
|
|
160
|
+
return /* @__PURE__ */ l("ul", {
|
|
160
161
|
"aria-label": t,
|
|
161
162
|
...{
|
|
162
163
|
0: { className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 xe8uvvx x1ghz6dp x1717udv x153jb6y x1hz01jw xy8obcc xas2l8k" },
|
|
163
164
|
1: { className: "x78zum5 x8zbtdt x1gkm1c7 xe8uvvx x1ghz6dp x1717udv x153jb6y x1hz01jw xy8obcc xas2l8k xozqiw3 xw2csxc x1mqbd49" }
|
|
164
165
|
}[!!n | 0],
|
|
165
|
-
children: e.map((e) => /* @__PURE__ */
|
|
166
|
+
children: e.map((e) => /* @__PURE__ */ u("li", {
|
|
166
167
|
...{
|
|
167
168
|
0: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli x193iq5w xj0a0fe" },
|
|
168
169
|
1: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli xj0a0fe x2lah0s x1x1rfll xuxw1ft" }
|
|
169
170
|
}[!!n | 0],
|
|
170
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
|
|
171
172
|
}, e.id))
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
-
return n === void 0 ? /* @__PURE__ */
|
|
175
|
+
function v({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
|
|
176
|
+
return n === void 0 ? /* @__PURE__ */ l("div", {
|
|
176
177
|
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x8zbtdt x1gkm1c7 xeuugli x17tes2r x17oiadl x9f619 xh8yej3 xc342km x1hmw7ec x5g2kb4 x1hz01jw xtqrqnz xj57cvi x1778rvt x1yc453h xj0a0fe xbixft xpvm0e4 xss6m8b",
|
|
177
178
|
children: r
|
|
178
|
-
}) : /* @__PURE__ */
|
|
179
|
+
}) : /* @__PURE__ */ l(a, {
|
|
179
180
|
type: "button",
|
|
180
181
|
"aria-label": e,
|
|
181
182
|
"aria-pressed": t,
|
|
@@ -187,12 +188,12 @@ function _({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
|
|
|
187
188
|
children: r
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
-
return /* @__PURE__ */
|
|
191
|
+
function y({ children: e, id: t }) {
|
|
192
|
+
return /* @__PURE__ */ l("p", {
|
|
192
193
|
id: t,
|
|
193
194
|
"aria-live": "polite",
|
|
194
195
|
className: "x1ghz6dp xeuugli x1mqbd49 xbixft xy8obcc xas2l8k xss6m8b xj0a0fe",
|
|
195
196
|
children: e
|
|
196
197
|
});
|
|
197
198
|
}
|
|
198
|
-
export {
|
|
199
|
+
export { m as a, y as i, g as n, _ as r, v as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as e } from "./src-
|
|
2
|
-
import { n as t } from "./chart-frame-
|
|
1
|
+
import { h as e } from "./src-DfOAlAd2.js";
|
|
2
|
+
import { n as t } from "./chart-frame-BsyI1Zc8.js";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
// packages/charts/src/chart-input.tsx
|
|
5
5
|
function r(e) {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { t as e } from "./accessibility-P89UG9-r.js";
|
|
2
|
+
import * as t from "@stylexjs/stylex";
|
|
3
|
+
import { createParts as n } from "@ui-sdk/react/primitive";
|
|
4
|
+
import { useId as r, useState as i } from "react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { definePrimitive as s } from "@ui-sdk/core";
|
|
7
|
+
// packages/charts/src/chart-data.tsx
|
|
8
|
+
function c({ label: n, columns: r, rows: i }) {
|
|
9
|
+
return /* @__PURE__ */ a("div", {
|
|
10
|
+
...t.props(e.hidden),
|
|
11
|
+
children: /* @__PURE__ */ o("table", { children: [
|
|
12
|
+
/* @__PURE__ */ a("caption", { children: n }),
|
|
13
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: r.map((e) => /* @__PURE__ */ a("th", {
|
|
14
|
+
scope: "col",
|
|
15
|
+
children: e.label
|
|
16
|
+
}, e.id)) }) }),
|
|
17
|
+
/* @__PURE__ */ a("tbody", { children: i.map((e) => /* @__PURE__ */ a("tr", { children: r.map((t, n) => n === 0 ? /* @__PURE__ */ a("th", {
|
|
18
|
+
scope: "row",
|
|
19
|
+
children: e.values[n]
|
|
20
|
+
}, t.id) : /* @__PURE__ */ a("td", { children: e.values[n] }, t.id)) }, e.id)) })
|
|
21
|
+
] })
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// packages/charts/src/chart-surface.tsx
|
|
25
|
+
var l = /* @__PURE__ */ new Set([" ", "Enter"]);
|
|
26
|
+
function u({ controls: e }) {
|
|
27
|
+
return { value: e.inspected ?? null };
|
|
28
|
+
}
|
|
29
|
+
var d = s({
|
|
30
|
+
name: "chart-inspection",
|
|
31
|
+
options: { controls: "value" },
|
|
32
|
+
state: u,
|
|
33
|
+
sync: u,
|
|
34
|
+
api: ({ options: e }) => {
|
|
35
|
+
function t(t) {
|
|
36
|
+
let { items: n, onInspect: r } = e().controls;
|
|
37
|
+
return n.some((e) => e.id === t) ? (r(t), !0) : !1;
|
|
38
|
+
}
|
|
39
|
+
function n(t) {
|
|
40
|
+
let { items: n, onSelect: r } = e().controls;
|
|
41
|
+
return r === void 0 || !n.some((e) => e.id === t) ? !1 : (r(t), !0);
|
|
42
|
+
}
|
|
43
|
+
function r(t) {
|
|
44
|
+
let { items: r, cursor: i, allowVerticalNavigation: a, onDismiss: o } = e().controls, s = t.altKey || t.ctrlKey || t.metaKey;
|
|
45
|
+
if (t.defaultPrevented || s || r.length === 0) return;
|
|
46
|
+
if (t.key === "Escape") {
|
|
47
|
+
t.preventDefault(), t.stopPropagation(), o();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (l.has(t.key)) {
|
|
51
|
+
if (t.target instanceof Element && t.target.closest("button, a, input, select, textarea") !== null) return;
|
|
52
|
+
i !== void 0 && n(i) && t.preventDefault();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let c = r.findIndex((e) => e.id === i), u = r.length - 1, d = {
|
|
56
|
+
Home: 0,
|
|
57
|
+
End: u,
|
|
58
|
+
ArrowLeft: Math.max(0, c - 1),
|
|
59
|
+
ArrowRight: Math.min(u, c + 1),
|
|
60
|
+
ArrowUp: a === !0 ? Math.max(0, c - 1) : void 0,
|
|
61
|
+
ArrowDown: a === !0 ? Math.min(u, c + 1) : void 0
|
|
62
|
+
}[t.key], f = d === void 0 ? void 0 : r[d];
|
|
63
|
+
f !== void 0 && (t.preventDefault(), e().controls.onInspect(f.id));
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
setValue: t,
|
|
67
|
+
get selectItem() {
|
|
68
|
+
return e().controls.onSelect === void 0 ? void 0 : n;
|
|
69
|
+
},
|
|
70
|
+
clear: () => e().controls.onDismiss(),
|
|
71
|
+
items: () => e().controls.items.map(({ id: e, label: t }) => ({
|
|
72
|
+
value: e,
|
|
73
|
+
label: t
|
|
74
|
+
})),
|
|
75
|
+
onKeyDown: r
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
slots: (e) => ({ root: e({ on: { keydown: (e, { api: t }) => t.onKeyDown(e) } }) }),
|
|
79
|
+
agent: {
|
|
80
|
+
items: (e) => e.items(),
|
|
81
|
+
closed: !0
|
|
82
|
+
}
|
|
83
|
+
}), f = n(d, { root: "div" }).Root, p = n(d, { root: "p" }).Root, m = n(d, { root: "svg" }).Root;
|
|
84
|
+
// packages/charts/src/chart-navigation.tsx
|
|
85
|
+
function h({ title: e, items: t, selection: n }) {
|
|
86
|
+
let a = r(), [o, s] = i(void 0), [c, l] = i(!1), u = t[Math.max(0, t.findIndex((e) => e.id === (o ?? n?.selectedId)))];
|
|
87
|
+
function d(e) {
|
|
88
|
+
s(e), l(!0);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
id: a,
|
|
92
|
+
props: {
|
|
93
|
+
controls: {
|
|
94
|
+
items: t,
|
|
95
|
+
cursor: u?.id,
|
|
96
|
+
inspected: c ? u?.id : void 0,
|
|
97
|
+
allowVerticalNavigation: !0,
|
|
98
|
+
onInspect: d,
|
|
99
|
+
onDismiss: () => l(!1),
|
|
100
|
+
onSelect: n?.onSelect
|
|
101
|
+
},
|
|
102
|
+
role: "group",
|
|
103
|
+
tabIndex: t.length > 0 ? 0 : void 0,
|
|
104
|
+
"aria-label": `${e}. Use arrow keys to inspect.${n === void 0 ? "" : " Press Enter to select."}`,
|
|
105
|
+
"aria-describedby": a,
|
|
106
|
+
onFocus: () => l(!0),
|
|
107
|
+
onBlur: (e) => {
|
|
108
|
+
e.currentTarget.contains(e.relatedTarget) || l(!1);
|
|
109
|
+
},
|
|
110
|
+
onPointerLeave: (e) => {
|
|
111
|
+
e.currentTarget.contains(document.activeElement) || l(!1);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
activeId: u?.id,
|
|
115
|
+
label: c ? u?.label : void 0,
|
|
116
|
+
inspect: d
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export { c as a, p as i, f as n, m as r, h as t };
|