@angular/material 16.1.3 → 16.1.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 (70) hide show
  1. package/autocomplete/index.d.ts +6 -2
  2. package/core/index.d.ts +2 -2
  3. package/core/tokens/_token-utils.scss +14 -0
  4. package/core/tokens/m2/mat/_expansion.scss +90 -0
  5. package/core/tokens/m2/mat/_menu.scss +62 -0
  6. package/core/tokens/m2/mat/_stepper.scss +118 -0
  7. package/core/typography/_typography-utils.scss +13 -0
  8. package/esm2022/autocomplete/autocomplete-trigger.mjs +61 -38
  9. package/esm2022/button-toggle/button-toggle.mjs +2 -1
  10. package/esm2022/chips/chip-set.mjs +2 -2
  11. package/esm2022/core/option/option.mjs +9 -5
  12. package/esm2022/core/version.mjs +1 -1
  13. package/esm2022/expansion/expansion-animations.mjs +5 -2
  14. package/esm2022/expansion/expansion-panel-header.mjs +3 -3
  15. package/esm2022/expansion/expansion-panel.mjs +3 -3
  16. package/esm2022/legacy-dialog/testing/dialog-opener.mjs +6 -1
  17. package/esm2022/legacy-menu/menu.mjs +4 -2
  18. package/esm2022/legacy-table/text-column.mjs +6 -2
  19. package/esm2022/legacy-tabs/tab.mjs +6 -3
  20. package/esm2022/legacy-tooltip/tooltip.mjs +5 -2
  21. package/esm2022/menu/menu-item.mjs +4 -4
  22. package/esm2022/menu/menu.mjs +3 -3
  23. package/esm2022/stepper/step-header.mjs +2 -2
  24. package/esm2022/stepper/stepper.mjs +3 -3
  25. package/expansion/_expansion-legacy-index.scss +0 -1
  26. package/expansion/_expansion-theme.import.scss +0 -2
  27. package/expansion/_expansion-theme.scss +12 -68
  28. package/fesm2022/autocomplete.mjs +61 -38
  29. package/fesm2022/autocomplete.mjs.map +1 -1
  30. package/fesm2022/button-toggle.mjs +1 -0
  31. package/fesm2022/button-toggle.mjs.map +1 -1
  32. package/fesm2022/chips.mjs +1 -1
  33. package/fesm2022/chips.mjs.map +1 -1
  34. package/fesm2022/core.mjs +9 -5
  35. package/fesm2022/core.mjs.map +1 -1
  36. package/fesm2022/expansion.mjs +8 -5
  37. package/fesm2022/expansion.mjs.map +1 -1
  38. package/fesm2022/legacy-dialog/testing.mjs +5 -0
  39. package/fesm2022/legacy-dialog/testing.mjs.map +1 -1
  40. package/fesm2022/legacy-menu.mjs +3 -1
  41. package/fesm2022/legacy-menu.mjs.map +1 -1
  42. package/fesm2022/legacy-table.mjs +5 -1
  43. package/fesm2022/legacy-table.mjs.map +1 -1
  44. package/fesm2022/legacy-tabs.mjs +5 -2
  45. package/fesm2022/legacy-tabs.mjs.map +1 -1
  46. package/fesm2022/legacy-tooltip.mjs +4 -1
  47. package/fesm2022/legacy-tooltip.mjs.map +1 -1
  48. package/fesm2022/menu.mjs +5 -5
  49. package/fesm2022/menu.mjs.map +1 -1
  50. package/fesm2022/stepper.mjs +4 -4
  51. package/fesm2022/stepper.mjs.map +1 -1
  52. package/legacy-prebuilt-themes/legacy-deeppurple-amber.css +1 -1
  53. package/legacy-prebuilt-themes/legacy-indigo-pink.css +1 -1
  54. package/legacy-prebuilt-themes/legacy-pink-bluegrey.css +1 -1
  55. package/legacy-prebuilt-themes/legacy-purple-green.css +1 -1
  56. package/menu/_menu-theme.scss +9 -52
  57. package/menu/index.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/prebuilt-themes/deeppurple-amber.css +1 -1
  60. package/prebuilt-themes/indigo-pink.css +1 -1
  61. package/prebuilt-themes/pink-bluegrey.css +1 -1
  62. package/prebuilt-themes/purple-green.css +1 -1
  63. package/schematics/ng-add/index.js +1 -1
  64. package/schematics/ng-add/index.mjs +1 -1
  65. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  66. package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +1 -1
  67. package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +1 -5
  68. package/stepper/_stepper-theme.scss +18 -147
  69. package/expansion/_expansion-mixins.import.scss +0 -1
  70. package/expansion/_expansion-mixins.scss +0 -11
@@ -302,6 +302,8 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
302
302
  private _componentDestroyed;
303
303
  private _autocompleteDisabled;
304
304
  private _scrollStrategy;
305
+ private _keydownSubscription;
306
+ private _outsideClickSubscription;
305
307
  /** Old value of the native input. Used to work around issues with the `input` event on IE. */
306
308
  private _previousValue;
307
309
  /** Strategy that is used to position the panel. */
@@ -428,6 +430,10 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
428
430
  */
429
431
  private _clearPreviousSelectedOption;
430
432
  private _attachOverlay;
433
+ /** Handles keyboard events coming from the overlay panel. */
434
+ private _handlePanelKeydown;
435
+ /** Updates the panel's visibility state and any trigger state tied to id. */
436
+ private _updatePanelState;
431
437
  private _getOverlayConfig;
432
438
  private _getOverlayPosition;
433
439
  /** Sets the positions on a position strategy based on the directive's input state. */
@@ -450,8 +456,6 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
450
456
  private _getWindow;
451
457
  /** Scrolls to a particular option in the list. */
452
458
  private _scrollToOption;
453
- /** Handles keyboard events coming from the overlay panel. */
454
- private _handleOverlayEvents;
455
459
  /**
456
460
  * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
457
461
  * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
package/core/index.d.ts CHANGED
@@ -606,9 +606,9 @@ export declare class _MatOptionBase<T = any> implements FocusableOption, AfterVi
606
606
  */
607
607
  get viewValue(): string;
608
608
  /** Selects the option. */
609
- select(): void;
609
+ select(emitEvent?: boolean): void;
610
610
  /** Deselects the option. */
611
- deselect(): void;
611
+ deselect(emitEvent?: boolean): void;
612
612
  /** Sets focus onto this option. */
613
613
  focus(_origin?: FocusOrigin, options?: FocusOptions): void;
614
614
  /**
@@ -39,6 +39,7 @@ $placeholder-typography-config: (
39
39
  caption: $_placeholder-typography-level-config,
40
40
  button: $_placeholder-typography-level-config,
41
41
  overline: $_placeholder-typography-level-config,
42
+ subheading-1: $_placeholder-typography-level-config,
42
43
  );
43
44
 
44
45
  // Placeholder density config that can be passed to token getter functions when generating token
@@ -84,6 +85,19 @@ $_component-prefix: null;
84
85
  }
85
86
  }
86
87
 
88
+ // Returns the name of a token including the current prefix. Intended to be used in calculations
89
+ // involving tokens. `create-token-slot` should be used when outputting tokens.
90
+ @function get-token-variable($token) {
91
+ @if $_component-prefix == null or $_tokens == null {
92
+ @error '`get-token-variable` must be used within `use-tokens`';
93
+ }
94
+ @if not map.has-key($_tokens, $token) {
95
+ @error 'Token #{$token} does not exist. Configured tokens are: #{map.keys($_tokens)}';
96
+ }
97
+
98
+ @return mdc-custom-properties.create-varname('#{$_component-prefix}-#{$token}');
99
+ }
100
+
87
101
  @mixin create-token-values($prefix, $tokens) {
88
102
  @include _configure-token-prefix($prefix...) {
89
103
  @include mdc-keys.declare-custom-properties($tokens, $_component-prefix);
@@ -0,0 +1,90 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../style/sass-utils';
5
+ @use '../../../typography/typography-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, expansion);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ container-shape: 4px,
15
+ );
16
+ }
17
+
18
+ // Tokens that can be configured through Angular Material's color theming API.
19
+ @function get-color-tokens($config) {
20
+ $foreground: map.get($config, foreground);
21
+ $background: map.get($config, background);
22
+
23
+ @return (
24
+ container-background-color: theming.get-color-from-palette($background, card),
25
+ container-text-color: theming.get-color-from-palette($foreground, text),
26
+ actions-divider-color: theming.get-color-from-palette($foreground, divider),
27
+ header-hover-state-layer-color: theming.get-color-from-palette($background, hover),
28
+ header-focus-state-layer-color: theming.get-color-from-palette($background, hover),
29
+ header-disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
30
+ header-text-color: theming.get-color-from-palette($foreground, text),
31
+ header-description-color: theming.get-color-from-palette($foreground, secondary-text),
32
+ header-indicator-color: theming.get-color-from-palette($foreground, secondary-text),
33
+ );
34
+ }
35
+
36
+ // Tokens that can be configured through Angular Material's typography theming API.
37
+ @function get-typography-tokens($config) {
38
+ $fallback-font-family: typography-utils.font-family($config);
39
+
40
+ @return (
41
+ header-text-font: typography-utils.font-family($config, subheading-1) or $fallback-font-family,
42
+ header-text-size: typography-utils.font-size($config, subheading-1),
43
+ header-text-weight: typography-utils.font-weight($config, subheading-1),
44
+
45
+ // TODO(crisbeto): these two properties weren't set at all before the introduction of tokens,
46
+ // but it's inconsistent not to provide them since the container sets all of them. Eventually
47
+ // we should change the values to use come from `subheading-1`.
48
+ header-text-line-height: inherit,
49
+ header-text-tracking: inherit,
50
+
51
+ container-text-font: typography-utils.font-family($config, body-1) or $fallback-font-family,
52
+ container-text-line-height: typography-utils.line-height($config, body-1),
53
+ container-text-size: typography-utils.font-size($config, body-1),
54
+ container-text-tracking: typography-utils.letter-spacing($config, body-1),
55
+ container-text-weight: typography-utils.font-weight($config, body-1),
56
+ );
57
+ }
58
+
59
+ // Tokens that can be configured through Angular Material's density theming API.
60
+ @function get-density-tokens($config) {
61
+ $scale: theming.clamp-density($config, -3);
62
+ $collapsed-scale: (
63
+ 0: 48px,
64
+ -1: 44px,
65
+ -2: 40px,
66
+ -3: 36px,
67
+ );
68
+ $expanded-scale: (
69
+ 0: 64px,
70
+ -1: 60px,
71
+ -2: 56px,
72
+ -3: 48px,
73
+ );
74
+
75
+ @return (
76
+ header-collapsed-state-height: map.get($collapsed-scale, $scale),
77
+ header-expanded-state-height: map.get($expanded-scale, $scale),
78
+ );
79
+ }
80
+
81
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
82
+ // This is used to create token slots.
83
+ @function get-token-slots() {
84
+ @return sass-utils.deep-merge-all(
85
+ get-unthemable-tokens(),
86
+ get-color-tokens(token-utils.$placeholder-color-config),
87
+ get-typography-tokens(token-utils.$placeholder-typography-config),
88
+ get-density-tokens(token-utils.$placeholder-density-config)
89
+ );
90
+ }
@@ -0,0 +1,62 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../style/sass-utils';
5
+ @use '../../../typography/typography-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, menu);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return (
14
+ container-shape: 4px,
15
+ );
16
+ }
17
+
18
+ // Tokens that can be configured through Angular Material's color theming API.
19
+ @function get-color-tokens($config) {
20
+ $is-dark: map.get($config, is-dark);
21
+ $foreground: map.get($config, foreground);
22
+ $background: map.get($config, background);
23
+ $on-surface: if($is-dark, #fff, #000);
24
+ $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
25
+ $text-color: theming.get-color-from-palette($foreground, text);
26
+
27
+ @return (
28
+ item-label-text-color: $text-color,
29
+ item-icon-color: $text-color,
30
+ item-hover-state-layer-color: $active-state-layer-color,
31
+ item-focus-state-layer-color: $active-state-layer-color,
32
+ container-color: theming.get-color-from-palette($background, card),
33
+ );
34
+ }
35
+
36
+ // Tokens that can be configured through Angular Material's typography theming API.
37
+ @function get-typography-tokens($config) {
38
+ @return (
39
+ item-label-text-font:
40
+ typography-utils.font-family($config, body-1) or typography-utils.font-family($config),
41
+ item-label-text-size: typography-utils.font-size($config, body-1),
42
+ item-label-text-tracking: typography-utils.letter-spacing($config, body-1),
43
+ item-label-text-line-height: typography-utils.line-height($config, body-1),
44
+ item-label-text-weight: typography-utils.font-weight($config, body-1),
45
+ );
46
+ }
47
+
48
+ // Tokens that can be configured through Angular Material's density theming API.
49
+ @function get-density-tokens($config) {
50
+ @return ();
51
+ }
52
+
53
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
54
+ // This is used to create token slots.
55
+ @function get-token-slots() {
56
+ @return sass-utils.deep-merge-all(
57
+ get-unthemable-tokens(),
58
+ get-color-tokens(token-utils.$placeholder-color-config),
59
+ get-typography-tokens(token-utils.$placeholder-typography-config),
60
+ get-density-tokens(token-utils.$placeholder-density-config)
61
+ );
62
+ }
@@ -0,0 +1,118 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../typography/typography-utils';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, stepper);
9
+
10
+ // Tokens that can't be configured through Angular Material's current theming API,
11
+ // but may be in a future version of the theming API.
12
+ @function get-unthemable-tokens() {
13
+ @return ();
14
+ }
15
+
16
+ // Tokens that can be configured through Angular Material's color theming API.
17
+ @function get-color-tokens($config) {
18
+ $foreground: map.get($config, foreground);
19
+ $background: map.get($config, background);
20
+ $primary: map.get($config, primary);
21
+ $warn: map.get($config, warn);
22
+
23
+ @return map.merge(private-get-color-palette-color-tokens($primary), (
24
+ // Background for stepper container.
25
+ container-color: theming.get-color-from-palette($background, card),
26
+ // Color of the line indicator connecting the steps.
27
+ line-color: theming.get-color-from-palette($foreground, divider),
28
+ // Background color of the header while hovered.
29
+ header-hover-state-layer-color: theming.get-color-from-palette($background, hover),
30
+ // Background color of the header while focused.
31
+ header-focus-state-layer-color: theming.get-color-from-palette($background, hover),
32
+ // Color of the text inside the step header.
33
+ header-label-text-color: theming.get-color-from-palette($foreground, secondary-text),
34
+ // Color for the "optional" label in the step header.
35
+ header-optional-label-text-color: theming.get-color-from-palette($foreground, secondary-text),
36
+ // Color of the header text when a step is selected.
37
+ header-selected-state-label-text-color: theming.get-color-from-palette($foreground, text),
38
+ // Color of the header text when a step is in an error state.
39
+ header-error-state-label-text-color: theming.get-color-from-palette($warn, text),
40
+ // Background color of the header icon.
41
+ header-icon-background-color: theming.get-color-from-palette($foreground, secondary-text),
42
+ // Foreground color of the header icon in the error state.
43
+ header-error-state-icon-foreground-color: theming.get-color-from-palette($warn, text),
44
+ // Background color of the header icon in the error state.
45
+ header-error-state-icon-background-color: transparent,
46
+ ));
47
+ }
48
+
49
+ // Tokens that can be configured through Angular Material's typography theming API.
50
+ @function get-typography-tokens($config) {
51
+ @return (
52
+ // Font family of the entire stepper.
53
+ container-text-font: typography-utils.font-family($config),
54
+ // Font family of the text inside the step header.
55
+ header-label-text-font: typography-utils.font-family($config, body-1) or
56
+ typography-utils.font-family($config),
57
+ // Size of the text inside the step header.
58
+ header-label-text-size: typography-utils.font-size($config, body-1),
59
+ // Weight of the text inside the step header.
60
+ header-label-text-weight: typography-utils.font-weight($config, body-1),
61
+ // Color of the header text when a step is in an error state.
62
+ header-error-state-label-text-size: typography-utils.font-size($config, body-2),
63
+ // Size of the header text in the selected state.
64
+ header-selected-state-label-text-size: typography-utils.font-size($config, body-2),
65
+ // Weight of the header text in the selected state.
66
+ header-selected-state-label-text-weight: typography-utils.font-weight($config, body-2),
67
+ );
68
+ }
69
+
70
+ // Tokens that can be configured through Angular Material's density theming API.
71
+ @function get-density-tokens($config) {
72
+ $scale: theming.clamp-density($config, -4);
73
+ $height-config: (
74
+ 0: 72px,
75
+ -1: 68px,
76
+ -2: 64px,
77
+ -3: 60px,
78
+ -4: 42px,
79
+ );
80
+
81
+ @return (
82
+ header-height: map.get($height-config, $scale),
83
+ );
84
+ }
85
+
86
+ // Generates the tokens used to theme the stepper based on a palette.
87
+ @function private-get-color-palette-color-tokens($palette) {
88
+ $active-state-foreground: theming.get-color-from-palette($palette, default-contrast);
89
+ $active-state-background: theming.get-color-from-palette($palette);
90
+
91
+ @return (
92
+ // Foreground color of the header icon.
93
+ header-icon-foreground-color: theming.get-color-from-palette($palette, default-contrast),
94
+ // Background color of the header icon in the selected state.
95
+ header-selected-state-icon-background-color: $active-state-background,
96
+ // Foreground color of the header icon in the selected state.
97
+ header-selected-state-icon-foreground-color: $active-state-foreground,
98
+ // Background color of the header icon in the selected state.
99
+ header-done-state-icon-background-color: $active-state-background,
100
+ // Foreground color of the header icon in the selected state.
101
+ header-done-state-icon-foreground-color: $active-state-foreground,
102
+ // Background color of the header icon in the editing state.
103
+ header-edit-state-icon-background-color: $active-state-background,
104
+ // Foreground color of the header icon in the editing state.
105
+ header-edit-state-icon-foreground-color: $active-state-foreground,
106
+ );
107
+ }
108
+
109
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
110
+ // This is used to create token slots.
111
+ @function get-token-slots() {
112
+ @return sass-utils.deep-merge-all(
113
+ get-unthemable-tokens(),
114
+ get-color-tokens(token-utils.$placeholder-color-config),
115
+ get-typography-tokens(token-utils.$placeholder-typography-config),
116
+ get-density-tokens(token-utils.$placeholder-density-config)
117
+ );
118
+ }
@@ -7,6 +7,15 @@
7
7
 
8
8
  // Utility for fetching a nested value from a typography config.
9
9
  @function _mat-get-type-value($config, $level, $name) {
10
+ @if meta.type-of($config) != 'map' {
11
+ @error 'Typography config must be a map. Received #{meta.type-of($config)}.';
12
+ }
13
+
14
+ @if not map.has-key($config, $level) {
15
+ @error 'Typography config does not have a level called "#{$level}". ' +
16
+ 'Available levels are: #{map.keys($config)}.';
17
+ }
18
+
10
19
  @return map.get(map.get($config, $level), $name);
11
20
  }
12
21
 
@@ -42,6 +51,10 @@
42
51
  /// @param {Map} $config A typography config.
43
52
  /// @param {Map} $level A typography level.
44
53
  @function font-family($config, $level: null) {
54
+ @if meta.type-of($config) != 'map' {
55
+ @error 'Typography config must be a map. Received #{meta.type-of($config)}.';
56
+ }
57
+
45
58
  $font-family: map.get($config, font-family);
46
59
 
47
60
  @if $level != null {