Skip to content

Commit

Permalink
fix(material/core): require theme for option typography (#29416)
Browse files Browse the repository at this point in the history
Removes the fallback for generating typography tokens for `mat-option` and `mat-optgroup` even if there's no theme. This isn't a supported configuration and the previous setup was temporary.

(cherry picked from commit b116643)
  • Loading branch information
crisbeto committed Jul 11, 2024
1 parent 09f99fd commit 57cc0b0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions src/material/core/tokens/m2/mat/_optgroup.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@use '../../token-utils';
@use '../../../theming/inspection';
@use '../../../style/sass-utils';
@use '../../../mdc-helpers/mdc-helpers';

// The prefix used to generate the fully qualified name for tokens in this file.
$prefix: (mat, optgroup);
Expand All @@ -21,14 +20,6 @@ $prefix: (mat, optgroup);

// Tokens that can be configured through Angular Material's typography theming API.
@function get-typography-tokens($theme) {
// TODO(crisbeto): The earlier implementation of the option used MDC's APIs to create the
// typography tokens. As a result, we unintentionally allowed `null` typography configs to be
// passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
// fallback.
@if ($theme == null) {
$theme: mdc-helpers.private-fallback-typography-from-mdc();
}

@return (
label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
Expand Down
9 changes: 0 additions & 9 deletions src/material/core/tokens/m2/mat/_option.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@use '../../token-utils';
@use '../../../theming/inspection';
@use '../../../style/sass-utils';
@use '../../../mdc-helpers/mdc-helpers';

// The prefix used to generate the fully qualified name for tokens in this file.
$prefix: (mat, option);
Expand Down Expand Up @@ -29,14 +28,6 @@ $prefix: (mat, option);

// Tokens that can be configured through Angular Material's typography theming API.
@function get-typography-tokens($theme) {
// TODO(crisbeto): The earlier implementation of the option used MDC's APIs to create the
// typography tokens. As a result, we unintentionally allowed `null` typography configs to be
// passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
// fallback.
@if ($theme == null) {
$theme: mdc-helpers.private-fallback-typography-from-mdc();
}

@return (
label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
Expand Down

0 comments on commit 57cc0b0

Please sign in to comment.