File tree 24 files changed +56
-60
lines changed
24 files changed +56
-60
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,12 @@ $candy-app-theme: mat.define-light-theme((
32
32
@include experimental .popover-edit-theme ($candy-app-theme );
33
33
34
34
.demo-strong-focus {
35
- // Include base styles for strong focus indicators.
36
- $indicators-config : (border-color : mat .get-color-from-palette ($candy-app-primary ));
37
- @include mat .strong-focus-indicators ($indicators-config );
38
- @include experimental .mdc-strong-focus-indicators ($indicators-config );
35
+ // Note: we can theme the indicators directly through `strong-focus-indicators` as well.
36
+ // Use the theme so we have some coverage over the entire API surface.
37
+ @include mat .strong-focus-indicators ();
38
+ @include mat .strong-focus-indicators-theme ($candy-app-theme );
39
+ @include experimental .mdc-strong-focus-indicators ();
40
+ @include experimental .mdc-strong-focus-indicators-theme ($candy-app-theme );
39
41
}
40
42
41
43
// Include the alternative theme styles inside of a block with a CSS class. You can make this
@@ -57,9 +59,8 @@ $candy-app-theme: mat.define-light-theme((
57
59
58
60
// Include the dark theme colors for focus indicators.
59
61
& .demo-strong-focus {
60
- $indicators-config : (border-color : mat .get-color-from-palette ($dark-primary ));
61
- @include mat .strong-focus-indicators ($indicators-config );
62
- @include experimental .mdc-strong-focus-indicators ($indicators-config );
62
+ @include mat .strong-focus-indicators-theme ($dark-colors );
63
+ @include experimental .mdc-strong-focus-indicators-theme ($dark-colors );
63
64
}
64
65
}
65
66
Original file line number Diff line number Diff line change 113
113
.mat-mdc-unelevated-button ,
114
114
.mat-mdc-raised-button {
115
115
.mat-mdc-focus-indicator ::before {
116
- $default-border-width : mat .$focus-indicators-private -default-border-width ;
116
+ $default-border-width : mat .$private-strong- focus-indicators-default-border-width ;
117
117
$border-width : var (--mat-mdc-focus-indicator-border-width , #{$default-border-width } );
118
118
$offset : calc (#{$border-width } + 2px );
119
119
margin : calc (#{$offset } * -1 );
120
120
}
121
121
}
122
122
123
123
.mat-mdc-outlined-button .mat-mdc-focus-indicator ::before {
124
- $default-border-width : mat .$focus-indicators-private -default-border-width ;
124
+ $default-border-width : mat .$private-strong- focus-indicators-default-border-width ;
125
125
$border-width : var (--mat-mdc-focus-indicator-border-width , #{$default-border-width } );
126
126
$offset : calc (#{$border-width } + 3px );
127
127
margin : calc (#{$offset } * -1 );
Original file line number Diff line number Diff line change 67
67
}
68
68
69
69
.mat-mdc-focus-indicator ::before {
70
- $default-border-width : mat .$focus-indicators-private -default-border-width ;
70
+ $default-border-width : mat .$private-strong- focus-indicators-default-border-width ;
71
71
$border-width : var (--mat-mdc-focus-indicator-border-width , #{$default-border-width } );
72
72
$offset : calc (#{$border-width } + 2px );
73
73
margin : calc (#{$offset } * -1 );
Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ sass_binary(
49
49
],
50
50
deps = [
51
51
":mdc_checkbox_scss_lib" ,
52
- "//src/cdk:sass_lib" ,
53
52
"//src/material:sass_lib" ,
54
53
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
55
54
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
Original file line number Diff line number Diff line change 179
179
// For the chip element, default inset/offset values are necessary to ensure that
180
180
// the focus indicator is sufficiently contrastive and renders appropriately.
181
181
.mat-mdc-focus-indicator ::before {
182
- $default-border-width : mat .$focus-indicators-private -default-border-width ;
182
+ $default-border-width : mat .$private-strong- focus-indicators-default-border-width ;
183
183
$border-width : var (--mat-mdc-focus-indicator-border-width , #{$default-border-width } );
184
184
$offset : calc (#{$border-width } + 2px );
185
185
margin : calc (#{$offset } * -1 );
196
196
}
197
197
198
198
& ::before {
199
- $default-border-width : mat .$focus-indicators-private -default-border-width ;
199
+ $default-border-width : mat .$private-strong- focus-indicators-default-border-width ;
200
200
$offset : var (--mat-mdc-focus-indicator-border-width , #{$default-border-width } );
201
201
margin : calc (#{$offset } * -1 );
202
202
228
228
}
229
229
}
230
230
231
- // In the chips the individual actions have focus so we target a different element.
231
+ // The chip has multiple focus targets so we have to put the indicator on
232
+ // a separate element, rather than on the focusable element itself.
232
233
.mat-mdc-chip-action :focus .mat-mdc-focus-indicator ::before {
233
234
content : ' ' ;
234
235
}
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ sass_binary(
43
43
"external/npm/node_modules" ,
44
44
],
45
45
deps = [
46
- "//src/cdk:sass_lib" ,
47
46
"//src/material:sass_lib" ,
48
47
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
49
48
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
Original file line number Diff line number Diff line change 2
2
@use ' sass:map' ;
3
3
@use ' sass:meta' ;
4
4
5
+ $_prefix : ' mat-mdc' ;
6
+
5
7
// stylelint-disable-next-line material/theme-mixin-api
6
8
@mixin color ($config-or-theme-or-color ) {
7
9
@if meta .type-of ($config-or-theme-or-color ) == ' color' {
8
- @include mat .focus-indicators-private-private -customize-focus-indicators ((
10
+ @include mat .private-strong-focus-indicators -customize-focus-indicators ((
9
11
border-color : $config-or-theme-or-color
10
- ), ' mat-mdc ' );
12
+ ), $_prefix );
11
13
}
12
14
@else {
13
15
$config : mat .get-color-config ($config-or-theme-or-color );
14
16
$border-color : mat .get-color-from-palette (map .get ($config , primary ));
15
- @include mat .focus-indicators-private-private -customize-focus-indicators ((
17
+ @include mat .private-strong-focus-indicators -customize-focus-indicators ((
16
18
border-color : $border-color
17
- ), ' mat-mdc ' );
19
+ ), $_prefix );
18
20
}
19
21
}
20
22
21
23
// stylelint-disable-next-line material/theme-mixin-api
22
24
@mixin theme ($theme-or-color-config-or-color ) {
23
25
@if meta .type-of ($theme-or-color-config-or-color ) == ' color' {
24
- @include mat .focus-indicators-private-private -customize-focus-indicators ((
26
+ @include mat .private-strong-focus-indicators -customize-focus-indicators ((
25
27
border-color : $theme-or-color-config-or-color
26
- ), ' mat-mdc ' );
28
+ ), $_prefix );
27
29
}
28
30
@else {
29
31
$theme : mat .private-legacy-get-theme ($theme-or-color-config-or-color );
Original file line number Diff line number Diff line change 11
11
// Merge default config with user config.
12
12
$config : map .merge ($default-config , $config );
13
13
14
- @include mat .focus-indicators-private-private -customize-focus-indicators ($config , ' mat-mdc' );
14
+ @include mat .private-strong-focus-indicators -customize-focus-indicators ($config , ' mat-mdc' );
15
15
}
Original file line number Diff line number Diff line change 59
59
// focus/selected/hover state. Hence, we need to have a separate list-item spanning
60
60
// element that can be used for strong focus indicators.
61
61
.mat-mdc-list-item {
62
- & > .mat-mdc-focus-indicator {
62
+ > .mat-mdc-focus-indicator {
63
63
@include mat .private-fill ();
64
64
pointer-events : none ;
65
65
}
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ sass_binary(
46
46
"external/npm/node_modules" ,
47
47
],
48
48
deps = [
49
- "//src/cdk:sass_lib" ,
50
49
"//src/material:sass_lib" ,
51
50
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
52
51
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
Original file line number Diff line number Diff line change 70
70
opacity : mdc-radio-theme .$ripple-opacity ;
71
71
}
72
72
73
- // Radio components have to set `border-radius: 50%` in order to support density scaling
74
- // which will clip a square focus indicator so we have to turn it into a circle.
75
73
& ::before {
76
74
border-radius : 50% ;
77
75
}
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ sass_binary(
50
50
"external/npm/node_modules" ,
51
51
],
52
52
deps = [
53
- "//src/cdk:sass_lib" ,
54
53
"//src/material:sass_lib" ,
55
54
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
56
55
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ sass_library(
46
46
name = "mdc_tabs_scss_lib" ,
47
47
srcs = glob (["**/_*.scss" ]),
48
48
deps = [
49
- "//src/cdk:sass_lib" ,
50
49
"//src/material:sass_lib" ,
51
50
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib" ,
52
51
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib" ,
Original file line number Diff line number Diff line change 32
32
@forward ' ./table/table-flex-styles' show private-table-flex-styles ;
33
33
@forward ' ./core/style/menu-common' as private-menu-common- *;
34
34
@forward ' ./core/style/button-common' as private-button-common- *;
35
- @forward ' ./core/style/focus-indicators' as focus-indicators-private- *;
36
35
37
36
// Structural
38
37
@forward ' ./core/core' show core ;
39
38
@forward ' ./core/ripple/ripple' show ripple ;
40
39
@forward ' ./core/focus-indicators/focus-indicators' show strong-focus-indicators ;
40
+ @forward ' ./core/focus-indicators/private' as private-strong-focus-indicators- *;
41
41
@forward ' ./core/style/elevation' show elevation , overridable-elevation , elevation-transition ;
42
42
43
43
// Theme bundles
Original file line number Diff line number Diff line change 2
2
3
3
@use ' ./button-base' ;
4
4
@use ' ../core/style/layout-common' ;
5
- @use ' ../core/style/ focus-indicators' ;
5
+ @use ' ../core/focus-indicators/private ' ;
6
6
7
7
// TODO(jelbourn): Measure perf benefits for translate3d and will-change.
8
8
// TODO(jelbourn): Figure out if anchor hover underline actually happens in any browser.
163
163
.mat-fab ,
164
164
.mat-mini-fab {
165
165
& ::before {
166
- $border-width :
167
- var (--mat-focus-indicator-border-width , #{focus-indicators .$default-border-width } );
166
+ $border-width : var (--mat-focus-indicator-border-width , #{private .$default-border-width } );
168
167
$offset : calc (#{$border-width } + 2px );
169
168
margin : calc (#{$offset } * -1 );
170
169
}
171
170
}
172
171
173
172
.mat-stroked-button ::before {
174
- $border-width :
175
- var (--mat-focus-indicator-border-width , #{focus-indicators .$default-border-width } );
173
+ $border-width : var (--mat-focus-indicator-border-width , #{private .$default-border-width } );
176
174
$offset : calc (#{$border-width } + 3px );
177
175
margin : calc (#{$offset } * -1 );
178
176
}
Original file line number Diff line number Diff line change 3
3
@use ' ../core/style/variables' ;
4
4
@use ' ../core/style/elevation' ;
5
5
@use ' ../core/style/layout-common' ;
6
- @use ' ../core/style/private' ;
7
- @use ' ../core/style/ focus-indicators' ;
6
+ @use ' ../core/style/private' as style-private ;
7
+ @use ' ../core/focus-indicators/private ' as focus-indicators-private ;
8
8
9
9
$chip-min-height : 32px ;
10
10
$chip-vertical-padding : 7px ;
@@ -41,15 +41,15 @@ $chip-remove-size: 18px;
41
41
// the focus indicator is sufficiently contrastive and renders appropriately.
42
42
& ::before {
43
43
$border-width :
44
- var (--mat-focus-indicator-border-width , #{focus-indicators .$default-border-width } );
44
+ var (--mat-focus-indicator-border-width , #{focus-indicators-private .$default-border-width } );
45
45
$offset : calc (#{$border-width } + 2px );
46
46
margin : calc (#{$offset } * -1 );
47
47
}
48
48
}
49
49
50
50
.mat-standard-chip {
51
51
@include elevation .elevation-transition ;
52
- @include private .private-animation-noop ;
52
+ @include style- private .private-animation-noop ;
53
53
display : inline-flex ;
54
54
padding : $chip-vertical-padding $chip-horizontal-padding ;
55
55
border-radius : 16px ;
Original file line number Diff line number Diff line change 2
2
3
3
// Core styles that can be used to apply material design treatments to any element.
4
4
@use ' ./ripple/ripple' ;
5
- @use ' ./style/ focus-indicators' ;
5
+ @use ' ./focus-indicators/private ' ;
6
6
@use ' ./typography/all-typography' ;
7
7
8
8
// Mixin that renders all of the core styles that are not theme-dependent.
13
13
@include cdk .overlay ();
14
14
@include cdk .text-field-autosize ();
15
15
@include cdk .text-field-autofill ();
16
- @include focus-indicators . private- structural-styling (' mat' );
17
- @include focus-indicators . private- structural-styling (' mat-mdc' );
16
+ @include private . structural-styling (' mat' );
17
+ @include private . structural-styling (' mat-mdc' );
18
18
}
Original file line number Diff line number Diff line change 1
1
@use ' sass:map' ;
2
2
@use ' sass:meta' ;
3
3
@use ' ../theming/theming' ;
4
- @use ' ../style/focus-indicators' ;
4
+ @use ' ./private' ;
5
+
6
+ $_prefix : ' mat' ;
5
7
6
8
// stylelint-disable-next-line material/theme-mixin-api
7
9
@mixin color ($config-or-theme-or-color ) {
8
10
@if meta .type-of ($config-or-theme-or-color ) == ' color' {
9
- @include focus-indicators . private- customize-focus-indicators ((
11
+ @include private . customize-focus-indicators ((
10
12
border-color : $config-or-theme-or-color
11
- ), ' mat ' );
13
+ ), $_prefix );
12
14
}
13
15
@else {
14
16
$config : theming .get-color-config ($config-or-theme-or-color );
15
17
$border-color : theming .get-color-from-palette (map .get ($config , primary ));
16
- @include focus-indicators . private- customize-focus-indicators ((
18
+ @include private . customize-focus-indicators ((
17
19
border-color : $border-color
18
- ), ' mat ' );
20
+ ), $_prefix );
19
21
}
20
22
}
21
23
22
24
// stylelint-disable-next-line material/theme-mixin-api
23
25
@mixin theme ($theme-or-color-config-or-color ) {
24
26
@if meta .type-of ($theme-or-color-config-or-color ) == ' color' {
25
- @include focus-indicators . private- customize-focus-indicators ((
27
+ @include private . customize-focus-indicators ((
26
28
border-color : $theme-or-color-config-or-color
27
- ), ' mat ' );
29
+ ), $_prefix );
28
30
}
29
31
@else {
30
32
$theme : theming .private-legacy-get-theme ($theme-or-color-config-or-color );
Original file line number Diff line number Diff line change 1
1
@use ' sass:map' ;
2
- @use ' ../style/focus-indicators ' ;
2
+ @use ' ./private ' ;
3
3
4
4
@mixin strong-focus-indicators ($config : ()) {
5
5
// Default focus indicator config.
11
11
// Merge default config with user config.
12
12
$config : map .merge ($default-config , $config );
13
13
14
- @include focus-indicators . private- customize-focus-indicators ($config , ' mat' );
14
+ @include private . customize-focus-indicators ($config , ' mat' );
15
15
}
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ $default-border-color: transparent;
9
9
$default-border-radius : 4px ;
10
10
11
11
// Mixin that renders the focus indicator structural styles.
12
- @mixin private- structural-styling ($prefix ) {
12
+ @mixin structural-styling ($prefix ) {
13
13
.#{$prefix } -focus-indicator {
14
14
position : relative ;
15
15
@@ -45,7 +45,7 @@ $default-border-radius: 4px;
45
45
46
46
// Enable the indicator in high contrast mode.
47
47
@include cdk .high-contrast (active , off) {
48
- @include private- customize-focus-indicators ((display : block ), $prefix );
48
+ @include customize-focus-indicators ((display : block ), $prefix );
49
49
}
50
50
}
51
51
@@ -59,7 +59,7 @@ $default-border-radius: 4px;
59
59
}
60
60
61
61
// Mixin that dedups CSS variables for the strong-focus-indicators mixin.
62
- @mixin private- customize-focus-indicators ($config , $prefix ) {
62
+ @mixin customize-focus-indicators ($config , $prefix ) {
63
63
$border-style : map .get ($config , border-style );
64
64
$border-width : map .get ($config , border-width );
65
65
$border-radius : map .get ($config , border-radius );
Original file line number Diff line number Diff line change @@ -24,3 +24,5 @@ $theme: mat.define-light-theme((
24
24
@include mat .all-component-colors ($theme );
25
25
@include mat .core-theme ($theme );
26
26
@include mat .button-theme ($theme );
27
+ @include mat .strong-focus-indicators ();
28
+ @include mat .strong-focus-indicators-theme ($theme );
Original file line number Diff line number Diff line change 1
1
@use ' @angular/cdk' ;
2
2
3
3
@use ' ../core/style/layout-common' ;
4
- @use ' ../core/style/ focus-indicators' ;
4
+ @use ' ../core/focus-indicators/private ' ;
5
5
6
6
$calendar-padding : 8px !default ;
7
7
$calendar-header-divider-width : 1px !default ;
@@ -129,8 +129,7 @@ $calendar-next-icon-transform: translateX(-2px) rotate(45deg);
129
129
// For the calendar element, default inset/offset values are necessary to ensure that
130
130
// the focus indicator is sufficiently contrastive and renders appropriately.
131
131
.mat-calendar-body-cell-content ::before {
132
- $border-width :
133
- var (--mat-focus-indicator-border-width , #{focus-indicators .$default-border-width } );
132
+ $border-width : var (--mat-focus-indicator-border-width , #{private .$default-border-width } );
134
133
$offset : calc (#{$border-width } + 3px );
135
134
margin : calc (#{$offset } * -1 );
136
135
}
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ sass_binary(
48
48
name = "expansion_panel_scss" ,
49
49
src = "expansion-panel.scss" ,
50
50
deps = [
51
- "//src/cdk:sass_lib" ,
52
51
"//src/material/core:core_scss_lib" ,
53
52
],
54
53
)
You can’t perform that action at this time.
0 commit comments