@vaadin/app-layout 25.0.0-alpha2 → 25.0.0-alpha20
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 +10 -11
- package/src/safe-area-inset.js +6 -0
- package/src/{vaadin-app-layout-styles.js → styles/vaadin-app-layout-base-styles.js} +45 -18
- package/src/styles/vaadin-drawer-toggle-base-styles.js +27 -0
- package/src/vaadin-app-layout-mixin.d.ts +1 -1
- package/src/vaadin-app-layout-mixin.js +29 -8
- package/src/vaadin-app-layout.d.ts +9 -9
- package/src/vaadin-app-layout.js +12 -11
- package/src/vaadin-drawer-toggle.d.ts +1 -1
- package/src/vaadin-drawer-toggle.js +5 -4
- package/vaadin-app-layout.js +1 -1
- package/vaadin-drawer-toggle.js +1 -1
- package/web-types.json +4 -4
- package/web-types.lit.json +4 -4
- package/src/vaadin-drawer-toggle-styles.js +0 -43
- package/theme/lumo/vaadin-app-layout-styles.d.ts +0 -3
- package/theme/lumo/vaadin-app-layout-styles.js +0 -56
- package/theme/lumo/vaadin-app-layout.d.ts +0 -2
- package/theme/lumo/vaadin-app-layout.js +0 -2
- package/theme/lumo/vaadin-drawer-toggle-styles.d.ts +0 -1
- package/theme/lumo/vaadin-drawer-toggle-styles.js +0 -36
- package/theme/lumo/vaadin-drawer-toggle.d.ts +0 -2
- package/theme/lumo/vaadin-drawer-toggle.js +0 -2
- /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-alpha20",
|
|
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/button": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/vaadin-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha20",
|
|
38
|
+
"@vaadin/button": "25.0.0-alpha20",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha20",
|
|
40
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha20",
|
|
43
41
|
"lit": "^3.0.0"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
44
|
+
"@vaadin/chai-plugins": "25.0.0-alpha20",
|
|
45
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha20",
|
|
48
46
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
-
"
|
|
47
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha20",
|
|
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": "c948aae591a30b432f3784000d4677674cae56e0"
|
|
56
55
|
}
|
package/src/safe-area-inset.js
CHANGED
|
@@ -3,16 +3,17 @@
|
|
|
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
|
|
6
|
+
import '@vaadin/component-base/src/styles/style-props.js';
|
|
7
|
+
import { css } from 'lit';
|
|
7
8
|
|
|
8
9
|
export const appLayoutStyles = css`
|
|
9
10
|
:host {
|
|
10
11
|
display: block;
|
|
11
12
|
box-sizing: border-box;
|
|
12
13
|
height: 100%;
|
|
13
|
-
--vaadin-app-layout-transition:
|
|
14
|
-
transition: padding var(--vaadin-app-layout-transition);
|
|
15
|
-
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width,
|
|
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);
|
|
16
17
|
--vaadin-app-layout-touch-optimized: false;
|
|
17
18
|
--vaadin-app-layout-navbar-offset-top: var(--_vaadin-app-layout-navbar-offset-size);
|
|
18
19
|
--vaadin-app-layout-navbar-offset-bottom: var(--_vaadin-app-layout-navbar-offset-size-bottom);
|
|
@@ -25,8 +26,10 @@ export const appLayoutStyles = css`
|
|
|
25
26
|
display: none !important;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
:
|
|
29
|
-
|
|
29
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
30
|
+
:host(:not([no-anim])) {
|
|
31
|
+
--vaadin-app-layout-transition-duration: 200ms;
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
:host([drawer-opened]) {
|
|
@@ -58,11 +61,21 @@ export const appLayoutStyles = css`
|
|
|
58
61
|
align-items: center;
|
|
59
62
|
top: 0;
|
|
60
63
|
inset-inline: 0;
|
|
61
|
-
transition: inset-inline-start var(--vaadin-app-layout-transition);
|
|
62
|
-
padding-top: var(--safe-area-inset-top);
|
|
63
|
-
padding-
|
|
64
|
-
padding-
|
|
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-s)), var(--safe-area-inset-top));
|
|
66
|
+
padding-bottom: var(--vaadin-app-layout-navbar-padding-bottom, var(--vaadin-padding-s));
|
|
67
|
+
padding-inline-start: max(
|
|
68
|
+
var(--vaadin-app-layout-navbar-padding-inline-start, var(--vaadin-padding-s)),
|
|
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-s)),
|
|
74
|
+
var(--safe-area-inset-right)
|
|
75
|
+
);
|
|
65
76
|
z-index: 1;
|
|
77
|
+
gap: var(--vaadin-app-layout-navbar-gap, var(--vaadin-gap-s));
|
|
78
|
+
background: var(--vaadin-app-layout-navbar-background, var(--vaadin-background-container));
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
:host([primary-section='drawer'][drawer-opened]:not([overlay])) [part='navbar'] {
|
|
@@ -76,18 +89,23 @@ export const appLayoutStyles = css`
|
|
|
76
89
|
[part='navbar'][bottom] {
|
|
77
90
|
top: auto;
|
|
78
91
|
bottom: 0;
|
|
79
|
-
padding-
|
|
92
|
+
padding-top: var(--vaadin-app-layout-navbar-padding-top, var(--vaadin-padding-s));
|
|
93
|
+
padding-bottom: max(
|
|
94
|
+
var(--vaadin-app-layout-navbar-padding-bottom, var(--vaadin-padding-s)),
|
|
95
|
+
var(--safe-area-inset-bottom)
|
|
96
|
+
);
|
|
80
97
|
}
|
|
81
98
|
|
|
82
99
|
[part='drawer'] {
|
|
83
100
|
overflow: auto;
|
|
101
|
+
overscroll-behavior: contain;
|
|
84
102
|
position: fixed;
|
|
85
103
|
top: var(--vaadin-app-layout-navbar-offset-top, 0);
|
|
86
104
|
bottom: var(--vaadin-app-layout-navbar-offset-bottom, var(--vaadin-viewport-offset-bottom, 0));
|
|
87
105
|
inset-inline: var(--vaadin-app-layout-navbar-offset-left, 0) auto;
|
|
88
106
|
transition:
|
|
89
|
-
transform var(--vaadin-app-layout-transition),
|
|
90
|
-
visibility var(--vaadin-app-layout-transition);
|
|
107
|
+
transform var(--vaadin-app-layout-transition-duration),
|
|
108
|
+
visibility var(--vaadin-app-layout-transition-duration);
|
|
91
109
|
transform: translateX(-100%);
|
|
92
110
|
max-width: 90%;
|
|
93
111
|
width: var(--_vaadin-app-layout-drawer-width);
|
|
@@ -98,6 +116,7 @@ export const appLayoutStyles = css`
|
|
|
98
116
|
visibility: hidden;
|
|
99
117
|
display: flex;
|
|
100
118
|
flex-direction: column;
|
|
119
|
+
background: var(--vaadin-app-layout-drawer-background, transparent);
|
|
101
120
|
}
|
|
102
121
|
|
|
103
122
|
:host([drawer-opened]) [part='drawer'] {
|
|
@@ -108,25 +127,27 @@ export const appLayoutStyles = css`
|
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
[part='backdrop'] {
|
|
111
|
-
background
|
|
112
|
-
|
|
130
|
+
background: var(--vaadin-overlay-backdrop-background, rgba(0, 0, 0, 0.2));
|
|
131
|
+
forced-color-adjust: none;
|
|
113
132
|
}
|
|
114
133
|
|
|
115
134
|
:host(:not([drawer-opened])) [part='backdrop'] {
|
|
116
|
-
opacity: 0;
|
|
135
|
+
opacity: 0 !important;
|
|
117
136
|
}
|
|
118
137
|
|
|
119
138
|
:host([overlay]) [part='backdrop'] {
|
|
120
139
|
position: fixed;
|
|
121
140
|
inset: 0;
|
|
122
141
|
pointer-events: none;
|
|
123
|
-
transition: opacity var(--vaadin-app-layout-transition);
|
|
142
|
+
transition: opacity var(--vaadin-app-layout-transition-duration);
|
|
124
143
|
-webkit-tap-highlight-color: transparent;
|
|
125
144
|
}
|
|
126
145
|
|
|
127
146
|
:host([overlay]) [part='drawer'] {
|
|
128
147
|
top: 0;
|
|
129
148
|
bottom: 0;
|
|
149
|
+
box-shadow: var(--vaadin-overlay-box-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3));
|
|
150
|
+
background: var(--vaadin-app-layout-drawer-background, var(--vaadin-background-color));
|
|
130
151
|
}
|
|
131
152
|
|
|
132
153
|
:host([overlay]) [part='drawer'],
|
|
@@ -154,7 +175,7 @@ export const appLayoutStyles = css`
|
|
|
154
175
|
@media (max-width: 800px), (max-height: 600px) {
|
|
155
176
|
:host {
|
|
156
177
|
--vaadin-app-layout-drawer-overlay: true;
|
|
157
|
-
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width,
|
|
178
|
+
--_vaadin-app-layout-drawer-width: var(--vaadin-app-layout-drawer-width, 320px);
|
|
158
179
|
}
|
|
159
180
|
}
|
|
160
181
|
|
|
@@ -163,4 +184,10 @@ export const appLayoutStyles = css`
|
|
|
163
184
|
flex: 1;
|
|
164
185
|
overscroll-behavior: contain;
|
|
165
186
|
}
|
|
187
|
+
|
|
188
|
+
@media (forced-colors: active) {
|
|
189
|
+
:host([overlay]) [part='drawer'] {
|
|
190
|
+
border: 3px solid;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
166
193
|
`;
|
|
@@ -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/styles/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
|
+
`;
|
|
@@ -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
|
|
|
@@ -104,7 +105,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
104
105
|
* just the individual properties you want to change.
|
|
105
106
|
*
|
|
106
107
|
* The object has the following structure and default values:
|
|
107
|
-
* ```
|
|
108
|
+
* ```js
|
|
108
109
|
* {
|
|
109
110
|
* drawer: 'Drawer'
|
|
110
111
|
* }
|
|
@@ -247,6 +248,22 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
247
248
|
this.__setAriaExpanded();
|
|
248
249
|
}
|
|
249
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
|
+
|
|
250
267
|
/**
|
|
251
268
|
* A callback for the `i18n` property observer.
|
|
252
269
|
*
|
|
@@ -363,8 +380,8 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
363
380
|
/**
|
|
364
381
|
* Returns a promise that resolves when the drawer opening/closing CSS transition ends.
|
|
365
382
|
*
|
|
366
|
-
* The method relies on the `--vaadin-app-layout-transition` CSS variable to detect whether
|
|
367
|
-
* 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`,
|
|
368
385
|
* the promise resolves immediately.
|
|
369
386
|
*
|
|
370
387
|
* @return {Promise}
|
|
@@ -372,7 +389,7 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
372
389
|
*/
|
|
373
390
|
__drawerTransitionComplete() {
|
|
374
391
|
return new Promise((resolve) => {
|
|
375
|
-
if (this._getCustomPropertyValue('--vaadin-app-layout-transition') === '
|
|
392
|
+
if (this._getCustomPropertyValue('--vaadin-app-layout-transition-duration') === '0s') {
|
|
376
393
|
resolve();
|
|
377
394
|
return;
|
|
378
395
|
}
|
|
@@ -409,18 +426,22 @@ export const AppLayoutMixin = (superclass) =>
|
|
|
409
426
|
return;
|
|
410
427
|
}
|
|
411
428
|
|
|
412
|
-
this.
|
|
413
|
-
this.__focusTrapController.releaseFocus();
|
|
414
|
-
this.$.drawer.removeAttribute('tabindex');
|
|
429
|
+
this.__restoreFocus();
|
|
415
430
|
|
|
416
431
|
// Move focus to the drawer toggle when closing the drawer.
|
|
417
432
|
const toggle = this.querySelector('vaadin-drawer-toggle');
|
|
418
433
|
if (toggle) {
|
|
419
434
|
toggle.focus();
|
|
420
|
-
toggle.setAttribute('focus-ring', 'focus');
|
|
421
435
|
}
|
|
422
436
|
}
|
|
423
437
|
|
|
438
|
+
/** @private */
|
|
439
|
+
__restoreFocus() {
|
|
440
|
+
this.__ariaModalController.close();
|
|
441
|
+
this.__focusTrapController.releaseFocus();
|
|
442
|
+
this.$.drawer.removeAttribute('tabindex');
|
|
443
|
+
}
|
|
444
|
+
|
|
424
445
|
/**
|
|
425
446
|
* Closes the drawer on Escape press if it has been opened in the overlay mode.
|
|
426
447
|
*
|
|
@@ -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>
|
|
@@ -55,17 +55,17 @@ export type AppLayoutEventMap = AppLayoutCustomEventMap & HTMLElementEventMap;
|
|
|
55
55
|
* For best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).
|
|
56
56
|
*
|
|
57
57
|
* The page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:
|
|
58
|
-
* ```
|
|
58
|
+
* ```html
|
|
59
59
|
* <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
60
60
|
* ```
|
|
61
|
+
*
|
|
61
62
|
* This causes the viewport to be scaled to fill the device display.
|
|
62
|
-
* To ensure that important content is displayed, use the provided css variables
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* ```
|
|
63
|
+
* To ensure that important content is displayed, use the provided css variables:
|
|
64
|
+
*
|
|
65
|
+
* - `--safe-area-inset-top`
|
|
66
|
+
* - `--safe-area-inset-right`
|
|
67
|
+
* - `--safe-area-inset-bottom`
|
|
68
|
+
* - `--safe-area-inset-left`
|
|
69
69
|
*
|
|
70
70
|
* ### Styling
|
|
71
71
|
*
|
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-base-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>
|
|
@@ -34,17 +35,17 @@ import { appLayoutStyles } from './vaadin-app-layout-styles.js';
|
|
|
34
35
|
* For best results, the component should be added to the root level of your application (i.e., as a direct child of `<body>`).
|
|
35
36
|
*
|
|
36
37
|
* The page should include a viewport meta tag which contains `viewport-fit=cover`, like the following:
|
|
37
|
-
* ```
|
|
38
|
+
* ```html
|
|
38
39
|
* <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
39
40
|
* ```
|
|
41
|
+
*
|
|
40
42
|
* This causes the viewport to be scaled to fill the device display.
|
|
41
|
-
* To ensure that important content is displayed, use the provided css variables
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* ```
|
|
43
|
+
* To ensure that important content is displayed, use the provided css variables:
|
|
44
|
+
*
|
|
45
|
+
* - `--safe-area-inset-top`
|
|
46
|
+
* - `--safe-area-inset-right`
|
|
47
|
+
* - `--safe-area-inset-bottom`
|
|
48
|
+
* - `--safe-area-inset-left`
|
|
48
49
|
*
|
|
49
50
|
* ### Styling
|
|
50
51
|
*
|
|
@@ -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-
|
|
7
|
+
import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-base-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-base-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/vaadin-app-layout.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-app-layout.js';
|
|
2
2
|
export * from './src/vaadin-app-layout.js';
|
package/vaadin-drawer-toggle.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-drawer-toggle.js';
|
|
2
2
|
export * from './src/vaadin-drawer-toggle.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/app-layout",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha20",
|
|
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```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\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### 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",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"properties": [
|
|
63
63
|
{
|
|
64
64
|
"name": "i18n",
|
|
65
|
-
"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
|
|
65
|
+
"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 drawer: 'Drawer'\n}\n```",
|
|
66
66
|
"value": {
|
|
67
67
|
"type": [
|
|
68
68
|
"AppLayoutI18n"
|
|
@@ -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-alpha20",
|
|
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```html\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, viewport-fit=cover\">\n```\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### 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
|
{
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
"name": ".i18n",
|
|
31
|
-
"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
|
|
31
|
+
"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 drawer: 'Drawer'\n}\n```",
|
|
32
32
|
"value": {
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
@@ -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
|
{
|
|
@@ -1,43 +0,0 @@
|
|
|
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 { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
|
-
|
|
8
|
-
export const drawerToggle = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
cursor: default;
|
|
14
|
-
position: relative;
|
|
15
|
-
outline: none;
|
|
16
|
-
height: 24px;
|
|
17
|
-
width: 24px;
|
|
18
|
-
padding: 4px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[part='icon'],
|
|
22
|
-
[part='icon']::after,
|
|
23
|
-
[part='icon']::before {
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 8px;
|
|
26
|
-
height: 3px;
|
|
27
|
-
width: 24px;
|
|
28
|
-
background-color: #000;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
[part='icon']::after,
|
|
32
|
-
[part='icon']::before {
|
|
33
|
-
content: '';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='icon']::after {
|
|
37
|
-
top: 6px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
[part='icon']::before {
|
|
41
|
-
top: 12px;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
2
|
-
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
3
|
-
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
4
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
|
-
|
|
6
|
-
registerStyles(
|
|
7
|
-
'vaadin-app-layout',
|
|
8
|
-
css`
|
|
9
|
-
[part='navbar'],
|
|
10
|
-
[part='drawer'] {
|
|
11
|
-
background-color: var(--lumo-base-color);
|
|
12
|
-
background-clip: padding-box;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[part='navbar'] {
|
|
16
|
-
min-height: var(--lumo-size-xl);
|
|
17
|
-
border-bottom: 1px solid var(--lumo-contrast-10pct);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
[part='navbar'][bottom] {
|
|
21
|
-
border-bottom: none;
|
|
22
|
-
border-top: 1px solid var(--lumo-contrast-10pct);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[part='drawer'] {
|
|
26
|
-
border-inline-end: 1px solid var(--lumo-contrast-10pct);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
:host([overlay]) [part='drawer'] {
|
|
30
|
-
border-inline-end: none;
|
|
31
|
-
box-shadow: var(--lumo-box-shadow-s);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([primary-section='navbar']) [part='navbar'] {
|
|
35
|
-
border: none;
|
|
36
|
-
background-image: linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:host([primary-section='drawer']:not([overlay])) [part='drawer'] {
|
|
40
|
-
background-image: linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[part='backdrop'] {
|
|
44
|
-
background-color: var(--lumo-shade-20pct);
|
|
45
|
-
opacity: 1;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
[part] ::slotted(h2),
|
|
49
|
-
[part] ::slotted(h3),
|
|
50
|
-
[part] ::slotted(h4) {
|
|
51
|
-
margin-top: var(--lumo-space-xs) !important;
|
|
52
|
-
margin-bottom: var(--lumo-space-xs) !important;
|
|
53
|
-
}
|
|
54
|
-
`,
|
|
55
|
-
{ moduleId: 'lumo-app-layout' },
|
|
56
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
2
|
-
import { button } from '@vaadin/button/theme/lumo/vaadin-button-styles.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
const drawerToggle = css`
|
|
6
|
-
:host {
|
|
7
|
-
width: var(--lumo-size-l);
|
|
8
|
-
height: var(--lumo-size-l);
|
|
9
|
-
min-width: auto;
|
|
10
|
-
margin: 0 var(--lumo-space-s);
|
|
11
|
-
padding: 0;
|
|
12
|
-
background: transparent;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
[part='icon'],
|
|
16
|
-
[part='icon']::after,
|
|
17
|
-
[part='icon']::before {
|
|
18
|
-
position: inherit;
|
|
19
|
-
height: auto;
|
|
20
|
-
width: auto;
|
|
21
|
-
background: transparent;
|
|
22
|
-
top: auto;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
[part='icon']::before {
|
|
26
|
-
font-family: lumo-icons;
|
|
27
|
-
font-size: var(--lumo-icon-size-m);
|
|
28
|
-
content: var(--lumo-icons-menu);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
:host([slot~='navbar']) {
|
|
32
|
-
color: var(--lumo-secondary-text-color);
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
registerStyles('vaadin-drawer-toggle', [button, drawerToggle], { moduleId: 'lumo-drawer-toggle' });
|
|
File without changes
|
/package/src/{vaadin-drawer-toggle-styles.d.ts → styles/vaadin-drawer-toggle-base-styles.d.ts}
RENAMED
|
File without changes
|