material 3.7.1 → 3.7.3

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 (276) hide show
  1. package/README.md +2 -2
  2. package/dist/components/slider/features/controller.js +24 -8
  3. package/dist/elements/css/bottom-app-bar.css +1 -1
  4. package/dist/elements/css/bottom-app-bar.js +1 -1
  5. package/dist/elements/css/card.css +1 -1
  6. package/dist/elements/css/card.js +1 -1
  7. package/dist/elements/css/checkbox.css +1 -1
  8. package/dist/elements/css/checkbox.js +1 -1
  9. package/dist/elements/css/datepicker.css +1 -1
  10. package/dist/elements/css/datepicker.js +1 -1
  11. package/dist/elements/css/dialog.css +1 -1
  12. package/dist/elements/css/dialog.js +1 -1
  13. package/dist/elements/css/menu.css +1 -1
  14. package/dist/elements/css/menu.js +1 -1
  15. package/dist/elements/css/radios.css +1 -1
  16. package/dist/elements/css/radios.js +1 -1
  17. package/dist/elements/css/select.css +1 -1
  18. package/dist/elements/css/select.js +1 -1
  19. package/dist/elements/css/slider.css +1 -1
  20. package/dist/elements/css/slider.js +1 -1
  21. package/dist/elements/css/tabs.css +1 -1
  22. package/dist/elements/css/tabs.js +1 -1
  23. package/dist/elements/css/text-field.css +1 -1
  24. package/dist/elements/css/text-field.js +1 -1
  25. package/dist/elements/css/timepicker.css +1 -1
  26. package/dist/elements/css/timepicker.js +1 -1
  27. package/dist/elements/css/top-app-bar.css +1 -1
  28. package/dist/elements/css/top-app-bar.js +1 -1
  29. package/dist/elements/preupgrade/badge.css +1 -1
  30. package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
  31. package/dist/elements/preupgrade/bottom-sheet.css +1 -1
  32. package/dist/elements/preupgrade/button-group.css +1 -1
  33. package/dist/elements/preupgrade/button.css +1 -1
  34. package/dist/elements/preupgrade/card.css +1 -1
  35. package/dist/elements/preupgrade/carousel.css +1 -1
  36. package/dist/elements/preupgrade/checkbox.css +1 -1
  37. package/dist/elements/preupgrade/chips.css +1 -1
  38. package/dist/elements/preupgrade/datepicker.css +1 -1
  39. package/dist/elements/preupgrade/dialog.css +1 -1
  40. package/dist/elements/preupgrade/divider.css +1 -1
  41. package/dist/elements/preupgrade/drawer.css +1 -1
  42. package/dist/elements/preupgrade/extended-fab.css +1 -1
  43. package/dist/elements/preupgrade/fab-menu.css +1 -1
  44. package/dist/elements/preupgrade/fab.css +1 -1
  45. package/dist/elements/preupgrade/icon-button.css +1 -1
  46. package/dist/elements/preupgrade/list.css +1 -1
  47. package/dist/elements/preupgrade/loading-indicator.css +1 -1
  48. package/dist/elements/preupgrade/menu.css +1 -1
  49. package/dist/elements/preupgrade/navigation-bar.css +1 -1
  50. package/dist/elements/preupgrade/navigation-rail.css +1 -1
  51. package/dist/elements/preupgrade/progress.css +1 -1
  52. package/dist/elements/preupgrade/radios.css +1 -1
  53. package/dist/elements/preupgrade/search.css +1 -1
  54. package/dist/elements/preupgrade/select.css +1 -1
  55. package/dist/elements/preupgrade/side-sheet.css +1 -1
  56. package/dist/elements/preupgrade/slider.css +1 -1
  57. package/dist/elements/preupgrade/snackbar.css +1 -1
  58. package/dist/elements/preupgrade/split-button.css +1 -1
  59. package/dist/elements/preupgrade/switch.css +1 -1
  60. package/dist/elements/preupgrade/tabs.css +1 -1
  61. package/dist/elements/preupgrade/text-field.css +1 -1
  62. package/dist/elements/preupgrade/timepicker.css +1 -1
  63. package/dist/elements/preupgrade/toolbar.css +1 -1
  64. package/dist/elements/preupgrade/tooltip.css +1 -1
  65. package/dist/elements/preupgrade/top-app-bar.css +1 -1
  66. package/dist/elements/preupgrade.css +1 -1
  67. package/dist/styles/badge.css +1 -1
  68. package/dist/styles/base-lite.css +1 -1
  69. package/dist/styles/base.css +1 -1
  70. package/dist/styles/bottom-app-bar.css +2 -2
  71. package/dist/styles/bottom-sheet.css +1 -1
  72. package/dist/styles/button-group.css +1 -1
  73. package/dist/styles/button.css +1 -1
  74. package/dist/styles/card.css +2 -2
  75. package/dist/styles/carousel.css +1 -1
  76. package/dist/styles/checkbox.css +2 -2
  77. package/dist/styles/chips.css +1 -1
  78. package/dist/styles/contrast.css +1 -1
  79. package/dist/styles/datepicker.css +2 -2
  80. package/dist/styles/dialog.css +2 -2
  81. package/dist/styles/divider.css +1 -1
  82. package/dist/styles/drawer.css +1 -1
  83. package/dist/styles/extended-fab.css +1 -1
  84. package/dist/styles/fab-menu.css +1 -1
  85. package/dist/styles/fab.css +1 -1
  86. package/dist/styles/icon-button.css +1 -1
  87. package/dist/styles/list.css +1 -1
  88. package/dist/styles/loading-indicator.css +1 -1
  89. package/dist/styles/menu.css +2 -2
  90. package/dist/styles/navigation-bar.css +1 -1
  91. package/dist/styles/navigation-rail.css +1 -1
  92. package/dist/styles/progress.css +1 -1
  93. package/dist/styles/radios.css +2 -2
  94. package/dist/styles/search.css +1 -1
  95. package/dist/styles/select.css +2 -2
  96. package/dist/styles/side-sheet.css +1 -1
  97. package/dist/styles/slider.css +2 -2
  98. package/dist/styles/snackbar.css +1 -1
  99. package/dist/styles/split-button.css +1 -1
  100. package/dist/styles/switch.css +1 -1
  101. package/dist/styles/tabs.css +2 -2
  102. package/dist/styles/text-field.css +2 -2
  103. package/dist/styles/timepicker.css +2 -2
  104. package/dist/styles/toolbar.css +1 -1
  105. package/dist/styles/tooltip.css +1 -1
  106. package/dist/styles/top-app-bar.css +2 -2
  107. package/dist/styles/typography.css +1 -1
  108. package/dist/styles/utilities.css +1 -1
  109. package/dist/styles.css +2 -2
  110. package/dist/themes/autumn-contrast.css +1 -1
  111. package/dist/themes/autumn.css +1 -1
  112. package/dist/themes/baseline-contrast.css +1 -1
  113. package/dist/themes/baseline.css +1 -1
  114. package/dist/themes/brownbeige-contrast.css +1 -1
  115. package/dist/themes/brownbeige.css +1 -1
  116. package/dist/themes/content-contrast.css +1 -1
  117. package/dist/themes/content.css +1 -1
  118. package/dist/themes/desert-contrast.css +1 -1
  119. package/dist/themes/desert.css +1 -1
  120. package/dist/themes/expressive-contrast.css +1 -1
  121. package/dist/themes/expressive.css +1 -1
  122. package/dist/themes/fidelity-contrast.css +1 -1
  123. package/dist/themes/fidelity.css +1 -1
  124. package/dist/themes/forest-contrast.css +1 -1
  125. package/dist/themes/forest.css +1 -1
  126. package/dist/themes/fruit-salad-contrast.css +1 -1
  127. package/dist/themes/fruit-salad.css +1 -1
  128. package/dist/themes/highcontrast-contrast.css +1 -1
  129. package/dist/themes/highcontrast.css +1 -1
  130. package/dist/themes/monochrome-contrast.css +1 -1
  131. package/dist/themes/monochrome.css +1 -1
  132. package/dist/themes/neutral-contrast.css +1 -1
  133. package/dist/themes/neutral.css +1 -1
  134. package/dist/themes/ocean-contrast.css +1 -1
  135. package/dist/themes/ocean.css +1 -1
  136. package/dist/themes/rainbow-contrast.css +1 -1
  137. package/dist/themes/rainbow.css +1 -1
  138. package/dist/themes/sageivory-contrast.css +1 -1
  139. package/dist/themes/sageivory.css +1 -1
  140. package/dist/themes/spring-contrast.css +1 -1
  141. package/dist/themes/spring.css +1 -1
  142. package/dist/themes/summer-contrast.css +1 -1
  143. package/dist/themes/summer.css +1 -1
  144. package/dist/themes/sunset-contrast.css +1 -1
  145. package/dist/themes/sunset.css +1 -1
  146. package/dist/themes/tealcaramel-contrast.css +1 -1
  147. package/dist/themes/tealcaramel.css +1 -1
  148. package/dist/themes/vibrant-contrast.css +1 -1
  149. package/dist/themes/vibrant.css +1 -1
  150. package/package.json +2 -1
  151. package/src/styles/abstract/_base.scss +0 -1
  152. package/src/styles/abstract/_direction.scss +121 -152
  153. package/src/styles/abstract/_emit.scss +7 -16
  154. package/src/styles/abstract/_floating-placement.scss +9 -10
  155. package/src/styles/abstract/_functions.scss +64 -79
  156. package/src/styles/abstract/_mixins.scss +355 -459
  157. package/src/styles/abstract/_theme.scss +122 -136
  158. package/src/styles/abstract/_variables.scss +320 -390
  159. package/src/styles/abstract/chips/_assist.scss +2 -3
  160. package/src/styles/abstract/chips/_filter.scss +2 -3
  161. package/src/styles/abstract/chips/_input.scss +2 -3
  162. package/src/styles/abstract/chips/_suggestion.scss +2 -3
  163. package/src/styles/base/_body-theme.scss +10 -15
  164. package/src/styles/base/_document.scss +10 -33
  165. package/src/styles/base/_reset.scss +20 -40
  166. package/src/styles/base/_tokens.scss +6 -21
  167. package/src/styles/base/_typescale-tokens.scss +12 -16
  168. package/src/styles/base/_typography.scss +28 -37
  169. package/src/styles/components/_badge.scss +171 -193
  170. package/src/styles/components/_bottom-app-bar.scss +72 -88
  171. package/src/styles/components/_bottom-sheet.scss +188 -232
  172. package/src/styles/components/_button-group.scss +140 -189
  173. package/src/styles/components/_button.scss +382 -478
  174. package/src/styles/components/_card.scss +349 -473
  175. package/src/styles/components/_carousel.scss +134 -156
  176. package/src/styles/components/_checkbox.scss +208 -247
  177. package/src/styles/components/_chips.scss +239 -304
  178. package/src/styles/components/_datepicker.scss +172 -220
  179. package/src/styles/components/_dialog.scss +428 -553
  180. package/src/styles/components/_divider.scss +37 -46
  181. package/src/styles/components/_drawer.scss +571 -678
  182. package/src/styles/components/_extended-fab.scss +263 -294
  183. package/src/styles/components/_fab-menu.scss +225 -267
  184. package/src/styles/components/_fab.scss +197 -218
  185. package/src/styles/components/_icon-button.scss +483 -588
  186. package/src/styles/components/_list.scss +115 -144
  187. package/src/styles/components/_loading-indicator.scss +23 -29
  188. package/src/styles/components/_menu.scss +543 -699
  189. package/src/styles/components/_navigation-bar.scss +189 -234
  190. package/src/styles/components/_navigation-rail.scss +256 -312
  191. package/src/styles/components/_progress.scss +60 -85
  192. package/src/styles/components/_radios.scss +170 -205
  193. package/src/styles/components/_search.scss +369 -455
  194. package/src/styles/components/_select.scss +78 -185
  195. package/src/styles/components/_side-sheet.scss +234 -292
  196. package/src/styles/components/_slider.scss +289 -367
  197. package/src/styles/components/_snackbar.scss +149 -198
  198. package/src/styles/components/_split-button.scss +139 -228
  199. package/src/styles/components/_switch.scss +282 -349
  200. package/src/styles/components/_tabs.scss +350 -547
  201. package/src/styles/components/_text-field.scss +788 -978
  202. package/src/styles/components/_timepicker.scss +435 -506
  203. package/src/styles/components/_toolbar.scss +178 -242
  204. package/src/styles/components/_tooltip.scss +152 -197
  205. package/src/styles/components/_top-app-bar.scss +206 -224
  206. package/src/styles/elements/_badge.scss +42 -61
  207. package/src/styles/elements/_bottom-app-bar.scss +14 -20
  208. package/src/styles/elements/_bottom-sheet.scss +0 -3
  209. package/src/styles/elements/_button-group.scss +80 -80
  210. package/src/styles/elements/_button.scss +72 -88
  211. package/src/styles/elements/_card.scss +48 -57
  212. package/src/styles/elements/_carousel.scss +2 -5
  213. package/src/styles/elements/_checkbox.scss +32 -43
  214. package/src/styles/elements/_chips.scss +18 -22
  215. package/src/styles/elements/_config.scss +11 -26
  216. package/src/styles/elements/_datepicker.scss +17 -22
  217. package/src/styles/elements/_dialog.scss +0 -3
  218. package/src/styles/elements/_divider.scss +11 -13
  219. package/src/styles/elements/_drawer.scss +9 -14
  220. package/src/styles/elements/_extended-fab.scss +36 -40
  221. package/src/styles/elements/_fab-menu.scss +21 -25
  222. package/src/styles/elements/_fab.scss +17 -20
  223. package/src/styles/elements/_field.scss +93 -114
  224. package/src/styles/elements/_icon-button.scss +34 -38
  225. package/src/styles/elements/_index.scss +0 -4
  226. package/src/styles/elements/_list.scss +19 -26
  227. package/src/styles/elements/_loading-indicator.scss +6 -9
  228. package/src/styles/elements/_menu.scss +0 -3
  229. package/src/styles/elements/_navigation-bar.scss +5 -9
  230. package/src/styles/elements/_navigation-rail.scss +10 -15
  231. package/src/styles/elements/_progress.scss +15 -18
  232. package/src/styles/elements/_radios.scss +24 -49
  233. package/src/styles/elements/_search.scss +19 -24
  234. package/src/styles/elements/_select.scss +4 -9
  235. package/src/styles/elements/_side-sheet.scss +0 -3
  236. package/src/styles/elements/_slider.scss +15 -35
  237. package/src/styles/elements/_snackbar.scss +0 -3
  238. package/src/styles/elements/_split-button.scss +33 -39
  239. package/src/styles/elements/_switch.scss +50 -90
  240. package/src/styles/elements/_tabs.scss +9 -13
  241. package/src/styles/elements/_text-field.scss +150 -178
  242. package/src/styles/elements/_timepicker.scss +0 -3
  243. package/src/styles/elements/_toolbar.scss +30 -35
  244. package/src/styles/elements/_tooltip.scss +0 -3
  245. package/src/styles/elements/_top-app-bar.scss +38 -45
  246. package/src/styles/main.scss +0 -15
  247. package/src/styles/themes/_autumn.scss +240 -258
  248. package/src/styles/themes/_base-theme.scss +96 -128
  249. package/src/styles/themes/_baseline.scss +273 -314
  250. package/src/styles/themes/_brownbeige.scss +242 -250
  251. package/src/styles/themes/_content.scss +240 -248
  252. package/src/styles/themes/_desert.scss +242 -250
  253. package/src/styles/themes/_expressive.scss +242 -250
  254. package/src/styles/themes/_fidelity.scss +240 -248
  255. package/src/styles/themes/_forest.scss +242 -259
  256. package/src/styles/themes/_fruit-salad.scss +242 -250
  257. package/src/styles/themes/_highcontrast.scss +164 -172
  258. package/src/styles/themes/_index.scss +0 -1
  259. package/src/styles/themes/_monochrome.scss +226 -234
  260. package/src/styles/themes/_neutral.scss +242 -250
  261. package/src/styles/themes/_ocean.scss +242 -259
  262. package/src/styles/themes/_rainbow.scss +242 -250
  263. package/src/styles/themes/_sageivory.scss +242 -250
  264. package/src/styles/themes/_spring.scss +238 -255
  265. package/src/styles/themes/_summer.scss +242 -250
  266. package/src/styles/themes/_sunset.scss +242 -259
  267. package/src/styles/themes/_tealcaramel.scss +242 -250
  268. package/src/styles/themes/_vibrant.scss +242 -250
  269. package/src/styles/utilities/_colors.scss +44 -50
  270. package/src/styles/utilities/_flexbox.scss +48 -59
  271. package/src/styles/utilities/_layout.scss +516 -591
  272. package/src/styles/utilities/_ripple.scss +61 -70
  273. package/src/styles/utilities/_spacing.scss +120 -127
  274. package/src/styles/utilities/_typography.scss +45 -58
  275. package/src/styles/utilities/_visibility.scss +61 -76
  276. package/dist/package.json +0 -488
@@ -1,998 +1,808 @@
1
- // src/styles/components/_text-field.scss
2
1
  @use "../../styles/abstract/base" as base;
3
2
  @use "../../styles/abstract/variables" as v;
4
3
  @use "../../styles/abstract/functions" as f;
5
4
  @use "../../styles/abstract/mixins" as m;
6
5
  @use "../../styles/abstract/theme" as t;
7
6
 
8
- // Define the component once
9
7
  $component: "#{base.$prefix}-text-field";
10
8
 
11
- // Right to left. 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
9
  @mixin mirrored {
19
- [dir='rtl'] &,
20
- &.#{$component}--rtl {
21
- @content;
22
- }
10
+ [dir='rtl'] &,
11
+ &.#{$component}--rtl {
12
+ @content;
13
+ }
23
14
  }
24
15
 
25
- // Autofill detection animations
26
16
  @keyframes onAutoFillStart {
27
- from {
28
- opacity: 1;
29
- }
30
- to {
31
- opacity: 1;
32
- }
17
+ from {
18
+ opacity: 1;
19
+ }
20
+ to {
21
+ opacity: 1;
22
+ }
33
23
  }
34
24
 
35
25
  @keyframes onAutoFillCancel {
36
- from {
37
- opacity: 1;
38
- }
39
- to {
40
- opacity: 1;
41
- }
26
+ from {
27
+ opacity: 1;
28
+ }
29
+ to {
30
+ opacity: 1;
31
+ }
42
32
  }
43
33
 
44
- // ===== BASE STYLES =====
45
34
  .#{$component} {
46
- position: relative;
47
- display: inline-flex;
48
- flex-direction: column;
49
- // Unsized, the field is 280px wide (TextFieldDefaults.MinWidth), not as
50
- // wide as its input's 20 average characters, which Chrome measures
51
- // differently per platform for the same font: 167px on macOS, 220px on
52
- // Linux. A width from the page still applies.
53
- contain: inline-size;
54
- contain-intrinsic-inline-size: v.text-field('width');
55
- // align-self: flex-start; // Prevents growing to fill the container's height
56
- flex: 0 0 auto; // Don't grow or shrink; keep natural size
57
- // The container: the label, input, outline, icons and affixes are placed
58
- // against it, so the supporting text row under it never moves them
59
- &__field {
60
- position: relative;
61
- display: flex;
62
- flex-direction: column;
63
- }
64
-
65
- // Label
66
- &__label {
67
- @include m.typography("body-large");
68
- user-select: none;
69
- position: absolute;
70
- left: var(--#{$component}-start, 16px);
71
- top: 50%;
72
- transform: translateY(-50%);
73
- transform-origin: left top;
74
- pointer-events: none;
75
- color: t.color("on-surface-variant");
76
- transition:
77
- transform v.motion("duration-short4") v.motion("easing-emphasized"),
78
- color v.motion("duration-short2") v.motion("easing-standard"),
79
- left v.motion("duration-short4") v.motion("easing-emphasized");
80
- }
81
-
82
- // Input element
83
- &__input {
84
- @include m.typography("body-large");
85
- @include m.shape("extra-small");
86
- padding: 13px 16px;
87
- width: 100%;
88
- height: 56px;
89
- color: t.color("on-surface");
90
- caret-color: t.color("primary");
91
- border: 0;
92
- appearance: none;
93
- outline: none;
94
-
95
- // Animation to detect autofill
96
- animation-name: onAutoFillCancel;
97
- animation-duration: 10ms;
98
-
99
- // Transition to help detect autofill changes
100
- transition: background-color 0s ease-out 50000000s;
101
-
102
- // InputPlaceholderColor, shown while the field is focused or has no
103
- // label: under a resting label it would collide with it
104
- &::placeholder {
105
- color: t.color("on-surface-variant");
106
- opacity: 1;
107
- }
108
-
109
- // Autofill styles
110
- &:-webkit-autofill {
111
- animation-name: onAutoFillStart;
112
- animation-duration: 10ms;
113
- -webkit-text-fill-color: t.color("on-surface");
114
- transition: background-color 5000s ease-in-out 0s; // Long transition to keep the background
115
- }
116
-
117
- // Firefox autofill; the animation reports it as on WebKit
118
- &:autofill {
119
- animation-name: onAutoFillStart;
120
- animation-duration: 10ms;
121
- color: t.color("on-surface");
122
- }
123
- }
124
-
125
- // The disabled input's -webkit-text-fill-color is inherited by its
126
- // placeholder and paints over color, so both are cleared
127
- &:has(> .#{$component}__field > .#{$component}__label):not(.#{$component}--focused) .#{$component}__input::placeholder {
128
- color: transparent;
129
- -webkit-text-fill-color: transparent;
130
- }
131
-
132
- // While the label rests in the input area it is all that area shows: the
133
- // prefix and suffix appear as it floats, like the placeholder.
134
- // Resting is the float rules' complement: empty to the script and to the
135
- // input itself, and not focused.
136
- &--empty:has(> .#{$component}__field > .#{$component}__label):not(.#{$component}--focused):not(:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill))) {
137
- :is(.#{$component}__prefix, .#{$component}__suffix) {
138
- opacity: 0;
139
- }
140
- }
141
-
142
- // Prefix text
143
- &__prefix {
144
- @include m.typography("body-large");
145
- position: absolute;
146
- left: var(--#{$component}-start, 16px);
147
- top: 50%;
148
- transform: translateY(-50%);
149
- color: t.color("on-surface-variant");
150
- pointer-events: none;
151
- z-index: 2; // Increased to ensure it stays above input
152
- white-space: nowrap; // Prevent text wrapping
153
- max-width: 40%; // Prevent extreme overflow
154
- overflow: hidden;
155
- text-overflow: ellipsis;
156
- // opacity as the label floats; top where a label is added
157
- // or removed
158
- transition:
159
- top v.motion("duration-short4") v.motion("easing-emphasized"),
160
- opacity v.motion("duration-short4") v.motion("easing-emphasized");
161
- }
162
-
163
- // Suffix text
164
- &__suffix {
165
- @include m.typography("body-large");
166
- position: absolute;
167
- right: var(--#{$component}-end, 16px);
168
- top: 50%;
169
- transform: translateY(-50%);
170
- color: t.color("on-surface-variant");
171
- pointer-events: none;
172
- z-index: 2; // Increased to ensure it stays above input
173
- white-space: nowrap; // Prevent text wrapping
174
- max-width: 40%; // Prevent extreme overflow
175
- overflow: hidden;
176
- text-overflow: ellipsis;
177
- transition:
178
- top v.motion("duration-short4") v.motion("easing-emphasized"),
179
- opacity v.motion("duration-short4") v.motion("easing-emphasized");
180
- }
181
-
182
- // Leading icon
183
- &__leading-icon {
184
- position: absolute;
185
- left: 12px;
186
- top: 50%;
187
- transform: translateY(-50%);
188
- display: flex;
189
- align-items: center;
190
- justify-content: center;
191
- width: 24px;
192
- height: 24px;
193
- pointer-events: none;
194
- color: t.color("on-surface-variant");
195
- z-index: 1;
196
- transition: top v.motion("duration-short4")
197
- v.motion("easing-emphasized"); // Add transition for top position
198
-
199
- // LeadingIconSize / TrailingIconSize: 24dp, the whole box
200
- svg {
201
- width: 24px;
202
- height: 24px;
203
- }
204
- }
205
-
206
- // Trailing icon
207
- &__trailing-icon {
208
- position: absolute;
209
- right: 12px;
210
- top: 50%;
211
- transform: translateY(-50%);
212
- display: flex;
213
- align-items: center;
214
- justify-content: center;
215
- width: 24px;
216
- height: 24px;
217
- color: t.color("on-surface-variant");
218
- z-index: 1;
219
- transition: top v.motion("duration-short4")
220
- v.motion("easing-emphasized"); // Add transition for top position
221
-
222
- // LeadingIconSize / TrailingIconSize: 24dp, the whole box
223
- svg {
224
- width: 24px;
225
- height: 24px;
226
- }
227
- }
228
-
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;
239
- }
240
-
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").
248
- &--with-leading-icon {
249
- --#{$component}-start: 52px;
250
- }
251
-
252
- &--with-trailing-icon {
253
- --#{$component}-end: 52px;
254
-
255
- // A search input with a trailing icon of its own must not also show the
256
- // browser's clear button. WebKit and Blink draw it into the input — the
257
- // `::-webkit-search-cancel-button` user-agent shadow part — beside ours
258
- // (two clears), and `appearance: none` on the input does not remove it.
259
- // A search field with no icon of its own keeps the browser's button,
260
- // its only clear affordance. `type` is enumerated, so the `i` flag
261
- // follows an uppercase `type="SEARCH"` too.
262
- .#{$component}__input[type="search" i]::-webkit-search-cancel-button {
263
- display: none;
264
- }
265
- }
266
-
267
- // What a prefix or a suffix adds before the text: its width, which
268
- // placement.ts measures into a custom property (32px until it has), and
269
- // the 2dp to the text (PrefixSuffixTextPadding)
270
- &--with-prefix {
271
- --#{$component}-prefix-space: calc(var(--#{$component}-prefix-width, 32px) + 2px);
272
- }
273
-
274
- &--with-suffix {
275
- --#{$component}-suffix-space: calc(var(--#{$component}-suffix-width, 32px) + 2px);
276
- }
277
-
278
- // Error state
279
- // Only the label, the trailing icon and the caret take the error colour:
280
- // ErrorLeadingIconColor is on-surface-variant, and the affixes keep theirs
281
- &--error {
282
- .#{$component}__label,
283
- .#{$component}__trailing-icon {
284
- color: t.color("error");
285
- }
286
-
287
- .#{$component}__input {
288
- caret-color: t.color("error");
289
- }
290
- }
291
-
292
- // Disabled state
293
- // Disabled: the roles at 38%, not the element faded, which also faded
294
- // the filled container's 4%. The fill is the filled variant's.
295
- &--disabled {
296
- .#{$component}__input {
297
- color: t.alpha("on-surface", 0.38);
298
- -webkit-text-fill-color: t.alpha("on-surface", 0.38);
299
- pointer-events: none;
300
- }
301
-
302
- .#{$component}__supporting {
303
- color: t.color("on-surface");
304
- opacity: 0.38;
305
- }
306
-
307
- .#{$component}__label {
308
- color: t.color("on-surface");
309
- opacity: 0.38;
310
- }
311
-
312
- .#{$component}__leading-icon,
313
- .#{$component}__trailing-icon,
314
- .#{$component}__prefix,
315
- .#{$component}__suffix {
316
- color: t.color("on-surface");
317
- opacity: 0.38;
318
- }
319
- }
320
-
321
- // The label comes before the input, so no sibling selector reaches it:
322
- // the root reads the input's state instead.
323
- &:has(.#{$component}__input:disabled) {
324
- .#{$component}__label,
325
- .#{$component}__supporting {
326
- color: t.color("on-surface");
327
- opacity: 0.38;
328
- }
329
- }
330
-
331
- // Disabled state - legacy support for direct input disabled
332
- &__input:disabled {
333
- color: t.alpha("on-surface", 0.38);
334
- -webkit-text-fill-color: t.alpha("on-surface", 0.38);
335
- pointer-events: none;
336
-
337
- & ~ .#{$component}__leading-icon,
338
- & ~ .#{$component}__trailing-icon,
339
- & ~ .#{$component}__prefix,
340
- & ~ .#{$component}__suffix {
341
- color: t.color("on-surface");
342
- opacity: 0.38;
343
- }
344
- }
345
-
346
- // The supporting text row, in the flow under the container: the helper at
347
- // the start, the counter at the end, 4dp below the field and 16dp in from
348
- // each side (TextFieldDefaults.supportingTextPadding). It was absolute,
349
- // 18px under the field, so it overlapped what followed and never wrapped
350
- &__supporting {
351
- @include m.typography("body-small");
352
- display: flex;
353
- gap: 16px;
354
- padding: 4px 16px 0;
355
- color: t.color("on-surface-variant");
356
- }
357
-
358
- &__helper {
359
- flex: 1 1 auto;
360
- min-width: 0;
361
-
362
- &--error {
363
- color: t.color("error");
364
- }
365
- }
366
-
367
- &__counter {
368
- flex: none;
369
- margin-inline-start: auto;
370
- }
371
-
372
- // The counter is supporting text: in error it takes the error colour, as
373
- // the helper does (Material Web)
374
- &--error .#{$component}__counter {
375
- color: t.color("error");
376
- }
377
-
378
- // The required asterisk: part of the label, in its colour and
379
- // straight after its text, as Material Web appends it. It was the error
380
- // colour with a 4px gap, a style no element carried until now.
381
- &__required {
382
- color: inherit;
383
- }
384
-
385
- // Accessibility
386
- @include m.reduced-motion {
387
- &__label,
388
- &__outline-leading,
389
- &__outline-notch,
390
- &__outline-trailing {
391
- transition: none;
392
- }
393
-
394
- &__prefix,
395
- &__suffix,
396
- &__leading-icon,
397
- &__trailing-icon {
398
- transition: none;
399
- }
400
- }
401
-
402
- // ===== FILLED VARIANT =====
403
- &--filled {
404
- // the label at rest is on-surface-variant at full strength: faded to
405
- // 0.6 it fell to a 2.85:1 contrast on the field's fill, under the
406
- // 4.5:1 a 16 px label needs
407
- .#{$component}__label {
408
- opacity: 1;
409
- }
410
- .#{$component}__input {
411
- background-color: t.color("surface-container-highest");
412
- // Under the label: 8dp, its 16dp line, the 24dp text, then 8dp with
413
- // the 1dp indicator (m3.material.io: "Top/bottom padding 8dp")
414
- padding: 24px 16px 7px;
415
- border-bottom: 1px solid t.color("on-surface-variant");
416
- border-radius: f.get-shape("extra-small") f.get-shape("extra-small")
417
- 0 0;
418
- @include m.motion-transition(background-color, border-color);
419
-
420
- // Autofill styles for filled variant
421
- &:-webkit-autofill {
422
- border-radius: f.get-shape("extra-small")
423
- f.get-shape("extra-small") 0 0;
424
- }
425
- }
426
-
427
- // The 2dp focus indicator, at the container's bottom edge
428
- .#{$component}__field::before {
429
- content: "";
430
- position: absolute;
431
- opacity: 0;
432
- bottom: 0;
433
- width: 100%;
434
- height: 2px;
435
- background-color: t.color("primary");
436
- border-radius: 0;
437
- pointer-events: none;
438
- transition: opacity v.motion("duration-short4") v.motion("easing-standard");
439
-
440
- // Here, not in the block above with the label and the outline:
441
- // this rule comes later and would win over it
442
- @include m.reduced-motion {
443
- transition: none;
444
- }
445
- }
446
-
447
- // Populated field (not empty) or focused field label position
448
- &:not(.#{$component}--empty) .#{$component}__label,
449
- &.#{$component}--focused .#{$component}__label {
450
- // Its line centred 16dp down, 8dp and half the 16dp line: from the
451
- // field's centre, 12px up and half its own scaled height
452
- transform: translateY(calc(-12px - 37.5%)) scale(0.75);
453
- }
454
-
455
- // Floated from the input's own state too: a value, or autofill before
456
- // the script has seen it. The label precedes the input, so the root
457
- // reads it.
458
- &:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill)) .#{$component}__label {
459
- transform: translateY(calc(-12px - 37.5%)) scale(0.75);
460
- }
461
-
462
- // A prefix or suffix is on the text's line: under a label, 24dp down
463
- // (its centre 36dp); without one it is centred, as the base places it.
464
- // It shows only once the label has floated, so the state is not in
465
- // the selector.
466
- &:has(> .#{$component}__field > .#{$component}__label) {
467
- .#{$component}__prefix,
468
- .#{$component}__suffix {
469
- top: 36px;
470
- }
471
- }
472
-
473
- // Without a label the text is centred: 16dp above and below it
474
- // (contentPaddingWithoutLabel), the indicator in the last of them
475
- &:not(:has(> .#{$component}__field > .#{$component}__label)) .#{$component}__input {
476
- padding-top: 16px;
477
- padding-bottom: 15px;
478
- }
479
-
480
- // Focus state
481
- &.#{$component}--focused {
482
- .#{$component}__label {
483
- color: t.color("primary");
484
- }
485
-
486
- .#{$component}__field::before {
487
- opacity: 1;
488
- }
489
- }
490
-
491
- // Hover: the on-surface state layer over the container, and the
492
- // indicator in on-surface (HoverActiveIndicatorColor)
493
- // (the layer in error too; there the indicator is on-error-container, below)
494
- &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(:has(.#{$component}__input:disabled)) .#{$component}__input {
495
- background-image: linear-gradient(#{t.alpha("on-surface", 0.08)}, #{t.alpha("on-surface", 0.08)});
496
- }
497
-
498
- &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(.#{$component}--error):not(:has(.#{$component}__input:disabled)) .#{$component}__input {
499
- border-bottom-color: t.color("on-surface");
500
- }
501
-
502
- // Error: 1dp at rest, the 2dp bar only when focused
503
- &.#{$component}--error {
504
- .#{$component}__input {
505
- border-bottom-color: t.color("error");
506
- }
507
-
508
- .#{$component}__field::before {
509
- background-color: t.color("error");
510
- }
511
-
512
- .#{$component}__label {
513
- color: t.color("error");
514
- }
515
-
516
- &:hover:not(.#{$component}--focused) {
517
- .#{$component}__input {
518
- border-bottom-color: t.color("on-error-container");
519
- }
520
-
521
- .#{$component}__label,
522
- .#{$component}__trailing-icon {
523
- color: t.color("on-error-container");
524
- }
525
- }
526
- }
527
-
528
- // Disabled: the 4% container and the indicator at 38%
529
- &.#{$component}--disabled .#{$component}__input,
530
- & .#{$component}__input:disabled {
531
- background-color: t.alpha("on-surface", 0.04);
532
- border-bottom-color: t.alpha("on-surface", 0.38);
533
- }
534
-
535
- &.#{$component}--disabled {
536
- pointer-events: none;
537
- }
538
-
539
- // Icon adjustments for filled variant
540
- &.#{$component}--with-leading-icon .#{$component}__leading-icon,
541
- &.#{$component}--with-trailing-icon .#{$component}__trailing-icon {
542
- top: 28px;
543
- }
544
- }
545
-
546
- // ===== OUTLINED VARIANT =====
547
- // The container is drawn by __outline in three segments: the leading
548
- // corner, the notch the floated label sits in, and the trailing rest.
549
- // While the label floats the notch drops its top edge, leaving a gap
550
- // around the label, so nothing is painted behind the label and the field
551
- // shows whatever surface it is on. placement.ts sizes the notch to the
552
- // floated label plus the 4dp cutout padding on each side.
553
- &__outline {
554
- display: none;
555
- position: absolute;
556
- inset: 0;
557
- pointer-events: none;
558
-
559
- &-leading,
560
- &-notch,
561
- &-trailing {
562
- border: var(--#{$component}-outline-width, 1px) solid
563
- var(--#{$component}-outline-color, #{t.color("outline")});
564
- @include m.motion-transition(border-color);
565
- }
566
-
567
- // 12dp: the label starts 16dp in, less the 4dp cutout padding
568
- &-leading {
569
- flex: 0 0 12px;
570
- border-inline-end: 0;
571
- border-radius: f.get-shape("extra-small") 0 0
572
- f.get-shape("extra-small");
573
- }
574
-
575
- &-notch {
576
- flex: 0 0 auto;
577
- width: 0;
578
- max-width: calc(100% - 24px);
579
- border-inline: 0;
580
- }
581
-
582
- &-trailing {
583
- flex: 1 1 auto;
584
- border-inline-start: 0;
585
- border-radius: 0 f.get-shape("extra-small")
586
- f.get-shape("extra-small") 0;
587
- }
588
-
589
- &--notched .#{$component}__outline-notch {
590
- border-top-color: transparent;
591
- }
592
-
593
- // Forced colours paints a declared-`transparent` border in the
594
- // line's own colour, so the open notch's gap was drawn as part of the
595
- // top line, across the floated label. In the mode the open notch has no
596
- // top edge at all, whether placement.ts has opened it (--notched) or
597
- // the input's own state has and the script has not caught up: a value
598
- // set without an event, an autofilled field. The leading and trailing
599
- // segments still draw theirs.
600
- @include m.high-contrast {
601
- &--notched .#{$component}__outline-notch {
602
- border-top-style: none;
603
- }
604
-
605
- .#{$component}__input:not(:placeholder-shown) ~ & .#{$component}__outline-notch,
606
- .#{$component}__input:-webkit-autofill ~ & .#{$component}__outline-notch,
607
- .#{$component}__input:autofill ~ & .#{$component}__outline-notch {
608
- border-top-style: none;
609
- }
610
- }
611
- }
612
-
613
- &--outlined {
614
- --#{$component}-outline-color: #{t.color("outline")};
615
- --#{$component}-outline-width: 1px;
616
- border-radius: f.get-shape("extra-small");
617
-
618
- .#{$component}__outline {
619
- display: flex;
620
- }
621
-
622
- // Before placement.ts has run, the notch opens from the input's own state
623
- .#{$component}__input:not(:placeholder-shown)
624
- ~ .#{$component}__outline
625
- .#{$component}__outline-notch,
626
- .#{$component}__input:-webkit-autofill
627
- ~ .#{$component}__outline
628
- .#{$component}__outline-notch,
629
- .#{$component}__input:autofill
630
- ~ .#{$component}__outline
631
- .#{$component}__outline-notch {
632
- border-top-color: transparent;
633
- }
634
-
635
- .#{$component}__input {
636
- background-color: transparent;
637
- // 16dp all round (contentPaddingWithoutLabel), 1px of it the border
638
- padding: 15px 16px;
639
- // transparent: the outline draws the edge, this keeps the text
640
- // where the old input border put it. Top and bottom only: the
641
- // horizontal insets are the filled field's, to the pixel
642
- border: solid transparent;
643
- border-width: 1px 0;
644
- @include m.motion-transition(padding);
645
-
646
- // Autofill styles for outlined variant
647
- &:-webkit-autofill {
648
- border-radius: f.get-shape("extra-small");
649
- }
650
- }
651
-
652
- // LabelColor at full strength: faded to 0.5 it failed 4.5:1
653
- .#{$component}__label {
654
- top: 50%;
655
- }
656
-
657
- // Populated field (not empty) or focused field label position
658
- &:not(.#{$component}--empty) .#{$component}__label,
659
- &.#{$component}--focused .#{$component}__label {
660
- // Centred on the top edge (`endY = -(it.height / 2)`), whatever
661
- // its height: up the 28px to the edge, and half its scaled box
662
- transform: translateY(calc(-28px - 37.5%)) scale(0.75);
663
- // The floated label starts 16dp in, inside the notch, whatever
664
- // the icon at rest: the label's own inset, either direction
665
- --#{$component}-start: 16px;
666
- }
667
-
668
- // Floated from the input's own state too, as the filled variant is
669
- &:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill)) .#{$component}__label {
670
- // Centred on the top edge (`endY = -(it.height / 2)`), whatever
671
- // its height: up the 28px to the edge, and half its scaled box
672
- transform: translateY(calc(-28px - 37.5%)) scale(0.75);
673
- --#{$component}-start: 16px;
674
- }
675
-
676
- // Hover state
677
- // Hover: the outline and the label in on-surface (HoverLabelColor,
678
- // where the filled label stays on-surface-variant)
679
- &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(.#{$component}--error):not(:has(.#{$component}__input:disabled)) {
680
- --#{$component}-outline-color: #{t.color("on-surface")};
681
-
682
- .#{$component}__label {
683
- color: t.color("on-surface");
684
- }
685
- }
686
-
687
- // Focus state
688
- &.#{$component}--focused {
689
- --#{$component}-outline-color: #{t.color("primary")};
690
- --#{$component}-outline-width: 2px;
691
-
692
- .#{$component}__label {
693
- color: t.color("primary");
694
- }
695
- }
696
-
697
- // Error state
698
- &.#{$component}--error {
699
- --#{$component}-outline-color: #{t.color("error")};
700
-
701
- &:hover:not(.#{$component}--focused) {
702
- --#{$component}-outline-color: #{t.color("on-error-container")};
703
-
704
- .#{$component}__label,
705
- .#{$component}__trailing-icon {
706
- color: t.color("on-error-container");
707
- }
708
- }
709
-
710
- .#{$component}__label {
711
- color: t.color("error");
712
- }
713
- }
714
-
715
- // Disabled state
716
- &.#{$component}--disabled {
717
- --#{$component}-outline-color: #{t.alpha("on-surface", 0.12)};
718
- pointer-events: none;
719
- }
720
-
721
- }
722
-
723
- // Multiline styles
724
- // The first line and the label are where a single-line field has them
725
- // Compose places the text with no singleLine branch,
726
- // `textPosition = topPaddingValue + labelPlaceable.height`. The textarea's
727
- // own 12px put the first line under the filled field's floated label.
728
- &--multiline {
729
- .#{$component}__input {
730
- min-height: v.text-field('height-multiline');
731
- height: auto;
732
- resize: vertical;
733
- padding-top: v.text-field('padding-top-multiline');
734
- }
735
-
736
- // Under the floated label: 8dp, then its 16dp line
737
- // (TextFieldWithLabelVerticalPadding, MinFocusedLabelLineHeight)
738
- &.#{$component}--filled:has(> .#{$component}__field > .#{$component}__label) .#{$component}__input {
739
- padding-top: v.text-field('padding-top-multiline-label');
740
- }
741
-
742
- // The input's own border is the rest of the 16dp
743
- &.#{$component}--outlined .#{$component}__input {
744
- padding-top: calc(#{v.text-field('padding-top-multiline')} - #{v.text-field('border-width')});
745
- }
746
-
747
- .#{$component}__prefix,
748
- .#{$component}__suffix {
749
- top: 28px;
750
- }
751
-
752
- // The single-line field's centre: its 56px box, halved
753
- .#{$component}__label {
754
- top: 28px;
755
- }
756
- }
757
-
758
- // Support for multiline inputs
759
- &__input[type="multiline"] {
760
- min-height: v.text-field('height-multiline');
761
- height: auto; // Allow height to adjust based on content
762
- max-height: none; // Remove max-height constraint from regular inputs
763
- flex-shrink: 1; // Allow some shrinking for multiline
764
-
765
- & ~ .#{$component}__leading-icon,
766
- & ~ .#{$component}__trailing-icon,
767
- & ~ .#{$component}__prefix,
768
- & ~ .#{$component}__suffix {
769
- top: 20px;
770
- transform: none;
771
- }
772
- }
773
-
774
- // ===== DENSITY VARIANTS =====
775
- // Compact density (40px height)
776
- &--density-compact {
777
- .#{$component}__input {
778
- height: 40px;
779
- padding: 8px 16px;
780
- @include m.typography("body-medium"); // Slightly smaller text
781
- }
782
-
783
- // Adjust label position for compact
784
- .#{$component}__label {
785
- @include m.typography("body-medium");
786
- }
787
-
788
- // Adjust icon positions for compact height
789
- .#{$component}__leading-icon,
790
- .#{$component}__trailing-icon {
791
- width: 20px;
792
- height: 20px;
793
-
794
- svg {
795
- width: 16px;
796
- height: 16px;
797
- }
798
- }
799
-
800
- // Adjust prefix/suffix position for compact
801
- .#{$component}__prefix,
802
- .#{$component}__suffix {
803
- @include m.typography("body-medium");
804
- }
805
-
806
- // Filled variant with compact density
807
- &.#{$component}--filled {
808
- .#{$component}__input {
809
- padding: 12px 16px 4px; // Adjusted for filled variant
810
- }
811
-
812
- // Populated/focused label position
813
- &:not(.#{$component}--empty) .#{$component}__label,
814
- &.#{$component}--focused .#{$component}__label {
815
- transform: translateY(-90%) scale(0.75); // Adjusted for compact height
816
- }
817
-
818
- // A prefix or suffix on the compact text's line, under a label
819
- &:has(> .#{$component}__field > .#{$component}__label) {
820
- .#{$component}__prefix,
821
- .#{$component}__suffix {
822
- top: 23.5px;
823
- }
824
- }
825
-
826
- // Without a label, the 20px line centred in the 40px box
827
- &:not(:has(> .#{$component}__field > .#{$component}__label)) .#{$component}__input {
828
- padding-top: 10px;
829
- padding-bottom: 9px;
830
- }
831
-
832
- // Adjust icons for filled compact
833
- .#{$component}__leading-icon,
834
- .#{$component}__trailing-icon {
835
- top: 20px; // Adjusted for compact filled
836
- }
837
- }
838
-
839
- // Outlined variant with compact density
840
- &.#{$component}--outlined {
841
- .#{$component}__input {
842
- padding: 9px 16px;
843
- }
844
-
845
- // Focused/populated position
846
- &:not(.#{$component}--empty) .#{$component}__label,
847
- &.#{$component}--focused .#{$component}__label {
848
- // On the edge of the 40px box: 20px up, and half its scaled box
849
- transform: translateY(calc(-20px - 37.5%)) scale(0.75);
850
- }
851
- }
852
-
853
- // Multiline with compact density: no M3 measure, so the first line
854
- // and the label are the compact single-line field's
855
- &.#{$component}--multiline {
856
- .#{$component}__input {
857
- min-height: 40px;
858
- padding: v.text-field('padding-top-multiline-compact') v.text-field('padding-horizontal') 8px;
859
- }
860
-
861
- &.#{$component}--filled:has(> .#{$component}__field > .#{$component}__label) .#{$component}__input {
862
- padding-top: v.text-field('padding-top-multiline-compact-label');
863
- }
864
-
865
- &.#{$component}--outlined .#{$component}__input {
866
- padding-top: calc(#{v.text-field('padding-top-multiline-compact')} - #{v.text-field('border-width')});
867
- }
868
-
869
- .#{$component}__label,
870
- .#{$component}__prefix,
871
- .#{$component}__suffix {
872
- top: 20px;
873
- }
874
- }
875
-
876
- // The compact icon box is 20dp: the content starts 48dp in
877
- &.#{$component}--with-leading-icon {
878
- --#{$component}-start: 48px;
879
- }
880
-
881
- &.#{$component}--with-trailing-icon {
882
- --#{$component}-end: 48px;
883
- }
884
- }
885
-
886
- // ===== THE INPUT'S SIDES, AND THE MIRROR =====
887
- // The text starts where the content does, after a prefix if there is one,
888
- // and ends before a suffix. Last, and one class heavier (the field), so it
889
- // holds over the variants' and the densities' padding shorthands.
890
- .#{$component}__field .#{$component}__input {
891
- padding-left: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
892
- padding-right: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
893
- }
894
-
895
- @include mirrored {
896
- .#{$component}__label {
897
- left: auto;
898
- right: var(--#{$component}-start, 16px);
899
- transform-origin: right top;
900
- }
901
-
902
- .#{$component}__prefix {
903
- left: auto;
904
- right: var(--#{$component}-start, 16px);
905
- }
906
-
907
- .#{$component}__suffix {
908
- right: auto;
909
- left: var(--#{$component}-end, 16px);
910
- }
911
-
912
- .#{$component}__leading-icon {
913
- left: auto;
914
- right: 12px;
915
- }
916
-
917
- .#{$component}__trailing-icon {
918
- right: auto;
919
- left: 12px;
920
- }
921
-
922
- .#{$component}__field .#{$component}__input {
923
- padding-left: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
924
- padding-right: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
925
- }
926
-
927
- // The outline's corners follow its segments
928
- .#{$component}__outline-leading {
929
- border-radius: 0 f.get-shape("extra-small")
930
- f.get-shape("extra-small") 0;
931
- }
932
-
933
- .#{$component}__outline-trailing {
934
- border-radius: f.get-shape("extra-small") 0 0
935
- f.get-shape("extra-small");
936
- }
937
- }
938
- }
939
-
940
- // ============================================================================
941
- // An interactive trailing icon
942
- // ============================================================================
943
- // With `trailingIconLabel` the trailing icon is a button: M3 draws an
944
- // interactive trailing icon as an icon button, as Compose's trailing slot holds
945
- // an IconButton, so a 40dp round state layer centred on the 24dp icon and a 48dp
946
- // target. Last in the file, and two classes, so the variant and density rules
947
- // that place the decorative icon keep its centre but not its size.
35
+ position: relative;
36
+ display: inline-flex;
37
+ flex-direction: column;
38
+ contain: inline-size;
39
+ contain-intrinsic-inline-size: v.text-field('width');
40
+ flex: 0 0 auto;
41
+ &__field {
42
+ position: relative;
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+
47
+ &__label {
48
+ @include m.typography("body-large");
49
+ user-select: none;
50
+ position: absolute;
51
+ left: var(--#{$component}-start, 16px);
52
+ top: 50%;
53
+ transform: translateY(-50%);
54
+ transform-origin: left top;
55
+ pointer-events: none;
56
+ color: t.color("on-surface-variant");
57
+ transition:
58
+ transform v.motion("duration-short4") v.motion("easing-emphasized"),
59
+ color v.motion("duration-short2") v.motion("easing-standard"),
60
+ left v.motion("duration-short4") v.motion("easing-emphasized");
61
+ }
62
+
63
+ &__input {
64
+ @include m.typography("body-large");
65
+ @include m.shape("extra-small");
66
+ padding: 13px 16px;
67
+ width: 100%;
68
+ height: 56px;
69
+ box-sizing: border-box;
70
+ color: t.color("on-surface");
71
+ caret-color: t.color("primary");
72
+ border: 0;
73
+ appearance: none;
74
+ outline: none;
75
+
76
+ animation-name: onAutoFillCancel;
77
+ animation-duration: 10ms;
78
+
79
+ transition: background-color 0s ease-out 50000000s;
80
+
81
+ &::placeholder {
82
+ color: t.color("on-surface-variant");
83
+ opacity: 1;
84
+ }
85
+
86
+ &:-webkit-autofill {
87
+ animation-name: onAutoFillStart;
88
+ animation-duration: 10ms;
89
+ -webkit-text-fill-color: t.color("on-surface");
90
+ transition: background-color 5000s ease-in-out 0s;
91
+ }
92
+
93
+ &:autofill {
94
+ animation-name: onAutoFillStart;
95
+ animation-duration: 10ms;
96
+ color: t.color("on-surface");
97
+ }
98
+ }
99
+
100
+ &:has(> .#{$component}__field > .#{$component}__label):not(.#{$component}--focused) .#{$component}__input::placeholder {
101
+ color: transparent;
102
+ -webkit-text-fill-color: transparent;
103
+ }
104
+
105
+ &--empty:has(> .#{$component}__field > .#{$component}__label):not(.#{$component}--focused):not(:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill))) {
106
+ :is(.#{$component}__prefix, .#{$component}__suffix) {
107
+ opacity: 0;
108
+ }
109
+ }
110
+
111
+ &__prefix {
112
+ @include m.typography("body-large");
113
+ position: absolute;
114
+ left: var(--#{$component}-start, 16px);
115
+ top: 50%;
116
+ transform: translateY(-50%);
117
+ color: t.color("on-surface-variant");
118
+ pointer-events: none;
119
+ z-index: 2;
120
+ white-space: nowrap;
121
+ max-width: 40%;
122
+ overflow: hidden;
123
+ text-overflow: ellipsis;
124
+ transition:
125
+ top v.motion("duration-short4") v.motion("easing-emphasized"),
126
+ opacity v.motion("duration-short4") v.motion("easing-emphasized");
127
+ }
128
+
129
+ &__suffix {
130
+ @include m.typography("body-large");
131
+ position: absolute;
132
+ right: var(--#{$component}-end, 16px);
133
+ top: 50%;
134
+ transform: translateY(-50%);
135
+ color: t.color("on-surface-variant");
136
+ pointer-events: none;
137
+ z-index: 2;
138
+ white-space: nowrap;
139
+ max-width: 40%;
140
+ overflow: hidden;
141
+ text-overflow: ellipsis;
142
+ transition:
143
+ top v.motion("duration-short4") v.motion("easing-emphasized"),
144
+ opacity v.motion("duration-short4") v.motion("easing-emphasized");
145
+ }
146
+
147
+ &__leading-icon {
148
+ position: absolute;
149
+ left: 12px;
150
+ top: 50%;
151
+ transform: translateY(-50%);
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ width: 24px;
156
+ height: 24px;
157
+ pointer-events: none;
158
+ color: t.color("on-surface-variant");
159
+ z-index: 1;
160
+ transition: top v.motion("duration-short4")
161
+ v.motion("easing-emphasized");
162
+
163
+ svg {
164
+ width: 24px;
165
+ height: 24px;
166
+ }
167
+ }
168
+
169
+ &__trailing-icon {
170
+ position: absolute;
171
+ right: 12px;
172
+ top: 50%;
173
+ transform: translateY(-50%);
174
+ display: flex;
175
+ align-items: center;
176
+ justify-content: center;
177
+ width: 24px;
178
+ height: 24px;
179
+ color: t.color("on-surface-variant");
180
+ z-index: 1;
181
+ transition: top v.motion("duration-short4")
182
+ v.motion("easing-emphasized");
183
+
184
+ svg {
185
+ width: 24px;
186
+ height: 24px;
187
+ }
188
+ }
189
+
190
+ &__leading-icon[hidden],
191
+ &__trailing-icon[hidden] {
192
+ display: none;
193
+ }
194
+
195
+ &--with-leading-icon {
196
+ --#{$component}-start: 52px;
197
+ }
198
+
199
+ &--with-trailing-icon {
200
+ --#{$component}-end: 52px;
201
+
202
+ .#{$component}__input[type="search" i]::-webkit-search-cancel-button {
203
+ display: none;
204
+ }
205
+ }
206
+
207
+ &--with-prefix {
208
+ --#{$component}-prefix-space: calc(var(--#{$component}-prefix-width, 32px) + 2px);
209
+ }
210
+
211
+ &--with-suffix {
212
+ --#{$component}-suffix-space: calc(var(--#{$component}-suffix-width, 32px) + 2px);
213
+ }
214
+
215
+ &--error {
216
+ .#{$component}__label,
217
+ .#{$component}__trailing-icon {
218
+ color: t.color("error");
219
+ }
220
+
221
+ .#{$component}__input {
222
+ caret-color: t.color("error");
223
+ }
224
+ }
225
+
226
+ &--disabled {
227
+ .#{$component}__input {
228
+ color: t.alpha("on-surface", 0.38);
229
+ -webkit-text-fill-color: t.alpha("on-surface", 0.38);
230
+ pointer-events: none;
231
+ }
232
+
233
+ .#{$component}__supporting {
234
+ color: t.color("on-surface");
235
+ opacity: 0.38;
236
+ }
237
+
238
+ .#{$component}__label {
239
+ color: t.color("on-surface");
240
+ opacity: 0.38;
241
+ }
242
+
243
+ .#{$component}__leading-icon,
244
+ .#{$component}__trailing-icon,
245
+ .#{$component}__prefix,
246
+ .#{$component}__suffix {
247
+ color: t.color("on-surface");
248
+ opacity: 0.38;
249
+ }
250
+ }
251
+
252
+ &:has(.#{$component}__input:disabled) {
253
+ .#{$component}__label,
254
+ .#{$component}__supporting {
255
+ color: t.color("on-surface");
256
+ opacity: 0.38;
257
+ }
258
+ }
259
+
260
+ &__input:disabled {
261
+ color: t.alpha("on-surface", 0.38);
262
+ -webkit-text-fill-color: t.alpha("on-surface", 0.38);
263
+ pointer-events: none;
264
+
265
+ & ~ .#{$component}__leading-icon,
266
+ & ~ .#{$component}__trailing-icon,
267
+ & ~ .#{$component}__prefix,
268
+ & ~ .#{$component}__suffix {
269
+ color: t.color("on-surface");
270
+ opacity: 0.38;
271
+ }
272
+ }
273
+
274
+ &__supporting {
275
+ @include m.typography("body-small");
276
+ display: flex;
277
+ gap: 16px;
278
+ padding: 4px 16px 0;
279
+ color: t.color("on-surface-variant");
280
+ }
281
+
282
+ &__helper {
283
+ flex: 1 1 auto;
284
+ min-width: 0;
285
+
286
+ &--error {
287
+ color: t.color("error");
288
+ }
289
+ }
290
+
291
+ &__counter {
292
+ flex: none;
293
+ margin-inline-start: auto;
294
+ }
295
+
296
+ &--error .#{$component}__counter {
297
+ color: t.color("error");
298
+ }
299
+
300
+ &__required {
301
+ color: inherit;
302
+ }
303
+
304
+ @include m.reduced-motion {
305
+ &__label,
306
+ &__outline-leading,
307
+ &__outline-notch,
308
+ &__outline-trailing {
309
+ transition: none;
310
+ }
311
+
312
+ &__prefix,
313
+ &__suffix,
314
+ &__leading-icon,
315
+ &__trailing-icon {
316
+ transition: none;
317
+ }
318
+ }
319
+
320
+ &--filled {
321
+ .#{$component}__label {
322
+ opacity: 1;
323
+ }
324
+ .#{$component}__input {
325
+ background-color: t.color("surface-container-highest");
326
+ padding: 24px 16px 7px;
327
+ border-bottom: 1px solid t.color("on-surface-variant");
328
+ border-radius: f.get-shape("extra-small") f.get-shape("extra-small")
329
+ 0 0;
330
+ @include m.motion-transition(background-color, border-color);
331
+
332
+ &:-webkit-autofill {
333
+ border-radius: f.get-shape("extra-small")
334
+ f.get-shape("extra-small") 0 0;
335
+ }
336
+ }
337
+
338
+ .#{$component}__field::before {
339
+ content: "";
340
+ position: absolute;
341
+ opacity: 0;
342
+ bottom: 0;
343
+ width: 100%;
344
+ height: 2px;
345
+ background-color: t.color("primary");
346
+ border-radius: 0;
347
+ pointer-events: none;
348
+ transition: opacity v.motion("duration-short4") v.motion("easing-standard");
349
+
350
+ @include m.reduced-motion {
351
+ transition: none;
352
+ }
353
+ }
354
+
355
+ &:not(.#{$component}--empty) .#{$component}__label,
356
+ &.#{$component}--focused .#{$component}__label {
357
+ transform: translateY(calc(-12px - 37.5%)) scale(0.75);
358
+ }
359
+
360
+ &:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill)) .#{$component}__label {
361
+ transform: translateY(calc(-12px - 37.5%)) scale(0.75);
362
+ }
363
+
364
+ &:has(> .#{$component}__field > .#{$component}__label) {
365
+ .#{$component}__prefix,
366
+ .#{$component}__suffix {
367
+ top: 36px;
368
+ }
369
+ }
370
+
371
+ &:not(:has(> .#{$component}__field > .#{$component}__label)) .#{$component}__input {
372
+ padding-top: 16px;
373
+ padding-bottom: 15px;
374
+ }
375
+
376
+ &.#{$component}--focused {
377
+ .#{$component}__label {
378
+ color: t.color("primary");
379
+ }
380
+
381
+ .#{$component}__field::before {
382
+ opacity: 1;
383
+ }
384
+ }
385
+
386
+ &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(:has(.#{$component}__input:disabled)) .#{$component}__input {
387
+ background-image: linear-gradient(#{t.alpha("on-surface", 0.08)}, #{t.alpha("on-surface", 0.08)});
388
+ }
389
+
390
+ &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(.#{$component}--error):not(:has(.#{$component}__input:disabled)) .#{$component}__input {
391
+ border-bottom-color: t.color("on-surface");
392
+ }
393
+
394
+ &.#{$component}--error {
395
+ .#{$component}__input {
396
+ border-bottom-color: t.color("error");
397
+ }
398
+
399
+ .#{$component}__field::before {
400
+ background-color: t.color("error");
401
+ }
402
+
403
+ .#{$component}__label {
404
+ color: t.color("error");
405
+ }
406
+
407
+ &:hover:not(.#{$component}--focused) {
408
+ .#{$component}__input {
409
+ border-bottom-color: t.color("on-error-container");
410
+ }
411
+
412
+ .#{$component}__label,
413
+ .#{$component}__trailing-icon {
414
+ color: t.color("on-error-container");
415
+ }
416
+ }
417
+ }
418
+
419
+ &.#{$component}--disabled .#{$component}__input,
420
+ & .#{$component}__input:disabled {
421
+ background-color: t.alpha("on-surface", 0.04);
422
+ border-bottom-color: t.alpha("on-surface", 0.38);
423
+ }
424
+
425
+ &.#{$component}--disabled {
426
+ pointer-events: none;
427
+ }
428
+
429
+ &.#{$component}--with-leading-icon .#{$component}__leading-icon,
430
+ &.#{$component}--with-trailing-icon .#{$component}__trailing-icon {
431
+ top: 28px;
432
+ }
433
+ }
434
+
435
+ &__outline {
436
+ display: none;
437
+ position: absolute;
438
+ inset: 0;
439
+ pointer-events: none;
440
+
441
+ &-leading,
442
+ &-notch,
443
+ &-trailing {
444
+ border: var(--#{$component}-outline-width, 1px) solid
445
+ var(--#{$component}-outline-color, #{t.color("outline")});
446
+ @include m.motion-transition(border-color);
447
+ }
448
+
449
+ &-leading {
450
+ flex: 0 0 12px;
451
+ border-inline-end: 0;
452
+ border-radius: f.get-shape("extra-small") 0 0
453
+ f.get-shape("extra-small");
454
+ }
455
+
456
+ &-notch {
457
+ flex: 0 0 auto;
458
+ width: 0;
459
+ max-width: calc(100% - 24px);
460
+ border-inline: 0;
461
+ }
462
+
463
+ &-trailing {
464
+ flex: 1 1 auto;
465
+ border-inline-start: 0;
466
+ border-radius: 0 f.get-shape("extra-small")
467
+ f.get-shape("extra-small") 0;
468
+ }
469
+
470
+ &--notched .#{$component}__outline-notch {
471
+ border-top-color: transparent;
472
+ }
473
+
474
+ @include m.high-contrast {
475
+ &--notched .#{$component}__outline-notch {
476
+ border-top-style: none;
477
+ }
478
+
479
+ .#{$component}__input:not(:placeholder-shown) ~ & .#{$component}__outline-notch,
480
+ .#{$component}__input:-webkit-autofill ~ & .#{$component}__outline-notch,
481
+ .#{$component}__input:autofill ~ & .#{$component}__outline-notch {
482
+ border-top-style: none;
483
+ }
484
+ }
485
+ }
486
+
487
+ &--outlined {
488
+ --#{$component}-outline-color: #{t.color("outline")};
489
+ --#{$component}-outline-width: 1px;
490
+ border-radius: f.get-shape("extra-small");
491
+
492
+ .#{$component}__outline {
493
+ display: flex;
494
+ }
495
+
496
+ .#{$component}__input:not(:placeholder-shown)
497
+ ~ .#{$component}__outline
498
+ .#{$component}__outline-notch,
499
+ .#{$component}__input:-webkit-autofill
500
+ ~ .#{$component}__outline
501
+ .#{$component}__outline-notch,
502
+ .#{$component}__input:autofill
503
+ ~ .#{$component}__outline
504
+ .#{$component}__outline-notch {
505
+ border-top-color: transparent;
506
+ }
507
+
508
+ .#{$component}__input {
509
+ background-color: transparent;
510
+ padding: 15px 16px;
511
+ border: solid transparent;
512
+ border-width: 1px 0;
513
+ @include m.motion-transition(padding);
514
+
515
+ &:-webkit-autofill {
516
+ border-radius: f.get-shape("extra-small");
517
+ }
518
+ }
519
+
520
+ .#{$component}__label {
521
+ top: 50%;
522
+ }
523
+
524
+ &:not(.#{$component}--empty) .#{$component}__label,
525
+ &.#{$component}--focused .#{$component}__label {
526
+ transform: translateY(calc(-28px - 37.5%)) scale(0.75);
527
+ --#{$component}-start: 16px;
528
+ }
529
+
530
+ &:has(.#{$component}__input:is(:not(:placeholder-shown), :autofill, :-webkit-autofill)) .#{$component}__label {
531
+ transform: translateY(calc(-28px - 37.5%)) scale(0.75);
532
+ --#{$component}-start: 16px;
533
+ }
534
+
535
+ &:hover:not(.#{$component}--focused):not(.#{$component}--disabled):not(.#{$component}--error):not(:has(.#{$component}__input:disabled)) {
536
+ --#{$component}-outline-color: #{t.color("on-surface")};
537
+
538
+ .#{$component}__label {
539
+ color: t.color("on-surface");
540
+ }
541
+ }
542
+
543
+ &.#{$component}--focused {
544
+ --#{$component}-outline-color: #{t.color("primary")};
545
+ --#{$component}-outline-width: 2px;
546
+
547
+ .#{$component}__label {
548
+ color: t.color("primary");
549
+ }
550
+ }
551
+
552
+ &.#{$component}--error {
553
+ --#{$component}-outline-color: #{t.color("error")};
554
+
555
+ &:hover:not(.#{$component}--focused) {
556
+ --#{$component}-outline-color: #{t.color("on-error-container")};
557
+
558
+ .#{$component}__label,
559
+ .#{$component}__trailing-icon {
560
+ color: t.color("on-error-container");
561
+ }
562
+ }
563
+
564
+ .#{$component}__label {
565
+ color: t.color("error");
566
+ }
567
+ }
568
+
569
+ &.#{$component}--disabled {
570
+ --#{$component}-outline-color: #{t.alpha("on-surface", 0.12)};
571
+ pointer-events: none;
572
+ }
573
+
574
+ }
575
+
576
+ &--multiline {
577
+ .#{$component}__input {
578
+ min-height: v.text-field('height-multiline');
579
+ height: auto;
580
+ resize: vertical;
581
+ padding-top: v.text-field('padding-top-multiline');
582
+ }
583
+
584
+ &.#{$component}--filled:has(> .#{$component}__field > .#{$component}__label) .#{$component}__input {
585
+ padding-top: v.text-field('padding-top-multiline-label');
586
+ }
587
+
588
+ &.#{$component}--outlined .#{$component}__input {
589
+ padding-top: calc(#{v.text-field('padding-top-multiline')} - #{v.text-field('border-width')});
590
+ }
591
+
592
+ .#{$component}__prefix,
593
+ .#{$component}__suffix {
594
+ top: 28px;
595
+ }
596
+
597
+ .#{$component}__label {
598
+ top: 28px;
599
+ }
600
+ }
601
+
602
+ &__input[type="multiline"] {
603
+ min-height: v.text-field('height-multiline');
604
+ height: auto;
605
+ max-height: none;
606
+ flex-shrink: 1;
607
+
608
+ & ~ .#{$component}__leading-icon,
609
+ & ~ .#{$component}__trailing-icon,
610
+ & ~ .#{$component}__prefix,
611
+ & ~ .#{$component}__suffix {
612
+ top: 20px;
613
+ transform: none;
614
+ }
615
+ }
616
+
617
+ &--density-compact {
618
+ .#{$component}__input {
619
+ height: 40px;
620
+ padding: 8px 16px;
621
+ @include m.typography("body-medium");
622
+ }
623
+
624
+ .#{$component}__label {
625
+ @include m.typography("body-medium");
626
+ }
627
+
628
+ .#{$component}__leading-icon,
629
+ .#{$component}__trailing-icon {
630
+ width: 20px;
631
+ height: 20px;
632
+
633
+ svg {
634
+ width: 16px;
635
+ height: 16px;
636
+ }
637
+ }
638
+
639
+ .#{$component}__prefix,
640
+ .#{$component}__suffix {
641
+ @include m.typography("body-medium");
642
+ }
643
+
644
+ &.#{$component}--filled {
645
+ .#{$component}__input {
646
+ padding: 12px 16px 4px;
647
+ }
648
+
649
+ &:not(.#{$component}--empty) .#{$component}__label,
650
+ &.#{$component}--focused .#{$component}__label {
651
+ transform: translateY(-90%) scale(0.75);
652
+ }
653
+
654
+ &:has(> .#{$component}__field > .#{$component}__label) {
655
+ .#{$component}__prefix,
656
+ .#{$component}__suffix {
657
+ top: 23.5px;
658
+ }
659
+ }
660
+
661
+ &:not(:has(> .#{$component}__field > .#{$component}__label)) .#{$component}__input {
662
+ padding-top: 10px;
663
+ padding-bottom: 9px;
664
+ }
665
+
666
+ .#{$component}__leading-icon,
667
+ .#{$component}__trailing-icon {
668
+ top: 20px;
669
+ }
670
+ }
671
+
672
+ &.#{$component}--outlined {
673
+ .#{$component}__input {
674
+ padding: 9px 16px;
675
+ }
676
+
677
+ &:not(.#{$component}--empty) .#{$component}__label,
678
+ &.#{$component}--focused .#{$component}__label {
679
+ transform: translateY(calc(-20px - 37.5%)) scale(0.75);
680
+ }
681
+ }
682
+
683
+ &.#{$component}--multiline {
684
+ .#{$component}__input {
685
+ min-height: 40px;
686
+ padding: v.text-field('padding-top-multiline-compact') v.text-field('padding-horizontal') 8px;
687
+ }
688
+
689
+ &.#{$component}--filled:has(> .#{$component}__field > .#{$component}__label) .#{$component}__input {
690
+ padding-top: v.text-field('padding-top-multiline-compact-label');
691
+ }
692
+
693
+ &.#{$component}--outlined .#{$component}__input {
694
+ padding-top: calc(#{v.text-field('padding-top-multiline-compact')} - #{v.text-field('border-width')});
695
+ }
696
+
697
+ .#{$component}__label,
698
+ .#{$component}__prefix,
699
+ .#{$component}__suffix {
700
+ top: 20px;
701
+ }
702
+ }
703
+
704
+ &.#{$component}--with-leading-icon {
705
+ --#{$component}-start: 48px;
706
+ }
707
+
708
+ &.#{$component}--with-trailing-icon {
709
+ --#{$component}-end: 48px;
710
+ }
711
+ }
712
+
713
+ .#{$component}__field .#{$component}__input {
714
+ padding-left: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
715
+ padding-right: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
716
+ }
717
+
718
+ @include mirrored {
719
+ .#{$component}__label {
720
+ left: auto;
721
+ right: var(--#{$component}-start, 16px);
722
+ transform-origin: right top;
723
+ }
724
+
725
+ .#{$component}__prefix {
726
+ left: auto;
727
+ right: var(--#{$component}-start, 16px);
728
+ }
729
+
730
+ .#{$component}__suffix {
731
+ right: auto;
732
+ left: var(--#{$component}-end, 16px);
733
+ }
734
+
735
+ .#{$component}__leading-icon {
736
+ left: auto;
737
+ right: 12px;
738
+ }
739
+
740
+ .#{$component}__trailing-icon {
741
+ right: auto;
742
+ left: 12px;
743
+ }
744
+
745
+ .#{$component}__field .#{$component}__input {
746
+ padding-left: calc(var(--#{$component}-end, 16px) + var(--#{$component}-suffix-space, 0px));
747
+ padding-right: calc(var(--#{$component}-start, 16px) + var(--#{$component}-prefix-space, 0px));
748
+ }
749
+
750
+ .#{$component}__outline-leading {
751
+ border-radius: 0 f.get-shape("extra-small")
752
+ f.get-shape("extra-small") 0;
753
+ }
754
+
755
+ .#{$component}__outline-trailing {
756
+ border-radius: f.get-shape("extra-small") 0 0
757
+ f.get-shape("extra-small");
758
+ }
759
+ }
760
+ }
761
+
948
762
  .#{$component}__trailing-icon.#{$component}__trailing-icon--button {
949
- right: 4px;
950
- width: 40px;
951
- height: 40px;
952
- padding: 0;
953
- border: 0;
954
- border-radius: 50%;
955
- background: transparent;
956
- font: inherit;
957
- cursor: pointer;
958
- @include m.touch-target(48px);
959
- // The mixin makes its host relative; the icon stays placed in the field
960
- position: absolute;
961
-
962
- // One state layer whose opacity the states set, as the icon button draws it
963
- &::before {
964
- content: "";
965
- position: absolute;
966
- inset: 0;
967
- border-radius: inherit;
968
- background-color: currentColor;
969
- opacity: 0;
970
- pointer-events: none;
971
- }
972
-
973
- &:hover:not(:disabled)::before {
974
- opacity: 0.08;
975
- }
976
-
977
- &:focus-visible {
978
- outline: 2px solid t.color("secondary");
979
- outline-offset: 2px;
980
- }
981
-
982
- &:focus-visible::before,
983
- &:active:not(:disabled)::before {
984
- opacity: 0.1;
985
- }
986
-
987
- &:disabled {
988
- cursor: default;
989
- }
990
-
991
- // The field's mirror, for the button: an ancestor's `dir`, or the
992
- // field's --rtl inside a shadow root
993
- [dir='rtl'] &,
994
- .#{$component}--rtl & {
995
- right: auto;
996
- left: 4px;
997
- }
763
+ right: 4px;
764
+ width: 40px;
765
+ height: 40px;
766
+ padding: 0;
767
+ border: 0;
768
+ border-radius: 50%;
769
+ background: transparent;
770
+ font: inherit;
771
+ cursor: pointer;
772
+ @include m.touch-target(48px);
773
+ position: absolute;
774
+
775
+ &::before {
776
+ content: "";
777
+ position: absolute;
778
+ inset: 0;
779
+ border-radius: inherit;
780
+ background-color: currentColor;
781
+ opacity: 0;
782
+ pointer-events: none;
783
+ }
784
+
785
+ &:hover:not(:disabled)::before {
786
+ opacity: 0.08;
787
+ }
788
+
789
+ &:focus-visible {
790
+ outline: 2px solid t.color("secondary");
791
+ outline-offset: 2px;
792
+ }
793
+
794
+ &:focus-visible::before,
795
+ &:active:not(:disabled)::before {
796
+ opacity: 0.1;
797
+ }
798
+
799
+ &:disabled {
800
+ cursor: default;
801
+ }
802
+
803
+ [dir='rtl'] &,
804
+ .#{$component}--rtl & {
805
+ right: auto;
806
+ left: 4px;
807
+ }
998
808
  }