@zazz-ui/core 0.10.0 → 0.12.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 (89) hide show
  1. package/AUTHORING.md +3 -3
  2. package/CHANGELOG.md +175 -0
  3. package/README.md +2 -2
  4. package/dist/{csp-DR-s45Kg.js → csp-LRx1fynI.js} +1 -1
  5. package/dist/sri.json +53 -53
  6. package/dist/zazz.css +1 -1
  7. package/dist/zazz.js +1 -1
  8. package/editor/zazz.css-data.json +184 -4
  9. package/editor/zazz.html-data.json +32 -0
  10. package/editor/zazz.language-data.json +209 -42
  11. package/editor/zazz.lint-data.json +1750 -1652
  12. package/package.json +5 -4
  13. package/src/base/_defaults.css +8 -2
  14. package/src/base/_properties-2xl.css +2 -0
  15. package/src/base/_properties-lg.css +2 -0
  16. package/src/base/_properties-md.css +2 -0
  17. package/src/base/_properties-sm.css +2 -0
  18. package/src/base/_properties-xl.css +2 -0
  19. package/src/base/_properties.css +6 -0
  20. package/src/base/_shadows.css +28 -28
  21. package/src/base/_utilities-box.css +3 -2
  22. package/src/base/_utilities-effects.css +25 -4
  23. package/src/base/_utilities-tier-2xl.css +1 -0
  24. package/src/base/_utilities-tier-lg.css +1 -0
  25. package/src/base/_utilities-tier-md.css +1 -0
  26. package/src/base/_utilities-tier-sm.css +1 -0
  27. package/src/base/_utilities-tier-xl.css +1 -0
  28. package/src/base/_variables.css +32 -2
  29. package/src/base/csp.d.ts.map +1 -1
  30. package/src/base/csp.js +7 -3
  31. package/src/base/csp.ts +9 -3
  32. package/src/base/kit-styling.d.ts.map +1 -1
  33. package/src/base/kit-styling.js +172 -158
  34. package/src/base/kit-styling.ts +172 -158
  35. package/src/base/utilities.d.ts +4 -1
  36. package/src/base/utilities.d.ts.map +1 -1
  37. package/src/base/utilities.js +28 -1
  38. package/src/base/utilities.ts +33 -2
  39. package/src/base/zazz-element.d.ts +1 -1
  40. package/src/base/zazz-element.js +1 -1
  41. package/src/base/zazz-element.ts +1 -1
  42. package/src/manifest.d.ts +1 -1
  43. package/src/manifest.d.ts.map +1 -1
  44. package/src/manifest.js +10 -2
  45. package/src/manifest.ts +10 -2
  46. package/src/primitives/accordion/accordion.css +61 -12
  47. package/src/primitives/alert-dialog/alert-dialog.html +14 -14
  48. package/src/primitives/badge/badge.css +33 -9
  49. package/src/primitives/button/button.css +57 -16
  50. package/src/primitives/callout/callout.css +2 -0
  51. package/src/primitives/card/card-article.html +115 -0
  52. package/src/primitives/card/card-horizontal.html +83 -0
  53. package/src/primitives/card/card-login.html +56 -0
  54. package/src/primitives/card/card-product.html +78 -0
  55. package/src/primitives/card/card-subgrid.html +96 -295
  56. package/src/primitives/card/card.css +189 -9
  57. package/src/primitives/card/card.html +110 -147
  58. package/src/primitives/carousel/carousel.html +4 -4
  59. package/src/primitives/checkbox/checkbox.css +11 -0
  60. package/src/primitives/combobox/combobox.css +47 -5
  61. package/src/primitives/command/command-dialog.html +109 -107
  62. package/src/primitives/command/command.css +16 -8
  63. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  64. package/src/primitives/debug/audit-core.js +17 -0
  65. package/src/primitives/debug/audit-core.ts +16 -0
  66. package/src/primitives/dialog/dialog.css +94 -40
  67. package/src/primitives/fields/fields.css +2 -0
  68. package/src/primitives/input/input.css +27 -3
  69. package/src/primitives/input-group/input-group.css +15 -5
  70. package/src/primitives/layout/layout.css +2 -0
  71. package/src/primitives/layout/layout.html +8 -11
  72. package/src/primitives/lightbox/lightbox.css +4 -4
  73. package/src/primitives/mobile-menu/mobile-menu.css +17 -16
  74. package/src/primitives/mobile-menu/mobile-menu.html +4 -4
  75. package/src/primitives/navigation-menu/navigation-menu.css +3 -3
  76. package/src/primitives/otp/otp.css +15 -2
  77. package/src/primitives/password-group/password-group.css +18 -5
  78. package/src/primitives/popover/popover.css +23 -10
  79. package/src/primitives/radio/radio.css +14 -2
  80. package/src/primitives/reveal/reveal.html +3 -3
  81. package/src/primitives/scroll-fade/scroll-fade.css +1 -1
  82. package/src/primitives/scroll-fade/scroll-fade.html +8 -12
  83. package/src/primitives/select/select.css +54 -17
  84. package/src/primitives/slider/slider.css +95 -42
  85. package/src/primitives/switch/switch.css +14 -2
  86. package/src/primitives/tabs/tabs.css +11 -2
  87. package/src/primitives/textarea/textarea.css +8 -4
  88. package/src/primitives/toggle/toggle.css +50 -4
  89. package/src/primitives/tooltip/tooltip.css +40 -25
@@ -162,6 +162,9 @@ export interface Utility {
162
162
  * channels, which turn `truncate` and `none` into real `text-wrap` values.
163
163
  * `animation` yields to `--_motion-off`, so reduced motion stops any value.
164
164
  * `divide` is a border between the element's direct children (`divideRules`).
165
+ * `corner-shape` reads its value with a `round` fallback: WebKit drops a registered
166
+ * property substituted into `corner-shape` without one (Safari 27.2), and `round` is
167
+ * the initial value an invalid one would give anyway.
165
168
  */
166
169
  emit?:
167
170
  | "plain"
@@ -177,7 +180,8 @@ export interface Utility {
177
180
  | "direct"
178
181
  | "text-wrap"
179
182
  | "animation"
180
- | "divide";
183
+ | "divide"
184
+ | "corner-shape";
181
185
  /**
182
186
  * What the precedence chain ends in when neither the base nor an active tier
183
187
  * sets the utility: a `px` utility that stands in for a token (`--focus-ring`
@@ -860,6 +864,25 @@ export const UTILITIES: readonly Utility[] = [
860
864
  tiers: "none",
861
865
  })),
862
866
  { name: "bg-stops", properties: [], mode: "raw", family: "color", emit: "none", tiers: "none" },
867
+ // the mask twin of the bg gradients: --mask-linear carries the prelude, --mask-stops
868
+ // the stops (opaque shows, transparent hides); they compose into mask-image. No
869
+ // tiers, like the bg gradients.
870
+ {
871
+ name: "mask-linear",
872
+ properties: [],
873
+ mode: "raw",
874
+ family: "effects",
875
+ emit: "none",
876
+ tiers: "none",
877
+ },
878
+ {
879
+ name: "mask-stops",
880
+ properties: [],
881
+ mode: "raw",
882
+ family: "effects",
883
+ emit: "none",
884
+ tiers: "none",
885
+ },
863
886
  // before the border utilities: a child's own border loads later and wins
864
887
  ...["divide", "divide-x", "divide-y"].map((name) => ({
865
888
  name,
@@ -1090,7 +1113,13 @@ export const UTILITIES: readonly Utility[] = [
1090
1113
  })),
1091
1114
  // the radius rules leave corner-shape to the defaults layer (see generate-utilities.ts);
1092
1115
  // this is the per-element override
1093
- { name: "corner-shape", properties: ["corner-shape"], mode: "raw", family: "box" },
1116
+ {
1117
+ name: "corner-shape",
1118
+ properties: ["corner-shape"],
1119
+ mode: "raw",
1120
+ family: "box",
1121
+ emit: "corner-shape",
1122
+ },
1094
1123
  // visually hidden, in its own layer above every other utility (`srRules`)
1095
1124
  {
1096
1125
  name: "sr",
@@ -1122,12 +1151,14 @@ export const UTILITIES: readonly Utility[] = [
1122
1151
  },
1123
1152
  { name: "outline", pseudo: true, properties: ["outline"], mode: "raw", family: "box" },
1124
1153
  { name: "cursor", properties: ["cursor"], mode: "keyword", family: "box" },
1154
+ // breakpoints: a layer that blocks taps on a phone often passes them through on desktop
1125
1155
  {
1126
1156
  name: "pointer-events",
1127
1157
  pseudo: true,
1128
1158
  properties: ["pointer-events"],
1129
1159
  mode: "keyword",
1130
1160
  family: "box",
1161
+ tiers: "breakpoints",
1131
1162
  },
1132
1163
  { name: "visibility", pseudo: true, properties: ["visibility"], mode: "keyword", family: "box" },
1133
1164
  // states, so a hovered, open, or focused item can sit above its neighbors
@@ -11,7 +11,7 @@
11
11
  * **`defineZazzElement(tag, cls)`** is the registration guard (safe under
12
12
  * double script loads). Only behavioral components register; the CSS-only
13
13
  * tag forms (`ui-tooltip`, `ui-accordion`, `ui-button-group`,
14
- * `ui-toggle-group`) stay unregistered.
14
+ * `ui-toggle-group`, `ui-card`) stay unregistered.
15
15
  *
16
16
  * **The refresh registry** lets navigation.ts re-scan swapped content without
17
17
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
@@ -12,7 +12,7 @@
12
12
  * **`defineZazzElement(tag, cls)`** is the registration guard (safe under
13
13
  * double script loads). Only behavioral components register; the CSS-only
14
14
  * tag forms (`ui-tooltip`, `ui-accordion`, `ui-button-group`,
15
- * `ui-toggle-group`) stay unregistered.
15
+ * `ui-toggle-group`, `ui-card`) stay unregistered.
16
16
  *
17
17
  * **The refresh registry** lets navigation.ts re-scan swapped content without
18
18
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
@@ -13,7 +13,7 @@
13
13
  * **`defineZazzElement(tag, cls)`** is the registration guard (safe under
14
14
  * double script loads). Only behavioral components register; the CSS-only
15
15
  * tag forms (`ui-tooltip`, `ui-accordion`, `ui-button-group`,
16
- * `ui-toggle-group`) stay unregistered.
16
+ * `ui-toggle-group`, `ui-card`) stay unregistered.
17
17
  *
18
18
  * **The refresh registry** lets navigation.ts re-scan swapped content without
19
19
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
package/src/manifest.d.ts CHANGED
@@ -110,7 +110,7 @@ export interface RuntimeFallback {
110
110
  * CLI that knows the gate; an older CLI ignores the list.
111
111
  */
112
112
  export declare const CORE_FALLBACKS: RuntimeFallback[];
113
- /** Every tag form in the kit; the generator excludes them from no-base emissions. */
113
+ /** Every tag form in the kit; the generator keeps them out of the grid place-content default, as it does `[data-ui]`. */
114
114
  export declare const TAG_FORMS: string[];
115
115
  export declare const CSS_CASCADE_ORDER: string[];
116
116
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAIlC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,qDAAqD;IACrD,EAAE,EAAE,MAAM,EAAE,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,uDAAuD;IACvD,QAAQ,EAA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CAC7C;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC;AAEF,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;OAIG;IACH,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,EAE3C,CAAC;AAEF,yHAAyH;AACzH,eAAO,MAAM,SAAS,EAAE,MAAM,EAErB,CAAC;AAEV,eAAO,MAAM,iBAAiB,EAAE,MAAM,EA2CrC,CAAC;AAIF;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAoBxD;AAID,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,GACb,KAAK,GACL,UAAU,GACV,MAAM,GACN,SAAS,CAAC;AAEd;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAmC/E,CAAC"}
package/src/manifest.js CHANGED
@@ -128,12 +128,20 @@ export const PRIMITIVES = {
128
128
  examples: ["primitives/callout/callout.html"],
129
129
  },
130
130
  card: {
131
+ tags: ["ui-card"],
131
132
  css: ["primitives/card/card.css"],
132
133
  js: [],
133
134
  base: [],
134
135
  primitives: [],
135
136
  bare: [],
136
- examples: ["primitives/card/card.html", "primitives/card/card-subgrid.html"],
137
+ examples: [
138
+ "primitives/card/card.html",
139
+ "primitives/card/card-horizontal.html",
140
+ "primitives/card/card-product.html",
141
+ "primitives/card/card-login.html",
142
+ "primitives/card/card-article.html",
143
+ "primitives/card/card-subgrid.html",
144
+ ],
137
145
  },
138
146
  carousel: {
139
147
  tags: ["ui-carousel"],
@@ -644,7 +652,7 @@ export const CORE_POLYFILLS = [
644
652
  export const CORE_FALLBACKS = [
645
653
  { file: "base/csp.js", requires: ["base/declarations.js"], gate: "blocked-inline-styles" },
646
654
  ];
647
- /** Every tag form in the kit; the generator excludes them from no-base emissions. */
655
+ /** Every tag form in the kit; the generator keeps them out of the grid place-content default, as it does `[data-ui]`. */
648
656
  export const TAG_FORMS = Object.values(PRIMITIVES)
649
657
  .flatMap((entry) => entry.tags ?? [])
650
658
  .sort();
package/src/manifest.ts CHANGED
@@ -164,12 +164,20 @@ export const PRIMITIVES: Record<string, PrimitiveEntry> = {
164
164
  examples: ["primitives/callout/callout.html"],
165
165
  },
166
166
  card: {
167
+ tags: ["ui-card"],
167
168
  css: ["primitives/card/card.css"],
168
169
  js: [],
169
170
  base: [],
170
171
  primitives: [],
171
172
  bare: [],
172
- examples: ["primitives/card/card.html", "primitives/card/card-subgrid.html"],
173
+ examples: [
174
+ "primitives/card/card.html",
175
+ "primitives/card/card-horizontal.html",
176
+ "primitives/card/card-product.html",
177
+ "primitives/card/card-login.html",
178
+ "primitives/card/card-article.html",
179
+ "primitives/card/card-subgrid.html",
180
+ ],
173
181
  },
174
182
  carousel: {
175
183
  tags: ["ui-carousel"],
@@ -709,7 +717,7 @@ export const CORE_FALLBACKS: RuntimeFallback[] = [
709
717
  { file: "base/csp.js", requires: ["base/declarations.js"], gate: "blocked-inline-styles" },
710
718
  ];
711
719
 
712
- /** Every tag form in the kit; the generator excludes them from no-base emissions. */
720
+ /** Every tag form in the kit; the generator keeps them out of the grid place-content default, as it does `[data-ui]`. */
713
721
  export const TAG_FORMS: string[] = Object.values(PRIMITIVES)
714
722
  .flatMap((entry) => entry.tags ?? [])
715
723
  .sort();
@@ -3,15 +3,45 @@
3
3
  * slot data-accordion-slot="marker" on the summary icon that rotates open)
4
4
  *
5
5
  * @layer variables, reset, components
6
- * @requires _layers.css, _variables.css, _properties.css (--_focus-shadow)
6
+ * @requires _layers.css, _variables.css, _properties.css (--_*-resolved, --_focus-shadow)
7
7
  * @uses ::details-content: native open/close block-size transition (reset layer)
8
+ * @uses --_touch-min (touch screens): the summary row grows to the touch floor
8
9
  * @uses interpolate-size: allow-keywords (from _variables.css; required for
9
10
  * block-size: 0 -> auto transitions)
10
- * @tokens --ui-accordion-* (@layer variables; none backs a utility)
11
+ * @tokens --ui-accordion-* (@layer variables; named after the utilities they back)
12
+ *
13
+ * The accordion is a column of native <details> items. Its parts are the item
14
+ * (each <details>), the summary (the row that toggles it), and the marker slot
15
+ * on the summary icon. The root, item, and summary read every layout
16
+ * declaration from a hook behind the matching utility, so
17
+ * --ui-accordion-summary-justify re-skins every summary and
18
+ * style="--justify: start" retunes one. A summary that is a button keeps the
19
+ * button's min height and touch padding.
11
20
  */
12
21
 
13
22
  @layer variables {
14
23
  :root {
24
+ /* root: a column of items that fills its flex parent */
25
+ --ui-accordion-display: flex;
26
+ --ui-accordion-flex-direction: column;
27
+ --ui-accordion-flex: 1;
28
+ /* dual-mode: a scale number or a length */
29
+ --ui-accordion-w: 100%;
30
+
31
+ /* item: each <details> */
32
+ --ui-accordion-item-display: flex;
33
+ --ui-accordion-item-flex-direction: column;
34
+ --ui-accordion-item-flex: 1 0 auto;
35
+
36
+ /* summary: the toggling row; its padding sits on the item in the example
37
+ fragment, so on touch the row itself takes the floor */
38
+ --ui-accordion-summary-display: flex;
39
+ --ui-accordion-summary-items: center;
40
+ --ui-accordion-summary-justify: space-between;
41
+ /* dual-mode: a scale number or a length; the touch floor is applied on top */
42
+ --ui-accordion-summary-min-h: 0;
43
+
44
+ /* marker: the summary icon */
15
45
  --ui-accordion-icon-size: calc(var(--spacing) * 4);
16
46
  --ui-accordion-icon-transform--open: rotate(-180deg);
17
47
  }
@@ -23,7 +53,7 @@
23
53
  =========================================================================== */
24
54
 
25
55
  :where(details)::details-content {
26
- --details-content-transition:
56
+ --_details-content-transition:
27
57
  opacity var(--default-transition-duration) var(--default-transition-timing-function),
28
58
  transform var(--default-transition-duration) var(--default-transition-timing-function),
29
59
  block-size var(--default-transition-duration) var(--default-transition-timing-function),
@@ -32,7 +62,7 @@
32
62
 
33
63
  block-size: 0;
34
64
  overflow: hidden;
35
- transition: var(--details-content-transition);
65
+ transition: var(--_details-content-transition);
36
66
  will-change: opacity, transform, block-size, content-visibility;
37
67
  }
38
68
 
@@ -50,20 +80,24 @@
50
80
 
51
81
  @layer ui.components {
52
82
  :where(ui-accordion, [data-ui~="accordion"]) {
53
- display: grid;
54
- inline-size: 100%;
55
- flex: 1;
83
+ display: var(--_display-resolved, var(--ui-accordion-display));
84
+ flex-direction: var(--_flex-direction-resolved, var(--ui-accordion-flex-direction));
85
+ flex: var(--_flex-resolved, var(--ui-accordion-flex));
86
+ --_w-len: var(--_w-resolved, var(--ui-accordion-w));
87
+ --_w-num: var(--_w-resolved, var(--ui-accordion-w));
88
+ inline-size: calc(var(--_w-len) + var(--_w-num) * var(--spacing));
56
89
  }
57
90
 
58
91
  :where(ui-accordion, [data-ui~="accordion"]) > details {
59
- display: grid;
60
- flex: 1 0 auto;
92
+ display: var(--_display-resolved, var(--ui-accordion-item-display));
93
+ flex-direction: var(--_flex-direction-resolved, var(--ui-accordion-item-flex-direction));
94
+ flex: var(--_flex-resolved, var(--ui-accordion-item-flex));
61
95
  }
62
96
 
63
97
  :where(ui-accordion, [data-ui~="accordion"]) > details > summary {
64
- display: flex;
65
- align-items: center;
66
- justify-content: space-between;
98
+ display: var(--_display-resolved, var(--ui-accordion-summary-display));
99
+ align-items: var(--_items-resolved, var(--ui-accordion-summary-items));
100
+ justify-content: var(--_justify-resolved, var(--ui-accordion-summary-justify));
67
101
 
68
102
  /* The ring is published to --_focus-shadow so a --shadow utility on the
69
103
  summary keeps it; the ring widths grow from 0 so the ring eases in. */
@@ -89,6 +123,21 @@
89
123
  transition: var(--default-transition);
90
124
  }
91
125
 
126
+ /* A summary that is a button keeps the button's own floor and touch padding,
127
+ which read the same --_min-h-len/-num pair; this rule would overwrite them.
128
+ :where(:not()) keeps the specificity of the rule above. */
129
+ :where(ui-accordion, [data-ui~="accordion"])
130
+ > details
131
+ > summary:where(:not([data-ui~="button"])) {
132
+ --_min-h-len: var(--_min-h-resolved, var(--ui-accordion-summary-min-h));
133
+ --_min-h-num: var(--_min-h-resolved, var(--ui-accordion-summary-min-h));
134
+ /* the touch floor (0 on a mouse) sits under whatever the hook or utility asks for */
135
+ min-block-size: max(
136
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
137
+ var(--_touch-min)
138
+ );
139
+ }
140
+
92
141
  :where(ui-accordion, [data-ui~="accordion"]) > details > summary:focus-visible {
93
142
  --_ring-offset-width: var(--ring-offset-width);
94
143
  --_ring-width: abs(var(--_focus-ring-w, var(--ring-width)));
@@ -49,19 +49,19 @@
49
49
  dialog by clicking outside the dialog or pressing the Escape key.
50
50
  </p>
51
51
  </div>
52
+ <footer data-dialog-slot="footer">
53
+ <button data-ui="button" type="button" commandfor="alert-dialog-example-1" command="close">
54
+ Cancel
55
+ </button>
56
+ <button
57
+ data-ui="button"
58
+ data-button-variant="destructive"
59
+ type="button"
60
+ commandfor="alert-dialog-example-1"
61
+ command="close"
62
+ >
63
+ Delete account
64
+ </button>
65
+ </footer>
52
66
  </div>
53
- <footer data-dialog-slot="footer">
54
- <button data-ui="button" type="button" commandfor="alert-dialog-example-1" command="close">
55
- Cancel
56
- </button>
57
- <button
58
- data-ui="button"
59
- data-button-variant="destructive"
60
- type="button"
61
- commandfor="alert-dialog-example-1"
62
- command="close"
63
- >
64
- Delete account
65
- </button>
66
- </footer>
67
67
  </dialog>
@@ -5,6 +5,8 @@
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
8
10
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
9
11
  * rounded corners
10
12
  * @tokens --ui-badge-* (@layer variables; hooks are named after the utilities they back)
@@ -46,6 +48,10 @@
46
48
 
47
49
  /* dual-mode: a scale number or a length */
48
50
  --ui-badge-gap: var(--spacing);
51
+ /* smaller than --ui-field-py: in a browser without text-box trim, the full line,
52
+ this, and the border still fit the default height (to
53
+ within a fraction of a pixel at the smallest fluid --spacing) */
54
+ --ui-badge-py: calc(var(--spacing) * 0.75);
49
55
  --ui-badge-px: calc(var(--spacing) * 1.25);
50
56
  --ui-badge-h: calc(var(--spacing) * 5);
51
57
  --ui-badge-radius: var(--radius-sm);
@@ -145,6 +151,11 @@
145
151
  inherits: false;
146
152
  }
147
153
 
154
+ @property --_badge-py {
155
+ syntax: "*";
156
+ inherits: false;
157
+ }
158
+
148
159
  @property --_badge-px {
149
160
  syntax: "*";
150
161
  inherits: false;
@@ -199,9 +210,16 @@
199
210
 
200
211
  --_h-len: var(--_h-resolved, var(--_badge-h, var(--ui-badge-h)));
201
212
  --_h-num: var(--_h-resolved, var(--_badge-h, var(--ui-badge-h)));
202
- block-size: calc(var(--_h-len) + var(--_h-num) * var(--spacing));
213
+ /* --h is a floor: the label plus --ui-badge-py on each side can outgrow it at a
214
+ small --spacing. fit-content, not auto, so a flex row never stretches it. */
215
+ block-size: fit-content;
216
+ min-block-size: calc(var(--_h-len) + var(--_h-num) * var(--spacing));
203
217
  min-inline-size: max-content;
204
218
 
219
+ --_py-len: var(--_py-resolved, var(--_badge-py, var(--ui-badge-py)));
220
+ --_py-num: var(--_py-resolved, var(--_badge-py, var(--ui-badge-py)));
221
+ padding-block: calc(var(--_py-len) + var(--_py-num) * var(--spacing));
222
+
205
223
  --_px-len: var(--_px-resolved, var(--_badge-px, var(--ui-badge-px)));
206
224
  --_px-num: var(--_px-resolved, var(--_badge-px, var(--ui-badge-px)));
207
225
  padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing));
@@ -281,6 +299,18 @@
281
299
  BADGE STATES — interactive badges only (button, a[href])
282
300
  =========================================================================== */
283
301
 
302
+ /* touch: the badge keeps its box; a transparent ::after centred on it is at least
303
+ --_touch-min square (it collapses to the box on a mouse) */
304
+ :where([data-ui~="badge"]):is(button, a[href]) {
305
+ position: relative;
306
+ }
307
+
308
+ :where([data-ui~="badge"]:is(button, a[href]))::after {
309
+ content: "";
310
+ position: absolute;
311
+ inset: min(0px, calc((100% - var(--_touch-min)) / 2));
312
+ }
313
+
284
314
  @media (hover: hover) {
285
315
  :where([data-ui~="badge"]):is(button, a[href]):hover:not(:disabled, [aria-disabled="true"]) {
286
316
  color: var(--_text-resolved, var(--_badge-text--hover, var(--ui-badge-text--hover)));
@@ -506,14 +536,8 @@
506
536
  --_badge-bg--active: transparent;
507
537
 
508
538
  --_badge-text: var(--color-foreground);
509
- --_badge-text--hover: light-dark(
510
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.2) c h),
511
- oklch(from var(--color-primary) calc(l * 0.8) c h)
512
- );
513
- --_badge-text--active: light-dark(
514
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.3) c h),
515
- oklch(from var(--color-primary) calc(l * 0.7) c h)
516
- );
539
+ --_badge-text--hover: var(--color-muted-foreground);
540
+ --_badge-text--active: var(--color-muted-foreground);
517
541
 
518
542
  --_badge-border-style: none;
519
543
 
@@ -7,6 +7,9 @@
7
7
  * @uses text-box — vertical trim (patchy browser support)
8
8
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
9
9
  * rounded corners
10
+ * @uses --_touch-min (touch screens) — the default and icon sizes grow to the touch
11
+ * floor, and each inline side gains half of what the height grew; sm and
12
+ * icon-sm keep their box and extend an invisible ::after hit area
10
13
  * @tokens --ui-button-* (@layer variables; hooks are named after the utilities they back; metrics default to the --ui-field-* family)
11
14
  * @consumedby toggle.css, select.css, button-group.css, autocomplete.css, combobox.css,
12
15
  * command.css, lightbox.css, menu.css, navigation-menu.css, popover.css
@@ -51,6 +54,7 @@
51
54
 
52
55
  /* dual-mode: a scale number or a length */
53
56
  --ui-button-gap: var(--spacing);
57
+ --ui-button-py: var(--ui-field-py);
54
58
  --ui-button-px: var(--ui-field-px);
55
59
  --ui-button-min-h: var(--ui-field-h);
56
60
  --ui-button-radius: var(--ui-field-radius);
@@ -151,6 +155,11 @@
151
155
  inherits: false;
152
156
  }
153
157
 
158
+ @property --_button-py {
159
+ syntax: "*";
160
+ inherits: false;
161
+ }
162
+
154
163
  @property --_button-px {
155
164
  syntax: "*";
156
165
  inherits: false;
@@ -210,12 +219,27 @@
210
219
 
211
220
  --_min-h-len: var(--_min-h-resolved, var(--_button-min-h, var(--ui-button-min-h)));
212
221
  --_min-h-num: var(--_min-h-resolved, var(--_button-min-h, var(--ui-button-min-h)));
213
- min-block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
222
+ /* the touch floor: 0 on a mouse; a variant or size that must stay small sets it to 0px */
223
+ --_touch-floor: var(--_touch-min);
224
+ min-block-size: max(
225
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
226
+ var(--_touch-floor)
227
+ );
214
228
  min-inline-size: max-content;
215
229
 
230
+ --_py-len: var(--_py-resolved, var(--_button-py, var(--ui-button-py)));
231
+ --_py-num: var(--_py-resolved, var(--_button-py, var(--ui-button-py)));
232
+ padding-block: calc(var(--_py-len) + var(--_py-num) * var(--spacing));
233
+
216
234
  --_px-len: var(--_px-resolved, var(--_button-px, var(--ui-button-px)));
217
235
  --_px-num: var(--_px-resolved, var(--_button-px, var(--ui-button-px)));
218
- padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing));
236
+ /* each inline side gains half of what the touch floor added to the height, so the
237
+ label's margins grow evenly; the kbd ends below add it too */
238
+ --_touch-px: max(
239
+ 0px,
240
+ (var(--_touch-floor) - calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing))) / 2
241
+ );
242
+ padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing) + var(--_touch-px));
219
243
 
220
244
  border-width: var(
221
245
  --_border-width-resolved,
@@ -516,20 +540,16 @@
516
540
  --_button-bg--active: transparent;
517
541
 
518
542
  --_button-text: var(--color-foreground);
519
- --_button-text--hover: light-dark(
520
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.2) c h),
521
- oklch(from var(--color-primary) calc(l * 0.8) c h)
522
- );
523
- --_button-text--active: light-dark(
524
- oklch(from var(--color-primary) calc(l + (1 - l) * 0.3) c h),
525
- oklch(from var(--color-primary) calc(l * 0.7) c h)
526
- );
543
+ --_button-text--hover: var(--color-muted-foreground);
544
+ --_button-text--active: var(--color-muted-foreground);
527
545
 
528
546
  --_button-border-style: none;
529
547
 
530
548
  --_button-min-h: 0;
531
549
  --_button-px: 0;
532
550
  --_button-radius: 0;
551
+ /* inline text: no touch floor (it would break line flow) */
552
+ --_touch-floor: 0px;
533
553
 
534
554
  --_button-shadow: 0 0 transparent;
535
555
  }
@@ -540,9 +560,14 @@
540
560
 
541
561
  :where([data-ui~="button"][data-button-size="sm"]) {
542
562
  --_button-min-h: calc(var(--spacing) * 6);
563
+ /* a 16px icon, this, and the border fit the 24px box */
564
+ --_button-py: calc(var(--spacing) * 0.75);
543
565
  --_button-px: calc(var(--spacing) * 2);
544
566
  --_button-radius: var(--radius-sm);
545
567
  --_button-font-size: var(--font-size-xs);
568
+ /* dense by choice: the box stays small and ::after takes the touch floor */
569
+ --_touch-floor: 0px;
570
+ position: relative;
546
571
  }
547
572
 
548
573
  :where(
@@ -552,8 +577,14 @@
552
577
  }
553
578
 
554
579
  :where([data-ui~="button"][data-button-size="icon"]) {
555
- block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
556
- inline-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
580
+ block-size: max(
581
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
582
+ var(--_touch-floor)
583
+ );
584
+ inline-size: max(
585
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
586
+ var(--_touch-floor)
587
+ );
557
588
  padding: 0;
558
589
  aspect-ratio: 1 / 1;
559
590
  }
@@ -564,6 +595,8 @@
564
595
  --_button-radius: var(--radius-sm);
565
596
  /* the hook, not a private: it must inherit to reach the icon */
566
597
  --ui-button-icon-size: calc(var(--spacing) * 3.5);
598
+ --_touch-floor: 0px;
599
+ position: relative;
567
600
 
568
601
  block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
569
602
  inline-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
@@ -571,6 +604,14 @@
571
604
  aspect-ratio: 1 / 1;
572
605
  }
573
606
 
607
+ /* touch: sm and icon-sm keep their box; a transparent ::after centred on the button
608
+ is at least --_touch-min square (it collapses to the box on a mouse) */
609
+ :where([data-ui~="button"]:is([data-button-size="sm"], [data-button-size="icon-sm"]))::after {
610
+ content: "";
611
+ position: absolute;
612
+ inset: min(0px, calc((100% - var(--_touch-min)) / 2));
613
+ }
614
+
574
615
  /* ===========================================================================
575
616
  BUTTON KBD
576
617
  =========================================================================== */
@@ -585,24 +626,24 @@
585
626
  :where([data-ui~="button"]):has(
586
627
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):last-child:not(:only-child)
587
628
  ) {
588
- padding-inline-end: calc(var(--spacing) * 1.5);
629
+ padding-inline-end: calc(var(--spacing) * 1.5 + var(--_touch-px));
589
630
  }
590
631
 
591
632
  :where([data-ui~="button"]):has(
592
633
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):first-child:not(:only-child)
593
634
  ) {
594
- padding-inline-start: calc(var(--spacing) * 1.5);
635
+ padding-inline-start: calc(var(--spacing) * 1.5 + var(--_touch-px));
595
636
  }
596
637
 
597
638
  :where([data-ui~="button"][data-button-size="sm"]):has(
598
639
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):last-child:not(:only-child)
599
640
  ) {
600
- padding-inline-end: calc(var(--spacing) * 0.5);
641
+ padding-inline-end: calc(var(--spacing) * 0.5 + var(--_touch-px));
601
642
  }
602
643
 
603
644
  :where([data-ui~="button"][data-button-size="sm"]):has(
604
645
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):first-child:not(:only-child)
605
646
  ) {
606
- padding-inline-start: calc(var(--spacing) * 0.5);
647
+ padding-inline-start: calc(var(--spacing) * 0.5 + var(--_touch-px));
607
648
  }
608
649
  }
@@ -60,6 +60,8 @@
60
60
  @layer ui.components {
61
61
  :where([data-ui~="callout"]) {
62
62
  display: grid;
63
+ /* rows stay together at the top when a row of callouts stretches this one */
64
+ align-content: start;
63
65
  --_gap-len: var(--_gap-resolved, var(--ui-callout-gap));
64
66
  --_gap-num: var(--_gap-resolved, var(--ui-callout-gap));
65
67
  gap: calc(var(--_gap-len) + var(--_gap-num) * var(--spacing));