@zanichelli/albe-web-components 4.2.0 → 5.0.0

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 (241) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/{index-0e75c8cc.js → index-5c16dc2b.js} +33 -0
  3. package/dist/cjs/index.cjs.js +2 -2
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{utils-97262bbd.js → utils-15c8b978.js} +1 -1
  6. package/dist/cjs/{utils-155eec04.js → utils-58afb908.js} +1 -1
  7. package/dist/cjs/web-components-library.cjs.js +1 -1
  8. package/dist/cjs/z-app-switcher_9.cjs.entry.js +3 -3
  9. package/dist/cjs/z-aria-alert.cjs.entry.js +1 -1
  10. package/dist/cjs/z-avatar.cjs.entry.js +1 -1
  11. package/dist/cjs/z-button-deprecated.cjs.entry.js +1 -1
  12. package/dist/cjs/z-button.cjs.entry.js +1 -1
  13. package/dist/cjs/z-card.cjs.entry.js +1 -1
  14. package/dist/cjs/z-chip.cjs.entry.js +2 -2
  15. package/dist/cjs/z-combobox.cjs.entry.js +2 -2
  16. package/dist/cjs/z-contextual-menu.cjs.entry.js +1 -1
  17. package/dist/cjs/z-cookiebar.cjs.entry.js +1 -1
  18. package/dist/cjs/z-date-picker.cjs.entry.js +2 -2
  19. package/dist/cjs/z-file-upload.cjs.entry.js +2 -2
  20. package/dist/cjs/z-file.cjs.entry.js +1 -1
  21. package/dist/cjs/z-footer.cjs.entry.js +1 -1
  22. package/dist/cjs/z-input-deprecated.cjs.entry.js +2 -2
  23. package/dist/cjs/z-input-label_2.cjs.entry.js +2 -2
  24. package/dist/cjs/z-list-group.cjs.entry.js +1 -1
  25. package/dist/cjs/z-list_2.cjs.entry.js +1 -1
  26. package/dist/cjs/z-menu-dropdown_2.cjs.entry.js +2 -2
  27. package/dist/cjs/z-messages-pocket.cjs.entry.js +1 -1
  28. package/dist/cjs/z-modal-login.cjs.entry.js +1 -1
  29. package/dist/cjs/z-myz-card-alert.cjs.entry.js +1 -1
  30. package/dist/cjs/z-myz-card-dictionary.cjs.entry.js +1 -1
  31. package/dist/cjs/z-myz-card-footer.cjs.entry.js +1 -1
  32. package/dist/cjs/z-myz-card-info.cjs.entry.js +2 -2
  33. package/dist/cjs/z-myz-card_4.cjs.entry.js +1 -1
  34. package/dist/cjs/z-myz-list-item.cjs.entry.js +2 -2
  35. package/dist/cjs/z-myz-topbar.cjs.entry.js +1 -1
  36. package/dist/cjs/z-navigation-tab-link.cjs.entry.js +1 -1
  37. package/dist/cjs/z-navigation-tab.cjs.entry.js +1 -1
  38. package/dist/cjs/z-navigation-tabs.cjs.entry.js +1 -1
  39. package/dist/cjs/z-offcanvas.cjs.entry.js +1 -1
  40. package/dist/cjs/z-otp.cjs.entry.js +1 -1
  41. package/dist/cjs/z-pagination-bar.cjs.entry.js +2 -2
  42. package/dist/cjs/z-pocket_3.cjs.entry.js +2 -2
  43. package/dist/cjs/z-popover-deprecated.cjs.entry.js +97 -303
  44. package/dist/cjs/z-popover.cjs.entry.js +2 -2
  45. package/dist/cjs/z-section-title.cjs.entry.js +1 -1
  46. package/dist/cjs/z-skip-to-content.cjs.entry.js +2 -2
  47. package/dist/cjs/z-slideshow.cjs.entry.js +2 -2
  48. package/dist/cjs/z-status-tag.cjs.entry.js +1 -1
  49. package/dist/cjs/z-table-cell.cjs.entry.js +1 -1
  50. package/dist/cjs/z-table-header.cjs.entry.js +2 -2
  51. package/dist/cjs/z-table-row.cjs.entry.js +1 -1
  52. package/dist/cjs/z-table.cjs.entry.js +1 -1
  53. package/dist/cjs/z-toast-notification-list.cjs.entry.js +1 -1
  54. package/dist/cjs/z-toast-notification.cjs.entry.js +1 -1
  55. package/dist/cjs/z-toggle-switch.cjs.entry.js +2 -2
  56. package/dist/cjs/z-tooltip-deprecated.cjs.entry.js +1 -1
  57. package/dist/cjs/z-tooltip.cjs.entry.js +1 -1
  58. package/dist/collection/beans/index.js +33 -0
  59. package/dist/collection/deprecated/z-popover-deprecated/index.js +173 -368
  60. package/dist/collection/deprecated/z-popover-deprecated/styles.css +188 -86
  61. package/dist/esm/{index-c1ce8cab.js → index-3786a7ff.js} +34 -1
  62. package/dist/esm/index.js +2 -2
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/{utils-fa9f38ec.js → utils-14da09de.js} +1 -1
  65. package/dist/esm/{utils-99c70c57.js → utils-d49ae9f0.js} +1 -1
  66. package/dist/esm/web-components-library.js +1 -1
  67. package/dist/esm/z-app-switcher_9.entry.js +3 -3
  68. package/dist/esm/z-aria-alert.entry.js +1 -1
  69. package/dist/esm/z-avatar.entry.js +1 -1
  70. package/dist/esm/z-button-deprecated.entry.js +1 -1
  71. package/dist/esm/z-button.entry.js +1 -1
  72. package/dist/esm/z-card.entry.js +1 -1
  73. package/dist/esm/z-chip.entry.js +2 -2
  74. package/dist/esm/z-combobox.entry.js +2 -2
  75. package/dist/esm/z-contextual-menu.entry.js +1 -1
  76. package/dist/esm/z-cookiebar.entry.js +1 -1
  77. package/dist/esm/z-date-picker.entry.js +2 -2
  78. package/dist/esm/z-file-upload.entry.js +2 -2
  79. package/dist/esm/z-file.entry.js +1 -1
  80. package/dist/esm/z-footer.entry.js +1 -1
  81. package/dist/esm/z-input-deprecated.entry.js +2 -2
  82. package/dist/esm/z-input-label_2.entry.js +2 -2
  83. package/dist/esm/z-list-group.entry.js +1 -1
  84. package/dist/esm/z-list_2.entry.js +1 -1
  85. package/dist/esm/z-menu-dropdown_2.entry.js +2 -2
  86. package/dist/esm/z-messages-pocket.entry.js +1 -1
  87. package/dist/esm/z-modal-login.entry.js +1 -1
  88. package/dist/esm/z-myz-card-alert.entry.js +1 -1
  89. package/dist/esm/z-myz-card-dictionary.entry.js +1 -1
  90. package/dist/esm/z-myz-card-footer.entry.js +1 -1
  91. package/dist/esm/z-myz-card-info.entry.js +2 -2
  92. package/dist/esm/z-myz-card_4.entry.js +1 -1
  93. package/dist/esm/z-myz-list-item.entry.js +2 -2
  94. package/dist/esm/z-myz-topbar.entry.js +1 -1
  95. package/dist/esm/z-navigation-tab-link.entry.js +1 -1
  96. package/dist/esm/z-navigation-tab.entry.js +1 -1
  97. package/dist/esm/z-navigation-tabs.entry.js +1 -1
  98. package/dist/esm/z-offcanvas.entry.js +1 -1
  99. package/dist/esm/z-otp.entry.js +1 -1
  100. package/dist/esm/z-pagination-bar.entry.js +2 -2
  101. package/dist/esm/z-pocket_3.entry.js +2 -2
  102. package/dist/esm/z-popover-deprecated.entry.js +98 -304
  103. package/dist/esm/z-popover.entry.js +2 -2
  104. package/dist/esm/z-section-title.entry.js +1 -1
  105. package/dist/esm/z-skip-to-content.entry.js +2 -2
  106. package/dist/esm/z-slideshow.entry.js +2 -2
  107. package/dist/esm/z-status-tag.entry.js +1 -1
  108. package/dist/esm/z-table-cell.entry.js +1 -1
  109. package/dist/esm/z-table-header.entry.js +2 -2
  110. package/dist/esm/z-table-row.entry.js +1 -1
  111. package/dist/esm/z-table.entry.js +1 -1
  112. package/dist/esm/z-toast-notification-list.entry.js +1 -1
  113. package/dist/esm/z-toast-notification.entry.js +1 -1
  114. package/dist/esm/z-toggle-switch.entry.js +2 -2
  115. package/dist/esm/z-tooltip-deprecated.entry.js +1 -1
  116. package/dist/esm/z-tooltip.entry.js +1 -1
  117. package/dist/types/beans/index.d.ts +30 -0
  118. package/dist/types/components.d.ts +28 -24
  119. package/dist/types/deprecated/z-popover-deprecated/index.d.ts +27 -51
  120. package/dist/web-components-library/index.esm.js +1 -1
  121. package/dist/web-components-library/{p-805af37b.entry.js → p-044edef0.entry.js} +1 -1
  122. package/dist/web-components-library/{p-897f9491.entry.js → p-0487d5f1.entry.js} +1 -1
  123. package/dist/web-components-library/{p-28e4abc4.entry.js → p-0610360b.entry.js} +1 -1
  124. package/{www/build/p-b6cd034b.js → dist/web-components-library/p-0b222589.js} +1 -1
  125. package/dist/web-components-library/{p-10be0462.entry.js → p-0bcc78d4.entry.js} +1 -1
  126. package/{www/build/p-91ec5eb4.entry.js → dist/web-components-library/p-0ccda54f.entry.js} +1 -1
  127. package/dist/web-components-library/{p-514719d2.entry.js → p-10c3285d.entry.js} +1 -1
  128. package/dist/web-components-library/{p-e007cd0b.entry.js → p-13174553.entry.js} +1 -1
  129. package/dist/web-components-library/{p-55f09348.entry.js → p-18c0f701.entry.js} +1 -1
  130. package/dist/web-components-library/{p-41f33f7b.entry.js → p-1c2331a4.entry.js} +1 -1
  131. package/dist/web-components-library/{p-f61fd81e.entry.js → p-206e5b31.entry.js} +1 -1
  132. package/dist/web-components-library/{p-e74b3fd9.entry.js → p-248e6c7d.entry.js} +1 -1
  133. package/dist/web-components-library/{p-8ddbbe24.entry.js → p-24ec049a.entry.js} +1 -1
  134. package/dist/web-components-library/{p-c8383456.entry.js → p-24f3a39e.entry.js} +1 -1
  135. package/dist/web-components-library/{p-970bd07c.entry.js → p-25b1a634.entry.js} +1 -1
  136. package/{www/build/p-870dabdc.entry.js → dist/web-components-library/p-286a2d0e.entry.js} +1 -1
  137. package/dist/web-components-library/{p-6bbd53ec.entry.js → p-286c4c99.entry.js} +1 -1
  138. package/dist/web-components-library/{p-f78d6123.entry.js → p-287678e2.entry.js} +1 -1
  139. package/dist/web-components-library/{p-ff4a0f6f.entry.js → p-2c86d1ea.entry.js} +1 -1
  140. package/dist/web-components-library/{p-5dcbba4e.entry.js → p-2d93e9e9.entry.js} +1 -1
  141. package/dist/web-components-library/{p-15fa8ca4.entry.js → p-33120ebd.entry.js} +1 -1
  142. package/{www/build/p-cd88cead.entry.js → dist/web-components-library/p-35f7cac2.entry.js} +1 -1
  143. package/dist/web-components-library/{p-46aecb12.entry.js → p-3dc21b58.entry.js} +1 -1
  144. package/dist/web-components-library/{p-b9cc2dfc.entry.js → p-4906f5a6.entry.js} +1 -1
  145. package/{www/build/p-1a76a57d.entry.js → dist/web-components-library/p-49602979.entry.js} +1 -1
  146. package/dist/web-components-library/{p-fdd91263.entry.js → p-49f8c86b.entry.js} +1 -1
  147. package/dist/web-components-library/{p-92895bce.entry.js → p-4a8fe1e0.entry.js} +1 -1
  148. package/dist/web-components-library/{p-1d5aa37b.entry.js → p-5553f117.entry.js} +1 -1
  149. package/dist/web-components-library/{p-053846df.entry.js → p-5a2dd46c.entry.js} +1 -1
  150. package/dist/web-components-library/{p-4be52491.entry.js → p-5c20338f.entry.js} +1 -1
  151. package/dist/web-components-library/{p-d04f3cb6.entry.js → p-60e042a0.entry.js} +1 -1
  152. package/dist/web-components-library/p-6897ca8c.js +1 -0
  153. package/dist/web-components-library/{p-53dade4b.entry.js → p-6d79baec.entry.js} +1 -1
  154. package/{www/build/p-78df5dbf.entry.js → dist/web-components-library/p-6db40dac.entry.js} +1 -1
  155. package/{www/build/p-fbfaa699.entry.js → dist/web-components-library/p-71f19680.entry.js} +1 -1
  156. package/{www/build/p-d6361790.entry.js → dist/web-components-library/p-7ce57dfd.entry.js} +1 -1
  157. package/dist/web-components-library/{p-8ce4b2c4.entry.js → p-80044bc0.entry.js} +1 -1
  158. package/{www/build/p-dd0efdbf.entry.js → dist/web-components-library/p-82217c76.entry.js} +1 -1
  159. package/dist/web-components-library/{p-0f6edb58.entry.js → p-95414290.entry.js} +1 -1
  160. package/dist/web-components-library/{p-659fc25e.entry.js → p-987f1f8a.entry.js} +1 -1
  161. package/dist/web-components-library/{p-1b1717c9.entry.js → p-99a76b4d.entry.js} +1 -1
  162. package/{www/build/p-4d6f2f01.entry.js → dist/web-components-library/p-9b563575.entry.js} +1 -1
  163. package/dist/web-components-library/{p-caa21a6f.entry.js → p-9c81ed70.entry.js} +1 -1
  164. package/dist/web-components-library/{p-c042e745.entry.js → p-a4245c8a.entry.js} +1 -1
  165. package/dist/web-components-library/{p-990b8236.entry.js → p-a88f4e49.entry.js} +1 -1
  166. package/dist/web-components-library/{p-bfc78a89.entry.js → p-a98ccf36.entry.js} +1 -1
  167. package/dist/web-components-library/{p-6c52ed1b.entry.js → p-bf3ea7b5.entry.js} +1 -1
  168. package/dist/web-components-library/{p-7f1cc90f.js → p-d41ca4c3.js} +1 -1
  169. package/{www/build/p-eca4cb15.entry.js → dist/web-components-library/p-e30a093f.entry.js} +1 -1
  170. package/dist/web-components-library/p-e9628876.entry.js +1 -0
  171. package/dist/web-components-library/p-ec0c7a06.entry.js +1 -0
  172. package/dist/web-components-library/{p-1eb357e8.entry.js → p-f9f5ab0b.entry.js} +1 -1
  173. package/dist/web-components-library/{p-99a562cb.entry.js → p-fd404599.entry.js} +1 -1
  174. package/dist/web-components-library/web-components-library.esm.js +1 -1
  175. package/package.json +1 -1
  176. package/www/build/index.esm.js +1 -1
  177. package/www/build/{p-805af37b.entry.js → p-044edef0.entry.js} +1 -1
  178. package/www/build/{p-897f9491.entry.js → p-0487d5f1.entry.js} +1 -1
  179. package/www/build/{p-28e4abc4.entry.js → p-0610360b.entry.js} +1 -1
  180. package/{dist/web-components-library/p-b6cd034b.js → www/build/p-0b222589.js} +1 -1
  181. package/www/build/{p-10be0462.entry.js → p-0bcc78d4.entry.js} +1 -1
  182. package/{dist/web-components-library/p-91ec5eb4.entry.js → www/build/p-0ccda54f.entry.js} +1 -1
  183. package/www/build/{p-514719d2.entry.js → p-10c3285d.entry.js} +1 -1
  184. package/www/build/{p-e007cd0b.entry.js → p-13174553.entry.js} +1 -1
  185. package/www/build/{p-55f09348.entry.js → p-18c0f701.entry.js} +1 -1
  186. package/www/build/{p-41f33f7b.entry.js → p-1c2331a4.entry.js} +1 -1
  187. package/www/build/{p-f61fd81e.entry.js → p-206e5b31.entry.js} +1 -1
  188. package/www/build/{p-e74b3fd9.entry.js → p-248e6c7d.entry.js} +1 -1
  189. package/www/build/{p-8ddbbe24.entry.js → p-24ec049a.entry.js} +1 -1
  190. package/www/build/{p-c8383456.entry.js → p-24f3a39e.entry.js} +1 -1
  191. package/www/build/{p-970bd07c.entry.js → p-25b1a634.entry.js} +1 -1
  192. package/{dist/web-components-library/p-870dabdc.entry.js → www/build/p-286a2d0e.entry.js} +1 -1
  193. package/www/build/{p-6bbd53ec.entry.js → p-286c4c99.entry.js} +1 -1
  194. package/www/build/{p-f78d6123.entry.js → p-287678e2.entry.js} +1 -1
  195. package/www/build/{p-ff4a0f6f.entry.js → p-2c86d1ea.entry.js} +1 -1
  196. package/www/build/{p-5dcbba4e.entry.js → p-2d93e9e9.entry.js} +1 -1
  197. package/www/build/{p-15fa8ca4.entry.js → p-33120ebd.entry.js} +1 -1
  198. package/{dist/web-components-library/p-cd88cead.entry.js → www/build/p-35f7cac2.entry.js} +1 -1
  199. package/www/build/{p-46aecb12.entry.js → p-3dc21b58.entry.js} +1 -1
  200. package/www/build/{p-b9cc2dfc.entry.js → p-4906f5a6.entry.js} +1 -1
  201. package/{dist/web-components-library/p-1a76a57d.entry.js → www/build/p-49602979.entry.js} +1 -1
  202. package/www/build/{p-fdd91263.entry.js → p-49f8c86b.entry.js} +1 -1
  203. package/www/build/{p-92895bce.entry.js → p-4a8fe1e0.entry.js} +1 -1
  204. package/www/build/{p-1d5aa37b.entry.js → p-5553f117.entry.js} +1 -1
  205. package/www/build/{p-053846df.entry.js → p-5a2dd46c.entry.js} +1 -1
  206. package/www/build/{p-4be52491.entry.js → p-5c20338f.entry.js} +1 -1
  207. package/www/build/{p-d04f3cb6.entry.js → p-60e042a0.entry.js} +1 -1
  208. package/www/build/p-6897ca8c.js +1 -0
  209. package/www/build/{p-53dade4b.entry.js → p-6d79baec.entry.js} +1 -1
  210. package/{dist/web-components-library/p-78df5dbf.entry.js → www/build/p-6db40dac.entry.js} +1 -1
  211. package/{dist/web-components-library/p-fbfaa699.entry.js → www/build/p-71f19680.entry.js} +1 -1
  212. package/{dist/web-components-library/p-d6361790.entry.js → www/build/p-7ce57dfd.entry.js} +1 -1
  213. package/www/build/{p-8ce4b2c4.entry.js → p-80044bc0.entry.js} +1 -1
  214. package/{dist/web-components-library/p-dd0efdbf.entry.js → www/build/p-82217c76.entry.js} +1 -1
  215. package/www/build/p-88b56b6e.css +1 -0
  216. package/www/build/{p-0f6edb58.entry.js → p-95414290.entry.js} +1 -1
  217. package/www/build/{p-659fc25e.entry.js → p-987f1f8a.entry.js} +1 -1
  218. package/www/build/{p-1b1717c9.entry.js → p-99a76b4d.entry.js} +1 -1
  219. package/{dist/web-components-library/p-4d6f2f01.entry.js → www/build/p-9b563575.entry.js} +1 -1
  220. package/www/build/{p-caa21a6f.entry.js → p-9c81ed70.entry.js} +1 -1
  221. package/www/build/{p-c042e745.entry.js → p-a4245c8a.entry.js} +1 -1
  222. package/www/build/{p-990b8236.entry.js → p-a88f4e49.entry.js} +1 -1
  223. package/www/build/{p-bfc78a89.entry.js → p-a98ccf36.entry.js} +1 -1
  224. package/www/build/p-ae4eff83.js +1 -0
  225. package/www/build/{p-6c52ed1b.entry.js → p-bf3ea7b5.entry.js} +1 -1
  226. package/www/build/{p-7f1cc90f.js → p-d41ca4c3.js} +1 -1
  227. package/{dist/web-components-library/p-eca4cb15.entry.js → www/build/p-e30a093f.entry.js} +1 -1
  228. package/www/build/p-e9628876.entry.js +1 -0
  229. package/www/build/p-ec0c7a06.entry.js +1 -0
  230. package/www/build/{p-1eb357e8.entry.js → p-f9f5ab0b.entry.js} +1 -1
  231. package/www/build/{p-99a562cb.entry.js → p-fd404599.entry.js} +1 -1
  232. package/www/build/web-components-library.esm.js +1 -1
  233. package/www/index.html +1 -1
  234. package/dist/web-components-library/p-b359a3b4.entry.js +0 -1
  235. package/dist/web-components-library/p-ed1cd6b1.js +0 -1
  236. package/dist/web-components-library/p-f26251dd.entry.js +0 -1
  237. package/www/build/p-975e9d42.js +0 -129
  238. package/www/build/p-b359a3b4.entry.js +0 -1
  239. package/www/build/p-ed1cd6b1.js +0 -1
  240. package/www/build/p-f26251dd.entry.js +0 -1
  241. package/www/build/p-fcff1237.css +0 -812
@@ -1,330 +1,126 @@
1
- import { Component, Prop, h, Watch, Listen, Element, State, Event, } from "@stencil/core";
2
- import { PopoverPositions, KeyboardKeys } from "../../beans";
1
+ import { Component, Prop, h, Host, State, Listen, Event, } from "@stencil/core";
2
+ import classNames from "classnames";
3
+ import { PopoverPosition, PopoverBorderRadius, PopoverShadow, KeyboardKeys, } from "../../beans";
3
4
  import { getElementTree } from "../../utils/utils";
4
- const documentElement = document.documentElement;
5
- function getParentElement(element) {
6
- if (element.parentNode.host) {
7
- return element.parentNode.host;
8
- }
9
- return element.parentNode;
10
- }
11
- /**
12
- * Find the closest scrollable parent of a node.
13
- *
14
- * @param {Element} element The node
15
- */
16
- function findScrollableParent(element) {
17
- let parent = getParentElement(element);
18
- while (parent && parent !== documentElement) {
19
- const { overflow, overflowX, overflowY } = window.getComputedStyle(parent);
20
- if (overflow === "hidden" ||
21
- overflowY === "hidden" ||
22
- overflowX === "hidden") {
23
- return parent;
24
- }
25
- if ((parent.scrollHeight > parent.clientHeight &&
26
- overflow !== "visible" &&
27
- overflowY !== "visible") ||
28
- (parent.scrollWidth > parent.clientWidth &&
29
- overflow !== "visible" &&
30
- overflowX !== "visible")) {
31
- return parent;
32
- }
33
- parent = getParentElement(parent);
34
- }
35
- return documentElement;
36
- }
37
- /**
38
- * Calculate computed offset.
39
- * It includes matrix transformations.
40
- * @param element The target element.
41
- * @param targetParentOffset The relative offset parent.
42
- * @return A client rect object.
43
- */
44
- function computeOffset(element, targetParentOffset) {
45
- const rect = element.getBoundingClientRect();
46
- const width = rect.width;
47
- const height = rect.height;
48
- let top = 0;
49
- let left = 0;
50
- let offsetParent = element;
51
- while (offsetParent && offsetParent != targetParentOffset) {
52
- left += offsetParent.offsetLeft;
53
- // document.body sometimes has offsetTop == 0 but still has an
54
- // offset because of children margins!
55
- if (offsetParent === document.body) {
56
- top += offsetParent.getBoundingClientRect().top + window.scrollY;
57
- }
58
- else {
59
- top += offsetParent.offsetTop;
60
- }
61
- if (window.DOMMatrix) {
62
- const style = window.getComputedStyle(offsetParent);
63
- const transform = style.transform || style.webkitTransform;
64
- const domMatrix = new DOMMatrix(transform);
65
- if (domMatrix) {
66
- left += domMatrix.m41;
67
- if (offsetParent !== document.body) {
68
- top += domMatrix.m42;
69
- }
70
- }
71
- }
72
- if (!offsetParent.offsetParent) {
73
- break;
74
- }
75
- offsetParent = offsetParent.offsetParent;
76
- }
77
- let parentWidth;
78
- let parentHeight;
79
- if (offsetParent === document.body) {
80
- parentWidth = window.innerWidth;
81
- parentHeight = window.innerHeight;
82
- }
83
- else {
84
- parentWidth = offsetParent.offsetWidth;
85
- parentHeight = offsetParent.offsetHeight;
86
- }
87
- const right = parentWidth - left - rect.width;
88
- const bottom = parentHeight - top - rect.height;
89
- return { top, right, bottom, left, width, height };
90
- }
91
- /**
92
- * Popover component.
93
- *
94
- * @cssprop --z-popover-theme--surface - background color of the popover.
95
- * @cssprop --z-popover-theme--text - foreground color of the popover.
96
- * @cssprop --z-popover-shadow - shadow of the popover.
97
- */
98
5
  export class ZPopoverDeprecated {
99
- constructor() {
100
- /** Popover position. */
101
- this.position = PopoverPositions.AUTO;
102
- /**
103
- * The open state of the popover.
104
- */
105
- this.open = false;
106
- /**
107
- * Whether to show popover's arrow.
108
- */
109
- this.showArrow = false;
110
- /**
111
- * Whether center the popup on the main side - according to "position".
112
- */
113
- this.center = false;
114
- }
115
- closePopoverWithKeyboard(e) {
116
- if (e.key === KeyboardKeys.ESC) {
117
- this.open = false;
118
- }
119
- }
120
- handleOutsideClick(e) {
121
- const tree = getElementTree(e.target);
122
- const parent = tree.find((elem) => elem.nodeName.toLowerCase() === "z-popover");
123
- if (!parent) {
124
- this.open = false;
125
- this.positionChange.emit({ position: this.currentPosition });
126
- }
127
- }
128
- validatePosition(newValue) {
129
- if (newValue &&
130
- Object.values(PopoverPositions).every((position) => newValue !== position)) {
131
- this.position = PopoverPositions.AUTO;
132
- }
133
- this.currentPosition = this.position;
134
- this.positionChange.emit({ position: this.currentPosition });
135
- }
136
6
  /**
137
- * Setup popover behaviors on opening.
7
+ * Constructor.
138
8
  */
139
- onOpen() {
140
- cancelAnimationFrame(this.animationFrameRequestId);
141
- if (this.open) {
142
- const setPosition = () => {
143
- if (this.open) {
144
- this.setPosition();
145
- this.animationFrameRequestId = requestAnimationFrame(setPosition);
146
- }
147
- };
148
- setPosition();
149
- }
150
- else {
151
- const style = this.host.style;
152
- style.removeProperty("top");
153
- style.removeProperty("right");
154
- style.removeProperty("bottom");
155
- style.removeProperty("left");
156
- style.removeProperty("max-width");
157
- style.removeProperty("max-height");
158
- this.currentPosition = undefined;
159
- }
160
- this.openChange.emit({ open: this.open });
9
+ constructor() {
10
+ /** [optional] Popover position */
11
+ this.position = PopoverPosition["after-up"];
12
+ /** [optional] Background color token for popover */
13
+ this.backgroundColor = "color-white";
14
+ /** [optional] Border radius token for popover */
15
+ this.borderRadius = PopoverBorderRadius.small;
16
+ /** [optional] Box shadow token for popover */
17
+ this.boxShadow = PopoverShadow["shadow-1"];
18
+ /** [optional] Show or hide arrow */
19
+ this.showArrow = false;
20
+ /** [optional] Sets padding for Popover container */
21
+ this.padding = "8px";
22
+ this.isVisible = false;
23
+ this.popoverPosition = this.position;
24
+ this.handleKeyDown = this.handleKeyDown.bind(this);
161
25
  }
162
- disconnectedCallback() {
163
- cancelAnimationFrame(this.animationFrameRequestId);
26
+ emitTriggerClick() {
27
+ this.triggerClick.emit({
28
+ isVisible: this.isVisible,
29
+ });
164
30
  }
165
- /**
166
- * Set the position of the popover.
167
- */
168
- setPosition() {
169
- let element;
170
- if (typeof this.bindTo === "string") {
171
- element = this.host.ownerDocument.querySelector(this.bindTo);
172
- }
173
- else if (this.bindTo) {
174
- element = this.bindTo;
175
- }
176
- else {
177
- element = this.host.parentElement;
178
- }
179
- if (!element) {
180
- return;
181
- }
182
- const scrollContainer = findScrollableParent(element);
183
- const scrollingBoundingRect = scrollContainer.getBoundingClientRect();
184
- const offsetContainer = this.host.offsetParent;
185
- const relativeBoundingRect = offsetContainer
186
- ? computeOffset(offsetContainer, scrollContainer)
187
- : { top: 0, right: 0, bottom: 0, left: 0 };
188
- const boundingRect = computeOffset(element, scrollContainer);
189
- const top = boundingRect.top - scrollContainer.scrollTop;
190
- const bottom = scrollingBoundingRect.height -
191
- (boundingRect.top + boundingRect.height) +
192
- scrollContainer.scrollTop;
193
- const left = boundingRect.left - scrollContainer.scrollLeft;
194
- const right = scrollingBoundingRect.width -
195
- (boundingRect.left + boundingRect.width) +
196
- scrollContainer.scrollLeft;
197
- const overflowBottom = Math.max(0, scrollingBoundingRect.top +
198
- scrollingBoundingRect.height -
199
- window.innerHeight);
200
- const overflowRight = Math.max(0, scrollingBoundingRect.left +
201
- scrollingBoundingRect.width -
202
- window.innerWidth);
203
- const availableTop = Math.min(top, top + scrollingBoundingRect.top);
204
- const availableBottom = Math.min(bottom, bottom - overflowBottom);
205
- const availableLeft = Math.min(left, left + scrollingBoundingRect.left);
206
- const availableRight = Math.min(right, right - overflowRight);
207
- const availableHeight = availableTop + availableBottom + boundingRect.height;
208
- const availableWidth = availableLeft + availableRight + boundingRect.width;
209
- let position = this.currentPosition;
210
- const positions = [];
211
- if (this.position === PopoverPositions.AUTO) {
212
- /**
213
- * The `AUTO` position tries to place the popover in the 'safest' area,
214
- * where there's more space available.
215
- */
216
- if (availableLeft / availableWidth > 0.6) {
217
- positions.push(PopoverPositions.LEFT);
31
+ openPopover() {
32
+ const width = document.body.clientWidth;
33
+ const height = window.innerHeight;
34
+ const rect = this.popoverElem.getBoundingClientRect();
35
+ const l = rect.left;
36
+ const r = rect.right;
37
+ const t = rect.top;
38
+ const b = rect.bottom;
39
+ let firstSide = this.position.split("-")[0];
40
+ let secondSide = this.position.split("-")[1];
41
+ // If top is outside viewport
42
+ if (t < 0) {
43
+ if (this.position.startsWith("above")) {
44
+ firstSide = "below";
218
45
  }
219
- else if (availableLeft / availableWidth < 0.4) {
220
- positions.push(PopoverPositions.RIGHT);
46
+ else {
47
+ secondSide = "down";
221
48
  }
222
- if (availableTop / availableHeight > 0.9) {
223
- positions.unshift(PopoverPositions.TOP);
49
+ }
50
+ // If bottom is outside viewport
51
+ if (b > height) {
52
+ if (this.position.startsWith("below")) {
53
+ firstSide = "above";
224
54
  }
225
- else if (availableTop / availableHeight > 0.6) {
226
- positions.push(PopoverPositions.TOP);
55
+ else {
56
+ secondSide = "up";
227
57
  }
228
- else if (availableTop / availableHeight < 0.1) {
229
- positions.unshift(PopoverPositions.BOTTOM);
58
+ }
59
+ // If right is outside viewport
60
+ if (r > width) {
61
+ if (this.position.startsWith("above") ||
62
+ this.position.startsWith("below")) {
63
+ secondSide = "left";
230
64
  }
231
65
  else {
232
- positions.push(PopoverPositions.BOTTOM);
66
+ firstSide = "before";
233
67
  }
234
- position = positions.join("_");
235
68
  }
236
- const style = this.host.style;
237
- style.position = "absolute";
238
- const offsetTop = boundingRect.top - relativeBoundingRect.top;
239
- const offsetRight = boundingRect.right - relativeBoundingRect.right;
240
- const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;
241
- const offsetLeft = boundingRect.left - relativeBoundingRect.left;
242
- const offsetModifier = this.center ? 0.5 : 0;
243
- const sizeModifier = this.center ? 0.5 : 0;
244
- if (position === PopoverPositions.TOP ||
245
- position === PopoverPositions.TOP_RIGHT) {
246
- style.top = "auto";
247
- style.right = "auto";
248
- style.bottom = `${offsetBottom + boundingRect.height}px`;
249
- style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
250
- style.maxHeight = `${availableTop}px`;
251
- if (position === PopoverPositions.TOP_RIGHT) {
252
- style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
69
+ // If left is outside viewport
70
+ if (l < 0) {
71
+ if (this.position.startsWith("above") ||
72
+ this.position.startsWith("below")) {
73
+ secondSide = "right";
253
74
  }
254
- }
255
- else if (position === PopoverPositions.TOP_LEFT) {
256
- style.top = "auto";
257
- style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
258
- style.bottom = `${offsetBottom + boundingRect.height}px`;
259
- style.left = "auto";
260
- style.maxWidth = `${availableLeft}px`;
261
- style.maxHeight = `${availableTop}px`;
262
- }
263
- else if (position === PopoverPositions.BOTTOM ||
264
- position === PopoverPositions.BOTTOM_RIGHT) {
265
- style.top = `${offsetTop + boundingRect.height}px`;
266
- style.right = "auto";
267
- style.bottom = "auto";
268
- style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
269
- style.maxHeight = `${availableBottom}px`;
270
- if (position === PopoverPositions.BOTTOM_RIGHT) {
271
- style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
75
+ else {
76
+ firstSide = "after";
272
77
  }
273
78
  }
274
- else if (position === PopoverPositions.BOTTOM_LEFT) {
275
- style.top = `${offsetTop + boundingRect.height}px`;
276
- style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
277
- style.bottom = "auto";
278
- style.left = "auto";
279
- style.maxWidth = `${availableLeft}px`;
280
- style.maxHeight = `${availableBottom}px`;
281
- }
282
- else if (position === PopoverPositions.RIGHT ||
283
- position === PopoverPositions.RIGHT_BOTTOM) {
284
- style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
285
- style.right = "auto";
286
- style.bottom = "auto";
287
- style.left = `${offsetLeft + boundingRect.width}px`;
288
- style.maxWidth = `${availableRight}px`;
289
- style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
290
- }
291
- else if (position === PopoverPositions.RIGHT_TOP) {
292
- style.top = "auto";
293
- style.right = "auto";
294
- style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
295
- style.left = `${offsetLeft + boundingRect.width}px`;
296
- style.maxWidth = `${availableRight}px`;
297
- style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
298
- }
299
- else if (position === PopoverPositions.LEFT ||
300
- position === PopoverPositions.LEFT_BOTTOM) {
301
- style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
302
- style.right = `${offsetRight + boundingRect.width}px`;
303
- style.bottom = "auto";
304
- style.left = "auto";
305
- style.maxWidth = `${availableLeft}px`;
306
- style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
79
+ this.popoverPosition = PopoverPosition[`${firstSide}-${secondSide}`];
80
+ this.isVisible = true;
81
+ }
82
+ closePopover() {
83
+ this.popoverPosition = this.position;
84
+ this.isVisible = false;
85
+ }
86
+ closePopoverWithKeyboard(e) {
87
+ if (e.key === KeyboardKeys.ESC) {
88
+ this.closePopover();
307
89
  }
308
- else if (position === PopoverPositions.LEFT_TOP) {
309
- style.top = "auto";
310
- style.right = `${offsetRight + boundingRect.width}px`;
311
- style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
312
- style.left = "auto";
313
- style.maxWidth = `${availableLeft}px`;
314
- style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
90
+ }
91
+ handleClick(event) {
92
+ this.isVisible ? this.closePopover() : this.openPopover();
93
+ this.emitTriggerClick();
94
+ event.stopPropagation();
95
+ }
96
+ handleKeyDown(event) {
97
+ if (event.code === KeyboardKeys.ENTER) {
98
+ this.isVisible ? this.closePopover() : this.openPopover();
315
99
  }
316
- this.currentPosition = position || this.position;
317
- this.host.setAttribute('current-position', this.currentPosition);
318
100
  }
319
- componentWillLoad() {
320
- this.validatePosition(this.position);
321
- this.onOpen();
101
+ handleOutsideClick(e) {
102
+ const tree = getElementTree(e.target);
103
+ const parent = tree.find((elem) => elem.nodeName.toLowerCase() === "z-popover-deprecated");
104
+ if (!parent) {
105
+ this.closePopover();
106
+ }
322
107
  }
323
108
  render() {
324
- return h("slot", null);
109
+ return (h(Host, { onKeyDown: this.handleKeyDown },
110
+ h("div", { tabindex: "0", onClick: (event) => this.handleClick(event), onKeyDown: (event) => {
111
+ if (event.key === KeyboardKeys.ENTER) {
112
+ this.handleClick(event);
113
+ }
114
+ } },
115
+ h("slot", { name: "trigger" })),
116
+ h("div", { ref: (e) => (this.popoverElem = e), class: classNames("popover-content-container", this.popoverPosition, `border-radius-${this.borderRadius}`, this.boxShadow, { "show-arrow": this.showArrow }, { visible: this.isVisible }), style: {
117
+ backgroundColor: `var(--${this.backgroundColor})`,
118
+ padding: this.padding,
119
+ } },
120
+ h("slot", { name: "popover" }))));
325
121
  }
326
122
  static get is() { return "z-popover-deprecated"; }
327
- static get encapsulation() { return "shadow"; }
123
+ static get encapsulation() { return "scoped"; }
328
124
  static get originalStyleUrls() { return {
329
125
  "$": ["styles.css"]
330
126
  }; }
@@ -334,54 +130,78 @@ export class ZPopoverDeprecated {
334
130
  static get properties() { return {
335
131
  "position": {
336
132
  "type": "string",
337
- "mutable": true,
133
+ "mutable": false,
338
134
  "complexType": {
339
- "original": "PopoverPositions",
340
- "resolved": "PopoverPositions.AUTO | PopoverPositions.BOTTOM | PopoverPositions.BOTTOM_LEFT | PopoverPositions.BOTTOM_RIGHT | PopoverPositions.LEFT | PopoverPositions.LEFT_BOTTOM | PopoverPositions.LEFT_TOP | PopoverPositions.RIGHT | PopoverPositions.RIGHT_BOTTOM | PopoverPositions.RIGHT_TOP | PopoverPositions.TOP | PopoverPositions.TOP_LEFT | PopoverPositions.TOP_RIGHT",
135
+ "original": "PopoverPosition",
136
+ "resolved": "typeof PopoverPosition[\"above-center\"] | typeof PopoverPosition[\"above-left\"] | typeof PopoverPosition[\"above-right\"] | typeof PopoverPosition[\"after-center\"] | typeof PopoverPosition[\"after-down\"] | typeof PopoverPosition[\"after-up\"] | typeof PopoverPosition[\"before-center\"] | typeof PopoverPosition[\"before-down\"] | typeof PopoverPosition[\"before-up\"] | typeof PopoverPosition[\"below-center\"] | typeof PopoverPosition[\"below-left\"] | typeof PopoverPosition[\"below-right\"]",
341
137
  "references": {
342
- "PopoverPositions": {
138
+ "PopoverPosition": {
343
139
  "location": "import",
344
140
  "path": "../../beans"
345
141
  }
346
142
  }
347
143
  },
348
144
  "required": false,
349
- "optional": false,
145
+ "optional": true,
350
146
  "docs": {
351
147
  "tags": [],
352
- "text": "Popover position."
148
+ "text": "[optional] Popover position"
353
149
  },
354
150
  "attribute": "position",
355
- "reflect": true,
356
- "defaultValue": "PopoverPositions.AUTO"
151
+ "reflect": false,
152
+ "defaultValue": "PopoverPosition[\"after-up\"]"
357
153
  },
358
- "open": {
359
- "type": "boolean",
360
- "mutable": true,
154
+ "backgroundColor": {
155
+ "type": "string",
156
+ "mutable": false,
361
157
  "complexType": {
362
- "original": "boolean",
363
- "resolved": "boolean",
158
+ "original": "string",
159
+ "resolved": "string",
364
160
  "references": {}
365
161
  },
366
162
  "required": false,
367
- "optional": false,
163
+ "optional": true,
368
164
  "docs": {
369
165
  "tags": [],
370
- "text": "The open state of the popover."
166
+ "text": "[optional] Background color token for popover"
371
167
  },
372
- "attribute": "open",
373
- "reflect": true,
374
- "defaultValue": "false"
168
+ "attribute": "background-color",
169
+ "reflect": false,
170
+ "defaultValue": "\"color-white\""
171
+ },
172
+ "borderRadius": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "PopoverBorderRadius",
177
+ "resolved": "PopoverBorderRadius.medium | PopoverBorderRadius.none | PopoverBorderRadius.small",
178
+ "references": {
179
+ "PopoverBorderRadius": {
180
+ "location": "import",
181
+ "path": "../../beans"
182
+ }
183
+ }
184
+ },
185
+ "required": false,
186
+ "optional": true,
187
+ "docs": {
188
+ "tags": [],
189
+ "text": "[optional] Border radius token for popover"
190
+ },
191
+ "attribute": "border-radius",
192
+ "reflect": false,
193
+ "defaultValue": "PopoverBorderRadius.small"
375
194
  },
376
- "bindTo": {
195
+ "boxShadow": {
377
196
  "type": "string",
378
197
  "mutable": false,
379
198
  "complexType": {
380
- "original": "string | HTMLElement",
381
- "resolved": "HTMLElement | string",
199
+ "original": "PopoverShadow",
200
+ "resolved": "typeof PopoverShadow[\"shadow-1\"] | typeof PopoverShadow[\"shadow-12\"] | typeof PopoverShadow[\"shadow-16\"] | typeof PopoverShadow[\"shadow-2\"] | typeof PopoverShadow[\"shadow-24\"] | typeof PopoverShadow[\"shadow-3\"] | typeof PopoverShadow[\"shadow-4\"] | typeof PopoverShadow[\"shadow-6\"] | typeof PopoverShadow[\"shadow-8\"]",
382
201
  "references": {
383
- "HTMLElement": {
384
- "location": "global"
202
+ "PopoverShadow": {
203
+ "location": "import",
204
+ "path": "../../beans"
385
205
  }
386
206
  }
387
207
  },
@@ -389,10 +209,11 @@ export class ZPopoverDeprecated {
389
209
  "optional": true,
390
210
  "docs": {
391
211
  "tags": [],
392
- "text": "The selector or the element bound with the popover."
212
+ "text": "[optional] Box shadow token for popover"
393
213
  },
394
- "attribute": "bind-to",
395
- "reflect": false
214
+ "attribute": "box-shadow",
215
+ "reflect": false,
216
+ "defaultValue": "PopoverShadow[\"shadow-1\"]"
396
217
  },
397
218
  "showArrow": {
398
219
  "type": "boolean",
@@ -403,61 +224,47 @@ export class ZPopoverDeprecated {
403
224
  "references": {}
404
225
  },
405
226
  "required": false,
406
- "optional": false,
227
+ "optional": true,
407
228
  "docs": {
408
229
  "tags": [],
409
- "text": "Whether to show popover's arrow."
230
+ "text": "[optional] Show or hide arrow"
410
231
  },
411
232
  "attribute": "show-arrow",
412
- "reflect": true,
233
+ "reflect": false,
413
234
  "defaultValue": "false"
414
235
  },
415
- "center": {
416
- "type": "boolean",
236
+ "padding": {
237
+ "type": "string",
417
238
  "mutable": false,
418
239
  "complexType": {
419
- "original": "boolean",
420
- "resolved": "boolean",
240
+ "original": "string",
241
+ "resolved": "string",
421
242
  "references": {}
422
243
  },
423
244
  "required": false,
424
- "optional": false,
245
+ "optional": true,
425
246
  "docs": {
426
247
  "tags": [],
427
- "text": "Whether center the popup on the main side - according to \"position\"."
248
+ "text": "[optional] Sets padding for Popover container"
428
249
  },
429
- "attribute": "center",
430
- "reflect": true,
431
- "defaultValue": "false"
250
+ "attribute": "padding",
251
+ "reflect": false,
252
+ "defaultValue": "\"8px\""
432
253
  }
433
254
  }; }
434
255
  static get states() { return {
435
- "currentPosition": {}
256
+ "isVisible": {},
257
+ "popoverPosition": {}
436
258
  }; }
437
259
  static get events() { return [{
438
- "method": "positionChange",
439
- "name": "positionChange",
440
- "bubbles": true,
441
- "cancelable": true,
442
- "composed": true,
443
- "docs": {
444
- "tags": [],
445
- "text": "Position change event."
446
- },
447
- "complexType": {
448
- "original": "any",
449
- "resolved": "any",
450
- "references": {}
451
- }
452
- }, {
453
- "method": "openChange",
454
- "name": "openChange",
260
+ "method": "triggerClick",
261
+ "name": "triggerClick",
455
262
  "bubbles": true,
456
263
  "cancelable": true,
457
264
  "composed": true,
458
265
  "docs": {
459
266
  "tags": [],
460
- "text": "Open change event."
267
+ "text": "Emitted on popover click, returns isVisible state"
461
268
  },
462
269
  "complexType": {
463
270
  "original": "any",
@@ -465,15 +272,13 @@ export class ZPopoverDeprecated {
465
272
  "references": {}
466
273
  }
467
274
  }]; }
468
- static get elementRef() { return "host"; }
469
- static get watchers() { return [{
470
- "propName": "position",
471
- "methodName": "validatePosition"
472
- }, {
473
- "propName": "open",
474
- "methodName": "onOpen"
475
- }]; }
476
275
  static get listeners() { return [{
276
+ "name": "closePopover",
277
+ "method": "closePopover",
278
+ "target": undefined,
279
+ "capture": false,
280
+ "passive": false
281
+ }, {
477
282
  "name": "keyup",
478
283
  "method": "closePopoverWithKeyboard",
479
284
  "target": "window",