@vaadin/side-nav 25.0.0-alpha1 → 25.0.0-alpha11
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 +9 -10
- package/{theme/lumo/vaadin-side-nav.js → src/styles/vaadin-side-nav-base-styles.d.ts} +5 -3
- package/src/styles/vaadin-side-nav-base-styles.js +42 -0
- package/{theme/lumo/vaadin-side-nav-item.js → src/styles/vaadin-side-nav-item-base-styles.d.ts} +3 -2
- package/src/styles/vaadin-side-nav-item-base-styles.js +122 -0
- package/{theme/lumo/vaadin-side-nav-item.d.ts → src/styles/vaadin-side-nav-shared-base-styles.d.ts} +3 -2
- 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/vaadin-side-nav-item.js +1 -1
- package/vaadin-side-nav.js +1 -1
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
- package/src/vaadin-side-nav-base-styles.js +0 -102
- package/theme/lumo/vaadin-side-nav-item-styles.d.ts +0 -7
- package/theme/lumo/vaadin-side-nav-item-styles.js +0 -125
- package/theme/lumo/vaadin-side-nav-styles.d.ts +0 -7
- package/theme/lumo/vaadin-side-nav-styles.js +0 -81
- package/theme/lumo/vaadin-side-nav.d.ts +0 -8
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-alpha11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"theme",
|
|
25
24
|
"vaadin-*.d.ts",
|
|
26
25
|
"vaadin-*.js",
|
|
27
26
|
"web-types.json",
|
|
@@ -35,16 +34,16 @@
|
|
|
35
34
|
],
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
39
|
-
"@vaadin/component-base": "25.0.0-
|
|
40
|
-
"@vaadin/vaadin-
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha11",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-alpha11",
|
|
39
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
|
|
42
40
|
"lit": "^3.0.0"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
45
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
46
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
47
|
-
"@vaadin/testing-helpers": "^
|
|
43
|
+
"@vaadin/chai-plugins": "25.0.0-alpha11",
|
|
44
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha11",
|
|
45
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
|
|
48
47
|
"lit": "^3.0.0",
|
|
49
48
|
"sinon": "^18.0.0"
|
|
50
49
|
},
|
|
@@ -52,5 +51,5 @@
|
|
|
52
51
|
"web-types.json",
|
|
53
52
|
"web-types.lit.json"
|
|
54
53
|
],
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
|
|
56
55
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
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 '
|
|
7
|
-
|
|
8
|
-
|
|
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/styles/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
|
+
`;
|
package/{theme/lumo/vaadin-side-nav-item.js → src/styles/vaadin-side-nav-item-base-styles.d.ts}
RENAMED
|
@@ -3,5 +3,6 @@
|
|
|
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 '
|
|
7
|
-
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const sideNavItemStyles: CSSResult;
|
|
@@ -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/styles/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];
|
package/{theme/lumo/vaadin-side-nav-item.d.ts → src/styles/vaadin-side-nav-shared-base-styles.d.ts}
RENAMED
|
@@ -3,5 +3,6 @@
|
|
|
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 '
|
|
7
|
-
|
|
6
|
+
import type { CSSResult } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const sharedStyles: CSSResult;
|
|
@@ -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/styles/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-base-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-base-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() {
|
package/vaadin-side-nav-item.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-side-nav-item.js';
|
|
2
2
|
export * from './src/vaadin-side-nav-item.js';
|
package/vaadin-side-nav.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-side-nav.js';
|
|
2
2
|
export * from './src/vaadin-side-nav.js';
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED
|
@@ -1,102 +0,0 @@
|
|
|
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 sideNavItemBaseStyles = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: block;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:host([hidden]),
|
|
14
|
-
[hidden] {
|
|
15
|
-
display: none !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host([disabled]) {
|
|
19
|
-
pointer-events: none;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
[part='content'] {
|
|
23
|
-
display: flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[part='link'] {
|
|
28
|
-
flex: auto;
|
|
29
|
-
min-width: 0;
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
text-decoration: none;
|
|
33
|
-
color: inherit;
|
|
34
|
-
font: inherit;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
button {
|
|
38
|
-
-webkit-appearance: none;
|
|
39
|
-
appearance: none;
|
|
40
|
-
flex: none;
|
|
41
|
-
position: relative;
|
|
42
|
-
margin: 0;
|
|
43
|
-
padding: 0;
|
|
44
|
-
border: 0;
|
|
45
|
-
background: transparent;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[part='children'] {
|
|
49
|
-
padding: 0;
|
|
50
|
-
margin: 0;
|
|
51
|
-
list-style-type: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
:host(:not([has-children])) button {
|
|
55
|
-
display: none !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
slot[name='prefix'],
|
|
59
|
-
slot[name='suffix'] {
|
|
60
|
-
flex: none;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
slot:not([name]) {
|
|
64
|
-
display: block;
|
|
65
|
-
flex: auto;
|
|
66
|
-
min-width: 0;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
text-overflow: ellipsis;
|
|
69
|
-
white-space: nowrap;
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
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
|
-
`;
|
|
@@ -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,125 +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
|
-
import { fieldButton } from '@vaadin/vaadin-lumo-styles/mixins/field-button.js';
|
|
8
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
|
|
10
|
-
export const sideNavItemStyles = css`
|
|
11
|
-
:host {
|
|
12
|
-
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
|
|
13
|
-
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
[part='link'] {
|
|
17
|
-
width: 100%;
|
|
18
|
-
gap: var(--lumo-space-xs);
|
|
19
|
-
padding: var(--lumo-space-s);
|
|
20
|
-
padding-inline-start: calc(var(--lumo-space-s) + var(--_child-indent, 0px));
|
|
21
|
-
border-radius: var(--lumo-border-radius-m);
|
|
22
|
-
transition:
|
|
23
|
-
background-color 140ms,
|
|
24
|
-
color 140ms;
|
|
25
|
-
cursor: var(--lumo-clickable-cursor, default);
|
|
26
|
-
min-height: var(--lumo-icon-size-m);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
[part='link'][href] {
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:host([disabled]) [part='link'] {
|
|
34
|
-
color: var(--lumo-disabled-text-color);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
[part='toggle-button'] {
|
|
38
|
-
margin-inline-end: calc(var(--lumo-space-xs) * -1);
|
|
39
|
-
width: var(--lumo-size-s);
|
|
40
|
-
height: var(--lumo-size-s);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([has-children]) [part='content'] {
|
|
44
|
-
padding-inline-end: var(--lumo-space-s);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@media (any-hover: hover) {
|
|
48
|
-
[part='link']:hover {
|
|
49
|
-
color: var(--lumo-header-text-color);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
[part='toggle-button']:hover {
|
|
53
|
-
color: var(--lumo-body-text-color);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[part='link']:active:focus {
|
|
58
|
-
background-color: var(--lumo-contrast-5pct);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
[part='toggle-button']::before {
|
|
62
|
-
content: var(--lumo-icons-dropdown);
|
|
63
|
-
transform: rotate(-90deg);
|
|
64
|
-
transition: transform 140ms;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:host([dir='rtl']) [part='toggle-button']::before {
|
|
68
|
-
transform: rotate(90deg);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host([expanded]) [part='toggle-button']::before {
|
|
72
|
-
transform: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@supports selector(:focus-visible) {
|
|
76
|
-
[part='link'],
|
|
77
|
-
[part='toggle-button'] {
|
|
78
|
-
outline: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[part='link']:focus-visible,
|
|
82
|
-
[part='toggle-button']:focus-visible {
|
|
83
|
-
border-radius: var(--lumo-border-radius-m);
|
|
84
|
-
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
[part='link']:active {
|
|
89
|
-
color: var(--lumo-header-text-color);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
slot:not([name]) {
|
|
93
|
-
margin: 0 var(--lumo-space-s);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
slot[name='prefix']::slotted(:is(vaadin-icon, [class*='icon'])) {
|
|
97
|
-
padding: 0.1em;
|
|
98
|
-
flex-shrink: 0;
|
|
99
|
-
color: var(--lumo-contrast-60pct);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
:host([disabled]) slot[name='prefix']::slotted(:is(vaadin-icon, [class*='icon'])) {
|
|
103
|
-
color: var(--lumo-disabled-text-color);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
:host([current]) slot[name='prefix']::slotted(:is(vaadin-icon, [class*='icon'])) {
|
|
107
|
-
color: inherit;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
slot[name='children'] {
|
|
111
|
-
--_child-indent: calc(var(--_child-indent-2, 0px) + var(--vaadin-side-nav-child-indent, var(--lumo-space-l)));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
slot[name='children']::slotted(*) {
|
|
115
|
-
--_child-indent-2: var(--_child-indent);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
:host([current]) [part='content'] {
|
|
119
|
-
background-color: var(--lumo-primary-color-10pct);
|
|
120
|
-
color: var(--vaadin-selection-color-text, var(--lumo-primary-text-color));
|
|
121
|
-
border-radius: var(--lumo-border-radius-m);
|
|
122
|
-
}
|
|
123
|
-
`;
|
|
124
|
-
|
|
125
|
-
registerStyles('vaadin-side-nav-item', [fieldButton, sideNavItemStyles], { moduleId: 'lumo-side-nav-item' });
|
|
@@ -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,81 +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
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
|
|
9
|
-
export const sideNavStyles = css`
|
|
10
|
-
:host {
|
|
11
|
-
font-family: var(--lumo-font-family);
|
|
12
|
-
font-size: var(--lumo-font-size-m);
|
|
13
|
-
font-weight: 500;
|
|
14
|
-
line-height: var(--lumo-line-height-xs);
|
|
15
|
-
color: var(--lumo-body-text-color);
|
|
16
|
-
-webkit-tap-highlight-color: transparent;
|
|
17
|
-
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
|
|
18
|
-
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[part='label'] {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
width: 100%;
|
|
25
|
-
outline: none;
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
border-radius: var(--lumo-border-radius-m);
|
|
28
|
-
font-family: var(--lumo-font-family);
|
|
29
|
-
font-size: var(--lumo-font-size-s);
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
line-height: var(--lumo-line-height-xs);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
[part='label'] ::slotted([slot='label']) {
|
|
35
|
-
color: var(--lumo-secondary-text-color);
|
|
36
|
-
margin: var(--lumo-space-s);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:host([focus-ring]) [part='label'] {
|
|
40
|
-
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part='toggle-button'] {
|
|
44
|
-
display: inline-flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
width: var(--lumo-size-s);
|
|
48
|
-
height: var(--lumo-size-s);
|
|
49
|
-
margin-inline: auto var(--lumo-space-xs);
|
|
50
|
-
font-size: var(--lumo-icon-size-m);
|
|
51
|
-
line-height: 1;
|
|
52
|
-
color: var(--lumo-contrast-60pct);
|
|
53
|
-
font-family: 'lumo-icons';
|
|
54
|
-
cursor: var(--lumo-clickable-cursor);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
[part='toggle-button']::before {
|
|
58
|
-
content: var(--lumo-icons-angle-right);
|
|
59
|
-
transition: transform 140ms;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
:host(:not([collapsible])) [part='toggle-button'] {
|
|
63
|
-
display: none !important;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:host(:not([collapsed])) [part='toggle-button']::before {
|
|
67
|
-
transform: rotate(90deg);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:host([collapsed][dir='rtl']) [part='toggle-button']::before {
|
|
71
|
-
transform: rotate(180deg);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media (any-hover: hover) {
|
|
75
|
-
[part='label']:hover [part='toggle-button'] {
|
|
76
|
-
color: var(--lumo-body-text-color);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
registerStyles('vaadin-side-nav', sideNavStyles, { moduleId: 'lumo-side-nav' });
|
|
@@ -1,8 +0,0 @@
|
|
|
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-side-nav-item.js';
|
|
7
|
-
import './vaadin-side-nav-styles.js';
|
|
8
|
-
import '../../src/vaadin-side-nav.js';
|