-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(material-experimental/theming): add M3 select, option, and optgr…
…oup support (#28148) * feat(material-experimental/theming): add M3 select support * feat(material-experimental/theming): add M3 option & optgroup support (cherry picked from commit 0f3a55f)
- Loading branch information
Showing
8 changed files
with
263 additions
and
77 deletions.
There are no files selected for viewing
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
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
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
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
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,41 +1,72 @@ | ||
@use 'sass:map'; | ||
@use '../tokens/m2/mat/optgroup' as tokens-mat-optgroup; | ||
@use '../tokens/token-utils'; | ||
@use '../style/sass-utils'; | ||
|
||
@use '../theming/theming'; | ||
@use '../theming/inspection'; | ||
@use '../typography/typography'; | ||
|
||
@mixin base($theme) {} | ||
@mixin base($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); | ||
} | ||
@else {} | ||
} | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-optgroup.$prefix, | ||
tokens-mat-optgroup.get-color-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-optgroup.$prefix, | ||
tokens-mat-optgroup.get-color-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin typography($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-optgroup.$prefix, | ||
tokens-mat-optgroup.get-typography-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, typography)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-optgroup.$prefix, | ||
tokens-mat-optgroup.get-typography-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin density($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, density)); | ||
} | ||
@else {} | ||
} | ||
|
||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-optgroup') { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme)); | ||
} | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
@else { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
} | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin _theme-from-tokens($tokens) { | ||
@if ($tokens != ()) { | ||
@include token-utils.create-token-values( | ||
tokens-mat-optgroup.$prefix, map.get($tokens, tokens-mat-optgroup.$prefix)); | ||
} | ||
} |
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,51 +1,82 @@ | ||
@use 'sass:map'; | ||
@use '../tokens/m2/mat/option' as tokens-mat-option; | ||
@use '../tokens/token-utils'; | ||
@use '../style/sass-utils'; | ||
|
||
@use '../theming/theming'; | ||
@use '../theming/inspection'; | ||
@use '../typography/typography'; | ||
|
||
@mixin base($theme) {} | ||
@mixin base($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); | ||
} | ||
@else {} | ||
} | ||
|
||
@mixin color($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme)); | ||
} | ||
|
||
.mat-accent { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme, accent)); | ||
} | ||
.mat-accent { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme, accent)); | ||
} | ||
|
||
.mat-warn { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme, warn)); | ||
.mat-warn { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-color-tokens($theme, warn)); | ||
} | ||
} | ||
} | ||
|
||
@mixin typography($theme) { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-typography-tokens($theme)); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, typography)); | ||
} | ||
@else { | ||
@include sass-utils.current-selector-or-root() { | ||
@include token-utils.create-token-values(tokens-mat-option.$prefix, | ||
tokens-mat-option.get-typography-tokens($theme)); | ||
} | ||
} | ||
} | ||
|
||
@mixin density($theme) { | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme, density)); | ||
} | ||
@else {} | ||
} | ||
|
||
@mixin theme($theme) { | ||
@include theming.private-check-duplicate-theme-styles($theme, 'mat-option') { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
@if inspection.get-theme-version($theme) == 1 { | ||
@include _theme-from-tokens(inspection.get-theme-tokens($theme)); | ||
} | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
@else { | ||
@include base($theme); | ||
@if inspection.theme-has($theme, color) { | ||
@include color($theme); | ||
} | ||
@if inspection.theme-has($theme, density) { | ||
@include density($theme); | ||
} | ||
@if inspection.theme-has($theme, typography) { | ||
@include typography($theme); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@mixin _theme-from-tokens($tokens) { | ||
@if ($tokens != ()) { | ||
@include token-utils.create-token-values( | ||
tokens-mat-option.$prefix, map.get($tokens, tokens-mat-option.$prefix)); | ||
} | ||
} |
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
Oops, something went wrong.