basalt-ui 2.28.0 → 2.29.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/CHANGELOG.md +461 -401
- package/MIGRATING.md +202 -12
- package/agent/skills/basalt-app/SKILL.md +3 -3
- package/agent/skills/basalt-charts/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +11 -5
- package/agent/skills/basalt-design/references/catalogue.md +3 -1
- package/agent/skills/basalt-design/references/recipes.md +1 -1
- package/agent/skills/basalt-design/references/states.md +1 -1
- package/configs/oxlint-plugin.js +2 -1
- package/configs/oxlint.json +1 -0
- package/dist/charts/ChartCard.d.ts +9 -5
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +68 -12
- package/dist/charts/Sparkline.d.ts +5 -0
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +53 -5
- package/dist/charts/chart-box.module.css +9 -2
- package/dist/charts/chart-card.module.css +16 -13
- package/dist/charts/chart-card.module.css.d.ts +2 -0
- package/dist/charts/compile.d.ts +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +18 -9
- package/dist/charts/ref-label.d.ts +6 -0
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +19 -5
- package/dist/charts/sparkline.module.css +44 -0
- package/dist/charts/sparkline.module.css.d.ts +3 -0
- package/dist/charts/state.d.ts +1 -1
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +3 -3
- package/dist/cli/doctor-upgrade.d.ts +11 -0
- package/dist/cli/doctor-upgrade.d.ts.map +1 -1
- package/dist/cli/doctor-upgrade.js +54 -0
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +8 -3
- package/dist/cli/index.d.ts +13 -13
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -2
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +118 -27
- package/dist/cli/router-wiring.d.ts +3 -0
- package/dist/cli/router-wiring.d.ts.map +1 -1
- package/dist/cli/router-wiring.js +2 -0
- package/dist/cli/shot/capture.d.ts +28 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +77 -7
- package/dist/cli/shot/detect.d.ts +4 -1
- package/dist/cli/shot/detect.d.ts.map +1 -1
- package/dist/cli/shot/detect.js +38 -16
- package/dist/cli/shot/index.d.ts.map +1 -1
- package/dist/cli/shot/index.js +9 -2
- package/dist/cli/shot/measure.d.ts.map +1 -1
- package/dist/cli/shot/measure.js +11 -2
- package/dist/cli/shot/types.d.ts +4 -1
- package/dist/cli/shot/types.d.ts.map +1 -1
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +10 -2
- package/dist/common/could-not-load.d.ts +13 -0
- package/dist/common/could-not-load.d.ts.map +1 -0
- package/dist/common/could-not-load.js +14 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +3 -0
- package/dist/common/props.d.ts +20 -0
- package/dist/common/props.d.ts.map +1 -1
- package/dist/common/props.js +13 -1
- package/dist/common/retry-button.module.css +7 -3
- package/dist/dashboard/bar-list.d.ts +4 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +10 -7
- package/dist/dashboard/bar-list.module.css +21 -3
- package/dist/dashboard/board.d.ts +2 -2
- package/dist/dashboard/board.d.ts.map +1 -1
- package/dist/dashboard/board.js +31 -12
- package/dist/dashboard/board.module.css +19 -0
- package/dist/dashboard/board.module.css.d.ts +2 -0
- package/dist/dashboard/empty-state.d.ts +3 -3
- package/dist/dashboard/empty-state.d.ts.map +1 -1
- package/dist/dashboard/empty-state.js +4 -2
- package/dist/dashboard/event-list-model.d.ts +3 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -1
- package/dist/dashboard/event-list-model.js +5 -1
- package/dist/dashboard/event-list-rows.d.ts.map +1 -1
- package/dist/dashboard/event-list-rows.js +2 -6
- package/dist/dashboard/event-list-scroll.d.ts +32 -4
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -1
- package/dist/dashboard/event-list-scroll.js +117 -4
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -1
- package/dist/dashboard/event-list-skeleton.js +2 -4
- package/dist/dashboard/event-list.d.ts +4 -4
- package/dist/dashboard/event-list.d.ts.map +1 -1
- package/dist/dashboard/event-list.js +53 -23
- package/dist/dashboard/event-list.module.css +90 -37
- package/dist/dashboard/event-list.module.css.d.ts +1 -0
- package/dist/dashboard/meter-model.d.ts +6 -3
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +9 -4
- package/dist/dashboard/meter-parts.d.ts +3 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +32 -4
- package/dist/dashboard/meter.d.ts +3 -3
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +10 -2
- package/dist/dashboard/meter.module.css +18 -11
- package/dist/dashboard/meter.module.css.d.ts +0 -1
- package/dist/dashboard/page-summary.d.ts +3 -3
- package/dist/dashboard/page-summary.d.ts.map +1 -1
- package/dist/dashboard/page-summary.js +7 -2
- package/dist/dashboard/page-summary.module.css +5 -2
- package/dist/dashboard/query-state.d.ts +9 -8
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +28 -10
- package/dist/dashboard/section.d.ts +11 -3
- package/dist/dashboard/section.d.ts.map +1 -1
- package/dist/dashboard/section.js +34 -7
- package/dist/dashboard/settings-section.d.ts +4 -4
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +11 -7
- package/dist/dashboard/settings-section.module.css +6 -0
- package/dist/dashboard/settings-section.module.css.d.ts +1 -0
- package/dist/dashboard/stat-card.d.ts +3 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +24 -8
- package/dist/dashboard/stat-card.module.css +11 -0
- package/dist/dashboard/stat-group.d.ts +2 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +10 -3
- package/dist/dashboard/stat-strip.d.ts +5 -4
- package/dist/dashboard/stat-strip.d.ts.map +1 -1
- package/dist/dashboard/stat-strip.js +41 -31
- package/dist/dashboard/stat-strip.module.css +4 -5
- package/dist/dashboard/visual-slot.d.ts +4 -0
- package/dist/dashboard/visual-slot.d.ts.map +1 -1
- package/dist/dashboard/visual-slot.js +2 -0
- package/dist/dashboard/widget-header.d.ts +6 -6
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +4 -2
- package/dist/dashboard/widget-header.module.css +6 -25
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +24 -1
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -1
- package/dist/styles.css +23 -0
- package/dist/table/cell-kinds.d.ts +10 -7
- package/dist/table/cell-kinds.d.ts.map +1 -1
- package/dist/table/cell-kinds.js +18 -7
- package/dist/table/data-table-fold.d.ts +13 -5
- package/dist/table/data-table-fold.d.ts.map +1 -1
- package/dist/table/data-table-fold.js +48 -16
- package/dist/table/data-table.d.ts +2 -2
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +16 -9
- package/dist/table/data-table.module.css +74 -2
- package/dist/table/data-table.module.css.d.ts +4 -0
- package/dist/theme/controls.module.css +23 -2
- package/llms.txt +263 -2
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +98 -16
- package/src/charts/Sparkline.tsx +84 -5
- package/src/charts/chart-box.module.css +9 -2
- package/src/charts/chart-card.module.css +16 -13
- package/src/charts/chart-card.module.css.d.ts +2 -0
- package/src/charts/compile.ts +37 -15
- package/src/charts/ref-label.ts +36 -9
- package/src/charts/sparkline.module.css +44 -0
- package/src/charts/sparkline.module.css.d.ts +3 -0
- package/src/charts/state.tsx +4 -3
- package/src/cli/doctor-upgrade.ts +75 -0
- package/src/cli/doctor.ts +36 -0
- package/src/cli/help.ts +16 -6
- package/src/cli/index.ts +73 -67
- package/src/cli/init.ts +157 -36
- package/src/cli/router-wiring.ts +2 -2
- package/src/cli/shot/capture.ts +109 -10
- package/src/cli/shot/detect.ts +46 -22
- package/src/cli/shot/index.ts +8 -2
- package/src/cli/shot/measure.ts +11 -2
- package/src/cli/shot/types.ts +4 -1
- package/src/cli/sync.ts +12 -2
- package/src/common/could-not-load.ts +22 -0
- package/src/common/index.ts +1 -0
- package/src/common/props.ts +30 -0
- package/src/common/retry-button.module.css +7 -3
- package/src/dashboard/bar-list.module.css +21 -3
- package/src/dashboard/bar-list.tsx +46 -41
- package/src/dashboard/board.module.css +19 -0
- package/src/dashboard/board.module.css.d.ts +2 -0
- package/src/dashboard/board.tsx +69 -48
- package/src/dashboard/empty-state.tsx +5 -2
- package/src/dashboard/event-list-model.ts +13 -1
- package/src/dashboard/event-list-rows.tsx +3 -6
- package/src/dashboard/event-list-scroll.ts +154 -8
- package/src/dashboard/event-list-skeleton.tsx +5 -1
- package/src/dashboard/event-list.module.css +90 -37
- package/src/dashboard/event-list.module.css.d.ts +1 -0
- package/src/dashboard/event-list.tsx +92 -65
- package/src/dashboard/meter-model.ts +16 -7
- package/src/dashboard/meter-parts.tsx +45 -13
- package/src/dashboard/meter.module.css +18 -11
- package/src/dashboard/meter.module.css.d.ts +0 -1
- package/src/dashboard/meter.tsx +36 -18
- package/src/dashboard/page-summary.module.css +5 -2
- package/src/dashboard/page-summary.tsx +13 -6
- package/src/dashboard/query-state.tsx +54 -29
- package/src/dashboard/section.tsx +83 -41
- package/src/dashboard/settings-section.module.css +6 -0
- package/src/dashboard/settings-section.module.css.d.ts +1 -0
- package/src/dashboard/settings-section.tsx +11 -6
- package/src/dashboard/stat-card.module.css +11 -0
- package/src/dashboard/stat-card.tsx +31 -8
- package/src/dashboard/stat-group.tsx +22 -14
- package/src/dashboard/stat-strip.module.css +4 -5
- package/src/dashboard/stat-strip.tsx +29 -20
- package/src/dashboard/visual-slot.ts +5 -0
- package/src/dashboard/widget-header.module.css +6 -25
- package/src/dashboard/widget-header.tsx +8 -5
- package/src/format/shared.ts +30 -1
- package/src/guard/index.ts +5 -1
- package/src/styles.css +23 -0
- package/src/table/cell-kinds.tsx +42 -13
- package/src/table/data-table-fold.tsx +65 -12
- package/src/table/data-table.module.css +74 -2
- package/src/table/data-table.module.css.d.ts +4 -0
- package/src/table/data-table.tsx +34 -13
- package/src/theme/controls.module.css +23 -2
package/dist/table/cell-kinds.js
CHANGED
|
@@ -24,15 +24,25 @@ function resolveKind(column) {
|
|
|
24
24
|
function kindAlign(kind) {
|
|
25
25
|
return kind === "number" || kind === "money" ? "right" : void 0;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const SHORT_TEXT = 32;
|
|
28
|
+
function isShortText(id, rows) {
|
|
29
|
+
return rows.length > 0 && rows.every((row) => {
|
|
30
|
+
const value = row.getValue(id);
|
|
31
|
+
return typeof value === "string" && value.length <= SHORT_TEXT;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function planColumnSizing(columns, fixedIds, rows) {
|
|
28
35
|
const data = columns.filter((column) => !fixedIds.has(column.id));
|
|
29
36
|
const kinds = new Map(data.map((column) => [column.id, resolveKind(column)]));
|
|
30
37
|
const fitIds = new Set(columns.filter((column) => fixedIds.has(column.id)).map((c) => c.id));
|
|
31
38
|
const hasKinds = data.some((column) => kinds.get(column.id) !== void 0);
|
|
32
39
|
if (!hasKinds) return { fitIds, spacer: false };
|
|
33
|
-
const
|
|
40
|
+
const tail = data.at(-1);
|
|
41
|
+
const tailKind = tail === void 0 ? void 0 : kinds.get(tail.id);
|
|
42
|
+
const slackId = tail !== void 0 && (tailKind === void 0 || tailKind === "text" || tailKind === "entity") ? tail.id : data.findLast((column) => kinds.get(column.id) === "text" && !isShortText(column.id, rows))?.id;
|
|
34
43
|
for (const column of data) {
|
|
35
|
-
if (column.id === slackId
|
|
44
|
+
if (column.id === slackId) continue;
|
|
45
|
+
if (kinds.get(column.id) === "text" && !isShortText(column.id, rows)) continue;
|
|
36
46
|
fitIds.add(column.id);
|
|
37
47
|
}
|
|
38
48
|
return { fitIds, spacer: slackId === void 0 };
|
|
@@ -43,8 +53,8 @@ const SKELETON_WIDTH = {
|
|
|
43
53
|
status: "4.5rem",
|
|
44
54
|
"relative-time": "4.5rem",
|
|
45
55
|
meter: "4rem",
|
|
46
|
-
entity: "100
|
|
47
|
-
text: "10rem",
|
|
56
|
+
entity: "min(100%, 10rem)",
|
|
57
|
+
text: "min(100%, 10rem)",
|
|
48
58
|
kindless: "100%"
|
|
49
59
|
};
|
|
50
60
|
function KindSkeleton({
|
|
@@ -108,8 +118,9 @@ function RelativeTime({ value }) {
|
|
|
108
118
|
if (date === void 0) return /* @__PURE__ */ jsx(Dash, {});
|
|
109
119
|
const full = dateTime(date);
|
|
110
120
|
return (
|
|
111
|
-
//
|
|
112
|
-
|
|
121
|
+
// Beside the cell, on hover and keyboard focus: below it the tip covered the next row's time, above it
|
|
122
|
+
// the header's label on row one.
|
|
123
|
+
/* @__PURE__ */ jsx(Tooltip, { label: full, position: "right", events: { hover: true, focus: true, touch: false }, children: /* @__PURE__ */ jsxs("time", { dateTime: date.toISOString(), tabIndex: 0, children: [
|
|
113
124
|
relativeTime(date),
|
|
114
125
|
/* @__PURE__ */ jsx("span", { className: classes.srOnly, children: `, ${full}` })
|
|
115
126
|
] }) })
|
|
@@ -129,11 +129,19 @@ export declare function RowDisclosure<T extends RowData>({ row, folded, }: {
|
|
|
129
129
|
row: Row<BasaltTableFeatures, T>;
|
|
130
130
|
folded: ReadonlySet<string>;
|
|
131
131
|
}): ReactNode;
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
/** "2 more columns: C, D" — the folded columns, counted and named. */
|
|
133
|
+
export declare function foldedSummary(count: number, label: string): string;
|
|
134
|
+
/** The header cell above the toggles: a micro count of what folded, and a button that NAMES them. The
|
|
135
|
+
* button's accessible name is the one summary (F102 — a hidden column must be announced, not merely
|
|
136
|
+
* reachable); its `title` is the mouse hint, and a tap, Enter or Space opens a popover listing the
|
|
137
|
+
* folded columns, because a touch reader never sees a `title` (the 390 crop read as an unexplained
|
|
138
|
+
* "+3 cols"). The popover closes on outside click and Escape. A bare `+N` read as an unexplained
|
|
139
|
+
* figure at 390, so the word rides with it — in the sans micro face, which keeps "+4 cols" inside
|
|
140
|
+
* the 44px toggle cell (the mono face did not). A second line shows the first folded name, ellipsised to
|
|
141
|
+
* the cell, so the button says what it opens before it is tapped. */
|
|
142
|
+
export declare function FoldHeaderLabel({ names, }: {
|
|
143
|
+
/** The folded columns' headers, in column order. */
|
|
144
|
+
names: readonly string[];
|
|
137
145
|
}): ReactNode;
|
|
138
146
|
/** The per-row expand/collapse control the fold column renders — a ghost chevron whose accessible
|
|
139
147
|
* name says WHAT folded ("Show Volume, Duration"), its 44px hit area carried by the hit overlay
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-fold.d.ts","sourceRoot":"","sources":["../../src/table/data-table-fold.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,MAAM,EACN,SAAS,EACT,GAAG,EACH,OAAO,EACP,KAAK,IAAI,aAAa,EACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D;0BAC0B;AAC1B,wBAAgB,WAAW,CAAC,CAAC,SAAS,OAAO,EAC3C,MAAM,EAAE,SAAS,CAAC,mBAAmB,EAAE,CAAC,EAAE,OAAO,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,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB,GAAG,SAAS,CA2BZ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Text } from "@mantine/core";
|
|
2
|
+
import { Popover, Text } from "@mantine/core";
|
|
3
3
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { HIT_COARSE } from "../common/hit-floor.js";
|
|
5
5
|
import { useMeasuredWidths } from "../common/use-measured-widths.js";
|
|
@@ -220,23 +220,54 @@ function RowDisclosure({
|
|
|
220
220
|
/* @__PURE__ */ jsx("div", { className: classes.foldDisclosureValue, children: /* @__PURE__ */ jsx(CellContent, { cell }) })
|
|
221
221
|
] }, cell.id)) });
|
|
222
222
|
}
|
|
223
|
+
function foldNoun(count, short) {
|
|
224
|
+
const noun = short ? "col" : "column";
|
|
225
|
+
return count === 1 ? noun : `${noun}s`;
|
|
226
|
+
}
|
|
227
|
+
function foldedSummary(count, label) {
|
|
228
|
+
return `${count} more ${foldNoun(count, false)}: ${label}`;
|
|
229
|
+
}
|
|
223
230
|
function FoldHeaderLabel({
|
|
224
|
-
|
|
225
|
-
foldedLabel
|
|
231
|
+
names
|
|
226
232
|
}) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
const [opened, setOpened] = useState(false);
|
|
234
|
+
const count = names.length;
|
|
235
|
+
const summary = foldedSummary(count, names.join(", "));
|
|
236
|
+
const visible = `+${count} ${foldNoun(count, true)}`;
|
|
237
|
+
return /* @__PURE__ */ jsx("span", { className: classes.foldCount, children: /* @__PURE__ */ jsxs(
|
|
238
|
+
Popover,
|
|
239
|
+
{
|
|
240
|
+
opened,
|
|
241
|
+
onChange: setOpened,
|
|
242
|
+
position: "bottom-start",
|
|
243
|
+
withinPortal: true,
|
|
244
|
+
shadow: "md",
|
|
245
|
+
transitionProps: { duration: 0 },
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsxs(
|
|
248
|
+
"button",
|
|
249
|
+
{
|
|
250
|
+
type: "button",
|
|
251
|
+
className: classes.foldCountButton,
|
|
252
|
+
"data-basalt-hit": true,
|
|
253
|
+
title: summary,
|
|
254
|
+
"aria-label": `${visible}, ${summary}`,
|
|
255
|
+
"aria-haspopup": "dialog",
|
|
256
|
+
"aria-expanded": opened,
|
|
257
|
+
onClick: (event) => {
|
|
258
|
+
event.stopPropagation();
|
|
259
|
+
setOpened((open) => !open);
|
|
260
|
+
},
|
|
261
|
+
children: [
|
|
262
|
+
visible,
|
|
263
|
+
/* @__PURE__ */ jsx("span", { className: classes.foldCountHint, "aria-hidden": true, children: names[0] })
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
) }),
|
|
267
|
+
/* @__PURE__ */ jsx(Popover.Dropdown, { p: "xs", className: classes.foldNames, "aria-label": summary, children: /* @__PURE__ */ jsx("ul", { className: classes.foldNameList, children: names.map((name, index) => /* @__PURE__ */ jsx("li", { children: name }, `${index}-${name}`)) }) })
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
) });
|
|
240
271
|
}
|
|
241
272
|
function FoldToggle({
|
|
242
273
|
expanded,
|
|
@@ -282,6 +313,7 @@ export {
|
|
|
282
313
|
columnLabel,
|
|
283
314
|
foldOrder,
|
|
284
315
|
foldToggleCellProps,
|
|
316
|
+
foldedSummary,
|
|
285
317
|
pinnedCellProps,
|
|
286
318
|
planColumnFold,
|
|
287
319
|
useColumnFold
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MantineSpacing } from '@mantine/core';
|
|
2
2
|
import type { ColumnFiltersState, PaginationState, RowData, RowSelectionState, SortingState } from '@tanstack/react-table';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
|
-
import type { BasaltProps, SlotStylesProps } from '../common/props.js';
|
|
4
|
+
import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
|
|
5
5
|
import type { BarAction, SlotActions } from '../controls/actions.js';
|
|
6
6
|
import type { QueryStateLike } from '../dashboard/query-state.js';
|
|
7
7
|
export { planColumnFold } from './data-table-fold.js';
|
|
@@ -85,7 +85,7 @@ export type BasaltDataTableSlot = 'root' | 'toolbar' | 'table' | 'footer';
|
|
|
85
85
|
* emptyState: <Text c="dimmed">No results found.</Text>,
|
|
86
86
|
* }
|
|
87
87
|
*/
|
|
88
|
-
export type BasaltDataTableProps<T extends RowData> = BasaltProps & SlotStylesProps<BasaltDataTableSlot> & {
|
|
88
|
+
export type BasaltDataTableProps<T extends RowData> = BasaltProps & DataAttributes & SlotStylesProps<BasaltDataTableSlot> & {
|
|
89
89
|
/**
|
|
90
90
|
* Optional heading rendered above the toolbar via `WidgetHeader tier="widget"`. The count tag
|
|
91
91
|
* beside it is automatic, not a prop (there is no `count`): it reads `table.getRowCount()` (C11)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/table/data-table.tsx"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAIV,kBAAkB,EAGlB,eAAe,EACf,OAAO,EACP,iBAAiB,EACjB,YAAY,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAgD,SAAS,EAAa,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../src/table/data-table.tsx"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAIV,kBA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AAM,CAAA;IAC3B;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpC,2DAA2D;IAC3D,eAAe,CAAC,EAAE,cAAc,CAAA;IAChC,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,cAAc,CAAA;IAClC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;;;;;;;;;;;OAeG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AA8QH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,+BA46BhF"}
|
package/dist/table/data-table.js
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
import { constructFilterFn, FlexRender, useTable } from "@tanstack/react-table";
|
|
17
17
|
import { Fragment, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
18
18
|
import { useDebouncedCallback } from "@mantine/hooks";
|
|
19
|
-
import {
|
|
19
|
+
import { HostTitleContext } from "../common/could-not-load.js";
|
|
20
|
+
import { cx, pickDataAttributes } from "../common/props.js";
|
|
20
21
|
import { BASALT_PREFIX } from "../common/errors.js";
|
|
21
22
|
import { HIT_COARSE } from "../common/hit-floor.js";
|
|
22
23
|
import { useMeasuredWidths } from "../common/use-measured-widths.js";
|
|
@@ -256,15 +257,17 @@ function BulkActionBar({ count, actions }) {
|
|
|
256
257
|
}
|
|
257
258
|
const SKELETON_MIN_REM = {
|
|
258
259
|
entity: 7,
|
|
259
|
-
text:
|
|
260
|
+
text: 4.5,
|
|
261
|
+
// A kindless column is the one-line cause or note of an outage or event log.
|
|
262
|
+
kindless: 8,
|
|
260
263
|
"relative-time": 5,
|
|
261
264
|
status: 4,
|
|
262
265
|
money: 4.5,
|
|
263
266
|
number: 3.5
|
|
264
267
|
};
|
|
265
268
|
function skeletonMinWidth(column) {
|
|
266
|
-
|
|
267
|
-
const rem =
|
|
269
|
+
if (column.id === SELECT_COLUMN_ID || column.id === ACTIONS_COLUMN_ID) return void 0;
|
|
270
|
+
const rem = SKELETON_MIN_REM[resolveKind(column) ?? "kindless"];
|
|
268
271
|
return rem === void 0 ? void 0 : `${rem}rem`;
|
|
269
272
|
}
|
|
270
273
|
function SortIndicator({ direction }) {
|
|
@@ -592,7 +595,8 @@ function BasaltDataTable(props) {
|
|
|
592
595
|
fullLeafColumns.map((column, index) => [column.id, index + 1 + colIndexOffset])
|
|
593
596
|
);
|
|
594
597
|
const ariaColCount = fullLeafColumns.length + colIndexOffset;
|
|
595
|
-
const
|
|
598
|
+
const foldedNames = fullLeafColumns.filter((column) => foldedColumns.has(column.id)).map((column) => columnLabel(column));
|
|
599
|
+
const foldedLabel = foldedNames.join(", ");
|
|
596
600
|
const selectedModelRows = enableRowSelection ? table.getSelectedRowModel().rows : void 0;
|
|
597
601
|
const selectedRows = useMemo(
|
|
598
602
|
() => selectedModelRows?.map((row) => row.original) ?? [],
|
|
@@ -623,13 +627,13 @@ function BasaltDataTable(props) {
|
|
|
623
627
|
ErrorState,
|
|
624
628
|
{
|
|
625
629
|
error: queryError.error,
|
|
626
|
-
title:
|
|
630
|
+
...title !== void 0 && { title: `Could not load ${title}` },
|
|
627
631
|
tier: "section",
|
|
628
632
|
retrying: queryError.fetchStatus === "fetching",
|
|
629
633
|
onRetry: () => void queryError.refetch()
|
|
630
634
|
}
|
|
631
635
|
);
|
|
632
|
-
const emptyNode = emptyState ?? /* @__PURE__ */ jsx(EmptyState, { tier: "section", title: "No data to display." });
|
|
636
|
+
const emptyNode = /* @__PURE__ */ jsx(HostTitleContext, { value: title, children: emptyState ?? /* @__PURE__ */ jsx(EmptyState, { tier: "section", title: "No data to display." }) });
|
|
633
637
|
const orderedVisibleColumns = pinningActive ? [
|
|
634
638
|
...table.getStartVisibleLeafColumns(),
|
|
635
639
|
...table.getCenterVisibleLeafColumns(),
|
|
@@ -644,7 +648,9 @@ function BasaltDataTable(props) {
|
|
|
644
648
|
const toggleCell = foldToggleCellProps(pinCtx);
|
|
645
649
|
const { fitIds, spacer } = planColumnSizing(
|
|
646
650
|
orderedVisibleColumns,
|
|
647
|
-
/* @__PURE__ */ new Set([SELECT_COLUMN_ID, ACTIONS_COLUMN_ID])
|
|
651
|
+
/* @__PURE__ */ new Set([SELECT_COLUMN_ID, ACTIONS_COLUMN_ID]),
|
|
652
|
+
// Every row, not the page: paging, sorting or filtering must not move a column's width.
|
|
653
|
+
table.getCoreRowModel().rows
|
|
648
654
|
);
|
|
649
655
|
const fitAttr = (id) => fitIds.has(id) ? { "data-fit": true } : void 0;
|
|
650
656
|
const spanCount = columnCount + (spacer ? 1 : 0);
|
|
@@ -670,7 +676,7 @@ function BasaltDataTable(props) {
|
|
|
670
676
|
withTableBorder,
|
|
671
677
|
children: [
|
|
672
678
|
/* @__PURE__ */ jsx(Table.Thead, { children: headerGroups.map((headerGroup) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
673
|
-
hasFolded && /* @__PURE__ */ jsx(Table.Th, { ...toggleCell, "aria-colindex": 1, children: /* @__PURE__ */ jsx(FoldHeaderLabel, {
|
|
679
|
+
hasFolded && /* @__PURE__ */ jsx(Table.Th, { ...toggleCell, "aria-colindex": 1, children: /* @__PURE__ */ jsx(FoldHeaderLabel, { names: foldedNames }) }),
|
|
674
680
|
headerGroup.headers.map((header) => {
|
|
675
681
|
const canSort = sortingEnabled && header.column.getCanSort();
|
|
676
682
|
const sorted = header.column.getIsSorted();
|
|
@@ -837,6 +843,7 @@ function BasaltDataTable(props) {
|
|
|
837
843
|
return /* @__PURE__ */ jsxs(
|
|
838
844
|
"div",
|
|
839
845
|
{
|
|
846
|
+
...pickDataAttributes(props),
|
|
840
847
|
ref: projectionRootRef,
|
|
841
848
|
className: cx(classNames?.root, className),
|
|
842
849
|
...style !== void 0 && { style },
|
|
@@ -130,6 +130,7 @@
|
|
|
130
130
|
* wrapper sized by its own min-content would never read a shrunken `clientWidth` back.
|
|
131
131
|
*/
|
|
132
132
|
.foldWrapper {
|
|
133
|
+
position: relative;
|
|
133
134
|
min-width: 0;
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -175,14 +176,59 @@
|
|
|
175
176
|
outline-offset: 1px;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
|
-
/* The header above the toggles: a micro count of the folded columns. */
|
|
179
|
+
/* The header above the toggles: a micro count of the folded columns, the word included ("+4 cols"). */
|
|
179
180
|
.foldCount {
|
|
180
|
-
|
|
181
|
+
/* The header cell is mono caps with tracking; "+4 COLS" in it is 51px, wider than the 44px cell. */
|
|
182
|
+
font-family: var(--mantine-font-family);
|
|
183
|
+
letter-spacing: normal;
|
|
184
|
+
text-transform: none;
|
|
181
185
|
font-size: var(--vx-text-micro);
|
|
182
186
|
color: var(--vx-muted);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* The first folded name under the count: one ellipsised line the width of the 44px toggle cell. */
|
|
190
|
+
.foldCountHint {
|
|
191
|
+
display: block;
|
|
192
|
+
inline-size: calc(2.75rem * var(--mantine-scale, 1));
|
|
193
|
+
overflow: hidden;
|
|
194
|
+
text-overflow: ellipsis;
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
opacity: 0.8;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* The count is a button: bare, inheriting the micro face, `help` for the mouse's title hint. */
|
|
200
|
+
.foldCountButton {
|
|
201
|
+
padding: 0;
|
|
202
|
+
border: none;
|
|
203
|
+
background: none;
|
|
204
|
+
font: inherit;
|
|
205
|
+
color: inherit;
|
|
183
206
|
cursor: help;
|
|
184
207
|
}
|
|
185
208
|
|
|
209
|
+
.foldCountButton:hover,
|
|
210
|
+
.foldCountButton:focus-visible {
|
|
211
|
+
color: var(--vx-ink);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.foldCountButton:focus-visible {
|
|
215
|
+
outline: 2px solid var(--vx-accent);
|
|
216
|
+
outline-offset: 2px;
|
|
217
|
+
border-radius: var(--vx-radius-ctrl);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* The popover naming the folded columns: a quiet list in the table's own sans. */
|
|
221
|
+
.foldNames {
|
|
222
|
+
font-size: var(--vx-text-sm);
|
|
223
|
+
color: var(--vx-ink);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.foldNameList {
|
|
227
|
+
margin: 0;
|
|
228
|
+
padding: 0;
|
|
229
|
+
list-style: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
186
232
|
.foldChevron {
|
|
187
233
|
width: 0.875rem;
|
|
188
234
|
height: 0.875rem;
|
|
@@ -301,6 +347,26 @@
|
|
|
301
347
|
outline-offset: -2px;
|
|
302
348
|
}
|
|
303
349
|
|
|
350
|
+
/*
|
|
351
|
+
* Inside the fold wrapper the ring is an overlay instead: an outline paints UNDER the sticky cells
|
|
352
|
+
* (pinned column, toggle, header), so at 390 it was open along the top and start edge. The overlay
|
|
353
|
+
* sits over them, on the wrapper — the scroller's own box, which never scrolls — closed on all four.
|
|
354
|
+
*/
|
|
355
|
+
@supports selector(:has(*)) {
|
|
356
|
+
.foldWrapper .scroller:focus-visible {
|
|
357
|
+
outline: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.foldWrapper:has(.scroller:focus-visible)::after {
|
|
361
|
+
content: '';
|
|
362
|
+
position: absolute;
|
|
363
|
+
inset: 0;
|
|
364
|
+
z-index: 5;
|
|
365
|
+
border: 2px solid var(--vx-accent);
|
|
366
|
+
pointer-events: none;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
304
370
|
/*
|
|
305
371
|
* A pinned cell is opaque in EVERY row state (TanStack issue 5392 — the cell under it bled through).
|
|
306
372
|
* Its inline `background-color` is the panel; the row's own state tint is layered over it as an image,
|
|
@@ -380,6 +446,12 @@ td.pinnedFluid {
|
|
|
380
446
|
width: 1px;
|
|
381
447
|
}
|
|
382
448
|
|
|
449
|
+
/* A fitted `text` column (all cells short) is as wide as its longest cell, so it holds one line: at
|
|
450
|
+
`width: 1px` the wrapping law would break "Payment failed" onto two. */
|
|
451
|
+
.table td[data-fit][data-kind='text']:not(.pinnedLayer) {
|
|
452
|
+
white-space: nowrap;
|
|
453
|
+
}
|
|
454
|
+
|
|
383
455
|
.spacer {
|
|
384
456
|
padding: 0;
|
|
385
457
|
}
|
|
@@ -10,12 +10,16 @@ declare const classes: {
|
|
|
10
10
|
readonly dangerAction: string
|
|
11
11
|
readonly foldChevron: string
|
|
12
12
|
readonly foldCount: string
|
|
13
|
+
readonly foldCountButton: string
|
|
14
|
+
readonly foldCountHint: string
|
|
13
15
|
readonly foldDisclosure: string
|
|
14
16
|
readonly foldDisclosureCell: string
|
|
15
17
|
readonly foldDisclosureLabel: string
|
|
16
18
|
readonly foldDisclosureRow: string
|
|
17
19
|
readonly foldDisclosureRowTr: string
|
|
18
20
|
readonly foldDisclosureValue: string
|
|
21
|
+
readonly foldNameList: string
|
|
22
|
+
readonly foldNames: string
|
|
19
23
|
readonly foldToggle: string
|
|
20
24
|
readonly foldToggleCell: string
|
|
21
25
|
readonly foldWrapper: string
|
|
@@ -56,11 +56,32 @@ html[data-mantine-color-scheme] .inputWrapper[data-variant='default']:not([data-
|
|
|
56
56
|
* which keep their Mantine semantics and take the focus ring alone.
|
|
57
57
|
*/
|
|
58
58
|
.input {
|
|
59
|
-
--field-
|
|
59
|
+
--field-resting: 0 0 transparent;
|
|
60
|
+
--field-depth: var(--field-resting);
|
|
60
61
|
|
|
61
62
|
box-shadow: var(--field-depth);
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/* Browser autofill: the field surface over the UA colour, keeping the variant's resting depth. */
|
|
66
|
+
.input:-webkit-autofill,
|
|
67
|
+
.input:-webkit-autofill:hover,
|
|
68
|
+
.input:-webkit-autofill:focus {
|
|
69
|
+
--field-depth: var(--field-resting), 0 0 0 100vmax var(--vx-surface-field) inset;
|
|
70
|
+
/* The UA repaints its highlight on :focus (a Select's input stays focused while its list is open)
|
|
71
|
+
* and recolours the text; parking the background transition keeps the paint off the field. */
|
|
72
|
+
-webkit-text-fill-color: var(--vx-ink);
|
|
73
|
+
caret-color: var(--vx-ink);
|
|
74
|
+
transition: background-color 600000s 0s;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Tab into a field selects its value, and the UA paints that selection in its own colour (a green
|
|
78
|
+
in the dark scheme). The shot crop of a focused field showed exactly that, not an autofill fill:
|
|
79
|
+
`:-webkit-autofill` never matches there. The selection takes the accent, tinted, with the ink kept. */
|
|
80
|
+
.input::selection {
|
|
81
|
+
background: color-mix(in srgb, var(--mantine-primary-color-filled) 35%, transparent);
|
|
82
|
+
color: var(--vx-ink);
|
|
83
|
+
}
|
|
84
|
+
|
|
64
85
|
/* An input cannot host the `[data-basalt-hit]` ::after overlay, so its touch floor is real height. */
|
|
65
86
|
@media (pointer: coarse) {
|
|
66
87
|
.input {
|
|
@@ -69,7 +90,7 @@ html[data-mantine-color-scheme] .inputWrapper[data-variant='default']:not([data-
|
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
.input[data-variant='default'] {
|
|
72
|
-
--field-
|
|
93
|
+
--field-resting: var(--vx-shadow-raised);
|
|
73
94
|
}
|
|
74
95
|
|
|
75
96
|
/*
|