magic-pill 9.0.0 → 9.1.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 (149) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +259 -15
  3. package/dist/MagicPill/MagicPill.d.mts +7 -1
  4. package/dist/MagicPill/MagicPill.d.ts +7 -1
  5. package/dist/MagicPill/MagicPill.js +40 -17
  6. package/dist/MagicPill/MagicPill.mjs +42 -19
  7. package/dist/MagicPill/choreography.js +1 -1
  8. package/dist/MagicPill/choreography.mjs +1 -1
  9. package/dist/Pill/Pill.js +53 -17
  10. package/dist/Pill/Pill.mjs +54 -18
  11. package/dist/Pill/PillContext.js +3 -1
  12. package/dist/Pill/PillContext.mjs +3 -1
  13. package/dist/Pill/PillPanel.d.mts +5 -5
  14. package/dist/Pill/PillPanel.d.ts +5 -5
  15. package/dist/Pill/PillPanel.js +28 -20
  16. package/dist/Pill/PillPanel.mjs +28 -20
  17. package/dist/Pill/morph.js +25 -7
  18. package/dist/Pill/morph.mjs +22 -8
  19. package/dist/Pill/scene.js +90 -0
  20. package/dist/Pill/scene.mjs +89 -0
  21. package/dist/Pill/themed.js +36 -0
  22. package/dist/Pill/themed.mjs +34 -0
  23. package/dist/Pill/types.d.mts +50 -0
  24. package/dist/Pill/types.d.ts +50 -0
  25. package/dist/Pill/zone.js +160 -0
  26. package/dist/Pill/zone.mjs +159 -0
  27. package/dist/PillForm/Calendar.d.mts +15 -0
  28. package/dist/PillForm/Calendar.d.ts +16 -0
  29. package/dist/PillForm/Calendar.js +371 -0
  30. package/dist/PillForm/Calendar.mjs +370 -0
  31. package/dist/PillForm/FormContext.d.mts +2 -0
  32. package/dist/PillForm/FormContext.d.ts +2 -0
  33. package/dist/PillForm/FormContext.js +8 -0
  34. package/dist/PillForm/FormContext.mjs +8 -0
  35. package/dist/PillForm/PillCheckbox.d.mts +8 -0
  36. package/dist/PillForm/PillCheckbox.d.ts +8 -0
  37. package/dist/PillForm/PillCheckbox.js +45 -0
  38. package/dist/PillForm/PillCheckbox.mjs +45 -0
  39. package/dist/PillForm/PillChoices.d.mts +39 -0
  40. package/dist/PillForm/PillChoices.d.ts +39 -0
  41. package/dist/PillForm/PillChoices.js +103 -0
  42. package/dist/PillForm/PillChoices.mjs +103 -0
  43. package/dist/PillForm/PillCode.d.mts +12 -0
  44. package/dist/PillForm/PillCode.d.ts +12 -0
  45. package/dist/PillForm/PillCode.js +60 -0
  46. package/dist/PillForm/PillCode.mjs +60 -0
  47. package/dist/PillForm/PillColor.d.mts +10 -0
  48. package/dist/PillForm/PillColor.d.ts +10 -0
  49. package/dist/PillForm/PillColor.js +56 -0
  50. package/dist/PillForm/PillColor.mjs +56 -0
  51. package/dist/PillForm/PillDate.d.mts +44 -0
  52. package/dist/PillForm/PillDate.d.ts +44 -0
  53. package/dist/PillForm/PillDate.js +193 -0
  54. package/dist/PillForm/PillDate.mjs +193 -0
  55. package/dist/PillForm/PillField.d.mts +38 -0
  56. package/dist/PillForm/PillField.d.ts +38 -0
  57. package/dist/PillForm/PillField.js +81 -0
  58. package/dist/PillForm/PillField.mjs +80 -0
  59. package/dist/PillForm/PillFields.d.mts +11 -0
  60. package/dist/PillForm/PillFields.d.ts +11 -0
  61. package/dist/PillForm/PillFields.js +21 -0
  62. package/dist/PillForm/PillFields.mjs +21 -0
  63. package/dist/PillForm/PillFile.d.mts +8 -0
  64. package/dist/PillForm/PillFile.d.ts +8 -0
  65. package/dist/PillForm/PillFile.js +55 -0
  66. package/dist/PillForm/PillFile.mjs +55 -0
  67. package/dist/PillForm/PillForm.d.mts +29 -0
  68. package/dist/PillForm/PillForm.d.ts +29 -0
  69. package/dist/PillForm/PillForm.js +66 -0
  70. package/dist/PillForm/PillForm.mjs +65 -0
  71. package/dist/PillForm/PillFormPanel.d.mts +24 -0
  72. package/dist/PillForm/PillFormPanel.d.ts +24 -0
  73. package/dist/PillForm/PillFormPanel.js +53 -0
  74. package/dist/PillForm/PillFormPanel.mjs +53 -0
  75. package/dist/PillForm/PillInput.d.mts +20 -0
  76. package/dist/PillForm/PillInput.d.ts +20 -0
  77. package/dist/PillForm/PillInput.js +84 -0
  78. package/dist/PillForm/PillInput.mjs +84 -0
  79. package/dist/PillForm/PillSelect.d.mts +23 -0
  80. package/dist/PillForm/PillSelect.d.ts +23 -0
  81. package/dist/PillForm/PillSelect.js +87 -0
  82. package/dist/PillForm/PillSelect.mjs +87 -0
  83. package/dist/PillForm/PillSlider.d.mts +17 -0
  84. package/dist/PillForm/PillSlider.d.ts +17 -0
  85. package/dist/PillForm/PillSlider.js +61 -0
  86. package/dist/PillForm/PillSlider.mjs +61 -0
  87. package/dist/PillForm/PillStepper.d.mts +13 -0
  88. package/dist/PillForm/PillStepper.d.ts +13 -0
  89. package/dist/PillForm/PillStepper.js +84 -0
  90. package/dist/PillForm/PillStepper.mjs +84 -0
  91. package/dist/PillForm/PillSubmit.d.mts +14 -0
  92. package/dist/PillForm/PillSubmit.d.ts +14 -0
  93. package/dist/PillForm/PillSubmit.js +90 -0
  94. package/dist/PillForm/PillSubmit.mjs +89 -0
  95. package/dist/PillForm/PillSwitch.d.mts +5 -0
  96. package/dist/PillForm/PillSwitch.d.ts +5 -0
  97. package/dist/PillForm/PillSwitch.js +38 -0
  98. package/dist/PillForm/PillSwitch.mjs +38 -0
  99. package/dist/PillForm/PillTextarea.d.mts +5 -0
  100. package/dist/PillForm/PillTextarea.d.ts +5 -0
  101. package/dist/PillForm/PillTextarea.js +49 -0
  102. package/dist/PillForm/PillTextarea.mjs +49 -0
  103. package/dist/PillForm/dates.d.mts +1 -0
  104. package/dist/PillForm/dates.d.ts +1 -0
  105. package/dist/PillForm/dates.js +155 -0
  106. package/dist/PillForm/dates.mjs +139 -0
  107. package/dist/PillForm/glyphs.js +65 -0
  108. package/dist/PillForm/glyphs.mjs +56 -0
  109. package/dist/PillForm/keyboard.js +34 -0
  110. package/dist/PillForm/keyboard.mjs +34 -0
  111. package/dist/PillForm/popover.js +84 -0
  112. package/dist/PillForm/popover.mjs +83 -0
  113. package/dist/PillForm/send.d.mts +6 -0
  114. package/dist/PillForm/send.d.ts +6 -0
  115. package/dist/PillForm/send.js +44 -0
  116. package/dist/PillForm/send.mjs +44 -0
  117. package/dist/PillForm/validity.js +74 -0
  118. package/dist/PillForm/validity.mjs +72 -0
  119. package/dist/PillNavbar/PillNavbar.d.mts +29 -6
  120. package/dist/PillNavbar/PillNavbar.d.ts +29 -6
  121. package/dist/PillNavbar/PillNavbar.js +35 -11
  122. package/dist/PillNavbar/PillNavbar.mjs +36 -12
  123. package/dist/PillNavbar/room.js +84 -0
  124. package/dist/PillNavbar/room.mjs +83 -0
  125. package/dist/PillNotification/PillNotification.d.mts +6 -0
  126. package/dist/PillNotification/PillNotification.d.ts +6 -0
  127. package/dist/PillNotification/PillNotification.js +3 -0
  128. package/dist/PillNotification/PillNotification.mjs +3 -0
  129. package/dist/PillOptics/PillOptics.d.mts +8 -0
  130. package/dist/PillOptics/PillOptics.d.ts +8 -0
  131. package/dist/PillOptics/PillOptics.js +195 -0
  132. package/dist/PillOptics/PillOptics.mjs +195 -0
  133. package/dist/PillOptics/adaptive.js +212 -0
  134. package/dist/PillOptics/adaptive.mjs +208 -0
  135. package/dist/PillOptics/lens.js +77 -0
  136. package/dist/PillOptics/lens.mjs +73 -0
  137. package/dist/PillOptics/light.js +37 -0
  138. package/dist/PillOptics/light.mjs +36 -0
  139. package/dist/calendar.css +499 -0
  140. package/dist/forms.css +1454 -0
  141. package/dist/index.d.mts +24 -3
  142. package/dist/index.d.ts +24 -3
  143. package/dist/index.js +36 -0
  144. package/dist/index.mjs +19 -1
  145. package/dist/styles.css +169 -19
  146. package/dist/themes.css +449 -0
  147. package/dist/utils/visuallyHidden.js +18 -0
  148. package/dist/utils/visuallyHidden.mjs +18 -0
  149. package/package.json +4 -1
package/dist/forms.css ADDED
@@ -0,0 +1,1454 @@
1
+ /*
2
+ * Magic Pill v9 forms: the fields' look. Optional: import it next to
3
+ * styles.css, in any order, for pills with a <PillForm>. Others don't use it.
4
+ *
5
+ * - Same rules as styles.css: everything is in the magic-pill layer (your
6
+ * unlayered CSS wins), public tokens (--mp-*) are only read, and nothing is
7
+ * loaded from the network.
8
+ * - The look is on what surrounds the native controls, and switches, ticks,
9
+ * sliders… are drawn next to a transparent one: an app's resets
10
+ * (input { border: … }) are unlayered, so they'd win on the control itself.
11
+ * Text controls only need to stay bare.
12
+ */
13
+
14
+ /* After the themes, whose actions the fields look like, even when this file is imported first */
15
+ @layer magic-pill.look, magic-pill.theme, magic-pill.forms, magic-pill.behaviour;
16
+
17
+ @layer magic-pill.forms {
18
+ [data-mp="pill"]:not([data-unstyled]) {
19
+ /* ─── Values ───────────────────────────────────────────────────────────── */
20
+
21
+ --_mp-track: var(--mp-track, color-mix(in srgb, var(--_mp-on-surface) 48%, transparent));
22
+ --_mp-outline: var(--mp-track, color-mix(in srgb, var(--_mp-on-surface) 60%, transparent));
23
+ --_mp-faint: color-mix(in srgb, var(--_mp-on-surface) 22%, transparent);
24
+ --_mp-quiet: 0.72;
25
+ --_mp-hint-strength: 70%;
26
+ /* How much of the pill's text (then of the accent) the soft look lays
27
+ down, and the outline one under what's on */
28
+ --_mp-soft-field: 13%;
29
+ --_mp-soft-on: 30%;
30
+ --_mp-soft-on-rim: transparent;
31
+ --_mp-outline-on: 14%;
32
+ --_mp-thumb: var(--mp-thumb, 1.25rem);
33
+ --_mp-error: var(--mp-error, color-mix(in oklab, var(--mp-danger, #c2303e) 38%, var(--_mp-on-surface)));
34
+ --_mp-label-font: var(--mp-label-font, var(--mp-font-accent, inherit));
35
+ /* Only if the app has an accent: not valid otherwise, so fallbacks apply */
36
+ --_mp-own-on-accent: color-mix(in srgb, var(--_mp-on-accent) 100%, var(--mp-accent));
37
+ /* The corners of what opens, for <PillOptics> (registered in themes.css) */
38
+ --_mp-list-radius: 1.5rem;
39
+ /* A hint of the pop: more would leave the bar */
40
+ --_mp-ease-slide: cubic-bezier(0.3, 1.2, 0.5, 1);
41
+
42
+ /* Less contrast to spend: on the status colours, and on glass, whose veil
43
+ leaves 4.5:1 to the plain text */
44
+ &:is([data-variant="success"], [data-variant="danger"], [data-theme="glass"], [data-theme="liquid"]) {
45
+ --_mp-outline: var(--mp-track, color-mix(in srgb, var(--_mp-on-surface) 85%, transparent));
46
+ --_mp-faint: color-mix(in srgb, var(--_mp-on-surface) 8%, transparent);
47
+ --_mp-quiet: 0.92;
48
+ --_mp-soft-field: 8%;
49
+ --_mp-soft-on: 0%;
50
+ --_mp-soft-on-rim: var(--_mp-accent);
51
+ --_mp-outline-on: 8%;
52
+ }
53
+
54
+ &:is([data-theme="glass"], [data-theme="liquid"]) {
55
+ --_mp-hint-strength: 92%;
56
+ --_mp-look-hint-strength: 100%;
57
+ --_mp-own-scheme: dark;
58
+ }
59
+
60
+ &[data-scheme="light"] {
61
+ --_mp-own-scheme: light;
62
+ }
63
+
64
+ &:is([data-variant="success"], [data-variant="danger"], [data-theme="glass"], [data-theme="liquid"]) {
65
+ --_mp-error: var(--mp-error, var(--_mp-on-surface));
66
+ }
67
+
68
+ &:is([data-variant="success"], [data-variant="danger"]) {
69
+ --_mp-own-switch: color-mix(in srgb, var(--_mp-on-surface) 20%, transparent);
70
+ --_mp-own-switch-rim: var(--_mp-outline);
71
+ --_mp-look-hint-strength: 100%;
72
+ }
73
+
74
+ /* A field looks like the actions, unless its form's look says otherwise */
75
+ & :is([data-mp="field"], [data-mp="form"]) {
76
+ --_mp-field: var(--mp-field, var(--_mp-look-field, var(--_mp-action)));
77
+ --_mp-on-field: var(--mp-on-field, var(--_mp-look-on-field, var(--_mp-on-action)));
78
+ --_mp-field-rim: var(--mp-field-rim, var(--_mp-look-rim, var(--_mp-action-rim)));
79
+ --_mp-field-scheme: var(--mp-field-scheme, var(--_mp-own-scheme, var(--_mp-look-scheme, light)));
80
+ --_mp-field-size: var(--mp-field-size, var(--_mp-action-size));
81
+ --_mp-field-radius: var(--mp-field-radius, calc(var(--_mp-field-size) / 2));
82
+ --_mp-field-gap: var(--mp-field-gap, calc(var(--_mp-gap) * 1.25));
83
+ --_mp-placeholder: var(
84
+ --mp-placeholder,
85
+ color-mix(in srgb, var(--_mp-on-field) var(--_mp-hint-strength), transparent)
86
+ );
87
+ /* What's on (fill, rim, and the mark or the text on it), what's off, and
88
+ the bar choices sit in */
89
+ --_mp-on-fill: var(--_mp-look-on, var(--_mp-accent));
90
+ --_mp-on-rim: var(--_mp-look-on-rim, transparent);
91
+ --_mp-mark: var(--_mp-look-mark, var(--_mp-on-accent));
92
+ --_mp-mark-text: var(--_mp-look-mark-text, var(--_mp-on-accent));
93
+ --_mp-off-fill: var(--_mp-look-off, transparent);
94
+ --_mp-off-rim: var(--_mp-look-off-rim, var(--_mp-outline));
95
+ --_mp-track-fill: var(--_mp-look-track, var(--_mp-track));
96
+ --_mp-track-rim: var(--_mp-look-track-rim, transparent);
97
+ --_mp-switch-fill: var(--_mp-look-track, var(--_mp-own-switch, var(--_mp-track)));
98
+ --_mp-switch-rim: var(--_mp-look-track-rim, var(--_mp-own-switch-rim, transparent));
99
+ --_mp-bar-fill: var(--_mp-look-bar, var(--_mp-faint));
100
+ --_mp-bar-rim: var(--_mp-look-bar-rim, transparent);
101
+ }
102
+
103
+ & [data-mp="form"]:is([data-look="soft"], [data-look="outline"]) {
104
+ --_mp-look-field: color-mix(in srgb, var(--_mp-on-surface) var(--_mp-soft-field), transparent);
105
+ --_mp-look-on-field: var(--_mp-on-surface);
106
+ --_mp-look-rim: transparent;
107
+ --_mp-look-scheme: dark;
108
+ --_mp-look-on: color-mix(in srgb, var(--_mp-accent) var(--_mp-soft-on), transparent);
109
+ --_mp-look-on-rim: var(--_mp-soft-on-rim);
110
+ --_mp-look-mark: var(--_mp-accent);
111
+ --_mp-look-mark-text: var(--_mp-on-surface);
112
+ --_mp-look-off: var(--_mp-look-field);
113
+ --_mp-look-off-rim: color-mix(in srgb, var(--_mp-on-surface) 45%, transparent);
114
+ --_mp-look-chip-rim: transparent;
115
+ /* On a status colour, see-through fields have no contrast left to spend */
116
+ --_mp-hint-strength: var(--_mp-look-hint-strength, 70%);
117
+ --_mp-look-track: var(--_mp-look-field);
118
+ --_mp-look-track-rim: transparent;
119
+ --_mp-look-bar: var(--_mp-look-field);
120
+ --_mp-look-bar-rim: transparent;
121
+ }
122
+
123
+ & [data-mp="form"][data-look="outline"] {
124
+ --_mp-look-field: transparent;
125
+ --_mp-look-rim: color-mix(in srgb, var(--_mp-on-surface) 55%, transparent);
126
+ /* A hint of it, so what's on doesn't only differ by its outline */
127
+ --_mp-look-on: color-mix(in srgb, var(--_mp-accent) var(--_mp-outline-on), transparent);
128
+ --_mp-look-on-rim: var(--_mp-accent);
129
+ --_mp-look-off-rim: var(--_mp-outline);
130
+ --_mp-look-chip-rim: var(--_mp-outline);
131
+ --_mp-look-track-rim: var(--_mp-outline);
132
+ --_mp-look-bar-rim: var(--_mp-look-rim);
133
+ }
134
+
135
+ /* What opens over the page: a list, a calendar. It's made of what the
136
+ fields are made of, and on a glass theme, of the same glass (themes.css
137
+ gives it: --_mp-list-*) */
138
+ & :is([data-mp="field-box"][data-type="select"], [data-mp="calendar"]) {
139
+ --_mp-paper: var(--mp-list, var(--_mp-list-color, var(--_mp-field)));
140
+ --_mp-ink: var(--mp-on-list, var(--_mp-list-ink, var(--_mp-on-field)));
141
+ /* A see-through field is laid on the pill's own colour */
142
+ --_mp-sheet: var(
143
+ --mp-list,
144
+ var(--_mp-list-glass, linear-gradient(var(--_mp-paper), var(--_mp-paper)) var(--_mp-surface))
145
+ );
146
+ --_mp-paper-rim: transparent;
147
+ /* The app's accent, if it has one; with an edge, as it may be close to the paper */
148
+ --_mp-chosen: var(--mp-accent, var(--_mp-ink));
149
+ --_mp-on-chosen: var(--_mp-own-on-accent, var(--_mp-off-ink, var(--_mp-paper)));
150
+ --_mp-chosen-rim: var(--_mp-own-chosen-rim, transparent);
151
+ /* (mixed with none of it: not valid without an accent, like the above) */
152
+ --_mp-own-chosen-rim: color-mix(in srgb, color-mix(in srgb, var(--_mp-ink) 100%, var(--mp-accent)) 55%, transparent);
153
+ --_mp-hover: color-mix(in srgb, var(--_mp-ink) var(--_mp-list-hover, 10%), transparent);
154
+ --_mp-dim: var(--_mp-list-dim, 0.62);
155
+
156
+ /* What reads on the ink, whatever the paper (it may be see-through) */
157
+ @supports (color: oklch(from red l c h)) {
158
+ --_mp-off-ink: oklch(from var(--_mp-ink) clamp(0.19, (0.62 - l) * 1000, 0.98) 0 0);
159
+ }
160
+ }
161
+
162
+ & [data-mp="form"]:is([data-look="soft"], [data-look="outline"])
163
+ :is([data-mp="field-box"][data-type="select"], [data-mp="calendar"]) {
164
+ --_mp-paper: var(
165
+ --mp-list,
166
+ color-mix(in oklab, var(--_mp-on-surface) var(--_mp-paper-strength, var(--_mp-soft-field)), var(--_mp-surface))
167
+ );
168
+ --_mp-sheet: var(--mp-list, var(--_mp-list-glass, var(--_mp-paper)));
169
+ --_mp-ink: var(--mp-on-list, var(--_mp-on-surface));
170
+ --_mp-chosen: var(--_mp-on-fill);
171
+ --_mp-on-chosen: var(--_mp-ink);
172
+ --_mp-chosen-rim: var(--_mp-on-rim);
173
+ }
174
+
175
+ & [data-mp="form"][data-look="outline"] :is([data-mp="field-box"][data-type="select"], [data-mp="calendar"]) {
176
+ --_mp-paper-strength: 0%;
177
+ --_mp-paper-rim: color-mix(in srgb, var(--_mp-ink) 55%, transparent);
178
+ }
179
+
180
+ /* ─── Form ─────────────────────────────────────────────────────────────── */
181
+
182
+ & :is([data-mp="form"], [data-mp="form-body"]) {
183
+ min-inline-size: 0;
184
+ margin: 0;
185
+ padding: 0;
186
+ border: 0;
187
+ }
188
+
189
+ & [data-mp="form-body"] {
190
+ display: grid;
191
+ grid-template-columns: minmax(0, 1fr);
192
+ gap: var(--_mp-field-gap);
193
+ }
194
+
195
+ /* A panel of fields takes the panel's width, rather than its labels' */
196
+ & [data-mp="panel"] [data-mp="form"] {
197
+ inline-size: var(--mp-panel-width, 32rem);
198
+ max-inline-size: 100%;
199
+ font-style: normal;
200
+ }
201
+
202
+ /* Room for the focus rings, which a glass panel's mask would cut */
203
+ & [data-mp="panel-body"]:has(> [data-mp="form"]) {
204
+ margin-inline: -6px;
205
+ padding: 4px 6px;
206
+ }
207
+
208
+ & [data-mp="form"][aria-busy="true"] {
209
+ opacity: 0.6;
210
+ }
211
+
212
+ /* What the form is for */
213
+ & [data-mp="action"][type="submit"] {
214
+ --_mp-action: var(--_mp-accent);
215
+ --_mp-on-action: var(--_mp-on-accent);
216
+ --_mp-action-rim: transparent;
217
+ }
218
+
219
+ & [data-mp="form-error"]:not(:empty) {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 0.5rem;
223
+ color: var(--_mp-error);
224
+ font-family: var(--_mp-label-font);
225
+ font-size: 0.875rem;
226
+ line-height: 1.4;
227
+ }
228
+
229
+ /* Its gap too, while there's nothing to say */
230
+ & [data-mp="form-error"]:empty {
231
+ display: none;
232
+ }
233
+
234
+ /* In the pill itself: a row */
235
+ & > [data-mp="form"] {
236
+ flex: 0 1 auto;
237
+
238
+ & > [data-mp="form-body"] {
239
+ display: flex;
240
+ align-items: center;
241
+ gap: calc(var(--_mp-gap) * 0.75);
242
+ }
243
+
244
+ & [data-mp="field"] {
245
+ flex: 0 1 auto;
246
+ inline-size: 15rem;
247
+ }
248
+
249
+ /* No room for it: the outline tells, and it's still read out */
250
+ & :is([data-mp="field-error"], [data-mp="form-error"]) {
251
+ position: absolute;
252
+ inline-size: 1px;
253
+ block-size: 1px;
254
+ overflow: hidden;
255
+ clip-path: inset(50%);
256
+ }
257
+ }
258
+
259
+ /* ─── Field ────────────────────────────────────────────────────────────── */
260
+
261
+ & [data-mp="field"] {
262
+ display: grid;
263
+ grid-template-columns: minmax(0, 1fr) auto;
264
+ align-items: center;
265
+ column-gap: var(--_mp-gap);
266
+ min-inline-size: 0;
267
+ margin: 0;
268
+ padding: 0;
269
+ border: 0;
270
+ font-family: var(--_mp-label-font);
271
+ font-size: 1rem;
272
+ font-style: var(--mp-label-style, normal);
273
+ text-align: start;
274
+
275
+ & > * {
276
+ grid-column: 1 / -1;
277
+ }
278
+ }
279
+
280
+ & [data-mp="field-label"],
281
+ & [data-mp="field-aside"] {
282
+ padding: 0 0 0.45rem;
283
+ font-size: 0.9375rem;
284
+ line-height: 1.3;
285
+ }
286
+
287
+ & [data-mp="field"] > [data-mp="field-label"] {
288
+ grid-column: 1;
289
+ font-weight: var(--mp-label-weight, 400);
290
+
291
+ &[data-hidden] {
292
+ position: absolute;
293
+ inline-size: 1px;
294
+ block-size: 1px;
295
+ padding: 0;
296
+ overflow: hidden;
297
+ clip-path: inset(50%);
298
+ white-space: nowrap;
299
+ }
300
+ }
301
+
302
+ & [data-mp="field"] > [data-mp="field-aside"] {
303
+ grid-column: 2;
304
+ font-variant-numeric: tabular-nums;
305
+ }
306
+
307
+ /* A legend ignores its fieldset's grid, unless it floats */
308
+ & legend[data-mp="field-label"] {
309
+ float: inline-start;
310
+ inline-size: 100%;
311
+ }
312
+
313
+ & :is([data-mp="field-optional"], [data-mp="field-hint"]) {
314
+ font-size: 0.8125rem;
315
+ opacity: var(--_mp-quiet);
316
+ }
317
+
318
+ & [data-mp="field-hint"] {
319
+ padding-block-start: 0.4rem;
320
+ line-height: 1.35;
321
+ }
322
+
323
+ /* It unfolds, so the panel grows with it */
324
+ & [data-mp="field-error"] {
325
+ display: grid;
326
+ grid-template-rows: 0fr;
327
+ color: var(--_mp-error);
328
+ font-size: 0.8125rem;
329
+ line-height: 1.35;
330
+ transition: grid-template-rows var(--_mp-change) ease-in-out;
331
+
332
+ & > div {
333
+ min-block-size: 0;
334
+ overflow: hidden;
335
+ }
336
+
337
+ & span {
338
+ display: flex;
339
+ align-items: flex-start;
340
+ gap: 0.4rem;
341
+ padding-block-start: 0.4rem;
342
+ }
343
+ }
344
+
345
+ & :is([data-mp="field-error"], [data-mp="form-error"]) i {
346
+ flex: none;
347
+ display: grid;
348
+ place-items: center;
349
+ inline-size: 1rem;
350
+ block-size: 1rem;
351
+ margin-block-start: 0.05rem;
352
+ border-radius: 50%;
353
+ background: var(--_mp-error);
354
+ color: var(--_mp-surface);
355
+ font-size: 0.75rem;
356
+ }
357
+
358
+ & [data-mp="field"][data-invalid] > [data-mp="field-error"] {
359
+ grid-template-rows: 1fr;
360
+ }
361
+
362
+ /* The label beside the control */
363
+ & [data-mp="field"][data-layout="inline"] {
364
+ min-block-size: 2rem;
365
+
366
+ & > [data-mp="field-label"] {
367
+ padding: 0;
368
+ }
369
+
370
+ & > :is([data-mp="field-box"], [data-mp="field-control"]) {
371
+ grid-column: 2;
372
+ justify-self: end;
373
+ }
374
+
375
+ &[data-kind="text"] {
376
+ grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
377
+
378
+ & > :is([data-mp="field-box"], [data-mp="field-hint"], [data-mp="field-error"]) {
379
+ grid-column: 2;
380
+ justify-self: stretch;
381
+ }
382
+ }
383
+ }
384
+
385
+ /* ─── Text, numbers, dates ─────────────────────────────────────────────── */
386
+
387
+ & [data-mp="field-box"] {
388
+ position: relative;
389
+ display: flex;
390
+ align-items: center;
391
+ gap: 0.5rem;
392
+ min-inline-size: 0;
393
+ min-block-size: var(--_mp-field-size);
394
+ padding-inline: 1.1rem;
395
+ border-radius: var(--_mp-field-radius);
396
+ background: var(--_mp-field);
397
+ box-shadow: inset 0 0 0 1px var(--_mp-field-rim);
398
+ color: var(--_mp-on-field);
399
+ color-scheme: var(--_mp-field-scheme);
400
+ cursor: text;
401
+ transition:
402
+ background-color var(--_mp-change) ease-in-out,
403
+ box-shadow var(--_mp-change) ease-in-out,
404
+ color var(--_mp-change) ease-in-out;
405
+
406
+ & :is(input, textarea, select) {
407
+ appearance: none;
408
+ flex: 1 1 auto;
409
+ inline-size: 100%;
410
+ min-inline-size: 0;
411
+ margin: 0;
412
+ padding: 0;
413
+ border: 0;
414
+ border-radius: 0;
415
+ outline: 0;
416
+ background: transparent;
417
+ box-shadow: none;
418
+ color: inherit;
419
+ font: inherit;
420
+ /* Under 16px, iOS zooms the page in */
421
+ font-size: max(1rem, 16px);
422
+ font-style: normal;
423
+ line-height: 1.3;
424
+ text-align: start;
425
+ }
426
+
427
+ & input {
428
+ block-size: var(--_mp-field-size);
429
+ }
430
+
431
+ & ::placeholder {
432
+ color: var(--_mp-placeholder);
433
+ opacity: 1;
434
+ }
435
+
436
+ & input[type="number"] {
437
+ font-variant-numeric: tabular-nums;
438
+ -moz-appearance: textfield;
439
+ }
440
+
441
+ & ::-webkit-inner-spin-button,
442
+ & ::-webkit-outer-spin-button {
443
+ appearance: none;
444
+ margin: 0;
445
+ }
446
+
447
+ & ::-webkit-search-cancel-button {
448
+ appearance: none;
449
+ inline-size: 0.75rem;
450
+ block-size: 0.75rem;
451
+ background: currentColor;
452
+ clip-path: polygon(
453
+ 14% 0,
454
+ 50% 36%,
455
+ 86% 0,
456
+ 100% 14%,
457
+ 64% 50%,
458
+ 100% 86%,
459
+ 86% 100%,
460
+ 50% 64%,
461
+ 14% 100%,
462
+ 0 86%,
463
+ 36% 50%,
464
+ 0 14%
465
+ );
466
+ cursor: pointer;
467
+ opacity: 0.7;
468
+ }
469
+
470
+ /* The whole field opens the browser's picker, under a sign of ours */
471
+ & ::-webkit-calendar-picker-indicator {
472
+ position: absolute;
473
+ inset: 0;
474
+ inline-size: auto;
475
+ block-size: auto;
476
+ cursor: pointer;
477
+ opacity: 0;
478
+ }
479
+
480
+ & ::-webkit-date-and-time-value {
481
+ margin: 0;
482
+ text-align: start;
483
+ }
484
+
485
+ /* Suggestions come as you type: no arrow over the text */
486
+ & input[list]::-webkit-calendar-picker-indicator {
487
+ display: none !important;
488
+ }
489
+
490
+ /* Autofill's own background can only be put off */
491
+ & :autofill {
492
+ -webkit-text-fill-color: var(--_mp-on-field);
493
+ transition: background-color 99999s 99999s;
494
+ }
495
+ }
496
+
497
+ & [data-mp="field-box"][data-type="textarea"] {
498
+ padding: 0.75rem 1.1rem;
499
+ border-radius: min(var(--_mp-field-radius), 1.375rem);
500
+
501
+ & textarea {
502
+ field-sizing: content;
503
+ min-block-size: 4lh;
504
+ max-block-size: 10lh;
505
+ line-height: 1.4;
506
+ resize: none;
507
+ }
508
+ }
509
+
510
+ & [data-mp="field-icon"] {
511
+ flex: none;
512
+ display: grid;
513
+ place-items: center;
514
+ font-size: 1.15rem;
515
+ pointer-events: none;
516
+
517
+ & > svg {
518
+ inline-size: 1em;
519
+ block-size: 1em;
520
+ }
521
+ }
522
+
523
+ & [data-mp="field-box"] > :is([data-mp="field-icon"], [data-mp="field-suffix"]) {
524
+ opacity: 0.75;
525
+ pointer-events: none;
526
+ }
527
+
528
+ & [data-mp="field-suffix"] {
529
+ flex: none;
530
+ font-size: 0.9375rem;
531
+ }
532
+
533
+ & [data-mp="field-button"] {
534
+ appearance: none;
535
+ flex: none;
536
+ display: grid;
537
+ place-items: center;
538
+ inline-size: 2.25rem;
539
+ block-size: 2.25rem;
540
+ margin: 0;
541
+ margin-inline-end: -0.6rem;
542
+ padding: 0;
543
+ border: 0;
544
+ border-radius: 50%;
545
+ background: transparent;
546
+ color: inherit;
547
+ font-size: 1.2rem;
548
+ cursor: pointer;
549
+ }
550
+
551
+ /* ─── Lists ────────────────────────────────────────────────────────────── */
552
+
553
+ & [data-mp="field-box"][data-type="select"] {
554
+ padding: 0;
555
+ cursor: pointer;
556
+
557
+ & select {
558
+ block-size: var(--_mp-field-size);
559
+ padding-inline: 1.1rem 2.75rem;
560
+ cursor: pointer;
561
+ text-overflow: ellipsis;
562
+ }
563
+
564
+ & [data-mp="field-icon"] {
565
+ position: absolute;
566
+ inset-inline-start: 1.1rem;
567
+
568
+ & + select {
569
+ padding-inline-start: 2.8rem;
570
+ }
571
+ }
572
+
573
+ & [data-mp="field-chevron"] {
574
+ position: absolute;
575
+ inset-inline-end: 1rem;
576
+ display: grid;
577
+ font-size: 1.1rem;
578
+ pointer-events: none;
579
+ transition: rotate var(--_mp-change) ease-in-out;
580
+ }
581
+
582
+ & select:open ~ [data-mp="field-chevron"] {
583
+ rotate: 180deg;
584
+ }
585
+
586
+ & :is(option, optgroup) {
587
+ background: var(--_mp-paper);
588
+ color: var(--_mp-ink);
589
+ }
590
+ }
591
+
592
+ /* A chip, at the end of a row */
593
+ & [data-mp="field"][data-layout="inline"] > [data-mp="field-box"][data-type="select"] {
594
+ --_mp-field-size: 2.25rem;
595
+ max-inline-size: 12rem;
596
+ background: var(--_mp-bar-fill);
597
+ box-shadow: inset 0 0 0 1px var(--_mp-bar-rim);
598
+ color: var(--_mp-on-surface);
599
+
600
+ & select {
601
+ field-sizing: content;
602
+ padding-inline: 0.9rem 2.2rem;
603
+ }
604
+
605
+ & [data-mp="field-chevron"] {
606
+ inset-inline-end: 0.75rem;
607
+ }
608
+ }
609
+
610
+ /* The open list in the pill's language, where the browser lets us draw it.
611
+ --mp-picker: none keeps the system's */
612
+ @supports (appearance: base-select) {
613
+ & [data-mp="field-box"][data-type="select"] {
614
+ & select,
615
+ & select::picker(select) {
616
+ appearance: var(--mp-picker, base-select);
617
+ }
618
+
619
+ & select {
620
+ display: flex;
621
+ align-items: center;
622
+ }
623
+
624
+ & select::picker-icon {
625
+ display: none;
626
+ }
627
+
628
+ & select::picker(select) {
629
+ min-inline-size: anchor-size(width);
630
+ max-block-size: 18rem;
631
+ margin-block: 0.4rem;
632
+ padding: 0.4rem;
633
+ border: 0;
634
+ border-radius: var(--_mp-list-radius);
635
+ background: var(--_mp-sheet);
636
+ -webkit-backdrop-filter: var(--_mp-list-filter, none);
637
+ backdrop-filter: var(--_mp-list-filter, none) var(--_mp-list-lens,);
638
+ box-shadow:
639
+ 0 0.5rem 1.5rem rgb(20 20 20 / 0.35),
640
+ inset 0 0 0 1px var(--_mp-paper-rim),
641
+ var(--_mp-list-rim, 0 0 transparent);
642
+ color: var(--_mp-ink);
643
+ font: 400 1rem / 1.3 var(--_mp-label-font);
644
+ opacity: 0;
645
+ scale: 0.96;
646
+ transform-origin: top;
647
+ transition:
648
+ opacity 150ms,
649
+ scale 150ms,
650
+ overlay 150ms allow-discrete,
651
+ display 150ms allow-discrete;
652
+ }
653
+
654
+ /* :open on the select, not :popover-open on the picker: Lightning CSS
655
+ (Next.js's Turbopack) refuses a pseudo-class after a pseudo-element */
656
+ & select:open::picker(select) {
657
+ opacity: 1;
658
+ scale: 1;
659
+
660
+ @starting-style {
661
+ opacity: 0;
662
+ scale: 0.96;
663
+ }
664
+ }
665
+
666
+ & option {
667
+ display: flex;
668
+ align-items: center;
669
+ gap: 0.5rem;
670
+ padding: 0.6rem 0.8rem;
671
+ border-radius: 1.1rem;
672
+ outline: 0;
673
+ background: transparent;
674
+ color: inherit;
675
+ font-weight: 400;
676
+ font-size: 1rem;
677
+ }
678
+
679
+ & option[hidden] {
680
+ display: none;
681
+ }
682
+
683
+ & option:is(:hover, :focus-visible) {
684
+ background: var(--_mp-hover);
685
+ }
686
+
687
+ & option:checked {
688
+ background: var(--_mp-chosen);
689
+ box-shadow: inset 0 0 0 1.5px var(--_mp-chosen-rim);
690
+ color: var(--_mp-on-chosen);
691
+ }
692
+
693
+ & option::checkmark {
694
+ display: none;
695
+ }
696
+
697
+ & optgroup {
698
+ padding-block-start: 0.4rem;
699
+ background: transparent;
700
+ font-weight: 700;
701
+ font-size: 0.8125rem;
702
+ }
703
+ }
704
+ }
705
+
706
+ /* ─── Sliders ──────────────────────────────────────────────────────────── */
707
+
708
+ & [data-mp="field-control"][data-type="slider"] {
709
+ --_mp-bar: var(--mp-track-size, 4px);
710
+ --_mp-run: calc(100% - var(--_mp-thumb));
711
+ position: relative;
712
+ display: grid;
713
+ align-items: center;
714
+ block-size: max(1.75rem, var(--_mp-thumb));
715
+
716
+ /* Transparent, over the drawing: its thumb has the same size, so it's
717
+ under the finger */
718
+ & input {
719
+ appearance: none;
720
+ position: relative;
721
+ z-index: 1;
722
+ inline-size: 100%;
723
+ block-size: 100%;
724
+ margin: 0;
725
+ padding: 0;
726
+ background: none;
727
+ cursor: pointer;
728
+ opacity: 0;
729
+ touch-action: pan-y;
730
+ }
731
+
732
+ & input::-webkit-slider-thumb {
733
+ appearance: none;
734
+ inline-size: var(--_mp-thumb);
735
+ block-size: var(--_mp-thumb);
736
+ }
737
+
738
+ & input::-moz-range-thumb {
739
+ inline-size: var(--_mp-thumb);
740
+ block-size: var(--_mp-thumb);
741
+ border: 0;
742
+ }
743
+ }
744
+
745
+ & [data-mp="slider-track"] {
746
+ position: absolute;
747
+ inset-inline: 0;
748
+ block-size: var(--_mp-bar);
749
+ overflow: hidden;
750
+ border-radius: 99px;
751
+ background: var(--_mp-track-fill);
752
+ box-shadow: inset 0 0 0 1px var(--_mp-track-rim);
753
+
754
+ &::before {
755
+ content: "";
756
+ position: absolute;
757
+ inset-block: 0;
758
+ inset-inline-start: 0;
759
+ inline-size: calc(var(--_mp-thumb) / 2 + var(--_mp-run) * var(--_mp-at));
760
+ background: var(--_mp-accent);
761
+ }
762
+ }
763
+
764
+ & [data-mp="slider-thumb"] {
765
+ position: absolute;
766
+ inset-inline-start: calc(var(--_mp-run) * var(--_mp-at));
767
+ inline-size: var(--_mp-thumb);
768
+ block-size: var(--_mp-thumb);
769
+ border-radius: 50%;
770
+ background: var(--_mp-accent);
771
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
772
+ }
773
+
774
+ & input:active ~ [data-mp="slider-thumb"] {
775
+ scale: 1.2;
776
+ }
777
+
778
+ /* ─── Switches ─────────────────────────────────────────────────────────── */
779
+
780
+ & [data-mp="field-control"][data-type="switch"] {
781
+ position: relative;
782
+ display: inline-grid;
783
+ inline-size: 3.125rem;
784
+ block-size: 1.625rem;
785
+
786
+ /* Easier to reach than it looks */
787
+ & input {
788
+ appearance: none;
789
+ position: absolute;
790
+ z-index: 1;
791
+ inset: -0.6rem -0.3rem;
792
+ inline-size: auto;
793
+ block-size: auto;
794
+ margin: 0;
795
+ cursor: pointer;
796
+ opacity: 0;
797
+ }
798
+
799
+ & > span {
800
+ border-radius: 99px;
801
+ background: var(--_mp-switch-fill);
802
+ box-shadow: inset 0 0 0 1.5px var(--_mp-switch-rim);
803
+ transition:
804
+ background-color var(--_mp-change) ease-in-out,
805
+ box-shadow var(--_mp-change) ease-in-out;
806
+
807
+ &::after {
808
+ content: "";
809
+ display: block;
810
+ inline-size: 1.375rem;
811
+ block-size: 1.375rem;
812
+ margin: 0.125rem;
813
+ border-radius: 99px;
814
+ background: var(--_mp-on-surface);
815
+ transition:
816
+ margin var(--_mp-change) var(--_mp-ease-enter),
817
+ inline-size 150ms ease-out,
818
+ background-color var(--_mp-change) ease-in-out;
819
+ }
820
+ }
821
+
822
+ & input:checked + span {
823
+ background: var(--_mp-on-fill);
824
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
825
+
826
+ &::after {
827
+ margin-inline-start: 1.625rem;
828
+ background: var(--_mp-mark);
829
+ }
830
+ }
831
+
832
+ /* It stretches under the finger, towards where it's going */
833
+ & input:active + span::after {
834
+ inline-size: 1.625rem;
835
+ }
836
+
837
+ & input:checked:active + span::after {
838
+ margin-inline-start: 1.375rem;
839
+ }
840
+ }
841
+
842
+ /* Off the rim */
843
+ & [data-mp="form"][data-look="outline"] [data-mp="field-control"][data-type="switch"] > span::after {
844
+ scale: 0.8;
845
+ }
846
+
847
+ /* ─── Checkboxes and choices ───────────────────────────────────────────── */
848
+
849
+ & [data-mp="field"][data-layout="leading"] {
850
+ grid-template-columns: auto minmax(0, 1fr);
851
+ column-gap: 0.75rem;
852
+
853
+ & > [data-mp="field-control"] {
854
+ grid-column: 1;
855
+ grid-row: 1;
856
+ align-self: start;
857
+ }
858
+
859
+ & > [data-mp="field-label"] {
860
+ grid-column: 2;
861
+ grid-row: 1;
862
+ align-content: center;
863
+ min-block-size: 1.5rem;
864
+ padding: 0;
865
+ }
866
+
867
+ & > :is([data-mp="field-hint"], [data-mp="field-error"]) {
868
+ grid-column: 2;
869
+ }
870
+ }
871
+
872
+ & [data-mp="field-control"][data-type="checkbox"] {
873
+ position: relative;
874
+ display: grid;
875
+
876
+ & input {
877
+ position: absolute;
878
+ z-index: 1;
879
+ inset: -0.5rem;
880
+ inline-size: calc(100% + 1rem);
881
+ block-size: calc(100% + 1rem);
882
+ margin: 0;
883
+ cursor: pointer;
884
+ opacity: 0;
885
+ }
886
+ }
887
+
888
+ & :is([data-mp="field-tick"], [data-mp="field-dot"]) {
889
+ flex: none;
890
+ display: grid;
891
+ place-items: center;
892
+ inline-size: 1.5rem;
893
+ block-size: 1.5rem;
894
+ border-radius: 0.5rem;
895
+ background: var(--_mp-off-fill);
896
+ box-shadow: inset 0 0 0 2px var(--_mp-off-rim);
897
+ color: var(--_mp-mark);
898
+ font-size: 1rem;
899
+ transition:
900
+ background-color 150ms ease-out,
901
+ box-shadow 150ms ease-out;
902
+
903
+ & > svg {
904
+ scale: 0;
905
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
906
+ }
907
+ }
908
+
909
+ & [data-mp="field-dot"] {
910
+ border-radius: 50%;
911
+
912
+ &::after {
913
+ content: "";
914
+ inline-size: 0.625rem;
915
+ block-size: 0.625rem;
916
+ border-radius: 50%;
917
+ background: var(--_mp-mark);
918
+ scale: 0;
919
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
920
+ }
921
+ }
922
+
923
+ & input:checked + :is([data-mp="field-tick"], [data-mp="field-dot"]) {
924
+ background: var(--_mp-on-fill);
925
+ box-shadow: inset 0 0 0 2px var(--_mp-on-rim);
926
+
927
+ & > svg {
928
+ scale: 1;
929
+ }
930
+
931
+ &::after {
932
+ scale: 1;
933
+ }
934
+ }
935
+
936
+ & input:indeterminate + [data-mp="field-tick"] {
937
+ background:
938
+ linear-gradient(var(--_mp-mark), var(--_mp-mark)) center / 0.8rem 3px no-repeat,
939
+ var(--_mp-on-fill);
940
+ box-shadow: inset 0 0 0 2px var(--_mp-on-rim);
941
+
942
+ & > svg {
943
+ scale: 0;
944
+ }
945
+ }
946
+
947
+ & [data-mp="choices"] {
948
+ position: relative;
949
+ display: grid;
950
+ gap: 0.15rem;
951
+ clear: both;
952
+ }
953
+
954
+ & [data-mp="choice"] {
955
+ position: relative;
956
+ display: flex;
957
+ align-items: center;
958
+ gap: 0.75rem;
959
+ min-block-size: 2.5rem;
960
+ line-height: 1.3;
961
+ cursor: pointer;
962
+
963
+ & > input {
964
+ position: absolute;
965
+ z-index: 1;
966
+ inset: 0;
967
+ inline-size: 100%;
968
+ block-size: 100%;
969
+ margin: 0;
970
+ cursor: pointer;
971
+ opacity: 0;
972
+ }
973
+
974
+ & small {
975
+ display: block;
976
+ font-size: 0.8125rem;
977
+ opacity: var(--_mp-quiet);
978
+ }
979
+ }
980
+
981
+ & [data-mp="choice-body"] {
982
+ display: flex;
983
+ align-items: center;
984
+ gap: 0.5rem;
985
+ }
986
+
987
+ /* In one bar */
988
+ & [data-mp="choices"][data-look="segmented"] {
989
+ --_mp-inset: 0.2rem;
990
+ grid-template-columns: repeat(var(--_mp-count), minmax(0, 1fr));
991
+ gap: 0;
992
+ padding: var(--_mp-inset);
993
+ border-radius: calc(var(--_mp-field-radius) + var(--_mp-inset));
994
+ background: var(--_mp-bar-fill);
995
+ box-shadow: inset 0 0 0 1px var(--_mp-bar-rim);
996
+
997
+ & [data-mp="choice"] {
998
+ justify-content: center;
999
+ min-block-size: calc(var(--_mp-field-size) - 2 * var(--_mp-inset));
1000
+ text-align: center;
1001
+ }
1002
+
1003
+ & [data-mp="choice-body"] {
1004
+ justify-content: center;
1005
+ inline-size: 100%;
1006
+ block-size: 100%;
1007
+ padding-inline: 0.4rem;
1008
+ border-radius: var(--_mp-field-radius);
1009
+ transition:
1010
+ background-color var(--_mp-change) ease-in-out,
1011
+ color var(--_mp-change) ease-in-out;
1012
+ }
1013
+
1014
+ & input:checked + [data-mp="choice-body"] {
1015
+ color: var(--_mp-mark-text);
1016
+ }
1017
+
1018
+ /* Several can be chosen: each has its own */
1019
+ &:not([data-slides]) input:checked + [data-mp="choice-body"] {
1020
+ background: var(--_mp-on-fill);
1021
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1022
+ }
1023
+ }
1024
+
1025
+ /* The choice, sliding from one to the next */
1026
+ & [data-mp="choices-thumb"] {
1027
+ position: absolute;
1028
+ inset-block: var(--_mp-inset);
1029
+ inset-inline-start: calc(
1030
+ var(--_mp-inset) + (100% - 2 * var(--_mp-inset)) / var(--_mp-count) * var(--_mp-at)
1031
+ );
1032
+ inline-size: calc((100% - 2 * var(--_mp-inset)) / var(--_mp-count));
1033
+ border-radius: var(--_mp-field-radius);
1034
+ background: var(--_mp-on-fill);
1035
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1036
+ transition:
1037
+ inset-inline-start calc(var(--_mp-change) * 1.4) var(--_mp-ease-slide),
1038
+ scale var(--_mp-change) var(--_mp-ease-enter),
1039
+ opacity var(--_mp-change) ease-out;
1040
+
1041
+ &[data-empty] {
1042
+ opacity: 0;
1043
+ scale: 0.8;
1044
+ }
1045
+
1046
+ &[data-appearing] {
1047
+ transition-property: opacity, scale;
1048
+ }
1049
+ }
1050
+
1051
+ /* It gives under the finger */
1052
+ & [data-mp="choices"]:active > [data-mp="choices-thumb"]:not([data-empty]) {
1053
+ scale: 0.96 0.92;
1054
+ }
1055
+
1056
+ /* As chips */
1057
+ & [data-mp="choices"][data-look="chips"] {
1058
+ display: flex;
1059
+ flex-wrap: wrap;
1060
+ gap: 0.5rem;
1061
+
1062
+ & [data-mp="choice"] {
1063
+ min-block-size: 0;
1064
+ }
1065
+
1066
+ & [data-mp="choice-body"] {
1067
+ min-block-size: 2.5rem;
1068
+ padding-inline: 1rem;
1069
+ border-radius: var(--_mp-field-radius);
1070
+ background: var(--_mp-off-fill);
1071
+ box-shadow: inset 0 0 0 1.5px var(--_mp-look-chip-rim, var(--_mp-off-rim));
1072
+ transition:
1073
+ background-color var(--_mp-change) ease-in-out,
1074
+ box-shadow var(--_mp-change) ease-in-out,
1075
+ color var(--_mp-change) ease-in-out;
1076
+ }
1077
+
1078
+ & input:checked + [data-mp="choice-body"] {
1079
+ background: var(--_mp-on-fill);
1080
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1081
+ color: var(--_mp-mark-text);
1082
+ }
1083
+ }
1084
+
1085
+ /* ─── Steppers ─────────────────────────────────────────────────────────── */
1086
+
1087
+ & [data-mp="field-control"][data-type="stepper"] {
1088
+ display: flex;
1089
+ align-items: center;
1090
+ gap: 0.35rem;
1091
+
1092
+ & input {
1093
+ appearance: textfield;
1094
+ field-sizing: content;
1095
+ min-inline-size: 1ch;
1096
+ max-inline-size: 5rem;
1097
+ margin: 0;
1098
+ padding: 0.35rem 0;
1099
+ border: 0;
1100
+ outline: 0;
1101
+ background: none;
1102
+ color: inherit;
1103
+ font: inherit;
1104
+ font-size: max(1rem, 16px);
1105
+ text-align: center;
1106
+ }
1107
+
1108
+ & ::-webkit-inner-spin-button,
1109
+ & ::-webkit-outer-spin-button {
1110
+ appearance: none;
1111
+ margin: 0;
1112
+ }
1113
+ }
1114
+
1115
+ & [data-mp="stepper-value"] {
1116
+ display: flex;
1117
+ align-items: baseline;
1118
+ justify-content: center;
1119
+ gap: 0.25rem;
1120
+ min-inline-size: 3rem;
1121
+ padding-inline: 0.25rem;
1122
+ border-radius: 0.6rem;
1123
+ font-variant-numeric: tabular-nums;
1124
+ }
1125
+
1126
+ & [data-mp="stepper-button"] {
1127
+ appearance: none;
1128
+ margin: 0;
1129
+ padding: 0;
1130
+ border: 0;
1131
+ border-radius: 50%;
1132
+ background: none;
1133
+ color: inherit;
1134
+ cursor: pointer;
1135
+
1136
+ & > span {
1137
+ display: grid;
1138
+ place-items: center;
1139
+ inline-size: 2.25rem;
1140
+ block-size: 2.25rem;
1141
+ border-radius: 50%;
1142
+ background: var(--_mp-look-field, var(--_mp-action));
1143
+ box-shadow: inset 0 0 0 1px var(--_mp-look-rim, var(--_mp-action-rim));
1144
+ color: var(--_mp-look-on-field, var(--_mp-on-action));
1145
+ font-size: 1.05rem;
1146
+ transition:
1147
+ scale 150ms ease-out,
1148
+ opacity var(--_mp-change) ease-in-out;
1149
+ }
1150
+
1151
+ &:active > span {
1152
+ scale: 0.9;
1153
+ }
1154
+
1155
+ &:disabled {
1156
+ cursor: not-allowed;
1157
+
1158
+ & > span {
1159
+ opacity: 0.4;
1160
+ }
1161
+ }
1162
+ }
1163
+
1164
+ /* ─── Groups ───────────────────────────────────────────────────────────── */
1165
+
1166
+ & [data-mp="fields"] {
1167
+ min-inline-size: 0;
1168
+ margin: 0;
1169
+ padding: 0;
1170
+ border: 0;
1171
+
1172
+ & > div {
1173
+ display: grid;
1174
+ grid-template-columns: minmax(0, 1fr);
1175
+ gap: var(--_mp-field-gap);
1176
+ }
1177
+
1178
+ &[data-columns="2"] > div {
1179
+ grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
1180
+ align-items: start;
1181
+ }
1182
+
1183
+ &[data-separators] > div > * + * {
1184
+ border-block-start: 1px solid color-mix(in srgb, var(--_mp-on-surface) 20%, transparent);
1185
+ padding-block-start: var(--_mp-field-gap);
1186
+ }
1187
+ }
1188
+
1189
+ & [data-mp="fields-label"] {
1190
+ padding: 0 0 0.6rem;
1191
+ font: italic 700 1.125rem / 1.3 var(--mp-font-text, inherit);
1192
+ }
1193
+
1194
+ /* ─── One-time codes ───────────────────────────────────────────────────── */
1195
+
1196
+ & [data-mp="field-control"][data-type="code"] {
1197
+ position: relative;
1198
+ display: grid;
1199
+ grid-template-columns: repeat(var(--_mp-count), minmax(0, 2.75rem));
1200
+ gap: 0.4rem;
1201
+
1202
+ & input {
1203
+ position: absolute;
1204
+ z-index: 1;
1205
+ inset: 0;
1206
+ inline-size: 100%;
1207
+ block-size: 100%;
1208
+ margin: 0;
1209
+ padding: 0;
1210
+ border: 0;
1211
+ cursor: text;
1212
+ font-size: 16px;
1213
+ opacity: 0;
1214
+ }
1215
+ }
1216
+
1217
+ & [data-mp="code-slot"] {
1218
+ display: grid;
1219
+ place-items: center;
1220
+ block-size: var(--_mp-field-size);
1221
+ border-radius: min(var(--_mp-field-radius), 0.9rem);
1222
+ background: var(--_mp-field);
1223
+ box-shadow: inset 0 0 0 1px var(--_mp-field-rim);
1224
+ color: var(--_mp-on-field);
1225
+ font-size: 1.25rem;
1226
+ font-weight: 700;
1227
+ font-variant-numeric: tabular-nums;
1228
+ transition: box-shadow var(--_mp-change) ease-in-out;
1229
+ }
1230
+
1231
+ & > [data-mp="form"] [data-mp="field"][data-kind="code"] {
1232
+ inline-size: auto;
1233
+ }
1234
+
1235
+ /* ─── Files and colours ────────────────────────────────────────────────── */
1236
+
1237
+ & [data-mp="field-control"][data-type="file"] {
1238
+ position: relative;
1239
+ min-block-size: 4.5rem;
1240
+ border-radius: min(var(--_mp-field-radius), 1.375rem);
1241
+ background: var(--_mp-off-fill);
1242
+ outline: 1.5px dashed var(--_mp-off-rim);
1243
+ outline-offset: -1.5px;
1244
+ transition:
1245
+ background-color 150ms ease-out,
1246
+ outline-color 150ms ease-out;
1247
+
1248
+ & input {
1249
+ position: absolute;
1250
+ inset: 0;
1251
+ inline-size: 100%;
1252
+ block-size: 100%;
1253
+ margin: 0;
1254
+ cursor: pointer;
1255
+ opacity: 0;
1256
+ }
1257
+
1258
+ &[data-over] {
1259
+ background: var(--_mp-faint);
1260
+ outline-color: var(--_mp-on-surface);
1261
+ }
1262
+ }
1263
+
1264
+ & [data-mp="file-body"] {
1265
+ display: flex;
1266
+ align-items: center;
1267
+ justify-content: center;
1268
+ gap: 0.6rem;
1269
+ min-block-size: 4.5rem;
1270
+ padding: 0.75rem 1rem;
1271
+ overflow-wrap: anywhere;
1272
+ text-align: center;
1273
+ }
1274
+
1275
+ & [data-mp="field-control"][data-type="color"] {
1276
+ position: relative;
1277
+ display: flex;
1278
+ align-items: center;
1279
+ gap: 0.6rem;
1280
+
1281
+ & input {
1282
+ position: absolute;
1283
+ inset: 0;
1284
+ inline-size: 100%;
1285
+ block-size: 100%;
1286
+ margin: 0;
1287
+ cursor: pointer;
1288
+ opacity: 0;
1289
+ }
1290
+ }
1291
+
1292
+ & [data-mp="color-value"] {
1293
+ font-size: 0.875rem;
1294
+ font-variant-numeric: tabular-nums;
1295
+ opacity: var(--_mp-quiet);
1296
+ }
1297
+
1298
+ & [data-mp="color-swatch"] {
1299
+ inline-size: 2.25rem;
1300
+ block-size: 2.25rem;
1301
+ border-radius: 50%;
1302
+ background: var(--_mp-color);
1303
+ box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--_mp-on-surface) 70%, transparent);
1304
+ }
1305
+
1306
+ /* ─── States ───────────────────────────────────────────────────────────── */
1307
+
1308
+ & [data-mp="field-box"]:has(> :is(input, textarea, select):focus-visible) {
1309
+ outline: 2px solid var(--_mp-on-surface);
1310
+ outline-offset: 2px;
1311
+ }
1312
+
1313
+ & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > input:focus-visible + span,
1314
+ & input:focus-visible ~ [data-mp="slider-thumb"],
1315
+ & [data-mp="choice"] > input:focus-visible + span,
1316
+ & [data-mp="stepper-value"]:focus-within {
1317
+ outline: 2px solid var(--_mp-on-surface);
1318
+ outline-offset: 2px;
1319
+ }
1320
+
1321
+ & input:focus-visible ~ [data-mp="code-slot"][data-next],
1322
+ & input:focus-visible ~ [data-mp="color-swatch"] {
1323
+ outline: 2px solid var(--_mp-on-surface);
1324
+ outline-offset: 2px;
1325
+ }
1326
+
1327
+ & [data-mp="field-control"][data-type="file"]:focus-within {
1328
+ outline: 2px solid var(--_mp-on-surface);
1329
+ outline-offset: 2px;
1330
+ }
1331
+
1332
+ @supports not selector(:has(*)) {
1333
+ & [data-mp="field-box"]:focus-within {
1334
+ outline: 2px solid var(--_mp-on-surface);
1335
+ outline-offset: 2px;
1336
+ }
1337
+ }
1338
+
1339
+ & [data-mp="field-button"]:focus-visible {
1340
+ outline: 2px solid currentColor;
1341
+ outline-offset: -4px;
1342
+ }
1343
+
1344
+ & [data-mp="field"][data-invalid] [data-mp="field-box"] {
1345
+ box-shadow:
1346
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1347
+ 0 0 0 1px var(--_mp-error);
1348
+ }
1349
+
1350
+ & [data-mp="field"][data-invalid] :is([data-mp="field-tick"], [data-mp="field-dot"]) {
1351
+ box-shadow: inset 0 0 0 2px var(--_mp-error);
1352
+ }
1353
+
1354
+ & [data-mp="field"][data-invalid] [data-mp="code-slot"] {
1355
+ box-shadow:
1356
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1357
+ 0 0 0 1px var(--_mp-error);
1358
+ }
1359
+
1360
+ & [data-mp="field"][data-invalid] [data-mp="field-control"][data-type="file"] {
1361
+ outline-color: var(--_mp-error);
1362
+ }
1363
+
1364
+ & > [data-mp="form"][data-failed] [data-mp="field-box"] {
1365
+ box-shadow:
1366
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1367
+ 0 0 0 1px var(--_mp-error);
1368
+ }
1369
+
1370
+ /* Read only: still there to be read, not to be filled in */
1371
+ & [data-mp="field-box"]:has(> :is(input, textarea)[readonly]) {
1372
+ background: transparent;
1373
+ box-shadow: inset 0 0 0 1px var(--_mp-outline);
1374
+ color: var(--_mp-on-surface);
1375
+ }
1376
+
1377
+ & [data-mp="field"]:has(> :is([data-mp="field-box"], [data-mp="field-control"]) > :is(input, textarea, select):disabled),
1378
+ & [data-mp="field"]:has(> [data-mp="field-control"] > [data-mp="stepper-value"] > input:disabled),
1379
+ & [data-mp="choice"]:has(> input:disabled) {
1380
+ opacity: 0.5;
1381
+
1382
+ & :disabled {
1383
+ cursor: not-allowed;
1384
+ }
1385
+ }
1386
+
1387
+ /* While it's sent, the form fades as one */
1388
+ & [data-mp="form"][aria-busy="true"] [data-mp="field"] {
1389
+ opacity: 1;
1390
+ }
1391
+
1392
+ /* ─── Above the on-screen keyboard (PillForm/keyboard.ts) ──────────────── */
1393
+
1394
+ &[data-placement^="bottom"] {
1395
+ margin-block-end: var(--_mp-keyboard, 0px);
1396
+ }
1397
+
1398
+ &:is([data-placement="overlay"], [data-placement="left"], [data-placement="right"]) {
1399
+ inset-block-end: var(--_mp-keyboard, 0px);
1400
+ }
1401
+
1402
+ &[data-presence="panel"]:not([data-placement="inline"]) {
1403
+ max-block-size: calc(
1404
+ 100dvh - 2 * var(--_mp-offset) - var(--_mp-shift-y, 0px) - var(--_mp-keyboard, 0px)
1405
+ );
1406
+ }
1407
+
1408
+ /* ─── Preferences ──────────────────────────────────────────────────────── */
1409
+
1410
+ @media (prefers-reduced-motion: reduce) {
1411
+ & :is([data-mp^="field"], [data-mp="form"], [data-mp^="slider"], [data-mp^="choice"], [data-mp="stepper-button"] > span),
1412
+ & [data-mp="field-control"] > span,
1413
+ & [data-mp="field-control"] > span::after,
1414
+ & [data-mp="field-tick"] > svg,
1415
+ & [data-mp="field-dot"]::after,
1416
+ & [data-mp="field-box"] ::picker(select) {
1417
+ transition: none;
1418
+ }
1419
+ }
1420
+
1421
+ @media (forced-colors: active) {
1422
+ & :is([data-mp="field-box"], [data-mp="choice-body"], [data-mp="code-slot"], [data-mp="stepper-button"] > span) {
1423
+ border: 1px solid CanvasText;
1424
+ }
1425
+
1426
+ /* As the system draws them */
1427
+ & [data-mp="field-control"]:is([data-type="slider"], [data-type="switch"], [data-type="checkbox"]) input {
1428
+ appearance: auto;
1429
+ position: static;
1430
+ opacity: 1;
1431
+ }
1432
+
1433
+ & [data-mp="field-control"][data-type="checkbox"] input {
1434
+ inline-size: 1.5rem;
1435
+ block-size: 1.5rem;
1436
+ }
1437
+
1438
+ & [data-mp="color-swatch"] {
1439
+ forced-color-adjust: none;
1440
+ }
1441
+
1442
+ & :is([data-mp="slider-track"], [data-mp="slider-thumb"], [data-mp="choices-thumb"]),
1443
+ & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > span {
1444
+ display: none;
1445
+ }
1446
+
1447
+ & input:checked + :is([data-mp="choice-body"], [data-mp="field-tick"], [data-mp="field-dot"]) {
1448
+ forced-color-adjust: none;
1449
+ background: Highlight;
1450
+ color: HighlightText;
1451
+ }
1452
+ }
1453
+ }
1454
+ }