@zazz-ui/core 0.11.0 → 0.12.1

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 (83) hide show
  1. package/AUTHORING.md +3 -3
  2. package/CHANGELOG.md +147 -0
  3. package/README.md +3 -3
  4. package/dist/{csp-DR-s45Kg.js → csp-LRx1fynI.js} +1 -1
  5. package/dist/sri.json +48 -48
  6. package/dist/zazz.css +1 -1
  7. package/dist/zazz.js +1 -1
  8. package/editor/zazz.css-data.json +493 -3
  9. package/editor/zazz.html-data.json +32 -0
  10. package/editor/zazz.language-data.json +218 -85
  11. package/editor/zazz.lint-data.json +1743 -1659
  12. package/package.json +5 -4
  13. package/src/base/_defaults.css +7 -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 +9 -0
  20. package/src/base/_shadows.css +28 -28
  21. package/src/base/_utilities-box.css +13 -32
  22. package/src/base/_utilities-color.css +10 -12
  23. package/src/base/_utilities-effects.css +21 -4
  24. package/src/base/_utilities-tier-2xl.css +1 -0
  25. package/src/base/_utilities-tier-lg.css +1 -0
  26. package/src/base/_utilities-tier-md.css +1 -0
  27. package/src/base/_utilities-tier-sm.css +1 -0
  28. package/src/base/_utilities-tier-xl.css +1 -0
  29. package/src/base/_variables.css +35 -29
  30. package/src/base/csp.d.ts.map +1 -1
  31. package/src/base/csp.js +7 -3
  32. package/src/base/csp.ts +9 -3
  33. package/src/base/kit-styling.d.ts.map +1 -1
  34. package/src/base/kit-styling.js +171 -158
  35. package/src/base/kit-styling.ts +171 -158
  36. package/src/base/navigation.d.ts.map +1 -1
  37. package/src/base/navigation.js +5 -1
  38. package/src/base/navigation.ts +5 -1
  39. package/src/base/utilities.d.ts +4 -1
  40. package/src/base/utilities.d.ts.map +1 -1
  41. package/src/base/utilities.js +37 -1
  42. package/src/base/utilities.ts +42 -2
  43. package/src/base/zazz-element.d.ts +1 -1
  44. package/src/base/zazz-element.js +1 -1
  45. package/src/base/zazz-element.ts +1 -1
  46. package/src/manifest.d.ts +1 -1
  47. package/src/manifest.d.ts.map +1 -1
  48. package/src/manifest.js +10 -2
  49. package/src/manifest.ts +10 -2
  50. package/src/primitives/accordion/accordion.css +60 -14
  51. package/src/primitives/badge/badge.css +20 -10
  52. package/src/primitives/button/button.css +28 -15
  53. package/src/primitives/callout/callout.css +2 -0
  54. package/src/primitives/card/card-article.html +115 -0
  55. package/src/primitives/card/card-horizontal.html +83 -0
  56. package/src/primitives/card/card-login.html +56 -0
  57. package/src/primitives/card/card-product.html +78 -0
  58. package/src/primitives/card/card-subgrid.html +96 -295
  59. package/src/primitives/card/card.css +190 -9
  60. package/src/primitives/card/card.html +110 -147
  61. package/src/primitives/carousel/carousel.html +4 -4
  62. package/src/primitives/checkbox/checkbox.css +2 -0
  63. package/src/primitives/combobox/combobox.css +32 -6
  64. package/src/primitives/debug/audit-core.d.ts.map +1 -1
  65. package/src/primitives/debug/audit-core.js +17 -0
  66. package/src/primitives/debug/audit-core.ts +16 -0
  67. package/src/primitives/dialog/dialog.css +2 -0
  68. package/src/primitives/fields/fields.css +2 -0
  69. package/src/primitives/input/input.css +27 -4
  70. package/src/primitives/input-group/input-group.css +9 -3
  71. package/src/primitives/layout/layout.css +2 -0
  72. package/src/primitives/layout/layout.html +8 -11
  73. package/src/primitives/otp/otp.css +14 -2
  74. package/src/primitives/password-group/password-group.css +12 -3
  75. package/src/primitives/radio/radio.css +2 -0
  76. package/src/primitives/reveal/reveal.html +3 -3
  77. package/src/primitives/scroll-fade/scroll-fade.html +8 -12
  78. package/src/primitives/select/select.css +30 -6
  79. package/src/primitives/slider/slider.css +94 -44
  80. package/src/primitives/switch/switch.css +3 -2
  81. package/src/primitives/tabs/tabs.css +11 -3
  82. package/src/primitives/textarea/textarea.css +8 -4
  83. package/src/primitives/toggle/toggle.css +24 -2
@@ -5,7 +5,8 @@
5
5
  * @requires _layers.css, _variables.css, fields.css, input.css,
6
6
  * button.css
7
7
  * @uses :focus-within, :has: shell focus ring and padding (as input-group.css)
8
- * @uses --_touch-min (touch screens): the shell and its addons grow to the touch floor
8
+ * @uses --_touch-min (touch screens): the shell and its addons grow to the touch floor,
9
+ * and the input's inline sides gain half of what the height grew
9
10
  * @uses aria-pressed on toggle — show/hide icon swap via CSS (JS sets type +
10
11
  * aria in password-group.ts)
11
12
  * @uses Native reveal suppressed in _reset.css (::-ms-reveal, etc.)
@@ -63,6 +64,11 @@
63
64
  calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
64
65
  var(--_touch-min)
65
66
  );
67
+ /* half of what the floor added to the shell's height; inherits to the input inside */
68
+ --_group-touch-px: max(
69
+ 0px,
70
+ (var(--_touch-min) - calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing))) / 2
71
+ );
66
72
  --_p-len: var(--_p-resolved, var(--ui-password-group-p));
67
73
  --_p-num: var(--_p-resolved, var(--ui-password-group-p));
68
74
  padding: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
@@ -137,6 +143,9 @@
137
143
 
138
144
  :where([data-ui~="password-group"]) [data-ui~="input"] {
139
145
  block-size: 100%;
146
+ /* 100% replaces input.css's height floor, so restore it here (the shell
147
+ carries the border; the --_py pair comes from input.css) */
148
+ min-block-size: calc(1lh + 2 * (var(--_py-len) + var(--_py-num) * var(--spacing)));
140
149
  padding-inline: 0;
141
150
  }
142
151
 
@@ -149,14 +158,14 @@
149
158
  )
150
159
  )
151
160
  [data-ui~="input"] {
152
- padding-inline-start: var(--ui-field-px);
161
+ padding-inline-start: calc(var(--ui-field-px) + var(--_group-touch-px));
153
162
  }
154
163
 
155
164
  :where([data-ui~="password-group"]):not(
156
165
  :has([data-password-group-slot~="addon"][data-password-group-align="inline-end"])
157
166
  )
158
167
  [data-ui~="input"] {
159
- padding-inline-end: var(--ui-field-px);
168
+ padding-inline-end: calc(var(--ui-field-px) + var(--_group-touch-px));
160
169
  }
161
170
 
162
171
  /* A textarea claims the full width; addons stack above/below via block-* */
@@ -45,6 +45,8 @@
45
45
  --_size-num: var(--_size-resolved, var(--ui-radio-size));
46
46
  inline-size: calc(var(--_size-len) + var(--_size-num) * var(--spacing));
47
47
  block-size: calc(var(--_size-len) + var(--_size-num) * var(--spacing));
48
+ min-inline-size: var(--spacing-control-min);
49
+ min-block-size: var(--spacing-control-min);
48
50
 
49
51
  background-color: var(--_bg-resolved, var(--ui-radio-bg));
50
52
 
@@ -9,7 +9,7 @@
9
9
  --w: 100%;
10
10
  "
11
11
  >
12
- <div data-ui="card" data-card-variant="muted" style="--p: 6">Arrives first</div>
13
- <div data-ui="card" data-card-variant="muted" style="--p: 6">Then this one</div>
14
- <div data-ui="card" data-card-variant="muted" style="--p: 6">Then the last</div>
12
+ <ui-card data-card-variant="muted" style="--p: 6">Arrives first</ui-card>
13
+ <ui-card data-card-variant="muted" style="--p: 6">Then this one</ui-card>
14
+ <ui-card data-card-variant="muted" style="--p: 6">Then the last</ui-card>
15
15
  </div>
@@ -29,41 +29,37 @@
29
29
  --overflow-x: auto;
30
30
  "
31
31
  >
32
- <div
33
- data-ui="card"
32
+ <ui-card
34
33
  style="
35
34
  --p: 4;
36
35
  --min-w: 60;
37
36
  "
38
37
  >
39
38
  one
40
- </div>
41
- <div
42
- data-ui="card"
39
+ </ui-card>
40
+ <ui-card
43
41
  style="
44
42
  --p: 4;
45
43
  --min-w: 60;
46
44
  "
47
45
  >
48
46
  two
49
- </div>
50
- <div
51
- data-ui="card"
47
+ </ui-card>
48
+ <ui-card
52
49
  style="
53
50
  --p: 4;
54
51
  --min-w: 60;
55
52
  "
56
53
  >
57
54
  three
58
- </div>
59
- <div
60
- data-ui="card"
55
+ </ui-card>
56
+ <ui-card
61
57
  style="
62
58
  --p: 4;
63
59
  --min-w: 60;
64
60
  "
65
61
  >
66
62
  four
67
- </div>
63
+ </ui-card>
68
64
  </div>
69
65
  </div>
@@ -13,7 +13,8 @@
13
13
  * @uses ui-multiselect (multiselect.ts): JS-projected dropdown for
14
14
  * <select multiple> (base-select has no stable multi-select);
15
15
  * degrades to the native multi listbox without JS
16
- * @uses --_touch-min (touch screens) — the trigger and every option row grow to the touch floor
16
+ * @uses --_touch-min (touch screens) — the trigger and every option row grow to the touch
17
+ * floor; the trigger's inline sides each gain half of what its height grew
17
18
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
18
19
  * rounded corners
19
20
  * @tokens --ui-select-* (@layer variables); picker panel reuses --ui-popover-* (owned in popover.css)
@@ -29,6 +30,7 @@
29
30
  --ui-select-pl: var(--ui-field-px);
30
31
  /* room for the picker icon */
31
32
  --ui-select-pr: calc(var(--spacing) * 2);
33
+ --ui-select-py: var(--ui-field-py);
32
34
  --ui-select-font-size: var(--ui-field-font-size);
33
35
  --ui-select-leading: var(--ui-field-leading);
34
36
  --ui-select-border-width: var(--ui-field-border-width);
@@ -52,6 +54,7 @@
52
54
  --ui-option-leading: var(--ui-button-leading);
53
55
  --ui-option-gap: var(--ui-button-gap);
54
56
  --ui-option-px: var(--ui-button-px);
57
+ --ui-option-py: var(--ui-button-py);
55
58
  --ui-option-min-h: var(--ui-button-min-h);
56
59
  --ui-option-icon-size: var(--ui-button-icon-size);
57
60
  --ui-option-radius: var(--ui-menu-button-radius);
@@ -171,13 +174,31 @@
171
174
  min-inline-size: calc(var(--_min-w-len) + var(--_min-w-num) * var(--spacing));
172
175
  --_h-len: var(--_h-resolved, var(--ui-field-h));
173
176
  --_h-num: var(--_h-resolved, var(--ui-field-h));
174
- block-size: max(calc(var(--_h-len) + var(--_h-num) * var(--spacing)), var(--_touch-min));
177
+ /* never shorter than one line plus --ui-select-py and the border above and below (see input.css) */
178
+ --_py-len: var(--_py-resolved, var(--ui-select-py));
179
+ --_py-num: var(--_py-resolved, var(--ui-select-py));
180
+ block-size: max(
181
+ calc(var(--_h-len) + var(--_h-num) * var(--spacing)),
182
+ var(--_touch-min),
183
+ calc(
184
+ 1lh + 2 *
185
+ (
186
+ var(--_py-len) + var(--_py-num) * var(--spacing) +
187
+ var(--_border-width-resolved, var(--ui-select-border-width))
188
+ )
189
+ )
190
+ );
191
+ /* half of what the touch floor added to the height, on each inline side */
192
+ --_touch-px: max(
193
+ 0px,
194
+ (var(--_touch-min) - calc(var(--_h-len) + var(--_h-num) * var(--spacing))) / 2
195
+ );
175
196
  --_pl-len: var(--_pl-resolved, var(--ui-select-pl));
176
197
  --_pl-num: var(--_pl-resolved, var(--ui-select-pl));
177
- padding-inline-start: calc(var(--_pl-len) + var(--_pl-num) * var(--spacing));
198
+ padding-inline-start: calc(var(--_pl-len) + var(--_pl-num) * var(--spacing) + var(--_touch-px));
178
199
  --_pr-len: var(--_pr-resolved, var(--ui-select-pr));
179
200
  --_pr-num: var(--_pr-resolved, var(--ui-select-pr));
180
- padding-inline-end: calc(var(--_pr-len) + var(--_pr-num) * var(--spacing));
201
+ padding-inline-end: calc(var(--_pr-len) + var(--_pr-num) * var(--spacing) + var(--_touch-px));
181
202
 
182
203
  font-size: var(--_font-size-resolved, var(--ui-select-font-size));
183
204
  line-height: var(--_leading-resolved, var(--ui-select-leading));
@@ -311,13 +332,15 @@
311
332
  }
312
333
  }
313
334
 
314
- /* Like [data-ui~="button"], sizing rides on min-block-size + padding-inline
315
- (no block padding) so every row is uniform. */
335
+ /* Like [data-ui~="button"], sizing rides on min-block-size + padding-inline, so
336
+ every row is uniform; --ui-option-py only shows once a small --spacing drops
337
+ the min height below the label. */
316
338
  :where([data-ui~="select"]) option {
317
339
  display: flex;
318
340
  align-items: center;
319
341
  gap: var(--ui-option-gap);
320
342
  min-block-size: max(var(--ui-option-min-h), var(--_touch-min));
343
+ padding-block: var(--ui-option-py);
321
344
  padding-inline: var(--ui-option-px);
322
345
 
323
346
  font-family: var(--ui-option-font-family);
@@ -448,6 +471,7 @@
448
471
  align-items: center;
449
472
  gap: var(--ui-option-gap);
450
473
  min-block-size: max(var(--ui-option-min-h), var(--_touch-min));
474
+ padding-block: var(--ui-option-py);
451
475
  padding-inline: var(--ui-option-px);
452
476
 
453
477
  font-family: var(--ui-option-font-family);
@@ -4,10 +4,15 @@
4
4
  * @layer variables, reset
5
5
  * @requires _layers.css, _variables.css
6
6
  * @uses appearance: none — redraws track + thumb from theme tokens
7
- * @uses --_touch-min (touch screens) — the transparent input grows to the touch
8
- * floor; the track stays --ui-slider-track-h and the thumb centred on it
7
+ * @uses --_touch-min (touch screens): the transparent input grows to the touch floor
8
+ * and so does the thumb's box, through a transparent border, while the visible
9
+ * thumb keeps its size. A thumb can't have an ::after, so on touch screens its
10
+ * border and ring draw inset, it loses its drop shadow, and the visible thumb
11
+ * stops a border's width short of each track end.
12
+ * @uses sign(): switches the ring inset once the thumb has a hit border
9
13
  * @uses corner-shape — round by default, so circles stay circles; a hook takes any shape
10
- * @tokens --ui-slider-* (@layer variables, on :root so subtree hooks work)
14
+ * @tokens --ui-slider-* (@layer variables, on :root so subtree hooks work); the thumb
15
+ * and track sizes floor at --spacing-control-min
11
16
  *
12
17
  * Note: The active region is NOT filled (parity across engines); add a paint
13
18
  * via JS if a filled track is needed. The thumb is centered on the track with a
@@ -18,25 +23,56 @@
18
23
  :root {
19
24
  --ui-slider-ring-color: var(--color-ring);
20
25
 
21
- --ui-slider-track-h: calc(var(--spacing) * 1.5);
26
+ --ui-slider-track-h: max(calc(var(--spacing) * 1.5), calc(var(--spacing-control-min) * 0.375));
22
27
  --ui-slider-track-bg: var(--color-muted);
23
- --ui-slider-track-border: 1px solid var(--color-muted);
28
+ --ui-slider-track-border-width: 1px;
29
+ --ui-slider-track-border-color: var(--color-muted);
24
30
  --ui-slider-track-radius: var(--radius-full);
25
31
  --ui-slider-track-corner-shape: round;
26
- --ui-slider-thumb-size: calc(var(--spacing) * 4);
32
+ --ui-slider-thumb-size: max(calc(var(--spacing) * 4), var(--spacing-control-min));
27
33
  --ui-slider-thumb-bg: var(--color-background);
28
34
 
35
+ /* composes into the thumb's box-shadow list with its border and ring: use a
36
+ transparent shadow, never `none` */
29
37
  --ui-slider-thumb-shadow: var(--shadow-xs);
30
- --ui-slider-thumb-border: 1px solid var(--color-border);
38
+ --ui-slider-thumb-border-width: 1px;
39
+ --ui-slider-thumb-border-color: var(--color-border);
31
40
  --ui-slider-thumb-radius: var(--radius-full);
32
41
  --ui-slider-thumb-corner-shape: round;
33
42
  }
34
43
  }
35
44
 
45
+ /* Thumb plumbing, set on the input and inherited by the thumb pseudo-elements */
46
+ @property --_slider-thumb-hit {
47
+ syntax: "*";
48
+ inherits: true;
49
+ }
50
+ @property --_slider-thumb-in {
51
+ syntax: "*";
52
+ inherits: true;
53
+ }
54
+ @property --_slider-thumb-drop {
55
+ syntax: "*";
56
+ inherits: true;
57
+ }
58
+
36
59
  @layer reset {
37
60
  :where(input[type="range"]) {
38
- /* derived on the element so a subtree --ui-slider-track-h keeps the thumb centered */
39
- --ui-slider-thumb-offset: calc(var(--ui-slider-track-h) * -1);
61
+ /* the transparent border that grows the thumb's box to the touch floor; 0 on a mouse */
62
+ --_slider-thumb-hit: max(0px, (var(--_touch-min) - var(--ui-slider-thumb-size)) / 2);
63
+ /* 1 once the thumb has a hit border: the ring then draws inside the visible thumb */
64
+ --_slider-thumb-in: sign(var(--_slider-thumb-hit));
65
+ --_slider-thumb-drop: var(--ui-slider-thumb-shadow);
66
+ /* derived on the element so a subtree hook keeps the thumb centered on the track */
67
+ --ui-slider-thumb-offset: calc(
68
+ (var(--ui-slider-track-h) - var(--ui-slider-thumb-size)) / 2 - var(--_slider-thumb-hit) -
69
+ var(--ui-slider-track-border-width)
70
+ );
71
+
72
+ /* the ring widths grow from 0 on focus and press, so the ring eases in */
73
+ --_ring-offset-width: 0px;
74
+ --_ring-width: 0px;
75
+ --_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
40
76
 
41
77
  -webkit-appearance: none;
42
78
  appearance: none;
@@ -48,16 +84,22 @@
48
84
  corner-shape: var(--ui-slider-track-corner-shape);
49
85
 
50
86
  /* transparent outline keeps focus visible in forced-colors / high-contrast
51
- modes; the visible focus ring lives on the thumb via --shadow-ring */
87
+ modes; the visible focus ring lives on the thumb */
52
88
  outline: var(--outline-width) var(--outline-style) transparent;
53
89
  outline-offset: var(--outline-offset);
54
90
  }
55
91
 
92
+ /* An outer shadow would paint at the edge of the grown thumb box, not the visible thumb */
93
+ @media (not (hover: hover)) {
94
+ :where(input[type="range"]) {
95
+ --_slider-thumb-drop: 0 0 transparent;
96
+ }
97
+ }
56
98
  :where(input[type="range"])::-webkit-slider-runnable-track {
57
99
  block-size: var(--ui-slider-track-h);
58
100
  inline-size: 100%;
59
101
  background: var(--ui-slider-track-bg);
60
- border: var(--ui-slider-track-border);
102
+ border: var(--ui-slider-track-border-width) solid var(--ui-slider-track-border-color);
61
103
  border-radius: var(--ui-slider-track-radius);
62
104
  corner-shape: var(--ui-slider-track-corner-shape);
63
105
  }
@@ -66,74 +108,82 @@
66
108
  block-size: var(--ui-slider-track-h);
67
109
  inline-size: 100%;
68
110
  background: var(--ui-slider-track-bg);
69
- border: var(--ui-slider-track-border);
111
+ border: var(--ui-slider-track-border-width) solid var(--ui-slider-track-border-color);
70
112
  border-radius: var(--ui-slider-track-radius);
71
113
  corner-shape: var(--ui-slider-track-corner-shape);
72
114
  }
73
115
 
74
116
  :where(input[type="range"])::-webkit-slider-thumb {
75
- /* the ring is a box-shadow so it composes with --ui-slider-thumb-shadow;
76
- widths animate from 0 so it grows in on focus */
77
- --_ring-offset-width: 0px;
78
- --_ring-width: 0px;
79
- --_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
80
- box-shadow:
81
- 0 0 0 var(--_ring-offset-width) var(--ring-offset-shadow-color),
82
- 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width))
83
- var(--_ring-fill, var(--ring-shadow-color)),
84
- var(--ui-slider-thumb-shadow);
85
-
86
117
  -webkit-appearance: none;
87
118
  appearance: none;
88
119
  margin-block-start: var(--ui-slider-thumb-offset);
120
+ box-sizing: content-box;
89
121
  inline-size: var(--ui-slider-thumb-size);
90
122
  block-size: var(--ui-slider-thumb-size);
123
+ /* the padding box is the visible thumb; the transparent border is the extra hit area */
124
+ border: var(--_slider-thumb-hit) solid transparent;
91
125
  background-color: var(--ui-slider-thumb-bg);
92
- border: var(--ui-slider-thumb-border);
93
- border-radius: var(--ui-slider-thumb-radius);
126
+ background-clip: padding-box;
127
+ border-radius: calc(var(--ui-slider-thumb-radius) + var(--_slider-thumb-hit));
94
128
  corner-shape: var(--ui-slider-thumb-corner-shape);
129
+ /* the visible border, then the ring outside the thumb (or inside it once the box has
130
+ grown), then the drop shadow */
131
+ box-shadow:
132
+ inset 0 0 0 var(--ui-slider-thumb-border-width) var(--ui-slider-thumb-border-color),
133
+ 0 0 0 calc(var(--_ring-offset-width) * (1 - var(--_slider-thumb-in)))
134
+ var(--ring-offset-shadow-color),
135
+ 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * (1 - var(--_slider-thumb-in)))
136
+ var(--_ring-fill, var(--ring-shadow-color)),
137
+ inset 0 0 0 calc(var(--_ring-offset-width) * var(--_slider-thumb-in))
138
+ var(--ring-offset-shadow-color),
139
+ inset 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * var(--_slider-thumb-in))
140
+ var(--_ring-fill, var(--ring-shadow-color)),
141
+ var(--_slider-thumb-drop);
95
142
 
96
143
  transition: var(--default-transition);
97
144
  }
98
145
 
99
146
  :where(input[type="range"])::-moz-range-thumb {
100
- /* the ring is a box-shadow so it composes with --ui-slider-thumb-shadow;
101
- widths animate from 0 so it grows in on focus */
102
- --_ring-offset-width: 0px;
103
- --_ring-width: 0px;
104
- --_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
105
-
106
147
  appearance: none;
148
+ box-sizing: content-box;
107
149
  inline-size: var(--ui-slider-thumb-size);
108
150
  block-size: var(--ui-slider-thumb-size);
151
+ /* the padding box is the visible thumb; the transparent border is the extra hit area */
152
+ border: var(--_slider-thumb-hit) solid transparent;
109
153
  background-color: var(--ui-slider-thumb-bg);
110
- border: var(--ui-slider-thumb-border);
111
- border-radius: var(--ui-slider-thumb-radius);
154
+ background-clip: padding-box;
155
+ border-radius: calc(var(--ui-slider-thumb-radius) + var(--_slider-thumb-hit));
112
156
  corner-shape: var(--ui-slider-thumb-corner-shape);
113
-
157
+ /* the visible border, then the ring outside the thumb (or inside it once the box has
158
+ grown), then the drop shadow */
114
159
  box-shadow:
115
- 0 0 0 var(--_ring-offset-width) var(--ring-offset-shadow-color),
116
- 0 0 0 calc(var(--_ring-offset-width) + var(--_ring-width))
160
+ inset 0 0 0 var(--ui-slider-thumb-border-width) var(--ui-slider-thumb-border-color),
161
+ 0 0 0 calc(var(--_ring-offset-width) * (1 - var(--_slider-thumb-in)))
162
+ var(--ring-offset-shadow-color),
163
+ 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * (1 - var(--_slider-thumb-in)))
164
+ var(--_ring-fill, var(--ring-shadow-color)),
165
+ inset 0 0 0 calc(var(--_ring-offset-width) * var(--_slider-thumb-in))
166
+ var(--ring-offset-shadow-color),
167
+ inset 0 0 0 calc((var(--_ring-offset-width) + var(--_ring-width)) * var(--_slider-thumb-in))
117
168
  var(--_ring-fill, var(--ring-shadow-color)),
118
- var(--ui-slider-thumb-shadow);
169
+ var(--_slider-thumb-drop);
119
170
 
120
171
  transition: var(--default-transition);
121
172
  }
122
173
 
123
174
  @media (hover: hover) {
124
175
  :where(input[type="range"]:hover) {
125
- --ui-slider-thumb-border: 1px solid var(--color-primary);
176
+ --ui-slider-thumb-border-color: var(--color-primary);
126
177
  }
127
178
  }
128
179
 
129
- :where(input[type="range"]:active) {
130
- --ui-slider-thumb-shadow: var(--shadow-xs), var(--shadow-ring);
131
-
132
- cursor: grabbing;
180
+ :where(input[type="range"]:is(:active, :focus-visible)) {
181
+ --_ring-offset-width: var(--ring-offset-width);
182
+ --_ring-width: var(--ring-width);
133
183
  }
134
184
 
135
- :where(input[type="range"]:focus-visible) {
136
- --ui-slider-thumb-shadow: var(--shadow-xs), var(--shadow-ring);
185
+ :where(input[type="range"]:active) {
186
+ cursor: grabbing;
137
187
  }
138
188
 
139
189
  :where(input[type="range"]:disabled) {
@@ -15,8 +15,9 @@
15
15
 
16
16
  @layer variables {
17
17
  :root {
18
- --ui-switch-track-w: calc(var(--spacing) * 7);
19
- --ui-switch-track-p: calc(var(--spacing) * 0.5);
18
+ /* floored so the track stays at least --spacing-control-min tall */
19
+ --ui-switch-track-w: max(calc(var(--spacing) * 7), calc(var(--spacing-control-min) * 1.75));
20
+ --ui-switch-track-p: max(calc(var(--spacing) * 0.5), calc(var(--spacing-control-min) * 0.125));
20
21
  --ui-switch-track-h: calc(var(--ui-switch-track-w) / 2 + var(--ui-switch-track-p));
21
22
 
22
23
  --ui-switch-thumb-bg: var(--color-card);
@@ -8,7 +8,8 @@
8
8
  * (@supports gated; checked-label fallback paints card fill without pill)
9
9
  * @uses anchor-scope — isolates --active-tab inside nested menus
10
10
  * @uses text-box, color-mix() — label trim and focus ring
11
- * @uses --_touch-min (touch screens) — labels grow to the touch floor
11
+ * @uses --_touch-min (touch screens) — labels grow to the touch floor,
12
+ * and each inline side gains half of what the height grew
12
13
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
13
14
  * rounded corners
14
15
  * @tokens --ui-tabs-* (@layer variables)
@@ -23,7 +24,7 @@
23
24
  --ui-tabs-track-radius: var(--ui-field-radius);
24
25
  --ui-tabs-track-corner-shape: var(--ui-field-corner-shape);
25
26
  --ui-tabs-track-gap: calc(var(--spacing) * 0.5);
26
- --ui-tabs-track-bg: var(--color-muted);
27
+ --ui-tabs-track-bg: var(--ui-field-bg);
27
28
  --ui-tabs-track-border-width: 1px;
28
29
  --ui-tabs-track-border-style: solid;
29
30
  --ui-tabs-track-border-color: var(--color-border);
@@ -51,6 +52,9 @@
51
52
  --ui-tabs-label-text--active: var(--color-foreground);
52
53
 
53
54
  --ui-tabs-label-px: var(--ui-field-px);
55
+ /* half the field value: labels sit inside the track's padding, and in a browser
56
+ without text-box trim the full line plus this still fits the default height */
57
+ --ui-tabs-label-py: calc(var(--ui-field-py) / 2);
54
58
  --ui-tabs-label-min-h: calc(var(--spacing) * 7);
55
59
  --ui-tabs-label-ring-color: var(--ui-field-ring-color);
56
60
  }
@@ -124,7 +128,11 @@
124
128
  line-height: var(--ui-tabs-label-leading);
125
129
 
126
130
  min-block-size: max(var(--ui-tabs-label-min-h), var(--_touch-min));
127
- padding-inline: var(--ui-tabs-label-px);
131
+ padding-block: var(--ui-tabs-label-py);
132
+ /* each side gains half of what the touch floor added to the height */
133
+ padding-inline: calc(
134
+ var(--ui-tabs-label-px) + max(0px, (var(--_touch-min) - var(--ui-tabs-label-min-h)) / 2)
135
+ );
128
136
 
129
137
  color: var(--ui-tabs-label-text);
130
138
  background-color: var(--ui-tabs-label-bg);
@@ -19,7 +19,8 @@
19
19
  --ui-textarea-min-w: 0;
20
20
  --ui-textarea-min-h: 5lh;
21
21
  --ui-textarea-max-h: 12lh;
22
- --ui-textarea-p: var(--ui-field-px);
22
+ --ui-textarea-px: var(--ui-field-px);
23
+ --ui-textarea-py: var(--ui-field-py);
23
24
  --ui-textarea-font-size: var(--ui-field-font-size);
24
25
  --ui-textarea-leading: var(--leading-sm);
25
26
  --ui-textarea-border-width: var(--ui-field-border-width);
@@ -47,9 +48,12 @@
47
48
  --_max-h-len: var(--_max-h-resolved, var(--ui-textarea-max-h));
48
49
  --_max-h-num: var(--_max-h-resolved, var(--ui-textarea-max-h));
49
50
  max-block-size: calc(var(--_max-h-len) + var(--_max-h-num) * var(--spacing));
50
- --_p-len: var(--_p-resolved, var(--ui-textarea-p));
51
- --_p-num: var(--_p-resolved, var(--ui-textarea-p));
52
- padding: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
51
+ --_px-len: var(--_px-resolved, var(--ui-textarea-px));
52
+ --_px-num: var(--_px-resolved, var(--ui-textarea-px));
53
+ padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing));
54
+ --_py-len: var(--_py-resolved, var(--ui-textarea-py));
55
+ --_py-num: var(--_py-resolved, var(--ui-textarea-py));
56
+ padding-block: calc(var(--_py-len) + var(--_py-num) * var(--spacing));
53
57
 
54
58
  font-size: var(--_font-size-resolved, var(--ui-textarea-font-size));
55
59
  line-height: var(--_leading-resolved, var(--ui-textarea-leading));
@@ -16,7 +16,8 @@
16
16
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
17
17
  * rounded corners
18
18
  * @uses --_touch-min (touch screens) — the default and icon sizes grow to the touch
19
- * floor; sm and icon-sm keep their box and extend an invisible ::after hit area
19
+ * floor, and each inline side gains half of what the height grew; sm and
20
+ * icon-sm keep their box and extend an invisible ::after hit area
20
21
  * @tokens --ui-toggle-* (@layer variables;
21
22
  * default to the --ui-button-* family)
22
23
  * @consumedby toggle-group.css
@@ -59,6 +60,7 @@
59
60
 
60
61
  /* dual-mode hooks: a scale number or a length */
61
62
  --ui-toggle-gap: var(--ui-button-gap);
63
+ --ui-toggle-py: var(--ui-button-py);
62
64
  --ui-toggle-px: var(--ui-button-px);
63
65
  --ui-toggle-min-h: var(--ui-button-min-h);
64
66
  --ui-toggle-radius: var(--ui-button-radius);
@@ -177,6 +179,12 @@
177
179
  syntax: "*";
178
180
  inherits: false;
179
181
  }
182
+
183
+ @property --_toggle-py {
184
+ syntax: "*";
185
+ inherits: false;
186
+ }
187
+
180
188
  @property --_toggle-px {
181
189
  syntax: "*";
182
190
  inherits: false;
@@ -230,9 +238,21 @@
230
238
  );
231
239
  min-inline-size: max-content;
232
240
 
241
+ --_py-len: var(--_py-resolved, var(--_toggle-py, var(--ui-toggle-py)));
242
+ --_py-num: var(--_py-resolved, var(--_toggle-py, var(--ui-toggle-py)));
243
+ padding-block: calc(var(--_py-len) + var(--_py-num) * var(--spacing));
244
+
233
245
  --_px-len: var(--_px-resolved, var(--_toggle-px, var(--ui-toggle-px)));
234
246
  --_px-num: var(--_px-resolved, var(--_toggle-px, var(--ui-toggle-px)));
235
- padding-inline: calc(var(--_px-len) + var(--_px-num) * var(--spacing));
247
+ /* each inline side gains half of what the touch floor added to the height, so the
248
+ label's margins grow evenly */
249
+ padding-inline: calc(
250
+ var(--_px-len) + var(--_px-num) * var(--spacing) +
251
+ max(
252
+ 0px,
253
+ (var(--_touch-floor) - calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing))) / 2
254
+ )
255
+ );
236
256
 
237
257
  border-width: var(
238
258
  --_border-width-resolved,
@@ -509,6 +529,8 @@
509
529
 
510
530
  :where([data-ui~="toggle"][data-toggle-size="sm"]) {
511
531
  --_toggle-min-h: calc(var(--spacing) * 6);
532
+ /* a 16px icon, this, and the border fit the 24px box */
533
+ --_toggle-py: calc(var(--spacing) * 0.75);
512
534
  --_toggle-px: calc(var(--spacing) * 2);
513
535
  --_toggle-radius: var(--radius-sm);
514
536
  /* dense by choice: the box stays small and ::after takes the touch floor */