uikit 3.25.30-dev.188f79c → 3.25.30-dev.6f7d153

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 (51) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/css/uikit-core-rtl.css +8 -6
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +8 -6
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +8 -6
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +8 -6
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +1 -1
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +1 -1
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +1 -1
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +93 -81
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +93 -81
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +13 -13
  43. package/src/js/core/drop.js +12 -3
  44. package/src/js/core/dropnav.js +67 -44
  45. package/src/js/core/navbar.js +1 -1
  46. package/src/js/core/toggle.js +36 -47
  47. package/src/js/util/lang.js +1 -1
  48. package/src/less/components/breadcrumb.less +7 -5
  49. package/src/scss/components/breadcrumb.scss +7 -5
  50. package/tests/js/index.js +2 -2
  51. package/tests/toggle.html +2 -2
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.25.30-dev.188f79c",
5
+ "version": "3.25.30-dev.6f7d153",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -33,26 +33,26 @@
33
33
  "packageManager": "pnpm@12.16.1",
34
34
  "devDependencies": {
35
35
  "@eslint/js": "^10.0.1",
36
- "@rollup/plugin-alias": "^6.0.0",
36
+ "@rollup/plugin-alias": "^6.0.1",
37
37
  "archiver": "^8.0.0",
38
38
  "camelcase": "^10.0.0",
39
39
  "clean-css": "^5.3.3",
40
- "esbuild": "^0.28.0",
41
- "eslint": "^10.0.0",
40
+ "esbuild": "^0.28.2",
41
+ "eslint": "^10.14.0",
42
42
  "eslint-config-prettier": "^10.1.8",
43
- "execa": "^10.0.0",
44
- "globals": "^17.0.0",
45
- "inquirer": "^14.0.2",
46
- "less": "^4.5.1",
43
+ "execa": "^10.2.1",
44
+ "globals": "^17.14.0",
45
+ "inquirer": "^14.2.5",
46
+ "less": "^4.9.1",
47
47
  "minimist": "^1.2.8",
48
- "p-limit": "^7.2.0",
49
- "prettier": "^3.7.4",
48
+ "p-limit": "^7.3.3",
49
+ "prettier": "^3.9.10",
50
50
  "prettier-plugin-organize-imports": "^4.3.0",
51
- "rollup": "^4.53.5",
51
+ "rollup": "^4.67.4",
52
52
  "rollup-plugin-esbuild": "^6.2.1",
53
53
  "rtlcss": "^4.3.0",
54
- "semver": "^7.7.3",
54
+ "semver": "^7.8.6",
55
55
  "strip-css-comments": "^5.0.0",
56
- "svgo": "^4.0.0"
56
+ "svgo": "^4.1.0"
57
57
  }
58
58
  }
@@ -194,7 +194,7 @@ export default {
194
194
 
195
195
  handler(e) {
196
196
  e.preventDefault();
197
- if (!matches(this.$el, ':focus,:hover')) {
197
+ if (!matches(this.$el, ':focus-within,:hover')) {
198
198
  this.hide();
199
199
  }
200
200
  },
@@ -213,12 +213,12 @@ export default {
213
213
  },
214
214
 
215
215
  {
216
- name: `${pointerLeave} focusout`,
216
+ name: pointerLeave,
217
217
 
218
218
  filter: ({ mode }) => includes(mode, 'hover'),
219
219
 
220
220
  handler(e) {
221
- if (!isTouch(e) && e.relatedTarget) {
221
+ if (!isTouch(e) && e.relatedTarget && !matches(this.$el, ':focus-within')) {
222
222
  this.hide();
223
223
  }
224
224
  },
@@ -252,6 +252,7 @@ export default {
252
252
  const handlers = [
253
253
  listenForResize(this),
254
254
  listenForEscClose(this),
255
+ listenForFocusClose(this),
255
256
  listenForBackgroundClose(this),
256
257
  this.autoUpdate && listenForScroll(this),
257
258
  this.closeOnScroll && listenForScrollClose(this),
@@ -501,6 +502,14 @@ function listenForScrollClose(drop) {
501
502
  return listenForScroll(drop, () => drop.hide(false));
502
503
  }
503
504
 
505
+ function listenForFocusClose(drop) {
506
+ return on(document, 'focusin', ({ target }) => {
507
+ if (!drop.$el.contains(target) && !drop.targetEl?.contains(target)) {
508
+ drop.hide(false);
509
+ }
510
+ });
511
+ }
512
+
504
513
  function listenForBackgroundClose(drop) {
505
514
  return onOutsidePointer(
506
515
  (target) => {
@@ -4,13 +4,13 @@ import {
4
4
  addClass,
5
5
  after,
6
6
  css,
7
- findIndex,
8
7
  getIndex,
9
8
  hasClass,
10
9
  height,
11
10
  includes,
12
11
  isInput,
13
12
  isRtl,
13
+ isVisible,
14
14
  matches,
15
15
  noop,
16
16
  observeResize,
@@ -65,7 +65,7 @@ export default {
65
65
  delayShow: 160,
66
66
  duration: 200,
67
67
  container: false,
68
- selNavItem: '> li > a, > ul > li > a',
68
+ selNavItem: '> li > a, > li > button, > ul > li > a, > ul > li > button',
69
69
  },
70
70
 
71
71
  computed: {
@@ -135,7 +135,7 @@ export default {
135
135
 
136
136
  events: [
137
137
  {
138
- name: 'mouseover focusin',
138
+ name: 'mouseover',
139
139
 
140
140
  delegate: ({ selNavItem }) => selNavItem,
141
141
 
@@ -161,27 +161,31 @@ export default {
161
161
  delegate: ({ selNavItem }) => selNavItem,
162
162
 
163
163
  handler(e) {
164
- const { current, keyCode } = e;
164
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
165
+ return;
166
+ }
167
+
168
+ const { current, keyCode, shiftKey } = e;
165
169
  const active = this.getActive();
166
170
 
167
- if (keyCode === keyMap.DOWN) {
168
- if (active?.targetEl === current) {
169
- e.preventDefault();
170
- $(selFocusable, active.$el)?.focus();
171
- } else {
172
- const dropdown = this.dropdowns.find(
173
- (el) => this.getDropdown(el)?.targetEl === current,
174
- );
171
+ if (keyCode === keyMap.ESC && active) {
172
+ closeDropdown(e, active);
173
+ return;
174
+ }
175
175
 
176
- if (dropdown) {
177
- e.preventDefault();
178
- current.click();
179
- once(dropdown, 'show', (e) => $(selFocusable, e.target)?.focus());
180
- }
176
+ if (
177
+ active?.targetEl === current &&
178
+ (keyCode === keyMap.DOWN || (keyCode === keyMap.TAB && !shiftKey))
179
+ ) {
180
+ const [first] = getFocusableElements(active.$el);
181
+ if (first) {
182
+ e.preventDefault();
183
+ first.focus();
181
184
  }
185
+ return;
182
186
  }
183
187
 
184
- handleNavItemNavigation(e, this.items, active);
188
+ handleNavigation(e, getFocusableElements(this.$el, this.selNavItem), current);
185
189
  },
186
190
  },
187
191
 
@@ -193,32 +197,39 @@ export default {
193
197
  delegate: ({ clsDrop }) => `.${clsDrop}`,
194
198
 
195
199
  handler(e) {
196
- const { current, keyCode, target } = e;
197
-
198
- if (isInput(target) || !includes(this.dropdowns, current)) {
200
+ if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) {
199
201
  return;
200
202
  }
201
203
 
204
+ const { current, keyCode, target } = e;
205
+
202
206
  const active = this.getActive();
203
- const next = getNavigationIndex(keyCode, keyMap.UP, keyMap.DOWN);
204
- if (~next) {
205
- e.preventDefault();
206
- const elements = $$(selFocusable, current);
207
- elements[
208
- getIndex(
209
- next,
210
- elements,
211
- findIndex(elements, (el) => matches(el, ':focus')),
212
- )
213
- ]?.focus();
207
+ if (!active || active.$el !== current) {
214
208
  return;
215
209
  }
216
210
 
217
211
  if (keyCode === keyMap.ESC) {
218
- active.targetEl?.focus();
212
+ closeDropdown(e, active);
213
+ return;
219
214
  }
220
215
 
221
- handleNavItemNavigation(e, this.items, active);
216
+ const elements = getFocusableElements(current);
217
+ if (keyCode === keyMap.TAB) {
218
+ if (target === elements[e.shiftKey ? 0 : elements.length - 1]) {
219
+ active.targetEl.focus();
220
+ if (e.shiftKey) {
221
+ e.preventDefault();
222
+ } else {
223
+ // Resume native Tab navigation after the toggle.
224
+ active.hide(false, false);
225
+ }
226
+ }
227
+ return;
228
+ }
229
+
230
+ if (!isInput(target)) {
231
+ handleNavigation(e, elements, target);
232
+ }
222
233
  },
223
234
  },
224
235
 
@@ -406,26 +417,38 @@ export default {
406
417
  },
407
418
  };
408
419
 
409
- function handleNavItemNavigation(e, toggles, active) {
410
- const { current, keyCode } = e;
420
+ function handleNavigation(e, elements, current) {
421
+ const keyCode =
422
+ { [keyMap.UP]: keyMap.LEFT, [keyMap.DOWN]: keyMap.RIGHT }[e.keyCode] || e.keyCode;
411
423
  const next = getNavigationIndex(keyCode);
412
-
413
424
  if (~next) {
414
425
  e.preventDefault();
415
- active.hide?.(false);
416
- toggles[getIndex(next, toggles, toggles.indexOf(active.targetEl || current))].focus();
417
- } else if (keyCode === keyMap.TAB) {
418
- active.targetEl?.focus();
419
- active.hide?.(false);
426
+ elements[getIndex(next, elements, elements.indexOf(current), true)]?.focus();
420
427
  }
421
428
  }
422
429
 
430
+ function closeDropdown(e, drop) {
431
+ e.preventDefault();
432
+ drop.hide(false);
433
+ drop.targetEl?.focus();
434
+ }
435
+
436
+ function getFocusableElements(el, selector = selFocusable) {
437
+ return $$(selector, el).filter(
438
+ (el) =>
439
+ el.tabIndex >= 0 &&
440
+ !matches(el, ':disabled') &&
441
+ !el.closest('[inert]') &&
442
+ isVisible(el),
443
+ );
444
+ }
445
+
423
446
  // Prevents initial pointer events from opening dropdowns on page load (Safari/Firefox)
424
447
  function preventInitialPointerEnter(el) {
425
448
  const off = () => handlers.forEach((handler) => handler());
426
449
  const handlers = [
427
450
  once(el.ownerDocument, pointerMove, (e) => el.contains(e.target) || off()),
428
- on(el, `mouseenter ${pointerEnter}`, (e) => e.stopPropagation(), { capture: true }),
429
- on(el, `mouseleave ${pointerLeave}`, off, { capture: true }),
451
+ on(el, `mouseenter ${pointerEnter}`, (e) => e.stopPropagation(), true),
452
+ on(el, `mouseleave ${pointerLeave}`, off, true),
430
453
  ];
431
454
  }
@@ -18,7 +18,7 @@ export default {
18
18
  delayShow: 200,
19
19
  clsDrop: 'uk-navbar-dropdown',
20
20
  selNavItem:
21
- '.uk-navbar-nav > li > a,a.uk-navbar-item,button.uk-navbar-item,.uk-navbar-item a,.uk-navbar-item button,.uk-navbar-toggle', // Simplify with :where() selector once browser target is Safari 14+
21
+ '.uk-navbar-nav > li > a,.uk-navbar-nav > li > button,a.uk-navbar-item,button.uk-navbar-item,.uk-navbar-item a,.uk-navbar-item button,.uk-navbar-toggle', // Simplify with :where() selector once browser target is Safari 14+
22
22
  dropbarTransparentMode: false,
23
23
  },
24
24
 
@@ -8,7 +8,6 @@ import {
8
8
  isTag,
9
9
  isTouch,
10
10
  matches,
11
- once,
12
11
  pointerDown,
13
12
  pointerEnter,
14
13
  pointerLeave,
@@ -69,72 +68,60 @@ export default {
69
68
  filter: ({ mode }) => includes(mode, 'hover'),
70
69
 
71
70
  handler(e) {
72
- this._preventClick = null;
73
-
74
- if (!isTouch(e) || isBoolean(this._showState) || this.$el.disabled) {
75
- return;
76
- }
77
-
78
- // Clicking a button does not give it focus on all browsers and platforms
79
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
80
- trigger(this.$el, 'focus');
81
- once(
82
- document,
83
- pointerDown,
84
- () => trigger(this.$el, 'blur'),
85
- true,
86
- (e) => !this.$el.contains(e.target),
87
- );
88
-
89
- // Prevent initial click to prevent double toggle through focus + click
90
- if (includes(this.mode, 'click')) {
91
- this._preventClick = true;
92
- }
71
+ // Preserve touch input for browsers whose click events lack pointerType.
72
+ this._touch = isTouch(e);
93
73
  },
94
74
  },
95
75
 
96
76
  {
97
- name: `${pointerEnter} ${pointerLeave} focus blur`,
77
+ name: `${pointerEnter} ${pointerLeave} click`,
98
78
 
99
79
  filter: ({ mode }) => includes(mode, 'hover'),
100
80
 
101
81
  handler(e) {
102
- if (isTouch(e) || this.$el.disabled || document.readyState === 'loading') {
82
+ const click = e.type === 'click';
83
+ const allowClick =
84
+ includes(this.mode, 'click') || e.detail === 0 || isTouch(e) || this._touch;
85
+ if (
86
+ this.$el.disabled ||
87
+ (click
88
+ ? e.defaultPrevented || !allowClick
89
+ : isTouch(e) || document.readyState === 'loading')
90
+ ) {
103
91
  return;
104
92
  }
105
93
 
106
- const show = includes([pointerEnter, 'focus'], e.type);
107
94
  const expanded = this.isToggled(this.target);
108
-
109
- // Skip hide if still hovered or focused
110
- if (
111
- !show &&
112
- (!isBoolean(this._showState) ||
113
- (e.type === pointerLeave && matches(this.$el, ':focus')) ||
114
- (e.type === 'blur' && matches(this.$el, ':hover')))
115
- ) {
116
- // Reset showState if already hidden
117
- if (expanded === this._showState) {
118
- this._showState = null;
95
+ if (e.type === pointerLeave) {
96
+ const initial = this._showState;
97
+ if (!isBoolean(initial)) {
98
+ return;
99
+ }
100
+ this._showState = null;
101
+ if (expanded !== initial) {
102
+ this.toggle('togglehide');
103
+ } else {
104
+ // Drops may have canceled a delayed hide on pointer re-entry.
105
+ trigger(this.target, 'togglehide', [this]);
119
106
  }
120
107
  return;
121
108
  }
122
109
 
123
- // Skip show if state does not change e.g. hover + focus received
124
- if (show && isBoolean(this._showState) && expanded !== this._showState) {
125
- return;
110
+ // Snapshot before hover or explicit activation changes the target.
111
+ if (!isBoolean(this._showState)) {
112
+ this._showState = expanded;
113
+ }
114
+ if (!click && expanded === this._showState) {
115
+ this.toggle('toggleshow');
126
116
  }
127
-
128
- this._showState = show ? expanded : null;
129
-
130
- this.toggle(`toggle${show ? 'show' : 'hide'}`);
131
117
  },
132
118
  },
133
119
 
134
120
  {
135
121
  name: 'keydown',
136
122
 
137
- filter: ({ $el, mode }) => includes(mode, 'click') && !isTag($el, 'input'),
123
+ filter: ({ $el, mode }) =>
124
+ ['click', 'hover'].some((m) => includes(mode, m)) && !isTag($el, 'input'),
138
125
 
139
126
  handler(e) {
140
127
  if (e.keyCode === keyMap.SPACE || e.keyCode === keyMap.ENTER) {
@@ -150,6 +137,9 @@ export default {
150
137
  filter: ({ mode }) => ['click', 'hover'].some((m) => includes(mode, m)),
151
138
 
152
139
  handler(e) {
140
+ const touch = this._touch;
141
+ this._touch = false;
142
+
153
143
  if (e.defaultPrevented) {
154
144
  return;
155
145
  }
@@ -158,13 +148,12 @@ export default {
158
148
  const isButtonLike =
159
149
  isSameSiteAnchor(link) && (!link.hash || matches(this.target, link.hash));
160
150
 
161
- if (this._preventClick || isButtonLike || (link && !this.isToggled(this.target))) {
151
+ if (isButtonLike || (link && !this.isToggled(this.target))) {
162
152
  e.preventDefault();
163
153
  }
164
154
 
165
155
  if (
166
- !this._preventClick &&
167
- includes(this.mode, 'click') &&
156
+ (includes(this.mode, 'click') || e.detail === 0 || isTouch(e) || touch) &&
168
157
  (!link || isButtonLike || e.defaultPrevented)
169
158
  ) {
170
159
  this.toggle();
@@ -255,5 +255,5 @@ export function getIndex(i, elements, current = 0, finite = false) {
255
255
 
256
256
  export function memoize(fn) {
257
257
  const cache = Object.create(null);
258
- return (key, ...args) => cache[key] || (cache[key] = fn(key, ...args));
258
+ return (key, ...args) => (cache[key] ||= fn(key, ...args));
259
259
  }
@@ -79,16 +79,18 @@
79
79
  /*
80
80
  * Divider
81
81
  * `nth-child` makes it also work without JS if it's only one row
82
- * 1. Remove space between inline block elements.
83
- * 2. Style
82
+ * 1. Use alternative text to hide divider from screen readers
83
+ * 2. Remove space between inline block elements.
84
+ * 3. Style
84
85
  */
85
86
 
86
87
  .uk-breadcrumb > :nth-child(n+2):not(.uk-first-column)::before {
87
- content: @breadcrumb-divider;
88
- display: inline-block;
89
88
  /* 1 */
90
- margin: 0 @breadcrumb-divider-margin-horizontal;
89
+ content: @breadcrumb-divider / "";
90
+ display: inline-block;
91
91
  /* 2 */
92
+ margin: 0 @breadcrumb-divider-margin-horizontal;
93
+ /* 3 */
92
94
  font-size: @breadcrumb-divider-font-size;
93
95
  color: @breadcrumb-divider-color;
94
96
  .hook-breadcrumb-divider();
@@ -72,16 +72,18 @@
72
72
  /*
73
73
  * Divider
74
74
  * `nth-child` makes it also work without JS if it's only one row
75
- * 1. Remove space between inline block elements.
76
- * 2. Style
75
+ * 1. Use alternative text to hide divider from screen readers
76
+ * 2. Remove space between inline block elements.
77
+ * 3. Style
77
78
  */
78
79
 
79
80
  .uk-breadcrumb > :nth-child(n+2):not(.uk-first-column)::before {
80
- content: $breadcrumb-divider;
81
- display: inline-block;
82
81
  /* 1 */
83
- margin: 0 $breadcrumb-divider-margin-horizontal;
82
+ content: $breadcrumb-divider / "";
83
+ display: inline-block;
84
84
  /* 2 */
85
+ margin: 0 $breadcrumb-divider-margin-horizontal;
86
+ /* 3 */
85
87
  font-size: $breadcrumb-divider-font-size;
86
88
  color: $breadcrumb-divider-color;
87
89
  @if(meta.mixin-exists(hook-breadcrumb-divider)) {@include hook-breadcrumb-divider();}
package/tests/js/index.js CHANGED
@@ -31,8 +31,8 @@ if (getParam('style') && getParam('style').match(/\.(json|css)$/)) {
31
31
  styles.custom = getParam('style');
32
32
  }
33
33
 
34
- storage[key] = storage[key] || 'core';
35
- storage[keyinverse] = storage[keyinverse] || '';
34
+ storage[key] ||= 'core';
35
+ storage[keyinverse] ||= '';
36
36
 
37
37
  const dir = storage._uikit_dir || 'ltr';
38
38
 
package/tests/toggle.html CHANGED
@@ -113,10 +113,10 @@
113
113
 
114
114
  <h3>Mode Hover</h3>
115
115
 
116
- <button class="uk-button uk-button-default" type="button" uk-toggle="target: ~; mode: hover">Hover, Focus</button>
116
+ <button class="uk-button uk-button-default" type="button" uk-toggle="target: ~; mode: hover">Hover, Activate</button>
117
117
 
118
118
  <p>What's up?</p>
119
- <p hidden>Hovered, Focused</p>
119
+ <p hidden>Hovered, Activated</p>
120
120
 
121
121
  </div>
122
122
  </div>