aboutsummaryrefslogtreecommitdiffstats
path: root/resources/src/mediawiki.widgets/mw.widgets.DateInputWidget.styles.less
blob: 1247e8b8f1e32e3dfbe4a8ae9c53ba880d610835 (plain) (blame)
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
/*!
 * MediaWiki Widgets – PHP DateInputWidget styles.
 *
 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
 * @license The MIT License (MIT); see LICENSE.txt
 */
@import 'mediawiki.skin.variables.less';

// Variables taken from OOUI's WikimediaUI theme
@ooui-font-size-browser: 16; // assumed browser default of `16px`
@ooui-font-size-base: 0.875em; // equals `14px` at browser default of `16px`
@ooui-unit: em;

@padding-input-text: @padding-vertical-base @padding-horizontal-input-text;
@padding-horizontal-input-text: 8px;
@padding-vertical-base: 6px;

// `line-height` has to be relative/in `em` to enable user override in browser settings.
@line-height-widget-base: unit( ( 18 / @ooui-font-size-browser / @ooui-font-size-base ), @ooui-unit ); // equals `18px` at base `font-size: 14px;

.oo-ui-inline-spacing( @spacing, @cancelled-spacing: 0 ) {
	margin-right: @spacing;

	&:last-child {
		margin-right: @cancelled-spacing;
	}
}

// DateInputWidget rules
.mw-widget-dateInputWidget {
	&.oo-ui-textInputWidget {
		display: inline-block;
		max-width: 21em;
		// .oo-ui-inline-spacing( @spacing-50 ); already inherited from `.oo-ui-inputWidget`

		.oo-ui-labelElement-label {
			line-height: @line-height-widget-base;
		}
	}

	// Note that this block applies to both the PHP widget and the JS widget
	&-handle,
	&.oo-ui-textInputWidget input {
		display: inline-block;
		position: relative;
		cursor: pointer;
		/**
		 * Ensures non-infused and infused widget have the same height.
		 * Equal to line height + top padding + bottom padding
		 */
		max-height: 2.458em;
	}

	// Ensure `.mw-widget-dateInputWidget-handle` similar appearance to OOUI's `.oo-ui-textInputWidget`
	&-handle {
		background-color: @background-color-base;
		color: @color-emphasized;
		box-sizing: border-box;
		width: @size-full;
		border: @border-base;
		border-radius: @border-radius-base;
		padding: @padding-input-text;
		line-height: @line-height-widget-base;
	}

	&.oo-ui-widget-enabled {
		.mw-widget-dateInputWidget-handle {
			// `transparent` necessary for smooth transition
			box-shadow: @box-shadow-inset-small @box-shadow-color-transparent;
			transition-property: border-color, box-shadow;
			transition-duration: @transition-duration-medium;

			&:hover {
				border-color: @border-color-input--hover;
			}

			&:focus {
				outline: @outline-base--focus;
				border-color: @border-color-progressive--focus;
				box-shadow: @box-shadow-inset-small @box-shadow-color-progressive--focus;
			}

			& > .oo-ui-labelElement-label {
				cursor: pointer;
			}
		}
	}

	&-active {
		&.oo-ui-textInputWidget input {
			cursor: text;
		}
	}
}

// Pending state (T382186)
.client-nojs .mw-widget-dateInputWidget .mw-widgets-pendingTextInputWidget,
.client-js .mw-widget-dateInputWidget input[ type='date' ] {
	display: none;
}