basalt-ui 2.16.0 → 2.17.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 +149 -126
- package/MIGRATING.md +101 -15
- package/agent/agents/basalt-design-reviewer.md +2 -2
- package/agent/skills/basalt-design/SKILL.md +2 -2
- package/configs/oxlint-plugin.js +2 -2
- package/dist/charts/Donut.d.ts.map +1 -1
- package/dist/charts/Donut.js +2 -2
- package/dist/charts/DualPanel.js +2 -2
- package/dist/charts/Heatmap.d.ts.map +1 -1
- package/dist/charts/Heatmap.js +2 -2
- package/dist/charts/MirroredBars.js +2 -2
- package/dist/charts/Sparkline.d.ts +4 -2
- package/dist/charts/Sparkline.d.ts.map +1 -1
- package/dist/charts/Sparkline.js +3 -3
- package/dist/charts/compile.d.ts +8 -3
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +19 -9
- package/dist/charts/cursor.d.ts +14 -1
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +29 -3
- package/dist/charts/date-tick-format.d.ts +17 -0
- package/dist/charts/date-tick-format.d.ts.map +1 -0
- package/dist/charts/date-tick-format.js +81 -0
- package/dist/charts/panel.d.ts +2 -1
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +3 -2
- package/dist/charts/types.d.ts +5 -1
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/cli/shot/capture.d.ts +16 -0
- package/dist/cli/shot/capture.d.ts.map +1 -1
- package/dist/cli/shot/capture.js +24 -3
- package/dist/cli/shot/playwright.d.ts +4 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.d.ts +2 -2
- package/dist/dashboard/delta-badge.d.ts.map +1 -1
- package/dist/dashboard/delta-badge.js +12 -14
- package/dist/dashboard/query-state.d.ts +35 -0
- package/dist/dashboard/query-state.d.ts.map +1 -1
- package/dist/dashboard/query-state.js +12 -1
- package/dist/dashboard/stat-card-parts.d.ts +40 -0
- package/dist/dashboard/stat-card-parts.d.ts.map +1 -0
- package/dist/dashboard/stat-card-parts.js +55 -0
- package/dist/dashboard/stat-card.d.ts +46 -34
- package/dist/dashboard/stat-card.d.ts.map +1 -1
- package/dist/dashboard/stat-card.js +148 -79
- package/dist/dashboard/stat-card.module.css +220 -7
- package/dist/dashboard/stat-card.module.css.d.ts +20 -0
- package/dist/dashboard/widget-header.d.ts.map +1 -1
- package/dist/dashboard/widget-header.js +73 -9
- package/dist/dashboard/widget-header.module.css +25 -17
- package/dist/guard/index.js +2 -2
- package/dist/theme/chrome-vars.d.ts +82 -0
- package/dist/theme/chrome-vars.d.ts.map +1 -0
- package/dist/theme/chrome-vars.js +36 -0
- package/dist/theme/controls.module.css +20 -1
- package/dist/theme/controls.module.css.d.ts +1 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +30 -33
- package/dist/tokens/derive.d.ts.map +1 -1
- package/dist/tokens/derive.js +2 -2
- package/llms.txt +6 -3
- package/package.json +1 -1
- package/src/charts/Donut.tsx +2 -2
- package/src/charts/DualPanel.tsx +2 -2
- package/src/charts/Heatmap.tsx +2 -2
- package/src/charts/MirroredBars.tsx +2 -2
- package/src/charts/Sparkline.tsx +7 -5
- package/src/charts/compile.ts +31 -11
- package/src/charts/cursor.ts +48 -3
- package/src/charts/date-tick-format.ts +132 -0
- package/src/charts/panel.tsx +5 -3
- package/src/charts/types.ts +5 -1
- package/src/cli/shot/capture.ts +35 -3
- package/src/cli/shot/playwright.ts +1 -1
- package/src/dashboard/delta-badge.tsx +24 -18
- package/src/dashboard/query-state.tsx +38 -0
- package/src/dashboard/stat-card-parts.tsx +108 -0
- package/src/dashboard/stat-card.module.css +220 -7
- package/src/dashboard/stat-card.module.css.d.ts +20 -0
- package/src/dashboard/stat-card.tsx +282 -174
- package/src/dashboard/widget-header.module.css +25 -17
- package/src/dashboard/widget-header.tsx +103 -7
- package/src/guard/index.ts +2 -2
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +128 -40
- package/src/theme/chrome-vars.ts +111 -0
- package/src/theme/controls.module.css +20 -1
- package/src/theme/controls.module.css.d.ts +1 -0
- package/src/theme/index.ts +39 -101
- package/src/tokens/derive.ts +7 -2
|
@@ -5,7 +5,18 @@
|
|
|
5
5
|
* than 480px (`container: basalt-card`, set on the Card root in `stat-card.tsx`).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/* Foot geometry, single-sourced: the visual slot (SPEC § 6.2: 22), one `sm` footer line (20) and the
|
|
9
|
+
* 4px between them. The foot reserves all three whenever it exists (`.foot`), which is what keeps a
|
|
10
|
+
* card with a sparkline and one without a footer the same height. */
|
|
8
11
|
.body {
|
|
12
|
+
--basalt-stat-visual-h: 1.375rem;
|
|
13
|
+
--basalt-stat-footer-h: 1.25rem;
|
|
14
|
+
--basalt-stat-foot-gap: 0.25rem;
|
|
15
|
+
/* The figure's size and line box, in one place: `.value`, the empty line and the pending skeleton
|
|
16
|
+
* all read them, so nothing moves when a reading lands. */
|
|
17
|
+
--basalt-stat-figure-size: var(--vx-text-kpi);
|
|
18
|
+
--basalt-stat-figure-line: 1.25;
|
|
19
|
+
--basalt-stat-figure-h: calc(var(--basalt-stat-figure-size) * var(--basalt-stat-figure-line));
|
|
9
20
|
display: flex;
|
|
10
21
|
flex-direction: column;
|
|
11
22
|
gap: var(--vx-space-stat-card-gap);
|
|
@@ -16,6 +27,210 @@
|
|
|
16
27
|
min-width: 0;
|
|
17
28
|
}
|
|
18
29
|
|
|
30
|
+
/* ── caption row ─────────────────────────────────────────────────────────────────────────────── */
|
|
31
|
+
|
|
32
|
+
/* `captionMain` takes the row; the actions slot sits at its end. The row is 24px (the widget control
|
|
33
|
+
* step) so a card with a kebab is the same height as one without. */
|
|
34
|
+
.captionRow {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
gap: var(--vx-space-control-gap, 0.375rem);
|
|
38
|
+
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Wraps on purpose: when caption + info + qualifier do not fit, the qualifier drops UNDER the caption
|
|
42
|
+
* instead of truncating either — the container's width decides, never the viewport's. */
|
|
43
|
+
.captionMain {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: 1 1 0;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
align-items: center;
|
|
48
|
+
/* Caption left, qualifier right; a qualifier that wraps is alone on its line, so it sits at the start. */
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
column-gap: var(--vx-space-control-gap, 0.375rem);
|
|
51
|
+
min-width: 0;
|
|
52
|
+
min-height: calc(var(--vx-space-control-height-widget, 1.5rem) * var(--mantine-scale, 1));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Caption and info glyph travel together: the pair is the first item of the row. */
|
|
56
|
+
.lead {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
column-gap: var(--vx-space-control-gap, 0.375rem);
|
|
60
|
+
min-width: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.caption {
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: 5px;
|
|
67
|
+
margin: 0;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
font-family: var(--basalt-font-mono);
|
|
70
|
+
font-size: var(--vx-text-micro);
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
text-transform: uppercase;
|
|
73
|
+
letter-spacing: 0.06em;
|
|
74
|
+
color: var(--vx-faint);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.captionText {
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
text-overflow: ellipsis;
|
|
80
|
+
white-space: nowrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.icon {
|
|
84
|
+
color: var(--vx-faint);
|
|
85
|
+
--vx-space-icon-size: 0.875rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.qualifier {
|
|
89
|
+
font-family: var(--basalt-font-mono);
|
|
90
|
+
font-size: var(--vx-text-micro);
|
|
91
|
+
color: var(--vx-muted);
|
|
92
|
+
/* Wraps before it is ever cut: a qualifier too long for the row on its own line breaks its words. */
|
|
93
|
+
overflow-wrap: anywhere;
|
|
94
|
+
min-width: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Law C15: the shared hit overlay; `--vx-hit-gap` caps the expansion at the control gap. */
|
|
98
|
+
.actions {
|
|
99
|
+
--vx-hit-gap: var(--vx-space-control-gap);
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
flex: none;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: var(--vx-space-control-gap, 0.375rem);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* ── value row ───────────────────────────────────────────────────────────────────────────────── */
|
|
107
|
+
|
|
108
|
+
/* The figure and its unit share a baseline; the delta follows them, on the same baseline, and wraps
|
|
109
|
+
* under when the card is too narrow for all three. Three sizes only: micro, sm, hero. */
|
|
110
|
+
.valueRow {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-wrap: wrap;
|
|
113
|
+
align-items: baseline;
|
|
114
|
+
column-gap: var(--vx-space-stack-sm);
|
|
115
|
+
row-gap: 2px;
|
|
116
|
+
min-width: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.figure {
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
align-items: baseline;
|
|
122
|
+
gap: 4px;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* NEVER truncated: the numeral IS the content. It shrinks with the card's own width instead (the
|
|
127
|
+
* `cqi` clamp below), and `overflow-wrap` breaks a pathological string rather than clipping it. */
|
|
128
|
+
.value {
|
|
129
|
+
min-width: 0;
|
|
130
|
+
overflow-wrap: anywhere;
|
|
131
|
+
font-family: var(--basalt-font-mono);
|
|
132
|
+
font-size: var(--basalt-stat-figure-size);
|
|
133
|
+
line-height: var(--basalt-stat-figure-line);
|
|
134
|
+
font-weight: 500;
|
|
135
|
+
letter-spacing: -0.02em;
|
|
136
|
+
color: var(--vx-ink);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* Mono like the number it qualifies, `sm` and muted: the SMALL half of the pair. Never shrinks — a
|
|
140
|
+
* unit clipped to `TS…` would state nothing. */
|
|
141
|
+
.unit {
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
font-family: var(--basalt-font-mono);
|
|
144
|
+
font-size: var(--vx-text-sm);
|
|
145
|
+
font-weight: 500;
|
|
146
|
+
color: var(--vx-muted);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* The numeral shrinks with its card (`cqi` resolves against the card's container wherever the var is
|
|
150
|
+
* read). `(width >= 0px)` is always true but only inside a `basalt-card` container. */
|
|
151
|
+
@container basalt-card (width >= 0px) {
|
|
152
|
+
.body {
|
|
153
|
+
--basalt-stat-figure-size: clamp(var(--vx-text-lg), 8cqi, var(--vx-text-kpi));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* ── states ──────────────────────────────────────────────────────────────────────────────────── */
|
|
158
|
+
|
|
159
|
+
/* The empty branch: one muted line in the figure's place, at the figure row's height. */
|
|
160
|
+
.empty {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
margin: 0;
|
|
164
|
+
min-height: var(--basalt-stat-figure-h);
|
|
165
|
+
font-size: var(--vx-text-sm);
|
|
166
|
+
color: var(--vx-muted);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* The pending skeleton holds the card's own footprint: a value bar at the figure's height, the
|
|
170
|
+
* visual slot at 22, the footer at one `sm` line. */
|
|
171
|
+
.skeletonValue {
|
|
172
|
+
width: 45%;
|
|
173
|
+
height: var(--basalt-stat-figure-h);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.skeletonVisual {
|
|
177
|
+
--skeleton-radius: 0;
|
|
178
|
+
height: var(--basalt-stat-visual-h);
|
|
179
|
+
margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.sparklineRight .skeletonVisual {
|
|
183
|
+
flex: 1 1 auto;
|
|
184
|
+
margin-inline: 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.skeletonRowBox {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
min-height: var(--vx-space-control-height-tag);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.skeletonRow {
|
|
194
|
+
width: 60%;
|
|
195
|
+
height: 0.625rem;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.skeletonFooter {
|
|
199
|
+
width: 55%;
|
|
200
|
+
height: 0.75rem;
|
|
201
|
+
margin-block: 0.25rem;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* ── foot: the visual and its footer line ────────────────────────────────────────────────────── */
|
|
205
|
+
|
|
206
|
+
/* Pinned to the card's bottom (`margin-top: auto`) and reserving visual + gap + footer whenever it
|
|
207
|
+
* exists, bottom-aligned, so the visual and the footer never move when one of them is absent. */
|
|
208
|
+
.foot {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
justify-content: flex-end;
|
|
212
|
+
gap: var(--basalt-stat-foot-gap);
|
|
213
|
+
margin-top: auto;
|
|
214
|
+
min-width: 0;
|
|
215
|
+
min-height: calc(
|
|
216
|
+
var(--basalt-stat-visual-h) + var(--basalt-stat-foot-gap) + var(--basalt-stat-footer-h)
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.foot[data-band='false'] {
|
|
221
|
+
min-height: var(--basalt-stat-footer-h);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.footer {
|
|
225
|
+
margin: 0;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
text-overflow: ellipsis;
|
|
228
|
+
white-space: nowrap;
|
|
229
|
+
font-size: var(--vx-text-sm);
|
|
230
|
+
line-height: var(--basalt-stat-footer-h);
|
|
231
|
+
color: var(--vx-muted);
|
|
232
|
+
}
|
|
233
|
+
|
|
19
234
|
/*
|
|
20
235
|
* `right` placement's second row (measured defect: the "···" actions trigger, and the "Data"
|
|
21
236
|
* select, sat ~74-88px in from the card's right edge — a phone-only 13px is correct). The cause was
|
|
@@ -122,9 +337,8 @@
|
|
|
122
337
|
}
|
|
123
338
|
|
|
124
339
|
.sparklineBleed {
|
|
125
|
-
|
|
340
|
+
height: var(--basalt-stat-visual-h);
|
|
126
341
|
margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
|
|
127
|
-
margin-bottom: calc(-1 * var(--vx-space-card-inset-y, 0.75rem));
|
|
128
342
|
}
|
|
129
343
|
|
|
130
344
|
/* Asks for `StatCard`'s `SPARKLINE_RIGHT_WIDTH`/`_HEIGHT` (handed down as custom properties, so this
|
|
@@ -132,12 +346,12 @@
|
|
|
132
346
|
* this restructure keeps at the SPARKLINE's own level rather than the row's: `.metricsRow` does not
|
|
133
347
|
* set `align-items: flex-end` itself, because a card with no breakdown would then need nothing to
|
|
134
348
|
* anchor against — only the sparkline opts into sitting at the row's bottom edge, which matters once
|
|
135
|
-
* a breakdown taller than the trend's own
|
|
349
|
+
* a breakdown taller than the trend's own 22px is the row's other child. */
|
|
136
350
|
.sparklineRight {
|
|
137
351
|
display: flex;
|
|
138
352
|
flex: 0 1 var(--basalt-stat-sparkline-w, 4.5rem);
|
|
139
353
|
min-width: 0;
|
|
140
|
-
height: var(--basalt-stat-sparkline-h, 1.
|
|
354
|
+
height: var(--basalt-stat-sparkline-h, 1.375rem);
|
|
141
355
|
align-items: flex-end;
|
|
142
356
|
align-self: flex-end;
|
|
143
357
|
overflow: hidden;
|
|
@@ -151,8 +365,8 @@
|
|
|
151
365
|
}
|
|
152
366
|
|
|
153
367
|
/* The row became a COLUMN, so `flex-basis` is now the main-axis HEIGHT — the 72px width would
|
|
154
|
-
* become a 72px-tall box around
|
|
155
|
-
* same
|
|
368
|
+
* become a 72px-tall box around 22px of bars. `flex: none` + the height keeps the bled trend the
|
|
369
|
+
* same 22px it is beside a hero row. `align-self: stretch` resets the row-only `flex-end` above:
|
|
156
370
|
* the cross axis is horizontal now, and this slot must fill the card's width like `.sparklineBleed`
|
|
157
371
|
* does, not shrink to its content and sit flush right. */
|
|
158
372
|
.metricsRow .sparklineRight {
|
|
@@ -160,6 +374,5 @@
|
|
|
160
374
|
align-self: stretch;
|
|
161
375
|
margin-top: auto;
|
|
162
376
|
margin-inline: calc(-1 * var(--vx-space-card-inset-x, 1rem));
|
|
163
|
-
margin-bottom: calc(-1 * var(--vx-space-card-inset-y, 0.75rem));
|
|
164
377
|
}
|
|
165
378
|
}
|
|
@@ -4,6 +4,26 @@
|
|
|
4
4
|
*/
|
|
5
5
|
declare const classes: {
|
|
6
6
|
readonly body: string
|
|
7
|
+
readonly captionRow: string
|
|
8
|
+
readonly captionMain: string
|
|
9
|
+
readonly lead: string
|
|
10
|
+
readonly caption: string
|
|
11
|
+
readonly captionText: string
|
|
12
|
+
readonly icon: string
|
|
13
|
+
readonly qualifier: string
|
|
14
|
+
readonly actions: string
|
|
15
|
+
readonly valueRow: string
|
|
16
|
+
readonly figure: string
|
|
17
|
+
readonly value: string
|
|
18
|
+
readonly unit: string
|
|
19
|
+
readonly empty: string
|
|
20
|
+
readonly skeletonValue: string
|
|
21
|
+
readonly skeletonVisual: string
|
|
22
|
+
readonly skeletonFooter: string
|
|
23
|
+
readonly skeletonRowBox: string
|
|
24
|
+
readonly skeletonRow: string
|
|
25
|
+
readonly foot: string
|
|
26
|
+
readonly footer: string
|
|
7
27
|
readonly header: string
|
|
8
28
|
readonly metricsRow: string
|
|
9
29
|
readonly breakdown: string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-header.d.ts","sourceRoot":"","sources":["../../src/dashboard/widget-header.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"widget-header.d.ts","sourceRoot":"","sources":["../../src/dashboard/widget-header.tsx"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAGlD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE7D;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;AAEnE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,eAAe,CAAC,gBAAgB,CAAC,GAAG;IAClC;;;;gDAI4C;IAC5C,IAAI,EAAE,gBAAgB,CAAA;IACtB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;wCAEoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;oFACgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;qEACiE;IACjE,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC;4DACwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;yDACqD;IACrD,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;2EACuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4FAA4F;IAC5F,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC,CAAA;AAEpG;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,CAAC,CAAA;AAE/E;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,iBAAiB,EACjB,OAAO,GAAG,aAAa,GAAG,eAAe,GAAG,aAAa,GAAG,YAAY,CACzE,CAAA;AAuED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,IAAI,EACJ,SAA8B,EAC9B,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;2DAGuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA0EA;AAED,wBAAgB,YAAY,CAAC,EAC3B,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,iBAAiB,+BAiEnB"}
|
|
@@ -1,9 +1,48 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
3
4
|
import { cx } from "../common/props.js";
|
|
4
5
|
import { IconSlot } from "../theme/icon-slot.js";
|
|
5
6
|
import { DeltaBadge } from "./delta-badge.js";
|
|
6
7
|
import classes from "./widget-header.module.css";
|
|
8
|
+
const BUBBLE_GAP = 7;
|
|
9
|
+
const BUBBLE_EDGE = 8;
|
|
10
|
+
function useBubblePosition(open, triggerRef, bubbleRef) {
|
|
11
|
+
const [pos, setPos] = useState(null);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
if (!open) return;
|
|
14
|
+
const bubbleEl = bubbleRef.current;
|
|
15
|
+
if (bubbleEl !== null && typeof bubbleEl.showPopover === "function") bubbleEl.showPopover();
|
|
16
|
+
const place = () => {
|
|
17
|
+
const trigger = triggerRef.current;
|
|
18
|
+
const bubble = bubbleRef.current;
|
|
19
|
+
if (trigger === null || bubble === null) return;
|
|
20
|
+
const t = trigger.getBoundingClientRect();
|
|
21
|
+
const b = bubble.getBoundingClientRect();
|
|
22
|
+
const viewW = document.documentElement.clientWidth;
|
|
23
|
+
const viewH = document.documentElement.clientHeight;
|
|
24
|
+
const below = t.bottom + BUBBLE_GAP;
|
|
25
|
+
const above = t.top - BUBBLE_GAP - b.height;
|
|
26
|
+
const top = below + b.height > viewH - BUBBLE_EDGE && above >= BUBBLE_EDGE ? above : below;
|
|
27
|
+
const left = Math.max(BUBBLE_EDGE, Math.min(t.left, viewW - BUBBLE_EDGE - b.width));
|
|
28
|
+
setPos((prev) => prev?.top === top && prev.left === left ? prev : { top, left });
|
|
29
|
+
};
|
|
30
|
+
place();
|
|
31
|
+
window.addEventListener("scroll", place, true);
|
|
32
|
+
window.addEventListener("resize", place);
|
|
33
|
+
const observer = typeof ResizeObserver === "undefined" || bubbleRef.current === null ? void 0 : new ResizeObserver(place);
|
|
34
|
+
if (observer !== void 0 && bubbleRef.current !== null) observer.observe(bubbleRef.current);
|
|
35
|
+
return () => {
|
|
36
|
+
window.removeEventListener("scroll", place, true);
|
|
37
|
+
window.removeEventListener("resize", place);
|
|
38
|
+
observer?.disconnect();
|
|
39
|
+
if (bubbleEl !== null && typeof bubbleEl.hidePopover === "function" && bubbleEl.matches(":popover-open")) {
|
|
40
|
+
bubbleEl.hidePopover();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [open, triggerRef, bubbleRef]);
|
|
44
|
+
return { pos, setPos };
|
|
45
|
+
}
|
|
7
46
|
function InfoGlyph({
|
|
8
47
|
text,
|
|
9
48
|
note,
|
|
@@ -13,15 +52,24 @@ function InfoGlyph({
|
|
|
13
52
|
const [open, setOpen] = useState(false);
|
|
14
53
|
const tipId = useId();
|
|
15
54
|
const triggerRef = useRef(null);
|
|
55
|
+
const bubbleRef = useRef(null);
|
|
56
|
+
const { pos, setPos } = useBubblePosition(open, triggerRef, bubbleRef);
|
|
57
|
+
const close = () => {
|
|
58
|
+
setOpen(false);
|
|
59
|
+
setPos(null);
|
|
60
|
+
};
|
|
16
61
|
useEffect(() => {
|
|
17
62
|
if (!open) return;
|
|
18
63
|
const handlePointerDown = (event) => {
|
|
19
|
-
|
|
64
|
+
const target = event.target;
|
|
65
|
+
if (!(target instanceof Node)) return;
|
|
66
|
+
if (triggerRef.current?.contains(target) || bubbleRef.current?.contains(target)) return;
|
|
20
67
|
setOpen(false);
|
|
68
|
+
setPos(null);
|
|
21
69
|
};
|
|
22
70
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
23
71
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
24
|
-
}, [open]);
|
|
72
|
+
}, [open, setPos]);
|
|
25
73
|
return /* @__PURE__ */ jsxs("span", { className: cx(classes.info, className), children: [
|
|
26
74
|
/* @__PURE__ */ jsx(
|
|
27
75
|
"button",
|
|
@@ -34,20 +82,36 @@ function InfoGlyph({
|
|
|
34
82
|
"aria-describedby": open ? tipId : void 0,
|
|
35
83
|
"data-open": open,
|
|
36
84
|
onMouseEnter: () => setOpen(true),
|
|
37
|
-
onMouseLeave:
|
|
85
|
+
onMouseLeave: close,
|
|
38
86
|
onFocus: () => setOpen(true),
|
|
39
|
-
onBlur:
|
|
87
|
+
onBlur: close,
|
|
40
88
|
onClick: () => setOpen(true),
|
|
41
89
|
onKeyDown: (event) => {
|
|
42
|
-
if (event.key === "Escape")
|
|
90
|
+
if (event.key === "Escape") close();
|
|
43
91
|
},
|
|
44
92
|
children: /* @__PURE__ */ jsx("svg", { width: 11, height: 11, viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm0 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm0 5a1 1 0 0 1 1 1v7a1 1 0 1 1-2 0v-7a1 1 0 0 1 1-1z" }) })
|
|
45
93
|
}
|
|
46
94
|
),
|
|
47
|
-
open &&
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
95
|
+
open && // Rendered IN PLACE as a manual popover, shown into the top layer by `useBubblePosition`: the top
|
|
96
|
+
// layer escapes every ancestor's `overflow: hidden` and `container-type` (a card's), so the
|
|
97
|
+
// bubble needs no portal — `react-dom` is outside `./charts`' allowed import set
|
|
98
|
+
// (`scripts/check-dist-layering.mjs`, V2-SPEC § 9.8). Hidden until the first measure lands: a
|
|
99
|
+
// bubble painted at 0,0 for one frame is a flash in the corner.
|
|
100
|
+
/* @__PURE__ */ jsxs(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
ref: bubbleRef,
|
|
104
|
+
id: tipId,
|
|
105
|
+
role: "tooltip",
|
|
106
|
+
popover: "manual",
|
|
107
|
+
className: classes.infoBubble,
|
|
108
|
+
style: pos === null ? { top: 0, left: 0, visibility: "hidden" } : { top: pos.top, left: pos.left },
|
|
109
|
+
children: [
|
|
110
|
+
text,
|
|
111
|
+
note !== void 0 && /* @__PURE__ */ jsx("span", { className: classes.foldNote, children: note })
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
)
|
|
51
115
|
] });
|
|
52
116
|
}
|
|
53
117
|
function WidgetHeader({
|
|
@@ -267,7 +267,9 @@
|
|
|
267
267
|
color: var(--vx-muted);
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
/* Folded-subtitle pieces: hidden until a `basalt-card` narrower than 480px shows them (below).
|
|
270
|
+
/* Folded-subtitle pieces: hidden until a `basalt-card` narrower than 480px shows them (below). The
|
|
271
|
+
* bubble is a top-layer popover but stays in the card's DOM subtree, so these ancestor-based rules
|
|
272
|
+
* (container query, short-card flag) still reach `.foldNote` inside it. */
|
|
271
273
|
.foldGlyph,
|
|
272
274
|
.foldNote {
|
|
273
275
|
display: none;
|
|
@@ -275,19 +277,25 @@
|
|
|
275
277
|
|
|
276
278
|
/*
|
|
277
279
|
* The tooltip bubble reads like every other floating surface — panel bg + `shadow-card` + card
|
|
278
|
-
* radius (docs/DESIGN-SPEC.md §5). It opens DOWNWARD
|
|
279
|
-
*
|
|
280
|
-
*
|
|
280
|
+
* radius (docs/DESIGN-SPEC.md §5). It opens DOWNWARD and flips up at the viewport edge.
|
|
281
|
+
* `pointer-events: none` so it can never swallow the pointer on its way back to the trigger's
|
|
282
|
+
* `mouseleave`. Mantine-free by design (this whole folder is), so it is a plain
|
|
281
283
|
* state-driven bubble rather than a Mantine Tooltip — which is also what makes it composable from
|
|
282
284
|
* inside the `charts/` boundary.
|
|
283
285
|
*/
|
|
284
286
|
.infoBubble {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
/* A `popover="manual"` element in the top layer, so no card's `overflow: hidden` or
|
|
288
|
+
* `container-type` clips it; placed from the trigger's rect (`useBubblePosition`), `top`/`left`
|
|
289
|
+
* arrive inline. The UA popover styles (centred, bordered, padded, Canvas background) are reset. */
|
|
290
|
+
position: fixed;
|
|
291
|
+
inset: auto;
|
|
292
|
+
margin: 0;
|
|
293
|
+
border: 0;
|
|
294
|
+
overflow: visible;
|
|
295
|
+
z-index: var(--mantine-z-index-popover, 300);
|
|
289
296
|
width: max-content;
|
|
290
|
-
|
|
297
|
+
/* 100% of the viewport (fixed): 2 × BUBBLE_EDGE in widget-header.tsx. */
|
|
298
|
+
max-width: min(260px, calc(100% - 16px));
|
|
291
299
|
padding: var(--vx-space-stack-sm) var(--vx-space-row-inset-x);
|
|
292
300
|
border-radius: var(--vx-radius-card);
|
|
293
301
|
background-color: var(--vx-surface-panel);
|
|
@@ -306,24 +314,24 @@
|
|
|
306
314
|
display: inline-flex;
|
|
307
315
|
flex: none;
|
|
308
316
|
white-space: nowrap;
|
|
309
|
-
align-items:
|
|
317
|
+
align-items: baseline;
|
|
310
318
|
gap: 3px;
|
|
311
|
-
border-radius: var(--vx-radius-ctrl);
|
|
312
|
-
padding: var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x);
|
|
313
319
|
font-family: var(--basalt-font-mono);
|
|
314
|
-
font-size: var(--vx-text-
|
|
315
|
-
font-weight:
|
|
320
|
+
font-size: var(--vx-text-sm);
|
|
321
|
+
font-weight: 500;
|
|
316
322
|
line-height: 1;
|
|
317
323
|
}
|
|
318
324
|
|
|
325
|
+
/* The glyph is direction, not a figure: the `micro` rung, so it never lands between two sizes. */
|
|
319
326
|
.deltaGlyph {
|
|
320
|
-
font-size:
|
|
327
|
+
font-size: var(--vx-text-micro);
|
|
321
328
|
}
|
|
322
329
|
|
|
323
330
|
.deltaPeriod {
|
|
324
331
|
margin-inline-start: 4px;
|
|
325
|
-
font-
|
|
326
|
-
|
|
332
|
+
font-size: var(--vx-text-micro);
|
|
333
|
+
font-weight: 400;
|
|
334
|
+
color: var(--vx-muted);
|
|
327
335
|
}
|
|
328
336
|
|
|
329
337
|
/* Card narrower than 480px: the subtitle folds into the info glyph (`InfoGlyph`'s `note`, or
|
package/dist/guard/index.js
CHANGED
|
@@ -259,12 +259,12 @@ const DEFAULT_GUARD_CONFIG = {
|
|
|
259
259
|
const GRACE_PERIOD_KINDS = {
|
|
260
260
|
"raw-spacing": {
|
|
261
261
|
since: "2.16.0",
|
|
262
|
-
promote: "2.
|
|
262
|
+
promote: "2.24.0",
|
|
263
263
|
why: "The spacing scale moved to 8/12/16/20/24 in 2.16.0: a prop value equal to a NEW step (p={16}) is newly a finding."
|
|
264
264
|
},
|
|
265
265
|
"inline-spacing": {
|
|
266
266
|
since: "2.16.0",
|
|
267
|
-
promote: "2.
|
|
267
|
+
promote: "2.24.0",
|
|
268
268
|
why: "The scale moved to 8/12/16/20/24 and the CSS micro ceiling dropped 10 \u2192 7 in 2.16.0: a literal 8px/10px in CSS is newly a finding."
|
|
269
269
|
}
|
|
270
270
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component `vars` that carry the Wave 33 chrome (`docs/waves/design-parity/SPEC.md` § 6.12) and the
|
|
3
|
+
* ON-COLOR re-point they sit beside. Pure functions of theme + props, kept out of `theme/index.ts`
|
|
4
|
+
* so the tests can call them directly.
|
|
5
|
+
*/
|
|
6
|
+
import type { MantineTheme } from '@mantine/core';
|
|
7
|
+
/**
|
|
8
|
+
* ON-COLOR: the foreground for a filled surface, decided in CSS. THE fix for Mantine's
|
|
9
|
+
* scheme-blind, contrast-blind `autoContrast`.
|
|
10
|
+
*
|
|
11
|
+
* Mantine picks the filled-variant text color ONCE, in JS, via `parseThemeColor({ color, theme })`
|
|
12
|
+
* — with NO `colorScheme` argument, so it resolves against the LIGHT `primaryShade` and bakes a
|
|
13
|
+
* static `color: var(--mantine-color-white)` into the element, while the BACKGROUND it pairs that
|
|
14
|
+
* with (`--mantine-color-{c}-filled`) stays a scheme-reactive CSS var. It gets away with it
|
|
15
|
+
* upstream only because Mantine's default `primaryShade` is `{ light: 6, dark: 8 }` — DARKER on
|
|
16
|
+
* dark, so white happens to stay right. It is luck, not logic: point `primaryShade.dark` at a
|
|
17
|
+
* lighter shade (as Basalt originally did) and every filled control in dark mode turns white-on-
|
|
18
|
+
* light. And even in one scheme the pick is wrong, because `isLightColor` is a BT.601 BRIGHTNESS
|
|
19
|
+
* test that does not track WCAG contrast — it handed white to lime `#97ba2e` at 2.24:1.
|
|
20
|
+
*
|
|
21
|
+
* Basalt removes the JS decision entirely. A fill is now scheme-INDEPENDENT and sits in a
|
|
22
|
+
* luminance band chosen so a WHITE label always clears AA (see `FILL` / `ACCENT` in
|
|
23
|
+
* tokens/palette.ts), so the on-color is a token, not a computation. `--vx-on-{color}` is emitted
|
|
24
|
+
* per color and resolves in pure CSS at paint time — the same discipline the rest of the `--vx-*`
|
|
25
|
+
* system follows. It is still MEASURED here (`legibleOn`) rather than hardcoded to white, so a
|
|
26
|
+
* consumer that retunes a family outside the band still gets the legible foreground.
|
|
27
|
+
*
|
|
28
|
+
* The palette already KNEW the answer: `ACCENT.onAccent` ("text on an accent fill") existed, and
|
|
29
|
+
* `Composer`'s send button hand-wired `color: var(--vx-on-accent)` — which was the ONLY reason that
|
|
30
|
+
* one control stayed legible while every generic Mantine control did not. The token was right;
|
|
31
|
+
* nothing bound the chrome to it. It is bound now (see `accentBridge` / `familyBridge`), and the
|
|
32
|
+
* Composer no longer needs the override.
|
|
33
|
+
*
|
|
34
|
+
* Fix: never let a foreground be decided in JS. `--vx-on-{color}` is emitted per color under BOTH
|
|
35
|
+
* scheme blocks of `cssVariablesResolver` (each resolved against the shade that scheme actually
|
|
36
|
+
* paints), so the foreground resolves in pure CSS at paint time — the same discipline the rest of
|
|
37
|
+
* the `--vx-*` system already follows. `basaltVariantColorResolver` re-points every filled variant
|
|
38
|
+
* at it, and the components that bypass the variant resolver (Checkbox / Radio / Tabs / Pagination /
|
|
39
|
+
* Stepper / Indicator / Timeline all call Mantine's `getContrastColor` directly) are re-pointed at
|
|
40
|
+
* it too, in `components` below. Regression-locked by `contrast.test.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function onColor(theme: MantineTheme, color: string | undefined): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The on-color for a component that bypasses the variant resolver and calls Mantine's
|
|
45
|
+
* `getContrastColor` directly. `undefined` (autoContrast off, or a hex / indexed color) leaves
|
|
46
|
+
* Mantine's own value in place — `mergeVars` strips undefined before merging.
|
|
47
|
+
*/
|
|
48
|
+
export declare function onColorFor(theme: MantineTheme, props: {
|
|
49
|
+
color?: string | undefined;
|
|
50
|
+
autoContrast?: boolean | undefined;
|
|
51
|
+
}): string | undefined;
|
|
52
|
+
/** The chrome opt-out: a call site that names a colour (even the primary one) keeps its hue. */
|
|
53
|
+
export declare function hasExplicitColor(color: string | undefined): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* A `subtle` Button / ActionIcon that names no colour takes neutral ink for its label and an
|
|
56
|
+
* ink-6% hover (`docs/DESIGN-SPEC.md` §5 ghost idiom). An explicit `color=` — the primary one
|
|
57
|
+
* included — keeps Mantine's tinted label and hover: `color="red"` on a destructive text action
|
|
58
|
+
* carries its hue as the whole signal. Mantine hands the variant resolver `color || primaryColor`,
|
|
59
|
+
* so only the component props can tell "unnamed" from "primary" — hence vars, not the resolver.
|
|
60
|
+
*/
|
|
61
|
+
export declare function subtleInkVars(props: {
|
|
62
|
+
color?: string | undefined;
|
|
63
|
+
variant?: string | undefined;
|
|
64
|
+
}): {
|
|
65
|
+
color: string | undefined;
|
|
66
|
+
hover: string | undefined;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Tabs vars: the on-color re-point plus the active underline in ink (SPEC § 6.12). Only the
|
|
70
|
+
* underline `default` variant takes ink (`pills` fills with the colour); an explicit `color=` opts
|
|
71
|
+
* out. The return type lists `--tabs-text-color` and `--tabs-radius` because Mantine's
|
|
72
|
+
* `TabsCssVariables` type declares only `--tabs-color` / `--tabs-radius` while Tabs' OWN
|
|
73
|
+
* varsResolver writes `--tabs-text-color` (an upstream type gap).
|
|
74
|
+
*/
|
|
75
|
+
export declare function tabsVars(theme: MantineTheme, props: {
|
|
76
|
+
color?: string | undefined;
|
|
77
|
+
variant?: string | undefined;
|
|
78
|
+
autoContrast?: boolean | undefined;
|
|
79
|
+
}): {
|
|
80
|
+
root: Record<'--tabs-color' | '--tabs-radius' | '--tabs-text-color', string | undefined>;
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=chrome-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome-vars.d.ts","sourceRoot":"","sources":["../../src/theme/chrome-vars.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI1F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GACxE,MAAM,GAAG,SAAS,CAGpB;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEnE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,GAAG;IACF,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAMA;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE;IACL,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACnC,GACA;IAAE,IAAI,EAAE,MAAM,CAAC,cAAc,GAAG,eAAe,GAAG,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CAAE,CAS9F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function onColor(theme, color) {
|
|
2
|
+
const name = color ?? theme.primaryColor;
|
|
3
|
+
if (!Object.prototype.hasOwnProperty.call(theme.colors, name)) return void 0;
|
|
4
|
+
return `var(--vx-on-${name})`;
|
|
5
|
+
}
|
|
6
|
+
function onColorFor(theme, props) {
|
|
7
|
+
const autoContrast = props.autoContrast ?? theme.autoContrast;
|
|
8
|
+
return autoContrast ? onColor(theme, props.color) : void 0;
|
|
9
|
+
}
|
|
10
|
+
function hasExplicitColor(color) {
|
|
11
|
+
return color !== void 0;
|
|
12
|
+
}
|
|
13
|
+
function subtleInkVars(props) {
|
|
14
|
+
const ink = props.variant === "subtle" && !hasExplicitColor(props.color);
|
|
15
|
+
return {
|
|
16
|
+
color: ink ? "var(--vx-ink)" : void 0,
|
|
17
|
+
hover: ink ? "color-mix(in srgb, var(--vx-ink) 6%, transparent)" : void 0
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function tabsVars(theme, props) {
|
|
21
|
+
const underline = !hasExplicitColor(props.color) && (props.variant ?? "default") === "default";
|
|
22
|
+
return {
|
|
23
|
+
root: {
|
|
24
|
+
"--tabs-text-color": onColorFor(theme, props),
|
|
25
|
+
"--tabs-color": underline ? "var(--vx-ink)" : void 0,
|
|
26
|
+
"--tabs-radius": void 0
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
hasExplicitColor,
|
|
32
|
+
onColor,
|
|
33
|
+
onColorFor,
|
|
34
|
+
subtleInkVars,
|
|
35
|
+
tabsVars
|
|
36
|
+
};
|