le-kit 0.2.0 → 0.2.2
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/dist/cjs/le-kit.cjs.js +1 -1
- package/dist/cjs/le-navigation.cjs.entry.js +115 -37
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/le-navigation/le-navigation.css +4 -0
- package/dist/collection/components/le-navigation/le-navigation.js +179 -37
- package/dist/collection/components/le-navigation/le-navigation.js.map +1 -1
- package/dist/collection/dist/components/assets/custom-elements.json +534 -386
- package/dist/collection/dist/components/assets/icons/ellipsis-horizontal.json +14 -0
- package/dist/collection/dist/components/assets/icons/ellipsis-vertical.json +14 -0
- package/dist/collection/dist/components/assets/icons/hamburger.json +14 -0
- package/dist/collection/types/options.js.map +1 -1
- package/dist/components/assets/custom-elements.json +534 -386
- package/dist/components/assets/icons/ellipsis-horizontal.json +14 -0
- package/dist/components/assets/icons/ellipsis-vertical.json +14 -0
- package/dist/components/assets/icons/hamburger.json +14 -0
- package/dist/components/le-navigation.js +119 -37
- package/dist/components/le-navigation.js.map +1 -1
- package/dist/docs.json +126 -8
- package/dist/esm/le-kit.js +1 -1
- package/dist/esm/le-navigation.entry.js +115 -37
- package/dist/esm/le-navigation.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/le-kit/dist/components/assets/custom-elements.json +534 -386
- package/dist/le-kit/dist/components/assets/icons/ellipsis-horizontal.json +14 -0
- package/dist/le-kit/dist/components/assets/icons/ellipsis-vertical.json +14 -0
- package/dist/le-kit/dist/components/assets/icons/hamburger.json +14 -0
- package/dist/le-kit/le-kit.esm.js +1 -1
- package/dist/le-kit/p-c08fcb00.entry.js +2 -0
- package/dist/le-kit/p-c08fcb00.entry.js.map +1 -0
- package/dist/types/components/le-navigation/le-navigation.d.ts +21 -0
- package/dist/types/components.d.ts +32 -2
- package/dist/types/types/options.d.ts +5 -0
- package/package.json +1 -1
- package/dist/le-kit/p-8c5a8f1e.entry.js +0 -2
- package/dist/le-kit/p-8c5a8f1e.entry.js.map +0 -1
|
@@ -7,6 +7,9 @@ import { classnames, generateId } from "../../utils/utils";
|
|
|
7
7
|
* - Supports hierarchical items via `children`.
|
|
8
8
|
* - Supports persisted expansion via `open` on items.
|
|
9
9
|
*
|
|
10
|
+
* @slot hamburger-trigger - Custom trigger contents for the hamburger button
|
|
11
|
+
* @slot more-trigger - Custom trigger contents for the "More" button
|
|
12
|
+
*
|
|
10
13
|
* @cmsEditable true
|
|
11
14
|
* @cmsCategory Navigation
|
|
12
15
|
*/
|
|
@@ -20,7 +23,7 @@ export class LeNavigation {
|
|
|
20
23
|
/**
|
|
21
24
|
* Layout orientation.
|
|
22
25
|
*/
|
|
23
|
-
orientation = '
|
|
26
|
+
orientation = 'horizontal';
|
|
24
27
|
/**
|
|
25
28
|
* Horizontal wrapping behavior.
|
|
26
29
|
* If false, overflow behavior depends on `overflowMode`.
|
|
@@ -32,6 +35,19 @@ export class LeNavigation {
|
|
|
32
35
|
* - hamburger: turns the whole nav into a hamburger popover
|
|
33
36
|
*/
|
|
34
37
|
overflowMode = 'more';
|
|
38
|
+
/**
|
|
39
|
+
* Minimum number of visible top-level items required to use the "More" overflow.
|
|
40
|
+
* If fewer would be visible, the navigation falls back to hamburger.
|
|
41
|
+
*/
|
|
42
|
+
minVisibleItemsForMore = 2;
|
|
43
|
+
/**
|
|
44
|
+
* Alignment of the hamburger trigger within the row.
|
|
45
|
+
*/
|
|
46
|
+
hamburgerAlign = 'start';
|
|
47
|
+
/**
|
|
48
|
+
* Active url for automatic selection.
|
|
49
|
+
*/
|
|
50
|
+
activeUrl = '';
|
|
35
51
|
/**
|
|
36
52
|
* Enables a search input for the vertical navigation.
|
|
37
53
|
*/
|
|
@@ -63,14 +79,30 @@ export class LeNavigation {
|
|
|
63
79
|
openState = {};
|
|
64
80
|
overflowIds = [];
|
|
65
81
|
hamburgerActive = false;
|
|
82
|
+
fallbackHamburger = false;
|
|
66
83
|
submenuQueries = {};
|
|
67
84
|
navContainerEl;
|
|
68
85
|
measureEl;
|
|
69
86
|
measureMoreEl;
|
|
70
87
|
topItemEls = new Map();
|
|
71
88
|
popoverRefs = new Map();
|
|
89
|
+
moreTriggerEl;
|
|
90
|
+
hamburgerPopoverEl;
|
|
91
|
+
morePopoverEl;
|
|
72
92
|
resizeObserver;
|
|
73
93
|
instanceId = generateId('le-nav');
|
|
94
|
+
partFromOptionPart(base, part) {
|
|
95
|
+
const raw = (part ?? '').trim();
|
|
96
|
+
if (!raw)
|
|
97
|
+
return base;
|
|
98
|
+
const tokens = raw
|
|
99
|
+
.split(/\s+/)
|
|
100
|
+
.map(t => t.replace(/[^a-zA-Z0-9_-]/g, ''))
|
|
101
|
+
.filter(Boolean);
|
|
102
|
+
if (tokens.length === 0)
|
|
103
|
+
return base;
|
|
104
|
+
return [base, ...tokens.map(t => `${base}-${t}`)].join(' ');
|
|
105
|
+
}
|
|
74
106
|
handleLayoutInputsChange() {
|
|
75
107
|
this.scheduleOverflowRecalc();
|
|
76
108
|
}
|
|
@@ -229,6 +261,8 @@ export class LeNavigation {
|
|
|
229
261
|
this.overflowIds = [];
|
|
230
262
|
if (this.hamburgerActive)
|
|
231
263
|
this.hamburgerActive = false;
|
|
264
|
+
if (this.fallbackHamburger)
|
|
265
|
+
this.fallbackHamburger = false;
|
|
232
266
|
return;
|
|
233
267
|
}
|
|
234
268
|
const container = this.navContainerEl;
|
|
@@ -245,10 +279,32 @@ export class LeNavigation {
|
|
|
245
279
|
}
|
|
246
280
|
if (this.overflowIds.length)
|
|
247
281
|
this.overflowIds = [];
|
|
282
|
+
if (this.fallbackHamburger)
|
|
283
|
+
this.fallbackHamburger = false;
|
|
248
284
|
return;
|
|
249
285
|
}
|
|
250
286
|
// overflowMode === 'more'
|
|
251
|
-
this.
|
|
287
|
+
if (this.hamburgerActive)
|
|
288
|
+
this.hamburgerActive = false;
|
|
289
|
+
const computedOverflow = this.computeOverflowMoreByWrap(availableWidth);
|
|
290
|
+
if (!computedOverflow)
|
|
291
|
+
return;
|
|
292
|
+
// Fallback to hamburger when "More" would leave too few items visible
|
|
293
|
+
// or when the trigger itself cannot fit the row.
|
|
294
|
+
const visibleCount = this.parsedItems.length - computedOverflow.length;
|
|
295
|
+
const moreWidth = this.moreTriggerEl?.getBoundingClientRect().width ?? 0;
|
|
296
|
+
const minVisible = Math.max(0, Number(this.minVisibleItemsForMore) || 0);
|
|
297
|
+
const shouldFallback = (computedOverflow.length > 0 && visibleCount < minVisible) ||
|
|
298
|
+
(moreWidth > 0 && moreWidth > availableWidth);
|
|
299
|
+
if (shouldFallback !== this.fallbackHamburger) {
|
|
300
|
+
this.fallbackHamburger = shouldFallback;
|
|
301
|
+
}
|
|
302
|
+
const nextOverflow = shouldFallback ? [] : computedOverflow;
|
|
303
|
+
const same = nextOverflow.length === this.overflowIds.length &&
|
|
304
|
+
nextOverflow.every((v, i) => v === this.overflowIds[i]);
|
|
305
|
+
if (!same) {
|
|
306
|
+
this.overflowIds = nextOverflow;
|
|
307
|
+
}
|
|
252
308
|
}
|
|
253
309
|
computeOverflowMoreByWrap(availableWidth) {
|
|
254
310
|
const container = this.navContainerEl;
|
|
@@ -256,9 +312,17 @@ export class LeNavigation {
|
|
|
256
312
|
const measureMore = this.measureMoreEl;
|
|
257
313
|
const items = this.parsedItems;
|
|
258
314
|
if (!container || !measure)
|
|
259
|
-
return;
|
|
315
|
+
return null;
|
|
260
316
|
// Ensure measurement container matches visible container width.
|
|
261
317
|
measure.style.width = `${availableWidth}px`;
|
|
318
|
+
// Keep the measured "More" width aligned with the real trigger width (supports slotted content).
|
|
319
|
+
const realMoreWidth = this.moreTriggerEl?.getBoundingClientRect().width;
|
|
320
|
+
if (measureMore && realMoreWidth && realMoreWidth > 0) {
|
|
321
|
+
const btn = measureMore.querySelector('button');
|
|
322
|
+
if (btn) {
|
|
323
|
+
btn.style.width = `${realMoreWidth}px`;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
262
326
|
const allIds = this.getTopLevelIds(items);
|
|
263
327
|
const itemEls = allIds
|
|
264
328
|
.map(id => measure.querySelector(`[data-nav-id="${CSS.escape(id)}"]`))
|
|
@@ -271,9 +335,7 @@ export class LeNavigation {
|
|
|
271
335
|
measureMore.style.display = 'none';
|
|
272
336
|
}
|
|
273
337
|
if (itemEls.length === 0) {
|
|
274
|
-
|
|
275
|
-
this.overflowIds = [];
|
|
276
|
-
return;
|
|
338
|
+
return [];
|
|
277
339
|
}
|
|
278
340
|
const firstRowTop = Math.min(...itemEls.map(el => el.offsetTop));
|
|
279
341
|
const overflowSet = new Set();
|
|
@@ -286,9 +348,7 @@ export class LeNavigation {
|
|
|
286
348
|
overflowSet.add(id);
|
|
287
349
|
});
|
|
288
350
|
if (overflowSet.size === 0) {
|
|
289
|
-
|
|
290
|
-
this.overflowIds = [];
|
|
291
|
-
return;
|
|
351
|
+
return [];
|
|
292
352
|
}
|
|
293
353
|
// Pass 2: show "More" and iteratively move items into overflow until "More" fits on row 1.
|
|
294
354
|
if (measureMore) {
|
|
@@ -319,11 +379,7 @@ export class LeNavigation {
|
|
|
319
379
|
overflowSet.add(lastId);
|
|
320
380
|
}
|
|
321
381
|
const overflowIds = allIds.filter(id => overflowSet.has(id));
|
|
322
|
-
|
|
323
|
-
overflowIds.every((v, i) => v === this.overflowIds[i]);
|
|
324
|
-
if (!same) {
|
|
325
|
-
this.overflowIds = overflowIds;
|
|
326
|
-
}
|
|
382
|
+
return overflowIds;
|
|
327
383
|
}
|
|
328
384
|
renderHorizontalMeasureItem(item, index) {
|
|
329
385
|
const id = this.getItemId(item, String(index));
|
|
@@ -336,9 +392,9 @@ export class LeNavigation {
|
|
|
336
392
|
if (!hasChildren) {
|
|
337
393
|
return (h("div", { class: "h-item", ref: setRef, "data-nav-id": id }, h("span", { class: "h-link" }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
|
|
338
394
|
}
|
|
339
|
-
return (h("div", { class: "h-item", ref: setRef, "data-nav-id": id }, h("span", { class: "h-trigger" }, h("span", { class: "h-link" }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label)), h("span", { class: "h-submenu-toggle", "aria-hidden": "true" }, h("
|
|
395
|
+
return (h("div", { class: "h-item", ref: setRef, "data-nav-id": id }, h("span", { class: "h-trigger" }, h("span", { class: "h-link" }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label)), h("span", { class: "h-submenu-toggle", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" })))));
|
|
340
396
|
}
|
|
341
|
-
renderVerticalList(items, { depth, pathPrefix, autoOpenIds, searchable, searchQuery, searchPlaceholder, emptyText, submenuId, }) {
|
|
397
|
+
renderVerticalList(items, { depth, pathPrefix, autoOpenIds, searchable, searchQuery, searchPlaceholder, emptyText, submenuId, closePopover, }) {
|
|
342
398
|
const query = searchQuery ?? '';
|
|
343
399
|
const openFromSearch = autoOpenIds ?? new Set();
|
|
344
400
|
const filtered = query ? this.filterTree(items, query, pathPrefix, openFromSearch) : items;
|
|
@@ -353,21 +409,28 @@ export class LeNavigation {
|
|
|
353
409
|
const attrs = TagType === 'a'
|
|
354
410
|
? { href: item.href, role: 'treeitem' }
|
|
355
411
|
: { type: 'button', role: 'treeitem' };
|
|
412
|
+
const itemPart = this.partFromOptionPart('item', item.part);
|
|
356
413
|
return (h("li", { class: classnames('nav-node', {
|
|
357
414
|
'disabled': item.disabled,
|
|
358
|
-
'selected': item.selected,
|
|
415
|
+
'selected': item.selected || (this.activeUrl && item.href === this.activeUrl),
|
|
359
416
|
open,
|
|
360
417
|
'has-children': hasChildren,
|
|
361
|
-
}), key: id, role: "none" }, h("div", { class: "nav-row", style: { paddingLeft } }, hasChildren ? (h("button", { type: "button", class: "nav-toggle", "aria-label": open ? 'Collapse' : 'Expand', "aria-expanded": open ? 'true' : 'false', onClick: (e) => this.handleToggle(e, item, id), disabled: item.disabled }, h("le-icon", { name: "chevron-down", class: "nav-chevron", "aria-hidden": "true" }))) : (h("span", { class: "nav-toggle-spacer", "aria-hidden": "true" })), h(TagType, { class: "nav-item", ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
418
|
+
}), key: id, role: "none" }, h("div", { class: "nav-row", style: { paddingLeft } }, hasChildren ? (h("button", { type: "button", class: "nav-toggle", "aria-label": open ? 'Collapse' : 'Expand', "aria-expanded": open ? 'true' : 'false', onClick: (e) => this.handleToggle(e, item, id), disabled: item.disabled }, h("le-icon", { name: "chevron-down", class: "nav-chevron", "aria-hidden": "true" }))) : (h("span", { class: "nav-toggle-spacer", "aria-hidden": "true" })), h(TagType, { class: "nav-item", part: itemPart, ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
362
419
|
// For buttons, also toggle if this is a purely structural node.
|
|
363
420
|
this.handleItemSelect(e, item, id);
|
|
364
421
|
if (!item.href && hasChildren && !item.disabled) {
|
|
365
422
|
this.handleToggle(e, item, id);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (!item.disabled && closePopover) {
|
|
426
|
+
closePopover();
|
|
366
427
|
}
|
|
367
428
|
} }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "nav-text" }, h("span", { class: "nav-label" }, item.label), item.description && (h("span", { class: "nav-description" }, item.description))), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))), hasChildren && (h("le-collapse", { class: "nav-children", closed: !open, noFading: true, role: "group" }, this.renderVerticalList(children, {
|
|
368
429
|
depth: depth + 1,
|
|
369
430
|
pathPrefix: path,
|
|
370
431
|
autoOpenIds: openFromSearch,
|
|
432
|
+
submenuId,
|
|
433
|
+
closePopover,
|
|
371
434
|
})))));
|
|
372
435
|
})))));
|
|
373
436
|
}
|
|
@@ -380,25 +443,28 @@ export class LeNavigation {
|
|
|
380
443
|
const attrs = TagType === 'a'
|
|
381
444
|
? { href: item.href, role: 'menuitem' }
|
|
382
445
|
: { type: 'button', role: 'menuitem' };
|
|
446
|
+
const itemPart = this.partFromOptionPart('item', item.part);
|
|
383
447
|
return (h("div", { class: "h-item" }, h(TagType, { class: classnames('h-link', {
|
|
384
448
|
disabled: item.disabled,
|
|
385
|
-
selected: item.selected,
|
|
386
|
-
}), ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => this.handleItemSelect(e, item, id) }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
|
|
449
|
+
selected: item.selected || (this.activeUrl && item.href === this.activeUrl),
|
|
450
|
+
}), part: itemPart, ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => this.handleItemSelect(e, item, id) }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), item.iconEnd && (h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
|
|
387
451
|
}
|
|
388
452
|
const submenuId = id;
|
|
453
|
+
const itemPart = this.partFromOptionPart('item', item.part);
|
|
389
454
|
return (h("div", { class: "h-item" }, h("le-popover", { ref: el => {
|
|
390
455
|
if (el)
|
|
391
456
|
this.popoverRefs.set(submenuId, el);
|
|
392
457
|
}, mode: "default", showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "start", minWidth: "240px" }, h("div", { slot: "trigger", class: classnames('h-trigger', {
|
|
393
458
|
disabled: item.disabled,
|
|
394
|
-
selected: item.selected,
|
|
395
|
-
}), role: "menuitem", "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
459
|
+
selected: item.selected || (this.activeUrl && item.href === this.activeUrl),
|
|
460
|
+
}), part: itemPart, role: "menuitem", "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
396
461
|
// Don’t let le-popover auto-toggle from its internal wrapper.
|
|
397
462
|
e.stopPropagation();
|
|
398
463
|
if (item.disabled)
|
|
399
464
|
return;
|
|
400
465
|
if (item.href) {
|
|
401
466
|
this.handleItemSelect(e, item, id);
|
|
467
|
+
this.popoverRefs.get(submenuId)?.hide();
|
|
402
468
|
}
|
|
403
469
|
else {
|
|
404
470
|
this.popoverRefs.get(submenuId)?.toggle();
|
|
@@ -406,18 +472,12 @@ export class LeNavigation {
|
|
|
406
472
|
} }, item.href ? (h("a", { class: "h-link", href: item.href, onClick: (e) => {
|
|
407
473
|
e.stopPropagation();
|
|
408
474
|
this.handleItemSelect(e, item, id);
|
|
409
|
-
} }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label))) : (h("button", { type: "button", class: "h-link", onClick: (e) => {
|
|
410
|
-
e.stopPropagation();
|
|
411
|
-
if (item.disabled)
|
|
412
|
-
return;
|
|
413
|
-
this.popoverRefs.get(submenuId)?.toggle();
|
|
414
|
-
} }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label))), h("button", { type: "button", class: "h-submenu-toggle", "aria-label": "Open submenu", onClick: (e) => {
|
|
415
|
-
e.preventDefault();
|
|
475
|
+
} }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), h("span", { class: "nav-chevron", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" })))) : (h("button", { type: "button", class: "h-link", onClick: (e) => {
|
|
416
476
|
e.stopPropagation();
|
|
417
477
|
if (item.disabled)
|
|
418
478
|
return;
|
|
419
479
|
this.popoverRefs.get(submenuId)?.toggle();
|
|
420
|
-
} }, h("span", { class: "nav-chevron", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" })))), h("div", { class: "popover-menu" }, this.renderVerticalList(children, {
|
|
480
|
+
} }, item.iconStart && (h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), h("span", { class: "h-label" }, item.label), h("span", { class: "nav-chevron", "aria-hidden": "true" }, h("le-icon", { name: "chevron-down" }))))), h("div", { class: "popover-menu" }, this.renderVerticalList(children, {
|
|
421
481
|
depth: 0,
|
|
422
482
|
pathPrefix: String(index),
|
|
423
483
|
searchable: this.submenuSearchable,
|
|
@@ -425,6 +485,7 @@ export class LeNavigation {
|
|
|
425
485
|
searchPlaceholder: this.searchPlaceholder,
|
|
426
486
|
emptyText: this.emptyText,
|
|
427
487
|
submenuId,
|
|
488
|
+
closePopover: () => this.popoverRefs.get(submenuId)?.hide(),
|
|
428
489
|
})))));
|
|
429
490
|
}
|
|
430
491
|
renderHorizontal() {
|
|
@@ -437,24 +498,35 @@ export class LeNavigation {
|
|
|
437
498
|
overflowItems.push(item);
|
|
438
499
|
}
|
|
439
500
|
});
|
|
440
|
-
|
|
441
|
-
|
|
501
|
+
const showHamburger = !this.wrap &&
|
|
502
|
+
((this.overflowMode === 'hamburger' && this.hamburgerActive) ||
|
|
503
|
+
(this.overflowMode === 'more' && this.fallbackHamburger));
|
|
504
|
+
// Hamburger mode: show a single trigger if anything overflows (or when forced for "more").
|
|
505
|
+
if (showHamburger) {
|
|
442
506
|
return (h("div", { class: "nav-horizontal-shell" }, h("div", { class: "nav-horizontal-measure", "aria-hidden": "true", ref: el => {
|
|
443
507
|
this.measureEl = el;
|
|
444
508
|
} }, items.map((item, index) => this.renderHorizontalMeasureItem(item, index)), h("div", { class: "h-item", ref: el => {
|
|
445
509
|
this.measureMoreEl = el;
|
|
446
|
-
} }, h("button", { type: "button", class: "overflow-trigger" }, "More"))), h("div", { class:
|
|
510
|
+
} }, h("button", { type: "button", class: "overflow-trigger" }, "More"))), h("div", { class: classnames('nav-horizontal', {
|
|
511
|
+
'hamburger-align-end': this.hamburgerAlign === 'end',
|
|
512
|
+
}), ref: el => {
|
|
447
513
|
this.navContainerEl = el;
|
|
448
514
|
this.setupResizeObserver();
|
|
449
515
|
this.observeContainer(this.navContainerEl);
|
|
450
|
-
} }, h("le-popover", {
|
|
516
|
+
} }, h("le-popover", { ref: el => {
|
|
517
|
+
this.hamburgerPopoverEl = el;
|
|
518
|
+
}, mode: "default", showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "end", minWidth: "260px" }, h("button", { slot: "trigger", type: "button", class: "overflow-trigger", part: "hamburger-trigger", "aria-label": "Open menu" }, h("slot", { name: "hamburger-trigger" }, h("le-icon", { name: "hamburger" }))), h("div", { class: "popover-menu" }, this.renderVerticalList(items, {
|
|
519
|
+
depth: 0,
|
|
520
|
+
pathPrefix: '',
|
|
521
|
+
closePopover: () => this.hamburgerPopoverEl?.hide(),
|
|
522
|
+
}))))));
|
|
451
523
|
}
|
|
452
524
|
const showMore = !this.wrap && this.overflowMode === 'more' && overflowItems.length > 0;
|
|
453
525
|
return (h("div", { class: "nav-horizontal-shell", role: "menubar" }, h("div", { class: "nav-horizontal-measure", "aria-hidden": "true", ref: el => {
|
|
454
526
|
this.measureEl = el;
|
|
455
527
|
} }, items.map((item, index) => this.renderHorizontalMeasureItem(item, index)), h("div", { class: "h-item", ref: el => {
|
|
456
528
|
this.measureMoreEl = el;
|
|
457
|
-
} }, h("button", { type: "button", class: "overflow-trigger" }, "
|
|
529
|
+
} }, h("button", { type: "button", class: "overflow-trigger" }, h("le-icon", { name: "ellipsis-horizontal" })))), h("div", { class: classnames('nav-horizontal', {
|
|
458
530
|
wrap: this.wrap,
|
|
459
531
|
nowrap: !this.wrap,
|
|
460
532
|
}), ref: el => {
|
|
@@ -470,7 +542,16 @@ export class LeNavigation {
|
|
|
470
542
|
}), h("div", { class: classnames('more-trigger-wrap', {
|
|
471
543
|
'is-visible': showMore,
|
|
472
544
|
'is-measure': !showMore,
|
|
473
|
-
}) }, h("le-popover", {
|
|
545
|
+
}) }, h("le-popover", { ref: el => {
|
|
546
|
+
this.morePopoverEl = el;
|
|
547
|
+
}, mode: "default", position: "bottom", align: "end", minWidth: "260px", showClose: false }, h("button", { slot: "trigger", type: "button", class: "overflow-trigger", part: "more-trigger", "aria-label": "More", ref: el => {
|
|
548
|
+
if (el)
|
|
549
|
+
this.moreTriggerEl = el;
|
|
550
|
+
} }, h("slot", { name: "more-trigger" }, h("le-icon", { name: "ellipsis-horizontal" }))), h("div", { class: "popover-menu" }, this.renderVerticalList(overflowItems, {
|
|
551
|
+
depth: 0,
|
|
552
|
+
pathPrefix: '',
|
|
553
|
+
closePopover: () => this.morePopoverEl?.hide(),
|
|
554
|
+
})))))));
|
|
474
555
|
}
|
|
475
556
|
render() {
|
|
476
557
|
const items = this.parsedItems;
|
|
@@ -544,7 +625,7 @@ export class LeNavigation {
|
|
|
544
625
|
"setter": false,
|
|
545
626
|
"reflect": true,
|
|
546
627
|
"attribute": "orientation",
|
|
547
|
-
"defaultValue": "'
|
|
628
|
+
"defaultValue": "'horizontal'"
|
|
548
629
|
},
|
|
549
630
|
"wrap": {
|
|
550
631
|
"type": "boolean",
|
|
@@ -586,6 +667,66 @@ export class LeNavigation {
|
|
|
586
667
|
"attribute": "overflow-mode",
|
|
587
668
|
"defaultValue": "'more'"
|
|
588
669
|
},
|
|
670
|
+
"minVisibleItemsForMore": {
|
|
671
|
+
"type": "number",
|
|
672
|
+
"mutable": false,
|
|
673
|
+
"complexType": {
|
|
674
|
+
"original": "number",
|
|
675
|
+
"resolved": "number",
|
|
676
|
+
"references": {}
|
|
677
|
+
},
|
|
678
|
+
"required": false,
|
|
679
|
+
"optional": false,
|
|
680
|
+
"docs": {
|
|
681
|
+
"tags": [],
|
|
682
|
+
"text": "Minimum number of visible top-level items required to use the \"More\" overflow.\nIf fewer would be visible, the navigation falls back to hamburger."
|
|
683
|
+
},
|
|
684
|
+
"getter": false,
|
|
685
|
+
"setter": false,
|
|
686
|
+
"reflect": false,
|
|
687
|
+
"attribute": "min-visible-items-for-more",
|
|
688
|
+
"defaultValue": "2"
|
|
689
|
+
},
|
|
690
|
+
"hamburgerAlign": {
|
|
691
|
+
"type": "string",
|
|
692
|
+
"mutable": false,
|
|
693
|
+
"complexType": {
|
|
694
|
+
"original": "'start' | 'end'",
|
|
695
|
+
"resolved": "\"end\" | \"start\"",
|
|
696
|
+
"references": {}
|
|
697
|
+
},
|
|
698
|
+
"required": false,
|
|
699
|
+
"optional": false,
|
|
700
|
+
"docs": {
|
|
701
|
+
"tags": [],
|
|
702
|
+
"text": "Alignment of the hamburger trigger within the row."
|
|
703
|
+
},
|
|
704
|
+
"getter": false,
|
|
705
|
+
"setter": false,
|
|
706
|
+
"reflect": true,
|
|
707
|
+
"attribute": "hamburger-align",
|
|
708
|
+
"defaultValue": "'start'"
|
|
709
|
+
},
|
|
710
|
+
"activeUrl": {
|
|
711
|
+
"type": "string",
|
|
712
|
+
"mutable": false,
|
|
713
|
+
"complexType": {
|
|
714
|
+
"original": "string",
|
|
715
|
+
"resolved": "string",
|
|
716
|
+
"references": {}
|
|
717
|
+
},
|
|
718
|
+
"required": false,
|
|
719
|
+
"optional": false,
|
|
720
|
+
"docs": {
|
|
721
|
+
"tags": [],
|
|
722
|
+
"text": "Active url for automatic selection."
|
|
723
|
+
},
|
|
724
|
+
"getter": false,
|
|
725
|
+
"setter": false,
|
|
726
|
+
"reflect": false,
|
|
727
|
+
"attribute": "active-url",
|
|
728
|
+
"defaultValue": "''"
|
|
729
|
+
},
|
|
589
730
|
"searchable": {
|
|
590
731
|
"type": "boolean",
|
|
591
732
|
"mutable": false,
|
|
@@ -674,6 +815,7 @@ export class LeNavigation {
|
|
|
674
815
|
"openState": {},
|
|
675
816
|
"overflowIds": {},
|
|
676
817
|
"hamburgerActive": {},
|
|
818
|
+
"fallbackHamburger": {},
|
|
677
819
|
"submenuQueries": {}
|
|
678
820
|
};
|
|
679
821
|
}
|