@keystone-sites/marketing-design-system 1.0.14 → 1.0.16
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/AGENTS.md +11 -1
- package/index.css +3 -0
- package/package.json +7 -1
- package/primitives/buttons.css +13 -1
- package/primitives/buttons.tsx +46 -0
- package/primitives/keystone-score.css +156 -0
- package/primitives/keystone-score.tsx +204 -0
- package/primitives/prose.css +50 -4
- package/primitives/prose.tsx +30 -6
- package/primitives/ramps.css +2 -9
- package/primitives/report-nav.css +322 -0
- package/primitives/report-nav.tsx +224 -0
- package/primitives/report.css +601 -0
- package/primitives/report.tsx +357 -0
- package/primitives/status.css +97 -11
- package/primitives/status.tsx +98 -3
- package/primitives/surface.css +10 -0
- package/primitives/surface.tsx +7 -2
- package/primitives/text.css +13 -0
- package/sections/landing-quote.tsx +1 -1
- package/sections/nav.css +6 -6
- package/tokens/motion.css +14 -0
package/AGENTS.md
CHANGED
|
@@ -57,7 +57,8 @@ files from their own `AGENTS.md`; they never copy them.
|
|
|
57
57
|
`size="inherit"` and declare the keyword on the mount at each gate; never
|
|
58
58
|
render one hidden copy per band. `<ButtonFill stretch>` fills its container.
|
|
59
59
|
- Text is `type ts-<figma-style>` (for example `type ts-text-md-light`;
|
|
60
|
-
`type-fixed` for material sizes
|
|
60
|
+
`type-fixed` for material sizes; `type-hang` for text that opens on a
|
|
61
|
+
quotation mark, which hangs into the margin). The generated class sets `--font`/`--ls`/
|
|
61
62
|
`--opsz` and the 384 size (`--fs-rm/--lh-rm`); the element's base rule names
|
|
62
63
|
the other designed anchors (`--fs-rs/rt/rd1/rd2`, `--lh-*`) and, per band,
|
|
63
64
|
where the size runs above its anchor (`--fs-rs-to: var(--fs-rt)`); a band
|
|
@@ -71,6 +72,15 @@ files from their own `AGENTS.md`; they never copy them.
|
|
|
71
72
|
tone, clip, num), `Title`, `Figure`, `SecTitle`/`SecSub`, `DotList`. Each is
|
|
72
73
|
the type law plus a role color; a consumer styles `.copy[data-size]`, never
|
|
73
74
|
a size class.
|
|
75
|
+
- The Grader report's parts (Figma `ks-Grader`, "Components · Grader report &
|
|
76
|
+
summary") are `primitives/report.tsx` (panel head, facts and chips, area
|
|
77
|
+
cards, score and finding rows, stat cards), `primitives/report-nav.tsx`
|
|
78
|
+
(the page switcher in the nav bar: chips from the first desktop anchor,
|
|
79
|
+
a menu card below it), `primitives/keystone-score.tsx`
|
|
80
|
+
(the one arc: the Keystone Score) and, in `primitives/status.tsx`, the
|
|
81
|
+
grade `Pill` and `ScoreRing` (an area's score is a ring, never an arc).
|
|
82
|
+
Grades come from the model as `poor | fair | good | neutral`; a null value
|
|
83
|
+
is unmeasured and the consumer says so in the slot.
|
|
74
84
|
- Motion is CSS only. Every duration, curve, and distance is a token in
|
|
75
85
|
`tokens/motion.css`; read the laws in its header before adding any motion.
|
|
76
86
|
Every state change is a CSS transition or animation; `base.css` zeroes them
|
package/index.css
CHANGED
|
@@ -56,6 +56,9 @@
|
|
|
56
56
|
@import "./primitives/skeleton.css" layer(primitives);
|
|
57
57
|
@import "./primitives/tag.css" layer(primitives);
|
|
58
58
|
@import "./primitives/tabs.css" layer(primitives);
|
|
59
|
+
@import "./primitives/report.css" layer(primitives);
|
|
60
|
+
@import "./primitives/report-nav.css" layer(primitives);
|
|
61
|
+
@import "./primitives/keystone-score.css" layer(primitives);
|
|
59
62
|
@import "./primitives/notice.css" layer(primitives);
|
|
60
63
|
@import "./primitives/modal.css" layer(primitives);
|
|
61
64
|
@import "./primitives/table.css" layer(primitives);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystone-sites/marketing-design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"description": "Keystone's marketing design system: tokens, the tick grid, type, primitives, site chrome, and the landing kit. Source-shipped CSS and TSX for Next.js consumers.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -124,6 +124,8 @@
|
|
|
124
124
|
"./primitives/grader-menu": "./primitives/grader-menu.tsx",
|
|
125
125
|
"./primitives/grader.css": "./primitives/grader.css",
|
|
126
126
|
"./primitives/grader": "./primitives/grader.tsx",
|
|
127
|
+
"./primitives/keystone-score.css": "./primitives/keystone-score.css",
|
|
128
|
+
"./primitives/keystone-score": "./primitives/keystone-score.tsx",
|
|
127
129
|
"./primitives/modal.css": "./primitives/modal.css",
|
|
128
130
|
"./primitives/modal": "./primitives/modal.tsx",
|
|
129
131
|
"./primitives/month-range.css": "./primitives/month-range.css",
|
|
@@ -139,6 +141,10 @@
|
|
|
139
141
|
"./primitives/prose.css": "./primitives/prose.css",
|
|
140
142
|
"./primitives/prose": "./primitives/prose.tsx",
|
|
141
143
|
"./primitives/ramps.css": "./primitives/ramps.css",
|
|
144
|
+
"./primitives/report-nav.css": "./primitives/report-nav.css",
|
|
145
|
+
"./primitives/report-nav": "./primitives/report-nav.tsx",
|
|
146
|
+
"./primitives/report.css": "./primitives/report.css",
|
|
147
|
+
"./primitives/report": "./primitives/report.tsx",
|
|
142
148
|
"./primitives/skeleton.css": "./primitives/skeleton.css",
|
|
143
149
|
"./primitives/skeleton": "./primitives/skeleton.tsx",
|
|
144
150
|
"./primitives/slider.css": "./primitives/slider.css",
|
package/primitives/buttons.css
CHANGED
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
.btn-fill[data-size="sm"],
|
|
36
36
|
.btn-ghost[data-size="sm"],
|
|
37
37
|
.btn-arrow[data-size="sm"] { --btn-size: sm; }
|
|
38
|
-
.btn-ghost[data-size="xs"]
|
|
38
|
+
.btn-ghost[data-size="xs"],
|
|
39
|
+
.btn-fill[data-icon][data-size="xs"] { --btn-size: xs; }
|
|
39
40
|
|
|
40
41
|
.btn-fill,
|
|
41
42
|
.btn-ghost {
|
|
@@ -252,6 +253,17 @@
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
|
|
256
|
+
/* Icon-only (`<ButtonIcon>`): a circle the size's height, the icon at the
|
|
257
|
+
size's icon measure, in the fill's ink. */
|
|
258
|
+
.btn-fill[data-icon] .btn-body {
|
|
259
|
+
width: var(--_h);
|
|
260
|
+
padding: 0;
|
|
261
|
+
}
|
|
262
|
+
.btn-fill[data-icon] .btn-body > svg {
|
|
263
|
+
width: var(--_icon);
|
|
264
|
+
height: var(--_icon);
|
|
265
|
+
}
|
|
266
|
+
|
|
255
267
|
/* The trailing glyph is an arrow that slides on hover. */
|
|
256
268
|
.btn-fill .btn-glyph {
|
|
257
269
|
display: inline-flex;
|
package/primitives/buttons.tsx
CHANGED
|
@@ -102,6 +102,52 @@ export function ButtonFill({
|
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
interface ButtonIconProps {
|
|
106
|
+
/** The fill's sizes and, for the round control alone, xs (32). */
|
|
107
|
+
size?: GhostSize;
|
|
108
|
+
chrome?: ButtonFillProps["chrome"];
|
|
109
|
+
/** The control is icon-only; the name is mandatory. */
|
|
110
|
+
label: string;
|
|
111
|
+
type?: "button" | "submit";
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
forceState?: ForceableState;
|
|
114
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
115
|
+
attrs?: PassAttrs;
|
|
116
|
+
/** The icon; it is drawn at the size's icon measure. */
|
|
117
|
+
children: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The fill as a round icon-only control: the fill's chrome, hover, ring
|
|
121
|
+
* and disabled states, on a circle the fill's height. */
|
|
122
|
+
export function ButtonIcon({
|
|
123
|
+
size = "lg",
|
|
124
|
+
chrome = "teal",
|
|
125
|
+
label,
|
|
126
|
+
type = "button",
|
|
127
|
+
disabled = false,
|
|
128
|
+
forceState,
|
|
129
|
+
onClick,
|
|
130
|
+
attrs,
|
|
131
|
+
children,
|
|
132
|
+
}: ButtonIconProps) {
|
|
133
|
+
return (
|
|
134
|
+
<button
|
|
135
|
+
type={type}
|
|
136
|
+
className="btn-fill"
|
|
137
|
+
data-icon=""
|
|
138
|
+
data-size={sizeAttr(size)}
|
|
139
|
+
data-chrome={chrome}
|
|
140
|
+
data-state={forceState}
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
aria-label={label}
|
|
143
|
+
onClick={onClick}
|
|
144
|
+
{...attrs}
|
|
145
|
+
>
|
|
146
|
+
<span className="btn-body">{children}</span>
|
|
147
|
+
</button>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
105
151
|
interface ButtonGhostProps {
|
|
106
152
|
size?: GhostSize;
|
|
107
153
|
color?: "brown" | "teal" | "gray";
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/* The Keystone Score (ks-Grader grader/keystone-score, 170:3424): the
|
|
2
|
+
arc, its bands, the number and the caption. The gauge is a 440 × 178
|
|
3
|
+
drawing scaled to its mount; strokes and the knob keep their px. The
|
|
4
|
+
grade arrives through data-grade and the status ramps: the fill, the
|
|
5
|
+
knob's ring and the active band read the accent (--_dot) and ink. */
|
|
6
|
+
|
|
7
|
+
/* Designed constants for this file. */
|
|
8
|
+
:root {
|
|
9
|
+
/* The arc's gauge box, the number's centre line and the end labels'
|
|
10
|
+
line inside it, read from the node (number box 113–203 of 178). */
|
|
11
|
+
--kscore-max-w: 440px;
|
|
12
|
+
--kscore-ratio: 440 / 178;
|
|
13
|
+
--kscore-value-y: 88.9%;
|
|
14
|
+
--kscore-ends-y: 89%;
|
|
15
|
+
--kscore-end-inset: 2.5%;
|
|
16
|
+
--kscore-wordmark-w: 64px;
|
|
17
|
+
--kscore-wordmark-h: 13px;
|
|
18
|
+
--kscore-reveal-dur: 1.4s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.kscore {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: var(--space-5xl);
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
width: 100%;
|
|
28
|
+
max-width: var(--kscore-max-w);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kscore-gauge {
|
|
32
|
+
position: relative;
|
|
33
|
+
width: 100%;
|
|
34
|
+
aspect-ratio: var(--kscore-ratio);
|
|
35
|
+
}
|
|
36
|
+
.kscore-gauge > svg {
|
|
37
|
+
position: absolute;
|
|
38
|
+
inset: 0;
|
|
39
|
+
display: block;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
overflow: visible;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* The track and fill: 2px and 3px, whatever the scale. */
|
|
46
|
+
.kscore-track,
|
|
47
|
+
.kscore-fill,
|
|
48
|
+
.kscore-tick {
|
|
49
|
+
fill: none;
|
|
50
|
+
vector-effect: non-scaling-stroke;
|
|
51
|
+
}
|
|
52
|
+
.kscore-track {
|
|
53
|
+
stroke: var(--color-bg-300);
|
|
54
|
+
stroke-width: 2;
|
|
55
|
+
}
|
|
56
|
+
.kscore-tick {
|
|
57
|
+
stroke: var(--color-bg-400);
|
|
58
|
+
stroke-width: 1.5;
|
|
59
|
+
}
|
|
60
|
+
.kscore-fill {
|
|
61
|
+
stroke: var(--_dot);
|
|
62
|
+
stroke-width: 3;
|
|
63
|
+
stroke-dasharray: var(--_score) 100;
|
|
64
|
+
animation: kscore-reveal var(--kscore-reveal-dur) var(--motion-drawer-ease) both;
|
|
65
|
+
}
|
|
66
|
+
@keyframes kscore-reveal {
|
|
67
|
+
from {
|
|
68
|
+
stroke-dasharray: 0 100;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.kscore-knob {
|
|
72
|
+
fill: var(--color-bg-000);
|
|
73
|
+
stroke: var(--_dot);
|
|
74
|
+
stroke-width: 3;
|
|
75
|
+
vector-effect: non-scaling-stroke;
|
|
76
|
+
animation: kscore-knob var(--kscore-reveal-dur) var(--motion-drawer-ease) both;
|
|
77
|
+
}
|
|
78
|
+
@keyframes kscore-knob {
|
|
79
|
+
from,
|
|
80
|
+
70% {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* The bands, named along the inside of the arc; the active one in the
|
|
86
|
+
grade's ink and a weight up. SVG text takes the type law's font. */
|
|
87
|
+
.kscore-band text {
|
|
88
|
+
fill: var(--color-text-500);
|
|
89
|
+
letter-spacing: 0.08em;
|
|
90
|
+
text-transform: uppercase;
|
|
91
|
+
}
|
|
92
|
+
.kscore-band[data-active] text {
|
|
93
|
+
fill: var(--_ink);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* The number sits under the crown, hanging past the gauge box into the
|
|
97
|
+
gap; 72/78 on a phone, 88/90 from the tablet anchor. */
|
|
98
|
+
.kscore-value {
|
|
99
|
+
position: absolute;
|
|
100
|
+
left: 0;
|
|
101
|
+
right: 0;
|
|
102
|
+
top: var(--kscore-value-y);
|
|
103
|
+
transform: translateY(-50%);
|
|
104
|
+
text-align: center;
|
|
105
|
+
color: var(--color-text-000);
|
|
106
|
+
font-variant-numeric: tabular-nums;
|
|
107
|
+
--fs-rm: 72;
|
|
108
|
+
--lh-rm: 78;
|
|
109
|
+
--fs-rs: 80;
|
|
110
|
+
--lh-rs: 84;
|
|
111
|
+
--fs-rt: 88;
|
|
112
|
+
--lh-rt: 90;
|
|
113
|
+
--fs-rd2: 88;
|
|
114
|
+
--lh-rd2: 90;
|
|
115
|
+
--fs-rm-to: var(--fs-rs);
|
|
116
|
+
--lh-rm-to: var(--lh-rs);
|
|
117
|
+
--fs-rs-to: var(--fs-rt);
|
|
118
|
+
--lh-rs-to: var(--lh-rt);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* 0 and 100 under the arc's ends. */
|
|
122
|
+
.kscore-end {
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: var(--kscore-ends-y);
|
|
125
|
+
color: var(--color-border-500);
|
|
126
|
+
}
|
|
127
|
+
.kscore-end[data-end="min"] {
|
|
128
|
+
left: var(--kscore-end-inset);
|
|
129
|
+
}
|
|
130
|
+
.kscore-end[data-end="max"] {
|
|
131
|
+
right: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* The caption: "Your ⟨keystone⟩ Score", then the grade pill. */
|
|
135
|
+
.kscore-caption {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
align-items: center;
|
|
139
|
+
gap: var(--space-lg);
|
|
140
|
+
}
|
|
141
|
+
.kscore-name {
|
|
142
|
+
display: inline-flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
gap: var(--space-xs);
|
|
145
|
+
color: var(--color-text-400);
|
|
146
|
+
white-space: nowrap;
|
|
147
|
+
}
|
|
148
|
+
.kscore-wordmark {
|
|
149
|
+
display: block;
|
|
150
|
+
width: var(--kscore-wordmark-w);
|
|
151
|
+
height: var(--kscore-wordmark-h);
|
|
152
|
+
/* Optical: an svg has no baseline, so centred it floats above the
|
|
153
|
+
words'; this seats its baseline and x-height on theirs. */
|
|
154
|
+
margin-top: var(--space-xs);
|
|
155
|
+
color: var(--color-text-200);
|
|
156
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/** The Keystone Score (ks-Grader grader/keystone-score, 170:3424): the
|
|
2
|
+
* one arc in the Grader. A 140° track with the three grade bands named
|
|
3
|
+
* along its inside, a fill in the grade's accent ending in a knob, the
|
|
4
|
+
* number beneath the arc's crown, and a caption — "Your ⟨keystone⟩
|
|
5
|
+
* Score" and the grade pill. Area scores are rings (status.tsx), never
|
|
6
|
+
* this arc.
|
|
7
|
+
*
|
|
8
|
+
* Drawn in a 440 × 178 box and scaled to its mount (the phone's 320 is
|
|
9
|
+
* the same geometry narrower); strokes and the knob keep their px. The
|
|
10
|
+
* number and the caption are HTML so their type follows the law. A
|
|
11
|
+
* score that has not landed passes `value={null}`: the track and bands
|
|
12
|
+
* draw, the fill and knob do not, and the number slot renders the
|
|
13
|
+
* children (a skeleton). Styles live in keystone-score.css. */
|
|
14
|
+
|
|
15
|
+
import { useId, type ReactNode } from "react";
|
|
16
|
+
import type { Grade } from "./status";
|
|
17
|
+
|
|
18
|
+
/* The gauge geometry, read from the Figma node. */
|
|
19
|
+
const BOX_W = 440;
|
|
20
|
+
const BOX_H = 178;
|
|
21
|
+
const CX = 220;
|
|
22
|
+
const CY = 242;
|
|
23
|
+
const R = 207.5;
|
|
24
|
+
/** The arc runs from −160° to −20°, clockwise through the crown. */
|
|
25
|
+
const START_DEG = -160;
|
|
26
|
+
const SWEEP_DEG = 140;
|
|
27
|
+
/** Band labels sit on a circle 20px inside the track. */
|
|
28
|
+
const LABEL_INSET = 20;
|
|
29
|
+
/** The ticks dividing the bands, in score points, as the design draws
|
|
30
|
+
* them (55 and 80); the model grades, these only mark the arc. */
|
|
31
|
+
const BAND_EDGES = [55, 80] as const;
|
|
32
|
+
const TICK_HALF = 5;
|
|
33
|
+
const KNOB_R = 7;
|
|
34
|
+
|
|
35
|
+
type Band = Exclude<Grade, "neutral">;
|
|
36
|
+
const BANDS: readonly { grade: Band; from: number; to: number }[] = [
|
|
37
|
+
{ grade: "poor", from: 0, to: BAND_EDGES[0] },
|
|
38
|
+
{ grade: "fair", from: BAND_EDGES[0], to: BAND_EDGES[1] },
|
|
39
|
+
{ grade: "good", from: BAND_EDGES[1], to: 100 },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
function point(score: number, radius = R): [number, number] {
|
|
43
|
+
const a = ((START_DEG + (SWEEP_DEG * score) / 100) * Math.PI) / 180;
|
|
44
|
+
return [CX + radius * Math.cos(a), CY + radius * Math.sin(a)];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function arcPath(from: number, to: number, radius = R): string {
|
|
48
|
+
const [x1, y1] = point(from, radius);
|
|
49
|
+
const [x2, y2] = point(to, radius);
|
|
50
|
+
return `M ${x1.toFixed(2)} ${y1.toFixed(2)} A ${radius} ${radius} 0 0 1 ${x2.toFixed(2)} ${y2.toFixed(2)}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The keystone wordmark in the caption (the vector in the Figma node,
|
|
54
|
+
* 64 × 13), tinted by `currentColor`. */
|
|
55
|
+
function Wordmark() {
|
|
56
|
+
return (
|
|
57
|
+
<svg className="kscore-wordmark" viewBox="0 0 65 14" fill="none" aria-hidden="true">
|
|
58
|
+
<path
|
|
59
|
+
d="M19.8984 7.6287L21.9991 2.22758H24.272L19.6977 13.1957H17.442L18.8137 10.1138L15.5076 2.22758H17.7633L19.8984 7.6287Z"
|
|
60
|
+
fill="currentColor"
|
|
61
|
+
/>
|
|
62
|
+
<path
|
|
63
|
+
fillRule="evenodd"
|
|
64
|
+
clipRule="evenodd"
|
|
65
|
+
d="M11.6063 2.0031C12.3754 2.0031 13.0757 2.18729 13.707 2.55541C14.3384 2.91204 14.8321 3.40679 15.1879 4.03953C15.5552 4.66072 15.739 5.35091 15.739 6.11013C15.739 6.38621 15.7159 6.68541 15.67 7.0075H9.23201C9.27837 7.32841 9.36925 7.62185 9.50562 7.88763C9.72371 8.27875 10.0165 8.58364 10.3838 8.80222C10.7626 9.0208 11.1818 9.13005 11.641 9.13005C12.1116 9.13003 12.5191 9.02651 12.8635 8.81945C13.2193 8.60089 13.4488 8.32483 13.5521 7.99126H15.6356C15.4979 8.54346 15.2396 9.04395 14.8608 9.49261C14.482 9.92976 14.0054 10.275 13.4315 10.528C12.8576 10.7811 12.2205 10.9075 11.5204 10.9076C10.6939 10.9076 9.9477 10.7177 9.28191 10.338C8.62764 9.94688 8.1111 9.41776 7.7323 8.75055C7.35349 8.08329 7.16401 7.34689 7.16401 6.54159C7.16402 5.71331 7.36491 4.94825 7.76667 4.24651C8.17992 3.54476 8.72524 2.99822 9.4025 2.60708C10.0797 2.20448 10.8143 2.00312 11.6063 2.0031ZM11.5891 3.76338C11.1415 3.76339 10.734 3.87835 10.3666 4.10843C10.0108 4.32701 9.72373 4.64359 9.50562 5.05775C9.45315 5.16294 9.40727 5.27221 9.36812 5.38557H13.5865C13.5635 5.08646 13.4602 4.81593 13.2765 4.57434C13.1044 4.3213 12.8692 4.12561 12.5708 3.98758C12.2838 3.83802 11.9565 3.76338 11.5891 3.76338Z"
|
|
66
|
+
fill="currentColor"
|
|
67
|
+
/>
|
|
68
|
+
<path
|
|
69
|
+
d="M27.4383 2.0031C28.4025 2.00311 29.1944 2.23335 29.8143 2.69349C30.4456 3.14216 30.8132 3.78647 30.9165 4.62629H28.8501C28.8042 4.3272 28.6435 4.0798 28.3681 3.88423C28.1041 3.68867 27.7884 3.59087 27.4211 3.59085C27.0768 3.59085 26.7839 3.67126 26.5429 3.83228C26.3018 3.98183 26.1811 4.2006 26.1811 4.48821C26.1812 4.68376 26.2559 4.84481 26.4051 4.97134C26.5544 5.09788 26.7438 5.1957 26.9734 5.26472C27.2145 5.32224 27.513 5.38546 27.8688 5.45447C28.5116 5.58101 29.0453 5.71916 29.47 5.86871C29.8947 6.01826 30.262 6.27137 30.5719 6.62799C30.8933 6.97311 31.0542 7.45047 31.0542 8.06016C31.0542 8.61235 30.9107 9.10713 30.6237 9.54428C30.3368 9.96993 29.9293 10.3037 29.4012 10.5453C28.8847 10.7869 28.2934 10.9076 27.6276 10.9076C26.9618 10.9076 26.3649 10.7983 25.8368 10.5797C25.3203 10.3496 24.9071 10.0216 24.5971 9.59596C24.2872 9.17031 24.1151 8.66408 24.0807 8.07739H26.078C26.1239 8.43402 26.2846 8.72172 26.5601 8.9403C26.8356 9.15888 27.1971 9.26813 27.6448 9.26813C28.0695 9.26813 28.4026 9.18204 28.6436 9.00948C28.8847 8.82542 29.0051 8.58373 29.0051 8.28464C29.0051 8.06607 28.9306 7.8876 28.7814 7.74956C28.6436 7.61152 28.4484 7.50798 28.1959 7.43895C27.9434 7.35843 27.6391 7.28377 27.2833 7.21475C26.6635 7.0882 26.1467 6.95008 25.7334 6.80052C25.3202 6.65096 24.9643 6.40928 24.6659 6.07568C24.3675 5.74206 24.2182 5.28186 24.2182 4.69519C24.2182 4.16602 24.356 3.7001 24.6315 3.29747C24.907 2.88331 25.286 2.56701 25.7681 2.34843C26.2617 2.11836 26.8184 2.0031 27.4383 2.0031Z"
|
|
70
|
+
fill="currentColor"
|
|
71
|
+
/>
|
|
72
|
+
<path
|
|
73
|
+
fillRule="evenodd"
|
|
74
|
+
clipRule="evenodd"
|
|
75
|
+
d="M41.7566 2.0031C42.5716 2.0031 43.3178 2.19871 43.9951 2.58986C44.6838 2.981 45.2232 3.52182 45.6134 4.21206C46.0152 4.89081 46.2161 5.63865 46.2161 6.45546C46.2161 7.28375 46.0152 8.03736 45.6134 8.7161C45.2232 9.39477 44.6837 9.92967 43.9951 10.3208C43.3178 10.7119 42.5716 10.9076 41.7566 10.9076C40.9416 10.9076 40.1954 10.7119 39.5181 10.3208C38.8409 9.92965 38.3012 9.39483 37.8995 8.7161C37.4977 8.03736 37.2971 7.28375 37.2971 6.45546C37.2971 5.63868 37.4977 4.89079 37.8995 4.21206C38.3012 3.5333 38.8408 2.99823 39.5181 2.60708C40.1954 2.20443 40.9416 2.0031 41.7566 2.0031ZM41.7566 3.95313C41.3089 3.95313 40.9014 4.0624 40.5341 4.28096C40.1782 4.49953 39.8912 4.7987 39.6731 5.17832C39.4664 5.55796 39.3631 5.98379 39.3631 6.45546C39.3632 6.92709 39.4665 7.35272 39.6731 7.73233C39.8912 8.11198 40.1782 8.41111 40.5341 8.62969C40.9014 8.84827 41.3089 8.95752 41.7566 8.95752C42.2043 8.95752 42.6118 8.84828 42.9791 8.62969C43.3464 8.41111 43.6335 8.11198 43.8401 7.73233C44.0582 7.35272 44.1672 6.92709 44.1672 6.45546C44.1672 5.98379 44.0582 5.56368 43.8401 5.19554C43.6335 4.81595 43.3464 4.51703 42.9791 4.29846C42.6118 4.06837 42.2043 3.95313 41.7566 3.95313Z"
|
|
76
|
+
fill="currentColor"
|
|
77
|
+
/>
|
|
78
|
+
<path
|
|
79
|
+
fillRule="evenodd"
|
|
80
|
+
clipRule="evenodd"
|
|
81
|
+
d="M60.3215 2.0031C61.0906 2.0031 61.7909 2.18728 62.4222 2.55541C63.0536 2.91204 63.5472 3.40679 63.9031 4.03953C64.2704 4.66072 64.4541 5.35092 64.4542 6.11013C64.4542 6.38621 64.431 6.68541 64.3851 7.0075H57.9472C57.9935 7.32841 58.0844 7.62185 58.2208 7.88763C58.4389 8.27876 58.7317 8.58364 59.099 8.80222C59.4778 9.02078 59.8967 9.13003 60.3559 9.13005C60.8265 9.13005 61.2343 9.02653 61.5786 8.81945C61.9344 8.60089 62.1639 8.32483 62.2672 7.99126H64.3508C64.213 8.54346 63.9548 9.04395 63.576 9.49261C63.1971 9.92977 62.7206 10.275 62.1467 10.528C61.5728 10.7811 60.9357 10.9075 60.2356 10.9076C59.4091 10.9076 58.6629 10.7177 57.9971 10.338C57.3428 9.94689 56.8263 9.41776 56.4475 8.75055C56.0686 8.08329 55.8792 7.34689 55.8792 6.54159C55.8792 5.71331 56.0801 4.94825 56.4818 4.24651C56.8951 3.54477 57.4404 2.99822 58.1177 2.60708C58.7949 2.20449 59.5295 2.00311 60.3215 2.0031ZM60.3043 3.76338C59.8566 3.76338 59.4491 3.87836 59.0818 4.10843C58.7259 4.32701 58.4389 4.64359 58.2208 5.05775C58.1683 5.16295 58.1224 5.27221 58.0833 5.38557H62.3016C62.2787 5.08646 62.1754 4.81593 61.9917 4.57434C61.8195 4.3213 61.5843 4.12561 61.2859 3.98758C60.9989 3.83802 60.6716 3.76338 60.3043 3.76338Z"
|
|
82
|
+
fill="currentColor"
|
|
83
|
+
/>
|
|
84
|
+
<path d="M2.11762 10.6825L0 10.6836V0H2.11762V10.6825Z" fill="currentColor" />
|
|
85
|
+
<path
|
|
86
|
+
d="M51.6708 2.0031C52.3136 2.0031 52.8818 2.15843 53.3754 2.46901C53.8805 2.77962 54.2708 3.22263 54.5463 3.79783C54.8218 4.37304 54.9597 5.05196 54.9597 5.83426V10.6833H52.8417V5.90316C52.8417 5.32799 52.6868 4.86206 52.3769 4.50544C52.0669 4.1373 51.642 3.95313 51.1025 3.95313C50.563 3.95314 50.1153 4.14303 49.7594 4.52266C49.4151 4.8908 49.243 5.38557 49.243 6.00678V10.6833H47.1423V2.22758H49.2086V3.08966C49.4041 2.87958 49.622 2.6956 49.8628 2.53818C50.4024 2.18155 51.005 2.0031 51.6708 2.0031Z"
|
|
87
|
+
fill="currentColor"
|
|
88
|
+
/>
|
|
89
|
+
<path
|
|
90
|
+
d="M34.8576 2.22758H37.0617V4.05675H34.8576V7.61148C34.8576 8.02561 34.9552 8.33621 35.1503 8.54329C35.3455 8.75037 35.6383 8.8539 36.0285 8.8539H37.0617V10.6831H35.753C34.7543 10.6831 34.0024 10.4474 33.4973 9.97574C32.9922 9.49256 32.7397 8.75616 32.7397 7.76678V4.05675H31.1729V2.22758H31.7409C32.0968 2.22758 32.3724 2.13549 32.5676 1.95142C32.7627 1.76736 32.8603 1.48538 32.8603 1.10574V0.00139657H34.8576V2.22758Z"
|
|
91
|
+
fill="currentColor"
|
|
92
|
+
/>
|
|
93
|
+
<path
|
|
94
|
+
d="M4.64081 6.26237L7.95682 10.6825H5.23432L2.11818 6.26126L5.09821 2.22757H7.66436L4.64081 6.26237Z"
|
|
95
|
+
fill="currentColor"
|
|
96
|
+
/>
|
|
97
|
+
</svg>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface KeystoneScoreCopy {
|
|
102
|
+
/** The three band names along the arc, by grade. */
|
|
103
|
+
bands: Record<Band, string>;
|
|
104
|
+
/** The caption around the wordmark: "Your" ⟨keystone⟩ "Score". */
|
|
105
|
+
before: string;
|
|
106
|
+
after: string;
|
|
107
|
+
/** Accessible name for the gauge ("Keystone Score"). */
|
|
108
|
+
label: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function KeystoneScore({
|
|
112
|
+
value,
|
|
113
|
+
grade,
|
|
114
|
+
copy,
|
|
115
|
+
pill,
|
|
116
|
+
children,
|
|
117
|
+
}: {
|
|
118
|
+
/** 0–100, or null while the score has not landed. */
|
|
119
|
+
value: number | null;
|
|
120
|
+
/** The model's grade; it colours the arc and names the active band. */
|
|
121
|
+
grade: Grade;
|
|
122
|
+
copy: KeystoneScoreCopy;
|
|
123
|
+
/** The grade pill under the caption. */
|
|
124
|
+
pill?: ReactNode;
|
|
125
|
+
/** Fills the number slot while `value` is null. */
|
|
126
|
+
children?: ReactNode;
|
|
127
|
+
}) {
|
|
128
|
+
const score = value == null ? null : Math.min(100, Math.max(0, value));
|
|
129
|
+
const knob = score == null ? null : point(score);
|
|
130
|
+
const measured = score != null;
|
|
131
|
+
/* The band label paths are referenced by id; several gauges may share a page. */
|
|
132
|
+
const uid = useId();
|
|
133
|
+
return (
|
|
134
|
+
<div
|
|
135
|
+
className="kscore"
|
|
136
|
+
data-grade={grade}
|
|
137
|
+
style={{ "--_score": score ?? 0 }}
|
|
138
|
+
role="img"
|
|
139
|
+
aria-label={measured ? `${copy.label}: ${Math.round(score)} of 100` : copy.label}
|
|
140
|
+
>
|
|
141
|
+
<div className="kscore-gauge">
|
|
142
|
+
<svg viewBox={`0 0 ${BOX_W} ${BOX_H}`} aria-hidden="true" focusable="false">
|
|
143
|
+
<path className="kscore-track" d={arcPath(0, 100)} />
|
|
144
|
+
{BAND_EDGES.map((edge) => {
|
|
145
|
+
const [x1, y1] = point(edge, R + TICK_HALF);
|
|
146
|
+
const [x2, y2] = point(edge, R - TICK_HALF);
|
|
147
|
+
return (
|
|
148
|
+
<line
|
|
149
|
+
key={edge}
|
|
150
|
+
className="kscore-tick"
|
|
151
|
+
x1={x1.toFixed(2)}
|
|
152
|
+
y1={y1.toFixed(2)}
|
|
153
|
+
x2={x2.toFixed(2)}
|
|
154
|
+
y2={y2.toFixed(2)}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
})}
|
|
158
|
+
{BANDS.map((band) => {
|
|
159
|
+
const id = `${uid}-${band.grade}`;
|
|
160
|
+
const active = band.grade === grade;
|
|
161
|
+
return (
|
|
162
|
+
<g key={band.grade} className="kscore-band" data-active={active || undefined}>
|
|
163
|
+
<path id={id} d={arcPath(band.from, band.to, R - LABEL_INSET)} fill="none" />
|
|
164
|
+
<text
|
|
165
|
+
className={`type type-fixed ${active ? "ts-text-2xs-semibold" : "ts-text-2xs-medium"}`}
|
|
166
|
+
>
|
|
167
|
+
<textPath href={`#${id}`} startOffset="50%" textAnchor="middle">
|
|
168
|
+
{copy.bands[band.grade]}
|
|
169
|
+
</textPath>
|
|
170
|
+
</text>
|
|
171
|
+
</g>
|
|
172
|
+
);
|
|
173
|
+
})}
|
|
174
|
+
{measured && <path className="kscore-fill" d={arcPath(0, 100)} pathLength={100} />}
|
|
175
|
+
{knob && (
|
|
176
|
+
<circle
|
|
177
|
+
className="kscore-knob"
|
|
178
|
+
cx={knob[0].toFixed(2)}
|
|
179
|
+
cy={knob[1].toFixed(2)}
|
|
180
|
+
r={KNOB_R}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
</svg>
|
|
184
|
+
<span className="type type-fixed ts-text-xs-light kscore-end" data-end="min">
|
|
185
|
+
0
|
|
186
|
+
</span>
|
|
187
|
+
<span className="type type-fixed ts-text-xs-light kscore-end" data-end="max">
|
|
188
|
+
100
|
|
189
|
+
</span>
|
|
190
|
+
<span className="type ts-display-serif-4xl-extralight kscore-value">
|
|
191
|
+
{measured ? Math.round(score) : children}
|
|
192
|
+
</span>
|
|
193
|
+
</div>
|
|
194
|
+
<div className="kscore-caption">
|
|
195
|
+
<span className="type type-fixed ts-text-md-regular kscore-name">
|
|
196
|
+
{copy.before}
|
|
197
|
+
<Wordmark />
|
|
198
|
+
{copy.after}
|
|
199
|
+
</span>
|
|
200
|
+
{pill}
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
}
|
package/primitives/prose.css
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
from the element's `type ts-…` classes (primitives/text.css); nothing
|
|
4
4
|
here sets a font. */
|
|
5
5
|
|
|
6
|
+
/* Designed constants for this file. */
|
|
7
|
+
:root {
|
|
8
|
+
/* The report lede's reading measure (ks-Grader grader/section-head). */
|
|
9
|
+
--sec-sub-measure: 620px;
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
.eyebrow {
|
|
7
13
|
margin: var(--space-none);
|
|
8
14
|
--ls: 0.08em;
|
|
@@ -41,12 +47,19 @@
|
|
|
41
47
|
text-overflow: ellipsis;
|
|
42
48
|
white-space: nowrap;
|
|
43
49
|
}
|
|
44
|
-
.copy[data-clip="2"]
|
|
50
|
+
.copy[data-clip="2"],
|
|
51
|
+
.copy[data-clip="3"] {
|
|
45
52
|
display: -webkit-box;
|
|
46
53
|
-webkit-box-orient: vertical;
|
|
47
|
-
-webkit-line-clamp:
|
|
54
|
+
-webkit-line-clamp: var(--copy-clip);
|
|
48
55
|
white-space: normal;
|
|
49
56
|
}
|
|
57
|
+
.copy[data-clip="2"] {
|
|
58
|
+
--copy-clip: 2;
|
|
59
|
+
}
|
|
60
|
+
.copy[data-clip="3"] {
|
|
61
|
+
--copy-clip: 3;
|
|
62
|
+
}
|
|
50
63
|
.copy-num {
|
|
51
64
|
font-variant-numeric: tabular-nums;
|
|
52
65
|
}
|
|
@@ -56,12 +69,19 @@
|
|
|
56
69
|
text-overflow: ellipsis;
|
|
57
70
|
white-space: nowrap;
|
|
58
71
|
}
|
|
59
|
-
.copy-clip-2
|
|
72
|
+
.copy-clip-2,
|
|
73
|
+
.copy-clip-3 {
|
|
60
74
|
display: -webkit-box;
|
|
61
75
|
-webkit-box-orient: vertical;
|
|
62
|
-
-webkit-line-clamp:
|
|
76
|
+
-webkit-line-clamp: var(--copy-clip);
|
|
63
77
|
overflow: hidden;
|
|
64
78
|
}
|
|
79
|
+
.copy-clip-2 {
|
|
80
|
+
--copy-clip: 2;
|
|
81
|
+
}
|
|
82
|
+
.copy-clip-3 {
|
|
83
|
+
--copy-clip: 3;
|
|
84
|
+
}
|
|
65
85
|
.copy-break {
|
|
66
86
|
word-break: break-all;
|
|
67
87
|
}
|
|
@@ -91,6 +111,32 @@
|
|
|
91
111
|
margin: var(--space-xs) 0 0;
|
|
92
112
|
color: var(--color-text-400);
|
|
93
113
|
}
|
|
114
|
+
/* The report's section head (ks-Grader grader/section-head): the title
|
|
115
|
+
runs 28/34 → 36/42, the lede 16/22 → 18/26 and holds a reading measure. */
|
|
116
|
+
.sec-title[data-size="lg"] {
|
|
117
|
+
color: var(--color-text-000);
|
|
118
|
+
--fs-rm: 28;
|
|
119
|
+
--lh-rm: 34;
|
|
120
|
+
--fs-rt: 36;
|
|
121
|
+
--lh-rt: 42;
|
|
122
|
+
--fs-rd2: 36;
|
|
123
|
+
--lh-rd2: 42;
|
|
124
|
+
--fs-rm-to: var(--fs-rt);
|
|
125
|
+
--lh-rm-to: var(--lh-rt);
|
|
126
|
+
}
|
|
127
|
+
.sec-sub[data-size="lg"] {
|
|
128
|
+
margin-top: var(--space-lg);
|
|
129
|
+
max-width: var(--sec-sub-measure);
|
|
130
|
+
color: var(--color-text-200);
|
|
131
|
+
--fs-rm: 16;
|
|
132
|
+
--lh-rm: 22;
|
|
133
|
+
--fs-rt: 18;
|
|
134
|
+
--lh-rt: 26;
|
|
135
|
+
--fs-rd2: 18;
|
|
136
|
+
--lh-rd2: 26;
|
|
137
|
+
--fs-rm-to: var(--fs-rt);
|
|
138
|
+
--lh-rm-to: var(--lh-rt);
|
|
139
|
+
}
|
|
94
140
|
|
|
95
141
|
/* Dot list: short lines marked with a teal dot. */
|
|
96
142
|
.dot-list {
|
package/primitives/prose.tsx
CHANGED
|
@@ -39,7 +39,7 @@ const COPY_STEP: Record<CopySize, Record<CopyWeight, string>> = {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/** Body copy. Size and weight pick the step; tone tints; `clip` keeps
|
|
42
|
-
* one line (or two) with an ellipsis; `num` sets tabular figures. */
|
|
42
|
+
* one line (or two, or three) with an ellipsis; `num` sets tabular figures. */
|
|
43
43
|
export function Copy({
|
|
44
44
|
as: Tag = "p",
|
|
45
45
|
size = "sm",
|
|
@@ -55,7 +55,7 @@ export function Copy({
|
|
|
55
55
|
size?: CopySize;
|
|
56
56
|
weight?: CopyWeight;
|
|
57
57
|
tone?: "poor" | "teal";
|
|
58
|
-
clip?: 1 | 2;
|
|
58
|
+
clip?: 1 | 2 | 3;
|
|
59
59
|
num?: boolean;
|
|
60
60
|
/** Break anywhere (URLs, identifiers). */
|
|
61
61
|
breakAll?: boolean;
|
|
@@ -135,25 +135,49 @@ export function Figure({
|
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
/** Names a group of surfaces inside a page body.
|
|
138
|
+
/** Names a group of surfaces inside a page body. `lg` is the Grader
|
|
139
|
+
* report's section head (ks-Grader grader/section-head): a thin serif
|
|
140
|
+
* that runs 28 → 36 with the grid, over a lede at 16 → 18. */
|
|
139
141
|
export function SecTitle({
|
|
140
142
|
as: Tag = "h2",
|
|
143
|
+
size,
|
|
144
|
+
id,
|
|
141
145
|
className,
|
|
142
146
|
children,
|
|
143
147
|
}: {
|
|
144
148
|
as?: ElementType;
|
|
149
|
+
size?: "lg";
|
|
150
|
+
/** Lets the section it heads name itself by it (`aria-labelledby`). */
|
|
151
|
+
id?: string;
|
|
145
152
|
className?: string;
|
|
146
153
|
children: ReactNode;
|
|
147
154
|
}) {
|
|
155
|
+
const step =
|
|
156
|
+
size === "lg"
|
|
157
|
+
? "type ts-display-serif-xs-plus-extralight"
|
|
158
|
+
: "type type-fixed ts-display-serif-xs-regular";
|
|
148
159
|
return (
|
|
149
|
-
<Tag className={cx("
|
|
160
|
+
<Tag className={cx(step, "sec-title", className)} data-size={size} id={id}>
|
|
150
161
|
{children}
|
|
151
162
|
</Tag>
|
|
152
163
|
);
|
|
153
164
|
}
|
|
154
165
|
|
|
155
|
-
export function SecSub({
|
|
156
|
-
|
|
166
|
+
export function SecSub({
|
|
167
|
+
size,
|
|
168
|
+
className,
|
|
169
|
+
children,
|
|
170
|
+
}: {
|
|
171
|
+
size?: "lg";
|
|
172
|
+
className?: string;
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
}) {
|
|
175
|
+
const step = size === "lg" ? "type ts-text-md-light" : "type type-fixed ts-text-sm-light";
|
|
176
|
+
return (
|
|
177
|
+
<p className={cx(step, "sec-sub", className)} data-size={size}>
|
|
178
|
+
{children}
|
|
179
|
+
</p>
|
|
180
|
+
);
|
|
157
181
|
}
|
|
158
182
|
|
|
159
183
|
/** Short lines marked with a teal dot. */
|