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.
- package/CHANGELOG.md +90 -0
- package/MIGRATING.md +238 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-mantine.md +1 -1
- package/agent/skills/basalt-app/SKILL.md +1 -1
- package/agent/skills/basalt-design/SKILL.md +1 -1
- package/agent/templates/DESIGN.md.tpl +1 -1
- package/configs/oxlint-plugin.js +33 -19
- package/configs/oxlint-plugin.test.ts +32 -2
- package/dist/charts/ChartCard.d.ts +28 -3
- package/dist/charts/ChartCard.d.ts.map +1 -1
- package/dist/charts/ChartCard.js +33 -11
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +13 -1
- package/dist/charts/Heatmap.js +1 -1
- package/dist/charts/Sparkline.d.ts +7 -1
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +137 -18
- package/dist/charts/box.d.ts +2 -0
- package/dist/charts/box.d.ts.map +1 -1
- package/dist/charts/box.js +2 -0
- package/dist/charts/chart-box.module.css +30 -0
- package/dist/charts/chart-box.module.css.d.ts +1 -0
- package/dist/charts/chart-card.module.css +47 -0
- package/dist/charts/chart-card.module.css.d.ts +7 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +35 -8
- package/dist/charts/host.d.ts.map +1 -1
- package/dist/charts/host.js +2 -1
- package/dist/charts/index.d.ts +1 -1
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/sparkline.module.css +59 -0
- package/dist/charts/sparkline.module.css.d.ts +13 -0
- package/dist/charts/state.d.ts.map +1 -1
- package/dist/charts/state.js +32 -4
- package/dist/charts/types.d.ts +6 -0
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +18 -26
- package/dist/content/callout.d.ts +1 -1
- package/dist/content/callout.d.ts.map +1 -1
- package/dist/content/callout.js +10 -1
- package/dist/content/callout.module.css +15 -3
- package/dist/content/callout.module.css.d.ts +1 -0
- package/dist/controls/sync-button.d.ts +3 -0
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/dashboard/bar-list.d.ts +15 -4
- package/dist/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +56 -19
- package/dist/dashboard/bar-list.module.css +110 -17
- package/dist/dashboard/bar-list.module.css.d.ts +2 -0
- package/dist/dashboard/delta-badge.d.ts +8 -3
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +9 -2
- package/dist/dashboard/index.d.ts +2 -0
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/meter-model.d.ts +68 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +65 -4
- package/dist/dashboard/meter-parts.d.ts +5 -1
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +234 -60
- package/dist/dashboard/meter.d.ts +38 -6
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.js +4 -1
- package/dist/dashboard/meter.module.css +209 -13
- package/dist/dashboard/meter.module.css.d.ts +16 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +14 -9
- package/dist/dashboard/settings-section.d.ts.map +1 -1
- package/dist/dashboard/settings-section.js +14 -25
- package/dist/dashboard/stat-card-parts.d.ts +3 -1
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
- package/dist/dashboard/stat-card-parts.js +18 -3
- package/dist/dashboard/stat-card.d.ts +7 -6
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +51 -83
- package/dist/dashboard/stat-card.module.css +42 -14
- package/dist/dashboard/stat-group.d.ts +11 -2
- package/dist/dashboard/stat-group.d.ts.map +1 -1
- package/dist/dashboard/stat-group.js +9 -7
- package/dist/dashboard/stat-strip.d.ts +50 -0
- package/dist/dashboard/stat-strip.d.ts.map +1 -0
- package/dist/dashboard/stat-strip.js +85 -0
- package/dist/dashboard/stat-strip.module.css +208 -0
- package/dist/dashboard/stat-strip.module.css.d.ts +28 -0
- package/dist/dashboard/widget-header.d.ts +3 -3
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +2 -1
- package/dist/dashboard/widget-header.module.css +38 -7
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +4 -3
- package/dist/format/shared.d.ts +6 -0
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +6 -2
- package/dist/guard/index.d.ts +1 -1
- package/dist/guard/index.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/styles.css +6 -0
- package/dist/theme/card-inset.module.css +76 -0
- package/dist/theme/card-inset.module.css.d.ts +9 -0
- package/dist/theme/chrome-vars.d.ts +29 -17
- package/dist/theme/chrome-vars.d.ts.map +1 -1
- package/dist/theme/chrome-vars.js +18 -8
- package/dist/theme/controls.module.css +3 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +32 -5
- package/dist/theme/nav-link.module.css +8 -10
- package/dist/theme/status-dot.d.ts +7 -0
- package/dist/theme/status-dot.d.ts.map +1 -0
- package/dist/theme/status-dot.js +18 -0
- package/dist/theme/status-dot.module.css +9 -0
- package/dist/theme/status-dot.module.css.d.ts +8 -0
- package/dist/theme/status-verdict.d.ts +10 -0
- package/dist/theme/status-verdict.d.ts.map +1 -0
- package/dist/theme/status-verdict.js +14 -0
- package/dist/theme/status-verdict.module.css +25 -0
- package/dist/theme/status-verdict.module.css.d.ts +9 -0
- package/llms.txt +30 -6
- package/package.json +1 -1
- package/src/charts/ChartCard.tsx +70 -4
- package/src/charts/Donut.tsx +9 -1
- package/src/charts/Heatmap.tsx +1 -1
- package/src/charts/Sparkline.tsx +180 -18
- package/src/charts/box.tsx +2 -0
- package/src/charts/chart-box.module.css +30 -0
- package/src/charts/chart-box.module.css.d.ts +1 -0
- package/src/charts/chart-card.module.css +47 -0
- package/src/charts/chart-card.module.css.d.ts +7 -0
- package/src/charts/compile.ts +42 -9
- package/src/charts/host.tsx +6 -3
- package/src/charts/index.ts +1 -1
- package/src/charts/sparkline.module.css +59 -0
- package/src/charts/sparkline.module.css.d.ts +13 -0
- package/src/charts/state.tsx +44 -4
- package/src/charts/types.ts +6 -0
- package/src/commands/notifications/center.tsx +29 -32
- package/src/content/callout.module.css +15 -3
- package/src/content/callout.module.css.d.ts +1 -0
- package/src/content/callout.tsx +15 -2
- package/src/controls/sync-button.tsx +3 -0
- package/src/dashboard/bar-list.module.css +110 -17
- package/src/dashboard/bar-list.module.css.d.ts +2 -0
- package/src/dashboard/bar-list.tsx +102 -21
- package/src/dashboard/delta-badge.tsx +21 -5
- package/src/dashboard/index.ts +2 -0
- package/src/dashboard/meter-model.ts +132 -4
- package/src/dashboard/meter-parts.tsx +305 -25
- package/src/dashboard/meter.module.css +209 -13
- package/src/dashboard/meter.module.css.d.ts +16 -0
- package/src/dashboard/meter.tsx +42 -7
- package/src/dashboard/query-state.tsx +28 -19
- package/src/dashboard/settings-section.tsx +1 -8
- package/src/dashboard/stat-card-parts.tsx +22 -2
- package/src/dashboard/stat-card.module.css +42 -14
- package/src/dashboard/stat-card.tsx +23 -60
- package/src/dashboard/stat-group.tsx +19 -8
- package/src/dashboard/stat-strip.module.css +208 -0
- package/src/dashboard/stat-strip.module.css.d.ts +28 -0
- package/src/dashboard/stat-strip.tsx +183 -0
- package/src/dashboard/widget-header.module.css +38 -7
- package/src/dashboard/widget-header.tsx +7 -4
- package/src/format/date.ts +6 -3
- package/src/format/shared.ts +11 -2
- package/src/guard/index.ts +1 -1
- package/src/index.ts +7 -0
- package/src/styles.css +6 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +242 -26
- package/src/theme/card-inset.module.css +76 -0
- package/src/theme/card-inset.module.css.d.ts +9 -0
- package/src/theme/chrome-vars.ts +48 -23
- package/src/theme/controls.module.css +3 -0
- package/src/theme/index.ts +40 -6
- package/src/theme/nav-link.module.css +8 -10
- package/src/theme/status-dot.module.css +9 -0
- package/src/theme/status-dot.module.css.d.ts +8 -0
- package/src/theme/status-dot.tsx +31 -0
- package/src/theme/status-verdict.module.css +25 -0
- package/src/theme/status-verdict.module.css.d.ts +9 -0
- package/src/theme/status-verdict.tsx +32 -0
package/src/theme/index.ts
CHANGED
|
@@ -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,
|
|
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`
|
|
318
|
-
// (the resolver is always handed `color || primaryColor`, so it cannot
|
|
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 =
|
|
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 =
|
|
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 =
|
|
3
|
-
* SELECTED rather than merely hovered (docs/DESIGN-SPEC.md §5).
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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,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
|
+
}
|