@zazz-ui/core 0.11.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 (79) hide show
  1. package/AUTHORING.md +3 -3
  2. package/CHANGELOG.md +120 -0
  3. package/README.md +2 -2
  4. package/dist/{csp-DR-s45Kg.js → csp-LRx1fynI.js} +1 -1
  5. package/dist/sri.json +46 -46
  6. package/dist/zazz.css +1 -1
  7. package/dist/zazz.js +1 -1
  8. package/editor/zazz.css-data.json +175 -3
  9. package/editor/zazz.html-data.json +32 -0
  10. package/editor/zazz.language-data.json +165 -32
  11. package/editor/zazz.lint-data.json +1691 -1612
  12. package/package.json +5 -4
  13. package/src/base/_defaults.css +6 -0
  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 +16 -11
  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 +170 -158
  34. package/src/base/kit-styling.ts +170 -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 +60 -14
  47. package/src/primitives/badge/badge.css +19 -9
  48. package/src/primitives/button/button.css +27 -14
  49. package/src/primitives/callout/callout.css +2 -0
  50. package/src/primitives/card/card-article.html +115 -0
  51. package/src/primitives/card/card-horizontal.html +83 -0
  52. package/src/primitives/card/card-login.html +56 -0
  53. package/src/primitives/card/card-product.html +78 -0
  54. package/src/primitives/card/card-subgrid.html +96 -295
  55. package/src/primitives/card/card.css +189 -9
  56. package/src/primitives/card/card.html +110 -147
  57. package/src/primitives/carousel/carousel.html +4 -4
  58. package/src/primitives/checkbox/checkbox.css +2 -0
  59. package/src/primitives/combobox/combobox.css +32 -6
  60. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  61. package/src/primitives/debug/audit-core.js +17 -0
  62. package/src/primitives/debug/audit-core.ts +16 -0
  63. package/src/primitives/dialog/dialog.css +2 -0
  64. package/src/primitives/fields/fields.css +2 -0
  65. package/src/primitives/input/input.css +27 -4
  66. package/src/primitives/input-group/input-group.css +9 -3
  67. package/src/primitives/layout/layout.css +2 -0
  68. package/src/primitives/layout/layout.html +8 -11
  69. package/src/primitives/otp/otp.css +14 -2
  70. package/src/primitives/password-group/password-group.css +12 -3
  71. package/src/primitives/radio/radio.css +2 -0
  72. package/src/primitives/reveal/reveal.html +3 -3
  73. package/src/primitives/scroll-fade/scroll-fade.html +8 -12
  74. package/src/primitives/select/select.css +30 -6
  75. package/src/primitives/slider/slider.css +94 -44
  76. package/src/primitives/switch/switch.css +3 -2
  77. package/src/primitives/tabs/tabs.css +10 -2
  78. package/src/primitives/textarea/textarea.css +8 -4
  79. package/src/primitives/toggle/toggle.css +24 -2
@@ -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,EAAE,MAAM,EAAE,CAAC;IACnB,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAgBD;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAwfrD,CAAC;AAIF;;;;;;GAMG;AACH;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,EAQhC,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,MAAM,EA4CjC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO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AO,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,16 +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
8
  * @uses --_touch-min (touch screens): the summary row grows to the touch floor
9
9
  * @uses interpolate-size: allow-keywords (from _variables.css; required for
10
10
  * block-size: 0 -> auto transitions)
11
- * @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.
12
20
  */
13
21
 
14
22
  @layer variables {
15
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 */
16
45
  --ui-accordion-icon-size: calc(var(--spacing) * 4);
17
46
  --ui-accordion-icon-transform--open: rotate(-180deg);
18
47
  }
@@ -24,7 +53,7 @@
24
53
  =========================================================================== */
25
54
 
26
55
  :where(details)::details-content {
27
- --details-content-transition:
56
+ --_details-content-transition:
28
57
  opacity var(--default-transition-duration) var(--default-transition-timing-function),
29
58
  transform var(--default-transition-duration) var(--default-transition-timing-function),
30
59
  block-size var(--default-transition-duration) var(--default-transition-timing-function),
@@ -33,7 +62,7 @@
33
62
 
34
63
  block-size: 0;
35
64
  overflow: hidden;
36
- transition: var(--details-content-transition);
65
+ transition: var(--_details-content-transition);
37
66
  will-change: opacity, transform, block-size, content-visibility;
38
67
  }
39
68
 
@@ -51,22 +80,24 @@
51
80
 
52
81
  @layer ui.components {
53
82
  :where(ui-accordion, [data-ui~="accordion"]) {
54
- display: grid;
55
- inline-size: 100%;
56
- 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));
57
89
  }
58
90
 
59
91
  :where(ui-accordion, [data-ui~="accordion"]) > details {
60
- display: grid;
61
- 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));
62
95
  }
63
96
 
64
97
  :where(ui-accordion, [data-ui~="accordion"]) > details > summary {
65
- display: flex;
66
- align-items: center;
67
- justify-content: space-between;
68
- /* the padding sits on <details>, so on touch the row itself takes the floor */
69
- min-block-size: var(--_touch-min);
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));
70
101
 
71
102
  /* The ring is published to --_focus-shadow so a --shadow utility on the
72
103
  summary keeps it; the ring widths grow from 0 so the ring eases in. */
@@ -92,6 +123,21 @@
92
123
  transition: var(--default-transition);
93
124
  }
94
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
+
95
141
  :where(ui-accordion, [data-ui~="accordion"]) > details > summary:focus-visible {
96
142
  --_ring-offset-width: var(--ring-offset-width);
97
143
  --_ring-width: abs(var(--_focus-ring-w, var(--ring-width)));
@@ -48,6 +48,10 @@
48
48
 
49
49
  /* dual-mode: a scale number or a length */
50
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);
51
55
  --ui-badge-px: calc(var(--spacing) * 1.25);
52
56
  --ui-badge-h: calc(var(--spacing) * 5);
53
57
  --ui-badge-radius: var(--radius-sm);
@@ -147,6 +151,11 @@
147
151
  inherits: false;
148
152
  }
149
153
 
154
+ @property --_badge-py {
155
+ syntax: "*";
156
+ inherits: false;
157
+ }
158
+
150
159
  @property --_badge-px {
151
160
  syntax: "*";
152
161
  inherits: false;
@@ -201,9 +210,16 @@
201
210
 
202
211
  --_h-len: var(--_h-resolved, var(--_badge-h, var(--ui-badge-h)));
203
212
  --_h-num: var(--_h-resolved, var(--_badge-h, var(--ui-badge-h)));
204
- 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));
205
217
  min-inline-size: max-content;
206
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
+
207
223
  --_px-len: var(--_px-resolved, var(--_badge-px, var(--ui-badge-px)));
208
224
  --_px-num: var(--_px-resolved, var(--_badge-px, var(--ui-badge-px)));
209
225
  padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing));
@@ -520,14 +536,8 @@
520
536
  --_badge-bg--active: transparent;
521
537
 
522
538
  --_badge-text: var(--color-foreground);
523
- --_badge-text--hover: light-dark(
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)
526
- );
527
- --_badge-text--active: light-dark(
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)
530
- );
539
+ --_badge-text--hover: var(--color-muted-foreground);
540
+ --_badge-text--active: var(--color-muted-foreground);
531
541
 
532
542
  --_badge-border-style: none;
533
543
 
@@ -8,7 +8,8 @@
8
8
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
9
9
  * rounded corners
10
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
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
12
13
  * @tokens --ui-button-* (@layer variables; hooks are named after the utilities they back; metrics default to the --ui-field-* family)
13
14
  * @consumedby toggle.css, select.css, button-group.css, autocomplete.css, combobox.css,
14
15
  * command.css, lightbox.css, menu.css, navigation-menu.css, popover.css
@@ -53,6 +54,7 @@
53
54
 
54
55
  /* dual-mode: a scale number or a length */
55
56
  --ui-button-gap: var(--spacing);
57
+ --ui-button-py: var(--ui-field-py);
56
58
  --ui-button-px: var(--ui-field-px);
57
59
  --ui-button-min-h: var(--ui-field-h);
58
60
  --ui-button-radius: var(--ui-field-radius);
@@ -153,6 +155,11 @@
153
155
  inherits: false;
154
156
  }
155
157
 
158
+ @property --_button-py {
159
+ syntax: "*";
160
+ inherits: false;
161
+ }
162
+
156
163
  @property --_button-px {
157
164
  syntax: "*";
158
165
  inherits: false;
@@ -220,9 +227,19 @@
220
227
  );
221
228
  min-inline-size: max-content;
222
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
+
223
234
  --_px-len: var(--_px-resolved, var(--_button-px, var(--ui-button-px)));
224
235
  --_px-num: var(--_px-resolved, var(--_button-px, var(--ui-button-px)));
225
- 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));
226
243
 
227
244
  border-width: var(
228
245
  --_border-width-resolved,
@@ -523,14 +540,8 @@
523
540
  --_button-bg--active: transparent;
524
541
 
525
542
  --_button-text: var(--color-foreground);
526
- --_button-text--hover: light-dark(
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)
529
- );
530
- --_button-text--active: light-dark(
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)
533
- );
543
+ --_button-text--hover: var(--color-muted-foreground);
544
+ --_button-text--active: var(--color-muted-foreground);
534
545
 
535
546
  --_button-border-style: none;
536
547
 
@@ -549,6 +560,8 @@
549
560
 
550
561
  :where([data-ui~="button"][data-button-size="sm"]) {
551
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);
552
565
  --_button-px: calc(var(--spacing) * 2);
553
566
  --_button-radius: var(--radius-sm);
554
567
  --_button-font-size: var(--font-size-xs);
@@ -613,24 +626,24 @@
613
626
  :where([data-ui~="button"]):has(
614
627
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):last-child:not(:only-child)
615
628
  ) {
616
- padding-inline-end: calc(var(--spacing) * 1.5);
629
+ padding-inline-end: calc(var(--spacing) * 1.5 + var(--_touch-px));
617
630
  }
618
631
 
619
632
  :where([data-ui~="button"]):has(
620
633
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):first-child:not(:only-child)
621
634
  ) {
622
- padding-inline-start: calc(var(--spacing) * 1.5);
635
+ padding-inline-start: calc(var(--spacing) * 1.5 + var(--_touch-px));
623
636
  }
624
637
 
625
638
  :where([data-ui~="button"][data-button-size="sm"]):has(
626
639
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):last-child:not(:only-child)
627
640
  ) {
628
- padding-inline-end: calc(var(--spacing) * 0.5);
641
+ padding-inline-end: calc(var(--spacing) * 0.5 + var(--_touch-px));
629
642
  }
630
643
 
631
644
  :where([data-ui~="button"][data-button-size="sm"]):has(
632
645
  > :where(kbd, ui-kbd-group, [data-ui~="kbd-group"]):first-child:not(:only-child)
633
646
  ) {
634
- padding-inline-start: calc(var(--spacing) * 0.5);
647
+ padding-inline-start: calc(var(--spacing) * 0.5 + var(--_touch-px));
635
648
  }
636
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));
@@ -0,0 +1,115 @@
1
+ <article data-ui="card" data-card-variant="floating" style="--max-w: 96">
2
+ <figure data-card-slot="header" style="--aspect: 3 / 2">
3
+ <img
4
+ width="600"
5
+ height="400"
6
+ loading="lazy"
7
+ src="https://images.unsplash.com/photo-1564760055775-d63b17a55c44?auto=format&fit=crop&w=600&h=400&q=60"
8
+ alt="Elephants crossing a dusty riverbed"
9
+ style="
10
+ --size: 100%;
11
+ --opacity: 1;
12
+ --opacity--hover: 0.75;
13
+ --scale: 1;
14
+ --scale--hover: 1.02;
15
+ --transition: var(--default-transition);
16
+ --object-fit: cover;
17
+ "
18
+ />
19
+ </figure>
20
+ <div
21
+ data-card-slot="body"
22
+ style="
23
+ --display: grid;
24
+ --gap: 2;
25
+ "
26
+ >
27
+ <div
28
+ style="
29
+ --display: flex;
30
+ --items: center;
31
+ --gap: 2;
32
+ "
33
+ >
34
+ <span data-ui="badge" data-badge-variant="muted">Research</span>
35
+ </div>
36
+ <hgroup
37
+ style="
38
+ --display: grid;
39
+ --gap: 2;
40
+ "
41
+ >
42
+ <h3 data-ui="text-lg">
43
+ <a href="#">Migration patterns</a>
44
+ </h3>
45
+ <p
46
+ data-ui="text-sm"
47
+ style="
48
+ --line-clamp: 2;
49
+ --text: var(--color-muted-foreground);
50
+ "
51
+ >
52
+ Satellite collars reveal ancient routes herds still follow each dry season across the
53
+ floodplain.
54
+ </p>
55
+ </hgroup>
56
+ </div>
57
+ <footer
58
+ data-card-slot="footer"
59
+ style="
60
+ --display: flex;
61
+ --items: center;
62
+ --pt: 4;
63
+ --gap: 2;
64
+ --border-t: 1;
65
+ "
66
+ >
67
+ <figure
68
+ role="img"
69
+ style="
70
+ --display: grid-pile;
71
+ --size: 11;
72
+ --border-color: var(--color-border);
73
+ --border-width: 1px;
74
+ --radius: full;
75
+ --overflow: clip;
76
+ "
77
+ >
78
+ <img
79
+ width="64"
80
+ height="64"
81
+ loading="lazy"
82
+ src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=facearea&facepad=2&w=64&h=64&q=90"
83
+ alt="John Doe"
84
+ aria-hidden="true"
85
+ style="
86
+ --order: 9999;
87
+ --size: 100%;
88
+ --bg: transparent;
89
+ --object-fit: cover;
90
+ "
91
+ />
92
+ <figcaption
93
+ style="
94
+ --display: flex;
95
+ --items: center;
96
+ --justify: center;
97
+ --order: -9999;
98
+ --size: 100%;
99
+ --font-weight: strong;
100
+ --text: var(--color-primary-foreground);
101
+ --bg: var(--color-primary);
102
+ "
103
+ >
104
+ <span style="--sr: only">John Doe</span>
105
+ <span aria-hidden="true">JD</span>
106
+ </figcaption>
107
+ </figure>
108
+ <div style="--display: flex-col">
109
+ <span data-ui="text-sm" style="--font-weight: strong">John Doe</span>
110
+ <span data-ui="text-xs" style="--text: var(--color-muted-foreground)"
111
+ >Founder, ACME Inc.</span
112
+ >
113
+ </div>
114
+ </footer>
115
+ </article>