@monospaced/set-skills 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +163 -0
- package/README.md +35 -6
- package/package.json +12 -3
- package/src/set/SKILL.md +128 -0
- package/src/set-free/SKILL.md +47 -0
- package/src/set-loose/SKILL.md +47 -0
- package/src/set-strict/SKILL.md +70 -0
- package/src/set-strict/examples/stepper.md +203 -0
- package/src/compose-first/SKILL.md +0 -100
- package/src/compose-first/examples/core/full-page.md +0 -130
- package/src/compose-first/examples/react/full-page.md +0 -101
- package/src/custom-with-tokens/SKILL.md +0 -102
- package/src/custom-with-tokens/examples/core/stepper.md +0 -215
- package/src/custom-with-tokens/examples/react/stepper.md +0 -220
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
# Stepper (core)
|
|
2
|
-
|
|
3
|
-
Multi-step process indicator (onboarding, checkout, multi-page form). A row of numbered steps with `done`, `current`, and `upcoming` visual states, connected by a baseline. Set doesn't ship one, so it's a clear gap to fill.
|
|
4
|
-
|
|
5
|
-
The example exercises the layered model end-to-end: a leaf component for the done-state checkmark, custom markup for the structural pattern, tokens for every design value (with one component-scoped custom property composed from tokens), and `@keyframes` driving state transitions through motion tokens.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
import { renderSetIcon, renderSetRoot } from "@monospaced/set-core";
|
|
9
|
-
|
|
10
|
-
type Step = { label: string; number: number };
|
|
11
|
-
type StepState = "current" | "done" | "upcoming";
|
|
12
|
-
|
|
13
|
-
const steps: Step[] = [
|
|
14
|
-
{ number: 1, label: "Plan" },
|
|
15
|
-
{ number: 2, label: "Build" },
|
|
16
|
-
{ number: 3, label: "Ship" },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
function getStepState(index: number, currentStep: number): StepState {
|
|
20
|
-
if (currentStep >= steps.length) return "done";
|
|
21
|
-
if (index < currentStep) return "done";
|
|
22
|
-
if (index === currentStep) return "current";
|
|
23
|
-
return "upcoming";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function renderStateLabel(state: StepState): string {
|
|
27
|
-
if (state === "done")
|
|
28
|
-
return '<span class="visually-hidden">, completed</span>';
|
|
29
|
-
if (state === "current")
|
|
30
|
-
return '<span class="visually-hidden">, current step</span>';
|
|
31
|
-
return "";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function renderStepper({ currentStep }: { currentStep: number }): string {
|
|
35
|
-
const items = steps
|
|
36
|
-
.map(({ number, label }, index) => {
|
|
37
|
-
const state = getStepState(index, currentStep);
|
|
38
|
-
const ariaCurrent = state === "current" ? ' aria-current="step"' : "";
|
|
39
|
-
|
|
40
|
-
return `
|
|
41
|
-
<li class="step" data-state="${state}"${ariaCurrent}>
|
|
42
|
-
<span class="bubble" aria-hidden="true">
|
|
43
|
-
<span class="bubble-number">${number}</span>
|
|
44
|
-
<span class="bubble-icon">${renderSetIcon({
|
|
45
|
-
ariaHidden: true,
|
|
46
|
-
name: "check",
|
|
47
|
-
size: "xs",
|
|
48
|
-
})}</span>
|
|
49
|
-
</span>
|
|
50
|
-
<span class="label">${label}${renderStateLabel(state)}</span>
|
|
51
|
-
</li>
|
|
52
|
-
`;
|
|
53
|
-
})
|
|
54
|
-
.join("");
|
|
55
|
-
|
|
56
|
-
return `<ol class="app-stepper">${items}</ol>`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Render inside a Set Root — the `.set` ancestor scopes both system
|
|
60
|
-
// CSS and your `:where(.set) .app-stepper` selector.
|
|
61
|
-
const html = renderSetRoot({
|
|
62
|
-
appRoot: true,
|
|
63
|
-
children: renderStepper({ currentStep: 1 }),
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
```css
|
|
68
|
-
@keyframes app-stepper-check-in {
|
|
69
|
-
from {
|
|
70
|
-
opacity: 0;
|
|
71
|
-
scale: 0.7;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
to {
|
|
75
|
-
opacity: 1;
|
|
76
|
-
scale: 1;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
:where(.set) .app-stepper {
|
|
81
|
-
--app-stepper-size: var(--set-spacing-vertical-800);
|
|
82
|
-
|
|
83
|
-
display: flex;
|
|
84
|
-
list-style: none;
|
|
85
|
-
margin: 0;
|
|
86
|
-
padding-inline: 0;
|
|
87
|
-
|
|
88
|
-
.bubble {
|
|
89
|
-
background-color: var(--set-color-background-subtle);
|
|
90
|
-
block-size: var(--app-stepper-size);
|
|
91
|
-
border-radius: calc(var(--app-stepper-size) * var(--set-radius-ratio-lg));
|
|
92
|
-
color: var(--set-color-foreground-muted-text);
|
|
93
|
-
display: grid;
|
|
94
|
-
font: var(--set-typography-text-body-xs);
|
|
95
|
-
font-variant-numeric: tabular-nums;
|
|
96
|
-
font-weight: var(--set-typography-font-weight-bold);
|
|
97
|
-
inline-size: var(--app-stepper-size);
|
|
98
|
-
place-items: center;
|
|
99
|
-
position: relative;
|
|
100
|
-
transition:
|
|
101
|
-
background-color var(--set-motion-duration-200)
|
|
102
|
-
var(--set-motion-easing-ease-in-out),
|
|
103
|
-
color var(--set-motion-duration-200) var(--set-motion-easing-ease-in-out);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.bubble-icon,
|
|
107
|
-
.bubble-number {
|
|
108
|
-
grid-area: 1 / 1;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.bubble-icon {
|
|
112
|
-
opacity: 0;
|
|
113
|
-
scale: 0.7;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.label {
|
|
117
|
-
color: var(--set-color-foreground-muted-text);
|
|
118
|
-
font: var(--set-typography-text-body-xs);
|
|
119
|
-
font-weight: var(--set-typography-font-weight-medium);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.step {
|
|
123
|
-
display: grid;
|
|
124
|
-
flex: 1;
|
|
125
|
-
gap: var(--set-spacing-vertical-400);
|
|
126
|
-
isolation: isolate;
|
|
127
|
-
justify-items: center;
|
|
128
|
-
position: relative;
|
|
129
|
-
text-align: center;
|
|
130
|
-
|
|
131
|
-
&::after {
|
|
132
|
-
background-color: var(--set-color-border-subtle);
|
|
133
|
-
block-size: var(--set-layout-border-width-thick);
|
|
134
|
-
content: "";
|
|
135
|
-
inline-size: 100%;
|
|
136
|
-
inset-block-start: calc(
|
|
137
|
-
(var(--app-stepper-size) / 2) -
|
|
138
|
-
(var(--set-layout-border-width-thick) / 2)
|
|
139
|
-
);
|
|
140
|
-
inset-inline-start: 50%;
|
|
141
|
-
position: absolute;
|
|
142
|
-
z-index: -1;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
&:first-child {
|
|
146
|
-
justify-items: start;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
&:first-child::after {
|
|
150
|
-
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
151
|
-
inset-inline-start: calc(var(--app-stepper-size) / 2);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&:first-child .label {
|
|
155
|
-
translate: calc((var(--app-stepper-size) - 100%) / 2) 0;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:nth-last-child(2)::after {
|
|
159
|
-
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
&:last-child {
|
|
163
|
-
justify-items: end;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:last-child::after {
|
|
167
|
-
display: none;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
&:last-child .label {
|
|
171
|
-
translate: calc((100% - var(--app-stepper-size)) / 2) 0;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
&[data-state="done"]::after {
|
|
175
|
-
background-color: var(--set-color-foreground-default);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.step[data-state="current"] .bubble,
|
|
180
|
-
.step[data-state="done"] .bubble {
|
|
181
|
-
background-color: var(--set-color-foreground-default);
|
|
182
|
-
color: var(--set-color-foreground-contrast);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.step[data-state="done"] .bubble-icon {
|
|
186
|
-
animation: app-stepper-check-in var(--set-motion-duration-200)
|
|
187
|
-
var(--set-motion-easing-ease-out);
|
|
188
|
-
opacity: 1;
|
|
189
|
-
scale: 1;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.step[data-state="done"] .bubble-number {
|
|
193
|
-
opacity: 0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.step[data-state="current"] .label,
|
|
197
|
-
.step[data-state="done"] .label {
|
|
198
|
-
color: var(--set-color-foreground-default);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
What sits where:
|
|
204
|
-
|
|
205
|
-
- **Leaf component for the content node.** `renderSetIcon` for the done-state checkmark — Set handles its sizing, color inheritance, and a11y. The number and the icon both render unconditionally; CSS reveals the right one for the state via `opacity` + `@keyframes`.
|
|
206
|
-
- **Custom markup expresses the structural pattern.** The `<ol>` / `<li>` / `<span>` skeleton captures "row of state-driven circles connected by a baseline." `aria-current="step"` carries the active-step semantics for screen readers; the bubble is `aria-hidden` because state is conveyed by both `aria-current` and the `.visually-hidden` text appended to the label (`, completed` / `, current step`). `.visually-hidden` is a Set utility class shipped from Root — no need to redefine.
|
|
207
|
-
- **Why not `renderSetText` for numbers and labels?** Text's prop surface doesn't expose `font-weight` or `font-variant-numeric`, and the design needs specific weights (bold for numbers, medium for labels) and tabular figures for the bubble's number to align across states. This is exactly the second branch the skill names in "When this applies" — _the case wants a visual treatment outside any existing component's prop surface_. Drop to a plain `<span>` and reach for typography composites + targeted overrides instead.
|
|
208
|
-
- **Composite typography token + targeted overrides.** `font: var(--set-typography-text-body-xs)` carries the system's full body-xs spec (size, family, line-height) in one declaration. Specific properties then override only the deviations: `font-weight` switches per role (`bold` / `medium`); `font-variant-numeric: tabular-nums` is a CSS keyword (no token surface) that aligns digits across states. Reaching for the composite first keeps you on the system's typography path; overrides surface only the genuine deviations.
|
|
209
|
-
- **Custom CSS, structural.** `display: grid` / `display: flex`, `position: relative` / `absolute`, `place-items: center`, `isolation: isolate` (creates a stacking context so the connector line's `z-index: -1` doesn't escape), edge-aware `:first-child` / `:last-child` rules for row alignment, `border-radius` derived through `calc()`.
|
|
210
|
-
- **Tokens for every design value.** Spacing (`--set-spacing-vertical-{400,800}`), colors (`--set-color-{foreground,background,border}-*`), border (`--set-layout-border-width-thick`), radius via `--set-radius-ratio-lg` composed against the component-scoped size, typography (`--set-typography-text-body-xs` composite, `--set-typography-font-weight-{bold,medium}` overrides), motion (`--set-motion-duration-200`, `--set-motion-easing-ease-{in-out,out}`).
|
|
211
|
-
- **Component-scoped custom property.** `--app-stepper-size` is defined at the component-level selector and consumed by descendants in the same file. The same-file scope keeps it local to the component (the `set/set-known-tokens` lint rule accepts same-file definitions). Tokens still drive the value (`var(--set-spacing-vertical-800)`); the custom property just gives the component one knob to compose around.
|
|
212
|
-
- **Animation through motion tokens.** `@keyframes app-stepper-check-in` defines the entrance transition; `animation: app-stepper-check-in var(--set-motion-duration-200) var(--set-motion-easing-ease-out)` runs it with the system's motion timing.
|
|
213
|
-
- **CSS architecture.** Selector wrapped in `:where(.set)` so the root sits at `0,1,0` (matching system rules); top-level class is project-prefixed (`.app-stepper`); descendants are nested unprefixed.
|
|
214
|
-
|
|
215
|
-
The `data-state` attribute is the seam between markup and styling. State semantics live on the element; state visuals are CSS rules keyed off the attribute. Adding a fourth state (e.g. `error`) is one CSS block referencing `--set-color-status-error-*` and one new value in the data.
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
# Stepper (React)
|
|
2
|
-
|
|
3
|
-
Multi-step process indicator (onboarding, checkout, multi-page form). A row of numbered steps with `done`, `current`, and `upcoming` visual states, connected by a baseline. Set doesn't ship one, so it's a clear gap to fill.
|
|
4
|
-
|
|
5
|
-
The example exercises the layered model end-to-end: a leaf component for the done-state checkmark, custom markup for the structural pattern, tokens for every design value (with one component-scoped custom property composed from tokens), and `@keyframes` driving state transitions through motion tokens.
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { Icon, Root } from "@monospaced/set-react";
|
|
9
|
-
|
|
10
|
-
type Step = { label: string; number: number };
|
|
11
|
-
type StepState = "current" | "done" | "upcoming";
|
|
12
|
-
|
|
13
|
-
const steps: Step[] = [
|
|
14
|
-
{ number: 1, label: "Plan" },
|
|
15
|
-
{ number: 2, label: "Build" },
|
|
16
|
-
{ number: 3, label: "Ship" },
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
function getStepState(index: number, currentStep: number): StepState {
|
|
20
|
-
if (currentStep >= steps.length) return "done";
|
|
21
|
-
if (index < currentStep) return "done";
|
|
22
|
-
if (index === currentStep) return "current";
|
|
23
|
-
return "upcoming";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function Stepper({ currentStep }: { currentStep: number }) {
|
|
27
|
-
return (
|
|
28
|
-
<ol className="app-stepper">
|
|
29
|
-
{steps.map(({ number, label }, index) => {
|
|
30
|
-
const state = getStepState(index, currentStep);
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<li
|
|
34
|
-
key={number}
|
|
35
|
-
className="step"
|
|
36
|
-
data-state={state}
|
|
37
|
-
{...(state === "current" ? { "aria-current": "step" } : {})}
|
|
38
|
-
>
|
|
39
|
-
<span className="bubble" aria-hidden="true">
|
|
40
|
-
<span className="bubble-number">{number}</span>
|
|
41
|
-
<span className="bubble-icon">
|
|
42
|
-
<Icon name="check" size="xs" />
|
|
43
|
-
</span>
|
|
44
|
-
</span>
|
|
45
|
-
<span className="label">
|
|
46
|
-
{label}
|
|
47
|
-
{state === "done" ? (
|
|
48
|
-
<span className="visually-hidden">, completed</span>
|
|
49
|
-
) : null}
|
|
50
|
-
{state === "current" ? (
|
|
51
|
-
<span className="visually-hidden">, current step</span>
|
|
52
|
-
) : null}
|
|
53
|
-
</span>
|
|
54
|
-
</li>
|
|
55
|
-
);
|
|
56
|
-
})}
|
|
57
|
-
</ol>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Render inside a Set Root — the `.set` ancestor scopes both system
|
|
62
|
-
// CSS and your `:where(.set) .app-stepper` selector.
|
|
63
|
-
function App() {
|
|
64
|
-
return (
|
|
65
|
-
<Root appRoot>
|
|
66
|
-
<Stepper currentStep={1} />
|
|
67
|
-
</Root>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```css
|
|
73
|
-
@keyframes app-stepper-check-in {
|
|
74
|
-
from {
|
|
75
|
-
opacity: 0;
|
|
76
|
-
scale: 0.7;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
to {
|
|
80
|
-
opacity: 1;
|
|
81
|
-
scale: 1;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
:where(.set) .app-stepper {
|
|
86
|
-
--app-stepper-size: var(--set-spacing-vertical-800);
|
|
87
|
-
|
|
88
|
-
display: flex;
|
|
89
|
-
list-style: none;
|
|
90
|
-
margin: 0;
|
|
91
|
-
padding-inline: 0;
|
|
92
|
-
|
|
93
|
-
.bubble {
|
|
94
|
-
background-color: var(--set-color-background-subtle);
|
|
95
|
-
block-size: var(--app-stepper-size);
|
|
96
|
-
border-radius: calc(var(--app-stepper-size) * var(--set-radius-ratio-lg));
|
|
97
|
-
color: var(--set-color-foreground-muted-text);
|
|
98
|
-
display: grid;
|
|
99
|
-
font: var(--set-typography-text-body-xs);
|
|
100
|
-
font-variant-numeric: tabular-nums;
|
|
101
|
-
font-weight: var(--set-typography-font-weight-bold);
|
|
102
|
-
inline-size: var(--app-stepper-size);
|
|
103
|
-
place-items: center;
|
|
104
|
-
position: relative;
|
|
105
|
-
transition:
|
|
106
|
-
background-color var(--set-motion-duration-200)
|
|
107
|
-
var(--set-motion-easing-ease-in-out),
|
|
108
|
-
color var(--set-motion-duration-200) var(--set-motion-easing-ease-in-out);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.bubble-icon,
|
|
112
|
-
.bubble-number {
|
|
113
|
-
grid-area: 1 / 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.bubble-icon {
|
|
117
|
-
opacity: 0;
|
|
118
|
-
scale: 0.7;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.label {
|
|
122
|
-
color: var(--set-color-foreground-muted-text);
|
|
123
|
-
font: var(--set-typography-text-body-xs);
|
|
124
|
-
font-weight: var(--set-typography-font-weight-medium);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.step {
|
|
128
|
-
display: grid;
|
|
129
|
-
flex: 1;
|
|
130
|
-
gap: var(--set-spacing-vertical-400);
|
|
131
|
-
isolation: isolate;
|
|
132
|
-
justify-items: center;
|
|
133
|
-
position: relative;
|
|
134
|
-
text-align: center;
|
|
135
|
-
|
|
136
|
-
&::after {
|
|
137
|
-
background-color: var(--set-color-border-subtle);
|
|
138
|
-
block-size: var(--set-layout-border-width-thick);
|
|
139
|
-
content: "";
|
|
140
|
-
inline-size: 100%;
|
|
141
|
-
inset-block-start: calc(
|
|
142
|
-
(var(--app-stepper-size) / 2) -
|
|
143
|
-
(var(--set-layout-border-width-thick) / 2)
|
|
144
|
-
);
|
|
145
|
-
inset-inline-start: 50%;
|
|
146
|
-
position: absolute;
|
|
147
|
-
z-index: -1;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
&:first-child {
|
|
151
|
-
justify-items: start;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&:first-child::after {
|
|
155
|
-
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
156
|
-
inset-inline-start: calc(var(--app-stepper-size) / 2);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&:first-child .label {
|
|
160
|
-
translate: calc((var(--app-stepper-size) - 100%) / 2) 0;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&:nth-last-child(2)::after {
|
|
164
|
-
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&:last-child {
|
|
168
|
-
justify-items: end;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&:last-child::after {
|
|
172
|
-
display: none;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&:last-child .label {
|
|
176
|
-
translate: calc((100% - var(--app-stepper-size)) / 2) 0;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
&[data-state="done"]::after {
|
|
180
|
-
background-color: var(--set-color-foreground-default);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.step[data-state="current"] .bubble,
|
|
185
|
-
.step[data-state="done"] .bubble {
|
|
186
|
-
background-color: var(--set-color-foreground-default);
|
|
187
|
-
color: var(--set-color-foreground-contrast);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.step[data-state="done"] .bubble-icon {
|
|
191
|
-
animation: app-stepper-check-in var(--set-motion-duration-200)
|
|
192
|
-
var(--set-motion-easing-ease-out);
|
|
193
|
-
opacity: 1;
|
|
194
|
-
scale: 1;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.step[data-state="done"] .bubble-number {
|
|
198
|
-
opacity: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.step[data-state="current"] .label,
|
|
202
|
-
.step[data-state="done"] .label {
|
|
203
|
-
color: var(--set-color-foreground-default);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
What sits where:
|
|
209
|
-
|
|
210
|
-
- **Leaf component for the content node.** `Icon` for the done-state checkmark — Set handles its sizing, color inheritance, and a11y. The number and the icon both render unconditionally; CSS reveals the right one for the state via `opacity` + `@keyframes`.
|
|
211
|
-
- **Custom markup expresses the structural pattern.** The `ol` / `li` / `span` skeleton captures "row of state-driven circles connected by a baseline." `aria-current="step"` carries the active-step semantics for screen readers; the bubble is `aria-hidden` because state is conveyed by both `aria-current` and the `.visually-hidden` text appended to the label (`, completed` / `, current step`). `.visually-hidden` is a Set utility class shipped from Root — no need to redefine.
|
|
212
|
-
- **Why not `Text` for numbers and labels?** Text's prop surface doesn't expose `font-weight` or `font-variant-numeric`, and the design needs specific weights (bold for numbers, medium for labels) and tabular figures for the bubble's number to align across states. This is exactly the second branch the skill names in "When this applies" — _the case wants a visual treatment outside any existing component's prop surface_. Drop to a plain `<span>` and reach for typography composites + targeted overrides instead.
|
|
213
|
-
- **Composite typography token + targeted overrides.** `font: var(--set-typography-text-body-xs)` carries the system's full body-xs spec (size, family, line-height) in one declaration. Specific properties then override only the deviations: `font-weight` switches per role (`bold` / `medium`); `font-variant-numeric: tabular-nums` is a CSS keyword (no token surface) that aligns digits across states. Reaching for the composite first keeps you on the system's typography path; overrides surface only the genuine deviations.
|
|
214
|
-
- **Custom CSS, structural.** `display: grid` / `display: flex`, `position: relative` / `absolute`, `place-items: center`, `isolation: isolate` (creates a stacking context so the connector line's `z-index: -1` doesn't escape), edge-aware `:first-child` / `:last-child` rules for row alignment, `border-radius` derived through `calc()`.
|
|
215
|
-
- **Tokens for every design value.** Spacing (`--set-spacing-vertical-{400,800}`), colors (`--set-color-{foreground,background,border}-*`), border (`--set-layout-border-width-thick`), radius via `--set-radius-ratio-lg` composed against the component-scoped size, typography (`--set-typography-text-body-xs` composite, `--set-typography-font-weight-{bold,medium}` overrides), motion (`--set-motion-duration-200`, `--set-motion-easing-ease-{in-out,out}`).
|
|
216
|
-
- **Component-scoped custom property.** `--app-stepper-size` is defined at the component-level selector and consumed by descendants in the same file. The same-file scope keeps it local to the component (the `set/set-known-tokens` lint rule accepts same-file definitions). Tokens still drive the value (`var(--set-spacing-vertical-800)`); the custom property just gives the component one knob to compose around.
|
|
217
|
-
- **Animation through motion tokens.** `@keyframes app-stepper-check-in` defines the entrance transition; `animation: app-stepper-check-in var(--set-motion-duration-200) var(--set-motion-easing-ease-out)` runs it with the system's motion timing.
|
|
218
|
-
- **CSS architecture.** Selector wrapped in `:where(.set)` so the root sits at `0,1,0` (matching system rules); top-level class is project-prefixed (`.app-stepper`); descendants are nested unprefixed.
|
|
219
|
-
|
|
220
|
-
The `data-state` attribute is the seam between markup and styling. State semantics live on the element; state visuals are CSS rules keyed off the attribute. Adding a fourth state (e.g. `error`) is one CSS block referencing `--set-color-status-error-*` and one new value in the data.
|