-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/core): Focus indicator theme and color mixins should acc…
…ept a basic color as well. (#23016) fix(core/material): Disable styelint for focus indicator theme mixins.
- Loading branch information
Showing
4 changed files
with
58 additions
and
24 deletions.
There are no files selected for viewing
38 changes: 27 additions & 11 deletions
38
src/material-experimental/mdc-helpers/_focus-indicators-theme.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
@use 'sass:map'; | ||
@use 'sass:meta'; | ||
@use '../../material/core/theming/theming'; | ||
|
||
@mixin color($config-or-theme) { | ||
$config: theming.get-color-config($config-or-theme); | ||
$border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
|
||
@mixin _border-color($color) { | ||
.mat-mdc-focus-indicator::before { | ||
border-color: $border-color; | ||
border-color: $color; | ||
} | ||
} | ||
|
||
// stylelint-disable-next-line material/theme-mixin-api | ||
@mixin color($config-or-theme-or-color) { | ||
@if meta.type-of($config-or-theme-or-color) == 'color' { | ||
@include _border-color($config-or-theme-or-color); | ||
} | ||
@else { | ||
$config: theming.get-color-config($config-or-theme-or-color); | ||
$border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
@include _border-color($border-color); | ||
} | ||
} | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-focus-indicators') { | ||
$color: theming.get-color-config($theme); | ||
@if $color != null { | ||
@include color($color); | ||
// stylelint-disable-next-line material/theme-mixin-api | ||
@mixin theme($theme-or-color-config-or-color) { | ||
@if meta.type-of($theme-or-color-config-or-color) == 'color' { | ||
@include _border-color($theme-or-color-config-or-color); | ||
} | ||
@else { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config-or-color); | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-focus-indicators') { | ||
$color: theming.get-color-config($theme); | ||
@if $color != null { | ||
@include color($color); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 27 additions & 11 deletions
38
src/material/core/focus-indicators/_focus-indicators-theme.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
@use 'sass:map'; | ||
@use 'sass:meta'; | ||
@use '../theming/theming'; | ||
|
||
@mixin color($config-or-theme) { | ||
$config: theming.get-color-config($config-or-theme); | ||
$border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
|
||
@mixin _border-color($color) { | ||
.mat-focus-indicator::before { | ||
border-color: $border-color; | ||
border-color: $color; | ||
} | ||
} | ||
|
||
// stylelint-disable-next-line material/theme-mixin-api | ||
@mixin color($config-or-theme-or-color) { | ||
@if meta.type-of($config-or-theme-or-color) == 'color' { | ||
@include _border-color($config-or-theme-or-color); | ||
} | ||
@else { | ||
$config: theming.get-color-config($config-or-theme-or-color); | ||
$border-color: theming.get-color-from-palette(map.get($config, primary)); | ||
@include _border-color($border-color); | ||
} | ||
} | ||
|
||
@mixin theme($theme-or-color-config) { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config); | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-focus-indicators') { | ||
$color: theming.get-color-config($theme); | ||
@if $color != null { | ||
@include color($color); | ||
// stylelint-disable-next-line material/theme-mixin-api | ||
@mixin theme($theme-or-color-config-or-color) { | ||
@if meta.type-of($theme-or-color-config-or-color) == 'color' { | ||
@include _border-color($theme-or-color-config-or-color); | ||
} | ||
@else { | ||
$theme: theming.private-legacy-get-theme($theme-or-color-config-or-color); | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-focus-indicators') { | ||
$color: theming.get-color-config($theme); | ||
@if $color != null { | ||
@include color($color); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters