uikit 3.11.2-dev.31cd2ba38 → 3.11.2-dev.3dfa2c50b
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 +7 -11
- 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 +42 -17
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +42 -17
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +42 -17
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +42 -17
- 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 +409 -438
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1116 -1305
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1164 -1383
- 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 +294 -345
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +292 -344
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +727 -850
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +292 -344
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +615 -799
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +588 -619
- 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 +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5266 -6572
- 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 +8126 -9876
- 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 +23 -27
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +13 -32
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +79 -100
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +71 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +11 -23
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +42 -61
- package/src/js/components/lightbox-panel.js +135 -109
- package/src/js/components/lightbox.js +18 -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 +75 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +8 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +10 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- package/src/js/core/form-custom.js +20 -25
- 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 +28 -35
- package/src/js/core/icon.js +38 -50
- package/src/js/core/img.js +130 -105
- 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 +50 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +49 -53
- 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 +130 -91
- package/src/js/core/svg.js +60 -79
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +64 -66
- package/src/js/core/video.js +11 -22
- 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 +61 -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/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +53 -48
- 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 +51 -50
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +90 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +27 -43
- package/src/js/util/animation.js +82 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +56 -43
- package/src/js/util/dom.js +40 -73
- 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 +0 -1
- package/src/js/util/lang.js +79 -119
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +42 -47
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/promise.js +0 -191
- package/src/js/util/selector.js +39 -48
- package/src/js/util/style.js +36 -46
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/flex.less +0 -9
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form.scss +3 -3
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/variables-theme.scss +6 -6
- package/src/scss/variables.scss +6 -6
- package/tests/image.html +38 -22
- package/tests/js/index.js +114 -85
- package/src/js/mixin/flex-bug.js +0 -56
- package/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.11.2-dev.
|
|
1
|
+
/*! UIkit 3.11.2-dev.3dfa2c50b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -7,435 +7,403 @@
|
|
|
7
7
|
})(this, (function (uikitUtil) { 'use strict';
|
|
8
8
|
|
|
9
9
|
var Container = {
|
|
10
|
+
props: {
|
|
11
|
+
container: Boolean },
|
|
10
12
|
|
|
11
|
-
props: {
|
|
12
|
-
container: Boolean
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
data: {
|
|
16
|
-
container: true
|
|
17
|
-
},
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
data: {
|
|
15
|
+
container: true },
|
|
20
16
|
|
|
21
|
-
container: function(ref) {
|
|
22
|
-
var container = ref.container;
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
};
|
|
18
|
+
computed: {
|
|
19
|
+
container(_ref) {let { container } = _ref;
|
|
20
|
+
return container === true && this.$container || container && uikitUtil.$(container);
|
|
21
|
+
} } };
|
|
30
22
|
|
|
31
23
|
var Togglable = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
props: {
|
|
25
|
+
cls: Boolean,
|
|
26
|
+
animation: 'list',
|
|
27
|
+
duration: Number,
|
|
28
|
+
origin: String,
|
|
29
|
+
transition: String },
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
data: {
|
|
33
|
+
cls: false,
|
|
34
|
+
animation: [false],
|
|
35
|
+
duration: 200,
|
|
36
|
+
origin: false,
|
|
37
|
+
transition: 'linear',
|
|
38
|
+
clsEnter: 'uk-togglabe-enter',
|
|
39
|
+
clsLeave: 'uk-togglabe-leave',
|
|
40
|
+
|
|
41
|
+
initProps: {
|
|
42
|
+
overflow: '',
|
|
43
|
+
height: '',
|
|
44
|
+
paddingTop: '',
|
|
45
|
+
paddingBottom: '',
|
|
46
|
+
marginTop: '',
|
|
47
|
+
marginBottom: '' },
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
hideProps: {
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
height: 0,
|
|
53
|
+
paddingTop: 0,
|
|
54
|
+
paddingBottom: 0,
|
|
55
|
+
marginTop: 0,
|
|
56
|
+
marginBottom: 0 } },
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
computed: {
|
|
61
|
+
hasAnimation(_ref) {let { animation } = _ref;
|
|
62
|
+
return !!animation[0];
|
|
39
63
|
},
|
|
40
64
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
duration: 200,
|
|
45
|
-
origin: false,
|
|
46
|
-
transition: 'linear',
|
|
47
|
-
clsEnter: 'uk-togglabe-enter',
|
|
48
|
-
clsLeave: 'uk-togglabe-leave',
|
|
49
|
-
|
|
50
|
-
initProps: {
|
|
51
|
-
overflow: '',
|
|
52
|
-
height: '',
|
|
53
|
-
paddingTop: '',
|
|
54
|
-
paddingBottom: '',
|
|
55
|
-
marginTop: '',
|
|
56
|
-
marginBottom: ''
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
hideProps: {
|
|
60
|
-
overflow: 'hidden',
|
|
61
|
-
height: 0,
|
|
62
|
-
paddingTop: 0,
|
|
63
|
-
paddingBottom: 0,
|
|
64
|
-
marginTop: 0,
|
|
65
|
-
marginBottom: 0
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
},
|
|
65
|
+
hasTransition(_ref2) {let { animation } = _ref2;
|
|
66
|
+
return this.hasAnimation && animation[0] === true;
|
|
67
|
+
} },
|
|
69
68
|
|
|
70
|
-
computed: {
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
methods: {
|
|
71
|
+
toggleElement(targets, toggle, animate) {
|
|
72
|
+
return new Promise((resolve) =>
|
|
73
|
+
Promise.all(
|
|
74
|
+
uikitUtil.toNodes(targets).map((el) => {
|
|
75
|
+
const show = uikitUtil.isBoolean(toggle) ? toggle : !this.isToggled(el);
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
hasTransition: function(ref) {
|
|
79
|
-
var animation = ref.animation;
|
|
80
|
-
|
|
81
|
-
return this.hasAnimation && animation[0] === true;
|
|
77
|
+
if (!uikitUtil.trigger(el, "before" + (show ? 'show' : 'hide'), [this])) {
|
|
78
|
+
return Promise.reject();
|
|
82
79
|
}
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
81
|
+
const promise = (
|
|
82
|
+
uikitUtil.isFunction(animate) ?
|
|
83
|
+
animate :
|
|
84
|
+
animate === false || !this.hasAnimation ?
|
|
85
|
+
this._toggle :
|
|
86
|
+
this.hasTransition ?
|
|
87
|
+
toggleHeight(this) :
|
|
88
|
+
toggleAnimation(this))(
|
|
89
|
+
el, show);
|
|
90
|
+
|
|
91
|
+
const cls = show ? this.clsEnter : this.clsLeave;
|
|
92
|
+
|
|
93
|
+
uikitUtil.addClass(el, cls);
|
|
94
|
+
|
|
95
|
+
uikitUtil.trigger(el, show ? 'show' : 'hide', [this]);
|
|
96
|
+
|
|
97
|
+
const done = () => {
|
|
98
|
+
uikitUtil.removeClass(el, cls);
|
|
99
|
+
uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this]);
|
|
100
|
+
this.$update(el);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return promise ?
|
|
104
|
+
promise.then(done, () => {
|
|
105
|
+
uikitUtil.removeClass(el, cls);
|
|
106
|
+
return Promise.reject();
|
|
107
|
+
}) :
|
|
108
|
+
done();
|
|
109
|
+
})).
|
|
110
|
+
then(resolve, uikitUtil.noop));
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
uikitUtil.trigger(el, show ? 'show' : 'hide', [this$1$1]);
|
|
114
|
-
|
|
115
|
-
var done = function () {
|
|
116
|
-
uikitUtil.removeClass(el, cls);
|
|
117
|
-
uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this$1$1]);
|
|
118
|
-
this$1$1.$update(el);
|
|
119
|
-
};
|
|
112
|
+
},
|
|
120
113
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
isToggled(el) {if (el === void 0) {el = this.$el;}
|
|
115
|
+
[el] = uikitUtil.toNodes(el);
|
|
116
|
+
return uikitUtil.hasClass(el, this.clsEnter) ?
|
|
117
|
+
true :
|
|
118
|
+
uikitUtil.hasClass(el, this.clsLeave) ?
|
|
119
|
+
false :
|
|
120
|
+
this.cls ?
|
|
121
|
+
uikitUtil.hasClass(el, this.cls.split(' ')[0]) :
|
|
122
|
+
uikitUtil.isVisible(el);
|
|
123
|
+
},
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
_toggle(el, toggled) {
|
|
126
|
+
if (!el) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
var assign;
|
|
130
|
+
toggled = Boolean(toggled);
|
|
132
131
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
: uikitUtil.isVisible(el);
|
|
142
|
-
},
|
|
132
|
+
let changed;
|
|
133
|
+
if (this.cls) {
|
|
134
|
+
changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls);
|
|
135
|
+
changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled);
|
|
136
|
+
} else {
|
|
137
|
+
changed = toggled === el.hidden;
|
|
138
|
+
changed && (el.hidden = !toggled);
|
|
139
|
+
}
|
|
143
140
|
|
|
144
|
-
|
|
141
|
+
uikitUtil.$$('[autofocus]', el).some((el) => uikitUtil.isVisible(el) ? el.focus() || true : el.blur());
|
|
145
142
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
if (changed) {
|
|
144
|
+
uikitUtil.trigger(el, 'toggled', [toggled, this]);
|
|
145
|
+
this.$update(el);
|
|
146
|
+
}
|
|
147
|
+
} } };
|
|
149
148
|
|
|
150
|
-
toggled = Boolean(toggled);
|
|
151
149
|
|
|
152
|
-
var changed;
|
|
153
|
-
if (this.cls) {
|
|
154
|
-
changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls);
|
|
155
|
-
changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled);
|
|
156
|
-
} else {
|
|
157
|
-
changed = toggled === el.hidden;
|
|
158
|
-
changed && (el.hidden = !toggled);
|
|
159
|
-
}
|
|
160
150
|
|
|
161
|
-
|
|
151
|
+
function toggleHeight(_ref3) {let { isToggled, duration, initProps, hideProps, transition, _toggle } = _ref3;
|
|
152
|
+
return (el, show) => {
|
|
153
|
+
const inProgress = uikitUtil.Transition.inProgress(el);
|
|
154
|
+
const inner = el.hasChildNodes ?
|
|
155
|
+
uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) +
|
|
156
|
+
uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) :
|
|
157
|
+
0;
|
|
158
|
+
const currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0;
|
|
162
159
|
|
|
163
|
-
|
|
164
|
-
uikitUtil.trigger(el, 'toggled', [toggled, this]);
|
|
165
|
-
this.$update(el);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
160
|
+
uikitUtil.Transition.cancel(el);
|
|
168
161
|
|
|
162
|
+
if (!isToggled(el)) {
|
|
163
|
+
_toggle(el, true);
|
|
169
164
|
}
|
|
170
165
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
// Update child components first
|
|
196
|
-
uikitUtil.fastdom.flush();
|
|
197
|
-
|
|
198
|
-
var endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner);
|
|
199
|
-
uikitUtil.height(el, currentHeight);
|
|
200
|
-
|
|
201
|
-
return (show
|
|
202
|
-
? uikitUtil.Transition.start(el, uikitUtil.assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition)
|
|
203
|
-
: uikitUtil.Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); })
|
|
204
|
-
).then(function () { return uikitUtil.css(el, initProps); });
|
|
205
|
-
|
|
206
|
-
};
|
|
166
|
+
uikitUtil.height(el, '');
|
|
167
|
+
|
|
168
|
+
// Update child components first
|
|
169
|
+
uikitUtil.fastdom.flush();
|
|
170
|
+
|
|
171
|
+
const endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner);
|
|
172
|
+
uikitUtil.height(el, currentHeight);
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
show ?
|
|
176
|
+
uikitUtil.Transition.start(
|
|
177
|
+
el,
|
|
178
|
+
uikitUtil.assign({}, initProps, { overflow: 'hidden', height: endHeight }),
|
|
179
|
+
Math.round(duration * (1 - currentHeight / endHeight)),
|
|
180
|
+
transition) :
|
|
181
|
+
|
|
182
|
+
uikitUtil.Transition.start(
|
|
183
|
+
el,
|
|
184
|
+
hideProps,
|
|
185
|
+
Math.round(duration * (currentHeight / endHeight)),
|
|
186
|
+
transition).
|
|
187
|
+
then(() => _toggle(el, false))).
|
|
188
|
+
then(() => uikitUtil.css(el, initProps));
|
|
189
|
+
};
|
|
207
190
|
}
|
|
208
191
|
|
|
209
192
|
function toggleAnimation(cmp) {
|
|
210
|
-
|
|
193
|
+
return (el, show) => {
|
|
194
|
+
uikitUtil.Animation.cancel(el);
|
|
211
195
|
|
|
212
|
-
|
|
196
|
+
const { animation, duration, _toggle } = cmp;
|
|
213
197
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
198
|
+
if (show) {
|
|
199
|
+
_toggle(el, true);
|
|
200
|
+
return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin);
|
|
201
|
+
}
|
|
217
202
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin);
|
|
221
|
-
}
|
|
203
|
+
return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(() =>
|
|
204
|
+
_toggle(el, false));
|
|
222
205
|
|
|
223
|
-
|
|
224
|
-
};
|
|
206
|
+
};
|
|
225
207
|
}
|
|
226
208
|
|
|
227
209
|
var Position = {
|
|
210
|
+
props: {
|
|
211
|
+
pos: String,
|
|
212
|
+
offset: null,
|
|
213
|
+
flip: Boolean,
|
|
214
|
+
clsPos: String },
|
|
228
215
|
|
|
229
|
-
props: {
|
|
230
|
-
pos: String,
|
|
231
|
-
offset: null,
|
|
232
|
-
flip: Boolean,
|
|
233
|
-
clsPos: String
|
|
234
|
-
},
|
|
235
216
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
},
|
|
217
|
+
data: {
|
|
218
|
+
pos: "bottom-" + (uikitUtil.isRtl ? 'right' : 'left'),
|
|
219
|
+
flip: true,
|
|
220
|
+
offset: false,
|
|
221
|
+
clsPos: '' },
|
|
242
222
|
|
|
243
|
-
computed: {
|
|
244
|
-
|
|
245
|
-
pos: function(ref) {
|
|
246
|
-
var pos = ref.pos;
|
|
247
|
-
|
|
248
|
-
return pos.split('-').concat('center').slice(0, 2);
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
dir: function() {
|
|
252
|
-
return this.pos[0];
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
align: function() {
|
|
256
|
-
return this.pos[1];
|
|
257
|
-
}
|
|
258
223
|
|
|
224
|
+
computed: {
|
|
225
|
+
pos(_ref) {let { pos } = _ref;
|
|
226
|
+
return pos.split('-').concat('center').slice(0, 2);
|
|
259
227
|
},
|
|
260
228
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
positionAt: function(element, target, boundary) {
|
|
264
|
-
|
|
265
|
-
uikitUtil.removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?"));
|
|
266
|
-
|
|
267
|
-
var ref = this;
|
|
268
|
-
var offset = ref.offset;
|
|
269
|
-
var axis = this.getAxis();
|
|
270
|
-
|
|
271
|
-
if (!uikitUtil.isNumeric(offset)) {
|
|
272
|
-
var node = uikitUtil.$(offset);
|
|
273
|
-
offset = node
|
|
274
|
-
? uikitUtil.offset(node)[axis === 'x' ? 'left' : 'top'] - uikitUtil.offset(target)[axis === 'x' ? 'right' : 'bottom']
|
|
275
|
-
: 0;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
var ref$1 = uikitUtil.positionAt(
|
|
279
|
-
element,
|
|
280
|
-
target,
|
|
281
|
-
axis === 'x' ? ((uikitUtil.flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (uikitUtil.flipPosition(this.dir))),
|
|
282
|
-
axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)),
|
|
283
|
-
axis === 'x' ? ("" + (this.dir === 'left' ? -offset : offset)) : (" " + (this.dir === 'top' ? -offset : offset)),
|
|
284
|
-
null,
|
|
285
|
-
this.flip,
|
|
286
|
-
boundary
|
|
287
|
-
).target;
|
|
288
|
-
var x = ref$1.x;
|
|
289
|
-
var y = ref$1.y;
|
|
290
|
-
|
|
291
|
-
this.dir = axis === 'x' ? x : y;
|
|
292
|
-
this.align = axis === 'x' ? y : x;
|
|
293
|
-
|
|
294
|
-
uikitUtil.toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false);
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
getAxis: function() {
|
|
299
|
-
return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
var obj;
|
|
307
|
-
|
|
308
|
-
var Component = {
|
|
309
|
-
|
|
310
|
-
mixins: [Container, Togglable, Position],
|
|
311
|
-
|
|
312
|
-
args: 'title',
|
|
313
|
-
|
|
314
|
-
props: {
|
|
315
|
-
delay: Number,
|
|
316
|
-
title: String
|
|
229
|
+
dir() {
|
|
230
|
+
return this.pos[0];
|
|
317
231
|
},
|
|
318
232
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
233
|
+
align() {
|
|
234
|
+
return this.pos[1];
|
|
235
|
+
} },
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
methods: {
|
|
239
|
+
positionAt(element, target, boundary) {
|
|
240
|
+
uikitUtil.removeClasses(element, this.clsPos + "-(top|bottom|left|right)(-[a-z]+)?");
|
|
241
|
+
|
|
242
|
+
let { offset } = this;
|
|
243
|
+
const axis = this.getAxis();
|
|
244
|
+
|
|
245
|
+
if (!uikitUtil.isNumeric(offset)) {
|
|
246
|
+
const node = uikitUtil.$(offset);
|
|
247
|
+
offset = node ?
|
|
248
|
+
uikitUtil.offset(node)[axis === 'x' ? 'left' : 'top'] -
|
|
249
|
+
uikitUtil.offset(target)[axis === 'x' ? 'right' : 'bottom'] :
|
|
250
|
+
0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const { x, y } = uikitUtil.positionAt(
|
|
254
|
+
element,
|
|
255
|
+
target,
|
|
256
|
+
axis === 'x' ?
|
|
257
|
+
uikitUtil.flipPosition(this.dir) + " " + this.align :
|
|
258
|
+
this.align + " " + uikitUtil.flipPosition(this.dir),
|
|
259
|
+
axis === 'x' ? this.dir + " " + this.align : this.align + " " + this.dir,
|
|
260
|
+
axis === 'x' ? "" + (
|
|
261
|
+
this.dir === 'left' ? -offset : offset) : " " + (
|
|
262
|
+
this.dir === 'top' ? -offset : offset),
|
|
263
|
+
null,
|
|
264
|
+
this.flip,
|
|
265
|
+
boundary).
|
|
266
|
+
target;
|
|
267
|
+
|
|
268
|
+
this.dir = axis === 'x' ? x : y;
|
|
269
|
+
this.align = axis === 'x' ? y : x;
|
|
270
|
+
|
|
271
|
+
uikitUtil.toggleClass(element, this.clsPos + "-" + this.dir + "-" + this.align, this.offset === false);
|
|
327
272
|
},
|
|
328
273
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
this.updateAria(false);
|
|
333
|
-
makeFocusable(this.$el);
|
|
334
|
-
},
|
|
274
|
+
getAxis() {
|
|
275
|
+
return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
|
|
276
|
+
} } };
|
|
335
277
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
278
|
+
var Component = {
|
|
279
|
+
mixins: [Container, Togglable, Position],
|
|
280
|
+
|
|
281
|
+
args: 'title',
|
|
282
|
+
|
|
283
|
+
props: {
|
|
284
|
+
delay: Number,
|
|
285
|
+
title: String },
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
data: {
|
|
289
|
+
pos: 'top',
|
|
290
|
+
title: '',
|
|
291
|
+
delay: 0,
|
|
292
|
+
animation: ['uk-animation-scale-up'],
|
|
293
|
+
duration: 100,
|
|
294
|
+
cls: 'uk-active',
|
|
295
|
+
clsPos: 'uk-tooltip' },
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
beforeConnect() {
|
|
299
|
+
this._hasTitle = uikitUtil.hasAttr(this.$el, 'title');
|
|
300
|
+
uikitUtil.attr(this.$el, 'title', '');
|
|
301
|
+
this.updateAria(false);
|
|
302
|
+
makeFocusable(this.$el);
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
disconnected() {
|
|
306
|
+
this.hide();
|
|
307
|
+
uikitUtil.attr(this.$el, 'title', this._hasTitle ? this.title : null);
|
|
308
|
+
},
|
|
309
|
+
|
|
310
|
+
methods: {
|
|
311
|
+
show() {
|
|
312
|
+
if (this.isToggled(this.tooltip || null) || !this.title) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
this._unbind = uikitUtil.once(
|
|
317
|
+
document, "show keydown " +
|
|
318
|
+
uikitUtil.pointerDown,
|
|
319
|
+
this.hide,
|
|
320
|
+
false,
|
|
321
|
+
(e) =>
|
|
322
|
+
e.type === uikitUtil.pointerDown && !uikitUtil.within(e.target, this.$el) ||
|
|
323
|
+
e.type === 'keydown' && e.keyCode === 27 ||
|
|
324
|
+
e.type === 'show' && e.detail[0] !== this && e.detail[0].$name === this.$name);
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
clearTimeout(this.showTimer);
|
|
328
|
+
this.showTimer = setTimeout(this._show, this.delay);
|
|
339
329
|
},
|
|
340
330
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if (this.isToggled(this.tooltip || null) || !this.title) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
this._unbind = uikitUtil.once(document, ("show keydown " + uikitUtil.pointerDown), this.hide, false, function (e) { return e.type === uikitUtil.pointerDown && !uikitUtil.within(e.target, this$1$1.$el)
|
|
352
|
-
|| e.type === 'keydown' && e.keyCode === 27
|
|
353
|
-
|| e.type === 'show' && e.detail[0] !== this$1$1 && e.detail[0].$name === this$1$1.$name; }
|
|
354
|
-
);
|
|
331
|
+
async hide() {
|
|
332
|
+
if (uikitUtil.matches(this.$el, 'input:focus')) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
355
335
|
|
|
356
|
-
|
|
357
|
-
this.showTimer = setTimeout(this._show, this.delay);
|
|
358
|
-
},
|
|
336
|
+
clearTimeout(this.showTimer);
|
|
359
337
|
|
|
360
|
-
|
|
361
|
-
|
|
338
|
+
if (!this.isToggled(this.tooltip || null)) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
362
341
|
|
|
342
|
+
await this.toggleElement(this.tooltip, false, false);
|
|
343
|
+
uikitUtil.remove(this.tooltip);
|
|
344
|
+
this.tooltip = null;
|
|
345
|
+
this._unbind();
|
|
346
|
+
},
|
|
363
347
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (!this.isToggled(this.tooltip || null)) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
this.toggleElement(this.tooltip, false, false).then(function () {
|
|
375
|
-
uikitUtil.remove(this$1$1.tooltip);
|
|
376
|
-
this$1$1.tooltip = null;
|
|
377
|
-
this$1$1._unbind();
|
|
378
|
-
});
|
|
379
|
-
},
|
|
380
|
-
|
|
381
|
-
_show: function() {
|
|
382
|
-
var this$1$1 = this;
|
|
348
|
+
_show() {
|
|
349
|
+
this.tooltip = uikitUtil.append(
|
|
350
|
+
this.container, "<div class=\"" +
|
|
351
|
+
this.clsPos + "\"> <div class=\"" +
|
|
352
|
+
this.clsPos + "-inner\">" + this.title + "</div> </div>");
|
|
383
353
|
|
|
384
354
|
|
|
385
|
-
this.tooltip = uikitUtil.append(this.container,
|
|
386
|
-
("<div class=\"" + (this.clsPos) + "\"> <div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div> </div>")
|
|
387
|
-
);
|
|
388
355
|
|
|
389
|
-
|
|
356
|
+
uikitUtil.on(this.tooltip, 'toggled', (e, toggled) => {
|
|
357
|
+
this.updateAria(toggled);
|
|
390
358
|
|
|
391
|
-
|
|
359
|
+
if (!toggled) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
392
362
|
|
|
393
|
-
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
363
|
+
this.positionAt(this.tooltip, this.$el);
|
|
396
364
|
|
|
397
|
-
|
|
365
|
+
this.origin =
|
|
366
|
+
this.getAxis() === 'y' ?
|
|
367
|
+
uikitUtil.flipPosition(this.dir) + "-" + this.align :
|
|
368
|
+
this.align + "-" + uikitUtil.flipPosition(this.dir);
|
|
369
|
+
});
|
|
398
370
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
: ((this$1$1.align) + "-" + (uikitUtil.flipPosition(this$1$1.dir)));
|
|
402
|
-
});
|
|
371
|
+
this.toggleElement(this.tooltip, true);
|
|
372
|
+
},
|
|
403
373
|
|
|
404
|
-
|
|
374
|
+
updateAria(toggled) {
|
|
375
|
+
uikitUtil.attr(this.$el, 'aria-expanded', toggled);
|
|
376
|
+
} },
|
|
405
377
|
|
|
406
|
-
},
|
|
407
378
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
379
|
+
events: {
|
|
380
|
+
focus: 'show',
|
|
381
|
+
blur: 'hide',
|
|
411
382
|
|
|
383
|
+
[uikitUtil.pointerEnter + " " + uikitUtil.pointerLeave](e) {
|
|
384
|
+
if (!uikitUtil.isTouch(e)) {
|
|
385
|
+
this[e.type === uikitUtil.pointerEnter ? 'show' : 'hide']();
|
|
386
|
+
}
|
|
412
387
|
},
|
|
413
388
|
|
|
414
|
-
|
|
389
|
+
// Clicking a button does not give it focus on all browsers and platforms
|
|
390
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
|
|
391
|
+
[uikitUtil.pointerDown](e) {
|
|
392
|
+
if (uikitUtil.isTouch(e)) {
|
|
393
|
+
this.show();
|
|
394
|
+
}
|
|
395
|
+
} } };
|
|
415
396
|
|
|
416
|
-
focus: 'show',
|
|
417
|
-
blur: 'hide'
|
|
418
397
|
|
|
419
|
-
}, obj[(uikitUtil.pointerEnter + " " + uikitUtil.pointerLeave)] = function (e) {
|
|
420
|
-
if (!uikitUtil.isTouch(e)) {
|
|
421
|
-
this[e.type === uikitUtil.pointerEnter ? 'show' : 'hide']();
|
|
422
|
-
}
|
|
423
|
-
}, obj[uikitUtil.pointerDown] = function (e) {
|
|
424
|
-
if (uikitUtil.isTouch(e)) {
|
|
425
|
-
this.show();
|
|
426
|
-
}
|
|
427
|
-
}, obj )
|
|
428
|
-
|
|
429
|
-
};
|
|
430
398
|
|
|
431
399
|
function makeFocusable(el) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
400
|
+
if (!uikitUtil.isFocusable(el)) {
|
|
401
|
+
uikitUtil.attr(el, 'tabindex', '0');
|
|
402
|
+
}
|
|
435
403
|
}
|
|
436
404
|
|
|
437
405
|
if (typeof window !== 'undefined' && window.UIkit) {
|
|
438
|
-
|
|
406
|
+
window.UIkit.component('tooltip', Component);
|
|
439
407
|
}
|
|
440
408
|
|
|
441
409
|
return Component;
|