luxen-ui 0.22.0 → 0.22.1
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.
- package/cdn/custom-elements.json +556 -556
- package/cdn/elements/dropdown/dropdown.d.ts +8 -0
- package/cdn/elements/dropdown/dropdown.d.ts.map +1 -1
- package/cdn/elements/dropdown/dropdown.js +2 -2
- package/cdn/elements/dropdown/dropdown.js.map +1 -1
- package/dist/custom-elements.json +556 -556
- package/dist/elements/dropdown/dropdown.d.ts +8 -0
- package/dist/elements/dropdown/dropdown.d.ts.map +1 -1
- package/dist/elements/dropdown/dropdown.js +33 -8
- package/dist/metadata/index.json +1 -1
- package/package.json +1 -1
|
@@ -78,6 +78,14 @@ export declare class Dropdown extends LuxenElement {
|
|
|
78
78
|
private _hoverTimer;
|
|
79
79
|
private _hoverItem;
|
|
80
80
|
private _openSubmenu;
|
|
81
|
+
/**
|
|
82
|
+
* Drop the pending hover-open. A click or a key press is an explicit decision
|
|
83
|
+
* that supersedes it — left armed, the timer would fire afterwards and reopen
|
|
84
|
+
* a submenu the user just closed. By default `_hoverItem` is kept, so staying
|
|
85
|
+
* on the same row doesn't re-arm it; `forget` also clears it, for when the
|
|
86
|
+
* pointer leaves the row or the menu goes away.
|
|
87
|
+
*/
|
|
88
|
+
private _cancelHoverIntent;
|
|
81
89
|
private _closeAllSubmenus;
|
|
82
90
|
/**
|
|
83
91
|
* The item targeted by a pointer event, via the composed path. Returns null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dropdown/dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,M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gB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAC;IACR,mBAAmB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAClD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC3D,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;IACR,mBAAmB,CACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;CACT"}
|
|
@@ -25,6 +25,8 @@ import { ShowEvent, AfterShowEvent, HideEvent, AfterHideEvent } from '../../even
|
|
|
25
25
|
import hostStyles from '../../shared/styles/host.styles.js';
|
|
26
26
|
import rawStyles from './dropdown.css?inline';
|
|
27
27
|
const styles = unsafeCSS(rawStyles);
|
|
28
|
+
/** Keys that decide nothing on their own — pressing one must not drop a pending hover. */
|
|
29
|
+
const MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'AltGraph', 'Meta']);
|
|
28
30
|
/** Fired when a dropdown item is selected. Bubbles; not composed. */
|
|
29
31
|
export class DropdownSelectEvent extends Event {
|
|
30
32
|
constructor(item) {
|
|
@@ -140,6 +142,8 @@ export class Dropdown extends LuxenElement {
|
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
144
|
this._onPanelKeyDown = (e) => {
|
|
145
|
+
if (!MODIFIER_KEYS.has(e.key))
|
|
146
|
+
this._cancelHoverIntent();
|
|
143
147
|
switch (e.key) {
|
|
144
148
|
case 'ArrowDown':
|
|
145
149
|
e.preventDefault();
|
|
@@ -211,6 +215,7 @@ export class Dropdown extends LuxenElement {
|
|
|
211
215
|
return;
|
|
212
216
|
if (item.hasSubmenu) {
|
|
213
217
|
// A parent item toggles its submenu instead of selecting
|
|
218
|
+
this._cancelHoverIntent();
|
|
214
219
|
if (item.submenuOpen)
|
|
215
220
|
item.closeSubmenu();
|
|
216
221
|
else
|
|
@@ -228,7 +233,7 @@ export class Dropdown extends LuxenElement {
|
|
|
228
233
|
const item = this._itemFromEvent(e);
|
|
229
234
|
if (item === this._hoverItem)
|
|
230
235
|
return;
|
|
231
|
-
|
|
236
|
+
this._cancelHoverIntent();
|
|
232
237
|
this._hoverItem = item;
|
|
233
238
|
if (!item || item.disabled)
|
|
234
239
|
return;
|
|
@@ -236,9 +241,19 @@ export class Dropdown extends LuxenElement {
|
|
|
236
241
|
void this._openSubmenu(item);
|
|
237
242
|
}, 100);
|
|
238
243
|
};
|
|
239
|
-
this._onPanelPointerOut = () => {
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
this._onPanelPointerOut = (e) => {
|
|
245
|
+
// pointerout also fires between parts of the same row — a slotted icon and
|
|
246
|
+
// the row padding (the related target arrives retargeted to the item host).
|
|
247
|
+
// Forgetting the row there would let the next pointerover re-arm the timer
|
|
248
|
+
// and reopen a submenu a click just closed. Leaving the row is pointerover's
|
|
249
|
+
// call, or this one's once the pointer exits the panel.
|
|
250
|
+
const to = e.relatedTarget;
|
|
251
|
+
if (this._hoverItem &&
|
|
252
|
+
to instanceof Element &&
|
|
253
|
+
to.closest(tagName('dropdown-item')) === this._hoverItem) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this._cancelHoverIntent({ forget: true });
|
|
242
257
|
};
|
|
243
258
|
/**
|
|
244
259
|
* Route `popover="auto"` light-dismiss through the same close path as every
|
|
@@ -362,8 +377,7 @@ export class Dropdown extends LuxenElement {
|
|
|
362
377
|
// --- Lifecycle ---
|
|
363
378
|
disconnectedCallback() {
|
|
364
379
|
super.disconnectedCallback();
|
|
365
|
-
|
|
366
|
-
this._hoverItem = null;
|
|
380
|
+
this._cancelHoverIntent({ forget: true });
|
|
367
381
|
}
|
|
368
382
|
updated(changed) {
|
|
369
383
|
if (changed.has('open')) {
|
|
@@ -426,9 +440,20 @@ export class Dropdown extends LuxenElement {
|
|
|
426
440
|
this._setActiveItem(first);
|
|
427
441
|
}
|
|
428
442
|
}
|
|
429
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Drop the pending hover-open. A click or a key press is an explicit decision
|
|
445
|
+
* that supersedes it — left armed, the timer would fire afterwards and reopen
|
|
446
|
+
* a submenu the user just closed. By default `_hoverItem` is kept, so staying
|
|
447
|
+
* on the same row doesn't re-arm it; `forget` also clears it, for when the
|
|
448
|
+
* pointer leaves the row or the menu goes away.
|
|
449
|
+
*/
|
|
450
|
+
_cancelHoverIntent({ forget = false } = {}) {
|
|
430
451
|
clearTimeout(this._hoverTimer);
|
|
431
|
-
|
|
452
|
+
if (forget)
|
|
453
|
+
this._hoverItem = null;
|
|
454
|
+
}
|
|
455
|
+
_closeAllSubmenus() {
|
|
456
|
+
this._cancelHoverIntent({ forget: true });
|
|
432
457
|
for (const item of this._getAllItems())
|
|
433
458
|
item.closeSubmenu();
|
|
434
459
|
}
|
package/dist/metadata/index.json
CHANGED
package/package.json
CHANGED