uikit 3.14.2-dev.e270e98f7 → 3.14.3-dev.5325d42a0
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 +30 -0
- package/build/util.js +8 -2
- package/dist/css/uikit-core-rtl.css +93 -21
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +93 -21
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +99 -33
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +99 -33
- 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 +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +106 -17
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +106 -17
- 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 +71 -36
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +55 -35
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +1 -1
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +55 -35
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +1 -1
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +142 -36
- 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 +276 -129
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +346 -164
- package/dist/js/uikit.min.js +1 -1
- package/package.json +11 -11
- package/src/js/components/parallax.js +16 -1
- package/src/js/core/accordion.js +3 -3
- package/src/js/core/alert.js +1 -1
- package/src/js/core/drop.js +47 -18
- package/src/js/core/height-viewport.js +15 -11
- package/src/js/core/navbar.js +19 -18
- package/src/js/core/scrollspy.js +4 -0
- package/src/js/core/toggle.js +9 -8
- package/src/js/mixin/parallax.js +54 -34
- package/src/js/mixin/position.js +36 -20
- package/src/js/mixin/togglable.js +110 -19
- package/src/js/util/animation.js +1 -0
- package/src/js/util/dom.js +4 -3
- package/src/js/util/position.js +24 -22
- package/src/js/util/viewport.js +7 -8
- package/src/less/components/drop.less +19 -4
- package/src/less/components/dropdown.less +21 -4
- package/src/less/components/margin.less +13 -14
- package/src/less/components/modal.less +19 -4
- package/src/less/components/nav.less +1 -1
- package/src/less/components/navbar.less +60 -19
- package/src/less/components/offcanvas.less +21 -21
- package/src/less/components/position.less +1 -1
- package/src/less/components/sticky.less +7 -0
- package/src/less/components/tooltip.less +1 -0
- package/src/less/components/utility.less +1 -2
- package/src/less/theme/dropdown.less +11 -0
- package/src/less/theme/navbar.less +10 -10
- package/src/scss/components/drop.scss +19 -4
- package/src/scss/components/dropdown.scss +21 -4
- package/src/scss/components/margin.scss +13 -14
- package/src/scss/components/modal.scss +19 -4
- package/src/scss/components/nav.scss +1 -1
- package/src/scss/components/navbar.scss +49 -8
- package/src/scss/components/offcanvas.scss +21 -21
- package/src/scss/components/position.scss +1 -1
- package/src/scss/components/sticky.scss +7 -0
- package/src/scss/components/tooltip.scss +1 -0
- package/src/scss/components/utility.scss +1 -2
- package/src/scss/mixins-theme.scss +8 -10
- package/src/scss/mixins.scss +2 -0
- package/src/scss/theme/dropdown.scss +8 -0
- package/src/scss/theme/navbar.scss +7 -0
- package/src/scss/variables-theme.scss +26 -11
- package/src/scss/variables.scss +24 -11
- package/tests/drop.html +165 -4
- package/tests/dropdown.html +234 -13
- package/tests/height-viewport.html +62 -0
- package/tests/navbar.html +333 -64
- package/tests/offcanvas.html +8 -8
- package/tests/sticky-navbar.html +132 -0
- package/tests/sticky-parallax.html +2 -1
- package/tests/sticky.html +5 -4
package/src/js/mixin/position.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
css,
|
|
3
|
+
dimensions,
|
|
3
4
|
flipPosition,
|
|
4
5
|
getCssVar,
|
|
5
|
-
offset as getOffset,
|
|
6
6
|
includes,
|
|
7
|
-
isNumeric,
|
|
8
7
|
isRtl,
|
|
9
8
|
positionAt,
|
|
10
9
|
toPx,
|
|
@@ -21,32 +20,21 @@ export default {
|
|
|
21
20
|
pos: `bottom-${isRtl ? 'right' : 'left'}`,
|
|
22
21
|
flip: true,
|
|
23
22
|
offset: false,
|
|
24
|
-
viewportPadding: 10,
|
|
25
23
|
},
|
|
26
24
|
|
|
27
25
|
connected() {
|
|
28
26
|
this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
|
|
29
|
-
this.
|
|
27
|
+
[this.dir, this.align] = this.pos;
|
|
28
|
+
this.axis = includes(['top', 'bottom'], this.dir) ? 'y' : 'x';
|
|
30
29
|
},
|
|
31
30
|
|
|
32
31
|
methods: {
|
|
33
32
|
positionAt(element, target, boundary) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let { offset } = this;
|
|
37
|
-
if (!isNumeric(offset)) {
|
|
38
|
-
const node = $(offset);
|
|
39
|
-
offset = node
|
|
40
|
-
? getOffset(node)[this.axis === 'x' ? 'left' : 'top'] -
|
|
41
|
-
getOffset(target)[this.axis === 'x' ? 'right' : 'bottom']
|
|
42
|
-
: 0;
|
|
43
|
-
}
|
|
44
|
-
offset = toPx(offset) + toPx(getCssVar('position-offset', element));
|
|
45
|
-
offset = [includes(['left', 'top'], dir) ? -offset : +offset, 0];
|
|
33
|
+
let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
|
|
46
34
|
|
|
47
35
|
const attach = {
|
|
48
|
-
element: [flipPosition(dir), align],
|
|
49
|
-
target: [dir, align],
|
|
36
|
+
element: [flipPosition(this.dir), this.align],
|
|
37
|
+
target: [this.dir, this.align],
|
|
50
38
|
};
|
|
51
39
|
|
|
52
40
|
if (this.axis === 'y') {
|
|
@@ -56,13 +44,41 @@ export default {
|
|
|
56
44
|
offset = offset.reverse();
|
|
57
45
|
}
|
|
58
46
|
|
|
47
|
+
// Ensure none positioned element does not generate scrollbars
|
|
48
|
+
const elDim = dimensions(element);
|
|
49
|
+
css(element, { top: -elDim.height, left: -elDim.width });
|
|
50
|
+
|
|
59
51
|
positionAt(element, target, {
|
|
60
52
|
attach,
|
|
61
53
|
offset,
|
|
62
54
|
boundary,
|
|
63
|
-
viewportPadding: this.boundaryAlign ? 0 : this.viewportPadding,
|
|
64
55
|
flip: this.flip,
|
|
56
|
+
viewportOffset: this.getViewportOffset(element),
|
|
65
57
|
});
|
|
66
58
|
},
|
|
59
|
+
|
|
60
|
+
getPositionOffset(element) {
|
|
61
|
+
return (
|
|
62
|
+
toPx(
|
|
63
|
+
this.offset === false ? getCssVar('position-offset', element) : this.offset,
|
|
64
|
+
this.axis === 'x' ? 'width' : 'height',
|
|
65
|
+
element
|
|
66
|
+
) * (includes(['left', 'top'], this.dir) ? -1 : 1)
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
getShiftOffset(element) {
|
|
71
|
+
return includes(['center', 'justify', 'stretch'], this.align)
|
|
72
|
+
? 0
|
|
73
|
+
: toPx(
|
|
74
|
+
getCssVar('position-shift-offset', element),
|
|
75
|
+
this.axis === 'y' ? 'width' : 'height',
|
|
76
|
+
element
|
|
77
|
+
) * (includes(['left', 'top'], this.align) ? 1 : -1);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
getViewportOffset(element) {
|
|
81
|
+
return toPx(getCssVar('position-viewport-offset', element));
|
|
82
|
+
},
|
|
67
83
|
},
|
|
68
84
|
};
|
|
@@ -5,13 +5,15 @@ import {
|
|
|
5
5
|
css,
|
|
6
6
|
fastdom,
|
|
7
7
|
hasClass,
|
|
8
|
-
height,
|
|
9
8
|
includes,
|
|
10
9
|
isBoolean,
|
|
11
10
|
isFunction,
|
|
12
11
|
isVisible,
|
|
13
12
|
noop,
|
|
13
|
+
offset,
|
|
14
14
|
removeClass,
|
|
15
|
+
scrollParents,
|
|
16
|
+
startsWith,
|
|
15
17
|
toFloat,
|
|
16
18
|
toggleClass,
|
|
17
19
|
toNodes,
|
|
@@ -41,7 +43,7 @@ export default {
|
|
|
41
43
|
|
|
42
44
|
initProps: {
|
|
43
45
|
overflow: '',
|
|
44
|
-
|
|
46
|
+
maxHeight: '',
|
|
45
47
|
paddingTop: '',
|
|
46
48
|
paddingBottom: '',
|
|
47
49
|
marginTop: '',
|
|
@@ -51,7 +53,7 @@ export default {
|
|
|
51
53
|
|
|
52
54
|
hideProps: {
|
|
53
55
|
overflow: 'hidden',
|
|
54
|
-
|
|
56
|
+
maxHeight: 0,
|
|
55
57
|
paddingTop: 0,
|
|
56
58
|
paddingBottom: 0,
|
|
57
59
|
marginTop: 0,
|
|
@@ -66,7 +68,7 @@ export default {
|
|
|
66
68
|
},
|
|
67
69
|
|
|
68
70
|
hasTransition({ animation }) {
|
|
69
|
-
return
|
|
71
|
+
return startsWith(animation[0], 'slide');
|
|
70
72
|
},
|
|
71
73
|
},
|
|
72
74
|
|
|
@@ -81,13 +83,18 @@ export default {
|
|
|
81
83
|
return Promise.reject();
|
|
82
84
|
}
|
|
83
85
|
|
|
86
|
+
if (!animate) {
|
|
87
|
+
Animation.cancel(el);
|
|
88
|
+
Transition.cancel(el);
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
const promise = (
|
|
85
92
|
isFunction(animate)
|
|
86
93
|
? animate
|
|
87
94
|
: animate === false || !this.hasAnimation
|
|
88
|
-
? this
|
|
95
|
+
? toggleInstant(this)
|
|
89
96
|
: this.hasTransition
|
|
90
|
-
?
|
|
97
|
+
? toggleTransition(this)
|
|
91
98
|
: toggleAnimation(this)
|
|
92
99
|
)(el, show);
|
|
93
100
|
|
|
@@ -151,7 +158,25 @@ export default {
|
|
|
151
158
|
},
|
|
152
159
|
};
|
|
153
160
|
|
|
154
|
-
|
|
161
|
+
function toggleInstant({ _toggle }) {
|
|
162
|
+
return (el, show) => {
|
|
163
|
+
Animation.cancel(el);
|
|
164
|
+
Transition.cancel(el);
|
|
165
|
+
return _toggle(el, show);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function toggleTransition(cmp) {
|
|
170
|
+
switch (cmp.animation[0]) {
|
|
171
|
+
case 'slide-left':
|
|
172
|
+
return slideHorizontal(cmp);
|
|
173
|
+
case 'slide-right':
|
|
174
|
+
return slideHorizontal(cmp, true);
|
|
175
|
+
}
|
|
176
|
+
return slide(cmp);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export function slide({
|
|
155
180
|
isToggled,
|
|
156
181
|
duration,
|
|
157
182
|
velocity,
|
|
@@ -162,11 +187,14 @@ export function toggleHeight({
|
|
|
162
187
|
}) {
|
|
163
188
|
return (el, show) => {
|
|
164
189
|
const inProgress = Transition.inProgress(el);
|
|
165
|
-
const inner =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
const inner =
|
|
191
|
+
!inProgress && el.hasChildNodes()
|
|
192
|
+
? toFloat(css(el.firstElementChild, 'marginTop')) +
|
|
193
|
+
toFloat(css(el.lastElementChild, 'marginBottom'))
|
|
194
|
+
: 0;
|
|
195
|
+
const currentHeight = isVisible(el) ? toFloat(css(el, 'height')) + inner : 0;
|
|
196
|
+
|
|
197
|
+
const props = inProgress ? css(el, Object.keys(initProps)) : show ? hideProps : initProps;
|
|
170
198
|
|
|
171
199
|
Transition.cancel(el);
|
|
172
200
|
|
|
@@ -174,34 +202,97 @@ export function toggleHeight({
|
|
|
174
202
|
_toggle(el, true);
|
|
175
203
|
}
|
|
176
204
|
|
|
177
|
-
|
|
205
|
+
css(el, 'maxHeight', '');
|
|
178
206
|
|
|
179
207
|
// Update child components first
|
|
180
208
|
fastdom.flush();
|
|
181
209
|
|
|
182
|
-
const endHeight =
|
|
183
|
-
duration = velocity *
|
|
210
|
+
const endHeight = toFloat(css(el, 'height')) + inner;
|
|
211
|
+
duration = velocity * endHeight + duration;
|
|
184
212
|
|
|
185
|
-
|
|
213
|
+
css(el, { ...props, maxHeight: currentHeight });
|
|
186
214
|
|
|
187
215
|
return (
|
|
188
216
|
show
|
|
189
217
|
? Transition.start(
|
|
190
218
|
el,
|
|
191
|
-
{ ...initProps, overflow: 'hidden',
|
|
192
|
-
|
|
219
|
+
{ ...initProps, overflow: 'hidden', maxHeight: endHeight },
|
|
220
|
+
duration * (1 - currentHeight / endHeight),
|
|
193
221
|
transition
|
|
194
222
|
)
|
|
195
223
|
: Transition.start(
|
|
196
224
|
el,
|
|
197
225
|
hideProps,
|
|
198
|
-
|
|
226
|
+
duration * (currentHeight / endHeight),
|
|
199
227
|
transition
|
|
200
228
|
).then(() => _toggle(el, false))
|
|
201
229
|
).then(() => css(el, initProps));
|
|
202
230
|
};
|
|
203
231
|
}
|
|
204
232
|
|
|
233
|
+
function slideHorizontal({ isToggled, duration, velocity, transition, _toggle }, right) {
|
|
234
|
+
return (el, show) => {
|
|
235
|
+
const visible = isVisible(el);
|
|
236
|
+
const marginLeft = toFloat(css(el, 'marginLeft'));
|
|
237
|
+
|
|
238
|
+
Transition.cancel(el);
|
|
239
|
+
|
|
240
|
+
const [scrollElement] = scrollParents(el);
|
|
241
|
+
css(scrollElement, 'overflowX', 'hidden');
|
|
242
|
+
|
|
243
|
+
if (!isToggled(el)) {
|
|
244
|
+
_toggle(el, true);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const width = toFloat(css(el, 'width'));
|
|
248
|
+
duration = velocity * width + duration;
|
|
249
|
+
|
|
250
|
+
const percent = visible ? ((width + marginLeft * (right ? -1 : 1)) / width) * 100 : 0;
|
|
251
|
+
const offsetEl = offset(el);
|
|
252
|
+
const useClipPath = right
|
|
253
|
+
? offsetEl.right < scrollElement.clientWidth
|
|
254
|
+
: Math.round(offsetEl.left) > 0;
|
|
255
|
+
|
|
256
|
+
css(el, {
|
|
257
|
+
clipPath: useClipPath
|
|
258
|
+
? right
|
|
259
|
+
? `polygon(0 0,${percent}% 0,${percent}% 100%,0 100%)`
|
|
260
|
+
: `polygon(${100 - percent}% 0,100% 0,100% 100%,${100 - percent}% 100%)`
|
|
261
|
+
: '',
|
|
262
|
+
marginLeft: (((100 - percent) * (right ? 1 : -1)) / 100) * width,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
show
|
|
267
|
+
? Transition.start(
|
|
268
|
+
el,
|
|
269
|
+
{
|
|
270
|
+
clipPath: useClipPath ? `polygon(0 0,100% 0,100% 100%,0 100%)` : '',
|
|
271
|
+
marginLeft: 0,
|
|
272
|
+
},
|
|
273
|
+
duration * (1 - percent / 100),
|
|
274
|
+
transition
|
|
275
|
+
)
|
|
276
|
+
: Transition.start(
|
|
277
|
+
el,
|
|
278
|
+
{
|
|
279
|
+
clipPath: useClipPath
|
|
280
|
+
? right
|
|
281
|
+
? `polygon(0 0,0 0,0 100%,0 100%)`
|
|
282
|
+
: `polygon(100% 0,100% 0,100% 100%,100% 100%)`
|
|
283
|
+
: '',
|
|
284
|
+
marginLeft: (right ? 1 : -1) * width,
|
|
285
|
+
},
|
|
286
|
+
duration * (percent / 100),
|
|
287
|
+
transition
|
|
288
|
+
).then(() => _toggle(el, false))
|
|
289
|
+
).then(() => {
|
|
290
|
+
css(scrollElement, 'overflowX', '');
|
|
291
|
+
css(el, { clipPath: '', marginLeft: '' });
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
205
296
|
function toggleAnimation(cmp) {
|
|
206
297
|
return (el, show) => {
|
|
207
298
|
Animation.cancel(el);
|
package/src/js/util/animation.js
CHANGED
|
@@ -5,6 +5,7 @@ import { startsWith, toNodes } from './lang';
|
|
|
5
5
|
import { addClass, hasClass, removeClass, removeClasses } from './class';
|
|
6
6
|
|
|
7
7
|
export function transition(element, props, duration = 400, timing = 'linear') {
|
|
8
|
+
duration = Math.round(duration);
|
|
8
9
|
return Promise.all(
|
|
9
10
|
toNodes(element).map(
|
|
10
11
|
(element) =>
|
package/src/js/util/dom.js
CHANGED
|
@@ -17,14 +17,15 @@ export function isTag(element, tagName) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function empty(element) {
|
|
20
|
-
|
|
20
|
+
element = $(element);
|
|
21
|
+
element.innerHTML = '';
|
|
22
|
+
return element;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export function html(parent, html) {
|
|
24
|
-
return isUndefined(html) ? $(parent).innerHTML :
|
|
26
|
+
return isUndefined(html) ? $(parent).innerHTML : append(empty(parent), html);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
export const replaceChildren = applyFn('replaceChildren');
|
|
28
29
|
export const prepend = applyFn('prepend');
|
|
29
30
|
export const append = applyFn('append');
|
|
30
31
|
export const before = applyFn('before');
|
package/src/js/util/position.js
CHANGED
|
@@ -49,6 +49,10 @@ function attachTo(element, target, options) {
|
|
|
49
49
|
return position;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function moveBy(start, end, dim) {
|
|
53
|
+
return start === 'center' ? dim / 2 : start === end ? dim : 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
function attachToWithFlip(element, target, options) {
|
|
53
57
|
const position = attachTo(element, target, options);
|
|
54
58
|
const targetDim = offset(target);
|
|
@@ -59,7 +63,7 @@ function attachToWithFlip(element, target, options) {
|
|
|
59
63
|
offset: elOffset,
|
|
60
64
|
boundary,
|
|
61
65
|
viewport,
|
|
62
|
-
|
|
66
|
+
viewportOffset,
|
|
63
67
|
} = options;
|
|
64
68
|
|
|
65
69
|
let viewports = scrollParents(element);
|
|
@@ -80,9 +84,9 @@ function attachToWithFlip(element, target, options) {
|
|
|
80
84
|
|
|
81
85
|
viewport = getIntersectionArea(...viewports.filter(Boolean).map(offsetViewport));
|
|
82
86
|
|
|
83
|
-
if (
|
|
84
|
-
viewport[start] +=
|
|
85
|
-
viewport[end] -=
|
|
87
|
+
if (viewportOffset) {
|
|
88
|
+
viewport[start] += viewportOffset;
|
|
89
|
+
viewport[end] -= viewportOffset;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
if (boundary && !willFlip && position[prop] <= offset(boundary)[prop]) {
|
|
@@ -139,19 +143,21 @@ function attachToWithFlip(element, target, options) {
|
|
|
139
143
|
return false;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
if (flip === true || includes(flip, dirs[1 - i][1])) {
|
|
147
|
+
const newPos = attachToWithFlip(element, target, {
|
|
148
|
+
...options,
|
|
149
|
+
attach: {
|
|
150
|
+
element: elAttach.map(flipDir).reverse(),
|
|
151
|
+
target: targetAttach.map(flipDir).reverse(),
|
|
152
|
+
},
|
|
153
|
+
offset: elOffset.reverse(),
|
|
154
|
+
flip: flip === true ? flip : [...flip, dirs[1 - i][1]],
|
|
155
|
+
recursion: true,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
if (newPos && isInScrollArea(newPos, scrollElement, 1 - i)) {
|
|
159
|
+
return newPos;
|
|
160
|
+
}
|
|
155
161
|
}
|
|
156
162
|
}
|
|
157
163
|
|
|
@@ -172,10 +178,6 @@ function attachToWithFlip(element, target, options) {
|
|
|
172
178
|
return offsetPosition;
|
|
173
179
|
}
|
|
174
180
|
|
|
175
|
-
function moveBy(start, end, dim) {
|
|
176
|
-
return start === 'center' ? dim / 2 : start === end ? dim : 0;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
181
|
function getIntersectionArea(...rects) {
|
|
180
182
|
let area = {};
|
|
181
183
|
for (const rect of rects) {
|
|
@@ -188,7 +190,7 @@ function getIntersectionArea(...rects) {
|
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
function isInScrollArea(position, scrollElement, dir) {
|
|
191
|
-
const viewport = offsetViewport(scrollElement);
|
|
193
|
+
const viewport = offsetViewport(scrollElement, false);
|
|
192
194
|
const [prop, , start, end] = dirs[dir];
|
|
193
195
|
viewport[start] -= scrollElement[`scroll${ucfirst(start)}`];
|
|
194
196
|
viewport[end] = viewport[start] + scrollElement[`scroll${ucfirst(prop)}`];
|
package/src/js/util/viewport.js
CHANGED
|
@@ -128,7 +128,7 @@ export function scrolledOver(element, startOffset = 0, endOffset = 0) {
|
|
|
128
128
|
return clamp((scrollTop - start) / (end - start));
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export function scrollParents(element, overflowRe = /auto|scroll|hidden/, scrollable = false) {
|
|
131
|
+
export function scrollParents(element, overflowRe = /auto|scroll|hidden|clip/, scrollable = false) {
|
|
132
132
|
const scrollEl = scrollingElement(element);
|
|
133
133
|
|
|
134
134
|
let ancestors = parents(element).reverse();
|
|
@@ -158,21 +158,20 @@ export function offsetViewport(scrollElement) {
|
|
|
158
158
|
['width', 'x', 'left', 'right'],
|
|
159
159
|
['height', 'y', 'top', 'bottom'],
|
|
160
160
|
]) {
|
|
161
|
-
if (!isWindow(
|
|
161
|
+
if (!isWindow(viewportElement)) {
|
|
162
162
|
rect[start] += toFloat(css(viewportElement, `border${ucfirst(start)}Width`));
|
|
163
|
+
} else {
|
|
164
|
+
// iOS 12 returns <body> as scrollingElement
|
|
165
|
+
viewportElement = viewportElement.document.documentElement;
|
|
163
166
|
}
|
|
164
|
-
rect[prop] = rect[dir] =
|
|
165
|
-
viewportElement[(isWindow(viewportElement) ? 'inner' : 'client') + ucfirst(prop)];
|
|
167
|
+
rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
|
|
166
168
|
rect[end] = rect[prop] + rect[start];
|
|
167
169
|
}
|
|
168
170
|
return rect;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
function scrollingElement(element) {
|
|
172
|
-
|
|
173
|
-
document: { scrollingElement },
|
|
174
|
-
} = toWindow(element);
|
|
175
|
-
return scrollingElement;
|
|
174
|
+
return toWindow(element).document.scrollingElement;
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
function getViewport(scrollElement) {
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
// Component: `uk-drop`
|
|
5
5
|
//
|
|
6
|
-
// Modifiers: `uk-drop-
|
|
7
|
-
// `uk-drop-bottom-*`
|
|
8
|
-
// `uk-drop-left-*`
|
|
9
|
-
// `uk-drop-right-*`
|
|
6
|
+
// Modifiers: `uk-drop-stretch`
|
|
10
7
|
// `uk-drop-stack`
|
|
11
8
|
// `uk-drop-grid`
|
|
12
9
|
//
|
|
@@ -22,6 +19,7 @@
|
|
|
22
19
|
|
|
23
20
|
@drop-z-index: @global-z-index + 20;
|
|
24
21
|
@drop-margin: @global-margin;
|
|
22
|
+
@drop-viewport-margin: 15px;
|
|
25
23
|
@drop-width: 300px;
|
|
26
24
|
|
|
27
25
|
|
|
@@ -42,6 +40,7 @@
|
|
|
42
40
|
position: absolute;
|
|
43
41
|
z-index: @drop-z-index;
|
|
44
42
|
--uk-position-offset: @drop-margin;
|
|
43
|
+
--uk-position-viewport-offset: @drop-viewport-margin;
|
|
45
44
|
/* 3 */
|
|
46
45
|
box-sizing: border-box;
|
|
47
46
|
width: @drop-width;
|
|
@@ -51,6 +50,22 @@
|
|
|
51
50
|
.uk-drop.uk-open { display: block; }
|
|
52
51
|
|
|
53
52
|
|
|
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
|
+
|
|
54
69
|
/* Grid modifiers
|
|
55
70
|
========================================================================== */
|
|
56
71
|
|
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Adopted: `uk-dropdown-nav`
|
|
7
7
|
//
|
|
8
|
-
// Modifiers: `uk-dropdown-
|
|
9
|
-
// `uk-dropdown-bottom-*`
|
|
10
|
-
// `uk-dropdown-left-*`
|
|
11
|
-
// `uk-dropdown-right-*`
|
|
8
|
+
// Modifiers: `uk-dropdown-stretch`
|
|
12
9
|
// `uk-dropdown-stack`
|
|
13
10
|
// `uk-dropdown-grid`
|
|
14
11
|
//
|
|
@@ -22,6 +19,7 @@
|
|
|
22
19
|
|
|
23
20
|
@dropdown-z-index: @global-z-index + 20;
|
|
24
21
|
@dropdown-margin: @global-small-margin;
|
|
22
|
+
@dropdown-viewport-margin: 15px;
|
|
25
23
|
@dropdown-min-width: 200px;
|
|
26
24
|
@dropdown-padding: 15px;
|
|
27
25
|
@dropdown-background: @global-muted-background;
|
|
@@ -55,6 +53,7 @@
|
|
|
55
53
|
position: absolute;
|
|
56
54
|
z-index: @dropdown-z-index;
|
|
57
55
|
--uk-position-offset: @dropdown-margin;
|
|
56
|
+
--uk-position-viewport-offset: @dropdown-viewport-margin;
|
|
58
57
|
/* 3 */
|
|
59
58
|
box-sizing: border-box;
|
|
60
59
|
min-width: @dropdown-min-width;
|
|
@@ -70,6 +69,23 @@
|
|
|
70
69
|
.uk-dropdown.uk-open { display: block; }
|
|
71
70
|
|
|
72
71
|
|
|
72
|
+
/* Stretch modifier
|
|
73
|
+
========================================================================== */
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* 1. Allow scrolling
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
.uk-dropdown-stretch {
|
|
80
|
+
--uk-position-offset: 0;
|
|
81
|
+
--uk-position-viewport-offset: 0;
|
|
82
|
+
/* 1 */
|
|
83
|
+
overflow-y: auto;
|
|
84
|
+
-webkit-overflow-scrolling: touch;
|
|
85
|
+
.hook-dropdown-stretch();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
73
89
|
/* Nav
|
|
74
90
|
* Adopts `uk-nav`
|
|
75
91
|
========================================================================== */
|
|
@@ -144,6 +160,7 @@
|
|
|
144
160
|
.hook-dropdown-misc();
|
|
145
161
|
|
|
146
162
|
.hook-dropdown() {}
|
|
163
|
+
.hook-dropdown-stretch() {}
|
|
147
164
|
.hook-dropdown-nav() {}
|
|
148
165
|
.hook-dropdown-nav-item() {}
|
|
149
166
|
.hook-dropdown-nav-item-hover() {}
|
|
@@ -193,20 +193,20 @@
|
|
|
193
193
|
/* Remove
|
|
194
194
|
========================================================================== */
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
.uk-margin-remove { margin: 0 !important; }
|
|
197
|
+
.uk-margin-remove-top { margin-top: 0 !important; }
|
|
198
|
+
.uk-margin-remove-bottom { margin-bottom: 0 !important; }
|
|
199
|
+
.uk-margin-remove-left { margin-left: 0 !important; }
|
|
200
|
+
.uk-margin-remove-right { margin-right: 0 !important; }
|
|
201
|
+
|
|
202
|
+
.uk-margin-remove-vertical {
|
|
203
|
+
margin-top: 0 !important;
|
|
204
|
+
margin-bottom: 0 !important;
|
|
205
|
+
}
|
|
206
206
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
.uk-margin-remove-adjacent + *,
|
|
208
|
+
.uk-margin-remove-first-child > :first-child { margin-top: 0 !important; }
|
|
209
|
+
.uk-margin-remove-last-child > :last-child { margin-bottom: 0 !important; }
|
|
210
210
|
|
|
211
211
|
/* Phone landscape and bigger */
|
|
212
212
|
@media (min-width: @breakpoint-small) {
|
|
@@ -241,7 +241,6 @@
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
|
|
245
244
|
// Hooks
|
|
246
245
|
// ========================================================================
|
|
247
246
|
|
|
@@ -40,15 +40,21 @@
|
|
|
40
40
|
|
|
41
41
|
@modal-container-width: 1200px;
|
|
42
42
|
|
|
43
|
-
@modal-body-padding-horizontal:
|
|
44
|
-
@modal-body-padding-vertical:
|
|
43
|
+
@modal-body-padding-horizontal: 20px;
|
|
44
|
+
@modal-body-padding-vertical: 20px;
|
|
45
|
+
@modal-body-padding-horizontal-s: @global-gutter;
|
|
46
|
+
@modal-body-padding-vertical-s: @global-gutter;
|
|
45
47
|
|
|
46
|
-
@modal-header-padding-horizontal:
|
|
48
|
+
@modal-header-padding-horizontal: 20px;
|
|
47
49
|
@modal-header-padding-vertical: (@modal-header-padding-horizontal / 2);
|
|
50
|
+
@modal-header-padding-horizontal-s: @global-gutter;
|
|
51
|
+
@modal-header-padding-vertical-s: (@modal-header-padding-horizontal-s / 2);
|
|
48
52
|
@modal-header-background: @global-muted-background;
|
|
49
53
|
|
|
50
|
-
@modal-footer-padding-horizontal:
|
|
54
|
+
@modal-footer-padding-horizontal: 20px;
|
|
51
55
|
@modal-footer-padding-vertical: (@modal-footer-padding-horizontal / 2);
|
|
56
|
+
@modal-footer-padding-horizontal-s: @global-gutter;
|
|
57
|
+
@modal-footer-padding-vertical-s: (@modal-footer-padding-horizontal-s / 2);
|
|
52
58
|
@modal-footer-background: @global-muted-background;
|
|
53
59
|
|
|
54
60
|
@modal-title-font-size: @global-xlarge-font-size;
|
|
@@ -228,6 +234,15 @@
|
|
|
228
234
|
.hook-modal-footer();
|
|
229
235
|
}
|
|
230
236
|
|
|
237
|
+
/* Phone landscape and bigger */
|
|
238
|
+
@media (min-width: @breakpoint-small) {
|
|
239
|
+
|
|
240
|
+
.uk-modal-body { padding: @modal-body-padding-vertical-s @modal-body-padding-horizontal-s; }
|
|
241
|
+
.uk-modal-header { padding: @modal-header-padding-vertical-s @modal-header-padding-horizontal-s; }
|
|
242
|
+
.uk-modal-footer { padding: @modal-footer-padding-vertical-s @modal-footer-padding-horizontal-s; }
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
231
246
|
/*
|
|
232
247
|
* Remove margin from the last-child
|
|
233
248
|
*/
|