@zanichelli/albe-web-components 12.3.1-RC → 12.4.0-RC
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/dist/cjs/index-195ca522.js +18 -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 +185 -0
- package/dist/cjs/{z-dragdrop-area_2.cjs.entry.js → z-button_6.cjs.entry.js} +259 -2
- package/dist/cjs/z-chip.cjs.entry.js +1 -1
- package/dist/cjs/z-input_2.cjs.entry.js +289 -0
- package/dist/cjs/z-list_3.cjs.entry.js +270 -0
- package/dist/cjs/z-offcanvas_2.cjs.entry.js +281 -0
- package/dist/collection/components/buttons/z-chip/index.js +1 -1
- package/dist/collection/components/file-upload/z-dragdrop-area/styles.css +1 -0
- package/dist/collection/components/file-upload/z-file-upload/index.js +1 -1
- package/dist/collection/components/file-upload/z-file-upload/styles.css +11 -0
- package/dist/esm/index-4968ce56.js +18 -10
- package/dist/esm/{index-4d1853ea.js → index-df06f147.js} +1 -1
- package/dist/esm/{index-fb19ca57.js → index-e44342f3.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-2a4ef29d.js → utils-3d2372eb.js} +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header.entry.js +181 -0
- package/dist/esm/z-book-card.entry.js +1 -1
- package/dist/esm/z-breadcrumb.entry.js +1 -1
- package/dist/esm/{z-dragdrop-area_2.entry.js → z-button_6.entry.js} +258 -5
- package/dist/esm/z-chip.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +1 -1
- package/dist/esm/z-input_2.entry.js +284 -0
- package/dist/esm/z-list_3.entry.js +264 -0
- package/dist/esm/z-myz-card-info.entry.js +1 -1
- package/dist/esm/z-myz-list-item.entry.js +1 -1
- package/dist/esm/z-offcanvas_2.entry.js +276 -0
- package/dist/esm/z-pocket_3.entry.js +1 -1
- package/dist/esm/z-select.entry.js +1 -1
- package/dist/esm/z-skip-to-content.entry.js +1 -1
- package/dist/esm/z-slideshow.entry.js +1 -1
- package/dist/esm/z-table-deprecated.entry.js +2 -2
- package/dist/esm/z-table-header.entry.js +2 -2
- package/dist/esm/z-table.entry.js +2 -2
- package/dist/esm/z-toggle-switch.entry.js +1 -1
- package/dist/esm/z-tr.entry.js +2 -2
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
- package/dist/web-components-library/p-07854026.entry.js +1 -0
- package/dist/web-components-library/p-13762a32.entry.js +1 -0
- package/dist/web-components-library/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
- package/dist/web-components-library/p-1b342136.entry.js +1 -0
- package/dist/web-components-library/p-1c541078.entry.js +1 -0
- package/dist/web-components-library/p-207467d2.entry.js +1 -0
- package/dist/web-components-library/p-285ec5fc.entry.js +1 -0
- package/dist/web-components-library/{p-98badafc.js → p-28b2868e.js} +1 -1
- package/dist/web-components-library/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
- package/dist/web-components-library/p-29d45fe5.entry.js +1 -0
- package/dist/web-components-library/p-49d22e92.entry.js +1 -0
- package/dist/web-components-library/p-570e1a2e.entry.js +1 -0
- package/{www/build/p-485fd3db.entry.js → dist/web-components-library/p-6f281905.entry.js} +1 -1
- package/dist/web-components-library/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
- package/dist/web-components-library/p-8aaa0c34.entry.js +1 -0
- package/dist/web-components-library/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
- package/dist/web-components-library/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
- package/dist/web-components-library/{p-a01baa71.js → p-b921dc8d.js} +1 -1
- package/dist/web-components-library/p-d00d2e95.entry.js +1 -0
- package/dist/web-components-library/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
- package/dist/web-components-library/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
- package/dist/web-components-library/p-dc854830.entry.js +1 -0
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
- package/www/build/p-07854026.entry.js +1 -0
- package/www/build/p-13762a32.entry.js +1 -0
- package/www/build/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
- package/www/build/p-1b342136.entry.js +1 -0
- package/www/build/p-1c541078.entry.js +1 -0
- package/www/build/p-207467d2.entry.js +1 -0
- package/www/build/p-285ec5fc.entry.js +1 -0
- package/www/build/{p-98badafc.js → p-28b2868e.js} +1 -1
- package/www/build/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
- package/www/build/p-29d45fe5.entry.js +1 -0
- package/www/build/p-49d22e92.entry.js +1 -0
- package/www/build/p-4a7a94e2.css +1576 -0
- package/www/build/p-570e1a2e.entry.js +1 -0
- package/{dist/web-components-library/p-485fd3db.entry.js → www/build/p-6f281905.entry.js} +1 -1
- package/www/build/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
- package/www/build/p-8aaa0c34.entry.js +1 -0
- package/www/build/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
- package/www/build/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
- package/www/build/{p-a01baa71.js → p-b921dc8d.js} +1 -1
- package/www/build/p-ce656c1c.js +129 -0
- package/www/build/p-d00d2e95.entry.js +1 -0
- package/www/build/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
- package/www/build/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
- package/www/build/p-dc854830.entry.js +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +10 -1
- package/dist/cjs/z-app-header_11.cjs.entry.js +0 -1077
- package/dist/cjs/z-file-upload.cjs.entry.js +0 -189
- package/dist/esm/z-app-header_11.entry.js +0 -1063
- package/dist/esm/z-file-upload.entry.js +0 -185
- package/dist/web-components-library/p-03b13390.entry.js +0 -1
- package/dist/web-components-library/p-07d0e902.entry.js +0 -1
- package/dist/web-components-library/p-3327e5f0.entry.js +0 -1
- package/dist/web-components-library/p-51bfa8ba.entry.js +0 -1
- package/dist/web-components-library/p-7907bdf7.entry.js +0 -1
- package/dist/web-components-library/p-7c5ddeb0.entry.js +0 -1
- package/dist/web-components-library/p-9b0bcd43.entry.js +0 -1
- package/dist/web-components-library/p-bbd6cbca.entry.js +0 -1
- package/dist/web-components-library/p-ed42ceca.entry.js +0 -1
- package/dist/web-components-library/p-ff5a6e34.entry.js +0 -1
- package/www/build/p-03b13390.entry.js +0 -1
- package/www/build/p-07d0e902.entry.js +0 -1
- package/www/build/p-21a94605.css +0 -3
- package/www/build/p-3327e5f0.entry.js +0 -1
- package/www/build/p-51bfa8ba.entry.js +0 -1
- package/www/build/p-7907bdf7.entry.js +0 -1
- package/www/build/p-7c5ddeb0.entry.js +0 -1
- package/www/build/p-92d5fd28.js +0 -1
- package/www/build/p-9b0bcd43.entry.js +0 -1
- package/www/build/p-bbd6cbca.entry.js +0 -1
- package/www/build/p-ed42ceca.entry.js +0 -1
- package/www/build/p-ff5a6e34.entry.js +0 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-195ca522.js');
|
|
6
|
+
const index$1 = require('./index-cf9497bc.js');
|
|
7
|
+
|
|
8
|
+
const stylesCss$2 = ":host{display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}";
|
|
9
|
+
|
|
10
|
+
const ZList = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
/**
|
|
14
|
+
* [optional] Sets size of inside elements.
|
|
15
|
+
*/
|
|
16
|
+
this.size = index$1.ListSize.MEDIUM;
|
|
17
|
+
/**
|
|
18
|
+
* [optional] type of the list marker for each element
|
|
19
|
+
*/
|
|
20
|
+
this.listType = index$1.ListType.NONE;
|
|
21
|
+
/**
|
|
22
|
+
* [optional] Sets role of the element.
|
|
23
|
+
*/
|
|
24
|
+
this.role = "list";
|
|
25
|
+
}
|
|
26
|
+
setChildrenSizeType() {
|
|
27
|
+
const children = this.host.children;
|
|
28
|
+
for (let i = 0; i < children.length; i++) {
|
|
29
|
+
children[i].setAttribute("size", this.size);
|
|
30
|
+
children[i].setAttribute("list-type", this.listType);
|
|
31
|
+
children[i].setAttribute("list-element-position", (i + 1).toString());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
componentDidLoad() {
|
|
35
|
+
this.setChildrenSizeType();
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return (index.h(index.Host, null, index.h("slot", null)));
|
|
39
|
+
}
|
|
40
|
+
get host() { return index.getElement(this); }
|
|
41
|
+
};
|
|
42
|
+
ZList.style = stylesCss$2;
|
|
43
|
+
|
|
44
|
+
const stylesCss$1 = ":host{outline:none}:host>.container,:host>.container-contextual-menu{--background-color-list-element:var(--color-surface01);--background-hover-color-list-element:var(--color-surface02);--background-active-color-list-element:var(--color-surface02);display:flex;box-sizing:border-box;flex-direction:column;justify-content:center;font-family:var(--font-family-sans);font-weight:var(--font-rg);outline:none}:host([size=\"small\"])>.container{min-height:calc(var(--space-unit) * 4);padding:calc(var(--space-unit) / 2) 0}:host([size=\"medium\"])>.container{min-height:calc(var(--space-unit) * 5);padding:var(--space-unit) 0}:host([size=\"large\"])>.container{min-height:calc(var(--space-unit) * 7);padding:calc(var(--space-unit) * 2) 0}:host([size=\"x-large\"])>.container{min-height:calc(var(--space-unit) * 9);padding:calc(var(--space-unit) * 3) 0}:host([expandable])>.container,:host([expandable])>.container-contextual-menu,:host([clickable])>.container,:host([clickable])>.container-contextual-menu{cursor:pointer}:host([expandable]:hover)>.container,:host([expandable]:hover)>.container-contextual-menu,:host([clickable]:hover)>.container,:host([clickable]:hover)>.container-contextual-menu{background-color:var(--background-hover-color-list-element)}:host([expandable]:focus:focus-visible)>.container,:host([expandable]:focus:focus-visible)>.container-contextual-menu,:host([clickable]:focus:focus-visible)>.container,:host([clickable]:focus:focus-visible)>.container-contextual-menu{box-shadow:var(--shadow-focus-primary)}:host([clickable]:not([expandable]))>.container.clicked,:host([clickable]:not([expandable]))>.container-contextual-menu.clicked{box-shadow:var(--shadow-focus-primary)}:host([expandable]:active)>.container,:host([expandable]:active)>.container-contextual-menu,:host([clickable]:active)>.container,:host([clickable]:active)>.container-contextual-menu{background-color:var(--background-active-color-list-element)}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex;flex-direction:row-reverse;justify-content:space-between}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-right:var(--space-unit)}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-left:var(--space-unit)}:host>.container>.z-list-element-inner-container,:host>.container-contextual-menu>.z-list-element-inner-container{display:none}:host>.container>.z-list-element-inner-container.expanded,:host>.container-contextual-menu>.z-list-element-inner-container.expanded{display:block}:host([clickable]:hover)>.container-contextual-menu{background-color:var(--color-surface03)}.container-contextual-menu:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.z-list-content-container{display:flex;align-items:center}";
|
|
45
|
+
|
|
46
|
+
const ZListElement = class {
|
|
47
|
+
/**
|
|
48
|
+
* Constructor.
|
|
49
|
+
*/
|
|
50
|
+
constructor(hostRef) {
|
|
51
|
+
index.registerInstance(this, hostRef);
|
|
52
|
+
this.accessibleFocus = index.createEvent(this, "accessibleFocus", 7);
|
|
53
|
+
this.ariaDescendantFocus = index.createEvent(this, "ariaDescendantFocus", 7);
|
|
54
|
+
this.clickItem = index.createEvent(this, "clickItem", 7);
|
|
55
|
+
/**
|
|
56
|
+
* [optional] Align expandable button left or right.
|
|
57
|
+
*/
|
|
58
|
+
this.alignButton = index$1.ExpandableListButtonAlign.LEFT;
|
|
59
|
+
/**
|
|
60
|
+
* [optional] Sets element clickable.
|
|
61
|
+
*/
|
|
62
|
+
this.clickable = false;
|
|
63
|
+
/**
|
|
64
|
+
* [optional] Sets the divider color.
|
|
65
|
+
*/
|
|
66
|
+
this.dividerColor = "color-surface03";
|
|
67
|
+
/**
|
|
68
|
+
* [optional] Sets the position where to insert the divider.
|
|
69
|
+
*/
|
|
70
|
+
this.dividerType = index$1.ListDividerType.NONE;
|
|
71
|
+
/**
|
|
72
|
+
* [optional] Sets the divider size.
|
|
73
|
+
*/
|
|
74
|
+
this.dividerSize = index$1.DividerSize.SMALL;
|
|
75
|
+
/**
|
|
76
|
+
* [optional] Sets element as expandable.
|
|
77
|
+
*/
|
|
78
|
+
this.expandable = false;
|
|
79
|
+
/**
|
|
80
|
+
* [optional] Sets expandable style to element.
|
|
81
|
+
*/
|
|
82
|
+
this.expandableStyle = index$1.ExpandableListStyle.ACCORDION;
|
|
83
|
+
/**
|
|
84
|
+
* [optional] Sets size of inside elements.
|
|
85
|
+
*/
|
|
86
|
+
this.size = index$1.ListSize.MEDIUM;
|
|
87
|
+
/**
|
|
88
|
+
* [optional] Sets text color of the element.
|
|
89
|
+
*/
|
|
90
|
+
this.color = "none";
|
|
91
|
+
/**
|
|
92
|
+
* [optional] Sets disabled style of the element.
|
|
93
|
+
*/
|
|
94
|
+
this.disabled = false;
|
|
95
|
+
/**
|
|
96
|
+
* [optional] If is used in ZContextualMenu component
|
|
97
|
+
*/
|
|
98
|
+
this.isContextualMenu = false;
|
|
99
|
+
/**
|
|
100
|
+
* [optional] position of the list element inside the list or the group
|
|
101
|
+
*/
|
|
102
|
+
this.listElementPosition = "0";
|
|
103
|
+
/**
|
|
104
|
+
* [optional] type of the list marker for each element
|
|
105
|
+
*/
|
|
106
|
+
this.listType = index$1.ListType.NONE;
|
|
107
|
+
/**
|
|
108
|
+
* [optional] Sets element role.
|
|
109
|
+
*/
|
|
110
|
+
this.role = "listitem";
|
|
111
|
+
this.showInnerContent = false;
|
|
112
|
+
this.openElementConfig = {
|
|
113
|
+
accordion: {
|
|
114
|
+
open: "minus-circled",
|
|
115
|
+
close: "plus-circled",
|
|
116
|
+
},
|
|
117
|
+
menu: {
|
|
118
|
+
open: "chevron-up",
|
|
119
|
+
close: "chevron-down",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
this.handleClick = this.handleClick.bind(this);
|
|
123
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
124
|
+
}
|
|
125
|
+
accessibleFocusHandler(e) {
|
|
126
|
+
if (this.listElementId === e.detail) {
|
|
127
|
+
const toFocus = this.host.shadowRoot.getElementById(`z-list-element-id-${e.detail}`);
|
|
128
|
+
toFocus.focus();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Handler for click on element. If element is expandable, change state.
|
|
133
|
+
* @returns void
|
|
134
|
+
*/
|
|
135
|
+
handleClick() {
|
|
136
|
+
this.clickItem.emit(this.listElementId);
|
|
137
|
+
if (!this.expandable) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.showInnerContent = !this.showInnerContent;
|
|
141
|
+
}
|
|
142
|
+
calculateClass() {
|
|
143
|
+
if (this.isContextualMenu) {
|
|
144
|
+
return "container-contextual-menu";
|
|
145
|
+
}
|
|
146
|
+
return "container";
|
|
147
|
+
}
|
|
148
|
+
handleKeyDown(event) {
|
|
149
|
+
const expandByKey = event.code === index$1.KeyboardCode.ENTER;
|
|
150
|
+
switch (event.code) {
|
|
151
|
+
case index$1.KeyboardCode.ARROW_DOWN:
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
this.accessibleFocus.emit(this.listElementId + 1);
|
|
154
|
+
break;
|
|
155
|
+
case index$1.KeyboardCode.ARROW_UP:
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
this.accessibleFocus.emit(this.listElementId - 1);
|
|
158
|
+
break;
|
|
159
|
+
case index$1.KeyboardCode.ENTER:
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
this.clickItem.emit(this.listElementId);
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (!this.expandable || !expandByKey) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.showInnerContent = !this.showInnerContent;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Renders button to expand element.
|
|
171
|
+
* @returns expadable button
|
|
172
|
+
*/
|
|
173
|
+
renderExpandableButton() {
|
|
174
|
+
if (!this.expandable) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
return (index.h("z-icon", { name: this.showInnerContent
|
|
178
|
+
? this.openElementConfig[this.expandableStyle].open
|
|
179
|
+
: this.openElementConfig[this.expandableStyle].close }));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Renders expanded content if element is expandable.
|
|
183
|
+
* @returns expanded content
|
|
184
|
+
*/
|
|
185
|
+
renderExpandedContent() {
|
|
186
|
+
if (!this.expandable) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return (index.h("div", { class: {
|
|
190
|
+
"z-list-element-inner-container": true,
|
|
191
|
+
"expanded": this.showInnerContent,
|
|
192
|
+
} }, index.h("slot", { name: "inner-content" })));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Renders content of the z-list-element
|
|
196
|
+
* @returns list content
|
|
197
|
+
*/
|
|
198
|
+
renderContent() {
|
|
199
|
+
if (this.listType === index$1.ListType.NONE) {
|
|
200
|
+
return index.h("slot", null);
|
|
201
|
+
}
|
|
202
|
+
if (this.listType === index$1.ListType.ORDERED) {
|
|
203
|
+
return (index.h("div", { class: "z-list-content-container" }, index.h("div", null, this.listElementPosition, ".\u2003"), index.h("slot", null)));
|
|
204
|
+
}
|
|
205
|
+
if (this.listType === index$1.ListType.UNORDERED) {
|
|
206
|
+
return (index.h("div", { class: "z-list-content-container" }, index.h("span", null, "\u2022\u2003"), index.h("slot", null)));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
render() {
|
|
210
|
+
return (index.h(index.Host, { "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onFocus: () => this.ariaDescendantFocus.emit(this.listElementId), 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}`, part: "list-item-container" }, 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 }))));
|
|
211
|
+
}
|
|
212
|
+
get host() { return index.getElement(this); }
|
|
213
|
+
};
|
|
214
|
+
ZListElement.style = stylesCss$1;
|
|
215
|
+
|
|
216
|
+
const stylesCss = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.z-list-group-header-container{color:var(--gray700);font-size:var(--font-size-2);font-weight:var(--font-sb) !important;letter-spacing:0.16px;line-height:1.4}:host>.z-list-group-header-container.has-header{padding-top:var(--space-unit);padding-bottom:var(--space-unit)}:host>.z-list-group-header-container.has-header>z-divider{margin-top:var(--space-unit)}";
|
|
217
|
+
|
|
218
|
+
const ZListGroup = class {
|
|
219
|
+
constructor(hostRef) {
|
|
220
|
+
index.registerInstance(this, hostRef);
|
|
221
|
+
/**
|
|
222
|
+
* [optional] Sets size of inside elements.
|
|
223
|
+
*/
|
|
224
|
+
this.size = index$1.ListSize.MEDIUM;
|
|
225
|
+
/**
|
|
226
|
+
* [optional] Sets the position where to insert the divider.
|
|
227
|
+
*/
|
|
228
|
+
this.dividerType = index$1.ListDividerType.NONE;
|
|
229
|
+
/**
|
|
230
|
+
* [optional] Sets the divider size.
|
|
231
|
+
*/
|
|
232
|
+
this.dividerSize = index$1.DividerSize.SMALL;
|
|
233
|
+
/**
|
|
234
|
+
* [optional] Sets the divider color.
|
|
235
|
+
*/
|
|
236
|
+
this.dividerColor = "gray200";
|
|
237
|
+
/**
|
|
238
|
+
* [optional] type of the list marker for each element
|
|
239
|
+
*/
|
|
240
|
+
this.listType = index$1.ListType.NONE;
|
|
241
|
+
}
|
|
242
|
+
componentDidLoad() {
|
|
243
|
+
const children = this.host.children;
|
|
244
|
+
for (let i = 0; i < children.length; i++) {
|
|
245
|
+
if (children.length - 1 > i) {
|
|
246
|
+
children[i].setAttribute("divider-type", this.dividerType);
|
|
247
|
+
children[i].setAttribute("divider-size", this.dividerSize);
|
|
248
|
+
children[i].setAttribute("divider-color", this.dividerColor);
|
|
249
|
+
}
|
|
250
|
+
children[i].setAttribute("size", this.size);
|
|
251
|
+
children[i].setAttribute("list-type", this.listType);
|
|
252
|
+
children[i].setAttribute("list-element-position", i.toString());
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
componentWillLoad() {
|
|
256
|
+
this.hasHeader = !!this.host.querySelector('[slot="header-title"]');
|
|
257
|
+
}
|
|
258
|
+
render() {
|
|
259
|
+
return (index.h(index.Host, { role: "group" }, index.h("div", { class: {
|
|
260
|
+
"z-list-group-header-container": true,
|
|
261
|
+
"has-header": this.hasHeader,
|
|
262
|
+
} }, index.h("slot", { name: "header-title" }), this.dividerType === index$1.ListDividerType.HEADER && (index.h("z-divider", { color: this.dividerColor, size: this.dividerSize }))), index.h("slot", null)));
|
|
263
|
+
}
|
|
264
|
+
get host() { return index.getElement(this); }
|
|
265
|
+
};
|
|
266
|
+
ZListGroup.style = stylesCss;
|
|
267
|
+
|
|
268
|
+
exports.z_list = ZList;
|
|
269
|
+
exports.z_list_element = ZListElement;
|
|
270
|
+
exports.z_list_group = ZListGroup;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-195ca522.js');
|
|
6
|
+
const index$1 = require('./index-cf9497bc.js');
|
|
7
|
+
const utils = require('./utils-ee86db4f.js');
|
|
8
|
+
require('./breakpoints-ebe1a437.js');
|
|
9
|
+
|
|
10
|
+
const stylesCss$1 = ".sc-z-offcanvas-h{--z-offcanvas--container-width:375px;--z-offcanvas--top-space:0;min-width:100%;height:100%;font-family:var(--font-family-sans);font-weight:var(--font-rg);visibility:hidden}.canvas-container.sc-z-offcanvas{display:flex;overflow:-moz-scrollbars-none;overflow:hidden;min-width:100%;height:100%;flex-direction:column;background:var(--color-surface01)}[variant=\"pushcontent\"].sc-z-offcanvas-h{display:none}[open].sc-z-offcanvas-h{display:flex;visibility:visible}[variant=\"overlay\"].sc-z-offcanvas-h{position:fixed;z-index:1000;top:var(--z-offcanvas--top-space);right:0;bottom:0;left:0;display:flex;height:calc(100% - var(--z-offcanvas--top-space))}[variant=\"overlay\"][transitiondirection=\"left\"].sc-z-offcanvas-h{justify-content:end}[variant=\"overlay\"].sc-z-offcanvas-h>.canvas-container.sc-z-offcanvas{z-index:1010}[variant=\"overlay\"].sc-z-offcanvas-h .canvas-background.sc-z-offcanvas{position:absolute;left:0;width:100%;height:100%;background-color:var(--gray900);opacity:0.7}.canvas-container.sc-z-offcanvas>.canvas-content.sc-z-offcanvas{overflow:auto;flex:1 auto;padding:0 calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) calc(var(--space-unit) / 2) calc(var(--space-unit) * 2) 0;overflow-x:hidden}[variant=\"overlay\"].sc-z-offcanvas-h>.canvas-container.sc-z-offcanvas>.canvas-content.sc-z-offcanvas{padding:0 calc(var(--space-unit) * 2) calc(var(--space-unit) * 2) calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) calc(var(--space-unit) / 2) 0 0}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-track{background-color:transparent}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas{scrollbar-color:var(--color-primary01) transparent}@media only screen and (max-width: 768px){[open][transitiondirection=\"left\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-right 0.4s ease-out}[open][transitiondirection=\"right\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-left 0.4s ease-out}}@media only screen and (min-width: 768px){.sc-z-offcanvas-h{min-width:auto}.canvas-container.sc-z-offcanvas{width:auto;min-width:max(var(--z-offcanvas--container-width), 375px);max-width:max(var(--z-offcanvas--container-width), 375px);height:auto;min-height:calc(var(--space-unit) * 40)}.sc-z-offcanvas-h:not([variant=\"overlay\"])[open]:not(.skip-animation){width:auto;animation:grow 0.4s ease-out}}@keyframes grow{from{width:0}to{width:max(var(--z-offcanvas--container-width), 375px)}}@keyframes enter-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes enter-right{from{transform:translateX(100%)}to{transform:translateX(0)}}[open][variant=\"overlay\"][transitiondirection=\"left\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-right 0.4s ease-out}[open][transitiondirection=\"right\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-left 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"][transitiondirection=\"right\"]>.canvas-container.sc-z-offcanvas{transform:translateX(-100%);transition:visibility 0.4s ease-out, transform 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"][transitiondirection=\"left\"]>.canvas-container.sc-z-offcanvas{transform:translateX(100%);transition:visibility 0.4s ease-out, transform 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"] .canvas-background.sc-z-offcanvas{transition:visibility 0.4s ease-out;visibility:hidden}";
|
|
11
|
+
|
|
12
|
+
const ZOffcanvas = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.canvasOpenStatusChanged = index.createEvent(this, "canvasOpenStatusChanged", 7);
|
|
16
|
+
/**
|
|
17
|
+
* Offcanvas variant.
|
|
18
|
+
* Can be one `overlay` or `pushcontent`.
|
|
19
|
+
* Default variant: pushcontent
|
|
20
|
+
*/
|
|
21
|
+
this.variant = index$1.OffCanvasVariant.PUSHCONTENT;
|
|
22
|
+
/** Whether the offcanvas is open. Default: false */
|
|
23
|
+
this.open = false;
|
|
24
|
+
/** open content transitioning in a specified direction left | right. Default: left */
|
|
25
|
+
this.transitiondirection = index$1.TransitionDirection.LEFT;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to skip the initial animation.
|
|
28
|
+
* Useful when the initial value of the `open` prop is set to `true`.
|
|
29
|
+
*/
|
|
30
|
+
this.skipLoadAnimation = false;
|
|
31
|
+
}
|
|
32
|
+
onOpenChanged() {
|
|
33
|
+
if (!this.open && this.skipLoadAnimation) {
|
|
34
|
+
this.skipLoadAnimation = false;
|
|
35
|
+
}
|
|
36
|
+
if (this.open) {
|
|
37
|
+
this.handlePageOverflow();
|
|
38
|
+
}
|
|
39
|
+
this.canvasOpenStatusChanged.emit(this.open);
|
|
40
|
+
}
|
|
41
|
+
handlePageOverflow() {
|
|
42
|
+
const overflow = this.variant === index$1.OffCanvasVariant.OVERLAY ? "overflow-y" : "overflow-x";
|
|
43
|
+
document.body.style[overflow] = this.open ? "hidden" : "";
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return (index.h(index.Host, { class: { "skip-animation": this.skipLoadAnimation } }, index.h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handlePageOverflow() }, index.h("div", { role: "presentation", class: "canvas-content" }, index.h("slot", { name: "canvasContent" }))), this.variant == index$1.OffCanvasVariant.OVERLAY && (index.h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
|
|
47
|
+
}
|
|
48
|
+
static get watchers() { return {
|
|
49
|
+
"open": ["onOpenChanged"]
|
|
50
|
+
}; }
|
|
51
|
+
};
|
|
52
|
+
ZOffcanvas.style = stylesCss$1;
|
|
53
|
+
|
|
54
|
+
const stylesCss = ":host{z-index:15;display:flex;column-gap:calc(var(--space-unit) * 2);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host,*{box-sizing:border-box}.input-container{position:relative;display:flex;width:100%;flex-direction:column}.results-wrapper{position:absolute;top:calc(100% - 1px);left:0;width:100%;padding:calc(var(--space-unit) / 4);border:var(--border-size-small) solid var(--color-surface03);border-top:none;background:var(--color-surface01)}.results{overflow:auto;max-height:var(--z-searchbar-results-height, 540px);padding:calc(var(--space-unit) / 2) calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}.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)}.results::-webkit-scrollbar-track{background-color:transparent}.results::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.results .category-heading{display:block;font-size:var(--font-size-2);font-weight:var(--font-rg);line-height:var(--font-size-3)}.results .category-heading>*{display:block}.results .category-heading>.category{color:var(--color-text05);font-style:italic}.results .category-heading>.subcategory{margin-top:var(--space-unit);color:var(--color-text01);text-transform:uppercase}.results z-list-element{display:block}.results .item{--z-icon-height:12px;--z-icon-width:12px;display:flex;flex-flow:row nowrap;align-items:center;justify-content:flex-start;color:var(--color-text01);column-gap:calc(var(--space-unit) * 1.5);fill:var(--color-icon02);font-size:var(--font-size-2);line-height:var(--font-size-3)}.results .item.ellipsis>.item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.results .item>.item-label mark{background:var(--color-primary03)}.results .item.has-category{padding-left:calc(var(--space-unit) * 3)}.results .item.item-search{--z-icon-height:16px;--z-icon-width:16px}.results .item-show-all{text-align:center}.results .item-no-results{display:block;font-size:var(--font-size-2);font-style:italic;line-height:var(--font-size-5)}.results .item-no-results>ul{padding-left:calc(var(--space-unit) * 2);margin:var(--space-unit)}@media (min-width: 768px){.results .category-heading{font-size:var(--font-size-3);line-height:var(--font-size-6)}.results .item{font-size:var(--font-size-3);line-height:var(--font-size-6)}.results .item.item-search{--z-icon-height:18px;--z-icon-width:18px}.results .item.ellipsis>.item-label{height:24px}}@media (min-width: 1152px){.results .item{cursor:pointer}.results .item-no-results{cursor:default;font-size:var(--font-size-3);line-height:var(--font-size-6)}}:host([size=\"small\"]) .results :is(.item,.category-heading),:host([size=\"x-small\"]) .results :is(.item,.category-heading){font-size:var(--font-size-2)}:host([size=\"small\"]) .results .item:not(.has-category),:host([size=\"x-small\"]) .results .item:not(.has-category){--z-icon-height:16px;--z-icon-width:16px}:host([size=\"small\"])::part(list-item-container){min-height:calc(var(--space-unit) * 4.5);padding:0}:host([size=\"x-small\"])::part(list-item-container){min-height:calc(var(--space-unit) * 4);padding:0}";
|
|
55
|
+
|
|
56
|
+
const ZSearchbar = class {
|
|
57
|
+
constructor(hostRef) {
|
|
58
|
+
index.registerInstance(this, hostRef);
|
|
59
|
+
this.searchSubmit = index.createEvent(this, "searchSubmit", 7);
|
|
60
|
+
this.searchTyping = index.createEvent(this, "searchTyping", 7);
|
|
61
|
+
this.searchItemClick = index.createEvent(this, "searchItemClick", 7);
|
|
62
|
+
/** the id of the searchbar element */
|
|
63
|
+
this.htmlid = `searchbar-${utils.randomId()}`;
|
|
64
|
+
/** Prevent submit action */
|
|
65
|
+
this.preventSubmit = false;
|
|
66
|
+
/** Show autocomplete results */
|
|
67
|
+
this.autocomplete = false;
|
|
68
|
+
/** Minimun number of characters to dispatch typing event */
|
|
69
|
+
this.autocompleteMinChars = 3;
|
|
70
|
+
/** Truncate results to single row */
|
|
71
|
+
this.resultsEllipsis = true;
|
|
72
|
+
/** Search helper text */
|
|
73
|
+
this.searchHelperLabel = "Cerca {searchString}";
|
|
74
|
+
/** Sort autocomplete results items */
|
|
75
|
+
this.sortResultsItems = false;
|
|
76
|
+
/** Show submit button */
|
|
77
|
+
this.showSearchButton = false;
|
|
78
|
+
/** Set button icon without label*/
|
|
79
|
+
this.searchButtonIconOnly = false;
|
|
80
|
+
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
81
|
+
this.size = index$1.ControlSize.BIG;
|
|
82
|
+
/** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
|
|
83
|
+
this.variant = index$1.ButtonVariant.PRIMARY;
|
|
84
|
+
this.searchString = this.value;
|
|
85
|
+
this.currResultsCount = 0;
|
|
86
|
+
this.showResults = false;
|
|
87
|
+
this.resultsItemsList = null;
|
|
88
|
+
}
|
|
89
|
+
emitSearchSubmit() {
|
|
90
|
+
this.searchSubmit.emit(this.inputRef.value);
|
|
91
|
+
}
|
|
92
|
+
emitSearchTyping(search) {
|
|
93
|
+
this.searchTyping.emit(search);
|
|
94
|
+
}
|
|
95
|
+
emitSearchItemClick(item) {
|
|
96
|
+
this.searchItemClick.emit(item);
|
|
97
|
+
}
|
|
98
|
+
watchItems() {
|
|
99
|
+
this.resultsItemsList = this.getResultsItemsList();
|
|
100
|
+
}
|
|
101
|
+
watchResultsCount() {
|
|
102
|
+
this.currResultsCount = this.resultsCount;
|
|
103
|
+
}
|
|
104
|
+
watchValue() {
|
|
105
|
+
this.searchString = this.value;
|
|
106
|
+
}
|
|
107
|
+
watchSearchString() {
|
|
108
|
+
this.emitSearchTyping(this.searchString);
|
|
109
|
+
if (!this.searchString) {
|
|
110
|
+
this.currResultsCount = this.resultsCount;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
componentWillLoad() {
|
|
114
|
+
this.resultsItemsList = this.getResultsItemsList();
|
|
115
|
+
this.currResultsCount = this.resultsCount;
|
|
116
|
+
}
|
|
117
|
+
getResultsItemsList() {
|
|
118
|
+
return typeof this.resultsItems === "string" ? JSON.parse(this.resultsItems) : this.resultsItems;
|
|
119
|
+
}
|
|
120
|
+
getGroupedItems(items) {
|
|
121
|
+
const groupedItems = {};
|
|
122
|
+
items.forEach((item) => {
|
|
123
|
+
var _a;
|
|
124
|
+
const key = `${item === null || item === void 0 ? void 0 : item.category}${item === null || item === void 0 ? void 0 : item.subcategory}`;
|
|
125
|
+
groupedItems[key] = (_a = groupedItems[key]) !== null && _a !== void 0 ? _a : {
|
|
126
|
+
category: item === null || item === void 0 ? void 0 : item.category,
|
|
127
|
+
subcategory: item === null || item === void 0 ? void 0 : item.subcategory,
|
|
128
|
+
items: [],
|
|
129
|
+
};
|
|
130
|
+
groupedItems[key]["items"].push(item);
|
|
131
|
+
});
|
|
132
|
+
if (this.sortResultsItems) {
|
|
133
|
+
return Object.keys(groupedItems)
|
|
134
|
+
.sort()
|
|
135
|
+
.reduce((obj, key) => {
|
|
136
|
+
obj[key] = Object.assign(Object.assign({}, groupedItems[key]), { items: groupedItems[key]["items"].sort((a, b) => {
|
|
137
|
+
const nameA = a.label.toUpperCase();
|
|
138
|
+
const nameB = b.label.toUpperCase();
|
|
139
|
+
if (nameA < nameB) {
|
|
140
|
+
return -1;
|
|
141
|
+
}
|
|
142
|
+
if (nameA > nameB) {
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
return 0;
|
|
146
|
+
}) });
|
|
147
|
+
return obj;
|
|
148
|
+
}, {});
|
|
149
|
+
}
|
|
150
|
+
return groupedItems;
|
|
151
|
+
}
|
|
152
|
+
checkResultsCount(counter) {
|
|
153
|
+
if (!this.currResultsCount || counter < this.currResultsCount) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
handleStopTyping(e) {
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
this.searchString = e.detail.value;
|
|
161
|
+
}
|
|
162
|
+
handleSubmit() {
|
|
163
|
+
if (this.preventSubmit) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
this.emitSearchSubmit();
|
|
167
|
+
}
|
|
168
|
+
handleOutsideClick(e) {
|
|
169
|
+
const cp = e.composedPath();
|
|
170
|
+
const searchbar = cp.find((elem) => elem.nodeName === "Z-SEARCHBAR");
|
|
171
|
+
if (!searchbar || searchbar.htmlid !== this.htmlid) {
|
|
172
|
+
this.showResults = false;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (cp.find((elem) => { var _a; return (elem === null || elem === void 0 ? void 0 : elem.nodeName) === "Z-INPUT" || ((_a = elem === null || elem === void 0 ? void 0 : elem.classList) === null || _a === void 0 ? void 0 : _a.contains("results")); })) {
|
|
176
|
+
this.showResults = true;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
this.showResults = false;
|
|
180
|
+
}
|
|
181
|
+
renderInput() {
|
|
182
|
+
return (index.h("z-input", { ref: (val) => {
|
|
183
|
+
this.inputRef = val;
|
|
184
|
+
}, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => utils.handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value, size: this.size }));
|
|
185
|
+
}
|
|
186
|
+
renderButton() {
|
|
187
|
+
if (!this.showSearchButton) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
|
|
191
|
+
const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
|
|
192
|
+
const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
|
|
193
|
+
return index.h("z-button", Object.assign({}, defaultProps), buttonLabel);
|
|
194
|
+
}
|
|
195
|
+
renderResults() {
|
|
196
|
+
if (!this.showResults ||
|
|
197
|
+
!this.autocomplete ||
|
|
198
|
+
!this.searchString ||
|
|
199
|
+
this.searchString.length < this.autocompleteMinChars ||
|
|
200
|
+
!this.resultsItemsList) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
return (index.h("div", { class: "results-wrapper" }, index.h("div", { class: "results" }, this.renderResultsList())));
|
|
204
|
+
}
|
|
205
|
+
renderResultsList() {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
if (this.preventSubmit && !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
208
|
+
return (index.h("span", { class: "item item-no-results" }, "Non abbiamo trovato risultati per ", index.h("b", null, this.searchString), index.h("br", null), index.h("br", null), "Cosa puoi fare?", index.h("ul", null, index.h("li", null, "Verificare di aver scritto bene"), index.h("li", null, "Provare a cercare un'altra parola"), index.h("li", null, "Provare a cercare qualcosa di pi\u00F9 generico"))));
|
|
209
|
+
}
|
|
210
|
+
return (index.h("z-list", { role: "listbox", id: `list-${this.htmlid}` }, this.renderSearchHelper(!!((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)), this.renderItems(), this.renderShowAllResults()));
|
|
211
|
+
}
|
|
212
|
+
renderItems() {
|
|
213
|
+
var _a;
|
|
214
|
+
if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
const groupedItems = this.getGroupedItems(this.resultsItemsList);
|
|
218
|
+
const listGroups = [];
|
|
219
|
+
let counter = 0;
|
|
220
|
+
Object.values(groupedItems).forEach((groupItem, index$2, array) => {
|
|
221
|
+
if (this.checkResultsCount(counter)) {
|
|
222
|
+
const listGroupsElements = [];
|
|
223
|
+
groupItem.items.forEach((item, subindex, subarray) => {
|
|
224
|
+
if (this.checkResultsCount(counter)) {
|
|
225
|
+
const isLast = index$2 === array.length - 1 && subindex === subarray.length - 1;
|
|
226
|
+
listGroupsElements.push(this.renderItem(item, subindex, !isLast));
|
|
227
|
+
}
|
|
228
|
+
counter++;
|
|
229
|
+
});
|
|
230
|
+
if (listGroupsElements.length) {
|
|
231
|
+
listGroups.push(index.h("z-list-group", { "divider-type": index$1.ListDividerType.ELEMENT }, this.renderItemCategory(groupItem), listGroupsElements));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
return listGroups;
|
|
236
|
+
}
|
|
237
|
+
renderItem(item, key, divider) {
|
|
238
|
+
return (index.h("z-list-element", { id: `list-item-${this.htmlid}-${key}`, role: "option", tabindex: 0, dividerType: divider ? index$1.ListDividerType.ELEMENT : undefined, clickable: true, onClickItem: () => this.emitSearchItemClick(item) }, index.h("span", { class: { "item": true, "ellipsis": this.resultsEllipsis, "has-category": !!item.category } }, (item === null || item === void 0 ? void 0 : item.icon) && (index.h("z-icon", { class: "item-icon", name: item.icon })), index.h("span", { class: "item-label", title: item.label, innerHTML: this.renderItemLabel(item.label) }))));
|
|
239
|
+
}
|
|
240
|
+
renderItemLabel(label) {
|
|
241
|
+
if (!this.searchString) {
|
|
242
|
+
return label;
|
|
243
|
+
}
|
|
244
|
+
return label.replace(new RegExp(this.searchString.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gmi"), (found) => `<mark>${found}</mark>`);
|
|
245
|
+
}
|
|
246
|
+
renderItemCategory(groupItem) {
|
|
247
|
+
if (!(groupItem === null || groupItem === void 0 ? void 0 : groupItem.category)) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
return (index.h("span", { class: "category-heading", slot: "header-title" }, index.h("span", { class: "category" }, groupItem.category), (groupItem === null || groupItem === void 0 ? void 0 : groupItem.subcategory) && index.h("span", { class: "subcategory" }, groupItem.subcategory)));
|
|
251
|
+
}
|
|
252
|
+
renderSearchHelper(hasDivider = true) {
|
|
253
|
+
if (!this.autocomplete || this.preventSubmit || !this.searchString) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
return (index.h("z-list-element", { role: "option", tabindex: 0, dividerType: hasDivider ? index$1.ListDividerType.ELEMENT : undefined, clickable: true, id: `list-item-${this.htmlid}-search`, onClickItem: () => this.emitSearchSubmit() }, index.h("span", { class: "item item-search" }, index.h("z-icon", { class: "search-icon", name: "left-magnifying-glass" }), index.h("span", { class: "item-label", innerHTML: this.searchHelperLabel.replace("{searchString}", `<mark>${this.searchString}</mark>`) }))));
|
|
257
|
+
}
|
|
258
|
+
renderShowAllResults() {
|
|
259
|
+
var _a, _b;
|
|
260
|
+
if (!this.currResultsCount ||
|
|
261
|
+
!this.searchString ||
|
|
262
|
+
!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
263
|
+
this.currResultsCount >= ((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
return (index.h("z-list-element", { role: "option", tabindex: 0, clickable: true, id: `list-item-${this.htmlid}-show-all`, onClickItem: () => (this.currResultsCount = 0), color: "color-primary01" }, index.h("div", { class: "item-show-all" }, "Vedi tutti i risultati")));
|
|
267
|
+
}
|
|
268
|
+
render() {
|
|
269
|
+
return (index.h(index.Host, { onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e), class: { "has-submit": this.showSearchButton, "has-results": this.autocomplete } }, index.h("div", { class: "input-container" }, this.renderInput(), this.renderResults()), this.renderButton()));
|
|
270
|
+
}
|
|
271
|
+
static get watchers() { return {
|
|
272
|
+
"resultsItems": ["watchItems"],
|
|
273
|
+
"resultsCount": ["watchResultsCount"],
|
|
274
|
+
"value": ["watchValue"],
|
|
275
|
+
"searchString": ["watchSearchString"]
|
|
276
|
+
}; }
|
|
277
|
+
};
|
|
278
|
+
ZSearchbar.style = stylesCss;
|
|
279
|
+
|
|
280
|
+
exports.z_offcanvas = ZOffcanvas;
|
|
281
|
+
exports.z_searchbar = ZSearchbar;
|
|
@@ -14,7 +14,7 @@ export class ZChip {
|
|
|
14
14
|
"z-chip-container": true,
|
|
15
15
|
"z-chip-interactive": !!this.interactiveIcon,
|
|
16
16
|
[this.type]: true,
|
|
17
|
-
}, "aria-disabled": this.disabled }, this.icon && h("z-icon", { name: this.icon }), h("slot", null), this.interactiveIcon && (h("button", { type: "button", onClick: () => this.interactiveIconClick.emit(),
|
|
17
|
+
}, "aria-disabled": this.disabled }, this.icon && h("z-icon", { name: this.icon }), h("slot", null), this.interactiveIcon && (h("button", { type: "button", onClick: () => this.interactiveIconClick.emit(), "aria-label": this.ariaLabel, disabled: this.disabled }, h("z-icon", { class: "interactive-icon", name: this.interactiveIcon })))));
|
|
18
18
|
}
|
|
19
19
|
static get is() { return "z-chip"; }
|
|
20
20
|
static get encapsulation() { return "scoped"; }
|
|
@@ -170,7 +170,7 @@ export class ZFileUpload {
|
|
|
170
170
|
})))));
|
|
171
171
|
}
|
|
172
172
|
render() {
|
|
173
|
-
return (h(Host, null, h("div", { tabIndex: 0, class: `container ${this.getType()}` }, this.mainTitle && this.renderTitle(), this.getType() == ZFileUploadType.DEFAULT ? this.renderDefaultMode() : this.renderDragDropMode()), !!this.invalidFiles.size && (h("z-modal", { tabIndex: 0, ref: (val) => (this.errorModal = val), modaltitle: "Attenzione", onModalClose: () => (this.invalidFiles = new Map()), onModalBackgroundClick: () => (this.invalidFiles = new Map()) }, this.handleErrorModalContent()))));
|
|
173
|
+
return (h(Host, null, h("div", { tabIndex: 0, class: `container ${this.getType()}` }, this.mainTitle && this.renderTitle(), this.getType() == ZFileUploadType.DEFAULT ? this.renderDefaultMode() : this.renderDragDropMode()), !!this.invalidFiles.size && (h("z-modal", { modalid: `file-upload-${this.type}-error-modal`, tabIndex: 0, ref: (val) => (this.errorModal = val), modaltitle: "Attenzione", onModalClose: () => (this.invalidFiles = new Map()), onModalBackgroundClick: () => (this.invalidFiles = new Map()) }, this.handleErrorModalContent()))));
|
|
174
174
|
}
|
|
175
175
|
static get is() { return "z-file-upload"; }
|
|
176
176
|
static get encapsulation() { return "shadow"; }
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: center;
|
|
16
|
+
padding: calc(var(--space-unit) * 2);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
:host .modal-wrapper > .files-wrapper {
|
|
@@ -94,4 +95,14 @@ input#file-elem {
|
|
|
94
95
|
:host > .container > z-button {
|
|
95
96
|
align-self: flex-start;
|
|
96
97
|
}
|
|
98
|
+
|
|
99
|
+
:host .modal-wrapper {
|
|
100
|
+
padding: calc(var(--space-unit) * 3);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@media only screen and (min-width: 1152px) {
|
|
105
|
+
:host .modal-wrapper {
|
|
106
|
+
padding: calc(var(--space-unit) * 4);
|
|
107
|
+
}
|
|
97
108
|
}
|