opui-css 3.3.4 → 4.0.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 (174) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +105 -0
  4. package/README.md +66 -29
  5. package/astro/index.ts +46 -0
  6. package/components/AGENTS.md +247 -0
  7. package/components/Accordion/Accordion.astro +42 -0
  8. package/components/Anchor/Anchor.astro +51 -0
  9. package/components/Avatar/Avatar.astro +44 -0
  10. package/components/Badge/Badge.astro +54 -0
  11. package/components/Button/Button.astro +45 -0
  12. package/components/ButtonGroup/ButtonGroup.astro +29 -0
  13. package/components/Callout/Callout.astro +75 -0
  14. package/components/Card/Card.astro +38 -0
  15. package/components/Checkbox/Checkbox.astro +76 -0
  16. package/components/Checkbox/CheckboxInput.astro +32 -0
  17. package/components/Chip/Chip.astro +37 -0
  18. package/components/ClassicSelect/ClassicSelect.astro +83 -0
  19. package/components/DescriptionList/Description.astro +12 -0
  20. package/components/DescriptionList/DescriptionList.astro +22 -0
  21. package/components/DescriptionList/Item.astro +12 -0
  22. package/components/DescriptionList/Term.astro +12 -0
  23. package/components/DescriptionList/index.ts +12 -0
  24. package/components/Dialog/Dialog.astro +43 -0
  25. package/components/Divider/Divider.astro +14 -0
  26. package/components/Drawer/Drawer.astro +49 -0
  27. package/components/Drawer/DrawerFooter.astro +14 -0
  28. package/components/Drawer/DrawerHeader.astro +31 -0
  29. package/components/FieldDescription/FieldDescription.astro +13 -0
  30. package/components/FieldGroup/FieldGroup.astro +31 -0
  31. package/components/FieldLegend/FieldLegend.astro +15 -0
  32. package/components/FieldSet/FieldSet.astro +15 -0
  33. package/components/Form/Form.astro +15 -0
  34. package/components/IconButton/IconButton.astro +26 -0
  35. package/components/List/List.astro +36 -0
  36. package/components/ListItem/ListItem.astro +118 -0
  37. package/components/Progress/Progress.astro +40 -0
  38. package/components/Radio/Radio.astro +70 -0
  39. package/components/Radio/RadioInput.astro +24 -0
  40. package/components/Range/Range.astro +136 -0
  41. package/components/Select/Select.astro +106 -0
  42. package/components/Switch/Switch.astro +101 -0
  43. package/components/Switch/SwitchInput.astro +25 -0
  44. package/components/Table/Body.astro +13 -0
  45. package/components/Table/Cell.astro +13 -0
  46. package/components/Table/Column.astro +15 -0
  47. package/components/Table/ColumnGroup.astro +13 -0
  48. package/components/Table/Head.astro +13 -0
  49. package/components/Table/HeaderCell.astro +13 -0
  50. package/components/Table/Row.astro +13 -0
  51. package/components/Table/Table.astro +15 -0
  52. package/components/Table/index.ts +20 -0
  53. package/components/Tabs/Tabs.astro +28 -0
  54. package/components/Tabs/TabsItem.astro +47 -0
  55. package/components/Tabs/TabsPanel.astro +21 -0
  56. package/components/Tabs/TabsTab.astro +19 -0
  57. package/components/Tabs/index.ts +14 -0
  58. package/components/TextField/TextField.astro +128 -0
  59. package/components/Textarea/Textarea.astro +106 -0
  60. package/components/Toast/Toast.astro +42 -0
  61. package/components/ToggleButton/ToggleButton.astro +53 -0
  62. package/components/ToggleGroup/ToggleGroup.astro +49 -0
  63. package/components/Tooltip/Tooltip.astro +30 -0
  64. package/{src/core → core}/normalize.css +194 -196
  65. package/core/palette.css +59 -0
  66. package/{src/core → core}/utils.css +71 -60
  67. package/css/components/accordion.css +174 -0
  68. package/css/components/anchor.css +27 -0
  69. package/{src/themes/theme-two → css}/components/avatar.css +65 -68
  70. package/css/components/badge.css +107 -0
  71. package/css/components/button-group.css +179 -0
  72. package/css/components/button.css +215 -0
  73. package/css/components/callout.css +109 -0
  74. package/css/components/card.css +117 -0
  75. package/css/components/checkbox.css +205 -0
  76. package/{src/themes/theme-one → css}/components/chip.css +87 -135
  77. package/{src/themes/theme-two/components/definition-list.css → css/components/description-list.css} +77 -68
  78. package/{src/themes/theme-two → css}/components/dialog.css +68 -59
  79. package/css/components/divider.css +20 -0
  80. package/css/components/drawer.css +171 -0
  81. package/css/components/form.css +146 -0
  82. package/css/components/icon-button.css +139 -0
  83. package/{src/themes/theme-two → css}/components/link.css +21 -21
  84. package/{src/themes/theme-two → css}/components/list.css +345 -318
  85. package/{src/themes/theme-one → css}/components/progress.css +97 -83
  86. package/css/components/radio.css +172 -0
  87. package/css/components/range.css +337 -0
  88. package/{src/themes/theme-two → css}/components/select.css +169 -162
  89. package/{src/themes/theme-two → css}/components/spinner.css +37 -38
  90. package/{src/themes/theme-two → css}/components/switch.css +268 -225
  91. package/css/components/table.css +179 -0
  92. package/css/components/tabs.css +77 -0
  93. package/css/components/text-field.css +450 -0
  94. package/css/components/text-input.css +53 -0
  95. package/{src/themes/theme-two → css}/components/textarea.css +24 -25
  96. package/css/components/toast.css +161 -0
  97. package/css/components/toggle-button.css +87 -0
  98. package/css/components/toggle-group.css +56 -0
  99. package/css/components/tooltip.css +67 -0
  100. package/css/components/typography.css +585 -0
  101. package/{src/themes/theme-two → css}/components.css +41 -37
  102. package/{src/themes/theme-two → css}/imports.css +16 -16
  103. package/css/js/checkbox.js +21 -0
  104. package/css/js/toast.js +94 -0
  105. package/css/theme.css +132 -0
  106. package/dist/op.css +1001 -32
  107. package/dist/op.css.map +1 -0
  108. package/dist/opui.components.css +5135 -0
  109. package/dist/opui.components.css.map +1 -0
  110. package/dist/opui.css +6604 -0
  111. package/dist/opui.css.map +1 -0
  112. package/env.d.ts +14 -0
  113. package/open-props.css +9 -0
  114. package/package.json +64 -55
  115. package/dist/theme-one/components.css +0 -3869
  116. package/dist/theme-one/theme-one.css +0 -4424
  117. package/dist/theme-two/components.css +0 -3591
  118. package/dist/theme-two/theme-two.css +0 -4141
  119. package/src/open-props.css +0 -10
  120. package/src/themes/theme-one/components/accordion.css +0 -172
  121. package/src/themes/theme-one/components/alert.css +0 -85
  122. package/src/themes/theme-one/components/avatar.css +0 -68
  123. package/src/themes/theme-one/components/badge.css +0 -101
  124. package/src/themes/theme-one/components/button-group.css +0 -69
  125. package/src/themes/theme-one/components/button.css +0 -281
  126. package/src/themes/theme-one/components/card.css +0 -82
  127. package/src/themes/theme-one/components/checkbox-radio.css +0 -123
  128. package/src/themes/theme-one/components/definition-list.css +0 -68
  129. package/src/themes/theme-one/components/dialog.css +0 -59
  130. package/src/themes/theme-one/components/divider.css +0 -7
  131. package/src/themes/theme-one/components/field-group.css +0 -83
  132. package/src/themes/theme-one/components/field.css +0 -494
  133. package/src/themes/theme-one/components/icon-button.css +0 -40
  134. package/src/themes/theme-one/components/link.css +0 -21
  135. package/src/themes/theme-one/components/list.css +0 -318
  136. package/src/themes/theme-one/components/range.css +0 -121
  137. package/src/themes/theme-one/components/rich-text.css +0 -210
  138. package/src/themes/theme-one/components/select.css +0 -163
  139. package/src/themes/theme-one/components/snackbar.css +0 -148
  140. package/src/themes/theme-one/components/spinner.css +0 -38
  141. package/src/themes/theme-one/components/switch.css +0 -225
  142. package/src/themes/theme-one/components/tab-buttons.css +0 -120
  143. package/src/themes/theme-one/components/table.css +0 -92
  144. package/src/themes/theme-one/components/text-field.css +0 -57
  145. package/src/themes/theme-one/components/textarea.css +0 -25
  146. package/src/themes/theme-one/components/toggle-button-group.css +0 -135
  147. package/src/themes/theme-one/components/tooltip.css +0 -94
  148. package/src/themes/theme-one/components/typography.css +0 -209
  149. package/src/themes/theme-one/components.css +0 -37
  150. package/src/themes/theme-one/imports.css +0 -16
  151. package/src/themes/theme-one/theme.css +0 -163
  152. package/src/themes/theme-two/components/accordion.css +0 -172
  153. package/src/themes/theme-two/components/alert.css +0 -85
  154. package/src/themes/theme-two/components/badge.css +0 -101
  155. package/src/themes/theme-two/components/button-group.css +0 -50
  156. package/src/themes/theme-two/components/button.css +0 -229
  157. package/src/themes/theme-two/components/card.css +0 -82
  158. package/src/themes/theme-two/components/checkbox-radio.css +0 -123
  159. package/src/themes/theme-two/components/chip.css +0 -135
  160. package/src/themes/theme-two/components/divider.css +0 -7
  161. package/src/themes/theme-two/components/field-group.css +0 -83
  162. package/src/themes/theme-two/components/field.css +0 -281
  163. package/src/themes/theme-two/components/icon-button.css +0 -40
  164. package/src/themes/theme-two/components/progress.css +0 -83
  165. package/src/themes/theme-two/components/range.css +0 -121
  166. package/src/themes/theme-two/components/rich-text.css +0 -210
  167. package/src/themes/theme-two/components/snackbar.css +0 -148
  168. package/src/themes/theme-two/components/tab-buttons.css +0 -120
  169. package/src/themes/theme-two/components/table.css +0 -99
  170. package/src/themes/theme-two/components/text-field.css +0 -57
  171. package/src/themes/theme-two/components/toggle-button-group.css +0 -135
  172. package/src/themes/theme-two/components/tooltip.css +0 -94
  173. package/src/themes/theme-two/components/typography.css +0 -209
  174. package/src/themes/theme-two/theme.css +0 -158
@@ -0,0 +1,77 @@
1
+ @layer components.root {
2
+ :where(.tabs) {
3
+ --_accent-color: var(--primary);
4
+ --_bg-color: transparent;
5
+
6
+ align-items: flex-start;
7
+ display: flex;
8
+ flex-wrap: wrap;
9
+ gap: 0 var(--size-1);
10
+ position: relative;
11
+
12
+ &>.tab-input[type="radio"] {
13
+ /* utils > .sr-only */
14
+ /* TODO: use mixin for this when available */
15
+ block-size: 1px;
16
+ clip-path: inset(50%);
17
+ inline-size: 1px;
18
+ overflow: hidden;
19
+ position: absolute;
20
+ white-space: nowrap;
21
+
22
+ &:checked {
23
+
24
+ /* Checked Tab */
25
+ &+[role="tab"] {
26
+ border-block-end-color: var(--_accent-color);
27
+ color: var(--_accent-color);
28
+
29
+ /* Checked Panel */
30
+ &+[role="tabpanel"] {
31
+ display: block;
32
+ }
33
+ }
34
+ }
35
+
36
+ &:focus-visible {
37
+ &+[role="tab"] {
38
+ --focus-ring-color: var(--text-muted);
39
+ --focus-ring-offset: calc(-1 * var(--size-2));
40
+ outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
41
+ outline-offset: var(--focus-ring-offset);
42
+ }
43
+ }
44
+ }
45
+
46
+ /* Tab */
47
+ &>[role="tab"] {
48
+ align-items: center;
49
+ background-color: transparent;
50
+ border-bottom: 2px solid transparent;
51
+ border-radius: 0;
52
+ color: var(--text-muted);
53
+ cursor: pointer;
54
+ display: inline-flex;
55
+ font-weight: 600;
56
+ justify-content: center;
57
+ line-height: var(--font-lineheight-4);
58
+ order: 1;
59
+ padding: var(--size-2) var(--size-3);
60
+ position: relative;
61
+ transition: color 0.1s;
62
+ user-select: none;
63
+
64
+ &:hover {
65
+ background-color: light-dark(oklch(from var(--_accent-color) calc(l * 0.75) none h / 5%),
66
+ oklch(from var(--_accent-color) calc(l * 1.25) none h / 5%));
67
+ }
68
+ }
69
+
70
+ /* Tab Panel */
71
+ &>[role="tabpanel"] {
72
+ display: none;
73
+ inline-size: 100%;
74
+ order: 2;
75
+ }
76
+ }
77
+ }
@@ -0,0 +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(.text-field, .textarea, .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
+ .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(.field input, .field textarea, .field 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
+ .prefix,
62
+ .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
+ .prefix {
71
+ grid-area: prefix;
72
+ }
73
+
74
+ .suffix {
75
+ grid-area: suffix;
76
+ }
77
+
78
+ .header,
79
+ .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
+ .header {
89
+ border-block-end: 1px solid var(--_border-color);
90
+ grid-area: header;
91
+ }
92
+
93
+ .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
+ .field:has(> .prefix) :where(input, textarea, select) {
100
+ padding-inline-start: 0;
101
+ }
102
+
103
+ .field:has(> .suffix) :where(input, textarea, select) {
104
+ padding-inline-end: 0;
105
+ }
106
+
107
+ /* Textarea - keep affix aligned with the first line */
108
+ &.textarea .field {
109
+
110
+ .prefix,
111
+ .suffix {
112
+ align-self: start;
113
+ padding-block: var(--_field-padding-block);
114
+ }
115
+ }
116
+
117
+ /* Required/Invalid */
118
+ &:has(:invalid) {
119
+ .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
+ &.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
+ &.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
+ .label {
185
+ /* Make sure chevron is visible */
186
+ inline-size: calc(100% - var(--size-6));
187
+ }
188
+ }
189
+
190
+ /* Select */
191
+ &:has(select) {
192
+ .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
+ .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
+ .field {
249
+ border-color: var(--text-primary);
250
+ }
251
+ }
252
+ }
253
+
254
+ &:focus-within {
255
+ .field {
256
+ border-color: var(--_accent-color);
257
+ outline-offset: -2px;
258
+ }
259
+ }
260
+
261
+ /* Label */
262
+ .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(.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
+ &.auto-fit {
282
+ inline-size: auto;
283
+
284
+ .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
+ &.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
+ .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
+ .label,
344
+ .start-text,
345
+ .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
+ &.small {
367
+ --_field-padding-block: var(--size-2);
368
+ --_height: var(--field-size-small);
369
+
370
+ &:has(input[type="color"]) {
371
+ .label {
372
+ line-height: 1.5;
373
+ }
374
+ }
375
+ }
376
+
377
+ /* Orientation */
378
+ &.spread {
379
+ align-items: start;
380
+ column-gap: var(--size-4);
381
+ container-type: inline-size;
382
+ grid-template-columns: 1fr auto;
383
+
384
+ .label {
385
+ font-weight: 600;
386
+ grid-column: 1;
387
+ grid-row: 1;
388
+ }
389
+
390
+ .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
+ .field {
399
+ align-self: start;
400
+ grid-column: 2;
401
+ grid-row: 1 / span 2;
402
+ }
403
+
404
+ .field:has(textarea) {
405
+ grid-row: 1 / span 3;
406
+
407
+ +.end-text {
408
+ grid-row: 4;
409
+ }
410
+ }
411
+
412
+ :where(textarea) {
413
+ min-inline-size: 30ch;
414
+ }
415
+
416
+ :where(.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
+ .label {
427
+ grid-column: 1;
428
+ grid-row: 1;
429
+ }
430
+
431
+ .start-text {
432
+ grid-column: 1;
433
+ grid-row: 2;
434
+ }
435
+
436
+ .field,
437
+ .field:has(textarea) {
438
+ grid-column: 1;
439
+ grid-row: 3;
440
+ }
441
+
442
+ :where(.end-text) {
443
+ grid-column: 1;
444
+ grid-row: 4;
445
+ text-align: start;
446
+ }
447
+ }
448
+ }
449
+ }
450
+ }
@@ -0,0 +1,53 @@
1
+ @layer components.extended {
2
+
3
+ :where(.text-field:has( :where(input[type="date"],
4
+ input[type="datetime-local"],
5
+ input[type="email"],
6
+ input[type="month"],
7
+ input[type="number"],
8
+ input[type="password"],
9
+ input[type="search"],
10
+ input[type="tel"],
11
+ input[type="text"],
12
+ input[type="time"],
13
+ input[type="url"],
14
+ input[type="week"]))) {
15
+
16
+ /* Sizes */
17
+ &.small {
18
+ input {
19
+ padding-inline: var(--size-2);
20
+ }
21
+ }
22
+ }
23
+
24
+ /* Autosuggest */
25
+ :where(.text-field:has(input[list])) {
26
+
27
+ /* Hide native arrow */
28
+ input::-webkit-calendar-picker-indicator {
29
+ cursor: pointer;
30
+ opacity: 0;
31
+ pointer-events: none;
32
+ position: absolute;
33
+ }
34
+ }
35
+
36
+ /* Arrow */
37
+ :where(.text-field:has(input[list]:placeholder-shown),
38
+ .text-field:has(input[list]):where(:focus-within, :hover)) {
39
+ &::after {
40
+ block-size: 0;
41
+ border-block-start: 5px solid;
42
+ border-inline: 5px solid transparent;
43
+ content: "";
44
+ display: inline-block;
45
+ flex-shrink: 0;
46
+ inline-size: 0;
47
+ inset: 50% var(--size-3) auto auto;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ translate: 0 -50%;
51
+ }
52
+ }
53
+ }
@@ -1,25 +1,24 @@
1
- @layer components.extended {
2
- :where(.field:has(textarea)) {
3
- textarea {
4
- block-size: auto;
5
- field-sizing: content;
6
- min-block-size: 5rem;
7
- resize: vertical;
8
- }
9
-
10
- /* Size */
11
- &.small {
12
- textarea {
13
- min-block-size: var(--_height);
14
- }
15
- }
16
-
17
- /* Auto-fit */
18
- &.auto-fit {
19
- textarea {
20
- min-block-size: var(--_height);
21
- resize: both;
22
- }
23
- }
24
- }
25
- }
1
+ @layer components.extended {
2
+ :where(.textarea) {
3
+ textarea {
4
+ block-size: auto;
5
+ field-sizing: content;
6
+ min-block-size: calc(var(--_field-padding-block) * 2 + (var(--border-width) * 2) + 3lh);
7
+ resize: vertical;
8
+ }
9
+
10
+ /* Size */
11
+ &.small {
12
+ textarea {
13
+ min-block-size: var(--size-9);
14
+ }
15
+ }
16
+
17
+ /* Auto-fit */
18
+ &.auto-fit {
19
+ textarea {
20
+ resize: both;
21
+ }
22
+ }
23
+ }
24
+ }