@zanichelli/albe-web-components 12.3.1-RC → 12.4.0-RC

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/cjs/index-195ca522.js +18 -10
  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.cjs.entry.js +185 -0
  5. package/dist/cjs/{z-dragdrop-area_2.cjs.entry.js → z-button_6.cjs.entry.js} +259 -2
  6. package/dist/cjs/z-chip.cjs.entry.js +1 -1
  7. package/dist/cjs/z-input_2.cjs.entry.js +289 -0
  8. package/dist/cjs/z-list_3.cjs.entry.js +270 -0
  9. package/dist/cjs/z-offcanvas_2.cjs.entry.js +281 -0
  10. package/dist/collection/components/buttons/z-chip/index.js +1 -1
  11. package/dist/collection/components/file-upload/z-dragdrop-area/styles.css +1 -0
  12. package/dist/collection/components/file-upload/z-file-upload/index.js +1 -1
  13. package/dist/collection/components/file-upload/z-file-upload/styles.css +11 -0
  14. package/dist/esm/index-4968ce56.js +18 -10
  15. package/dist/esm/{index-4d1853ea.js → index-df06f147.js} +1 -1
  16. package/dist/esm/{index-fb19ca57.js → index-e44342f3.js} +1 -1
  17. package/dist/esm/index.js +1 -1
  18. package/dist/esm/loader.js +1 -1
  19. package/dist/esm/{utils-2a4ef29d.js → utils-3d2372eb.js} +1 -1
  20. package/dist/esm/web-components-library.js +1 -1
  21. package/dist/esm/z-app-header.entry.js +181 -0
  22. package/dist/esm/z-book-card.entry.js +1 -1
  23. package/dist/esm/z-breadcrumb.entry.js +1 -1
  24. package/dist/esm/{z-dragdrop-area_2.entry.js → z-button_6.entry.js} +258 -5
  25. package/dist/esm/z-chip.entry.js +1 -1
  26. package/dist/esm/z-combobox.entry.js +1 -1
  27. package/dist/esm/z-input_2.entry.js +284 -0
  28. package/dist/esm/z-list_3.entry.js +264 -0
  29. package/dist/esm/z-myz-card-info.entry.js +1 -1
  30. package/dist/esm/z-myz-list-item.entry.js +1 -1
  31. package/dist/esm/z-offcanvas_2.entry.js +276 -0
  32. package/dist/esm/z-pocket_3.entry.js +1 -1
  33. package/dist/esm/z-select.entry.js +1 -1
  34. package/dist/esm/z-skip-to-content.entry.js +1 -1
  35. package/dist/esm/z-slideshow.entry.js +1 -1
  36. package/dist/esm/z-table-deprecated.entry.js +2 -2
  37. package/dist/esm/z-table-header.entry.js +2 -2
  38. package/dist/esm/z-table.entry.js +2 -2
  39. package/dist/esm/z-toggle-switch.entry.js +1 -1
  40. package/dist/esm/z-tr.entry.js +2 -2
  41. package/dist/web-components-library/index.esm.js +1 -1
  42. package/dist/web-components-library/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
  43. package/dist/web-components-library/p-07854026.entry.js +1 -0
  44. package/dist/web-components-library/p-13762a32.entry.js +1 -0
  45. package/dist/web-components-library/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
  46. package/dist/web-components-library/p-1b342136.entry.js +1 -0
  47. package/dist/web-components-library/p-1c541078.entry.js +1 -0
  48. package/dist/web-components-library/p-207467d2.entry.js +1 -0
  49. package/dist/web-components-library/p-285ec5fc.entry.js +1 -0
  50. package/dist/web-components-library/{p-98badafc.js → p-28b2868e.js} +1 -1
  51. package/dist/web-components-library/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
  52. package/dist/web-components-library/p-29d45fe5.entry.js +1 -0
  53. package/dist/web-components-library/p-49d22e92.entry.js +1 -0
  54. package/dist/web-components-library/p-570e1a2e.entry.js +1 -0
  55. package/{www/build/p-485fd3db.entry.js → dist/web-components-library/p-6f281905.entry.js} +1 -1
  56. package/dist/web-components-library/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
  57. package/dist/web-components-library/p-8aaa0c34.entry.js +1 -0
  58. package/dist/web-components-library/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
  59. package/dist/web-components-library/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
  60. package/dist/web-components-library/{p-a01baa71.js → p-b921dc8d.js} +1 -1
  61. package/dist/web-components-library/p-d00d2e95.entry.js +1 -0
  62. package/dist/web-components-library/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
  63. package/dist/web-components-library/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
  64. package/dist/web-components-library/p-dc854830.entry.js +1 -0
  65. package/dist/web-components-library/web-components-library.esm.js +1 -1
  66. package/package.json +1 -1
  67. package/www/build/index.esm.js +1 -1
  68. package/www/build/{p-100207d8.entry.js → p-0495fb84.entry.js} +1 -1
  69. package/www/build/p-07854026.entry.js +1 -0
  70. package/www/build/p-13762a32.entry.js +1 -0
  71. package/www/build/{p-cc009af8.entry.js → p-17d4f729.entry.js} +1 -1
  72. package/www/build/p-1b342136.entry.js +1 -0
  73. package/www/build/p-1c541078.entry.js +1 -0
  74. package/www/build/p-207467d2.entry.js +1 -0
  75. package/www/build/p-285ec5fc.entry.js +1 -0
  76. package/www/build/{p-98badafc.js → p-28b2868e.js} +1 -1
  77. package/www/build/{p-5944a8f2.entry.js → p-29377b57.entry.js} +1 -1
  78. package/www/build/p-29d45fe5.entry.js +1 -0
  79. package/www/build/p-49d22e92.entry.js +1 -0
  80. package/www/build/p-4a7a94e2.css +1576 -0
  81. package/www/build/p-570e1a2e.entry.js +1 -0
  82. package/{dist/web-components-library/p-485fd3db.entry.js → www/build/p-6f281905.entry.js} +1 -1
  83. package/www/build/{p-a1663ab1.entry.js → p-76e7d402.entry.js} +1 -1
  84. package/www/build/p-8aaa0c34.entry.js +1 -0
  85. package/www/build/{p-f5bc7dda.entry.js → p-a6af3c1d.entry.js} +1 -1
  86. package/www/build/{p-f3cc3f27.entry.js → p-b0f9cf23.entry.js} +1 -1
  87. package/www/build/{p-a01baa71.js → p-b921dc8d.js} +1 -1
  88. package/www/build/p-ce656c1c.js +129 -0
  89. package/www/build/p-d00d2e95.entry.js +1 -0
  90. package/www/build/{p-cd561d69.js → p-d12d4dcd.js} +1 -1
  91. package/www/build/{p-8c31e60b.entry.js → p-d51d7b44.entry.js} +1 -1
  92. package/www/build/p-dc854830.entry.js +1 -0
  93. package/www/build/web-components-library.esm.js +1 -1
  94. package/www/index.html +10 -1
  95. package/dist/cjs/z-app-header_11.cjs.entry.js +0 -1077
  96. package/dist/cjs/z-file-upload.cjs.entry.js +0 -189
  97. package/dist/esm/z-app-header_11.entry.js +0 -1063
  98. package/dist/esm/z-file-upload.entry.js +0 -185
  99. package/dist/web-components-library/p-03b13390.entry.js +0 -1
  100. package/dist/web-components-library/p-07d0e902.entry.js +0 -1
  101. package/dist/web-components-library/p-3327e5f0.entry.js +0 -1
  102. package/dist/web-components-library/p-51bfa8ba.entry.js +0 -1
  103. package/dist/web-components-library/p-7907bdf7.entry.js +0 -1
  104. package/dist/web-components-library/p-7c5ddeb0.entry.js +0 -1
  105. package/dist/web-components-library/p-9b0bcd43.entry.js +0 -1
  106. package/dist/web-components-library/p-bbd6cbca.entry.js +0 -1
  107. package/dist/web-components-library/p-ed42ceca.entry.js +0 -1
  108. package/dist/web-components-library/p-ff5a6e34.entry.js +0 -1
  109. package/www/build/p-03b13390.entry.js +0 -1
  110. package/www/build/p-07d0e902.entry.js +0 -1
  111. package/www/build/p-21a94605.css +0 -3
  112. package/www/build/p-3327e5f0.entry.js +0 -1
  113. package/www/build/p-51bfa8ba.entry.js +0 -1
  114. package/www/build/p-7907bdf7.entry.js +0 -1
  115. package/www/build/p-7c5ddeb0.entry.js +0 -1
  116. package/www/build/p-92d5fd28.js +0 -1
  117. package/www/build/p-9b0bcd43.entry.js +0 -1
  118. package/www/build/p-bbd6cbca.entry.js +0 -1
  119. package/www/build/p-ed42ceca.entry.js +0 -1
  120. package/www/build/p-ff5a6e34.entry.js +0 -1
@@ -1,1063 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4968ce56.js';
2
- import { O as OffCanvasVariant, v as TransitionDirection, B as ButtonVariant, e as ControlSize, c as ButtonType, D as DividerSize, h as DividerOrientation, k as LabelPosition, I as InputType, i as ListSize, m as ListType, j as ExpandableListButtonAlign, l as ListDividerType, E as ExpandableListStyle, g as KeyboardCode } from './index-47f23745.js';
3
- import { I as ICONS } from './icons-e3232103.js';
4
- import { r as randomId, b as boolean, h as handleEnterKeydSubmit } from './utils-2a4ef29d.js';
5
- import './breakpoints-9b81eb1b.js';
6
-
7
- const stylesCss$a = ":host{--app-header-typography-1-size:24px;--app-header-typography-2-size:28px;--app-header-typography-3-size:32px;--app-header-typography-4-size:36px;--app-header-typography-5-size:42px;--app-header-typography-6-size:48px;--app-header-typography-7-size:54px;--app-header-typography-8-size:60px;--app-header-typography-9-size:68px;--app-header-typography-10-size:76px;--app-header-typography-11-size:84px;--app-header-typography-12-size:92px;--app-header-typography-1-lineheight:1.33;--app-header-typography-2-lineheight:1.29;--app-header-typography-3-lineheight:1.25;--app-header-typography-4-lineheight:1.24;--app-header-typography-5-lineheight:1.24;--app-header-typography-6-lineheight:1.25;--app-header-typography-7-lineheight:1.2;--app-header-typography-8-lineheight:1.26;--app-header-typography-9-lineheight:1.24;--app-header-typography-10-lineheight:1.26;--app-header-typography-11-lineheight:1.2;--app-header-typography-12-lineheight:1.2;--app-header-typography-1-tracking:calc(-0.2 / 1em);--app-header-typography-2-tracking:calc(-0.4 / 1em);--app-header-typography-3-tracking:calc(-0.6 / 1em);--app-header-typography-4-tracking:calc(-0.8 / 1em);--app-header-typography-5-tracking:calc(-1 / 1em);--app-header-typography-6-tracking:calc(-1.2 / 1em);--app-header-typography-7-tracking:calc(-1.4 / 1em);--app-header-typography-8-tracking:calc(-1.6 / 1em);--app-header-typography-9-tracking:calc(-1.8 / 1em);--app-header-typography-10-tracking:calc(-2 / 1em);--app-header-typography-11-tracking:calc(-2.2 / 1em);--app-header-typography-12-tracking:calc(-2.4 / 1em);--app-header-content-max-width:100%;--app-header-height:auto;--app-header-top-offset:48px;--app-header-drawer-trigger-size:calc(var(--space-unit) * 4);--app-header-bg:var(--color-surface01);--app-header-stucked-bg:var(--color-surface01);--app-header-text-color:var(--color-text01);--app-header-title-font-size:var(--app-header-typography-3-size);--app-header-title-lineheight:var(--app-header-typography-3-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-3-tracking);--app-header-stucked-text-color:var(--color-text01);position:relative;display:block;height:var(--app-header-height);color:var(--app-header-text-color)}:host,*{box-sizing:border-box}.heading-panel{position:relative;display:flex;width:100%;max-width:var(--app-header-content-max-width);flex-direction:column;flex-grow:0;flex-shrink:0;align-items:baseline;padding:var(--grid-margin);margin:0 auto;background:var(--app-header-bg);gap:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5)}.hero-container+.heading-panel{background:transparent}:host(:empty) .heading-panel{padding:0}.heading-container{position:relative;z-index:1;display:flex;width:100%;max-width:100%;flex:1 auto;flex-direction:column;justify-content:flex-start}.heading-title{display:flex;max-width:100%;flex-direction:row;align-items:flex-start;column-gap:calc(var(--space-unit) * 2)}::slotted([slot=\"title\"]),.heading-stuck .heading-title>*,::slotted([slot=\"stucked-title\"]){margin:0;font-family:\"IBM Plex Serif\", serif;font-weight:var(--font-bd)}::slotted([slot=\"title\"]){font-size:var(--app-header-title-font-size);letter-spacing:var(--app-header-title-letter-spacing);line-height:var(--app-header-title-lineheight)}.heading-stuck .heading-title>*,::slotted([slot=\"stucked-title\"]){font-size:var(--app-header-typography-3-size);letter-spacing:var(--app-header-typography-3-tracking);line-height:var(--app-header-typography-3-lineheight)}:host(:not([menu-length=\"0\"])) .heading-subtitle{padding-left:calc(var(--app-header-drawer-trigger-size) + (var(--space-unit) * 2))}::slotted([slot=\"top-subtitle\"]),::slotted([slot=\"subtitle\"]){margin:0;font-family:var(--font-family-sans);font-size:20px;font-style:italic;line-height:26px}::slotted([slot=\"subtitle\"]){font-weight:500}::slotted([slot=\"top-subtitle\"]){font-weight:400}.menu-container{display:flex;width:100%;flex:1 auto;flex-flow:row wrap}:host([menu-length=\"0\"]:not([enable-search])) .menu-container,.menu-container:empty{display:none}.menu-container ::slotted([open]){position:relative;z-index:3}z-searchbar{z-index:0;display:flex;width:auto;min-width:calc(var(--space-unit) * 32);flex:1 auto;align-items:center;margin-left:auto}.heading-stuck{position:fixed;z-index:20;top:var(--app-header-top-offset);left:0;width:100%;max-width:100%;animation:slide-stuck-heading-in 250ms ease-out;background:var(--app-header-stucked-bg);box-shadow:var(--shadow-2);color:var(--app-header-stucked-text-color)}.heading-stuck-content{display:flex;max-width:var(--app-header-content-max-width);align-items:center;padding:var(--space-unit) var(--grid-margin);margin:0 auto;column-gap:calc(var(--space-unit) * 2)}.heading-stuck .heading-title{overflow:hidden}.heading-stuck .heading-title>*,.heading-stuck .heading-title ::slotted([slot=\"stucked-title\"]){display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.heading-stuck-content z-button{margin-left:auto}.drawer-trigger{padding:0;border:0;margin:0;appearance:none;background:none;border-radius:0;color:inherit;cursor:pointer}.drawer-trigger z-icon{--z-icon-width:var(--app-header-drawer-trigger-size);--z-icon-height:var(--app-header-drawer-trigger-size);fill:currentcolor}.heading-container :is(.drawer-trigger,z-button.search-page-button){display:flex;height:calc(var(--app-header-title-font-size) * var(--app-header-title-lineheight));align-items:center}.heading-container z-button.search-page-button{margin-left:auto}.drawer-content{display:none}z-offcanvas[open] .drawer-content{display:flex;width:100%;flex:1 auto;flex-direction:column;row-gap:calc(var(--space-unit) * 2.5)}z-offcanvas[open] .drawer-content ::slotted(z-menu){width:100%}.drawer-close{--z-icon-width:var(--app-header-drawer-trigger-size);--z-icon-height:var(--app-header-drawer-trigger-size);padding:0;border:0;margin:var(--space-unit) 0 calc(var(--space-unit) * 2.5);appearance:none;background:transparent;border-radius:0;color:inherit;cursor:pointer;fill:currentcolor;font-size:inherit;outline:none}.drawer-close:focus-visible{box-shadow:var(--shadow-focus-primary)}.hero-container{position:absolute;z-index:0;top:0;left:0;width:100%;height:100%}:host([overlay]) .heading-panel .drawer-trigger z-icon,:host([overlay]) .heading-panel .heading-container,:host([overlay]) .heading-panel .menu-container{color:var(--color-white);fill:var(--color-white)}:host([overlay]) .heading-panel .menu-container ::slotted(z-menu){--z-menu-label-color:var(--color-white)}:host([overlay]) .hero-container::after{position:absolute;z-index:0;top:0;left:0;width:100%;height:100%;background:var(--color-black);content:\"\";opacity:0.5}.hero-container img,.hero-container ::slotted(*){position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:top center;-webkit-user-drag:none}@media (min-width: 768px){:host{--app-header-title-font-size:var(--app-header-typography-6-size);--app-header-title-lineheight:var(--app-header-typography-6-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-6-tracking)}.heading-panel{flex-flow:row wrap;align-items:center;padding-bottom:calc(var(--space-unit) * 2)}.heading-container{margin-right:auto}:host(:is([flow=\"offcanvas\"],[menu-length=\"0\"])) :is(.heading-container,.menu-container){width:auto}:host(:not([flow=\"offcanvas\"])) .heading-subtitle{padding-left:0}.menu-container{flex:initial;align-items:center}:host([menu-length=\"0\"]) .menu-container:not(:empty){height:calc(var(--app-header-title-font-size) * var(--app-header-title-lineheight))}:host(:not([flow=\"offcanvas\"])) .menu-container{gap:var(--space-unit) calc(var(--space-unit) * 5)}:host(:not([flow=\"offcanvas\"])) .heading-container .drawer-trigger{display:none}}@media (min-width: 1152px){:host{--app-header-title-font-size:var(--app-header-typography-7-size);--app-header-title-lineheight:var(--app-header-typography-7-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-7-tracking)}.heading-panel{justify-content:flex-start;padding-bottom:calc(var(--space-unit) * 3)}.heading-container,.menu-container{width:auto}:host([flow=\"stack\"]) .heading-panel{flex-flow:column;align-items:flex-start}:host([flow=\"stack\"]) .menu-container{width:100%}:host(:not([flow=\"offcanvas\"],[menu-length=\"0\"])) .heading-panel{row-gap:calc(var(--space-unit) * 3)}z-searchbar{min-width:calc(var(--space-unit) * 45);flex:initial}}@media (min-width: 1366px){:host{--app-header-title-font-size:var(--app-header-typography-9-size);--app-header-title-lineheight:var(--app-header-typography-9-lineheight);--app-header-title-letter-spacing:var(--app-header-typography-9-tracking)}}@keyframes slide-stuck-heading-in{0%{transform:translate3d(0, -100%, 0)}100%{transform:none}}";
8
-
9
- const SUPPORT_INTERSECTION_OBSERVER = typeof IntersectionObserver !== "undefined";
10
- const ZAppHeader = class {
11
- constructor(hostRef) {
12
- registerInstance(this, hostRef);
13
- this.sticking = createEvent(this, "sticking", 7);
14
- /**
15
- * Stuck mode for the header.
16
- * You can programmatically set it using an IntersectionObserver.
17
- */
18
- this.stuck = false;
19
- /**
20
- * Should place an overlay over the hero image.
21
- * Useful for legibility purpose.
22
- */
23
- this.overlay = false;
24
- /**
25
- * Control menu bar position in the header.
26
- * - auto: the menu bar is positioned near the title
27
- * - stack: the menu bar is positioned below the title
28
- * - offcanvas: the menu bar is not displayed and a burger icon appears to open the offcanvas menu
29
- */
30
- this.flow = "auto";
31
- /**
32
- * The opening state of the drawer.
33
- */
34
- this.drawerOpen = false;
35
- /**
36
- * Enable the search bar.
37
- */
38
- this.enableSearch = false;
39
- /**
40
- * Placeholder text for the search bar.
41
- */
42
- this.searchPlaceholder = "Cerca";
43
- /**
44
- * Search string for the search bar.
45
- */
46
- this.searchString = "";
47
- /**
48
- * The stuck state of the bar.
49
- */
50
- this._stuck = false;
51
- /**
52
- * Current viewport.
53
- * Used to change the aspect of the search button (icon only) on mobile and tablet.
54
- */
55
- this.currentViewport = "mobile";
56
- this.observer = SUPPORT_INTERSECTION_OBSERVER &&
57
- new IntersectionObserver(([entry]) => {
58
- this._stuck = !entry.isIntersecting;
59
- }, {
60
- threshold: 0.5,
61
- });
62
- this.openDrawer = this.openDrawer.bind(this);
63
- this.closeDrawer = this.closeDrawer.bind(this);
64
- this.collectMenuElements = this.collectMenuElements.bind(this);
65
- }
66
- evaluateViewport() {
67
- if (window.innerWidth < 768) {
68
- this.currentViewport = "mobile";
69
- }
70
- else if (window.innerWidth >= 768 && window.innerWidth < 1152) {
71
- this.currentViewport = "tablet";
72
- }
73
- else {
74
- this.currentViewport = "desktop";
75
- }
76
- }
77
- onStuck() {
78
- const scrollParent = this.scrollParent;
79
- if (!scrollParent) {
80
- return;
81
- }
82
- this.sticking.emit(this._stuck);
83
- }
84
- setMenuFloatingMode() {
85
- if (this.menuElements.length === 0) {
86
- return;
87
- }
88
- const elements = this.menuElements;
89
- elements.forEach((element) => {
90
- element.open = false;
91
- element.floating = !this.drawerOpen;
92
- element.verticalContext = this.drawerOpen;
93
- });
94
- }
95
- get title() {
96
- const titleElement = this.hostElement.querySelector('[slot="title"]');
97
- if (titleElement === null) {
98
- return "";
99
- }
100
- return titleElement.textContent.trim();
101
- }
102
- get scrollParent() {
103
- const parent = this.hostElement.offsetParent;
104
- if (parent === document.body || parent === document.documentElement) {
105
- return window;
106
- }
107
- return parent;
108
- }
109
- get canShowMenu() {
110
- return this.flow !== "offcanvas" && this.currentViewport !== "mobile" && !this.drawerOpen;
111
- }
112
- get canShowSearchbar() {
113
- if (!this.enableSearch) {
114
- return false;
115
- }
116
- // Always show the searchbar on desktop, even if a searchPageUrl is set
117
- if (this.searchPageUrl) {
118
- return this.currentViewport === "desktop";
119
- }
120
- return true;
121
- }
122
- /**
123
- * Whether the header has a hero image, either as a prop or as a slot.
124
- */
125
- get hasHero() {
126
- return !!this.hero || this.hostElement.querySelector("[slot=hero]") !== null;
127
- }
128
- openDrawer() {
129
- this.drawerOpen = true;
130
- }
131
- closeDrawer() {
132
- this.drawerOpen = false;
133
- }
134
- collectMenuElements() {
135
- const menuElements = (this.menuElements = this.hostElement.querySelectorAll('[slot="menu"]'));
136
- this.menuLength = menuElements.length;
137
- this.setMenuFloatingMode();
138
- }
139
- enableStuckObserver() {
140
- if (this.observer) {
141
- this.observer.observe(this.container);
142
- }
143
- }
144
- disableStuckMode() {
145
- this._stuck = false;
146
- if (this.observer) {
147
- this.observer.unobserve(this.container);
148
- }
149
- }
150
- onStuckMode() {
151
- if (this.stuck) {
152
- this.enableStuckObserver();
153
- }
154
- else {
155
- this.disableStuckMode();
156
- }
157
- }
158
- renderSearchLinkButton() {
159
- if (!this.enableSearch || !this.searchPageUrl || this.currentViewport === "desktop") {
160
- return null;
161
- }
162
- return (h("z-button", { class: "search-page-button", variant: ButtonVariant.SECONDARY, href: this.searchPageUrl, icon: "search", size: ControlSize.X_SMALL }));
163
- }
164
- renderSeachbar(searchButtonIconOnly) {
165
- 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) }));
166
- }
167
- componentDidLoad() {
168
- this.collectMenuElements();
169
- this.onStuckMode();
170
- this.evaluateViewport();
171
- }
172
- render() {
173
- 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-subtitle" }, h("slot", { name: "top-subtitle" })), 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", "aria-hidden": `${!this.drawerOpen}`, disabled: !this.drawerOpen }, 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))))));
174
- }
175
- get hostElement() { return getElement(this); }
176
- static get watchers() { return {
177
- "_stuck": ["onStuck"],
178
- "drawerOpen": ["setMenuFloatingMode"],
179
- "stuck": ["onStuckMode"]
180
- }; }
181
- };
182
- ZAppHeader.style = stylesCss$a;
183
-
184
- const stylesCss$9 = ".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:var(--color-primary02);background-color:var(--color-primary02);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-primary02);background-color:var(--color-primary02);color:var(--color-primary01)}[variant=\"tertiary\"].sc-z-button-h .z-button--container.sc-z-button:active{border-color:var(--color-primary02);background-color:var(--color-primary02);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:var(--color-disabled01);background-color:var(--color-disabled01);color:var(--color-disabled02)}";
185
-
186
- const ZButton = class {
187
- constructor(hostRef) {
188
- registerInstance(this, hostRef);
189
- /** defines a string value that labels an interactive element, used for accessibility. */
190
- this.ariaLabel = "";
191
- /** HTML button disabled attribute. */
192
- this.disabled = false;
193
- /** HTML button type attribute. */
194
- this.type = ButtonType.BUTTON;
195
- /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
196
- this.variant = ButtonVariant.PRIMARY;
197
- /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
198
- this.size = ControlSize.BIG;
199
- }
200
- getAttributes() {
201
- return {
202
- id: this.htmlid,
203
- class: {
204
- "z-button--container": true,
205
- "z-button--has-text": !!this.hostElement.textContent.trim(),
206
- },
207
- };
208
- }
209
- render() {
210
- if (this.href) {
211
- 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)));
212
- }
213
- return (h("button", Object.assign({}, this.getAttributes(), { "aria-label": this.ariaLabel, name: this.name, type: this.type, role: this.role, disabled: this.disabled }), this.icon && (h("z-icon", { name: this.icon, width: 16, height: 16 })), h("slot", null)));
214
- }
215
- get hostElement() { return getElement(this); }
216
- };
217
- ZButton.style = stylesCss$9;
218
-
219
- const stylesCss$8 = ".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)}";
220
-
221
- const ZDivider = class {
222
- constructor(hostRef) {
223
- registerInstance(this, hostRef);
224
- /** [optional] Divider size */
225
- this.size = DividerSize.SMALL;
226
- /** [optional] Divider color */
227
- this.color = "gray200";
228
- /** [optional] Divider orintation */
229
- this.orientation = DividerOrientation.HORIZONTAL;
230
- }
231
- render() {
232
- return (h(Host, { class: `divider-${this.size} divider-${this.orientation}`, style: { backgroundColor: `var(--${this.color})` } }));
233
- }
234
- };
235
- ZDivider.style = stylesCss$8;
236
-
237
- const stylesCss$7 = ":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)}";
238
-
239
- const ZIcon = class {
240
- constructor(hostRef) {
241
- registerInstance(this, hostRef);
242
- }
243
- selectPathOrPolygon(iconValue) {
244
- if (iconValue === null || iconValue === void 0 ? void 0 : iconValue.startsWith("M")) {
245
- return h("path", { d: ICONS[this.name] });
246
- }
247
- return h("polygon", { points: ICONS[this.name] });
248
- }
249
- render() {
250
- 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]))));
251
- }
252
- };
253
- ZIcon.style = stylesCss$7;
254
-
255
- const stylesCss$6 = ".sc-z-input-h{display:inline-block;width:inherit}input.sc-z-input::-ms-clear,input.sc-z-input::-ms-reveal{display:none}.sc-z-input-h input.sc-z-input::-ms-clear,.sc-z-input-h input.sc-z-input::-ms-reveal{display:none}input.sc-z-input,textarea.sc-z-input,.textarea-wrapper.sc-z-input{box-sizing:border-box;border:var(--border-size-small) solid var(--color-surface04);background:var(--color-input-field01);border-radius:var(--border-radius-small);color:var(--color-text01);fill:var(--color-icon02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg);outline:none}[size=\"small\"].sc-z-input-h input.sc-z-input,[size=\"small\"].sc-z-input-h textarea.sc-z-input,[size=\"small\"].sc-z-input-h .textarea-wrapper.sc-z-input,[size=\"x-small\"].sc-z-input-h input.sc-z-input,[size=\"x-small\"].sc-z-input-h textarea.sc-z-input,[size=\"x-small\"].sc-z-input-h .textarea-wrapper.sc-z-input{font-size:var(--font-size-2)}.cursor-select.sc-z-input-h input.sc-z-input{cursor:pointer}.sc-z-input-h:not(.active-select) input.sc-z-input:focus:focus-visible,[readonly=\"false\"].sc-z-input-h .textarea-wrapper.sc-z-input:focus-within{box-shadow:var(--shadow-focus-primary)}input.sc-z-input:focus:focus-visible,textarea.sc-z-input:focus:focus-visible{color:var(--color-input-field02)}.active-select.sc-z-input-h input.sc-z-input{border:var(--border-size-small) solid var(--blue500)}.cursor-select.sc-z-input-h input.sc-z-input:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-input-h input[readonly].sc-z-input:focus:focus-visible{box-shadow:none}.filled.sc-z-input{border-color:var(--color-surface05)}.input-success.sc-z-input{border-color:var(--color-success01);background:var(--color-success-inverse);fill:var(--color-success01)}.input-error.sc-z-input{border-color:var(--color-error01);background:var(--color-error-inverse);fill:var(--color-error01)}.input-warning.sc-z-input{border-color:var(--color-warning01);background:var(--color-warning-inverse);fill:var(--color-warning01)}input.sc-z-input:not([readonly]):hover,.textarea-wrapper.sc-z-input:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}.sc-z-input-h:not(.active-select) input[readonly].sc-z-input,.readonly.sc-z-input{border-color:var(--color-disabled01);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) .textarea-wrapper.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) z-icon.sc-z-input{border-color:var(--color-disabled01);box-shadow:none;color:var(--color-disabled02);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input:hover{border-width:var(--border-size-small)}input.sc-z-input::placeholder,textarea.sc-z-input::placeholder{color:var(--color-text05)}.sc-z-input::-webkit-textarea-placeholder{color:var(--color-text05)}.sc-z-input:-ms-textarea-placeholder{color:var(--color-text05)}.sc-z-input::placeholder{color:var(--color-text05)}label.input-label.sc-z-input{display:block;padding-bottom:var(--space-unit);color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}[disabled].sc-z-input-h:not([disabled=\"false\"]) label.input-label.sc-z-input{color:var(--color-disabled02)}.text-wrapper.sc-z-input>div.sc-z-input{position:relative;z-index:1;fill:var(--color-icon02)}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{width:100%;height:calc(var(--space-unit) * 5.5);box-sizing:border-box;padding:0 calc(var(--space-unit) * 1.5);margin:0}[size=\"small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4.5)}[size=\"x-small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.sc-z-input,.text-wrapper.sc-z-input>div.sc-z-input>input.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 5.25)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 8)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input{position:absolute;z-index:2;top:50%;right:calc(var(--space-unit) * 1.5);display:flex;pointer-events:none;transform:translateY(-50%)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input{padding:0;border:0;background:none;color:inherit;font:inherit;pointer-events:initial}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input+button.icon-button.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.hidden.sc-z-input{display:none}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.reset-icon.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.toggle-password-icon.sc-z-input{cursor:pointer}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.sc-z-input{--z-icon-width:18px;--z-icon-height:18px;display:block}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.small.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.x-small.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset;-webkit-text-fill-color:currentcolor}.textarea-wrapper.sc-z-input{padding:calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}textarea.sc-z-input::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-track{background-color:transparent}textarea.sc-z-input::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}textarea.sc-z-input{width:100%;min-height:132px;padding:0;border:none;margin:0;resize:none}.radio-wrapper.sc-z-input,.checkbox-wrapper.sc-z-input{position:relative;display:inline-flex;flex-direction:row;align-items:center;color:var(--color-text01);fill:var(--color-primary01);font-family:var(--font-family-sans)}.radio-wrapper.sc-z-input:hover,.checkbox-wrapper.sc-z-input:hover{color:var(--color-hover-primary);fill:currentcolor}.radio-wrapper.sc-z-input>input.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input{position:absolute;z-index:-1;opacity:0;pointer-events:none}.radio-wrapper.sc-z-input .radio-label.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{display:inline-flex;align-items:center;margin:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1;text-transform:inherit}.radio-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.checkbox-label.sc-z-input{cursor:pointer}.radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{cursor:pointer;fill:inherit}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-2)}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:14px;--z-icon-height:14px}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-1)}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input{flex-direction:row}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input{flex-direction:row-reverse}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:var(--space-unit)}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:var(--space-unit)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:calc(var(--space-unit) * 0.5)}.radio-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.checkbox-label.sc-z-input>z-icon.sc-z-input{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input{color:var(--color-disabled02)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input>z-icon.sc-z-input{cursor:default;fill:var(--color-disabled01)}";
256
-
257
- const ZInput = class {
258
- constructor(hostRef) {
259
- registerInstance(this, hostRef);
260
- this.inputChange = createEvent(this, "inputChange", 7);
261
- this.startTyping = createEvent(this, "startTyping", 7);
262
- this.stopTyping = createEvent(this, "stopTyping", 7);
263
- this.inputCheck = createEvent(this, "inputCheck", 7);
264
- /** the id of the input element */
265
- this.htmlid = `id-${randomId()}`;
266
- /** the input aria-label */
267
- this.ariaLabel = "";
268
- /** the input is disabled */
269
- this.disabled = false;
270
- /** the input is readonly */
271
- this.readonly = false;
272
- /** the input is required (optional): available for text, password, number, email, textarea, checkbox */
273
- this.required = false;
274
- /** checked: available for checkbox, radio */
275
- this.checked = false;
276
- /** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */
277
- this.message = true;
278
- /** the input label position: available for checkbox, radio */
279
- this.labelPosition = LabelPosition.RIGHT;
280
- /** render clear icon when typing (optional): available for text */
281
- this.hasclearicon = true;
282
- /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
283
- this.size = ControlSize.BIG;
284
- this.isTyping = false;
285
- this.passwordHidden = true;
286
- this.typingtimeout = 300;
287
- }
288
- inputCheckListener(e) {
289
- const data = e.detail;
290
- switch (this.type) {
291
- case InputType.RADIO:
292
- if (data.type === InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {
293
- this.checked = false;
294
- }
295
- break;
296
- }
297
- }
298
- /** get checked status */
299
- async isChecked() {
300
- switch (this.type) {
301
- case InputType.CHECKBOX:
302
- case InputType.RADIO:
303
- return this.checked;
304
- default:
305
- console.warn("`isChecked` method is only available for type `checkbox` and `radio`");
306
- return false;
307
- }
308
- }
309
- emitInputChange(value) {
310
- if (!this.isTyping) {
311
- this.emitStartTyping();
312
- }
313
- let validity;
314
- if (this.type === InputType.TEXTAREA) {
315
- validity = this.getValidity("textarea");
316
- }
317
- else {
318
- validity = this.getValidity("input");
319
- }
320
- this.value = value;
321
- this.inputChange.emit({ value, validity });
322
- clearTimeout(this.timer);
323
- this.timer = setTimeout(() => {
324
- this.emitStopTyping(this.value, validity);
325
- }, this.typingtimeout);
326
- }
327
- emitStartTyping() {
328
- this.isTyping = true;
329
- this.startTyping.emit();
330
- }
331
- emitStopTyping(value, validity) {
332
- this.isTyping = false;
333
- this.stopTyping.emit({
334
- value: value,
335
- validity: validity,
336
- });
337
- }
338
- emitInputCheck(checked) {
339
- this.inputCheck.emit({
340
- id: this.htmlid,
341
- checked: checked,
342
- type: this.type,
343
- name: this.name,
344
- value: this.value,
345
- validity: this.getValidity("input"),
346
- });
347
- }
348
- getValidity(type) {
349
- const input = this.hostElement.querySelector(type);
350
- return input.validity;
351
- }
352
- /* START text/password/email/number */
353
- getTextAttributes() {
354
- return {
355
- id: this.htmlid,
356
- name: this.name,
357
- placeholder: this.placeholder,
358
- value: this.value,
359
- disabled: this.disabled,
360
- readonly: this.readonly,
361
- required: this.required,
362
- title: this.htmltitle,
363
- minlength: this.minlength,
364
- maxlength: this.maxlength,
365
- class: {
366
- [`input-${this.status}`]: !!this.status,
367
- filled: !!this.value,
368
- },
369
- autocomplete: this.autocomplete,
370
- onInput: (e) => this.emitInputChange(e.target.value),
371
- };
372
- }
373
- getNumberAttributes(type) {
374
- if (type != InputType.NUMBER) {
375
- return;
376
- }
377
- return {
378
- min: this.min,
379
- max: this.max,
380
- step: this.step,
381
- };
382
- }
383
- getPatternAttribute(type) {
384
- if (type != InputType.PASSWORD &&
385
- type != InputType.TEXT &&
386
- type != InputType.TEL &&
387
- type != InputType.SEARCH &&
388
- type != InputType.URL &&
389
- type != InputType.EMAIL) {
390
- return;
391
- }
392
- return {
393
- pattern: this.pattern,
394
- };
395
- }
396
- getRoleAttribute() {
397
- return this.role ? { role: this.role } : {};
398
- }
399
- getAriaAttrubutes() {
400
- const expanded = this.ariaExpanded ? { "aria-expanded": this.ariaExpanded } : {};
401
- const controls = this.ariaControls ? { "aria-controls": this.ariaControls } : {};
402
- const autocomplete = this.ariaAutocomplete ? { "aria-autocomplete": this.ariaAutocomplete } : {};
403
- const activedescendant = this.ariaActivedescendant ? { "aria-activedescendant": this.ariaActivedescendant } : {};
404
- return Object.assign(Object.assign(Object.assign(Object.assign({}, expanded), controls), autocomplete), activedescendant);
405
- }
406
- renderInputText(type = InputType.TEXT) {
407
- const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
408
- const attr = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.getTextAttributes()), this.getNumberAttributes(type)), this.getPatternAttribute(type)), ariaLabel), this.getRoleAttribute()), this.getAriaAttrubutes());
409
- if (this.icon || type === InputType.PASSWORD) {
410
- Object.assign(attr.class, { "has-icon": true });
411
- }
412
- if (this.hasclearicon && type != InputType.NUMBER) {
413
- Object.assign(attr.class, { "has-clear-icon": true });
414
- }
415
- 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()));
416
- }
417
- renderLabel() {
418
- if (!this.label) {
419
- return;
420
- }
421
- return (h("label", { class: "input-label body-5-sb", id: `${this.htmlid}_label`, htmlFor: this.htmlid }, this.label));
422
- }
423
- renderIcons() {
424
- return (h("span", { class: "icons-wrapper" }, this.renderResetIcon(), this.renderIcon()));
425
- }
426
- renderIcon() {
427
- if (this.type === InputType.PASSWORD) {
428
- return this.renderShowHidePassword();
429
- }
430
- if (!this.icon) {
431
- return;
432
- }
433
- return (h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1, "aria-hidden": "true" }, h("z-icon", { name: this.icon, class: this.size })));
434
- }
435
- renderResetIcon() {
436
- let hidden = false;
437
- if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {
438
- hidden = true;
439
- }
440
- return (h("button", { type: "button", class: `icon-button reset-icon ${hidden ? "hidden" : ""}`, "aria-label": "cancella il contenuto dell'input", onClick: () => {
441
- this.inputRef.value = "";
442
- this.emitInputChange("");
443
- } }, h("z-icon", { name: "multiply", class: this.size })));
444
- }
445
- renderShowHidePassword() {
446
- 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 })));
447
- }
448
- renderMessage() {
449
- if (boolean(this.message) === false) {
450
- return;
451
- }
452
- return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
453
- }
454
- /* END text/password/email/number */
455
- /* START textarea */
456
- renderTextarea() {
457
- const attributes = this.getTextAttributes();
458
- const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
459
- 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.getRoleAttribute()))), this.renderMessage()));
460
- }
461
- /* END textarea */
462
- handleCheck(ev) {
463
- this.checked = ev.target.checked;
464
- this.emitInputCheck(this.checked);
465
- }
466
- /* START checkbox */
467
- renderCheckbox() {
468
- return (h("div", { class: "checkbox-wrapper" }, h("input", Object.assign({ id: this.htmlid, type: "checkbox", name: this.name, checked: this.checked, disabled: this.disabled, readonly: this.readonly, required: this.required, onChange: this.handleCheck.bind(this), value: this.value }, this.getRoleAttribute())), h("label", { htmlFor: this.htmlid, class: {
469
- "checkbox-label": true,
470
- "after": this.labelPosition === LabelPosition.RIGHT,
471
- "before": this.labelPosition === LabelPosition.LEFT,
472
- } }, h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
473
- }
474
- /* END checkbox */
475
- /* START radio */
476
- renderRadio() {
477
- return (h("div", { class: "radio-wrapper" }, h("input", Object.assign({ id: this.htmlid, type: "radio", name: this.name, checked: this.checked, disabled: this.disabled, readonly: this.readonly, onChange: this.handleCheck.bind(this), value: this.value }, this.getRoleAttribute())), h("label", { htmlFor: this.htmlid, class: {
478
- "radio-label": true,
479
- "after": this.labelPosition === LabelPosition.RIGHT,
480
- "before": this.labelPosition === LabelPosition.LEFT,
481
- } }, h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
482
- }
483
- /* END radio */
484
- render() {
485
- let input;
486
- switch (this.type) {
487
- case InputType.TEXTAREA:
488
- input = this.renderTextarea();
489
- break;
490
- case InputType.CHECKBOX:
491
- input = this.renderCheckbox();
492
- break;
493
- case InputType.RADIO:
494
- input = this.renderRadio();
495
- break;
496
- default:
497
- input = this.renderInputText(this.type);
498
- }
499
- return h(Host, null, input);
500
- }
501
- get hostElement() { return getElement(this); }
502
- };
503
- ZInput.style = stylesCss$6;
504
-
505
- const stylesCss$5 = ":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)}";
506
-
507
- const ZInputMessage = class {
508
- constructor(hostRef) {
509
- registerInstance(this, hostRef);
510
- this.statusIcons = {
511
- success: "checkmark-circle",
512
- error: "multiply-circled",
513
- warning: "exclamation-circle",
514
- };
515
- this.statusRole = {};
516
- }
517
- onMessageChange() {
518
- this.statusRole = this.message && this.status ? { role: "alert" } : {};
519
- }
520
- componentWillLoad() {
521
- this.onMessageChange();
522
- }
523
- render() {
524
- 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 })));
525
- }
526
- static get watchers() { return {
527
- "message": ["onMessageChange"],
528
- "status": ["onMessageChange"]
529
- }; }
530
- };
531
- ZInputMessage.style = stylesCss$5;
532
-
533
- const stylesCss$4 = ":host{display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}";
534
-
535
- const ZList = class {
536
- constructor(hostRef) {
537
- registerInstance(this, hostRef);
538
- /**
539
- * [optional] Sets size of inside elements.
540
- */
541
- this.size = ListSize.MEDIUM;
542
- /**
543
- * [optional] type of the list marker for each element
544
- */
545
- this.listType = ListType.NONE;
546
- /**
547
- * [optional] Sets role of the element.
548
- */
549
- this.role = "list";
550
- }
551
- setChildrenSizeType() {
552
- const children = this.host.children;
553
- for (let i = 0; i < children.length; i++) {
554
- children[i].setAttribute("size", this.size);
555
- children[i].setAttribute("list-type", this.listType);
556
- children[i].setAttribute("list-element-position", (i + 1).toString());
557
- }
558
- }
559
- componentDidLoad() {
560
- this.setChildrenSizeType();
561
- }
562
- render() {
563
- return (h(Host, null, h("slot", null)));
564
- }
565
- get host() { return getElement(this); }
566
- };
567
- ZList.style = stylesCss$4;
568
-
569
- const stylesCss$3 = ":host{outline:none}:host>.container,:host>.container-contextual-menu{--background-color-list-element:var(--color-surface01);--background-hover-color-list-element:var(--color-surface02);--background-active-color-list-element:var(--color-surface02);display:flex;box-sizing:border-box;flex-direction:column;justify-content:center;font-family:var(--font-family-sans);font-weight:var(--font-rg);outline:none}:host([size=\"small\"])>.container{min-height:calc(var(--space-unit) * 4);padding:calc(var(--space-unit) / 2) 0}:host([size=\"medium\"])>.container{min-height:calc(var(--space-unit) * 5);padding:var(--space-unit) 0}:host([size=\"large\"])>.container{min-height:calc(var(--space-unit) * 7);padding:calc(var(--space-unit) * 2) 0}:host([size=\"x-large\"])>.container{min-height:calc(var(--space-unit) * 9);padding:calc(var(--space-unit) * 3) 0}:host([expandable])>.container,:host([expandable])>.container-contextual-menu,:host([clickable])>.container,:host([clickable])>.container-contextual-menu{cursor:pointer}:host([expandable]:hover)>.container,:host([expandable]:hover)>.container-contextual-menu,:host([clickable]:hover)>.container,:host([clickable]:hover)>.container-contextual-menu{background-color:var(--background-hover-color-list-element)}:host([expandable]:focus:focus-visible)>.container,:host([expandable]:focus:focus-visible)>.container-contextual-menu,:host([clickable]:focus:focus-visible)>.container,:host([clickable]:focus:focus-visible)>.container-contextual-menu{box-shadow:var(--shadow-focus-primary)}:host([clickable]:not([expandable]))>.container.clicked,:host([clickable]:not([expandable]))>.container-contextual-menu.clicked{box-shadow:var(--shadow-focus-primary)}:host([expandable]:active)>.container,:host([expandable]:active)>.container-contextual-menu,:host([clickable]:active)>.container,:host([clickable]:active)>.container-contextual-menu{background-color:var(--background-active-color-list-element)}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex;flex-direction:row-reverse;justify-content:space-between}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-right:var(--space-unit)}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-left:var(--space-unit)}:host>.container>.z-list-element-inner-container,:host>.container-contextual-menu>.z-list-element-inner-container{display:none}:host>.container>.z-list-element-inner-container.expanded,:host>.container-contextual-menu>.z-list-element-inner-container.expanded{display:block}:host([clickable]:hover)>.container-contextual-menu{background-color:var(--color-surface03)}.container-contextual-menu:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.z-list-content-container{display:flex;align-items:center}";
570
-
571
- const ZListElement = class {
572
- /**
573
- * Constructor.
574
- */
575
- constructor(hostRef) {
576
- registerInstance(this, hostRef);
577
- this.accessibleFocus = createEvent(this, "accessibleFocus", 7);
578
- this.ariaDescendantFocus = createEvent(this, "ariaDescendantFocus", 7);
579
- this.clickItem = createEvent(this, "clickItem", 7);
580
- /**
581
- * [optional] Align expandable button left or right.
582
- */
583
- this.alignButton = ExpandableListButtonAlign.LEFT;
584
- /**
585
- * [optional] Sets element clickable.
586
- */
587
- this.clickable = false;
588
- /**
589
- * [optional] Sets the divider color.
590
- */
591
- this.dividerColor = "color-surface03";
592
- /**
593
- * [optional] Sets the position where to insert the divider.
594
- */
595
- this.dividerType = ListDividerType.NONE;
596
- /**
597
- * [optional] Sets the divider size.
598
- */
599
- this.dividerSize = DividerSize.SMALL;
600
- /**
601
- * [optional] Sets element as expandable.
602
- */
603
- this.expandable = false;
604
- /**
605
- * [optional] Sets expandable style to element.
606
- */
607
- this.expandableStyle = ExpandableListStyle.ACCORDION;
608
- /**
609
- * [optional] Sets size of inside elements.
610
- */
611
- this.size = ListSize.MEDIUM;
612
- /**
613
- * [optional] Sets text color of the element.
614
- */
615
- this.color = "none";
616
- /**
617
- * [optional] Sets disabled style of the element.
618
- */
619
- this.disabled = false;
620
- /**
621
- * [optional] If is used in ZContextualMenu component
622
- */
623
- this.isContextualMenu = false;
624
- /**
625
- * [optional] position of the list element inside the list or the group
626
- */
627
- this.listElementPosition = "0";
628
- /**
629
- * [optional] type of the list marker for each element
630
- */
631
- this.listType = ListType.NONE;
632
- /**
633
- * [optional] Sets element role.
634
- */
635
- this.role = "listitem";
636
- this.showInnerContent = false;
637
- this.openElementConfig = {
638
- accordion: {
639
- open: "minus-circled",
640
- close: "plus-circled",
641
- },
642
- menu: {
643
- open: "chevron-up",
644
- close: "chevron-down",
645
- },
646
- };
647
- this.handleClick = this.handleClick.bind(this);
648
- this.handleKeyDown = this.handleKeyDown.bind(this);
649
- }
650
- accessibleFocusHandler(e) {
651
- if (this.listElementId === e.detail) {
652
- const toFocus = this.host.shadowRoot.getElementById(`z-list-element-id-${e.detail}`);
653
- toFocus.focus();
654
- }
655
- }
656
- /**
657
- * Handler for click on element. If element is expandable, change state.
658
- * @returns void
659
- */
660
- handleClick() {
661
- this.clickItem.emit(this.listElementId);
662
- if (!this.expandable) {
663
- return;
664
- }
665
- this.showInnerContent = !this.showInnerContent;
666
- }
667
- calculateClass() {
668
- if (this.isContextualMenu) {
669
- return "container-contextual-menu";
670
- }
671
- return "container";
672
- }
673
- handleKeyDown(event) {
674
- const expandByKey = event.code === KeyboardCode.ENTER;
675
- switch (event.code) {
676
- case KeyboardCode.ARROW_DOWN:
677
- event.preventDefault();
678
- this.accessibleFocus.emit(this.listElementId + 1);
679
- break;
680
- case KeyboardCode.ARROW_UP:
681
- event.preventDefault();
682
- this.accessibleFocus.emit(this.listElementId - 1);
683
- break;
684
- case KeyboardCode.ENTER:
685
- event.preventDefault();
686
- this.clickItem.emit(this.listElementId);
687
- break;
688
- }
689
- if (!this.expandable || !expandByKey) {
690
- return;
691
- }
692
- this.showInnerContent = !this.showInnerContent;
693
- }
694
- /**
695
- * Renders button to expand element.
696
- * @returns expadable button
697
- */
698
- renderExpandableButton() {
699
- if (!this.expandable) {
700
- return null;
701
- }
702
- return (h("z-icon", { name: this.showInnerContent
703
- ? this.openElementConfig[this.expandableStyle].open
704
- : this.openElementConfig[this.expandableStyle].close }));
705
- }
706
- /**
707
- * Renders expanded content if element is expandable.
708
- * @returns expanded content
709
- */
710
- renderExpandedContent() {
711
- if (!this.expandable) {
712
- return null;
713
- }
714
- return (h("div", { class: {
715
- "z-list-element-inner-container": true,
716
- "expanded": this.showInnerContent,
717
- } }, h("slot", { name: "inner-content" })));
718
- }
719
- /**
720
- * Renders content of the z-list-element
721
- * @returns list content
722
- */
723
- renderContent() {
724
- if (this.listType === ListType.NONE) {
725
- return h("slot", null);
726
- }
727
- if (this.listType === ListType.ORDERED) {
728
- return (h("div", { class: "z-list-content-container" }, h("div", null, this.listElementPosition, ".\u2003"), h("slot", null)));
729
- }
730
- if (this.listType === ListType.UNORDERED) {
731
- return (h("div", { class: "z-list-content-container" }, h("span", null, "\u2022\u2003"), h("slot", null)));
732
- }
733
- }
734
- render() {
735
- return (h(Host, { "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onFocus: () => this.ariaDescendantFocus.emit(this.listElementId), onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, 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 }))));
736
- }
737
- get host() { return getElement(this); }
738
- };
739
- ZListElement.style = stylesCss$3;
740
-
741
- const stylesCss$2 = ":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)}";
742
-
743
- const ZListGroup = class {
744
- constructor(hostRef) {
745
- registerInstance(this, hostRef);
746
- /**
747
- * [optional] Sets size of inside elements.
748
- */
749
- this.size = ListSize.MEDIUM;
750
- /**
751
- * [optional] Sets the position where to insert the divider.
752
- */
753
- this.dividerType = ListDividerType.NONE;
754
- /**
755
- * [optional] Sets the divider size.
756
- */
757
- this.dividerSize = DividerSize.SMALL;
758
- /**
759
- * [optional] Sets the divider color.
760
- */
761
- this.dividerColor = "gray200";
762
- /**
763
- * [optional] type of the list marker for each element
764
- */
765
- this.listType = ListType.NONE;
766
- }
767
- componentDidLoad() {
768
- const children = this.host.children;
769
- for (let i = 0; i < children.length; i++) {
770
- if (children.length - 1 > i) {
771
- children[i].setAttribute("divider-type", this.dividerType);
772
- children[i].setAttribute("divider-size", this.dividerSize);
773
- children[i].setAttribute("divider-color", this.dividerColor);
774
- }
775
- children[i].setAttribute("size", this.size);
776
- children[i].setAttribute("list-type", this.listType);
777
- children[i].setAttribute("list-element-position", i.toString());
778
- }
779
- }
780
- componentWillLoad() {
781
- this.hasHeader = !!this.host.querySelector('[slot="header-title"]');
782
- }
783
- render() {
784
- return (h(Host, { role: "group" }, h("div", { class: {
785
- "z-list-group-header-container": true,
786
- "has-header": this.hasHeader,
787
- } }, h("slot", { name: "header-title" }), this.dividerType === ListDividerType.HEADER && (h("z-divider", { color: this.dividerColor, size: this.dividerSize }))), h("slot", null)));
788
- }
789
- get host() { return getElement(this); }
790
- };
791
- ZListGroup.style = stylesCss$2;
792
-
793
- const stylesCss$1 = ".sc-z-offcanvas-h{--z-offcanvas--container-width:375px;--z-offcanvas--top-space:0;min-width:100%;height:100%;font-family:var(--font-family-sans);font-weight:var(--font-rg);visibility:hidden}.canvas-container.sc-z-offcanvas{display:flex;overflow:-moz-scrollbars-none;overflow:hidden;min-width:100%;height:100%;flex-direction:column;background:var(--color-surface01)}[variant=\"pushcontent\"].sc-z-offcanvas-h{display:none}[open].sc-z-offcanvas-h{display:flex;visibility:visible}[variant=\"overlay\"].sc-z-offcanvas-h{position:fixed;z-index:1000;top:var(--z-offcanvas--top-space);right:0;bottom:0;left:0;display:flex;height:calc(100% - var(--z-offcanvas--top-space))}[variant=\"overlay\"][transitiondirection=\"left\"].sc-z-offcanvas-h{justify-content:end}[variant=\"overlay\"].sc-z-offcanvas-h>.canvas-container.sc-z-offcanvas{z-index:1010}[variant=\"overlay\"].sc-z-offcanvas-h .canvas-background.sc-z-offcanvas{position:absolute;left:0;width:100%;height:100%;background-color:var(--gray900);opacity:0.7}.canvas-container.sc-z-offcanvas>.canvas-content.sc-z-offcanvas{overflow:auto;flex:1 auto;padding:0 calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) calc(var(--space-unit) / 2) calc(var(--space-unit) * 2) 0;overflow-x:hidden}[variant=\"overlay\"].sc-z-offcanvas-h>.canvas-container.sc-z-offcanvas>.canvas-content.sc-z-offcanvas{padding:0 calc(var(--space-unit) * 2) calc(var(--space-unit) * 2) calc(var(--space-unit) * 2);margin:calc(var(--space-unit) * 2) calc(var(--space-unit) / 2) 0 0}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-track{background-color:transparent}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.canvas-container.sc-z-offcanvas .canvas-content.sc-z-offcanvas{scrollbar-color:var(--color-primary01) transparent}@media only screen and (max-width: 768px){[open][transitiondirection=\"left\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-right 0.4s ease-out}[open][transitiondirection=\"right\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-left 0.4s ease-out}}@media only screen and (min-width: 768px){.sc-z-offcanvas-h{min-width:auto}.canvas-container.sc-z-offcanvas{width:auto;min-width:max(var(--z-offcanvas--container-width), 375px);max-width:max(var(--z-offcanvas--container-width), 375px);height:auto;min-height:calc(var(--space-unit) * 40)}.sc-z-offcanvas-h:not([variant=\"overlay\"])[open]:not(.skip-animation){width:auto;animation:grow 0.4s ease-out}}@keyframes grow{from{width:0}to{width:max(var(--z-offcanvas--container-width), 375px)}}@keyframes enter-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes enter-right{from{transform:translateX(100%)}to{transform:translateX(0)}}[open][variant=\"overlay\"][transitiondirection=\"left\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-right 0.4s ease-out}[open][transitiondirection=\"right\"].sc-z-offcanvas-h:not(.skip-animation)>.canvas-container.sc-z-offcanvas{animation:enter-left 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"][transitiondirection=\"right\"]>.canvas-container.sc-z-offcanvas{transform:translateX(-100%);transition:visibility 0.4s ease-out, transform 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"][transitiondirection=\"left\"]>.canvas-container.sc-z-offcanvas{transform:translateX(100%);transition:visibility 0.4s ease-out, transform 0.4s ease-out}.sc-z-offcanvas-h:not([open])[variant=\"overlay\"] .canvas-background.sc-z-offcanvas{transition:visibility 0.4s ease-out;visibility:hidden}";
794
-
795
- const ZOffcanvas = class {
796
- constructor(hostRef) {
797
- registerInstance(this, hostRef);
798
- this.canvasOpenStatusChanged = createEvent(this, "canvasOpenStatusChanged", 7);
799
- /**
800
- * Offcanvas variant.
801
- * Can be one `overlay` or `pushcontent`.
802
- * Default variant: pushcontent
803
- */
804
- this.variant = OffCanvasVariant.PUSHCONTENT;
805
- /** Whether the offcanvas is open. Default: false */
806
- this.open = false;
807
- /** open content transitioning in a specified direction left | right. Default: left */
808
- this.transitiondirection = TransitionDirection.LEFT;
809
- /**
810
- * Whether to skip the initial animation.
811
- * Useful when the initial value of the `open` prop is set to `true`.
812
- */
813
- this.skipLoadAnimation = false;
814
- }
815
- onOpenChanged() {
816
- if (!this.open && this.skipLoadAnimation) {
817
- this.skipLoadAnimation = false;
818
- }
819
- if (this.open) {
820
- this.handlePageOverflow();
821
- }
822
- this.canvasOpenStatusChanged.emit(this.open);
823
- }
824
- handlePageOverflow() {
825
- const overflow = this.variant === OffCanvasVariant.OVERLAY ? "overflow-y" : "overflow-x";
826
- document.body.style[overflow] = this.open ? "hidden" : "";
827
- }
828
- render() {
829
- 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) }))));
830
- }
831
- static get watchers() { return {
832
- "open": ["onOpenChanged"]
833
- }; }
834
- };
835
- ZOffcanvas.style = stylesCss$1;
836
-
837
- const stylesCss = ":host{z-index:15;display:flex;column-gap:calc(var(--space-unit) * 2);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host,*{box-sizing:border-box}.input-container{position:relative;display:flex;width:100%;flex-direction:column}.results-wrapper{position:absolute;top:calc(100% - 1px);left:0;width:100%;padding:calc(var(--space-unit) / 4);border:var(--border-size-small) solid var(--color-surface03);border-top:none;background:var(--color-surface01)}.results{overflow:auto;max-height:var(--z-searchbar-results-height, 540px);padding:calc(var(--space-unit) / 2) calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}.results::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.results::-webkit-scrollbar-track{background-color:transparent}.results::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.results .category-heading{display:block;font-size:var(--font-size-2);font-weight:var(--font-rg);line-height:var(--font-size-3)}.results .category-heading>*{display:block}.results .category-heading>.category{color:var(--color-text05);font-style:italic}.results .category-heading>.subcategory{margin-top:var(--space-unit);color:var(--color-text01);text-transform:uppercase}.results z-list-element{display:block}.results .item{--z-icon-height:12px;--z-icon-width:12px;display:flex;flex-flow:row nowrap;align-items:center;justify-content:flex-start;color:var(--color-text01);column-gap:calc(var(--space-unit) * 1.5);fill:var(--color-icon02);font-size:var(--font-size-2);line-height:var(--font-size-3)}.results .item.ellipsis>.item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.results .item>.item-label mark{background:var(--color-primary03)}.results .item.has-category{padding-left:calc(var(--space-unit) * 3)}.results .item.item-search{--z-icon-height:16px;--z-icon-width:16px}.results .item-show-all{text-align:center}.results .item-no-results{display:block;font-size:var(--font-size-2);font-style:italic;line-height:var(--font-size-5)}.results .item-no-results>ul{padding-left:calc(var(--space-unit) * 2);margin:var(--space-unit)}@media (min-width: 768px){.results .category-heading{font-size:var(--font-size-3);line-height:var(--font-size-6)}.results .item{font-size:var(--font-size-3);line-height:var(--font-size-6)}.results .item.item-search{--z-icon-height:18px;--z-icon-width:18px}.results .item.ellipsis>.item-label{height:24px}}@media (min-width: 1152px){.results .item{cursor:pointer}.results .item-no-results{cursor:default;font-size:var(--font-size-3);line-height:var(--font-size-6)}}:host([size=\"small\"]) .results :is(.item,.category-heading),:host([size=\"x-small\"]) .results :is(.item,.category-heading){font-size:var(--font-size-2)}:host([size=\"small\"]) .results .item:not(.has-category),:host([size=\"x-small\"]) .results .item:not(.has-category){--z-icon-height:16px;--z-icon-width:16px}:host([size=\"small\"])::part(list-item-container){min-height:calc(var(--space-unit) * 4.5);padding:0}:host([size=\"x-small\"])::part(list-item-container){min-height:calc(var(--space-unit) * 4);padding:0}";
838
-
839
- const ZSearchbar = class {
840
- constructor(hostRef) {
841
- registerInstance(this, hostRef);
842
- this.searchSubmit = createEvent(this, "searchSubmit", 7);
843
- this.searchTyping = createEvent(this, "searchTyping", 7);
844
- this.searchItemClick = createEvent(this, "searchItemClick", 7);
845
- /** the id of the searchbar element */
846
- this.htmlid = `searchbar-${randomId()}`;
847
- /** Prevent submit action */
848
- this.preventSubmit = false;
849
- /** Show autocomplete results */
850
- this.autocomplete = false;
851
- /** Minimun number of characters to dispatch typing event */
852
- this.autocompleteMinChars = 3;
853
- /** Truncate results to single row */
854
- this.resultsEllipsis = true;
855
- /** Search helper text */
856
- this.searchHelperLabel = "Cerca {searchString}";
857
- /** Sort autocomplete results items */
858
- this.sortResultsItems = false;
859
- /** Show submit button */
860
- this.showSearchButton = false;
861
- /** Set button icon without label*/
862
- this.searchButtonIconOnly = false;
863
- /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
864
- this.size = ControlSize.BIG;
865
- /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
866
- this.variant = ButtonVariant.PRIMARY;
867
- this.searchString = this.value;
868
- this.currResultsCount = 0;
869
- this.showResults = false;
870
- this.resultsItemsList = null;
871
- }
872
- emitSearchSubmit() {
873
- this.searchSubmit.emit(this.inputRef.value);
874
- }
875
- emitSearchTyping(search) {
876
- this.searchTyping.emit(search);
877
- }
878
- emitSearchItemClick(item) {
879
- this.searchItemClick.emit(item);
880
- }
881
- watchItems() {
882
- this.resultsItemsList = this.getResultsItemsList();
883
- }
884
- watchResultsCount() {
885
- this.currResultsCount = this.resultsCount;
886
- }
887
- watchValue() {
888
- this.searchString = this.value;
889
- }
890
- watchSearchString() {
891
- this.emitSearchTyping(this.searchString);
892
- if (!this.searchString) {
893
- this.currResultsCount = this.resultsCount;
894
- }
895
- }
896
- componentWillLoad() {
897
- this.resultsItemsList = this.getResultsItemsList();
898
- this.currResultsCount = this.resultsCount;
899
- }
900
- getResultsItemsList() {
901
- return typeof this.resultsItems === "string" ? JSON.parse(this.resultsItems) : this.resultsItems;
902
- }
903
- getGroupedItems(items) {
904
- const groupedItems = {};
905
- items.forEach((item) => {
906
- var _a;
907
- const key = `${item === null || item === void 0 ? void 0 : item.category}${item === null || item === void 0 ? void 0 : item.subcategory}`;
908
- groupedItems[key] = (_a = groupedItems[key]) !== null && _a !== void 0 ? _a : {
909
- category: item === null || item === void 0 ? void 0 : item.category,
910
- subcategory: item === null || item === void 0 ? void 0 : item.subcategory,
911
- items: [],
912
- };
913
- groupedItems[key]["items"].push(item);
914
- });
915
- if (this.sortResultsItems) {
916
- return Object.keys(groupedItems)
917
- .sort()
918
- .reduce((obj, key) => {
919
- obj[key] = Object.assign(Object.assign({}, groupedItems[key]), { items: groupedItems[key]["items"].sort((a, b) => {
920
- const nameA = a.label.toUpperCase();
921
- const nameB = b.label.toUpperCase();
922
- if (nameA < nameB) {
923
- return -1;
924
- }
925
- if (nameA > nameB) {
926
- return 1;
927
- }
928
- return 0;
929
- }) });
930
- return obj;
931
- }, {});
932
- }
933
- return groupedItems;
934
- }
935
- checkResultsCount(counter) {
936
- if (!this.currResultsCount || counter < this.currResultsCount) {
937
- return true;
938
- }
939
- return false;
940
- }
941
- handleStopTyping(e) {
942
- e.stopPropagation();
943
- this.searchString = e.detail.value;
944
- }
945
- handleSubmit() {
946
- if (this.preventSubmit) {
947
- return;
948
- }
949
- this.emitSearchSubmit();
950
- }
951
- handleOutsideClick(e) {
952
- const cp = e.composedPath();
953
- const searchbar = cp.find((elem) => elem.nodeName === "Z-SEARCHBAR");
954
- if (!searchbar || searchbar.htmlid !== this.htmlid) {
955
- this.showResults = false;
956
- return;
957
- }
958
- 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")); })) {
959
- this.showResults = true;
960
- return;
961
- }
962
- this.showResults = false;
963
- }
964
- renderInput() {
965
- return (h("z-input", { ref: (val) => {
966
- this.inputRef = val;
967
- }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value, size: this.size }));
968
- }
969
- renderButton() {
970
- if (!this.showSearchButton) {
971
- return null;
972
- }
973
- const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
974
- const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
975
- const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
976
- return h("z-button", Object.assign({}, defaultProps), buttonLabel);
977
- }
978
- renderResults() {
979
- if (!this.showResults ||
980
- !this.autocomplete ||
981
- !this.searchString ||
982
- this.searchString.length < this.autocompleteMinChars ||
983
- !this.resultsItemsList) {
984
- return null;
985
- }
986
- return (h("div", { class: "results-wrapper" }, h("div", { class: "results" }, this.renderResultsList())));
987
- }
988
- renderResultsList() {
989
- var _a, _b;
990
- if (this.preventSubmit && !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
991
- 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"))));
992
- }
993
- 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()));
994
- }
995
- renderItems() {
996
- var _a;
997
- if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
998
- return [];
999
- }
1000
- const groupedItems = this.getGroupedItems(this.resultsItemsList);
1001
- const listGroups = [];
1002
- let counter = 0;
1003
- Object.values(groupedItems).forEach((groupItem, index, array) => {
1004
- if (this.checkResultsCount(counter)) {
1005
- const listGroupsElements = [];
1006
- groupItem.items.forEach((item, subindex, subarray) => {
1007
- if (this.checkResultsCount(counter)) {
1008
- const isLast = index === array.length - 1 && subindex === subarray.length - 1;
1009
- listGroupsElements.push(this.renderItem(item, subindex, !isLast));
1010
- }
1011
- counter++;
1012
- });
1013
- if (listGroupsElements.length) {
1014
- listGroups.push(h("z-list-group", { "divider-type": ListDividerType.ELEMENT }, this.renderItemCategory(groupItem), listGroupsElements));
1015
- }
1016
- }
1017
- });
1018
- return listGroups;
1019
- }
1020
- renderItem(item, key, divider) {
1021
- 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) }))));
1022
- }
1023
- renderItemLabel(label) {
1024
- if (!this.searchString) {
1025
- return label;
1026
- }
1027
- return label.replace(new RegExp(this.searchString.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gmi"), (found) => `<mark>${found}</mark>`);
1028
- }
1029
- renderItemCategory(groupItem) {
1030
- if (!(groupItem === null || groupItem === void 0 ? void 0 : groupItem.category)) {
1031
- return null;
1032
- }
1033
- 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)));
1034
- }
1035
- renderSearchHelper(hasDivider = true) {
1036
- if (!this.autocomplete || this.preventSubmit || !this.searchString) {
1037
- return null;
1038
- }
1039
- 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>`) }))));
1040
- }
1041
- renderShowAllResults() {
1042
- var _a, _b;
1043
- if (!this.currResultsCount ||
1044
- !this.searchString ||
1045
- !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length) ||
1046
- this.currResultsCount >= ((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)) {
1047
- return null;
1048
- }
1049
- 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")));
1050
- }
1051
- render() {
1052
- 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()));
1053
- }
1054
- static get watchers() { return {
1055
- "resultsItems": ["watchItems"],
1056
- "resultsCount": ["watchResultsCount"],
1057
- "value": ["watchValue"],
1058
- "searchString": ["watchSearchString"]
1059
- }; }
1060
- };
1061
- ZSearchbar.style = stylesCss;
1062
-
1063
- export { ZAppHeader as z_app_header, ZButton as z_button, 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, ZOffcanvas as z_offcanvas, ZSearchbar as z_searchbar };