@vaadin/side-nav 24.4.0-alpha9 → 24.4.0-dev.4b20a0c55
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/README.md +1 -2
- package/package.json +7 -7
- package/src/vaadin-side-nav-item.d.ts +18 -3
- package/src/vaadin-side-nav-item.js +43 -7
- package/src/vaadin-side-nav.d.ts +44 -0
- package/src/vaadin-side-nav.js +100 -0
- package/theme/lumo/vaadin-side-nav-item-styles.d.ts +0 -7
- package/theme/lumo/vaadin-side-nav-item.d.ts +0 -7
- package/theme/lumo/vaadin-side-nav-styles.d.ts +0 -7
- package/theme/lumo/vaadin-side-nav.d.ts +0 -8
- package/theme/material/vaadin-side-nav-item-styles.d.ts +0 -4
- package/theme/material/vaadin-side-nav-item.d.ts +0 -7
- package/theme/material/vaadin-side-nav-styles.d.ts +0 -4
- package/theme/material/vaadin-side-nav.d.ts +0 -8
- package/web-types.json +0 -213
- package/web-types.lit.json +0 -111
package/README.md
CHANGED
|
@@ -4,8 +4,7 @@ A web component for navigation menus.
|
|
|
4
4
|
|
|
5
5
|
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/side-nav)
|
|
6
6
|
|
|
7
|
-
[](https://discord.gg/PHmkCKC)
|
|
7
|
+
[](https://www.npmjs.com/package/@vaadin/side-nav)
|
|
9
8
|
|
|
10
9
|
```html
|
|
11
10
|
<vaadin-side-nav collapsible>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/side-nav",
|
|
3
|
-
"version": "24.4.0-
|
|
3
|
+
"version": "24.4.0-dev.4b20a0c55",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "24.4.0-
|
|
39
|
-
"@vaadin/component-base": "24.4.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.4.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.4.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "24.4.0-dev.4b20a0c55",
|
|
39
|
+
"@vaadin/component-base": "24.4.0-dev.4b20a0c55",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-dev.4b20a0c55",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.4.0-dev.4b20a0c55",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-dev.4b20a0c55",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"web-types.json",
|
|
53
53
|
"web-types.lit.json"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b79c81e5f6fd24684b34ee0dc434e94d943ea13e"
|
|
56
56
|
}
|
|
@@ -94,9 +94,14 @@ declare class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixi
|
|
|
94
94
|
expanded: boolean;
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Whether the path
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* Whether the item's path matches the current browser URL.
|
|
98
|
+
*
|
|
99
|
+
* A match occurs when both share the same base origin (like https://example.com),
|
|
100
|
+
* the same path (like /path/to/page), and the browser URL contains all
|
|
101
|
+
* the query parameters with the same values from the item's path.
|
|
102
|
+
*
|
|
103
|
+
* The state is updated when the item is added to the DOM or when the browser
|
|
104
|
+
* navigates to a new page.
|
|
100
105
|
*/
|
|
101
106
|
readonly current: boolean;
|
|
102
107
|
|
|
@@ -105,6 +110,16 @@ declare class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixi
|
|
|
105
110
|
*/
|
|
106
111
|
target: string | null | undefined;
|
|
107
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Whether to exclude the item from client-side routing. When enabled,
|
|
115
|
+
* this causes the item to behave like a regular anchor, causing a full
|
|
116
|
+
* page reload. This only works with supported routers, such as the one
|
|
117
|
+
* provided in Vaadin apps, or when using the side nav `onNavigate` hook.
|
|
118
|
+
*
|
|
119
|
+
* @attr {boolean} router-ignore
|
|
120
|
+
*/
|
|
121
|
+
routerIgnore: boolean;
|
|
122
|
+
|
|
108
123
|
addEventListener<K extends keyof SideNavItemEventMap>(
|
|
109
124
|
type: K,
|
|
110
125
|
listener: (this: SideNavItem, ev: SideNavItemEventMap[K]) => void,
|
|
@@ -115,9 +115,14 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* Whether the path
|
|
119
|
-
*
|
|
120
|
-
*
|
|
118
|
+
* Whether the item's path matches the current browser URL.
|
|
119
|
+
*
|
|
120
|
+
* A match occurs when both share the same base origin (like https://example.com),
|
|
121
|
+
* the same path (like /path/to/page), and the browser URL contains at least
|
|
122
|
+
* all the query parameters with the same values from the item's path.
|
|
123
|
+
*
|
|
124
|
+
* The state is updated when the item is added to the DOM or when the browser
|
|
125
|
+
* navigates to a new page.
|
|
121
126
|
*
|
|
122
127
|
* @type {boolean}
|
|
123
128
|
*/
|
|
@@ -132,6 +137,20 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
132
137
|
* The target of the link. Works only when `path` is set.
|
|
133
138
|
*/
|
|
134
139
|
target: String,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Whether to exclude the item from client-side routing. When enabled,
|
|
143
|
+
* this causes the item to behave like a regular anchor, causing a full
|
|
144
|
+
* page reload. This only works with supported routers, such as the one
|
|
145
|
+
* provided in Vaadin apps, or when using the side nav `onNavigate` hook.
|
|
146
|
+
*
|
|
147
|
+
* @type {boolean}
|
|
148
|
+
* @attr {boolean} router-ignore
|
|
149
|
+
*/
|
|
150
|
+
routerIgnore: {
|
|
151
|
+
type: Boolean,
|
|
152
|
+
value: false,
|
|
153
|
+
},
|
|
135
154
|
};
|
|
136
155
|
}
|
|
137
156
|
|
|
@@ -189,12 +208,14 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
189
208
|
this.__updateCurrent();
|
|
190
209
|
|
|
191
210
|
window.addEventListener('popstate', this.__boundUpdateCurrent);
|
|
211
|
+
window.addEventListener('side-nav-location-changed', this.__boundUpdateCurrent);
|
|
192
212
|
}
|
|
193
213
|
|
|
194
214
|
/** @protected */
|
|
195
215
|
disconnectedCallback() {
|
|
196
216
|
super.disconnectedCallback();
|
|
197
217
|
window.removeEventListener('popstate', this.__boundUpdateCurrent);
|
|
218
|
+
window.removeEventListener('side-nav-location-changed', this.__boundUpdateCurrent);
|
|
198
219
|
}
|
|
199
220
|
|
|
200
221
|
/** @protected */
|
|
@@ -207,6 +228,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
207
228
|
tabindex="${this.disabled || this.path == null ? '-1' : '0'}"
|
|
208
229
|
href="${ifDefined(this.disabled ? null : this.path)}"
|
|
209
230
|
target="${ifDefined(this.target)}"
|
|
231
|
+
?router-ignore="${this.routerIgnore}"
|
|
210
232
|
part="link"
|
|
211
233
|
aria-current="${this.current ? 'page' : 'false'}"
|
|
212
234
|
>
|
|
@@ -255,19 +277,33 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
255
277
|
__updateCurrent() {
|
|
256
278
|
this._setCurrent(this.__isCurrent());
|
|
257
279
|
if (this.current) {
|
|
280
|
+
this.__expandParentItems();
|
|
258
281
|
this.expanded = this._items.length > 0;
|
|
259
282
|
}
|
|
260
283
|
}
|
|
261
284
|
|
|
285
|
+
/** @private */
|
|
286
|
+
__expandParentItems() {
|
|
287
|
+
const parentItem = this.__getParentItem();
|
|
288
|
+
if (parentItem) {
|
|
289
|
+
parentItem.__expandParentItems();
|
|
290
|
+
}
|
|
291
|
+
this.expanded = true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** @private */
|
|
295
|
+
__getParentItem() {
|
|
296
|
+
return this.parentElement instanceof SideNavItem ? this.parentElement : null;
|
|
297
|
+
}
|
|
298
|
+
|
|
262
299
|
/** @private */
|
|
263
300
|
__isCurrent() {
|
|
264
301
|
if (this.path == null) {
|
|
265
302
|
return false;
|
|
266
303
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
);
|
|
304
|
+
|
|
305
|
+
const browserPath = `${document.location.pathname}${document.location.search}`;
|
|
306
|
+
return matchPaths(browserPath, this.path) || this.pathAliases.some((alias) => matchPaths(browserPath, alias));
|
|
271
307
|
}
|
|
272
308
|
}
|
|
273
309
|
|
package/src/vaadin-side-nav.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
|
7
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
9
|
import { SideNavChildrenMixin, type SideNavI18n } from './vaadin-side-nav-children-mixin.js';
|
|
10
|
+
import type { SideNavItem } from './vaadin-side-nav-item.js';
|
|
10
11
|
|
|
11
12
|
export type { SideNavI18n };
|
|
12
13
|
|
|
@@ -21,6 +22,15 @@ export interface SideNavCustomEventMap {
|
|
|
21
22
|
|
|
22
23
|
export type SideNavEventMap = HTMLElementEventMap & SideNavCustomEventMap;
|
|
23
24
|
|
|
25
|
+
export type NavigateEvent = {
|
|
26
|
+
path: SideNavItem['path'];
|
|
27
|
+
target: SideNavItem['target'];
|
|
28
|
+
current: SideNavItem['current'];
|
|
29
|
+
expanded: SideNavItem['expanded'];
|
|
30
|
+
pathAliases: SideNavItem['pathAliases'];
|
|
31
|
+
originalEvent: MouseEvent;
|
|
32
|
+
};
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
35
|
* `<vaadin-side-nav>` is a Web Component for navigation menus.
|
|
26
36
|
*
|
|
@@ -83,6 +93,40 @@ declare class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(Thema
|
|
|
83
93
|
*/
|
|
84
94
|
collapsed: boolean;
|
|
85
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Callback function for router integration.
|
|
98
|
+
*
|
|
99
|
+
* When a side nav item link is clicked, this function is called and the default click action is cancelled.
|
|
100
|
+
* This delegates the responsibility of navigation to the function's logic.
|
|
101
|
+
*
|
|
102
|
+
* The click event action is not cancelled in the following cases:
|
|
103
|
+
* - The click event has a modifier (e.g. `metaKey`, `shiftKey`)
|
|
104
|
+
* - The click event is on an external link
|
|
105
|
+
* - The click event is on a link with `target="_blank"`
|
|
106
|
+
* - The function explicitly returns `false`
|
|
107
|
+
*
|
|
108
|
+
* The function receives an object with the properties of the clicked side-nav item:
|
|
109
|
+
* - `path`: The path of the navigation item.
|
|
110
|
+
* - `target`: The target of the navigation item.
|
|
111
|
+
* - `current`: A boolean indicating whether the navigation item is currently selected.
|
|
112
|
+
* - `expanded`: A boolean indicating whether the navigation item is expanded.
|
|
113
|
+
* - `pathAliases`: An array of path aliases for the navigation item.
|
|
114
|
+
* - `originalEvent`: The original DOM event that triggered the navigation.
|
|
115
|
+
*
|
|
116
|
+
* Also see the `location` property for updating the highlighted navigation item on route change.
|
|
117
|
+
*/
|
|
118
|
+
onNavigate?: ((event: NavigateEvent) => boolean) | ((event: NavigateEvent) => void);
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A change to this property triggers an update of the highlighted item in the side navigation. While it typically
|
|
122
|
+
* corresponds to the browser's URL, the specific value assigned to the property is irrelevant. The component has
|
|
123
|
+
* its own internal logic for determining which item is highlighted.
|
|
124
|
+
*
|
|
125
|
+
* The main use case for this property is when the side navigation is used with a client-side router. In this case,
|
|
126
|
+
* the component needs to be informed about route changes so it can update the highlighted item.
|
|
127
|
+
*/
|
|
128
|
+
location: any;
|
|
129
|
+
|
|
86
130
|
addEventListener<K extends keyof SideNavEventMap>(
|
|
87
131
|
type: K,
|
|
88
132
|
listener: (this: SideNav, ev: SideNavEventMap[K]) => void,
|
package/src/vaadin-side-nav.js
CHANGED
|
@@ -103,6 +103,48 @@ class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(ThemableMixin
|
|
|
103
103
|
notify: true,
|
|
104
104
|
reflectToAttribute: true,
|
|
105
105
|
},
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Callback function for router integration.
|
|
109
|
+
*
|
|
110
|
+
* When a side nav item link is clicked, this function is called and the default click action is cancelled.
|
|
111
|
+
* This delegates the responsibility of navigation to the function's logic.
|
|
112
|
+
*
|
|
113
|
+
* The click event action is not cancelled in the following cases:
|
|
114
|
+
* - The click event has a modifier (e.g. `metaKey`, `shiftKey`)
|
|
115
|
+
* - The click event is on an external link
|
|
116
|
+
* - The click event is on a link with `target="_blank"`
|
|
117
|
+
* - The function explicitly returns `false`
|
|
118
|
+
*
|
|
119
|
+
* The function receives an object with the properties of the clicked side-nav item:
|
|
120
|
+
* - `path`: The path of the navigation item.
|
|
121
|
+
* - `target`: The target of the navigation item.
|
|
122
|
+
* - `current`: A boolean indicating whether the navigation item is currently selected.
|
|
123
|
+
* - `expanded`: A boolean indicating whether the navigation item is expanded.
|
|
124
|
+
* - `pathAliases`: An array of path aliases for the navigation item.
|
|
125
|
+
* - `originalEvent`: The original DOM event that triggered the navigation.
|
|
126
|
+
*
|
|
127
|
+
* Also see the `location` property for updating the highlighted navigation item on route change.
|
|
128
|
+
*
|
|
129
|
+
* @type {function(Object): boolean | undefined}
|
|
130
|
+
*/
|
|
131
|
+
onNavigate: {
|
|
132
|
+
attribute: false,
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* A change to this property triggers an update of the highlighted item in the side navigation. While it typically
|
|
137
|
+
* corresponds to the browser's URL, the specific value assigned to the property is irrelevant. The component has
|
|
138
|
+
* its own internal logic for determining which item is highlighted.
|
|
139
|
+
*
|
|
140
|
+
* The main use case for this property is when the side navigation is used with a client-side router. In this case,
|
|
141
|
+
* the component needs to be informed about route changes so it can update the highlighted item.
|
|
142
|
+
*
|
|
143
|
+
* @type {any}
|
|
144
|
+
*/
|
|
145
|
+
location: {
|
|
146
|
+
observer: '__locationChanged',
|
|
147
|
+
},
|
|
106
148
|
};
|
|
107
149
|
}
|
|
108
150
|
|
|
@@ -114,6 +156,7 @@ class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(ThemableMixin
|
|
|
114
156
|
super();
|
|
115
157
|
|
|
116
158
|
this._labelId = `side-nav-label-${generateUniqueId()}`;
|
|
159
|
+
this.addEventListener('click', this.__onClick);
|
|
117
160
|
}
|
|
118
161
|
|
|
119
162
|
/**
|
|
@@ -203,10 +246,67 @@ class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(ThemableMixin
|
|
|
203
246
|
}
|
|
204
247
|
}
|
|
205
248
|
|
|
249
|
+
/** @private */
|
|
250
|
+
__locationChanged() {
|
|
251
|
+
window.dispatchEvent(new CustomEvent('side-nav-location-changed'));
|
|
252
|
+
}
|
|
253
|
+
|
|
206
254
|
/** @private */
|
|
207
255
|
__toggleCollapsed() {
|
|
208
256
|
this.collapsed = !this.collapsed;
|
|
209
257
|
}
|
|
258
|
+
|
|
259
|
+
/** @private */
|
|
260
|
+
__onClick(e) {
|
|
261
|
+
if (!this.onNavigate) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const hasModifier = e.metaKey || e.shiftKey;
|
|
266
|
+
if (hasModifier) {
|
|
267
|
+
// Allow default action for clicks with modifiers
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const composedPath = e.composedPath();
|
|
272
|
+
const item = composedPath.find((el) => el.localName && el.localName.includes('side-nav-item'));
|
|
273
|
+
const anchor = composedPath.find((el) => el instanceof HTMLAnchorElement);
|
|
274
|
+
if (!item || !item.shadowRoot.contains(anchor)) {
|
|
275
|
+
// Not a click on a side-nav-item anchor
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const isRelative = anchor.href && anchor.href.startsWith(location.origin);
|
|
280
|
+
if (!isRelative) {
|
|
281
|
+
// Allow default action for external links
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (item.target === '_blank') {
|
|
286
|
+
// Allow default action for links with target="_blank"
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (item.routerIgnore) {
|
|
291
|
+
// Allow default action when client-side routing is ignored
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Call the onNavigate callback
|
|
296
|
+
const result = this.onNavigate({
|
|
297
|
+
path: item.path,
|
|
298
|
+
target: item.target,
|
|
299
|
+
current: item.current,
|
|
300
|
+
expanded: item.expanded,
|
|
301
|
+
pathAliases: item.pathAliases,
|
|
302
|
+
originalEvent: e,
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
if (result !== false) {
|
|
306
|
+
// Cancel the default action if the callback didn't return false
|
|
307
|
+
e.preventDefault();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
210
310
|
}
|
|
211
311
|
|
|
212
312
|
defineCustomElement(SideNav);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
7
|
-
export declare const sideNavItemStyles: import("lit").CSSResult;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
|
-
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
7
|
-
export declare const sideNavStyles: import("lit").CSSResult;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2023 - 2024 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-side-nav-item.js';
|
|
7
|
-
import './vaadin-side-nav-styles.js';
|
|
8
|
-
import '../../src/vaadin-side-nav.js';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2023 - 2024 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-side-nav-item.js';
|
|
7
|
-
import './vaadin-side-nav-styles.js';
|
|
8
|
-
import '../../src/vaadin-side-nav.js';
|
package/web-types.json
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/side-nav",
|
|
4
|
-
"version": "24.4.0-alpha9",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"contributions": {
|
|
7
|
-
"html": {
|
|
8
|
-
"elements": [
|
|
9
|
-
{
|
|
10
|
-
"name": "vaadin-side-nav-item",
|
|
11
|
-
"description": "A navigation item to be used within `<vaadin-side-nav>`. Represents a navigation target.\nNot intended to be used separately.\n\n```html\n<vaadin-side-nav-item>\n Item 1\n <vaadin-side-nav-item path=\"/path1\" slot=\"children\">\n Child item 1\n </vaadin-side-nav-item>\n <vaadin-side-nav-item path=\"/path2\" slot=\"children\">\n Child item 2\n </vaadin-side-nav-item>\n</vaadin-side-nav-item>\n```\n\n### Customization\n\nYou can configure the item by using `slot` names.\n\nSlot name | Description\n----------|-------------\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\n#### Example\n\n```html\n<vaadin-side-nav-item>\n <vaadin-icon icon=\"vaadin:chart\" slot=\"prefix\"></vaadin-icon>\n Item\n <span theme=\"badge primary\" slot=\"suffix\">Suffix</span>\n</vaadin-side-nav-item>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`content` | The element that wraps link and toggle button\n`children` | The element that wraps child items\n`link` | The clickable anchor used for navigation\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`disabled` | Set when the element is disabled.\n`expanded` | Set when the element is expanded.\n`has-children` | Set when the element has child items.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
|
-
"attributes": [
|
|
13
|
-
{
|
|
14
|
-
"name": "disabled",
|
|
15
|
-
"description": "If true, the user cannot interact with this element.",
|
|
16
|
-
"value": {
|
|
17
|
-
"type": [
|
|
18
|
-
"boolean",
|
|
19
|
-
"null",
|
|
20
|
-
"undefined"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "path",
|
|
26
|
-
"description": "The path to navigate to",
|
|
27
|
-
"value": {
|
|
28
|
-
"type": [
|
|
29
|
-
"string",
|
|
30
|
-
"null",
|
|
31
|
-
"undefined"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "expanded",
|
|
37
|
-
"description": "Whether to show the child items or not",
|
|
38
|
-
"value": {
|
|
39
|
-
"type": [
|
|
40
|
-
"boolean"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"name": "target",
|
|
46
|
-
"description": "The target of the link. Works only when `path` is set.",
|
|
47
|
-
"value": {
|
|
48
|
-
"type": [
|
|
49
|
-
"string",
|
|
50
|
-
"null",
|
|
51
|
-
"undefined"
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "theme",
|
|
57
|
-
"description": "The theme variants to apply to the component.",
|
|
58
|
-
"value": {
|
|
59
|
-
"type": [
|
|
60
|
-
"string",
|
|
61
|
-
"null",
|
|
62
|
-
"undefined"
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
"js": {
|
|
68
|
-
"properties": [
|
|
69
|
-
{
|
|
70
|
-
"name": "disabled",
|
|
71
|
-
"description": "If true, the user cannot interact with this element.",
|
|
72
|
-
"value": {
|
|
73
|
-
"type": [
|
|
74
|
-
"boolean",
|
|
75
|
-
"null",
|
|
76
|
-
"undefined"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"name": "i18n",
|
|
82
|
-
"description": "The object used to localize this component.\n\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nThe object has the following structure and default values:\n```\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
83
|
-
"value": {
|
|
84
|
-
"type": [
|
|
85
|
-
"SideNavI18n"
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"name": "path",
|
|
91
|
-
"description": "The path to navigate to",
|
|
92
|
-
"value": {
|
|
93
|
-
"type": [
|
|
94
|
-
"string",
|
|
95
|
-
"null",
|
|
96
|
-
"undefined"
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"name": "pathAliases",
|
|
102
|
-
"description": "The list of alternative paths matching this item",
|
|
103
|
-
"value": {
|
|
104
|
-
"type": [
|
|
105
|
-
"Array.<string>"
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"name": "expanded",
|
|
111
|
-
"description": "Whether to show the child items or not",
|
|
112
|
-
"value": {
|
|
113
|
-
"type": [
|
|
114
|
-
"boolean"
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"name": "target",
|
|
120
|
-
"description": "The target of the link. Works only when `path` is set.",
|
|
121
|
-
"value": {
|
|
122
|
-
"type": [
|
|
123
|
-
"string",
|
|
124
|
-
"null",
|
|
125
|
-
"undefined"
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
"events": [
|
|
131
|
-
{
|
|
132
|
-
"name": "expanded-changed",
|
|
133
|
-
"description": "Fired when the `expanded` property changes."
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"name": "vaadin-side-nav",
|
|
140
|
-
"description": "`<vaadin-side-nav>` is a Web Component for navigation menus.\n\n```html\n<vaadin-side-nav>\n <vaadin-side-nav-item>Item 1</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 2</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 3</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 4</vaadin-side-nav-item>\n</vaadin-side-nav>\n```\n\n### Customization\n\nYou can configure the component by using `slot` names.\n\nSlot name | Description\n----------|-------------\n`label` | The label (text) inside the side nav.\n\n#### Example\n\n```html\n<vaadin-side-nav>\n <span slot=\"label\">Main menu</span>\n <vaadin-side-nav-item>Item</vaadin-side-nav-item>\n</vaadin-side-nav>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`label` | The label element\n`children` | The element that wraps child items\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`collapsed` | Set when the element is collapsed.\n`focus-ring` | Set when the label is focused using the keyboard.\n`focused` | Set when the label is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
141
|
-
"attributes": [
|
|
142
|
-
{
|
|
143
|
-
"name": "collapsible",
|
|
144
|
-
"description": "Whether the side nav is collapsible. When enabled, the toggle icon is shown.",
|
|
145
|
-
"value": {
|
|
146
|
-
"type": [
|
|
147
|
-
"boolean"
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "collapsed",
|
|
153
|
-
"description": "Whether the side nav is collapsed. When collapsed, the items are hidden.",
|
|
154
|
-
"value": {
|
|
155
|
-
"type": [
|
|
156
|
-
"boolean"
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"name": "theme",
|
|
162
|
-
"description": "The theme variants to apply to the component.",
|
|
163
|
-
"value": {
|
|
164
|
-
"type": [
|
|
165
|
-
"string",
|
|
166
|
-
"null",
|
|
167
|
-
"undefined"
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
"js": {
|
|
173
|
-
"properties": [
|
|
174
|
-
{
|
|
175
|
-
"name": "i18n",
|
|
176
|
-
"description": "The object used to localize this component.\n\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nThe object has the following structure and default values:\n```\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
177
|
-
"value": {
|
|
178
|
-
"type": [
|
|
179
|
-
"SideNavI18n"
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"name": "collapsible",
|
|
185
|
-
"description": "Whether the side nav is collapsible. When enabled, the toggle icon is shown.",
|
|
186
|
-
"value": {
|
|
187
|
-
"type": [
|
|
188
|
-
"boolean"
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"name": "collapsed",
|
|
194
|
-
"description": "Whether the side nav is collapsed. When collapsed, the items are hidden.",
|
|
195
|
-
"value": {
|
|
196
|
-
"type": [
|
|
197
|
-
"boolean"
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
"events": [
|
|
203
|
-
{
|
|
204
|
-
"name": "collapsed-changed",
|
|
205
|
-
"description": "Fired when the `collapsed` property changes."
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
package/web-types.lit.json
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/side-nav",
|
|
4
|
-
"version": "24.4.0-alpha9",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"framework": "lit",
|
|
7
|
-
"framework-config": {
|
|
8
|
-
"enable-when": {
|
|
9
|
-
"node-packages": [
|
|
10
|
-
"lit"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"contributions": {
|
|
15
|
-
"html": {
|
|
16
|
-
"elements": [
|
|
17
|
-
{
|
|
18
|
-
"name": "vaadin-side-nav-item",
|
|
19
|
-
"description": "A navigation item to be used within `<vaadin-side-nav>`. Represents a navigation target.\nNot intended to be used separately.\n\n```html\n<vaadin-side-nav-item>\n Item 1\n <vaadin-side-nav-item path=\"/path1\" slot=\"children\">\n Child item 1\n </vaadin-side-nav-item>\n <vaadin-side-nav-item path=\"/path2\" slot=\"children\">\n Child item 2\n </vaadin-side-nav-item>\n</vaadin-side-nav-item>\n```\n\n### Customization\n\nYou can configure the item by using `slot` names.\n\nSlot name | Description\n----------|-------------\n`prefix` | A slot for content before the label (e.g. an icon).\n`suffix` | A slot for content after the label (e.g. an icon).\n\n#### Example\n\n```html\n<vaadin-side-nav-item>\n <vaadin-icon icon=\"vaadin:chart\" slot=\"prefix\"></vaadin-icon>\n Item\n <span theme=\"badge primary\" slot=\"suffix\">Suffix</span>\n</vaadin-side-nav-item>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`content` | The element that wraps link and toggle button\n`children` | The element that wraps child items\n`link` | The clickable anchor used for navigation\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`disabled` | Set when the element is disabled.\n`expanded` | Set when the element is expanded.\n`has-children` | Set when the element has child items.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
|
-
"extension": true,
|
|
21
|
-
"attributes": [
|
|
22
|
-
{
|
|
23
|
-
"name": "?disabled",
|
|
24
|
-
"description": "If true, the user cannot interact with this element.",
|
|
25
|
-
"value": {
|
|
26
|
-
"kind": "expression"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "?expanded",
|
|
31
|
-
"description": "Whether to show the child items or not",
|
|
32
|
-
"value": {
|
|
33
|
-
"kind": "expression"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": ".i18n",
|
|
38
|
-
"description": "The object used to localize this component.\n\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nThe object has the following structure and default values:\n```\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
39
|
-
"value": {
|
|
40
|
-
"kind": "expression"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"name": ".path",
|
|
45
|
-
"description": "The path to navigate to",
|
|
46
|
-
"value": {
|
|
47
|
-
"kind": "expression"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"name": ".pathAliases",
|
|
52
|
-
"description": "The list of alternative paths matching this item",
|
|
53
|
-
"value": {
|
|
54
|
-
"kind": "expression"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": ".target",
|
|
59
|
-
"description": "The target of the link. Works only when `path` is set.",
|
|
60
|
-
"value": {
|
|
61
|
-
"kind": "expression"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "@expanded-changed",
|
|
66
|
-
"description": "Fired when the `expanded` property changes.",
|
|
67
|
-
"value": {
|
|
68
|
-
"kind": "expression"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "vaadin-side-nav",
|
|
75
|
-
"description": "`<vaadin-side-nav>` is a Web Component for navigation menus.\n\n```html\n<vaadin-side-nav>\n <vaadin-side-nav-item>Item 1</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 2</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 3</vaadin-side-nav-item>\n <vaadin-side-nav-item>Item 4</vaadin-side-nav-item>\n</vaadin-side-nav>\n```\n\n### Customization\n\nYou can configure the component by using `slot` names.\n\nSlot name | Description\n----------|-------------\n`label` | The label (text) inside the side nav.\n\n#### Example\n\n```html\n<vaadin-side-nav>\n <span slot=\"label\">Main menu</span>\n <vaadin-side-nav-item>Item</vaadin-side-nav-item>\n</vaadin-side-nav>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------------|----------------\n`label` | The label element\n`children` | The element that wraps child items\n`toggle-button` | The toggle button\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`collapsed` | Set when the element is collapsed.\n`focus-ring` | Set when the label is focused using the keyboard.\n`focused` | Set when the label is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
76
|
-
"extension": true,
|
|
77
|
-
"attributes": [
|
|
78
|
-
{
|
|
79
|
-
"name": "?collapsible",
|
|
80
|
-
"description": "Whether the side nav is collapsible. When enabled, the toggle icon is shown.",
|
|
81
|
-
"value": {
|
|
82
|
-
"kind": "expression"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"name": "?collapsed",
|
|
87
|
-
"description": "Whether the side nav is collapsed. When collapsed, the items are hidden.",
|
|
88
|
-
"value": {
|
|
89
|
-
"kind": "expression"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"name": ".i18n",
|
|
94
|
-
"description": "The object used to localize this component.\n\nTo change the default localization, replace the entire\n`i18n` object with a custom one.\n\nThe object has the following structure and default values:\n```\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
95
|
-
"value": {
|
|
96
|
-
"kind": "expression"
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"name": "@collapsed-changed",
|
|
101
|
-
"description": "Fired when the `collapsed` property changes.",
|
|
102
|
-
"value": {
|
|
103
|
-
"kind": "expression"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|