actual-css 0.20.2 → 0.21.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +6 -6
  3. package/components.json +19 -4
  4. package/dist/actual.full.css +451 -118
  5. package/dist/actual.full.js +2 -2
  6. package/dist/actual.full.min.css +1 -1
  7. package/dist/types/data-flag.d.ts +1 -0
  8. package/dist/types/enhancement-loader-state.d.ts +6 -0
  9. package/dist/types/enhancement-loader.d.ts +0 -2
  10. package/dist/types/parse-config.d.ts +0 -1
  11. package/dist/types/popover-transport.d.ts +2 -0
  12. package/dist/types/status.d.ts +0 -1
  13. package/dist/types/validation.d.ts +6 -2
  14. package/docs/pages/components/app-navigation.md +67 -0
  15. package/docs/pages/components/button.md +3 -0
  16. package/docs/pages/components/dialog.md +3 -0
  17. package/docs/pages/components/list.md +13 -0
  18. package/docs/pages/components/segmented.md +7 -4
  19. package/docs/pages/components/table.md +4 -1
  20. package/docs/pages/enhancements/flyout.md +12 -3
  21. package/docs/pages/enhancements/tooltip.md +1 -0
  22. package/docs/pages/examples/overview.md +29 -1
  23. package/docs/pages/forms/combobox.md +10 -8
  24. package/docs/pages/forms/labels.md +7 -0
  25. package/docs/pages/forms/overview.md +13 -10
  26. package/docs/pages/forms/validation.md +3 -3
  27. package/docs/pages/foundations/philosophy.md +26 -0
  28. package/docs/pages/foundations/theming.md +80 -7
  29. package/docs/pages/foundations/tokens.md +39 -2
  30. package/docs/pages/guides/coding-agents.md +11 -0
  31. package/docs/pages/guides/introduction.md +1 -1
  32. package/docs/pages/guides/progressive-enhancement.md +88 -20
  33. package/docs/pages/guides/tailwind.md +12 -6
  34. package/docs/pages/guides/upgrading.md +52 -0
  35. package/docs/pages/layout/app-layout.md +50 -1
  36. package/docs/pages/patterns/empty-state.md +48 -10
  37. package/forms.json +325 -0
  38. package/llms.txt +2 -1
  39. package/package.json +3 -1
  40. package/reserved-classes.json +1 -0
  41. package/skills/actual-css/SKILL.md +1 -1
  42. package/skills/actual-css/references/api-and-vocabulary.md +2 -1
  43. package/src/cli/actual-css.js +8 -2
  44. package/src/css/components/app-nav.css +75 -18
  45. package/src/css/components/badge.css +7 -1
  46. package/src/css/components/button.css +20 -3
  47. package/src/css/components/flyout.css +5 -2
  48. package/src/css/components/list.css +28 -13
  49. package/src/css/components/menu.css +18 -0
  50. package/src/css/components/meter.css +4 -0
  51. package/src/css/components/progress.css +9 -2
  52. package/src/css/components/segmented.css +22 -12
  53. package/src/css/components/table.css +21 -2
  54. package/src/css/core/theme.css +11 -1
  55. package/src/css/core/tokens.css +16 -2
  56. package/src/css/forms/choice-card.css +4 -3
  57. package/src/css/forms/choice.css +28 -16
  58. package/src/css/forms/control.css +23 -16
  59. package/src/css/forms/custom-select.css +3 -1
  60. package/src/css/forms/form.css +8 -5
  61. package/src/css/forms/otp.css +2 -1
  62. package/src/css/forms/range.css +20 -6
  63. package/src/css/forms/select.css +12 -4
  64. package/src/css/forms/switch.css +11 -5
  65. package/src/css/layout/app-layout.css +104 -5
  66. package/src/js/data-flag.js +4 -0
  67. package/src/js/dialog.js +5 -8
  68. package/src/js/enhancement-loader-state.js +7 -0
  69. package/src/js/enhancement-loader.js +4 -21
  70. package/src/js/keys.js +5 -7
  71. package/src/js/parse-config.js +0 -2
  72. package/src/js/popover-transport.js +18 -0
  73. package/src/js/status.js +0 -2
  74. package/src/js/surface.js +35 -41
  75. package/src/js/tooltip.js +8 -36
  76. package/src/js/validation.js +24 -10
  77. package/src/tooling/css-bundle.js +5 -0
  78. package/src/tooling/design-tokens.js +8 -1
  79. package/src/tooling/theme-contrast.js +45 -17
  80. package/tokens.json +4 -0
@@ -10,6 +10,7 @@
10
10
  * --list-item-pad-block
11
11
  * --list-item-pad-inline
12
12
  * --list-item-gap
13
+ * --list-current-inset-block
13
14
  * --list-divider
14
15
  * --list-radius
15
16
  */
@@ -52,18 +53,6 @@
52
53
  background: var(--surface-raised);
53
54
  }
54
55
 
55
- /* A row's fill sits inside the shell's border box, so its inner radius is the
56
- shell radius minus that border — and never negative on a square theme. */
57
- .list.grouped > :where(li:first-child > .list-item, .list-item:first-child) {
58
- border-start-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
59
- border-start-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
60
- }
61
-
62
- .list.grouped > :where(li:last-child > .list-item, .list-item:last-child) {
63
- border-end-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
64
- border-end-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
65
- }
66
-
67
56
  /*
68
57
  * Flex, not a three-track grid: the leading and trailing regions are optional,
69
58
  * and a fixed `auto minmax(0, 1fr) auto` template gives an absent region a
@@ -93,6 +82,20 @@
93
82
  border-block-start: var(--list-divider);
94
83
  }
95
84
 
85
+ /* A row's fill sits inside the shell's border box, so its inner radius is the
86
+ shell radius minus that border — and never negative on a square theme. */
87
+ .list.grouped > :where(li:first-child) > :where(.list-item),
88
+ .list.grouped > :where(.list-item:first-child) {
89
+ border-start-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
90
+ border-start-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
91
+ }
92
+
93
+ .list.grouped > :where(li:last-child) > :where(.list-item),
94
+ .list.grouped > :where(.list-item:last-child) {
95
+ border-end-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
96
+ border-end-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
97
+ }
98
+
96
99
  a.list-item {
97
100
  position: relative;
98
101
  color: inherit;
@@ -119,9 +122,21 @@ a.list-item:is([aria-current="page"], [aria-current="true"]) {
119
122
  a.list-item:is([aria-current="page"], [aria-current="true"])::before {
120
123
  content: "";
121
124
  position: absolute;
122
- inset-block: var(--list-item-pad-block);
125
+ inset-block: var(--list-current-inset-block, var(--list-item-pad-block));
123
126
  inset-inline-start: 0;
124
127
  border-inline-start: 2px solid var(--state-selected);
128
+ pointer-events: none;
129
+ }
130
+
131
+ /* Draw against the full corner, then trim the mark. Clipping the row itself
132
+ would also clip its focus outline and any flyout anchored inside it. */
133
+ :is(.list.grouped > li > .list-item, .list.grouped > .list-item):is(
134
+ [aria-current="page"],
135
+ [aria-current="true"]
136
+ )::before {
137
+ inset: 0;
138
+ border-radius: inherit;
139
+ clip-path: inset(var(--list-current-inset-block, var(--list-item-pad-block)) 0);
125
140
  }
126
141
 
127
142
  /* The content region is the one that flexes, whichever position it holds.
@@ -67,6 +67,24 @@
67
67
  text-overflow: ellipsis;
68
68
  }
69
69
 
70
+ .menu-item-text:where(:has(> .menu-item-desc)),
71
+ .menu-item-desc {
72
+ overflow-wrap: anywhere;
73
+ white-space: normal;
74
+ }
75
+
76
+ .menu-item-desc {
77
+ display: block;
78
+ color: var(--text-muted);
79
+ font-size: 0.875em;
80
+ }
81
+
82
+ /* Keep the leading icon aligned with the label when the description wraps. */
83
+ .menu-item:where(:has(> .menu-item-text > .menu-item-desc)) {
84
+ align-items: flex-start;
85
+ padding-block: var(--space-10);
86
+ }
87
+
70
88
  .menu-item-end {
71
89
  display: inline-flex;
72
90
  align-items: center;
@@ -29,6 +29,8 @@
29
29
  border: 0;
30
30
  border-radius: var(--bar-radius);
31
31
  background: var(--meter-track);
32
+ /* A rail, recessed with the fields when a theme sets --shadow-inset. */
33
+ box-shadow: var(--shadow-inset, none);
32
34
  }
33
35
 
34
36
  /* A non-native meter is a weighted flex container. The element type keeps the
@@ -56,6 +58,8 @@
56
58
  border: 0;
57
59
  border-radius: var(--bar-radius);
58
60
  background: var(--meter-track);
61
+ /* Paints over the host's inset shadow, so it carries it too. */
62
+ box-shadow: var(--shadow-inset, none);
59
63
  }
60
64
 
61
65
  .meter::-webkit-meter-optimum-value {
@@ -35,24 +35,31 @@
35
35
  border: 0;
36
36
  border-radius: var(--bar-radius);
37
37
  background: var(--progress-track);
38
+ /* A rail, recessed with the fields when a theme sets --shadow-inset. */
39
+ box-shadow: var(--shadow-inset, none);
38
40
  }
39
41
 
42
+ /* The bar box paints over the host's inset shadow, so it carries it too. */
40
43
  .progress::-webkit-progress-bar {
41
44
  block-size: var(--bar-height);
42
45
  border-radius: var(--bar-radius);
43
46
  background: var(--progress-track);
47
+ box-shadow: var(--shadow-inset, none);
44
48
  }
45
49
 
50
+ /* The value is a solid fill: the theme finish is the layer over it. Two
51
+ layers of one shorthand, so --progress-value may stay a color or become a
52
+ gradient (only the last layer accepts a color). */
46
53
  .progress::-webkit-progress-value {
47
54
  block-size: var(--bar-height);
48
55
  border-radius: var(--bar-radius);
49
- background: var(--progress-value);
56
+ background: var(--finish, none), var(--progress-value);
50
57
  }
51
58
 
52
59
  .progress::-moz-progress-bar {
53
60
  block-size: var(--bar-height);
54
61
  border-radius: var(--bar-radius);
55
- background: var(--progress-value);
62
+ background: var(--finish, none), var(--progress-value);
56
63
  }
57
64
 
58
65
  /* Indeterminate progress */
@@ -28,11 +28,13 @@
28
28
  * --segmented-radius
29
29
  * --segmented-fg
30
30
  * --segmented-selected-bg
31
+ * --segmented-selected-fg
31
32
  * --segmented-selected-border (fallback-only: no edge by default; a theme sets
32
33
  * it once on its root, e.g. a flat theme whose selected pill has no shadow)
33
34
  *
34
35
  * Internal:
35
36
  * --segment-min-size
37
+ * --segment-focus
36
38
  */
37
39
  .segmented {
38
40
  --segmented-bg: var(--surface-subtle);
@@ -53,6 +55,8 @@
53
55
  border: var(--border-width) solid transparent;
54
56
  border-radius: var(--segmented-radius);
55
57
  background: var(--segmented-bg);
58
+ /* A rail, recessed with the fields when a theme sets --shadow-inset. */
59
+ box-shadow: var(--shadow-inset, none);
56
60
  font-size: var(--control-font-size);
57
61
  vertical-align: middle;
58
62
  }
@@ -153,33 +157,39 @@
153
157
  The selected pill is set apart by its fill, its shadow and the full --text
154
158
  ink against --text-muted; no edge by default. --segmented-selected-border
155
159
  is read, never declared here, so a theme (a flat one without --shadow) can
156
- restore the edge once on its root.
157
- Trap: the ring and --shadow share one box-shadow list, and `none` is not a
158
- list item. A theme that sets --shadow: none drops the whole declaration,
159
- ring included; flatten shadows with --shadow-color: transparent instead. */
160
+ restore the edge once on its root. The shadow is --shadow-control when a
161
+ theme sets it, the surface --shadow otherwise.
162
+ Trap: the ring and the shadow share one box-shadow list, and `none` is not
163
+ a list item. A theme that sets either shadow to none drops the whole
164
+ declaration, ring included; flatten with 0 0 #0000 or
165
+ --shadow-color: transparent instead. */
160
166
  .segment:is([aria-selected="true"], [aria-current="page"], [aria-current="true"]) {
167
+ --segment-focus: var(--segmented-selected-fg, var(--focus));
168
+
161
169
  background: var(--segmented-selected-bg);
162
- color: var(--text);
170
+ color: var(--segmented-selected-fg, var(--text));
163
171
  box-shadow:
164
172
  0 0 0 var(--border-width) var(--segmented-selected-border, transparent),
165
- var(--shadow);
173
+ var(--shadow-control, var(--shadow));
166
174
  }
167
175
 
168
176
  .segment:has(> input:checked) {
177
+ --segment-focus: var(--segmented-selected-fg, var(--focus));
178
+
169
179
  background: var(--segmented-selected-bg);
170
- color: var(--text);
180
+ color: var(--segmented-selected-fg, var(--text));
171
181
  box-shadow:
172
182
  0 0 0 var(--border-width) var(--segmented-selected-border, transparent),
173
- var(--shadow);
183
+ var(--shadow-control, var(--shadow));
174
184
  }
175
185
 
176
186
  .segment:focus-visible {
177
- outline: var(--focus-ring-width) solid var(--focus);
187
+ outline: var(--focus-ring-width) solid var(--segment-focus, var(--focus));
178
188
  outline-offset: calc(var(--focus-ring-width) * -1);
179
189
  }
180
190
 
181
191
  .segment:has(> input:focus-visible) {
182
- outline: var(--focus-ring-width) solid var(--focus);
192
+ outline: var(--focus-ring-width) solid var(--segment-focus, var(--focus));
183
193
  outline-offset: calc(var(--focus-ring-width) * -1);
184
194
  }
185
195
 
@@ -201,7 +211,7 @@
201
211
  is dropped here and the focus line takes the highlight's text color. */
202
212
  @media (forced-colors: active) {
203
213
  .segment:is([aria-selected="true"], [aria-current="page"], [aria-current="true"]) {
204
- --focus: HighlightText;
214
+ --segment-focus: HighlightText;
205
215
 
206
216
  forced-color-adjust: none;
207
217
  background: Highlight;
@@ -210,7 +220,7 @@
210
220
  }
211
221
 
212
222
  .segment:has(> input:checked) {
213
- --focus: HighlightText;
223
+ --segment-focus: HighlightText;
214
224
 
215
225
  forced-color-adjust: none;
216
226
  background: Highlight;
@@ -14,7 +14,8 @@
14
14
  *
15
15
  * Public hooks:
16
16
  * --table-min
17
- * --table-cell-pad
17
+ * --table-cell-pad (a single length: the edge columns compare it to the radius)
18
+ * --table-radius (on .table-wrap; the edge columns pad at least this much)
18
19
  *
19
20
  * Theme hooks (unset by default, read with a fallback, so a theme sets them
20
21
  * once on its root and third-party grid bridges can read the same choice):
@@ -34,8 +35,10 @@
34
35
  max-inline-size: 100%;
35
36
  min-inline-size: 0;
36
37
  overflow-x: auto;
38
+ --table-radius: var(--radius-lg);
39
+
37
40
  border: var(--border-width) solid var(--border);
38
- border-radius: var(--radius-lg);
41
+ border-radius: var(--table-radius);
39
42
  background: var(--surface-raised);
40
43
  }
41
44
 
@@ -64,6 +67,22 @@
64
67
  vertical-align: baseline;
65
68
  }
66
69
 
70
+ /* The edge columns clear the wrap's corner: with an inline padding under the
71
+ radius, the first letter of a header or caption sits inside the curve. The
72
+ whole column takes it so the body stays aligned with its header. A row under
73
+ a rowspan cell starts in the second column and takes it too. */
74
+ .table caption {
75
+ padding-inline: max(var(--table-cell-pad), var(--table-radius, 0px));
76
+ }
77
+
78
+ .table :is(th, td):first-child {
79
+ padding-inline-start: max(var(--table-cell-pad), var(--table-radius, 0px));
80
+ }
81
+
82
+ .table :is(th, td):last-child {
83
+ padding-inline-end: max(var(--table-cell-pad), var(--table-radius, 0px));
84
+ }
85
+
67
86
  .table th {
68
87
  color: var(--text-muted);
69
88
  font-weight: var(--font-weight-semibold);
@@ -10,7 +10,8 @@
10
10
  * Exception: --surface-opaque and --surface-solid-fg are public; a theme with
11
11
  * translucent surfaces overrides them with opaque values. --border-control is
12
12
  * public too: the resting edge of a neutral control, apart from structural
13
- * separators. --control-default-bg is the inherited resting field fill.
13
+ * separators. --control-default-bg and --control-default-border are the
14
+ * inherited resting field fill and edge.
14
15
  *
15
16
  * Internal:
16
17
  * --hgroup-gap
@@ -136,6 +137,12 @@
136
137
  /* Inherited resting field fill, shared with external control bridges.
137
138
  Component state rules still own readonly, disabled and invalid fills. */
138
139
  --control-default-bg: var(--surface);
140
+ /* Inherited resting field edge: the quiet --border, like a neutral outline
141
+ button. A known WCAG 1.4.11 trade-off: on a fill equal to the surface the
142
+ field reads by its label and place, not a 3:1 edge (actual-css contrast
143
+ warns). Increased contrast restores --border-control below; a product
144
+ that needs strong identification everywhere sets it on :root. */
145
+ --control-default-border: var(--border);
139
146
  }
140
147
 
141
148
  /* Custom properties accept unknown functions, so guard the pair to preserve
@@ -268,5 +275,8 @@
268
275
  --focus-ring-width: 3px;
269
276
  --text-muted: var(--text);
270
277
  --text-subtle: var(--text);
278
+ /* Fields are identified by a 3:1 edge again, quiet or borderless themes
279
+ included. */
280
+ --control-default-border: var(--border-control);
271
281
  }
272
282
  }
@@ -61,6 +61,17 @@
61
61
  --radius-full: 9999px;
62
62
  --shadow: 0 1px 3px rgb(0 0 0 / 0.05), 0 4px 12px rgb(0 0 0 / 0.04);
63
63
  --shadow-popout: 0 0.25rem 0.75rem rgb(0 0 0 / 0.15);
64
+ /* Control-scale relief, unset so the default theme stays flat: a theme sets
65
+ them on its root. --shadow-control lifts the part that moves on a rail
66
+ (selected segment, switch knob, range thumb), where --shadow's blur reads
67
+ as a smudge; --shadow-inset recesses fields and rails. Both enter shadow
68
+ lists, so a theme flattens them with 0 0 #0000, never none. */
69
+ --shadow-control: initial;
70
+ --shadow-inset: initial;
71
+ /* Finish, unset so the default theme stays matte: a background-image every
72
+ solid fill (button, checked choice and switch, progress value, solid
73
+ badge) layers over its color. Keep it a translucent neutral veil. */
74
+ --finish: initial;
64
75
 
65
76
  /* Motion — see reset.css for the prefers-reduced-motion hard reset.
66
77
  --duration scales component transitions (hover/focus); the dedicated
@@ -217,9 +228,12 @@
217
228
  when a tinted or translucent surface pulls the edge under 3:1. */
218
229
  --border-control-mix: 45%;
219
230
 
220
- /* Shared icon assets. Override these URLs when a strict CSP disallows data:. */
231
+ /* Shared icon assets. Override these URLs when a strict CSP disallows data:.
232
+ --icon-check is every checked state's mark (checkbox, choice card, chip,
233
+ menu, picker), drawn as a mask in the ink of its context: replace it to
234
+ restyle them all. Its 3-unit stroke draws 2px at 1em. */
221
235
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238a8594' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
222
- --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
236
+ --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
223
237
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3C/svg%3E");
224
238
  --icon-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
225
239
 
@@ -161,11 +161,12 @@
161
161
  border-radius: var(--radius-sm);
162
162
  }
163
163
 
164
- /* Check mark */
164
+ /* Check mark: --icon-check, as on .check. 80% of the indicator is 1em at the
165
+ default size, the checkbox's mark, and grows with a larger indicator. */
165
166
  .choice-card::after {
166
167
  background: var(--intent-fg, var(--state-selected-fg));
167
- -webkit-mask: var(--icon-check) center / 60% no-repeat;
168
- mask: var(--icon-check) center / 60% no-repeat;
168
+ -webkit-mask: var(--icon-check) center / 80% no-repeat;
169
+ mask: var(--icon-check) center / 80% no-repeat;
169
170
  z-index: 2;
170
171
  }
171
172
 
@@ -1,6 +1,8 @@
1
1
  /*
2
2
  * Checkbox and radio controls.
3
3
  *
4
+ * Docs: docs/pages/forms/overview.md
5
+ *
4
6
  * Native inputs keep their behavior while sharing custom geometry, checked,
5
7
  * focus, and disabled states across semantic forms and classed aliases. This
6
8
  * file also owns the .choice label layout (input + label text) so the whole
@@ -181,12 +183,15 @@
181
183
  transition: transform var(--duration);
182
184
  }
183
185
 
186
+ /* The check is --icon-check, the mark every checked state shares (cards,
187
+ chips, menus, the picker), at 1em: a 24-unit icon with a 3-unit stroke
188
+ draws 2px at 16px. Replace the token to restyle every check at once. */
184
189
  .check::before {
185
- inline-size: 0.58em;
186
- block-size: 0.34em;
187
- border-inline-start: 2px solid currentColor;
188
- border-block-end: 2px solid currentColor;
189
- transform: translateY(-0.06em) rotate(-45deg) scale(0);
190
+ inline-size: 1em;
191
+ block-size: 1em;
192
+ background: currentColor;
193
+ -webkit-mask: var(--icon-check) center / contain no-repeat;
194
+ mask: var(--icon-check) center / contain no-repeat;
190
195
  }
191
196
 
192
197
  .radio::before {
@@ -196,25 +201,26 @@
196
201
  background: currentColor;
197
202
  }
198
203
 
204
+ /* Checked is a solid fill, so it takes the theme finish like a solid button. */
199
205
  .check:is(:checked, :indeterminate),
200
206
  .radio:checked {
201
207
  --choice-border: var(--intent, var(--state-selected));
202
208
  --choice-bg: var(--intent, var(--state-selected));
203
209
  --choice-mark: var(--intent-fg, var(--state-selected-fg));
204
- }
205
210
 
206
- .check:checked::before {
207
- transform: translateY(-0.06em) rotate(-45deg) scale(1);
211
+ background-image: var(--finish, none);
208
212
  }
209
213
 
214
+ /* The dash stays drawn: the same layer without the mask, flattened to a bar
215
+ the check's stroke weight. */
210
216
  .check:indeterminate::before {
211
- border-inline-start: 0;
217
+ -webkit-mask: none;
218
+ mask: none;
212
219
  inline-size: 0.6em;
213
- block-size: 0;
214
- border-block-end: 2px solid currentColor;
215
- transform: scale(1);
220
+ block-size: 2px;
216
221
  }
217
222
 
223
+ .check:is(:checked, :indeterminate)::before,
218
224
  .radio:checked::before {
219
225
  transform: scale(1);
220
226
  }
@@ -241,7 +247,13 @@
241
247
  opacity: 1;
242
248
  }
243
249
 
244
- /* Forced colors intentionally stay under UA control: the visible check/dot
245
- carries state while native remapping preserves platform contrast and focus.
246
- If real HCM testing ever loses a mark, opt out on that pseudo only—never on
247
- the interactive input host. */
250
+ /* Forced colors stay under UA control on the input host, which keeps platform
251
+ contrast and focus. The marks are currentColor fills (the check a mask, the
252
+ dash and dot plain), which the system remaps to Canvas, erasing the state:
253
+ they opt out on the pseudo only, and inherit the host's forced ink. */
254
+ @media (forced-colors: active) {
255
+ .check::before,
256
+ .radio::before {
257
+ forced-color-adjust: none;
258
+ }
259
+ }
@@ -18,9 +18,12 @@
18
18
  * underline-style lower edge instead of a uniform border.
19
19
  *
20
20
  * --control-default-border is the inherited resting edge, the twin of
21
- * --control-default-bg: a theme sets both on its root, where --control-border
22
- * itself is owned by the state rules below. Paired with the lower-edge hook it
23
- * moves the 3:1 identification to the bottom alone (quiet sides, or none).
21
+ * --control-default-bg: theme.css sets both (the quiet --border, and
22
+ * --border-control under increased contrast), and a theme sets them on its
23
+ * root, where --control-border itself is owned by the state rules below.
24
+ * --border-control there is strong field identification; paired with the
25
+ * lower-edge hook it puts the 3:1 cue on the bottom alone. The fallback below
26
+ * is the strong edge, for a page that unsets the token.
24
27
  * readonly and disabled reset the lower edge, so an inherited accent or 3:1
25
28
  * underline never marks a field the user cannot edit.
26
29
  *
@@ -34,8 +37,8 @@
34
37
  * --control-shadow
35
38
  * --control-border-block-end-color
36
39
  * --control-border-block-end-width
37
- * --control-hover-border (input and textarea)
38
- * --control-hover-bg (select)
40
+ * --control-hover-border
41
+ * --control-hover-bg
39
42
  */
40
43
  .input,
41
44
  .textarea,
@@ -60,10 +63,11 @@
60
63
  background: var(--control-bg);
61
64
  color: var(--control-fg);
62
65
  /* why: an unset hook, so a theme can give every field a resting elevation
63
- that focus keeps (see the focus rule). The fallback is none, the same as
64
- the focus rule's: a transparent 0 0 shadow here made focus transition
65
- between two values and expose a phantom shadow mid-way. */
66
- box-shadow: var(--control-shadow, none);
66
+ that focus keeps (see the focus rule); --shadow-inset recesses fields and
67
+ rails alike. The fallback is none, the same as the focus rule's: a
68
+ transparent 0 0 shadow here made focus transition between two values and
69
+ expose a phantom shadow mid-way. */
70
+ box-shadow: var(--control-shadow, var(--shadow-inset, none));
67
71
  font-size: var(--control-font-size);
68
72
  cursor: var(--control-cursor);
69
73
  /* No outline: none here — the core :focus fallback must survive for browsers
@@ -83,13 +87,16 @@
83
87
  resize: vertical;
84
88
  }
85
89
 
86
- .input:hover:not(:disabled),
87
- .textarea:hover:not(:disabled) {
88
- --control-border: var(--control-hover-border, var(--text-subtle));
89
- }
90
-
90
+ /* One hover for every field, so a select never answers differently from the
91
+ input beside it: the edge darkens, and the fill changes once a theme sets
92
+ --control-hover-bg (a theme that clears the hover edge, such as an
93
+ underline or a borderless well, needs one). A readonly field is not
94
+ editable, so it keeps its rest state. */
95
+ .input:hover:not(:disabled, [readonly]),
96
+ .textarea:hover:not(:disabled, [readonly]),
91
97
  .select:hover:not(:disabled) {
92
- --control-bg: var(--control-hover-bg, var(--surface-subtle));
98
+ --control-border: var(--control-hover-border, var(--text-subtle));
99
+ --control-bg: var(--control-hover-bg, var(--control-default-bg, var(--surface)));
93
100
  }
94
101
 
95
102
  /* Field focus is an inset outline: offset = -width keeps every pixel inside
@@ -104,7 +111,7 @@
104
111
  .select:focus-visible:not(:disabled) {
105
112
  outline: var(--focus-ring-width) solid var(--form-invalid-border, var(--focus));
106
113
  outline-offset: calc(var(--focus-ring-width) * -1);
107
- box-shadow: var(--control-shadow, none);
114
+ box-shadow: var(--control-shadow, var(--shadow-inset, none));
108
115
  }
109
116
 
110
117
  .input[readonly],
@@ -1,6 +1,8 @@
1
1
  /*
2
2
  * Customizable select — appearance: base-select picker enhancement.
3
3
  *
4
+ * Docs: docs/pages/forms/overview.md
5
+ *
4
6
  * Progressive enhancement on top of the native .select baseline in select.css.
5
7
  * Wrapped in @supports and gated on fine pointer devices so it never blocks a
6
8
  * layout. Add .native to a specific select to opt out.
@@ -48,7 +50,7 @@
48
50
  --control-bg: var(--surface-raised);
49
51
  outline: var(--focus-ring-width) solid var(--form-invalid-border, var(--focus));
50
52
  outline-offset: calc(var(--focus-ring-width) * -1);
51
- box-shadow: var(--control-shadow, none);
53
+ box-shadow: var(--control-shadow, var(--shadow-inset, none));
52
54
  }
53
55
 
54
56
  &::picker-icon {
@@ -14,6 +14,7 @@
14
14
  * .field-group.flush, .required-mark.
15
15
  *
16
16
  * Public hooks:
17
+ * --field-label-scale
17
18
  * --fieldset-legend-padding-inline
18
19
  */
19
20
  .field {
@@ -41,12 +42,14 @@
41
42
  own size the hierarchy rested on weight alone, and a stack of medium
42
43
  labels read louder than the fields. Medium and the full ink keep it a
43
44
  clear read. A fraction of --control-font-size, not a fixed step, so it
44
- follows .sm/.lg on the .field whatever element holds the label. The legend
45
- titles a group, one level up, and is set small inside the frame, so it
46
- keeps the heavier weight. */
45
+ follows .sm/.lg on the .field whatever element holds the label.
46
+ --field-label-scale is the author hook for that fraction (1 sets labels at
47
+ the field text size); its fallback stays here, not on :root, so the hook
48
+ can be set on any container. The legend titles a group, one level up, and
49
+ is set small inside the frame, so it keeps the heavier weight. */
47
50
  .field-label {
48
51
  color: var(--text);
49
- font-size: calc(var(--control-font-size) * 0.875);
52
+ font-size: calc(var(--control-font-size) * var(--field-label-scale, 0.875));
50
53
  font-weight: var(--font-weight-medium);
51
54
  }
52
55
 
@@ -72,7 +75,7 @@
72
75
  .field-group.flush > legend {
73
76
  margin-block-end: var(--space-10);
74
77
  padding-inline: 0;
75
- font-size: calc(var(--control-font-size) * 0.875);
78
+ font-size: calc(var(--control-font-size) * var(--field-label-scale, 0.875));
76
79
  }
77
80
 
78
81
  .field-help {
@@ -21,7 +21,8 @@
21
21
  --otp-cell-size: var(--control-size);
22
22
  --otp-gap: var(--space-10);
23
23
  --otp-font-size: 1.5em;
24
- --otp-cell-border: var(--border-control);
24
+ /* A text field per cell: the same resting edge as .input. */
25
+ --otp-cell-border: var(--control-default-border, var(--border-control));
25
26
  --otp-cell-bg: var(--surface);
26
27
  --otp-caret-space: calc((var(--otp-cell-size) - 1ch) / 2 + var(--otp-gap) + 1px);
27
28