1
1
@import ' ../theming/theming' ;
2
2
@import ' ../style/layout-common' ;
3
3
4
- // Focus indicator styles.
5
- $mat-focus-indicator-border-radius : 4px ;
6
- $mat-focus-indicator-border-width : 2px ;
7
- $mat-focus-indicator-border-style : solid ;
8
-
9
4
/// Mixin that turns on strong focus indicators.
10
5
///
11
6
/// @example
12
7
/// .my-app {
13
- /// @include mat-strong-focus-indicators();
8
+ /// @include mat-strong-focus-indicators($config );
14
9
/// }
15
- @mixin mat-strong-focus-indicators () {
10
+ @mixin mat-strong-focus-indicators ($config : ()) {
11
+ // Default focus indicator config.
12
+ $default-config : (
13
+ border-style : solid ,
14
+ border-width : 3px ,
15
+ border-radius : 4px ,
16
+ );
17
+
18
+ // Merge default config with user config.
19
+ $config : map-merge ($default-config , $config );
20
+ $border-style : map-get ($config , border-style );
21
+ $border-width : map-get ($config , border-width );
22
+ $border-radius : map-get ($config , border-radius );
16
23
17
- // Base styles for the focus indicators.
24
+ // Base styles for focus indicators.
18
25
.mat-focus-indicator ::before {
19
26
@include mat-fill ();
20
-
21
- border-radius : $mat-focus-indicator-border-radius ;
22
- border : $mat-focus-indicator-border-width $mat-focus-indicator-border-style transparent ;
23
27
box-sizing : border-box ;
24
28
pointer-events : none ;
29
+ border : $border-width $border-style transparent ;
30
+ border-radius : $border-radius ;
25
31
}
26
32
27
33
// By default, all focus indicators are flush with the bounding box of their
28
34
// host element. For particular elements (listed below), default inset/offset
29
35
// values are necessary to ensure that the focus indicator is sufficiently
30
36
// contrastive and renders appropriately.
31
37
32
- .mat-focus-indicator.mat-button-base ::before ,
33
- .mat-focus-indicator.mat-card ::before ,
38
+ .mat-focus-indicator.mat-flat-button ::before ,
39
+ .mat-focus-indicator.mat-raised-button ::before ,
40
+ .mat-focus-indicator.mat-fab ::before ,
41
+ .mat-focus-indicator.mat-mini-fab ::before ,
34
42
.mat-focus-indicator.mat-chip ::before ,
35
43
.mat-focus-indicator.mat-sort-header-button ::before {
36
- margin : $mat-focus-indicator-border-width * -2 ;
44
+ margin : - ($border-width + 2px );
45
+ }
46
+
47
+ .mat-focus-indicator.mat-stroked-button ::before {
48
+ margin : - ($border-width + 3px );
37
49
}
38
50
39
51
.mat-focus-indicator.mat-calendar-body-cell ::before {
40
- margin : $mat-focus-indicator- border-width * -1 ;
52
+ margin : - $ border-width ;
41
53
}
42
54
43
55
.mat-focus-indicator.mat-tab-link ::before ,
44
56
.mat-focus-indicator.mat-tab-label ::before {
45
- margin : $mat-focus-indicator-border-width * 2 ;
57
+ margin : 5 px ;
46
58
}
47
59
48
60
// Render the focus indicator on focus. Defining a pseudo element's
@@ -66,24 +78,24 @@ $mat-focus-indicator-border-style: solid;
66
78
67
79
/// Mixin that sets the color of the focus indicators.
68
80
///
69
- /// @param {color|map} $themeOrMap
81
+ /// @param {color|map} $theme-or-color
70
82
/// If theme, focus indicators are set to the primary color of the theme. If
71
83
/// color, focus indicators are set to that color.
72
84
///
73
85
/// @example
74
86
/// .demo-dark-theme {
75
- /// @include mat-strong-focus-indicators-theme($darkThemeMap );
87
+ /// @include mat-strong-focus-indicators-theme($dark-theme-map );
76
88
/// }
77
89
///
78
90
/// @example
79
91
/// .demo-red-theme {
80
- /// @include mat-strong-focus-indicators-theme(#F00 );
92
+ /// @include mat-strong-focus-indicators-theme(#f00 );
81
93
/// }
82
- @mixin mat-strong-focus-indicators-theme ($themeOrColor ) {
94
+ @mixin mat-strong-focus-indicators-theme ($theme-or-color ) {
83
95
.mat-focus-indicator ::before {
84
96
border-color : if (
85
- type-of ($themeOrColor ) == ' map' ,
86
- mat-color (map_get ($themeOrColor , primary )),
87
- $themeOrColor );
97
+ type-of ($theme-or-color ) == ' map' ,
98
+ mat-color (map_get ($theme-or-color , primary )),
99
+ $theme-or-color );
88
100
}
89
101
}
0 commit comments