@vaadin/side-nav 25.0.0-alpha2 → 25.0.0-alpha21
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 +64 -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 +124 -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 +97 -0
- package/src/vaadin-side-nav-children-mixin.d.ts +1 -1
- package/src/vaadin-side-nav-children-mixin.js +1 -1
- package/src/vaadin-side-nav-item.d.ts +1 -0
- package/src/vaadin-side-nav-item.js +41 -6
- 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 +4 -4
- package/web-types.lit.json +4 -4
- 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-alpha21",
|
|
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,22 +34,22 @@
|
|
|
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-alpha2",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha21",
|
|
38
|
+
"@vaadin/component-base": "25.0.0-alpha21",
|
|
39
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha21",
|
|
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-
|
|
43
|
+
"@vaadin/chai-plugins": "25.0.0-alpha21",
|
|
44
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha21",
|
|
47
45
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
46
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha21",
|
|
48
47
|
"lit": "^3.0.0",
|
|
49
|
-
"sinon": "^
|
|
48
|
+
"sinon": "^21.0.0"
|
|
50
49
|
},
|
|
51
50
|
"web-types": [
|
|
52
51
|
"web-types.json",
|
|
53
52
|
"web-types.lit.json"
|
|
54
53
|
],
|
|
55
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "8fb9e9710c01449edf623a1aaac4655cdc11a933"
|
|
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,64 @@
|
|
|
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-s));
|
|
22
|
+
padding: var(--vaadin-side-nav-item-padding, var(--vaadin-padding-container));
|
|
23
|
+
font-size: var(--vaadin-side-nav-label-font-size, max(11px, 0.875em));
|
|
24
|
+
font-weight: var(--vaadin-side-nav-label-font-weight, 500);
|
|
25
|
+
color: var(--vaadin-side-nav-label-color, var(--vaadin-text-color-secondary));
|
|
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
|
+
min-width: 0;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
::slotted([slot='label']) {
|
|
34
|
+
min-width: 0;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
text-overflow: ellipsis;
|
|
37
|
+
margin: 0;
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const sideNavStyles = [sharedStyles, sideNav];
|
|
42
|
+
|
|
43
|
+
export const sideNavSlotStyles = css`
|
|
44
|
+
:where(vaadin-side-nav:has(> vaadin-side-nav-item > vaadin-icon[slot='prefix']))::part(children),
|
|
45
|
+
:where(vaadin-side-nav-item:has(> vaadin-side-nav-item[slot='children'] > vaadin-icon[slot='prefix']))::part(
|
|
46
|
+
children
|
|
47
|
+
) {
|
|
48
|
+
--_icon-indent: calc(var(--_icon-indent-2, 0) + 1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:where(vaadin-side-nav-item:has(> vaadin-icon[slot='prefix']))::part(content) {
|
|
52
|
+
--_icon-indent: calc(var(--_icon-indent-2) - 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:where(
|
|
56
|
+
vaadin-side-nav-item:has(> vaadin-icon[slot='prefix']):has(> vaadin-side-nav-item > vaadin-icon[slot='prefix'])
|
|
57
|
+
)::part(children) {
|
|
58
|
+
--_level: var(--_level-2, 0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
vaadin-side-nav:not(:has([slot='label']))::part(label) {
|
|
62
|
+
display: none;
|
|
63
|
+
}
|
|
64
|
+
`;
|
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,124 @@
|
|
|
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 { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
|
|
9
|
+
import { sharedStyles } from './vaadin-side-nav-shared-base-styles.js';
|
|
10
|
+
|
|
11
|
+
const sideNavItem = css`
|
|
12
|
+
[part='content'] {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
padding: var(--vaadin-side-nav-item-padding, var(--vaadin-padding-container));
|
|
18
|
+
--_gap: var(--vaadin-side-nav-item-gap, var(--vaadin-gap-s));
|
|
19
|
+
gap: var(--_gap);
|
|
20
|
+
font-size: var(--vaadin-side-nav-item-font-size, 1em);
|
|
21
|
+
font-weight: var(--vaadin-side-nav-item-font-weight, 500);
|
|
22
|
+
line-height: var(--vaadin-side-nav-item-line-height, inherit);
|
|
23
|
+
color: var(--vaadin-side-nav-item-color, var(--vaadin-text-color-secondary));
|
|
24
|
+
background: var(--vaadin-side-nav-item-background, transparent);
|
|
25
|
+
background-origin: border-box;
|
|
26
|
+
border: var(--vaadin-side-nav-item-border-width, 0) solid var(--vaadin-side-nav-item-border-color, transparent);
|
|
27
|
+
border-radius: var(--vaadin-side-nav-item-border-radius, var(--vaadin-radius-m));
|
|
28
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
29
|
+
touch-action: manipulation;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([current]) [part='content'] {
|
|
33
|
+
--vaadin-side-nav-item-background: var(--vaadin-background-container);
|
|
34
|
+
--vaadin-side-nav-item-color: var(--vaadin-text-color);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host([disabled]) {
|
|
38
|
+
--vaadin-clickable-cursor: var(--vaadin-disabled-cursor);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([disabled]) [part='content'] {
|
|
42
|
+
--vaadin-side-nav-item-color: var(--vaadin-text-color-disabled);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[part='link'] {
|
|
46
|
+
flex: auto;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: inherit;
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
color: inherit;
|
|
53
|
+
outline: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host(:not([has-children])) [part='toggle-button'] {
|
|
57
|
+
display: none !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
slot:not([name]) {
|
|
61
|
+
display: block;
|
|
62
|
+
flex: auto;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
/* Don't clip ascenders or descenders */
|
|
67
|
+
padding-block: 0.25em;
|
|
68
|
+
margin-block: -0.25em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
slot:is([name='prefix'], [name='suffix'])::slotted(*) {
|
|
72
|
+
flex: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[part='content']:not(:has([href])):has([part='toggle-button']:focus-visible),
|
|
76
|
+
[part='content']:has(:not([part='toggle-button']):focus-visible),
|
|
77
|
+
[part='content']:has([href]) [part='toggle-button']:focus-visible {
|
|
78
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[part='content']:not(:has([href])) [part='toggle-button']:focus-visible {
|
|
82
|
+
outline: 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Hierarchy indentation */
|
|
86
|
+
[part='content']::before {
|
|
87
|
+
content: '';
|
|
88
|
+
width: calc(
|
|
89
|
+
var(--vaadin-side-nav-child-indent, 1em) * var(--_level, 0) + var(--_icon-indent, 0) *
|
|
90
|
+
(var(--vaadin-icon-size, 1lh) + var(--_gap))
|
|
91
|
+
);
|
|
92
|
+
flex: none;
|
|
93
|
+
margin-inline-start: calc(var(--_gap) * -1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
[part='children'] {
|
|
97
|
+
--_level: calc(var(--_level-2, 0) + 1);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[part='children'] ::slotted(*) {
|
|
101
|
+
--_level-2: var(--_level);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media (forced-colors: active) {
|
|
105
|
+
[part='content'] {
|
|
106
|
+
border: 1px solid Canvas !important;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host([current]) [part='content'] {
|
|
110
|
+
color: Highlight !important;
|
|
111
|
+
border-color: Highlight !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([disabled]) [part='content'] {
|
|
115
|
+
--vaadin-side-nav-item-color: GrayText !important;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([disabled]) [part='toggle-button']::before {
|
|
119
|
+
background: GrayText !important;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
export const sideNavItemStyles = [sharedStyles, screenReaderOnly, 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,97 @@
|
|
|
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
|
+
min-width: 0;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
gap: var(--vaadin-side-nav-items-gap, var(--vaadin-gap-s));
|
|
16
|
+
cursor: default;
|
|
17
|
+
-webkit-tap-highlight-color: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([hidden]),
|
|
21
|
+
[hidden] {
|
|
22
|
+
display: none !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
button {
|
|
26
|
+
appearance: none;
|
|
27
|
+
margin: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
border: 0;
|
|
30
|
+
background: transparent;
|
|
31
|
+
color: inherit;
|
|
32
|
+
font: inherit;
|
|
33
|
+
text-align: inherit;
|
|
34
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
35
|
+
flex: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[part='toggle-button'] {
|
|
39
|
+
border-radius: var(--vaadin-side-nav-item-border-radius, var(--vaadin-radius-s));
|
|
40
|
+
color: var(--vaadin-text-color-secondary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[part='toggle-button']::before {
|
|
44
|
+
content: '';
|
|
45
|
+
display: block;
|
|
46
|
+
background: currentColor;
|
|
47
|
+
mask: var(--_vaadin-icon-chevron-down) 50% / var(--vaadin-icon-visual-size, 100%) no-repeat;
|
|
48
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
49
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
50
|
+
rotate: -90deg;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([dir='rtl']) [part='toggle-button']::before {
|
|
54
|
+
scale: -1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host(:is(vaadin-side-nav-item[expanded], vaadin-side-nav:not([collapsed]))) [part='toggle-button'] {
|
|
58
|
+
rotate: 90deg;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([dir='rtl']:is(vaadin-side-nav-item[expanded], vaadin-side-nav:not([collapsed]))) [part='toggle-button'] {
|
|
62
|
+
rotate: -90deg;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
66
|
+
[part='toggle-button'] {
|
|
67
|
+
transition: rotate 150ms;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([disabled]) [part='toggle-button'] {
|
|
72
|
+
opacity: 0.5;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[part='children'] {
|
|
76
|
+
padding: 0;
|
|
77
|
+
margin: 0;
|
|
78
|
+
list-style-type: none;
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: var(--vaadin-side-nav-items-gap, var(--vaadin-gap-s));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[part='children'] slot {
|
|
85
|
+
--_icon-indent-2: var(--_icon-indent);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:focus-visible {
|
|
89
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (forced-colors: active) {
|
|
93
|
+
[part='toggle-button']::before {
|
|
94
|
+
background: CanvasText;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
@@ -72,6 +72,7 @@ export type SideNavItemEventMap = HTMLElementEventMap & SideNavItemCustomEventMa
|
|
|
72
72
|
* `disabled` | Set when the element is disabled.
|
|
73
73
|
* `expanded` | Set when the element is expanded.
|
|
74
74
|
* `has-children` | Set when the element has child items.
|
|
75
|
+
* `has-tooltip` | Set when the element has a slotted tooltip.
|
|
75
76
|
*
|
|
76
77
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
77
78
|
*
|
|
@@ -9,10 +9,12 @@ import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
|
9
9
|
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
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
13
|
import { matchPaths } from '@vaadin/component-base/src/url-utils.js';
|
|
14
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
13
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
16
|
import { location } from './location.js';
|
|
15
|
-
import {
|
|
17
|
+
import { sideNavItemStyles } from './styles/vaadin-side-nav-item-base-styles.js';
|
|
16
18
|
import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -68,6 +70,7 @@ import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
|
68
70
|
* `disabled` | Set when the element is disabled.
|
|
69
71
|
* `expanded` | Set when the element is expanded.
|
|
70
72
|
* `has-children` | Set when the element has child items.
|
|
73
|
+
* `has-tooltip` | Set when the element has a slotted tooltip.
|
|
71
74
|
*
|
|
72
75
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
73
76
|
*
|
|
@@ -80,7 +83,9 @@ import { SideNavChildrenMixin } from './vaadin-side-nav-children-mixin.js';
|
|
|
80
83
|
* @mixes ElementMixin
|
|
81
84
|
* @mixes SideNavChildrenMixin
|
|
82
85
|
*/
|
|
83
|
-
class SideNavItem extends SideNavChildrenMixin(
|
|
86
|
+
class SideNavItem extends SideNavChildrenMixin(
|
|
87
|
+
DisabledMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
|
|
88
|
+
) {
|
|
84
89
|
static get is() {
|
|
85
90
|
return 'vaadin-side-nav-item';
|
|
86
91
|
}
|
|
@@ -171,11 +176,16 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
171
176
|
type: Boolean,
|
|
172
177
|
value: false,
|
|
173
178
|
},
|
|
179
|
+
|
|
180
|
+
/** @private */
|
|
181
|
+
__tooltipText: {
|
|
182
|
+
type: String,
|
|
183
|
+
},
|
|
174
184
|
};
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
static get styles() {
|
|
178
|
-
return
|
|
188
|
+
return sideNavItemStyles;
|
|
179
189
|
}
|
|
180
190
|
|
|
181
191
|
constructor() {
|
|
@@ -243,7 +253,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
243
253
|
/** @protected */
|
|
244
254
|
render() {
|
|
245
255
|
return html`
|
|
246
|
-
<div part="content" @click="${this._onContentClick}">
|
|
256
|
+
<div id="content" part="content" @click="${this._onContentClick}">
|
|
247
257
|
<a
|
|
248
258
|
id="link"
|
|
249
259
|
?disabled="${this.disabled}"
|
|
@@ -256,6 +266,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
256
266
|
>
|
|
257
267
|
<slot name="prefix"></slot>
|
|
258
268
|
<slot></slot>
|
|
269
|
+
<div class="sr-only">${this.__tooltipText}</div>
|
|
259
270
|
<slot name="suffix"></slot>
|
|
260
271
|
</a>
|
|
261
272
|
<button
|
|
@@ -271,9 +282,29 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
271
282
|
<slot name="children"></slot>
|
|
272
283
|
</ul>
|
|
273
284
|
<div hidden id="i18n">${this.__effectiveI18n.toggle}</div>
|
|
285
|
+
<slot name="tooltip"></slot>
|
|
274
286
|
`;
|
|
275
287
|
}
|
|
276
288
|
|
|
289
|
+
/** @protected */
|
|
290
|
+
ready() {
|
|
291
|
+
super.ready();
|
|
292
|
+
|
|
293
|
+
this._tooltipController = new TooltipController(this);
|
|
294
|
+
this._tooltipController.setTarget(this.$.content);
|
|
295
|
+
this._tooltipController.setAriaTarget(null);
|
|
296
|
+
this._tooltipController.addEventListener('tooltip-changed', (event) => {
|
|
297
|
+
const { node } = event.detail;
|
|
298
|
+
if (node) {
|
|
299
|
+
this.__tooltipText = node.textContent.trim();
|
|
300
|
+
node.setAttribute('aria-hidden', 'true');
|
|
301
|
+
} else {
|
|
302
|
+
this.__tooltipText = '';
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
this.addController(this._tooltipController);
|
|
306
|
+
}
|
|
307
|
+
|
|
277
308
|
/** @private */
|
|
278
309
|
_onButtonClick(event) {
|
|
279
310
|
// Prevent the event from being handled
|
|
@@ -283,9 +314,13 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
283
314
|
}
|
|
284
315
|
|
|
285
316
|
/** @private */
|
|
286
|
-
_onContentClick() {
|
|
317
|
+
_onContentClick(e) {
|
|
318
|
+
// Navigate if path is defined and not clicking on the link directly
|
|
319
|
+
if (this.path && !e.composedPath().find((el) => el === this.$.link)) {
|
|
320
|
+
this.$.link.click();
|
|
321
|
+
}
|
|
287
322
|
// Toggle item expanded state unless the link has a non-empty path
|
|
288
|
-
if (this.path == null && this.hasAttribute('has-children')) {
|
|
323
|
+
else if (this.path == null && this.hasAttribute('has-children') && !this.disabled) {
|
|
289
324
|
this.__toggleExpanded();
|
|
290
325
|
}
|
|
291
326
|
}
|
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
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/side-nav",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha21",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
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.",
|
|
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`has-tooltip` | Set when the element has a slotted tooltip.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "i18n",
|
|
100
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n
|
|
100
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```js\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
101
101
|
"value": {
|
|
102
102
|
"type": [
|
|
103
103
|
"SideNavI18n"
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"properties": [
|
|
229
229
|
{
|
|
230
230
|
"name": "i18n",
|
|
231
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n
|
|
231
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```js\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
232
232
|
"value": {
|
|
233
233
|
"type": [
|
|
234
234
|
"SideNavI18n"
|
package/web-types.lit.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": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha21",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
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.",
|
|
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`has-tooltip` | Set when the element has a slotted tooltip.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"name": ".i18n",
|
|
52
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n
|
|
52
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```js\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
"name": ".i18n",
|
|
115
|
-
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n
|
|
115
|
+
"description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following structure and default values:\n```js\n{\n toggle: 'Toggle child items'\n}\n```",
|
|
116
116
|
"value": {
|
|
117
117
|
"kind": "expression"
|
|
118
118
|
}
|
|
@@ -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';
|