basalt-ui 2.18.0 → 2.20.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 (183) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/MIGRATING.md +238 -12
  3. package/agent/agents/basalt-design-reviewer.md +2 -2
  4. package/agent/rules/basalt-charts.md +1 -1
  5. package/agent/rules/basalt-mantine.md +1 -1
  6. package/agent/skills/basalt-app/SKILL.md +1 -1
  7. package/agent/skills/basalt-design/SKILL.md +1 -1
  8. package/agent/templates/DESIGN.md.tpl +1 -1
  9. package/configs/oxlint-plugin.js +33 -19
  10. package/configs/oxlint-plugin.test.ts +32 -2
  11. package/dist/charts/ChartCard.d.ts +28 -3
  12. package/dist/charts/ChartCard.d.ts.map +1 -1
  13. package/dist/charts/ChartCard.js +33 -11
  14. package/dist/charts/Donut.d.ts.map +1 -1
  15. package/dist/charts/Donut.js +13 -1
  16. package/dist/charts/Heatmap.js +1 -1
  17. package/dist/charts/Sparkline.d.ts +7 -1
  18. package/dist/charts/Sparkline.d.ts.map +1 -1
  19. package/dist/charts/Sparkline.js +137 -18
  20. package/dist/charts/box.d.ts +2 -0
  21. package/dist/charts/box.d.ts.map +1 -1
  22. package/dist/charts/box.js +2 -0
  23. package/dist/charts/chart-box.module.css +30 -0
  24. package/dist/charts/chart-box.module.css.d.ts +1 -0
  25. package/dist/charts/chart-card.module.css +47 -0
  26. package/dist/charts/chart-card.module.css.d.ts +7 -0
  27. package/dist/charts/compile.d.ts.map +1 -1
  28. package/dist/charts/compile.js +35 -8
  29. package/dist/charts/host.d.ts.map +1 -1
  30. package/dist/charts/host.js +2 -1
  31. package/dist/charts/index.d.ts +1 -1
  32. package/dist/charts/index.d.ts.map +1 -1
  33. package/dist/charts/sparkline.module.css +59 -0
  34. package/dist/charts/sparkline.module.css.d.ts +13 -0
  35. package/dist/charts/state.d.ts.map +1 -1
  36. package/dist/charts/state.js +32 -4
  37. package/dist/charts/types.d.ts +6 -0
  38. package/dist/charts/types.d.ts.map +1 -1
  39. package/dist/commands/notifications/center.d.ts.map +1 -1
  40. package/dist/commands/notifications/center.js +18 -26
  41. package/dist/content/callout.d.ts +1 -1
  42. package/dist/content/callout.d.ts.map +1 -1
  43. package/dist/content/callout.js +10 -1
  44. package/dist/content/callout.module.css +15 -3
  45. package/dist/content/callout.module.css.d.ts +1 -0
  46. package/dist/controls/sync-button.d.ts +3 -0
  47. package/dist/controls/sync-button.d.ts.map +1 -1
  48. package/dist/dashboard/bar-list.d.ts +15 -4
  49. package/dist/dashboard/bar-list.d.ts.map +1 -1
  50. package/dist/dashboard/bar-list.js +56 -19
  51. package/dist/dashboard/bar-list.module.css +110 -17
  52. package/dist/dashboard/bar-list.module.css.d.ts +2 -0
  53. package/dist/dashboard/delta-badge.d.ts +8 -3
  54. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  55. package/dist/dashboard/delta-badge.js +9 -2
  56. package/dist/dashboard/index.d.ts +2 -0
  57. package/dist/dashboard/index.d.ts.map +1 -1
  58. package/dist/dashboard/meter-model.d.ts +68 -1
  59. package/dist/dashboard/meter-model.d.ts.map +1 -1
  60. package/dist/dashboard/meter-model.js +65 -4
  61. package/dist/dashboard/meter-parts.d.ts +5 -1
  62. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  63. package/dist/dashboard/meter-parts.js +234 -60
  64. package/dist/dashboard/meter.d.ts +38 -6
  65. package/dist/dashboard/meter.d.ts.map +1 -1
  66. package/dist/dashboard/meter.js +4 -1
  67. package/dist/dashboard/meter.module.css +209 -13
  68. package/dist/dashboard/meter.module.css.d.ts +16 -0
  69. package/dist/dashboard/query-state.d.ts.map +1 -1
  70. package/dist/dashboard/query-state.js +14 -9
  71. package/dist/dashboard/settings-section.d.ts.map +1 -1
  72. package/dist/dashboard/settings-section.js +14 -25
  73. package/dist/dashboard/stat-card-parts.d.ts +3 -1
  74. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  75. package/dist/dashboard/stat-card-parts.js +18 -3
  76. package/dist/dashboard/stat-card.d.ts +7 -6
  77. package/dist/dashboard/stat-card.d.ts.map +1 -1
  78. package/dist/dashboard/stat-card.js +51 -83
  79. package/dist/dashboard/stat-card.module.css +42 -14
  80. package/dist/dashboard/stat-group.d.ts +11 -2
  81. package/dist/dashboard/stat-group.d.ts.map +1 -1
  82. package/dist/dashboard/stat-group.js +9 -7
  83. package/dist/dashboard/stat-strip.d.ts +50 -0
  84. package/dist/dashboard/stat-strip.d.ts.map +1 -0
  85. package/dist/dashboard/stat-strip.js +85 -0
  86. package/dist/dashboard/stat-strip.module.css +208 -0
  87. package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
  88. package/dist/dashboard/widget-header.d.ts +3 -3
  89. package/dist/dashboard/widget-header.d.ts.map +1 -1
  90. package/dist/dashboard/widget-header.js +2 -1
  91. package/dist/dashboard/widget-header.module.css +38 -7
  92. package/dist/format/date.d.ts.map +1 -1
  93. package/dist/format/date.js +4 -3
  94. package/dist/format/shared.d.ts +6 -0
  95. package/dist/format/shared.d.ts.map +1 -1
  96. package/dist/format/shared.js +6 -2
  97. package/dist/guard/index.d.ts +1 -1
  98. package/dist/guard/index.js +1 -1
  99. package/dist/index.d.ts +3 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +4 -0
  102. package/dist/styles.css +6 -0
  103. package/dist/theme/card-inset.module.css +76 -0
  104. package/dist/theme/card-inset.module.css.d.ts +9 -0
  105. package/dist/theme/chrome-vars.d.ts +29 -17
  106. package/dist/theme/chrome-vars.d.ts.map +1 -1
  107. package/dist/theme/chrome-vars.js +18 -8
  108. package/dist/theme/controls.module.css +3 -0
  109. package/dist/theme/index.d.ts.map +1 -1
  110. package/dist/theme/index.js +32 -5
  111. package/dist/theme/nav-link.module.css +8 -10
  112. package/dist/theme/status-dot.d.ts +7 -0
  113. package/dist/theme/status-dot.d.ts.map +1 -0
  114. package/dist/theme/status-dot.js +18 -0
  115. package/dist/theme/status-dot.module.css +9 -0
  116. package/dist/theme/status-dot.module.css.d.ts +8 -0
  117. package/dist/theme/status-verdict.d.ts +10 -0
  118. package/dist/theme/status-verdict.d.ts.map +1 -0
  119. package/dist/theme/status-verdict.js +14 -0
  120. package/dist/theme/status-verdict.module.css +25 -0
  121. package/dist/theme/status-verdict.module.css.d.ts +9 -0
  122. package/llms.txt +30 -6
  123. package/package.json +1 -1
  124. package/src/charts/ChartCard.tsx +70 -4
  125. package/src/charts/Donut.tsx +9 -1
  126. package/src/charts/Heatmap.tsx +1 -1
  127. package/src/charts/Sparkline.tsx +180 -18
  128. package/src/charts/box.tsx +2 -0
  129. package/src/charts/chart-box.module.css +30 -0
  130. package/src/charts/chart-box.module.css.d.ts +1 -0
  131. package/src/charts/chart-card.module.css +47 -0
  132. package/src/charts/chart-card.module.css.d.ts +7 -0
  133. package/src/charts/compile.ts +42 -9
  134. package/src/charts/host.tsx +6 -3
  135. package/src/charts/index.ts +1 -1
  136. package/src/charts/sparkline.module.css +59 -0
  137. package/src/charts/sparkline.module.css.d.ts +13 -0
  138. package/src/charts/state.tsx +44 -4
  139. package/src/charts/types.ts +6 -0
  140. package/src/commands/notifications/center.tsx +29 -32
  141. package/src/content/callout.module.css +15 -3
  142. package/src/content/callout.module.css.d.ts +1 -0
  143. package/src/content/callout.tsx +15 -2
  144. package/src/controls/sync-button.tsx +3 -0
  145. package/src/dashboard/bar-list.module.css +110 -17
  146. package/src/dashboard/bar-list.module.css.d.ts +2 -0
  147. package/src/dashboard/bar-list.tsx +102 -21
  148. package/src/dashboard/delta-badge.tsx +21 -5
  149. package/src/dashboard/index.ts +2 -0
  150. package/src/dashboard/meter-model.ts +132 -4
  151. package/src/dashboard/meter-parts.tsx +305 -25
  152. package/src/dashboard/meter.module.css +209 -13
  153. package/src/dashboard/meter.module.css.d.ts +16 -0
  154. package/src/dashboard/meter.tsx +42 -7
  155. package/src/dashboard/query-state.tsx +28 -19
  156. package/src/dashboard/settings-section.tsx +1 -8
  157. package/src/dashboard/stat-card-parts.tsx +22 -2
  158. package/src/dashboard/stat-card.module.css +42 -14
  159. package/src/dashboard/stat-card.tsx +23 -60
  160. package/src/dashboard/stat-group.tsx +19 -8
  161. package/src/dashboard/stat-strip.module.css +208 -0
  162. package/src/dashboard/stat-strip.module.css.d.ts +28 -0
  163. package/src/dashboard/stat-strip.tsx +183 -0
  164. package/src/dashboard/widget-header.module.css +38 -7
  165. package/src/dashboard/widget-header.tsx +7 -4
  166. package/src/format/date.ts +6 -3
  167. package/src/format/shared.ts +11 -2
  168. package/src/guard/index.ts +1 -1
  169. package/src/index.ts +7 -0
  170. package/src/styles.css +6 -0
  171. package/src/theme/__snapshots__/plain-theme.test.ts.snap +242 -26
  172. package/src/theme/card-inset.module.css +76 -0
  173. package/src/theme/card-inset.module.css.d.ts +9 -0
  174. package/src/theme/chrome-vars.ts +48 -23
  175. package/src/theme/controls.module.css +3 -0
  176. package/src/theme/index.ts +40 -6
  177. package/src/theme/nav-link.module.css +8 -10
  178. package/src/theme/status-dot.module.css +9 -0
  179. package/src/theme/status-dot.module.css.d.ts +8 -0
  180. package/src/theme/status-dot.tsx +31 -0
  181. package/src/theme/status-verdict.module.css +25 -0
  182. package/src/theme/status-verdict.module.css.d.ts +9 -0
  183. package/src/theme/status-verdict.tsx +32 -0
@@ -86,7 +86,8 @@ import { CTL_HEIGHT_VARS } from '../tokens/ctl-vars'
86
86
  import type { CtlHeightVar } from '../tokens/ctl-vars'
87
87
  import { SIZE_CLASS_BREAKPOINTS } from '../tokens/size-classes'
88
88
  import type { BasaltFontsConfig } from '../tokens/core'
89
- import { onColor, onColorFor, subtleInkVars, tabsVars } from './chrome-vars'
89
+ import { onColor, onColorFor, inkVars, tabsVars } from './chrome-vars'
90
+ import cardInsetClasses from './card-inset.module.css'
90
91
  import controlsClasses from './controls.module.css'
91
92
  import floatingClasses from './floating.module.css'
92
93
  import navLinkClasses from './nav-link.module.css'
@@ -314,9 +315,9 @@ const basaltVariantColorResolver: VariantColorsResolver = (input) => {
314
315
  return autoContrast ? { ...resolved, color: on } : resolved
315
316
  }
316
317
 
317
- // `subtle` stays Mantine's: Button and ActionIcon get their ink label + hover in `subtleInkVars`
318
- // (the resolver is always handed `color || primaryColor`, so it cannot tell "unnamed" from an
319
- // explicit primary colour — only the component props can).
318
+ // `subtle`, `light` and `outline` stay Mantine's: a Button or ActionIcon that names no colour gets
319
+ // ink for them in `inkVars` (the resolver is always handed `color || primaryColor`, so it cannot
320
+ // tell "unnamed" from an explicit primary colour — only the component props can).
320
321
  // `outline`: the tone's own text colour, pulled toward ink so the label keeps its hue at AA
321
322
  // (grey outline badges measured 3.9:1 on the light page).
322
323
  if (input.variant === 'outline') {
@@ -480,7 +481,11 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
480
481
  // • radius → `--vx-radius-card` (10px).
481
482
  // This is the single source the user's "strict surface across components" demands; the
482
483
  // `raw-surface` guard then stops consumers re-overriding any of it inline.
484
+ // • inset → `card-inset.module.css`: the density-scaled 12/16 tokens, on Paper too (Mantine
485
+ // gives a bare Paper 0 and a bare Card 16); `variant="flush"` zeroes it and `Card.Section`
486
+ // cancels exactly it. A Card `padding` prop still wins (see the CSS).
483
487
  Card: ext<typeof Card>({
488
+ classNames: { root: cardInsetClasses.inset, section: cardInsetClasses.section },
484
489
  styles: {
485
490
  root: {
486
491
  backgroundColor: 'var(--vx-surface-panel)',
@@ -490,6 +495,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
490
495
  },
491
496
  }),
492
497
  Paper: ext<typeof Paper>({
498
+ classNames: { root: cardInsetClasses.inset },
493
499
  styles: {
494
500
  root: {
495
501
  backgroundColor: 'var(--vx-surface-panel)',
@@ -676,15 +682,18 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
676
682
  Button: ext<typeof Button>({
677
683
  classNames: { root: controlsClasses.buttonRoot },
678
684
  vars: (_theme, props) => {
679
- const ink = subtleInkVars(props)
685
+ const ink = inkVars(props)
680
686
  return {
681
687
  root: {
682
688
  '--button-height':
683
689
  props.size === 'md'
684
690
  ? 'calc(var(--vx-space-control-height) * var(--mantine-scale))'
685
691
  : undefined,
692
+ '--button-padding-x': buttonPaddingX(props.size),
686
693
  '--button-color': ink.color,
687
694
  '--button-hover': ink.hover,
695
+ '--button-bg': ink.bg,
696
+ '--button-bd': ink.border,
688
697
  },
689
698
  }
690
699
  },
@@ -692,7 +701,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
692
701
  ActionIcon: ext<typeof ActionIcon>({
693
702
  classNames: { root: controlsClasses.actionIconRoot },
694
703
  vars: (_theme, props) => {
695
- const ink = subtleInkVars(props)
704
+ const ink = inkVars(props)
696
705
  return {
697
706
  root: {
698
707
  '--ai-size':
@@ -701,6 +710,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
701
710
  : undefined,
702
711
  '--ai-color': ink.color,
703
712
  '--ai-hover': ink.hover,
713
+ '--ai-bg': ink.bg,
714
+ '--ai-bd': ink.border,
704
715
  },
705
716
  }
706
717
  },
@@ -1221,6 +1232,29 @@ function familyBridge(data: PaletteData): Record<string, string> {
1221
1232
  return vars
1222
1233
  }
1223
1234
 
1235
+ /**
1236
+ * Button inline padding per Mantine size, on the density-scaled `--vx-space-stack-*` steps (4/8/12/16/24
1237
+ * at level 0) instead of Mantine's 14/18/22/26/32 and 7/8/10/12/14 — the off-scale values argo's
1238
+ * decision cards showed (SPEC § 6.12). Heights are untouched. `ctl` (and any custom size) stays
1239
+ * undefined so its own `--button-padding-x-ctl` applies; an unsized Button is Mantine's `sm`.
1240
+ */
1241
+ const BUTTON_PADDING_X: Record<string, string> = {
1242
+ xs: 'var(--vx-space-stack-md)',
1243
+ sm: 'var(--vx-space-stack-lg)',
1244
+ md: 'var(--vx-space-stack-lg) + var(--vx-space-stack-xs)',
1245
+ lg: 'var(--vx-space-stack-xl)',
1246
+ xl: 'var(--vx-space-stack-xl) + var(--vx-space-stack-sm)',
1247
+ 'compact-xs': 'var(--vx-space-stack-sm)',
1248
+ 'compact-sm': 'var(--vx-space-stack-sm)',
1249
+ 'compact-md': 'var(--vx-space-stack-md)',
1250
+ 'compact-lg': 'var(--vx-space-stack-md)',
1251
+ 'compact-xl': 'var(--vx-space-stack-lg)',
1252
+ }
1253
+ function buttonPaddingX(size: unknown): string | undefined {
1254
+ const steps = BUTTON_PADDING_X[typeof size === 'string' ? size : 'sm']
1255
+ return steps === undefined ? undefined : `calc((${steps}) * var(--mantine-scale))`
1256
+ }
1257
+
1224
1258
  /**
1225
1259
  * The `ctl` tier's horizontal inset — one number for a Button, a `FilterPill`, a SegmentedControl
1226
1260
  * segment and a `kind: 'custom'` Badge, so a home's row reads as one control family
@@ -1,9 +1,8 @@
1
1
  /*
2
- * Active nav row = an ACCENT-tinted fill plus heavier weight, so the row reads unambiguously as
3
- * SELECTED rather than merely hovered (docs/DESIGN-SPEC.md §5). The fill was previously the ink
4
- * tint `--nl-bg` carries (theme/index.ts) at 9% — visually indistinguishable from the 6% ink hover
5
- * tint on a dark surface, which is what let a hovered row read as a second active item. NO depth:
6
- * an active row is a SELECTED ROW, not a raised control.
2
+ * Active nav row = a NEUTRAL ink fill (10%, twice the 5% inactive hover) plus heavier weight, so the
3
+ * row reads as SELECTED rather than merely hovered (docs/DESIGN-SPEC.md §5). Never the accent
4
+ * (DESIGN-CORE § Accent discipline, SPEC § 6.12): the accent stays on the focus ring, the filled
5
+ * primary and the active ICON below. NO depth: an active row is a SELECTED ROW, not a raised control.
7
6
  *
8
7
  * `[data-active]` is the ONLY style hook here — `use-nav.ts` already resolves exactly one winner
9
8
  * per route and stamps `data-active` on it, so keying these selectors on `aria-current="page"` too
@@ -17,7 +16,7 @@
17
16
  * there throws a React warning), so the state selectors live here.
18
17
  */
19
18
  .root[data-active] {
20
- background-color: color-mix(in srgb, var(--vx-accent) 12%, transparent);
19
+ background-color: color-mix(in srgb, var(--vx-ink) 10%, transparent);
21
20
  font-weight: 600;
22
21
  }
23
22
 
@@ -32,7 +31,7 @@
32
31
  * still reads as feedback rather than as a flat, unresponsive selection. */
33
32
  @media (hover: hover) {
34
33
  .root[data-active]:hover {
35
- background-color: color-mix(in srgb, var(--vx-accent) 16%, transparent);
34
+ background-color: color-mix(in srgb, var(--vx-ink) 14%, transparent);
36
35
  }
37
36
  }
38
37
 
@@ -61,10 +60,9 @@
61
60
 
62
61
  /*
63
62
  * Inactive hover — the ink-5% ghost tint + ink text/icon (docs/DESIGN-SPEC.md §5; dropped from 6%
64
- * so it reads clearly below the active row's 12% accent fill instead of nearly matching its old 9%
65
- * ink fill). Lives here (not only in the shell module) so a consumer's `SidebarItem.Anchor` path
63
+ * so it reads clearly below the active row's 10% ink fill). Lives here (not only in the shell module) so a consumer's `SidebarItem.Anchor` path
66
64
  * gets the same hover; Mantine's own hover fill uses `:where(scheme) .m_*:hover` (gray-0/dark-6),
67
- * which this outranks on specificity. Active rows keep their accent fill above, untouched here.
65
+ * which this outranks on specificity. Active rows keep their ink fill above, untouched here.
68
66
  */
69
67
  @media (hover: hover) {
70
68
  .root:not([data-active]):hover {
@@ -0,0 +1,9 @@
1
+ /* The one status mark: a 6px round dot (a § 5 step). The colour arrives as `--basalt-status-dot`. */
2
+ .dot {
3
+ display: inline-block;
4
+ flex: none;
5
+ width: 6px;
6
+ height: 6px;
7
+ border-radius: 50%;
8
+ background: var(--basalt-status-dot);
9
+ }
@@ -0,0 +1,8 @@
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 dot: string
7
+ }
8
+ export default classes
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `StatusDot` — the one status mark: a 6px round dot that carries a colour and nothing else. It is
3
+ * decoration (`aria-hidden`); the meaning always travels as a word beside it (`StatusVerdict`), so a
4
+ * verdict is never colour alone. Exported from the root.
5
+ *
6
+ * @example
7
+ * <StatusDot color={VX.status.ok} />
8
+ */
9
+ import type { CSSProperties } from 'react'
10
+ import { cx } from '../common/props'
11
+ import type { BasaltProps } from '../common/props'
12
+ import classes from './status-dot.module.css'
13
+
14
+ export type StatusDotProps = BasaltProps & {
15
+ /** Any CSS colour; callers pass a `VX.status.*` token so it re-resolves per scheme. */
16
+ color: string
17
+ }
18
+
19
+ type DotStyle = CSSProperties & { '--basalt-status-dot': string }
20
+
21
+ export function StatusDot({ color, className, style }: StatusDotProps) {
22
+ const merged: DotStyle = { ...style, '--basalt-status-dot': color }
23
+ return (
24
+ <span
25
+ className={cx(classes.dot, className)}
26
+ data-basalt-status-dot=""
27
+ aria-hidden="true"
28
+ style={merged}
29
+ />
30
+ )
31
+ }
@@ -0,0 +1,25 @@
1
+ /* A status dot plus its word: the dot carries the colour, the word is muted ink. `flex: none` keeps
2
+ * it whole when a neighbouring caption or title truncates. The word is the proportional sans, at the
3
+ * micro size: it is a sentence fragment ("Blocked · Waits on the API change"), not an UPPERCASE
4
+ * caption, so it never takes the mono. */
5
+ .verdict {
6
+ display: inline-flex;
7
+ flex: none;
8
+ align-items: center;
9
+ gap: 5px;
10
+ font-family: var(--basalt-font-sans);
11
+ font-size: var(--vx-text-micro);
12
+ color: var(--vx-muted);
13
+ }
14
+
15
+ /* Visually hidden, still read by assistive tech. */
16
+ .hidden {
17
+ position: absolute;
18
+ width: 1px;
19
+ height: 1px;
20
+ margin: -1px;
21
+ padding: 0;
22
+ overflow: hidden;
23
+ clip-path: inset(50%);
24
+ white-space: nowrap;
25
+ }
@@ -0,0 +1,9 @@
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 verdict: string
7
+ readonly hidden: string
8
+ }
9
+ export default classes
@@ -0,0 +1,32 @@
1
+ /**
2
+ * `StatusVerdict` — a `StatusDot` plus its word in muted ink. With `phrase`, the visible word is
3
+ * hidden from assistive tech and the full phrase is read instead, so a screen reader never hears a
4
+ * bare "Over". Exported from the root; `StatCard` and the notification centre compose it.
5
+ *
6
+ * @example
7
+ * <StatusVerdict color={VX.status.error} word="Over" phrase="Over budget" />
8
+ */
9
+ import { cx } from '../common/props'
10
+ import type { BasaltProps } from '../common/props'
11
+ import { StatusDot } from './status-dot'
12
+ import classes from './status-verdict.module.css'
13
+
14
+ export type StatusVerdictProps = BasaltProps & {
15
+ color: string
16
+ /** The short visible word ("Over", "Error"). */
17
+ word: string
18
+ /** A longer phrase for assistive tech, read in place of the word. */
19
+ phrase?: string
20
+ }
21
+
22
+ export function StatusVerdict({ color, word, phrase, className, style }: StatusVerdictProps) {
23
+ return (
24
+ <span className={cx(classes.verdict, className)} {...(style !== undefined && { style })}>
25
+ <StatusDot color={color} />
26
+ <span data-verdict-word="" {...(phrase !== undefined && { 'aria-hidden': true })}>
27
+ {word}
28
+ </span>
29
+ {phrase !== undefined && <span className={classes.hidden}>{phrase}</span>}
30
+ </span>
31
+ )
32
+ }