@canonical/styles 0.30.0 → 0.31.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 +4 -4
- package/src/controls.hover.shim.css +119 -0
- package/src/index.css +9 -1
- package/src/modifiers.criticality.shim.css +39 -15
- package/src/modifiers.density.css +166 -0
- package/src/modifiers.importance.shim.css +11 -4
- package/src/modifiers.states.shim.css +8 -0
- package/src/spacing.css +5 -4
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.
|
|
4
|
+
"version": "0.31.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.
|
|
33
|
+
"@canonical/biome-config": "^0.31.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@canonical/design-tokens": "0.6.2-contrasted.0",
|
|
37
|
-
"@canonical/styles-typography": "^0.
|
|
37
|
+
"@canonical/styles-typography": "^0.31.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": "
|
|
48
|
+
"gitHead": "d4a67ebe42e62b8cf3de77f42f537309ca88d672"
|
|
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
|
|
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
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
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
|
-
*
|
|
19
|
-
*
|
|
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.
|
|
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,166 @@
|
|
|
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 24 (6) 16 (4) 28 (7) 20 (5)
|
|
35
|
+
* space-md 16 (4) 8 (2) 20 (5) 12 (3)
|
|
36
|
+
* space-sm 8 (2) 4 (1) 8 (2) 8 (2)
|
|
37
|
+
* (parenthesised = baseline units; 1 bU = --baseline-height = 4px)
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/* ── Context family: the comfortable/dense PAIR per surface ──────────────────
|
|
41
|
+
* The internal pair-vars are namespaced `--density-*-comfy/-dense` — they ship on
|
|
42
|
+
* the global @canonical/styles surface, so a bare name like `--lh-comfy` would be
|
|
43
|
+
* an easy collision with an app-level variable. The pre-namespace names are kept
|
|
44
|
+
* as back-compat ALIASES (an app or an older ds-global-form that read `--lh-comfy`
|
|
45
|
+
* directly still resolves) — same computed values, no output change. Read the
|
|
46
|
+
* namespaced name in new code; the aliases exist only for the transition. */
|
|
47
|
+
.app {
|
|
48
|
+
--density-lh-comfy: calc(var(--baseline-height) * 8); /* 32px */
|
|
49
|
+
--density-lh-dense: calc(var(--baseline-height) * 6); /* 24px */
|
|
50
|
+
--density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
|
|
51
|
+
--density-pad-inline-dense: calc(var(--baseline-height) * 2); /* 8px */
|
|
52
|
+
--density-space-lg-comfy: calc(var(--baseline-height) * 6); /* 24px */
|
|
53
|
+
--density-space-lg-dense: calc(var(--baseline-height) * 4); /* 16px */
|
|
54
|
+
--density-space-md-comfy: calc(var(--baseline-height) * 4); /* 16px */
|
|
55
|
+
--density-space-md-dense: calc(var(--baseline-height) * 2); /* 8px */
|
|
56
|
+
--density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
|
|
57
|
+
--density-space-sm-dense: calc(var(--baseline-height) * 1); /* 4px */
|
|
58
|
+
|
|
59
|
+
/* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
|
|
60
|
+
--lh-comfy: var(--density-lh-comfy);
|
|
61
|
+
--lh-dense: var(--density-lh-dense);
|
|
62
|
+
--pad-inline-comfy: var(--density-pad-inline-comfy);
|
|
63
|
+
--pad-inline-dense: var(--density-pad-inline-dense);
|
|
64
|
+
--space-lg-comfy: var(--density-space-lg-comfy);
|
|
65
|
+
--space-lg-dense: var(--density-space-lg-dense);
|
|
66
|
+
--space-md-comfy: var(--density-space-md-comfy);
|
|
67
|
+
--space-md-dense: var(--density-space-md-dense);
|
|
68
|
+
--space-sm-comfy: var(--density-space-sm-comfy);
|
|
69
|
+
--space-sm-dense: var(--density-space-sm-dense);
|
|
70
|
+
}
|
|
71
|
+
.site,
|
|
72
|
+
.docs {
|
|
73
|
+
--density-lh-comfy: calc(var(--baseline-height) * 9); /* 36px */
|
|
74
|
+
--density-lh-dense: calc(var(--baseline-height) * 7); /* 28px */
|
|
75
|
+
--density-pad-inline-comfy: calc(var(--baseline-height) * 4); /* 16px */
|
|
76
|
+
--density-pad-inline-dense: calc(var(--baseline-height) * 3); /* 12px */
|
|
77
|
+
--density-space-lg-comfy: calc(var(--baseline-height) * 7); /* 28px */
|
|
78
|
+
--density-space-lg-dense: calc(var(--baseline-height) * 5); /* 20px */
|
|
79
|
+
--density-space-md-comfy: calc(var(--baseline-height) * 5); /* 20px */
|
|
80
|
+
--density-space-md-dense: calc(var(--baseline-height) * 3); /* 12px */
|
|
81
|
+
--density-space-sm-comfy: calc(var(--baseline-height) * 2); /* 8px */
|
|
82
|
+
--density-space-sm-dense: calc(var(--baseline-height) * 2); /* 8px */
|
|
83
|
+
|
|
84
|
+
/* Back-compat aliases (pre-namespace names). Remove once no consumer reads them. */
|
|
85
|
+
--lh-comfy: var(--density-lh-comfy);
|
|
86
|
+
--lh-dense: var(--density-lh-dense);
|
|
87
|
+
--pad-inline-comfy: var(--density-pad-inline-comfy);
|
|
88
|
+
--pad-inline-dense: var(--density-pad-inline-dense);
|
|
89
|
+
--space-lg-comfy: var(--density-space-lg-comfy);
|
|
90
|
+
--space-lg-dense: var(--density-space-lg-dense);
|
|
91
|
+
--space-md-comfy: var(--density-space-md-comfy);
|
|
92
|
+
--space-md-dense: var(--density-space-md-dense);
|
|
93
|
+
--space-sm-comfy: var(--density-space-sm-comfy);
|
|
94
|
+
--space-sm-dense: var(--density-space-sm-dense);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── Density family: pick within the context pair ────────────────────────────
|
|
98
|
+
* Each density tier resolves every GENERIC primitive from the context's
|
|
99
|
+
* *-comfy / *-dense pair. Fallbacks cover the app-comfortable defaults when no
|
|
100
|
+
* context class is present (a plain `.comfortable` still works). */
|
|
101
|
+
.comfortable {
|
|
102
|
+
--density-line-height: var(
|
|
103
|
+
--density-lh-comfy,
|
|
104
|
+
calc(var(--baseline-height) * 8)
|
|
105
|
+
);
|
|
106
|
+
--density-padding-inline: var(
|
|
107
|
+
--density-pad-inline-comfy,
|
|
108
|
+
calc(var(--baseline-height) * 4)
|
|
109
|
+
);
|
|
110
|
+
--density-space-lg: var(
|
|
111
|
+
--density-space-lg-comfy,
|
|
112
|
+
calc(var(--baseline-height) * 6)
|
|
113
|
+
);
|
|
114
|
+
--density-space-md: var(
|
|
115
|
+
--density-space-md-comfy,
|
|
116
|
+
calc(var(--baseline-height) * 4)
|
|
117
|
+
);
|
|
118
|
+
--density-space-sm: var(
|
|
119
|
+
--density-space-sm-comfy,
|
|
120
|
+
calc(var(--baseline-height) * 2)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
.dense {
|
|
124
|
+
--density-line-height: var(
|
|
125
|
+
--density-lh-dense,
|
|
126
|
+
calc(var(--baseline-height) * 6)
|
|
127
|
+
);
|
|
128
|
+
--density-padding-inline: var(
|
|
129
|
+
--density-pad-inline-dense,
|
|
130
|
+
calc(var(--baseline-height) * 2)
|
|
131
|
+
);
|
|
132
|
+
--density-space-lg: var(
|
|
133
|
+
--density-space-lg-dense,
|
|
134
|
+
calc(var(--baseline-height) * 4)
|
|
135
|
+
);
|
|
136
|
+
--density-space-md: var(
|
|
137
|
+
--density-space-md-dense,
|
|
138
|
+
calc(var(--baseline-height) * 2)
|
|
139
|
+
);
|
|
140
|
+
--density-space-sm: var(
|
|
141
|
+
--density-space-sm-dense,
|
|
142
|
+
calc(var(--baseline-height) * 1)
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ── Target baseline = round(up, height × 2/3) ──────────────────────────────
|
|
147
|
+
* Snapped UP so fractional cases lift (apps-comfy 5.33→6) while exact multiples
|
|
148
|
+
* stay (apps-dense 4.0, sites-comfy 6.0). Matches: apps 32→6th/24→4th,
|
|
149
|
+
* sites 36→6th/28→5th. */
|
|
150
|
+
:where(.comfortable, .dense, .app, .site, .docs) {
|
|
151
|
+
/* Effective line-height with the SAME fallback chain a control box uses
|
|
152
|
+
(--density-line-height → context --density-lh-comfy → apps-comfy literal).
|
|
153
|
+
Without this fallback, a bare context class (.app/.site/.docs applied with no
|
|
154
|
+
density class — the documented "no class = comfortable" case) leaves
|
|
155
|
+
--density-line-height unset, the round(calc(var(--density-line-height)…))
|
|
156
|
+
becomes invalid, the target resolves to 0, and controls lose their seating. */
|
|
157
|
+
--density-line-height-effective: var(
|
|
158
|
+
--density-line-height,
|
|
159
|
+
var(--density-lh-comfy, calc(var(--baseline-height) * 8))
|
|
160
|
+
);
|
|
161
|
+
--density-target-baseline-px: round(
|
|
162
|
+
up,
|
|
163
|
+
calc(var(--density-line-height-effective) * 2 / 3),
|
|
164
|
+
var(--baseline-height)
|
|
165
|
+
);
|
|
166
|
+
}
|
|
@@ -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).
|
|
29
|
-
*
|
|
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;
|
|
64
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 */
|