@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,7 +1,63 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-4968ce56.js';
2
- import { g as KeyboardCode } from './index-47f23745.js';
1
+ import { r as registerInstance, h, g as getElement, H as Host, c as createEvent } from './index-4968ce56.js';
2
+ import { c as ButtonType, B as ButtonVariant, e as ControlSize, D as DividerSize, h as DividerOrientation, w as ZFileUploadType, p as Device, g as KeyboardCode } from './index-47f23745.js';
3
+ import { g as getDevice } from './utils-3d2372eb.js';
4
+ import { I as ICONS } from './icons-e3232103.js';
5
+ import './breakpoints-9b81eb1b.js';
3
6
 
4
- const stylesCss$1 = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.dragdrop{position:relative;display:flex;height:228px;flex-direction:column;border-color:var(--color-surface04);background-color:var(--color-surface02);background-image:url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='2' ry='2' stroke='%23CACCCEFF' stroke-width='2' stroke-dasharray='15%2c 10%2c 14%2c 11' stroke-dashoffset='3' stroke-linecap='square'/%3e%3c/svg%3e\");border-radius:2px;color:var(--color-text01)}:host>.dragdrop.dragover *{pointer-events:none}:host>.dragdrop .dragover-container{position:absolute;z-index:10;top:0;left:0;display:none;width:100%;height:100%;background-color:var(--color-primary03);box-shadow:var(--shadow-focus-primary)}:host>.dragdrop .dragover-container .dragover-message{padding:10px 28px;background-color:var(--color-link-primary);color:var(--color-text04)}:host>.dragdrop.dragover .dragover-container{display:flex;align-items:center;justify-content:center}";
7
+ const stylesCss$5 = ".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)}";
8
+
9
+ const ZButton = class {
10
+ constructor(hostRef) {
11
+ registerInstance(this, hostRef);
12
+ /** defines a string value that labels an interactive element, used for accessibility. */
13
+ this.ariaLabel = "";
14
+ /** HTML button disabled attribute. */
15
+ this.disabled = false;
16
+ /** HTML button type attribute. */
17
+ this.type = ButtonType.BUTTON;
18
+ /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
19
+ this.variant = ButtonVariant.PRIMARY;
20
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
21
+ this.size = ControlSize.BIG;
22
+ }
23
+ getAttributes() {
24
+ return {
25
+ id: this.htmlid,
26
+ class: {
27
+ "z-button--container": true,
28
+ "z-button--has-text": !!this.hostElement.textContent.trim(),
29
+ },
30
+ };
31
+ }
32
+ render() {
33
+ if (this.href) {
34
+ 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)));
35
+ }
36
+ 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)));
37
+ }
38
+ get hostElement() { return getElement(this); }
39
+ };
40
+ ZButton.style = stylesCss$5;
41
+
42
+ const stylesCss$4 = ".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)}";
43
+
44
+ const ZDivider = class {
45
+ constructor(hostRef) {
46
+ registerInstance(this, hostRef);
47
+ /** [optional] Divider size */
48
+ this.size = DividerSize.SMALL;
49
+ /** [optional] Divider color */
50
+ this.color = "gray200";
51
+ /** [optional] Divider orintation */
52
+ this.orientation = DividerOrientation.HORIZONTAL;
53
+ }
54
+ render() {
55
+ return (h(Host, { class: `divider-${this.size} divider-${this.orientation}`, style: { backgroundColor: `var(--${this.color})` } }));
56
+ }
57
+ };
58
+ ZDivider.style = stylesCss$4;
59
+
60
+ const stylesCss$3 = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.dragdrop{position:relative;display:flex;height:228px;flex-direction:column;padding:calc(var(--space-unit) * 2);border-color:var(--color-surface04);background-color:var(--color-surface02);background-image:url(\"data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='2' ry='2' stroke='%23CACCCEFF' stroke-width='2' stroke-dasharray='15%2c 10%2c 14%2c 11' stroke-dashoffset='3' stroke-linecap='square'/%3e%3c/svg%3e\");border-radius:2px;color:var(--color-text01)}:host>.dragdrop.dragover *{pointer-events:none}:host>.dragdrop .dragover-container{position:absolute;z-index:10;top:0;left:0;display:none;width:100%;height:100%;background-color:var(--color-primary03);box-shadow:var(--shadow-focus-primary)}:host>.dragdrop .dragover-container .dragover-message{padding:10px 28px;background-color:var(--color-link-primary);color:var(--color-text04)}:host>.dragdrop.dragover .dragover-container{display:flex;align-items:center;justify-content:center}";
5
61
 
6
62
  const ZDragdropArea = class {
7
63
  constructor(hostRef) {
@@ -29,7 +85,204 @@ const ZDragdropArea = class {
29
85
  } }, this.renderOnDragOverMessage(), h("slot", null)));
30
86
  }
31
87
  };
32
- ZDragdropArea.style = stylesCss$1;
88
+ ZDragdropArea.style = stylesCss$3;
89
+
90
+ const stylesCss$2 = ":host{color:var(--color-text01);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.container{display:flex;flex-direction:column}:host .modal-wrapper{display:flex;align-items:center;justify-content:center;padding:calc(var(--space-unit) * 2)}:host .modal-wrapper>.files-wrapper{display:flex;flex-direction:column;margin:calc(var(--space-unit) * 4);gap:var(--space-unit)}:host .text-container{display:flex;flex-direction:column;margin:auto}:host .text-container .body-1{text-align:center}:host .text-container .upload-link{color:var(--color-link-primary);cursor:pointer}:host .text-container .upload-link-text{margin-bottom:var(--space-unit)}input#file-elem{display:none}#title{display:inline-block;margin:calc(var(--space-unit) * 2.5) 0 calc(var(--space-unit) * 4);font-size:calc(var(--space-unit) * 3);font-weight:var(--font-sb)}:host>.container>z-button{display:inline-block;margin-top:calc(var(--space-unit) * 3)}:host>.container>.files-container.hidden{display:none}:host>.container>.files-container>.heading-4-sb{display:inline-block;margin:calc(var(--space-unit) * 3) 0;font-size:calc(var(--space-unit) * 2);font-weight:var(--font-sb)}:host([type=\"dragdrop\"])>.container>.files-container>.heading-4-sb{margin-top:0;margin-bottom:calc(var(--space-unit) * 3)}:host>.container>.files-container>.files-wrapper{display:flex;flex-wrap:wrap;column-gap:calc(var(--space-unit) * 2);row-gap:calc(var(--space-unit) * 2)}:host>.container>.files-container>z-divider{margin-top:calc(var(--space-unit) * 3);margin-bottom:0}:host([type=\"dragdrop\"])>.container>.files-container>z-divider{margin:calc(var(--space-unit) * 3) 0}@media only screen and (min-width: 768px){:host>.container>z-button{align-self:flex-start}:host .modal-wrapper{padding:calc(var(--space-unit) * 3)}}@media only screen and (min-width: 1152px){:host .modal-wrapper{padding:calc(var(--space-unit) * 4)}}";
91
+
92
+ const ZFileUpload = class {
93
+ constructor(hostRef) {
94
+ registerInstance(this, hostRef);
95
+ this.fileInput = createEvent(this, "fileInput", 7);
96
+ /** Prop indicating the file upload type - can be default or dragdrop */
97
+ this.type = ZFileUploadType.DEFAULT;
98
+ /** Files added by the user */
99
+ this.files = [];
100
+ /** upoload button label */
101
+ this.uploadBtnLabel = "allega";
102
+ /** drag & drop button label */
103
+ this.dragAndDropLabel = "Rilascia i file in questa area per allegarli.";
104
+ this.inputAttributes = {
105
+ type: "file",
106
+ id: "file-elem",
107
+ multiple: true,
108
+ };
109
+ }
110
+ /** Listen removeFile event sent from z-file component */
111
+ removeFileListener(e) {
112
+ const files = this.files;
113
+ const file = files.find((file) => file.name === e.detail.fileName);
114
+ if (file) {
115
+ const index = files.indexOf(file);
116
+ if (index >= 0) {
117
+ files.splice(index, 1);
118
+ this.files = [...files];
119
+ }
120
+ }
121
+ }
122
+ /** Listen fileDropped event sent from z-dragdrop-area component */
123
+ fileDroppedListener(e) {
124
+ this.input.files = e.detail;
125
+ this.fileInputHandler();
126
+ }
127
+ componentDidUpdate() {
128
+ this.handleAccessibility();
129
+ this.invalidFiles.size && this.errorModal.focus();
130
+ }
131
+ componentWillLoad() {
132
+ this.invalidFiles = new Map();
133
+ }
134
+ fileInputHandler() {
135
+ if (this.input.files.length) {
136
+ this.invalidFiles = this.checkFiles(Array.from(this.input.files));
137
+ }
138
+ }
139
+ /** get array of uploaded files */
140
+ async getFiles() {
141
+ return this.files;
142
+ }
143
+ getType() {
144
+ if (getDevice() !== Device.DESKTOP && getDevice() !== Device.DESKTOP_WIDE) {
145
+ return ZFileUploadType.DEFAULT;
146
+ }
147
+ return this.type;
148
+ }
149
+ handleAccessibility() {
150
+ const lastFile = this.el.querySelector("z-file:last-child z-chip button");
151
+ if (this.files.length > 0 && lastFile) {
152
+ lastFile.focus();
153
+ }
154
+ else {
155
+ this.getType() === ZFileUploadType.DEFAULT
156
+ ? this.button.querySelector("button").focus()
157
+ : this.uploadLink.focus();
158
+ }
159
+ }
160
+ checkFiles(files) {
161
+ const errors = new Map();
162
+ const sizeErrorString = `supera i ${this.fileMaxSize}MB`;
163
+ const formatErrorString = " ha un'estensione non prevista";
164
+ files.forEach((file) => {
165
+ const fileSize = file.size / 1024 / 1024;
166
+ const fileFormatOk = this.acceptedFormat
167
+ .split(",")
168
+ .some((ext) => file.name.toLowerCase().endsWith(ext.trim()));
169
+ const fileSizeOk = fileSize <= this.fileMaxSize;
170
+ if (fileSizeOk && fileFormatOk) {
171
+ if (!this.files.find((f) => f.name === file.name)) {
172
+ this.files.push(file);
173
+ this.fileInput.emit(file);
174
+ this.input.value = "";
175
+ }
176
+ return;
177
+ }
178
+ errors.set(file.name, []);
179
+ if (!fileSizeOk) {
180
+ errors.get(file.name).push(sizeErrorString);
181
+ }
182
+ if (!fileFormatOk) {
183
+ errors.get(file.name).push(formatErrorString);
184
+ }
185
+ });
186
+ return errors;
187
+ }
188
+ renderTitle() {
189
+ return h("span", { id: "title" }, this.mainTitle);
190
+ }
191
+ renderDescription(cssClass) {
192
+ return h("span", { class: cssClass }, this.description);
193
+ }
194
+ renderAllowedFileExtensions() {
195
+ let fileFormatString = "";
196
+ let fileWeightString = "";
197
+ if (this.acceptedFormat) {
198
+ const fileFormat = this.acceptedFormat
199
+ .split(", ")
200
+ .map((string) => string.substring(1).toUpperCase())
201
+ .join(", ");
202
+ fileFormatString = ` nei formati ${fileFormat}`;
203
+ }
204
+ if (this.fileMaxSize) {
205
+ fileWeightString = ` per un massimo di ${this.fileMaxSize}MB di peso`;
206
+ }
207
+ const finalString = `Puoi allegare file${fileFormatString}${fileWeightString}.`;
208
+ return h("span", { class: "body-3" }, fileFormatString || fileWeightString ? finalString : null);
209
+ }
210
+ renderFileSection() {
211
+ return (h("section", { class: `files-container ${!this.files.length ? "hidden" : ""}` }, h("span", { class: "heading-4-sb" }, "File appena caricati"), h("div", { class: "files-wrapper" }, h("slot", { name: "files" })), h("z-divider", { size: DividerSize.MEDIUM })));
212
+ }
213
+ renderInput() {
214
+ return (h("input", Object.assign({}, this.inputAttributes, { onChange: () => this.fileInputHandler(), accept: this.acceptedFormat, ref: (val) => (this.input = val) })));
215
+ }
216
+ renderUploadButton() {
217
+ return [
218
+ this.renderInput(),
219
+ h("z-button", { onClick: () => this.input.click(), onKeyPress: (e) => {
220
+ if (e.code == "Space" || e.code == "Enter") {
221
+ e.preventDefault();
222
+ this.input.click();
223
+ }
224
+ }, id: "fileSelect", variant: this.buttonVariant, icon: "upload", ref: (val) => (this.button = val) }, this.uploadBtnLabel),
225
+ ];
226
+ }
227
+ renderUploadLink() {
228
+ return [
229
+ this.renderInput(),
230
+ h("span", { class: "body-1 upload-link-text" }, "Trascina o", " ", h("span", { tabIndex: 0, class: "body-1-sb upload-link", onClick: () => this.input.click(), onKeyPress: (e) => {
231
+ if (e.code == "Space" || e.code == "Enter") {
232
+ e.preventDefault();
233
+ this.input.click();
234
+ }
235
+ }, ref: (val) => (this.uploadLink = val) }, "carica"), " ", "dal tuo computer"),
236
+ ];
237
+ }
238
+ renderDefaultMode() {
239
+ return [
240
+ this.renderDescription("body-3-sb"),
241
+ this.renderAllowedFileExtensions(),
242
+ this.renderFileSection(),
243
+ this.renderUploadButton(),
244
+ ];
245
+ }
246
+ renderDragDropMode() {
247
+ return [
248
+ this.renderFileSection(),
249
+ h("z-dragdrop-area", { "drag-and-drop-label": this.dragAndDropLabel }, h("div", { class: "text-container" }, this.renderDescription("body-1"), this.renderUploadLink(), this.renderAllowedFileExtensions())),
250
+ ];
251
+ }
252
+ formatErrorString(key, value) {
253
+ var _a, _b;
254
+ const bothErrors = value[0] && value[1] ? ", " : "";
255
+ return `Il file ${key} ${(_a = value[0]) !== null && _a !== void 0 ? _a : ""}${bothErrors} ${(_b = value[1]) !== null && _b !== void 0 ? _b : ""} e non può quindi essere caricato.`;
256
+ }
257
+ handleErrorModalContent() {
258
+ return (h("div", { slot: "modalContent" }, h("div", { class: "modal-wrapper" }, h("div", { class: "files" }, Array.from(this.invalidFiles).map(([key, value]) => {
259
+ return h("span", { class: "body-3" }, this.formatErrorString(key, value));
260
+ })))));
261
+ }
262
+ render() {
263
+ return (h(Host, null, h("div", { tabIndex: 0, class: `container ${this.getType()}` }, this.mainTitle && this.renderTitle(), this.getType() == ZFileUploadType.DEFAULT ? this.renderDefaultMode() : this.renderDragDropMode()), !!this.invalidFiles.size && (h("z-modal", { modalid: `file-upload-${this.type}-error-modal`, tabIndex: 0, ref: (val) => (this.errorModal = val), modaltitle: "Attenzione", onModalClose: () => (this.invalidFiles = new Map()), onModalBackgroundClick: () => (this.invalidFiles = new Map()) }, this.handleErrorModalContent()))));
264
+ }
265
+ get el() { return getElement(this); }
266
+ };
267
+ ZFileUpload.style = stylesCss$2;
268
+
269
+ const stylesCss$1 = ":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)}";
270
+
271
+ const ZIcon = class {
272
+ constructor(hostRef) {
273
+ registerInstance(this, hostRef);
274
+ }
275
+ selectPathOrPolygon(iconValue) {
276
+ if (iconValue === null || iconValue === void 0 ? void 0 : iconValue.startsWith("M")) {
277
+ return h("path", { d: ICONS[this.name] });
278
+ }
279
+ return h("polygon", { points: ICONS[this.name] });
280
+ }
281
+ render() {
282
+ 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]))));
283
+ }
284
+ };
285
+ ZIcon.style = stylesCss$1;
33
286
 
34
287
  // nb. This is for IE10 and lower _only_.
35
288
  var supportCustomEvent = window.CustomEvent;
@@ -1008,4 +1261,4 @@ const ZModal = class {
1008
1261
  };
1009
1262
  ZModal.style = stylesCss;
1010
1263
 
1011
- export { ZDragdropArea as z_dragdrop_area, ZModal as z_modal };
1264
+ export { ZButton as z_button, ZDivider as z_divider, ZDragdropArea as z_dragdrop_area, ZFileUpload as z_file_upload, ZIcon as z_icon, ZModal as z_modal };
@@ -19,7 +19,7 @@ const ZChip = class {
19
19
  "z-chip-container": true,
20
20
  "z-chip-interactive": !!this.interactiveIcon,
21
21
  [this.type]: true,
22
- }, "aria-disabled": this.disabled }, this.icon && h("z-icon", { name: this.icon }), h("slot", null), this.interactiveIcon && (h("button", { type: "button", onClick: () => this.interactiveIconClick.emit(), onKeyUp: () => this.interactiveIconClick.emit(), "aria-label": this.ariaLabel, disabled: this.disabled }, h("z-icon", { class: "interactive-icon", name: this.interactiveIcon })))));
22
+ }, "aria-disabled": this.disabled }, this.icon && h("z-icon", { name: this.icon }), h("slot", null), this.interactiveIcon && (h("button", { type: "button", onClick: () => this.interactiveIconClick.emit(), "aria-label": this.ariaLabel, disabled: this.disabled }, h("z-icon", { class: "interactive-icon", name: this.interactiveIcon })))));
23
23
  }
24
24
  get el() { return getElement(this); }
25
25
  };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-4968ce56.js';
2
2
  import { e as ControlSize, I as InputType, K as KeyboardKeyCode, l as ListDividerType } from './index-47f23745.js';
3
- import { a as handleKeyboardSubmit } from './utils-2a4ef29d.js';
3
+ import { h as handleKeyboardSubmit } from './utils-3d2372eb.js';
4
4
  import './breakpoints-9b81eb1b.js';
5
5
 
6
6
  const stylesCss = ":host{display:block}:host>div.fixed{position:relative}:host>div>.header{position:relative;z-index:10;display:flex;min-height:42px;align-items:center;justify-content:space-between;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--color-surface04);margin:0;background-color:var(--color-input-field01);border-radius:var(--border-radius-small);cursor:pointer}:host([size=\"small\"])>div>.header{min-height:34px;font-size:var(--font-size-2)}:host([size=\"x-small\"])>div>.header{min-height:30px;font-size:var(--font-size-2)}:host([size=\"x-small\"])>div>.header p.body-3{padding:calc(var(--space-unit) * 0.5) 0}:host>div>.header:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}:host>div.open>div.header:focus:focus-visible{box-shadow:none}:host>div>div.header:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host>div>.header>p.body-3{padding:var(--space-unit) 0;margin:0;color:var(--color-text01)}:host>div>.header>p.body-3>span{font-weight:var(--font-sb)}:host>div>.header>z-icon{fill:var(--color-icon02);transform:rotate(360deg);transition:all 200ms linear}:host>div>.header>z-icon.small,:host>div>.header>z-icon.x-small{--z-icon-width:16px;--z-icon-height:16px}:host>div.open>.header{border:var(--border-size-small) solid var(--color-primary01);border-radius:var(--border-radius-small) var(--border-radius-small) 0 0}:host>div.disabled{pointer-events:none}:host>div.disabled .header{border-color:var(--color-disabled01);fill:var(--color-disabled01)}:host>div.disabled .header>p.body-3{color:var(--color-disabled02)}:host>div.disabled .header>z-icon:last-child{fill:var(--color-disabled01)}:host>div.open>.header>z-icon{fill:var(--color-icon02);transform:rotate(180deg);transition:all 200ms linear}:host>div.open>div.open-combo-data{position:relative;z-index:12;padding:var(--space-unit) calc(var(--space-unit) * 2);border:var(--border-size-small) solid var(--gray200);border-top:0;background-color:var(--color-input-field01);border-radius:0}:host>div.open>div.open-combo-data>div{overflow:auto;max-height:235px;padding:0;scrollbar-color:var(--color-primary01) transparent}:host>div.open>div.open-combo-data>z-input{width:100%;margin-bottom:calc(var(--space-unit) * 2)}:host>div.open>div.open-combo-data>div>ul{max-height:235px;padding:0 3px;margin:0}::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01)}:host>div.open>z-input{position:relative;z-index:1;width:238px;margin:0 calc(var(--space-unit) * 2);color:var(--color-primary01)}:host>div.open>div.open-combo-data>div.search{overflow:hidden;max-height:auto;margin-top:0;box-shadow:1px 1px 4px 2px rgb(217 222 227 / 50%)}:host>div.open>div.open-combo-data>div.search>ul{overflow:auto;max-height:180px;padding:var(--space-unit) calc(var(--space-unit) * 2);scrollbar-color:var(--color-primary01) transparent}:host>div.open>div.open-combo-data>div.search>div{display:flex;justify-content:center}:host>div.open>div.open-combo-data>div.search>div>a{display:inline-block;height:44px;color:var(--color-primary01);cursor:pointer;font-family:var(--font-family-sans);font-size:14px;font-weight:var(--font-sb);line-height:44px;text-align:center;text-transform:uppercase}:host>div.open>div.open-combo-data>div.check-all-wrapper{padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5);border-bottom:var(--border-size-small) solid var(--gray800);margin-bottom:var(--space-unit);text-align:left}:host([size=\"small\"])>div.open>div.open-combo-data>div.check-all-wrapper{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 0.5)}:host([size=\"x-small\"])>div.open>div.open-combo-data>div.check-all-wrapper{padding:var(--space-unit) calc(var(--space-unit) * 0.5)}";
@@ -0,0 +1,284 @@
1
+ import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-4968ce56.js';
2
+ import { k as LabelPosition, e as ControlSize, I as InputType } from './index-47f23745.js';
3
+ import { r as randomId, b as boolean } from './utils-3d2372eb.js';
4
+ import './breakpoints-9b81eb1b.js';
5
+
6
+ const stylesCss$1 = ".sc-z-input-h{display:inline-block;width:inherit}input.sc-z-input::-ms-clear,input.sc-z-input::-ms-reveal{display:none}.sc-z-input-h input.sc-z-input::-ms-clear,.sc-z-input-h input.sc-z-input::-ms-reveal{display:none}input.sc-z-input,textarea.sc-z-input,.textarea-wrapper.sc-z-input{box-sizing:border-box;border:var(--border-size-small) solid var(--color-surface04);background:var(--color-input-field01);border-radius:var(--border-radius-small);color:var(--color-text01);fill:var(--color-icon02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg);outline:none}[size=\"small\"].sc-z-input-h input.sc-z-input,[size=\"small\"].sc-z-input-h textarea.sc-z-input,[size=\"small\"].sc-z-input-h .textarea-wrapper.sc-z-input,[size=\"x-small\"].sc-z-input-h input.sc-z-input,[size=\"x-small\"].sc-z-input-h textarea.sc-z-input,[size=\"x-small\"].sc-z-input-h .textarea-wrapper.sc-z-input{font-size:var(--font-size-2)}.cursor-select.sc-z-input-h input.sc-z-input{cursor:pointer}.sc-z-input-h:not(.active-select) input.sc-z-input:focus:focus-visible,[readonly=\"false\"].sc-z-input-h .textarea-wrapper.sc-z-input:focus-within{box-shadow:var(--shadow-focus-primary)}input.sc-z-input:focus:focus-visible,textarea.sc-z-input:focus:focus-visible{color:var(--color-input-field02)}.active-select.sc-z-input-h input.sc-z-input{border:var(--border-size-small) solid var(--blue500)}.cursor-select.sc-z-input-h input.sc-z-input:focus:focus-visible{box-shadow:var(--shadow-focus-primary)}.sc-z-input-h input[readonly].sc-z-input:focus:focus-visible{box-shadow:none}.filled.sc-z-input{border-color:var(--color-surface05)}.input-success.sc-z-input{border-color:var(--color-success01);background:var(--color-success-inverse);fill:var(--color-success01)}.input-error.sc-z-input{border-color:var(--color-error01);background:var(--color-error-inverse);fill:var(--color-error01)}.input-warning.sc-z-input{border-color:var(--color-warning01);background:var(--color-warning-inverse);fill:var(--color-warning01)}input.sc-z-input:not([readonly]):hover,.textarea-wrapper.sc-z-input:hover{outline:var(--border-size-medium) solid var(--color-surface04);outline-offset:-2px}.sc-z-input-h:not(.active-select) input[readonly].sc-z-input,.readonly.sc-z-input{border-color:var(--color-disabled01);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) .textarea-wrapper.sc-z-input,[disabled].sc-z-input-h:not([disabled=\"false\"]) z-icon.sc-z-input{border-color:var(--color-disabled01);box-shadow:none;color:var(--color-disabled02);fill:var(--color-disabled01);pointer-events:none}[disabled].sc-z-input-h:not([disabled=\"false\"]) input.sc-z-input:hover{border-width:var(--border-size-small)}input.sc-z-input::placeholder,textarea.sc-z-input::placeholder{color:var(--color-text05)}.sc-z-input::-webkit-textarea-placeholder{color:var(--color-text05)}.sc-z-input:-ms-textarea-placeholder{color:var(--color-text05)}.sc-z-input::placeholder{color:var(--color-text05)}label.input-label.sc-z-input{display:block;padding-bottom:var(--space-unit);color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-1);font-weight:var(--font-sb);text-align:left;text-transform:uppercase}[disabled].sc-z-input-h:not([disabled=\"false\"]) label.input-label.sc-z-input{color:var(--color-disabled02)}.text-wrapper.sc-z-input>div.sc-z-input{position:relative;z-index:1;fill:var(--color-icon02)}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{width:100%;height:calc(var(--space-unit) * 5.5);box-sizing:border-box;padding:0 calc(var(--space-unit) * 1.5);margin:0}[size=\"small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4.5)}[size=\"x-small\"].sc-z-input-h .text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input{height:calc(var(--space-unit) * 4)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.sc-z-input,.text-wrapper.sc-z-input>div.sc-z-input>input.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 5.25)}.text-wrapper.sc-z-input>div.sc-z-input>input.has-icon.has-clear-icon.sc-z-input{padding-right:calc(var(--space-unit) * 8)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input{position:absolute;z-index:2;top:50%;right:calc(var(--space-unit) * 1.5);display:flex;pointer-events:none;transform:translateY(-50%)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input{padding:0;border:0;background:none;color:inherit;font:inherit;pointer-events:initial}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input+button.icon-button.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.hidden.sc-z-input{display:none}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.reset-icon.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.toggle-password-icon.sc-z-input{cursor:pointer}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.sc-z-input{--z-icon-width:18px;--z-icon-height:18px;display:block}.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.small.sc-z-input,.text-wrapper.sc-z-input .icons-wrapper.sc-z-input>button.icon-button.sc-z-input>z-icon.x-small.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}.text-wrapper.sc-z-input>div.sc-z-input>input.sc-z-input:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset;-webkit-text-fill-color:currentcolor}.textarea-wrapper.sc-z-input{padding:calc(var(--space-unit) * 1.5);scrollbar-color:var(--color-primary01) transparent}textarea.sc-z-input::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-track{background-color:transparent}textarea.sc-z-input::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}textarea.sc-z-input::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}textarea.sc-z-input{width:100%;min-height:132px;padding:0;border:none;margin:0;resize:none}.radio-wrapper.sc-z-input,.checkbox-wrapper.sc-z-input{position:relative;display:inline-flex;flex-direction:row;align-items:center;color:var(--color-text01);fill:var(--color-primary01);font-family:var(--font-family-sans)}.radio-wrapper.sc-z-input:hover,.checkbox-wrapper.sc-z-input:hover{color:var(--color-hover-primary);fill:currentcolor}.radio-wrapper.sc-z-input>input.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input{position:absolute;z-index:-1;opacity:0;pointer-events:none}.radio-wrapper.sc-z-input .radio-label.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{display:inline-flex;align-items:center;margin:0;color:inherit;font-family:inherit;font-size:inherit;font-weight:inherit;line-height:1;text-transform:inherit}.radio-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input input.sc-z-input:not(:disabled)+.checkbox-label.sc-z-input{cursor:pointer}.radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{cursor:pointer;fill:inherit}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:16px;--z-icon-height:16px}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-2)}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input z-icon.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input z-icon.sc-z-input{--z-icon-width:14px;--z-icon-height:14px}[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.sc-z-input{font-size:var(--font-size-1)}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input{flex-direction:row}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input{flex-direction:row-reverse}.radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:var(--space-unit)}.radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,.checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:var(--space-unit)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.after.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.after.sc-z-input>span.sc-z-input{margin-left:calc(var(--space-unit) * 0.5)}[size=\"small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .radio-wrapper.sc-z-input .radio-label.before.sc-z-input>span.sc-z-input,[size=\"x-small\"].sc-z-input-h .checkbox-wrapper.sc-z-input .checkbox-label.before.sc-z-input>span.sc-z-input{margin-right:calc(var(--space-unit) * 0.5)}.radio-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:focus:focus-visible+.checkbox-label.sc-z-input>z-icon.sc-z-input{border-radius:var(--border-radius-small);box-shadow:var(--shadow-focus-primary)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input{color:var(--color-disabled02)}.radio-wrapper.sc-z-input>input.sc-z-input:disabled+.radio-label.sc-z-input>z-icon.sc-z-input,.checkbox-wrapper.sc-z-input>input.sc-z-input:disabled+.checkbox-label.sc-z-input>z-icon.sc-z-input{cursor:default;fill:var(--color-disabled01)}";
7
+
8
+ const ZInput = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ this.inputChange = createEvent(this, "inputChange", 7);
12
+ this.startTyping = createEvent(this, "startTyping", 7);
13
+ this.stopTyping = createEvent(this, "stopTyping", 7);
14
+ this.inputCheck = createEvent(this, "inputCheck", 7);
15
+ /** the id of the input element */
16
+ this.htmlid = `id-${randomId()}`;
17
+ /** the input aria-label */
18
+ this.ariaLabel = "";
19
+ /** the input is disabled */
20
+ this.disabled = false;
21
+ /** the input is readonly */
22
+ this.readonly = false;
23
+ /** the input is required (optional): available for text, password, number, email, textarea, checkbox */
24
+ this.required = false;
25
+ /** checked: available for checkbox, radio */
26
+ this.checked = false;
27
+ /** input helper message (optional): available for text, password, number, email, textarea - if set to `false` message won't be displayed */
28
+ this.message = true;
29
+ /** the input label position: available for checkbox, radio */
30
+ this.labelPosition = LabelPosition.RIGHT;
31
+ /** render clear icon when typing (optional): available for text */
32
+ this.hasclearicon = true;
33
+ /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
34
+ this.size = ControlSize.BIG;
35
+ this.isTyping = false;
36
+ this.passwordHidden = true;
37
+ this.typingtimeout = 300;
38
+ }
39
+ inputCheckListener(e) {
40
+ const data = e.detail;
41
+ switch (this.type) {
42
+ case InputType.RADIO:
43
+ if (data.type === InputType.RADIO && data.name === this.name && data.id !== this.htmlid) {
44
+ this.checked = false;
45
+ }
46
+ break;
47
+ }
48
+ }
49
+ /** get checked status */
50
+ async isChecked() {
51
+ switch (this.type) {
52
+ case InputType.CHECKBOX:
53
+ case InputType.RADIO:
54
+ return this.checked;
55
+ default:
56
+ console.warn("`isChecked` method is only available for type `checkbox` and `radio`");
57
+ return false;
58
+ }
59
+ }
60
+ emitInputChange(value) {
61
+ if (!this.isTyping) {
62
+ this.emitStartTyping();
63
+ }
64
+ let validity;
65
+ if (this.type === InputType.TEXTAREA) {
66
+ validity = this.getValidity("textarea");
67
+ }
68
+ else {
69
+ validity = this.getValidity("input");
70
+ }
71
+ this.value = value;
72
+ this.inputChange.emit({ value, validity });
73
+ clearTimeout(this.timer);
74
+ this.timer = setTimeout(() => {
75
+ this.emitStopTyping(this.value, validity);
76
+ }, this.typingtimeout);
77
+ }
78
+ emitStartTyping() {
79
+ this.isTyping = true;
80
+ this.startTyping.emit();
81
+ }
82
+ emitStopTyping(value, validity) {
83
+ this.isTyping = false;
84
+ this.stopTyping.emit({
85
+ value: value,
86
+ validity: validity,
87
+ });
88
+ }
89
+ emitInputCheck(checked) {
90
+ this.inputCheck.emit({
91
+ id: this.htmlid,
92
+ checked: checked,
93
+ type: this.type,
94
+ name: this.name,
95
+ value: this.value,
96
+ validity: this.getValidity("input"),
97
+ });
98
+ }
99
+ getValidity(type) {
100
+ const input = this.hostElement.querySelector(type);
101
+ return input.validity;
102
+ }
103
+ /* START text/password/email/number */
104
+ getTextAttributes() {
105
+ return {
106
+ id: this.htmlid,
107
+ name: this.name,
108
+ placeholder: this.placeholder,
109
+ value: this.value,
110
+ disabled: this.disabled,
111
+ readonly: this.readonly,
112
+ required: this.required,
113
+ title: this.htmltitle,
114
+ minlength: this.minlength,
115
+ maxlength: this.maxlength,
116
+ class: {
117
+ [`input-${this.status}`]: !!this.status,
118
+ filled: !!this.value,
119
+ },
120
+ autocomplete: this.autocomplete,
121
+ onInput: (e) => this.emitInputChange(e.target.value),
122
+ };
123
+ }
124
+ getNumberAttributes(type) {
125
+ if (type != InputType.NUMBER) {
126
+ return;
127
+ }
128
+ return {
129
+ min: this.min,
130
+ max: this.max,
131
+ step: this.step,
132
+ };
133
+ }
134
+ getPatternAttribute(type) {
135
+ if (type != InputType.PASSWORD &&
136
+ type != InputType.TEXT &&
137
+ type != InputType.TEL &&
138
+ type != InputType.SEARCH &&
139
+ type != InputType.URL &&
140
+ type != InputType.EMAIL) {
141
+ return;
142
+ }
143
+ return {
144
+ pattern: this.pattern,
145
+ };
146
+ }
147
+ getRoleAttribute() {
148
+ return this.role ? { role: this.role } : {};
149
+ }
150
+ getAriaAttrubutes() {
151
+ const expanded = this.ariaExpanded ? { "aria-expanded": this.ariaExpanded } : {};
152
+ const controls = this.ariaControls ? { "aria-controls": this.ariaControls } : {};
153
+ const autocomplete = this.ariaAutocomplete ? { "aria-autocomplete": this.ariaAutocomplete } : {};
154
+ const activedescendant = this.ariaActivedescendant ? { "aria-activedescendant": this.ariaActivedescendant } : {};
155
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, expanded), controls), autocomplete), activedescendant);
156
+ }
157
+ renderInputText(type = InputType.TEXT) {
158
+ const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
159
+ 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());
160
+ if (this.icon || type === InputType.PASSWORD) {
161
+ Object.assign(attr.class, { "has-icon": true });
162
+ }
163
+ if (this.hasclearicon && type != InputType.NUMBER) {
164
+ Object.assign(attr.class, { "has-clear-icon": true });
165
+ }
166
+ 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()));
167
+ }
168
+ renderLabel() {
169
+ if (!this.label) {
170
+ return;
171
+ }
172
+ return (h("label", { class: "input-label body-5-sb", id: `${this.htmlid}_label`, htmlFor: this.htmlid }, this.label));
173
+ }
174
+ renderIcons() {
175
+ return (h("span", { class: "icons-wrapper" }, this.renderResetIcon(), this.renderIcon()));
176
+ }
177
+ renderIcon() {
178
+ if (this.type === InputType.PASSWORD) {
179
+ return this.renderShowHidePassword();
180
+ }
181
+ if (!this.icon) {
182
+ return;
183
+ }
184
+ return (h("button", { type: "button", class: "icon-button input-icon", tabIndex: -1, "aria-hidden": "true" }, h("z-icon", { name: this.icon, class: this.size })));
185
+ }
186
+ renderResetIcon() {
187
+ let hidden = false;
188
+ if (!this.hasclearicon || !this.value || this.disabled || this.readonly || this.type == InputType.NUMBER) {
189
+ hidden = true;
190
+ }
191
+ return (h("button", { type: "button", class: `icon-button reset-icon ${hidden ? "hidden" : ""}`, "aria-label": "cancella il contenuto dell'input", onClick: () => {
192
+ this.inputRef.value = "";
193
+ this.emitInputChange("");
194
+ } }, h("z-icon", { name: "multiply", class: this.size })));
195
+ }
196
+ renderShowHidePassword() {
197
+ 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 })));
198
+ }
199
+ renderMessage() {
200
+ if (boolean(this.message) === false) {
201
+ return;
202
+ }
203
+ return (h("z-input-message", { message: boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
204
+ }
205
+ /* END text/password/email/number */
206
+ /* START textarea */
207
+ renderTextarea() {
208
+ const attributes = this.getTextAttributes();
209
+ const ariaLabel = this.ariaLabel ? { "aria-label": this.ariaLabel } : {};
210
+ 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()));
211
+ }
212
+ /* END textarea */
213
+ handleCheck(ev) {
214
+ this.checked = ev.target.checked;
215
+ this.emitInputCheck(this.checked);
216
+ }
217
+ /* START checkbox */
218
+ renderCheckbox() {
219
+ 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: {
220
+ "checkbox-label": true,
221
+ "after": this.labelPosition === LabelPosition.RIGHT,
222
+ "before": this.labelPosition === LabelPosition.LEFT,
223
+ } }, h("z-icon", { name: this.checked ? "checkbox-checked" : "checkbox", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
224
+ }
225
+ /* END checkbox */
226
+ /* START radio */
227
+ renderRadio() {
228
+ 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: {
229
+ "radio-label": true,
230
+ "after": this.labelPosition === LabelPosition.RIGHT,
231
+ "before": this.labelPosition === LabelPosition.LEFT,
232
+ } }, h("z-icon", { name: this.checked ? "radio-button-checked" : "radio-button", "aria-hidden": "true", class: this.size }), this.label && h("span", { innerHTML: this.label }))));
233
+ }
234
+ /* END radio */
235
+ render() {
236
+ let input;
237
+ switch (this.type) {
238
+ case InputType.TEXTAREA:
239
+ input = this.renderTextarea();
240
+ break;
241
+ case InputType.CHECKBOX:
242
+ input = this.renderCheckbox();
243
+ break;
244
+ case InputType.RADIO:
245
+ input = this.renderRadio();
246
+ break;
247
+ default:
248
+ input = this.renderInputText(this.type);
249
+ }
250
+ return h(Host, null, input);
251
+ }
252
+ get hostElement() { return getElement(this); }
253
+ };
254
+ ZInput.style = stylesCss$1;
255
+
256
+ const stylesCss = ":host{display:flex;min-height:calc(var(--space-unit) * 2.5);align-items:start;margin-top:var(--space-unit);color:var(--color-text05);fill:currentcolor;font-family:var(--font-family-sans);font-size:var(--font-size-2);letter-spacing:0.16px}:host(.small),:host(.x-small){margin-top:calc(var(--space-unit) * 0.5);font-size:var(--font-size-1)}:host([status=\"success\"]){color:var(--color-text-success)}:host([status=\"error\"]){color:var(--color-text-error)}:host([status=\"warning\"]){color:var(--color-warning02)}:host(:focus){outline:none}:host>z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);--z-icon-right-margin:var(--space-unit);margin-top:calc(var(--space-unit) * 0.25)}:host(.small)>z-icon,:host(.x-small)>z-icon{--z-icon-width:14px;--z-icon-height:14px;--z-icon-right-margin:calc(var(--space-unit) * 0.5)}";
257
+
258
+ const ZInputMessage = class {
259
+ constructor(hostRef) {
260
+ registerInstance(this, hostRef);
261
+ this.statusIcons = {
262
+ success: "checkmark-circle",
263
+ error: "multiply-circled",
264
+ warning: "exclamation-circle",
265
+ };
266
+ this.statusRole = {};
267
+ }
268
+ onMessageChange() {
269
+ this.statusRole = this.message && this.status ? { role: "alert" } : {};
270
+ }
271
+ componentWillLoad() {
272
+ this.onMessageChange();
273
+ }
274
+ render() {
275
+ 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 })));
276
+ }
277
+ static get watchers() { return {
278
+ "message": ["onMessageChange"],
279
+ "status": ["onMessageChange"]
280
+ }; }
281
+ };
282
+ ZInputMessage.style = stylesCss;
283
+
284
+ export { ZInput as z_input, ZInputMessage as z_input_message };