basalt-ui 2.19.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/MIGRATING.md +291 -12
  3. package/agent/agents/basalt-design-reviewer.md +22 -5
  4. package/agent/rules/basalt-charts.md +1 -1
  5. package/agent/rules/basalt-mantine.md +1 -1
  6. package/agent/rules/basalt-tokens.md +2 -2
  7. package/agent/skills/basalt-app/SKILL.md +1 -1
  8. package/agent/skills/basalt-design/SKILL.md +10 -23
  9. package/agent/skills/basalt-design/references/anti-defaults.md +24 -0
  10. package/agent/skills/basalt-design/references/catalogue.md +48 -0
  11. package/agent/skills/basalt-design/references/concept.md +36 -0
  12. package/agent/skills/basalt-design/references/encoding-rules.md +45 -0
  13. package/agent/skills/basalt-design/references/stat-tile.md +24 -0
  14. package/agent/templates/AGENTS-block.md.tpl +3 -3
  15. package/agent/templates/DESIGN.md.tpl +1 -1
  16. package/configs/oxlint-plugin.js +34 -19
  17. package/configs/oxlint-plugin.test.ts +32 -2
  18. package/dist/charts/ChartCard.d.ts +33 -4
  19. package/dist/charts/ChartCard.d.ts.map +1 -1
  20. package/dist/charts/ChartCard.js +37 -11
  21. package/dist/charts/Donut.d.ts.map +1 -1
  22. package/dist/charts/Donut.js +13 -1
  23. package/dist/charts/Heatmap.js +1 -1
  24. package/dist/charts/Sparkline.d.ts +7 -1
  25. package/dist/charts/Sparkline.d.ts.map +1 -1
  26. package/dist/charts/Sparkline.js +137 -18
  27. package/dist/charts/box.d.ts +2 -0
  28. package/dist/charts/box.d.ts.map +1 -1
  29. package/dist/charts/box.js +2 -0
  30. package/dist/charts/chart-box.module.css +30 -0
  31. package/dist/charts/chart-box.module.css.d.ts +1 -0
  32. package/dist/charts/chart-card.module.css +47 -0
  33. package/dist/charts/chart-card.module.css.d.ts +7 -0
  34. package/dist/charts/compile.d.ts.map +1 -1
  35. package/dist/charts/compile.js +35 -8
  36. package/dist/charts/host.d.ts.map +1 -1
  37. package/dist/charts/host.js +2 -1
  38. package/dist/charts/index.d.ts +1 -1
  39. package/dist/charts/index.d.ts.map +1 -1
  40. package/dist/charts/sparkline.module.css +59 -0
  41. package/dist/charts/sparkline.module.css.d.ts +13 -0
  42. package/dist/charts/state.d.ts +5 -0
  43. package/dist/charts/state.d.ts.map +1 -1
  44. package/dist/charts/state.js +34 -4
  45. package/dist/charts/types.d.ts +6 -0
  46. package/dist/charts/types.d.ts.map +1 -1
  47. package/dist/cli/check-theme.d.ts.map +1 -1
  48. package/dist/cli/check-theme.js +3 -0
  49. package/dist/cli/help.d.ts.map +1 -1
  50. package/dist/cli/help.js +3 -2
  51. package/dist/cli/index.d.ts +4 -2
  52. package/dist/cli/index.d.ts.map +1 -1
  53. package/dist/cli/index.js +27 -15
  54. package/dist/cli/init.d.ts.map +1 -1
  55. package/dist/cli/init.js +3 -2
  56. package/dist/cli/shot/capture.d.ts.map +1 -1
  57. package/dist/cli/shot/capture.js +6 -1
  58. package/dist/cli/shot/detect.d.ts +51 -0
  59. package/dist/cli/shot/detect.d.ts.map +1 -0
  60. package/dist/cli/shot/detect.js +396 -0
  61. package/dist/cli/shot/index.d.ts.map +1 -1
  62. package/dist/cli/shot/index.js +7 -4
  63. package/dist/cli/shot/measure.d.ts +2 -0
  64. package/dist/cli/shot/measure.d.ts.map +1 -1
  65. package/dist/cli/shot/measure.js +2 -0
  66. package/dist/cli/shot/types.d.ts +4 -1
  67. package/dist/cli/shot/types.d.ts.map +1 -1
  68. package/dist/cli/shot/types.js +2 -0
  69. package/dist/cli/sync.d.ts +2 -0
  70. package/dist/cli/sync.d.ts.map +1 -1
  71. package/dist/cli/sync.js +2 -2
  72. package/dist/common/retry-button.d.ts +12 -0
  73. package/dist/common/retry-button.d.ts.map +1 -0
  74. package/dist/common/retry-button.js +22 -0
  75. package/dist/common/retry-button.module.css +58 -0
  76. package/dist/common/retry-button.module.css.d.ts +8 -0
  77. package/dist/controls/sync-button.d.ts +3 -0
  78. package/dist/controls/sync-button.d.ts.map +1 -1
  79. package/dist/dashboard/bar-list.d.ts +18 -4
  80. package/dist/dashboard/bar-list.d.ts.map +1 -1
  81. package/dist/dashboard/bar-list.js +39 -15
  82. package/dist/dashboard/bar-list.module.css +77 -2
  83. package/dist/dashboard/bar-list.module.css.d.ts +1 -0
  84. package/dist/dashboard/delta-badge.d.ts +8 -3
  85. package/dist/dashboard/delta-badge.d.ts.map +1 -1
  86. package/dist/dashboard/delta-badge.js +9 -2
  87. package/dist/dashboard/index.d.ts +2 -0
  88. package/dist/dashboard/index.d.ts.map +1 -1
  89. package/dist/dashboard/meter-model.d.ts +53 -6
  90. package/dist/dashboard/meter-model.d.ts.map +1 -1
  91. package/dist/dashboard/meter-model.js +62 -14
  92. package/dist/dashboard/meter-parts.d.ts +5 -1
  93. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  94. package/dist/dashboard/meter-parts.js +140 -68
  95. package/dist/dashboard/meter.d.ts +29 -4
  96. package/dist/dashboard/meter.d.ts.map +1 -1
  97. package/dist/dashboard/meter.js +8 -1
  98. package/dist/dashboard/meter.module.css +74 -43
  99. package/dist/dashboard/meter.module.css.d.ts +4 -4
  100. package/dist/dashboard/query-state.d.ts +1 -1
  101. package/dist/dashboard/query-state.d.ts.map +1 -1
  102. package/dist/dashboard/query-state.js +16 -10
  103. package/dist/dashboard/settings-section.d.ts.map +1 -1
  104. package/dist/dashboard/settings-section.js +14 -25
  105. package/dist/dashboard/stat-card-parts.js +1 -1
  106. package/dist/dashboard/stat-card.d.ts +1 -1
  107. package/dist/dashboard/stat-card.d.ts.map +1 -1
  108. package/dist/dashboard/stat-card.js +5 -7
  109. package/dist/dashboard/stat-card.module.css +15 -7
  110. package/dist/dashboard/stat-group.d.ts +11 -2
  111. package/dist/dashboard/stat-group.d.ts.map +1 -1
  112. package/dist/dashboard/stat-group.js +9 -7
  113. package/dist/dashboard/stat-strip.d.ts +67 -0
  114. package/dist/dashboard/stat-strip.d.ts.map +1 -0
  115. package/dist/dashboard/stat-strip.js +115 -0
  116. package/dist/dashboard/stat-strip.module.css +291 -0
  117. package/dist/dashboard/stat-strip.module.css.d.ts +32 -0
  118. package/dist/dashboard/visual-slot.d.ts +2 -0
  119. package/dist/dashboard/visual-slot.d.ts.map +1 -0
  120. package/dist/dashboard/visual-slot.js +5 -0
  121. package/dist/dashboard/widget-header.d.ts +3 -3
  122. package/dist/dashboard/widget-header.module.css +10 -6
  123. package/dist/format/date.d.ts.map +1 -1
  124. package/dist/format/date.js +4 -3
  125. package/dist/format/shared.d.ts +6 -0
  126. package/dist/format/shared.d.ts.map +1 -1
  127. package/dist/format/shared.js +6 -2
  128. package/dist/guard/index.d.ts +16 -3
  129. package/dist/guard/index.d.ts.map +1 -1
  130. package/dist/guard/index.js +15 -1
  131. package/dist/guard/palette.d.ts +51 -0
  132. package/dist/guard/palette.d.ts.map +1 -0
  133. package/dist/guard/palette.js +190 -0
  134. package/dist/guard/series-file.d.ts +15 -0
  135. package/dist/guard/series-file.d.ts.map +1 -0
  136. package/dist/guard/series-file.js +29 -0
  137. package/dist/guard/types.d.ts +3 -3
  138. package/dist/guard/types.d.ts.map +1 -1
  139. package/dist/index.d.ts +3 -1
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +4 -0
  142. package/dist/styles.css +6 -0
  143. package/dist/surfaces.d.ts +1 -1
  144. package/dist/surfaces.d.ts.map +1 -1
  145. package/dist/surfaces.js +2 -0
  146. package/dist/theme/card-inset.module.css +76 -0
  147. package/dist/theme/card-inset.module.css.d.ts +9 -0
  148. package/dist/theme/controls.module.css +13 -0
  149. package/dist/theme/index.d.ts.map +1 -1
  150. package/dist/theme/index.js +41 -0
  151. package/dist/theme/nav-link.module.css +8 -10
  152. package/dist/theme/status-dot.d.ts +3 -2
  153. package/dist/theme/status-dot.d.ts.map +1 -1
  154. package/dist/theme/status-dot.js +12 -3
  155. package/dist/theme/status-verdict.d.ts +3 -2
  156. package/dist/theme/status-verdict.d.ts.map +1 -1
  157. package/dist/theme/status-verdict.js +3 -2
  158. package/dist/theme/status-verdict.module.css +4 -2
  159. package/dist/tokens/oklab.d.ts +28 -0
  160. package/dist/tokens/oklab.d.ts.map +1 -0
  161. package/dist/tokens/oklab.js +73 -0
  162. package/llms.txt +33 -7
  163. package/package.json +1 -1
  164. package/src/charts/ChartCard.tsx +79 -5
  165. package/src/charts/Donut.tsx +9 -1
  166. package/src/charts/Heatmap.tsx +1 -1
  167. package/src/charts/Sparkline.tsx +180 -18
  168. package/src/charts/box.tsx +2 -0
  169. package/src/charts/chart-box.module.css +30 -0
  170. package/src/charts/chart-box.module.css.d.ts +1 -0
  171. package/src/charts/chart-card.module.css +47 -0
  172. package/src/charts/chart-card.module.css.d.ts +7 -0
  173. package/src/charts/compile.ts +42 -9
  174. package/src/charts/host.tsx +6 -3
  175. package/src/charts/index.ts +1 -1
  176. package/src/charts/sparkline.module.css +59 -0
  177. package/src/charts/sparkline.module.css.d.ts +13 -0
  178. package/src/charts/state.tsx +53 -4
  179. package/src/charts/types.ts +6 -0
  180. package/src/cli/check-theme.ts +3 -0
  181. package/src/cli/help.ts +18 -1
  182. package/src/cli/index.ts +48 -17
  183. package/src/cli/init.ts +2 -1
  184. package/src/cli/shot/capture.ts +15 -2
  185. package/src/cli/shot/detect.ts +533 -0
  186. package/src/cli/shot/index.ts +8 -4
  187. package/src/cli/shot/measure.ts +4 -0
  188. package/src/cli/shot/types.ts +5 -1
  189. package/src/cli/sync.ts +4 -2
  190. package/src/common/retry-button.module.css +58 -0
  191. package/src/common/retry-button.module.css.d.ts +8 -0
  192. package/src/common/retry-button.tsx +29 -0
  193. package/src/controls/sync-button.tsx +3 -0
  194. package/src/dashboard/bar-list.module.css +77 -2
  195. package/src/dashboard/bar-list.module.css.d.ts +1 -0
  196. package/src/dashboard/bar-list.tsx +89 -18
  197. package/src/dashboard/delta-badge.tsx +21 -5
  198. package/src/dashboard/index.ts +2 -0
  199. package/src/dashboard/meter-model.ts +126 -20
  200. package/src/dashboard/meter-parts.tsx +224 -88
  201. package/src/dashboard/meter.module.css +74 -43
  202. package/src/dashboard/meter.module.css.d.ts +4 -4
  203. package/src/dashboard/meter.tsx +39 -5
  204. package/src/dashboard/query-state.tsx +26 -20
  205. package/src/dashboard/settings-section.tsx +1 -8
  206. package/src/dashboard/stat-card-parts.tsx +1 -1
  207. package/src/dashboard/stat-card.module.css +15 -7
  208. package/src/dashboard/stat-card.tsx +9 -9
  209. package/src/dashboard/stat-group.tsx +19 -8
  210. package/src/dashboard/stat-strip.module.css +291 -0
  211. package/src/dashboard/stat-strip.module.css.d.ts +32 -0
  212. package/src/dashboard/stat-strip.tsx +263 -0
  213. package/src/dashboard/visual-slot.ts +8 -0
  214. package/src/dashboard/widget-header.module.css +10 -6
  215. package/src/dashboard/widget-header.tsx +3 -3
  216. package/src/format/date.ts +6 -3
  217. package/src/format/shared.ts +11 -2
  218. package/src/guard/index.ts +17 -5
  219. package/src/guard/palette.ts +261 -0
  220. package/src/guard/series-file.ts +51 -0
  221. package/src/guard/types.ts +3 -2
  222. package/src/index.ts +7 -0
  223. package/src/styles.css +6 -0
  224. package/src/surfaces.ts +2 -0
  225. package/src/theme/__snapshots__/plain-theme.test.ts.snap +202 -24
  226. package/src/theme/card-inset.module.css +76 -0
  227. package/src/theme/card-inset.module.css.d.ts +9 -0
  228. package/src/theme/controls.module.css +13 -0
  229. package/src/theme/index.ts +56 -0
  230. package/src/theme/nav-link.module.css +8 -10
  231. package/src/theme/status-dot.tsx +17 -5
  232. package/src/theme/status-verdict.module.css +4 -2
  233. package/src/theme/status-verdict.tsx +9 -4
  234. package/src/tokens/oklab.ts +97 -0
@@ -0,0 +1,291 @@
1
+ /*
2
+ * StatGroup `variant="strip"`: one joined surface, cells split by 1px hairlines.
3
+ *
4
+ * The hairlines are LEADING edges (inline-start + block-start) drawn as outer box-shadows, so they
5
+ * take no layout space and every cell keeps the same `stack-md` inset. `.clip` hides the ones that
6
+ * lead a row or the strip by pulling the grid 1px up/left inside an `overflow: hidden` box. That is
7
+ * why the rail survives any column count and any wrap with no `nth-child` bookkeeping
8
+ * (`stat-group.module.css` needs it because its cells are not clipped). No coloured edge: the one
9
+ * surface is the Card's.
10
+ *
11
+ * The column law keys on the CONTAINER like `StatGroup`'s own: two columns at < 480px (the `regular` class boundary) with an odd
12
+ * last cell spanning, never one; up to three below 800px; the full `cols` from 800px.
13
+ */
14
+
15
+ .container {
16
+ container-type: inline-size;
17
+ container-name: basalt-grid;
18
+ }
19
+
20
+ .clip {
21
+ overflow: hidden;
22
+ }
23
+
24
+ .cells {
25
+ display: grid;
26
+ grid-template-columns: repeat(var(--basalt-strip-cols-sm), minmax(0, 1fr));
27
+ margin: -1px 0 0 -1px;
28
+ }
29
+
30
+ .cell {
31
+ display: grid;
32
+ grid-row: span 5;
33
+ grid-template-rows: subgrid;
34
+ min-width: 0;
35
+ padding: var(--vx-space-stack-md);
36
+ box-shadow:
37
+ -1px 0 0 var(--vx-divider),
38
+ 0 -1px 0 var(--vx-divider);
39
+ }
40
+
41
+ /* Forced colors drop box-shadows, so the hairlines come back as CanvasText borders. Every cell takes
42
+ * both, so they stay level with each other; `.clip` still hides the leading ones. */
43
+ @media (forced-colors: active) {
44
+ .cell {
45
+ border-inline-start: 1px solid CanvasText;
46
+ border-block-start: 1px solid CanvasText;
47
+ }
48
+ }
49
+
50
+ /* Cells align by PART. Every cell spans the same five tracks of `.cells` (caption, hero, visual,
51
+ * rows, footer), so a row of cells shares one caption top and one value baseline, and a void opens
52
+ * only where a sibling's same part is taller. A part a cell lacks collapses its track (the spacing
53
+ * is a margin on the part, not a gap, so an empty track adds none). A cell without a visual keeps
54
+ * its rows (and a footer without rows) in the visual track, directly under its hero: short cells
55
+ * stay compact instead of stretching their footer to the row's bottom. A footer under a visual
56
+ * rides in the visual track with it (`.visualStack`), so it hugs its own visual; only a rows
57
+ * cell's footer uses the shared footer track. A hero-less cell (rows only) starts its rows in the
58
+ * visual track, so the hero track above them is the one void, and only as tall as a sibling's
59
+ * value. */
60
+ .cell > * {
61
+ grid-column: 1;
62
+ min-width: 0;
63
+ }
64
+
65
+ .cell > :not(.captionLine) {
66
+ margin-block-start: var(--vx-space-stack-sm);
67
+ }
68
+
69
+ .valueRow,
70
+ .skeletonValue,
71
+ .error {
72
+ grid-row: 2;
73
+ }
74
+
75
+ .cell > .visualStack,
76
+ .cell > .reason,
77
+ .cell > .rows,
78
+ .cell > .footer {
79
+ grid-row: 3;
80
+ }
81
+
82
+ .cell[data-strip-has-visual] > .rows {
83
+ grid-row: 4;
84
+ }
85
+
86
+ .cell[data-strip-has-rows] > .footer {
87
+ grid-row: 5;
88
+ }
89
+
90
+ .cell > .footer {
91
+ align-self: start;
92
+ }
93
+
94
+ @container basalt-grid (max-width: 479.9px) {
95
+ .cells {
96
+ grid-template-columns: repeat(2, minmax(0, 1fr));
97
+ }
98
+
99
+ .cells > .cell:last-child:nth-child(odd) {
100
+ grid-column: 1 / -1;
101
+ }
102
+ }
103
+
104
+ @container basalt-grid (min-width: 800px) {
105
+ .cells {
106
+ grid-template-columns: repeat(var(--basalt-strip-cols), minmax(0, 1fr));
107
+ }
108
+ }
109
+
110
+ .captionLine {
111
+ grid-row: 1;
112
+ display: flex;
113
+ flex-wrap: wrap;
114
+ align-items: center;
115
+ column-gap: var(--vx-space-control-gap);
116
+ min-width: 0;
117
+ }
118
+
119
+ /* Caption and info glyph are one unit: the caption truncates, the glyph never leaves its line. */
120
+ .lead {
121
+ display: inline-flex;
122
+ align-items: center;
123
+ column-gap: var(--vx-space-control-gap);
124
+ min-width: 0;
125
+ max-width: 100%;
126
+ }
127
+
128
+ .caption {
129
+ margin: 0;
130
+ min-width: 0;
131
+ overflow: hidden;
132
+ text-overflow: ellipsis;
133
+ white-space: nowrap;
134
+ font-family: var(--basalt-font-mono);
135
+ font-size: var(--vx-text-micro);
136
+ font-weight: 500;
137
+ letter-spacing: 0.06em;
138
+ text-transform: uppercase;
139
+ color: var(--vx-faint);
140
+ }
141
+
142
+ /* The lowercase qualifier is the muted sans (mono is for the UPPERCASE caption only). It is one flex
143
+ * item, so when it does not fit beside the caption it wraps WHOLE onto its own line below. */
144
+ .qualifier {
145
+ font-size: var(--vx-text-micro);
146
+ color: var(--vx-muted);
147
+ overflow-wrap: anywhere;
148
+ }
149
+
150
+ .valueRow {
151
+ display: flex;
152
+ flex-wrap: wrap;
153
+ align-items: baseline;
154
+ column-gap: var(--vx-space-stack-sm);
155
+ min-width: 0;
156
+ }
157
+
158
+ /* The numeral face (proportional sans, lining figures; Wave 35 typography law): never mono. */
159
+ .value {
160
+ min-width: 0;
161
+ overflow-wrap: anywhere;
162
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
163
+ font-size: var(--vx-text-kpi);
164
+ line-height: 1.25;
165
+ font-weight: 500;
166
+ letter-spacing: -0.02em;
167
+ font-variant-numeric: lining-nums;
168
+ color: var(--vx-ink);
169
+ }
170
+
171
+ .unit {
172
+ flex-shrink: 0;
173
+ font-size: var(--vx-text-sm);
174
+ font-weight: 500;
175
+ color: var(--vx-muted);
176
+ }
177
+
178
+ .skeletonValue {
179
+ width: 45%;
180
+ height: calc(var(--vx-text-kpi) * 1.25);
181
+ }
182
+
183
+ .cell[data-stale] {
184
+ /* The package's one dimmed-state value (controls.module.css, panel-row.module.css). */
185
+ opacity: 0.55;
186
+ }
187
+
188
+ .skeletonRow {
189
+ width: 100%;
190
+ height: 0.75rem;
191
+ }
192
+
193
+ .visual {
194
+ min-width: 0;
195
+ }
196
+
197
+ .visualStack > .footer {
198
+ margin-block-start: var(--vx-space-stack-sm);
199
+ }
200
+
201
+ /* A Sparkline's hover readout takes this line above its plot (`charts/sparkline.module.css`). The
202
+ * cell's own stack gap already sits above it; the slot reserves the rest, so the chip never covers
203
+ * the value. */
204
+ .cell {
205
+ --basalt-spark-readout-h: 1.125rem;
206
+ }
207
+
208
+ .visual:has([data-basalt-sparkline]) {
209
+ padding-top: max(0px, calc(var(--basalt-spark-readout-h) - var(--vx-space-stack-sm)));
210
+ }
211
+
212
+ /* An empty cell's reason and an errored cell's message: one muted `sm` line, wrapping rather than
213
+ * clipping (a 390px two-column cell is ~170px wide). */
214
+ .reason {
215
+ margin: 0;
216
+ min-width: 0;
217
+ font-size: var(--vx-text-sm);
218
+ line-height: 1.3;
219
+ color: var(--vx-muted);
220
+ overflow-wrap: anywhere;
221
+ }
222
+
223
+ /* The compact error anatomy: dot + word, the message, Retry — a left-aligned stack in the cell. */
224
+ .error {
225
+ display: flex;
226
+ flex-direction: column;
227
+ align-items: flex-start;
228
+ gap: var(--vx-space-stack-xs);
229
+ min-width: 0;
230
+ }
231
+
232
+ .errorHead {
233
+ display: inline-flex;
234
+ align-items: center;
235
+ gap: var(--vx-space-stack-sm);
236
+ font-size: var(--vx-text-sm);
237
+ font-weight: 500;
238
+ color: var(--vx-ink);
239
+ }
240
+
241
+ .footer {
242
+ font-size: var(--vx-text-sm);
243
+ color: var(--vx-muted);
244
+ }
245
+
246
+ /* ── multi-row cell: label · visual · value · delta ──────────────────────────────────────────── */
247
+
248
+ .rows {
249
+ display: flex;
250
+ flex-direction: column;
251
+ gap: var(--vx-space-stack-sm);
252
+ margin: 0;
253
+ padding: 0;
254
+ list-style: none;
255
+ }
256
+
257
+ .row {
258
+ display: grid;
259
+ grid-template-columns: minmax(3.5rem, auto) minmax(0, 1fr) auto auto;
260
+ align-items: center;
261
+ column-gap: var(--vx-space-stack-sm);
262
+ }
263
+
264
+ .rowLabel {
265
+ font-size: var(--vx-text-sm);
266
+ color: var(--vx-muted);
267
+ }
268
+
269
+ .rowValue {
270
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
271
+ font-size: var(--vx-text-sm);
272
+ font-weight: 500;
273
+ font-variant-numeric: lining-nums;
274
+ color: var(--vx-ink);
275
+ }
276
+
277
+ /* ── footer row: wider cells under the cells, split by the same hairline ─────────────────────── */
278
+
279
+ .footerRow {
280
+ display: flex;
281
+ flex-wrap: wrap;
282
+ margin-left: -1px;
283
+ }
284
+
285
+ .footerCell {
286
+ flex: 1 1 14rem;
287
+ min-width: 0;
288
+ padding: var(--vx-space-stack-md);
289
+ border-inline-start: 1px solid var(--vx-divider);
290
+ border-block-start: 1px solid var(--vx-divider);
291
+ }
@@ -0,0 +1,32 @@
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 container: string
7
+ readonly clip: string
8
+ readonly cells: string
9
+ readonly cell: string
10
+ readonly captionLine: string
11
+ readonly lead: string
12
+ readonly caption: string
13
+ readonly qualifier: string
14
+ readonly valueRow: string
15
+ readonly value: string
16
+ readonly unit: string
17
+ readonly skeletonValue: string
18
+ readonly skeletonRow: string
19
+ readonly visual: string
20
+ readonly visualStack: string
21
+ readonly reason: string
22
+ readonly error: string
23
+ readonly errorHead: string
24
+ readonly footer: string
25
+ readonly rows: string
26
+ readonly row: string
27
+ readonly rowLabel: string
28
+ readonly rowValue: string
29
+ readonly footerRow: string
30
+ readonly footerCell: string
31
+ }
32
+ export default classes
@@ -0,0 +1,263 @@
1
+ /**
2
+ * StatStrip — the body of `StatGroup variant="strip"`: KPI cells joined into one surface and split
3
+ * by hairlines, with an optional footer row of wider cells. Internal: reached through `StatGroup`.
4
+ *
5
+ * Cell anatomy: a mono caption (with `· qualifier` muted on the same line and the `info` glyph), the
6
+ * hero `value` in the proportional sans, an optional `delta`, `visual` and `footer` line. `rows`
7
+ * replaces the hero with aligned `label · visual · value · delta` rows (one cell, several signals).
8
+ * `tone` inks the VALUE only, for a verdict; a null reading is `—`. A cell may carry BOTH: the hero
9
+ * (e.g. VO2max) with `rows` under it; omit `value` to render the rows alone.
10
+ *
11
+ * `state` replaces the readings (hero, visual, rows, footer) with the cell's empty or error body, at
12
+ * the cell's size. Empty: `—` in the value position and the reason, muted. Error: the shared error
13
+ * anatomy compact — status dot, the word `Failed`, the message, the shared Retry. The caption stays.
14
+ * A `visual` is a hero host: a zoned `Meter` in it does not repeat the value at its marker.
15
+ *
16
+ * Alignment: cells of one row align by PART (caption, value, visual, rows, footer share tracks via
17
+ * subgrid), not by stretching; a cell without a visual keeps its footer directly under its content.
18
+ *
19
+ * Anchors: each cell is `data-shot="strip-<key>"` and each footer cell
20
+ * `data-shot="strip-footer-<key>"` (derived — a consumer cannot choose another name).
21
+ *
22
+ * Mapping from a prototype: warden's JSX `qualifier` line UNDER the value is `footer`; the cell
23
+ * `qualifier` is the short `· text` on the caption line. Cells are equal-weight: unequal column
24
+ * weights are not supported. `stale` dims a cell while placeholder data shows.
25
+ */
26
+ import { Card, Skeleton } from '@mantine/core'
27
+ import { useId } from 'react'
28
+ import type { CSSProperties, ReactNode } from 'react'
29
+ import { toErrorMessage } from '../common/errors'
30
+ import { cx } from '../common/props'
31
+ import type { BasaltProps, Tone } from '../common/props'
32
+ import { RetryButton } from '../common/retry-button'
33
+ import { StatusDot } from '../theme/status-dot'
34
+ import { VX } from '../tokens'
35
+ import { InfoGlyph } from './widget-header'
36
+ import classes from './stat-strip.module.css'
37
+ import { VisualSlotContext } from './visual-slot'
38
+
39
+ export type StatStripRow = {
40
+ key: string
41
+ label: string
42
+ /** `null` = no reading, printed as `—`. Pre-join the unit (`'48 ms'`). */
43
+ value: string | null
44
+ visual?: ReactNode
45
+ /** A `DeltaBadge`. */
46
+ delta?: ReactNode
47
+ }
48
+
49
+ /** What a cell shows instead of its readings. Mirrors `StatCard`'s `query` branches. */
50
+ type StatStripCellState =
51
+ | {
52
+ kind: 'empty'
53
+ /** Why there is no reading, one muted line (`'No sleep logged'`). */
54
+ reason?: string
55
+ }
56
+ | {
57
+ kind: 'error'
58
+ /** Whatever was thrown; decoded like `ErrorState`'s. */
59
+ error?: unknown
60
+ /** Renders the shared Retry button. */
61
+ onRetry?: () => void
62
+ /** A refetch is in flight: Retry is inert. */
63
+ retrying?: boolean
64
+ }
65
+
66
+ export type StatStripCell = {
67
+ key: string
68
+ caption: string
69
+ /** Muted, on the caption line: `CAPTION · qualifier`. */
70
+ qualifier?: string
71
+ /** The definition behind the caption, in the info-glyph tooltip. */
72
+ info?: string
73
+ /** `null` = no reading, printed as `—`. Omit only when `rows` carries the cell. */
74
+ value?: string | null
75
+ unit?: string
76
+ /** A `DeltaBadge`. */
77
+ delta?: ReactNode
78
+ /** The micro-visual slot (Meter / Sparkline / BandStrip). */
79
+ visual?: ReactNode
80
+ /** A muted line pinned to the cell foot. */
81
+ footer?: ReactNode
82
+ /** Aligned signals under the hero (or alone when `value` is omitted). */
83
+ rows?: readonly StatStripRow[]
84
+ /** Inks the value only — set it when the reading is a verdict. */
85
+ tone?: Tone
86
+ /** Skeleton in place of the readings. */
87
+ loading?: boolean
88
+ /** Dims the cell while placeholder data shows. */
89
+ stale?: boolean
90
+ /** Empty or failed: replaces the readings; `loading` wins while pending. */
91
+ state?: StatStripCellState
92
+ }
93
+
94
+ export type StatStripProps = BasaltProps & {
95
+ /** The strip's accessible name. */
96
+ label: string
97
+ cells: readonly StatStripCell[]
98
+ /** Wider cells under the cells. */
99
+ footer?: readonly { key: string; content: ReactNode }[]
100
+ /** The DESKTOP column count. Default: the cell count, capped at 6. */
101
+ cols?: 2 | 3 | 4 | 5 | 6
102
+ }
103
+
104
+ const EMPTY = '—'
105
+
106
+ function CellState({ state }: { state: StatStripCellState }) {
107
+ if (state.kind === 'empty') {
108
+ return (
109
+ <>
110
+ <div className={classes.valueRow}>
111
+ <span className={classes.value} data-strip-value>
112
+ {EMPTY}
113
+ </span>
114
+ </div>
115
+ {state.reason !== undefined && <p className={classes.reason}>{state.reason}</p>}
116
+ </>
117
+ )
118
+ }
119
+ const message = toErrorMessage(state.error, 'The request failed.')
120
+ return (
121
+ <div className={classes.error} role="alert" data-strip-state="error">
122
+ <span className={classes.errorHead}>
123
+ <StatusDot color={VX.status.bad} />
124
+ Failed
125
+ </span>
126
+ <p className={classes.reason}>{message}</p>
127
+ {state.onRetry !== undefined && (
128
+ <RetryButton onClick={state.onRetry} retrying={state.retrying ?? false} />
129
+ )}
130
+ </div>
131
+ )
132
+ }
133
+
134
+ function StripCell({ cell }: { cell: StatStripCell }) {
135
+ const captionId = useId()
136
+ const { rows, loading } = cell
137
+ const state = loading ? undefined : cell.state
138
+ const hasHero = cell.value !== undefined || rows === undefined
139
+ // A footer under a visual (and no rows) rides with it, so it hugs that visual instead of dropping
140
+ // to a taller sibling's; under rows, or with neither, it takes the row's shared footer track.
141
+ const ownFooter = cell.visual !== undefined && rows === undefined
142
+ const footerEl = cell.footer !== undefined && (
143
+ <div className={classes.footer} data-strip-footer>
144
+ {cell.footer}
145
+ </div>
146
+ )
147
+ return (
148
+ <article
149
+ className={classes.cell}
150
+ data-strip-cell={cell.key}
151
+ data-shot={`strip-${cell.key}`}
152
+ aria-labelledby={captionId}
153
+ {...(state === undefined && cell.visual !== undefined && { 'data-strip-has-visual': '' })}
154
+ {...(state === undefined && rows !== undefined && { 'data-strip-has-rows': '' })}
155
+ {...(cell.stale && { 'data-stale': 'true' })}
156
+ >
157
+ <div className={classes.captionLine}>
158
+ {/* The caption and its info glyph are one unit: the qualifier wraps whole, never between them. */}
159
+ <span className={classes.lead}>
160
+ <span className={classes.caption} id={captionId} title={cell.caption} data-strip-caption>
161
+ {cell.caption}
162
+ </span>
163
+ {cell.info !== undefined && <InfoGlyph text={cell.info} />}
164
+ </span>
165
+ {cell.qualifier !== undefined && (
166
+ <span className={classes.qualifier}>{cell.qualifier}</span>
167
+ )}
168
+ </div>
169
+ {state !== undefined && <CellState state={state} />}
170
+ {state === undefined &&
171
+ hasHero &&
172
+ (loading ? (
173
+ <Skeleton className={classes.skeletonValue} radius="sm" />
174
+ ) : (
175
+ <div className={classes.valueRow}>
176
+ <span
177
+ className={classes.value}
178
+ data-strip-value
179
+ style={cell.tone !== undefined ? { color: VX.status[cell.tone] } : undefined}
180
+ >
181
+ {cell.value ?? EMPTY}
182
+ </span>
183
+ {cell.value !== undefined && cell.value !== null && cell.unit !== undefined && (
184
+ <span className={classes.unit}>{cell.unit}</span>
185
+ )}
186
+ {cell.delta}
187
+ </div>
188
+ ))}
189
+ {state === undefined && cell.visual !== undefined && (
190
+ <div className={classes.visualStack}>
191
+ <div className={classes.visual} data-strip-visual>
192
+ <VisualSlotContext.Provider value={hasHero}>{cell.visual}</VisualSlotContext.Provider>
193
+ </div>
194
+ {ownFooter && footerEl}
195
+ </div>
196
+ )}
197
+ {state === undefined &&
198
+ rows !== undefined &&
199
+ (loading ? (
200
+ <div className={classes.rows} aria-hidden="true">
201
+ {rows.map((row) => (
202
+ <Skeleton key={row.key} className={classes.skeletonRow} radius="sm" />
203
+ ))}
204
+ </div>
205
+ ) : (
206
+ <ul className={classes.rows} data-strip-rows>
207
+ {rows.map((row) => (
208
+ <li key={row.key} className={classes.row} data-strip-row={row.key}>
209
+ <span className={classes.rowLabel}>{row.label}</span>
210
+ <span className={classes.visual}>{row.visual}</span>
211
+ <span className={classes.rowValue}>{row.value ?? EMPTY}</span>
212
+ <span>{row.delta}</span>
213
+ </li>
214
+ ))}
215
+ </ul>
216
+ ))}
217
+ {state === undefined && !ownFooter && footerEl}
218
+ </article>
219
+ )
220
+ }
221
+
222
+ export function StatStrip({ label, cells, footer, cols, className, style }: StatStripProps) {
223
+ const desktop = cols ?? Math.min(Math.max(cells.length, 2), 6)
224
+ // `StatGroup`'s rule: four is 2 + 2 below the full count, never 3 + 1.
225
+ const mid = desktop === 4 ? 2 : Math.min(desktop, 3)
226
+ return (
227
+ <div className={cx(classes.container, className)} style={style}>
228
+ <Card>
229
+ <Card.Section
230
+ component="section"
231
+ aria-label={label}
232
+ className={classes.clip}
233
+ style={
234
+ {
235
+ '--basalt-strip-cols': desktop,
236
+ '--basalt-strip-cols-sm': mid,
237
+ } as CSSProperties
238
+ }
239
+ >
240
+ <div className={classes.cells}>
241
+ {cells.map((cell) => (
242
+ <StripCell key={cell.key} cell={cell} />
243
+ ))}
244
+ </div>
245
+ {footer !== undefined && footer.length > 0 && (
246
+ <div className={classes.footerRow}>
247
+ {footer.map((entry) => (
248
+ <div
249
+ key={entry.key}
250
+ className={classes.footerCell}
251
+ data-strip-footer-cell={entry.key}
252
+ data-shot={`strip-footer-${entry.key}`}
253
+ >
254
+ {entry.content}
255
+ </div>
256
+ ))}
257
+ </div>
258
+ )}
259
+ </Card.Section>
260
+ </Card>
261
+ </div>
262
+ )
263
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set by a host that already shows the reading as its hero (a `StatCard` sparkline slot, a strip
3
+ * cell's `visual`). A `Meter` in zones mode reads it and drops the reading it would draw at the
4
+ * marker, so the headline value is not printed twice. Internal: never exported.
5
+ */
6
+ import { createContext } from 'react'
7
+
8
+ export const VisualSlotContext = createContext(false)
@@ -143,7 +143,8 @@
143
143
  border-radius: var(--vx-radius-ctrl);
144
144
  background: var(--vx-surface-subtle);
145
145
  padding: var(--vx-space-badge-inset-y) var(--vx-space-badge-inset-x);
146
- font-family: var(--basalt-font-mono);
146
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
147
+ font-variant-numeric: lining-nums;
147
148
  font-size: var(--vx-text-xs);
148
149
  font-weight: 500;
149
150
  color: var(--vx-faint);
@@ -172,7 +173,8 @@
172
173
  .value {
173
174
  min-width: 0;
174
175
  overflow-wrap: anywhere;
175
- font-family: var(--basalt-font-mono);
176
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
177
+ font-variant-numeric: lining-nums;
176
178
  font-size: var(--vx-text-kpi);
177
179
  font-weight: 500;
178
180
  letter-spacing: -0.02em;
@@ -180,15 +182,16 @@
180
182
  }
181
183
 
182
184
  /*
183
- * The unit beside the hero value. Mono like the number it qualifies (so `412 TSS` sits on one
184
- * baseline grid), `--vx-text-sm` and `--vx-muted` so it never competes with the numeral — the whole
185
+ * The unit beside the hero value. Sans like the number it qualifies (so `412 TSS` sits on one
186
+ * baseline), `--vx-text-sm` and `--vx-muted` so it never competes with the numeral — the whole
185
187
  * point is that a unit is the SMALL half of the pair. `flex-shrink: 0`: a unit clipped to `TS…`
186
188
  * would state nothing.
187
189
  */
188
190
  .unit {
189
191
  flex-shrink: 0;
190
192
  align-self: baseline;
191
- font-family: var(--basalt-font-mono);
193
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
194
+ font-variant-numeric: lining-nums;
192
195
  font-size: var(--vx-text-sm);
193
196
  font-weight: 500;
194
197
  color: var(--vx-muted);
@@ -343,7 +346,8 @@
343
346
  white-space: nowrap;
344
347
  align-items: baseline;
345
348
  gap: 3px;
346
- font-family: var(--basalt-font-mono);
349
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
350
+ font-variant-numeric: lining-nums;
347
351
  font-size: var(--vx-text-sm);
348
352
  font-weight: 500;
349
353
  line-height: 1;
@@ -77,11 +77,11 @@ export type WidgetHeaderProps = BasaltProps &
77
77
  * click — so a keyboard user gets it too. Mantine-free: a plain state bubble, not a Tooltip.
78
78
  */
79
79
  info?: string
80
- /** Pre-formatted metric value (mono, hero size, never truncated). Renders on its own row with
80
+ /** Pre-formatted metric value (sans, lining figures, hero size, never truncated). Renders on its own row with
81
81
  * `delta` under the title row, or on the title row in a card 480px or wider. */
82
82
  value?: string
83
83
  /**
84
- * The value's unit, rendered immediately after it on the hero row: muted, mono, `--vx-text-sm`.
84
+ * The value's unit, rendered immediately after it on the hero row: muted, sans, `--vx-text-sm`.
85
85
  *
86
86
  * It exists because `value` is a pre-formatted `string` and a KPI's unit is not part of the
87
87
  * number: `412` and `TSS` are two facts at two weights, and jamming them into one string paints
@@ -120,7 +120,7 @@ export type WidgetHeaderProps = BasaltProps &
120
120
  /** Trend visual slot, rendered below the metric row. Carries `data-placement="right"` so a
121
121
  * wave-3 composer's `bleed` layout can select it. */
122
122
  sparkline?: ReactNode
123
- /** Mono count tag rendered after the title (C11 — every table/list states its count). `0` is a
123
+ /** Count tag rendered after the title (C11 — every table/list states its count). `0` is a
124
124
  * real count and renders, distinct from omitting the prop entirely. */
125
125
  count?: number
126
126
  /** Right-aligned slot (`margin-inline-start: auto`) — the C1/C5 home for header actions. */
@@ -3,7 +3,7 @@
3
3
  * seeded from argo consumers (`features/{walking-pad,reading,astro-window,garmin-health}/{formatters,format,
4
4
  * formulas}.ts` — read those files' own JSDoc for the exact call sites this generalizes).
5
5
  */
6
- import { dateFormat, NON_FINITE, numberFormat, toDate } from './shared'
6
+ import { dateFormat, NON_FINITE, numberFormat, resolveLocale, toDate } from './shared'
7
7
  import type { LocaleOption } from './shared'
8
8
 
9
9
  type DateInput = Date | number | string | null | undefined
@@ -92,10 +92,13 @@ function relativeTimeFormat(
92
92
  style: 'long' | 'short' | 'narrow',
93
93
  numeric: 'auto' | 'always',
94
94
  ): Intl.RelativeTimeFormat {
95
- const key = `${locale ?? ''}|${style}|${numeric}`
95
+ // Same resolution as `numberFormat`/`dateFormat`. The RESOLVED tag keys the cache (`\0` marks
96
+ // "runtime locale", which no real tag can equal), so a changed default never serves a stale one.
97
+ const resolved = resolveLocale(locale)
98
+ const key = `${resolved ?? '\0'}|${style}|${numeric}`
96
99
  const cached = relativeTimeFormatterCache.get(key)
97
100
  if (cached !== undefined) return cached
98
- const created = new Intl.RelativeTimeFormat(locale, { style, numeric })
101
+ const created = new Intl.RelativeTimeFormat(resolved, { style, numeric })
99
102
  relativeTimeFormatterCache.set(key, created)
100
103
  return created
101
104
  }