le-kit 0.1.19 → 0.2.0
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/index-pT2cVC5w.js.map +1 -1
- package/dist/cjs/le-button_13.cjs.entry.js +17 -21
- package/dist/cjs/le-icon.cjs.entry.js +108 -0
- package/dist/cjs/le-kit.cjs.js +1 -1
- package/dist/cjs/le-multiselect.cjs.entry.js +3 -3
- package/dist/cjs/le-navigation.cjs.entry.js +499 -0
- package/dist/cjs/le-number-input.cjs.entry.js +1 -1
- package/dist/cjs/le-round-progress.cjs.entry.js +1 -1
- package/dist/cjs/le-segmented-control.cjs.entry.js +1 -1
- package/dist/cjs/le-stack.cjs.entry.js +1 -1
- package/dist/cjs/le-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/le-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/le-tab.cjs.entry.js +1 -1
- package/dist/cjs/le-tabs.cjs.entry.js +2 -2
- package/dist/cjs/le-tag.cjs.entry.js +1 -1
- package/dist/cjs/le-turntable.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/assets/icons/chevron-down.svg +3 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/le-collapse/le-collapse.css +3 -3
- package/dist/collection/components/le-collapse/le-collapse.js +11 -15
- package/dist/collection/components/le-collapse/le-collapse.js.map +1 -1
- package/dist/collection/components/le-icon/le-icon.css +13 -0
- package/dist/collection/components/le-icon/le-icon.js +168 -0
- package/dist/collection/components/le-icon/le-icon.js.map +1 -0
- package/dist/collection/components/le-multiselect/le-multiselect.js +3 -3
- package/dist/collection/components/le-navigation/le-navigation.css +323 -0
- package/dist/collection/components/le-navigation/le-navigation.js +742 -0
- package/dist/collection/components/le-navigation/le-navigation.js.map +1 -0
- package/dist/collection/components/le-number-input/le-number-input.js +1 -1
- package/dist/collection/components/le-popover/le-popover.js +3 -3
- package/dist/collection/components/le-popup/le-popup.js +7 -7
- package/dist/collection/components/le-round-progress/le-round-progress.js +1 -1
- package/dist/collection/components/le-scroll-progress/le-scroll-progress.js +1 -1
- package/dist/collection/components/le-segmented-control/le-segmented-control.js +1 -1
- package/dist/collection/components/le-select/le-select.js +2 -2
- package/dist/collection/components/le-slot/le-slot.js +1 -1
- package/dist/collection/components/le-stack/le-stack.js +1 -1
- package/dist/collection/components/le-string-input/le-string-input.js +2 -2
- package/dist/collection/components/le-tab/le-tab.js +1 -1
- package/dist/collection/components/le-tab-bar/le-tab-bar.js +1 -1
- package/dist/collection/components/le-tab-panel/le-tab-panel.js +2 -2
- package/dist/collection/components/le-tabs/le-tabs.js +2 -2
- package/dist/collection/components/le-tag/le-tag.js +1 -1
- package/dist/collection/components/le-turntable/le-turntable.js +1 -1
- package/dist/collection/dist/components/assets/custom-elements.json +1278 -533
- package/dist/collection/dist/components/assets/icons/chevron-down.json +13 -0
- package/dist/collection/dist/components/assets/icons/chevron-down.svg +3 -0
- package/dist/collection/types/options.js.map +1 -1
- package/dist/components/assets/custom-elements.json +1278 -533
- package/dist/components/assets/icons/chevron-down.json +13 -0
- package/dist/components/assets/icons/chevron-down.svg +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/le-button2.js +5 -5
- package/dist/components/le-collapse.js +1 -137
- package/dist/components/le-collapse.js.map +1 -1
- package/dist/components/le-collapse2.js +138 -0
- package/dist/components/le-collapse2.js.map +1 -0
- package/dist/components/le-icon.d.ts +11 -0
- package/dist/components/le-icon.js +9 -0
- package/dist/components/le-icon.js.map +1 -0
- package/dist/components/le-icon2.js +133 -0
- package/dist/components/le-icon2.js.map +1 -0
- package/dist/components/le-multiselect.js +3 -3
- package/dist/components/le-navigation.d.ts +11 -0
- package/dist/components/le-navigation.js +598 -0
- package/dist/components/le-navigation.js.map +1 -0
- package/dist/components/le-number-input.js +1 -1
- package/dist/components/le-popover2.js +3 -3
- package/dist/components/le-round-progress.js +1 -1
- package/dist/components/le-scroll-progress.js +1 -1
- package/dist/components/le-segmented-control.js +1 -1
- package/dist/components/le-stack.js +1 -1
- package/dist/components/le-tab-bar.js +1 -1
- package/dist/components/le-tab-panel.js +2 -2
- package/dist/components/le-tab2.js +1 -1
- package/dist/components/le-tabs.js +2 -2
- package/dist/components/le-tag2.js +1 -1
- package/dist/components/le-turntable.js +1 -1
- package/dist/docs.json +515 -27
- package/dist/esm/index-CNv6tzAt.js.map +1 -1
- package/dist/esm/le-button_13.entry.js +17 -21
- package/dist/esm/le-icon.entry.js +106 -0
- package/dist/esm/le-icon.entry.js.map +1 -0
- package/dist/esm/le-kit.js +1 -1
- package/dist/esm/le-multiselect.entry.js +3 -3
- package/dist/esm/le-navigation.entry.js +497 -0
- package/dist/esm/le-navigation.entry.js.map +1 -0
- package/dist/esm/le-number-input.entry.js +1 -1
- package/dist/esm/le-round-progress.entry.js +1 -1
- package/dist/esm/le-segmented-control.entry.js +1 -1
- package/dist/esm/le-stack.entry.js +1 -1
- package/dist/esm/le-tab-bar.entry.js +1 -1
- package/dist/esm/le-tab-panel.entry.js +2 -2
- package/dist/esm/le-tab.entry.js +1 -1
- package/dist/esm/le-tabs.entry.js +2 -2
- package/dist/esm/le-tag.entry.js +1 -1
- package/dist/esm/le-turntable.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/le-kit/dist/components/assets/custom-elements.json +1278 -533
- package/dist/le-kit/dist/components/assets/icons/chevron-down.json +13 -0
- package/dist/le-kit/dist/components/assets/icons/chevron-down.svg +3 -0
- package/dist/le-kit/le-kit.esm.js +1 -1
- package/dist/le-kit/{p-3327b089.entry.js → p-0ac4397c.entry.js} +2 -2
- package/dist/le-kit/{p-dfd20890.entry.js → p-25a29e69.entry.js} +2 -2
- package/dist/le-kit/{p-64c2cee1.entry.js → p-511fbb63.entry.js} +2 -2
- package/dist/le-kit/{p-4bdb03cb.entry.js → p-58120921.entry.js} +2 -2
- package/dist/le-kit/{p-b7c008de.entry.js → p-5ceb06d8.entry.js} +2 -2
- package/dist/le-kit/p-8c5a8f1e.entry.js +2 -0
- package/dist/le-kit/p-8c5a8f1e.entry.js.map +1 -0
- package/dist/le-kit/{p-e3f3cc8f.entry.js → p-9a3bdbe1.entry.js} +2 -2
- package/dist/le-kit/p-CNv6tzAt.js.map +1 -1
- package/dist/le-kit/{p-f88c804a.entry.js → p-a0d2c580.entry.js} +2 -2
- package/dist/le-kit/p-b1dc7e06.entry.js +2 -0
- package/dist/le-kit/p-b1dc7e06.entry.js.map +1 -0
- package/dist/le-kit/p-bb160082.entry.js +2 -0
- package/dist/le-kit/p-bb160082.entry.js.map +1 -0
- package/dist/le-kit/{p-da0265c5.entry.js → p-de5638c9.entry.js} +2 -2
- package/dist/le-kit/{p-1733d907.entry.js → p-e24d3e33.entry.js} +2 -2
- package/dist/le-kit/{p-6acdf000.entry.js → p-ec20e438.entry.js} +2 -2
- package/dist/le-kit/{p-02532919.entry.js → p-f4f2c3e7.entry.js} +2 -2
- package/dist/types/components/le-collapse/le-collapse.d.ts +5 -3
- package/dist/types/components/le-icon/le-icon.d.ts +28 -0
- package/dist/types/components/le-navigation/le-navigation.d.ts +112 -0
- package/dist/types/components.d.ts +194 -10
- package/dist/types/types/options.d.ts +5 -0
- package/package.json +1 -1
- package/dist/collection/dist/components/assets/.gitkeep +0 -1
- package/dist/components/assets/.gitkeep +0 -1
- package/dist/le-kit/dist/components/assets/.gitkeep +0 -1
- package/dist/le-kit/p-83007215.entry.js +0 -2
- package/dist/le-kit/p-83007215.entry.js.map +0 -1
- /package/dist/le-kit/{p-3327b089.entry.js.map → p-0ac4397c.entry.js.map} +0 -0
- /package/dist/le-kit/{p-dfd20890.entry.js.map → p-25a29e69.entry.js.map} +0 -0
- /package/dist/le-kit/{p-64c2cee1.entry.js.map → p-511fbb63.entry.js.map} +0 -0
- /package/dist/le-kit/{p-4bdb03cb.entry.js.map → p-58120921.entry.js.map} +0 -0
- /package/dist/le-kit/{p-b7c008de.entry.js.map → p-5ceb06d8.entry.js.map} +0 -0
- /package/dist/le-kit/{p-e3f3cc8f.entry.js.map → p-9a3bdbe1.entry.js.map} +0 -0
- /package/dist/le-kit/{p-f88c804a.entry.js.map → p-a0d2c580.entry.js.map} +0 -0
- /package/dist/le-kit/{p-da0265c5.entry.js.map → p-de5638c9.entry.js.map} +0 -0
- /package/dist/le-kit/{p-1733d907.entry.js.map → p-e24d3e33.entry.js.map} +0 -0
- /package/dist/le-kit/{p-6acdf000.entry.js.map → p-ec20e438.entry.js.map} +0 -0
- /package/dist/le-kit/{p-02532919.entry.js.map → p-f4f2c3e7.entry.js.map} +0 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-pT2cVC5w.js');
|
|
4
|
+
var utils = require('./utils-ByTskwtC.js');
|
|
5
|
+
|
|
6
|
+
const leNavigationCss = () => `:host{display:block;--le-nav-radius:var(--le-radius-md);--le-nav-gap:var(--le-spacing-2);--le-nav-item-padding-x:var(--le-spacing-1);--le-nav-item-padding-y:var(--le-spacing-2);--le-nav-item-gap:var(--le-spacing-2);--le-nav-color:var(--le-color-text-primary);--le-nav-muted:var(--le-color-text-secondary);--le-nav-hover-bg:var(--le-color-gray-100);--le-nav-selected-bg:var(--le-color-primary);--le-nav-selected-color:var(--le-color-primary-contrast)}.nav-vertical{display:flex;flex-direction:column;gap:var(--le-nav-gap)}.nav-search{width:100%}.nav-search-input{--le-input-radius:var(--le-radius-md)}.nav-empty{padding:var(--le-spacing-2);color:var(--le-nav-muted);font-size:var(--le-font-size-sm)}.nav-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--le-spacing-1)}.nav-row{display:flex;align-items:stretch;gap:var(--le-spacing-1);border-radius:var(--le-nav-radius)}.nav-row:hover{background:var(--le-nav-hover-bg)}.nav-toggle,.nav-toggle-spacer{box-sizing:border-box;width:var(--le-spacing-4);min-width:var(--le-spacing-4);display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--le-nav-radius);color:inherit}.nav-toggle{background:transparent;cursor:pointer;opacity:0.4}.nav-toggle:hover:not(:disabled){opacity:1}.nav-toggle:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px;opacity:1}.nav-chevron{display:inline-block;transition:transform var(--le-transition-fast)}.nav-chevron svg{display:block;width:var(--le-spacing-4);height:var(--le-spacing-4)}.nav-node>div>button>.nav-chevron{transform:rotate(-90deg)}.nav-node.open>div>button>.nav-chevron{transform:rotate(0deg)}.nav-item{flex:1;display:inline-flex;align-items:center;gap:var(--le-nav-item-gap);padding:var(--le-nav-item-padding-y) var(--le-nav-item-padding-x) var(--le-nav-item-padding-y) 0;border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;text-decoration:none;color:var(--le-nav-color);font-family:var(--le-font-family-base);font-size:var(--le-font-size-md);line-height:var(--le-line-height-tight);cursor:pointer}.nav-item:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.nav-node.selected>.nav-row{background:var(--le-nav-selected-bg);color:var(--le-nav-selected-color)}.nav-node.selected>.nav-row>.nav-item{color:inherit}.nav-node.disabled>.nav-row>.nav-item{opacity:0.5;cursor:not-allowed}.nav-text{display:flex;flex-direction:column;min-width:0}.nav-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nav-description{color:color-mix(in srgb, var(--le-nav-muted) 90%, transparent);font-size:var(--le-font-size-sm);line-height:var(--le-line-height-tight)}.nav-icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.nav-icon-end{margin-left:auto}.nav-children{margin-top:var(--le-spacing-1)}.nav-horizontal{display:flex;align-items:center;gap:var(--le-spacing-2)}.nav-horizontal-shell{position:relative}.nav-horizontal-measure{position:absolute;left:-10000px;top:-10000px;visibility:hidden;pointer-events:none;display:flex;align-items:center;gap:var(--le-spacing-2);flex-wrap:wrap}.nav-horizontal.wrap{flex-wrap:wrap}.nav-horizontal.nowrap{flex-wrap:nowrap;overflow:hidden}.h-item{display:flex;align-items:center}.h-link{display:inline-flex;align-items:center;gap:var(--le-spacing-2);padding:var(--le-spacing-2) var(--le-spacing-3);border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;text-decoration:none;color:var(--le-nav-color);font-family:var(--le-font-family-base);font-size:var(--le-font-size-md);cursor:pointer}.h-link:hover{background:var(--le-nav-hover-bg)}.h-link:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.h-link.disabled,.h-trigger.disabled{opacity:0.5;pointer-events:none}.h-link.selected,.h-trigger.selected{background:var(--le-nav-selected-bg);color:var(--le-nav-selected-color)}.h-label{white-space:nowrap}.h-trigger{display:inline-flex;align-items:center;gap:var(--le-spacing-1);border-radius:var(--le-nav-radius)}.h-submenu-toggle{width:var(--le-spacing-3);height:var(--le-spacing-3);display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:var(--le-nav-radius);background:transparent;color:currentColor;cursor:pointer}.h-submenu-toggle:hover{background:var(--le-nav-hover-bg)}.more-trigger-wrap{display:flex;align-items:center}.more-trigger-wrap.is-measure{position:absolute;visibility:hidden;pointer-events:none}.more-trigger-wrap.is-visible{position:static;visibility:visible}.overflow-trigger{display:inline-flex;align-items:center;justify-content:center;gap:var(--le-spacing-2);padding:var(--le-spacing-2) var(--le-spacing-3);border-radius:var(--le-nav-radius);border:1px solid transparent;background:transparent;color:var(--le-nav-color);cursor:pointer;font-family:var(--le-font-family-base);font-size:var(--le-font-size-md)}.overflow-trigger:hover{background:var(--le-nav-hover-bg)}.overflow-trigger:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}le-popover::part(content){padding:var(--le-spacing-1)}`;
|
|
7
|
+
|
|
8
|
+
const LeNavigation = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
this.leNavItemSelect = index.createEvent(this, "leNavItemSelect");
|
|
12
|
+
this.leNavItemToggle = index.createEvent(this, "leNavItemToggle");
|
|
13
|
+
}
|
|
14
|
+
get el() { return index.getElement(this); }
|
|
15
|
+
/**
|
|
16
|
+
* Navigation items.
|
|
17
|
+
* Can be passed as an array or JSON string (same pattern as le-select).
|
|
18
|
+
*/
|
|
19
|
+
items = [];
|
|
20
|
+
/**
|
|
21
|
+
* Layout orientation.
|
|
22
|
+
*/
|
|
23
|
+
orientation = 'vertical';
|
|
24
|
+
/**
|
|
25
|
+
* Horizontal wrapping behavior.
|
|
26
|
+
* If false, overflow behavior depends on `overflowMode`.
|
|
27
|
+
*/
|
|
28
|
+
wrap = true;
|
|
29
|
+
/**
|
|
30
|
+
* Overflow behavior for horizontal, non-wrapping menus.
|
|
31
|
+
* - more: moves overflow items into a "More" popover
|
|
32
|
+
* - hamburger: turns the whole nav into a hamburger popover
|
|
33
|
+
*/
|
|
34
|
+
overflowMode = 'more';
|
|
35
|
+
/**
|
|
36
|
+
* Enables a search input for the vertical navigation.
|
|
37
|
+
*/
|
|
38
|
+
searchable = false;
|
|
39
|
+
/**
|
|
40
|
+
* Placeholder text for the search input.
|
|
41
|
+
*/
|
|
42
|
+
searchPlaceholder = 'Search...';
|
|
43
|
+
/**
|
|
44
|
+
* Text shown when no items match the filter.
|
|
45
|
+
*/
|
|
46
|
+
emptyText = 'No results found';
|
|
47
|
+
/**
|
|
48
|
+
* Whether submenu popovers should include a filter input.
|
|
49
|
+
*/
|
|
50
|
+
submenuSearchable = false;
|
|
51
|
+
/**
|
|
52
|
+
* Fired when a navigation item is activated.
|
|
53
|
+
*
|
|
54
|
+
* This event is cancelable. Call `event.preventDefault()` to prevent
|
|
55
|
+
* default browser navigation and implement custom routing.
|
|
56
|
+
*/
|
|
57
|
+
leNavItemSelect;
|
|
58
|
+
/**
|
|
59
|
+
* Fired when a tree branch is toggled.
|
|
60
|
+
*/
|
|
61
|
+
leNavItemToggle;
|
|
62
|
+
searchQuery = '';
|
|
63
|
+
openState = {};
|
|
64
|
+
overflowIds = [];
|
|
65
|
+
hamburgerActive = false;
|
|
66
|
+
submenuQueries = {};
|
|
67
|
+
navContainerEl;
|
|
68
|
+
measureEl;
|
|
69
|
+
measureMoreEl;
|
|
70
|
+
topItemEls = new Map();
|
|
71
|
+
popoverRefs = new Map();
|
|
72
|
+
resizeObserver;
|
|
73
|
+
instanceId = utils.generateId('le-nav');
|
|
74
|
+
handleLayoutInputsChange() {
|
|
75
|
+
this.scheduleOverflowRecalc();
|
|
76
|
+
}
|
|
77
|
+
componentDidLoad() {
|
|
78
|
+
this.setupResizeObserver();
|
|
79
|
+
this.scheduleOverflowRecalc();
|
|
80
|
+
}
|
|
81
|
+
disconnectedCallback() {
|
|
82
|
+
this.resizeObserver?.disconnect();
|
|
83
|
+
this.resizeObserver = undefined;
|
|
84
|
+
}
|
|
85
|
+
componentDidRender() {
|
|
86
|
+
// In case refs change after render.
|
|
87
|
+
this.scheduleOverflowRecalc();
|
|
88
|
+
}
|
|
89
|
+
setupResizeObserver() {
|
|
90
|
+
this.resizeObserver?.disconnect();
|
|
91
|
+
if (typeof ResizeObserver === 'undefined')
|
|
92
|
+
return;
|
|
93
|
+
this.resizeObserver = new ResizeObserver(() => this.computeOverflow());
|
|
94
|
+
this.observeContainer(this.navContainerEl);
|
|
95
|
+
}
|
|
96
|
+
observeContainer(el) {
|
|
97
|
+
if (!this.resizeObserver)
|
|
98
|
+
return;
|
|
99
|
+
this.resizeObserver.disconnect();
|
|
100
|
+
if (el)
|
|
101
|
+
this.resizeObserver.observe(el);
|
|
102
|
+
}
|
|
103
|
+
scheduleOverflowRecalc() {
|
|
104
|
+
// Avoid work for vertical layout.
|
|
105
|
+
if (this.orientation !== 'horizontal')
|
|
106
|
+
return;
|
|
107
|
+
// Ensure it runs after layout.
|
|
108
|
+
requestAnimationFrame(() => this.computeOverflow());
|
|
109
|
+
}
|
|
110
|
+
get parsedItems() {
|
|
111
|
+
if (typeof this.items === 'string') {
|
|
112
|
+
try {
|
|
113
|
+
return JSON.parse(this.items);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return this.items;
|
|
120
|
+
}
|
|
121
|
+
getItemId(item, path) {
|
|
122
|
+
return item.id ?? `${this.instanceId}:${path}`;
|
|
123
|
+
}
|
|
124
|
+
getChildItems(item) {
|
|
125
|
+
return Array.isArray(item.children) ? item.children : [];
|
|
126
|
+
}
|
|
127
|
+
isOpen(item, id) {
|
|
128
|
+
const fromState = this.openState[id];
|
|
129
|
+
if (typeof fromState === 'boolean')
|
|
130
|
+
return fromState;
|
|
131
|
+
return !!item.open;
|
|
132
|
+
}
|
|
133
|
+
setOpen(id, open) {
|
|
134
|
+
if (this.openState[id] === open)
|
|
135
|
+
return;
|
|
136
|
+
this.openState = {
|
|
137
|
+
...this.openState,
|
|
138
|
+
[id]: open,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
matchesQuery(option, query) {
|
|
142
|
+
if (!query)
|
|
143
|
+
return true;
|
|
144
|
+
const q = query.toLowerCase();
|
|
145
|
+
return (option.label.toLowerCase().includes(q) ||
|
|
146
|
+
(option.description?.toLowerCase().includes(q) ?? false));
|
|
147
|
+
}
|
|
148
|
+
filterTree(items, query, pathPrefix, autoOpen) {
|
|
149
|
+
if (!query)
|
|
150
|
+
return items;
|
|
151
|
+
const result = [];
|
|
152
|
+
items.forEach((item, index) => {
|
|
153
|
+
const path = pathPrefix ? `${pathPrefix}.${index}` : String(index);
|
|
154
|
+
const id = this.getItemId(item, path);
|
|
155
|
+
const children = this.getChildItems(item);
|
|
156
|
+
const filteredChildren = this.filterTree(children, query, path, autoOpen);
|
|
157
|
+
const selfMatch = this.matchesQuery(item, query);
|
|
158
|
+
const childMatch = filteredChildren.length > 0;
|
|
159
|
+
if (selfMatch || childMatch) {
|
|
160
|
+
if (childMatch) {
|
|
161
|
+
autoOpen.add(id);
|
|
162
|
+
}
|
|
163
|
+
if (childMatch && filteredChildren !== children) {
|
|
164
|
+
result.push({
|
|
165
|
+
...item,
|
|
166
|
+
children: filteredChildren,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
result.push(item);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
handleItemSelect = (e, item, id) => {
|
|
177
|
+
if (item.disabled) {
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
e.stopPropagation();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const emitted = this.leNavItemSelect.emit({
|
|
183
|
+
item,
|
|
184
|
+
id,
|
|
185
|
+
href: item.href,
|
|
186
|
+
originalEvent: e,
|
|
187
|
+
});
|
|
188
|
+
if (emitted.defaultPrevented) {
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
handleToggle = (e, item, id) => {
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
e.stopPropagation();
|
|
195
|
+
if (item.disabled)
|
|
196
|
+
return;
|
|
197
|
+
const next = !this.isOpen(item, id);
|
|
198
|
+
this.setOpen(id, next);
|
|
199
|
+
this.leNavItemToggle.emit({
|
|
200
|
+
item,
|
|
201
|
+
id,
|
|
202
|
+
open: next,
|
|
203
|
+
originalEvent: e,
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
handleSearchInput = (e) => {
|
|
207
|
+
const target = e.target;
|
|
208
|
+
this.searchQuery = target.value;
|
|
209
|
+
};
|
|
210
|
+
handleSubmenuSearchInput = (submenuId, e) => {
|
|
211
|
+
const target = e.target;
|
|
212
|
+
const value = target.value;
|
|
213
|
+
if (this.submenuQueries[submenuId] === value)
|
|
214
|
+
return;
|
|
215
|
+
this.submenuQueries = {
|
|
216
|
+
...this.submenuQueries,
|
|
217
|
+
[submenuId]: value,
|
|
218
|
+
};
|
|
219
|
+
// Position may change as items filter.
|
|
220
|
+
requestAnimationFrame(() => this.popoverRefs.get(submenuId)?.updatePosition());
|
|
221
|
+
};
|
|
222
|
+
getTopLevelIds(items) {
|
|
223
|
+
return items.map((item, index) => this.getItemId(item, String(index)));
|
|
224
|
+
}
|
|
225
|
+
computeOverflow() {
|
|
226
|
+
// Only applies to horizontal, non-wrapping navs.
|
|
227
|
+
if (this.orientation !== 'horizontal' || this.wrap) {
|
|
228
|
+
if (this.overflowIds.length)
|
|
229
|
+
this.overflowIds = [];
|
|
230
|
+
if (this.hamburgerActive)
|
|
231
|
+
this.hamburgerActive = false;
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const container = this.navContainerEl;
|
|
235
|
+
if (!container)
|
|
236
|
+
return;
|
|
237
|
+
const topIds = this.getTopLevelIds(this.parsedItems);
|
|
238
|
+
const widths = topIds.map(id => this.topItemEls.get(id)?.getBoundingClientRect().width ?? 0);
|
|
239
|
+
const totalWidth = widths.reduce((a, b) => a + b, 0);
|
|
240
|
+
const availableWidth = container.getBoundingClientRect().width;
|
|
241
|
+
if (this.overflowMode === 'hamburger') {
|
|
242
|
+
const shouldHamburger = totalWidth > availableWidth;
|
|
243
|
+
if (shouldHamburger !== this.hamburgerActive) {
|
|
244
|
+
this.hamburgerActive = shouldHamburger;
|
|
245
|
+
}
|
|
246
|
+
if (this.overflowIds.length)
|
|
247
|
+
this.overflowIds = [];
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
// overflowMode === 'more'
|
|
251
|
+
this.computeOverflowMoreByWrap(availableWidth);
|
|
252
|
+
}
|
|
253
|
+
computeOverflowMoreByWrap(availableWidth) {
|
|
254
|
+
const container = this.navContainerEl;
|
|
255
|
+
const measure = this.measureEl;
|
|
256
|
+
const measureMore = this.measureMoreEl;
|
|
257
|
+
const items = this.parsedItems;
|
|
258
|
+
if (!container || !measure)
|
|
259
|
+
return;
|
|
260
|
+
// Ensure measurement container matches visible container width.
|
|
261
|
+
measure.style.width = `${availableWidth}px`;
|
|
262
|
+
const allIds = this.getTopLevelIds(items);
|
|
263
|
+
const itemEls = allIds
|
|
264
|
+
.map(id => measure.querySelector(`[data-nav-id="${CSS.escape(id)}"]`))
|
|
265
|
+
.filter((el) => !!el);
|
|
266
|
+
// Reset measurement visibility.
|
|
267
|
+
itemEls.forEach(el => {
|
|
268
|
+
el.style.display = '';
|
|
269
|
+
});
|
|
270
|
+
if (measureMore) {
|
|
271
|
+
measureMore.style.display = 'none';
|
|
272
|
+
}
|
|
273
|
+
if (itemEls.length === 0) {
|
|
274
|
+
if (this.overflowIds.length)
|
|
275
|
+
this.overflowIds = [];
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const firstRowTop = Math.min(...itemEls.map(el => el.offsetTop));
|
|
279
|
+
const overflowSet = new Set();
|
|
280
|
+
// Pass 1: detect which items fall onto rows > 1 (without "More" in flow).
|
|
281
|
+
itemEls.forEach(el => {
|
|
282
|
+
const id = el.getAttribute('data-nav-id');
|
|
283
|
+
if (!id)
|
|
284
|
+
return;
|
|
285
|
+
if (el.offsetTop > firstRowTop)
|
|
286
|
+
overflowSet.add(id);
|
|
287
|
+
});
|
|
288
|
+
if (overflowSet.size === 0) {
|
|
289
|
+
if (this.overflowIds.length)
|
|
290
|
+
this.overflowIds = [];
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
// Pass 2: show "More" and iteratively move items into overflow until "More" fits on row 1.
|
|
294
|
+
if (measureMore) {
|
|
295
|
+
measureMore.style.display = '';
|
|
296
|
+
}
|
|
297
|
+
// Hide currently overflowing items.
|
|
298
|
+
itemEls.forEach(el => {
|
|
299
|
+
const id = el.getAttribute('data-nav-id');
|
|
300
|
+
if (!id)
|
|
301
|
+
return;
|
|
302
|
+
if (overflowSet.has(id))
|
|
303
|
+
el.style.display = 'none';
|
|
304
|
+
});
|
|
305
|
+
const getVisibleItemEls = () => itemEls.filter(el => el.style.display !== 'none');
|
|
306
|
+
while (measureMore) {
|
|
307
|
+
const visible = getVisibleItemEls();
|
|
308
|
+
const rowTop = visible.length ? Math.min(...visible.map(el => el.offsetTop)) : 0;
|
|
309
|
+
if (measureMore.offsetTop <= rowTop)
|
|
310
|
+
break;
|
|
311
|
+
if (visible.length === 0)
|
|
312
|
+
break;
|
|
313
|
+
// Remove one last visible item and retry.
|
|
314
|
+
const last = visible[visible.length - 1];
|
|
315
|
+
const lastId = last.getAttribute('data-nav-id');
|
|
316
|
+
if (!lastId)
|
|
317
|
+
break;
|
|
318
|
+
last.style.display = 'none';
|
|
319
|
+
overflowSet.add(lastId);
|
|
320
|
+
}
|
|
321
|
+
const overflowIds = allIds.filter(id => overflowSet.has(id));
|
|
322
|
+
const same = overflowIds.length === this.overflowIds.length &&
|
|
323
|
+
overflowIds.every((v, i) => v === this.overflowIds[i]);
|
|
324
|
+
if (!same) {
|
|
325
|
+
this.overflowIds = overflowIds;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
renderHorizontalMeasureItem(item, index$1) {
|
|
329
|
+
const id = this.getItemId(item, String(index$1));
|
|
330
|
+
const children = this.getChildItems(item);
|
|
331
|
+
const hasChildren = children.length > 0;
|
|
332
|
+
const setRef = (el) => {
|
|
333
|
+
if (el)
|
|
334
|
+
this.topItemEls.set(id, el);
|
|
335
|
+
};
|
|
336
|
+
if (!hasChildren) {
|
|
337
|
+
return (index.h("div", { class: "h-item", ref: setRef, "data-nav-id": id }, index.h("span", { class: "h-link" }, item.iconStart && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "h-label" }, item.label), item.iconEnd && (index.h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
|
|
338
|
+
}
|
|
339
|
+
return (index.h("div", { class: "h-item", ref: setRef, "data-nav-id": id }, index.h("span", { class: "h-trigger" }, index.h("span", { class: "h-link" }, item.iconStart && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "h-label" }, item.label)), index.h("span", { class: "h-submenu-toggle", "aria-hidden": "true" }, index.h("span", { class: "nav-chevron" }, "\u25BC")))));
|
|
340
|
+
}
|
|
341
|
+
renderVerticalList(items, { depth, pathPrefix, autoOpenIds, searchable, searchQuery, searchPlaceholder, emptyText, submenuId, }) {
|
|
342
|
+
const query = searchQuery ?? '';
|
|
343
|
+
const openFromSearch = autoOpenIds ?? new Set();
|
|
344
|
+
const filtered = query ? this.filterTree(items, query, pathPrefix, openFromSearch) : items;
|
|
345
|
+
return (index.h("div", { class: utils.classnames('nav-vertical', { 'is-submenu': !!submenuId }) }, searchable && (index.h("div", { class: "nav-search" }, index.h("le-string-input", { mode: "default", class: "nav-search-input", placeholder: searchPlaceholder ?? 'Search...', value: query, onInput: (e) => submenuId ? this.handleSubmenuSearchInput(submenuId, e) : this.handleSearchInput(e) }))), filtered.length === 0 ? (index.h("div", { class: "nav-empty" }, emptyText ?? this.emptyText)) : (index.h("ul", { class: "nav-list", role: "tree" }, filtered.map((item, index$1) => {
|
|
346
|
+
const path = pathPrefix ? `${pathPrefix}.${index$1}` : String(index$1);
|
|
347
|
+
const id = this.getItemId(item, path);
|
|
348
|
+
const children = this.getChildItems(item);
|
|
349
|
+
const hasChildren = children.length > 0;
|
|
350
|
+
const open = hasChildren && (this.isOpen(item, id) || openFromSearch.has(id));
|
|
351
|
+
const paddingLeft = `calc(var(--le-nav-item-padding-x) + ${depth} * var(--le-spacing-4))`;
|
|
352
|
+
const TagType = item.href && !item.disabled ? 'a' : 'button';
|
|
353
|
+
const attrs = TagType === 'a'
|
|
354
|
+
? { href: item.href, role: 'treeitem' }
|
|
355
|
+
: { type: 'button', role: 'treeitem' };
|
|
356
|
+
return (index.h("li", { class: utils.classnames('nav-node', {
|
|
357
|
+
'disabled': item.disabled,
|
|
358
|
+
'selected': item.selected,
|
|
359
|
+
open,
|
|
360
|
+
'has-children': hasChildren,
|
|
361
|
+
}), key: id, role: "none" }, index.h("div", { class: "nav-row", style: { paddingLeft } }, hasChildren ? (index.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 }, index.h("le-icon", { name: "chevron-down", class: "nav-chevron", "aria-hidden": "true" }))) : (index.h("span", { class: "nav-toggle-spacer", "aria-hidden": "true" })), index.h(TagType, { class: "nav-item", ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
362
|
+
// For buttons, also toggle if this is a purely structural node.
|
|
363
|
+
this.handleItemSelect(e, item, id);
|
|
364
|
+
if (!item.href && hasChildren && !item.disabled) {
|
|
365
|
+
this.handleToggle(e, item, id);
|
|
366
|
+
}
|
|
367
|
+
} }, item.iconStart && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "nav-text" }, index.h("span", { class: "nav-label" }, item.label), item.description && (index.h("span", { class: "nav-description" }, item.description))), item.iconEnd && (index.h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))), hasChildren && (index.h("le-collapse", { class: "nav-children", closed: !open, noFading: true, role: "group" }, this.renderVerticalList(children, {
|
|
368
|
+
depth: depth + 1,
|
|
369
|
+
pathPrefix: path,
|
|
370
|
+
autoOpenIds: openFromSearch,
|
|
371
|
+
})))));
|
|
372
|
+
})))));
|
|
373
|
+
}
|
|
374
|
+
renderHorizontalItem(item, index$1) {
|
|
375
|
+
const id = this.getItemId(item, String(index$1));
|
|
376
|
+
const children = this.getChildItems(item);
|
|
377
|
+
const hasChildren = children.length > 0;
|
|
378
|
+
if (!hasChildren) {
|
|
379
|
+
const TagType = item.href && !item.disabled ? 'a' : 'button';
|
|
380
|
+
const attrs = TagType === 'a'
|
|
381
|
+
? { href: item.href, role: 'menuitem' }
|
|
382
|
+
: { type: 'button', role: 'menuitem' };
|
|
383
|
+
return (index.h("div", { class: "h-item" }, index.h(TagType, { class: utils.classnames('h-link', {
|
|
384
|
+
disabled: item.disabled,
|
|
385
|
+
selected: item.selected,
|
|
386
|
+
}), ...attrs, "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => this.handleItemSelect(e, item, id) }, item.iconStart && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "h-label" }, item.label), item.iconEnd && (index.h("span", { class: "nav-icon nav-icon-end", "aria-hidden": "true" }, item.iconEnd)))));
|
|
387
|
+
}
|
|
388
|
+
const submenuId = id;
|
|
389
|
+
return (index.h("div", { class: "h-item" }, index.h("le-popover", { ref: el => {
|
|
390
|
+
if (el)
|
|
391
|
+
this.popoverRefs.set(submenuId, el);
|
|
392
|
+
}, mode: "default", showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "start", minWidth: "240px" }, index.h("div", { slot: "trigger", class: utils.classnames('h-trigger', {
|
|
393
|
+
disabled: item.disabled,
|
|
394
|
+
selected: item.selected,
|
|
395
|
+
}), role: "menuitem", "aria-disabled": item.disabled ? 'true' : undefined, onClick: (e) => {
|
|
396
|
+
// Don’t let le-popover auto-toggle from its internal wrapper.
|
|
397
|
+
e.stopPropagation();
|
|
398
|
+
if (item.disabled)
|
|
399
|
+
return;
|
|
400
|
+
if (item.href) {
|
|
401
|
+
this.handleItemSelect(e, item, id);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
this.popoverRefs.get(submenuId)?.toggle();
|
|
405
|
+
}
|
|
406
|
+
} }, item.href ? (index.h("a", { class: "h-link", href: item.href, onClick: (e) => {
|
|
407
|
+
e.stopPropagation();
|
|
408
|
+
this.handleItemSelect(e, item, id);
|
|
409
|
+
} }, item.iconStart && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "h-label" }, item.label))) : (index.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 && (index.h("span", { class: "nav-icon", "aria-hidden": "true" }, item.iconStart)), index.h("span", { class: "h-label" }, item.label))), index.h("button", { type: "button", class: "h-submenu-toggle", "aria-label": "Open submenu", onClick: (e) => {
|
|
415
|
+
e.preventDefault();
|
|
416
|
+
e.stopPropagation();
|
|
417
|
+
if (item.disabled)
|
|
418
|
+
return;
|
|
419
|
+
this.popoverRefs.get(submenuId)?.toggle();
|
|
420
|
+
} }, index.h("span", { class: "nav-chevron", "aria-hidden": "true" }, index.h("le-icon", { name: "chevron-down" })))), index.h("div", { class: "popover-menu" }, this.renderVerticalList(children, {
|
|
421
|
+
depth: 0,
|
|
422
|
+
pathPrefix: String(index$1),
|
|
423
|
+
searchable: this.submenuSearchable,
|
|
424
|
+
searchQuery: this.submenuQueries[submenuId] ?? '',
|
|
425
|
+
searchPlaceholder: this.searchPlaceholder,
|
|
426
|
+
emptyText: this.emptyText,
|
|
427
|
+
submenuId,
|
|
428
|
+
})))));
|
|
429
|
+
}
|
|
430
|
+
renderHorizontal() {
|
|
431
|
+
const items = this.parsedItems;
|
|
432
|
+
const overflowSet = new Set(this.overflowIds);
|
|
433
|
+
const overflowItems = [];
|
|
434
|
+
items.forEach((item, index) => {
|
|
435
|
+
const id = this.getItemId(item, String(index));
|
|
436
|
+
if (!this.wrap && this.overflowMode === 'more' && overflowSet.has(id)) {
|
|
437
|
+
overflowItems.push(item);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
// Hamburger mode: show a single trigger if anything overflows.
|
|
441
|
+
if (!this.wrap && this.overflowMode === 'hamburger' && this.hamburgerActive) {
|
|
442
|
+
return (index.h("div", { class: "nav-horizontal-shell" }, index.h("div", { class: "nav-horizontal-measure", "aria-hidden": "true", ref: el => {
|
|
443
|
+
this.measureEl = el;
|
|
444
|
+
} }, items.map((item, index) => this.renderHorizontalMeasureItem(item, index)), index.h("div", { class: "h-item", ref: el => {
|
|
445
|
+
this.measureMoreEl = el;
|
|
446
|
+
} }, index.h("button", { type: "button", class: "overflow-trigger" }, "More"))), index.h("div", { class: "nav-horizontal", ref: el => {
|
|
447
|
+
this.navContainerEl = el;
|
|
448
|
+
this.setupResizeObserver();
|
|
449
|
+
this.observeContainer(this.navContainerEl);
|
|
450
|
+
} }, index.h("le-popover", { mode: "default", showClose: false, closeOnClickOutside: true, closeOnEscape: true, position: "bottom", align: "end", minWidth: "260px" }, index.h("button", { slot: "trigger", type: "button", class: "overflow-trigger", "aria-label": "Open menu" }, "\u2630"), index.h("div", { class: "popover-menu" }, this.renderVerticalList(items, { depth: 0, pathPrefix: '' }))))));
|
|
451
|
+
}
|
|
452
|
+
const showMore = !this.wrap && this.overflowMode === 'more' && overflowItems.length > 0;
|
|
453
|
+
return (index.h("div", { class: "nav-horizontal-shell", role: "menubar" }, index.h("div", { class: "nav-horizontal-measure", "aria-hidden": "true", ref: el => {
|
|
454
|
+
this.measureEl = el;
|
|
455
|
+
} }, items.map((item, index) => this.renderHorizontalMeasureItem(item, index)), index.h("div", { class: "h-item", ref: el => {
|
|
456
|
+
this.measureMoreEl = el;
|
|
457
|
+
} }, index.h("button", { type: "button", class: "overflow-trigger" }, "More"))), index.h("div", { class: utils.classnames('nav-horizontal', {
|
|
458
|
+
wrap: this.wrap,
|
|
459
|
+
nowrap: !this.wrap,
|
|
460
|
+
}), ref: el => {
|
|
461
|
+
this.navContainerEl = el;
|
|
462
|
+
this.setupResizeObserver();
|
|
463
|
+
this.observeContainer(this.navContainerEl);
|
|
464
|
+
} }, items.map((item, index) => {
|
|
465
|
+
const id = this.getItemId(item, String(index));
|
|
466
|
+
const isOverflow = !this.wrap && this.overflowMode === 'more' && overflowSet.has(id);
|
|
467
|
+
if (isOverflow)
|
|
468
|
+
return null;
|
|
469
|
+
return this.renderHorizontalItem(item, index);
|
|
470
|
+
}), index.h("div", { class: utils.classnames('more-trigger-wrap', {
|
|
471
|
+
'is-visible': showMore,
|
|
472
|
+
'is-measure': !showMore,
|
|
473
|
+
}) }, index.h("le-popover", { mode: "default", position: "bottom", align: "end", minWidth: "260px", showClose: false }, index.h("button", { slot: "trigger", type: "button", class: "overflow-trigger", "aria-label": "More" }, "More"), index.h("div", { class: "popover-menu" }, this.renderVerticalList(overflowItems, { depth: 0, pathPrefix: '' })))))));
|
|
474
|
+
}
|
|
475
|
+
render() {
|
|
476
|
+
const items = this.parsedItems;
|
|
477
|
+
if (this.orientation === 'horizontal') {
|
|
478
|
+
return (index.h(index.Host, null, index.h("le-component", { component: "le-navigation" }, this.renderHorizontal())));
|
|
479
|
+
}
|
|
480
|
+
return (index.h(index.Host, null, index.h("le-component", { component: "le-navigation" }, this.renderVerticalList(items, {
|
|
481
|
+
depth: 0,
|
|
482
|
+
pathPrefix: '',
|
|
483
|
+
searchable: this.searchable,
|
|
484
|
+
searchQuery: this.searchQuery,
|
|
485
|
+
searchPlaceholder: this.searchPlaceholder,
|
|
486
|
+
emptyText: this.emptyText,
|
|
487
|
+
}))));
|
|
488
|
+
}
|
|
489
|
+
static get watchers() { return {
|
|
490
|
+
"items": ["handleLayoutInputsChange"],
|
|
491
|
+
"orientation": ["handleLayoutInputsChange"],
|
|
492
|
+
"wrap": ["handleLayoutInputsChange"],
|
|
493
|
+
"overflowMode": ["handleLayoutInputsChange"]
|
|
494
|
+
}; }
|
|
495
|
+
};
|
|
496
|
+
LeNavigation.style = leNavigationCss();
|
|
497
|
+
|
|
498
|
+
exports.le_navigation = LeNavigation;
|
|
499
|
+
//# sourceMappingURL=le-navigation.entry.cjs.js.map
|
|
@@ -190,7 +190,7 @@ const LeNumberInput = class {
|
|
|
190
190
|
this.emitChange();
|
|
191
191
|
};
|
|
192
192
|
render() {
|
|
193
|
-
return (index.h("le-component", { key: '
|
|
193
|
+
return (index.h("le-component", { key: '5ca731314dea05358c17f1d1341f60c092f7f3cf', component: "le-number-input", hostClass: utils.classnames({ 'disabled': this.disabled }) }, index.h("div", { key: '59d4e240934731b055ac907ae2834e0b298cfa43', class: "le-input-wrapper" }, this.label && (index.h("label", { key: 'c69754d91ce30e387336e79cb964d2b3811b6143', class: "le-input-label", htmlFor: this.name }, this.label)), index.h("div", { key: '87b8fd88f702752b78e392b668081dcabc3ee818', class: utils.classnames('le-input-container', { 'has-error': !this.isValid }) }, this.iconStart && (index.h("span", { key: 'df1ae914d42940d08378af548b3f75a61da4221d', class: "icon-start" }, this.iconStart)), index.h("input", { key: '65cf776d7ed9ba024cb74b0b28340e4122789f1d', id: this.name, type: "number", name: this.name, placeholder: this.placeholder, min: this.min, max: this.max, step: this.step, value: this.value, disabled: this.disabled, readOnly: this.readonly, required: this.required, onInput: this.handleInput, onChange: this.handleChange, onKeyDown: this.handleKeyDown, onWheel: this.handleWheel }), this.showSpinners && (index.h("div", { key: '2011b1d921ce59471f73e0e8ee71c31009cd6ccd', class: "le-input-controls" }, index.h("le-button", { key: '19d8bfdda57d33770d577477abc065b1f3c9f8bd', mode: "default", variant: "clear", size: "small", "icon-only": true, class: "le-input-control-btn", onClick: this.increment, disabled: this.disabled || this.readonly || (this.max !== undefined && this.value >= this.max), tabindex: "-1" }, index.h("span", { key: 'b9e929938c42d29d3d8f52547dbb2ea0d6660f59', slot: "icon-only" }, "\u2191")), index.h("le-button", { key: '0ac2bc5438d684deb4b29e229b7a7b1db09578e7', mode: "default", variant: "clear", size: "small", "icon-only": true, class: "le-input-control-btn", onClick: this.decrement, disabled: this.disabled || this.readonly || (this.min !== undefined && this.value <= this.min), tabindex: "-1" }, index.h("span", { key: 'ec2933d49fbff75b14c2c7a3ff994f15ab22b08f', slot: "icon-only" }, "\u2193"))))), !this.isValid && index.h("div", { key: '7dc47495f4c2aaf3f91efaad08f56fae47de3d05', class: "le-input-error" }, this.validationMessage), index.h("div", { key: '165415790fab9e911ab236570e2f2723043deebb', class: "le-input-description" }, index.h("le-slot", { key: 'bc6401930e0546dfae4bba8436ae56392fef3c1b', name: "description", type: "text", tag: "p", label: "Description" }, index.h("slot", { key: '0f39013377f404bfd78a4f19318a76e20d66f99a', name: "description" }))))));
|
|
194
194
|
}
|
|
195
195
|
static get watchers() { return {
|
|
196
196
|
"value": ["valueChanged"]
|
|
@@ -92,7 +92,7 @@ const LeRoundProgress = class {
|
|
|
92
92
|
return (index.h("svg", { viewBox: this.getViewBox(), class: "round-progress" }, paths));
|
|
93
93
|
}
|
|
94
94
|
render() {
|
|
95
|
-
return (index.h("div", { key: '
|
|
95
|
+
return (index.h("div", { key: '3ffd4b3088bb03af650e413b3c24b5c8206abe7b', class: "round-progress--container" }, this.getPaths(), index.h("svg", { key: 'd5b1a23bc9bf3092fa1e97857dcd1cb3d690d39d', viewBox: this.getViewBox(), class: "round-progress round-progress--progress" }, index.h("path", { key: 'a3ded815f03c77fbb693822223e10979ae0db760', class: "round-progress--circle", "stroke-dasharray": this.getStrokeDashArray(), d: this.getPath() })), index.h("slot", { key: '3d54c7c12e5930d51bc4dfcdcf1b82829eea8ad9' })));
|
|
96
96
|
}
|
|
97
97
|
static get watchers() { return {
|
|
98
98
|
"value": ["updateValue"],
|
|
@@ -228,7 +228,7 @@ const LeSegmentedControl = class {
|
|
|
228
228
|
'full-width': fullWidth,
|
|
229
229
|
'disabled': disabled,
|
|
230
230
|
};
|
|
231
|
-
return (index.h(index.Host, { key: '
|
|
231
|
+
return (index.h(index.Host, { key: '559bbf293fcd9108dfc04025562cee8d87fe87ba', class: `overflow-${this.overflow}` }, index.h("le-component", { key: '12cb853ddae94c506c5788882fb3336301e283c6', component: "le-segmented-control" }, index.h("div", { key: 'bedce1c124e8ab3daa089a74915afa8f6ed62f3d', class: classes, ref: el => (this.containerRef = el), role: "radiogroup", part: "container", onKeyDown: this.handleKeyDown, tabIndex: 0 }, segmentConfigs.map(option => {
|
|
232
232
|
const optValue = this.getOptionValue(option);
|
|
233
233
|
const isSelected = optValue === value;
|
|
234
234
|
const isDisabled = option.disabled || disabled;
|
|
@@ -126,7 +126,7 @@ const LeStack = class {
|
|
|
126
126
|
});
|
|
127
127
|
// Slot style for admin mode - make items display in the same direction
|
|
128
128
|
const slotStyle = `display: flex; flex-direction: ${this.getFlexDirection()}; gap: ${this.gap || 'var(--le-space-md)'}; flex-wrap: ${this.wrap ? 'wrap' : 'nowrap'}; justify-content: ${this.getJustifyContent()}; align-items: ${this.getAlignItems()};`;
|
|
129
|
-
return (index.h("le-component", { key: '
|
|
129
|
+
return (index.h("le-component", { key: '5f01f4afc716be565227e396952da314182de505', component: "le-stack", hostClass: hostClass }, index.h("div", { key: '1eef9ac4318f39038282c3574d0019c4d904b421', class: "stack", part: "stack", style: style }, index.h("le-slot", { key: 'f4445ca2070d685a3621df06dffe02b40cbb2db3', name: "", description: `Items arranged ${this.direction}ly${this.maxItems ? ` (max ${this.maxItems})` : ''}`, type: "slot", "allowed-components": "le-text,le-box,le-card,le-button,le-stack", slotStyle: slotStyle }, index.h("slot", { key: '90d40bfa5c766d6161614e90ab8f8cec8a0a6dc3' })))));
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
LeStack.style = leStackDefaultCss();
|
|
@@ -225,7 +225,7 @@ const LeTabBar = class {
|
|
|
225
225
|
'position-top': this.position === 'top',
|
|
226
226
|
'position-bottom': this.position === 'bottom',
|
|
227
227
|
};
|
|
228
|
-
return (index.h(index.Host, { key: '
|
|
228
|
+
return (index.h(index.Host, { key: '99ecfa8de9c894f913ab1ea2a2293c4fe863a6e9', class: classes }, index.h("le-component", { key: '59de2d9ffe9710d9480b6666a539039b0a38675e', component: "le-tab-bar" }, index.h("div", { key: '13b4037e84ee994d924bd08dc6305f1ad7bab3bd', class: "tablist", role: "tablist", "aria-orientation": "horizontal", part: "tablist", onKeyDown: this.handleKeyDown }, index.h("le-slot", { key: 'cab80272032e911ce09549fbdc18c2eb9df1de74', name: "", type: "slot", allowedComponents: "le-tab" }, tabConfigs.map(tab => {
|
|
229
229
|
const value = this.getTabValue(tab);
|
|
230
230
|
const isSelected = value === selected;
|
|
231
231
|
return (index.h("le-tab", { key: value, class: "tab", role: "tab", variant: "icon-only", label: tab.label, value: tab.value, icon: tab.icon, href: tab.href, selected: isSelected, disabled: tab.disabled, showLabel: this.showLabels, size: size, part: isSelected ? 'tab tab-active' : 'tab', "aria-selected": isSelected ? 'true' : 'false', "aria-disabled": tab.disabled ? 'true' : undefined, tabIndex: -1, onClick: () => this.handleTabClick(tab) }, index.h("span", { class: "tab-label" }, tab.label)));
|
|
@@ -84,11 +84,11 @@ const LeTabPanel = class {
|
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
86
|
const shouldRender = this.shouldRenderContent();
|
|
87
|
-
return (index.h("le-component", { key: '
|
|
87
|
+
return (index.h("le-component", { key: '19aab1adeb6de102df6c92d84df1ea65b4143912', component: "le-tab-panel" }, index.h("div", { key: 'e7c75b5a093da0cf0563b4e374c98c2fba2e8cb1', class: {
|
|
88
88
|
'tab-panel': true,
|
|
89
89
|
'active': this.active,
|
|
90
90
|
'lazy-hidden': this.lazy && !this.active,
|
|
91
|
-
}, role: "tabpanel", "aria-hidden": !this.active ? 'true' : undefined, tabIndex: this.active ? 0 : -1 }, index.h("le-slot", { key: '
|
|
91
|
+
}, role: "tabpanel", "aria-hidden": !this.active ? 'true' : undefined, tabIndex: this.active ? 0 : -1 }, index.h("le-slot", { key: '0847f8b0cb41f5fbc131839160eadb51e9d5f5a4', name: "", description: "Tab panel content", type: "slot" }, shouldRender && index.h("slot", { key: 'c52b444823c3e981a3e832c16fa1cd5db53d6d33' })))));
|
|
92
92
|
}
|
|
93
93
|
static get watchers() { return {
|
|
94
94
|
"active": ["activeChanged"]
|
|
@@ -127,7 +127,7 @@ const LeTab = class {
|
|
|
127
127
|
const attrs = this.href
|
|
128
128
|
? { href: this.href, target: this.target, role: 'button' }
|
|
129
129
|
: { disabled: this.disabled };
|
|
130
|
-
return (index.h(index.Host, { key: '
|
|
130
|
+
return (index.h(index.Host, { key: '7e073b5ca3bba044c2325571ca9aed94b0be66de' }, index.h("le-component", { key: 'b6c6952c9f8b48b5f4f7851d1216de160dd16c45', component: "le-tab" }, index.h(TagType, { key: 'e1c901c60e75ff9104420c28452964d090f67365', class: utils.classnames('le-tab-container', `le-tab-align-${this.align}`, classes), part: "button", ...attrs, onClick: this.handleClick, tabIndex: this.focusable ? 0 : -1 }, this.icon !== undefined ? (index.h("div", { class: "icon-only" }, index.h("div", { class: "icon" }, this.icon), this.showLabel && index.h("span", { class: "icon-label" }, this.label))) : (index.h(index.Fragment, null, index.h("span", { class: "le-tab-label" }, this.iconStart && (index.h("span", { class: "icon-start", part: "icon-start" }, this.iconStart)), index.h("le-slot", { name: "", description: "Tab text", type: "text", class: "content", part: "content" }, index.h("slot", null, this.label))), this.iconEnd && (index.h("span", { class: "icon-end", part: "icon-end" }, this.iconEnd))))))));
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
LeTab.style = leTabCss();
|
|
@@ -273,7 +273,7 @@ const LeTabs = class {
|
|
|
273
273
|
: this.position === 'start'
|
|
274
274
|
? 'top'
|
|
275
275
|
: 'bottom';
|
|
276
|
-
return (index.h("le-component", { key: '
|
|
276
|
+
return (index.h("le-component", { key: '6882b32d3be8f1686c1f367bdcd9fc54ee92a8ee', component: "le-tabs", hostClass: utils.classnames(classes) }, index.h("div", { key: 'd50731bf95b4898dec01f1a003f6b8e1f694ef87', class: classes }, index.h("div", { key: '1e07303c43016d13dedff719b6efc5374f97d7db', class: {
|
|
277
277
|
'tablist': true,
|
|
278
278
|
'wrap-tabs': this.wrap,
|
|
279
279
|
[`overflow-${this.overflow}`]: true,
|
|
@@ -282,7 +282,7 @@ const LeTabs = class {
|
|
|
282
282
|
const tabId = `tab-${config.value}`;
|
|
283
283
|
const panelId = `panel-${config.value}`;
|
|
284
284
|
return (index.h("le-tab", { key: config.value, id: tabId, class: "tab", mode: "default", variant: this.variant, selected: isSelected, disabled: config.disabled, size: this.size, position: tabPosition, align: this.orientation === 'vertical' ? 'start' : 'center', role: "tab", part: isSelected ? 'tab tab-active' : 'tab', "aria-selected": isSelected ? 'true' : 'false', "aria-controls": panelId, "aria-disabled": config.disabled ? 'true' : undefined, focusable: false, onClick: () => this.handleTabClick(config), iconStart: config.iconStart, iconEnd: config.iconEnd }, index.h("span", { class: "tab-label" }, config.label)));
|
|
285
|
-
})), index.h("div", { key: '
|
|
285
|
+
})), index.h("div", { key: 'dcd32445495900eda29cc610c30261da6262c3c4', class: "panels", part: "panels" }, isDeclarativeMode ? (
|
|
286
286
|
// Declarative mode - render slot for le-tab-panel children
|
|
287
287
|
index.h("le-slot", { name: "", description: "Tab panels", type: "slot", allowedComponents: "le-tab-panel" }, index.h("slot", null))) : (
|
|
288
288
|
// Programmatic mode - render named slots
|
|
@@ -59,7 +59,7 @@ const LeTag = class {
|
|
|
59
59
|
return index.h("span", { class: "tag-icon" }, this.icon);
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (index.h("le-component", { key: '
|
|
62
|
+
return (index.h("le-component", { key: '0cae0957e69fe0a1304f81e69d12d31c18ba9d19', component: "le-tag" }, index.h("span", { key: 'b9d141aa16c0d8a22f2a0ee274feae4af3f330a4', class: "tag" }, this.renderIcon(), index.h("span", { key: '721836b45727b79547f4207a59c0a42266f3b24a', class: "tag-label" }, index.h("le-slot", { key: '48be93bc17af5fa8fd8de18f6c53b81b26dee01b', name: "", tag: "span", type: "text" }, index.h("slot", { key: '482d37fe79b37fade8460a8abde4813e3ececa99' }, this.label))), this.dismissible && (index.h("button", { key: 'a0de79ab2ea5ce3e6f37b255028096a31ca06a33', type: "button", class: "tag-dismiss", onClick: this.handleDismiss, disabled: this.disabled, "aria-label": "Remove" }, index.h("svg", { key: 'ff30daa4aaffa92e7fc7d29b66c0ee401c9541ac', viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", "stroke-width": "2" }, index.h("path", { key: '3f7d739758c3213847f0214cb6377c4e5c48abab', d: "M4 4l8 8M12 4l-8 8" })))))));
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
LeTag.style = leTagCss();
|