|
1 |
| -@import 'elevation'; |
2 |
| - |
3 |
| -$mat-datepicker-calendar-padding: 8px; |
4 |
| -$mat-datepicker-non-touch-calendar-cell-size: 40px; |
5 |
| -$mat-datepicker-non-touch-calendar-width: $mat-datepicker-non-touch-calendar-cell-size * 7 + |
6 |
| - $mat-datepicker-calendar-padding * 2; |
7 |
| - |
8 |
| -/** |
9 |
| - * Based on the natural height of the calendar in a month with 6 rows of dates |
10 |
| - * (largest the calendar will get). |
11 |
| - */ |
12 |
| -$mat-datepicker-non-touch-calendar-height: 354px; |
13 |
| - |
14 |
| -/** |
15 |
| - * Ideally the calendar would have a constant aspect ratio, no matter its size, and we would base |
16 |
| - * these measurements off the aspect ratio. Unfortunately, the aspect ratio does change a little as |
17 |
| - * the calendar grows, since some of the elements have pixel-based sizes. These numbers have been |
18 |
| - * chosen to minimize extra whitespace at larger sizes, while still ensuring we won't need |
19 |
| - * scrollbars at smaller sizes. |
20 |
| - */ |
21 |
| -$mat-datepicker-touch-landscape-width: 132vh; |
22 |
| -$mat-datepicker-touch-landscape-height: 90vh; |
23 |
| -$mat-datepicker-touch-landscape-header: 53vh; |
24 |
| -$mat-datepicker-touch-portrait-width: 80vw; |
25 |
| -$mat-datepicker-touch-portrait-height: 112vw; |
26 |
| -$mat-datepicker-touch-portrait-header: 33vw; |
27 |
| - |
28 |
| -$mat-datepicker-touch-landscape-max-width: 500px; |
29 |
| -$mat-datepicker-touch-landscape-max-height: 325px; |
30 |
| -$mat-datepicker-touch-landscape-max-header: 150px; |
31 |
| -$mat-datepicker-touch-portrait-max-width: 275px; |
32 |
| -$mat-datepicker-touch-portrait-max-height: 580px; |
33 |
| -$mat-datepicker-touch-portrait-max-header: 115px; |
34 |
| - |
35 |
| -.mat-datepicker-content { |
36 |
| - @include mat-elevation(5); |
37 |
| - |
38 |
| - display: block; |
39 |
| -} |
40 |
| - |
41 |
| -.mat-calendar { |
42 |
| - display: flex; |
43 |
| -} |
44 |
| -/** |
45 |
| - * .mat-datepicker-content:not(.mat-datepicker-content-touch) .mat-calendar { |
46 |
| - * width: $mat-datepicker-non-touch-calendar-width; |
47 |
| - * height: $mat-datepicker-non-touch-calendar-height; |
48 |
| - * } |
49 |
| - */ |
50 |
| -.mat-datepicker-content-touch { |
51 |
| - @include mat-elevation(0); |
52 |
| - |
53 |
| - /* make sure the dialog scrolls rather than being cropped on ludicrously small screens */ |
54 |
| - max-height: 90vh; |
55 |
| - overflow: auto; |
56 |
| - |
57 |
| - /* TODO(mmalerba): hack to offset the padding of the dialog. Can be removed when we switch away from using dialog. */ |
58 |
| - margin: -24px; |
59 |
| -} |
| 1 | +@mixin mat-datepicker-content($theme) { |
| 2 | + $mat-datepicker-calendar-padding: 8px; |
| 3 | + $mat-datepicker-non-touch-calendar-cell-size: 40px; |
| 4 | + $mat-datepicker-non-touch-calendar-width: $mat-datepicker-non-touch-calendar-cell-size * |
| 5 | + 7 + $mat-datepicker-calendar-padding * 2; |
| 6 | + |
| 7 | + /** |
| 8 | + * Based on the natural height of the calendar in a month with 6 rows of dates |
| 9 | + * (largest the calendar will get). |
| 10 | + */ |
| 11 | + $mat-datepicker-non-touch-calendar-height: 354px; |
| 12 | + |
| 13 | + /** |
| 14 | + * Ideally the calendar would have a constant aspect ratio, no matter its size, and we would base |
| 15 | + * these measurements off the aspect ratio. Unfortunately, the aspect ratio does change a little as |
| 16 | + * the calendar grows, since some of the elements have pixel-based sizes. These numbers have been |
| 17 | + * chosen to minimize extra whitespace at larger sizes, while still ensuring we won't need |
| 18 | + * scrollbars at smaller sizes. |
| 19 | + */ |
| 20 | + $mat-datepicker-touch-landscape-width: 132vh; |
| 21 | + $mat-datepicker-touch-landscape-height: 90vh; |
| 22 | + $mat-datepicker-touch-landscape-header: 53vh; |
| 23 | + $mat-datepicker-touch-portrait-width: 80vw; |
| 24 | + $mat-datepicker-touch-portrait-height: 112vw; |
| 25 | + $mat-datepicker-touch-portrait-header: 33vw; |
| 26 | + |
| 27 | + $mat-datepicker-touch-landscape-max-width: 500px; |
| 28 | + $mat-datepicker-touch-landscape-max-height: 325px; |
| 29 | + $mat-datepicker-touch-landscape-max-header: 150px; |
| 30 | + $mat-datepicker-touch-portrait-max-width: 275px; |
| 31 | + $mat-datepicker-touch-portrait-max-height: 580px; |
| 32 | + $mat-datepicker-touch-portrait-max-header: 115px; |
| 33 | + |
| 34 | + .mat-datepicker-content { |
| 35 | + @include mat-elevation(5); |
| 36 | + |
| 37 | + display: block; |
| 38 | + } |
60 | 39 |
|
61 |
| -@media all and (orientation: landscape) { |
62 | 40 | .mat-calendar {
|
63 |
| - width: $mat-datepicker-touch-landscape-width; |
64 |
| - height: $mat-datepicker-touch-landscape-height; |
65 |
| - |
66 |
| - max-width: $mat-datepicker-touch-landscape-max-width; |
67 |
| - max-height: $mat-datepicker-touch-landscape-max-height; |
| 41 | + display: flex; |
| 42 | + } |
| 43 | + /** |
| 44 | + * .mat-datepicker-content:not(.mat-datepicker-content-touch) .mat-calendar { |
| 45 | + * width: $mat-datepicker-non-touch-calendar-width; |
| 46 | + * height: $mat-datepicker-non-touch-calendar-height; |
| 47 | + * } |
| 48 | + */ |
| 49 | + .mat-datepicker-content-touch { |
| 50 | + @include mat-elevation(0); |
| 51 | + |
| 52 | + /* make sure the dialog scrolls rather than being cropped on ludicrously small screens */ |
| 53 | + max-height: 90vh; |
| 54 | + overflow: auto; |
| 55 | + |
| 56 | + /* TODO(mmalerba): hack to offset the padding of the dialog. Can be removed when we switch away from using dialog. */ |
| 57 | + margin: -24px; |
| 58 | + } |
68 | 59 |
|
69 |
| - .mat-calendar-header { |
70 |
| - width: $mat-datepicker-touch-landscape-header; |
71 |
| - max-width: $mat-datepicker-touch-landscape-max-header; |
72 |
| - } |
73 |
| - .mat-calendar-content { |
74 |
| - flex: 1 1 100%; |
| 60 | + @media all and (orientation: landscape) { |
| 61 | + .mat-calendar { |
| 62 | + width: $mat-datepicker-touch-landscape-width; |
| 63 | + height: $mat-datepicker-touch-landscape-height; |
| 64 | + |
| 65 | + max-width: $mat-datepicker-touch-landscape-max-width; |
| 66 | + max-height: $mat-datepicker-touch-landscape-max-height; |
| 67 | + |
| 68 | + .mat-calendar-header { |
| 69 | + width: $mat-datepicker-touch-landscape-header; |
| 70 | + max-width: $mat-datepicker-touch-landscape-max-header; |
| 71 | + } |
| 72 | + .mat-calendar-content { |
| 73 | + flex: 1 1 100%; |
| 74 | + } |
75 | 75 | }
|
76 | 76 | }
|
77 |
| -} |
78 | 77 |
|
79 |
| -@media all and (orientation: portrait) { |
80 |
| - .mat-calendar { |
81 |
| - width: $mat-datepicker-touch-portrait-width; |
82 |
| - height: $mat-datepicker-touch-portrait-height; |
| 78 | + @media all and (orientation: portrait) { |
| 79 | + .mat-calendar { |
| 80 | + width: $mat-datepicker-touch-portrait-width; |
| 81 | + height: $mat-datepicker-touch-portrait-height; |
83 | 82 |
|
84 |
| - max-width: $mat-datepicker-touch-portrait-max-width; |
85 |
| - max-height: $mat-datepicker-touch-portrait-max-height; |
| 83 | + max-width: $mat-datepicker-touch-portrait-max-width; |
| 84 | + max-height: $mat-datepicker-touch-portrait-max-height; |
86 | 85 |
|
87 |
| - flex-direction: column; |
88 |
| - align-items: stretch; |
| 86 | + flex-direction: column; |
| 87 | + align-items: stretch; |
89 | 88 |
|
90 |
| - .mat-calendar-header { |
91 |
| - height: $mat-datepicker-touch-portrait-header; |
92 |
| - max-height: $mat-datepicker-touch-portrait-max-header; |
93 |
| - } |
94 |
| - .mat-calendar-content { |
95 |
| - flex: 1 1 100%; |
| 89 | + .mat-calendar-header { |
| 90 | + height: $mat-datepicker-touch-portrait-header; |
| 91 | + max-height: $mat-datepicker-touch-portrait-max-header; |
| 92 | + } |
| 93 | + .mat-calendar-content { |
| 94 | + flex: 1 1 100%; |
| 95 | + } |
96 | 96 | }
|
97 | 97 | }
|
98 | 98 | }
|
0 commit comments