2020// THE SOFTWARE.
2121//
2222
23+ // Selector '.mdc-*' should only be used in this project.
24+ // stylelint-disable selector-class-pattern --
25+ // NOTE: this is the implementation of the aforementioned classes.
26+
2327@use ' sass:map' ;
28+ @use ' @material/notched-outline/mixins' as notched-outline-mixins ;
2429@use ' @material/theme/theme' ;
2530@use ' @material/tokens/resolvers' ;
2631@use ' ./text-field-theme' ;
32+ @use ' ./mixins' ;
2733
2834$_light-theme : (
2935 caret-color : null,
@@ -42,13 +48,15 @@ $_light-theme: (
4248 disabled-supporting-text-opacity : null,
4349 disabled-trailing-icon-color : null,
4450 disabled-trailing-icon-opacity : null,
51+ error-caret-color : null,
4552 error-focus-caret-color : null,
4653 error-focus-input-text-color : null,
4754 error-focus-label-text-color : null,
4855 error-focus-leading-icon-color : null,
4956 error-focus-outline-color : null,
5057 error-focus-supporting-text-color : null,
5158 error-focus-trailing-icon-color : null,
59+ error-hover-caret-color : null,
5260 error-hover-input-text-color : null,
5361 error-hover-label-text-color : null,
5462 error-hover-leading-icon-color : null,
@@ -61,13 +69,15 @@ $_light-theme: (
6169 error-outline-color : null,
6270 error-supporting-text-color : null,
6371 error-trailing-icon-color : null,
72+ focus-caret-color : null,
6473 focus-input-text-color : null,
6574 focus-label-text-color : null,
6675 focus-leading-icon-color : null,
6776 focus-outline-color : null,
6877 focus-outline-width : null,
6978 focus-supporting-text-color : null,
7079 focus-trailing-icon-color : null,
80+ hover-caret-color : null,
7181 hover-input-text-color : null,
7282 hover-label-text-color : null,
7383 hover-leading-icon-color : null,
@@ -109,4 +119,90 @@ $_light-theme: (
109119@mixin theme-styles ($theme , $resolvers : resolvers .$material ) {
110120 @include theme .validate-theme ($_light-theme , $theme );
111121 @include text-field-theme .theme-styles ($theme , $resolvers : $resolvers );
122+
123+ @if map .get ($theme , container-height ) {
124+ @include mixins .outlined-height (map .get ($theme , container-height ));
125+
126+ & .mdc-text-field--with-leading-icon {
127+ @include mixins .outlined-with-leading-icon-height (
128+ map .get ($theme , container-height )
129+ );
130+ }
131+ }
132+ @if map .get ($theme , container-shape ) {
133+ @include mixins .outline-shape-radius (map .get ($theme , container-shape ));
134+ }
135+
136+ @include _outline-color (
137+ (
138+ default : map .get ($theme , outline-color ),
139+ hover: map .get ($theme , hover-outline-color ),
140+ focus: map .get ($theme , focus-outline-color ),
141+ disabled : map .get ($theme , disabled-outline-color ),
142+ )
143+ );
144+ @include _error-outline-color (
145+ (
146+ default : map .get ($theme , error-outline-color ),
147+ hover: map .get ($theme , error-hover-outline-color ),
148+ focus: map .get ($theme , error-focus-outline-color ),
149+ )
150+ );
151+ @include _outline-width (
152+ (
153+ default : map .get ($theme , outline-width ),
154+ hover: map .get ($theme , hover-outline-width ),
155+ focus: map .get ($theme , focus-outline-width ),
156+ )
157+ );
158+ }
159+
160+ @mixin _outline-color ($colors ) {
161+ @include text-field-theme .if-enabled {
162+ @include _set-outline-color (map .get ($colors , default ));
163+
164+ @include text-field-theme .if-hovered {
165+ .mdc-notched-outline {
166+ @include _set-outline-color (map .get ($colors , hover ));
167+ }
168+ }
169+
170+ @include text-field-theme .if-focused {
171+ @include _set-outline-color (map .get ($colors , focus ));
172+ }
173+ }
174+
175+ @include text-field-theme .if-disabled {
176+ @include _set-outline-color (map .get ($colors , disabled ));
177+ }
178+ }
179+
180+ @mixin _set-outline-color ($color ) {
181+ @include notched-outline-mixins .color ($color );
182+ }
183+
184+ @mixin _error-outline-color ($color ) {
185+ & .mdc-text-field--invalid {
186+ @include _outline-color ($color );
187+ }
188+ }
189+
190+ @mixin _outline-width ($width ) {
191+ @include text-field-theme .if-enabled {
192+ @include _set-outline-width (map .get ($width , default ));
193+
194+ @include text-field-theme .if-hovered {
195+ @include _set-outline-width (map .get ($width , hover ));
196+ }
197+
198+ @include text-field-theme .if-focused {
199+ @include _set-outline-width (map .get ($width , focus ));
200+ }
201+ }
202+ }
203+
204+ @mixin _set-outline-width ($width ) {
205+ .mdc-notched-outline {
206+ @include notched-outline-mixins .stroke-width ($width );
207+ }
112208}
0 commit comments