1 | @use 'sass:map';
|
---|
2 | @use '../core/theming/theming';
|
---|
3 | @use '../core/typography/typography';
|
---|
4 | @use '../core/typography/typography-utils';
|
---|
5 | @use '../core/density/private/compatibility';
|
---|
6 | @use '../core/style/private';
|
---|
7 | @use './stepper-variables';
|
---|
8 |
|
---|
9 | @mixin color($config-or-theme) {
|
---|
10 | $config: theming.get-color-config($config-or-theme);
|
---|
11 | $foreground: map.get($config, foreground);
|
---|
12 | $background: map.get($config, background);
|
---|
13 | $primary: map.get($config, primary);
|
---|
14 | $accent: map.get($config, accent);
|
---|
15 | $warn: map.get($config, warn);
|
---|
16 |
|
---|
17 | .mat-step-header {
|
---|
18 | &.cdk-keyboard-focused,
|
---|
19 | &.cdk-program-focused,
|
---|
20 | &:hover:not([aria-disabled]),
|
---|
21 | &:hover[aria-disabled='false'] {
|
---|
22 | background-color: theming.get-color-from-palette($background, hover);
|
---|
23 | }
|
---|
24 |
|
---|
25 | &:hover[aria-disabled='true'] {
|
---|
26 | cursor: default;
|
---|
27 | }
|
---|
28 |
|
---|
29 | // On touch devices the :hover state will linger on the element after a tap.
|
---|
30 | // Reset it via `@media` after the declaration, because the media query isn't
|
---|
31 | // supported by all browsers yet.
|
---|
32 | @media (hover: none) {
|
---|
33 | &:hover {
|
---|
34 | background: none;
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | .mat-step-label,
|
---|
39 | .mat-step-optional {
|
---|
40 | // TODO(josephperrott): Update to using a corrected disabled-text contrast
|
---|
41 | // instead of secondary-text.
|
---|
42 | color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
43 | }
|
---|
44 |
|
---|
45 | .mat-step-icon {
|
---|
46 | // TODO(josephperrott): Update to using a corrected disabled-text contrast
|
---|
47 | // instead of secondary-text.
|
---|
48 | background-color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
49 | color: theming.get-color-from-palette($primary, default-contrast);
|
---|
50 | }
|
---|
51 |
|
---|
52 | .mat-step-icon-selected,
|
---|
53 | .mat-step-icon-state-done,
|
---|
54 | .mat-step-icon-state-edit {
|
---|
55 | background-color: theming.get-color-from-palette($primary);
|
---|
56 | color: theming.get-color-from-palette($primary, default-contrast);
|
---|
57 | }
|
---|
58 |
|
---|
59 | &.mat-accent {
|
---|
60 | .mat-step-icon {
|
---|
61 | color: theming.get-color-from-palette($accent, default-contrast);
|
---|
62 | }
|
---|
63 |
|
---|
64 | .mat-step-icon-selected,
|
---|
65 | .mat-step-icon-state-done,
|
---|
66 | .mat-step-icon-state-edit {
|
---|
67 | background-color: theming.get-color-from-palette($accent);
|
---|
68 | color: theming.get-color-from-palette($accent, default-contrast);
|
---|
69 | }
|
---|
70 | }
|
---|
71 |
|
---|
72 | &.mat-warn {
|
---|
73 | .mat-step-icon {
|
---|
74 | color: theming.get-color-from-palette($warn, default-contrast);
|
---|
75 | }
|
---|
76 |
|
---|
77 | .mat-step-icon-selected,
|
---|
78 | .mat-step-icon-state-done,
|
---|
79 | .mat-step-icon-state-edit {
|
---|
80 | background-color: theming.get-color-from-palette($warn);
|
---|
81 | color: theming.get-color-from-palette($warn, default-contrast);
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | .mat-step-icon-state-error {
|
---|
86 | background-color: transparent;
|
---|
87 | color: theming.get-color-from-palette($warn, text);
|
---|
88 | }
|
---|
89 |
|
---|
90 | .mat-step-label.mat-step-label-active {
|
---|
91 | color: theming.get-color-from-palette($foreground, text);
|
---|
92 | }
|
---|
93 |
|
---|
94 | .mat-step-label.mat-step-label-error {
|
---|
95 | color: theming.get-color-from-palette($warn, text);
|
---|
96 | }
|
---|
97 | }
|
---|
98 |
|
---|
99 | .mat-stepper-horizontal, .mat-stepper-vertical {
|
---|
100 | background-color: theming.get-color-from-palette($background, card);
|
---|
101 | }
|
---|
102 |
|
---|
103 | .mat-stepper-vertical-line::before {
|
---|
104 | border-left-color: theming.get-color-from-palette($foreground, divider);
|
---|
105 | }
|
---|
106 |
|
---|
107 | .mat-horizontal-stepper-header::before,
|
---|
108 | .mat-horizontal-stepper-header::after,
|
---|
109 | .mat-stepper-horizontal-line {
|
---|
110 | border-top-color: theming.get-color-from-palette($foreground, divider);
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | @mixin typography($config-or-theme) {
|
---|
115 | $config: typography.private-typography-to-2014-config(
|
---|
116 | theming.get-typography-config($config-or-theme));
|
---|
117 | .mat-stepper-vertical, .mat-stepper-horizontal {
|
---|
118 | font-family: typography-utils.font-family($config);
|
---|
119 | }
|
---|
120 |
|
---|
121 | .mat-step-label {
|
---|
122 | font: {
|
---|
123 | size: typography-utils.font-size($config, body-1);
|
---|
124 | weight: typography-utils.font-weight($config, body-1);
|
---|
125 | };
|
---|
126 | }
|
---|
127 |
|
---|
128 | .mat-step-sub-label-error {
|
---|
129 | font-weight: normal;
|
---|
130 | }
|
---|
131 |
|
---|
132 | .mat-step-label-error {
|
---|
133 | font-size: typography-utils.font-size($config, body-2);
|
---|
134 | }
|
---|
135 |
|
---|
136 | .mat-step-label-selected {
|
---|
137 | font: {
|
---|
138 | size: typography-utils.font-size($config, body-2);
|
---|
139 | weight: typography-utils.font-weight($config, body-2);
|
---|
140 | };
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | @mixin density($config-or-theme) {
|
---|
145 | $density-scale: theming.get-density-config($config-or-theme);
|
---|
146 | $height: compatibility.private-density-prop-value(stepper-variables.$density-config,
|
---|
147 | $density-scale, height);
|
---|
148 | $vertical-padding: private.private-div($height - stepper-variables.$label-header-height, 2);
|
---|
149 |
|
---|
150 | @include compatibility.private-density-legacy-compatibility() {
|
---|
151 | .mat-horizontal-stepper-header {
|
---|
152 | height: $height;
|
---|
153 | }
|
---|
154 |
|
---|
155 | .mat-stepper-label-position-bottom .mat-horizontal-stepper-header,
|
---|
156 | .mat-vertical-stepper-header {
|
---|
157 | padding: $vertical-padding stepper-variables.$side-gap;
|
---|
158 | }
|
---|
159 |
|
---|
160 | // Ensures that the vertical lines for the step content exceed into the step
|
---|
161 | // headers with a given distance (`$mat-stepper-line-gap`) to the step icon.
|
---|
162 | .mat-stepper-vertical-line::before {
|
---|
163 | top: stepper-variables.$line-gap - $vertical-padding;
|
---|
164 | bottom: stepper-variables.$line-gap - $vertical-padding;
|
---|
165 | }
|
---|
166 |
|
---|
167 | // Ensures that the horizontal lines for the step header are centered vertically.
|
---|
168 | .mat-stepper-label-position-bottom .mat-horizontal-stepper-header {
|
---|
169 | &::after, &::before {
|
---|
170 | top: $vertical-padding + private.private-div(stepper-variables.$label-header-height, 2);
|
---|
171 | }
|
---|
172 | }
|
---|
173 |
|
---|
174 | // Ensures that the horizontal line for the step content is aligned centered vertically.
|
---|
175 | .mat-stepper-label-position-bottom .mat-stepper-horizontal-line {
|
---|
176 | top: $vertical-padding + private.private-div(stepper-variables.$label-header-height, 2);
|
---|
177 | }
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | @mixin theme($theme-or-color-config) {
|
---|
182 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
183 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-stepper') {
|
---|
184 | $color: theming.get-color-config($theme);
|
---|
185 | $density: theming.get-density-config($theme);
|
---|
186 | $typography: theming.get-typography-config($theme);
|
---|
187 |
|
---|
188 | @if $color != null {
|
---|
189 | @include color($color);
|
---|
190 | }
|
---|
191 | @if $density != null {
|
---|
192 | @include density($density);
|
---|
193 | }
|
---|
194 | @if $typography != null {
|
---|
195 | @include typography($typography);
|
---|
196 | }
|
---|
197 | }
|
---|
198 | }
|
---|