@ng-matero/extensions 16.1.3 → 16.3.0

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 (147) hide show
  1. package/_index.scss +0 -3
  2. package/_theming.scss +0 -3
  3. package/alert/_alert-theme.scss +12 -28
  4. package/alert/alert.scss +28 -0
  5. package/colorpicker/_colorpicker-theme.scss +20 -8
  6. package/colorpicker/colorpicker-toggle.scss +23 -17
  7. package/column-resize/column-resize-notifier.d.ts +1 -1
  8. package/column-resize/polyfill.d.ts +1 -3
  9. package/column-resize/resizable.d.ts +1 -0
  10. package/column-resize/resize-strategy.d.ts +4 -3
  11. package/core/style/_sass-utils.scss +49 -0
  12. package/core/theming/_all-theme.scss +0 -2
  13. package/core/tokens/_token-utils.scss +127 -0
  14. package/core/tokens/m2/_index.scss +49 -0
  15. package/core/tokens/m2/mdc/_plain-tooltip.scss +72 -0
  16. package/core/tokens/m2/mtx/_alert.scss +55 -0
  17. package/core/tokens/m2/mtx/_colorpicker.scss +55 -0
  18. package/core/tokens/m2/mtx/_datetimepicker.scss +155 -0
  19. package/core/tokens/m2/mtx/_drawer.scss +45 -0
  20. package/core/tokens/m2/mtx/_grid.scss +57 -0
  21. package/core/tokens/m2/mtx/_loader.scss +45 -0
  22. package/core/tokens/m2/mtx/_popover.scss +46 -0
  23. package/core/tokens/m2/mtx/_progress.scss +56 -0
  24. package/core/tokens/m2/mtx/_select.scss +83 -0
  25. package/core/tokens/m2/mtx/_split.scss +54 -0
  26. package/core/typography/_typography.scss +203 -36
  27. package/datetimepicker/_datetimepicker-theme.scss +31 -183
  28. package/datetimepicker/calendar-body.scss +81 -1
  29. package/datetimepicker/calendar.scss +33 -3
  30. package/datetimepicker/clock.scss +50 -10
  31. package/datetimepicker/datetimepicker-content.scss +12 -0
  32. package/datetimepicker/datetimepicker-toggle.scss +23 -17
  33. package/datetimepicker/time.scss +41 -1
  34. package/drawer/_drawer-theme.scss +6 -10
  35. package/drawer/drawer-container.scss +11 -0
  36. package/esm2022/alert/alert.mjs +4 -4
  37. package/esm2022/colorpicker/colorpicker-toggle.mjs +2 -2
  38. package/esm2022/column-resize/column-resize-directives/column-resize-flex.mjs +3 -9
  39. package/esm2022/column-resize/column-resize-directives/column-resize.mjs +3 -9
  40. package/esm2022/column-resize/column-resize-directives/constants.mjs +1 -1
  41. package/esm2022/column-resize/column-resize-notifier.mjs +7 -2
  42. package/esm2022/column-resize/column-resize.mjs +3 -3
  43. package/esm2022/column-resize/event-dispatcher.mjs +5 -2
  44. package/esm2022/column-resize/polyfill.mjs +3 -19
  45. package/esm2022/column-resize/resizable.mjs +7 -7
  46. package/esm2022/column-resize/resize-ref.mjs +1 -1
  47. package/esm2022/column-resize/resize-strategy.mjs +16 -10
  48. package/esm2022/datetimepicker/calendar-body.mjs +2 -2
  49. package/esm2022/datetimepicker/calendar.mjs +3 -3
  50. package/esm2022/datetimepicker/clock.mjs +2 -2
  51. package/esm2022/datetimepicker/datetimepicker-toggle.mjs +2 -2
  52. package/esm2022/datetimepicker/datetimepicker.mjs +3 -3
  53. package/esm2022/datetimepicker/time.mjs +3 -3
  54. package/esm2022/drawer/drawer-container.mjs +3 -3
  55. package/esm2022/grid/cell.mjs +3 -19
  56. package/esm2022/grid/column-resize/column-resize-directives/common.mjs +1 -8
  57. package/esm2022/grid/column-resize/overlay-handle.mjs +11 -6
  58. package/esm2022/grid/column-resize/resizable-directives/common.mjs +1 -1
  59. package/esm2022/grid/column-resize/resizable-directives/resizable.mjs +3 -2
  60. package/esm2022/grid/column-resize/resize-strategy.mjs +10 -5
  61. package/esm2022/grid/grid-module.mjs +13 -9
  62. package/esm2022/grid/grid-utils.mjs +1 -9
  63. package/esm2022/grid/grid.mjs +28 -21
  64. package/esm2022/loader/loader.mjs +2 -2
  65. package/esm2022/photoviewer/mtxPhotoviewer.mjs +5 -0
  66. package/esm2022/photoviewer/photoviewer-module.mjs +17 -0
  67. package/esm2022/photoviewer/photoviewer.mjs +63 -0
  68. package/esm2022/photoviewer/public-api.mjs +3 -0
  69. package/esm2022/popover/popover-interfaces.mjs +1 -1
  70. package/esm2022/popover/popover.mjs +13 -3
  71. package/esm2022/progress/progress.mjs +4 -4
  72. package/esm2022/select/select.mjs +11 -3
  73. package/esm2022/split/split.mjs +2 -2
  74. package/esm2022/tooltip/tooltip.mjs +2 -2
  75. package/fesm2022/mtxAlert.mjs +3 -3
  76. package/fesm2022/mtxAlert.mjs.map +1 -1
  77. package/fesm2022/mtxColorpicker.mjs +2 -2
  78. package/fesm2022/mtxColorpicker.mjs.map +1 -1
  79. package/fesm2022/mtxColumnResize.mjs +38 -52
  80. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  81. package/fesm2022/mtxDatetimepicker.mjs +12 -12
  82. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  83. package/fesm2022/mtxDrawer.mjs +2 -2
  84. package/fesm2022/mtxDrawer.mjs.map +1 -1
  85. package/fesm2022/mtxGrid.mjs +188 -197
  86. package/fesm2022/mtxGrid.mjs.map +1 -1
  87. package/fesm2022/mtxLoader.mjs +2 -2
  88. package/fesm2022/mtxLoader.mjs.map +1 -1
  89. package/fesm2022/mtxPhotoviewer.mjs +84 -0
  90. package/fesm2022/mtxPhotoviewer.mjs.map +1 -0
  91. package/fesm2022/mtxPopover.mjs +12 -2
  92. package/fesm2022/mtxPopover.mjs.map +1 -1
  93. package/fesm2022/mtxProgress.mjs +3 -3
  94. package/fesm2022/mtxProgress.mjs.map +1 -1
  95. package/fesm2022/mtxSelect.mjs +10 -2
  96. package/fesm2022/mtxSelect.mjs.map +1 -1
  97. package/fesm2022/mtxSplit.mjs +2 -2
  98. package/fesm2022/mtxSplit.mjs.map +1 -1
  99. package/fesm2022/mtxTooltip.mjs +2 -2
  100. package/fesm2022/mtxTooltip.mjs.map +1 -1
  101. package/grid/_grid-theme.scss +14 -86
  102. package/grid/cell.d.ts +0 -2
  103. package/grid/cell.scss +0 -1
  104. package/grid/column-resize/_column-resize.scss +88 -94
  105. package/grid/column-resize/column-resize-directives/common.d.ts +0 -7
  106. package/grid/column-resize/overlay-handle.d.ts +1 -0
  107. package/grid/column-resize/resize-strategy.d.ts +2 -2
  108. package/grid/grid-module.d.ts +4 -4
  109. package/grid/grid-utils.d.ts +0 -6
  110. package/grid/grid.d.ts +10 -7
  111. package/grid/grid.scss +103 -15
  112. package/loader/_loader-theme.scss +6 -6
  113. package/loader/loader.scss +7 -0
  114. package/package.json +25 -25
  115. package/{slider → photoviewer}/index.d.ts +1 -1
  116. package/photoviewer/photoviewer-module.d.ts +7 -0
  117. package/photoviewer/photoviewer.d.ts +17 -0
  118. package/photoviewer/public-api.d.ts +2 -0
  119. package/popover/_popover-theme.scss +6 -40
  120. package/popover/popover-interfaces.d.ts +1 -0
  121. package/popover/popover.d.ts +6 -1
  122. package/popover/popover.scss +36 -2
  123. package/prebuilt-themes/deeppurple-amber.css +1 -1
  124. package/prebuilt-themes/indigo-pink.css +1 -1
  125. package/prebuilt-themes/pink-bluegrey.css +1 -1
  126. package/prebuilt-themes/purple-green.css +1 -1
  127. package/progress/_progress-theme.scss +6 -25
  128. package/progress/progress.scss +42 -0
  129. package/select/_select-theme.scss +19 -133
  130. package/select/select.d.ts +1 -0
  131. package/select/select.scss +147 -36
  132. package/split/_split-theme.scss +21 -18
  133. package/split/split.scss +13 -0
  134. package/tooltip/_tooltip-theme.scss +19 -24
  135. package/tooltip/tooltip.scss +18 -17
  136. package/esm2022/slider/mtxSlider.mjs +0 -5
  137. package/esm2022/slider/public-api.mjs +0 -3
  138. package/esm2022/slider/slider-module.mjs +0 -19
  139. package/esm2022/slider/slider.mjs +0 -1115
  140. package/fesm2022/mtxSlider.mjs +0 -1137
  141. package/fesm2022/mtxSlider.mjs.map +0 -1
  142. package/slider/_slider-theme.import.scss +0 -2
  143. package/slider/_slider-theme.scss +0 -232
  144. package/slider/public-api.d.ts +0 -2
  145. package/slider/slider-module.d.ts +0 -9
  146. package/slider/slider.d.ts +0 -277
  147. package/slider/slider.scss +0 -514
@@ -1,6 +1,9 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:math';
3
+ @use 'sass:meta';
2
4
  @use 'typography-utils';
3
5
  @use '../theming/theming';
6
+ @use '@material/typography' as mdc-typography;
4
7
 
5
8
  /// Defines a typography level from the Material Design spec.
6
9
  /// @param {String} $font-size The font-size for this level.
@@ -47,8 +50,7 @@
47
50
  /// @param {Map} $input Configuration for the "input" typographic level.
48
51
  /// @returns {Map} A typography config for the application.
49
52
  ///
50
- /// @deprecated Use `mat.define-typography-config` instead.
51
- /// See https://material.angular.io/guide/mdc-migration for information about migrating.
53
+ /// @deprecated Use `mat.define-typography-config` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
52
54
  /// @breaking-change 17.0.0
53
55
  @function define-legacy-typography-config(
54
56
  $font-family: 'Roboto, "Helvetica Neue", sans-serif',
@@ -64,7 +66,7 @@
64
66
  $body-1: define-typography-level(14px, 20px, 400),
65
67
  $caption: define-typography-level(12px, 20px, 400),
66
68
  $button: define-typography-level(14px, 14px, 500),
67
-
69
+
68
70
  $input: define-typography-level(inherit, 1.125, 400)
69
71
  ) {
70
72
 
@@ -98,6 +100,165 @@
98
100
  @return map.merge($config, (font-family: $font-family));
99
101
  }
100
102
 
103
+ // Converts a map containing rem values to a map containing px values.
104
+ @function _rem-to-px($x, $px-per-rem: 16px) {
105
+ @if meta.type-of($x) == 'map' {
106
+ @each $key, $val in $x {
107
+ $x: map.merge($x, ($key: _rem-to-px($val)));
108
+ }
109
+ @return $x;
110
+ }
111
+ @if meta.type-of($x) == 'number' and math.unit($x) == 'rem' {
112
+ @return math.div($x, 1rem) * $px-per-rem;
113
+ }
114
+ @else {
115
+ @return $x;
116
+ }
117
+ }
118
+
119
+ // Applies the default font family to all levels in a typography config.
120
+ @function _apply-font-family($font-family, $initial-config) {
121
+ $config: $initial-config;
122
+
123
+ @each $key, $level in $config {
124
+ @if map.get($level, 'font-family') == null {
125
+ // Sass maps are immutable so we have to re-assign the variable each time.
126
+ $config: map.set($config, $key, map.set($level, 'font-family', $font-family));
127
+ }
128
+ }
129
+
130
+ @return map.set($config, 'font-family', $font-family);
131
+ }
132
+
133
+ // Converts an MDC typography level config to an Angular Material one.
134
+ @function typography-config-level-from-mdc($mdc-level, $font-family: null) {
135
+ $mdc-level-config: map.get(mdc-typography.$styles, $mdc-level);
136
+
137
+ // Explicitly default the font family to null since we'll apply it globally
138
+ // through the `define-typgraphy-config`/`define-legacy-typography-config`.
139
+ @return define-typography-level(
140
+ $font-family: $font-family,
141
+ $font-size: map.get($mdc-level-config, font-size),
142
+ $line-height: map.get($mdc-level-config, line-height),
143
+ $font-weight: map.get($mdc-level-config, font-weight),
144
+ $letter-spacing: map.get($mdc-level-config, letter-spacing)
145
+ );
146
+ }
147
+
148
+ /// Generates an Angular Material typography config based on values from the official Material
149
+ /// Design spec implementation (MDC Web). All arguments are optional, but may be passed to override
150
+ /// the default values. The `mat-typography-level` function can be used to generate a custom
151
+ /// typography level map which can be passed to this function to override one of the default levels.
152
+ /// All default typography sizing generated by this function is in `px` units.
153
+ ///
154
+ /// @param {String} $font-family The font family to use for levels where it is not explicitly
155
+ /// specified.
156
+ /// @param {Map} $headline-1 The font settings for the headline-1 font level.
157
+ /// @param {Map} $headline-2 The font settings for the headline-2 font level.
158
+ /// @param {Map} $headline-3 The font settings for the headline-3 font level.
159
+ /// @param {Map} $headline-4 The font settings for the headline-4 font level.
160
+ /// @param {Map} $headline-5 The font settings for the headline-5 font level.
161
+ /// @param {Map} $headline-6 The font settings for the headline-6 font level.
162
+ /// @param {Map} $subtitle-1 The font settings for the subtitle-1 font level.
163
+ /// @param {Map} $subtitle-2 The font settings for the subtitle-2 font level.
164
+ /// @param {Map} $body-1 The font settings for the body-1 font level.
165
+ /// @param {Map} $body-2 The font settings for the body-2 font level.
166
+ /// @param {Map} $caption The font settings for the caption font level.
167
+ /// @param {Map} $button The font settings for the button font level.
168
+ /// @param {Map} $overline The font settings for the overline font level.
169
+ /// @return {Map} A map containing font settings for each of the levels in the Material Design spec.
170
+ @function define-typography-config(
171
+ // TODO(mmalerba): rename this function to define-typography-config,
172
+ // and create a predefined px based config for people that need it.
173
+ $font-family: mdc-typography.$font-family,
174
+ $headline-1: null,
175
+ $headline-2: null,
176
+ $headline-3: null,
177
+ $headline-4: null,
178
+ $headline-5: null,
179
+ $headline-6: null,
180
+ $subtitle-1: null,
181
+ $subtitle-2: null,
182
+ $body-1: null,
183
+ $body-2: null,
184
+ $caption: null,
185
+ $button: null,
186
+ $overline: null,
187
+ ) {
188
+ @return _apply-font-family($font-family, (
189
+ headline-1: $headline-1 or _rem-to-px(typography-config-level-from-mdc(headline1)),
190
+ headline-2: $headline-2 or _rem-to-px(typography-config-level-from-mdc(headline2)),
191
+ headline-3: $headline-3 or _rem-to-px(typography-config-level-from-mdc(headline3)),
192
+ headline-4: $headline-4 or _rem-to-px(typography-config-level-from-mdc(headline4)),
193
+ headline-5: $headline-5 or _rem-to-px(typography-config-level-from-mdc(headline5)),
194
+ headline-6: $headline-6 or _rem-to-px(typography-config-level-from-mdc(headline6)),
195
+ subtitle-1: $subtitle-1 or _rem-to-px(typography-config-level-from-mdc(subtitle1)),
196
+ subtitle-2: $subtitle-2 or _rem-to-px(typography-config-level-from-mdc(subtitle2)),
197
+ body-1: $body-1 or _rem-to-px(typography-config-level-from-mdc(body1)),
198
+ body-2: $body-2 or _rem-to-px(typography-config-level-from-mdc(body2)),
199
+ caption: $caption or _rem-to-px(typography-config-level-from-mdc(caption)),
200
+ button: $button or _rem-to-px(typography-config-level-from-mdc(button)),
201
+ overline: $overline or _rem-to-px(typography-config-level-from-mdc(overline)),
202
+ ));
203
+ }
204
+
205
+ /// Generates an Angular Material typography config based on values from the official Material
206
+ /// Design spec implementation (MDC Web). All arguments are optional, but may be passed to override
207
+ /// the default values. The `mat-typography-level` function can be used to generate a custom
208
+ /// typography level map which can be passed to this function to override one of the default levels.
209
+ /// All default typography sizing generated by this function is in `rem` units.
210
+ ///
211
+ /// @param {String} $font-family The font family to use for levels where it is not explicitly
212
+ /// specified.
213
+ /// @param {Map} $headline-1 The font settings for the headline-1 font level.
214
+ /// @param {Map} $headline-2 The font settings for the headline-2 font level.
215
+ /// @param {Map} $headline-3 The font settings for the headline-3 font level.
216
+ /// @param {Map} $headline-4 The font settings for the headline-4 font level.
217
+ /// @param {Map} $headline-5 The font settings for the headline-5 font level.
218
+ /// @param {Map} $headline-6 The font settings for the headline-6 font level.
219
+ /// @param {Map} $subtitle-1 The font settings for the subtitle-1 font level.
220
+ /// @param {Map} $subtitle-2 The font settings for the subtitle-2 font level.
221
+ /// @param {Map} $body-1 The font settings for the body-1 font level.
222
+ /// @param {Map} $body-2 The font settings for the body-2 font level.
223
+ /// @param {Map} $caption The font settings for the caption font level.
224
+ /// @param {Map} $button The font settings for the button font level.
225
+ /// @param {Map} $overline The font settings for the overline font level.
226
+ /// @return {Map} A map containing font settings for each of the levels in the Material Design spec.
227
+ @function define-rem-typography-config(
228
+ // TODO(mmalerba): rename this function to define-typography-config,
229
+ // and create a predefined px based config for people that need it.
230
+ $font-family: mdc-typography.$font-family,
231
+ $headline-1: null,
232
+ $headline-2: null,
233
+ $headline-3: null,
234
+ $headline-4: null,
235
+ $headline-5: null,
236
+ $headline-6: null,
237
+ $subtitle-1: null,
238
+ $subtitle-2: null,
239
+ $body-1: null,
240
+ $body-2: null,
241
+ $caption: null,
242
+ $button: null,
243
+ $overline: null,
244
+ ) {
245
+ @return _apply-font-family($font-family, (
246
+ headline-1: $headline-1 or typography-config-level-from-mdc(headline1),
247
+ headline-2: $headline-2 or typography-config-level-from-mdc(headline2),
248
+ headline-3: $headline-3 or typography-config-level-from-mdc(headline3),
249
+ headline-4: $headline-4 or typography-config-level-from-mdc(headline4),
250
+ headline-5: $headline-5 or typography-config-level-from-mdc(headline5),
251
+ headline-6: $headline-6 or typography-config-level-from-mdc(headline6),
252
+ subtitle-1: $subtitle-1 or typography-config-level-from-mdc(subtitle1),
253
+ subtitle-2: $subtitle-2 or typography-config-level-from-mdc(subtitle2),
254
+ body-1: $body-1 or typography-config-level-from-mdc(body1),
255
+ body-2: $body-2 or typography-config-level-from-mdc(body2),
256
+ caption: $caption or typography-config-level-from-mdc(caption),
257
+ button: $button or typography-config-level-from-mdc(button),
258
+ overline: $overline or typography-config-level-from-mdc(overline),
259
+ ));
260
+ }
261
+
101
262
  // Whether a config is for the Material Design 2018 typography system.
102
263
  @function private-typography-is-2018-config($config) {
103
264
  @return map.get($config, headline-1) != null;
@@ -121,18 +282,19 @@
121
282
  }
122
283
  @if not private-typography-is-2014-config($config) {
123
284
  $args: (
124
- display-4: map.get($config, headline-1),
125
- display-3: map.get($config, headline-2),
126
- display-2: map.get($config, headline-3),
127
- display-1: map.get($config, headline-4),
128
- headline: map.get($config, headline-5),
129
- title: map.get($config, headline-6),
130
- subheading-2: map.get($config, subtitle-1),
131
- subheading-1: map.get($config, subtitle-2),
132
- body-2: map.get($config, body-1),
133
- body-1: map.get($config, body-2),
134
- button: map.get($config, button),
135
- caption: map.get($config, caption),
285
+ display-4: map.get($config, headline-1),
286
+ display-3: map.get($config, headline-2),
287
+ display-2: map.get($config, headline-3),
288
+ display-1: map.get($config, headline-4),
289
+ headline: map.get($config, headline-5),
290
+ title: map.get($config, headline-6),
291
+ subheading-2: map.get($config, subtitle-1),
292
+ subheading-1: map.get($config, subtitle-2),
293
+ body-2: map.get($config, body-1),
294
+ body-1: map.get($config, body-2),
295
+ button: map.get($config, button),
296
+ caption: map.get($config, caption),
297
+ font-family: map.get($config, font-family),
136
298
  );
137
299
  $non-null-args: ();
138
300
  @each $key, $value in $args {
@@ -155,21 +317,27 @@
155
317
  }
156
318
  @if not private-typography-is-2018-config($config) {
157
319
  @return (
158
- headline-1: map.get($config, display-4),
159
- headline-2: map.get($config, display-3),
160
- headline-3: map.get($config, display-2),
161
- headline-4: map.get($config, display-1),
162
- headline-5: map.get($config, headline),
163
- headline-6: map.get($config, title),
164
- subtitle-1: map.get($config, subheading-2),
165
-
166
- subtitle-2: map.get($config, body-2),
167
- body-1: map.get($config, subheading-1),
168
-
169
- body-2: map.get($config, body-1),
170
- button: map.get($config, button),
171
- caption: map.get($config, caption),
172
- overline: if(map.get($config, overline), map.get($config, overline),define-typography-level(12px, 32px, 500))
320
+ headline-1: map.get($config, display-4),
321
+ headline-2: map.get($config, display-3),
322
+ headline-3: map.get($config, display-2),
323
+ headline-4: map.get($config, display-1),
324
+ headline-5: map.get($config, headline),
325
+ headline-6: map.get($config, title),
326
+ subtitle-1: map.get($config, subheading-2),
327
+ font-famiy: map.get($config, font-family),
328
+
329
+ // These mappings are odd, but body-2 in the 2014 system actually looks closer to subtitle-2
330
+ // in the 2018 system, and subeading-1 in the 2014 system looks more like body-1 in the 2018
331
+ // system.
332
+ subtitle-2: map.get($config, body-2),
333
+ body-1: map.get($config, subheading-1),
334
+
335
+ body-2: map.get($config, body-1),
336
+ button: map.get($config, button),
337
+ caption: map.get($config, caption),
338
+ overline: if(map.get($config, overline), map.get($config, overline),
339
+ define-typography-level(12px, 32px, 500)
340
+ )
173
341
  );
174
342
  }
175
343
  @return $config;
@@ -232,7 +400,7 @@
232
400
  #{$selector} .mat-h5,
233
401
  #{$selector} h5 {
234
402
  @include typography-utils.font-shorthand(
235
-
403
+
236
404
  calc(#{typography-utils.font-size($config, body-2)} * .83),
237
405
  typography-utils.font-weight($config, body-2),
238
406
  typography-utils.line-height($config, body-2),
@@ -246,7 +414,7 @@
246
414
  #{$selector} .mat-h6,
247
415
  #{$selector} h6 {
248
416
  @include typography-utils.font-shorthand(
249
-
417
+
250
418
  calc(#{typography-utils.font-size($config, body-2)} * .67),
251
419
  typography-utils.font-weight($config, body-2),
252
420
  typography-utils.line-height($config, body-2),
@@ -315,8 +483,7 @@
315
483
  /// @param {Map} $config-or-theme A typography config for an entire theme.
316
484
  /// @param {String} $selector Ancestor selector under which native elements, such as h1, will
317
485
  /// be styled.
318
- /// @deprecated Use `mat.typography-hierarchy` instead.
319
- /// See https://material.angular.io/guide/mdc-migration for information about migrating.
486
+ /// @deprecated Use `mat.typography-hierarchy` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
320
487
  /// @breaking-change 17.0.0
321
488
  @mixin legacy-typography-hierarchy($config-or-theme, $selector: '.mat-typography') {
322
489
  $config: private-typography-to-2014-config(theming.get-typography-config($config-or-theme));
@@ -371,7 +538,7 @@
371
538
  #{$selector} .mat-h5,
372
539
  #{$selector} h5 {
373
540
  @include typography-utils.font-shorthand(
374
-
541
+
375
542
  calc(#{typography-utils.font-size($config, body-1)} * .83),
376
543
  typography-utils.font-weight($config, body-1),
377
544
  typography-utils.line-height($config, body-1),
@@ -385,7 +552,7 @@
385
552
  #{$selector} .mat-h6,
386
553
  #{$selector} h6 {
387
554
  @include typography-utils.font-shorthand(
388
-
555
+
389
556
  calc(#{typography-utils.font-size($config, body-1)} * .67),
390
557
  typography-utils.font-weight($config, body-1),
391
558
  typography-utils.line-height($config, body-1),
@@ -1,209 +1,54 @@
1
1
  @use 'sass:map';
2
2
  @use '../core/theming/theming';
3
- @use '../core/theming/palette';
4
- @use '../core/style/private';
5
3
  @use '../core/typography/typography';
6
- @use '../core/typography/typography-utils';
4
+ @use '../core/style/sass-utils';
5
+ @use '../core/tokens/token-utils';
6
+ @use '../core/tokens/m2/mtx/datetimepicker' as tokens-mtx-datetimepicker;
7
7
 
8
- $selected-today-box-shadow-width: 1px;
9
- $calendar-body-font-size: 13px !default;
10
- $calendar-weekday-table-font-size: 11px !default;
11
- $clock-font-size: 14px !default;
8
+ @mixin _calendar-color($config, $palette) {
9
+ $palette-color: theming.get-color-from-palette(map.get($config, $palette));
10
+ $calendar-tokens: tokens-mtx-datetimepicker.private-get-calendar-color-palette-color-tokens($config, $palette);
11
+
12
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix, $calendar-tokens);
13
+ }
12
14
 
13
15
  @mixin color($config-or-theme) {
14
16
  $config: theming.get-color-config($config-or-theme);
15
- $is-dark-theme: map.get($config, is-dark);
16
- $primary: map.get($config, primary);
17
- $accent: map.get($config, accent);
18
- $warn: map.get($config, warn);
19
- $background: map.get($config, background);
20
- $foreground: map.get($config, foreground);
21
- $disabled-color: theming.get-color-from-palette($foreground, disabled-text);
22
-
23
- .mtx-datetimepicker-content {
24
- background-color: theming.get-color-from-palette($background, card);
25
- color: theming.get-color-from-palette($foreground, text);
26
-
27
- @include private.private-theme-elevation(8, $config);
28
- }
29
-
30
- .mtx-calendar-header {
31
- background-color: theming.get-color-from-palette($primary);
32
- color: white;
33
- }
34
-
35
- .mtx-calendar-body-label {
36
- color: theming.get-color-from-palette($foreground, secondary-text);
37
- }
38
-
39
- .mtx-calendar-table-header {
40
- color: theming.get-color-from-palette($foreground, hint-text);
41
- }
42
-
43
- .mtx-calendar-body-cell-content {
44
- color: theming.get-color-from-palette($foreground, text);
45
-
46
- &.mtx-calendar-body-selected {
47
- background-color: theming.get-color-from-palette($primary);
48
- color: white;
49
-
50
- &.mtx-calendar-body-today {
51
- box-shadow:
52
- inset 0 0 0 $selected-today-box-shadow-width
53
- theming.get-color-from-palette($primary, default-contrast);
54
- }
55
- }
56
-
57
- &:not(.mtx-calendar-body-selected) {
58
- &.mtx-calendar-body-today {
59
- border-color: theming.get-color-from-palette($foreground, hint-text);
60
- }
61
- }
62
- }
63
-
64
- .mtx-calendar-body-cell:not(.mtx-calendar-body-disabled):hover,
65
- .mtx-calendar-body-active {
66
- & > .mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected) {
67
- background-color: theming.get-color-from-palette($primary, .3);
68
- }
69
- }
70
-
71
- .mtx-calendar-body-disabled {
72
- > .mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected) {
73
- color: $disabled-color;
74
- }
75
-
76
- > .mtx-calendar-body-today:not(.mtx-calendar-body-selected) {
77
- border-color: $disabled-color;
78
- }
79
-
80
- > .mtx-calendar-body-selected {
81
- background-color: theming.get-color-from-palette($primary, .4);
82
- }
83
- }
84
-
85
- .mtx-calendar-previous-button,
86
- .mtx-calendar-next-button {
87
- &.disabled {
88
- color: $disabled-color;
89
- }
90
- }
91
-
92
- .mtx-clock-wrapper {
93
- background-color: theming.get-color-from-palette($foreground, divider);
94
- }
95
-
96
- .mtx-clock-center {
97
- background-color: theming.get-color-from-palette($primary);
98
- }
99
17
 
100
- .mtx-clock-hand {
101
- background-color: theming.get-color-from-palette($primary);
102
-
103
- &::before {
104
- background-color: theming.get-color-from-palette($primary);
105
- }
18
+ @include sass-utils.current-selector-or-root() {
19
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix,
20
+ tokens-mtx-datetimepicker.get-color-tokens($config));
106
21
  }
107
22
 
108
- .mtx-clock-cell {
109
- color: theming.get-color-from-palette($foreground, text);
110
-
111
- &.mtx-clock-cell-selected {
112
- background-color: theming.get-color-from-palette($primary);
113
- color: white;
114
- }
115
-
116
- &:not(.mtx-clock-cell-selected, .mtx-clock-cell-disabled):hover {
117
- background-color: theming.get-color-from-palette($background, hover);
23
+ .mtx-datetimepicker-content {
24
+ &.mat-accent {
25
+ @include _calendar-color($config, accent);
118
26
  }
119
27
 
120
- &.mtx-clock-cell-disabled {
121
- color: $disabled-color;
28
+ &.mat-warn {
29
+ @include _calendar-color($config, warn);
122
30
  }
123
31
  }
124
32
 
125
33
  .mtx-datetimepicker-toggle-active {
126
- color: theming.get-color-from-palette($primary);
127
-
128
34
  &.mat-accent {
129
- color: theming.get-color-from-palette($accent);
35
+ $accent-tokens: tokens-mtx-datetimepicker.private-get-toggle-color-palette-color-tokens($config, accent);
36
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix, $accent-tokens);
130
37
  }
131
38
 
132
39
  &.mat-warn {
133
- color: theming.get-color-from-palette($warn);
134
- }
135
- }
136
-
137
- .mtx-time-input {
138
- color: theming.get-color-from-palette($foreground, text);
139
- background-color: theming.get-color-from-palette($background, disabled-button);
140
-
141
- &.mtx-time-input-active {
142
- color: theming.get-color-from-palette($primary);
143
- background-color: theming.get-color-from-palette($primary, .2);
144
-
145
- &:focus {
146
- border-color: theming.get-color-from-palette($primary);
147
- background-color: theming.get-color-from-palette($background, background);
148
-
149
- &::placeholder {
150
- color: theming.get-color-from-palette($primary, .6);
151
- }
152
- }
153
- }
154
-
155
- &.mtx-time-input-warning {
156
- border-color: theming.get-color-from-palette($warn);
157
- }
158
- }
159
-
160
- .mtx-time-ampm {
161
- .mtx-time-am,
162
- .mtx-time-pm {
163
- --mdc-text-button-label-text-color: #{theming.get-color-from-palette($foreground, text, .75)};
164
-
165
- border-color: theming.get-color-from-palette($foreground, hint-text);
166
-
167
- &.mtx-time-ampm-active {
168
- --mdc-text-button-label-text-color: #{theming.get-color-from-palette($foreground, text)};
169
- --mdc-typography-button-font-weight: 500;
170
-
171
- background-color: theming.get-color-from-palette($accent, .2);
172
- }
40
+ $warn-tokens: tokens-mtx-datetimepicker.private-get-toggle-color-palette-color-tokens($config, warn);
41
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix, $warn-tokens);
173
42
  }
174
43
  }
175
44
  }
176
45
 
177
46
  @mixin typography($config-or-theme) {
178
- $config: typography.private-typography-to-2014-config(
179
- theming.get-typography-config($config-or-theme)
180
- );
181
-
182
- .mtx-calendar {
183
- font-family: typography-utils.font-family($config);
184
- }
185
-
186
- .mtx-calendar-body {
187
- font-size: $calendar-body-font-size;
188
- }
47
+ $config: typography.private-typography-to-2014-config(theming.get-typography-config($config-or-theme));
189
48
 
190
- .mtx-calendar-body-label,
191
- .mtx-calendar-period-button {
192
- font: {
193
- size: typography-utils.font-size($config, button);
194
- weight: typography-utils.font-weight($config, button);
195
- }
196
- }
197
-
198
- .mtx-calendar-table-header th {
199
- font: {
200
- size: $calendar-weekday-table-font-size;
201
- weight: typography-utils.font-weight($config, body-1);
202
- }
203
- }
204
-
205
- .mtx-clock {
206
- font-size: $clock-font-size;
49
+ @include sass-utils.current-selector-or-root() {
50
+ @include token-utils.create-token-values(tokens-mtx-datetimepicker.$prefix,
51
+ tokens-mtx-datetimepicker.get-typography-tokens($config));
207
52
  }
208
53
  }
209
54
 
@@ -211,18 +56,21 @@ $clock-font-size: 14px !default;
211
56
 
212
57
  @mixin theme($theme-or-color-config) {
213
58
  $theme: theming.private-legacy-get-theme($theme-or-color-config);
59
+
214
60
  @include theming.private-check-duplicate-theme-styles($theme, 'mtx-datetimepicker') {
215
61
  $color: theming.get-color-config($theme);
216
62
  $density: theming.get-density-config($theme);
217
63
  $typography: theming.get-typography-config($theme);
218
64
 
219
- @if $color != null {
65
+ @if $color !=null {
220
66
  @include color($color);
221
67
  }
222
- @if $density != null {
68
+
69
+ @if $density !=null {
223
70
  @include density($density);
224
71
  }
225
- @if $typography != null {
72
+
73
+ @if $typography !=null {
226
74
  @include typography($typography);
227
75
  }
228
76
  }
@@ -1,5 +1,6 @@
1
1
  @use 'sass:math';
2
- @use '../core/style/private';
2
+ @use '../core/tokens/token-utils';
3
+ @use '../core/tokens/m2/mtx/datetimepicker' as tokens-mtx-datetimepicker;
3
4
 
4
5
  $calendar-body-label-padding-start: 5% !default;
5
6
  $calendar-body-label-side-padding: math.div(33%, 7) !default;
@@ -13,16 +14,48 @@ $calendar-body-cell-radius: 999px !default;
13
14
  $calendar-body-min-size: 7 * $calendar-body-cell-min-size !default;
14
15
  $calendar-body-cell-content-size: 100% - $calendar-body-cell-content-margin * 2 !default;
15
16
 
17
+ $_tokens: tokens-mtx-datetimepicker.$prefix, tokens-mtx-datetimepicker.get-token-slots();
18
+
19
+ // Styles for a highlighted calendar cell (e.g. hovered or focused).
20
+ @mixin _highlighted-cell($token-name) {
21
+ &>.mtx-calendar-body-cell-content {
22
+ @include _unselected-cell {
23
+ @include token-utils.create-token-slot(background-color, $token-name);
24
+ }
25
+ }
26
+ }
27
+
28
+ // Utility mixin to target cells that aren't selected. Used to make selector easier to follow.
29
+ @mixin _unselected-cell {
30
+ &:not(.mtx-calendar-body-selected) {
31
+ @content;
32
+ }
33
+ }
34
+
16
35
  .mtx-calendar-body {
17
36
  min-width: $calendar-body-min-size;
18
37
  }
19
38
 
39
+ .mtx-calendar-body-today {
40
+ @include _unselected-cell {
41
+ @include token-utils.use-tokens($_tokens...) {
42
+ @include token-utils.create-token-slot(border-color, calendar-date-today-outline-color);
43
+ }
44
+ }
45
+ }
46
+
20
47
  .mtx-calendar-body-label {
21
48
  height: 0;
22
49
  line-height: 0;
23
50
  text-align: left;
24
51
  padding: $calendar-body-cell-padding $calendar-body-label-side-padding;
25
52
 
53
+ @include token-utils.use-tokens($_tokens...) {
54
+ @include token-utils.create-token-slot(font-size, calendar-body-label-text-size);
55
+ @include token-utils.create-token-slot(font-weight, calendar-body-label-text-weight);
56
+ @include token-utils.create-token-slot(color, calendar-body-label-text-color);
57
+ }
58
+
26
59
  [dir='rtl'] & {
27
60
  text-align: right;
28
61
  }
@@ -42,6 +75,16 @@ $calendar-body-cell-content-size: 100% - $calendar-body-cell-content-margin * 2
42
75
  .mtx-calendar-body-disabled {
43
76
  cursor: default;
44
77
  pointer-events: none;
78
+
79
+ @include token-utils.use-tokens($_tokens...) {
80
+ >.mtx-calendar-body-cell-content:not(.mtx-calendar-body-selected) {
81
+ @include token-utils.create-token-slot(color, calendar-date-disabled-state-text-color);
82
+ }
83
+
84
+ >.mtx-calendar-body-today:not(.mtx-calendar-body-selected) {
85
+ @include token-utils.create-token-slot(border-color, calendar-date-disabled-state-text-color);
86
+ }
87
+ }
45
88
  }
46
89
 
47
90
  .mtx-calendar-body-cell-content {
@@ -56,4 +99,41 @@ $calendar-body-cell-content-size: 100% - $calendar-body-cell-content-margin * 2
56
99
  height: $calendar-body-cell-content-size;
57
100
  border: $calendar-body-cell-content-border-width solid transparent;
58
101
  border-radius: $calendar-body-cell-radius;
102
+
103
+ @include token-utils.use-tokens($_tokens...) {
104
+ @include token-utils.create-token-slot(color, calendar-date-text-color);
105
+ @include token-utils.create-token-slot(border-color, calendar-date-outline-color);
106
+ }
107
+ }
108
+
109
+ // TODO: cdk-keyboard-focused, cdk-program-focused
110
+ .mtx-calendar-body-active {
111
+ @include token-utils.use-tokens($_tokens...) {
112
+ @include _highlighted-cell(calendar-date-focus-state-background-color);
113
+ }
114
+ }
115
+
116
+ @media (hover: hover) {
117
+ .mtx-calendar-body-cell:not(.mtx-calendar-body-disabled):hover {
118
+ @include token-utils.use-tokens($_tokens...) {
119
+ @include _highlighted-cell(calendar-date-hover-state-background-color);
120
+ }
121
+ }
122
+ }
123
+
124
+ .mtx-calendar-body-selected {
125
+ @include token-utils.use-tokens($_tokens...) {
126
+ @include token-utils.create-token-slot(background-color, calendar-date-selected-state-background-color);
127
+ @include token-utils.create-token-slot(color, calendar-date-selected-state-text-color);
128
+
129
+ .mtx-calendar-body-disabled>& {
130
+ @include token-utils.create-token-slot(background-color, calendar-date-selected-disabled-state-background-color);
131
+ }
132
+
133
+ &.mtx-calendar-body-today {
134
+ $shadow: token-utils.get-token-variable(calendar-date-today-selected-state-outline-color);
135
+
136
+ box-shadow: inset 0 0 0 1px var(#{$shadow});
137
+ }
138
+ }
59
139
  }