@zanichelli/albe-web-components 7.3.1 → 7.3.3

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 (235) hide show
  1. package/dist/cjs/index-e3299e0a.js +6 -30
  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_11.cjs.entry.js +1052 -0
  5. package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +865 -2
  6. package/dist/cjs/z-menu-section.cjs.entry.js +1 -1
  7. package/dist/cjs/z-menu.cjs.entry.js +1 -1
  8. package/dist/cjs/z-popover.cjs.entry.js +2 -1
  9. package/dist/cjs/z-tooltip.cjs.entry.js +8 -2
  10. package/dist/collection/components/inputs/z-searchbar/index.js +6 -17
  11. package/dist/collection/components/inputs/z-searchbar/styles.css +46 -95
  12. package/dist/collection/components/modal/z-modal/index.js +8 -1
  13. package/dist/collection/components/modal/z-modal/styles.css +13 -0
  14. package/dist/collection/components/navigation/z-app-header/index.js +171 -47
  15. package/dist/collection/components/navigation/z-app-header/index.stories.js +393 -0
  16. package/dist/collection/components/navigation/z-app-header/styles.css +167 -166
  17. package/dist/collection/components/navigation/z-menu/index.js +1 -0
  18. package/dist/collection/components/navigation/z-menu/styles.css +7 -7
  19. package/dist/collection/components/navigation/z-menu-section/styles.css +8 -9
  20. package/dist/collection/components/notification/z-tooltip/index.js +28 -4
  21. package/dist/collection/components/notification/z-tooltip/styles.css +1 -0
  22. package/dist/collection/components/z-offcanvas/index.js +34 -50
  23. package/dist/collection/components/z-popover/index.js +3 -2
  24. package/dist/esm/index-a2ca4b97.js +6 -30
  25. package/dist/esm/index.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/polyfills/css-shim.js +0 -0
  28. package/dist/esm/{utils-970ac457.js → utils-a52a81ba.js} +1 -1
  29. package/dist/esm/web-components-library.js +1 -1
  30. package/dist/esm/z-app-header_11.entry.js +1038 -0
  31. package/dist/esm/z-chip.entry.js +1 -1
  32. package/dist/esm/z-combobox.entry.js +1 -1
  33. package/dist/esm/z-dragdrop-area_2.entry.js +865 -2
  34. package/dist/esm/z-file-upload.entry.js +1 -1
  35. package/dist/esm/z-menu-section.entry.js +1 -1
  36. package/dist/esm/z-menu.entry.js +1 -1
  37. package/dist/esm/z-myz-card-info.entry.js +1 -1
  38. package/dist/esm/z-myz-list-item.entry.js +1 -1
  39. package/dist/esm/z-pocket_3.entry.js +1 -1
  40. package/dist/esm/z-popover.entry.js +2 -1
  41. package/dist/esm/z-select.entry.js +1 -1
  42. package/dist/esm/z-skip-to-content.entry.js +1 -1
  43. package/dist/esm/z-slideshow.entry.js +1 -1
  44. package/dist/esm/z-table-header.entry.js +1 -1
  45. package/dist/esm/z-toggle-switch.entry.js +1 -1
  46. package/dist/esm/z-tooltip.entry.js +8 -2
  47. package/dist/types/beans/index.d.ts +0 -0
  48. package/dist/types/components/buttons/z-button/index.d.ts +0 -0
  49. package/dist/types/components/buttons/z-button-sort/index.d.ts +0 -0
  50. package/dist/types/components/buttons/z-chip/index.d.ts +0 -0
  51. package/dist/types/components/buttons/z-toggle-button/index.d.ts +0 -0
  52. package/dist/types/components/buttons/z-toggle-switch/index.d.ts +0 -0
  53. package/dist/types/components/date-picker/utils.d.ts +0 -0
  54. package/dist/types/components/date-picker/z-date-picker/index.d.ts +0 -0
  55. package/dist/types/components/date-picker/z-range-picker/index.d.ts +0 -0
  56. package/dist/types/components/file-upload/z-dragdrop-area/index.d.ts +0 -0
  57. package/dist/types/components/file-upload/z-file/index.d.ts +0 -0
  58. package/dist/types/components/file-upload/z-file-upload/index.d.ts +0 -0
  59. package/dist/types/components/icons/icons.d.ts +0 -0
  60. package/dist/types/components/icons/z-icon/index.d.ts +0 -0
  61. package/dist/types/components/index.d.ts +0 -0
  62. package/dist/types/components/indicators/z-stepper/index.d.ts +0 -0
  63. package/dist/types/components/indicators/z-stepper-item/index.d.ts +0 -0
  64. package/dist/types/components/inputs/z-combobox/index.d.ts +0 -0
  65. package/dist/types/components/inputs/z-input/index.d.ts +0 -0
  66. package/dist/types/components/inputs/z-input-message/index.d.ts +0 -0
  67. package/dist/types/components/inputs/z-searchbar/index.d.ts +0 -2
  68. package/dist/types/components/inputs/z-select/index.d.ts +0 -0
  69. package/dist/types/components/list/z-list/index.d.ts +0 -0
  70. package/dist/types/components/list/z-list-element/index.d.ts +0 -0
  71. package/dist/types/components/list/z-list-group/index.d.ts +0 -0
  72. package/dist/types/components/list/z-toast-notification-list/index.d.ts +0 -0
  73. package/dist/types/components/logo/z-logo/index.d.ts +0 -0
  74. package/dist/types/components/modal/z-modal/index.d.ts +0 -0
  75. package/dist/types/components/navigation/tabs/z-navigation-tab/index.d.ts +0 -0
  76. package/dist/types/components/navigation/tabs/z-navigation-tab-link/index.d.ts +0 -0
  77. package/dist/types/components/navigation/tabs/z-navigation-tabs/index.d.ts +0 -0
  78. package/dist/types/components/navigation/z-app-header/index.d.ts +49 -17
  79. package/dist/types/components/navigation/z-link/index.d.ts +0 -0
  80. package/dist/types/components/navigation/z-menu/index.d.ts +1 -0
  81. package/dist/types/components/navigation/z-menu-section/index.d.ts +0 -0
  82. package/dist/types/components/notification/z-info-box/index.d.ts +0 -0
  83. package/dist/types/components/notification/z-notification/index.d.ts +0 -0
  84. package/dist/types/components/notification/z-toast-notification/index.d.ts +0 -0
  85. package/dist/types/components/notification/z-tooltip/index.d.ts +9 -3
  86. package/dist/types/components/panel/z-panel-elem/index.d.ts +0 -0
  87. package/dist/types/components/z-anchor-navigation/index.d.ts +0 -0
  88. package/dist/types/components/z-aria-alert/index.d.ts +0 -0
  89. package/dist/types/components/z-avatar/index.d.ts +0 -0
  90. package/dist/types/components/z-card/index.d.ts +0 -0
  91. package/dist/types/components/z-carousel/index.d.ts +0 -0
  92. package/dist/types/components/z-contextual-menu/index.d.ts +0 -0
  93. package/dist/types/components/z-cover-hero/index.d.ts +0 -0
  94. package/dist/types/components/z-divider/index.d.ts +0 -0
  95. package/dist/types/components/z-ghost-loading/index.d.ts +0 -0
  96. package/dist/types/components/z-info-reveal/index.d.ts +0 -0
  97. package/dist/types/components/z-offcanvas/index.d.ts +10 -12
  98. package/dist/types/components/z-pagination/index.d.ts +0 -0
  99. package/dist/types/components/z-popover/index.d.ts +2 -1
  100. package/dist/types/components/z-section-title/index.d.ts +0 -0
  101. package/dist/types/components/z-skip-to-content/index.d.ts +0 -0
  102. package/dist/types/components/z-table/z-table/index.d.ts +0 -0
  103. package/dist/types/components/z-table/z-table-body/index.d.ts +0 -0
  104. package/dist/types/components/z-table/z-table-cell/index.d.ts +0 -0
  105. package/dist/types/components/z-table/z-table-empty-box/index.d.ts +0 -0
  106. package/dist/types/components/z-table/z-table-expanded-row/index.d.ts +0 -0
  107. package/dist/types/components/z-table/z-table-footer/index.d.ts +0 -0
  108. package/dist/types/components/z-table/z-table-head/index.d.ts +0 -0
  109. package/dist/types/components/z-table/z-table-header/index.d.ts +0 -0
  110. package/dist/types/components/z-table/z-table-header-row/index.d.ts +0 -0
  111. package/dist/types/components/z-table/z-table-row/index.d.ts +0 -0
  112. package/dist/types/components/z-table/z-table-sticky-footer/index.d.ts +0 -0
  113. package/dist/types/components/z-tag/index.d.ts +0 -0
  114. package/dist/types/components/z-visually-hidden/index.d.ts +0 -0
  115. package/dist/types/components.d.ts +51 -15
  116. package/dist/types/constants/breakpoints.d.ts +0 -0
  117. package/dist/types/constants/icons.d.ts +0 -0
  118. package/dist/types/index.d.ts +0 -0
  119. package/dist/types/snowflakes/myz/card/z-myz-card/index.d.ts +0 -0
  120. package/dist/types/snowflakes/myz/card/z-myz-card-alert/index.d.ts +0 -0
  121. package/dist/types/snowflakes/myz/card/z-myz-card-body/index.d.ts +0 -0
  122. package/dist/types/snowflakes/myz/card/z-myz-card-cover/index.d.ts +0 -0
  123. package/dist/types/snowflakes/myz/card/z-myz-card-dictionary/index.d.ts +0 -0
  124. package/dist/types/snowflakes/myz/card/z-myz-card-footer/index.d.ts +0 -0
  125. package/dist/types/snowflakes/myz/card/z-myz-card-footer-sections/index.d.ts +0 -0
  126. package/dist/types/snowflakes/myz/card/z-myz-card-header/index.d.ts +0 -0
  127. package/dist/types/snowflakes/myz/card/z-myz-card-icon/index.d.ts +0 -0
  128. package/dist/types/snowflakes/myz/card/z-myz-card-info/index.d.ts +0 -0
  129. package/dist/types/snowflakes/myz/card/z-myz-card-list/index.d.ts +0 -0
  130. package/dist/types/snowflakes/myz/list/z-myz-list/index.d.ts +0 -0
  131. package/dist/types/snowflakes/myz/list/z-myz-list-item/index.d.ts +0 -0
  132. package/dist/types/snowflakes/myz/pocket/z-messages-pocket/index.d.ts +0 -0
  133. package/dist/types/snowflakes/myz/pocket/z-pocket/index.d.ts +0 -0
  134. package/dist/types/snowflakes/myz/pocket/z-pocket-body/index.d.ts +0 -0
  135. package/dist/types/snowflakes/myz/pocket/z-pocket-header/index.d.ts +0 -0
  136. package/dist/types/snowflakes/myz/pocket/z-pocket-message/index.d.ts +0 -0
  137. package/dist/types/snowflakes/myz/z-alert/index.d.ts +0 -0
  138. package/dist/types/snowflakes/myz/z-otp/index.d.ts +0 -0
  139. package/dist/types/snowflakes/myz/z-slideshow/index.d.ts +0 -0
  140. package/dist/types/stencil-public-runtime.d.ts +0 -0
  141. package/dist/types/utils/utils.d.ts +0 -0
  142. package/dist/web-components-library/index.esm.js +1 -1
  143. package/dist/web-components-library/{p-1f259ec0.entry.js → p-0bf3a704.entry.js} +1 -1
  144. package/{www/build/p-d982fc4c.entry.js → dist/web-components-library/p-10e036e4.entry.js} +1 -1
  145. package/dist/web-components-library/p-161a4e84.entry.js +1 -0
  146. package/dist/web-components-library/{p-dfc69cc3.js → p-1c6b0e09.js} +1 -1
  147. package/dist/web-components-library/{p-10625725.entry.js → p-1e71778f.entry.js} +1 -1
  148. package/dist/web-components-library/{p-068951a7.entry.js → p-1eaef57d.entry.js} +1 -1
  149. package/dist/web-components-library/p-27441384.entry.js +1 -0
  150. package/dist/web-components-library/{p-779c8d20.entry.js → p-378e3fd3.entry.js} +1 -1
  151. package/dist/web-components-library/{p-e2758870.entry.js → p-5c5a2680.entry.js} +1 -1
  152. package/dist/web-components-library/p-6d377fcb.entry.js +1 -0
  153. package/{www/build/p-191c9901.entry.js → dist/web-components-library/p-84b23d4b.entry.js} +1 -1
  154. package/dist/web-components-library/p-8ff45f5f.entry.js +1 -0
  155. package/dist/web-components-library/p-a7249453.entry.js +1 -0
  156. package/dist/web-components-library/p-b36fc3db.entry.js +1 -0
  157. package/dist/web-components-library/{p-bca446ef.entry.js → p-c9bb584c.entry.js} +1 -1
  158. package/dist/web-components-library/{p-59b1f1e9.entry.js → p-d986024a.entry.js} +1 -1
  159. package/dist/web-components-library/p-eefde77a.entry.js +1 -0
  160. package/dist/web-components-library/web-components-library.css +0 -0
  161. package/dist/web-components-library/web-components-library.esm.js +1 -1
  162. package/loader/cdn.js +0 -0
  163. package/loader/index.cjs.js +0 -0
  164. package/loader/index.d.ts +0 -0
  165. package/loader/index.es2017.js +0 -0
  166. package/loader/index.js +0 -0
  167. package/loader/package.json +0 -0
  168. package/package.json +3 -2
  169. package/www/build/index.esm.js +1 -1
  170. package/www/build/{p-1f259ec0.entry.js → p-0bf3a704.entry.js} +1 -1
  171. package/{dist/web-components-library/p-d982fc4c.entry.js → www/build/p-10e036e4.entry.js} +1 -1
  172. package/www/build/p-161a4e84.entry.js +1 -0
  173. package/www/build/{p-dfc69cc3.js → p-1c6b0e09.js} +1 -1
  174. package/www/build/{p-10625725.entry.js → p-1e71778f.entry.js} +1 -1
  175. package/www/build/{p-068951a7.entry.js → p-1eaef57d.entry.js} +1 -1
  176. package/www/build/p-27441384.entry.js +1 -0
  177. package/www/build/{p-779c8d20.entry.js → p-378e3fd3.entry.js} +1 -1
  178. package/www/build/{p-e2758870.entry.js → p-5c5a2680.entry.js} +1 -1
  179. package/www/build/p-6d377fcb.entry.js +1 -0
  180. package/www/build/p-70021fac.js +1 -0
  181. package/{dist/web-components-library/p-191c9901.entry.js → www/build/p-84b23d4b.entry.js} +1 -1
  182. package/www/build/p-8ff45f5f.entry.js +1 -0
  183. package/www/build/p-a7249453.entry.js +1 -0
  184. package/www/build/p-b36fc3db.entry.js +1 -0
  185. package/www/build/{p-bca446ef.entry.js → p-c9bb584c.entry.js} +1 -1
  186. package/www/build/{p-59b1f1e9.entry.js → p-d986024a.entry.js} +1 -1
  187. package/www/build/p-eefde77a.entry.js +1 -0
  188. package/www/build/web-components-library.css +0 -0
  189. package/www/build/web-components-library.esm.js +1 -1
  190. package/www/build/web-components-library.js +0 -0
  191. package/www/host.config.json +0 -0
  192. package/www/index.html +1 -1
  193. package/CHANGELOG.md +0 -2439
  194. package/dist/cjs/z-app-header_2.cjs.entry.js +0 -152
  195. package/dist/cjs/z-button.cjs.entry.js +0 -43
  196. package/dist/cjs/z-divider.cjs.entry.js +0 -26
  197. package/dist/cjs/z-input_2.cjs.entry.js +0 -273
  198. package/dist/cjs/z-list_3.cjs.entry.js +0 -261
  199. package/dist/cjs/z-offcanvas.cjs.entry.js +0 -57
  200. package/dist/cjs/z-searchbar.cjs.entry.js +0 -248
  201. package/dist/esm/z-app-header_2.entry.js +0 -147
  202. package/dist/esm/z-button.entry.js +0 -39
  203. package/dist/esm/z-divider.entry.js +0 -22
  204. package/dist/esm/z-input_2.entry.js +0 -268
  205. package/dist/esm/z-list_3.entry.js +0 -255
  206. package/dist/esm/z-offcanvas.entry.js +0 -53
  207. package/dist/esm/z-searchbar.entry.js +0 -244
  208. package/dist/web-components-library/p-1570917d.entry.js +0 -1
  209. package/dist/web-components-library/p-157aea3b.entry.js +0 -1
  210. package/dist/web-components-library/p-1c8e7c24.entry.js +0 -1
  211. package/dist/web-components-library/p-20682781.entry.js +0 -1
  212. package/dist/web-components-library/p-3d0f5e36.entry.js +0 -1
  213. package/dist/web-components-library/p-4f266607.entry.js +0 -1
  214. package/dist/web-components-library/p-51c946a5.entry.js +0 -1
  215. package/dist/web-components-library/p-975afabe.entry.js +0 -1
  216. package/dist/web-components-library/p-af283478.entry.js +0 -1
  217. package/dist/web-components-library/p-bae1911e.entry.js +0 -1
  218. package/dist/web-components-library/p-d0760bb1.entry.js +0 -1
  219. package/dist/web-components-library/p-deda8776.entry.js +0 -1
  220. package/dist/web-components-library/p-f3a8cc14.entry.js +0 -1
  221. package/src-react/index.ts +0 -1
  222. package/www/build/p-1570917d.entry.js +0 -1
  223. package/www/build/p-157aea3b.entry.js +0 -1
  224. package/www/build/p-1c8e7c24.entry.js +0 -1
  225. package/www/build/p-20682781.entry.js +0 -1
  226. package/www/build/p-3d0f5e36.entry.js +0 -1
  227. package/www/build/p-4f266607.entry.js +0 -1
  228. package/www/build/p-51c946a5.entry.js +0 -1
  229. package/www/build/p-77d28b14.js +0 -1
  230. package/www/build/p-975afabe.entry.js +0 -1
  231. package/www/build/p-af283478.entry.js +0 -1
  232. package/www/build/p-bae1911e.entry.js +0 -1
  233. package/www/build/p-d0760bb1.entry.js +0 -1
  234. package/www/build/p-deda8776.entry.js +0 -1
  235. package/www/build/p-f3a8cc14.entry.js +0 -1
@@ -1,261 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e3299e0a.js');
6
- const index$1 = require('./index-7a9a8430.js');
7
-
8
- const stylesCss$2 = ":host{display:flex;flex-direction:column;font-family:var(--font-family-sans);font-weight:var(--font-rg)}";
9
-
10
- const ZList = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- /**
14
- * [optional] Sets size of inside elements.
15
- */
16
- this.size = index$1.ListSize.MEDIUM;
17
- /**
18
- * [optional] type of the list marker for each element
19
- */
20
- this.listType = index$1.ListType.NONE;
21
- }
22
- setChildrenSizeType() {
23
- const children = this.host.children;
24
- for (let i = 0; i < children.length; i++) {
25
- children[i].setAttribute("size", this.size);
26
- children[i].setAttribute("list-type", this.listType);
27
- children[i].setAttribute("list-element-position", (i + 1).toString());
28
- }
29
- }
30
- componentDidLoad() {
31
- this.setChildrenSizeType();
32
- }
33
- render() {
34
- return (index.h(index.Host, { role: "list" }, index.h("slot", null)));
35
- }
36
- get host() { return index.getElement(this); }
37
- };
38
- ZList.style = stylesCss$2;
39
-
40
- const stylesCss$1 = ":host{outline:none}:host>.container,:host>.container-contextual-menu{--background-color-list-element:var(--bg-white);--background-hover-color-list-element:var(--color-surface02);--background-active-color-list-element:var(--color-surface02);display:flex;box-sizing:border-box;flex-direction:column;justify-content:center;font-family:var(--font-family-sans);font-weight:var(--font-rg);outline:none}:host([size=\"small\"])>.container{min-height:calc(var(--space-unit) * 4);padding:calc(var(--space-unit) / 2) 0}:host([size=\"medium\"])>.container{min-height:calc(var(--space-unit) * 5);padding:var(--space-unit) 0}:host([size=\"large\"])>.container{min-height:calc(var(--space-unit) * 7);padding:calc(var(--space-unit) * 2) 0}:host([size=\"x-large\"])>.container{min-height:calc(var(--space-unit) * 9);padding:calc(var(--space-unit) * 3) 0}:host([expandable])>.container,:host([expandable])>.container-contextual-menu,:host([clickable])>.container,:host([clickable])>.container-contextual-menu{cursor:pointer}:host([expandable]:hover)>.container,:host([expandable]:hover)>.container-contextual-menu,:host([clickable]:hover)>.container,:host([clickable]:hover)>.container-contextual-menu{background-color:var(--background-hover-color-list-element)}:host([expandable]:focus:focus-visible)>.container,:host([expandable]:focus:focus-visible)>.container-contextual-menu,:host([clickable]:focus:focus-visible)>.container,:host([clickable]:focus:focus-visible)>.container-contextual-menu{box-shadow:var(--shadow-focus-primary)}:host([clickable]:not([expandable]))>.container.clicked,:host([clickable]:not([expandable]))>.container-contextual-menu.clicked{box-shadow:var(--shadow-focus-primary)}:host([expandable]:active)>.container,:host([expandable]:active)>.container-contextual-menu,:host([clickable]:active)>.container,:host([clickable]:active)>.container-contextual-menu{background-color:var(--background-active-color-list-element)}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container{display:flex;flex-direction:row-reverse;justify-content:space-between}:host([align-button=\"left\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"left\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-right:var(--space-unit)}:host([align-button=\"right\"][expandable])>.container>.z-list-element-container>z-icon,:host([align-button=\"right\"][expandable])>.container-contextual-menu>.z-list-element-container>z-icon{margin-left:var(--space-unit)}:host>.container>.z-list-element-inner-container,:host>.container-contextual-menu>.z-list-element-inner-container{display:none}:host>.container>.z-list-element-inner-container.expanded,:host>.container-contextual-menu>.z-list-element-inner-container.expanded{display:block}:host([clickable]:hover)>.container-contextual-menu{background-color:var(--color-surface03)}.container-contextual-menu:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}.z-list-content-container{display:flex;align-items:center}";
41
-
42
- const ZListElement = class {
43
- /**
44
- * Constructor.
45
- */
46
- constructor(hostRef) {
47
- index.registerInstance(this, hostRef);
48
- this.accessibleFocus = index.createEvent(this, "accessibleFocus", 7);
49
- this.clickItem = index.createEvent(this, "clickItem", 7);
50
- /**
51
- * [optional] Align expandable button left or right.
52
- */
53
- this.alignButton = index$1.ExpandableListButtonAlign.LEFT;
54
- /**
55
- * [optional] Sets element clickable.
56
- */
57
- this.clickable = false;
58
- /**
59
- * [optional] Sets the divider color.
60
- */
61
- this.dividerColor = "color-surface03";
62
- /**
63
- * [optional] Sets the position where to insert the divider.
64
- */
65
- this.dividerType = index$1.ListDividerType.NONE;
66
- /**
67
- * [optional] Sets the divider size.
68
- */
69
- this.dividerSize = index$1.DividerSize.SMALL;
70
- /**
71
- * [optional] Sets element as expandable.
72
- */
73
- this.expandable = false;
74
- /**
75
- * [optional] Sets expandable style to element.
76
- */
77
- this.expandableStyle = index$1.ExpandableListStyle.ACCORDION;
78
- /**
79
- * [optional] Sets size of inside elements.
80
- */
81
- this.size = index$1.ListSize.MEDIUM;
82
- /**
83
- * [optional] Sets text color of the element.
84
- */
85
- this.color = "none";
86
- /**
87
- * [optional] Sets disabled style of the element.
88
- */
89
- this.disabled = false;
90
- /**
91
- * [optional] If is used in ZContextualMenu component
92
- */
93
- this.isContextualMenu = false;
94
- /**
95
- * [optional] position of the list element inside the list or the group
96
- */
97
- this.listElementPosition = "0";
98
- /**
99
- * [optional] type of the list marker for each element
100
- */
101
- this.listType = index$1.ListType.NONE;
102
- this.showInnerContent = false;
103
- this.openElementConfig = {
104
- accordion: {
105
- open: "minus-circled",
106
- close: "plus-circled",
107
- },
108
- menu: {
109
- open: "chevron-up",
110
- close: "chevron-down",
111
- },
112
- };
113
- this.handleClick = this.handleClick.bind(this);
114
- this.handleKeyDown = this.handleKeyDown.bind(this);
115
- }
116
- accessibleFocusHandler(e) {
117
- if (this.listElementId === e.detail) {
118
- const toFocus = this.host.shadowRoot.getElementById(`z-list-element-id-${e.detail}`);
119
- toFocus.focus();
120
- }
121
- }
122
- /**
123
- * Handler for click on element. If element is expandable, change state.
124
- * @returns void
125
- */
126
- handleClick() {
127
- this.clickItem.emit(this.listElementId);
128
- if (!this.expandable) {
129
- return;
130
- }
131
- this.showInnerContent = !this.showInnerContent;
132
- }
133
- calculateClass() {
134
- if (this.isContextualMenu) {
135
- return "container-contextual-menu";
136
- }
137
- return "container";
138
- }
139
- handleKeyDown(event) {
140
- const expandByKey = event.code === index$1.KeyboardCode.ENTER;
141
- switch (event.code) {
142
- case index$1.KeyboardCode.ARROW_DOWN:
143
- event.preventDefault();
144
- this.accessibleFocus.emit(this.listElementId + 1);
145
- break;
146
- case index$1.KeyboardCode.ARROW_UP:
147
- event.preventDefault();
148
- this.accessibleFocus.emit(this.listElementId - 1);
149
- break;
150
- case index$1.KeyboardCode.ENTER:
151
- event.preventDefault();
152
- this.clickItem.emit(this.listElementId);
153
- break;
154
- }
155
- if (!this.expandable || !expandByKey) {
156
- return;
157
- }
158
- this.showInnerContent = !this.showInnerContent;
159
- }
160
- /**
161
- * Renders button to expand element.
162
- * @returns expadable button
163
- */
164
- renderExpandableButton() {
165
- if (!this.expandable) {
166
- return null;
167
- }
168
- return (index.h("z-icon", { name: this.showInnerContent
169
- ? this.openElementConfig[this.expandableStyle].open
170
- : this.openElementConfig[this.expandableStyle].close }));
171
- }
172
- /**
173
- * Renders expanded content if element is expandable.
174
- * @returns expanded content
175
- */
176
- renderExpandedContent() {
177
- if (!this.expandable) {
178
- return null;
179
- }
180
- return (index.h("div", { class: {
181
- "z-list-element-inner-container": true,
182
- "expanded": this.showInnerContent,
183
- } }, index.h("slot", { name: "inner-content" })));
184
- }
185
- /**
186
- * Renders content of the z-list-element
187
- * @returns list content
188
- */
189
- renderContent() {
190
- if (this.listType === index$1.ListType.NONE) {
191
- return index.h("slot", null);
192
- }
193
- if (this.listType === index$1.ListType.ORDERED) {
194
- return (index.h("div", { class: "z-list-content-container" }, index.h("div", null, this.listElementPosition, ".\u2003"), index.h("slot", null)));
195
- }
196
- if (this.listType === index$1.ListType.UNORDERED) {
197
- return (index.h("div", { class: "z-list-content-container" }, index.h("span", null, "\u2022\u2003"), index.h("slot", null)));
198
- }
199
- }
200
- render() {
201
- return (index.h(index.Host, { role: "listitem", "aria-expanded": this.expandable ? this.showInnerContent : null, onClick: this.handleClick, onKeyDown: this.handleKeyDown, clickable: this.clickable && !this.disabled, tabIndex: !this.isContextualMenu ? "0" : null }, index.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" }, index.h("div", { class: "z-list-element-container" }, this.renderExpandableButton(), this.renderContent()), this.renderExpandedContent()), this.dividerType === index$1.ListDividerType.ELEMENT && (index.h("z-divider", { color: this.dividerColor, size: this.dividerSize }))));
202
- }
203
- get host() { return index.getElement(this); }
204
- };
205
- ZListElement.style = stylesCss$1;
206
-
207
- const stylesCss = ":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)}";
208
-
209
- const ZListGroup = class {
210
- constructor(hostRef) {
211
- index.registerInstance(this, hostRef);
212
- /**
213
- * [optional] Sets size of inside elements.
214
- */
215
- this.size = index$1.ListSize.MEDIUM;
216
- /**
217
- * [optional] Sets the position where to insert the divider.
218
- */
219
- this.dividerType = index$1.ListDividerType.NONE;
220
- /**
221
- * [optional] Sets the divider size.
222
- */
223
- this.dividerSize = index$1.DividerSize.SMALL;
224
- /**
225
- * [optional] Sets the divider color.
226
- */
227
- this.dividerColor = "gray200";
228
- /**
229
- * [optional] type of the list marker for each element
230
- */
231
- this.listType = index$1.ListType.NONE;
232
- }
233
- componentDidLoad() {
234
- const children = this.host.children;
235
- for (let i = 0; i < children.length; i++) {
236
- if (children.length - 1 > i) {
237
- children[i].setAttribute("divider-type", this.dividerType);
238
- children[i].setAttribute("divider-size", this.dividerSize);
239
- children[i].setAttribute("divider-color", this.dividerColor);
240
- }
241
- children[i].setAttribute("size", this.size);
242
- children[i].setAttribute("list-type", this.listType);
243
- children[i].setAttribute("list-element-position", i.toString());
244
- }
245
- }
246
- componentWillLoad() {
247
- this.hasHeader = !!this.host.querySelector('[slot="header-title"]');
248
- }
249
- render() {
250
- return (index.h(index.Host, { role: "group" }, index.h("div", { class: {
251
- "z-list-group-header-container": true,
252
- "has-header": this.hasHeader,
253
- } }, index.h("slot", { name: "header-title" }), this.dividerType === index$1.ListDividerType.HEADER && (index.h("z-divider", { color: this.dividerColor, size: this.dividerSize }))), index.h("slot", null)));
254
- }
255
- get host() { return index.getElement(this); }
256
- };
257
- ZListGroup.style = stylesCss;
258
-
259
- exports.z_list = ZList;
260
- exports.z_list_element = ZListElement;
261
- exports.z_list_group = ZListGroup;
@@ -1,57 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e3299e0a.js');
6
- const index$1 = require('./index-7a9a8430.js');
7
-
8
- const stylesCss = ".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}";
9
-
10
- const ZOffcanvas = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.canvasOpenStatusChanged = index.createEvent(this, "canvasOpenStatusChanged", 7);
14
- /**
15
- * Offcanvas variant.
16
- * Can be one of "overlay", "pushcontent"
17
- * Default variant: pushcontent
18
- */
19
- this.variant = index$1.OffCanvasVariant.PUSHCONTENT;
20
- /** open component. Default: false */
21
- this.open = false;
22
- /** open content transitioning in a specified direction left | right. Default: left */
23
- this.transitiondirection = index$1.TransitionDirection.LEFT;
24
- /** manages the skip for the entry animation*/
25
- this.skipanimationonload = false;
26
- }
27
- /** this method allows you to skip the page loading animation, to be used with the prop set to true */
28
- async setSkipAanimationOnLoad(value) {
29
- this.skipanimationonload = value;
30
- }
31
- onOpenChanged() {
32
- if (!this.open && this.skipanimationonload) {
33
- this.skipanimationonload = false;
34
- }
35
- if (this.open) {
36
- this.handleOverflowProperty();
37
- }
38
- this.canvasOpenStatusChanged.emit(this.open);
39
- }
40
- handleOverflowProperty() {
41
- const overflow = this.variant === index$1.OffCanvasVariant.OVERLAY ? "overflow-y" : "overflow-x";
42
- document.body.style[overflow] = this.open ? "hidden" : "";
43
- }
44
- handledTransitionEnd() {
45
- this.handleOverflowProperty();
46
- }
47
- render() {
48
- return (index.h(index.Host, { class: { "skip-animation": this.skipanimationonload } }, index.h("div", { role: "presentation", class: "canvas-container", onTransitionEnd: () => this.handledTransitionEnd() }, index.h("div", { role: "presentation", class: "canvas-content" }, index.h("slot", { name: "canvasContent" }))), this.variant == index$1.OffCanvasVariant.OVERLAY && (index.h("div", { class: "canvas-background", "data-action": "canvasBackground", onClick: () => (this.open = false) }))));
49
- }
50
- get hostElement() { return index.getElement(this); }
51
- static get watchers() { return {
52
- "open": ["onOpenChanged"]
53
- }; }
54
- };
55
- ZOffcanvas.style = stylesCss;
56
-
57
- exports.z_offcanvas = ZOffcanvas;
@@ -1,248 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-e3299e0a.js');
6
- const index$1 = require('./index-7a9a8430.js');
7
- const utils = require('./utils-305151da.js');
8
- require('./breakpoints-88c4fd6c.js');
9
-
10
- const stylesCss = ":host{position:relative;z-index:5;display:block;width:inherit;height:44px;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>div{position:absolute;z-index:10;display:grid;width:100%;gap:0 calc(var(--space-unit) * 2);grid-template-columns:auto;grid-template-rows:auto}:host>div.has-submit{grid-template-columns:auto min-content}:host>div.has-results{grid-template-rows:auto auto}:host>div>z-input{width:100%;grid-column:1;grid-row:1}:host>div>z-button{grid-column:2;grid-row:1}:host>div>div.results-wrapper{overflow:auto;padding:calc(var(--space-unit) / 4);padding-bottom:calc(var(--space-unit) / 4);border:var(--border-size-small) solid var(--color-surface03);border-top:none;margin-top:-1px;background:var(--color-surface01);grid-column:1;grid-row:2}:host>div>div.results-wrapper>div.results{overflow:auto;max-height:var(--z-searchbar-results-height, 540px);padding:var(--space-unit) calc(var(--space-unit) * 1.5);padding-bottom:calc(var(--space-unit) / 2);scrollbar-color:var(--color-primary01) transparent}:host>div>div.results-wrapper>div.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)}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-track{background-color:transparent}:host>div>div.results-wrapper>div.results::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}:host>div>div.results-wrapper>div.results .category-heading{display:block;font-size:var(--font-size-2);font-weight:var(--font-rg);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .category-heading>*{display:block}:host>div>div.results-wrapper>div.results span.category-heading>span.category{color:var(--color-text05);font-style:italic}:host>div>div.results-wrapper>div.results span.category-heading>span.subcategory{margin-top:8px;color:var(--color-text01);text-transform:uppercase}:host>div>div.results-wrapper>div.results z-list-element{display:block}:host>div>div.results-wrapper>div.results z-list-element:focus{box-shadow:var(--shadow-focus-primary)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;display:flex;flex-flow:row nowrap;align-content:stretch;align-items:flex-start;justify-content:flex-start;color:var(--color-text01);fill:var(--color-icon02);font-size:var(--font-size-2);line-height:var(--font-size-3)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host>div>div.results-wrapper>div.results .item>span.item-label>mark,:host>div>div.results-wrapper>div.results .item>span.item-label>*>mark{background:var(--color-primary03)}:host>div>div.results-wrapper>div.results .item.has-category{padding-left:calc(var(--space-unit) * 3)}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:2px 0;margin-right:calc(var(--space-unit) * 1.5)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:16px;--z-icon-width:16px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-right:var(--space-unit)}:host>div>div.results-wrapper>div.results .item-show-all{display:block;text-align:center}:host>div>div.results-wrapper>div.results .item-no-results{display:block;font-size:var(--font-size-2);font-style:italic;line-height:var(--font-size-5)}:host>div>div.results-wrapper>div.results .item-no-results>ul{padding-left:calc(var(--space-unit) * 2);margin:var(--space-unit)}@media (min-width: 768px){:host>div>div.results-wrapper>div.results .category-heading{font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item{--z-icon-height:12px;--z-icon-width:12px;font-size:var(--font-size-3);line-height:var(--font-size-6)}:host>div>div.results-wrapper>div.results .item.item-search{--z-icon-height:18px;--z-icon-width:18px}:host>div>div.results-wrapper>div.results .item.item-search>z-icon{margin-top:calc(var(--space-unit) / 4)}:host>div>div.results-wrapper>div.results .item.ellipsis>span.item-label{height:24px}:host>div>div.results-wrapper>div.results .item>z-icon.item-icon{padding:6px 0}}@media (min-width: 1152px){:host>div>div.results-wrapper>div.results .item{cursor:pointer}:host>div>div.results-wrapper>div.results .item-no-results{cursor:default;font-size:var(--font-size-3);line-height:var(--font-size-6)}}:host([size=\"small\"])>div>div.results-wrapper>div.results .item,:host([size=\"x-small\"])>div>div.results-wrapper>div.results .item,:host([size=\"small\"])>div>div.results-wrapper>div.results .category-heading,:host([size=\"x-small\"])>div>div.results-wrapper>div.results .category-heading{font-size:var(--font-size-2)}:host([size=\"small\"])>div>div.results-wrapper>div.results .item:not(.has-category),:host([size=\"x-small\"])>div>div.results-wrapper>div.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}";
11
-
12
- const ZSearchbar = class {
13
- constructor(hostRef) {
14
- index.registerInstance(this, hostRef);
15
- this.searchSubmit = index.createEvent(this, "searchSubmit", 7);
16
- this.searchTyping = index.createEvent(this, "searchTyping", 7);
17
- this.searchItemClick = index.createEvent(this, "searchItemClick", 7);
18
- /** the id of the searchbar element */
19
- this.htmlid = `searchbar-${utils.randomId()}`;
20
- /** Prevent submit action */
21
- this.preventSubmit = false;
22
- /** Show autocomplete results */
23
- this.autocomplete = false;
24
- /** Minimun number of characters to dispatch typing event */
25
- this.autocompleteMinChars = 3;
26
- /** Truncate results to single row */
27
- this.resultsEllipsis = true;
28
- /** Search helper text */
29
- this.searchHelperLabel = "Cerca {searchString}";
30
- /** Sort autocomplete results items */
31
- this.sortResultsItems = false;
32
- /** Show submit button */
33
- this.showSearchButton = false;
34
- /** Set button icon without label*/
35
- this.searchButtonIconOnly = false;
36
- /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
37
- this.size = index$1.ControlSize.BIG;
38
- /** Graphical variant: `primary`, `secondary`, `tertiary`. Defaults to `primary`. */
39
- this.variant = index$1.ButtonVariant.PRIMARY;
40
- this.searchString = "";
41
- this.currResultsCount = 0;
42
- this.showResults = false;
43
- this.resultsItemsList = null;
44
- }
45
- emitSearchSubmit() {
46
- this.searchSubmit.emit(this.inputRef.value);
47
- }
48
- emitSearchTyping(search) {
49
- this.searchTyping.emit(search);
50
- }
51
- emitSearchItemClick(item) {
52
- this.searchItemClick.emit(item);
53
- }
54
- watchItems() {
55
- this.resultsItemsList = this.getResultsItemsList();
56
- }
57
- watchResultsCount() {
58
- this.currResultsCount = this.resultsCount;
59
- }
60
- watchValue() {
61
- this.handleInput(this.value);
62
- }
63
- watchSearchString() {
64
- this.emitSearchTyping(this.searchString);
65
- if (!this.searchString) {
66
- this.currResultsCount = this.resultsCount;
67
- }
68
- }
69
- clickListener(e) {
70
- this.handleOutsideClick(e);
71
- }
72
- componentWillLoad() {
73
- this.resultsItemsList = this.getResultsItemsList();
74
- this.currResultsCount = this.resultsCount;
75
- this.handleInput(this.value);
76
- }
77
- getResultsItemsList() {
78
- return typeof this.resultsItems === "string" ? JSON.parse(this.resultsItems) : this.resultsItems;
79
- }
80
- getGroupedItems(items) {
81
- const groupedItems = {};
82
- items.forEach((item) => {
83
- var _a;
84
- const key = `${item === null || item === void 0 ? void 0 : item.category}${item === null || item === void 0 ? void 0 : item.subcategory}`;
85
- groupedItems[key] = (_a = groupedItems[key]) !== null && _a !== void 0 ? _a : {
86
- category: item === null || item === void 0 ? void 0 : item.category,
87
- subcategory: item === null || item === void 0 ? void 0 : item.subcategory,
88
- items: [],
89
- };
90
- groupedItems[key]["items"].push(item);
91
- });
92
- if (this.sortResultsItems) {
93
- return Object.keys(groupedItems)
94
- .sort()
95
- .reduce((obj, key) => {
96
- obj[key] = Object.assign(Object.assign({}, groupedItems[key]), { items: groupedItems[key]["items"].sort((a, b) => {
97
- const nameA = a.label.toUpperCase();
98
- const nameB = b.label.toUpperCase();
99
- if (nameA < nameB) {
100
- return -1;
101
- }
102
- if (nameA > nameB) {
103
- return 1;
104
- }
105
- return 0;
106
- }) });
107
- return obj;
108
- }, {});
109
- }
110
- return groupedItems;
111
- }
112
- checkResultsCount(counter) {
113
- if (!this.currResultsCount || counter < this.currResultsCount) {
114
- return true;
115
- }
116
- return false;
117
- }
118
- handleStopTyping(e) {
119
- e.stopPropagation();
120
- this.handleInput(e.detail.value);
121
- }
122
- handleInput(value) {
123
- if ((value === null || value === void 0 ? void 0 : value.length) >= this.autocompleteMinChars) {
124
- this.searchString = value;
125
- }
126
- else if (this.searchString) {
127
- this.searchString = "";
128
- }
129
- }
130
- handleSubmit() {
131
- if (this.preventSubmit) {
132
- return;
133
- }
134
- this.emitSearchSubmit();
135
- }
136
- handleOutsideClick(e) {
137
- const cp = e.composedPath();
138
- const searchbar = cp.find((elem) => elem.nodeName === "Z-SEARCHBAR");
139
- if (!searchbar || searchbar.htmlid !== this.htmlid) {
140
- this.showResults = false;
141
- return;
142
- }
143
- 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")); })) {
144
- this.showResults = true;
145
- return;
146
- }
147
- this.showResults = false;
148
- }
149
- renderInput() {
150
- return (index.h("z-input", { ref: (val) => {
151
- this.inputRef = val;
152
- }, message: false, placeholder: this.placeholder, onStopTyping: (e) => this.handleStopTyping(e), onKeyUp: (e) => utils.handleEnterKeydSubmit(e, () => this.handleSubmit()), value: this.value, size: this.size }));
153
- }
154
- renderButton() {
155
- if (!this.showSearchButton) {
156
- return null;
157
- }
158
- const iconProp = this.searchButtonIconOnly ? { icon: "search" } : null;
159
- const buttonLabel = this.searchButtonIconOnly ? "" : "CERCA";
160
- const defaultProps = Object.assign({ disabled: this.preventSubmit, variant: this.variant, size: this.size, onClick: () => this.handleSubmit() }, iconProp);
161
- return index.h("z-button", Object.assign({}, defaultProps), buttonLabel);
162
- }
163
- renderResults() {
164
- if (!this.showResults ||
165
- !this.autocomplete ||
166
- !this.searchString ||
167
- this.searchString.length < this.autocompleteMinChars ||
168
- !this.resultsItemsList) {
169
- return null;
170
- }
171
- return (index.h("div", { class: "results-wrapper" }, index.h("div", { class: "results" }, this.renderResultsList())));
172
- }
173
- renderResultsList() {
174
- var _a, _b;
175
- if (this.preventSubmit && !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
176
- return (index.h("span", { class: "item item-no-results" }, "Non abbiamo trovato risultati per ", index.h("b", null, this.searchString), index.h("br", null), index.h("br", null), "Cosa puoi fare?", index.h("ul", null, index.h("li", null, "Verificare di aver scritto bene"), index.h("li", null, "Provare a cercare un'altra parola"), index.h("li", null, "Provare a cercare qualcosa di pi\u00F9 generico"))));
177
- }
178
- return (index.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()));
179
- }
180
- renderItems() {
181
- var _a;
182
- if (!((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length)) {
183
- return [];
184
- }
185
- const groupedItems = this.getGroupedItems(this.resultsItemsList);
186
- const listGroups = [];
187
- let counter = 0;
188
- Object.values(groupedItems).forEach((groupItem, index$2, array) => {
189
- if (this.checkResultsCount(counter)) {
190
- const listGroupsElements = [];
191
- groupItem.items.forEach((item, subindex, subarray) => {
192
- if (this.checkResultsCount(counter)) {
193
- const isLast = index$2 === array.length - 1 && subindex === subarray.length - 1;
194
- listGroupsElements.push(this.renderItem(item, subindex, !isLast));
195
- }
196
- counter++;
197
- });
198
- if (listGroupsElements.length) {
199
- listGroups.push(index.h("z-list-group", { "divider-type": index$1.ListDividerType.ELEMENT }, this.renderItemCategory(groupItem), listGroupsElements));
200
- }
201
- }
202
- });
203
- return listGroups;
204
- }
205
- renderItem(item, key, divider) {
206
- return (index.h("z-list-element", { id: `list-item-${this.htmlid}-${key}`, role: "option", tabindex: 0, dividerType: divider ? index$1.ListDividerType.ELEMENT : undefined, clickable: true, onClickItem: () => this.emitSearchItemClick(item) }, index.h("span", { class: { "item": true, "ellipsis": this.resultsEllipsis, "has-category": !!item.category } }, (item === null || item === void 0 ? void 0 : item.icon) && (index.h("z-icon", { class: "item-icon", name: item.icon })), index.h("span", { class: "item-label", title: item.label, innerHTML: this.renderItemLabel(item.label) }))));
207
- }
208
- renderItemLabel(label) {
209
- if (!this.searchString) {
210
- return label;
211
- }
212
- return label.replace(new RegExp(this.searchString.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gmi"), (found) => `<mark>${found}</mark>`);
213
- }
214
- renderItemCategory(groupItem) {
215
- if (!(groupItem === null || groupItem === void 0 ? void 0 : groupItem.category)) {
216
- return null;
217
- }
218
- return (index.h("span", { class: "category-heading", slot: "header-title" }, index.h("span", { class: "category" }, groupItem.category), (groupItem === null || groupItem === void 0 ? void 0 : groupItem.subcategory) && index.h("span", { class: "subcategory" }, groupItem.subcategory)));
219
- }
220
- renderSearchHelper(hasDivider = true) {
221
- if (!this.autocomplete || this.preventSubmit || !this.searchString) {
222
- return null;
223
- }
224
- return (index.h("z-list-element", { role: "option", tabindex: 0, dividerType: hasDivider ? index$1.ListDividerType.ELEMENT : undefined, clickable: true, id: `list-item-${this.htmlid}-search`, onClickItem: () => this.emitSearchSubmit() }, index.h("span", { class: "item item-search" }, index.h("z-icon", { class: "search-icon", name: "left-magnifying-glass" }), index.h("span", { class: "item-label", innerHTML: this.searchHelperLabel.replace("{searchString}", `<mark>${this.searchString}</mark>`) }))));
225
- }
226
- renderShowAllResults() {
227
- var _a, _b;
228
- if (!this.currResultsCount ||
229
- !this.searchString ||
230
- !((_a = this.resultsItemsList) === null || _a === void 0 ? void 0 : _a.length) ||
231
- this.currResultsCount >= ((_b = this.resultsItemsList) === null || _b === void 0 ? void 0 : _b.length)) {
232
- return null;
233
- }
234
- return (index.h("z-list-element", { role: "option", tabindex: 0, clickable: true, id: `list-item-${this.htmlid}-show-all`, onClickItem: () => (this.currResultsCount = 0) }, index.h("span", { class: "item-show-all" }, index.h("z-link", null, "Vedi tutti i risultati"))));
235
- }
236
- render() {
237
- return (index.h(index.Host, { onFocus: () => (this.showResults = true), onClick: (e) => this.handleOutsideClick(e) }, index.h("div", { class: { "has-submit": this.showSearchButton, "has-results": this.autocomplete } }, this.renderInput(), this.renderResults(), this.renderButton())));
238
- }
239
- static get watchers() { return {
240
- "resultsItems": ["watchItems"],
241
- "resultsCount": ["watchResultsCount"],
242
- "value": ["watchValue"],
243
- "searchString": ["watchSearchString"]
244
- }; }
245
- };
246
- ZSearchbar.style = stylesCss;
247
-
248
- exports.z_searchbar = ZSearchbar;