uikit 3.25.20-dev.e4f47fc → 3.25.21-dev.a074036

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 (201) hide show
  1. package/CHANGELOG.md +4 -29
  2. package/build/prefix.js +1 -1
  3. package/build/publishDev.js +1 -1
  4. package/build/scope.js +1 -1
  5. package/build/scss.js +1 -1
  6. package/dist/css/uikit-core-rtl.css +917 -1045
  7. package/dist/css/uikit-core-rtl.min.css +1 -1
  8. package/dist/css/uikit-core.css +917 -1045
  9. package/dist/css/uikit-core.min.css +1 -1
  10. package/dist/css/uikit-rtl.css +936 -1064
  11. package/dist/css/uikit-rtl.min.css +1 -1
  12. package/dist/css/uikit.css +936 -1064
  13. package/dist/css/uikit.min.css +1 -1
  14. package/dist/js/components/countdown.js +1 -1
  15. package/dist/js/components/countdown.min.js +1 -1
  16. package/dist/js/components/filter.js +1 -1
  17. package/dist/js/components/filter.min.js +1 -1
  18. package/dist/js/components/lightbox-panel.js +133 -134
  19. package/dist/js/components/lightbox-panel.min.js +1 -1
  20. package/dist/js/components/lightbox.js +134 -135
  21. package/dist/js/components/lightbox.min.js +1 -1
  22. package/dist/js/components/notification.js +1 -1
  23. package/dist/js/components/notification.min.js +1 -1
  24. package/dist/js/components/parallax.js +12 -8
  25. package/dist/js/components/parallax.min.js +1 -1
  26. package/dist/js/components/slider-parallax.js +12 -8
  27. package/dist/js/components/slider-parallax.min.js +1 -1
  28. package/dist/js/components/slider.js +26 -42
  29. package/dist/js/components/slider.min.js +1 -1
  30. package/dist/js/components/slideshow-parallax.js +12 -8
  31. package/dist/js/components/slideshow-parallax.min.js +1 -1
  32. package/dist/js/components/slideshow.js +103 -72
  33. package/dist/js/components/slideshow.min.js +1 -1
  34. package/dist/js/components/sortable.js +1 -1
  35. package/dist/js/components/sortable.min.js +1 -1
  36. package/dist/js/components/tooltip.js +19 -19
  37. package/dist/js/components/tooltip.min.js +1 -1
  38. package/dist/js/components/upload.js +1 -1
  39. package/dist/js/components/upload.min.js +1 -1
  40. package/dist/js/uikit-core.js +267 -752
  41. package/dist/js/uikit-core.min.js +1 -1
  42. package/dist/js/uikit-icons.js +1 -1
  43. package/dist/js/uikit-icons.min.js +1 -1
  44. package/dist/js/uikit.js +380 -628
  45. package/dist/js/uikit.min.js +1 -1
  46. package/package.json +2 -2
  47. package/src/js/api/component.js +3 -2
  48. package/src/js/api/observables.js +4 -2
  49. package/src/js/api/options.js +3 -6
  50. package/src/js/api/props.js +4 -1
  51. package/src/js/api/state.js +8 -7
  52. package/src/js/components/index.js +0 -1
  53. package/src/js/components/internal/lightbox-animations.js +26 -7
  54. package/src/js/components/internal/slideshow-animations.js +62 -15
  55. package/src/js/components/lightbox-panel.js +96 -121
  56. package/src/js/components/lightbox.js +8 -5
  57. package/src/js/components/tooltip.js +2 -4
  58. package/src/js/core/accordion.js +29 -78
  59. package/src/js/core/drop.js +11 -5
  60. package/src/js/core/dropnav.js +3 -3
  61. package/src/js/core/grid.js +19 -5
  62. package/src/js/core/height-match.js +2 -1
  63. package/src/js/core/margin.js +0 -3
  64. package/src/js/core/overflow-fade.js +5 -5
  65. package/src/js/core/sticky.js +1 -1
  66. package/src/js/core/switcher.js +44 -24
  67. package/src/js/core/video.js +15 -172
  68. package/src/js/mixin/internal/slideshow-animations.js +13 -5
  69. package/src/js/mixin/internal/slideshow-transitioner.js +2 -2
  70. package/src/js/mixin/modal.js +3 -4
  71. package/src/js/mixin/parallax.js +4 -1
  72. package/src/js/mixin/position.js +1 -1
  73. package/src/js/mixin/slider-nav.js +2 -2
  74. package/src/js/mixin/slider-parallax.js +38 -9
  75. package/src/js/mixin/togglable.js +14 -13
  76. package/src/js/util/attr.js +7 -7
  77. package/src/js/util/class.js +1 -1
  78. package/src/js/util/dom.js +4 -3
  79. package/src/js/util/lang.js +1 -1
  80. package/src/js/util/player.js +4 -4
  81. package/src/js/util/style.js +15 -10
  82. package/src/js/util/viewport.js +25 -22
  83. package/src/less/components/_import.less +1 -6
  84. package/src/less/components/base.less +1 -1
  85. package/src/less/components/button.less +1 -1
  86. package/src/less/components/form.less +5 -5
  87. package/src/less/components/grid.less +65 -58
  88. package/src/less/components/margin.less +124 -155
  89. package/src/less/components/nav.less +1 -1
  90. package/src/less/components/padding.less +9 -9
  91. package/src/less/components/text.less +0 -6
  92. package/src/less/components/utility.less +163 -0
  93. package/src/less/theme/_import.less +1 -5
  94. package/src/less/theme/utility.less +32 -0
  95. package/src/scss/components/_import.scss +1 -6
  96. package/src/scss/components/base.scss +1 -1
  97. package/src/scss/components/button.scss +1 -1
  98. package/src/scss/components/form.scss +5 -5
  99. package/src/scss/components/grid.scss +64 -57
  100. package/src/scss/components/margin.scss +124 -155
  101. package/src/scss/components/nav.scss +1 -1
  102. package/src/scss/components/padding.scss +9 -9
  103. package/src/scss/components/text.scss +0 -6
  104. package/src/scss/components/utility.scss +129 -0
  105. package/src/scss/mixins-theme.scss +33 -42
  106. package/src/scss/mixins.scss +30 -39
  107. package/src/scss/variables-theme.scss +14 -14
  108. package/src/scss/variables.scss +14 -14
  109. package/tests/accordion.html +10 -77
  110. package/tests/alert.html +1 -1
  111. package/tests/align.html +5 -5
  112. package/tests/animation.html +4 -4
  113. package/tests/article.html +7 -7
  114. package/tests/background.html +2 -2
  115. package/tests/badge.html +1 -1
  116. package/tests/base.html +3 -3
  117. package/tests/button.html +1 -1
  118. package/tests/card.html +15 -15
  119. package/tests/close.html +2 -2
  120. package/tests/comment.html +9 -9
  121. package/tests/container.html +2 -2
  122. package/tests/countdown.html +21 -21
  123. package/tests/cover.html +6 -6
  124. package/tests/description-list.html +1 -1
  125. package/tests/divider.html +3 -3
  126. package/tests/dotnav.html +1 -1
  127. package/tests/drop.html +7 -7
  128. package/tests/dropbar.html +5 -5
  129. package/tests/dropdown.html +1 -1
  130. package/tests/dropnav.html +18 -18
  131. package/tests/filter.html +3 -3
  132. package/tests/form.html +14 -14
  133. package/tests/grid.html +47 -41
  134. package/tests/heading.html +2 -2
  135. package/tests/height-viewport.html +4 -4
  136. package/tests/height.html +5 -5
  137. package/tests/icon.html +8 -8
  138. package/tests/image.html +6 -6
  139. package/tests/index.html +13 -13
  140. package/tests/js/index.js +1 -1
  141. package/tests/leader.html +5 -5
  142. package/tests/lightbox.html +14 -14
  143. package/tests/link.html +1 -1
  144. package/tests/list.html +4 -4
  145. package/tests/margin.html +7 -7
  146. package/tests/marker.html +3 -3
  147. package/tests/modal.html +4 -4
  148. package/tests/nav.html +5 -5
  149. package/tests/navbar.html +27 -27
  150. package/tests/notification.html +2 -2
  151. package/tests/offcanvas.html +12 -12
  152. package/tests/overlay.html +3 -3
  153. package/tests/padding.html +1 -1
  154. package/tests/pagination.html +3 -3
  155. package/tests/parallax.html +1 -1
  156. package/tests/position.html +6 -6
  157. package/tests/scrollspy.html +12 -12
  158. package/tests/search.html +5 -5
  159. package/tests/section.html +17 -17
  160. package/tests/slidenav.html +3 -3
  161. package/tests/slider.html +5 -5
  162. package/tests/slideshow.html +4 -34
  163. package/tests/sortable.html +15 -15
  164. package/tests/sticky-navbar.html +4 -4
  165. package/tests/sticky-parallax.html +3 -3
  166. package/tests/sticky.html +3 -3
  167. package/tests/svg.html +2 -3
  168. package/tests/switcher.html +6 -6
  169. package/tests/tab.html +4 -4
  170. package/tests/text.html +3 -3
  171. package/tests/tile.html +4 -4
  172. package/tests/toggle.html +1 -1
  173. package/tests/tooltip.html +3 -3
  174. package/tests/totop.html +2 -2
  175. package/tests/transition.html +1 -1
  176. package/tests/upload.html +5 -5
  177. package/tests/utility.html +116 -16
  178. package/tests/video.html +27 -227
  179. package/tests/visibility.html +4 -4
  180. package/tests/width.html +12 -12
  181. package/dist/js/components/marquee.js +0 -179
  182. package/dist/js/components/marquee.min.js +0 -1
  183. package/src/js/components/marquee.js +0 -123
  184. package/src/js/mixin/connect.js +0 -55
  185. package/src/js/mixin/scroll-driven.js +0 -57
  186. package/src/less/components/dropcap.less +0 -71
  187. package/src/less/components/floating-shadow.less +0 -66
  188. package/src/less/components/logo.less +0 -94
  189. package/src/less/components/marquee.less +0 -133
  190. package/src/less/theme/dropcap.less +0 -29
  191. package/src/less/theme/floating-shadow.less +0 -20
  192. package/src/less/theme/logo.less +0 -29
  193. package/src/less/theme/marquee.less +0 -14
  194. package/src/scss/components/dropcap.scss +0 -63
  195. package/src/scss/components/floating-shadow.scss +0 -63
  196. package/src/scss/components/logo.scss +0 -75
  197. package/src/scss/components/marquee.scss +0 -136
  198. package/tests/dropcap.html +0 -26
  199. package/tests/floating-shadow.html +0 -44
  200. package/tests/logo.html +0 -84
  201. package/tests/marquee.html +0 -617
@@ -6,7 +6,6 @@ import {
6
6
  css,
7
7
  dimensions,
8
8
  filter,
9
- findIndex,
10
9
  getIndex,
11
10
  hasClass,
12
11
  includes,
@@ -23,14 +22,15 @@ import {
23
22
  import { generateId } from '../api/instance';
24
23
  import { lazyload } from '../api/observables';
25
24
  import Class from '../mixin/class';
26
- import Connect from '../mixin/connect';
27
25
  import { maybeDefaultPreventClick } from '../mixin/event';
26
+ import Togglable from '../mixin/togglable';
28
27
  import { keyMap } from '../util/keys';
29
28
 
30
29
  export default {
31
- mixins: [Class, Connect],
30
+ mixins: [Class, Togglable],
32
31
 
33
32
  props: {
33
+ animation: Boolean,
34
34
  targets: String,
35
35
  active: null,
36
36
  collapsible: Boolean,
@@ -38,25 +38,18 @@ export default {
38
38
  toggle: String,
39
39
  content: String,
40
40
  offset: Number,
41
- switcherConnect: String,
42
41
  },
43
42
 
44
43
  data: {
45
44
  targets: '> *',
46
45
  active: false,
47
- animation: [true],
46
+ animation: true,
48
47
  collapsible: true,
49
48
  multiple: false,
50
49
  clsOpen: 'uk-open',
51
- cls: 'uk-active',
52
50
  toggle: '.uk-accordion-title',
53
51
  content: '.uk-accordion-content',
54
52
  offset: 0,
55
- switcherConnect: '',
56
- },
57
-
58
- beforeConnect() {
59
- this.connect = this.$props.connect = this.switcherConnect;
60
53
  },
61
54
 
62
55
  computed: {
@@ -86,13 +79,6 @@ export default {
86
79
  }
87
80
  },
88
81
 
89
- connectChildren() {
90
- this.showConnects(
91
- findIndex(this.items, (el) => hasClass(el, this.clsOpen)),
92
- false,
93
- );
94
- },
95
-
96
82
  toggles() {
97
83
  this.$emit();
98
84
  },
@@ -160,86 +146,51 @@ export default {
160
146
  }
161
147
 
162
148
  toggle.id = generateId(this, toggle);
149
+ content.id = generateId(this, content);
163
150
 
164
151
  const active = includes(activeItems, this.items[index]);
165
-
166
- attr(content, {
167
- id: generateId(this, content),
168
- role: 'region',
169
- 'aria-labelledby': toggle.id,
170
- });
171
- if (isTag(content, 'ul')) {
172
- attr(children(content), 'role', 'presentation');
173
- }
174
-
175
- const controls = [content.id];
176
- for (const { children } of this.connects) {
177
- const item = children[index];
178
-
179
- if (!item) {
180
- continue;
181
- }
182
-
183
- attr(item, {
184
- id: generateId(this, item),
185
- role: 'tabpanel',
186
- 'aria-labelledby': toggle.id,
187
- });
188
- controls.push(item.id);
189
- }
190
-
191
152
  attr(toggle, {
192
153
  role: isTag(toggle, 'a') ? 'button' : null,
193
- 'aria-controls': controls.join(' '),
154
+ 'aria-controls': content.id,
194
155
  'aria-expanded': active,
195
156
  'aria-disabled': !this.collapsible && activeItems.length < 2 && active,
196
157
  });
158
+
159
+ attr(content, { role: 'region', 'aria-labelledby': toggle.id });
160
+ if (isTag(content, 'ul')) {
161
+ attr(children(content), 'role', 'presentation');
162
+ }
197
163
  }
198
164
  },
199
165
 
200
166
  methods: {
201
- async toggle(item, animate) {
202
- animate = animate !== false;
203
-
204
- const next = getIndex(item, this.items);
205
-
206
- item = this.items[next];
167
+ toggle(item, animate) {
168
+ item = this.items[getIndex(item, this.items)];
207
169
  let items = [item];
208
170
  const activeItems = filter(this.items, `.${this.clsOpen}`);
209
- const isActive = includes(activeItems, item);
210
171
 
211
- if (isActive && !this.collapsible && activeItems.length < 2) {
212
- return;
172
+ if (!this.multiple && !includes(activeItems, items[0])) {
173
+ items = items.concat(activeItems);
213
174
  }
214
175
 
215
- if (!isActive && !this.multiple) {
216
- items.push(...activeItems);
176
+ if (!this.collapsible && activeItems.length < 2 && includes(activeItems, item)) {
177
+ items = [];
217
178
  }
218
179
 
219
- const toggle = (el) =>
220
- this.toggleElement(el, !includes(activeItems, el), (el, show) => {
221
- toggleClass(el, this.clsOpen, show);
222
-
223
- if (!animate || !this.hasAnimation) {
224
- hide($(this.content, el), !show);
225
- return;
226
- }
180
+ return Promise.all(
181
+ items.map((el) =>
182
+ this.toggleElement(el, !includes(activeItems, el), (el, show) => {
183
+ toggleClass(el, this.clsOpen, show);
227
184
 
228
- return transition(el, show, this);
229
- });
185
+ if (animate === false || !this.animation) {
186
+ hide($(this.content, el), !show);
187
+ return;
188
+ }
230
189
 
231
- const hideIndex = () => {
232
- const index = findIndex(children(this.connects[0]), (el) => hasClass(el, this.cls));
233
-
234
- return index === next
235
- ? findIndex(this.items, (i) => i !== item && includes(activeItems, i))
236
- : index;
237
- };
238
-
239
- return Promise.all([
240
- ...items.map(toggle),
241
- this.showConnects(isActive ? hideIndex() : next, animate),
242
- ]);
190
+ return transition(el, show, this);
191
+ }),
192
+ ),
193
+ );
243
194
  },
244
195
  },
245
196
  };
@@ -28,6 +28,7 @@ import {
28
28
  query,
29
29
  removeClass,
30
30
  } from 'uikit-util';
31
+ import { generateId } from '../api/instance';
31
32
  import Class from '../mixin/class';
32
33
  import Container from '../mixin/container';
33
34
  import { maybeDefaultPreventClick } from '../mixin/event';
@@ -392,7 +393,6 @@ export default {
392
393
  this.$el.hidden = true;
393
394
 
394
395
  const viewports = this.target.map((target) => getViewport(this.$el, target));
395
- const boundaryOffsets = this.boundary.map((el) => offset(el));
396
396
  const viewportOffset = this.getViewportOffset(this.$el);
397
397
 
398
398
  const dirs = [
@@ -404,7 +404,7 @@ export default {
404
404
  if (this.axis !== axis && includes([axis, true], this.stretch)) {
405
405
  css(this.$el, {
406
406
  [prop]: Math.min(
407
- boundaryOffsets[i][prop],
407
+ offset(this.boundary[i])[prop],
408
408
  viewports[i][prop] - 2 * viewportOffset,
409
409
  ),
410
410
  [`overflow-${axis}`]: 'auto',
@@ -437,11 +437,11 @@ export default {
437
437
  (targetOffset[start] > elOffset[start]
438
438
  ? targetOffset[this.inset ? end : start] -
439
439
  Math.max(
440
- boundaryOffsets[i][start],
440
+ offset(this.boundary[i])[start],
441
441
  viewports[i][start] + viewportOffset,
442
442
  )
443
443
  : Math.min(
444
- boundaryOffsets[i][end],
444
+ offset(this.boundary[i])[end],
445
445
  viewports[i][end] - viewportOffset,
446
446
  ) - targetOffset[this.inset ? start : end]) - positionOffset,
447
447
  [`overflow-${axis}`]: 'auto',
@@ -466,6 +466,12 @@ function createToggleComponent(drop) {
466
466
  if (el) {
467
467
  drop.$create('toggle', el, { target: drop.$el, mode: drop.mode });
468
468
  el.ariaHasPopup = true;
469
+
470
+ const dropEl = drop.$el;
471
+ if (!dropEl.id) {
472
+ dropEl.id = generateId(drop, dropEl);
473
+ }
474
+ attr(el, 'aria-controls', dropEl.id);
469
475
  }
470
476
 
471
477
  return el;
@@ -477,7 +483,7 @@ function listenForResize(drop) {
477
483
  observeViewportResize(update),
478
484
  observeResize(overflowParents(drop.$el).concat(drop.target), update),
479
485
  ];
480
- return () => off.forEach((observer) => observer.disconnect());
486
+ return () => off.map((observer) => observer.disconnect());
481
487
  }
482
488
 
483
489
  function listenForScroll(drop, fn = () => drop.$emit()) {
@@ -286,9 +286,9 @@ export default {
286
286
  const drop = this.getDropdown(target);
287
287
  const adjustHeight = () => {
288
288
  const maxBottom = Math.max(
289
- ...[...parents(target, `.${this.clsDrop}`), target].map(
290
- (el) => offset(el).bottom,
291
- ),
289
+ ...parents(target, `.${this.clsDrop}`)
290
+ .concat(target)
291
+ .map((el) => offset(el).bottom),
292
292
  );
293
293
 
294
294
  offset(this.dropbar, {
@@ -1,4 +1,14 @@
1
- import { addClass, css, isRtl, scrolledOver, sumBy, toFloat, toggleClass, toPx } from 'uikit-util';
1
+ import {
2
+ addClass,
3
+ css,
4
+ hasClass,
5
+ isRtl,
6
+ scrolledOver,
7
+ sumBy,
8
+ toFloat,
9
+ toggleClass,
10
+ toPx,
11
+ } from 'uikit-util';
2
12
  import { scroll } from '../api/observables';
3
13
  import Class from '../mixin/class';
4
14
  import Margin from './margin';
@@ -19,8 +29,7 @@ export default {
19
29
  },
20
30
 
21
31
  data: {
22
- margin: '',
23
- firstRow: 'uk-first-row',
32
+ margin: 'uk-grid-margin',
24
33
  clsStack: 'uk-grid-stack',
25
34
  masonry: false,
26
35
  parallax: 0,
@@ -47,7 +56,7 @@ export default {
47
56
  {
48
57
  read(data) {
49
58
  const { rows } = data;
50
- let { masonry, parallax, parallaxJustify } = this;
59
+ let { masonry, parallax, parallaxJustify, margin } = this;
51
60
 
52
61
  parallax = Math.max(0, toPx(parallax));
53
62
 
@@ -62,7 +71,7 @@ export default {
62
71
  return (data.translates = data.scrollColumns = false);
63
72
  }
64
73
 
65
- let gutter = toFloat(css(this.$el, 'row-gap'));
74
+ let gutter = getGutter(rows, margin);
66
75
 
67
76
  let columns;
68
77
  let translates;
@@ -176,6 +185,11 @@ function applyMasonry(rows, gutter, next) {
176
185
  return [columns, translates];
177
186
  }
178
187
 
188
+ function getGutter(rows, cls) {
189
+ const node = rows.flat().find((el) => hasClass(el, cls));
190
+ return toFloat(node ? css(node, 'marginTop') : css(rows[0][0], 'paddingLeft'));
191
+ }
192
+
179
193
  function transpose(rows) {
180
194
  const columns = [];
181
195
  for (const row of rows) {
@@ -20,7 +20,8 @@ export default {
20
20
  },
21
21
 
22
22
  observe: resize({
23
- target: ({ $el, elements }) => [$el, ...elements.flatMap((el) => [el, ...el.children])],
23
+ target: ({ $el, elements }) =>
24
+ elements.reduce((elements, el) => elements.concat(el, ...el.children), [$el]),
24
25
  }),
25
26
 
26
27
  events: {
@@ -4,13 +4,11 @@ import { mutation, resize } from '../api/observables';
4
4
  export default {
5
5
  props: {
6
6
  margin: String,
7
- firstRow: Boolean,
8
7
  firstColumn: Boolean,
9
8
  },
10
9
 
11
10
  data: {
12
11
  margin: 'uk-margin-small-top',
13
- firstRow: false,
14
12
  firstColumn: 'uk-first-column',
15
13
  },
16
14
 
@@ -54,7 +52,6 @@ export default {
54
52
  for (const row of rows) {
55
53
  for (const el of row) {
56
54
  toggleClass(el, this.margin, rows[0] !== row);
57
- toggleClass(el, this.firstRow, rows[0] === row);
58
55
  toggleClass(el, this.firstColumn, row[isRtl ? row.length - 1 : 0] === el);
59
56
  }
60
57
  }
@@ -55,11 +55,11 @@ export default {
55
55
 
56
56
  update: {
57
57
  read() {
58
- return {
59
- overflow: ['Width', 'Height'].map(
60
- (prop) => this.$el[`scroll${prop}`] - this.$el[`client${prop}`],
61
- ),
62
- };
58
+ const overflow = [];
59
+ for (const prop of ['Width', 'Height']) {
60
+ overflow.push(this.$el[`scroll${prop}`] - this.$el[`client${prop}`]);
61
+ }
62
+ return { overflow };
63
63
  },
64
64
 
65
65
  write({ overflow }) {
@@ -464,7 +464,7 @@ function parseProp(value, el, propOffset, padding) {
464
464
  return 0;
465
465
  }
466
466
 
467
- if (isNumeric(value) || (isString(value) && /^-?\d/.test(value))) {
467
+ if (isNumeric(value) || (isString(value) && value.match(/^-?\d/))) {
468
468
  return propOffset + toPx(value, 'height', el, true);
469
469
  } else {
470
470
  const refElement = value === true ? getVisibleParent(el) : query(value, el);
@@ -9,24 +9,27 @@ import {
9
9
  getIndex,
10
10
  hasClass,
11
11
  isNumeric,
12
+ isTag,
12
13
  matches,
13
14
  queryAll,
15
+ toArray,
14
16
  toggleClass,
15
17
  } from 'uikit-util';
16
18
  import { generateId } from '../api/instance';
17
- import { swipe } from '../api/observables';
18
- import Connect from '../mixin/connect';
19
+ import { lazyload, swipe } from '../api/observables';
19
20
  import { maybeDefaultPreventClick } from '../mixin/event';
21
+ import Togglable from '../mixin/togglable';
20
22
  import { keyMap } from '../util/keys';
21
23
 
22
24
  const selDisabled = '.uk-disabled *, .uk-disabled, [disabled]';
23
25
 
24
26
  export default {
25
- mixins: [Connect],
27
+ mixins: [Togglable],
26
28
 
27
29
  args: 'connect',
28
30
 
29
31
  props: {
32
+ connect: String,
30
33
  toggle: String,
31
34
  itemNav: String,
32
35
  active: Number,
@@ -39,6 +42,7 @@ export default {
39
42
  toggle: '> * > :first-child',
40
43
  itemNav: false,
41
44
  active: 0,
45
+ cls: 'uk-active',
42
46
  attrItem: 'uk-switcher-item',
43
47
  selVertical: '.uk-nav',
44
48
  followFocus: false,
@@ -46,6 +50,15 @@ export default {
46
50
  },
47
51
 
48
52
  computed: {
53
+ connects: {
54
+ get: ({ connect }, $el) => queryAll(connect, $el),
55
+ observe: ({ connect }) => connect,
56
+ },
57
+
58
+ connectChildren() {
59
+ return this.connects.map((el) => children(el)).flat();
60
+ },
61
+
49
62
  toggles: ({ toggle }, $el) => $$(toggle, $el),
50
63
 
51
64
  children(_, $el) {
@@ -82,7 +95,10 @@ export default {
82
95
  this.$el.role = 'tablist';
83
96
  },
84
97
 
85
- observe: swipe({ target: ({ connects }) => connects, filter: ({ swiping }) => swiping }),
98
+ observe: [
99
+ lazyload({ targets: ({ connectChildren }) => connectChildren }),
100
+ swipe({ target: ({ connects }) => connects, filter: ({ swiping }) => swiping }),
101
+ ],
86
102
 
87
103
  events: [
88
104
  {
@@ -164,33 +180,28 @@ export default {
164
180
  ],
165
181
 
166
182
  update() {
183
+ for (const el of this.connects) {
184
+ if (isTag(el, 'ul')) {
185
+ el.role = 'presentation';
186
+ }
187
+ }
167
188
  attr(children(this.$el), 'role', 'presentation');
168
189
 
169
190
  for (const index in this.toggles) {
170
191
  const toggle = this.toggles[index];
171
- toggle.id = generateId(this, toggle);
172
-
173
- const controls = [];
192
+ const item = this.connects[0]?.children[index];
174
193
 
175
- for (const { children } of this.connects) {
176
- const item = children[index];
194
+ toggle.role = 'tab';
177
195
 
178
- if (!item) {
179
- continue;
180
- }
181
-
182
- attr(item, {
183
- id: generateId(this, item),
184
- role: 'tabpanel',
185
- 'aria-labelledby': toggle.id,
186
- });
187
- controls.push(item.id);
196
+ if (!item) {
197
+ continue;
188
198
  }
189
199
 
190
- attr(toggle, {
191
- role: 'tab',
192
- 'aria-controls': controls.join(' '),
193
- });
200
+ toggle.id = generateId(this, toggle);
201
+ item.id = generateId(this, item);
202
+
203
+ attr(toggle, 'aria-controls', item.id);
204
+ attr(item, { role: 'tabpanel', 'aria-labelledby': toggle.id });
194
205
  }
195
206
  attr(this.$el, 'aria-orientation', matches(this.$el, this.selVertical) ? 'vertical' : null);
196
207
  },
@@ -229,7 +240,16 @@ export default {
229
240
  });
230
241
  });
231
242
 
232
- return this.showConnects(next, prev >= 0 && prev !== next);
243
+ const animate = prev >= 0 && prev !== next;
244
+ this.connects.forEach(async ({ children }) => {
245
+ const actives = toArray(children).filter(
246
+ (child, i) => i !== next && hasClass(child, this.cls),
247
+ );
248
+
249
+ if (await this.toggleElement(actives, false, animate)) {
250
+ await this.toggleElement(children[next], true, animate);
251
+ }
252
+ });
233
253
  },
234
254
  },
235
255
  };