@vaadin/app-layout 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 +12 -10
- package/src/safe-area-inset.js +6 -0
- package/src/styles/vaadin-app-layout-base-styles.js +191 -0
- package/src/styles/vaadin-app-layout-core-styles.d.ts +8 -0
- package/src/{vaadin-app-layout-styles.js → styles/vaadin-app-layout-core-styles.js} +8 -8
- package/src/styles/vaadin-drawer-toggle-base-styles.js +27 -0
- package/src/styles/vaadin-drawer-toggle-core-styles.d.ts +8 -0
- package/src/{vaadin-drawer-toggle-styles.js → styles/vaadin-drawer-toggle-core-styles.js} +1 -1
- package/src/vaadin-app-layout-mixin.js +29 -6
- package/src/vaadin-app-layout.d.ts +1 -1
- package/src/vaadin-app-layout.js +4 -3
- package/src/vaadin-drawer-toggle.d.ts +1 -1
- package/src/vaadin-drawer-toggle.js +5 -4
- package/web-types.json +3 -3
- package/web-types.lit.json +3 -3
- /package/src/{vaadin-app-layout-styles.d.ts → styles/vaadin-app-layout-base-styles.d.ts} +0 -0
- /package/src/{vaadin-drawer-toggle-styles.d.ts → styles/vaadin-drawer-toggle-base-styles.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/app-layout",
|
|
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,22 +37,22 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
39
|
-
"@vaadin/button": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
40
|
+
"@vaadin/a11y-base": "25.0.0-alpha10",
|
|
41
|
+
"@vaadin/button": "25.0.0-alpha10",
|
|
42
|
+
"@vaadin/component-base": "25.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
|
|
43
45
|
"lit": "^3.0.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
48
|
-
"@vaadin/testing-helpers": "^
|
|
48
|
+
"@vaadin/chai-plugins": "25.0.0-alpha10",
|
|
49
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha10",
|
|
50
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
51
|
"sinon": "^18.0.0"
|
|
50
52
|
},
|
|
51
53
|
"web-types": [
|
|
52
54
|
"web-types.json",
|
|
53
55
|
"web-types.lit.json"
|
|
54
56
|
],
|
|
55
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
|
|
56
58
|
}
|
package/src/safe-area-inset.js
CHANGED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 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 appLayoutStyles = css`
|
|
10
|
+
:host {
|
|
11
|
+
display: block;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
height: 100%;
|
|
14
|
+
--vaadin-app-layout-transition-duration: 0s;
|
|
15
|
+
transition: padding var(--vaadin-app-layout-transition-duration);
|
|
16
|
+
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width, auto);
|
|
17
|
+
--vaadin-app-layout-touch-optimized: false;
|
|
18
|
+
--vaadin-app-layout-navbar-offset-top: var(--_vaadin-app-layout-navbar-offset-size);
|
|
19
|
+
--vaadin-app-layout-navbar-offset-bottom: var(--_vaadin-app-layout-navbar-offset-size-bottom);
|
|
20
|
+
padding-block: var(--vaadin-app-layout-navbar-offset-top) var(--vaadin-app-layout-navbar-offset-bottom);
|
|
21
|
+
padding-inline-start: var(--vaadin-app-layout-navbar-offset-left);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([hidden]),
|
|
25
|
+
[hidden] {
|
|
26
|
+
display: none !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
30
|
+
:host(:not([no-anim])) {
|
|
31
|
+
--vaadin-app-layout-transition-duration: 200ms;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([drawer-opened]) {
|
|
36
|
+
--vaadin-app-layout-drawer-offset-left: var(--_vaadin-app-layout-drawer-offset-size);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([overlay]) {
|
|
40
|
+
--vaadin-app-layout-drawer-offset-left: 0;
|
|
41
|
+
--vaadin-app-layout-navbar-offset-left: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host(:not([no-scroll])) [content] {
|
|
45
|
+
overflow: auto;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[content] {
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (pointer: coarse) and (max-width: 800px) and (min-height: 500px) {
|
|
53
|
+
:host {
|
|
54
|
+
--vaadin-app-layout-touch-optimized: true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part='navbar'] {
|
|
59
|
+
position: fixed;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
top: 0;
|
|
63
|
+
inset-inline: 0;
|
|
64
|
+
transition: inset-inline-start var(--vaadin-app-layout-transition-duration);
|
|
65
|
+
padding-top: max(var(--vaadin-app-layout-navbar-padding-top, var(--vaadin-padding)), var(--safe-area-inset-top));
|
|
66
|
+
padding-bottom: var(--vaadin-app-layout-navbar-padding-bottom, var(--vaadin-padding));
|
|
67
|
+
padding-inline-start: max(
|
|
68
|
+
var(--vaadin-app-layout-navbar-padding-inline-start, var(--vaadin-padding)),
|
|
69
|
+
var(--safe-area-inset-left)
|
|
70
|
+
);
|
|
71
|
+
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
|
|
72
|
+
padding-inline-end: max(
|
|
73
|
+
var(--vaadin-app-layout-navbar-padding-inline-end, var(--vaadin-padding)),
|
|
74
|
+
var(--safe-area-inset-right)
|
|
75
|
+
);
|
|
76
|
+
z-index: 1;
|
|
77
|
+
gap: var(--vaadin-app-layout-navbar-gap, var(--vaadin-gap-container-inline));
|
|
78
|
+
background: var(--vaadin-app-layout-navbar-background, var(--vaadin-background-container));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host([primary-section='drawer'][drawer-opened]:not([overlay])) [part='navbar'] {
|
|
82
|
+
inset-inline-start: var(--vaadin-app-layout-drawer-offset-left, 0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host([primary-section='drawer']) [part='drawer'] {
|
|
86
|
+
top: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[part='navbar'][bottom] {
|
|
90
|
+
top: auto;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
padding-top: var(--vaadin-app-layout-navbar-padding-top, var(--vaadin-padding));
|
|
93
|
+
padding-bottom: max(
|
|
94
|
+
var(--vaadin-app-layout-navbar-padding-bottom, var(--vaadin-padding)),
|
|
95
|
+
var(--safe-area-inset-bottom)
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[part='drawer'] {
|
|
100
|
+
overflow: auto;
|
|
101
|
+
overscroll-behavior: contain;
|
|
102
|
+
position: fixed;
|
|
103
|
+
top: var(--vaadin-app-layout-navbar-offset-top, 0);
|
|
104
|
+
bottom: var(--vaadin-app-layout-navbar-offset-bottom, var(--vaadin-viewport-offset-bottom, 0));
|
|
105
|
+
inset-inline: var(--vaadin-app-layout-navbar-offset-left, 0) auto;
|
|
106
|
+
transition:
|
|
107
|
+
transform var(--vaadin-app-layout-transition-duration),
|
|
108
|
+
visibility var(--vaadin-app-layout-transition-duration);
|
|
109
|
+
transform: translateX(-100%);
|
|
110
|
+
max-width: 90%;
|
|
111
|
+
width: var(--_vaadin-app-layout-drawer-width);
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
padding: var(--safe-area-inset-top) 0 var(--safe-area-inset-bottom) var(--safe-area-inset-left);
|
|
114
|
+
outline: none;
|
|
115
|
+
/* The drawer should be inaccessible by the tabbing navigation when it is closed. */
|
|
116
|
+
visibility: hidden;
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
background: var(--vaadin-app-layout-drawer-background, var(--vaadin-background-color));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([drawer-opened]) [part='drawer'] {
|
|
123
|
+
/* The drawer should be accessible by the tabbing navigation when it is opened. */
|
|
124
|
+
visibility: visible;
|
|
125
|
+
transform: translateX(0%);
|
|
126
|
+
touch-action: manipulation;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[part='backdrop'] {
|
|
130
|
+
background: var(--vaadin-overlay-backdrop-background, rgba(0, 0, 0, 0.5));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host(:not([drawer-opened])) [part='backdrop'] {
|
|
134
|
+
opacity: 0 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:host([overlay]) [part='backdrop'] {
|
|
138
|
+
position: fixed;
|
|
139
|
+
inset: 0;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
transition: opacity var(--vaadin-app-layout-transition-duration);
|
|
142
|
+
-webkit-tap-highlight-color: transparent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([overlay]) [part='drawer'] {
|
|
146
|
+
top: 0;
|
|
147
|
+
bottom: 0;
|
|
148
|
+
box-shadow: var(--vaadin-overlay-box-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([overlay]) [part='drawer'],
|
|
152
|
+
:host([overlay]) [part='backdrop'] {
|
|
153
|
+
z-index: 2;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host([drawer-opened][overlay]) [part='backdrop'] {
|
|
157
|
+
pointer-events: auto;
|
|
158
|
+
touch-action: manipulation;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([dir='rtl']) [part='drawer'] {
|
|
162
|
+
transform: translateX(100%);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([dir='rtl'][drawer-opened]) [part='drawer'] {
|
|
166
|
+
transform: translateX(0%);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([drawer-opened]:not([overlay])) {
|
|
170
|
+
padding-inline-start: var(--vaadin-app-layout-drawer-offset-left);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@media (max-width: 800px), (max-height: 600px) {
|
|
174
|
+
:host {
|
|
175
|
+
--vaadin-app-layout-drawer-overlay: true;
|
|
176
|
+
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width, 320px);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* If a vaadin-scroller is used in the drawer, allow it to take all remaining space and contain scrolling */
|
|
181
|
+
[part='drawer'] ::slotted(vaadin-scroller) {
|
|
182
|
+
flex: 1;
|
|
183
|
+
overscroll-behavior: contain;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@media (forced-colors: active) {
|
|
187
|
+
:host([overlay]) [part='drawer'] {
|
|
188
|
+
border: 3px solid;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 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 { css } from '
|
|
6
|
+
import { css } from 'lit';
|
|
7
7
|
|
|
8
8
|
export const appLayoutStyles = css`
|
|
9
9
|
:host {
|
|
10
10
|
display: block;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
height: 100%;
|
|
13
|
-
--vaadin-app-layout-transition: 200ms;
|
|
14
|
-
transition: padding var(--vaadin-app-layout-transition);
|
|
13
|
+
--vaadin-app-layout-transition-duration: 200ms;
|
|
14
|
+
transition: padding var(--vaadin-app-layout-transition-duration);
|
|
15
15
|
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width, 16em);
|
|
16
16
|
--vaadin-app-layout-touch-optimized: false;
|
|
17
17
|
--vaadin-app-layout-navbar-offset-top: var(--_vaadin-app-layout-navbar-offset-size);
|
|
@@ -26,7 +26,7 @@ export const appLayoutStyles = css`
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
:host([no-anim]) {
|
|
29
|
-
--vaadin-app-layout-transition:
|
|
29
|
+
--vaadin-app-layout-transition-duration: 0s !important;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
:host([drawer-opened]) {
|
|
@@ -58,7 +58,7 @@ export const appLayoutStyles = css`
|
|
|
58
58
|
align-items: center;
|
|
59
59
|
top: 0;
|
|
60
60
|
inset-inline: 0;
|
|
61
|
-
transition: inset-inline-start var(--vaadin-app-layout-transition);
|
|
61
|
+
transition: inset-inline-start var(--vaadin-app-layout-transition-duration);
|
|
62
62
|
padding-top: var(--safe-area-inset-top);
|
|
63
63
|
padding-left: var(--safe-area-inset-left);
|
|
64
64
|
padding-right: var(--safe-area-inset-right);
|
|
@@ -86,8 +86,8 @@ export const appLayoutStyles = css`
|
|
|
86
86
|
bottom: var(--vaadin-app-layout-navbar-offset-bottom, var(--vaadin-viewport-offset-bottom, 0));
|
|
87
87
|
inset-inline: var(--vaadin-app-layout-navbar-offset-left, 0) auto;
|
|
88
88
|
transition:
|
|
89
|
-
transform var(--vaadin-app-layout-transition),
|
|
90
|
-
visibility var(--vaadin-app-layout-transition);
|
|
89
|
+
transform var(--vaadin-app-layout-transition-duration),
|
|
90
|
+
visibility var(--vaadin-app-layout-transition-duration);
|
|
91
91
|
transform: translateX(-100%);
|
|
92
92
|
max-width: 90%;
|
|
93
93
|
width: var(--_vaadin-app-layout-drawer-width);
|
|
@@ -120,7 +120,7 @@ export const appLayoutStyles = css`
|
|
|
120
120
|
position: fixed;
|
|
121
121
|
inset: 0;
|
|
122
122
|
pointer-events: none;
|
|
123
|
-
transition: opacity var(--vaadin-app-layout-transition);
|
|
123
|
+
transition: opacity var(--vaadin-app-layout-transition-duration);
|
|
124
124
|
-webkit-tap-highlight-color: transparent;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2018 - 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 drawerToggle = css`
|
|
10
|
+
[part='icon'] {
|
|
11
|
+
background: currentColor;
|
|
12
|
+
display: block;
|
|
13
|
+
height: var(--vaadin-icon-size, 1lh);
|
|
14
|
+
mask-image: var(--_vaadin-icon-menu);
|
|
15
|
+
width: var(--vaadin-icon-size, 1lh);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[hidden] {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (forced-colors: active) {
|
|
23
|
+
[part='icon'] {
|
|
24
|
+
background: CanvasText;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 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 { css } from '
|
|
6
|
+
import { css } from 'lit';
|
|
7
7
|
|
|
8
8
|
export const drawerToggle = css`
|
|
9
9
|
:host {
|
|
@@ -69,6 +69,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
69
69
|
readOnly: true,
|
|
70
70
|
value: false,
|
|
71
71
|
reflectToAttribute: true,
|
|
72
|
+
observer: '__overlayChanged',
|
|
72
73
|
sync: true,
|
|
73
74
|
},
|
|
74
75
|
|
|
@@ -166,6 +167,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
166
167
|
});
|
|
167
168
|
this._navbarSizeObserver.observe(this.$.navbarTop);
|
|
168
169
|
this._navbarSizeObserver.observe(this.$.navbarBottom);
|
|
170
|
+
this._navbarSizeObserver.observe(this.$.drawer);
|
|
169
171
|
|
|
170
172
|
window.addEventListener('close-overlay-drawer', this.__closeOverlayDrawerListener);
|
|
171
173
|
window.addEventListener('keydown', this.__onDrawerKeyDown);
|
|
@@ -246,6 +248,22 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
246
248
|
this.__setAriaExpanded();
|
|
247
249
|
}
|
|
248
250
|
|
|
251
|
+
/**
|
|
252
|
+
* A callback for the `overlay` property observer.
|
|
253
|
+
*
|
|
254
|
+
* When layout resizes while in the overlay mode, drawer opened state
|
|
255
|
+
* is not changed, but focus trap needs to be removed.
|
|
256
|
+
*
|
|
257
|
+
* @param {boolean} overlay
|
|
258
|
+
* @param {boolean} oldOverlay
|
|
259
|
+
* @private
|
|
260
|
+
*/
|
|
261
|
+
__overlayChanged(_overlay, oldOverlay) {
|
|
262
|
+
if (oldOverlay) {
|
|
263
|
+
this.__restoreFocus();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
249
267
|
/**
|
|
250
268
|
* A callback for the `i18n` property observer.
|
|
251
269
|
*
|
|
@@ -362,8 +380,8 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
362
380
|
/**
|
|
363
381
|
* Returns a promise that resolves when the drawer opening/closing CSS transition ends.
|
|
364
382
|
*
|
|
365
|
-
* The method relies on the `--vaadin-app-layout-transition` CSS variable to detect whether
|
|
366
|
-
* the drawer has a CSS transition that needs to be awaited. If the CSS variable equals `
|
|
383
|
+
* The method relies on the `--vaadin-app-layout-transition-duration` CSS variable to detect whether
|
|
384
|
+
* the drawer has a CSS transition that needs to be awaited. If the CSS variable equals `0s`,
|
|
367
385
|
* the promise resolves immediately.
|
|
368
386
|
*
|
|
369
387
|
* @return {Promise}
|
|
@@ -371,7 +389,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
371
389
|
*/
|
|
372
390
|
__drawerTransitionComplete() {
|
|
373
391
|
return new Promise((resolve) => {
|
|
374
|
-
if (this._getCustomPropertyValue('--vaadin-app-layout-transition') === '
|
|
392
|
+
if (this._getCustomPropertyValue('--vaadin-app-layout-transition-duration') === '0s') {
|
|
375
393
|
resolve();
|
|
376
394
|
return;
|
|
377
395
|
}
|
|
@@ -408,9 +426,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
408
426
|
return;
|
|
409
427
|
}
|
|
410
428
|
|
|
411
|
-
this.
|
|
412
|
-
this.__focusTrapController.releaseFocus();
|
|
413
|
-
this.$.drawer.removeAttribute('tabindex');
|
|
429
|
+
this.__restoreFocus();
|
|
414
430
|
|
|
415
431
|
// Move focus to the drawer toggle when closing the drawer.
|
|
416
432
|
const toggle = this.querySelector('vaadin-drawer-toggle');
|
|
@@ -420,6 +436,13 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
420
436
|
}
|
|
421
437
|
}
|
|
422
438
|
|
|
439
|
+
/** @private */
|
|
440
|
+
__restoreFocus() {
|
|
441
|
+
this.__ariaModalController.close();
|
|
442
|
+
this.__focusTrapController.releaseFocus();
|
|
443
|
+
this.$.drawer.removeAttribute('tabindex');
|
|
444
|
+
}
|
|
445
|
+
|
|
423
446
|
/**
|
|
424
447
|
* Closes the drawer on Escape press if it has been opened in the overlay mode.
|
|
425
448
|
*
|
|
@@ -37,7 +37,7 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
37
37
|
/**
|
|
38
38
|
* `<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.
|
|
39
39
|
*
|
|
40
|
-
* ```
|
|
40
|
+
* ```html
|
|
41
41
|
* <vaadin-app-layout primary-section="navbar|drawer">
|
|
42
42
|
* <vaadin-drawer-toggle slot="navbar [touch-optimized]"></vaadin-drawer-toggle>
|
|
43
43
|
* <h3 slot="navbar [touch-optimized]">Company Name</h3>
|
package/src/vaadin-app-layout.js
CHANGED
|
@@ -9,14 +9,15 @@ import { html, LitElement } from 'lit';
|
|
|
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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
13
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
|
+
import { appLayoutStyles } from './styles/vaadin-app-layout-core-styles.js';
|
|
13
15
|
import { AppLayoutMixin } from './vaadin-app-layout-mixin.js';
|
|
14
|
-
import { appLayoutStyles } from './vaadin-app-layout-styles.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* `<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.
|
|
18
19
|
*
|
|
19
|
-
* ```
|
|
20
|
+
* ```html
|
|
20
21
|
* <vaadin-app-layout primary-section="navbar|drawer">
|
|
21
22
|
* <vaadin-drawer-toggle slot="navbar [touch-optimized]"></vaadin-drawer-toggle>
|
|
22
23
|
* <h3 slot="navbar [touch-optimized]">Company Name</h3>
|
|
@@ -107,7 +108,7 @@ import { appLayoutStyles } from './vaadin-app-layout-styles.js';
|
|
|
107
108
|
* @mixes ElementMixin
|
|
108
109
|
* @mixes ThemableMixin
|
|
109
110
|
*/
|
|
110
|
-
class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
111
|
+
class AppLayout extends AppLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
111
112
|
static get is() {
|
|
112
113
|
return 'vaadin-app-layout';
|
|
113
114
|
}
|
|
@@ -10,7 +10,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
10
10
|
/**
|
|
11
11
|
* The Drawer Toggle component controls the drawer in App Layout component.
|
|
12
12
|
*
|
|
13
|
-
* ```
|
|
13
|
+
* ```html
|
|
14
14
|
* <vaadin-app-layout>
|
|
15
15
|
* <vaadin-drawer-toggle slot="navbar">Toggle drawer</vaadin-drawer-toggle>
|
|
16
16
|
* </vaadin-app-layout>
|
|
@@ -4,19 +4,20 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, LitElement } from 'lit';
|
|
7
|
-
import { buttonStyles } from '@vaadin/button/src/vaadin-button-core-styles.js';
|
|
7
|
+
import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-core-styles.js';
|
|
8
8
|
import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
|
|
9
9
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
10
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
11
11
|
import { isEmptyTextNode } from '@vaadin/component-base/src/dom-utils.js';
|
|
12
12
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.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
|
-
import { drawerToggle } from './vaadin-drawer-toggle-styles.js';
|
|
15
|
+
import { drawerToggle } from './styles/vaadin-drawer-toggle-core-styles.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* The Drawer Toggle component controls the drawer in App Layout component.
|
|
18
19
|
*
|
|
19
|
-
* ```
|
|
20
|
+
* ```html
|
|
20
21
|
* <vaadin-app-layout>
|
|
21
22
|
* <vaadin-drawer-toggle slot="navbar">Toggle drawer</vaadin-drawer-toggle>
|
|
22
23
|
* </vaadin-app-layout>
|
|
@@ -28,7 +29,7 @@ import { drawerToggle } from './vaadin-drawer-toggle-styles.js';
|
|
|
28
29
|
* @mixes DirMixin
|
|
29
30
|
* @mixes ThemableMixin
|
|
30
31
|
*/
|
|
31
|
-
class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
32
|
+
class DrawerToggle extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
32
33
|
static get is() {
|
|
33
34
|
return 'vaadin-drawer-toggle';
|
|
34
35
|
}
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/app-layout",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-app-layout",
|
|
11
|
-
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n
|
|
11
|
+
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables.\n```\n--safe-area-inset-top\n--safe-area-inset-right\n--safe-area-inset-bottom\n--safe-area-inset-left\n```\n\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat will make the `[content]` element of app layout scrollable.\nOn this case, the toolbars on mobile device won't collapse.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "i18n",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
"name": "vaadin-drawer-toggle",
|
|
122
|
-
"description": "The Drawer Toggle component controls the drawer in App Layout component.\n\n
|
|
122
|
+
"description": "The Drawer Toggle component controls the drawer in App Layout component.\n\n```html\n<vaadin-app-layout>\n <vaadin-drawer-toggle slot=\"navbar\">Toggle drawer</vaadin-drawer-toggle>\n</vaadin-app-layout>\n```",
|
|
123
123
|
"attributes": [
|
|
124
124
|
{
|
|
125
125
|
"name": "disabled",
|
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/app-layout",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
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-app-layout",
|
|
19
|
-
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n
|
|
19
|
+
"description": "`<vaadin-app-layout>` is a Web Component providing a quick and easy way to get a common application layout structure done.\n\n```html\n<vaadin-app-layout primary-section=\"navbar|drawer\">\n <vaadin-drawer-toggle slot=\"navbar [touch-optimized]\"></vaadin-drawer-toggle>\n <h3 slot=\"navbar [touch-optimized]\">Company Name</h3>\n <vaadin-tabs orientation=\"vertical\" slot=\"drawer\">\n <vaadin-tab>Menu item 1</vaadin-tab>\n </vaadin-tabs>\n <!-- Everything else will be the page content -->\n <div>\n <h3>Page title</h3>\n <p>Page content</p>\n </div>\n</vaadin-app-layout>\n```\n\nFor best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).\n\nThe page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:\n```\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\nThis causes the viewport to be scaled to fill the device display.\nTo ensure that important content is displayed, use the provided css variables.\n```\n--safe-area-inset-top\n--safe-area-inset-right\n--safe-area-inset-bottom\n--safe-area-inset-left\n```\n\n### Styling\n\nThe following Shadow DOM parts of the `<vaadin-app-layout>` are available for styling:\n\nPart name | Description\n--------------|---------------------------------------------------------|\n`backdrop` | Backdrop covering the layout when drawer is open as an overlay\n`navbar` | Container for the navigation bar\n`drawer` | Container for the drawer area\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Component's slots\n\nThe following slots are available to be set\n\nSlot name | Description\n-------------------|---------------------------------------------------|\nno name | Default container for the page content\n`navbar ` | Container for the top navbar area\n`drawer` | Container for an application menu\n`touch-optimized` | Container for the bottom navbar area (only visible for mobile devices)\n\n#### Touch optimized\n\nApp Layout has a pseudo-slot `touch-optimized` in order to give more control of the presentation of\nelements with `slot[navbar]`. Internally, when the user is interacting with App Layout from a\ntouchscreen device, the component will search for elements with `slot[navbar touch-optimized]` and move\nthem to the bottom of the page.\n\n### Navigation\n\nAs the drawer opens as an overlay in small devices, it makes sense to close it once a navigation happens.\nIf you are using Vaadin Router, this will happen automatically unless you change the `closeDrawerOn` event name.\n\nIn order to do so, there are two options:\n- If the `vaadin-app-layout` instance is available, then `drawerOpened` can be set to `false`\n- If not, a custom event `close-overlay-drawer` can be dispatched either by calling\n `window.dispatchEvent(new CustomEvent('close-overlay-drawer'))` or by calling\n `AppLayout.dispatchCloseOverlayDrawerEvent()`\n\n### Scrolling areas\n\nBy default, the component will act with the \"body scrolling\", so on mobile (iOS Safari and Android Chrome),\nthe toolbars will collapse when a scroll happens.\n\nTo use the \"content scrolling\", in case of the content of the page relies on a pre-defined height (for instance,\nit has a `height:100%`), then the developer can set `height: 100%` to both `html` and `body`.\nThat will make the `[content]` element of app layout scrollable.\nOn this case, the toolbars on mobile device won't collapse.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "vaadin-drawer-toggle",
|
|
82
|
-
"description": "The Drawer Toggle component controls the drawer in App Layout component.\n\n
|
|
82
|
+
"description": "The Drawer Toggle component controls the drawer in App Layout component.\n\n```html\n<vaadin-app-layout>\n <vaadin-drawer-toggle slot=\"navbar\">Toggle drawer</vaadin-drawer-toggle>\n</vaadin-app-layout>\n```",
|
|
83
83
|
"extension": true,
|
|
84
84
|
"attributes": [
|
|
85
85
|
{
|
|
File without changes
|
/package/src/{vaadin-drawer-toggle-styles.d.ts → styles/vaadin-drawer-toggle-base-styles.d.ts}
RENAMED
|
File without changes
|