23
23
// stylelint-disable selector-class-pattern --
24
24
// Selector '.mdc-*' should only be used in this project.
25
25
26
+ @use ' sass:map' ;
26
27
@use ' @material/feature-targeting/feature-targeting' ;
27
28
@use ' @material/ripple/ripple-theme' ;
28
29
@use ' @material/theme/state' ;
@@ -43,6 +44,148 @@ $tick-mark-active-color: on-primary;
43
44
$tick-mark-inactive-color : primary;
44
45
$tick-mark-opacity : 0.6 ;
45
46
47
+ $light-theme : (
48
+ active-track-color : $color ,
49
+ active-track-height : 6px ,
50
+ active-track-shape : null,
51
+ disabled-active-track-color : $disabled-color ,
52
+ disabled-active-track-opacity : null,
53
+ disabled-handle-color : $disabled-color ,
54
+ disabled-handle-elevation : null,
55
+ disabled-handle-opacity : null,
56
+ disabled-inactive-track-color : $disabled-color ,
57
+ disabled-inactive-track-opacity : null,
58
+ focus-handle-color : null,
59
+ focus-state-layer-color : null,
60
+ focus-state-layer-opacity : null,
61
+ handle-color : $color ,
62
+ handle-elevation : null,
63
+ handle-height : 20px ,
64
+ handle-shadow-color : null,
65
+ handle-shape : null,
66
+ handle-width : 20px ,
67
+ hover-handle-color : null,
68
+ hover-state-layer-color : null,
69
+ hover-state-layer-opacity : null,
70
+ inactive-track-color : $color ,
71
+ inactive-track-height : 4px ,
72
+ inactive-track-shape : null,
73
+ label-container-color : $value-indicator-color ,
74
+ label-container-elevation : null,
75
+ label-container-height : null,
76
+ label-label-text-color : $value-indicator-text-color ,
77
+ label-label-text-font : null,
78
+ label-label-text-font-size : null,
79
+ label-label-text-line-height : null,
80
+ label-label-text-size : null,
81
+ label-label-text-tracking : null,
82
+ label-label-text-type : null,
83
+ label-label-text-weight : null,
84
+ pressed-handle-color : null,
85
+ pressed-state-layer-color : null,
86
+ pressed-state-layer-opacity : null,
87
+ state-layer-size : null,
88
+ track-elevation : null,
89
+ with-overlap-handle-outline-color : null,
90
+ with-overlap-handle-outline-width : null,
91
+ with-tick-marks-active-container-color : $tick-mark-active-color ,
92
+ with-tick-marks-active-container-opacity : $tick-mark-opacity ,
93
+ with-tick-marks-container-shape : null,
94
+ with-tick-marks-container-size : 2px ,
95
+ with-tick-marks-disabled-container-color : $disabled-color ,
96
+ with-tick-marks-disabled-container-opacity : $tick-mark-opacity ,
97
+ with-tick-marks-inactive-container-color : $tick-mark-inactive-color ,
98
+ with-tick-marks-inactive-container-opacity : $tick-mark-opacity ,
99
+ );
100
+
101
+ @mixin theme-styles ($theme , $query : feature-targeting .all ()) {
102
+ $feat-structure : feature-targeting .create-target ($query , structure );
103
+
104
+ @include theme .validate-theme-keys ($light-theme , $theme );
105
+
106
+ @include thumb-color (
107
+ $color-or-map : (
108
+ default : map .get ($theme , ' handle-color' ),
109
+ disabled : map .get ($theme , ' disabled-handle-color' ),
110
+ ),
111
+ $query : $query
112
+ );
113
+
114
+ @include thumb-ripple-color (
115
+ $color : map .get ($theme , ' handle-color' ),
116
+ $query : $query
117
+ );
118
+
119
+ @include track-active-color (
120
+ $color-or-map : (
121
+ default : map .get ($theme , ' active-track-color' ),
122
+ disabled : map .get ($theme , ' disabled-active-track-color' ),
123
+ ),
124
+ $query : $query
125
+ );
126
+
127
+ @include track-inactive-color (
128
+ $color-or-map : (
129
+ default : map .get ($theme , ' inactive-track-color' ),
130
+ disabled : map .get ($theme , ' disabled-inactive-track-color' ),
131
+ ),
132
+ $query : $query
133
+ );
134
+
135
+ @include tick-mark-active-color (
136
+ $color-or-map : (
137
+ default : map .get ($theme , ' with-tick-marks-active-container-color' ),
138
+ disabled : map .get ($theme , ' with-tick-marks-active-container-color' ),
139
+ ),
140
+ $query : $query
141
+ );
142
+
143
+ @include tick-mark-inactive-color (
144
+ $color-or-map : (
145
+ default : map .get ($theme , ' with-tick-marks-inactive-container-color' ),
146
+ disabled : map .get ($theme , ' with-tick-marks-disabled-container-color' ),
147
+ ),
148
+ $query : $query
149
+ );
150
+
151
+ @include value-indicator-color (
152
+ $color : map .get ($theme , ' label-container-color' ),
153
+ $opacity : $value-indicator-opacity ,
154
+ $query : $query
155
+ );
156
+
157
+ @include value-indicator-text-color (
158
+ $color : map .get ($theme , ' label-label-text-color' ),
159
+ $query : $query
160
+ );
161
+
162
+ .mdc-slider__track {
163
+ @include feature-targeting .targets ($feat-structure ) {
164
+ height : map .get ($theme , ' inactive-track-height' );
165
+ }
166
+ }
167
+
168
+ .mdc-slider__track--active {
169
+ @include feature-targeting .targets ($feat-structure ) {
170
+ height : map .get ($theme , ' active-track-height' );
171
+ }
172
+ }
173
+
174
+ .mdc-slider__track--inactive {
175
+ @include feature-targeting .targets ($feat-structure ) {
176
+ height : map .get ($theme , ' inactive-track-height' );
177
+ }
178
+ }
179
+
180
+ .mdc-slider__tick-mark--active ,
181
+ .mdc-slider__tick-mark--inactive {
182
+ @include feature-targeting .targets ($feat-structure ) {
183
+ height : map .get ($theme , ' with-tick-marks-container-size' );
184
+ width : map .get ($theme , ' with-tick-marks-container-size' );
185
+ }
186
+ }
187
+ }
188
+
46
189
/// Customizes active track color, using a Color or state Map.
47
190
/// - To set only the default color, provide a single Color.
48
191
/// - To set one or more state colors, provide a state Map with optional keys.
0 commit comments