@zazz-ui/core 0.9.1 → 0.11.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 (127) hide show
  1. package/AUTHORING.md +21 -16
  2. package/CHANGELOG.md +144 -0
  3. package/README.md +3 -3
  4. package/dist/sri.json +89 -88
  5. package/dist/zazz.css +1 -1
  6. package/editor/zazz.css-data.json +8370 -1264
  7. package/editor/zazz.html-data.json +31 -41
  8. package/editor/zazz.language-data.json +516 -247
  9. package/editor/zazz.lint-data.json +654 -619
  10. package/package.json +2 -3
  11. package/src/base/_defaults.css +59 -40
  12. package/src/base/_layers.css +5 -2
  13. package/src/base/_properties-2xl.css +10 -0
  14. package/src/base/_properties-active.css +8 -0
  15. package/src/base/_properties-checked.css +8 -0
  16. package/src/base/_properties-current.css +8 -0
  17. package/src/base/_properties-disabled.css +8 -0
  18. package/src/base/_properties-focus-visible.css +8 -0
  19. package/src/base/_properties-focus-within.css +8 -0
  20. package/src/base/_properties-hover.css +8 -0
  21. package/src/base/_properties-lg.css +10 -0
  22. package/src/base/_properties-md.css +10 -0
  23. package/src/base/_properties-open.css +8 -0
  24. package/src/base/_properties-sm.css +10 -0
  25. package/src/base/_properties-starting.css +4 -0
  26. package/src/base/_properties-stuck.css +4 -0
  27. package/src/base/_properties-xl.css +10 -0
  28. package/src/base/_properties.css +55 -15
  29. package/src/base/_reset.css +8 -4
  30. package/src/base/_typography.css +26 -9
  31. package/src/base/_utilities-box.css +63 -59
  32. package/src/base/_utilities-color.css +55 -8
  33. package/src/base/_utilities-effects.css +8 -0
  34. package/src/base/_utilities-flow.css +28 -5
  35. package/src/base/_utilities-pseudo.css +4 -0
  36. package/src/base/_utilities-spacing.css +8 -8
  37. package/src/base/_utilities-sr.css +98 -0
  38. package/src/base/_utilities-tier-2xl.css +5 -0
  39. package/src/base/_utilities-tier-active.css +5 -1
  40. package/src/base/_utilities-tier-checked.css +5 -1
  41. package/src/base/_utilities-tier-current.css +5 -1
  42. package/src/base/_utilities-tier-disabled.css +5 -1
  43. package/src/base/_utilities-tier-focus-visible.css +5 -1
  44. package/src/base/_utilities-tier-focus-within.css +5 -1
  45. package/src/base/_utilities-tier-hover.css +5 -1
  46. package/src/base/_utilities-tier-lg.css +5 -0
  47. package/src/base/_utilities-tier-md.css +5 -0
  48. package/src/base/_utilities-tier-open.css +5 -1
  49. package/src/base/_utilities-tier-sm.css +5 -0
  50. package/src/base/_utilities-tier-starting.css +2 -0
  51. package/src/base/_utilities-tier-stuck.css +3 -0
  52. package/src/base/_utilities-tier-xl.css +5 -0
  53. package/src/base/_utilities-typography.css +263 -3
  54. package/src/base/_variables.css +151 -60
  55. package/src/base/kit-styling.d.ts.map +1 -1
  56. package/src/base/kit-styling.js +134 -128
  57. package/src/base/kit-styling.ts +134 -128
  58. package/src/base/utilities.d.ts +23 -8
  59. package/src/base/utilities.d.ts.map +1 -1
  60. package/src/base/utilities.js +78 -3
  61. package/src/base/utilities.ts +95 -11
  62. package/src/head.d.ts.map +1 -1
  63. package/src/head.js +4 -5
  64. package/src/head.ts +4 -5
  65. package/src/index.css +3 -2
  66. package/src/manifest.d.ts.map +1 -1
  67. package/src/manifest.js +13 -3
  68. package/src/manifest.ts +13 -3
  69. package/src/primitives/accordion/accordion.css +3 -0
  70. package/src/primitives/alert-dialog/alert-dialog.css +1 -1
  71. package/src/primitives/alert-dialog/alert-dialog.html +14 -14
  72. package/src/primitives/autocomplete/autocomplete.css +4 -2
  73. package/src/primitives/avatar/avatar.html +4 -6
  74. package/src/primitives/badge/badge.css +77 -56
  75. package/src/primitives/breadcrumbs/breadcrumbs.html +1 -7
  76. package/src/primitives/button/button.css +75 -60
  77. package/src/primitives/button-group/button-group.css +4 -0
  78. package/src/primitives/callout/callout.css +22 -43
  79. package/src/primitives/card/card-subgrid.html +2 -3
  80. package/src/primitives/card/card.css +4 -0
  81. package/src/primitives/card/card.html +2 -3
  82. package/src/primitives/checkbox/checkbox.css +13 -0
  83. package/src/primitives/combobox/combobox.css +25 -2
  84. package/src/primitives/command/command-actions.d.ts.map +1 -1
  85. package/src/primitives/command/command-actions.js +4 -9
  86. package/src/primitives/command/command-actions.ts +4 -9
  87. package/src/primitives/command/command-dialog.html +109 -107
  88. package/src/primitives/command/command.css +16 -8
  89. package/src/primitives/debug/audit-core.d.ts +1 -1
  90. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  91. package/src/primitives/debug/audit-core.js +30 -3
  92. package/src/primitives/debug/audit-core.ts +40 -2
  93. package/src/primitives/dialog/dialog-with-form.html +1 -1
  94. package/src/primitives/dialog/dialog.css +111 -44
  95. package/src/primitives/fields/fields.css +11 -5
  96. package/src/primitives/group/group.css +18 -0
  97. package/src/primitives/group/group.html +26 -0
  98. package/src/primitives/input/input.css +16 -9
  99. package/src/primitives/input-group/input-group-password-group.html +1 -1
  100. package/src/primitives/input-group/input-group.css +19 -11
  101. package/src/primitives/kbd/kbd.css +4 -0
  102. package/src/primitives/lightbox/lightbox.css +17 -4
  103. package/src/primitives/lightbox/lightbox.html +2 -1
  104. package/src/primitives/menu/menu.css +3 -1
  105. package/src/primitives/meter/meter.css +10 -3
  106. package/src/primitives/mobile-menu/mobile-menu.css +17 -16
  107. package/src/primitives/mobile-menu/mobile-menu.html +4 -4
  108. package/src/primitives/navigation-menu/navigation-menu.css +8 -3
  109. package/src/primitives/navigation-menu/navigation-menu.html +2 -2
  110. package/src/primitives/otp/otp.css +7 -2
  111. package/src/primitives/password-group/password-group.css +20 -12
  112. package/src/primitives/password-group/password-group.html +1 -1
  113. package/src/primitives/popover/popover.css +29 -10
  114. package/src/primitives/progress/progress.css +5 -0
  115. package/src/primitives/radio/radio.css +15 -2
  116. package/src/primitives/scroll-fade/scroll-fade.css +1 -1
  117. package/src/primitives/select/select.css +42 -21
  118. package/src/primitives/slider/slider.css +11 -0
  119. package/src/primitives/switch/switch.css +67 -20
  120. package/src/primitives/tabs/tabs.css +20 -1
  121. package/src/primitives/textarea/textarea.css +19 -10
  122. package/src/primitives/toaster/toaster.css +8 -4
  123. package/src/primitives/toggle/toggle.css +37 -9
  124. package/src/primitives/toggle-group/toggle-group.css +4 -0
  125. package/src/primitives/tooltip/tooltip.css +44 -25
  126. package/src/primitives/utilities/pile.html +2 -3
  127. package/src/base/_switches.css +0 -148
@@ -5,12 +5,21 @@
5
5
  * @requires _layers.css, _variables.css, _reset.css, _properties.css (--_*-resolved, --_focus-shadow), fields.css (--ui-field-* border/ring)
6
6
  * @uses color-mix(), oklch(from …): variant hover/active tints
7
7
  * @uses text-box: vertical trim (patchy browser support)
8
+ * @uses --_touch-min (touch screens): an interactive badge keeps its size and extends an
9
+ * invisible ::after hit area to the touch floor
10
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
11
+ * rounded corners
8
12
  * @tokens --ui-badge-* (@layer variables; hooks are named after the utilities they back)
9
13
  * @consumedby combobox.css (selection tags)
10
14
  *
11
15
  * Every utility-backed declaration reads one chain, highest first:
12
16
  * var(--_<utility>-resolved, var(--_badge-<utility>, var(--ui-badge-<utility>)))
13
17
  * States apply only to interactive badges (button, a[href]).
18
+ *
19
+ * States step one way and active goes further than hover. Unfilled surfaces (the
20
+ * default, outline, ghost) gain the muted role; filled ones fade toward the page;
21
+ * status surfaces darken. Button and badge resolve the same in every variant
22
+ * (badge-button-parity.browser.test.ts).
14
23
  */
15
24
 
16
25
  @layer variables {
@@ -24,8 +33,8 @@
24
33
  --ui-badge-leading: 1;
25
34
 
26
35
  --ui-badge-bg: var(--color-background);
27
- --ui-badge-bg--hover: oklch(from var(--color-background) calc(l - 0.025) c h);
28
- --ui-badge-bg--active: oklch(from var(--color-background) calc(l - 0.05) c h);
36
+ --ui-badge-bg--hover: var(--color-muted);
37
+ --ui-badge-bg--active: oklch(from var(--ui-badge-bg--hover) l c h / calc(alpha * 1.5));
29
38
 
30
39
  --ui-badge-text: var(--color-foreground);
31
40
  --ui-badge-text--hover: var(--color-foreground);
@@ -42,6 +51,7 @@
42
51
  --ui-badge-px: calc(var(--spacing) * 1.25);
43
52
  --ui-badge-h: calc(var(--spacing) * 5);
44
53
  --ui-badge-radius: var(--radius-sm);
54
+ --ui-badge-corner-shape: var(--radius-corner-shape);
45
55
  --ui-badge-background-clip: border-box;
46
56
 
47
57
  --ui-badge-icon-size: calc(var(--spacing) * 3);
@@ -215,6 +225,7 @@
215
225
  border-radius: calc(
216
226
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
217
227
  );
228
+ corner-shape: var(--_corner-shape-resolved, var(--ui-badge-corner-shape));
218
229
 
219
230
  color: var(--_text-resolved, var(--_badge-text, var(--ui-badge-text)));
220
231
  background-color: var(--_bg-resolved, var(--_badge-bg, var(--ui-badge-bg)));
@@ -272,6 +283,18 @@
272
283
  BADGE STATES — interactive badges only (button, a[href])
273
284
  =========================================================================== */
274
285
 
286
+ /* touch: the badge keeps its box; a transparent ::after centred on it is at least
287
+ --_touch-min square (it collapses to the box on a mouse) */
288
+ :where([data-ui~="badge"]):is(button, a[href]) {
289
+ position: relative;
290
+ }
291
+
292
+ :where([data-ui~="badge"]:is(button, a[href]))::after {
293
+ content: "";
294
+ position: absolute;
295
+ inset: min(0px, calc((100% - var(--_touch-min)) / 2));
296
+ }
297
+
275
298
  @media (hover: hover) {
276
299
  :where([data-ui~="badge"]):is(button, a[href]):hover:not(:disabled, [aria-disabled="true"]) {
277
300
  color: var(--_text-resolved, var(--_badge-text--hover, var(--ui-badge-text--hover)));
@@ -302,6 +325,18 @@
302
325
  outline-color: transparent;
303
326
  }
304
327
 
328
+ /* before the variants at the same specificity: a disabled primary keeps its color */
329
+ :where([data-ui~="badge"]:is(:disabled, [aria-disabled="true"])) {
330
+ --_badge-text: var(--color-muted-foreground);
331
+ --_badge-bg: var(--color-muted);
332
+ --_badge-shadow: 0 0 transparent;
333
+ --decoration-line: none;
334
+
335
+ cursor: default;
336
+ opacity: 0.6;
337
+ outline: none;
338
+ }
339
+
305
340
  :where([data-ui~="badge"]):is(button, a[href])[aria-busy="true"] {
306
341
  cursor: progress;
307
342
  }
@@ -324,6 +359,12 @@
324
359
  BADGE VARIANTS — data-badge-variant writes the privates
325
360
  =========================================================================== */
326
361
 
362
+ :where([data-ui~="badge"][data-badge-variant="outline"]) {
363
+ --_badge-bg: transparent;
364
+
365
+ --_badge-shadow: 0 0 transparent;
366
+ }
367
+
327
368
  :where([data-ui~="badge"][data-badge-variant="primary"]) {
328
369
  --_badge-bg: var(--color-primary);
329
370
  --_badge-bg--hover: light-dark(
@@ -342,6 +383,8 @@
342
383
  --_badge-border-color: transparent;
343
384
  --_badge-border-color--hover: transparent;
344
385
  --_badge-border-color--active: transparent;
386
+
387
+ --_badge-shadow: 0 0 transparent;
345
388
  }
346
389
 
347
390
  :where([data-ui~="badge"][data-badge-variant="secondary"]) {
@@ -362,6 +405,8 @@
362
405
  --_badge-border-color: transparent;
363
406
  --_badge-border-color--hover: transparent;
364
407
  --_badge-border-color--active: transparent;
408
+
409
+ --_badge-shadow: 0 0 transparent;
365
410
  }
366
411
 
367
412
  :where([data-ui~="badge"][data-badge-variant="tertiary"]) {
@@ -382,16 +427,15 @@
382
427
  --_badge-border-color: transparent;
383
428
  --_badge-border-color--hover: transparent;
384
429
  --_badge-border-color--active: transparent;
430
+
431
+ --_badge-shadow: 0 0 transparent;
385
432
  }
386
433
 
387
434
  :where([data-ui~="badge"][data-badge-variant="muted"]) {
388
- /* --color-muted flattened onto the page so the surface stays opaque */
389
- --_badge-bg: light-dark(
390
- color-mix(in srgb, var(--color-foreground) 5%, var(--color-background)),
391
- color-mix(in srgb, var(--color-foreground) 10%, var(--color-background))
392
- );
393
- --_badge-bg--hover: oklch(from var(--_badge-bg) calc(l - 0.025) c h);
394
- --_badge-bg--active: oklch(from var(--_badge-bg) calc(l - 0.05) c h);
435
+ /* the translucent muted role: fades toward the surface beneath */
436
+ --_badge-bg: var(--color-muted);
437
+ --_badge-bg--hover: oklch(from var(--_badge-bg) l c h / calc(alpha * 0.66));
438
+ --_badge-bg--active: oklch(from var(--_badge-bg) l c h / calc(alpha * 0.33));
395
439
 
396
440
  --_badge-text: var(--color-foreground);
397
441
  --_badge-text--hover: var(--color-foreground);
@@ -400,6 +444,8 @@
400
444
  --_badge-border-color: transparent;
401
445
  --_badge-border-color--hover: transparent;
402
446
  --_badge-border-color--active: transparent;
447
+
448
+ --_badge-shadow: 0 0 transparent;
403
449
  }
404
450
 
405
451
  :where([data-ui~="badge"][data-badge-variant="ghost"]) {
@@ -415,15 +461,14 @@
415
461
  --_badge-border-color: transparent;
416
462
  --_badge-border-color--hover: transparent;
417
463
  --_badge-border-color--active: transparent;
464
+
465
+ --_badge-shadow: 0 0 transparent;
418
466
  }
419
467
 
420
- /* Status variants (info, success, warning, destructive) share one soft
421
- design: the status color mixed 10% (20% in dark) into the page background
422
- as an opaque surface, and
423
- the status hue as the text with its lightness clamped (at most 0.45 in
424
- light, at least 0.82 in dark) so it holds 4.5:1 on the tint and on the
425
- hover and active steps; status-contrast.browser.test.ts checks it. No border. One rule derives the states from the
426
- surface; each variant names only its colors. */
468
+ /* Status variants (info, success, warning, destructive) pair the role's
469
+ surface with its -foreground. No border. One rule derives the states from
470
+ the surface; each variant names only its role. status-contrast.browser.test.ts
471
+ checks 4.5:1 at rest, hover, and active. */
427
472
  :where(
428
473
  [data-ui~="badge"]:is(
429
474
  [data-badge-variant="info"],
@@ -446,51 +491,27 @@
446
491
  }
447
492
 
448
493
  :where([data-ui~="badge"][data-badge-variant="info"]) {
449
- --_badge-ring-color: var(--color-info);
450
- --_badge-bg: light-dark(
451
- color-mix(in srgb, var(--color-info) 10%, var(--color-background)),
452
- color-mix(in srgb, var(--color-info) 20%, var(--color-background))
453
- );
454
- --_badge-text: light-dark(
455
- oklch(from var(--color-info) min(l, 0.45) c h),
456
- oklch(from var(--color-info) max(l, 0.82) c h)
457
- );
494
+ --_badge-ring-color: var(--color-info-foreground);
495
+ --_badge-bg: var(--color-info);
496
+ --_badge-text: var(--color-info-foreground);
458
497
  }
459
498
 
460
499
  :where([data-ui~="badge"][data-badge-variant="success"]) {
461
- --_badge-ring-color: var(--color-success);
462
- --_badge-bg: light-dark(
463
- color-mix(in srgb, var(--color-success) 10%, var(--color-background)),
464
- color-mix(in srgb, var(--color-success) 20%, var(--color-background))
465
- );
466
- --_badge-text: light-dark(
467
- oklch(from var(--color-success) min(l, 0.45) c h),
468
- oklch(from var(--color-success) max(l, 0.82) c h)
469
- );
500
+ --_badge-ring-color: var(--color-success-foreground);
501
+ --_badge-bg: var(--color-success);
502
+ --_badge-text: var(--color-success-foreground);
470
503
  }
471
504
 
472
505
  :where([data-ui~="badge"][data-badge-variant="warning"]) {
473
- --_badge-ring-color: var(--color-warning);
474
- --_badge-bg: light-dark(
475
- color-mix(in srgb, var(--color-warning) 10%, var(--color-background)),
476
- color-mix(in srgb, var(--color-warning) 20%, var(--color-background))
477
- );
478
- --_badge-text: light-dark(
479
- oklch(from var(--color-warning) min(l, 0.45) c h),
480
- oklch(from var(--color-warning) max(l, 0.82) c h)
481
- );
506
+ --_badge-ring-color: var(--color-warning-foreground);
507
+ --_badge-bg: var(--color-warning);
508
+ --_badge-text: var(--color-warning-foreground);
482
509
  }
483
510
 
484
511
  :where([data-ui~="badge"][data-badge-variant="destructive"]) {
485
- --_badge-ring-color: var(--color-destructive);
486
- --_badge-bg: light-dark(
487
- color-mix(in srgb, var(--color-destructive) 10%, var(--color-background)),
488
- color-mix(in srgb, var(--color-destructive) 20%, var(--color-background))
489
- );
490
- --_badge-text: light-dark(
491
- oklch(from var(--color-destructive) min(l, 0.45) c h),
492
- oklch(from var(--color-destructive) max(l, 0.82) c h)
493
- );
512
+ --_badge-ring-color: var(--color-destructive-foreground);
513
+ --_badge-bg: var(--color-destructive);
514
+ --_badge-text: var(--color-destructive-foreground);
494
515
  }
495
516
 
496
517
  :where([data-ui~="badge"][data-badge-variant="link"]) {
@@ -500,12 +521,12 @@
500
521
 
501
522
  --_badge-text: var(--color-foreground);
502
523
  --_badge-text--hover: light-dark(
503
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.4) c h),
504
- oklch(from var(--color-primary) calc(l * 0.6) c h)
524
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.2) c h),
525
+ oklch(from var(--color-primary) calc(l * 0.8) c h)
505
526
  );
506
527
  --_badge-text--active: light-dark(
507
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.5) c h),
508
- oklch(from var(--color-primary) calc(l * 0.5) c h)
528
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.3) c h),
529
+ oklch(from var(--color-primary) calc(l * 0.7) c h)
509
530
  );
510
531
 
511
532
  --_badge-border-style: none;
@@ -14,13 +14,7 @@
14
14
  >
15
15
  <li><a data-ui="button" data-button-variant="link">Home</a></li>
16
16
  <li>
17
- <span
18
- style="
19
- --text: var(--color-muted-foreground);
20
- --opacity: 0.5;
21
- "
22
- >/</span
23
- >
17
+ <span style="--text: var(--color-muted-foreground)">/</span>
24
18
  </li>
25
19
  <li>
26
20
  <div data-ui="button" data-button-variant="link" aria-disabled="true">Product name</div>
@@ -5,6 +5,10 @@
5
5
  * @requires _layers.css, _variables.css, _reset.css, _properties.css (--_*-resolved, --_focus-shadow), fields.css (--ui-field-* metrics), kbd.css (--ui-kbd-*)
6
6
  * @uses color-mix(), oklch(from …) — variant hover/active tints
7
7
  * @uses text-box — vertical trim (patchy browser support)
8
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
9
+ * rounded corners
10
+ * @uses --_touch-min (touch screens) — the default and icon sizes grow to the touch
11
+ * floor; sm and icon-sm keep their box and extend an invisible ::after hit area
8
12
  * @tokens --ui-button-* (@layer variables; hooks are named after the utilities they back; metrics default to the --ui-field-* family)
9
13
  * @consumedby toggle.css, select.css, button-group.css, autocomplete.css, combobox.css,
10
14
  * command.css, lightbox.css, menu.css, navigation-menu.css, popover.css
@@ -14,6 +18,11 @@
14
18
  * The resolver is set by the utilities layer from the element's `style` gate
15
19
  * (inline utilities and their tiers), the private by a variant or size on this
16
20
  * element, and the hook by :root, a subtree, or an inline hook.
21
+ *
22
+ * States step one way and active goes further than hover. Unfilled surfaces (the
23
+ * default, outline, ghost) gain the muted role; filled ones fade toward the page;
24
+ * status surfaces darken. Button and badge resolve the same in every variant
25
+ * (badge-button-parity.browser.test.ts).
17
26
  */
18
27
 
19
28
  @layer variables {
@@ -29,8 +38,8 @@
29
38
  --ui-button-leading: 1;
30
39
 
31
40
  --ui-button-bg: var(--color-background);
32
- --ui-button-bg--hover: oklch(from var(--color-background) calc(l - 0.025) c h);
33
- --ui-button-bg--active: oklch(from var(--color-background) calc(l - 0.05) c h);
41
+ --ui-button-bg--hover: var(--color-muted);
42
+ --ui-button-bg--active: oklch(from var(--ui-button-bg--hover) l c h / calc(alpha * 1.5));
34
43
 
35
44
  --ui-button-text: var(--color-foreground);
36
45
  --ui-button-text--hover: var(--color-foreground);
@@ -47,6 +56,7 @@
47
56
  --ui-button-px: var(--ui-field-px);
48
57
  --ui-button-min-h: var(--ui-field-h);
49
58
  --ui-button-radius: var(--ui-field-radius);
59
+ --ui-button-corner-shape: var(--ui-field-corner-shape);
50
60
  --ui-button-background-clip: padding-box;
51
61
 
52
62
  --ui-button-icon-size: var(--ui-field-icon-size);
@@ -158,6 +168,11 @@
158
168
  inherits: false;
159
169
  }
160
170
 
171
+ @property --_button-corner-shape {
172
+ syntax: "*";
173
+ inherits: false;
174
+ }
175
+
161
176
  @property --_button-background-clip {
162
177
  syntax: "*";
163
178
  inherits: false;
@@ -197,7 +212,12 @@
197
212
 
198
213
  --_min-h-len: var(--_min-h-resolved, var(--_button-min-h, var(--ui-button-min-h)));
199
214
  --_min-h-num: var(--_min-h-resolved, var(--_button-min-h, var(--ui-button-min-h)));
200
- min-block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
215
+ /* the touch floor: 0 on a mouse; a variant or size that must stay small sets it to 0px */
216
+ --_touch-floor: var(--_touch-min);
217
+ min-block-size: max(
218
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
219
+ var(--_touch-floor)
220
+ );
201
221
  min-inline-size: max-content;
202
222
 
203
223
  --_px-len: var(--_px-resolved, var(--_button-px, var(--ui-button-px)));
@@ -221,6 +241,10 @@
221
241
  border-radius: calc(
222
242
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
223
243
  );
244
+ corner-shape: var(
245
+ --_corner-shape-resolved,
246
+ var(--_button-corner-shape, var(--ui-button-corner-shape))
247
+ );
224
248
 
225
249
  color: var(--_text-resolved, var(--_button-text, var(--ui-button-text)));
226
250
  background-color: var(--_bg-resolved, var(--_button-bg, var(--ui-button-bg)));
@@ -313,7 +337,7 @@
313
337
  --decoration-line: none;
314
338
 
315
339
  cursor: default;
316
- opacity: 0.5;
340
+ opacity: 0.6;
317
341
  outline: none;
318
342
  }
319
343
 
@@ -411,13 +435,10 @@
411
435
  }
412
436
 
413
437
  :where([data-ui~="button"][data-button-variant="muted"]) {
414
- /* --color-muted flattened onto the page so the surface stays opaque */
415
- --_button-bg: light-dark(
416
- color-mix(in srgb, var(--color-foreground) 5%, var(--color-background)),
417
- color-mix(in srgb, var(--color-foreground) 10%, var(--color-background))
418
- );
419
- --_button-bg--hover: oklch(from var(--_button-bg) calc(l - 0.025) c h);
420
- --_button-bg--active: oklch(from var(--_button-bg) calc(l - 0.05) c h);
438
+ /* the translucent muted role: fades toward the surface beneath */
439
+ --_button-bg: var(--color-muted);
440
+ --_button-bg--hover: oklch(from var(--_button-bg) l c h / calc(alpha * 0.66));
441
+ --_button-bg--active: oklch(from var(--_button-bg) l c h / calc(alpha * 0.33));
421
442
 
422
443
  --_button-text: var(--color-foreground);
423
444
  --_button-text--hover: var(--color-foreground);
@@ -447,13 +468,10 @@
447
468
  --_button-shadow: 0 0 transparent;
448
469
  }
449
470
 
450
- /* Status variants (info, success, warning, destructive) share one soft
451
- design: the status color mixed 10% (20% in dark) into the page background
452
- as an opaque surface, and
453
- the status hue as the text with its lightness clamped (at most 0.45 in
454
- light, at least 0.82 in dark) so it holds 4.5:1 on the tint and on the
455
- hover and active steps; status-contrast.browser.test.ts checks it. No border. One rule derives the states from the
456
- surface; each variant names only its colors. */
471
+ /* Status variants (info, success, warning, destructive) pair the role's
472
+ surface with its -foreground. No border. One rule derives the states from
473
+ the surface; each variant names only its role. status-contrast.browser.test.ts
474
+ checks 4.5:1 at rest, hover, and active. */
457
475
  :where(
458
476
  [data-ui~="button"]:is(
459
477
  [data-button-variant="info"],
@@ -476,51 +494,27 @@
476
494
  }
477
495
 
478
496
  :where([data-ui~="button"][data-button-variant="info"]) {
479
- --_button-ring-color: var(--color-info);
480
- --_button-bg: light-dark(
481
- color-mix(in srgb, var(--color-info) 10%, var(--color-background)),
482
- color-mix(in srgb, var(--color-info) 20%, var(--color-background))
483
- );
484
- --_button-text: light-dark(
485
- oklch(from var(--color-info) min(l, 0.45) c h),
486
- oklch(from var(--color-info) max(l, 0.82) c h)
487
- );
497
+ --_button-ring-color: var(--color-info-foreground);
498
+ --_button-bg: var(--color-info);
499
+ --_button-text: var(--color-info-foreground);
488
500
  }
489
501
 
490
502
  :where([data-ui~="button"][data-button-variant="success"]) {
491
- --_button-ring-color: var(--color-success);
492
- --_button-bg: light-dark(
493
- color-mix(in srgb, var(--color-success) 10%, var(--color-background)),
494
- color-mix(in srgb, var(--color-success) 20%, var(--color-background))
495
- );
496
- --_button-text: light-dark(
497
- oklch(from var(--color-success) min(l, 0.45) c h),
498
- oklch(from var(--color-success) max(l, 0.82) c h)
499
- );
503
+ --_button-ring-color: var(--color-success-foreground);
504
+ --_button-bg: var(--color-success);
505
+ --_button-text: var(--color-success-foreground);
500
506
  }
501
507
 
502
508
  :where([data-ui~="button"][data-button-variant="warning"]) {
503
- --_button-ring-color: var(--color-warning);
504
- --_button-bg: light-dark(
505
- color-mix(in srgb, var(--color-warning) 10%, var(--color-background)),
506
- color-mix(in srgb, var(--color-warning) 20%, var(--color-background))
507
- );
508
- --_button-text: light-dark(
509
- oklch(from var(--color-warning) min(l, 0.45) c h),
510
- oklch(from var(--color-warning) max(l, 0.82) c h)
511
- );
509
+ --_button-ring-color: var(--color-warning-foreground);
510
+ --_button-bg: var(--color-warning);
511
+ --_button-text: var(--color-warning-foreground);
512
512
  }
513
513
 
514
514
  :where([data-ui~="button"][data-button-variant="destructive"]) {
515
- --_button-ring-color: var(--color-destructive);
516
- --_button-bg: light-dark(
517
- color-mix(in srgb, var(--color-destructive) 10%, var(--color-background)),
518
- color-mix(in srgb, var(--color-destructive) 20%, var(--color-background))
519
- );
520
- --_button-text: light-dark(
521
- oklch(from var(--color-destructive) min(l, 0.45) c h),
522
- oklch(from var(--color-destructive) max(l, 0.82) c h)
523
- );
515
+ --_button-ring-color: var(--color-destructive-foreground);
516
+ --_button-bg: var(--color-destructive);
517
+ --_button-text: var(--color-destructive-foreground);
524
518
  }
525
519
 
526
520
  :where([data-ui~="button"][data-button-variant="link"]) {
@@ -530,12 +524,12 @@
530
524
 
531
525
  --_button-text: var(--color-foreground);
532
526
  --_button-text--hover: light-dark(
533
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.4) c h),
534
- oklch(from var(--color-primary) calc(l * 0.6) c h)
527
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.2) c h),
528
+ oklch(from var(--color-primary) calc(l * 0.8) c h)
535
529
  );
536
530
  --_button-text--active: light-dark(
537
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.5) c h),
538
- oklch(from var(--color-primary) calc(l * 0.5) c h)
531
+ oklch(from var(--color-primary) calc(l + (1 - l) * 0.3) c h),
532
+ oklch(from var(--color-primary) calc(l * 0.7) c h)
539
533
  );
540
534
 
541
535
  --_button-border-style: none;
@@ -543,6 +537,8 @@
543
537
  --_button-min-h: 0;
544
538
  --_button-px: 0;
545
539
  --_button-radius: 0;
540
+ /* inline text: no touch floor (it would break line flow) */
541
+ --_touch-floor: 0px;
546
542
 
547
543
  --_button-shadow: 0 0 transparent;
548
544
  }
@@ -556,6 +552,9 @@
556
552
  --_button-px: calc(var(--spacing) * 2);
557
553
  --_button-radius: var(--radius-sm);
558
554
  --_button-font-size: var(--font-size-xs);
555
+ /* dense by choice: the box stays small and ::after takes the touch floor */
556
+ --_touch-floor: 0px;
557
+ position: relative;
559
558
  }
560
559
 
561
560
  :where(
@@ -565,8 +564,14 @@
565
564
  }
566
565
 
567
566
  :where([data-ui~="button"][data-button-size="icon"]) {
568
- block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
569
- inline-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
567
+ block-size: max(
568
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
569
+ var(--_touch-floor)
570
+ );
571
+ inline-size: max(
572
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
573
+ var(--_touch-floor)
574
+ );
570
575
  padding: 0;
571
576
  aspect-ratio: 1 / 1;
572
577
  }
@@ -577,6 +582,8 @@
577
582
  --_button-radius: var(--radius-sm);
578
583
  /* the hook, not a private: it must inherit to reach the icon */
579
584
  --ui-button-icon-size: calc(var(--spacing) * 3.5);
585
+ --_touch-floor: 0px;
586
+ position: relative;
580
587
 
581
588
  block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
582
589
  inline-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
@@ -584,6 +591,14 @@
584
591
  aspect-ratio: 1 / 1;
585
592
  }
586
593
 
594
+ /* touch: sm and icon-sm keep their box; a transparent ::after centred on the button
595
+ is at least --_touch-min square (it collapses to the box on a mouse) */
596
+ :where([data-ui~="button"]:is([data-button-size="sm"], [data-button-size="icon-sm"]))::after {
597
+ content: "";
598
+ position: absolute;
599
+ inset: min(0px, calc((100% - var(--_touch-min)) / 2));
600
+ }
601
+
587
602
  /* ===========================================================================
588
603
  BUTTON KBD
589
604
  =========================================================================== */
@@ -6,12 +6,15 @@
6
6
  * @uses :not(): first/last edge selection for shared-border collapse
7
7
  * @uses logical border-radius longhands: RTL-safe corner rounding per orientation
8
8
  * @uses flex-item z-index: raise the active control so its border/ring isn't clipped
9
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
10
+ * rounded corners
9
11
  * @tokens --ui-button-group-* (@layer variables; named after the utilities they back)
10
12
  */
11
13
 
12
14
  @layer variables {
13
15
  :root {
14
16
  --ui-button-group-radius: var(--ui-button-radius);
17
+ --ui-button-group-corner-shape: var(--ui-button-corner-shape);
15
18
  --ui-button-group-bg: var(--color-card);
16
19
  }
17
20
  }
@@ -53,6 +56,7 @@
53
56
  border-radius: calc(
54
57
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
55
58
  );
59
+ corner-shape: var(--_corner-shape-resolved, var(--ui-button-group-corner-shape));
56
60
  background-color: var(--_bg-resolved, var(--_button-group-bg, var(--ui-button-group-bg)));
57
61
  position: relative;
58
62
  isolation: isolate;
@@ -3,16 +3,17 @@
3
3
  *
4
4
  * @layer variables, components
5
5
  * @requires _layers.css, _variables.css, _properties.css (--_*-resolved)
6
- * @uses color-mix(), oklch(from …): status tints
6
+ * @uses oklch(from …): faint status borders
7
+ * @uses corner-shape — superellipse corners; unsupported browsers keep plain
8
+ * rounded corners
7
9
  * @tokens --ui-callout-* (@layer variables; named after the utilities they back)
8
- * @see badge.css (status tint and border formulas; the test keeps them in sync)
10
+ * @see badge.css (same status surfaces and text; the test keeps them in sync)
9
11
  * @presets data-callout-variant="muted" | "info" | "success" | "warning" | "destructive"
10
12
  *
11
13
  * A callout is an aside or alert: a padded grid with a gap, a border, and a
12
14
  * radius. The default matches an outline card and muted a muted card. Info,
13
- * success, and warning take the matching badge's tint and border, with the
14
- * role mixed toward --color-foreground for text; destructive is the badge's
15
- * solid fill.
15
+ * success, warning, and destructive use the role's surface and -foreground,
16
+ * like the matching badge, plus a faint border in the -foreground hue.
16
17
  * Every variant keeps the 1px border (muted makes it transparent), so every
17
18
  * variant is the same size.
18
19
  * Its parts are plain elements laid out with utilities. Use <aside> for a
@@ -27,6 +28,7 @@
27
28
  --ui-callout-bg: var(--color-card);
28
29
  --ui-callout-text: var(--color-card-foreground);
29
30
  --ui-callout-radius: var(--radius-md);
31
+ --ui-callout-corner-shape: var(--radius-corner-shape);
30
32
  --ui-callout-shadow: none;
31
33
 
32
34
  --ui-callout-border-width: 1px;
@@ -77,6 +79,7 @@
77
79
  border-radius: calc(
78
80
  var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-multiplier)
79
81
  );
82
+ corner-shape: var(--_corner-shape-resolved, var(--ui-callout-corner-shape));
80
83
  box-shadow: var(--_shadow-resolved, var(--ui-callout-shadow));
81
84
  }
82
85
 
@@ -90,54 +93,30 @@
90
93
  --_callout-border-color: transparent;
91
94
  }
92
95
 
93
- /* status variants: the soft status colors buttons and badges use (see
94
- button.css), plus a faint status border that outlines the block */
96
+ /* status variants: the role's surface and -foreground, as buttons and badges
97
+ use them, plus a faint status border that outlines the block */
95
98
 
96
99
  :where([data-ui~="callout"][data-callout-variant="info"]) {
97
- --_callout-bg: light-dark(
98
- color-mix(in srgb, var(--color-info) 10%, var(--color-background)),
99
- color-mix(in srgb, var(--color-info) 20%, var(--color-background))
100
- );
101
- --_callout-text: light-dark(
102
- oklch(from var(--color-info) min(l, 0.45) c h),
103
- oklch(from var(--color-info) max(l, 0.82) c h)
104
- );
105
- --_callout-border-color: oklch(from var(--color-info) l c h / 0.2);
100
+ --_callout-bg: var(--color-info);
101
+ --_callout-text: var(--color-info-foreground);
102
+ --_callout-border-color: oklch(from var(--color-info-foreground) l c h / 0.2);
106
103
  }
107
104
 
108
105
  :where([data-ui~="callout"][data-callout-variant="success"]) {
109
- --_callout-bg: light-dark(
110
- color-mix(in srgb, var(--color-success) 10%, var(--color-background)),
111
- color-mix(in srgb, var(--color-success) 20%, var(--color-background))
112
- );
113
- --_callout-text: light-dark(
114
- oklch(from var(--color-success) min(l, 0.45) c h),
115
- oklch(from var(--color-success) max(l, 0.82) c h)
116
- );
117
- --_callout-border-color: oklch(from var(--color-success) l c h / 0.2);
106
+ --_callout-bg: var(--color-success);
107
+ --_callout-text: var(--color-success-foreground);
108
+ --_callout-border-color: oklch(from var(--color-success-foreground) l c h / 0.2);
118
109
  }
119
110
 
120
111
  :where([data-ui~="callout"][data-callout-variant="warning"]) {
121
- --_callout-bg: light-dark(
122
- color-mix(in srgb, var(--color-warning) 10%, var(--color-background)),
123
- color-mix(in srgb, var(--color-warning) 20%, var(--color-background))
124
- );
125
- --_callout-text: light-dark(
126
- oklch(from var(--color-warning) min(l, 0.45) c h),
127
- oklch(from var(--color-warning) max(l, 0.82) c h)
128
- );
129
- --_callout-border-color: oklch(from var(--color-warning) l c h / 0.2);
112
+ --_callout-bg: var(--color-warning);
113
+ --_callout-text: var(--color-warning-foreground);
114
+ --_callout-border-color: oklch(from var(--color-warning-foreground) l c h / 0.2);
130
115
  }
131
116
 
132
117
  :where([data-ui~="callout"][data-callout-variant="destructive"]) {
133
- --_callout-bg: light-dark(
134
- color-mix(in srgb, var(--color-destructive) 10%, var(--color-background)),
135
- color-mix(in srgb, var(--color-destructive) 20%, var(--color-background))
136
- );
137
- --_callout-text: light-dark(
138
- oklch(from var(--color-destructive) min(l, 0.45) c h),
139
- oklch(from var(--color-destructive) max(l, 0.82) c h)
140
- );
141
- --_callout-border-color: oklch(from var(--color-destructive) l c h / 0.2);
118
+ --_callout-bg: var(--color-destructive);
119
+ --_callout-text: var(--color-destructive-foreground);
120
+ --_callout-border-color: oklch(from var(--color-destructive-foreground) l c h / 0.2);
142
121
  }
143
122
  }