@zazz-ui/core 0.12.2 → 0.13.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 (86) hide show
  1. package/AUTHORING.md +6 -6
  2. package/CHANGELOG.md +51 -0
  3. package/README.md +8 -6
  4. package/dist/sri.json +53 -53
  5. package/dist/zazz.css +1 -1
  6. package/dist/zazz.js +1 -1
  7. package/editor/zazz.css-data.json +1254 -3556
  8. package/editor/zazz.html-data.json +9 -0
  9. package/editor/zazz.language-data.json +48 -11
  10. package/editor/zazz.lint-data.json +1141 -1110
  11. package/package.json +5 -5
  12. package/src/base/_defaults.css +0 -83
  13. package/src/base/_properties-2xl.css +0 -8
  14. package/src/base/_properties-active.css +0 -4
  15. package/src/base/_properties-checked.css +0 -4
  16. package/src/base/_properties-current.css +0 -4
  17. package/src/base/_properties-disabled.css +0 -4
  18. package/src/base/_properties-focus-visible.css +0 -4
  19. package/src/base/_properties-focus-within.css +0 -4
  20. package/src/base/_properties-hover.css +0 -4
  21. package/src/base/_properties-lg.css +0 -8
  22. package/src/base/_properties-md.css +0 -8
  23. package/src/base/_properties-open.css +0 -4
  24. package/src/base/_properties-sm.css +0 -8
  25. package/src/base/_properties-starting.css +0 -26
  26. package/src/base/_properties-stuck.css +0 -2
  27. package/src/base/_properties-xl.css +0 -8
  28. package/src/base/_properties.css +23 -0
  29. package/src/base/_utilities-box.css +1 -6
  30. package/src/base/_utilities-color.css +1 -1
  31. package/src/base/_utilities-effects.css +7 -7
  32. package/src/base/_utilities-flow.css +54 -11
  33. package/src/base/_utilities-grid.css +5 -85
  34. package/src/base/_utilities-tier-2xl.css +0 -4
  35. package/src/base/_utilities-tier-active.css +0 -2
  36. package/src/base/_utilities-tier-checked.css +0 -2
  37. package/src/base/_utilities-tier-current.css +0 -2
  38. package/src/base/_utilities-tier-disabled.css +0 -2
  39. package/src/base/_utilities-tier-focus-visible.css +0 -2
  40. package/src/base/_utilities-tier-focus-within.css +0 -2
  41. package/src/base/_utilities-tier-hover.css +0 -2
  42. package/src/base/_utilities-tier-lg.css +0 -4
  43. package/src/base/_utilities-tier-md.css +0 -4
  44. package/src/base/_utilities-tier-open.css +0 -2
  45. package/src/base/_utilities-tier-sm.css +0 -4
  46. package/src/base/_utilities-tier-starting.css +0 -13
  47. package/src/base/_utilities-tier-stuck.css +0 -1
  48. package/src/base/_utilities-tier-xl.css +0 -4
  49. package/src/base/_utilities-typography.css +4 -8
  50. package/src/base/embla.d.ts.map +1 -1
  51. package/src/base/embla.js +223 -65
  52. package/src/base/embla.ts +245 -62
  53. package/src/base/kit-styling.d.ts.map +1 -1
  54. package/src/base/kit-styling.js +154 -150
  55. package/src/base/kit-styling.ts +154 -150
  56. package/src/base/utilities.d.ts +23 -7
  57. package/src/base/utilities.d.ts.map +1 -1
  58. package/src/base/utilities.js +91 -22
  59. package/src/base/utilities.ts +101 -23
  60. package/src/head.js +8 -8
  61. package/src/head.ts +8 -8
  62. package/src/manifest.d.ts.map +1 -1
  63. package/src/manifest.js +7 -1
  64. package/src/manifest.ts +7 -1
  65. package/src/primitives/carousel/carousel.css +4 -3
  66. package/src/primitives/carousel/carousel.d.ts +2 -1
  67. package/src/primitives/carousel/carousel.d.ts.map +1 -1
  68. package/src/primitives/carousel/carousel.js +2 -1
  69. package/src/primitives/carousel/carousel.ts +2 -1
  70. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  71. package/src/primitives/debug/audit-core.js +46 -4
  72. package/src/primitives/debug/audit-core.ts +53 -4
  73. package/src/primitives/lightbox/lightbox.js +2 -2
  74. package/src/primitives/lightbox/lightbox.ts +2 -2
  75. package/src/primitives/slider/slider.css +7 -2
  76. package/src/primitives/switch/switch.css +26 -3
  77. package/src/primitives/tabs/tabs-underline.html +117 -0
  78. package/src/primitives/tabs/tabs.css +119 -27
  79. package/src/primitives/toggle/toggle.css +153 -40
  80. package/src/primitives/utilities/flex-direction.html +1 -1
  81. package/src/primitives/utilities/flex-reverse.html +136 -0
  82. package/src/primitives/utilities/gallery.html +289 -0
  83. package/src/primitives/utilities/inline-flex.html +45 -0
  84. package/src/primitives/utilities/subgrid-col.html +109 -0
  85. package/src/primitives/utilities/subgrid-row.html +98 -0
  86. package/src/primitives/utilities/subgrid.html +135 -0
@@ -12,9 +12,22 @@
12
12
  * and each inline side gains half of what the height grew
13
13
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
14
14
  * rounded corners
15
+ * @uses data-tabs-variant="underline" — no track; the indicator is a line under
16
+ * the checked label (at its start edge when vertical)
15
17
  * @tokens --ui-tabs-* (@layer variables)
16
18
  */
17
19
 
20
+ /* Variant privates: non-inheriting so a variant never cascades into nested tabs. */
21
+ @property --_tabs-label-font-size {
22
+ syntax: "*";
23
+ inherits: false;
24
+ }
25
+
26
+ @property --_tabs-label-leading {
27
+ syntax: "*";
28
+ inherits: false;
29
+ }
30
+
18
31
  @layer variables {
19
32
  :root {
20
33
  /* metrics default to the shared --ui-field-* family so the track matches
@@ -57,6 +70,10 @@
57
70
  --ui-tabs-label-py: calc(var(--ui-field-py) / 2);
58
71
  --ui-tabs-label-min-h: calc(var(--spacing) * 7);
59
72
  --ui-tabs-label-ring-color: var(--ui-field-ring-color);
73
+
74
+ /* data-tabs-variant="underline" */
75
+ --ui-tabs-underline-width: 2px;
76
+ --ui-tabs-underline-color: var(--color-foreground);
60
77
  }
61
78
  }
62
79
 
@@ -123,9 +140,9 @@
123
140
  justify-content: center;
124
141
 
125
142
  font-family: var(--ui-tabs-label-font-family);
126
- font-size: var(--ui-tabs-label-font-size);
143
+ font-size: var(--_tabs-label-font-size, var(--ui-tabs-label-font-size));
127
144
  font-weight: var(--ui-tabs-label-font-weight);
128
- line-height: var(--ui-tabs-label-leading);
145
+ line-height: var(--_tabs-label-leading, var(--ui-tabs-label-leading));
129
146
 
130
147
  min-block-size: max(var(--ui-tabs-label-min-h), var(--_touch-min));
131
148
  padding-block: var(--ui-tabs-label-py);
@@ -255,101 +272,102 @@
255
272
  /* Nth radio in the list maps to the (N + 1)th child of the root. Selectors
256
273
  cannot do index arithmetic and sibling-index() is a value function, so the
257
274
  per-index enumeration (capped at 24 tabs) is needed. Hiding stays
258
- display:none so hidden panels are not focusable. */
275
+ display:none so hidden panels are not focusable. The list is matched as a
276
+ child of the root, so tabs nested in a panel do not hide the outer panels. */
259
277
  :where(ui-tabs, [data-ui~="tabs"]):has(
260
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(1):not(:checked)
278
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(1):not(:checked)
261
279
  )
262
280
  > [data-tabs-slot~="panel"]:nth-child(2),
263
281
  :where(ui-tabs, [data-ui~="tabs"]):has(
264
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(2):not(:checked)
282
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(2):not(:checked)
265
283
  )
266
284
  > [data-tabs-slot~="panel"]:nth-child(3),
267
285
  :where(ui-tabs, [data-ui~="tabs"]):has(
268
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(3):not(:checked)
286
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(3):not(:checked)
269
287
  )
270
288
  > [data-tabs-slot~="panel"]:nth-child(4),
271
289
  :where(ui-tabs, [data-ui~="tabs"]):has(
272
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(4):not(:checked)
290
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(4):not(:checked)
273
291
  )
274
292
  > [data-tabs-slot~="panel"]:nth-child(5),
275
293
  :where(ui-tabs, [data-ui~="tabs"]):has(
276
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(5):not(:checked)
294
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(5):not(:checked)
277
295
  )
278
296
  > [data-tabs-slot~="panel"]:nth-child(6),
279
297
  :where(ui-tabs, [data-ui~="tabs"]):has(
280
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(6):not(:checked)
298
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(6):not(:checked)
281
299
  )
282
300
  > [data-tabs-slot~="panel"]:nth-child(7),
283
301
  :where(ui-tabs, [data-ui~="tabs"]):has(
284
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(7):not(:checked)
302
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(7):not(:checked)
285
303
  )
286
304
  > [data-tabs-slot~="panel"]:nth-child(8),
287
305
  :where(ui-tabs, [data-ui~="tabs"]):has(
288
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(8):not(:checked)
306
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(8):not(:checked)
289
307
  )
290
308
  > [data-tabs-slot~="panel"]:nth-child(9),
291
309
  :where(ui-tabs, [data-ui~="tabs"]):has(
292
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(9):not(:checked)
310
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(9):not(:checked)
293
311
  )
294
312
  > [data-tabs-slot~="panel"]:nth-child(10),
295
313
  :where(ui-tabs, [data-ui~="tabs"]):has(
296
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(10):not(:checked)
314
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(10):not(:checked)
297
315
  )
298
316
  > [data-tabs-slot~="panel"]:nth-child(11),
299
317
  :where(ui-tabs, [data-ui~="tabs"]):has(
300
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(11):not(:checked)
318
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(11):not(:checked)
301
319
  )
302
320
  > [data-tabs-slot~="panel"]:nth-child(12),
303
321
  :where(ui-tabs, [data-ui~="tabs"]):has(
304
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(12):not(:checked)
322
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(12):not(:checked)
305
323
  )
306
324
  > [data-tabs-slot~="panel"]:nth-child(13),
307
325
  :where(ui-tabs, [data-ui~="tabs"]):has(
308
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(13):not(:checked)
326
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(13):not(:checked)
309
327
  )
310
328
  > [data-tabs-slot~="panel"]:nth-child(14),
311
329
  :where(ui-tabs, [data-ui~="tabs"]):has(
312
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(14):not(:checked)
330
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(14):not(:checked)
313
331
  )
314
332
  > [data-tabs-slot~="panel"]:nth-child(15),
315
333
  :where(ui-tabs, [data-ui~="tabs"]):has(
316
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(15):not(:checked)
334
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(15):not(:checked)
317
335
  )
318
336
  > [data-tabs-slot~="panel"]:nth-child(16),
319
337
  :where(ui-tabs, [data-ui~="tabs"]):has(
320
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(16):not(:checked)
338
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(16):not(:checked)
321
339
  )
322
340
  > [data-tabs-slot~="panel"]:nth-child(17),
323
341
  :where(ui-tabs, [data-ui~="tabs"]):has(
324
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(17):not(:checked)
342
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(17):not(:checked)
325
343
  )
326
344
  > [data-tabs-slot~="panel"]:nth-child(18),
327
345
  :where(ui-tabs, [data-ui~="tabs"]):has(
328
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(18):not(:checked)
346
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(18):not(:checked)
329
347
  )
330
348
  > [data-tabs-slot~="panel"]:nth-child(19),
331
349
  :where(ui-tabs, [data-ui~="tabs"]):has(
332
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(19):not(:checked)
350
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(19):not(:checked)
333
351
  )
334
352
  > [data-tabs-slot~="panel"]:nth-child(20),
335
353
  :where(ui-tabs, [data-ui~="tabs"]):has(
336
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(20):not(:checked)
354
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(20):not(:checked)
337
355
  )
338
356
  > [data-tabs-slot~="panel"]:nth-child(21),
339
357
  :where(ui-tabs, [data-ui~="tabs"]):has(
340
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(21):not(:checked)
358
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(21):not(:checked)
341
359
  )
342
360
  > [data-tabs-slot~="panel"]:nth-child(22),
343
361
  :where(ui-tabs, [data-ui~="tabs"]):has(
344
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(22):not(:checked)
362
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(22):not(:checked)
345
363
  )
346
364
  > [data-tabs-slot~="panel"]:nth-child(23),
347
365
  :where(ui-tabs, [data-ui~="tabs"]):has(
348
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(23):not(:checked)
366
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(23):not(:checked)
349
367
  )
350
368
  > [data-tabs-slot~="panel"]:nth-child(24),
351
369
  :where(ui-tabs, [data-ui~="tabs"]):has(
352
- [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(24):not(:checked)
370
+ > [data-tabs-slot~="list"] > input[type="radio"]:nth-of-type(24):not(:checked)
353
371
  )
354
372
  > [data-tabs-slot~="panel"]:nth-child(25) {
355
373
  display: none !important;
@@ -373,4 +391,78 @@
373
391
  text-align: start;
374
392
  justify-content: start;
375
393
  }
394
+
395
+ /* ===========================================================================
396
+ UNDERLINE VARIANT — no track; the indicator is a line under the checked label.
397
+ Child combinators keep the variant off tabs nested in a panel.
398
+ =========================================================================== */
399
+
400
+ :where(ui-tabs, [data-ui~="tabs"])[data-tabs-variant="underline"] > [data-tabs-slot~="list"] {
401
+ padding: 0;
402
+ border: 0;
403
+ border-radius: 0;
404
+ background-color: transparent;
405
+ }
406
+
407
+ :where(ui-tabs, [data-ui~="tabs"])[data-tabs-variant="underline"]
408
+ > [data-tabs-slot~="list"]
409
+ > [data-tabs-slot~="label"] {
410
+ --_tabs-label-font-size: var(--font-size-md);
411
+ --_tabs-label-leading: var(--leading-md);
412
+ }
413
+
414
+ :where(ui-tabs, [data-ui~="tabs"])[data-tabs-variant="underline"]
415
+ > [data-tabs-slot~="list"]
416
+ > [data-tabs-slot~="indicator"] {
417
+ /* the line sits on the label's own edge: there is no track padding to clear */
418
+ --ui-tabs-indicator-inset: 0px;
419
+ border: 0;
420
+ border-block-end: var(--ui-tabs-underline-width) solid var(--ui-tabs-underline-color);
421
+ border-radius: 0;
422
+ background-color: transparent;
423
+ box-shadow: none;
424
+ }
425
+
426
+ :where(
427
+ ui-tabs,
428
+ [data-ui~="tabs"]
429
+ )[data-tabs-variant="underline"][data-tabs-orientation="vertical"]
430
+ > [data-tabs-slot~="list"]
431
+ > [data-tabs-slot~="indicator"] {
432
+ border-block-end: 0;
433
+ border-inline-start: var(--ui-tabs-underline-width) solid var(--ui-tabs-underline-color);
434
+ }
435
+
436
+ /* Without anchor positioning there is no indicator: the checked label draws the line. */
437
+ @supports not (anchor-name: --active-tab) {
438
+ :where(ui-tabs, [data-ui~="tabs"])[data-tabs-variant="underline"]
439
+ > [data-tabs-slot~="list"]
440
+ > input[type="radio"]:checked
441
+ + [data-tabs-slot~="label"] {
442
+ border-radius: 0;
443
+ background: linear-gradient(var(--ui-tabs-underline-color) 0 0) bottom / 100%
444
+ var(--ui-tabs-underline-width) no-repeat;
445
+ }
446
+
447
+ :where(
448
+ ui-tabs,
449
+ [data-ui~="tabs"]
450
+ )[data-tabs-variant="underline"][data-tabs-orientation="vertical"]
451
+ > [data-tabs-slot~="list"]
452
+ > input[type="radio"]:checked
453
+ + [data-tabs-slot~="label"] {
454
+ background-position: left;
455
+ background-size: var(--ui-tabs-underline-width) 100%;
456
+ }
457
+
458
+ :where(
459
+ ui-tabs,
460
+ [data-ui~="tabs"]
461
+ )[data-tabs-variant="underline"][data-tabs-orientation="vertical"]:dir(rtl)
462
+ > [data-tabs-slot~="list"]
463
+ > input[type="radio"]:checked
464
+ + [data-tabs-slot~="label"] {
465
+ background-position: right;
466
+ }
467
+ }
376
468
  }
@@ -3,15 +3,16 @@
3
3
  *
4
4
  * Same look as the button (hooks default to the --ui-button-* family), but it wraps a
5
5
  * native checkbox or radio inside a <label>. State is driven from the nested input
6
- * via :has(): the checked state reuses the button's *active* token values, so an
7
- * "on" toggle reads like a pressed button. Because the state lives on the input,
6
+ * via :has(): the checked state takes the primary role, so an "on" toggle reads
7
+ * like a primary button. Because the state lives on the input,
8
8
  * the label's own state tiers (`--bg--checked`) do not fire; theme the checked
9
9
  * look through the `--ui-toggle-*--checked` hooks.
10
10
  *
11
11
  * @layer variables, components
12
- * @requires _layers.css, _variables.css, _properties.css (--_*-resolved, --_focus-shadow), button.css
12
+ * @requires _layers.css, _variables.css, _properties.css (--_*-resolved, --_focus-shadow), button.css, kbd.css (--ui-kbd-*)
13
13
  * @uses :has(): drive label state from the nested input (checked/focus/disabled)
14
- * @uses oklch(from …): variant hover/active tints (inherited from --ui-button-*)
14
+ * @uses color-mix(), oklch(from …): variant hover/active tints, the same steps
15
+ * as the button's variants
15
16
  * @uses text-box: vertical trim (patchy browser support)
16
17
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
17
18
  * rounded corners
@@ -54,9 +55,9 @@
54
55
  --ui-toggle-border-color--hover: var(--ui-button-border-color--hover);
55
56
  --ui-toggle-border-color--active: var(--ui-button-border-color--active);
56
57
 
57
- --ui-toggle-border-color--checked: var(--color-primary);
58
- --ui-toggle-border-color--checked-hover: var(--color-primary);
59
- --ui-toggle-border-color--checked-active: var(--color-primary);
58
+ --ui-toggle-border-color--checked: var(--color-border);
59
+ --ui-toggle-border-color--checked-hover: var(--color-border);
60
+ --ui-toggle-border-color--checked-active: var(--color-border);
60
61
 
61
62
  /* dual-mode hooks: a scale number or a length */
62
63
  --ui-toggle-gap: var(--ui-button-gap);
@@ -65,6 +66,7 @@
65
66
  --ui-toggle-min-h: var(--ui-button-min-h);
66
67
  --ui-toggle-radius: var(--ui-button-radius);
67
68
  --ui-toggle-corner-shape: var(--ui-button-corner-shape);
69
+ --ui-toggle-background-clip: border-box;
68
70
 
69
71
  --ui-toggle-icon-size: var(--ui-button-icon-size);
70
72
 
@@ -79,102 +81,127 @@
79
81
  syntax: "*";
80
82
  inherits: false;
81
83
  }
84
+
82
85
  @property --_toggle-font-family {
83
86
  syntax: "*";
84
87
  inherits: false;
85
88
  }
89
+
86
90
  @property --_toggle-font-size {
87
91
  syntax: "*";
88
92
  inherits: false;
89
93
  }
94
+
90
95
  @property --_toggle-font-weight {
91
96
  syntax: "*";
92
97
  inherits: false;
93
98
  }
99
+
94
100
  @property --_toggle-leading {
95
101
  syntax: "*";
96
102
  inherits: false;
97
103
  }
104
+
98
105
  @property --_toggle-bg {
99
106
  syntax: "*";
100
107
  inherits: false;
101
108
  }
109
+
102
110
  @property --_toggle-bg--hover {
103
111
  syntax: "*";
104
112
  inherits: false;
105
113
  }
114
+
106
115
  @property --_toggle-bg--active {
107
116
  syntax: "*";
108
117
  inherits: false;
109
118
  }
119
+
110
120
  @property --_toggle-bg--checked {
111
121
  syntax: "*";
112
122
  inherits: false;
113
123
  }
124
+
114
125
  @property --_toggle-bg--checked-hover {
115
126
  syntax: "*";
116
127
  inherits: false;
117
128
  }
129
+
118
130
  @property --_toggle-bg--checked-active {
119
131
  syntax: "*";
120
132
  inherits: false;
121
133
  }
134
+
122
135
  @property --_toggle-text {
123
136
  syntax: "*";
124
137
  inherits: false;
125
138
  }
139
+
126
140
  @property --_toggle-text--hover {
127
141
  syntax: "*";
128
142
  inherits: false;
129
143
  }
144
+
130
145
  @property --_toggle-text--active {
131
146
  syntax: "*";
132
147
  inherits: false;
133
148
  }
149
+
134
150
  @property --_toggle-text--checked {
135
151
  syntax: "*";
136
152
  inherits: false;
137
153
  }
154
+
138
155
  @property --_toggle-text--checked-hover {
139
156
  syntax: "*";
140
157
  inherits: false;
141
158
  }
159
+
142
160
  @property --_toggle-text--checked-active {
143
161
  syntax: "*";
144
162
  inherits: false;
145
163
  }
164
+
146
165
  @property --_toggle-border-width {
147
166
  syntax: "*";
148
167
  inherits: false;
149
168
  }
169
+
150
170
  @property --_toggle-border-style {
151
171
  syntax: "*";
152
172
  inherits: false;
153
173
  }
174
+
154
175
  @property --_toggle-border-color {
155
176
  syntax: "*";
156
177
  inherits: false;
157
178
  }
179
+
158
180
  @property --_toggle-border-color--hover {
159
181
  syntax: "*";
160
182
  inherits: false;
161
183
  }
184
+
162
185
  @property --_toggle-border-color--active {
163
186
  syntax: "*";
164
187
  inherits: false;
165
188
  }
189
+
166
190
  @property --_toggle-border-color--checked {
167
191
  syntax: "*";
168
192
  inherits: false;
169
193
  }
194
+
170
195
  @property --_toggle-border-color--checked-hover {
171
196
  syntax: "*";
172
197
  inherits: false;
173
198
  }
199
+
174
200
  @property --_toggle-border-color--checked-active {
175
201
  syntax: "*";
176
202
  inherits: false;
177
203
  }
204
+
178
205
  @property --_toggle-gap {
179
206
  syntax: "*";
180
207
  inherits: false;
@@ -189,14 +216,27 @@
189
216
  syntax: "*";
190
217
  inherits: false;
191
218
  }
219
+
192
220
  @property --_toggle-min-h {
193
221
  syntax: "*";
194
222
  inherits: false;
195
223
  }
224
+
196
225
  @property --_toggle-radius {
197
226
  syntax: "*";
198
227
  inherits: false;
199
228
  }
229
+
230
+ @property --_toggle-corner-shape {
231
+ syntax: "*";
232
+ inherits: false;
233
+ }
234
+
235
+ @property --_toggle-background-clip {
236
+ syntax: "*";
237
+ inherits: false;
238
+ }
239
+
200
240
  @property --_toggle-shadow {
201
241
  syntax: "*";
202
242
  inherits: false;
@@ -245,14 +285,12 @@
245
285
  --_px-len: var(--_px-resolved, var(--_toggle-px, var(--ui-toggle-px)));
246
286
  --_px-num: var(--_px-resolved, var(--_toggle-px, var(--ui-toggle-px)));
247
287
  /* each inline side gains half of what the touch floor added to the height, so the
248
- label's margins grow evenly */
249
- padding-inline: calc(
250
- var(--_px-len) + var(--_px-num) * var(--spacing) +
251
- max(
252
- 0px,
253
- (var(--_touch-floor) - calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing))) / 2
254
- )
288
+ label's margins grow evenly; the kbd ends below add it too */
289
+ --_touch-px: max(
290
+ 0px,
291
+ (var(--_touch-floor) - calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing))) / 2
255
292
  );
293
+ padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing) + var(--_touch-px));
256
294
 
257
295
  border-width: var(
258
296
  --_border-width-resolved,
@@ -271,10 +309,18 @@
271
309
  border-radius: calc(
272
310
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
273
311
  );
274
- corner-shape: var(--_corner-shape-resolved, var(--ui-toggle-corner-shape));
312
+ corner-shape: var(
313
+ --_corner-shape-resolved,
314
+ var(--_toggle-corner-shape, var(--ui-toggle-corner-shape))
315
+ );
275
316
 
276
317
  color: var(--_text-resolved, var(--_toggle-text, var(--ui-toggle-text)));
277
318
  background-color: var(--_bg-resolved, var(--_toggle-bg, var(--ui-toggle-bg)));
319
+ background-clip: var(
320
+ --_bg-clip-resolved,
321
+ var(--_toggle-background-clip, var(--ui-toggle-background-clip))
322
+ );
323
+ white-space-collapse: collapse;
278
324
 
279
325
  /* published to --_focus-shadow so a --shadow or --ring utility keeps it; the
280
326
  widths grow from 0 on :focus-visible so the ring eases in */
@@ -298,7 +344,7 @@
298
344
  var(--_focus-shadow, 0 0 #0000),
299
345
  var(--_shadow-resolved, var(--_toggle-shadow, var(--ui-toggle-shadow)));
300
346
 
301
- cursor: pointer;
347
+ cursor: default;
302
348
  text-decoration: none;
303
349
 
304
350
  /* transparent twin of the ring for forced-colors / high-contrast modes */
@@ -395,6 +441,18 @@
395
441
  outline-color: transparent;
396
442
  }
397
443
 
444
+ /* before the variants at the same specificity: a disabled primary keeps its color; only the default surface goes muted */
445
+ :where([data-ui~="toggle"]:has(> input:disabled)) {
446
+ --_toggle-text: var(--color-muted-foreground);
447
+ --_toggle-bg: var(--color-muted);
448
+ --_toggle-shadow: 0 0 transparent;
449
+ --decoration-line: none;
450
+
451
+ cursor: default;
452
+ opacity: 0.6;
453
+ outline: none;
454
+ }
455
+
398
456
  /* ===========================================================================
399
457
  ICONS
400
458
  =========================================================================== */
@@ -415,8 +473,14 @@
415
473
 
416
474
  :where([data-ui~="toggle"][data-toggle-variant="primary"]) {
417
475
  --_toggle-bg: var(--color-primary);
418
- --_toggle-bg--hover: oklch(from var(--color-primary) l c h / 0.9);
419
- --_toggle-bg--active: oklch(from var(--color-primary) l c h / 0.8);
476
+ --_toggle-bg--hover: light-dark(
477
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.2) c h),
478
+ oklch(from var(--color-primary) calc(l * 0.8) c h)
479
+ );
480
+ --_toggle-bg--active: light-dark(
481
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.3) c h),
482
+ oklch(from var(--color-primary) calc(l * 0.7) c h)
483
+ );
420
484
 
421
485
  --_toggle-text: var(--color-primary-foreground);
422
486
  --_toggle-text--hover: var(--color-primary-foreground);
@@ -431,8 +495,14 @@
431
495
 
432
496
  :where([data-ui~="toggle"][data-toggle-variant="secondary"]) {
433
497
  --_toggle-bg: var(--color-secondary);
434
- --_toggle-bg--hover: oklch(from var(--color-secondary) l c h / 0.9);
435
- --_toggle-bg--active: oklch(from var(--color-secondary) l c h / 0.8);
498
+ --_toggle-bg--hover: light-dark(
499
+ oklch(from var(--color-secondary) calc(l + (1 - l) * 0.2) c h),
500
+ oklch(from var(--color-secondary) calc(l * 0.8) c h)
501
+ );
502
+ --_toggle-bg--active: light-dark(
503
+ oklch(from var(--color-secondary) calc(l + (1 - l) * 0.3) c h),
504
+ oklch(from var(--color-secondary) calc(l * 0.7) c h)
505
+ );
436
506
 
437
507
  --_toggle-text: var(--color-secondary-foreground);
438
508
  --_toggle-text--hover: var(--color-secondary-foreground);
@@ -447,8 +517,14 @@
447
517
 
448
518
  :where([data-ui~="toggle"][data-toggle-variant="tertiary"]) {
449
519
  --_toggle-bg: var(--color-tertiary);
450
- --_toggle-bg--hover: oklch(from var(--color-tertiary) l c h / 0.9);
451
- --_toggle-bg--active: oklch(from var(--color-tertiary) l c h / 0.8);
520
+ --_toggle-bg--hover: light-dark(
521
+ oklch(from var(--color-tertiary) calc(l + (1 - l) * 0.2) c h),
522
+ oklch(from var(--color-tertiary) calc(l * 0.8) c h)
523
+ );
524
+ --_toggle-bg--active: light-dark(
525
+ oklch(from var(--color-tertiary) calc(l + (1 - l) * 0.3) c h),
526
+ oklch(from var(--color-tertiary) calc(l * 0.7) c h)
527
+ );
452
528
 
453
529
  --_toggle-text: var(--color-tertiary-foreground);
454
530
  --_toggle-text--hover: var(--color-tertiary-foreground);
@@ -462,9 +538,10 @@
462
538
  }
463
539
 
464
540
  :where([data-ui~="toggle"][data-toggle-variant="muted"]) {
541
+ /* the translucent muted role: fades toward the surface beneath */
465
542
  --_toggle-bg: var(--color-muted);
466
- --_toggle-bg--hover: oklch(from var(--color-muted) l c h / calc(alpha - 0.02));
467
- --_toggle-bg--active: var(--color-muted);
543
+ --_toggle-bg--hover: oklch(from var(--_toggle-bg) l c h / calc(alpha * 0.66));
544
+ --_toggle-bg--active: oklch(from var(--_toggle-bg) l c h / calc(alpha * 0.33));
468
545
 
469
546
  --_toggle-text: var(--color-foreground);
470
547
  --_toggle-text--hover: var(--color-foreground);
@@ -480,8 +557,9 @@
480
557
  /* the "ghost" toggle reads as bare until on/hovered */
481
558
  :where([data-ui~="toggle"][data-toggle-variant="ghost"]) {
482
559
  --_toggle-bg: transparent;
560
+ /* the translucent muted role: shows the surface beneath and follows a retheme */
483
561
  --_toggle-bg--hover: var(--color-muted);
484
- --_toggle-bg--active: oklch(from var(--color-muted) l c h / calc(alpha - 0.02));
562
+ --_toggle-bg--active: oklch(from var(--_toggle-bg--hover) l c h / calc(alpha * 1.5));
485
563
 
486
564
  --_toggle-text: var(--color-foreground);
487
565
  --_toggle-text--hover: var(--color-foreground);
@@ -498,12 +576,12 @@
498
576
  --_toggle-ring-color: var(--color-destructive-foreground);
499
577
 
500
578
  --_toggle-bg: var(--color-destructive);
501
- --_toggle-bg--hover: oklch(from var(--color-destructive) calc(l - 0.025) c h);
502
- --_toggle-bg--active: oklch(from var(--color-destructive) calc(l - 0.05) c h);
579
+ --_toggle-bg--hover: oklch(from var(--_toggle-bg) calc(l - 0.025) c h);
580
+ --_toggle-bg--active: oklch(from var(--_toggle-bg) calc(l - 0.05) c h);
503
581
 
504
582
  --_toggle-text: var(--color-destructive-foreground);
505
- --_toggle-text--hover: var(--color-destructive-foreground);
506
- --_toggle-text--active: var(--color-destructive-foreground);
583
+ --_toggle-text--hover: var(--_toggle-text);
584
+ --_toggle-text--active: var(--_toggle-text);
507
585
 
508
586
  --_toggle-border-color: transparent;
509
587
  --_toggle-border-color--hover: transparent;
@@ -512,17 +590,6 @@
512
590
  --_toggle-shadow: 0 0 transparent;
513
591
  }
514
592
 
515
- /* disabled comes after the variants so a disabled toggle is muted whatever its variant */
516
- :where([data-ui~="toggle"]:has(> input:disabled)) {
517
- --_toggle-text: var(--color-muted-foreground);
518
- --_toggle-bg: var(--color-muted);
519
- --_toggle-shadow: 0 0 transparent;
520
-
521
- cursor: default;
522
- opacity: 0.5;
523
- outline: none;
524
- }
525
-
526
593
  /* ===========================================================================
527
594
  SIZES
528
595
  =========================================================================== */
@@ -533,6 +600,7 @@
533
600
  --_toggle-py: calc(var(--spacing) * 0.75);
534
601
  --_toggle-px: calc(var(--spacing) * 2);
535
602
  --_toggle-radius: var(--radius-sm);
603
+ --_toggle-font-size: var(--font-size-xs);
536
604
  /* dense by choice: the box stays small and ::after takes the touch floor */
537
605
  --_touch-floor: 0px;
538
606
  }
@@ -571,4 +639,49 @@
571
639
  position: absolute;
572
640
  inset: min(0px, calc((100% - var(--_touch-min)) / 2));
573
641
  }
642
+
643
+ /* ===========================================================================
644
+ KBD
645
+ =========================================================================== */
646
+
647
+ /* Descendant (not child) so keys wrapped in a ui-kbd-group still resize */
648
+ :where([data-ui~="toggle"]) :where(kbd) {
649
+ --ui-kbd-min-w: calc(var(--spacing) * 4.5);
650
+ --ui-kbd-min-h: calc(var(--spacing) * 4.5);
651
+ --ui-kbd-icon-size: calc(var(--spacing) * 3);
652
+ }
653
+
654
+ /* the button's kbd ends, counted without the hidden input: a kbd at either end
655
+ of the visible content, but not alone, tightens that side */
656
+ :where([data-ui~="toggle"]):has(
657
+ > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):nth-last-child(1 of :not(input)):not(
658
+ :nth-child(1 of :not(input))
659
+ )
660
+ ) {
661
+ padding-inline-end: calc(var(--spacing) * 1.5 + var(--_touch-px));
662
+ }
663
+
664
+ :where([data-ui~="toggle"]):has(
665
+ > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):nth-child(1 of :not(input)):not(
666
+ :nth-last-child(1 of :not(input))
667
+ )
668
+ ) {
669
+ padding-inline-start: calc(var(--spacing) * 1.5 + var(--_touch-px));
670
+ }
671
+
672
+ :where([data-ui~="toggle"][data-toggle-size="sm"]):has(
673
+ > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):nth-last-child(1 of :not(input)):not(
674
+ :nth-child(1 of :not(input))
675
+ )
676
+ ) {
677
+ padding-inline-end: calc(var(--spacing) * 0.5 + var(--_touch-px));
678
+ }
679
+
680
+ :where([data-ui~="toggle"][data-toggle-size="sm"]):has(
681
+ > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):nth-child(1 of :not(input)):not(
682
+ :nth-last-child(1 of :not(input))
683
+ )
684
+ ) {
685
+ padding-inline-start: calc(var(--spacing) * 0.5 + var(--_touch-px));
686
+ }
574
687
  }
@@ -22,7 +22,7 @@
22
22
  >
23
23
  <div
24
24
  style="
25
- --display: flex;
25
+ --display: flex-row;
26
26
  --gap: 4;
27
27
  "
28
28
  >