1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | @use 'sass:map';
|
28 | @use '@material/notched-outline/mixins' as notched-outline-mixins;
|
29 | @use '@material/theme/theme';
|
30 | @use '@material/tokens/resolvers';
|
31 | @use './text-field-theme';
|
32 | @use './mixins';
|
33 |
|
34 | $_light-theme: (
|
35 | caret-color: null,
|
36 | container-height: null,
|
37 | container-shape: null,
|
38 | disabled-input-text-color: null,
|
39 | disabled-input-text-opacity: null,
|
40 | disabled-label-text-color: null,
|
41 | disabled-label-text-opacity: null,
|
42 | disabled-leading-icon-color: null,
|
43 | disabled-leading-icon-opacity: null,
|
44 | disabled-outline-color: null,
|
45 | disabled-outline-opacity: null,
|
46 | disabled-outline-width: null,
|
47 | disabled-supporting-text-color: null,
|
48 | disabled-supporting-text-opacity: null,
|
49 | disabled-trailing-icon-color: null,
|
50 | disabled-trailing-icon-opacity: null,
|
51 | error-caret-color: null,
|
52 | error-focus-caret-color: null,
|
53 | error-focus-input-text-color: null,
|
54 | error-focus-label-text-color: null,
|
55 | error-focus-leading-icon-color: null,
|
56 | error-focus-outline-color: null,
|
57 | error-focus-supporting-text-color: null,
|
58 | error-focus-trailing-icon-color: null,
|
59 | error-hover-caret-color: null,
|
60 | error-hover-input-text-color: null,
|
61 | error-hover-label-text-color: null,
|
62 | error-hover-leading-icon-color: null,
|
63 | error-hover-outline-color: null,
|
64 | error-hover-supporting-text-color: null,
|
65 | error-hover-trailing-icon-color: null,
|
66 | error-input-text-color: null,
|
67 | error-label-text-color: null,
|
68 | error-leading-icon-color: null,
|
69 | error-outline-color: null,
|
70 | error-supporting-text-color: null,
|
71 | error-trailing-icon-color: null,
|
72 | focus-caret-color: null,
|
73 | focus-input-text-color: null,
|
74 | focus-label-text-color: null,
|
75 | focus-leading-icon-color: null,
|
76 | focus-outline-color: null,
|
77 | focus-outline-width: null,
|
78 | focus-supporting-text-color: null,
|
79 | focus-trailing-icon-color: null,
|
80 | hover-caret-color: null,
|
81 | hover-input-text-color: null,
|
82 | hover-label-text-color: null,
|
83 | hover-leading-icon-color: null,
|
84 | hover-outline-color: null,
|
85 | hover-outline-width: null,
|
86 | hover-supporting-text-color: null,
|
87 | hover-trailing-icon-color: null,
|
88 | input-text-color: null,
|
89 | input-text-font: null,
|
90 | input-text-line-height: null,
|
91 | input-text-size: null,
|
92 | input-text-tracking: null,
|
93 | input-text-type: null,
|
94 | input-text-weight: null,
|
95 | label-text-color: null,
|
96 | label-text-font: null,
|
97 | label-text-line-height: null,
|
98 | label-text-populated-line-height: null,
|
99 | label-text-populated-size: null,
|
100 | label-text-size: null,
|
101 | label-text-tracking: null,
|
102 | label-text-type: null,
|
103 | label-text-weight: null,
|
104 | leading-icon-color: null,
|
105 | leading-icon-size: null,
|
106 | outline-color: null,
|
107 | outline-width: null,
|
108 | supporting-text-color: null,
|
109 | supporting-text-font: null,
|
110 | supporting-text-line-height: null,
|
111 | supporting-text-size: null,
|
112 | supporting-text-tracking: null,
|
113 | supporting-text-type: null,
|
114 | supporting-text-weight: null,
|
115 | trailing-icon-color: null,
|
116 | trailing-icon-size: null,
|
117 | );
|
118 |
|
119 | @mixin theme-styles($theme, $resolvers: resolvers.$material) {
|
120 | @include theme.validate-theme($_light-theme, $theme);
|
121 | @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 | }
|
208 | }
|