uikit 3.11.1 → 3.11.2-dev.03e47c2ff

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.
Files changed (222) hide show
  1. package/.eslintrc.json +4 -49
  2. package/.prettierignore +14 -0
  3. package/.prettierrc.json +13 -0
  4. package/.webstorm.js +3 -3
  5. package/CHANGELOG.md +59 -17
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +127 -201
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +127 -201
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +129 -207
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +129 -207
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +408 -439
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1098 -1316
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1144 -1393
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +345 -362
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +343 -350
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +768 -843
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +343 -350
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +645 -793
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +587 -621
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5430 -6690
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +8143 -9784
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +15 -28
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +14 -33
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +79 -100
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +70 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +14 -25
  70. package/src/js/components/internal/slider-preload.js +37 -0
  71. package/src/js/components/internal/slider-transitioner.js +66 -45
  72. package/src/js/components/internal/slideshow-animations.js +46 -64
  73. package/src/js/components/lightbox-panel.js +107 -105
  74. package/src/js/components/lightbox.js +17 -39
  75. package/src/js/components/notification.js +49 -43
  76. package/src/js/components/parallax.js +21 -46
  77. package/src/js/components/slider-parallax.js +13 -23
  78. package/src/js/components/slider.js +95 -64
  79. package/src/js/components/slideshow-parallax.js +1 -1
  80. package/src/js/components/slideshow.js +15 -13
  81. package/src/js/components/sortable.js +126 -108
  82. package/src/js/components/tooltip.js +41 -31
  83. package/src/js/components/upload.js +52 -63
  84. package/src/js/core/accordion.js +53 -48
  85. package/src/js/core/alert.js +9 -17
  86. package/src/js/core/core.js +74 -53
  87. package/src/js/core/cover.js +11 -15
  88. package/src/js/core/drop.js +107 -93
  89. package/src/js/core/form-custom.js +20 -25
  90. package/src/js/core/gif.js +3 -7
  91. package/src/js/core/grid.js +57 -58
  92. package/src/js/core/height-match.js +16 -29
  93. package/src/js/core/height-viewport.js +29 -36
  94. package/src/js/core/icon.js +47 -52
  95. package/src/js/core/img.js +156 -138
  96. package/src/js/core/index.js +39 -39
  97. package/src/js/core/leader.js +9 -18
  98. package/src/js/core/margin.js +21 -37
  99. package/src/js/core/modal.js +49 -36
  100. package/src/js/core/nav.js +2 -4
  101. package/src/js/core/navbar.js +113 -85
  102. package/src/js/core/offcanvas.js +49 -53
  103. package/src/js/core/overflow-auto.js +13 -17
  104. package/src/js/core/responsive.js +14 -12
  105. package/src/js/core/scroll.js +10 -20
  106. package/src/js/core/scrollspy-nav.js +34 -31
  107. package/src/js/core/scrollspy.js +37 -54
  108. package/src/js/core/sticky.js +194 -123
  109. package/src/js/core/svg.js +68 -83
  110. package/src/js/core/switcher.js +47 -46
  111. package/src/js/core/tab.js +7 -10
  112. package/src/js/core/toggle.js +66 -67
  113. package/src/js/core/video.js +11 -22
  114. package/src/js/mixin/animate.js +19 -20
  115. package/src/js/mixin/class.js +2 -4
  116. package/src/js/mixin/container.js +7 -11
  117. package/src/js/mixin/internal/animate-fade.js +73 -30
  118. package/src/js/mixin/internal/animate-slide.js +58 -41
  119. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  120. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  121. package/src/js/mixin/media.js +5 -10
  122. package/src/js/mixin/modal.js +89 -66
  123. package/src/js/mixin/parallax.js +175 -121
  124. package/src/js/mixin/position.js +26 -20
  125. package/src/js/mixin/slider-autoplay.js +12 -21
  126. package/src/js/mixin/slider-drag.js +64 -65
  127. package/src/js/mixin/slider-nav.js +26 -35
  128. package/src/js/mixin/slider-reactive.js +2 -8
  129. package/src/js/mixin/slider.js +48 -55
  130. package/src/js/mixin/slideshow.js +13 -19
  131. package/src/js/mixin/togglable.js +89 -63
  132. package/src/js/uikit-core.js +2 -4
  133. package/src/js/uikit.js +2 -4
  134. package/src/js/util/ajax.js +25 -40
  135. package/src/js/util/animation.js +77 -75
  136. package/src/js/util/attr.js +17 -21
  137. package/src/js/util/class.js +14 -52
  138. package/src/js/util/dimensions.js +78 -49
  139. package/src/js/util/dom.js +39 -66
  140. package/src/js/util/env.js +7 -12
  141. package/src/js/util/event.js +60 -59
  142. package/src/js/util/fastdom.js +3 -8
  143. package/src/js/util/filter.js +17 -34
  144. package/src/js/util/index.js +0 -1
  145. package/src/js/util/lang.js +82 -121
  146. package/src/js/util/mouse.js +19 -17
  147. package/src/js/util/options.js +35 -49
  148. package/src/js/util/player.js +41 -36
  149. package/src/js/util/position.js +54 -46
  150. package/src/js/util/selector.js +43 -58
  151. package/src/js/util/style.js +39 -49
  152. package/src/js/util/viewport.js +81 -66
  153. package/src/less/components/base.less +10 -33
  154. package/src/less/components/flex.less +0 -9
  155. package/src/less/components/form-range.less +48 -95
  156. package/src/less/components/form.less +0 -1
  157. package/src/less/components/height.less +3 -0
  158. package/src/less/components/leader.less +0 -1
  159. package/src/less/components/lightbox.less +0 -1
  160. package/src/less/components/modal.less +3 -7
  161. package/src/less/components/navbar.less +0 -7
  162. package/src/less/components/progress.less +14 -36
  163. package/src/less/components/slider.less +0 -3
  164. package/src/less/components/slideshow.less +0 -3
  165. package/src/less/components/text.less +16 -32
  166. package/src/less/components/utility.less +22 -0
  167. package/src/scss/components/base.scss +10 -33
  168. package/src/scss/components/flex.scss +0 -9
  169. package/src/scss/components/form-range.scss +48 -95
  170. package/src/scss/components/form.scss +3 -4
  171. package/src/scss/components/height.scss +3 -0
  172. package/src/scss/components/icon.scss +2 -2
  173. package/src/scss/components/leader.scss +0 -1
  174. package/src/scss/components/lightbox.scss +0 -1
  175. package/src/scss/components/modal.scss +3 -7
  176. package/src/scss/components/navbar.scss +0 -7
  177. package/src/scss/components/progress.scss +14 -36
  178. package/src/scss/components/search.scss +1 -1
  179. package/src/scss/components/slider.scss +0 -3
  180. package/src/scss/components/slideshow.scss +0 -3
  181. package/src/scss/components/text.scss +16 -32
  182. package/src/scss/components/utility.scss +22 -0
  183. package/src/scss/mixins-theme.scss +1 -1
  184. package/src/scss/mixins.scss +1 -1
  185. package/src/scss/variables-theme.scss +9 -9
  186. package/src/scss/variables.scss +9 -9
  187. package/tests/align.html +10 -10
  188. package/tests/animation.html +2 -2
  189. package/tests/article.html +2 -2
  190. package/tests/base.html +3 -3
  191. package/tests/card.html +10 -10
  192. package/tests/column.html +3 -3
  193. package/tests/comment.html +9 -9
  194. package/tests/dotnav.html +3 -3
  195. package/tests/image.html +296 -64
  196. package/tests/images/image-type.avif +0 -0
  197. package/tests/images/image-type.jpeg +0 -0
  198. package/tests/images/image-type.webp +0 -0
  199. package/tests/index.html +8 -8
  200. package/tests/js/index.js +114 -85
  201. package/tests/lightbox.html +10 -10
  202. package/tests/marker.html +2 -2
  203. package/tests/modal.html +8 -9
  204. package/tests/navbar.html +2 -2
  205. package/tests/overlay.html +7 -7
  206. package/tests/parallax.html +14 -5
  207. package/tests/position.html +12 -12
  208. package/tests/slidenav.html +12 -12
  209. package/tests/slider.html +20 -20
  210. package/tests/sortable.html +1 -1
  211. package/tests/sticky-parallax.html +86 -98
  212. package/tests/sticky.html +56 -24
  213. package/tests/svg.html +6 -6
  214. package/tests/table.html +11 -11
  215. package/tests/thumbnav.html +12 -12
  216. package/tests/transition.html +30 -30
  217. package/tests/utility.html +33 -33
  218. package/tests/video.html +1 -1
  219. package/tests/width.html +1 -1
  220. package/src/js/mixin/flex-bug.js +0 -56
  221. package/src/js/util/promise.js +0 -191
  222. package/tests/images/animated.gif +0 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.1 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.03e47c2ff | 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
- computed: {
14
+ data: {
15
+ container: true },
20
16
 
21
- container: function(ref) {
22
- var container = ref.container;
23
17
 
24
- return container === true && this.$container || container && uikitUtil.$(container);
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
- props: {
34
- cls: Boolean,
35
- animation: 'list',
36
- duration: Number,
37
- origin: String,
38
- transition: String
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
- data: {
42
- cls: false,
43
- animation: [false],
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
- hasAnimation: function(ref) {
73
- var animation = ref.animation;
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
- return !!animation[0];
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
- methods: {
87
-
88
- toggleElement: function(targets, toggle, animate) {
89
- var this$1$1 = this;
90
-
91
- return new uikitUtil.Promise(function (resolve) { return uikitUtil.Promise.all(uikitUtil.toNodes(targets).map(function (el) {
92
-
93
- var show = uikitUtil.isBoolean(toggle) ? toggle : !this$1$1.isToggled(el);
94
-
95
- if (!uikitUtil.trigger(el, ("before" + (show ? 'show' : 'hide')), [this$1$1])) {
96
- return uikitUtil.Promise.reject();
97
- }
98
-
99
- var promise = (
100
- uikitUtil.isFunction(animate)
101
- ? animate
102
- : animate === false || !this$1$1.hasAnimation
103
- ? this$1$1._toggle
104
- : this$1$1.hasTransition
105
- ? toggleHeight(this$1$1)
106
- : toggleAnimation(this$1$1)
107
- )(el, show);
108
-
109
- var cls = show ? this$1$1.clsEnter : this$1$1.clsLeave;
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
- uikitUtil.addClass(el, cls);
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
- return promise ? promise.then(done, function () {
122
- uikitUtil.removeClass(el, cls);
123
- return uikitUtil.Promise.reject();
124
- }) : done();
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
- })).then(resolve, uikitUtil.noop); }
127
- );
128
- },
125
+ _toggle(el, toggled) {
126
+ if (!el) {
127
+ return;
128
+ }
129
129
 
130
- isToggled: function(el) {
131
- var assign;
130
+ toggled = Boolean(toggled);
132
131
 
133
- if ( el === void 0 ) el = this.$el;
134
- (assign = uikitUtil.toNodes(el), el = assign[0]);
135
- return uikitUtil.hasClass(el, this.clsEnter)
136
- ? true
137
- : uikitUtil.hasClass(el, this.clsLeave)
138
- ? false
139
- : this.cls
140
- ? uikitUtil.hasClass(el, this.cls.split(' ')[0])
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
- _toggle: function(el, toggled) {
141
+ uikitUtil.$$('[autofocus]', el).some((el) => uikitUtil.isVisible(el) ? el.focus() || true : el.blur());
145
142
 
146
- if (!el) {
147
- return;
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
- uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); });
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
- if (changed) {
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
- function toggleHeight(ref) {
174
- var isToggled = ref.isToggled;
175
- var duration = ref.duration;
176
- var initProps = ref.initProps;
177
- var hideProps = ref.hideProps;
178
- var transition = ref.transition;
179
- var _toggle = ref._toggle;
180
-
181
- return function (el, show) {
182
-
183
- var inProgress = uikitUtil.Transition.inProgress(el);
184
- var inner = el.hasChildNodes ? uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) + uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) : 0;
185
- var currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0;
186
-
187
- uikitUtil.Transition.cancel(el);
188
-
189
- if (!isToggled(el)) {
190
- _toggle(el, true);
191
- }
192
-
193
- uikitUtil.height(el, '');
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
+ { ...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
- return function (el, show) {
193
+ return (el, show) => {
194
+ uikitUtil.Animation.cancel(el);
211
195
 
212
- uikitUtil.Animation.cancel(el);
196
+ const { animation, duration, _toggle } = cmp;
213
197
 
214
- var animation = cmp.animation;
215
- var duration = cmp.duration;
216
- var _toggle = cmp._toggle;
198
+ if (show) {
199
+ _toggle(el, true);
200
+ return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin);
201
+ }
217
202
 
218
- if (show) {
219
- _toggle(el, true);
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
- return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); });
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
- data: {
237
- pos: ("bottom-" + (uikitUtil.isRtl ? 'right' : 'left')),
238
- flip: true,
239
- offset: false,
240
- clsPos: ''
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
- methods: {
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
- data: {
320
- pos: 'top',
321
- title: '',
322
- delay: 0,
323
- animation: ['uk-animation-scale-up'],
324
- duration: 100,
325
- cls: 'uk-active',
326
- clsPos: 'uk-tooltip'
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
- beforeConnect: function() {
330
- this._hasTitle = uikitUtil.hasAttr(this.$el, 'title');
331
- uikitUtil.attr(this.$el, 'title', '');
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
- disconnected: function() {
337
- this.hide();
338
- uikitUtil.attr(this.$el, 'title', this._hasTitle ? this.title : null);
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
- methods: {
342
-
343
- show: function() {
344
- var this$1$1 = this;
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
- clearTimeout(this.showTimer);
357
- this.showTimer = setTimeout(this._show, this.delay);
358
- },
336
+ clearTimeout(this.showTimer);
359
337
 
360
- hide: function() {
361
- var this$1$1 = this;
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
- if (uikitUtil.matches(this.$el, 'input:focus')) {
365
- return;
366
- }
367
-
368
- clearTimeout(this.showTimer);
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
- uikitUtil.on(this.tooltip, 'toggled', function (e, toggled) {
356
+ uikitUtil.on(this.tooltip, 'toggled', (e, toggled) => {
357
+ this.updateAria(toggled);
390
358
 
391
- this$1$1.updateAria(toggled);
359
+ if (!toggled) {
360
+ return;
361
+ }
392
362
 
393
- if (!toggled) {
394
- return;
395
- }
363
+ this.positionAt(this.tooltip, this.$el);
396
364
 
397
- this$1$1.positionAt(this$1$1.tooltip, this$1$1.$el);
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
- this$1$1.origin = this$1$1.getAxis() === 'y'
400
- ? ((uikitUtil.flipPosition(this$1$1.dir)) + "-" + (this$1$1.align))
401
- : ((this$1$1.align) + "-" + (uikitUtil.flipPosition(this$1$1.dir)));
402
- });
371
+ this.toggleElement(this.tooltip, true);
372
+ },
403
373
 
404
- this.toggleElement(this.tooltip, true);
374
+ updateAria(toggled) {
375
+ uikitUtil.attr(this.$el, 'aria-expanded', toggled);
376
+ } },
405
377
 
406
- },
407
378
 
408
- updateAria: function(toggled) {
409
- uikitUtil.attr(this.$el, 'aria-expanded', toggled);
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
- events: ( obj = {
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
- if (!uikitUtil.isFocusable(el)) {
433
- uikitUtil.attr(el, 'tabindex', '0');
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
- window.UIkit.component('tooltip', Component);
406
+ window.UIkit.component('tooltip', Component);
439
407
  }
440
408
 
441
409
  return Component;