actual-css 0.20.1 → 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 (88) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +6 -6
  3. package/components.json +29 -7
  4. package/dist/actual.full.css +542 -135
  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/tooltip.d.ts +4 -0
  14. package/dist/types/validation.d.ts +6 -2
  15. package/docs/pages/components/app-navigation.md +67 -0
  16. package/docs/pages/components/button.md +3 -0
  17. package/docs/pages/components/dialog.md +3 -0
  18. package/docs/pages/components/list.md +13 -0
  19. package/docs/pages/components/meter.md +1 -0
  20. package/docs/pages/components/progress.md +1 -0
  21. package/docs/pages/components/segmented.md +7 -4
  22. package/docs/pages/components/table.md +4 -1
  23. package/docs/pages/components/timeline.md +32 -0
  24. package/docs/pages/enhancements/flyout.md +12 -3
  25. package/docs/pages/enhancements/tooltip.md +6 -1
  26. package/docs/pages/examples/overview.md +30 -1
  27. package/docs/pages/forms/combobox.md +14 -10
  28. package/docs/pages/forms/labels.md +7 -0
  29. package/docs/pages/forms/overview.md +13 -10
  30. package/docs/pages/forms/range.md +3 -1
  31. package/docs/pages/forms/validation.md +3 -3
  32. package/docs/pages/foundations/philosophy.md +26 -0
  33. package/docs/pages/foundations/theming.md +80 -7
  34. package/docs/pages/foundations/tokens.md +39 -2
  35. package/docs/pages/guides/coding-agents.md +11 -0
  36. package/docs/pages/guides/introduction.md +1 -1
  37. package/docs/pages/guides/progressive-enhancement.md +109 -19
  38. package/docs/pages/guides/tailwind.md +12 -6
  39. package/docs/pages/guides/upgrading.md +52 -0
  40. package/docs/pages/layout/app-layout.md +50 -1
  41. package/docs/pages/patterns/empty-state.md +48 -10
  42. package/forms.json +325 -0
  43. package/llms.txt +2 -1
  44. package/package.json +3 -1
  45. package/reserved-classes.json +2 -0
  46. package/skills/actual-css/SKILL.md +1 -1
  47. package/skills/actual-css/references/api-and-vocabulary.md +2 -1
  48. package/src/cli/actual-css.js +8 -2
  49. package/src/css/components/app-nav.css +75 -18
  50. package/src/css/components/avatar.css +1 -0
  51. package/src/css/components/badge.css +7 -1
  52. package/src/css/components/button.css +20 -3
  53. package/src/css/components/flyout.css +8 -2
  54. package/src/css/components/list.css +28 -13
  55. package/src/css/components/menu.css +18 -0
  56. package/src/css/components/meter.css +11 -6
  57. package/src/css/components/progress.css +14 -6
  58. package/src/css/components/rating.css +2 -0
  59. package/src/css/components/segmented.css +22 -12
  60. package/src/css/components/table.css +21 -2
  61. package/src/css/components/timeline.css +50 -1
  62. package/src/css/core/theme.css +11 -1
  63. package/src/css/core/tokens.css +20 -2
  64. package/src/css/forms/choice-card.css +6 -4
  65. package/src/css/forms/choice.css +28 -16
  66. package/src/css/forms/control.css +23 -16
  67. package/src/css/forms/custom-select.css +3 -1
  68. package/src/css/forms/form.css +8 -5
  69. package/src/css/forms/otp.css +7 -1
  70. package/src/css/forms/range.css +31 -11
  71. package/src/css/forms/select.css +13 -4
  72. package/src/css/forms/switch.css +11 -5
  73. package/src/css/layout/app-layout.css +104 -5
  74. package/src/js/data-flag.js +4 -0
  75. package/src/js/dialog.js +24 -8
  76. package/src/js/enhancement-loader-state.js +7 -0
  77. package/src/js/enhancement-loader.js +4 -21
  78. package/src/js/keys.js +5 -7
  79. package/src/js/parse-config.js +0 -2
  80. package/src/js/popover-transport.js +18 -0
  81. package/src/js/status.js +0 -2
  82. package/src/js/surface.js +35 -41
  83. package/src/js/tooltip.js +70 -36
  84. package/src/js/validation.js +24 -10
  85. package/src/tooling/css-bundle.js +5 -0
  86. package/src/tooling/design-tokens.js +9 -2
  87. package/src/tooling/theme-contrast.js +45 -17
  88. package/tokens.json +5 -0
@@ -35,13 +35,16 @@
35
35
  last row of a full-width sidebar nav list. Stretches both the
36
36
  positioning wrapper and its trigger control. Named for the effect
37
37
  (stretch to fill), not the display value, to avoid reading like a
38
- generic display-block utility. */
38
+ generic display-block utility. The trigger is matched by aria-controls,
39
+ the runtime's own wiring: aria-haspopup="menu" follows role="menu" only, so
40
+ a trigger for a panel holding a field (an account menu with a theme select)
41
+ carries none and stayed content-sized. */
39
42
  .flyout-trigger.stretch {
40
43
  display: block;
41
44
  inline-size: 100%;
42
45
  }
43
46
 
44
- .flyout-trigger.stretch > [aria-haspopup="menu"] {
47
+ .flyout-trigger.stretch > [aria-controls] {
45
48
  inline-size: 100%;
46
49
  }
47
50
 
@@ -97,6 +100,9 @@
97
100
  .flyout[popover] {
98
101
  position: fixed;
99
102
  inset: auto;
103
+ /* why: the UA's height: fit-content made Safari 18 size this grid to its
104
+ max-block-size and spread the spare room between menu rows. */
105
+ block-size: auto;
100
106
  }
101
107
 
102
108
  /* A presentation class may own its *visible* display type, but must not
@@ -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;
@@ -14,6 +14,7 @@
14
14
  * --meter-track
15
15
  * --meter-value
16
16
  * --bar-height
17
+ * --bar-radius
17
18
  */
18
19
 
19
20
  .meter {
@@ -26,8 +27,10 @@
26
27
  block-size: var(--bar-height);
27
28
  overflow: hidden;
28
29
  border: 0;
29
- border-radius: var(--radius-full);
30
+ border-radius: var(--bar-radius);
30
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);
31
34
  }
32
35
 
33
36
  /* A non-native meter is a weighted flex container. The element type keeps the
@@ -53,31 +56,33 @@
53
56
  -webkit-appearance: none;
54
57
  block-size: var(--bar-height);
55
58
  border: 0;
56
- border-radius: var(--radius-full);
59
+ border-radius: var(--bar-radius);
57
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);
58
63
  }
59
64
 
60
65
  .meter::-webkit-meter-optimum-value {
61
66
  block-size: var(--bar-height);
62
- border-radius: var(--radius-full);
67
+ border-radius: var(--bar-radius);
63
68
  background: var(--success);
64
69
  }
65
70
 
66
71
  .meter::-webkit-meter-suboptimum-value {
67
72
  block-size: var(--bar-height);
68
- border-radius: var(--radius-full);
73
+ border-radius: var(--bar-radius);
69
74
  background: var(--warning);
70
75
  }
71
76
 
72
77
  .meter::-webkit-meter-even-less-good-value {
73
78
  block-size: var(--bar-height);
74
- border-radius: var(--radius-full);
79
+ border-radius: var(--bar-radius);
75
80
  background: var(--danger);
76
81
  }
77
82
 
78
83
  .meter::-moz-meter-bar {
79
84
  block-size: var(--bar-height);
80
- border-radius: var(--radius-full);
85
+ border-radius: var(--bar-radius);
81
86
  }
82
87
 
83
88
  /* The background shorthand clears Gecko's native gradient. Keep state
@@ -14,6 +14,7 @@
14
14
  * --progress-track
15
15
  * --progress-value
16
16
  * --bar-height
17
+ * --bar-radius
17
18
  */
18
19
  /* Intent boundary — inherited intents do not tint this component.
19
20
  Local intent classes still win because :where() has zero specificity. */
@@ -32,26 +33,33 @@
32
33
  block-size: var(--bar-height);
33
34
  overflow: hidden;
34
35
  border: 0;
35
- border-radius: var(--radius-full);
36
+ border-radius: var(--bar-radius);
36
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);
37
40
  }
38
41
 
42
+ /* The bar box paints over the host's inset shadow, so it carries it too. */
39
43
  .progress::-webkit-progress-bar {
40
44
  block-size: var(--bar-height);
41
- border-radius: var(--radius-full);
45
+ border-radius: var(--bar-radius);
42
46
  background: var(--progress-track);
47
+ box-shadow: var(--shadow-inset, none);
43
48
  }
44
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). */
45
53
  .progress::-webkit-progress-value {
46
54
  block-size: var(--bar-height);
47
- border-radius: var(--radius-full);
48
- background: var(--progress-value);
55
+ border-radius: var(--bar-radius);
56
+ background: var(--finish, none), var(--progress-value);
49
57
  }
50
58
 
51
59
  .progress::-moz-progress-bar {
52
60
  block-size: var(--bar-height);
53
- border-radius: var(--radius-full);
54
- background: var(--progress-value);
61
+ border-radius: var(--bar-radius);
62
+ background: var(--finish, none), var(--progress-value);
55
63
  }
56
64
 
57
65
  /* Indeterminate progress */
@@ -67,6 +67,7 @@
67
67
 
68
68
  .rating > input[type="radio"] {
69
69
  appearance: none;
70
+ -webkit-appearance: none;
70
71
  flex: 0 0 auto;
71
72
  inline-size: calc(var(--rating-size) + var(--rating-gap));
72
73
  /* Taller than the star: the hit area grows, the drawing does not. */
@@ -212,6 +213,7 @@
212
213
  @media (forced-colors: active) {
213
214
  .rating > input[type="radio"] {
214
215
  appearance: auto;
216
+ -webkit-appearance: auto;
215
217
  inline-size: auto;
216
218
  block-size: auto;
217
219
  background: Canvas;
@@ -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);
@@ -17,7 +17,8 @@
17
17
  * block flow, so a sentence mixing text and links is never split into items.
18
18
  *
19
19
  * .timeline-dates-end moves every dateline to the inline end of the event's
20
- * first line, beside the title instead of above it.
20
+ * first line, beside the title instead of above it. .timeline-dates-start sets
21
+ * them in a shared column before the rail.
21
22
  *
22
23
  * Progress through a process is .steps, not a timeline.
23
24
  *
@@ -174,6 +175,54 @@
174
175
  font-size: calc(var(--timeline-line-box) / var(--line-height));
175
176
  }
176
177
 
178
+ /* Dates at the start: the datelines form a column before the rail, as in a
179
+ log. The list owns three tracks (dateline, rail, event) and every event
180
+ takes them as a subgrid, so the column is as wide as its longest dateline
181
+ and every rail lines up. The marker, the segment and a slot stay absolutely
182
+ positioned: placed in the rail track, that track becomes their containing
183
+ block, and the offsets above hold unchanged.
184
+
185
+ Contract: after the <time>, every piece of the event is an element. A
186
+ grid makes each run of bare text an item of its own, which could land in
187
+ the dateline track.
188
+
189
+ Guarded: without subgrid these rules would leave each event a lone grid
190
+ that scatters its children; the fallback is the default dateline above
191
+ the title. */
192
+ @supports (grid-template-columns: subgrid) {
193
+ .timeline-dates-start {
194
+ grid-template-columns: max-content var(--timeline-rail-size) minmax(0, 1fr);
195
+ column-gap: var(--timeline-inline-gap);
196
+ }
197
+
198
+ .timeline-dates-start > li {
199
+ display: grid;
200
+ grid-column: 1 / -1;
201
+ grid-template-columns: subgrid;
202
+ /* The smaller dateline shares the title's baseline on the first row. */
203
+ align-items: first baseline;
204
+ padding-inline-start: 0;
205
+ }
206
+
207
+ .timeline-dates-start > li > * {
208
+ grid-column: 3;
209
+ }
210
+
211
+ /* Row 1, so the dateline sits beside the title rather than above it, and
212
+ end-aligned, so ragged datelines hug the rail. */
213
+ .timeline-dates-start > li > time {
214
+ grid-row: 1;
215
+ grid-column: 1;
216
+ text-align: end;
217
+ }
218
+
219
+ .timeline-dates-start > li::before,
220
+ .timeline-dates-start > li::after,
221
+ .timeline-dates-start > li > :is(.avatar, [aria-hidden="true"]):first-child {
222
+ grid-column: 2;
223
+ }
224
+ }
225
+
177
226
  .timeline > li::before {
178
227
  content: "";
179
228
  position: absolute;
@@ -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
@@ -106,6 +117,10 @@
106
117
  the same geometry. Public: set it on the element or on an application
107
118
  class rather than reaching for a size variant. */
108
119
  --bar-height: 0.65rem;
120
+ /* Their corner, track and value alike. The value is drawn on vendor
121
+ pseudo-elements a theme cannot reach in one rule, so this is the way to
122
+ square a bar. */
123
+ --bar-radius: var(--radius-full);
109
124
 
110
125
  /* Controls — inputs and buttons share --control-size so heights always match.
111
126
  .compact/.spacious (variants.css) switch geometry (--control-size,
@@ -213,9 +228,12 @@
213
228
  when a tinted or translucent surface pulls the edge under 3:1. */
214
229
  --border-control-mix: 45%;
215
230
 
216
- /* 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. */
217
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");
218
- --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");
219
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");
220
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");
221
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
 
@@ -218,7 +219,8 @@
218
219
  border: 0;
219
220
  border-radius: inherit;
220
221
  background: var(--text-subtle);
221
- transform: none;
222
+ /* No transform here: the card's scale(0) keeps the dot hidden beside a
223
+ visible native input until the :has() block above reveals it. */
222
224
  clip-path: circle(0.1875em at var(--choice-chip-dot));
223
225
  z-index: -1;
224
226
  transition: clip-path var(--duration);
@@ -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
+ }