@keystone-sites/marketing-design-system 1.0.13 → 1.0.15

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.
@@ -0,0 +1,337 @@
1
+ /** The report kit: the parts a Grader report is built from (ks-Grader
2
+ * "Components · Grader report & summary", 170:3424). A panel head, a
3
+ * fact and a fact chip, the locked chip and the report link an area card
4
+ * ends in, the "You" badge, the rank badge, the area card itself, a
5
+ * score row and a finding row that open to their fix, and a stat card. Each takes its
6
+ * words and data as props; the consumer composes them with real data.
7
+ * Styles live in report.css. */
8
+
9
+ import type { ReactNode } from "react";
10
+ import { IconArrowRight, IconChevronDownMedium, IconLock } from "../icons";
11
+ import type { Grade } from "./status";
12
+
13
+ function cx(...parts: (string | false | undefined)[]) {
14
+ return parts.filter(Boolean).join(" ");
15
+ }
16
+
17
+ /** The head of a panel: a title at the left, a meta line at its right
18
+ * (under it on a phone); the body beneath starts at its hairline. */
19
+ export function PanelHead({
20
+ title,
21
+ meta,
22
+ as: Tag = "h3",
23
+ children,
24
+ }: {
25
+ title: ReactNode;
26
+ meta?: ReactNode;
27
+ as?: "h2" | "h3" | "h4";
28
+ /** A mark beside the meta (a grade pill). */
29
+ children?: ReactNode;
30
+ }) {
31
+ return (
32
+ <header className="rpt-panel-head">
33
+ <Tag className="type type-fixed ts-text-lg-medium rpt-panel-title">{title}</Tag>
34
+ {(meta || children) && (
35
+ <div className="rpt-panel-meta">
36
+ {children}
37
+ {meta && <span className="type type-fixed ts-text-sm-light rpt-panel-note">{meta}</span>}
38
+ </div>
39
+ )}
40
+ </header>
41
+ );
42
+ }
43
+
44
+ /** A labelled fact on the cover: label over value, with an optional detail. */
45
+ export function Fact({
46
+ label,
47
+ value,
48
+ detail,
49
+ children,
50
+ }: {
51
+ label: ReactNode;
52
+ value: ReactNode;
53
+ detail?: ReactNode;
54
+ /** Replaces the value while it has not landed (a skeleton). */
55
+ children?: ReactNode;
56
+ }) {
57
+ return (
58
+ <div className="rpt-fact">
59
+ <dt className="type type-fixed ts-text-xs-light rpt-fact-label">{label}</dt>
60
+ <dd className="type type-fixed ts-text-md-light rpt-fact-value">
61
+ {children ?? (
62
+ <>
63
+ {value}
64
+ {detail && <span className="rpt-fact-detail"> {detail}</span>}
65
+ </>
66
+ )}
67
+ </dd>
68
+ </div>
69
+ );
70
+ }
71
+
72
+ /** A fact in a chip under a report hero; `flag` marks a problem. */
73
+ export function FactChip({
74
+ tone = "neutral",
75
+ children,
76
+ }: {
77
+ tone?: "neutral" | "flag";
78
+ children: ReactNode;
79
+ }) {
80
+ return (
81
+ <span className="type type-fixed ts-text-sm-light rpt-fact-chip" data-tone={tone}>
82
+ {tone === "flag" && <i className="rpt-fact-chip-flag" aria-hidden="true" />}
83
+ {children}
84
+ </span>
85
+ );
86
+ }
87
+
88
+ /** The area a finding belongs to, in a `FindingRow`'s chip slot
89
+ * (ks-Grader grader/area-chip). */
90
+ export function AreaChip({ children }: { children: ReactNode }) {
91
+ return <span className="type type-fixed ts-text-xs-medium rpt-area-chip">{children}</span>;
92
+ }
93
+
94
+ /** The mark on a summary's area card: what the full report holds. */
95
+ export function LockedChip({ children }: { children: ReactNode }) {
96
+ return (
97
+ <span className="type type-fixed ts-text-sm-light rpt-locked">
98
+ <IconLock size={16} />
99
+ {children}
100
+ </span>
101
+ );
102
+ }
103
+
104
+ /** Where the business ranks for a search (ks-Grader grader/rank-badge):
105
+ * first, placed in the pack, or outside it. `rank` null is outside the
106
+ * top of the results; the consumer supplies the words for that. */
107
+ export function RankBadge({ rank, children }: { rank: number | null; children: ReactNode }) {
108
+ const tier = rank == null ? "none" : rank === 1 ? "first" : rank <= 3 ? "top" : "placed";
109
+ return (
110
+ <span className="type type-fixed ts-text-sm-medium rpt-rank" data-tier={tier}>
111
+ {children}
112
+ </span>
113
+ );
114
+ }
115
+
116
+ /** A measured value on a scale with bands (ks-Grader 06, the speed
117
+ * cards): the segments in order with the share of the bar each takes
118
+ * and its tone, and the marker at `at` (0–1). The consumer owns the
119
+ * thresholds; the bar only draws them. */
120
+ export function ScaleBar({
121
+ segments,
122
+ at,
123
+ }: {
124
+ segments: ReadonlyArray<{ share: number; tone: Grade }>;
125
+ at: number;
126
+ }) {
127
+ const clamped = Math.min(1, Math.max(0, at));
128
+ return (
129
+ <span className="rpt-scale" aria-hidden="true" style={{ "--at": clamped }}>
130
+ {segments.map((s, i) => (
131
+ <i key={i} className="rpt-scale-seg" data-tone={s.tone} style={{ flexGrow: s.share }} />
132
+ ))}
133
+ <i className="rpt-scale-mark" />
134
+ </span>
135
+ );
136
+ }
137
+
138
+ /** The "You" mark beside the subject's own row in a ranked list. */
139
+ export function YouBadge({ children }: { children: ReactNode }) {
140
+ return <span className="type type-fixed ts-text-sm-medium rpt-you">{children}</span>;
141
+ }
142
+
143
+ /** The link an unlocked area card ends in. */
144
+ export function ReportLink({
145
+ href,
146
+ className,
147
+ children,
148
+ }: {
149
+ /** Without one the link is a cue inside a box that is itself the link. */
150
+ href?: string;
151
+ className?: string;
152
+ children: ReactNode;
153
+ }) {
154
+ const cls = cx("type type-fixed ts-text-sm-regular rpt-link", className);
155
+ const body = (
156
+ <>
157
+ {children}
158
+ <IconArrowRight size={16} />
159
+ </>
160
+ );
161
+ return href ? (
162
+ <a className={cls} href={href}>
163
+ {body}
164
+ </a>
165
+ ) : (
166
+ <span className={cls}>{body}</span>
167
+ );
168
+ }
169
+
170
+ /** One of the four area cards under the Keystone Score: the area's
171
+ * name and grade pill, its ring, a short summary, and a footer — the
172
+ * locked chip on the summary, the report link once unlocked. In a
173
+ * `AreaCards` grid the cards are a 2 × 2 from the tablet anchor and
174
+ * full-width rows split by hairlines on a phone. */
175
+ export function AreaCard({
176
+ title,
177
+ pill,
178
+ ring,
179
+ summary,
180
+ footer,
181
+ href,
182
+ attrs,
183
+ as: Tag = "h3",
184
+ }: {
185
+ title: ReactNode;
186
+ pill: ReactNode;
187
+ ring: ReactNode;
188
+ summary: ReactNode;
189
+ footer: ReactNode;
190
+ /** The whole card is the link to the area's report; the footer is then
191
+ * a cue (`ReportLink` without an href), never a second link. */
192
+ href?: string;
193
+ /** Data and aria attributes for the link (a host's tracking hook). */
194
+ attrs?: Record<`data-${string}` | `aria-${string}`, string | undefined>;
195
+ as?: "h3" | "h4";
196
+ }) {
197
+ const body = (
198
+ <>
199
+ <div className="rpt-area-head">
200
+ <div className="rpt-area-title">
201
+ <Tag className="type type-fixed ts-text-lg-light rpt-area-name">{title}</Tag>
202
+ {pill}
203
+ </div>
204
+ {ring}
205
+ </div>
206
+ <p className="type type-fixed ts-text-sm-light rpt-area-summary">{summary}</p>
207
+ <div className="rpt-area-footer">{footer}</div>
208
+ </>
209
+ );
210
+ return href ? (
211
+ <a className="rpt-area" href={href} {...attrs}>
212
+ {body}
213
+ </a>
214
+ ) : (
215
+ <article className="rpt-area">{body}</article>
216
+ );
217
+ }
218
+
219
+ export function AreaCards({ children }: { children: ReactNode }) {
220
+ return <div className="rpt-areas">{children}</div>;
221
+ }
222
+
223
+ /** A row in the nine-area list: area, score, grade, and — when it opens
224
+ * — the finding and first fix beneath. `score` null is unmeasured: the
225
+ * slot stays empty and the pill says so. */
226
+ export function ScoreRow({
227
+ area,
228
+ score,
229
+ pill,
230
+ grade,
231
+ open,
232
+ children,
233
+ }: {
234
+ area: ReactNode;
235
+ score: number | null;
236
+ pill: ReactNode;
237
+ grade: Grade;
238
+ /** Open on first render (the summary shows one). */
239
+ open?: boolean;
240
+ /** The body the row opens to; without it the row is flat. */
241
+ children?: ReactNode;
242
+ }) {
243
+ const head = (
244
+ <>
245
+ <span className="type type-fixed ts-text-lg-regular rpt-score-area">{area}</span>
246
+ <span className="type type-fixed ts-display-serif-xs-light rpt-score-value">
247
+ {score == null ? "" : Math.round(score)}
248
+ </span>
249
+ <span className="rpt-score-grade">{pill}</span>
250
+ {children && <IconChevronDownMedium className="rpt-row-chevron" />}
251
+ </>
252
+ );
253
+ if (!children) {
254
+ return (
255
+ <div className="rpt-score-row" data-grade={grade}>
256
+ {head}
257
+ </div>
258
+ );
259
+ }
260
+ return (
261
+ <details className="rpt-score-row" data-grade={grade} open={open}>
262
+ <summary className="rpt-score-summary">{head}</summary>
263
+ <div className="rpt-row-body">{children}</div>
264
+ </details>
265
+ );
266
+ }
267
+
268
+ /** A finding, numbered, with the area it belongs to as a chip; opens to
269
+ * its fix when it has one. On a phone the chip moves under the finding. */
270
+ export function FindingRow({
271
+ number,
272
+ finding,
273
+ chip,
274
+ open,
275
+ children,
276
+ }: {
277
+ number: ReactNode;
278
+ finding: ReactNode;
279
+ chip?: ReactNode;
280
+ open?: boolean;
281
+ children?: ReactNode;
282
+ }) {
283
+ const head = (
284
+ <>
285
+ <span className="type type-fixed ts-text-sm-light rpt-finding-number">{number}</span>
286
+ <span className="type type-fixed ts-text-md-light rpt-finding-text">{finding}</span>
287
+ {chip && <span className="rpt-finding-chip">{chip}</span>}
288
+ {children && <IconChevronDownMedium className="rpt-row-chevron" />}
289
+ </>
290
+ );
291
+ if (!children) {
292
+ return <div className="rpt-finding-row">{head}</div>;
293
+ }
294
+ return (
295
+ <details className="rpt-finding-row" open={open}>
296
+ <summary className="rpt-finding-summary">{head}</summary>
297
+ <div className="rpt-row-body rpt-finding-body">{children}</div>
298
+ </details>
299
+ );
300
+ }
301
+
302
+ /** A statistic in a panel: a label, the figure, a line under it and a
303
+ * note. In a `StatCards` row the cards sit side by side from the first
304
+ * desktop anchor and stack as hairline rows below it. */
305
+ export function StatCard({
306
+ label,
307
+ value,
308
+ sub,
309
+ note,
310
+ }: {
311
+ label: ReactNode;
312
+ value: ReactNode;
313
+ sub?: ReactNode;
314
+ note?: ReactNode;
315
+ }) {
316
+ return (
317
+ <div className="rpt-stat">
318
+ <span className="type type-fixed ts-text-sm-regular rpt-stat-label">{label}</span>
319
+ <span className="type ts-display-serif-md-light rpt-stat-value">{value}</span>
320
+ {sub && (
321
+ <span className="type type-fixed ts-display-serif-3xs-extralight rpt-stat-sub">{sub}</span>
322
+ )}
323
+ {note && <span className="type type-fixed ts-text-xs-light rpt-stat-note">{note}</span>}
324
+ </div>
325
+ );
326
+ }
327
+
328
+ /** The row of cards; `columns` is how many sit side by side at the
329
+ * desktop anchors (the summary's three standings, the website page's four
330
+ * speed figures). */
331
+ export function StatCards({ columns = 3, children }: { columns?: 3 | 4; children: ReactNode }) {
332
+ return (
333
+ <div className="rpt-stats" style={{ "--rpt-stat-cols": columns }}>
334
+ {children}
335
+ </div>
336
+ );
337
+ }
@@ -74,26 +74,28 @@
74
74
  --_soft: var(--color-bg-300);
75
75
  }
76
76
 
77
- /* Grade hues: good, fair, poor. */
77
+ /* Grade hues: good, fair, poor, and neutral for a value that was not
78
+ found. The Grader's "grade" variable collection (ks-Grader 170:3424):
79
+ accent → dot, tint → fill, ink → ink. */
78
80
  [data-grade="good"] {
79
- --_dot: var(--color-teal-300);
80
- --_fill: var(--color-teal-250);
81
+ --_dot: var(--color-teal-500);
82
+ --_fill: var(--color-teal-200);
81
83
  --_ink: var(--color-teal-700);
82
84
  }
83
85
  [data-grade="fair"] {
84
86
  --_dot: var(--color-yellow-400);
85
- --_fill: var(--color-yellow-300);
86
- --_ink: var(--color-yellow-700);
87
+ --_fill: var(--color-yellow-200);
88
+ --_ink: var(--color-yellow-600);
87
89
  }
88
90
  [data-grade="poor"] {
89
91
  --_dot: var(--color-red-400);
90
- --_fill: var(--color-red-300);
91
- --_ink: var(--color-red-700);
92
+ --_fill: var(--color-red-200);
93
+ --_ink: var(--color-red-600);
92
94
  }
93
95
  [data-grade="neutral"] {
94
- --_dot: var(--color-text-500);
95
- --_fill: var(--color-bg-300);
96
- --_ink: var(--color-text-100);
96
+ --_dot: var(--color-border-300);
97
+ --_fill: var(--color-bg-200);
98
+ --_ink: var(--color-text-200);
97
99
  }
98
100
 
99
101
  /* Spinner: a two-tone ring that turns. */
@@ -128,7 +130,7 @@
128
130
  width: 6px;
129
131
  height: 6px;
130
132
  border-radius: var(--radius-full);
131
- background: var(--color-teal-300);
133
+ background: var(--color-teal-500);
132
134
  animation: pulse-dot var(--status-pulse-dur) ease-in-out infinite;
133
135
  }
134
136
  @keyframes pulse-dot {
@@ -207,6 +209,29 @@
207
209
  width: 6px;
208
210
  height: 6px;
209
211
  }
212
+ /* The grade pill (ks-Grader grader/status-pill): the grade's tint
213
+ behind its ink, a square in its accent; 26 tall at 12 in, 22 at 8 in. */
214
+ .pill[data-grade] {
215
+ height: 26px;
216
+ padding-inline: var(--space-lg);
217
+ gap: var(--space-sm);
218
+ border-color: transparent;
219
+ background: var(--_fill);
220
+ color: var(--_ink);
221
+ }
222
+ .pill[data-grade] .pill-dot {
223
+ width: 6px;
224
+ height: 6px;
225
+ border-radius: var(--radius-none);
226
+ }
227
+ .pill[data-grade][data-size="sm"] {
228
+ height: 22px;
229
+ padding-inline: var(--space-md);
230
+ }
231
+ .pill[data-grade][data-size="sm"] .pill-dot {
232
+ width: 5px;
233
+ height: 5px;
234
+ }
210
235
  .pill > svg {
211
236
  flex: none;
212
237
  width: 14px;
@@ -266,6 +291,11 @@
266
291
  .meter[data-slow]::after {
267
292
  transition: width var(--status-meter-reveal-dur) var(--motion-drawer-ease);
268
293
  }
294
+ /* Live progress reads in the deep teal: a thin bar of the ramp's pale
295
+ fill disappears against the track while it is still moving. */
296
+ .meter[data-live] {
297
+ --_fill: var(--color-teal-500);
298
+ }
269
299
 
270
300
  /* Ring: a circular progress track drawn by SVG. */
271
301
  .arc {
@@ -299,6 +329,62 @@
299
329
  text-align: center;
300
330
  }
301
331
 
332
+ /* Score ring (ks-Grader grader/score-ring): an area's score as a thin
333
+ ring in its grade's accent on a bg/300 track, the number centred in
334
+ the serif. md is 60 (56 on a phone), lg is 76 (64), sm is 32. The
335
+ number's type steps with the size; the ring has no motion so a card
336
+ of four lands settled. */
337
+ .score-ring {
338
+ --_size: 60px;
339
+ position: relative;
340
+ display: inline-grid;
341
+ place-items: center;
342
+ flex: none;
343
+ width: var(--_size);
344
+ height: var(--_size);
345
+ color: var(--color-text-000);
346
+ }
347
+ /* The ring is drawn in a 100-unit box and scaled by the size; the stroke
348
+ stays 3px at every size, so at any size under 100 its outer edge
349
+ lands past the box: the svg paints it rather than clipping it. */
350
+ .score-ring .arc {
351
+ width: 100%;
352
+ height: 100%;
353
+ overflow: visible;
354
+ }
355
+ .score-ring .arc-track,
356
+ .score-ring .arc-fill {
357
+ vector-effect: non-scaling-stroke;
358
+ }
359
+ .score-ring .arc-track {
360
+ stroke: var(--color-bg-300);
361
+ }
362
+ .score-ring .arc-fill {
363
+ transition: none;
364
+ }
365
+ .score-ring-value {
366
+ position: absolute;
367
+ inset: 0;
368
+ display: grid;
369
+ place-items: center;
370
+ font-variant-numeric: tabular-nums;
371
+ }
372
+ .score-ring[data-size="lg"] {
373
+ --_size: 76px;
374
+ }
375
+ /* sm (grader-nav 214:27889) is 32 at every size: a list row's mark. */
376
+ .score-ring[data-size="sm"] {
377
+ --_size: 32px;
378
+ }
379
+ @container (--below-rt) {
380
+ .score-ring:not([data-size="sm"]) {
381
+ --_size: 56px;
382
+ }
383
+ .score-ring[data-size="lg"] {
384
+ --_size: 64px;
385
+ }
386
+ }
387
+
302
388
  /* Stars: a rating row. */
303
389
  .stars {
304
390
  display: inline-flex;
@@ -9,6 +9,8 @@ import { useEffect, useState, type CSSProperties, type ReactNode } from "react";
9
9
  export type Hue =
10
10
  "teal" | "blue" | "yellow" | "orange" | "red" | "brown" | "green" | "pink" | "purple" | "gray";
11
11
  export type StepStatus = "done" | "active" | "pending";
12
+ /** A measured grade, or neutral for a value that was not found. */
13
+ export type Grade = "good" | "fair" | "poor" | "neutral";
12
14
 
13
15
  export function Spinner({ size }: { size?: "sm" | "lg" }) {
14
16
  return <span className="spinner" data-size={size} aria-hidden="true" />;
@@ -41,15 +43,20 @@ export function StepMark({ status, size }: { status: StepStatus; size?: "sm" })
41
43
  );
42
44
  }
43
45
 
46
+ /** A pill is coloured one way: by a hue, or — the grade pill (ks-Grader
47
+ * grader/status-pill) — by a grade, the grade's tint and ink with a dot
48
+ * in its accent, set in medium. */
49
+ type PillColour = { hue: Hue; grade?: never } | { grade: Grade; hue?: never };
50
+
44
51
  export function Pill({
45
52
  hue,
53
+ grade,
46
54
  fill,
47
55
  size,
48
56
  className,
49
57
  style,
50
58
  children,
51
- }: {
52
- hue: Hue;
59
+ }: PillColour & {
53
60
  /** Solid hue tint instead of the dotted ground pill. */
54
61
  fill?: boolean;
55
62
  size?: "sm";
@@ -57,13 +64,20 @@ export function Pill({
57
64
  style?: CSSProperties;
58
65
  children: ReactNode;
59
66
  }) {
60
- const step = size === "sm" ? "ts-text-xs-regular" : "ts-text-sm-light";
67
+ const step = grade
68
+ ? size === "sm"
69
+ ? "ts-text-xs-medium"
70
+ : "ts-text-sm-medium"
71
+ : size === "sm"
72
+ ? "ts-text-xs-regular"
73
+ : "ts-text-sm-light";
61
74
  return (
62
75
  <span
63
76
  className={
64
77
  className ? `type type-fixed ${step} pill ${className}` : `type type-fixed ${step} pill`
65
78
  }
66
79
  data-hue={hue}
80
+ data-grade={grade}
67
81
  data-fill={fill || undefined}
68
82
  data-size={size}
69
83
  style={style}
@@ -96,6 +110,7 @@ export function Meter({
96
110
  size,
97
111
  slow,
98
112
  you,
113
+ live,
99
114
  }: {
100
115
  value: number;
101
116
  hue?: Hue;
@@ -104,6 +119,8 @@ export function Meter({
104
119
  slow?: boolean;
105
120
  /** Marks the subject's own bar in a ranked list. */
106
121
  you?: boolean;
122
+ /** Live progress of running work: the fill reads in the deep teal. */
123
+ live?: boolean;
107
124
  }) {
108
125
  const clamped = Math.min(1, Math.max(0, value));
109
126
  const [shown, setShown] = useState(slow ? 0 : clamped);
@@ -119,6 +136,7 @@ export function Meter({
119
136
  data-size={size}
120
137
  data-slow={slow || undefined}
121
138
  data-you={you || undefined}
139
+ data-live={live || undefined}
122
140
  style={{ "--value": slow ? shown : clamped }}
123
141
  role="progressbar"
124
142
  aria-valuemin={0}
@@ -177,6 +195,83 @@ export function Ring({
177
195
  );
178
196
  }
179
197
 
198
+ /** The score ring's drawing box; the stroke is pinned to 3px in CSS so
199
+ * the ring reads the same at every size (ks-Grader grader/score-ring). */
200
+ const SCORE_RING_BOX = 100;
201
+ const SCORE_RING_STROKE = 3;
202
+
203
+ const SCORE_RING_TYPE = {
204
+ sm: "ts-display-serif-3xs-regular",
205
+ md: "ts-display-serif-xs-light",
206
+ lg: "ts-display-serif-xs-plus-extralight",
207
+ } as const;
208
+
209
+ /** Score ring: an area's 0–100 score as a thin ring in its grade's
210
+ * accent, the number centred. `md` is the overview card's 60 (56 on a
211
+ * phone); `lg` the report hero's 76 (64); `sm` the report nav's 32 at
212
+ * every size. A score that was not measured passes `value={null}`: the
213
+ * ring stays a track and the centre shows the children (a dash, a
214
+ * skeleton) instead of a number. */
215
+ export function ScoreRing({
216
+ value,
217
+ grade,
218
+ size = "md",
219
+ label,
220
+ children,
221
+ }: {
222
+ value: number | null;
223
+ grade: Grade;
224
+ size?: keyof typeof SCORE_RING_TYPE;
225
+ /** Accessible name; the number alone says nothing about what it scores. */
226
+ label: string;
227
+ children?: ReactNode;
228
+ }) {
229
+ const r = (SCORE_RING_BOX - SCORE_RING_STROKE) / 2;
230
+ const c = 2 * Math.PI * r;
231
+ const clamped = value == null ? 0 : Math.min(1, Math.max(0, value / 100));
232
+ const step = SCORE_RING_TYPE[size];
233
+ return (
234
+ <span
235
+ className="score-ring"
236
+ data-grade={grade}
237
+ data-size={size}
238
+ role="img"
239
+ aria-label={value == null ? label : `${label}: ${Math.round(value)} of 100`}
240
+ >
241
+ <svg
242
+ className="arc"
243
+ viewBox={`0 0 ${SCORE_RING_BOX} ${SCORE_RING_BOX}`}
244
+ aria-hidden="true"
245
+ focusable="false"
246
+ >
247
+ <circle
248
+ className="arc-track"
249
+ cx={SCORE_RING_BOX / 2}
250
+ cy={SCORE_RING_BOX / 2}
251
+ r={r}
252
+ fill="none"
253
+ strokeWidth={SCORE_RING_STROKE}
254
+ />
255
+ {value != null && (
256
+ <circle
257
+ className="arc-fill"
258
+ cx={SCORE_RING_BOX / 2}
259
+ cy={SCORE_RING_BOX / 2}
260
+ r={r}
261
+ fill="none"
262
+ strokeWidth={SCORE_RING_STROKE}
263
+ strokeDasharray={c}
264
+ strokeDashoffset={c * (1 - clamped)}
265
+ />
266
+ )}
267
+ </svg>
268
+ <span className={`type type-fixed ${step} score-ring-value`} aria-hidden="true">
269
+ {value == null ? children : Math.round(value)}
270
+ </span>
271
+ </span>
272
+ );
273
+ }
274
+
180
275
  /** Gauge: a ring that fills in after mount, with content in the centre. */
181
276
  export function Gauge({
182
277
  value,
@@ -33,6 +33,16 @@
33
33
  .surface[data-tone="well"] {
34
34
  background: var(--color-bg-000);
35
35
  }
36
+ /* The report panel (ks-Grader 153:2): 16 at the corners, 12 on a phone. */
37
+ .surface[data-tone="paper"] {
38
+ border-color: var(--color-border-000);
39
+ background: var(--color-bg-050);
40
+ }
41
+ @container (--below-rt) {
42
+ .surface[data-tone="paper"] {
43
+ border-radius: var(--radius-xl);
44
+ }
45
+ }
36
46
 
37
47
  /* Rows: stacked children divided by the hairline. */
38
48
  .rows > * + * {
@@ -4,7 +4,7 @@
4
4
 
5
5
  import type { CSSProperties, ElementType, ReactNode } from "react";
6
6
 
7
- type DataAttrs = Record<`data-${string}`, string | undefined>;
7
+ type DataAttrs = Record<`data-${string}`, string | undefined> & { "aria-busy"?: boolean };
8
8
 
9
9
  export function Surface({
10
10
  as: Tag = "div",
@@ -21,10 +21,15 @@ export function Surface({
21
21
  as?: ElementType;
22
22
  pad?: "none" | "sm" | "md" | "lg";
23
23
  elev?: "lift";
24
- tone?: "well";
24
+ /** `well` sinks to the page's white; `paper` is the Grader report's
25
+ * panel (ks-Grader 153:2): bg/050 on the border hairline, a step
26
+ * tighter at the corners on a phone. */
27
+ tone?: "well" | "paper";
25
28
  className?: string;
26
29
  style?: CSSProperties;
27
30
  children: ReactNode;
31
+ /** Set while a skeleton is mounted inside (skeleton.tsx). */
32
+ "aria-busy"?: boolean;
28
33
  /** Data attributes (a stagger delay, a test id) pass through. */
29
34
  [data: `data-${string}`]: string | undefined;
30
35
  }) {