@angular/material 20.1.0-next.0 → 20.1.0-next.2

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 (243) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +28 -37
  3. package/autocomplete/_m2-autocomplete.scss +5 -2
  4. package/badge/_badge-theme.scss +35 -44
  5. package/badge/_m2-badge.scss +3 -2
  6. package/bottom-sheet/_bottom-sheet-theme.scss +28 -40
  7. package/bottom-sheet/_m2-bottom-sheet.scss +12 -11
  8. package/button/_button-theme.scss +37 -55
  9. package/button/_fab-theme.scss +42 -56
  10. package/button/_icon-button-theme.scss +30 -48
  11. package/button/_m2-button.scss +60 -59
  12. package/button/_m2-fab.scss +19 -15
  13. package/button/_m2-icon-button.scss +7 -5
  14. package/button/testing/index.d.ts +1 -0
  15. package/button-toggle/_button-toggle-theme.scss +29 -44
  16. package/button-toggle/_m2-button-toggle.scss +11 -17
  17. package/card/_card-theme.scss +28 -36
  18. package/card/_m2-card.scss +12 -14
  19. package/checkbox/_checkbox-theme.scss +35 -50
  20. package/checkbox/_m2-checkbox.scss +8 -8
  21. package/chips/_chips-theme.scss +24 -30
  22. package/chips/_m2-chip.scss +12 -28
  23. package/core/_core-theme.scss +48 -67
  24. package/core/focus-indicators/_private.scss +2 -5
  25. package/core/m2/_theming.scss +68 -113
  26. package/core/option/_m2-optgroup.scss +10 -7
  27. package/core/option/_m2-option.scss +13 -11
  28. package/core/option/_optgroup-theme.scss +28 -30
  29. package/core/option/_option-theme.scss +35 -34
  30. package/core/ripple/_m2-ripple.scss +6 -10
  31. package/core/ripple/_ripple-theme.scss +28 -33
  32. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +2 -3
  33. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +55 -45
  34. package/core/theming/_all-theme.scss +38 -42
  35. package/core/theming/_definition.scss +20 -13
  36. package/core/theming/_inspection.scss +0 -12
  37. package/core/theming/_m2-inspection.scss +0 -33
  38. package/core/theming/_theming.scss +4 -172
  39. package/core/tokens/_m2-utils.scss +5 -75
  40. package/core/tokens/_m3-system.scss +11 -9
  41. package/core/tokens/_m3-utils.scss +2 -14
  42. package/core/tokens/_token-utils.scss +7 -27
  43. package/core/tokens/m2/_index.scss +6 -0
  44. package/core/tokens/m2/_md-sys-color.scss +123 -0
  45. package/core/tokens/m2/_md-sys-elevation.scss +16 -0
  46. package/core/tokens/m2/_md-sys-motion.scss +36 -0
  47. package/core/tokens/m2/_md-sys-shape.scss +22 -0
  48. package/core/tokens/m2/_md-sys-state.scss +15 -0
  49. package/core/tokens/m2/_md-sys-typescale.scss +68 -0
  50. package/core/tokens/m3/_md-sys-color.scss +2 -2
  51. package/core/tokens/m3/_md-sys-typescale.scss +1 -1
  52. package/core/tokens/m3/_theme.scss +14 -26
  53. package/datepicker/_datepicker-theme.scss +47 -87
  54. package/datepicker/_m2-datepicker.scss +33 -123
  55. package/datepicker/index.d.ts +1 -1
  56. package/dialog/_dialog-theme.scss +28 -34
  57. package/dialog/_m2-dialog.scss +17 -17
  58. package/divider/_divider-theme.scss +28 -30
  59. package/divider/_m2-divider.scss +4 -2
  60. package/expansion/_expansion-theme.scss +28 -39
  61. package/expansion/_m2-expansion.scss +11 -10
  62. package/expansion/_m3-expansion.scss +2 -0
  63. package/fesm2022/animation-DfMFjxHu.mjs.map +1 -1
  64. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  65. package/fesm2022/autocomplete.mjs +1 -1
  66. package/fesm2022/autocomplete.mjs.map +1 -1
  67. package/fesm2022/badge/testing.mjs.map +1 -1
  68. package/fesm2022/badge.mjs.map +1 -1
  69. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  70. package/fesm2022/bottom-sheet.mjs.map +1 -1
  71. package/fesm2022/button/testing.mjs +7 -4
  72. package/fesm2022/button/testing.mjs.map +1 -1
  73. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  74. package/fesm2022/button-toggle.mjs.map +1 -1
  75. package/fesm2022/button.mjs +2 -2
  76. package/fesm2022/button.mjs.map +1 -1
  77. package/fesm2022/card/testing.mjs.map +1 -1
  78. package/fesm2022/card.mjs.map +1 -1
  79. package/fesm2022/checkbox/testing.mjs.map +1 -1
  80. package/fesm2022/checkbox.mjs.map +1 -1
  81. package/fesm2022/chips/testing.mjs.map +1 -1
  82. package/fesm2022/chips.mjs +1 -1
  83. package/fesm2022/chips.mjs.map +1 -1
  84. package/fesm2022/common-module-cKSwHniA.mjs.map +1 -1
  85. package/fesm2022/core/testing.mjs.map +1 -1
  86. package/fesm2022/core.mjs +1 -1
  87. package/fesm2022/core.mjs.map +1 -1
  88. package/fesm2022/date-formats-K6TQue-Y.mjs.map +1 -1
  89. package/fesm2022/date-range-input-harness-DEyfkeOs.mjs.map +1 -1
  90. package/fesm2022/datepicker/testing.mjs.map +1 -1
  91. package/fesm2022/datepicker.mjs +1 -1
  92. package/fesm2022/datepicker.mjs.map +1 -1
  93. package/fesm2022/dialog/testing.mjs.map +1 -1
  94. package/fesm2022/dialog.mjs.map +1 -1
  95. package/fesm2022/divider/testing.mjs.map +1 -1
  96. package/fesm2022/divider.mjs.map +1 -1
  97. package/fesm2022/error-options-DCNQlTOA.mjs.map +1 -1
  98. package/fesm2022/error-state-Dtb1IHM-.mjs.map +1 -1
  99. package/fesm2022/expansion/testing.mjs.map +1 -1
  100. package/fesm2022/expansion.mjs +2 -2
  101. package/fesm2022/expansion.mjs.map +1 -1
  102. package/fesm2022/form-field/testing/control.mjs.map +1 -1
  103. package/fesm2022/form-field/testing.mjs.map +1 -1
  104. package/fesm2022/{form-field-C9DZXojn.mjs → form-field-CFbrnFED.mjs} +3 -3
  105. package/fesm2022/form-field-CFbrnFED.mjs.map +1 -0
  106. package/fesm2022/form-field.mjs +2 -2
  107. package/fesm2022/form-field.mjs.map +1 -1
  108. package/fesm2022/grid-list/testing.mjs.map +1 -1
  109. package/fesm2022/grid-list.mjs.map +1 -1
  110. package/fesm2022/icon/testing.mjs.map +1 -1
  111. package/fesm2022/icon-button-DxiIc1ex.mjs.map +1 -1
  112. package/fesm2022/icon-registry-CwOTJ7YM.mjs.map +1 -1
  113. package/fesm2022/icon.mjs.map +1 -1
  114. package/fesm2022/index-BFRo2fUq.mjs.map +1 -1
  115. package/fesm2022/index-DwiL-HGk.mjs.map +1 -1
  116. package/fesm2022/input/testing.mjs.map +1 -1
  117. package/fesm2022/input-harness-C5Msdc4-.mjs.map +1 -1
  118. package/fesm2022/input-value-accessor-D1GvPuqO.mjs.map +1 -1
  119. package/fesm2022/input.mjs +3 -27
  120. package/fesm2022/input.mjs.map +1 -1
  121. package/fesm2022/internal-form-field-D5iFxU6d.mjs.map +1 -1
  122. package/fesm2022/line-Bz5f9Cyx.mjs.map +1 -1
  123. package/fesm2022/list/testing.mjs.map +1 -1
  124. package/fesm2022/list.mjs.map +1 -1
  125. package/fesm2022/material.mjs.map +1 -1
  126. package/fesm2022/menu/testing.mjs +97 -13
  127. package/fesm2022/menu/testing.mjs.map +1 -1
  128. package/fesm2022/menu.mjs +343 -122
  129. package/fesm2022/menu.mjs.map +1 -1
  130. package/fesm2022/{module-BDiw_nWS.mjs → module-B0CLRw5e.mjs} +3 -3
  131. package/fesm2022/module-B0CLRw5e.mjs.map +1 -0
  132. package/fesm2022/{module-DzZHEh7B.mjs → module-B62K-792.mjs} +2 -2
  133. package/fesm2022/module-B62K-792.mjs.map +1 -0
  134. package/fesm2022/module-CWxMD37a.mjs.map +1 -1
  135. package/fesm2022/module-Ce6F7TNm.mjs.map +1 -1
  136. package/fesm2022/option-BzhYL_xC.mjs.map +1 -1
  137. package/fesm2022/option-harness-BFcc-M_4.mjs.map +1 -1
  138. package/fesm2022/paginator/testing.mjs.map +1 -1
  139. package/fesm2022/paginator.mjs +3 -3
  140. package/fesm2022/paginator.mjs.map +1 -1
  141. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  142. package/fesm2022/progress-bar.mjs.map +1 -1
  143. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  144. package/fesm2022/progress-spinner.mjs.map +1 -1
  145. package/fesm2022/pseudo-checkbox-DDmgx3P4.mjs.map +1 -1
  146. package/fesm2022/pseudo-checkbox-module-4F8Up4PL.mjs.map +1 -1
  147. package/fesm2022/public-api-BoO5eSq-.mjs.map +1 -1
  148. package/fesm2022/radio/testing.mjs.map +1 -1
  149. package/fesm2022/radio.mjs.map +1 -1
  150. package/fesm2022/ripple-BYgV4oZC.mjs.map +1 -1
  151. package/fesm2022/ripple-loader-BnMiRtmT.mjs.map +1 -1
  152. package/fesm2022/select/testing.mjs.map +1 -1
  153. package/fesm2022/select.mjs +3 -3
  154. package/fesm2022/select.mjs.map +1 -1
  155. package/fesm2022/sidenav/testing.mjs.map +1 -1
  156. package/fesm2022/sidenav.mjs.map +1 -1
  157. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  158. package/fesm2022/slide-toggle.mjs +2 -2
  159. package/fesm2022/slide-toggle.mjs.map +1 -1
  160. package/fesm2022/slider/testing.mjs.map +1 -1
  161. package/fesm2022/slider.mjs +2 -2
  162. package/fesm2022/slider.mjs.map +1 -1
  163. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  164. package/fesm2022/snack-bar.mjs +2 -2
  165. package/fesm2022/snack-bar.mjs.map +1 -1
  166. package/fesm2022/sort/testing.mjs.map +1 -1
  167. package/fesm2022/sort.mjs.map +1 -1
  168. package/fesm2022/stepper/testing.mjs.map +1 -1
  169. package/fesm2022/stepper.mjs.map +1 -1
  170. package/fesm2022/structural-styles-CObeNzjn.mjs.map +1 -1
  171. package/fesm2022/table/testing.mjs.map +1 -1
  172. package/fesm2022/table.mjs.map +1 -1
  173. package/fesm2022/tabs/testing.mjs.map +1 -1
  174. package/fesm2022/tabs.mjs.map +1 -1
  175. package/fesm2022/timepicker/testing.mjs.map +1 -1
  176. package/fesm2022/timepicker.mjs +1 -1
  177. package/fesm2022/timepicker.mjs.map +1 -1
  178. package/fesm2022/toolbar/testing.mjs.map +1 -1
  179. package/fesm2022/toolbar.mjs.map +1 -1
  180. package/fesm2022/tooltip/testing.mjs.map +1 -1
  181. package/fesm2022/tooltip.mjs.map +1 -1
  182. package/fesm2022/tree/testing.mjs.map +1 -1
  183. package/fesm2022/tree.mjs.map +1 -1
  184. package/form-field/_form-field-theme.scss +35 -51
  185. package/form-field/_m2-form-field.scss +23 -31
  186. package/grid-list/_grid-list-theme.scss +28 -28
  187. package/grid-list/_m2-grid-list.scss +7 -9
  188. package/icon/_icon-theme.scss +40 -41
  189. package/input/_input-theme.scss +1 -4
  190. package/input/index.d.ts +0 -11
  191. package/list/_list-theme.scss +55 -53
  192. package/list/_m2-list.scss +21 -35
  193. package/menu/_m2-menu.scss +18 -15
  194. package/menu/_menu-theme.scss +28 -33
  195. package/menu/index.d.ts +145 -61
  196. package/menu/testing/index.d.ts +50 -2
  197. package/package.json +2 -2
  198. package/paginator/_m2-paginator.scss +9 -9
  199. package/paginator/_paginator-theme.scss +28 -33
  200. package/prebuilt-themes/azure-blue.css +1 -1
  201. package/prebuilt-themes/cyan-orange.css +1 -1
  202. package/prebuilt-themes/deeppurple-amber.css +1 -1
  203. package/prebuilt-themes/indigo-pink.css +1 -1
  204. package/prebuilt-themes/magenta-violet.css +1 -1
  205. package/prebuilt-themes/pink-bluegrey.css +1 -1
  206. package/prebuilt-themes/purple-green.css +1 -1
  207. package/prebuilt-themes/rose-red.css +1 -1
  208. package/progress-bar/_progress-bar-theme.scss +35 -43
  209. package/progress-spinner/_progress-spinner-theme.scss +42 -43
  210. package/radio/_m2-radio.scss +6 -5
  211. package/radio/_m3-radio.scss +1 -1
  212. package/radio/_radio-theme.scss +33 -46
  213. package/schematics/ng-add/index.js +1 -1
  214. package/select/_m2-select.scss +10 -8
  215. package/select/_select-theme.scss +38 -48
  216. package/sidenav/_sidenav-theme.scss +28 -30
  217. package/slide-toggle/_m2-slide-toggle.scss +45 -58
  218. package/slide-toggle/_m3-slide-toggle.scss +1 -0
  219. package/slide-toggle/_slide-toggle-theme.scss +41 -79
  220. package/slider/_m2-slider.scss +33 -35
  221. package/slider/_slider-theme.scss +38 -45
  222. package/snack-bar/_m2-snack-bar.scss +5 -6
  223. package/snack-bar/_snack-bar-theme.scss +28 -31
  224. package/sort/_m2-sort.scss +5 -2
  225. package/sort/_sort-theme.scss +28 -33
  226. package/stepper/_m2-stepper.scss +10 -13
  227. package/stepper/_stepper-theme.scss +41 -49
  228. package/table/_m2-table.scss +23 -28
  229. package/table/_table-theme.scss +28 -36
  230. package/tabs/_m2-tabs.scss +11 -16
  231. package/tabs/_tabs-theme.scss +35 -43
  232. package/timepicker/_m2-timepicker.scss +5 -2
  233. package/timepicker/_timepicker-theme.scss +28 -46
  234. package/toolbar/_m2-toolbar.scss +10 -9
  235. package/toolbar/_toolbar-theme.scss +55 -46
  236. package/tooltip/_m2-tooltip.scss +5 -6
  237. package/tooltip/_tooltip-theme.scss +28 -37
  238. package/tree/_m2-tree.scss +9 -5
  239. package/tree/_tree-theme.scss +28 -38
  240. package/core/tokens/_format-tokens.scss +0 -5
  241. package/fesm2022/form-field-C9DZXojn.mjs.map +0 -1
  242. package/fesm2022/module-BDiw_nWS.mjs.map +0 -1
  243. package/fesm2022/module-DzZHEh7B.mjs.map +0 -1
@@ -0,0 +1,68 @@
1
+ @use 'sass:map';
2
+ @use 'sass:string';
3
+ @use 'sass:meta';
4
+
5
+ @function md-sys-typescale-values($config) {
6
+ // Mapping is according to the old 2014 version of the typography spec.
7
+ $sys-to-config: (
8
+ body-large: subheading-1,
9
+ body-medium: body-1,
10
+ body-small: caption,
11
+ display-large: display-4,
12
+ display-medium: display-4,
13
+ display-small: display-4,
14
+ headline-large: display-3,
15
+ headline-medium: display-2,
16
+ headline-small: display-1,
17
+ label-large: subheading-2,
18
+ label-medium: body-2,
19
+ label-small: button,
20
+ title-large: headline,
21
+ title-medium: headline,
22
+ title-small: title,
23
+ );
24
+
25
+ // If the config is based on the updated 2018 version of the typography spec, then
26
+ // use the correct config keys mapping.
27
+ @if (map.get($config, headline-1) != null) {
28
+ $sys-to-config: (
29
+ body-large: body-1,
30
+ body-medium: body-2,
31
+ body-small: caption,
32
+ label-large: subtitle-1,
33
+ label-medium: subtitle-2,
34
+ label-small: button,
35
+ display-large: headline-1,
36
+ display-medium: headline-1,
37
+ display-small: headline-1,
38
+ headline-large: headline-2,
39
+ headline-medium: headline-3,
40
+ headline-small: headline-4,
41
+ title-large: headline-5,
42
+ title-medium: headline-5,
43
+ title-small: headline-6,
44
+ );
45
+ }
46
+
47
+ $typography: ();
48
+ @each $sys-key, $config-key in $sys-to-config {
49
+ $font: map.get($config, $config-key, font-family);
50
+ @if (meta.type-of($font) == 'string') {
51
+ $font: string.unquote($font);
52
+ }
53
+ $line-height: map.get($config, $config-key, line-height);
54
+ $size: map.get($config, $config-key, font-size);
55
+ $tracking: map.get($config, $config-key, letter-spacing);
56
+ $weight: map.get($config, $config-key, font-weight);
57
+ $typography: map.merge($typography, (
58
+ #{$sys-key}: $weight $size #{'/'} $line-height $font,
59
+ #{$sys-key}-font: $font,
60
+ #{$sys-key}-line-height: $line-height,
61
+ #{$sys-key}-size: $size,
62
+ #{$sys-key}-tracking: $tracking,
63
+ #{$sys-key}-weight: $weight,
64
+ ));
65
+ }
66
+
67
+ @return $typography;
68
+ }
@@ -8,7 +8,7 @@
8
8
  // Indicates whether alternative tokens should be used
9
9
  $_alternate-tokens: false;
10
10
 
11
- @function md-sys-color-values-dark($palettes) {
11
+ @function md-sys-color-values-dark($palettes: ()) {
12
12
  $values: (
13
13
  background: map.get($palettes, neutral, 6),
14
14
  error: map.get($palettes, error, 80),
@@ -80,7 +80,7 @@ $_alternate-tokens: false;
80
80
  @return $values;
81
81
  }
82
82
 
83
- @function md-sys-color-values-light($palettes) {
83
+ @function md-sys-color-values-light($palettes: ()) {
84
84
  $values: (
85
85
  background: map.get($palettes, neutral, 98),
86
86
  error: map.get($palettes, error, 40),
@@ -8,7 +8,7 @@
8
8
  // Indicates whether alternative tokens should be used
9
9
  $_alternate-tokens: false;
10
10
 
11
- @function md-sys-typescale-values($typography) {
11
+ @function md-sys-typescale-values($typography: ()) {
12
12
  $plain: map.get($typography, plain);
13
13
  $brand: map.get($typography, brand);
14
14
  $bold: map.get($typography, bold);
@@ -1,4 +1,3 @@
1
- @use '../../theming/palettes';
2
1
  @use './md-sys-color';
3
2
  @use './md-sys-elevation';
4
3
  @use './md-sys-shape';
@@ -17,31 +16,20 @@
17
16
  @return $new-map;
18
17
  }
19
18
 
20
- /// Map key used to store internals of theme config.
21
- $internals: _mat-theming-internals-do-not-access;
22
-
23
- $placeholder-palettes: md-sys-color.md-sys-color-values-light(palettes.$blue-palette);
24
- $placeholder-palettes: map.set($placeholder-palettes, primary, palettes.$blue-palette);
25
- $app-vars: (
26
- 'md-sys-color': _create-system-app-vars-map(
27
- md-sys-color.md-sys-color-values-light($placeholder-palettes)),
28
- 'md-sys-typescale': _create-system-app-vars-map(md-sys-typescale.md-sys-typescale-values((
29
- brand: (Roboto),
30
- plain: (Roboto),
31
- bold: 700,
32
- medium: 500,
33
- regular: 400
34
- ))),
35
- 'md-sys-elevation': _create-system-app-vars-map(md-sys-elevation.md-sys-elevation-values()),
36
- 'md-sys-state': _create-system-app-vars-map(md-sys-state.md-sys-state-values()),
37
- 'md-sys-shape': _create-system-app-vars-map(md-sys-shape.md-sys-shape-values()),
38
- // Add a subset of palette-specific colors used by components instead of system values
39
- 'md-ref-palette': _create-system-app-vars-map(
40
- (
41
- neutral10: '', // Form field native select option text color
42
- neutral-variant20: '', // Sidenav scrim (container background shadow when opened),
43
- )
19
+ $_sys-maps: (
20
+ md-sys-color.md-sys-color-values-light(),
21
+ md-sys-typescale.md-sys-typescale-values(),
22
+ md-sys-elevation.md-sys-elevation-values(),
23
+ md-sys-state.md-sys-state-values(),
24
+ md-sys-shape.md-sys-shape-values(),
25
+ (
26
+ neutral10: '', // Form field native select option text color
27
+ neutral-variant20: '', // Sidenav scrim (container background shadow when opened),
44
28
  ),
45
29
  );
46
30
 
47
- $sys-theme: ($internals: $app-vars);
31
+ $_system: ();
32
+ @each $sys-map in $_sys-maps {
33
+ $_system: map.merge($_system, _create-system-app-vars-map($sys-map));
34
+ }
35
+ $sys-theme: (_mat-system: $_system);
@@ -2,81 +2,44 @@
2
2
  @use 'sass:map';
3
3
  @use './m2-datepicker';
4
4
  @use './m3-datepicker';
5
- @use '../core/theming/theming';
6
5
  @use '../core/theming/inspection';
7
6
  @use '../core/tokens/token-utils';
8
- @use '../core/style/sass-utils';
9
7
  @use '../core/typography/typography';
10
8
  @use '../button/icon-button-theme';
11
- @use '../core/tokens/m2-utils';
12
- @use '../core/tokens/m3-utils';
13
-
14
- // TODO(crisbeto): these variables aren't used anymore and should be removed.
15
- $selected-today-box-shadow-width: 1px;
16
- $selected-fade-amount: 0.6;
17
- $range-fade-amount: 0.2;
18
- $today-fade-amount: 0.2;
19
- $calendar-body-font-size: 13px !default;
20
- $calendar-weekday-table-font-size: 11px !default;
21
-
22
- @mixin _calendar-color($theme, $color-variant) {
23
- $system: m2-utils.get-system($theme);
24
- $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
25
-
26
- $range-color: m2-datepicker.private-get-range-background-color(map.get($system, primary));
27
- $range-tokens: m2-datepicker.get-range-color-tokens($range-color);
28
- $calendar-tokens: m2-datepicker.private-get-calendar-color-palette-color-tokens(
29
- $theme,
30
- $color-variant
31
- );
32
-
33
- @include token-utils.create-token-values-mixed(map.merge($calendar-tokens, $range-tokens));
34
- }
35
9
 
36
10
  /// Outputs base theme styles (styles not dependent on the color, typography, or density settings)
37
11
  /// for the mat-datepicker.
38
12
  /// @param {Map} $theme The theme to generate base styles for.
39
13
  @mixin base($theme) {
14
+ $tokens: m2-datepicker.get-unthemable-tokens();
40
15
  @if inspection.get-theme-version($theme) == 1 {
41
- @include token-utils.create-token-values(map.get(m3-datepicker.get-tokens($theme), base));
42
- } @else {
43
- @include sass-utils.current-selector-or-root() {
44
- @include token-utils.create-token-values-mixed(m2-datepicker.get-unthemable-tokens());
45
- }
16
+ $tokens: map.get(m3-datepicker.get-tokens($theme), base);
46
17
  }
18
+
19
+ @include token-utils.values($tokens);
47
20
  }
48
21
 
49
22
  /// Outputs color theme styles for the mat-datepicker.
50
23
  /// @param {Map} $theme The theme to generate color styles for.
51
24
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
52
25
  @mixin color($theme, $color-variant: null) {
26
+ $tokens: m2-datepicker.get-color-tokens($theme, primary);
53
27
  @if inspection.get-theme-version($theme) == 1 {
54
- @include token-utils.create-token-values(
55
- map.get(m3-datepicker.get-tokens($theme, $color-variant), color));
56
- } @else {
57
- @include sass-utils.current-selector-or-root() {
58
- @include token-utils.create-token-values-mixed(m2-datepicker.get-color-tokens($theme));
59
- }
60
-
61
- .mat-datepicker-content {
62
- &.mat-accent {
63
- @include _calendar-color($theme, secondary);
64
- }
28
+ $tokens: map.get(m3-datepicker.get-tokens($theme, $color-variant), color);
29
+ }
65
30
 
66
- &.mat-warn {
67
- @include _calendar-color($theme, error);
68
- }
69
- }
31
+ @include token-utils.values($tokens);
70
32
 
71
- .mat-datepicker-toggle-active {
33
+ @if inspection.get-theme-version($theme) != 1 {
34
+ .mat-datepicker-content, .mat-datepicker-toggle-active {
72
35
  &.mat-accent {
73
- $accent-tokens: m2-datepicker.private-get-toggle-color-palette-color-tokens($theme, accent);
74
- @include token-utils.create-token-values-mixed($accent-tokens);
36
+ $tokens: m2-datepicker.get-color-tokens($theme, secondary);
37
+ @include token-utils.values($tokens);
75
38
  }
76
39
 
77
40
  &.mat-warn {
78
- $warn-tokens: m2-datepicker.private-get-toggle-color-palette-color-tokens($theme, warn);
79
- @include token-utils.create-token-values-mixed($warn-tokens);
41
+ $tokens: m2-datepicker.get-color-tokens($theme, error);
42
+ @include token-utils.values($tokens);
80
43
  }
81
44
  }
82
45
  }
@@ -85,40 +48,39 @@ $calendar-weekday-table-font-size: 11px !default;
85
48
  /// Outputs typography theme styles for the mat-datepicker.
86
49
  /// @param {Map} $theme The theme to generate typography styles for.
87
50
  @mixin typography($theme) {
51
+ $tokens: m2-datepicker.get-typography-tokens($theme);
88
52
  @if inspection.get-theme-version($theme) == 1 {
89
- @include token-utils.create-token-values(map.get(m3-datepicker.get-tokens($theme), typography));
90
- } @else {
91
- @include sass-utils.current-selector-or-root() {
92
- @include token-utils.create-token-values-mixed(m2-datepicker.get-typography-tokens($theme));
93
- }
53
+ $tokens: map.get(m3-datepicker.get-tokens($theme), typography);
94
54
  }
55
+
56
+ @include token-utils.values($tokens);
95
57
  }
96
58
 
97
59
  @mixin date-range-colors(
98
60
  $range-color,
99
- $comparison-color: m2-datepicker.$private-default-comparison-color,
100
- $overlap-color: m2-datepicker.$private-default-overlap-color,
101
- $overlap-selected-color:
102
- m2-datepicker.private-get-default-overlap-selected-color($overlap-color)
61
+ $comparison-color: rgba(#f9ab00, 0.2),
62
+ $overlap-color: #a8dab5,
63
+ $overlap-selected-color: color.adjust($overlap-color, $lightness: -30%)
103
64
  ) {
104
- $tokens: m2-datepicker.get-range-color-tokens(
105
- $range-color: $range-color,
106
- $comparison-color: $comparison-color,
107
- $overlap-color: $overlap-color,
108
- $overlap-selected-color: $overlap-selected-color,
109
- );
110
-
111
- @include sass-utils.current-selector-or-root() {
112
- @include token-utils.create-token-values-mixed($tokens);
113
- }
65
+ @include overrides((
66
+ calendar-date-in-range-state-background-color: $range-color,
67
+ calendar-date-in-comparison-range-state-background-color: $comparison-color,
68
+ calendar-date-in-overlap-range-state-background-color: $overlap-color,
69
+ calendar-date-in-overlap-range-selected-state-background-color: $overlap-selected-color,
70
+ ));
114
71
  }
115
72
 
116
73
  /// Outputs density theme styles for the mat-datepicker.
117
74
  /// @param {Map} $theme The theme to generate density styles for.
118
75
  @mixin density($theme) {
76
+ $tokens: m2-datepicker.get-density-tokens($theme);
119
77
  @if inspection.get-theme-version($theme) == 1 {
120
- @include token-utils.create-token-values(map.get(m3-datepicker.get-tokens($theme), density));
121
- } @else {
78
+ $tokens: map.get(m3-datepicker.get-tokens($theme), density);
79
+ }
80
+
81
+ @include token-utils.values($tokens);
82
+
83
+ @if inspection.get-theme-version($theme) != 1 {
122
84
  // TODO(crisbeto): move this into the structural styles
123
85
  // once the icon button density is switched to tokens.
124
86
 
@@ -150,23 +112,21 @@ $calendar-weekday-table-font-size: 11px !default;
150
112
  /// @param {Map} $theme The theme to generate styles for.
151
113
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
152
114
  @mixin theme($theme, $color-variant: null) {
153
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-datepicker') {
154
- @if inspection.get-theme-version($theme) == 1 {
155
- @include base($theme);
156
- @include color($theme, $color-variant);
115
+ @if inspection.get-theme-version($theme) == 1 {
116
+ @include base($theme);
117
+ @include color($theme, $color-variant);
118
+ @include density($theme);
119
+ @include typography($theme);
120
+ } @else {
121
+ @include base($theme);
122
+ @if inspection.theme-has($theme, color) {
123
+ @include color($theme);
124
+ }
125
+ @if inspection.theme-has($theme, density) {
157
126
  @include density($theme);
127
+ }
128
+ @if inspection.theme-has($theme, typography) {
158
129
  @include typography($theme);
159
- } @else {
160
- @include base($theme);
161
- @if inspection.theme-has($theme, color) {
162
- @include color($theme);
163
- }
164
- @if inspection.theme-has($theme, density) {
165
- @include density($theme);
166
- }
167
- @if inspection.theme-has($theme, typography) {
168
- @include typography($theme);
169
- }
170
130
  }
171
131
  }
172
132
  }
@@ -1,32 +1,9 @@
1
1
  @use 'sass:color';
2
- @use 'sass:meta';
3
- @use 'sass:math';
4
- @use '../core/theming/inspection';
5
2
  @use '../core/style/elevation';
6
- @use '../core/style/sass-utils';
7
3
  @use '../core/tokens/m3-utils';
8
4
  @use '../core/tokens/m2-utils';
9
5
  @use 'sass:map';
10
6
 
11
- $_selected-fade-amount: 0.6;
12
- $_today-fade-amount: 0.2;
13
-
14
- // Utility that produces a range background color from a specific color.
15
- @function private-get-range-background-color($color) {
16
- @return rgba($color, 0.2);
17
- }
18
-
19
- // Utility that produces the overlap selected color from an overlap color.
20
- @function private-get-default-overlap-selected-color($overlap-color) {
21
- @return color.adjust($overlap-color, $lightness: -30%);
22
- }
23
-
24
- // Default range comparison color.
25
- $private-default-comparison-color: private-get-range-background-color(#f9ab00);
26
-
27
- // Default range overlap color.
28
- $private-default-overlap-color: #a8dab5;
29
-
30
7
  // Tokens that can't be configured through Angular Material's current theming API,
31
8
  // but may be in a future version of the theming API.
32
9
  @function get-unthemable-tokens() {
@@ -39,139 +16,72 @@ $private-default-overlap-color: #a8dab5;
39
16
  }
40
17
 
41
18
  // Tokens that can be configured through Angular Material's color theming API.
42
- @function get-color-tokens($theme) {
19
+ @function get-color-tokens($theme, $color-variant) {
43
20
  $system: m2-utils.get-system($theme);
44
-
45
- $inactive-icon-color: inspection.get-theme-color($theme, foreground, icon);
21
+ $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
46
22
  $disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
47
- $hint-text-color: inspection.get-theme-color($theme, foreground, hint-text);
48
- $preview-outline-color: map.get($system, outline);
49
- $today-disabled-outline-color: null;
50
- $is-dark: inspection.get-theme-type($theme) == dark;
51
- $system: m2-utils.get-system($theme);
52
23
 
53
- $primary-color: map.get($system, primary);
54
- $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
55
- $calendar-tokens: private-get-calendar-color-palette-color-tokens($theme, primary);
56
- $toggle-tokens: private-get-toggle-color-palette-color-tokens($theme, primary);
57
-
58
- // The divider color is set under the assumption that it'll be used
59
- // for a solid border, but because we're using a dashed border for the
60
- // preview range, we need to bump its opacity to ensure that it's visible.
61
- @if meta.type-of($preview-outline-color) == color {
62
- $preview-outline-opacity: math.min(color.opacity($preview-outline-color) * 2, 1);
63
- $preview-outline-color: rgba($preview-outline-color, $preview-outline-opacity);
64
- }
65
-
66
- @if (meta.type-of($hint-text-color) == color) {
67
- $today-disabled-outline-color: color.adjust($hint-text-color, $alpha: -$_today-fade-amount);
68
- }
69
- @else {
70
- $today-disabled-outline-color: $disabled;
71
- }
72
-
73
- @return sass-utils.merge-all($calendar-tokens, $toggle-tokens, $range-tokens, (
24
+ @return (
25
+ datepicker-calendar-date-in-range-state-background-color:
26
+ m3-utils.color-with-opacity(map.get($system, primary), 20%),
27
+ datepicker-calendar-date-in-comparison-range-state-background-color:
28
+ m3-utils.color-with-opacity(map.get($system, secondary), 20%),
29
+ datepicker-calendar-date-in-overlap-range-state-background-color: #a8dab5,
30
+ datepicker-calendar-date-in-overlap-range-selected-state-background-color:
31
+ color.adjust(#a8dab5, $lightness: -30%),
32
+ datepicker-calendar-date-selected-state-text-color: map.get($system, on-primary),
33
+ datepicker-calendar-date-selected-state-background-color: map.get($system, primary),
34
+ datepicker-calendar-date-selected-disabled-state-background-color:
35
+ m3-utils.color-with-opacity(map.get($system, primary), 38%),
36
+ datepicker-calendar-date-today-selected-state-outline-color: map.get($system, on-primary),
37
+ datepicker-calendar-date-focus-state-background-color: m3-utils.color-with-opacity(
38
+ map.get($system, primary), map.get($system, focus-state-layer-opacity)),
39
+ datepicker-calendar-date-hover-state-background-color: m3-utils.color-with-opacity(
40
+ map.get($system, primary), map.get($system, hover-state-layer-opacity)),
41
+
42
+ datepicker-toggle-active-state-icon-color: map.get($system, primary),
74
43
  datepicker-toggle-icon-color: map.get($system, on-surface-variant),
75
44
  datepicker-calendar-body-label-text-color: map.get($system, on-surface-variant),
76
- datepicker-calendar-period-button-text-color:
77
- inspection.get-theme-color($theme, foreground, base),
45
+ datepicker-calendar-period-button-text-color: map.get($system, on-surface),
78
46
  datepicker-calendar-period-button-icon-color: map.get($system, on-surface-variant),
79
47
  datepicker-calendar-navigation-button-icon-color: map.get($system, on-surface-variant),
80
48
  datepicker-calendar-header-divider-color: map.get($system, outline),
81
49
  datepicker-calendar-header-text-color: map.get($system, on-surface-variant),
82
50
 
83
- // Note: though it's not text, the border is a hint about the fact
84
- // that this is today's date, so we use the hint color.
85
- datepicker-calendar-date-today-outline-color: $hint-text-color,
86
- datepicker-calendar-date-today-disabled-state-outline-color: $today-disabled-outline-color,
51
+ datepicker-calendar-date-today-outline-color: map.get($system, on-surface-variant),
52
+ datepicker-calendar-date-today-disabled-state-outline-color: $disabled,
87
53
  datepicker-calendar-date-text-color: map.get($system, on-surface),
88
54
  datepicker-calendar-date-outline-color: transparent,
89
55
  datepicker-calendar-date-disabled-state-text-color: $disabled,
90
- datepicker-calendar-date-preview-state-outline-color: $preview-outline-color,
56
+ datepicker-calendar-date-preview-state-outline-color: map.get($system, on-surface-variant),
91
57
  datepicker-range-input-separator-color: map.get($system, on-surface),
92
58
  datepicker-range-input-disabled-state-separator-color: $disabled,
93
59
  datepicker-range-input-disabled-state-text-color: $disabled,
94
60
  datepicker-calendar-container-background-color: map.get($system, surface),
95
61
  datepicker-calendar-container-text-color: map.get($system, on-surface),
96
- ));
62
+ );
97
63
  }
98
64
 
99
65
  // Tokens that can be configured through Angular Material's typography theming API.
100
66
  @function get-typography-tokens($theme) {
67
+ $system: m2-utils.get-system($theme);
101
68
  @return (
102
69
  // TODO(crisbeto): the typography tokens for other components set every typography dimension of
103
70
  // an element (e.g. size, weight, line height, letter spacing). These tokens only set the values
104
71
  // that were set in the previous theming API to reduce the amount of subtle screenshot
105
72
  // differences. We should look into introducing the other tokens in a follow-up.
106
- datepicker-calendar-text-font: inspection.get-theme-typography($theme, body-1, font-family),
73
+ datepicker-calendar-text-font: map.get($system, body-large-font),
107
74
  datepicker-calendar-text-size: 13px,
108
-
109
- datepicker-calendar-body-label-text-size:
110
- inspection.get-theme-typography($theme, button, font-size),
111
- datepicker-calendar-body-label-text-weight:
112
- inspection.get-theme-typography($theme, button, font-weight),
113
-
114
- datepicker-calendar-period-button-text-size:
115
- inspection.get-theme-typography($theme, button, font-size),
116
- datepicker-calendar-period-button-text-weight:
117
- inspection.get-theme-typography($theme, button, font-weight),
118
-
75
+ datepicker-calendar-body-label-text-size: map.get($system, label-small-size),
76
+ datepicker-calendar-body-label-text-weight: map.get($system, label-small-weight),
77
+ datepicker-calendar-period-button-text-size: map.get($system, label-small-size),
78
+ datepicker-calendar-period-button-text-weight: map.get($system, label-small-weight),
119
79
  datepicker-calendar-header-text-size: 11px,
120
80
  datepicker-calendar-header-text-weight:
121
- inspection.get-theme-typography($theme, body-1, font-weight),
81
+ map.get($system, body-large-weight),
122
82
  );
123
83
  }
124
84
 
125
- // Gets the tokens map that can be used to override the range colors.
126
- @function get-range-color-tokens(
127
- $range-color,
128
- $comparison-color: $private-default-comparison-color,
129
- $overlap-color: $private-default-overlap-color,
130
- $overlap-selected-color: private-get-default-overlap-selected-color($overlap-color)) {
131
-
132
- @return (
133
- datepicker-calendar-date-in-range-state-background-color: $range-color,
134
- datepicker-calendar-date-in-comparison-range-state-background-color: $comparison-color,
135
- datepicker-calendar-date-in-overlap-range-state-background-color: $overlap-color,
136
- datepicker-calendar-date-in-overlap-range-selected-state-background-color:
137
- $overlap-selected-color,
138
- );
139
- }
140
-
141
- @function private-get-calendar-color-palette-color-tokens($theme, $color-variant) {
142
- $system: m2-utils.get-system($theme);
143
- $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
144
-
145
- $palette-color: map.get($system, primary);
146
- $default-contrast: map.get($system, on-primary);
147
- $active-background-color: m3-utils.color-with-opacity(map.get($system, primary), 30%);
148
- $active-disabled-color: null;
149
-
150
- @if (meta.type-of($palette-color) == color) {
151
- $active-disabled-color: color.adjust($palette-color, $alpha: -$_selected-fade-amount);
152
- }
153
- @else {
154
- $active-disabled-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
155
- }
156
-
157
- @return (
158
- datepicker-calendar-date-selected-state-text-color: $default-contrast,
159
- datepicker-calendar-date-selected-state-background-color: $palette-color,
160
- datepicker-calendar-date-selected-disabled-state-background-color: $active-disabled-color,
161
- datepicker-calendar-date-today-selected-state-outline-color: $default-contrast,
162
- datepicker-calendar-date-focus-state-background-color: $active-background-color,
163
- datepicker-calendar-date-hover-state-background-color: $active-background-color,
164
- );
165
- }
166
-
167
- @function private-get-toggle-color-palette-color-tokens($theme, $palette-name) {
168
- @return (
169
- datepicker-toggle-active-state-icon-color:
170
- inspection.get-theme-color($theme, $palette-name, text),
171
- );
172
- }
173
-
174
-
175
85
  // Tokens that can be configured through Angular Material's density theming API.
176
86
  @function get-density-tokens($theme) {
177
87
  @return ();
@@ -1127,7 +1127,7 @@ interface MatDatepickerControl<D> {
1127
1127
  getOverlayLabelId(): string | null;
1128
1128
  stateChanges: Observable<void>;
1129
1129
  }
1130
- /** A datepicker that can be attached to a {@link MatDatepickerControl}. */
1130
+ /** A datepicker that can be attached to a `MatDatepickerControl`. */
1131
1131
  interface MatDatepickerPanel<C extends MatDatepickerControl<D>, S, D = ExtractDateTypeFromSelection<S>> {
1132
1132
  /** Stream that emits whenever the date picker is closed. */
1133
1133
  closedStream: EventEmitter<void>;
@@ -1,48 +1,44 @@
1
1
  @use 'sass:map';
2
- @use '../core/style/sass-utils';
3
2
  @use './m2-dialog';
4
3
  @use './m3-dialog';
5
4
  @use '../core/tokens/token-utils';
6
- @use '../core/theming/theming';
7
5
  @use '../core/theming/inspection';
8
6
  @use '../core/typography/typography';
9
7
 
10
8
  @mixin base($theme) {
9
+ $tokens: m2-dialog.get-unthemable-tokens();
11
10
  @if inspection.get-theme-version($theme) == 1 {
12
- @include token-utils.create-token-values(map.get(m3-dialog.get-tokens($theme), base));
13
- } @else {
14
- // Add default values for tokens not related to color, typography, or density.
15
- @include sass-utils.current-selector-or-root() {
16
- @include token-utils.create-token-values-mixed(m2-dialog.get-unthemable-tokens());
17
- }
11
+ $tokens: map.get(m3-dialog.get-tokens($theme), base);
18
12
  }
13
+
14
+ @include token-utils.values($tokens);
19
15
  }
20
16
 
21
17
  @mixin color($theme) {
18
+ $tokens: m2-dialog.get-color-tokens($theme);
22
19
  @if inspection.get-theme-version($theme) == 1 {
23
- @include token-utils.create-token-values(map.get(m3-dialog.get-tokens($theme), color));
24
- } @else {
25
- @include sass-utils.current-selector-or-root() {
26
- @include token-utils.create-token-values-mixed(m2-dialog.get-color-tokens($theme));
27
- }
20
+ $tokens: map.get(m3-dialog.get-tokens($theme), color);
28
21
  }
22
+
23
+ @include token-utils.values($tokens);
29
24
  }
30
25
 
31
26
  @mixin typography($theme) {
27
+ $tokens: m2-dialog.get-typography-tokens($theme);
32
28
  @if inspection.get-theme-version($theme) == 1 {
33
- @include token-utils.create-token-values(map.get(m3-dialog.get-tokens($theme), typography));
34
- } @else {
35
- @include sass-utils.current-selector-or-root() {
36
- @include token-utils.create-token-values-mixed(m2-dialog.get-typography-tokens($theme));
37
- }
29
+ $tokens: map.get(m3-dialog.get-tokens($theme), typography);
38
30
  }
31
+
32
+ @include token-utils.values($tokens);
39
33
  }
40
34
 
41
35
  @mixin density($theme) {
36
+ $tokens: m2-dialog.get-density-tokens($theme);
42
37
  @if inspection.get-theme-version($theme) == 1 {
43
- @include token-utils.create-token-values(map.get(m3-dialog.get-tokens($theme), density));
44
- } @else {
38
+ $tokens: map.get(m3-dialog.get-tokens($theme), density);
45
39
  }
40
+
41
+ @include token-utils.values($tokens);
46
42
  }
47
43
 
48
44
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -60,23 +56,21 @@
60
56
  }
61
57
 
62
58
  @mixin theme($theme) {
63
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') {
64
- @if inspection.get-theme-version($theme) == 1 {
65
- @include base($theme);
59
+ @if inspection.get-theme-version($theme) == 1 {
60
+ @include base($theme);
61
+ @include color($theme);
62
+ @include density($theme);
63
+ @include typography($theme);
64
+ } @else {
65
+ @include base($theme);
66
+ @if inspection.theme-has($theme, color) {
66
67
  @include color($theme);
68
+ }
69
+ @if inspection.theme-has($theme, density) {
67
70
  @include density($theme);
71
+ }
72
+ @if inspection.theme-has($theme, typography) {
68
73
  @include typography($theme);
69
- } @else {
70
- @include base($theme);
71
- @if inspection.theme-has($theme, color) {
72
- @include color($theme);
73
- }
74
- @if inspection.theme-has($theme, density) {
75
- @include density($theme);
76
- }
77
- @if inspection.theme-has($theme, typography) {
78
- @include typography($theme);
79
- }
80
74
  }
81
75
  }
82
76
  }