@canonical/styles 0.30.0 → 0.32.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/styles",
3
3
  "description": "Canonical Design System global stylesheet. Aggregates normalize, typography, and design tokens.",
4
- "version": "0.30.0",
4
+ "version": "0.32.0",
5
5
  "main": "src/index.css",
6
6
  "exports": {
7
7
  ".": "./src/index.css",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@biomejs/biome": "2.4.9",
33
- "@canonical/biome-config": "^0.30.0"
33
+ "@canonical/biome-config": "^0.32.0"
34
34
  },
35
35
  "dependencies": {
36
- "@canonical/design-tokens": "0.6.2-contrasted.0",
37
- "@canonical/styles-typography": "^0.30.0",
36
+ "@canonical/design-tokens": "0.8.1",
37
+ "@canonical/styles-typography": "^0.32.0",
38
38
  "normalize.css": "^8.0.1"
39
39
  },
40
40
  "peerDependencies": {
@@ -45,5 +45,5 @@
45
45
  "optional": true
46
46
  }
47
47
  },
48
- "gitHead": "40fe86ac955473536ac14f074812a9821f5b65c0"
48
+ "gitHead": "5b279d8150e3988c68c6c2a741046bcd425624ca"
49
49
  }
@@ -0,0 +1,119 @@
1
+ /* @canonical/styles — Control selected-state SURFACE + HOVER SHIM (temporary)
2
+ *
3
+ * The generated design-tokens surface the control colours per nesting level
4
+ * (`.surface` → `.surface .surface` → `.contrasted` → `.modal`, in
5
+ * `@canonical/design-tokens/dist/modifiers.surfaces.css`) for the checkbox/radio
6
+ * UNSELECTED + checkmark and the switch knob — but NOT for any SELECTED state,
7
+ * nor the switch's unselected track. They also expose `--hover--color-foreground-*`
8
+ * (an OKLCH lightness-delta hover shade) only for those same unselected states.
9
+ *
10
+ * Consequences this shim fixes:
11
+ * 1. Selected controls were not surface-provided: a :checked box/dot/track kept
12
+ * the flat `--color-foreground-*-selected` on every surface, ignoring
13
+ * OnSurface stepping. (Ideal: selected states come through the surface layer
14
+ * like the unselected ones do.)
15
+ * 2. Hovered selected controls had no hover token, so components faked it with
16
+ * `filter: brightness()` on the whole <input> — which also dimmed the masked
17
+ * checkmark glyph / switch knob (Diana's review: "hover should not affect the
18
+ * checkmark/knob colour, just the fill/background").
19
+ *
20
+ * ── Part 1: surface-provided selected tokens ────────────────────────────────
21
+ * Mirror the surfaces.css selector structure so a control's SELECTED fill reads
22
+ * `--surface-color-foreground-*-selected`, resolved per surface. The design build
23
+ * has no `-selected-layer2/-layer3/-contrasted` PRIMITIVES yet, so every level
24
+ * currently aliases the flat base — but establishing the surface token means (a)
25
+ * components stop hard-coding the flat token, and (b) upstream can drop in real
26
+ * per-layer values later with zero component change. `switch-unselected` gets the
27
+ * same treatment (its surface token is also absent).
28
+ *
29
+ * ── Part 2: hover channels ──────────────────────────────────────────────────
30
+ * Same idiom as the generated `--hover--` tokens: shift the (now surface-aware)
31
+ * base lightness by the per-family `--delta-hover-*` step. Because Part 1 defines
32
+ * the surface tokens, these hovers are surface-correct too.
33
+ *
34
+ * Components read the CHANNELS, never re-derive the maths. Part 1 is zero-
35
+ * specificity (`:where()`) so it self-upgrades when upstream lands; Part 2 can be
36
+ * dropped once the `--hover--…-selected` tokens are generated. Imported into
37
+ * `ds.modifiers` after the generated tokens.
38
+ */
39
+
40
+ @layer ds.modifiers {
41
+ /* Part 1 — surface-provided selected tokens, per surface level (mirrors
42
+ * modifiers.surfaces.css). No -selected-layerN primitives exist yet, so each
43
+ * level aliases the flat base.
44
+ *
45
+ * SELF-UPGRADING (no manual removal): the selectors are wrapped in `:where()`,
46
+ * so this block has ZERO specificity. The generated `modifiers.surfaces.css`
47
+ * rules use normal `.surface` selectors (specificity 0,1,0), so the moment
48
+ * upstream defines the real per-level `-selected` values they WIN over this
49
+ * fallback automatically — even though this shim is imported later in the same
50
+ * layer. The shim can stay indefinitely; it only ever supplies a value when
51
+ * upstream has none. (Removing it once upstream lands is still tidy, but no
52
+ * longer load-bearing.) */
53
+ :where(
54
+ .surface,
55
+ .surface .surface,
56
+ .surface .surface .surface,
57
+ .contrasted,
58
+ .modal
59
+ ) {
60
+ --surface-color-foreground-checkbox-selected: var(
61
+ --color-foreground-checkbox-selected
62
+ );
63
+ --surface-color-foreground-radio-selected: var(
64
+ --color-foreground-radio-selected
65
+ );
66
+ --surface-color-foreground-switch-selected: var(
67
+ --color-foreground-switch-selected
68
+ );
69
+ --surface-color-foreground-switch-unselected: var(
70
+ --color-foreground-switch-unselected
71
+ );
72
+ }
73
+
74
+ /* Part 2 — hover channels, derived from the surface-aware base above. */
75
+ :root {
76
+ /* Checkbox — selected fill on :checked / :indeterminate hover. */
77
+ --hover--color-foreground-checkbox-selected: oklch(
78
+ from
79
+ var(
80
+ --surface-color-foreground-checkbox-selected,
81
+ var(--color-foreground-checkbox-selected)
82
+ )
83
+ calc(l + var(--delta-hover-color-foreground-checkbox-selected, -0.0391))
84
+ c h
85
+ );
86
+
87
+ /* Switch — selected track on :checked hover, and unselected track hover. */
88
+ --hover--color-foreground-switch-selected: oklch(
89
+ from
90
+ var(
91
+ --surface-color-foreground-switch-selected,
92
+ var(--color-foreground-switch-selected)
93
+ )
94
+ calc(l + var(--delta-hover-color-foreground-switch-selected, -0.0391)) c
95
+ h
96
+ );
97
+
98
+ --hover--color-foreground-switch-unselected: oklch(
99
+ from
100
+ var(
101
+ --surface-color-foreground-switch-unselected,
102
+ var(--color-foreground-switch-unselected)
103
+ )
104
+ calc(l + var(--delta-hover-color-foreground-switch-unselected, -0.0391))
105
+ c h
106
+ );
107
+
108
+ /* Radio — selected dot on :checked hover (parity with checkbox). */
109
+ --hover--color-foreground-radio-selected: oklch(
110
+ from
111
+ var(
112
+ --surface-color-foreground-radio-selected,
113
+ var(--color-foreground-radio-selected)
114
+ )
115
+ calc(l + var(--delta-hover-color-foreground-radio-selected, -0.0391)) c
116
+ h
117
+ );
118
+ }
119
+ }
package/src/index.css CHANGED
@@ -30,10 +30,14 @@
30
30
  hints so importance-driven components can render their hierarchy.
31
31
  - criticality: adds an icon channel (--modifier-icon) mapping each
32
32
  criticality class to its glyph, so criticality components render the icon
33
- from the modifier rather than hard-coding it. */
33
+ from the modifier rather than hard-coding it.
34
+ - controls-hover: adds the missing selected-state (and switch unselected)
35
+ `--hover--color-foreground-*` shades so checkbox/radio/switch hover shifts
36
+ only the fill/track, not the masked glyph/knob. */
34
37
  @import url("./modifiers.states.shim.css");
35
38
  @import url("./modifiers.importance.shim.css");
36
39
  @import url("./modifiers.criticality.shim.css");
40
+ @import url("./controls.hover.shim.css");
37
41
  @import url("@canonical/design-tokens/dist/states.css");
38
42
 
39
43
  /* Grid layout presets */
@@ -42,6 +46,10 @@
42
46
  /* Spacing architecture tokens */
43
47
  @import url("./spacing.css");
44
48
 
49
+ /* Density modifier family (context × density → control height + baseline).
50
+ * After spacing.css, which supplies the --baseline-height these primitives use. */
51
+ @import url("./modifiers.density.css");
52
+
45
53
  /* Scroll overflow affordance tokens */
46
54
  @import url("./overflow.css");
47
55
 
@@ -1,47 +1,71 @@
1
- /* @canonical/styles — Criticality modifier ICON SHIM (temporary)
1
+ /* @canonical/styles — Criticality modifier SHIM (temporary)
2
2
  *
3
3
  * The generated `@canonical/design-tokens/dist/modifiers.criticality.css`
4
4
  * exposes the colour channels for each criticality (`--modifier-color-icon`,
5
- * `-text`, `-border`, `-foreground-secondary`) but NOT an icon channel: nothing
6
- * says *which glyph* signals "information" vs "warning" etc. Criticality-driven
7
- * components (Announcement, and future callouts) each hard-code that mapping in
8
- * their own markup today.
5
+ * `-text`, `-border`, `-foreground-secondary`) but is missing two channels this
6
+ * shim fills in, keyed off the criticality class. Remove each block once its
7
+ * channel is generated upstream in the criticality modifier tokens.
9
8
  *
10
- * This hand-authored shim adds a single channel, keyed off the criticality
11
- * class, that carries the glyph as a CSS `mask-image` reference into the
12
- * Canonical icon set (served at `/icons/<name>.svg`):
9
+ * Design contract — components listen to the CHANNEL, never to the class. A
10
+ * consumer must not key off `.information` / `.warning`; it reads the generic
11
+ * channel, so any criticality gets the right value for free.
12
+ *
13
+ * ── 1. Icon channel (--modifier-icon) ──────────────────────────────────────
14
+ * Nothing upstream says *which glyph* signals "information" vs "warning" etc.
15
+ * Criticality-driven components (Announcement, and future callouts) each
16
+ * hard-code that mapping in their own markup today. This adds a channel that
17
+ * carries the glyph as a CSS `mask-image` reference into the Canonical icon set
18
+ * (served at `/icons/<name>.svg`):
13
19
  *
14
20
  * --modifier-icon a `mask-image` value; a component masks a pseudo-element
15
21
  * with it and fills it with `--modifier-color-icon`, so the
16
22
  * glyph both matches the criticality AND takes its colour.
17
23
  *
18
- * Design contract — components listen to the CHANNEL, never to the class. A
19
- * consumer must not key off `.information` / `.warning`; it reads
20
- * `--modifier-icon` generically, so any criticality gets the right glyph for
21
- * free. This mirrors the mask technique used by Accordion's chevron and the
22
- * form CheckboxInput's checkmark (mask-image + background-color so the glyph is
24
+ * This mirrors the mask technique used by Accordion's chevron and the form
25
+ * CheckboxInput's checkmark (mask-image + background-color so the glyph is
23
26
  * recolourable, unlike a background-image SVG).
24
27
  *
28
+ * ── 2. On-surface text channel (--modifier-color-text-onForegroundSecondary) ─
29
+ * The generated `--modifier-color-text` is the *standalone* criticality text
30
+ * colour (e.g. green text on the page background). Components that place text on
31
+ * the criticality's own coloured surface — Badge sits its label on
32
+ * `--modifier-color-foreground-secondary` — need the *on-surface* pairing
33
+ * instead, or they render same-hue-on-same-hue with failing contrast. The
34
+ * design-tokens build already defines `--color-text-onForegroundSecondary-*`
35
+ * per criticality; it just isn't wired into the modifier family. This exposes
36
+ * it as a channel so on-surface criticality components read it generically.
37
+ *
25
38
  * Imported into the `ds.modifiers` layer after the generated criticality
26
39
  * modifiers so these class rules compose at equal specificity, later source
27
- * order. Remove once an icon channel is generated upstream in the criticality
28
- * modifier tokens.
40
+ * order.
29
41
  */
30
42
 
31
43
  @layer ds.modifiers {
32
44
  .information {
33
45
  --modifier-icon: url("/icons/information.svg#information");
46
+ --modifier-color-text-onForegroundSecondary: var(
47
+ --color-text-onForegroundSecondary-information
48
+ );
34
49
  }
35
50
 
36
51
  .success {
37
52
  --modifier-icon: url("/icons/success.svg#success");
53
+ --modifier-color-text-onForegroundSecondary: var(
54
+ --color-text-onForegroundSecondary-success
55
+ );
38
56
  }
39
57
 
40
58
  .warning {
41
59
  --modifier-icon: url("/icons/warning.svg#warning");
60
+ --modifier-color-text-onForegroundSecondary: var(
61
+ --color-text-onForegroundSecondary-warning
62
+ );
42
63
  }
43
64
 
44
65
  .error {
45
66
  --modifier-icon: url("/icons/error.svg#error");
67
+ --modifier-color-text-onForegroundSecondary: var(
68
+ --color-text-onForegroundSecondary-error
69
+ );
46
70
  }
47
71
  }
@@ -0,0 +1,234 @@
1
+ /* @canonical/styles — Density modifier family
2
+ *
3
+ * A composed 2×3 modifier family that sizes controls and seats their text on the
4
+ * 4px baseline grid, applied as classes on an ancestor (an app root, or a section):
5
+ *
6
+ * CONTEXT .app / .site / .docs — the surface. Sets the comfortable/dense
7
+ * PAIR for every density primitive. `.docs` shares `.site`'s values.
8
+ * DENSITY .comfortable / .dense — picks within the context pair.
9
+ *
10
+ * This is the LOWEST layer of the density system, and it lives in @canonical/styles
11
+ * so EVERY package can read it (ds-global, ds-global-form, and any future consumer)
12
+ * — the primitives were previously in ds-global-form, out of reach of ds-global.
13
+ *
14
+ * Design contract — components listen to the CHANNEL, never to the class. This
15
+ * file exposes only GENERIC, domain-neutral primitives; it knows nothing about
16
+ * forms, fields, buttons, accordions, or any component. A consumer reads the
17
+ * `--density-*` outputs and applies them to its own box/tokens (see the seating
18
+ * guides shipped by ds-global-form):
19
+ *
20
+ * --density-line-height the control-height / line unit for a cell
21
+ * --density-line-height-effective the same, with the full fallback chain
22
+ * --density-target-baseline-px the grid line a control's baseline lands on
23
+ * --density-padding-inline inline padding for a cell
24
+ * --density-space-sm / -md / -lg three vertical spacing rungs for a cell
25
+ *
26
+ * Every value is a WHOLE multiple of --baseline-height (from spacing.css), so
27
+ * vertical rhythm holds in all four cells. Sites/docs run one baseline looser than
28
+ * apps on the height (+4px) and on each rung, so the looser surface breathes.
29
+ *
30
+ * app site / docs
31
+ * comfy dense comfy dense
32
+ * line-height 32 (8) 24 (6) 36 (9) 28 (7)
33
+ * padding-inline 16 (4) 8 (2) 16 (4) 12 (3)
34
+ * space-lg 40 (10) 32 (8) 44 (11) 36 (9) ← between fields
35
+ * space-md 8 (2) 4 (1) 8 (2) 8 (2) ← label → control
36
+ * space-sm 8 (2) 4 (1) 8 (2) 8 (2) ← desc/error → input
37
+ * space-xs 4 (1) 4 (1) 4 (1) 4 (1) ← label → description
38
+ * (parenthesised = baseline units; 1 bU = --baseline-height = 4px)
39
+ *
40
+ * NB the space-lg / space-md values were retuned from Diana's 15/07 review
41
+ * (label→input 8px, between-fields 40px), and space-xs (label→description 4px)
42
+ * added, replacing the earlier graded 16/24 rungs. The values stay whole
43
+ * baseline multiples, so vertical rhythm holds.
44
+ */
45
+
46
+ /* ── Context family: the comfortable/dense PAIR per surface ──────────────────
47
+ * The internal pair-vars are namespaced `--density-*-comfy/-dense` — they ship on
48
+ * the global @canonical/styles surface, so a bare name like `--lh-comfy` would be
49
+ * an easy collision with an app-level variable. The pre-namespace names are kept
50
+ * as back-compat ALIASES (an app or an older ds-global-form that read `--lh-comfy`
51
+ * directly still resolves) — same computed values, no output change. Read the
52
+ * namespaced name in new code; the aliases exist only for the transition. */
53
+ .app {
54
+ --density-lh-comfy: calc(var(--baseline-height) * 8); /* 32px */
55
+ --density-lh-dense: calc(var(--baseline-height) * 6); /* 24px */
56
+ --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
57
+ --density-pad-inline-dense: calc(var(--baseline-height) * 2); /* 8px */
58
+ --density-space-lg-comfy: calc(var(--baseline-height) * 10); /* 40px */
59
+ --density-space-lg-dense: calc(var(--baseline-height) * 8); /* 32px */
60
+ --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
61
+ --density-space-md-dense: calc(var(--baseline-height) * 1); /* 4px */
62
+ --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
63
+ --density-space-sm-dense: calc(var(--baseline-height) * 1); /* 4px */
64
+ --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
65
+ --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
66
+
67
+ /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
68
+ --lh-comfy: var(--density-lh-comfy);
69
+ --lh-dense: var(--density-lh-dense);
70
+ --pad-inline-comfy: var(--density-pad-inline-comfy);
71
+ --pad-inline-dense: var(--density-pad-inline-dense);
72
+ --space-lg-comfy: var(--density-space-lg-comfy);
73
+ --space-lg-dense: var(--density-space-lg-dense);
74
+ --space-md-comfy: var(--density-space-md-comfy);
75
+ --space-md-dense: var(--density-space-md-dense);
76
+ --space-sm-comfy: var(--density-space-sm-comfy);
77
+ --space-sm-dense: var(--density-space-sm-dense);
78
+ }
79
+ .site,
80
+ .docs {
81
+ --density-lh-comfy: calc(var(--baseline-height) * 9); /* 36px */
82
+ --density-lh-dense: calc(var(--baseline-height) * 7); /* 28px */
83
+ --density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
84
+ --density-pad-inline-dense: calc(var(--baseline-height) * 3); /* 12px */
85
+ --density-space-lg-comfy: calc(var(--baseline-height) * 11); /* 44px */
86
+ --density-space-lg-dense: calc(var(--baseline-height) * 9); /* 36px */
87
+ --density-space-md-comfy: calc(var(--baseline-height) * 2); /* 8px */
88
+ --density-space-md-dense: calc(var(--baseline-height) * 2); /* 8px */
89
+ --density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
90
+ --density-space-sm-dense: calc(var(--baseline-height) * 2); /* 8px */
91
+ --density-space-xs-comfy: calc(var(--baseline-height) * 1); /* 4px */
92
+ --density-space-xs-dense: calc(var(--baseline-height) * 1); /* 4px */
93
+
94
+ /* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
95
+ --lh-comfy: var(--density-lh-comfy);
96
+ --lh-dense: var(--density-lh-dense);
97
+ --pad-inline-comfy: var(--density-pad-inline-comfy);
98
+ --pad-inline-dense: var(--density-pad-inline-dense);
99
+ --space-lg-comfy: var(--density-space-lg-comfy);
100
+ --space-lg-dense: var(--density-space-lg-dense);
101
+ --space-md-comfy: var(--density-space-md-comfy);
102
+ --space-md-dense: var(--density-space-md-dense);
103
+ --space-sm-comfy: var(--density-space-sm-comfy);
104
+ --space-sm-dense: var(--density-space-sm-dense);
105
+ }
106
+
107
+ /* ── Density family: pick within the context pair ────────────────────────────
108
+ * Each density tier resolves every GENERIC primitive from the context's
109
+ * *-comfy / *-dense pair. Fallbacks cover the app-comfortable defaults when no
110
+ * context class is present (a plain `.comfortable` still works). */
111
+ .comfortable {
112
+ --density-line-height: var(
113
+ --density-lh-comfy,
114
+ calc(var(--baseline-height) * 8)
115
+ );
116
+ --density-padding-inline: var(
117
+ --density-pad-inline-comfy,
118
+ calc(var(--baseline-height) * 4)
119
+ );
120
+ --density-space-lg: var(
121
+ --density-space-lg-comfy,
122
+ calc(var(--baseline-height) * 10)
123
+ );
124
+ --density-space-md: var(
125
+ --density-space-md-comfy,
126
+ calc(var(--baseline-height) * 2)
127
+ );
128
+ --density-space-sm: var(
129
+ --density-space-sm-comfy,
130
+ calc(var(--baseline-height) * 2)
131
+ );
132
+ --density-space-xs: var(
133
+ --density-space-xs-comfy,
134
+ calc(var(--baseline-height) * 1)
135
+ );
136
+ }
137
+ .dense {
138
+ --density-line-height: var(
139
+ --density-lh-dense,
140
+ calc(var(--baseline-height) * 6)
141
+ );
142
+ --density-padding-inline: var(
143
+ --density-pad-inline-dense,
144
+ calc(var(--baseline-height) * 2)
145
+ );
146
+ --density-space-lg: var(
147
+ --density-space-lg-dense,
148
+ calc(var(--baseline-height) * 8)
149
+ );
150
+ --density-space-md: var(
151
+ --density-space-md-dense,
152
+ calc(var(--baseline-height) * 1)
153
+ );
154
+ --density-space-sm: var(
155
+ --density-space-sm-dense,
156
+ calc(var(--baseline-height) * 1)
157
+ );
158
+ --density-space-xs: var(
159
+ --density-space-xs-dense,
160
+ calc(var(--baseline-height) * 1)
161
+ );
162
+ }
163
+
164
+ /* ── Target baseline = round(nearest, height × 2/3) ─────────────────────────
165
+ * The control text seats where line-height × 2/3 lands on the grid — the optical
166
+ * centre of the box — snapped to the NEAREST grid line, not the next one up.
167
+ * Nearest (not up) because up over-lifts the one cell where lh × 2/3 is
168
+ * fractional: apps-comfortable is 32 × 2/3 = 21.33px, which round(up) forced a
169
+ * whole step onto the 24px line (6th), a baseline too low. round(nearest) seats
170
+ * it on the 20px line (5th) — Diana's F-O2 "move text 1 baseline up in
171
+ * apps/comfortable" (AV-323). The exact-multiple cells are unaffected:
172
+ * apps-comfy 21.33 → 20 (5th) ← the fix; was 24
173
+ * apps-dense 16.00 → 16 (4th) unchanged (exact)
174
+ * sites-comfy 24.00 → 24 (6th) unchanged (exact)
175
+ * sites-dense 18.67 → 20 (5th) unchanged (nearest == up here)
176
+ * So it's a self-correcting rule, not a per-cell offset: any future fractional
177
+ * cell snaps to its nearest line too. */
178
+ :where(.comfortable, .dense, .app, .site, .docs) {
179
+ /* Effective line-height with the SAME fallback chain a control box uses
180
+ (--density-line-height → context --density-lh-comfy → apps-comfy literal).
181
+ Without this fallback, a bare context class (.app/.site/.docs applied with no
182
+ density class — the documented "no class = comfortable" case) leaves
183
+ --density-line-height unset, the round(calc(var(--density-line-height)…))
184
+ becomes invalid, the target resolves to 0, and controls lose their seating. */
185
+ --density-line-height-effective: var(
186
+ --density-line-height,
187
+ var(--density-lh-comfy, calc(var(--baseline-height) * 8))
188
+ );
189
+ --density-target-baseline-px: round(
190
+ nearest,
191
+ calc(var(--density-line-height-effective) * 2 / 3),
192
+ var(--baseline-height)
193
+ );
194
+
195
+ /* ── Control seat (intrinsic) ──────────────────────────────────────────────
196
+ * ONE seat for every control (button, input chrome, accordion header, …):
197
+ * the text's own line box — the density cell minus one baseline of headroom
198
+ * per side (`--control-seat-line`) — IS the control interior. The height is
199
+ * INTRINSIC: no block-size; border + pads + line-height add up to the cell,
200
+ * and both outer edges land on grid lines.
201
+ *
202
+ * The shared layer exports the two BORDER-AGNOSTIC pieces. A var() inside a
203
+ * custom property is substituted where the property is DECLARED — here, the
204
+ * density scope — so a component's border can never be a formula input at
205
+ * this level; each component folds its own border in at the application site
206
+ * (single-line <input>/<select> also floor the line at the UA's `normal`
207
+ * minimum — see the form package's density.css):
208
+ *
209
+ * --seat-before: max(0px, calc(
210
+ * var(--control-seat-basis) - <border-width>));
211
+ * --seat-after: max(0px, calc(
212
+ * var(--density-line-height-effective) - var(--control-seat-line) -
213
+ * var(--seat-before) - 2 * <border-width>));
214
+ * line-height: var(--control-seat-line);
215
+ * padding-block: var(--seat-before) var(--seat-after);
216
+ *
217
+ * `1cap` below stays an unresolved token inside the custom property and only
218
+ * resolves where the seat is APPLIED — each component's own font — so
219
+ * components with different fonts still seat on the SAME grid index. The
220
+ * border must be the control's CONSTANT nominal width (transparent where no
221
+ * border shows), so bordered and borderless variants share one geometry. */
222
+ --control-seat-line: calc(
223
+ var(--density-line-height-effective) -
224
+ 2 *
225
+ var(--baseline-height)
226
+ );
227
+ /* Unclamped distance from just inside the box's top border down to the
228
+ target baseline, for a --control-seat-line line box. */
229
+ --control-seat-basis: calc(
230
+ var(--density-target-baseline-px) -
231
+ (var(--control-seat-line) + 1cap) /
232
+ 2
233
+ );
234
+ }
@@ -25,8 +25,10 @@
25
25
  * with the on-foreground contrast tokens. This shim is imported after the
26
26
  * anticipation/emphasis modifiers in the same `ds.modifiers` layer, so on a
27
27
  * `.primary.destructive` button the anticipation colour drives the fill while
28
- * this contrast text wins (equal specificity, later source order). For ghost
29
- * importances the text channel is left untouched, so the anticipation colour
28
+ * this contrast text wins (equal specificity, later source order).
29
+ * `.secondary` pins its text to the root text colour by the same mechanism —
30
+ * per design, the secondary label never takes the anticipation colour. Only
31
+ * `.tertiary` leaves the text channel untouched, so the anticipation colour
30
32
  * lands on the text — exactly the Figma treatment.
31
33
  */
32
34
 
@@ -60,8 +62,9 @@
60
62
  );
61
63
  }
62
64
 
63
- /* Secondary — outlined: a ghost background with a visible border; text/icon
64
- keep the modifier colour. */
65
+ /* Secondary — outlined: a ghost background with a visible border; the icon
66
+ keeps the modifier colour, but the label is pinned to the root text colour
67
+ (the anticipation colour shows on the border/fill states, not the text). */
65
68
  .secondary {
66
69
  --modifier-surface: var(
67
70
  --modifier-color-foreground-ghost,
@@ -73,6 +76,10 @@
73
76
  --modifier-color-foreground-ghost-disabled
74
77
  );
75
78
  --modifier-outline: 1;
79
+ /* `color/text/root` compiles to the bare `--color-text` var; re-point at a
80
+ dedicated `button.secondary` semantic token once ratified upstream. */
81
+ --modifier-color-text: var(--color-text);
82
+ --modifier-color-text-disabled: var(--color-text-disabled);
76
83
  }
77
84
 
78
85
  /* Tertiary — text: a ghost background, no border; text/icon keep the modifier
@@ -69,6 +69,10 @@
69
69
  );
70
70
  --modifier-color-text-disabled: var(--color-text-disabled);
71
71
  --modifier-color-icon-disabled: var(--color-icon-disabled);
72
+ /* The disabled border tracks the highlighted ramp the enabled border uses
73
+ (it matches the disabled-text tone), not the much fainter plain
74
+ border-disabled ramp. */
75
+ --modifier-color-border-disabled: var(--color-border-highlighted-disabled);
72
76
  }
73
77
 
74
78
  .constructive {
@@ -92,6 +96,7 @@
92
96
  );
93
97
  --modifier-color-text-disabled: var(--color-text-constructive-disabled);
94
98
  --modifier-color-icon-disabled: var(--color-icon-constructive-disabled);
99
+ --modifier-color-border-disabled: var(--color-border-constructive-disabled);
95
100
  }
96
101
 
97
102
  .destructive {
@@ -115,6 +120,7 @@
115
120
  );
116
121
  --modifier-color-text-disabled: var(--color-text-destructive-disabled);
117
122
  --modifier-color-icon-disabled: var(--color-icon-destructive-disabled);
123
+ --modifier-color-border-disabled: var(--color-border-destructive-disabled);
118
124
  }
119
125
 
120
126
  /* `caution` uses the `warning` colour ramp. The ghost-warning state tokens do
@@ -144,6 +150,7 @@
144
150
  );
145
151
  --modifier-color-text-disabled: var(--color-text-warning-disabled);
146
152
  --modifier-color-icon-disabled: var(--color-icon-warning-disabled);
153
+ --modifier-color-border-disabled: var(--color-border-warning-disabled);
147
154
  }
148
155
 
149
156
  .branded {
@@ -167,5 +174,6 @@
167
174
  );
168
175
  --modifier-color-text-disabled: var(--color-text-branded-disabled);
169
176
  --modifier-color-icon-disabled: var(--color-icon-branded-disabled);
177
+ --modifier-color-border-disabled: var(--color-border-branded-disabled);
170
178
  }
171
179
  }
package/src/spacing.css CHANGED
@@ -16,10 +16,11 @@
16
16
 
17
17
  :root {
18
18
  /* ── Baseline grid ──────────────────────────────────────────────── */
19
- --space-baseline: var(
20
- --dimension-size-height-baseline,
21
- 0.5rem
22
- ); /* 8px — bU */
19
+ /* SPIKE: the baseline unit is 4px (down from 8px). Set here in styles, NOT in
20
+ the design token — the token (--dimension-size-height-baseline) is left at
21
+ 8px and intentionally no longer consumed, so this is the single place the
22
+ 4px grid lives until it is promoted into design-tokens via its own PR. */
23
+ --space-baseline: 0.25rem; /* 4px — bU (was the 8px --dimension-size-height-baseline token) */
23
24
  --baseline-height: var(
24
25
  --space-baseline
25
26
  ); /* alias consumed by typography engine */