@angular/material 20.0.4 → 20.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 (219) hide show
  1. package/_index.scss +0 -1
  2. package/autocomplete/_m2-autocomplete.scss +5 -15
  3. package/badge/_badge-theme.scss +2 -2
  4. package/badge/_m2-badge.scss +13 -34
  5. package/bottom-sheet/_m2-bottom-sheet.scss +6 -15
  6. package/button/_button-theme.scss +2 -2
  7. package/button/_fab-theme.scss +2 -2
  8. package/button/_icon-button-theme.scss +2 -2
  9. package/button/_m2-button.scss +83 -127
  10. package/button/_m2-fab.scss +40 -68
  11. package/button/_m2-icon-button.scss +18 -30
  12. package/button/testing/index.d.ts +0 -1
  13. package/button-toggle/_button-toggle-theme.scss +2 -1
  14. package/button-toggle/_m2-button-toggle.scss +24 -49
  15. package/card/_m2-card.scss +9 -18
  16. package/checkbox/_checkbox-theme.scss +4 -3
  17. package/checkbox/_m2-checkbox.scss +33 -62
  18. package/chips/_chips-theme.scss +7 -4
  19. package/chips/_m2-chip.scss +22 -47
  20. package/chips/index.d.ts +56 -4
  21. package/chips/testing/index.d.ts +23 -2
  22. package/core/_m2-app.scss +6 -19
  23. package/core/m2/_theming.scss +89 -79
  24. package/core/option/_m2-optgroup.scss +3 -13
  25. package/core/option/_m2-option.scss +14 -21
  26. package/core/option/_option-theme.scss +3 -3
  27. package/core/ripple/_m2-ripple.scss +5 -22
  28. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +11 -22
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +3 -3
  30. package/core/style/_private.scss +6 -9
  31. package/core/style/_sass-utils.scss +0 -29
  32. package/core/tokens/_m2-utils.scss +10 -42
  33. package/{date-range-input-harness.d-CaEyN8dT.d.ts → date-range-input-harness.d-CJ4r85Uf.d.ts} +7 -4
  34. package/datepicker/_datepicker-theme.scss +16 -50
  35. package/datepicker/_m2-datepicker.scss +45 -137
  36. package/datepicker/testing/index.d.ts +3 -3
  37. package/dialog/_m2-dialog.scss +6 -25
  38. package/divider/_m2-divider.scss +3 -14
  39. package/expansion/_m2-expansion.scss +15 -25
  40. package/fesm2022/animation-DfMFjxHu.mjs.map +1 -1
  41. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  42. package/fesm2022/autocomplete.mjs +1 -1
  43. package/fesm2022/autocomplete.mjs.map +1 -1
  44. package/fesm2022/badge/testing.mjs.map +1 -1
  45. package/fesm2022/badge.mjs.map +1 -1
  46. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  47. package/fesm2022/bottom-sheet.mjs.map +1 -1
  48. package/fesm2022/button/testing.mjs +4 -7
  49. package/fesm2022/button/testing.mjs.map +1 -1
  50. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  51. package/fesm2022/button-toggle.mjs.map +1 -1
  52. package/fesm2022/button.mjs +2 -2
  53. package/fesm2022/button.mjs.map +1 -1
  54. package/fesm2022/card/testing.mjs.map +1 -1
  55. package/fesm2022/card.mjs.map +1 -1
  56. package/fesm2022/checkbox/testing.mjs.map +1 -1
  57. package/fesm2022/checkbox.mjs.map +1 -1
  58. package/fesm2022/chips/testing.mjs +26 -1
  59. package/fesm2022/chips/testing.mjs.map +1 -1
  60. package/fesm2022/chips.mjs +132 -14
  61. package/fesm2022/chips.mjs.map +1 -1
  62. package/fesm2022/common-module-cKSwHniA.mjs.map +1 -1
  63. package/fesm2022/core/testing.mjs.map +1 -1
  64. package/fesm2022/core.mjs +1 -1
  65. package/fesm2022/core.mjs.map +1 -1
  66. package/fesm2022/date-formats-K6TQue-Y.mjs.map +1 -1
  67. package/fesm2022/{date-range-input-harness-Bp1T4oUe.mjs → date-range-input-harness-DEyfkeOs.mjs} +32 -4
  68. package/fesm2022/date-range-input-harness-DEyfkeOs.mjs.map +1 -0
  69. package/fesm2022/datepicker/testing.mjs +3 -3
  70. package/fesm2022/datepicker/testing.mjs.map +1 -1
  71. package/fesm2022/datepicker.mjs +1 -1
  72. package/fesm2022/datepicker.mjs.map +1 -1
  73. package/fesm2022/dialog/testing.mjs.map +1 -1
  74. package/fesm2022/dialog.mjs.map +1 -1
  75. package/fesm2022/divider/testing.mjs.map +1 -1
  76. package/fesm2022/divider.mjs.map +1 -1
  77. package/fesm2022/error-options-DCNQlTOA.mjs.map +1 -1
  78. package/fesm2022/error-state-Dtb1IHM-.mjs.map +1 -1
  79. package/fesm2022/expansion/testing.mjs.map +1 -1
  80. package/fesm2022/expansion.mjs.map +1 -1
  81. package/fesm2022/form-field/testing/control.mjs +26 -1
  82. package/fesm2022/form-field/testing/control.mjs.map +1 -1
  83. package/fesm2022/form-field/testing.mjs +4 -4
  84. package/fesm2022/form-field/testing.mjs.map +1 -1
  85. package/fesm2022/{form-field-CFbrnFED.mjs → form-field-C9DZXojn.mjs} +3 -3
  86. package/fesm2022/form-field-C9DZXojn.mjs.map +1 -0
  87. package/fesm2022/form-field.mjs +2 -2
  88. package/fesm2022/form-field.mjs.map +1 -1
  89. package/fesm2022/grid-list/testing.mjs.map +1 -1
  90. package/fesm2022/grid-list.mjs.map +1 -1
  91. package/fesm2022/icon/testing.mjs.map +1 -1
  92. package/fesm2022/icon-button-DxiIc1ex.mjs.map +1 -1
  93. package/fesm2022/icon-registry-CwOTJ7YM.mjs.map +1 -1
  94. package/fesm2022/icon.mjs.map +1 -1
  95. package/fesm2022/index-BFRo2fUq.mjs.map +1 -1
  96. package/fesm2022/index-DwiL-HGk.mjs.map +1 -1
  97. package/fesm2022/input/testing.mjs +7 -4
  98. package/fesm2022/input/testing.mjs.map +1 -1
  99. package/fesm2022/{input-harness-oQzj5EsQ.mjs → input-harness-C5Msdc4-.mjs} +6 -3
  100. package/fesm2022/input-harness-C5Msdc4-.mjs.map +1 -0
  101. package/fesm2022/input-value-accessor-D1GvPuqO.mjs.map +1 -1
  102. package/fesm2022/input.mjs +27 -3
  103. package/fesm2022/input.mjs.map +1 -1
  104. package/fesm2022/internal-form-field-D5iFxU6d.mjs.map +1 -1
  105. package/fesm2022/line-Bz5f9Cyx.mjs.map +1 -1
  106. package/fesm2022/list/testing.mjs.map +1 -1
  107. package/fesm2022/list.mjs.map +1 -1
  108. package/fesm2022/material.mjs.map +1 -1
  109. package/fesm2022/menu/testing.mjs.map +1 -1
  110. package/fesm2022/menu.mjs +11 -2
  111. package/fesm2022/menu.mjs.map +1 -1
  112. package/fesm2022/{module-B0CLRw5e.mjs → module-BDiw_nWS.mjs} +3 -3
  113. package/fesm2022/module-BDiw_nWS.mjs.map +1 -0
  114. package/fesm2022/module-CWxMD37a.mjs.map +1 -1
  115. package/fesm2022/module-Ce6F7TNm.mjs.map +1 -1
  116. package/fesm2022/{module-B62K-792.mjs → module-DzZHEh7B.mjs} +2 -2
  117. package/fesm2022/module-DzZHEh7B.mjs.map +1 -0
  118. package/fesm2022/option-BzhYL_xC.mjs.map +1 -1
  119. package/fesm2022/option-harness-BFcc-M_4.mjs.map +1 -1
  120. package/fesm2022/paginator/testing.mjs +2 -3
  121. package/fesm2022/paginator/testing.mjs.map +1 -1
  122. package/fesm2022/paginator.mjs +3 -3
  123. package/fesm2022/paginator.mjs.map +1 -1
  124. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  125. package/fesm2022/progress-bar.mjs.map +1 -1
  126. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  127. package/fesm2022/progress-spinner.mjs.map +1 -1
  128. package/fesm2022/pseudo-checkbox-DDmgx3P4.mjs.map +1 -1
  129. package/fesm2022/pseudo-checkbox-module-4F8Up4PL.mjs.map +1 -1
  130. package/fesm2022/public-api-BoO5eSq-.mjs.map +1 -1
  131. package/fesm2022/radio/testing.mjs.map +1 -1
  132. package/fesm2022/radio.mjs.map +1 -1
  133. package/fesm2022/ripple-BYgV4oZC.mjs.map +1 -1
  134. package/fesm2022/ripple-loader-BnMiRtmT.mjs.map +1 -1
  135. package/fesm2022/select/testing.mjs +8 -5
  136. package/fesm2022/select/testing.mjs.map +1 -1
  137. package/fesm2022/select.mjs +3 -3
  138. package/fesm2022/select.mjs.map +1 -1
  139. package/fesm2022/sidenav/testing.mjs.map +1 -1
  140. package/fesm2022/sidenav.mjs.map +1 -1
  141. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  142. package/fesm2022/slide-toggle.mjs.map +1 -1
  143. package/fesm2022/slider/testing.mjs.map +1 -1
  144. package/fesm2022/slider.mjs.map +1 -1
  145. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  146. package/fesm2022/snack-bar.mjs.map +1 -1
  147. package/fesm2022/sort/testing.mjs.map +1 -1
  148. package/fesm2022/sort.mjs.map +1 -1
  149. package/fesm2022/stepper/testing.mjs.map +1 -1
  150. package/fesm2022/stepper.mjs +2 -2
  151. package/fesm2022/stepper.mjs.map +1 -1
  152. package/fesm2022/structural-styles-CObeNzjn.mjs.map +1 -1
  153. package/fesm2022/table/testing.mjs.map +1 -1
  154. package/fesm2022/table.mjs.map +1 -1
  155. package/fesm2022/tabs/testing.mjs.map +1 -1
  156. package/fesm2022/tabs.mjs.map +1 -1
  157. package/fesm2022/timepicker/testing.mjs.map +1 -1
  158. package/fesm2022/timepicker.mjs +1 -1
  159. package/fesm2022/timepicker.mjs.map +1 -1
  160. package/fesm2022/toolbar/testing.mjs.map +1 -1
  161. package/fesm2022/toolbar.mjs.map +1 -1
  162. package/fesm2022/tooltip/testing.mjs.map +1 -1
  163. package/fesm2022/tooltip.mjs.map +1 -1
  164. package/fesm2022/tree/testing.mjs.map +1 -1
  165. package/fesm2022/tree.mjs.map +1 -1
  166. package/form-field/_form-field-theme.scss +2 -2
  167. package/form-field/_m2-form-field.scss +59 -93
  168. package/form-field/testing/control/index.d.ts +8 -5
  169. package/form-field/testing/index.d.ts +5 -5
  170. package/form-field-control-harness.d-BLvFBy6v.d.ts +18 -0
  171. package/grid-list/_m2-grid-list.scss +0 -13
  172. package/icon/_m2-icon.scss +0 -13
  173. package/input/index.d.ts +11 -0
  174. package/input/testing/index.d.ts +5 -4
  175. package/{input-harness.d-8fkAAbu2.d.ts → input-harness.d-DVI6ttzl.d.ts} +4 -4
  176. package/list/_list-theme.scss +10 -5
  177. package/list/_m2-list.scss +19 -37
  178. package/menu/_m2-menu.scss +12 -23
  179. package/menu/index.d.ts +2 -0
  180. package/package.json +6 -6
  181. package/paginator/_m2-paginator.scss +7 -18
  182. package/paginator/testing/index.d.ts +2 -3
  183. package/prebuilt-themes/deeppurple-amber.css +1 -1
  184. package/prebuilt-themes/indigo-pink.css +1 -1
  185. package/prebuilt-themes/pink-bluegrey.css +1 -1
  186. package/prebuilt-themes/purple-green.css +1 -1
  187. package/progress-bar/_m2-progress-bar.scss +11 -20
  188. package/progress-bar/_progress-bar-theme.scss +2 -2
  189. package/progress-spinner/_m2-progress-spinner.scss +7 -15
  190. package/progress-spinner/_progress-spinner-theme.scss +2 -2
  191. package/radio/_m2-radio.scss +21 -32
  192. package/radio/_radio-theme.scss +6 -3
  193. package/schematics/ng-add/index.js +2 -2
  194. package/select/_m2-select.scss +14 -36
  195. package/select/_select-theme.scss +6 -3
  196. package/select/testing/index.d.ts +5 -6
  197. package/sidenav/_m2-sidenav.scss +10 -20
  198. package/slide-toggle/_m2-slide-toggle.scss +13 -20
  199. package/slide-toggle/_slide-toggle-theme.scss +3 -2
  200. package/slider/_m2-slider.scss +27 -39
  201. package/slider/_slider-theme.scss +2 -2
  202. package/snack-bar/_m2-snack-bar.scss +5 -22
  203. package/sort/_m2-sort.scss +3 -33
  204. package/stepper/_m2-stepper.scss +23 -34
  205. package/stepper/_m3-stepper.scss +2 -2
  206. package/stepper/_stepper-theme.scss +2 -2
  207. package/table/_m2-table.scss +6 -17
  208. package/tabs/_m2-tabs.scss +19 -36
  209. package/tabs/_tabs-theme.scss +4 -4
  210. package/timepicker/_m2-timepicker.scss +5 -15
  211. package/toolbar/_m2-toolbar.scss +4 -15
  212. package/tooltip/_m2-tooltip.scss +4 -14
  213. package/tree/_m2-tree.scss +4 -16
  214. package/core/tokens/_m2-tokens.scss +0 -131
  215. package/fesm2022/date-range-input-harness-Bp1T4oUe.mjs.map +0 -1
  216. package/fesm2022/form-field-CFbrnFED.mjs.map +0 -1
  217. package/fesm2022/input-harness-oQzj5EsQ.mjs.map +0 -1
  218. package/fesm2022/module-B0CLRw5e.mjs.map +0 -1
  219. package/fesm2022/module-B62K-792.mjs.map +0 -1
@@ -1,6 +1,7 @@
1
- @use '../../tokens/m2-utils';
2
1
  @use '../../theming/inspection';
3
- @use '../../style/sass-utils';
2
+ @use 'sass:map';
3
+ @use '../../tokens/m2-utils';
4
+ @use '../../tokens/m3-utils';
4
5
 
5
6
  // Tokens that can't be configured through Angular Material's current theming API,
6
7
  // but may be in a future version of the theming API.
@@ -9,21 +10,20 @@
9
10
  }
10
11
 
11
12
  // Tokens that can be configured through Angular Material's color theming API.
12
- @function get-color-tokens($theme, $palette-name: accent) {
13
+ @function get-color-tokens($theme, $color-variant) {
13
14
  $is-dark: inspection.get-theme-type($theme) == dark;
14
15
  $disabled-color: if($is-dark, #686868, #b0b0b0);
15
- $checkmark-color: inspection.get-theme-color($theme, background, background);
16
+ $system: m2-utils.get-system($theme);
17
+ $system: m3-utils.replace-colors-with-variant($system, secondary, $color-variant);
16
18
 
17
19
  @return (
18
- pseudo-checkbox-full-selected-icon-color: inspection.get-theme-color($theme, $palette-name),
19
- pseudo-checkbox-full-selected-checkmark-color: $checkmark-color,
20
- pseudo-checkbox-full-unselected-icon-color:
21
- inspection.get-theme-color($theme, foreground, secondary-text),
22
- pseudo-checkbox-full-disabled-selected-checkmark-color: $checkmark-color,
20
+ pseudo-checkbox-full-selected-icon-color: map.get($system, secondary),
21
+ pseudo-checkbox-full-selected-checkmark-color: map.get($system, background),
22
+ pseudo-checkbox-full-unselected-icon-color: map.get($system, on-surface-variant),
23
+ pseudo-checkbox-full-disabled-selected-checkmark-color: map.get($system, background),
23
24
  pseudo-checkbox-full-disabled-unselected-icon-color: $disabled-color,
24
25
  pseudo-checkbox-full-disabled-selected-icon-color: $disabled-color,
25
- pseudo-checkbox-minimal-selected-checkmark-color:
26
- inspection.get-theme-color($theme, $palette-name),
26
+ pseudo-checkbox-minimal-selected-checkmark-color: map.get($system, secondary),
27
27
  pseudo-checkbox-minimal-disabled-selected-checkmark-color: if($is-dark, #686868, #b0b0b0),
28
28
  );
29
29
  }
@@ -37,14 +37,3 @@
37
37
  @function get-density-tokens($theme) {
38
38
  @return ();
39
39
  }
40
-
41
- // Combines the tokens generated by the above functions into a single map with placeholder values.
42
- // This is used to create token slots.
43
- @function get-token-slots() {
44
- @return sass-utils.deep-merge-all(
45
- get-unthemable-tokens(),
46
- get-color-tokens(m2-utils.$placeholder-color-config),
47
- get-typography-tokens(m2-utils.$placeholder-typography-config),
48
- get-density-tokens(m2-utils.$placeholder-density-config)
49
- );
50
- }
@@ -48,18 +48,18 @@
48
48
  // don't attach to the `mat-*` classes. Also note that this needs to be below `.mat-primary`
49
49
  // in order to allow for the color to be overwritten if the checkbox is inside a parent that
50
50
  // has `mat-accent` and is placed inside another parent that has `mat-primary`.
51
- @include _palette-styles($theme, accent);
51
+ @include _palette-styles($theme, secondary);
52
52
 
53
53
  .mat-primary {
54
54
  @include _palette-styles($theme, primary);
55
55
  }
56
56
 
57
57
  .mat-accent {
58
- @include _palette-styles($theme, accent);
58
+ @include _palette-styles($theme, secondary);
59
59
  }
60
60
 
61
61
  .mat-warn {
62
- @include _palette-styles($theme, warn);
62
+ @include _palette-styles($theme, error);
63
63
  }
64
64
  }
65
65
  }
@@ -1,18 +1,15 @@
1
1
  @use './elevation';
2
- @use '../theming/inspection';
2
+ @use '../tokens/m2-utils';
3
+ @use 'sass:map';
3
4
 
4
5
  @mixin private-theme-elevation($zValue, $theme) {
5
- $elevation-color: inspection.get-theme-color($theme, foreground, elevation);
6
- $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
7
-
8
- @include elevation.elevation($zValue, $elevation-color-or-default);
6
+ $system: m2-utils.get-system($theme);
7
+ @include elevation.elevation($zValue, map.get($system, shadow));
9
8
  }
10
9
 
11
10
  @mixin private-theme-overridable-elevation($zValue, $theme) {
12
- $elevation-color: inspection.get-theme-color($theme, foreground, elevation);
13
- $elevation-color-or-default: if($elevation-color == null, elevation.$color, $elevation-color);
14
-
15
- @include elevation.overridable-elevation($zValue, $elevation-color-or-default);
11
+ $system: m2-utils.get-system($theme);
12
+ @include elevation.overridable-elevation($zValue, map.get($system, shadow));
16
13
  }
17
14
 
18
15
  // If the mat-animation-noop class is present on the components root element,
@@ -1,4 +1,3 @@
1
- @use 'sass:color';
2
1
  @use 'sass:string';
3
2
  @use 'sass:map';
4
3
  @use 'sass:meta';
@@ -51,34 +50,6 @@ $use-system-typography-variables: false;
51
50
  @return $result;
52
51
  }
53
52
 
54
- /// A version of the Sass `color.change` function that is safe ot use with CSS variables.
55
- @function safe-color-change($color, $args...) {
56
- $args: meta.keywords($args);
57
- $use-color-mix: $use-system-color-variables or
58
- (is-css-var-name($color) and string.index($color, '--mat') == 1);
59
- @if (meta.type-of($color) == 'color') {
60
- @return color.change($color, $args...);
61
- }
62
- @else if ($color != null and
63
- map.get($args, alpha) != null and $use-color-mix) {
64
- $opacity: map.get($args, alpha);
65
- @if meta.type-of($opacity) == number {
66
- $opacity: ($opacity * 100) + '%';
67
- }
68
-
69
- @if (is-css-var-name($opacity)) {
70
- $opacity: calc(var($opacity) * 100%);
71
- }
72
-
73
- @if (is-css-var-name($color)) {
74
- $color: var($color);
75
- }
76
-
77
- @return #{color-mix(in srgb, #{$color} #{$opacity}, transparent)};
78
- }
79
- @return $color;
80
- }
81
-
82
53
  // Returns whether the $value is a CSS variable name based on whether it's a string prefixed
83
54
  // by "--".
84
55
  @function is-css-var-name($value) {
@@ -1,52 +1,20 @@
1
- @use '../m2/palette';
2
- @use '../m2/theming';
3
- @use '../m2/typography';
4
1
  @use 'sass:color';
5
2
  @use 'sass:math';
6
3
  @use 'sass:meta';
7
-
8
- $_placeholder-color-palette: theming.define-palette(palette.$red-palette);
4
+ @use 'sass:map';
9
5
 
10
6
  // Indicates whether we're building internally. Used for backwards compatibility.
11
7
  $private-is-internal-build: false;
12
8
 
13
- // Placeholder color config that can be passed to token getter functions when generating token
14
- // slots.
15
- $placeholder-color-config: (
16
- primary: $_placeholder-color-palette,
17
- accent: $_placeholder-color-palette,
18
- warn: $_placeholder-color-palette,
19
- is-dark: false,
20
- foreground: palette.$light-theme-foreground-palette,
21
- background: palette.$light-theme-background-palette,
22
- );
23
-
24
- $_placeholder-typography-level-config: typography.typography-config-level-from-mdc(body1);
25
-
26
- // Placeholder typography config that can be passed to token getter functions when generating token
27
- // slots.
28
- $placeholder-typography-config: (
29
- font-family: 'Roboto, sans-serif',
30
- headline-1: $_placeholder-typography-level-config,
31
- headline-2: $_placeholder-typography-level-config,
32
- headline-3: $_placeholder-typography-level-config,
33
- headline-4: $_placeholder-typography-level-config,
34
- headline-5: $_placeholder-typography-level-config,
35
- headline-6: $_placeholder-typography-level-config,
36
- subtitle-1: $_placeholder-typography-level-config,
37
- subtitle-2: $_placeholder-typography-level-config,
38
- body-1: $_placeholder-typography-level-config,
39
- body-2: $_placeholder-typography-level-config,
40
- caption: $_placeholder-typography-level-config,
41
- button: $_placeholder-typography-level-config,
42
- overline: $_placeholder-typography-level-config,
43
- subheading-1: $_placeholder-typography-level-config,
44
- title: $_placeholder-typography-level-config,
45
- );
46
-
47
- // Placeholder density config that can be passed to token getter functions when generating token
48
- // slots.
49
- $placeholder-density-config: 0;
9
+ // Gets the theme's system values as a flat map.
10
+ @function get-system($theme) {
11
+ $system: map.get($theme, _mat-system);
12
+ @if $system {
13
+ @return $system;
14
+ }
15
+
16
+ @return ();
17
+ }
50
18
 
51
19
  /// Inherited function from MDC that computes which contrast tone to use on top of a color.
52
20
  /// This is used only in a narrow set of use cases when generating M2 button tokens to maintain
@@ -1,8 +1,8 @@
1
1
  import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
2
- import { MatFormFieldControlHarness } from './form-field/testing/control/index.js';
2
+ import { MatFormFieldControlHarnessFilters, MatFormFieldControlHarnessBase } from '@angular/material/form-field/testing/control';
3
3
 
4
4
  /** A set of criteria that can be used to filter a list of datepicker input instances. */
5
- interface DatepickerInputHarnessFilters extends BaseHarnessFilters {
5
+ interface DatepickerInputHarnessFilters extends MatFormFieldControlHarnessFilters {
6
6
  /** Filters based on the value of the input. */
7
7
  value?: string | RegExp;
8
8
  /** Filters based on the placeholder text of the input. */
@@ -34,13 +34,13 @@ interface CalendarCellHarnessFilters extends BaseHarnessFilters {
34
34
  inPreviewRange?: boolean;
35
35
  }
36
36
  /** A set of criteria that can be used to filter a list of date range input instances. */
37
- interface DateRangeInputHarnessFilters extends BaseHarnessFilters {
37
+ interface DateRangeInputHarnessFilters extends MatFormFieldControlHarnessFilters {
38
38
  /** Filters based on the value of the input. */
39
39
  value?: string | RegExp;
40
40
  }
41
41
 
42
42
  /** Base class for datepicker input harnesses. */
43
- declare abstract class MatDatepickerInputHarnessBase extends MatFormFieldControlHarness {
43
+ declare abstract class MatDatepickerInputHarnessBase extends MatFormFieldControlHarnessBase {
44
44
  /** Whether the input is disabled. */
45
45
  isDisabled(): Promise<boolean>;
46
46
  /** Whether the input is required. */
@@ -251,6 +251,7 @@ declare class MatEndDateHarness extends MatDatepickerInputHarnessBase {
251
251
  /** Harness for interacting with a standard Material date range input in tests. */
252
252
  declare class MatDateRangeInputHarness extends DatepickerTriggerHarnessBase {
253
253
  static hostSelector: string;
254
+ private readonly _floatingLabelSelector;
254
255
  /**
255
256
  * Gets a `HarnessPredicate` that can be used to search for a `MatDateRangeInputHarness`
256
257
  * that meets certain criteria.
@@ -264,6 +265,8 @@ declare class MatDateRangeInputHarness extends DatepickerTriggerHarnessBase {
264
265
  getStartInput(): Promise<MatStartDateHarness>;
265
266
  /** Gets the inner start date input inside the range input. */
266
267
  getEndInput(): Promise<MatEndDateHarness>;
268
+ /** Gets the floating label text for the range input, if it exists. */
269
+ getLabel(): Promise<string | null>;
267
270
  /** Gets the separator text between the values of the two inputs. */
268
271
  getSeparator(): Promise<string>;
269
272
  /** Gets whether the range input is disabled. */
@@ -9,26 +9,6 @@
9
9
  @use '../core/typography/typography';
10
10
  @use '../button/icon-button-theme';
11
11
 
12
- // TODO(crisbeto): these variables aren't used anymore and should be removed.
13
- $selected-today-box-shadow-width: 1px;
14
- $selected-fade-amount: 0.6;
15
- $range-fade-amount: 0.2;
16
- $today-fade-amount: 0.2;
17
- $calendar-body-font-size: 13px !default;
18
- $calendar-weekday-table-font-size: 11px !default;
19
-
20
- @mixin _calendar-color($theme, $palette-name) {
21
- $palette-color: inspection.get-theme-color($theme, $palette-name);
22
- $range-color: m2-datepicker.private-get-range-background-color($palette-color);
23
- $range-tokens: m2-datepicker.get-range-color-tokens($range-color);
24
- $calendar-tokens: m2-datepicker.private-get-calendar-color-palette-color-tokens(
25
- $theme,
26
- $palette-name
27
- );
28
-
29
- @include token-utils.create-token-values-mixed(map.merge($calendar-tokens, $range-tokens));
30
- }
31
-
32
12
  /// Outputs base theme styles (styles not dependent on the color, typography, or density settings)
33
13
  /// for the mat-datepicker.
34
14
  /// @param {Map} $theme The theme to generate base styles for.
@@ -51,28 +31,19 @@ $calendar-weekday-table-font-size: 11px !default;
51
31
  map.get(m3-datepicker.get-tokens($theme, $color-variant), color));
52
32
  } @else {
53
33
  @include sass-utils.current-selector-or-root() {
54
- @include token-utils.create-token-values-mixed(m2-datepicker.get-color-tokens($theme));
34
+ @include token-utils.create-token-values-mixed(
35
+ m2-datepicker.get-color-tokens($theme, primary));
55
36
  }
56
37
 
57
- .mat-datepicker-content {
38
+ .mat-datepicker-content, .mat-datepicker-toggle-active {
58
39
  &.mat-accent {
59
- @include _calendar-color($theme, accent);
40
+ @include token-utils.create-token-values-mixed(
41
+ m2-datepicker.get-color-tokens($theme, secondary));
60
42
  }
61
43
 
62
44
  &.mat-warn {
63
- @include _calendar-color($theme, warn);
64
- }
65
- }
66
-
67
- .mat-datepicker-toggle-active {
68
- &.mat-accent {
69
- $accent-tokens: m2-datepicker.private-get-toggle-color-palette-color-tokens($theme, accent);
70
- @include token-utils.create-token-values-mixed($accent-tokens);
71
- }
72
-
73
- &.mat-warn {
74
- $warn-tokens: m2-datepicker.private-get-toggle-color-palette-color-tokens($theme, warn);
75
- @include token-utils.create-token-values-mixed($warn-tokens);
45
+ @include token-utils.create-token-values-mixed(
46
+ m2-datepicker.get-color-tokens($theme, error));
76
47
  }
77
48
  }
78
49
  }
@@ -92,21 +63,16 @@ $calendar-weekday-table-font-size: 11px !default;
92
63
 
93
64
  @mixin date-range-colors(
94
65
  $range-color,
95
- $comparison-color: m2-datepicker.$private-default-comparison-color,
96
- $overlap-color: m2-datepicker.$private-default-overlap-color,
97
- $overlap-selected-color:
98
- m2-datepicker.private-get-default-overlap-selected-color($overlap-color)
66
+ $comparison-color: rgba(#f9ab00, 0.2),
67
+ $overlap-color: #a8dab5,
68
+ $overlap-selected-color: color.adjust($overlap-color, $lightness: -30%)
99
69
  ) {
100
- $tokens: m2-datepicker.get-range-color-tokens(
101
- $range-color: $range-color,
102
- $comparison-color: $comparison-color,
103
- $overlap-color: $overlap-color,
104
- $overlap-selected-color: $overlap-selected-color,
105
- );
106
-
107
- @include sass-utils.current-selector-or-root() {
108
- @include token-utils.create-token-values-mixed($tokens);
109
- }
70
+ @include overrides((
71
+ calendar-date-in-range-state-background-color: $range-color,
72
+ calendar-date-in-comparison-range-state-background-color: $comparison-color,
73
+ calendar-date-in-overlap-range-state-background-color: $overlap-color,
74
+ calendar-date-in-overlap-range-selected-state-background-color: $overlap-selected-color,
75
+ ));
110
76
  }
111
77
 
112
78
  /// Outputs density theme styles for the mat-datepicker.
@@ -1,29 +1,9 @@
1
1
  @use 'sass:color';
2
- @use 'sass:meta';
3
- @use 'sass:math';
4
- @use '../core/tokens/m2-utils';
5
2
  @use '../core/theming/inspection';
6
3
  @use '../core/style/elevation';
7
- @use '../core/style/sass-utils';
8
-
9
- $_selected-fade-amount: 0.6;
10
- $_today-fade-amount: 0.2;
11
-
12
- // Utility that produces a range background color from a specific color.
13
- @function private-get-range-background-color($color) {
14
- @return rgba($color, 0.2);
15
- }
16
-
17
- // Utility that produces the overlap selected color from an overlap color.
18
- @function private-get-default-overlap-selected-color($overlap-color) {
19
- @return color.adjust($overlap-color, $lightness: -30%);
20
- }
21
-
22
- // Default range comparison color.
23
- $private-default-comparison-color: private-get-range-background-color(#f9ab00);
24
-
25
- // Default range overlap color.
26
- $private-default-overlap-color: #a8dab5;
4
+ @use '../core/tokens/m3-utils';
5
+ @use '../core/tokens/m2-utils';
6
+ @use 'sass:map';
27
7
 
28
8
  // Tokens that can't be configured through Angular Material's current theming API,
29
9
  // but may be in a future version of the theming API.
@@ -37,64 +17,50 @@ $private-default-overlap-color: #a8dab5;
37
17
  }
38
18
 
39
19
  // Tokens that can be configured through Angular Material's color theming API.
40
- @function get-color-tokens($theme) {
41
- $inactive-icon-color: inspection.get-theme-color($theme, foreground, icon);
42
- $text-color: inspection.get-theme-color($theme, foreground, text);
43
- $secondary-text-color: inspection.get-theme-color($theme, foreground, secondary-text);
44
- $disabled-text-color: inspection.get-theme-color($theme, foreground, disabled-text);
45
- $divider-color: inspection.get-theme-color($theme, foreground, divider);
46
- $hint-text-color: inspection.get-theme-color($theme, foreground, hint-text);
47
- $preview-outline-color: $divider-color;
48
- $today-disabled-outline-color: null;
49
- $is-dark: inspection.get-theme-type($theme) == dark;
50
-
51
- $primary-color: inspection.get-theme-color($theme, primary);
52
- $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
53
- $calendar-tokens: private-get-calendar-color-palette-color-tokens($theme, primary);
54
- $toggle-tokens: private-get-toggle-color-palette-color-tokens($theme, primary);
20
+ @function get-color-tokens($theme, $color-variant) {
21
+ $system: m2-utils.get-system($theme);
22
+ $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
23
+ $disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
55
24
 
56
- // The divider color is set under the assumption that it'll be used
57
- // for a solid border, but because we're using a dashed border for the
58
- // preview range, we need to bump its opacity to ensure that it's visible.
59
- @if meta.type-of($preview-outline-color) == color {
60
- $preview-outline-opacity: math.min(color.opacity($preview-outline-color) * 2, 1);
61
- $preview-outline-color: rgba($preview-outline-color, $preview-outline-opacity);
62
- }
63
-
64
- @if (meta.type-of($hint-text-color) == color) {
65
- $today-disabled-outline-color: color.adjust($hint-text-color, $alpha: -$_today-fade-amount);
66
- }
67
- @else {
68
- $today-disabled-outline-color: $disabled-text-color;
69
- }
70
-
71
- @return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
72
- datepicker-toggle-icon-color: $inactive-icon-color,
73
- datepicker-calendar-body-label-text-color: $secondary-text-color,
74
- datepicker-calendar-period-button-text-color:
75
- inspection.get-theme-color($theme, foreground, text, 1),
76
- datepicker-calendar-period-button-icon-color: $inactive-icon-color,
77
- datepicker-calendar-navigation-button-icon-color: $inactive-icon-color,
78
- datepicker-calendar-header-divider-color: $divider-color,
79
- datepicker-calendar-header-text-color: $secondary-text-color,
80
-
81
- // Note: though it's not text, the border is a hint about the fact
82
- // that this is today's date, so we use the hint color.
83
- datepicker-calendar-date-today-outline-color: $hint-text-color,
84
- datepicker-calendar-date-today-disabled-state-outline-color: $today-disabled-outline-color,
85
- datepicker-calendar-date-text-color: $text-color,
25
+ @return (
26
+ datepicker-calendar-date-in-range-state-background-color:
27
+ m3-utils.color-with-opacity(map.get($system, primary), 20%),
28
+ datepicker-calendar-date-in-comparison-range-state-background-color:
29
+ m3-utils.color-with-opacity(map.get($system, secondary), 20%),
30
+ datepicker-calendar-date-in-overlap-range-state-background-color: #a8dab5,
31
+ datepicker-calendar-date-in-overlap-range-selected-state-background-color:
32
+ color.adjust(#a8dab5, $lightness: -30%),
33
+ datepicker-calendar-date-selected-state-text-color: map.get($system, on-primary),
34
+ datepicker-calendar-date-selected-state-background-color: map.get($system, primary),
35
+ datepicker-calendar-date-selected-disabled-state-background-color:
36
+ m3-utils.color-with-opacity(map.get($system, primary), 38%),
37
+ datepicker-calendar-date-today-selected-state-outline-color: map.get($system, on-primary),
38
+ datepicker-calendar-date-focus-state-background-color: m3-utils.color-with-opacity(
39
+ map.get($system, primary), map.get($system, focus-state-layer-opacity)),
40
+ datepicker-calendar-date-hover-state-background-color: m3-utils.color-with-opacity(
41
+ map.get($system, primary), map.get($system, hover-state-layer-opacity)),
42
+
43
+ datepicker-toggle-active-state-icon-color: map.get($system, primary),
44
+ datepicker-toggle-icon-color: map.get($system, on-surface-variant),
45
+ datepicker-calendar-body-label-text-color: map.get($system, on-surface-variant),
46
+ datepicker-calendar-period-button-text-color: map.get($system, on-surface),
47
+ datepicker-calendar-period-button-icon-color: map.get($system, on-surface-variant),
48
+ datepicker-calendar-navigation-button-icon-color: map.get($system, on-surface-variant),
49
+ datepicker-calendar-header-divider-color: map.get($system, outline),
50
+ datepicker-calendar-header-text-color: map.get($system, on-surface-variant),
51
+
52
+ datepicker-calendar-date-today-outline-color: map.get($system, on-surface-variant),
53
+ datepicker-calendar-date-today-disabled-state-outline-color: $disabled,
54
+ datepicker-calendar-date-text-color: map.get($system, on-surface),
86
55
  datepicker-calendar-date-outline-color: transparent,
87
- datepicker-calendar-date-disabled-state-text-color: $disabled-text-color,
88
- datepicker-calendar-date-preview-state-outline-color: $preview-outline-color,
89
-
90
- datepicker-range-input-separator-color: $text-color,
91
- datepicker-range-input-disabled-state-separator-color: $disabled-text-color,
92
- datepicker-range-input-disabled-state-text-color: $disabled-text-color,
93
-
94
- datepicker-calendar-container-background-color:
95
- inspection.get-theme-color($theme, background, card),
96
- datepicker-calendar-container-text-color: $text-color,
97
- ));
56
+ datepicker-calendar-date-disabled-state-text-color: $disabled,
57
+ datepicker-calendar-date-preview-state-outline-color: map.get($system, on-surface-variant),
58
+ datepicker-range-input-separator-color: map.get($system, on-surface),
59
+ datepicker-range-input-disabled-state-separator-color: $disabled,
60
+ datepicker-range-input-disabled-state-text-color: $disabled,
61
+ datepicker-calendar-container-background-color: map.get($system, surface),
62
+ datepicker-calendar-container-text-color: map.get($system, on-surface),
63
+ );
98
64
  }
99
65
 
100
66
  // Tokens that can be configured through Angular Material's typography theming API.
@@ -123,65 +89,7 @@ $private-default-overlap-color: #a8dab5;
123
89
  );
124
90
  }
125
91
 
126
- // Gets the tokens map that can be used to override the range colors.
127
- @function get-range-color-tokens(
128
- $range-color,
129
- $comparison-color: $private-default-comparison-color,
130
- $overlap-color: $private-default-overlap-color,
131
- $overlap-selected-color: private-get-default-overlap-selected-color($overlap-color)) {
132
-
133
- @return (
134
- datepicker-calendar-date-in-range-state-background-color: $range-color,
135
- datepicker-calendar-date-in-comparison-range-state-background-color: $comparison-color,
136
- datepicker-calendar-date-in-overlap-range-state-background-color: $overlap-color,
137
- datepicker-calendar-date-in-overlap-range-selected-state-background-color:
138
- $overlap-selected-color,
139
- );
140
- }
141
-
142
- @function private-get-calendar-color-palette-color-tokens($theme, $palette-name) {
143
- $palette-color: inspection.get-theme-color($theme, $palette-name);
144
- $default-contrast: inspection.get-theme-color($theme, $palette-name, default-contrast);
145
- $active-background-color: sass-utils.safe-color-change($palette-color, $alpha: 0.3);
146
- $active-disabled-color: null;
147
-
148
- @if (meta.type-of($palette-color) == color) {
149
- $active-disabled-color: color.adjust($palette-color, $alpha: -$_selected-fade-amount);
150
- }
151
- @else {
152
- $active-disabled-color: inspection.get-theme-color($theme, foreground, disabled-button);
153
- }
154
-
155
- @return (
156
- datepicker-calendar-date-selected-state-text-color: $default-contrast,
157
- datepicker-calendar-date-selected-state-background-color: $palette-color,
158
- datepicker-calendar-date-selected-disabled-state-background-color: $active-disabled-color,
159
- datepicker-calendar-date-today-selected-state-outline-color: $default-contrast,
160
- datepicker-calendar-date-focus-state-background-color: $active-background-color,
161
- datepicker-calendar-date-hover-state-background-color: $active-background-color,
162
- );
163
- }
164
-
165
- @function private-get-toggle-color-palette-color-tokens($theme, $palette-name) {
166
- @return (
167
- datepicker-toggle-active-state-icon-color:
168
- inspection.get-theme-color($theme, $palette-name, text),
169
- );
170
- }
171
-
172
-
173
92
  // Tokens that can be configured through Angular Material's density theming API.
174
93
  @function get-density-tokens($theme) {
175
94
  @return ();
176
95
  }
177
-
178
- // Combines the tokens generated by the above functions into a single map with placeholder values.
179
- // This is used to create token slots.
180
- @function get-token-slots() {
181
- @return sass-utils.deep-merge-all(
182
- get-unthemable-tokens(),
183
- get-color-tokens(m2-utils.$placeholder-color-config),
184
- get-typography-tokens(m2-utils.$placeholder-typography-config),
185
- get-density-tokens(m2-utils.$placeholder-density-config)
186
- );
187
- }
@@ -1,7 +1,7 @@
1
- import { D as DatepickerTriggerHarnessBase, a as DatepickerToggleHarnessFilters } from '../../date-range-input-harness.d-CaEyN8dT.js';
2
- export { c as CalendarCellHarnessFilters, C as CalendarHarnessFilters, h as CalendarView, d as DateRangeInputHarnessFilters, b as DatepickerInputHarnessFilters, j as MatCalendarCellHarness, i as MatCalendarHarness, g as MatDateRangeInputHarness, M as MatDatepickerInputHarness, f as MatEndDateHarness, e as MatStartDateHarness } from '../../date-range-input-harness.d-CaEyN8dT.js';
1
+ import { D as DatepickerTriggerHarnessBase, a as DatepickerToggleHarnessFilters } from '../../date-range-input-harness.d-CJ4r85Uf.js';
2
+ export { c as CalendarCellHarnessFilters, C as CalendarHarnessFilters, h as CalendarView, d as DateRangeInputHarnessFilters, b as DatepickerInputHarnessFilters, j as MatCalendarCellHarness, i as MatCalendarHarness, g as MatDateRangeInputHarness, M as MatDatepickerInputHarness, f as MatEndDateHarness, e as MatStartDateHarness } from '../../date-range-input-harness.d-CJ4r85Uf.js';
3
3
  import { HarnessPredicate } from '@angular/cdk/testing';
4
- import '../../form-field/testing/control/index.js';
4
+ import '@angular/material/form-field/testing/control';
5
5
 
6
6
  /** Harness for interacting with a standard Material datepicker toggle in tests. */
7
7
  declare class MatDatepickerToggleHarness extends DatepickerTriggerHarnessBase {
@@ -1,7 +1,7 @@
1
- @use '../core/tokens/m2-utils';
2
1
  @use '../core/style/elevation';
3
- @use '../core/style/sass-utils';
4
2
  @use '../core/theming/inspection';
3
+ @use '../core/tokens/m2-utils';
4
+ @use 'sass:map';
5
5
 
6
6
  // Tokens that can't be configured through Angular Material's current theming API,
7
7
  // but may be in a future version of the theming API.
@@ -25,19 +25,11 @@
25
25
 
26
26
  // Tokens that can be configured through Angular Material's color theming API.
27
27
  @function get-color-tokens($theme) {
28
- $is-dark: inspection.get-theme-type($theme) == dark;
29
-
30
- // Ideally we would derive all values directly from the theme, but it causes a lot of regressions
31
- // internally. For now we fall back to the old hardcoded behavior only for internal apps.
32
- $text-base: if(m2-utils.$private-is-internal-build,
33
- if($is-dark, #fff, #000),
34
- inspection.get-theme-color($theme, foreground, text, 1)
35
- );
36
-
28
+ $system: m2-utils.get-system($theme);
37
29
  @return (
38
- dialog-container-color: inspection.get-theme-color($theme, background, dialog),
39
- dialog-subhead-color: sass-utils.safe-color-change($text-base, $alpha: 0.87),
40
- dialog-supporting-text-color: sass-utils.safe-color-change($text-base, $alpha: 0.6),
30
+ dialog-container-color: map.get($system, surface),
31
+ dialog-subhead-color: map.get($system, on-surface),
32
+ dialog-supporting-text-color: map.get($system, on-surface-variant),
41
33
  );
42
34
  }
43
35
 
@@ -63,14 +55,3 @@
63
55
  @function get-density-tokens($theme) {
64
56
  @return ();
65
57
  }
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 sass-utils.deep-merge-all(
71
- get-unthemable-tokens(),
72
- get-color-tokens(m2-utils.$placeholder-color-config),
73
- get-typography-tokens(m2-utils.$placeholder-typography-config),
74
- get-density-tokens(m2-utils.$placeholder-density-config)
75
- );
76
- }
@@ -1,6 +1,5 @@
1
1
  @use '../core/tokens/m2-utils';
2
- @use '../core/theming/inspection';
3
- @use '../core/style/sass-utils';
2
+ @use 'sass:map';
4
3
 
5
4
  // Tokens that can't be configured through Angular Material's current theming API,
6
5
  // but may be in a future version of the theming API.
@@ -12,8 +11,9 @@
12
11
 
13
12
  // Tokens that can be configured through Angular Material's color theming API.
14
13
  @function get-color-tokens($theme) {
14
+ $system: m2-utils.get-system($theme);
15
15
  @return (
16
- divider-color: inspection.get-theme-color($theme, foreground, divider)
16
+ divider-color: map.get($system, outline)
17
17
  );
18
18
  }
19
19
 
@@ -26,14 +26,3 @@
26
26
  @function get-density-tokens($theme) {
27
27
  @return ();
28
28
  }
29
-
30
- // Combines the tokens generated by the above functions into a single map with placeholder values.
31
- // This is used to create token slots.
32
- @function get-token-slots() {
33
- @return sass-utils.deep-merge-all(
34
- get-unthemable-tokens(),
35
- get-color-tokens(m2-utils.$placeholder-color-config),
36
- get-typography-tokens(m2-utils.$placeholder-typography-config),
37
- get-density-tokens(m2-utils.$placeholder-density-config)
38
- );
39
- }