basalt-ui 2.27.2 → 2.28.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 +99 -0
- package/MIGRATING.md +168 -12
- package/agent/rules/basalt-batteries.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/rules/basalt-tokens.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/skills/basalt-design/references/catalogue.md +40 -36
- package/agent/skills/basalt-design/references/recipes.md +47 -0
- package/configs/oxlint-basalt.json +2 -1
- package/configs/oxlint-plugin.js +110 -2
- package/configs/oxlint-plugin.test.ts +99 -4
- package/dist/agent/chat/thread-message.d.ts +1 -160
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +7 -162
- package/dist/agent/chat/virtualize.d.ts +5 -5
- package/dist/charts/ChartCard.d.ts +5 -2
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +46 -13
- package/dist/charts/Lines.d.ts.map +1 -1
- package/dist/charts/Lines.js +11 -4
- package/dist/charts/Sparkline.d.ts +9 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +104 -41
- package/dist/charts/chart-box.module.css +50 -0
- package/dist/charts/chart-box.module.css.d.ts +5 -0
- package/dist/charts/chart-card.module.css +12 -4
- package/dist/charts/chart-card.module.css.d.ts +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +20 -18
- package/dist/charts/labels.d.ts +13 -3
- package/dist/charts/labels.d.ts.map +1 -1
- package/dist/charts/labels.js +131 -20
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +1 -1
- package/dist/charts/ref-label.d.ts +31 -8
- package/dist/charts/ref-label.d.ts.map +1 -1
- package/dist/charts/ref-label.js +40 -9
- package/dist/charts/sparkline.module.css +6 -0
- package/dist/charts/state.d.ts +3 -3
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +20 -2
- package/dist/cli/shot/capture.d.ts +6 -1
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +18 -5
- package/dist/common/empty-copy.d.ts +16 -0
- package/dist/common/empty-copy.d.ts.map +1 -0
- package/dist/common/empty-copy.js +9 -0
- package/dist/common/virtual-rows.d.ts +196 -0
- package/dist/common/virtual-rows.d.ts.map +1 -0
- package/dist/common/virtual-rows.js +290 -0
- package/dist/controls/controls.module.css +33 -1
- package/dist/controls/controls.module.css.d.ts +2 -0
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -2
- package/dist/controls/filter-pill.d.ts +27 -3
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +15 -4
- package/dist/controls/form-layout.d.ts +9 -3
- package/dist/controls/form-layout.d.ts.map +1 -1
- package/dist/controls/form-layout.js +74 -12
- package/dist/controls/form-layout.module.css +112 -7
- package/dist/controls/form-layout.module.css.d.ts +1 -0
- package/dist/controls/multi-select-filter.d.ts +2 -2
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +12 -6
- package/dist/controls/range-filter.d.ts +1 -1
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +8 -2
- package/dist/dashboard/bar-list.d.ts +1 -1
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +6 -2
- package/dist/dashboard/bar-list.module.css +0 -2
- package/dist/dashboard/board-nav.d.ts +22 -0
- package/dist/dashboard/board-nav.d.ts.map +1 -0
- package/dist/dashboard/board-nav.js +49 -0
- package/dist/dashboard/board.d.ts +52 -0
- package/dist/dashboard/board.d.ts.map +1 -0
- package/dist/dashboard/board.js +228 -0
- package/dist/dashboard/board.module.css +160 -0
- package/dist/dashboard/board.module.css.d.ts +26 -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 +13 -6
- package/dist/dashboard/event-list-model.d.ts +51 -0
- package/dist/dashboard/event-list-model.d.ts.map +1 -0
- package/dist/dashboard/event-list-model.js +72 -0
- package/dist/dashboard/event-list-rows.d.ts +23 -0
- package/dist/dashboard/event-list-rows.d.ts.map +1 -0
- package/dist/dashboard/event-list-rows.js +93 -0
- package/dist/dashboard/event-list-scroll.d.ts +27 -0
- package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
- package/dist/dashboard/event-list-scroll.js +103 -0
- package/dist/dashboard/event-list-skeleton.d.ts +10 -0
- package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
- package/dist/dashboard/event-list-skeleton.js +36 -0
- package/dist/dashboard/event-list.d.ts +65 -0
- package/dist/dashboard/event-list.d.ts.map +1 -0
- package/dist/dashboard/event-list.js +178 -0
- package/dist/dashboard/event-list.module.css +283 -0
- package/dist/dashboard/event-list.module.css.d.ts +33 -0
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -0
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +5 -3
- package/dist/dashboard/meter.module.css +2 -1
- package/dist/dashboard/query-state.js +1 -1
- package/dist/dashboard/settings-section.d.ts +4 -1
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +1 -1
- package/dist/dashboard/settings-section.module.css +19 -4
- package/dist/dashboard/stat-card-parts.d.ts +5 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +8 -3
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +25 -6
- package/dist/dashboard/stat-card.module.css +31 -7
- package/dist/dashboard/stat-card.module.css.d.ts +3 -0
- package/dist/dashboard/stat-strip.module.css +4 -1
- package/dist/dashboard/widget-header.module.css +17 -1
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/shell/app-main.module.css +18 -0
- package/dist/styles.css +46 -0
- package/dist/surfaces.d.ts +2 -2
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +8 -2
- package/dist/table/cell-kinds.d.ts +44 -0
- package/dist/table/cell-kinds.d.ts.map +1 -0
- package/dist/table/cell-kinds.js +169 -0
- package/dist/table/cell-kinds.module.css +55 -0
- package/dist/table/cell-kinds.module.css.d.ts +15 -0
- package/dist/table/data-table-fold.d.ts +147 -0
- package/dist/table/data-table-fold.d.ts.map +1 -0
- package/dist/table/data-table-fold.js +288 -0
- package/dist/table/data-table-state.d.ts +10 -3
- package/dist/table/data-table-state.d.ts.map +1 -1
- package/dist/table/data-table-state.js +11 -6
- package/dist/table/data-table.d.ts +11 -26
- package/dist/table/data-table.d.ts.map +1 -1
- package/dist/table/data-table.js +354 -254
- package/dist/table/data-table.module.css +210 -3
- package/dist/table/data-table.module.css.d.ts +12 -0
- package/dist/table/table-features.d.ts +34 -4
- package/dist/table/table-features.d.ts.map +1 -1
- package/dist/table/table-features.js +10 -0
- package/dist/theme/card-inset.module.css +35 -0
- package/dist/theme/controls.module.css +32 -0
- package/dist/theme/ctl-theme.d.ts.map +1 -1
- package/dist/theme/ctl-theme.js +5 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +14 -10
- package/dist/tokens/core.d.ts +1 -0
- package/dist/tokens/core.d.ts.map +1 -1
- package/dist/tokens/core.js +1 -0
- package/dist/tokens/derive.js +1 -1
- package/dist/tokens/palette.d.ts +2 -1
- package/dist/tokens/palette.d.ts.map +1 -1
- package/llms.txt +34 -5
- package/package.json +1 -1
- package/src/agent/chat/thread-message.tsx +10 -403
- package/src/agent/chat/virtualize.ts +5 -5
- package/src/charts/ChartCard.tsx +79 -17
- package/src/charts/Lines.tsx +13 -4
- package/src/charts/Sparkline.tsx +131 -45
- package/src/charts/chart-box.module.css +50 -0
- package/src/charts/chart-box.module.css.d.ts +5 -0
- package/src/charts/chart-card.module.css +12 -4
- package/src/charts/chart-card.module.css.d.ts +1 -0
- package/src/charts/compile.ts +22 -18
- package/src/charts/labels.ts +175 -24
- package/src/charts/legend.tsx +3 -2
- package/src/charts/ref-label.ts +86 -17
- package/src/charts/sparkline.module.css +6 -0
- package/src/charts/state.tsx +36 -7
- package/src/cli/shot/capture.ts +29 -6
- package/src/common/empty-copy.ts +17 -0
- package/src/common/virtual-rows.tsx +682 -0
- package/src/controls/controls.module.css +33 -1
- package/src/controls/controls.module.css.d.ts +2 -0
- package/src/controls/enum-filter.tsx +8 -2
- package/src/controls/filter-pill.tsx +80 -27
- package/src/controls/form-layout.module.css +112 -7
- package/src/controls/form-layout.module.css.d.ts +1 -0
- package/src/controls/form-layout.tsx +115 -22
- package/src/controls/multi-select-filter.tsx +22 -11
- package/src/controls/range-filter.tsx +9 -3
- package/src/dashboard/bar-list.module.css +0 -2
- package/src/dashboard/bar-list.tsx +8 -5
- package/src/dashboard/board-nav.ts +67 -0
- package/src/dashboard/board.module.css +160 -0
- package/src/dashboard/board.module.css.d.ts +26 -0
- package/src/dashboard/board.tsx +394 -0
- package/src/dashboard/empty-state.tsx +16 -9
- package/src/dashboard/event-list-model.ts +113 -0
- package/src/dashboard/event-list-rows.tsx +120 -0
- package/src/dashboard/event-list-scroll.ts +145 -0
- package/src/dashboard/event-list-skeleton.tsx +58 -0
- package/src/dashboard/event-list.module.css +283 -0
- package/src/dashboard/event-list.module.css.d.ts +33 -0
- package/src/dashboard/event-list.tsx +309 -0
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-parts.tsx +9 -2
- package/src/dashboard/meter.module.css +2 -1
- package/src/dashboard/query-state.tsx +1 -1
- package/src/dashboard/settings-section.module.css +19 -4
- package/src/dashboard/settings-section.tsx +7 -2
- package/src/dashboard/stat-card-parts.tsx +20 -3
- package/src/dashboard/stat-card.module.css +31 -7
- package/src/dashboard/stat-card.module.css.d.ts +3 -0
- package/src/dashboard/stat-card.tsx +24 -5
- package/src/dashboard/stat-strip.module.css +4 -1
- package/src/dashboard/widget-header.module.css +17 -1
- package/src/guard/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/shell/app-main.module.css +18 -0
- package/src/styles.css +46 -0
- package/src/surfaces.ts +7 -1
- package/src/table/cell-kinds.module.css +55 -0
- package/src/table/cell-kinds.module.css.d.ts +15 -0
- package/src/table/cell-kinds.tsx +234 -0
- package/src/table/data-table-fold.tsx +514 -0
- package/src/table/data-table-state.ts +24 -13
- package/src/table/data-table.module.css +210 -3
- package/src/table/data-table.module.css.d.ts +12 -0
- package/src/table/data-table.tsx +406 -359
- package/src/table/table-features.ts +44 -4
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
- package/src/theme/card-inset.module.css +35 -0
- package/src/theme/controls.module.css +32 -0
- package/src/theme/ctl-theme.tsx +8 -0
- package/src/theme/index.ts +12 -8
- package/src/tokens/core.ts +1 -0
- package/src/tokens/derive.ts +1 -1
- package/src/tokens/palette.ts +4 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const BOARD_KEYS = [
|
|
2
|
+
"ArrowUp",
|
|
3
|
+
"ArrowDown",
|
|
4
|
+
"ArrowLeft",
|
|
5
|
+
"ArrowRight",
|
|
6
|
+
"Home",
|
|
7
|
+
"End"
|
|
8
|
+
];
|
|
9
|
+
function isBoardKey(key) {
|
|
10
|
+
return BOARD_KEYS.includes(key);
|
|
11
|
+
}
|
|
12
|
+
function moveOnBoard(sizes, from, key) {
|
|
13
|
+
const size = sizes[from.col] ?? 0;
|
|
14
|
+
let next;
|
|
15
|
+
switch (key) {
|
|
16
|
+
case "ArrowUp":
|
|
17
|
+
next = { col: from.col, row: from.row - 1 };
|
|
18
|
+
break;
|
|
19
|
+
case "ArrowDown":
|
|
20
|
+
next = { col: from.col, row: from.row + 1 };
|
|
21
|
+
break;
|
|
22
|
+
case "Home":
|
|
23
|
+
next = { col: from.col, row: 0 };
|
|
24
|
+
break;
|
|
25
|
+
case "End":
|
|
26
|
+
next = { col: from.col, row: size - 1 };
|
|
27
|
+
break;
|
|
28
|
+
case "ArrowLeft":
|
|
29
|
+
case "ArrowRight": {
|
|
30
|
+
const step = key === "ArrowLeft" ? -1 : 1;
|
|
31
|
+
let col = from.col + step;
|
|
32
|
+
while (col >= 0 && col < sizes.length && (sizes[col] ?? 0) === 0) col += step;
|
|
33
|
+
if (col < 0 || col >= sizes.length) return null;
|
|
34
|
+
next = { col, row: Math.min(from.row, (sizes[col] ?? 1) - 1) };
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (next.row < 0 || next.row >= (sizes[next.col] ?? 0)) return null;
|
|
39
|
+
return next.col === from.col && next.row === from.row ? null : next;
|
|
40
|
+
}
|
|
41
|
+
function isSafeHref(href) {
|
|
42
|
+
return /^https?:\/\//i.test(href) || /^(?:\/(?![/\\])|\.{1,2}\/|#|\?)/.test(href);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
BOARD_KEYS,
|
|
46
|
+
isBoardKey,
|
|
47
|
+
isSafeHref,
|
|
48
|
+
moveOnBoard
|
|
49
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BasaltProps } from '../common/props.js';
|
|
3
|
+
import type { EnumField, FieldHandle } from '../state.js';
|
|
4
|
+
export type BoardProps<T extends string = string> = BasaltProps & {
|
|
5
|
+
/** Accessible name of the board. Default "Board". */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Columns in display order. Column and card `id`s must be unique within their parent. */
|
|
8
|
+
columns: readonly {
|
|
9
|
+
id: T;
|
|
10
|
+
title: string;
|
|
11
|
+
/** Colour of the header's status dot (a `VX.status.*` token). Default muted. */
|
|
12
|
+
tone?: string;
|
|
13
|
+
/** Right-aligned header text, already formatted ("3 items", "$12.40"). */
|
|
14
|
+
total?: string;
|
|
15
|
+
/** The title of the `EmptyState` tile an empty column shows. Default "Nothing here"; say why it is empty. */
|
|
16
|
+
empty?: string;
|
|
17
|
+
cards: readonly {
|
|
18
|
+
id: string;
|
|
19
|
+
actor?: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
title: string;
|
|
22
|
+
/** A linked record; `href` is a link only when http(s) or relative. */
|
|
23
|
+
record?: {
|
|
24
|
+
label: string;
|
|
25
|
+
href?: string;
|
|
26
|
+
};
|
|
27
|
+
/** One muted status line ("Deferred · waiting on CI"). */
|
|
28
|
+
status?: string;
|
|
29
|
+
/** An optional meter or preview; the one ReactNode slot. */
|
|
30
|
+
meter?: ReactNode;
|
|
31
|
+
}[];
|
|
32
|
+
}[];
|
|
33
|
+
/** Called with the card and column ids on Enter, Space or a click. */
|
|
34
|
+
onOpen?: (cardId: string, columnId: string) => void;
|
|
35
|
+
/** Each column scrolls alone inside a box of this height. Omitted: content-sized. */
|
|
36
|
+
height?: number | string;
|
|
37
|
+
/** Renders column-shaped skeletons. */
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
/** The tile shown when no column has a card. Default "Nothing on the board". */
|
|
40
|
+
empty?: {
|
|
41
|
+
title: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
action?: ReactNode;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Compact: the store field holding the selected column id (an enum field of the column ids, the
|
|
47
|
+
* type `ViewTabs` takes). Omitted: internal state, first column.
|
|
48
|
+
*/
|
|
49
|
+
field?: FieldHandle<EnumField<T>>;
|
|
50
|
+
};
|
|
51
|
+
export declare function Board<T extends string = string>({ field, ...props }: BoardProps<T>): import("react").JSX.Element;
|
|
52
|
+
//# sourceMappingURL=board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../../src/dashboard/board.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAQtD,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,WAAW,GAAG;IAChE,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0FAA0F;IAC1F,OAAO,EAAE,SAAS;QAChB,EAAE,EAAE,CAAC,CAAA;QACL,KAAK,EAAE,MAAM,CAAA;QACb,gFAAgF;QAChF,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,0EAA0E;QAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,6GAA6G;QAC7G,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,SAAS;YACd,EAAE,EAAE,MAAM,CAAA;YACV,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,IAAI,CAAC,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;YACb,uEAAuE;YACvE,MAAM,CAAC,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;YACzC,0DAA0D;YAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,4DAA4D;YAC5D,KAAK,CAAC,EAAE,SAAS,CAAA;SAClB,EAAE,CAAA;KACJ,EAAE,CAAA;IACH,sEAAsE;IACtE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gFAAgF;IAChF,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,SAAS,CAAA;KAAE,CAAA;IACnE;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;CAClC,CAAA;AA+ED,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,+BAMlF"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ScrollArea, SegmentedControl, Skeleton, Card, VisuallyHidden } from "@mantine/core";
|
|
3
|
+
import { Fragment, useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { cx } from "../common/props.js";
|
|
5
|
+
import { useSizeClass } from "../shell/use-size-class.js";
|
|
6
|
+
import { StatusDot } from "../theme/status-dot.js";
|
|
7
|
+
import { VX } from "../tokens/index.js";
|
|
8
|
+
import classes from "./board.module.css";
|
|
9
|
+
import { isBoardKey, isSafeHref, moveOnBoard } from "./board-nav.js";
|
|
10
|
+
import { EmptyState } from "./empty-state.js";
|
|
11
|
+
const DEFAULT_EMPTY = { title: "Nothing on the board" };
|
|
12
|
+
const SKELETON_COLUMNS = 3;
|
|
13
|
+
const SKELETON_CARDS = 3;
|
|
14
|
+
const cardKey = (col, card) => `${col}\0${card}`;
|
|
15
|
+
function ColumnSwitcher({
|
|
16
|
+
label,
|
|
17
|
+
items,
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
disabled = false
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
// theme-allow raw-selection-control — the board's own column switcher, its selection is the board's own (a `field` when given, else internal), not a page filter.
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
SegmentedControl,
|
|
26
|
+
{
|
|
27
|
+
"aria-label": `${label} column`,
|
|
28
|
+
disabled,
|
|
29
|
+
fullWidth: true,
|
|
30
|
+
size: "ctl",
|
|
31
|
+
value,
|
|
32
|
+
...onChange !== void 0 && { onChange },
|
|
33
|
+
data: items.map((i) => ({ value: i.id, label: i.text }))
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function SkeletonColumn({ title }) {
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.column, "aria-hidden": true, children: [
|
|
40
|
+
/* @__PURE__ */ jsx("div", { className: classes.head, children: title === void 0 ? /* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonTitle }) : /* @__PURE__ */ jsx("span", { className: classes.title, children: title }) }),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: classes.list, children: Array.from({ length: SKELETON_CARDS }, (_, i) => /* @__PURE__ */ jsxs(Card, { className: classes.card, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonCaption }),
|
|
43
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonLine }),
|
|
44
|
+
/* @__PURE__ */ jsx(Skeleton, { className: classes.skeletonStatus })
|
|
45
|
+
] }, i)) })
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
function FieldBoard({
|
|
49
|
+
field,
|
|
50
|
+
...props
|
|
51
|
+
}) {
|
|
52
|
+
const [picked, setPicked] = field.use();
|
|
53
|
+
return /* @__PURE__ */ jsx(BoardView, { ...props, picked, onPick: setPicked });
|
|
54
|
+
}
|
|
55
|
+
function InternalBoard(props) {
|
|
56
|
+
const [picked, setPicked] = useState(void 0);
|
|
57
|
+
return /* @__PURE__ */ jsx(BoardView, { ...props, picked, onPick: setPicked });
|
|
58
|
+
}
|
|
59
|
+
function Board({ field, ...props }) {
|
|
60
|
+
return field === void 0 ? /* @__PURE__ */ jsx(InternalBoard, { ...props }) : /* @__PURE__ */ jsx(FieldBoard, { field, ...props });
|
|
61
|
+
}
|
|
62
|
+
function BoardView({
|
|
63
|
+
label = "Board",
|
|
64
|
+
columns,
|
|
65
|
+
onOpen,
|
|
66
|
+
height,
|
|
67
|
+
loading = false,
|
|
68
|
+
empty = DEFAULT_EMPTY,
|
|
69
|
+
picked,
|
|
70
|
+
onPick,
|
|
71
|
+
className,
|
|
72
|
+
style
|
|
73
|
+
}) {
|
|
74
|
+
const compact = useSizeClass() === "compact";
|
|
75
|
+
const labelId = useId();
|
|
76
|
+
const [active, setActive] = useState(null);
|
|
77
|
+
const [announcement, setAnnouncement] = useState("");
|
|
78
|
+
const buttons = useRef(/* @__PURE__ */ new Map());
|
|
79
|
+
const pending = useRef(null);
|
|
80
|
+
const sizes = columns.map((c) => c.cards.length);
|
|
81
|
+
const total = sizes.reduce((a, b) => a + b, 0);
|
|
82
|
+
const selected = columns.find((c) => c.id === picked) ?? columns[0];
|
|
83
|
+
const selectColumn = onPick;
|
|
84
|
+
const selectedIndex = selected === void 0 ? -1 : columns.indexOf(selected);
|
|
85
|
+
const rendered = (colIndex) => !compact || colIndex === selectedIndex;
|
|
86
|
+
const firstCol = columns.findIndex((c, i) => rendered(i) && c.cards.length > 0);
|
|
87
|
+
const activeCol = columns.findIndex((c) => c.id === active?.col);
|
|
88
|
+
const activeRow = columns[activeCol]?.cards.findIndex((c) => c.id === active?.card) ?? -1;
|
|
89
|
+
const stop = activeCol >= 0 && activeRow >= 0 && rendered(activeCol) ? { col: activeCol, row: activeRow } : firstCol >= 0 ? { col: firstCol, row: 0 } : null;
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const key = pending.current;
|
|
92
|
+
if (key === null) return;
|
|
93
|
+
pending.current = null;
|
|
94
|
+
buttons.current.get(key)?.focus();
|
|
95
|
+
});
|
|
96
|
+
const onKeyDown = (event, from) => {
|
|
97
|
+
if (!isBoardKey(event.key)) return;
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
const to = moveOnBoard(sizes, from, event.key);
|
|
100
|
+
const col = to && columns[to.col];
|
|
101
|
+
const card = col && col.cards[to.row];
|
|
102
|
+
if (!to || !col || !card) return;
|
|
103
|
+
pending.current = cardKey(col.id, card.id);
|
|
104
|
+
setActive({ col: col.id, card: card.id });
|
|
105
|
+
setAnnouncement(`${col.title}, card ${to.row + 1} of ${col.cards.length}: ${card.title}`);
|
|
106
|
+
if (compact && col.id !== selected?.id) selectColumn(col.id);
|
|
107
|
+
};
|
|
108
|
+
const renderColumn = (col, colIndex) => {
|
|
109
|
+
const headId = `${labelId}-${col.id}`;
|
|
110
|
+
const list = col.cards.length === 0 ? /* @__PURE__ */ jsx(EmptyState, { tier: "section", title: col.empty ?? "Nothing here" }) : (
|
|
111
|
+
// The explicit role is deliberate: `list-style: none` makes Safari/VoiceOver drop the implicit one.
|
|
112
|
+
// oxlint-disable-next-line jsx-a11y/no-redundant-roles
|
|
113
|
+
/* @__PURE__ */ jsx("ul", { className: classes.list, role: "list", "aria-labelledby": headId, children: col.cards.map((card, row) => {
|
|
114
|
+
const here = stop?.col === colIndex && stop.row === row;
|
|
115
|
+
const caption = [card.actor, card.type].filter(Boolean).join(" \xB7 ");
|
|
116
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Card, { className: classes.card, children: [
|
|
117
|
+
caption !== "" && /* @__PURE__ */ jsx("p", { className: classes.caption, children: caption }),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
className: classes.open,
|
|
123
|
+
tabIndex: here ? 0 : -1,
|
|
124
|
+
ref: (el) => {
|
|
125
|
+
const key = cardKey(col.id, card.id);
|
|
126
|
+
if (el) buttons.current.set(key, el);
|
|
127
|
+
else buttons.current.delete(key);
|
|
128
|
+
},
|
|
129
|
+
onFocus: () => setActive({ col: col.id, card: card.id }),
|
|
130
|
+
onKeyDown: (e) => onKeyDown(e, { col: colIndex, row }),
|
|
131
|
+
onClick: () => onOpen?.(card.id, col.id),
|
|
132
|
+
children: card.title
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
card.record !== void 0 && (card.record.href !== void 0 && isSafeHref(card.record.href) ? /* @__PURE__ */ jsx(
|
|
136
|
+
"a",
|
|
137
|
+
{
|
|
138
|
+
className: classes.record,
|
|
139
|
+
href: card.record.href,
|
|
140
|
+
.../^https?:/i.test(card.record.href) && {
|
|
141
|
+
target: "_blank",
|
|
142
|
+
rel: "noreferrer"
|
|
143
|
+
},
|
|
144
|
+
children: card.record.label
|
|
145
|
+
}
|
|
146
|
+
) : /* @__PURE__ */ jsx("span", { className: classes.record, children: card.record.label })),
|
|
147
|
+
card.status !== void 0 && /* @__PURE__ */ jsx("p", { className: classes.status, children: card.status }),
|
|
148
|
+
card.meter !== void 0 && /* @__PURE__ */ jsx("div", { className: classes.meter, children: card.meter })
|
|
149
|
+
] }) }, card.id);
|
|
150
|
+
}) })
|
|
151
|
+
);
|
|
152
|
+
return (
|
|
153
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a named group of cards, not a fieldset
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: classes.column, role: "group", "aria-labelledby": headId, children: [
|
|
155
|
+
/* @__PURE__ */ jsxs("div", { className: classes.head, children: [
|
|
156
|
+
!compact && /* @__PURE__ */ jsx(StatusDot, { color: col.tone ?? VX.muted }),
|
|
157
|
+
/* @__PURE__ */ jsxs("h3", { id: headId, className: classes.title, children: [
|
|
158
|
+
compact ? /* @__PURE__ */ jsx(VisuallyHidden, { children: col.title }) : col.title,
|
|
159
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: `, ${col.cards.length} ${col.cards.length === 1 ? "card" : "cards"}` })
|
|
160
|
+
] }),
|
|
161
|
+
!compact && /* @__PURE__ */ jsx("span", { className: classes.count, "aria-hidden": true, children: col.cards.length }),
|
|
162
|
+
col.total !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.total, children: col.total })
|
|
163
|
+
] }),
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
165
|
+
ScrollArea.Autosize,
|
|
166
|
+
{
|
|
167
|
+
...height !== void 0 && { mah: height },
|
|
168
|
+
type: "auto",
|
|
169
|
+
offsetScrollbars: "y",
|
|
170
|
+
children: list
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
] }, col.id)
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
let content;
|
|
177
|
+
if (loading) {
|
|
178
|
+
content = /* @__PURE__ */ jsxs("div", { "aria-busy": "true", children: [
|
|
179
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: `Loading ${label}` }),
|
|
180
|
+
compact && columns.length > 0 && // The loaded switcher's footprint with the titles it will carry, inert until the cards land.
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
ColumnSwitcher,
|
|
183
|
+
{
|
|
184
|
+
label,
|
|
185
|
+
disabled: true,
|
|
186
|
+
value: selected?.id ?? "",
|
|
187
|
+
items: columns.map((c) => ({ id: c.id, text: c.title }))
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsx("div", { className: classes.columns, children: compact ? /* @__PURE__ */ jsx(SkeletonColumn, {}) : columns.length > 0 ? columns.map((c) => /* @__PURE__ */ jsx(SkeletonColumn, { title: c.title }, c.id)) : Array.from({ length: SKELETON_COLUMNS }, (_, i) => /* @__PURE__ */ jsx(SkeletonColumn, {}, i)) })
|
|
191
|
+
] });
|
|
192
|
+
} else if (total === 0) {
|
|
193
|
+
content = // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a polite live region whose name is the visually hidden label inside
|
|
194
|
+
/* @__PURE__ */ jsxs("div", { className: classes.empty, role: "status", children: [
|
|
195
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
EmptyState,
|
|
198
|
+
{
|
|
199
|
+
tier: "section",
|
|
200
|
+
title: empty.title,
|
|
201
|
+
...empty.description !== void 0 && { description: empty.description },
|
|
202
|
+
...empty.action !== void 0 && { action: empty.action }
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] });
|
|
206
|
+
} else {
|
|
207
|
+
content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
+
compact && /* @__PURE__ */ jsx(
|
|
209
|
+
ColumnSwitcher,
|
|
210
|
+
{
|
|
211
|
+
label,
|
|
212
|
+
value: selected?.id ?? "",
|
|
213
|
+
onChange: (id) => {
|
|
214
|
+
const col = columns.find((c) => c.id === id);
|
|
215
|
+
if (col) selectColumn(col.id);
|
|
216
|
+
},
|
|
217
|
+
items: columns.map((c) => ({ id: c.id, text: `${c.title} ${c.cards.length}` }))
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ jsx("div", { className: classes.columns, children: compact ? selected && renderColumn(selected, columns.indexOf(selected)) : columns.map(renderColumn) }),
|
|
221
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { component: "output", "aria-live": "polite", children: announcement })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
return /* @__PURE__ */ jsx("div", { className: cx(classes.root, className), style, "data-board": "", children: content });
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
Board
|
|
228
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Board (docs/waves/design-parity/SPEC.md § 6.8). Columns share the row; each scrolls alone inside a
|
|
3
|
+
* Mantine ScrollArea bounded by `height`. Cards are Mantine Cards: the theme owns inset, radius and
|
|
4
|
+
* surface, so nothing here sets them. The open button is stretched over its card (one click target,
|
|
5
|
+
* one tab stop); the record link and the meter slot sit above that overlay.
|
|
6
|
+
*/
|
|
7
|
+
.root {
|
|
8
|
+
inline-size: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: var(--vx-space-stack-sm);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.columns {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: flex-start;
|
|
18
|
+
gap: var(--vx-space-stack-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.column {
|
|
22
|
+
flex: 1 1 0;
|
|
23
|
+
min-width: 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: var(--vx-space-stack-sm);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.head {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: var(--vx-space-control-gap);
|
|
33
|
+
min-width: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.title {
|
|
37
|
+
margin: 0;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
font-size: var(--vx-text-sm);
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
color: var(--vx-ink);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.count {
|
|
48
|
+
font-family: var(--basalt-font-mono);
|
|
49
|
+
font-size: var(--vx-text-micro);
|
|
50
|
+
color: var(--vx-muted);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.total {
|
|
54
|
+
margin-inline-start: auto;
|
|
55
|
+
font-family: var(--basalt-font-mono);
|
|
56
|
+
font-size: var(--vx-text-micro);
|
|
57
|
+
color: var(--vx-muted);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.list {
|
|
62
|
+
margin: 0;
|
|
63
|
+
padding: 0;
|
|
64
|
+
list-style: none;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
/* 6 px at level 0, riding the density multiplier like every other step. */
|
|
68
|
+
gap: calc(var(--vx-space-stack-xs) * 1.5);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.card {
|
|
72
|
+
position: relative;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: var(--vx-space-stack-xs);
|
|
76
|
+
min-width: 0;
|
|
77
|
+
overflow-wrap: anywhere;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.caption {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-family: var(--basalt-font-mono);
|
|
83
|
+
font-size: var(--vx-text-micro);
|
|
84
|
+
color: var(--vx-muted);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.open {
|
|
88
|
+
all: unset;
|
|
89
|
+
display: block;
|
|
90
|
+
font-size: var(--vx-text-sm);
|
|
91
|
+
color: var(--vx-ink);
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* The whole card is the target. */
|
|
96
|
+
.open::after {
|
|
97
|
+
content: '';
|
|
98
|
+
position: absolute;
|
|
99
|
+
inset: 0;
|
|
100
|
+
border-radius: inherit;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.open:focus-visible::after {
|
|
104
|
+
outline: 2px solid var(--vx-focus-ring, var(--mantine-primary-color-filled));
|
|
105
|
+
outline-offset: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.record,
|
|
109
|
+
.meter {
|
|
110
|
+
position: relative;
|
|
111
|
+
z-index: 1;
|
|
112
|
+
font-size: var(--vx-text-xs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The record link is chrome, not an accent site (SPEC § 6.12): ink in both schemes, and a visited
|
|
116
|
+
record never changes colour. */
|
|
117
|
+
a.record,
|
|
118
|
+
a.record:visited {
|
|
119
|
+
color: var(--vx-ink);
|
|
120
|
+
text-decoration: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
a.record:hover {
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
a.record:focus-visible {
|
|
128
|
+
outline: 2px solid var(--vx-focus-ring, var(--mantine-primary-color-filled));
|
|
129
|
+
outline-offset: 1px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.status {
|
|
133
|
+
margin: 0;
|
|
134
|
+
font-size: var(--vx-text-xs);
|
|
135
|
+
color: var(--vx-muted);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.empty {
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.skeletonTitle {
|
|
143
|
+
inline-size: 40%;
|
|
144
|
+
block-size: 0.75rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.skeletonCaption {
|
|
148
|
+
inline-size: 35%;
|
|
149
|
+
block-size: 0.5rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.skeletonLine {
|
|
153
|
+
inline-size: 85%;
|
|
154
|
+
block-size: 0.75rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.skeletonStatus {
|
|
158
|
+
inline-size: 50%;
|
|
159
|
+
block-size: 0.5rem;
|
|
160
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly root: string
|
|
7
|
+
readonly columns: string
|
|
8
|
+
readonly column: string
|
|
9
|
+
readonly head: string
|
|
10
|
+
readonly title: string
|
|
11
|
+
readonly count: string
|
|
12
|
+
readonly total: string
|
|
13
|
+
readonly list: string
|
|
14
|
+
readonly card: string
|
|
15
|
+
readonly caption: string
|
|
16
|
+
readonly open: string
|
|
17
|
+
readonly record: string
|
|
18
|
+
readonly meter: string
|
|
19
|
+
readonly status: string
|
|
20
|
+
readonly empty: string
|
|
21
|
+
readonly skeletonTitle: string
|
|
22
|
+
readonly skeletonCaption: string
|
|
23
|
+
readonly skeletonLine: string
|
|
24
|
+
readonly skeletonStatus: string
|
|
25
|
+
}
|
|
26
|
+
export default classes
|
|
@@ -5,10 +5,10 @@ export type EmptyStateSlot = 'root' | 'icon' | 'title' | 'description' | 'action
|
|
|
5
5
|
export type EmptyStateProps = BasaltProps & SlotStylesProps<EmptyStateSlot> & {
|
|
6
6
|
/** Optional glyph slot, rendered faint at ~28-32px. No shipped illustration assets. */
|
|
7
7
|
icon?: ReactNode;
|
|
8
|
-
/**
|
|
8
|
+
/** Weight 500, ink: `sm` in a section tile (never louder than its host's title), `md` on a page (SPEC § 6.11). */
|
|
9
9
|
title: string;
|
|
10
10
|
/**
|
|
11
|
-
* Muted
|
|
11
|
+
* Muted `sm` description, capped at ~360px so it reads as a short explanation. Optional: a
|
|
12
12
|
* compact panel ("No data yet") should not have to invent a second sentence, and five argo
|
|
13
13
|
* features wrapped this component solely to avoid doing so.
|
|
14
14
|
*/
|
|
@@ -16,7 +16,7 @@ export type EmptyStateProps = BasaltProps & SlotStylesProps<EmptyStateSlot> & {
|
|
|
16
16
|
/** Optional call-to-action rendered below the description. */
|
|
17
17
|
action?: ReactNode;
|
|
18
18
|
/** How loud this state is: `'page'` (default) = generous padding for a full-page state;
|
|
19
|
-
* `'section'` = compact. */
|
|
19
|
+
* `'section'` = a compact, ring-edged tile (one ring, card radius) inside the surface it replaces. */
|
|
20
20
|
tier?: 'page' | 'section';
|
|
21
21
|
};
|
|
22
22
|
export declare function EmptyState({ icon, title, description, action, tier, className, style, classNames, }: EmptyStateProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEnE,oGAAoG;AACpG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB
|
|
1
|
+
{"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEnE,oGAAoG;AACpG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,kHAAkH;IAClH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;0GACsG;IACtG,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAaH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,+BAyDjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Center, Stack } from "@mantine/core";
|
|
3
|
-
import { VX } from "../tokens/index.js";
|
|
3
|
+
import { VX, alpha } from "../tokens/index.js";
|
|
4
4
|
import { cx } from "../common/props.js";
|
|
5
5
|
const STACK_XS = "var(--vx-space-stack-xs, 0.25rem)";
|
|
6
6
|
const PAGE_PADDING_Y = `calc(${STACK_XS} * 16)`;
|
|
@@ -27,6 +27,14 @@ function EmptyState({
|
|
|
27
27
|
style: {
|
|
28
28
|
padding: resolved === "page" ? `${PAGE_PADDING_Y} ${PAGE_PADDING_X}` : `${SECTION_PADDING_Y} ${SECTION_PADDING_X}`,
|
|
29
29
|
textAlign: "center",
|
|
30
|
+
// The section tile: one ring (a shadow, never a border), card radius. The ring is a neutral
|
|
31
|
+
// tint, not the card hairline: the tile sits on the page or a panel, and the hairline (a card
|
|
32
|
+
// edge on a white card) vanishes on the grey page in light.
|
|
33
|
+
...resolved === "section" && {
|
|
34
|
+
// theme-allow surface-shadow-override — an inset ring on a tile inside a surface, not a card's depth
|
|
35
|
+
boxShadow: `inset 0 0 0 1px ${alpha(VX.neutral, 0.25)}`,
|
|
36
|
+
borderRadius: "var(--vx-radius-card)"
|
|
37
|
+
},
|
|
30
38
|
...style
|
|
31
39
|
},
|
|
32
40
|
children: [
|
|
@@ -45,10 +53,9 @@ function EmptyState({
|
|
|
45
53
|
{
|
|
46
54
|
className: classNames?.title,
|
|
47
55
|
style: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
fontWeight: 550,
|
|
56
|
+
// A section tile never out-sizes its host's own title (`sm`); the page tier has none and keeps `md`.
|
|
57
|
+
fontSize: resolved === "section" ? VX.text.sm : VX.text.md,
|
|
58
|
+
fontWeight: 500,
|
|
52
59
|
color: VX.ink
|
|
53
60
|
},
|
|
54
61
|
children: title
|
|
@@ -59,7 +66,7 @@ function EmptyState({
|
|
|
59
66
|
"span",
|
|
60
67
|
{
|
|
61
68
|
className: classNames?.description,
|
|
62
|
-
style: { fontSize: VX.text.
|
|
69
|
+
style: { fontSize: VX.text.sm, color: VX.muted, maxWidth: "22.5rem" },
|
|
63
70
|
children: description
|
|
64
71
|
}
|
|
65
72
|
),
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `EventList`'s pure half: day grouping and the labels. Local-time day boundaries, the caller's
|
|
3
|
+
* order kept (a group is a run of adjacent items on one local day, never a re-sort).
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
export type EventTimeMode = 'clock' | 'relative' | 'date-time' | ((at: Date) => string);
|
|
7
|
+
export declare const toEventDate: (at: Date | number) => Date;
|
|
8
|
+
export declare const isValidEventDate: (at: Date) => boolean;
|
|
9
|
+
/** Local calendar day, `YYYY-MM-DD`. */
|
|
10
|
+
export declare function dayKey(at: Date): string;
|
|
11
|
+
export type EventGroup<T extends {
|
|
12
|
+
readonly at: Date | number;
|
|
13
|
+
}> = {
|
|
14
|
+
readonly day: Date;
|
|
15
|
+
/** The local day, `YYYY-MM-DD`, or `invalid` for a list with no real instant. */
|
|
16
|
+
readonly key: string;
|
|
17
|
+
/** `key` plus the run's occurrence, so a same-day prepend keeps every group's identity. */
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly items: readonly T[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Runs of adjacent items on one local day, in the order given. An item whose `at` is invalid has no
|
|
23
|
+
* day of its own: it joins the run before it, or (leading) the first real run that follows. A list
|
|
24
|
+
* with no real instant at all is one group on an invalid day, which renders without a header.
|
|
25
|
+
*/
|
|
26
|
+
export declare function groupByDay<T extends {
|
|
27
|
+
readonly at: Date | number;
|
|
28
|
+
}>(items: readonly T[]): EventGroup<T>[];
|
|
29
|
+
/** `Today`, `Yesterday`, else `Wed, Sep 2, 2026`. With no clock yet (the server render) always the date. */
|
|
30
|
+
export declare function defaultDayLabel(day: Date, now: Date | null): string;
|
|
31
|
+
export declare function formatEventTime(at: Date, mode: EventTimeMode, now: Date | null): string;
|
|
32
|
+
/** What every row (real or skeleton) shares: the list's density, rail, lead column, time mode and "now". */
|
|
33
|
+
export type RowContext = {
|
|
34
|
+
readonly density: 'feed' | 'timeline';
|
|
35
|
+
readonly rail: boolean;
|
|
36
|
+
readonly lead: boolean;
|
|
37
|
+
readonly timeMode: EventTimeMode;
|
|
38
|
+
/** `null` until the client clock is read (the server render and the hydrating paint). */
|
|
39
|
+
readonly now: Date | null;
|
|
40
|
+
};
|
|
41
|
+
/** `null`, `undefined`, booleans and the empty string render nothing, so they are not content. */
|
|
42
|
+
export declare const present: (node: ReactNode) => boolean;
|
|
43
|
+
/** The data attributes a row (real or skeleton) carries; the CSS keys on them. */
|
|
44
|
+
export declare function rowAttributes(ctx: RowContext, first: boolean, last: boolean): {
|
|
45
|
+
'data-density': "feed" | "timeline";
|
|
46
|
+
'data-lead': string | undefined;
|
|
47
|
+
'data-rail': string | undefined;
|
|
48
|
+
'data-first': string | undefined;
|
|
49
|
+
'data-last': string | undefined;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=event-list-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-list-model.d.ts","sourceRoot":"","sources":["../../src/dashboard/event-list-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,CAAA;AAEvF,eAAO,MAAM,WAAW,GAAI,IAAI,IAAI,GAAG,MAAM,KAAG,IAAgD,CAAA;AAEhG,eAAO,MAAM,gBAAgB,GAAI,IAAI,IAAI,KAAG,OAAwC,CAAA;AAKpF,wCAAwC;AACxC,wBAAgB,MAAM,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAIvC;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,IAAI;IACjE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAA;CAC7B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,EACjE,KAAK,EAAE,SAAS,CAAC,EAAE,GAClB,UAAU,CAAC,CAAC,CAAC,EAAE,CA0BjB;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CASnE;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAQvF;AAED,4GAA4G;AAC5G,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC,yFAAyF;IACzF,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,OAAO,GAAI,MAAM,SAAS,KAAG,OACuC,CAAA;AAEjF,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;;;;;;EAQ3E"}
|