Skip to content

Commit 06c81e3

Browse files
committed
fix(material-experimental/theming): fix paginator in M3
Fixes that the form field inside the paginator didn't have the proper density in M3. Also simplifies the setup a bit.
1 parent 935eda0 commit 06c81e3

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/material/paginator/_paginator-theme.scss

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@use 'sass:map';
22
@use 'sass:meta';
33
@use '../core/tokens/m2/mat/paginator' as tokens-mat-paginator;
4-
@use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field;
4+
@use '../form-field/form-field-theme';
55
@use '../core/style/sass-utils';
66
@use '../core/typography/typography';
77
@use '../core/theming/theming';
@@ -40,30 +40,24 @@
4040
}
4141

4242
@mixin density($theme) {
43+
$density-scale: inspection.get-theme-density($theme);
44+
$form-field-density: if((meta.type-of($density-scale) == 'number' and $density-scale >= -4) or
45+
$density-scale == maximum, -4, $density-scale);
46+
4347
@if inspection.get-theme-version($theme) == 1 {
4448
@include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
4549
}
4650
@else {
47-
$density-scale: inspection.get-theme-density($theme);
48-
4951
@include sass-utils.current-selector-or-root() {
5052
@include token-utils.create-token-values(tokens-mat-paginator.$prefix,
5153
tokens-mat-paginator.get-density-tokens($theme));
5254
}
55+
}
5356

54-
.mat-mdc-paginator {
55-
// We need the form field to be narrower in order to fit into the paginator,
56-
// so we set its density to be -4 or denser.
57-
@if ((meta.type-of($density-scale) == 'number' and $density-scale >= -4) or
58-
$density-scale == maximum) {
59-
@include token-utils.create-token-values(tokens-mat-form-field.$prefix,
60-
tokens-mat-form-field.get-density-tokens((density: -4)));
61-
}
62-
@else {
63-
@include token-utils.create-token-values(tokens-mat-form-field.$prefix,
64-
tokens-mat-form-field.get-density-tokens((density: $density-scale)));
65-
}
66-
}
57+
// We need the form field to be narrower in order to fit into the paginator,
58+
// so we set its density to be -4 or denser.
59+
.mat-mdc-paginator {
60+
@include form-field-theme.density((density: $form-field-density));
6761
}
6862
}
6963

0 commit comments

Comments
 (0)