uikit 3.14.4-dev.871ba3c05 → 3.14.4-dev.ae765cd84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -11
- package/build/util.js +1 -0
- package/dist/css/uikit-core-rtl.css +385 -110
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +385 -110
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +402 -115
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +402 -115
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +7 -5
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +185 -137
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +185 -137
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +4 -5
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +4 -5
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +22 -7
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +4 -5
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +22 -7
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -3
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +97 -135
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +1803 -1709
- package/dist/js/uikit-core.min.js +14 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +1051 -940
- package/dist/js/uikit.min.js +14 -1
- package/package.json +1 -1
- package/src/images/{backgrounds/nav-parent-open.svg → components/nav-parent-icon-large.svg} +0 -0
- package/src/images/components/nav-parent-icon.svg +3 -0
- package/src/images/components/navbar-parent-icon.svg +3 -0
- package/src/images/components/navbar-toggle-icon.svg +22 -3
- package/src/js/api/state.js +2 -2
- package/src/js/components/filter.js +5 -3
- package/src/js/components/sortable.js +2 -3
- package/src/js/core/accordion.js +9 -17
- package/src/js/core/alert.js +35 -14
- package/src/js/core/drop.js +95 -61
- package/src/js/core/height-viewport.js +14 -6
- package/src/js/core/icon.js +16 -0
- package/src/js/core/index.js +2 -0
- package/src/js/core/leader.js +2 -2
- package/src/js/core/navbar.js +44 -30
- package/src/js/core/offcanvas.js +1 -47
- package/src/js/core/scroll.js +37 -10
- package/src/js/core/sticky.js +8 -9
- package/src/js/core/toggle.js +3 -5
- package/src/js/mixin/media.js +4 -5
- package/src/js/mixin/modal.js +97 -8
- package/src/js/mixin/position.js +26 -11
- package/src/js/mixin/slider-drag.js +20 -8
- package/src/js/mixin/style.js +11 -0
- package/src/js/mixin/togglable.js +80 -133
- package/src/js/util/animation.js +4 -3
- package/src/js/util/dimensions.js +6 -6
- package/src/js/util/filter.js +3 -7
- package/src/js/util/position.js +108 -107
- package/src/js/util/style.js +4 -13
- package/src/js/util/viewport.js +5 -32
- package/src/less/components/_import.less +1 -0
- package/src/less/components/drop.less +1 -18
- package/src/less/components/dropbar.less +115 -0
- package/src/less/components/dropdown.less +16 -16
- package/src/less/components/leader.less +1 -1
- package/src/less/components/nav.less +240 -63
- package/src/less/components/navbar.less +81 -38
- package/src/less/components/utility.less +21 -4
- package/src/less/theme/_import.less +1 -0
- package/src/less/theme/dropbar.less +44 -0
- package/src/less/theme/dropdown.less +0 -11
- package/src/less/theme/nav.less +43 -9
- package/src/less/theme/navbar.less +7 -11
- package/src/scss/components/_import.scss +1 -0
- package/src/scss/components/drop.scss +1 -18
- package/src/scss/components/dropbar.scss +115 -0
- package/src/scss/components/dropdown.scss +16 -16
- package/src/scss/components/leader.scss +1 -1
- package/src/scss/components/nav.scss +189 -51
- package/src/scss/components/navbar.scss +69 -38
- package/src/scss/components/utility.scss +19 -3
- package/src/scss/mixins-theme.scss +93 -25
- package/src/scss/mixins.scss +89 -17
- package/src/scss/theme/_import.scss +1 -0
- package/src/scss/theme/dropbar.scss +44 -0
- package/src/scss/theme/dropdown.scss +0 -8
- package/src/scss/theme/nav.scss +41 -9
- package/src/scss/theme/navbar.scss +7 -8
- package/src/scss/variables-theme.scss +71 -18
- package/src/scss/variables.scss +60 -14
- package/tests/accordion.html +2 -2
- package/tests/alert.html +2 -2
- package/tests/countdown.html +1 -1
- package/tests/drop.html +457 -371
- package/tests/dropbar.html +456 -0
- package/tests/dropdown.html +26 -401
- package/tests/filter.html +9 -12
- package/tests/form.html +1 -1
- package/tests/index.html +126 -107
- package/tests/js/index.js +1 -4
- package/tests/lightbox.html +5 -5
- package/tests/list.html +8 -8
- package/tests/modal.html +13 -13
- package/tests/nav.html +117 -75
- package/tests/navbar.html +2002 -1131
- package/tests/offcanvas.html +17 -21
- package/tests/parallax.html +1 -1
- package/tests/position.html +18 -16
- package/tests/progress.html +9 -9
- package/tests/scroll.html +7 -10
- package/tests/search.html +5 -5
- package/tests/slider.html +6 -5
- package/tests/slideshow.html +8 -8
- package/tests/sortable.html +6 -8
- package/tests/sticky-navbar.html +6 -6
- package/tests/sticky.html +8 -8
- package/tests/switcher.html +1 -1
- package/tests/tab.html +1 -1
- package/tests/table.html +7 -7
- package/tests/toggle.html +2 -2
- package/tests/tooltip.html +1 -1
- package/tests/upload.html +11 -11
- package/tests/utility.html +19 -0
- package/src/images/backgrounds/nav-parent-close.svg +0 -3
package/src/js/util/position.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { offset } from './dimensions';
|
|
2
|
-
import { clamp,
|
|
2
|
+
import { clamp, isArray, ucfirst } from './lang';
|
|
3
3
|
import { offsetViewport, scrollParents } from './viewport';
|
|
4
4
|
|
|
5
5
|
const dirs = [
|
|
@@ -15,126 +15,65 @@ export function positionAt(element, target, options) {
|
|
|
15
15
|
...options.attach,
|
|
16
16
|
},
|
|
17
17
|
offset: [0, 0],
|
|
18
|
+
placement: [],
|
|
18
19
|
...options,
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
: attachTo(element, target, options);
|
|
24
|
-
|
|
25
|
-
offset(element, dim);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function attachTo(element, target, options) {
|
|
29
|
-
let { attach, offset: offsetBy } = {
|
|
30
|
-
attach: {
|
|
31
|
-
element: ['left', 'top'],
|
|
32
|
-
target: ['left', 'top'],
|
|
33
|
-
...options.attach,
|
|
34
|
-
},
|
|
35
|
-
offset: [0, 0],
|
|
36
|
-
...options,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const position = offset(element);
|
|
40
|
-
const targetOffset = offset(target);
|
|
41
|
-
for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
|
|
42
|
-
position[start] = position[dir] =
|
|
43
|
-
targetOffset[start] +
|
|
44
|
-
moveBy(attach.target[i], end, targetOffset[prop]) -
|
|
45
|
-
moveBy(attach.element[i], end, position[prop]) +
|
|
46
|
-
+offsetBy[i];
|
|
47
|
-
position[end] = position[start] + position[prop];
|
|
22
|
+
if (!isArray(target)) {
|
|
23
|
+
target = [target, target];
|
|
48
24
|
}
|
|
49
|
-
return position;
|
|
50
|
-
}
|
|
51
25
|
|
|
52
|
-
|
|
53
|
-
return start === 'center' ? dim / 2 : start === end ? dim : 0;
|
|
26
|
+
offset(element, getPosition(element, target, options));
|
|
54
27
|
}
|
|
55
28
|
|
|
56
|
-
function
|
|
29
|
+
function getPosition(element, target, options) {
|
|
57
30
|
const position = attachTo(element, target, options);
|
|
58
|
-
const targetDim = offset(target);
|
|
59
31
|
|
|
60
32
|
let {
|
|
61
|
-
flip,
|
|
62
33
|
attach: { element: elAttach, target: targetAttach },
|
|
63
34
|
offset: elOffset,
|
|
64
35
|
boundary,
|
|
65
|
-
viewport,
|
|
66
36
|
viewportOffset,
|
|
37
|
+
placement,
|
|
67
38
|
} = options;
|
|
68
39
|
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
viewports =
|
|
72
|
-
|
|
73
|
-
const [scrollElement] = viewports;
|
|
74
|
-
viewports.push(viewport);
|
|
40
|
+
let offsetPosition = position;
|
|
41
|
+
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
42
|
+
let viewports = scrollParents(target[i]);
|
|
43
|
+
const [scrollElement] = viewports;
|
|
75
44
|
|
|
76
|
-
|
|
77
|
-
for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
|
|
78
|
-
if (flip !== true && !includes(flip, dir)) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const willFlip =
|
|
83
|
-
!intersectLine(position, targetDim, i) && intersectLine(position, targetDim, 1 - i);
|
|
84
|
-
|
|
85
|
-
viewport = getIntersectionArea(...viewports.filter(Boolean).map(offsetViewport));
|
|
45
|
+
let viewport = getIntersectionArea(...viewports.map(offsetViewport));
|
|
86
46
|
|
|
87
47
|
if (viewportOffset) {
|
|
88
48
|
viewport[start] += viewportOffset;
|
|
89
49
|
viewport[end] -= viewportOffset;
|
|
90
50
|
}
|
|
91
51
|
|
|
92
|
-
if (boundary
|
|
93
|
-
viewport = getIntersectionArea(viewport,
|
|
52
|
+
if (boundary) {
|
|
53
|
+
viewport = getIntersectionArea(viewport, offsetViewport(boundary));
|
|
94
54
|
}
|
|
95
55
|
|
|
96
|
-
const
|
|
97
|
-
const
|
|
56
|
+
const isInStartViewport = position[start] >= viewport[start];
|
|
57
|
+
const isInEndViewport = position[end] <= viewport[end];
|
|
98
58
|
|
|
99
|
-
if (
|
|
59
|
+
if (isInStartViewport && isInEndViewport) {
|
|
100
60
|
continue;
|
|
101
61
|
}
|
|
102
62
|
|
|
103
|
-
let offsetBy;
|
|
63
|
+
let offsetBy = 0;
|
|
104
64
|
|
|
105
65
|
// Flip
|
|
106
|
-
if (
|
|
66
|
+
if (placement[i] === 'flip') {
|
|
107
67
|
if (
|
|
108
|
-
(
|
|
109
|
-
(
|
|
68
|
+
(targetAttach[i] === end && isInEndViewport) ||
|
|
69
|
+
(targetAttach[i] === start && isInStartViewport)
|
|
110
70
|
) {
|
|
111
71
|
continue;
|
|
112
72
|
}
|
|
113
73
|
|
|
114
|
-
offsetBy =
|
|
115
|
-
(elAttach[i] === start
|
|
116
|
-
? -position[prop]
|
|
117
|
-
: elAttach[i] === end
|
|
118
|
-
? position[prop]
|
|
119
|
-
: 0) +
|
|
120
|
-
(targetAttach[i] === start
|
|
121
|
-
? targetDim[prop]
|
|
122
|
-
: targetAttach[i] === end
|
|
123
|
-
? -targetDim[prop]
|
|
124
|
-
: 0) -
|
|
125
|
-
elOffset[i] * 2;
|
|
74
|
+
offsetBy = flip(element, target, options, i)[start] - position[start];
|
|
126
75
|
|
|
127
|
-
if (
|
|
128
|
-
!isInScrollArea(
|
|
129
|
-
{
|
|
130
|
-
...position,
|
|
131
|
-
[start]: position[start] + offsetBy,
|
|
132
|
-
[end]: position[end] + offsetBy,
|
|
133
|
-
},
|
|
134
|
-
scrollElement,
|
|
135
|
-
i
|
|
136
|
-
)
|
|
137
|
-
) {
|
|
76
|
+
if (!isInScrollArea(applyOffset(position, offsetBy, i), scrollElement, i)) {
|
|
138
77
|
if (isInScrollArea(position, scrollElement, i)) {
|
|
139
78
|
continue;
|
|
140
79
|
}
|
|
@@ -143,26 +82,27 @@ function attachToWithFlip(element, target, options) {
|
|
|
143
82
|
return false;
|
|
144
83
|
}
|
|
145
84
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return newPos;
|
|
160
|
-
}
|
|
85
|
+
const newPos = getPosition(element, target, {
|
|
86
|
+
...options,
|
|
87
|
+
attach: {
|
|
88
|
+
element: elAttach.map(flipAxis).reverse(),
|
|
89
|
+
target: targetAttach.map(flipAxis).reverse(),
|
|
90
|
+
},
|
|
91
|
+
offset: elOffset.reverse(),
|
|
92
|
+
placement: placement.reverse(),
|
|
93
|
+
recursion: true,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (newPos && isInScrollArea(newPos, scrollElement, 1 - i)) {
|
|
97
|
+
return newPos;
|
|
161
98
|
}
|
|
99
|
+
|
|
100
|
+
continue;
|
|
162
101
|
}
|
|
163
102
|
|
|
164
|
-
//
|
|
165
|
-
} else {
|
|
103
|
+
// Shift
|
|
104
|
+
} else if (placement[i] === 'shift') {
|
|
105
|
+
const targetDim = offset(target[i]);
|
|
166
106
|
offsetBy =
|
|
167
107
|
clamp(
|
|
168
108
|
clamp(position[start], viewport[start], viewport[end] - position[prop]),
|
|
@@ -171,13 +111,54 @@ function attachToWithFlip(element, target, options) {
|
|
|
171
111
|
) - position[start];
|
|
172
112
|
}
|
|
173
113
|
|
|
174
|
-
offsetPosition
|
|
175
|
-
offsetPosition[end] += offsetBy;
|
|
114
|
+
offsetPosition = applyOffset(offsetPosition, offsetBy, i);
|
|
176
115
|
}
|
|
177
116
|
|
|
178
117
|
return offsetPosition;
|
|
179
118
|
}
|
|
180
119
|
|
|
120
|
+
function attachTo(element, target, options) {
|
|
121
|
+
let { attach, offset: offsetBy } = {
|
|
122
|
+
attach: {
|
|
123
|
+
element: ['left', 'top'],
|
|
124
|
+
target: ['left', 'top'],
|
|
125
|
+
...options.attach,
|
|
126
|
+
},
|
|
127
|
+
offset: [0, 0],
|
|
128
|
+
...options,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
let elOffset = offset(element);
|
|
132
|
+
|
|
133
|
+
for (const [i, [prop, , start, end]] of Object.entries(dirs)) {
|
|
134
|
+
const targetOffset =
|
|
135
|
+
attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
|
|
136
|
+
|
|
137
|
+
elOffset = applyOffset(
|
|
138
|
+
elOffset,
|
|
139
|
+
targetOffset[start] -
|
|
140
|
+
elOffset[start] +
|
|
141
|
+
moveBy(attach.target[i], end, targetOffset[prop]) -
|
|
142
|
+
moveBy(attach.element[i], end, elOffset[prop]) +
|
|
143
|
+
+offsetBy[i],
|
|
144
|
+
i
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return elOffset;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function applyOffset(position, offset, i) {
|
|
151
|
+
const [, dir, start, end] = dirs[i];
|
|
152
|
+
const newPos = { ...position };
|
|
153
|
+
newPos[start] = position[dir] = position[start] + offset;
|
|
154
|
+
newPos[end] += offset;
|
|
155
|
+
return newPos;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function moveBy(attach, end, dim) {
|
|
159
|
+
return attach === 'center' ? dim / 2 : attach === end ? dim : 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
181
162
|
function getIntersectionArea(...rects) {
|
|
182
163
|
let area = {};
|
|
183
164
|
for (const rect of rects) {
|
|
@@ -198,12 +179,32 @@ function isInScrollArea(position, scrollElement, dir) {
|
|
|
198
179
|
return position[start] >= viewport[start] && position[end] <= viewport[end];
|
|
199
180
|
}
|
|
200
181
|
|
|
201
|
-
function
|
|
202
|
-
|
|
203
|
-
|
|
182
|
+
function flip(element, target, { offset, attach }, i) {
|
|
183
|
+
return attachTo(element, target, {
|
|
184
|
+
attach: {
|
|
185
|
+
element: flipAttach(attach.element, i),
|
|
186
|
+
target: flipAttach(attach.target, i),
|
|
187
|
+
},
|
|
188
|
+
offset: flipOffset(offset, i),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function flipAttach(attach, i) {
|
|
193
|
+
const newAttach = [...attach];
|
|
194
|
+
const index = dirs[i].indexOf(attach[i]);
|
|
195
|
+
if (~index) {
|
|
196
|
+
newAttach[i] = dirs[i][1 - (index % 2) + 2];
|
|
197
|
+
}
|
|
198
|
+
return newAttach;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function flipOffset(offset, i) {
|
|
202
|
+
offset = [...offset];
|
|
203
|
+
offset[i] *= -1;
|
|
204
|
+
return offset;
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
function
|
|
207
|
+
function flipAxis(prop) {
|
|
207
208
|
for (let i = 0; i < dirs.length; i++) {
|
|
208
209
|
const index = dirs[i].indexOf(prop);
|
|
209
210
|
if (~index) {
|
package/src/js/util/style.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
isString,
|
|
9
9
|
isUndefined,
|
|
10
10
|
memoize,
|
|
11
|
+
startsWith,
|
|
11
12
|
toNodes,
|
|
12
13
|
} from './lang';
|
|
13
14
|
|
|
@@ -62,18 +63,11 @@ export function css(element, property, value, priority = '') {
|
|
|
62
63
|
return elements[0];
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const propertyRe = /^\s*(["'])?(.*?)\1\s*$/;
|
|
66
|
-
export function getCssVar(name, element = document.documentElement) {
|
|
67
|
-
return css(element, `--uk-${name}`).replace(propertyRe, '$2');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
66
|
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
|
|
71
67
|
export const propName = memoize((name) => vendorPropName(name));
|
|
72
68
|
|
|
73
|
-
const cssPrefixes = ['webkit', 'moz'];
|
|
74
|
-
|
|
75
69
|
function vendorPropName(name) {
|
|
76
|
-
if (name
|
|
70
|
+
if (startsWith(name, '--')) {
|
|
77
71
|
return name;
|
|
78
72
|
}
|
|
79
73
|
|
|
@@ -85,11 +79,8 @@ function vendorPropName(name) {
|
|
|
85
79
|
return name;
|
|
86
80
|
}
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
prefixedName
|
|
90
|
-
|
|
91
|
-
while (i--) {
|
|
92
|
-
prefixedName = `-${cssPrefixes[i]}-${name}`;
|
|
82
|
+
for (const prefix of ['webkit', 'moz']) {
|
|
83
|
+
const prefixedName = `-${prefix}-${name}`;
|
|
93
84
|
if (prefixedName in style) {
|
|
94
85
|
return prefixedName;
|
|
95
86
|
}
|
package/src/js/util/viewport.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { css } from './style';
|
|
2
2
|
import { isVisible, parents } from './filter';
|
|
3
3
|
import { offset, offsetPosition } from './dimensions';
|
|
4
|
-
import {
|
|
5
|
-
clamp,
|
|
6
|
-
findIndex,
|
|
7
|
-
intersectRect,
|
|
8
|
-
isDocument,
|
|
9
|
-
isUndefined,
|
|
10
|
-
isWindow,
|
|
11
|
-
toFloat,
|
|
12
|
-
toNode,
|
|
13
|
-
toWindow,
|
|
14
|
-
ucfirst,
|
|
15
|
-
} from './lang';
|
|
4
|
+
import { clamp, findIndex, intersectRect, isWindow, toFloat, toWindow, ucfirst } from './lang';
|
|
16
5
|
|
|
17
6
|
export function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
18
7
|
if (!isVisible(element)) {
|
|
@@ -35,20 +24,6 @@ export function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
|
35
24
|
);
|
|
36
25
|
}
|
|
37
26
|
|
|
38
|
-
export function scrollTop(element, top) {
|
|
39
|
-
if (isWindow(element) || isDocument(element)) {
|
|
40
|
-
element = scrollingElement(element);
|
|
41
|
-
} else {
|
|
42
|
-
element = toNode(element);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (isUndefined(top)) {
|
|
46
|
-
return element.scrollTop;
|
|
47
|
-
} else {
|
|
48
|
-
element.scrollTop = top;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
27
|
export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
53
28
|
const parents = isVisible(element) ? scrollParents(element) : [];
|
|
54
29
|
return parents.reduce(
|
|
@@ -90,7 +65,7 @@ export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
|
90
65
|
(function step() {
|
|
91
66
|
const percent = ease(clamp((Date.now() - start) / duration));
|
|
92
67
|
|
|
93
|
-
scrollTop
|
|
68
|
+
element.scrollTop = scroll + top * percent;
|
|
94
69
|
|
|
95
70
|
// scroll more if we have not reached our destination
|
|
96
71
|
if (percent === 1) {
|
|
@@ -153,12 +128,10 @@ export function scrollParents(element, overflowRe = /auto|scroll|hidden|clip/, s
|
|
|
153
128
|
export function offsetViewport(scrollElement) {
|
|
154
129
|
const window = toWindow(scrollElement);
|
|
155
130
|
const {
|
|
156
|
-
document: {
|
|
131
|
+
document: { documentElement },
|
|
157
132
|
} = window;
|
|
158
133
|
let viewportElement =
|
|
159
|
-
scrollElement === scrollingElement(scrollElement)
|
|
160
|
-
? window
|
|
161
|
-
: scrollElement;
|
|
134
|
+
scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
|
|
162
135
|
|
|
163
136
|
const { visualViewport } = window;
|
|
164
137
|
if (isWindow(viewportElement) && visualViewport) {
|
|
@@ -177,7 +150,7 @@ export function offsetViewport(scrollElement) {
|
|
|
177
150
|
// iOS 12 returns <body> as scrollingElement
|
|
178
151
|
viewportElement = documentElement;
|
|
179
152
|
} else {
|
|
180
|
-
rect[start] += toFloat(css(viewportElement, `border
|
|
153
|
+
rect[start] += toFloat(css(viewportElement, `border-${start}-width`));
|
|
181
154
|
}
|
|
182
155
|
rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
|
|
183
156
|
rect[end] = rect[prop] + rect[start];
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Component: `uk-drop`
|
|
5
5
|
//
|
|
6
|
-
// Modifiers: `uk-drop-
|
|
7
|
-
// `uk-drop-stack`
|
|
6
|
+
// Modifiers: `uk-drop-stack`
|
|
8
7
|
// `uk-drop-grid`
|
|
9
8
|
//
|
|
10
9
|
// States: `uk-open`
|
|
@@ -50,22 +49,6 @@
|
|
|
50
49
|
.uk-drop.uk-open { display: block; }
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
/* Stretch modifier
|
|
54
|
-
========================================================================== */
|
|
55
|
-
|
|
56
|
-
/*
|
|
57
|
-
* 1. Allow scrolling
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
.uk-drop-stretch {
|
|
61
|
-
--uk-position-offset: 0;
|
|
62
|
-
--uk-position-viewport-offset: 0;
|
|
63
|
-
/* 1 */
|
|
64
|
-
overflow-y: auto;
|
|
65
|
-
-webkit-overflow-scrolling: touch;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
52
|
/* Grid modifiers
|
|
70
53
|
========================================================================== */
|
|
71
54
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Name: Dropbar
|
|
2
|
+
// Description: Component to create dropbar menus
|
|
3
|
+
//
|
|
4
|
+
// Component: `uk-dropbar`
|
|
5
|
+
//
|
|
6
|
+
// ========================================================================
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Variables
|
|
10
|
+
// ========================================================================
|
|
11
|
+
|
|
12
|
+
@dropbar-margin: 0;
|
|
13
|
+
@dropbar-z-index: @global-z-index + 20;
|
|
14
|
+
@dropbar-padding-top: 15px;
|
|
15
|
+
@dropbar-padding-bottom: @dropbar-padding-top;
|
|
16
|
+
@dropbar-padding-horizontal: 15px;
|
|
17
|
+
@dropbar-padding-horizontal-s: @global-gutter;
|
|
18
|
+
@dropbar-padding-horizontal-m: @global-medium-gutter;
|
|
19
|
+
@dropbar-background: @global-muted-background;
|
|
20
|
+
@dropbar-color: @global-color;
|
|
21
|
+
@dropbar-color-mode: none;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/* ========================================================================
|
|
25
|
+
Component: Dropbar
|
|
26
|
+
========================================================================== */
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* 1. Hide by default
|
|
30
|
+
* 2. Set position
|
|
31
|
+
* 3. Style
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
.uk-dropbar {
|
|
35
|
+
--uk-position-offset: @dropbar-margin;
|
|
36
|
+
--uk-position-shift-offset: 0;
|
|
37
|
+
--uk-position-viewport-offset: 0;
|
|
38
|
+
/* 1 */
|
|
39
|
+
display: none;
|
|
40
|
+
/* 2 */
|
|
41
|
+
position: absolute;
|
|
42
|
+
z-index: @dropbar-z-index;
|
|
43
|
+
/* 3 */
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
padding: @dropbar-padding-top @dropbar-padding-horizontal @dropbar-padding-bottom @dropbar-padding-horizontal;
|
|
46
|
+
background: @dropbar-background;
|
|
47
|
+
color: @dropbar-color;
|
|
48
|
+
.hook-dropbar();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Show */
|
|
52
|
+
.uk-dropbar.uk-open { display: block; }
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* Remove margin from the last-child
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
.uk-dropbar > :last-child { margin-bottom: 0; }
|
|
59
|
+
|
|
60
|
+
/* Phone landscape and bigger */
|
|
61
|
+
@media (min-width: @breakpoint-small) {
|
|
62
|
+
|
|
63
|
+
.uk-dropbar {
|
|
64
|
+
padding-left: @dropbar-padding-horizontal-s;
|
|
65
|
+
padding-right: @dropbar-padding-horizontal-s;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Tablet landscape and bigger */
|
|
71
|
+
@media (min-width: @breakpoint-medium) {
|
|
72
|
+
|
|
73
|
+
.uk-dropbar {
|
|
74
|
+
padding-left: @dropbar-padding-horizontal-m;
|
|
75
|
+
padding-right: @dropbar-padding-horizontal-m;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Color Mode
|
|
81
|
+
.uk-dropbar:extend(.uk-light all) when (@dropbar-color-mode = light) {}
|
|
82
|
+
.uk-dropbar:extend(.uk-dark all) when (@dropbar-color-mode = dark) {}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/* Direction modifier
|
|
86
|
+
========================================================================== */
|
|
87
|
+
|
|
88
|
+
.uk-dropbar-top {
|
|
89
|
+
.hook-dropbar-top();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.uk-dropbar-bottom {
|
|
93
|
+
.hook-dropbar-bottom();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.uk-dropbar-left {
|
|
97
|
+
.hook-dropbar-left();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.uk-dropbar-right {
|
|
101
|
+
.hook-dropbar-right();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// Hooks
|
|
106
|
+
// ========================================================================
|
|
107
|
+
|
|
108
|
+
.hook-dropbar-misc();
|
|
109
|
+
|
|
110
|
+
.hook-dropbar() {}
|
|
111
|
+
.hook-dropbar-top() {}
|
|
112
|
+
.hook-dropbar-bottom() {}
|
|
113
|
+
.hook-dropbar-left() {}
|
|
114
|
+
.hook-dropbar-right() {}
|
|
115
|
+
.hook-dropbar-misc() {}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Adopted: `uk-dropdown-nav`
|
|
7
7
|
//
|
|
8
|
-
// Modifiers: `uk-dropdown-
|
|
8
|
+
// Modifiers: `uk-dropdown-large`
|
|
9
9
|
// `uk-dropdown-stack`
|
|
10
10
|
// `uk-dropdown-grid`
|
|
11
11
|
//
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
@dropdown-padding: 15px;
|
|
25
25
|
@dropdown-background: @global-muted-background;
|
|
26
26
|
@dropdown-color: @global-color;
|
|
27
|
+
@dropdown-color-mode: none;
|
|
28
|
+
|
|
29
|
+
@dropdown-large-padding: 40px;
|
|
27
30
|
|
|
28
31
|
@dropdown-nav-item-color: @global-muted-color;
|
|
29
32
|
@dropdown-nav-item-hover-color: @global-color;
|
|
@@ -57,7 +60,6 @@
|
|
|
57
60
|
/* 3 */
|
|
58
61
|
box-sizing: border-box;
|
|
59
62
|
min-width: @dropdown-min-width;
|
|
60
|
-
max-width: 100vw;
|
|
61
63
|
/* 4 */
|
|
62
64
|
padding: @dropdown-padding;
|
|
63
65
|
background: @dropdown-background;
|
|
@@ -68,22 +70,21 @@
|
|
|
68
70
|
/* Show */
|
|
69
71
|
.uk-dropdown.uk-open { display: block; }
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
/* Stretch modifier
|
|
73
|
-
========================================================================== */
|
|
74
|
-
|
|
75
73
|
/*
|
|
76
|
-
*
|
|
74
|
+
* Remove margin from the last-child
|
|
77
75
|
*/
|
|
78
76
|
|
|
79
|
-
.uk-dropdown-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
.uk-dropdown > :last-child { margin-bottom: 0; }
|
|
78
|
+
|
|
79
|
+
// Color Mode
|
|
80
|
+
.uk-dropdown:extend(.uk-light all) when (@dropdown-color-mode = light) {}
|
|
81
|
+
.uk-dropdown:extend(.uk-dark all) when (@dropdown-color-mode = dark) {}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
/* Size modifier
|
|
85
|
+
========================================================================== */
|
|
86
|
+
|
|
87
|
+
.uk-dropdown-large { padding: @dropdown-large-padding; }
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
/* Nav
|
|
@@ -160,7 +161,6 @@
|
|
|
160
161
|
.hook-dropdown-misc();
|
|
161
162
|
|
|
162
163
|
.hook-dropdown() {}
|
|
163
|
-
.hook-dropdown-stretch() {}
|
|
164
164
|
.hook-dropdown-nav() {}
|
|
165
165
|
.hook-dropdown-nav-item() {}
|
|
166
166
|
.hook-dropdown-nav-item-hover() {}
|