UNPKG

13.6 kBSCSSView Raw
1// Name: Utility
2// Description: Utilities collection
3//
4// Component: `uk-panel-*`
5// `uk-clearfix`
6// `uk-float-*`
7// `uk-overflow-*`
8// `uk-resize-*`
9// `uk-display-*`
10// `uk-inline-*`
11// `uk-responsive-*`
12// `uk-preserve-width`
13// `uk-border-*`
14// `uk-box-shadow-*`
15// `uk-box-shadow-bottom`
16// `uk-dropcap`
17// `uk-logo`
18// `uk-blend-*`
19// `uk-transform-*`
20// `uk-transform-origin-*`
21//
22// States: `uk-disabled`
23// `uk-drag`
24// `uk-dragover`
25// `uk-preserve`
26//
27// ========================================================================
28
29
30// Variables
31// ========================================================================
32
33$panel-scrollable-height: 170px !default;
34$panel-scrollable-padding: 10px !default;
35$panel-scrollable-border-width: $global-border-width !default;
36$panel-scrollable-border: $global-border !default;
37
38$border-rounded-border-radius: 5px !default;
39
40$box-shadow-duration: 0.1s !default;
41
42$box-shadow-bottom-height: 30px !default;
43$box-shadow-bottom-border-radius: 100% !default;
44$box-shadow-bottom-background: #444 !default;
45$box-shadow-bottom-blur: 20px !default;
46
47$dropcap-margin-right: 10px !default;
48$dropcap-font-size: (($global-line-height * 3) * 1em) !default;
49
50$logo-font-size: $global-large-font-size !default;
51$logo-font-family: $global-font-family !default;
52$logo-color: $global-color !default;
53$logo-hover-color: $global-color !default;
54
55$dragover-box-shadow: 0 0 20px rgba(100,100,100,0.3) !default;
56
57
58/* ========================================================================
59 Component: Utility
60 ========================================================================== */
61
62
63/* Panel
64 ========================================================================== */
65
66.uk-panel {
67 position: relative;
68 box-sizing: border-box;
69}
70
71/*
72 * Micro clearfix
73 */
74
75.uk-panel::before,
76.uk-panel::after {
77 content: "";
78 display: table;
79}
80
81.uk-panel::after { clear: both; }
82
83/*
84 * Remove margin from the last-child
85 */
86
87.uk-panel > :last-child { margin-bottom: 0; }
88
89
90/*
91 * Scrollable
92 */
93
94.uk-panel-scrollable {
95 height: $panel-scrollable-height;
96 padding: $panel-scrollable-padding;
97 border: $panel-scrollable-border-width solid $panel-scrollable-border;
98 overflow: auto;
99 -webkit-overflow-scrolling: touch;
100 resize: both;
101 @if(mixin-exists(hook-panel-scrollable)) {@include hook-panel-scrollable();}
102}
103
104
105/* Clearfix
106 ========================================================================== */
107
108/*
109 * 1. `table-cell` is used with `::before` because `table` creates a 1px gap when it becomes a flex item, only in Webkit
110 * 2. `table` is used again with `::after` because `clear` only works with block elements.
111 * Note: `display: block` with `overflow: hidden` is currently not working in the latest Safari
112 */
113
114/* 1 */
115.uk-clearfix::before {
116 content: "";
117 display: table-cell;
118}
119
120/* 2 */
121.uk-clearfix::after {
122 content: "";
123 display: table;
124 clear: both;
125}
126
127
128/* Float
129 ========================================================================== */
130
131/*
132 * 1. Prevent content overflow
133 */
134
135.uk-float-left { float: left; }
136.uk-float-right { float: right; }
137
138/* 1 */
139[class*='uk-float-'] { max-width: 100%; }
140
141
142/* Overfow
143 ========================================================================== */
144
145.uk-overflow-hidden { overflow: hidden; }
146
147/*
148 * Enable scrollbars if content is clipped
149 * Note: Firefox ignores `padding-bottom` for the scrollable overflow https://bugzilla.mozilla.org/show_bug.cgi?id=748518
150 */
151
152.uk-overflow-auto {
153 overflow: auto;
154 -webkit-overflow-scrolling: touch;
155}
156
157.uk-overflow-auto > :last-child { margin-bottom: 0; }
158
159
160/* Resize
161 ========================================================================== */
162
163.uk-resize { resize: both; }
164.uk-resize-vertical { resize: vertical; }
165
166
167/* Display
168 ========================================================================== */
169
170.uk-display-block { display: block !important; }
171.uk-display-inline { display: inline !important; }
172.uk-display-inline-block { display: inline-block !important; }
173
174
175/* Inline
176 ========================================================================== */
177
178/*
179 * 1. Container fits its content
180 * 2. Create position context
181 * 3. Prevent content overflow
182 * 4. Behave like most inline-block elements
183 * 5. Force hardware acceleration without creating a new stacking context
184 * to fix 1px glitch when combined with overlays and transitions in Webkit
185 * 6. Clip child elements
186 */
187
188[class*='uk-inline'] {
189 /* 1 */
190 display: inline-block;
191 /* 2 */
192 position: relative;
193 /* 3 */
194 max-width: 100%;
195 /* 4 */
196 vertical-align: middle;
197 /* 5 */
198 -webkit-backface-visibility: hidden;
199}
200
201.uk-inline-clip {
202 /* 6 */
203 overflow: hidden;
204}
205
206
207/* Responsive objects
208 ========================================================================== */
209
210/*
211 * Preserve original dimensions
212 * Because `img, `video`, `canvas` and `audio` are already responsive by default, see Base component
213 */
214
215.uk-preserve-width,
216.uk-preserve-width canvas,
217.uk-preserve-width img,
218.uk-preserve-width svg,
219.uk-preserve-width video { max-width: none; }
220
221/*
222 * Responsiveness
223 * Corrects `max-width` and `max-height` behavior if padding and border are used
224 */
225
226.uk-responsive-width,
227.uk-responsive-height { box-sizing: border-box; }
228
229/*
230 * 1. Set a maximum width. `important` needed to override `uk-preserve-width img`
231 * 2. Auto scale the height. Only needed if `height` attribute is present
232 */
233
234.uk-responsive-width {
235 /* 1 */
236 max-width: 100% !important;
237 /* 2 */
238 height: auto;
239}
240
241/*
242 * 1. Set a maximum height. Only works if the parent element has a fixed height
243 * 2. Auto scale the width. Only needed if `width` attribute is present
244 * 3. Reset max-width, which `img, `video`, `canvas` and `audio` already have by default
245 */
246
247.uk-responsive-height {
248 /* 1 */
249 max-height: 100%;
250 /* 2 */
251 width: auto;
252 /* 3 */
253 max-width: none;
254}
255
256
257/* Border
258 ========================================================================== */
259
260.uk-border-circle { border-radius: 50%; }
261.uk-border-pill { border-radius: 500px; }
262.uk-border-rounded { border-radius: $border-rounded-border-radius; }
263
264/*
265 * Fix `overflow: hidden` to be ignored with border-radius and CSS transforms in Webkit
266 */
267
268.uk-inline-clip[class*='uk-border-'] { -webkit-transform: translateZ(0); }
269
270
271/* Box-shadow
272 ========================================================================== */
273
274.uk-box-shadow-small { box-shadow: $global-small-box-shadow; }
275.uk-box-shadow-medium { box-shadow: $global-medium-box-shadow; }
276.uk-box-shadow-large { box-shadow: $global-large-box-shadow; }
277.uk-box-shadow-xlarge { box-shadow: $global-xlarge-box-shadow; }
278
279/*
280 * Hover
281 */
282
283[class*='uk-box-shadow-hover'] { transition: box-shadow $box-shadow-duration ease-in-out; }
284
285.uk-box-shadow-hover-small:hover { box-shadow: $global-small-box-shadow; }
286.uk-box-shadow-hover-medium:hover { box-shadow: $global-medium-box-shadow; }
287.uk-box-shadow-hover-large:hover { box-shadow: $global-large-box-shadow; }
288.uk-box-shadow-hover-xlarge:hover { box-shadow: $global-xlarge-box-shadow; }
289
290
291/* Box-shadow bottom
292 ========================================================================== */
293
294/*
295 * 1. Set position.
296 * 2. Set style
297 * 3. Blur doesn't work on pseudo elements with negative `z-index` in Edge.
298 * Solved by using `before` and add position context to child elements.
299 */
300
301@supports (filter: blur(0)) {
302
303 .uk-box-shadow-bottom {
304 display: inline-block;
305 position: relative;
306 max-width: 100%;
307 vertical-align: middle;
308 }
309
310 .uk-box-shadow-bottom::before {
311 content: '';
312 /* 1 */
313 position: absolute;
314 bottom: (-$box-shadow-bottom-height);
315 left: 0;
316 right: 0;
317 /* 2 */
318 height: $box-shadow-bottom-height;
319 border-radius: $box-shadow-bottom-border-radius;
320 background: $box-shadow-bottom-background;
321 filter: blur($box-shadow-bottom-blur);
322 @if(mixin-exists(hook-box-shadow-bottom)) {@include hook-box-shadow-bottom();}
323 }
324
325 /* 3 */
326 .uk-box-shadow-bottom > * { position: relative; }
327
328}
329
330
331/* Drop cap
332 ========================================================================== */
333
334/*
335 * 1. Firefox doesn't apply `::first-letter` if the first letter is inside child elements
336 * https://bugzilla.mozilla.org/show_bug.cgi?id=214004
337 * 2. In Firefox, a floating `::first-letter` doesn't have a line box and there for no `line-height`
338 * https://bugzilla.mozilla.org/show_bug.cgi?id=317933
339 * 3. Caused by 1.: Edge creates two nested `::first-letter` containers, one for each selector
340 * This doubles the `font-size` exponential when using the `em` unit.
341 */
342
343.uk-dropcap::first-letter,
344/* 1 */
345.uk-dropcap > p:first-of-type::first-letter {
346 display: block;
347 margin-right: $dropcap-margin-right;
348 float: left;
349 font-size: $dropcap-font-size;
350 line-height: 1;
351 @if(mixin-exists(hook-dropcap)) {@include hook-dropcap();}
352}
353
354/* 2 */
355@-moz-document url-prefix() {
356
357 .uk-dropcap::first-letter,
358 .uk-dropcap > p:first-of-type::first-letter { margin-top: 1.1%; }
359
360}
361
362/* 3 */
363@supports (-ms-ime-align: auto) {
364
365 .uk-dropcap > p:first-of-type::first-letter { font-size: 1em; }
366
367}
368
369
370/* Logo
371 ========================================================================== */
372
373/*
374 * 1. Required for `a`
375 */
376
377.uk-logo {
378 font-size: $logo-font-size;
379 font-family: $logo-font-family;
380 color: $logo-color;
381 /* 1 */
382 text-decoration: none;
383 @if(mixin-exists(hook-logo)) {@include hook-logo();}
384}
385
386/* Hover + Focus */
387.uk-logo:hover,
388.uk-logo:focus {
389 color: $logo-hover-color;
390 outline: none;
391 /* 1 */
392 text-decoration: none;
393 @if(mixin-exists(hook-logo-hover)) {@include hook-logo-hover();}
394}
395
396.uk-logo-inverse { display: none; }
397
398
399/* Disabled State
400 ========================================================================== */
401
402.uk-disabled { pointer-events: none; }
403
404
405/* Drag State
406 ========================================================================== */
407
408/*
409 * 1. Needed if moving over elements with have their own cursor on hover, e.g. links or buttons
410 * 2. Fix dragging over iframes
411 */
412
413.uk-drag,
414/* 1 */
415.uk-drag * { cursor: move; }
416
417/* 2 */
418.uk-drag iframe { pointer-events: none; }
419
420
421/* Dragover State
422 ========================================================================== */
423
424/*
425 * Create a box-shadow when dragging a file over the upload area
426 */
427
428.uk-dragover { box-shadow: $dragover-box-shadow; }
429
430
431/* Blend modes
432 ========================================================================== */
433
434.uk-blend-multiply { mix-blend-mode: multiply; }
435.uk-blend-screen { mix-blend-mode: screen; }
436.uk-blend-overlay { mix-blend-mode: overlay; }
437.uk-blend-darken { mix-blend-mode: darken; }
438.uk-blend-lighten { mix-blend-mode: lighten; }
439.uk-blend-color-dodge { mix-blend-mode: color-dodge; }
440.uk-blend-color-burn { mix-blend-mode: color-burn; }
441.uk-blend-hard-light { mix-blend-mode: hard-light; }
442.uk-blend-soft-light { mix-blend-mode: soft-light; }
443.uk-blend-difference { mix-blend-mode: difference; }
444.uk-blend-exclusion { mix-blend-mode: exclusion; }
445.uk-blend-hue { mix-blend-mode: hue; }
446.uk-blend-saturation { mix-blend-mode: saturation; }
447.uk-blend-color { mix-blend-mode: color; }
448.uk-blend-luminosity { mix-blend-mode: luminosity; }
449
450
451/* Transform
452========================================================================== */
453
454.uk-transform-center { transform: translate(-50%, -50%); }
455
456
457/* Transform Origin
458========================================================================== */
459
460.uk-transform-origin-top-left { transform-origin: 0 0; }
461.uk-transform-origin-top-center { transform-origin: 50% 0; }
462.uk-transform-origin-top-right { transform-origin: 100% 0; }
463.uk-transform-origin-center-left { transform-origin: 0 50%; }
464.uk-transform-origin-center-right { transform-origin: 100% 50%; }
465.uk-transform-origin-bottom-left { transform-origin: 0 100%; }
466.uk-transform-origin-bottom-center { transform-origin: 50% 100%; }
467.uk-transform-origin-bottom-right { transform-origin: 100% 100%; }
468
469
470// Hooks
471// ========================================================================
472
473@if(mixin-exists(hook-utility-misc)) {@include hook-utility-misc();}
474
475// @mixin hook-panel-scrollable(){}
476// @mixin hook-box-shadow-bottom(){}
477// @mixin hook-dropcap(){}
478// @mixin hook-logo(){}
479// @mixin hook-logo-hover(){}
480// @mixin hook-utility-misc(){}
481
482
483// Inverse
484// ========================================================================
485
486$inverse-logo-color: $inverse-global-color !default;
487$inverse-logo-hover-color: $inverse-global-color !default;
488
489
490
491// @mixin hook-inverse-dropcap(){}
492// @mixin hook-inverse-logo(){}
493// @mixin hook-inverse-logo-hover(){}