uikit 3.17.7 → 3.17.9-dev.337e68f15
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 +29 -4
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- 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 +2 -2
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +15 -7
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +15 -7
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +2 -2
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +22 -26
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +22 -26
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +12 -4
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +22 -26
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +12 -4
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +4 -4
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +47 -31
- 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 +74 -71
- 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 +104 -107
- package/dist/js/uikit.min.js +1 -1
- package/package.json +12 -12
- package/src/js/api/component.js +2 -2
- package/src/js/api/events.js +1 -6
- package/src/js/api/instance.js +6 -3
- package/src/js/api/observables.js +2 -2
- package/src/js/api/options.js +15 -14
- package/src/js/api/props.js +32 -18
- package/src/js/components/filter.js +1 -2
- package/src/js/components/notification.js +1 -2
- package/src/js/components/sortable.js +4 -5
- package/src/js/components/tooltip.js +30 -35
- package/src/js/core/accordion.js +1 -2
- package/src/js/core/drop.js +23 -20
- package/src/js/core/dropnav.js +2 -3
- package/src/js/core/form-custom.js +5 -5
- package/src/js/core/icon.js +5 -6
- package/src/js/core/navbar.js +1 -2
- package/src/js/core/overflow-auto.js +3 -3
- package/src/js/core/scroll.js +1 -2
- package/src/js/core/scrollspy-nav.js +1 -2
- package/src/js/core/sticky.js +2 -5
- package/src/js/core/switcher.js +10 -12
- package/src/js/core/tab.js +2 -2
- package/src/js/core/toggle.js +3 -5
- package/src/js/mixin/animate.js +7 -7
- package/src/js/mixin/internal/animate-fade.js +2 -2
- package/src/js/mixin/modal.js +4 -6
- package/src/js/mixin/slider-drag.js +1 -2
- package/src/js/mixin/slider-nav.js +7 -8
- package/src/js/mixin/togglable.js +8 -8
- package/src/js/util/dimensions.js +4 -4
- package/src/js/util/event.js +6 -7
- package/src/js/util/lang.js +11 -11
- package/src/js/util/position.js +1 -2
- package/src/js/util/selector.js +2 -2
- package/src/js/util/style.js +2 -2
- package/src/js/util/viewport.js +20 -16
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.17.
|
|
5
|
+
"version": "3.17.9-dev.337e68f15",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -22,31 +22,31 @@
|
|
|
22
22
|
"packageManager": "pnpm@8.10.1",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@rollup/plugin-alias": "^5.0.1",
|
|
25
|
-
"@rollup/plugin-replace": "^5.0.
|
|
26
|
-
"archiver": "^6.0.
|
|
25
|
+
"@rollup/plugin-replace": "^5.0.5",
|
|
26
|
+
"archiver": "^6.0.1",
|
|
27
27
|
"camelcase": "^8.0.0",
|
|
28
28
|
"chokidar-cli": "^3.0.0",
|
|
29
29
|
"clean-css": "^5.3.2",
|
|
30
30
|
"dateformat": "^5.0.3",
|
|
31
31
|
"esbuild": "^0.19.5",
|
|
32
|
-
"eslint": "^8.
|
|
32
|
+
"eslint": "^8.53.0",
|
|
33
33
|
"eslint-config-prettier": "^9.0.0",
|
|
34
34
|
"execa": "^8.0.1",
|
|
35
35
|
"fs-extra": "^11.1.1",
|
|
36
|
-
"glob": "^10.3.
|
|
37
|
-
"inquirer": "^9.2.
|
|
38
|
-
"less": "^4.
|
|
36
|
+
"glob": "^10.3.10",
|
|
37
|
+
"inquirer": "^9.2.12",
|
|
38
|
+
"less": "^4.2.0",
|
|
39
39
|
"minimist": "^1.2.8",
|
|
40
40
|
"number-precision": "^1.6.0",
|
|
41
41
|
"p-limit": "^5.0.0",
|
|
42
|
-
"prettier": "^3.0
|
|
43
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
44
|
-
"rollup": "^4.
|
|
42
|
+
"prettier": "^3.1.0",
|
|
43
|
+
"prettier-plugin-organize-imports": "^3.2.4",
|
|
44
|
+
"rollup": "^4.4.0",
|
|
45
45
|
"rollup-plugin-esbuild": "^6.1.0",
|
|
46
46
|
"rollup-plugin-modify": "^3.0.0",
|
|
47
|
-
"rtlcss": "^4.1.
|
|
47
|
+
"rtlcss": "^4.1.1",
|
|
48
48
|
"semver": "^7.5.4",
|
|
49
|
-
"svgo": "^3.0.
|
|
49
|
+
"svgo": "^3.0.3"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build-scss": "node build/scss",
|
package/src/js/api/component.js
CHANGED
|
@@ -41,8 +41,8 @@ export function createComponent(name, element, data, ...args) {
|
|
|
41
41
|
return Component.options.functional
|
|
42
42
|
? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] })
|
|
43
43
|
: element
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
? $$(element).map(init)[0]
|
|
45
|
+
: init();
|
|
46
46
|
|
|
47
47
|
function init(element) {
|
|
48
48
|
const instance = getComponent(element, name);
|
package/src/js/api/events.js
CHANGED
|
@@ -24,12 +24,7 @@ export function registerEvent(instance, event, key) {
|
|
|
24
24
|
: { name: key, handler: event };
|
|
25
25
|
el = isFunction(el) ? el.call(instance, instance) : el || instance.$el;
|
|
26
26
|
|
|
27
|
-
if (isArray(el)) {
|
|
28
|
-
el.forEach((el) => registerEvent(instance, { ...event, el }, key));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!el || (filter && !filter.call(instance))) {
|
|
27
|
+
if (!el || (isArray(el) && !el.length) || (filter && !filter.call(instance))) {
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
35
30
|
|
package/src/js/api/instance.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { remove } from 'uikit-util';
|
|
2
2
|
import { attachToElement, createComponent, detachFromElement, getComponent } from './component';
|
|
3
3
|
import { update } from './global';
|
|
4
4
|
import { callConnected, callDisconnected, callHook } from './hooks';
|
|
@@ -11,7 +11,7 @@ export default function (App) {
|
|
|
11
11
|
|
|
12
12
|
instance.$options.el = el;
|
|
13
13
|
|
|
14
|
-
if (
|
|
14
|
+
if (document.contains(el)) {
|
|
15
15
|
callConnected(instance);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -60,6 +60,7 @@ export default function (App) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
const ids = Object.create(null);
|
|
63
64
|
export function generateId(instance, el = instance.$el, postfix = '') {
|
|
64
65
|
if (el.id) {
|
|
65
66
|
return el.id;
|
|
@@ -67,9 +68,11 @@ export function generateId(instance, el = instance.$el, postfix = '') {
|
|
|
67
68
|
|
|
68
69
|
let id = `${instance.$options.id}-${instance._uid}${postfix}`;
|
|
69
70
|
|
|
70
|
-
if (
|
|
71
|
+
if (ids[id]) {
|
|
71
72
|
id = generateId(instance, el, `${postfix}-2`);
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
ids[id] = true;
|
|
76
|
+
|
|
74
77
|
return id;
|
|
75
78
|
}
|
package/src/js/api/options.js
CHANGED
|
@@ -90,8 +90,8 @@ function concatStrat(parentVal, childVal) {
|
|
|
90
90
|
? parentVal
|
|
91
91
|
? parentVal.concat(childVal)
|
|
92
92
|
: isArray(childVal)
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
? childVal
|
|
94
|
+
: [childVal]
|
|
95
95
|
: parentVal;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -140,14 +140,14 @@ export function parseOptions(options, args = []) {
|
|
|
140
140
|
? startsWith(options, '{')
|
|
141
141
|
? JSON.parse(options)
|
|
142
142
|
: args.length && !includes(options, ':')
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
? { [args[0]]: options }
|
|
144
|
+
: options.split(';').reduce((options, option) => {
|
|
145
|
+
const [key, value] = option.split(/:(.*)/);
|
|
146
|
+
if (key && !isUndefined(value)) {
|
|
147
|
+
options[key.trim()] = value.trim();
|
|
148
|
+
}
|
|
149
|
+
return options;
|
|
150
|
+
}, {})
|
|
151
151
|
: {};
|
|
152
152
|
} catch (e) {
|
|
153
153
|
return {};
|
|
@@ -168,12 +168,13 @@ export function coerce(type, value) {
|
|
|
168
168
|
return type ? type(value) : value;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
const listRe = /,(?![^(]*\))/;
|
|
171
172
|
function toList(value) {
|
|
172
173
|
return isArray(value)
|
|
173
174
|
? value
|
|
174
175
|
: isString(value)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
? value
|
|
177
|
+
.split(listRe)
|
|
178
|
+
.map((value) => (isNumeric(value) ? toNumber(value) : toBoolean(value.trim())))
|
|
179
|
+
: [value];
|
|
179
180
|
}
|
package/src/js/api/props.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
assign,
|
|
3
|
+
camelize,
|
|
4
|
+
data as getData,
|
|
5
|
+
hasOwn,
|
|
6
|
+
hyphenate,
|
|
7
|
+
isUndefined,
|
|
8
|
+
memoize,
|
|
9
|
+
startsWith,
|
|
10
|
+
} from 'uikit-util';
|
|
2
11
|
import { registerObserver } from './observer';
|
|
3
12
|
import { coerce, parseOptions } from './options';
|
|
4
13
|
|
|
5
14
|
export function initProps(instance) {
|
|
6
|
-
const props =
|
|
15
|
+
const { $options, $props } = instance;
|
|
16
|
+
const props = getProps($options);
|
|
7
17
|
|
|
8
|
-
|
|
9
|
-
if (!isUndefined(props[key])) {
|
|
10
|
-
instance.$props[key] = props[key];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
18
|
+
assign($props, props);
|
|
13
19
|
|
|
14
|
-
const
|
|
15
|
-
for (let key in
|
|
16
|
-
if (
|
|
17
|
-
|
|
20
|
+
const { computed, methods } = $options;
|
|
21
|
+
for (let key in $props) {
|
|
22
|
+
if (
|
|
23
|
+
key in props &&
|
|
24
|
+
(!computed || !hasOwn(computed, key)) &&
|
|
25
|
+
(!methods || !hasOwn(methods, key))
|
|
26
|
+
) {
|
|
27
|
+
instance[key] = $props[key];
|
|
18
28
|
}
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
function getProps(opts) {
|
|
23
33
|
const data = {};
|
|
24
34
|
const { args = [], props = {}, el, id } = opts;
|
|
25
35
|
|
|
@@ -56,9 +66,14 @@ export function getProps(opts) {
|
|
|
56
66
|
return data;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
const getAttributes = memoize((id, props) => {
|
|
70
|
+
const attributes = Object.keys(props);
|
|
71
|
+
const filter = attributes
|
|
72
|
+
.concat(id)
|
|
73
|
+
.map((key) => [hyphenate(key), `data-${hyphenate(key)}`])
|
|
74
|
+
.flat();
|
|
75
|
+
return { attributes, filter };
|
|
76
|
+
});
|
|
62
77
|
|
|
63
78
|
export function initPropsObserver(instance) {
|
|
64
79
|
const { $options, $props } = instance;
|
|
@@ -68,8 +83,7 @@ export function initPropsObserver(instance) {
|
|
|
68
83
|
return;
|
|
69
84
|
}
|
|
70
85
|
|
|
71
|
-
const attributes =
|
|
72
|
-
const filter = attributes.map((key) => hyphenate(key)).concat(id);
|
|
86
|
+
const { attributes, filter } = getAttributes(id, props);
|
|
73
87
|
|
|
74
88
|
const observer = new MutationObserver((records) => {
|
|
75
89
|
const data = getProps($options);
|
|
@@ -87,7 +101,7 @@ export function initPropsObserver(instance) {
|
|
|
87
101
|
|
|
88
102
|
observer.observe(el, {
|
|
89
103
|
attributes: true,
|
|
90
|
-
attributeFilter: filter
|
|
104
|
+
attributeFilter: filter,
|
|
91
105
|
});
|
|
92
106
|
|
|
93
107
|
registerObserver(instance, observer);
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
$$,
|
|
4
4
|
append,
|
|
5
5
|
attr,
|
|
6
|
-
closest,
|
|
7
6
|
css,
|
|
8
7
|
data,
|
|
9
8
|
each,
|
|
@@ -82,7 +81,7 @@ export default {
|
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
if (
|
|
84
|
+
if (e.target.closest('a,button')) {
|
|
86
85
|
e.preventDefault();
|
|
87
86
|
this.apply(e.current);
|
|
88
87
|
}
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
$,
|
|
3
3
|
append,
|
|
4
4
|
apply,
|
|
5
|
-
closest,
|
|
6
5
|
css,
|
|
7
6
|
isVisible,
|
|
8
7
|
parent,
|
|
@@ -81,7 +80,7 @@ export default {
|
|
|
81
80
|
|
|
82
81
|
events: {
|
|
83
82
|
click(e) {
|
|
84
|
-
if (
|
|
83
|
+
if (e.target.closest('a[href="#"],a[href=""]')) {
|
|
85
84
|
e.preventDefault();
|
|
86
85
|
}
|
|
87
86
|
this.close();
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
toggleClass,
|
|
31
31
|
Transition,
|
|
32
32
|
trigger,
|
|
33
|
-
within,
|
|
34
33
|
} from 'uikit-util';
|
|
35
34
|
import Animate from '../mixin/animate';
|
|
36
35
|
import Class from '../mixin/class';
|
|
@@ -181,15 +180,15 @@ export default {
|
|
|
181
180
|
methods: {
|
|
182
181
|
init(e) {
|
|
183
182
|
const { target, button, defaultPrevented } = e;
|
|
184
|
-
const [placeholder] = this.items.filter((el) =>
|
|
183
|
+
const [placeholder] = this.items.filter((el) => el.contains(target));
|
|
185
184
|
|
|
186
185
|
if (
|
|
187
186
|
!placeholder ||
|
|
188
187
|
defaultPrevented ||
|
|
189
188
|
button > 0 ||
|
|
190
189
|
isInput(target) ||
|
|
191
|
-
|
|
192
|
-
(this.handle && !
|
|
190
|
+
target.closest(`.${this.clsNoDrag}`) ||
|
|
191
|
+
(this.handle && !target.closest(this.handle))
|
|
193
192
|
) {
|
|
194
193
|
return;
|
|
195
194
|
}
|
|
@@ -280,7 +279,7 @@ export default {
|
|
|
280
279
|
},
|
|
281
280
|
|
|
282
281
|
remove(element) {
|
|
283
|
-
if (!
|
|
282
|
+
if (!this.target.contains(element)) {
|
|
284
283
|
return;
|
|
285
284
|
}
|
|
286
285
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
append,
|
|
3
3
|
attr,
|
|
4
|
+
data,
|
|
4
5
|
flipPosition,
|
|
5
6
|
hasAttr,
|
|
6
7
|
includes,
|
|
@@ -15,9 +16,9 @@ import {
|
|
|
15
16
|
pointerEnter,
|
|
16
17
|
pointerLeave,
|
|
17
18
|
remove,
|
|
18
|
-
within,
|
|
19
19
|
} from 'uikit-util';
|
|
20
20
|
import { generateId } from '../api/instance';
|
|
21
|
+
import { parseOptions } from '../api/options';
|
|
21
22
|
import Container from '../mixin/container';
|
|
22
23
|
import Position from '../mixin/position';
|
|
23
24
|
import Togglable from '../mixin/togglable';
|
|
@@ -26,48 +27,42 @@ import { keyMap } from '../util/keys';
|
|
|
26
27
|
export default {
|
|
27
28
|
mixins: [Container, Togglable, Position],
|
|
28
29
|
|
|
29
|
-
args: 'title',
|
|
30
|
-
|
|
31
|
-
props: {
|
|
32
|
-
delay: Number,
|
|
33
|
-
title: String,
|
|
34
|
-
},
|
|
35
|
-
|
|
36
30
|
data: {
|
|
37
31
|
pos: 'top',
|
|
38
|
-
title: '',
|
|
39
|
-
delay: 0,
|
|
40
32
|
animation: ['uk-animation-scale-up'],
|
|
41
33
|
duration: 100,
|
|
42
34
|
cls: 'uk-active',
|
|
43
35
|
},
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
this.id = generateId(this, {});
|
|
47
|
-
this._hasTitle = hasAttr(this.$el, 'title');
|
|
48
|
-
attr(this.$el, {
|
|
49
|
-
title: '',
|
|
50
|
-
'aria-describedby': this.id,
|
|
51
|
-
});
|
|
37
|
+
connected() {
|
|
52
38
|
makeFocusable(this.$el);
|
|
53
39
|
},
|
|
54
40
|
|
|
55
41
|
disconnected() {
|
|
56
42
|
this.hide();
|
|
57
|
-
|
|
58
|
-
if (!attr(this.$el, 'title')) {
|
|
59
|
-
attr(this.$el, 'title', this._hasTitle ? this.title : null);
|
|
60
|
-
}
|
|
61
43
|
},
|
|
62
44
|
|
|
63
45
|
methods: {
|
|
64
46
|
show() {
|
|
65
|
-
if (this.isToggled(this.tooltip || null)
|
|
47
|
+
if (this.isToggled(this.tooltip || null)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const { delay = 0, title } = parseProps(this.$options);
|
|
52
|
+
|
|
53
|
+
if (!title) {
|
|
66
54
|
return;
|
|
67
55
|
}
|
|
68
56
|
|
|
57
|
+
this.title = title;
|
|
58
|
+
this.id ||= generateId(this, {});
|
|
59
|
+
this._hasTitle = hasAttr(this.$el, 'title');
|
|
60
|
+
attr(this.$el, { title: null, 'aria-describedby': this.id });
|
|
61
|
+
|
|
62
|
+
once(this.$el, ['blur', pointerLeave], (e) => !isTouch(e) && this.hide());
|
|
63
|
+
|
|
69
64
|
clearTimeout(this.showTimer);
|
|
70
|
-
this.showTimer = setTimeout(this._show,
|
|
65
|
+
this.showTimer = setTimeout(this._show, delay);
|
|
71
66
|
},
|
|
72
67
|
|
|
73
68
|
async hide() {
|
|
@@ -81,6 +76,7 @@ export default {
|
|
|
81
76
|
await this.toggleElement(this.tooltip, false, false);
|
|
82
77
|
}
|
|
83
78
|
|
|
79
|
+
attr(this.$el, { title: this._hasTitle ? this.title : null, 'aria-describedby': null });
|
|
84
80
|
remove(this.tooltip);
|
|
85
81
|
this.tooltip = null;
|
|
86
82
|
},
|
|
@@ -115,7 +111,7 @@ export default {
|
|
|
115
111
|
this.hide,
|
|
116
112
|
false,
|
|
117
113
|
(e) =>
|
|
118
|
-
(e.type === pointerDown && !
|
|
114
|
+
(e.type === pointerDown && !this.$el.contains(e.target)) ||
|
|
119
115
|
(e.type === 'keydown' && e.keyCode === keyMap.ESC),
|
|
120
116
|
),
|
|
121
117
|
on([document, ...overflowParents(this.$el)], 'scroll', update, {
|
|
@@ -134,19 +130,10 @@ export default {
|
|
|
134
130
|
},
|
|
135
131
|
|
|
136
132
|
events: {
|
|
137
|
-
focus: 'show',
|
|
138
|
-
blur: 'hide',
|
|
139
|
-
|
|
140
|
-
[`${pointerEnter} ${pointerLeave}`](e) {
|
|
141
|
-
if (!isTouch(e)) {
|
|
142
|
-
this[e.type === pointerEnter ? 'show' : 'hide']();
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
|
|
146
133
|
// Clicking a button does not give it focus on all browsers and platforms
|
|
147
134
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
|
|
148
|
-
[pointerDown](e) {
|
|
149
|
-
if (isTouch(e)) {
|
|
135
|
+
[`focus ${pointerEnter} ${pointerDown}`](e) {
|
|
136
|
+
if (!isTouch(e)) {
|
|
150
137
|
this.show();
|
|
151
138
|
}
|
|
152
139
|
},
|
|
@@ -189,3 +176,11 @@ function getAlignment(el, target, [dir, align]) {
|
|
|
189
176
|
|
|
190
177
|
return [dir, align];
|
|
191
178
|
}
|
|
179
|
+
|
|
180
|
+
function parseProps(options) {
|
|
181
|
+
const { el, id } = options;
|
|
182
|
+
return ['delay', 'title'].reduce(
|
|
183
|
+
(obj, key) => ({ [key]: data(el, key), ...obj }),
|
|
184
|
+
parseOptions(data(el, id), ['title']),
|
|
185
|
+
);
|
|
186
|
+
}
|
package/src/js/core/accordion.js
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
toggleClass,
|
|
18
18
|
Transition,
|
|
19
19
|
unwrap,
|
|
20
|
-
within,
|
|
21
20
|
wrapAll,
|
|
22
21
|
} from 'uikit-util';
|
|
23
22
|
import { generateId } from '../api/instance';
|
|
@@ -86,7 +85,7 @@ export default {
|
|
|
86
85
|
contents(items) {
|
|
87
86
|
for (const el of items) {
|
|
88
87
|
const isOpen = hasClass(
|
|
89
|
-
this.items.find((item) =>
|
|
88
|
+
this.items.find((item) => item.contains(el)),
|
|
90
89
|
this.clsOpen,
|
|
91
90
|
);
|
|
92
91
|
|
package/src/js/core/drop.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
$,
|
|
2
3
|
addClass,
|
|
3
4
|
append,
|
|
4
5
|
apply,
|
|
@@ -160,7 +161,7 @@ export default {
|
|
|
160
161
|
!defaultPrevented &&
|
|
161
162
|
hash &&
|
|
162
163
|
isSameSiteAnchor(current) &&
|
|
163
|
-
!
|
|
164
|
+
!this.$el.contains($(hash))
|
|
164
165
|
) {
|
|
165
166
|
this.hide(false);
|
|
166
167
|
}
|
|
@@ -298,7 +299,7 @@ export default {
|
|
|
298
299
|
handler({ target }) {
|
|
299
300
|
if (this.$el !== target) {
|
|
300
301
|
active =
|
|
301
|
-
active === null &&
|
|
302
|
+
active === null && this.$el.contains(target) && this.isToggled()
|
|
302
303
|
? this
|
|
303
304
|
: active;
|
|
304
305
|
return;
|
|
@@ -340,7 +341,7 @@ export default {
|
|
|
340
341
|
}
|
|
341
342
|
|
|
342
343
|
let prev;
|
|
343
|
-
while (active && prev !== active && !
|
|
344
|
+
while (active && prev !== active && !active.$el.contains(this.$el)) {
|
|
344
345
|
prev = active;
|
|
345
346
|
active.hide(false, false);
|
|
346
347
|
}
|
|
@@ -463,7 +464,7 @@ function getPositionedElements(el) {
|
|
|
463
464
|
}
|
|
464
465
|
|
|
465
466
|
function getViewport(el, target) {
|
|
466
|
-
return offsetViewport(overflowParents(target).find((parent) =>
|
|
467
|
+
return offsetViewport(overflowParents(target).find((parent) => parent.contains(el)));
|
|
467
468
|
}
|
|
468
469
|
|
|
469
470
|
function createToggleComponent(drop) {
|
|
@@ -505,22 +506,24 @@ function listenForScrollClose(drop) {
|
|
|
505
506
|
|
|
506
507
|
function listenForBackgroundClose(drop) {
|
|
507
508
|
return on(document, pointerDown, ({ target }) => {
|
|
508
|
-
if (
|
|
509
|
-
|
|
510
|
-
document,
|
|
511
|
-
`${pointerUp} ${pointerCancel} scroll`,
|
|
512
|
-
({ defaultPrevented, type, target: newTarget }) => {
|
|
513
|
-
if (
|
|
514
|
-
!defaultPrevented &&
|
|
515
|
-
type === pointerUp &&
|
|
516
|
-
target === newTarget &&
|
|
517
|
-
!(drop.targetEl && within(target, drop.targetEl))
|
|
518
|
-
) {
|
|
519
|
-
drop.hide(false);
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
true,
|
|
523
|
-
);
|
|
509
|
+
if (drop.$el.contains(target)) {
|
|
510
|
+
return;
|
|
524
511
|
}
|
|
512
|
+
|
|
513
|
+
once(
|
|
514
|
+
document,
|
|
515
|
+
`${pointerUp} ${pointerCancel} scroll`,
|
|
516
|
+
({ defaultPrevented, type, target: newTarget }) => {
|
|
517
|
+
if (
|
|
518
|
+
!defaultPrevented &&
|
|
519
|
+
type === pointerUp &&
|
|
520
|
+
target === newTarget &&
|
|
521
|
+
!(drop.targetEl && within(target, drop.targetEl))
|
|
522
|
+
) {
|
|
523
|
+
drop.hide(false);
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
true,
|
|
527
|
+
);
|
|
525
528
|
});
|
|
526
529
|
}
|
package/src/js/core/dropnav.js
CHANGED
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
selFocusable,
|
|
21
21
|
toFloat,
|
|
22
22
|
Transition,
|
|
23
|
-
within,
|
|
24
23
|
} from 'uikit-util';
|
|
25
24
|
import Class from '../mixin/class';
|
|
26
25
|
import Container from '../mixin/container';
|
|
@@ -90,7 +89,7 @@ export default {
|
|
|
90
89
|
if (this.dropContainer !== $el) {
|
|
91
90
|
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
|
|
92
91
|
const target = this.getDropdown(el)?.targetEl;
|
|
93
|
-
if (!includes(dropdowns, el) && target &&
|
|
92
|
+
if (!includes(dropdowns, el) && target && this.$el.contains(target)) {
|
|
94
93
|
dropdowns.push(el);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
@@ -143,7 +142,7 @@ export default {
|
|
|
143
142
|
active &&
|
|
144
143
|
includes(active.mode, 'hover') &&
|
|
145
144
|
active.targetEl &&
|
|
146
|
-
!
|
|
145
|
+
!current.contains(active.targetEl) &&
|
|
147
146
|
!active.isDelaying
|
|
148
147
|
) {
|
|
149
148
|
active.hide(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, $$,
|
|
1
|
+
import { $, $$, isInput, matches, parent, selInput } from 'uikit-util';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
@@ -43,9 +43,9 @@ export default {
|
|
|
43
43
|
const value = input.files?.[0]
|
|
44
44
|
? input.files[0].name
|
|
45
45
|
: matches(input, 'select') &&
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
(option = $$('option', input).filter((el) => el.selected)[0]) // eslint-disable-line prefer-destructuring
|
|
47
|
+
? option.textContent
|
|
48
|
+
: input.value;
|
|
49
49
|
|
|
50
50
|
if (prev !== value) {
|
|
51
51
|
target[prop] = value;
|
|
@@ -65,7 +65,7 @@ export default {
|
|
|
65
65
|
name: 'reset',
|
|
66
66
|
|
|
67
67
|
el() {
|
|
68
|
-
return
|
|
68
|
+
return this.$el.closest('form');
|
|
69
69
|
},
|
|
70
70
|
|
|
71
71
|
handler() {
|
package/src/js/core/icon.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
addClass,
|
|
4
4
|
apply,
|
|
5
5
|
attr,
|
|
6
|
-
closest,
|
|
7
6
|
css,
|
|
8
7
|
each,
|
|
9
8
|
hasAttr,
|
|
@@ -110,7 +109,7 @@ export const NavParentIcon = {
|
|
|
110
109
|
|
|
111
110
|
beforeConnect() {
|
|
112
111
|
const icon = this.$props.icon;
|
|
113
|
-
this.icon =
|
|
112
|
+
this.icon = this.$el.closest('.uk-nav-primary') ? `${icon}-large` : icon;
|
|
114
113
|
},
|
|
115
114
|
};
|
|
116
115
|
|
|
@@ -126,8 +125,8 @@ export const Search = {
|
|
|
126
125
|
hasClass(this.$el, 'uk-search-icon') && parents(this.$el, '.uk-search-large').length
|
|
127
126
|
? 'search-large'
|
|
128
127
|
: parents(this.$el, '.uk-search-navbar').length
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
? 'search-navbar'
|
|
129
|
+
: this.$props.icon;
|
|
131
130
|
|
|
132
131
|
if (hasAttr(this.$el, 'aria-label')) {
|
|
133
132
|
return;
|
|
@@ -137,7 +136,7 @@ export const Search = {
|
|
|
137
136
|
const label = this.t('toggle');
|
|
138
137
|
attr(this.$el, 'aria-label', label);
|
|
139
138
|
} else {
|
|
140
|
-
const button =
|
|
139
|
+
const button = this.$el.closest('a,button');
|
|
141
140
|
if (button) {
|
|
142
141
|
const label = this.t('submit');
|
|
143
142
|
attr(button, 'aria-label', label);
|
|
@@ -172,7 +171,7 @@ const ButtonComponent = {
|
|
|
172
171
|
mixins: [I18n],
|
|
173
172
|
|
|
174
173
|
beforeConnect() {
|
|
175
|
-
const button =
|
|
174
|
+
const button = this.$el.closest('a,button');
|
|
176
175
|
|
|
177
176
|
attr(button, 'role', this.role !== null && isTag(button, 'a') ? 'button' : this.role);
|
|
178
177
|
|