@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
@@ -1,332 +1,133 @@
1
1
  <div
2
2
  style="
3
3
  --display: grid;
4
- --grid-cols: 2;
5
- --grid-rows: 3;
4
+ --template-cols: repeat(auto-fit, minmax(min(100%, max(14rem, 40%)), 1fr));
6
5
  --gap: 6;
6
+ --w: 100%;
7
7
  "
8
8
  >
9
- <a
10
- href="#"
9
+ <ui-card
10
+ data-card-variant="outline"
11
11
  style="
12
- --display: grid;
13
12
  --row-span: 3;
14
13
  --template-rows: subgrid;
15
- --cursor: pointer;
16
14
  "
17
15
  >
16
+ <figure data-card-slot="header" style="--aspect: 3 / 2">
17
+ <img
18
+ width="600"
19
+ height="400"
20
+ loading="lazy"
21
+ src="https://images.unsplash.com/photo-1564760055775-d63b17a55c44?auto=format&fit=crop&w=600&h=400&q=60"
22
+ alt="Elephants crossing a dusty riverbed"
23
+ style="
24
+ --size: 100%;
25
+ --object-fit: cover;
26
+ "
27
+ />
28
+ </figure>
18
29
  <div
19
- data-ui="card"
30
+ data-card-slot="body"
20
31
  style="
21
- --row-span: 3;
22
- --template-rows: subgrid;
32
+ --display: grid;
33
+ --place-content: start;
34
+ --gap: 2;
23
35
  "
24
36
  >
25
- <figure
26
- style="
27
- --display: grid;
28
- --row-span: 1;
29
- --template-rows: subgrid;
30
- --aspect: 3 / 2;
31
- --radius-t: 2.5;
32
- --overflow: clip;
33
- "
34
- >
35
- <img
36
- width="300"
37
- height="200"
38
- loading="lazy"
39
- src="https://images.unsplash.com/photo-1564760055775-d63b17a55c44?auto=format&fit=crop&w=300&h=200&q=60"
40
- alt="Elephants crossing a dusty riverbed"
41
- style="
42
- --size: 100%;
43
- --opacity: 1;
44
- --opacity--hover: 0.75;
45
- --scale: 1;
46
- --scale--hover: 1.02;
47
- --transition: var(--default-transition);
48
- --object-fit: cover;
49
- "
50
- />
51
- </figure>
52
37
  <div
53
38
  style="
54
- --display: grid;
55
- --row-span: 2;
56
- --template-rows: subgrid;
57
- --px: 4;
58
- --pb: 4;
59
- --gap: 4;
39
+ --display: flex;
40
+ --items: center;
41
+ --gap: 2;
60
42
  "
61
43
  >
62
- <header
63
- style="
64
- --display: grid;
65
- --gap: 2;
66
- "
67
- >
68
- <div
69
- style="
70
- --display: flex;
71
- --items: center;
72
- --gap: 2;
73
- "
74
- >
75
- <span data-ui="badge" data-badge-variant="muted">Research</span>
76
- </div>
77
- <hgroup
78
- style="
79
- --display: grid;
80
- --gap: 2;
81
- "
82
- >
83
- <h3
84
- style="
85
- --font-size: var(--font-size-lg);
86
- --font-family: var(--font-family-heading);
87
- --leading: var(--leading-lg);
88
- --tracking: var(--tracking-lg);
89
- "
90
- >
91
- Migration patterns
92
- </h3>
93
- <p
94
- style="
95
- --font-size: var(--font-size-sm);
96
- --leading: var(--leading-sm);
97
- --tracking: var(--tracking-sm);
98
- --line-clamp: 2;
99
- --text: var(--color-muted-foreground);
100
- "
101
- >
102
- Satellite collars reveal ancient routes herds still follow each dry season across the
103
- floodplain.
104
- </p>
105
- </hgroup>
106
- </header>
107
- <footer
108
- style="
109
- --display: grid;
110
- --justify: start;
111
- --pt: 4;
112
- --gap: 4;
113
- --border-t: 1;
114
- "
115
- >
116
- <div
117
- style="
118
- --display: flex;
119
- --items: center;
120
- --gap: 2;
121
- "
122
- >
123
- <figure
124
- role="img"
125
- style="
126
- --display: grid-pile;
127
- --size: 11;
128
- --border-color: var(--color-border);
129
- --border-width: 1px;
130
- --radius: full;
131
- --overflow: clip;
132
- "
133
- >
134
- <img
135
- width="64"
136
- height="64"
137
- loading="lazy"
138
- src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=facearea&facepad=2&w=64&h=64&q=90"
139
- alt="John Doe"
140
- aria-hidden="true"
141
- style="
142
- --order: 9999;
143
- --size: 100%;
144
- --bg: transparent;
145
- --object-fit: cover;
146
- "
147
- />
148
- <figcaption
149
- style="
150
- --display: flex;
151
- --items: center;
152
- --justify: center;
153
- --order: -9999;
154
- --size: 100%;
155
- --font-size: var(--font-size-md);
156
- --font-weight: strong;
157
- --leading: var(--leading-md);
158
- --tracking: var(--tracking-md);
159
- --text-align: center;
160
- --text: var(--color-primary-foreground);
161
- --bg: var(--color-primary);
162
- "
163
- >
164
- <span style="--sr: only">John Doe</span>
165
- <span aria-hidden="true">JD</span>
166
- </figcaption>
167
- </figure>
168
- <div style="--display: flex-col">
169
- <span
170
- style="
171
- --font-size: var(--font-size-sm);
172
- --font-weight: strong;
173
- --leading: var(--leading-sm);
174
- --leading: 1;
175
- --tracking: var(--tracking-sm);
176
- "
177
- >John Doe</span
178
- >
179
- <span
180
- style="
181
- --font-size: var(--font-size-xs);
182
- --leading: var(--leading-xs);
183
- --tracking: var(--tracking-xs);
184
- --text: var(--color-muted-foreground);
185
- "
186
- >Founder, ACME Inc.</span
187
- >
188
- </div>
189
- </div>
190
- </footer>
44
+ <span data-ui="badge" data-badge-variant="muted">Research</span>
191
45
  </div>
46
+ <h3 data-ui="text-lg">Migration patterns</h3>
47
+ <p data-ui="text-sm" style="--text: var(--color-muted-foreground)">
48
+ Satellite collars reveal ancient routes herds still follow each dry season across the
49
+ floodplain.
50
+ </p>
192
51
  </div>
193
- </a>
194
-
195
- <a
196
- href="#"
52
+ <footer
53
+ data-card-slot="footer"
54
+ style="
55
+ --pt: 4;
56
+ --border-t: 1;
57
+ "
58
+ >
59
+ <a
60
+ href="#"
61
+ data-ui="button"
62
+ data-button-variant="link"
63
+ style="
64
+ --justify: end;
65
+ --text-align: end;
66
+ "
67
+ >Read article &rarr;</a
68
+ >
69
+ </footer>
70
+ </ui-card>
71
+ <ui-card
72
+ data-card-variant="outline"
197
73
  style="
198
- --display: grid;
199
74
  --row-span: 3;
200
75
  --template-rows: subgrid;
201
- --cursor: pointer;
202
76
  "
203
77
  >
78
+ <figure data-card-slot="header" style="--aspect: 3 / 2">
79
+ <img
80
+ width="600"
81
+ height="400"
82
+ loading="lazy"
83
+ src="https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=600&h=400&q=60"
84
+ alt="Zebras grazing at dawn on the savanna"
85
+ style="
86
+ --size: 100%;
87
+ --object-fit: cover;
88
+ "
89
+ />
90
+ </figure>
204
91
  <div
205
- data-ui="card"
92
+ data-card-slot="body"
206
93
  style="
207
- --row-span: 3;
208
- --template-rows: subgrid;
94
+ --display: grid;
95
+ --place-content: start;
96
+ --gap: 2;
209
97
  "
210
98
  >
211
- <figure
212
- style="
213
- --display: grid;
214
- --row-span: 1;
215
- --template-rows: subgrid;
216
- --aspect: 3 / 2;
217
- --radius-t: 2.5;
218
- --overflow: clip;
219
- "
220
- >
221
- <img
222
- width="300"
223
- height="200"
224
- loading="lazy"
225
- src="https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=300&h=200&q=60"
226
- alt="Zebras grazing at dawn on the savanna"
227
- style="
228
- --size: 100%;
229
- --opacity: 1;
230
- --opacity--hover: 0.75;
231
- --scale: 1;
232
- --scale--hover: 1.02;
233
- --transition: var(--default-transition);
234
- --object-fit: cover;
235
- "
236
- />
237
- </figure>
238
99
  <div
239
100
  style="
240
- --display: grid;
241
- --row-span: 2;
242
- --template-rows: subgrid;
243
- --px: 4;
244
- --pb: 4;
245
- --gap: 4;
101
+ --display: flex;
102
+ --items: center;
103
+ --gap: 2;
246
104
  "
247
105
  >
248
- <header
249
- style="
250
- --display: grid;
251
- --gap: 2;
252
- "
253
- >
254
- <div
255
- style="
256
- --display: flex;
257
- --items: center;
258
- --gap: 2;
259
- "
260
- >
261
- <span data-ui="badge" data-badge-variant="muted">Field notes</span>
262
- </div>
263
- <hgroup
264
- style="
265
- --display: grid;
266
- --gap: 2;
267
- "
268
- >
269
- <h3
270
- style="
271
- --font-size: var(--font-size-lg);
272
- --font-family: var(--font-family-heading);
273
- --leading: var(--leading-lg);
274
- --tracking: var(--tracking-lg);
275
- "
276
- >
277
- How quickly zebras jump
278
- </h3>
279
- <p
280
- style="
281
- --font-size: var(--font-size-sm);
282
- --leading: var(--leading-sm);
283
- --tracking: var(--tracking-sm);
284
- --line-clamp: 2;
285
- --text: var(--color-muted-foreground);
286
- "
287
- >
288
- Striped coats and sudden bursts of speed help herds evade predators when the
289
- grasslands go quiet at dusk.
290
- </p>
291
- </hgroup>
292
- </header>
293
- <footer
294
- style="
295
- --display: grid;
296
- --justify: end;
297
- --pt: 4;
298
- --pb: 2;
299
- --gap: 4;
300
- --border-t: 1;
301
- "
302
- >
303
- <div data-ui="button" data-button-variant="link">
304
- Read article
305
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
306
- <rect width="256" height="256" fill="none" />
307
- <line
308
- x1="40"
309
- y1="128"
310
- x2="216"
311
- y2="128"
312
- fill="none"
313
- stroke="currentColor"
314
- stroke-linecap="round"
315
- stroke-linejoin="round"
316
- stroke-width="16"
317
- />
318
- <polyline
319
- points="144 56 216 128 144 200"
320
- fill="none"
321
- stroke="currentColor"
322
- stroke-linecap="round"
323
- stroke-linejoin="round"
324
- stroke-width="16"
325
- />
326
- </svg>
327
- </div>
328
- </footer>
106
+ <span data-ui="badge" data-badge-variant="muted">Field notes</span>
329
107
  </div>
108
+ <h3 data-ui="text-lg">How quickly zebras jump</h3>
109
+ <p data-ui="text-sm" style="--text: var(--color-muted-foreground)">
110
+ Striped coats and sudden bursts of speed help herds evade predators when the grasslands go
111
+ quiet at dusk, long after the light fades from the plain.
112
+ </p>
330
113
  </div>
331
- </a>
114
+ <footer
115
+ data-card-slot="footer"
116
+ style="
117
+ --pt: 4;
118
+ --border-t: 1;
119
+ "
120
+ >
121
+ <a
122
+ href="#"
123
+ data-ui="button"
124
+ data-button-variant="link"
125
+ style="
126
+ --justify: end;
127
+ --text-align: end;
128
+ "
129
+ >Read article &rarr;</a
130
+ >
131
+ </footer>
132
+ </ui-card>
332
133
  </div>
@@ -1,19 +1,39 @@
1
1
  /**
2
- * card.css — Card ([data-ui~="card"])
2
+ * card.css: Card (ui-card | [data-ui~="card"])
3
3
  *
4
4
  * @layer variables, components
5
5
  * @requires _layers.css, _variables.css, _properties.css (--_*-resolved)
6
6
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
7
7
  * rounded corners
8
+ * @uses :has() — a header that holds only media bleeds to the card's edge;
9
+ * a horizontal card needs a header slot
10
+ * @uses @container (width >= 40rem) — a horizontal card lays out in two columns
11
+ * once its nearest container reaches sm, and stacks below that
8
12
  * @tokens --ui-card-* (@layer variables; named after the utilities they back)
9
13
  * @presets data-card-variant="outline" | "muted" | "floating"
14
+ * @presets data-card-orientation="vertical" | "horizontal"
10
15
  *
11
16
  * The card is a surface: a grid with a gap, the card colors, a radius, and
12
17
  * clipped overflow. The default card is bare (no padding, radius, or shadow), so
13
18
  * media can run edge to edge; each variant adds padding, the radius, and one
14
19
  * treatment. Every card keeps a 1px border, transparent unless a variant colors
15
20
  * it, so cards line up whatever their variant.
16
- * Its parts are plain elements laid out with utilities.
21
+ *
22
+ * Its parts are plain elements laid out with utilities, or the slots
23
+ * data-card-slot="header" | "body" | "footer" on direct children. A header that
24
+ * is an img/picture/video, a figure without a figcaption, or an element holding
25
+ * only an img/picture/video bleeds: negative margins pull it over the card's
26
+ * padding to the clipped, rounded edge. The bleed follows --p and --ui-card-p,
27
+ * not the per-side padding utilities.
28
+ *
29
+ * data-card-orientation="horizontal" puts the header in a start column
30
+ * (--ui-card-header-w, default 40%) spanning the rows, with the body above the footer in the
31
+ * end column. It applies when the nearest container is at least sm (40rem) wide,
32
+ * like the --*--sm utilities, and the card stacks below that; give the card's
33
+ * parent --container-type: inline-size to follow the parent's width. Don't make
34
+ * a horizontal card a container itself: its slots would query it, not the parent.
35
+ * Vertical is the default; the attribute only names it.
36
+ *
17
37
  * Every utility-backed declaration reads one chain, highest first:
18
38
  * var(--_<utility>-resolved, var(--_card-<utility>, var(--ui-card-<utility>)))
19
39
  */
@@ -21,6 +41,8 @@
21
41
  @layer variables {
22
42
  :root {
23
43
  /* a bare card has no surface; the outline and floating variants paint --color-card */
44
+ --ui-card-display: grid;
45
+ --ui-card-place-content: start stretch;
24
46
  --ui-card-bg: transparent;
25
47
  --ui-card-text: var(--color-card-foreground);
26
48
  --ui-card-radius: var(--radius-lg);
@@ -34,6 +56,9 @@
34
56
  /* dual-mode: a scale number or a length */
35
57
  --ui-card-gap: var(--space-sm);
36
58
  --ui-card-p: 0;
59
+
60
+ /* horizontal: the header column's width */
61
+ --ui-card-header-w: 40%;
37
62
  }
38
63
  }
39
64
 
@@ -73,15 +98,25 @@
73
98
  inherits: false;
74
99
  }
75
100
 
101
+ /* The resolved padding, inherited so a media header can bleed over it. Every card
102
+ sets its own, so it never carries into a nested card. */
103
+ @property --_card-inset {
104
+ syntax: "*";
105
+ inherits: true;
106
+ }
107
+
76
108
  @layer ui.components {
77
- :where([data-ui~="card"]) {
78
- display: grid;
109
+ :where(ui-card, [data-ui~="card"]) {
110
+ display: var(--ui-card-display);
111
+ place-content: var(--ui-card-place-content);
112
+ grid-template-columns: minmax(0, 1fr);
79
113
  --_gap-len: var(--_gap-resolved, var(--ui-card-gap));
80
114
  --_gap-num: var(--_gap-resolved, var(--ui-card-gap));
81
115
  gap: calc(var(--_gap-len) + var(--_gap-num) * var(--spacing));
82
116
  --_p-len: var(--_p-resolved, var(--_card-p, var(--ui-card-p)));
83
117
  --_p-num: var(--_p-resolved, var(--_card-p, var(--ui-card-p)));
84
- padding: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
118
+ --_card-inset: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
119
+ padding: var(--_card-inset);
85
120
  color: var(--_text-resolved, var(--_card-text, var(--ui-card-text)));
86
121
  background-color: var(--_bg-resolved, var(--_card-bg, var(--ui-card-bg)));
87
122
  border-width: var(
@@ -108,26 +143,171 @@
108
143
  CARD VARIANTS — data-card-variant writes the privates
109
144
  =========================================================================== */
110
145
 
111
- :where([data-ui~="card"]:not([data-card-variant])) {
146
+ :where(ui-card:not([data-card-variant]), [data-ui~="card"]:not([data-card-variant])) {
112
147
  --_card-radius: 0;
113
148
  }
114
149
 
115
- :where([data-ui~="card"][data-card-variant="outline"]) {
150
+ :where(ui-card[data-card-variant="outline"], [data-ui~="card"][data-card-variant="outline"]) {
116
151
  --_card-p: var(--space-md);
117
152
  --_card-border-color: var(--color-border);
118
153
  }
119
154
 
120
- :where([data-ui~="card"][data-card-variant="muted"]) {
155
+ :where(ui-card[data-card-variant="muted"], [data-ui~="card"][data-card-variant="muted"]) {
121
156
  --_card-p: var(--space-md);
122
157
  --_card-bg: var(--color-muted);
123
158
  --_card-text: var(--color-foreground);
124
159
  }
125
160
 
126
- :where([data-ui~="card"][data-card-variant="floating"]) {
161
+ :where(ui-card[data-card-variant="floating"], [data-ui~="card"][data-card-variant="floating"]) {
127
162
  --_card-p: var(--space-md);
128
163
  --_card-bg: var(--color-card);
129
164
  --_card-border-color: var(--color-border);
130
165
  --_card-text: var(--color-card-foreground);
131
166
  --_card-shadow: var(--shadow-sm);
132
167
  }
168
+
169
+ /* ===========================================================================
170
+ CARD SLOTS — header, body, footer on direct children
171
+ =========================================================================== */
172
+
173
+ /* a media header bleeds over the card's padding to its clipped edge */
174
+ :where(
175
+ :is(ui-card, [data-ui~="card"])
176
+ > [data-card-slot~="header"]:is(
177
+ img,
178
+ picture,
179
+ video,
180
+ figure:not(:has(> figcaption)),
181
+ :has(> :is(img, picture, video):only-child)
182
+ )
183
+ ) {
184
+ margin-inline: calc(var(--_card-inset) * -1);
185
+ margin-block-start: calc(var(--_card-inset) * -1);
186
+ }
187
+
188
+ /* ===========================================================================
189
+ CARD ORIENTATION — data-card-orientation; vertical is the default
190
+ =========================================================================== */
191
+
192
+ :where(
193
+ ui-card[data-card-orientation="vertical"],
194
+ [data-ui~="card"][data-card-orientation="vertical"]
195
+ ) {
196
+ grid-template-columns: minmax(0, 1fr);
197
+ }
198
+
199
+ @container (width >= 40rem) {
200
+ :where(
201
+ :is(
202
+ ui-card[data-card-orientation="horizontal"],
203
+ [data-ui~="card"][data-card-orientation="horizontal"]
204
+ ):has(> [data-card-slot~="header"])
205
+ ) {
206
+ grid-template-columns: var(--ui-card-header-w) minmax(0, 1fr);
207
+ grid-template-rows: 1fr auto;
208
+ }
209
+
210
+ :where(
211
+ :is(
212
+ ui-card[data-card-orientation="horizontal"],
213
+ [data-ui~="card"][data-card-orientation="horizontal"]
214
+ ):has(> [data-card-slot~="header"]):not(:has(> [data-card-slot~="footer"]))
215
+ ) {
216
+ grid-template-rows: 1fr;
217
+ }
218
+
219
+ :where(
220
+ :is(
221
+ ui-card[data-card-orientation="horizontal"],
222
+ [data-ui~="card"][data-card-orientation="horizontal"]
223
+ ):has(> [data-card-slot~="header"])
224
+ > [data-card-slot~="header"]
225
+ ) {
226
+ grid-column: 1;
227
+ grid-row: 1 / -1;
228
+ }
229
+
230
+ :where(
231
+ :is(
232
+ ui-card[data-card-orientation="horizontal"],
233
+ [data-ui~="card"][data-card-orientation="horizontal"]
234
+ ):has(> [data-card-slot~="header"])
235
+ > [data-card-slot~="body"]
236
+ ) {
237
+ grid-column: 2;
238
+ grid-row: 1;
239
+ /* the row stretches to the header; keep the body's own rows at the top */
240
+ align-content: start;
241
+ }
242
+
243
+ :where(
244
+ :is(
245
+ ui-card[data-card-orientation="horizontal"],
246
+ [data-ui~="card"][data-card-orientation="horizontal"]
247
+ ):has(> [data-card-slot~="header"])
248
+ > [data-card-slot~="footer"]
249
+ ) {
250
+ grid-column: 2;
251
+ grid-row: 2;
252
+ }
253
+
254
+ /* the media header bleeds on its three outer sides */
255
+ :where(
256
+ :is(
257
+ ui-card[data-card-orientation="horizontal"],
258
+ [data-ui~="card"][data-card-orientation="horizontal"]
259
+ )
260
+ > [data-card-slot~="header"]:is(
261
+ img,
262
+ picture,
263
+ video,
264
+ figure:not(:has(> figcaption)),
265
+ :has(> :is(img, picture, video):only-child)
266
+ )
267
+ ) {
268
+ margin-block: calc(var(--_card-inset) * -1);
269
+ margin-inline-end: 0;
270
+ }
271
+
272
+ /* the media fills the column's height and crops to it. A bare img or video
273
+ is sized to its grid area plus the bleed (WebKit won't stretch a replaced
274
+ grid item), and the media inside a wrapper takes the wrapper's full box */
275
+ :where(
276
+ :is(
277
+ ui-card[data-card-orientation="horizontal"],
278
+ [data-ui~="card"][data-card-orientation="horizontal"]
279
+ )
280
+ > [data-card-slot~="header"]:is(img, video)
281
+ ) {
282
+ inline-size: calc(100% + var(--_card-inset));
283
+ max-inline-size: none;
284
+ block-size: calc(100% + 2 * var(--_card-inset));
285
+ object-fit: cover;
286
+ }
287
+
288
+ :where(
289
+ :is(
290
+ ui-card[data-card-orientation="horizontal"],
291
+ [data-ui~="card"][data-card-orientation="horizontal"]
292
+ )
293
+ > [data-card-slot~="header"]:is(
294
+ picture,
295
+ figure:not(:has(> figcaption)),
296
+ :has(> :is(img, picture, video):only-child)
297
+ )
298
+ > :is(img, video, picture),
299
+ :is(
300
+ ui-card[data-card-orientation="horizontal"],
301
+ [data-ui~="card"][data-card-orientation="horizontal"]
302
+ )
303
+ > [data-card-slot~="header"]
304
+ > picture
305
+ > img
306
+ ) {
307
+ display: block;
308
+ inline-size: 100%;
309
+ block-size: 100%;
310
+ object-fit: cover;
311
+ }
312
+ }
133
313
  }