@vaadin/side-nav 24.4.0-alpha16 → 24.4.0-alpha18

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 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
- [![npm version](https://badgen.net/npm/v/@vaadin/vaadin-side-nav)](https://www.npmjs.com/package/@vaadin/vaadin-side-nav)
8
- [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
7
+ [![npm version](https://badgen.net/npm/v/@vaadin/side-nav)](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-alpha16",
3
+ "version": "24.4.0-alpha18",
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-alpha16",
39
- "@vaadin/component-base": "24.4.0-alpha16",
40
- "@vaadin/vaadin-lumo-styles": "24.4.0-alpha16",
41
- "@vaadin/vaadin-material-styles": "24.4.0-alpha16",
42
- "@vaadin/vaadin-themable-mixin": "24.4.0-alpha16",
38
+ "@vaadin/a11y-base": "24.4.0-alpha18",
39
+ "@vaadin/component-base": "24.4.0-alpha18",
40
+ "@vaadin/vaadin-lumo-styles": "24.4.0-alpha18",
41
+ "@vaadin/vaadin-material-styles": "24.4.0-alpha18",
42
+ "@vaadin/vaadin-themable-mixin": "24.4.0-alpha18",
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": "2d797855c2b3a3828ee7b0d90aeb227b56c32e76"
55
+ "gitHead": "7d675c61eaa32ef50c07de7b2fea19ff437b6b90"
56
56
  }
@@ -110,6 +110,16 @@ declare class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixi
110
110
  */
111
111
  target: string | null | undefined;
112
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
+
113
123
  addEventListener<K extends keyof SideNavItemEventMap>(
114
124
  type: K,
115
125
  listener: (this: SideNavItem, ev: SideNavItemEventMap[K]) => void,
@@ -137,6 +137,20 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
137
137
  * The target of the link. Works only when `path` is set.
138
138
  */
139
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
+ },
140
154
  };
141
155
  }
142
156
 
@@ -214,6 +228,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
214
228
  tabindex="${this.disabled || this.path == null ? '-1' : '0'}"
215
229
  href="${ifDefined(this.disabled ? null : this.path)}"
216
230
  target="${ifDefined(this.target)}"
231
+ ?router-ignore="${this.routerIgnore}"
217
232
  part="link"
218
233
  aria-current="${this.current ? 'page' : 'false'}"
219
234
  >
@@ -262,10 +277,25 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
262
277
  __updateCurrent() {
263
278
  this._setCurrent(this.__isCurrent());
264
279
  if (this.current) {
280
+ this.__expandParentItems();
265
281
  this.expanded = this._items.length > 0;
266
282
  }
267
283
  }
268
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
+
269
299
  /** @private */
270
300
  __isCurrent() {
271
301
  if (this.path == null) {
@@ -287,6 +287,11 @@ class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(ThemableMixin
287
287
  return;
288
288
  }
289
289
 
290
+ if (item.routerIgnore) {
291
+ // Allow default action when client-side routing is ignored
292
+ return;
293
+ }
294
+
290
295
  // Call the onNavigate callback
291
296
  const result = this.onNavigate({
292
297
  path: item.path,
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/side-nav",
4
- "version": "24.4.0-alpha16",
4
+ "version": "24.4.0-alpha18",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -52,6 +52,15 @@
52
52
  ]
53
53
  }
54
54
  },
55
+ {
56
+ "name": "router-ignore",
57
+ "description": "Whether to exclude the item from client-side routing. When enabled,\nthis causes the item to behave like a regular anchor, causing a full\npage reload. This only works with supported routers, such as the one\nprovided in Vaadin apps, or when using the side nav `onNavigate` hook.",
58
+ "value": {
59
+ "type": [
60
+ "boolean"
61
+ ]
62
+ }
63
+ },
55
64
  {
56
65
  "name": "theme",
57
66
  "description": "The theme variants to apply to the component.",
@@ -125,6 +134,15 @@
125
134
  "undefined"
126
135
  ]
127
136
  }
137
+ },
138
+ {
139
+ "name": "routerIgnore",
140
+ "description": "Whether to exclude the item from client-side routing. When enabled,\nthis causes the item to behave like a regular anchor, causing a full\npage reload. This only works with supported routers, such as the one\nprovided in Vaadin apps, or when using the side nav `onNavigate` hook.",
141
+ "value": {
142
+ "type": [
143
+ "boolean"
144
+ ]
145
+ }
128
146
  }
129
147
  ],
130
148
  "events": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/side-nav",
4
- "version": "24.4.0-alpha16",
4
+ "version": "24.4.0-alpha18",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -33,6 +33,13 @@
33
33
  "kind": "expression"
34
34
  }
35
35
  },
36
+ {
37
+ "name": "?routerIgnore",
38
+ "description": "Whether to exclude the item from client-side routing. When enabled,\nthis causes the item to behave like a regular anchor, causing a full\npage reload. This only works with supported routers, such as the one\nprovided in Vaadin apps, or when using the side nav `onNavigate` hook.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
36
43
  {
37
44
  "name": ".i18n",
38
45
  "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```",