@zanichelli/albe-web-components 7.1.1 → 7.2.0
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/CHANGELOG.md +0 -29
- package/dist/cjs/index-e3299e0a.js +6 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header.cjs.entry.js +133 -0
- package/dist/cjs/z-button_3.cjs.entry.js +108 -0
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +4 -24
- package/dist/cjs/z-list_3.cjs.entry.js +1 -1
- package/dist/cjs/z-menu-section.cjs.entry.js +3 -11
- package/dist/cjs/z-menu.cjs.entry.js +14 -26
- package/dist/cjs/z-searchbar.cjs.entry.js +3 -12
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/inputs/z-searchbar/index.js +3 -76
- package/dist/collection/components/inputs/z-searchbar/styles.css +0 -23
- package/dist/collection/components/list/z-list-element/index.js +1 -1
- package/dist/collection/components/modal/z-modal/index.js +4 -42
- package/dist/collection/components/navigation/z-app-header/index.js +15 -14
- package/dist/collection/components/navigation/z-app-header/styles.css +3 -2
- package/dist/collection/components/navigation/z-menu/index.js +21 -45
- package/dist/collection/components/navigation/z-menu/styles.css +13 -80
- package/dist/collection/components/navigation/z-menu-section/index.js +4 -13
- package/dist/collection/components/navigation/z-menu-section/styles.css +4 -37
- package/dist/collection/components/z-offcanvas/index.js +31 -31
- package/dist/collection/components/z-offcanvas/styles.css +78 -87
- package/dist/esm/index-a2ca4b97.js +6 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header.entry.js +129 -0
- package/dist/esm/z-button_3.entry.js +102 -0
- package/dist/esm/z-dragdrop-area_2.entry.js +4 -24
- package/dist/esm/z-list_3.entry.js +1 -1
- package/dist/esm/z-menu-section.entry.js +3 -11
- package/dist/esm/z-menu.entry.js +14 -26
- package/dist/esm/z-searchbar.entry.js +4 -13
- package/dist/types/components/inputs/z-searchbar/index.d.ts +1 -7
- package/dist/types/components/modal/z-modal/index.d.ts +0 -4
- package/dist/types/components/navigation/z-app-header/index.d.ts +4 -2
- package/dist/types/components/navigation/z-menu/index.d.ts +5 -13
- package/dist/types/components/navigation/z-menu-section/index.d.ts +3 -9
- package/dist/types/components/z-offcanvas/index.d.ts +4 -4
- package/dist/types/components.d.ts +14 -42
- package/dist/web-components-library/p-029e4fba.entry.js +1 -0
- package/dist/web-components-library/p-14a6abe4.entry.js +1 -0
- package/dist/web-components-library/p-73d9489b.entry.js +1 -0
- package/dist/web-components-library/p-f158d205.entry.js +1 -0
- package/dist/web-components-library/p-f95cc914.entry.js +1 -0
- package/dist/web-components-library/p-fa4c203a.entry.js +1 -0
- package/dist/web-components-library/p-fffb14e1.entry.js +1 -0
- package/dist/web-components-library/web-components-library.css +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +2 -2
- package/www/build/p-029e4fba.entry.js +1 -0
- package/www/build/p-14a6abe4.entry.js +1 -0
- package/www/build/p-275801c6.css +1 -0
- package/www/build/p-73d9489b.entry.js +1 -0
- package/www/build/p-811ee64f.js +1 -0
- package/www/build/p-f158d205.entry.js +1 -0
- package/www/build/p-f95cc914.entry.js +1 -0
- package/www/build/p-fa4c203a.entry.js +1 -0
- package/www/build/p-fffb14e1.entry.js +1 -0
- package/www/build/web-components-library.css +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +37 -1
- package/dist/cjs/z-app-header_2.cjs.entry.js +0 -152
- package/dist/cjs/z-button.cjs.entry.js +0 -43
- package/dist/cjs/z-offcanvas.cjs.entry.js +0 -70
- package/dist/esm/z-app-header_2.entry.js +0 -147
- package/dist/esm/z-button.entry.js +0 -39
- package/dist/esm/z-offcanvas.entry.js +0 -66
- package/dist/web-components-library/p-1570917d.entry.js +0 -1
- package/dist/web-components-library/p-157aea3b.entry.js +0 -1
- package/dist/web-components-library/p-1c8e7c24.entry.js +0 -1
- package/dist/web-components-library/p-8d134dc4.entry.js +0 -1
- package/dist/web-components-library/p-af283478.entry.js +0 -1
- package/dist/web-components-library/p-d0760bb1.entry.js +0 -1
- package/dist/web-components-library/p-deda8776.entry.js +0 -1
- package/dist/web-components-library/p-f3a8cc14.entry.js +0 -1
- package/www/build/p-1570917d.entry.js +0 -1
- package/www/build/p-157aea3b.entry.js +0 -1
- package/www/build/p-1c8e7c24.entry.js +0 -1
- package/www/build/p-717b1737.js +0 -1
- package/www/build/p-8d134dc4.entry.js +0 -1
- package/www/build/p-ab4e13f7.css +0 -1
- package/www/build/p-af283478.entry.js +0 -1
- package/www/build/p-d0760bb1.entry.js +0 -1
- package/www/build/p-deda8776.entry.js +0 -1
- package/www/build/p-f3a8cc14.entry.js +0 -1
|
@@ -10,18 +10,16 @@ export class ZMenu {
|
|
|
10
10
|
* Flag to set the display mode of the list.
|
|
11
11
|
* If true, the list will be absolutely positioned under the menu label,
|
|
12
12
|
* stacked beneath it otherwise.
|
|
13
|
+
* @default false
|
|
13
14
|
*/
|
|
14
15
|
this.floating = false;
|
|
15
|
-
/** The opening state of the menu. */
|
|
16
|
-
this.open = false;
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* The opening state of the menu.
|
|
18
|
+
* @default false
|
|
20
19
|
*/
|
|
21
|
-
this.
|
|
20
|
+
this.open = false;
|
|
22
21
|
this.toggle = this.toggle.bind(this);
|
|
23
22
|
this.checkContent = this.checkContent.bind(this);
|
|
24
|
-
this.onLabelSlotChange = this.onLabelSlotChange.bind(this);
|
|
25
23
|
this.onItemsChange = this.onItemsChange.bind(this);
|
|
26
24
|
}
|
|
27
25
|
toggle() {
|
|
@@ -51,14 +49,6 @@ export class ZMenu {
|
|
|
51
49
|
componentWillLoad() {
|
|
52
50
|
this.checkContent();
|
|
53
51
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
|
|
56
|
-
* @param ev Slotchange event
|
|
57
|
-
*/
|
|
58
|
-
onLabelSlotChange(ev) {
|
|
59
|
-
const labelElement = ev.target.assignedElements()[0];
|
|
60
|
-
labelElement.dataset.text = labelElement === null || labelElement === void 0 ? void 0 : labelElement.textContent;
|
|
61
|
-
}
|
|
62
52
|
/**
|
|
63
53
|
* Correctly set position of the floating menu in order to prevent overflow.
|
|
64
54
|
* @param live Should run the method on every refresh frame.
|
|
@@ -80,29 +70,27 @@ export class ZMenu {
|
|
|
80
70
|
* Check if some content slot is set.
|
|
81
71
|
*/
|
|
82
72
|
checkContent() {
|
|
83
|
-
this.hasHeader = !!this.hostElement.querySelectorAll(
|
|
84
|
-
this.hasContent = !!this.hostElement.querySelectorAll(
|
|
73
|
+
this.hasHeader = !!this.hostElement.querySelectorAll('[slot="header"]').length;
|
|
74
|
+
this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length || this.hasHeader;
|
|
85
75
|
}
|
|
86
76
|
/**
|
|
87
77
|
* Set `menuitem` role to all menu items.
|
|
88
|
-
* Set the item's inner text to the `data-text` attribute (this is for using bold text avoiding layout shifts).
|
|
89
78
|
*/
|
|
90
79
|
onItemsChange() {
|
|
91
80
|
this.checkContent();
|
|
92
|
-
const items = this.hostElement.querySelectorAll(
|
|
93
|
-
items.forEach((item) =>
|
|
94
|
-
item.setAttribute("role", "menuitem");
|
|
95
|
-
item.dataset.text = item.textContent;
|
|
96
|
-
});
|
|
81
|
+
const items = this.hostElement.querySelectorAll('[slot="item"]');
|
|
82
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => item.setAttribute("role", "menuitem"));
|
|
97
83
|
}
|
|
98
84
|
renderMenuLabel() {
|
|
99
85
|
if (this.hasContent) {
|
|
100
|
-
return (h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, h("div", { class: "menu-label-content" }, h("slot",
|
|
86
|
+
return (h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, h("div", { class: "menu-label-content" }, h("slot", null), h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" }))));
|
|
101
87
|
}
|
|
102
|
-
return (h("div", { class: "menu-label" }, h("div", { class: "menu-label-content" }, h("slot",
|
|
88
|
+
return (h("div", { class: "menu-label" }, h("div", { class: "menu-label-content" }, h("slot", null))));
|
|
103
89
|
}
|
|
104
90
|
render() {
|
|
105
|
-
return (h(Host, null, this.renderMenuLabel(),
|
|
91
|
+
return (h(Host, null, this.renderMenuLabel(), h("div", { class: "content", ref: (el) => {
|
|
92
|
+
this.content = el;
|
|
93
|
+
}, hidden: !this.open }, this.hasHeader && (h("header", { class: "header" }, h("slot", { name: "header", onSlotchange: this.checkContent }))), h("div", { class: "items", role: "menu" }, h("slot", { name: "item", onSlotchange: this.onItemsChange })))));
|
|
106
94
|
}
|
|
107
95
|
static get is() { return "z-menu"; }
|
|
108
96
|
static get encapsulation() { return "shadow"; }
|
|
@@ -146,7 +134,10 @@ export class ZMenu {
|
|
|
146
134
|
"required": false,
|
|
147
135
|
"optional": true,
|
|
148
136
|
"docs": {
|
|
149
|
-
"tags": [
|
|
137
|
+
"tags": [{
|
|
138
|
+
"name": "default",
|
|
139
|
+
"text": "false"
|
|
140
|
+
}],
|
|
150
141
|
"text": "Flag to set the display mode of the list.\nIf true, the list will be absolutely positioned under the menu label,\nstacked beneath it otherwise."
|
|
151
142
|
},
|
|
152
143
|
"attribute": "floating",
|
|
@@ -164,30 +155,15 @@ export class ZMenu {
|
|
|
164
155
|
"required": false,
|
|
165
156
|
"optional": false,
|
|
166
157
|
"docs": {
|
|
167
|
-
"tags": [
|
|
158
|
+
"tags": [{
|
|
159
|
+
"name": "default",
|
|
160
|
+
"text": "false"
|
|
161
|
+
}],
|
|
168
162
|
"text": "The opening state of the menu."
|
|
169
163
|
},
|
|
170
164
|
"attribute": "open",
|
|
171
165
|
"reflect": true,
|
|
172
166
|
"defaultValue": "false"
|
|
173
|
-
},
|
|
174
|
-
"verticalContext": {
|
|
175
|
-
"type": "boolean",
|
|
176
|
-
"mutable": false,
|
|
177
|
-
"complexType": {
|
|
178
|
-
"original": "boolean",
|
|
179
|
-
"resolved": "boolean",
|
|
180
|
-
"references": {}
|
|
181
|
-
},
|
|
182
|
-
"required": false,
|
|
183
|
-
"optional": false,
|
|
184
|
-
"docs": {
|
|
185
|
-
"tags": [],
|
|
186
|
-
"text": "Tells the component that it's placed in a vertical context with other `ZMenu`s (e.g. in the ZAppHeader's offcanvas).\nA small border is placed under it as a separator from other elements."
|
|
187
|
-
},
|
|
188
|
-
"attribute": "vertical-context",
|
|
189
|
-
"reflect": true,
|
|
190
|
-
"defaultValue": "false"
|
|
191
167
|
}
|
|
192
168
|
};
|
|
193
169
|
}
|
|
@@ -11,17 +11,13 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
::slotted(a) {
|
|
14
|
+
color: var(--color-text01);
|
|
14
15
|
text-decoration: none;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
::slotted(*) {
|
|
18
|
-
color: var(--color-text01);
|
|
19
19
|
font-family: var(--font-family-sans);
|
|
20
20
|
font-weight: var(--font-rg);
|
|
21
|
-
|
|
22
|
-
/* increasing the letter spacing of the regular text helps reduce
|
|
23
|
-
the size difference between regular and bold text */
|
|
24
|
-
letter-spacing: 0.36px;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
.menu-label {
|
|
@@ -49,101 +45,38 @@ button.menu-label {
|
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
.menu-label .menu-label-content {
|
|
52
|
-
position: relative;
|
|
53
48
|
display: flex;
|
|
54
49
|
align-items: center;
|
|
50
|
+
padding: var(--space-unit) 0;
|
|
51
|
+
border-bottom: var(--border-size-large) solid var(--color-surface05);
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
:host(
|
|
58
|
-
|
|
54
|
+
:host([active]) .menu-label-content,
|
|
55
|
+
:host([open]) .menu-label-content,
|
|
56
|
+
.menu-label:hover .menu-label-content,
|
|
59
57
|
.menu-label:focus-within .menu-label-content {
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host(:is([active], [open])) .menu-label-content ::slotted(*),
|
|
64
|
-
.menu-label .menu-label-content:hover ::slotted(*),
|
|
65
|
-
.menu-label:focus-within .menu-label-content ::slotted(*) {
|
|
66
|
-
letter-spacing: normal;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* border */
|
|
70
|
-
:host(:is([active], [open], [vertical-context])) .menu-label .menu-label-content::after,
|
|
71
|
-
.menu-label .menu-label-content:hover::after,
|
|
72
|
-
.menu-label:focus-within .menu-label-content::after {
|
|
73
|
-
position: absolute;
|
|
74
|
-
bottom: 0;
|
|
75
|
-
left: 0;
|
|
76
|
-
width: 100%;
|
|
77
|
-
content: "";
|
|
78
|
-
pointer-events: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
:host([vertical-context]) .menu-label-content::after {
|
|
82
|
-
height: var(--border-size-small);
|
|
83
|
-
background-color: var(--color-surface03);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
:host(:is([active], [open])) .menu-label .menu-label-content::after,
|
|
87
|
-
.menu-label .menu-label-content:hover::after,
|
|
88
|
-
.menu-label:focus-within .menu-label-content::after {
|
|
89
|
-
height: var(--border-size-large);
|
|
90
|
-
background-color: var(--color-secondary01);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/* Prevents layout shifts on font-weight changes.
|
|
94
|
-
The trick is to put an hidden copy of the text already set to bold,
|
|
95
|
-
so the needed space is correctly calculated before any hover/active state changes the
|
|
96
|
-
font-weight of the real text.
|
|
97
|
-
The hidden text has an height of 0px so it can expand the width without changing the height
|
|
98
|
-
when placed below the real text using `flex-direction: column`. */
|
|
99
|
-
::slotted([data-text])::after {
|
|
100
|
-
height: 0;
|
|
101
|
-
content: attr(data-text);
|
|
102
|
-
content: attr(data-text) / "";
|
|
103
|
-
font-weight: var(--font-bd);
|
|
104
|
-
letter-spacing: normal;
|
|
105
|
-
pointer-events: none;
|
|
106
|
-
user-select: none;
|
|
107
|
-
visibility: hidden;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@media speech {
|
|
111
|
-
::slotted([data-text])::after {
|
|
112
|
-
display: none;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
::slotted([data-text]) {
|
|
117
|
-
display: inline-flex;
|
|
118
|
-
flex-direction: column;
|
|
58
|
+
border-color: var(--color-secondary01);
|
|
119
59
|
}
|
|
120
60
|
|
|
121
|
-
.menu-label
|
|
122
|
-
display: inline-flex;
|
|
61
|
+
.menu-label ::slotted(*) {
|
|
123
62
|
width: 100%;
|
|
124
63
|
margin: 0;
|
|
125
64
|
appearance: none;
|
|
126
65
|
font-size: var(--font-size-5);
|
|
127
|
-
font-weight: inherit;
|
|
128
66
|
line-height: 1.2;
|
|
129
67
|
outline: none;
|
|
130
68
|
}
|
|
131
69
|
|
|
132
|
-
.menu-label
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.menu-label .menu-label-content z-icon {
|
|
138
|
-
margin-left: calc(var(--space-unit) * 1.5);
|
|
139
|
-
fill: var(--color-icon02);
|
|
70
|
+
.menu-label z-icon {
|
|
71
|
+
margin-left: calc(var(--space-unit) * 4);
|
|
72
|
+
fill: currentcolor;
|
|
140
73
|
}
|
|
141
74
|
|
|
142
75
|
.content {
|
|
143
76
|
background: var(--color-surface01);
|
|
144
77
|
}
|
|
145
78
|
|
|
146
|
-
|
|
79
|
+
.content[hidden] {
|
|
147
80
|
display: none;
|
|
148
81
|
}
|
|
149
82
|
|
|
@@ -190,6 +123,7 @@ when placed below the real text using `flex-direction: column`. */
|
|
|
190
123
|
}
|
|
191
124
|
|
|
192
125
|
.items > ::slotted([slot="item"]) {
|
|
126
|
+
display: inline-flex;
|
|
193
127
|
width: 100%;
|
|
194
128
|
margin: 0;
|
|
195
129
|
font-size: var(--font-size-3);
|
|
@@ -209,5 +143,4 @@ when placed below the real text using `flex-direction: column`. */
|
|
|
209
143
|
.items > ::slotted([slot="item"]:hover),
|
|
210
144
|
.items > ::slotted([slot="item"]:active) {
|
|
211
145
|
border-color: var(--color-secondary01);
|
|
212
|
-
font-weight: var(--font-bd);
|
|
213
146
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @slot -
|
|
5
|
-
* @slot item - Single entry of the section. Set the same slot name to different items to put many of them. Add the `active` attribute to a slotted item to highlight it.
|
|
3
|
+
* @slot - Menu section label
|
|
4
|
+
* @slot item - Single entry of the section. Can be slotted multiple times to insert items.
|
|
6
5
|
*/
|
|
7
6
|
export class ZMenuSection {
|
|
8
7
|
toggle() {
|
|
@@ -24,21 +23,13 @@ export class ZMenuSection {
|
|
|
24
23
|
* Check if some content slot is set.
|
|
25
24
|
*/
|
|
26
25
|
checkContent() {
|
|
27
|
-
this.hasContent = this.hostElement.querySelectorAll('[slot="item"]').length
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
|
|
31
|
-
* @param ev Slotchange event
|
|
32
|
-
*/
|
|
33
|
-
onLabelSlotChange(ev) {
|
|
34
|
-
const labelElement = ev.target.assignedElements()[0];
|
|
35
|
-
labelElement.dataset.text = (labelElement === null || labelElement === void 0 ? void 0 : labelElement.innerText) || null;
|
|
26
|
+
this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length;
|
|
36
27
|
}
|
|
37
28
|
componentWillLoad() {
|
|
38
29
|
this.checkContent();
|
|
39
30
|
}
|
|
40
31
|
render() {
|
|
41
|
-
return (h(Host, { role: "menu", open: this.open }, h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, h("slot",
|
|
32
|
+
return (h(Host, { role: "menu", open: this.open }, h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, h("slot", null), this.hasContent && h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" })), this.open && (h("div", { class: "items" }, h("slot", { name: "item", onSlotchange: this.checkContent.bind(this) })))));
|
|
42
33
|
}
|
|
43
34
|
static get is() { return "z-menu-section"; }
|
|
44
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -23,15 +23,12 @@
|
|
|
23
23
|
font-weight: var(--font-rg);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
:host(
|
|
26
|
+
:host([active]) .label,
|
|
27
|
+
:host([open]) .label,
|
|
27
28
|
.label:hover {
|
|
28
29
|
border-color: var(--color-secondary01);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
:is(:host(:is([active], [open])) .label, .label:hover) ::slotted(*) {
|
|
32
|
-
font-weight: var(--font-bd);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
32
|
.label {
|
|
36
33
|
display: flex;
|
|
37
34
|
width: 100%;
|
|
@@ -46,34 +43,6 @@
|
|
|
46
43
|
text-align: left;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
::slotted([data-text]) {
|
|
50
|
-
display: inline-flex;
|
|
51
|
-
flex-direction: column;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* Trick to prevent layout shifts on font-weight changes.
|
|
55
|
-
The trick is to put an hidden copy of the text already set to bold,
|
|
56
|
-
so the needed space is correctly calculated before any hover/active state changes the
|
|
57
|
-
font-weight of the real text.
|
|
58
|
-
The hidden text has an height of 0px so it can expand the width without changing the height
|
|
59
|
-
when placed below the real text using `flex-direction: column`. */
|
|
60
|
-
::slotted([data-text])::after {
|
|
61
|
-
overflow: hidden;
|
|
62
|
-
height: 0;
|
|
63
|
-
content: attr(data-text);
|
|
64
|
-
content: attr(data-text) / "";
|
|
65
|
-
font-weight: var(--font-bd);
|
|
66
|
-
pointer-events: none;
|
|
67
|
-
user-select: none;
|
|
68
|
-
visibility: hidden;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@media speech {
|
|
72
|
-
::slotted([data-text])::after {
|
|
73
|
-
display: none;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
46
|
.label ::slotted(*) {
|
|
78
47
|
width: 100%;
|
|
79
48
|
margin: 0;
|
|
@@ -88,7 +57,7 @@ when placed below the real text using `flex-direction: column`. */
|
|
|
88
57
|
|
|
89
58
|
.label z-icon {
|
|
90
59
|
margin-left: calc(var(--space-unit) * 4);
|
|
91
|
-
fill:
|
|
60
|
+
fill: currentcolor;
|
|
92
61
|
}
|
|
93
62
|
|
|
94
63
|
.items {
|
|
@@ -117,8 +86,6 @@ when placed below the real text using `flex-direction: column`. */
|
|
|
117
86
|
color: var(--color-secondary01);
|
|
118
87
|
}
|
|
119
88
|
|
|
120
|
-
.items > ::slotted([slot="item"]:hover)
|
|
121
|
-
.items > ::slotted([slot="item"][active]) {
|
|
89
|
+
.items > ::slotted([slot="item"]:hover) {
|
|
122
90
|
color: var(--color-secondary01);
|
|
123
|
-
font-weight: var(--font-bd);
|
|
124
91
|
}
|
|
@@ -15,44 +15,26 @@ export class ZOffcanvas {
|
|
|
15
15
|
this.open = false;
|
|
16
16
|
/** open content transitioning in a specified direction left | right. Default: left */
|
|
17
17
|
this.transitiondirection = TransitionDirection.LEFT;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.handleOpenStatus();
|
|
18
|
+
/** allows you to skip the entry animation on page load, to be used with the open prop at true */
|
|
19
|
+
this.skipanimationonload = false;
|
|
21
20
|
}
|
|
22
21
|
onOpenChanged() {
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
handleOpenStatus() {
|
|
27
|
-
if (this.open) {
|
|
28
|
-
this.hostElement.style.opacity = "0";
|
|
29
|
-
this.hostElement.style.display = "flex";
|
|
30
|
-
if (this.variant === OffCanvasVariant.OVERLAY) {
|
|
31
|
-
document.body.style.overflowY = "hidden";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else if (this.variant === OffCanvasVariant.PUSHCONTENT) {
|
|
35
|
-
this.hostElement.style.display = "none";
|
|
36
|
-
document.body.style.overflowX = "hidden";
|
|
22
|
+
if (!this.open && this.hostElement.hasAttribute("skipanimationonload")) {
|
|
23
|
+
this.hostElement.removeAttribute("skipanimationonload");
|
|
37
24
|
}
|
|
25
|
+
if (this.open)
|
|
26
|
+
this.handleOverflowProperty();
|
|
27
|
+
this.canvasOpenStatusChanged.emit(this.open);
|
|
38
28
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
else if (this.variant === OffCanvasVariant.OVERLAY) {
|
|
44
|
-
this.hostElement.style.display = "none";
|
|
45
|
-
document.body.style.overflowX = "initial";
|
|
46
|
-
document.body.style.overflowY = "initial";
|
|
47
|
-
}
|
|
29
|
+
handleOverflowProperty() {
|
|
30
|
+
const overflow = this.variant === OffCanvasVariant.OVERLAY ? "overflow-y" : "overflow-x";
|
|
31
|
+
document.body.style[overflow] = this.open ? "hidden" : "";
|
|
48
32
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.hostElement.style.opacity = "1";
|
|
52
|
-
}
|
|
33
|
+
handledTransitionEnd() {
|
|
34
|
+
this.handleOverflowProperty();
|
|
53
35
|
}
|
|
54
36
|
render() {
|
|
55
|
-
return (h(Host, null, h("div", { class: "canvas-container",
|
|
37
|
+
return (h(Host, null, h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handledTransitionEnd() }, h("div", { role: "presentation", class: "canvas-content" }, h("slot", { name: "canvasContent" }))), this.variant == OffCanvasVariant.OVERLAY && (h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
|
|
56
38
|
}
|
|
57
39
|
static get is() { return "z-offcanvas"; }
|
|
58
40
|
static get encapsulation() { return "scoped"; }
|
|
@@ -131,6 +113,24 @@ export class ZOffcanvas {
|
|
|
131
113
|
"attribute": "transitiondirection",
|
|
132
114
|
"reflect": true,
|
|
133
115
|
"defaultValue": "TransitionDirection.LEFT"
|
|
116
|
+
},
|
|
117
|
+
"skipanimationonload": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "boolean",
|
|
122
|
+
"resolved": "boolean",
|
|
123
|
+
"references": {}
|
|
124
|
+
},
|
|
125
|
+
"required": false,
|
|
126
|
+
"optional": false,
|
|
127
|
+
"docs": {
|
|
128
|
+
"tags": [],
|
|
129
|
+
"text": "allows you to skip the entry animation on page load, to be used with the open prop at true"
|
|
130
|
+
},
|
|
131
|
+
"attribute": "skipanimationonload",
|
|
132
|
+
"reflect": false,
|
|
133
|
+
"defaultValue": "false"
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
--z-offcanvas--container-width: 375px;
|
|
3
3
|
--z-offcanvas--top-space: 0;
|
|
4
4
|
|
|
5
|
-
display: none;
|
|
6
5
|
min-width: 100%;
|
|
7
6
|
height: 100%;
|
|
8
|
-
justify-content: end;
|
|
9
7
|
font-family: var(--font-family-sans);
|
|
10
8
|
font-weight: var(--font-rg);
|
|
9
|
+
visibility: hidden;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
.canvas-container {
|
|
@@ -18,41 +17,15 @@
|
|
|
18
17
|
height: 100%;
|
|
19
18
|
flex-direction: column;
|
|
20
19
|
background: var(--color-surface01);
|
|
21
|
-
transform: translateX(100%);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@keyframes enter-right {
|
|
25
|
-
from {
|
|
26
|
-
transform: translateX(100%);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
to {
|
|
30
|
-
transform: translateX(0);
|
|
31
|
-
}
|
|
32
20
|
}
|
|
33
21
|
|
|
34
|
-
:host([
|
|
35
|
-
|
|
36
|
-
animation-name: enter-right;
|
|
37
|
-
animation-timing-function: ease-out;
|
|
38
|
-
transform: translateX(0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@keyframes exit-right {
|
|
42
|
-
from {
|
|
43
|
-
transform: translateX(0);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
to {
|
|
47
|
-
transform: translateX(100%);
|
|
48
|
-
}
|
|
22
|
+
:host([variant="pushcontent"]) {
|
|
23
|
+
display: none;
|
|
49
24
|
}
|
|
50
25
|
|
|
51
|
-
:host(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
animation-timing-function: ease-out;
|
|
55
|
-
transform: translateX(100%);
|
|
26
|
+
:host([open]) {
|
|
27
|
+
display: flex;
|
|
28
|
+
visibility: visible;
|
|
56
29
|
}
|
|
57
30
|
|
|
58
31
|
:host([variant="overlay"]) {
|
|
@@ -62,9 +35,14 @@
|
|
|
62
35
|
right: 0;
|
|
63
36
|
bottom: 0;
|
|
64
37
|
left: 0;
|
|
38
|
+
display: flex;
|
|
65
39
|
height: calc(100% - var(--z-offcanvas--top-space));
|
|
66
40
|
}
|
|
67
41
|
|
|
42
|
+
:host([variant="overlay"][transitiondirection="left"]) {
|
|
43
|
+
justify-content: end;
|
|
44
|
+
}
|
|
45
|
+
|
|
68
46
|
:host([variant="overlay"]) > .canvas-container {
|
|
69
47
|
z-index: 1010;
|
|
70
48
|
}
|
|
@@ -78,48 +56,6 @@
|
|
|
78
56
|
opacity: 0.7;
|
|
79
57
|
}
|
|
80
58
|
|
|
81
|
-
:host([transitiondirection="right"]) {
|
|
82
|
-
justify-content: start;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
:host([transitiondirection="right"]) > .canvas-container {
|
|
86
|
-
transform: translateX(-100%);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@keyframes enter-left {
|
|
90
|
-
from {
|
|
91
|
-
transform: translateX(-100%);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
to {
|
|
95
|
-
transform: translateX(0);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
:host([transitiondirection="right"][open]) > .canvas-container {
|
|
100
|
-
animation-duration: 0.4s;
|
|
101
|
-
animation-name: enter-left;
|
|
102
|
-
animation-timing-function: ease-out;
|
|
103
|
-
transform: translateX(0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@keyframes exit-left {
|
|
107
|
-
from {
|
|
108
|
-
transform: translateX(0);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
to {
|
|
112
|
-
transform: translateX(-100%);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
:host(:not([open])[variant="overlay"][transitiondirection="right"]) > .canvas-container {
|
|
117
|
-
animation-duration: 0.4s;
|
|
118
|
-
animation-name: exit-left;
|
|
119
|
-
animation-timing-function: ease-out;
|
|
120
|
-
transform: translateX(-100%);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
59
|
.canvas-container > .canvas-content {
|
|
124
60
|
overflow: auto;
|
|
125
61
|
flex: 1 auto;
|
|
@@ -133,6 +69,7 @@
|
|
|
133
69
|
margin: calc(var(--space-unit) * 2) calc(var(--space-unit) / 2) 0 0;
|
|
134
70
|
}
|
|
135
71
|
|
|
72
|
+
/* Webkit Scrollbar */
|
|
136
73
|
.canvas-container .canvas-content::-webkit-scrollbar {
|
|
137
74
|
width: 10px;
|
|
138
75
|
background: linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);
|
|
@@ -158,6 +95,17 @@
|
|
|
158
95
|
scrollbar-color: var(--color-primary01) transparent;
|
|
159
96
|
}
|
|
160
97
|
|
|
98
|
+
/* Mobile */
|
|
99
|
+
@media only screen and (max-width: 768px) {
|
|
100
|
+
:host([open][transitiondirection="left"]:not([skipAnimationOnLoad])) > .canvas-container {
|
|
101
|
+
animation: enter-right 0.4s ease-out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:host([open][transitiondirection="right"]:not([skipAnimationOnLoad])) > .canvas-container {
|
|
105
|
+
animation: enter-left 0.4s ease-out;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
161
109
|
/* Tablet / Desktop */
|
|
162
110
|
@media only screen and (min-width: 768px) {
|
|
163
111
|
:host {
|
|
@@ -172,20 +120,63 @@
|
|
|
172
120
|
min-height: calc(var(--space-unit) * 40);
|
|
173
121
|
}
|
|
174
122
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
123
|
+
:host(:not([variant="overlay"])[open]:not([skipAnimationOnLoad])) {
|
|
124
|
+
width: auto;
|
|
125
|
+
animation: grow 0.4s ease-out;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ANIMATION */
|
|
179
130
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
131
|
+
@keyframes grow {
|
|
132
|
+
from {
|
|
133
|
+
width: 0;
|
|
183
134
|
}
|
|
184
135
|
|
|
185
|
-
|
|
186
|
-
width:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
136
|
+
to {
|
|
137
|
+
width: max(var(--z-offcanvas--container-width), 375px);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@keyframes enter-left {
|
|
142
|
+
from {
|
|
143
|
+
transform: translateX(-100%);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
to {
|
|
147
|
+
transform: translateX(0);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@keyframes enter-right {
|
|
152
|
+
from {
|
|
153
|
+
transform: translateX(100%);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
to {
|
|
157
|
+
transform: translateX(0);
|
|
190
158
|
}
|
|
191
159
|
}
|
|
160
|
+
|
|
161
|
+
:host([open][variant="overlay"][transitiondirection="left"]:not([skipAnimationOnLoad])) > .canvas-container {
|
|
162
|
+
animation: enter-right 0.4s ease-out;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([open][transitiondirection="right"]:not([skipAnimationOnLoad])) > .canvas-container {
|
|
166
|
+
animation: enter-left 0.4s ease-out;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host(:not([open])[variant="overlay"][transitiondirection="right"]) > .canvas-container {
|
|
170
|
+
transform: translateX(-100%);
|
|
171
|
+
transition: visibility 0.4s ease-out, transform 0.4s ease-out;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
:host(:not([open])[variant="overlay"][transitiondirection="left"]) > .canvas-container {
|
|
175
|
+
transform: translateX(100%);
|
|
176
|
+
transition: visibility 0.4s ease-out, transform 0.4s ease-out;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
:host(:not([open])[variant="overlay"]) .canvas-background {
|
|
180
|
+
transition: visibility 0.4s ease-out;
|
|
181
|
+
visibility: hidden;
|
|
182
|
+
}
|