magic-pill 9.0.0 → 9.1.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 (149) hide show
  1. package/CHANGELOG.md +44 -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 +1452 -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,1452 @@
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
+ & select::picker(select):popover-open {
655
+ opacity: 1;
656
+ scale: 1;
657
+
658
+ @starting-style {
659
+ opacity: 0;
660
+ scale: 0.96;
661
+ }
662
+ }
663
+
664
+ & option {
665
+ display: flex;
666
+ align-items: center;
667
+ gap: 0.5rem;
668
+ padding: 0.6rem 0.8rem;
669
+ border-radius: 1.1rem;
670
+ outline: 0;
671
+ background: transparent;
672
+ color: inherit;
673
+ font-weight: 400;
674
+ font-size: 1rem;
675
+ }
676
+
677
+ & option[hidden] {
678
+ display: none;
679
+ }
680
+
681
+ & option:is(:hover, :focus-visible) {
682
+ background: var(--_mp-hover);
683
+ }
684
+
685
+ & option:checked {
686
+ background: var(--_mp-chosen);
687
+ box-shadow: inset 0 0 0 1.5px var(--_mp-chosen-rim);
688
+ color: var(--_mp-on-chosen);
689
+ }
690
+
691
+ & option::checkmark {
692
+ display: none;
693
+ }
694
+
695
+ & optgroup {
696
+ padding-block-start: 0.4rem;
697
+ background: transparent;
698
+ font-weight: 700;
699
+ font-size: 0.8125rem;
700
+ }
701
+ }
702
+ }
703
+
704
+ /* ─── Sliders ──────────────────────────────────────────────────────────── */
705
+
706
+ & [data-mp="field-control"][data-type="slider"] {
707
+ --_mp-bar: var(--mp-track-size, 4px);
708
+ --_mp-run: calc(100% - var(--_mp-thumb));
709
+ position: relative;
710
+ display: grid;
711
+ align-items: center;
712
+ block-size: max(1.75rem, var(--_mp-thumb));
713
+
714
+ /* Transparent, over the drawing: its thumb has the same size, so it's
715
+ under the finger */
716
+ & input {
717
+ appearance: none;
718
+ position: relative;
719
+ z-index: 1;
720
+ inline-size: 100%;
721
+ block-size: 100%;
722
+ margin: 0;
723
+ padding: 0;
724
+ background: none;
725
+ cursor: pointer;
726
+ opacity: 0;
727
+ touch-action: pan-y;
728
+ }
729
+
730
+ & input::-webkit-slider-thumb {
731
+ appearance: none;
732
+ inline-size: var(--_mp-thumb);
733
+ block-size: var(--_mp-thumb);
734
+ }
735
+
736
+ & input::-moz-range-thumb {
737
+ inline-size: var(--_mp-thumb);
738
+ block-size: var(--_mp-thumb);
739
+ border: 0;
740
+ }
741
+ }
742
+
743
+ & [data-mp="slider-track"] {
744
+ position: absolute;
745
+ inset-inline: 0;
746
+ block-size: var(--_mp-bar);
747
+ overflow: hidden;
748
+ border-radius: 99px;
749
+ background: var(--_mp-track-fill);
750
+ box-shadow: inset 0 0 0 1px var(--_mp-track-rim);
751
+
752
+ &::before {
753
+ content: "";
754
+ position: absolute;
755
+ inset-block: 0;
756
+ inset-inline-start: 0;
757
+ inline-size: calc(var(--_mp-thumb) / 2 + var(--_mp-run) * var(--_mp-at));
758
+ background: var(--_mp-accent);
759
+ }
760
+ }
761
+
762
+ & [data-mp="slider-thumb"] {
763
+ position: absolute;
764
+ inset-inline-start: calc(var(--_mp-run) * var(--_mp-at));
765
+ inline-size: var(--_mp-thumb);
766
+ block-size: var(--_mp-thumb);
767
+ border-radius: 50%;
768
+ background: var(--_mp-accent);
769
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
770
+ }
771
+
772
+ & input:active ~ [data-mp="slider-thumb"] {
773
+ scale: 1.2;
774
+ }
775
+
776
+ /* ─── Switches ─────────────────────────────────────────────────────────── */
777
+
778
+ & [data-mp="field-control"][data-type="switch"] {
779
+ position: relative;
780
+ display: inline-grid;
781
+ inline-size: 3.125rem;
782
+ block-size: 1.625rem;
783
+
784
+ /* Easier to reach than it looks */
785
+ & input {
786
+ appearance: none;
787
+ position: absolute;
788
+ z-index: 1;
789
+ inset: -0.6rem -0.3rem;
790
+ inline-size: auto;
791
+ block-size: auto;
792
+ margin: 0;
793
+ cursor: pointer;
794
+ opacity: 0;
795
+ }
796
+
797
+ & > span {
798
+ border-radius: 99px;
799
+ background: var(--_mp-switch-fill);
800
+ box-shadow: inset 0 0 0 1.5px var(--_mp-switch-rim);
801
+ transition:
802
+ background-color var(--_mp-change) ease-in-out,
803
+ box-shadow var(--_mp-change) ease-in-out;
804
+
805
+ &::after {
806
+ content: "";
807
+ display: block;
808
+ inline-size: 1.375rem;
809
+ block-size: 1.375rem;
810
+ margin: 0.125rem;
811
+ border-radius: 99px;
812
+ background: var(--_mp-on-surface);
813
+ transition:
814
+ margin var(--_mp-change) var(--_mp-ease-enter),
815
+ inline-size 150ms ease-out,
816
+ background-color var(--_mp-change) ease-in-out;
817
+ }
818
+ }
819
+
820
+ & input:checked + span {
821
+ background: var(--_mp-on-fill);
822
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
823
+
824
+ &::after {
825
+ margin-inline-start: 1.625rem;
826
+ background: var(--_mp-mark);
827
+ }
828
+ }
829
+
830
+ /* It stretches under the finger, towards where it's going */
831
+ & input:active + span::after {
832
+ inline-size: 1.625rem;
833
+ }
834
+
835
+ & input:checked:active + span::after {
836
+ margin-inline-start: 1.375rem;
837
+ }
838
+ }
839
+
840
+ /* Off the rim */
841
+ & [data-mp="form"][data-look="outline"] [data-mp="field-control"][data-type="switch"] > span::after {
842
+ scale: 0.8;
843
+ }
844
+
845
+ /* ─── Checkboxes and choices ───────────────────────────────────────────── */
846
+
847
+ & [data-mp="field"][data-layout="leading"] {
848
+ grid-template-columns: auto minmax(0, 1fr);
849
+ column-gap: 0.75rem;
850
+
851
+ & > [data-mp="field-control"] {
852
+ grid-column: 1;
853
+ grid-row: 1;
854
+ align-self: start;
855
+ }
856
+
857
+ & > [data-mp="field-label"] {
858
+ grid-column: 2;
859
+ grid-row: 1;
860
+ align-content: center;
861
+ min-block-size: 1.5rem;
862
+ padding: 0;
863
+ }
864
+
865
+ & > :is([data-mp="field-hint"], [data-mp="field-error"]) {
866
+ grid-column: 2;
867
+ }
868
+ }
869
+
870
+ & [data-mp="field-control"][data-type="checkbox"] {
871
+ position: relative;
872
+ display: grid;
873
+
874
+ & input {
875
+ position: absolute;
876
+ z-index: 1;
877
+ inset: -0.5rem;
878
+ inline-size: calc(100% + 1rem);
879
+ block-size: calc(100% + 1rem);
880
+ margin: 0;
881
+ cursor: pointer;
882
+ opacity: 0;
883
+ }
884
+ }
885
+
886
+ & :is([data-mp="field-tick"], [data-mp="field-dot"]) {
887
+ flex: none;
888
+ display: grid;
889
+ place-items: center;
890
+ inline-size: 1.5rem;
891
+ block-size: 1.5rem;
892
+ border-radius: 0.5rem;
893
+ background: var(--_mp-off-fill);
894
+ box-shadow: inset 0 0 0 2px var(--_mp-off-rim);
895
+ color: var(--_mp-mark);
896
+ font-size: 1rem;
897
+ transition:
898
+ background-color 150ms ease-out,
899
+ box-shadow 150ms ease-out;
900
+
901
+ & > svg {
902
+ scale: 0;
903
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
904
+ }
905
+ }
906
+
907
+ & [data-mp="field-dot"] {
908
+ border-radius: 50%;
909
+
910
+ &::after {
911
+ content: "";
912
+ inline-size: 0.625rem;
913
+ block-size: 0.625rem;
914
+ border-radius: 50%;
915
+ background: var(--_mp-mark);
916
+ scale: 0;
917
+ transition: scale var(--_mp-change) var(--_mp-ease-enter);
918
+ }
919
+ }
920
+
921
+ & input:checked + :is([data-mp="field-tick"], [data-mp="field-dot"]) {
922
+ background: var(--_mp-on-fill);
923
+ box-shadow: inset 0 0 0 2px var(--_mp-on-rim);
924
+
925
+ & > svg {
926
+ scale: 1;
927
+ }
928
+
929
+ &::after {
930
+ scale: 1;
931
+ }
932
+ }
933
+
934
+ & input:indeterminate + [data-mp="field-tick"] {
935
+ background:
936
+ linear-gradient(var(--_mp-mark), var(--_mp-mark)) center / 0.8rem 3px no-repeat,
937
+ var(--_mp-on-fill);
938
+ box-shadow: inset 0 0 0 2px var(--_mp-on-rim);
939
+
940
+ & > svg {
941
+ scale: 0;
942
+ }
943
+ }
944
+
945
+ & [data-mp="choices"] {
946
+ position: relative;
947
+ display: grid;
948
+ gap: 0.15rem;
949
+ clear: both;
950
+ }
951
+
952
+ & [data-mp="choice"] {
953
+ position: relative;
954
+ display: flex;
955
+ align-items: center;
956
+ gap: 0.75rem;
957
+ min-block-size: 2.5rem;
958
+ line-height: 1.3;
959
+ cursor: pointer;
960
+
961
+ & > input {
962
+ position: absolute;
963
+ z-index: 1;
964
+ inset: 0;
965
+ inline-size: 100%;
966
+ block-size: 100%;
967
+ margin: 0;
968
+ cursor: pointer;
969
+ opacity: 0;
970
+ }
971
+
972
+ & small {
973
+ display: block;
974
+ font-size: 0.8125rem;
975
+ opacity: var(--_mp-quiet);
976
+ }
977
+ }
978
+
979
+ & [data-mp="choice-body"] {
980
+ display: flex;
981
+ align-items: center;
982
+ gap: 0.5rem;
983
+ }
984
+
985
+ /* In one bar */
986
+ & [data-mp="choices"][data-look="segmented"] {
987
+ --_mp-inset: 0.2rem;
988
+ grid-template-columns: repeat(var(--_mp-count), minmax(0, 1fr));
989
+ gap: 0;
990
+ padding: var(--_mp-inset);
991
+ border-radius: calc(var(--_mp-field-radius) + var(--_mp-inset));
992
+ background: var(--_mp-bar-fill);
993
+ box-shadow: inset 0 0 0 1px var(--_mp-bar-rim);
994
+
995
+ & [data-mp="choice"] {
996
+ justify-content: center;
997
+ min-block-size: calc(var(--_mp-field-size) - 2 * var(--_mp-inset));
998
+ text-align: center;
999
+ }
1000
+
1001
+ & [data-mp="choice-body"] {
1002
+ justify-content: center;
1003
+ inline-size: 100%;
1004
+ block-size: 100%;
1005
+ padding-inline: 0.4rem;
1006
+ border-radius: var(--_mp-field-radius);
1007
+ transition:
1008
+ background-color var(--_mp-change) ease-in-out,
1009
+ color var(--_mp-change) ease-in-out;
1010
+ }
1011
+
1012
+ & input:checked + [data-mp="choice-body"] {
1013
+ color: var(--_mp-mark-text);
1014
+ }
1015
+
1016
+ /* Several can be chosen: each has its own */
1017
+ &:not([data-slides]) input:checked + [data-mp="choice-body"] {
1018
+ background: var(--_mp-on-fill);
1019
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1020
+ }
1021
+ }
1022
+
1023
+ /* The choice, sliding from one to the next */
1024
+ & [data-mp="choices-thumb"] {
1025
+ position: absolute;
1026
+ inset-block: var(--_mp-inset);
1027
+ inset-inline-start: calc(
1028
+ var(--_mp-inset) + (100% - 2 * var(--_mp-inset)) / var(--_mp-count) * var(--_mp-at)
1029
+ );
1030
+ inline-size: calc((100% - 2 * var(--_mp-inset)) / var(--_mp-count));
1031
+ border-radius: var(--_mp-field-radius);
1032
+ background: var(--_mp-on-fill);
1033
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1034
+ transition:
1035
+ inset-inline-start calc(var(--_mp-change) * 1.4) var(--_mp-ease-slide),
1036
+ scale var(--_mp-change) var(--_mp-ease-enter),
1037
+ opacity var(--_mp-change) ease-out;
1038
+
1039
+ &[data-empty] {
1040
+ opacity: 0;
1041
+ scale: 0.8;
1042
+ }
1043
+
1044
+ &[data-appearing] {
1045
+ transition-property: opacity, scale;
1046
+ }
1047
+ }
1048
+
1049
+ /* It gives under the finger */
1050
+ & [data-mp="choices"]:active > [data-mp="choices-thumb"]:not([data-empty]) {
1051
+ scale: 0.96 0.92;
1052
+ }
1053
+
1054
+ /* As chips */
1055
+ & [data-mp="choices"][data-look="chips"] {
1056
+ display: flex;
1057
+ flex-wrap: wrap;
1058
+ gap: 0.5rem;
1059
+
1060
+ & [data-mp="choice"] {
1061
+ min-block-size: 0;
1062
+ }
1063
+
1064
+ & [data-mp="choice-body"] {
1065
+ min-block-size: 2.5rem;
1066
+ padding-inline: 1rem;
1067
+ border-radius: var(--_mp-field-radius);
1068
+ background: var(--_mp-off-fill);
1069
+ box-shadow: inset 0 0 0 1.5px var(--_mp-look-chip-rim, var(--_mp-off-rim));
1070
+ transition:
1071
+ background-color var(--_mp-change) ease-in-out,
1072
+ box-shadow var(--_mp-change) ease-in-out,
1073
+ color var(--_mp-change) ease-in-out;
1074
+ }
1075
+
1076
+ & input:checked + [data-mp="choice-body"] {
1077
+ background: var(--_mp-on-fill);
1078
+ box-shadow: inset 0 0 0 1.5px var(--_mp-on-rim);
1079
+ color: var(--_mp-mark-text);
1080
+ }
1081
+ }
1082
+
1083
+ /* ─── Steppers ─────────────────────────────────────────────────────────── */
1084
+
1085
+ & [data-mp="field-control"][data-type="stepper"] {
1086
+ display: flex;
1087
+ align-items: center;
1088
+ gap: 0.35rem;
1089
+
1090
+ & input {
1091
+ appearance: textfield;
1092
+ field-sizing: content;
1093
+ min-inline-size: 1ch;
1094
+ max-inline-size: 5rem;
1095
+ margin: 0;
1096
+ padding: 0.35rem 0;
1097
+ border: 0;
1098
+ outline: 0;
1099
+ background: none;
1100
+ color: inherit;
1101
+ font: inherit;
1102
+ font-size: max(1rem, 16px);
1103
+ text-align: center;
1104
+ }
1105
+
1106
+ & ::-webkit-inner-spin-button,
1107
+ & ::-webkit-outer-spin-button {
1108
+ appearance: none;
1109
+ margin: 0;
1110
+ }
1111
+ }
1112
+
1113
+ & [data-mp="stepper-value"] {
1114
+ display: flex;
1115
+ align-items: baseline;
1116
+ justify-content: center;
1117
+ gap: 0.25rem;
1118
+ min-inline-size: 3rem;
1119
+ padding-inline: 0.25rem;
1120
+ border-radius: 0.6rem;
1121
+ font-variant-numeric: tabular-nums;
1122
+ }
1123
+
1124
+ & [data-mp="stepper-button"] {
1125
+ appearance: none;
1126
+ margin: 0;
1127
+ padding: 0;
1128
+ border: 0;
1129
+ border-radius: 50%;
1130
+ background: none;
1131
+ color: inherit;
1132
+ cursor: pointer;
1133
+
1134
+ & > span {
1135
+ display: grid;
1136
+ place-items: center;
1137
+ inline-size: 2.25rem;
1138
+ block-size: 2.25rem;
1139
+ border-radius: 50%;
1140
+ background: var(--_mp-look-field, var(--_mp-action));
1141
+ box-shadow: inset 0 0 0 1px var(--_mp-look-rim, var(--_mp-action-rim));
1142
+ color: var(--_mp-look-on-field, var(--_mp-on-action));
1143
+ font-size: 1.05rem;
1144
+ transition:
1145
+ scale 150ms ease-out,
1146
+ opacity var(--_mp-change) ease-in-out;
1147
+ }
1148
+
1149
+ &:active > span {
1150
+ scale: 0.9;
1151
+ }
1152
+
1153
+ &:disabled {
1154
+ cursor: not-allowed;
1155
+
1156
+ & > span {
1157
+ opacity: 0.4;
1158
+ }
1159
+ }
1160
+ }
1161
+
1162
+ /* ─── Groups ───────────────────────────────────────────────────────────── */
1163
+
1164
+ & [data-mp="fields"] {
1165
+ min-inline-size: 0;
1166
+ margin: 0;
1167
+ padding: 0;
1168
+ border: 0;
1169
+
1170
+ & > div {
1171
+ display: grid;
1172
+ grid-template-columns: minmax(0, 1fr);
1173
+ gap: var(--_mp-field-gap);
1174
+ }
1175
+
1176
+ &[data-columns="2"] > div {
1177
+ grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
1178
+ align-items: start;
1179
+ }
1180
+
1181
+ &[data-separators] > div > * + * {
1182
+ border-block-start: 1px solid color-mix(in srgb, var(--_mp-on-surface) 20%, transparent);
1183
+ padding-block-start: var(--_mp-field-gap);
1184
+ }
1185
+ }
1186
+
1187
+ & [data-mp="fields-label"] {
1188
+ padding: 0 0 0.6rem;
1189
+ font: italic 700 1.125rem / 1.3 var(--mp-font-text, inherit);
1190
+ }
1191
+
1192
+ /* ─── One-time codes ───────────────────────────────────────────────────── */
1193
+
1194
+ & [data-mp="field-control"][data-type="code"] {
1195
+ position: relative;
1196
+ display: grid;
1197
+ grid-template-columns: repeat(var(--_mp-count), minmax(0, 2.75rem));
1198
+ gap: 0.4rem;
1199
+
1200
+ & input {
1201
+ position: absolute;
1202
+ z-index: 1;
1203
+ inset: 0;
1204
+ inline-size: 100%;
1205
+ block-size: 100%;
1206
+ margin: 0;
1207
+ padding: 0;
1208
+ border: 0;
1209
+ cursor: text;
1210
+ font-size: 16px;
1211
+ opacity: 0;
1212
+ }
1213
+ }
1214
+
1215
+ & [data-mp="code-slot"] {
1216
+ display: grid;
1217
+ place-items: center;
1218
+ block-size: var(--_mp-field-size);
1219
+ border-radius: min(var(--_mp-field-radius), 0.9rem);
1220
+ background: var(--_mp-field);
1221
+ box-shadow: inset 0 0 0 1px var(--_mp-field-rim);
1222
+ color: var(--_mp-on-field);
1223
+ font-size: 1.25rem;
1224
+ font-weight: 700;
1225
+ font-variant-numeric: tabular-nums;
1226
+ transition: box-shadow var(--_mp-change) ease-in-out;
1227
+ }
1228
+
1229
+ & > [data-mp="form"] [data-mp="field"][data-kind="code"] {
1230
+ inline-size: auto;
1231
+ }
1232
+
1233
+ /* ─── Files and colours ────────────────────────────────────────────────── */
1234
+
1235
+ & [data-mp="field-control"][data-type="file"] {
1236
+ position: relative;
1237
+ min-block-size: 4.5rem;
1238
+ border-radius: min(var(--_mp-field-radius), 1.375rem);
1239
+ background: var(--_mp-off-fill);
1240
+ outline: 1.5px dashed var(--_mp-off-rim);
1241
+ outline-offset: -1.5px;
1242
+ transition:
1243
+ background-color 150ms ease-out,
1244
+ outline-color 150ms ease-out;
1245
+
1246
+ & input {
1247
+ position: absolute;
1248
+ inset: 0;
1249
+ inline-size: 100%;
1250
+ block-size: 100%;
1251
+ margin: 0;
1252
+ cursor: pointer;
1253
+ opacity: 0;
1254
+ }
1255
+
1256
+ &[data-over] {
1257
+ background: var(--_mp-faint);
1258
+ outline-color: var(--_mp-on-surface);
1259
+ }
1260
+ }
1261
+
1262
+ & [data-mp="file-body"] {
1263
+ display: flex;
1264
+ align-items: center;
1265
+ justify-content: center;
1266
+ gap: 0.6rem;
1267
+ min-block-size: 4.5rem;
1268
+ padding: 0.75rem 1rem;
1269
+ overflow-wrap: anywhere;
1270
+ text-align: center;
1271
+ }
1272
+
1273
+ & [data-mp="field-control"][data-type="color"] {
1274
+ position: relative;
1275
+ display: flex;
1276
+ align-items: center;
1277
+ gap: 0.6rem;
1278
+
1279
+ & input {
1280
+ position: absolute;
1281
+ inset: 0;
1282
+ inline-size: 100%;
1283
+ block-size: 100%;
1284
+ margin: 0;
1285
+ cursor: pointer;
1286
+ opacity: 0;
1287
+ }
1288
+ }
1289
+
1290
+ & [data-mp="color-value"] {
1291
+ font-size: 0.875rem;
1292
+ font-variant-numeric: tabular-nums;
1293
+ opacity: var(--_mp-quiet);
1294
+ }
1295
+
1296
+ & [data-mp="color-swatch"] {
1297
+ inline-size: 2.25rem;
1298
+ block-size: 2.25rem;
1299
+ border-radius: 50%;
1300
+ background: var(--_mp-color);
1301
+ box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--_mp-on-surface) 70%, transparent);
1302
+ }
1303
+
1304
+ /* ─── States ───────────────────────────────────────────────────────────── */
1305
+
1306
+ & [data-mp="field-box"]:has(> :is(input, textarea, select):focus-visible) {
1307
+ outline: 2px solid var(--_mp-on-surface);
1308
+ outline-offset: 2px;
1309
+ }
1310
+
1311
+ & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > input:focus-visible + span,
1312
+ & input:focus-visible ~ [data-mp="slider-thumb"],
1313
+ & [data-mp="choice"] > input:focus-visible + span,
1314
+ & [data-mp="stepper-value"]:focus-within {
1315
+ outline: 2px solid var(--_mp-on-surface);
1316
+ outline-offset: 2px;
1317
+ }
1318
+
1319
+ & input:focus-visible ~ [data-mp="code-slot"][data-next],
1320
+ & input:focus-visible ~ [data-mp="color-swatch"] {
1321
+ outline: 2px solid var(--_mp-on-surface);
1322
+ outline-offset: 2px;
1323
+ }
1324
+
1325
+ & [data-mp="field-control"][data-type="file"]:focus-within {
1326
+ outline: 2px solid var(--_mp-on-surface);
1327
+ outline-offset: 2px;
1328
+ }
1329
+
1330
+ @supports not selector(:has(*)) {
1331
+ & [data-mp="field-box"]:focus-within {
1332
+ outline: 2px solid var(--_mp-on-surface);
1333
+ outline-offset: 2px;
1334
+ }
1335
+ }
1336
+
1337
+ & [data-mp="field-button"]:focus-visible {
1338
+ outline: 2px solid currentColor;
1339
+ outline-offset: -4px;
1340
+ }
1341
+
1342
+ & [data-mp="field"][data-invalid] [data-mp="field-box"] {
1343
+ box-shadow:
1344
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1345
+ 0 0 0 1px var(--_mp-error);
1346
+ }
1347
+
1348
+ & [data-mp="field"][data-invalid] :is([data-mp="field-tick"], [data-mp="field-dot"]) {
1349
+ box-shadow: inset 0 0 0 2px var(--_mp-error);
1350
+ }
1351
+
1352
+ & [data-mp="field"][data-invalid] [data-mp="code-slot"] {
1353
+ box-shadow:
1354
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1355
+ 0 0 0 1px var(--_mp-error);
1356
+ }
1357
+
1358
+ & [data-mp="field"][data-invalid] [data-mp="field-control"][data-type="file"] {
1359
+ outline-color: var(--_mp-error);
1360
+ }
1361
+
1362
+ & > [data-mp="form"][data-failed] [data-mp="field-box"] {
1363
+ box-shadow:
1364
+ inset 0 0 0 2px var(--mp-danger, #c2303e),
1365
+ 0 0 0 1px var(--_mp-error);
1366
+ }
1367
+
1368
+ /* Read only: still there to be read, not to be filled in */
1369
+ & [data-mp="field-box"]:has(> :is(input, textarea)[readonly]) {
1370
+ background: transparent;
1371
+ box-shadow: inset 0 0 0 1px var(--_mp-outline);
1372
+ color: var(--_mp-on-surface);
1373
+ }
1374
+
1375
+ & [data-mp="field"]:has(> :is([data-mp="field-box"], [data-mp="field-control"]) > :is(input, textarea, select):disabled),
1376
+ & [data-mp="field"]:has(> [data-mp="field-control"] > [data-mp="stepper-value"] > input:disabled),
1377
+ & [data-mp="choice"]:has(> input:disabled) {
1378
+ opacity: 0.5;
1379
+
1380
+ & :disabled {
1381
+ cursor: not-allowed;
1382
+ }
1383
+ }
1384
+
1385
+ /* While it's sent, the form fades as one */
1386
+ & [data-mp="form"][aria-busy="true"] [data-mp="field"] {
1387
+ opacity: 1;
1388
+ }
1389
+
1390
+ /* ─── Above the on-screen keyboard (PillForm/keyboard.ts) ──────────────── */
1391
+
1392
+ &[data-placement^="bottom"] {
1393
+ margin-block-end: var(--_mp-keyboard, 0px);
1394
+ }
1395
+
1396
+ &:is([data-placement="overlay"], [data-placement="left"], [data-placement="right"]) {
1397
+ inset-block-end: var(--_mp-keyboard, 0px);
1398
+ }
1399
+
1400
+ &[data-presence="panel"]:not([data-placement="inline"]) {
1401
+ max-block-size: calc(
1402
+ 100dvh - 2 * var(--_mp-offset) - var(--_mp-shift-y, 0px) - var(--_mp-keyboard, 0px)
1403
+ );
1404
+ }
1405
+
1406
+ /* ─── Preferences ──────────────────────────────────────────────────────── */
1407
+
1408
+ @media (prefers-reduced-motion: reduce) {
1409
+ & :is([data-mp^="field"], [data-mp="form"], [data-mp^="slider"], [data-mp^="choice"], [data-mp="stepper-button"] > span),
1410
+ & [data-mp="field-control"] > span,
1411
+ & [data-mp="field-control"] > span::after,
1412
+ & [data-mp="field-tick"] > svg,
1413
+ & [data-mp="field-dot"]::after,
1414
+ & [data-mp="field-box"] ::picker(select) {
1415
+ transition: none;
1416
+ }
1417
+ }
1418
+
1419
+ @media (forced-colors: active) {
1420
+ & :is([data-mp="field-box"], [data-mp="choice-body"], [data-mp="code-slot"], [data-mp="stepper-button"] > span) {
1421
+ border: 1px solid CanvasText;
1422
+ }
1423
+
1424
+ /* As the system draws them */
1425
+ & [data-mp="field-control"]:is([data-type="slider"], [data-type="switch"], [data-type="checkbox"]) input {
1426
+ appearance: auto;
1427
+ position: static;
1428
+ opacity: 1;
1429
+ }
1430
+
1431
+ & [data-mp="field-control"][data-type="checkbox"] input {
1432
+ inline-size: 1.5rem;
1433
+ block-size: 1.5rem;
1434
+ }
1435
+
1436
+ & [data-mp="color-swatch"] {
1437
+ forced-color-adjust: none;
1438
+ }
1439
+
1440
+ & :is([data-mp="slider-track"], [data-mp="slider-thumb"], [data-mp="choices-thumb"]),
1441
+ & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > span {
1442
+ display: none;
1443
+ }
1444
+
1445
+ & input:checked + :is([data-mp="choice-body"], [data-mp="field-tick"], [data-mp="field-dot"]) {
1446
+ forced-color-adjust: none;
1447
+ background: Highlight;
1448
+ color: HighlightText;
1449
+ }
1450
+ }
1451
+ }
1452
+ }