summaryrefslogtreecommitdiff
path: root/resources/mediawiki.ui/sourcefiles/scss/components/default/_forms.scss
blob: a9cec39a4bf59e4a0bc7ec7c8b8683ed9bf0f473 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Form elements and layouts

// --------------------------------------------------------------------------
// Layouts
// --------------------------------------------------------------------------

// The FancyCaptcha image CAPTCHA used on WMF wikis drives the width of the
// 'VForm' design, the form can't be narrower than this.
$captchaContainerWidth: 290px;
$defaultFormWidth: $captchaContainerWidth;

// Style a compact vertical stacked form ("VForm") and the elements in divs
// within it.
.mw-ui-vform {
    @include box-sizing(border-box);

    width: $defaultFormWidth;

    // Immediate divs in a vform are block and spaced-out.
    & > div {
        display: block;
        margin: 0 0 15px 0;
        padding: 0;
        width: 100%;

        // MW currently doesn't use the type attribute everywhere on inputs.
        input,
        .mw-ui-button {
            display: block;
            @include box-sizing(border-box);
            margin: 0;
            width: 100%;
        }

        // We exclude these because they'll generally use mw-ui-button.
        // Otherwise, we'll unintentionally override that.
        input:not([type=button]):not([type=submit]):not([type=file]), {
            @include agora-field-styling; // mixins/_forms.scss
        }

        label {
            display: block;
            @include box-sizing(border-box);
            @include agora-label-styling;
            width: auto;
            margin: 0 0 0.2em 0;
            padding: 0;
        }

        // Override input styling just for checkboxes and radio inputs.
        input[type="checkbox"],
        input[type="radio"] {
            display: inline;
            @include box-sizing(content-box);
            width: auto;
        }

    }

    // HTMLForm uses error, SpecialUserlogin (login and create account) uses
    // errorbox.
    // TODO move errorbox from mediawiki.special.vforms.css into here.
    .error {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
        font-size: 0.9em;
        margin: 0 0 1em 0;
        padding: 0.5em;
        color: #cc0000;
        border: 1px solid #fac5c5;
        background-color: #fae3e3;
        text-shadow: 0 1px #fae3e3;
        word-wrap: break-word;
    }
}

// --------------------------------------------------------------------------
// Elements
// --------------------------------------------------------------------------

// Apply this to individual elements to style them.
// You generally don't need to use this class on divs within an Agora
// form container such as mw-ui-vform
// XXX DRY: This repeats earlier styling, use an @include agora-div-styling ?
.mw-ui-vform-div {
	display: block;
	margin: 0 0 15px 0;
	padding: 0;
	width: 100%;
}

// Apply mw-ui-input to individual input fields to style them.
// You generally don't need to use this class if <input> is within an Agora
// form container such as mw-ui-vform
.mw-ui-input {
    @include agora-field-styling; // mixins/_forms.scss
}

// Apply mw-ui-label to individual elements to style them.
// You generally don't need to use this class if <label> is within an Agora
// form container such as mw-ui-vform
.mw-ui-label {
    @include agora-label-styling; // mixins/_forms.scss
}

// Nesting an input checkbox or radio button inside a label with this class
// improves alignment, e.g.
//   <label class="mw-ui-checkbox-label">
//       <input type="checkbox">The label text
//   </label>
.mw-ui-checkbox-label, .mw-ui-radio-label {
    @include agora-inline-label-styling;
}