@monospaced/set-skills 0.24.0 → 0.25.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/package.json +9 -2
- package/src/compose-first/SKILL.md +0 -11
- package/src/custom-with-tokens/SKILL.md +1 -6
- package/src/custom-with-tokens/examples/stepper.md +203 -0
- 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/examples/core/stepper.md +0 -215
- package/src/custom-with-tokens/examples/react/stepper.md +0 -220
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monospaced/set-skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Markdown guardrails for AI coding agents (and humans) building sites and apps with Set.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,5 +15,12 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"src",
|
|
17
17
|
"README.md"
|
|
18
|
-
]
|
|
18
|
+
],
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"prettier": "^3.9.10"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"sync": "node scripts/sync.mjs",
|
|
24
|
+
"verify": "node scripts/verify.mjs"
|
|
25
|
+
}
|
|
19
26
|
}
|
|
@@ -7,8 +7,6 @@ description: Use Set's components to build pages and sections, before authoring
|
|
|
7
7
|
|
|
8
8
|
Set is a compositional system. The fastest path to a correct, accessible, on-brand UI is to build out of the system's components and let their props express your intent — essentially no custom CSS, only tokens for minor edge-case tweaks. Anything beyond that belongs to the next layer.
|
|
9
9
|
|
|
10
|
-
Inline code in this skill is shown in JSX for compactness. See `@monospaced/set-skills/compose-first/examples/core/` for template-string equivalents and `@monospaced/set-skills/compose-first/examples/react/` for the parallel JSX.
|
|
11
|
-
|
|
12
10
|
## Root is required
|
|
13
11
|
|
|
14
12
|
Every Set app must be wrapped in `Root`. It emits the `.set` scoping class that every component's CSS targets, sets the brand and (optional) theme, and carries language / direction attributes. Without it, components render unstyled.
|
|
@@ -83,15 +81,6 @@ Custom CSS at this layer is at most a one-off, token-based tweak (e.g. nudging a
|
|
|
83
81
|
|
|
84
82
|
If a layout genuinely can't be expressed with the existing components, the next layer is custom markup with design tokens. That layer has its own guidance.
|
|
85
83
|
|
|
86
|
-
## Examples
|
|
87
|
-
|
|
88
|
-
Worked examples live alongside this skill:
|
|
89
|
-
|
|
90
|
-
- `@monospaced/set-skills/compose-first/examples/core/` — for `@monospaced/set-core` consumers (SSR / web components / template strings).
|
|
91
|
-
- `@monospaced/set-skills/compose-first/examples/react/` — for `@monospaced/set-react` consumers.
|
|
92
|
-
|
|
93
|
-
Pick the flavor matching your project.
|
|
94
|
-
|
|
95
84
|
## References
|
|
96
85
|
|
|
97
86
|
- Component catalog (live): [Storybook](https://set.monospaced.com/storybook).
|
|
@@ -87,12 +87,7 @@ You've gone past "filling a gap" and started building parallel infrastructure wh
|
|
|
87
87
|
|
|
88
88
|
## Examples
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- `@monospaced/set-skills/custom-with-tokens/examples/core/` — for `@monospaced/set-core` consumers (SSR / web components / template strings).
|
|
93
|
-
- `@monospaced/set-skills/custom-with-tokens/examples/react/` — for `@monospaced/set-react` consumers.
|
|
94
|
-
|
|
95
|
-
Pick the flavor matching your project.
|
|
90
|
+
The stepper example, `@monospaced/set-skills/custom-with-tokens/examples/stepper.md`, fills a gap with the system.
|
|
96
91
|
|
|
97
92
|
## References
|
|
98
93
|
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<!-- Generated by scripts/sync.mjs from templates/stepper.md and apps/playground/src/stepper. Do not edit. -->
|
|
2
|
+
|
|
3
|
+
# Stepper
|
|
4
|
+
|
|
5
|
+
A stepper shows where someone is in a multi-step process: onboarding, checkout, a long form split across pages. It's a row of numbered steps, each done, current or upcoming, joined by a line. Set doesn't ship one, so it's a gap to fill with the system: a Set component where one fits, custom markup for the rest, and tokens for every design value.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import "./Stepper.css";
|
|
9
|
+
|
|
10
|
+
import { Icon } from "@monospaced/set-react";
|
|
11
|
+
|
|
12
|
+
type Step = { label: string; number: number };
|
|
13
|
+
type StepState = "current" | "done" | "upcoming";
|
|
14
|
+
|
|
15
|
+
export const steps: Step[] = [
|
|
16
|
+
{ number: 1, label: "Plan" },
|
|
17
|
+
{ number: 2, label: "Build" },
|
|
18
|
+
{ number: 3, label: "Ship" },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function getStepState(index: number, currentStep: number): StepState {
|
|
22
|
+
if (currentStep >= steps.length) return "done";
|
|
23
|
+
if (index < currentStep) return "done";
|
|
24
|
+
if (index === currentStep) return "current";
|
|
25
|
+
return "upcoming";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function Stepper({ currentStep }: { currentStep: number }) {
|
|
29
|
+
return (
|
|
30
|
+
<ol className="app-stepper">
|
|
31
|
+
{steps.map(({ number, label }, index) => {
|
|
32
|
+
const state = getStepState(index, currentStep);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<li
|
|
36
|
+
key={number}
|
|
37
|
+
className="step"
|
|
38
|
+
data-state={state}
|
|
39
|
+
{...(state === "current" ? { "aria-current": "step" } : {})}
|
|
40
|
+
>
|
|
41
|
+
<span className="bubble" aria-hidden="true">
|
|
42
|
+
<span className="bubble-number">{number}</span>
|
|
43
|
+
<span className="bubble-icon">
|
|
44
|
+
<Icon name="check" size="xs" />
|
|
45
|
+
</span>
|
|
46
|
+
</span>
|
|
47
|
+
<span className="label">
|
|
48
|
+
{label}
|
|
49
|
+
{state === "done" ? (
|
|
50
|
+
<span className="visually-hidden">, completed</span>
|
|
51
|
+
) : null}
|
|
52
|
+
{state === "current" ? (
|
|
53
|
+
<span className="visually-hidden">, current step</span>
|
|
54
|
+
) : null}
|
|
55
|
+
</span>
|
|
56
|
+
</li>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
</ol>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
:where(.set) .app-stepper {
|
|
66
|
+
--app-stepper-size: var(--set-spacing-vertical-800);
|
|
67
|
+
|
|
68
|
+
display: flex;
|
|
69
|
+
list-style: none;
|
|
70
|
+
margin: 0;
|
|
71
|
+
padding-inline: 0;
|
|
72
|
+
|
|
73
|
+
.bubble {
|
|
74
|
+
background-color: var(--set-color-background-subtle);
|
|
75
|
+
block-size: var(--app-stepper-size);
|
|
76
|
+
border-radius: calc(var(--app-stepper-size) * var(--set-radius-ratio-lg));
|
|
77
|
+
color: var(--set-color-foreground-muted-text);
|
|
78
|
+
display: grid;
|
|
79
|
+
font: var(--set-typography-text-body-xs-font);
|
|
80
|
+
font-variant-numeric: tabular-nums;
|
|
81
|
+
font-variation-settings: var(
|
|
82
|
+
--set-typography-font-variation-settings-default
|
|
83
|
+
);
|
|
84
|
+
font-weight: var(--set-typography-font-weight-bold);
|
|
85
|
+
inline-size: var(--app-stepper-size);
|
|
86
|
+
place-items: center;
|
|
87
|
+
position: relative;
|
|
88
|
+
transition:
|
|
89
|
+
background-color var(--set-motion-duration-200)
|
|
90
|
+
var(--set-motion-easing-ease-in-out),
|
|
91
|
+
color var(--set-motion-duration-200) var(--set-motion-easing-ease-in-out);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.bubble-icon,
|
|
95
|
+
.bubble-number {
|
|
96
|
+
grid-area: 1 / 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.bubble-icon {
|
|
100
|
+
opacity: 0;
|
|
101
|
+
scale: 0.7;
|
|
102
|
+
transition:
|
|
103
|
+
opacity var(--set-motion-duration-200) var(--set-motion-easing-ease-out),
|
|
104
|
+
scale var(--set-motion-duration-200) var(--set-motion-easing-ease-out);
|
|
105
|
+
|
|
106
|
+
@media (prefers-reduced-motion: reduce) {
|
|
107
|
+
scale: 1;
|
|
108
|
+
transition: opacity var(--set-motion-duration-200)
|
|
109
|
+
var(--set-motion-easing-ease-out);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.label {
|
|
114
|
+
color: var(--set-color-foreground-muted-text);
|
|
115
|
+
font: var(--set-typography-text-body-xs-font);
|
|
116
|
+
font-variation-settings: var(
|
|
117
|
+
--set-typography-font-variation-settings-default
|
|
118
|
+
);
|
|
119
|
+
font-weight: var(--set-typography-font-weight-medium);
|
|
120
|
+
inline-size: max-content;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.step {
|
|
124
|
+
display: grid;
|
|
125
|
+
flex: 1;
|
|
126
|
+
gap: var(--set-spacing-vertical-400);
|
|
127
|
+
grid-template-columns: var(--app-stepper-size);
|
|
128
|
+
isolation: isolate;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
justify-items: center;
|
|
131
|
+
position: relative;
|
|
132
|
+
|
|
133
|
+
&::after {
|
|
134
|
+
background-color: var(--set-color-border-subtle);
|
|
135
|
+
block-size: var(--set-layout-border-width-thick);
|
|
136
|
+
content: "";
|
|
137
|
+
inline-size: 100%;
|
|
138
|
+
inset-block-start: calc(
|
|
139
|
+
(var(--app-stepper-size) / 2) -
|
|
140
|
+
(var(--set-layout-border-width-thick) / 2)
|
|
141
|
+
);
|
|
142
|
+
inset-inline-start: 50%;
|
|
143
|
+
position: absolute;
|
|
144
|
+
z-index: -1;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:first-child {
|
|
148
|
+
justify-content: start;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:first-child::after {
|
|
152
|
+
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
153
|
+
inset-inline-start: calc(var(--app-stepper-size) / 2);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:nth-last-child(2)::after {
|
|
157
|
+
inline-size: calc(150% - (var(--app-stepper-size) / 2));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&:last-child {
|
|
161
|
+
justify-content: end;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:last-child::after {
|
|
165
|
+
display: none;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&[data-state="done"]::after {
|
|
169
|
+
background-color: var(--set-color-foreground-default);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.step[data-state="current"] .bubble,
|
|
174
|
+
.step[data-state="done"] .bubble {
|
|
175
|
+
background-color: var(--set-color-foreground-default);
|
|
176
|
+
color: var(--set-color-foreground-contrast);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.step[data-state="done"] .bubble-icon {
|
|
180
|
+
opacity: 1;
|
|
181
|
+
scale: 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.step[data-state="done"] .bubble-number {
|
|
185
|
+
opacity: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.step[data-state="current"] .label,
|
|
189
|
+
.step[data-state="done"] .label {
|
|
190
|
+
color: var(--set-color-foreground-default);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Notes
|
|
196
|
+
|
|
197
|
+
- **`Icon` is the one leaf a component covers.** It handles the checkmark's sizing and color inheritance. The number and the icon both render on every step, and CSS reveals the one the state calls for.
|
|
198
|
+
- **Why not `Text` for the number and label?** The design needs specific weights and tabular figures, and `Text` doesn't expose `font-weight` or `font-variant-numeric`. So the example drops to a plain `span`, takes the body-xs composite font token, and overrides only the deviations.
|
|
199
|
+
- **`data-state` is the seam between markup and styling.** State semantics live on the element, and each visual state is a CSS rule keyed off the attribute. An `error` state would be one more value in the data and one more CSS block, colored with `--set-color-intent-danger-*`.
|
|
200
|
+
- **One size, from one token.** `--app-stepper-size` is set once from a vertical spacing token, so the bubble follows the vertical rhythm and both sides match. It's round by convention, as step markers are, with a radius of `--set-radius-ratio-lg` times its size. The property is defined and consumed in the same file, which keeps it local to the component and satisfies the `set/set-known-tokens` lint rule.
|
|
201
|
+
- **The step is a one-column grid as wide as the bubble.** Centring the label in that column places it under the bubble whether the step is justified to the start, the centre or the end, in either writing direction, so the first and last labels need no offset of their own. A label wider than the bubble overhangs the row's ends by half the difference, so keep end labels short or give the row room.
|
|
202
|
+
- **Transitions, not keyframes.** A transition doesn't run on first render, so completed steps don't animate in as the page loads; the checkmark only moves when a step becomes done. Under `prefers-reduced-motion: reduce` the scale is dropped and the fade stands in.
|
|
203
|
+
- **Accessibility.** `aria-current="step"` marks the active step. The bubble is `aria-hidden` because the state is already carried by `aria-current` and by the `.visually-hidden` text appended to each label. `.visually-hidden` ships from `Root`, so there's nothing to redefine.
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# Full page (core)
|
|
2
|
-
|
|
3
|
-
A complete page composition: branded header with nav, a content intro section laid on the 12-column responsive grid, footer. Built entirely from Set components — no custom CSS.
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import {
|
|
7
|
-
defineSetNav,
|
|
8
|
-
renderSetBox,
|
|
9
|
-
renderSetButton,
|
|
10
|
-
renderSetContainer,
|
|
11
|
-
renderSetDivider,
|
|
12
|
-
renderSetGrid,
|
|
13
|
-
renderSetGridItem,
|
|
14
|
-
renderSetHeading,
|
|
15
|
-
renderSetInline,
|
|
16
|
-
renderSetLogo,
|
|
17
|
-
renderSetNav,
|
|
18
|
-
renderSetPage,
|
|
19
|
-
renderSetRoot,
|
|
20
|
-
renderSetStack,
|
|
21
|
-
renderSetText,
|
|
22
|
-
} from "@monospaced/set-core";
|
|
23
|
-
|
|
24
|
-
defineSetNav();
|
|
25
|
-
|
|
26
|
-
const page = renderSetPage({
|
|
27
|
-
headerBorder: "scroll",
|
|
28
|
-
headerSize: "lg",
|
|
29
|
-
stickyHeader: "always",
|
|
30
|
-
header: renderSetContainer({
|
|
31
|
-
gutter: "narrow",
|
|
32
|
-
maxInlineSize: "wide",
|
|
33
|
-
children: renderSetBox({
|
|
34
|
-
paddingBlock: "sm",
|
|
35
|
-
paddingInline: "none",
|
|
36
|
-
responsive: true,
|
|
37
|
-
children: renderSetInline({
|
|
38
|
-
gap: "sm",
|
|
39
|
-
justify: "between",
|
|
40
|
-
children: [
|
|
41
|
-
`<a href="/">${renderSetLogo({ label: "Brand", variant: "primary" })}</a>`,
|
|
42
|
-
renderSetNav({
|
|
43
|
-
collapsible: "belowTablet",
|
|
44
|
-
contentId: "site-nav",
|
|
45
|
-
expanderPosition: "end",
|
|
46
|
-
items: [
|
|
47
|
-
{ current: "page", href: "/", label: "Home" },
|
|
48
|
-
{ href: "/work", label: "Work" },
|
|
49
|
-
{ href: "/about", label: "About" },
|
|
50
|
-
],
|
|
51
|
-
}),
|
|
52
|
-
].join(""),
|
|
53
|
-
}),
|
|
54
|
-
}),
|
|
55
|
-
}),
|
|
56
|
-
children: renderSetContainer({
|
|
57
|
-
children: renderSetBox({
|
|
58
|
-
paddingBlock: "2xl",
|
|
59
|
-
paddingInline: "none",
|
|
60
|
-
children: renderSetGrid({
|
|
61
|
-
children: renderSetGridItem({
|
|
62
|
-
colSpan: 6,
|
|
63
|
-
colSpanNarrow: 12,
|
|
64
|
-
children: renderSetStack({
|
|
65
|
-
align: "start",
|
|
66
|
-
gap: "lg",
|
|
67
|
-
children: [
|
|
68
|
-
renderSetHeading({
|
|
69
|
-
level: 1,
|
|
70
|
-
responsive: true,
|
|
71
|
-
size: "4xl",
|
|
72
|
-
children: "A heading that anchors the section",
|
|
73
|
-
}),
|
|
74
|
-
renderSetText({
|
|
75
|
-
as: "p",
|
|
76
|
-
children:
|
|
77
|
-
"Supporting copy that introduces the topic. Set's Text component handles the type scale and measure so this paragraph reads well at any viewport.",
|
|
78
|
-
}),
|
|
79
|
-
renderSetButton({
|
|
80
|
-
appearance: "solid",
|
|
81
|
-
label: "Get started",
|
|
82
|
-
size: "lg",
|
|
83
|
-
}),
|
|
84
|
-
].join(""),
|
|
85
|
-
}),
|
|
86
|
-
}),
|
|
87
|
-
}),
|
|
88
|
-
}),
|
|
89
|
-
}),
|
|
90
|
-
footer: renderSetContainer({
|
|
91
|
-
gutter: "narrow",
|
|
92
|
-
maxInlineSize: "wide",
|
|
93
|
-
children: [
|
|
94
|
-
renderSetDivider({ tone: "brand" }),
|
|
95
|
-
renderSetBox({
|
|
96
|
-
paddingBlock: "sm",
|
|
97
|
-
paddingInline: "none",
|
|
98
|
-
responsive: true,
|
|
99
|
-
children: renderSetText({
|
|
100
|
-
as: "p",
|
|
101
|
-
tone: "muted",
|
|
102
|
-
children: "© 2026 Brand",
|
|
103
|
-
}),
|
|
104
|
-
}),
|
|
105
|
-
].join(""),
|
|
106
|
-
}),
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const html = renderSetRoot({
|
|
110
|
-
appOverscrollBehavior: "none",
|
|
111
|
-
appRoot: true,
|
|
112
|
-
children: page,
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
## What's compositional here
|
|
117
|
-
|
|
118
|
-
- **Root** wraps the app, emitting the `.set` scoping class every component's CSS targets. `appRoot` marks this as the owning app root.
|
|
119
|
-
- **Page** owns the shell layout. Header is sticky.
|
|
120
|
-
- **Container** bounds the header, main, and footer. The header / footer use a wider `gutter` and `maxInlineSize`; main keeps the default reading width.
|
|
121
|
-
- **Box** carries vertical padding rhythm — `sm` for header, `2xl` for main, `md` for footer.
|
|
122
|
-
- **Inline** lays out the logo and nav with `justify: "between"`.
|
|
123
|
-
- **Nav** is a structural component that handles collapse / expander wiring at narrow viewports.
|
|
124
|
-
- **Grid** + **GridItem** lay the main content on the 12-column responsive system. The item spans 6 columns at the default container threshold and falls back to all 12 at narrow viewports — the breakpoint behavior is built into the primitive.
|
|
125
|
-
- **Stack** stacks the heading, copy, and CTA inside the grid item with a consistent `gap`. No margins.
|
|
126
|
-
- **Heading**, **Text**, **Button**, **Logo**, **Divider** are content leaves.
|
|
127
|
-
|
|
128
|
-
Main content runs the canonical chassis — **Root → Page → Container → Grid → GridItem → Stack → leaves** — with **Box** providing the section padding around the Grid (Box is a flexible primitive, applied wherever padding / background / border is needed; it has no fixed position in the chain). Site furniture (header, footer) rarely needs the column system, so it nests more simply: **Container → Inline → leaves**, again with Box where padding rhythm is needed.
|
|
129
|
-
|
|
130
|
-
No custom CSS.
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# Full page (react)
|
|
2
|
-
|
|
3
|
-
A complete page composition: branded header with nav, a content intro section laid on the 12-column responsive grid, footer. Built entirely from Set components — no custom CSS.
|
|
4
|
-
|
|
5
|
-
```tsx
|
|
6
|
-
import {
|
|
7
|
-
Box,
|
|
8
|
-
Button,
|
|
9
|
-
Container,
|
|
10
|
-
Divider,
|
|
11
|
-
Grid,
|
|
12
|
-
GridItem,
|
|
13
|
-
Heading,
|
|
14
|
-
Inline,
|
|
15
|
-
Logo,
|
|
16
|
-
Nav,
|
|
17
|
-
Page,
|
|
18
|
-
Root,
|
|
19
|
-
Stack,
|
|
20
|
-
Text,
|
|
21
|
-
} from "@monospaced/set-react";
|
|
22
|
-
|
|
23
|
-
export function App() {
|
|
24
|
-
return (
|
|
25
|
-
<Root appOverscrollBehavior="none" appRoot>
|
|
26
|
-
<Page
|
|
27
|
-
headerBorder="scroll"
|
|
28
|
-
headerSize="lg"
|
|
29
|
-
stickyHeader="always"
|
|
30
|
-
header={
|
|
31
|
-
<Container gutter="narrow" maxInlineSize="wide">
|
|
32
|
-
<Box paddingBlock="sm" paddingInline="none" responsive>
|
|
33
|
-
<Inline gap="sm" justify="between">
|
|
34
|
-
<a href="/">
|
|
35
|
-
<Logo label="Brand" variant="primary" />
|
|
36
|
-
</a>
|
|
37
|
-
<Nav
|
|
38
|
-
collapsible="belowTablet"
|
|
39
|
-
contentId="site-nav"
|
|
40
|
-
expanderPosition="end"
|
|
41
|
-
items={[
|
|
42
|
-
{ current: "page", href: "/", label: "Home" },
|
|
43
|
-
{ href: "/work", label: "Work" },
|
|
44
|
-
{ href: "/about", label: "About" },
|
|
45
|
-
]}
|
|
46
|
-
/>
|
|
47
|
-
</Inline>
|
|
48
|
-
</Box>
|
|
49
|
-
</Container>
|
|
50
|
-
}
|
|
51
|
-
footer={
|
|
52
|
-
<Container gutter="narrow" maxInlineSize="wide">
|
|
53
|
-
<Divider tone="brand" />
|
|
54
|
-
<Box paddingBlock="sm" paddingInline="none" responsive>
|
|
55
|
-
<Text as="p" tone="muted">
|
|
56
|
-
© 2026 Brand
|
|
57
|
-
</Text>
|
|
58
|
-
</Box>
|
|
59
|
-
</Container>
|
|
60
|
-
}
|
|
61
|
-
>
|
|
62
|
-
<Container>
|
|
63
|
-
<Box paddingBlock="2xl" paddingInline="none">
|
|
64
|
-
<Grid>
|
|
65
|
-
<GridItem colSpan={6} colSpanNarrow={12}>
|
|
66
|
-
<Stack align="start" gap="lg">
|
|
67
|
-
<Heading level={1} responsive size="4xl">
|
|
68
|
-
A heading that anchors the section
|
|
69
|
-
</Heading>
|
|
70
|
-
<Text as="p">
|
|
71
|
-
Supporting copy that introduces the topic. Set's Text
|
|
72
|
-
component handles the type scale and measure so this
|
|
73
|
-
paragraph reads well at any viewport.
|
|
74
|
-
</Text>
|
|
75
|
-
<Button appearance="solid" label="Get started" size="lg" />
|
|
76
|
-
</Stack>
|
|
77
|
-
</GridItem>
|
|
78
|
-
</Grid>
|
|
79
|
-
</Box>
|
|
80
|
-
</Container>
|
|
81
|
-
</Page>
|
|
82
|
-
</Root>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## What's compositional here
|
|
88
|
-
|
|
89
|
-
- **Root** wraps the app, emitting the `.set` scoping class every component's CSS targets. `appRoot` marks this as the owning app root.
|
|
90
|
-
- **Page** owns the shell layout. Header is sticky.
|
|
91
|
-
- **Container** bounds the header, main, and footer. The header / footer use a wider `gutter` and `maxInlineSize`; main keeps the default reading width.
|
|
92
|
-
- **Box** carries vertical padding rhythm — `sm` for header, `2xl` for main, `md` for footer.
|
|
93
|
-
- **Inline** lays out the logo and nav with `justify="between"`.
|
|
94
|
-
- **Nav** is a structural component that handles collapse / expander wiring at narrow viewports.
|
|
95
|
-
- **Grid** + **GridItem** lay the main content on the 12-column responsive system. The item spans 6 columns at the default container threshold and falls back to all 12 at narrow viewports — the breakpoint behavior is built into the primitive.
|
|
96
|
-
- **Stack** stacks the heading, copy, and CTA inside the grid item with a consistent `gap`. No margins.
|
|
97
|
-
- **Heading**, **Text**, **Button**, **Logo**, **Divider** are content leaves.
|
|
98
|
-
|
|
99
|
-
Main content runs the canonical chassis — **Root → Page → Container → Grid → GridItem → Stack → leaves** — with **Box** providing the section padding around the Grid (Box is a flexible primitive, applied wherever padding / background / border is needed; it has no fixed position in the chain). Site furniture (header, footer) rarely needs the column system, so it nests more simply: **Container → Inline → leaves**, again with Box where padding rhythm is needed.
|
|
100
|
-
|
|
101
|
-
No custom CSS.
|
|
@@ -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.
|