source: trip-planner-front/node_modules/@angular/material/datepicker/_datepicker-theme.scss@ 76712b2

Last change on this file since 76712b2 was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

  • Property mode set to 100644
File size: 8.0 KB
Line 
1@use 'sass:color';
2@use 'sass:map';
3@use 'sass:math';
4@use 'sass:meta';
5@use '../core/style/private';
6@use '../core/theming/theming';
7@use '../core/typography/typography';
8@use '../core/typography/typography-utils';
9
10
11$selected-today-box-shadow-width: 1px;
12$selected-fade-amount: 0.6;
13$range-fade-amount: 0.2;
14$today-fade-amount: 0.2;
15$calendar-body-font-size: 13px !default;
16$calendar-weekday-table-font-size: 11px !default;
17
18@mixin _color($palette) {
19 @include date-range-colors(
20 theming.get-color-from-palette($palette, default, $range-fade-amount));
21
22 .mat-calendar-body-selected {
23 background-color: theming.get-color-from-palette($palette);
24 color: theming.get-color-from-palette($palette, default-contrast);
25 }
26
27 .mat-calendar-body-disabled > .mat-calendar-body-selected {
28 $background: theming.get-color-from-palette($palette);
29
30 @if (meta.type-of($background) == color) {
31 background-color: color.adjust($background, $alpha: -$selected-fade-amount);
32 }
33 @else {
34 // If we couldn't resolve to background to a color (e.g. it's a CSS variable),
35 // fall back to fading the content out via `opacity`.
36 opacity: $today-fade-amount;
37 }
38 }
39
40 .mat-calendar-body-today.mat-calendar-body-selected {
41 box-shadow: inset 0 0 0 $selected-today-box-shadow-width
42 theming.get-color-from-palette($palette, default-contrast);
43 }
44
45 .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover,
46 .cdk-keyboard-focused .mat-calendar-body-active,
47 .cdk-program-focused .mat-calendar-body-active {
48 & > .mat-calendar-body-cell-content {
49 @include _unselected-cell {
50 background-color: theming.get-color-from-palette($palette, 0.3);
51 }
52 }
53 }
54}
55
56// Utility mixin to target cells that aren't selected. Used to make selector easier to follow.
57@mixin _unselected-cell {
58 &:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) {
59 @content;
60 }
61}
62
63@mixin color($config-or-theme) {
64 $config: theming.get-color-config($config-or-theme);
65 $foreground: map.get($config, foreground);
66 $background: map.get($config, background);
67 $disabled-color: theming.get-color-from-palette($foreground, disabled-text);
68
69 .mat-calendar-arrow {
70 border-top-color: theming.get-color-from-palette($foreground, icon);
71 }
72
73 // The prev/next buttons need a bit more specificity to
74 // avoid being overwritten by the .mat-icon-button.
75 .mat-datepicker-toggle,
76 .mat-datepicker-content .mat-calendar-next-button,
77 .mat-datepicker-content .mat-calendar-previous-button {
78 color: theming.get-color-from-palette($foreground, icon);
79 }
80
81 .mat-calendar-table-header-divider::after {
82 background: theming.get-color-from-palette($foreground, divider);
83 }
84
85 .mat-calendar-table-header,
86 .mat-calendar-body-label {
87 color: theming.get-color-from-palette($foreground, secondary-text);
88 }
89
90 .mat-calendar-body-cell-content,
91 .mat-date-range-input-separator {
92 color: theming.get-color-from-palette($foreground, text);
93 border-color: transparent;
94 }
95
96 .mat-calendar-body-disabled > .mat-calendar-body-cell-content {
97 @include _unselected-cell {
98 color: $disabled-color;
99 }
100 }
101
102 .mat-form-field-disabled .mat-date-range-input-separator {
103 color: $disabled-color;
104 }
105
106 .mat-calendar-body-in-preview {
107 $divider-color: theming.get-color-from-palette($foreground, divider);
108
109 @if meta.type-of($divider-color) == color {
110 // The divider color is set under the assumption that it'll be used
111 // for a solid border, but because we're using a dashed border for the
112 // preview range, we need to bump its opacity to ensure that it's visible.
113 color: rgba($divider-color, math.min(opacity($divider-color) * 2, 1));
114 }
115 @else {
116 color: $divider-color;
117 }
118 }
119
120 .mat-calendar-body-today {
121 @include _unselected-cell {
122 // Note: though it's not text, the border is a hint about the fact that this is today's date,
123 // so we use the hint color.
124 border-color: theming.get-color-from-palette($foreground, hint-text);
125 }
126 }
127
128 .mat-calendar-body-disabled > .mat-calendar-body-today {
129 @include _unselected-cell {
130 $color: theming.get-color-from-palette($foreground, hint-text);
131
132 @if (meta.type-of($color) == color) {
133 border-color: color.adjust($color, $alpha: -$today-fade-amount);
134 }
135 @else {
136 // If the color didn't resolve to a color value, but something like a CSS variable, we can't
137 // fade it out so we fall back to reducing the element opacity. Note that we don't use the
138 // $mat-datepicker-today-fade-amount, because hint text usually has some opacity applied
139 // to it already and we don't want them to stack on top of each other.
140 opacity: 0.5;
141 }
142 }
143 }
144
145 @include _color(map.get($config, primary));
146
147 .mat-datepicker-content {
148 @include private.private-theme-elevation(4, $config);
149 background-color: theming.get-color-from-palette($background, card);
150 color: theming.get-color-from-palette($foreground, text);
151
152 &.mat-accent {
153 @include _color(map.get($config, accent));
154 }
155
156 &.mat-warn {
157 @include _color(map.get($config, warn));
158 }
159 }
160
161 .mat-datepicker-content-touch {
162 @include private.private-theme-elevation(24, $config);
163 }
164
165 .mat-datepicker-toggle-active {
166 color: theming.get-color-from-palette(map.get($config, primary), text);
167
168 &.mat-accent {
169 color: theming.get-color-from-palette(map.get($config, accent), text);
170 }
171
172 &.mat-warn {
173 color: theming.get-color-from-palette(map.get($config, warn), text);
174 }
175 }
176
177 .mat-date-range-input-inner[disabled] {
178 color: theming.get-color-from-palette($foreground, disabled-text);
179 }
180}
181
182@mixin typography($config-or-theme) {
183 $config: typography.private-typography-to-2014-config(
184 theming.get-typography-config($config-or-theme));
185 .mat-calendar {
186 font-family: typography-utils.font-family($config);
187 }
188
189 .mat-calendar-body {
190 font-size: $calendar-body-font-size;
191 }
192
193 .mat-calendar-body-label,
194 .mat-calendar-period-button {
195 font: {
196 size: typography-utils.font-size($config, button);
197 weight: typography-utils.font-weight($config, button);
198 }
199 }
200
201 .mat-calendar-table-header th {
202 font: {
203 size: $calendar-weekday-table-font-size;
204 weight: typography-utils.font-weight($config, body-1);
205 }
206 }
207}
208
209@mixin date-range-colors(
210 $range-color,
211 $comparison-color: rgba(#f9ab00, $range-fade-amount),
212 $overlap-color: #a8dab5,
213 $overlap-selected-color: color.adjust($overlap-color, $lightness: -30%)) {
214
215 .mat-calendar-body-in-range::before {
216 background: $range-color;
217 }
218
219 .mat-calendar-body-comparison-identical,
220 .mat-calendar-body-in-comparison-range::before {
221 background: $comparison-color;
222 }
223
224 .mat-calendar-body-comparison-bridge-start::before,
225 [dir='rtl'] .mat-calendar-body-comparison-bridge-end::before {
226 background: linear-gradient(to right, $range-color 50%, $comparison-color 50%);
227 }
228
229 .mat-calendar-body-comparison-bridge-end::before,
230 [dir='rtl'] .mat-calendar-body-comparison-bridge-start::before {
231 background: linear-gradient(to left, $range-color 50%, $comparison-color 50%);
232 }
233
234 .mat-calendar-body-in-range > .mat-calendar-body-comparison-identical,
235 .mat-calendar-body-in-comparison-range.mat-calendar-body-in-range::after {
236 background: $overlap-color;
237 }
238
239 .mat-calendar-body-comparison-identical.mat-calendar-body-selected,
240 .mat-calendar-body-in-comparison-range > .mat-calendar-body-selected {
241 background: $overlap-selected-color;
242 }
243}
244
245@mixin _density($config-or-theme) {}
246
247@mixin theme($theme-or-color-config) {
248 $theme: theming.private-legacy-get-theme($theme-or-color-config);
249 @include theming.private-check-duplicate-theme-styles($theme, 'mat-datepicker') {
250 $color: theming.get-color-config($theme);
251 $density: theming.get-density-config($theme);
252 $typography: theming.get-typography-config($theme);
253
254 @if $color != null {
255 @include color($color);
256 }
257 @if $density != null {
258 @include _density($density);
259 }
260 @if $typography != null {
261 @include typography($typography);
262 }
263 }
264}
Note: See TracBrowser for help on using the repository browser.