luxen-ui 0.19.0 → 0.20.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 (103) hide show
  1. package/README.md +1 -0
  2. package/cdn/custom-elements.json +99 -5
  3. package/cdn/elements/button-group/button-group.d.ts +12 -7
  4. package/cdn/elements/button-group/button-group.d.ts.map +1 -1
  5. package/cdn/elements/button-group/button-group.js.map +1 -1
  6. package/cdn/elements/input-stepper/input-stepper.d.ts +1 -1
  7. package/cdn/elements/input-stepper/input-stepper.js.map +1 -1
  8. package/cdn/elements/popover/popover.d.ts +15 -0
  9. package/cdn/elements/popover/popover.d.ts.map +1 -1
  10. package/cdn/elements/popover/popover.js +1 -1
  11. package/cdn/elements/popover/popover.js.map +1 -1
  12. package/cdn/elements/radio-group/radio-group.meta.d.ts +41 -0
  13. package/cdn/elements/radio-group/radio-group.meta.d.ts.map +1 -0
  14. package/cdn/elements/radio-group/radio-group.meta.js +0 -0
  15. package/cdn/elements/segmented-control/segmented-control.d.ts +8 -4
  16. package/cdn/elements/segmented-control/segmented-control.d.ts.map +1 -1
  17. package/cdn/elements/segmented-control/segmented-control.js.map +1 -1
  18. package/cdn/elements/select/select.js +1 -1
  19. package/cdn/elements/select/select.js.map +1 -1
  20. package/cdn/elements/tag/tag.d.ts +3 -1
  21. package/cdn/elements/tag/tag.d.ts.map +1 -1
  22. package/cdn/elements/tag/tag.js +1 -1
  23. package/cdn/elements/tag/tag.js.map +1 -1
  24. package/cdn/elements/tooltip/tooltip.d.ts +15 -0
  25. package/cdn/elements/tooltip/tooltip.d.ts.map +1 -1
  26. package/cdn/elements/tooltip/tooltip.js +1 -1
  27. package/cdn/elements/tooltip/tooltip.js.map +1 -1
  28. package/cdn/shared/controllers/popover.d.ts +40 -0
  29. package/cdn/shared/controllers/popover.d.ts.map +1 -1
  30. package/cdn/shared/controllers/popover.js +1 -1
  31. package/cdn/shared/controllers/popover.js.map +1 -1
  32. package/cdn/shared/styles/button-core.styles.js +1 -1
  33. package/cdn/shared/styles/button-core.styles.js.map +1 -1
  34. package/cdn/standalone.css +774 -28
  35. package/cdn/styles/elements/button-group.css +4 -3
  36. package/cdn/styles/elements/button.css +28 -1
  37. package/cdn/styles/elements/disclosure.css +3 -3
  38. package/cdn/styles/elements/input-stepper/default.css +29 -2
  39. package/cdn/styles/elements/input-stepper/pill.css +420 -0
  40. package/cdn/styles/elements/input-stepper/rounded.css +69 -8
  41. package/cdn/styles/elements/kbd.css +2 -2
  42. package/cdn/styles/elements/radio-group.css +206 -0
  43. package/cdn/styles/elements/segmented-control.css +3 -3
  44. package/cdn/styles/elements/tabs/enclosed.css +4 -4
  45. package/cdn/styles/elements/tabs/line.css +2 -2
  46. package/dist/css/elements/button-group.css +4 -3
  47. package/dist/css/elements/button.css +28 -1
  48. package/dist/css/elements/disclosure.css +3 -3
  49. package/dist/css/elements/input-stepper/default.css +29 -2
  50. package/dist/css/elements/input-stepper/pill.css +420 -0
  51. package/dist/css/elements/input-stepper/rounded.css +69 -8
  52. package/dist/css/elements/kbd.css +2 -2
  53. package/dist/css/elements/radio-group.css +206 -0
  54. package/dist/css/elements/segmented-control.css +3 -3
  55. package/dist/css/elements/tabs/enclosed.css +4 -4
  56. package/dist/css/elements/tabs/line.css +2 -2
  57. package/dist/custom-elements.json +99 -5
  58. package/dist/elements/button-group/button-group.d.ts +12 -7
  59. package/dist/elements/button-group/button-group.d.ts.map +1 -1
  60. package/dist/elements/button-group/button-group.js +12 -7
  61. package/dist/elements/input-stepper/input-stepper.d.ts +1 -1
  62. package/dist/elements/input-stepper/input-stepper.js +1 -1
  63. package/dist/elements/popover/popover.d.ts +15 -0
  64. package/dist/elements/popover/popover.d.ts.map +1 -1
  65. package/dist/elements/popover/popover.js +61 -14
  66. package/dist/elements/radio-group/radio-group.meta.d.ts +41 -0
  67. package/dist/elements/radio-group/radio-group.meta.d.ts.map +1 -0
  68. package/dist/elements/radio-group/radio-group.meta.js +51 -0
  69. package/dist/elements/segmented-control/segmented-control.d.ts +8 -4
  70. package/dist/elements/segmented-control/segmented-control.d.ts.map +1 -1
  71. package/dist/elements/segmented-control/segmented-control.js +8 -4
  72. package/dist/elements/select/select.css +14 -0
  73. package/dist/elements/tag/tag.css +128 -49
  74. package/dist/elements/tag/tag.d.ts +3 -1
  75. package/dist/elements/tag/tag.d.ts.map +1 -1
  76. package/dist/elements/tag/tag.js +3 -1
  77. package/dist/elements/tooltip/tooltip.d.ts +15 -0
  78. package/dist/elements/tooltip/tooltip.d.ts.map +1 -1
  79. package/dist/elements/tooltip/tooltip.js +61 -14
  80. package/dist/metadata/button-group.json +2 -2
  81. package/dist/metadata/index.json +95 -7
  82. package/dist/metadata/input-stepper.json +3 -2
  83. package/dist/metadata/popover.json +6 -0
  84. package/dist/metadata/radio-group.json +65 -0
  85. package/dist/metadata/segmented-control.json +1 -1
  86. package/dist/metadata/tag.json +11 -1
  87. package/dist/metadata/tooltip.json +6 -0
  88. package/dist/shared/controllers/popover.d.ts +40 -0
  89. package/dist/shared/controllers/popover.d.ts.map +1 -1
  90. package/dist/shared/controllers/popover.js +69 -0
  91. package/dist/shared/styles/button-core.css +28 -1
  92. package/dist/templates/elements/button-group.md +159 -41
  93. package/dist/templates/elements/button.md +1 -1
  94. package/dist/templates/elements/input-stepper.md +220 -58
  95. package/dist/templates/elements/popover.md +3 -0
  96. package/dist/templates/elements/radio-group.md +351 -0
  97. package/dist/templates/elements/radio.md +34 -30
  98. package/dist/templates/elements/segmented-control.md +5 -63
  99. package/dist/templates/elements/tag.md +72 -3
  100. package/dist/templates/elements/tooltip.md +3 -0
  101. package/elements.json +10 -1
  102. package/package.json +1 -1
  103. package/vite-plugin.ts +44 -14
@@ -85,6 +85,18 @@
85
85
  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
86
86
  */
87
87
 
88
+ /*
89
+ Appearance files re-style these internals, and each of them `@import`s this file,
90
+ so a page loading two appearances ends up with two copies of the block below —
91
+ the second one sitting *after* the first appearance's own rules. Element selectors
92
+ like `button` carry no extra specificity from the `@scope` prelude, so that later
93
+ copy would win on source order and strip the first appearance's skin.
94
+
95
+ Contract: an appearance file qualifies every rule that targets a shared internal
96
+ with `:scope ` (`:scope button`, not `button`). That single pseudo-class puts it
97
+ permanently above this block, whatever order the imports land in.
98
+ */
99
+
88
100
  button {
89
101
  padding: 0;
90
102
  appearance: none;
@@ -168,6 +180,12 @@
168
180
  min-width: 0;
169
181
  }
170
182
 
183
+ /* No background: the overlay REPLACES the input's digits (see the opacity rule
184
+ below) instead of masking them behind an opaque fill, so whatever the host
185
+ paints — the form-control fill in `default`, nothing at all in `rounded` —
186
+ shows through untouched. A fill here would composite a second time over the
187
+ host's own and read as a tinted rectangle over the value area wherever either
188
+ one is translucent, e.g. --l-form-control-disabled-background. */
171
189
  .l-input-stepper-track-display {
172
190
  position: absolute;
173
191
  inset: 0;
@@ -175,7 +193,6 @@
175
193
  overflow: hidden;
176
194
  pointer-events: none;
177
195
  font-variant-numeric: tabular-nums;
178
- background: var(--_track-bg, var(--l-color-surface));
179
196
  }
180
197
 
181
198
  .l-input-stepper-track {
@@ -189,6 +206,17 @@
189
206
  height: var(--_button-size);
190
207
  }
191
208
 
209
+ /* Hide the real digits while the roller is the thing on screen. `opacity`, NOT
210
+ `visibility`/`display` — those drop the input out of the tab order, so the
211
+ :focus-within rule below could never fire to swap the two back. Gated on both
212
+ the attribute and the overlay's presence because the overlay is built once at
213
+ setup: toggling `with-roller` afterwards must not blank the value. */
214
+ :scope[with-roller]
215
+ .l-input-stepper-value:has(.l-input-stepper-track-display):not(:focus-within)
216
+ input {
217
+ opacity: 0;
218
+ }
219
+
192
220
  .l-input-stepper-value:focus-within .l-input-stepper-track-display {
193
221
  visibility: hidden;
194
222
  }
@@ -227,28 +255,61 @@
227
255
  @layer components {
228
256
  @scope (l-input-stepper[appearance='rounded']) {
229
257
  :scope {
230
- gap: 0.25rem;
258
+ --_gap: 0.25rem;
259
+
260
+ gap: var(--_gap);
231
261
  }
232
262
 
233
- button {
263
+ /* FOUCE: the base reserves two bare button widths, which is right for an
264
+ appearance whose buttons sit flush against the value. These do not — each
265
+ carries a 1px border and a gap — so the reserved box has to grow by both
266
+ or the stepper jumps 12px wider and 12px taller the moment it hydrates.
267
+ Qualified with the attribute so it outranks the base rule (equal
268
+ specificity otherwise) whichever order the appearance sheets load in. */
269
+ :scope:not(:defined)[appearance='rounded'] {
270
+ padding-inline: calc(var(--_button-size) + 2px + var(--_gap));
271
+ min-height: calc(var(--_button-size) + 2px);
272
+ }
273
+
274
+ /* Every rule that re-styles a shared internal is qualified with `:scope ` — see
275
+ the note above the button block in `_base.css`. Without it, the base copy
276
+ inlined by a *later*-imported appearance would win on source order. */
277
+ :scope button {
234
278
  border: 1px solid var(--border-color);
235
279
  border-radius: var(--l-radius-full);
236
280
  background-color: var(--l-form-control-background-color);
237
281
  }
238
282
 
239
283
  @media (hover: hover) {
240
- button:hover:not(:disabled) {
241
- border-color: var(--l-color-text-primary);
284
+ :scope button:hover:not(:disabled) {
285
+ border-color: var(--l-form-control-border-color-hover);
242
286
  background-color: transparent;
243
287
  }
244
288
  }
245
289
 
246
- button:active:not(:disabled) {
247
- border-color: var(--l-color-text-primary);
290
+ /* Hover and press share one border token, the system's own for a hovered
291
+ form control. It reads at gray-500 in both modes; --l-color-text-primary,
292
+ which these two states used to reach for, lands near-black on a white page
293
+ and near-white on a dark one — too hard an edge for a hairline circle. The
294
+ press is told apart by its fill and by the same shrink `pill` uses: both
295
+ appearances hang their buttons as free-standing discs, so both can afford
296
+ to press one into the surface. `default` cannot — its buttons sit flush
297
+ inside the container's border, and shrinking one opens a gap in the corner
298
+ of the box — which is why the shrink lives in these two files and not in
299
+ `_base.css`. */
300
+ :scope button:active:not(:disabled) {
301
+ border-color: var(--l-form-control-border-color-hover);
248
302
  background-color: var(--_button-bg-active);
303
+ scale: 0.94;
249
304
  }
250
305
 
251
- button:disabled {
306
+ @media (prefers-reduced-motion: reduce) {
307
+ :scope button:active:not(:disabled) {
308
+ scale: none;
309
+ }
310
+ }
311
+
312
+ :scope button:disabled {
252
313
  border-color: var(--l-form-control-disabled-border);
253
314
  }
254
315
  }
@@ -5,8 +5,8 @@
5
5
 
6
6
  .l-kbd {
7
7
  display: inline-block;
8
- padding-block: calc(var(--spacing) * 1);
9
- padding-inline: calc(var(--spacing) * 2);
8
+ padding-block: var(--l-spacing-1);
9
+ padding-inline: var(--l-spacing-2);
10
10
  font-family: var(--l-font-mono);
11
11
  font-size: var(--l-text-xs);
12
12
  font-weight: 600;
@@ -0,0 +1,206 @@
1
+ @layer components {
2
+ /**
3
+ * Radio group — a set of native `<input type="radio">` controls, each wrapped
4
+ * in the `<label>` that names it, in one of two appearances:
5
+ *
6
+ * default the radio primitive (`.l-radio` on the input): a dot in a
7
+ * circle, with its label beside it.
8
+ * button the segments wear the `.l-button` look and are joined into a
9
+ * single unit, like `l-button-group`.
10
+ *
11
+ * There is no JavaScript because there is nothing to implement. Radios
12
+ * sharing a `name` already give single selection, arrow-key navigation, a
13
+ * single tab stop, form submission, reset and validation. This file only
14
+ * decides what the group looks like.
15
+ *
16
+ * The host is the `<fieldset>` itself, captioned by its `<legend>`: that is
17
+ * the platform's own way to group and name a set of radios, so no ARIA is
18
+ * needed. A rendered legend is taken out of flow, so it sits above the group
19
+ * and never becomes a flex item — verified in Chrome 148, and what the HTML
20
+ * rendering spec requires. (Making the fieldset a flex container used to be
21
+ * ignored by Chrome and Safari; that was fixed years ago.)
22
+ *
23
+ * Kept as one flat file rather than an appearance directory: the default
24
+ * appearance adds layout and nothing else — the dot itself lives in
25
+ * radio.css — so there is no second visual treatment to isolate, and a
26
+ * consumer wanting both appearances on one page keeps a single import.
27
+ *
28
+ * - https://www.w3.org/WAI/ARIA/apg/patterns/radio/
29
+ */
30
+
31
+ .l-radio-group {
32
+ display: inline-flex;
33
+ align-items: stretch;
34
+
35
+ /* Fieldset defaults, cleared so the group is the only visible chrome.
36
+ `min-inline-size: 0` overrides the UA's `min-content`, which would
37
+ otherwise stop the group from ever shrinking. */
38
+ margin: 0;
39
+ border: 0;
40
+ padding: 0;
41
+ min-inline-size: 0;
42
+ }
43
+
44
+ /* The group's caption. Out of flow, so it needs no flex handling — only the
45
+ gap below it. Typography matches an `l-form-field` label, so a radio group
46
+ and a labelled field read as the same thing in a form. */
47
+ .l-radio-group > legend {
48
+ margin-block-end: var(--l-spacing-2);
49
+ padding: 0;
50
+ color: var(--l-form-control-label-color);
51
+ font-size: var(--l-text-sm);
52
+ font-weight: var(--l-font-weight-medium);
53
+ }
54
+
55
+ .l-radio-group[data-orientation='vertical'] {
56
+ flex-direction: column;
57
+ align-items: start;
58
+ }
59
+
60
+ /*
61
+ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
62
+ Default appearance — the radio primitive. Layout only: put `.l-radio` on each
63
+ input and radio.css draws the dot.
64
+ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
65
+ */
66
+
67
+ .l-radio-group:not([data-appearance='button']) {
68
+ gap: var(--l-spacing-4);
69
+
70
+ /* Luxen tokens, never `var(--spacing)`: that one belongs to Tailwind's base
71
+ layer, so outside a Tailwind project the calc() is invalid and the gap
72
+ collapses to zero. That is not cosmetic — a zero gap puts two stacked
73
+ radio boxes close enough to fail the WCAG 2.5.8 target-size spacing
74
+ exception (the boxes are under the 24px minimum on their own). There is
75
+ an axe fixture on the stacked group. */
76
+ &[data-orientation='vertical'] {
77
+ gap: var(--l-spacing-3);
78
+ }
79
+
80
+ & > label {
81
+ display: inline-flex;
82
+ gap: var(--l-spacing-2);
83
+ align-items: center;
84
+ cursor: pointer;
85
+ }
86
+
87
+ & > label:has(:disabled) {
88
+ cursor: not-allowed;
89
+ opacity: 0.4;
90
+ }
91
+ }
92
+
93
+ /*
94
+ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
95
+ Button appearance — `.l-button` on each label, segments joined.
96
+ The checked fill is NOT defined here: `.l-button:has(input:checked)` in
97
+ button-core.css already gives it the same look as a pressed toggle button.
98
+ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
99
+ */
100
+
101
+ .l-radio-group[data-appearance='button'] {
102
+ /* Segments overlap their neighbour's border, so the interacted one has to
103
+ be raised or its border and focus ring get clipped. */
104
+ & > .l-button {
105
+ position: relative;
106
+ }
107
+
108
+ & > .l-button:hover,
109
+ & > .l-button:has(:checked) {
110
+ z-index: 1;
111
+ }
112
+
113
+ /*
114
+ * The input covers its label and is transparent, rather than being sized to
115
+ * zero: a zero-size focusable control is occasionally skipped by assistive
116
+ * tech. It must never be `display: none` or `visibility: hidden` either —
117
+ * both drop it from the accessibility tree AND the tab order, which would
118
+ * take the group's whole keyboard model with them.
119
+ */
120
+ & > .l-button > input[type='radio'] {
121
+ position: absolute;
122
+ inset: 0;
123
+ margin: 0;
124
+ padding: 0;
125
+ appearance: none;
126
+ border: 0;
127
+ background: none;
128
+ opacity: 0;
129
+ cursor: inherit;
130
+ }
131
+
132
+ /* A `<label>` is never focused itself — the ring has to be mirrored from
133
+ the input inside it. */
134
+ & > .l-button:has(:focus-visible) {
135
+ z-index: 2;
136
+ outline: 2px solid var(--l-focus-ring);
137
+ outline-offset: 2px;
138
+ }
139
+
140
+ /* A `<label>` is never `:disabled` either, so the button's own
141
+ `:not(:disabled)` guards all pass and a disabled segment would still
142
+ react to the pointer. Rebinding the hover knobs (rather than overriding
143
+ `background-color`) keeps it inert on hover in every variant, and
144
+ resolves to the checked fill when it is the selected one. */
145
+ & > .l-button:has(:disabled) {
146
+ --background-color-hover: var(--background-color);
147
+ --border-color-hover: var(--border-color);
148
+ --text-color-hover: var(--text-color);
149
+
150
+ cursor: not-allowed;
151
+ opacity: 0.4;
152
+ }
153
+
154
+ /* `:active` needs its own rule: button-core sets `background-color`
155
+ directly there, so rebinding the knobs above does not reach it and the
156
+ segment flashed the pressed fill on mousedown. `data-press-effect` is
157
+ opt-in per button but would move it for the same reason. There is a
158
+ browser test on this, with an enabled segment as its control. */
159
+ & > .l-button:has(:disabled):active {
160
+ background-color: var(--background-color);
161
+ scale: none;
162
+ translate: none;
163
+ }
164
+
165
+ &[data-orientation='vertical'] {
166
+ align-items: stretch;
167
+ }
168
+ }
169
+
170
+ /*
171
+ Seam collapsing. Deliberately duplicated from button-group.css: sharing it
172
+ would need one selector list covering both hosts, so importing
173
+ `luxen-ui/css/button-group` alone would ship the radio-group selectors too.
174
+ Per-element files stay self-contained; keep the two in sync by hand.
175
+ */
176
+
177
+ .l-radio-group[data-appearance='button']:not([data-orientation='vertical']) {
178
+ /* Overlap the shared 1px border. Sibling selectors rather than
179
+ `:not(:first-child)` / `:not(:last-child)`: the group's first child is
180
+ the `<legend>`, so the positional pseudo-classes would be off by one and
181
+ square the first segment's leading corners. */
182
+ & > .l-button + .l-button {
183
+ margin-inline-start: -1px;
184
+ border-start-start-radius: 0;
185
+ border-end-start-radius: 0;
186
+ }
187
+
188
+ & > .l-button:has(+ .l-button) {
189
+ border-start-end-radius: 0;
190
+ border-end-end-radius: 0;
191
+ }
192
+ }
193
+
194
+ .l-radio-group[data-appearance='button'][data-orientation='vertical'] {
195
+ & > .l-button + .l-button {
196
+ margin-block-start: -1px;
197
+ border-start-start-radius: 0;
198
+ border-start-end-radius: 0;
199
+ }
200
+
201
+ & > .l-button:has(+ .l-button) {
202
+ border-end-start-radius: 0;
203
+ border-end-end-radius: 0;
204
+ }
205
+ }
206
+ }
@@ -25,7 +25,7 @@
25
25
  align-items: stretch;
26
26
  height: var(--_height);
27
27
  padding: var(--_pad);
28
- gap: calc(var(--spacing) * 0.5);
28
+ gap: var(--l-spacing-0_5);
29
29
  background: var(--l-color-bg-fill-neutral-subtle);
30
30
  border-radius: var(--border-radius, var(--l-radius-lg));
31
31
  /* Match the form-control border (--l-color-border, as used by .l-button,
@@ -87,8 +87,8 @@
87
87
  display: inline-flex;
88
88
  align-items: center;
89
89
  justify-content: center;
90
- gap: calc(var(--spacing) * 1.5);
91
- padding-inline: calc(var(--spacing) * 3);
90
+ gap: var(--l-spacing-1_5);
91
+ padding-inline: var(--l-spacing-3);
92
92
  margin: 0;
93
93
  appearance: none;
94
94
  border: none;
@@ -136,8 +136,8 @@
136
136
  & > :first-child {
137
137
  background: var(--l-color-bg-fill-neutral-subtle);
138
138
  border-radius: var(--l-radius-lg);
139
- padding: calc(var(--spacing) * 1);
140
- gap: calc(var(--spacing) * 1);
139
+ padding: var(--l-spacing-1);
140
+ gap: var(--l-spacing-1);
141
141
  box-shadow: inset 0 0 0 1px var(--l-color-divider);
142
142
 
143
143
  &::before {
@@ -146,7 +146,7 @@
146
146
  box-shadow:
147
147
  0 1px 3px 0 rgb(0 0 0 / 0.08),
148
148
  0 1px 2px -1px rgb(0 0 0 / 0.08);
149
- inset-block: calc(var(--spacing) * 1);
149
+ inset-block: var(--l-spacing-1);
150
150
  z-index: 0;
151
151
  }
152
152
  }
@@ -154,7 +154,7 @@
154
154
  & > :first-child button {
155
155
  position: relative;
156
156
  z-index: 1;
157
- padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3);
157
+ padding: var(--l-spacing-1_5) var(--l-spacing-3);
158
158
  border-radius: var(--l-radius-md);
159
159
  }
160
160
  }
@@ -145,7 +145,7 @@
145
145
  }
146
146
 
147
147
  & > :first-child button {
148
- padding: calc(var(--spacing) * 2) calc(var(--spacing) * 3);
148
+ padding: var(--l-spacing-2) var(--l-spacing-3);
149
149
 
150
150
  /* `isolation` keeps the pill's negative z-index inside the button: it
151
151
  paints above the button background but under the label, and can never
@@ -160,7 +160,7 @@
160
160
  content: '';
161
161
  position: absolute;
162
162
  z-index: -1;
163
- inset-block: var(--hover-inset, calc(var(--spacing) * 1));
163
+ inset-block: var(--hover-inset, var(--l-spacing-1));
164
164
  inset-inline: 0;
165
165
  border-radius: var(--l-radius-md);
166
166
  background: transparent;
@@ -1,7 +1,7 @@
1
1
  @layer components {
2
2
  /**
3
- * Visually joins a set of `.l-button` elements into a single segmented
4
- * control. Pure CSS: it targets direct `.l-button` children and buttons
3
+ * Visually joins a set of `.l-button` elements into a single unit.
4
+ * Pure CSS: it targets direct `.l-button` children and buttons
5
5
  * nested one level inside a wrapper (e.g. an `l-dropdown` trigger, for split
6
6
  * buttons), so it works without JavaScript. `<l-button-group>` only adds the
7
7
  * `role="group"` / `aria-orientation` semantics on top.
@@ -26,7 +26,8 @@
26
26
  }
27
27
 
28
28
  l-button-group .l-button:hover,
29
- l-button-group .l-button:active {
29
+ l-button-group .l-button:active,
30
+ l-button-group .l-button[aria-pressed='true'] {
30
31
  z-index: 1;
31
32
  }
32
33
 
@@ -57,7 +57,7 @@
57
57
  display: inline-flex;
58
58
  place-items: center;
59
59
  justify-content: center;
60
- gap: calc(var(--spacing) * 2);
60
+ gap: var(--l-spacing-2);
61
61
  height: var(--height);
62
62
  padding-inline: var(--padding-inline);
63
63
  border: 1px solid var(--border-color);
@@ -137,6 +137,33 @@
137
137
  --border-color: transparent;
138
138
  --border-color-hover: transparent;
139
139
  }
140
+
141
+ /* Toggle button in the pressed state (APG toggle pattern): the button keeps its
142
+ `:active` fill for as long as it is on. Rebinding the knobs rather than
143
+ setting `background-color` is what makes this variant-agnostic — every
144
+ variant inherits the pressed look from the active/hover colors it already
145
+ defines. Hover mixes that fill toward the variant's own text color so a
146
+ pressed button still answers the pointer: darker for the secondary button,
147
+ lighter for `primary`, a deeper red for `destructive`.
148
+
149
+ `:has(input:checked)` gives the same look to a `.l-button` wrapping a checked
150
+ radio or checkbox — the shape `.l-radio-group` uses, where the visible segment
151
+ is a `<label class="l-button">`. Same state, same look, defined once.
152
+
153
+ MUST stay after the variant rules: `.l-button[aria-pressed='true']` and
154
+ `.l-button[data-variant='…']` have the same specificity, so source order is
155
+ what lets the pressed state win over a variant's base fill. (The `:has()`
156
+ selector scores one higher and would win either way.) */
157
+ .l-button[aria-pressed='true'],
158
+ .l-button:has(input:checked) {
159
+ --background-color: var(--background-color-active);
160
+ --background-color-hover: color-mix(
161
+ in oklab,
162
+ var(--background-color-active) 88%,
163
+ var(--text-color)
164
+ );
165
+ --border-color: var(--border-color-hover);
166
+ }
140
167
  }
141
168
  @layer components {
142
169
  .l-button[data-press-effect]:active {
@@ -23,7 +23,7 @@
23
23
  display: flex;
24
24
  align-items: center;
25
25
  justify-content: space-between;
26
- padding: calc(var(--spacing) * 3) calc(var(--spacing) * 4);
26
+ padding: var(--l-spacing-3) var(--l-spacing-4);
27
27
  font-weight: 600;
28
28
  font-size: var(--l-text-base);
29
29
  line-height: 1;
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  & > :last-child:not(summary) {
49
- padding: calc(var(--spacing) * 4);
49
+ padding: var(--l-spacing-4);
50
50
  color: var(--l-color-text-secondary);
51
51
  }
52
52
 
@@ -144,7 +144,7 @@
144
144
  .l-disclosure[data-marker-placement='start'] summary {
145
145
  justify-content: flex-start;
146
146
  /* Match the summary's inline padding so the space around the marker is symmetric */
147
- gap: calc(var(--spacing) * 4);
147
+ gap: var(--l-spacing-4);
148
148
  }
149
149
 
150
150
  .l-disclosure[data-marker-placement='start'] summary::after {
@@ -85,6 +85,18 @@
85
85
  ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
86
86
  */
87
87
 
88
+ /*
89
+ Appearance files re-style these internals, and each of them `@import`s this file,
90
+ so a page loading two appearances ends up with two copies of the block below —
91
+ the second one sitting *after* the first appearance's own rules. Element selectors
92
+ like `button` carry no extra specificity from the `@scope` prelude, so that later
93
+ copy would win on source order and strip the first appearance's skin.
94
+
95
+ Contract: an appearance file qualifies every rule that targets a shared internal
96
+ with `:scope ` (`:scope button`, not `button`). That single pseudo-class puts it
97
+ permanently above this block, whatever order the imports land in.
98
+ */
99
+
88
100
  button {
89
101
  padding: 0;
90
102
  appearance: none;
@@ -168,6 +180,12 @@
168
180
  min-width: 0;
169
181
  }
170
182
 
183
+ /* No background: the overlay REPLACES the input's digits (see the opacity rule
184
+ below) instead of masking them behind an opaque fill, so whatever the host
185
+ paints — the form-control fill in `default`, nothing at all in `rounded` —
186
+ shows through untouched. A fill here would composite a second time over the
187
+ host's own and read as a tinted rectangle over the value area wherever either
188
+ one is translucent, e.g. --l-form-control-disabled-background. */
171
189
  .l-input-stepper-track-display {
172
190
  position: absolute;
173
191
  inset: 0;
@@ -175,7 +193,6 @@
175
193
  overflow: hidden;
176
194
  pointer-events: none;
177
195
  font-variant-numeric: tabular-nums;
178
- background: var(--_track-bg, var(--l-color-surface));
179
196
  }
180
197
 
181
198
  .l-input-stepper-track {
@@ -189,6 +206,17 @@
189
206
  height: var(--_button-size);
190
207
  }
191
208
 
209
+ /* Hide the real digits while the roller is the thing on screen. `opacity`, NOT
210
+ `visibility`/`display` — those drop the input out of the tab order, so the
211
+ :focus-within rule below could never fire to swap the two back. Gated on both
212
+ the attribute and the overlay's presence because the overlay is built once at
213
+ setup: toggling `with-roller` afterwards must not blank the value. */
214
+ :scope[with-roller]
215
+ .l-input-stepper-value:has(.l-input-stepper-track-display):not(:focus-within)
216
+ input {
217
+ opacity: 0;
218
+ }
219
+
192
220
  .l-input-stepper-value:focus-within .l-input-stepper-track-display {
193
221
  visibility: hidden;
194
222
  }
@@ -244,7 +272,6 @@
244
272
  /* Uses the form-control disabled tokens, not the generic aliases: a stepper
245
273
  is a text control and must grey out identically to the input next to it. */
246
274
  :scope:has(input:disabled) {
247
- --_track-bg: var(--l-form-control-disabled-background);
248
275
  border-color: var(--l-form-control-disabled-border);
249
276
  background-color: var(--l-form-control-disabled-background);
250
277
  }