@mistriwork/ui 1.0.0-rc.58 → 1.0.0-rc.60

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 (122) hide show
  1. package/README.md +46 -12
  2. package/dist/Avatar.js +3 -3
  3. package/dist/Button.d.ts +4 -14
  4. package/dist/Button.js +26 -13
  5. package/dist/Carousel.d.ts +6 -5
  6. package/dist/Carousel.js +58 -67
  7. package/dist/Choices.d.ts +2 -9
  8. package/dist/Choices.js +127 -64
  9. package/dist/DateField.d.ts +9 -4
  10. package/dist/DateField.js +102 -119
  11. package/dist/Drawer.d.ts +1 -19
  12. package/dist/Drawer.js +8 -9
  13. package/dist/DropMenu.d.ts +8 -21
  14. package/dist/DropMenu.js +84 -30
  15. package/dist/Dropdown.d.ts +9 -8
  16. package/dist/Dropdown.js +69 -65
  17. package/dist/Field.d.ts +2 -1
  18. package/dist/Field.js +12 -18
  19. package/dist/FileField.d.ts +3 -10
  20. package/dist/FileField.js +12 -9
  21. package/dist/FormParts.d.ts +17 -10
  22. package/dist/FormParts.js +26 -41
  23. package/dist/HeroBlocks.d.ts +7 -3
  24. package/dist/HeroBlocks.js +11 -6
  25. package/dist/Modal.d.ts +6 -17
  26. package/dist/Modal.js +90 -21
  27. package/dist/Pagination.d.ts +1 -12
  28. package/dist/Pagination.js +17 -3
  29. package/dist/Popover.d.ts +1 -15
  30. package/dist/Popover.js +10 -15
  31. package/dist/Resizable.d.ts +3 -21
  32. package/dist/Resizable.js +14 -91
  33. package/dist/ScrollArea.d.ts +4 -2
  34. package/dist/ScrollArea.js +11 -11
  35. package/dist/Select.d.ts +1 -6
  36. package/dist/Select.js +16 -7
  37. package/dist/SensitiveField.d.ts +1 -8
  38. package/dist/SensitiveField.js +6 -4
  39. package/dist/Slider.d.ts +1 -5
  40. package/dist/Slider.js +13 -5
  41. package/dist/Switch.d.ts +1 -11
  42. package/dist/Switch.js +10 -9
  43. package/dist/Tabs.d.ts +3 -3
  44. package/dist/Tabs.js +3 -3
  45. package/dist/TextArea.d.ts +4 -6
  46. package/dist/TextArea.js +14 -5
  47. package/dist/TextField.d.ts +5 -9
  48. package/dist/TextField.js +67 -9
  49. package/dist/Tooltip.d.ts +1 -21
  50. package/dist/Tooltip.js +13 -31
  51. package/dist/Typeahead.d.ts +15 -18
  52. package/dist/Typeahead.js +151 -86
  53. package/dist/UiKit.d.ts +63 -4
  54. package/dist/UiKit.js +46 -5
  55. package/dist/behaviors/DaysParts.js +28 -0
  56. package/dist/behaviors/EditableParts.js +21 -0
  57. package/dist/behaviors/PickParts.js +30 -0
  58. package/dist/behaviors/ScrubParts.js +21 -0
  59. package/dist/behaviors/SortableParts.js +32 -0
  60. package/dist/behaviors/SpansParts.js +12 -0
  61. package/dist/behaviors/TransferParts.js +37 -0
  62. package/dist/behaviors/TurnsParts.js +31 -0
  63. package/dist/behaviors/WidthsParts.js +27 -0
  64. package/dist/behaviors/days.js +216 -0
  65. package/dist/behaviors/dress.js +86 -0
  66. package/dist/behaviors/editable.js +104 -0
  67. package/dist/behaviors/heard.js +22 -0
  68. package/dist/behaviors/index.d.ts +310 -0
  69. package/dist/behaviors/index.js +44 -0
  70. package/dist/behaviors/pick.js +158 -0
  71. package/dist/behaviors/scrub.js +152 -0
  72. package/dist/behaviors/sortable.js +170 -0
  73. package/dist/behaviors/spans.js +240 -0
  74. package/dist/behaviors/testing.js +48 -0
  75. package/dist/behaviors/transfer.js +202 -0
  76. package/dist/behaviors/turns.js +106 -0
  77. package/dist/behaviors/widths.js +150 -0
  78. package/dist/behaviors.css +309 -0
  79. package/dist/changeDetails.d.ts +4 -8
  80. package/dist/changeDetails.js +0 -6
  81. package/dist/conformance.js +107 -1
  82. package/dist/controls.css +36 -0
  83. package/dist/fieldFrame.d.ts +2 -15
  84. package/dist/fieldFrame.js +1 -17
  85. package/dist/index.d.ts +6 -5
  86. package/dist/index.js +6 -5
  87. package/dist/internal/Frame.d.ts +6 -0
  88. package/dist/internal/Frame.js +25 -0
  89. package/dist/internal/HelpTip.d.ts +5 -0
  90. package/dist/internal/HelpTip.js +37 -0
  91. package/dist/internal/layers.d.ts +21 -0
  92. package/dist/internal/layers.js +66 -0
  93. package/dist/internal/popups.d.ts +12 -10
  94. package/dist/internal/popups.js +18 -14
  95. package/dist/internal/told.d.ts +14 -0
  96. package/dist/internal/told.js +20 -0
  97. package/dist/internal/uiKitContext.js +6 -4
  98. package/dist/preferences.css +2 -3
  99. package/dist/style.css +5 -16
  100. package/dist/styles/extras.css +463 -0
  101. package/dist/styles/forms.css +346 -0
  102. package/dist/styles/guard.css +114 -0
  103. package/dist/styles/kit-fields.css +181 -0
  104. package/dist/styles/kit-parts.css +130 -0
  105. package/dist/styles/kit.css +558 -0
  106. package/dist/styles/layers.css +4 -0
  107. package/dist/styles/looks.css +374 -0
  108. package/dist/styles/m-tokens.css +173 -0
  109. package/dist/styles/overlays.css +107 -0
  110. package/dist/styles/parts.css +456 -0
  111. package/dist/styles/screens.css +76 -0
  112. package/dist/styles/ui-sdk.css +1635 -0
  113. package/dist/tokens.css +15 -4
  114. package/dist/uiKitSlots.d.ts +1 -1
  115. package/dist/uiKitSlots.js +18 -2
  116. package/package.json +13 -11
  117. package/dist/forms.css +0 -225
  118. package/dist/hero.css +0 -23
  119. package/dist/internal/anchor.d.ts +0 -19
  120. package/dist/internal/anchor.js +0 -52
  121. package/dist/primitives.css +0 -200
  122. package/dist/standalone.css +0 -478
@@ -0,0 +1,346 @@
1
+ /* Forms: label over value, the hint under it, pairs side by side, sections named beside their fields. */
2
+ @layer m-components {
3
+
4
+ [data-slot='field'] :is([data-slot='select-trigger'], [data-slot='date-picker'], [data-slot='number-input']) {
5
+ width: 100%;
6
+ }
7
+
8
+ /* The word is on every field that need not be answered, and seen where the page asked for it. A theme that
9
+ marks the optional ones and not the required shows it on all of them (theme/looks.css, `required`). */
10
+ [data-slot='field-optional']:not([data-said]) {
11
+ display: none;
12
+ }
13
+
14
+ [data-slot='field-optional'] {
15
+ margin-inline-start: var(--m-space-2h);
16
+ color: var(--m-ink-subtle);
17
+ font-size: var(--m-size-xs);
18
+ line-height: var(--m-lead-xs);
19
+ font-weight: var(--m-weight-regular);
20
+ }
21
+
22
+ /* A setting: its words, then the switch at the row's end. Rows are ruled apart, not boxed. */
23
+ [data-slot='field'][data-kind='setting'] {
24
+ flex-direction: row;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ gap: var(--m-space-6);
28
+
29
+ & + [data-kind='setting'] {
30
+ padding-block-start: var(--m-space-5);
31
+ border-block-start: 1px solid var(--m-line);
32
+ }
33
+
34
+ & > div {
35
+ display: flex;
36
+ flex-direction: column;
37
+ gap: var(--m-space-1);
38
+ }
39
+
40
+ & [data-slot='switch'] {
41
+ flex: none;
42
+ margin: 0;
43
+ }
44
+ }
45
+
46
+ [data-slot='field'][data-kind='check'] {
47
+ flex-direction: row;
48
+ align-items: flex-start;
49
+ gap: var(--m-space-3h);
50
+
51
+ & > div {
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: var(--m-space-1);
55
+ }
56
+ }
57
+
58
+ /* One of a few: each choice is a card, and the chosen one wears the accent's edge and wash. The radio covers
59
+ its card, so the whole card is the target and the ring is drawn on the card. */
60
+ [data-slot='radio-group'][data-kind='cards'] {
61
+ display: grid;
62
+ gap: var(--m-space-3);
63
+
64
+ & [data-slot='choice'] {
65
+ position: relative;
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: var(--m-space-1);
69
+ padding: var(--m-space-3) var(--m-space-4);
70
+ border: 1px solid var(--m-line-control);
71
+ border-radius: var(--m-radius);
72
+ background: var(--m-surface);
73
+ cursor: pointer;
74
+ transition:
75
+ background-color var(--m-fast),
76
+ border-color var(--m-fast);
77
+
78
+ &:hover {
79
+ background: var(--m-raised);
80
+ }
81
+
82
+ &:has([data-slot='radio'][data-checked]) {
83
+ border-color: var(--m-accent);
84
+ background: var(--m-accent-soft);
85
+ box-shadow: inset 0 0 0 1px var(--m-accent);
86
+ }
87
+
88
+ &:has([data-slot='radio']:focus-visible) {
89
+ outline: 2px solid var(--ui-ring);
90
+ outline-offset: 2px;
91
+ }
92
+ }
93
+
94
+ & [data-slot='radio'] {
95
+ position: absolute;
96
+ inset: 0;
97
+ width: auto;
98
+ height: auto;
99
+ margin: 0;
100
+ border: 0;
101
+ border-radius: inherit;
102
+ background: none;
103
+ opacity: 0;
104
+ /* The card is the radio's label, which hands a press on to it: the cover is there for the keyboard's ring
105
+ and takes no pointer, so the words under it are still what is pressed (and what a test presses). */
106
+ pointer-events: none;
107
+ }
108
+
109
+ & [data-slot='choice-label'] {
110
+ font-weight: var(--m-weight-strong);
111
+ }
112
+
113
+ & [data-slot='choice-hint'] {
114
+ color: var(--m-ink-muted);
115
+ font-size: var(--m-size-xs);
116
+ line-height: var(--m-lead-xs);
117
+ }
118
+
119
+ /* A card says it is one of a few with a round mark at its end, as a card of several says it with a square
120
+ (kit-fields.css): empty until chosen, then the accent's with a dot. Without it a row of unchosen cards read
121
+ as buttons, and nothing told one answer from several. A pick (a row of words, a pair) is a button and has
122
+ none. The mark is drawn on the card, under the radio that covers it: as its `::before`, since on a coarse
123
+ pointer UI SDK takes the `::after` of a label that holds a radio for the label's touch target, and a mark
124
+ drawn there was moved onto the card's icon on every phone. */
125
+ &:not([data-fit='row'], [data-fit='pair'], [data-shape='pair']) [data-slot='choice'] {
126
+ padding-inline-end: calc(var(--m-space-4) + 1.125rem + var(--m-space-3));
127
+
128
+ &::before {
129
+ content: '';
130
+ position: absolute;
131
+ inset-block-start: var(--m-space-3);
132
+ inset-inline-end: var(--m-space-4);
133
+ box-sizing: border-box;
134
+ width: 1.125rem;
135
+ height: 1.125rem;
136
+ border: 1.5px solid var(--m-line-control);
137
+ border-radius: 50%;
138
+ background: var(--m-surface);
139
+ transition:
140
+ background-color var(--m-fast),
141
+ border-color var(--m-fast);
142
+ }
143
+
144
+ &:has([data-slot='radio'][data-checked])::before {
145
+ border-color: var(--m-accent);
146
+ background: radial-gradient(circle, var(--m-on-accent) 0 0.1875rem, var(--m-accent) 0.21875rem);
147
+ }
148
+ }
149
+ }
150
+
151
+ /* The bar at the foot of what it ends. It sticks there, so on a step longer than the window the way on is still
152
+ in reach, and it stays in its own container, so the page keeps its sidebar. Its ground is the surface's, with a
153
+ rule over it, because what scrolls under it has to end somewhere. */
154
+ [data-slot='action-bar'] {
155
+ position: sticky;
156
+ inset-block-end: 0;
157
+ z-index: 2;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: flex-end;
161
+ gap: var(--m-space-3);
162
+ padding: var(--m-space-4) var(--m-space-5);
163
+ border-block-start: 1px solid var(--m-line);
164
+ background: var(--m-surface);
165
+ }
166
+
167
+ /* On a phone the primary takes the row: a thumb finds it without aiming. */
168
+ @media (max-width: 40rem) {
169
+ [data-slot='action-bar'] > [data-slot='button'][data-variant='solid'] {
170
+ flex: 1;
171
+ }
172
+ }
173
+
174
+ /* What must be answered: a mark in the critical tone beside the label, the word for it said to a screen reader. */
175
+ [data-slot='field-required'] {
176
+ margin-inline-start: var(--m-space-1);
177
+ color: var(--m-critical);
178
+ }
179
+
180
+ [data-slot='field-label'] [data-kind='help-tip'] {
181
+ margin-inline-start: var(--m-space-2h);
182
+ }
183
+
184
+ /* A label said and not drawn. */
185
+ [data-slot='field-label'][data-hidden] {
186
+ position: absolute;
187
+ width: 1px;
188
+ height: 1px;
189
+ overflow: hidden;
190
+ clip-path: inset(50%);
191
+ white-space: nowrap;
192
+ }
193
+
194
+ /* The line under a field: its hint or its problem at the start, how much has been typed at the end. */
195
+ [data-slot='field-under'] {
196
+ display: flex;
197
+ align-items: baseline;
198
+ justify-content: space-between;
199
+ gap: var(--m-space-4);
200
+
201
+ & > :first-child {
202
+ min-width: 0;
203
+ }
204
+ }
205
+
206
+ /* A line kept for a problem that is not there yet, so the form does not move when it comes. */
207
+ [data-slot='field-reserve'] {
208
+ display: block;
209
+ height: 1.25rem;
210
+ }
211
+
212
+ [data-slot='field-count'] {
213
+ flex: none;
214
+ color: var(--m-ink-subtle);
215
+ font-size: var(--m-size-xs);
216
+ line-height: var(--m-lead-xs);
217
+ font-variant-numeric: tabular-nums;
218
+
219
+ &[data-near] {
220
+ color: var(--m-warning);
221
+ }
222
+
223
+ &[data-full] {
224
+ color: var(--m-critical);
225
+ font-weight: var(--m-weight-strong);
226
+ }
227
+ }
228
+
229
+ /* A cross that empties the field stands inside its end, and only while there is something to empty. */
230
+ [data-slot='input-group'][data-kind='clearable'] {
231
+ position: relative;
232
+ display: flex;
233
+ flex: 1;
234
+
235
+ & [data-slot='input'] {
236
+ flex: 1;
237
+ padding-inline-end: var(--m-inset-icon);
238
+ }
239
+
240
+ & [data-slot='input-clear'] {
241
+ position: absolute;
242
+ inset-block: 0;
243
+ inset-inline-end: 0.375rem;
244
+ display: grid;
245
+ place-items: center;
246
+ width: 1.5rem;
247
+ height: 1.5rem;
248
+ margin-block: auto;
249
+ padding: 0;
250
+ border: 0;
251
+ border-radius: 999px;
252
+ background: transparent;
253
+ color: var(--m-ink-subtle);
254
+ cursor: pointer;
255
+
256
+ &:hover {
257
+ background: var(--m-raised);
258
+ color: var(--m-ink);
259
+ }
260
+
261
+ & svg {
262
+ width: 0.75rem;
263
+ height: 0.75rem;
264
+ }
265
+ }
266
+ }
267
+
268
+ /* A text area grows with what is typed, to a height past which it scrolls. */
269
+ [data-slot='textarea'] {
270
+ max-height: 16rem;
271
+ }
272
+
273
+ /* A row that does something rather than being chosen: set off by a rule, in the accent. */
274
+ [data-slot='select-item'][data-kind='action'] {
275
+ color: var(--m-accent-ink);
276
+ font-weight: var(--m-weight-strong);
277
+
278
+ &[data-first] {
279
+ margin-block-start: var(--m-space-2);
280
+ border-block-start: 1px solid var(--m-line);
281
+ border-start-start-radius: 0;
282
+ border-start-end-radius: 0;
283
+ padding-block-start: var(--m-space-2h);
284
+ }
285
+ }
286
+
287
+ /* The calendar's head and foot: the month between its two arrows, and today beside the way to empty the field. */
288
+ [data-slot='calendar-head'] {
289
+ display: flex;
290
+ align-items: center;
291
+ justify-content: space-between;
292
+ gap: var(--m-space-2);
293
+
294
+ & [data-slot='calendar-heading'] {
295
+ margin: 0;
296
+ font-size: inherit;
297
+ font-weight: var(--m-weight-strong);
298
+ letter-spacing: 0;
299
+ }
300
+ }
301
+
302
+ [data-slot='calendar-foot'] {
303
+ display: flex;
304
+ justify-content: space-between;
305
+ margin-block-start: var(--m-space-2h);
306
+ padding-block-start: var(--m-space-2h);
307
+ border-block-start: 1px solid var(--m-line)
308
+ }
309
+
310
+ [data-slot='slider-ends'] {
311
+ display: flex;
312
+ flex: 0 0 100%;
313
+ justify-content: space-between;
314
+ order: 3;
315
+ color: var(--m-ink-subtle);
316
+ font-size: var(--m-size-xs);
317
+ line-height: var(--m-lead-xs);
318
+ font-variant-numeric: tabular-nums;
319
+ }
320
+
321
+ /* A choice's icon stands before its words. */
322
+ [data-slot='choice-label'] {
323
+ display: inline-flex;
324
+ align-items: center;
325
+ gap: var(--m-space-3);
326
+
327
+ & svg {
328
+ flex: none;
329
+ width: 1rem;
330
+ height: 1rem;
331
+ color: var(--m-ink-muted);
332
+ }
333
+ }
334
+
335
+ @keyframes m-step {
336
+ from {
337
+ opacity: 0;
338
+ translate: 0.5rem 0;
339
+ }
340
+ }
341
+
342
+ /* A step's name takes the keyboard when the step changes, to be read out; it is not a control and wears no ring. */
343
+ [data-slot='step-header'] :is(h1, h2, h3):focus {
344
+ outline: 0;
345
+ }
346
+ }
@@ -0,0 +1,114 @@
1
+ /* What UI SDK says a second time when it is a guest on mistri's page.
2
+
3
+ mistri's stylesheets dress bare elements, by design: a look gives every `button` and `input` its corner
4
+ (`:root[data-visual-theme] button { border-radius }`), every `th` and `td` its padding, rule and face, and the
5
+ base sheet gives a `button` its padding. UI SDK's parts are those elements. What the base sheet says is under
6
+ this one and is only reset; what a look says is over it (`components` is under `look`), and the one way an
7
+ earlier layer keeps its word against a later one is to say it as important. So the corners and the table's
8
+ cells are said again here, important, and nothing else is.
9
+
10
+ This file is the cost of the seam as it stands, written out. It goes when mistri's looks leave what carries a
11
+ `data-slot` alone, or when UI SDK's parts are the ones the looks are written for. */
12
+ @layer m-guest {
13
+ button[data-slot] {
14
+ padding: 0;
15
+ }
16
+ }
17
+
18
+ @layer m-components {
19
+ /* A plain control's corner is not said here: the host gives its buttons and fields theirs by where they stand (a
20
+ theme's control corner, a form's field corner), and those rules name the parts. What is said is the parts whose
21
+ shape is not a control's, which a rule for every `button` and `input` would square or round with the rest. */
22
+ [data-slot='checkbox'] {
23
+ border-radius: calc(var(--ui-radius) / 2) !important;
24
+ }
25
+
26
+ /* A row in a menu may be a button, and a button's corner above would make it as round as a field: a row is a
27
+ row's corner, the host's where it names one. */
28
+ :is(button, a)[data-slot='menu-item'] {
29
+ border-radius: var(--radius-item, max(0px, calc(var(--ui-radius) - 2px))) !important;
30
+ }
31
+
32
+ [data-slot='radio'] {
33
+ border-radius: 50% !important;
34
+ }
35
+
36
+ [data-slot='switch'],
37
+ [data-slot='menu-trigger'][data-kind='filter-chip'] {
38
+ border-radius: 999px !important;
39
+ }
40
+
41
+ [data-slot='tabs-tab'],
42
+ [data-slot='button'][data-variant='bare'],
43
+ [data-slot='radio-group'][data-kind='cards'] [data-slot='radio'],
44
+ :is([data-slot='date-field'], [data-slot='adorned']) :is(input, button)[data-slot] {
45
+ border-radius: 0 !important;
46
+ }
47
+
48
+ :is([data-slot='calendar-previous'], [data-slot='calendar-next'], [data-slot='date-picker-trigger'], [data-slot='date-picker-clear']) {
49
+ border-radius: max(0px, calc(var(--ui-radius) - 2px)) !important;
50
+ }
51
+
52
+ [data-slot='popover-trigger'][data-kind='help-tip'] {
53
+ border-radius: 999px !important;
54
+ }
55
+
56
+ /* A form's bare input is given an edge and a height by mistri, and the date field a class of its own
57
+ (`insert-input`) with padding to match; the field is one box, and the input in it has none. */
58
+ [data-slot='date-field'] {
59
+ padding: 0 !important;
60
+
61
+ & [data-slot='input'] {
62
+ border: 0 !important;
63
+ background: transparent !important;
64
+ box-shadow: none !important;
65
+ }
66
+ }
67
+
68
+ /* A calendar's cells are sized by the calendar: a look gives its tables' cells room above and below their
69
+ words, and a month given that room is half as tall again. */
70
+ :is([data-slot='calendar-day'], [data-slot='calendar-weekday']) {
71
+ padding: 0 !important;
72
+ }
73
+
74
+ /* A calendar is a table too, and theirs makes a row's first cell its name, in the ink and heavier, with the
75
+ rest quiet. A week has no name: every day is said again as UI SDK says it, in the order it says them. */
76
+ [data-slot='calendar-day'] {
77
+ color: var(--m-ink) !important;
78
+ font-weight: var(--m-weight-regular) !important;
79
+
80
+ &[data-today] {
81
+ font-weight: var(--m-weight-bold) !important;
82
+ }
83
+
84
+ &:is([data-outside], [data-disabled], [data-unavailable]) {
85
+ color: var(--m-ink-muted) !important;
86
+ }
87
+
88
+ &:is([data-selected]:not([data-range-middle]), [data-range-start], [data-range-end]) {
89
+ color: var(--m-on-accent) !important;
90
+ }
91
+ }
92
+ }
93
+
94
+ /* A part its caller dresses whole (`data-own`: a menu's trigger given classes, which may be a tab, a grip, an icon in
95
+ a row) wears nothing of the control's own: every property goes back to the browser's, and the caller's rules, which
96
+ stand over these layers, are all that is drawn. Without it the caller's classes sat on top of a button's height,
97
+ edge and padding, and a chip's one-line menu was a field tall. */
98
+ @layer m-own {
99
+ [data-slot][data-own] {
100
+ all: revert;
101
+ }
102
+
103
+ /* The SDK's coarse-pointer hit area (an absolute `::after`, grown to 44px tall) stays, placed against the part,
104
+ which the SDK makes `position: relative`. The revert above leaves the part static, so on a phone the hit area
105
+ spread to the nearest positioned ancestor and swallowed every tap in the pane (a list's Columns trigger covered
106
+ its New button); anchoring the part again keeps the 44px target and nothing more. */
107
+ @media (pointer: coarse) {
108
+ button[data-slot][data-own],
109
+ [data-slot="navigation-menu-link"][data-own],
110
+ [data-slot="segmented-control-item"][data-own] {
111
+ position: relative;
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,181 @@
1
+ /* What a field's own parts wear that the rest of the kit's stylesheet does not have: the file field, and the
2
+ check cards where each card is the checkbox (kit/choices.tsx). */
3
+ @layer m-components {
4
+ /* The browser's input is the control, so it stays in the page and in the tab order, clipped to nothing; the
5
+ button and the names beside it are what is seen. */
6
+ [data-slot='file-field'] {
7
+ position: relative;
8
+ display: flex;
9
+ align-items: center;
10
+ gap: var(--m-space-3);
11
+ min-width: 0;
12
+
13
+ & input[type='file'] {
14
+ position: absolute;
15
+ inset-block-start: 0;
16
+ inset-inline-start: 0;
17
+ width: 1px;
18
+ height: 1px;
19
+ margin: 0;
20
+ opacity: 0;
21
+ overflow: hidden;
22
+ clip-path: inset(50%);
23
+ }
24
+
25
+ /* The keyboard is on the input, which is not seen: the ring is drawn on the button that stands for it. */
26
+ & input[type='file']:focus-visible ~ [data-slot='button'] {
27
+ outline: 2px solid var(--ui-ring);
28
+ outline-offset: 2px;
29
+ }
30
+
31
+ & [data-slot='button'] {
32
+ flex: none;
33
+ }
34
+ }
35
+
36
+ [data-slot='file-field-names'] {
37
+ flex: 1 1 0;
38
+ min-width: 0;
39
+ overflow: hidden;
40
+ text-overflow: ellipsis;
41
+ white-space: nowrap;
42
+
43
+ &[data-none] {
44
+ color: var(--m-ink-muted);
45
+ }
46
+ }
47
+
48
+ /* A card of several: the whole card is the checkbox and the one target, the square at its end its picture. */
49
+ [data-slot='check-cards'] {
50
+ display: flex;
51
+ flex-direction: column;
52
+ gap: var(--m-space-2);
53
+
54
+ &[data-fit] {
55
+ display: grid;
56
+ grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
57
+ }
58
+ }
59
+
60
+ [data-slot='check-cards-card'] {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: var(--m-space-2h);
64
+ padding: var(--m-space-2h) var(--m-space-3);
65
+ border: 1px solid var(--m-line-control);
66
+ border-radius: var(--m-radius);
67
+ background: var(--m-surface);
68
+ /* The card may be a button, which would centre its words and set them in its own face. */
69
+ color: inherit;
70
+ font: inherit;
71
+ text-align: start;
72
+ cursor: pointer;
73
+ transition:
74
+ background-color var(--m-fast),
75
+ border-color var(--m-fast);
76
+
77
+ &:hover {
78
+ background: var(--m-raised);
79
+ }
80
+
81
+ &:focus-visible {
82
+ outline: 2px solid var(--ui-ring);
83
+ outline-offset: 2px;
84
+ }
85
+
86
+ &[data-checked] {
87
+ border-color: var(--m-accent);
88
+ background: var(--m-accent-soft);
89
+ box-shadow: inset 0 0 0 1px var(--m-accent);
90
+ }
91
+
92
+ &[aria-disabled='true'] {
93
+ opacity: 0.5;
94
+ cursor: not-allowed;
95
+ }
96
+
97
+ & [data-slot='choice-label'] {
98
+ flex: 1;
99
+ display: flex;
100
+ flex-direction: column;
101
+ /* A lone card's word is centred on its row; here it is a column, where that would centre it across. */
102
+ align-items: flex-start;
103
+ font-weight: var(--m-weight-medium);
104
+ }
105
+
106
+ & [data-slot='choice-hint'] {
107
+ color: var(--m-ink-muted);
108
+ font-size: var(--m-size-xs);
109
+ font-weight: var(--m-weight-regular);
110
+ }
111
+
112
+ /* The square is a picture here, not a control: it takes no press of its own. */
113
+ & [data-slot='checkbox'] {
114
+ flex: none;
115
+ margin: 0;
116
+ pointer-events: none;
117
+ }
118
+ }
119
+
120
+ /* An amount set by a slider: the browser's own range, so the field's id, its label and a form's reset reach it as
121
+ they reach any input. The filled part of the track is drawn from --range-share, which the control sets from its
122
+ value, since WebKit has no part for it. */
123
+ [data-slot='field-control'][data-kind='range'] {
124
+ --range-share: 0%;
125
+ width: 100%;
126
+ height: 1.375rem;
127
+ margin: var(--m-space-3) 0 0;
128
+ padding: 0;
129
+ background: transparent;
130
+ appearance: none;
131
+ cursor: pointer;
132
+
133
+ &::-webkit-slider-runnable-track {
134
+ height: 4px;
135
+ border-radius: 2px;
136
+ background: linear-gradient(to right, var(--m-accent) 0 var(--range-share), var(--m-line-strong) var(--range-share) 100%);
137
+ }
138
+
139
+ &::-webkit-slider-thumb {
140
+ appearance: none;
141
+ width: 1.125rem;
142
+ height: 1.125rem;
143
+ /* Centres the thumb on the 4px track: (4 - 18) / 2. */
144
+ margin-top: -7px;
145
+ border: 2px solid var(--m-accent);
146
+ border-radius: 50%;
147
+ background: var(--m-surface);
148
+ box-shadow: var(--m-shadow-control);
149
+ }
150
+
151
+ &::-moz-range-track {
152
+ height: 4px;
153
+ border-radius: 2px;
154
+ background: var(--m-line-strong);
155
+ }
156
+
157
+ &::-moz-range-progress {
158
+ height: 4px;
159
+ border-radius: 2px;
160
+ background: var(--m-accent);
161
+ }
162
+
163
+ &::-moz-range-thumb {
164
+ width: 0.875rem;
165
+ height: 0.875rem;
166
+ border: 2px solid var(--m-accent);
167
+ border-radius: 50%;
168
+ background: var(--m-surface);
169
+ }
170
+
171
+ &:focus-visible {
172
+ outline: 2px solid var(--ui-ring);
173
+ outline-offset: 2px;
174
+ }
175
+
176
+ &:disabled {
177
+ opacity: 0.5;
178
+ cursor: not-allowed;
179
+ }
180
+ }
181
+ }