@angular/material 16.2.0-next.5 → 16.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/bottom-sheet/index.d.ts +6 -0
  2. package/core/selection/pseudo-checkbox/_pseudo-checkbox-common.scss +1 -1
  3. package/core/tokens/m2/mat/_form-field.scss +72 -0
  4. package/core/tokens/m2/mat/_grid-list.scss +46 -0
  5. package/core/tokens/m2/mat/_icon.scss +45 -0
  6. package/core/tokens/m2/mat/_slide-toggle.scss +1 -1
  7. package/core/tokens/m2/mat/_tab-header.scss +1 -1
  8. package/core/tokens/m2/mdc/_circular-progress.scss +1 -1
  9. package/core/tokens/m2/mdc/_filled-text-field.scss +175 -0
  10. package/core/tokens/m2/mdc/_outlined-text-field.scss +158 -0
  11. package/core/tokens/m2/mdc/_plain-tooltip.scss +2 -2
  12. package/dialog/index.d.ts +6 -0
  13. package/esm2022/autocomplete/autocomplete-trigger.mjs +7 -2
  14. package/esm2022/bottom-sheet/bottom-sheet-ref.mjs +8 -1
  15. package/esm2022/chips/chip-option.mjs +9 -3
  16. package/esm2022/core/version.mjs +1 -1
  17. package/esm2022/dialog/dialog-ref.mjs +1 -1
  18. package/esm2022/dialog/dialog.mjs +2 -1
  19. package/esm2022/form-field/form-field.mjs +3 -3
  20. package/esm2022/grid-list/grid-list.mjs +2 -2
  21. package/esm2022/grid-list/grid-tile.mjs +2 -2
  22. package/esm2022/icon/icon.mjs +2 -2
  23. package/esm2022/slide-toggle/slide-toggle.mjs +2 -2
  24. package/esm2022/slider/slider-input.mjs +21 -5
  25. package/esm2022/slider/slider-interface.mjs +1 -1
  26. package/esm2022/slider/slider-thumb.mjs +2 -10
  27. package/esm2022/slider/slider.mjs +20 -12
  28. package/esm2022/tabs/ink-bar.mjs +1 -1
  29. package/esm2022/tabs/tab-group.mjs +2 -2
  30. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +2 -2
  31. package/fesm2022/autocomplete.mjs +6 -1
  32. package/fesm2022/autocomplete.mjs.map +1 -1
  33. package/fesm2022/bottom-sheet.mjs +7 -0
  34. package/fesm2022/bottom-sheet.mjs.map +1 -1
  35. package/fesm2022/chips.mjs +8 -2
  36. package/fesm2022/chips.mjs.map +1 -1
  37. package/fesm2022/core.mjs +1 -1
  38. package/fesm2022/core.mjs.map +1 -1
  39. package/fesm2022/dialog.mjs +1 -0
  40. package/fesm2022/dialog.mjs.map +1 -1
  41. package/fesm2022/form-field.mjs +2 -2
  42. package/fesm2022/form-field.mjs.map +1 -1
  43. package/fesm2022/grid-list.mjs +4 -4
  44. package/fesm2022/grid-list.mjs.map +1 -1
  45. package/fesm2022/icon.mjs +2 -2
  46. package/fesm2022/icon.mjs.map +1 -1
  47. package/fesm2022/slide-toggle.mjs +2 -2
  48. package/fesm2022/slide-toggle.mjs.map +1 -1
  49. package/fesm2022/slider.mjs +40 -24
  50. package/fesm2022/slider.mjs.map +1 -1
  51. package/fesm2022/tabs.mjs +4 -4
  52. package/fesm2022/tabs.mjs.map +1 -1
  53. package/form-field/_form-field-subscript.scss +11 -9
  54. package/form-field/_form-field-theme.scss +34 -70
  55. package/form-field/_mdc-text-field-structure-overrides.scss +18 -0
  56. package/grid-list/_grid-list-theme.scss +7 -6
  57. package/icon/_icon-theme.scss +18 -8
  58. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  59. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  60. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  61. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  62. package/package.json +54 -54
  63. package/prebuilt-themes/deeppurple-amber.css +1 -1
  64. package/prebuilt-themes/indigo-pink.css +1 -1
  65. package/prebuilt-themes/pink-bluegrey.css +1 -1
  66. package/prebuilt-themes/purple-green.css +1 -1
  67. package/schematics/ng-add/index.js +2 -2
  68. package/schematics/ng-add/index.mjs +2 -2
  69. package/slider/index.d.ts +8 -5
  70. package/tabs/_tabs-common.scss +1 -1
  71. package/tabs/index.d.ts +1 -1
@@ -3,8 +3,8 @@
3
3
  @use '@material/typography' as mdc-typography;
4
4
  @use '@material/textfield/variables' as mdc-textfield-variables;
5
5
 
6
- @use '../core/theming/theming';
7
- @use '../core/mdc-helpers/mdc-helpers';
6
+ @use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field;
7
+ @use '../core/tokens/token-utils';
8
8
  @use './form-field-sizing';
9
9
 
10
10
  @mixin private-form-field-subscript() {
@@ -66,17 +66,19 @@
66
66
  .mat-mdc-form-field-error {
67
67
  @include mdc-theme.prop(color, mdc-textfield.$error);
68
68
  }
69
- }
70
-
71
- // We need to define our own typography for the subscript because we don't include MDC's
72
- // helper text in our MDC based form field
73
- @mixin private-form-field-subscript-typography($config-or-theme) {
74
- $config: theming.get-typography-config($config-or-theme);
75
69
 
76
70
  // The subscript wrapper has a minimum height to avoid that the form-field
77
71
  // jumps when hints or errors are displayed.
78
72
  .mat-mdc-form-field-subscript-wrapper,
79
73
  .mat-mdc-form-field-bottom-align::before {
80
- @include mdc-typography.typography(caption, $query: mdc-helpers.$mdc-typography-styles-query);
74
+ @include token-utils.use-tokens(tokens-mat-form-field.$prefix,
75
+ tokens-mat-form-field.get-token-slots()) {
76
+ @include mdc-typography.smooth-font();
77
+ @include token-utils.create-token-slot(font-family, subscript-text-font);
78
+ @include token-utils.create-token-slot(line-height, subscript-text-line-height);
79
+ @include token-utils.create-token-slot(font-size, subscript-text-size);
80
+ @include token-utils.create-token-slot(letter-spacing, subscript-text-tracking);
81
+ @include token-utils.create-token-slot(font-weight, subscript-text-weight);
82
+ }
81
83
  }
82
84
  }
@@ -1,63 +1,50 @@
1
- @use '@material/textfield' as mdc-textfield;
2
- @use '@material/floating-label' as mdc-floating-label;
3
- @use '@material/notched-outline' as mdc-notched-outline;
4
- @use '@material/line-ripple' as mdc-line-ripple;
5
- @use '@material/theme/theme-color' as mdc-theme-color;
6
- @use '@material/typography/typography' as mdc-typography;
1
+ @use '@material/textfield/filled-text-field-theme' as mdc-filled-text-field-theme;
2
+ @use '@material/textfield/outlined-text-field-theme' as mdc-outlined-text-field-theme;
7
3
 
4
+ @use '../core/tokens/m2/mdc/filled-text-field' as tokens-mdc-filled-text-field;
5
+ @use '../core/tokens/m2/mdc/outlined-text-field' as tokens-mdc-outlined-text-field;
6
+ @use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field;
8
7
  @use '../core/theming/theming';
9
8
  @use '../core/typography/typography';
10
9
  @use '../core/mdc-helpers/mdc-helpers';
10
+ @use '../core/style/sass-utils';
11
+ @use '../core/tokens/token-utils';
11
12
  @use './form-field-density';
12
13
  @use './form-field-subscript';
13
14
  @use './form-field-focus-overlay';
14
15
  @use './form-field-native-select';
15
16
  @use './mdc-text-field-theme-variable-refresh';
16
17
 
18
+ @mixin color($config-or-theme) {
19
+ $config: theming.get-color-config($config-or-theme);
17
20
 
18
- // Mixin that overwrites the default MDC text-field color styles to be based on
19
- // the given theme palette. The MDC text-field is styled using `primary` by default.
20
- @mixin _color-styles($palette-name,
21
- $query: mdc-helpers.$mdc-theme-styles-query) {
22
- $orig-focused-label-color: mdc-textfield.$focused-label-color;
23
- mdc-textfield.$focused-label-color: rgba(mdc-theme-color.prop-value($palette-name), 0.87);
24
-
25
- @include mdc-textfield.caret-color($palette-name, $query);
26
- @include mdc-textfield.line-ripple-color($palette-name, $query);
27
-
28
- .mdc-text-field--focused {
29
- @include mdc-textfield.focused_($query);
30
- }
31
-
32
- .mdc-text-field--invalid {
33
- @include mdc-textfield.invalid_($query);
34
- }
35
-
36
- .mdc-text-field--outlined {
37
- @include mdc-textfield.focused-outline-color($palette-name, $query);
21
+ @include sass-utils.current-selector-or-root() {
22
+ @include mdc-filled-text-field-theme.theme(
23
+ tokens-mdc-filled-text-field.get-color-tokens($config));
24
+ @include mdc-outlined-text-field-theme.theme(
25
+ tokens-mdc-outlined-text-field.get-color-tokens($config));
26
+ @include token-utils.create-token-values(tokens-mat-form-field.$prefix,
27
+ tokens-mat-form-field.get-color-tokens($config));
38
28
  }
39
29
 
40
- mdc-textfield.$focused-label-color: $orig-focused-label-color;
41
- }
42
-
43
- @mixin color($config-or-theme) {
44
- $config: theming.get-color-config($config-or-theme);
45
30
  @include mdc-helpers.using-mdc-theme($config) {
46
31
  @include mdc-text-field-theme-variable-refresh.private-text-field-refresh-theme-variables() {
47
- @include mdc-textfield.without-ripple($query: mdc-helpers.$mdc-theme-styles-query);
48
- @include mdc-floating-label.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
49
- @include mdc-notched-outline.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
50
- @include mdc-line-ripple.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
51
32
  @include form-field-subscript.private-form-field-subscript-color();
52
33
  @include form-field-focus-overlay.private-form-field-focus-overlay-color();
53
34
  @include form-field-native-select.private-form-field-native-select-color($config);
54
35
 
55
36
  .mat-mdc-form-field.mat-accent {
56
- @include _color-styles(secondary);
37
+ @include mdc-filled-text-field-theme.theme(
38
+ tokens-mdc-filled-text-field.private-get-color-palette-color-tokens($config, accent));
39
+ @include mdc-outlined-text-field-theme.theme(
40
+ tokens-mdc-outlined-text-field.private-get-color-palette-color-tokens($config, accent));
57
41
  }
58
42
 
59
43
  .mat-mdc-form-field.mat-warn {
60
- @include _color-styles(error);
44
+ @include mdc-filled-text-field-theme.theme(
45
+ tokens-mdc-filled-text-field.private-get-color-palette-color-tokens($config, warn));
46
+ @include mdc-outlined-text-field-theme.theme(
47
+ tokens-mdc-outlined-text-field.private-get-color-palette-color-tokens($config, warn));
61
48
  }
62
49
 
63
50
  // This fixes an issue where the notch appears to be thicker than the rest of the outline when
@@ -68,15 +55,16 @@
68
55
  // Note: class name is repeated to achieve sufficient specificity over the various MDC states.
69
56
  // (hover, focus, etc.)
70
57
  // TODO(mmalerba): port this fix into MDC
58
+ // TODO(crisbeto): move this into the structural styles
71
59
  .mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field {
72
- &.mat-mdc-form-field .mdc-notched-outline__notch {
60
+ &.mat-mdc-form-field.mat-mdc-form-field .mdc-notched-outline__notch {
73
61
  border-left: 1px solid transparent;
74
62
  }
75
63
  }
76
64
 
77
65
  [dir='rtl'] {
78
66
  .mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field.mat-mdc-form-field {
79
- &.mat-mdc-form-field .mdc-notched-outline__notch {
67
+ &.mat-mdc-form-field.mat-mdc-form-field .mdc-notched-outline__notch {
80
68
  border-left: none;
81
69
  border-right: 1px solid transparent;
82
70
  }
@@ -89,38 +77,14 @@
89
77
  @mixin typography($config-or-theme) {
90
78
  $config: typography.private-typography-to-2018-config(
91
79
  theming.get-typography-config($config-or-theme));
92
- @include mdc-helpers.using-mdc-typography($config) {
93
- @include mdc-textfield.without-ripple($query: mdc-helpers.$mdc-typography-styles-query);
94
- @include mdc-floating-label.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
95
- @include mdc-notched-outline.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
96
- @include mdc-line-ripple.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
97
- @include form-field-subscript.private-form-field-subscript-typography($config);
98
-
99
- // MDC uses `subtitle1` for the input value, placeholder and floating label. The spec
100
- // shows `body1` for text fields though, so we manually override the typography.
101
- // Note: Form controls inherit the typography from the parent form field.
102
- .mat-mdc-form-field,
103
- .mat-mdc-floating-label {
104
- @include mdc-typography.typography(body1, $query: mdc-helpers.$mdc-typography-styles-query);
105
- }
106
80
 
107
- // Above, we updated the floating label to use the `body1` typography level. The MDC notched
108
- // outline overrides this accidentally (only when the label floats) to a `rem`-based value.
109
- // This results in different label widths when floated/docked and ultimately breaks the notch
110
- // width as it has been measured in the docked state (where `body1` is applied). We try to
111
- // unset these styles set by the `mdc-notched-outline`:
112
- // https://github.com/material-components/material-components-web/blob/master/packages/mdc-notched-outline/_mixins.scss#L272-L292.
113
- .mat-mdc-form-field .mdc-text-field--outlined {
114
- // For the non-upgraded notch label (i.e. when rendered on the server), also
115
- // use the correct `body1` typography level.
116
- .mdc-floating-label--float-above {
117
- font-size: calc(#{
118
- mdc-typography.get-size(body1)} * var(--mat-mdc-form-field-floating-label-scale, 0.75));
119
- }
120
- .mdc-notched-outline--upgraded .mdc-floating-label--float-above {
121
- font-size: mdc-typography.get-size(body1);
122
- }
123
- }
81
+ @include sass-utils.current-selector-or-root() {
82
+ @include mdc-filled-text-field-theme.theme(
83
+ tokens-mdc-filled-text-field.get-typography-tokens($config));
84
+ @include mdc-outlined-text-field-theme.theme(
85
+ tokens-mdc-outlined-text-field.get-typography-tokens($config));
86
+ @include token-utils.create-token-values(tokens-mat-form-field.$prefix,
87
+ tokens-mat-form-field.get-typography-tokens($config));
124
88
  }
125
89
  }
126
90
 
@@ -1,4 +1,8 @@
1
1
  @use '@material/textfield/variables' as mdc-textfield-variables;
2
+ @use '@material/typography/typography' as mdc-typography;
3
+ @use '../core/tokens/m2/mat/form-field' as tokens-mat-form-field;
4
+ @use '../core/tokens/token-utils';
5
+ @use '../core/style/vendor-prefixes';
2
6
 
3
7
  // Mixin that can be included to override the default MDC text-field
4
8
  // styles to fit our needs. See individual comments for context on why
@@ -13,6 +17,7 @@
13
17
  // Note: We increase specificity here because the MDC textfield seems to override this,
14
18
  // depending on the CSS order, with an affix selector joint with the input.
15
19
  .mat-mdc-form-field-input-control.mat-mdc-form-field-input-control {
20
+ @include mdc-typography.smooth-font();
16
21
  font: inherit;
17
22
  letter-spacing: inherit;
18
23
  text-decoration: inherit;
@@ -21,6 +26,8 @@
21
26
  }
22
27
 
23
28
  .mat-mdc-form-field .mat-mdc-floating-label.mdc-floating-label {
29
+ @include mdc-typography.smooth-font();
30
+
24
31
  // In order to ensure proper alignment of the floating label, we reset its line-height.
25
32
  // The line-height is not important as the element is absolutely positioned and only has one
26
33
  // line of text.
@@ -86,6 +93,17 @@
86
93
  }
87
94
  }
88
95
 
96
+ // Before the switch to the tokens MDC was setting a specific placeholder color when the input
97
+ // is disabled, but now there's no token for it so we need to implement it ourselves.
98
+ .mat-form-field-disabled .mdc-text-field__input {
99
+ @include vendor-prefixes.input-placeholder {
100
+ @include token-utils.use-tokens(
101
+ tokens-mat-form-field.$prefix, tokens-mat-form-field.get-token-slots()) {
102
+ @include token-utils.create-token-slot(color, disabled-input-text-placeholder-color);
103
+ }
104
+ }
105
+ }
106
+
89
107
  // The default MDC text-field implementation does not support labels which always float.
90
108
  // MDC only renders the placeholder if the input is focused. We extend this to show the
91
109
  // placeholder if the form-field label is set to always float.
@@ -1,7 +1,8 @@
1
1
  @use '../core/theming/theming';
2
2
  @use '../core/typography/typography';
3
- @use '../core/typography/typography-utils';
4
- @use '../core/style/list-common';
3
+ @use '../core/tokens/m2/mat/grid-list' as tokens-mat-grid-list;
4
+ @use '../core/style/sass-utils';
5
+ @use '../core/tokens/token-utils';
5
6
 
6
7
 
7
8
  // Include this empty mixin for consistency with the other components.
@@ -10,10 +11,10 @@
10
11
  @mixin typography($config-or-theme) {
11
12
  $config: typography.private-typography-to-2014-config(
12
13
  theming.get-typography-config($config-or-theme));
13
- .mat-grid-tile-header,
14
- .mat-grid-tile-footer {
15
- @include list-common.base(typography-utils.font-size($config, caption));
16
- font-size: typography-utils.font-size($config, body-1);
14
+
15
+ @include sass-utils.current-selector-or-root() {
16
+ @include token-utils.create-token-values(tokens-mat-grid-list.$prefix,
17
+ tokens-mat-grid-list.get-typography-tokens($config));
17
18
  }
18
19
  }
19
20
 
@@ -1,25 +1,35 @@
1
1
  @use 'sass:map';
2
2
  @use '../core/theming/theming';
3
+ @use '../core/tokens/m2/mat/icon' as tokens-mat-icon;
4
+ @use '../core/tokens/token-utils';
5
+ @use '../core/style/sass-utils';
6
+
7
+ @mixin _palette-colors($config, $palette-name) {
8
+ $palette: map.get($config, $palette-name);
9
+ $color: theming.get-color-from-palette($palette, text);
10
+ $tokens: tokens-mat-icon.private-get-icon-color-tokens($color);
11
+ @include token-utils.create-token-values(tokens-mat-icon.$prefix, $tokens);
12
+ }
3
13
 
4
14
  @mixin color($config-or-theme) {
5
15
  $config: theming.get-color-config($config-or-theme);
6
- $primary: map.get($config, primary);
7
- $accent: map.get($config, accent);
8
- $warn: map.get($config, warn);
9
- $background: map.get($config, background);
10
- $foreground: map.get($config, foreground);
16
+
17
+ @include sass-utils.current-selector-or-root() {
18
+ @include token-utils.create-token-values(tokens-mat-icon.$prefix,
19
+ tokens-mat-icon.get-color-tokens($config));
20
+ }
11
21
 
12
22
  .mat-icon {
13
23
  &.mat-primary {
14
- color: theming.get-color-from-palette($primary, text);
24
+ @include _palette-colors($config, primary);
15
25
  }
16
26
 
17
27
  &.mat-accent {
18
- color: theming.get-color-from-palette($accent, text);
28
+ @include _palette-colors($config, accent);
19
29
  }
20
30
 
21
31
  &.mat-warn {
22
- color: theming.get-color-from-palette($warn, text);
32
+ @include _palette-colors($config, warn);
23
33
  }
24
34
  }
25
35
  }