@angular/material 17.0.0-rc.1 → 17.0.0-rc.2
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.
- package/button/_button-base.scss +37 -18
- package/button/_button-theme.scss +86 -142
- package/button/_fab-theme.scss +21 -49
- package/button/_icon-button-theme.scss +26 -25
- package/core/theming/_theming.scss +0 -14
- package/core/tokens/m2/mat/_fab.scss +87 -0
- package/core/tokens/m2/mat/_filled-button.scss +76 -0
- package/core/tokens/m2/mat/_icon-button.scss +73 -0
- package/core/tokens/m2/mat/_outlined-button.scss +73 -0
- package/core/tokens/m2/mat/_protected-button.scss +76 -0
- package/core/tokens/m2/mat/_text-button.scss +73 -0
- package/core/tokens/m2/mdc/_extended-fab.scss +3 -0
- package/core/tokens/m2/mdc/_fab.scss +17 -3
- package/core/tokens/m2/mdc/_filled-button.scss +24 -18
- package/core/tokens/m2/mdc/_icon-button.scss +0 -3
- package/core/tokens/m2/mdc/_outlined-button.scss +120 -0
- package/core/tokens/m2/mdc/_protected-button.scss +24 -19
- package/dialog/index.d.ts +2 -1
- package/esm2022/button/button.mjs +4 -4
- package/esm2022/button/fab.mjs +8 -8
- package/esm2022/button/icon-button.mjs +4 -4
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/dialog/dialog.mjs +1 -1
- package/esm2022/snack-bar/snack-bar-container.mjs +3 -3
- package/fesm2022/button.mjs +16 -16
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/core.mjs +1 -1
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +2 -2
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/package.json +2 -2
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/migration.json +1 -1
- package/schematics/ng-add/fonts/material-fonts.js +1 -3
- package/schematics/ng-add/fonts/material-fonts.mjs +1 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
- package/schematics/ng-update/index_bundled.js +123 -30
- package/schematics/ng-update/index_bundled.js.map +4 -4
- package/button/_button-theme-private.scss +0 -67
- package/core/density/private/_compatibility.scss +0 -74
package/button/_button-base.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
1
|
@use '@material/touch-target' as mdc-touch-target;
|
|
3
2
|
|
|
3
|
+
@use '../core/tokens/token-utils';
|
|
4
4
|
@use '../core/style/layout-common';
|
|
5
5
|
@use '../core/mdc-helpers/mdc-helpers';
|
|
6
6
|
|
|
@@ -40,11 +40,6 @@
|
|
|
40
40
|
.mat-mdc-button-persistent-ripple::before {
|
|
41
41
|
content: '';
|
|
42
42
|
opacity: 0;
|
|
43
|
-
background-color: var(--mat-mdc-button-persistent-ripple-color);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.mat-ripple-element {
|
|
47
|
-
background-color: var(--mat-mdc-button-ripple-color);
|
|
48
43
|
}
|
|
49
44
|
|
|
50
45
|
// The content should appear over the state and ripple layers, otherwise they may adversely affect
|
|
@@ -63,6 +58,33 @@
|
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
60
|
|
|
61
|
+
@mixin mat-private-button-ripple($prefix, $slots) {
|
|
62
|
+
@include token-utils.use-tokens($prefix, $slots) {
|
|
63
|
+
.mat-ripple-element {
|
|
64
|
+
@include token-utils.create-token-slot(background-color, ripple-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.mat-mdc-button-persistent-ripple::before {
|
|
68
|
+
@include token-utils.create-token-slot(background-color, state-layer-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:hover .mat-mdc-button-persistent-ripple::before {
|
|
72
|
+
@include token-utils.create-token-slot(opacity, hover-state-layer-opacity);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.cdk-program-focused,
|
|
76
|
+
&.cdk-keyboard-focused {
|
|
77
|
+
.mat-mdc-button-persistent-ripple::before {
|
|
78
|
+
@include token-utils.create-token-slot(opacity, focus-state-layer-opacity);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:active .mat-mdc-button-persistent-ripple::before {
|
|
83
|
+
@include token-utils.create-token-slot(opacity, pressed-state-layer-opacity);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
66
88
|
// MDC's disabled buttons define a default cursor with pointer-events none. However, they select
|
|
67
89
|
// :disabled for this, which does not affect anchor tags.
|
|
68
90
|
// TODO(andrewseguin): Discuss with the MDC team about a mixin we can call for applying this style,
|
|
@@ -76,6 +98,15 @@
|
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
100
|
|
|
101
|
+
// Hides the touch target on lower densities.
|
|
102
|
+
@mixin mat-private-button-touch-target-density($scale) {
|
|
103
|
+
@include mdc-helpers.if-touch-targets-unsupported($scale) {
|
|
104
|
+
.mat-mdc-button-touch-target {
|
|
105
|
+
display: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
79
110
|
@mixin mat-private-button-touch-target($is-square) {
|
|
80
111
|
// Element used to ensure that the button has a touch target that meets the required minimum.
|
|
81
112
|
// Note that we use this, instead of MDC's built-in `mdc-button--touch` class, because the MDC
|
|
@@ -89,15 +120,3 @@
|
|
|
89
120
|
$query: mdc-helpers.$mdc-base-styles-query);
|
|
90
121
|
}
|
|
91
122
|
}
|
|
92
|
-
|
|
93
|
-
// Changes a button token set to exclude the ripple styles.
|
|
94
|
-
@function mat-private-button-remove-ripple($tokens) {
|
|
95
|
-
@return map.merge($tokens, (
|
|
96
|
-
focus-state-layer-color: null,
|
|
97
|
-
focus-state-layer-opacity: null,
|
|
98
|
-
hover-state-layer-color: null,
|
|
99
|
-
hover-state-layer-opacity: null,
|
|
100
|
-
pressed-state-layer-color: null,
|
|
101
|
-
pressed-state-layer-opacity: null,
|
|
102
|
-
));
|
|
103
|
-
}
|
|
@@ -1,168 +1,136 @@
|
|
|
1
1
|
@use '@material/button/button' as mdc-button;
|
|
2
|
-
@use '@material/button/button-theme' as mdc-button-theme;
|
|
3
2
|
@use '@material/button/button-text-theme' as mdc-button-text-theme;
|
|
4
3
|
@use '@material/button/button-filled-theme' as mdc-button-filled-theme;
|
|
5
4
|
@use '@material/button/button-protected-theme' as mdc-button-protected-theme;
|
|
6
5
|
@use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;
|
|
7
|
-
@use '@material/theme/theme-color' as mdc-theme-color;
|
|
8
6
|
@use '@material/elevation/elevation-theme' as mdc-elevation-theme;
|
|
9
7
|
|
|
10
|
-
@use './button-
|
|
8
|
+
@use './button-base';
|
|
11
9
|
@use '../core/mdc-helpers/mdc-helpers';
|
|
12
10
|
@use '../core/theming/theming';
|
|
13
11
|
@use '../core/theming/inspection';
|
|
12
|
+
@use '../core/tokens/token-utils';
|
|
14
13
|
@use '../core/typography/typography';
|
|
15
14
|
@use '../core/tokens/m2/mdc/filled-button' as tokens-mdc-filled-button;
|
|
15
|
+
@use '../core/tokens/m2/mat/filled-button' as tokens-mat-filled-button;
|
|
16
|
+
@use '../core/tokens/m2/mdc/outlined-button' as tokens-mdc-outlined-button;
|
|
17
|
+
@use '../core/tokens/m2/mat/outlined-button' as tokens-mat-outlined-button;
|
|
16
18
|
@use '../core/tokens/m2/mdc/protected-button' as tokens-mdc-protected-button;
|
|
19
|
+
@use '../core/tokens/m2/mat/protected-button' as tokens-mat-protected-button;
|
|
17
20
|
@use '../core/tokens/m2/mdc/text-button' as tokens-mdc-text-button;
|
|
21
|
+
@use '../core/tokens/m2/mat/text-button' as tokens-mat-text-button;
|
|
18
22
|
|
|
19
|
-
@function _on-color($theme, $palette) {
|
|
20
|
-
$is-dark: inspection.get-theme-type($theme) == dark;
|
|
21
|
-
@return if(mdc-helpers.variable-safe-contrast-tone($palette, $is-dark) == 'dark', #000, #fff);
|
|
22
|
-
}
|
|
23
23
|
|
|
24
|
-
@mixin
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
@mixin _text-button-variant($theme, $palette) {
|
|
25
|
+
$mdc-tokens: if($palette,
|
|
26
|
+
tokens-mdc-text-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
27
|
+
tokens-mdc-text-button.get-color-tokens($theme)
|
|
28
|
+
);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
$mat-tokens: if($palette,
|
|
31
|
+
tokens-mat-text-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
32
|
+
tokens-mat-text-button.get-color-tokens($theme)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
@include mdc-button-text-theme.theme($mdc-tokens);
|
|
36
|
+
@include token-utils.create-token-values(tokens-mat-text-button.$prefix, $mat-tokens);
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
@mixin
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
$primary: mdc-theme-color.prop-value(primary);
|
|
40
|
-
$secondary: mdc-theme-color.prop-value(secondary);
|
|
41
|
-
$error: mdc-theme-color.prop-value(error);
|
|
42
|
-
|
|
43
|
-
.mat-mdc-outlined-button {
|
|
44
|
-
@include mdc-button-outlined-theme.theme((
|
|
45
|
-
outline-color: rgba(mdc-theme-color.prop-value(on-surface), 0.12)
|
|
46
|
-
));
|
|
47
|
-
|
|
48
|
-
&.mat-unthemed {
|
|
49
|
-
@include _outlined-button-variant($on-surface);
|
|
50
|
-
}
|
|
39
|
+
@mixin _filled-button-variant($theme, $palette) {
|
|
40
|
+
$mdc-tokens: if($palette,
|
|
41
|
+
tokens-mdc-filled-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
42
|
+
tokens-mdc-filled-button.get-color-tokens($theme)
|
|
43
|
+
);
|
|
51
44
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
$mat-tokens: if($palette,
|
|
46
|
+
tokens-mat-filled-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
47
|
+
tokens-mat-filled-button.get-color-tokens($theme)
|
|
48
|
+
);
|
|
55
49
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
@include mdc-button-filled-theme.theme($mdc-tokens);
|
|
51
|
+
@include token-utils.create-token-values(tokens-mat-filled-button.$prefix, $mat-tokens);
|
|
52
|
+
}
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
@mixin _protected-button-variant($theme, $palette) {
|
|
55
|
+
$mdc-tokens: if($palette,
|
|
56
|
+
tokens-mdc-protected-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
57
|
+
tokens-mdc-protected-button.get-color-tokens($theme)
|
|
58
|
+
);
|
|
63
59
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
label-text-color: $disabled-ink-color,
|
|
69
|
-
disabled-label-text-color: $disabled-ink-color,
|
|
70
|
-
outline-color: rgba($on-surface, 0.12),
|
|
71
|
-
disabled-outline-color: rgba($on-surface, 0.12),
|
|
72
|
-
));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
60
|
+
$mat-tokens: if($palette,
|
|
61
|
+
tokens-mat-protected-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
62
|
+
tokens-mat-protected-button.get-color-tokens($theme)
|
|
63
|
+
);
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
65
|
+
@include mdc-button-protected-theme.theme($mdc-tokens);
|
|
66
|
+
@include token-utils.create-token-values(tokens-mat-protected-button.$prefix, $mat-tokens);
|
|
67
|
+
}
|
|
80
68
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
69
|
+
@mixin _outlined-button-variant($theme, $palette) {
|
|
70
|
+
$mdc-tokens: if($palette,
|
|
71
|
+
tokens-mdc-outlined-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
72
|
+
tokens-mdc-outlined-button.get-color-tokens($theme)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
$mat-tokens: if($palette,
|
|
76
|
+
tokens-mat-outlined-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
77
|
+
tokens-mat-outlined-button.get-color-tokens($theme)
|
|
78
|
+
);
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$error: inspection.get-theme-color($theme, warn);
|
|
80
|
+
@include mdc-button-outlined-theme.theme($mdc-tokens);
|
|
81
|
+
@include token-utils.create-token-values(tokens-mat-outlined-button.$prefix, $mat-tokens);
|
|
82
|
+
}
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
$on-error: _on-color($theme, $error);
|
|
84
|
+
@mixin base($theme) {
|
|
85
|
+
// TODO(mmalerba): Move button base tokens here
|
|
86
|
+
}
|
|
95
87
|
|
|
88
|
+
@mixin color($theme) {
|
|
96
89
|
.mat-mdc-button {
|
|
97
|
-
@include
|
|
90
|
+
@include _text-button-variant($theme, null);
|
|
98
91
|
|
|
99
92
|
&.mat-primary {
|
|
100
|
-
@include
|
|
101
|
-
tokens-mdc-text-button.private-get-color-palette-color-tokens($theme, primary));
|
|
93
|
+
@include _text-button-variant($theme, primary);
|
|
102
94
|
}
|
|
103
95
|
|
|
104
96
|
&.mat-accent {
|
|
105
|
-
@include
|
|
106
|
-
tokens-mdc-text-button.private-get-color-palette-color-tokens($theme, accent));
|
|
97
|
+
@include _text-button-variant($theme, accent);
|
|
107
98
|
}
|
|
108
99
|
|
|
109
100
|
&.mat-warn {
|
|
110
|
-
@include
|
|
111
|
-
tokens-mdc-text-button.private-get-color-palette-color-tokens($theme, warn));
|
|
101
|
+
@include _text-button-variant($theme, warn);
|
|
112
102
|
}
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
.mat-mdc-unelevated-button {
|
|
116
|
-
|
|
117
|
-
$primary-color-tokens: tokens-mdc-filled-button.get-color-tokens($theme, $primary, $on-primary);
|
|
118
|
-
$accent-color-tokens: tokens-mdc-filled-button.get-color-tokens($theme, $accent, $on-accent);
|
|
119
|
-
$warn-color-tokens: tokens-mdc-filled-button.get-color-tokens($theme, $error, $on-error);
|
|
120
|
-
|
|
121
|
-
&.mat-unthemed {
|
|
122
|
-
@include mdc-button-filled-theme.theme($default-color-tokens);
|
|
123
|
-
}
|
|
106
|
+
@include _filled-button-variant($theme, null);
|
|
124
107
|
|
|
125
108
|
&.mat-primary {
|
|
126
|
-
@include
|
|
109
|
+
@include _filled-button-variant($theme, primary);
|
|
127
110
|
}
|
|
128
111
|
|
|
129
112
|
&.mat-accent {
|
|
130
|
-
@include
|
|
113
|
+
@include _filled-button-variant($theme, accent);
|
|
131
114
|
}
|
|
132
115
|
|
|
133
116
|
&.mat-warn {
|
|
134
|
-
@include
|
|
117
|
+
@include _filled-button-variant($theme, warn);
|
|
135
118
|
}
|
|
136
119
|
}
|
|
137
120
|
|
|
138
121
|
.mat-mdc-raised-button {
|
|
139
|
-
|
|
140
|
-
$theme,
|
|
141
|
-
$surface,
|
|
142
|
-
$on-surface
|
|
143
|
-
);
|
|
144
|
-
$primary-color-tokens: tokens-mdc-protected-button.get-color-tokens(
|
|
145
|
-
$theme,
|
|
146
|
-
$primary,
|
|
147
|
-
$on-primary
|
|
148
|
-
);
|
|
149
|
-
$accent-color-tokens: tokens-mdc-protected-button.get-color-tokens($theme, $accent, $on-accent);
|
|
150
|
-
$warn-color-tokens: tokens-mdc-protected-button.get-color-tokens($theme, $error, $on-error);
|
|
151
|
-
|
|
152
|
-
&.mat-unthemed {
|
|
153
|
-
@include mdc-button-protected-theme.theme($default-color-tokens);
|
|
154
|
-
}
|
|
122
|
+
@include _protected-button-variant($theme, null);
|
|
155
123
|
|
|
156
124
|
&.mat-primary {
|
|
157
|
-
@include
|
|
125
|
+
@include _protected-button-variant($theme, primary);
|
|
158
126
|
}
|
|
159
127
|
|
|
160
128
|
&.mat-accent {
|
|
161
|
-
@include
|
|
129
|
+
@include _protected-button-variant($theme, accent);
|
|
162
130
|
}
|
|
163
131
|
|
|
164
132
|
&.mat-warn {
|
|
165
|
-
@include
|
|
133
|
+
@include _protected-button-variant($theme, warn);
|
|
166
134
|
}
|
|
167
135
|
|
|
168
136
|
// TODO(wagnermaciel): Remove this workaround when b/301126527 is resolved
|
|
@@ -179,41 +147,19 @@
|
|
|
179
147
|
}
|
|
180
148
|
}
|
|
181
149
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
$disabled-container-color: rgba($on-surface, 0.12);
|
|
150
|
+
.mat-mdc-outlined-button {
|
|
151
|
+
@include _outlined-button-variant($theme, null);
|
|
185
152
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.mat-mdc-button {
|
|
189
|
-
@include button-theme-private.apply-disabled-style() {
|
|
190
|
-
@include mdc-button-text-theme.theme((
|
|
191
|
-
disabled-label-text-color: $disabled-ink-color,
|
|
192
|
-
label-text-color: $disabled-ink-color,
|
|
193
|
-
));
|
|
153
|
+
&.mat-primary {
|
|
154
|
+
@include _outlined-button-variant($theme, primary);
|
|
194
155
|
}
|
|
195
|
-
}
|
|
196
156
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
@include mdc-elevation-theme.elevation(0);
|
|
200
|
-
@include mdc-button-protected-theme.theme((
|
|
201
|
-
disabled-container-color: $disabled-container-color,
|
|
202
|
-
disabled-label-text-color: $disabled-ink-color,
|
|
203
|
-
container-color: $disabled-container-color,
|
|
204
|
-
label-text-color: $disabled-ink-color,
|
|
205
|
-
));
|
|
157
|
+
&.mat-accent {
|
|
158
|
+
@include _outlined-button-variant($theme, accent);
|
|
206
159
|
}
|
|
207
|
-
}
|
|
208
160
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@include mdc-button-filled-theme.theme((
|
|
212
|
-
disabled-container-color: $disabled-container-color,
|
|
213
|
-
disabled-label-text-color: $disabled-ink-color,
|
|
214
|
-
container-color: $disabled-container-color,
|
|
215
|
-
label-text-color: $disabled-ink-color,
|
|
216
|
-
));
|
|
161
|
+
&.mat-warn {
|
|
162
|
+
@include _outlined-button-variant($theme, warn);
|
|
217
163
|
}
|
|
218
164
|
}
|
|
219
165
|
}
|
|
@@ -230,27 +176,25 @@
|
|
|
230
176
|
.mat-mdc-button {
|
|
231
177
|
$density-tokens: tokens-mdc-text-button.get-density-tokens($theme);
|
|
232
178
|
@include mdc-button-text-theme.theme($density-tokens);
|
|
233
|
-
@include button-
|
|
179
|
+
@include button-base.mat-private-button-touch-target-density($density-scale);
|
|
234
180
|
}
|
|
235
181
|
|
|
236
182
|
.mat-mdc-raised-button {
|
|
237
183
|
$density-tokens: tokens-mdc-protected-button.get-density-tokens($theme);
|
|
238
184
|
@include mdc-button-protected-theme.theme($density-tokens);
|
|
239
|
-
@include button-
|
|
185
|
+
@include button-base.mat-private-button-touch-target-density($density-scale);
|
|
240
186
|
}
|
|
241
187
|
|
|
242
188
|
.mat-mdc-unelevated-button {
|
|
243
189
|
$density-tokens: tokens-mdc-filled-button.get-density-tokens($theme);
|
|
244
190
|
@include mdc-button-filled-theme.theme($density-tokens);
|
|
245
|
-
@include button-
|
|
191
|
+
@include button-base.mat-private-button-touch-target-density($density-scale);
|
|
246
192
|
}
|
|
247
193
|
|
|
248
194
|
.mat-mdc-outlined-button {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
@include button-theme-private.touch-target-density($density-scale);
|
|
253
|
-
}
|
|
195
|
+
$density-tokens: tokens-mdc-outlined-button.get-density-tokens($theme);
|
|
196
|
+
@include mdc-button-outlined-theme.theme($density-tokens);
|
|
197
|
+
@include button-base.mat-private-button-touch-target-density($density-scale);
|
|
254
198
|
}
|
|
255
199
|
}
|
|
256
200
|
|
package/button/_fab-theme.scss
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
@use '@material/fab/fab-theme' as mdc-fab-theme;
|
|
3
3
|
@use '@material/fab/extended-fab-theme' as mdc-extended-fab-theme;
|
|
4
4
|
|
|
5
|
-
@use './button-theme-private';
|
|
6
5
|
@use '../core/mdc-helpers/mdc-helpers';
|
|
7
6
|
@use '../core/style/sass-utils';
|
|
8
7
|
@use '../core/theming/theming';
|
|
9
8
|
@use '../core/theming/inspection';
|
|
10
9
|
@use '../core/tokens/m2/mdc/fab' as tokens-mdc-fab;
|
|
11
10
|
@use '../core/tokens/m2/mdc/extended-fab' as tokens-mdc-extended-fab;
|
|
11
|
+
@use '../core/tokens/m2/mat/fab' as tokens-mat-fab;
|
|
12
|
+
@use '../core/tokens/token-utils';
|
|
12
13
|
@use '../core/typography/typography';
|
|
13
14
|
|
|
14
15
|
@mixin base($theme) {
|
|
@@ -21,67 +22,38 @@
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
@mixin _fab-variant($
|
|
25
|
-
$
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
@mixin _fab-variant($theme, $palette) {
|
|
26
|
+
$mdc-tokens: if($palette,
|
|
27
|
+
tokens-mdc-fab.private-get-color-palette-color-tokens($theme, $palette),
|
|
28
|
+
tokens-mdc-fab.get-color-tokens($theme)
|
|
28
29
|
);
|
|
29
|
-
@include mdc-fab-theme.theme($color-tokens);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
$mat-tokens: if($palette,
|
|
32
|
+
tokens-mat-fab.private-get-color-palette-color-tokens($theme, $palette),
|
|
33
|
+
tokens-mat-fab.get-color-tokens($theme)
|
|
34
|
+
);
|
|
33
35
|
|
|
34
|
-
@
|
|
35
|
-
@
|
|
36
|
+
@include mdc-fab-theme.theme($mdc-tokens);
|
|
37
|
+
@include token-utils.create-token-values(tokens-mat-fab.$prefix, $mat-tokens);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
@mixin color($theme) {
|
|
39
|
-
$is-dark: inspection.get-theme-type($theme) == dark;
|
|
40
|
-
|
|
41
|
-
$surface: inspection.get-theme-color($theme, background, card);
|
|
42
|
-
$primary: inspection.get-theme-color($theme, primary);
|
|
43
|
-
$accent: inspection.get-theme-color($theme, accent);
|
|
44
|
-
$warn: inspection.get-theme-color($theme, warn);
|
|
45
|
-
|
|
46
|
-
$on-surface: white-or-black($surface, $is-dark);
|
|
47
|
-
$on-primary: white-or-black($primary, $is-dark);
|
|
48
|
-
$on-accent: white-or-black($accent, $is-dark);
|
|
49
|
-
$on-warn: white-or-black($warn, $is-dark);
|
|
50
|
-
|
|
51
|
-
$disabled: rgba($on-surface, 0.12);
|
|
52
|
-
$on-disabled: rgba($on-surface, if($is-dark, 0.5, 0.38));
|
|
53
|
-
|
|
54
41
|
@include sass-utils.current-selector-or-root() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// revisited w/ a more holistic solution.
|
|
42
|
+
@include _fab-variant($theme, null);
|
|
43
|
+
|
|
58
44
|
.mat-mdc-fab,
|
|
59
45
|
.mat-mdc-mini-fab {
|
|
60
|
-
|
|
61
|
-
@include
|
|
46
|
+
&.mat-primary {
|
|
47
|
+
@include _fab-variant($theme, primary);
|
|
62
48
|
}
|
|
63
|
-
}
|
|
64
49
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@include _fab-variant($on-disabled, $disabled);
|
|
50
|
+
&.mat-accent {
|
|
51
|
+
@include _fab-variant($theme, accent);
|
|
68
52
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.mat-unthemed {
|
|
72
|
-
@include _fab-variant($on-surface, $surface);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.mat-primary {
|
|
76
|
-
@include _fab-variant($on-primary, $primary);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.mat-accent {
|
|
80
|
-
@include _fab-variant($on-accent, $accent);
|
|
81
|
-
}
|
|
82
53
|
|
|
83
|
-
|
|
84
|
-
|
|
54
|
+
&.mat-warn {
|
|
55
|
+
@include _fab-variant($theme, warn);
|
|
56
|
+
}
|
|
85
57
|
}
|
|
86
58
|
}
|
|
87
59
|
}
|
|
@@ -2,48 +2,48 @@
|
|
|
2
2
|
@use '@material/density/functions' as mdc-density-functions;
|
|
3
3
|
@use '@material/icon-button/icon-button-theme' as mdc-icon-button-theme;
|
|
4
4
|
@use '../core/tokens/m2/mdc/icon-button' as tokens-mdc-icon-button;
|
|
5
|
+
@use '../core/tokens/m2/mat/icon-button' as tokens-mat-icon-button;
|
|
5
6
|
|
|
6
|
-
@use '
|
|
7
|
+
@use '../core/style/sass-utils';
|
|
8
|
+
@use './button-base';
|
|
9
|
+
@use '../core/tokens/token-utils';
|
|
7
10
|
@use '../core/theming/theming';
|
|
8
11
|
@use '../core/theming/inspection';
|
|
9
12
|
|
|
10
|
-
$_icon-size: 24px;
|
|
11
|
-
|
|
12
|
-
// TODO(crisbeto): move these into tokens
|
|
13
|
-
@mixin _ripple-color($color) {
|
|
14
|
-
--mat-mdc-button-persistent-ripple-color: #{$color};
|
|
15
|
-
--mat-mdc-button-ripple-color: #{rgba($color, 0.1)};
|
|
16
|
-
}
|
|
17
13
|
|
|
18
14
|
@mixin base($theme) {
|
|
19
15
|
// TODO(mmalerba): Move icon button base tokens here
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
@mixin
|
|
23
|
-
$
|
|
24
|
-
|
|
18
|
+
@mixin _icon-button-variant($theme, $palette) {
|
|
19
|
+
$mdc-tokens: if($palette,
|
|
20
|
+
tokens-mdc-icon-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
21
|
+
tokens-mdc-icon-button.get-color-tokens($theme)
|
|
22
|
+
);
|
|
25
23
|
|
|
24
|
+
$mat-tokens: if($palette,
|
|
25
|
+
tokens-mat-icon-button.private-get-color-palette-color-tokens($theme, $palette),
|
|
26
|
+
tokens-mat-icon-button.get-color-tokens($theme)
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
@include mdc-icon-button-theme.theme($mdc-tokens);
|
|
30
|
+
@include token-utils.create-token-values(tokens-mat-icon-button.$prefix, $mat-tokens);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@mixin color($theme) {
|
|
26
34
|
.mat-mdc-icon-button {
|
|
27
|
-
@include button-
|
|
28
|
-
@include mdc-icon-button-theme.theme($color-tokens);
|
|
29
|
-
@include _ripple-color(if($is-dark, #fff, #000));
|
|
35
|
+
@include _icon-button-variant($theme, null);
|
|
30
36
|
|
|
31
37
|
&.mat-primary {
|
|
32
|
-
@include
|
|
33
|
-
@include mdc-icon-button-theme.theme(
|
|
34
|
-
tokens-mdc-icon-button.private-get-color-palette-color-tokens($theme, primary));
|
|
38
|
+
@include _icon-button-variant($theme, primary);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
&.mat-accent {
|
|
38
|
-
@include
|
|
39
|
-
@include mdc-icon-button-theme.theme(
|
|
40
|
-
tokens-mdc-icon-button.private-get-color-palette-color-tokens($theme, accent));
|
|
42
|
+
@include _icon-button-variant($theme, accent);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
&.mat-warn {
|
|
44
|
-
@include
|
|
45
|
-
@include mdc-icon-button-theme.theme(
|
|
46
|
-
tokens-mdc-icon-button.private-get-color-palette-color-tokens($theme, warn));
|
|
46
|
+
@include _icon-button-variant($theme, warn);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -51,6 +51,7 @@ $_icon-size: 24px;
|
|
|
51
51
|
@mixin typography($theme) {}
|
|
52
52
|
|
|
53
53
|
@mixin density($theme) {
|
|
54
|
+
$icon-size: 24px;
|
|
54
55
|
$density-scale: inspection.get-theme-density($theme);
|
|
55
56
|
// Manually apply the expected density theming, and include the padding
|
|
56
57
|
// as it was applied before
|
|
@@ -81,9 +82,9 @@ $_icon-size: 24px;
|
|
|
81
82
|
// fails validation because the variable is "undefined" in the sass stack.
|
|
82
83
|
width: var(--mdc-icon-button-state-layer-size);
|
|
83
84
|
height: var(--mdc-icon-button-state-layer-size);
|
|
84
|
-
padding: math.div($calculated-size - $
|
|
85
|
+
padding: math.div($calculated-size - $icon-size, 2);
|
|
85
86
|
|
|
86
|
-
@include button-
|
|
87
|
+
@include button-base.mat-private-button-touch-target-density($density-scale);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
@use 'sass:math';
|
|
4
4
|
@use 'sass:meta';
|
|
5
5
|
@use 'palette';
|
|
6
|
-
@use '../density/private/compatibility';
|
|
7
6
|
|
|
8
7
|
// Whether to enable compatibility with legacy methods for accessing theme information.
|
|
9
8
|
$theme-legacy-inspection-api-compatibility: true !default;
|
|
@@ -481,20 +480,7 @@ $_internals: _mat-theming-internals-do-not-access;
|
|
|
481
480
|
$_emitted-density: map.merge($_emitted-density, ($id: $previous-density)) !global;
|
|
482
481
|
$_emitted-typography: map.merge($_emitted-typography, ($id: $previous-typography)) !global;
|
|
483
482
|
|
|
484
|
-
// If duplicate default density styles would be generated for a legacy constructed theme,
|
|
485
|
-
// we adjust the density generation so that no density styles are generated by default.
|
|
486
|
-
// If no default density styles have been generated yet, we ensure that the styles
|
|
487
|
-
// are generated at root. For legacy themes our goal is to generate default density
|
|
488
|
-
// styles **once** and at root. This matches the old behavior where density styles were
|
|
489
|
-
// part of the base component styles (that did not use view encapsulation).
|
|
490
|
-
// TODO: Remove this compatibility logic when the legacy theming API is removed.
|
|
491
|
-
compatibility.$private-density-generate-at-root: private-is-legacy-constructed-theme($theme);
|
|
492
|
-
compatibility.$private-density-generate-styles: not $duplicate-legacy-density;
|
|
493
|
-
|
|
494
483
|
@content;
|
|
495
|
-
|
|
496
|
-
compatibility.$private-density-generate-at-root: false;
|
|
497
|
-
compatibility.$private-density-generate-styles: true;
|
|
498
484
|
}
|
|
499
485
|
|
|
500
486
|
// Checks whether the given value resolves to a theme object. Theme objects are always
|