-
Notifications
You must be signed in to change notification settings - Fork 6.8k
/
_datepicker-theme.scss
123 lines (105 loc) · 4.11 KB
/
_datepicker-theme.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@use 'sass:color';
@use 'sass:map';
@use '../core/tokens/m2/mat/datepicker' as tokens-mat-datepicker;
@use '../core/theming/theming';
@use '../core/tokens/token-utils';
@use '../core/style/sass-utils';
@use '../core/typography/typography';
@use '../button/icon-button-theme';
// TODO(crisbeto): these variables aren't used anymore and should be removed.
$selected-today-box-shadow-width: 1px;
$selected-fade-amount: 0.6;
$range-fade-amount: 0.2;
$today-fade-amount: 0.2;
$calendar-body-font-size: 13px !default;
$calendar-weekday-table-font-size: 11px !default;
@mixin _calendar-color($config, $palette) {
$palette-color: theming.get-color-from-palette(map.get($config, $palette));
$range-color: tokens-mat-datepicker.private-get-range-background-color($palette-color);
$range-tokens: tokens-mat-datepicker.get-range-color-tokens($range-color);
$calendar-tokens:
tokens-mat-datepicker.private-get-calendar-color-palette-color-tokens($config, $palette);
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
map.merge($calendar-tokens, $range-tokens));
}
@mixin color($config-or-theme) {
$config: theming.get-color-config($config-or-theme);
$foreground: map.get($config, foreground);
$background: map.get($config, background);
$disabled-color: theming.get-color-from-palette($foreground, disabled-text);
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
tokens-mat-datepicker.get-color-tokens($config));
}
.mat-datepicker-content {
&.mat-accent {
@include _calendar-color($config, accent);
}
&.mat-warn {
@include _calendar-color($config, warn);
}
}
.mat-datepicker-toggle-active {
&.mat-accent {
$accent-tokens:
tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, accent);
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $accent-tokens);
}
&.mat-warn {
$warn-tokens:
tokens-mat-datepicker.private-get-toggle-color-palette-color-tokens($config, warn);
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $warn-tokens);
}
}
}
@mixin typography($config-or-theme) {
$config: typography.private-typography-to-2014-config(
theming.get-typography-config($config-or-theme));
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix,
tokens-mat-datepicker.get-typography-tokens($config));
}
}
@mixin date-range-colors(
$range-color,
$comparison-color: tokens-mat-datepicker.$private-default-comparison-color,
$overlap-color: tokens-mat-datepicker.$private-default-overlap-color,
$overlap-selected-color:
tokens-mat-datepicker.private-get-default-overlap-selected-color($overlap-color)) {
$tokens: tokens-mat-datepicker.get-range-color-tokens(
$range-color: $range-color,
$comparison-color: $comparison-color,
$overlap-color: $overlap-color,
$overlap-selected-color: $overlap-selected-color,
);
@include sass-utils.current-selector-or-root() {
@include token-utils.create-token-values(tokens-mat-datepicker.$prefix, $tokens);
}
}
@mixin density($config-or-theme) {
$density-scale: theming.get-density-config($config-or-theme);
// TODO(crisbeto): move this into the structural styles
// once the icon button density is switched to tokens.
// Regardless of the user-passed density, we want the calendar
// previous/next buttons to remain at density -2
.mat-calendar-controls {
@include icon-button-theme.density(-2);
}
}
@mixin theme($theme-or-color-config) {
$theme: theming.private-legacy-get-theme($theme-or-color-config);
@include theming.private-check-duplicate-theme-styles($theme, 'mat-datepicker') {
$color: theming.get-color-config($theme);
$density: theming.get-density-config($theme);
$typography: theming.get-typography-config($theme);
@if $color != null {
@include color($color);
}
@if $density != null {
@include density($density);
}
@if $typography != null {
@include typography($typography);
}
}
}