UNPKG

8.97 kBtext/lessView Raw
1@import (reference) './imports/global';
2@import (reference) './imports/mixins';
3@import (reference) './imports/aui-theme/components/forms';
4
5/* Field styles */
6form.aui:not(.aui-legacy-forms) {
7 ::-webkit-contacts-auto-fill-button {
8 background: @aui-form-field-default-text-color;
9 }
10 .text,
11 .password,
12 .textarea,
13 .select {
14 #aui-forms.aui-input-field-style(normal);
15 font-size: @aui-font-size-medium;
16 font-family: inherit;
17
18 &:hover {
19 #aui-forms.aui-input-field-style(hover);
20 }
21
22 &:-webkit-autofill {
23 -webkit-text-fill-color: var(--aui-form-field-autofilled-text-color);
24 // for some reason, setting background-color doesn't work. webkit does some weird shit.
25 -webkit-box-shadow: 0 0 0 1000px var(--aui-form-field-autofilled-bg-color) inset;
26 color: var(--aui-form-field-autofilled-text-color);
27 border-color: var(--aui-form-field-autofilled-border-color);
28
29 &::-webkit-contacts-auto-fill-button {
30 background: var(--aui-form-field-autofilled-text-color);
31 }
32
33 }
34 }
35
36 .multi-select {
37 #aui-forms.aui-select2-input-field-style(normal);
38 font-size: @aui-font-size-medium;
39 font-family: inherit;
40
41 &:hover {
42 #aui-forms.aui-select2-input-field-style(hover);
43 }
44 }
45
46 .select,
47 .multi-select {
48 &:hover {
49 background-color: @aui-form-select-hover-bg-color;
50 border-color: @aui-form-select-hover-bg-color;
51 }
52 }
53
54 .aui-select2-container {
55 & > ul:hover {
56 #aui-forms.aui-select2-input-field-style(hover);
57 }
58
59 &.select2-container-active > ul {
60 #aui-forms.aui-input-field-style(focus);
61 }
62 }
63
64 .multi-select {
65 &:hover > option {
66 #aui-forms.aui-select2-input-field-style(hover);
67 }
68 }
69
70 .text,
71 .password,
72 .textarea,
73 .select {
74 #aui.transition(background-color @aui-form-transition-time ease-in-out);
75 #aui.transition(border-color @aui-form-transition-time ease-in-out);
76 border: @aui-form-field-border-width solid @aui-form-field-border-color;
77 border-radius: @aui-form-field-border-radius;
78 box-sizing: border-box;
79 font-size: inherit;
80 margin: 0;
81 vertical-align: baseline;
82 }
83
84 .multi-select,
85 .aui-select2-container .select2-choices {
86 #aui.transition(background-color @aui-form-transition-time ease-in-out);
87 #aui.transition(border-color @aui-form-transition-time ease-in-out);
88 border: @aui-form-field-border-width solid var(--aui-select2-field-border-color);
89 border-radius: @aui-form-field-border-radius;
90 box-sizing: border-box;
91 font-size: inherit;
92 margin: 0;
93 vertical-align: baseline;
94 }
95
96 .multi-select {
97 background-color: @aui-form-select-bg-color;
98 border-color: @aui-form-select-border-color;
99 }
100
101 .text,
102 .password,
103 .select,
104 .aui-select2-container .select2-choices {
105 height: @aui-form-field-height;
106 line-height: 1.4285714285714;
107 padding: 3px 4px;
108 }
109
110 .textarea,
111 .select[size],
112 .multi-select {
113 height: auto;
114 line-height: 1.4285714285714;
115 margin: 0;
116 padding: 3px 4px;
117 }
118
119 .textarea {
120 overflow-y: auto;
121 }
122
123 .multi-select {
124 margin-top: 2px;
125 }
126 .group .field-group,
127 .date-select .field-group {
128 clear: none;
129 padding-left: 0;
130 padding-top: 0;
131 }
132
133 /* Focus styles */
134 .text,
135 .password,
136 .textarea,
137 .select,
138 .multi-select {
139 &:focus {
140 #aui-forms.aui-input-field-style(focus);
141 }
142 &:focus > option {
143 #aui-forms.aui-input-field-style(focus);
144 }
145 }
146 .text,
147 .password,
148 .textarea,
149 .select,
150 .multi-select,
151 .aui-select2-container .select2-choices {
152 // Forms get a custom "border-as-focus" style, because:
153 // a) the form field doesn't "grow" in size,
154 // b) the "focus ring" is impossible to clip when it's a border, and
155 // c) it's more in line with how Atlaskit does it.
156 &:focus {
157 #aui.with-focus-border(@aui-focus-ring-color, @aui-form-field-border-width);
158 }
159 }
160
161 .aui-select2-container.select2-container-active .select2-choices {
162 #aui.with-focus-border();
163 }
164
165 .button,
166 .cancel {
167 #aui.focus(#aui.with-focus-ring());
168 }
169
170 /* Placeholder form element styles */
171
172 .text, .password, .textarea {
173 #aui.placeholder(@aui-form-placeholder-text-color);
174
175 &[disabled] {
176 #aui.placeholder(@aui-form-placeholder-disabled-text-color);
177 }
178 }
179
180 /* Disabled form element styles */
181
182 .text[disabled],
183 .password[disabled],
184 .textarea[disabled],
185 .select[disabled],
186 .multi-select[disabled],
187 .select[disabled] option,
188 .select[disabled] optgroup,
189 .multi-select[disabled] option,
190 .multi-select[disabled] optgroup {
191 background-color: @aui-form-disabled-field-bg-color;
192 color: @aui-form-disabled-field-text-color;
193 border: none;
194 }
195 .text[disabled],
196 .password[disabled],
197 .textarea[disabled],
198 .select[disabled],
199 .multi-select[disabled] {
200 border: 2px solid transparent;
201 }
202
203 .select {
204 margin-top: 1px;
205 vertical-align: top;
206 background-color: @aui-form-select-bg-color;
207 border-color: @aui-form-select-border-color;
208 -webkit-appearance: none;
209 -moz-appearance: none;
210 appearance: none;
211
212 &::-ms-expand {
213 display: none;
214 }
215 }
216 /* Ensure AUI Select2's do not show as regular text fields */
217 .aui-select2-container {
218 border: 0;
219 height: auto;
220 padding: 0;
221 vertical-align: baseline;
222 width: 100%;
223 }
224
225 .aui-select2-container .select2-choices {
226 height: auto;
227 max-width: none;
228 }
229
230 .field-group,
231 .group,
232 .date-select {
233 box-sizing: border-box;
234 clear: both;
235 padding: 4px 0 4px 145px;
236 position: relative;
237 margin: 1px 0;
238 width: 100%;
239 }
240
241 .group {
242 padding-top: 0;
243 }
244
245 // both are @ak-color-N600
246 @chevron-dark: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23A5ADBA" d="M8.292 10.293a1.009 1.009 0 000 1.419l2.939 2.965c.218.215.5.322.779.322s.556-.107.769-.322l2.93-2.955a1.01 1.01 0 000-1.419.987.987 0 00-1.406 0l-2.298 2.317-2.307-2.327a.99.99 0 00-1.406 0z"/%3E%3C/svg%3E%0A');
247 @chevron-light: url('data:image/svg+xml,%3Csvg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath fill="%23344563" d="M8.292 10.293a1.009 1.009 0 000 1.419l2.939 2.965c.218.215.5.322.779.322s.556-.107.769-.322l2.93-2.955a1.01 1.01 0 000-1.419.987.987 0 00-1.406 0l-2.298 2.317-2.307-2.327a.99.99 0 00-1.406 0z"/%3E%3C/svg%3E%0A');
248
249 select[disabled]:not([size]),
250 .select:not([size]) {
251 background-repeat: no-repeat;
252 background-position: calc(100% + 1.5px) 50%;
253 background-size: 25px;
254 }
255
256 select.select[disabled]:not([size]) {
257 // used to be a light ak-color-N70, but there were only 2-3 shades of difference
258 // between that and dark ak-color-N600, so I'm re-using it here.
259 background-image: @chevron-dark;
260 }
261
262 select.select:not([size]) {
263 padding-right: 20px;
264 background-image: @chevron-light;
265 }
266
267 #aui-themes.when-dark({
268 select.select:not([size]) {
269 background-image: @chevron-dark;
270 }
271 });
272
273 .icon-required {
274 left: 100%;
275 position: absolute;
276 top: 7px;
277
278 &::before {
279 content: "*";
280 position: absolute;
281 left: 0;
282 top: 0;
283 text-indent: initial;
284 color: @aui-form-error-text-color;
285 line-height: 1;
286 font-size: @aui-font-size-small;
287 }
288 }
289
290 legend,
291 label {
292 color: @aui-form-label-text-color;
293 font-weight: @aui-font-weight-medium;
294 font-size: @aui-font-size-medium;
295 }
296
297 legend + .field-group {
298 margin-top: 0;
299 padding-top: 5px;
300 }
301
302 div.description {
303 font-size: @aui-font-size-xsmall;
304 line-height: unit(20 / @aui-font-size-xsmall);
305 color: @aui-form-description-text-color;
306 margin: 5px 0 0 0;
307
308 &:first-child {
309 margin-top: 0;
310 }
311 }
312
313 legend,
314 .field-group > label,
315 .field-group > aui-label {
316 float: left;
317 margin-left: -145px;
318 padding: 5px 0 0 0;
319 position: relative;
320 text-align: right;
321 width: 130px;
322 word-wrap: break-word;
323 }
324}
325
326@import 'forms-radios-and-checkboxes';