@zanichelli/albe-web-components 18.4.1 → 18.4.2-rc2

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 (491) hide show
  1. package/CHANGELOG.md +0 -40
  2. package/dist/cjs/{index-f0b0a7d1.js → index-443b084a.js} +2 -2
  3. package/dist/cjs/{index-f0b0a7d1.js.map → index-443b084a.js.map} +1 -1
  4. package/dist/cjs/{index-4f18c0e2.js → index-be0b8cf5.js} +6 -1
  5. package/dist/cjs/index-be0b8cf5.js.map +1 -0
  6. package/dist/cjs/{index-d1759a5a.js → index-e98b419e.js} +2 -2
  7. package/dist/cjs/{index-d1759a5a.js.map → index-e98b419e.js.map} +1 -1
  8. package/dist/cjs/{index-394da17e.js → index-f67078cb.js} +4 -4
  9. package/dist/cjs/{index-394da17e.js.map → index-f67078cb.js.map} +1 -1
  10. package/dist/cjs/index.cjs.js +2 -2
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{utils-123c371d.js → utils-021d5bc3.js} +2 -2
  13. package/dist/cjs/{utils-123c371d.js.map → utils-021d5bc3.js.map} +1 -1
  14. package/dist/cjs/{utils-67ea6e35.js → utils-714b7a92.js} +2 -2
  15. package/dist/cjs/{utils-67ea6e35.js.map → utils-714b7a92.js.map} +1 -1
  16. package/dist/cjs/web-components-library.cjs.js +1 -1
  17. package/dist/cjs/z-accordion.cjs.entry.js +1 -1
  18. package/dist/cjs/z-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/z-anchor-navigation.cjs.entry.js +1 -1
  20. package/dist/cjs/z-app-header-deprecated.cjs.entry.js +1 -1
  21. package/dist/cjs/z-app-header_12.cjs.entry.js +3 -3
  22. package/dist/cjs/z-aria-alert.cjs.entry.js +1 -1
  23. package/dist/cjs/z-avatar.cjs.entry.js +1 -1
  24. package/dist/cjs/z-book-card-app.cjs.entry.js +1 -1
  25. package/dist/cjs/z-book-card-deprecated.cjs.entry.js +2 -2
  26. package/dist/cjs/z-book-card.cjs.entry.js +1 -1
  27. package/dist/cjs/z-breadcrumb.cjs.entry.js +2 -2
  28. package/dist/cjs/z-card.cjs.entry.js +1 -1
  29. package/dist/cjs/z-carousel.cjs.entry.js +1 -1
  30. package/dist/cjs/z-chip.cjs.entry.js +1 -1
  31. package/dist/cjs/z-combobox.cjs.entry.js +2 -2
  32. package/dist/cjs/z-cover-hero.cjs.entry.js +1 -1
  33. package/dist/cjs/z-date-picker.cjs.entry.js +2 -2
  34. package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +1 -1
  35. package/dist/cjs/z-file-upload.cjs.entry.js +1 -1
  36. package/dist/cjs/z-file.cjs.entry.js +1 -1
  37. package/dist/cjs/z-info-reveal.cjs.entry.js +1 -1
  38. package/dist/cjs/z-menu-section.cjs.entry.js +1 -1
  39. package/dist/cjs/z-menu.cjs.entry.js +2 -2
  40. package/dist/cjs/z-myz-card-alert.cjs.entry.js +2 -2
  41. package/dist/cjs/z-myz-card-dictionary.cjs.entry.js +2 -2
  42. package/dist/cjs/z-myz-card-footer-sections.cjs.entry.js +1 -1
  43. package/dist/cjs/z-myz-card-footer.cjs.entry.js +2 -2
  44. package/dist/cjs/z-myz-card-icon.cjs.entry.js +1 -1
  45. package/dist/cjs/z-myz-card-info.cjs.entry.js +3 -3
  46. package/dist/cjs/z-myz-card-list.cjs.entry.js +1 -1
  47. package/dist/cjs/z-myz-card_4.cjs.entry.js +5 -5
  48. package/dist/cjs/z-myz-list-item.cjs.entry.js +3 -3
  49. package/dist/cjs/z-myz-list.cjs.entry.js +1 -1
  50. package/dist/cjs/z-navigation-tabs.cjs.entry.js +2 -2
  51. package/dist/cjs/z-navigation-tabs.cjs.entry.js.map +1 -1
  52. package/dist/cjs/z-otp.cjs.entry.js +3 -3
  53. package/dist/cjs/z-pagination.cjs.entry.js +1 -1
  54. package/dist/cjs/z-popover.cjs.entry.js +307 -153
  55. package/dist/cjs/z-popover.cjs.entry.js.map +1 -1
  56. package/dist/cjs/z-range-picker.cjs.entry.js +2 -2
  57. package/dist/cjs/z-section-title.cjs.entry.js +1 -1
  58. package/dist/cjs/z-select.cjs.entry.js +2 -2
  59. package/dist/cjs/z-skip-to-content.cjs.entry.js +3 -3
  60. package/dist/cjs/z-slideshow.cjs.entry.js +2 -2
  61. package/dist/cjs/z-stepper-item.cjs.entry.js +1 -1
  62. package/dist/cjs/z-stepper.cjs.entry.js +1 -1
  63. package/dist/cjs/z-table.cjs.entry.js +5 -5
  64. package/dist/cjs/z-td.cjs.entry.js +2 -2
  65. package/dist/cjs/z-th.cjs.entry.js +2 -2
  66. package/dist/cjs/z-toast-notification-list.cjs.entry.js +2 -2
  67. package/dist/cjs/z-toast-notification.cjs.entry.js +2 -2
  68. package/dist/cjs/z-toggle-button.cjs.entry.js +2 -2
  69. package/dist/cjs/z-toggle-switch.cjs.entry.js +5 -5
  70. package/dist/cjs/z-tooltip.cjs.entry.js +2 -2
  71. package/dist/cjs/z-tr.cjs.entry.js +5 -5
  72. package/dist/cjs/z-tree-list.cjs.entry.js +1 -1
  73. package/dist/collection/beans/index.js +5 -0
  74. package/dist/collection/beans/index.js.map +1 -1
  75. package/dist/collection/components/file-upload/z-file-upload/index.js +1 -1
  76. package/dist/collection/components/z-navigation-tabs/styles.css +1 -1
  77. package/dist/collection/components/z-popover/index.js +316 -156
  78. package/dist/collection/components/z-popover/index.js.map +1 -1
  79. package/dist/collection/components/z-popover/index.stories.js +124 -41
  80. package/dist/collection/components/z-popover/index.stories.js.map +1 -1
  81. package/dist/collection/components/z-popover/styles.css +16 -10
  82. package/dist/collection/components/z-searchbar/index.js +1 -1
  83. package/dist/collection/components/z-skip-to-content/index.js +1 -1
  84. package/dist/collection/components/z-stepper/index.js +1 -1
  85. package/dist/collection/components/z-stepper-item/index.js +1 -1
  86. package/dist/collection/components/z-toast-notification/index.js +1 -1
  87. package/dist/collection/components/z-toast-notification-list/index.js +1 -1
  88. package/dist/collection/components/z-toggle-button/index.js +2 -2
  89. package/dist/collection/components/z-toggle-switch/index.js +3 -3
  90. package/dist/collection/components/z-tooltip/index.js +1 -1
  91. package/dist/collection/snowflakes/myz/card/z-myz-card/index.js +1 -1
  92. package/dist/collection/snowflakes/myz/card/z-myz-card-alert/index.js +1 -1
  93. package/dist/collection/snowflakes/myz/card/z-myz-card-body/index.js +1 -1
  94. package/dist/collection/snowflakes/myz/card/z-myz-card-cover/index.js +1 -1
  95. package/dist/collection/snowflakes/myz/card/z-myz-card-dictionary/index.js +1 -1
  96. package/dist/collection/snowflakes/myz/card/z-myz-card-footer/index.js +1 -1
  97. package/dist/collection/snowflakes/myz/card/z-myz-card-footer-sections/index.js +1 -1
  98. package/dist/collection/snowflakes/myz/card/z-myz-card-header/index.js +1 -1
  99. package/dist/collection/snowflakes/myz/card/z-myz-card-icon/index.js +1 -1
  100. package/dist/collection/snowflakes/myz/card/z-myz-card-info/index.js +1 -1
  101. package/dist/collection/snowflakes/myz/card/z-myz-card-list/index.js +1 -1
  102. package/dist/collection/snowflakes/myz/list/z-myz-list/index.js +1 -1
  103. package/dist/collection/snowflakes/myz/list/z-myz-list-item/index.js +1 -1
  104. package/dist/collection/snowflakes/myz/z-alert/index.js +1 -1
  105. package/dist/collection/snowflakes/myz/z-otp/index.js +2 -2
  106. package/dist/components/index17.js +1 -1
  107. package/dist/components/index18.js +1 -1
  108. package/dist/components/index19.js +1 -1
  109. package/dist/components/index2.js +5 -0
  110. package/dist/components/index2.js.map +1 -1
  111. package/dist/components/index20.js +1 -1
  112. package/dist/components/index21.js +1 -1
  113. package/dist/components/index23.js +308 -154
  114. package/dist/components/index23.js.map +1 -1
  115. package/dist/components/index24.js +1 -1
  116. package/dist/components/index3.js +1 -1
  117. package/dist/components/z-myz-card-alert.js +1 -1
  118. package/dist/components/z-myz-card-dictionary.js +1 -1
  119. package/dist/components/z-myz-card-footer-sections.js +1 -1
  120. package/dist/components/z-myz-card-footer.js +1 -1
  121. package/dist/components/z-myz-card-icon.js +1 -1
  122. package/dist/components/z-myz-card-info.js +1 -1
  123. package/dist/components/z-myz-card-list.js +1 -1
  124. package/dist/components/z-myz-list.js +1 -1
  125. package/dist/components/z-navigation-tabs.js +1 -1
  126. package/dist/components/z-navigation-tabs.js.map +1 -1
  127. package/dist/components/z-otp.js +2 -2
  128. package/dist/components/z-skip-to-content.js +1 -1
  129. package/dist/components/z-stepper-item.js +1 -1
  130. package/dist/components/z-stepper.js +1 -1
  131. package/dist/components/z-table.js +1 -0
  132. package/dist/components/z-table.js.map +1 -1
  133. package/dist/components/z-toast-notification-list.js +1 -1
  134. package/dist/components/z-toast-notification.js +1 -1
  135. package/dist/components/z-toggle-button.js +2 -2
  136. package/dist/components/z-toggle-switch.js +3 -3
  137. package/dist/components/z-tooltip.js +1 -1
  138. package/dist/components/z-tr.js +1 -0
  139. package/dist/components/z-tr.js.map +1 -1
  140. package/dist/esm/{index-fc0913d1.js → index-2a26d10b.js} +2 -2
  141. package/dist/esm/{index-fc0913d1.js.map → index-2a26d10b.js.map} +1 -1
  142. package/dist/esm/{index-2ccbb96f.js → index-406138db.js} +2 -2
  143. package/dist/esm/{index-2ccbb96f.js.map → index-406138db.js.map} +1 -1
  144. package/dist/esm/{index-fe87283d.js → index-9f584e0a.js} +6 -1
  145. package/dist/esm/index-9f584e0a.js.map +1 -0
  146. package/dist/esm/{index-ceebee64.js → index-be3c8aaa.js} +4 -4
  147. package/dist/esm/{index-ceebee64.js.map → index-be3c8aaa.js.map} +1 -1
  148. package/dist/esm/index.js +2 -2
  149. package/dist/esm/loader.js +1 -1
  150. package/dist/esm/{utils-c7062cf7.js → utils-6e83ba99.js} +2 -2
  151. package/dist/esm/{utils-c7062cf7.js.map → utils-6e83ba99.js.map} +1 -1
  152. package/dist/esm/{utils-5e53516d.js → utils-90416845.js} +2 -2
  153. package/dist/esm/{utils-5e53516d.js.map → utils-90416845.js.map} +1 -1
  154. package/dist/esm/web-components-library.js +1 -1
  155. package/dist/esm/z-accordion.entry.js +1 -1
  156. package/dist/esm/z-alert.entry.js +1 -1
  157. package/dist/esm/z-anchor-navigation.entry.js +1 -1
  158. package/dist/esm/z-app-header-deprecated.entry.js +1 -1
  159. package/dist/esm/z-app-header_12.entry.js +3 -3
  160. package/dist/esm/z-aria-alert.entry.js +1 -1
  161. package/dist/esm/z-avatar.entry.js +1 -1
  162. package/dist/esm/z-book-card-app.entry.js +1 -1
  163. package/dist/esm/z-book-card-deprecated.entry.js +2 -2
  164. package/dist/esm/z-book-card.entry.js +1 -1
  165. package/dist/esm/z-breadcrumb.entry.js +2 -2
  166. package/dist/esm/z-card.entry.js +1 -1
  167. package/dist/esm/z-carousel.entry.js +1 -1
  168. package/dist/esm/z-chip.entry.js +1 -1
  169. package/dist/esm/z-combobox.entry.js +2 -2
  170. package/dist/esm/z-cover-hero.entry.js +1 -1
  171. package/dist/esm/z-date-picker.entry.js +2 -2
  172. package/dist/esm/z-dragdrop-area_2.entry.js +1 -1
  173. package/dist/esm/z-file-upload.entry.js +1 -1
  174. package/dist/esm/z-file.entry.js +1 -1
  175. package/dist/esm/z-info-reveal.entry.js +1 -1
  176. package/dist/esm/z-menu-section.entry.js +1 -1
  177. package/dist/esm/z-menu.entry.js +2 -2
  178. package/dist/esm/z-myz-card-alert.entry.js +2 -2
  179. package/dist/esm/z-myz-card-dictionary.entry.js +2 -2
  180. package/dist/esm/z-myz-card-footer-sections.entry.js +1 -1
  181. package/dist/esm/z-myz-card-footer.entry.js +2 -2
  182. package/dist/esm/z-myz-card-icon.entry.js +1 -1
  183. package/dist/esm/z-myz-card-info.entry.js +3 -3
  184. package/dist/esm/z-myz-card-list.entry.js +1 -1
  185. package/dist/esm/z-myz-card_4.entry.js +5 -5
  186. package/dist/esm/z-myz-list-item.entry.js +3 -3
  187. package/dist/esm/z-myz-list.entry.js +1 -1
  188. package/dist/esm/z-navigation-tabs.entry.js +2 -2
  189. package/dist/esm/z-navigation-tabs.entry.js.map +1 -1
  190. package/dist/esm/z-otp.entry.js +3 -3
  191. package/dist/esm/z-pagination.entry.js +1 -1
  192. package/dist/esm/z-popover.entry.js +308 -154
  193. package/dist/esm/z-popover.entry.js.map +1 -1
  194. package/dist/esm/z-range-picker.entry.js +2 -2
  195. package/dist/esm/z-section-title.entry.js +1 -1
  196. package/dist/esm/z-select.entry.js +2 -2
  197. package/dist/esm/z-skip-to-content.entry.js +3 -3
  198. package/dist/esm/z-slideshow.entry.js +2 -2
  199. package/dist/esm/z-stepper-item.entry.js +1 -1
  200. package/dist/esm/z-stepper.entry.js +1 -1
  201. package/dist/esm/z-table.entry.js +5 -5
  202. package/dist/esm/z-td.entry.js +2 -2
  203. package/dist/esm/z-th.entry.js +2 -2
  204. package/dist/esm/z-toast-notification-list.entry.js +2 -2
  205. package/dist/esm/z-toast-notification.entry.js +2 -2
  206. package/dist/esm/z-toggle-button.entry.js +2 -2
  207. package/dist/esm/z-toggle-switch.entry.js +5 -5
  208. package/dist/esm/z-tooltip.entry.js +2 -2
  209. package/dist/esm/z-tr.entry.js +5 -5
  210. package/dist/esm/z-tree-list.entry.js +1 -1
  211. package/dist/types/beans/index.d.ts +5 -0
  212. package/dist/types/components/z-popover/index.d.ts +50 -4
  213. package/dist/types/components/z-popover/index.stories.d.ts +26 -6
  214. package/dist/types/components.d.ts +23 -3
  215. package/dist/web-components-library/index.esm.js +1 -1
  216. package/dist/web-components-library/{p-6b679226.entry.js → p-0084024e.entry.js} +2 -2
  217. package/{www/build/p-0b26a8e0.js → dist/web-components-library/p-06b31bf5.js} +2 -2
  218. package/{www/build/p-b705fba3.entry.js → dist/web-components-library/p-0e91e5b6.entry.js} +2 -2
  219. package/dist/web-components-library/{p-f609b40e.entry.js → p-1252814d.entry.js} +2 -2
  220. package/{www/build/p-c6b7c8e4.entry.js → dist/web-components-library/p-12a7af3b.entry.js} +2 -2
  221. package/{www/build/p-dfcf9936.js → dist/web-components-library/p-137c2618.js} +1 -1
  222. package/dist/web-components-library/p-137c2618.js.map +1 -0
  223. package/{www/build/p-d60b9285.entry.js → dist/web-components-library/p-245a7cf6.entry.js} +2 -2
  224. package/dist/web-components-library/{p-43aea424.entry.js → p-26ea588a.entry.js} +2 -2
  225. package/dist/web-components-library/{p-611e6579.entry.js → p-2dee7eef.entry.js} +2 -2
  226. package/{www/build/p-f7d7cf44.entry.js → dist/web-components-library/p-353952ef.entry.js} +2 -2
  227. package/dist/web-components-library/{p-2726182b.entry.js → p-359fddfd.entry.js} +2 -2
  228. package/{www/build/p-c7d5971f.js → dist/web-components-library/p-36e71b13.js} +2 -2
  229. package/dist/web-components-library/p-37d31461.entry.js +2 -0
  230. package/dist/web-components-library/{p-dc46730d.entry.js → p-3cc02ff9.entry.js} +2 -2
  231. package/{www/build/p-49f99fa3.entry.js → dist/web-components-library/p-3fe267a1.entry.js} +2 -2
  232. package/dist/web-components-library/{p-b1561f18.entry.js → p-5123ff9e.entry.js} +2 -2
  233. package/dist/web-components-library/{p-d9592fa6.entry.js → p-512a8f43.entry.js} +2 -2
  234. package/dist/web-components-library/{p-c419dba3.entry.js → p-5ba4f3cf.entry.js} +2 -2
  235. package/dist/web-components-library/{p-604602a8.entry.js → p-5f58b59c.entry.js} +2 -2
  236. package/{www/build/p-a3860bef.entry.js → dist/web-components-library/p-5f5fd804.entry.js} +2 -2
  237. package/dist/web-components-library/{p-8e7554c4.entry.js → p-610207c1.entry.js} +2 -2
  238. package/dist/web-components-library/p-651250c2.entry.js +2 -0
  239. package/dist/web-components-library/{p-6598aee0.entry.js → p-6ba34f6e.entry.js} +2 -2
  240. package/{www/build/p-d8d7db0e.entry.js → dist/web-components-library/p-7248bddb.entry.js} +2 -2
  241. package/dist/web-components-library/p-725b253d.entry.js +2 -0
  242. package/dist/web-components-library/{p-222d4160.entry.js → p-74301de8.entry.js} +2 -2
  243. package/dist/web-components-library/p-76ee5c89.entry.js +2 -0
  244. package/{www/build/p-93af4721.entry.js → dist/web-components-library/p-77b02b31.entry.js} +2 -2
  245. package/dist/web-components-library/{p-b0f758e7.entry.js → p-7934dde1.entry.js} +2 -2
  246. package/{www/build/p-f73d8a87.entry.js → dist/web-components-library/p-7e554fad.entry.js} +2 -2
  247. package/dist/web-components-library/{p-e2b57681.js → p-84635654.js} +2 -2
  248. package/dist/web-components-library/{p-37a34984.entry.js → p-84fe65a8.entry.js} +2 -2
  249. package/dist/web-components-library/{p-f3145212.js → p-8c322c9a.js} +2 -2
  250. package/dist/web-components-library/{p-1ef90472.entry.js → p-93bea5f7.entry.js} +2 -2
  251. package/dist/web-components-library/{p-96b5a35d.entry.js → p-9c3cea8c.entry.js} +2 -2
  252. package/{www/build/p-506d2cdb.entry.js → dist/web-components-library/p-9dc90af3.entry.js} +2 -2
  253. package/dist/web-components-library/{p-2a657ab1.entry.js → p-9f506297.entry.js} +2 -2
  254. package/dist/web-components-library/{p-e4627f9a.entry.js → p-a33b1a31.entry.js} +2 -2
  255. package/dist/web-components-library/{p-a1d45a8b.entry.js → p-a3aef2c0.entry.js} +2 -2
  256. package/dist/web-components-library/p-a4e05ee2.entry.js +2 -0
  257. package/{www/build/p-290f832a.entry.js → dist/web-components-library/p-aff88c50.entry.js} +2 -2
  258. package/dist/web-components-library/{p-ee7185cf.entry.js → p-b2313d3c.entry.js} +2 -2
  259. package/dist/web-components-library/p-b256f1e9.entry.js +2 -0
  260. package/dist/web-components-library/p-b256f1e9.entry.js.map +1 -0
  261. package/{www/build/p-564ddab3.entry.js → dist/web-components-library/p-b6de2c30.entry.js} +2 -2
  262. package/{www/build/p-3d8cdd34.entry.js → dist/web-components-library/p-bba086fb.entry.js} +2 -2
  263. package/dist/web-components-library/{p-e853ccde.entry.js → p-c231ed32.entry.js} +2 -2
  264. package/dist/web-components-library/{p-07da09b0.entry.js → p-c381b01c.entry.js} +2 -2
  265. package/dist/web-components-library/{p-8ec302f8.entry.js → p-c6ae7dfa.entry.js} +2 -2
  266. package/dist/web-components-library/p-cdd36026.entry.js +2 -0
  267. package/dist/web-components-library/p-cdd36026.entry.js.map +1 -0
  268. package/{www/build/p-996446e2.entry.js → dist/web-components-library/p-dd021fcb.entry.js} +2 -2
  269. package/dist/web-components-library/{p-430916e9.entry.js → p-e540d235.entry.js} +2 -2
  270. package/dist/web-components-library/{p-c1d89e00.entry.js → p-e5ac7dfc.entry.js} +2 -2
  271. package/{www/build/p-8ca5851b.entry.js → dist/web-components-library/p-e7270ec2.entry.js} +2 -2
  272. package/dist/web-components-library/{p-1dd6dff4.entry.js → p-e91ece0c.entry.js} +3 -3
  273. package/dist/web-components-library/{p-e8bab6ad.entry.js → p-ee8c03e3.entry.js} +2 -2
  274. package/{www/build/p-6949d27d.entry.js → dist/web-components-library/p-f0dd44c4.entry.js} +2 -2
  275. package/dist/web-components-library/p-f20f1ed3.entry.js +2 -0
  276. package/{www/build/p-ef2484b8.js → dist/web-components-library/p-f670c5ad.js} +2 -2
  277. package/{www/build/p-b0856b23.entry.js → dist/web-components-library/p-f7461e10.entry.js} +2 -2
  278. package/dist/web-components-library/{p-8e43f5ee.entry.js → p-fb12af88.entry.js} +2 -2
  279. package/dist/web-components-library/web-components-library.esm.js +1 -1
  280. package/dist/web-components-library/web-components-library.esm.js.map +1 -1
  281. package/package.json +1 -1
  282. package/www/build/index.esm.js +1 -1
  283. package/www/build/{p-6b679226.entry.js → p-0084024e.entry.js} +2 -2
  284. package/www/build/{p-992ea73d.js → p-01619706.js} +1 -1
  285. package/{dist/web-components-library/p-0b26a8e0.js → www/build/p-06b31bf5.js} +2 -2
  286. package/{dist/web-components-library/p-b705fba3.entry.js → www/build/p-0e91e5b6.entry.js} +2 -2
  287. package/www/build/{p-f609b40e.entry.js → p-1252814d.entry.js} +2 -2
  288. package/{dist/web-components-library/p-c6b7c8e4.entry.js → www/build/p-12a7af3b.entry.js} +2 -2
  289. package/{dist/web-components-library/p-dfcf9936.js → www/build/p-137c2618.js} +1 -1
  290. package/www/build/p-137c2618.js.map +1 -0
  291. package/{dist/web-components-library/p-d60b9285.entry.js → www/build/p-245a7cf6.entry.js} +2 -2
  292. package/www/build/{p-43aea424.entry.js → p-26ea588a.entry.js} +2 -2
  293. package/www/build/{p-611e6579.entry.js → p-2dee7eef.entry.js} +2 -2
  294. package/{dist/web-components-library/p-f7d7cf44.entry.js → www/build/p-353952ef.entry.js} +2 -2
  295. package/www/build/{p-2726182b.entry.js → p-359fddfd.entry.js} +2 -2
  296. package/{dist/web-components-library/p-c7d5971f.js → www/build/p-36e71b13.js} +2 -2
  297. package/www/build/p-37d31461.entry.js +2 -0
  298. package/www/build/{p-dc46730d.entry.js → p-3cc02ff9.entry.js} +2 -2
  299. package/{dist/web-components-library/p-49f99fa3.entry.js → www/build/p-3fe267a1.entry.js} +2 -2
  300. package/www/build/{p-b1561f18.entry.js → p-5123ff9e.entry.js} +2 -2
  301. package/www/build/{p-d9592fa6.entry.js → p-512a8f43.entry.js} +2 -2
  302. package/www/build/{p-c419dba3.entry.js → p-5ba4f3cf.entry.js} +2 -2
  303. package/www/build/{p-604602a8.entry.js → p-5f58b59c.entry.js} +2 -2
  304. package/{dist/web-components-library/p-a3860bef.entry.js → www/build/p-5f5fd804.entry.js} +2 -2
  305. package/www/build/{p-8e7554c4.entry.js → p-610207c1.entry.js} +2 -2
  306. package/www/build/p-651250c2.entry.js +2 -0
  307. package/www/build/{p-6598aee0.entry.js → p-6ba34f6e.entry.js} +2 -2
  308. package/{dist/web-components-library/p-d8d7db0e.entry.js → www/build/p-7248bddb.entry.js} +2 -2
  309. package/www/build/p-725b253d.entry.js +2 -0
  310. package/www/build/{p-222d4160.entry.js → p-74301de8.entry.js} +2 -2
  311. package/www/build/p-76ee5c89.entry.js +2 -0
  312. package/{dist/web-components-library/p-93af4721.entry.js → www/build/p-77b02b31.entry.js} +2 -2
  313. package/www/build/{p-b0f758e7.entry.js → p-7934dde1.entry.js} +2 -2
  314. package/{dist/web-components-library/p-f73d8a87.entry.js → www/build/p-7e554fad.entry.js} +2 -2
  315. package/www/build/{p-e2b57681.js → p-84635654.js} +2 -2
  316. package/www/build/{p-37a34984.entry.js → p-84fe65a8.entry.js} +2 -2
  317. package/www/build/{p-f3145212.js → p-8c322c9a.js} +2 -2
  318. package/www/build/{p-1ef90472.entry.js → p-93bea5f7.entry.js} +2 -2
  319. package/www/build/{p-96b5a35d.entry.js → p-9c3cea8c.entry.js} +2 -2
  320. package/{dist/web-components-library/p-506d2cdb.entry.js → www/build/p-9dc90af3.entry.js} +2 -2
  321. package/www/build/{p-2a657ab1.entry.js → p-9f506297.entry.js} +2 -2
  322. package/www/build/{p-e4627f9a.entry.js → p-a33b1a31.entry.js} +2 -2
  323. package/www/build/{p-a1d45a8b.entry.js → p-a3aef2c0.entry.js} +2 -2
  324. package/www/build/p-a4e05ee2.entry.js +2 -0
  325. package/{dist/web-components-library/p-290f832a.entry.js → www/build/p-aff88c50.entry.js} +2 -2
  326. package/www/build/{p-ee7185cf.entry.js → p-b2313d3c.entry.js} +2 -2
  327. package/www/build/p-b256f1e9.entry.js +2 -0
  328. package/www/build/p-b256f1e9.entry.js.map +1 -0
  329. package/{dist/web-components-library/p-564ddab3.entry.js → www/build/p-b6de2c30.entry.js} +2 -2
  330. package/{dist/web-components-library/p-3d8cdd34.entry.js → www/build/p-bba086fb.entry.js} +2 -2
  331. package/www/build/{p-e853ccde.entry.js → p-c231ed32.entry.js} +2 -2
  332. package/www/build/{p-07da09b0.entry.js → p-c381b01c.entry.js} +2 -2
  333. package/www/build/{p-8ec302f8.entry.js → p-c6ae7dfa.entry.js} +2 -2
  334. package/www/build/p-cdd36026.entry.js +2 -0
  335. package/www/build/p-cdd36026.entry.js.map +1 -0
  336. package/{dist/web-components-library/p-996446e2.entry.js → www/build/p-dd021fcb.entry.js} +2 -2
  337. package/www/build/{p-430916e9.entry.js → p-e540d235.entry.js} +2 -2
  338. package/www/build/{p-c1d89e00.entry.js → p-e5ac7dfc.entry.js} +2 -2
  339. package/{dist/web-components-library/p-8ca5851b.entry.js → www/build/p-e7270ec2.entry.js} +2 -2
  340. package/www/build/{p-1dd6dff4.entry.js → p-e91ece0c.entry.js} +3 -3
  341. package/www/build/{p-e8bab6ad.entry.js → p-ee8c03e3.entry.js} +2 -2
  342. package/{dist/web-components-library/p-6949d27d.entry.js → www/build/p-f0dd44c4.entry.js} +2 -2
  343. package/www/build/p-f20f1ed3.entry.js +2 -0
  344. package/{dist/web-components-library/p-ef2484b8.js → www/build/p-f670c5ad.js} +2 -2
  345. package/{dist/web-components-library/p-b0856b23.entry.js → www/build/p-f7461e10.entry.js} +2 -2
  346. package/www/build/{p-8e43f5ee.entry.js → p-fb12af88.entry.js} +2 -2
  347. package/www/build/web-components-library.esm.js +1 -1
  348. package/www/build/web-components-library.esm.js.map +1 -1
  349. package/www/index.html +1 -1
  350. package/dist/cjs/index-4f18c0e2.js.map +0 -1
  351. package/dist/esm/index-fe87283d.js.map +0 -1
  352. package/dist/web-components-library/p-0bd2b21e.entry.js +0 -2
  353. package/dist/web-components-library/p-43f9569d.entry.js +0 -2
  354. package/dist/web-components-library/p-43f9569d.entry.js.map +0 -1
  355. package/dist/web-components-library/p-83e3b2ff.entry.js +0 -2
  356. package/dist/web-components-library/p-a2217ed8.entry.js +0 -2
  357. package/dist/web-components-library/p-a9d05a92.entry.js +0 -2
  358. package/dist/web-components-library/p-cf837902.entry.js +0 -2
  359. package/dist/web-components-library/p-d8e88ea8.entry.js +0 -2
  360. package/dist/web-components-library/p-d8e88ea8.entry.js.map +0 -1
  361. package/dist/web-components-library/p-dfcf9936.js.map +0 -1
  362. package/dist/web-components-library/p-fd7c7885.entry.js +0 -2
  363. package/www/build/p-0bd2b21e.entry.js +0 -2
  364. package/www/build/p-43f9569d.entry.js +0 -2
  365. package/www/build/p-43f9569d.entry.js.map +0 -1
  366. package/www/build/p-83e3b2ff.entry.js +0 -2
  367. package/www/build/p-a2217ed8.entry.js +0 -2
  368. package/www/build/p-a9d05a92.entry.js +0 -2
  369. package/www/build/p-cf837902.entry.js +0 -2
  370. package/www/build/p-d8e88ea8.entry.js +0 -2
  371. package/www/build/p-d8e88ea8.entry.js.map +0 -1
  372. package/www/build/p-dfcf9936.js.map +0 -1
  373. package/www/build/p-fd7c7885.entry.js +0 -2
  374. /package/dist/types/{Users/dario/Progetti/Zanichelli → home/runner/work/design-system}/design-system/.stencil/docs/grid/index.stories.d.ts +0 -0
  375. /package/dist/types/{Users/dario/Progetti/Zanichelli → home/runner/work/design-system}/design-system/.stencil/docs/iconset/index.stories.d.ts +0 -0
  376. /package/dist/types/{Users/dario/Progetti/Zanichelli → home/runner/work/design-system}/design-system/.stencil/docs/themes/index.stories.d.ts +0 -0
  377. /package/dist/types/{Users/dario/Progetti/Zanichelli → home/runner/work/design-system}/design-system/.stencil/docs/typography/index.stories.d.ts +0 -0
  378. /package/dist/web-components-library/{p-6b679226.entry.js.map → p-0084024e.entry.js.map} +0 -0
  379. /package/dist/web-components-library/{p-0b26a8e0.js.map → p-06b31bf5.js.map} +0 -0
  380. /package/dist/web-components-library/{p-b705fba3.entry.js.map → p-0e91e5b6.entry.js.map} +0 -0
  381. /package/dist/web-components-library/{p-f609b40e.entry.js.map → p-1252814d.entry.js.map} +0 -0
  382. /package/dist/web-components-library/{p-c6b7c8e4.entry.js.map → p-12a7af3b.entry.js.map} +0 -0
  383. /package/dist/web-components-library/{p-d60b9285.entry.js.map → p-245a7cf6.entry.js.map} +0 -0
  384. /package/dist/web-components-library/{p-43aea424.entry.js.map → p-26ea588a.entry.js.map} +0 -0
  385. /package/dist/web-components-library/{p-611e6579.entry.js.map → p-2dee7eef.entry.js.map} +0 -0
  386. /package/dist/web-components-library/{p-f7d7cf44.entry.js.map → p-353952ef.entry.js.map} +0 -0
  387. /package/dist/web-components-library/{p-2726182b.entry.js.map → p-359fddfd.entry.js.map} +0 -0
  388. /package/dist/web-components-library/{p-c7d5971f.js.map → p-36e71b13.js.map} +0 -0
  389. /package/dist/web-components-library/{p-fd7c7885.entry.js.map → p-37d31461.entry.js.map} +0 -0
  390. /package/dist/web-components-library/{p-dc46730d.entry.js.map → p-3cc02ff9.entry.js.map} +0 -0
  391. /package/dist/web-components-library/{p-49f99fa3.entry.js.map → p-3fe267a1.entry.js.map} +0 -0
  392. /package/dist/web-components-library/{p-b1561f18.entry.js.map → p-5123ff9e.entry.js.map} +0 -0
  393. /package/dist/web-components-library/{p-d9592fa6.entry.js.map → p-512a8f43.entry.js.map} +0 -0
  394. /package/dist/web-components-library/{p-c419dba3.entry.js.map → p-5ba4f3cf.entry.js.map} +0 -0
  395. /package/dist/web-components-library/{p-604602a8.entry.js.map → p-5f58b59c.entry.js.map} +0 -0
  396. /package/dist/web-components-library/{p-a3860bef.entry.js.map → p-5f5fd804.entry.js.map} +0 -0
  397. /package/dist/web-components-library/{p-8e7554c4.entry.js.map → p-610207c1.entry.js.map} +0 -0
  398. /package/dist/web-components-library/{p-a2217ed8.entry.js.map → p-651250c2.entry.js.map} +0 -0
  399. /package/dist/web-components-library/{p-6598aee0.entry.js.map → p-6ba34f6e.entry.js.map} +0 -0
  400. /package/dist/web-components-library/{p-d8d7db0e.entry.js.map → p-7248bddb.entry.js.map} +0 -0
  401. /package/dist/web-components-library/{p-0bd2b21e.entry.js.map → p-725b253d.entry.js.map} +0 -0
  402. /package/dist/web-components-library/{p-222d4160.entry.js.map → p-74301de8.entry.js.map} +0 -0
  403. /package/dist/web-components-library/{p-a9d05a92.entry.js.map → p-76ee5c89.entry.js.map} +0 -0
  404. /package/dist/web-components-library/{p-93af4721.entry.js.map → p-77b02b31.entry.js.map} +0 -0
  405. /package/dist/web-components-library/{p-b0f758e7.entry.js.map → p-7934dde1.entry.js.map} +0 -0
  406. /package/dist/web-components-library/{p-f73d8a87.entry.js.map → p-7e554fad.entry.js.map} +0 -0
  407. /package/dist/web-components-library/{p-e2b57681.js.map → p-84635654.js.map} +0 -0
  408. /package/dist/web-components-library/{p-37a34984.entry.js.map → p-84fe65a8.entry.js.map} +0 -0
  409. /package/dist/web-components-library/{p-f3145212.js.map → p-8c322c9a.js.map} +0 -0
  410. /package/dist/web-components-library/{p-1ef90472.entry.js.map → p-93bea5f7.entry.js.map} +0 -0
  411. /package/dist/web-components-library/{p-96b5a35d.entry.js.map → p-9c3cea8c.entry.js.map} +0 -0
  412. /package/dist/web-components-library/{p-506d2cdb.entry.js.map → p-9dc90af3.entry.js.map} +0 -0
  413. /package/dist/web-components-library/{p-2a657ab1.entry.js.map → p-9f506297.entry.js.map} +0 -0
  414. /package/dist/web-components-library/{p-e4627f9a.entry.js.map → p-a33b1a31.entry.js.map} +0 -0
  415. /package/dist/web-components-library/{p-a1d45a8b.entry.js.map → p-a3aef2c0.entry.js.map} +0 -0
  416. /package/dist/web-components-library/{p-83e3b2ff.entry.js.map → p-a4e05ee2.entry.js.map} +0 -0
  417. /package/dist/web-components-library/{p-290f832a.entry.js.map → p-aff88c50.entry.js.map} +0 -0
  418. /package/dist/web-components-library/{p-ee7185cf.entry.js.map → p-b2313d3c.entry.js.map} +0 -0
  419. /package/dist/web-components-library/{p-564ddab3.entry.js.map → p-b6de2c30.entry.js.map} +0 -0
  420. /package/dist/web-components-library/{p-3d8cdd34.entry.js.map → p-bba086fb.entry.js.map} +0 -0
  421. /package/dist/web-components-library/{p-e853ccde.entry.js.map → p-c231ed32.entry.js.map} +0 -0
  422. /package/dist/web-components-library/{p-07da09b0.entry.js.map → p-c381b01c.entry.js.map} +0 -0
  423. /package/dist/web-components-library/{p-8ec302f8.entry.js.map → p-c6ae7dfa.entry.js.map} +0 -0
  424. /package/dist/web-components-library/{p-996446e2.entry.js.map → p-dd021fcb.entry.js.map} +0 -0
  425. /package/dist/web-components-library/{p-430916e9.entry.js.map → p-e540d235.entry.js.map} +0 -0
  426. /package/dist/web-components-library/{p-c1d89e00.entry.js.map → p-e5ac7dfc.entry.js.map} +0 -0
  427. /package/dist/web-components-library/{p-8ca5851b.entry.js.map → p-e7270ec2.entry.js.map} +0 -0
  428. /package/dist/web-components-library/{p-1dd6dff4.entry.js.map → p-e91ece0c.entry.js.map} +0 -0
  429. /package/dist/web-components-library/{p-e8bab6ad.entry.js.map → p-ee8c03e3.entry.js.map} +0 -0
  430. /package/dist/web-components-library/{p-6949d27d.entry.js.map → p-f0dd44c4.entry.js.map} +0 -0
  431. /package/dist/web-components-library/{p-cf837902.entry.js.map → p-f20f1ed3.entry.js.map} +0 -0
  432. /package/dist/web-components-library/{p-ef2484b8.js.map → p-f670c5ad.js.map} +0 -0
  433. /package/dist/web-components-library/{p-b0856b23.entry.js.map → p-f7461e10.entry.js.map} +0 -0
  434. /package/dist/web-components-library/{p-8e43f5ee.entry.js.map → p-fb12af88.entry.js.map} +0 -0
  435. /package/www/build/{p-6b679226.entry.js.map → p-0084024e.entry.js.map} +0 -0
  436. /package/www/build/{p-0b26a8e0.js.map → p-06b31bf5.js.map} +0 -0
  437. /package/www/build/{p-b705fba3.entry.js.map → p-0e91e5b6.entry.js.map} +0 -0
  438. /package/www/build/{p-f609b40e.entry.js.map → p-1252814d.entry.js.map} +0 -0
  439. /package/www/build/{p-c6b7c8e4.entry.js.map → p-12a7af3b.entry.js.map} +0 -0
  440. /package/www/build/{p-d60b9285.entry.js.map → p-245a7cf6.entry.js.map} +0 -0
  441. /package/www/build/{p-43aea424.entry.js.map → p-26ea588a.entry.js.map} +0 -0
  442. /package/www/build/{p-611e6579.entry.js.map → p-2dee7eef.entry.js.map} +0 -0
  443. /package/www/build/{p-f7d7cf44.entry.js.map → p-353952ef.entry.js.map} +0 -0
  444. /package/www/build/{p-2726182b.entry.js.map → p-359fddfd.entry.js.map} +0 -0
  445. /package/www/build/{p-c7d5971f.js.map → p-36e71b13.js.map} +0 -0
  446. /package/www/build/{p-fd7c7885.entry.js.map → p-37d31461.entry.js.map} +0 -0
  447. /package/www/build/{p-dc46730d.entry.js.map → p-3cc02ff9.entry.js.map} +0 -0
  448. /package/www/build/{p-49f99fa3.entry.js.map → p-3fe267a1.entry.js.map} +0 -0
  449. /package/www/build/{p-b1561f18.entry.js.map → p-5123ff9e.entry.js.map} +0 -0
  450. /package/www/build/{p-d9592fa6.entry.js.map → p-512a8f43.entry.js.map} +0 -0
  451. /package/www/build/{p-c419dba3.entry.js.map → p-5ba4f3cf.entry.js.map} +0 -0
  452. /package/www/build/{p-604602a8.entry.js.map → p-5f58b59c.entry.js.map} +0 -0
  453. /package/www/build/{p-a3860bef.entry.js.map → p-5f5fd804.entry.js.map} +0 -0
  454. /package/www/build/{p-8e7554c4.entry.js.map → p-610207c1.entry.js.map} +0 -0
  455. /package/www/build/{p-a2217ed8.entry.js.map → p-651250c2.entry.js.map} +0 -0
  456. /package/www/build/{p-6598aee0.entry.js.map → p-6ba34f6e.entry.js.map} +0 -0
  457. /package/www/build/{p-d8d7db0e.entry.js.map → p-7248bddb.entry.js.map} +0 -0
  458. /package/www/build/{p-0bd2b21e.entry.js.map → p-725b253d.entry.js.map} +0 -0
  459. /package/www/build/{p-222d4160.entry.js.map → p-74301de8.entry.js.map} +0 -0
  460. /package/www/build/{p-a9d05a92.entry.js.map → p-76ee5c89.entry.js.map} +0 -0
  461. /package/www/build/{p-93af4721.entry.js.map → p-77b02b31.entry.js.map} +0 -0
  462. /package/www/build/{p-b0f758e7.entry.js.map → p-7934dde1.entry.js.map} +0 -0
  463. /package/www/build/{p-f73d8a87.entry.js.map → p-7e554fad.entry.js.map} +0 -0
  464. /package/www/build/{p-e2b57681.js.map → p-84635654.js.map} +0 -0
  465. /package/www/build/{p-37a34984.entry.js.map → p-84fe65a8.entry.js.map} +0 -0
  466. /package/www/build/{p-f3145212.js.map → p-8c322c9a.js.map} +0 -0
  467. /package/www/build/{p-1ef90472.entry.js.map → p-93bea5f7.entry.js.map} +0 -0
  468. /package/www/build/{p-96b5a35d.entry.js.map → p-9c3cea8c.entry.js.map} +0 -0
  469. /package/www/build/{p-506d2cdb.entry.js.map → p-9dc90af3.entry.js.map} +0 -0
  470. /package/www/build/{p-2a657ab1.entry.js.map → p-9f506297.entry.js.map} +0 -0
  471. /package/www/build/{p-e4627f9a.entry.js.map → p-a33b1a31.entry.js.map} +0 -0
  472. /package/www/build/{p-a1d45a8b.entry.js.map → p-a3aef2c0.entry.js.map} +0 -0
  473. /package/www/build/{p-83e3b2ff.entry.js.map → p-a4e05ee2.entry.js.map} +0 -0
  474. /package/www/build/{p-290f832a.entry.js.map → p-aff88c50.entry.js.map} +0 -0
  475. /package/www/build/{p-ee7185cf.entry.js.map → p-b2313d3c.entry.js.map} +0 -0
  476. /package/www/build/{p-564ddab3.entry.js.map → p-b6de2c30.entry.js.map} +0 -0
  477. /package/www/build/{p-3d8cdd34.entry.js.map → p-bba086fb.entry.js.map} +0 -0
  478. /package/www/build/{p-e853ccde.entry.js.map → p-c231ed32.entry.js.map} +0 -0
  479. /package/www/build/{p-07da09b0.entry.js.map → p-c381b01c.entry.js.map} +0 -0
  480. /package/www/build/{p-8ec302f8.entry.js.map → p-c6ae7dfa.entry.js.map} +0 -0
  481. /package/www/build/{p-996446e2.entry.js.map → p-dd021fcb.entry.js.map} +0 -0
  482. /package/www/build/{p-430916e9.entry.js.map → p-e540d235.entry.js.map} +0 -0
  483. /package/www/build/{p-c1d89e00.entry.js.map → p-e5ac7dfc.entry.js.map} +0 -0
  484. /package/www/build/{p-8ca5851b.entry.js.map → p-e7270ec2.entry.js.map} +0 -0
  485. /package/www/build/{p-1dd6dff4.entry.js.map → p-e91ece0c.entry.js.map} +0 -0
  486. /package/www/build/{p-e8bab6ad.entry.js.map → p-ee8c03e3.entry.js.map} +0 -0
  487. /package/www/build/{p-6949d27d.entry.js.map → p-f0dd44c4.entry.js.map} +0 -0
  488. /package/www/build/{p-cf837902.entry.js.map → p-f20f1ed3.entry.js.map} +0 -0
  489. /package/www/build/{p-ef2484b8.js.map → p-f670c5ad.js.map} +0 -0
  490. /package/www/build/{p-b0856b23.entry.js.map → p-f7461e10.entry.js.map} +0 -0
  491. /package/www/build/{p-8e43f5ee.entry.js.map → p-fb12af88.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { h } from "@stencil/core";
1
+ import { Host, h } from "@stencil/core";
2
2
  import { KeyboardCode, PopoverPosition } from "../../beans";
3
3
  const DOCUMENT_ELEMENT = document.documentElement;
4
4
  function getParentElement(element) {
@@ -15,12 +15,18 @@ function getParentElement(element) {
15
15
  function findScrollableParent(element) {
16
16
  let parent = getParentElement(element);
17
17
  while (parent && parent !== DOCUMENT_ELEMENT) {
18
- const { overflow, overflowX, overflowY } = window.getComputedStyle(parent);
18
+ const style = window.getComputedStyle(parent);
19
+ const { overflow, overflowX, overflowY } = style;
20
+ // Check for hidden overflow first (early return)
19
21
  if (overflow === "hidden" || overflowY === "hidden" || overflowX === "hidden") {
20
22
  return parent;
21
23
  }
22
- if ((parent.scrollHeight > parent.clientHeight && overflow !== "visible" && overflowY !== "visible") ||
23
- (parent.scrollWidth > parent.clientWidth && overflow !== "visible" && overflowX !== "visible")) {
24
+ // Only check scrollable if overflow is not visible
25
+ const isOverflowNotVisible = overflow !== "visible";
26
+ const isOverflowYNotVisible = overflowY !== "visible";
27
+ const isOverflowXNotVisible = overflowX !== "visible";
28
+ if ((parent.scrollHeight > parent.clientHeight && isOverflowNotVisible && isOverflowYNotVisible) ||
29
+ (parent.scrollWidth > parent.clientWidth && isOverflowNotVisible && isOverflowXNotVisible)) {
24
30
  return parent;
25
31
  }
26
32
  parent = getParentElement(parent);
@@ -32,30 +38,28 @@ function findScrollableParent(element) {
32
38
  * It includes matrix transformations.
33
39
  * @param element The target element.
34
40
  * @param targetParentOffset The relative offset parent.
35
- * @return A client rect object.
36
41
  */
37
42
  function computeOffset(element, targetParentOffset) {
38
43
  const rect = element.getBoundingClientRect();
39
- const width = rect.width;
40
- const height = rect.height;
44
+ const { width, height } = rect;
41
45
  let top = 0;
42
46
  let left = 0;
43
47
  let offsetParent = element;
44
- while (offsetParent && offsetParent != targetParentOffset) {
48
+ while (offsetParent && offsetParent !== targetParentOffset) {
45
49
  left += offsetParent.offsetLeft;
46
- // document.body sometimes has offsetTop == 0 but still has an
47
- // offset because of children margins!
50
+ // document.body sometimes has offsetTop == 0 but still has an offset because of children margins!
48
51
  if (offsetParent === document.body) {
49
52
  top += offsetParent.getBoundingClientRect().top + window.scrollY;
50
53
  }
51
54
  else {
52
55
  top += offsetParent.offsetTop;
53
56
  }
57
+ // Handle CSS transforms only when DOMMatrix is available
54
58
  if (window.DOMMatrix) {
55
59
  const style = window.getComputedStyle(offsetParent);
56
- const transform = style.transform || style.webkitTransform;
57
- const domMatrix = new DOMMatrix(transform);
58
- if (domMatrix) {
60
+ const { transform } = style;
61
+ if (transform && transform !== "none") {
62
+ const domMatrix = new DOMMatrix(transform);
59
63
  left += domMatrix.m41;
60
64
  if (offsetParent !== document.body) {
61
65
  top += domMatrix.m42;
@@ -77,12 +81,18 @@ function computeOffset(element, targetParentOffset) {
77
81
  parentWidth = offsetParent.offsetWidth;
78
82
  parentHeight = offsetParent.offsetHeight;
79
83
  }
80
- const right = parentWidth - left - rect.width;
81
- const bottom = parentHeight - top - rect.height;
84
+ const right = parentWidth - left - width;
85
+ const bottom = parentHeight - top - height;
82
86
  return { top, right, bottom, left, width, height };
83
87
  }
84
88
  /**
85
89
  * Popover component.
90
+ * This component displays a popover that can be bound to an element.
91
+ * It supports various positions and can automatically adjust its position based on available space.
92
+ *
93
+ * Notes:
94
+ * - To ensure the positioning algorithm finds the right container when calculating the position, set its container's `position` to `relative`.
95
+ * - 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).
86
96
  *
87
97
  * @cssprop --z-popover-theme--surface - background color of the popover.
88
98
  * @cssprop --z-popover-theme--text - foreground color of the popover.
@@ -91,7 +101,8 @@ function computeOffset(element, targetParentOffset) {
91
101
  */
92
102
  export class ZPopover {
93
103
  constructor() {
94
- this.position = PopoverPosition.AUTO;
104
+ this.spaceTolerance = 3; // 3px tolerance for space calculations
105
+ this.position = PopoverPosition.TOP;
95
106
  this.open = false;
96
107
  this.bindTo = undefined;
97
108
  this.showArrow = false;
@@ -114,10 +125,18 @@ export class ZPopover {
114
125
  if (!this.closable || !this.open) {
115
126
  return;
116
127
  }
117
- if (!e.composedPath().includes(this.host)) {
128
+ const eventPath = e.composedPath();
129
+ if (!eventPath.includes(this.host)) {
118
130
  const target = e.target;
119
- const triggerElemClicked = this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);
131
+ let triggerElemClicked = false;
132
+ if (typeof this.bindTo === "string") {
133
+ triggerElemClicked = !!target.closest(this.bindTo);
134
+ }
135
+ else if (this.bindTo) {
136
+ triggerElemClicked = this.bindTo.contains(target);
137
+ }
120
138
  if (triggerElemClicked) {
139
+ // stop propagation if the click was on the trigger element to prevent close and reopen glitches
121
140
  e.stopPropagation();
122
141
  }
123
142
  this.open = false;
@@ -125,11 +144,13 @@ export class ZPopover {
125
144
  }
126
145
  }
127
146
  validatePosition(newValue) {
128
- if (newValue && !Object.values(PopoverPosition).includes(newValue)) {
129
- this.position = PopoverPosition.AUTO;
147
+ if (!Object.values(PopoverPosition).includes(newValue) || newValue === PopoverPosition.AUTO) {
148
+ newValue = PopoverPosition.TOP;
130
149
  }
131
- this.currentPosition = this.position;
150
+ this.position = newValue;
151
+ this.currentPosition = newValue;
132
152
  this.positionChange.emit({ position: this.currentPosition });
153
+ this.setPosition();
133
154
  }
134
155
  /**
135
156
  * Setup popover behaviors on opening.
@@ -143,165 +164,289 @@ export class ZPopover {
143
164
  this.animationFrameRequestId = requestAnimationFrame(setPosition);
144
165
  }
145
166
  };
146
- setPosition();
147
- }
148
- else if (this.host.hasAttribute("current-position")) {
149
- this.host.removeAttribute("current-position");
150
- this.currentPosition = undefined;
167
+ // call `setPosition` after a tick to ensure the DOM is ready and sizes are available
168
+ setTimeout(() => {
169
+ setPosition();
170
+ }, 0);
151
171
  }
152
172
  this.openChange.emit({ open: this.open });
153
173
  }
154
- disconnectedCallback() {
155
- cancelAnimationFrame(this.animationFrameRequestId);
174
+ /**
175
+ * Helper functions for space calculation
176
+ */
177
+ hasCenteredHorizontalSpace(availableLeft, availableRight, hostWidth, boundWidth, offsetModifier) {
178
+ const requiredSpace = (hostWidth - boundWidth) * (1 - offsetModifier);
179
+ return (availableLeft >= requiredSpace - this.spaceTolerance && availableRight >= requiredSpace - this.spaceTolerance);
180
+ }
181
+ hasCenteredVerticalSpace(availableTop, availableBottom, hostHeight, boundHeight, offsetModifier) {
182
+ const requiredSpace = (hostHeight - boundHeight) * (1 - offsetModifier);
183
+ return (availableTop >= requiredSpace - this.spaceTolerance && availableBottom >= requiredSpace - this.spaceTolerance);
184
+ }
185
+ hasOffsetSpace(availableSpace, hostSize, boundSize, offsetModifier) {
186
+ return availableSpace >= hostSize - boundSize * (1 - offsetModifier) - this.spaceTolerance;
187
+ }
188
+ /**
189
+ * Given a desired position and available space around the bound element, returns the best position
190
+ * that fits the popover, trying all positions if needed.
191
+ * Takes into account offsetModifier for centering.
192
+ * @param desiredPosition The desired position of the popover.
193
+ * @param availableSpace The available space around the bound element.
194
+ * @param boundElemSizes The sizes of the bound element.
195
+ * @param offsetModifier The modifier to apply to the offset for centering.
196
+ */
197
+ getOptimalPopoverPosition(desiredPosition, availableSpace, boundElemSizes, offsetModifier) {
198
+ const hostWidth = this.host.offsetWidth;
199
+ const hostHeight = this.host.offsetHeight;
200
+ // Check if the desired position has enough space
201
+ const fits = (pos) => {
202
+ switch (pos) {
203
+ case PopoverPosition.TOP:
204
+ return (availableSpace.top >= hostHeight &&
205
+ this.hasCenteredHorizontalSpace(availableSpace.left, availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier));
206
+ case PopoverPosition.TOP_RIGHT:
207
+ return (availableSpace.top >= hostHeight &&
208
+ this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier));
209
+ case PopoverPosition.TOP_LEFT:
210
+ return (availableSpace.top >= hostHeight &&
211
+ this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier));
212
+ case PopoverPosition.RIGHT:
213
+ return (availableSpace.right >= hostWidth &&
214
+ this.hasCenteredVerticalSpace(availableSpace.top, availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier));
215
+ case PopoverPosition.RIGHT_BOTTOM:
216
+ return (availableSpace.right >= hostWidth &&
217
+ this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier));
218
+ case PopoverPosition.RIGHT_TOP:
219
+ return (availableSpace.right >= hostWidth &&
220
+ this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier));
221
+ case PopoverPosition.BOTTOM:
222
+ return (availableSpace.bottom >= hostHeight &&
223
+ this.hasCenteredHorizontalSpace(availableSpace.left, availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier));
224
+ case PopoverPosition.BOTTOM_LEFT:
225
+ return (availableSpace.bottom >= hostHeight &&
226
+ this.hasOffsetSpace(availableSpace.left, hostWidth, boundElemSizes.width, offsetModifier));
227
+ case PopoverPosition.BOTTOM_RIGHT:
228
+ return (availableSpace.bottom >= hostHeight &&
229
+ this.hasOffsetSpace(availableSpace.right, hostWidth, boundElemSizes.width, offsetModifier));
230
+ case PopoverPosition.LEFT:
231
+ return (availableSpace.left >= hostWidth &&
232
+ this.hasCenteredVerticalSpace(availableSpace.top, availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier));
233
+ case PopoverPosition.LEFT_TOP:
234
+ return (availableSpace.left >= hostWidth &&
235
+ this.hasOffsetSpace(availableSpace.top, hostHeight, boundElemSizes.height, offsetModifier));
236
+ case PopoverPosition.LEFT_BOTTOM:
237
+ return (availableSpace.left >= hostWidth &&
238
+ this.hasOffsetSpace(availableSpace.bottom, hostHeight, boundElemSizes.height, offsetModifier));
239
+ default:
240
+ return false;
241
+ }
242
+ };
243
+ // Check desired position first
244
+ if (fits(desiredPosition)) {
245
+ return desiredPosition;
246
+ }
247
+ // Find position index and create rotation starting from next position
248
+ const positions = ZPopover.positionOrder;
249
+ const startIndex = positions.indexOf(desiredPosition);
250
+ if (startIndex === -1) {
251
+ return desiredPosition; // fallback if position not found
252
+ }
253
+ // Try all other positions starting from the next one
254
+ for (let i = 1; i < positions.length; i++) {
255
+ const posIndex = (startIndex + i) % positions.length;
256
+ const pos = positions[posIndex];
257
+ if (fits(pos)) {
258
+ return pos;
259
+ }
260
+ }
261
+ // If no position fits, find the best fallback based on available space
262
+ return this.findBestFallbackPosition(availableSpace);
263
+ }
264
+ /**
265
+ * Find the best fallback position based on available space when no position fits perfectly
266
+ */
267
+ findBestFallbackPosition(availableSpace) {
268
+ // Determine the directions with the most space
269
+ const bestHorizontalDirection = availableSpace.right >= availableSpace.left ? PopoverPosition.RIGHT : PopoverPosition.LEFT;
270
+ const bestVerticalDirection = availableSpace.bottom >= availableSpace.top ? PopoverPosition.BOTTOM : PopoverPosition.TOP;
271
+ // Choose the main direction based on which has more space
272
+ const maxHorizontalSpace = Math.max(availableSpace.right, availableSpace.left);
273
+ const maxVerticalSpace = Math.max(availableSpace.bottom, availableSpace.top);
274
+ const mainDirection = maxVerticalSpace >= maxHorizontalSpace ? bestVerticalDirection : bestHorizontalDirection;
275
+ // Check if secondary direction is necessary
276
+ // Only add secondary direction if the difference between min and max in that direction is at least double
277
+ let needsSecondaryDirection = false;
278
+ if (mainDirection === bestVerticalDirection) {
279
+ // Main direction is vertical, check horizontal space difference
280
+ const minHorizontalSpace = Math.min(availableSpace.right, availableSpace.left);
281
+ needsSecondaryDirection = maxHorizontalSpace >= minHorizontalSpace * 2;
282
+ }
283
+ else {
284
+ // Main direction is horizontal, check vertical space difference
285
+ const minVerticalSpace = Math.min(availableSpace.bottom, availableSpace.top);
286
+ needsSecondaryDirection = maxVerticalSpace >= minVerticalSpace * 2;
287
+ }
288
+ if (!needsSecondaryDirection) {
289
+ return mainDirection;
290
+ }
291
+ const secondaryDirection = mainDirection === bestVerticalDirection ? bestHorizontalDirection : bestVerticalDirection;
292
+ // Create a combined position (e.g., "bottom_right")
293
+ return `${mainDirection}_${secondaryDirection}`;
294
+ }
295
+ /**
296
+ * Calculate available space around the bound element
297
+ */
298
+ calculateAvailableSpace(boundElementRect, scrollContainer, scrollingBoundingRect) {
299
+ const top = boundElementRect.top - scrollContainer.scrollTop;
300
+ const bottom = scrollingBoundingRect.height - (boundElementRect.top + boundElementRect.height) + scrollContainer.scrollTop;
301
+ const left = boundElementRect.left - scrollContainer.scrollLeft;
302
+ const right = scrollingBoundingRect.width - (boundElementRect.left + boundElementRect.width) + scrollContainer.scrollLeft;
303
+ const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);
304
+ const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);
305
+ return {
306
+ top: Math.min(top, top + scrollingBoundingRect.top),
307
+ bottom: Math.min(bottom, bottom - overflowBottom),
308
+ left: Math.min(left, left + scrollingBoundingRect.left),
309
+ right: Math.min(right, right - overflowRight),
310
+ };
311
+ }
312
+ /**
313
+ * Calculate relative offsets for positioning
314
+ */
315
+ calculateRelativeOffsets(boundElementRect, relativeBoundingRect) {
316
+ return {
317
+ top: boundElementRect.top - relativeBoundingRect.top,
318
+ right: boundElementRect.right - relativeBoundingRect.right,
319
+ bottom: boundElementRect.bottom - relativeBoundingRect.bottom,
320
+ left: boundElementRect.left - relativeBoundingRect.left,
321
+ };
322
+ }
323
+ /**
324
+ * Apply positioning styles based on position
325
+ */
326
+ applyPositionStyles(position, style, offsets, boundElementSizes, availableSpace, offsetModifier, arrowModifier) {
327
+ const distanceFromBound = 8; // 8px is the distance of the popover from the bound element
328
+ // Reset all positioning properties
329
+ style.top = "auto";
330
+ style.right = "auto";
331
+ style.bottom = "auto";
332
+ style.left = "auto";
333
+ style.maxWidth = "";
334
+ style.maxHeight = "";
335
+ switch (position) {
336
+ case PopoverPosition.TOP:
337
+ case PopoverPosition.TOP_RIGHT:
338
+ style.bottom = `${offsets.bottom + boundElementSizes.height}px`;
339
+ style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.TOP_RIGHT ? arrowModifier : 0)}px`;
340
+ style.maxHeight = `${availableSpace.top - distanceFromBound}px`;
341
+ if (position === PopoverPosition.TOP_RIGHT) {
342
+ style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;
343
+ }
344
+ break;
345
+ case PopoverPosition.TOP_LEFT:
346
+ style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;
347
+ style.bottom = `${offsets.bottom + boundElementSizes.height}px`;
348
+ style.maxWidth = `${availableSpace.left}px`;
349
+ style.maxHeight = `${availableSpace.top - distanceFromBound}px`;
350
+ break;
351
+ case PopoverPosition.BOTTOM:
352
+ case PopoverPosition.BOTTOM_RIGHT:
353
+ style.top = `${offsets.top + boundElementSizes.height}px`;
354
+ style.left = `${offsets.left + boundElementSizes.width * offsetModifier - (position === PopoverPosition.BOTTOM_RIGHT ? arrowModifier : 0)}px`;
355
+ style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;
356
+ if (position === PopoverPosition.BOTTOM_RIGHT) {
357
+ style.maxWidth = `${availableSpace.right + boundElementSizes.width * offsetModifier}px`;
358
+ }
359
+ break;
360
+ case PopoverPosition.BOTTOM_LEFT:
361
+ style.top = `${offsets.top + boundElementSizes.height}px`;
362
+ style.right = `${offsets.right + boundElementSizes.width * offsetModifier - arrowModifier}px`;
363
+ style.maxWidth = `${availableSpace.left}px`;
364
+ style.maxHeight = `${availableSpace.bottom - distanceFromBound}px`;
365
+ break;
366
+ case PopoverPosition.RIGHT:
367
+ case PopoverPosition.RIGHT_BOTTOM:
368
+ style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.RIGHT_BOTTOM ? arrowModifier : 0)}px`;
369
+ style.left = `${offsets.left + boundElementSizes.width}px`;
370
+ style.maxWidth = `${availableSpace.right - distanceFromBound}px`;
371
+ if (position === PopoverPosition.RIGHT) {
372
+ style.maxHeight = `${Math.min(availableSpace.top + availableSpace.bottom + boundElementSizes.height, window.innerHeight - 20)}px`;
373
+ }
374
+ else {
375
+ style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;
376
+ }
377
+ break;
378
+ case PopoverPosition.RIGHT_TOP:
379
+ style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;
380
+ style.left = `${offsets.left + boundElementSizes.width}px`;
381
+ style.maxWidth = `${availableSpace.right - distanceFromBound}px`;
382
+ if (position === PopoverPosition.RIGHT_TOP) {
383
+ style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;
384
+ }
385
+ break;
386
+ case PopoverPosition.LEFT:
387
+ case PopoverPosition.LEFT_BOTTOM:
388
+ style.top = `${offsets.top + boundElementSizes.height * offsetModifier - (position === PopoverPosition.LEFT_BOTTOM ? arrowModifier : 0)}px`;
389
+ style.right = `${offsets.right + boundElementSizes.width}px`;
390
+ style.maxWidth = `${availableSpace.left - distanceFromBound}px`;
391
+ if (position === PopoverPosition.LEFT_BOTTOM) {
392
+ style.maxHeight = `${availableSpace.bottom + boundElementSizes.height * offsetModifier}px`;
393
+ }
394
+ break;
395
+ case PopoverPosition.LEFT_TOP:
396
+ style.right = `${offsets.right + boundElementSizes.width}px`;
397
+ style.bottom = `${offsets.bottom + boundElementSizes.height * offsetModifier - arrowModifier}px`;
398
+ style.maxWidth = `${availableSpace.left - distanceFromBound}px`;
399
+ if (position === PopoverPosition.LEFT_TOP) {
400
+ style.maxHeight = `${availableSpace.top + boundElementSizes.height * offsetModifier}px`;
401
+ }
402
+ break;
403
+ }
156
404
  }
157
405
  /**
158
406
  * Set the position of the popover.
159
407
  */
160
408
  setPosition() {
161
- let element;
409
+ let boundElement;
162
410
  if (typeof this.bindTo === "string") {
163
- element = this.host.ownerDocument.querySelector(this.bindTo);
411
+ boundElement = this.host.ownerDocument.querySelector(this.bindTo);
164
412
  }
165
413
  else if (this.bindTo) {
166
- element = this.bindTo;
414
+ boundElement = this.bindTo;
167
415
  }
168
416
  else {
169
- element = this.host.parentElement;
417
+ boundElement = this.host.parentElement;
170
418
  }
171
- if (!element) {
419
+ if (!boundElement) {
172
420
  return;
173
421
  }
174
- const scrollContainer = findScrollableParent(element);
422
+ const scrollContainer = findScrollableParent(boundElement);
175
423
  const scrollingBoundingRect = scrollContainer.getBoundingClientRect();
176
424
  const offsetContainer = this.host.offsetParent;
177
425
  const relativeBoundingRect = offsetContainer
178
426
  ? computeOffset(offsetContainer, scrollContainer)
179
427
  : { top: 0, right: 0, bottom: 0, left: 0 };
180
- const boundingRect = computeOffset(element, scrollContainer);
181
- const top = boundingRect.top - scrollContainer.scrollTop;
182
- const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;
183
- const left = boundingRect.left - scrollContainer.scrollLeft;
184
- const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;
185
- const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);
186
- const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);
187
- const availableTop = Math.min(top, top + scrollingBoundingRect.top);
188
- const availableBottom = Math.min(bottom, bottom - overflowBottom);
189
- const availableLeft = Math.min(left, left + scrollingBoundingRect.left);
190
- const availableRight = Math.min(right, right - overflowRight);
191
- const availableHeight = availableTop + availableBottom + boundingRect.height;
192
- const availableWidth = availableLeft + availableRight + boundingRect.width;
193
- let position = this.currentPosition;
194
- const positions = [];
195
- if (this.position === PopoverPosition.AUTO) {
196
- /**
197
- * The `AUTO` position tries to place the popover in the 'safest' area,
198
- * where there's more space available.
199
- */
200
- if (availableLeft / availableWidth > 0.6) {
201
- positions.push(PopoverPosition.LEFT);
202
- }
203
- else if (availableLeft / availableWidth < 0.4) {
204
- positions.push(PopoverPosition.RIGHT);
205
- }
206
- if (availableTop / availableHeight > 0.9) {
207
- positions.unshift(PopoverPosition.TOP);
208
- }
209
- else if (availableTop / availableHeight > 0.6) {
210
- positions.push(PopoverPosition.TOP);
211
- }
212
- else if (availableTop / availableHeight < 0.1) {
213
- positions.unshift(PopoverPosition.BOTTOM);
214
- }
215
- else {
216
- positions.push(PopoverPosition.BOTTOM);
217
- }
218
- position = positions.join("_");
219
- }
220
- const style = this.host.style;
221
- style.position = "absolute";
222
- const offsetTop = boundingRect.top - relativeBoundingRect.top;
223
- const offsetRight = boundingRect.right - relativeBoundingRect.right;
224
- const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;
225
- const offsetLeft = boundingRect.left - relativeBoundingRect.left;
428
+ const boundElementRect = computeOffset(boundElement, scrollContainer);
429
+ const availableSpace = this.calculateAvailableSpace(boundElementRect, scrollContainer, scrollingBoundingRect);
430
+ const offsets = this.calculateRelativeOffsets(boundElementRect, relativeBoundingRect);
226
431
  const offsetModifier = this.center ? 0.5 : 0;
227
- const sizeModifier = this.center ? 0.5 : 0;
228
- if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {
229
- style.top = "auto";
230
- style.right = "auto";
231
- style.bottom = `${offsetBottom + boundingRect.height}px`;
232
- style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
233
- style.maxHeight = `${availableTop}px`;
234
- if (position === PopoverPosition.TOP_RIGHT) {
235
- style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
236
- }
237
- }
238
- else if (position === PopoverPosition.TOP_LEFT) {
239
- style.top = "auto";
240
- style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
241
- style.bottom = `${offsetBottom + boundingRect.height}px`;
242
- style.left = "auto";
243
- style.maxWidth = `${availableLeft}px`;
244
- style.maxHeight = `${availableTop}px`;
245
- }
246
- else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {
247
- style.top = `${offsetTop + boundingRect.height}px`;
248
- style.right = "auto";
249
- style.bottom = "auto";
250
- style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
251
- style.maxHeight = `${availableBottom}px`;
252
- if (position === PopoverPosition.BOTTOM_RIGHT) {
253
- style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
254
- }
255
- }
256
- else if (position === PopoverPosition.BOTTOM_LEFT) {
257
- style.top = `${offsetTop + boundingRect.height}px`;
258
- style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
259
- style.bottom = "auto";
260
- style.left = "auto";
261
- style.maxWidth = `${availableLeft}px`;
262
- style.maxHeight = `${availableBottom}px`;
263
- }
264
- else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {
265
- style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
266
- style.right = "auto";
267
- style.bottom = "auto";
268
- style.left = `${offsetLeft + boundingRect.width}px`;
269
- style.maxWidth = `${availableRight}px`;
270
- style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
271
- }
272
- else if (position === PopoverPosition.RIGHT_TOP) {
273
- style.top = "auto";
274
- style.right = "auto";
275
- style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
276
- style.left = `${offsetLeft + boundingRect.width}px`;
277
- style.maxWidth = `${availableRight}px`;
278
- style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
279
- }
280
- else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {
281
- style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
282
- style.right = `${offsetRight + boundingRect.width}px`;
283
- style.bottom = "auto";
284
- style.left = "auto";
285
- style.maxWidth = `${availableLeft}px`;
286
- style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
287
- }
288
- else if (position === PopoverPosition.LEFT_TOP) {
289
- style.top = "auto";
290
- style.right = `${offsetRight + boundingRect.width}px`;
291
- style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
292
- style.left = "auto";
293
- style.maxWidth = `${availableLeft}px`;
294
- style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
295
- }
296
- this.currentPosition = position || this.position;
297
- this.host.setAttribute("current-position", this.currentPosition);
432
+ const arrowModifier = this.showArrow && this.center ? 8 : 0; // 8px is the distance of the arrow center from the edge of the popover
433
+ const position = this.getOptimalPopoverPosition(this.position, availableSpace, { width: boundElementRect.width, height: boundElementRect.height }, offsetModifier);
434
+ const style = this.host.style;
435
+ this.applyPositionStyles(position, style, offsets, boundElementRect, availableSpace, offsetModifier, arrowModifier);
436
+ this.currentPosition = position;
298
437
  }
299
438
  componentWillLoad() {
300
439
  this.validatePosition(this.position);
301
440
  this.onOpen();
302
441
  }
442
+ componentDidLoad() {
443
+ this.setPosition();
444
+ }
445
+ disconnectedCallback() {
446
+ cancelAnimationFrame(this.animationFrameRequestId);
447
+ }
303
448
  render() {
304
- return h("slot", { key: 'f7f6f81dc2698b5d560503a984dcd47e377de0bc' });
449
+ return (h(Host, { key: '38c84d7959587dfef4ef66a4b76be519fe1e0f82', "current-position": this.currentPosition }, h("slot", { key: 'ccd1f8a455c7755e38b5aac231adcb9efeebee17' })));
305
450
  }
306
451
  static get is() { return "z-popover"; }
307
452
  static get encapsulation() { return "shadow"; }
@@ -319,7 +464,7 @@ export class ZPopover {
319
464
  return {
320
465
  "position": {
321
466
  "type": "string",
322
- "mutable": false,
467
+ "mutable": true,
323
468
  "complexType": {
324
469
  "original": "PopoverPosition",
325
470
  "resolved": "PopoverPosition.AUTO | PopoverPosition.BOTTOM | PopoverPosition.BOTTOM_LEFT | PopoverPosition.BOTTOM_RIGHT | PopoverPosition.LEFT | PopoverPosition.LEFT_BOTTOM | PopoverPosition.LEFT_TOP | PopoverPosition.RIGHT | PopoverPosition.RIGHT_BOTTOM | PopoverPosition.RIGHT_TOP | PopoverPosition.TOP | PopoverPosition.TOP_LEFT | PopoverPosition.TOP_RIGHT",
@@ -332,14 +477,14 @@ export class ZPopover {
332
477
  }
333
478
  },
334
479
  "required": false,
335
- "optional": false,
480
+ "optional": true,
336
481
  "docs": {
337
482
  "tags": [],
338
- "text": "Popover position."
483
+ "text": "The preferred position to render the popover.\nThe popover will automatically search another position if not enough space is available for the preferred position.\nIf the preferred position is not available, it will try to find the best position starting from `TOP` and going clockwise."
339
484
  },
340
485
  "attribute": "position",
341
486
  "reflect": true,
342
- "defaultValue": "PopoverPosition.AUTO"
487
+ "defaultValue": "PopoverPosition.TOP"
343
488
  },
344
489
  "open": {
345
490
  "type": "boolean",
@@ -501,4 +646,19 @@ export class ZPopover {
501
646
  }];
502
647
  }
503
648
  }
649
+ // Clockwise order of positions.
650
+ ZPopover.positionOrder = [
651
+ PopoverPosition.TOP_RIGHT,
652
+ PopoverPosition.TOP,
653
+ PopoverPosition.TOP_LEFT,
654
+ PopoverPosition.RIGHT_BOTTOM,
655
+ PopoverPosition.RIGHT,
656
+ PopoverPosition.RIGHT_TOP,
657
+ PopoverPosition.BOTTOM_LEFT,
658
+ PopoverPosition.BOTTOM,
659
+ PopoverPosition.BOTTOM_RIGHT,
660
+ PopoverPosition.LEFT_TOP,
661
+ PopoverPosition.LEFT,
662
+ PopoverPosition.LEFT_BOTTOM,
663
+ ];
504
664
  //# sourceMappingURL=index.js.map