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