@angular/material 16.0.2 → 16.1.0-next.1

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 (63) hide show
  1. package/autocomplete/index.d.ts +28 -0
  2. package/autocomplete/testing/index.d.ts +3 -1
  3. package/chips/_chips-theme.scss +44 -60
  4. package/core/mdc-helpers/_mdc-helpers.scss +6 -6
  5. package/core/tokens/m2/mdc/_chip.scss +313 -0
  6. package/core/tokens/m2/mdc/_plain-tooltip.scss +80 -0
  7. package/esm2022/autocomplete/autocomplete-trigger.mjs +58 -3
  8. package/esm2022/autocomplete/testing/autocomplete-harness.mjs +5 -1
  9. package/esm2022/chips/chip-option.mjs +2 -2
  10. package/esm2022/chips/chip-row.mjs +2 -2
  11. package/esm2022/chips/chip.mjs +2 -2
  12. package/esm2022/core/option/option.mjs +3 -3
  13. package/esm2022/core/version.mjs +1 -1
  14. package/esm2022/form-field/directives/floating-label.mjs +66 -5
  15. package/esm2022/form-field/directives/notched-outline.mjs +14 -16
  16. package/esm2022/form-field/form-field.mjs +30 -36
  17. package/esm2022/legacy-tooltip/testing/tooltip-harness.mjs +2 -1
  18. package/esm2022/legacy-tooltip/tooltip.mjs +3 -2
  19. package/esm2022/select/select.mjs +60 -4
  20. package/esm2022/snack-bar/snack-bar-container.mjs +4 -2
  21. package/esm2022/tabs/tab-group.mjs +3 -2
  22. package/esm2022/tabs/tab-header.mjs +2 -2
  23. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +12 -3
  24. package/esm2022/tooltip/testing/tooltip-harness.mjs +7 -1
  25. package/esm2022/tooltip/tooltip.mjs +5 -4
  26. package/fesm2022/autocomplete/testing.mjs +4 -0
  27. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  28. package/fesm2022/autocomplete.mjs +57 -3
  29. package/fesm2022/autocomplete.mjs.map +1 -1
  30. package/fesm2022/chips.mjs +6 -6
  31. package/fesm2022/chips.mjs.map +1 -1
  32. package/fesm2022/core.mjs +3 -3
  33. package/fesm2022/core.mjs.map +1 -1
  34. package/fesm2022/form-field.mjs +102 -50
  35. package/fesm2022/form-field.mjs.map +1 -1
  36. package/fesm2022/legacy-tooltip/testing.mjs +1 -0
  37. package/fesm2022/legacy-tooltip/testing.mjs.map +1 -1
  38. package/fesm2022/legacy-tooltip.mjs +2 -1
  39. package/fesm2022/legacy-tooltip.mjs.map +1 -1
  40. package/fesm2022/select.mjs +59 -3
  41. package/fesm2022/select.mjs.map +1 -1
  42. package/fesm2022/snack-bar.mjs +3 -1
  43. package/fesm2022/snack-bar.mjs.map +1 -1
  44. package/fesm2022/tabs.mjs +15 -5
  45. package/fesm2022/tabs.mjs.map +1 -1
  46. package/fesm2022/tooltip/testing.mjs +6 -0
  47. package/fesm2022/tooltip/testing.mjs.map +1 -1
  48. package/fesm2022/tooltip.mjs +4 -3
  49. package/fesm2022/tooltip.mjs.map +1 -1
  50. package/form-field/index.d.ts +44 -12
  51. package/legacy-tooltip/testing/index.d.ts +1 -0
  52. package/package.json +7 -7
  53. package/prebuilt-themes/deeppurple-amber.css +1 -1
  54. package/prebuilt-themes/indigo-pink.css +1 -1
  55. package/prebuilt-themes/pink-bluegrey.css +1 -1
  56. package/prebuilt-themes/purple-green.css +1 -1
  57. package/schematics/ng-add/index.js +2 -2
  58. package/schematics/ng-add/index.mjs +2 -2
  59. package/select/index.d.ts +28 -0
  60. package/tabs/_tabs-common.scss +4 -0
  61. package/tabs/index.d.ts +4 -1
  62. package/tooltip/_tooltip-theme.scss +18 -22
  63. package/tooltip/testing/index.d.ts +4 -0
@@ -452,6 +452,34 @@ export declare abstract class _MatAutocompleteTriggerBase implements ControlValu
452
452
  private _scrollToOption;
453
453
  /** Handles keyboard events coming from the overlay panel. */
454
454
  private _handleOverlayEvents;
455
+ /**
456
+ * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
457
+ * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
458
+ * panel. Track the modal we have changed so we can undo the changes on destroy.
459
+ */
460
+ private _trackedModal;
461
+ /**
462
+ * If the autocomplete trigger is inside of an `aria-modal` element, connect
463
+ * that modal to the options panel with `aria-owns`.
464
+ *
465
+ * For some browser + screen reader combinations, when navigation is inside
466
+ * of an `aria-modal` element, the screen reader treats everything outside
467
+ * of that modal as hidden or invisible.
468
+ *
469
+ * This causes a problem when the combobox trigger is _inside_ of a modal, because the
470
+ * options panel is rendered _outside_ of that modal, preventing screen reader navigation
471
+ * from reaching the panel.
472
+ *
473
+ * We can work around this issue by applying `aria-owns` to the modal with the `id` of
474
+ * the options panel. This effectively communicates to assistive technology that the
475
+ * options panel is part of the same interaction as the modal.
476
+ *
477
+ * At time of this writing, this issue is present in VoiceOver.
478
+ * See https://github.com/angular/components/issues/20694
479
+ */
480
+ private _applyModalPanelOwnership;
481
+ /** Clears the references to the listbox overlay element from the modal it was added to. */
482
+ private _clearFromModal;
455
483
  static ɵfac: i0.ɵɵFactoryDeclaration<_MatAutocompleteTriggerBase, [null, null, null, null, null, null, { optional: true; }, { optional: true; host: true; }, { optional: true; }, null, { optional: true; }]>;
456
484
  static ɵdir: i0.ɵɵDirectiveDeclaration<_MatAutocompleteTriggerBase, never, never, { "autocomplete": { "alias": "matAutocomplete"; "required": false; }; "position": { "alias": "matAutocompletePosition"; "required": false; }; "connectedTo": { "alias": "matAutocompleteConnectedTo"; "required": false; }; "autocompleteAttribute": { "alias": "autocomplete"; "required": false; }; "autocompleteDisabled": { "alias": "matAutocompleteDisabled"; "required": false; }; }, {}, never, never, false, never>;
457
485
  }
@@ -29,6 +29,8 @@ export declare class MatAutocompleteHarness extends _MatAutocompleteHarnessBase<
29
29
  * @return a `HarnessPredicate` configured with the given options.
30
30
  */
31
31
  static with<T extends MatAutocompleteHarness>(this: ComponentHarnessConstructor<T>, options?: AutocompleteHarnessFilters): HarnessPredicate<T>;
32
+ /** Gets the selector that can be used to find the autocomplete trigger's panel. */
33
+ protected _getPanelSelector(): Promise<string>;
32
34
  }
33
35
 
34
36
  export declare abstract class _MatAutocompleteHarnessBase<OptionType extends ComponentHarnessConstructor<Option> & {
@@ -67,7 +69,7 @@ export declare abstract class _MatAutocompleteHarnessBase<OptionType extends Com
67
69
  /** Gets the panel associated with this autocomplete trigger. */
68
70
  private _getPanel;
69
71
  /** Gets the selector that can be used to find the autocomplete trigger's panel. */
70
- private _getPanelSelector;
72
+ protected _getPanelSelector(): Promise<string>;
71
73
  }
72
74
 
73
75
  export { }
@@ -2,100 +2,84 @@
2
2
  @use 'sass:map';
3
3
  @use 'sass:meta';
4
4
  @use '@material/chips/chip-theme' as mdc-chip-theme;
5
- @use '@material/chips/chip-set' as mdc-chip-set;
6
- @use '@material/theme/theme-color' as mdc-theme-color;
7
- @use '@material/theme/color-palette' as mdc-color-palette;
8
- @use '@material/typography' as mdc-typography;
9
- @use '../core/mdc-helpers/mdc-helpers';
5
+ @use '../core/tokens/m2/mdc/chip' as tokens-mdc-chip;
6
+ @use '../core/theming/palette';
10
7
  @use '../core/theming/theming';
11
8
  @use '../core/typography/typography';
9
+ @use '../core/mdc-helpers/mdc-helpers';
12
10
 
13
- @mixin _chip-variant($background, $foreground) {
14
- @include mdc-chip-theme.theme((
15
- elevated-container-color: $background,
16
- elevated-disabled-container-color: $background,
17
- label-text-color: $foreground,
18
- disabled-label-text-color: $foreground,
19
- with-icon-icon-color: $foreground,
20
- with-icon-disabled-icon-color: $foreground,
21
- with-trailing-icon-disabled-trailing-icon-color: $foreground,
22
- with-trailing-icon-trailing-icon-color: $foreground,
23
- with-icon-selected-icon-color: $foreground,
24
- ));
25
- }
11
+ @function _get-default-palette($config) {
12
+ $is-dark: map.get($config, is-dark);
13
+ $grey-50: map.get(palette.$grey-palette, 50);
14
+ $grey-900: map.get(palette.$grey-palette, 900);
15
+ $default-foreground: if($is-dark, $grey-50, $grey-900);
26
16
 
27
- @mixin _colored-chip($palette) {
28
- $background: theming.get-color-from-palette($palette);
29
- $foreground: theming.get-color-from-palette($palette, default-contrast);
17
+ $surface: map.get(map.get($config, background), card);
18
+ $on-surface: if(
19
+ mdc-helpers.variable-safe-contrast-tone($surface, $is-dark) == 'dark',
20
+ #000,
21
+ #fff
22
+ );
23
+ $default-background: if(
24
+ meta.type-of($on-surface) == color and meta.type-of($surface) == color,
25
+ color.mix($on-surface, $surface, 12%),
26
+ $on-surface
27
+ );
30
28
 
31
- &.mat-mdc-chip-selected,
32
- &.mat-mdc-chip-highlighted {
33
- @include _chip-variant($background, $foreground);
34
- }
29
+ @return (default: $default-background, default-contrast: $default-foreground);
35
30
  }
36
31
 
37
32
  @mixin color($config-or-theme) {
38
33
  $config: theming.get-color-config($config-or-theme);
39
- $primary: map.get($config, primary);
40
- $accent: map.get($config, accent);
41
- $warn: map.get($config, warn);
42
- $foreground: map.get($config, foreground);
43
- $is-dark: map.get($config, is-dark);
44
-
45
- @include mdc-helpers.using-mdc-theme($config) {
46
- $on-surface: mdc-theme-color.prop-value(on-surface);
47
- $surface: mdc-theme-color.prop-value(surface);
48
-
49
- .mat-mdc-standard-chip {
50
- $standard-background: if(
51
- meta.type-of($on-surface) == color and meta.type-of($surface) == color,
52
- color.mix($on-surface, $surface, 12%),
53
- $on-surface
54
- );
55
34
 
56
- @include _chip-variant(
57
- $standard-background,
58
- if($is-dark, mdc-color-palette.$grey-50, mdc-color-palette.$grey-900)
59
- );
35
+ .mat-mdc-standard-chip {
36
+ $default-palette: _get-default-palette($config);
37
+ $default-config: map.merge($config, (primary: $default-palette));
38
+ $default-color-tokens: tokens-mdc-chip.get-color-tokens($default-config);
39
+ @include mdc-chip-theme.theme($default-color-tokens);
60
40
 
41
+ &.mat-mdc-chip-selected,
42
+ &.mat-mdc-chip-highlighted {
61
43
  &.mat-primary {
62
- @include _colored-chip($primary);
44
+ $primary-color-tokens: tokens-mdc-chip.get-color-tokens($config);
45
+ @include mdc-chip-theme.theme($primary-color-tokens);
63
46
  }
64
47
 
65
48
  &.mat-accent {
66
- @include _colored-chip($accent);
49
+ $accent-config: map.merge($config, (primary: map.get($config, accent)));
50
+ $accent-color-tokens: tokens-mdc-chip.get-color-tokens($accent-config);
51
+ @include mdc-chip-theme.theme($accent-color-tokens);
67
52
  }
68
53
 
69
54
  &.mat-warn {
70
- @include _colored-chip($warn);
55
+ $warn-config: map.merge($config, (primary: map.get($config, warn)));
56
+ $warn-color-tokens: tokens-mdc-chip.get-color-tokens($warn-config);
57
+ @include mdc-chip-theme.theme($warn-color-tokens);
71
58
  }
72
59
  }
73
60
  }
74
61
 
75
62
  .mat-mdc-chip-focus-overlay {
76
- background: map.get($foreground, base);
63
+ background: map.get(map.get($config, foreground), base);
77
64
  }
78
65
  }
79
66
 
80
67
  @mixin typography($config-or-theme) {
81
68
  $config: typography.private-typography-to-2018-config(
82
- theming.get-typography-config($config-or-theme));
83
- @include mdc-chip-set.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
84
- @include mdc-helpers.using-mdc-typography($config) {
85
- // Note that we don't go through MDC's typography mixin, because it assigns the styles to
86
- // an inner element which makes it difficult for clients to customize. Instead we apply the
87
- // same styles ourselves to the root.
88
- .mat-mdc-standard-chip {
89
- @include mdc-typography.typography(body2, $query: mdc-helpers.$mdc-typography-styles-query);
90
- }
69
+ theming.get-typography-config($config-or-theme)
70
+ );
71
+ $typography-tokens: tokens-mdc-chip.get-typography-tokens($config);
72
+
73
+ .mat-mdc-standard-chip {
74
+ @include mdc-chip-theme.theme($typography-tokens);
91
75
  }
92
76
  }
93
77
 
94
78
  @mixin density($config-or-theme) {
95
79
  $density-scale: theming.get-density-config($config-or-theme);
96
- $density-scale: theming.clamp-density($density-scale, -2);
80
+ $density-tokens: tokens-mdc-chip.get-density-tokens($density-scale);
97
81
  .mat-mdc-chip.mat-mdc-standard-chip {
98
- @include mdc-chip-theme.density($density-scale, $query: mdc-helpers.$mdc-base-styles-query);
82
+ @include mdc-chip-theme.theme($density-tokens);
99
83
  }
100
84
  }
101
85
 
@@ -100,7 +100,7 @@ $mat-typography-mdc-level-mappings: (
100
100
 
101
101
  // MDC logs a warning if the `contrast-tone` function is called with a CSS variable.
102
102
  // This function falls back to determining the tone based on whether the theme is light or dark.
103
- @function _variable-safe-contrast-tone($value, $is-dark) {
103
+ @function variable-safe-contrast-tone($value, $is-dark) {
104
104
  @if ($value == 'dark' or $value == 'light' or type-of($value) == 'color') {
105
105
  @return mdc-theme-color.contrast-tone($value);
106
106
  }
@@ -109,7 +109,7 @@ $mat-typography-mdc-level-mappings: (
109
109
  }
110
110
 
111
111
  @function _variable-safe-ink-color-for-fill($text-style, $fill-color, $is-dark) {
112
- $contrast-tone: _variable-safe-contrast-tone($fill-color, $is-dark);
112
+ $contrast-tone: variable-safe-contrast-tone($fill-color, $is-dark);
113
113
  @return map.get(map.get(mdc-theme-color.$text-colors, $contrast-tone), $text-style);
114
114
  }
115
115
 
@@ -137,17 +137,17 @@ $mat-typography-mdc-level-mappings: (
137
137
  // Set new values based on the given Angular Material theme.
138
138
  mdc-theme-color.$primary: $primary;
139
139
  mdc-theme-color.$on-primary:
140
- if(_variable-safe-contrast-tone(mdc-theme-color.$primary, $is-dark) == 'dark', #000, #fff);
140
+ if(variable-safe-contrast-tone(mdc-theme-color.$primary, $is-dark) == 'dark', #000, #fff);
141
141
  mdc-theme-color.$secondary: $accent;
142
142
  mdc-theme-color.$on-secondary:
143
- if(_variable-safe-contrast-tone(mdc-theme-color.$secondary, $is-dark) == 'dark', #000, #fff);
143
+ if(variable-safe-contrast-tone(mdc-theme-color.$secondary, $is-dark) == 'dark', #000, #fff);
144
144
  mdc-theme-color.$background: theming.get-color-from-palette($background-palette, background);
145
145
  mdc-theme-color.$surface: theming.get-color-from-palette($background-palette, card);
146
146
  mdc-theme-color.$on-surface:
147
- if(_variable-safe-contrast-tone(mdc-theme-color.$surface, $is-dark) == 'dark', #000, #fff);
147
+ if(variable-safe-contrast-tone(mdc-theme-color.$surface, $is-dark) == 'dark', #000, #fff);
148
148
  mdc-theme-color.$error: $warn;
149
149
  mdc-theme-color.$on-error:
150
- if(_variable-safe-contrast-tone(mdc-theme-color.$error, $is-dark) == 'dark', #000, #fff);
150
+ if(variable-safe-contrast-tone(mdc-theme-color.$error, $is-dark) == 'dark', #000, #fff);
151
151
  mdc-theme-color.$property-values: (
152
152
  // Primary
153
153
  primary: mdc-theme-color.$primary,
@@ -0,0 +1,313 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use '../../token-utils';
4
+ @use '../../../mdc-helpers/mdc-helpers';
5
+ @use '../../../theming/theming';
6
+ @use '../../../typography/typography-utils';
7
+
8
+ // The prefix used to generate the fully qualified name for tokens in this file.
9
+ $prefix: (mdc, chip);
10
+
11
+ // Tokens that can't be configured through Angular Material's current theming API,
12
+ // but may be in a future version of the theming API.
13
+ //
14
+ // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
15
+ // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
16
+ // our CSS.
17
+ @function get-unthemable-tokens() {
18
+ @return (
19
+ // The shape & radius of the chip.
20
+ container-shape:
21
+ (
22
+ family: 'rounded',
23
+ radius: (
24
+ 16px 16px 16px 16px,
25
+ )
26
+ ),
27
+ // The shape & radius of the avatar.
28
+ with-avatar-avatar-shape:
29
+ (
30
+ family: 'rounded',
31
+ radius: (
32
+ 14px 14px 14px 14px,
33
+ )
34
+ ),
35
+ // The width & height of the chip avatar.
36
+ with-avatar-avatar-size: 28px,
37
+ // The width & height of the chip icon.
38
+ with-icon-icon-size: 18px,
39
+ // Not used by MDC.
40
+ disabled-label-text-opacity: null,
41
+ // Not used by MDC.
42
+ disabled-outline-opacity: null,
43
+ // Not used by MDC.
44
+ elevated-disabled-container-opacity: null,
45
+ // Not used by MDC.
46
+ flat-disabled-outline-opacity: null,
47
+ // Not used by MDC.
48
+ flat-disabled-unselected-outline-opacity: null,
49
+ // Our chips do not have a border.
50
+ flat-outline-width: null,
51
+ // Our chips do not have a border.
52
+ flat-selected-outline-width: null,
53
+ // Our chips do not have a border.
54
+ flat-unselected-outline-width: null,
55
+ // Our chips do not have a border.
56
+ outline-width: null,
57
+ // Not used by MDC.
58
+ with-avatar-disabled-avatar-opacity: null,
59
+ // Not used by MDC.
60
+ with-icon-disabled-icon-opacity: null,
61
+ // Not used by MDC.
62
+ with-leading-icon-disabled-leading-icon-opacity: null,
63
+ // Not used by MDC.
64
+ with-leading-icon-leading-icon-size: null,
65
+ // Not used by MDC.
66
+ with-trailing-icon-disabled-trailing-icon-opacity: null,
67
+ // Not used by MDC.
68
+ with-trailing-icon-trailing-icon-size: null,
69
+ // Elevated chips not implemented.
70
+ container-elevation: null,
71
+ // Elevated chips not implemented.
72
+ container-shadow-color: null,
73
+ // Our chips do not have a border.
74
+ disabled-outline-color: null,
75
+ // Elevated chips not implemented.
76
+ elevated-container-elevation: null,
77
+ // Elevated chips not implemented.
78
+ elevated-container-shadow-color: null,
79
+ // Elevated chips not implemented.
80
+ container-surface-tint-layer-color: null,
81
+ // Elevated chips not implemented.
82
+ elevated-disabled-container-elevation: null,
83
+ // Elevated chips not implemented.
84
+ elevated-focus-container-elevation: null,
85
+ // Elevated chips not implemented.
86
+ elevated-hover-container-elevation: null,
87
+ // Elevated chips not implemented.
88
+ elevated-pressed-container-elevation: null,
89
+ // Elevated chips not implemented.
90
+ elevated-selected-container-color: null,
91
+ // Elevated chips not implemented.
92
+ elevated-selected-container-elevation: null,
93
+ // Elevated chips not implemented.
94
+ elevated-unselected-container-color: null,
95
+ // Elevated chips not implemented.
96
+ flat-container-elevation: null,
97
+ // Our chips do not have a border.
98
+ flat-disabled-outline-color: null,
99
+ // Not providing this uses
100
+ flat-disabled-selected-container-color: null,
101
+ // Not used by MDC.
102
+ flat-disabled-selected-container-opacity: null,
103
+ // Unused.
104
+ flat-disabled-selected-outline-color: null,
105
+ // Unused.
106
+ flat-disabled-selected-outline-opacity: null,
107
+ // Unused.
108
+ flat-disabled-unselected-outline-color: null,
109
+ // Unused.
110
+ flat-focus-outline-color: null,
111
+ // Unused.
112
+ flat-outline-color: null,
113
+ // Unused.
114
+ flat-selected-container-color: null,
115
+ // Unused.
116
+ flat-selected-focus-container-elevation: null,
117
+ // Unused.
118
+ flat-selected-hover-container-elevation: null,
119
+ // Unused.
120
+ flat-selected-outline-color: null,
121
+ // Unused.
122
+ flat-selected-pressed-container-elevation: null,
123
+ // Unused.
124
+ flat-unselected-focus-container-elevation: null,
125
+ // Unused.
126
+ flat-unselected-focus-outline-color: null,
127
+ // Unused.
128
+ flat-unselected-hover-container-elevation: null,
129
+ // Unused.
130
+ flat-unselected-outline-color: null,
131
+ // Unused.
132
+ flat-unselected-pressed-container-elevation: null,
133
+ // Unused.
134
+ focus-label-text-color: null,
135
+ // Unused.
136
+ focus-outline-color: null,
137
+ // Unused.
138
+ focus-state-layer-color: null,
139
+ // Unused.
140
+ focus-state-layer-opacity: null,
141
+ // Unused.
142
+ hover-label-text-color: null,
143
+ // Unused.
144
+ hover-state-layer-color: null,
145
+ // Unused.
146
+ hover-state-layer-opacity: null,
147
+ // Unused.
148
+ outline-color: null,
149
+ // Unused.
150
+ pressed-label-text-color: null,
151
+ // Unused.
152
+ pressed-state-layer-color: null,
153
+ // Unused.
154
+ pressed-state-layer-opacity: null,
155
+ // Unused.
156
+ selected-focus-label-text-color: null,
157
+ // Unused.
158
+ selected-focus-state-layer-color: null,
159
+ // Unused.
160
+ selected-focus-state-layer-opacity: null,
161
+ // Unused.
162
+ selected-hover-label-text-color: null,
163
+ // Unused.
164
+ selected-hover-state-layer-color: null,
165
+ // Unused.
166
+ selected-hover-state-layer-opacity: null,
167
+ // Unused.
168
+ selected-label-text-color: null,
169
+ // Unused.
170
+ selected-pressed-label-text-color: null,
171
+ // Unused.
172
+ selected-pressed-state-layer-color: null,
173
+ // Unused.
174
+ selected-pressed-state-layer-opacity: null,
175
+ // Unused.
176
+ unselected-focus-label-text-color: null,
177
+ // Unused.
178
+ unselected-focus-state-layer-color: null,
179
+ // Unused.
180
+ unselected-focus-state-layer-opacity: null,
181
+ // Unused.
182
+ unselected-hover-label-text-color: null,
183
+ // Unused.
184
+ unselected-hover-state-layer-color: null,
185
+ // Unused.
186
+ unselected-hover-state-layer-opacity: null,
187
+ // Unused.
188
+ unselected-label-text-color: null,
189
+ // Unused.
190
+ unselected-pressed-label-text-color: null,
191
+ // Unused.
192
+ unselected-pressed-state-layer-color: null,
193
+ // Unused.
194
+ unselected-pressed-state-layer-opacity: null,
195
+ // Unused.
196
+ with-icon-focus-icon-color: null,
197
+ // Unused.
198
+ with-icon-hover-icon-color: null,
199
+ // Unused.
200
+ with-icon-pressed-icon-color: null,
201
+ // Unused.
202
+ with-icon-selected-focus-icon-color: null,
203
+ // Unused.
204
+ with-icon-selected-hover-icon-color: null,
205
+ // Unused.
206
+ with-icon-selected-pressed-icon-color: null,
207
+ // Unused.
208
+ with-icon-unselected-focus-icon-color: null,
209
+ // Unused.
210
+ with-icon-unselected-hover-icon-color: null,
211
+ // Unused.
212
+ with-icon-unselected-icon-color: null,
213
+ // Unused.
214
+ with-icon-unselected-pressed-icon-color: null,
215
+ // Unused.
216
+ with-leading-icon-disabled-leading-icon-color: null,
217
+ // Unused.
218
+ with-leading-icon-focus-leading-icon-color: null,
219
+ // Unused.
220
+ with-leading-icon-hover-leading-icon-color: null,
221
+ // Unused.
222
+ with-leading-icon-leading-icon-color: null,
223
+ // Unused.
224
+ with-leading-icon-pressed-leading-icon-color: null,
225
+ // Unused.
226
+ with-trailing-icon-focus-trailing-icon-color: null,
227
+ // Unused.
228
+ with-trailing-icon-hover-trailing-icon-color: null,
229
+ // Unused.
230
+ with-trailing-icon-pressed-trailing-icon-color: null
231
+ );
232
+ }
233
+
234
+ // Tokens that can be configured through Angular Material's color theming API.
235
+ @function get-color-tokens($config) {
236
+ $palette: map.get($config, primary);
237
+ $background: theming.get-color-from-palette($palette);
238
+ $foreground: theming.get-color-from-palette($palette, default-contrast);
239
+
240
+ @return (
241
+ // The text color of a disabled chip.
242
+ disabled-label-text-color: $foreground,
243
+ // The background-color of the chip.
244
+ elevated-container-color: $background,
245
+ // The background-color of a disabled chip.
246
+ elevated-disabled-container-color: $background,
247
+ // The chip text color.
248
+ label-text-color: $foreground,
249
+ // The icon color of a chip.
250
+ with-icon-icon-color: $foreground,
251
+ // The color of the icon of a disabled chip.
252
+ with-icon-disabled-icon-color: $foreground,
253
+ // The color of the icon of a selected chip.
254
+ with-icon-selected-icon-color: $foreground,
255
+ // The color of the icon at the end of a disabled chip.
256
+ with-trailing-icon-disabled-trailing-icon-color: $foreground,
257
+ // The color of the icon at the end of the chip.
258
+ with-trailing-icon-trailing-icon-color: $foreground
259
+ );
260
+ }
261
+
262
+ // Tokens that can be configured through Angular Material's typography theming API.
263
+ @function get-typography-tokens($config) {
264
+ // TODO(wagnermaciel): The earlier implementation of the chip used MDC's APIs to create the
265
+ // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
266
+ // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
267
+ // fallback.
268
+ @if ($config == null) {
269
+ $config: mdc-helpers.private-fallback-typography-from-mdc();
270
+ }
271
+
272
+ @return (
273
+ // The font family of the chip text.
274
+ label-text-font: typography-utils.font-family($config, body-2) or
275
+ typography-utils.font-family($config),
276
+ // The line height of the chip text.
277
+ label-text-line-height: typography-utils.line-height($config, body-2),
278
+ // The font size of the chip text.
279
+ label-text-size: typography-utils.font-size($config, body-2),
280
+ // The letter spacing of the chip label.
281
+ label-text-tracking: typography-utils.letter-spacing($config, body-2),
282
+ // The font weight of the chip text.
283
+ label-text-weight: typography-utils.font-weight($config, body-2)
284
+ );
285
+ }
286
+
287
+ // Tokens that can be configured through Angular Material's density theming API.
288
+ @function get-density-tokens($config) {
289
+ $scale: theming.clamp-density($config, -2);
290
+ @return (
291
+ // The height of the chip.
292
+ container-height:
293
+ map.get(
294
+ (
295
+ 0: 32px,
296
+ -1: 28px,
297
+ -2: 24px,
298
+ ),
299
+ $scale
300
+ )
301
+ );
302
+ }
303
+
304
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
305
+ // This is used to create token slots.
306
+ @function get-token-slots() {
307
+ @return token-utils.merge-all(
308
+ get-unthemable-tokens(),
309
+ get-color-tokens(token-utils.$placeholder-color-config),
310
+ get-typography-tokens(token-utils.$placeholder-typography-config),
311
+ get-density-tokens(token-utils.$placeholder-density-config)
312
+ );
313
+ }
@@ -0,0 +1,80 @@
1
+ @use 'sass:map';
2
+ @use '../../../theming/theming';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../mdc-helpers/mdc-helpers';
5
+ @use '../../token-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mdc, plain-tooltip);
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
+ //
13
+ // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
14
+ // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
15
+ // our CSS.
16
+ @function get-unthemable-tokens() {
17
+ @return (
18
+ // Border radius for the tooltip container.
19
+ container-shape: 4px,
20
+ // Line height of the tooltip text.
21
+ supporting-text-line-height: 16px,
22
+ // MDC does not seem to use these token.
23
+ supporting-text-type: null,
24
+ );
25
+ }
26
+
27
+ // Tokens that can be configured through Angular Material's color theming API.
28
+ @function get-color-tokens($config) {
29
+ $background: map.get($config, background);
30
+
31
+ @return (
32
+ // Color of the tooltip container.
33
+ container-color: theming.get-color-from-palette($background, tooltip),
34
+ // Color of the tooltip text.
35
+ supporting-text-color: #fff,
36
+ );
37
+ }
38
+
39
+ // Tokens that can be configured through Angular Material's typography theming API.
40
+ @function get-typography-tokens($config) {
41
+ // TODO(amysorto): The earlier implementation of the tooltip used MDC's APIs to create the
42
+ // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
43
+ // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
44
+ // fallback.
45
+ @if ($config == null) {
46
+ $config: mdc-helpers.private-fallback-typography-from-mdc();
47
+ }
48
+
49
+ @return (
50
+ // Font for the tooltip text.
51
+ supporting-text-font: typography-utils.font-family($config, caption)
52
+ or typography-utils.font-family($config),
53
+ // Font size for the the tooltip text.
54
+ supporting-text-size: typography-utils.font-size($config, caption),
55
+ // Font weight of the the tooltip text.
56
+ supporting-text-weight: typography-utils.font-weight($config, caption),
57
+ // Tracking (space between letters) of the tooltip text.
58
+ supporting-text-tracking: typography-utils.letter-spacing($config, caption),
59
+ );
60
+ }
61
+
62
+ // Tokens that can be configured through Angular Material's density theming API.
63
+ @function get-density-tokens($config) {
64
+ @return ();
65
+ }
66
+
67
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
68
+ // This is used to create token slots.
69
+ @function get-token-slots() {
70
+ @return map.merge(
71
+ get-unthemable-tokens(),
72
+ map.merge(
73
+ get-color-tokens(token-utils.$placeholder-color-config),
74
+ map.merge(
75
+ get-typography-tokens(token-utils.$placeholder-typography-config),
76
+ get-density-tokens(token-utils.$placeholder-density-config)
77
+ )
78
+ )
79
+ );
80
+ }