1
|
// Name: Search
|
2
|
// Description: Component to create the search
|
3
|
//
|
4
|
// Component: `uk-search`
|
5
|
//
|
6
|
// Sub-objects: `uk-search-input`
|
7
|
// `uk-search-toggle`
|
8
|
//
|
9
|
// Adopted: `uk-search-icon`
|
10
|
//
|
11
|
// Modifier: `uk-search-default`
|
12
|
// `uk-search-navbar`
|
13
|
// `uk-search-large`
|
14
|
//
|
15
|
// ========================================================================
|
16
|
|
17
|
|
18
|
// Variables
|
19
|
// ========================================================================
|
20
|
|
21
|
@search-color: @global-color;
|
22
|
@search-placeholder-color: @global-muted-color;
|
23
|
|
24
|
@search-icon-color: @global-muted-color;
|
25
|
|
26
|
@search-default-width: 180px;
|
27
|
@search-default-height: @global-control-height;
|
28
|
@search-default-padding-horizontal: 6px;
|
29
|
@search-default-background: @global-muted-background;
|
30
|
@search-default-focus-background: @search-default-background;
|
31
|
|
32
|
@search-default-icon-width: @global-control-height;
|
33
|
|
34
|
@search-navbar-width: 400px;
|
35
|
@search-navbar-height: 40px;
|
36
|
@search-navbar-background: transparent;
|
37
|
@search-navbar-font-size: @global-large-font-size;
|
38
|
|
39
|
@search-navbar-icon-width: 40px;
|
40
|
|
41
|
@search-large-width: 500px;
|
42
|
@search-large-height: 80px;
|
43
|
@search-large-background: transparent;
|
44
|
@search-large-font-size: @global-xxlarge-font-size;
|
45
|
|
46
|
@search-large-icon-width: 80px;
|
47
|
|
48
|
@search-toggle-color: @global-muted-color;
|
49
|
@search-toggle-hover-color: @global-color;
|
50
|
|
51
|
|
52
|
/* ========================================================================
|
53
|
Component: Search
|
54
|
========================================================================== */
|
55
|
|
56
|
/*
|
57
|
* 1. Container fits its content
|
58
|
* 2. Create position context
|
59
|
* 3. Prevent content overflow
|
60
|
* 4. Reset `form`
|
61
|
*/
|
62
|
|
63
|
.uk-search {
|
64
|
/* 1 */
|
65
|
display: inline-block;
|
66
|
/* 2 */
|
67
|
position: relative;
|
68
|
/* 3 */
|
69
|
max-width: 100%;
|
70
|
/* 4 */
|
71
|
margin: 0;
|
72
|
}
|
73
|
|
74
|
|
75
|
/* Input
|
76
|
========================================================================== */
|
77
|
|
78
|
/*
|
79
|
* Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X.
|
80
|
*/
|
81
|
|
82
|
.uk-search-input::-webkit-search-cancel-button,
|
83
|
.uk-search-input::-webkit-search-decoration { -webkit-appearance: none; }
|
84
|
|
85
|
/*
|
86
|
* Removes placeholder transparency in Firefox.
|
87
|
*/
|
88
|
|
89
|
.uk-search-input::-moz-placeholder { opacity: 1; }
|
90
|
|
91
|
/*
|
92
|
* 1. Define consistent box sizing.
|
93
|
* 2. Address margins set differently in Firefox/IE and Chrome/Safari/Opera.
|
94
|
* 3. Remove `border-radius` in iOS.
|
95
|
* 4. Change font properties to `inherit` in all browsers
|
96
|
* 5. Show the overflow in Edge.
|
97
|
* 6. Remove default style in iOS.
|
98
|
* 7. Vertical alignment
|
99
|
* 8. Take the full container width
|
100
|
* 9. Style
|
101
|
*/
|
102
|
|
103
|
.uk-search-input {
|
104
|
/* 1 */
|
105
|
box-sizing: border-box;
|
106
|
/* 2 */
|
107
|
margin: 0;
|
108
|
/* 3 */
|
109
|
border-radius: 0;
|
110
|
/* 4 */
|
111
|
font: inherit;
|
112
|
/* 5 */
|
113
|
overflow: visible;
|
114
|
/* 6 */
|
115
|
-webkit-appearance: none;
|
116
|
/* 7 */
|
117
|
vertical-align: middle;
|
118
|
/* 8 */
|
119
|
width: 100%;
|
120
|
/* 9 */
|
121
|
border: none;
|
122
|
color: @search-color;
|
123
|
}
|
124
|
|
125
|
.uk-search-input:focus { outline: 0; }
|
126
|
|
127
|
/* Placeholder */
|
128
|
.uk-search-input:-ms-input-placeholder { color: @search-placeholder-color !important; }
|
129
|
.uk-search-input::-moz-placeholder { color: @search-placeholder-color; }
|
130
|
.uk-search-input::-webkit-input-placeholder { color: @search-placeholder-color; }
|
131
|
|
132
|
|
133
|
/* Icon
|
134
|
========================================================================== */
|
135
|
|
136
|
/*
|
137
|
* Adopts `uk-icon`
|
138
|
* Required for `button`
|
139
|
* 1. Remove margins in Chrome, Safari and Opera.
|
140
|
* 2. Remove borders for `button`.
|
141
|
* 3. Address `overflow` set to `hidden` in IE.
|
142
|
* 4. Correct `font` properties and `color` not being inherited for `button`.
|
143
|
* 5. Remove the inheritance of text transform in Edge, Firefox, and IE.
|
144
|
* 6. Remove default `button` padding and background color
|
145
|
* 7. Required for `button`.
|
146
|
*/
|
147
|
|
148
|
.uk-search-icon {
|
149
|
/* 1 */
|
150
|
margin: 0;
|
151
|
/* 2 */
|
152
|
border: none;
|
153
|
/* 3 */
|
154
|
overflow: visible;
|
155
|
/* 4 */
|
156
|
font: inherit;
|
157
|
color: inherit;
|
158
|
/* 5 */
|
159
|
text-transform: none;
|
160
|
/* 6. */
|
161
|
padding: 0;
|
162
|
background-color: transparent;
|
163
|
/* 7 */
|
164
|
cursor: pointer;
|
165
|
}
|
166
|
|
167
|
/*
|
168
|
* Remove the inner border and padding in Firefox. Required for `button`.
|
169
|
*/
|
170
|
|
171
|
.uk-search-icon::-moz-focus-inner {
|
172
|
border: 0;
|
173
|
padding: 0;
|
174
|
}
|
175
|
|
176
|
/*
|
177
|
* Remove default focus style
|
178
|
*/
|
179
|
|
180
|
.uk-search-icon:focus { outline: none; }
|
181
|
|
182
|
/*
|
183
|
* Position above input
|
184
|
* 1. Set position
|
185
|
* 2. Center icon vertically and horizontally
|
186
|
* 3. Style
|
187
|
*/
|
188
|
|
189
|
.uk-search .uk-search-icon {
|
190
|
/* 1 */
|
191
|
position: absolute;
|
192
|
top: 0;
|
193
|
bottom: 0;
|
194
|
left: 0;
|
195
|
/* 2 */
|
196
|
display: -ms-inline-flexbox;
|
197
|
display: -webkit-inline-flex;
|
198
|
display: inline-flex;
|
199
|
-ms-flex-pack: center;
|
200
|
-webkit-justify-content: center;
|
201
|
justify-content: center;
|
202
|
-ms-flex-align: center;
|
203
|
-webkit-align-items: center;
|
204
|
align-items: center;
|
205
|
/* 3 */
|
206
|
color: @search-icon-color;
|
207
|
}
|
208
|
|
209
|
/*
|
210
|
* Required for `a`.
|
211
|
*/
|
212
|
|
213
|
.uk-search .uk-search-icon:hover { color: @search-icon-color; }
|
214
|
|
215
|
/*
|
216
|
* Make `input` element clickable through icon, e.g. if it's a `span`
|
217
|
*/
|
218
|
|
219
|
.uk-search .uk-search-icon:not(a):not(button):not(input) { pointer-events: none; }
|
220
|
|
221
|
/*
|
222
|
* Position modifier
|
223
|
*/
|
224
|
|
225
|
.uk-search .uk-search-icon-flip {
|
226
|
right: 0;
|
227
|
left: auto;
|
228
|
}
|
229
|
|
230
|
|
231
|
/* Default modifier
|
232
|
========================================================================== */
|
233
|
|
234
|
.uk-search-default { width: @search-default-width; }
|
235
|
|
236
|
/*
|
237
|
* Input
|
238
|
*/
|
239
|
|
240
|
.uk-search-default .uk-search-input {
|
241
|
height: @search-default-height;
|
242
|
padding-left: @search-default-padding-horizontal;
|
243
|
padding-right: @search-default-padding-horizontal;
|
244
|
background: @search-default-background;
|
245
|
.hook-search-default-input;
|
246
|
}
|
247
|
|
248
|
/* Focus */
|
249
|
.uk-search-default .uk-search-input:focus {
|
250
|
background-color: @search-default-focus-background;
|
251
|
.hook-search-default-input-focus;
|
252
|
}
|
253
|
|
254
|
/*
|
255
|
* Icon
|
256
|
*/
|
257
|
|
258
|
.uk-search-default .uk-search-icon { width: @search-default-icon-width; }
|
259
|
|
260
|
.uk-search-default .uk-search-icon:not(.uk-search-icon-flip) + .uk-search-input { padding-left: (@search-default-icon-width); }
|
261
|
.uk-search-default .uk-search-icon-flip + .uk-search-input { padding-right: (@search-default-icon-width); }
|
262
|
|
263
|
|
264
|
/* Navbar modifier
|
265
|
========================================================================== */
|
266
|
|
267
|
.uk-search-navbar { width: @search-navbar-width; }
|
268
|
|
269
|
/*
|
270
|
* Input
|
271
|
*/
|
272
|
|
273
|
.uk-search-navbar .uk-search-input {
|
274
|
height: @search-navbar-height;
|
275
|
background: @search-navbar-background;
|
276
|
font-size: @search-navbar-font-size;
|
277
|
.hook-search-navbar-input;
|
278
|
}
|
279
|
|
280
|
/*
|
281
|
* Icon
|
282
|
*/
|
283
|
|
284
|
.uk-search-navbar .uk-search-icon { width: @search-navbar-icon-width; }
|
285
|
|
286
|
.uk-search-navbar .uk-search-icon:not(.uk-search-icon-flip) + .uk-search-input { padding-left: (@search-navbar-icon-width); }
|
287
|
.uk-search-navbar .uk-search-icon-flip + .uk-search-input { padding-right: (@search-navbar-icon-width); }
|
288
|
|
289
|
|
290
|
/* Large modifier
|
291
|
========================================================================== */
|
292
|
|
293
|
.uk-search-large { width: @search-large-width; }
|
294
|
|
295
|
/*
|
296
|
* Input
|
297
|
*/
|
298
|
|
299
|
.uk-search-large .uk-search-input {
|
300
|
height: @search-large-height;
|
301
|
background: @search-large-background;
|
302
|
font-size: @search-large-font-size;
|
303
|
.hook-search-large-input;
|
304
|
}
|
305
|
|
306
|
/*
|
307
|
* Icon
|
308
|
*/
|
309
|
|
310
|
.uk-search-large .uk-search-icon { width: @search-large-icon-width; }
|
311
|
|
312
|
.uk-search-large .uk-search-icon:not(.uk-search-icon-flip) + .uk-search-input { padding-left: (@search-large-icon-width); }
|
313
|
.uk-search-large .uk-search-icon-flip + .uk-search-input { padding-right: (@search-large-icon-width); }
|
314
|
|
315
|
|
316
|
/* Toggle
|
317
|
========================================================================== */
|
318
|
|
319
|
.uk-search-toggle {
|
320
|
color: @search-toggle-color;
|
321
|
.hook-search-toggle;
|
322
|
}
|
323
|
|
324
|
/* Hover + Focus */
|
325
|
.uk-search-toggle:hover,
|
326
|
.uk-search-toggle:focus {
|
327
|
color: @search-toggle-hover-color;
|
328
|
.hook-search-toggle-hover;
|
329
|
}
|
330
|
|
331
|
|
332
|
// Hooks
|
333
|
// ========================================================================
|
334
|
|
335
|
.hook-search-misc;
|
336
|
|
337
|
.hook-search-default-input() {}
|
338
|
.hook-search-default-input-focus() {}
|
339
|
.hook-search-navbar-input() {}
|
340
|
.hook-search-large-input() {}
|
341
|
|
342
|
.hook-search-toggle() {}
|
343
|
.hook-search-toggle-hover() {}
|
344
|
|
345
|
.hook-search-misc() {}
|
346
|
|
347
|
|
348
|
// Inverse
|
349
|
// ========================================================================
|
350
|
|
351
|
@inverse-search-color: @inverse-global-color;
|
352
|
@inverse-search-placeholder-color: @inverse-global-muted-color;
|
353
|
|
354
|
@inverse-search-icon-color: @inverse-global-muted-color;
|
355
|
|
356
|
@inverse-search-default-background: @inverse-global-muted-background;
|
357
|
@inverse-search-default-focus-background: @inverse-search-default-background;
|
358
|
|
359
|
@inverse-search-navbar-background: transparent;
|
360
|
|
361
|
@inverse-search-large-background: transparent;
|
362
|
|
363
|
@inverse-search-toggle-color: @inverse-global-muted-color;
|
364
|
@inverse-search-toggle-hover-color: @inverse-global-color;
|
365
|
|
366
|
.hook-inverse() {
|
367
|
|
368
|
//
|
369
|
// Input
|
370
|
//
|
371
|
|
372
|
.uk-search-input { color: @inverse-search-color; }
|
373
|
|
374
|
.uk-search-input:-ms-input-placeholder { color: @inverse-search-placeholder-color !important; }
|
375
|
.uk-search-input::-moz-placeholder { color: @inverse-search-placeholder-color; }
|
376
|
.uk-search-input::-webkit-input-placeholder { color: @inverse-search-placeholder-color; }
|
377
|
|
378
|
|
379
|
//
|
380
|
// Icon
|
381
|
//
|
382
|
|
383
|
.uk-search .uk-search-icon { color: @inverse-search-icon-color; }
|
384
|
|
385
|
.uk-search .uk-search-icon:hover { color: @inverse-search-icon-color; }
|
386
|
|
387
|
//
|
388
|
// Style modifier
|
389
|
//
|
390
|
|
391
|
.uk-search-default .uk-search-input {
|
392
|
background-color: @inverse-search-default-background;
|
393
|
.hook-inverse-search-default-input;
|
394
|
}
|
395
|
.uk-search-default .uk-search-input:focus {
|
396
|
background-color: @inverse-search-default-background;
|
397
|
.hook-inverse-search-default-input-focus;
|
398
|
}
|
399
|
|
400
|
.uk-search-navbar .uk-search-input {
|
401
|
background-color: @inverse-search-navbar-background;
|
402
|
.hook-inverse-search-navbar-input;
|
403
|
}
|
404
|
|
405
|
.uk-search-large .uk-search-input {
|
406
|
background-color: @inverse-search-large-background;
|
407
|
.hook-inverse-search-large-input;
|
408
|
}
|
409
|
|
410
|
//
|
411
|
// Toggle
|
412
|
//
|
413
|
|
414
|
.uk-search-toggle {
|
415
|
color: @inverse-search-toggle-color;
|
416
|
.hook-inverse-search-toggle;
|
417
|
}
|
418
|
|
419
|
.uk-search-toggle:hover,
|
420
|
.uk-search-toggle:focus {
|
421
|
color: @inverse-search-toggle-hover-color;
|
422
|
.hook-inverse-search-toggle-hover;
|
423
|
}
|
424
|
|
425
|
}
|
426
|
|
427
|
.hook-inverse-search-default-input() {}
|
428
|
.hook-inverse-search-default-input-focus() {}
|
429
|
.hook-inverse-search-navbar-input() {}
|
430
|
.hook-inverse-search-large-input() {}
|
431
|
.hook-inverse-search-toggle() {}
|
432
|
.hook-inverse-search-toggle-hover() {}
|