@atom63/ui-react 0.2.0-beta.15 → 0.2.0-beta.16

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 (49) hide show
  1. package/dist/chart/index.d.ts +48 -0
  2. package/dist/chart/index.js +309 -0
  3. package/dist/chart/index.js.map +1 -0
  4. package/dist/{chunk-ASV4A4YB.js → chunk-4HE5IB6K.js} +4 -12
  5. package/dist/chunk-4HE5IB6K.js.map +1 -0
  6. package/dist/{chunk-GRRWPMZI.js → chunk-77CBRRVT.js} +47 -7
  7. package/dist/chunk-77CBRRVT.js.map +1 -0
  8. package/dist/{chunk-L5KFLZUC.js → chunk-BQONJKNA.js} +4 -4
  9. package/dist/{chunk-L5KFLZUC.js.map → chunk-BQONJKNA.js.map} +1 -1
  10. package/dist/{chunk-CFFGYLY3.js → chunk-CO6KHYO5.js} +26 -4
  11. package/dist/chunk-CO6KHYO5.js.map +1 -0
  12. package/dist/{chunk-BSDSLG3L.js → chunk-IEHYTNLS.js} +7 -4
  13. package/dist/chunk-IEHYTNLS.js.map +1 -0
  14. package/dist/{chunk-TAXYD4I4.js → chunk-IPUBANIB.js} +3 -2
  15. package/dist/chunk-IPUBANIB.js.map +1 -0
  16. package/dist/{chunk-WLLPGOQ7.js → chunk-SL6J2Y6I.js} +18 -6
  17. package/dist/chunk-SL6J2Y6I.js.map +1 -0
  18. package/dist/{chunk-3R74FOXV.js → chunk-VUUSD5AG.js} +3 -3
  19. package/dist/{chunk-3R74FOXV.js.map → chunk-VUUSD5AG.js.map} +1 -1
  20. package/dist/{chunk-CJAWGKA5.js → chunk-Y52BV635.js} +16 -4
  21. package/dist/chunk-Y52BV635.js.map +1 -0
  22. package/dist/components/command/index.js +1 -1
  23. package/dist/components/drawer/index.js +1 -1
  24. package/dist/components/feedback-state/index.js +1 -1
  25. package/dist/components/form/index.js +1 -1
  26. package/dist/components/pagination/index.js +1 -1
  27. package/dist/components/sheet/index.js +1 -1
  28. package/dist/components/sidebar/index.js +3 -3
  29. package/dist/components/sidebar-nav-tree/index.js +4 -4
  30. package/dist/components/table/index.js +2 -1
  31. package/dist/{index-DlcaeyJS.d.ts → index-B0PHovoW.d.ts} +10 -3
  32. package/dist/index.d.ts +35 -6
  33. package/dist/index.js +22 -22
  34. package/dist/preview/index.d.ts +1 -1
  35. package/dist/preview/index.js +5 -5
  36. package/package.json +9 -3
  37. package/src/components/autocomplete/autocomplete.css +18 -8
  38. package/src/components/chart/chart.css +316 -0
  39. package/src/components/command/command.css +13 -0
  40. package/src/components/feedback-state/feedback-state.css +1 -0
  41. package/src/components/table/table.css +5 -0
  42. package/src/styles/recipes.css +1 -0
  43. package/dist/chunk-ASV4A4YB.js.map +0 -1
  44. package/dist/chunk-BSDSLG3L.js.map +0 -1
  45. package/dist/chunk-CFFGYLY3.js.map +0 -1
  46. package/dist/chunk-CJAWGKA5.js.map +0 -1
  47. package/dist/chunk-GRRWPMZI.js.map +0 -1
  48. package/dist/chunk-TAXYD4I4.js.map +0 -1
  49. package/dist/chunk-WLLPGOQ7.js.map +0 -1
@@ -0,0 +1,48 @@
1
+ import { ChartColor, ChartType, ChartSize } from '@atom63/ui-foundation';
2
+ import * as React from 'react';
3
+
4
+ interface ChartSeries {
5
+ /** The series name, in the legend, the tooltip and the table header. */
6
+ label: string;
7
+ /** One value per category, in the order of `categories`. Values are zero or more. */
8
+ values: readonly number[];
9
+ /** The series colour, `--a63-chart-<n>`. Defaults to the series' position, 1 to 5. */
10
+ color?: ChartColor;
11
+ }
12
+ interface ChartLabels {
13
+ /** The table toggle's label while the table is hidden. */
14
+ showTable?: string;
15
+ /** The table toggle's label while the table shows. */
16
+ hideTable?: string;
17
+ /** Read after the plot's name: how to move between categories. */
18
+ keyboardHint?: string;
19
+ }
20
+ type ChartProps = Omit<React.ComponentProps<'figure'>, 'children'> & {
21
+ /** The chart's accessible name, also the data table's caption. Required. */
22
+ label: string;
23
+ /** A sentence that summarizes what the chart shows, read with its name. */
24
+ description?: string;
25
+ /** The categories along the x axis, such as months. */
26
+ categories: readonly string[];
27
+ /** The series to draw, up to five. */
28
+ series: readonly ChartSeries[];
29
+ type?: ChartType;
30
+ /** Stack the series instead of drawing them side by side (bar) or over each other (area). Ignored for line. */
31
+ stacked?: boolean;
32
+ size?: ChartSize;
33
+ /** Formats a value in the tooltip and the table. */
34
+ formatValue?: (value: number) => string;
35
+ /** Formats a y-axis tick. Defaults to `formatValue`. */
36
+ formatTick?: (value: number) => string;
37
+ /** The heading of the table's first column. */
38
+ categoryLabel?: string;
39
+ /** Show the legend. Defaults to true when there is more than one series. */
40
+ legend?: boolean;
41
+ /** `hidden` keeps the data table for screen readers only; `toggle` adds a button that shows it. */
42
+ table?: 'hidden' | 'toggle';
43
+ labels?: ChartLabels;
44
+ };
45
+ declare function Chart({ label, description, categories, series, type, stacked, size, formatValue, formatTick, categoryLabel, legend, table, labels, className, ...props }: ChartProps): React.ReactElement;
46
+
47
+ export { Chart };
48
+ export type { ChartLabels, ChartProps, ChartSeries };
@@ -0,0 +1,309 @@
1
+ import { Table, TableCaption, TableHeader, TableRow, TableHead, TableBody, TableCell } from '../chunk-77CBRRVT.js';
2
+ import { Button } from '../chunk-CYWNKIIJ.js';
3
+ import { cn } from '../chunk-AJLHJRK6.js';
4
+ import { chartColors, chartContract } from '@atom63/ui-foundation';
5
+ import * as React from 'react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
7
+
8
+ var defaultLabels = {
9
+ showTable: "Show data table",
10
+ hideTable: "Hide data table",
11
+ keyboardHint: "Use the arrow keys to read each value."
12
+ };
13
+ var tickCounts = { sm: 3, md: 5 };
14
+ function chartTicks(max, count) {
15
+ const top = max > 0 ? max : 1;
16
+ const raw = top / (count - 1);
17
+ const magnitude = 10 ** Math.floor(Math.log10(raw));
18
+ const nice = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].find((step) => step * magnitude >= raw) ?? 10;
19
+ return Array.from(
20
+ { length: count },
21
+ (_, index) => Number((index * nice * magnitude).toPrecision(12))
22
+ );
23
+ }
24
+ var defaultFormat = (value) => value.toLocaleString();
25
+ function Chart({
26
+ label,
27
+ description,
28
+ categories,
29
+ series,
30
+ type = chartContract.defaultType,
31
+ stacked = false,
32
+ size = chartContract.defaultSize,
33
+ formatValue = defaultFormat,
34
+ formatTick = formatValue,
35
+ categoryLabel = "Category",
36
+ legend = series.length > 1,
37
+ table = "hidden",
38
+ labels,
39
+ className,
40
+ ...props
41
+ }) {
42
+ const id = React.useId();
43
+ const text = { ...defaultLabels, ...labels };
44
+ const [active, setActive] = React.useState(null);
45
+ const [announce, setAnnounce] = React.useState(false);
46
+ const [tableOpen, setTableOpen] = React.useState(false);
47
+ const count = categories.length;
48
+ const stacks = stacked && type !== "line";
49
+ const colors = series.map((item, index) => item.color ?? chartColors[index % chartColors.length]);
50
+ const value = (seriesIndex, category) => Math.max(0, series[seriesIndex]?.values[category] ?? 0);
51
+ const totals = categories.map(
52
+ (_, category) => series.reduce((sum, _item, seriesIndex) => sum + value(seriesIndex, category), 0)
53
+ );
54
+ const max = stacks ? Math.max(0, ...totals) : Math.max(
55
+ 0,
56
+ ...series.flatMap((_, seriesIndex) => categories.map((__, c) => value(seriesIndex, c)))
57
+ );
58
+ const ticks = chartTicks(max, tickCounts[size]);
59
+ const top = ticks[ticks.length - 1];
60
+ const band = count > 0 ? 100 / count : 100;
61
+ const center = (category) => (category + 0.5) * band;
62
+ const y = (amount) => 100 - amount / top * 100;
63
+ const spans = series.map(
64
+ (_, seriesIndex) => categories.map((__, category) => {
65
+ const base = stacks ? series.slice(0, seriesIndex).reduce((sum, _s, below) => sum + value(below, category), 0) : 0;
66
+ return [base, base + value(seriesIndex, category)];
67
+ })
68
+ );
69
+ const marks = type === "bar" ? series.map((_, seriesIndex) => {
70
+ const width = stacks ? band * 0.5 : band * 0.64 / Math.max(1, series.length);
71
+ return /* @__PURE__ */ jsx("g", { className: "a63-Chart-series", "data-color": colors[seriesIndex], children: spans[seriesIndex].map(([base, end2], category) => /* @__PURE__ */ jsx(
72
+ "rect",
73
+ {
74
+ className: "a63-Chart-bar",
75
+ height: y(base) - y(end2),
76
+ width,
77
+ x: stacks ? center(category) - width / 2 : category * band + band * 0.18 + seriesIndex * width,
78
+ y: y(end2)
79
+ },
80
+ category
81
+ )) }, seriesIndex);
82
+ }) : series.map((_, seriesIndex) => {
83
+ const points = spans[seriesIndex].map(
84
+ ([, end2], category) => `${center(category)},${y(end2)}`
85
+ );
86
+ const floor = spans[seriesIndex].map(
87
+ ([base], category) => `${center(category)},${y(base)}`
88
+ );
89
+ return /* @__PURE__ */ jsxs("g", { className: "a63-Chart-series", "data-color": colors[seriesIndex], children: [
90
+ type === "area" ? /* @__PURE__ */ jsx(
91
+ "polygon",
92
+ {
93
+ className: "a63-Chart-area",
94
+ points: [...points, ...floor.reverse()].join(" ")
95
+ }
96
+ ) : null,
97
+ /* @__PURE__ */ jsx(
98
+ "polyline",
99
+ {
100
+ className: "a63-Chart-line",
101
+ points: points.join(" "),
102
+ vectorEffect: "non-scaling-stroke"
103
+ }
104
+ )
105
+ ] }, seriesIndex);
106
+ });
107
+ const pick = (category, fromKeyboard) => {
108
+ setActive(category);
109
+ setAnnounce(fromKeyboard && category !== null);
110
+ };
111
+ const onPointerMove = (event) => {
112
+ if (count === 0) return;
113
+ const rect = event.currentTarget.getBoundingClientRect();
114
+ let fraction = (event.clientX - rect.left) / rect.width;
115
+ if (getComputedStyle(event.currentTarget).direction === "rtl") fraction = 1 - fraction;
116
+ pick(Math.min(count - 1, Math.max(0, Math.floor(fraction * count))), false);
117
+ };
118
+ const onKeyDown = (event) => {
119
+ if (count === 0) return;
120
+ const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
121
+ const current = active ?? -1;
122
+ const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1, ArrowUp: 1, ArrowDown: -1 }[event.key];
123
+ if (event.key === "Escape" && active !== null) {
124
+ event.preventDefault();
125
+ pick(null, false);
126
+ return;
127
+ }
128
+ let next;
129
+ if (step !== void 0) next = current < 0 ? 0 : current + step;
130
+ else if (event.key === "Home") next = 0;
131
+ else if (event.key === "End") next = count - 1;
132
+ else return;
133
+ event.preventDefault();
134
+ pick(Math.min(count - 1, Math.max(0, next)), true);
135
+ };
136
+ const readout = active === null ? "" : `${categories[active]}: ${series.map((item, seriesIndex) => `${item.label} ${formatValue(value(seriesIndex, active))}`).join(", ")}`;
137
+ const descriptionId = description ? `${id}-description` : void 0;
138
+ const tableId = `${id}-table`;
139
+ const end = active !== null && center(active) > 50;
140
+ return /* @__PURE__ */ jsxs(
141
+ "figure",
142
+ {
143
+ "aria-describedby": descriptionId,
144
+ "aria-label": label,
145
+ className: cn("a63-Chart", className),
146
+ "data-size": size,
147
+ "data-slot": "chart",
148
+ "data-stacked": stacks || void 0,
149
+ "data-state": active === null ? "rest" : "current",
150
+ "data-type": type,
151
+ ...props,
152
+ children: [
153
+ description ? /* @__PURE__ */ jsx("p", { className: "a63-Chart-sr-only", id: descriptionId, children: description }) : null,
154
+ legend ? /* @__PURE__ */ jsx("ul", { className: "a63-Chart-legend", "data-slot": "chart-legend", children: series.map((item, seriesIndex) => /* @__PURE__ */ jsxs("li", { className: "a63-Chart-legend-item", children: [
155
+ /* @__PURE__ */ jsx(Swatch, { color: colors[seriesIndex], type }),
156
+ item.label
157
+ ] }, item.label)) }) : null,
158
+ /* @__PURE__ */ jsxs("div", { className: "a63-Chart-frame", children: [
159
+ /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "a63-Chart-y-axis", "data-slot": "chart-y-axis", children: [...ticks].reverse().map((tick) => /* @__PURE__ */ jsx("span", { className: "a63-Chart-tick", children: formatTick(tick) }, tick)) }),
160
+ /* @__PURE__ */ jsxs(
161
+ "div",
162
+ {
163
+ "aria-describedby": `${id}-hint`,
164
+ "aria-label": label,
165
+ className: "a63-Chart-plot",
166
+ "data-slot": "chart-plot",
167
+ onBlur: () => pick(null, false),
168
+ onKeyDown,
169
+ onPointerLeave: () => pick(null, false),
170
+ onPointerMove,
171
+ role: "group",
172
+ tabIndex: count > 0 ? 0 : void 0,
173
+ children: [
174
+ /* @__PURE__ */ jsxs(
175
+ "svg",
176
+ {
177
+ "aria-hidden": true,
178
+ className: "a63-Chart-marks",
179
+ preserveAspectRatio: "none",
180
+ viewBox: "0 0 100 100",
181
+ children: [
182
+ ticks.map((tick) => /* @__PURE__ */ jsx(
183
+ "line",
184
+ {
185
+ className: tick === 0 ? "a63-Chart-baseline" : "a63-Chart-grid",
186
+ vectorEffect: "non-scaling-stroke",
187
+ x1: "0",
188
+ x2: "100",
189
+ y1: y(tick),
190
+ y2: y(tick)
191
+ },
192
+ tick
193
+ )),
194
+ active !== null ? type === "bar" ? /* @__PURE__ */ jsx(
195
+ "rect",
196
+ {
197
+ className: "a63-Chart-band",
198
+ height: "100",
199
+ width: band,
200
+ x: active * band,
201
+ y: "0"
202
+ }
203
+ ) : /* @__PURE__ */ jsx(
204
+ "line",
205
+ {
206
+ className: "a63-Chart-guide",
207
+ vectorEffect: "non-scaling-stroke",
208
+ x1: center(active),
209
+ x2: center(active),
210
+ y1: "0",
211
+ y2: "100"
212
+ }
213
+ ) : null,
214
+ marks
215
+ ]
216
+ }
217
+ ),
218
+ active !== null && type !== "bar" ? series.map((_, seriesIndex) => /* @__PURE__ */ jsx(
219
+ "span",
220
+ {
221
+ "aria-hidden": true,
222
+ className: "a63-Chart-dot",
223
+ "data-color": colors[seriesIndex],
224
+ style: {
225
+ insetBlockStart: `${y(spans[seriesIndex][active][1])}%`,
226
+ insetInlineStart: `${center(active)}%`
227
+ }
228
+ },
229
+ seriesIndex
230
+ )) : null,
231
+ active !== null ? /* @__PURE__ */ jsxs(
232
+ "div",
233
+ {
234
+ "aria-hidden": true,
235
+ className: "a63-Chart-tooltip",
236
+ "data-slot": "chart-tooltip",
237
+ style: end ? { insetInlineEnd: `${100 - center(active) + band / 2}%` } : { insetInlineStart: `${center(active) + band / 2}%` },
238
+ children: [
239
+ /* @__PURE__ */ jsx("div", { className: "a63-Chart-tooltip-title", children: categories[active] }),
240
+ series.map((item, seriesIndex) => /* @__PURE__ */ jsxs("div", { className: "a63-Chart-tooltip-row", children: [
241
+ /* @__PURE__ */ jsx(Swatch, { color: colors[seriesIndex], type }),
242
+ /* @__PURE__ */ jsx("span", { className: "a63-Chart-tooltip-label", children: item.label }),
243
+ /* @__PURE__ */ jsx("span", { className: "a63-Chart-tooltip-value", children: formatValue(value(seriesIndex, active)) })
244
+ ] }, item.label))
245
+ ]
246
+ }
247
+ ) : null,
248
+ /* @__PURE__ */ jsx("span", { className: "a63-Chart-sr-only", id: `${id}-hint`, children: text.keyboardHint })
249
+ ]
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsx("span", {}),
253
+ /* @__PURE__ */ jsx(
254
+ "div",
255
+ {
256
+ "aria-hidden": true,
257
+ className: "a63-Chart-x-axis",
258
+ "data-dense": count > 6 || void 0,
259
+ "data-slot": "chart-x-axis",
260
+ children: categories.map((category) => /* @__PURE__ */ jsx("span", { className: "a63-Chart-category", children: category }, category))
261
+ }
262
+ )
263
+ ] }),
264
+ /* @__PURE__ */ jsx("div", { "aria-live": "polite", className: "a63-Chart-sr-only", children: announce ? readout : "" }),
265
+ table === "toggle" ? /* @__PURE__ */ jsx(
266
+ Button,
267
+ {
268
+ "aria-controls": tableId,
269
+ "aria-expanded": tableOpen,
270
+ className: "a63-Chart-table-toggle",
271
+ "data-slot": "chart-table-toggle",
272
+ onClick: () => setTableOpen((open) => !open),
273
+ size: "sm",
274
+ tone: "muted",
275
+ variant: "ghost",
276
+ children: tableOpen ? text.hideTable : text.showTable
277
+ }
278
+ ) : null,
279
+ /* @__PURE__ */ jsx(
280
+ "div",
281
+ {
282
+ className: "a63-Chart-table",
283
+ "data-slot": "chart-table",
284
+ "data-visible": table === "toggle" && tableOpen || void 0,
285
+ id: tableId,
286
+ children: /* @__PURE__ */ jsxs(Table, { size: "sm", children: [
287
+ /* @__PURE__ */ jsx(TableCaption, { children: label }),
288
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
289
+ /* @__PURE__ */ jsx(TableHead, { scope: "col", children: categoryLabel }),
290
+ series.map((item) => /* @__PURE__ */ jsx(TableHead, { scope: "col", children: item.label }, item.label))
291
+ ] }) }),
292
+ /* @__PURE__ */ jsx(TableBody, { children: categories.map((category, index) => /* @__PURE__ */ jsxs(TableRow, { children: [
293
+ /* @__PURE__ */ jsx(TableHead, { scope: "row", children: category }),
294
+ series.map((item, seriesIndex) => /* @__PURE__ */ jsx(TableCell, { children: formatValue(value(seriesIndex, index)) }, item.label))
295
+ ] }, category)) })
296
+ ] })
297
+ }
298
+ )
299
+ ]
300
+ }
301
+ );
302
+ }
303
+ function Swatch({ color, type }) {
304
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": true, className: "a63-Chart-swatch", "data-color": color, viewBox: "0 0 12 12", children: type === "bar" ? /* @__PURE__ */ jsx("rect", { className: "a63-Chart-bar", height: "10", width: "10", x: "1", y: "1" }) : /* @__PURE__ */ jsx("line", { className: "a63-Chart-line", x1: "0", x2: "12", y1: "6", y2: "6" }) });
305
+ }
306
+
307
+ export { Chart };
308
+ //# sourceMappingURL=index.js.map
309
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/chart/chart.tsx"],"names":["end"],"mappings":";;;;;;;AA8EA,IAAM,aAAA,GAAuC;AAAA,EAC3C,SAAA,EAAW,iBAAA;AAAA,EACX,SAAA,EAAW,iBAAA;AAAA,EACX,YAAA,EAAc;AAChB,CAAA;AAEA,IAAM,UAAA,GAAwC,EAAE,EAAA,EAAI,CAAA,EAAG,IAAI,CAAA,EAAE;AAGtD,SAAS,UAAA,CAAW,KAAa,KAAA,EAAyB;AAC/D,EAAA,MAAM,GAAA,GAAM,GAAA,GAAM,CAAA,GAAI,GAAA,GAAM,CAAA;AAC5B,EAAA,MAAM,GAAA,GAAM,OAAO,KAAA,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,GAAE,GAAA,EAAI,CAAA,EAAE,GAAA,EAAI,CAAA,uBAElE,MAAA,EAAA,EAAK,SAAA,EAAU,gBAAA,EAAiB,EAAA,EAAG,KAAI,EAAA,EAAG,IAAA,EAAK,IAAG,GAAA,EAAI,EAAA,EAAG,KAAI,CAAA,EAElE,CAAA;AAEJ","file":"index.js","sourcesContent":["import {\n type ChartColor,\n type ChartSize,\n type ChartType,\n chartColors,\n chartContract,\n} from '@atom63/ui-foundation'\nimport * as React from 'react'\n\nimport { cn } from '../../lib/cn'\nimport { Button } from '../button'\nimport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '../table'\n\n/*\n * Chart — a small dashboard chart drawn in SVG, with no charting library.\n * Line, area and bar (grouped or stacked) charts of a few numeric series over a\n * categorical axis. Only the marks are SVG; the axis labels, legend, tooltip and\n * data table are HTML, so text keeps its size at any width. The plot is one tab\n * stop: the arrow keys move between categories and show each one's values in\n * the tooltip. Every chart carries a table of the same numbers, visually hidden\n * unless `table=\"toggle\"` lets a reader show it.\n *\n * Not for: big or live data, zooming, scatter or pie charts, or values below\n * zero. Use a Table when the exact numbers matter more than the shape.\n */\n\nexport interface ChartSeries {\n /** The series name, in the legend, the tooltip and the table header. */\n label: string\n /** One value per category, in the order of `categories`. Values are zero or more. */\n values: readonly number[]\n /** The series colour, `--a63-chart-<n>`. Defaults to the series' position, 1 to 5. */\n color?: ChartColor\n}\n\nexport interface ChartLabels {\n /** The table toggle's label while the table is hidden. */\n showTable?: string\n /** The table toggle's label while the table shows. */\n hideTable?: string\n /** Read after the plot's name: how to move between categories. */\n keyboardHint?: string\n}\n\nexport type ChartProps = Omit<React.ComponentProps<'figure'>, 'children'> & {\n /** The chart's accessible name, also the data table's caption. Required. */\n label: string\n /** A sentence that summarizes what the chart shows, read with its name. */\n description?: string\n /** The categories along the x axis, such as months. */\n categories: readonly string[]\n /** The series to draw, up to five. */\n series: readonly ChartSeries[]\n type?: ChartType\n /** Stack the series instead of drawing them side by side (bar) or over each other (area). Ignored for line. */\n stacked?: boolean\n size?: ChartSize\n /** Formats a value in the tooltip and the table. */\n formatValue?: (value: number) => string\n /** Formats a y-axis tick. Defaults to `formatValue`. */\n formatTick?: (value: number) => string\n /** The heading of the table's first column. */\n categoryLabel?: string\n /** Show the legend. Defaults to true when there is more than one series. */\n legend?: boolean\n /** `hidden` keeps the data table for screen readers only; `toggle` adds a button that shows it. */\n table?: 'hidden' | 'toggle'\n labels?: ChartLabels\n}\n\nconst defaultLabels: Required<ChartLabels> = {\n showTable: 'Show data table',\n hideTable: 'Hide data table',\n keyboardHint: 'Use the arrow keys to read each value.',\n}\n\nconst tickCounts: Record<ChartSize, number> = { sm: 3, md: 5 }\n\n/** Ticks from zero to a tidy maximum at or above `max`: 110,000 in 5 ticks → 0, 30,000 … 120,000. */\nexport function chartTicks(max: number, count: number): number[] {\n const top = max > 0 ? max : 1\n const raw = top / (count - 1)\n const magnitude = 10 ** Math.floor(Math.log10(raw))\n const nice = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10].find(step => step * magnitude >= raw) ?? 10\n // toPrecision drops the float noise of a fractional step (0.1 × 3 = 0.30000000000000004).\n return Array.from({ length: count }, (_, index) =>\n Number((index * nice * magnitude).toPrecision(12))\n )\n}\n\nconst defaultFormat = (value: number) => value.toLocaleString()\n\nexport function Chart({\n label,\n description,\n categories,\n series,\n type = chartContract.defaultType,\n stacked = false,\n size = chartContract.defaultSize,\n formatValue = defaultFormat,\n formatTick = formatValue,\n categoryLabel = 'Category',\n legend = series.length > 1,\n table = 'hidden',\n labels,\n className,\n ...props\n}: ChartProps): React.ReactElement {\n const id = React.useId()\n const text = { ...defaultLabels, ...labels }\n const [active, setActive] = React.useState<number | null>(null)\n const [announce, setAnnounce] = React.useState(false)\n const [tableOpen, setTableOpen] = React.useState(false)\n\n const count = categories.length\n const stacks = stacked && type !== 'line'\n const colors = series.map((item, index) => item.color ?? chartColors[index % chartColors.length])\n const value = (seriesIndex: number, category: number) =>\n Math.max(0, series[seriesIndex]?.values[category] ?? 0)\n const totals = categories.map((_, category) =>\n series.reduce((sum, _item, seriesIndex) => sum + value(seriesIndex, category), 0)\n )\n const max = stacks\n ? Math.max(0, ...totals)\n : Math.max(\n 0,\n ...series.flatMap((_, seriesIndex) => categories.map((__, c) => value(seriesIndex, c)))\n )\n const ticks = chartTicks(max, tickCounts[size])\n const top = ticks[ticks.length - 1]\n\n // The plot is a 100 × 100 box stretched to its size; each category owns an\n // equal band, and a line's points sit in the middle of their bands.\n const band = count > 0 ? 100 / count : 100\n const center = (category: number) => (category + 0.5) * band\n const y = (amount: number) => 100 - (amount / top) * 100\n // The base and top of each series in each category, stacked or not.\n const spans = series.map((_, seriesIndex) =>\n categories.map((__, category) => {\n const base = stacks\n ? series.slice(0, seriesIndex).reduce((sum, _s, below) => sum + value(below, category), 0)\n : 0\n return [base, base + value(seriesIndex, category)] as const\n })\n )\n\n const marks =\n type === 'bar'\n ? series.map((_, seriesIndex) => {\n const width = stacks ? band * 0.5 : (band * 0.64) / Math.max(1, series.length)\n return (\n <g className=\"a63-Chart-series\" data-color={colors[seriesIndex]} key={seriesIndex}>\n {spans[seriesIndex].map(([base, end], category) => (\n <rect\n className=\"a63-Chart-bar\"\n height={y(base) - y(end)}\n key={category}\n width={width}\n x={\n stacks\n ? center(category) - width / 2\n : category * band + band * 0.18 + seriesIndex * width\n }\n y={y(end)}\n />\n ))}\n </g>\n )\n })\n : series.map((_, seriesIndex) => {\n const points = spans[seriesIndex].map(\n ([, end], category) => `${center(category)},${y(end)}`\n )\n const floor = spans[seriesIndex].map(\n ([base], category) => `${center(category)},${y(base)}`\n )\n return (\n <g className=\"a63-Chart-series\" data-color={colors[seriesIndex]} key={seriesIndex}>\n {type === 'area' ? (\n <polygon\n className=\"a63-Chart-area\"\n points={[...points, ...floor.reverse()].join(' ')}\n />\n ) : null}\n <polyline\n className=\"a63-Chart-line\"\n points={points.join(' ')}\n vectorEffect=\"non-scaling-stroke\"\n />\n </g>\n )\n })\n\n const pick = (category: number | null, fromKeyboard: boolean) => {\n setActive(category)\n setAnnounce(fromKeyboard && category !== null)\n }\n\n const onPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {\n if (count === 0) return\n const rect = event.currentTarget.getBoundingClientRect()\n let fraction = (event.clientX - rect.left) / rect.width\n if (getComputedStyle(event.currentTarget).direction === 'rtl') fraction = 1 - fraction\n pick(Math.min(count - 1, Math.max(0, Math.floor(fraction * count))), false)\n }\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (count === 0) return\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl'\n const current = active ?? -1\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1, ArrowUp: 1, ArrowDown: -1 }[\n event.key as 'ArrowRight'\n ]\n if (event.key === 'Escape' && active !== null) {\n event.preventDefault()\n pick(null, false)\n return\n }\n let next: number\n if (step !== undefined) next = current < 0 ? 0 : current + step\n else if (event.key === 'Home') next = 0\n else if (event.key === 'End') next = count - 1\n else return\n event.preventDefault()\n pick(Math.min(count - 1, Math.max(0, next)), true)\n }\n\n const readout =\n active === null\n ? ''\n : `${categories[active]}: ${series\n .map((item, seriesIndex) => `${item.label} ${formatValue(value(seriesIndex, active))}`)\n .join(', ')}`\n\n const descriptionId = description ? `${id}-description` : undefined\n const tableId = `${id}-table`\n const end = active !== null && center(active) > 50\n\n return (\n <figure\n aria-describedby={descriptionId}\n aria-label={label}\n className={cn('a63-Chart', className)}\n data-size={size}\n data-slot=\"chart\"\n data-stacked={stacks || undefined}\n data-state={active === null ? 'rest' : 'current'}\n data-type={type}\n {...props}\n >\n {description ? (\n <p className=\"a63-Chart-sr-only\" id={descriptionId}>\n {description}\n </p>\n ) : null}\n {legend ? (\n <ul className=\"a63-Chart-legend\" data-slot=\"chart-legend\">\n {series.map((item, seriesIndex) => (\n <li className=\"a63-Chart-legend-item\" key={item.label}>\n <Swatch color={colors[seriesIndex]} type={type} />\n {item.label}\n </li>\n ))}\n </ul>\n ) : null}\n <div className=\"a63-Chart-frame\">\n <div aria-hidden className=\"a63-Chart-y-axis\" data-slot=\"chart-y-axis\">\n {[...ticks].reverse().map(tick => (\n <span className=\"a63-Chart-tick\" key={tick}>\n {formatTick(tick)}\n </span>\n ))}\n </div>\n {/* The plot is one tab stop that reads its categories with the arrow keys, as\n the WAI chart guidance suggests; the data table carries the same numbers. */}\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- the plot takes the arrow keys and the pointer to pick a category. */}\n <div\n aria-describedby={`${id}-hint`}\n aria-label={label}\n className=\"a63-Chart-plot\"\n data-slot=\"chart-plot\"\n onBlur={() => pick(null, false)}\n onKeyDown={onKeyDown}\n onPointerLeave={() => pick(null, false)}\n onPointerMove={onPointerMove}\n role=\"group\"\n tabIndex={count > 0 ? 0 : undefined}\n >\n <svg\n aria-hidden\n className=\"a63-Chart-marks\"\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 100 100\"\n >\n {ticks.map(tick => (\n <line\n className={tick === 0 ? 'a63-Chart-baseline' : 'a63-Chart-grid'}\n key={tick}\n vectorEffect=\"non-scaling-stroke\"\n x1=\"0\"\n x2=\"100\"\n y1={y(tick)}\n y2={y(tick)}\n />\n ))}\n {active !== null ? (\n type === 'bar' ? (\n <rect\n className=\"a63-Chart-band\"\n height=\"100\"\n width={band}\n x={active * band}\n y=\"0\"\n />\n ) : (\n <line\n className=\"a63-Chart-guide\"\n vectorEffect=\"non-scaling-stroke\"\n x1={center(active)}\n x2={center(active)}\n y1=\"0\"\n y2=\"100\"\n />\n )\n ) : null}\n {marks}\n </svg>\n {active !== null && type !== 'bar'\n ? series.map((_, seriesIndex) => (\n <span\n aria-hidden\n className=\"a63-Chart-dot\"\n data-color={colors[seriesIndex]}\n key={seriesIndex}\n style={{\n insetBlockStart: `${y(spans[seriesIndex][active][1])}%`,\n insetInlineStart: `${center(active)}%`,\n }}\n />\n ))\n : null}\n {active !== null ? (\n <div\n aria-hidden\n className=\"a63-Chart-tooltip\"\n data-slot=\"chart-tooltip\"\n style={\n end\n ? { insetInlineEnd: `${100 - center(active) + band / 2}%` }\n : { insetInlineStart: `${center(active) + band / 2}%` }\n }\n >\n <div className=\"a63-Chart-tooltip-title\">{categories[active]}</div>\n {series.map((item, seriesIndex) => (\n <div className=\"a63-Chart-tooltip-row\" key={item.label}>\n <Swatch color={colors[seriesIndex]} type={type} />\n <span className=\"a63-Chart-tooltip-label\">{item.label}</span>\n <span className=\"a63-Chart-tooltip-value\">\n {formatValue(value(seriesIndex, active))}\n </span>\n </div>\n ))}\n </div>\n ) : null}\n <span className=\"a63-Chart-sr-only\" id={`${id}-hint`}>\n {text.keyboardHint}\n </span>\n </div>\n <span />\n <div\n aria-hidden\n className=\"a63-Chart-x-axis\"\n data-dense={count > 6 || undefined}\n data-slot=\"chart-x-axis\"\n >\n {categories.map(category => (\n <span className=\"a63-Chart-category\" key={category}>\n {category}\n </span>\n ))}\n </div>\n </div>\n <div aria-live=\"polite\" className=\"a63-Chart-sr-only\">\n {announce ? readout : ''}\n </div>\n {table === 'toggle' ? (\n <Button\n aria-controls={tableId}\n aria-expanded={tableOpen}\n className=\"a63-Chart-table-toggle\"\n data-slot=\"chart-table-toggle\"\n onClick={() => setTableOpen(open => !open)}\n size=\"sm\"\n tone=\"muted\"\n variant=\"ghost\"\n >\n {tableOpen ? text.hideTable : text.showTable}\n </Button>\n ) : null}\n <div\n className=\"a63-Chart-table\"\n data-slot=\"chart-table\"\n data-visible={(table === 'toggle' && tableOpen) || undefined}\n id={tableId}\n >\n <Table size=\"sm\">\n <TableCaption>{label}</TableCaption>\n <TableHeader>\n <TableRow>\n <TableHead scope=\"col\">{categoryLabel}</TableHead>\n {series.map(item => (\n <TableHead key={item.label} scope=\"col\">\n {item.label}\n </TableHead>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {categories.map((category, index) => (\n <TableRow key={category}>\n <TableHead scope=\"row\">{category}</TableHead>\n {series.map((item, seriesIndex) => (\n <TableCell key={item.label}>{formatValue(value(seriesIndex, index))}</TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </div>\n </figure>\n )\n}\n\n/* A legend or tooltip key: a short line for line and area charts, a square for bars. */\nfunction Swatch({ color, type }: { color: ChartColor; type: ChartType }) {\n return (\n <svg aria-hidden className=\"a63-Chart-swatch\" data-color={color} viewBox=\"0 0 12 12\">\n {type === 'bar' ? (\n <rect className=\"a63-Chart-bar\" height=\"10\" width=\"10\" x=\"1\" y=\"1\" />\n ) : (\n <line className=\"a63-Chart-line\" x1=\"0\" x2=\"12\" y1=\"6\" y2=\"6\" />\n )}\n </svg>\n )\n}\n"]}
@@ -109,6 +109,7 @@ function FeedbackState({
109
109
  const finalDescription = getFeedbackDescription({ description, error, query, state });
110
110
  const finalTitle = title || config.defaultTitle;
111
111
  const iconNode = renderFeedbackIcon(icon ?? config.icon);
112
+ const Heading = `h${level}`;
112
113
  return /* @__PURE__ */ jsxs(
113
114
  "div",
114
115
  {
@@ -121,16 +122,7 @@ function FeedbackState({
121
122
  children: [
122
123
  /* @__PURE__ */ jsxs("div", { className: "a63-FeedbackState-header", "data-slot": "feedback-state-header", children: [
123
124
  showIcon && iconNode ? /* @__PURE__ */ jsx("div", { className: "a63-FeedbackState-media", "data-slot": "feedback-state-media", children: iconNode }) : null,
124
- /* @__PURE__ */ jsx(
125
- "div",
126
- {
127
- "aria-level": level,
128
- className: "a63-FeedbackState-title",
129
- "data-slot": "feedback-state-title",
130
- role: "heading",
131
- children: finalTitle
132
- }
133
- ),
125
+ /* @__PURE__ */ jsx(Heading, { className: "a63-FeedbackState-title", "data-slot": "feedback-state-title", children: finalTitle }),
134
126
  /* @__PURE__ */ jsx("div", { className: "a63-FeedbackState-description", "data-slot": "feedback-state-description", children: finalDescription })
135
127
  ] }),
136
128
  actions && actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "a63-FeedbackState-content", "data-slot": "feedback-state-content", children: actions.map((action) => /* @__PURE__ */ jsx(
@@ -146,5 +138,5 @@ function FeedbackState({
146
138
  }
147
139
 
148
140
  export { FeedbackState };
149
- //# sourceMappingURL=chunk-ASV4A4YB.js.map
150
- //# sourceMappingURL=chunk-ASV4A4YB.js.map
141
+ //# sourceMappingURL=chunk-4HE5IB6K.js.map
142
+ //# sourceMappingURL=chunk-4HE5IB6K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/feedback-state/feedback-state.tsx"],"names":[],"mappings":";;;;;;;AAeA,IAAM,aAAA,GAAgB;AAAA,EACpB,aAAA,EAAe,aAAA;AAAA,EACf,KAAA,EAAO,KAAA;AAAA,EACP,UAAA,EAAY,UAAA;AAAA,EACZ,KAAA,EAAO,KAAA;AAAA,EACP,SAAA,EAAW,SAAA;AAAA,EACX,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS,OAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAA;AAMA,SAAS,mBAAmB,IAAA,EAAsD;AAChF,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,IAAA;AAC/B,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,EAAU,OAAO,IAAA;AAErC,EAAA,MAAM,aAAA,GACJ,cACA,IAAI,CAAA;AACN,EAAA,OAAO,aAAA,mBAAgB,GAAA,CAAC,aAAA,EAAA,EAAc,aAAA,EAAW,MAAC,CAAA,GAAK,IAAA;AACzD;AAyBA,IAAM,WAAA,GAAc;AAAA,EAClB,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,OAAA;AAAA,IACN,YAAA,EAAc,gBAAA;AAAA,IACd,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,eAAA;AAAA,IACN,YAAA,EAAc,sBAAA;AAAA,IACd,kBAAA,EAAoB;AAAA,GACtB;AAAA,EACA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,SAAA;AAAA,IACN,YAAA,EAAc,SAAA;AAAA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AW,EAAA,CAAG,mBAAA,EAAqB,SAAS,CAAA;AAAA,MAC5C,WAAA,EAAW,IAAA;AAAA,MACX,WAAA,EAAU,gBAAA;AAAA,MACV,YAAA,EAAY,KAAA;AAAA,MACZ,IAAA,EAAM,KAAA,KAAU,OAAA,GAAU,OAAA,GAAU,QAAA;AAAA,MAEpC,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0BAAA,EAA2B,WAAA,EAAU,uBAAA,EACjD,QAAA,EAAA;AAAA,UAAA,QAAA,IAAY,QAAA,uBACV,KAAA,EAAA,EAAI,SAAA,EAAU,2BAA0B,WAAA,EAAU,sBAAA,EAChD,oBACH,CAAA,GACE,IAAA;AAAA,8BAEH,OAAA,EAAA,EAAQ,SAAA,EAAU,yBAAA,EAA0B,WAAA,EAAU,wBACpD,QAAA,EAAA,UAAA,EACH,CAAA;AAAA,8BACC,KAAA,EAAA,EAAI,SAAA,EAAU,+BAAA,EAAgC,WAAA,EAAU,8BACtD,QAAA,EAAA,gBAAA,EACH;AAAA,SAAA,EACF,CAAA;AAAA,QAEC,OAAA,IAAW,OAAA,CAAQ,MAAA,GAAS,CAAA,mBAC3B,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2BAAA,EAA4B,WAAA,EAAU,wBAAA,EAClD,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,MAAA,qBACX,GAAA;AAAA,UAAC,yBAAA;AAAA,UAAA;AAAA,YACC;AAAA,WAAA;AAAA,UACK,GAAG,MAAA,CAAO,KAAK,CAAA,CAAA,EAAI,MAAA,CAAO,QAAQ,QAAQ,CAAA;AAAA,SAElD,GACH,CAAA,GACE;AAAA;AAAA;AAAA,GACN;AAEJ","file":"chunk-4HE5IB6K.js","sourcesContent":["import {\n type FeedbackStateKind,\n type FeedbackStateSize,\n feedbackStateContract,\n} from '@atom63/ui-foundation'\nimport { AlertTriangle, Clock, FileSearch, Inbox, RefreshCw, SearchX, WifiOff } from 'lucide-react'\nimport type * as React from 'react'\n\nimport { cn } from '../../lib/cn'\nimport type { ButtonProps } from '../button'\nimport { Button } from '../button'\nimport { Spinner } from '../spinner'\n\nexport type { FeedbackStateKind, FeedbackStateSize }\n\nconst feedbackIcons = {\n alertTriangle: AlertTriangle,\n clock: Clock,\n fileSearch: FileSearch,\n inbox: Inbox,\n refreshCw: RefreshCw,\n searchX: SearchX,\n spinner: Spinner,\n wifiOff: WifiOff,\n} satisfies Record<string, React.ComponentType<React.ComponentProps<'svg'>>>\n\n/** A built-in icon name, or any element (for icons outside the built-in set). */\nexport type FeedbackStateIconName = keyof typeof feedbackIcons\nexport type FeedbackStateIcon = FeedbackStateIconName | React.ReactElement\n\nfunction renderFeedbackIcon(icon: FeedbackStateIcon | undefined): React.ReactNode {\n if (icon === undefined) return null\n if (typeof icon !== 'string') return icon\n // Types reject unknown names; untyped callers get no icon rather than a crash.\n const IconComponent = (\n feedbackIcons as Record<string, React.ComponentType<React.ComponentProps<'svg'>> | undefined>\n )[icon]\n return IconComponent ? <IconComponent aria-hidden /> : null\n}\n\nexport interface FeedbackStateAction {\n href?: string\n icon?: FeedbackStateIcon\n label: string\n onClick?: () => void\n variant?: ButtonProps['variant']\n}\n\nexport interface FeedbackStateProps {\n actions?: FeedbackStateAction[]\n className?: string\n description?: string\n error?: unknown\n icon?: FeedbackStateIcon\n /** Heading level of the title, to fit the page outline. Defaults to 3. */\n level?: 1 | 2 | 3 | 4 | 5 | 6\n query?: string\n showIcon?: boolean\n size?: FeedbackStateSize\n state?: FeedbackStateKind\n title?: string\n}\n\nconst stateConfig = {\n empty: {\n icon: 'inbox',\n defaultTitle: 'No content yet',\n defaultDescription: \"There's nothing here at the moment\",\n },\n error: {\n icon: 'alertTriangle',\n defaultTitle: 'Something went wrong',\n defaultDescription: 'An unexpected error occurred',\n },\n loading: {\n icon: 'spinner',\n defaultTitle: 'Loading',\n defaultDescription: 'Loading...',\n },\n 'not-found': {\n icon: 'searchX',\n defaultTitle: 'Nothing found',\n defaultDescription: \"We couldn't find what you're looking for\",\n },\n 'no-results': {\n icon: 'fileSearch',\n defaultTitle: 'No results',\n defaultDescription: 'No items match your search criteria',\n },\n offline: {\n icon: 'wifiOff',\n defaultTitle: 'You are offline',\n defaultDescription: 'Reconnect to continue with the latest content',\n },\n stale: {\n icon: 'clock',\n defaultTitle: 'Showing saved content',\n defaultDescription: 'This content may be out of date',\n },\n} as const satisfies Record<\n FeedbackStateKind,\n { icon: FeedbackStateIconName; defaultTitle: string; defaultDescription: string }\n>\n\nfunction getFeedbackDescription({\n description,\n error,\n query,\n state,\n}: Pick<FeedbackStateProps, 'description' | 'error' | 'query'> & {\n state: FeedbackStateKind\n}) {\n if (description) {\n return description\n }\n\n if (state === 'error' && error instanceof Error) {\n return error.message\n }\n\n if (state === 'no-results' && query) {\n return `No results found for \"${query}\"`\n }\n\n return stateConfig[state].defaultDescription\n}\n\nfunction FeedbackStateActionButton({ action }: { action: FeedbackStateAction }) {\n const inner = (\n <>\n {renderFeedbackIcon(action.icon)}\n {action.label}\n </>\n )\n\n if (action.href) {\n return (\n <Button\n render={<a href={action.href}>{inner}</a>}\n size=\"sm\"\n variant={action.variant ?? 'outline'}\n />\n )\n }\n\n return (\n <Button onClick={action.onClick} size=\"sm\" type=\"button\" variant={action.variant ?? 'outline'}>\n {inner}\n </Button>\n )\n}\n\n/* FeedbackState — the empty/error/loading/not-found/no-results pattern, ported\n from prod @atom63/ui. Prod composed a separate `Empty` (which pulled in\n CopyButton → sonner); here the empty-state layout is inlined as\n `.a63-FeedbackState-*` elements so this pattern stays self-contained.\n The root is one live region that stays mounted across states, so a change of\n state only changes its text and screen readers announce it: polite\n (role=status) for loading and the result states, assertive (role=alert) for\n an error. It is never aria-busy, which would silence it; mark the content\n being loaded busy instead. */\nexport function FeedbackState({\n actions,\n className,\n description,\n error,\n icon,\n level = 3,\n query,\n showIcon = true,\n size = feedbackStateContract.defaultSize,\n state = feedbackStateContract.defaultKind,\n title,\n}: FeedbackStateProps): React.ReactElement {\n const config = stateConfig[state]\n const finalDescription = getFeedbackDescription({ description, error, query, state })\n const finalTitle = title || config.defaultTitle\n const iconNode = renderFeedbackIcon(icon ?? config.icon)\n const Heading = `h${level}` as const\n\n return (\n <div\n aria-live={state === 'error' ? 'assertive' : 'polite'}\n className={cn('a63-FeedbackState', className)}\n data-size={size}\n data-slot=\"feedback-state\"\n data-state={state}\n role={state === 'error' ? 'alert' : 'status'}\n >\n <div className=\"a63-FeedbackState-header\" data-slot=\"feedback-state-header\">\n {showIcon && iconNode ? (\n <div className=\"a63-FeedbackState-media\" data-slot=\"feedback-state-media\">\n {iconNode}\n </div>\n ) : null}\n\n <Heading className=\"a63-FeedbackState-title\" data-slot=\"feedback-state-title\">\n {finalTitle}\n </Heading>\n <div className=\"a63-FeedbackState-description\" data-slot=\"feedback-state-description\">\n {finalDescription}\n </div>\n </div>\n\n {actions && actions.length > 0 ? (\n <div className=\"a63-FeedbackState-content\" data-slot=\"feedback-state-content\">\n {actions.map(action => (\n <FeedbackStateActionButton\n action={action}\n key={`${action.label}-${action.href ?? 'button'}`}\n />\n ))}\n </div>\n ) : null}\n </div>\n )\n}\n"]}
@@ -1,15 +1,21 @@
1
+ import { Button } from './chunk-CYWNKIIJ.js';
1
2
  import { cn } from './chunk-AJLHJRK6.js';
2
3
  import { tableContract } from '@atom63/ui-foundation';
3
- import { jsx } from 'react/jsx-runtime';
4
+ import { ArrowUp, ArrowDown, ArrowUpDown } from 'lucide-react';
5
+ import { createContext, useContext } from 'react';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
7
 
8
+ var TableSortContext = createContext({});
5
9
  function Table({
6
10
  className,
11
+ onSortChange,
7
12
  size = tableContract.defaultSize,
13
+ sort,
8
14
  tone = tableContract.defaultTone,
9
15
  variant = tableContract.defaultVariant,
10
16
  ...props
11
17
  }) {
12
- return /* @__PURE__ */ jsx(
18
+ return /* @__PURE__ */ jsx(TableSortContext.Provider, { value: { onSortChange, sort }, children: /* @__PURE__ */ jsx(
13
19
  "div",
14
20
  {
15
21
  className: "a63-Table-container",
@@ -19,7 +25,7 @@ function Table({
19
25
  "data-variant": variant,
20
26
  children: /* @__PURE__ */ jsx("table", { className: cn("a63-Table", className), "data-slot": "table", ...props })
21
27
  }
22
- );
28
+ ) });
23
29
  }
24
30
  function TableHeader({ className, ...props }) {
25
31
  return /* @__PURE__ */ jsx("thead", { className: cn("a63-Table-header", className), "data-slot": "table-header", ...props });
@@ -33,14 +39,48 @@ function TableFooter({ className, ...props }) {
33
39
  function TableRow({ className, ...props }) {
34
40
  return /* @__PURE__ */ jsx("tr", { className: cn("a63-Table-row", className), "data-slot": "table-row", ...props });
35
41
  }
36
- function TableHead({ className, sticky, ...props }) {
42
+ function defaultSortIcon(direction) {
43
+ if (direction === "ascending") return /* @__PURE__ */ jsx(ArrowUp, { "aria-hidden": true });
44
+ if (direction === "descending") return /* @__PURE__ */ jsx(ArrowDown, { "aria-hidden": true });
45
+ return /* @__PURE__ */ jsx(ArrowUpDown, { "aria-hidden": true });
46
+ }
47
+ function TableHead({
48
+ children,
49
+ className,
50
+ firstSortDirection = "ascending",
51
+ sortIcon = defaultSortIcon,
52
+ sortKey,
53
+ sticky,
54
+ ...props
55
+ }) {
56
+ const { onSortChange, sort } = useContext(TableSortContext);
57
+ const direction = sortKey !== void 0 && sort?.column === sortKey ? sort.direction : void 0;
37
58
  return /* @__PURE__ */ jsx(
38
59
  "th",
39
60
  {
61
+ "aria-sort": direction,
40
62
  className: cn("a63-Table-head", className),
41
63
  "data-slot": "table-head",
42
64
  "data-sticky": sticky,
43
- ...props
65
+ ...props,
66
+ children: sortKey === void 0 ? children : /* @__PURE__ */ jsxs(
67
+ Button,
68
+ {
69
+ className: "a63-Table-sort-button",
70
+ "data-slot": "table-sort-button",
71
+ onClick: () => onSortChange?.({
72
+ column: sortKey,
73
+ direction: direction === void 0 ? firstSortDirection : direction === "ascending" ? "descending" : "ascending"
74
+ }),
75
+ size: "xs",
76
+ tone: "muted",
77
+ variant: "ghost",
78
+ children: [
79
+ children,
80
+ sortIcon(direction ?? "none")
81
+ ]
82
+ }
83
+ )
44
84
  }
45
85
  );
46
86
  }
@@ -60,5 +100,5 @@ function TableCaption({ className, ...props }) {
60
100
  }
61
101
 
62
102
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
63
- //# sourceMappingURL=chunk-GRRWPMZI.js.map
64
- //# sourceMappingURL=chunk-GRRWPMZI.js.map
103
+ //# sourceMappingURL=chunk-77CBRRVT.js.map
104
+ //# sourceMappingURL=chunk-77CBRRVT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/table/table.tsx"],"names":[],"mappings":";;;;;;;AA+BA,IAAM,gBAAA,GAAmB,aAAA,CAAqC,EAAE,CAAA;AA4BzD,SAAS,KAAA,CAAM;AAAA,EACpB,SAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAO,aAAA,CAAc,WAAA;AAAA,EACrB,IAAA;AAAA,EACA,OAAO,aAAA,CAAc,WAAA;AAAA,EACrB,UAAU,aAAA,CAAc,cAAA;AAAA,EACxB,GAAG;AACL,CAAA,EAAmC;AACjC,EAAA,uBACE,GAAA,CAAC,iBAAiB,QAAA,EAAjB,EAA0B,OAAO,EAAE,YAAA,EAAc,MAAK,EACrD,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,qBAAA;AAAA,MACV,WAAA,EAAW,IAAA,KAAS,SAAA,GAAY,IAAA,GAAO,IAAA;AAAA,MACvC,WAAA,EAAU,iBAAA;AAAA,MACV,WAAA,EAAW,IAAA;AAAA,MACX,cAAA,EAAc,OAAA;AAAA,MAEd,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAW,EAAA,CAAG,WAAA,EAAa,SAAS,CAAA,EAAG,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO;AAAA;AAAA,GAC7E,EAC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AA;AAAA,MACC,SAAA,EAAW,EAAA,CAAG,gBAAA,EAAkB,SAAS,CAAA;AAAA,MACzC,WAAA,EAAU,YAAA;AAAA,MACV,aAAA,EAAa,MAAA;AAAA,MACZ,GAAG;AAAA;AAAA,GACN;AAEJ;AAIO,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAA0C;AAC3F,EAAA,uBACE,GAAA,CAAC,SAAA,EAAA,EAAQ,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,SAAS,CAAA,EAAG,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AAEjG","file":"chunk-77CBRRVT.js","sourcesContent":["'use client'\n\nimport {\n type TableSize,\n type TableSizeAlias,\n type TableStickyEdge,\n type TableTone,\n type TableVariant,\n tableContract,\n} from '@atom63/ui-foundation'\nimport { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react'\nimport { createContext, useContext } from 'react'\nimport type * as React from 'react'\n\nimport { cn } from '../../lib/cn'\nimport { Button } from '../button'\n\n/** The direction a sorted column is in, named as `aria-sort` names it. */\nexport type TableSortDirection = 'ascending' | 'descending'\n\n/** The column the table is sorted by. The caller sorts the rows; the table only shows it. */\nexport interface TableSort {\n column: string\n direction: TableSortDirection\n}\n\ninterface TableSortContextValue {\n onSortChange?: (sort: TableSort) => void\n sort?: TableSort | null\n}\n\nconst TableSortContext = createContext<TableSortContextValue>({})\n\n/* Table — the tabular-data set. Faithful port of prod @atom63/ui Table: a\n horizontally scrollable container wrapping a semantic <table> with header /\n body / footer / row / head / cell / caption parts. Each part carries its\n data-slot; the base look is DS-tokenized, and a `frame` ancestor\n (data-slot=\"frame\") switches on the bordered-card treatment. `size`, `tone`\n and `variant` sit on the container; `sticky` pins a head or body cell to an\n inline edge while the container scrolls. */\n\nexport type TableProps = React.ComponentProps<'table'> & {\n /** `'default'` is a deprecated alias of `'md'`. */\n size?: TableSize | TableSizeAlias\n /**\n * How selected rows (`data-state=\"selected\"`) are coloured. `neutral` (the\n * default) is a muted fill with primary text; `accent` is a light primary wash\n * with accent text.\n */\n tone?: TableTone\n variant?: TableVariant\n /** The column the rows are sorted by (controlled), shown by the `TableHead` whose `sortKey`\n * matches. `null` or omitted: no column is sorted. */\n sort?: TableSort | null\n /** Called when a sortable `TableHead` is pressed, with the sort to apply. Sort the rows and\n * pass the new value back as `sort`. */\n onSortChange?: (sort: TableSort) => void\n}\n\nexport function Table({\n className,\n onSortChange,\n size = tableContract.defaultSize,\n sort,\n tone = tableContract.defaultTone,\n variant = tableContract.defaultVariant,\n ...props\n}: TableProps): React.ReactElement {\n return (\n <TableSortContext.Provider value={{ onSortChange, sort }}>\n <div\n className=\"a63-Table-container\"\n data-size={size === 'default' ? 'md' : size}\n data-slot=\"table-container\"\n data-tone={tone}\n data-variant={variant}\n >\n <table className={cn('a63-Table', className)} data-slot=\"table\" {...props} />\n </div>\n </TableSortContext.Provider>\n )\n}\n\nexport type TableHeaderProps = React.ComponentProps<'thead'>\n\nexport function TableHeader({ className, ...props }: TableHeaderProps): React.ReactElement {\n return <thead className={cn('a63-Table-header', className)} data-slot=\"table-header\" {...props} />\n}\n\nexport type TableBodyProps = React.ComponentProps<'tbody'>\n\nexport function TableBody({ className, ...props }: TableBodyProps): React.ReactElement {\n return <tbody className={cn('a63-Table-body', className)} data-slot=\"table-body\" {...props} />\n}\n\nexport type TableFooterProps = React.ComponentProps<'tfoot'>\n\nexport function TableFooter({ className, ...props }: TableFooterProps): React.ReactElement {\n return <tfoot className={cn('a63-Table-footer', className)} data-slot=\"table-footer\" {...props} />\n}\n\nexport type TableRowProps = React.ComponentProps<'tr'>\n\nexport function TableRow({ className, ...props }: TableRowProps): React.ReactElement {\n return <tr className={cn('a63-Table-row', className)} data-slot=\"table-row\" {...props} />\n}\n\nexport type TableHeadProps = React.ComponentProps<'th'> & {\n sticky?: TableStickyEdge\n /** Makes the column sortable: the header becomes a button that calls the Table's\n * `onSortChange` with this key, and the cell carries `aria-sort` while the Table's\n * `sort.column` is this key. */\n sortKey?: string\n /** The direction a first press sorts in. Later presses flip it. */\n firstSortDirection?: TableSortDirection\n /** Replaces the sort icon. Receives the column's direction, or `none` while it is not sorted. */\n sortIcon?: (direction: TableSortDirection | 'none') => React.ReactNode\n}\n\nfunction defaultSortIcon(direction: TableSortDirection | 'none'): React.ReactNode {\n if (direction === 'ascending') return <ArrowUp aria-hidden />\n if (direction === 'descending') return <ArrowDown aria-hidden />\n return <ArrowUpDown aria-hidden />\n}\n\nexport function TableHead({\n children,\n className,\n firstSortDirection = 'ascending',\n sortIcon = defaultSortIcon,\n sortKey,\n sticky,\n ...props\n}: TableHeadProps): React.ReactElement {\n const { onSortChange, sort } = useContext(TableSortContext)\n const direction = sortKey !== undefined && sort?.column === sortKey ? sort.direction : undefined\n return (\n <th\n aria-sort={direction}\n className={cn('a63-Table-head', className)}\n data-slot=\"table-head\"\n data-sticky={sticky}\n {...props}\n >\n {sortKey === undefined ? (\n children\n ) : (\n <Button\n className=\"a63-Table-sort-button\"\n data-slot=\"table-sort-button\"\n onClick={() =>\n onSortChange?.({\n column: sortKey,\n direction:\n direction === undefined\n ? firstSortDirection\n : direction === 'ascending'\n ? 'descending'\n : 'ascending',\n })\n }\n size=\"xs\"\n tone=\"muted\"\n variant=\"ghost\"\n >\n {children}\n {sortIcon(direction ?? 'none')}\n </Button>\n )}\n </th>\n )\n}\n\nexport type TableCellProps = React.ComponentProps<'td'> & {\n sticky?: TableStickyEdge\n}\n\nexport function TableCell({ className, sticky, ...props }: TableCellProps): React.ReactElement {\n return (\n <td\n className={cn('a63-Table-cell', className)}\n data-slot=\"table-cell\"\n data-sticky={sticky}\n {...props}\n />\n )\n}\n\nexport type TableCaptionProps = React.ComponentProps<'caption'>\n\nexport function TableCaption({ className, ...props }: TableCaptionProps): React.ReactElement {\n return (\n <caption className={cn('a63-Table-caption', className)} data-slot=\"table-caption\" {...props} />\n )\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { Skeleton } from './chunk-34JIIXPP.js';
2
2
  import { Tooltip, TooltipTrigger, TooltipPopup } from './chunk-KJMIFN46.js';
3
- import { Sheet, SheetPopup, SheetHeader, SheetTitle, SheetDescription } from './chunk-BSDSLG3L.js';
4
- import { Input } from './chunk-PAWFTQV6.js';
3
+ import { Sheet, SheetPopup, SheetHeader, SheetTitle, SheetDescription } from './chunk-IEHYTNLS.js';
5
4
  import { Separator } from './chunk-R35FHBSP.js';
5
+ import { Input } from './chunk-PAWFTQV6.js';
6
6
  import { Button } from './chunk-CYWNKIIJ.js';
7
7
  import { cn } from './chunk-AJLHJRK6.js';
8
8
  import { sidebarContract } from '@atom63/ui-foundation';
@@ -620,5 +620,5 @@ function SidebarMenuSubButton({
620
620
  }
621
621
 
622
622
  export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
623
- //# sourceMappingURL=chunk-L5KFLZUC.js.map
624
- //# sourceMappingURL=chunk-L5KFLZUC.js.map
623
+ //# sourceMappingURL=chunk-BQONJKNA.js.map
624
+ //# sourceMappingURL=chunk-BQONJKNA.js.map