@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
|
@@ -48,21 +48,15 @@ const ZModal = class {
|
|
|
48
48
|
this.closeButtonLabel = "chiudi modale";
|
|
49
49
|
/** add role "alertdialog" to dialog (optional, default is false) */
|
|
50
50
|
this.alertdialog = false;
|
|
51
|
-
/** if true, the modal is closable (optional, default is true) */
|
|
52
|
-
this.closable = true;
|
|
53
51
|
}
|
|
54
52
|
emitModalClose() {
|
|
55
|
-
|
|
56
|
-
this.modalClose.emit({ modalid: this.modalid });
|
|
57
|
-
}
|
|
53
|
+
this.modalClose.emit({ modalid: this.modalid });
|
|
58
54
|
}
|
|
59
55
|
emitModalHeaderActive() {
|
|
60
56
|
this.modalHeaderActive.emit({ modalid: this.modalid });
|
|
61
57
|
}
|
|
62
58
|
emitBackgroundClick() {
|
|
63
|
-
|
|
64
|
-
this.modalBackgroundClick.emit({ modalid: this.modalid });
|
|
65
|
-
}
|
|
59
|
+
this.modalBackgroundClick.emit({ modalid: this.modalid });
|
|
66
60
|
}
|
|
67
61
|
componentDidLoad() {
|
|
68
62
|
this.open();
|
|
@@ -75,9 +69,7 @@ const ZModal = class {
|
|
|
75
69
|
/** close modal */
|
|
76
70
|
async close() {
|
|
77
71
|
var _a;
|
|
78
|
-
|
|
79
|
-
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
|
|
80
|
-
}
|
|
72
|
+
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
|
|
81
73
|
}
|
|
82
74
|
/**
|
|
83
75
|
* Get a list of focusable elements in the dialog.
|
|
@@ -112,20 +104,8 @@ const ZModal = class {
|
|
|
112
104
|
firstFocusableElement.focus();
|
|
113
105
|
}
|
|
114
106
|
}
|
|
115
|
-
closeButtonSlot() {
|
|
116
|
-
if (this.closable) {
|
|
117
|
-
return (index.h("slot", { name: "modalCloseButton" }, index.h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, index.h("z-icon", { name: "multiply-circle-filled" }))));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
handleEscape(e) {
|
|
121
|
-
if (this.closable)
|
|
122
|
-
return;
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
}
|
|
125
107
|
render() {
|
|
126
|
-
return (index.h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose(),
|
|
127
|
-
// @ts-ignore
|
|
128
|
-
onCancel: (e) => this.handleEscape(e) }, index.h("div", { class: "modal-container", id: this.modalid }, index.h("header", { onClick: this.emitModalHeaderActive.bind(this) }, index.h("div", null, this.modaltitle && index.h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && index.h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), this.closeButtonSlot()), index.h("div", { class: "modal-content", id: "modal-content" }, index.h("slot", { name: "modalContent" }))), index.h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
|
|
108
|
+
return (index.h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose() }, index.h("div", { class: "modal-container", id: this.modalid }, index.h("header", { onClick: this.emitModalHeaderActive.bind(this) }, index.h("div", null, this.modaltitle && index.h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && index.h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), index.h("slot", { name: "modalCloseButton" }, index.h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, index.h("z-icon", { name: "multiply-circle-filled" })))), index.h("div", { class: "modal-content", id: "modal-content" }, index.h("slot", { name: "modalContent" }))), index.h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
|
|
129
109
|
this.emitBackgroundClick();
|
|
130
110
|
this.close();
|
|
131
111
|
} })));
|
|
@@ -198,7 +198,7 @@ const ZListElement = class {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
render() {
|
|
201
|
-
return (index.h(index.Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, index.h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}
|
|
201
|
+
return (index.h(index.Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, index.h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}` }, index.h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === index$1.ListDividerType.ELEMENT && (index.h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
|
|
202
202
|
}
|
|
203
203
|
get host() { return index.getElement(this); }
|
|
204
204
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3299e0a.js');
|
|
6
6
|
|
|
7
|
-
const stylesCss = ":host{display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:0;font-family:var(--font-family-sans)}:host,::slotted(*),*{box-sizing:border-box}::slotted(a){text-decoration:none}::slotted(*){color:var(--color-text01);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host(
|
|
7
|
+
const stylesCss = ":host{display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center;padding:0;font-family:var(--font-family-sans)}:host,::slotted(*),*{box-sizing:border-box}::slotted(a){text-decoration:none}::slotted(*){color:var(--color-text01);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host([active]) .label,:host([open]) .label,.label:hover{border-color:var(--color-secondary01)}.label{display:flex;width:100%;align-items:center;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5);border:0;border-bottom:var(--border-size-small) solid var(--color-surface05);margin:0;background:transparent;border-radius:0;cursor:pointer;text-align:left}.label ::slotted(*){width:100%;margin:0;font-size:var(--font-size-3);line-height:1.25}.label:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.label z-icon{margin-left:calc(var(--space-unit) * 4);fill:currentcolor}.items{display:flex;width:100%;flex-direction:column;padding:calc(var(--space-unit) * 0.5);padding-bottom:calc(var(--space-unit) * 2)}.items>::slotted([slot=\"item\"]){display:inline-flex;padding:calc(var(--space-unit) * 0.5);margin:0;font-size:var(--font-size-2);line-height:1.4;outline:none}.items>::slotted([slot=\"item\"]:last-child){padding-bottom:0}.items>::slotted([slot=\"item\"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary);color:var(--color-secondary01)}.items>::slotted([slot=\"item\"]:hover){color:var(--color-secondary01)}";
|
|
8
8
|
|
|
9
9
|
const ZMenuSection = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -31,21 +31,13 @@ const ZMenuSection = class {
|
|
|
31
31
|
* Check if some content slot is set.
|
|
32
32
|
*/
|
|
33
33
|
checkContent() {
|
|
34
|
-
this.hasContent = this.hostElement.querySelectorAll('[slot="item"]').length
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
|
|
38
|
-
* @param ev Slotchange event
|
|
39
|
-
*/
|
|
40
|
-
onLabelSlotChange(ev) {
|
|
41
|
-
const labelElement = ev.target.assignedElements()[0];
|
|
42
|
-
labelElement.dataset.text = (labelElement === null || labelElement === void 0 ? void 0 : labelElement.innerText) || null;
|
|
34
|
+
this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length;
|
|
43
35
|
}
|
|
44
36
|
componentWillLoad() {
|
|
45
37
|
this.checkContent();
|
|
46
38
|
}
|
|
47
39
|
render() {
|
|
48
|
-
return (index.h(index.Host, { role: "menu", open: this.open }, index.h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, index.h("slot",
|
|
40
|
+
return (index.h(index.Host, { role: "menu", open: this.open }, index.h("button", { class: "label", "aria-pressed": this.open ? "true" : "false", onClick: this.toggle.bind(this) }, index.h("slot", null), this.hasContent && index.h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" })), this.open && (index.h("div", { class: "items" }, index.h("slot", { name: "item", onSlotchange: this.checkContent.bind(this) })))));
|
|
49
41
|
}
|
|
50
42
|
get hostElement() { return index.getElement(this); }
|
|
51
43
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3299e0a.js');
|
|
6
6
|
|
|
7
|
-
const stylesCss = ":host,::slotted(*),*{box-sizing:border-box}:host{position:relative;display:inline-flex;flex-direction:column}::slotted(a){text-decoration:none}::slotted(*){
|
|
7
|
+
const stylesCss = ":host,::slotted(*),*{box-sizing:border-box}:host{position:relative;display:inline-flex;flex-direction:column}::slotted(a){color:var(--color-text01);text-decoration:none}::slotted(*){font-family:var(--font-family-sans);font-weight:var(--font-rg)}.menu-label{padding:0;border:0;margin:0;background:transparent;border-radius:0;color:inherit;outline:none;text-align:left}button.menu-label{cursor:pointer}.menu-label:focus-within{z-index:1;padding-right:calc(var(--space-unit) * 0.5);padding-left:calc(var(--space-unit) * 0.5);margin-right:calc(var(--space-unit) * -0.5);margin-left:calc(var(--space-unit) * -0.5);box-shadow:var(--shadow-focus-primary)}.menu-label .menu-label-content{display:flex;align-items:center;padding:var(--space-unit) 0;border-bottom:var(--border-size-large) solid var(--color-surface05)}:host([active]) .menu-label-content,:host([open]) .menu-label-content,.menu-label:hover .menu-label-content,.menu-label:focus-within .menu-label-content{border-color:var(--color-secondary01)}.menu-label ::slotted(*){width:100%;margin:0;appearance:none;font-size:var(--font-size-5);line-height:1.2;outline:none}.menu-label z-icon{margin-left:calc(var(--space-unit) * 4);fill:currentcolor}.content{background:var(--color-surface01)}.content[hidden]{display:none}:host([floating]) .content{position:absolute;top:100%;left:0;width:375px;min-width:100%;max-width:100vw;padding:var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2);box-shadow:var(--shadow-2)}:host(:not([floating])) .content{width:100%}.header{display:flex;align-items:center;padding:var(--space-unit) 0 calc(var(--space-unit) * 2)}.header ::slotted(img[slot=\"header\"]){width:calc(var(--space-unit) * 11.25);height:auto;object-fit:contain}.header ::slotted([slot=\"header\"]:not(:first-child)){margin:auto 0;margin-left:calc(var(--space-unit) * 2.5);font-size:var(--font-size-3);font-weight:var(--font-sb);line-height:1.5}.items{display:flex;flex-direction:column;align-items:flex-start;background:inherit}.items>::slotted([slot=\"item\"]){display:inline-flex;width:100%;margin:0;font-size:var(--font-size-3);line-height:1.25;outline:none}.items>::slotted([slot=\"item\"]:focus:focus-visible){box-shadow:var(--shadow-focus-primary)}.items>::slotted([slot=\"item\"]:not(z-menu-section)){padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5);border-bottom:var(--border-size-small) solid var(--color-surface05)}.items>::slotted([slot=\"item\"]:hover),.items>::slotted([slot=\"item\"]:active){border-color:var(--color-secondary01)}";
|
|
8
8
|
|
|
9
9
|
const ZMenu = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -15,18 +15,16 @@ const ZMenu = class {
|
|
|
15
15
|
* Flag to set the display mode of the list.
|
|
16
16
|
* If true, the list will be absolutely positioned under the menu label,
|
|
17
17
|
* stacked beneath it otherwise.
|
|
18
|
+
* @default false
|
|
18
19
|
*/
|
|
19
20
|
this.floating = false;
|
|
20
|
-
/** The opening state of the menu. */
|
|
21
|
-
this.open = false;
|
|
22
21
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* The opening state of the menu.
|
|
23
|
+
* @default false
|
|
25
24
|
*/
|
|
26
|
-
this.
|
|
25
|
+
this.open = false;
|
|
27
26
|
this.toggle = this.toggle.bind(this);
|
|
28
27
|
this.checkContent = this.checkContent.bind(this);
|
|
29
|
-
this.onLabelSlotChange = this.onLabelSlotChange.bind(this);
|
|
30
28
|
this.onItemsChange = this.onItemsChange.bind(this);
|
|
31
29
|
}
|
|
32
30
|
toggle() {
|
|
@@ -56,14 +54,6 @@ const ZMenu = class {
|
|
|
56
54
|
componentWillLoad() {
|
|
57
55
|
this.checkContent();
|
|
58
56
|
}
|
|
59
|
-
/**
|
|
60
|
-
* Sets slotted item text as `data-text` attribute value, to let CSS use it through `attr()`.
|
|
61
|
-
* @param ev Slotchange event
|
|
62
|
-
*/
|
|
63
|
-
onLabelSlotChange(ev) {
|
|
64
|
-
const labelElement = ev.target.assignedElements()[0];
|
|
65
|
-
labelElement.dataset.text = labelElement === null || labelElement === void 0 ? void 0 : labelElement.textContent;
|
|
66
|
-
}
|
|
67
57
|
/**
|
|
68
58
|
* Correctly set position of the floating menu in order to prevent overflow.
|
|
69
59
|
* @param live Should run the method on every refresh frame.
|
|
@@ -85,29 +75,27 @@ const ZMenu = class {
|
|
|
85
75
|
* Check if some content slot is set.
|
|
86
76
|
*/
|
|
87
77
|
checkContent() {
|
|
88
|
-
this.hasHeader = !!this.hostElement.querySelectorAll(
|
|
89
|
-
this.hasContent = !!this.hostElement.querySelectorAll(
|
|
78
|
+
this.hasHeader = !!this.hostElement.querySelectorAll('[slot="header"]').length;
|
|
79
|
+
this.hasContent = !!this.hostElement.querySelectorAll('[slot="item"]').length || this.hasHeader;
|
|
90
80
|
}
|
|
91
81
|
/**
|
|
92
82
|
* Set `menuitem` role to all menu items.
|
|
93
|
-
* Set the item's inner text to the `data-text` attribute (this is for using bold text avoiding layout shifts).
|
|
94
83
|
*/
|
|
95
84
|
onItemsChange() {
|
|
96
85
|
this.checkContent();
|
|
97
|
-
const items = this.hostElement.querySelectorAll(
|
|
98
|
-
items.forEach((item) =>
|
|
99
|
-
item.setAttribute("role", "menuitem");
|
|
100
|
-
item.dataset.text = item.textContent;
|
|
101
|
-
});
|
|
86
|
+
const items = this.hostElement.querySelectorAll('[slot="item"]');
|
|
87
|
+
items === null || items === void 0 ? void 0 : items.forEach((item) => item.setAttribute("role", "menuitem"));
|
|
102
88
|
}
|
|
103
89
|
renderMenuLabel() {
|
|
104
90
|
if (this.hasContent) {
|
|
105
|
-
return (index.h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, index.h("div", { class: "menu-label-content" }, index.h("slot",
|
|
91
|
+
return (index.h("button", { class: "menu-label", "aria-expanded": this.open ? "true" : "false", "aria-label": this.open ? "Chiudi menù" : "Apri menù", onClick: this.toggle }, index.h("div", { class: "menu-label-content" }, index.h("slot", null), index.h("z-icon", { name: this.open ? "chevron-up" : "chevron-down" }))));
|
|
106
92
|
}
|
|
107
|
-
return (index.h("div", { class: "menu-label" }, index.h("div", { class: "menu-label-content" }, index.h("slot",
|
|
93
|
+
return (index.h("div", { class: "menu-label" }, index.h("div", { class: "menu-label-content" }, index.h("slot", null))));
|
|
108
94
|
}
|
|
109
95
|
render() {
|
|
110
|
-
return (index.h(index.Host, null, this.renderMenuLabel(),
|
|
96
|
+
return (index.h(index.Host, null, this.renderMenuLabel(), index.h("div", { class: "content", ref: (el) => {
|
|
97
|
+
this.content = el;
|
|
98
|
+
}, hidden: !this.open }, this.hasHeader && (index.h("header", { class: "header" }, index.h("slot", { name: "header", onSlotchange: this.checkContent }))), index.h("div", { class: "items", role: "menu" }, index.h("slot", { name: "item", onSlotchange: this.onItemsChange })))));
|
|
111
99
|
}
|
|
112
100
|
get hostElement() { return index.getElement(this); }
|
|
113
101
|
static get watchers() { return {
|
|
@@ -7,7 +7,7 @@ const index$1 = require('./index-7a9a8430.js');
|
|
|
7
7
|
const utils = require('./utils-305151da.js');
|
|
8
8
|
require('./breakpoints-88c4fd6c.js');
|
|
9
9
|
|
|
10
|
-
const stylesCss = ":host{position:relative;z-index:5;display:block;width:inherit;height:44px;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>div{position:absolute;z-index:10;display:grid;width:100%;gap:0 calc(var(--space-unit) * 2);grid-template-columns:auto;grid-template-rows:auto}:host>div.has-submit{grid-template-columns:auto min-content}:host>div.has-results{grid-template-rows:auto auto}:host>div>z-input{width:100%;grid-column:1;grid-row:1}:host>div>z-button{grid-column:2;grid-row:1}:host>div>div.results-wrapper{overflow:auto;padding:calc(var(--space-unit) / 4);padding-bottom:calc(var(--space-unit) / 4);border:var(--border-size-small) solid var(--color-surface03);border-top:none;margin-top:-1px;background:var(--color-surface01);grid-column:1;grid-row:2}:host>div>div.results-wrapper>div.results{overflow:auto;max-height:var(--z-searchbar-results-height, 540px);padding:var(--space-unit) calc(var(--space-unit) * 1.5);padding-bottom:calc(var(--space-unit) / 2);scrollbar-color:var(--color-primary01) transparent}:host>div>div.results-wrapper>div.results::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-track{background-color:transparent}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}:host>div>div.results-wrapper>div.results .category-heading{display:block;font-size:var(--font-size-2);font-weight:var(--font-rg);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .category-heading>*{display:block}:host>div>div.results-wrapper>div.results span.category-heading>span.category{color:var(--color-text05);font-style:italic}:host>div>div.results-wrapper>div.results span.category-heading>span.subcategory{margin-top:8px;color:var(--color-text01);text-transform:uppercase}:host>div>div.results-wrapper>div.results z-list-element{display:block}:host>div>div.results-wrapper>div.results z-list-element:focus{box-shadow:var(--shadow-focus-primary)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;display:flex;flex-flow:row nowrap;align-content:stretch;align-items:flex-start;justify-content:flex-start;color:var(--color-text01);fill:var(--color-icon02);font-size:var(--font-size-2);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host>div>div.results-wrapper>div.results .item>span.item-label>mark,:host>div>div.results-wrapper>div.results .item>span.item-label>*>mark{background:var(--color-primary03)}:host>div>div.results-wrapper>div.results .item.has-category{padding-left:calc(var(--space-unit) * 3)}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:2px 0;margin-right:calc(var(--space-unit) * 1.5)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:16px;--z-icon-width:16px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-right:var(--space-unit)}:host>div>div.results-wrapper>div.results .item-show-all{display:block;text-align:center}:host>div>div.results-wrapper>div.results .item-no-results{display:block;font-size:var(--font-size-2);font-style:italic;line-height:var(--font-size-5)}:host>div>div.results-wrapper>div.results .item-no-results>ul{padding-left:calc(var(--space-unit) * 2);margin:var(--space-unit)}@media (min-width: 768px){:host>div>div.results-wrapper>div.results .category-heading{font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:18px;--z-icon-width:18px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-top:calc(var(--space-unit) / 4)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{height:24px}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:6px 0}}@media (min-width: 1152px){:host>div>div.results-wrapper>div.results .item{cursor:pointer}:host>div>div.results-wrapper>div.results .item-no-results{cursor:default;font-size:var(--font-size-3);line-height:var(--font-size-6)}}
|
|
10
|
+
const stylesCss = ":host{position:relative;z-index:5;display:block;width:inherit;height:44px;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>div{position:absolute;z-index:10;display:grid;width:100%;gap:0 calc(var(--space-unit) * 2);grid-template-columns:auto;grid-template-rows:auto}:host>div.has-submit{grid-template-columns:auto min-content}:host>div.has-results{grid-template-rows:auto auto}:host>div>z-input{width:100%;grid-column:1;grid-row:1}:host>div>z-button{grid-column:2;grid-row:1}:host>div>div.results-wrapper{overflow:auto;padding:calc(var(--space-unit) / 4);padding-bottom:calc(var(--space-unit) / 4);border:var(--border-size-small) solid var(--color-surface03);border-top:none;margin-top:-1px;background:var(--color-surface01);grid-column:1;grid-row:2}:host>div>div.results-wrapper>div.results{overflow:auto;max-height:var(--z-searchbar-results-height, 540px);padding:var(--space-unit) calc(var(--space-unit) * 1.5);padding-bottom:calc(var(--space-unit) / 2);scrollbar-color:var(--color-primary01) transparent}:host>div>div.results-wrapper>div.results::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-track{background-color:transparent}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}:host>div>div.results-wrapper>div.results .category-heading{display:block;font-size:var(--font-size-2);font-weight:var(--font-rg);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .category-heading>*{display:block}:host>div>div.results-wrapper>div.results span.category-heading>span.category{color:var(--color-text05);font-style:italic}:host>div>div.results-wrapper>div.results span.category-heading>span.subcategory{margin-top:8px;color:var(--color-text01);text-transform:uppercase}:host>div>div.results-wrapper>div.results z-list-element{display:block}:host>div>div.results-wrapper>div.results z-list-element:focus{box-shadow:var(--shadow-focus-primary)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;display:flex;flex-flow:row nowrap;align-content:stretch;align-items:flex-start;justify-content:flex-start;color:var(--color-text01);fill:var(--color-icon02);font-size:var(--font-size-2);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host>div>div.results-wrapper>div.results .item>span.item-label>mark,:host>div>div.results-wrapper>div.results .item>span.item-label>*>mark{background:var(--color-primary03)}:host>div>div.results-wrapper>div.results .item.has-category{padding-left:calc(var(--space-unit) * 3)}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:2px 0;margin-right:calc(var(--space-unit) * 1.5)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:16px;--z-icon-width:16px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-right:var(--space-unit)}:host>div>div.results-wrapper>div.results .item-show-all{display:block;text-align:center}:host>div>div.results-wrapper>div.results .item-no-results{display:block;font-size:var(--font-size-2);font-style:italic;line-height:var(--font-size-5)}:host>div>div.results-wrapper>div.results .item-no-results>ul{padding-left:calc(var(--space-unit) * 2);margin:var(--space-unit)}@media (min-width: 768px){:host>div>div.results-wrapper>div.results .category-heading{font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:18px;--z-icon-width:18px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-top:calc(var(--space-unit) / 4)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{height:24px}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:6px 0}}@media (min-width: 1152px){:host>div>div.results-wrapper>div.results .item{cursor:pointer}:host>div>div.results-wrapper>div.results .item-no-results{cursor:default;font-size:var(--font-size-3);line-height:var(--font-size-6)}}";
|
|
11
11
|
|
|
12
12
|
const ZSearchbar = class {
|
|
13
13
|
constructor(hostRef) {
|
|
@@ -31,12 +31,6 @@ const ZSearchbar = class {
|
|
|
31
31
|
this.sortResultsItems = false;
|
|
32
32
|
/** Show submit button */
|
|
33
33
|
this.showSearchButton = false;
|
|
34
|
-
/** Set button icon without label*/
|
|
35
|
-
this.searchButtonIconOnly = false;
|
|
36
|
-
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
37
|
-
this.size = index$1.ControlSize.BIG;
|
|
38
|
-
/** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
|
|
39
|
-
this.variant = index$1.ButtonVariant.PRIMARY;
|
|
40
34
|
this.searchString = "";
|
|
41
35
|
this.currResultsCount = 0;
|
|
42
36
|
this.showResults = false;
|
|
@@ -149,16 +143,13 @@ const ZSearchbar = class {
|
|
|
149
143
|
renderInput() {
|
|
150
144
|
return (index.h("z-input", { ref: (val) => {
|
|
151
145
|
this.inputRef = val;
|
|
152
|
-
}, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => utils.handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value
|
|
146
|
+
}, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => utils.handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value }));
|
|
153
147
|
}
|
|
154
148
|
renderButton() {
|
|
155
149
|
if (!this.showSearchButton) {
|
|
156
150
|
return null;
|
|
157
151
|
}
|
|
158
|
-
|
|
159
|
-
const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
|
|
160
|
-
const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
|
|
161
|
-
return index.h("z-button", Object.assign({}, defaultProps), buttonLabel);
|
|
152
|
+
return (index.h("z-button", { disabled: this.preventSubmit, variant: index$1.ButtonVariant.PRIMARY, onClick: () => this.handleSubmit() }, "CERCA"));
|
|
162
153
|
}
|
|
163
154
|
renderResults() {
|
|
164
155
|
if (!this.showResults ||
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"./components/navigation/tabs/z-navigation-tab/index.js",
|
|
30
30
|
"./components/navigation/tabs/z-navigation-tab-link/index.js",
|
|
31
31
|
"./components/navigation/tabs/z-navigation-tabs/index.js",
|
|
32
|
+
"./components/navigation/z-menu/index.js",
|
|
32
33
|
"./components/navigation/z-app-header/index.js",
|
|
33
34
|
"./components/navigation/z-link/index.js",
|
|
34
|
-
"./components/navigation/z-menu/index.js",
|
|
35
35
|
"./components/navigation/z-menu-section/index.js",
|
|
36
36
|
"./components/notification/z-info-box/index.js",
|
|
37
37
|
"./components/notification/z-notification/index.js",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { ButtonVariant, ListDividerType
|
|
2
|
+
import { ButtonVariant, ListDividerType } from "../../../beans";
|
|
3
3
|
import { handleEnterKeydSubmit, randomId } from "../../../utils/utils";
|
|
4
4
|
/**
|
|
5
5
|
* @cssprop --z-searchbar-results-height - Max height of the results container (default: 540px)
|
|
@@ -22,12 +22,6 @@ export class ZSearchbar {
|
|
|
22
22
|
this.sortResultsItems = false;
|
|
23
23
|
/** Show submit button */
|
|
24
24
|
this.showSearchButton = false;
|
|
25
|
-
/** Set button icon without label*/
|
|
26
|
-
this.searchButtonIconOnly = false;
|
|
27
|
-
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
28
|
-
this.size = ControlSize.BIG;
|
|
29
|
-
/** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
|
|
30
|
-
this.variant = ButtonVariant.PRIMARY;
|
|
31
25
|
this.searchString = "";
|
|
32
26
|
this.currResultsCount = 0;
|
|
33
27
|
this.showResults = false;
|
|
@@ -140,16 +134,13 @@ export class ZSearchbar {
|
|
|
140
134
|
renderInput() {
|
|
141
135
|
return (h("z-input", { ref: (val) => {
|
|
142
136
|
this.inputRef = val;
|
|
143
|
-
}, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value
|
|
137
|
+
}, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value }));
|
|
144
138
|
}
|
|
145
139
|
renderButton() {
|
|
146
140
|
if (!this.showSearchButton) {
|
|
147
141
|
return null;
|
|
148
142
|
}
|
|
149
|
-
|
|
150
|
-
const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
|
|
151
|
-
const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
|
|
152
|
-
return h("z-button", Object.assign({}, defaultProps), buttonLabel);
|
|
143
|
+
return (h("z-button", { disabled: this.preventSubmit, variant: ButtonVariant.PRIMARY, onClick: () => this.handleSubmit() }, "CERCA"));
|
|
153
144
|
}
|
|
154
145
|
renderResults() {
|
|
155
146
|
if (!this.showResults ||
|
|
@@ -457,70 +448,6 @@ export class ZSearchbar {
|
|
|
457
448
|
"attribute": "show-search-button",
|
|
458
449
|
"reflect": false,
|
|
459
450
|
"defaultValue": "false"
|
|
460
|
-
},
|
|
461
|
-
"searchButtonIconOnly": {
|
|
462
|
-
"type": "boolean",
|
|
463
|
-
"mutable": false,
|
|
464
|
-
"complexType": {
|
|
465
|
-
"original": "boolean",
|
|
466
|
-
"resolved": "boolean",
|
|
467
|
-
"references": {}
|
|
468
|
-
},
|
|
469
|
-
"required": false,
|
|
470
|
-
"optional": true,
|
|
471
|
-
"docs": {
|
|
472
|
-
"tags": [],
|
|
473
|
-
"text": "Set button icon without label"
|
|
474
|
-
},
|
|
475
|
-
"attribute": "search-button-icon-only",
|
|
476
|
-
"reflect": false,
|
|
477
|
-
"defaultValue": "false"
|
|
478
|
-
},
|
|
479
|
-
"size": {
|
|
480
|
-
"type": "string",
|
|
481
|
-
"mutable": false,
|
|
482
|
-
"complexType": {
|
|
483
|
-
"original": "ControlSize",
|
|
484
|
-
"resolved": "ControlSize.BIG | ControlSize.SMALL | ControlSize.X_SMALL",
|
|
485
|
-
"references": {
|
|
486
|
-
"ControlSize": {
|
|
487
|
-
"location": "import",
|
|
488
|
-
"path": "../../../beans"
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
"required": false,
|
|
493
|
-
"optional": true,
|
|
494
|
-
"docs": {
|
|
495
|
-
"tags": [],
|
|
496
|
-
"text": "Available sizes: `big`, `small` and `x-small`. Defaults to `big`."
|
|
497
|
-
},
|
|
498
|
-
"attribute": "size",
|
|
499
|
-
"reflect": false,
|
|
500
|
-
"defaultValue": "ControlSize.BIG"
|
|
501
|
-
},
|
|
502
|
-
"variant": {
|
|
503
|
-
"type": "string",
|
|
504
|
-
"mutable": false,
|
|
505
|
-
"complexType": {
|
|
506
|
-
"original": "ButtonVariant",
|
|
507
|
-
"resolved": "ButtonVariant.DARK_BG | ButtonVariant.PRIMARY | ButtonVariant.SECONDARY | ButtonVariant.TERTIARY",
|
|
508
|
-
"references": {
|
|
509
|
-
"ButtonVariant": {
|
|
510
|
-
"location": "import",
|
|
511
|
-
"path": "../../../beans"
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
"required": false,
|
|
516
|
-
"optional": true,
|
|
517
|
-
"docs": {
|
|
518
|
-
"tags": [],
|
|
519
|
-
"text": "Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`."
|
|
520
|
-
},
|
|
521
|
-
"attribute": "variant",
|
|
522
|
-
"reflect": false,
|
|
523
|
-
"defaultValue": "ButtonVariant.PRIMARY"
|
|
524
451
|
}
|
|
525
452
|
};
|
|
526
453
|
}
|
|
@@ -209,26 +209,3 @@
|
|
|
209
209
|
line-height: var(--font-size-6);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
:host([size="small"]) > div > div.results-wrapper > div.results .item,
|
|
214
|
-
:host([size="x-small"]) > div > div.results-wrapper > div.results .item,
|
|
215
|
-
:host([size="small"]) > div > div.results-wrapper > div.results .category-heading,
|
|
216
|
-
:host([size="x-small"]) > div > div.results-wrapper > div.results .category-heading {
|
|
217
|
-
font-size: var(--font-size-2);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
:host([size="small"]) > div > div.results-wrapper > div.results .item:not(.has-category),
|
|
221
|
-
:host([size="x-small"]) > div > div.results-wrapper > div.results .item:not(.has-category) {
|
|
222
|
-
--z-icon-height: 16px;
|
|
223
|
-
--z-icon-width: 16px;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
:host([size="small"])::part(list-item-container) {
|
|
227
|
-
min-height: calc(var(--space-unit) * 4.5);
|
|
228
|
-
padding: 0;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
:host([size="x-small"])::part(list-item-container) {
|
|
232
|
-
min-height: calc(var(--space-unit) * 4);
|
|
233
|
-
padding: 0;
|
|
234
|
-
}
|
|
@@ -158,7 +158,7 @@ export class ZListElement {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
render() {
|
|
161
|
-
return (h(Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}
|
|
161
|
+
return (h(Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}` }, h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === ListDividerType.ELEMENT && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
|
|
162
162
|
}
|
|
163
163
|
static get is() { return "z-list-element"; }
|
|
164
164
|
static get encapsulation() { return "shadow"; }
|
|
@@ -11,21 +11,15 @@ export class ZModal {
|
|
|
11
11
|
this.closeButtonLabel = "chiudi modale";
|
|
12
12
|
/** add role "alertdialog" to dialog (optional, default is false) */
|
|
13
13
|
this.alertdialog = false;
|
|
14
|
-
/** if true, the modal is closable (optional, default is true) */
|
|
15
|
-
this.closable = true;
|
|
16
14
|
}
|
|
17
15
|
emitModalClose() {
|
|
18
|
-
|
|
19
|
-
this.modalClose.emit({ modalid: this.modalid });
|
|
20
|
-
}
|
|
16
|
+
this.modalClose.emit({ modalid: this.modalid });
|
|
21
17
|
}
|
|
22
18
|
emitModalHeaderActive() {
|
|
23
19
|
this.modalHeaderActive.emit({ modalid: this.modalid });
|
|
24
20
|
}
|
|
25
21
|
emitBackgroundClick() {
|
|
26
|
-
|
|
27
|
-
this.modalBackgroundClick.emit({ modalid: this.modalid });
|
|
28
|
-
}
|
|
22
|
+
this.modalBackgroundClick.emit({ modalid: this.modalid });
|
|
29
23
|
}
|
|
30
24
|
componentDidLoad() {
|
|
31
25
|
this.open();
|
|
@@ -38,9 +32,7 @@ export class ZModal {
|
|
|
38
32
|
/** close modal */
|
|
39
33
|
async close() {
|
|
40
34
|
var _a;
|
|
41
|
-
|
|
42
|
-
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
|
|
43
|
-
}
|
|
35
|
+
(_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
|
|
44
36
|
}
|
|
45
37
|
/**
|
|
46
38
|
* Get a list of focusable elements in the dialog.
|
|
@@ -75,20 +67,8 @@ export class ZModal {
|
|
|
75
67
|
firstFocusableElement.focus();
|
|
76
68
|
}
|
|
77
69
|
}
|
|
78
|
-
closeButtonSlot() {
|
|
79
|
-
if (this.closable) {
|
|
80
|
-
return (h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" }))));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
handleEscape(e) {
|
|
84
|
-
if (this.closable)
|
|
85
|
-
return;
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
}
|
|
88
70
|
render() {
|
|
89
|
-
return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose(),
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
onCancel: (e) => this.handleEscape(e) }, h("div", { class: "modal-container", id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), this.closeButtonSlot()), h("div", { class: "modal-content", id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
|
|
71
|
+
return (h("dialog", { "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose() }, h("div", { class: "modal-container", id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" })))), h("div", { class: "modal-content", id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: "modal-background", "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
|
|
92
72
|
this.emitBackgroundClick();
|
|
93
73
|
this.close();
|
|
94
74
|
} })));
|
|
@@ -193,24 +173,6 @@ export class ZModal {
|
|
|
193
173
|
"attribute": "alertdialog",
|
|
194
174
|
"reflect": false,
|
|
195
175
|
"defaultValue": "false"
|
|
196
|
-
},
|
|
197
|
-
"closable": {
|
|
198
|
-
"type": "boolean",
|
|
199
|
-
"mutable": false,
|
|
200
|
-
"complexType": {
|
|
201
|
-
"original": "boolean",
|
|
202
|
-
"resolved": "boolean",
|
|
203
|
-
"references": {}
|
|
204
|
-
},
|
|
205
|
-
"required": false,
|
|
206
|
-
"optional": true,
|
|
207
|
-
"docs": {
|
|
208
|
-
"tags": [],
|
|
209
|
-
"text": "if true, the modal is closable (optional, default is true)"
|
|
210
|
-
},
|
|
211
|
-
"attribute": "closable",
|
|
212
|
-
"reflect": false,
|
|
213
|
-
"defaultValue": "true"
|
|
214
176
|
}
|
|
215
177
|
};
|
|
216
178
|
}
|
|
@@ -68,6 +68,8 @@ export class ZAppHeader {
|
|
|
68
68
|
* - auto: the menu bar is positioned near the title
|
|
69
69
|
* - stack: the menu bar is positioned below the title
|
|
70
70
|
* - offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu
|
|
71
|
+
*
|
|
72
|
+
* **Optional**
|
|
71
73
|
*/
|
|
72
74
|
this.flow = "auto";
|
|
73
75
|
/**
|
|
@@ -86,17 +88,11 @@ export class ZAppHeader {
|
|
|
86
88
|
});
|
|
87
89
|
this.openDrawer = this.openDrawer.bind(this);
|
|
88
90
|
this.closeDrawer = this.closeDrawer.bind(this);
|
|
89
|
-
this.collectMenuElements
|
|
91
|
+
this.collectMenuElements.bind(this);
|
|
90
92
|
}
|
|
91
93
|
emitStickingEvent() {
|
|
92
94
|
this.sticking.emit(this._stuck);
|
|
93
95
|
}
|
|
94
|
-
openDrawer() {
|
|
95
|
-
this.drawerOpen = true;
|
|
96
|
-
}
|
|
97
|
-
closeDrawer() {
|
|
98
|
-
this.drawerOpen = false;
|
|
99
|
-
}
|
|
100
96
|
componentDidLoad() {
|
|
101
97
|
this.collectMenuElements();
|
|
102
98
|
this.onStuckMode();
|
|
@@ -151,14 +147,19 @@ export class ZAppHeader {
|
|
|
151
147
|
return;
|
|
152
148
|
}
|
|
153
149
|
const elements = this.menuElements;
|
|
154
|
-
elements.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
150
|
+
for (let i = 0, len = elements.length; i < len; i++) {
|
|
151
|
+
elements[i].open = false;
|
|
152
|
+
elements[i].floating = !this.drawerOpen;
|
|
153
|
+
}
|
|
159
154
|
}
|
|
160
155
|
render() {
|
|
161
|
-
return (h(Host, { "menu-length": this.menuLength }, h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, h("div", { class: "hero-container" }, h("slot", { name: "hero" }, this.hero && (h("img", { alt: "", src: this.hero })))), h("div", { class: "heading-container" }, h("div", { class: "heading-title" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("slot", { name: "title" })), h("div", { class: "heading-subtitle" }, h("slot", { name: "subtitle" }))), h("div", { class: "menu-container" }, !this.drawerOpen && this.flow !== "offcanvas" && (h("slot", { name: "menu", onSlotchange: this.collectMenuElements })))), h("div", { class: "drawer-container" }, h("div", { class: "drawer-overlay", onClick: this.closeDrawer }), h("div", { class: "drawer-panel" }, h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content" }, this.drawerOpen && (h("slot", { name: "menu", onSlotchange: this.collectMenuElements }))))), this._stuck && (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("div", { class: "heading-title" }, h("slot", { name: "stucked-title" }, this.title)))))));
|
|
156
|
+
return (h(Host, { "menu-length": this.menuLength }, h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, h("div", { class: "hero-container" }, h("slot", { name: "hero" }, this.hero && (h("img", { alt: "", src: this.hero })))), h("div", { class: "heading-container" }, h("div", { class: "heading-title" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("slot", { name: "title" })), h("div", { class: "heading-subtitle" }, h("slot", { name: "subtitle" }))), h("div", { class: "menu-container" }, !this.drawerOpen && this.flow !== "offcanvas" && (h("slot", { name: "menu", onSlotchange: () => this.collectMenuElements() })))), h("div", { class: "drawer-container" }, h("div", { class: "drawer-overlay", onClick: this.closeDrawer }), h("div", { class: "drawer-panel" }, h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content" }, this.drawerOpen && (h("slot", { name: "menu", onSlotchange: () => this.collectMenuElements() }))))), this._stuck && (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("div", { class: "heading-title" }, h("slot", { name: "stucked-title" }, this.title)))))));
|
|
157
|
+
}
|
|
158
|
+
openDrawer() {
|
|
159
|
+
this.drawerOpen = true;
|
|
160
|
+
}
|
|
161
|
+
closeDrawer() {
|
|
162
|
+
this.drawerOpen = false;
|
|
162
163
|
}
|
|
163
164
|
static get is() { return "z-app-header"; }
|
|
164
165
|
static get encapsulation() { return "shadow"; }
|
|
@@ -239,7 +240,7 @@ export class ZAppHeader {
|
|
|
239
240
|
"optional": false,
|
|
240
241
|
"docs": {
|
|
241
242
|
"tags": [],
|
|
242
|
-
"text": "Control menu bar position in the header.\n- auto: the menu bar is positioned near the title\n- stack: the menu bar is positioned below the title\n- offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu"
|
|
243
|
+
"text": "Control menu bar position in the header.\n- auto: the menu bar is positioned near the title\n- stack: the menu bar is positioned below the title\n- offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu\n\n**Optional**"
|
|
243
244
|
},
|
|
244
245
|
"attribute": "flow",
|
|
245
246
|
"reflect": true,
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
--app-header-typography-11-tracking: calc(-2.2 / 1em);
|
|
39
39
|
--app-header-typography-12-tracking: calc(-2.4 / 1em);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Variable to set stuck header and drawer's top offset. Useful when something is absolutely positioned above the header.
|
|
43
|
+
*/
|
|
43
44
|
--app-header-top-offset: 48px;
|
|
44
45
|
--app-header-drawer-trigger-size: calc(var(--space-unit) * 4);
|
|
45
46
|
|