@zanichelli/albe-web-components 18.6.1 → 18.6.3-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 (187) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/dist/cjs/{index-c48948bf.js → index-0d3de93e.js} +2 -2
  3. package/dist/cjs/{index-c48948bf.js.map → index-0d3de93e.js.map} +1 -1
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{utils-93961cb6.js → utils-3dc316f8.js} +56 -1
  7. package/dist/cjs/utils-3dc316f8.js.map +1 -0
  8. package/dist/cjs/web-components-library.cjs.js +1 -1
  9. package/dist/cjs/z-anchor-navigation.cjs.entry.js +1 -1
  10. package/dist/cjs/z-anchor-navigation.cjs.entry.js.map +1 -1
  11. package/dist/cjs/z-app-header_12.cjs.entry.js +1 -1
  12. package/dist/cjs/z-book-card-deprecated.cjs.entry.js +1 -1
  13. package/dist/cjs/z-breadcrumb.cjs.entry.js +1 -1
  14. package/dist/cjs/z-card.cjs.entry.js +1 -1
  15. package/dist/cjs/z-card.cjs.entry.js.map +1 -1
  16. package/dist/cjs/z-combobox.cjs.entry.js +1 -1
  17. package/dist/cjs/z-menu.cjs.entry.js +1 -1
  18. package/dist/cjs/z-myz-card-info.cjs.entry.js +1 -1
  19. package/dist/cjs/z-myz-list-item.cjs.entry.js +1 -1
  20. package/dist/cjs/z-popover.cjs.entry.js +232 -264
  21. package/dist/cjs/z-popover.cjs.entry.js.map +1 -1
  22. package/dist/cjs/z-select.cjs.entry.js +4 -6
  23. package/dist/cjs/z-select.cjs.entry.js.map +1 -1
  24. package/dist/cjs/z-skip-to-content.cjs.entry.js +1 -1
  25. package/dist/cjs/z-slideshow.cjs.entry.js +1 -1
  26. package/dist/cjs/z-table.cjs.entry.js +2 -2
  27. package/dist/cjs/z-toggle-switch.cjs.entry.js +1 -1
  28. package/dist/cjs/z-tr.cjs.entry.js +2 -2
  29. package/dist/collection/components/z-anchor-navigation/index.js +2 -2
  30. package/dist/collection/components/z-anchor-navigation/index.js.map +1 -1
  31. package/dist/collection/components/z-card/styles.css +4 -0
  32. package/dist/collection/components/z-popover/index.js +236 -268
  33. package/dist/collection/components/z-popover/index.js.map +1 -1
  34. package/dist/collection/components/z-popover/index.stories.js +92 -45
  35. package/dist/collection/components/z-popover/index.stories.js.map +1 -1
  36. package/dist/collection/components/z-popover/styles.css +4 -14
  37. package/dist/collection/components/z-select/index.js +4 -6
  38. package/dist/collection/components/z-select/index.js.map +1 -1
  39. package/dist/collection/utils/utils.js +53 -0
  40. package/dist/collection/utils/utils.js.map +1 -1
  41. package/dist/components/index23.js +234 -266
  42. package/dist/components/index23.js.map +1 -1
  43. package/dist/components/index24.js +1 -1
  44. package/dist/components/utils.js +55 -2
  45. package/dist/components/utils.js.map +1 -1
  46. package/dist/components/z-anchor-navigation.js +2 -2
  47. package/dist/components/z-anchor-navigation.js.map +1 -1
  48. package/dist/components/z-card.js +1 -1
  49. package/dist/components/z-card.js.map +1 -1
  50. package/dist/components/z-select.js +4 -6
  51. package/dist/components/z-select.js.map +1 -1
  52. package/dist/esm/{index-10473b87.js → index-328b69a7.js} +2 -2
  53. package/dist/esm/{index-10473b87.js.map → index-328b69a7.js.map} +1 -1
  54. package/dist/esm/index.js +1 -1
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/{utils-c8abef2f.js → utils-6e2be2b6.js} +55 -2
  57. package/dist/esm/utils-6e2be2b6.js.map +1 -0
  58. package/dist/esm/web-components-library.js +1 -1
  59. package/dist/esm/z-anchor-navigation.entry.js +2 -2
  60. package/dist/esm/z-anchor-navigation.entry.js.map +1 -1
  61. package/dist/esm/z-app-header_12.entry.js +1 -1
  62. package/dist/esm/z-book-card-deprecated.entry.js +1 -1
  63. package/dist/esm/z-breadcrumb.entry.js +1 -1
  64. package/dist/esm/z-card.entry.js +1 -1
  65. package/dist/esm/z-card.entry.js.map +1 -1
  66. package/dist/esm/z-combobox.entry.js +1 -1
  67. package/dist/esm/z-menu.entry.js +1 -1
  68. package/dist/esm/z-myz-card-info.entry.js +1 -1
  69. package/dist/esm/z-myz-list-item.entry.js +1 -1
  70. package/dist/esm/z-popover.entry.js +233 -265
  71. package/dist/esm/z-popover.entry.js.map +1 -1
  72. package/dist/esm/z-select.entry.js +4 -6
  73. package/dist/esm/z-select.entry.js.map +1 -1
  74. package/dist/esm/z-skip-to-content.entry.js +1 -1
  75. package/dist/esm/z-slideshow.entry.js +1 -1
  76. package/dist/esm/z-table.entry.js +2 -2
  77. package/dist/esm/z-toggle-switch.entry.js +1 -1
  78. package/dist/esm/z-tr.entry.js +2 -2
  79. package/dist/types/components/z-popover/index.d.ts +47 -45
  80. package/dist/types/components/z-popover/index.stories.d.ts +18 -7
  81. package/dist/types/components.d.ts +13 -17
  82. package/dist/types/utils/utils.d.ts +17 -0
  83. package/dist/web-components-library/index.esm.js +1 -1
  84. package/dist/web-components-library/{p-8b93bc6d.entry.js → p-01302e57.entry.js} +2 -2
  85. package/dist/web-components-library/{p-14f0bdf4.entry.js → p-1ad8810a.entry.js} +2 -2
  86. package/{www/build/p-c2ba8a6c.entry.js → dist/web-components-library/p-2e0923bd.entry.js} +2 -2
  87. package/dist/web-components-library/p-3284e37b.entry.js +2 -0
  88. package/dist/web-components-library/{p-61f76cab.js → p-43bc482a.js} +2 -2
  89. package/{www/build/p-2fb52cd0.entry.js → dist/web-components-library/p-539f99db.entry.js} +2 -2
  90. package/dist/web-components-library/p-625e2cee.js +2 -0
  91. package/dist/web-components-library/p-625e2cee.js.map +1 -0
  92. package/dist/web-components-library/p-62e1d867.entry.js +2 -0
  93. package/dist/web-components-library/p-62e1d867.entry.js.map +1 -0
  94. package/dist/web-components-library/p-63d220da.entry.js +2 -0
  95. package/dist/web-components-library/{p-8d5e3396.entry.js.map → p-63d220da.entry.js.map} +1 -1
  96. package/dist/web-components-library/{p-c8814ae1.entry.js → p-7916e0f7.entry.js} +2 -2
  97. package/{www/build/p-f5efb3fc.entry.js → dist/web-components-library/p-8bd4a2aa.entry.js} +2 -2
  98. package/dist/web-components-library/{p-c962e854.entry.js → p-8dec332e.entry.js} +2 -2
  99. package/dist/web-components-library/{p-72a7eb26.entry.js → p-966cbf03.entry.js} +2 -2
  100. package/{www/build/p-30575221.entry.js → dist/web-components-library/p-a0ed0c63.entry.js} +2 -2
  101. package/dist/web-components-library/p-b7b972c0.entry.js +2 -0
  102. package/dist/web-components-library/p-b7b972c0.entry.js.map +1 -0
  103. package/dist/web-components-library/{p-25935be3.entry.js → p-bc2f94d9.entry.js} +2 -2
  104. package/dist/web-components-library/{p-57b8bd19.entry.js → p-db9b7eb5.entry.js} +2 -2
  105. package/dist/web-components-library/p-db9b7eb5.entry.js.map +1 -0
  106. package/dist/web-components-library/p-df04a63e.entry.js +2 -0
  107. package/dist/web-components-library/p-df04a63e.entry.js.map +1 -0
  108. package/dist/web-components-library/web-components-library.esm.js +1 -1
  109. package/dist/web-components-library/web-components-library.esm.js.map +1 -1
  110. package/package.json +1 -1
  111. package/www/build/index.esm.js +1 -1
  112. package/www/build/{p-8b93bc6d.entry.js → p-01302e57.entry.js} +2 -2
  113. package/www/build/{p-14f0bdf4.entry.js → p-1ad8810a.entry.js} +2 -2
  114. package/{dist/web-components-library/p-c2ba8a6c.entry.js → www/build/p-2e0923bd.entry.js} +2 -2
  115. package/www/build/p-3284e37b.entry.js +2 -0
  116. package/www/build/{p-61f76cab.js → p-43bc482a.js} +2 -2
  117. package/{dist/web-components-library/p-2fb52cd0.entry.js → www/build/p-539f99db.entry.js} +2 -2
  118. package/www/build/p-625e2cee.js +2 -0
  119. package/www/build/p-625e2cee.js.map +1 -0
  120. package/www/build/p-62e1d867.entry.js +2 -0
  121. package/www/build/p-62e1d867.entry.js.map +1 -0
  122. package/www/build/p-63d220da.entry.js +2 -0
  123. package/www/build/{p-8d5e3396.entry.js.map → p-63d220da.entry.js.map} +1 -1
  124. package/www/build/{p-c8814ae1.entry.js → p-7916e0f7.entry.js} +2 -2
  125. package/{dist/web-components-library/p-f5efb3fc.entry.js → www/build/p-8bd4a2aa.entry.js} +2 -2
  126. package/www/build/{p-c962e854.entry.js → p-8dec332e.entry.js} +2 -2
  127. package/www/build/{p-72a7eb26.entry.js → p-966cbf03.entry.js} +2 -2
  128. package/{dist/web-components-library/p-30575221.entry.js → www/build/p-a0ed0c63.entry.js} +2 -2
  129. package/www/build/p-b7b972c0.entry.js +2 -0
  130. package/www/build/p-b7b972c0.entry.js.map +1 -0
  131. package/www/build/{p-25935be3.entry.js → p-bc2f94d9.entry.js} +2 -2
  132. package/www/build/{p-adc42c6f.js → p-c2d3e81c.js} +1 -1
  133. package/www/build/{p-57b8bd19.entry.js → p-db9b7eb5.entry.js} +2 -2
  134. package/www/build/p-db9b7eb5.entry.js.map +1 -0
  135. package/www/build/p-df04a63e.entry.js +2 -0
  136. package/www/build/p-df04a63e.entry.js.map +1 -0
  137. package/www/build/web-components-library.esm.js +1 -1
  138. package/www/build/web-components-library.esm.js.map +1 -1
  139. package/www/index.html +1 -1
  140. package/dist/cjs/utils-93961cb6.js.map +0 -1
  141. package/dist/esm/utils-c8abef2f.js.map +0 -1
  142. package/dist/web-components-library/p-37f271c8.entry.js +0 -2
  143. package/dist/web-components-library/p-37f271c8.entry.js.map +0 -1
  144. package/dist/web-components-library/p-57b8bd19.entry.js.map +0 -1
  145. package/dist/web-components-library/p-69a1a67a.entry.js +0 -2
  146. package/dist/web-components-library/p-8d5e3396.entry.js +0 -2
  147. package/dist/web-components-library/p-a06fbbc0.js +0 -2
  148. package/dist/web-components-library/p-a06fbbc0.js.map +0 -1
  149. package/dist/web-components-library/p-da30a6cb.entry.js +0 -2
  150. package/dist/web-components-library/p-da30a6cb.entry.js.map +0 -1
  151. package/dist/web-components-library/p-e1a80453.entry.js +0 -2
  152. package/dist/web-components-library/p-e1a80453.entry.js.map +0 -1
  153. package/www/build/p-37f271c8.entry.js +0 -2
  154. package/www/build/p-37f271c8.entry.js.map +0 -1
  155. package/www/build/p-57b8bd19.entry.js.map +0 -1
  156. package/www/build/p-69a1a67a.entry.js +0 -2
  157. package/www/build/p-8d5e3396.entry.js +0 -2
  158. package/www/build/p-a06fbbc0.js +0 -2
  159. package/www/build/p-a06fbbc0.js.map +0 -1
  160. package/www/build/p-da30a6cb.entry.js +0 -2
  161. package/www/build/p-da30a6cb.entry.js.map +0 -1
  162. package/www/build/p-e1a80453.entry.js +0 -2
  163. package/www/build/p-e1a80453.entry.js.map +0 -1
  164. /package/dist/web-components-library/{p-8b93bc6d.entry.js.map → p-01302e57.entry.js.map} +0 -0
  165. /package/dist/web-components-library/{p-14f0bdf4.entry.js.map → p-1ad8810a.entry.js.map} +0 -0
  166. /package/dist/web-components-library/{p-c2ba8a6c.entry.js.map → p-2e0923bd.entry.js.map} +0 -0
  167. /package/dist/web-components-library/{p-69a1a67a.entry.js.map → p-3284e37b.entry.js.map} +0 -0
  168. /package/dist/web-components-library/{p-61f76cab.js.map → p-43bc482a.js.map} +0 -0
  169. /package/dist/web-components-library/{p-2fb52cd0.entry.js.map → p-539f99db.entry.js.map} +0 -0
  170. /package/dist/web-components-library/{p-c8814ae1.entry.js.map → p-7916e0f7.entry.js.map} +0 -0
  171. /package/dist/web-components-library/{p-f5efb3fc.entry.js.map → p-8bd4a2aa.entry.js.map} +0 -0
  172. /package/dist/web-components-library/{p-c962e854.entry.js.map → p-8dec332e.entry.js.map} +0 -0
  173. /package/dist/web-components-library/{p-72a7eb26.entry.js.map → p-966cbf03.entry.js.map} +0 -0
  174. /package/dist/web-components-library/{p-30575221.entry.js.map → p-a0ed0c63.entry.js.map} +0 -0
  175. /package/dist/web-components-library/{p-25935be3.entry.js.map → p-bc2f94d9.entry.js.map} +0 -0
  176. /package/www/build/{p-8b93bc6d.entry.js.map → p-01302e57.entry.js.map} +0 -0
  177. /package/www/build/{p-14f0bdf4.entry.js.map → p-1ad8810a.entry.js.map} +0 -0
  178. /package/www/build/{p-c2ba8a6c.entry.js.map → p-2e0923bd.entry.js.map} +0 -0
  179. /package/www/build/{p-69a1a67a.entry.js.map → p-3284e37b.entry.js.map} +0 -0
  180. /package/www/build/{p-61f76cab.js.map → p-43bc482a.js.map} +0 -0
  181. /package/www/build/{p-2fb52cd0.entry.js.map → p-539f99db.entry.js.map} +0 -0
  182. /package/www/build/{p-c8814ae1.entry.js.map → p-7916e0f7.entry.js.map} +0 -0
  183. /package/www/build/{p-f5efb3fc.entry.js.map → p-8bd4a2aa.entry.js.map} +0 -0
  184. /package/www/build/{p-c962e854.entry.js.map → p-8dec332e.entry.js.map} +0 -0
  185. /package/www/build/{p-72a7eb26.entry.js.map → p-966cbf03.entry.js.map} +0 -0
  186. /package/www/build/{p-30575221.entry.js.map → p-a0ed0c63.entry.js.map} +0 -0
  187. /package/www/build/{p-25935be3.entry.js.map → p-bc2f94d9.entry.js.map} +0 -0
@@ -1,2 +0,0 @@
1
- import{r as t,c as e,h as o,a as r,g as s}from"./p-75c4a726.js";import{P as i,g as n}from"./p-17af7fb2.js";const a=':host{position:absolute;display:none;min-width:calc(var(--space-unit) * 8);max-width:100%;min-height:calc(var(--space-unit) * 4);max-height:100%;align-items:center;justify-content:center;padding:var(--z-popover-padding, 0);background:var(--z-popover-theme--surface, var(--color-surface01));border-radius:var(--border-radius-small);color:var(--z-popover-theme--text, var(--color-default-text));fill:currentcolor;filter:var(--z-popover-shadow-filter, drop-shadow(0 1px 2px var(--shadow-color-base)));font-family:var(--font-family-sans);text-align:center}:host([open]:not([current-position])){visibility:hidden}:host([open][current-position]),:host([open="true"][current-position]){display:flex}:host([center][current-position="top"]),:host([center][current-position="bottom"]){transform:translateX(-50%)}:host([center][current-position="right"]),:host([center][current-position="left"]){transform:translateY(-50%)}:host([current-position^="top"]){margin:0 0 var(--space-unit)}:host([current-position^="bottom"]){margin:var(--space-unit) 0 0}:host([current-position^="left"]){margin:0 var(--space-unit) 0 0}:host([current-position^="right"]){margin:0 0 0 var(--space-unit)}:host([current-position])::before{--arrow-size:6px;--arrow-edge-offset:calc(100% - var(--space-unit) - (var(--arrow-size) / 2));--arrow-center-x-offset:calc(50% - (var(--arrow-size) / 2));--arrow-center-y-offset:calc(100% - (var(--arrow-size) / 2));position:absolute;display:block;width:var(--arrow-size);height:var(--arrow-size);background:var(--z-popover-theme--surface, var(--color-surface01));content:"";transform:rotate(45deg)}:host([show-arrow="false"])::before,:host(:not([show-arrow]))::before{display:none}:host([current-position^="top"])::before{top:var(--arrow-center-y-offset)}:host([current-position^="bottom"])::before{bottom:var(--arrow-center-y-offset)}:host([current-position="top"])::before,:host([current-position="bottom"])::before{right:var(--arrow-edge-offset)}:host([current-position="right"])::before,:host([current-position="left"])::before{bottom:var(--arrow-edge-offset)}:host([current-position="right"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left"])::before{left:var(--arrow-center-y-offset)}:host([current-position="top_right"])::before,:host([current-position="bottom_right"])::before{right:var(--arrow-edge-offset)}:host([current-position="top_left"])::before,:host([current-position="bottom_left"])::before{left:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="left_top"])::before{top:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="right_bottom"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left_top"])::before,:host([current-position="left_bottom"])::before{left:var(--arrow-center-y-offset)}:host([current-position="right_bottom"])::before,:host([current-position="left_bottom"])::before{bottom:var(--arrow-edge-offset)}:host([center][current-position="top"])::before,:host([center][current-position="bottom"])::before{right:auto;left:var(--arrow-center-x-offset)}:host([center][current-position="right"])::before,:host([center][current-position="left"])::before{top:var(--arrow-center-x-offset);bottom:auto}::slotted(*){overflow:auto;flex:1 auto}';const c=a;const h=document.documentElement;function f(t){if(t.parentNode===t.shadowRoot){return t.shadowRoot.host}return t.parentElement}function p(t){let e=f(t);while(e&&e!==h){const t=window.getComputedStyle(e);const{overflow:o,overflowX:r,overflowY:s}=t;if(o==="hidden"||s==="hidden"||r==="hidden"){return e}const i=o!=="visible";const n=s!=="visible";const a=r!=="visible";if(e.scrollHeight>e.clientHeight&&i&&n||e.scrollWidth>e.clientWidth&&i&&a){return e}e=f(e)}return h}function u(t,e){const o=t.getBoundingClientRect();const{width:r,height:s}=o;let i=0;let n=0;let a=t;while(a&&a!==e){n+=a.offsetLeft;if(a===document.body){i+=a.getBoundingClientRect().top+window.scrollY}else{i+=a.offsetTop}if(window.DOMMatrix){const t=window.getComputedStyle(a);const{transform:e}=t;if(e&&e!=="none"){const t=new DOMMatrix(e);n+=t.m41;if(a!==document.body){i+=t.m42}}}if(!a.offsetParent){break}a=a.offsetParent}let c;let h;if(a===document.body){c=window.innerWidth;h=window.innerHeight}else{c=a.offsetWidth;h=a.offsetHeight}const f=c-n-r;const p=h-i-s;return{top:i,right:f,bottom:p,left:n,width:r,height:s}}const l=class{constructor(o){t(this,o);this.positionChange=e(this,"positionChange",7);this.openChange=e(this,"openChange",7);this.spaceTolerance=3;this.position=i.TOP;this.open=false;this.bindTo=undefined;this.showArrow=false;this.center=false;this.closable=true;this.currentPosition=undefined}closePopoverWithKeyboard(t){if(this.closable&&t.key===n.ESC){this.open=false}}handleOutsideClick(t){if(!this.closable||!this.open){return}const e=t.composedPath();if(!e.includes(this.host)){const e=t.target;let o=false;if(typeof this.bindTo==="string"){o=!!e.closest(this.bindTo)}else if(this.bindTo){o=this.bindTo.contains(e)}if(o){t.stopPropagation()}this.open=false;this.positionChange.emit({position:this.currentPosition})}}validatePosition(t){if(!Object.values(i).includes(t)||t===i.AUTO){t=i.TOP}this.position=t;this.currentPosition=t;this.positionChange.emit({position:this.currentPosition});this.setPosition()}onOpen(){cancelAnimationFrame(this.animationFrameRequestId);if(this.open){const t=()=>{if(this.open){this.setPosition();this.animationFrameRequestId=requestAnimationFrame(t)}};setTimeout((()=>{t()}),0)}this.openChange.emit({open:this.open})}hasCenteredHorizontalSpace(t,e,o,r,s){const i=(o-r)*(1-s);return t>=i-this.spaceTolerance&&e>=i-this.spaceTolerance}hasCenteredVerticalSpace(t,e,o,r,s){const i=(o-r)*(1-s);return t>=i-this.spaceTolerance&&e>=i-this.spaceTolerance}hasOffsetSpace(t,e,o,r){return t>=e-o*(1-r)-this.spaceTolerance}getOptimalPopoverPosition(t,e,o,r){const s=this.host.offsetWidth;const n=this.host.offsetHeight;const a=t=>{switch(t){case i.TOP:return e.top>=n&&this.hasCenteredHorizontalSpace(e.left,e.right,s,o.width,r);case i.TOP_RIGHT:return e.top>=n&&this.hasOffsetSpace(e.right,s,o.width,r);case i.TOP_LEFT:return e.top>=n&&this.hasOffsetSpace(e.left,s,o.width,r);case i.RIGHT:return e.right>=s&&this.hasCenteredVerticalSpace(e.top,e.bottom,n,o.height,r);case i.RIGHT_BOTTOM:return e.right>=s&&this.hasOffsetSpace(e.bottom,n,o.height,r);case i.RIGHT_TOP:return e.right>=s&&this.hasOffsetSpace(e.top,n,o.height,r);case i.BOTTOM:return e.bottom>=n&&this.hasCenteredHorizontalSpace(e.left,e.right,s,o.width,r);case i.BOTTOM_LEFT:return e.bottom>=n&&this.hasOffsetSpace(e.left,s,o.width,r);case i.BOTTOM_RIGHT:return e.bottom>=n&&this.hasOffsetSpace(e.right,s,o.width,r);case i.LEFT:return e.left>=s&&this.hasCenteredVerticalSpace(e.top,e.bottom,n,o.height,r);case i.LEFT_TOP:return e.left>=s&&this.hasOffsetSpace(e.top,n,o.height,r);case i.LEFT_BOTTOM:return e.left>=s&&this.hasOffsetSpace(e.bottom,n,o.height,r);default:return false}};if(a(t)){return t}const c=l.positionOrder;const h=c.indexOf(t);if(h===-1){return t}for(let t=1;t<c.length;t++){const e=(h+t)%c.length;const o=c[e];if(a(o)){return o}}return this.findBestFallbackPosition(e)}findBestFallbackPosition(t){const e=t.right>=t.left?i.RIGHT:i.LEFT;const o=t.bottom>=t.top?i.BOTTOM:i.TOP;const r=Math.max(t.right,t.left);const s=Math.max(t.bottom,t.top);const n=s>=r?o:e;let a=false;if(n===o){const e=Math.min(t.right,t.left);a=r>=e*2}else{const e=Math.min(t.bottom,t.top);a=s>=e*2}if(!a){return n}const c=n===o?e:o;return`${n}_${c}`}calculateAvailableSpace(t,e,o){const r=t.top-e.scrollTop;const s=o.height-(t.top+t.height)+e.scrollTop;const i=t.left-e.scrollLeft;const n=o.width-(t.left+t.width)+e.scrollLeft;const a=Math.max(0,o.top+o.height-window.innerHeight);const c=Math.max(0,o.left+o.width-window.innerWidth);return{top:Math.min(r,r+o.top),bottom:Math.min(s,s-a),left:Math.min(i,i+o.left),right:Math.min(n,n-c)}}calculateRelativeOffsets(t,e){return{top:t.top-e.top,right:t.right-e.right,bottom:t.bottom-e.bottom,left:t.left-e.left}}applyPositionStyles(t,e,o,r,s,n,a){const c=8;e.top="auto";e.right="auto";e.bottom="auto";e.left="auto";e.maxWidth="";e.maxHeight="";switch(t){case i.TOP:case i.TOP_RIGHT:e.bottom=`${o.bottom+r.height}px`;e.left=`${o.left+r.width*n-(t===i.TOP_RIGHT?a:0)}px`;e.maxHeight=`${s.top-c}px`;if(t===i.TOP_RIGHT){e.maxWidth=`${s.right+r.width*n}px`}break;case i.TOP_LEFT:e.right=`${o.right+r.width*n-a}px`;e.bottom=`${o.bottom+r.height}px`;e.maxWidth=`${s.left}px`;e.maxHeight=`${s.top-c}px`;break;case i.BOTTOM:case i.BOTTOM_RIGHT:e.top=`${o.top+r.height}px`;e.left=`${o.left+r.width*n-(t===i.BOTTOM_RIGHT?a:0)}px`;e.maxHeight=`${s.bottom-c}px`;if(t===i.BOTTOM_RIGHT){e.maxWidth=`${s.right+r.width*n}px`}break;case i.BOTTOM_LEFT:e.top=`${o.top+r.height}px`;e.right=`${o.right+r.width*n-a}px`;e.maxWidth=`${s.left}px`;e.maxHeight=`${s.bottom-c}px`;break;case i.RIGHT:case i.RIGHT_BOTTOM:e.top=`${o.top+r.height*n-(t===i.RIGHT_BOTTOM?a:0)}px`;e.left=`${o.left+r.width}px`;e.maxWidth=`${s.right-c}px`;if(t===i.RIGHT){e.maxHeight=`${Math.min(s.top+s.bottom+r.height,window.innerHeight-20)}px`}else{e.maxHeight=`${s.bottom+r.height*n}px`}break;case i.RIGHT_TOP:e.bottom=`${o.bottom+r.height*n-a}px`;e.left=`${o.left+r.width}px`;e.maxWidth=`${s.right-c}px`;if(t===i.RIGHT_TOP){e.maxHeight=`${s.top+r.height*n}px`}break;case i.LEFT:case i.LEFT_BOTTOM:e.top=`${o.top+r.height*n-(t===i.LEFT_BOTTOM?a:0)}px`;e.right=`${o.right+r.width}px`;e.maxWidth=`${s.left-c}px`;if(t===i.LEFT_BOTTOM){e.maxHeight=`${s.bottom+r.height*n}px`}break;case i.LEFT_TOP:e.right=`${o.right+r.width}px`;e.bottom=`${o.bottom+r.height*n-a}px`;e.maxWidth=`${s.left-c}px`;if(t===i.LEFT_TOP){e.maxHeight=`${s.top+r.height*n}px`}break}}setPosition(){let t;if(typeof this.bindTo==="string"){t=this.host.ownerDocument.querySelector(this.bindTo)}else if(this.bindTo){t=this.bindTo}else{t=this.host.parentElement}if(!t){return}const e=p(t);const o=e.getBoundingClientRect();const r=this.host.offsetParent;const s=r?u(r,e):{top:0,right:0,bottom:0,left:0};const i=u(t,e);const n=this.calculateAvailableSpace(i,e,o);const a=this.calculateRelativeOffsets(i,s);const c=this.center?.5:0;const h=this.showArrow&&this.center?8:0;const f=this.getOptimalPopoverPosition(this.position,n,{width:i.width,height:i.height},c);const l=this.host.style;this.applyPositionStyles(f,l,a,i,n,c,h);this.currentPosition=f}componentWillLoad(){this.validatePosition(this.position);this.onOpen()}componentDidLoad(){this.setPosition()}disconnectedCallback(){cancelAnimationFrame(this.animationFrameRequestId)}render(){return o(r,{key:"8628b0f299deb808e4c554047c76b82f392782c9","current-position":this.currentPosition},o("slot",{key:"144294e8216d7ad673e4ee3a96651c053703d135"}))}get host(){return s(this)}static get watchers(){return{position:["validatePosition"],open:["onOpen"]}}};l.positionOrder=[i.TOP_RIGHT,i.TOP,i.TOP_LEFT,i.RIGHT_BOTTOM,i.RIGHT,i.RIGHT_TOP,i.BOTTOM_LEFT,i.BOTTOM,i.BOTTOM_RIGHT,i.LEFT_TOP,i.LEFT,i.LEFT_BOTTOM];l.style=c;export{l as z_popover};
2
- //# sourceMappingURL=p-37f271c8.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZPopoverStyle0","DOCUMENT_ELEMENT","document","documentElement","getParentElement","element","parentNode","shadowRoot","host","parentElement","findScrollableParent","parent","style","window","getComputedStyle","overflow","overflowX","overflowY","isOverflowNotVisible","isOverflowYNotVisible","isOverflowXNotVisible","scrollHeight","clientHeight","scrollWidth","clientWidth","computeOffset","targetParentOffset","rect","getBoundingClientRect","width","height","top","left","offsetParent","offsetLeft","body","scrollY","offsetTop","DOMMatrix","transform","domMatrix","m41","m42","parentWidth","parentHeight","innerWidth","innerHeight","offsetWidth","offsetHeight","right","bottom","ZPopover","this","spaceTolerance","PopoverPosition","TOP","closePopoverWithKeyboard","e","closable","key","KeyboardCode","ESC","open","handleOutsideClick","eventPath","composedPath","includes","target","triggerElemClicked","bindTo","closest","contains","stopPropagation","positionChange","emit","position","currentPosition","validatePosition","newValue","Object","values","AUTO","setPosition","onOpen","cancelAnimationFrame","animationFrameRequestId","requestAnimationFrame","setTimeout","openChange","hasCenteredHorizontalSpace","availableLeft","availableRight","hostWidth","boundWidth","offsetModifier","requiredSpace","hasCenteredVerticalSpace","availableTop","availableBottom","hostHeight","boundHeight","hasOffsetSpace","availableSpace","hostSize","boundSize","getOptimalPopoverPosition","desiredPosition","boundElemSizes","fits","pos","TOP_RIGHT","TOP_LEFT","RIGHT","RIGHT_BOTTOM","RIGHT_TOP","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","LEFT","LEFT_TOP","LEFT_BOTTOM","positions","positionOrder","startIndex","indexOf","i","length","posIndex","findBestFallbackPosition","bestHorizontalDirection","bestVerticalDirection","maxHorizontalSpace","Math","max","maxVerticalSpace","mainDirection","needsSecondaryDirection","minHorizontalSpace","min","minVerticalSpace","secondaryDirection","calculateAvailableSpace","boundElementRect","scrollContainer","scrollingBoundingRect","scrollTop","scrollLeft","overflowBottom","overflowRight","calculateRelativeOffsets","relativeBoundingRect","applyPositionStyles","offsets","boundElementSizes","arrowModifier","distanceFromBound","maxWidth","maxHeight","boundElement","ownerDocument","querySelector","offsetContainer","center","showArrow","componentWillLoad","componentDidLoad","disconnectedCallback","render","h","Host"],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: ;\n --z-popover-theme--text: ;\n --z-popover-padding: ;\n --z-popover-shadow-filter: ;\n\n position: absolute;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n max-width: 100%;\n min-height: calc(var(--space-unit) * 4);\n max-height: 100%;\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding, 0);\n background: var(--z-popover-theme--surface, var(--color-surface01));\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text, var(--color-default-text));\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter, drop-shadow(0 1px 2px var(--shadow-color-base)));\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open]:not([current-position])) {\n visibility: hidden;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface, var(--color-surface01));\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\ntype Offsets = {top: number; right: number; bottom: number; left: number};\ntype ElementSizes = {width: number; height: number};\n/** Centering offset modifier. 0 for no offset, 0.5 for centering. */\ntype OffsetModifier = 0 | 0.5;\n\nfunction getParentElement(element: Element): Element {\n if (element.parentNode === element.shadowRoot) {\n return element.shadowRoot.host;\n }\n\n return element.parentElement;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const style = window.getComputedStyle(parent);\n const {overflow, overflowX, overflowY} = style;\n\n // Check for hidden overflow first (early return)\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n // Only check scrollable if overflow is not visible\n const isOverflowNotVisible = overflow !== \"visible\";\n const isOverflowYNotVisible = overflowY !== \"visible\";\n const isOverflowXNotVisible = overflowX !== \"visible\";\n\n if (\n (parent.scrollHeight > parent.clientHeight && isOverflowNotVisible && isOverflowYNotVisible) ||\n (parent.scrollWidth > parent.clientWidth && isOverflowNotVisible && isOverflowXNotVisible)\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Offsets & ElementSizes {\n const rect = element.getBoundingClientRect();\n const {width, height} = rect;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n\n while (offsetParent && offsetParent !== targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n // Handle CSS transforms only when DOMMatrix is available\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const {transform} = style;\n\n if (transform && transform !== \"none\") {\n const domMatrix = new DOMMatrix(transform);\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - width;\n const bottom = parentHeight - top - height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n * This component displays a popover that can be bound to an element.\n * It supports various positions and can automatically adjust its position based on available space.\n *\n * Notes:\n * - To ensure the positioning algorithm finds the right container when calculating the position, set its container's `position` to `relative`.\n * - Consider manually adjusting the size of the slotted element (using `max-width`, `max-height`, etc...) when its content is \"fluid\" (like a big text), because it can interfere with the position calculation (for example a long text on one single line can be bigger than the available space, letting the algorithm think that the popover doesn't fit in the available space).\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /**\n * The preferred position to render the popover.\n * The popover will automatically search another position if not enough space is available for the preferred position.\n * If the preferred position is not available, it will try to find the best position starting from `TOP` and going clockwise.\n */\n @Prop({reflect: true, mutable: true})\n position?: PopoverPosition = PopoverPosition.TOP;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n * It differs from `position` only when calculated automatically (position=auto) or when the position is recalculated for space reasons.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n private readonly spaceTolerance = 3; // 3px tolerance for space calculations\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n const eventPath = e.composedPath();\n if (!eventPath.includes(this.host)) {\n const target = e.target as HTMLElement;\n let triggerElemClicked = false;\n\n if (typeof this.bindTo === \"string\") {\n triggerElemClicked = !!target.closest(this.bindTo);\n } else if (this.bindTo) {\n triggerElemClicked = this.bindTo.contains(target);\n }\n\n if (triggerElemClicked) {\n // stop propagation if the click was on the trigger element to prevent close and reopen glitches\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (!Object.values(PopoverPosition).includes(newValue as PopoverPosition) || newValue === PopoverPosition.AUTO) {\n newValue = PopoverPosition.TOP;\n }\n\n this.position = newValue;\n this.currentPosition = newValue;\n this.positionChange.emit({position: this.currentPosition});\n this.setPosition();\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n // call `setPosition` after a tick to ensure the DOM is ready and sizes are available\n setTimeout(() => {\n setPosition();\n }, 0);\n }\n\n this.openChange.emit({open: this.open});\n }\n\n // Clockwise order of positions.\n private static readonly positionOrder: PopoverPosition[] = [\n PopoverPosition.TOP_RIGHT,\n PopoverPosition.TOP,\n PopoverPosition.TOP_LEFT,\n PopoverPosition.RIGHT_BOTTOM,\n PopoverPosition.RIGHT,\n PopoverPosition.RIGHT_TOP,\n PopoverPosition.BOTTOM_LEFT,\n PopoverPosition.BOTTOM,\n PopoverPosition.BOTTOM_RIGHT,\n PopoverPosition.LEFT_TOP,\n PopoverPosition.LEFT,\n PopoverPosition.LEFT_BOTTOM,\n ] as const;\n\n /**\n * Helper functions for space calculation\n */\n private hasCenteredHorizontalSpace(\n availableLeft: number,\n availableRight: number,\n hostWidth: number,\n boundWidth: number,\n offsetModifier: OffsetModifier\n ): boolean {\n const requiredSpace = (hostWidth - boundWidth) * (1 - offsetModifier);\n\n return (\n availableLeft >= requiredSpace - this.spaceTolerance && availableRight >= requiredSpace - this.spaceTolerance\n );\n }\n\n private hasCenteredVerticalSpace(\n availableTop: number,\n availableBottom: number,\n hostHeight: number,\n boundHeight: number,\n offsetModifier: OffsetModifier\n ): boolean {\n const requiredSpace = (hostHeight - boundHeight) * (1 - offsetModifier);\n\n return (\n availableTop >= requiredSpace - this.spaceTolerance && availableBottom >= requiredSpace - this.spaceTolerance\n );\n }\n\n private hasOffsetSpace(\n availableSpace: number,\n hostSize: number,\n boundSize: number,\n offsetModifier: OffsetModifier\n ): boolean {\n return availableSpace >= hostSize - boundSize * (1 - offsetModifier) - this.spaceTolerance;\n }\n\n /**\n * Given a desired position and available space around the bound element, returns the best position\n * that fits the popover, trying all positions if needed.\n * Takes into account offsetModifier for centering.\n * @param desiredPosition The desired position of the popover.\n * @param availableSpace The available space around the bound element.\n * @param boundElemSizes The sizes of the bound element.\n * @param offsetModifier The modifier to apply to the offset for centering.\n */\n private getOptimalPopoverPosition(\n desiredPosition: PopoverPosition,\n availableSpace: Offsets,\n boundElemSizes: ElementSizes,\n offsetModifier: OffsetModifier\n ): PopoverPosition {\n const hostWidth = this.host.offsetWidth;\n const hostHeight = this.host.offsetHeight;\n\n // Check if the desired position has enough space\n const fits = (pos: PopoverPosition): boolean => {\n switch (pos) {\n case PopoverPosition.TOP:\n return (\n availableSpace.top >= hostHeight &&\n this.hasCenteredHorizontalSpace(\n availableSpace.left,\n availableSpace.right,\n hostWidth,\n boundElemSizes.width,\n offsetModifier\n )\n );\n\n case PopoverPosition.TOP_RIGHT:\n return (\n availableSpace.top >= hostHeight &&\n this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.TOP_LEFT:\n return (\n availableSpace.top >= hostHeight &&\n this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.RIGHT:\n return (\n availableSpace.right >= hostWidth &&\n this.hasCenteredVerticalSpace(\n availableSpace.top,\n availableSpace.bottom,\n hostHeight,\n boundElemSizes.height,\n offsetModifier\n )\n );\n\n case PopoverPosition.RIGHT_BOTTOM:\n return (\n availableSpace.right >= hostWidth &&\n this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.RIGHT_TOP:\n return (\n availableSpace.right >= hostWidth &&\n this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.BOTTOM:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasCenteredHorizontalSpace(\n availableSpace.left,\n availableSpace.right,\n hostWidth,\n boundElemSizes.width,\n offsetModifier\n )\n );\n\n case PopoverPosition.BOTTOM_LEFT:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.BOTTOM_RIGHT:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.LEFT:\n return (\n availableSpace.left >= hostWidth &&\n this.hasCenteredVerticalSpace(\n availableSpace.top,\n availableSpace.bottom,\n hostHeight,\n boundElemSizes.height,\n offsetModifier\n )\n );\n\n case PopoverPosition.LEFT_TOP:\n return (\n availableSpace.left >= hostWidth &&\n this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.LEFT_BOTTOM:\n return (\n availableSpace.left >= hostWidth &&\n this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n default:\n return false;\n }\n };\n\n // Check desired position first\n if (fits(desiredPosition)) {\n return desiredPosition;\n }\n\n // Find position index and create rotation starting from next position\n const positions = ZPopover.positionOrder;\n const startIndex = positions.indexOf(desiredPosition);\n\n if (startIndex === -1) {\n return desiredPosition; // fallback if position not found\n }\n\n // Try all other positions starting from the next one\n for (let i = 1; i < positions.length; i++) {\n const posIndex = (startIndex + i) % positions.length;\n const pos = positions[posIndex];\n if (fits(pos)) {\n return pos;\n }\n }\n\n // If no position fits, find the best fallback based on available space\n return this.findBestFallbackPosition(availableSpace);\n }\n\n /**\n * Find the best fallback position based on available space when no position fits perfectly\n */\n private findBestFallbackPosition(availableSpace: Offsets): PopoverPosition {\n // Determine the directions with the most space\n const bestHorizontalDirection =\n availableSpace.right >= availableSpace.left ? PopoverPosition.RIGHT : PopoverPosition.LEFT;\n\n const bestVerticalDirection =\n availableSpace.bottom >= availableSpace.top ? PopoverPosition.BOTTOM : PopoverPosition.TOP;\n\n // Choose the main direction based on which has more space\n const maxHorizontalSpace = Math.max(availableSpace.right, availableSpace.left);\n const maxVerticalSpace = Math.max(availableSpace.bottom, availableSpace.top);\n\n const mainDirection = maxVerticalSpace >= maxHorizontalSpace ? bestVerticalDirection : bestHorizontalDirection;\n\n // Check if secondary direction is necessary\n // Only add secondary direction if the difference between min and max in that direction is at least double\n let needsSecondaryDirection = false;\n\n if (mainDirection === bestVerticalDirection) {\n // Main direction is vertical, check horizontal space difference\n const minHorizontalSpace = Math.min(availableSpace.right, availableSpace.left);\n needsSecondaryDirection = maxHorizontalSpace >= minHorizontalSpace * 2;\n } else {\n // Main direction is horizontal, check vertical space difference\n const minVerticalSpace = Math.min(availableSpace.bottom, availableSpace.top);\n needsSecondaryDirection = maxVerticalSpace >= minVerticalSpace * 2;\n }\n\n if (!needsSecondaryDirection) {\n return mainDirection;\n }\n\n const secondaryDirection =\n mainDirection === bestVerticalDirection ? bestHorizontalDirection : bestVerticalDirection;\n\n // Create a combined position (e.g., \"bottom_right\")\n return `${mainDirection}_${secondaryDirection}` as PopoverPosition;\n }\n\n /**\n * Calculate available space around the bound element\n */\n private calculateAvailableSpace(\n boundElementRect: Offsets & ElementSizes,\n scrollContainer: HTMLElement,\n scrollingBoundingRect: DOMRect\n ): {top: number; right: number; bottom: number; left: number} {\n const top = boundElementRect.top - scrollContainer.scrollTop;\n const bottom =\n scrollingBoundingRect.height - (boundElementRect.top + boundElementRect.height) + scrollContainer.scrollTop;\n const left = boundElementRect.left - scrollContainer.scrollLeft;\n const right =\n scrollingBoundingRect.width - (boundElementRect.left + boundElementRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n return {\n top: Math.min(top, top + scrollingBoundingRect.top),\n bottom: Math.min(bottom, bottom - overflowBottom),\n left: Math.min(left, left + scrollingBoundingRect.left),\n right: Math.min(right, right - overflowRight),\n };\n }\n\n /**\n * Calculate relative offsets for positioning\n */\n private calculateRelativeOffsets(\n boundElementRect: Offsets,\n relativeBoundingRect: Offsets\n ): {top: number; right: number; bottom: number; left: number} {\n return {\n top: boundElementRect.top - relativeBoundingRect.top,\n right: boundElementRect.right - relativeBoundingRect.right,\n bottom: boundElementRect.bottom - relativeBoundingRect.bottom,\n left: boundElementRect.left - relativeBoundingRect.left,\n };\n }\n\n /**\n * Apply positioning styles based on position\n */\n private applyPositionStyles(\n position: PopoverPosition,\n style: CSSStyleDeclaration,\n offsets: Offsets,\n boundElementSizes: ElementSizes,\n availableSpace: Offsets,\n offsetModifier: OffsetModifier,\n arrowModifier: number\n ): void {\n const distanceFromBound = 8; // 8px is the distance of the popover from the bound element\n // Reset all positioning properties\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = \"\";\n style.maxHeight = \"\";\n\n switch (position) {\n case PopoverPosition.TOP:\n case PopoverPosition.TOP_RIGHT:\n style.bottom = `${offsets.bottom + boundElementSizes.height}px`;\n style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.TOP_RIGHT ? arrowModifier : 0)}px`;\n style.maxHeight = `${availableSpace.top - distanceFromBound}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.TOP_LEFT:\n style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;\n style.bottom = `${offsets.bottom + boundElementSizes.height}px`;\n style.maxWidth = `${availableSpace.left}px`;\n style.maxHeight = `${availableSpace.top - distanceFromBound}px`;\n break;\n\n case PopoverPosition.BOTTOM:\n case PopoverPosition.BOTTOM_RIGHT:\n style.top = `${offsets.top + boundElementSizes.height}px`;\n style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.BOTTOM_RIGHT ? arrowModifier : 0)}px`;\n style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.BOTTOM_LEFT:\n style.top = `${offsets.top + boundElementSizes.height}px`;\n style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;\n style.maxWidth = `${availableSpace.left}px`;\n style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;\n break;\n\n case PopoverPosition.RIGHT:\n case PopoverPosition.RIGHT_BOTTOM:\n style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.RIGHT_BOTTOM ? arrowModifier : 0)}px`;\n style.left = `${offsets.left + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.right - distanceFromBound}px`;\n if (position === PopoverPosition.RIGHT) {\n style.maxHeight = `${Math.min(availableSpace.top + availableSpace.bottom + boundElementSizes.height, window.innerHeight - 20)}px`;\n } else {\n style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.RIGHT_TOP:\n style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;\n style.left = `${offsets.left + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.right - distanceFromBound}px`;\n if (position === PopoverPosition.RIGHT_TOP) {\n style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.LEFT:\n case PopoverPosition.LEFT_BOTTOM:\n style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.LEFT_BOTTOM ? arrowModifier : 0)}px`;\n style.right = `${offsets.right + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.left - distanceFromBound}px`;\n if (position === PopoverPosition.LEFT_BOTTOM) {\n style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.LEFT_TOP:\n style.right = `${offsets.right + boundElementSizes.width}px`;\n style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;\n style.maxWidth = `${availableSpace.left - distanceFromBound}px`;\n if (position === PopoverPosition.LEFT_TOP) {\n style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n }\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let boundElement: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n boundElement = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n boundElement = this.bindTo;\n } else {\n boundElement = this.host.parentElement as HTMLElement;\n }\n\n if (!boundElement) {\n return;\n }\n\n const scrollContainer = findScrollableParent(boundElement) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundElementRect = computeOffset(boundElement, scrollContainer);\n\n const availableSpace = this.calculateAvailableSpace(boundElementRect, scrollContainer, scrollingBoundingRect);\n const offsets = this.calculateRelativeOffsets(boundElementRect, relativeBoundingRect);\n const offsetModifier = this.center ? 0.5 : 0;\n const arrowModifier = this.showArrow && this.center ? 8 : 0; // 8px is the distance of the arrow center from the edge of the popover\n\n const position = this.getOptimalPopoverPosition(\n this.position,\n availableSpace,\n {width: boundElementRect.width, height: boundElementRect.height},\n offsetModifier\n );\n\n const style = this.host.style;\n this.applyPositionStyles(position, style, offsets, boundElementRect, availableSpace, offsetModifier, arrowModifier);\n\n this.currentPosition = position;\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n componentDidLoad(): void {\n this.setPosition();\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n render(): HTMLZPopoverElement {\n return (\n <Host current-position={this.currentPosition}>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"mappings":"2GAAA,MAAMA,EAAY,yuGAClB,MAAAC,EAAeD,ECEf,MAAME,EAAmBC,SAASC,gBAOlC,SAASC,EAAiBC,GACxB,GAAIA,EAAQC,aAAeD,EAAQE,WAAY,CAC7C,OAAOF,EAAQE,WAAWC,I,CAG5B,OAAOH,EAAQI,aACjB,CAOA,SAASC,EAAqBL,GAC5B,IAAIM,EAASP,EAAiBC,GAE9B,MAAOM,GAAUA,IAAWV,EAAkB,CAC5C,MAAMW,EAAQC,OAAOC,iBAAiBH,GACtC,MAAMI,SAACA,EAAQC,UAAEA,EAASC,UAAEA,GAAaL,EAGzC,GAAIG,IAAa,UAAYE,IAAc,UAAYD,IAAc,SAAU,CAC7E,OAAOL,C,CAIT,MAAMO,EAAuBH,IAAa,UAC1C,MAAMI,EAAwBF,IAAc,UAC5C,MAAMG,EAAwBJ,IAAc,UAE5C,GACGL,EAAOU,aAAeV,EAAOW,cAAgBJ,GAAwBC,GACrER,EAAOY,YAAcZ,EAAOa,aAAeN,GAAwBE,EACpE,CACA,OAAOT,C,CAGTA,EAASP,EAAiBO,E,CAG5B,OAAOV,CACT,CAQA,SAASwB,EAAcpB,EAAsBqB,GAC3C,MAAMC,EAAOtB,EAAQuB,wBACrB,MAAMC,MAACA,EAAKC,OAAEA,GAAUH,EAExB,IAAII,EAAM,EACV,IAAIC,EAAO,EACX,IAAIC,EAAe5B,EAEnB,MAAO4B,GAAgBA,IAAiBP,EAAoB,CAC1DM,GAAQC,EAAaC,WAGrB,GAAID,IAAiB/B,SAASiC,KAAM,CAClCJ,GAAOE,EAAaL,wBAAwBG,IAAMlB,OA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AAgB4D,GAErGtG,KAAKwB,gBAAkBD,C,CAGzB,iBAAAyF,GACEhH,KAAKyB,iBAAiBzB,KAAKuB,UAC3BvB,KAAK+B,Q,CAGP,gBAAAkF,GACEjH,KAAK8B,a,CAGP,oBAAAoF,GACElF,qBAAqBhC,KAAKiC,wB,CAG5B,MAAAkF,GACE,OACEC,EAACC,EAAI,CAAA9G,IAAA,8DAAmBP,KAAKwB,iBAC3B4F,EAAA,QAAA7G,IAAA,6C,yGA5bkBR,EAAAuE,cAAmC,CACzDpE,EAAgBwD,UAChBxD,EAAgBC,IAChBD,EAAgByD,SAChBzD,EAAgB2D,aAChB3D,EAAgB0D,MAChB1D,EAAgB4D,UAChB5D,EAAgB8D,YAChB9D,EAAgB6D,OAChB7D,EAAgB+D,aAChB/D,EAAgBiE,SAChBjE,EAAgBgE,KAChBhE,EAAgBkE,a","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZCardStyle0","ZCard","componentWillLoad","this","hasCoverImage","host","querySelector","renderColorCoverCard","h","class","name","renderContent","render","variant","CardVariant","TEXT","Host","OVERLAY","coverIcon"],"sources":["src/components/z-card/styles.css?tag=z-card&encapsulation=shadow","src/components/z-card/index.tsx"],"sourcesContent":["/* The width of the card must be set by its container,\nrespecting the grid indications of the design. */\n\n:host {\n /* Override this var to change the cover's aspect ratio */\n --aspect-ratio: 1.62;\n --z-card--border-color: var(--gray200);\n --z-card--color-cover-background: var(--color-surface01);\n --z-card--text-background: var(--color-surface01);\n --z-card--text-border-radius: none;\n --z-card--text-border: none;\n --z-card--text-padding: calc(var(--space-unit) * 2) var(--space-unit);\n\n position: relative;\n display: flex;\n flex-direction: column;\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n*,\n::slotted(*) {\n box-sizing: border-box;\n}\n\n*:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(:not([variant=\"overlay\"])) .cover-container {\n position: relative;\n width: 100%;\n}\n\n/* Old good trick with percentage padding to keep the aspect ratio.\nUnfortunately the `aspect-ratio` property is still experimental */\n.cover-container {\n padding-bottom: calc(100% / var(--aspect-ratio));\n}\n\n::slotted([slot=\"cover\"]),\n.color-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n}\n\n.cover-container > z-icon {\n --z-icon-width: calc(var(--space-unit) * 11);\n --z-icon-height: var(--z-icon-width);\n\n position: absolute;\n top: calc(50% - calc(var(--z-icon-height) / 2));\n left: calc(50% - calc(var(--z-icon-width) / 2));\n fill: var(--color-primary01);\n}\n\n.color-cover {\n background-color: var(--z-card--color-cover-background);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n padding-top: var(--space-unit);\n}\n\n.color-cover .cover-content {\n display: flex;\n height: 100%;\n flex-direction: column;\n justify-content: flex-end;\n padding: var(--space-unit);\n}\n\n/* Truncates overflowing text */\n::slotted([slot=\"metadata\"]),\n::slotted([slot=\"title\"]),\n::slotted([slot=\"text\"]) {\n display: -webkit-inline-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n\n::slotted([slot=\"title\"]:not(:last-child)),\n::slotted([slot=\"text\"]:not(:last-child)) {\n margin-bottom: var(--space-unit);\n}\n\n::slotted([slot=\"title\"])::before {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \"\";\n}\n\n::slotted([slot=\"metadata\"]:not(:last-child)) {\n margin: 0 0 calc(var(--space-unit) * 0.25);\n -webkit-line-clamp: 1;\n line-clamp: 1;\n text-transform: uppercase;\n}\n\n::slotted([slot=\"title\"]) {\n margin: 0;\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-decoration: none;\n}\n\n::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n::slotted([slot=\"text\"]) {\n margin: 0;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n}\n\n.actions {\n position: relative;\n z-index: 2;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n::slotted([slot=\"action\"]:not(:last-child)) {\n margin-right: calc(var(--space-unit) * 2);\n}\n\n::slotted([slot=\"action\"]:focus) {\n box-shadow: var(--shadow-focus-primary);\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible)::before {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: none !important;\n outline: none !important;\n}\n\n:host([variant=\"text\"]) {\n border: var(--z-card--text-border);\n background-color: var(--z-card--text-background);\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([show-shadow]) > .content,\n:host([variant=\"border\"]) > .content,\n:host([variant=\"shadow\"]) > .content {\n height: 100%;\n padding: var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2);\n}\n\n:host([variant=\"text\"]) > .content {\n padding: var(--z-card--text-padding);\n}\n\n:host([variant=\"border\"]) .actions,\n:host([variant=\"shadow\"]) .actions {\n margin-top: auto;\n}\n\n/* Border */\n:host([variant=\"border\"]) {\n border: var(--border-size-small) solid var(--z-card--border-color);\n}\n\n:host([variant=\"border\"][clickable]:hover) > .content {\n background: var(--color-background);\n}\n\n:host([variant=\"border\"][clickable]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"border\"][clickable]:active) {\n border-color: transparent;\n}\n\n/* Shadow */\n:host([variant=\"shadow\"]),\n:host([show-shadow]) {\n box-shadow: var(--shadow-2);\n}\n\n:host([variant=\"shadow\"][clickable]:hover),\n:host([clickable][show-shadow]:hover) {\n box-shadow: var(--shadow-4);\n}\n\n:host([variant=\"shadow\"][clickable]:focus:focus-visible),\n:host([clickable][show-shadow]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"shadow\"][clickable]:active),\n:host([clickable][show-shadow]:active) {\n box-shadow: none;\n}\n\n/* Overlay */\n:host([variant=\"overlay\"]) .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n justify-content: flex-end;\n padding: var(--space-unit);\n background-image: linear-gradient(to top, rgb(0 0 0 / 100%), rgb(0 0 0 / 0%));\n color: var(--color-text-inverse);\n fill: var(--color-text-inverse);\n}\n","import {Component, Element, Host, Prop, State, h} from \"@stencil/core\";\nimport {CardVariant} from \"../../beans\";\n\n/**\n * ZCard component.\n * @cssprop --aspect-ratio - Cover aspect ratio. Default: `1.62`\n * @cssprop --z-card--border-color - Default: `var(--gray200)`\n * @cssprop --z-card--color-cover-background - Cover color. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-background - Background color for the `text` variant. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-border-radius - Default: `none`\n * @cssprop --z-card--text-border - Configure CSS `border`. Default: `none`\n * @cssprop --z-card--text-padding - Configure CSS `padding`. Default: `none`\n * @slot cover - Image cover\n * @slot metadata - Metadata\n * @slot title - Title\n * @slot text - Text content\n * @slot action - Actions\n */\n@Component({\n tag: \"z-card\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZCard {\n /**\n * Card variant.\n * Can be one of \"text\", \"border\", \"shadow\", \"overlay\".\n * Leave it undefined for the default card.\n */\n @Prop({reflect: true})\n variant: CardVariant;\n\n /** Name of the icon to place over the image cover */\n @Prop()\n coverIcon: string;\n\n /** Enable shadow. Default: false. */\n @Prop({reflect: true})\n showShadow = false;\n\n /** Enable \"clickable\" styles like hover background and cursor, focus shadow on the whole card, etc. */\n @Prop({reflect: true})\n clickable = false;\n\n @Element() host: HTMLZCardElement;\n\n @State()\n hasCoverImage: boolean;\n\n componentWillLoad(): void {\n this.hasCoverImage = this.host.querySelector('[slot=\"cover\"]') !== null;\n }\n\n /**\n * Template for a card without image cover.\n * A colored background replaces the image and some data is moved over it.\n */\n private renderColorCoverCard(): HTMLDivElement[] {\n return [\n <div class=\"cover-container\">\n <div class=\"color-cover\">\n <div class=\"cover-content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n </div>\n </div>\n </div>,\n <div class=\"content\">\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>,\n ];\n }\n\n /**\n * Template for the content.\n */\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n );\n }\n\n render(): HTMLZCardElement {\n if (this.variant === CardVariant.TEXT) {\n return <Host>{this.renderContent()}</Host>;\n }\n\n if (this.variant === CardVariant.OVERLAY || this.hasCoverImage) {\n return (\n <Host>\n <div class=\"cover-container\">\n {this.hasCoverImage && [\n <slot name=\"cover\"></slot>,\n this.variant !== CardVariant.OVERLAY && this.coverIcon && <z-icon name={this.coverIcon}></z-icon>,\n ]}\n {!this.hasCoverImage && <div class=\"color-cover\"></div>}\n </div>\n {this.renderContent()}\n </Host>\n );\n }\n\n return <Host>{this.renderColorCoverCard()}</Host>;\n }\n}\n"],"mappings":"wFAAA,MAAMA,EAAY,0lIAClB,MAAAC,EAAeD,E,MCsBFE,EAAK,M,yFAeH,M,eAID,M,6BAOZ,iBAAAC,GACEC,KAAKC,cAAgBD,KAAKE,KAAKC,cAAc,oBAAsB,I,CAO7D,oBAAAC,GACN,MAAO,CACLC,EAAA,OAAKC,MAAM,mBACTD,EAAA,OAAKC,MAAM,eACTD,EAAA,OAAKC,MAAM,iBACTD,EAAA,QAAME,KAAK,aACXF,EAAA,QAAME,KAAK,aAIjBF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,SACXF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,a,CASX,aAAAC,GACN,OACEH,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,aACXF,EAAA,QAAME,KAAK,UACXF,EAAA,QAAME,KAAK,SACXF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,Y,CAMnB,MAAAE,GACE,GAAIT,KAAKU,UAAYC,EAAYC,KAAM,CACrC,OAAOP,EAACQ,EAAI,KAAEb,KAAKQ,gB,CAGrB,GAAIR,KAAKU,UAAYC,EAAYG,SAAWd,KAAKC,cAAe,CAC9D,OACEI,EAACQ,EAAI,KACHR,EAAA,OAAKC,MAAM,mBACRN,KAAKC,eAAiB,CACrBI,EAAA,QAAME,KAAK,UACXP,KAAKU,UAAYC,EAAYG,SAAWd,KAAKe,WAAaV,EAAA,UAAQE,KAAMP,KAAKe,cAE7Ef,KAAKC,eAAiBI,EAAA,OAAKC,MAAM,iBAEpCN,KAAKQ,gB,CAKZ,OAAOH,EAACQ,EAAI,KAAEb,KAAKI,uB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export{Z as z_tr}from"./p-61f76cab.js";import"./p-75c4a726.js";import"./p-a06fbbc0.js";import"./p-17af7fb2.js";import"./p-5145a606.js";import"./p-f19f12b1.js";import"./p-748fa3ae.js";
2
- //# sourceMappingURL=p-69a1a67a.entry.js.map
@@ -1,2 +0,0 @@
1
- import{r as t,h as a,a as e,g as s}from"./p-75c4a726.js";import"./p-1170826b.js";import"./p-4c9bf42d.js";import"./p-d7f12672.js";import"./p-61f76cab.js";import"./p-a06fbbc0.js";import"./p-17af7fb2.js";import"./p-5145a606.js";import"./p-f19f12b1.js";import"./p-748fa3ae.js";const r=":host{--z-table--cells-padding:calc(var(--space-unit) * 2);position:relative;display:block;overflow:auto;min-width:max-content;max-width:100%;box-sizing:border-box;padding:var(--space-unit);background-color:var(--color-surface01)}:host([expandable]){--z-table--expand-button-size:40px}:host([bordered]){--z-table--cell-left-border:1px solid var(--color-surface03)}";const o=r;const i=class{constructor(a){t(this,a);this.bordered=false;this.expandable=false}updateExpandable(){this.expandable=this.host.querySelectorAll("z-tr[expandable]").length>0}componentWillLoad(){this.expandableMutationObserver=new MutationObserver((()=>{this.updateExpandable()}));this.expandableMutationObserver.observe(this.host,{childList:true,subtree:true,attributes:true,attributeFilter:["expandable"],attributeOldValue:false})}disconnectedCallback(){var t;(t=this.expandableMutationObserver)===null||t===void 0?void 0:t.disconnect()}render(){return a(e,{key:"6749b44ab2c28b92e6b282487bf9f23c40cead58",expandable:this.expandable},a("div",{key:"633237695b09182263ac74b5118d533a8cae33b8",class:"table",role:"table"},a("slot",{key:"f46d287050238e137ababadae8b8eb1ffdb96c7b"})))}get host(){return s(this)}};i.style=o;export{i as z_table};
2
- //# sourceMappingURL=p-8d5e3396.entry.js.map
@@ -1,2 +0,0 @@
1
- import{g as e,p as t}from"./p-17af7fb2.js";import{B as n}from"./p-5145a606.js";function r(e){switch(e){case true:case"true":case 1:case"1":case"on":case"yes":return true;case false:case"false":case 0:case"0":case"off":case"no":return false;default:return e}}function a(){return Math.random().toString(36).replace("0.","")}function s(t,n,...r){if(t.code===e.ENTER||t.code===e.SPACE){t.preventDefault();n(...r)}}function u(t,n,...r){if(t.code===e.ENTER){t.preventDefault();n(...r)}}function c(e=null){if(!e){e=document.activeElement}if(e&&e.shadowRoot&&e.shadowRoot.activeElement){e=e.shadowRoot.activeElement;return c(e)}return e}function f(e,t=[]){t.push(e);if(e.parentElement){e=e.parentElement;return f(e,t)}else if(e.parentNode&&e.parentNode.host){e=e.parentNode.host;return f(e,t)}return t}function o(){switch(true){case window.innerWidth<=n.MOBILE:return t.MOBILE;case window.innerWidth<=n.TABLET:return t.TABLET;case window.innerWidth<=n.DESKTOP:return t.DESKTOP;default:return t.DESKTOP_WIDE}}function i(e){try{return JSON.parse(e)}catch(e){return false}}function l(e){const t="avatar-C";const n=19;const r=Math.ceil(2**31-1)*parseFloat(`0.${e}`);let a=Math.ceil(n*(r%1));if(a===0){a=1}return`${t}${a.toString().padStart(2,"0")}`}function d(e,t){var n;return e.contains(t)||!!((n=e.shadowRoot)===null||n===void 0?void 0:n.contains(t))}export{d as a,r as b,l as c,s as d,f as e,c as f,o as g,u as h,i,a as r};
2
- //# sourceMappingURL=p-a06fbbc0.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["boolean","value","randomId","Math","random","toString","replace","handleKeyboardSubmit","ev","callback","args","code","KeyboardCode","ENTER","SPACE","preventDefault","handleEnterKeydSubmit","getClickedElement","elem","document","activeElement","shadowRoot","getElementTree","tree","push","parentElement","parentNode","host","getDevice","window","innerWidth","Breakpoints","MOBILE","Device","TABLET","DESKTOP","DESKTOP_WIDE","convertJson","data","JSON","parse","_a","colorFromId","id","prefix","colorsCount","seed","ceil","parseFloat","color","padStart","containsElement","ancestor","descendant","contains"],"sources":["src/utils/utils.ts"],"sourcesContent":["import {ChildNode} from \"@stencil/core\";\nimport {Device, KeyboardCode} from \"../beans/index\";\nimport {Breakpoints} from \"../constants/breakpoints\";\n\n/**\n * Return boolean value for passed value if a boolean corresponding value is found\n * Return passed value otherwise\n */\nexport function boolean(value: string | number | boolean): boolean | string | number {\n switch (value) {\n case true:\n case \"true\":\n case 1:\n case \"1\":\n case \"on\":\n case \"yes\":\n return true;\n case false:\n case \"false\":\n case 0:\n case \"0\":\n case \"off\":\n case \"no\":\n return false;\n default:\n return value;\n }\n}\n\nexport function retrieveAsset(assetName: string): string {\n return assetName && \"assets/images/png/\" + assetName;\n}\n\nexport function randomId(): string {\n return Math.random().toString(36).replace(\"0.\", \"\");\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function handleKeyboardSubmit(ev: KeyboardEvent, callback: (...args) => void, ...args: any[]): void {\n if (ev.code === KeyboardCode.ENTER || ev.code === KeyboardCode.SPACE) {\n ev.preventDefault();\n callback(...args);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function handleEnterKeydSubmit(ev: KeyboardEvent, callback: (...args) => void, ...args: any[]): void {\n if (ev.code === KeyboardCode.ENTER) {\n ev.preventDefault();\n callback(...args);\n }\n}\n\nexport function getClickedElement(elem: null | Element = null): null | Element {\n if (!elem) {\n elem = document.activeElement;\n }\n\n if (elem && elem.shadowRoot && elem.shadowRoot.activeElement) {\n elem = elem.shadowRoot.activeElement;\n\n return getClickedElement(elem);\n }\n\n return elem;\n}\n\nexport function getElementTree(elem: Element, tree: Element[] = []): null | Element[] {\n tree.push(elem);\n\n if (elem.parentElement) {\n elem = elem.parentElement;\n\n return getElementTree(elem, tree);\n } else if (elem.parentNode && (elem.parentNode as ShadowRoot).host) {\n elem = (elem.parentNode as ShadowRoot).host;\n\n return getElementTree(elem, tree);\n }\n\n return tree;\n}\n\nexport function getSiblings(elem: HTMLElement): ChildNode[] {\n const siblings = [];\n if (!elem || !elem.parentNode || !elem.parentNode.childNodes) {\n return siblings;\n }\n\n elem.parentNode.childNodes.forEach((child) => {\n if (child.nodeType === 1 && child !== elem) {\n siblings.push(child);\n }\n });\n\n return siblings;\n}\n\n/**\n * Get the current device type based on the window width.\n * @returns {Device} - The current device type\n */\nexport function getDevice(): Device {\n switch (true) {\n case window.innerWidth <= Breakpoints.MOBILE:\n return Device.MOBILE;\n case window.innerWidth <= Breakpoints.TABLET:\n return Device.TABLET;\n case window.innerWidth <= Breakpoints.DESKTOP:\n return Device.DESKTOP;\n default:\n return Device.DESKTOP_WIDE;\n }\n}\n\ntype JSONValue = string | number | boolean | JSONObject | JSONArray;\ninterface JSONObject {\n [x: string]: JSONValue;\n}\ntype JSONArray = JSONValue[];\n\nexport function convertJson(data: string): JSONValue {\n try {\n return JSON.parse(data);\n } catch {\n return false;\n }\n}\n\nexport function colorFromId(id: number): string {\n const prefix = \"avatar-C\"; // prefix for color vars name\n const colorsCount = 19; // available colors\n const seed = Math.ceil(2 ** 31 - 1) * parseFloat(`0.${id}`);\n let color = Math.ceil(colorsCount * (seed % 1));\n\n // if result of mc is 0\n // es.: 3895229\n if (color === 0) {\n color = 1;\n }\n\n return `${prefix}${color.toString().padStart(2, \"0\")}`;\n}\n\n/**\n * Check if the passed CSS selector is valid.\n * @param selector CSS selector to validate\n */\nexport function isSelectorValid(selector: string): boolean {\n try {\n document.createDocumentFragment().querySelector(selector);\n\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if an element contains another element, checking both light and shadow DOM.\n * @param ancestor Ancestor element\n * @param descendant Descendant element\n */\nexport function containsElement(ancestor: HTMLElement, descendant: Node): boolean {\n return ancestor.contains(descendant) || !!ancestor.shadowRoot?.contains(descendant);\n}\n"],"mappings":"wFAQgBA,EAAQC,GACtB,OAAQA,GACN,KAAK,KACL,IAAK,OACL,KAAK,EACL,IAAK,IACL,IAAK,KACL,IAAK,MACH,OAAO,KACT,KAAK,MACL,IAAK,QACL,KAAK,EACL,IAAK,IACL,IAAK,MACL,IAAK,KACH,OAAO,MACT,QACE,OAAOA,EAEb,C,SAMgBC,IACd,OAAOC,KAAKC,SAASC,SAAS,IAAIC,QAAQ,KAAM,GAClD,C,SAGgBC,EAAqBC,EAAmBC,KAAgCC,GACtF,GAAIF,EAAGG,OAASC,EAAaC,OAASL,EAAGG,OAASC,EAAaE,MAAO,CACpEN,EAAGO,iBACHN,KAAYC,E,CAEhB,C,SAGgBM,EAAsBR,EAAmBC,KAAgCC,GACvF,GAAIF,EAAGG,OAASC,EAAaC,MAAO,CAClCL,EAAGO,iBACHN,KAAYC,E,CAEhB,C,SAEgBO,EAAkBC,EAAuB,MACvD,IAAKA,EAAM,CACTA,EAAOC,SAASC,a,CAGlB,GAAIF,GAAQA,EAAKG,YAAcH,EAAKG,WAAWD,cAAe,CAC5DF,EAAOA,EAAKG,WAAWD,cAEvB,OAAOH,EAAkBC,E,CAG3B,OAAOA,CACT,C,SAEgBI,EAAeJ,EAAeK,EAAkB,IAC9DA,EAAKC,KAAKN,GAEV,GAAIA,EAAKO,cAAe,CACtBP,EAAOA,EAAKO,cAEZ,OAAOH,EAAeJ,EAAMK,E,MACvB,GAAIL,EAAKQ,YAAeR,EAAKQ,WAA0BC,KAAM,CAClET,EAAQA,EAAKQ,WAA0BC,KAEvC,OAAOL,EAAeJ,EAAMK,E,CAG9B,OAAOA,CACT,C,SAqBgBK,IACd,OAAQ,MACN,KAAKC,OAAOC,YAAcC,EAAYC,OACpC,OAAOC,EAAOD,OAChB,KAAKH,OAAOC,YAAcC,EAAYG,OACpC,OAAOD,EAAOC,OAChB,KAAKL,OAAOC,YAAcC,EAAYI,QACpC,OAAOF,EAAOE,QAChB,QACE,OAAOF,EAAOG,aAEpB,C,SAQgBC,EAAYC,GAC1B,IACE,OAAOC,KAAKC,MAAMF,E,CAClB,MAAAG,GACA,OAAO,K,CAEX,C,SAEgBC,EAAYC,GAC1B,MAAMC,EAAS,WACf,MAAMC,EAAc,GACpB,MAAMC,EAAO3C,KAAK4C,KAAK,GAAK,GAAK,GAAKC,WAAW,KAAKL,KACtD,IAAIM,EAAQ9C,KAAK4C,KAAKF,GAAeC,EAAO,IAI5C,GAAIG,IAAU,EAAG,CACfA,EAAQ,C,CAGV,MAAO,GAAGL,IAASK,EAAM5C,WAAW6C,SAAS,EAAG,MAClD,C,SAqBgBC,EAAgBC,EAAuBC,G,MACrD,OAAOD,EAASE,SAASD,QAAiBZ,EAAAW,EAAS/B,cAAU,MAAAoB,SAAA,SAAAA,EAAEa,SAASD,GAC1E,Q","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,c as t,h as s,g as i}from"./p-75c4a726.js";import{e as l,g as c,l as r,i as n}from"./p-17af7fb2.js";import{r as o,b as a,e as h,d,f as z}from"./p-a06fbbc0.js";import"./p-5145a606.js";const p='.sc-z-select-h{display:inline-block;width:inherit;color:var(--color-form-default-text);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg)}[size="small"].sc-z-select-h,[size="x-small"].sc-z-select-h{font-size:var(--font-size-2)}.select-wrapper.sc-z-select>z-input.sc-z-select{width:100%}.select-wrapper.sc-z-select>z-input.sc-z-select .input-icon.sc-z-select{cursor:pointer}.select-wrapper.sc-z-select>div.sc-z-select{position:relative}.select-wrapper.sc-z-select>div.closed.sc-z-select{overflow:hidden;height:0}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select{position:absolute;width:100%;box-sizing:border-box;border-top:none;background:var(--color-form-background);box-shadow:var(--shadow-2);outline:none}.select-wrapper.sc-z-select .closed.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:10}.select-wrapper.sc-z-select .open.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:20}.select-wrapper.sc-z-select .ul-scroll-wrapper.fixed.sc-z-select{position:static}.select-wrapper.sc-z-select z-list.sc-z-select{--background-color-list-element:var(--color-form-background);--background-hover-color-list-element:var(--color-form-surface03);--background-active-color-list-element:var(--color-form-surface03)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select{position:relative;overflow:auto;max-height:240px;padding:0 calc(var(--space-unit) * 1.5);outline:none}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element[disabled].sc-z-select{color:var(--color-form-disabled03)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select{display:flex;align-items:center;padding:calc(var(--space-unit) / 2) var(--space-unit);column-gap:var(--space-unit)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select .list-element-content.sc-z-select{margin-right:auto}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select>z-icon.sc-z-select+.list-element-content.sc-z-select{padding:calc(var(--space-unit) * 0.5) var(--space-unit)}[size="x-small"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select .list-element-content.sc-z-select{padding:0}[size="small"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select>z-icon.sc-z-select{--z-icon-width:16px;--z-icon-height:16px}[size="x-small"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select>z-icon.sc-z-select{--z-icon-width:14px;--z-icon-height:14px}[size="x-small"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select>z-icon.sc-z-select+.list-element-content.sc-z-select{padding:0 var(--space-unit)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-container.sc-z-select .list-element-content.selected.sc-z-select{font-weight:var(--font-sb)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select .no-results.sc-z-select z-icon.sc-z-select{margin-right:var(--space-unit)}.z-list-group-title.sc-z-select{color:var(--color-form-default-text)}.reset-item.sc-z-select{color:var(--color-form-active-primary);fill:var(--color-form-active-primary)}.reset-item-content.sc-z-select{display:flex;align-items:center}.reset-item.reset-item-margin.sc-z-select .reset-item-content.sc-z-select{margin-left:var(--space-unit)}.reset-item.sc-z-select .reset-item-content.sc-z-select>z-icon.sc-z-select{margin-right:var(--space-unit)}.reset-item.hide.sc-z-select{display:none}.tree-list-reset-item.sc-z-select{padding:var(--space-unit) 0}z-list-element.sc-z-select{position:relative;display:block}z-list.sc-z-select z-list-element.sc-z-select::before{position:absolute;z-index:100;top:3px;left:-15px;width:8px;height:1em;border-bottom:1px solid var(--color-form-disabled01-icon);border-left:1px solid var(--color-form-disabled01-icon);content:"";cursor:pointer}z-list.sc-z-select z-list-element.sc-z-select::after{position:absolute;z-index:100;top:5px;left:-15px;width:8px;height:100%;border-left:1px solid var(--color-form-disabled01-icon);content:"";cursor:pointer}z-list.sc-z-select z-list-element.sc-z-select:last-child::after{display:none}z-list.sc-z-select>z-list-element.sc-z-select::before,z-list.sc-z-select>z-list-element.sc-z-select::after,z-list.sc-z-select>z-list-group.sc-z-select>z-list-element.sc-z-select::before,z-list.sc-z-select>z-list-group.sc-z-select>z-list-element.sc-z-select::after{display:none}z-list.sc-z-select>div.children-node.sc-z-select{padding-left:calc(var(--space-unit) * 2)}z-list-element.grouped-tree-parent-node.sc-z-select{padding-top:0;padding-left:calc(var(--space-unit) * 2)}z-list-element.sc-z-select>.list-element.sc-z-select{display:flex;justify-content:space-between;padding:calc(var(--space-unit) * 1.25) 0;cursor:pointer}z-list-element.sc-z-select>.list-element.sc-z-select:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}z-list-element.sc-z-select>.list-element.sc-z-select .item.ellipsis.sc-z-select{overflow:hidden}z-list-element.sc-z-select .list-element.sc-z-select::after{position:absolute;top:0;right:-1px;display:block;width:100%;height:40px;content:"";transform:translateX(-100%)}z-list-element.tree-search-item.sc-z-select{padding-top:0}z-list-element.tree-search-item.sc-z-select .list-element.sc-z-select::after{position:absolute;top:8px;right:-25px;display:block;width:100%;height:40px;content:"";transform:translateX(-100%)}z-list-element.grouped-tree-parent-node.sc-z-select .list-element.sc-z-select::after{position:absolute;top:8px;right:-25px;display:block;width:100%;height:40px;content:"";transform:translateX(-100%)}z-list-element.sc-z-select:not([disabled])>.list-element.sc-z-select:hover,z-list-element.sc-z-select:not([disabled])>.list-element.sc-z-select:hover::after{z-index:-1;background-color:var(--color-form-surface03);cursor:pointer}.item-label.selected.sc-z-select{font-weight:bold}z-list-element.sc-z-select:focus{box-shadow:var(--shadow-focus-primary);outline:none}.item.ellipsis.sc-z-select{display:inline-block;overflow:hidden;max-width:100%;text-overflow:ellipsis;white-space:nowrap}z-list.sc-z-select>z-list-element.grouped-tree-parent-node.sc-z-select>.list-element.sc-z-select:hover::after,z-list-element.tree-search-item.sc-z-select .list-element.sc-z-select:hover::after,z-list.sc-z-select>z-list-group.sc-z-select>z-list-element.grouped-tree-parent-node.sc-z-select>.list-element.sc-z-select:hover::after{position:absolute;z-index:-1;top:8px;right:-18px;display:block;width:100%;height:40px;content:"";transform:translateX(-100%)}z-list-element.sc-z-select>.list-element.sc-z-select:hover::after{position:absolute;z-index:-1;top:0;right:0;display:block;width:100%;height:40px;content:"";transform:translateX(-100%)}.children-node.sc-z-select z-list-element.sc-z-select::before,.children-node.sc-z-select z-list-element.sc-z-select::after{left:-15px}.children-node.sc-z-select .children-node.sc-z-select z-list-element.sc-z-select::before,.children-node.sc-z-select .children-node.sc-z-select z-list-element.sc-z-select::after{left:-15px}.children-node.sc-z-select>z-list-element.sc-z-select{padding:0}';const u=p;const m=class{constructor(s){e(this,s);this.optionSelect=t(this,"optionSelect",7);this.resetSelect=t(this,"resetSelect",7);this.itemsList=[];this.itemIdKeyMap={};this.resetKey=-1;this.htmlid=`id-${o()}`;this.items=undefined;this.name=undefined;this.label=undefined;this.ariaLabel="";this.disabled=false;this.readonly=false;this.placeholder=undefined;this.htmltitle=undefined;this.status=undefined;this.message=true;this.autocomplete=false;this.noresultslabel="Nessun risultato";this.hasGroupItems=undefined;this.hasTreeItems=undefined;this.showChildrenOfMatchingParent=undefined;this.isfixed=false;this.resetItem=undefined;this.size=l.BIG;this.isOpen=false;this.selectedItem=null;this.focusedItemId=undefined;this.searchString=undefined;this.flattenedList=[];this.toggleSelectUl=this.toggleSelectUl.bind(this);this.handleSelectFocus=this.handleSelectFocus.bind(this)}watchItems(){this.itemsList=this.getInitialItemsArray();this.selectedItem=this.findSelectedItem(this.itemsList);this.flattenedList=this.flattenTreeItems(this.itemsList);this.itemIdKeyMap={};this.flattenedList.forEach((({item:e,key:t})=>{this.itemIdKeyMap[e.id]=t}))}getFocusedItemHandler(e){this.focusedItemId=e.target.id}async getSelectedItem(){return this.selectedItem}async getValue(){return this.getSelectedValue()}async setValue(e){let t=[];if(typeof e==="string"){t.push(e)}else{t=e}this.itemsList=this.getInitialItemsArray();if(t.length){this.updateSelection(this.itemsList,t[0])}this.selectedItem=this.findSelectedItem(this.itemsList)}emitOptionSelect(){this.optionSelect.emit({id:this.htmlid,selected:this.getSelectedValue()})}emitResetSelect(){this.resetSelect.emit({id:this.htmlid})}componentWillLoad(){this.watchItems()}componentWillRender(){this.filterItems(this.searchString)}getInitialItemsArray(){return typeof this.items==="string"?JSON.parse(this.items):this.items}mapSelectedItemToItemsArray(){const e=this.getInitialItemsArray();return e.map((e=>{var t;e.selected=e.id===((t=this.selectedItem)===null||t===void 0?void 0:t.id);return e}))}getSelectedValue(){var e;return(e=this.selectedItem)===null||e===void 0?void 0:e.id}filterItems(e){const t=this.mapSelectedItemToItemsArray();if(!(e===null||e===void 0?void 0:e.length)){this.itemsList=t;return}if(this.hasTreeItems){this.itemsList=this.filterTree(t,e,false)}else{this.itemsList=t.filter((t=>t.name.toUpperCase().includes(e.toUpperCase()))).map((t=>{t.name=this.getHighlightedText(t.name,e);return t}))}this.flattenedList=this.flattenTreeItems(this.itemsList);this.itemIdKeyMap={};this.flattenedList.forEach((({item:e,key:t})=>{this.itemIdKeyMap[e.id]=t}))}filterTree(e,t,s){if(!e){return[]}return e.map((e=>{const i=e.name.toUpperCase().includes(t.toUpperCase());const l=Object.assign({},e);if(l.children&&l.children.length>0){l.children=this.filterTree(l.children,t,i)}if(i){l.name=this.getHighlightedText(l.name,t)}if(i||l.children&&l.children.length>0||this.showChildrenOfMatchingParent&&s){return l}return null})).filter((e=>e!==null))}getHighlightedText(e,t){const s=e.toUpperCase();const i=t.toUpperCase();const l=s.indexOf(i);if(l===-1){return e}const c=l+t.length;return e.substring(0,l)+`<strong>${e.substring(l,c)}</strong>`+e.substring(c)}hasAutocomplete(){return a(this.autocomplete)===true}handleInputChange(e){this.searchString=e.detail.value;if(!this.isOpen){this.toggleSelectUl()}}updateSelection(e,t){if(e){e.forEach((e=>{e.selected=e.id===t;if(e.children&&e.children.length>0){this.updateSelection(e.children,t)}}))}}findSelectedItem(e){if(e){for(const t of e){if(t.selected){return t}if(t.children&&t.children.length>0){const e=this.findSelectedItem(t.children);if(e){return e}}}}return null}selectItem(e){if(e===null||e===void 0?void 0:e.disabled){return}this.itemsList=this.getInitialItemsArray();if(e){this.updateSelection(this.itemsList,e.id)}this.selectedItem=this.findSelectedItem(this.itemsList);this.emitOptionSelect();this.toggleSelectUl(true);if(this.searchString){this.searchString=null}}flattenTreeItems(e){const t=[];let s=0;const i=e=>{e.forEach((e=>{t.push({item:e,key:s++});if(e.children&&e.children.length>0){i(e.children)}}))};if(e){i(e)}return t}arrowsSelectNav(e,t){const s=this.resetItem&&!!this.selectedItem;const i=[c.ARROW_DOWN,c.ARROW_UP];if(!i.includes(e.key)){return}e.preventDefault();e.stopPropagation();const l=[...this.flattenedList].filter((e=>!e.item.disabled));if(this.resetItem&&s){l.unshift({item:{id:"__RESET_ITEM__"},key:this.resetKey})}let r;if(typeof t==="number"){r=l.findIndex((e=>e.key===t))}else{const e=this.itemIdKeyMap[t];r=l.findIndex((t=>t.key===e))}if(!this.isOpen){this.toggleSelectUl();if(r===-1){r=-1}}const n=l.length-1;let o=r;if(e.key===c.ARROW_DOWN){do{o=o===n?0:o+1}while(l[o].item.disabled)}else{do{o=o<=0?n:o-1}while(l[o].item.disabled)}this.focusSelectItem(l[o].key)}focusSelectItem(e){var t;(t=this.host.querySelector(`#${this.htmlid}_key_${e}`))===null||t===void 0?void 0:t.focus()}toggleSelectUl(e=false){var t;if(this.disabled||this.readonly){return}if(!this.isOpen){document.addEventListener("click",this.handleSelectFocus);document.addEventListener("keyup",this.handleSelectFocus)}else{document.removeEventListener("click",this.handleSelectFocus);document.removeEventListener("keyup",this.handleSelectFocus);if(e){(t=this.host.querySelector(`#${this.htmlid}_input`))===null||t===void 0?void 0:t.focus()}}this.focusedItemId="";this.isOpen=!this.isOpen}handleInputClick(e){if(e.target.closest(".reset-icon")){e.stopPropagation();return}this.toggleSelectUl()}handleSelectFocus(e){const t=z();if(t===null||t===void 0?void 0:t.hasAttribute("disabled")){return}if(e instanceof KeyboardEvent&&e.key===c.ESC){e.stopPropagation();return this.toggleSelectUl(true)}if(e instanceof KeyboardEvent&&(e.key===c.ENTER||e.key!==c.TAB)){return}if(!h(t).find((e=>e.nodeName.toLowerCase()==="z-input"&&e.id===`${this.htmlid}_input`))){this.toggleSelectUl(e instanceof MouseEvent)}}scrollToLetter(e){const t=this.itemsList.findIndex((t=>t.name.charAt(0)===e));if(t>-1){this.focusSelectItem(this.itemIdKeyMap[this.itemsList[t].id])}}renderInput(){return s("z-input",{class:{"active-select":this.isOpen,"cursor-select":!this.autocomplete},id:`${this.htmlid}_input`,htmlid:`${this.htmlid}_select_input`,placeholder:this.placeholder,value:!this.isOpen&&this.selectedItem?this.selectedItem.name.replace(/<[^>]+>/g,""):null,label:this.label,"aria-expanded":this.isOpen?"true":"false","aria-label":this.ariaLabel,"aria-controls":`${this.htmlid}_list`,"aria-autocomplete":this.hasAutocomplete()?"list":"none","aria-activedescendant":this.isOpen?this.focusedItemId:"",icon:this.isOpen?"caret-up":"caret-down",hasclearicon:this.hasAutocomplete(),message:false,name:this.name,disabled:this.disabled,readonly:this.readonly||!this.hasAutocomplete()&&this.isOpen,status:this.isOpen?undefined:this.status,role:"combobox",size:this.size,onClick:e=>{this.handleInputClick(e)},onKeyUp:e=>{if(e.key!==c.ENTER){e.preventDefault()}d(e,this.toggleSelectUl)},onKeyDown:e=>{const t=this.selectedItem?this.itemIdKeyMap[this.selectedItem.id]:this.resetItem?this.resetKey:"";return this.arrowsSelectNav(e,t)},onInputChange:e=>{this.handleInputChange(e)},onKeyPress:e=>{if(!this.hasAutocomplete()){e.preventDefault();this.scrollToLetter(String.fromCharCode(e.keyCode))}}})}renderSelectUl(){return s("div",{class:this.isOpen?"open":"closed"},s("div",{class:{"ul-scroll-wrapper":true,fixed:this.isfixed}},s("z-list",{role:"listbox","aria-label":this.ariaLabel||this.label,tabindex:this.disabled||this.readonly||!this.isOpen?-1:0,id:`${this.htmlid}_list`,"aria-multiselectable":false,size:this.listSizeType(),class:{disabled:this.disabled,readonly:this.readonly,[`input-${this.status}`]:!this.isOpen&&!!this.status,"z-scrollbar":true}},this.resetItem&&this.renderResetItem(),this.renderSelectUlItems())))}renderResetItem(){return s("z-list-element",{class:{hide:!this.selectedItem||!this.resetItem,"reset-item":true,"reset-item-margin":!this.hasGroupItems},clickable:true,disabled:false,dividerType:r.ELEMENT,role:"option",tabindex:"0","aria-selected":"false",id:`${this.htmlid}_key_${this.resetKey}`,size:this.hasTreeItems?n.MEDIUM:this.listSizeType(),onClickItem:()=>{this.selectedItem=null;this.searchString=null;this.emitResetSelect()},onKeyDown:e=>this.arrowsSelectNav(e,this.resetKey)},s("div",{class:{"reset-item-content":true,"tree-list-reset-item":this.hasTreeItems}},s("z-icon",{name:"multiply-circled"}),s("span",null,this.resetItem)))}renderItem(e,t){const i=this.itemIdKeyMap[e.id];return s("z-list-element",{clickable:!e.disabled,disabled:e.disabled,dividerType:t?r.HEADER:r.ELEMENT,role:"option",tabindex:e.disabled||!this.isOpen?-1:0,"aria-selected":e.selected?"true":"false",id:`${this.htmlid}_key_${i}`,size:this.listSizeType(),onClickItem:()=>this.selectItem(e),onKeyDown:e=>this.arrowsSelectNav(e,i)},s("div",{class:"list-element-container"},s("div",{class:{selected:!!e.selected,"list-element-content":true},innerHTML:e.name}),e.icon&&s("z-tag",{icon:e.icon})))}listSizeType(){if(this.hasTreeItems){return n.NONE}if(this.size===l.SMALL||this.size===l.X_SMALL){return n.SMALL}return n.MEDIUM}renderSelectUlItems(){if(!this.itemsList.length){return this.renderNoSearchResults()}if(this.hasGroupItems&&!this.hasTreeItems){return this.renderSelectGroupItems()}else if(this.hasGroupItems&&this.hasTreeItems){return this.renderGroupedTree()}return this.itemsList.map(((e,t,s)=>{const i=t===s.length-1;const l=s.length>1;if(this.hasTreeItems){return this.renderTreeItems(e,i,l,true)}return this.renderItem(e,i)}))}renderTreeItems(e,t,i,l){var n,o;const a=this.itemIdKeyMap[e.id];const h=this.hasGroupItems?undefined:this.hasGroupItems?t&&!i?r.ELEMENT:undefined:l&&i&&!t?r.ELEMENT:undefined;return s("z-list-element",{clickable:!e.disabled,disabled:e.disabled,class:{"grouped-tree-parent-node":this.hasGroupItems&&!!((n=e.children)===null||n===void 0?void 0:n.length),"tree-search-item":this.hasGroupItems&&l&&!((o=e.children)===null||o===void 0?void 0:o.length)&&!!this.searchString},size:this.listSizeType(),dividerType:h,hasTreeItems:this.hasTreeItems},s("div",{id:`${this.htmlid}_key_${a}`,role:"option",class:"list-element",tabIndex:0,onClick:()=>this.selectItem(e),onKeyDown:t=>{this.arrowsSelectNav(t,a);if(t.key===c.ENTER){this.selectItem(e)}}},s("span",{class:"item ellipsis"},s("span",{class:{"item-label":true,selected:!!e.selected},title:e.name,innerHTML:e.selected?`<strong>${e.name}</strong>`:e.name})),e.icon&&s("z-tag",{icon:e.icon})),e.children&&e.children.length>0?s("z-list",null,s("div",{class:"children-node"},e.children.map(((e,t,s)=>this.renderTreeItems(e,t===s.length-1,s.length>1,false))))):null)}renderGroupedTree(){const e=this.itemsList.reduce(((e,t)=>{const s=t.category||"Altra categoria";e[s]=e[s]||[];e[s].push(t);return e}),{});return Object.entries(e).map((([t,i],l,c)=>{const n=Object.values(e).some((e=>e.length>1));return s("z-list-group",{"divider-type":l===c.length-1?undefined:r.ELEMENT,hasTreeItems:true},s("span",{class:"body-3-sb z-list-group-title",slot:"header-title"},t),s("z-list",null,i.map(((e,t,i)=>[this.renderTreeItems(e,t===i.length-1,n,true),t<i.length-1?s("z-divider",{key:`divider-${t}`,style:{zIndex:"100",height:"var(--border-size-small)"}}):null]))),l!==c.length-1&&s("z-divider",{style:{zIndex:"100",height:"var(--border-size-small)"}}))}))}renderSelectGroupItems(){const e=this.itemsList.reduce(((e,t,s,i)=>{var l;const{category:c}=t;const r=i.length===s+1;const n=this.renderItem(t,r);e[c]=(l=e[c])!==null&&l!==void 0?l:[];e[c].push(n);return e}),{});return Object.entries(e).map((([e,t])=>s("z-list-group",{"divider-type":r.ELEMENT},s("span",{class:"body-3-sb z-list-group-title",slot:"header-title"},e),t.map((e=>e)))))}renderNoSearchResults(){return s("z-list-element",{color:"color-primary01",class:"no-results",size:this.hasTreeItems?n.MEDIUM:this.listSizeType()},s("z-icon",{name:"multiply-circle",fill:"color-primary01-icon"}),this.noresultslabel)}renderMessage(){if(a(this.message)===false){return}return s("z-input-message",{message:a(this.message)===true?undefined:this.message,status:this.status,class:this.size,disabled:this.disabled})}render(){return s("div",{key:"175046b438342ee0b6bae38a35a0c70f47cdc0f8",class:"select-wrapper"},this.renderInput(),this.renderSelectUl(),this.renderMessage())}get host(){return i(this)}static get watchers(){return{items:["watchItems"]}}};m.style=u;export{m as z_select};
2
- //# sourceMappingURL=p-da30a6cb.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZSelectStyle0","ZSelect","constructor","hostRef","this","itemsList","itemIdKeyMap","resetKey","randomId","ControlSize","BIG","toggleSelectUl","bind","handleSelectFocus","watchItems","getInitialItemsArray","selectedItem","findSelectedItem","flattenedList","flattenTreeItems","forEach","item","key","id","getFocusedItemHandler","e","focusedItemId","target","getSelectedItem","getValue","getSelectedValue","setValue","value","values","push","length","updateSelection","emitOptionSelect","optionSelect","emit","htmlid","selected","emitResetSelect","resetSelect","componentWillLoad","componentWillRender","filterItems","searchString","items","JSON","parse","mapSelectedItemToItemsArray","initialItemsList","map","_a","prevList","hasTreeItems","filterTree","filter","name","toUpperCase","includes","getHighlightedText","matchingParent","match","newItem","Object","assign","children","showChildrenOfMatchingParent","text","search","upperText","upperSearch","start","indexOf","end","substring","hasAutocomplete","boolean","autocomplete","handleInputChange","detail","isOpen","selectedId","found","selectItem","disabled","flatItems","index","flatten","subItems","itm","arrowsSelectNav","idOrReset","showResetIcon","resetItem","arrows","KeyboardCode","ARROW_DOWN","ARROW_UP","preventDefault","stopPropagation","f","unshift","currentIndex","findIndex","k","lastIndex","newIndex","focusSelectItem","host","querySelector","focus","selfFocusOnClose","readonly","document","addEventListener","removeEventListener","handleInputClick","closest","clickedElement","getClickedElement","hasAttribute","KeyboardEvent","ESC","ENTER","TAB","getElementTree","find","elem","nodeName","toLowerCase","MouseEvent","scrollToLetter","letter","foundItem","charAt","renderInput","h","class","placeholder","replace","label","ariaLabel","icon","hasclearicon","message","status","undefined","role","size","onClick","onKeyUp","handleKeyboardSubmit","onKeyDown","current","onInputChange","onKeyPress","String","fromCharCode","keyCode","renderSelectUl","fixed","isfixed","tabindex","listSizeType","renderResetItem","renderSelectUlItems","hide","hasGroupItems","clickable","dividerType","ListDividerType","ELEMENT","ListSize","MEDIUM","onClickItem","renderItem","lastItem","thisItemKey","HEADER","innerHTML","NONE","SMALL","X_SMALL","renderNoSearchResults","renderSelectGroupItems","renderGroupedTree","array","isLastItem","parentHasSiblings","renderTreeItems","isLastChild","isTopLevel","hasDivider","_b","tabIndex","title","child","arr","grouped","reduce","acc","category","entries","some","groupItems","slot","i","style","zIndex","height","newData","group","zListItem","color","fill","noresultslabel","renderMessage","render"],"sources":["src/components/z-select/styles.css?tag=z-select&encapsulation=scoped","src/components/z-select/index.tsx"],"sourcesContent":[":host {\n display: inline-block;\n width: inherit;\n color: var(--color-form-default-text);\n font-family: var(--font-family-sans);\n font-size: var(--font-size-3);\n font-weight: var(--font-rg);\n}\n\n:host([size=\"small\"]),\n:host([size=\"x-small\"]) {\n font-size: var(--font-size-2);\n}\n\n.select-wrapper > z-input {\n width: 100%;\n}\n\n.select-wrapper > z-input .input-icon {\n cursor: pointer;\n}\n\n.select-wrapper > div {\n position: relative;\n}\n\n.select-wrapper > div.closed {\n overflow: hidden;\n height: 0;\n}\n\n.select-wrapper .ul-scroll-wrapper {\n position: absolute;\n width: 100%;\n box-sizing: border-box;\n border-top: none;\n background: var(--color-form-background);\n box-shadow: var(--shadow-2);\n outline: none;\n}\n\n.select-wrapper .closed .ul-scroll-wrapper {\n z-index: 10;\n}\n\n.select-wrapper .open .ul-scroll-wrapper {\n z-index: 20;\n}\n\n.select-wrapper .ul-scroll-wrapper.fixed {\n position: static;\n}\n\n.select-wrapper z-list {\n --background-color-list-element: var(--color-form-background);\n --background-hover-color-list-element: var(--color-form-surface03);\n --background-active-color-list-element: var(--color-form-surface03);\n}\n\n.select-wrapper .ul-scroll-wrapper > z-list {\n position: relative;\n overflow: auto;\n max-height: 240px;\n padding: 0 calc(var(--space-unit) * 1.5);\n outline: none;\n}\n\n.select-wrapper .ul-scroll-wrapper z-list z-list-element[disabled] {\n color: var(--color-form-disabled03);\n}\n\n.select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container {\n display: flex;\n align-items: center;\n padding: calc(var(--space-unit) / 2) var(--space-unit);\n column-gap: var(--space-unit);\n}\n\n.select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container .list-element-content {\n margin-right: auto;\n}\n\n.select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container > z-icon + .list-element-content {\n padding: calc(var(--space-unit) * 0.5) var(--space-unit);\n}\n\n:host([size=\"x-small\"])\n .select-wrapper\n .ul-scroll-wrapper\n z-list\n z-list-element\n .list-element-container\n .list-element-content {\n padding: 0;\n}\n\n:host([size=\"small\"]) .select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container > z-icon {\n --z-icon-width: 16px;\n --z-icon-height: 16px;\n}\n\n:host([size=\"x-small\"]) .select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container > z-icon {\n --z-icon-width: 14px;\n --z-icon-height: 14px;\n}\n\n:host([size=\"x-small\"])\n .select-wrapper\n .ul-scroll-wrapper\n z-list\n z-list-element\n .list-element-container\n > z-icon\n + .list-element-content {\n padding: 0 var(--space-unit);\n}\n\n.select-wrapper .ul-scroll-wrapper z-list z-list-element .list-element-container .list-element-content.selected {\n font-weight: var(--font-sb);\n}\n\n.select-wrapper .ul-scroll-wrapper .no-results z-icon {\n margin-right: var(--space-unit);\n}\n\n.z-list-group-title {\n color: var(--color-form-default-text);\n}\n\n.reset-item {\n color: var(--color-form-active-primary);\n fill: var(--color-form-active-primary);\n}\n\n.reset-item-content {\n display: flex;\n align-items: center;\n}\n\n.reset-item.reset-item-margin .reset-item-content {\n margin-left: var(--space-unit);\n}\n\n.reset-item .reset-item-content > z-icon {\n margin-right: var(--space-unit);\n}\n\n.reset-item.hide {\n display: none;\n}\n\n.tree-list-reset-item {\n padding: var(--space-unit) 0;\n}\n\nz-list-element {\n position: relative;\n display: block;\n}\n\nz-list z-list-element::before {\n position: absolute;\n z-index: 100;\n top: 3px;\n left: -15px;\n width: 8px;\n height: 1em;\n border-bottom: 1px solid var(--color-form-disabled01-icon);\n border-left: 1px solid var(--color-form-disabled01-icon);\n content: \"\";\n cursor: pointer;\n}\n\nz-list z-list-element::after {\n position: absolute;\n z-index: 100;\n top: 5px;\n left: -15px;\n width: 8px;\n height: 100%;\n border-left: 1px solid var(--color-form-disabled01-icon);\n content: \"\";\n cursor: pointer;\n}\n\nz-list z-list-element:last-child::after {\n display: none;\n}\n\nz-list > z-list-element::before,\nz-list > z-list-element::after,\nz-list > z-list-group > z-list-element::before,\nz-list > z-list-group > z-list-element::after {\n display: none;\n}\n\nz-list > div.children-node {\n padding-left: calc(var(--space-unit) * 2);\n}\n\nz-list-element.grouped-tree-parent-node {\n padding-top: 0;\n padding-left: calc(var(--space-unit) * 2);\n}\n\nz-list-element > .list-element {\n display: flex;\n justify-content: space-between;\n padding: calc(var(--space-unit) * 1.25) 0;\n cursor: pointer;\n}\n\nz-list-element > .list-element:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\nz-list-element > .list-element .item.ellipsis {\n overflow: hidden;\n}\n\nz-list-element .list-element::after {\n position: absolute;\n top: 0;\n right: -1px;\n display: block;\n width: 100%;\n height: 40px;\n content: \"\";\n transform: translateX(-100%);\n}\n\nz-list-element.tree-search-item {\n padding-top: 0;\n}\n\nz-list-element.tree-search-item .list-element::after {\n position: absolute;\n top: 8px;\n right: -25px;\n display: block;\n width: 100%;\n height: 40px;\n content: \"\";\n transform: translateX(-100%);\n}\n\nz-list-element.grouped-tree-parent-node .list-element::after {\n position: absolute;\n top: 8px;\n right: -25px;\n display: block;\n width: 100%;\n height: 40px;\n content: \"\";\n transform: translateX(-100%);\n}\n\nz-list-element:not([disabled]) > .list-element:hover,\nz-list-element:not([disabled]) > .list-element:hover::after {\n z-index: -1;\n background-color: var(--color-form-surface03);\n cursor: pointer;\n}\n\n.item-label.selected {\n font-weight: bold;\n}\n\nz-list-element:focus {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n.item.ellipsis {\n display: inline-block;\n overflow: hidden;\n max-width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\nz-list > z-list-element.grouped-tree-parent-node > .list-element:hover::after,\nz-list-element.tree-search-item .list-element:hover::after,\nz-list > z-list-group > z-list-element.grouped-tree-parent-node > .list-element:hover::after {\n position: absolute;\n z-index: -1;\n top: 8px;\n right: -18px;\n display: block;\n width: 100%;\n height: 40px;\n content: \"\";\n transform: translateX(-100%);\n}\n\nz-list-element > .list-element:hover::after {\n position: absolute;\n z-index: -1;\n top: 0;\n right: 0;\n display: block;\n width: 100%;\n height: 40px;\n content: \"\";\n transform: translateX(-100%);\n}\n\n.children-node z-list-element::before,\n.children-node z-list-element::after {\n left: -15px;\n}\n\n.children-node .children-node z-list-element::before,\n.children-node .children-node z-list-element::after {\n left: -15px;\n}\n\n.children-node > z-list-element {\n padding: 0;\n}\n","import {Component, Element, Event, EventEmitter, Listen, Method, Prop, State, Watch, h} from \"@stencil/core\";\nimport {ControlSize, InputStatus, KeyboardCode, ListDividerType, ListSize, SelectItem} from \"../../beans\";\nimport {boolean, getClickedElement, getElementTree, handleKeyboardSubmit, randomId} from \"../../utils/utils\";\n\n@Component({\n tag: \"z-select\",\n styleUrl: \"styles.css\",\n shadow: false,\n scoped: true,\n})\nexport class ZSelect {\n @Element() host: HTMLZSelectElement;\n\n /** the id of the input element */\n @Prop()\n htmlid = `id-${randomId()}`;\n\n /** the input select options */\n @Prop()\n items: SelectItem[] | string;\n\n /** the input name */\n @Prop()\n name?: string;\n\n /** the input label */\n @Prop()\n label?: string;\n\n /** the input aria-label */\n @Prop()\n ariaLabel = \"\";\n\n /** the input is disabled */\n @Prop()\n disabled?: boolean = false;\n\n /** the input is readonly */\n @Prop()\n readonly?: boolean = false;\n\n /** the input placeholder (optional) */\n @Prop()\n placeholder?: string;\n\n /** the input html title (optional) */\n @Prop()\n htmltitle?: string;\n\n /** the input status (optional) */\n @Prop()\n status?: InputStatus;\n\n /** input helper message (optional) - if set to `false` message won't be displayed */\n @Prop()\n message?: string | boolean = true;\n\n /** the input has autocomplete option */\n @Prop()\n autocomplete?: boolean = false;\n\n /** no result text message */\n @Prop()\n noresultslabel?: string = \"Nessun risultato\";\n\n /** */\n @Prop()\n hasGroupItems?: boolean;\n\n /** */\n @Prop()\n hasTreeItems?: boolean;\n\n /** If true and an item matches the search string, children of matching item are shown even if they don't match the search string */\n @Prop()\n showChildrenOfMatchingParent?: boolean;\n\n /** When fixed, it occupies space and pushes down next elements. */\n @Prop()\n isfixed?: boolean = false;\n\n /** */\n @Prop()\n resetItem?: string;\n\n /** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */\n @Prop()\n size?: ControlSize = ControlSize.BIG;\n\n @State()\n isOpen = false;\n\n @State()\n selectedItem: null | SelectItem = null;\n\n @State()\n focusedItemId: string;\n\n @State()\n searchString: null | string;\n\n @State()\n private flattenedList: {item: SelectItem; key: number}[] = [];\n\n private itemsList: SelectItem[] = [];\n\n private itemIdKeyMap: Record<string, number> = {};\n\n private readonly resetKey = -1;\n\n constructor() {\n this.toggleSelectUl = this.toggleSelectUl.bind(this);\n this.handleSelectFocus = this.handleSelectFocus.bind(this);\n }\n\n @Watch(\"items\")\n watchItems(): void {\n this.itemsList = this.getInitialItemsArray();\n\n this.selectedItem = this.findSelectedItem(this.itemsList);\n\n this.flattenedList = this.flattenTreeItems(this.itemsList);\n this.itemIdKeyMap = {};\n this.flattenedList.forEach(({item, key}) => {\n this.itemIdKeyMap[item.id] = key;\n });\n }\n\n @Listen(\"ariaDescendantFocus\")\n getFocusedItemHandler(e: CustomEvent): void {\n this.focusedItemId = (e.target as Element).id;\n }\n\n /** get the input selected options */\n @Method()\n async getSelectedItem(): Promise<SelectItem> {\n return this.selectedItem;\n }\n\n /** get the input value */\n @Method()\n async getValue(): Promise<string> {\n return this.getSelectedValue();\n }\n\n /** set the input value */\n @Method()\n async setValue(value: string | string[]): Promise<void> {\n let values: string[] = [];\n if (typeof value === \"string\") {\n values.push(value);\n } else {\n values = value;\n }\n\n this.itemsList = this.getInitialItemsArray();\n if (values.length) {\n this.updateSelection(this.itemsList, values[0]);\n }\n this.selectedItem = this.findSelectedItem(this.itemsList);\n }\n\n /** Emitted on select option selection, returns select id, selected item id */\n @Event()\n optionSelect: EventEmitter;\n\n private emitOptionSelect(): void {\n this.optionSelect.emit({\n id: this.htmlid,\n selected: this.getSelectedValue(),\n });\n }\n\n /** Emitted on reset selected item, returns select id, selected item id */\n @Event()\n resetSelect: EventEmitter;\n\n private emitResetSelect(): void {\n this.resetSelect.emit({\n id: this.htmlid,\n });\n }\n\n componentWillLoad(): void {\n this.watchItems();\n }\n\n componentWillRender(): void {\n this.filterItems(this.searchString);\n }\n\n private getInitialItemsArray(): SelectItem[] {\n return typeof this.items === \"string\" ? JSON.parse(this.items) : this.items;\n }\n\n private mapSelectedItemToItemsArray(): SelectItem[] {\n const initialItemsList = this.getInitialItemsArray();\n\n return initialItemsList.map((item: SelectItem) => {\n item.selected = item.id === this.selectedItem?.id;\n\n return item;\n });\n }\n\n private getSelectedValue(): string {\n return this.selectedItem?.id;\n }\n\n private filterItems(searchString: string): void {\n const prevList = this.mapSelectedItemToItemsArray();\n\n if (!searchString?.length) {\n this.itemsList = prevList;\n\n return;\n }\n\n if (this.hasTreeItems) {\n this.itemsList = this.filterTree(prevList, searchString, false);\n } else {\n this.itemsList = prevList\n .filter((item: SelectItem) => item.name.toUpperCase().includes(searchString.toUpperCase()))\n .map((item: SelectItem) => {\n item.name = this.getHighlightedText(item.name, searchString);\n\n return item;\n });\n }\n\n this.flattenedList = this.flattenTreeItems(this.itemsList);\n this.itemIdKeyMap = {};\n this.flattenedList.forEach(({item, key}) => {\n this.itemIdKeyMap[item.id] = key;\n });\n }\n\n private filterTree(items: SelectItem[], searchString: string, matchingParent: boolean): SelectItem[] {\n if (!items) {\n return [];\n }\n\n return items\n .map((item) => {\n const match = item.name.toUpperCase().includes(searchString.toUpperCase());\n\n const newItem: SelectItem = {...item};\n if (newItem.children && newItem.children.length > 0) {\n newItem.children = this.filterTree(newItem.children, searchString, match);\n }\n\n if (match) {\n newItem.name = this.getHighlightedText(newItem.name, searchString);\n }\n if (\n match ||\n (newItem.children && newItem.children.length > 0) ||\n (this.showChildrenOfMatchingParent && matchingParent)\n ) {\n return newItem;\n }\n\n return null;\n })\n .filter((item) => item !== null) as SelectItem[];\n }\n\n private getHighlightedText(text: string, search: string): string {\n const upperText = text.toUpperCase();\n const upperSearch = search.toUpperCase();\n const start = upperText.indexOf(upperSearch);\n\n if (start === -1) {\n return text;\n }\n\n const end = start + search.length;\n\n return text.substring(0, start) + `<strong>${text.substring(start, end)}</strong>` + text.substring(end);\n }\n\n private hasAutocomplete(): boolean {\n return boolean(this.autocomplete) === true;\n }\n\n private handleInputChange(e: CustomEvent): void {\n this.searchString = e.detail.value;\n if (!this.isOpen) {\n this.toggleSelectUl();\n }\n }\n\n private updateSelection(items: SelectItem[], selectedId: string): void {\n if (items) {\n items.forEach((item) => {\n item.selected = item.id === selectedId;\n if (item.children && item.children.length > 0) {\n this.updateSelection(item.children, selectedId);\n }\n });\n }\n }\n\n private findSelectedItem(items: SelectItem[]): SelectItem | null {\n if (items) {\n for (const item of items) {\n if (item.selected) {\n return item;\n }\n if (item.children && item.children.length > 0) {\n const found = this.findSelectedItem(item.children);\n if (found) {\n return found;\n }\n }\n }\n }\n\n return null;\n }\n\n private selectItem(selected: null | SelectItem): void {\n if (selected?.disabled) {\n return;\n }\n\n this.itemsList = this.getInitialItemsArray();\n\n if (selected) {\n this.updateSelection(this.itemsList, selected.id);\n }\n\n this.selectedItem = this.findSelectedItem(this.itemsList);\n this.emitOptionSelect();\n this.toggleSelectUl(true);\n\n if (this.searchString) {\n this.searchString = null;\n }\n }\n\n private flattenTreeItems(items: SelectItem[]): {item: SelectItem; key: number}[] {\n const flatItems: {item: SelectItem; key: number}[] = [];\n let index = 0;\n\n const flatten = (subItems: SelectItem[]): void => {\n subItems.forEach((itm) => {\n flatItems.push({item: itm, key: index++});\n if (itm.children && itm.children.length > 0) {\n flatten(itm.children);\n }\n });\n };\n\n if (items) {\n flatten(items);\n }\n\n return flatItems;\n }\n\n private arrowsSelectNav(e: KeyboardEvent, idOrReset: string | number): void {\n const showResetIcon = this.resetItem && !!this.selectedItem;\n const arrows = [KeyboardCode.ARROW_DOWN, KeyboardCode.ARROW_UP];\n\n if (!arrows.includes(e.key as KeyboardCode)) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n const flatItems = [...this.flattenedList].filter((f) => !f.item.disabled);\n\n if (this.resetItem && showResetIcon) {\n flatItems.unshift({\n item: {id: \"__RESET_ITEM__\"} as SelectItem,\n key: this.resetKey,\n });\n }\n\n let currentIndex: number;\n if (typeof idOrReset === \"number\") {\n currentIndex = flatItems.findIndex((f) => f.key === idOrReset);\n } else {\n const k = this.itemIdKeyMap[idOrReset];\n currentIndex = flatItems.findIndex((f) => f.key === k);\n }\n\n if (!this.isOpen) {\n this.toggleSelectUl();\n\n if (currentIndex === -1) {\n currentIndex = -1;\n }\n }\n\n const lastIndex = flatItems.length - 1;\n\n let newIndex = currentIndex;\n\n if (e.key === KeyboardCode.ARROW_DOWN) {\n do {\n newIndex = newIndex === lastIndex ? 0 : newIndex + 1;\n } while (flatItems[newIndex].item.disabled);\n } else {\n do {\n newIndex = newIndex <= 0 ? lastIndex : newIndex - 1;\n } while (flatItems[newIndex].item.disabled);\n }\n\n this.focusSelectItem(flatItems[newIndex].key);\n }\n\n private focusSelectItem(key: number): void {\n this.host.querySelector<HTMLDivElement>(`#${this.htmlid}_key_${key}`)?.focus();\n }\n\n private toggleSelectUl(selfFocusOnClose = false): void {\n if (this.disabled || this.readonly) {\n return;\n }\n\n if (!this.isOpen) {\n document.addEventListener(\"click\", this.handleSelectFocus);\n document.addEventListener(\"keyup\", this.handleSelectFocus);\n } else {\n document.removeEventListener(\"click\", this.handleSelectFocus);\n document.removeEventListener(\"keyup\", this.handleSelectFocus);\n if (selfFocusOnClose) {\n (this.host.querySelector(`#${this.htmlid}_input`) as HTMLInputElement)?.focus();\n }\n }\n\n this.focusedItemId = \"\";\n this.isOpen = !this.isOpen;\n }\n\n private handleInputClick(e: MouseEvent | KeyboardEvent): void {\n if ((e.target as HTMLElement).closest(\".reset-icon\")) {\n e.stopPropagation();\n\n return;\n }\n\n this.toggleSelectUl();\n }\n\n private handleSelectFocus(e: MouseEvent | KeyboardEvent): void {\n const clickedElement = getClickedElement();\n if (clickedElement?.hasAttribute(\"disabled\")) {\n return;\n }\n\n if (e instanceof KeyboardEvent && e.key === KeyboardCode.ESC) {\n e.stopPropagation();\n\n return this.toggleSelectUl(true);\n }\n\n if (e instanceof KeyboardEvent && (e.key === KeyboardCode.ENTER || e.key !== KeyboardCode.TAB)) {\n return;\n }\n\n if (\n !getElementTree(clickedElement).find(\n (elem: HTMLElement) => elem.nodeName.toLowerCase() === \"z-input\" && elem.id === `${this.htmlid}_input`\n )\n ) {\n this.toggleSelectUl(e instanceof MouseEvent);\n }\n }\n\n private scrollToLetter(letter: string): void {\n const foundItem = this.itemsList.findIndex((item: SelectItem) => item.name.charAt(0) === letter);\n if (foundItem > -1) {\n this.focusSelectItem(this.itemIdKeyMap[this.itemsList[foundItem].id]);\n }\n }\n\n private renderInput(): HTMLZInputElement {\n return (\n <z-input\n class={{\n \"active-select\": this.isOpen,\n \"cursor-select\": !this.autocomplete,\n }}\n id={`${this.htmlid}_input`}\n htmlid={`${this.htmlid}_select_input`}\n placeholder={this.placeholder}\n value={!this.isOpen && this.selectedItem ? this.selectedItem.name.replace(/<[^>]+>/g, \"\") : null}\n label={this.label}\n aria-expanded={this.isOpen ? \"true\" : \"false\"}\n aria-label={this.ariaLabel}\n aria-controls={`${this.htmlid}_list`}\n aria-autocomplete={this.hasAutocomplete() ? \"list\" : \"none\"}\n aria-activedescendant={this.isOpen ? this.focusedItemId : \"\"}\n icon={this.isOpen ? \"caret-up\" : \"caret-down\"}\n hasclearicon={this.hasAutocomplete()}\n message={false}\n name={this.name}\n disabled={this.disabled}\n readonly={this.readonly || (!this.hasAutocomplete() && this.isOpen)}\n status={this.isOpen ? undefined : this.status}\n role=\"combobox\"\n size={this.size}\n onClick={(e: MouseEvent) => {\n this.handleInputClick(e);\n }}\n onKeyUp={(e: KeyboardEvent) => {\n if (e.key !== KeyboardCode.ENTER) {\n e.preventDefault();\n }\n handleKeyboardSubmit(e, this.toggleSelectUl);\n }}\n onKeyDown={(e: KeyboardEvent) => {\n const current = this.selectedItem\n ? this.itemIdKeyMap[this.selectedItem.id]\n : this.resetItem\n ? this.resetKey\n : \"\";\n\n return this.arrowsSelectNav(e, current);\n }}\n onInputChange={(e: CustomEvent) => {\n this.handleInputChange(e);\n }}\n onKeyPress={(e: KeyboardEvent) => {\n if (!this.hasAutocomplete()) {\n e.preventDefault();\n this.scrollToLetter(String.fromCharCode(e.keyCode));\n }\n }}\n />\n );\n }\n\n private renderSelectUl(): HTMLDivElement {\n return (\n <div class={this.isOpen ? \"open\" : \"closed\"}>\n <div\n class={{\n \"ul-scroll-wrapper\": true,\n \"fixed\": this.isfixed,\n }}\n >\n <z-list\n role=\"listbox\"\n aria-label={this.ariaLabel || this.label}\n tabindex={this.disabled || this.readonly || !this.isOpen ? -1 : 0}\n id={`${this.htmlid}_list`}\n aria-multiselectable={false}\n size={this.listSizeType()}\n class={{\n \"disabled\": this.disabled,\n \"readonly\": this.readonly,\n [`input-${this.status}`]: !this.isOpen && !!this.status,\n \"z-scrollbar\": true,\n }}\n >\n {this.resetItem && this.renderResetItem()}\n {this.renderSelectUlItems()}\n </z-list>\n </div>\n </div>\n );\n }\n\n private renderResetItem(): HTMLZListElementElement {\n return (\n <z-list-element\n class={{\n \"hide\": !this.selectedItem || !this.resetItem,\n \"reset-item\": true,\n \"reset-item-margin\": !this.hasGroupItems,\n }}\n clickable={true}\n disabled={false}\n dividerType={ListDividerType.ELEMENT}\n role=\"option\"\n tabindex=\"0\"\n aria-selected=\"false\"\n id={`${this.htmlid}_key_${this.resetKey}`}\n size={this.hasTreeItems ? ListSize.MEDIUM : this.listSizeType()}\n onClickItem={() => {\n this.selectedItem = null;\n this.searchString = null;\n this.emitResetSelect();\n }}\n onKeyDown={(e: KeyboardEvent) => this.arrowsSelectNav(e, this.resetKey)}\n >\n <div\n class={{\n \"reset-item-content\": true,\n \"tree-list-reset-item\": this.hasTreeItems,\n }}\n >\n <z-icon name=\"multiply-circled\" />\n <span>{this.resetItem}</span>\n </div>\n </z-list-element>\n );\n }\n\n private renderItem(item: SelectItem, lastItem: boolean): HTMLZListElementElement {\n const thisItemKey = this.itemIdKeyMap[item.id];\n\n return (\n <z-list-element\n clickable={!item.disabled}\n disabled={item.disabled}\n dividerType={lastItem ? ListDividerType.HEADER : ListDividerType.ELEMENT}\n role=\"option\"\n tabindex={item.disabled || !this.isOpen ? -1 : 0}\n aria-selected={item.selected ? \"true\" : \"false\"}\n id={`${this.htmlid}_key_${thisItemKey}`}\n size={this.listSizeType()}\n onClickItem={() => this.selectItem(item)}\n onKeyDown={(e: KeyboardEvent) => this.arrowsSelectNav(e, thisItemKey)}\n >\n <div class=\"list-element-container\">\n <div\n class={{\n \"selected\": !!item.selected,\n \"list-element-content\": true,\n }}\n innerHTML={item.name}\n />\n {item.icon && <z-tag icon={item.icon}></z-tag>}\n </div>\n </z-list-element>\n );\n }\n\n private listSizeType(): ListSize {\n if (this.hasTreeItems) {\n return ListSize.NONE;\n }\n\n if (this.size === ControlSize.SMALL || this.size === ControlSize.X_SMALL) {\n return ListSize.SMALL;\n }\n\n return ListSize.MEDIUM;\n }\n\n //eslint-disable-next-line\n private renderSelectUlItems(): any {\n if (!this.itemsList.length) {\n return this.renderNoSearchResults();\n }\n\n if (this.hasGroupItems && !this.hasTreeItems) {\n return this.renderSelectGroupItems();\n } else if (this.hasGroupItems && this.hasTreeItems) {\n return this.renderGroupedTree();\n }\n\n return this.itemsList.map((item: SelectItem, index, array) => {\n const isLastItem = index === array.length - 1;\n const parentHasSiblings = array.length > 1;\n\n if (this.hasTreeItems) {\n return this.renderTreeItems(item, isLastItem, parentHasSiblings, true);\n }\n\n return this.renderItem(item, isLastItem);\n });\n }\n\n private renderTreeItems(\n item: SelectItem,\n isLastChild: boolean,\n parentHasSiblings: boolean,\n isTopLevel?: boolean\n ): HTMLZListElementElement[] {\n const thisItemKey = this.itemIdKeyMap[item.id];\n\n const hasDivider = this.hasGroupItems\n ? undefined\n : this.hasGroupItems\n ? isLastChild && !parentHasSiblings\n ? ListDividerType.ELEMENT\n : undefined\n : isTopLevel && parentHasSiblings && !isLastChild\n ? ListDividerType.ELEMENT\n : undefined;\n\n return (\n <z-list-element\n clickable={!item.disabled}\n disabled={item.disabled}\n class={{\n \"grouped-tree-parent-node\": this.hasGroupItems && !!item.children?.length,\n \"tree-search-item\": this.hasGroupItems && isTopLevel && !item.children?.length && !!this.searchString,\n }}\n size={this.listSizeType()}\n dividerType={hasDivider}\n hasTreeItems={this.hasTreeItems}\n >\n <div\n id={`${this.htmlid}_key_${thisItemKey}`}\n role=\"option\"\n class=\"list-element\"\n tabIndex={0}\n onClick={() => this.selectItem(item)}\n onKeyDown={(e: KeyboardEvent) => {\n this.arrowsSelectNav(e, thisItemKey);\n if (e.key === KeyboardCode.ENTER) {\n this.selectItem(item);\n }\n }}\n >\n <span class=\"item ellipsis\">\n <span\n class={{\n \"item-label\": true,\n \"selected\": !!item.selected,\n }}\n title={item.name}\n innerHTML={item.selected ? `<strong>${item.name}</strong>` : item.name}\n />\n </span>\n {item.icon && <z-tag icon={item.icon}></z-tag>}\n </div>\n {item.children && item.children.length > 0 ? (\n <z-list>\n <div class=\"children-node\">\n {item.children.map((child, index, arr) =>\n this.renderTreeItems(\n child,\n index === arr.length - 1,\n arr.length > 1,\n false // isTopLevel = false for children\n )\n )}\n </div>\n </z-list>\n ) : null}\n </z-list-element>\n );\n }\n\n private renderGroupedTree(): HTMLZListGroupElement[] {\n const grouped = this.itemsList.reduce(\n (acc, item) => {\n const category = item.category || \"Altra categoria\";\n acc[category] = acc[category] || [];\n acc[category].push(item);\n\n return acc;\n },\n {} as Record<string, SelectItem[]>\n );\n\n return Object.entries(grouped).map(([category, items], index, entries) => {\n const parentHasSiblings = Object.values(grouped).some((groupItems) => groupItems.length > 1);\n // const parentHasSiblings = items.length > 1;\n\n return (\n <z-list-group\n divider-type={index === entries.length - 1 ? undefined : ListDividerType.ELEMENT}\n hasTreeItems={true}\n >\n <span\n class=\"body-3-sb z-list-group-title\"\n slot=\"header-title\"\n >\n {category}\n </span>\n <z-list>\n {items.map((item, i, arr) => [\n this.renderTreeItems(item, i === arr.length - 1, parentHasSiblings, true),\n i < arr.length - 1 ? (\n <z-divider\n key={`divider-${i}`}\n style={{zIndex: \"100\", height: \"var(--border-size-small)\"}}\n />\n ) : null,\n ])}\n </z-list>\n {index !== entries.length - 1 && <z-divider style={{zIndex: \"100\", height: \"var(--border-size-small)\"}} />}\n </z-list-group>\n );\n });\n }\n\n private renderSelectGroupItems(): HTMLZListElementElement[] {\n const newData = this.itemsList.reduce(\n (group, item, index, array) => {\n const {category} = item;\n const lastItem = array.length === index + 1;\n const zListItem = this.renderItem(item, lastItem);\n\n group[category] = group[category] ?? [];\n group[category].push(zListItem);\n\n return group;\n },\n {} as Record<string, HTMLZListElementElement[]>\n );\n\n return Object.entries(newData).map(([key, value]) => {\n return (\n <z-list-group divider-type={ListDividerType.ELEMENT}>\n <span\n class=\"body-3-sb z-list-group-title\"\n slot=\"header-title\"\n >\n {key}\n </span>\n {value.map((item) => item)}\n </z-list-group>\n );\n });\n }\n\n private renderNoSearchResults(): HTMLZListElementElement {\n return (\n <z-list-element\n color=\"color-primary01\"\n class=\"no-results\"\n size={this.hasTreeItems ? ListSize.MEDIUM : this.listSizeType()}\n >\n <z-icon\n name=\"multiply-circle\"\n fill=\"color-primary01-icon\"\n />\n {this.noresultslabel}\n </z-list-element>\n );\n }\n\n private renderMessage(): HTMLZInputMessageElement {\n if (boolean(this.message) === false) {\n return;\n }\n\n return (\n <z-input-message\n message={boolean(this.message) === true ? undefined : (this.message as string)}\n status={this.status}\n class={this.size}\n disabled={this.disabled}\n />\n );\n }\n\n render(): HTMLDivElement {\n return (\n <div class=\"select-wrapper\">\n {this.renderInput()}\n {this.renderSelectUl()}\n {this.renderMessage()}\n </div>\n );\n }\n}\n"],"mappings":"qMAAA,MAAMA,EAAY,6gPAClB,MAAAC,EAAeD,E,MCSFE,EAAO,MAoGlB,WAAAC,CAAAC,G,8FANQC,KAAAC,UAA0B,GAE1BD,KAAAE,aAAuC,GAE9BF,KAAAG,UAAY,E,YA7FpB,MAAMC,M,6EAgBH,G,cAIS,M,cAIA,M,uFAgBQ,K,kBAIJ,M,oBAIC,mB,kHAgBN,M,mCAQCC,EAAYC,I,YAGxB,M,kBAGyB,K,4EASyB,GASzDN,KAAKO,eAAiBP,KAAKO,eAAeC,KAAKR,MAC/CA,KAAKS,kBAAoBT,KAAKS,kBAAkBD,KAAKR,K,CAIvD,UAAAU,GACEV,KAAKC,UAAYD,KAAKW,uBAEtBX,KAAKY,aAAeZ,KAAKa,iBAAiBb,KAAKC,WAE/CD,KAAKc,cAAgBd,KAAKe,iBAAiBf,KAAKC,WAChDD,KAAKE,aAAe,GACpBF,KAAKc,cAAcE,SAAQ,EAAEC,OAAMC,UACjClB,KAAKE,aAAae,EAAKE,IAAMD,CAAG,G,CAKpC,qBAAAE,CAAsBC,GACpBrB,KAAKsB,cAAiBD,EAAEE,OAAmBJ,E,CAK7C,qBAAMK,GACJ,OAAOxB,KAAKY,Y,CAKd,cAAMa,GACJ,OAAOzB,KAAK0B,kB,CAKd,cAAMC,CAASC,GACb,IAAIC,EAAmB,GACvB,UAAWD,IAAU,SAAU,CAC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BC,SAC1CnC,EAAA,QACEC,MAAM,+BACNoE,KAAK,gBAEJ1L,GAEFU,EAAMqB,KAAKhC,GAASA,M,CAMrB,qBAAAqK,GACN,OACE/C,EAAA,kBACE6E,MAAM,kBACN5E,MAAM,aACNW,KAAMnJ,KAAKoD,aAAeuH,EAASC,OAAS5K,KAAKkK,gBAEjD3B,EAAA,UACEhF,KAAK,kBACL8J,KAAK,yBAENrN,KAAKsN,e,CAKJ,aAAAC,GACN,GAAI5I,EAAQ3E,KAAK+I,WAAa,MAAO,CACnC,M,CAGF,OACER,EAAA,mBACEQ,QAASpE,EAAQ3E,KAAK+I,WAAa,KAAOE,UAAajJ,KAAK+I,QAC5DC,OAAQhJ,KAAKgJ,OACbR,MAAOxI,KAAKmJ,KACZhE,SAAUnF,KAAKmF,U,CAKrB,MAAAqI,GACE,OACEjF,EAAA,OAAArH,IAAA,2CAAKsH,MAAM,kBACRxI,KAAKsI,cACLtI,KAAK8J,iBACL9J,KAAKuN,gB","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as a,h as o,a as n,g as t}from"./p-75c4a726.js";import{B as i}from"./p-17af7fb2.js";const r="html{scroll-behavior:smooth}z-anchor-navigation nav{display:none;flex-direction:column;justify-content:flex-start;row-gap:calc(var(--space-unit) / 2)}z-anchor-navigation[collapsed] nav{display:flex;margin-top:var(--space-unit)}z-anchor-navigation nav a{display:-webkit-box;overflow:clip;width:100%;box-sizing:border-box;padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 2);-webkit-box-orient:vertical;font-weight:inherit;-webkit-line-clamp:2;line-clamp:2;overflow-clip-margin:content-box;text-decoration:none}z-anchor-navigation nav>* a{color:inherit}z-anchor-navigation nav * a:not(:only-child){padding-right:calc(var(--space-unit) * 5)}@supports not (overflow-clip-margin: content-box){z-anchor-navigation nav a{display:inline-block;overflow:hidden;-webkit-line-clamp:none;line-clamp:none;text-overflow:ellipsis;white-space:nowrap}}z-anchor-navigation nav>*{position:relative;border-left:var(--border-size-large) solid var(--color-default-icon);color:var(--color-default-text);font-family:var(--font-family-sans);transition:background-color 0.3s ease-in-out,\n border-color 0.3s ease-in-out,\n color 0.3s ease-in-out}z-anchor-navigation nav>[data-current]{border-left-color:var(--color-primary01);color:var(--color-primary01);font-weight:var(--font-sb)}z-anchor-navigation nav>*>*:is(z-button,button){position:absolute;top:50%;right:0;transform:translateY(-50%);transition:opacity 0.3s ease-in-out}z-anchor-navigation nav>*:focus:focus-visible,z-anchor-navigation nav>*>*:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}z-anchor-navigation nav button{padding:0;border:none;margin:0;background-color:transparent}@media (min-width: 768px){z-anchor-navigation:not([is-collapsed]) z-button.toggle{display:none !important}z-anchor-navigation:not([is-collapsed]) nav{display:flex}z-anchor-navigation nav>*>:is(z-button,button){opacity:0;pointer-events:none}@media (hover: hover){z-anchor-navigation nav>:is([data-current],:hover,:focus,:focus-within)>:is(z-button,button){fill:var(--color-default-icon);opacity:1;pointer-events:unset}z-anchor-navigation nav>*:hover{border-left-color:var(--color-hover-primary);background-color:var(--color-background);color:var(--color-hover-primary)}}z-anchor-navigation[hide-unselected] nav>*:not([data-current],:hover,:focus,:focus-within){color:transparent;fill:transparent}}";const e=r;const c=class{constructor(o){a(this,o);this.hideUnselected=false;this.autoCurrent=true;this.collapsedLabel="salta a";this.isCollapsed=false;this.collapsed=false}setCurrent(){const a=Array.from(this.nav.querySelectorAll("a")).find((a=>a.href===this.host.ownerDocument.location.href));Array.from(this.nav.children).forEach((o=>{const n=o instanceof HTMLAnchorElement?o:o.querySelector("a");const t=n===a;n.setAttribute("aria-current",t.toString());o.toggleAttribute("data-current",t)}))}toggleCollapsed(){this.collapsed=!this.collapsed}componentDidLoad(){if(this.autoCurrent){window.addEventListener("hashchange",this.setCurrent.bind(this));this.setCurrent()}}disconnectedCallback(){window.removeEventListener("hashchange",this.setCurrent)}render(){return o(n,{key:"6a97023e45aadf7d5d3145fe03722a48f7d42c89",collapsed:this.collapsed},o("z-button",{key:"cb9859955b6f95c7c4f4e7aea5c7c517c3d9eeab",class:"toggle",variant:i.SECONDARY,icon:this.collapsed?"chevron-up":"chevron-down",onClick:this.toggleCollapsed.bind(this)},this.collapsedLabel),o("nav",{key:"9b157978f2b13719b23d292454ba0aa148c5a6ab",ref:a=>this.nav=a},o("slot",{key:"b07777d32d40d79b3a61672898f664a49986ac9b"})))}get host(){return t(this)}};c.style=e;export{c as z_anchor_navigation};
2
- //# sourceMappingURL=p-e1a80453.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZAnchorNavigationStyle0","ZAnchorNavigation","setCurrent","currentElement","Array","from","this","nav","querySelectorAll","find","anchor","href","host","ownerDocument","location","children","forEach","item","HTMLAnchorElement","querySelector","isCurrent","setAttribute","toString","toggleAttribute","toggleCollapsed","collapsed","componentDidLoad","autoCurrent","window","addEventListener","bind","disconnectedCallback","removeEventListener","render","h","Host","key","class","variant","ButtonVariant","SECONDARY","icon","onClick","collapsedLabel","ref","el"],"sources":["src/components/z-anchor-navigation/styles.css?tag=z-anchor-navigation","src/components/z-anchor-navigation/index.tsx"],"sourcesContent":["html {\n scroll-behavior: smooth;\n}\n\nz-anchor-navigation nav {\n display: none;\n flex-direction: column;\n justify-content: flex-start;\n row-gap: calc(var(--space-unit) / 2);\n}\n\nz-anchor-navigation[collapsed] nav {\n display: flex;\n margin-top: var(--space-unit);\n}\n\nz-anchor-navigation nav a {\n display: -webkit-box;\n overflow: clip;\n width: 100%;\n box-sizing: border-box;\n padding: calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 2);\n -webkit-box-orient: vertical;\n font-weight: inherit;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow-clip-margin: content-box;\n text-decoration: none;\n}\n\nz-anchor-navigation nav > * a {\n color: inherit;\n}\n\nz-anchor-navigation nav * a:not(:only-child) {\n padding-right: calc(var(--space-unit) * 5);\n}\n\n@supports not (overflow-clip-margin: content-box) {\n z-anchor-navigation nav a {\n display: inline-block;\n overflow: hidden;\n -webkit-line-clamp: none;\n line-clamp: none;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n}\n\nz-anchor-navigation nav > * {\n position: relative;\n border-left: var(--border-size-large) solid var(--color-default-icon);\n color: var(--color-default-text);\n font-family: var(--font-family-sans);\n transition:\n background-color 0.3s ease-in-out,\n border-color 0.3s ease-in-out,\n color 0.3s ease-in-out;\n}\n\nz-anchor-navigation nav > [data-current] {\n border-left-color: var(--color-primary01);\n color: var(--color-primary01);\n font-weight: var(--font-sb);\n}\n\nz-anchor-navigation nav > * > *:is(z-button, button) {\n position: absolute;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n transition: opacity 0.3s ease-in-out;\n}\n\nz-anchor-navigation nav > *:focus:focus-visible,\nz-anchor-navigation nav > * > *:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\nz-anchor-navigation nav button {\n padding: 0;\n border: none;\n margin: 0;\n background-color: transparent;\n}\n\n@media (min-width: 768px) {\n z-anchor-navigation:not([is-collapsed]) z-button.toggle {\n display: none !important;\n }\n\n z-anchor-navigation:not([is-collapsed]) nav {\n display: flex;\n }\n\n /* hide anchor actions by default... */\n z-anchor-navigation nav > * > :is(z-button, button) {\n opacity: 0;\n pointer-events: none;\n }\n\n @media (hover: hover) {\n /* ...show them only hovering/focusing the anchor */\n z-anchor-navigation nav > :is([data-current], :hover, :focus, :focus-within) > :is(z-button, button) {\n fill: var(--color-default-icon);\n opacity: 1;\n pointer-events: unset;\n }\n\n z-anchor-navigation nav > *:hover {\n border-left-color: var(--color-hover-primary);\n background-color: var(--color-background);\n color: var(--color-hover-primary);\n }\n }\n\n z-anchor-navigation[hide-unselected] nav > *:not([data-current], :hover, :focus, :focus-within) {\n color: transparent;\n fill: transparent;\n }\n}\n","import {Component, Element, h, Host, Prop, State} from \"@stencil/core\";\nimport {ButtonVariant} from \"../../beans\";\n\n/**\n * Anchor navigation component.\n * @slot - Anchor navigation items. Use `<a>` elements inside. If you need an extra action element, use a wrapper around it and the anchor.\n * @example\n * ```\n * <z-anchor-navigation>\n * <div>\n * <a href=\"#section-id\">Section name</a>\n * <button type=\"button\">\n * <z-icon name=\"share\" />\n * </button>\n * </div>\n * </z-anchor-navigation>\n * ```\n */\n@Component({\n tag: \"z-anchor-navigation\",\n styleUrl: \"styles.css\",\n shadow: false,\n})\nexport class ZAnchorNavigation {\n /**\n * If enabled, the text of each anchor will be hidden unless\n * for the current one or the one the user is hovering.\n */\n @Prop({reflect: true})\n hideUnselected = false;\n\n /**\n * Enables automatic inference of the current item, listening for hash change\n * and checking the `href` of the slotted anchors.\n * When disabled, the highlight of current item must be handled manually by setting the `data-current`\n * attribute to the correct slotted items and the `aria-current` attribute to the anchors.\n */\n @Prop()\n autoCurrent = true;\n\n /**\n * Sets the label of the button displayed on mobile viewport when the anchor navigation is collapsed\n */\n @Prop()\n collapsedLabel = \"salta a\";\n\n /**\n * Explicitly collapse anchor navigation.\n * If false will collapse automatically only on mobile.\n */\n @Prop({reflect: true})\n isCollapsed = false;\n\n /**\n * Whether the mobile list is collapsed.\n */\n @State()\n collapsed = false;\n\n @Element() host: HTMLZAnchorNavigationElement;\n\n /** Reference to the nav element. */\n private nav: HTMLElement;\n\n /**\n * Set `aria-current` attribute to the anchors.\n */\n private setCurrent(): void {\n const currentElement = Array.from(this.nav.querySelectorAll(\"a\")).find(\n (anchor) => anchor.href === this.host.ownerDocument.location.href\n );\n Array.from(this.nav.children).forEach((item) => {\n const anchor = item instanceof HTMLAnchorElement ? item : item.querySelector(\"a\");\n const isCurrent = anchor === currentElement;\n anchor.setAttribute(\"aria-current\", isCurrent.toString());\n item.toggleAttribute(\"data-current\", isCurrent);\n });\n }\n\n /**\n * Toggle collapsed state.\n */\n private toggleCollapsed(): void {\n this.collapsed = !this.collapsed;\n }\n\n componentDidLoad(): void {\n if (this.autoCurrent) {\n window.addEventListener(\"hashchange\", this.setCurrent.bind(this));\n this.setCurrent();\n }\n }\n\n disconnectedCallback(): void {\n window.removeEventListener(\"hashchange\", this.setCurrent);\n }\n\n render(): HTMLZAnchorNavigationElement {\n return (\n <Host collapsed={this.collapsed}>\n <z-button\n class=\"toggle\"\n variant={ButtonVariant.SECONDARY}\n icon={this.collapsed ? \"chevron-up\" : \"chevron-down\"}\n onClick={this.toggleCollapsed.bind(this)}\n >\n {this.collapsedLabel}\n </z-button>\n <nav ref={(el) => (this.nav = el)}>\n <slot></slot>\n </nav>\n </Host>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAAY,mzEAClB,MAAAC,EAAeD,E,MCsBFE,EAAiB,M,6CAMX,M,iBASH,K,oBAMG,U,iBAOH,M,eAMF,K,CAUJ,UAAAC,GACN,MAAMC,EAAiBC,MAAMC,KAAKC,KAAKC,IAAIC,iBAAiB,MAAMC,MAC/DC,GAAWA,EAAOC,OAASL,KAAKM,KAAKC,cAAcC,SAASH,OAE/DP,MAAMC,KAAKC,KAAKC,IAAIQ,UAAUC,SAASC,IACrC,MAAMP,EAASO,aAAgBC,kBAAoBD,EAAOA,EAAKE,cAAc,KAC7E,MAAMC,EAAYV,IAAWP,EAC7BO,EAAOW,aAAa,eAAgBD,EAAUE,YAC9CL,EAAKM,gBAAgB,eAAgBH,EAAU,G,CAO3C,eAAAI,GACNlB,KAAKmB,WAAanB,KAAKmB,S,CAGzB,gBAAAC,GACE,GAAIpB,KAAKqB,YAAa,CACpBC,OAAOC,iBAAiB,aAAcvB,KAAKJ,WAAW4B,KAAKxB,OAC3DA,KAAKJ,Y,EAIT,oBAAA6B,GACEH,OAAOI,oBAAoB,aAAc1B,KAAKJ,W,CAGhD,MAAA+B,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,2CAACX,UAAWnB,KAAKmB,WACpBS,EAAA,YAAAE,IAAA,2CACEC,MAAM,SACNC,QAASC,EAAcC,UACvBC,KAAMnC,KAAKmB,UAAY,aAAe,eACtCiB,QAASpC,KAAKkB,gBAAgBM,KAAKxB,OAElCA,KAAKqC,gBAERT,EAAA,OAAAE,IAAA,2CAAKQ,IAAMC,GAAQvC,KAAKC,IAAMsC,GAC5BX,EAAA,QAAAE,IAAA,8C","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as t,c as e,h as o,a as r,g as s}from"./p-75c4a726.js";import{P as i,g as n}from"./p-17af7fb2.js";const a=':host{position:absolute;display:none;min-width:calc(var(--space-unit) * 8);max-width:100%;min-height:calc(var(--space-unit) * 4);max-height:100%;align-items:center;justify-content:center;padding:var(--z-popover-padding, 0);background:var(--z-popover-theme--surface, var(--color-surface01));border-radius:var(--border-radius-small);color:var(--z-popover-theme--text, var(--color-default-text));fill:currentcolor;filter:var(--z-popover-shadow-filter, drop-shadow(0 1px 2px var(--shadow-color-base)));font-family:var(--font-family-sans);text-align:center}:host([open]:not([current-position])){visibility:hidden}:host([open][current-position]),:host([open="true"][current-position]){display:flex}:host([center][current-position="top"]),:host([center][current-position="bottom"]){transform:translateX(-50%)}:host([center][current-position="right"]),:host([center][current-position="left"]){transform:translateY(-50%)}:host([current-position^="top"]){margin:0 0 var(--space-unit)}:host([current-position^="bottom"]){margin:var(--space-unit) 0 0}:host([current-position^="left"]){margin:0 var(--space-unit) 0 0}:host([current-position^="right"]){margin:0 0 0 var(--space-unit)}:host([current-position])::before{--arrow-size:6px;--arrow-edge-offset:calc(100% - var(--space-unit) - (var(--arrow-size) / 2));--arrow-center-x-offset:calc(50% - (var(--arrow-size) / 2));--arrow-center-y-offset:calc(100% - (var(--arrow-size) / 2));position:absolute;display:block;width:var(--arrow-size);height:var(--arrow-size);background:var(--z-popover-theme--surface, var(--color-surface01));content:"";transform:rotate(45deg)}:host([show-arrow="false"])::before,:host(:not([show-arrow]))::before{display:none}:host([current-position^="top"])::before{top:var(--arrow-center-y-offset)}:host([current-position^="bottom"])::before{bottom:var(--arrow-center-y-offset)}:host([current-position="top"])::before,:host([current-position="bottom"])::before{right:var(--arrow-edge-offset)}:host([current-position="right"])::before,:host([current-position="left"])::before{bottom:var(--arrow-edge-offset)}:host([current-position="right"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left"])::before{left:var(--arrow-center-y-offset)}:host([current-position="top_right"])::before,:host([current-position="bottom_right"])::before{right:var(--arrow-edge-offset)}:host([current-position="top_left"])::before,:host([current-position="bottom_left"])::before{left:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="left_top"])::before{top:var(--arrow-edge-offset)}:host([current-position="right_top"])::before,:host([current-position="right_bottom"])::before{right:var(--arrow-center-y-offset)}:host([current-position="left_top"])::before,:host([current-position="left_bottom"])::before{left:var(--arrow-center-y-offset)}:host([current-position="right_bottom"])::before,:host([current-position="left_bottom"])::before{bottom:var(--arrow-edge-offset)}:host([center][current-position="top"])::before,:host([center][current-position="bottom"])::before{right:auto;left:var(--arrow-center-x-offset)}:host([center][current-position="right"])::before,:host([center][current-position="left"])::before{top:var(--arrow-center-x-offset);bottom:auto}::slotted(*){overflow:auto;flex:1 auto}';const c=a;const h=document.documentElement;function f(t){if(t.parentNode===t.shadowRoot){return t.shadowRoot.host}return t.parentElement}function p(t){let e=f(t);while(e&&e!==h){const t=window.getComputedStyle(e);const{overflow:o,overflowX:r,overflowY:s}=t;if(o==="hidden"||s==="hidden"||r==="hidden"){return e}const i=o!=="visible";const n=s!=="visible";const a=r!=="visible";if(e.scrollHeight>e.clientHeight&&i&&n||e.scrollWidth>e.clientWidth&&i&&a){return e}e=f(e)}return h}function u(t,e){const o=t.getBoundingClientRect();const{width:r,height:s}=o;let i=0;let n=0;let a=t;while(a&&a!==e){n+=a.offsetLeft;if(a===document.body){i+=a.getBoundingClientRect().top+window.scrollY}else{i+=a.offsetTop}if(window.DOMMatrix){const t=window.getComputedStyle(a);const{transform:e}=t;if(e&&e!=="none"){const t=new DOMMatrix(e);n+=t.m41;if(a!==document.body){i+=t.m42}}}if(!a.offsetParent){break}a=a.offsetParent}let c;let h;if(a===document.body){c=window.innerWidth;h=window.innerHeight}else{c=a.offsetWidth;h=a.offsetHeight}const f=c-n-r;const p=h-i-s;return{top:i,right:f,bottom:p,left:n,width:r,height:s}}const l=class{constructor(o){t(this,o);this.positionChange=e(this,"positionChange",7);this.openChange=e(this,"openChange",7);this.spaceTolerance=3;this.position=i.TOP;this.open=false;this.bindTo=undefined;this.showArrow=false;this.center=false;this.closable=true;this.currentPosition=undefined}closePopoverWithKeyboard(t){if(this.closable&&t.key===n.ESC){this.open=false}}handleOutsideClick(t){if(!this.closable||!this.open){return}const e=t.composedPath();if(!e.includes(this.host)){const e=t.target;let o=false;if(typeof this.bindTo==="string"){o=!!e.closest(this.bindTo)}else if(this.bindTo){o=this.bindTo.contains(e)}if(o){t.stopPropagation()}this.open=false;this.positionChange.emit({position:this.currentPosition})}}validatePosition(t){if(!Object.values(i).includes(t)||t===i.AUTO){t=i.TOP}this.position=t;this.currentPosition=t;this.positionChange.emit({position:this.currentPosition});this.setPosition()}onOpen(){cancelAnimationFrame(this.animationFrameRequestId);if(this.open){const t=()=>{if(this.open){this.setPosition();this.animationFrameRequestId=requestAnimationFrame(t)}};setTimeout((()=>{t()}),0)}this.openChange.emit({open:this.open})}hasCenteredHorizontalSpace(t,e,o,r,s){const i=(o-r)*(1-s);return t>=i-this.spaceTolerance&&e>=i-this.spaceTolerance}hasCenteredVerticalSpace(t,e,o,r,s){const i=(o-r)*(1-s);return t>=i-this.spaceTolerance&&e>=i-this.spaceTolerance}hasOffsetSpace(t,e,o,r){return t>=e-o*(1-r)-this.spaceTolerance}getOptimalPopoverPosition(t,e,o,r){const s=this.host.offsetWidth;const n=this.host.offsetHeight;const a=t=>{switch(t){case i.TOP:return e.top>=n&&this.hasCenteredHorizontalSpace(e.left,e.right,s,o.width,r);case i.TOP_RIGHT:return e.top>=n&&this.hasOffsetSpace(e.right,s,o.width,r);case i.TOP_LEFT:return e.top>=n&&this.hasOffsetSpace(e.left,s,o.width,r);case i.RIGHT:return e.right>=s&&this.hasCenteredVerticalSpace(e.top,e.bottom,n,o.height,r);case i.RIGHT_BOTTOM:return e.right>=s&&this.hasOffsetSpace(e.bottom,n,o.height,r);case i.RIGHT_TOP:return e.right>=s&&this.hasOffsetSpace(e.top,n,o.height,r);case i.BOTTOM:return e.bottom>=n&&this.hasCenteredHorizontalSpace(e.left,e.right,s,o.width,r);case i.BOTTOM_LEFT:return e.bottom>=n&&this.hasOffsetSpace(e.left,s,o.width,r);case i.BOTTOM_RIGHT:return e.bottom>=n&&this.hasOffsetSpace(e.right,s,o.width,r);case i.LEFT:return e.left>=s&&this.hasCenteredVerticalSpace(e.top,e.bottom,n,o.height,r);case i.LEFT_TOP:return e.left>=s&&this.hasOffsetSpace(e.top,n,o.height,r);case i.LEFT_BOTTOM:return e.left>=s&&this.hasOffsetSpace(e.bottom,n,o.height,r);default:return false}};if(a(t)){return t}const c=l.positionOrder;const h=c.indexOf(t);if(h===-1){return t}for(let t=1;t<c.length;t++){const e=(h+t)%c.length;const o=c[e];if(a(o)){return o}}return this.findBestFallbackPosition(e)}findBestFallbackPosition(t){const e=t.right>=t.left?i.RIGHT:i.LEFT;const o=t.bottom>=t.top?i.BOTTOM:i.TOP;const r=Math.max(t.right,t.left);const s=Math.max(t.bottom,t.top);const n=s>=r?o:e;let a=false;if(n===o){const e=Math.min(t.right,t.left);a=r>=e*2}else{const e=Math.min(t.bottom,t.top);a=s>=e*2}if(!a){return n}const c=n===o?e:o;return`${n}_${c}`}calculateAvailableSpace(t,e,o){const r=t.top-e.scrollTop;const s=o.height-(t.top+t.height)+e.scrollTop;const i=t.left-e.scrollLeft;const n=o.width-(t.left+t.width)+e.scrollLeft;const a=Math.max(0,o.top+o.height-window.innerHeight);const c=Math.max(0,o.left+o.width-window.innerWidth);return{top:Math.min(r,r+o.top),bottom:Math.min(s,s-a),left:Math.min(i,i+o.left),right:Math.min(n,n-c)}}calculateRelativeOffsets(t,e){return{top:t.top-e.top,right:t.right-e.right,bottom:t.bottom-e.bottom,left:t.left-e.left}}applyPositionStyles(t,e,o,r,s,n,a){const c=8;e.top="auto";e.right="auto";e.bottom="auto";e.left="auto";e.maxWidth="";e.maxHeight="";switch(t){case i.TOP:case i.TOP_RIGHT:e.bottom=`${o.bottom+r.height}px`;e.left=`${o.left+r.width*n-(t===i.TOP_RIGHT?a:0)}px`;e.maxHeight=`${s.top-c}px`;if(t===i.TOP_RIGHT){e.maxWidth=`${s.right+r.width*n}px`}break;case i.TOP_LEFT:e.right=`${o.right+r.width*n-a}px`;e.bottom=`${o.bottom+r.height}px`;e.maxWidth=`${s.left}px`;e.maxHeight=`${s.top-c}px`;break;case i.BOTTOM:case i.BOTTOM_RIGHT:e.top=`${o.top+r.height}px`;e.left=`${o.left+r.width*n-(t===i.BOTTOM_RIGHT?a:0)}px`;e.maxHeight=`${s.bottom-c}px`;if(t===i.BOTTOM_RIGHT){e.maxWidth=`${s.right+r.width*n}px`}break;case i.BOTTOM_LEFT:e.top=`${o.top+r.height}px`;e.right=`${o.right+r.width*n-a}px`;e.maxWidth=`${s.left}px`;e.maxHeight=`${s.bottom-c}px`;break;case i.RIGHT:case i.RIGHT_BOTTOM:e.top=`${o.top+r.height*n-(t===i.RIGHT_BOTTOM?a:0)}px`;e.left=`${o.left+r.width}px`;e.maxWidth=`${s.right-c}px`;if(t===i.RIGHT){e.maxHeight=`${Math.min(s.top+s.bottom+r.height,window.innerHeight-20)}px`}else{e.maxHeight=`${s.bottom+r.height*n}px`}break;case i.RIGHT_TOP:e.bottom=`${o.bottom+r.height*n-a}px`;e.left=`${o.left+r.width}px`;e.maxWidth=`${s.right-c}px`;if(t===i.RIGHT_TOP){e.maxHeight=`${s.top+r.height*n}px`}break;case i.LEFT:case i.LEFT_BOTTOM:e.top=`${o.top+r.height*n-(t===i.LEFT_BOTTOM?a:0)}px`;e.right=`${o.right+r.width}px`;e.maxWidth=`${s.left-c}px`;if(t===i.LEFT_BOTTOM){e.maxHeight=`${s.bottom+r.height*n}px`}break;case i.LEFT_TOP:e.right=`${o.right+r.width}px`;e.bottom=`${o.bottom+r.height*n-a}px`;e.maxWidth=`${s.left-c}px`;if(t===i.LEFT_TOP){e.maxHeight=`${s.top+r.height*n}px`}break}}setPosition(){let t;if(typeof this.bindTo==="string"){t=this.host.ownerDocument.querySelector(this.bindTo)}else if(this.bindTo){t=this.bindTo}else{t=this.host.parentElement}if(!t){return}const e=p(t);const o=e.getBoundingClientRect();const r=this.host.offsetParent;const s=r?u(r,e):{top:0,right:0,bottom:0,left:0};const i=u(t,e);const n=this.calculateAvailableSpace(i,e,o);const a=this.calculateRelativeOffsets(i,s);const c=this.center?.5:0;const h=this.showArrow&&this.center?8:0;const f=this.getOptimalPopoverPosition(this.position,n,{width:i.width,height:i.height},c);const l=this.host.style;this.applyPositionStyles(f,l,a,i,n,c,h);this.currentPosition=f}componentWillLoad(){this.validatePosition(this.position);this.onOpen()}componentDidLoad(){this.setPosition()}disconnectedCallback(){cancelAnimationFrame(this.animationFrameRequestId)}render(){return o(r,{key:"8628b0f299deb808e4c554047c76b82f392782c9","current-position":this.currentPosition},o("slot",{key:"144294e8216d7ad673e4ee3a96651c053703d135"}))}get host(){return s(this)}static get watchers(){return{position:["validatePosition"],open:["onOpen"]}}};l.positionOrder=[i.TOP_RIGHT,i.TOP,i.TOP_LEFT,i.RIGHT_BOTTOM,i.RIGHT,i.RIGHT_TOP,i.BOTTOM_LEFT,i.BOTTOM,i.BOTTOM_RIGHT,i.LEFT_TOP,i.LEFT,i.LEFT_BOTTOM];l.style=c;export{l as z_popover};
2
- //# sourceMappingURL=p-37f271c8.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZPopoverStyle0","DOCUMENT_ELEMENT","document","documentElement","getParentElement","element","parentNode","shadowRoot","host","parentElement","findScrollableParent","parent","style","window","getComputedStyle","overflow","overflowX","overflowY","isOverflowNotVisible","isOverflowYNotVisible","isOverflowXNotVisible","scrollHeight","clientHeight","scrollWidth","clientWidth","computeOffset","targetParentOffset","rect","getBoundingClientRect","width","height","top","left","offsetParent","offsetLeft","body","scrollY","offsetTop","DOMMatrix","transform","domMatrix","m41","m42","parentWidth","parentHeight","innerWidth","innerHeight","offsetWidth","offsetHeight","right","bottom","ZPopover","this","spaceTolerance","PopoverPosition","TOP","closePopoverWithKeyboard","e","closable","key","KeyboardCode","ESC","open","handleOutsideClick","eventPath","composedPath","includes","target","triggerElemClicked","bindTo","closest","contains","stopPropagation","positionChange","emit","position","currentPosition","validatePosition","newValue","Object","values","AUTO","setPosition","onOpen","cancelAnimationFrame","animationFrameRequestId","requestAnimationFrame","setTimeout","openChange","hasCenteredHorizontalSpace","availableLeft","availableRight","hostWidth","boundWidth","offsetModifier","requiredSpace","hasCenteredVerticalSpace","availableTop","availableBottom","hostHeight","boundHeight","hasOffsetSpace","availableSpace","hostSize","boundSize","getOptimalPopoverPosition","desiredPosition","boundElemSizes","fits","pos","TOP_RIGHT","TOP_LEFT","RIGHT","RIGHT_BOTTOM","RIGHT_TOP","BOTTOM","BOTTOM_LEFT","BOTTOM_RIGHT","LEFT","LEFT_TOP","LEFT_BOTTOM","positions","positionOrder","startIndex","indexOf","i","length","posIndex","findBestFallbackPosition","bestHorizontalDirection","bestVerticalDirection","maxHorizontalSpace","Math","max","maxVerticalSpace","mainDirection","needsSecondaryDirection","minHorizontalSpace","min","minVerticalSpace","secondaryDirection","calculateAvailableSpace","boundElementRect","scrollContainer","scrollingBoundingRect","scrollTop","scrollLeft","overflowBottom","overflowRight","calculateRelativeOffsets","relativeBoundingRect","applyPositionStyles","offsets","boundElementSizes","arrowModifier","distanceFromBound","maxWidth","maxHeight","boundElement","ownerDocument","querySelector","offsetContainer","center","showArrow","componentWillLoad","componentDidLoad","disconnectedCallback","render","h","Host"],"sources":["src/components/z-popover/styles.css?tag=z-popover&encapsulation=shadow","src/components/z-popover/index.tsx"],"sourcesContent":[":host {\n --z-popover-theme--surface: ;\n --z-popover-theme--text: ;\n --z-popover-padding: ;\n --z-popover-shadow-filter: ;\n\n position: absolute;\n display: none;\n min-width: calc(var(--space-unit) * 8);\n max-width: 100%;\n min-height: calc(var(--space-unit) * 4);\n max-height: 100%;\n align-items: center;\n justify-content: center;\n padding: var(--z-popover-padding, 0);\n background: var(--z-popover-theme--surface, var(--color-surface01));\n border-radius: var(--border-radius-small);\n color: var(--z-popover-theme--text, var(--color-default-text));\n fill: currentcolor;\n filter: var(--z-popover-shadow-filter, drop-shadow(0 1px 2px var(--shadow-color-base)));\n font-family: var(--font-family-sans);\n text-align: center;\n}\n\n:host([open]:not([current-position])) {\n visibility: hidden;\n}\n\n:host([open][current-position]),\n:host([open=\"true\"][current-position]) {\n display: flex;\n}\n\n:host([center][current-position=\"top\"]),\n:host([center][current-position=\"bottom\"]) {\n transform: translateX(-50%);\n}\n\n:host([center][current-position=\"right\"]),\n:host([center][current-position=\"left\"]) {\n transform: translateY(-50%);\n}\n\n:host([current-position^=\"top\"]) {\n margin: 0 0 var(--space-unit);\n}\n\n:host([current-position^=\"bottom\"]) {\n margin: var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"left\"]) {\n margin: 0 var(--space-unit) 0 0;\n}\n\n:host([current-position^=\"right\"]) {\n margin: 0 0 0 var(--space-unit);\n}\n\n/* Arrow style */\n\n:host([current-position])::before {\n --arrow-size: 6px;\n --arrow-edge-offset: calc(100% - var(--space-unit) - (var(--arrow-size) / 2));\n --arrow-center-x-offset: calc(50% - (var(--arrow-size) / 2));\n --arrow-center-y-offset: calc(100% - (var(--arrow-size) / 2));\n\n position: absolute;\n display: block;\n width: var(--arrow-size);\n height: var(--arrow-size);\n background: var(--z-popover-theme--surface, var(--color-surface01));\n content: \"\";\n transform: rotate(45deg);\n}\n\n:host([show-arrow=\"false\"])::before,\n:host(:not([show-arrow]))::before {\n display: none;\n}\n\n:host([current-position^=\"top\"])::before {\n top: var(--arrow-center-y-offset);\n}\n\n:host([current-position^=\"bottom\"])::before {\n bottom: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top\"])::before,\n:host([current-position=\"bottom\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before,\n:host([current-position=\"left\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"top_right\"])::before,\n:host([current-position=\"bottom_right\"])::before {\n right: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"top_left\"])::before,\n:host([current-position=\"bottom_left\"])::before {\n left: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"left_top\"])::before {\n top: var(--arrow-edge-offset);\n}\n\n:host([current-position=\"right_top\"])::before,\n:host([current-position=\"right_bottom\"])::before {\n right: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"left_top\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n left: var(--arrow-center-y-offset);\n}\n\n:host([current-position=\"right_bottom\"])::before,\n:host([current-position=\"left_bottom\"])::before {\n bottom: var(--arrow-edge-offset);\n}\n\n:host([center][current-position=\"top\"])::before,\n:host([center][current-position=\"bottom\"])::before {\n right: auto;\n left: var(--arrow-center-x-offset);\n}\n\n:host([center][current-position=\"right\"])::before,\n:host([center][current-position=\"left\"])::before {\n top: var(--arrow-center-x-offset);\n bottom: auto;\n}\n\n::slotted(*) {\n overflow: auto;\n flex: 1 auto;\n}\n","import {Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h} from \"@stencil/core\";\nimport {KeyboardCode, PopoverPosition} from \"../../beans\";\n\nconst DOCUMENT_ELEMENT = document.documentElement;\n\ntype Offsets = {top: number; right: number; bottom: number; left: number};\ntype ElementSizes = {width: number; height: number};\n/** Centering offset modifier. 0 for no offset, 0.5 for centering. */\ntype OffsetModifier = 0 | 0.5;\n\nfunction getParentElement(element: Element): Element {\n if (element.parentNode === element.shadowRoot) {\n return element.shadowRoot.host;\n }\n\n return element.parentElement;\n}\n\n/**\n * Find the closest scrollable parent of a node.\n *\n * @param {Element} element The node\n */\nfunction findScrollableParent(element: Element): Element {\n let parent = getParentElement(element);\n\n while (parent && parent !== DOCUMENT_ELEMENT) {\n const style = window.getComputedStyle(parent);\n const {overflow, overflowX, overflowY} = style;\n\n // Check for hidden overflow first (early return)\n if (overflow === \"hidden\" || overflowY === \"hidden\" || overflowX === \"hidden\") {\n return parent;\n }\n\n // Only check scrollable if overflow is not visible\n const isOverflowNotVisible = overflow !== \"visible\";\n const isOverflowYNotVisible = overflowY !== \"visible\";\n const isOverflowXNotVisible = overflowX !== \"visible\";\n\n if (\n (parent.scrollHeight > parent.clientHeight && isOverflowNotVisible && isOverflowYNotVisible) ||\n (parent.scrollWidth > parent.clientWidth && isOverflowNotVisible && isOverflowXNotVisible)\n ) {\n return parent;\n }\n\n parent = getParentElement(parent);\n }\n\n return DOCUMENT_ELEMENT;\n}\n\n/**\n * Calculate computed offset.\n * It includes matrix transformations.\n * @param element The target element.\n * @param targetParentOffset The relative offset parent.\n */\nfunction computeOffset(element: HTMLElement, targetParentOffset?: HTMLElement): Offsets & ElementSizes {\n const rect = element.getBoundingClientRect();\n const {width, height} = rect;\n\n let top = 0;\n let left = 0;\n let offsetParent = element;\n\n while (offsetParent && offsetParent !== targetParentOffset) {\n left += offsetParent.offsetLeft;\n\n // document.body sometimes has offsetTop == 0 but still has an offset because of children margins!\n if (offsetParent === document.body) {\n top += offsetParent.getBoundingClientRect().top + window.scrollY;\n } else {\n top += offsetParent.offsetTop;\n }\n\n // Handle CSS transforms only when DOMMatrix is available\n if (window.DOMMatrix) {\n const style = window.getComputedStyle(offsetParent);\n const {transform} = style;\n\n if (transform && transform !== \"none\") {\n const domMatrix = new DOMMatrix(transform);\n left += domMatrix.m41;\n if (offsetParent !== document.body) {\n top += domMatrix.m42;\n }\n }\n }\n\n if (!offsetParent.offsetParent) {\n break;\n }\n\n offsetParent = offsetParent.offsetParent as HTMLElement;\n }\n\n let parentWidth: number;\n let parentHeight: number;\n if (offsetParent === document.body) {\n parentWidth = window.innerWidth;\n parentHeight = window.innerHeight;\n } else {\n parentWidth = offsetParent.offsetWidth;\n parentHeight = offsetParent.offsetHeight;\n }\n\n const right = parentWidth - left - width;\n const bottom = parentHeight - top - height;\n\n return {top, right, bottom, left, width, height};\n}\n\n/**\n * Popover component.\n * This component displays a popover that can be bound to an element.\n * It supports various positions and can automatically adjust its position based on available space.\n *\n * Notes:\n * - To ensure the positioning algorithm finds the right container when calculating the position, set its container's `position` to `relative`.\n * - Consider manually adjusting the size of the slotted element (using `max-width`, `max-height`, etc...) when its content is \"fluid\" (like a big text), because it can interfere with the position calculation (for example a long text on one single line can be bigger than the available space, letting the algorithm think that the popover doesn't fit in the available space).\n *\n * @cssprop --z-popover-theme--surface - background color of the popover.\n * @cssprop --z-popover-theme--text - foreground color of the popover.\n * @cssprop --z-popover-padding - padding of the popover.\n * @cssprop --z-popover-shadow-filter - drop-shadow filter of the popover. Defaults to `drop-shadow(0 1px 2px var(--shadow-color-base))`.\n */\n@Component({\n tag: \"z-popover\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZPopover {\n /**\n * The preferred position to render the popover.\n * The popover will automatically search another position if not enough space is available for the preferred position.\n * If the preferred position is not available, it will try to find the best position starting from `TOP` and going clockwise.\n */\n @Prop({reflect: true, mutable: true})\n position?: PopoverPosition = PopoverPosition.TOP;\n\n /**\n * The open state of the popover.\n */\n @Prop({reflect: true, mutable: true})\n open = false;\n\n /**\n * The selector or the element bound with the popover.\n * If string css selector is provided make sure to use a valid selector.\n */\n @Prop()\n bindTo?: string | HTMLElement;\n\n /**\n * Whether to show popover's arrow.\n */\n @Prop({reflect: true})\n showArrow = false;\n\n /**\n * Whether to center the popup on the main side (according to \"position\").\n */\n @Prop({reflect: true})\n center = false;\n\n /**\n * If true, the popover can be closed by clicking outside of it or pressing the escape key.\n * Otherwise, it will be closed only programmatically (by setting `open` to `false`).\n */\n @Prop()\n closable = true;\n\n /**\n * The current position of the popover.\n * It differs from `position` only when calculated automatically (position=auto) or when the position is recalculated for space reasons.\n */\n @State()\n currentPosition?: PopoverPosition;\n\n /**\n * Position change event.\n */\n @Event()\n positionChange: EventEmitter;\n\n /**\n * Open change event.\n */\n @Event()\n openChange: EventEmitter;\n\n @Element() host: HTMLZPopoverElement;\n\n private animationFrameRequestId?: number;\n\n private readonly spaceTolerance = 3; // 3px tolerance for space calculations\n\n @Listen(\"keyup\", {target: \"window\"})\n closePopoverWithKeyboard(e: KeyboardEvent): void {\n if (this.closable && e.key === KeyboardCode.ESC) {\n this.open = false;\n }\n }\n\n /**\n * Close the popover when clicking outside of its content.\n * Stop event propagation if the click was fired by popover's trigger element,\n * to prevent close and reopen glitches.\n * @param {MouseEvent} e\n */\n @Listen(\"click\", {target: \"body\", capture: true})\n handleOutsideClick(e: MouseEvent): void {\n if (!this.closable || !this.open) {\n return;\n }\n\n const eventPath = e.composedPath();\n if (!eventPath.includes(this.host)) {\n const target = e.target as HTMLElement;\n let triggerElemClicked = false;\n\n if (typeof this.bindTo === \"string\") {\n triggerElemClicked = !!target.closest(this.bindTo);\n } else if (this.bindTo) {\n triggerElemClicked = this.bindTo.contains(target);\n }\n\n if (triggerElemClicked) {\n // stop propagation if the click was on the trigger element to prevent close and reopen glitches\n e.stopPropagation();\n }\n\n this.open = false;\n this.positionChange.emit({position: this.currentPosition});\n }\n }\n\n @Watch(\"position\")\n validatePosition(newValue: PopoverPosition): void {\n if (!Object.values(PopoverPosition).includes(newValue as PopoverPosition) || newValue === PopoverPosition.AUTO) {\n newValue = PopoverPosition.TOP;\n }\n\n this.position = newValue;\n this.currentPosition = newValue;\n this.positionChange.emit({position: this.currentPosition});\n this.setPosition();\n }\n\n /**\n * Setup popover behaviors on opening.\n */\n @Watch(\"open\")\n onOpen(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n\n if (this.open) {\n const setPosition = (): void => {\n if (this.open) {\n this.setPosition();\n this.animationFrameRequestId = requestAnimationFrame(setPosition);\n }\n };\n\n // call `setPosition` after a tick to ensure the DOM is ready and sizes are available\n setTimeout(() => {\n setPosition();\n }, 0);\n }\n\n this.openChange.emit({open: this.open});\n }\n\n // Clockwise order of positions.\n private static readonly positionOrder: PopoverPosition[] = [\n PopoverPosition.TOP_RIGHT,\n PopoverPosition.TOP,\n PopoverPosition.TOP_LEFT,\n PopoverPosition.RIGHT_BOTTOM,\n PopoverPosition.RIGHT,\n PopoverPosition.RIGHT_TOP,\n PopoverPosition.BOTTOM_LEFT,\n PopoverPosition.BOTTOM,\n PopoverPosition.BOTTOM_RIGHT,\n PopoverPosition.LEFT_TOP,\n PopoverPosition.LEFT,\n PopoverPosition.LEFT_BOTTOM,\n ] as const;\n\n /**\n * Helper functions for space calculation\n */\n private hasCenteredHorizontalSpace(\n availableLeft: number,\n availableRight: number,\n hostWidth: number,\n boundWidth: number,\n offsetModifier: OffsetModifier\n ): boolean {\n const requiredSpace = (hostWidth - boundWidth) * (1 - offsetModifier);\n\n return (\n availableLeft >= requiredSpace - this.spaceTolerance && availableRight >= requiredSpace - this.spaceTolerance\n );\n }\n\n private hasCenteredVerticalSpace(\n availableTop: number,\n availableBottom: number,\n hostHeight: number,\n boundHeight: number,\n offsetModifier: OffsetModifier\n ): boolean {\n const requiredSpace = (hostHeight - boundHeight) * (1 - offsetModifier);\n\n return (\n availableTop >= requiredSpace - this.spaceTolerance && availableBottom >= requiredSpace - this.spaceTolerance\n );\n }\n\n private hasOffsetSpace(\n availableSpace: number,\n hostSize: number,\n boundSize: number,\n offsetModifier: OffsetModifier\n ): boolean {\n return availableSpace >= hostSize - boundSize * (1 - offsetModifier) - this.spaceTolerance;\n }\n\n /**\n * Given a desired position and available space around the bound element, returns the best position\n * that fits the popover, trying all positions if needed.\n * Takes into account offsetModifier for centering.\n * @param desiredPosition The desired position of the popover.\n * @param availableSpace The available space around the bound element.\n * @param boundElemSizes The sizes of the bound element.\n * @param offsetModifier The modifier to apply to the offset for centering.\n */\n private getOptimalPopoverPosition(\n desiredPosition: PopoverPosition,\n availableSpace: Offsets,\n boundElemSizes: ElementSizes,\n offsetModifier: OffsetModifier\n ): PopoverPosition {\n const hostWidth = this.host.offsetWidth;\n const hostHeight = this.host.offsetHeight;\n\n // Check if the desired position has enough space\n const fits = (pos: PopoverPosition): boolean => {\n switch (pos) {\n case PopoverPosition.TOP:\n return (\n availableSpace.top >= hostHeight &&\n this.hasCenteredHorizontalSpace(\n availableSpace.left,\n availableSpace.right,\n hostWidth,\n boundElemSizes.width,\n offsetModifier\n )\n );\n\n case PopoverPosition.TOP_RIGHT:\n return (\n availableSpace.top >= hostHeight &&\n this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.TOP_LEFT:\n return (\n availableSpace.top >= hostHeight &&\n this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.RIGHT:\n return (\n availableSpace.right >= hostWidth &&\n this.hasCenteredVerticalSpace(\n availableSpace.top,\n availableSpace.bottom,\n hostHeight,\n boundElemSizes.height,\n offsetModifier\n )\n );\n\n case PopoverPosition.RIGHT_BOTTOM:\n return (\n availableSpace.right >= hostWidth &&\n this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.RIGHT_TOP:\n return (\n availableSpace.right >= hostWidth &&\n this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.BOTTOM:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasCenteredHorizontalSpace(\n availableSpace.left,\n availableSpace.right,\n hostWidth,\n boundElemSizes.width,\n offsetModifier\n )\n );\n\n case PopoverPosition.BOTTOM_LEFT:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.BOTTOM_RIGHT:\n return (\n availableSpace.bottom >= hostHeight &&\n this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier)\n );\n\n case PopoverPosition.LEFT:\n return (\n availableSpace.left >= hostWidth &&\n this.hasCenteredVerticalSpace(\n availableSpace.top,\n availableSpace.bottom,\n hostHeight,\n boundElemSizes.height,\n offsetModifier\n )\n );\n\n case PopoverPosition.LEFT_TOP:\n return (\n availableSpace.left >= hostWidth &&\n this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n case PopoverPosition.LEFT_BOTTOM:\n return (\n availableSpace.left >= hostWidth &&\n this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier)\n );\n\n default:\n return false;\n }\n };\n\n // Check desired position first\n if (fits(desiredPosition)) {\n return desiredPosition;\n }\n\n // Find position index and create rotation starting from next position\n const positions = ZPopover.positionOrder;\n const startIndex = positions.indexOf(desiredPosition);\n\n if (startIndex === -1) {\n return desiredPosition; // fallback if position not found\n }\n\n // Try all other positions starting from the next one\n for (let i = 1; i < positions.length; i++) {\n const posIndex = (startIndex + i) % positions.length;\n const pos = positions[posIndex];\n if (fits(pos)) {\n return pos;\n }\n }\n\n // If no position fits, find the best fallback based on available space\n return this.findBestFallbackPosition(availableSpace);\n }\n\n /**\n * Find the best fallback position based on available space when no position fits perfectly\n */\n private findBestFallbackPosition(availableSpace: Offsets): PopoverPosition {\n // Determine the directions with the most space\n const bestHorizontalDirection =\n availableSpace.right >= availableSpace.left ? PopoverPosition.RIGHT : PopoverPosition.LEFT;\n\n const bestVerticalDirection =\n availableSpace.bottom >= availableSpace.top ? PopoverPosition.BOTTOM : PopoverPosition.TOP;\n\n // Choose the main direction based on which has more space\n const maxHorizontalSpace = Math.max(availableSpace.right, availableSpace.left);\n const maxVerticalSpace = Math.max(availableSpace.bottom, availableSpace.top);\n\n const mainDirection = maxVerticalSpace >= maxHorizontalSpace ? bestVerticalDirection : bestHorizontalDirection;\n\n // Check if secondary direction is necessary\n // Only add secondary direction if the difference between min and max in that direction is at least double\n let needsSecondaryDirection = false;\n\n if (mainDirection === bestVerticalDirection) {\n // Main direction is vertical, check horizontal space difference\n const minHorizontalSpace = Math.min(availableSpace.right, availableSpace.left);\n needsSecondaryDirection = maxHorizontalSpace >= minHorizontalSpace * 2;\n } else {\n // Main direction is horizontal, check vertical space difference\n const minVerticalSpace = Math.min(availableSpace.bottom, availableSpace.top);\n needsSecondaryDirection = maxVerticalSpace >= minVerticalSpace * 2;\n }\n\n if (!needsSecondaryDirection) {\n return mainDirection;\n }\n\n const secondaryDirection =\n mainDirection === bestVerticalDirection ? bestHorizontalDirection : bestVerticalDirection;\n\n // Create a combined position (e.g., \"bottom_right\")\n return `${mainDirection}_${secondaryDirection}` as PopoverPosition;\n }\n\n /**\n * Calculate available space around the bound element\n */\n private calculateAvailableSpace(\n boundElementRect: Offsets & ElementSizes,\n scrollContainer: HTMLElement,\n scrollingBoundingRect: DOMRect\n ): {top: number; right: number; bottom: number; left: number} {\n const top = boundElementRect.top - scrollContainer.scrollTop;\n const bottom =\n scrollingBoundingRect.height - (boundElementRect.top + boundElementRect.height) + scrollContainer.scrollTop;\n const left = boundElementRect.left - scrollContainer.scrollLeft;\n const right =\n scrollingBoundingRect.width - (boundElementRect.left + boundElementRect.width) + scrollContainer.scrollLeft;\n\n const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);\n const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);\n\n return {\n top: Math.min(top, top + scrollingBoundingRect.top),\n bottom: Math.min(bottom, bottom - overflowBottom),\n left: Math.min(left, left + scrollingBoundingRect.left),\n right: Math.min(right, right - overflowRight),\n };\n }\n\n /**\n * Calculate relative offsets for positioning\n */\n private calculateRelativeOffsets(\n boundElementRect: Offsets,\n relativeBoundingRect: Offsets\n ): {top: number; right: number; bottom: number; left: number} {\n return {\n top: boundElementRect.top - relativeBoundingRect.top,\n right: boundElementRect.right - relativeBoundingRect.right,\n bottom: boundElementRect.bottom - relativeBoundingRect.bottom,\n left: boundElementRect.left - relativeBoundingRect.left,\n };\n }\n\n /**\n * Apply positioning styles based on position\n */\n private applyPositionStyles(\n position: PopoverPosition,\n style: CSSStyleDeclaration,\n offsets: Offsets,\n boundElementSizes: ElementSizes,\n availableSpace: Offsets,\n offsetModifier: OffsetModifier,\n arrowModifier: number\n ): void {\n const distanceFromBound = 8; // 8px is the distance of the popover from the bound element\n // Reset all positioning properties\n style.top = \"auto\";\n style.right = \"auto\";\n style.bottom = \"auto\";\n style.left = \"auto\";\n style.maxWidth = \"\";\n style.maxHeight = \"\";\n\n switch (position) {\n case PopoverPosition.TOP:\n case PopoverPosition.TOP_RIGHT:\n style.bottom = `${offsets.bottom + boundElementSizes.height}px`;\n style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.TOP_RIGHT ? arrowModifier : 0)}px`;\n style.maxHeight = `${availableSpace.top - distanceFromBound}px`;\n if (position === PopoverPosition.TOP_RIGHT) {\n style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.TOP_LEFT:\n style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;\n style.bottom = `${offsets.bottom + boundElementSizes.height}px`;\n style.maxWidth = `${availableSpace.left}px`;\n style.maxHeight = `${availableSpace.top - distanceFromBound}px`;\n break;\n\n case PopoverPosition.BOTTOM:\n case PopoverPosition.BOTTOM_RIGHT:\n style.top = `${offsets.top + boundElementSizes.height}px`;\n style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.BOTTOM_RIGHT ? arrowModifier : 0)}px`;\n style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;\n if (position === PopoverPosition.BOTTOM_RIGHT) {\n style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.BOTTOM_LEFT:\n style.top = `${offsets.top + boundElementSizes.height}px`;\n style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;\n style.maxWidth = `${availableSpace.left}px`;\n style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;\n break;\n\n case PopoverPosition.RIGHT:\n case PopoverPosition.RIGHT_BOTTOM:\n style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.RIGHT_BOTTOM ? arrowModifier : 0)}px`;\n style.left = `${offsets.left + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.right - distanceFromBound}px`;\n if (position === PopoverPosition.RIGHT) {\n style.maxHeight = `${Math.min(availableSpace.top + availableSpace.bottom + boundElementSizes.height, window.innerHeight - 20)}px`;\n } else {\n style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.RIGHT_TOP:\n style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;\n style.left = `${offsets.left + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.right - distanceFromBound}px`;\n if (position === PopoverPosition.RIGHT_TOP) {\n style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.LEFT:\n case PopoverPosition.LEFT_BOTTOM:\n style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.LEFT_BOTTOM ? arrowModifier : 0)}px`;\n style.right = `${offsets.right + boundElementSizes.width}px`;\n style.maxWidth = `${availableSpace.left - distanceFromBound}px`;\n if (position === PopoverPosition.LEFT_BOTTOM) {\n style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n\n case PopoverPosition.LEFT_TOP:\n style.right = `${offsets.right + boundElementSizes.width}px`;\n style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;\n style.maxWidth = `${availableSpace.left - distanceFromBound}px`;\n if (position === PopoverPosition.LEFT_TOP) {\n style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;\n }\n break;\n }\n }\n\n /**\n * Set the position of the popover.\n */\n private setPosition(): void {\n let boundElement: HTMLElement;\n if (typeof this.bindTo === \"string\") {\n boundElement = this.host.ownerDocument.querySelector(this.bindTo) as HTMLElement;\n } else if (this.bindTo) {\n boundElement = this.bindTo;\n } else {\n boundElement = this.host.parentElement as HTMLElement;\n }\n\n if (!boundElement) {\n return;\n }\n\n const scrollContainer = findScrollableParent(boundElement) as HTMLElement;\n const scrollingBoundingRect = scrollContainer.getBoundingClientRect();\n const offsetContainer = this.host.offsetParent as HTMLElement;\n\n const relativeBoundingRect = offsetContainer\n ? computeOffset(offsetContainer, scrollContainer)\n : {top: 0, right: 0, bottom: 0, left: 0};\n const boundElementRect = computeOffset(boundElement, scrollContainer);\n\n const availableSpace = this.calculateAvailableSpace(boundElementRect, scrollContainer, scrollingBoundingRect);\n const offsets = this.calculateRelativeOffsets(boundElementRect, relativeBoundingRect);\n const offsetModifier = this.center ? 0.5 : 0;\n const arrowModifier = this.showArrow && this.center ? 8 : 0; // 8px is the distance of the arrow center from the edge of the popover\n\n const position = this.getOptimalPopoverPosition(\n this.position,\n availableSpace,\n {width: boundElementRect.width, height: boundElementRect.height},\n offsetModifier\n );\n\n const style = this.host.style;\n this.applyPositionStyles(position, style, offsets, boundElementRect, availableSpace, offsetModifier, arrowModifier);\n\n this.currentPosition = position;\n }\n\n componentWillLoad(): void {\n this.validatePosition(this.position);\n this.onOpen();\n }\n\n componentDidLoad(): void {\n this.setPosition();\n }\n\n disconnectedCallback(): void {\n cancelAnimationFrame(this.animationFrameRequestId);\n }\n\n render(): HTMLZPopoverElement {\n return (\n <Host current-position={this.currentPosition}>\n <slot></slot>\n </Host>\n );\n }\n}\n"],"mappings":"2GAAA,MAAMA,EAAY,yuGAClB,MAAAC,EAAeD,ECEf,MAAME,EAAmBC,SAASC,gBAOlC,SAASC,EAAiBC,GACxB,GAAIA,EAAQC,aAAeD,EAAQE,WAAY,CAC7C,OAAOF,EAAQE,WAAWC,I,CAG5B,OAAOH,EAAQI,aACjB,CAOA,SA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D,YAChB9D,EAAgB6D,OAChB7D,EAAgB+D,aAChB/D,EAAgBiE,SAChBjE,EAAgBgE,KAChBhE,EAAgBkE,a","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["stylesCss","ZCardStyle0","ZCard","componentWillLoad","this","hasCoverImage","host","querySelector","renderColorCoverCard","h","class","name","renderContent","render","variant","CardVariant","TEXT","Host","OVERLAY","coverIcon"],"sources":["src/components/z-card/styles.css?tag=z-card&encapsulation=shadow","src/components/z-card/index.tsx"],"sourcesContent":["/* The width of the card must be set by its container,\nrespecting the grid indications of the design. */\n\n:host {\n /* Override this var to change the cover's aspect ratio */\n --aspect-ratio: 1.62;\n --z-card--border-color: var(--gray200);\n --z-card--color-cover-background: var(--color-surface01);\n --z-card--text-background: var(--color-surface01);\n --z-card--text-border-radius: none;\n --z-card--text-border: none;\n --z-card--text-padding: calc(var(--space-unit) * 2) var(--space-unit);\n\n position: relative;\n display: flex;\n flex-direction: column;\n font-family: var(--font-family-sans);\n font-weight: var(--font-rg);\n}\n\n*,\n::slotted(*) {\n box-sizing: border-box;\n}\n\n*:focus:focus-visible {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n:host(:not([variant=\"overlay\"])) .cover-container {\n position: relative;\n width: 100%;\n}\n\n/* Old good trick with percentage padding to keep the aspect ratio.\nUnfortunately the `aspect-ratio` property is still experimental */\n.cover-container {\n padding-bottom: calc(100% / var(--aspect-ratio));\n}\n\n::slotted([slot=\"cover\"]),\n.color-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n object-position: center;\n}\n\n.cover-container > z-icon {\n --z-icon-width: calc(var(--space-unit) * 11);\n --z-icon-height: var(--z-icon-width);\n\n position: absolute;\n top: calc(50% - calc(var(--z-icon-height) / 2));\n left: calc(50% - calc(var(--z-icon-width) / 2));\n fill: var(--color-primary01);\n}\n\n.color-cover {\n background-color: var(--z-card--color-cover-background);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n padding-top: var(--space-unit);\n}\n\n.color-cover .cover-content {\n display: flex;\n height: 100%;\n flex-direction: column;\n justify-content: flex-end;\n padding: var(--space-unit);\n}\n\n/* Truncates overflowing text */\n::slotted([slot=\"metadata\"]),\n::slotted([slot=\"title\"]),\n::slotted([slot=\"text\"]) {\n display: -webkit-inline-box;\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n\n::slotted([slot=\"title\"]:not(:last-child)),\n::slotted([slot=\"text\"]:not(:last-child)) {\n margin-bottom: var(--space-unit);\n}\n\n::slotted([slot=\"title\"])::before {\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n content: \"\";\n}\n\n::slotted([slot=\"metadata\"]:not(:last-child)) {\n margin: 0 0 calc(var(--space-unit) * 0.25);\n -webkit-line-clamp: 1;\n line-clamp: 1;\n text-transform: uppercase;\n}\n\n::slotted([slot=\"title\"]) {\n margin: 0;\n font-size: var(--font-size-3);\n font-weight: var(--font-sb);\n -webkit-line-clamp: 2;\n line-clamp: 2;\n text-decoration: none;\n}\n\n::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n outline: none;\n}\n\n::slotted([slot=\"text\"]) {\n margin: 0;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n}\n\n.actions {\n position: relative;\n z-index: 2;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n::slotted([slot=\"action\"]:not(:last-child)) {\n margin-right: calc(var(--space-unit) * 2);\n}\n\n::slotted([slot=\"action\"]:focus) {\n box-shadow: var(--shadow-focus-primary);\n outline: none !important;\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible)::before {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([clickable]) ::slotted([slot=\"title\"]:focus:focus-visible) {\n box-shadow: none !important;\n outline: none !important;\n}\n\n:host([variant=\"text\"]) {\n border: var(--z-card--text-border);\n background-color: var(--z-card--text-background);\n border-radius: var(--z-card--text-border-radius);\n}\n\n:host([show-shadow]) > .content,\n:host([variant=\"border\"]) > .content,\n:host([variant=\"shadow\"]) > .content {\n height: 100%;\n padding: var(--space-unit) var(--space-unit) calc(var(--space-unit) * 2);\n}\n\n:host([variant=\"text\"]) > .content {\n padding: var(--z-card--text-padding);\n}\n\n:host([variant=\"border\"]) .actions,\n:host([variant=\"shadow\"]) .actions {\n margin-top: auto;\n}\n\n/* Border */\n:host([variant=\"border\"]) {\n border: var(--border-size-small) solid var(--z-card--border-color);\n}\n\n:host([variant=\"border\"][clickable]:hover) > .content {\n background: var(--color-background);\n}\n\n:host([variant=\"border\"][clickable]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"border\"][clickable]:active) {\n border-color: transparent;\n}\n\n/* Shadow */\n:host([variant=\"shadow\"]),\n:host([show-shadow]) {\n box-shadow: var(--shadow-2);\n}\n\n:host([variant=\"shadow\"][clickable]:hover),\n:host([clickable][show-shadow]:hover) {\n box-shadow: var(--shadow-4);\n}\n\n:host([variant=\"shadow\"][clickable]:focus:focus-visible),\n:host([clickable][show-shadow]:focus:focus-visible) {\n box-shadow: var(--shadow-focus-primary);\n}\n\n:host([variant=\"shadow\"][clickable]:active),\n:host([clickable][show-shadow]:active) {\n box-shadow: none;\n}\n\n/* Overlay */\n:host([variant=\"overlay\"]) .content {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n justify-content: flex-end;\n padding: var(--space-unit);\n background-image: linear-gradient(to top, rgb(0 0 0 / 100%), rgb(0 0 0 / 0%));\n color: var(--color-text-inverse);\n fill: var(--color-text-inverse);\n}\n","import {Component, Element, Host, Prop, State, h} from \"@stencil/core\";\nimport {CardVariant} from \"../../beans\";\n\n/**\n * ZCard component.\n * @cssprop --aspect-ratio - Cover aspect ratio. Default: `1.62`\n * @cssprop --z-card--border-color - Default: `var(--gray200)`\n * @cssprop --z-card--color-cover-background - Cover color. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-background - Background color for the `text` variant. Default: `var(--color-surface01)`\n * @cssprop --z-card--text-border-radius - Default: `none`\n * @cssprop --z-card--text-border - Configure CSS `border`. Default: `none`\n * @cssprop --z-card--text-padding - Configure CSS `padding`. Default: `none`\n * @slot cover - Image cover\n * @slot metadata - Metadata\n * @slot title - Title\n * @slot text - Text content\n * @slot action - Actions\n */\n@Component({\n tag: \"z-card\",\n styleUrl: \"styles.css\",\n shadow: true,\n})\nexport class ZCard {\n /**\n * Card variant.\n * Can be one of \"text\", \"border\", \"shadow\", \"overlay\".\n * Leave it undefined for the default card.\n */\n @Prop({reflect: true})\n variant: CardVariant;\n\n /** Name of the icon to place over the image cover */\n @Prop()\n coverIcon: string;\n\n /** Enable shadow. Default: false. */\n @Prop({reflect: true})\n showShadow = false;\n\n /** Enable \"clickable\" styles like hover background and cursor, focus shadow on the whole card, etc. */\n @Prop({reflect: true})\n clickable = false;\n\n @Element() host: HTMLZCardElement;\n\n @State()\n hasCoverImage: boolean;\n\n componentWillLoad(): void {\n this.hasCoverImage = this.host.querySelector('[slot=\"cover\"]') !== null;\n }\n\n /**\n * Template for a card without image cover.\n * A colored background replaces the image and some data is moved over it.\n */\n private renderColorCoverCard(): HTMLDivElement[] {\n return [\n <div class=\"cover-container\">\n <div class=\"color-cover\">\n <div class=\"cover-content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n </div>\n </div>\n </div>,\n <div class=\"content\">\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>,\n ];\n }\n\n /**\n * Template for the content.\n */\n private renderContent(): HTMLDivElement {\n return (\n <div class=\"content\">\n <slot name=\"metadata\"></slot>\n <slot name=\"title\"></slot>\n <slot name=\"text\"></slot>\n <div class=\"actions\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n );\n }\n\n render(): HTMLZCardElement {\n if (this.variant === CardVariant.TEXT) {\n return <Host>{this.renderContent()}</Host>;\n }\n\n if (this.variant === CardVariant.OVERLAY || this.hasCoverImage) {\n return (\n <Host>\n <div class=\"cover-container\">\n {this.hasCoverImage && [\n <slot name=\"cover\"></slot>,\n this.variant !== CardVariant.OVERLAY && this.coverIcon && <z-icon name={this.coverIcon}></z-icon>,\n ]}\n {!this.hasCoverImage && <div class=\"color-cover\"></div>}\n </div>\n {this.renderContent()}\n </Host>\n );\n }\n\n return <Host>{this.renderColorCoverCard()}</Host>;\n }\n}\n"],"mappings":"wFAAA,MAAMA,EAAY,0lIAClB,MAAAC,EAAeD,E,MCsBFE,EAAK,M,yFAeH,M,eAID,M,6BAOZ,iBAAAC,GACEC,KAAKC,cAAgBD,KAAKE,KAAKC,cAAc,oBAAsB,I,CAO7D,oBAAAC,GACN,MAAO,CACLC,EAAA,OAAKC,MAAM,mBACTD,EAAA,OAAKC,MAAM,eACTD,EAAA,OAAKC,MAAM,iBACTD,EAAA,QAAME,KAAK,aACXF,EAAA,QAAME,KAAK,aAIjBF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,SACXF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,a,CASX,aAAAC,GACN,OACEH,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,aACXF,EAAA,QAAME,KAAK,UACXF,EAAA,QAAME,KAAK,SACXF,EAAA,OAAKC,MAAM,WACTD,EAAA,QAAME,KAAK,Y,CAMnB,MAAAE,GACE,GAAIT,KAAKU,UAAYC,EAAYC,KAAM,CACrC,OAAOP,EAACQ,EAAI,KAAEb,KAAKQ,gB,CAGrB,GAAIR,KAAKU,UAAYC,EAAYG,SAAWd,KAAKC,cAAe,CAC9D,OACEI,EAACQ,EAAI,KACHR,EAAA,OAAKC,MAAM,mBACRN,KAAKC,eAAiB,CACrBI,EAAA,QAAME,KAAK,UACXP,KAAKU,UAAYC,EAAYG,SAAWd,KAAKe,WAAaV,EAAA,UAAQE,KAAMP,KAAKe,cAE7Ef,KAAKC,eAAiBI,EAAA,OAAKC,MAAM,iBAEpCN,KAAKQ,gB,CAKZ,OAAOH,EAACQ,EAAI,KAAEb,KAAKI,uB","ignoreList":[]}