basalt-ui 2.18.0 → 2.19.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 +40 -0
- package/MIGRATING.md +76 -12
- package/agent/agents/basalt-design-reviewer.md +2 -2
- 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/dashboard/bar-list.d.ts.map +1 -1
- package/dist/dashboard/bar-list.js +31 -18
- package/dist/dashboard/bar-list.module.css +33 -15
- package/dist/dashboard/bar-list.module.css.d.ts +1 -0
- package/dist/dashboard/meter-model.d.ts +49 -1
- package/dist/dashboard/meter-model.d.ts.map +1 -1
- package/dist/dashboard/meter-model.js +47 -3
- package/dist/dashboard/meter-parts.d.ts.map +1 -1
- package/dist/dashboard/meter-parts.js +143 -9
- package/dist/dashboard/meter.d.ts +16 -5
- package/dist/dashboard/meter.d.ts.map +1 -1
- package/dist/dashboard/meter.module.css +127 -9
- package/dist/dashboard/meter.module.css.d.ts +11 -0
- 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 +6 -5
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +48 -77
- package/dist/dashboard/stat-card.module.css +27 -7
- 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 +28 -1
- 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/index.d.ts.map +1 -1
- package/dist/theme/index.js +9 -5
- package/dist/theme/status-dot.d.ts +6 -0
- package/dist/theme/status-dot.d.ts.map +1 -0
- package/dist/theme/status-dot.js +9 -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 +9 -0
- package/dist/theme/status-verdict.d.ts.map +1 -0
- package/dist/theme/status-verdict.js +13 -0
- package/dist/theme/status-verdict.module.css +23 -0
- package/dist/theme/status-verdict.module.css.d.ts +9 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
- 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/dashboard/bar-list.module.css +33 -15
- package/src/dashboard/bar-list.module.css.d.ts +1 -0
- package/src/dashboard/bar-list.tsx +29 -16
- package/src/dashboard/meter-model.ts +97 -4
- package/src/dashboard/meter-parts.tsx +195 -11
- package/src/dashboard/meter.module.css +127 -9
- package/src/dashboard/meter.module.css.d.ts +11 -0
- package/src/dashboard/meter.tsx +16 -5
- package/src/dashboard/stat-card-parts.tsx +22 -2
- package/src/dashboard/stat-card.module.css +27 -7
- package/src/dashboard/stat-card.tsx +18 -52
- package/src/dashboard/widget-header.module.css +28 -1
- package/src/dashboard/widget-header.tsx +4 -1
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +88 -16
- package/src/theme/chrome-vars.ts +48 -23
- package/src/theme/index.ts +10 -6
- 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 +19 -0
- package/src/theme/status-verdict.module.css +23 -0
- package/src/theme/status-verdict.module.css.d.ts +9 -0
- package/src/theme/status-verdict.tsx +27 -0
|
@@ -31,15 +31,14 @@
|
|
|
31
31
|
* (`emptyText`). `loading` shows the same skeleton with no query at all. The caption row stays put
|
|
32
32
|
* in every branch.
|
|
33
33
|
*
|
|
34
|
-
* `tone`
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* the meaning of omission: it exists for the threshold where the calm number IS the finding (zero
|
|
34
|
+
* `tone` states a threshold verdict as a status dot plus a short word on the caption row (`OK`,
|
|
35
|
+
* `Watch`, `Over`), with the full phrase for assistive tech. The dot carries the colour and the word
|
|
36
|
+
* the meaning, so the verdict never rides on colour alone. It exists because `value` is typed
|
|
37
|
+
* `string`: without it, a card whose number has crossed a threshold reads exactly as calm as one
|
|
38
|
+
* that hasn't. A coloured edge stripe is not the form — it reads as generic dashboard decoration
|
|
39
|
+
* (Wave 34). `undefined` renders nothing at all — absence of a reading is neither a good one nor a
|
|
40
|
+
* bad one, and must never be tinted. `'good'` is a deliberate positive verdict, never the meaning
|
|
41
|
+
* of omission: it exists for the threshold where the calm number IS the finding (zero
|
|
43
42
|
* downtime over the window), and a card that has measured nothing must not be able to reach green by
|
|
44
43
|
* leaving the prop off.
|
|
45
44
|
*
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
* <StatCard title="Active users" value="—" loading sparkline={() => null} />
|
|
75
74
|
*
|
|
76
75
|
* @example
|
|
77
|
-
* // Past a threshold —
|
|
76
|
+
* // Past a threshold — a status dot and the word "Over" on the caption row, value untouched.
|
|
78
77
|
* <StatCard title="Downtime" value="29 min" tone="bad" />
|
|
79
78
|
*
|
|
80
79
|
* @example
|
|
@@ -90,7 +89,7 @@
|
|
|
90
89
|
* tone={hasCoverage ? (downtimeMinutes === 0 ? 'good' : 'bad') : undefined}
|
|
91
90
|
* />
|
|
92
91
|
*/
|
|
93
|
-
import {
|
|
92
|
+
import { Card, VisuallyHidden } from '@mantine/core'
|
|
94
93
|
import { useEffect, useState } from 'react'
|
|
95
94
|
import type { ReactNode } from 'react'
|
|
96
95
|
import {
|
|
@@ -108,7 +107,6 @@ import type {
|
|
|
108
107
|
WidgetHeaderTitleProps,
|
|
109
108
|
} from './widget-header'
|
|
110
109
|
import { DeltaBadge } from './delta-badge'
|
|
111
|
-
import { VX } from '../tokens'
|
|
112
110
|
import { cx } from '../common/props'
|
|
113
111
|
import type { BasaltProps, SlotStylesProps, Tone } from '../common/props'
|
|
114
112
|
import { ErrorState, QueryState, resolveQueryBranch } from './query-state'
|
|
@@ -126,7 +124,7 @@ export type StatCardSlot = 'root' | 'header' | 'body' | 'sparkline'
|
|
|
126
124
|
*
|
|
127
125
|
* `value` is a pre-formatted `string` for the same reason the hero's is: the card cannot know the
|
|
128
126
|
* locale, the currency or the precision the number was measured at. `tone` marks ONE row as past a
|
|
129
|
-
* threshold and is the same vocabulary as the card's own `tone`, so a row saying `bad` and a
|
|
127
|
+
* threshold and is the same vocabulary as the card's own `tone`, so a row saying `bad` and a dot
|
|
130
128
|
* saying `bad` are the same claim at two scales; omitting it is untinted, never `'good'`.
|
|
131
129
|
*/
|
|
132
130
|
export type StatCardBreakdownRow = {
|
|
@@ -193,16 +191,6 @@ function useSlotWidth(active: boolean): {
|
|
|
193
191
|
return { ref: setNode, width }
|
|
194
192
|
}
|
|
195
193
|
|
|
196
|
-
/** The rail's width, in px. Wide enough to read as a deliberate mark at a glance, narrow enough
|
|
197
|
-
* that it cannot be mistaken for the card's own edge. */
|
|
198
|
-
const TONE_RAIL_WIDTH = 3
|
|
199
|
-
|
|
200
|
-
const TONE_LABEL: Record<Tone, string> = {
|
|
201
|
-
good: 'Within the good threshold',
|
|
202
|
-
warn: 'Past the warning threshold',
|
|
203
|
-
bad: 'Past the severe threshold',
|
|
204
|
-
}
|
|
205
|
-
|
|
206
194
|
/**
|
|
207
195
|
* `StatCard` re-publishes three NAMED `WidgetHeader` slices (`WidgetHeaderTitleProps` /
|
|
208
196
|
* `WidgetHeaderMetricProps` / `WidgetHeaderDeltaProps`, audit B #2) rather than re-declaring the
|
|
@@ -302,10 +290,11 @@ export type StatCardProps = BasaltProps &
|
|
|
302
290
|
/** Caption-row right slot (e.g. a ghost "..." menu trigger) — wrapped in `CtlSlot tier="widget"`,
|
|
303
291
|
* so a raw `ActionIcon` with no `size` lands on the 24px step the caption row holds (C1/C5). */
|
|
304
292
|
actions?: ReactNode
|
|
305
|
-
/** Threshold verdict —
|
|
306
|
-
* assistive tech. Omitting it is NOT `'good'`: omitted covers a
|
|
307
|
-
* is absent, and stays untinted so a card with nothing
|
|
308
|
-
* `'good'` only to assert a measured value that has
|
|
293
|
+
/** Threshold verdict — a status dot plus a short word (`OK` / `Watch` / `Over`) on the caption
|
|
294
|
+
* row, with the full phrase for assistive tech. Omitting it is NOT `'good'`: omitted covers a
|
|
295
|
+
* reading that is fine AND one that is absent, and stays untinted so a card with nothing
|
|
296
|
+
* measured can never render green. Pass `'good'` only to assert a measured value that has
|
|
297
|
+
* earned the verdict. */
|
|
309
298
|
tone?: Tone
|
|
310
299
|
}
|
|
311
300
|
|
|
@@ -515,8 +504,7 @@ export function StatCard({
|
|
|
515
504
|
// grid row stretch to the tallest.
|
|
516
505
|
padding: 'var(--vx-space-card-inset-y, 0.75rem) var(--vx-space-card-inset-x, 1rem)',
|
|
517
506
|
overflow: 'hidden',
|
|
518
|
-
//
|
|
519
|
-
// depending on whether it happens to have crossed a threshold this render.
|
|
507
|
+
// Consumers may anchor overlays (badges, menus) to the card, so it stays a positioned box.
|
|
520
508
|
position: 'relative',
|
|
521
509
|
// The card's own width drives its chrome (`stat-card.module.css`).
|
|
522
510
|
containerType: 'inline-size',
|
|
@@ -525,29 +513,6 @@ export function StatCard({
|
|
|
525
513
|
}}
|
|
526
514
|
data-tone={tone}
|
|
527
515
|
>
|
|
528
|
-
{tone !== undefined && (
|
|
529
|
-
<>
|
|
530
|
-
{/* The rail is decoration; the verdict it encodes is real information, so it is also
|
|
531
|
-
stated in text for anyone who cannot see a 3px colour bar. Colour alone is never the
|
|
532
|
-
only carrier of a threshold. */}
|
|
533
|
-
<VisuallyHidden>{TONE_LABEL[tone]}</VisuallyHidden>
|
|
534
|
-
<Box
|
|
535
|
-
aria-hidden="true"
|
|
536
|
-
style={{
|
|
537
|
-
position: 'absolute',
|
|
538
|
-
insetBlock: 0,
|
|
539
|
-
insetInlineStart: 0,
|
|
540
|
-
width: TONE_RAIL_WIDTH,
|
|
541
|
-
// `Tone`'s members are `VX.status` keys by construction, so the rail reads the
|
|
542
|
-
// per-scheme `--vx-status-*` solid directly — never a hex, so it re-resolves in both
|
|
543
|
-
// schemes and under a consumer's `derive` retune. Contrast against
|
|
544
|
-
// `--vx-surface-panel` is measured in `theme/contrast.test.ts`.
|
|
545
|
-
background: VX.status[tone],
|
|
546
|
-
}}
|
|
547
|
-
/>
|
|
548
|
-
</>
|
|
549
|
-
)}
|
|
550
|
-
|
|
551
516
|
<div
|
|
552
517
|
className={cx(classes.body, classNames?.body)}
|
|
553
518
|
data-placement={sparklinePlacement}
|
|
@@ -560,6 +525,7 @@ export function StatCard({
|
|
|
560
525
|
{...(icon !== undefined && { icon })}
|
|
561
526
|
{...(info !== undefined && { info })}
|
|
562
527
|
{...(qualifier !== undefined && { qualifier })}
|
|
528
|
+
{...(tone !== undefined && { tone })}
|
|
563
529
|
{...(actions !== undefined && { actions })}
|
|
564
530
|
/>
|
|
565
531
|
|
|
@@ -247,12 +247,16 @@
|
|
|
247
247
|
* overlay — axe and assistive tech measure the element. The negative margin hands the extra
|
|
248
248
|
* (24 - 11) / 2 back on every side, so the glyph and the row around it keep their drawn size. */
|
|
249
249
|
.infoTrigger {
|
|
250
|
+
--basalt-info-glyph: 11px;
|
|
251
|
+
--basalt-info-ring-offset: 2px;
|
|
252
|
+
--basalt-info-ring-width: 2px;
|
|
250
253
|
display: inline-flex;
|
|
251
254
|
align-items: center;
|
|
252
255
|
justify-content: center;
|
|
253
256
|
min-width: 24px;
|
|
254
257
|
min-height: 24px;
|
|
255
|
-
margin: calc((
|
|
258
|
+
margin: calc((var(--basalt-info-glyph) - 24px) / 2);
|
|
259
|
+
position: relative;
|
|
256
260
|
appearance: none;
|
|
257
261
|
padding: 0;
|
|
258
262
|
border: none;
|
|
@@ -261,6 +265,29 @@
|
|
|
261
265
|
cursor: help;
|
|
262
266
|
}
|
|
263
267
|
|
|
268
|
+
/* The keyboard ring hugs the glyph, not the 24px hit box: drawn on the box it reached 6.5px past
|
|
269
|
+
* the glyph and painted over the title's last letter and a neighbouring status dot. The `::before`
|
|
270
|
+
* is the glyph + the offset on each side, outlined by the ring width, so the ring ends 4px from the
|
|
271
|
+
* glyph — inside the 6px control gap. (`::after` is the hit overlay's.)
|
|
272
|
+
* Forced colors: the ring is an `outline`, which the UA keeps and recolours to a system colour, so
|
|
273
|
+
* it stays visible without a `forced-colors` override. */
|
|
274
|
+
.infoTrigger:focus-visible {
|
|
275
|
+
outline: none;
|
|
276
|
+
|
|
277
|
+
&::before {
|
|
278
|
+
content: '';
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: 50%;
|
|
281
|
+
left: 50%;
|
|
282
|
+
translate: -50% -50%;
|
|
283
|
+
width: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
|
|
284
|
+
height: calc(var(--basalt-info-glyph) + 2 * var(--basalt-info-ring-offset));
|
|
285
|
+
border-radius: var(--vx-radius-fine);
|
|
286
|
+
outline: var(--basalt-info-ring-width) solid var(--vx-accent);
|
|
287
|
+
pointer-events: none;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
264
291
|
.infoTrigger:hover,
|
|
265
292
|
.infoTrigger:focus-visible,
|
|
266
293
|
.infoTrigger[data-open='true'] {
|
|
@@ -290,6 +290,7 @@ export function InfoGlyph({
|
|
|
290
290
|
ref={triggerRef}
|
|
291
291
|
type="button"
|
|
292
292
|
data-basalt-hit
|
|
293
|
+
data-info-trigger
|
|
293
294
|
className={classes.infoTrigger}
|
|
294
295
|
// The GLYPH is named, not the text — `text` reaches AT through `aria-describedby` below, so
|
|
295
296
|
// it never lands in the heading's or the button's accessible name.
|
|
@@ -372,7 +373,9 @@ export function WidgetHeader({
|
|
|
372
373
|
{icon !== undefined && (
|
|
373
374
|
<IconSlot className={cx(classes.icon, classNames?.icon)}>{icon}</IconSlot>
|
|
374
375
|
)}
|
|
375
|
-
<span className={classes.titleText}
|
|
376
|
+
<span className={classes.titleText} data-widget-title>
|
|
377
|
+
{title}
|
|
378
|
+
</span>
|
|
376
379
|
</Heading>
|
|
377
380
|
{/* OUTSIDE the heading on purpose — see `info`'s own doc. */}
|
|
378
381
|
{info !== undefined && (
|
|
@@ -194,29 +194,47 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
194
194
|
"vars": {
|
|
195
195
|
"fn":
|
|
196
196
|
"(_theme, props) => {
|
|
197
|
-
const ink =
|
|
197
|
+
const ink = inkVars(props);
|
|
198
198
|
return {
|
|
199
199
|
root: {
|
|
200
200
|
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
201
201
|
"--ai-color": ink.color,
|
|
202
|
-
"--ai-hover": ink.hover
|
|
202
|
+
"--ai-hover": ink.hover,
|
|
203
|
+
"--ai-bg": ink.bg,
|
|
204
|
+
"--ai-bd": ink.border
|
|
203
205
|
}
|
|
204
206
|
};
|
|
205
207
|
}"
|
|
206
208
|
,
|
|
207
209
|
"outputs": [
|
|
208
210
|
{
|
|
209
|
-
"probes":
|
|
211
|
+
"probes": 1892,
|
|
210
212
|
"result": "{"root":{}}",
|
|
211
213
|
},
|
|
214
|
+
{
|
|
215
|
+
"probes": 42,
|
|
216
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"probes": 42,
|
|
220
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
221
|
+
},
|
|
212
222
|
{
|
|
213
223
|
"probes": 42,
|
|
214
224
|
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
215
225
|
},
|
|
216
226
|
{
|
|
217
|
-
"probes":
|
|
227
|
+
"probes": 272,
|
|
218
228
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
219
229
|
},
|
|
230
|
+
{
|
|
231
|
+
"probes": 6,
|
|
232
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"probes": 6,
|
|
236
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
237
|
+
},
|
|
220
238
|
{
|
|
221
239
|
"probes": 6,
|
|
222
240
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -271,29 +289,47 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
271
289
|
"vars": {
|
|
272
290
|
"fn":
|
|
273
291
|
"(_theme, props) => {
|
|
274
|
-
const ink =
|
|
292
|
+
const ink = inkVars(props);
|
|
275
293
|
return {
|
|
276
294
|
root: {
|
|
277
295
|
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
278
296
|
"--button-color": ink.color,
|
|
279
|
-
"--button-hover": ink.hover
|
|
297
|
+
"--button-hover": ink.hover,
|
|
298
|
+
"--button-bg": ink.bg,
|
|
299
|
+
"--button-bd": ink.border
|
|
280
300
|
}
|
|
281
301
|
};
|
|
282
302
|
}"
|
|
283
303
|
,
|
|
284
304
|
"outputs": [
|
|
285
305
|
{
|
|
286
|
-
"probes":
|
|
306
|
+
"probes": 1892,
|
|
287
307
|
"result": "{"root":{}}",
|
|
288
308
|
},
|
|
309
|
+
{
|
|
310
|
+
"probes": 42,
|
|
311
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"probes": 42,
|
|
315
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
316
|
+
},
|
|
289
317
|
{
|
|
290
318
|
"probes": 42,
|
|
291
319
|
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
292
320
|
},
|
|
293
321
|
{
|
|
294
|
-
"probes":
|
|
322
|
+
"probes": 272,
|
|
295
323
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
296
324
|
},
|
|
325
|
+
{
|
|
326
|
+
"probes": 6,
|
|
327
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"probes": 6,
|
|
331
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
332
|
+
},
|
|
297
333
|
{
|
|
298
334
|
"probes": 6,
|
|
299
335
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -1336,29 +1372,47 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
1336
1372
|
"vars": {
|
|
1337
1373
|
"fn":
|
|
1338
1374
|
"(_theme, props) => {
|
|
1339
|
-
const ink =
|
|
1375
|
+
const ink = inkVars(props);
|
|
1340
1376
|
return {
|
|
1341
1377
|
root: {
|
|
1342
1378
|
"--ai-size": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
1343
1379
|
"--ai-color": ink.color,
|
|
1344
|
-
"--ai-hover": ink.hover
|
|
1380
|
+
"--ai-hover": ink.hover,
|
|
1381
|
+
"--ai-bg": ink.bg,
|
|
1382
|
+
"--ai-bd": ink.border
|
|
1345
1383
|
}
|
|
1346
1384
|
};
|
|
1347
1385
|
}"
|
|
1348
1386
|
,
|
|
1349
1387
|
"outputs": [
|
|
1350
1388
|
{
|
|
1351
|
-
"probes":
|
|
1389
|
+
"probes": 1892,
|
|
1352
1390
|
"result": "{"root":{}}",
|
|
1353
1391
|
},
|
|
1392
|
+
{
|
|
1393
|
+
"probes": 42,
|
|
1394
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"probes": 42,
|
|
1398
|
+
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1399
|
+
},
|
|
1354
1400
|
{
|
|
1355
1401
|
"probes": 42,
|
|
1356
1402
|
"result": "{"root":{"--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
1357
1403
|
},
|
|
1358
1404
|
{
|
|
1359
|
-
"probes":
|
|
1405
|
+
"probes": 272,
|
|
1360
1406
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
1361
1407
|
},
|
|
1408
|
+
{
|
|
1409
|
+
"probes": 6,
|
|
1410
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--ai-bg":"var(--vx-surface-subtle)"}}",
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
"probes": 6,
|
|
1414
|
+
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"var(--vx-surface-subtle)","--ai-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1415
|
+
},
|
|
1362
1416
|
{
|
|
1363
1417
|
"probes": 6,
|
|
1364
1418
|
"result": "{"root":{"--ai-size":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--ai-color":"var(--vx-ink)","--ai-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
@@ -1413,29 +1467,47 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
1413
1467
|
"vars": {
|
|
1414
1468
|
"fn":
|
|
1415
1469
|
"(_theme, props) => {
|
|
1416
|
-
const ink =
|
|
1470
|
+
const ink = inkVars(props);
|
|
1417
1471
|
return {
|
|
1418
1472
|
root: {
|
|
1419
1473
|
"--button-height": props.size === "md" ? "calc(var(--vx-space-control-height) * var(--mantine-scale))" : void 0,
|
|
1420
1474
|
"--button-color": ink.color,
|
|
1421
|
-
"--button-hover": ink.hover
|
|
1475
|
+
"--button-hover": ink.hover,
|
|
1476
|
+
"--button-bg": ink.bg,
|
|
1477
|
+
"--button-bd": ink.border
|
|
1422
1478
|
}
|
|
1423
1479
|
};
|
|
1424
1480
|
}"
|
|
1425
1481
|
,
|
|
1426
1482
|
"outputs": [
|
|
1427
1483
|
{
|
|
1428
|
-
"probes":
|
|
1484
|
+
"probes": 1892,
|
|
1429
1485
|
"result": "{"root":{}}",
|
|
1430
1486
|
},
|
|
1487
|
+
{
|
|
1488
|
+
"probes": 42,
|
|
1489
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
"probes": 42,
|
|
1493
|
+
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1494
|
+
},
|
|
1431
1495
|
{
|
|
1432
1496
|
"probes": 42,
|
|
1433
1497
|
"result": "{"root":{"--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
|
1434
1498
|
},
|
|
1435
1499
|
{
|
|
1436
|
-
"probes":
|
|
1500
|
+
"probes": 272,
|
|
1437
1501
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))"}}",
|
|
1438
1502
|
},
|
|
1503
|
+
{
|
|
1504
|
+
"probes": 6,
|
|
1505
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, var(--vx-surface-subtle))","--button-bg":"var(--vx-surface-subtle)"}}",
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
"probes": 6,
|
|
1509
|
+
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"var(--vx-surface-subtle)","--button-bd":"calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)"}}",
|
|
1510
|
+
},
|
|
1439
1511
|
{
|
|
1440
1512
|
"probes": 6,
|
|
1441
1513
|
"result": "{"root":{"--button-height":"calc(var(--vx-space-control-height) * var(--mantine-scale))","--button-color":"var(--vx-ink)","--button-hover":"color-mix(in srgb, var(--vx-ink) 6%, transparent)"}}",
|
package/src/theme/chrome-vars.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Component `vars` that carry the Wave 33 chrome (`
|
|
2
|
+
* Component `vars` that carry the Wave 33 chrome (`MIGRATING.md` § Light and outline Buttons are ink, D27) and the
|
|
3
3
|
* ON-COLOR re-point they sit beside. Pure functions of theme + props, kept out of `theme/index.ts`
|
|
4
4
|
* so the tests can call them directly.
|
|
5
5
|
*/
|
|
@@ -40,7 +40,7 @@ import type { MantineTheme } from '@mantine/core'
|
|
|
40
40
|
* Stepper / Indicator / Timeline all call Mantine's `getContrastColor` directly) are re-pointed at
|
|
41
41
|
* it too, in `components` below. Regression-locked by `contrast.test.ts`.
|
|
42
42
|
*/
|
|
43
|
-
export function onColor(theme: MantineTheme, color: string | undefined): string | undefined {
|
|
43
|
+
export function onColor(theme: MantineTheme, color: string | null | undefined): string | undefined {
|
|
44
44
|
const name = color ?? theme.primaryColor
|
|
45
45
|
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return undefined // hex / `blue.5`
|
|
46
46
|
return `var(--vx-on-${name})`
|
|
@@ -53,36 +53,61 @@ export function onColor(theme: MantineTheme, color: string | undefined): string
|
|
|
53
53
|
*/
|
|
54
54
|
export function onColorFor(
|
|
55
55
|
theme: MantineTheme,
|
|
56
|
-
props: { color?: string | undefined; autoContrast?: boolean | undefined },
|
|
56
|
+
props: { color?: string | null | undefined; autoContrast?: boolean | undefined },
|
|
57
57
|
): string | undefined {
|
|
58
58
|
const autoContrast = props.autoContrast ?? theme.autoContrast
|
|
59
59
|
return autoContrast ? onColor(theme, props.color) : undefined
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
/**
|
|
63
|
+
* The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. An
|
|
64
|
+
* empty string and `null` name nothing — Mantine reads `color || primaryColor`, so they fall back to
|
|
65
|
+
* the primary colour too.
|
|
66
|
+
*/
|
|
67
|
+
export function hasExplicitColor(color: string | null | undefined): boolean {
|
|
68
|
+
return typeof color === 'string' && color !== ''
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type InkVars = {
|
|
72
|
+
color?: string
|
|
73
|
+
hover?: string
|
|
74
|
+
bg?: string
|
|
75
|
+
border?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const INK = 'var(--vx-ink)'
|
|
79
|
+
const SUBTLE = 'var(--vx-surface-subtle)'
|
|
80
|
+
|
|
81
|
+
/** Per variant: what an unnamed-colour Button / ActionIcon paints instead of the accent. */
|
|
82
|
+
const INK_BY_VARIANT: Partial<Record<'subtle' | 'light' | 'outline', InkVars>> = {
|
|
83
|
+
subtle: { color: INK, hover: 'color-mix(in srgb, var(--vx-ink) 6%, transparent)' },
|
|
84
|
+
light: { color: INK, bg: SUBTLE, hover: `color-mix(in srgb, var(--vx-ink) 6%, ${SUBTLE})` },
|
|
85
|
+
outline: {
|
|
86
|
+
color: INK,
|
|
87
|
+
border: 'calc(0.0625rem * var(--mantine-scale)) solid var(--vx-surface-border)',
|
|
88
|
+
hover: SUBTLE,
|
|
89
|
+
},
|
|
65
90
|
}
|
|
66
91
|
|
|
67
92
|
/**
|
|
68
|
-
* A `subtle` Button / ActionIcon that names no colour
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
93
|
+
* A `subtle`, `light` or `outline` Button / ActionIcon that names no colour is ink, not the accent
|
|
94
|
+
* (`MIGRATING.md` § Light and outline Buttons are ink, D27). `subtle`: ink label, ink-6% hover
|
|
95
|
+
* (`docs/DESIGN-SPEC.md` §5 ghost idiom). `light`: the subtle surface with an ink label, hover one
|
|
96
|
+
* ink step on top (Mantine's gray-light roles collapse bg and hover to one colour in light). `outline`:
|
|
97
|
+
* the surface border, ink label, subtle-surface hover. An explicit `color=` — the primary one
|
|
98
|
+
* included — keeps Mantine's tinted vars: `color="red"` on a destructive action carries its hue as
|
|
99
|
+
* the whole signal. Mantine hands the variant resolver `color || primaryColor`, so only the
|
|
100
|
+
* component props can tell "unnamed" from "primary" — hence vars, not the resolver. Disabled needs no
|
|
101
|
+
* gate: Mantine's disabled rule sets colour, background and border directly, not through these vars.
|
|
73
102
|
*/
|
|
74
|
-
export function
|
|
75
|
-
color?: string | undefined
|
|
103
|
+
export function inkVars(props: {
|
|
104
|
+
color?: string | null | undefined
|
|
76
105
|
variant?: string | undefined
|
|
77
|
-
}): {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
color: ink ? 'var(--vx-ink)' : undefined,
|
|
84
|
-
hover: ink ? 'color-mix(in srgb, var(--vx-ink) 6%, transparent)' : undefined,
|
|
85
|
-
}
|
|
106
|
+
}): InkVars {
|
|
107
|
+
const { variant } = props
|
|
108
|
+
if (hasExplicitColor(props.color) || variant === undefined) return {}
|
|
109
|
+
if (!Object.hasOwn(INK_BY_VARIANT, variant)) return {}
|
|
110
|
+
return INK_BY_VARIANT[variant as keyof typeof INK_BY_VARIANT] ?? {}
|
|
86
111
|
}
|
|
87
112
|
|
|
88
113
|
/**
|
|
@@ -95,7 +120,7 @@ export function subtleInkVars(props: {
|
|
|
95
120
|
export function tabsVars(
|
|
96
121
|
theme: MantineTheme,
|
|
97
122
|
props: {
|
|
98
|
-
color?: string | undefined
|
|
123
|
+
color?: string | null | undefined
|
|
99
124
|
variant?: string | undefined
|
|
100
125
|
autoContrast?: boolean | undefined
|
|
101
126
|
},
|
package/src/theme/index.ts
CHANGED
|
@@ -86,7 +86,7 @@ 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
90
|
import controlsClasses from './controls.module.css'
|
|
91
91
|
import floatingClasses from './floating.module.css'
|
|
92
92
|
import navLinkClasses from './nav-link.module.css'
|
|
@@ -314,9 +314,9 @@ const basaltVariantColorResolver: VariantColorsResolver = (input) => {
|
|
|
314
314
|
return autoContrast ? { ...resolved, color: on } : resolved
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
// `subtle`
|
|
318
|
-
// (the resolver is always handed `color || primaryColor`, so it cannot
|
|
319
|
-
// explicit primary colour — only the component props can).
|
|
317
|
+
// `subtle`, `light` and `outline` stay Mantine's: a Button or ActionIcon that names no colour gets
|
|
318
|
+
// ink for them in `inkVars` (the resolver is always handed `color || primaryColor`, so it cannot
|
|
319
|
+
// tell "unnamed" from an explicit primary colour — only the component props can).
|
|
320
320
|
// `outline`: the tone's own text colour, pulled toward ink so the label keeps its hue at AA
|
|
321
321
|
// (grey outline badges measured 3.9:1 on the light page).
|
|
322
322
|
if (input.variant === 'outline') {
|
|
@@ -676,7 +676,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
676
676
|
Button: ext<typeof Button>({
|
|
677
677
|
classNames: { root: controlsClasses.buttonRoot },
|
|
678
678
|
vars: (_theme, props) => {
|
|
679
|
-
const ink =
|
|
679
|
+
const ink = inkVars(props)
|
|
680
680
|
return {
|
|
681
681
|
root: {
|
|
682
682
|
'--button-height':
|
|
@@ -685,6 +685,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
685
685
|
: undefined,
|
|
686
686
|
'--button-color': ink.color,
|
|
687
687
|
'--button-hover': ink.hover,
|
|
688
|
+
'--button-bg': ink.bg,
|
|
689
|
+
'--button-bd': ink.border,
|
|
688
690
|
},
|
|
689
691
|
}
|
|
690
692
|
},
|
|
@@ -692,7 +694,7 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
692
694
|
ActionIcon: ext<typeof ActionIcon>({
|
|
693
695
|
classNames: { root: controlsClasses.actionIconRoot },
|
|
694
696
|
vars: (_theme, props) => {
|
|
695
|
-
const ink =
|
|
697
|
+
const ink = inkVars(props)
|
|
696
698
|
return {
|
|
697
699
|
root: {
|
|
698
700
|
'--ai-size':
|
|
@@ -701,6 +703,8 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
701
703
|
: undefined,
|
|
702
704
|
'--ai-color': ink.color,
|
|
703
705
|
'--ai-hover': ink.hover,
|
|
706
|
+
'--ai-bg': ink.bg,
|
|
707
|
+
'--ai-bd': ink.border,
|
|
704
708
|
},
|
|
705
709
|
}
|
|
706
710
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
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. INTERNAL: not on any barrel.
|
|
5
|
+
*/
|
|
6
|
+
import type { CSSProperties } from 'react'
|
|
7
|
+
import classes from './status-dot.module.css'
|
|
8
|
+
|
|
9
|
+
export type StatusDotProps = {
|
|
10
|
+
/** Any CSS colour; callers pass a `VX.status.*` token so it re-resolves per scheme. */
|
|
11
|
+
color: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type DotStyle = CSSProperties & { '--basalt-status-dot': string }
|
|
15
|
+
|
|
16
|
+
export function StatusDot({ color }: StatusDotProps) {
|
|
17
|
+
const style: DotStyle = { '--basalt-status-dot': color }
|
|
18
|
+
return <span className={classes.dot} data-basalt-status-dot="" aria-hidden="true" style={style} />
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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. */
|
|
3
|
+
.verdict {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex: none;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 5px;
|
|
8
|
+
font-family: var(--basalt-font-mono);
|
|
9
|
+
font-size: var(--vx-text-micro);
|
|
10
|
+
color: var(--vx-muted);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Visually hidden, still read by assistive tech. */
|
|
14
|
+
.hidden {
|
|
15
|
+
position: absolute;
|
|
16
|
+
width: 1px;
|
|
17
|
+
height: 1px;
|
|
18
|
+
margin: -1px;
|
|
19
|
+
padding: 0;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
clip-path: inset(50%);
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|