@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,118 +1,41 @@
1
- @use 'sass:map';
2
- @use '../core/style/private';
3
1
  @use '../core/theming/theming';
4
2
  @use '../core/typography/typography';
5
- @use '../core/typography/typography-utils';
6
- @use '../core/density/private/compatibility';
7
- @use './button-toggle-variables';
3
+ @use '../core/tokens/m2/mat/legacy-button-toggle' as tokens-mat-legacy-button-toggle;
4
+ @use '../core/tokens/m2/mat/standard-button-toggle' as tokens-mat-standard-button-toggle;
5
+ @use '../core/tokens/token-utils';
6
+ @use '../core/style/sass-utils';
8
7
 
9
8
  @mixin color($config-or-theme) {
10
9
  $config: theming.get-color-config($config-or-theme);
11
- $foreground: map.get($config, foreground);
12
- $background: map.get($config, background);
13
- $divider-color: theming.get-color-from-palette($foreground, divider);
14
- $theme-divider-color: map.get($foreground, divider);
15
10
 
16
- // By default the theme usually has an rgba color for the dividers, which can
17
- // stack up with the background of a button toggle. This can cause the border
18
- // of a selected toggle to look different from an deselected one. We use a solid
19
- // color to ensure that the border always stays the same.
20
- $divider-color: if(type-of($theme-divider-color) == color,
21
- theming.private-rgba-to-hex($theme-divider-color, map.get($background, card)),
22
- $theme-divider-color
23
- );
24
-
25
- .mat-button-toggle-standalone,
26
- .mat-button-toggle-group {
27
- @include private.private-theme-overridable-elevation(2, $config);
28
- }
29
-
30
- .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
31
- .mat-button-toggle-group-appearance-standard {
32
- &:not([class*='mat-elevation-z']) {
33
- box-shadow: none;
34
- }
35
- }
36
-
37
- .mat-button-toggle {
38
- color: theming.get-color-from-palette($foreground, hint-text);
39
-
40
- .mat-button-toggle-focus-overlay {
41
- background-color: theming.get-color-from-palette($background, focused-button);
42
- }
43
- }
44
-
45
- .mat-button-toggle-appearance-standard {
46
- color: theming.get-color-from-palette($foreground, text);
47
- background: theming.get-color-from-palette($background, card);
48
-
49
- .mat-button-toggle-focus-overlay {
50
- background-color: theming.get-color-from-palette($background, focused-button, 1);
51
- }
52
- }
53
-
54
- .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
55
- border-left: solid 1px $divider-color;
56
- }
57
-
58
- [dir='rtl'] .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
59
- border-left: none;
60
- border-right: solid 1px $divider-color;
61
- }
62
-
63
- .mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical {
64
- .mat-button-toggle + .mat-button-toggle {
65
- border-left: none;
66
- border-right: none;
67
- border-top: solid 1px $divider-color;
68
- }
69
- }
70
-
71
- .mat-button-toggle-checked {
72
- background-color: theming.get-color-from-palette($background, selected-button);
73
- color: theming.get-color-from-palette($foreground, secondary-text);
74
-
75
- &.mat-button-toggle-appearance-standard {
76
- color: theming.get-color-from-palette($foreground, text);
77
- }
78
- }
79
-
80
- .mat-button-toggle-disabled {
81
- color: theming.get-color-from-palette($foreground, disabled-button);
82
- background-color: theming.get-color-from-palette($background, disabled-button-toggle);
83
-
84
- &.mat-button-toggle-appearance-standard {
85
- background: theming.get-color-from-palette($background, card);
86
- }
87
-
88
- &.mat-button-toggle-checked {
89
- background-color: theming.get-color-from-palette($background, selected-disabled-button);
90
- }
91
- }
92
-
93
- .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
94
- .mat-button-toggle-group-appearance-standard {
95
- border: solid 1px $divider-color;
11
+ @include sass-utils.current-selector-or-root() {
12
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
13
+ tokens-mat-legacy-button-toggle.get-color-tokens($config));
14
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
15
+ tokens-mat-standard-button-toggle.get-color-tokens($config));
96
16
  }
97
17
  }
98
18
 
99
19
  @mixin typography($config-or-theme) {
100
20
  $config: typography.private-typography-to-2014-config(
101
21
  theming.get-typography-config($config-or-theme));
102
- .mat-button-toggle {
103
- font-family: typography-utils.font-family($config);
22
+
23
+ @include sass-utils.current-selector-or-root() {
24
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
25
+ tokens-mat-legacy-button-toggle.get-typography-tokens($config));
26
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
27
+ tokens-mat-standard-button-toggle.get-typography-tokens($config));
104
28
  }
105
29
  }
106
30
 
107
31
  @mixin density($config-or-theme) {
108
32
  $density-scale: theming.get-density-config($config-or-theme);
109
- $standard-height: compatibility.private-density-prop-value(
110
- button-toggle-variables.$standard-density-config, $density-scale, height);
111
33
 
112
- @include compatibility.private-density-legacy-compatibility() {
113
- .mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
114
- line-height: $standard-height;
115
- }
34
+ @include sass-utils.current-selector-or-root() {
35
+ @include token-utils.create-token-values(tokens-mat-legacy-button-toggle.$prefix,
36
+ tokens-mat-legacy-button-toggle.get-density-tokens($density-scale));
37
+ @include token-utils.create-token-values(tokens-mat-standard-button-toggle.$prefix,
38
+ tokens-mat-standard-button-toggle.get-density-tokens($density-scale));
116
39
  }
117
40
  }
118
41
 
@@ -1,3 +1,5 @@
1
+ // TODO(crisbeto): this file isn't used anymore and should be removed.
2
+
1
3
  $standard-height: 48px !default;
2
4
  // Minimum height for highest density can vary based on the content that developers
3
5
  // project into button-toggle's. We use a minimum of `24px` though because commonly
@@ -79,8 +79,24 @@
79
79
  }
80
80
 
81
81
  @mixin theme-from-tokens($tokens) {
82
- @include mdc-elevated-card-theme.theme(map.get($tokens, tokens-mdc-elevated-card.$prefix));
83
- @include mdc-outlined-card-theme.theme(map.get($tokens, tokens-mdc-outlined-card.$prefix));
84
- @include token-utils.create-token-values(
85
- tokens-mat-card.$prefix, map.get($tokens, tokens-mat-card.$prefix));
82
+ @if ($tokens != ()) {
83
+ $elevated-card-tokens: map.get($tokens, tokens-mdc-elevated-card.$prefix);
84
+ // Work around a bug in MDC where the elevation is not resolved to an actual shadow value.
85
+ $elevated-card-tokens: token-utils.resolve-elevation(
86
+ $elevated-card-tokens,
87
+ container-elevation,
88
+ container-shadow-color
89
+ );
90
+ $outlined-card-tokens: map.get($tokens, tokens-mdc-outlined-card.$prefix);
91
+ // Work around a bug in MDC where the elevation is not resolved to an actual shadow value.
92
+ $outlined-card-tokens: token-utils.resolve-elevation(
93
+ $outlined-card-tokens,
94
+ container-elevation,
95
+ container-shadow-color
96
+ );
97
+ @include mdc-elevated-card-theme.theme($elevated-card-tokens);
98
+ @include mdc-outlined-card-theme.theme($outlined-card-tokens);
99
+ @include token-utils.create-token-values(
100
+ tokens-mat-card.$prefix, map.get($tokens, tokens-mat-card.$prefix));
101
+ }
86
102
  }
@@ -90,7 +90,9 @@
90
90
  }
91
91
 
92
92
  @mixin theme-from-tokens($tokens) {
93
- // TODO(mmalerba): Some of the theme styles above are not represented in terms of tokens,
94
- // so this mixin is currently incomplete.
95
- @include mdc-checkbox-theme.theme(map.get($tokens, tokens-mdc-checkbox.$prefix));
93
+ @if ($tokens != ()) {
94
+ // TODO(mmalerba): Some of the theme styles above are not represented in terms of tokens,
95
+ // so this mixin is currently incomplete.
96
+ @include mdc-checkbox-theme.theme(map.get($tokens, tokens-mdc-checkbox.$prefix));
97
+ }
96
98
  }
package/chips/index.d.ts CHANGED
@@ -25,6 +25,7 @@ import { InjectionToken } from '@angular/core';
25
25
  import { MatFormField } from '@angular/material/form-field';
26
26
  import { MatFormFieldControl } from '@angular/material/form-field';
27
27
  import { MatRipple } from '@angular/material/core';
28
+ import { MatRippleLoader } from '@angular/material/core';
28
29
  import { NgControl } from '@angular/forms';
29
30
  import { NgForm } from '@angular/forms';
30
31
  import { NgZone } from '@angular/core';
@@ -146,14 +147,12 @@ export declare const MAT_CHIPS_DEFAULT_OPTIONS: InjectionToken<MatChipsDefaultOp
146
147
  *
147
148
  * Extended by MatChipOption and MatChipRow for different interaction patterns.
148
149
  */
149
- export declare class MatChip extends _MatChipMixinBase implements OnInit, AfterViewInit, AfterContentInit, CanColor, CanDisableRipple, CanDisable, HasTabIndex, OnDestroy {
150
+ export declare class MatChip extends _MatChipMixinBase implements OnInit, AfterViewInit, AfterContentInit, CanColor, CanDisableRipple, CanDisable, DoCheck, HasTabIndex, OnDestroy {
150
151
  _changeDetectorRef: ChangeDetectorRef;
151
152
  protected _ngZone: NgZone;
152
153
  private _focusMonitor;
153
154
  private _globalRippleOptions?;
154
155
  protected _document: Document;
155
- /** Whether the ripple is centered on the chip. */
156
- readonly _isRippleCentered = false;
157
156
  /** Emits when the chip is focused. */
158
157
  readonly _onFocus: Subject<MatChipEvent>;
159
158
  /** Emits when the chip is blurred. */
@@ -222,13 +221,20 @@ export declare class MatChip extends _MatChipMixinBase implements OnInit, AfterV
222
221
  * @deprecated Considered an implementation detail. To be removed.
223
222
  * @breaking-change 17.0.0
224
223
  */
225
- ripple: MatRipple;
224
+ get ripple(): MatRipple;
225
+ set ripple(v: MatRipple);
226
226
  /** Action receiving the primary set of user interactions. */
227
227
  primaryAction: MatChipAction;
228
+ /**
229
+ * Handles the lazy creation of the MatChip ripple.
230
+ * Used to improve initial load time of large applications.
231
+ */
232
+ _rippleLoader: MatRippleLoader;
228
233
  constructor(_changeDetectorRef: ChangeDetectorRef, elementRef: ElementRef<HTMLElement>, _ngZone: NgZone, _focusMonitor: FocusMonitor, _document: any, animationMode?: string, _globalRippleOptions?: RippleGlobalOptions | undefined, tabIndex?: string);
229
234
  ngOnInit(): void;
230
235
  ngAfterViewInit(): void;
231
236
  ngAfterContentInit(): void;
237
+ ngDoCheck(): void;
232
238
  ngOnDestroy(): void;
233
239
  /**
234
240
  * Allows for programmatic removal of the chip.
@@ -868,6 +874,7 @@ export declare class MatChipRow extends MatChip implements AfterViewInit {
868
874
  _handleDoubleclick(event: MouseEvent): void;
869
875
  private _startEditing;
870
876
  private _onEditFinish;
877
+ _isRippleDisabled(): boolean;
871
878
  /**
872
879
  * Gets the projected chip edit input, or the default input if none is projected in. One of these
873
880
  * two values is guaranteed to be defined.
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
  /**
@@ -820,6 +820,7 @@ export declare class MatRippleLoader implements OnDestroy {
820
820
  configureRipple(host: HTMLElement, config: {
821
821
  className?: string;
822
822
  centered?: boolean;
823
+ disabled?: boolean;
823
824
  }): void;
824
825
  /** Returns the ripple instance for the given host element. */
825
826
  getRipple(host: HTMLElement): MatRipple | undefined;
@@ -39,6 +39,8 @@ $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,
43
+ title: $_placeholder-typography-level-config,
42
44
  );
43
45
 
44
46
  // Placeholder density config that can be passed to token getter functions when generating token
@@ -0,0 +1,78 @@
1
+ @use 'sass:meta';
2
+ @use 'sass:map';
3
+ @use 'sass:color';
4
+ @use '../../token-utils';
5
+ @use '../../../typography/typography-utils';
6
+ @use '../../../theming/theming';
7
+ @use '../../../style/sass-utils';
8
+
9
+ // The prefix used to generate the fully qualified name for tokens in this file.
10
+ $prefix: (mat, badge);
11
+
12
+ // Tokens that can't be configured through Angular Material's current theming API,
13
+ // but may be in a future version of the theming API.
14
+ @function get-unthemable-tokens() {
15
+ @return ();
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
+ $primary-color-tokens: private-get-color-palette-color-tokens(map.get($config, primary));
23
+ $app-background: theming.get-color-from-palette($background, 'background');
24
+ $disabled-background: theming.get-color-from-palette($foreground, disabled-button);
25
+
26
+ // The disabled color usually has some kind of opacity, but because the badge is overlayed
27
+ // on top of something else, it won't look good if it's opaque. If it is a color *type*,
28
+ // we convert it into a solid color by taking the opacity from the rgba value and using
29
+ // the value to determine the percentage of the background to put into foreground when
30
+ // mixing the colors together.
31
+ @if (meta.type-of($disabled-background) == color and meta.type-of($app-background) == color) {
32
+ $badge-opacity: opacity($disabled-background);
33
+ $disabled-background: color.mix($app-background,
34
+ rgba($disabled-background, 1), (1 - $badge-opacity) * 100%);
35
+ }
36
+
37
+ @return map.merge($primary-color-tokens, (
38
+ disabled-state-background-color: $disabled-background,
39
+ disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-text),
40
+ ));
41
+ }
42
+
43
+ // Generates the tokens used to theme the badge based on a palette.
44
+ @function private-get-color-palette-color-tokens($palette) {
45
+ @return (
46
+ background-color: theming.get-color-from-palette($palette),
47
+ text-color: theming.get-color-from-palette($palette, default-contrast),
48
+ );
49
+ }
50
+
51
+ // Tokens that can be configured through Angular Material's typography theming API.
52
+ @function get-typography-tokens($config) {
53
+ $base-size: 12px;
54
+
55
+ @return (
56
+ text-font: typography-utils.font-family($config),
57
+ text-size: $base-size,
58
+ text-weight: 600,
59
+ small-size-text-size: $base-size * 0.75,
60
+ large-size-text-size: $base-size * 2,
61
+ );
62
+ }
63
+
64
+ // Tokens that can be configured through Angular Material's density theming API.
65
+ @function get-density-tokens($config) {
66
+ @return ();
67
+ }
68
+
69
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
70
+ // This is used to create token slots.
71
+ @function get-token-slots() {
72
+ @return sass-utils.deep-merge-all(
73
+ get-unthemable-tokens(),
74
+ get-color-tokens(token-utils.$placeholder-color-config),
75
+ get-typography-tokens(token-utils.$placeholder-typography-config),
76
+ get-density-tokens(token-utils.$placeholder-density-config)
77
+ );
78
+ }
@@ -0,0 +1,56 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../typography/typography-utils';
4
+ @use '../../../theming/theming';
5
+ @use '../../../style/sass-utils';
6
+
7
+ // The prefix used to generate the fully qualified name for tokens in this file.
8
+ $prefix: (mat, bottom-sheet);
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
+ // TODO: will be necessary for M3.
15
+ container-shape: 4px,
16
+ );
17
+ }
18
+
19
+ // Tokens that can be configured through Angular Material's color theming API.
20
+ @function get-color-tokens($config) {
21
+ $foreground: map.get($config, foreground);
22
+ $background: map.get($config, background);
23
+
24
+ @return (
25
+ container-text-color: theming.get-color-from-palette($foreground, text),
26
+ container-background-color: theming.get-color-from-palette($background, dialog),
27
+ );
28
+ }
29
+
30
+ // Tokens that can be configured through Angular Material's typography theming API.
31
+ @function get-typography-tokens($config) {
32
+ @return (
33
+ container-text-font: typography-utils.font-family($config, body-1) or
34
+ typography-utils.font-family($config),
35
+ container-text-line-height: typography-utils.line-height($config, body-1),
36
+ container-text-size: typography-utils.font-size($config, body-1),
37
+ container-text-tracking: typography-utils.letter-spacing($config, body-1),
38
+ container-text-weight: typography-utils.font-weight($config, body-1),
39
+ );
40
+ }
41
+
42
+ // Tokens that can be configured through Angular Material's density theming API.
43
+ @function get-density-tokens($config) {
44
+ @return ();
45
+ }
46
+
47
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
48
+ // This is used to create token slots.
49
+ @function get-token-slots() {
50
+ @return sass-utils.deep-merge-all(
51
+ get-unthemable-tokens(),
52
+ get-color-tokens(token-utils.$placeholder-color-config),
53
+ get-typography-tokens(token-utils.$placeholder-typography-config),
54
+ get-density-tokens(token-utils.$placeholder-density-config)
55
+ );
56
+ }
@@ -0,0 +1,184 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:meta';
4
+ @use 'sass:math';
5
+ @use '../../token-utils';
6
+ @use '../../../theming/theming';
7
+ @use '../../../typography/typography-utils';
8
+ @use '../../../style/sass-utils';
9
+
10
+ // The prefix used to generate the fully qualified name for tokens in this file.
11
+ $prefix: (mat, datepicker);
12
+
13
+ $_selected-fade-amount: 0.6;
14
+ $_today-fade-amount: 0.2;
15
+
16
+ // Utility that produces a range background color from a specific color.
17
+ @function private-get-range-background-color($color) {
18
+ @return rgba($color, 0.2);
19
+ }
20
+
21
+ // Utility that produces the overlap selected color from an overlap color.
22
+ @function private-get-default-overlap-selected-color($overlap-color) {
23
+ @return color.adjust($overlap-color, $lightness: -30%);
24
+ }
25
+
26
+ // Default range comparison color.
27
+ $private-default-comparison-color: private-get-range-background-color(#f9ab00);
28
+
29
+ // Default range overlap color.
30
+ $private-default-overlap-color: #a8dab5;
31
+
32
+ // Tokens that can't be configured through Angular Material's current theming API,
33
+ // but may be in a future version of the theming API.
34
+ @function get-unthemable-tokens() {
35
+ @return ();
36
+ }
37
+
38
+ // Tokens that can be configured through Angular Material's color theming API.
39
+ @function get-color-tokens($config) {
40
+ $foreground: map.get($config, foreground);
41
+ $background: map.get($config, background);
42
+ $primary: map.get($config, primary);
43
+ $inactive-icon-color: theming.get-color-from-palette($foreground, icon);
44
+ $text-color: theming.get-color-from-palette($foreground, text);
45
+ $secondary-text-color: theming.get-color-from-palette($foreground, secondary-text);
46
+ $disabled-text-color: theming.get-color-from-palette($foreground, disabled-text);
47
+ $divider-color: theming.get-color-from-palette($foreground, divider);
48
+ $hint-text-color: theming.get-color-from-palette($foreground, hint-text);
49
+ $preview-outline-color: $divider-color;
50
+ $today-disabled-outline-color: null;
51
+
52
+ $primary-color: theming.get-color-from-palette(map.get($config, primary));
53
+ $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
54
+ $calendar-tokens: private-get-calendar-color-palette-color-tokens($config, primary);
55
+ $toggle-tokens: private-get-toggle-color-palette-color-tokens($config, primary);
56
+
57
+ // The divider color is set under the assumption that it'll be used
58
+ // for a solid border, but because we're using a dashed border for the
59
+ // preview range, we need to bump its opacity to ensure that it's visible.
60
+ @if meta.type-of($preview-outline-color) == color {
61
+ $preview-outline-opacity: math.min(opacity($preview-outline-color) * 2, 1);
62
+ $preview-outline-color: rgba($preview-outline-color, $preview-outline-opacity);
63
+ }
64
+
65
+ @if (meta.type-of($hint-text-color) == color) {
66
+ $today-disabled-outline-color: color.adjust($hint-text-color, $alpha: -$_today-fade-amount);
67
+ }
68
+ @else {
69
+ $today-disabled-outline-color: $disabled-text-color;
70
+ }
71
+
72
+ @return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
73
+ toggle-icon-color: $inactive-icon-color,
74
+ calendar-body-label-text-color: $secondary-text-color,
75
+ calendar-period-button-icon-color: $inactive-icon-color,
76
+ calendar-navigation-button-icon-color: $inactive-icon-color,
77
+ calendar-header-divider-color: $divider-color,
78
+ calendar-header-text-color: $secondary-text-color,
79
+
80
+ // Note: though it's not text, the border is a hint about the fact
81
+ // that this is today's date, so we use the hint color.
82
+ calendar-date-today-outline-color: $hint-text-color,
83
+ calendar-date-today-disabled-state-outline-color: $today-disabled-outline-color,
84
+ calendar-date-text-color: $text-color,
85
+ calendar-date-outline-color: transparent,
86
+ calendar-date-disabled-state-text-color: $disabled-text-color,
87
+ calendar-date-preview-state-outline-color: $preview-outline-color,
88
+
89
+ range-input-separator-color: $text-color,
90
+ range-input-disabled-state-separator-color: $disabled-text-color,
91
+ range-input-disabled-state-text-color: $disabled-text-color,
92
+
93
+ calendar-container-background-color: theming.get-color-from-palette($background, card),
94
+ calendar-container-text-color: $text-color,
95
+ ));
96
+ }
97
+
98
+ // Tokens that can be configured through Angular Material's typography theming API.
99
+ @function get-typography-tokens($config) {
100
+ $fallback-font: typography-utils.font-family($config);
101
+
102
+ @return (
103
+ // TODO(crisbeto): the typography tokens for other components set every typography dimension of
104
+ // an element (e.g. size, weight, line height, letter spacing). These tokens only set the values
105
+ // that were set in the previous theming API to reduce the amount of subtle screenshot
106
+ // differences. We should look into introducing the other tokens in a follow-up.
107
+ calendar-text-font: $fallback-font,
108
+ calendar-text-size: 13px, // TODO(crisbeto): this doesn't appear to affect anything
109
+
110
+ calendar-body-label-text-size: typography-utils.font-size($config, button),
111
+ calendar-body-label-text-weight: typography-utils.font-weight($config, button),
112
+
113
+ calendar-period-button-text-size: typography-utils.font-size($config, button),
114
+ calendar-period-button-text-weight: typography-utils.font-weight($config, button),
115
+
116
+ calendar-header-text-size: 11px,
117
+ calendar-header-text-weight: typography-utils.font-weight($config, body-1),
118
+ );
119
+ }
120
+
121
+ // Gets the tokens map that can be used to override the range colors.
122
+ @function get-range-color-tokens(
123
+ $range-color,
124
+ $comparison-color: $private-default-comparison-color,
125
+ $overlap-color: $private-default-overlap-color,
126
+ $overlap-selected-color: private-get-default-overlap-selected-color($overlap-color)) {
127
+
128
+ @return (
129
+ calendar-date-in-range-state-background-color: $range-color,
130
+ calendar-date-in-comparison-range-state-background-color: $comparison-color,
131
+ calendar-date-in-overlap-range-state-background-color: $overlap-color,
132
+ calendar-date-in-overlap-range-selected-state-background-color: $overlap-selected-color,
133
+ );
134
+ }
135
+
136
+ @function private-get-calendar-color-palette-color-tokens($config, $palette-name) {
137
+ $foreground: map.get($config, foreground);
138
+ $palette: map.get($config, $palette-name);
139
+ $palette-color: theming.get-color-from-palette($palette);
140
+ $default-contrast: theming.get-color-from-palette($palette, default-contrast);
141
+ $active-background-color: theming.get-color-from-palette($palette, 0.3);
142
+ $active-disabled-color: null;
143
+
144
+ @if (meta.type-of($palette-color) == color) {
145
+ $active-disabled-color: color.adjust($palette-color, $alpha: -$_selected-fade-amount);
146
+ }
147
+ @else {
148
+ $active-disabled-color: theming.get-color-from-palette($foreground, disabled-button);
149
+ }
150
+
151
+ @return (
152
+ calendar-date-selected-state-text-color: $default-contrast,
153
+ calendar-date-selected-state-background-color: $palette-color,
154
+ calendar-date-selected-disabled-state-background-color: $active-disabled-color,
155
+ calendar-date-today-selected-state-outline-color: $default-contrast,
156
+ calendar-date-focus-state-background-color: $active-background-color,
157
+ calendar-date-hover-state-background-color: $active-background-color,
158
+ );
159
+ }
160
+
161
+ @function private-get-toggle-color-palette-color-tokens($config, $palette-name) {
162
+ $palette: map.get($config, $palette-name);
163
+
164
+ @return (
165
+ toggle-active-state-icon-color: theming.get-color-from-palette($palette, text),
166
+ );
167
+ }
168
+
169
+
170
+ // Tokens that can be configured through Angular Material's density theming API.
171
+ @function get-density-tokens($config) {
172
+ @return ();
173
+ }
174
+
175
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
176
+ // This is used to create token slots.
177
+ @function get-token-slots() {
178
+ @return sass-utils.deep-merge-all(
179
+ get-unthemable-tokens(),
180
+ get-color-tokens(token-utils.$placeholder-color-config),
181
+ get-typography-tokens(token-utils.$placeholder-typography-config),
182
+ get-density-tokens(token-utils.$placeholder-density-config)
183
+ );
184
+ }
@@ -0,0 +1,45 @@
1
+ @use 'sass:map';
2
+ @use '../../token-utils';
3
+ @use '../../../theming/theming';
4
+ @use '../../../style/sass-utils';
5
+
6
+ // The prefix used to generate the fully qualified name for tokens in this file.
7
+ $prefix: (mat, divider);
8
+
9
+ // Tokens that can't be configured through Angular Material's current theming API,
10
+ // but may be in a future version of the theming API.
11
+ @function get-unthemable-tokens() {
12
+ @return (
13
+ width: 1px
14
+ );
15
+ }
16
+
17
+ // Tokens that can be configured through Angular Material's color theming API.
18
+ @function get-color-tokens($config) {
19
+ $foreground: map.get($config, foreground);
20
+
21
+ @return (
22
+ color: theming.get-color-from-palette($foreground, divider)
23
+ );
24
+ }
25
+
26
+ // Tokens that can be configured through Angular Material's typography theming API.
27
+ @function get-typography-tokens($config) {
28
+ @return ();
29
+ }
30
+
31
+ // Tokens that can be configured through Angular Material's density theming API.
32
+ @function get-density-tokens($config) {
33
+ @return ();
34
+ }
35
+
36
+ // Combines the tokens generated by the above functions into a single map with placeholder values.
37
+ // This is used to create token slots.
38
+ @function get-token-slots() {
39
+ @return sass-utils.deep-merge-all(
40
+ get-unthemable-tokens(),
41
+ get-color-tokens(token-utils.$placeholder-color-config),
42
+ get-typography-tokens(token-utils.$placeholder-typography-config),
43
+ get-density-tokens(token-utils.$placeholder-density-config)
44
+ );
45
+ }