@angular/material 16.2.0-next.3 → 16.2.0-next.5

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 (120) hide show
  1. package/autocomplete/index.d.ts +34 -4
  2. package/badge/_badge-theme.scss +84 -118
  3. package/bottom-sheet/_bottom-sheet-theme.scss +10 -11
  4. package/button/_fab-theme.scss +70 -43
  5. package/button-toggle/_button-toggle-theme.scss +20 -97
  6. package/button-toggle/_button-toggle-variables.scss +2 -0
  7. package/card/_card-theme.scss +20 -4
  8. package/checkbox/_checkbox-theme.scss +5 -3
  9. package/chips/index.d.ts +11 -4
  10. package/core/index.d.ts +3 -2
  11. package/core/tokens/_token-utils.scss +2 -0
  12. package/core/tokens/m2/mat/_badge.scss +78 -0
  13. package/core/tokens/m2/mat/_bottom-sheet.scss +56 -0
  14. package/core/tokens/m2/mat/_datepicker.scss +184 -0
  15. package/core/tokens/m2/mat/_divider.scss +45 -0
  16. package/core/tokens/m2/mat/_expansion.scss +90 -0
  17. package/core/tokens/m2/mat/_legacy-button-toggle.scss +63 -0
  18. package/core/tokens/m2/mat/_sidenav.scss +65 -0
  19. package/core/tokens/m2/mat/_standard-button-toggle.scss +87 -0
  20. package/core/tokens/m2/mat/_toolbar.scss +79 -0
  21. package/core/tokens/m2/mdc/_extended-fab.scss +88 -0
  22. package/core/tokens/m2/mdc/_fab.scss +89 -0
  23. package/datepicker/_datepicker-theme.scss +44 -203
  24. package/divider/_divider-theme.scss +6 -8
  25. package/esm2022/autocomplete/autocomplete-trigger.mjs +85 -38
  26. package/esm2022/autocomplete/autocomplete.mjs +25 -4
  27. package/esm2022/bottom-sheet/bottom-sheet-container.mjs +3 -3
  28. package/esm2022/button/fab.mjs +8 -8
  29. package/esm2022/button-toggle/button-toggle.mjs +2 -2
  30. package/esm2022/chips/chip-option.mjs +4 -5
  31. package/esm2022/chips/chip-row.mjs +15 -10
  32. package/esm2022/chips/chip.mjs +29 -12
  33. package/esm2022/core/option/option.mjs +9 -5
  34. package/esm2022/core/private/ripple-loader.mjs +4 -1
  35. package/esm2022/core/version.mjs +1 -1
  36. package/esm2022/datepicker/calendar-body.mjs +2 -2
  37. package/esm2022/datepicker/calendar.mjs +2 -2
  38. package/esm2022/datepicker/date-range-input.mjs +2 -2
  39. package/esm2022/datepicker/datepicker-base.mjs +3 -3
  40. package/esm2022/datepicker/datepicker-toggle.mjs +2 -2
  41. package/esm2022/divider/divider.mjs +2 -2
  42. package/esm2022/expansion/expansion-animations.mjs +5 -2
  43. package/esm2022/expansion/expansion-panel-header.mjs +3 -3
  44. package/esm2022/expansion/expansion-panel.mjs +3 -3
  45. package/esm2022/form-field/form-field.mjs +3 -3
  46. package/esm2022/legacy-autocomplete/autocomplete.mjs +2 -1
  47. package/esm2022/legacy-dialog/testing/dialog-opener.mjs +6 -1
  48. package/esm2022/legacy-menu/menu.mjs +4 -2
  49. package/esm2022/legacy-table/text-column.mjs +6 -2
  50. package/esm2022/legacy-tabs/tab.mjs +6 -3
  51. package/esm2022/legacy-tooltip/tooltip.mjs +5 -2
  52. package/esm2022/menu/menu-item.mjs +4 -4
  53. package/esm2022/menu/menu.mjs +3 -3
  54. package/esm2022/radio/radio.mjs +13 -1
  55. package/esm2022/sidenav/drawer.mjs +3 -3
  56. package/esm2022/sidenav/sidenav.mjs +3 -3
  57. package/esm2022/slide-toggle/slide-toggle.mjs +2 -2
  58. package/esm2022/toolbar/toolbar.mjs +2 -2
  59. package/expansion/_expansion-legacy-index.scss +0 -1
  60. package/expansion/_expansion-theme.import.scss +0 -2
  61. package/expansion/_expansion-theme.scss +12 -68
  62. package/fesm2022/autocomplete.mjs +109 -41
  63. package/fesm2022/autocomplete.mjs.map +1 -1
  64. package/fesm2022/bottom-sheet.mjs +2 -2
  65. package/fesm2022/bottom-sheet.mjs.map +1 -1
  66. package/fesm2022/button-toggle.mjs +2 -2
  67. package/fesm2022/button-toggle.mjs.map +1 -1
  68. package/fesm2022/button.mjs +8 -8
  69. package/fesm2022/button.mjs.map +1 -1
  70. package/fesm2022/chips.mjs +41 -17
  71. package/fesm2022/chips.mjs.map +1 -1
  72. package/fesm2022/core.mjs +12 -5
  73. package/fesm2022/core.mjs.map +1 -1
  74. package/fesm2022/datepicker.mjs +10 -10
  75. package/fesm2022/datepicker.mjs.map +1 -1
  76. package/fesm2022/divider.mjs +2 -2
  77. package/fesm2022/divider.mjs.map +1 -1
  78. package/fesm2022/expansion.mjs +8 -5
  79. package/fesm2022/expansion.mjs.map +1 -1
  80. package/fesm2022/form-field.mjs +2 -2
  81. package/fesm2022/form-field.mjs.map +1 -1
  82. package/fesm2022/legacy-autocomplete.mjs +1 -0
  83. package/fesm2022/legacy-autocomplete.mjs.map +1 -1
  84. package/fesm2022/legacy-dialog/testing.mjs +5 -0
  85. package/fesm2022/legacy-dialog/testing.mjs.map +1 -1
  86. package/fesm2022/legacy-menu.mjs +3 -1
  87. package/fesm2022/legacy-menu.mjs.map +1 -1
  88. package/fesm2022/legacy-table.mjs +5 -1
  89. package/fesm2022/legacy-table.mjs.map +1 -1
  90. package/fesm2022/legacy-tabs.mjs +5 -2
  91. package/fesm2022/legacy-tabs.mjs.map +1 -1
  92. package/fesm2022/legacy-tooltip.mjs +4 -1
  93. package/fesm2022/legacy-tooltip.mjs.map +1 -1
  94. package/fesm2022/menu.mjs +5 -5
  95. package/fesm2022/menu.mjs.map +1 -1
  96. package/fesm2022/radio.mjs +12 -0
  97. package/fesm2022/radio.mjs.map +1 -1
  98. package/fesm2022/sidenav.mjs +4 -4
  99. package/fesm2022/sidenav.mjs.map +1 -1
  100. package/fesm2022/slide-toggle.mjs +2 -2
  101. package/fesm2022/slide-toggle.mjs.map +1 -1
  102. package/fesm2022/toolbar.mjs +2 -2
  103. package/fesm2022/toolbar.mjs.map +1 -1
  104. package/legacy-autocomplete/index.d.ts +1 -0
  105. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  106. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  107. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  108. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  109. package/package.json +2 -2
  110. package/prebuilt-themes/deeppurple-amber.css +1 -1
  111. package/prebuilt-themes/indigo-pink.css +1 -1
  112. package/prebuilt-themes/pink-bluegrey.css +1 -1
  113. package/prebuilt-themes/purple-green.css +1 -1
  114. package/radio/index.d.ts +4 -1
  115. package/schematics/ng-add/index.js +1 -1
  116. package/schematics/ng-add/index.mjs +1 -1
  117. package/sidenav/_sidenav-theme.scss +6 -69
  118. package/toolbar/_toolbar-theme.scss +25 -71
  119. package/expansion/_expansion-mixins.import.scss +0 -1
  120. package/expansion/_expansion-mixins.scss +0 -11
@@ -1,13 +1,13 @@
1
1
  @use 'sass:color';
2
2
  @use 'sass:map';
3
- @use 'sass:math';
4
- @use 'sass:meta';
5
- @use '../core/style/private';
3
+ @use '../core/tokens/m2/mat/datepicker' as tokens-mat-datepicker;
6
4
  @use '../core/theming/theming';
5
+ @use '../core/tokens/token-utils';
6
+ @use '../core/style/sass-utils';
7
7
  @use '../core/typography/typography';
8
- @use '../core/typography/typography-utils';
9
8
  @use '../button/icon-button-theme';
10
9
 
10
+ // TODO(crisbeto): these variables aren't used anymore and should be removed.
11
11
  $selected-today-box-shadow-width: 1px;
12
12
  $selected-fade-amount: 0.6;
13
13
  $range-fade-amount: 0.2;
@@ -15,59 +15,15 @@ $today-fade-amount: 0.2;
15
15
  $calendar-body-font-size: 13px !default;
16
16
  $calendar-weekday-table-font-size: 11px !default;
17
17
 
18
- @mixin _color($palette) {
19
- @include date-range-colors(
20
- theming.get-color-from-palette($palette, default, $range-fade-amount));
18
+ @mixin _calendar-color($config, $palette) {
19
+ $palette-color: theming.get-color-from-palette(map.get($config, $palette));
20
+ $range-color: tokens-mat-datepicker.private-get-range-background-color($palette-color);
21
+ $range-tokens: tokens-mat-datepicker.get-range-color-tokens($range-color);
22
+ $calendar-tokens:
23
+ tokens-mat-datepicker.private-get-calendar-color-palette-color-tokens($config, $palette);
21
24
 
22
- .mat-calendar-body-selected {
23
- background-color: theming.get-color-from-palette($palette);
24
- color: theming.get-color-from-palette($palette, default-contrast);
25
- }
26
-
27
- .mat-calendar-body-disabled > .mat-calendar-body-selected {
28
- $background: theming.get-color-from-palette($palette);
29
-
30
- @if (meta.type-of($background) == color) {
31
- background-color: color.adjust($background, $alpha: -$selected-fade-amount);
32
- }
33
- @else {
34
- // If we couldn't resolve to background to a color (e.g. it's a CSS variable),
35
- // fall back to fading the content out via `opacity`.
36
- opacity: $today-fade-amount;
37
- }
38
- }
39
-
40
- .mat-calendar-body-today.mat-calendar-body-selected {
41
- box-shadow: inset 0 0 0 $selected-today-box-shadow-width
42
- theming.get-color-from-palette($palette, default-contrast);
43
- }
44
-
45
- .cdk-keyboard-focused .mat-calendar-body-active,
46
- .cdk-program-focused .mat-calendar-body-active {
47
- @include _highlighted-cell($palette);
48
- }
49
-
50
- @media (hover: hover) {
51
- .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover {
52
- @include _highlighted-cell($palette);
53
- }
54
- }
55
- }
56
-
57
- // Utility mixin to target cells that aren't selected. Used to make selector easier to follow.
58
- @mixin _unselected-cell {
59
- &:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
60
- @content;
61
- }
62
- }
63
-
64
- // Styles for a highlighted calendar cell (e.g. hovered or focused).
65
- @mixin _highlighted-cell($palette) {
66
- & > .mat-calendar-body-cell-content {
67
- @include _unselected-cell {
68
- background-color: theming.get-color-from-palette($palette, 0.3);
69
- }
70
- }
25
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
26
+ map.merge($calendar-tokens, $range-tokens));
71
27
  }
72
28
 
73
29
  @mixin color($config-or-theme) {
@@ -76,187 +32,72 @@ $calendar-weekday-table-font-size: 11px !default;
76
32
  $background: map.get($config, background);
77
33
  $disabled-color: theming.get-color-from-palette($foreground, disabled-text);
78
34
 
79
- .mat-calendar-arrow {
80
- fill: theming.get-color-from-palette($foreground, icon);
81
- }
82
-
83
- // The prev/next buttons need a bit more specificity to
84
- // avoid being overwritten by the .mat-icon-button.
85
- .mat-datepicker-toggle,
86
- .mat-datepicker-content .mat-calendar-next-button,
87
- .mat-datepicker-content .mat-calendar-previous-button {
88
- color: theming.get-color-from-palette($foreground, icon);
89
- }
90
-
91
- .mat-calendar-table-header-divider::after {
92
- background: theming.get-color-from-palette($foreground, divider);
93
- }
94
-
95
- .mat-calendar-table-header,
96
- .mat-calendar-body-label {
97
- color: theming.get-color-from-palette($foreground, secondary-text);
98
- }
99
-
100
- .mat-calendar-body-cell-content,
101
- .mat-date-range-input-separator {
102
- color: theming.get-color-from-palette($foreground, text);
103
- border-color: transparent;
35
+ @include sass-utils.current-selector-or-root() {
36
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
37
+ tokens-mat-datepicker.get-color-tokens($config));
104
38
  }
105
39
 
106
- .mat-calendar-body-disabled > .mat-calendar-body-cell-content {
107
- @include _unselected-cell {
108
- color: $disabled-color;
109
- }
110
- }
111
-
112
- .mat-form-field-disabled .mat-date-range-input-separator {
113
- color: $disabled-color;
114
- }
115
-
116
- .mat-calendar-body-in-preview {
117
- $divider-color: theming.get-color-from-palette($foreground, divider);
118
-
119
- @if meta.type-of($divider-color) == color {
120
- // The divider color is set under the assumption that it'll be used
121
- // for a solid border, but because we're using a dashed border for the
122
- // preview range, we need to bump its opacity to ensure that it's visible.
123
- color: rgba($divider-color, math.min(opacity($divider-color) * 2, 1));
124
- }
125
- @else {
126
- color: $divider-color;
127
- }
128
- }
129
-
130
- .mat-calendar-body-today {
131
- @include _unselected-cell {
132
- // Note: though it's not text, the border is a hint about the fact that this is today's date,
133
- // so we use the hint color.
134
- border-color: theming.get-color-from-palette($foreground, hint-text);
135
- }
136
- }
137
-
138
- .mat-calendar-body-disabled > .mat-calendar-body-today {
139
- @include _unselected-cell {
140
- $color: theming.get-color-from-palette($foreground, hint-text);
141
-
142
- @if (meta.type-of($color) == color) {
143
- border-color: color.adjust($color, $alpha: -$today-fade-amount);
144
- }
145
- @else {
146
- // If the color didn't resolve to a color value, but something like a CSS variable, we can't
147
- // fade it out so we fall back to reducing the element opacity. Note that we don't use the
148
- // $mat-datepicker-today-fade-amount, because hint text usually has some opacity applied
149
- // to it already and we don't want them to stack on top of each other.
150
- opacity: 0.5;
151
- }
152
- }
153
- }
154
-
155
- @include _color(map.get($config, primary));
156
-
157
40
  .mat-datepicker-content {
158
- @include private.private-theme-elevation(4, $config);
159
- background-color: theming.get-color-from-palette($background, card);
160
- color: theming.get-color-from-palette($foreground, text);
161
-
162
41
  &.mat-accent {
163
- @include _color(map.get($config, accent));
42
+ @include _calendar-color($config, accent);
164
43
  }
165
44
 
166
45
  &.mat-warn {
167
- @include _color(map.get($config, warn));
46
+ @include _calendar-color($config, warn);
168
47
  }
169
48
  }
170
49
 
171
- .mat-datepicker-content-touch {
172
- @include private.private-theme-elevation(24, $config);
173
- }
174
-
175
50
  .mat-datepicker-toggle-active {
176
- color: theming.get-color-from-palette(map.get($config, primary), text);
177
-
178
51
  &.mat-accent {
179
- color: theming.get-color-from-palette(map.get($config, accent), text);
52
+ $accent-tokens:
53
+ tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, accent);
54
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $accent-tokens);
180
55
  }
181
56
 
182
57
  &.mat-warn {
183
- color: theming.get-color-from-palette(map.get($config, warn), text);
58
+ $warn-tokens:
59
+ tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, warn);
60
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $warn-tokens);
184
61
  }
185
62
  }
186
-
187
- .mat-date-range-input-inner[disabled] {
188
- color: theming.get-color-from-palette($foreground, disabled-text);
189
- }
190
63
  }
191
64
 
192
65
  @mixin typography($config-or-theme) {
193
66
  $config: typography.private-typography-to-2014-config(
194
67
  theming.get-typography-config($config-or-theme));
195
- .mat-calendar {
196
- font-family: typography-utils.font-family($config);
197
- }
198
68
 
199
- .mat-calendar-body {
200
- font-size: $calendar-body-font-size;
201
- }
202
-
203
- .mat-calendar-body-label,
204
- .mat-calendar-period-button {
205
- font: {
206
- size: typography-utils.font-size($config, button);
207
- weight: typography-utils.font-weight($config, button);
208
- }
209
- }
210
-
211
- .mat-calendar-table-header th {
212
- font: {
213
- size: $calendar-weekday-table-font-size;
214
- weight: typography-utils.font-weight($config, body-1);
215
- }
69
+ @include sass-utils.current-selector-or-root() {
70
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
71
+ tokens-mat-datepicker.get-typography-tokens($config));
216
72
  }
217
73
  }
218
74
 
219
75
  @mixin date-range-colors(
220
76
  $range-color,
221
- $comparison-color: rgba(#f9ab00, $range-fade-amount),
222
- $overlap-color: #a8dab5,
223
- $overlap-selected-color: color.adjust($overlap-color, $lightness: -30%)) {
224
-
225
- .mat-calendar-body-in-range::before {
226
- background: $range-color;
227
- }
228
-
229
- .mat-calendar-body-comparison-identical,
230
- .mat-calendar-body-in-comparison-range::before {
231
- background: $comparison-color;
232
- }
233
-
234
- .mat-calendar-body-comparison-bridge-start::before,
235
- [dir='rtl'] .mat-calendar-body-comparison-bridge-end::before {
236
- background: linear-gradient(to right, $range-color 50%, $comparison-color 50%);
237
- }
238
-
239
- .mat-calendar-body-comparison-bridge-end::before,
240
- [dir='rtl'] .mat-calendar-body-comparison-bridge-start::before {
241
- background: linear-gradient(to left, $range-color 50%, $comparison-color 50%);
242
- }
243
-
244
- .mat-calendar-body-in-range > .mat-calendar-body-comparison-identical,
245
- .mat-calendar-body-in-comparison-range.mat-calendar-body-in-range::after {
246
- background: $overlap-color;
247
- }
248
-
249
- .mat-calendar-body-comparison-identical.mat-calendar-body-selected,
250
- .mat-calendar-body-in-comparison-range > .mat-calendar-body-selected {
251
- background: $overlap-selected-color;
77
+ $comparison-color: tokens-mat-datepicker.$private-default-comparison-color,
78
+ $overlap-color: tokens-mat-datepicker.$private-default-overlap-color,
79
+ $overlap-selected-color:
80
+ tokens-mat-datepicker.private-get-default-overlap-selected-color($overlap-color)) {
81
+ $tokens: tokens-mat-datepicker.get-range-color-tokens(
82
+ $range-color: $range-color,
83
+ $comparison-color: $comparison-color,
84
+ $overlap-color: $overlap-color,
85
+ $overlap-selected-color: $overlap-selected-color,
86
+ );
87
+
88
+ @include sass-utils.current-selector-or-root() {
89
+ @include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $tokens);
252
90
  }
253
91
  }
254
92
 
255
93
  @mixin density($config-or-theme) {
256
94
  $density-scale: theming.get-density-config($config-or-theme);
257
95
 
258
- // Regardless of the user-passed density, we want the calendar previous/next buttons to remain at
259
- // density -2
96
+ // TODO(crisbeto): move this into the structural styles
97
+ // once the icon button density is switched to tokens.
98
+
99
+ // Regardless of the user-passed density, we want the calendar
100
+ // previous/next buttons to remain at density -2
260
101
  .mat-calendar-controls {
261
102
  @include icon-button-theme.density(-2);
262
103
  }
@@ -1,16 +1,14 @@
1
- @use 'sass:map';
1
+ @use '../core/style/sass-utils';
2
2
  @use '../core/theming/theming';
3
+ @use '../core/tokens/token-utils';
4
+ @use '../core/tokens/m2/mat/divider' as tokens-mat-divider;
3
5
 
4
6
  @mixin color($config-or-theme) {
5
7
  $config: theming.get-color-config($config-or-theme);
6
- $foreground: map.get($config, foreground);
7
8
 
8
- .mat-divider {
9
- border-top-color: theming.get-color-from-palette($foreground, divider);
10
- }
11
-
12
- .mat-divider-vertical {
13
- border-right-color: theming.get-color-from-palette($foreground, divider);
9
+ @include sass-utils.current-selector-or-root() {
10
+ @include token-utils.create-token-values(tokens-mat-divider.$prefix,
11
+ tokens-mat-divider.get-color-tokens($config));
14
12
  }
15
13
  }
16
14