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.
Files changed (229) hide show
  1. package/CHANGELOG.md +461 -401
  2. package/MIGRATING.md +202 -12
  3. package/agent/skills/basalt-app/SKILL.md +3 -3
  4. package/agent/skills/basalt-charts/SKILL.md +1 -1
  5. package/agent/skills/basalt-design/SKILL.md +11 -5
  6. package/agent/skills/basalt-design/references/catalogue.md +3 -1
  7. package/agent/skills/basalt-design/references/recipes.md +1 -1
  8. package/agent/skills/basalt-design/references/states.md +1 -1
  9. package/configs/oxlint-plugin.js +2 -1
  10. package/configs/oxlint.json +1 -0
  11. package/dist/charts/ChartCard.d.ts +9 -5
  12. package/dist/charts/ChartCard.d.ts.map +1 -1
  13. package/dist/charts/ChartCard.js +68 -12
  14. package/dist/charts/Sparkline.d.ts +5 -0
  15. package/dist/charts/Sparkline.d.ts.map +1 -1
  16. package/dist/charts/Sparkline.js +53 -5
  17. package/dist/charts/chart-box.module.css +9 -2
  18. package/dist/charts/chart-card.module.css +16 -13
  19. package/dist/charts/chart-card.module.css.d.ts +2 -0
  20. package/dist/charts/compile.d.ts +1 -1
  21. package/dist/charts/compile.d.ts.map +1 -1
  22. package/dist/charts/compile.js +18 -9
  23. package/dist/charts/ref-label.d.ts +6 -0
  24. package/dist/charts/ref-label.d.ts.map +1 -1
  25. package/dist/charts/ref-label.js +19 -5
  26. package/dist/charts/sparkline.module.css +44 -0
  27. package/dist/charts/sparkline.module.css.d.ts +3 -0
  28. package/dist/charts/state.d.ts +1 -1
  29. package/dist/charts/state.d.ts.map +1 -1
  30. package/dist/charts/state.js +3 -3
  31. package/dist/cli/doctor-upgrade.d.ts +11 -0
  32. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  33. package/dist/cli/doctor-upgrade.js +54 -0
  34. package/dist/cli/doctor.d.ts.map +1 -1
  35. package/dist/cli/doctor.js +32 -0
  36. package/dist/cli/help.d.ts.map +1 -1
  37. package/dist/cli/help.js +8 -3
  38. package/dist/cli/index.d.ts +13 -13
  39. package/dist/cli/index.d.ts.map +1 -1
  40. package/dist/cli/index.js +36 -2
  41. package/dist/cli/init.d.ts +6 -0
  42. package/dist/cli/init.d.ts.map +1 -1
  43. package/dist/cli/init.js +118 -27
  44. package/dist/cli/router-wiring.d.ts +3 -0
  45. package/dist/cli/router-wiring.d.ts.map +1 -1
  46. package/dist/cli/router-wiring.js +2 -0
  47. package/dist/cli/shot/capture.d.ts +28 -1
  48. package/dist/cli/shot/capture.d.ts.map +1 -1
  49. package/dist/cli/shot/capture.js +77 -7
  50. package/dist/cli/shot/detect.d.ts +4 -1
  51. package/dist/cli/shot/detect.d.ts.map +1 -1
  52. package/dist/cli/shot/detect.js +38 -16
  53. package/dist/cli/shot/index.d.ts.map +1 -1
  54. package/dist/cli/shot/index.js +9 -2
  55. package/dist/cli/shot/measure.d.ts.map +1 -1
  56. package/dist/cli/shot/measure.js +11 -2
  57. package/dist/cli/shot/types.d.ts +4 -1
  58. package/dist/cli/shot/types.d.ts.map +1 -1
  59. package/dist/cli/sync.d.ts.map +1 -1
  60. package/dist/cli/sync.js +10 -2
  61. package/dist/common/could-not-load.d.ts +13 -0
  62. package/dist/common/could-not-load.d.ts.map +1 -0
  63. package/dist/common/could-not-load.js +14 -0
  64. package/dist/common/index.d.ts +1 -0
  65. package/dist/common/index.d.ts.map +1 -1
  66. package/dist/common/index.js +3 -0
  67. package/dist/common/props.d.ts +20 -0
  68. package/dist/common/props.d.ts.map +1 -1
  69. package/dist/common/props.js +13 -1
  70. package/dist/common/retry-button.module.css +7 -3
  71. package/dist/dashboard/bar-list.d.ts +4 -4
  72. package/dist/dashboard/bar-list.d.ts.map +1 -1
  73. package/dist/dashboard/bar-list.js +10 -7
  74. package/dist/dashboard/bar-list.module.css +21 -3
  75. package/dist/dashboard/board.d.ts +2 -2
  76. package/dist/dashboard/board.d.ts.map +1 -1
  77. package/dist/dashboard/board.js +31 -12
  78. package/dist/dashboard/board.module.css +19 -0
  79. package/dist/dashboard/board.module.css.d.ts +2 -0
  80. package/dist/dashboard/empty-state.d.ts +3 -3
  81. package/dist/dashboard/empty-state.d.ts.map +1 -1
  82. package/dist/dashboard/empty-state.js +4 -2
  83. package/dist/dashboard/event-list-model.d.ts +3 -0
  84. package/dist/dashboard/event-list-model.d.ts.map +1 -1
  85. package/dist/dashboard/event-list-model.js +5 -1
  86. package/dist/dashboard/event-list-rows.d.ts.map +1 -1
  87. package/dist/dashboard/event-list-rows.js +2 -6
  88. package/dist/dashboard/event-list-scroll.d.ts +32 -4
  89. package/dist/dashboard/event-list-scroll.d.ts.map +1 -1
  90. package/dist/dashboard/event-list-scroll.js +117 -4
  91. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -1
  92. package/dist/dashboard/event-list-skeleton.js +2 -4
  93. package/dist/dashboard/event-list.d.ts +4 -4
  94. package/dist/dashboard/event-list.d.ts.map +1 -1
  95. package/dist/dashboard/event-list.js +53 -23
  96. package/dist/dashboard/event-list.module.css +90 -37
  97. package/dist/dashboard/event-list.module.css.d.ts +1 -0
  98. package/dist/dashboard/meter-model.d.ts +6 -3
  99. package/dist/dashboard/meter-model.d.ts.map +1 -1
  100. package/dist/dashboard/meter-model.js +9 -4
  101. package/dist/dashboard/meter-parts.d.ts +3 -0
  102. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  103. package/dist/dashboard/meter-parts.js +32 -4
  104. package/dist/dashboard/meter.d.ts +3 -3
  105. package/dist/dashboard/meter.d.ts.map +1 -1
  106. package/dist/dashboard/meter.js +10 -2
  107. package/dist/dashboard/meter.module.css +18 -11
  108. package/dist/dashboard/meter.module.css.d.ts +0 -1
  109. package/dist/dashboard/page-summary.d.ts +3 -3
  110. package/dist/dashboard/page-summary.d.ts.map +1 -1
  111. package/dist/dashboard/page-summary.js +7 -2
  112. package/dist/dashboard/page-summary.module.css +5 -2
  113. package/dist/dashboard/query-state.d.ts +9 -8
  114. package/dist/dashboard/query-state.d.ts.map +1 -1
  115. package/dist/dashboard/query-state.js +28 -10
  116. package/dist/dashboard/section.d.ts +11 -3
  117. package/dist/dashboard/section.d.ts.map +1 -1
  118. package/dist/dashboard/section.js +34 -7
  119. package/dist/dashboard/settings-section.d.ts +4 -4
  120. package/dist/dashboard/settings-section.d.ts.map +1 -1
  121. package/dist/dashboard/settings-section.js +11 -7
  122. package/dist/dashboard/settings-section.module.css +6 -0
  123. package/dist/dashboard/settings-section.module.css.d.ts +1 -0
  124. package/dist/dashboard/stat-card.d.ts +3 -3
  125. package/dist/dashboard/stat-card.d.ts.map +1 -1
  126. package/dist/dashboard/stat-card.js +24 -8
  127. package/dist/dashboard/stat-card.module.css +11 -0
  128. package/dist/dashboard/stat-group.d.ts +2 -2
  129. package/dist/dashboard/stat-group.d.ts.map +1 -1
  130. package/dist/dashboard/stat-group.js +10 -3
  131. package/dist/dashboard/stat-strip.d.ts +5 -4
  132. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  133. package/dist/dashboard/stat-strip.js +41 -31
  134. package/dist/dashboard/stat-strip.module.css +4 -5
  135. package/dist/dashboard/visual-slot.d.ts +4 -0
  136. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  137. package/dist/dashboard/visual-slot.js +2 -0
  138. package/dist/dashboard/widget-header.d.ts +6 -6
  139. package/dist/dashboard/widget-header.d.ts.map +1 -1
  140. package/dist/dashboard/widget-header.js +4 -2
  141. package/dist/dashboard/widget-header.module.css +6 -25
  142. package/dist/format/shared.d.ts.map +1 -1
  143. package/dist/format/shared.js +24 -1
  144. package/dist/guard/index.d.ts +1 -1
  145. package/dist/guard/index.d.ts.map +1 -1
  146. package/dist/guard/index.js +2 -1
  147. package/dist/styles.css +23 -0
  148. package/dist/table/cell-kinds.d.ts +10 -7
  149. package/dist/table/cell-kinds.d.ts.map +1 -1
  150. package/dist/table/cell-kinds.js +18 -7
  151. package/dist/table/data-table-fold.d.ts +13 -5
  152. package/dist/table/data-table-fold.d.ts.map +1 -1
  153. package/dist/table/data-table-fold.js +48 -16
  154. package/dist/table/data-table.d.ts +2 -2
  155. package/dist/table/data-table.d.ts.map +1 -1
  156. package/dist/table/data-table.js +16 -9
  157. package/dist/table/data-table.module.css +74 -2
  158. package/dist/table/data-table.module.css.d.ts +4 -0
  159. package/dist/theme/controls.module.css +23 -2
  160. package/llms.txt +263 -2
  161. package/package.json +1 -1
  162. package/src/charts/ChartCard.tsx +98 -16
  163. package/src/charts/Sparkline.tsx +84 -5
  164. package/src/charts/chart-box.module.css +9 -2
  165. package/src/charts/chart-card.module.css +16 -13
  166. package/src/charts/chart-card.module.css.d.ts +2 -0
  167. package/src/charts/compile.ts +37 -15
  168. package/src/charts/ref-label.ts +36 -9
  169. package/src/charts/sparkline.module.css +44 -0
  170. package/src/charts/sparkline.module.css.d.ts +3 -0
  171. package/src/charts/state.tsx +4 -3
  172. package/src/cli/doctor-upgrade.ts +75 -0
  173. package/src/cli/doctor.ts +36 -0
  174. package/src/cli/help.ts +16 -6
  175. package/src/cli/index.ts +73 -67
  176. package/src/cli/init.ts +157 -36
  177. package/src/cli/router-wiring.ts +2 -2
  178. package/src/cli/shot/capture.ts +109 -10
  179. package/src/cli/shot/detect.ts +46 -22
  180. package/src/cli/shot/index.ts +8 -2
  181. package/src/cli/shot/measure.ts +11 -2
  182. package/src/cli/shot/types.ts +4 -1
  183. package/src/cli/sync.ts +12 -2
  184. package/src/common/could-not-load.ts +22 -0
  185. package/src/common/index.ts +1 -0
  186. package/src/common/props.ts +30 -0
  187. package/src/common/retry-button.module.css +7 -3
  188. package/src/dashboard/bar-list.module.css +21 -3
  189. package/src/dashboard/bar-list.tsx +46 -41
  190. package/src/dashboard/board.module.css +19 -0
  191. package/src/dashboard/board.module.css.d.ts +2 -0
  192. package/src/dashboard/board.tsx +69 -48
  193. package/src/dashboard/empty-state.tsx +5 -2
  194. package/src/dashboard/event-list-model.ts +13 -1
  195. package/src/dashboard/event-list-rows.tsx +3 -6
  196. package/src/dashboard/event-list-scroll.ts +154 -8
  197. package/src/dashboard/event-list-skeleton.tsx +5 -1
  198. package/src/dashboard/event-list.module.css +90 -37
  199. package/src/dashboard/event-list.module.css.d.ts +1 -0
  200. package/src/dashboard/event-list.tsx +92 -65
  201. package/src/dashboard/meter-model.ts +16 -7
  202. package/src/dashboard/meter-parts.tsx +45 -13
  203. package/src/dashboard/meter.module.css +18 -11
  204. package/src/dashboard/meter.module.css.d.ts +0 -1
  205. package/src/dashboard/meter.tsx +36 -18
  206. package/src/dashboard/page-summary.module.css +5 -2
  207. package/src/dashboard/page-summary.tsx +13 -6
  208. package/src/dashboard/query-state.tsx +54 -29
  209. package/src/dashboard/section.tsx +83 -41
  210. package/src/dashboard/settings-section.module.css +6 -0
  211. package/src/dashboard/settings-section.module.css.d.ts +1 -0
  212. package/src/dashboard/settings-section.tsx +11 -6
  213. package/src/dashboard/stat-card.module.css +11 -0
  214. package/src/dashboard/stat-card.tsx +31 -8
  215. package/src/dashboard/stat-group.tsx +22 -14
  216. package/src/dashboard/stat-strip.module.css +4 -5
  217. package/src/dashboard/stat-strip.tsx +29 -20
  218. package/src/dashboard/visual-slot.ts +5 -0
  219. package/src/dashboard/widget-header.module.css +6 -25
  220. package/src/dashboard/widget-header.tsx +8 -5
  221. package/src/format/shared.ts +30 -1
  222. package/src/guard/index.ts +5 -1
  223. package/src/styles.css +23 -0
  224. package/src/table/cell-kinds.tsx +42 -13
  225. package/src/table/data-table-fold.tsx +65 -12
  226. package/src/table/data-table.module.css +74 -2
  227. package/src/table/data-table.module.css.d.ts +4 -0
  228. package/src/table/data-table.tsx +34 -13
  229. package/src/theme/controls.module.css +23 -2
@@ -9,11 +9,14 @@
9
9
  min-width: 0;
10
10
  }
11
11
 
12
+ /* The aside sits right after the sentence it dates and wraps under it when the line is full — never
13
+ * pinned to the far edge, where it read as belonging to nothing. */
12
14
  .top {
13
15
  display: flex;
16
+ flex-wrap: wrap;
14
17
  align-items: baseline;
15
- justify-content: space-between;
16
- gap: var(--vx-space-stack-md);
18
+ column-gap: var(--vx-space-stack-md);
19
+ row-gap: var(--vx-space-stack-xs);
17
20
  min-width: 0;
18
21
  }
19
22
 
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { BasaltProps, SlotStylesProps } from '../common/props.js';
2
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
3
3
  import type { QueryStateLike } from '../common/query-state-like.js';
4
4
  /**
5
5
  * How loud this state is: `'page'` = a full route body (generous padding), `'section'` = a
@@ -27,7 +27,7 @@ export type QueryEmptyCopy = {
27
27
  /** Call-to-action below the copy (e.g. "Reset filters"). */
28
28
  action?: ReactNode;
29
29
  };
30
- export type LoadingStateProps = BasaltProps & {
30
+ export type LoadingStateProps = BasaltProps & DataAttributes & {
31
31
  /** How loud this state is. Default `'page'`. */
32
32
  tier?: QueryStateTier;
33
33
  /** Accessible name for the loading state. Say what is loading. */
@@ -38,8 +38,8 @@ export type LoadingStateProps = BasaltProps & {
38
38
  * `'section'` is a neutral skeleton, never an accent spinner. A card region that knows its loaded
39
39
  * shape passes `loading` to `QueryState` instead.
40
40
  */
41
- export declare function LoadingState({ tier, label, className, style, }: LoadingStateProps): ReactNode;
42
- export type ErrorStateProps = BasaltProps & {
41
+ export declare function LoadingState({ tier, label, className, style, ...rest }: LoadingStateProps): ReactNode;
42
+ export type ErrorStateProps = BasaltProps & DataAttributes & {
43
43
  /** Whatever was thrown — the raw Eden/fetch envelope is fine, it gets decoded. */
44
44
  error: unknown;
45
45
  /** Alert heading. Say what failed, e.g. `Could not load images`. */
@@ -58,7 +58,7 @@ export type ErrorStateProps = BasaltProps & {
58
58
  * The error branch: the REAL server message (via `toErrorMessage`) plus a retry. Usable on its own,
59
59
  * outside a query — an auth gate or a boundary fallback renders it directly.
60
60
  */
61
- export declare function ErrorState({ error, title, fallback, onRetry, retrying, tier, action, className, style, }: ErrorStateProps): ReactNode;
61
+ export declare function ErrorState({ error, title: titleProp, fallback, onRetry, retrying, tier, action, className, style, ...rest }: ErrorStateProps): ReactNode;
62
62
  /**
63
63
  * The body a card-sized consumer should show for `query`, resolved by ONE precedence:
64
64
  * error > pending > empty > ready.
@@ -105,7 +105,7 @@ caller: string, isEmpty?: (data: TData) => boolean): QueryBranch<TData>;
105
105
  * `EmptyState` placed by hand — that escape hatch is why they ship.
106
106
  */
107
107
  export type QueryStateSlot = 'root';
108
- export type QueryStateProps<TData> = BasaltProps & SlotStylesProps<QueryStateSlot> & {
108
+ export type QueryStateProps<TData> = BasaltProps & DataAttributes & SlotStylesProps<QueryStateSlot> & {
109
109
  query: QueryStateLike<TData>;
110
110
  /** A render function gets `data` narrowed to non-undefined; a plain node also works. */
111
111
  children: ReactNode | ((data: TData) => ReactNode);
@@ -113,7 +113,8 @@ export type QueryStateProps<TData> = BasaltProps & SlotStylesProps<QueryStateSlo
113
113
  empty?: QueryEmptyCopy;
114
114
  /** Override the default `[]` / `{ data: [] }` emptiness test — `() => false` disables it. */
115
115
  isEmpty?: (data: TData) => boolean;
116
- /** Alert heading on the error branch — say what failed. */
116
+ /** Alert heading on the error branch — say what failed. Omitted inside a titled `Section`, it
117
+ * names that section ("Could not load practice record"); elsewhere it is "Could not load". */
117
118
  errorTitle?: string;
118
119
  /** Shown only when the server body carries no readable message. */
119
120
  errorFallback?: string;
@@ -143,5 +144,5 @@ export type QueryStateProps<TData> = BasaltProps & SlotStylesProps<QueryStateSlo
143
144
  * {(data) => <ImageGrid images={data.rows} />}
144
145
  * </QueryState>
145
146
  */
146
- export declare function QueryState<TData>({ query, children, empty, isEmpty, errorTitle, errorFallback, errorAction, tier, loading, className, style, classNames, }: QueryStateProps<TData>): ReactNode;
147
+ export declare function QueryState<TData>({ query, children, empty, isEmpty, errorTitle, errorFallback, errorAction, tier, loading, className, style, classNames, ...rest }: QueryStateProps<TData>): ReactNode;
147
148
  //# sourceMappingURL=query-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-state.d.ts","sourceRoot":"","sources":["../../src/d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;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,EAChC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAU,EACV,aAAqC,EACrC,WAAW,EACX,IAAI,EACJ,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CA2EpC"}
@@ -1,7 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Center, Group, Loader, Skeleton, Stack, Text, VisuallyHidden } from "@mantine/core";
3
+ import { useContext } from "react";
3
4
  import { toErrorMessage } from "../common/errors.js";
4
- import { cx } from "../common/props.js";
5
+ import { couldNotLoad, HostTitleContext } from "../common/could-not-load.js";
6
+ import { cx, pickDataAttributes } from "../common/props.js";
5
7
  import { RetryButton } from "../common/retry-button.js";
6
8
  import { VX } from "../tokens/index.js";
7
9
  import { StatusDot } from "../theme/status-dot.js";
@@ -11,13 +13,16 @@ function LoadingState({
11
13
  tier,
12
14
  label = "Loading",
13
15
  className,
14
- style
16
+ style,
17
+ ...rest
15
18
  }) {
16
19
  const resolved = tier ?? "page";
20
+ const data = pickDataAttributes(rest);
17
21
  if (resolved === "section") {
18
22
  return /* @__PURE__ */ jsxs(
19
23
  Stack,
20
24
  {
25
+ ...data,
21
26
  component: "output",
22
27
  gap: "xs",
23
28
  "aria-label": label,
@@ -36,6 +41,7 @@ function LoadingState({
36
41
  return /* @__PURE__ */ jsx(
37
42
  Center,
38
43
  {
44
+ ...data,
39
45
  ...className !== void 0 && { className },
40
46
  style: { paddingBlock: "calc(var(--vx-space-stack-xs, 0.25rem) * 16)", ...style },
41
47
  children: /* @__PURE__ */ jsx(Loader, { size: "sm", color: VX.muted, "aria-label": label })
@@ -44,21 +50,26 @@ function LoadingState({
44
50
  }
45
51
  function ErrorState({
46
52
  error,
47
- title = "Could not load",
53
+ title: titleProp,
48
54
  fallback = "The request failed.",
49
55
  onRetry,
50
56
  retrying = false,
51
57
  tier,
52
58
  action,
53
59
  className,
54
- style
60
+ style,
61
+ ...rest
55
62
  }) {
63
+ const data = pickDataAttributes(rest);
64
+ const hostTitle = useContext(HostTitleContext);
65
+ const title = titleProp ?? couldNotLoad(hostTitle);
56
66
  const resolved = tier ?? "page";
57
67
  const alert = /* @__PURE__ */ jsxs(
58
68
  Stack,
59
69
  {
60
70
  gap: "xs",
61
71
  role: "alert",
72
+ ...resolved === "section" && data,
62
73
  ...resolved === "section" && className !== void 0 && { className },
63
74
  ...resolved === "section" && style !== void 0 && { style },
64
75
  children: [
@@ -79,6 +90,7 @@ function ErrorState({
79
90
  Stack,
80
91
  {
81
92
  py: "md",
93
+ ...data,
82
94
  ...className !== void 0 && { className },
83
95
  ...style !== void 0 && { style },
84
96
  children: alert
@@ -108,16 +120,18 @@ function QueryState({
108
120
  children,
109
121
  empty,
110
122
  isEmpty,
111
- errorTitle = "Could not load",
123
+ errorTitle,
112
124
  errorFallback = "The request failed.",
113
125
  errorAction,
114
126
  tier,
115
127
  loading,
116
128
  className,
117
129
  style,
118
- classNames
130
+ classNames,
131
+ ...rest
119
132
  }) {
120
133
  assertQueryStateLike("QueryState", query);
134
+ const dataAttrs = pickDataAttributes(rest);
121
135
  const resolvedTier = tier ?? "page";
122
136
  const rootClassName = cx(classNames?.root, className) || void 0;
123
137
  const { data, isError, error, fetchStatus } = query;
@@ -127,8 +141,9 @@ function QueryState({
127
141
  return /* @__PURE__ */ jsx(
128
142
  ErrorState,
129
143
  {
144
+ ...dataAttrs,
130
145
  error,
131
- title: errorTitle,
146
+ ...errorTitle !== void 0 && { title: errorTitle },
132
147
  fallback: errorFallback,
133
148
  onRetry: retry,
134
149
  retrying,
@@ -141,10 +156,11 @@ function QueryState({
141
156
  }
142
157
  if (data === void 0) {
143
158
  if (fetchStatus === "idle" && !isError)
144
- return empty ? renderEmpty(empty, resolvedTier, rootClassName, style) : null;
159
+ return empty ? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs) : null;
145
160
  return loading ?? /* @__PURE__ */ jsx(
146
161
  LoadingState,
147
162
  {
163
+ ...dataAttrs,
148
164
  tier: resolvedTier,
149
165
  ...rootClassName !== void 0 && { className: rootClassName },
150
166
  ...style !== void 0 && { style }
@@ -152,11 +168,12 @@ function QueryState({
152
168
  );
153
169
  }
154
170
  const emptyNow = isEmpty ? isEmpty(data) : defaultIsEmpty(data);
155
- const body = emptyNow ? empty ? renderEmpty(empty, resolvedTier, rootClassName, style) : null : typeof children === "function" ? children(data) : children;
171
+ const body = emptyNow ? empty ? renderEmpty(empty, resolvedTier, rootClassName, style, dataAttrs) : null : typeof children === "function" ? children(data) : children;
156
172
  if (!isError) return body;
157
173
  return /* @__PURE__ */ jsxs(
158
174
  Stack,
159
175
  {
176
+ ...dataAttrs,
160
177
  gap: "sm",
161
178
  ...rootClassName !== void 0 && { className: rootClassName },
162
179
  ...style !== void 0 && { style },
@@ -177,10 +194,11 @@ function QueryState({
177
194
  }
178
195
  );
179
196
  }
180
- function renderEmpty(empty, tier, className, style) {
197
+ function renderEmpty(empty, tier, className, style, data) {
181
198
  return /* @__PURE__ */ jsx(
182
199
  EmptyState,
183
200
  {
201
+ ...data,
184
202
  title: empty.title,
185
203
  tier,
186
204
  ...empty.description !== void 0 && { description: empty.description },
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { BasaltProps, SlotStylesProps } from '../common/props.js';
2
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
3
3
  import type { SectionActions } from '../controls/actions.js';
4
4
  import type { QueryEmptyCopy, QueryStateLike } from './query-state.js';
5
5
  import type { WidgetHeaderProps } from './widget-header.js';
@@ -12,7 +12,7 @@ import type { WidgetHeaderProps } from './widget-header.js';
12
12
  export type SectionSlot = 'root' | 'header' | 'body';
13
13
  /** The props only a drawn heading can carry; an untitled `Section` forbids each (`?: never`). */
14
14
  type HeaderOnlyKey = 'icon' | 'subtitle' | 'info' | 'value' | 'unit' | 'delta' | 'deltaPeriod' | 'deltaPolarity' | 'deltaFormat' | 'deltaGlyph' | 'sparkline' | 'count';
15
- type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey> & BasaltProps & SlotStylesProps<SectionSlot> & {
15
+ type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions' | 'title' | HeaderOnlyKey> & BasaltProps & DataAttributes & SlotStylesProps<SectionSlot> & {
16
16
  /**
17
17
  * Header actions as typed data (law C15), projected through the SAME row `PageBar` uses — one
18
18
  * kebab below `sm`. At most three: a fourth is a tsc error (law C6, `docs/V2-SPEC.md` §3).
@@ -35,6 +35,14 @@ type SectionBaseProps = Omit<WidgetHeaderProps, 'tier' | 'classNames' | 'actions
35
35
  * without `query`.
36
36
  */
37
37
  empty?: QueryEmptyCopy;
38
+ /**
39
+ * The loaded body's height in px. While `query` is pending the loading skeleton fills it, so
40
+ * the section does not jump when the data lands. Declared, not measured: a first load has no
41
+ * previous body to measure. Omitted, a body that is one `BarList`, `EventList` or `Meter`
42
+ * loads as that figure's own skeleton (set its `loadingRows` to the loaded count); any other
43
+ * body gets the three-bar default. Ignored without `query`.
44
+ */
45
+ loadingHeight?: number;
38
46
  /** Rendered in the header row, in its own `CtlSlot` — hidden while the section is collapsed. */
39
47
  tabs?: ReactNode;
40
48
  /** Renders a chevron toggle in the header; the header stays drawn when closed, only `children`
@@ -82,6 +90,6 @@ export type SectionProps = SectionBaseProps & ((Pick<WidgetHeaderProps, HeaderOn
82
90
  } & {
83
91
  [K in HeaderOnlyKey]?: never;
84
92
  }));
85
- export declare function Section({ actions, query, empty, tabs, collapsible, persistKey, defaultOpen, open: openProp, onOpenChange, summary, id, children, className, style, classNames, 'aria-label': ariaLabel, ...headerProps }: SectionProps): import("react").JSX.Element;
93
+ export declare function Section({ actions, query, empty, loadingHeight, tabs, collapsible, persistKey, defaultOpen, open: openProp, onOpenChange, summary, id, children, className, style, classNames, 'aria-label': ariaLabel, ...headerAndData }: SectionProps): import("react").JSX.Element;
86
94
  export {};
87
95
  //# sourceMappingURL=section.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"section.d.ts","sourceRoot":"","sources":["../../src/dashboard/section.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGxD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAMpD,iGAAiG;AACjG,KAAK,aAAa,GACd,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,GACP,MAAM,GACN,OAAO,GACP,aAAa,GACb,eAAe,GACf,aAAa,GACb,YAAY,GACZ,WAAW,GACX,OAAO,CAAA;AAEX,KAAK,gBAAgB,GAAG,IAAI,CAC1B,iBAAiB,EACjB,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAC5D,GACC,WAAW,GACX,eAAe,CAAC,WAAW,CAAC,GAAG;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IAC/B;;;;OAIG;IACH,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,gGAAgG;IAChG,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;8CAC0C;IAC1C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;uBACmB;IACnB,UAAU,CAAC,EAAE,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;qCAEiC;IACjC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,gBAAgB,GACzC,CACI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,GAClF,CAAC;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;KAC9D,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,KAAK;CAC7B,CAAC,CACL,CAAA;AAyDH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,KAAK,EACL,aAAa,EACb,IAAI,EACJ,WAAmB,EACnB,UAAU,EACV,WAAkB,EAClB,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,OAAO,EACP,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,EACV,YAAY,EAAE,SAAS,EACvB,GAAG,aAAa,EACjB,EAAE,YAAY,+BA8Hd"}
@@ -1,14 +1,18 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useId } from "react";
3
- import { cx } from "../common/props.js";
2
+ import { Children, cloneElement, isValidElement, useContext, useEffect, useId } from "react";
3
+ import { cx, splitDataAttributes } from "../common/props.js";
4
4
  import { BASALT_PREFIX } from "../common/errors.js";
5
5
  import { useValidateProps } from "../common/validate.js";
6
6
  import { CtlSlot } from "../theme/index.js";
7
7
  import { BarActionSlot } from "../controls/actions.js";
8
8
  import { useFilterSurface } from "../controls/filter-context.js";
9
- import { QueryState } from "./query-state.js";
9
+ import { HostTitleContext } from "../common/could-not-load.js";
10
+ import { LoadingState, QueryState } from "./query-state.js";
10
11
  import { usePersistedOrLocal } from "../state/persisted-or-local.js";
11
12
  import { PAGE_BAR_HEIGHT_VAR, useInPageBarShell } from "../shell/index.js";
13
+ import { BarList } from "./bar-list.js";
14
+ import { EventList } from "./event-list.js";
15
+ import { Meter } from "./meter.js";
12
16
  import { WidgetHeader } from "./widget-header.js";
13
17
  import classes from "./section.module.css";
14
18
  function ChevronToggle({
@@ -43,6 +47,13 @@ function ChevronToggle({
43
47
  }
44
48
  );
45
49
  }
50
+ function figureLoading(children) {
51
+ const only = Children.toArray(children);
52
+ const [child] = only;
53
+ if (only.length !== 1 || !isValidElement(child)) return null;
54
+ if (child.type !== BarList && child.type !== EventList && child.type !== Meter) return null;
55
+ return cloneElement(child, { loading: true });
56
+ }
46
57
  const ANCHOR_CLEARANCE = "var(--vx-space-sticky-header-clearance)";
47
58
  function anchorOffset(inShell) {
48
59
  if (inShell) return ANCHOR_CLEARANCE;
@@ -52,6 +63,7 @@ function Section({
52
63
  actions,
53
64
  query,
54
65
  empty,
66
+ loadingHeight,
55
67
  tabs,
56
68
  collapsible = false,
57
69
  persistKey,
@@ -65,9 +77,11 @@ function Section({
65
77
  style,
66
78
  classNames,
67
79
  "aria-label": ariaLabel,
68
- ...headerProps
80
+ ...headerAndData
69
81
  }) {
82
+ const { data, rest: headerProps } = splitDataAttributes(headerAndData);
70
83
  const { title } = headerProps;
84
+ const outerTitle = useContext(HostTitleContext);
71
85
  const untitled = title === void 0;
72
86
  useValidateProps(
73
87
  "Section",
@@ -100,9 +114,11 @@ function Section({
100
114
  actions !== void 0 && /* @__PURE__ */ jsx(CtlSlot, { children: /* @__PURE__ */ jsx(BarActionSlot, { actions }) }),
101
115
  foldable && /* @__PURE__ */ jsx(ChevronToggle, { open, onToggle: () => setOpen(!open), controls: bodyId })
102
116
  ] }) : void 0;
103
- return /* @__PURE__ */ jsxs(
117
+ const figure = query !== void 0 && loadingHeight === void 0 ? figureLoading(children) : null;
118
+ return /* @__PURE__ */ jsx(HostTitleContext, { value: title ?? outerTitle, children: /* @__PURE__ */ jsxs(
104
119
  "div",
105
120
  {
121
+ ...data,
106
122
  className: cx(classes.root, classNames?.root, className),
107
123
  "data-tier": tier,
108
124
  ...untitled && ariaLabel !== void 0 && { role: "group", "aria-label": ariaLabel },
@@ -124,11 +140,22 @@ function Section({
124
140
  // `tier="section"` is the compact one: a bare spinner rather than a 64px centred
125
141
  // block, and the error alert without the page-level stack around it. A Section IS the
126
142
  // region, so the state belongs inside its body, never around its header.
127
- /* @__PURE__ */ jsx(QueryState, { query, tier: "section", ...empty !== void 0 && { empty }, children })
143
+ /* @__PURE__ */ jsx(
144
+ QueryState,
145
+ {
146
+ query,
147
+ tier: "section",
148
+ ...empty !== void 0 && { empty },
149
+ ...loadingHeight !== void 0 ? {
150
+ loading: /* @__PURE__ */ jsx(LoadingState, { tier: "section", style: { minHeight: loadingHeight } })
151
+ } : figure !== null && { loading: figure },
152
+ children
153
+ }
154
+ )
128
155
  ) })
129
156
  ]
130
157
  }
131
- );
158
+ ) });
132
159
  }
133
160
  export {
134
161
  Section
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { WidgetHeaderTitleProps } from './widget-header.js';
3
- import type { BasaltProps, SlotStylesProps } from '../common/props.js';
3
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
4
4
  /** The three boxes `SettingsSection`/`DangerZone` paint (`common/props.ts`). */
5
5
  export type SettingsSectionSlot = 'root' | 'header' | 'body';
6
6
  /**
@@ -11,13 +11,13 @@ export type SettingsSectionSlot = 'root' | 'header' | 'body';
11
11
  * `Section` and `ChartCard` still cut their own ad-hoc subsets; both should move onto the same
12
12
  * slices.
13
13
  */
14
- export type SettingsSectionProps = BasaltProps & SlotStylesProps<SettingsSectionSlot> & WidgetHeaderTitleProps & {
14
+ export type SettingsSectionProps = BasaltProps & DataAttributes & SlotStylesProps<SettingsSectionSlot> & WidgetHeaderTitleProps & {
15
15
  /** Header-right slot — wrapped in `CtlSlot` (C1/C5). */
16
16
  actions?: ReactNode;
17
17
  /** Section body — typically a stack of `SettingsRow`s. */
18
18
  children: ReactNode;
19
19
  };
20
- export declare function SettingsSection({ title, icon, subtitle, info, actions, children, className, style, classNames, }: SettingsSectionProps): import("react").JSX.Element;
20
+ export declare function SettingsSection({ title, icon, subtitle, info, actions, children, className, style, classNames, ...rest }: SettingsSectionProps): import("react").JSX.Element;
21
21
  /** The three boxes `SettingsRow` paints (`common/props.ts`). */
22
22
  export type SettingsRowSlot = 'root' | 'label' | 'control';
23
23
  export type SettingsRowProps = BasaltProps & SlotStylesProps<SettingsRowSlot> & {
@@ -35,5 +35,5 @@ export type SettingsRowProps = BasaltProps & SlotStylesProps<SettingsRowSlot> &
35
35
  };
36
36
  export declare function SettingsRow({ label, description, control, children, className, style, classNames, }: SettingsRowProps): import("react").JSX.Element;
37
37
  export type DangerZoneProps = SettingsSectionProps;
38
- export declare function DangerZone({ title, icon, subtitle, info, actions, children, className, style, classNames, }: DangerZoneProps): import("react").JSX.Element;
38
+ export declare function DangerZone({ title, icon, subtitle, info, actions, children, className, style, classNames, ...rest }: DangerZoneProps): import("react").JSX.Element;
39
39
  //# sourceMappingURL=settings-section.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/dashboard/settings-section.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAYnE,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAC5C,eAAe,CAAC,mBAAmB,CAAC,GACpC,sBAAsB,GAAG;IACvB,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,0DAA0D;IAC1D,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,oBAAoB,+BAgBtB;AAED,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AAE1D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,eAAe,CAAC,eAAe,CAAC,GAAG;IACjC,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAEH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,gBAAgB,+BAiBlB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAElD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,+BAuBjB"}
1
+ {"version":3,"file":"settings-section.d.ts","sourceRoot":"","sources":["../../src/dashboard/settings-section.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAI7D,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAYnF,gF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} from "react/jsx-runtime";
2
2
  import { Card, Stack } from "@mantine/core";
3
3
  import { WidgetHeader } from "./widget-header.js";
4
4
  import { CtlSlot } from "../theme/index.js";
5
- import { alpha, VX } from "../tokens/index.js";
6
- import { cx } from "../common/props.js";
5
+ import { VX } from "../tokens/index.js";
6
+ import { cx, pickDataAttributes } from "../common/props.js";
7
7
  import classes from "./settings-section.module.css";
8
8
  const eyebrowStyle = {
9
9
  fontFamily: "var(--basalt-font-mono)",
@@ -22,9 +22,10 @@ function SettingsSection({
22
22
  children,
23
23
  className,
24
24
  style,
25
- classNames
25
+ classNames,
26
+ ...rest
26
27
  }) {
27
- return /* @__PURE__ */ jsxs(Card, { className: cx(classNames?.root, className), style, children: [
28
+ return /* @__PURE__ */ jsxs(Card, { ...pickDataAttributes(rest), className: cx(classNames?.root, className), style, children: [
28
29
  /* @__PURE__ */ jsx("div", { className: cx(classes.header, classNames?.header), children: /* @__PURE__ */ jsx(
29
30
  WidgetHeader,
30
31
  {
@@ -72,14 +73,17 @@ function DangerZone({
72
73
  children,
73
74
  className,
74
75
  style,
75
- classNames
76
+ classNames,
77
+ ...rest
76
78
  }) {
77
79
  return /* @__PURE__ */ jsxs(
78
80
  Card,
79
81
  {
80
- className: cx(classNames?.root, className),
82
+ ...pickDataAttributes(rest),
83
+ className: cx(classes.danger, classNames?.root, className),
81
84
  style: {
82
- boxShadow: `${VX.shadowCard}, 0 0 0 1px ${alpha(VX.status.bad, 0.25)}`,
85
+ // The card's depth plus ONE edge in the class's scheme-independent ring colour.
86
+ boxShadow: `${VX.shadowCard}, 0 0 0 1px var(--danger-ring)`,
83
87
  ...style
84
88
  },
85
89
  children: [
@@ -46,3 +46,9 @@
46
46
  gap: var(--vx-space-stack-xs);
47
47
  }
48
48
  }
49
+
50
+ /* DangerZone's ring colour: the status token mixed into the panel surface — one formula in both
51
+ * schemes, never an alpha over whatever sits behind it. The component layers it on `shadow-card`. */
52
+ .danger {
53
+ --danger-ring: color-mix(in srgb, var(--vx-status-bad) 40%, var(--vx-surface-panel));
54
+ }
@@ -7,5 +7,6 @@ declare const classes: {
7
7
  readonly rows: string
8
8
  readonly row: string
9
9
  readonly control: string
10
+ readonly danger: string
10
11
  }
11
12
  export default classes
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { WidgetHeaderDeltaProps, WidgetHeaderMetricProps, WidgetHeaderTitleProps } from './widget-header.js';
3
- import type { BasaltProps, SlotStylesProps, Tone } from '../common/props.js';
3
+ import type { BasaltProps, DataAttributes, SlotStylesProps, Tone } from '../common/props.js';
4
4
  import type { QueryStateLike } from './query-state.js';
5
5
  /**
6
6
  * The boxes `StatCard` paints, and the whole styling seam it offers (`common/props.ts`).
@@ -48,7 +48,7 @@ export type StatCardSparklineSize = {
48
48
  * `Section` and `ChartCard` still cut their own ad-hoc subsets; both should move onto these same
49
49
  * three slices.
50
50
  */
51
- export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Omit<WidgetHeaderTitleProps, 'subtitle'> & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
51
+ export type StatCardProps = BasaltProps & DataAttributes & SlotStylesProps<StatCardSlot> & Omit<WidgetHeaderTitleProps, 'subtitle'> & Omit<WidgetHeaderMetricProps, 'value'> & WidgetHeaderDeltaProps & {
52
52
  /** Pre-formatted hero figure (sans `kpi`, weight 500, lining, ink). Required here, unlike on
53
53
  * `WidgetHeader`: see the type's own doc. */
54
54
  value: string;
@@ -137,5 +137,5 @@ export type StatCardProps = BasaltProps & SlotStylesProps<StatCardSlot> & Omit<W
137
137
  * earned the verdict. */
138
138
  tone?: Tone;
139
139
  };
140
- export declare function StatCard({ title, icon, info, qualifier, subtitle, value, unit, breakdown, query, loading, emptyText, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, sparklinePlacement, actions, tone, className, style, classNames, }: StatCardProps): import("react").JSX.Element;
140
+ export declare function StatCard({ title, icon, info, qualifier, subtitle, value, unit, breakdown, query, loading, emptyText, delta, deltaPeriod, deltaPolarity, deltaFormat, deltaGlyph, sparkline, sparklinePlacement, actions, tone, className, style, classNames, ...rest }: StatCardProps): import("react").JSX.Element;
141
141
  //# sourceMappingURL=stat-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stat-card.d.ts","sourceRoot":"","sources":["../../src/dashboard/stat-card.tsx"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAUtC,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAIzE,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,eAAe,CAAA;AAIhE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AAEnE;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB,CAAA;AAaD;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAmCD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GACrC,eAAe,CAAC,YAAY,CAAC,GAC7B,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,GACxC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,GACtC,sBAAsB,GAAG;IACvB;iDAC6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,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CAAC,CAAA;IACpE;;qBAEiB;IACjB,kBAAkB,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;IACtC;oGACgG;IAChG,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;6BAIyB;IACzB,IAAI,CAAC,EAAE,IAAI,CAAA;CACZ,CAAA;AAuGH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,OAAe,EACf,SAAqC,EACrC,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,kBAA4B,EAC5B,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,EAAE,aAAa,+BA2Lf"}
@@ -11,12 +11,13 @@ import {
11
11
  rightSlotStyle
12
12
  } from "./stat-card-parts.js";
13
13
  import { DeltaBadge } from "./delta-badge.js";
14
- import { cx } from "../common/props.js";
14
+ import { cx, pickDataAttributes } from "../common/props.js";
15
15
  import { splitEmptyCopy } from "../common/empty-copy.js";
16
16
  import { EmptyState } from "./empty-state.js";
17
+ import { couldNotLoad, HostTitleContext } from "../common/could-not-load.js";
17
18
  import { ErrorState, QueryState, resolveQueryBranch } from "./query-state.js";
18
19
  import classes from "./stat-card.module.css";
19
- import { HOSTED, VisualSlotContext } from "./visual-slot.js";
20
+ import { HOSTED, HOSTED_COMPACT, VisualSlotContext } from "./visual-slot.js";
20
21
  const SPARKLINE_RIGHT_WIDTH = 72;
21
22
  const SPARKLINE_HEIGHT = 22;
22
23
  function useSlotWidth(active) {
@@ -42,7 +43,8 @@ function renderValueBody({
42
43
  resolved,
43
44
  figure,
44
45
  emptyText,
45
- hasDelta
46
+ hasDelta,
47
+ label
46
48
  }) {
47
49
  const copy = splitEmptyCopy(emptyText);
48
50
  if (resolved === void 0) return pending ? /* @__PURE__ */ jsx(ValueSkeleton, { delta: hasDelta }) : figure;
@@ -55,7 +57,7 @@ function renderValueBody({
55
57
  ErrorState,
56
58
  {
57
59
  error: resolved.error,
58
- title: "Could not load",
60
+ title: couldNotLoad(label),
59
61
  tier: "section",
60
62
  onRetry: () => void resolved.query.refetch(),
61
63
  retrying: resolved.query.fetchStatus === "fetching"
@@ -97,6 +99,16 @@ function renderFooterNode({
97
99
  if (!ready) return null;
98
100
  return /* @__PURE__ */ jsx("p", { className: classes.footer, title: subtitle, children: subtitle });
99
101
  }
102
+ const toneSlots = /* @__PURE__ */ new Map();
103
+ function slotFor(tone, compact) {
104
+ if (tone === void 0) return compact ? HOSTED_COMPACT : HOSTED;
105
+ const key = `${tone}:${compact}`;
106
+ const known = toneSlots.get(key);
107
+ if (known !== void 0) return known;
108
+ const slot = compact ? { tone, compact: true } : { tone };
109
+ toneSlots.set(key, slot);
110
+ return slot;
111
+ }
100
112
  function StatCard({
101
113
  title,
102
114
  icon,
@@ -120,7 +132,8 @@ function StatCard({
120
132
  tone,
121
133
  className,
122
134
  style,
123
- classNames
135
+ classNames,
136
+ ...rest
124
137
  }) {
125
138
  const isRender = typeof sparkline === "function";
126
139
  const bleeds = sparklinePlacement === "bleed";
@@ -142,7 +155,8 @@ function StatCard({
142
155
  },
143
156
  row.label
144
157
  )) });
145
- const breakdownContent = query === void 0 ? breakdownRows : /* @__PURE__ */ jsx(QueryState, { query, tier: "section", children: breakdownRows });
158
+ const breakdownContent = query === void 0 ? breakdownRows : /* @__PURE__ */ jsx(HostTitleContext, { value: title, children: /* @__PURE__ */ jsx(QueryState, { query, tier: "section", children: breakdownRows }) });
159
+ const hostSlot = slotFor(tone, !bleeds);
146
160
  const sparklineSlot = !ready || sparkline === void 0 ? null : /* @__PURE__ */ jsx(
147
161
  "div",
148
162
  {
@@ -152,7 +166,7 @@ function StatCard({
152
166
  classNames?.sparkline
153
167
  ),
154
168
  ...!bleeds && { style: rightSlotStyle(SPARKLINE_RIGHT_WIDTH, SPARKLINE_HEIGHT) },
155
- children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: tone === void 0 ? HOSTED : { tone }, children: isRender ? measured.width > 0 && sparkline(measured) : sparkline })
169
+ children: /* @__PURE__ */ jsx(VisualSlotContext.Provider, { value: hostSlot, children: isRender ? measured.width > 0 && sparkline(measured) : sparkline })
156
170
  }
157
171
  );
158
172
  const figure = /* @__PURE__ */ jsxs("div", { className: classes.valueRow, children: [
@@ -176,7 +190,8 @@ function StatCard({
176
190
  resolved,
177
191
  figure,
178
192
  emptyText,
179
- hasDelta: delta !== void 0
193
+ hasDelta: delta !== void 0,
194
+ label: title
180
195
  });
181
196
  const breakdownCount = breakdown?.length ?? 0;
182
197
  const hasBreakdown = breakdownCount > 0;
@@ -187,6 +202,7 @@ function StatCard({
187
202
  return /* @__PURE__ */ jsx(
188
203
  Card,
189
204
  {
205
+ ...pickDataAttributes(rest),
190
206
  className: cx(classNames?.root, className),
191
207
  style: {
192
208
  // The inset is the theme's (`card-inset.module.css`: the `cardInsetY`/`cardInsetX` tokens, 12/16
@@ -437,6 +437,17 @@
437
437
  padding-top: var(--basalt-spark-readout-reserve);
438
438
  }
439
439
 
440
+ /* A sparkline that states its window has a caption line under its plot: the slot grows by it rather than
441
+ * letting the caption run into the footer. */
442
+ .sparklineBleed:has([data-basalt-sparkline-caption]) {
443
+ height: auto;
444
+ }
445
+
446
+ /* The slot bleeds past the card's inset, the plot with it; the caption is text and takes the inset back. */
447
+ .sparklineBleed [data-basalt-sparkline-caption] {
448
+ padding-inline: var(--vx-space-card-inset-x, 1rem);
449
+ }
450
+
440
451
  /* A Meter in the visual slot is a block, not a chart: it sizes to its content and keeps the card's
441
452
  * inline inset instead of the sparkline's fixed 22px and side bleed. */
442
453
  .sparklineBleed:has(> [data-basalt-meter]) {