@zanichelli/albe-web-components 9.2.4-beta2 → 9.3.0-rc1

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.
Files changed (105) hide show
  1. package/dist/cjs/index-e3299e0a.js +4 -12
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/web-components-library.cjs.js +1 -1
  4. package/dist/cjs/z-app-header_14.cjs.entry.js +2828 -0
  5. package/dist/cjs/z-dragdrop-area.cjs.entry.js +37 -0
  6. package/dist/collection/components/modal/z-modal/index.js +18 -17
  7. package/dist/collection/components/modal/z-modal/styles.css +61 -24
  8. package/dist/esm/{index-d3dfe710.js → index-5b83b0b1.js} +1 -1
  9. package/dist/esm/{index-1b2e3e53.js → index-8528dee0.js} +1 -1
  10. package/dist/esm/index-a2ca4b97.js +4 -12
  11. package/dist/esm/index.js +1 -1
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/esm/{utils-4d2d99d9.js → utils-6c83dfcb.js} +1 -1
  14. package/dist/esm/web-components-library.js +1 -1
  15. package/dist/esm/z-app-header_14.entry.js +2811 -0
  16. package/dist/esm/z-book-card.entry.js +1 -1
  17. package/dist/esm/z-breadcrumb.entry.js +1 -1
  18. package/dist/esm/z-chip.entry.js +1 -1
  19. package/dist/esm/z-combobox.entry.js +1 -1
  20. package/dist/esm/z-dragdrop-area.entry.js +33 -0
  21. package/dist/esm/z-file-upload.entry.js +1 -1
  22. package/dist/esm/z-myz-card-info.entry.js +1 -1
  23. package/dist/esm/z-myz-list-item.entry.js +1 -1
  24. package/dist/esm/z-pocket_3.entry.js +1 -1
  25. package/dist/esm/z-skip-to-content.entry.js +1 -1
  26. package/dist/esm/z-slideshow.entry.js +1 -1
  27. package/dist/esm/z-table-deprecated.entry.js +2 -2
  28. package/dist/esm/z-table-header.entry.js +2 -2
  29. package/dist/esm/z-table.entry.js +2 -2
  30. package/dist/esm/z-toggle-switch.entry.js +1 -1
  31. package/dist/esm/z-tr.entry.js +2 -2
  32. package/dist/types/components/modal/z-modal/index.d.ts +2 -2
  33. package/dist/types/components.d.ts +4 -4
  34. package/dist/web-components-library/index.esm.js +1 -1
  35. package/dist/web-components-library/p-052c06ac.entry.js +1 -0
  36. package/dist/web-components-library/{p-37e8194f.entry.js → p-13ac8bd3.entry.js} +1 -1
  37. package/dist/web-components-library/{p-65dd23d7.js → p-327b7b79.js} +1 -1
  38. package/dist/web-components-library/{p-f2eaa685.entry.js → p-3ee4aa12.entry.js} +1 -1
  39. package/dist/web-components-library/{p-a6a09ce6.entry.js → p-432a2f5b.entry.js} +1 -1
  40. package/dist/web-components-library/{p-f3408275.entry.js → p-438f017e.entry.js} +1 -1
  41. package/dist/web-components-library/p-466c3c0b.entry.js +1 -0
  42. package/dist/web-components-library/p-76c2c26d.entry.js +1 -0
  43. package/dist/web-components-library/{p-1cbd8a5f.entry.js → p-7eb6d043.entry.js} +1 -1
  44. package/{www/build/p-c1f20cec.entry.js → dist/web-components-library/p-7f43e400.entry.js} +1 -1
  45. package/dist/web-components-library/{p-dd3e0b4e.js → p-91447194.js} +1 -1
  46. package/dist/web-components-library/{p-8b2bf3b4.entry.js → p-aa8b0c95.entry.js} +1 -1
  47. package/dist/web-components-library/p-b2420056.entry.js +1 -0
  48. package/dist/web-components-library/{p-69bde29c.entry.js → p-b3093245.entry.js} +1 -1
  49. package/dist/web-components-library/{p-fc8f0f1a.entry.js → p-c1de287b.entry.js} +1 -1
  50. package/dist/web-components-library/{p-cb07de86.entry.js → p-c8bd65d9.entry.js} +1 -1
  51. package/dist/web-components-library/{p-2d0ac109.entry.js → p-c99acff4.entry.js} +1 -1
  52. package/dist/web-components-library/{p-2f013f10.entry.js → p-dca0db1b.entry.js} +1 -1
  53. package/dist/web-components-library/{p-d7668580.js → p-eb9fa72b.js} +1 -1
  54. package/dist/web-components-library/p-f01f4e9b.entry.js +16 -0
  55. package/dist/web-components-library/web-components-library.esm.js +1 -1
  56. package/package.json +1 -1
  57. package/www/build/index.esm.js +1 -1
  58. package/www/build/p-052c06ac.entry.js +1 -0
  59. package/www/build/{p-37e8194f.entry.js → p-13ac8bd3.entry.js} +1 -1
  60. package/www/build/{p-65dd23d7.js → p-327b7b79.js} +1 -1
  61. package/www/build/p-39b528a6.js +129 -0
  62. package/www/build/{p-f2eaa685.entry.js → p-3ee4aa12.entry.js} +1 -1
  63. package/www/build/{p-a6a09ce6.entry.js → p-432a2f5b.entry.js} +1 -1
  64. package/www/build/{p-f3408275.entry.js → p-438f017e.entry.js} +1 -1
  65. package/www/build/p-466c3c0b.entry.js +1 -0
  66. package/www/build/p-5a0a4f69.css +1653 -0
  67. package/www/build/p-76c2c26d.entry.js +1 -0
  68. package/www/build/{p-1cbd8a5f.entry.js → p-7eb6d043.entry.js} +1 -1
  69. package/{dist/web-components-library/p-c1f20cec.entry.js → www/build/p-7f43e400.entry.js} +1 -1
  70. package/www/build/{p-dd3e0b4e.js → p-91447194.js} +1 -1
  71. package/www/build/{p-8b2bf3b4.entry.js → p-aa8b0c95.entry.js} +1 -1
  72. package/www/build/p-b2420056.entry.js +1 -0
  73. package/www/build/{p-69bde29c.entry.js → p-b3093245.entry.js} +1 -1
  74. package/www/build/{p-fc8f0f1a.entry.js → p-c1de287b.entry.js} +1 -1
  75. package/www/build/{p-cb07de86.entry.js → p-c8bd65d9.entry.js} +1 -1
  76. package/www/build/{p-2d0ac109.entry.js → p-c99acff4.entry.js} +1 -1
  77. package/www/build/{p-2f013f10.entry.js → p-dca0db1b.entry.js} +1 -1
  78. package/www/build/{p-d7668580.js → p-eb9fa72b.js} +1 -1
  79. package/www/build/p-f01f4e9b.entry.js +16 -0
  80. package/www/build/web-components-library.esm.js +1 -1
  81. package/www/index.html +59 -1
  82. package/dist/cjs/z-app-header_11.cjs.entry.js +0 -1056
  83. package/dist/cjs/z-date-picker.cjs.entry.js +0 -477
  84. package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +0 -1015
  85. package/dist/cjs/z-select.cjs.entry.js +0 -333
  86. package/dist/esm/z-app-header_11.entry.js +0 -1042
  87. package/dist/esm/z-date-picker.entry.js +0 -473
  88. package/dist/esm/z-dragdrop-area_2.entry.js +0 -1010
  89. package/dist/esm/z-select.entry.js +0 -329
  90. package/dist/web-components-library/p-06d2f371.entry.js +0 -1
  91. package/dist/web-components-library/p-09be4e46.entry.js +0 -1
  92. package/dist/web-components-library/p-2d600a28.entry.js +0 -1
  93. package/dist/web-components-library/p-386bdb7f.entry.js +0 -1
  94. package/dist/web-components-library/p-3e61bad0.entry.js +0 -1
  95. package/dist/web-components-library/p-9829f5bd.entry.js +0 -16
  96. package/dist/web-components-library/p-ad47fe7d.entry.js +0 -1
  97. package/www/build/p-06d2f371.entry.js +0 -1
  98. package/www/build/p-09be4e46.entry.js +0 -1
  99. package/www/build/p-2d600a28.entry.js +0 -1
  100. package/www/build/p-386bdb7f.entry.js +0 -1
  101. package/www/build/p-39ac174d.css +0 -2
  102. package/www/build/p-3e61bad0.entry.js +0 -1
  103. package/www/build/p-4392fcb5.js +0 -1
  104. package/www/build/p-9829f5bd.entry.js +0 -16
  105. package/www/build/p-ad47fe7d.entry.js +0 -1
@@ -0,0 +1,2811 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a2ca4b97.js';
2
+ import { O as OffCanvasVariant, v as TransitionDirection, B as ButtonVariant, e as ControlSize, c as ButtonType, z as ZDatePickerMode, G as ZDatePickerPosition, I as InputType, D as DividerSize, h as DividerOrientation, k as LabelPosition, i as ListSize, m as ListType, j as ExpandableListButtonAlign, l as ListDividerType, E as ExpandableListStyle, g as KeyboardCode } from './index-03c8b0f0.js';
3
+ import { f as flatpickr, i as it, s as setAriaOptions, a as setFlatpickrPosition, v as validateDate } from './utils-14a10b2b.js';
4
+ import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-9943807e.js';
5
+ import { I as ICONS } from './icons-4b57811d.js';
6
+ import { r as randomId, b as boolean, h as handleEnterKeydSubmit, g as getElementTree, a as handleKeyboardSubmit, d as getClickedElement } from './utils-6c83dfcb.js';
7
+ import './breakpoints-9b81eb1b.js';
8
+
9
+ const stylesCss$d = ":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=\"subtitle\"]){margin:0;font-family:var(--font-family-sans);font-size:20px;font-style:italic;font-weight:500;line-height:26px}.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>*,.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}}";
10
+
11
+ const SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== "undefined";
12
+ const ZAppHeader = class {
13
+ constructor(hostRef) {
14
+ registerInstance(this, hostRef);
15
+ this.sticking = createEvent(this, "sticking", 7);
16
+ /**
17
+ * Stuck mode for the header.
18
+ * You can programmatically set it using an IntersectionObserver.
19
+ */
20
+ this.stuck = false;
21
+ /**
22
+ * Should place an overlay over the hero image.
23
+ * Useful for legibility purpose.
24
+ */
25
+ this.overlay = false;
26
+ /**
27
+ * Control menu bar position in the header.
28
+ * - auto: the menu bar is positioned near the title
29
+ * - stack: the menu bar is positioned below the title
30
+ * - offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu
31
+ */
32
+ this.flow = "auto";
33
+ /**
34
+ * The opening state of the drawer.
35
+ */
36
+ this.drawerOpen = false;
37
+ /**
38
+ * Enable the search bar.
39
+ */
40
+ this.enableSearch = false;
41
+ /**
42
+ * Placeholder text for the search bar.
43
+ */
44
+ this.searchPlaceholder = "Cerca";
45
+ /**
46
+ * Search string for the search bar.
47
+ */
48
+ this.searchString = "";
49
+ /**
50
+ * The stuck state of the bar.
51
+ */
52
+ this._stuck = false;
53
+ /**
54
+ * Current viewport.
55
+ * Used to change the aspect of the search button (icon only) on mobile and tablet.
56
+ */
57
+ this.currentViewport = "mobile";
58
+ this.observer = SUPPORT_INTERSECTION_OBSERVER &&
59
+ new IntersectionObserver(([entry]) => {
60
+ this._stuck = !entry.isIntersecting;
61
+ }, {
62
+ threshold: 0.5,
63
+ });
64
+ this.openDrawer = this.openDrawer.bind(this);
65
+ this.closeDrawer = this.closeDrawer.bind(this);
66
+ this.collectMenuElements = this.collectMenuElements.bind(this);
67
+ }
68
+ evaluateViewport() {
69
+ if (window.innerWidth < 768) {
70
+ this.currentViewport = "mobile";
71
+ }
72
+ else if (window.innerWidth >= 768 && window.innerWidth < 1152) {
73
+ this.currentViewport = "tablet";
74
+ }
75
+ else {
76
+ this.currentViewport = "desktop";
77
+ }
78
+ }
79
+ onStuck() {
80
+ const scrollParent = this.scrollParent;
81
+ if (!scrollParent) {
82
+ return;
83
+ }
84
+ this.sticking.emit(this._stuck);
85
+ }
86
+ setMenuFloatingMode() {
87
+ if (this.menuElements.length === 0) {
88
+ return;
89
+ }
90
+ const elements = this.menuElements;
91
+ elements.forEach((element) => {
92
+ element.open = false;
93
+ element.floating = !this.drawerOpen;
94
+ element.verticalContext = this.drawerOpen;
95
+ });
96
+ }
97
+ get title() {
98
+ const titleElement = this.hostElement.querySelector('[slot="title"]');
99
+ if (titleElement === null) {
100
+ return "";
101
+ }
102
+ return titleElement.textContent.trim();
103
+ }
104
+ get scrollParent() {
105
+ const parent = this.hostElement.offsetParent;
106
+ if (parent === document.body || parent === document.documentElement) {
107
+ return window;
108
+ }
109
+ return parent;
110
+ }
111
+ get canShowMenu() {
112
+ return this.flow !== "offcanvas" && this.currentViewport !== "mobile" && !this.drawerOpen;
113
+ }
114
+ get canShowSearchbar() {
115
+ if (!this.enableSearch) {
116
+ return false;
117
+ }
118
+ // Always show the searchbar on desktop, even if a searchPageUrl is set
119
+ if (this.searchPageUrl) {
120
+ return this.currentViewport === "desktop";
121
+ }
122
+ return true;
123
+ }
124
+ /**
125
+ * Whether the header has a hero image, either as a prop or as a slot.
126
+ */
127
+ get hasHero() {
128
+ return !!this.hero || this.hostElement.querySelector("[slot=hero]") !== null;
129
+ }
130
+ openDrawer() {
131
+ this.drawerOpen = true;
132
+ }
133
+ closeDrawer() {
134
+ this.drawerOpen = false;
135
+ }
136
+ collectMenuElements() {
137
+ const menuElements = (this.menuElements = this.hostElement.querySelectorAll('[slot="menu"]'));
138
+ this.menuLength = menuElements.length;
139
+ this.setMenuFloatingMode();
140
+ }
141
+ enableStuckObserver() {
142
+ if (this.observer) {
143
+ this.observer.observe(this.container);
144
+ }
145
+ }
146
+ disableStuckMode() {
147
+ this._stuck = false;
148
+ if (this.observer) {
149
+ this.observer.unobserve(this.container);
150
+ }
151
+ }
152
+ onStuckMode() {
153
+ if (this.stuck) {
154
+ this.enableStuckObserver();
155
+ }
156
+ else {
157
+ this.disableStuckMode();
158
+ }
159
+ }
160
+ renderSearchLinkButton() {
161
+ if (!this.enableSearch || !this.searchPageUrl || this.currentViewport === "desktop") {
162
+ return null;
163
+ }
164
+ return (h("z-button", { class: "search-page-button", variant: ButtonVariant.SECONDARY, href: this.searchPageUrl, icon: "search", size: ControlSize.X_SMALL }));
165
+ }
166
+ renderSeachbar(searchButtonIconOnly) {
167
+ return (h("z-searchbar", { value: this.searchString, placeholder: this.searchPlaceholder, showSearchButton: true, searchButtonIconOnly: searchButtonIconOnly, size: ControlSize.X_SMALL, variant: ButtonVariant.SECONDARY, preventSubmit: this.searchString.length < 3, onSearchTyping: (e) => (this.searchString = e.detail) }));
168
+ }
169
+ componentDidLoad() {
170
+ this.collectMenuElements();
171
+ this.onStuckMode();
172
+ this.evaluateViewport();
173
+ }
174
+ render() {
175
+ return (h(Host, { "menu-length": this.menuLength }, this.hasHero && (h("div", { class: "hero-container" }, h("slot", { name: "hero" }, this.hero && (h("img", { alt: "", src: this.hero }))))), h("div", { class: "heading-panel", ref: (el) => (this.container = el) }, h("div", { class: "heading-container" }, h("div", { class: "heading-title" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("slot", { name: "title" }), this.renderSearchLinkButton()), h("div", { class: "heading-subtitle" }, h("slot", { name: "subtitle" }))), (this.canShowMenu || this.canShowSearchbar) && (h("div", { class: "menu-container" }, this.canShowMenu && (h("slot", { name: "menu", onSlotchange: this.collectMenuElements })), this.canShowSearchbar && this.renderSeachbar(this.currentViewport !== "desktop")))), h("z-offcanvas", { variant: OffCanvasVariant.OVERLAY, transitiondirection: TransitionDirection.RIGHT, open: this.drawerOpen, onCanvasOpenStatusChanged: (ev) => (this.drawerOpen = ev.detail) }, h("button", { class: "drawer-close", "aria-label": "Chiudi menu", onClick: this.closeDrawer, slot: "canvasContent" }, h("z-icon", { name: "close" })), h("div", { class: "drawer-content", slot: "canvasContent", "aria-hidden": !this.drawerOpen }, h("slot", { name: "menu", onSlotchange: this.collectMenuElements }))), this._stuck && (h("div", { class: "heading-stuck" }, h("div", { class: "heading-stuck-content" }, this.menuLength > 0 && (h("button", { class: "drawer-trigger", "aria-label": "Apri menu", onClick: this.openDrawer }, h("z-icon", { name: "burger-menu" }))), h("div", { class: "heading-title" }, h("slot", { name: "stucked-title" }, this.title)), this.renderSearchLinkButton(), this.canShowSearchbar && this.currentViewport === "desktop" && this.renderSeachbar(false))))));
176
+ }
177
+ get hostElement() { return getElement(this); }
178
+ static get watchers() { return {
179
+ "_stuck": ["onStuck"],
180
+ "drawerOpen": ["setMenuFloatingMode"],
181
+ "stuck": ["onStuckMode"]
182
+ }; }
183
+ };
184
+ ZAppHeader.style = stylesCss$d;
185
+
186
+ const stylesCss$c = ".sc-z-button-h{display:inline-block;--z-icon-width:16px;--z-icon-height:16px;--z-icon-right-margin:0}[disabled].sc-z-button-h:not([disabled=\"false\"]){pointer-events:none}.sc-z-button-h .z-button--container.sc-z-button{display:inline-flex;width:100%;box-sizing:border-box;align-items:center;justify-content:center;padding:0;border-width:var(--border-size-medium);border-style:solid;border-radius:var(--border-radius);cursor:pointer;fill:currentcolor;font-family:var(--font-family-sans);font-size:14px;font-weight:var(--font-sb);letter-spacing:0.3px;line-height:1;outline:none;text-decoration:none;text-transform:uppercase;white-space:nowrap}.sc-z-button-h .z-button--container.sc-z-button:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-button-h .z-button--container.z-button--has-text.sc-z-button{min-width:calc(var(--space-unit) * 8);padding:0 calc(var(--space-unit) * 2)}.sc-z-button-h .z-button--container.z-button--has-text.sc-z-button z-icon.sc-z-button{--z-icon-right-margin:var(--space-unit)}[size=\"big\"].sc-z-button-h .z-button--container.sc-z-button{min-width:44px;height:44px}[size=\"small\"].sc-z-button-h .z-button--container.sc-z-button{min-width:36px;height:36px}[size=\"x-small\"].sc-z-button-h .z-button--container.sc-z-button{min-width:32px;height:32px}[variant=\"primary\"].sc-z-button-h .z-button--container.sc-z-button{border-color:var(--color-primary01);background-color:var(--color-primary01);color:var(--color-text-inverse)}@media (hover: hover){[variant=\"primary\"].sc-z-button-h .z-button--container.sc-z-button:hover{border-color:var(--color-hover-primary);background-color:var(--color-hover-primary);color:var(--color-text-inverse)}}[variant=\"primary\"].sc-z-button-h .z-button--container.sc-z-button:active{border-color:var(--color-pressed-primary);background-color:var(--color-pressed-primary);box-shadow:var(--shadow-2);color:var(--color-text-inverse)}[variant=\"primary\"][disabled].sc-z-button-h:not([disabled=\"false\"]) .z-button--container.sc-z-button{border-color:var(--color-disabled01);background-color:var(--color-disabled01);color:var(--color-disabled02)}[variant=\"secondary\"].sc-z-button-h .z-button--container.sc-z-button{border-color:var(--color-primary01);background-color:var(--color-surface01);color:var(--color-primary01)}@media (hover: hover){[variant=\"secondary\"].sc-z-button-h .z-button--container.sc-z-button:hover{border-color:var(--color-hover-primary);background-color:var(--color-surface01);color:var(--color-hover-primary)}}[variant=\"secondary\"].sc-z-button-h .z-button--container.sc-z-button:active{border-color:var(--color-pressed-primary);background-color:var(--color-surface01);box-shadow:var(--shadow-2);color:var(--color-pressed-primary)}[variant=\"secondary\"][disabled].sc-z-button-h:not([disabled=\"false\"]) .z-button--container.sc-z-button{border-color:var(--color-disabled01);background-color:var(--color-surface01);color:var(--color-disabled02)}[variant=\"tertiary\"].sc-z-button-h .z-button--container.sc-z-button{border-color:transparent;background-color:transparent;color:var(--color-primary01)}@media (hover: hover){[variant=\"tertiary\"].sc-z-button-h .z-button--container.sc-z-button:hover{border-color:var(--color-primary03);background-color:var(--color-primary03);color:var(--color-hover-primary)}}[variant=\"tertiary\"].sc-z-button-h .z-button--container.sc-z-button:focus:focus-visible{border-color:var(--color-surface01);background-color:var(--color-surface01);color:var(--color-primary01)}[variant=\"tertiary\"].sc-z-button-h .z-button--container.sc-z-button:active{border-color:var(--color-surface01);background-color:var(--color-surface01);box-shadow:var(--shadow-2);color:var(--color-primary01)}[variant=\"tertiary\"][disabled].sc-z-button-h:not([disabled=\"false\"]) .z-button--container.sc-z-button{border-color:transparent;background-color:transparent;color:var(--color-disabled02)}";
187
+
188
+ const ZButton = class {
189
+ constructor(hostRef) {
190
+ registerInstance(this, hostRef);
191
+ /** defines a string value that labels an interactive element, used for accessibility. */
192
+ this.ariaLabel = "";
193
+ /** HTML button disabled attribute. */
194
+ this.disabled = false;
195
+ /** HTML button type attribute. */
196
+ this.type = ButtonType.BUTTON;
197
+ /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
198
+ this.variant = ButtonVariant.PRIMARY;
199
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
200
+ this.size = ControlSize.BIG;
201
+ }
202
+ getAttributes() {
203
+ return {
204
+ id: this.htmlid,
205
+ class: {
206
+ "z-button--container": true,
207
+ "z-button--has-text": !!this.hostElement.textContent.trim(),
208
+ },
209
+ };
210
+ }
211
+ render() {
212
+ if (this.href) {
213
+ return (h("a", Object.assign({}, this.getAttributes(), { "aria-label": this.ariaLabel, href: this.href, target: this.target }), this.icon && (h("z-icon", { name: this.icon, width: 16, height: 16 })), h("slot", null)));
214
+ }
215
+ return (h("button", Object.assign({}, this.getAttributes(), { "aria-label": this.ariaLabel, name: this.name, type: this.type, disabled: this.disabled }), this.icon && (h("z-icon", { name: this.icon, width: 16, height: 16 })), h("slot", null)));
216
+ }
217
+ get hostElement() { return getElement(this); }
218
+ };
219
+ ZButton.style = stylesCss$c;
220
+
221
+ var monthSelect = createCommonjsModule(function (module, exports) {
222
+ (function (global, factory) {
223
+ module.exports = factory() ;
224
+ }(commonjsGlobal, (function () {
225
+ /*! *****************************************************************************
226
+ Copyright (c) Microsoft Corporation.
227
+
228
+ Permission to use, copy, modify, and/or distribute this software for any
229
+ purpose with or without fee is hereby granted.
230
+
231
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
232
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
233
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
234
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
235
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
236
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
237
+ PERFORMANCE OF THIS SOFTWARE.
238
+ ***************************************************************************** */
239
+
240
+ var __assign = function() {
241
+ __assign = Object.assign || function __assign(t) {
242
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
243
+ s = arguments[i];
244
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
245
+ }
246
+ return t;
247
+ };
248
+ return __assign.apply(this, arguments);
249
+ };
250
+
251
+ var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; };
252
+
253
+ function clearNode(node) {
254
+ while (node.firstChild)
255
+ node.removeChild(node.firstChild);
256
+ }
257
+ function getEventTarget(event) {
258
+ try {
259
+ if (typeof event.composedPath === "function") {
260
+ var path = event.composedPath();
261
+ return path[0];
262
+ }
263
+ return event.target;
264
+ }
265
+ catch (error) {
266
+ return event.target;
267
+ }
268
+ }
269
+
270
+ var defaultConfig = {
271
+ shorthand: false,
272
+ dateFormat: "F Y",
273
+ altFormat: "F Y",
274
+ theme: "light",
275
+ };
276
+ function monthSelectPlugin(pluginConfig) {
277
+ var config = __assign(__assign({}, defaultConfig), pluginConfig);
278
+ return function (fp) {
279
+ fp.config.dateFormat = config.dateFormat;
280
+ fp.config.altFormat = config.altFormat;
281
+ var self = { monthsContainer: null };
282
+ function clearUnnecessaryDOMElements() {
283
+ if (!fp.rContainer)
284
+ return;
285
+ clearNode(fp.rContainer);
286
+ for (var index = 0; index < fp.monthElements.length; index++) {
287
+ var element = fp.monthElements[index];
288
+ if (!element.parentNode)
289
+ continue;
290
+ element.parentNode.removeChild(element);
291
+ }
292
+ }
293
+ function build() {
294
+ if (!fp.rContainer)
295
+ return;
296
+ self.monthsContainer = fp._createElement("div", "flatpickr-monthSelect-months");
297
+ self.monthsContainer.tabIndex = -1;
298
+ buildMonths();
299
+ fp.rContainer.appendChild(self.monthsContainer);
300
+ fp.calendarContainer.classList.add("flatpickr-monthSelect-theme-" + config.theme);
301
+ }
302
+ function buildMonths() {
303
+ if (!self.monthsContainer)
304
+ return;
305
+ clearNode(self.monthsContainer);
306
+ var frag = document.createDocumentFragment();
307
+ for (var i = 0; i < 12; i++) {
308
+ var month = fp.createDay("flatpickr-monthSelect-month", new Date(fp.currentYear, i), 0, i);
309
+ if (month.dateObj.getMonth() === new Date().getMonth() &&
310
+ month.dateObj.getFullYear() === new Date().getFullYear())
311
+ month.classList.add("today");
312
+ month.textContent = monthToStr(i, config.shorthand, fp.l10n);
313
+ month.addEventListener("click", selectMonth);
314
+ frag.appendChild(month);
315
+ }
316
+ self.monthsContainer.appendChild(frag);
317
+ if (fp.config.minDate &&
318
+ fp.currentYear === fp.config.minDate.getFullYear())
319
+ fp.prevMonthNav.classList.add("flatpickr-disabled");
320
+ else
321
+ fp.prevMonthNav.classList.remove("flatpickr-disabled");
322
+ if (fp.config.maxDate &&
323
+ fp.currentYear === fp.config.maxDate.getFullYear())
324
+ fp.nextMonthNav.classList.add("flatpickr-disabled");
325
+ else
326
+ fp.nextMonthNav.classList.remove("flatpickr-disabled");
327
+ }
328
+ function bindEvents() {
329
+ fp._bind(fp.prevMonthNav, "click", function (e) {
330
+ e.preventDefault();
331
+ e.stopPropagation();
332
+ fp.changeYear(fp.currentYear - 1);
333
+ selectYear();
334
+ buildMonths();
335
+ });
336
+ fp._bind(fp.nextMonthNav, "click", function (e) {
337
+ e.preventDefault();
338
+ e.stopPropagation();
339
+ fp.changeYear(fp.currentYear + 1);
340
+ selectYear();
341
+ buildMonths();
342
+ });
343
+ fp._bind(self.monthsContainer, "mouseover", function (e) {
344
+ if (fp.config.mode === "range")
345
+ fp.onMouseOver(getEventTarget(e), "flatpickr-monthSelect-month");
346
+ });
347
+ }
348
+ function setCurrentlySelected() {
349
+ if (!fp.rContainer)
350
+ return;
351
+ if (!fp.selectedDates.length)
352
+ return;
353
+ var currentlySelected = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month.selected");
354
+ for (var index = 0; index < currentlySelected.length; index++) {
355
+ currentlySelected[index].classList.remove("selected");
356
+ }
357
+ var targetMonth = fp.selectedDates[0].getMonth();
358
+ var month = fp.rContainer.querySelector(".flatpickr-monthSelect-month:nth-child(" + (targetMonth + 1) + ")");
359
+ if (month) {
360
+ month.classList.add("selected");
361
+ }
362
+ }
363
+ function selectYear() {
364
+ var selectedDate = fp.selectedDates[0];
365
+ if (selectedDate) {
366
+ selectedDate = new Date(selectedDate);
367
+ selectedDate.setFullYear(fp.currentYear);
368
+ if (fp.config.minDate && selectedDate < fp.config.minDate) {
369
+ selectedDate = fp.config.minDate;
370
+ }
371
+ if (fp.config.maxDate && selectedDate > fp.config.maxDate) {
372
+ selectedDate = fp.config.maxDate;
373
+ }
374
+ fp.currentYear = selectedDate.getFullYear();
375
+ }
376
+ fp.currentYearElement.value = String(fp.currentYear);
377
+ if (fp.rContainer) {
378
+ var months = fp.rContainer.querySelectorAll(".flatpickr-monthSelect-month");
379
+ months.forEach(function (month) {
380
+ month.dateObj.setFullYear(fp.currentYear);
381
+ if ((fp.config.minDate && month.dateObj < fp.config.minDate) ||
382
+ (fp.config.maxDate && month.dateObj > fp.config.maxDate)) {
383
+ month.classList.add("flatpickr-disabled");
384
+ }
385
+ else {
386
+ month.classList.remove("flatpickr-disabled");
387
+ }
388
+ });
389
+ }
390
+ setCurrentlySelected();
391
+ }
392
+ function selectMonth(e) {
393
+ e.preventDefault();
394
+ e.stopPropagation();
395
+ var eventTarget = getEventTarget(e);
396
+ if (!(eventTarget instanceof Element))
397
+ return;
398
+ if (eventTarget.classList.contains("flatpickr-disabled"))
399
+ return;
400
+ if (eventTarget.classList.contains("notAllowed"))
401
+ return; // necessary??
402
+ setMonth(eventTarget.dateObj);
403
+ if (fp.config.closeOnSelect) {
404
+ var single = fp.config.mode === "single";
405
+ var range = fp.config.mode === "range" && fp.selectedDates.length === 2;
406
+ if (single || range)
407
+ fp.close();
408
+ }
409
+ }
410
+ function setMonth(date) {
411
+ var selectedDate = new Date(fp.currentYear, date.getMonth(), date.getDate());
412
+ var selectedDates = [];
413
+ switch (fp.config.mode) {
414
+ case "single":
415
+ selectedDates = [selectedDate];
416
+ break;
417
+ case "multiple":
418
+ selectedDates.push(selectedDate);
419
+ break;
420
+ case "range":
421
+ if (fp.selectedDates.length === 2) {
422
+ selectedDates = [selectedDate];
423
+ }
424
+ else {
425
+ selectedDates = fp.selectedDates.concat([selectedDate]);
426
+ selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
427
+ }
428
+ break;
429
+ }
430
+ fp.setDate(selectedDates, true);
431
+ setCurrentlySelected();
432
+ }
433
+ var shifts = {
434
+ 37: -1,
435
+ 39: 1,
436
+ 40: 3,
437
+ 38: -3,
438
+ };
439
+ function onKeyDown(_, __, ___, e) {
440
+ var shouldMove = shifts[e.keyCode] !== undefined;
441
+ if (!shouldMove && e.keyCode !== 13) {
442
+ return;
443
+ }
444
+ if (!fp.rContainer || !self.monthsContainer)
445
+ return;
446
+ var currentlySelected = fp.rContainer.querySelector(".flatpickr-monthSelect-month.selected");
447
+ var index = Array.prototype.indexOf.call(self.monthsContainer.children, document.activeElement);
448
+ if (index === -1) {
449
+ var target = currentlySelected || self.monthsContainer.firstElementChild;
450
+ target.focus();
451
+ index = target.$i;
452
+ }
453
+ if (shouldMove) {
454
+ self.monthsContainer.children[(12 + index + shifts[e.keyCode]) % 12].focus();
455
+ }
456
+ else if (e.keyCode === 13 &&
457
+ self.monthsContainer.contains(document.activeElement)) {
458
+ setMonth(document.activeElement.dateObj);
459
+ }
460
+ }
461
+ function closeHook() {
462
+ var _a;
463
+ if (((_a = fp.config) === null || _a === void 0 ? void 0 : _a.mode) === "range" && fp.selectedDates.length === 1)
464
+ fp.clear(false);
465
+ if (!fp.selectedDates.length)
466
+ buildMonths();
467
+ }
468
+ // Help the prev/next year nav honor config.minDate (see 3fa5a69)
469
+ function stubCurrentMonth() {
470
+ config._stubbedCurrentMonth = fp._initialDate.getMonth();
471
+ fp._initialDate.setMonth(config._stubbedCurrentMonth);
472
+ fp.currentMonth = config._stubbedCurrentMonth;
473
+ }
474
+ function unstubCurrentMonth() {
475
+ if (!config._stubbedCurrentMonth)
476
+ return;
477
+ fp._initialDate.setMonth(config._stubbedCurrentMonth);
478
+ fp.currentMonth = config._stubbedCurrentMonth;
479
+ delete config._stubbedCurrentMonth;
480
+ }
481
+ function destroyPluginInstance() {
482
+ if (self.monthsContainer !== null) {
483
+ var months = self.monthsContainer.querySelectorAll(".flatpickr-monthSelect-month");
484
+ for (var index = 0; index < months.length; index++) {
485
+ months[index].removeEventListener("click", selectMonth);
486
+ }
487
+ }
488
+ }
489
+ return {
490
+ onParseConfig: function () {
491
+ fp.config.enableTime = false;
492
+ },
493
+ onValueUpdate: setCurrentlySelected,
494
+ onKeyDown: onKeyDown,
495
+ onReady: [
496
+ stubCurrentMonth,
497
+ clearUnnecessaryDOMElements,
498
+ build,
499
+ bindEvents,
500
+ setCurrentlySelected,
501
+ function () {
502
+ fp.config.onClose.push(closeHook);
503
+ fp.loadedPlugins.push("monthSelect");
504
+ },
505
+ ],
506
+ onDestroy: [
507
+ unstubCurrentMonth,
508
+ destroyPluginInstance,
509
+ function () {
510
+ fp.config.onClose = fp.config.onClose.filter(function (hook) { return hook !== closeHook; });
511
+ },
512
+ ],
513
+ };
514
+ };
515
+ }
516
+
517
+ return monthSelectPlugin;
518
+
519
+ })));
520
+ });
521
+
522
+ const stylesCss$b = ".flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{left:0}.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{right:0}.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:\"\";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:7.48px 0 0 0;line-height:1;height:34px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\\0;display:inline-block}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;background:transparent;border:none;border-radius:0;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;font-family:inherit;font-weight:300;height:auto;line-height:inherit;margin:-1px 0 0 0;outline:none;padding:0 0 0 .5ch;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.dayContainer+.dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange+.endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange+.endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:\"\";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:#eee}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.flatpickr-monthSelect-months{margin:10px 1px 3px 1px;flex-wrap:wrap}.flatpickr-monthSelect-month{background:none;border:1px solid transparent;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;display:inline-block;font-weight:400;margin:0.5px;justify-content:center;padding:10px;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;text-align:center;width:33%}.flatpickr-monthSelect-month.flatpickr-disabled{color:#eee}.flatpickr-monthSelect-month.flatpickr-disabled:hover,.flatpickr-monthSelect-month.flatpickr-disabled:focus{cursor:not-allowed;background:none !important}.flatpickr-monthSelect-theme-dark{background:#3f4458}.flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year{color:#fff}.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month,.flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month{color:#fff;fill:#fff}.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month{color:rgba(255, 255, 255, 0.95)}.flatpickr-monthSelect-month.today{border-color:#959ea9}.flatpickr-monthSelect-month.inRange,.flatpickr-monthSelect-month.inRange.today,.flatpickr-monthSelect-month:hover,.flatpickr-monthSelect-month:focus{background:#e6e6e6;cursor:pointer;outline:0;border-color:#e6e6e6}.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus{background:#646c8c;border-color:#646c8c}.flatpickr-monthSelect-month.today:hover,.flatpickr-monthSelect-month.today:focus{background:#959ea9;border-color:#959ea9;color:#fff}.flatpickr-monthSelect-month.selected,.flatpickr-monthSelect-month.startRange,.flatpickr-monthSelect-month.endRange{background-color:#569ff7;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-monthSelect-month.startRange{border-radius:50px 0 0 50px}.flatpickr-monthSelect-month.endRange{border-radius:0 50px 50px 0}.flatpickr-monthSelect-month.startRange.endRange{border-radius:50px}.flatpickr-monthSelect-month.inRange{border-radius:0;box-shadow:-5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6}.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,.flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange{background:#80cbc4;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#80cbc4}:host{font-family:var(--font-family-sans);font-weight:var(--font-rg);--z-range-picker--toggle-height:0}z-date-picker{position:relative}z-date-picker>div>*{cursor:pointer !important}z-range-picker{position:relative}.flatpickr-toggle-container{width:fit-content}.range-pickers-container>div{position:relative}.hidden-input{position:absolute;bottom:0;width:0;height:0;visibility:hidden !important}.flatpickr-calendar::before,.flatpickr-calendar::after{display:none}.flatpickr-calendar{position:absolute !important;top:var(--z-range-picker--toggle-height) !important;left:0 !important;padding-top:calc(var(--space-unit) * 2);border-radius:2px;box-shadow:var(--shadow-2);font-family:var(--font-family-sans) !important}.months.top>.flatpickr-calendar{top:-288px !important}.date.top>.flatpickr-calendar,.date.top>div>.flatpickr-calendar{top:-401px !important}.date-time.top>.flatpickr-calendar,.date-time.top>div>.flatpickr-calendar{top:-523px !important}.flatpickr-calendar,.flatpickr-innerContainer,.flatpickr-days,.dayContainer,.flatpickr-rContainer,.flatpickr-monthSelect-months{width:calc(var(--space-unit) * 42) !important;max-width:calc(var(--space-unit) * 42) !important}.flatpickr-monthSelect-months{box-sizing:border-box;padding:0 !important;margin:calc(var(--space-unit) * 2) 0 !important}.flatpickr-months{position:relative;height:calc(var(--space-unit) * 6) !important;align-items:center;margin-bottom:var(--space-unit) 0 !important}.flatpickr-month{overflow:visible !important;height:calc(var(--space-unit) * 6) !important}.flatpickr-current-month{left:0 !important;display:flex !important;width:fill-available;height:calc(var(--space-unit) * 6);align-items:baseline;justify-content:space-evenly;padding-top:0}.flatpickr-next-month,.flatpickr-prev-month{position:static !important;display:flex;width:calc(var(--space-unit) * 4) !important;height:calc(var(--space-unit) * 4) !important;align-items:center;justify-content:center;padding:0 !important}.flatpickr-prev-month{margin-left:var(--space-unit)}.flatpickr-next-month{margin-right:var(--space-unit)}.flatpickr-next-month>svg,.flatpickr-prev-month>svg{width:calc(var(--space-unit) * 2) !important;height:calc(var(--space-unit) * 2) !important;fill:var(--color-primary01)}.flatpickr-next-month:hover,.flatpickr-prev-month:hover,.flatpickr-next-month:focus,.flatpickr-prev-month:focus{border:none !important;border-color:var(--color-primary03) !important;background-color:var(--color-primary03) !important;border-radius:var(--border-radius);color:var(--color-hover-primary) !important;outline:none !important}.flatpickr-next-month:hover svg,.flatpickr-prev-month:hover svg{fill:var(--color-hover-primary) !important}.flatpickr-next-month:active,.flatpickr-prev-month:active{border-color:var(--color-surface01) !important;background-color:var(--color-surface01) !important;border-radius:var(--border-radius);box-shadow:var(--shadow-2) !important;color:var(--color-primary01) !important}.flatpickr-next-month:focus svg,.flatpickr-prev-month:focus svg{fill:var(--color-primary01) !important}.flatpickr-monthDropdown-months{width:108px !important;height:calc(var(--space-unit) * 5.5) !important;padding-left:var(--space-unit) !important;background:var(--color-surface01) !important;color:var(--color-text02) !important;font-size:var(--font-size-3) !important;font-weight:var(--font-rg) !important;outline:1px solid black !important}.flatpickr-monthDropdown-months:hover,.flatpickr-monthDropdown-months:focus{outline:1px solid var(--color-primary01) !important}.flatpickr-current-month>.numInputWrapper{display:flex;width:calc(var(--space-unit) * 10);height:calc(var(--space-unit) * 5.5) !important;background:var(--color-surface01) !important;color:var(--color-text02);outline:1px solid black !important}.flatpickr-current-month>.numInputWrapper:hover,.flatpickr-current-month>.numInputWrapper:focus-within{outline:1px solid var(--color-primary01) !important}.flatpickr-current-month>.numInputWrapper>input{padding:0 calc(var(--space-unit) * 3) 0 var(--space-unit);font-size:var(--font-size-3) !important;font-weight:var(--font-rg) !important;text-align:center}.flatpickr-weekdays{height:calc(var(--space-unit) * 6);border-bottom:1px solid var(--color-surface03)}.flatpickr-weekday{font-size:var(--font-size-3) !important;font-weight:var(--font-rg) !important}.flatpickr-day,.flatpickr-monthSelect-month{width:calc(var(--space-unit) * 6) !important;max-width:100% !important;height:calc(var(--space-unit) * 6) !important;border:none;margin:0 !important;border-radius:0 !important;box-shadow:none !important;font-size:var(--font-size-3) !important;line-height:calc(var(--space-unit) * 6) !important}.flatpickr-day{width:calc(var(--space-unit) * 6) !important;border:none;line-height:calc(var(--space-unit) * 6) !important}.flatpickr-monthSelect-month{width:calc(var(--space-unit) * 14) !important;padding:0 !important;border:2px solid var(--color-surface01) !important;line-height:calc(var(--space-unit) * 5) !important}.flatpickr-day:not(.flatpickr-disabled):hover,.flatpickr-day:not(.flatpickr-disabled):active,.flatpickr-day:not(.flatpickr-disabled):focus,.flatpickr-day:not(.flatpickr-disabled).prevMonthDay:hover,.flatpickr-day:not(.flatpickr-disabled).prevMonthDay:active,.flatpickr-day:not(.flatpickr-disabled).prevMonthDay:focus,.flatpickr-day:not(.flatpickr-disabled).selected:hover,.flatpickr-day:not(.flatpickr-disabled).selected:active,.flatpickr-day:not(.flatpickr-disabled).selected:focus,.flatpickr-monthSelect-month:hover,.flatpickr-monthSelect-month:active,.flatpickr-monthSelect-month:focus{border-color:var(--color-hover-primary) !important;background-color:var(--color-hover-primary) !important;color:var(--color-text04) !important}.flatpickr-day.today,.flatpickr-monthSelect-month.today{border:2px solid var(--color-hover-primary) !important}.flatpickr-day.selected:not(.flatpickr-disabled),.flatpickr-monthSelect-month.selected:not(.flatpickr-disabled){border-color:var(--color-primary01) !important;background-color:var(--color-primary01) !important}.flatpickr-weekday:nth-child(6),.flatpickr-weekday:nth-child(7),.flatpickr-day:nth-child(7n+6),.flatpickr-day:nth-child(7n+7){font-weight:var(--font-sb) !important}.flatpickr-time{display:block;height:90px !important;max-height:90px !important;text-align:left}.flatpickr-time::before{display:block;width:100%;padding-left:var(--space-unit);color:var(--color-text02) !important;content:\"Orario\";font-size:var(--font-size-1);font-weight:var(--font-sb);text-transform:uppercase}.flatpickr-time.time24hr{margin:calc(var(--space-unit) * 2) !important}.flatpickr-time.time24hr>.numInputWrapper>input:hover,.flatpickr-time.time24hr>.numInputWrapper>input:focus,.flatpickr-time.time24hr>.numInputWrapper:hover{background-color:var(--color-surface01) !important}.flatpickr-time.time24hr>div{width:calc(var(--space-unit) * 10) !important;height:calc(var(--space-unit) * 5.5) !important;margin-right:var(--space-unit) !important;margin-left:var(--space-unit) !important}.flatpickr-time-separator{display:flex;height:calc(var(--space-unit) * 5.5) !important;align-items:center;justify-content:center;font-weight:unset !important}.flatpickr-minute,.flatpickr-hour{font-size:var(--font-size-3) !important;font-weight:var(--font-rg) !important;outline:1px solid black !important}.numInputWrapper:hover .flatpickr-minute,.numInputWrapper:hover .flatpickr-hour,.flatpickr-minute:focus,.flatpickr-hour:focus{outline:1px solid var(--color-primary01) !important}.arrowUp,.arrowDown{width:calc(var(--space-unit) * 2) !important;height:calc(var(--space-unit) * 2) !important;padding:0 !important;border:none !important;opacity:1 !important}.arrowUp{margin-top:calc(var(--space-unit) / 2) !important;margin-right:calc(var(--space-unit) / 2) !important}.arrowDown{top:auto !important;margin-top:calc(var(--space-unit) * 3) !important;margin-right:calc(var(--space-unit) / 2) !important}.arrowUp:hover,.arrowDown:hover{border-color:var(--color-primary03) !important;background-color:var(--color-primary03) !important;border-radius:var(--border-radius);color:var(--color-hover-primary) !important}.arrowUp:active,.arrowDown:active{border-color:var(--color-surface01) !important;background-color:var(--color-surface01) !important;border-radius:var(--border-radius);box-shadow:var(--shadow-2) !important;color:var(--color-primary01) !important}.arrowUp::after,.arrowDown::after{padding:2.5px !important;border:solid var(--color-primary01) !important;border-width:0 1px 1px 0 !important}.arrowUp::after{top:0 !important;margin-top:6px !important;margin-left:5.5px !important;transform:rotate(-135deg)}.arrowDown::after{top:0 !important;left:5.5px !important;margin-top:4px !important;transform:rotate(45deg)}.flatpickr-day:not(.flatpickr-disabled).inRange:hover,.flatpickr-day:not(.flatpickr-disabled).today.inRange:hover,.flatpickr-day.prevMonthDay:not(.flatpickr-disabled).inRange:hover,.flatpickr-monthSelect-month:not(.flatpickr-disabled).inRange:hover{border-color:var(--color-hover-primary) !important;background-color:var(--color-hover-primary) !important}.flatpickr-day:not(.flatpickr-disabled).inRange,.flatpickr-day:not(.flatpickr-disabled).today.inRange,.flatpickr-day:not(.flatpickr-disabled).prevMonthDay.inRange,.flatpickr-monthSelect-month:not(.flatpickr-disabled).inRange{border-color:var(--color-primary03);background-color:var(--color-primary03)}.flatpickr-day:not(.flatpickr-disabled).startRange,.flatpickr-day:not(.flatpickr-disabled).endRange,.flatpickr-monthSelect-month:not(.flatpickr-disabled).startRange,.flatpickr-monthSelect-month:not(.flatpickr-disabled).endRange{border-color:var(--color-primary01) !important;background-color:var(--color-primary01) !important}.flatpickr-day:not(.flatpickr-disabled).prevMonthDay.selected.startRange,.flatpickr-day:not(.flatpickr-disabled).prevMonthDay.selected.endRange{border-color:var(--color-primary01) !important;background-color:var(--color-primary01) !important}.flatpickr-range.second-input{cursor:pointer}.range-pickers-container{display:flex;gap:16px}";
523
+
524
+ const ZDatePicker = class {
525
+ constructor(hostRef) {
526
+ registerInstance(this, hostRef);
527
+ this.dateSelect = createEvent(this, "dateSelect", 7);
528
+ /** z-input aria label */
529
+ this.ariaLabel = "";
530
+ /** [Optional] datepicker mode: date, datetime, only months */
531
+ this.mode = ZDatePickerMode.DATE;
532
+ this.flatpickrPosition = ZDatePickerPosition.BOTTOM;
533
+ this.inputError = false;
534
+ }
535
+ emitDateSelect(date) {
536
+ this.dateSelect.emit(date);
537
+ }
538
+ handleKeyDown(ev) {
539
+ var _a, _b, _c, _d, _e, _f, _g;
540
+ if (ev.key === "Escape") {
541
+ (_a = this.picker) === null || _a === void 0 ? void 0 : _a.close();
542
+ }
543
+ if (ev.key === "Enter" || ev.key === " ") {
544
+ !this.hasChildren && ((_b = this.picker) === null || _b === void 0 ? void 0 : _b.open());
545
+ const isCrossIconEntered = document.activeElement.classList.contains("reset-icon");
546
+ if (isCrossIconEntered) {
547
+ this.inputError = false;
548
+ (_c = this.picker) === null || _c === void 0 ? void 0 : _c.setDate([]);
549
+ this.dateSelect.emit(null);
550
+ }
551
+ document.activeElement.classList.contains("flatpickr-day");
552
+ const isPrevArrowEntered = document.activeElement.classList.contains("flatpickr-prev-month");
553
+ const isNextArrowEntered = document.activeElement.classList.contains("flatpickr-next-month");
554
+ const arrowPressed = isPrevArrowEntered || isNextArrowEntered;
555
+ arrowPressed && ev.key === " " && ev.preventDefault();
556
+ if (this.mode === ZDatePickerMode.MONTHS) {
557
+ isPrevArrowEntered && ((_d = this.picker) === null || _d === void 0 ? void 0 : _d.changeYear(this.picker.currentYear - 1));
558
+ isNextArrowEntered && ((_e = this.picker) === null || _e === void 0 ? void 0 : _e.changeYear(this.picker.currentYear + 1));
559
+ if (arrowPressed) {
560
+ const calendar = this.element.getElementsByClassName("flatpickr-calendar")[0];
561
+ const months = calendar === null || calendar === void 0 ? void 0 : calendar.querySelectorAll(".flatpickr-monthSelect-month");
562
+ months === null || months === void 0 ? void 0 : months.forEach((element) => {
563
+ var _a;
564
+ element.setAttribute("aria-label", `${element.innerHTML} ${(_a = this.picker) === null || _a === void 0 ? void 0 : _a.currentYear}`);
565
+ });
566
+ //Force check of the current day
567
+ months &&
568
+ Array.from(months).forEach((element, index) => {
569
+ var _a;
570
+ const curMonth = new Date().getMonth();
571
+ const curYear = new Date().getFullYear();
572
+ if (index === curMonth) {
573
+ if (((_a = this.picker) === null || _a === void 0 ? void 0 : _a.currentYear) === curYear) {
574
+ element.setAttribute("class", "flatpickr-monthSelect-month today");
575
+ }
576
+ else {
577
+ element.setAttribute("class", "flatpickr-monthSelect-month");
578
+ }
579
+ }
580
+ });
581
+ }
582
+ }
583
+ else {
584
+ isPrevArrowEntered && ((_f = this.picker) === null || _f === void 0 ? void 0 : _f.changeMonth(-1));
585
+ isNextArrowEntered && ((_g = this.picker) === null || _g === void 0 ? void 0 : _g.changeMonth(1));
586
+ }
587
+ }
588
+ }
589
+ componentWillLoad() {
590
+ const customToggle = this.element.querySelector("[slot=toggle]");
591
+ this.hasChildren = !!customToggle;
592
+ this.hasChildren && customToggle.setAttribute("data-toggle", "data-toggle");
593
+ }
594
+ componentDidLoad() {
595
+ this.setupPickers();
596
+ }
597
+ setupPickers() {
598
+ const classToAppend = this.hasChildren ? `${this.datePickerId}-hidden` : `${this.datePickerId}-container`;
599
+ this.picker = flatpickr(`.${classToAppend}`, {
600
+ appendTo: this.element.children[0],
601
+ enableTime: this.mode === ZDatePickerMode.DATE_TIME,
602
+ locale: it.Italian,
603
+ allowInput: true,
604
+ dateFormat: this.mode === ZDatePickerMode.DATE_TIME ? "d-m-Y - H:i" : "d-m-Y",
605
+ ariaDateFormat: this.mode === ZDatePickerMode.MONTHS ? "F Y" : "d F Y",
606
+ minuteIncrement: 1,
607
+ // eslint-disable-next-line @typescript-eslint/naming-convention
608
+ time_24hr: true,
609
+ onChange: (_selectedDates, dateStr) => {
610
+ this.emitDateSelect(dateStr);
611
+ },
612
+ onOpen: () => {
613
+ setAriaOptions(this.element, this.mode);
614
+ this.flatpickrPosition = setFlatpickrPosition(this.element, this.mode);
615
+ },
616
+ onKeyDown: () => {
617
+ setAriaOptions(this.element, this.mode);
618
+ },
619
+ wrap: true,
620
+ plugins: this.mode === ZDatePickerMode.MONTHS && [
621
+ monthSelect({
622
+ dateFormat: "m-Y",
623
+ altFormat: "m-Y",
624
+ }),
625
+ ],
626
+ });
627
+ this.element.querySelectorAll(".flatpickr-weekday").forEach((element) => {
628
+ element.innerHTML = element.innerHTML.trim().charAt(0);
629
+ });
630
+ }
631
+ formatDate(date) {
632
+ if (this.mode === ZDatePickerMode.DATE) {
633
+ return `${flatpickr.formatDate(date, "d-m-Y")}`;
634
+ }
635
+ else if (this.mode === ZDatePickerMode.MONTHS) {
636
+ return `${flatpickr.formatDate(date, "m-Y")}`;
637
+ }
638
+ return `${flatpickr.formatDate(date, "d-m-Y - H:i")}`;
639
+ }
640
+ onStopTyping(value) {
641
+ let text = value.detail.value;
642
+ if (this.mode === ZDatePickerMode.MONTHS) {
643
+ text = "01-".concat(value.detail.value);
644
+ }
645
+ const englishData = text.split("-");
646
+ const time = this.mode === ZDatePickerMode.DATE_TIME ? `T${englishData[3]}:00` : "";
647
+ const englishParsedData = `${englishData[2]}-${englishData[1]}-${englishData[0]}${time}`.split(" ").join("");
648
+ const isValidDate = validateDate(englishParsedData, this.mode === ZDatePickerMode.DATE_TIME);
649
+ if (text === "") {
650
+ this.inputError = false;
651
+ this.picker.setDate([]);
652
+ this.dateSelect.emit(null);
653
+ }
654
+ else if (!isValidDate) {
655
+ this.inputError = true;
656
+ this.dateSelect.emit(null);
657
+ }
658
+ else if (isValidDate) {
659
+ this.inputError = false;
660
+ this.picker.setDate([value.detail.value]);
661
+ this.dateSelect.emit(this.formatDate(new Date(englishParsedData)));
662
+ }
663
+ }
664
+ renderSlottedContent() {
665
+ return (h("div", { class: `${this.datePickerId}-hidden` }, h("input", { class: "hidden-input", "data-input": true }), h("slot", { name: "toggle" })));
666
+ }
667
+ renderZInput() {
668
+ return (h("div", { class: `${this.datePickerId}-container` }, h("z-input", { "data-input": "data-input", ariaLabel: this.ariaLabel, label: this.label, class: this.datePickerId, type: InputType.TEXT, icon: "event", message: false, tabindex: "0", value: "", onStopTyping: (value) => {
669
+ this.onStopTyping(value);
670
+ }, onStartTyping: () => {
671
+ this.inputError = false;
672
+ } })));
673
+ }
674
+ render() {
675
+ return (h("div", { class: {
676
+ "flatpickr-toggle-container": true,
677
+ [this.flatpickrPosition]: true,
678
+ [this.mode]: true,
679
+ } }, this.hasChildren ? this.renderSlottedContent() : this.renderZInput()));
680
+ }
681
+ get element() { return getElement(this); }
682
+ static get watchers() { return {
683
+ "mode": ["setupPickers"]
684
+ }; }
685
+ };
686
+ ZDatePicker.style = stylesCss$b;
687
+
688
+ const stylesCss$a = ".sc-z-divider-h{display:block;padding:0;margin:0}.divider-horizontal.sc-z-divider-h{width:100%}.divider-vertical.sc-z-divider-h{height:100%}.divider-small.divider-horizontal.sc-z-divider-h{height:var(--border-size-small)}.divider-medium.divider-horizontal.sc-z-divider-h{height:var(--border-size-medium)}.divider-large.divider-horizontal.sc-z-divider-h{height:var(--border-size-large)}.divider-small.divider-vertical.sc-z-divider-h{width:var(--border-size-small)}.divider-medium.divider-vertical.sc-z-divider-h{width:var(--border-size-medium)}.divider-large.divider-vertical.sc-z-divider-h{width:var(--border-size-large)}";
689
+
690
+ const ZDivider = class {
691
+ constructor(hostRef) {
692
+ registerInstance(this, hostRef);
693
+ /** [optional] Divider size */
694
+ this.size = DividerSize.SMALL;
695
+ /** [optional] Divider color */
696
+ this.color = "gray200";
697
+ /** [optional] Divider orintation */
698
+ this.orientation = DividerOrientation.HORIZONTAL;
699
+ }
700
+ render() {
701
+ return (h(Host, { class: `divider-${this.size} divider-${this.orientation}`, style: { backgroundColor: `var(--${this.color})` } }));
702
+ }
703
+ };
704
+ ZDivider.style = stylesCss$a;
705
+
706
+ const stylesCss$9 = ":host{margin-right:var(--z-icon-right-margin, 0);margin-left:var(--z-icon-left-margin, 0);line-height:0;vertical-align:middle}:host svg:not([width]){width:var(--z-icon-width, 18px)}:host svg:not([height]){height:var(--z-icon-height, 18px)}";
707
+
708
+ const ZIcon = class {
709
+ constructor(hostRef) {
710
+ registerInstance(this, hostRef);
711
+ }
712
+ selectPathOrPolygon(iconValue) {
713
+ if (iconValue === null || iconValue === void 0 ? void 0 : iconValue.startsWith("M")) {
714
+ return h("path", { d: ICONS[this.name] });
715
+ }
716
+ return h("polygon", { points: ICONS[this.name] });
717
+ }
718
+ render() {
719
+ return (h(Host, { "aria-hidden": "true" }, h("svg", { viewBox: "0 0 1000 1000", width: this.width, height: this.height, id: this.iconid, fill: this.fill ? `var(--${this.fill})` : "" }, this.selectPathOrPolygon(ICONS[this.name]))));
720
+ }
721
+ };
722
+ ZIcon.style = stylesCss$9;
723
+
724
+ const stylesCss$8 = ".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,.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-primary02)}.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: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,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:hover,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:focus,.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill:active{background:var(--color-white) !important;background-clip:text !important;-webkit-transition-delay:99999s !important}.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)}";
725
+
726
+ const ZInput = class {
727
+ constructor(hostRef) {
728
+ registerInstance(this, hostRef);
729
+ this.inputChange = createEvent(this, "inputChange", 7);
730
+ this.startTyping = createEvent(this, "startTyping", 7);
731
+ this.stopTyping = createEvent(this, "stopTyping", 7);
732
+ this.inputCheck = createEvent(this, "inputCheck", 7);
733
+ /** the id of the input element */
734
+ this.htmlid = `id-${randomId()}`;
735
+ /** the input aria-label */
736
+ this.ariaLabel = "";
737
+ /** the input is disabled */
738
+ this.disabled = false;
739
+ /** the input is readonly */
740
+ this.readonly = false;
741
+ /** the input is required (optional): available for text, password, number, email, textarea, checkbox */
742
+ this.required = false;
743
+ /** checked: available for checkbox, radio */
744
+ this.checked = false;
745
+ /** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */
746
+ this.message = true;
747
+ /** the input label position: available for checkbox, radio */
748
+ this.labelPosition = LabelPosition.RIGHT;
749
+ /** render clear icon when typing (optional): available for text */
750
+ this.hasclearicon = true;
751
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
752
+ this.size = ControlSize.BIG;
753
+ this.isTyping = false;
754
+ this.passwordHidden = true;
755
+ this.typingtimeout = 300;
756
+ }
757
+ inputCheckListener(e) {
758
+ const data = e.detail;
759
+ switch (this.type) {
760
+ case InputType.RADIO:
761
+ if (data.type === InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {
762
+ this.checked = false;
763
+ }
764
+ break;
765
+ }
766
+ }
767
+ /** get checked status */
768
+ async isChecked() {
769
+ switch (this.type) {
770
+ case InputType.CHECKBOX:
771
+ case InputType.RADIO:
772
+ return this.checked;
773
+ default:
774
+ console.warn("`isChecked` method is only available for type `checkbox` and `radio`");
775
+ return false;
776
+ }
777
+ }
778
+ emitInputChange(value) {
779
+ if (!this.isTyping) {
780
+ this.emitStartTyping();
781
+ }
782
+ let validity;
783
+ if (this.type === InputType.TEXTAREA) {
784
+ validity = this.getValidity("textarea");
785
+ }
786
+ else {
787
+ validity = this.getValidity("input");
788
+ }
789
+ this.value = value;
790
+ this.inputChange.emit({ value, validity });
791
+ clearTimeout(this.timer);
792
+ this.timer = setTimeout(() => {
793
+ this.emitStopTyping(this.value, validity);
794
+ }, this.typingtimeout);
795
+ }
796
+ emitStartTyping() {
797
+ this.isTyping = true;
798
+ this.startTyping.emit();
799
+ }
800
+ emitStopTyping(value, validity) {
801
+ this.isTyping = false;
802
+ this.stopTyping.emit({
803
+ value: value,
804
+ validity: validity,
805
+ });
806
+ }
807
+ emitInputCheck(checked) {
808
+ this.inputCheck.emit({
809
+ id: this.htmlid,
810
+ checked: checked,
811
+ type: this.type,
812
+ name: this.name,
813
+ value: this.value,
814
+ validity: this.getValidity("input"),
815
+ });
816
+ }
817
+ getValidity(type) {
818
+ const input = this.hostElement.querySelector(type);
819
+ return input.validity;
820
+ }
821
+ /* START text/password/email/number */
822
+ getTextAttributes() {
823
+ return {
824
+ id: this.htmlid,
825
+ name: this.name,
826
+ placeholder: this.placeholder,
827
+ value: this.value,
828
+ disabled: this.disabled,
829
+ readonly: this.readonly,
830
+ required: this.required,
831
+ title: this.htmltitle,
832
+ class: {
833
+ [`input-${this.status}`]: !!this.status,
834
+ filled: !!this.value,
835
+ },
836
+ autocomplete: this.autocomplete,
837
+ onInput: (e) => this.emitInputChange(e.target.value),
838
+ };
839
+ }
840
+ getNumberAttributes(type) {
841
+ if (type != InputType.NUMBER) {
842
+ return;
843
+ }
844
+ return {
845
+ min: this.min,
846
+ max: this.max,
847
+ step: this.step,
848
+ };
849
+ }
850
+ getPatternAttribute(type) {
851
+ if (type != InputType.PASSWORD &&
852
+ type != InputType.TEXT &&
853
+ type != InputType.TEL &&
854
+ type != InputType.SEARCH &&
855
+ type != InputType.URL &&
856
+ type != InputType.EMAIL) {
857
+ return;
858
+ }
859
+ return {
860
+ pattern: this.pattern,
861
+ };
862
+ }
863
+ renderInputText(type = InputType.TEXT) {
864
+ const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
865
+ const attr = Object.assign(Object.assign(Object.assign(Object.assign({}, this.getTextAttributes()), this.getNumberAttributes(type)), this.getPatternAttribute(type)), ariaLabel);
866
+ if (this.icon || type === InputType.PASSWORD) {
867
+ Object.assign(attr.class, { "has-icon": true });
868
+ }
869
+ if (this.hasclearicon && type != InputType.NUMBER) {
870
+ Object.assign(attr.class, { "has-clear-icon": true });
871
+ }
872
+ return (h("div", { class: "text-wrapper" }, this.renderLabel(), h("div", null, h("input", Object.assign({ type: type === InputType.PASSWORD && !this.passwordHidden ? InputType.TEXT : type }, attr, { ref: (el) => (this.inputRef = el) })), this.renderIcons()), this.renderMessage()));
873
+ }
874
+ renderLabel() {
875
+ if (!this.label) {
876
+ return;
877
+ }
878
+ return (h("label", { class: "input-label body-5-sb", id: `${this.htmlid}_label`, htmlFor: this.htmlid }, this.label));
879
+ }
880
+ renderIcons() {
881
+ return (h("span", { class: "icons-wrapper" }, this.renderResetIcon(), this.renderIcon()));
882
+ }
883
+ renderIcon() {
884
+ if (this.type === InputType.PASSWORD) {
885
+ return this.renderShowHidePassword();
886
+ }
887
+ if (!this.icon) {
888
+ return;
889
+ }
890
+ return (h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1 }, h("z-icon", { name: this.icon, class: this.size })));
891
+ }
892
+ renderResetIcon() {
893
+ let hidden = false;
894
+ if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {
895
+ hidden = true;
896
+ }
897
+ return (h("button", { type: "button", class: `icon-button reset-icon ${hidden ? "hidden" : ""}`, "aria-label": "cancella il contenuto dell'input", onClick: () => {
898
+ this.inputRef.value = "";
899
+ this.emitInputChange("");
900
+ } }, h("z-icon", { name: "multiply", class: this.size })));
901
+ }
902
+ renderShowHidePassword() {
903
+ return (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) }, h("z-icon", { name: this.passwordHidden ? "view-filled" : "view-off-filled", class: this.size })));
904
+ }
905
+ renderMessage() {
906
+ if (boolean(this.message) === false) {
907
+ return;
908
+ }
909
+ return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
910
+ }
911
+ /* END text/password/email/number */
912
+ /* START textarea */
913
+ renderTextarea() {
914
+ const attributes = this.getTextAttributes();
915
+ const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
916
+ return (h("div", { class: "text-wrapper" }, this.renderLabel(), h("div", { class: Object.assign(Object.assign({}, attributes.class), { "textarea-wrapper": true, "readonly": attributes.readonly }) }, h("textarea", Object.assign({}, attributes, ariaLabel))), this.renderMessage()));
917
+ }
918
+ /* END textarea */
919
+ handleCheck(ev) {
920
+ this.checked = ev.target.checked;
921
+ this.emitInputCheck(this.checked);
922
+ }
923
+ /* START checkbox */
924
+ renderCheckbox() {
925
+ return (h("div", { class: "checkbox-wrapper" }, h("input", { 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 }), h("label", { htmlFor: this.htmlid, class: {
926
+ "checkbox-label": true,
927
+ "after": this.labelPosition === LabelPosition.RIGHT,
928
+ "before": this.labelPosition === LabelPosition.LEFT,
929
+ } }, h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
930
+ }
931
+ /* END checkbox */
932
+ /* START radio */
933
+ renderRadio() {
934
+ return (h("div", { class: "radio-wrapper" }, h("input", { 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 }), h("label", { htmlFor: this.htmlid, class: {
935
+ "radio-label": true,
936
+ "after": this.labelPosition === LabelPosition.RIGHT,
937
+ "before": this.labelPosition === LabelPosition.LEFT,
938
+ } }, h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
939
+ }
940
+ /* END radio */
941
+ render() {
942
+ let input;
943
+ switch (this.type) {
944
+ case InputType.TEXTAREA:
945
+ input = this.renderTextarea();
946
+ break;
947
+ case InputType.CHECKBOX:
948
+ input = this.renderCheckbox();
949
+ break;
950
+ case InputType.RADIO:
951
+ input = this.renderRadio();
952
+ break;
953
+ default:
954
+ input = this.renderInputText(this.type);
955
+ }
956
+ return h(Host, null, input);
957
+ }
958
+ get hostElement() { return getElement(this); }
959
+ };
960
+ ZInput.style = stylesCss$8;
961
+
962
+ const stylesCss$7 = ":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)}";
963
+
964
+ const ZInputMessage = class {
965
+ constructor(hostRef) {
966
+ registerInstance(this, hostRef);
967
+ this.statusIcons = {
968
+ success: "checkmark-circle",
969
+ error: "multiply-circled",
970
+ warning: "exclamation-circle",
971
+ };
972
+ this.statusRole = {};
973
+ }
974
+ onMessageChange() {
975
+ this.statusRole = this.message && this.status ? { role: "alert" } : {};
976
+ }
977
+ componentWillLoad() {
978
+ this.onMessageChange();
979
+ }
980
+ render() {
981
+ return (h(Host, Object.assign({}, this.statusRole, { "aria-label": this.message }), this.statusIcons[this.status] && this.message && h("z-icon", { name: this.statusIcons[this.status] }), h("span", { innerHTML: this.message })));
982
+ }
983
+ static get watchers() { return {
984
+ "message": ["onMessageChange"],
985
+ "status": ["onMessageChange"]
986
+ }; }
987
+ };
988
+ ZInputMessage.style = stylesCss$7;
989
+
990
+ const stylesCss$6 = ":host{display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}";
991
+
992
+ const ZList = class {
993
+ constructor(hostRef) {
994
+ registerInstance(this, hostRef);
995
+ /**
996
+ * [optional] Sets size of inside elements.
997
+ */
998
+ this.size = ListSize.MEDIUM;
999
+ /**
1000
+ * [optional] type of the list marker for each element
1001
+ */
1002
+ this.listType = ListType.NONE;
1003
+ }
1004
+ setChildrenSizeType() {
1005
+ const children = this.host.children;
1006
+ for (let i = 0; i < children.length; i++) {
1007
+ children[i].setAttribute("size", this.size);
1008
+ children[i].setAttribute("list-type", this.listType);
1009
+ children[i].setAttribute("list-element-position", (i + 1).toString());
1010
+ }
1011
+ }
1012
+ componentDidLoad() {
1013
+ this.setChildrenSizeType();
1014
+ }
1015
+ render() {
1016
+ return (h(Host, { role: "list" }, h("slot", null)));
1017
+ }
1018
+ get host() { return getElement(this); }
1019
+ };
1020
+ ZList.style = stylesCss$6;
1021
+
1022
+ const stylesCss$5 = ":host{outline:none}:host>.container,:host>.container-contextual-menu{--background-color-list-element:var(--bg-white);--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}";
1023
+
1024
+ const ZListElement = class {
1025
+ /**
1026
+ * Constructor.
1027
+ */
1028
+ constructor(hostRef) {
1029
+ registerInstance(this, hostRef);
1030
+ this.accessibleFocus = createEvent(this, "accessibleFocus", 7);
1031
+ this.clickItem = createEvent(this, "clickItem", 7);
1032
+ /**
1033
+ * [optional] Align expandable button left or right.
1034
+ */
1035
+ this.alignButton = ExpandableListButtonAlign.LEFT;
1036
+ /**
1037
+ * [optional] Sets element clickable.
1038
+ */
1039
+ this.clickable = false;
1040
+ /**
1041
+ * [optional] Sets the divider color.
1042
+ */
1043
+ this.dividerColor = "color-surface03";
1044
+ /**
1045
+ * [optional] Sets the position where to insert the divider.
1046
+ */
1047
+ this.dividerType = ListDividerType.NONE;
1048
+ /**
1049
+ * [optional] Sets the divider size.
1050
+ */
1051
+ this.dividerSize = DividerSize.SMALL;
1052
+ /**
1053
+ * [optional] Sets element as expandable.
1054
+ */
1055
+ this.expandable = false;
1056
+ /**
1057
+ * [optional] Sets expandable style to element.
1058
+ */
1059
+ this.expandableStyle = ExpandableListStyle.ACCORDION;
1060
+ /**
1061
+ * [optional] Sets size of inside elements.
1062
+ */
1063
+ this.size = ListSize.MEDIUM;
1064
+ /**
1065
+ * [optional] Sets text color of the element.
1066
+ */
1067
+ this.color = "none";
1068
+ /**
1069
+ * [optional] Sets disabled style of the element.
1070
+ */
1071
+ this.disabled = false;
1072
+ /**
1073
+ * [optional] If is used in ZContextualMenu component
1074
+ */
1075
+ this.isContextualMenu = false;
1076
+ /**
1077
+ * [optional] position of the list element inside the list or the group
1078
+ */
1079
+ this.listElementPosition = "0";
1080
+ /**
1081
+ * [optional] type of the list marker for each element
1082
+ */
1083
+ this.listType = ListType.NONE;
1084
+ this.showInnerContent = false;
1085
+ this.openElementConfig = {
1086
+ accordion: {
1087
+ open: "minus-circled",
1088
+ close: "plus-circled",
1089
+ },
1090
+ menu: {
1091
+ open: "chevron-up",
1092
+ close: "chevron-down",
1093
+ },
1094
+ };
1095
+ this.handleClick = this.handleClick.bind(this);
1096
+ this.handleKeyDown = this.handleKeyDown.bind(this);
1097
+ }
1098
+ accessibleFocusHandler(e) {
1099
+ if (this.listElementId === e.detail) {
1100
+ const toFocus = this.host.shadowRoot.getElementById(`z-list-element-id-${e.detail}`);
1101
+ toFocus.focus();
1102
+ }
1103
+ }
1104
+ /**
1105
+ * Handler for click on element. If element is expandable, change state.
1106
+ * @returns void
1107
+ */
1108
+ handleClick() {
1109
+ this.clickItem.emit(this.listElementId);
1110
+ if (!this.expandable) {
1111
+ return;
1112
+ }
1113
+ this.showInnerContent = !this.showInnerContent;
1114
+ }
1115
+ calculateClass() {
1116
+ if (this.isContextualMenu) {
1117
+ return "container-contextual-menu";
1118
+ }
1119
+ return "container";
1120
+ }
1121
+ handleKeyDown(event) {
1122
+ const expandByKey = event.code === KeyboardCode.ENTER;
1123
+ switch (event.code) {
1124
+ case KeyboardCode.ARROW_DOWN:
1125
+ event.preventDefault();
1126
+ this.accessibleFocus.emit(this.listElementId + 1);
1127
+ break;
1128
+ case KeyboardCode.ARROW_UP:
1129
+ event.preventDefault();
1130
+ this.accessibleFocus.emit(this.listElementId - 1);
1131
+ break;
1132
+ case KeyboardCode.ENTER:
1133
+ event.preventDefault();
1134
+ this.clickItem.emit(this.listElementId);
1135
+ break;
1136
+ }
1137
+ if (!this.expandable || !expandByKey) {
1138
+ return;
1139
+ }
1140
+ this.showInnerContent = !this.showInnerContent;
1141
+ }
1142
+ /**
1143
+ * Renders button to expand element.
1144
+ * @returns expadable button
1145
+ */
1146
+ renderExpandableButton() {
1147
+ if (!this.expandable) {
1148
+ return null;
1149
+ }
1150
+ return (h("z-icon", { name: this.showInnerContent
1151
+ ? this.openElementConfig[this.expandableStyle].open
1152
+ : this.openElementConfig[this.expandableStyle].close }));
1153
+ }
1154
+ /**
1155
+ * Renders expanded content if element is expandable.
1156
+ * @returns expanded content
1157
+ */
1158
+ renderExpandedContent() {
1159
+ if (!this.expandable) {
1160
+ return null;
1161
+ }
1162
+ return (h("div", { class: {
1163
+ "z-list-element-inner-container": true,
1164
+ "expanded": this.showInnerContent,
1165
+ } }, h("slot", { name: "inner-content" })));
1166
+ }
1167
+ /**
1168
+ * Renders content of the z-list-element
1169
+ * @returns list content
1170
+ */
1171
+ renderContent() {
1172
+ if (this.listType === ListType.NONE) {
1173
+ return h("slot", null);
1174
+ }
1175
+ if (this.listType === ListType.ORDERED) {
1176
+ return (h("div", { class: "z-list-content-container" }, h("div", null, this.listElementPosition, ".\u2003"), h("slot", null)));
1177
+ }
1178
+ if (this.listType === ListType.UNORDERED) {
1179
+ return (h("div", { class: "z-list-content-container" }, h("span", null, "\u2022\u2003"), h("slot", null)));
1180
+ }
1181
+ }
1182
+ render() {
1183
+ return (h(Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, h("div", { class: `${this.calculateClass()}`, style: { color: `var(--${this.color})` }, tabindex: this.isContextualMenu ? "0" : "-1", id: `z-list-element-id-${this.listElementId}`, part: "list-item-container" }, h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === ListDividerType.ELEMENT && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
1184
+ }
1185
+ get host() { return getElement(this); }
1186
+ };
1187
+ ZListElement.style = stylesCss$5;
1188
+
1189
+ const stylesCss$4 = ":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)}";
1190
+
1191
+ const ZListGroup = class {
1192
+ constructor(hostRef) {
1193
+ registerInstance(this, hostRef);
1194
+ /**
1195
+ * [optional] Sets size of inside elements.
1196
+ */
1197
+ this.size = ListSize.MEDIUM;
1198
+ /**
1199
+ * [optional] Sets the position where to insert the divider.
1200
+ */
1201
+ this.dividerType = ListDividerType.NONE;
1202
+ /**
1203
+ * [optional] Sets the divider size.
1204
+ */
1205
+ this.dividerSize = DividerSize.SMALL;
1206
+ /**
1207
+ * [optional] Sets the divider color.
1208
+ */
1209
+ this.dividerColor = "gray200";
1210
+ /**
1211
+ * [optional] type of the list marker for each element
1212
+ */
1213
+ this.listType = ListType.NONE;
1214
+ }
1215
+ componentDidLoad() {
1216
+ const children = this.host.children;
1217
+ for (let i = 0; i < children.length; i++) {
1218
+ if (children.length - 1 > i) {
1219
+ children[i].setAttribute("divider-type", this.dividerType);
1220
+ children[i].setAttribute("divider-size", this.dividerSize);
1221
+ children[i].setAttribute("divider-color", this.dividerColor);
1222
+ }
1223
+ children[i].setAttribute("size", this.size);
1224
+ children[i].setAttribute("list-type", this.listType);
1225
+ children[i].setAttribute("list-element-position", i.toString());
1226
+ }
1227
+ }
1228
+ componentWillLoad() {
1229
+ this.hasHeader = !!this.host.querySelector('[slot="header-title"]');
1230
+ }
1231
+ render() {
1232
+ return (h(Host, { role: "group" }, h("div", { class: {
1233
+ "z-list-group-header-container": true,
1234
+ "has-header": this.hasHeader,
1235
+ } }, h("slot", { name: "header-title" }), this.dividerType === ListDividerType.HEADER && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))), h("slot", null)));
1236
+ }
1237
+ get host() { return getElement(this); }
1238
+ };
1239
+ ZListGroup.style = stylesCss$4;
1240
+
1241
+ // nb. This is for IE10 and lower _only_.
1242
+ var supportCustomEvent = window.CustomEvent;
1243
+ if (!supportCustomEvent || typeof supportCustomEvent === 'object') {
1244
+ supportCustomEvent = function CustomEvent(event, x) {
1245
+ x = x || {};
1246
+ var ev = document.createEvent('CustomEvent');
1247
+ ev.initCustomEvent(event, !!x.bubbles, !!x.cancelable, x.detail || null);
1248
+ return ev;
1249
+ };
1250
+ supportCustomEvent.prototype = window.Event.prototype;
1251
+ }
1252
+
1253
+ /**
1254
+ * Dispatches the passed event to both an "on<type>" handler as well as via the
1255
+ * normal dispatch operation. Does not bubble.
1256
+ *
1257
+ * @param {!EventTarget} target
1258
+ * @param {!Event} event
1259
+ * @return {boolean}
1260
+ */
1261
+ function safeDispatchEvent(target, event) {
1262
+ var check = 'on' + event.type.toLowerCase();
1263
+ if (typeof target[check] === 'function') {
1264
+ target[check](event);
1265
+ }
1266
+ return target.dispatchEvent(event);
1267
+ }
1268
+
1269
+ /**
1270
+ * @param {Element} el to check for stacking context
1271
+ * @return {boolean} whether this el or its parents creates a stacking context
1272
+ */
1273
+ function createsStackingContext(el) {
1274
+ while (el && el !== document.body) {
1275
+ var s = window.getComputedStyle(el);
1276
+ var invalid = function(k, ok) {
1277
+ return !(s[k] === undefined || s[k] === ok);
1278
+ };
1279
+
1280
+ if (s.opacity < 1 ||
1281
+ invalid('zIndex', 'auto') ||
1282
+ invalid('transform', 'none') ||
1283
+ invalid('mixBlendMode', 'normal') ||
1284
+ invalid('filter', 'none') ||
1285
+ invalid('perspective', 'none') ||
1286
+ s['isolation'] === 'isolate' ||
1287
+ s.position === 'fixed' ||
1288
+ s.webkitOverflowScrolling === 'touch') {
1289
+ return true;
1290
+ }
1291
+ el = el.parentElement;
1292
+ }
1293
+ return false;
1294
+ }
1295
+
1296
+ /**
1297
+ * Finds the nearest <dialog> from the passed element.
1298
+ *
1299
+ * @param {Element} el to search from
1300
+ * @return {HTMLDialogElement} dialog found
1301
+ */
1302
+ function findNearestDialog(el) {
1303
+ while (el) {
1304
+ if (el.localName === 'dialog') {
1305
+ return /** @type {HTMLDialogElement} */ (el);
1306
+ }
1307
+ if (el.parentElement) {
1308
+ el = el.parentElement;
1309
+ } else if (el.parentNode) {
1310
+ el = el.parentNode.host;
1311
+ } else {
1312
+ el = null;
1313
+ }
1314
+ }
1315
+ return null;
1316
+ }
1317
+
1318
+ /**
1319
+ * Blur the specified element, as long as it's not the HTML body element.
1320
+ * This works around an IE9/10 bug - blurring the body causes Windows to
1321
+ * blur the whole application.
1322
+ *
1323
+ * @param {Element} el to blur
1324
+ */
1325
+ function safeBlur(el) {
1326
+ // Find the actual focused element when the active element is inside a shadow root
1327
+ while (el && el.shadowRoot && el.shadowRoot.activeElement) {
1328
+ el = el.shadowRoot.activeElement;
1329
+ }
1330
+
1331
+ if (el && el.blur && el !== document.body) {
1332
+ el.blur();
1333
+ }
1334
+ }
1335
+
1336
+ /**
1337
+ * @param {!NodeList} nodeList to search
1338
+ * @param {Node} node to find
1339
+ * @return {boolean} whether node is inside nodeList
1340
+ */
1341
+ function inNodeList(nodeList, node) {
1342
+ for (var i = 0; i < nodeList.length; ++i) {
1343
+ if (nodeList[i] === node) {
1344
+ return true;
1345
+ }
1346
+ }
1347
+ return false;
1348
+ }
1349
+
1350
+ /**
1351
+ * @param {HTMLFormElement} el to check
1352
+ * @return {boolean} whether this form has method="dialog"
1353
+ */
1354
+ function isFormMethodDialog(el) {
1355
+ if (!el || !el.hasAttribute('method')) {
1356
+ return false;
1357
+ }
1358
+ return el.getAttribute('method').toLowerCase() === 'dialog';
1359
+ }
1360
+
1361
+ /**
1362
+ * @param {!DocumentFragment|!Element} hostElement
1363
+ * @return {?Element}
1364
+ */
1365
+ function findFocusableElementWithin(hostElement) {
1366
+ // Note that this is 'any focusable area'. This list is probably not exhaustive, but the
1367
+ // alternative involves stepping through and trying to focus everything.
1368
+ var opts = ['button', 'input', 'keygen', 'select', 'textarea'];
1369
+ var query = opts.map(function(el) {
1370
+ return el + ':not([disabled])';
1371
+ });
1372
+ // TODO(samthor): tabindex values that are not numeric are not focusable.
1373
+ query.push('[tabindex]:not([disabled]):not([tabindex=""])'); // tabindex != "", not disabled
1374
+ var target = hostElement.querySelector(query.join(', '));
1375
+
1376
+ if (!target && 'attachShadow' in Element.prototype) {
1377
+ // If we haven't found a focusable target, see if the host element contains an element
1378
+ // which has a shadowRoot.
1379
+ // Recursively search for the first focusable item in shadow roots.
1380
+ var elems = hostElement.querySelectorAll('*');
1381
+ for (var i = 0; i < elems.length; i++) {
1382
+ if (elems[i].tagName && elems[i].shadowRoot) {
1383
+ target = findFocusableElementWithin(elems[i].shadowRoot);
1384
+ if (target) {
1385
+ break;
1386
+ }
1387
+ }
1388
+ }
1389
+ }
1390
+ return target;
1391
+ }
1392
+
1393
+ /**
1394
+ * Determines if an element is attached to the DOM.
1395
+ * @param {Element} element to check
1396
+ * @return {boolean} whether the element is in DOM
1397
+ */
1398
+ function isConnected(element) {
1399
+ return element.isConnected || document.body.contains(element);
1400
+ }
1401
+
1402
+ /**
1403
+ * @param {!Event} event
1404
+ * @return {?Element}
1405
+ */
1406
+ function findFormSubmitter(event) {
1407
+ if (event.submitter) {
1408
+ return event.submitter;
1409
+ }
1410
+
1411
+ var form = event.target;
1412
+ if (!(form instanceof HTMLFormElement)) {
1413
+ return null;
1414
+ }
1415
+
1416
+ var submitter = dialogPolyfill.formSubmitter;
1417
+ if (!submitter) {
1418
+ var target = event.target;
1419
+ var root = ('getRootNode' in target && target.getRootNode() || document);
1420
+ submitter = root.activeElement;
1421
+ }
1422
+
1423
+ if (!submitter || submitter.form !== form) {
1424
+ return null;
1425
+ }
1426
+ return submitter;
1427
+ }
1428
+
1429
+ /**
1430
+ * @param {!Event} event
1431
+ */
1432
+ function maybeHandleSubmit(event) {
1433
+ if (event.defaultPrevented) {
1434
+ return;
1435
+ }
1436
+ var form = /** @type {!HTMLFormElement} */ (event.target);
1437
+
1438
+ // We'd have a value if we clicked on an imagemap.
1439
+ var value = dialogPolyfill.imagemapUseValue;
1440
+ var submitter = findFormSubmitter(event);
1441
+ if (value === null && submitter) {
1442
+ value = submitter.value;
1443
+ }
1444
+
1445
+ // There should always be a dialog as this handler is added specifically on them, but check just
1446
+ // in case.
1447
+ var dialog = findNearestDialog(form);
1448
+ if (!dialog) {
1449
+ return;
1450
+ }
1451
+
1452
+ // Prefer formmethod on the button.
1453
+ var formmethod = submitter && submitter.getAttribute('formmethod') || form.getAttribute('method');
1454
+ if (formmethod !== 'dialog') {
1455
+ return;
1456
+ }
1457
+ event.preventDefault();
1458
+
1459
+ if (value != null) {
1460
+ // nb. we explicitly check against null/undefined
1461
+ dialog.close(value);
1462
+ } else {
1463
+ dialog.close();
1464
+ }
1465
+ }
1466
+
1467
+ /**
1468
+ * @param {!HTMLDialogElement} dialog to upgrade
1469
+ * @constructor
1470
+ */
1471
+ function dialogPolyfillInfo(dialog) {
1472
+ this.dialog_ = dialog;
1473
+ this.replacedStyleTop_ = false;
1474
+ this.openAsModal_ = false;
1475
+
1476
+ // Set a11y role. Browsers that support dialog implicitly know this already.
1477
+ if (!dialog.hasAttribute('role')) {
1478
+ dialog.setAttribute('role', 'dialog');
1479
+ }
1480
+
1481
+ dialog.show = this.show.bind(this);
1482
+ dialog.showModal = this.showModal.bind(this);
1483
+ dialog.close = this.close.bind(this);
1484
+
1485
+ dialog.addEventListener('submit', maybeHandleSubmit, false);
1486
+
1487
+ if (!('returnValue' in dialog)) {
1488
+ dialog.returnValue = '';
1489
+ }
1490
+
1491
+ if ('MutationObserver' in window) {
1492
+ var mo = new MutationObserver(this.maybeHideModal.bind(this));
1493
+ mo.observe(dialog, {attributes: true, attributeFilter: ['open']});
1494
+ } else {
1495
+ // IE10 and below support. Note that DOMNodeRemoved etc fire _before_ removal. They also
1496
+ // seem to fire even if the element was removed as part of a parent removal. Use the removed
1497
+ // events to force downgrade (useful if removed/immediately added).
1498
+ var removed = false;
1499
+ var cb = function() {
1500
+ removed ? this.downgradeModal() : this.maybeHideModal();
1501
+ removed = false;
1502
+ }.bind(this);
1503
+ var timeout;
1504
+ var delayModel = function(ev) {
1505
+ if (ev.target !== dialog) { return; } // not for a child element
1506
+ var cand = 'DOMNodeRemoved';
1507
+ removed |= (ev.type.substr(0, cand.length) === cand);
1508
+ window.clearTimeout(timeout);
1509
+ timeout = window.setTimeout(cb, 0);
1510
+ };
1511
+ ['DOMAttrModified', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument'].forEach(function(name) {
1512
+ dialog.addEventListener(name, delayModel);
1513
+ });
1514
+ }
1515
+ // Note that the DOM is observed inside DialogManager while any dialog
1516
+ // is being displayed as a modal, to catch modal removal from the DOM.
1517
+
1518
+ Object.defineProperty(dialog, 'open', {
1519
+ set: this.setOpen.bind(this),
1520
+ get: dialog.hasAttribute.bind(dialog, 'open')
1521
+ });
1522
+
1523
+ this.backdrop_ = document.createElement('div');
1524
+ this.backdrop_.className = 'backdrop';
1525
+ this.backdrop_.addEventListener('mouseup' , this.backdropMouseEvent_.bind(this));
1526
+ this.backdrop_.addEventListener('mousedown', this.backdropMouseEvent_.bind(this));
1527
+ this.backdrop_.addEventListener('click' , this.backdropMouseEvent_.bind(this));
1528
+ }
1529
+
1530
+ dialogPolyfillInfo.prototype = /** @type {HTMLDialogElement.prototype} */ ({
1531
+
1532
+ get dialog() {
1533
+ return this.dialog_;
1534
+ },
1535
+
1536
+ /**
1537
+ * Maybe remove this dialog from the modal top layer. This is called when
1538
+ * a modal dialog may no longer be tenable, e.g., when the dialog is no
1539
+ * longer open or is no longer part of the DOM.
1540
+ */
1541
+ maybeHideModal: function() {
1542
+ if (this.dialog_.hasAttribute('open') && isConnected(this.dialog_)) { return; }
1543
+ this.downgradeModal();
1544
+ },
1545
+
1546
+ /**
1547
+ * Remove this dialog from the modal top layer, leaving it as a non-modal.
1548
+ */
1549
+ downgradeModal: function() {
1550
+ if (!this.openAsModal_) { return; }
1551
+ this.openAsModal_ = false;
1552
+ this.dialog_.style.zIndex = '';
1553
+
1554
+ // This won't match the native <dialog> exactly because if the user set top on a centered
1555
+ // polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
1556
+ // possible to polyfill this perfectly.
1557
+ if (this.replacedStyleTop_) {
1558
+ this.dialog_.style.top = '';
1559
+ this.replacedStyleTop_ = false;
1560
+ }
1561
+
1562
+ // Clear the backdrop and remove from the manager.
1563
+ this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_);
1564
+ dialogPolyfill.dm.removeDialog(this);
1565
+ },
1566
+
1567
+ /**
1568
+ * @param {boolean} value whether to open or close this dialog
1569
+ */
1570
+ setOpen: function(value) {
1571
+ if (value) {
1572
+ this.dialog_.hasAttribute('open') || this.dialog_.setAttribute('open', '');
1573
+ } else {
1574
+ this.dialog_.removeAttribute('open');
1575
+ this.maybeHideModal(); // nb. redundant with MutationObserver
1576
+ }
1577
+ },
1578
+
1579
+ /**
1580
+ * Handles mouse events ('mouseup', 'mousedown', 'click') on the fake .backdrop element, redirecting them as if
1581
+ * they were on the dialog itself.
1582
+ *
1583
+ * @param {!Event} e to redirect
1584
+ */
1585
+ backdropMouseEvent_: function(e) {
1586
+ if (!this.dialog_.hasAttribute('tabindex')) {
1587
+ // Clicking on the backdrop should move the implicit cursor, even if dialog cannot be
1588
+ // focused. Create a fake thing to focus on. If the backdrop was _before_ the dialog, this
1589
+ // would not be needed - clicks would move the implicit cursor there.
1590
+ var fake = document.createElement('div');
1591
+ this.dialog_.insertBefore(fake, this.dialog_.firstChild);
1592
+ fake.tabIndex = -1;
1593
+ fake.focus();
1594
+ this.dialog_.removeChild(fake);
1595
+ } else {
1596
+ this.dialog_.focus();
1597
+ }
1598
+
1599
+ var redirectedEvent = document.createEvent('MouseEvents');
1600
+ redirectedEvent.initMouseEvent(e.type, e.bubbles, e.cancelable, window,
1601
+ e.detail, e.screenX, e.screenY, e.clientX, e.clientY, e.ctrlKey,
1602
+ e.altKey, e.shiftKey, e.metaKey, e.button, e.relatedTarget);
1603
+ this.dialog_.dispatchEvent(redirectedEvent);
1604
+ e.stopPropagation();
1605
+ },
1606
+
1607
+ /**
1608
+ * Focuses on the first focusable element within the dialog. This will always blur the current
1609
+ * focus, even if nothing within the dialog is found.
1610
+ */
1611
+ focus_: function() {
1612
+ // Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
1613
+ var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
1614
+ if (!target && this.dialog_.tabIndex >= 0) {
1615
+ target = this.dialog_;
1616
+ }
1617
+ if (!target) {
1618
+ target = findFocusableElementWithin(this.dialog_);
1619
+ }
1620
+ safeBlur(document.activeElement);
1621
+ target && target.focus();
1622
+ },
1623
+
1624
+ /**
1625
+ * Sets the zIndex for the backdrop and dialog.
1626
+ *
1627
+ * @param {number} dialogZ
1628
+ * @param {number} backdropZ
1629
+ */
1630
+ updateZIndex: function(dialogZ, backdropZ) {
1631
+ if (dialogZ < backdropZ) {
1632
+ throw new Error('dialogZ should never be < backdropZ');
1633
+ }
1634
+ this.dialog_.style.zIndex = dialogZ;
1635
+ this.backdrop_.style.zIndex = backdropZ;
1636
+ },
1637
+
1638
+ /**
1639
+ * Shows the dialog. If the dialog is already open, this does nothing.
1640
+ */
1641
+ show: function() {
1642
+ if (!this.dialog_.open) {
1643
+ this.setOpen(true);
1644
+ this.focus_();
1645
+ }
1646
+ },
1647
+
1648
+ /**
1649
+ * Show this dialog modally.
1650
+ */
1651
+ showModal: function() {
1652
+ if (this.dialog_.hasAttribute('open')) {
1653
+ throw new Error('Failed to execute \'showModal\' on dialog: The element is already open, and therefore cannot be opened modally.');
1654
+ }
1655
+ if (!isConnected(this.dialog_)) {
1656
+ throw new Error('Failed to execute \'showModal\' on dialog: The element is not in a Document.');
1657
+ }
1658
+ if (!dialogPolyfill.dm.pushDialog(this)) {
1659
+ throw new Error('Failed to execute \'showModal\' on dialog: There are too many open modal dialogs.');
1660
+ }
1661
+
1662
+ if (createsStackingContext(this.dialog_.parentElement)) {
1663
+ console.warn('A dialog is being shown inside a stacking context. ' +
1664
+ 'This may cause it to be unusable. For more information, see this link: ' +
1665
+ 'https://github.com/GoogleChrome/dialog-polyfill/#stacking-context');
1666
+ }
1667
+
1668
+ this.setOpen(true);
1669
+ this.openAsModal_ = true;
1670
+
1671
+ // Optionally center vertically, relative to the current viewport.
1672
+ if (dialogPolyfill.needsCentering(this.dialog_)) {
1673
+ dialogPolyfill.reposition(this.dialog_);
1674
+ this.replacedStyleTop_ = true;
1675
+ } else {
1676
+ this.replacedStyleTop_ = false;
1677
+ }
1678
+
1679
+ // Insert backdrop.
1680
+ this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling);
1681
+
1682
+ // Focus on whatever inside the dialog.
1683
+ this.focus_();
1684
+ },
1685
+
1686
+ /**
1687
+ * Closes this HTMLDialogElement. This is optional vs clearing the open
1688
+ * attribute, however this fires a 'close' event.
1689
+ *
1690
+ * @param {string=} opt_returnValue to use as the returnValue
1691
+ */
1692
+ close: function(opt_returnValue) {
1693
+ if (!this.dialog_.hasAttribute('open')) {
1694
+ throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.');
1695
+ }
1696
+ this.setOpen(false);
1697
+
1698
+ // Leave returnValue untouched in case it was set directly on the element
1699
+ if (opt_returnValue !== undefined) {
1700
+ this.dialog_.returnValue = opt_returnValue;
1701
+ }
1702
+
1703
+ // Triggering "close" event for any attached listeners on the <dialog>.
1704
+ var closeEvent = new supportCustomEvent('close', {
1705
+ bubbles: false,
1706
+ cancelable: false
1707
+ });
1708
+ safeDispatchEvent(this.dialog_, closeEvent);
1709
+ }
1710
+
1711
+ });
1712
+
1713
+ var dialogPolyfill = {};
1714
+
1715
+ dialogPolyfill.reposition = function(element) {
1716
+ var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
1717
+ var topValue = scrollTop + (window.innerHeight - element.offsetHeight) / 2;
1718
+ element.style.top = Math.max(scrollTop, topValue) + 'px';
1719
+ };
1720
+
1721
+ dialogPolyfill.isInlinePositionSetByStylesheet = function(element) {
1722
+ for (var i = 0; i < document.styleSheets.length; ++i) {
1723
+ var styleSheet = document.styleSheets[i];
1724
+ var cssRules = null;
1725
+ // Some browsers throw on cssRules.
1726
+ try {
1727
+ cssRules = styleSheet.cssRules;
1728
+ } catch (e) {}
1729
+ if (!cssRules) { continue; }
1730
+ for (var j = 0; j < cssRules.length; ++j) {
1731
+ var rule = cssRules[j];
1732
+ var selectedNodes = null;
1733
+ // Ignore errors on invalid selector texts.
1734
+ try {
1735
+ selectedNodes = document.querySelectorAll(rule.selectorText);
1736
+ } catch(e) {}
1737
+ if (!selectedNodes || !inNodeList(selectedNodes, element)) {
1738
+ continue;
1739
+ }
1740
+ var cssTop = rule.style.getPropertyValue('top');
1741
+ var cssBottom = rule.style.getPropertyValue('bottom');
1742
+ if ((cssTop && cssTop !== 'auto') || (cssBottom && cssBottom !== 'auto')) {
1743
+ return true;
1744
+ }
1745
+ }
1746
+ }
1747
+ return false;
1748
+ };
1749
+
1750
+ dialogPolyfill.needsCentering = function(dialog) {
1751
+ var computedStyle = window.getComputedStyle(dialog);
1752
+ if (computedStyle.position !== 'absolute') {
1753
+ return false;
1754
+ }
1755
+
1756
+ // We must determine whether the top/bottom specified value is non-auto. In
1757
+ // WebKit/Blink, checking computedStyle.top == 'auto' is sufficient, but
1758
+ // Firefox returns the used value. So we do this crazy thing instead: check
1759
+ // the inline style and then go through CSS rules.
1760
+ if ((dialog.style.top !== 'auto' && dialog.style.top !== '') ||
1761
+ (dialog.style.bottom !== 'auto' && dialog.style.bottom !== '')) {
1762
+ return false;
1763
+ }
1764
+ return !dialogPolyfill.isInlinePositionSetByStylesheet(dialog);
1765
+ };
1766
+
1767
+ /**
1768
+ * @param {!Element} element to force upgrade
1769
+ */
1770
+ dialogPolyfill.forceRegisterDialog = function(element) {
1771
+ if (window.HTMLDialogElement || element.showModal) {
1772
+ console.warn('This browser already supports <dialog>, the polyfill ' +
1773
+ 'may not work correctly', element);
1774
+ }
1775
+ if (element.localName !== 'dialog') {
1776
+ throw new Error('Failed to register dialog: The element is not a dialog.');
1777
+ }
1778
+ new dialogPolyfillInfo(/** @type {!HTMLDialogElement} */ (element));
1779
+ };
1780
+
1781
+ /**
1782
+ * @param {!Element} element to upgrade, if necessary
1783
+ */
1784
+ dialogPolyfill.registerDialog = function(element) {
1785
+ if (!element.showModal) {
1786
+ dialogPolyfill.forceRegisterDialog(element);
1787
+ }
1788
+ };
1789
+
1790
+ /**
1791
+ * @constructor
1792
+ */
1793
+ dialogPolyfill.DialogManager = function() {
1794
+ /** @type {!Array<!dialogPolyfillInfo>} */
1795
+ this.pendingDialogStack = [];
1796
+
1797
+ var checkDOM = this.checkDOM_.bind(this);
1798
+
1799
+ // The overlay is used to simulate how a modal dialog blocks the document.
1800
+ // The blocking dialog is positioned on top of the overlay, and the rest of
1801
+ // the dialogs on the pending dialog stack are positioned below it. In the
1802
+ // actual implementation, the modal dialog stacking is controlled by the
1803
+ // top layer, where z-index has no effect.
1804
+ this.overlay = document.createElement('div');
1805
+ this.overlay.className = '_dialog_overlay';
1806
+ this.overlay.addEventListener('click', function(e) {
1807
+ this.forwardTab_ = undefined;
1808
+ e.stopPropagation();
1809
+ checkDOM([]); // sanity-check DOM
1810
+ }.bind(this));
1811
+
1812
+ this.handleKey_ = this.handleKey_.bind(this);
1813
+ this.handleFocus_ = this.handleFocus_.bind(this);
1814
+
1815
+ this.zIndexLow_ = 100000;
1816
+ this.zIndexHigh_ = 100000 + 150;
1817
+
1818
+ this.forwardTab_ = undefined;
1819
+
1820
+ if ('MutationObserver' in window) {
1821
+ this.mo_ = new MutationObserver(function(records) {
1822
+ var removed = [];
1823
+ records.forEach(function(rec) {
1824
+ for (var i = 0, c; c = rec.removedNodes[i]; ++i) {
1825
+ if (!(c instanceof Element)) {
1826
+ continue;
1827
+ } else if (c.localName === 'dialog') {
1828
+ removed.push(c);
1829
+ }
1830
+ removed = removed.concat(c.querySelectorAll('dialog'));
1831
+ }
1832
+ });
1833
+ removed.length && checkDOM(removed);
1834
+ });
1835
+ }
1836
+ };
1837
+
1838
+ /**
1839
+ * Called on the first modal dialog being shown. Adds the overlay and related
1840
+ * handlers.
1841
+ */
1842
+ dialogPolyfill.DialogManager.prototype.blockDocument = function() {
1843
+ document.documentElement.addEventListener('focus', this.handleFocus_, true);
1844
+ document.addEventListener('keydown', this.handleKey_);
1845
+ this.mo_ && this.mo_.observe(document, {childList: true, subtree: true});
1846
+ };
1847
+
1848
+ /**
1849
+ * Called on the first modal dialog being removed, i.e., when no more modal
1850
+ * dialogs are visible.
1851
+ */
1852
+ dialogPolyfill.DialogManager.prototype.unblockDocument = function() {
1853
+ document.documentElement.removeEventListener('focus', this.handleFocus_, true);
1854
+ document.removeEventListener('keydown', this.handleKey_);
1855
+ this.mo_ && this.mo_.disconnect();
1856
+ };
1857
+
1858
+ /**
1859
+ * Updates the stacking of all known dialogs.
1860
+ */
1861
+ dialogPolyfill.DialogManager.prototype.updateStacking = function() {
1862
+ var zIndex = this.zIndexHigh_;
1863
+
1864
+ for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
1865
+ dpi.updateZIndex(--zIndex, --zIndex);
1866
+ if (i === 0) {
1867
+ this.overlay.style.zIndex = --zIndex;
1868
+ }
1869
+ }
1870
+
1871
+ // Make the overlay a sibling of the dialog itself.
1872
+ var last = this.pendingDialogStack[0];
1873
+ if (last) {
1874
+ var p = last.dialog.parentNode || document.body;
1875
+ p.appendChild(this.overlay);
1876
+ } else if (this.overlay.parentNode) {
1877
+ this.overlay.parentNode.removeChild(this.overlay);
1878
+ }
1879
+ };
1880
+
1881
+ /**
1882
+ * @param {Element} candidate to check if contained or is the top-most modal dialog
1883
+ * @return {boolean} whether candidate is contained in top dialog
1884
+ */
1885
+ dialogPolyfill.DialogManager.prototype.containedByTopDialog_ = function(candidate) {
1886
+ while (candidate = findNearestDialog(candidate)) {
1887
+ for (var i = 0, dpi; dpi = this.pendingDialogStack[i]; ++i) {
1888
+ if (dpi.dialog === candidate) {
1889
+ return i === 0; // only valid if top-most
1890
+ }
1891
+ }
1892
+ candidate = candidate.parentElement;
1893
+ }
1894
+ return false;
1895
+ };
1896
+
1897
+ dialogPolyfill.DialogManager.prototype.handleFocus_ = function(event) {
1898
+ var target = event.composedPath ? event.composedPath()[0] : event.target;
1899
+
1900
+ if (this.containedByTopDialog_(target)) { return; }
1901
+
1902
+ if (document.activeElement === document.documentElement) { return; }
1903
+
1904
+ event.preventDefault();
1905
+ event.stopPropagation();
1906
+ safeBlur(/** @type {Element} */ (target));
1907
+
1908
+ if (this.forwardTab_ === undefined) { return; } // move focus only from a tab key
1909
+
1910
+ var dpi = this.pendingDialogStack[0];
1911
+ var dialog = dpi.dialog;
1912
+ var position = dialog.compareDocumentPosition(target);
1913
+ if (position & Node.DOCUMENT_POSITION_PRECEDING) {
1914
+ if (this.forwardTab_) {
1915
+ // forward
1916
+ dpi.focus_();
1917
+ } else if (target !== document.documentElement) {
1918
+ // backwards if we're not already focused on <html>
1919
+ document.documentElement.focus();
1920
+ }
1921
+ }
1922
+
1923
+ return false;
1924
+ };
1925
+
1926
+ dialogPolyfill.DialogManager.prototype.handleKey_ = function(event) {
1927
+ this.forwardTab_ = undefined;
1928
+ if (event.keyCode === 27) {
1929
+ event.preventDefault();
1930
+ event.stopPropagation();
1931
+ var cancelEvent = new supportCustomEvent('cancel', {
1932
+ bubbles: false,
1933
+ cancelable: true
1934
+ });
1935
+ var dpi = this.pendingDialogStack[0];
1936
+ if (dpi && safeDispatchEvent(dpi.dialog, cancelEvent)) {
1937
+ dpi.dialog.close();
1938
+ }
1939
+ } else if (event.keyCode === 9) {
1940
+ this.forwardTab_ = !event.shiftKey;
1941
+ }
1942
+ };
1943
+
1944
+ /**
1945
+ * Finds and downgrades any known modal dialogs that are no longer displayed. Dialogs that are
1946
+ * removed and immediately readded don't stay modal, they become normal.
1947
+ *
1948
+ * @param {!Array<!HTMLDialogElement>} removed that have definitely been removed
1949
+ */
1950
+ dialogPolyfill.DialogManager.prototype.checkDOM_ = function(removed) {
1951
+ // This operates on a clone because it may cause it to change. Each change also calls
1952
+ // updateStacking, which only actually needs to happen once. But who removes many modal dialogs
1953
+ // at a time?!
1954
+ var clone = this.pendingDialogStack.slice();
1955
+ clone.forEach(function(dpi) {
1956
+ if (removed.indexOf(dpi.dialog) !== -1) {
1957
+ dpi.downgradeModal();
1958
+ } else {
1959
+ dpi.maybeHideModal();
1960
+ }
1961
+ });
1962
+ };
1963
+
1964
+ /**
1965
+ * @param {!dialogPolyfillInfo} dpi
1966
+ * @return {boolean} whether the dialog was allowed
1967
+ */
1968
+ dialogPolyfill.DialogManager.prototype.pushDialog = function(dpi) {
1969
+ var allowed = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
1970
+ if (this.pendingDialogStack.length >= allowed) {
1971
+ return false;
1972
+ }
1973
+ if (this.pendingDialogStack.unshift(dpi) === 1) {
1974
+ this.blockDocument();
1975
+ }
1976
+ this.updateStacking();
1977
+ return true;
1978
+ };
1979
+
1980
+ /**
1981
+ * @param {!dialogPolyfillInfo} dpi
1982
+ */
1983
+ dialogPolyfill.DialogManager.prototype.removeDialog = function(dpi) {
1984
+ var index = this.pendingDialogStack.indexOf(dpi);
1985
+ if (index === -1) { return; }
1986
+
1987
+ this.pendingDialogStack.splice(index, 1);
1988
+ if (this.pendingDialogStack.length === 0) {
1989
+ this.unblockDocument();
1990
+ }
1991
+ this.updateStacking();
1992
+ };
1993
+
1994
+ dialogPolyfill.dm = new dialogPolyfill.DialogManager();
1995
+ dialogPolyfill.formSubmitter = null;
1996
+ dialogPolyfill.imagemapUseValue = null;
1997
+
1998
+ /**
1999
+ * Installs global handlers, such as click listers and native method overrides. These are needed
2000
+ * even if a no dialog is registered, as they deal with <form method="dialog">.
2001
+ */
2002
+ if (window.HTMLDialogElement === undefined) {
2003
+
2004
+ /**
2005
+ * If HTMLFormElement translates method="DIALOG" into 'get', then replace the descriptor with
2006
+ * one that returns the correct value.
2007
+ */
2008
+ var testForm = document.createElement('form');
2009
+ testForm.setAttribute('method', 'dialog');
2010
+ if (testForm.method !== 'dialog') {
2011
+ var methodDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, 'method');
2012
+ if (methodDescriptor) {
2013
+ // nb. Some older iOS and older PhantomJS fail to return the descriptor. Don't do anything
2014
+ // and don't bother to update the element.
2015
+ var realGet = methodDescriptor.get;
2016
+ methodDescriptor.get = function() {
2017
+ if (isFormMethodDialog(this)) {
2018
+ return 'dialog';
2019
+ }
2020
+ return realGet.call(this);
2021
+ };
2022
+ var realSet = methodDescriptor.set;
2023
+ /** @this {HTMLElement} */
2024
+ methodDescriptor.set = function(v) {
2025
+ if (typeof v === 'string' && v.toLowerCase() === 'dialog') {
2026
+ return this.setAttribute('method', v);
2027
+ }
2028
+ return realSet.call(this, v);
2029
+ };
2030
+ Object.defineProperty(HTMLFormElement.prototype, 'method', methodDescriptor);
2031
+ }
2032
+ }
2033
+
2034
+ /**
2035
+ * Global 'click' handler, to capture the <input type="submit"> or <button> element which has
2036
+ * submitted a <form method="dialog">. Needed as Safari and others don't report this inside
2037
+ * document.activeElement.
2038
+ */
2039
+ document.addEventListener('click', function(ev) {
2040
+ dialogPolyfill.formSubmitter = null;
2041
+ dialogPolyfill.imagemapUseValue = null;
2042
+ if (ev.defaultPrevented) { return; } // e.g. a submit which prevents default submission
2043
+
2044
+ var target = /** @type {Element} */ (ev.target);
2045
+ if ('composedPath' in ev) {
2046
+ var path = ev.composedPath();
2047
+ target = path.shift() || target;
2048
+ }
2049
+ if (!target || !isFormMethodDialog(target.form)) { return; }
2050
+
2051
+ var valid = (target.type === 'submit' && ['button', 'input'].indexOf(target.localName) > -1);
2052
+ if (!valid) {
2053
+ if (!(target.localName === 'input' && target.type === 'image')) { return; }
2054
+ // this is a <input type="image">, which can submit forms
2055
+ dialogPolyfill.imagemapUseValue = ev.offsetX + ',' + ev.offsetY;
2056
+ }
2057
+
2058
+ var dialog = findNearestDialog(target);
2059
+ if (!dialog) { return; }
2060
+
2061
+ dialogPolyfill.formSubmitter = target;
2062
+
2063
+ }, false);
2064
+
2065
+ /**
2066
+ * Global 'submit' handler. This handles submits of `method="dialog"` which are invalid, i.e.,
2067
+ * outside a dialog. They get prevented.
2068
+ */
2069
+ document.addEventListener('submit', function(ev) {
2070
+ var form = ev.target;
2071
+ var dialog = findNearestDialog(form);
2072
+ if (dialog) {
2073
+ return; // ignore, handle there
2074
+ }
2075
+
2076
+ var submitter = findFormSubmitter(ev);
2077
+ var formmethod = submitter && submitter.getAttribute('formmethod') || form.getAttribute('method');
2078
+ if (formmethod === 'dialog') {
2079
+ ev.preventDefault();
2080
+ }
2081
+ });
2082
+
2083
+ /**
2084
+ * Replace the native HTMLFormElement.submit() method, as it won't fire the
2085
+ * submit event and give us a chance to respond.
2086
+ */
2087
+ var nativeFormSubmit = HTMLFormElement.prototype.submit;
2088
+ var replacementFormSubmit = function () {
2089
+ if (!isFormMethodDialog(this)) {
2090
+ return nativeFormSubmit.call(this);
2091
+ }
2092
+ var dialog = findNearestDialog(this);
2093
+ dialog && dialog.close();
2094
+ };
2095
+ HTMLFormElement.prototype.submit = replacementFormSubmit;
2096
+ }
2097
+
2098
+ const stylesCss$3 = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>dialog{padding:0;border:none;margin:0;background-color:transparent}:host>dialog:modal{width:100%;max-width:100%;max-height:100%}:host>dialog::backdrop{display:none}:host>dialog+.backdrop{display:none}:host>dialog:not([open]){display:none}:host>dialog[open]{display:block}.modal-container{z-index:1010;display:flex;overflow:-moz-scrollbars-none;width:100%;height:100vh;flex-direction:column}.modal-container>.modal-content-scroll-outside{overflow:auto;background:var(--color-surface01)}.modal-container>header{padding:calc(var(--space-unit) * 2 - 2px) calc(var(--space-unit) * 2);background:var(--color-surface02)}.modal-container>header button{padding:0;border:none;margin:0;margin-left:auto;background:transparent;cursor:pointer}.modal-container>header z-icon{--z-icon-width:calc(var(--space-unit) * 2.5);--z-icon-height:calc(var(--space-unit) * 2.5);display:flex;fill:var(--color-icon01)}.modal-container>header>div{display:flex;width:100%;align-items:center;margin-right:calc(var(--space-unit) * 2)}.modal-container>header h1,.modal-container>header h2{padding:0;margin:0;color:var(--color-text01);font-weight:var(--font-rg)}.modal-container>header h1{font-size:var(--font-size-5);letter-spacing:0;line-height:1.4}.modal-container>header h2{font-size:var(--font-size-3);letter-spacing:0;line-height:1.5}.modal-container>header>div>h1 *:empty{display:none}.modal-container>header h1+h2{margin-top:calc(var(--space-unit) * 0.5)}.modal-container-scroll-inside>.modal-content-scroll-inside{overflow:hidden auto;flex:1 auto;background:var(--color-surface01)}.modal-container-scroll-inside>.modal-content-scroll-inside::-webkit-scrollbar,.modal-container-scroll-outside>.modal-content-scroll-outside::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.modal-container-scroll-inside>.modal-content-scroll-inside::-webkit-scrollbar-thumb,.modal-container-scroll-outside>.modal-content-scroll-outside::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01)}.modal-container-scroll-inside>.modal-content-scroll-inside::-webkit-scrollbar-thumb:hover,.modal-container-scroll-outside>.modal-content-scroll-outside::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.modal-container-scroll-inside .modal-content-scroll-inside,.modal-container-scroll-outside .modal-content-scroll-outside{scrollbar-color:var(--color-primary01) transparent}@media only screen and (min-width: 768px){.modal-background{position:fixed;top:0;left:0;overflow:hidden;width:100vw;height:100vh;background-color:var(--gray900);opacity:0.7}.modal-background.modal-background-scroll-outside{position:sticky}.modal-container-scroll-inside{position:fixed;top:calc(var(--space-unit) * 6);left:50%;overflow:hidden;width:auto;min-width:calc(var(--space-unit) * 40);height:auto;min-height:calc(var(--space-unit) * 40);max-height:calc(100vh - calc(var(--space-unit) * 6 * 2));border-radius:var(--border-radius);transform:translateX(-50%)}.modal-container-scroll-outside{position:absolute;top:calc(var(--space-unit) * 6);left:50%;display:block;overflow:initial;width:auto;min-width:calc(var(--space-unit) * 40);height:auto;min-height:calc(var(--space-unit) * 40);max-height:calc(100vh - calc(var(--space-unit) * 6 * 2));transform:translateX(-50%)}.modal-container>.modal-content-scroll-outside{overflow:initial}.modal-container-scroll-outside>header{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.modal-container-scroll-outside::after{display:block;height:calc(var(--space-unit) * 6);content:\" \"}.modal-dialog{position:fixed;top:0;left:0;height:auto;overflow-x:hidden;overflow-y:auto}.modal-content-scroll-outside{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.modal-container-scroll-inside>header{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.modal-dialog::-webkit-scrollbar{display:none}.modal-container>header z-icon{--z-icon-width:calc(var(--space-unit) * 3);--z-icon-height:calc(var(--space-unit) * 3)}}@media only screen and (min-width: 768px) and (max-width: 1151px){.modal-container>header{padding:calc(var(--space-unit) * 3 - 2px) calc(var(--space-unit) * 3)}}@media only screen and (min-width: 1152px){.modal-container>header{padding:calc(var(--space-unit) * 4 - 4px) calc(var(--space-unit) * 4)}.modal-container>header h1{font-size:var(--font-size-6);letter-spacing:0;line-height:1.33}.modal-container>header h2{font-size:var(--font-size-4);letter-spacing:0;line-height:1.5}.modal-container>header h1+h2{margin-top:0}}";
2099
+
2100
+ const FOCUSABLE_ELEMENTS_SELECTOR = ':is(button, input, select, textarea, [contenteditable=""], [contenteditable="true"], a[href], [tabindex], summary):not([disabled], [disabled=""], [tabindex="-1"], [aria-hidden="true"], [hidden])';
2101
+ const ZModal = class {
2102
+ constructor(hostRef) {
2103
+ registerInstance(this, hostRef);
2104
+ this.modalClose = createEvent(this, "modalClose", 7);
2105
+ this.modalHeaderActive = createEvent(this, "modalHeaderActive", 7);
2106
+ this.modalBackgroundClick = createEvent(this, "modalBackgroundClick", 7);
2107
+ /** aria-label for close button (optional) */
2108
+ this.closeButtonLabel = "chiudi modale";
2109
+ /** add role "alertdialog" to dialog (optional, default is false) */
2110
+ this.alertdialog = false;
2111
+ /** if true, the modal is closable (optional, default is true) */
2112
+ this.closable = true;
2113
+ /** if true, the modal can scroll inside, if false the viewport can scroll */
2114
+ this.scrollInside = true;
2115
+ }
2116
+ emitModalClose() {
2117
+ if (this.closable) {
2118
+ this.modalClose.emit({ modalid: this.modalid });
2119
+ }
2120
+ }
2121
+ emitModalHeaderActive() {
2122
+ this.modalHeaderActive.emit({ modalid: this.modalid });
2123
+ }
2124
+ emitBackgroundClick() {
2125
+ if (this.closable) {
2126
+ this.modalBackgroundClick.emit({ modalid: this.modalid });
2127
+ }
2128
+ }
2129
+ componentDidLoad() {
2130
+ if (typeof HTMLDialogElement !== "function") {
2131
+ dialogPolyfill.registerDialog(this.dialog);
2132
+ this.dialog.setAttribute("open", "true");
2133
+ }
2134
+ else {
2135
+ this.open();
2136
+ }
2137
+ }
2138
+ /** open modal */
2139
+ async open() {
2140
+ var _a;
2141
+ (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.showModal();
2142
+ }
2143
+ /** close modal */
2144
+ async close() {
2145
+ var _a;
2146
+ if (this.closable) {
2147
+ (_a = this.dialog) === null || _a === void 0 ? void 0 : _a.close();
2148
+ }
2149
+ }
2150
+ /**
2151
+ * Get a list of focusable elements in the dialog.
2152
+ * Remove elements with `display: none` from the list, because they're not focusable.
2153
+ *
2154
+ * N.B. The list is built on the assumption that elements inside shadow root are placed ALL before the `modalContent` slot.
2155
+ * Adding focusable elements after the `modalContent` slot would break the order of elements in the list.
2156
+ */
2157
+ get focusableElements() {
2158
+ return [
2159
+ ...Array.from(this.host.shadowRoot.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR)),
2160
+ ...Array.from(this.host.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR)),
2161
+ ].filter((element) => getComputedStyle(element).display !== "none");
2162
+ }
2163
+ handleKeyDown(e) {
2164
+ if (e.code !== KeyboardCode.TAB) {
2165
+ return;
2166
+ }
2167
+ const focusableElements = this.focusableElements;
2168
+ const shadowActiveElement = this.host.shadowRoot.activeElement;
2169
+ const activeElement = this.host.ownerDocument.activeElement;
2170
+ const firstFocusableElement = focusableElements[0];
2171
+ const lastFocusableElement = focusableElements[focusableElements.length - 1];
2172
+ if (e.shiftKey && (shadowActiveElement == firstFocusableElement || activeElement == firstFocusableElement)) {
2173
+ // shift + tab was pressed and current active element is the first focusable element
2174
+ e.preventDefault();
2175
+ lastFocusableElement.focus();
2176
+ }
2177
+ else if (!e.shiftKey && (shadowActiveElement == lastFocusableElement || activeElement == lastFocusableElement)) {
2178
+ // shift + tab was pressed and current active element is the first focusable element
2179
+ e.preventDefault();
2180
+ firstFocusableElement.focus();
2181
+ }
2182
+ }
2183
+ closeButtonSlot() {
2184
+ if (this.closable) {
2185
+ return (h("slot", { name: "modalCloseButton" }, h("button", { "aria-label": this.closeButtonLabel, onClick: () => this.close() }, h("z-icon", { name: "multiply-circle-filled" }))));
2186
+ }
2187
+ }
2188
+ handleEscape(e) {
2189
+ if (this.closable) {
2190
+ return;
2191
+ }
2192
+ e.preventDefault();
2193
+ }
2194
+ render() {
2195
+ return (h("dialog", { class: {
2196
+ "modal-dialog": !this.scrollInside,
2197
+ }, "aria-labelledby": "modal-title", "aria-describedby": "modal-content", role: this.alertdialog ? "alertdialog" : undefined, ref: (el) => (this.dialog = el), onClose: () => this.emitModalClose(),
2198
+ // @ts-ignore
2199
+ onCancel: (e) => this.handleEscape(e) }, h("div", { class: {
2200
+ "modal-container": true,
2201
+ "modal-container-scroll-inside": this.scrollInside,
2202
+ "modal-container-scroll-outside": !this.scrollInside,
2203
+ }, id: this.modalid }, h("header", { onClick: this.emitModalHeaderActive.bind(this) }, h("div", null, this.modaltitle && h("h1", { id: "modal-title" }, this.modaltitle), this.closeButtonSlot()), this.modalsubtitle && h("h2", { id: "modal-subtitle" }, this.modalsubtitle)), h("div", { class: {
2204
+ "modal-content-scroll-inside": this.scrollInside,
2205
+ "modal-content-scroll-outside": !this.scrollInside,
2206
+ }, id: "modal-content" }, h("slot", { name: "modalContent" }))), h("div", { class: {
2207
+ "modal-background": true,
2208
+ "modal-background-scroll-outside": !this.scrollInside,
2209
+ }, "data-action": "modalBackground", "data-modal": this.modalid, onClick: () => {
2210
+ this.emitBackgroundClick();
2211
+ this.close();
2212
+ } })));
2213
+ }
2214
+ get host() { return getElement(this); }
2215
+ };
2216
+ ZModal.style = stylesCss$3;
2217
+
2218
+ const stylesCss$2 = ".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}";
2219
+
2220
+ const ZOffcanvas = class {
2221
+ constructor(hostRef) {
2222
+ registerInstance(this, hostRef);
2223
+ this.canvasOpenStatusChanged = createEvent(this, "canvasOpenStatusChanged", 7);
2224
+ /**
2225
+ * Offcanvas variant.
2226
+ * Can be one `overlay` or `pushcontent`.
2227
+ * Default variant: pushcontent
2228
+ */
2229
+ this.variant = OffCanvasVariant.PUSHCONTENT;
2230
+ /** Whether the offcanvas is open. Default: false */
2231
+ this.open = false;
2232
+ /** open content transitioning in a specified direction left | right. Default: left */
2233
+ this.transitiondirection = TransitionDirection.LEFT;
2234
+ /**
2235
+ * Whether to skip the initial animation.
2236
+ * Useful when the initial value of the `open` prop is set to `true`.
2237
+ */
2238
+ this.skipLoadAnimation = false;
2239
+ }
2240
+ onOpenChanged() {
2241
+ if (!this.open && this.skipLoadAnimation) {
2242
+ this.skipLoadAnimation = false;
2243
+ }
2244
+ if (this.open) {
2245
+ this.handlePageOverflow();
2246
+ }
2247
+ this.canvasOpenStatusChanged.emit(this.open);
2248
+ }
2249
+ handlePageOverflow() {
2250
+ const overflow = this.variant === OffCanvasVariant.OVERLAY ? "overflow-y" : "overflow-x";
2251
+ document.body.style[overflow] = this.open ? "hidden" : "";
2252
+ }
2253
+ render() {
2254
+ return (h(Host, { class: { "skip-animation": this.skipLoadAnimation } }, h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handlePageOverflow() }, h("div", { role: "presentation", class: "canvas-content" }, h("slot", { name: "canvasContent" }))), this.variant == OffCanvasVariant.OVERLAY && (h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
2255
+ }
2256
+ static get watchers() { return {
2257
+ "open": ["onOpenChanged"]
2258
+ }; }
2259
+ };
2260
+ ZOffcanvas.style = stylesCss$2;
2261
+
2262
+ const stylesCss$1 = ":host{z-index:10;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}";
2263
+
2264
+ const ZSearchbar = class {
2265
+ constructor(hostRef) {
2266
+ registerInstance(this, hostRef);
2267
+ this.searchSubmit = createEvent(this, "searchSubmit", 7);
2268
+ this.searchTyping = createEvent(this, "searchTyping", 7);
2269
+ this.searchItemClick = createEvent(this, "searchItemClick", 7);
2270
+ /** the id of the searchbar element */
2271
+ this.htmlid = `searchbar-${randomId()}`;
2272
+ /** Prevent submit action */
2273
+ this.preventSubmit = false;
2274
+ /** Show autocomplete results */
2275
+ this.autocomplete = false;
2276
+ /** Minimun number of characters to dispatch typing event */
2277
+ this.autocompleteMinChars = 3;
2278
+ /** Truncate results to single row */
2279
+ this.resultsEllipsis = true;
2280
+ /** Search helper text */
2281
+ this.searchHelperLabel = "Cerca {searchString}";
2282
+ /** Sort autocomplete results items */
2283
+ this.sortResultsItems = false;
2284
+ /** Show submit button */
2285
+ this.showSearchButton = false;
2286
+ /** Set button icon without label*/
2287
+ this.searchButtonIconOnly = false;
2288
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
2289
+ this.size = ControlSize.BIG;
2290
+ /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
2291
+ this.variant = ButtonVariant.PRIMARY;
2292
+ this.searchString = this.value;
2293
+ this.currResultsCount = 0;
2294
+ this.showResults = false;
2295
+ this.resultsItemsList = null;
2296
+ }
2297
+ emitSearchSubmit() {
2298
+ this.searchSubmit.emit(this.inputRef.value);
2299
+ }
2300
+ emitSearchTyping(search) {
2301
+ this.searchTyping.emit(search);
2302
+ }
2303
+ emitSearchItemClick(item) {
2304
+ this.searchItemClick.emit(item);
2305
+ }
2306
+ watchItems() {
2307
+ this.resultsItemsList = this.getResultsItemsList();
2308
+ }
2309
+ watchResultsCount() {
2310
+ this.currResultsCount = this.resultsCount;
2311
+ }
2312
+ watchValue() {
2313
+ this.searchString = this.value;
2314
+ }
2315
+ watchSearchString() {
2316
+ this.emitSearchTyping(this.searchString);
2317
+ if (!this.searchString) {
2318
+ this.currResultsCount = this.resultsCount;
2319
+ }
2320
+ }
2321
+ componentWillLoad() {
2322
+ this.resultsItemsList = this.getResultsItemsList();
2323
+ this.currResultsCount = this.resultsCount;
2324
+ }
2325
+ getResultsItemsList() {
2326
+ return typeof this.resultsItems === "string" ? JSON.parse(this.resultsItems) : this.resultsItems;
2327
+ }
2328
+ getGroupedItems(items) {
2329
+ const groupedItems = {};
2330
+ items.forEach((item) => {
2331
+ var _a;
2332
+ const key = `${item === null || item === void 0 ? void 0 : item.category}${item === null || item === void 0 ? void 0 : item.subcategory}`;
2333
+ groupedItems[key] = (_a = groupedItems[key]) !== null && _a !== void 0 ? _a : {
2334
+ category: item === null || item === void 0 ? void 0 : item.category,
2335
+ subcategory: item === null || item === void 0 ? void 0 : item.subcategory,
2336
+ items: [],
2337
+ };
2338
+ groupedItems[key]["items"].push(item);
2339
+ });
2340
+ if (this.sortResultsItems) {
2341
+ return Object.keys(groupedItems)
2342
+ .sort()
2343
+ .reduce((obj, key) => {
2344
+ obj[key] = Object.assign(Object.assign({}, groupedItems[key]), { items: groupedItems[key]["items"].sort((a, b) => {
2345
+ const nameA = a.label.toUpperCase();
2346
+ const nameB = b.label.toUpperCase();
2347
+ if (nameA < nameB) {
2348
+ return -1;
2349
+ }
2350
+ if (nameA > nameB) {
2351
+ return 1;
2352
+ }
2353
+ return 0;
2354
+ }) });
2355
+ return obj;
2356
+ }, {});
2357
+ }
2358
+ return groupedItems;
2359
+ }
2360
+ checkResultsCount(counter) {
2361
+ if (!this.currResultsCount || counter < this.currResultsCount) {
2362
+ return true;
2363
+ }
2364
+ return false;
2365
+ }
2366
+ handleStopTyping(e) {
2367
+ e.stopPropagation();
2368
+ this.searchString = e.detail.value;
2369
+ }
2370
+ handleSubmit() {
2371
+ if (this.preventSubmit) {
2372
+ return;
2373
+ }
2374
+ this.emitSearchSubmit();
2375
+ }
2376
+ handleOutsideClick(e) {
2377
+ const cp = e.composedPath();
2378
+ const searchbar = cp.find((elem) => elem.nodeName === "Z-SEARCHBAR");
2379
+ if (!searchbar || searchbar.htmlid !== this.htmlid) {
2380
+ this.showResults = false;
2381
+ return;
2382
+ }
2383
+ 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")); })) {
2384
+ this.showResults = true;
2385
+ return;
2386
+ }
2387
+ this.showResults = false;
2388
+ }
2389
+ renderInput() {
2390
+ return (h("z-input", { ref: (val) => {
2391
+ this.inputRef = val;
2392
+ }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value, size: this.size }));
2393
+ }
2394
+ renderButton() {
2395
+ if (!this.showSearchButton) {
2396
+ return null;
2397
+ }
2398
+ const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
2399
+ const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
2400
+ const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
2401
+ return h("z-button", Object.assign({}, defaultProps), buttonLabel);
2402
+ }
2403
+ renderResults() {
2404
+ if (!this.showResults ||
2405
+ !this.autocomplete ||
2406
+ !this.searchString ||
2407
+ this.searchString.length < this.autocompleteMinChars ||
2408
+ !this.resultsItemsList) {
2409
+ return null;
2410
+ }
2411
+ return (h("div", { class: "results-wrapper" }, h("div", { class: "results" }, this.renderResultsList())));
2412
+ }
2413
+ renderResultsList() {
2414
+ var _a, _b;
2415
+ if (this.preventSubmit && !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
2416
+ return (h("span", { class: "item item-no-results" }, "Non abbiamo trovato risultati per ", h("b", null, this.searchString), h("br", null), h("br", null), "Cosa puoi fare?", h("ul", null, h("li", null, "Verificare di aver scritto bene"), h("li", null, "Provare a cercare un'altra parola"), h("li", null, "Provare a cercare qualcosa di pi\u00F9 generico"))));
2417
+ }
2418
+ return (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()));
2419
+ }
2420
+ renderItems() {
2421
+ var _a;
2422
+ if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
2423
+ return [];
2424
+ }
2425
+ const groupedItems = this.getGroupedItems(this.resultsItemsList);
2426
+ const listGroups = [];
2427
+ let counter = 0;
2428
+ Object.values(groupedItems).forEach((groupItem, index, array) => {
2429
+ if (this.checkResultsCount(counter)) {
2430
+ const listGroupsElements = [];
2431
+ groupItem.items.forEach((item, subindex, subarray) => {
2432
+ if (this.checkResultsCount(counter)) {
2433
+ const isLast = index === array.length - 1 && subindex === subarray.length - 1;
2434
+ listGroupsElements.push(this.renderItem(item, subindex, !isLast));
2435
+ }
2436
+ counter++;
2437
+ });
2438
+ if (listGroupsElements.length) {
2439
+ listGroups.push(h("z-list-group", { "divider-type": ListDividerType.ELEMENT }, this.renderItemCategory(groupItem), listGroupsElements));
2440
+ }
2441
+ }
2442
+ });
2443
+ return listGroups;
2444
+ }
2445
+ renderItem(item, key, divider) {
2446
+ return (h("z-list-element", { id: `list-item-${this.htmlid}-${key}`, role: "option", tabindex: 0, dividerType: divider ? ListDividerType.ELEMENT : undefined, clickable: true, onClickItem: () => this.emitSearchItemClick(item) }, h("span", { class: { "item": true, "ellipsis": this.resultsEllipsis, "has-category": !!item.category } }, (item === null || item === void 0 ? void 0 : item.icon) && (h("z-icon", { class: "item-icon", name: item.icon })), h("span", { class: "item-label", title: item.label, innerHTML: this.renderItemLabel(item.label) }))));
2447
+ }
2448
+ renderItemLabel(label) {
2449
+ if (!this.searchString) {
2450
+ return label;
2451
+ }
2452
+ return label.replace(new RegExp(this.searchString.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gmi"), (found) => `<mark>${found}</mark>`);
2453
+ }
2454
+ renderItemCategory(groupItem) {
2455
+ if (!(groupItem === null || groupItem === void 0 ? void 0 : groupItem.category)) {
2456
+ return null;
2457
+ }
2458
+ return (h("span", { class: "category-heading", slot: "header-title" }, h("span", { class: "category" }, groupItem.category), (groupItem === null || groupItem === void 0 ? void 0 : groupItem.subcategory) && h("span", { class: "subcategory" }, groupItem.subcategory)));
2459
+ }
2460
+ renderSearchHelper(hasDivider = true) {
2461
+ if (!this.autocomplete || this.preventSubmit || !this.searchString) {
2462
+ return null;
2463
+ }
2464
+ return (h("z-list-element", { role: "option", tabindex: 0, dividerType: hasDivider ? ListDividerType.ELEMENT : undefined, clickable: true, id: `list-item-${this.htmlid}-search`, onClickItem: () => this.emitSearchSubmit() }, h("span", { class: "item item-search" }, h("z-icon", { class: "search-icon", name: "left-magnifying-glass" }), h("span", { class: "item-label", innerHTML: this.searchHelperLabel.replace("{searchString}", `<mark>${this.searchString}</mark>`) }))));
2465
+ }
2466
+ renderShowAllResults() {
2467
+ var _a, _b;
2468
+ if (!this.currResultsCount ||
2469
+ !this.searchString ||
2470
+ !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length) ||
2471
+ this.currResultsCount >= ((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)) {
2472
+ return null;
2473
+ }
2474
+ return (h("z-list-element", { role: "option", tabindex: 0, clickable: true, id: `list-item-${this.htmlid}-show-all`, onClickItem: () => (this.currResultsCount = 0), color: "color-primary01" }, h("div", { class: "item-show-all" }, "Vedi tutti i risultati")));
2475
+ }
2476
+ render() {
2477
+ return (h(Host, { onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e), class: { "has-submit": this.showSearchButton, "has-results": this.autocomplete } }, h("div", { class: "input-container" }, this.renderInput(), this.renderResults()), this.renderButton()));
2478
+ }
2479
+ static get watchers() { return {
2480
+ "resultsItems": ["watchItems"],
2481
+ "resultsCount": ["watchResultsCount"],
2482
+ "value": ["watchValue"],
2483
+ "searchString": ["watchSearchString"]
2484
+ }; }
2485
+ };
2486
+ ZSearchbar.style = stylesCss$1;
2487
+
2488
+ const stylesCss = ".sc-z-select-h{display:inline-block;width:inherit;color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg)}[size=\"small\"].sc-z-select-h,[size=\"x-small\"].sc-z-select-h{font-size:var(--font-size-2)}.select-wrapper.sc-z-select>z-input.sc-z-select{width:100%}.select-wrapper.sc-z-select>div.sc-z-select{position:relative}.select-wrapper.sc-z-select>div.closed.sc-z-select{overflow:hidden;height:0}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select{position:absolute;width:100%;box-sizing:border-box;padding:calc(var(--space-unit) * 0.5) var(--space-unit);border:var(--border-size-small) solid var(--gray200);border-top:none;background:var(--color-surface01);outline:none}.select-wrapper.sc-z-select .closed.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:10}.select-wrapper.sc-z-select .open.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:20}.select-wrapper.sc-z-select .ul-scroll-wrapper.fixed.sc-z-select{position:static}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select{position:relative;overflow:auto;max-height:240px;padding:calc(var(--space-unit) * 0.5);outline:none;scrollbar-color:var(--color-primary01) transparent}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-track{background-color:transparent}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.sc-z-select{display:block;padding:calc(var(--space-unit) * 0.5) calc(var(--space-unit) * 1.5)}[size=\"x-small\"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.sc-z-select{padding:0 calc(var(--space-unit) * 1.5)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.selected.sc-z-select{font-weight:bold}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select .no-results.sc-z-select z-icon.sc-z-select{margin-right:var(--space-unit)}.z-list-group-title.sc-z-select{color:var(--gray800)}.reset-item.sc-z-select{color:var(--color-primary01);fill:var(--color-primary01)}.reset-item-content.sc-z-select{display:flex;align-items:center}.reset-item.reset-item-margin.sc-z-select .reset-item-content.sc-z-select{margin-left:calc(var(--space-unit))}.reset-item.sc-z-select .reset-item-content.sc-z-select>z-icon.sc-z-select{margin-right:var(--space-unit)}.reset-item.hide.sc-z-select{display:none}";
2489
+
2490
+ const ZSelect = class {
2491
+ constructor(hostRef) {
2492
+ registerInstance(this, hostRef);
2493
+ this.optionSelect = createEvent(this, "optionSelect", 7);
2494
+ this.resetSelect = createEvent(this, "resetSelect", 7);
2495
+ /** the id of the input element */
2496
+ this.htmlid = `id-${randomId()}`;
2497
+ /** the input aria-label */
2498
+ this.ariaLabel = "";
2499
+ /** the input is disabled */
2500
+ this.disabled = false;
2501
+ /** the input is readonly */
2502
+ this.readonly = false;
2503
+ /** input helper message (optional) - if set to `false` message won't be displayed */
2504
+ this.message = true;
2505
+ /** the input has autocomplete option */
2506
+ this.autocomplete = false;
2507
+ /** no result text message */
2508
+ this.noresultslabel = "Nessun risultato";
2509
+ /** When fixed, it occupies space and pushes down next elements. */
2510
+ this.isfixed = false;
2511
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
2512
+ this.size = ControlSize.BIG;
2513
+ this.isOpen = false;
2514
+ this.selectedItem = null;
2515
+ this.itemsList = [];
2516
+ this.toggleSelectUl = this.toggleSelectUl.bind(this);
2517
+ this.selectItem = this.selectItem.bind(this);
2518
+ this.handleSelectFocus = this.handleSelectFocus.bind(this);
2519
+ }
2520
+ watchItems() {
2521
+ this.itemsList = this.getInitialItemsArray();
2522
+ this.selectedItem = this.itemsList.find((item) => item.selected);
2523
+ }
2524
+ /** get the input selected options */
2525
+ async getSelectedItem() {
2526
+ return this.selectedItem;
2527
+ }
2528
+ /** get the input value */
2529
+ async getValue() {
2530
+ return this.getSelectedValue();
2531
+ }
2532
+ /** set the input value */
2533
+ async setValue(value) {
2534
+ let values = [];
2535
+ if (typeof value === "string") {
2536
+ values.push(value);
2537
+ }
2538
+ else {
2539
+ values = value;
2540
+ }
2541
+ this.selectedItem = this.itemsList.find((item) => values.includes(item.id));
2542
+ }
2543
+ emitOptionSelect() {
2544
+ this.optionSelect.emit({
2545
+ id: this.htmlid,
2546
+ selected: this.getSelectedValue(),
2547
+ });
2548
+ }
2549
+ emitResetSelect() {
2550
+ this.resetSelect.emit({
2551
+ id: this.htmlid,
2552
+ });
2553
+ }
2554
+ componentWillLoad() {
2555
+ this.watchItems();
2556
+ }
2557
+ componentWillRender() {
2558
+ this.filterItems(this.searchString);
2559
+ }
2560
+ getInitialItemsArray() {
2561
+ return typeof this.items === "string" ? JSON.parse(this.items) : this.items;
2562
+ }
2563
+ mapSelectedItemToItemsArray() {
2564
+ const initialItemsList = this.getInitialItemsArray();
2565
+ return initialItemsList.map((item) => {
2566
+ var _a;
2567
+ item.selected = item.id === ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id);
2568
+ return item;
2569
+ });
2570
+ }
2571
+ getSelectedValue() {
2572
+ var _a;
2573
+ return (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id;
2574
+ }
2575
+ filterItems(searchString) {
2576
+ const prevList = this.mapSelectedItemToItemsArray();
2577
+ if (!(searchString === null || searchString === void 0 ? void 0 : searchString.length)) {
2578
+ this.itemsList = prevList;
2579
+ }
2580
+ else {
2581
+ this.itemsList = prevList
2582
+ .filter((item) => {
2583
+ return item.name.toUpperCase().includes(searchString.toUpperCase());
2584
+ })
2585
+ .map((item) => {
2586
+ const start = item.name.toUpperCase().indexOf(searchString.toUpperCase());
2587
+ const end = start + searchString.length;
2588
+ const newName = item.name.substring(0, start) +
2589
+ `<strong>${item.name.substring(start, end)}</strong>` +
2590
+ item.name.substring(end, item.name.length);
2591
+ item.name = newName;
2592
+ return item;
2593
+ });
2594
+ }
2595
+ }
2596
+ hasAutocomplete() {
2597
+ return boolean(this.autocomplete) === true;
2598
+ }
2599
+ handleInputChange(e) {
2600
+ this.searchString = e.detail.value;
2601
+ if (!this.isOpen) {
2602
+ this.toggleSelectUl();
2603
+ }
2604
+ }
2605
+ selectItem(item, selected) {
2606
+ if (item && item.disabled) {
2607
+ return;
2608
+ }
2609
+ this.itemsList = this.mapSelectedItemToItemsArray();
2610
+ this.itemsList = this.itemsList.map((i) => {
2611
+ i.selected = false;
2612
+ if (i.id === (item === null || item === void 0 ? void 0 : item.id)) {
2613
+ i.selected = selected;
2614
+ }
2615
+ return i;
2616
+ });
2617
+ this.selectedItem = this.itemsList.find((item) => item.selected);
2618
+ this.emitOptionSelect();
2619
+ if (this.searchString) {
2620
+ this.searchString = null;
2621
+ }
2622
+ }
2623
+ arrowsSelectNav(e, key) {
2624
+ const showResetIcon = this.resetItem && !!this.selectedItem;
2625
+ const arrows = [KeyboardCode.ARROW_DOWN, KeyboardCode.ARROW_UP];
2626
+ if (!arrows.includes(e.key)) {
2627
+ return;
2628
+ }
2629
+ e.preventDefault();
2630
+ e.stopPropagation();
2631
+ if (!this.isOpen) {
2632
+ this.toggleSelectUl();
2633
+ }
2634
+ let index;
2635
+ if (this.resetItem) {
2636
+ if (e.key === KeyboardCode.ARROW_DOWN) {
2637
+ index = key + 1 === this.itemsList.length + 1 ? +!showResetIcon : key + 1;
2638
+ }
2639
+ else if (e.key === KeyboardCode.ARROW_UP) {
2640
+ index = key <= +!showResetIcon ? this.itemsList.length : key - 1;
2641
+ }
2642
+ }
2643
+ if (!this.resetItem) {
2644
+ if (e.key === KeyboardCode.ARROW_DOWN) {
2645
+ index = key + 1 === this.itemsList.length ? 0 : key + 1;
2646
+ }
2647
+ else if (e.key === KeyboardCode.ARROW_UP) {
2648
+ index = key <= 0 ? this.itemsList.length - 1 : key - 1;
2649
+ }
2650
+ }
2651
+ this.focusSelectItem(index);
2652
+ }
2653
+ focusSelectItem(index) {
2654
+ const focusElem = this.element.querySelector(`#${this.htmlid}_${index}`);
2655
+ if (focusElem) {
2656
+ focusElem.focus();
2657
+ }
2658
+ }
2659
+ toggleSelectUl(selfFocusOnClose = false) {
2660
+ if (this.disabled || this.readonly) {
2661
+ return;
2662
+ }
2663
+ if (!this.isOpen) {
2664
+ document.addEventListener("click", this.handleSelectFocus);
2665
+ document.addEventListener("keyup", this.handleSelectFocus);
2666
+ }
2667
+ else {
2668
+ document.removeEventListener("click", this.handleSelectFocus);
2669
+ document.removeEventListener("keyup", this.handleSelectFocus);
2670
+ if (selfFocusOnClose) {
2671
+ this.element.querySelector(`#${this.htmlid}_input`).focus();
2672
+ }
2673
+ }
2674
+ this.isOpen = !this.isOpen;
2675
+ }
2676
+ handleInputClick(e) {
2677
+ const cp = e.composedPath();
2678
+ const clearIcon = cp.find((item) => item.classList && item.classList.contains("reset-icon"));
2679
+ if (clearIcon) {
2680
+ e.stopPropagation();
2681
+ return;
2682
+ }
2683
+ this.toggleSelectUl();
2684
+ }
2685
+ handleSelectFocus(e) {
2686
+ if (e instanceof KeyboardEvent && e.key === KeyboardCode.ESC) {
2687
+ e.stopPropagation();
2688
+ return this.toggleSelectUl(true);
2689
+ }
2690
+ if (e instanceof KeyboardEvent && e.key !== KeyboardCode.TAB && e.key !== KeyboardCode.ENTER) {
2691
+ return;
2692
+ }
2693
+ const tree = getElementTree(getClickedElement());
2694
+ const parent = tree.find((elem) => {
2695
+ return elem.nodeName.toLowerCase() === "z-input" && elem.id === `${this.htmlid}_input`;
2696
+ });
2697
+ if (!parent) {
2698
+ this.toggleSelectUl(e instanceof MouseEvent ? true : false);
2699
+ }
2700
+ }
2701
+ scrollToLetter(letter) {
2702
+ const foundItem = this.itemsList.find((item) => item.name.charAt(0) === letter);
2703
+ if (foundItem) {
2704
+ this.focusSelectItem(this.itemsList.indexOf(foundItem));
2705
+ }
2706
+ }
2707
+ renderInput() {
2708
+ return (h("z-input", { class: {
2709
+ "active-select": this.isOpen,
2710
+ "cursor-select": !this.autocomplete,
2711
+ }, id: `${this.htmlid}_input`, htmlid: `${this.htmlid}_input`, placeholder: this.placeholder, value: !this.isOpen && this.selectedItem ? this.selectedItem.name.replace(/<[^>]+>/g, "") : null, label: this.label, "aria-label": this.ariaLabel, icon: this.isOpen ? "caret-up" : "caret-down", hasclearicon: this.hasAutocomplete(), message: false, disabled: this.disabled, readonly: this.readonly || (!this.hasAutocomplete() && this.isOpen), status: this.isOpen ? undefined : this.status, autocomplete: "off", size: this.size, onClick: (e) => {
2712
+ this.handleInputClick(e);
2713
+ }, onKeyUp: (e) => {
2714
+ if (e.keyCode !== 13) {
2715
+ e.preventDefault();
2716
+ }
2717
+ handleKeyboardSubmit(e, this.toggleSelectUl);
2718
+ }, onKeyDown: (e) => {
2719
+ return this.arrowsSelectNav(e, this.selectedItem ? this.itemsList.indexOf(this.selectedItem) : this.resetItem ? 0 : -1);
2720
+ }, onInputChange: (e) => {
2721
+ this.handleInputChange(e);
2722
+ }, onKeyPress: (e) => {
2723
+ if (!this.hasAutocomplete()) {
2724
+ e.preventDefault();
2725
+ this.scrollToLetter(String.fromCharCode(e.keyCode));
2726
+ }
2727
+ } }));
2728
+ }
2729
+ renderSelectUl() {
2730
+ var _a;
2731
+ return (h("div", { class: this.isOpen ? "open" : "closed", tabindex: "-1" }, h("div", { class: {
2732
+ "ul-scroll-wrapper": true,
2733
+ "fixed": this.isfixed,
2734
+ }, tabindex: "-1" }, h("z-list", { role: "listbox", tabindex: this.disabled || this.readonly || !this.isOpen ? -1 : 0, id: this.htmlid, "aria-activedescendant": (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id, "aria-multiselectable": false, size: this.listSizeType(), class: {
2735
+ disabled: this.disabled,
2736
+ readonly: this.readonly,
2737
+ filled: !!this.selectedItem,
2738
+ [`input-${this.status}`]: !this.isOpen && !!this.status,
2739
+ } }, this.resetItem && this.renderResetItem(), this.renderSelectUlItems()))));
2740
+ }
2741
+ renderResetItem() {
2742
+ return (h("z-list-element", { class: {
2743
+ "hide": !this.selectedItem || !this.resetItem,
2744
+ "reset-item": true,
2745
+ "reset-item-margin": !this.hasGroupItems,
2746
+ }, clickable: true, disabled: false, dividerType: ListDividerType.ELEMENT, role: "option", tabindex: "0", "aria-selected": "false", id: `${this.htmlid}_${this.resetItem ? "0" : "none"}`, size: this.listSizeType(), onClickItem: () => {
2747
+ this.selectedItem = null;
2748
+ this.searchString = null;
2749
+ this.emitResetSelect();
2750
+ }, onKeyDown: (e) => this.arrowsSelectNav(e, 0) }, h("div", { class: "reset-item-content" }, h("z-icon", { name: "multiply-circled" }), h("span", null, this.resetItem))));
2751
+ }
2752
+ renderItem(item, key, lastItem) {
2753
+ return (h("z-list-element", { clickable: !item.disabled, disabled: item.disabled, dividerType: lastItem ? ListDividerType.HEADER : ListDividerType.ELEMENT, role: "option", tabindex: item.disabled || !this.isOpen ? -1 : 0, "aria-selected": !!item.selected, id: `${this.htmlid}_${key}`, size: this.listSizeType(), onClickItem: () => this.selectItem(item, true), onKeyDown: (e) => this.arrowsSelectNav(e, key) }, h("span", { class: {
2754
+ "selected": !!item.selected,
2755
+ "list-element-content": true,
2756
+ }, innerHTML: item.name })));
2757
+ }
2758
+ listSizeType() {
2759
+ if (this.size === ControlSize.SMALL || this.size === ControlSize.X_SMALL) {
2760
+ return ListSize.SMALL;
2761
+ }
2762
+ return ListSize.MEDIUM;
2763
+ }
2764
+ renderSelectUlItems() {
2765
+ if (!this.itemsList.length) {
2766
+ return this.renderNoSearchResults();
2767
+ }
2768
+ if (this.hasGroupItems) {
2769
+ return this.renderSelectGroupItems();
2770
+ }
2771
+ return this.itemsList.map((item, key, array) => {
2772
+ const lastItem = array.length === key + 1;
2773
+ const itemKey = this.resetItem ? key + 1 : key;
2774
+ return this.renderItem(item, itemKey, lastItem);
2775
+ });
2776
+ }
2777
+ renderSelectGroupItems() {
2778
+ const newData = this.itemsList.reduce((group, item, index, array) => {
2779
+ var _a;
2780
+ const { category } = item;
2781
+ const lastItem = array.length === index + 1;
2782
+ const itemKey = this.resetItem ? index + 1 : index;
2783
+ const zListItem = this.renderItem(item, itemKey, lastItem);
2784
+ group[category] = (_a = group[category]) !== null && _a !== void 0 ? _a : [];
2785
+ group[category].push(zListItem);
2786
+ return group;
2787
+ }, {});
2788
+ return Object.entries(newData).map(([key, value]) => {
2789
+ return (h("z-list-group", { "divider-type": ListDividerType.ELEMENT }, h("span", { class: "body-3-sb z-list-group-title", slot: "header-title" }, key), value.map((item) => item)));
2790
+ });
2791
+ }
2792
+ renderNoSearchResults() {
2793
+ return (h("z-list-element", { color: "blue500", class: "no-results", size: this.listSizeType() }, h("z-icon", { name: "multiply-circle", fill: "blue500" }), this.noresultslabel));
2794
+ }
2795
+ renderMessage() {
2796
+ if (boolean(this.message) === false) {
2797
+ return;
2798
+ }
2799
+ return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
2800
+ }
2801
+ render() {
2802
+ return (h("div", { class: "select-wrapper" }, this.renderInput(), this.renderSelectUl(), this.renderMessage()));
2803
+ }
2804
+ get element() { return getElement(this); }
2805
+ static get watchers() { return {
2806
+ "items": ["watchItems"]
2807
+ }; }
2808
+ };
2809
+ ZSelect.style = stylesCss;
2810
+
2811
+ export { ZAppHeader as z_app_header, ZButton as z_button, ZDatePicker as z_date_picker, ZDivider as z_divider, ZIcon as z_icon, ZInput as z_input, ZInputMessage as z_input_message, ZList as z_list, ZListElement as z_list_element, ZListGroup as z_list_group, ZModal as z_modal, ZOffcanvas as z_offcanvas, ZSearchbar as z_searchbar, ZSelect as z_select };