uikit 3.11.2-dev.9433cd5fd → 3.11.2-dev.946d2efea
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/.eslintrc.json +4 -49
- package/.prettierignore +14 -0
- package/.prettierrc.json +13 -0
- package/.webstorm.js +3 -3
- package/CHANGELOG.md +46 -29
- package/build/.eslintrc.json +1 -3
- package/build/build.js +26 -28
- package/build/icons.js +7 -11
- package/build/less.js +48 -36
- package/build/package.json +2 -2
- package/build/prefix.js +21 -18
- package/build/publishDev.js +6 -8
- package/build/release.js +20 -17
- package/build/scope.js +21 -11
- package/build/scss.js +72 -39
- package/build/util.js +71 -62
- package/build/wrapper/icons.js +0 -2
- package/dist/css/uikit-core-rtl.css +133 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +133 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +135 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +135 -207
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1091 -1319
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1137 -1396
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +94 -114
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +347 -361
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +345 -360
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +749 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +345 -360
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +628 -798
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +156 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5323 -6536
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +7 -9
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +8181 -9810
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +199 -187
- package/src/js/components/countdown.js +26 -52
- package/src/js/components/filter.js +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-preload.js +9 -0
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +16 -30
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +117 -89
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +53 -63
- package/src/js/core/accordion.js +58 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +17 -69
- package/src/js/core/cover.js +15 -15
- package/src/js/core/drop.js +109 -93
- package/src/js/core/form-custom.js +22 -27
- package/src/js/core/gif.js +3 -7
- package/src/js/core/grid.js +57 -58
- package/src/js/core/height-match.js +16 -29
- package/src/js/core/height-viewport.js +30 -34
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +96 -83
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +49 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +51 -54
- package/src/js/core/overflow-auto.js +13 -17
- package/src/js/core/responsive.js +14 -12
- package/src/js/core/scroll.js +10 -20
- package/src/js/core/scrollspy-nav.js +34 -31
- package/src/js/core/scrollspy.js +37 -54
- package/src/js/core/sticky.js +161 -128
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +56 -47
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +69 -68
- package/src/js/core/video.js +22 -21
- package/src/js/mixin/animate.js +19 -20
- package/src/js/mixin/class.js +2 -4
- package/src/js/mixin/container.js +7 -11
- package/src/js/mixin/internal/animate-fade.js +73 -30
- package/src/js/mixin/internal/animate-slide.js +58 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/lazyload.js +20 -0
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -107
- package/src/js/mixin/position.js +26 -20
- package/src/js/mixin/slider-autoplay.js +12 -21
- package/src/js/mixin/slider-drag.js +64 -65
- package/src/js/mixin/slider-nav.js +26 -35
- package/src/js/mixin/slider-reactive.js +2 -8
- package/src/js/mixin/slider.js +47 -60
- package/src/js/mixin/slideshow.js +12 -22
- package/src/js/mixin/swipe.js +72 -0
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +25 -40
- package/src/js/util/animation.js +77 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +58 -45
- package/src/js/util/dom.js +39 -66
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +1 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/observer.js +36 -0
- package/src/js/util/options.js +32 -46
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +25 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +25 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -48
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/js/index.js +114 -85
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +16 -7
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +56 -71
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +50 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
- package/tests/images/animated.gif +0 -0
- package/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
package/src/js/core/modal.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import Modal from '../mixin/modal';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$,
|
|
4
|
+
addClass,
|
|
5
|
+
css,
|
|
6
|
+
Deferred,
|
|
7
|
+
hasClass,
|
|
8
|
+
height,
|
|
9
|
+
html,
|
|
10
|
+
isString,
|
|
11
|
+
on,
|
|
12
|
+
removeClass,
|
|
13
|
+
} from 'uikit-util';
|
|
3
14
|
|
|
4
15
|
export default {
|
|
5
|
-
|
|
6
16
|
install,
|
|
7
17
|
|
|
8
18
|
mixins: [Modal],
|
|
@@ -10,18 +20,17 @@ export default {
|
|
|
10
20
|
data: {
|
|
11
21
|
clsPage: 'uk-modal-page',
|
|
12
22
|
selPanel: '.uk-modal-dialog',
|
|
13
|
-
selClose:
|
|
23
|
+
selClose:
|
|
24
|
+
'.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full',
|
|
14
25
|
},
|
|
15
26
|
|
|
16
27
|
events: [
|
|
17
|
-
|
|
18
28
|
{
|
|
19
29
|
name: 'show',
|
|
20
30
|
|
|
21
31
|
self: true,
|
|
22
32
|
|
|
23
33
|
handler() {
|
|
24
|
-
|
|
25
34
|
if (hasClass(this.panel, 'uk-margin-auto-vertical')) {
|
|
26
35
|
addClass(this.$el, 'uk-flex');
|
|
27
36
|
} else {
|
|
@@ -29,7 +38,7 @@ export default {
|
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
height(this.$el); // force reflow
|
|
32
|
-
}
|
|
41
|
+
},
|
|
33
42
|
},
|
|
34
43
|
|
|
35
44
|
{
|
|
@@ -38,21 +47,15 @@ export default {
|
|
|
38
47
|
self: true,
|
|
39
48
|
|
|
40
49
|
handler() {
|
|
41
|
-
|
|
42
50
|
css(this.$el, 'display', '');
|
|
43
51
|
removeClass(this.$el, 'uk-flex');
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
]
|
|
49
|
-
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
],
|
|
50
55
|
};
|
|
51
56
|
|
|
52
|
-
function install({modal}) {
|
|
53
|
-
|
|
57
|
+
function install({ modal }) {
|
|
54
58
|
modal.dialog = function (content, options) {
|
|
55
|
-
|
|
56
59
|
const dialog = modal(
|
|
57
60
|
`<div class="uk-modal">
|
|
58
61
|
<div class="uk-modal-dialog">${content}</div>
|
|
@@ -62,10 +65,14 @@ function install({modal}) {
|
|
|
62
65
|
|
|
63
66
|
dialog.show();
|
|
64
67
|
|
|
65
|
-
on(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)
|
|
68
|
+
on(
|
|
69
|
+
dialog.$el,
|
|
70
|
+
'hidden',
|
|
71
|
+
async () => {
|
|
72
|
+
await Promise.resolve();
|
|
73
|
+
dialog.$destroy(true);
|
|
74
|
+
},
|
|
75
|
+
{ self: true }
|
|
69
76
|
);
|
|
70
77
|
|
|
71
78
|
return dialog;
|
|
@@ -73,64 +80,71 @@ function install({modal}) {
|
|
|
73
80
|
|
|
74
81
|
modal.alert = function (message, options) {
|
|
75
82
|
return openDialog(
|
|
76
|
-
({labels}) => `<div class="uk-modal-body">${
|
|
83
|
+
({ labels }) => `<div class="uk-modal-body">${
|
|
84
|
+
isString(message) ? message : html(message)
|
|
85
|
+
}</div>
|
|
77
86
|
<div class="uk-modal-footer uk-text-right">
|
|
78
|
-
<button class="uk-button uk-button-primary uk-modal-close" autofocus>${
|
|
87
|
+
<button class="uk-button uk-button-primary uk-modal-close" autofocus>${
|
|
88
|
+
labels.ok
|
|
89
|
+
}</button>
|
|
79
90
|
</div>`,
|
|
80
91
|
options,
|
|
81
|
-
deferred => deferred.resolve()
|
|
92
|
+
(deferred) => deferred.resolve()
|
|
82
93
|
);
|
|
83
94
|
};
|
|
84
95
|
|
|
85
96
|
modal.confirm = function (message, options) {
|
|
86
97
|
return openDialog(
|
|
87
|
-
({labels}) => `<form>
|
|
98
|
+
({ labels }) => `<form>
|
|
88
99
|
<div class="uk-modal-body">${isString(message) ? message : html(message)}</div>
|
|
89
100
|
<div class="uk-modal-footer uk-text-right">
|
|
90
|
-
<button class="uk-button uk-button-default uk-modal-close" type="button">${
|
|
101
|
+
<button class="uk-button uk-button-default uk-modal-close" type="button">${
|
|
102
|
+
labels.cancel
|
|
103
|
+
}</button>
|
|
91
104
|
<button class="uk-button uk-button-primary" autofocus>${labels.ok}</button>
|
|
92
105
|
</div>
|
|
93
106
|
</form>`,
|
|
94
107
|
options,
|
|
95
|
-
deferred => deferred.reject()
|
|
108
|
+
(deferred) => deferred.reject()
|
|
96
109
|
);
|
|
97
110
|
};
|
|
98
111
|
|
|
99
112
|
modal.prompt = function (message, value, options) {
|
|
100
113
|
return openDialog(
|
|
101
|
-
({labels}) => `<form class="uk-form-stacked">
|
|
114
|
+
({ labels }) => `<form class="uk-form-stacked">
|
|
102
115
|
<div class="uk-modal-body">
|
|
103
116
|
<label>${isString(message) ? message : html(message)}</label>
|
|
104
117
|
<input class="uk-input" value="${value || ''}" autofocus>
|
|
105
118
|
</div>
|
|
106
119
|
<div class="uk-modal-footer uk-text-right">
|
|
107
|
-
<button class="uk-button uk-button-default uk-modal-close" type="button">${
|
|
120
|
+
<button class="uk-button uk-button-default uk-modal-close" type="button">${
|
|
121
|
+
labels.cancel
|
|
122
|
+
}</button>
|
|
108
123
|
<button class="uk-button uk-button-primary">${labels.ok}</button>
|
|
109
124
|
</div>
|
|
110
125
|
</form>`,
|
|
111
126
|
options,
|
|
112
|
-
deferred => deferred.resolve(null),
|
|
113
|
-
dialog => $('input', dialog.$el).value
|
|
127
|
+
(deferred) => deferred.resolve(null),
|
|
128
|
+
(dialog) => $('input', dialog.$el).value
|
|
114
129
|
);
|
|
115
130
|
};
|
|
116
131
|
|
|
117
132
|
modal.labels = {
|
|
118
133
|
ok: 'Ok',
|
|
119
|
-
cancel: 'Cancel'
|
|
134
|
+
cancel: 'Cancel',
|
|
120
135
|
};
|
|
121
136
|
|
|
122
137
|
function openDialog(tmpl, options, hideFn, submitFn) {
|
|
123
|
-
|
|
124
|
-
options = assign({bgClose: false, escClose: true, labels: modal.labels}, options);
|
|
138
|
+
options = { bgClose: false, escClose: true, labels: modal.labels, ...options };
|
|
125
139
|
|
|
126
140
|
const dialog = modal.dialog(tmpl(options), options);
|
|
127
141
|
const deferred = new Deferred();
|
|
128
142
|
|
|
129
143
|
let resolved = false;
|
|
130
144
|
|
|
131
|
-
on(dialog.$el, 'submit', 'form', e => {
|
|
145
|
+
on(dialog.$el, 'submit', 'form', (e) => {
|
|
132
146
|
e.preventDefault();
|
|
133
|
-
deferred.resolve(submitFn
|
|
147
|
+
deferred.resolve(submitFn?.(dialog));
|
|
134
148
|
resolved = true;
|
|
135
149
|
dialog.hide();
|
|
136
150
|
});
|
|
@@ -141,5 +155,4 @@ function install({modal}) {
|
|
|
141
155
|
|
|
142
156
|
return deferred.promise;
|
|
143
157
|
}
|
|
144
|
-
|
|
145
158
|
}
|
package/src/js/core/nav.js
CHANGED
package/src/js/core/navbar.js
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
import {active} from './drop';
|
|
1
|
+
import { active } from './drop';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
|
-
import FlexBug from '../mixin/flex-bug';
|
|
4
3
|
import Container from '../mixin/container';
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
$,
|
|
6
|
+
$$,
|
|
7
|
+
addClass,
|
|
8
|
+
after,
|
|
9
|
+
css,
|
|
10
|
+
findIndex,
|
|
11
|
+
hasAttr,
|
|
12
|
+
hasClass,
|
|
13
|
+
height,
|
|
14
|
+
includes,
|
|
15
|
+
isRtl,
|
|
16
|
+
isVisible,
|
|
17
|
+
matches,
|
|
18
|
+
noop,
|
|
19
|
+
once,
|
|
20
|
+
parent,
|
|
21
|
+
query,
|
|
22
|
+
remove,
|
|
23
|
+
selFocusable,
|
|
24
|
+
toFloat,
|
|
25
|
+
Transition,
|
|
26
|
+
within,
|
|
27
|
+
} from 'uikit-util';
|
|
6
28
|
|
|
7
29
|
const navItem = '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle';
|
|
8
30
|
|
|
9
31
|
export default {
|
|
10
|
-
|
|
11
|
-
mixins: [Class, Container, FlexBug],
|
|
32
|
+
mixins: [Class, Container],
|
|
12
33
|
|
|
13
34
|
props: {
|
|
14
35
|
dropdown: String,
|
|
@@ -23,7 +44,7 @@ export default {
|
|
|
23
44
|
dropbar: Boolean,
|
|
24
45
|
dropbarMode: String,
|
|
25
46
|
dropbarAnchor: Boolean,
|
|
26
|
-
duration: Number
|
|
47
|
+
duration: Number,
|
|
27
48
|
},
|
|
28
49
|
|
|
29
50
|
data: {
|
|
@@ -43,43 +64,41 @@ export default {
|
|
|
43
64
|
duration: 200,
|
|
44
65
|
forceHeight: true,
|
|
45
66
|
selMinHeight: navItem,
|
|
46
|
-
container: false
|
|
67
|
+
container: false,
|
|
47
68
|
},
|
|
48
69
|
|
|
49
70
|
computed: {
|
|
50
|
-
|
|
51
|
-
boundary({boundary, boundaryAlign}, $el) {
|
|
71
|
+
boundary({ boundary, boundaryAlign }, $el) {
|
|
52
72
|
return boundary === true || boundaryAlign ? $el : boundary;
|
|
53
73
|
},
|
|
54
74
|
|
|
55
|
-
dropbarAnchor({dropbarAnchor}, $el) {
|
|
75
|
+
dropbarAnchor({ dropbarAnchor }, $el) {
|
|
56
76
|
return query(dropbarAnchor, $el);
|
|
57
77
|
},
|
|
58
78
|
|
|
59
|
-
pos({align}) {
|
|
79
|
+
pos({ align }) {
|
|
60
80
|
return `bottom-${align}`;
|
|
61
81
|
},
|
|
62
82
|
|
|
63
83
|
dropbar: {
|
|
64
|
-
|
|
65
|
-
get({dropbar}) {
|
|
66
|
-
|
|
84
|
+
get({ dropbar }) {
|
|
67
85
|
if (!dropbar) {
|
|
68
86
|
return null;
|
|
69
87
|
}
|
|
70
88
|
|
|
71
|
-
dropbar =
|
|
89
|
+
dropbar =
|
|
90
|
+
this._dropbar ||
|
|
91
|
+
query(dropbar, this.$el) ||
|
|
92
|
+
$('+ .uk-navbar-dropbar', this.$el);
|
|
72
93
|
|
|
73
94
|
return dropbar ? dropbar : (this._dropbar = $('<div></div>'));
|
|
74
|
-
|
|
75
95
|
},
|
|
76
96
|
|
|
77
97
|
watch(dropbar) {
|
|
78
98
|
addClass(dropbar, 'uk-navbar-dropbar');
|
|
79
99
|
},
|
|
80
100
|
|
|
81
|
-
immediate: true
|
|
82
|
-
|
|
101
|
+
immediate: true,
|
|
83
102
|
},
|
|
84
103
|
|
|
85
104
|
dropContainer(_, $el) {
|
|
@@ -87,17 +106,16 @@ export default {
|
|
|
87
106
|
},
|
|
88
107
|
|
|
89
108
|
dropdowns: {
|
|
90
|
-
|
|
91
|
-
get({clsDrop}, $el) {
|
|
109
|
+
get({ clsDrop }, $el) {
|
|
92
110
|
const dropdowns = $$(`.${clsDrop}`, $el);
|
|
93
111
|
|
|
94
112
|
if (this.dropContainer !== $el) {
|
|
95
|
-
$$(`.${clsDrop}`, this.dropContainer)
|
|
96
|
-
const
|
|
97
|
-
if (!includes(dropdowns, el) &&
|
|
113
|
+
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
|
|
114
|
+
const target = this.getDropdown(el)?.target;
|
|
115
|
+
if (!includes(dropdowns, el) && target && within(target, this.$el)) {
|
|
98
116
|
dropdowns.push(el);
|
|
99
117
|
}
|
|
100
|
-
}
|
|
118
|
+
}
|
|
101
119
|
}
|
|
102
120
|
|
|
103
121
|
return dropdowns;
|
|
@@ -106,19 +124,22 @@ export default {
|
|
|
106
124
|
watch(dropdowns) {
|
|
107
125
|
this.$create(
|
|
108
126
|
'drop',
|
|
109
|
-
dropdowns.filter(el => !this.getDropdown(el)),
|
|
110
|
-
|
|
127
|
+
dropdowns.filter((el) => !this.getDropdown(el)),
|
|
128
|
+
{
|
|
129
|
+
...this.$props,
|
|
130
|
+
boundary: this.boundary,
|
|
131
|
+
pos: this.pos,
|
|
132
|
+
offset: this.dropbar || this.offset,
|
|
133
|
+
}
|
|
111
134
|
);
|
|
112
135
|
},
|
|
113
136
|
|
|
114
|
-
immediate: true
|
|
115
|
-
|
|
137
|
+
immediate: true,
|
|
116
138
|
},
|
|
117
139
|
|
|
118
|
-
toggles({dropdown}, $el) {
|
|
140
|
+
toggles({ dropdown }, $el) {
|
|
119
141
|
return $$(dropdown, $el);
|
|
120
|
-
}
|
|
121
|
-
|
|
142
|
+
},
|
|
122
143
|
},
|
|
123
144
|
|
|
124
145
|
disconnected() {
|
|
@@ -127,7 +148,6 @@ export default {
|
|
|
127
148
|
},
|
|
128
149
|
|
|
129
150
|
events: [
|
|
130
|
-
|
|
131
151
|
{
|
|
132
152
|
name: 'mouseover focusin',
|
|
133
153
|
|
|
@@ -135,13 +155,18 @@ export default {
|
|
|
135
155
|
return this.dropdown;
|
|
136
156
|
},
|
|
137
157
|
|
|
138
|
-
handler({current}) {
|
|
158
|
+
handler({ current }) {
|
|
139
159
|
const active = this.getActive();
|
|
140
|
-
if (
|
|
160
|
+
if (
|
|
161
|
+
active &&
|
|
162
|
+
includes(active.mode, 'hover') &&
|
|
163
|
+
active.target &&
|
|
164
|
+
!within(active.target, current) &&
|
|
165
|
+
!active.isDelaying
|
|
166
|
+
) {
|
|
141
167
|
active.hide(false);
|
|
142
168
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
169
|
+
},
|
|
145
170
|
},
|
|
146
171
|
|
|
147
172
|
{
|
|
@@ -152,25 +177,24 @@ export default {
|
|
|
152
177
|
},
|
|
153
178
|
|
|
154
179
|
handler(e) {
|
|
155
|
-
|
|
156
|
-
const {current, keyCode} = e;
|
|
180
|
+
const { current, keyCode } = e;
|
|
157
181
|
const active = this.getActive();
|
|
158
182
|
|
|
159
183
|
if (keyCode === keyMap.DOWN && hasAttr(current, 'aria-expanded')) {
|
|
160
|
-
|
|
161
184
|
e.preventDefault();
|
|
162
185
|
|
|
163
186
|
if (!active || active.target !== current) {
|
|
164
187
|
current.click();
|
|
165
|
-
once(this.dropContainer, 'show', ({target}) =>
|
|
188
|
+
once(this.dropContainer, 'show', ({ target }) =>
|
|
189
|
+
focusFirstFocusableElement(target)
|
|
190
|
+
);
|
|
166
191
|
} else {
|
|
167
192
|
focusFirstFocusableElement(active.$el);
|
|
168
193
|
}
|
|
169
|
-
|
|
170
194
|
}
|
|
171
195
|
|
|
172
196
|
handleNavItemNavigation(e, this.toggles, active);
|
|
173
|
-
}
|
|
197
|
+
},
|
|
174
198
|
},
|
|
175
199
|
|
|
176
200
|
{
|
|
@@ -185,8 +209,7 @@ export default {
|
|
|
185
209
|
},
|
|
186
210
|
|
|
187
211
|
handler(e) {
|
|
188
|
-
|
|
189
|
-
const {current, keyCode} = e;
|
|
212
|
+
const { current, keyCode } = e;
|
|
190
213
|
|
|
191
214
|
if (!includes(this.dropdowns, current)) {
|
|
192
215
|
return;
|
|
@@ -194,7 +217,7 @@ export default {
|
|
|
194
217
|
|
|
195
218
|
const active = this.getActive();
|
|
196
219
|
const elements = $$(selFocusable, current);
|
|
197
|
-
const i = findIndex(elements, el => matches(el, ':focus'));
|
|
220
|
+
const i = findIndex(elements, (el) => matches(el, ':focus'));
|
|
198
221
|
|
|
199
222
|
if (keyCode === keyMap.UP) {
|
|
200
223
|
e.preventDefault();
|
|
@@ -211,11 +234,11 @@ export default {
|
|
|
211
234
|
}
|
|
212
235
|
|
|
213
236
|
if (keyCode === keyMap.ESC) {
|
|
214
|
-
active
|
|
237
|
+
active?.target?.focus();
|
|
215
238
|
}
|
|
216
239
|
|
|
217
240
|
handleNavItemNavigation(e, this.toggles, active);
|
|
218
|
-
}
|
|
241
|
+
},
|
|
219
242
|
},
|
|
220
243
|
|
|
221
244
|
{
|
|
@@ -232,10 +255,14 @@ export default {
|
|
|
232
255
|
handler() {
|
|
233
256
|
const active = this.getActive();
|
|
234
257
|
|
|
235
|
-
if (
|
|
258
|
+
if (
|
|
259
|
+
active &&
|
|
260
|
+
includes(active.mode, 'hover') &&
|
|
261
|
+
!this.dropdowns.some((el) => matches(el, ':hover'))
|
|
262
|
+
) {
|
|
236
263
|
active.hide();
|
|
237
264
|
}
|
|
238
|
-
}
|
|
265
|
+
},
|
|
239
266
|
},
|
|
240
267
|
|
|
241
268
|
{
|
|
@@ -250,12 +277,10 @@ export default {
|
|
|
250
277
|
},
|
|
251
278
|
|
|
252
279
|
handler() {
|
|
253
|
-
|
|
254
280
|
if (!parent(this.dropbar)) {
|
|
255
281
|
after(this.dropbarAnchor || this.$el, this.dropbar);
|
|
256
282
|
}
|
|
257
|
-
|
|
258
|
-
}
|
|
283
|
+
},
|
|
259
284
|
},
|
|
260
285
|
|
|
261
286
|
{
|
|
@@ -269,7 +294,7 @@ export default {
|
|
|
269
294
|
return this.dropbar;
|
|
270
295
|
},
|
|
271
296
|
|
|
272
|
-
handler(_, {$el, dir}) {
|
|
297
|
+
handler(_, { $el, dir }) {
|
|
273
298
|
if (!hasClass($el, this.clsDrop)) {
|
|
274
299
|
return;
|
|
275
300
|
}
|
|
@@ -281,9 +306,14 @@ export default {
|
|
|
281
306
|
this.clsDrop && addClass($el, `${this.clsDrop}-dropbar`);
|
|
282
307
|
|
|
283
308
|
if (dir === 'bottom') {
|
|
284
|
-
this.transitionTo(
|
|
309
|
+
this.transitionTo(
|
|
310
|
+
$el.offsetHeight +
|
|
311
|
+
toFloat(css($el, 'marginTop')) +
|
|
312
|
+
toFloat(css($el, 'marginBottom')),
|
|
313
|
+
$el
|
|
314
|
+
);
|
|
285
315
|
}
|
|
286
|
-
}
|
|
316
|
+
},
|
|
287
317
|
},
|
|
288
318
|
|
|
289
319
|
{
|
|
@@ -297,18 +327,17 @@ export default {
|
|
|
297
327
|
return this.dropbar;
|
|
298
328
|
},
|
|
299
329
|
|
|
300
|
-
handler(e, {$el}) {
|
|
301
|
-
|
|
330
|
+
handler(e, { $el }) {
|
|
302
331
|
const active = this.getActive();
|
|
303
332
|
|
|
304
|
-
if (
|
|
305
|
-
&&
|
|
306
|
-
|
|
307
|
-
|
|
333
|
+
if (
|
|
334
|
+
matches(this.dropbar, ':hover') &&
|
|
335
|
+
active?.$el === $el &&
|
|
336
|
+
!this.toggles.some((el) => active.target !== el && matches(el, ':focus'))
|
|
308
337
|
) {
|
|
309
338
|
e.preventDefault();
|
|
310
339
|
}
|
|
311
|
-
}
|
|
340
|
+
},
|
|
312
341
|
},
|
|
313
342
|
|
|
314
343
|
{
|
|
@@ -322,30 +351,27 @@ export default {
|
|
|
322
351
|
return this.dropbar;
|
|
323
352
|
},
|
|
324
353
|
|
|
325
|
-
handler(_, {$el}) {
|
|
354
|
+
handler(_, { $el }) {
|
|
326
355
|
if (!hasClass($el, this.clsDrop)) {
|
|
327
356
|
return;
|
|
328
357
|
}
|
|
329
358
|
|
|
330
359
|
const active = this.getActive();
|
|
331
360
|
|
|
332
|
-
if (!active || active
|
|
361
|
+
if (!active || active?.$el === $el) {
|
|
333
362
|
this.transitionTo(0);
|
|
334
363
|
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
364
|
+
},
|
|
365
|
+
},
|
|
338
366
|
],
|
|
339
367
|
|
|
340
368
|
methods: {
|
|
341
|
-
|
|
342
369
|
getActive() {
|
|
343
370
|
return active && within(active.target, this.$el) && active;
|
|
344
371
|
},
|
|
345
372
|
|
|
346
373
|
transitionTo(newHeight, el) {
|
|
347
|
-
|
|
348
|
-
const {dropbar} = this;
|
|
374
|
+
const { dropbar } = this;
|
|
349
375
|
const oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
|
|
350
376
|
|
|
351
377
|
el = oldHeight < newHeight && el;
|
|
@@ -356,54 +382,52 @@ export default {
|
|
|
356
382
|
|
|
357
383
|
Transition.cancel([el, dropbar]);
|
|
358
384
|
return Promise.all([
|
|
359
|
-
Transition.start(dropbar, {height: newHeight}, this.duration),
|
|
360
|
-
Transition.start(
|
|
385
|
+
Transition.start(dropbar, { height: newHeight }, this.duration),
|
|
386
|
+
Transition.start(
|
|
387
|
+
el,
|
|
388
|
+
{ clip: `rect(0,${el.offsetWidth}px,${newHeight}px,0)` },
|
|
389
|
+
this.duration
|
|
390
|
+
),
|
|
361
391
|
])
|
|
362
392
|
.catch(noop)
|
|
363
393
|
.then(() => {
|
|
364
|
-
css(el, {clip: ''});
|
|
394
|
+
css(el, { clip: '' });
|
|
365
395
|
this.$update(dropbar);
|
|
366
396
|
});
|
|
367
397
|
},
|
|
368
398
|
|
|
369
399
|
getDropdown(el) {
|
|
370
400
|
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
401
|
+
},
|
|
402
|
+
},
|
|
375
403
|
};
|
|
376
404
|
|
|
377
405
|
function handleNavItemNavigation(e, toggles, active) {
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
const target = active && active.target || current;
|
|
406
|
+
const { current, keyCode } = e;
|
|
407
|
+
const target = active?.target || current;
|
|
381
408
|
const i = toggles.indexOf(target);
|
|
382
409
|
|
|
383
410
|
// Left
|
|
384
411
|
if (keyCode === keyMap.LEFT && i > 0) {
|
|
385
|
-
active
|
|
412
|
+
active?.hide(false);
|
|
386
413
|
toggles[i - 1].focus();
|
|
387
414
|
}
|
|
388
415
|
|
|
389
416
|
// Right
|
|
390
417
|
if (keyCode === keyMap.RIGHT && i < toggles.length - 1) {
|
|
391
|
-
active
|
|
418
|
+
active?.hide(false);
|
|
392
419
|
toggles[i + 1].focus();
|
|
393
420
|
}
|
|
394
421
|
|
|
395
422
|
if (keyCode === keyMap.TAB) {
|
|
396
423
|
target.focus();
|
|
397
|
-
active
|
|
424
|
+
active?.hide(false);
|
|
398
425
|
}
|
|
399
426
|
}
|
|
400
427
|
|
|
401
428
|
function focusFirstFocusableElement(el) {
|
|
402
429
|
if (!$(':focus', el)) {
|
|
403
|
-
|
|
404
|
-
if (focusEl) {
|
|
405
|
-
focusEl.focus();
|
|
406
|
-
}
|
|
430
|
+
$(selFocusable, el)?.focus();
|
|
407
431
|
}
|
|
408
432
|
}
|
|
409
433
|
|
|
@@ -413,5 +437,5 @@ const keyMap = {
|
|
|
413
437
|
LEFT: 37,
|
|
414
438
|
UP: 38,
|
|
415
439
|
RIGHT: 39,
|
|
416
|
-
DOWN: 40
|
|
440
|
+
DOWN: 40,
|
|
417
441
|
};
|