@mechane-ai/elements 0.42.0 → 0.43.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 (44) hide show
  1. package/README.md +32 -32
  2. package/dist/catalog.json +89 -1
  3. package/dist/{categorical-values-B6lGI7BH.js → categorical-values-DzhbfZ5w.js} +2 -2
  4. package/dist/{chart-frame-D0enjyj9.js → chart-frame-9dQQNF3F.js} +73 -21
  5. package/dist/{chart-input-D4_Awave.js → chart-input-DT0STflx.js} +1 -1
  6. package/dist/{chart-navigation-D4-pdgpj.js → chart-navigation-BAbb5PV9.js} +56 -32
  7. package/dist/charts/cartesian.js +1696 -547
  8. package/dist/charts/distribution.js +4 -4
  9. package/dist/charts/graph.js +442 -75
  10. package/dist/charts/hierarchy.js +4 -4
  11. package/dist/charts/matrix.js +231 -62
  12. package/dist/charts/timeline.js +2 -2
  13. package/dist/charts.js +1 -1
  14. package/dist/label-spacing-BncjePGb.js +6 -0
  15. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  16. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  17. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  18. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  19. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  20. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  21. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  22. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  23. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  24. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  25. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  26. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  27. package/dist/packages/charts/src/chart-inspection.d.ts +3 -1
  28. package/dist/packages/charts/src/chart-navigation.d.ts +3 -1
  29. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  30. package/dist/packages/charts/src/chart-surface.d.ts +2 -0
  31. package/dist/packages/charts/src/chart-theme.d.ts +26 -0
  32. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  33. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  34. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  35. package/dist/packages/charts/src/index.d.ts +1 -1
  36. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  37. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  38. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  39. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  40. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  41. package/dist/{plot-width-BQQS-mw9.js → plot-width-DzCmthQW.js} +28 -0
  42. package/dist/styles2.css +115 -0
  43. package/package.json +1 -1
  44. package/recipes/allocation-report.tsx +115 -0
package/README.md CHANGED
@@ -96,38 +96,38 @@ emitted layers and selector specificity.
96
96
 
97
97
  Every path below belongs to `@mechane-ai/elements`. There is one package, version, and stylesheet.
98
98
 
99
- | Entry | Responsibility |
100
- | ---------------------- | ----------------------------------------------------------------------------------- |
101
- | Root | Buttons, text, surfaces, disclosure, avatars, and CopyValue. |
102
- | `/forms` | Fields, inputs, selection, appearance picking, file picking, and settings sections. |
103
- | `/forms/dates` | Civil-date pickers, range selection, and a controlled event month. |
104
- | `/overlays` | Dialog, Drawer, Menu, Popover, Preview, Tooltip, and AlertDialog. |
105
- | `/feedback` | Async regions, skeletons, progress, meters, notices, empty states, and toasts. |
106
- | `/navigation` | Tabs, page navigation, breadcrumbs, skip links, and shortcut labels. |
107
- | `/navigation/commands` | Command palette and scoped application-owned shortcuts. |
108
- | `/layout` | Application shell, sidebar, toolbars, compound record pages, and resizable panes. |
109
- | `/collections` | Tables, inspectors, collection controls, timelines, metrics, and timestamps. |
110
- | `/content` | Trace, JSON, recorded logs, and stack traces. |
111
- | `/content/link` | Safe content links without a renderer dependency. |
112
- | `/content/markdown` | Completed and streaming Markdown, embedded headings, and inert previews. |
113
- | `/content/code` | Source-preserving code highlighting. |
114
- | `/content/diff` | File changes and patches. |
115
- | `/content/tree` | File paths, statuses, and controlled selection. |
116
- | `/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
117
- | `/charts` | Shared frames, legends, selection, and category types. |
118
- | `/charts/cartesian` | Lines, areas, sparklines, small multiples, bars, and scatter plots. |
119
- | `/charts/distribution` | Histograms, cumulative distributions, intervals, and ranked values. |
120
- | `/charts/matrix` | Matrices, token heatmaps, and color legends. |
121
- | `/charts/graph` | Supplied relationships and node selection. |
122
- | `/charts/hierarchy` | Treemaps. |
123
- | `/charts/timeline` | Waterfall intervals and instants. |
124
- | `/theme` | Light and dark theme props. |
125
- | `/agent` | Optional UI SDK bridge for a host that enables component inspection and actions. |
126
- | `/csp` | Application-supplied content security policy configuration. |
127
- | `/tokens` | Compiled token references for runtime styles. |
128
- | `/tokens.stylex` | Variable definitions for StyleX authoring and themes. |
129
- | `/constants.stylex` | Compile-time conditions, palette values, layers, and shared geometry. |
130
- | `/styles.css` | Component styles and token defaults. |
99
+ | Entry | Responsibility |
100
+ | ---------------------- | ------------------------------------------------------------------------------------ |
101
+ | Root | Buttons, text, surfaces, disclosure, avatars, and CopyValue. |
102
+ | `/forms` | Fields, inputs, selection, appearance picking, file picking, and settings sections. |
103
+ | `/forms/dates` | Civil-date pickers, range selection, and a controlled event month. |
104
+ | `/overlays` | Dialog, Drawer, Menu, Popover, Preview, Tooltip, and AlertDialog. |
105
+ | `/feedback` | Async regions, skeletons, progress, meters, notices, empty states, and toasts. |
106
+ | `/navigation` | Tabs, page navigation, breadcrumbs, skip links, and shortcut labels. |
107
+ | `/navigation/commands` | Command palette and scoped application-owned shortcuts. |
108
+ | `/layout` | Application shell, sidebar, toolbars, compound record pages, and resizable panes. |
109
+ | `/collections` | Tables, inspectors, collection controls, timelines, metrics, and timestamps. |
110
+ | `/content` | Trace, JSON, recorded logs, and stack traces. |
111
+ | `/content/link` | Safe content links without a renderer dependency. |
112
+ | `/content/markdown` | Completed and streaming Markdown, embedded headings, and inert previews. |
113
+ | `/content/code` | Source-preserving code highlighting. |
114
+ | `/content/diff` | File changes and patches. |
115
+ | `/content/tree` | File paths, statuses, and controlled selection. |
116
+ | `/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
117
+ | `/charts` | Shared frames, legends, selection, and category types. |
118
+ | `/charts/cartesian` | Lines, ranges, areas, sparklines, small multiples, bars, bridges, and scatter plots. |
119
+ | `/charts/distribution` | Histograms, cumulative distributions, intervals, and ranked values. |
120
+ | `/charts/matrix` | Matrices, compact strips, token heatmaps, and color legends. |
121
+ | `/charts/graph` | Supplied relationships, weighted flows, and selection. |
122
+ | `/charts/hierarchy` | Treemaps. |
123
+ | `/charts/timeline` | Waterfall intervals and instants. |
124
+ | `/theme` | Light and dark theme props. |
125
+ | `/agent` | Optional UI SDK bridge for a host that enables component inspection and actions. |
126
+ | `/csp` | Application-supplied content security policy configuration. |
127
+ | `/tokens` | Compiled token references for runtime styles. |
128
+ | `/tokens.stylex` | Variable definitions for StyleX authoring and themes. |
129
+ | `/constants.stylex` | Compile-time conditions, palette values, layers, and shared geometry. |
130
+ | `/styles.css` | Component styles and token defaults. |
131
131
 
132
132
  Focused entries keep renderer and chart dependencies out of basic controls. There is no all-components barrel. Renderers
133
133
  initialize when used, without a consumer-managed worker pool or grammar CDN. The
package/dist/catalog.json CHANGED
@@ -1,7 +1,23 @@
1
1
  {
2
2
  "package": "@mechane-ai/elements",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "recipes": [
5
+ {
6
+ "slug": "allocation-report",
7
+ "title": "Allocation Report",
8
+ "description": "Explain how one total divides among commitments and what remains, with the parts strip above one explanatory chart. Use a BridgeChart for the path from total to remainder, or a FlowDiagram when commitments divide again. Give each commitment one tone everywhere; the application computes amounts and writes the report's one-sentence headline.",
9
+ "path": "recipes/allocation-report.tsx",
10
+ "story": "recipes-allocation-report--example",
11
+ "imports": [
12
+ "import { Stack, Text } from '@mechane-ai/elements';",
13
+ "import type { ChartTone } from '@mechane-ai/elements/charts';",
14
+ "import { BreakdownBar, BridgeChart } from '@mechane-ai/elements/charts/cartesian';",
15
+ "import type { BridgeStep, ChartReferenceLine } from '@mechane-ai/elements/charts/cartesian';",
16
+ "import { FlowDiagram } from '@mechane-ai/elements/charts/graph';",
17
+ "import type { FlowLink, FlowNode } from '@mechane-ai/elements/charts/graph';",
18
+ "import { PageContent, PageLayout } from '@mechane-ai/elements/layout';"
19
+ ]
20
+ },
5
21
  {
6
22
  "slug": "consequential-form",
7
23
  "title": "Consequential Form",
@@ -1371,6 +1387,10 @@
1371
1387
  "kind": "value",
1372
1388
  "declaration": "dist/packages/foundations/src/chart-tones.d.ts"
1373
1389
  },
1390
+ "ChartMarkShape": {
1391
+ "kind": "type",
1392
+ "declaration": "dist/packages/charts/src/chart-series-marker.d.ts"
1393
+ },
1374
1394
  "ChartSeriesMarkerProps": {
1375
1395
  "kind": "type",
1376
1396
  "declaration": "dist/packages/charts/src/chart-series-marker.d.ts"
@@ -1401,6 +1421,14 @@
1401
1421
  "kind": "type",
1402
1422
  "declaration": "dist/packages/charts/src/cartesian/bar-chart.d.ts"
1403
1423
  },
1424
+ "BarMarker": {
1425
+ "kind": "type",
1426
+ "declaration": "dist/packages/charts/src/cartesian/bar-chart.d.ts"
1427
+ },
1428
+ "BarAnnotation": {
1429
+ "kind": "type",
1430
+ "declaration": "dist/packages/charts/src/cartesian/bar-chart.d.ts"
1431
+ },
1404
1432
  "BarChart": {
1405
1433
  "kind": "value",
1406
1434
  "declaration": "dist/packages/charts/src/cartesian/bar-chart.d.ts"
@@ -1417,6 +1445,22 @@
1417
1445
  "kind": "value",
1418
1446
  "declaration": "dist/packages/charts/src/cartesian/breakdown-bar.d.ts"
1419
1447
  },
1448
+ "BridgeChartProps": {
1449
+ "kind": "type",
1450
+ "declaration": "dist/packages/charts/src/cartesian/bridge-chart.d.ts"
1451
+ },
1452
+ "BridgeStep": {
1453
+ "kind": "type",
1454
+ "declaration": "dist/packages/charts/src/cartesian/bridge-chart.d.ts"
1455
+ },
1456
+ "BridgeChart": {
1457
+ "kind": "value",
1458
+ "declaration": "dist/packages/charts/src/cartesian/bridge-chart.d.ts"
1459
+ },
1460
+ "ChartReferenceLine": {
1461
+ "kind": "type",
1462
+ "declaration": "dist/packages/charts/src/cartesian/reference-lines.d.ts"
1463
+ },
1420
1464
  "ScatterPoint": {
1421
1465
  "kind": "type",
1422
1466
  "declaration": "dist/packages/charts/src/cartesian/scatter-plot.d.ts"
@@ -1445,6 +1489,10 @@
1445
1489
  "kind": "type",
1446
1490
  "declaration": "dist/packages/charts/src/cartesian/sparkline.d.ts"
1447
1491
  },
1492
+ "SparklinePoint": {
1493
+ "kind": "type",
1494
+ "declaration": "dist/packages/charts/src/cartesian/sparkline.d.ts"
1495
+ },
1448
1496
  "Sparkline": {
1449
1497
  "kind": "value",
1450
1498
  "declaration": "dist/packages/charts/src/cartesian/sparkline.d.ts"
@@ -1465,6 +1513,22 @@
1465
1513
  "kind": "value",
1466
1514
  "declaration": "dist/packages/charts/src/cartesian/time-series-data.d.ts"
1467
1515
  },
1516
+ "TimeSeriesBand": {
1517
+ "kind": "type",
1518
+ "declaration": "dist/packages/charts/src/cartesian/time-series-bands.d.ts"
1519
+ },
1520
+ "TimeSeriesBandPoint": {
1521
+ "kind": "type",
1522
+ "declaration": "dist/packages/charts/src/cartesian/time-series-bands.d.ts"
1523
+ },
1524
+ "TimeSeriesCrossing": {
1525
+ "kind": "type",
1526
+ "declaration": "dist/packages/charts/src/cartesian/time-series-bands.d.ts"
1527
+ },
1528
+ "timeSeriesBandLimits": {
1529
+ "kind": "value",
1530
+ "declaration": "dist/packages/charts/src/cartesian/time-series-bands.d.ts"
1531
+ },
1468
1532
  "TimeSeriesChartProps": {
1469
1533
  "kind": "type",
1470
1534
  "declaration": "dist/packages/charts/src/cartesian/time-series.d.ts"
@@ -1611,6 +1675,30 @@
1611
1675
  }
1612
1676
  },
1613
1677
  "@mechane-ai/elements/charts/graph": {
1678
+ "FlowDiagramProps": {
1679
+ "kind": "type",
1680
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1681
+ },
1682
+ "FlowLink": {
1683
+ "kind": "type",
1684
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1685
+ },
1686
+ "FlowNode": {
1687
+ "kind": "type",
1688
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1689
+ },
1690
+ "FlowDiagram": {
1691
+ "kind": "value",
1692
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1693
+ },
1694
+ "MAX_FLOW_LINKS": {
1695
+ "kind": "value",
1696
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1697
+ },
1698
+ "MAX_FLOW_NODES": {
1699
+ "kind": "value",
1700
+ "declaration": "dist/packages/charts/src/graph/flow-diagram.d.ts"
1701
+ },
1614
1702
  "RelationNode": {
1615
1703
  "kind": "type",
1616
1704
  "declaration": "dist/packages/charts/src/graph/relation-graph.d.ts"
@@ -1,6 +1,6 @@
1
1
  import { c as e } from "./src-BpvnBWrF.js";
2
- import { t } from "./chart-frame-D0enjyj9.js";
3
- import { n } from "./chart-input-D4_Awave.js";
2
+ import { t } from "./chart-frame-9dQQNF3F.js";
3
+ import { n } from "./chart-input-DT0STflx.js";
4
4
  import * as r from "@stylexjs/stylex";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  // packages/charts/src/categorical-values.tsx
@@ -57,19 +57,65 @@ var p = {
57
57
  kZKoxP: "xdk7pt",
58
58
  kWkggS: "xtwfq29",
59
59
  $$css: !0
60
+ },
61
+ transparent: {
62
+ kWkggS: "xjbqb8w",
63
+ $$css: !0
60
64
  }
61
- };
62
- function m({ tone: e, children: n }) {
63
- let r = o.toArray(n).length > 0;
65
+ }, m = 8, h = .3;
66
+ function g({ shape: e }) {
67
+ switch (e) {
68
+ case "line": return /* @__PURE__ */ l("path", {
69
+ d: "M0 4 H8",
70
+ stroke: "currentColor",
71
+ strokeWidth: 2
72
+ });
73
+ case "band": return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("rect", {
74
+ width: 8,
75
+ height: 8,
76
+ fill: "currentColor",
77
+ opacity: h
78
+ }), /* @__PURE__ */ l("path", {
79
+ d: "M0 4 H8",
80
+ stroke: "currentColor",
81
+ strokeWidth: 1.5
82
+ })] });
83
+ case "tick": return /* @__PURE__ */ l("path", {
84
+ d: "M0 4 H8",
85
+ stroke: "currentColor",
86
+ strokeWidth: 3
87
+ });
88
+ case "range": return /* @__PURE__ */ l("path", {
89
+ d: "M1.5 0.75 H6.5 M4 0.75 V7.25 M1.5 7.25 H6.5",
90
+ stroke: "currentColor",
91
+ strokeWidth: 1.5,
92
+ fill: "none"
93
+ });
94
+ case "dashed": return /* @__PURE__ */ l("path", {
95
+ d: "M0 4 H3 M5 4 H8",
96
+ stroke: "currentColor",
97
+ strokeWidth: 1.5
98
+ });
99
+ }
100
+ }
101
+ function _({ tone: e, shape: n = "swatch", children: r }) {
102
+ let a = o.toArray(r).length > 0, s = !a && n !== "swatch", c = a || n === "swatch" ? r : /* @__PURE__ */ l("svg", {
103
+ width: m,
104
+ height: m,
105
+ viewBox: `0 0 ${m} ${m}`,
106
+ focusable: "false",
107
+ className: "x1lliihq x1xc55vz xdk7pt x1rea2x4",
108
+ children: /* @__PURE__ */ l(g, { shape: n })
109
+ });
64
110
  return /* @__PURE__ */ l("span", {
65
111
  "aria-hidden": !0,
66
112
  inert: !0,
67
- ...i.props(p.root, p.color(t[e]), r ? p.icon : p.swatch),
68
- children: n
113
+ ...i.props(p.root, p.color(t[e]), a ? p.icon : p.swatch, s && p.transparent),
114
+ children: c
69
115
  });
70
116
  }
71
117
  // packages/charts/src/chart-series-summary.tsx
72
- function h({ series: e, values: t }) {
118
+ function v({ series: e, values: t }) {
73
119
  return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */ l("dl", {
74
120
  "aria-label": "Period summary",
75
121
  className: "x78zum5 x1a02dak xaml1ju x1ghz6dp xeuugli",
@@ -80,7 +126,10 @@ function h({ series: e, values: t }) {
80
126
  }[r > 0 | 0],
81
127
  children: [/* @__PURE__ */ u("dt", {
82
128
  className: "x78zum5 x6s0dn4 xunmzkg x153jb6y xy8obcc",
83
- children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
129
+ children: [/* @__PURE__ */ l(_, {
130
+ tone: e.tone,
131
+ shape: e.shape
132
+ }), e.label]
84
133
  }), /* @__PURE__ */ l("dd", {
85
134
  className: "x1ghz6dp xbixft x71lla1 xgkpprq xk4h15q x1wjjqco xss6m8b xj0a0fe",
86
135
  children: t[e.id] === void 0 ? /* @__PURE__ */ l(n, { width: "6ch" }) : t[e.id]
@@ -92,21 +141,21 @@ function h({ series: e, values: t }) {
92
141
  });
93
142
  }
94
143
  // packages/charts/src/chart-frame.tsx
95
- function g({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
96
- let g = s();
144
+ function y({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
145
+ let h = s();
97
146
  if (p !== void 0) {
98
- let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(h, {
147
+ let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(v, {
99
148
  series: m,
100
149
  values: p.seriesValues
101
- }), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, _ = /* @__PURE__ */ u(c, { children: [p.actions, a] });
150
+ }), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, g = /* @__PURE__ */ u(c, { children: [p.actions, a] });
102
151
  return /* @__PURE__ */ u("figure", {
103
- "aria-labelledby": g,
152
+ "aria-labelledby": h,
104
153
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt xmkeg23 x1y0btm7 x1ey3b81",
105
154
  children: [/* @__PURE__ */ l("figcaption", { children: /* @__PURE__ */ l(f, {
106
- id: g,
155
+ id: h,
107
156
  title: t,
108
157
  meta: p.meta,
109
- actions: s && _
158
+ actions: s && g
110
159
  }) }), /* @__PURE__ */ u("div", {
111
160
  className: "xeuugli xg7ukam",
112
161
  children: [
@@ -128,7 +177,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
128
177
  });
129
178
  }
130
179
  return /* @__PURE__ */ u("figure", {
131
- "aria-labelledby": g,
180
+ "aria-labelledby": h,
132
181
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt",
133
182
  children: [
134
183
  /* @__PURE__ */ u("figcaption", {
@@ -136,7 +185,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
136
185
  children: [/* @__PURE__ */ u("div", {
137
186
  className: "x1cqoux5 xeuugli xj0a0fe",
138
187
  children: [/* @__PURE__ */ l("p", {
139
- id: g,
188
+ id: h,
140
189
  className: "x1ghz6dp x12myhf4 x1778rvt xk4h15q",
141
190
  children: t
142
191
  }), n !== void 0 && /* @__PURE__ */ l("p", {
@@ -156,7 +205,7 @@ function g({ title: t, description: n, children: r, actions: a, footer: d, repor
156
205
  ]
157
206
  });
158
207
  }
159
- function _({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
208
+ function b({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
160
209
  return /* @__PURE__ */ l("ul", {
161
210
  "aria-label": t,
162
211
  ...{
@@ -168,11 +217,14 @@ function _({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
168
217
  0: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli x193iq5w xj0a0fe" },
169
218
  1: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli xj0a0fe x2lah0s x1x1rfll xuxw1ft" }
170
219
  }[!!n | 0],
171
- children: [/* @__PURE__ */ l(m, { tone: e.tone }), e.label]
220
+ children: [/* @__PURE__ */ l(_, {
221
+ tone: e.tone,
222
+ shape: e.shape
223
+ }), e.label]
172
224
  }, e.id))
173
225
  });
174
226
  }
175
- function v({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
227
+ function x({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
176
228
  return n === void 0 ? /* @__PURE__ */ l("div", {
177
229
  className: "x78zum5 x1a02dak x6s0dn4 x1qughib x8zbtdt x1gkm1c7 xeuugli x17tes2r x17oiadl x9f619 xh8yej3 xc342km x1hmw7ec x5g2kb4 x1hz01jw xtqrqnz xj57cvi x1778rvt x1yc453h xj0a0fe xbixft xpvm0e4 xss6m8b",
178
230
  children: r
@@ -188,7 +240,7 @@ function v({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
188
240
  children: r
189
241
  });
190
242
  }
191
- function y({ children: e, id: t }) {
243
+ function S({ children: e, id: t }) {
192
244
  return /* @__PURE__ */ l("p", {
193
245
  id: t,
194
246
  "aria-live": "polite",
@@ -196,4 +248,4 @@ function y({ children: e, id: t }) {
196
248
  children: e
197
249
  });
198
250
  }
199
- export { m as a, y as i, g as n, _ as r, v as t };
251
+ export { _ as a, S as i, y as n, b as r, x as t };
@@ -1,5 +1,5 @@
1
1
  import { h as e } from "./src-BpvnBWrF.js";
2
- import { n as t } from "./chart-frame-D0enjyj9.js";
2
+ import { n as t } from "./chart-frame-9dQQNF3F.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  // packages/charts/src/chart-input.tsx
5
5
  function r(e) {
@@ -23,18 +23,40 @@ function c({ label: n, columns: r, rows: i }) {
23
23
  }
24
24
  // packages/charts/src/chart-surface.tsx
25
25
  var l = /* @__PURE__ */ new Set([" ", "Enter"]);
26
- function u({ controls: e }) {
26
+ function u({ index: e, last: t, allowVerticalNavigation: n }) {
27
+ let r = Math.max(0, e - 1), i = Math.min(t, e + 1);
28
+ return {
29
+ Home: 0,
30
+ End: t,
31
+ ArrowLeft: r,
32
+ ArrowRight: i,
33
+ ArrowUp: n ? r : void 0,
34
+ ArrowDown: n ? i : void 0
35
+ };
36
+ }
37
+ function d({ index: e, last: t, columnCount: n }) {
38
+ let r = Math.max(0, e), i = r - r % n, a = Math.min(t, i + n - 1), o = r - n, s = r + n;
39
+ return {
40
+ Home: i,
41
+ End: a,
42
+ ArrowLeft: Math.max(i, r - 1),
43
+ ArrowRight: Math.min(a, r + 1),
44
+ ArrowUp: o < 0 ? r : o,
45
+ ArrowDown: s > t ? r : s
46
+ };
47
+ }
48
+ function f({ controls: e }) {
27
49
  return {
28
50
  value: e.inspected ?? null,
29
51
  readout: e.readout ?? null,
30
52
  selected: e.selected ?? null
31
53
  };
32
54
  }
33
- var d = s({
55
+ var p = s({
34
56
  name: "chart-inspection",
35
57
  options: { controls: "value" },
36
- state: u,
37
- sync: u,
58
+ state: f,
59
+ sync: f,
38
60
  controlled: [
39
61
  "value",
40
62
  "readout",
@@ -61,15 +83,16 @@ var d = s({
61
83
  i !== void 0 && n(i) && t.preventDefault();
62
84
  return;
63
85
  }
64
- let c = r.findIndex((e) => e.id === i), u = r.length - 1, d = {
65
- Home: 0,
66
- End: u,
67
- ArrowLeft: Math.max(0, c - 1),
68
- ArrowRight: Math.min(u, c + 1),
69
- ArrowUp: a === !0 ? Math.max(0, c - 1) : void 0,
70
- ArrowDown: a === !0 ? Math.min(u, c + 1) : void 0
71
- }[t.key], f = d === void 0 ? void 0 : r[d];
72
- f !== void 0 && (t.preventDefault(), e().controls.onInspect(f.id));
86
+ let c = r.findIndex((e) => e.id === i), f = r.length - 1, { columnCount: p } = e().controls, m = (p === void 0 || p < 1 ? u({
87
+ index: c,
88
+ last: f,
89
+ allowVerticalNavigation: a === !0
90
+ }) : d({
91
+ index: c,
92
+ last: f,
93
+ columnCount: p
94
+ }))[t.key], h = m === void 0 ? void 0 : r[m];
95
+ h !== void 0 && (t.preventDefault(), e().controls.onInspect(h.id));
73
96
  }
74
97
  return {
75
98
  setValue: t,
@@ -89,42 +112,43 @@ var d = s({
89
112
  items: (e) => e.items(),
90
113
  closed: !0
91
114
  }
92
- }), f = n(d, { root: "div" }).Root, p = n(d, { root: "p" }).Root, m = n(d, { root: "svg" }).Root;
115
+ }), m = n(p, { root: "div" }).Root, h = n(p, { root: "p" }).Root, g = n(p, { root: "svg" }).Root;
93
116
  // packages/charts/src/chart-navigation.tsx
94
- function h({ title: e, items: t, selection: n }) {
95
- 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)))];
96
- function d(e) {
97
- s(e), l(!0);
117
+ function _({ title: e, items: t, selection: n, columnCount: a }) {
118
+ let o = r(), [s, c] = i(void 0), [l, u] = i(!1), d = t[Math.max(0, t.findIndex((e) => e.id === (s ?? n?.selectedId)))];
119
+ function f(e) {
120
+ c(e), u(!0);
98
121
  }
99
122
  return {
100
- id: a,
123
+ id: o,
101
124
  props: {
102
125
  controls: {
103
126
  items: t,
104
- cursor: u?.id,
105
- inspected: c ? u?.id : void 0,
106
- readout: c ? u?.label : void 0,
127
+ cursor: d?.id,
128
+ inspected: l ? d?.id : void 0,
129
+ readout: l ? d?.label : void 0,
107
130
  selected: t.find((e) => e.id === n?.selectedId)?.id,
108
131
  allowVerticalNavigation: !0,
109
- onInspect: d,
110
- onDismiss: () => l(!1),
132
+ columnCount: a,
133
+ onInspect: f,
134
+ onDismiss: () => u(!1),
111
135
  onSelect: n?.onSelect
112
136
  },
113
137
  role: "group",
114
138
  tabIndex: t.length > 0 ? 0 : void 0,
115
139
  "aria-label": `${e}. Use arrow keys to inspect.${n === void 0 ? "" : " Press Enter to select."}`,
116
- "aria-describedby": a,
117
- onFocus: () => l(!0),
140
+ "aria-describedby": o,
141
+ onFocus: () => u(!0),
118
142
  onBlur: (e) => {
119
- e.currentTarget.contains(e.relatedTarget) || l(!1);
143
+ e.currentTarget.contains(e.relatedTarget) || u(!1);
120
144
  },
121
145
  onPointerLeave: (e) => {
122
- e.currentTarget.contains(document.activeElement) || l(!1);
146
+ e.currentTarget.contains(document.activeElement) || u(!1);
123
147
  }
124
148
  },
125
- activeId: u?.id,
126
- label: c ? u?.label : void 0,
127
- inspect: d
149
+ activeId: d?.id,
150
+ label: l ? d?.label : void 0,
151
+ inspect: f
128
152
  };
129
153
  }
130
- export { c as a, p as i, f as n, m as r, h as t };
154
+ export { c as a, h as i, m as n, g as r, _ as t };