UNPKG

5.35 kBSCSSView Raw
1@use './variables.scss' as *;
2@use './mixins.scss';
3@use './list.scss' as list;
4
5$bg: $widget-bg !default;
6
7$btn-bg: #fff !default;
8$btn-color: $widget-color !default;
9$btn-border-color: null !default;
10$btn-muted-color: $gray-400;
11$btn-border-radius: $widget-border-radius !default;
12
13$btn-hover-bg: $widget-hover-bg !default;
14$btn-hover-border-color: $widget-hover-border-color !default;
15$btn-hover-color: $widget-hover-color !default;
16
17$btn-active-color: null !default;
18$btn-active-border-color: null !default;
19$btn-active-bg: $gray-300 !default;
20
21$btn-focus-color: null !default;
22$btn-focus-border-color: null !default;
23$btn-focus-bg: null !default;
24
25$cell-align: center !default;
26$cell-padding: 0.25em !default;
27$cell-color: $btn-color !default;
28$cell-border-color: null !default;
29$cell-border-radius: $btn-border-radius !default;
30
31$cell-hover-bg: $btn-hover-bg !default;
32$cell-hover-border-color: $btn-hover-border-color !default;
33$cell-hover-color: $btn-hover-color !default;
34
35$cell-active-bg: $btn-active-bg !default;
36$cell-active-border-color: $btn-active-border-color !default;
37$cell-active-color: $btn-active-color !default;
38
39$cell-select-color: list.$selected-color !default;
40$cell-select-border-color: list.$selected-border-color !default;
41$cell-select-bg: list.$selected-bg !default;
42
43@mixin _translate($x, $y) {
44 transform: translate(#{$x}, #{$y});
45
46 @supports (transform-style: preserve-3d) {
47 transform: translate3d(#{$x}, #{$y}, 0);
48 }
49}
50
51@mixin Calendar() {
52 .rw-calendar-popup {
53 right: auto;
54 min-width: 0;
55 width: 22em;
56 }
57
58 .rw-calendar {
59 overflow: hidden;
60 }
61
62 .rw-calendar-contained {
63 border-radius: $widget-border-radius;
64 background-color: $bg;
65 border: $widget-border-color 1px solid;
66 }
67
68 .rw-calendar-now {
69 font-weight: bold;
70 }
71 .rw-calendar-header {
72 display: flex;
73 padding: 0.8em;
74 }
75
76 .rw-cell,
77 .rw-calendar-btn {
78 background-clip: $widget-background-clip;
79
80 @include mixins.focus();
81
82 // TODO: normal button disabled
83 &:disabled,
84 &.rw-state-disabled {
85 pointer-events: none;
86 opacity: 0.35;
87 }
88 }
89
90 .rw-calendar-btn {
91 line-height: 2em;
92 border-radius: $btn-border-radius;
93 border-color: $btn-border-color;
94
95 &:hover {
96 background-color: $btn-hover-bg;
97 }
98 &:active {
99 background-color: $btn-active-bg;
100 }
101 }
102
103 .rw-calendar-btn-left,
104 .rw-calendar-btn-today,
105 .rw-calendar-btn-right,
106 .rw-calendar-btn-view {
107 padding: 0.3em 0.6em;
108 }
109
110 .rw-calendar-btn-left,
111 .rw-calendar-btn-right {
112 [dir='rtl'] & {
113 transform: scale(-1, 1);
114 }
115 }
116 .rw-calendar-btn-view {
117 font-weight: bold;
118
119 & > :last-child {
120 margin: 0 0.5em;
121 }
122
123 & + * {
124 margin-left: auto;
125
126 [dir='rtl'] & {
127 margin-left: 0;
128 margin-right: auto;
129 }
130 }
131 }
132
133 .rw-calendar-grid {
134 display: table;
135 outline: none;
136 height: 14em;
137 padding: $widget-focus-width;
138 table-layout: fixed;
139 border-collapse: separate;
140 border-spacing: 0;
141 width: 100%;
142 background-color: $bg;
143 }
144 .rw-calendar-head {
145 display: table-header-group;
146 }
147 .rw-calendar-body {
148 display: table-row-group;
149 }
150
151 .rw-calendar-row {
152 display: table-row;
153 }
154
155 .rw-head-cell {
156 display: table-cell;
157 text-align: $cell-align;
158 border-bottom: 1px solid $input-border-color;
159 padding: $cell-padding;
160 }
161
162 .rw-cell {
163 display: table-cell;
164 color: $cell-color;
165 vertical-align: middle;
166 border-color: $cell-border-color;
167 border-radius: $cell-border-radius;
168 cursor: pointer;
169 line-height: normal;
170 text-align: center;
171 border: 1px solid transparent;
172 padding: $cell-padding;
173 outline: none;
174
175 &:hover {
176 background-color: $cell-hover-bg;
177 }
178 &:active {
179 background-color: $cell-active-bg;
180 }
181
182 &.rw-state-selected {
183 background-color: $cell-select-bg;
184 border-color: $cell-select-border-color;
185 color: $cell-select-color;
186 }
187
188 .rw-calendar-month & {
189 text-align: $cell-align;
190 }
191 }
192
193 .rw-cell-off-range {
194 color: $btn-muted-color;
195 }
196
197 .rw-calendar-transition-group {
198 position: relative;
199 overflow: hidden;
200 }
201
202 .rw-calendar-transition {
203 width: 100%;
204 overflow: hidden;
205 transition: transform 0.2s ease-in-out 0ms;
206 @include _translate(0, 0);
207 }
208
209 .rw-calendar-transition-next {
210 -webkit-backface-visibility: hidden;
211 backface-visibility: hidden;
212
213 .rw-calendar-transition-top & {
214 @include _translate(0, -100%);
215 }
216 .rw-calendar-transition-bottom & {
217 @include _translate(0, 100%);
218 }
219 .rw-calendar-transition-right & {
220 @include _translate(-100%, 0);
221 }
222 .rw-calendar-transition-left & {
223 @include _translate(100%, 0);
224 }
225
226 &.rw-calendar-transition-active {
227 @include _translate(0, 0);
228 }
229 }
230
231 .rw-calendar-transition-prev {
232 -webkit-backface-visibility: hidden;
233 backface-visibility: hidden;
234 position: absolute;
235 left: 0;
236 top: 0;
237
238 .rw-calendar-transition-top & {
239 @include _translate(0, 100%);
240 }
241 .rw-calendar-transition-bottom & {
242 @include _translate(0, -100%);
243 }
244 .rw-calendar-transition-right & {
245 @include _translate(100%, 0);
246 }
247 .rw-calendar-transition-left & {
248 @include _translate(-100%, 0);
249 }
250 }
251}