@zanichelli/albe-web-components 2.18.0 → 2.18.4
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 +18 -0
- package/dist/cjs/{index-156c65fe.js → index-2e494cc2.js} +0 -12
- package/dist/cjs/{index-5c40f36c.js → index-66eb89b1.js} +36 -6
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-2a89d30b.js → utils-2636e75b.js} +1 -1
- package/dist/cjs/web-components-library.cjs.js +2 -2
- package/dist/cjs/{contextual-menu_65.cjs.entry.js → z-alert_65.cjs.entry.js} +86 -90
- package/dist/cjs/z-app-header.cjs.entry.js +1 -1
- package/dist/cjs/z-candybar.cjs.entry.js +1 -1
- package/dist/cjs/z-cookiebar.cjs.entry.js +2 -2
- package/dist/cjs/z-header.cjs.entry.js +2 -2
- package/dist/cjs/z-heading.cjs.entry.js +1 -1
- package/dist/cjs/z-messages-pocket.cjs.entry.js +2 -2
- package/dist/cjs/z-modal-login.cjs.entry.js +3 -3
- package/dist/cjs/z-modal.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-dictionary.cjs.entry.js +2 -2
- package/dist/cjs/z-myz-card-footer-sections.cjs.entry.js +1 -1
- package/dist/cjs/z-myz-card-info.cjs.entry.js +3 -3
- package/dist/cjs/z-navigation-tab.cjs.entry.js +1 -1
- package/dist/cjs/z-navigation-tabs.cjs.entry.js +2 -2
- package/dist/cjs/z-otp.cjs.entry.js +2 -2
- package/dist/cjs/z-pocket-message.cjs.entry.js +1 -1
- package/dist/cjs/z-pocket_3.cjs.entry.js +3 -3
- package/dist/cjs/z-registro-table-footer.cjs.entry.js +1 -1
- package/dist/cjs/z-slideshow.cjs.entry.js +3 -3
- package/dist/cjs/z-toast-notification-list.cjs.entry.js +56 -0
- package/dist/cjs/z-toast-notification.cjs.entry.js +202 -0
- package/dist/collection/beans/index.js +36 -6
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/buttons/z-button/index.js +3 -3
- package/dist/collection/components/buttons/z-button/styles.css +33 -0
- package/dist/collection/components/list/z-list-element/index.js +2 -2
- package/dist/collection/components/list/z-toast-notification-list/index.js +97 -0
- package/dist/collection/components/list/z-toast-notification-list/styles.css +107 -0
- package/dist/collection/components/modal/z-modal-login/index.js +20 -3
- package/dist/collection/components/navigation/z-link/index.js +16 -16
- package/dist/collection/components/navigation/z-link/styles.css +10 -11
- package/dist/collection/components/navigation/z-user-dropdown/index.js +5 -7
- package/dist/collection/components/navigation/z-user-dropdown/styles.css +0 -6
- package/dist/collection/components/notification/z-toast-notification/index.js +402 -0
- package/dist/collection/components/notification/z-toast-notification/styles.css +247 -0
- package/dist/collection/components/{contextual-menu → z-contextual-menu}/index.js +9 -9
- package/dist/collection/components/{contextual-menu → z-contextual-menu}/styles.css +8 -14
- package/dist/collection/snowflakes/registro-table/z-registro-table-header/index.js +38 -15
- package/dist/collection/snowflakes/registro-table/z-registro-table-header/styles.css +0 -4
- package/dist/esm/{index-c46a98db.js → index-6eb9a735.js} +1 -12
- package/dist/esm/{index-967c7341.js → index-98ce8389.js} +37 -7
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{utils-a9ad5ffb.js → utils-c7b22832.js} +1 -1
- package/dist/esm/web-components-library.js +2 -2
- package/dist/esm/{contextual-menu_65.entry.js → z-alert_65.entry.js} +86 -90
- package/dist/esm/z-app-header.entry.js +1 -1
- package/dist/esm/z-candybar.entry.js +1 -1
- package/dist/esm/z-cookiebar.entry.js +2 -2
- package/dist/esm/z-header.entry.js +2 -2
- package/dist/esm/z-heading.entry.js +1 -1
- package/dist/esm/z-messages-pocket.entry.js +2 -2
- package/dist/esm/z-modal-login.entry.js +3 -3
- package/dist/esm/z-modal.entry.js +1 -1
- package/dist/esm/z-myz-card-dictionary.entry.js +2 -2
- package/dist/esm/z-myz-card-footer-sections.entry.js +1 -1
- package/dist/esm/z-myz-card-info.entry.js +3 -3
- package/dist/esm/z-navigation-tab.entry.js +1 -1
- package/dist/esm/z-navigation-tabs.entry.js +2 -2
- package/dist/esm/z-otp.entry.js +2 -2
- package/dist/esm/z-pocket-message.entry.js +1 -1
- package/dist/esm/z-pocket_3.entry.js +3 -3
- package/dist/esm/z-registro-table-footer.entry.js +1 -1
- package/dist/esm/z-slideshow.entry.js +3 -3
- package/dist/esm/z-toast-notification-list.entry.js +52 -0
- package/dist/esm/z-toast-notification.entry.js +198 -0
- package/dist/types/beans/index.d.ts +33 -2
- package/dist/types/components/buttons/z-button/index.d.ts +1 -1
- package/dist/types/components/list/z-list-element/index.d.ts +1 -1
- package/dist/types/components/list/z-toast-notification-list/index.d.ts +14 -0
- package/dist/types/components/modal/z-modal-login/index.d.ts +2 -0
- package/dist/types/components/navigation/z-link/index.d.ts +1 -2
- package/dist/types/components/navigation/z-user-dropdown/index.d.ts +1 -2
- package/dist/types/components/notification/z-toast-notification/index.d.ts +56 -0
- package/dist/types/components/{contextual-menu → z-contextual-menu}/index.d.ts +4 -4
- package/dist/types/components.d.ts +167 -39
- package/dist/types/snowflakes/registro-table/z-registro-table-header/index.d.ts +2 -2
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-2d372576.entry.js → p-01ebd1c9.entry.js} +1 -1
- package/dist/web-components-library/{p-81aca7f9.entry.js → p-12ce5608.entry.js} +1 -1
- package/dist/web-components-library/{p-57c3d9ff.entry.js → p-2137b1fb.entry.js} +1 -1
- package/dist/web-components-library/{p-74c1c6e0.entry.js → p-251558f4.entry.js} +1 -1
- package/dist/web-components-library/p-26e91915.entry.js +7 -0
- package/dist/web-components-library/{p-e51658e2.entry.js → p-2a5adef6.entry.js} +1 -1
- package/dist/web-components-library/{p-6375145b.entry.js → p-337ace81.entry.js} +1 -1
- package/dist/web-components-library/{p-1cab68e1.entry.js → p-3c9ec157.entry.js} +1 -1
- package/dist/web-components-library/{p-dc5b4723.entry.js → p-40aff614.entry.js} +1 -1
- package/dist/web-components-library/{p-673631bf.entry.js → p-4c255df1.entry.js} +1 -1
- package/dist/web-components-library/p-504ff914.entry.js +1 -0
- package/dist/web-components-library/{p-df7cbc7e.entry.js → p-590be9d2.entry.js} +1 -1
- package/dist/web-components-library/{p-f2689b14.js → p-818c7395.js} +1 -1
- package/dist/web-components-library/p-859f6438.js +1 -0
- package/dist/web-components-library/{p-e32ebd79.entry.js → p-8a7841df.entry.js} +1 -1
- package/dist/web-components-library/{p-640cf406.entry.js → p-8c800c8c.entry.js} +1 -1
- package/dist/web-components-library/{p-e45b780b.entry.js → p-9c17ebe5.entry.js} +1 -1
- package/dist/web-components-library/{p-d9f4bef7.entry.js → p-b11b6985.entry.js} +1 -1
- package/dist/web-components-library/{p-1f02b80f.entry.js → p-b4ceb308.entry.js} +1 -1
- package/dist/web-components-library/{p-e2d6c4ae.entry.js → p-ba896238.entry.js} +1 -1
- package/dist/web-components-library/{p-c007fb63.entry.js → p-d428fe35.entry.js} +1 -1
- package/dist/web-components-library/p-e34dbabe.js +1 -0
- package/dist/web-components-library/{p-195cfc7e.entry.js → p-e7cd27ec.entry.js} +1 -1
- package/dist/web-components-library/p-fd7a7565.entry.js +1 -0
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +3 -1
- package/react/components.js +5 -3
- package/react/components.js.map +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-2d372576.entry.js → p-01ebd1c9.entry.js} +1 -1
- package/www/build/{p-81aca7f9.entry.js → p-12ce5608.entry.js} +1 -1
- package/www/build/{p-57c3d9ff.entry.js → p-2137b1fb.entry.js} +1 -1
- package/www/build/{p-74c1c6e0.entry.js → p-251558f4.entry.js} +1 -1
- package/www/build/p-26e91915.entry.js +7 -0
- package/www/build/{p-e51658e2.entry.js → p-2a5adef6.entry.js} +1 -1
- package/www/build/{p-6375145b.entry.js → p-337ace81.entry.js} +1 -1
- package/www/build/{p-1cab68e1.entry.js → p-3c9ec157.entry.js} +1 -1
- package/www/build/{p-dc5b4723.entry.js → p-40aff614.entry.js} +1 -1
- package/www/build/{p-673631bf.entry.js → p-4c255df1.entry.js} +1 -1
- package/www/build/p-504ff914.entry.js +1 -0
- package/www/build/{p-df7cbc7e.entry.js → p-590be9d2.entry.js} +1 -1
- package/www/build/{p-f2689b14.js → p-818c7395.js} +1 -1
- package/www/build/p-859f6438.js +1 -0
- package/www/build/p-859fc437.js +1 -0
- package/www/build/{p-e32ebd79.entry.js → p-8a7841df.entry.js} +1 -1
- package/www/build/{p-640cf406.entry.js → p-8c800c8c.entry.js} +1 -1
- package/www/build/{p-e45b780b.entry.js → p-9c17ebe5.entry.js} +1 -1
- package/www/build/{p-d9f4bef7.entry.js → p-b11b6985.entry.js} +1 -1
- package/www/build/{p-1f02b80f.entry.js → p-b4ceb308.entry.js} +1 -1
- package/www/build/{p-e2d6c4ae.entry.js → p-ba896238.entry.js} +1 -1
- package/www/build/{p-c007fb63.entry.js → p-d428fe35.entry.js} +1 -1
- package/www/build/p-e34dbabe.js +1 -0
- package/www/build/p-e55724ae.css +1 -0
- package/www/build/{p-195cfc7e.entry.js → p-e7cd27ec.entry.js} +1 -1
- package/www/build/p-fd7a7565.entry.js +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +34 -28
- package/www/pages/notification.html +247 -0
- package/dist/web-components-library/p-0e91a877.js +0 -1
- package/dist/web-components-library/p-4dbf0b2e.entry.js +0 -7
- package/dist/web-components-library/p-e51276a9.js +0 -1
- package/www/build/p-0e91a877.js +0 -1
- package/www/build/p-4dbf0b2e.entry.js +0 -7
- package/www/build/p-a28aa39d.css +0 -1
- package/www/build/p-e51276a9.js +0 -1
- package/www/build/p-f0b45c9d.js +0 -1
|
@@ -102,16 +102,16 @@ a.inverse:visited {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
a.black {
|
|
105
|
-
color: var(--
|
|
106
|
-
fill: var(--
|
|
105
|
+
color: var(--gray800);
|
|
106
|
+
fill: var(--gray800);
|
|
107
107
|
text-decoration: none;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
a.black:hover,
|
|
111
111
|
a.black.active,
|
|
112
112
|
a.black:visited {
|
|
113
|
-
color: var(--
|
|
114
|
-
fill: var(--
|
|
113
|
+
color: var(--color-black);
|
|
114
|
+
fill: var(--color-black);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
a.black:hover,
|
|
@@ -121,8 +121,8 @@ a.black:active {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
a.black:active {
|
|
124
|
-
color: var(--
|
|
125
|
-
fill: var(--
|
|
124
|
+
color: var(--gray700);
|
|
125
|
+
fill: var(--gray700);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
a.white,
|
|
@@ -135,8 +135,8 @@ a.white.active {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
a.white:visited {
|
|
138
|
-
color: var(--
|
|
139
|
-
fill: var(--
|
|
138
|
+
color: var(--gray300);
|
|
139
|
+
fill: var(--gray300);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
a.white:hover,
|
|
@@ -145,11 +145,10 @@ a.white:active {
|
|
|
145
145
|
text-decoration: underline;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
|
|
149
148
|
a.white.disabled,
|
|
150
149
|
a.black.disabled {
|
|
151
|
-
color: var(--
|
|
152
|
-
fill: var(--
|
|
150
|
+
color: var(--gray500);
|
|
151
|
+
fill: var(--gray500);
|
|
153
152
|
}
|
|
154
153
|
|
|
155
154
|
a > z-icon:first-child {
|
|
@@ -7,6 +7,7 @@ export class ZUserDropdown {
|
|
|
7
7
|
this.theme = ThemeVariant.dark;
|
|
8
8
|
this.ismenuopen = false;
|
|
9
9
|
this.handleToggle = this.handleToggle.bind(this);
|
|
10
|
+
this.emitDropdownMenuLinkClick = this.emitDropdownMenuLinkClick.bind(this);
|
|
10
11
|
}
|
|
11
12
|
componentWillLoad() {
|
|
12
13
|
this.setMobileAndGhostDivWidth();
|
|
@@ -30,7 +31,7 @@ export class ZUserDropdown {
|
|
|
30
31
|
window.innerWidth <= mobileBreakpoint;
|
|
31
32
|
if (this.gosthDiv)
|
|
32
33
|
this.gosthDiv.style.width =
|
|
33
|
-
this.logged &&
|
|
34
|
+
this.logged && !this.isMobile && this.ismenuopen
|
|
34
35
|
? `${(_a = this.userButton) === null || _a === void 0 ? void 0 : _a.offsetWidth}px`
|
|
35
36
|
: "";
|
|
36
37
|
}
|
|
@@ -38,7 +39,7 @@ export class ZUserDropdown {
|
|
|
38
39
|
this.userButtonClick.emit(this.ismenuopen);
|
|
39
40
|
}
|
|
40
41
|
emitDropdownMenuLinkClick(e) {
|
|
41
|
-
this.dropdownMenuLinkClick.emit(e.detail.linkId);
|
|
42
|
+
this.dropdownMenuLinkClick.emit({ e, linkId: e.detail.linkId });
|
|
42
43
|
}
|
|
43
44
|
handleResize() {
|
|
44
45
|
this.isMobile = window.innerWidth <= mobileBreakpoint;
|
|
@@ -55,9 +56,6 @@ export class ZUserDropdown {
|
|
|
55
56
|
this.ismenuopen = !this.ismenuopen;
|
|
56
57
|
this.emitUserButtonClick();
|
|
57
58
|
}
|
|
58
|
-
handleDropdownLinkClick(e) {
|
|
59
|
-
this.emitDropdownMenuLinkClick(e);
|
|
60
|
-
}
|
|
61
59
|
renderCaretIcon() {
|
|
62
60
|
const direction = this.ismenuopen ? "up" : "down";
|
|
63
61
|
return (h("z-icon", { name: `caret-${direction}-filled`, height: 18, width: 18 }));
|
|
@@ -82,7 +80,7 @@ export class ZUserDropdown {
|
|
|
82
80
|
renderDropdownMenu() {
|
|
83
81
|
return (this.ismenuopen && (h("ul", { class: this.theme }, this.linkarray.map((link) => {
|
|
84
82
|
return (h("li", { id: link.id },
|
|
85
|
-
h("z-link", { textcolor: this.retrieveLiTextColor(), big: true, href: link.link, htmlid: link.id, target: link.target, icon: link.icon, onZLinkClick:
|
|
83
|
+
h("z-link", { textcolor: this.retrieveLiTextColor(), big: true, href: link.link, htmlid: link.id, target: link.target, icon: link.icon, onZLinkClick: this.emitDropdownMenuLinkClick }, link.label)));
|
|
86
84
|
}))));
|
|
87
85
|
}
|
|
88
86
|
render() {
|
|
@@ -208,7 +206,7 @@ export class ZUserDropdown {
|
|
|
208
206
|
"composed": true,
|
|
209
207
|
"docs": {
|
|
210
208
|
"tags": [],
|
|
211
|
-
"text": "Emitted on dropdown menu zlink click, returns
|
|
209
|
+
"text": "Emitted on dropdown menu zlink click, returns event"
|
|
212
210
|
},
|
|
213
211
|
"complexType": {
|
|
214
212
|
"original": "any",
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { Component, Prop, h, Event, Element, Host, State, Watch, } from "@stencil/core";
|
|
2
|
+
import { ToastNotificationTransitionsEnum, } from "../../../beans";
|
|
3
|
+
import { mobileBreakpoint } from "../../../constants/breakpoints";
|
|
4
|
+
import Hammer from "hammerjs";
|
|
5
|
+
export class ZToastNotification {
|
|
6
|
+
constructor() {
|
|
7
|
+
/** toast notification autoclose can be paused */
|
|
8
|
+
this.pauseonfocusloss = true;
|
|
9
|
+
/** toast notification can be draggable*/
|
|
10
|
+
this.isdraggable = true;
|
|
11
|
+
/** toast notification draggable percentage*/
|
|
12
|
+
this.draggablepercentage = 80;
|
|
13
|
+
this.isCloseEventCalled = false;
|
|
14
|
+
this.visibilityChangeEventHandler = () => {
|
|
15
|
+
if (document.visibilityState === "hidden") {
|
|
16
|
+
this.timeoutHandle && this.onBlur();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.elapsedTime && this.onFocus();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
watchPropIsdraggable(newValue) {
|
|
24
|
+
if (newValue) {
|
|
25
|
+
this.sliderManager.get('pan').set({ enable: true });
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.sliderManager.get('pan').set({ enable: false });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
watchPropAutoclose(newValue) {
|
|
32
|
+
clearTimeout(this.timeoutHandle);
|
|
33
|
+
this.startClosingTimeout(newValue);
|
|
34
|
+
}
|
|
35
|
+
watchPropPauseonfocusloss(newValue) {
|
|
36
|
+
if (this.autoclose) {
|
|
37
|
+
if (newValue) {
|
|
38
|
+
document.addEventListener("visibilitychange", this.visibilityChangeEventHandler);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
document.removeEventListener("visibilitychange", this.visibilityChangeEventHandler);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
emitToastClose(cssClass) {
|
|
46
|
+
this.timeoutHandle = null;
|
|
47
|
+
this.elapsedTime = null;
|
|
48
|
+
this.hostElement.classList.add(cssClass);
|
|
49
|
+
this.toastClose.emit();
|
|
50
|
+
}
|
|
51
|
+
componentWillLoad() {
|
|
52
|
+
this.isMobile = window.innerWidth <= mobileBreakpoint;
|
|
53
|
+
this.validateAutoclose();
|
|
54
|
+
}
|
|
55
|
+
componentDidLoad() {
|
|
56
|
+
this.isTextLong = this.detectWrap() || this.toastText.offsetHeight > 20;
|
|
57
|
+
this.startTime = Date.now();
|
|
58
|
+
if (this.autoclose && this.pauseonfocusloss) {
|
|
59
|
+
document.addEventListener("visibilitychange", this.visibilityChangeEventHandler);
|
|
60
|
+
}
|
|
61
|
+
this.isdraggable && this.handleSlideOutDragAnimation();
|
|
62
|
+
this.percentage = 0;
|
|
63
|
+
}
|
|
64
|
+
validateAutoclose() {
|
|
65
|
+
if (!this.autoclose && !this.closebutton)
|
|
66
|
+
console.error("At least one between autoclose and closebutton must be present");
|
|
67
|
+
}
|
|
68
|
+
mapSlideOutClass() {
|
|
69
|
+
switch (this.transition) {
|
|
70
|
+
case ToastNotificationTransitionsEnum.slideInDown:
|
|
71
|
+
return ToastNotificationTransitionsEnum.slideOutUp;
|
|
72
|
+
case ToastNotificationTransitionsEnum.slideInUp:
|
|
73
|
+
return ToastNotificationTransitionsEnum.slideOutDown;
|
|
74
|
+
case ToastNotificationTransitionsEnum.slideInLeft:
|
|
75
|
+
return ToastNotificationTransitionsEnum.slideOutRight;
|
|
76
|
+
case ToastNotificationTransitionsEnum.slideInRight:
|
|
77
|
+
return ToastNotificationTransitionsEnum.slideOutLeft;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
calculateDraggedPercentage(e) {
|
|
81
|
+
const bounding = this.hostElement.getBoundingClientRect();
|
|
82
|
+
return Math.round((100 * e.deltaX) / bounding.width);
|
|
83
|
+
}
|
|
84
|
+
handleSlideOutDragAnimation() {
|
|
85
|
+
this.sliderManager = new Hammer(this.hostElement);
|
|
86
|
+
this.sliderManager.get("pan").set({
|
|
87
|
+
direction: Hammer.DIRECTION_HORIZONTAL,
|
|
88
|
+
});
|
|
89
|
+
this.sliderManager.on("pan", (e) => {
|
|
90
|
+
this.percentage = this.calculateDraggedPercentage(e);
|
|
91
|
+
this.hostElement.style.transition = "none";
|
|
92
|
+
this.hostElement.classList.remove(this.transition);
|
|
93
|
+
const translateObj = {
|
|
94
|
+
translate: "translateX( " + this.percentage + "% )",
|
|
95
|
+
translateBack: "translateX(0)",
|
|
96
|
+
};
|
|
97
|
+
this.hostElement.style.opacity = `${100 - Math.abs(this.percentage)}%`;
|
|
98
|
+
if (e.eventType === Hammer.DIRECTION_LEFT ||
|
|
99
|
+
e.eventType === Hammer.DIRECTION_RIGHT) {
|
|
100
|
+
this.hostElement.style.transform = translateObj.translate;
|
|
101
|
+
if (Math.abs(this.percentage) > this.draggablepercentage &&
|
|
102
|
+
!this.isCloseEventCalled) {
|
|
103
|
+
this.isCloseEventCalled = true;
|
|
104
|
+
this.emitToastClose(e.direction === Hammer.DIRECTION_LEFT
|
|
105
|
+
? "slide-out-left"
|
|
106
|
+
: "slide-out-right");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (e.isFinal && Math.abs(this.percentage) < this.draggablepercentage) {
|
|
110
|
+
this.hostElement.style.transform = translateObj.translateBack;
|
|
111
|
+
this.hostElement.style.transition = "all 1s";
|
|
112
|
+
this.hostElement.style.opacity = `100%`;
|
|
113
|
+
this.percentage = 0;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
onFocus() {
|
|
118
|
+
let time;
|
|
119
|
+
time = this.autoclose;
|
|
120
|
+
if (this.elapsedTime) {
|
|
121
|
+
time = this.autoclose - this.elapsedTime;
|
|
122
|
+
}
|
|
123
|
+
if (time > 0) {
|
|
124
|
+
this.startClosingTimeout(time);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
onBlur() {
|
|
128
|
+
this.elapsedTime = Date.now() - this.startTime;
|
|
129
|
+
clearTimeout(this.timeoutHandle);
|
|
130
|
+
}
|
|
131
|
+
startClosingTimeout(time) {
|
|
132
|
+
this.timeoutHandle = setTimeout(() => this.emitToastClose(this.mapSlideOutClass()), time);
|
|
133
|
+
}
|
|
134
|
+
detectWrap() {
|
|
135
|
+
const parentWidth = this.container.offsetWidth;
|
|
136
|
+
const children = this.container.children;
|
|
137
|
+
let totalWidth = 0;
|
|
138
|
+
for (let i = 0; i < children.length; i++) {
|
|
139
|
+
totalWidth += children[i].offsetWidth;
|
|
140
|
+
}
|
|
141
|
+
return totalWidth > parentWidth;
|
|
142
|
+
}
|
|
143
|
+
renderText() {
|
|
144
|
+
return (h("div", { id: "text", ref: (el) => (this.toastText = el) },
|
|
145
|
+
h("span", { class: "title" }, this.heading),
|
|
146
|
+
h("span", { class: "message" }, this.message)));
|
|
147
|
+
}
|
|
148
|
+
renderButton() {
|
|
149
|
+
return (h("div", { id: "button" },
|
|
150
|
+
h("slot", { name: "button" })));
|
|
151
|
+
}
|
|
152
|
+
renderCloseIcon() {
|
|
153
|
+
return (this.closebutton && (h("div", { id: "icon" },
|
|
154
|
+
h("z-icon", { tabIndex: 0, name: "multiply-circled", width: 15, height: 15, onClick: () => this.emitToastClose(this.mapSlideOutClass()), onKeyPress: (e) => {
|
|
155
|
+
if (e.keyCode == 32 || e.keyCode == 13) {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
this.emitToastClose(this.mapSlideOutClass());
|
|
158
|
+
}
|
|
159
|
+
} }))));
|
|
160
|
+
}
|
|
161
|
+
renderContainer() {
|
|
162
|
+
return (h("div", { tabIndex: 0, id: "external-container", class: {
|
|
163
|
+
[this.type]: !!this.type,
|
|
164
|
+
"several-lines-padding": this.isTextLong,
|
|
165
|
+
}, ref: (el) => (this.container = el) },
|
|
166
|
+
this.renderText(),
|
|
167
|
+
this.renderButton(),
|
|
168
|
+
this.renderCloseIcon()));
|
|
169
|
+
}
|
|
170
|
+
renderMobileContainer() {
|
|
171
|
+
return (h("div", { id: "external-container", class: {
|
|
172
|
+
[this.type]: !!this.type,
|
|
173
|
+
"several-lines-padding": this.isTextLong,
|
|
174
|
+
"mobile-wrapped": this.isTextLong,
|
|
175
|
+
} },
|
|
176
|
+
h("div", { id: "flex-container", ref: (el) => (this.container = el) },
|
|
177
|
+
this.renderText(),
|
|
178
|
+
this.renderButton()),
|
|
179
|
+
this.renderCloseIcon()));
|
|
180
|
+
}
|
|
181
|
+
render() {
|
|
182
|
+
return (h(Host, { style: {
|
|
183
|
+
["--percentuale"]: `${this.percentage}%`,
|
|
184
|
+
}, class: this.transition
|
|
185
|
+
? this.transition
|
|
186
|
+
: ToastNotificationTransitionsEnum.slideInDown, onAnimationEnd: (e) => {
|
|
187
|
+
if (this.autoclose && e.animationName.includes("slidein")) {
|
|
188
|
+
this.startClosingTimeout(this.autoclose);
|
|
189
|
+
}
|
|
190
|
+
if (e.animationName.includes("slideout")) {
|
|
191
|
+
this.hostElement.parentNode.removeChild(this.hostElement);
|
|
192
|
+
}
|
|
193
|
+
} }, this.isMobile ? this.renderMobileContainer() : this.renderContainer()));
|
|
194
|
+
}
|
|
195
|
+
static get is() { return "z-toast-notification"; }
|
|
196
|
+
static get encapsulation() { return "shadow"; }
|
|
197
|
+
static get originalStyleUrls() { return {
|
|
198
|
+
"$": ["styles.css"]
|
|
199
|
+
}; }
|
|
200
|
+
static get styleUrls() { return {
|
|
201
|
+
"$": ["styles.css"]
|
|
202
|
+
}; }
|
|
203
|
+
static get properties() { return {
|
|
204
|
+
"heading": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"mutable": false,
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "string",
|
|
209
|
+
"resolved": "string",
|
|
210
|
+
"references": {}
|
|
211
|
+
},
|
|
212
|
+
"required": false,
|
|
213
|
+
"optional": true,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "toast notification's title"
|
|
217
|
+
},
|
|
218
|
+
"attribute": "heading",
|
|
219
|
+
"reflect": false
|
|
220
|
+
},
|
|
221
|
+
"message": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": false,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "toast notification's message"
|
|
234
|
+
},
|
|
235
|
+
"attribute": "message",
|
|
236
|
+
"reflect": false
|
|
237
|
+
},
|
|
238
|
+
"closebutton": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "boolean",
|
|
243
|
+
"resolved": "boolean",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": false,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "toggles closing button rendering"
|
|
251
|
+
},
|
|
252
|
+
"attribute": "closebutton",
|
|
253
|
+
"reflect": false
|
|
254
|
+
},
|
|
255
|
+
"autoclose": {
|
|
256
|
+
"type": "number",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "number",
|
|
260
|
+
"resolved": "number",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": true,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": "toast notification closing timeout (ms)"
|
|
268
|
+
},
|
|
269
|
+
"attribute": "autoclose",
|
|
270
|
+
"reflect": false
|
|
271
|
+
},
|
|
272
|
+
"pauseonfocusloss": {
|
|
273
|
+
"type": "boolean",
|
|
274
|
+
"mutable": false,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "boolean",
|
|
277
|
+
"resolved": "boolean",
|
|
278
|
+
"references": {}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": true,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "toast notification autoclose can be paused"
|
|
285
|
+
},
|
|
286
|
+
"attribute": "pauseonfocusloss",
|
|
287
|
+
"reflect": false,
|
|
288
|
+
"defaultValue": "true"
|
|
289
|
+
},
|
|
290
|
+
"type": {
|
|
291
|
+
"type": "string",
|
|
292
|
+
"mutable": false,
|
|
293
|
+
"complexType": {
|
|
294
|
+
"original": "ToastNotificationTypes",
|
|
295
|
+
"resolved": "ToastNotificationEnum.accent | ToastNotificationEnum.dark | ToastNotificationEnum.error | ToastNotificationEnum.light | ToastNotificationEnum.success | ToastNotificationEnum.warning",
|
|
296
|
+
"references": {
|
|
297
|
+
"ToastNotificationTypes": {
|
|
298
|
+
"location": "import",
|
|
299
|
+
"path": "../../../beans"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"required": false,
|
|
304
|
+
"optional": true,
|
|
305
|
+
"docs": {
|
|
306
|
+
"tags": [],
|
|
307
|
+
"text": "toast notification type: dark, light, accent, error, success, warning"
|
|
308
|
+
},
|
|
309
|
+
"attribute": "type",
|
|
310
|
+
"reflect": false
|
|
311
|
+
},
|
|
312
|
+
"isdraggable": {
|
|
313
|
+
"type": "boolean",
|
|
314
|
+
"mutable": false,
|
|
315
|
+
"complexType": {
|
|
316
|
+
"original": "boolean",
|
|
317
|
+
"resolved": "boolean",
|
|
318
|
+
"references": {}
|
|
319
|
+
},
|
|
320
|
+
"required": false,
|
|
321
|
+
"optional": true,
|
|
322
|
+
"docs": {
|
|
323
|
+
"tags": [],
|
|
324
|
+
"text": "toast notification can be draggable"
|
|
325
|
+
},
|
|
326
|
+
"attribute": "isdraggable",
|
|
327
|
+
"reflect": false,
|
|
328
|
+
"defaultValue": "true"
|
|
329
|
+
},
|
|
330
|
+
"draggablepercentage": {
|
|
331
|
+
"type": "number",
|
|
332
|
+
"mutable": false,
|
|
333
|
+
"complexType": {
|
|
334
|
+
"original": "number",
|
|
335
|
+
"resolved": "number",
|
|
336
|
+
"references": {}
|
|
337
|
+
},
|
|
338
|
+
"required": false,
|
|
339
|
+
"optional": true,
|
|
340
|
+
"docs": {
|
|
341
|
+
"tags": [],
|
|
342
|
+
"text": "toast notification draggable percentage"
|
|
343
|
+
},
|
|
344
|
+
"attribute": "draggablepercentage",
|
|
345
|
+
"reflect": false,
|
|
346
|
+
"defaultValue": "80"
|
|
347
|
+
},
|
|
348
|
+
"transition": {
|
|
349
|
+
"type": "string",
|
|
350
|
+
"mutable": false,
|
|
351
|
+
"complexType": {
|
|
352
|
+
"original": "ToastNotificationTransitionTypes",
|
|
353
|
+
"resolved": "ToastNotificationTransitionsEnum.slideInDown | ToastNotificationTransitionsEnum.slideInLeft | ToastNotificationTransitionsEnum.slideInRight | ToastNotificationTransitionsEnum.slideInUp | ToastNotificationTransitionsEnum.slideOutDown | ToastNotificationTransitionsEnum.slideOutLeft | ToastNotificationTransitionsEnum.slideOutRight | ToastNotificationTransitionsEnum.slideOutUp",
|
|
354
|
+
"references": {
|
|
355
|
+
"ToastNotificationTransitionTypes": {
|
|
356
|
+
"location": "import",
|
|
357
|
+
"path": "../../../beans"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
"required": false,
|
|
362
|
+
"optional": true,
|
|
363
|
+
"docs": {
|
|
364
|
+
"tags": [],
|
|
365
|
+
"text": "toast notification animation type: slide-in-left, slide-in-right, slide-in-down, slide-in-up"
|
|
366
|
+
},
|
|
367
|
+
"attribute": "transition",
|
|
368
|
+
"reflect": false
|
|
369
|
+
}
|
|
370
|
+
}; }
|
|
371
|
+
static get states() { return {
|
|
372
|
+
"percentage": {},
|
|
373
|
+
"isTextLong": {}
|
|
374
|
+
}; }
|
|
375
|
+
static get events() { return [{
|
|
376
|
+
"method": "toastClose",
|
|
377
|
+
"name": "toastClose",
|
|
378
|
+
"bubbles": true,
|
|
379
|
+
"cancelable": true,
|
|
380
|
+
"composed": true,
|
|
381
|
+
"docs": {
|
|
382
|
+
"tags": [],
|
|
383
|
+
"text": "notification close event"
|
|
384
|
+
},
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "any",
|
|
387
|
+
"resolved": "any",
|
|
388
|
+
"references": {}
|
|
389
|
+
}
|
|
390
|
+
}]; }
|
|
391
|
+
static get elementRef() { return "hostElement"; }
|
|
392
|
+
static get watchers() { return [{
|
|
393
|
+
"propName": "isdraggable",
|
|
394
|
+
"methodName": "watchPropIsdraggable"
|
|
395
|
+
}, {
|
|
396
|
+
"propName": "autoclose",
|
|
397
|
+
"methodName": "watchPropAutoclose"
|
|
398
|
+
}, {
|
|
399
|
+
"propName": "pauseonfocusloss",
|
|
400
|
+
"methodName": "watchPropPauseonfocusloss"
|
|
401
|
+
}]; }
|
|
402
|
+
}
|