@@ -217,37 +217,55 @@ $mat-typography-level-mappings: (
217217///
218218/// @example
219219/// .my-app {
220- /// @include mat-mdc-strong-focus-indicators();
220+ /// @include mat-mdc-strong-focus-indicators($config );
221221/// }
222- @mixin mat-mdc-strong-focus-indicators () {
223- // Base styles for the focus indicators.
222+ @mixin mat-mdc-strong-focus-indicators ($config : ()) {
223+ // Default focus indicator config.
224+ $default-config : (
225+ border-style : solid ,
226+ border-width : 3px ,
227+ border-radius : 4px ,
228+ );
229+
230+ // Merge default config with user config.
231+ $config : map-merge ($default-config , $config );
232+ $border-style : map-get ($config , border-style );
233+ $border-width : map-get ($config , border-width );
234+ $border-radius : map-get ($config , border-radius );
235+
236+ // Base styles for focus indicators.
224237 .mat-mdc-focus-indicator ::before {
225238 @include mat-fill ();
226-
227- border-radius : $mat-focus-indicator-border-radius ;
228- border : $mat-focus-indicator-border-width $mat-focus-indicator-border-style transparent ;
229239 box-sizing : border-box ;
230240 pointer-events : none ;
241+ border : $border-width $border-style transparent ;
242+ border-radius : $border-radius ;
231243 }
232244
233245 // By default, all focus indicators are flush with the bounding box of their
234246 // host element. For particular elements (listed below), default inset/offset
235247 // values are necessary to ensure that the focus indicator is sufficiently
236248 // contrastive and renders appropriately.
237249
238- .mat-mdc-button-base .mat-mdc-focus-indicator ::before ,
250+ .mat-mdc-unelevated-button .mat-mdc-focus-indicator ::before ,
251+ .mat-mdc-raised-button .mat-mdc-focus-indicator ::before ,
252+ .mdc-fab .mat-mdc-focus-indicator ::before ,
239253 .mat-mdc-focus-indicator.mdc-chip ::before {
240- margin : $mat-focus-indicator-border-width * -2 ;
254+ margin : - ($border-width + 2px );
255+ }
256+
257+ .mat-mdc-outlined-button .mat-mdc-focus-indicator ::before {
258+ margin : - ($border-width + 3px );
241259 }
242260
243261 .mat-mdc-focus-indicator.mat-mdc-chip-remove ::before ,
244262 .mat-mdc-focus-indicator.mat-chip-row-focusable-text-content ::before {
245- margin : $mat-focus-indicator- border-width * -1 ;
263+ margin : - $ border-width ;
246264 }
247265
248266 .mat-mdc-focus-indicator.mat-mdc-tab ::before ,
249267 .mat-mdc-focus-indicator.mat-mdc-tab-link ::before {
250- margin : $mat-focus-indicator-border-width * 2 ;
268+ margin : 5 px ;
251269 }
252270
253271 // Render the focus indicator on focus. Defining a pseudo element's
@@ -258,6 +276,8 @@ $mat-typography-level-mappings: (
258276 .mdc-checkbox__native-control :focus ~ .mat-mdc-focus-indicator ::before ,
259277 .mat-mdc-slide-toggle-focused .mat-mdc-focus-indicator ::before ,
260278 .mat-mdc-radio-button.cdk-focused .mat-mdc-focus-indicator ::before ,
279+
280+ // For buttons, render the focus indicator when the parent button is focused.
261281 .mat-mdc-button-base :focus .mat-mdc-focus-indicator ::before ,
262282
263283 // For all other components, render the focus indicator on focus.
@@ -268,24 +288,24 @@ $mat-typography-level-mappings: (
268288
269289/// Mixin that sets the color of the focus indicators.
270290///
271- /// @param {color|map} $themeOrMap
291+ /// @param {color|map} $theme-or-color
272292/// If theme, focus indicators are set to the primary color of the theme. If
273293/// color, focus indicators are set to that color.
274294///
275295/// @example
276296/// .demo-dark-theme {
277- /// @include mat-mdc-strong-focus-indicators-theme($darkThemeMap );
297+ /// @include mat-mdc-strong-focus-indicators-theme($dark-theme-map );
278298/// }
279299///
280300/// @example
281301/// .demo-red-theme {
282- /// @include mat-mdc-strong-focus-indicators-theme(#F00 );
302+ /// @include mat-mdc-strong-focus-indicators-theme(#f00 );
283303/// }
284- @mixin mat-mdc-strong-focus-indicators-theme ($themeOrColor ) {
304+ @mixin mat-mdc-strong-focus-indicators-theme ($theme-or-color ) {
285305 .mat-mdc-focus-indicator ::before {
286306 border-color : if (
287- type-of ($themeOrColor ) == ' map' ,
288- mat-color (map_get ($themeOrColor , primary )),
289- $themeOrColor );
307+ type-of ($theme-or-color ) == ' map' ,
308+ mat-color (map_get ($theme-or-color , primary )),
309+ $theme-or-color );
290310 }
291311}
0 commit comments