@vaadin/side-nav 25.0.0-alpha1 → 25.0.0-alpha10
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/package.json +11 -9
- package/src/styles/vaadin-side-nav-base-styles.d.ts +10 -0
- package/src/styles/vaadin-side-nav-base-styles.js +42 -0
- package/src/styles/vaadin-side-nav-core-styles.d.ts +10 -0
- package/src/styles/vaadin-side-nav-core-styles.js +39 -0
- package/src/styles/vaadin-side-nav-item-base-styles.d.ts +8 -0
- package/src/styles/vaadin-side-nav-item-base-styles.js +122 -0
- package/src/styles/vaadin-side-nav-item-core-styles.d.ts +8 -0
- package/src/{vaadin-side-nav-base-styles.js → styles/vaadin-side-nav-item-core-styles.js} +1 -33
- package/src/styles/vaadin-side-nav-shared-base-styles.d.ts +8 -0
- package/src/styles/vaadin-side-nav-shared-base-styles.js +91 -0
- package/src/vaadin-side-nav-item.js +12 -5
- package/src/vaadin-side-nav.js +13 -3
- package/theme/lumo/vaadin-side-nav-item-styles.js +8 -10
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/side-nav",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/styles/*-base-styles.d.ts",
|
|
25
|
+
"!src/styles/*-base-styles.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -35,16 +37,16 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
39
|
-
"@vaadin/component-base": "25.0.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
42
44
|
"lit": "^3.0.0"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {
|
|
45
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
46
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
47
|
-
"@vaadin/testing-helpers": "^
|
|
47
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
49
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
48
50
|
"lit": "^3.0.0",
|
|
49
51
|
"sinon": "^18.0.0"
|
|
50
52
|
},
|
|
@@ -52,5 +54,5 @@
|
|
|
52
54
|
"web-types.json",
|
|
53
55
|
"web-types.lit.json"
|
|
54
56
|
],
|
|
55
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
56
58
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const sideNavStyles: CSSResult;
|
|
9
|
+
|
|
10
|
+
export const sideNavSlotStyles: CSSResult;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
import { sharedStyles } from './vaadin-side-nav-shared-base-styles.js';
|
|
9
|
+
|
|
10
|
+
const sideNav = css`
|
|
11
|
+
:host {
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
touch-action: manipulation;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[part='label'] {
|
|
17
|
+
align-self: start;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: start;
|
|
21
|
+
gap: var(--vaadin-side-nav-item-gap, var(--vaadin-gap-container-inline));
|
|
22
|
+
padding: var(--vaadin-side-nav-item-padding, var(--vaadin-padding-container));
|
|
23
|
+
font-size: var(--vaadin-side-nav-label-font-size, 0.875em);
|
|
24
|
+
font-weight: var(--vaadin-side-nav-label-font-weight, 500);
|
|
25
|
+
color: var(--vaadin-side-nav-label-color, var(--vaadin-color-subtle));
|
|
26
|
+
line-height: var(--vaadin-side-nav-label-line-height, inherit);
|
|
27
|
+
border-radius: var(--vaadin-side-nav-item-border-radius, var(--vaadin-radius-m));
|
|
28
|
+
touch-action: manipulation;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
export const sideNavStyles = [sharedStyles, sideNav];
|
|
33
|
+
|
|
34
|
+
export const sideNavSlotStyles = css`
|
|
35
|
+
:where(vaadin-side-nav:has(vaadin-icon[slot='prefix'])) {
|
|
36
|
+
--_has-prefix-icon: '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where(vaadin-side-nav-item:has(> vaadin-icon[slot='prefix']))::part(link) {
|
|
40
|
+
--_has-prefix-icon:;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const sideNavStyles: CSSResult;
|
|
9
|
+
|
|
10
|
+
export const sideNavSlotStyles: CSSResult;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const sideNavStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([hidden]) {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
button {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: inherit;
|
|
21
|
+
width: 100%;
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
background-color: initial;
|
|
25
|
+
color: inherit;
|
|
26
|
+
border: initial;
|
|
27
|
+
outline: none;
|
|
28
|
+
font: inherit;
|
|
29
|
+
text-align: inherit;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part='children'] {
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: 0;
|
|
35
|
+
list-style-type: none;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const sideNavSlotStyles = css``;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
import { sharedStyles } from './vaadin-side-nav-shared-base-styles.js';
|
|
9
|
+
|
|
10
|
+
const sideNavItem = css`
|
|
11
|
+
[part='content'] {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: var(--vaadin-side-nav-item-padding, var(--vaadin-padding-container));
|
|
15
|
+
gap: var(--vaadin-side-nav-item-gap, var(--vaadin-gap-container-inline));
|
|
16
|
+
font-size: var(--vaadin-side-nav-item-font-size, 1em);
|
|
17
|
+
font-weight: var(--vaadin-side-nav-item-font-weight, 500);
|
|
18
|
+
line-height: var(--vaadin-side-nav-item-line-height, inherit);
|
|
19
|
+
color: var(--vaadin-side-nav-item-color, var(--vaadin-color-subtle));
|
|
20
|
+
background: var(--vaadin-side-nav-item-background, transparent);
|
|
21
|
+
background-origin: border-box;
|
|
22
|
+
border: var(--vaadin-side-nav-item-border-width, 0) solid var(--vaadin-side-nav-item-border-color, transparent);
|
|
23
|
+
border-radius: var(--vaadin-side-nav-item-border-radius, var(--vaadin-radius-m));
|
|
24
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
25
|
+
touch-action: manipulation;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([current]) [part='content'] {
|
|
29
|
+
--vaadin-side-nav-item-background: var(--vaadin-background-container);
|
|
30
|
+
--vaadin-side-nav-item-color: var(--vaadin-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([disabled]) {
|
|
34
|
+
--vaadin-clickable-cursor: var(--vaadin-disabled-cursor);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([disabled]) [part='content'] {
|
|
38
|
+
--vaadin-side-nav-item-color: var(--vaadin-color-disabled);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part='link'] {
|
|
42
|
+
flex: auto;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: inherit;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
color: inherit;
|
|
49
|
+
outline: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host(:not([has-children])) [part='toggle-button'] {
|
|
53
|
+
display: none !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
slot:not([name]) {
|
|
57
|
+
display: block;
|
|
58
|
+
flex: auto;
|
|
59
|
+
min-width: 0;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
text-overflow: ellipsis;
|
|
62
|
+
/* Don't clip ascenders or descenders */
|
|
63
|
+
padding-block: 0.25em;
|
|
64
|
+
margin-block: -0.25em;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
slot:is([name='prefix'], [name='suffix'])::slotted(*) {
|
|
68
|
+
flex: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Reserved space for icon */
|
|
72
|
+
slot[name='prefix']::before {
|
|
73
|
+
content: var(--_has-prefix-icon);
|
|
74
|
+
display: block;
|
|
75
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
76
|
+
flex: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[part='content']:not(:has([href])):has([part='toggle-button']:focus-visible),
|
|
80
|
+
[part='content']:has(:not([part='toggle-button']):focus-visible),
|
|
81
|
+
[part='content']:has([href]) [part='toggle-button']:focus-visible {
|
|
82
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[part='content']:not(:has([href])) [part='toggle-button']:focus-visible {
|
|
86
|
+
outline: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Hierarchy indentation */
|
|
90
|
+
[part='content']::before {
|
|
91
|
+
content: '';
|
|
92
|
+
--_hierarchy-indent: calc(var(--_level, 0) * var(--vaadin-side-nav-child-indent, var(--vaadin-icon-size, 1lh)));
|
|
93
|
+
--_icon-indent: calc(var(--_level, 0) * var(--vaadin-side-nav-item-gap, var(--vaadin-gap-container-inline)));
|
|
94
|
+
width: calc(var(--_hierarchy-indent) + var(--_icon-indent));
|
|
95
|
+
flex: none;
|
|
96
|
+
margin-inline-start: calc(var(--vaadin-side-nav-item-gap, var(--vaadin-gap-container-inline)) * -1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
slot[name='children'] {
|
|
100
|
+
--_level: calc(var(--_level-2, 0) + 1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
slot[name='children']::slotted(*) {
|
|
104
|
+
--_level-2: var(--_level);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (forced-colors: active) {
|
|
108
|
+
:host([current]) [part='content'] {
|
|
109
|
+
color: Highlight;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([disabled]) [part='content'] {
|
|
113
|
+
--vaadin-side-nav-item-color: GrayText;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([disabled]) [part='toggle-button']::before {
|
|
117
|
+
background: GrayText;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
|
|
122
|
+
export const sideNavItemStyles = [sharedStyles, sideNavItem];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { css } from 'lit';
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const sideNavItemStyles = css`
|
|
9
9
|
:host {
|
|
10
10
|
display: block;
|
|
11
11
|
}
|
|
@@ -35,7 +35,6 @@ export const sideNavItemBaseStyles = css`
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
button {
|
|
38
|
-
-webkit-appearance: none;
|
|
39
38
|
appearance: none;
|
|
40
39
|
flex: none;
|
|
41
40
|
position: relative;
|
|
@@ -69,34 +68,3 @@ export const sideNavItemBaseStyles = css`
|
|
|
69
68
|
white-space: nowrap;
|
|
70
69
|
}
|
|
71
70
|
`;
|
|
72
|
-
|
|
73
|
-
export const sideNavBaseStyles = css`
|
|
74
|
-
:host {
|
|
75
|
-
display: block;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
:host([hidden]) {
|
|
79
|
-
display: none !important;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
button {
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
justify-content: inherit;
|
|
86
|
-
width: 100%;
|
|
87
|
-
margin: 0;
|
|
88
|
-
padding: 0;
|
|
89
|
-
background-color: initial;
|
|
90
|
-
color: inherit;
|
|
91
|
-
border: initial;
|
|
92
|
-
outline: none;
|
|
93
|
-
font: inherit;
|
|
94
|
-
text-align: inherit;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
[part='children'] {
|
|
98
|
-
padding: 0;
|
|
99
|
-
margin: 0;
|
|
100
|
-
list-style-type: none;
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import '@vaadin/component-base/src/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
|
|
9
|
+
export const sharedStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--vaadin-side-nav-items-gap, var(--vaadin-gap-container-block));
|
|
14
|
+
cursor: default;
|
|
15
|
+
-webkit-tap-highlight-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([hidden]),
|
|
19
|
+
[hidden] {
|
|
20
|
+
display: none !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
button {
|
|
24
|
+
appearance: none;
|
|
25
|
+
margin: 0;
|
|
26
|
+
padding: 0;
|
|
27
|
+
border: 0;
|
|
28
|
+
background: transparent;
|
|
29
|
+
color: inherit;
|
|
30
|
+
font: inherit;
|
|
31
|
+
text-align: inherit;
|
|
32
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
33
|
+
flex: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[part='toggle-button'] {
|
|
37
|
+
border-radius: var(--vaadin-side-nav-item-border-radius, var(--vaadin-radius-s));
|
|
38
|
+
color: var(--vaadin-color-subtle);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part='toggle-button']::before {
|
|
42
|
+
content: '';
|
|
43
|
+
display: block;
|
|
44
|
+
background: currentColor;
|
|
45
|
+
mask-image: var(--_vaadin-icon-chevron-down);
|
|
46
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
47
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
48
|
+
rotate: -90deg;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([dir='rtl']) [part='toggle-button']::before {
|
|
52
|
+
scale: -1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host(:is(vaadin-side-nav-item[expanded], vaadin-side-nav:not([collapsed]))) [part='toggle-button'] {
|
|
56
|
+
rotate: 90deg;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([dir='rtl']:is(vaadin-side-nav-item[expanded], vaadin-side-nav:not([collapsed]))) [part='toggle-button'] {
|
|
60
|
+
rotate: -90deg;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
64
|
+
[part='toggle-button'] {
|
|
65
|
+
transition: rotate 150ms;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([disabled]) [part='toggle-button'] {
|
|
70
|
+
opacity: 0.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[part='children'] {
|
|
74
|
+
padding: 0;
|
|
75
|
+
margin: 0;
|
|
76
|
+
list-style-type: none;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: var(--vaadin-side-nav-items-gap, var(--vaadin-gap-container-block));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:focus-visible {
|
|
83
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (forced-colors: active) {
|
|
87
|
+
[part='toggle-button']::before {
|
|
88
|
+
background: CanvasText;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
@@ -10,9 +10,10 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
|
10
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
11
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
12
|
import { matchPaths } from '@vaadin/component-base/src/url-utils.js';
|
|
13
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
14
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
15
|
import { location } from './location.js';
|
|
15
|
-
import {
|
|
16
|
+
import { sideNavItemStyles } from './styles/vaadin-side-nav-item-core-styles.js';
|
|
16
17
|
import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -80,7 +81,9 @@ import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
|
80
81
|
* @mixes ElementMixin
|
|
81
82
|
* @mixes SideNavChildrenMixin
|
|
82
83
|
*/
|
|
83
|
-
class SideNavItem extends SideNavChildrenMixin(
|
|
84
|
+
class SideNavItem extends SideNavChildrenMixin(
|
|
85
|
+
DisabledMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
|
|
86
|
+
) {
|
|
84
87
|
static get is() {
|
|
85
88
|
return 'vaadin-side-nav-item';
|
|
86
89
|
}
|
|
@@ -175,7 +178,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
static get styles() {
|
|
178
|
-
return
|
|
181
|
+
return sideNavItemStyles;
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
constructor() {
|
|
@@ -283,9 +286,13 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
283
286
|
}
|
|
284
287
|
|
|
285
288
|
/** @private */
|
|
286
|
-
_onContentClick() {
|
|
289
|
+
_onContentClick(e) {
|
|
290
|
+
// Navigate if path is defined and not clicking on the link directly
|
|
291
|
+
if (this.path && !e.composedPath().find((el) => el === this.$.link)) {
|
|
292
|
+
this.$.link.click();
|
|
293
|
+
}
|
|
287
294
|
// Toggle item expanded state unless the link has a non-empty path
|
|
288
|
-
if (this.path == null && this.hasAttribute('has-children')) {
|
|
295
|
+
else if (this.path == null && this.hasAttribute('has-children') && !this.disabled) {
|
|
289
296
|
this.__toggleExpanded();
|
|
290
297
|
}
|
|
291
298
|
}
|
package/src/vaadin-side-nav.js
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import './vaadin-side-nav-item.js';
|
|
6
7
|
import { html, LitElement } from 'lit';
|
|
7
8
|
import { FocusMixin } from '@vaadin/a11y-base/src/focus-mixin.js';
|
|
8
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
10
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
11
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
|
+
import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
|
11
13
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
14
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
-
import {
|
|
16
|
+
import { sideNavSlotStyles, sideNavStyles } from './styles/vaadin-side-nav-core-styles.js';
|
|
14
17
|
import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -70,7 +73,9 @@ import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
|
70
73
|
* @mixes ElementMixin
|
|
71
74
|
* @mixes SideNavChildrenMixin
|
|
72
75
|
*/
|
|
73
|
-
class SideNav extends SideNavChildrenMixin(
|
|
76
|
+
class SideNav extends SideNavChildrenMixin(
|
|
77
|
+
SlotStylesMixin(FocusMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))))),
|
|
78
|
+
) {
|
|
74
79
|
static get is() {
|
|
75
80
|
return 'vaadin-side-nav';
|
|
76
81
|
}
|
|
@@ -149,7 +154,12 @@ class SideNav extends SideNavChildrenMixin(FocusMixin(ElementMixin(ThemableMixin
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
static get styles() {
|
|
152
|
-
return
|
|
157
|
+
return sideNavStyles;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** @protected */
|
|
161
|
+
get slotStyles() {
|
|
162
|
+
return [sideNavSlotStyles];
|
|
153
163
|
}
|
|
154
164
|
|
|
155
165
|
constructor() {
|
|
@@ -72,17 +72,15 @@ export const sideNavItemStyles = css`
|
|
|
72
72
|
transform: none;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
75
|
+
[part='link'],
|
|
76
|
+
[part='toggle-button'] {
|
|
77
|
+
outline: none;
|
|
78
|
+
}
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
80
|
+
[part='link']:focus-visible,
|
|
81
|
+
[part='toggle-button']:focus-visible {
|
|
82
|
+
border-radius: var(--lumo-border-radius-m);
|
|
83
|
+
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
[part='link']:active {
|
package/web-types.json
CHANGED