opui-css 5.0.0 → 5.0.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 (114) hide show
  1. package/CHANGELOG.md +282 -276
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +127 -127
  4. package/README.md +87 -87
  5. package/astro/index.ts +46 -46
  6. package/components/AGENTS.md +248 -248
  7. package/components/Accordion/Accordion.astro +42 -42
  8. package/components/Anchor/Anchor.astro +51 -51
  9. package/components/Avatar/Avatar.astro +38 -38
  10. package/components/Badge/Badge.astro +59 -59
  11. package/components/Button/Button.astro +45 -45
  12. package/components/ButtonGroup/ButtonGroup.astro +29 -29
  13. package/components/Callout/Callout.astro +75 -75
  14. package/components/Card/Card.astro +36 -36
  15. package/components/Checkbox/Checkbox.astro +76 -76
  16. package/components/Checkbox/CheckboxInput.astro +32 -32
  17. package/components/Chip/Chip.astro +37 -37
  18. package/components/ClassicSelect/ClassicSelect.astro +83 -83
  19. package/components/DescriptionList/Description.astro +12 -12
  20. package/components/DescriptionList/DescriptionList.astro +22 -22
  21. package/components/DescriptionList/Item.astro +12 -12
  22. package/components/DescriptionList/Term.astro +12 -12
  23. package/components/DescriptionList/index.ts +12 -12
  24. package/components/Dialog/Dialog.astro +41 -41
  25. package/components/Divider/Divider.astro +17 -17
  26. package/components/Drawer/Drawer.astro +49 -49
  27. package/components/Drawer/DrawerFooter.astro +14 -14
  28. package/components/Drawer/DrawerHeader.astro +31 -31
  29. package/components/FieldDescription/FieldDescription.astro +13 -13
  30. package/components/FieldGroup/FieldGroup.astro +31 -31
  31. package/components/FieldLegend/FieldLegend.astro +15 -15
  32. package/components/FieldSet/FieldSet.astro +15 -15
  33. package/components/Form/Form.astro +15 -15
  34. package/components/IconButton/IconButton.astro +26 -26
  35. package/components/List/List.astro +36 -36
  36. package/components/ListItem/ListItem.astro +118 -118
  37. package/components/Progress/Progress.astro +41 -40
  38. package/components/Radio/Radio.astro +70 -70
  39. package/components/Radio/RadioInput.astro +24 -24
  40. package/components/Range/Range.astro +136 -136
  41. package/components/Select/Select.astro +106 -106
  42. package/components/Switch/Switch.astro +101 -101
  43. package/components/Switch/SwitchInput.astro +25 -25
  44. package/components/Table/Body.astro +13 -13
  45. package/components/Table/Cell.astro +13 -13
  46. package/components/Table/Column.astro +15 -15
  47. package/components/Table/ColumnGroup.astro +13 -13
  48. package/components/Table/Head.astro +13 -13
  49. package/components/Table/HeaderCell.astro +13 -13
  50. package/components/Table/Row.astro +13 -13
  51. package/components/Table/Table.astro +18 -18
  52. package/components/Table/index.ts +20 -20
  53. package/components/Tabs/Tabs.astro +28 -28
  54. package/components/Tabs/TabsItem.astro +47 -47
  55. package/components/Tabs/TabsPanel.astro +21 -21
  56. package/components/Tabs/TabsTab.astro +19 -19
  57. package/components/Tabs/index.ts +14 -14
  58. package/components/TextField/TextField.astro +128 -128
  59. package/components/Textarea/Textarea.astro +106 -106
  60. package/components/Toast/Toast.astro +42 -42
  61. package/components/ToggleButton/ToggleButton.astro +53 -53
  62. package/components/ToggleGroup/ToggleGroup.astro +49 -49
  63. package/components/Tooltip/Tooltip.astro +30 -30
  64. package/core/normalize.css +194 -194
  65. package/core/palette.css +59 -59
  66. package/core/utils.css +71 -71
  67. package/css/components/accordion.css +174 -174
  68. package/css/components/anchor.css +27 -27
  69. package/css/components/avatar.css +65 -65
  70. package/css/components/badge.css +107 -107
  71. package/css/components/button-group.css +179 -179
  72. package/css/components/button.css +215 -215
  73. package/css/components/callout.css +109 -109
  74. package/css/components/card.css +117 -117
  75. package/css/components/checkbox.css +205 -205
  76. package/css/components/chip.css +87 -87
  77. package/css/components/description-list.css +80 -80
  78. package/css/components/dialog.css +68 -68
  79. package/css/components/divider.css +20 -20
  80. package/css/components/drawer.css +171 -171
  81. package/css/components/form.css +146 -146
  82. package/css/components/icon-button.css +139 -139
  83. package/css/components/link.css +21 -21
  84. package/css/components/list.css +345 -345
  85. package/css/components/progress.css +102 -97
  86. package/css/components/radio.css +172 -172
  87. package/css/components/range.css +337 -337
  88. package/css/components/select.css +169 -169
  89. package/css/components/spinner.css +37 -37
  90. package/css/components/switch.css +268 -268
  91. package/css/components/table.css +179 -179
  92. package/css/components/tabs.css +83 -83
  93. package/css/components/text-field.css +450 -450
  94. package/css/components/text-input.css +64 -64
  95. package/css/components/textarea.css +24 -24
  96. package/css/components/toast.css +161 -161
  97. package/css/components/toggle-button.css +87 -87
  98. package/css/components/toggle-group.css +56 -56
  99. package/css/components/tooltip.css +67 -67
  100. package/css/components/typography.css +585 -585
  101. package/css/components.css +41 -41
  102. package/css/imports.css +16 -16
  103. package/css/js/checkbox.js +21 -21
  104. package/css/js/toast.js +94 -94
  105. package/css/theme.css +132 -132
  106. package/dist/op.css +65 -65
  107. package/dist/op.css.map +1 -1
  108. package/dist/opui.components.css +5159 -5154
  109. package/dist/opui.components.css.map +1 -1
  110. package/dist/opui.css +5668 -5663
  111. package/dist/opui.css.map +1 -1
  112. package/env.d.ts +14 -14
  113. package/open-props.css +9 -9
  114. package/package.json +81 -81
@@ -1,450 +1,450 @@
1
- @layer components.extended {
2
-
3
- /*
4
- - Common styling for input, textarea and select
5
- - Form related styles such as: label, supporting text, error handling
6
- */
7
- :where(.ui-text-field, .ui-textarea, .ui-select) {
8
- --_accent-color: var(--primary);
9
- --_bg-color: var(--surface-default);
10
- --_border-color: var(--field-border-color);
11
- --_field-padding-block: var(--size-2);
12
- --_field-padding-inline: var(--size-2);
13
- --_filled-border-color: var(--text-primary);
14
- --_height: var(--field-size);
15
- --_label-color: var(--text-muted);
16
- --_end-text-color: var(--text-muted);
17
-
18
- display: grid;
19
- gap: var(--size-1) 0;
20
- position: relative;
21
-
22
- /* Field - the actual input with a border around it */
23
- .ui-field {
24
- background-color: var(--_bg-color);
25
- border: var(--field-border-width) solid var(--_border-color);
26
- border-radius: var(--field-border-radius);
27
- display: grid;
28
- grid-column: 1/-1;
29
- grid-row: 2;
30
- grid-template-columns: auto 1fr auto;
31
- grid-template-areas:
32
- "header header header"
33
- "prefix input suffix"
34
- "footer footer footer";
35
- min-block-size: var(--_height);
36
-
37
- @media (prefers-reduced-motion: no-preference) {
38
- transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
39
- }
40
- }
41
-
42
- :where(.ui-field) :where(input, textarea, select) {
43
- background: transparent;
44
- border: 0;
45
- color: var(--text-primary);
46
- font-family: var(--font-sans);
47
- font-size: var(--font-size-1);
48
- grid-area: input;
49
- inline-size: 100%;
50
- line-height: var(--font-lineheight-1);
51
- min-inline-size: 0;
52
- padding: var(--_field-padding-block) var(--_field-padding-inline);
53
-
54
- &:focus,
55
- &:focus-visible {
56
- outline: 0;
57
- }
58
- }
59
-
60
- /* Affixes */
61
- .ui-prefix,
62
- .ui-suffix {
63
- align-items: center;
64
- color: var(--_label-color);
65
- display: inline-flex;
66
- padding-inline: var(--_field-padding-inline);
67
- white-space: nowrap;
68
- }
69
-
70
- .ui-prefix {
71
- grid-area: prefix;
72
- }
73
-
74
- .ui-suffix {
75
- grid-area: suffix;
76
- }
77
-
78
- .ui-header,
79
- .ui-footer {
80
- align-items: center;
81
- color: var(--_label-color);
82
- display: flex;
83
- font-size: var(--font-size-0);
84
- gap: var(--size-2);
85
- padding: var(--size-1) var(--_field-padding-inline);
86
- }
87
-
88
- .ui-header {
89
- border-block-end: 1px solid var(--_border-color);
90
- grid-area: header;
91
- }
92
-
93
- .ui-footer {
94
- border-block-start: 1px solid var(--_border-color);
95
- grid-area: footer;
96
- }
97
-
98
- /* Remove padding on the input when affixes are next to it */
99
- .ui-field:has(> .ui-prefix) :where(input, textarea, select) {
100
- padding-inline-start: 0;
101
- }
102
-
103
- .ui-field:has(> .ui-suffix) :where(input, textarea, select) {
104
- padding-inline-end: 0;
105
- }
106
-
107
- /* Textarea - keep affix aligned with the first line */
108
- &.ui-textarea .ui-field {
109
-
110
- .ui-prefix,
111
- .ui-suffix {
112
- align-self: start;
113
- padding-block: var(--_field-padding-block);
114
- }
115
- }
116
-
117
- /* Required/Invalid */
118
- &:has(:invalid) {
119
- .ui-label:after {
120
- color: var(--red);
121
- content: "*";
122
- margin: -0.25em auto auto 0.25em;
123
- }
124
- }
125
-
126
- /* File */
127
- &:has(input[type="file"]) {
128
- cursor: pointer;
129
-
130
- input {
131
- align-self: flex-start;
132
- block-size: var(--_height);
133
- box-shadow: none;
134
- color: var(--text-primary);
135
- cursor: inherit;
136
- max-inline-size: 100%;
137
- padding: 0;
138
- transition: font-size 0.2s var(--ease-3);
139
-
140
- &::-webkit-file-upload-button,
141
- &::file-selector-button {
142
- background-color: var(--surface-tonal);
143
- block-size: calc(100% - var(--size-2) * 2);
144
- border: none;
145
- border-radius: var(--field-border-radius);
146
- cursor: pointer;
147
- margin-block-start: var(--size-2);
148
- margin-inline-end: 1ex;
149
- margin-inline-start: var(--size-2);
150
- }
151
- }
152
-
153
- /* Variants */
154
- &.ui-filled {
155
- input {
156
-
157
- &::-webkit-file-upload-button,
158
- &::file-selector-button {
159
- background-color: var(--surface-default);
160
- block-size: calc(100% - var(--size-2) * 2);
161
- border-radius: var(--field-border-radius);
162
- cursor: pointer;
163
- margin-block-start: var(--size-2);
164
- }
165
- }
166
- }
167
-
168
- /* Sizes */
169
- &.ui-small {
170
- input {
171
- font-size: var(--font-size-05);
172
-
173
- &::-webkit-file-upload-button,
174
- &::file-selector-button {
175
- block-size: calc(100% - var(--size-2));
176
- margin-block-start: var(--size-1);
177
- }
178
- }
179
- }
180
- }
181
-
182
- /* Autosuggest */
183
- &:has(input[list]) {
184
- .ui-label {
185
- /* Make sure chevron is visible */
186
- inline-size: calc(100% - var(--size-6));
187
- }
188
- }
189
-
190
- /* Select */
191
- &:has(select) {
192
- .ui-label {
193
- /* Make sure chevron is visible */
194
- inline-size: calc(100% - var(--size-6));
195
-
196
- }
197
- }
198
-
199
- /* Customizable Select */
200
- &:has(select button) {
201
- select {
202
- padding: 0;
203
-
204
- button {
205
- outline: 0;
206
- padding: var(--_field-padding-block) var(--size-8) var(--_field-padding-block) var(--_field-padding-inline);
207
- }
208
- }
209
- }
210
-
211
- /* Non-customizable Select */
212
- &:has(select):not(:has(button)) {
213
- select {
214
- padding: var(--_field-padding-block) var(--size-8) var(--_field-padding-block) var(--_field-padding-inline);
215
- }
216
- }
217
-
218
- /* Input - color */
219
- &:has(input[type="color"]) {
220
- .ui-field {
221
- block-size: var(--_height);
222
- inline-size: var(--_height);
223
- min-block-size: 0;
224
- overflow: hidden;
225
- }
226
-
227
- input {
228
- appearance: none;
229
- background: none;
230
- block-size: var(--_height);
231
- inline-size: var(--_height);
232
- overflow: hidden;
233
- padding: 0;
234
-
235
- &::-webkit-color-swatch {
236
- border: none;
237
- }
238
-
239
- &::-webkit-color-swatch-wrapper {
240
- padding: 0;
241
- }
242
- }
243
- }
244
-
245
- /* Element states */
246
- &:hover {
247
- &:not([data-invalid]) {
248
- .ui-field {
249
- border-color: var(--text-primary);
250
- }
251
- }
252
- }
253
-
254
- &:focus-within {
255
- .ui-field {
256
- border-color: var(--_accent-color);
257
- outline-offset: -2px;
258
- }
259
- }
260
-
261
- /* Label */
262
- .ui-label {
263
- color: var(--text-primary);
264
- font-size: var(--font-size-05);
265
- font-weight: 600;
266
- grid-column: 1/-1;
267
- grid-row: 1;
268
- padding-inline: 0 1ex;
269
- }
270
-
271
- /* End text */
272
- :where(.ui-end-text) {
273
- color: var(--_end-text-color);
274
- font-size: var(--font-size-0);
275
- grid-column: 1/-1;
276
- grid-row: 3;
277
- line-height: 1.5;
278
- }
279
-
280
- /* Auto-fit */
281
- &.ui-auto-fit {
282
- inline-size: auto;
283
-
284
- .ui-field {
285
- inline-size: auto;
286
- }
287
-
288
- :where(& input, & textarea) {
289
- field-sizing: content;
290
- inline-size: auto;
291
- min-inline-size: 25ch;
292
- }
293
- }
294
-
295
- /* Validation */
296
- &[data-invalid],
297
- &:has(:user-invalid) {
298
- --_accent-color: var(--color-9);
299
- --_border-color: var(--color-9);
300
- --_filled-border-color: var(--color-9);
301
- --_label-color: var(--color-9);
302
- --_end-text-color: var(--color-9);
303
- }
304
-
305
- /*
306
- * Variant: Filled
307
- */
308
- &.ui-filled {
309
- --_bg-color: var(--surface-tonal);
310
-
311
- &:not(:has([disabled], :has(input[type="color"]))) {
312
-
313
- /* Hover */
314
- &:hover {
315
- --_bg-color: light-dark(oklch(from var(--surface-tonal) calc(l * 0.93) c h),
316
- oklch(from var(--surface-tonal) calc(l * 1.1) c h));
317
- }
318
- }
319
- }
320
-
321
- /* Disabled */
322
- &:where(:has([disabled])) {
323
- cursor: not-allowed;
324
- opacity: 0.64;
325
- user-select: none;
326
-
327
- &::before {
328
- display: none;
329
- }
330
-
331
- .ui-field {
332
- cursor: not-allowed;
333
- }
334
-
335
- :where(input, textarea, select) {
336
- cursor: not-allowed;
337
-
338
- * {
339
- pointer-events: none;
340
- }
341
- }
342
-
343
- .ui-label,
344
- .ui-start-text,
345
- .ui-end-text {
346
- cursor: not-allowed;
347
- }
348
- }
349
-
350
- /* Read-only */
351
- &:where(:has([readonly])) {
352
- &::before {
353
- display: none;
354
- }
355
-
356
- :where(input, textarea, select) {
357
- cursor: not-allowed;
358
-
359
- * {
360
- pointer-events: none;
361
- }
362
- }
363
- }
364
-
365
- /* Sizes */
366
- &.ui-small {
367
- --_field-padding-block: var(--size-2);
368
- --_height: var(--field-size-small);
369
-
370
- &:has(input[type="color"]) {
371
- .ui-label {
372
- line-height: 1.5;
373
- }
374
- }
375
- }
376
-
377
- /* Orientation */
378
- &.ui-spread {
379
- align-items: start;
380
- column-gap: var(--size-4);
381
- container-type: inline-size;
382
- grid-template-columns: 1fr auto;
383
-
384
- .ui-label {
385
- font-weight: 600;
386
- grid-column: 1;
387
- grid-row: 1;
388
- }
389
-
390
- .ui-start-text {
391
- color: var(--_end-text-color);
392
- font-size: var(--font-size-0);
393
- grid-column: 1;
394
- grid-row: 2;
395
- line-height: 1.5;
396
- }
397
-
398
- .ui-field {
399
- align-self: start;
400
- grid-column: 2;
401
- grid-row: 1 / span 2;
402
- }
403
-
404
- .ui-field:has(textarea) {
405
- grid-row: 1 / span 3;
406
-
407
- +.ui-end-text {
408
- grid-row: 4;
409
- }
410
- }
411
-
412
- :where(textarea) {
413
- min-inline-size: 30ch;
414
- }
415
-
416
- :where(.ui-end-text) {
417
- grid-column: 2;
418
- text-align: end;
419
- }
420
-
421
- /* Collapse to column on narrow containers */
422
- @container (width < 400px) {
423
- column-gap: 0;
424
- grid-template-columns: 1fr;
425
-
426
- .ui-label {
427
- grid-column: 1;
428
- grid-row: 1;
429
- }
430
-
431
- .ui-start-text {
432
- grid-column: 1;
433
- grid-row: 2;
434
- }
435
-
436
- .ui-field,
437
- .ui-field:has(textarea) {
438
- grid-column: 1;
439
- grid-row: 3;
440
- }
441
-
442
- :where(.ui-end-text) {
443
- grid-column: 1;
444
- grid-row: 4;
445
- text-align: start;
446
- }
447
- }
448
- }
449
- }
450
- }
1
+ @layer components.extended {
2
+
3
+ /*
4
+ - Common styling for input, textarea and select
5
+ - Form related styles such as: label, supporting text, error handling
6
+ */
7
+ :where(.ui-text-field, .ui-textarea, .ui-select) {
8
+ --_accent-color: var(--primary);
9
+ --_bg-color: var(--surface-default);
10
+ --_border-color: var(--field-border-color);
11
+ --_field-padding-block: var(--size-2);
12
+ --_field-padding-inline: var(--size-2);
13
+ --_filled-border-color: var(--text-primary);
14
+ --_height: var(--field-size);
15
+ --_label-color: var(--text-muted);
16
+ --_end-text-color: var(--text-muted);
17
+
18
+ display: grid;
19
+ gap: var(--size-1) 0;
20
+ position: relative;
21
+
22
+ /* Field - the actual input with a border around it */
23
+ .ui-field {
24
+ background-color: var(--_bg-color);
25
+ border: var(--field-border-width) solid var(--_border-color);
26
+ border-radius: var(--field-border-radius);
27
+ display: grid;
28
+ grid-column: 1/-1;
29
+ grid-row: 2;
30
+ grid-template-columns: auto 1fr auto;
31
+ grid-template-areas:
32
+ "header header header"
33
+ "prefix input suffix"
34
+ "footer footer footer";
35
+ min-block-size: var(--_height);
36
+
37
+ @media (prefers-reduced-motion: no-preference) {
38
+ transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
39
+ }
40
+ }
41
+
42
+ :where(.ui-field) :where(input, textarea, select) {
43
+ background: transparent;
44
+ border: 0;
45
+ color: var(--text-primary);
46
+ font-family: var(--font-sans);
47
+ font-size: var(--font-size-1);
48
+ grid-area: input;
49
+ inline-size: 100%;
50
+ line-height: var(--font-lineheight-1);
51
+ min-inline-size: 0;
52
+ padding: var(--_field-padding-block) var(--_field-padding-inline);
53
+
54
+ &:focus,
55
+ &:focus-visible {
56
+ outline: 0;
57
+ }
58
+ }
59
+
60
+ /* Affixes */
61
+ .ui-prefix,
62
+ .ui-suffix {
63
+ align-items: center;
64
+ color: var(--_label-color);
65
+ display: inline-flex;
66
+ padding-inline: var(--_field-padding-inline);
67
+ white-space: nowrap;
68
+ }
69
+
70
+ .ui-prefix {
71
+ grid-area: prefix;
72
+ }
73
+
74
+ .ui-suffix {
75
+ grid-area: suffix;
76
+ }
77
+
78
+ .ui-header,
79
+ .ui-footer {
80
+ align-items: center;
81
+ color: var(--_label-color);
82
+ display: flex;
83
+ font-size: var(--font-size-0);
84
+ gap: var(--size-2);
85
+ padding: var(--size-1) var(--_field-padding-inline);
86
+ }
87
+
88
+ .ui-header {
89
+ border-block-end: 1px solid var(--_border-color);
90
+ grid-area: header;
91
+ }
92
+
93
+ .ui-footer {
94
+ border-block-start: 1px solid var(--_border-color);
95
+ grid-area: footer;
96
+ }
97
+
98
+ /* Remove padding on the input when affixes are next to it */
99
+ .ui-field:has(> .ui-prefix) :where(input, textarea, select) {
100
+ padding-inline-start: 0;
101
+ }
102
+
103
+ .ui-field:has(> .ui-suffix) :where(input, textarea, select) {
104
+ padding-inline-end: 0;
105
+ }
106
+
107
+ /* Textarea - keep affix aligned with the first line */
108
+ &.ui-textarea .ui-field {
109
+
110
+ .ui-prefix,
111
+ .ui-suffix {
112
+ align-self: start;
113
+ padding-block: var(--_field-padding-block);
114
+ }
115
+ }
116
+
117
+ /* Required/Invalid */
118
+ &:has(:invalid) {
119
+ .ui-label:after {
120
+ color: var(--red);
121
+ content: "*";
122
+ margin: -0.25em auto auto 0.25em;
123
+ }
124
+ }
125
+
126
+ /* File */
127
+ &:has(input[type="file"]) {
128
+ cursor: pointer;
129
+
130
+ input {
131
+ align-self: flex-start;
132
+ block-size: var(--_height);
133
+ box-shadow: none;
134
+ color: var(--text-primary);
135
+ cursor: inherit;
136
+ max-inline-size: 100%;
137
+ padding: 0;
138
+ transition: font-size 0.2s var(--ease-3);
139
+
140
+ &::-webkit-file-upload-button,
141
+ &::file-selector-button {
142
+ background-color: var(--surface-tonal);
143
+ block-size: calc(100% - var(--size-2) * 2);
144
+ border: none;
145
+ border-radius: var(--field-border-radius);
146
+ cursor: pointer;
147
+ margin-block-start: var(--size-2);
148
+ margin-inline-end: 1ex;
149
+ margin-inline-start: var(--size-2);
150
+ }
151
+ }
152
+
153
+ /* Variants */
154
+ &.ui-filled {
155
+ input {
156
+
157
+ &::-webkit-file-upload-button,
158
+ &::file-selector-button {
159
+ background-color: var(--surface-default);
160
+ block-size: calc(100% - var(--size-2) * 2);
161
+ border-radius: var(--field-border-radius);
162
+ cursor: pointer;
163
+ margin-block-start: var(--size-2);
164
+ }
165
+ }
166
+ }
167
+
168
+ /* Sizes */
169
+ &.ui-small {
170
+ input {
171
+ font-size: var(--font-size-05);
172
+
173
+ &::-webkit-file-upload-button,
174
+ &::file-selector-button {
175
+ block-size: calc(100% - var(--size-2));
176
+ margin-block-start: var(--size-1);
177
+ }
178
+ }
179
+ }
180
+ }
181
+
182
+ /* Autosuggest */
183
+ &:has(input[list]) {
184
+ .ui-label {
185
+ /* Make sure chevron is visible */
186
+ inline-size: calc(100% - var(--size-6));
187
+ }
188
+ }
189
+
190
+ /* Select */
191
+ &:has(select) {
192
+ .ui-label {
193
+ /* Make sure chevron is visible */
194
+ inline-size: calc(100% - var(--size-6));
195
+
196
+ }
197
+ }
198
+
199
+ /* Customizable Select */
200
+ &:has(select button) {
201
+ select {
202
+ padding: 0;
203
+
204
+ button {
205
+ outline: 0;
206
+ padding: var(--_field-padding-block) var(--size-8) var(--_field-padding-block) var(--_field-padding-inline);
207
+ }
208
+ }
209
+ }
210
+
211
+ /* Non-customizable Select */
212
+ &:has(select):not(:has(button)) {
213
+ select {
214
+ padding: var(--_field-padding-block) var(--size-8) var(--_field-padding-block) var(--_field-padding-inline);
215
+ }
216
+ }
217
+
218
+ /* Input - color */
219
+ &:has(input[type="color"]) {
220
+ .ui-field {
221
+ block-size: var(--_height);
222
+ inline-size: var(--_height);
223
+ min-block-size: 0;
224
+ overflow: hidden;
225
+ }
226
+
227
+ input {
228
+ appearance: none;
229
+ background: none;
230
+ block-size: var(--_height);
231
+ inline-size: var(--_height);
232
+ overflow: hidden;
233
+ padding: 0;
234
+
235
+ &::-webkit-color-swatch {
236
+ border: none;
237
+ }
238
+
239
+ &::-webkit-color-swatch-wrapper {
240
+ padding: 0;
241
+ }
242
+ }
243
+ }
244
+
245
+ /* Element states */
246
+ &:hover {
247
+ &:not([data-invalid]) {
248
+ .ui-field {
249
+ border-color: var(--text-primary);
250
+ }
251
+ }
252
+ }
253
+
254
+ &:focus-within {
255
+ .ui-field {
256
+ border-color: var(--_accent-color);
257
+ outline-offset: -2px;
258
+ }
259
+ }
260
+
261
+ /* Label */
262
+ .ui-label {
263
+ color: var(--text-primary);
264
+ font-size: var(--font-size-05);
265
+ font-weight: 600;
266
+ grid-column: 1/-1;
267
+ grid-row: 1;
268
+ padding-inline: 0 1ex;
269
+ }
270
+
271
+ /* End text */
272
+ :where(.ui-end-text) {
273
+ color: var(--_end-text-color);
274
+ font-size: var(--font-size-0);
275
+ grid-column: 1/-1;
276
+ grid-row: 3;
277
+ line-height: 1.5;
278
+ }
279
+
280
+ /* Auto-fit */
281
+ &.ui-auto-fit {
282
+ inline-size: auto;
283
+
284
+ .ui-field {
285
+ inline-size: auto;
286
+ }
287
+
288
+ :where(& input, & textarea) {
289
+ field-sizing: content;
290
+ inline-size: auto;
291
+ min-inline-size: 25ch;
292
+ }
293
+ }
294
+
295
+ /* Validation */
296
+ &[data-invalid],
297
+ &:has(:user-invalid) {
298
+ --_accent-color: var(--color-9);
299
+ --_border-color: var(--color-9);
300
+ --_filled-border-color: var(--color-9);
301
+ --_label-color: var(--color-9);
302
+ --_end-text-color: var(--color-9);
303
+ }
304
+
305
+ /*
306
+ * Variant: Filled
307
+ */
308
+ &.ui-filled {
309
+ --_bg-color: var(--surface-tonal);
310
+
311
+ &:not(:has([disabled], :has(input[type="color"]))) {
312
+
313
+ /* Hover */
314
+ &:hover {
315
+ --_bg-color: light-dark(oklch(from var(--surface-tonal) calc(l * 0.93) c h),
316
+ oklch(from var(--surface-tonal) calc(l * 1.1) c h));
317
+ }
318
+ }
319
+ }
320
+
321
+ /* Disabled */
322
+ &:where(:has([disabled])) {
323
+ cursor: not-allowed;
324
+ opacity: 0.64;
325
+ user-select: none;
326
+
327
+ &::before {
328
+ display: none;
329
+ }
330
+
331
+ .ui-field {
332
+ cursor: not-allowed;
333
+ }
334
+
335
+ :where(input, textarea, select) {
336
+ cursor: not-allowed;
337
+
338
+ * {
339
+ pointer-events: none;
340
+ }
341
+ }
342
+
343
+ .ui-label,
344
+ .ui-start-text,
345
+ .ui-end-text {
346
+ cursor: not-allowed;
347
+ }
348
+ }
349
+
350
+ /* Read-only */
351
+ &:where(:has([readonly])) {
352
+ &::before {
353
+ display: none;
354
+ }
355
+
356
+ :where(input, textarea, select) {
357
+ cursor: not-allowed;
358
+
359
+ * {
360
+ pointer-events: none;
361
+ }
362
+ }
363
+ }
364
+
365
+ /* Sizes */
366
+ &.ui-small {
367
+ --_field-padding-block: var(--size-2);
368
+ --_height: var(--field-size-small);
369
+
370
+ &:has(input[type="color"]) {
371
+ .ui-label {
372
+ line-height: 1.5;
373
+ }
374
+ }
375
+ }
376
+
377
+ /* Orientation */
378
+ &.ui-spread {
379
+ align-items: start;
380
+ column-gap: var(--size-4);
381
+ container-type: inline-size;
382
+ grid-template-columns: 1fr auto;
383
+
384
+ .ui-label {
385
+ font-weight: 600;
386
+ grid-column: 1;
387
+ grid-row: 1;
388
+ }
389
+
390
+ .ui-start-text {
391
+ color: var(--_end-text-color);
392
+ font-size: var(--font-size-0);
393
+ grid-column: 1;
394
+ grid-row: 2;
395
+ line-height: 1.5;
396
+ }
397
+
398
+ .ui-field {
399
+ align-self: start;
400
+ grid-column: 2;
401
+ grid-row: 1 / span 2;
402
+ }
403
+
404
+ .ui-field:has(textarea) {
405
+ grid-row: 1 / span 3;
406
+
407
+ +.ui-end-text {
408
+ grid-row: 4;
409
+ }
410
+ }
411
+
412
+ :where(textarea) {
413
+ min-inline-size: 30ch;
414
+ }
415
+
416
+ :where(.ui-end-text) {
417
+ grid-column: 2;
418
+ text-align: end;
419
+ }
420
+
421
+ /* Collapse to column on narrow containers */
422
+ @container (width < 400px) {
423
+ column-gap: 0;
424
+ grid-template-columns: 1fr;
425
+
426
+ .ui-label {
427
+ grid-column: 1;
428
+ grid-row: 1;
429
+ }
430
+
431
+ .ui-start-text {
432
+ grid-column: 1;
433
+ grid-row: 2;
434
+ }
435
+
436
+ .ui-field,
437
+ .ui-field:has(textarea) {
438
+ grid-column: 1;
439
+ grid-row: 3;
440
+ }
441
+
442
+ :where(.ui-end-text) {
443
+ grid-column: 1;
444
+ grid-row: 4;
445
+ text-align: start;
446
+ }
447
+ }
448
+ }
449
+ }
450
+ }