@zanichelli/albe-web-components 12.4.0-RC → 12.4.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/dist/cjs/index-195ca522.js +10 -18
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header_11.cjs.entry.js +1077 -0
- package/dist/cjs/{z-button_6.cjs.entry.js → z-dragdrop-area_2.cjs.entry.js} +2 -259
- package/dist/cjs/z-file-upload.cjs.entry.js +189 -0
- package/dist/cjs/z-select.cjs.entry.js +3 -3
- package/dist/collection/components/file-upload/z-file-upload/index.js +3 -3
- package/dist/collection/components/inputs/z-select/index.js +2 -2
- package/dist/collection/components/inputs/z-select/styles.css +43 -5
- package/dist/esm/index-4968ce56.js +10 -18
- package/dist/esm/{index-df06f147.js → index-4d1853ea.js} +1 -1
- package/dist/esm/{index-e44342f3.js → index-fb19ca57.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-3d2372eb.js → utils-2a4ef29d.js} +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header_11.entry.js +1063 -0
- package/dist/esm/z-book-card.entry.js +1 -1
- package/dist/esm/z-breadcrumb.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +1 -1
- package/dist/esm/{z-button_6.entry.js → z-dragdrop-area_2.entry.js} +5 -258
- package/dist/esm/z-file-upload.entry.js +185 -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-pocket_3.entry.js +1 -1
- package/dist/esm/z-select.entry.js +4 -4
- 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/types/beans/index.d.ts +1 -0
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/p-03b13390.entry.js +1 -0
- package/dist/web-components-library/{p-0495fb84.entry.js → p-100207d8.entry.js} +1 -1
- package/dist/web-components-library/p-3327e5f0.entry.js +1 -0
- package/dist/web-components-library/{p-6f281905.entry.js → p-485fd3db.entry.js} +1 -1
- package/dist/web-components-library/{p-29377b57.entry.js → p-5944a8f2.entry.js} +1 -1
- package/dist/web-components-library/p-5c63b09c.entry.js +1 -0
- package/dist/web-components-library/p-5d19e5ef.entry.js +1 -0
- package/dist/web-components-library/p-7907bdf7.entry.js +1 -0
- package/dist/web-components-library/p-8053b752.entry.js +1 -0
- package/dist/web-components-library/{p-d51d7b44.entry.js → p-8c31e60b.entry.js} +1 -1
- package/dist/web-components-library/{p-28b2868e.js → p-98badafc.js} +1 -1
- package/dist/web-components-library/p-9b0bcd43.entry.js +1 -0
- package/dist/web-components-library/{p-b921dc8d.js → p-a01baa71.js} +1 -1
- package/{www/build/p-76e7d402.entry.js → dist/web-components-library/p-a1663ab1.entry.js} +1 -1
- package/dist/web-components-library/{p-17d4f729.entry.js → p-cc009af8.entry.js} +1 -1
- package/dist/web-components-library/{p-d12d4dcd.js → p-cd561d69.js} +1 -1
- package/dist/web-components-library/p-ed42ceca.entry.js +1 -0
- package/dist/web-components-library/{p-b0f9cf23.entry.js → p-f3cc3f27.entry.js} +1 -1
- package/dist/web-components-library/{p-a6af3c1d.entry.js → p-f5bc7dda.entry.js} +1 -1
- package/dist/web-components-library/p-ff5a6e34.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-03b13390.entry.js +1 -0
- package/www/build/{p-0495fb84.entry.js → p-100207d8.entry.js} +1 -1
- package/www/build/p-21a94605.css +3 -0
- package/www/build/p-3327e5f0.entry.js +1 -0
- package/www/build/{p-6f281905.entry.js → p-485fd3db.entry.js} +1 -1
- package/www/build/{p-29377b57.entry.js → p-5944a8f2.entry.js} +1 -1
- package/www/build/p-5c63b09c.entry.js +1 -0
- package/www/build/p-5d19e5ef.entry.js +1 -0
- package/www/build/p-7907bdf7.entry.js +1 -0
- package/www/build/p-8053b752.entry.js +1 -0
- package/www/build/{p-d51d7b44.entry.js → p-8c31e60b.entry.js} +1 -1
- package/www/build/p-8c5fa7fd.js +1 -0
- package/www/build/{p-28b2868e.js → p-98badafc.js} +1 -1
- package/www/build/p-9b0bcd43.entry.js +1 -0
- package/www/build/{p-b921dc8d.js → p-a01baa71.js} +1 -1
- package/{dist/web-components-library/p-76e7d402.entry.js → www/build/p-a1663ab1.entry.js} +1 -1
- package/www/build/{p-17d4f729.entry.js → p-cc009af8.entry.js} +1 -1
- package/www/build/{p-d12d4dcd.js → p-cd561d69.js} +1 -1
- package/www/build/p-ed42ceca.entry.js +1 -0
- package/www/build/{p-b0f9cf23.entry.js → p-f3cc3f27.entry.js} +1 -1
- package/www/build/{p-a6af3c1d.entry.js → p-f5bc7dda.entry.js} +1 -1
- package/www/build/p-ff5a6e34.entry.js +1 -0
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -10
- package/CHANGELOG.md +0 -2865
- package/dist/cjs/z-app-header.cjs.entry.js +0 -185
- package/dist/cjs/z-input_2.cjs.entry.js +0 -289
- package/dist/cjs/z-list_3.cjs.entry.js +0 -270
- package/dist/cjs/z-offcanvas_2.cjs.entry.js +0 -281
- package/dist/esm/z-app-header.entry.js +0 -181
- package/dist/esm/z-input_2.entry.js +0 -284
- package/dist/esm/z-list_3.entry.js +0 -264
- package/dist/esm/z-offcanvas_2.entry.js +0 -276
- package/dist/web-components-library/p-07854026.entry.js +0 -1
- package/dist/web-components-library/p-13762a32.entry.js +0 -1
- package/dist/web-components-library/p-1b342136.entry.js +0 -1
- package/dist/web-components-library/p-1c541078.entry.js +0 -1
- package/dist/web-components-library/p-207467d2.entry.js +0 -1
- package/dist/web-components-library/p-285ec5fc.entry.js +0 -1
- package/dist/web-components-library/p-29d45fe5.entry.js +0 -1
- package/dist/web-components-library/p-49d22e92.entry.js +0 -1
- package/dist/web-components-library/p-570e1a2e.entry.js +0 -1
- package/dist/web-components-library/p-8aaa0c34.entry.js +0 -1
- package/dist/web-components-library/p-d00d2e95.entry.js +0 -1
- package/src-react/index.ts +0 -1
- package/www/build/p-07854026.entry.js +0 -1
- package/www/build/p-13762a32.entry.js +0 -1
- package/www/build/p-1b342136.entry.js +0 -1
- package/www/build/p-1c541078.entry.js +0 -1
- package/www/build/p-207467d2.entry.js +0 -1
- package/www/build/p-285ec5fc.entry.js +0 -1
- package/www/build/p-29d45fe5.entry.js +0 -1
- package/www/build/p-49d22e92.entry.js +0 -1
- package/www/build/p-4a7a94e2.css +0 -1576
- package/www/build/p-570e1a2e.entry.js +0 -1
- package/www/build/p-8aaa0c34.entry.js +0 -1
- package/www/build/p-ce656c1c.js +0 -129
- package/www/build/p-d00d2e95.entry.js +0 -1
|
@@ -1,185 +0,0 @@
|
|
|
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 = ":host{--app-header-typography-1-size:24px;--app-header-typography-2-size:28px;--app-header-typography-3-size:32px;--app-header-typography-4-size:36px;--app-header-typography-5-size:42px;--app-header-typography-6-size:48px;--app-header-typography-7-size:54px;--app-header-typography-8-size:60px;--app-header-typography-9-size:68px;--app-header-typography-10-size:76px;--app-header-typography-11-size:84px;--app-header-typography-12-size:92px;--app-header-typography-1-lineheight:1.33;--app-header-typography-2-lineheight:1.29;--app-header-typography-3-lineheight:1.25;--app-header-typography-4-lineheight:1.24;--app-header-typography-5-lineheight:1.24;--app-header-typography-6-lineheight:1.25;--app-header-typography-7-lineheight:1.2;--app-header-typography-8-lineheight:1.26;--app-header-typography-9-lineheight:1.24;--app-header-typography-10-lineheight:1.26;--app-header-typography-11-lineheight:1.2;--app-header-typography-12-lineheight:1.2;--app-header-typography-1-tracking:calc(-0.2 / 1em);--app-header-typography-2-tracking:calc(-0.4 / 1em);--app-header-typography-3-tracking:calc(-0.6 / 1em);--app-header-typography-4-tracking:calc(-0.8 / 1em);--app-header-typography-5-tracking:calc(-1 / 1em);--app-header-typography-6-tracking:calc(-1.2 / 1em);--app-header-typography-7-tracking:calc(-1.4 / 1em);--app-header-typography-8-tracking:calc(-1.6 / 1em);--app-header-typography-9-tracking:calc(-1.8 / 1em);--app-header-typography-10-tracking:calc(-2 / 1em);--app-header-typography-11-tracking:calc(-2.2 / 1em);--app-header-typography-12-tracking:calc(-2.4 / 1em);--app-header-content-max-width:100%;--app-header-height:auto;--app-header-top-offset:48px;--app-header-drawer-trigger-size:calc(var(--space-unit) * 4);--app-header-bg:var(--color-surface01);--app-header-stucked-bg:var(--color-surface01);--app-header-text-color:var(--color-text01);--app-header-title-font-size:var(--app-header-typography-3-size);--app-header-title-lineheight:var(--app-header-typography-3-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-3-tracking);--app-header-stucked-text-color:var(--color-text01);position:relative;display:block;height:var(--app-header-height);color:var(--app-header-text-color)}:host,*{box-sizing:border-box}.heading-panel{position:relative;display:flex;width:100%;max-width:var(--app-header-content-max-width);flex-direction:column;flex-grow:0;flex-shrink:0;align-items:baseline;padding:var(--grid-margin);margin:0 auto;background:var(--app-header-bg);gap:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5)}.hero-container+.heading-panel{background:transparent}:host(:empty) .heading-panel{padding:0}.heading-container{position:relative;z-index:1;display:flex;width:100%;max-width:100%;flex:1 auto;flex-direction:column;justify-content:flex-start}.heading-title{display:flex;max-width:100%;flex-direction:row;align-items:flex-start;column-gap:calc(var(--space-unit) * 2)}::slotted([slot=\"title\"]),.heading-stuck .heading-title>*,::slotted([slot=\"stucked-title\"]){margin:0;font-family:\"IBM Plex Serif\", serif;font-weight:var(--font-bd)}::slotted([slot=\"title\"]){font-size:var(--app-header-title-font-size);letter-spacing:var(--app-header-title-letter-spacing);line-height:var(--app-header-title-lineheight)}.heading-stuck .heading-title>*,::slotted([slot=\"stucked-title\"]){font-size:var(--app-header-typography-3-size);letter-spacing:var(--app-header-typography-3-tracking);line-height:var(--app-header-typography-3-lineheight)}:host(:not([menu-length=\"0\"])) .heading-subtitle{padding-left:calc(var(--app-header-drawer-trigger-size) + (var(--space-unit) * 2))}::slotted([slot=\"top-subtitle\"]),::slotted([slot=\"subtitle\"]){margin:0;font-family:var(--font-family-sans);font-size:20px;font-style:italic;line-height:26px}::slotted([slot=\"subtitle\"]){font-weight:500}::slotted([slot=\"top-subtitle\"]){font-weight:400}.menu-container{display:flex;width:100%;flex:1 auto;flex-flow:row wrap}:host([menu-length=\"0\"]:not([enable-search])) .menu-container,.menu-container:empty{display:none}.menu-container ::slotted([open]){position:relative;z-index:3}z-searchbar{z-index:0;display:flex;width:auto;min-width:calc(var(--space-unit) * 32);flex:1 auto;align-items:center;margin-left:auto}.heading-stuck{position:fixed;z-index:20;top:var(--app-header-top-offset);left:0;width:100%;max-width:100%;animation:slide-stuck-heading-in 250ms ease-out;background:var(--app-header-stucked-bg);box-shadow:var(--shadow-2);color:var(--app-header-stucked-text-color)}.heading-stuck-content{display:flex;max-width:var(--app-header-content-max-width);align-items:center;padding:var(--space-unit) var(--grid-margin);margin:0 auto;column-gap:calc(var(--space-unit) * 2)}.heading-stuck .heading-title{overflow:hidden}.heading-stuck .heading-title>*,.heading-stuck .heading-title ::slotted([slot=\"stucked-title\"]){display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.heading-stuck-content z-button{margin-left:auto}.drawer-trigger{padding:0;border:0;margin:0;appearance:none;background:none;border-radius:0;color:inherit;cursor:pointer}.drawer-trigger z-icon{--z-icon-width:var(--app-header-drawer-trigger-size);--z-icon-height:var(--app-header-drawer-trigger-size);fill:currentcolor}.heading-container :is(.drawer-trigger,z-button.search-page-button){display:flex;height:calc(var(--app-header-title-font-size) * var(--app-header-title-lineheight));align-items:center}.heading-container z-button.search-page-button{margin-left:auto}.drawer-content{display:none}z-offcanvas[open] .drawer-content{display:flex;width:100%;flex:1 auto;flex-direction:column;row-gap:calc(var(--space-unit) * 2.5)}z-offcanvas[open] .drawer-content ::slotted(z-menu){width:100%}.drawer-close{--z-icon-width:var(--app-header-drawer-trigger-size);--z-icon-height:var(--app-header-drawer-trigger-size);padding:0;border:0;margin:var(--space-unit) 0 calc(var(--space-unit) * 2.5);appearance:none;background:transparent;border-radius:0;color:inherit;cursor:pointer;fill:currentcolor;font-size:inherit;outline:none}.drawer-close:focus-visible{box-shadow:var(--shadow-focus-primary)}.hero-container{position:absolute;z-index:0;top:0;left:0;width:100%;height:100%}:host([overlay]) .heading-panel .drawer-trigger z-icon,:host([overlay]) .heading-panel .heading-container,:host([overlay]) .heading-panel .menu-container{color:var(--color-white);fill:var(--color-white)}:host([overlay]) .heading-panel .menu-container ::slotted(z-menu){--z-menu-label-color:var(--color-white)}:host([overlay]) .hero-container::after{position:absolute;z-index:0;top:0;left:0;width:100%;height:100%;background:var(--color-black);content:\"\";opacity:0.5}.hero-container img,.hero-container ::slotted(*){position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:top center;-webkit-user-drag:none}@media (min-width: 768px){:host{--app-header-title-font-size:var(--app-header-typography-6-size);--app-header-title-lineheight:var(--app-header-typography-6-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-6-tracking)}.heading-panel{flex-flow:row wrap;align-items:center;padding-bottom:calc(var(--space-unit) * 2)}.heading-container{margin-right:auto}:host(:is([flow=\"offcanvas\"],[menu-length=\"0\"])) :is(.heading-container,.menu-container){width:auto}:host(:not([flow=\"offcanvas\"])) .heading-subtitle{padding-left:0}.menu-container{flex:initial;align-items:center}:host([menu-length=\"0\"]) .menu-container:not(:empty){height:calc(var(--app-header-title-font-size) * var(--app-header-title-lineheight))}:host(:not([flow=\"offcanvas\"])) .menu-container{gap:var(--space-unit) calc(var(--space-unit) * 5)}:host(:not([flow=\"offcanvas\"])) .heading-container .drawer-trigger{display:none}}@media (min-width: 1152px){:host{--app-header-title-font-size:var(--app-header-typography-7-size);--app-header-title-lineheight:var(--app-header-typography-7-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-7-tracking)}.heading-panel{justify-content:flex-start;padding-bottom:calc(var(--space-unit) * 3)}.heading-container,.menu-container{width:auto}:host([flow=\"stack\"]) .heading-panel{flex-flow:column;align-items:flex-start}:host([flow=\"stack\"]) .menu-container{width:100%}:host(:not([flow=\"offcanvas\"],[menu-length=\"0\"])) .heading-panel{row-gap:calc(var(--space-unit) * 3)}z-searchbar{min-width:calc(var(--space-unit) * 45);flex:initial}}@media (min-width: 1366px){:host{--app-header-title-font-size:var(--app-header-typography-9-size);--app-header-title-lineheight:var(--app-header-typography-9-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-9-tracking)}}@keyframes slide-stuck-heading-in{0%{transform:translate3d(0, -100%, 0)}100%{transform:none}}";
|
|
9
|
-
|
|
10
|
-
const SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== "undefined";
|
|
11
|
-
const ZAppHeader = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.sticking = index.createEvent(this, "sticking", 7);
|
|
15
|
-
/**
|
|
16
|
-
* Stuck mode for the header.
|
|
17
|
-
* You can programmatically set it using an IntersectionObserver.
|
|
18
|
-
*/
|
|
19
|
-
this.stuck = false;
|
|
20
|
-
/**
|
|
21
|
-
* Should place an overlay over the hero image.
|
|
22
|
-
* Useful for legibility purpose.
|
|
23
|
-
*/
|
|
24
|
-
this.overlay = false;
|
|
25
|
-
/**
|
|
26
|
-
* Control menu bar position in the header.
|
|
27
|
-
* - auto: the menu bar is positioned near the title
|
|
28
|
-
* - stack: the menu bar is positioned below the title
|
|
29
|
-
* - offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu
|
|
30
|
-
*/
|
|
31
|
-
this.flow = "auto";
|
|
32
|
-
/**
|
|
33
|
-
* The opening state of the drawer.
|
|
34
|
-
*/
|
|
35
|
-
this.drawerOpen = false;
|
|
36
|
-
/**
|
|
37
|
-
* Enable the search bar.
|
|
38
|
-
*/
|
|
39
|
-
this.enableSearch = false;
|
|
40
|
-
/**
|
|
41
|
-
* Placeholder text for the search bar.
|
|
42
|
-
*/
|
|
43
|
-
this.searchPlaceholder = "Cerca";
|
|
44
|
-
/**
|
|
45
|
-
* Search string for the search bar.
|
|
46
|
-
*/
|
|
47
|
-
this.searchString = "";
|
|
48
|
-
/**
|
|
49
|
-
* The stuck state of the bar.
|
|
50
|
-
*/
|
|
51
|
-
this._stuck = false;
|
|
52
|
-
/**
|
|
53
|
-
* Current viewport.
|
|
54
|
-
* Used to change the aspect of the search button (icon only) on mobile and tablet.
|
|
55
|
-
*/
|
|
56
|
-
this.currentViewport = "mobile";
|
|
57
|
-
this.observer = SUPPORT_INTERSECTION_OBSERVER &&
|
|
58
|
-
new IntersectionObserver(([entry]) => {
|
|
59
|
-
this._stuck = !entry.isIntersecting;
|
|
60
|
-
}, {
|
|
61
|
-
threshold: 0.5,
|
|
62
|
-
});
|
|
63
|
-
this.openDrawer = this.openDrawer.bind(this);
|
|
64
|
-
this.closeDrawer = this.closeDrawer.bind(this);
|
|
65
|
-
this.collectMenuElements = this.collectMenuElements.bind(this);
|
|
66
|
-
}
|
|
67
|
-
evaluateViewport() {
|
|
68
|
-
if (window.innerWidth < 768) {
|
|
69
|
-
this.currentViewport = "mobile";
|
|
70
|
-
}
|
|
71
|
-
else if (window.innerWidth >= 768 && window.innerWidth < 1152) {
|
|
72
|
-
this.currentViewport = "tablet";
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
this.currentViewport = "desktop";
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
onStuck() {
|
|
79
|
-
const scrollParent = this.scrollParent;
|
|
80
|
-
if (!scrollParent) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
this.sticking.emit(this._stuck);
|
|
84
|
-
}
|
|
85
|
-
setMenuFloatingMode() {
|
|
86
|
-
if (this.menuElements.length === 0) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const elements = this.menuElements;
|
|
90
|
-
elements.forEach((element) => {
|
|
91
|
-
element.open = false;
|
|
92
|
-
element.floating = !this.drawerOpen;
|
|
93
|
-
element.verticalContext = this.drawerOpen;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
get title() {
|
|
97
|
-
const titleElement = this.hostElement.querySelector('[slot="title"]');
|
|
98
|
-
if (titleElement === null) {
|
|
99
|
-
return "";
|
|
100
|
-
}
|
|
101
|
-
return titleElement.textContent.trim();
|
|
102
|
-
}
|
|
103
|
-
get scrollParent() {
|
|
104
|
-
const parent = this.hostElement.offsetParent;
|
|
105
|
-
if (parent === document.body || parent === document.documentElement) {
|
|
106
|
-
return window;
|
|
107
|
-
}
|
|
108
|
-
return parent;
|
|
109
|
-
}
|
|
110
|
-
get canShowMenu() {
|
|
111
|
-
return this.flow !== "offcanvas" && this.currentViewport !== "mobile" && !this.drawerOpen;
|
|
112
|
-
}
|
|
113
|
-
get canShowSearchbar() {
|
|
114
|
-
if (!this.enableSearch) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
// Always show the searchbar on desktop, even if a searchPageUrl is set
|
|
118
|
-
if (this.searchPageUrl) {
|
|
119
|
-
return this.currentViewport === "desktop";
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Whether the header has a hero image, either as a prop or as a slot.
|
|
125
|
-
*/
|
|
126
|
-
get hasHero() {
|
|
127
|
-
return !!this.hero || this.hostElement.querySelector("[slot=hero]") !== null;
|
|
128
|
-
}
|
|
129
|
-
openDrawer() {
|
|
130
|
-
this.drawerOpen = true;
|
|
131
|
-
}
|
|
132
|
-
closeDrawer() {
|
|
133
|
-
this.drawerOpen = false;
|
|
134
|
-
}
|
|
135
|
-
collectMenuElements() {
|
|
136
|
-
const menuElements = (this.menuElements = this.hostElement.querySelectorAll('[slot="menu"]'));
|
|
137
|
-
this.menuLength = menuElements.length;
|
|
138
|
-
this.setMenuFloatingMode();
|
|
139
|
-
}
|
|
140
|
-
enableStuckObserver() {
|
|
141
|
-
if (this.observer) {
|
|
142
|
-
this.observer.observe(this.container);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
disableStuckMode() {
|
|
146
|
-
this._stuck = false;
|
|
147
|
-
if (this.observer) {
|
|
148
|
-
this.observer.unobserve(this.container);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
onStuckMode() {
|
|
152
|
-
if (this.stuck) {
|
|
153
|
-
this.enableStuckObserver();
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this.disableStuckMode();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
renderSearchLinkButton() {
|
|
160
|
-
if (!this.enableSearch || !this.searchPageUrl || this.currentViewport === "desktop") {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
return (index.h("z-button", { class: "search-page-button", variant: index$1.ButtonVariant.SECONDARY, href: this.searchPageUrl, icon: "search", size: index$1.ControlSize.X_SMALL }));
|
|
164
|
-
}
|
|
165
|
-
renderSeachbar(searchButtonIconOnly) {
|
|
166
|
-
return (index.h("z-searchbar", { value: this.searchString, placeholder: this.searchPlaceholder, showSearchButton: true, searchButtonIconOnly: searchButtonIconOnly, size: index$1.ControlSize.X_SMALL, variant: index$1.ButtonVariant.SECONDARY, preventSubmit: this.searchString.length < 3, onSearchTyping: (e) => (this.searchString = e.detail) }));
|
|
167
|
-
}
|
|
168
|
-
componentDidLoad() {
|
|
169
|
-
this.collectMenuElements();
|
|
170
|
-
this.onStuckMode();
|
|
171
|
-
this.evaluateViewport();
|
|
172
|
-
}
|
|
173
|
-
render() {
|
|
174
|
-
return (index.h(index.Host, { "menu-length": this.menuLength }, this.hasHero && (index.h("div", { class: "hero-container" }, index.h("slot", { name: "hero" }, this.hero && (index.h("img", { alt: "", src: this.hero }))))), index.h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, index.h("div", { class: "heading-container" }, index.h("div", { class: "heading-subtitle" }, index.h("slot", { name: "top-subtitle" })), index.h("div", { class: "heading-title" }, this.menuLength > 0 && (index.h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, index.h("z-icon", { name: "burger-menu" }))), index.h("slot", { name: "title" }), this.renderSearchLinkButton()), index.h("div", { class: "heading-subtitle" }, index.h("slot", { name: "subtitle" }))), (this.canShowMenu || this.canShowSearchbar) && (index.h("div", { class: "menu-container" }, this.canShowMenu && (index.h("slot", { name: "menu", onSlotchange: this.collectMenuElements })), this.canShowSearchbar && this.renderSeachbar(this.currentViewport !== "desktop")))), index.h("z-offcanvas", { variant: index$1.OffCanvasVariant.OVERLAY, transitiondirection: index$1.TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail) }, index.h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer, slot: "canvasContent", "aria-hidden": `${!this.drawerOpen}`, disabled: !this.drawerOpen }, index.h("z-icon", { name: "close" })), index.h("div", { class: "drawer-content", slot: "canvasContent", "aria-hidden": `${!this.drawerOpen}` }, index.h("slot", { name: "menu", onSlotchange: this.collectMenuElements }))), this._stuck && (index.h("div", { class: "heading-stuck" }, index.h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (index.h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, index.h("z-icon", { name: "burger-menu" }))), index.h("div", { class: "heading-title" }, index.h("slot", { name: "stucked-title" }, this.title)), this.renderSearchLinkButton(), this.canShowSearchbar && this.currentViewport === "desktop" && this.renderSeachbar(false))))));
|
|
175
|
-
}
|
|
176
|
-
get hostElement() { return index.getElement(this); }
|
|
177
|
-
static get watchers() { return {
|
|
178
|
-
"_stuck": ["onStuck"],
|
|
179
|
-
"drawerOpen": ["setMenuFloatingMode"],
|
|
180
|
-
"stuck": ["onStuckMode"]
|
|
181
|
-
}; }
|
|
182
|
-
};
|
|
183
|
-
ZAppHeader.style = stylesCss;
|
|
184
|
-
|
|
185
|
-
exports.z_app_header = ZAppHeader;
|
|
@@ -1,289 +0,0 @@
|
|
|
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-input-h{display:inline-block;width:inherit}input.sc-z-input::-ms-clear,input.sc-z-input::-ms-reveal{display:none}.sc-z-input-h input.sc-z-input::-ms-clear,.sc-z-input-h input.sc-z-input::-ms-reveal{display:none}input.sc-z-input,textarea.sc-z-input,.textarea-wrapper.sc-z-input{box-sizing:border-box;border:var(--border-size-small) solid var(--color-surface04);background:var(--color-input-field01);border-radius:var(--border-radius-small);color:var(--color-text01);fill:var(--color-icon02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg);outline:none}[size=\"small\"].sc-z-input-h input.sc-z-input,[size=\"small\"].sc-z-input-h textarea.sc-z-input,[size=\"small\"].sc-z-input-h .textarea-wrapper.sc-z-input,[size=\"x-small\"].sc-z-input-h input.sc-z-input,[size=\"x-small\"].sc-z-input-h textarea.sc-z-input,[size=\"x-small\"].sc-z-input-h .textarea-wrapper.sc-z-input{font-size:var(--font-size-2)}.cursor-select.sc-z-input-h input.sc-z-input{cursor:pointer}.sc-z-input-h:not(.active-select) input.sc-z-input:focus:focus-visible,[readonly=\"false\"].sc-z-input-h .textarea-wrapper.sc-z-input:focus-within{box-shadow:var(--shadow-focus-primary)}input.sc-z-input:focus:focus-visible,textarea.sc-z-input:focus:focus-visible{color:var(--color-input-field02)}.active-select.sc-z-input-h input.sc-z-input{border:var(--border-size-small) solid var(--blue500)}.cursor-select.sc-z-input-h input.sc-z-input:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-input-h input[readonly].sc-z-input:focus:focus-visible{box-shadow:none}.filled.sc-z-input{border-color:var(--color-surface05)}.input-success.sc-z-input{border-color:var(--color-success01);background:var(--color-success-inverse);fill:var(--color-success01)}.input-error.sc-z-input{border-color:var(--color-error01);background:var(--color-error-inverse);fill:var(--color-error01)}.input-warning.sc-z-input{border-color:var(--color-warning01);background:var(--color-warning-inverse);fill:var(--color-warning01)}input.sc-z-input:not([readonly]):hover,.textarea-wrapper.sc-z-input:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}.sc-z-input-h:not(.active-select) input[readonly].sc-z-input,.readonly.sc-z-input{border-color:var(--color-disabled01);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) .textarea-wrapper.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) z-icon.sc-z-input{border-color:var(--color-disabled01);box-shadow:none;color:var(--color-disabled02);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input:hover{border-width:var(--border-size-small)}input.sc-z-input::placeholder,textarea.sc-z-input::placeholder{color:var(--color-text05)}.sc-z-input::-webkit-textarea-placeholder{color:var(--color-text05)}.sc-z-input:-ms-textarea-placeholder{color:var(--color-text05)}.sc-z-input::placeholder{color:var(--color-text05)}label.input-label.sc-z-input{display:block;padding-bottom:var(--space-unit);color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}[disabled].sc-z-input-h:not([disabled=\"false\"]) label.input-label.sc-z-input{color:var(--color-disabled02)}.text-wrapper.sc-z-input>div.sc-z-input{position:relative;z-index:1;fill:var(--color-icon02)}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{width:100%;height:calc(var(--space-unit) * 5.5);box-sizing:border-box;padding:0 calc(var(--space-unit) * 1.5);margin:0}[size=\"small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4.5)}[size=\"x-small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.sc-z-input,.text-wrapper.sc-z-input>div.sc-z-input>input.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 5.25)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 8)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input{position:absolute;z-index:2;top:50%;right:calc(var(--space-unit) * 1.5);display:flex;pointer-events:none;transform:translateY(-50%)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input{padding:0;border:0;background:none;color:inherit;font:inherit;pointer-events:initial}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input+button.icon-button.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.hidden.sc-z-input{display:none}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.reset-icon.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.toggle-password-icon.sc-z-input{cursor:pointer}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.sc-z-input{--z-icon-width:18px;--z-icon-height:18px;display:block}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.small.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.x-small.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset;-webkit-text-fill-color:currentcolor}.textarea-wrapper.sc-z-input{padding:calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}textarea.sc-z-input::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-track{background-color:transparent}textarea.sc-z-input::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}textarea.sc-z-input{width:100%;min-height:132px;padding:0;border:none;margin:0;resize:none}.radio-wrapper.sc-z-input,.checkbox-wrapper.sc-z-input{position:relative;display:inline-flex;flex-direction:row;align-items:center;color:var(--color-text01);fill:var(--color-primary01);font-family:var(--font-family-sans)}.radio-wrapper.sc-z-input:hover,.checkbox-wrapper.sc-z-input:hover{color:var(--color-hover-primary);fill:currentcolor}.radio-wrapper.sc-z-input>input.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input{position:absolute;z-index:-1;opacity:0;pointer-events:none}.radio-wrapper.sc-z-input .radio-label.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{display:inline-flex;align-items:center;margin:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1;text-transform:inherit}.radio-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.checkbox-label.sc-z-input{cursor:pointer}.radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{cursor:pointer;fill:inherit}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-2)}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:14px;--z-icon-height:14px}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-1)}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input{flex-direction:row}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input{flex-direction:row-reverse}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:var(--space-unit)}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:var(--space-unit)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:calc(var(--space-unit) * 0.5)}.radio-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.checkbox-label.sc-z-input>z-icon.sc-z-input{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input{color:var(--color-disabled02)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input>z-icon.sc-z-input{cursor:default;fill:var(--color-disabled01)}";
|
|
11
|
-
|
|
12
|
-
const ZInput = class {
|
|
13
|
-
constructor(hostRef) {
|
|
14
|
-
index.registerInstance(this, hostRef);
|
|
15
|
-
this.inputChange = index.createEvent(this, "inputChange", 7);
|
|
16
|
-
this.startTyping = index.createEvent(this, "startTyping", 7);
|
|
17
|
-
this.stopTyping = index.createEvent(this, "stopTyping", 7);
|
|
18
|
-
this.inputCheck = index.createEvent(this, "inputCheck", 7);
|
|
19
|
-
/** the id of the input element */
|
|
20
|
-
this.htmlid = `id-${utils.randomId()}`;
|
|
21
|
-
/** the input aria-label */
|
|
22
|
-
this.ariaLabel = "";
|
|
23
|
-
/** the input is disabled */
|
|
24
|
-
this.disabled = false;
|
|
25
|
-
/** the input is readonly */
|
|
26
|
-
this.readonly = false;
|
|
27
|
-
/** the input is required (optional): available for text, password, number, email, textarea, checkbox */
|
|
28
|
-
this.required = false;
|
|
29
|
-
/** checked: available for checkbox, radio */
|
|
30
|
-
this.checked = false;
|
|
31
|
-
/** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */
|
|
32
|
-
this.message = true;
|
|
33
|
-
/** the input label position: available for checkbox, radio */
|
|
34
|
-
this.labelPosition = index$1.LabelPosition.RIGHT;
|
|
35
|
-
/** render clear icon when typing (optional): available for text */
|
|
36
|
-
this.hasclearicon = true;
|
|
37
|
-
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
38
|
-
this.size = index$1.ControlSize.BIG;
|
|
39
|
-
this.isTyping = false;
|
|
40
|
-
this.passwordHidden = true;
|
|
41
|
-
this.typingtimeout = 300;
|
|
42
|
-
}
|
|
43
|
-
inputCheckListener(e) {
|
|
44
|
-
const data = e.detail;
|
|
45
|
-
switch (this.type) {
|
|
46
|
-
case index$1.InputType.RADIO:
|
|
47
|
-
if (data.type === index$1.InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {
|
|
48
|
-
this.checked = false;
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/** get checked status */
|
|
54
|
-
async isChecked() {
|
|
55
|
-
switch (this.type) {
|
|
56
|
-
case index$1.InputType.CHECKBOX:
|
|
57
|
-
case index$1.InputType.RADIO:
|
|
58
|
-
return this.checked;
|
|
59
|
-
default:
|
|
60
|
-
console.warn("`isChecked` method is only available for type `checkbox` and `radio`");
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
emitInputChange(value) {
|
|
65
|
-
if (!this.isTyping) {
|
|
66
|
-
this.emitStartTyping();
|
|
67
|
-
}
|
|
68
|
-
let validity;
|
|
69
|
-
if (this.type === index$1.InputType.TEXTAREA) {
|
|
70
|
-
validity = this.getValidity("textarea");
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
validity = this.getValidity("input");
|
|
74
|
-
}
|
|
75
|
-
this.value = value;
|
|
76
|
-
this.inputChange.emit({ value, validity });
|
|
77
|
-
clearTimeout(this.timer);
|
|
78
|
-
this.timer = setTimeout(() => {
|
|
79
|
-
this.emitStopTyping(this.value, validity);
|
|
80
|
-
}, this.typingtimeout);
|
|
81
|
-
}
|
|
82
|
-
emitStartTyping() {
|
|
83
|
-
this.isTyping = true;
|
|
84
|
-
this.startTyping.emit();
|
|
85
|
-
}
|
|
86
|
-
emitStopTyping(value, validity) {
|
|
87
|
-
this.isTyping = false;
|
|
88
|
-
this.stopTyping.emit({
|
|
89
|
-
value: value,
|
|
90
|
-
validity: validity,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
emitInputCheck(checked) {
|
|
94
|
-
this.inputCheck.emit({
|
|
95
|
-
id: this.htmlid,
|
|
96
|
-
checked: checked,
|
|
97
|
-
type: this.type,
|
|
98
|
-
name: this.name,
|
|
99
|
-
value: this.value,
|
|
100
|
-
validity: this.getValidity("input"),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
getValidity(type) {
|
|
104
|
-
const input = this.hostElement.querySelector(type);
|
|
105
|
-
return input.validity;
|
|
106
|
-
}
|
|
107
|
-
/* START text/password/email/number */
|
|
108
|
-
getTextAttributes() {
|
|
109
|
-
return {
|
|
110
|
-
id: this.htmlid,
|
|
111
|
-
name: this.name,
|
|
112
|
-
placeholder: this.placeholder,
|
|
113
|
-
value: this.value,
|
|
114
|
-
disabled: this.disabled,
|
|
115
|
-
readonly: this.readonly,
|
|
116
|
-
required: this.required,
|
|
117
|
-
title: this.htmltitle,
|
|
118
|
-
minlength: this.minlength,
|
|
119
|
-
maxlength: this.maxlength,
|
|
120
|
-
class: {
|
|
121
|
-
[`input-${this.status}`]: !!this.status,
|
|
122
|
-
filled: !!this.value,
|
|
123
|
-
},
|
|
124
|
-
autocomplete: this.autocomplete,
|
|
125
|
-
onInput: (e) => this.emitInputChange(e.target.value),
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
getNumberAttributes(type) {
|
|
129
|
-
if (type != index$1.InputType.NUMBER) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
min: this.min,
|
|
134
|
-
max: this.max,
|
|
135
|
-
step: this.step,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
getPatternAttribute(type) {
|
|
139
|
-
if (type != index$1.InputType.PASSWORD &&
|
|
140
|
-
type != index$1.InputType.TEXT &&
|
|
141
|
-
type != index$1.InputType.TEL &&
|
|
142
|
-
type != index$1.InputType.SEARCH &&
|
|
143
|
-
type != index$1.InputType.URL &&
|
|
144
|
-
type != index$1.InputType.EMAIL) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
return {
|
|
148
|
-
pattern: this.pattern,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
getRoleAttribute() {
|
|
152
|
-
return this.role ? { role: this.role } : {};
|
|
153
|
-
}
|
|
154
|
-
getAriaAttrubutes() {
|
|
155
|
-
const expanded = this.ariaExpanded ? { "aria-expanded": this.ariaExpanded } : {};
|
|
156
|
-
const controls = this.ariaControls ? { "aria-controls": this.ariaControls } : {};
|
|
157
|
-
const autocomplete = this.ariaAutocomplete ? { "aria-autocomplete": this.ariaAutocomplete } : {};
|
|
158
|
-
const activedescendant = this.ariaActivedescendant ? { "aria-activedescendant": this.ariaActivedescendant } : {};
|
|
159
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, expanded), controls), autocomplete), activedescendant);
|
|
160
|
-
}
|
|
161
|
-
renderInputText(type = index$1.InputType.TEXT) {
|
|
162
|
-
const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
|
|
163
|
-
const attr = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getTextAttributes()), this.getNumberAttributes(type)), this.getPatternAttribute(type)), ariaLabel), this.getRoleAttribute()), this.getAriaAttrubutes());
|
|
164
|
-
if (this.icon || type === index$1.InputType.PASSWORD) {
|
|
165
|
-
Object.assign(attr.class, { "has-icon": true });
|
|
166
|
-
}
|
|
167
|
-
if (this.hasclearicon && type != index$1.InputType.NUMBER) {
|
|
168
|
-
Object.assign(attr.class, { "has-clear-icon": true });
|
|
169
|
-
}
|
|
170
|
-
return (index.h("div", { class: "text-wrapper" }, this.renderLabel(), index.h("div", null, index.h("input", Object.assign({ type: type === index$1.InputType.PASSWORD && !this.passwordHidden ? index$1.InputType.TEXT : type }, attr, { ref: (el) => (this.inputRef = el) })), this.renderIcons()), this.renderMessage()));
|
|
171
|
-
}
|
|
172
|
-
renderLabel() {
|
|
173
|
-
if (!this.label) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
return (index.h("label", { class: "input-label body-5-sb", id: `${this.htmlid}_label`, htmlFor: this.htmlid }, this.label));
|
|
177
|
-
}
|
|
178
|
-
renderIcons() {
|
|
179
|
-
return (index.h("span", { class: "icons-wrapper" }, this.renderResetIcon(), this.renderIcon()));
|
|
180
|
-
}
|
|
181
|
-
renderIcon() {
|
|
182
|
-
if (this.type === index$1.InputType.PASSWORD) {
|
|
183
|
-
return this.renderShowHidePassword();
|
|
184
|
-
}
|
|
185
|
-
if (!this.icon) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
return (index.h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1, "aria-hidden": "true" }, index.h("z-icon", { name: this.icon, class: this.size })));
|
|
189
|
-
}
|
|
190
|
-
renderResetIcon() {
|
|
191
|
-
let hidden = false;
|
|
192
|
-
if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == index$1.InputType.NUMBER) {
|
|
193
|
-
hidden = true;
|
|
194
|
-
}
|
|
195
|
-
return (index.h("button", { type: "button", class: `icon-button reset-icon ${hidden ? "hidden" : ""}`, "aria-label": "cancella il contenuto dell'input", onClick: () => {
|
|
196
|
-
this.inputRef.value = "";
|
|
197
|
-
this.emitInputChange("");
|
|
198
|
-
} }, index.h("z-icon", { name: "multiply", class: this.size })));
|
|
199
|
-
}
|
|
200
|
-
renderShowHidePassword() {
|
|
201
|
-
return (index.h("button", { type: "button", class: "icon-button toggle-password-icon", disabled: this.disabled, "aria-label": this.passwordHidden ? "mostra password" : "nascondi password", onClick: () => (this.passwordHidden = !this.passwordHidden) }, index.h("z-icon", { name: this.passwordHidden ? "view-filled" : "view-off-filled", class: this.size })));
|
|
202
|
-
}
|
|
203
|
-
renderMessage() {
|
|
204
|
-
if (utils.boolean(this.message) === false) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
return (index.h("z-input-message", { message: utils.boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
|
|
208
|
-
}
|
|
209
|
-
/* END text/password/email/number */
|
|
210
|
-
/* START textarea */
|
|
211
|
-
renderTextarea() {
|
|
212
|
-
const attributes = this.getTextAttributes();
|
|
213
|
-
const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
|
|
214
|
-
return (index.h("div", { class: "text-wrapper" }, this.renderLabel(), index.h("div", { class: Object.assign(Object.assign({}, attributes.class), { "textarea-wrapper": true, "readonly": attributes.readonly }) }, index.h("textarea", Object.assign({}, attributes, ariaLabel, this.getRoleAttribute()))), this.renderMessage()));
|
|
215
|
-
}
|
|
216
|
-
/* END textarea */
|
|
217
|
-
handleCheck(ev) {
|
|
218
|
-
this.checked = ev.target.checked;
|
|
219
|
-
this.emitInputCheck(this.checked);
|
|
220
|
-
}
|
|
221
|
-
/* START checkbox */
|
|
222
|
-
renderCheckbox() {
|
|
223
|
-
return (index.h("div", { class: "checkbox-wrapper" }, index.h("input", Object.assign({ id: this.htmlid, type: "checkbox", name: this.name, checked: this.checked, disabled: this.disabled, readonly: this.readonly, required: this.required, onChange: this.handleCheck.bind(this), value: this.value }, this.getRoleAttribute())), index.h("label", { htmlFor: this.htmlid, class: {
|
|
224
|
-
"checkbox-label": true,
|
|
225
|
-
"after": this.labelPosition === index$1.LabelPosition.RIGHT,
|
|
226
|
-
"before": this.labelPosition === index$1.LabelPosition.LEFT,
|
|
227
|
-
} }, index.h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true", class: this.size }), this.label && index.h("span", { innerHTML: this.label }))));
|
|
228
|
-
}
|
|
229
|
-
/* END checkbox */
|
|
230
|
-
/* START radio */
|
|
231
|
-
renderRadio() {
|
|
232
|
-
return (index.h("div", { class: "radio-wrapper" }, index.h("input", Object.assign({ id: this.htmlid, type: "radio", name: this.name, checked: this.checked, disabled: this.disabled, readonly: this.readonly, onChange: this.handleCheck.bind(this), value: this.value }, this.getRoleAttribute())), index.h("label", { htmlFor: this.htmlid, class: {
|
|
233
|
-
"radio-label": true,
|
|
234
|
-
"after": this.labelPosition === index$1.LabelPosition.RIGHT,
|
|
235
|
-
"before": this.labelPosition === index$1.LabelPosition.LEFT,
|
|
236
|
-
} }, index.h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true", class: this.size }), this.label && index.h("span", { innerHTML: this.label }))));
|
|
237
|
-
}
|
|
238
|
-
/* END radio */
|
|
239
|
-
render() {
|
|
240
|
-
let input;
|
|
241
|
-
switch (this.type) {
|
|
242
|
-
case index$1.InputType.TEXTAREA:
|
|
243
|
-
input = this.renderTextarea();
|
|
244
|
-
break;
|
|
245
|
-
case index$1.InputType.CHECKBOX:
|
|
246
|
-
input = this.renderCheckbox();
|
|
247
|
-
break;
|
|
248
|
-
case index$1.InputType.RADIO:
|
|
249
|
-
input = this.renderRadio();
|
|
250
|
-
break;
|
|
251
|
-
default:
|
|
252
|
-
input = this.renderInputText(this.type);
|
|
253
|
-
}
|
|
254
|
-
return index.h(index.Host, null, input);
|
|
255
|
-
}
|
|
256
|
-
get hostElement() { return index.getElement(this); }
|
|
257
|
-
};
|
|
258
|
-
ZInput.style = stylesCss$1;
|
|
259
|
-
|
|
260
|
-
const stylesCss = ":host{display:flex;min-height:calc(var(--space-unit) * 2.5);align-items:start;margin-top:var(--space-unit);color:var(--color-text05);fill:currentcolor;font-family:var(--font-family-sans);font-size:var(--font-size-2);letter-spacing:0.16px}:host(.small),:host(.x-small){margin-top:calc(var(--space-unit) * 0.5);font-size:var(--font-size-1)}:host([status=\"success\"]){color:var(--color-text-success)}:host([status=\"error\"]){color:var(--color-text-error)}:host([status=\"warning\"]){color:var(--color-warning02)}:host(:focus){outline:none}:host>z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);--z-icon-right-margin:var(--space-unit);margin-top:calc(var(--space-unit) * 0.25)}:host(.small)>z-icon,:host(.x-small)>z-icon{--z-icon-width:14px;--z-icon-height:14px;--z-icon-right-margin:calc(var(--space-unit) * 0.5)}";
|
|
261
|
-
|
|
262
|
-
const ZInputMessage = class {
|
|
263
|
-
constructor(hostRef) {
|
|
264
|
-
index.registerInstance(this, hostRef);
|
|
265
|
-
this.statusIcons = {
|
|
266
|
-
success: "checkmark-circle",
|
|
267
|
-
error: "multiply-circled",
|
|
268
|
-
warning: "exclamation-circle",
|
|
269
|
-
};
|
|
270
|
-
this.statusRole = {};
|
|
271
|
-
}
|
|
272
|
-
onMessageChange() {
|
|
273
|
-
this.statusRole = this.message && this.status ? { role: "alert" } : {};
|
|
274
|
-
}
|
|
275
|
-
componentWillLoad() {
|
|
276
|
-
this.onMessageChange();
|
|
277
|
-
}
|
|
278
|
-
render() {
|
|
279
|
-
return (index.h(index.Host, Object.assign({}, this.statusRole, { "aria-label": this.message }), this.statusIcons[this.status] && this.message && index.h("z-icon", { name: this.statusIcons[this.status] }), index.h("span", { innerHTML: this.message })));
|
|
280
|
-
}
|
|
281
|
-
static get watchers() { return {
|
|
282
|
-
"message": ["onMessageChange"],
|
|
283
|
-
"status": ["onMessageChange"]
|
|
284
|
-
}; }
|
|
285
|
-
};
|
|
286
|
-
ZInputMessage.style = stylesCss;
|
|
287
|
-
|
|
288
|
-
exports.z_input = ZInput;
|
|
289
|
-
exports.z_input_message = ZInputMessage;
|