Merge "Let deduplicateRootJob() accept JobSpecification for consistency"
[lhc/web/wiklou.git] / resources / src / mediawiki.ui / components / checkbox.less
1 @import "mediawiki.mixins";
2 @import "mediawiki.ui/variables";
3
4 // Checkbox
5 //
6 // Styling checkboxes in a way that works cross browser is a tricky problem to solve.
7 // In MediaWiki UI put a checkbox and label inside a mw-ui-checkbox div.
8 // This renders in all browsers except IE6-8 which do not support the :checked selector;
9 // these are kept backwards-compatible using the :not(#noop) selector.
10 // You should give the checkbox and label matching "id" and "for" attributes, respectively.
11 //
12 // Markup:
13 // <div class="mw-ui-checkbox">
14 // <input type="checkbox" id="kss-example-3">
15 // <label for="kss-example-3">Standard checkbox</label>
16 // </div>
17 // <div class="mw-ui-checkbox">
18 // <input type="checkbox" id="kss-example-3-checked" checked>
19 // <label for="kss-example-3-checked">Standard checked checkbox</label>
20 // </div>
21 // <div class="mw-ui-checkbox">
22 // <input type="checkbox" id="kss-example-3-disabled" disabled>
23 // <label for="kss-example-3-disabled">Disabled checkbox</label>
24 // </div>
25 // <div class="mw-ui-checkbox">
26 // <input type="checkbox" id="kss-example-3-disabled-checked" disabled checked>
27 // <label for="kss-example-3-disabled-checked">Disabled checked checkbox</label>
28 // </div>
29 //
30 // Styleguide 3.
31 .mw-ui-checkbox {
32 display: inline-block;
33 vertical-align: middle;
34 }
35
36 @checkboxSize: 2em;
37
38 // We use the not selector to cancel out styling on IE 8 and below
39 // We also disable this styling on javascript disabled devices. This fixes the issue with
40 // Opera Mini where checking/unchecking doesn't apply styling but potentially leaves other
41 // more capable browsers with unstyled checkboxes.
42 .client-js .mw-ui-checkbox:not(#noop) {
43 // Position relatively so we can make use of absolute pseudo elements
44 position: relative;
45 display: table;
46
47 * {
48 // reset font sizes (see bug 72727)
49 font: inherit;
50 vertical-align: middle;
51 }
52
53 input[type="checkbox"] {
54 // we hide the input element as instead we will style the label that follows
55 // we use opacity so that VoiceOver software can still identify it
56 opacity: 0;
57 // Render "on top of" the label, so that it's still clickable (T98905)
58 z-index: 1;
59 position: relative;
60 // ensure the invisible checkbox takes up the required width
61 width: @checkboxSize;
62 height: @checkboxSize;
63 // This is needed for Firefox mobile (See bug 71750 to workaround default Firefox stylesheet)
64 max-width: none;
65 margin: 0;
66 margin-right: 0.4em;
67 display: table-cell;
68
69 & + label {
70 display: table-cell;
71 }
72
73 // the pseudo before element of the label after the checkbox now looks like a checkbox
74 & + label::before {
75 .transition( 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) );
76 content: '';
77 cursor: pointer;
78 .box-sizing(border-box);
79 position: absolute;
80 left: 0;
81 border-radius: @borderRadius;
82 width: @checkboxSize;
83 height: @checkboxSize;
84 line-height: @checkboxSize;
85 background-color: #fff;
86 border: 1px solid @colorGray7;
87 // align the checkbox to middle of the text
88 top: 50%;
89 margin-top: -1em;
90 .background-image-svg('images/checked.svg', 'images/checked.png');
91 .background-size( @checkboxSize - 0.2em, @checkboxSize - 0.2em );
92 background-repeat: no-repeat;
93 background-position: center center;
94 background-origin: border-box;
95 background-size: 0 0;
96 }
97
98 // when the input is checked, style the label pseudo before element that followed as a checked checkbox
99 &:checked + label::before {
100 background-size: 100% 100%;
101 }
102
103 &:active + label::before {
104 background-color: @colorGray13;
105 border-color: @colorGray13;
106 }
107
108 &:focus + label::before {
109 border-width: 2px;
110 }
111
112 &:focus:hover + label::before,
113 &:hover + label::before {
114 border-bottom-width: 3px;
115 }
116
117 // disabled checkboxes have a gray background
118 &:disabled + label::before {
119 cursor: default;
120 background-color: @colorGray14;
121 border-color: @colorGray14;
122 }
123
124 // disabled and checked checkboxes have a white circle
125 &:disabled:checked + label::before {
126 .background-image-svg('images/checked_disabled.svg', 'images/checked_disabled.png');
127 }
128 }
129 }