@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
@@ -52,8 +52,8 @@
52
52
  closedby="any"
53
53
  style="--border-width: 0"
54
54
  >
55
- <div data-mobile-menu-slot="viewport">
56
- <div data-mobile-menu-slot="header">
55
+ <div data-mobile-menu-slot="viewport" data-dialog-slot="content">
56
+ <div data-mobile-menu-slot="header" data-dialog-slot="header">
57
57
  <span
58
58
  style="
59
59
  --font-size: var(--font-size-md);
@@ -98,7 +98,7 @@
98
98
  </button>
99
99
  </div>
100
100
 
101
- <div data-mobile-menu-slot="body">
101
+ <div data-mobile-menu-slot="body" data-dialog-slot="body">
102
102
  <ui-accordion>
103
103
  <!-- Platform -->
104
104
  <details>
@@ -1895,7 +1895,7 @@
1895
1895
  </ui-accordion>
1896
1896
  </div>
1897
1897
 
1898
- <div data-mobile-menu-slot="footer">
1898
+ <div data-mobile-menu-slot="footer" data-dialog-slot="footer">
1899
1899
  <button data-ui="button" type="button" style="--flex: 1">
1900
1900
  Sign in
1901
1901
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
@@ -93,7 +93,7 @@
93
93
  --ui-popover-min-w: 0;
94
94
 
95
95
  --ui-popover-position-area: block-end span-inline-end;
96
- --ui-popover-origin: top center;
96
+ --ui-popover-origin: top var(--_origin-inline-start);
97
97
  --ui-popover-my: calc(var(--spacing) * 1.5);
98
98
  }
99
99
 
@@ -115,7 +115,7 @@
115
115
  :where([data-ui~="navigation-menu"])
116
116
  [data-navigation-menu-slot~="popover"][data-popover-align="end"] {
117
117
  --ui-popover-position-area: block-end span-inline-start;
118
- --ui-popover-origin: top right;
118
+ --ui-popover-origin: top var(--_origin-inline-end);
119
119
  }
120
120
 
121
121
  /* ===========================================================================
@@ -174,7 +174,7 @@
174
174
  position-anchor: --ui-navigation-menu-menu-subtrigger;
175
175
 
176
176
  --ui-popover-position-area: inline-end span-block-start;
177
- --ui-popover-origin: left top;
177
+ --ui-popover-origin: bottom var(--_origin-inline-start);
178
178
  --ui-popover-my: 0;
179
179
  --ui-popover-mx: calc(var(--spacing) * 1.5);
180
180
  --ui-popover-position-try-fallbacks: flip-inline, flip-block, flip-inline flip-block;
@@ -7,6 +7,7 @@
7
7
  * stamped cell rail with transparent text/caret so autofill,
8
8
  * paste, and focus stay native; never display:none
9
9
  * @uses :focus-within: active-cell ring only while the input has focus
10
+ * @uses --_touch-min (touch screens): each cell grows to the touch floor
10
11
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
11
12
  * rounded corners
12
13
  * @tokens --ui-otp-* (@layer variables; aliases --ui-field-*)
@@ -17,6 +18,8 @@
17
18
  :root {
18
19
  --ui-otp-cell-w: var(--ui-field-h);
19
20
  --ui-otp-cell-h: var(--ui-field-h);
21
+ /* half the field value: the digit is larger than field text */
22
+ --ui-otp-cell-py: calc(var(--ui-field-py) / 2);
20
23
  --ui-otp-cell-bg: var(--ui-field-bg);
21
24
  --ui-otp-cell-border-width: var(--ui-field-border-width);
22
25
  --ui-otp-cell-border-style: var(--ui-field-border-style);
@@ -78,8 +81,18 @@
78
81
  :where(ui-otp, [data-ui~="otp"]) [data-otp-slot~="cell"] {
79
82
  display: grid;
80
83
  place-items: center;
81
- inline-size: var(--ui-otp-cell-w);
82
- block-size: var(--ui-otp-cell-h);
84
+ /* never smaller than its digit plus --ui-otp-cell-py around it, both ways, so
85
+ the cell stays square at a small --spacing */
86
+ inline-size: max(
87
+ var(--ui-otp-cell-w),
88
+ var(--_touch-min),
89
+ calc(1em + 2 * (var(--ui-otp-cell-py) + var(--ui-otp-cell-border-width)))
90
+ );
91
+ block-size: max(
92
+ var(--ui-otp-cell-h),
93
+ var(--_touch-min),
94
+ calc(1em + 2 * (var(--ui-otp-cell-py) + var(--ui-otp-cell-border-width)))
95
+ );
83
96
 
84
97
  font-family: var(--font-family-mono);
85
98
  font-size: var(--ui-otp-cell-font-size);
@@ -5,6 +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,
9
+ * and the input's inline sides gain half of what the height grew
8
10
  * @uses aria-pressed on toggle — show/hide icon swap via CSS (JS sets type +
9
11
  * aria in password-group.ts)
10
12
  * @uses Native reveal suppressed in _reset.css (::-ms-reveal, etc.)
@@ -58,7 +60,15 @@
58
60
  inline-size: calc(var(--_w-len) + var(--_w-num) * var(--spacing));
59
61
  --_min-h-len: var(--_min-h-resolved, var(--ui-password-group-min-h));
60
62
  --_min-h-num: var(--_min-h-resolved, var(--ui-password-group-min-h));
61
- min-block-size: calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing));
63
+ min-block-size: max(
64
+ calc(var(--_min-h-len) + var(--_min-h-num) * var(--spacing)),
65
+ var(--_touch-min)
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
+ );
62
72
  --_p-len: var(--_p-resolved, var(--ui-password-group-p));
63
73
  --_p-num: var(--_p-resolved, var(--ui-password-group-p));
64
74
  padding: calc(var(--_p-len) + var(--_p-num) * var(--spacing));
@@ -133,6 +143,9 @@
133
143
 
134
144
  :where([data-ui~="password-group"]) [data-ui~="input"] {
135
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)));
136
149
  padding-inline: 0;
137
150
  }
138
151
 
@@ -145,14 +158,14 @@
145
158
  )
146
159
  )
147
160
  [data-ui~="input"] {
148
- padding-inline-start: var(--ui-field-px);
161
+ padding-inline-start: calc(var(--ui-field-px) + var(--_group-touch-px));
149
162
  }
150
163
 
151
164
  :where([data-ui~="password-group"]):not(
152
165
  :has([data-password-group-slot~="addon"][data-password-group-align="inline-end"])
153
166
  )
154
167
  [data-ui~="input"] {
155
- padding-inline-end: var(--ui-field-px);
168
+ padding-inline-end: calc(var(--ui-field-px) + var(--_group-touch-px));
156
169
  }
157
170
 
158
171
  /* A textarea claims the full width; addons stack above/below via block-* */
@@ -172,8 +185,8 @@
172
185
  gap: var(--spacing);
173
186
  color: var(--color-muted-foreground);
174
187
  white-space: nowrap;
175
- block-size: var(--ui-field-h);
176
- min-inline-size: var(--ui-field-h);
188
+ block-size: max(var(--ui-field-h), var(--_touch-min));
189
+ min-inline-size: max(var(--ui-field-h), var(--_touch-min));
177
190
  padding-inline: var(--ui-field-addon-p);
178
191
  }
179
192
 
@@ -10,6 +10,9 @@
10
10
  * back to the UA-centered popover)
11
11
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
12
12
  * rounded corners
13
+ * @uses :dir(rtl): inline-side transform origins mirror in RTL (transform-origin
14
+ * has no logical keywords); origins follow the declared side, not an
15
+ * active position-try fallback
13
16
  * @tokens --ui-popover-* (Tier 3 owner; @layer variables)
14
17
  * @presets data-popover-side="top | bottom | left | right", data-popover-align="start | center | end"
15
18
  * on the [popover] element (the identity is the native attribute)
@@ -59,6 +62,11 @@
59
62
  background-color: var(--color-popover);
60
63
 
61
64
  align-content: start;
65
+ /* transform-origin has no logical keywords: the placement matrix names the
66
+ inline edge through these, resolved per element so RTL mirrors them.
67
+ Origins track the declared side, not the active position-try fallback. */
68
+ --_origin-inline-start: left;
69
+ --_origin-inline-end: right;
62
70
  transform-origin: var(--ui-popover-origin);
63
71
  --_radius-len: var(--_radius-resolved, var(--ui-popover-radius));
64
72
  --_radius-num: var(--_radius-resolved, var(--ui-popover-radius));
@@ -81,6 +89,11 @@
81
89
  allow-discrete;
82
90
  }
83
91
 
92
+ :where([popover]:dir(rtl)) {
93
+ --_origin-inline-start: right;
94
+ --_origin-inline-end: left;
95
+ }
96
+
84
97
  /* Anchor positioning tethers the popover to its trigger and flips it away
85
98
  from viewport edges. The gate keeps Safari 26.x on the UA-centered popover
86
99
  (inset: 0 + margin: auto) instead of a mispositioned top-left box.
@@ -152,7 +165,7 @@
152
165
  :where([popover])[data-popover-side="bottom"]:not([data-popover-align]),
153
166
  :where([popover])[data-popover-side="bottom"][data-popover-align="start"] {
154
167
  --ui-popover-position-area: block-end span-inline-end;
155
- --ui-popover-origin: top center;
168
+ --ui-popover-origin: top var(--_origin-inline-start);
156
169
  --ui-popover-my: calc(var(--spacing) * 1.5);
157
170
  --ui-popover-mx: 0;
158
171
  }
@@ -166,7 +179,7 @@
166
179
 
167
180
  :where([popover])[data-popover-side="bottom"][data-popover-align="end"] {
168
181
  --ui-popover-position-area: block-end span-inline-start;
169
- --ui-popover-origin: top center;
182
+ --ui-popover-origin: top var(--_origin-inline-end);
170
183
  --ui-popover-my: calc(var(--spacing) * 1.5);
171
184
  --ui-popover-mx: 0;
172
185
  }
@@ -174,7 +187,7 @@
174
187
  :where([popover])[data-popover-side="top"]:not([data-popover-align]),
175
188
  :where([popover])[data-popover-side="top"][data-popover-align="start"] {
176
189
  --ui-popover-position-area: block-start span-inline-end;
177
- --ui-popover-origin: bottom center;
190
+ --ui-popover-origin: bottom var(--_origin-inline-start);
178
191
  --ui-popover-my: calc(var(--spacing) * 1.5);
179
192
  --ui-popover-mx: 0;
180
193
  }
@@ -188,7 +201,7 @@
188
201
 
189
202
  :where([popover])[data-popover-side="top"][data-popover-align="end"] {
190
203
  --ui-popover-position-area: block-start span-inline-start;
191
- --ui-popover-origin: bottom center;
204
+ --ui-popover-origin: bottom var(--_origin-inline-end);
192
205
  --ui-popover-my: calc(var(--spacing) * 1.5);
193
206
  --ui-popover-mx: 0;
194
207
  }
@@ -196,21 +209,21 @@
196
209
  :where([popover])[data-popover-side="right"]:not([data-popover-align]),
197
210
  :where([popover])[data-popover-side="right"][data-popover-align="start"] {
198
211
  --ui-popover-position-area: inline-end span-block-end;
199
- --ui-popover-origin: bottom left;
212
+ --ui-popover-origin: top var(--_origin-inline-start);
200
213
  --ui-popover-my: 0;
201
214
  --ui-popover-mx: calc(var(--spacing) * 1.5);
202
215
  }
203
216
 
204
217
  :where([popover])[data-popover-side="right"][data-popover-align="center"] {
205
218
  --ui-popover-position-area: inline-end span-all;
206
- --ui-popover-origin: center left;
219
+ --ui-popover-origin: center var(--_origin-inline-start);
207
220
  --ui-popover-my: 0;
208
221
  --ui-popover-mx: calc(var(--spacing) * 1.5);
209
222
  }
210
223
 
211
224
  :where([popover])[data-popover-side="right"][data-popover-align="end"] {
212
225
  --ui-popover-position-area: inline-end span-block-start;
213
- --ui-popover-origin: top left;
226
+ --ui-popover-origin: bottom var(--_origin-inline-start);
214
227
  --ui-popover-my: 0;
215
228
  --ui-popover-mx: calc(var(--spacing) * 1.5);
216
229
  }
@@ -218,21 +231,21 @@
218
231
  :where([popover])[data-popover-side="left"]:not([data-popover-align]),
219
232
  :where([popover])[data-popover-side="left"][data-popover-align="start"] {
220
233
  --ui-popover-position-area: inline-start span-block-end;
221
- --ui-popover-origin: bottom right;
234
+ --ui-popover-origin: top var(--_origin-inline-end);
222
235
  --ui-popover-my: 0;
223
236
  --ui-popover-mx: calc(var(--spacing) * 1.5);
224
237
  }
225
238
 
226
239
  :where([popover])[data-popover-side="left"][data-popover-align="center"] {
227
240
  --ui-popover-position-area: inline-start span-all;
228
- --ui-popover-origin: center right;
241
+ --ui-popover-origin: center var(--_origin-inline-end);
229
242
  --ui-popover-my: 0;
230
243
  --ui-popover-mx: calc(var(--spacing) * 1.5);
231
244
  }
232
245
 
233
246
  :where([popover])[data-popover-side="left"][data-popover-align="end"] {
234
247
  --ui-popover-position-area: inline-start span-block-start;
235
- --ui-popover-origin: top right;
248
+ --ui-popover-origin: bottom var(--_origin-inline-end);
236
249
  --ui-popover-my: 0;
237
250
  --ui-popover-mx: calc(var(--spacing) * 1.5);
238
251
  }
@@ -4,6 +4,8 @@
4
4
  * @layer variables, components
5
5
  * @requires _layers.css, _variables.css, _properties.css (--_*-resolved, --_focus-shadow), fields.css (field-group layout, --ui-field-* surface/border)
6
6
  * @uses appearance: none — custom circle + masked ::before dot when :checked
7
+ * @uses --_touch-min (touch screens) — the circle keeps its size; an invisible ::after
8
+ * centred on it is at least the touch floor square
7
9
  * @uses corner-shape — round by default, so circles stay circles; a hook takes any shape
8
10
  * @tokens --ui-radio-* (@layer variables)
9
11
  */
@@ -21,7 +23,7 @@
21
23
  --ui-radio-border-color--checked: var(--color-primary);
22
24
  --ui-radio-radius: var(--radius-full);
23
25
  --ui-radio-corner-shape: round;
24
- --ui-radio-dot-size: 1em;
26
+ --ui-radio-dot-size: 1.125em;
25
27
  --ui-radio-dot-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' fill='currentColor' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3C/svg%3E")
26
28
  center / contain no-repeat;
27
29
  }
@@ -43,8 +45,18 @@
43
45
  --_size-num: var(--_size-resolved, var(--ui-radio-size));
44
46
  inline-size: calc(var(--_size-len) + var(--_size-num) * var(--spacing));
45
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);
46
50
 
47
51
  background-color: var(--_bg-resolved, var(--ui-radio-bg));
52
+
53
+ /* touch: the hit area, --_touch-min square at least; collapses to the box on a mouse */
54
+ &::after {
55
+ content: "";
56
+ position: absolute;
57
+ inset: min(0px, calc((100% - var(--_touch-min)) / 2));
58
+ }
59
+
48
60
  border-width: var(--_border-width-resolved, var(--ui-radio-border-width));
49
61
  border-style: var(--_border-style-resolved, var(--ui-radio-border-style));
50
62
  border-color: var(--_border-color-resolved, var(--ui-radio-border-color));
@@ -58,7 +70,7 @@
58
70
  /* centres the ::before dot */
59
71
  display: inline-grid;
60
72
  place-items: center;
61
- background-clip: padding-box;
73
+ background-clip: border-box;
62
74
 
63
75
  cursor: pointer;
64
76
 
@@ -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>
@@ -109,7 +109,7 @@
109
109
  transparent 100%
110
110
  );
111
111
 
112
- &:where([dir="rtl"], [dir="rtl"] *) {
112
+ &:where(:dir(rtl)) {
113
113
  --_scroll-fade-gradient: linear-gradient(
114
114
  to left,
115
115
  transparent 0,
@@ -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,6 +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
17
+ * floor; the trigger's inline sides each gain half of what its height grew
16
18
  * @uses corner-shape — superellipse corners; unsupported browsers keep plain
17
19
  * rounded corners
18
20
  * @tokens --ui-select-* (@layer variables); picker panel reuses --ui-popover-* (owned in popover.css)
@@ -28,6 +30,7 @@
28
30
  --ui-select-pl: var(--ui-field-px);
29
31
  /* room for the picker icon */
30
32
  --ui-select-pr: calc(var(--spacing) * 2);
33
+ --ui-select-py: var(--ui-field-py);
31
34
  --ui-select-font-size: var(--ui-field-font-size);
32
35
  --ui-select-leading: var(--ui-field-leading);
33
36
  --ui-select-border-width: var(--ui-field-border-width);
@@ -51,6 +54,7 @@
51
54
  --ui-option-leading: var(--ui-button-leading);
52
55
  --ui-option-gap: var(--ui-button-gap);
53
56
  --ui-option-px: var(--ui-button-px);
57
+ --ui-option-py: var(--ui-button-py);
54
58
  --ui-option-min-h: var(--ui-button-min-h);
55
59
  --ui-option-icon-size: var(--ui-button-icon-size);
56
60
  --ui-option-radius: var(--ui-menu-button-radius);
@@ -89,6 +93,18 @@
89
93
  appearance: base-select;
90
94
  }
91
95
 
96
+ /* Inline-edge names for the placement matrix's origins, resolved on the
97
+ select (where the matrix sets them) so RTL mirrors them; see popover.css. */
98
+ :where([data-ui~="select"]) {
99
+ --_origin-inline-start: left;
100
+ --_origin-inline-end: right;
101
+ }
102
+
103
+ :where([data-ui~="select"]:dir(rtl)) {
104
+ --_origin-inline-start: right;
105
+ --_origin-inline-end: left;
106
+ }
107
+
92
108
  :where([data-ui~="select"])::picker(select) {
93
109
  transform-origin: var(--ui-popover-origin);
94
110
  opacity: var(--ui-popover-opacity--start);
@@ -158,13 +174,31 @@
158
174
  min-inline-size: calc(var(--_min-w-len) + var(--_min-w-num) * var(--spacing));
159
175
  --_h-len: var(--_h-resolved, var(--ui-field-h));
160
176
  --_h-num: var(--_h-resolved, var(--ui-field-h));
161
- block-size: calc(var(--_h-len) + var(--_h-num) * var(--spacing));
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
+ );
162
196
  --_pl-len: var(--_pl-resolved, var(--ui-select-pl));
163
197
  --_pl-num: var(--_pl-resolved, var(--ui-select-pl));
164
- 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));
165
199
  --_pr-len: var(--_pr-resolved, var(--ui-select-pr));
166
200
  --_pr-num: var(--_pr-resolved, var(--ui-select-pr));
167
- 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));
168
202
 
169
203
  font-size: var(--_font-size-resolved, var(--ui-select-font-size));
170
204
  line-height: var(--_leading-resolved, var(--ui-select-leading));
@@ -298,13 +332,15 @@
298
332
  }
299
333
  }
300
334
 
301
- /* Like [data-ui~="button"], sizing rides on min-block-size + padding-inline
302
- (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. */
303
338
  :where([data-ui~="select"]) option {
304
339
  display: flex;
305
340
  align-items: center;
306
341
  gap: var(--ui-option-gap);
307
- min-block-size: var(--ui-option-min-h);
342
+ min-block-size: max(var(--ui-option-min-h), var(--_touch-min));
343
+ padding-block: var(--ui-option-py);
308
344
  padding-inline: var(--ui-option-px);
309
345
 
310
346
  font-family: var(--ui-option-font-family);
@@ -434,7 +470,8 @@
434
470
  display: flex;
435
471
  align-items: center;
436
472
  gap: var(--ui-option-gap);
437
- min-block-size: var(--ui-option-min-h);
473
+ min-block-size: max(var(--ui-option-min-h), var(--_touch-min));
474
+ padding-block: var(--ui-option-py);
438
475
  padding-inline: var(--ui-option-px);
439
476
 
440
477
  font-family: var(--ui-option-font-family);
@@ -530,7 +567,7 @@
530
567
  :where([data-ui~="select"]:not([data-select-side]):not([data-select-align])),
531
568
  :where([data-ui~="select"]:not([data-select-side])[data-select-align="start"]) {
532
569
  --ui-popover-position-area: block-end span-inline-end;
533
- --ui-popover-origin: top center;
570
+ --ui-popover-origin: top var(--_origin-inline-start);
534
571
  --ui-popover-my: calc(var(--spacing) * 1.5);
535
572
  --ui-popover-mx: 0;
536
573
  }
@@ -546,7 +583,7 @@
546
583
  :where([data-ui~="select"])[data-select-side="bottom"][data-select-align="end"],
547
584
  :where([data-ui~="select"]:not([data-select-side])[data-select-align="end"]) {
548
585
  --ui-popover-position-area: block-end span-inline-start;
549
- --ui-popover-origin: top center;
586
+ --ui-popover-origin: top var(--_origin-inline-end);
550
587
  --ui-popover-my: calc(var(--spacing) * 1.5);
551
588
  --ui-popover-mx: 0;
552
589
  }
@@ -554,7 +591,7 @@
554
591
  :where([data-ui~="select"])[data-select-side="top"]:not([data-select-align]),
555
592
  :where([data-ui~="select"])[data-select-side="top"][data-select-align="start"] {
556
593
  --ui-popover-position-area: block-start span-inline-end;
557
- --ui-popover-origin: bottom center;
594
+ --ui-popover-origin: bottom var(--_origin-inline-start);
558
595
  --ui-popover-my: calc(var(--spacing) * 1.5);
559
596
  --ui-popover-mx: 0;
560
597
  }
@@ -568,7 +605,7 @@
568
605
 
569
606
  :where([data-ui~="select"])[data-select-side="top"][data-select-align="end"] {
570
607
  --ui-popover-position-area: block-start span-inline-start;
571
- --ui-popover-origin: bottom center;
608
+ --ui-popover-origin: bottom var(--_origin-inline-end);
572
609
  --ui-popover-my: calc(var(--spacing) * 1.5);
573
610
  --ui-popover-mx: 0;
574
611
  }
@@ -576,21 +613,21 @@
576
613
  :where([data-ui~="select"])[data-select-side="right"]:not([data-select-align]),
577
614
  :where([data-ui~="select"])[data-select-side="right"][data-select-align="start"] {
578
615
  --ui-popover-position-area: inline-end span-block-end;
579
- --ui-popover-origin: bottom left;
616
+ --ui-popover-origin: top var(--_origin-inline-start);
580
617
  --ui-popover-my: 0;
581
618
  --ui-popover-mx: calc(var(--spacing) * 1.5);
582
619
  }
583
620
 
584
621
  :where([data-ui~="select"])[data-select-side="right"][data-select-align="center"] {
585
622
  --ui-popover-position-area: inline-end span-all;
586
- --ui-popover-origin: center left;
623
+ --ui-popover-origin: center var(--_origin-inline-start);
587
624
  --ui-popover-my: 0;
588
625
  --ui-popover-mx: calc(var(--spacing) * 1.5);
589
626
  }
590
627
 
591
628
  :where([data-ui~="select"])[data-select-side="right"][data-select-align="end"] {
592
629
  --ui-popover-position-area: inline-end span-block-start;
593
- --ui-popover-origin: top left;
630
+ --ui-popover-origin: bottom var(--_origin-inline-start);
594
631
  --ui-popover-my: 0;
595
632
  --ui-popover-mx: calc(var(--spacing) * 1.5);
596
633
  }
@@ -598,21 +635,21 @@
598
635
  :where([data-ui~="select"])[data-select-side="left"]:not([data-select-align]),
599
636
  :where([data-ui~="select"])[data-select-side="left"][data-select-align="start"] {
600
637
  --ui-popover-position-area: inline-start span-block-end;
601
- --ui-popover-origin: bottom right;
638
+ --ui-popover-origin: top var(--_origin-inline-end);
602
639
  --ui-popover-my: 0;
603
640
  --ui-popover-mx: calc(var(--spacing) * 1.5);
604
641
  }
605
642
 
606
643
  :where([data-ui~="select"])[data-select-side="left"][data-select-align="center"] {
607
644
  --ui-popover-position-area: inline-start span-all;
608
- --ui-popover-origin: center right;
645
+ --ui-popover-origin: center var(--_origin-inline-end);
609
646
  --ui-popover-my: 0;
610
647
  --ui-popover-mx: calc(var(--spacing) * 1.5);
611
648
  }
612
649
 
613
650
  :where([data-ui~="select"])[data-select-side="left"][data-select-align="end"] {
614
651
  --ui-popover-position-area: inline-start span-block-start;
615
- --ui-popover-origin: top right;
652
+ --ui-popover-origin: bottom var(--_origin-inline-end);
616
653
  --ui-popover-my: 0;
617
654
  --ui-popover-mx: calc(var(--spacing) * 1.5);
618
655
  }