uikit 3.14.4-dev.a02c81d72 → 3.14.4-dev.ae765cd84

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 (132) hide show
  1. package/CHANGELOG.md +34 -17
  2. package/build/util.js +1 -0
  3. package/dist/css/uikit-core-rtl.css +339 -109
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +339 -109
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +359 -113
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +359 -113
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +1 -1
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +78 -129
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +78 -129
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +4 -5
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +4 -5
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +1 -1
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +4 -5
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +1 -1
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +1 -1
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +92 -145
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +460 -446
  38. package/dist/js/uikit-core.min.js +14 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +460 -446
  42. package/dist/js/uikit.min.js +14 -1
  43. package/package.json +1 -1
  44. package/src/images/{backgrounds/nav-parent-close.svg → components/nav-parent-icon-large.svg} +0 -0
  45. package/src/images/{backgrounds/navbar-parent-close.svg → components/nav-parent-icon.svg} +0 -0
  46. package/src/images/{backgrounds/navbar-parent-open.svg → components/navbar-parent-icon.svg} +1 -1
  47. package/src/images/components/navbar-toggle-icon.svg +22 -3
  48. package/src/js/api/state.js +2 -2
  49. package/src/js/core/accordion.js +9 -17
  50. package/src/js/core/alert.js +35 -14
  51. package/src/js/core/drop.js +89 -62
  52. package/src/js/core/height-viewport.js +4 -2
  53. package/src/js/core/icon.js +16 -0
  54. package/src/js/core/index.js +2 -0
  55. package/src/js/core/leader.js +2 -2
  56. package/src/js/core/navbar.js +30 -45
  57. package/src/js/core/scroll.js +37 -10
  58. package/src/js/core/toggle.js +3 -5
  59. package/src/js/mixin/media.js +4 -5
  60. package/src/js/mixin/modal.js +9 -6
  61. package/src/js/mixin/position.js +24 -26
  62. package/src/js/mixin/style.js +11 -0
  63. package/src/js/mixin/togglable.js +80 -133
  64. package/src/js/util/animation.js +4 -3
  65. package/src/js/util/filter.js +3 -7
  66. package/src/js/util/position.js +107 -107
  67. package/src/js/util/style.js +4 -13
  68. package/src/js/util/viewport.js +3 -5
  69. package/src/less/components/_import.less +1 -0
  70. package/src/less/components/drop.less +1 -18
  71. package/src/less/components/dropbar.less +115 -0
  72. package/src/less/components/dropdown.less +11 -19
  73. package/src/less/components/leader.less +1 -1
  74. package/src/less/components/nav.less +218 -59
  75. package/src/less/components/navbar.less +54 -47
  76. package/src/less/components/utility.less +10 -2
  77. package/src/less/theme/_import.less +1 -0
  78. package/src/less/theme/dropbar.less +44 -0
  79. package/src/less/theme/dropdown.less +0 -11
  80. package/src/less/theme/nav.less +45 -7
  81. package/src/less/theme/navbar.less +1 -5
  82. package/src/scss/components/_import.scss +1 -0
  83. package/src/scss/components/drop.scss +1 -18
  84. package/src/scss/components/dropbar.scss +115 -0
  85. package/src/scss/components/dropdown.scss +11 -19
  86. package/src/scss/components/leader.scss +1 -1
  87. package/src/scss/components/nav.scss +167 -47
  88. package/src/scss/components/navbar.scss +42 -47
  89. package/src/scss/components/utility.scss +8 -1
  90. package/src/scss/mixins-theme.scss +92 -21
  91. package/src/scss/mixins.scss +89 -17
  92. package/src/scss/theme/_import.scss +1 -0
  93. package/src/scss/theme/dropbar.scss +44 -0
  94. package/src/scss/theme/dropdown.scss +0 -8
  95. package/src/scss/theme/nav.scss +43 -7
  96. package/src/scss/theme/navbar.scss +1 -5
  97. package/src/scss/variables-theme.scss +56 -19
  98. package/src/scss/variables.scss +45 -17
  99. package/tests/accordion.html +2 -2
  100. package/tests/alert.html +2 -2
  101. package/tests/countdown.html +1 -1
  102. package/tests/drop.html +442 -412
  103. package/tests/dropbar.html +456 -0
  104. package/tests/dropdown.html +8 -470
  105. package/tests/filter.html +9 -12
  106. package/tests/form.html +1 -1
  107. package/tests/index.html +126 -107
  108. package/tests/js/index.js +1 -4
  109. package/tests/lightbox.html +5 -5
  110. package/tests/list.html +8 -8
  111. package/tests/modal.html +13 -13
  112. package/tests/nav.html +117 -75
  113. package/tests/navbar.html +102 -237
  114. package/tests/offcanvas.html +17 -21
  115. package/tests/parallax.html +1 -1
  116. package/tests/position.html +18 -16
  117. package/tests/progress.html +9 -9
  118. package/tests/scroll.html +7 -10
  119. package/tests/search.html +5 -5
  120. package/tests/slider.html +6 -5
  121. package/tests/slideshow.html +8 -8
  122. package/tests/sortable.html +6 -8
  123. package/tests/sticky-navbar.html +6 -6
  124. package/tests/sticky.html +8 -8
  125. package/tests/switcher.html +1 -1
  126. package/tests/tab.html +1 -1
  127. package/tests/table.html +7 -7
  128. package/tests/toggle.html +2 -2
  129. package/tests/tooltip.html +1 -1
  130. package/tests/upload.html +11 -11
  131. package/tests/utility.html +19 -0
  132. package/src/images/backgrounds/nav-parent-open.svg +0 -3
@@ -19,6 +19,7 @@ import {
19
19
  offset,
20
20
  once,
21
21
  parent,
22
+ parents,
22
23
  query,
23
24
  remove,
24
25
  selFocusable,
@@ -36,7 +37,9 @@ export default {
36
37
  align: String,
37
38
  offset: Number,
38
39
  boundary: Boolean,
39
- boundaryAlign: Boolean,
40
+ target: Boolean,
41
+ targetX: Boolean,
42
+ targetY: Boolean,
40
43
  clsDrop: String,
41
44
  delayShow: Number,
42
45
  delayHide: Number,
@@ -53,9 +56,12 @@ export default {
53
56
  offset: undefined,
54
57
  delayShow: undefined,
55
58
  delayHide: undefined,
56
- boundaryAlign: undefined,
57
- flip: 'x',
59
+ flip: false,
60
+ shift: true,
58
61
  boundary: true,
62
+ target: false,
63
+ targetX: false,
64
+ targetY: false,
59
65
  dropbar: false,
60
66
  dropbarAnchor: false,
61
67
  duration: 200,
@@ -90,7 +96,7 @@ export default {
90
96
  },
91
97
 
92
98
  watch(dropbar) {
93
- addClass(dropbar, 'uk-navbar-dropbar');
99
+ addClass(dropbar, 'uk-dropbar', 'uk-dropbar-top', 'uk-navbar-dropbar');
94
100
  },
95
101
 
96
102
  immediate: true,
@@ -106,7 +112,7 @@ export default {
106
112
 
107
113
  if (this.dropContainer !== $el) {
108
114
  for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
109
- const target = this.getDropdown(el)?.target;
115
+ const target = this.getDropdown(el)?.targetEl;
110
116
  if (!includes(dropdowns, el) && target && within(target, this.$el)) {
111
117
  dropdowns.push(el);
112
118
  }
@@ -168,8 +174,8 @@ export default {
168
174
  if (
169
175
  active &&
170
176
  includes(active.mode, 'hover') &&
171
- active.target &&
172
- !within(active.target, current) &&
177
+ active.targetEl &&
178
+ !within(active.targetEl, current) &&
173
179
  !active.isDelaying
174
180
  ) {
175
181
  active.hide(false);
@@ -191,7 +197,7 @@ export default {
191
197
  if (keyCode === keyMap.DOWN && hasAttr(current, 'aria-expanded')) {
192
198
  e.preventDefault();
193
199
 
194
- if (!active || active.target !== current) {
200
+ if (!active || active.targetEl !== current) {
195
201
  current.click();
196
202
  once(this.dropContainer, 'show', ({ target }) =>
197
203
  focusFirstFocusableElement(target)
@@ -242,7 +248,7 @@ export default {
242
248
  }
243
249
 
244
250
  if (keyCode === keyMap.ESC) {
245
- active?.target?.focus();
251
+ active?.targetEl?.focus();
246
252
  }
247
253
 
248
254
  handleNavItemNavigation(e, this.toggles, active);
@@ -313,39 +319,19 @@ export default {
313
319
  return;
314
320
  }
315
321
 
316
- this._observer = observeResize(target, () =>
322
+ this._observer = observeResize(target, () => {
323
+ const targetOffsets = parents(target, `.${this.clsDrop}`)
324
+ .concat(target)
325
+ .map((el) => offset(el));
326
+ const minTop = Math.min(...targetOffsets.map(({ top }) => top));
327
+ const maxBottom = Math.max(...targetOffsets.map(({ bottom }) => bottom));
328
+ const dropbarOffset = offset(this.dropbar);
329
+ css(this.dropbar, 'top', this.dropbar.offsetTop - (dropbarOffset.top - minTop));
317
330
  this.transitionTo(
318
- offset(target).bottom -
319
- offset(this.dropbar).top +
320
- toFloat(css(target, 'marginBottom')),
331
+ maxBottom - minTop + toFloat(css(target, 'marginBottom')),
321
332
  target
322
- )
323
- );
324
- },
325
- },
326
-
327
- {
328
- name: 'beforeposition',
329
-
330
- el() {
331
- return this.dropContainer;
332
- },
333
-
334
- filter() {
335
- return this.dropbar;
336
- },
337
-
338
- handler(e, element, target, options) {
339
- if (!this.isDropbarDrop(element)) {
340
- return;
341
- }
342
-
343
- const dropbarOffset = offset(this.dropbar);
344
-
345
- css(element, 'maxWidth', dropbarOffset.width - options.viewportOffset * 2);
346
-
347
- options.offset[1] = dropbarOffset.top - offset(target).bottom;
348
- options.viewportOffset += dropbarOffset.left;
333
+ );
334
+ });
349
335
  },
350
336
  },
351
337
 
@@ -366,7 +352,7 @@ export default {
366
352
  if (
367
353
  matches(this.dropbar, ':hover') &&
368
354
  active?.$el === e.target &&
369
- !this.toggles.some((el) => active.target !== el && matches(el, ':focus'))
355
+ !this.toggles.some((el) => active.targetEl !== el && matches(el, ':focus'))
370
356
  ) {
371
357
  e.preventDefault();
372
358
  }
@@ -402,7 +388,7 @@ export default {
402
388
 
403
389
  methods: {
404
390
  getActive() {
405
- return active && within(active.target, this.$el) && active;
391
+ return active && within(active.targetEl, this.$el) && active;
406
392
  },
407
393
 
408
394
  transitionTo(newHeight, el) {
@@ -435,15 +421,14 @@ export default {
435
421
  },
436
422
 
437
423
  isDropbarDrop(el) {
438
- const drop = this.getDropdown(el);
439
- return drop && hasClass(el, this.clsDrop) && drop.align !== 'stretch';
424
+ return this.getDropdown(el) && hasClass(el, this.clsDrop);
440
425
  },
441
426
  },
442
427
  };
443
428
 
444
429
  function handleNavItemNavigation(e, toggles, active) {
445
430
  const { current, keyCode } = e;
446
- const target = active?.target || current;
431
+ const target = active?.targetEl || current;
447
432
  const i = toggles.indexOf(target);
448
433
 
449
434
  // Left
@@ -1,4 +1,4 @@
1
- import { $, scrollIntoView, trigger } from 'uikit-util';
1
+ import { $, off, on, scrollIntoView, trigger, within } from 'uikit-util';
2
2
 
3
3
  export default {
4
4
  props: {
@@ -9,6 +9,14 @@ export default {
9
9
  offset: 0,
10
10
  },
11
11
 
12
+ connected() {
13
+ registerClick(this);
14
+ },
15
+
16
+ disconnected() {
17
+ unregisterClick(this);
18
+ },
19
+
12
20
  methods: {
13
21
  async scrollTo(el) {
14
22
  el = (el && $(el)) || document.body;
@@ -19,18 +27,37 @@ export default {
19
27
  }
20
28
  },
21
29
  },
30
+ };
22
31
 
23
- events: {
24
- click(e) {
25
- if (e.defaultPrevented) {
26
- return;
27
- }
32
+ const components = new Set();
33
+ function registerClick(cmp) {
34
+ if (!components.size) {
35
+ on(document, 'click', clickHandler);
36
+ }
37
+
38
+ components.add(cmp);
39
+ }
28
40
 
41
+ function unregisterClick(cmp) {
42
+ components.delete(cmp);
43
+
44
+ if (!components.length) {
45
+ off(document, 'click', clickHandler);
46
+ }
47
+ }
48
+
49
+ function clickHandler(e) {
50
+ if (e.defaultPrevented) {
51
+ return;
52
+ }
53
+
54
+ for (const component of components) {
55
+ if (within(e.target, component.$el)) {
29
56
  e.preventDefault();
30
- this.scrollTo(getTargetElement(this.$el));
31
- },
32
- },
33
- };
57
+ component.scrollTo(getTargetElement(component.$el));
58
+ }
59
+ }
60
+ }
34
61
 
35
62
  export function getTargetElement(el) {
36
63
  return document.getElementById(decodeURIComponent(el.hash).substring(1));
@@ -181,7 +181,7 @@ export default {
181
181
  },
182
182
 
183
183
  {
184
- name: 'toggled',
184
+ name: 'hide show',
185
185
 
186
186
  self: true,
187
187
 
@@ -189,10 +189,8 @@ export default {
189
189
  return this.target;
190
190
  },
191
191
 
192
- handler(e, toggled) {
193
- if (e.target === this.target[0]) {
194
- this.updateAria(toggled);
195
- }
192
+ handler({ type }) {
193
+ this.updateAria(type === 'show');
196
194
  },
197
195
  },
198
196
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createEvent,
3
- getCssVar,
3
+ css,
4
4
  isNumeric,
5
5
  isString,
6
6
  on,
@@ -19,7 +19,7 @@ export default {
19
19
  },
20
20
 
21
21
  connected() {
22
- const media = toMedia(this.media);
22
+ const media = toMedia(this.media, this.$el);
23
23
  this.matchMedia = true;
24
24
  if (media) {
25
25
  this.mediaObj = window.matchMedia(media);
@@ -40,11 +40,10 @@ export default {
40
40
  },
41
41
  };
42
42
 
43
- function toMedia(value) {
43
+ function toMedia(value, element) {
44
44
  if (isString(value)) {
45
45
  if (startsWith(value, '@')) {
46
- const name = `breakpoint-${value.substr(1)}`;
47
- value = toFloat(getCssVar(name));
46
+ value = toFloat(css(element, `--uk-breakpoint-${value.substr(1)}`));
48
47
  } else if (isNaN(value)) {
49
48
  return value;
50
49
  }
@@ -9,6 +9,7 @@ import {
9
9
  includes,
10
10
  isFocusable,
11
11
  last,
12
+ noop,
12
13
  on,
13
14
  once,
14
15
  parent,
@@ -134,8 +135,8 @@ export default {
134
135
  );
135
136
 
136
137
  if (this.overlay) {
137
- once(this.$el, 'hide', preventOverscroll(this.$el));
138
- once(this.$el, 'hide', preventBackgroundScroll());
138
+ once(this.$el, 'hidden', preventOverscroll(this.$el));
139
+ once(this.$el, 'hidden', preventBackgroundScroll());
139
140
  }
140
141
 
141
142
  if (this.stack) {
@@ -217,10 +218,6 @@ export default {
217
218
  active.splice(active.indexOf(this), 1);
218
219
  }
219
220
 
220
- if (!active.length) {
221
- css(document.body, 'overflowY', '');
222
- }
223
-
224
221
  css(this.$el, 'zIndex', '');
225
222
 
226
223
  if (!active.some((modal) => modal.clsPage === this.clsPage)) {
@@ -337,7 +334,12 @@ export function preventOverscroll(el) {
337
334
  return () => events.forEach((fn) => fn());
338
335
  }
339
336
 
337
+ let prevented;
340
338
  export function preventBackgroundScroll() {
339
+ if (prevented) {
340
+ return noop;
341
+ }
342
+ prevented = true;
341
343
  const { body, documentElement } = document;
342
344
  css(body, {
343
345
  overflowY: width(window) > documentElement.clientWidth ? 'scroll' : '',
@@ -345,6 +347,7 @@ export function preventBackgroundScroll() {
345
347
  });
346
348
  css(documentElement, 'overflowY', 'hidden');
347
349
  return () => {
350
+ prevented = false;
348
351
  css(documentElement, 'overflowY', '');
349
352
  css(body, { overflowY: '', touchAction: '' });
350
353
  };
@@ -2,13 +2,11 @@ import {
2
2
  css,
3
3
  dimensions,
4
4
  flipPosition,
5
- getCssVar,
6
5
  includes,
7
6
  isRtl,
8
7
  positionAt,
9
8
  scrollParents,
10
9
  toPx,
11
- trigger,
12
10
  } from 'uikit-util';
13
11
 
14
12
  export default {
@@ -16,12 +14,16 @@ export default {
16
14
  pos: String,
17
15
  offset: null,
18
16
  flip: Boolean,
17
+ shift: Boolean,
18
+ inset: Boolean,
19
19
  },
20
20
 
21
21
  data: {
22
22
  pos: `bottom-${isRtl ? 'right' : 'left'}`,
23
- flip: true,
24
23
  offset: false,
24
+ flip: true,
25
+ shift: true,
26
+ inset: false,
25
27
  },
26
28
 
27
29
  connected() {
@@ -33,17 +35,19 @@ export default {
33
35
  methods: {
34
36
  positionAt(element, target, boundary) {
35
37
  let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
38
+ const placement = [this.flip && 'flip', this.shift && 'shift'];
36
39
 
37
40
  const attach = {
38
- element: [flipPosition(this.dir), this.align],
41
+ element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
39
42
  target: [this.dir, this.align],
40
43
  };
41
44
 
42
45
  if (this.axis === 'y') {
43
46
  for (const prop in attach) {
44
- attach[prop] = attach[prop].reverse();
47
+ attach[prop].reverse();
45
48
  }
46
- offset = offset.reverse();
49
+ offset.reverse();
50
+ placement.reverse();
47
51
  }
48
52
 
49
53
  const [scrollElement] = scrollParents(element, /auto|scroll/);
@@ -53,21 +57,13 @@ export default {
53
57
  const elDim = dimensions(element);
54
58
  css(element, { top: -elDim.height, left: -elDim.width });
55
59
 
56
- const args = [
57
- element,
58
- target,
59
- {
60
- attach,
61
- offset,
62
- boundary,
63
- flip: this.flip,
64
- viewportOffset: this.getViewportOffset(element),
65
- },
66
- ];
67
-
68
- trigger(element, 'beforeposition', args);
69
-
70
- positionAt(...args);
60
+ positionAt(element, target, {
61
+ attach,
62
+ offset,
63
+ boundary,
64
+ placement,
65
+ viewportOffset: this.getViewportOffset(element),
66
+ });
71
67
 
72
68
  // Restore scroll position
73
69
  scrollElement.scrollTop = scrollTop;
@@ -77,25 +73,27 @@ export default {
77
73
  getPositionOffset(element) {
78
74
  return (
79
75
  toPx(
80
- this.offset === false ? getCssVar('position-offset', element) : this.offset,
76
+ this.offset === false ? css(element, '--uk-position-offset') : this.offset,
81
77
  this.axis === 'x' ? 'width' : 'height',
82
78
  element
83
- ) * (includes(['left', 'top'], this.dir) ? -1 : 1)
79
+ ) *
80
+ (includes(['left', 'top'], this.dir) ? -1 : 1) *
81
+ (this.inset ? -1 : 1)
84
82
  );
85
83
  },
86
84
 
87
85
  getShiftOffset(element) {
88
- return includes(['center', 'justify', 'stretch'], this.align)
86
+ return this.align === 'center'
89
87
  ? 0
90
88
  : toPx(
91
- getCssVar('position-shift-offset', element),
89
+ css(element, '--uk-position-shift-offset'),
92
90
  this.axis === 'y' ? 'width' : 'height',
93
91
  element
94
92
  ) * (includes(['left', 'top'], this.align) ? 1 : -1);
95
93
  },
96
94
 
97
95
  getViewportOffset(element) {
98
- return toPx(getCssVar('position-viewport-offset', element));
96
+ return toPx(css(element, '--uk-position-viewport-offset'));
99
97
  },
100
98
  },
101
99
  };
@@ -0,0 +1,11 @@
1
+ import { attr } from 'uikit-util';
2
+
3
+ export default {
4
+ beforeConnect() {
5
+ this._style = attr(this.$el, 'style');
6
+ },
7
+
8
+ disconnected() {
9
+ attr(this.$el, 'style', this._style);
10
+ },
11
+ };