| 1 |
/*! |
| 2 |
* MediaWiki Widgets – CalendarWidget styles. |
| 3 |
* |
| 4 |
* @copyright 2011-2023 MediaWiki Widgets Team and others; see AUTHORS.txt |
| 5 |
* @license The MIT License (MIT); see LICENSE.txt |
| 6 |
*/ |
| 7 |
|
| 8 |
/* stylelint-disable no-duplicate-selectors */ |
| 9 |
@import 'mediawiki.skin.variables.less'; |
| 10 |
@import 'mediawiki.mixins.less'; |
| 11 |
|
| 12 |
@calendarWidth: 21em; |
| 13 |
@calendarHeight: 14em; |
| 14 |
|
| 15 |
.mw-widget-calendarWidget { |
| 16 |
width: @calendarWidth; |
| 17 |
} |
| 18 |
|
| 19 |
.mw-widget-calendarWidget-header { |
| 20 |
position: relative; |
| 21 |
line-height: 2.5; |
| 22 |
|
| 23 |
// Overwrite OOUI's `.oo-ui-buttonElement-frameless.oo-ui-iconElement:first-child` |
| 24 |
.oo-ui-buttonWidget.oo-ui-iconElement { |
| 25 |
margin-left: 0; |
| 26 |
margin-right: 0; |
| 27 |
} |
| 28 |
|
| 29 |
.mw-widget-calendarWidget-labelButton { |
| 30 |
margin: 0 auto; |
| 31 |
display: block; |
| 32 |
width: @calendarWidth - 2 * 3em; |
| 33 |
|
| 34 |
.oo-ui-buttonElement-button { |
| 35 |
width: @calendarWidth - 2 * 3em; |
| 36 |
text-align: center; |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
.mw-widget-calendarWidget-upButton { |
| 42 |
position: absolute; |
| 43 |
top: 0; |
| 44 |
right: 3em; |
| 45 |
pointer-events: none; |
| 46 |
} |
| 47 |
|
| 48 |
.mw-widget-calendarWidget-prevButton { |
| 49 |
float: left; |
| 50 |
} |
| 51 |
|
| 52 |
.mw-widget-calendarWidget-nextButton { |
| 53 |
float: right; |
| 54 |
} |
| 55 |
|
| 56 |
.mw-widget-calendarWidget-body-outer-wrapper { |
| 57 |
clear: both; |
| 58 |
position: relative; |
| 59 |
overflow: hidden; |
| 60 |
// Fit 7 days, 3em each |
| 61 |
width: @calendarWidth; |
| 62 |
// Fit 6 weeks + heading line, 2em each |
| 63 |
height: @calendarHeight; |
| 64 |
} |
| 65 |
|
| 66 |
.mw-widget-calendarWidget-body-wrapper { |
| 67 |
.mw-widget-calendarWidget-body { |
| 68 |
display: inline-block; |
| 69 |
display: inline-grid; |
| 70 |
// Fit 7 days, 3em each |
| 71 |
width: @calendarWidth; |
| 72 |
// Fit 6 weeks + heading line, 2em each |
| 73 |
height: @calendarHeight; |
| 74 |
} |
| 75 |
|
| 76 |
.mw-widget-calendarWidget-body:not( .mw-widget-calendarWidget-old-body ):first-child { |
| 77 |
margin-top: -@calendarHeight; |
| 78 |
margin-left: -@calendarWidth; |
| 79 |
} |
| 80 |
|
| 81 |
.mw-widget-calendarWidget-body:not( .mw-widget-calendarWidget-old-body ):last-child { |
| 82 |
margin-top: 0; |
| 83 |
margin-left: 0; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
.mw-widget-calendarWidget-body-wrapper-fade-previous { |
| 88 |
width: @calendarWidth * 2; |
| 89 |
height: @calendarHeight; |
| 90 |
|
| 91 |
.mw-widget-calendarWidget-body:first-child { |
| 92 |
margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 93 |
margin-left: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 94 |
transition: margin-left 500ms; |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
.mw-widget-calendarWidget-body-wrapper-fade-next { |
| 99 |
width: @calendarWidth * 2; |
| 100 |
height: @calendarHeight; |
| 101 |
|
| 102 |
.mw-widget-calendarWidget-body:first-child { |
| 103 |
margin-left: -@calendarWidth !important; /* stylelint-disable-line declaration-no-important */ |
| 104 |
margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 105 |
transition: margin-left 500ms; |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
.mw-widget-calendarWidget-body-wrapper-fade-up { |
| 110 |
width: @calendarWidth; |
| 111 |
height: @calendarHeight * 2; |
| 112 |
|
| 113 |
.mw-widget-calendarWidget-body { |
| 114 |
display: block; |
| 115 |
display: grid; |
| 116 |
} |
| 117 |
|
| 118 |
.mw-widget-calendarWidget-body:first-child { |
| 119 |
margin-left: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 120 |
margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 121 |
transition: margin-top 500ms; |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
.mw-widget-calendarWidget-body-wrapper-fade-down { |
| 126 |
width: @calendarWidth; |
| 127 |
height: @calendarHeight * 2; |
| 128 |
|
| 129 |
.mw-widget-calendarWidget-body { |
| 130 |
display: block; |
| 131 |
display: grid; |
| 132 |
} |
| 133 |
|
| 134 |
.mw-widget-calendarWidget-body:first-child { |
| 135 |
margin-left: 0 !important; /* stylelint-disable-line declaration-no-important */ |
| 136 |
margin-top: -@calendarHeight !important; /* stylelint-disable-line declaration-no-important */ |
| 137 |
transition: margin-top 500ms; |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
// Support: Browsers that render CSS Grid. All others ignore unknown `grid-*` properties. |
| 142 |
// This avoids any calculation issues pushing items to next line. |
| 143 |
.mw-widget-calendarWidget-body-month { |
| 144 |
grid-template-columns: auto auto auto auto auto auto auto; |
| 145 |
} |
| 146 |
|
| 147 |
.mw-widget-calendarWidget-body-year { |
| 148 |
grid-template-columns: auto auto; |
| 149 |
} |
| 150 |
|
| 151 |
.mw-widget-calendarWidget-body-duodecade { |
| 152 |
grid-template-columns: auto auto auto auto auto; |
| 153 |
} |
| 154 |
|
| 155 |
.mw-widget-calendarWidget-day, |
| 156 |
.mw-widget-calendarWidget-day-heading, |
| 157 |
.mw-widget-calendarWidget-month, |
| 158 |
.mw-widget-calendarWidget-year { |
| 159 |
display: inline-block; |
| 160 |
vertical-align: middle; |
| 161 |
white-space: nowrap; |
| 162 |
overflow: hidden; |
| 163 |
text-overflow: ellipsis; |
| 164 |
text-align: center; |
| 165 |
} |
| 166 |
|
| 167 |
.mw-widget-calendarWidget-day, |
| 168 |
.mw-widget-calendarWidget-day-heading { |
| 169 |
// 7x7 grid |
| 170 |
width: (@calendarWidth / 7); |
| 171 |
line-height: (@calendarHeight / 7); |
| 172 |
|
| 173 |
// Don't overlap the hacked-up fake box-shadow border we get when focussed |
| 174 |
&:nth-child( 7n ) { |
| 175 |
width: (@calendarWidth / 7 - 0.2em); |
| 176 |
margin-right: 0.2em; |
| 177 |
} |
| 178 |
|
| 179 |
&:nth-child( 7n+1 ) { |
| 180 |
width: (@calendarWidth / 7 - 0.2em); |
| 181 |
margin-left: 0.2em; |
| 182 |
} |
| 183 |
|
| 184 |
&:nth-child( 42 ) ~ & { |
| 185 |
line-height: (@calendarHeight / 7 - 0.2em); |
| 186 |
margin-bottom: 0.2em; |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
.mw-widget-calendarWidget-month { |
| 191 |
// 2x6 grid |
| 192 |
width: (@calendarWidth / 2); |
| 193 |
line-height: (@calendarHeight / 6); |
| 194 |
|
| 195 |
// Don't overlap the hacked-up fake box-shadow border we get when focussed |
| 196 |
&:nth-child( 2n ) { |
| 197 |
width: (@calendarWidth / 2 - 0.2em); |
| 198 |
margin-right: 0.2em; |
| 199 |
} |
| 200 |
|
| 201 |
&:nth-child( 2n+1 ) { |
| 202 |
width: (@calendarWidth / 2 - 0.2em); |
| 203 |
margin-left: 0.2em; |
| 204 |
} |
| 205 |
|
| 206 |
&:nth-child( 10 ) ~ & { |
| 207 |
line-height: (@calendarHeight / 6 - 0.2em); |
| 208 |
margin-bottom: 0.2em; |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
.mw-widget-calendarWidget-year { |
| 213 |
// 5x4 grid |
| 214 |
width: (@calendarWidth / 5); |
| 215 |
line-height: (@calendarHeight / 4); |
| 216 |
|
| 217 |
// Don't overlap the hacked-up fake box-shadow border we get when focussed |
| 218 |
&:nth-child( 5n ) { |
| 219 |
width: (@calendarWidth / 5 - 0.2em); |
| 220 |
margin-right: 0.2em; |
| 221 |
} |
| 222 |
|
| 223 |
&:nth-child( 5n+1 ) { |
| 224 |
width: (@calendarWidth / 5 - 0.2em); |
| 225 |
margin-left: 0.2em; |
| 226 |
} |
| 227 |
|
| 228 |
&:nth-child( 15 ) ~ & { |
| 229 |
line-height: (@calendarHeight / 4 - 0.2em); |
| 230 |
margin-bottom: 0.2em; |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
.mw-widget-calendarWidget-item { |
| 235 |
cursor: pointer; |
| 236 |
} |
| 237 |
|
| 238 |
/* Theme-specific */ |
| 239 |
.mw-widget-calendarWidget { |
| 240 |
box-sizing: border-box; |
| 241 |
border: @border-base; |
| 242 |
transition: border-color 100ms, box-shadow 100ms; |
| 243 |
|
| 244 |
&:focus { |
| 245 |
border-color: @border-color-progressive--focus; |
| 246 |
box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus; |
| 247 |
outline: @outline-base--focus; |
| 248 |
} |
| 249 |
|
| 250 |
&-day { |
| 251 |
color: @color-base; |
| 252 |
border-radius: @border-radius-base; |
| 253 |
} |
| 254 |
|
| 255 |
&-day-heading { |
| 256 |
color: @color-subtle; |
| 257 |
font-weight: bold; |
| 258 |
} |
| 259 |
|
| 260 |
&-day-additional { |
| 261 |
color: #a2a9b1; |
| 262 |
|
| 263 |
&:hover { |
| 264 |
color: #202122; |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
&-day-today { |
| 269 |
box-shadow: @box-shadow-inset-small @box-shadow-color-progressive-selected; |
| 270 |
} |
| 271 |
|
| 272 |
&-item { |
| 273 |
transition: background-color 250ms, color 250ms; |
| 274 |
|
| 275 |
&:hover { |
| 276 |
background-color: #36c; |
| 277 |
color: #fff; |
| 278 |
} |
| 279 |
|
| 280 |
&-selected { |
| 281 |
background-color: #2a4b8d; |
| 282 |
color: #fff; |
| 283 |
} |
| 284 |
} |
| 285 |
} |