This repository has been archived by the owner on Oct 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path_forms.scss
274 lines (206 loc) · 6.64 KB
/
_forms.scss
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/* ============================================================================
@CORE -> BASE -> FORMS
========================================================================= */
/**
* Settings.
*/
/**
* Toggle on/off certain styles and treatments.
*/
// Turn styling on for inputs and `select`s
$apply-text-input-and-select-styles: true !default;
$apply-text-input-and-select-border: true !default;
$apply-text-input-and-select-rounded-corners: false !default;
$apply-text-input-and-select-disabled-state: true !default;
$apply-text-input-full-bleed: true !default;
$apply-text-input-placeholder-color: true !default;
// Remove the top inner shadow from iOS inputs
$apply-top-inner-shadow-for-ios-inputs: false !default;
// Remove the close button generated by IE 10+ for `input[type="search"]`
$apply-close-button-for-ie10plus-inputs: false !default;
/**
* Text inputs and `select`s styles.
*/
$text-input-and-select-text-color: $color-text-base !default;
$text-input-and-select-background-color: $color-white !default;
$text-input-and-select-rounded-corners-size: $border-radius !default;
$text-input-and-select-padding: $spacing-quarter !default;
$text-input-and-select-border-thickness: 1 !default;
$text-input-and-select-border-style: solid !default;
$text-input-and-select-border-color: lighten($color-black, 30%) !default;
$text-input-and-select-disabled-state-opacity-strength: 0.6 !default;
/**
* The name of the class to target iOS so the top inner shadow from iOS inputs
* can be removed.
*/
$remove-top-inner-shadow-from-ios-inputs-class: ios !default;
/**
* Box sizing.
*
* Here we set a variable assuming that `box-sizing: border-box;` is not set
* globally. If it has been previously been defined, the following variable
* will be overridden and will be set to `true`.
*/
$apply-friendly-box-model: false !default;
/**
* Indicate that `label` will shift focus to the associated `input` element.
*/
label,
.faux-label {
cursor: pointer;
}
/**
* Disable `textarea`s from being resized horizontally.
*/
textarea {
resize: vertical;
}
/**
* Override `content-box` from normalize.css for search inputs.
*/
@if $apply-friendly-box-model {
input[type="search"] {
box-sizing: border-box;
}
}
/**
* Remove rounded corners from iOS search inputs by overriding
* `appearance: textfield` from normalize.css.
* See: https://github.com/necolas/normalize.css/issues/360.
*/
input[type="search"] {
appearance: none;
}
/**
* Remove rounded corners that iOS applies to all `input` buttons, see:
* https://github.com/necolas/normalize.css/issues/178. And certain browsers
* e.g. Chrome, apply rounded corners to `select` lists so if we haven't opted
* in for rounded corners via the `$apply-text-input-and-select-styles` and
* `$apply-text-input-and-select-rounded-corners` settings then turn them off.
*/
input[type="submit"],
input[type="button"],
input[type="image"],
input[type="reset"],
select {
border-radius: 0;
}
/**
* Fix for IE and old versions of some other browsers not wrapping text within
* a `legend`.
*
* 1. Enable line-wrapping in IE8+.
* 2. Enable line-wrapping in old versions of some other browsers.
*
* @credit
* http://www.456bereastreet.com/archive/201210/how_to_line_wrap_text_in_legend_elements_even_in_ie/
*/
legend {
display: table; // [1]
white-space: normal; // [2]
}
/**
* Set whitespace for `legend`s via a class, we use `padding` over `margin` as
* `padding` is the most cross-browser compatible for `legend`s.
*/
.form-heading {
@include to-rem(padding-bottom, $spacing-base);
}
/**
* Disabled state.
*
* N.B. it is okay to use `!important` here as we're doing it preemptively
* i.e. you know you will always want the rule it's applied too to take
* precedence.
*/
@if $apply-text-input-and-select-disabled-state {
button[disabled],
input[disabled],
select[disabled],
textarea[disabled],
.is-disabled {
cursor: not-allowed !important;
text-shadow: none !important;
box-shadow: none !important;
opacity: $text-input-and-select-disabled-state-opacity-strength !important;
}
// Modifier: no hover; prevent common hover/focus states being applied
.is-disabled--no-hover {
cursor: inherit !important;
color: inherit !important;
background: inherit !important;
text-decoration: none !important;
}
}
/**
* Required field indicator (asterisk).
*/
.required-field {
color: $color-state-error;
cursor: help;
}
/**
* Text inputs via the `.text-input` class, `textarea`s, and `select` lists.
*/
@if $apply-text-input-and-select-styles {
.text-input,
textarea,
select {
@include to-rem(padding, $text-input-and-select-padding);
color: $text-input-and-select-text-color;
background: $text-input-and-select-background-color;
// Apply a border but make it optional
@if $apply-text-input-and-select-border {
border: strip-unit($text-input-and-select-border-thickness) * 1px
$text-input-and-select-border-style
$text-input-and-select-border-color;
}
@else {
border: 0;
}
// Apply rounded corners but make it optional
@if $apply-text-input-and-select-rounded-corners {
border-radius: strip-unit($text-input-and-select-rounded-corners-size) * 1px;
}
// Make 100% wide but make it optional
@if $apply-text-input-full-bleed {
width: 100%;
// Need to apply `box-sizing: border-box` if it hasn't been set globally
@if $apply-friendly-box-model == false {
box-sizing: border-box;
}
}
}
}
/**
* Text input placeholder colour which uses the
* `text-input-placeholder-color()` mixin.
*/
@if $apply-text-input-placeholder-color {
@include text-input-placeholder-color();
}
/**
* Remove the top inner shadow from iOS inputs.
*
* N.B. this needs to be isolated to iOS devices so user-agent sniffing needs
* to happen and the most robust implementation of this is to apply the hook
* to the `html` element e.g. `.ios`.
*/
@if $apply-top-inner-shadow-for-ios-inputs {
.#{$remove-top-inner-shadow-from-ios-inputs-class} {
.remove-top-inner-shadow-from-ios-inputs,
.text-input,
textarea {
-webkit-appearance: caret;
}
}
}
/**
* Hide the close button generated by IE 10+ for inputs.
*/
@if $apply-close-button-for-ie10plus-inputs {
.hide-close-button-for-ie-inputs::-ms-clear,
.text-input::-ms-clear {
display: none;
}
}