forked from foundation/foundation-sites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_text.scss
179 lines (143 loc) · 4.19 KB
/
_text.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
// Foundation for Sites by ZURB
// foundation.zurb.com
// Licensed under MIT Open Source
////
/// @group forms
////
/// Font color of text inputs.
/// @type Color
$input-color: $black !default;
/// Font color of placeholder text within text inputs.
/// @type Color
$input-placeholder-color: $medium-gray !default;
/// Font family of text inputs.
/// @type Font
$input-font-family: inherit !default;
/// Font size of text inputs.
/// @type Number
$input-font-size: rem-calc(16) !default;
/// Font weight of text inputs.
/// @type Keyword
$input-font-weight: $global-weight-normal !default;
/// Line height of text inputs.
/// @type Keyword
$input-line-height: $global-lineheight !default;
/// Background color of text inputs.
/// @type Color
$input-background: $white !default;
/// Background color of focused of text inputs.
/// @type Color
$input-background-focus: $white !default;
/// Background color of disabled text inputs.
/// @type Color
$input-background-disabled: $light-gray !default;
/// Border around text inputs.
/// @type Border
$input-border: 1px solid $medium-gray !default;
/// Border around focused text inputs.
/// @type Color
$input-border-focus: 1px solid $dark-gray !default;
/// Padding of text inputs.
/// @type Color
$input-padding: $form-spacing / 2 !default;
/// Box shadow inside text inputs when not focused.
/// @type Shadow
$input-shadow: inset 0 1px 2px rgba($black, 0.1) !default;
/// Box shadow outside text inputs when focused.
/// @type Shadow
$input-shadow-focus: 0 0 5px $medium-gray !default;
/// Cursor to use when hovering over a disabled text input.
/// @type Cursor
$input-cursor-disabled: not-allowed !default;
/// Properties to transition on text inputs.
/// @type Transition
$input-transition: box-shadow 0.5s, border-color 0.25s ease-in-out !default;
/// Enables the up/down buttons that Chrome and Firefox add to `<input type='number'>` elements.
/// @type Boolean
$input-number-spinners: true !default;
/// Radius for text inputs.
/// @type Border
$input-radius: $global-radius !default;
/// Border radius for form buttons, defaulted to global-radius.
/// @type Number
$form-button-radius: $global-radius !default;
@mixin form-element {
$height: ($input-font-size * unitless-calc($input-line-height)) + (get-side($input-padding, 'top') + get-side($input-padding, 'bottom')) - rem-calc(1);
display: block;
box-sizing: border-box;
width: 100%;
height: $height;
margin: 0 0 $form-spacing;
padding: $input-padding;
border: $input-border;
border-radius: $input-radius;
background-color: $input-background;
box-shadow: $input-shadow;
font-family: $input-font-family;
font-size: $input-font-size;
font-weight: $input-font-weight;
line-height: $input-line-height;
color: $input-color;
@if has-value($input-transition) {
transition: $input-transition;
}
// Focus state
&:focus {
outline: none;
border: $input-border-focus;
background-color: $input-background-focus;
box-shadow: $input-shadow-focus;
@if has-value($input-transition) {
transition: $input-transition;
}
}
}
@mixin foundation-form-text {
// Text inputs
#{text-inputs()},
textarea {
@include form-element;
appearance: none;
}
// Text areas
textarea {
max-width: 100%;
&[rows] {
height: auto;
}
}
input,
textarea {
// Placeholder text
&::placeholder {
color: $input-placeholder-color;
}
// Disabled/readonly state
&:disabled,
&[readonly] {
background-color: $input-background-disabled;
cursor: $input-cursor-disabled;
}
}
// Reset styles on button-like inputs
[type='submit'],
[type='button'] {
appearance: none;
border-radius: $form-button-radius;
}
// Reset Normalize setting content-box to search elements
input[type='search'] { // sass-lint:disable-line no-qualifying-elements
box-sizing: border-box;
}
// Number input styles
[type='number'] {
@if not $input-number-spinners {
-moz-appearance: textfield; // sass-lint:disable-line no-vendor-prefix
&::-webkit-inner-spin-button,
&::-webkit-outer-spin-button {
-webkit-appearance: none; // sass-lint:disable-line no-vendor-prefix
margin: 0;
}
}
}
}