material 3.0.0-next.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/README.md +59 -370
  2. package/dist/components/badge/index.d.ts +1 -1
  3. package/dist/components/badge/index.js +1 -1
  4. package/dist/components/button/index.d.ts +1 -1
  5. package/dist/components/button/index.js +1 -1
  6. package/dist/components/card/index.d.ts +1 -1
  7. package/dist/components/card/index.js +1 -1
  8. package/dist/components/checkbox/index.d.ts +1 -1
  9. package/dist/components/checkbox/index.js +1 -1
  10. package/dist/components/chips/index.d.ts +1 -1
  11. package/dist/components/chips/index.js +1 -1
  12. package/dist/components/datepicker/index.d.ts +1 -1
  13. package/dist/components/datepicker/index.js +1 -1
  14. package/dist/components/dialog/index.d.ts +1 -1
  15. package/dist/components/dialog/index.js +1 -1
  16. package/dist/components/divider/index.d.ts +1 -1
  17. package/dist/components/divider/index.js +1 -1
  18. package/dist/components/drawer/index.d.ts +1 -1
  19. package/dist/components/drawer/index.js +1 -1
  20. package/dist/components/index.d.ts +1 -1
  21. package/dist/components/list/config.js +6 -1
  22. package/dist/components/list/constants.d.ts +10 -0
  23. package/dist/components/list/constants.js +4 -0
  24. package/dist/components/list/index.d.ts +3 -3
  25. package/dist/components/list/index.js +2 -2
  26. package/dist/components/list/list.d.ts +17 -0
  27. package/dist/components/list/list.js +2 -2
  28. package/dist/components/list/types.d.ts +29 -1
  29. package/dist/components/loading-indicator/index.d.ts +1 -1
  30. package/dist/components/loading-indicator/index.js +1 -1
  31. package/dist/components/menu/index.d.ts +1 -1
  32. package/dist/components/menu/index.js +1 -1
  33. package/dist/components/progress/index.d.ts +1 -1
  34. package/dist/components/progress/index.js +1 -1
  35. package/dist/components/progress/types.d.ts +20 -10
  36. package/dist/components/radios/index.d.ts +1 -1
  37. package/dist/components/radios/index.js +1 -1
  38. package/dist/components/search/index.d.ts +1 -1
  39. package/dist/components/search/index.js +1 -1
  40. package/dist/components/select/index.d.ts +1 -1
  41. package/dist/components/select/index.js +1 -1
  42. package/dist/components/slider/index.d.ts +1 -1
  43. package/dist/components/slider/index.js +1 -1
  44. package/dist/components/slider/types.d.ts +7 -0
  45. package/dist/components/snackbar/index.d.ts +1 -1
  46. package/dist/components/snackbar/index.js +1 -1
  47. package/dist/components/split-button/index.d.ts +1 -1
  48. package/dist/components/split-button/index.js +1 -1
  49. package/dist/components/switch/index.d.ts +1 -1
  50. package/dist/components/switch/index.js +1 -1
  51. package/dist/components/tabs/index.d.ts +1 -0
  52. package/dist/components/tabs/index.js +1 -0
  53. package/dist/components/tabs/types.d.ts +15 -3
  54. package/dist/components/text-field/features/placement.js +7 -4
  55. package/dist/components/timepicker/index.d.ts +1 -1
  56. package/dist/components/timepicker/index.js +1 -1
  57. package/dist/components/tooltip/index.d.ts +1 -1
  58. package/dist/components/tooltip/index.js +1 -1
  59. package/dist/core/compose/features/textinput.js +3 -1
  60. package/dist/core/compose/index.d.ts +1 -1
  61. package/dist/core/dom/html.d.ts +1 -1
  62. package/dist/elements/css/button.css +1 -1
  63. package/dist/elements/css/button.js +1 -1
  64. package/dist/elements/css/card.css +1 -1
  65. package/dist/elements/css/card.js +1 -1
  66. package/dist/elements/css/checkbox.css +1 -1
  67. package/dist/elements/css/checkbox.js +1 -1
  68. package/dist/elements/css/chips.css +1 -1
  69. package/dist/elements/css/chips.js +1 -1
  70. package/dist/elements/css/dialog.css +1 -1
  71. package/dist/elements/css/dialog.js +1 -1
  72. package/dist/elements/css/extended-fab.css +1 -1
  73. package/dist/elements/css/extended-fab.js +1 -1
  74. package/dist/elements/css/fab-menu.css +1 -1
  75. package/dist/elements/css/fab-menu.js +1 -1
  76. package/dist/elements/css/fab.css +1 -1
  77. package/dist/elements/css/fab.js +1 -1
  78. package/dist/elements/css/hosts/switch.css +1 -1
  79. package/dist/elements/css/hosts/text-field.css +1 -1
  80. package/dist/elements/css/icon-button.css +1 -1
  81. package/dist/elements/css/icon-button.js +1 -1
  82. package/dist/elements/css/list.css +1 -1
  83. package/dist/elements/css/list.js +1 -1
  84. package/dist/elements/css/menu.css +1 -1
  85. package/dist/elements/css/menu.js +1 -1
  86. package/dist/elements/css/radios.css +1 -1
  87. package/dist/elements/css/radios.js +1 -1
  88. package/dist/elements/css/select.css +1 -1
  89. package/dist/elements/css/select.js +1 -1
  90. package/dist/elements/css/side-sheet.css +1 -1
  91. package/dist/elements/css/side-sheet.js +1 -1
  92. package/dist/elements/css/slider.css +1 -1
  93. package/dist/elements/css/slider.js +1 -1
  94. package/dist/elements/css/snackbar.css +1 -1
  95. package/dist/elements/css/snackbar.js +1 -1
  96. package/dist/elements/css/switch.css +1 -1
  97. package/dist/elements/css/switch.js +1 -1
  98. package/dist/elements/css/text-field.css +1 -1
  99. package/dist/elements/css/text-field.js +1 -1
  100. package/dist/elements/define.d.ts +20 -0
  101. package/dist/elements/list.d.ts +6 -0
  102. package/dist/elements/list.js +1 -0
  103. package/dist/elements/preupgrade/badge.css +1 -1
  104. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  105. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  106. package/dist/elements/preupgrade/button-group.css +1 -1
  107. package/dist/elements/preupgrade/button.css +2 -2
  108. package/dist/elements/preupgrade/card.css +1 -1
  109. package/dist/elements/preupgrade/carousel.css +1 -1
  110. package/dist/elements/preupgrade/checkbox.css +2 -2
  111. package/dist/elements/preupgrade/chips.css +1 -1
  112. package/dist/elements/preupgrade/datepicker.css +1 -1
  113. package/dist/elements/preupgrade/dialog.css +1 -1
  114. package/dist/elements/preupgrade/divider.css +1 -1
  115. package/dist/elements/preupgrade/drawer.css +1 -1
  116. package/dist/elements/preupgrade/extended-fab.css +1 -1
  117. package/dist/elements/preupgrade/fab-menu.css +1 -1
  118. package/dist/elements/preupgrade/fab.css +1 -1
  119. package/dist/elements/preupgrade/icon-button.css +1 -1
  120. package/dist/elements/preupgrade/list.css +2 -2
  121. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  122. package/dist/elements/preupgrade/menu.css +1 -1
  123. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  124. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  125. package/dist/elements/preupgrade/progress.css +1 -1
  126. package/dist/elements/preupgrade/radios.css +2 -2
  127. package/dist/elements/preupgrade/search.css +1 -1
  128. package/dist/elements/preupgrade/select.css +1 -1
  129. package/dist/elements/preupgrade/side-sheet.css +1 -1
  130. package/dist/elements/preupgrade/slider.css +1 -1
  131. package/dist/elements/preupgrade/snackbar.css +1 -1
  132. package/dist/elements/preupgrade/split-button.css +1 -1
  133. package/dist/elements/preupgrade/switch.css +2 -2
  134. package/dist/elements/preupgrade/tabs.css +1 -1
  135. package/dist/elements/preupgrade/text-field.css +2 -2
  136. package/dist/elements/preupgrade/timepicker.css +1 -1
  137. package/dist/elements/preupgrade/toolbar.css +1 -1
  138. package/dist/elements/preupgrade/tooltip.css +1 -1
  139. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  140. package/dist/elements/preupgrade.css +2 -2
  141. package/dist/elements/preupgrade.js +1 -1
  142. package/dist/elements/styles.d.ts +13 -1
  143. package/dist/elements/switch.d.ts +1 -0
  144. package/dist/elements/switch.js +1 -0
  145. package/dist/elements/text-field.js +1 -5
  146. package/dist/package.json +28 -4
  147. package/dist/styles/badge.css +1 -1
  148. package/dist/styles/base.css +1 -1
  149. package/dist/styles/bottom-app-bar.css +1 -1
  150. package/dist/styles/bottom-sheet.css +1 -1
  151. package/dist/styles/button-group.css +1 -1
  152. package/dist/styles/button.css +2 -2
  153. package/dist/styles/card.css +2 -2
  154. package/dist/styles/carousel.css +1 -1
  155. package/dist/styles/checkbox.css +2 -2
  156. package/dist/styles/chips.css +2 -2
  157. package/dist/styles/contrast.css +1 -1
  158. package/dist/styles/datepicker.css +1 -1
  159. package/dist/styles/dialog.css +2 -2
  160. package/dist/styles/divider.css +1 -1
  161. package/dist/styles/drawer.css +1 -1
  162. package/dist/styles/extended-fab.css +2 -2
  163. package/dist/styles/fab-menu.css +2 -2
  164. package/dist/styles/fab.css +2 -2
  165. package/dist/styles/icon-button.css +2 -2
  166. package/dist/styles/list.css +2 -2
  167. package/dist/styles/loading-indicator.css +1 -1
  168. package/dist/styles/menu.css +2 -2
  169. package/dist/styles/navigation-bar.css +1 -1
  170. package/dist/styles/navigation-rail.css +1 -1
  171. package/dist/styles/progress.css +1 -1
  172. package/dist/styles/radios.css +2 -2
  173. package/dist/styles/search.css +1 -1
  174. package/dist/styles/select.css +2 -2
  175. package/dist/styles/side-sheet.css +2 -2
  176. package/dist/styles/slider.css +2 -2
  177. package/dist/styles/snackbar.css +2 -2
  178. package/dist/styles/split-button.css +1 -1
  179. package/dist/styles/switch.css +2 -2
  180. package/dist/styles/tabs.css +1 -1
  181. package/dist/styles/text-field.css +2 -2
  182. package/dist/styles/timepicker.css +1 -1
  183. package/dist/styles/toolbar.css +1 -1
  184. package/dist/styles/tooltip.css +1 -1
  185. package/dist/styles/top-app-bar.css +1 -1
  186. package/dist/styles/typography.css +1 -1
  187. package/dist/styles/utilities.css +1 -1
  188. package/dist/styles.css +2 -2
  189. package/dist/themes/autumn-contrast.css +1 -1
  190. package/dist/themes/autumn.css +1 -1
  191. package/dist/themes/baseline-contrast.css +1 -1
  192. package/dist/themes/baseline.css +1 -1
  193. package/dist/themes/brownbeige-contrast.css +1 -1
  194. package/dist/themes/brownbeige.css +1 -1
  195. package/dist/themes/content-contrast.css +1 -1
  196. package/dist/themes/content.css +1 -1
  197. package/dist/themes/desert-contrast.css +1 -1
  198. package/dist/themes/desert.css +1 -1
  199. package/dist/themes/expressive-contrast.css +1 -1
  200. package/dist/themes/expressive.css +1 -1
  201. package/dist/themes/fidelity-contrast.css +1 -1
  202. package/dist/themes/fidelity.css +1 -1
  203. package/dist/themes/forest-contrast.css +1 -1
  204. package/dist/themes/forest.css +1 -1
  205. package/dist/themes/fruit-salad-contrast.css +1 -1
  206. package/dist/themes/fruit-salad.css +1 -1
  207. package/dist/themes/highcontrast-contrast.css +1 -1
  208. package/dist/themes/highcontrast.css +1 -1
  209. package/dist/themes/monochrome-contrast.css +1 -1
  210. package/dist/themes/monochrome.css +1 -1
  211. package/dist/themes/neutral-contrast.css +1 -1
  212. package/dist/themes/neutral.css +1 -1
  213. package/dist/themes/ocean-contrast.css +1 -1
  214. package/dist/themes/ocean.css +1 -1
  215. package/dist/themes/rainbow-contrast.css +1 -1
  216. package/dist/themes/rainbow.css +1 -1
  217. package/dist/themes/sageivory-contrast.css +1 -1
  218. package/dist/themes/sageivory.css +1 -1
  219. package/dist/themes/spring-contrast.css +1 -1
  220. package/dist/themes/spring.css +1 -1
  221. package/dist/themes/summer-contrast.css +1 -1
  222. package/dist/themes/summer.css +1 -1
  223. package/dist/themes/sunset-contrast.css +1 -1
  224. package/dist/themes/sunset.css +1 -1
  225. package/dist/themes/tealcaramel-contrast.css +1 -1
  226. package/dist/themes/tealcaramel.css +1 -1
  227. package/dist/themes/vibrant-contrast.css +1 -1
  228. package/dist/themes/vibrant.css +1 -1
  229. package/package.json +28 -4
  230. package/src/styles/abstract/_mixins.scss +17 -5
  231. package/src/styles/abstract/_variables.scss +1 -1
  232. package/src/styles/components/_button.scss +10 -7
  233. package/src/styles/components/_checkbox.scss +10 -0
  234. package/src/styles/components/_chips.scss +10 -0
  235. package/src/styles/components/_dialog.scss +16 -0
  236. package/src/styles/components/_fab-menu.scss +20 -1
  237. package/src/styles/components/_icon-button.scss +6 -0
  238. package/src/styles/components/_list.scss +48 -4
  239. package/src/styles/components/_menu.scss +8 -0
  240. package/src/styles/components/_radios.scss +22 -4
  241. package/src/styles/components/_select.scss +13 -29
  242. package/src/styles/components/_side-sheet.scss +22 -0
  243. package/src/styles/components/_slider.scss +3 -3
  244. package/src/styles/components/_switch.scss +19 -0
  245. package/src/styles/components/_text-field.scss +97 -319
  246. package/src/styles/elements/_button.scss +17 -1
  247. package/src/styles/elements/_checkbox.scss +16 -0
  248. package/src/styles/elements/_list.scss +6 -0
  249. package/src/styles/elements/_radios.scss +3 -2
  250. package/src/styles/elements/_switch.scss +52 -0
  251. package/src/styles/elements/_text-field.scss +21 -0
  252. package/dist/LICENSE +0 -21
  253. package/dist/README.md +0 -438
@@ -8,11 +8,18 @@
8
8
  // Define the component once
9
9
  $component: "#{base.$prefix}-text-field";
10
10
 
11
- // Where the text starts or ends beside a prefix or a suffix: the affix's own
12
- // inset, its width, which placement.ts measures into a custom property (32px
13
- // until it has), and the 2dp to the text (PrefixSuffixTextPadding).
14
- @function beside-affix($inset, $affix) {
15
- @return calc(#{$inset} + var(--#{$component}-#{$affix}-width, 32px) + 2px);
11
+ // Right to left (FLO-562). Every horizontal inset is a custom property, set
12
+ // once whatever the direction, and the rules in this mixin, at the end of the
13
+ // component's block, are the whole mirror. Two selectors: an ancestor's `dir`,
14
+ // which needs no script, and --rtl, which placement.ts sets from the computed
15
+ // direction, for a field in a shadow root, where a `dir` outside it does not
16
+ // reach. Physical sides, as bundlers lower logical insets, corners and :dir()
17
+ // into :lang() lists that miss dir="rtl".
18
+ @mixin mirrored {
19
+ [dir='rtl'] &,
20
+ &.#{$component}--rtl {
21
+ @content;
22
+ }
16
23
  }
17
24
 
18
25
  // Autofill detection animations
@@ -60,7 +67,7 @@ $component: "#{base.$prefix}-text-field";
60
67
  @include m.typography("body-large");
61
68
  user-select: none;
62
69
  position: absolute;
63
- left: 16px;
70
+ left: var(--#{$component}-start, 16px);
64
71
  top: 50%;
65
72
  transform: translateY(-50%);
66
73
  transform-origin: left top;
@@ -136,7 +143,7 @@ $component: "#{base.$prefix}-text-field";
136
143
  &__prefix {
137
144
  @include m.typography("body-large");
138
145
  position: absolute;
139
- left: 16px;
146
+ left: var(--#{$component}-start, 16px);
140
147
  top: 50%;
141
148
  transform: translateY(-50%);
142
149
  color: t.color("on-surface-variant");
@@ -157,7 +164,7 @@ $component: "#{base.$prefix}-text-field";
157
164
  &__suffix {
158
165
  @include m.typography("body-large");
159
166
  position: absolute;
160
- right: 16px;
167
+ right: var(--#{$component}-end, 16px);
161
168
  top: 50%;
162
169
  transform: translateY(-50%);
163
170
  color: t.color("on-surface-variant");
@@ -219,59 +226,42 @@ $component: "#{base.$prefix}-text-field";
219
226
  }
220
227
  }
221
228
 
222
- // A field with a prefix or a suffix pads its input from --text-start and
223
- // --text-end (the rules are last in this block): what stands on that side,
224
- // an icon then the affix, each after the other (FLO-299). The label is
225
- // not moved by a prefix: it starts where the content does (Compose
226
- // TextFieldImpl, "Prefix/suffix does not get applied to label").
227
- &--with-prefix {
228
- --#{$component}-text-start: #{beside-affix(16px, prefix)};
229
- }
230
-
231
- &--with-suffix {
232
- --#{$component}-text-end: #{beside-affix(16px, suffix)};
229
+ // A hidden icon is hidden (#60): an author rule beats the user agent's
230
+ // `[hidden] { display: none }`, so the parts' `display: flex` above must
231
+ // yield to their own hidden state. Scoped to the two parts, not a global
232
+ // `[hidden]` rule. The padding an icon's presence reserved stays: M3 has
233
+ // no hidden-icon state ("Left/right padding with icons 12dp", "Padding
234
+ // between icons and text 16dp"), and Compose's icon slot keeps its room
235
+ // whatever it draws.
236
+ &__leading-icon[hidden],
237
+ &__trailing-icon[hidden] {
238
+ display: none;
233
239
  }
234
240
 
235
- // Adjustments when icons are present: an icon is 12dp in, and what
236
- // follows it 16dp further ("Left/right padding with icons 12dp", "Padding
237
- // between icons and text 16dp", m3.material.io text fields): 52dp with
238
- // the 24dp icon, 48dp with compact's 20dp one
241
+ // Where the content starts and ends: 16dp in (TextFieldPadding), or after
242
+ // an icon, which is 12dp in with 16dp after it ("Left/right padding with
243
+ // icons 12dp", "Padding between icons and text 16dp", m3.material.io text
244
+ // fields): 52dp with the 24dp icon, 48dp with compact's 20dp one. The
245
+ // label, a prefix and a suffix stand there; the label is not moved by a
246
+ // prefix (Compose TextFieldImpl, "Prefix/suffix does not get applied to
247
+ // label").
239
248
  &--with-leading-icon {
240
- --#{$component}-text-start: 52px;
241
-
242
- .#{$component}__label {
243
- left: 52px;
244
- }
245
-
246
- .#{$component}__input {
247
- padding-left: 52px;
248
- }
249
-
250
- // With a prefix too: the icon, the prefix, then the text
251
- &.#{$component}--with-prefix {
252
- --#{$component}-text-start: #{beside-affix(52px, prefix)};
253
-
254
- .#{$component}__prefix {
255
- left: 52px;
256
- }
257
- }
249
+ --#{$component}-start: 52px;
258
250
  }
259
251
 
260
252
  &--with-trailing-icon {
261
- --#{$component}-text-end: 52px;
262
-
263
- .#{$component}__input {
264
- padding-right: 52px;
265
- }
253
+ --#{$component}-end: 52px;
254
+ }
266
255
 
267
- // With a suffix too: the text, the suffix, then the icon
268
- &.#{$component}--with-suffix {
269
- --#{$component}-text-end: #{beside-affix(52px, suffix)};
256
+ // What a prefix or a suffix adds before the text: its width, which
257
+ // placement.ts measures into a custom property (32px until it has), and
258
+ // the 2dp to the text (PrefixSuffixTextPadding) (FLO-299)
259
+ &--with-prefix {
260
+ --#{$component}-prefix-space: calc(var(--#{$component}-prefix-width, 32px) + 2px);
261
+ }
270
262
 
271
- .#{$component}__suffix {
272
- right: 52px;
273
- }
274
- }
263
+ &--with-suffix {
264
+ --#{$component}-suffix-space: calc(var(--#{$component}-suffix-width, 32px) + 2px);
275
265
  }
276
266
 
277
267
  // Error state
@@ -399,68 +389,6 @@ $component: "#{base.$prefix}-text-field";
399
389
  }
400
390
  }
401
391
 
402
- // RTL support
403
- @include m.rtl {
404
- &__label {
405
- left: auto;
406
- right: 16px;
407
- transform-origin: right top;
408
- }
409
-
410
- &__prefix {
411
- left: auto;
412
- right: 16px;
413
- }
414
-
415
- &__suffix {
416
- right: auto;
417
- left: 16px;
418
- }
419
-
420
- &__leading-icon {
421
- left: auto;
422
- right: 12px;
423
- }
424
-
425
- &__trailing-icon {
426
- right: auto;
427
- left: 12px;
428
- }
429
-
430
- &--with-leading-icon {
431
- .#{$component}__label {
432
- left: auto;
433
- right: 52px;
434
- }
435
-
436
- .#{$component}__input {
437
- padding-left: 16px;
438
- padding-right: 52px;
439
- }
440
-
441
- &.#{$component}--with-prefix {
442
- .#{$component}__prefix {
443
- left: auto;
444
- right: 52px;
445
- }
446
- }
447
- }
448
-
449
- &--with-trailing-icon {
450
- .#{$component}__input {
451
- padding-right: 16px;
452
- padding-left: 52px;
453
- }
454
-
455
- &.#{$component}--with-suffix {
456
- .#{$component}__suffix {
457
- right: auto;
458
- left: 52px;
459
- }
460
- }
461
- }
462
- }
463
-
464
392
  // ===== FILLED VARIANT =====
465
393
  &--filled {
466
394
  // the label at rest is on-surface-variant at full strength: faded to
@@ -599,57 +527,9 @@ $component: "#{base.$prefix}-text-field";
599
527
  }
600
528
 
601
529
  // Icon adjustments for filled variant
602
- &.#{$component}--with-leading-icon {
603
- .#{$component}__input {
604
- padding-left: 52px;
605
- }
606
-
607
- .#{$component}__label {
608
- left: 52px;
609
- }
610
-
611
- .#{$component}__leading-icon {
612
- top: 28px;
613
- }
614
- }
615
-
616
- &.#{$component}--with-trailing-icon {
617
- .#{$component}__input {
618
- padding-right: 52px;
619
- }
620
-
621
- .#{$component}__trailing-icon {
622
- top: 28px;
623
- }
624
- }
625
-
626
- // RTL support
627
- @include m.rtl {
628
- .#{$component}__label {
629
- left: auto;
630
- right: 16px;
631
- }
632
-
633
- &.#{$component}--with-leading-icon {
634
- .#{$component}__input {
635
- // The sides only: the shorthand also set the default density's
636
- // top and bottom on a compact field
637
- padding-left: 16px;
638
- padding-right: 52px;
639
- }
640
-
641
- .#{$component}__label {
642
- left: auto;
643
- right: 52px;
644
- }
645
- }
646
-
647
- &.#{$component}--with-trailing-icon {
648
- .#{$component}__input {
649
- padding-right: 16px;
650
- padding-left: 52px;
651
- }
652
- }
530
+ &.#{$component}--with-leading-icon .#{$component}__leading-icon,
531
+ &.#{$component}--with-trailing-icon .#{$component}__trailing-icon {
532
+ top: 28px;
653
533
  }
654
534
  }
655
535
 
@@ -742,7 +622,6 @@ $component: "#{base.$prefix}-text-field";
742
622
 
743
623
  // LabelColor at full strength: faded to 0.5 it failed 4.5:1 (FLO-298)
744
624
  .#{$component}__label {
745
- left: 16px;
746
625
  top: 50%;
747
626
  }
748
627
 
@@ -753,8 +632,8 @@ $component: "#{base.$prefix}-text-field";
753
632
  // its height: up the 28px to the edge, and half its scaled box
754
633
  transform: translateY(calc(-28px - 37.5%)) scale(0.75);
755
634
  // The floated label starts 16dp in, inside the notch, whatever
756
- // the icon or prefix at rest
757
- left: 16px;
635
+ // the icon at rest: the label's own inset, either direction
636
+ --#{$component}-start: 16px;
758
637
  }
759
638
 
760
639
  // Floated from the input's own state too, as the filled variant is
@@ -762,7 +641,7 @@ $component: "#{base.$prefix}-text-field";
762
641
  // Centred on the top edge (`endY = -(it.height / 2)`), whatever
763
642
  // its height: up the 28px to the edge, and half its scaled box
764
643
  transform: translateY(calc(-28px - 37.5%)) scale(0.75);
765
- left: 16px;
644
+ --#{$component}-start: 16px;
766
645
  }
767
646
 
768
647
  // Hover state
@@ -810,78 +689,6 @@ $component: "#{base.$prefix}-text-field";
810
689
  pointer-events: none;
811
690
  }
812
691
 
813
- // Icon adjustments for outlined variant
814
- &.#{$component}--with-leading-icon {
815
- .#{$component}__input {
816
- padding-left: 52px;
817
- }
818
-
819
- .#{$component}__label {
820
- left: 52px;
821
- }
822
-
823
- &:not(.#{$component}--empty) .#{$component}__label,
824
- &.#{$component}--focused .#{$component}__label {
825
- left: 16px;
826
- }
827
- }
828
-
829
- &.#{$component}--with-trailing-icon {
830
- .#{$component}__input {
831
- padding-right: 52px;
832
- }
833
- }
834
-
835
- // Right to left follows --rtl, which placement.ts sets from the
836
- // computed direction: the [dir] selectors cannot see a direction set
837
- // outside a shadow root, and bundlers lower logical insets, corners
838
- // and :dir() into :lang() lists that miss dir="rtl"
839
- &.#{$component}--rtl {
840
- .#{$component}__label {
841
- left: auto;
842
- right: 16px;
843
- transform-origin: right top;
844
- }
845
-
846
- &.#{$component}--with-leading-icon .#{$component}__label {
847
- left: auto;
848
- right: 52px;
849
- }
850
-
851
- &:not(.#{$component}--empty) .#{$component}__label,
852
- &.#{$component}--focused .#{$component}__label,
853
- &:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill)) .#{$component}__label {
854
- left: auto;
855
- right: 16px;
856
- }
857
-
858
- .#{$component}__outline-leading {
859
- border-radius: 0 f.get-shape("extra-small")
860
- f.get-shape("extra-small") 0;
861
- }
862
-
863
- .#{$component}__outline-trailing {
864
- border-radius: f.get-shape("extra-small") 0 0
865
- f.get-shape("extra-small");
866
- }
867
- }
868
-
869
- // RTL support for the light DOM
870
- @include m.rtl {
871
- &.#{$component}--with-leading-icon {
872
- .#{$component}__input {
873
- padding-left: 16px;
874
- padding-right: 52px;
875
- }
876
- }
877
-
878
- &.#{$component}--with-trailing-icon {
879
- .#{$component}__input {
880
- padding-right: 16px;
881
- padding-left: 52px;
882
- }
883
- }
884
- }
885
692
  }
886
693
 
887
694
  // Multiline styles
@@ -1037,98 +844,66 @@ $component: "#{base.$prefix}-text-field";
1037
844
  }
1038
845
  }
1039
846
 
1040
- // Adjust element positions for compact with icons
847
+ // The compact icon box is 20dp: the content starts 48dp in
1041
848
  &.#{$component}--with-leading-icon {
1042
- --#{$component}-text-start: 48px;
1043
-
1044
- .#{$component}__label {
1045
- left: 48px;
1046
- }
1047
-
1048
- .#{$component}__input {
1049
- padding-left: 48px;
1050
- }
1051
-
1052
- &.#{$component}--with-prefix {
1053
- --#{$component}-text-start: #{beside-affix(48px, prefix)};
1054
-
1055
- .#{$component}__prefix {
1056
- left: 48px;
1057
- }
1058
- }
849
+ --#{$component}-start: 48px;
1059
850
  }
1060
851
 
1061
852
  &.#{$component}--with-trailing-icon {
1062
- --#{$component}-text-end: 48px;
1063
-
1064
- .#{$component}__input {
1065
- padding-right: 48px;
1066
- }
853
+ --#{$component}-end: 48px;
854
+ }
855
+ }
1067
856
 
1068
- &.#{$component}--with-suffix {
1069
- --#{$component}-text-end: #{beside-affix(48px, suffix)};
857
+ // ===== THE INPUT'S SIDES, AND THE MIRROR =====
858
+ // The text starts where the content does, after a prefix if there is one,
859
+ // and ends before a suffix. Last, and one class heavier (the field), so it
860
+ // holds over the variants' and the densities' padding shorthands.
861
+ .#{$component}__field .#{$component}__input {
862
+ padding-left: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
863
+ padding-right: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
864
+ }
1070
865
 
1071
- .#{$component}__suffix {
1072
- right: 48px;
1073
- }
1074
- }
866
+ @include mirrored {
867
+ .#{$component}__label {
868
+ left: auto;
869
+ right: var(--#{$component}-start, 16px);
870
+ transform-origin: right top;
1075
871
  }
1076
872
 
1077
- // RTL adjustments for compact density
1078
- @include m.rtl {
1079
- &.#{$component}--with-leading-icon {
1080
- .#{$component}__label {
1081
- left: auto;
1082
- right: 48px;
1083
- }
873
+ .#{$component}__prefix {
874
+ left: auto;
875
+ right: var(--#{$component}-start, 16px);
876
+ }
1084
877
 
1085
- .#{$component}__input {
1086
- padding-left: 16px;
1087
- padding-right: 48px;
1088
- }
878
+ .#{$component}__suffix {
879
+ right: auto;
880
+ left: var(--#{$component}-end, 16px);
881
+ }
1089
882
 
1090
- &.#{$component}--with-prefix {
1091
- .#{$component}__prefix {
1092
- left: auto;
1093
- right: 48px;
1094
- }
1095
- }
1096
- }
883
+ .#{$component}__leading-icon {
884
+ left: auto;
885
+ right: 12px;
886
+ }
1097
887
 
1098
- &.#{$component}--with-trailing-icon {
1099
- .#{$component}__input {
1100
- padding-right: 16px;
1101
- padding-left: 48px;
1102
- }
888
+ .#{$component}__trailing-icon {
889
+ right: auto;
890
+ left: 12px;
891
+ }
1103
892
 
1104
- &.#{$component}--with-suffix {
1105
- .#{$component}__suffix {
1106
- right: auto;
1107
- left: 48px;
1108
- }
1109
- }
1110
- }
893
+ .#{$component}__field .#{$component}__input {
894
+ padding-left: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
895
+ padding-right: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
1111
896
  }
1112
- }
1113
897
 
1114
- // ===== BESIDE A PREFIX OR A SUFFIX =====
1115
- // The input's padding in a field with a prefix or a suffix, from the two
1116
- // insets set above. Last, and one class heavier, so it holds over the
1117
- // variants' and the densities' paddings. A selector list, not :is():
1118
- // bundlers emit an :is() rule three times, with the -webkit-any() and
1119
- // -moz-any() forms.
1120
- &.#{$component}--with-prefix,
1121
- &.#{$component}--with-suffix {
1122
- .#{$component}__input {
1123
- padding-left: var(--#{$component}-text-start, 16px);
1124
- padding-right: var(--#{$component}-text-end, 16px);
898
+ // The outline's corners follow its segments
899
+ .#{$component}__outline-leading {
900
+ border-radius: 0 f.get-shape("extra-small")
901
+ f.get-shape("extra-small") 0;
1125
902
  }
1126
903
 
1127
- @include m.rtl {
1128
- .#{$component}__input {
1129
- padding-left: var(--#{$component}-text-end, 16px);
1130
- padding-right: var(--#{$component}-text-start, 16px);
1131
- }
904
+ .#{$component}__outline-trailing {
905
+ border-radius: f.get-shape("extra-small") 0 0
906
+ f.get-shape("extra-small");
1132
907
  }
1133
908
  }
1134
909
  }
@@ -1184,7 +959,10 @@ $component: "#{base.$prefix}-text-field";
1184
959
  cursor: default;
1185
960
  }
1186
961
 
1187
- @include m.rtl {
962
+ // The field's mirror, for the button: an ancestor's `dir`, or the
963
+ // field's --rtl inside a shadow root (FLO-562)
964
+ [dir='rtl'] &,
965
+ .#{$component}--rtl & {
1188
966
  right: auto;
1189
967
  left: 4px;
1190
968
  }
@@ -71,8 +71,24 @@ $containers: (
71
71
  flex: none;
72
72
  }
73
73
 
74
+ // Same 12dp icon-side inset as the component, logical so the reserved box
75
+ // follows direction. The host is in light DOM until upgrade.
74
76
  &[icon]:not([size]),
75
77
  &[icon][size='s'] {
76
- padding-left: v.button('padding-icon');
78
+ padding-inline-start: v.button('padding-icon');
79
+ }
80
+
81
+ // Match the text button's leading-icon insets at its small sizes.
82
+ &[variant='text'][icon]:not([size]),
83
+ &[variant='text'][icon][size='xs'],
84
+ &[variant='text'][icon][size='s'] {
85
+ padding-inline: v.button('padding-horizontal-small') v.button('padding-s');
86
+ }
87
+
88
+ // Larger text buttons use the size's spacing on both sides of the icon.
89
+ @each $size in m, l, xl {
90
+ &[variant='text'][icon][size='#{$size}'] {
91
+ padding: 0 v.button('padding-#{$size}');
92
+ }
77
93
  }
78
94
  }
@@ -35,4 +35,20 @@
35
35
  order: 1;
36
36
  margin-inline: 12px 0;
37
37
  }
38
+
39
+ // No slotted text, and no `label` attribute or an empty one (the element
40
+ // reads `label=""` as no label and builds none): the host is its own 48px
41
+ // target, and the box sits in its centre, as components/_checkbox.scss has it.
42
+ // A whitespace-only text node is not matched here: CSS cannot see it, so
43
+ // `<m-checkbox> </m-checkbox>` (or the tag with a line break inside) keeps
44
+ // the labelled layout before upgrade although the element then builds no
45
+ // label. Write the tag with nothing between its tags.
46
+ &:empty:is(:not([label]), [label='']) {
47
+ min-width: 48px;
48
+ justify-content: center;
49
+
50
+ &::before {
51
+ margin-inline: 0;
52
+ }
53
+ }
38
54
  }
@@ -1,15 +1,21 @@
1
1
  // src/styles/elements/_list.scss
2
2
  // <m-list> before upgrade: a row per <m-list-item>, which is drawn on upgrade.
3
+ @use '../abstract/base' as base;
3
4
  @use '../abstract/mixins' as m;
4
5
  @use '../abstract/theme' as t;
6
+ @use '../abstract/variables' as v;
5
7
  @use 'config' as c;
6
8
 
7
9
  // As components/_list.scss: 8px above and below the rows, one-line rows
8
10
  // 56px, two-line 72px, a 1px divider and the subheader's padded line.
11
+ // The undefined host is the box the upgraded list will be, so it rounds by
12
+ // the same property. After upgrade the host does not paint: `::part(list)`
13
+ // is `.mtrl-list` and carries the radius.
9
14
  @include c.host('list') {
10
15
  display: block;
11
16
  padding: 8px 0;
12
17
  background-color: t.color('surface');
18
+ border-radius: var(--#{base.$prefix}-list-item-shape-outer, v.shape('large'));
13
19
  }
14
20
 
15
21
  @include c.declarations('list') {
@@ -13,11 +13,12 @@
13
13
  }
14
14
  }
15
15
 
16
- // As components/_radios.scss: a 48px row, the 40px control and 8px before the text.
16
+ // As components/_radios.scss: a row at least 48px, the 40px control and 8px
17
+ // before the text. A wrapping label grows the row.
17
18
  @include c.declarations('radios') {
18
19
  display: flex;
19
20
  align-items: center;
20
21
  box-sizing: border-box;
21
- height: 48px;
22
+ min-height: 48px;
22
23
  padding-inline-start: 48px;
23
24
  }
@@ -48,4 +48,56 @@
48
48
  color: t.color('on-surface-variant');
49
49
  @include m.typography('body-medium');
50
50
  }
51
+
52
+ // No slotted text and no label, so the supporting text is the only text and
53
+ // there is no label row above it: the spanning track is then the first row's
54
+ // only item, and an empty box synthesizes its baseline at its bottom edge —
55
+ // the track's bottom, 44px — so that was the host's baseline, 11px below the
56
+ // supporting text's own (33px) that the element's helper keeps after
57
+ // upgrade, and inline text beside the switch moved 11px at upgrade (the
58
+ // check's `[supporting-text no label]` rows). With no label above it the
59
+ // track belongs beside the text, in the row `[supporting-text]::before`
60
+ // places the text in: without it the first row keeps no height, the track's
61
+ // box does not move, and the text's baseline — the first row with one — is
62
+ // the host's before upgrade too. The labelled case keeps the span there: its
63
+ // label leads the first row and carries the baseline. An empty
64
+ // `supporting-text` is no supporting text (the element builds no helper from
65
+ // an empty value) and is the track box below, not this.
66
+ &:empty:is(:not([label]), [label=''])[supporting-text]:not([supporting-text='']) {
67
+ &::after {
68
+ grid-row: 2;
69
+ }
70
+ }
71
+
72
+ // No slotted text, and no `label` attribute or an empty one (the element
73
+ // reads `label=""` as no label and builds none), and no supporting text
74
+ // (`supporting-text` absent or empty: the element builds no helper from an
75
+ // empty value): the host is the 52 x 48 track box itself, as
76
+ // components/_switch.scss has it — the 12px gap stands between text (a
77
+ // label or supporting text) and the track, and there is none. A
78
+ // whitespace-only text node is not matched here: CSS cannot see it, so
79
+ // `<m-switch> </m-switch>` (or the tag with a line break inside) keeps the
80
+ // labelled layout before upgrade although the element then builds no label.
81
+ // Write the tag with nothing between its tags.
82
+ &:empty:is(:not([label]), [label='']):is(:not([supporting-text]), [supporting-text='']) {
83
+ column-gap: 0;
84
+ min-height: 48px;
85
+
86
+ // The container's baseline is its first row's first item's, and the track
87
+ // was the only item: an empty box synthesizes a baseline at its bottom
88
+ // edge, so the host's baseline was the track's bottom, 40px from the
89
+ // host's top — 16px below the 24px the element's own container has after
90
+ // upgrade (4px above and below the 32px track, centred: the centre). A
91
+ // zero-height item centred with the track carries that centre as the
92
+ // baseline before upgrade too; it is 0 x 0, so the host's box, the track's
93
+ // box and the zero gap do not change. `span 2` matches the empty
94
+ // `supporting-text`'s spanning `::after` above: with an item in the first
95
+ // row, that span gives the first row none of the track's 32px, so the item
96
+ // has to span with it to stay centred in the track.
97
+ &::before {
98
+ content: '';
99
+ grid-column: 1;
100
+ grid-row: 1 / span 2;
101
+ }
102
+ }
51
103
  }