uikit 3.14.3 → 3.14.4-dev.07daf8fb8

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 (145) hide show
  1. package/CHANGELOG.md +54 -3
  2. package/build/util.js +1 -0
  3. package/dist/css/uikit-core-rtl.css +428 -95
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +428 -95
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +444 -108
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +444 -108
  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 +7 -5
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +203 -76
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +203 -76
  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 +22 -7
  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 +22 -7
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +3 -3
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +138 -76
  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 +1801 -1573
  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 +1081 -836
  42. package/dist/js/uikit.min.js +14 -1
  43. package/package.json +1 -1
  44. package/src/images/{backgrounds/nav-parent-open.svg → components/nav-parent-icon-large.svg} +0 -0
  45. package/src/images/components/nav-parent-icon.svg +3 -0
  46. package/src/images/components/navbar-parent-icon.svg +3 -0
  47. package/src/images/components/navbar-toggle-icon.svg +22 -3
  48. package/src/js/api/state.js +2 -2
  49. package/src/js/components/filter.js +5 -3
  50. package/src/js/components/sortable.js +2 -3
  51. package/src/js/core/accordion.js +9 -17
  52. package/src/js/core/alert.js +35 -14
  53. package/src/js/core/drop.js +102 -48
  54. package/src/js/core/height-viewport.js +22 -9
  55. package/src/js/core/icon.js +16 -0
  56. package/src/js/core/index.js +2 -0
  57. package/src/js/core/leader.js +2 -2
  58. package/src/js/core/navbar.js +47 -33
  59. package/src/js/core/offcanvas.js +1 -47
  60. package/src/js/core/scroll.js +37 -10
  61. package/src/js/core/sticky.js +8 -9
  62. package/src/js/core/switcher.js +1 -1
  63. package/src/js/mixin/media.js +4 -5
  64. package/src/js/mixin/modal.js +97 -8
  65. package/src/js/mixin/position.js +59 -14
  66. package/src/js/mixin/slider-drag.js +20 -8
  67. package/src/js/mixin/style.js +11 -0
  68. package/src/js/mixin/togglable.js +100 -72
  69. package/src/js/util/animation.js +5 -3
  70. package/src/js/util/dimensions.js +6 -6
  71. package/src/js/util/filter.js +3 -7
  72. package/src/js/util/position.js +43 -47
  73. package/src/js/util/style.js +4 -13
  74. package/src/js/util/viewport.js +21 -37
  75. package/src/less/components/_import.less +1 -0
  76. package/src/less/components/drop.less +3 -6
  77. package/src/less/components/dropbar.less +115 -0
  78. package/src/less/components/dropdown.less +22 -6
  79. package/src/less/components/leader.less +1 -1
  80. package/src/less/components/margin.less +13 -14
  81. package/src/less/components/modal.less +19 -4
  82. package/src/less/components/nav.less +241 -64
  83. package/src/less/components/navbar.less +111 -35
  84. package/src/less/components/offcanvas.less +21 -21
  85. package/src/less/components/position.less +1 -1
  86. package/src/less/components/utility.less +21 -5
  87. package/src/less/theme/_import.less +1 -0
  88. package/src/less/theme/dropbar.less +44 -0
  89. package/src/less/theme/nav.less +43 -9
  90. package/src/less/theme/navbar.less +9 -15
  91. package/src/scss/components/_import.scss +1 -0
  92. package/src/scss/components/drop.scss +3 -6
  93. package/src/scss/components/dropbar.scss +115 -0
  94. package/src/scss/components/dropdown.scss +22 -6
  95. package/src/scss/components/leader.scss +1 -1
  96. package/src/scss/components/margin.scss +13 -14
  97. package/src/scss/components/modal.scss +19 -4
  98. package/src/scss/components/nav.scss +190 -52
  99. package/src/scss/components/navbar.scss +88 -24
  100. package/src/scss/components/offcanvas.scss +21 -21
  101. package/src/scss/components/position.scss +1 -1
  102. package/src/scss/components/utility.scss +19 -4
  103. package/src/scss/mixins-theme.scss +93 -29
  104. package/src/scss/mixins.scss +89 -15
  105. package/src/scss/theme/_import.scss +1 -0
  106. package/src/scss/theme/dropbar.scss +44 -0
  107. package/src/scss/theme/nav.scss +41 -9
  108. package/src/scss/theme/navbar.scss +9 -3
  109. package/src/scss/variables-theme.scss +93 -25
  110. package/src/scss/variables.scss +82 -23
  111. package/tests/accordion.html +2 -2
  112. package/tests/alert.html +2 -2
  113. package/tests/countdown.html +1 -1
  114. package/tests/drop.html +484 -255
  115. package/tests/dropbar.html +456 -0
  116. package/tests/dropdown.html +29 -189
  117. package/tests/filter.html +9 -12
  118. package/tests/form.html +1 -1
  119. package/tests/height-viewport.html +62 -0
  120. package/tests/index.html +126 -107
  121. package/tests/js/index.js +1 -4
  122. package/tests/lightbox.html +5 -5
  123. package/tests/list.html +8 -8
  124. package/tests/modal.html +13 -13
  125. package/tests/nav.html +117 -75
  126. package/tests/navbar.html +2270 -1104
  127. package/tests/offcanvas.html +25 -29
  128. package/tests/parallax.html +1 -1
  129. package/tests/position.html +13 -24
  130. package/tests/progress.html +9 -9
  131. package/tests/scroll.html +7 -10
  132. package/tests/search.html +5 -5
  133. package/tests/slider.html +6 -5
  134. package/tests/slideshow.html +8 -8
  135. package/tests/sortable.html +6 -8
  136. package/tests/sticky-navbar.html +132 -0
  137. package/tests/sticky.html +8 -8
  138. package/tests/switcher.html +1 -1
  139. package/tests/tab.html +1 -1
  140. package/tests/table.html +7 -7
  141. package/tests/toggle.html +2 -2
  142. package/tests/tooltip.html +1 -1
  143. package/tests/upload.html +11 -11
  144. package/tests/utility.html +19 -0
  145. package/src/images/backgrounds/nav-parent-close.svg +0 -3
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit",
3
3
  "title": "UIkit",
4
4
  "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
- "version": "3.14.3",
5
+ "version": "3.14.4-dev.07daf8fb8",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
2
+ <polyline fill="none" stroke="#000" stroke-width="1.1" points="1 3.5 6 8.5 11 3.5"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
2
+ <polyline fill="none" stroke="#000" stroke-width="1.1" points="1 3.5 6 8.5 11 3.5"/>
3
+ </svg>
@@ -1,5 +1,24 @@
1
1
  <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
2
- <rect y="9" width="20" height="2" />
3
- <rect y="3" width="20" height="2" />
4
- <rect y="15" width="20" height="2" />
2
+ <style>
3
+
4
+ .uk-navbar-toggle svg > [class*='line-'] {
5
+ transition: 0.2s ease-in-out;
6
+ transition-property: transform, opacity,;
7
+ transform-origin: center;
8
+ opacity: 1;
9
+ }
10
+
11
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-2 { transform: rotate(45deg); }
12
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-3 { transform: rotate(-45deg); }
13
+
14
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-1,
15
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-4 { opacity: 0; }
16
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-1 { transform: translateY(6px) scaleX(0); }
17
+ .uk-navbar-toggle[aria-expanded="true"] svg > .line-4 { transform: translateY(-6px) scaleX(0); }
18
+
19
+ </style>
20
+ <rect class="line-1" y="3" width="20" height="2" />
21
+ <rect class="line-2" y="9" width="20" height="2" />
22
+ <rect class="line-3" y="9" width="20" height="2" />
23
+ <rect class="line-4" y="15" width="20" height="2" />
5
24
  </svg>
@@ -142,7 +142,7 @@ function getProps(opts, name) {
142
142
 
143
143
  value = props[key] === Boolean && value === '' ? true : coerce(props[key], value);
144
144
 
145
- if (prop === 'target' && (!value || startsWith(value, '_'))) {
145
+ if (prop === 'target' && startsWith(value, '_')) {
146
146
  continue;
147
147
  }
148
148
 
@@ -153,7 +153,7 @@ function getProps(opts, name) {
153
153
 
154
154
  for (const key in options) {
155
155
  const prop = camelize(key);
156
- if (props[prop] !== undefined) {
156
+ if (!isUndefined(props[prop])) {
157
157
  data[prop] = coerce(props[prop], options[key]);
158
158
  }
159
159
  }
@@ -103,7 +103,7 @@ export default {
103
103
  });
104
104
  },
105
105
 
106
- setState(state, animate = true) {
106
+ async setState(state, animate = true) {
107
107
  state = { filter: { '': '' }, sort: [], ...state };
108
108
 
109
109
  trigger(this.$el, 'beforeFilter', [this, state]);
@@ -112,7 +112,7 @@ export default {
112
112
  toggleClass(el, this.cls, !!matchFilter(el, this.attrItem, state))
113
113
  );
114
114
 
115
- Promise.all(
115
+ await Promise.all(
116
116
  $$(this.target, this.$el).map((target) => {
117
117
  const filterFn = () => {
118
118
  applyState(state, target, getChildren(target));
@@ -120,7 +120,9 @@ export default {
120
120
  };
121
121
  return animate ? this.animate(filterFn, target) : filterFn();
122
122
  })
123
- ).then(() => trigger(this.$el, 'afterFilter', [this]));
123
+ );
124
+
125
+ trigger(this.$el, 'afterFilter', [this]);
124
126
  },
125
127
 
126
128
  updateState() {
@@ -26,7 +26,6 @@ import {
26
26
  remove,
27
27
  removeClass,
28
28
  scrollParents,
29
- scrollTop,
30
29
  toggleClass,
31
30
  Transition,
32
31
  trigger,
@@ -313,7 +312,7 @@ function trackScroll(pos) {
313
312
  let last = Date.now();
314
313
  trackTimer = setInterval(() => {
315
314
  let { x, y } = pos;
316
- y += scrollTop(window);
315
+ y += document.scrollingElement.scrollTop;
317
316
 
318
317
  const dist = (Date.now() - last) * 0.3;
319
318
  last = Date.now();
@@ -334,7 +333,7 @@ function trackScroll(pos) {
334
333
  }
335
334
 
336
335
  if (scroll > 0 && scroll < scrollHeight - height) {
337
- scrollTop(scrollEl, scroll);
336
+ scrollEl.scrollTop = scroll;
338
337
  return true;
339
338
  }
340
339
  });
@@ -1,6 +1,6 @@
1
1
  import Class from '../mixin/class';
2
2
  import Lazyload from '../mixin/lazyload';
3
- import { default as Togglable, toggleHeight } from '../mixin/togglable';
3
+ import { default as Togglable, toggleTransition } from '../mixin/togglable';
4
4
  import {
5
5
  $,
6
6
  $$,
@@ -14,14 +14,14 @@ import {
14
14
  isInView,
15
15
  scrollIntoView,
16
16
  toggleClass,
17
- unwrap,
18
- wrapAll,
17
+ within,
19
18
  } from 'uikit-util';
20
19
 
21
20
  export default {
22
21
  mixins: [Class, Lazyload, Togglable],
23
22
 
24
23
  props: {
24
+ animation: Boolean,
25
25
  targets: String,
26
26
  active: null,
27
27
  collapsible: Boolean,
@@ -34,7 +34,7 @@ export default {
34
34
  data: {
35
35
  targets: '> *',
36
36
  active: false,
37
- animation: [true],
37
+ animation: true,
38
38
  collapsible: true,
39
39
  multiple: false,
40
40
  clsOpen: 'uk-open',
@@ -80,7 +80,7 @@ export default {
80
80
  hide(
81
81
  el,
82
82
  !hasClass(
83
- this.items.find((item) => item.contains(el)),
83
+ this.items.find((item) => within(el, item)),
84
84
  this.clsOpen
85
85
  )
86
86
  );
@@ -132,23 +132,15 @@ export default {
132
132
  toggleClass(el, this.clsOpen, show);
133
133
  attr($(this.$props.toggle, el), 'aria-expanded', show);
134
134
 
135
- const content = $(`${el._wrapper ? '> * ' : ''}${this.content}`, el);
135
+ const content = $(this.content, el);
136
136
 
137
- if (animate === false || !this.hasTransition) {
137
+ if (animate === false || !this.animation) {
138
+ content.hidden = !show;
138
139
  hide(content, !show);
139
140
  return;
140
141
  }
141
142
 
142
- if (!el._wrapper) {
143
- el._wrapper = wrapAll(content, `<div${show ? ' hidden' : ''}>`);
144
- }
145
-
146
- hide(content, false);
147
- await toggleHeight(this)(el._wrapper, show);
148
- hide(content, !show);
149
-
150
- delete el._wrapper;
151
- unwrap(content);
143
+ await toggleTransition(this)(content, show);
152
144
 
153
145
  if (show) {
154
146
  const toggle = $(this.$props.toggle, el);
@@ -1,5 +1,6 @@
1
1
  import Class from '../mixin/class';
2
2
  import Togglable from '../mixin/togglable';
3
+ import { css, toFloat, Transition } from 'uikit-util';
3
4
 
4
5
  export default {
5
6
  mixins: [Class, Togglable],
@@ -7,35 +8,55 @@ export default {
7
8
  args: 'animation',
8
9
 
9
10
  props: {
11
+ animation: Boolean,
10
12
  close: String,
11
13
  },
12
14
 
13
15
  data: {
14
- animation: [true],
16
+ animation: true,
15
17
  selClose: '.uk-alert-close',
16
18
  duration: 150,
17
- hideProps: { opacity: 0, ...Togglable.data.hideProps },
18
19
  },
19
20
 
20
- events: [
21
- {
22
- name: 'click',
21
+ events: {
22
+ name: 'click',
23
23
 
24
- delegate() {
25
- return this.selClose;
26
- },
24
+ delegate() {
25
+ return this.selClose;
26
+ },
27
27
 
28
- handler(e) {
29
- e.preventDefault();
30
- this.close();
31
- },
28
+ handler(e) {
29
+ e.preventDefault();
30
+ this.close();
32
31
  },
33
- ],
32
+ },
34
33
 
35
34
  methods: {
36
35
  async close() {
37
- await this.toggleElement(this.$el);
36
+ await this.toggleElement(this.$el, false, animate(this));
38
37
  this.$destroy(true);
39
38
  },
40
39
  },
41
40
  };
41
+
42
+ function animate({ duration, transition, velocity }) {
43
+ return (el) => {
44
+ const height = toFloat(css(el, 'height'));
45
+ css(el, 'height', height);
46
+ return Transition.start(
47
+ el,
48
+ {
49
+ height: 0,
50
+ marginTop: 0,
51
+ marginBottom: 0,
52
+ paddingTop: 0,
53
+ paddingBottom: 0,
54
+ borderTop: 0,
55
+ borderBottom: 0,
56
+ opacity: 0,
57
+ },
58
+ velocity * height + duration,
59
+ transition
60
+ );
61
+ };
62
+ }
@@ -1,6 +1,7 @@
1
1
  import Container from '../mixin/container';
2
2
  import Lazyload from '../mixin/lazyload';
3
3
  import Position from '../mixin/position';
4
+ import Style from '../mixin/style';
4
5
  import Togglable from '../mixin/togglable';
5
6
  import {
6
7
  addClass,
@@ -8,7 +9,6 @@ import {
8
9
  apply,
9
10
  attr,
10
11
  css,
11
- getCssVar,
12
12
  hasClass,
13
13
  includes,
14
14
  isTouch,
@@ -16,6 +16,7 @@ import {
16
16
  MouseTracker,
17
17
  observeResize,
18
18
  offset,
19
+ offsetViewport,
19
20
  on,
20
21
  once,
21
22
  parent,
@@ -27,15 +28,14 @@ import {
27
28
  query,
28
29
  removeClass,
29
30
  scrollParents,
30
- toggleClass,
31
- toPx,
32
31
  within,
33
32
  } from 'uikit-util';
33
+ import { preventBackgroundScroll, preventOverscroll } from '../mixin/modal';
34
34
 
35
35
  export let active;
36
36
 
37
37
  export default {
38
- mixins: [Container, Lazyload, Position, Togglable],
38
+ mixins: [Container, Lazyload, Position, Style, Togglable],
39
39
 
40
40
  args: 'pos',
41
41
 
@@ -43,27 +43,49 @@ export default {
43
43
  mode: 'list',
44
44
  toggle: Boolean,
45
45
  boundary: Boolean,
46
- boundaryAlign: Boolean,
46
+ target: Boolean,
47
+ targetX: Boolean,
48
+ targetY: Boolean,
49
+ stretch: Boolean,
47
50
  delayShow: Number,
48
51
  delayHide: Number,
49
52
  display: String,
50
53
  clsDrop: String,
54
+ animateOut: Boolean,
55
+ bgScroll: Boolean,
51
56
  },
52
57
 
53
58
  data: {
54
59
  mode: ['click', 'hover'],
55
60
  toggle: '- *',
56
- boundary: true,
57
- boundaryAlign: false,
61
+ boundary: false,
62
+ target: false,
63
+ targetX: false,
64
+ targetY: false,
65
+ stretch: false,
58
66
  delayShow: 0,
59
67
  delayHide: 800,
60
68
  display: null,
61
69
  clsDrop: false,
70
+ animateOut: false,
71
+ bgScroll: true,
62
72
  animation: ['uk-animation-fade'],
63
73
  cls: 'uk-open',
64
74
  container: false,
65
75
  },
66
76
 
77
+ computed: {
78
+ target({ target, targetX, targetY }, $el) {
79
+ targetX = targetX || target || this.targetEl;
80
+ targetY = targetY || target || this.targetEl;
81
+
82
+ return [
83
+ targetX === true ? window : query(targetX, $el),
84
+ targetY === true ? window : query(targetY, $el),
85
+ ];
86
+ },
87
+ },
88
+
67
89
  created() {
68
90
  this.tracker = new MouseTracker();
69
91
  },
@@ -75,13 +97,13 @@ export default {
75
97
  connected() {
76
98
  addClass(this.$el, this.clsDrop);
77
99
 
78
- if (this.toggle && !this.target) {
79
- this.target = this.$create('toggle', query(this.toggle, this.$el), {
100
+ if (this.toggle && !this.targetEl) {
101
+ this.targetEl = this.$create('toggle', query(this.toggle, this.$el), {
80
102
  target: this.$el,
81
103
  mode: this.mode,
82
104
  }).$el;
83
- attr(this.target, 'aria-haspopup', true);
84
- this.lazyload(this.target);
105
+ attr(this.targetEl, 'aria-haspopup', true);
106
+ this.lazyload(this.targetEl);
85
107
  }
86
108
  },
87
109
 
@@ -234,7 +256,7 @@ export default {
234
256
  !defaultPrevented &&
235
257
  type === pointerUp &&
236
258
  target === newTarget &&
237
- !(this.target && within(target, this.target))
259
+ !(this.targetEl && within(target, this.targetEl))
238
260
  ) {
239
261
  this.hide(false);
240
262
  }
@@ -249,13 +271,17 @@ export default {
249
271
  }
250
272
  }),
251
273
 
274
+ ...(this.bgScroll
275
+ ? []
276
+ : [preventOverscroll(this.$el), preventBackgroundScroll()]),
277
+
252
278
  ...(this.display === 'static'
253
279
  ? []
254
280
  : (() => {
255
281
  const handler = () => this.$emit();
256
282
  return [
257
283
  on(window, 'resize', handler),
258
- on(document, 'scroll', handler, true),
284
+ on([document, scrollParents(this.$el)], 'scroll', handler),
259
285
  (() => {
260
286
  const observer = observeResize(
261
287
  scrollParents(this.$el),
@@ -308,12 +334,12 @@ export default {
308
334
  },
309
335
 
310
336
  methods: {
311
- show(target = this.target, delay = true) {
312
- if (this.isToggled() && target && this.target && target !== this.target) {
313
- this.hide(false);
337
+ show(target = this.targetEl, delay = true) {
338
+ if (this.isToggled() && target && this.targetEl && target !== this.targetEl) {
339
+ this.hide(false, false);
314
340
  }
315
341
 
316
- this.target = target;
342
+ this.targetEl = target;
317
343
 
318
344
  this.clearTimers();
319
345
 
@@ -330,7 +356,7 @@ export default {
330
356
  let prev;
331
357
  while (active && prev !== active && !within(this.$el, active.$el)) {
332
358
  prev = active;
333
- active.hide(false);
359
+ active.hide(false, false);
334
360
  }
335
361
  }
336
362
 
@@ -344,8 +370,8 @@ export default {
344
370
  );
345
371
  },
346
372
 
347
- hide(delay = true) {
348
- const hide = () => this.toggleElement(this.$el, false, false);
373
+ hide(delay = true, animate = true) {
374
+ const hide = () => this.toggleElement(this.$el, false, this.animateOut && animate);
349
375
 
350
376
  this.clearTimers();
351
377
 
@@ -376,41 +402,69 @@ export default {
376
402
 
377
403
  position() {
378
404
  removeClass(this.$el, `${this.clsDrop}-stack`);
379
- toggleClass(this.$el, `${this.clsDrop}-boundary`, this.boundaryAlign);
405
+ attr(this.$el, 'style', this._style);
406
+
407
+ // Ensure none positioned element does not generate scrollbars
408
+ this.$el.hidden = true;
380
409
 
381
410
  const boundary = query(this.boundary, this.$el);
382
- const scrollParentOffset = offset(
383
- scrollParents(boundary && this.boundaryAlign ? boundary : this.$el)[0]
384
- );
385
- const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
386
-
387
- css(this.$el, 'maxWidth', '');
388
- const maxWidth =
389
- scrollParentOffset.width -
390
- 2 * toPx(getCssVar('position-viewport-offset', this.$el));
391
-
392
- if (this.pos[1] === 'justify') {
393
- const prop = this.axis === 'y' ? 'width' : 'height';
394
- css(
395
- this.$el,
396
- prop,
397
- Math.min(
398
- (boundary ? boundaryOffset : offset(this.target))[prop],
399
- scrollParentOffset[prop] -
400
- 2 * toPx(getCssVar('position-viewport-offset', this.$el))
401
- )
402
- );
403
- } else if (this.$el.offsetWidth > maxWidth) {
411
+ const boundaryOffset = offsetViewport(boundary || window);
412
+ const viewports = this.target.map((target) => offsetViewport(scrollParents(target)[0]));
413
+ const viewportOffset = this.getViewportOffset(this.$el);
414
+
415
+ const dirs = [
416
+ [0, ['x', 'width', 'left', 'right']],
417
+ [1, ['y', 'height', 'top', 'bottom']],
418
+ ];
419
+
420
+ for (const [i, [axis, prop]] of dirs) {
421
+ if (this.axis !== axis && includes([axis, true], this.stretch)) {
422
+ css(this.$el, {
423
+ [prop]: Math.min(
424
+ boundaryOffset[prop],
425
+ viewports[i][prop] - 2 * viewportOffset
426
+ ),
427
+ [`overflow-${axis}`]: 'auto',
428
+ });
429
+ }
430
+ }
431
+
432
+ const maxWidth = viewports[0].width - 2 * viewportOffset;
433
+
434
+ if (this.$el.offsetWidth > maxWidth) {
404
435
  addClass(this.$el, `${this.clsDrop}-stack`);
405
436
  }
406
437
 
407
438
  css(this.$el, 'maxWidth', maxWidth);
408
439
 
409
- this.positionAt(
410
- this.$el,
411
- boundary && this.boundaryAlign ? boundary : this.target,
412
- boundary
413
- );
440
+ this.$el.hidden = false;
441
+
442
+ this.positionAt(this.$el, this.target, boundary);
443
+
444
+ for (const [i, [axis, prop, start, end]] of dirs) {
445
+ if (this.axis === axis && includes([axis, true], this.stretch)) {
446
+ const positionOffset = Math.abs(this.getPositionOffset(this.$el));
447
+ const targetOffset = offset(this.target[i]);
448
+ const elOffset = offset(this.$el);
449
+
450
+ css(this.$el, {
451
+ [prop]:
452
+ (targetOffset[start] > elOffset[start]
453
+ ? targetOffset[start] -
454
+ Math.max(
455
+ boundaryOffset[start],
456
+ viewports[i][start] + viewportOffset
457
+ )
458
+ : Math.min(
459
+ boundaryOffset[end],
460
+ viewports[i][end] - viewportOffset
461
+ ) - targetOffset[end]) - positionOffset,
462
+ [`overflow-${axis}`]: 'auto',
463
+ });
464
+
465
+ this.positionAt(this.$el, this.target, boundary);
466
+ }
467
+ }
414
468
  },
415
469
  },
416
470
  };
@@ -4,12 +4,13 @@ import {
4
4
  css,
5
5
  dimensions,
6
6
  endsWith,
7
- height,
8
7
  isNumeric,
9
8
  isString,
10
9
  isVisible,
11
- offset,
10
+ offsetPosition,
11
+ offsetViewport,
12
12
  query,
13
+ scrollParents,
13
14
  toFloat,
14
15
  } from 'uikit-util';
15
16
 
@@ -32,7 +33,7 @@ export default {
32
33
 
33
34
  resizeTargets() {
34
35
  // check for offsetTop change
35
- return [this.$el, document.documentElement];
36
+ return [this.$el, ...scrollParents(this.$el, /auto|scroll/)];
36
37
  },
37
38
 
38
39
  update: {
@@ -44,21 +45,33 @@ export default {
44
45
  let minHeight = '';
45
46
  const box = boxModelAdjust(this.$el, 'height', 'content-box');
46
47
 
48
+ const { body, scrollingElement } = document;
49
+ const [scrollElement] = scrollParents(this.$el, /auto|scroll/);
50
+ const { height: viewportHeight } = offsetViewport(
51
+ scrollElement === body ? scrollingElement : scrollElement
52
+ );
53
+
47
54
  if (this.expand) {
48
55
  minHeight = Math.max(
49
- height(window) -
50
- (dimensions(document.documentElement).height -
51
- dimensions(this.$el).height) -
56
+ viewportHeight -
57
+ (dimensions(scrollElement).height - dimensions(this.$el).height) -
52
58
  box,
53
59
  0
54
60
  );
55
61
  } else {
62
+ const isScrollingElement =
63
+ scrollingElement === scrollElement || body === scrollElement;
64
+
56
65
  // on mobile devices (iOS and Android) window.innerHeight !== 100vh
57
- minHeight = 'calc(100vh';
66
+ minHeight = `calc(${isScrollingElement ? '100vh' : `${viewportHeight}px`}`;
58
67
 
59
68
  if (this.offsetTop) {
60
- const { top } = offset(this.$el);
61
- minHeight += top > 0 && top < height(window) / 2 ? ` - ${top}px` : '';
69
+ if (isScrollingElement) {
70
+ const top = offsetPosition(this.$el)[0] - offsetPosition(scrollElement)[0];
71
+ minHeight += top > 0 && top < viewportHeight / 2 ? ` - ${top}px` : '';
72
+ } else {
73
+ minHeight += ` - ${css(scrollElement, 'paddingTop')}`;
74
+ }
62
75
  }
63
76
 
64
77
  if (this.offsetBottom === true) {
@@ -2,6 +2,9 @@ import SVG from './svg';
2
2
  import closeIcon from '../../images/components/close-icon.svg';
3
3
  import closeLarge from '../../images/components/close-large.svg';
4
4
  import marker from '../../images/components/marker.svg';
5
+ import navParentIcon from '../../images/components/nav-parent-icon.svg';
6
+ import navParentIconLarge from '../../images/components/nav-parent-icon-large.svg';
7
+ import navbarParentIcon from '../../images/components/navbar-parent-icon.svg';
5
8
  import navbarToggleIcon from '../../images/components/navbar-toggle-icon.svg';
6
9
  import overlayIcon from '../../images/components/overlay-icon.svg';
7
10
  import paginationNext from '../../images/components/pagination-next.svg';
@@ -19,6 +22,7 @@ import {
19
22
  $,
20
23
  addClass,
21
24
  apply,
25
+ closest,
22
26
  css,
23
27
  each,
24
28
  hasClass,
@@ -35,6 +39,9 @@ const icons = {
35
39
  marker,
36
40
  'close-icon': closeIcon,
37
41
  'close-large': closeLarge,
42
+ 'nav-parent-icon': navParentIcon,
43
+ 'nav-parent-icon-large': navParentIconLarge,
44
+ 'navbar-parent-icon': navbarParentIcon,
38
45
  'navbar-toggle-icon': navbarToggleIcon,
39
46
  'overlay-icon': overlayIcon,
40
47
  'pagination-next': paginationNext,
@@ -96,6 +103,15 @@ export const IconComponent = {
96
103
  },
97
104
  };
98
105
 
106
+ export const NavParentIcon = {
107
+ extends: IconComponent,
108
+
109
+ beforeConnect() {
110
+ const icon = this.$props.icon;
111
+ this.icon = closest(this.$el, '.uk-nav-primary') ? `${icon}-large` : icon;
112
+ },
113
+ };
114
+
99
115
  export const Slidenav = {
100
116
  extends: IconComponent,
101
117
 
@@ -29,10 +29,12 @@ export { default as Video } from './video';
29
29
  // Icon components
30
30
  export { Close } from './icon';
31
31
  export { Spinner } from './icon';
32
+ export { NavParentIcon } from './icon';
32
33
  export { Slidenav as SlidenavNext } from './icon';
33
34
  export { Slidenav as SlidenavPrevious } from './icon';
34
35
  export { Search as SearchIcon } from './icon';
35
36
  export { IconComponent as Marker } from './icon';
37
+ export { IconComponent as NavbarParentIcon } from './icon';
36
38
  export { IconComponent as NavbarToggleIcon } from './icon';
37
39
  export { IconComponent as OverlayIcon } from './icon';
38
40
  export { IconComponent as PaginationNext } from './icon';