@content-blocks/js 0.3.2

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 (369) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/dist/cjs/BehaviorSubject-771fd78b.js +640 -0
  4. package/dist/cjs/BehaviorSubject-771fd78b.js.map +1 -0
  5. package/dist/cjs/Youtube-41424972.js +807 -0
  6. package/dist/cjs/Youtube-41424972.js.map +1 -0
  7. package/dist/cjs/content-accordion.cjs.entry.js +114 -0
  8. package/dist/cjs/content-accordion.cjs.entry.js.map +1 -0
  9. package/dist/cjs/content-blocks.cjs.js +25 -0
  10. package/dist/cjs/content-blocks.cjs.js.map +1 -0
  11. package/dist/cjs/content-button_4.cjs.entry.js +2165 -0
  12. package/dist/cjs/content-button_4.cjs.entry.js.map +1 -0
  13. package/dist/cjs/content-carousel-8b0e8962.js +1488 -0
  14. package/dist/cjs/content-carousel-8b0e8962.js.map +1 -0
  15. package/dist/cjs/content-carousel.cjs.entry.js +13 -0
  16. package/dist/cjs/content-carousel.cjs.entry.js.map +1 -0
  17. package/dist/cjs/content-grid-formatter.cjs.entry.js +50 -0
  18. package/dist/cjs/content-grid-formatter.cjs.entry.js.map +1 -0
  19. package/dist/cjs/content-hero-block.cjs.entry.js +46 -0
  20. package/dist/cjs/content-hero-block.cjs.entry.js.map +1 -0
  21. package/dist/cjs/content-image.cjs.entry.js +95 -0
  22. package/dist/cjs/content-image.cjs.entry.js.map +1 -0
  23. package/dist/cjs/content-navigation-block.cjs.entry.js +62 -0
  24. package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -0
  25. package/dist/cjs/content-split-block.cjs.entry.js +36 -0
  26. package/dist/cjs/content-split-block.cjs.entry.js.map +1 -0
  27. package/dist/cjs/content-tabs.cjs.entry.js +219 -0
  28. package/dist/cjs/content-tabs.cjs.entry.js.map +1 -0
  29. package/dist/cjs/content-text-block.cjs.entry.js +48 -0
  30. package/dist/cjs/content-text-block.cjs.entry.js.map +1 -0
  31. package/dist/cjs/content-tout-block.cjs.entry.js +32 -0
  32. package/dist/cjs/content-tout-block.cjs.entry.js.map +1 -0
  33. package/dist/cjs/content-video.cjs.entry.js +114 -0
  34. package/dist/cjs/content-video.cjs.entry.js.map +1 -0
  35. package/dist/cjs/index-a42fb1d0.js +2116 -0
  36. package/dist/cjs/index-a42fb1d0.js.map +1 -0
  37. package/dist/cjs/index.cjs.js +11 -0
  38. package/dist/cjs/index.cjs.js.map +1 -0
  39. package/dist/cjs/loader.cjs.js +15 -0
  40. package/dist/cjs/loader.cjs.js.map +1 -0
  41. package/dist/cjs/swiper-8c9ab198.js +3612 -0
  42. package/dist/cjs/swiper-8c9ab198.js.map +1 -0
  43. package/dist/cjs/utils-6c985f2f.js +113 -0
  44. package/dist/cjs/utils-6c985f2f.js.map +1 -0
  45. package/dist/cjs/video.es-7d4d33f5.js +64206 -0
  46. package/dist/cjs/video.es-7d4d33f5.js.map +1 -0
  47. package/dist/cjs/window-resize-service-c9766178.js +35 -0
  48. package/dist/cjs/window-resize-service-c9766178.js.map +1 -0
  49. package/dist/collection/blocks/content-hero-block/content-hero-block.css +39 -0
  50. package/dist/collection/blocks/content-hero-block/content-hero-block.js +138 -0
  51. package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +1 -0
  52. package/dist/collection/blocks/content-hero-block/test/content-hero-block.e2e.js +10 -0
  53. package/dist/collection/blocks/content-hero-block/test/content-hero-block.e2e.js.map +1 -0
  54. package/dist/collection/blocks/content-hero-block/test/content-hero-block.spec.js +18 -0
  55. package/dist/collection/blocks/content-hero-block/test/content-hero-block.spec.js.map +1 -0
  56. package/dist/collection/blocks/content-split-block/content-split-block.css +18 -0
  57. package/dist/collection/blocks/content-split-block/content-split-block.js +125 -0
  58. package/dist/collection/blocks/content-split-block/content-split-block.js.map +1 -0
  59. package/dist/collection/blocks/content-split-block/test/content-split-block.e2e.js +10 -0
  60. package/dist/collection/blocks/content-split-block/test/content-split-block.e2e.js.map +1 -0
  61. package/dist/collection/blocks/content-split-block/test/content-split-block.spec.js +18 -0
  62. package/dist/collection/blocks/content-split-block/test/content-split-block.spec.js.map +1 -0
  63. package/dist/collection/blocks/content-text-block/content-text-block.css +47 -0
  64. package/dist/collection/blocks/content-text-block/content-text-block.js +192 -0
  65. package/dist/collection/blocks/content-text-block/content-text-block.js.map +1 -0
  66. package/dist/collection/blocks/content-text-block/test/content-text-block.e2e.js +10 -0
  67. package/dist/collection/blocks/content-text-block/test/content-text-block.e2e.js.map +1 -0
  68. package/dist/collection/blocks/content-text-block/test/content-text-block.spec.js +18 -0
  69. package/dist/collection/blocks/content-text-block/test/content-text-block.spec.js.map +1 -0
  70. package/dist/collection/blocks/content-tout-block/content-tout-block.css +35 -0
  71. package/dist/collection/blocks/content-tout-block/content-tout-block.js +74 -0
  72. package/dist/collection/blocks/content-tout-block/content-tout-block.js.map +1 -0
  73. package/dist/collection/blocks/content-tout-block/test/content-tout-block.e2e.js +10 -0
  74. package/dist/collection/blocks/content-tout-block/test/content-tout-block.e2e.js.map +1 -0
  75. package/dist/collection/blocks/content-tout-block/test/content-tout-block.spec.js +18 -0
  76. package/dist/collection/blocks/content-tout-block/test/content-tout-block.spec.js.map +1 -0
  77. package/dist/collection/collection-manifest.json +27 -0
  78. package/dist/collection/components/content-accordion/content-accordion.css +11 -0
  79. package/dist/collection/components/content-accordion/content-accordion.js +33 -0
  80. package/dist/collection/components/content-accordion/content-accordion.js.map +1 -0
  81. package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js +87 -0
  82. package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js.map +1 -0
  83. package/dist/collection/components/content-accordion/test/content-accordion.e2e.js +10 -0
  84. package/dist/collection/components/content-accordion/test/content-accordion.e2e.js.map +1 -0
  85. package/dist/collection/components/content-accordion/test/content-accordion.spec.js +18 -0
  86. package/dist/collection/components/content-accordion/test/content-accordion.spec.js.map +1 -0
  87. package/dist/collection/components/content-carousel/content-carousel.css +21 -0
  88. package/dist/collection/components/content-carousel/content-carousel.js +152 -0
  89. package/dist/collection/components/content-carousel/content-carousel.js.map +1 -0
  90. package/dist/collection/components/content-carousel/test/content-carousel.e2e.js +10 -0
  91. package/dist/collection/components/content-carousel/test/content-carousel.e2e.js.map +1 -0
  92. package/dist/collection/components/content-carousel/test/content-carousel.spec.js +18 -0
  93. package/dist/collection/components/content-carousel/test/content-carousel.spec.js.map +1 -0
  94. package/dist/collection/components/content-navigation-block/content-navigation-block.css +51 -0
  95. package/dist/collection/components/content-navigation-block/content-navigation-block.js +146 -0
  96. package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -0
  97. package/dist/collection/components/content-navigation-block/test/content-navigation-block.e2e.js +10 -0
  98. package/dist/collection/components/content-navigation-block/test/content-navigation-block.e2e.js.map +1 -0
  99. package/dist/collection/components/content-navigation-block/test/content-navigation-block.spec.js +18 -0
  100. package/dist/collection/components/content-navigation-block/test/content-navigation-block.spec.js.map +1 -0
  101. package/dist/collection/components/content-overlay/content-overlay.css +103 -0
  102. package/dist/collection/components/content-overlay/content-overlay.js +384 -0
  103. package/dist/collection/components/content-overlay/content-overlay.js.map +1 -0
  104. package/dist/collection/components/content-overlay/libraries/aria-dialog.js +356 -0
  105. package/dist/collection/components/content-overlay/libraries/aria-dialog.js.map +1 -0
  106. package/dist/collection/components/content-overlay/libraries/aria-utilities.js +78 -0
  107. package/dist/collection/components/content-overlay/libraries/aria-utilities.js.map +1 -0
  108. package/dist/collection/components/content-overlay/test/content-overlay.e2e.js +10 -0
  109. package/dist/collection/components/content-overlay/test/content-overlay.e2e.js.map +1 -0
  110. package/dist/collection/components/content-overlay/test/content-overlay.spec.js +18 -0
  111. package/dist/collection/components/content-overlay/test/content-overlay.spec.js.map +1 -0
  112. package/dist/collection/components/content-tabs/content-tabs.css +19 -0
  113. package/dist/collection/components/content-tabs/content-tabs.js +27 -0
  114. package/dist/collection/components/content-tabs/content-tabs.js.map +1 -0
  115. package/dist/collection/components/content-tabs/libraries/w3_tabs.js +223 -0
  116. package/dist/collection/components/content-tabs/libraries/w3_tabs.js.map +1 -0
  117. package/dist/collection/components/content-tabs/test/content-tabs.e2e.js +10 -0
  118. package/dist/collection/components/content-tabs/test/content-tabs.e2e.js.map +1 -0
  119. package/dist/collection/components/content-tabs/test/content-tabs.spec.js +18 -0
  120. package/dist/collection/components/content-tabs/test/content-tabs.spec.js.map +1 -0
  121. package/dist/collection/elements/content-button/content-button.css +37 -0
  122. package/dist/collection/elements/content-button/content-button.js +257 -0
  123. package/dist/collection/elements/content-button/content-button.js.map +1 -0
  124. package/dist/collection/elements/content-button/test/content-button.e2e.js +10 -0
  125. package/dist/collection/elements/content-button/test/content-button.e2e.js.map +1 -0
  126. package/dist/collection/elements/content-button/test/content-button.spec.js +18 -0
  127. package/dist/collection/elements/content-button/test/content-button.spec.js.map +1 -0
  128. package/dist/collection/elements/content-image/content-image.css +53 -0
  129. package/dist/collection/elements/content-image/content-image.js +305 -0
  130. package/dist/collection/elements/content-image/content-image.js.map +1 -0
  131. package/dist/collection/elements/content-image/test/content-image.e2e.js +10 -0
  132. package/dist/collection/elements/content-image/test/content-image.e2e.js.map +1 -0
  133. package/dist/collection/elements/content-image/test/content-image.spec.js +18 -0
  134. package/dist/collection/elements/content-image/test/content-image.spec.js.map +1 -0
  135. package/dist/collection/elements/content-line/content-line.css +18 -0
  136. package/dist/collection/elements/content-line/content-line.e2e.js +10 -0
  137. package/dist/collection/elements/content-line/content-line.e2e.js.map +1 -0
  138. package/dist/collection/elements/content-line/content-line.js +229 -0
  139. package/dist/collection/elements/content-line/content-line.js.map +1 -0
  140. package/dist/collection/elements/content-video/content-video.css +75 -0
  141. package/dist/collection/elements/content-video/content-video.js +391 -0
  142. package/dist/collection/elements/content-video/content-video.js.map +1 -0
  143. package/dist/collection/elements/content-video/test/content-video.e2e.js +10 -0
  144. package/dist/collection/elements/content-video/test/content-video.e2e.js.map +1 -0
  145. package/dist/collection/elements/content-video/test/content-video.spec.js +18 -0
  146. package/dist/collection/elements/content-video/test/content-video.spec.js.map +1 -0
  147. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +43 -0
  148. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +269 -0
  149. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -0
  150. package/dist/collection/formatters/content-grid-formatter/test/content-grid-formatter.e2e.js +10 -0
  151. package/dist/collection/formatters/content-grid-formatter/test/content-grid-formatter.e2e.js.map +1 -0
  152. package/dist/collection/formatters/content-grid-formatter/test/content-grid-formatter.spec.js +18 -0
  153. package/dist/collection/formatters/content-grid-formatter/test/content-grid-formatter.spec.js.map +1 -0
  154. package/dist/collection/formatters/content-spacer/content-spacer.css +32 -0
  155. package/dist/collection/formatters/content-spacer/content-spacer.js +350 -0
  156. package/dist/collection/formatters/content-spacer/content-spacer.js.map +1 -0
  157. package/dist/collection/formatters/content-spacer/test/content-spacer.e2e.js +10 -0
  158. package/dist/collection/formatters/content-spacer/test/content-spacer.e2e.js.map +1 -0
  159. package/dist/collection/formatters/content-spacer/test/content-spacer.spec.js +18 -0
  160. package/dist/collection/formatters/content-spacer/test/content-spacer.spec.js.map +1 -0
  161. package/dist/collection/globalScript.js +15 -0
  162. package/dist/collection/globalScript.js.map +1 -0
  163. package/dist/collection/index.js +3 -0
  164. package/dist/collection/index.js.map +1 -0
  165. package/dist/collection/sass/_mixins.scss +249 -0
  166. package/dist/collection/sass/_variables.scss +18 -0
  167. package/dist/collection/services/content-events-service.js +23 -0
  168. package/dist/collection/services/content-events-service.js.map +1 -0
  169. package/dist/collection/services/window-resize-service.js +29 -0
  170. package/dist/collection/services/window-resize-service.js.map +1 -0
  171. package/dist/collection/utils/utils.js +88 -0
  172. package/dist/collection/utils/utils.js.map +1 -0
  173. package/dist/collection/utils/utils.spec.js +1 -0
  174. package/dist/collection/utils/utils.spec.js.map +1 -0
  175. package/dist/components/BehaviorSubject.js +637 -0
  176. package/dist/components/BehaviorSubject.js.map +1 -0
  177. package/dist/components/Youtube.js +805 -0
  178. package/dist/components/Youtube.js.map +1 -0
  179. package/dist/components/content-accordion.d.ts +11 -0
  180. package/dist/components/content-accordion.js +127 -0
  181. package/dist/components/content-accordion.js.map +1 -0
  182. package/dist/components/content-button.d.ts +11 -0
  183. package/dist/components/content-button.js +88 -0
  184. package/dist/components/content-button.js.map +1 -0
  185. package/dist/components/content-carousel.d.ts +11 -0
  186. package/dist/components/content-carousel.js +1489 -0
  187. package/dist/components/content-carousel.js.map +1 -0
  188. package/dist/components/content-grid-formatter.d.ts +11 -0
  189. package/dist/components/content-grid-formatter.js +8 -0
  190. package/dist/components/content-grid-formatter.js.map +1 -0
  191. package/dist/components/content-grid-formatter2.js +68 -0
  192. package/dist/components/content-grid-formatter2.js.map +1 -0
  193. package/dist/components/content-hero-block.d.ts +11 -0
  194. package/dist/components/content-hero-block.js +63 -0
  195. package/dist/components/content-hero-block.js.map +1 -0
  196. package/dist/components/content-image.d.ts +11 -0
  197. package/dist/components/content-image.js +120 -0
  198. package/dist/components/content-image.js.map +1 -0
  199. package/dist/components/content-line.d.ts +11 -0
  200. package/dist/components/content-line.js +70 -0
  201. package/dist/components/content-line.js.map +1 -0
  202. package/dist/components/content-navigation-block.d.ts +11 -0
  203. package/dist/components/content-navigation-block.js +79 -0
  204. package/dist/components/content-navigation-block.js.map +1 -0
  205. package/dist/components/content-overlay.d.ts +11 -0
  206. package/dist/components/content-overlay.js +2048 -0
  207. package/dist/components/content-overlay.js.map +1 -0
  208. package/dist/components/content-spacer.d.ts +11 -0
  209. package/dist/components/content-spacer.js +76 -0
  210. package/dist/components/content-spacer.js.map +1 -0
  211. package/dist/components/content-split-block.d.ts +11 -0
  212. package/dist/components/content-split-block.js +58 -0
  213. package/dist/components/content-split-block.js.map +1 -0
  214. package/dist/components/content-tabs.d.ts +11 -0
  215. package/dist/components/content-tabs.js +232 -0
  216. package/dist/components/content-tabs.js.map +1 -0
  217. package/dist/components/content-text-block.d.ts +11 -0
  218. package/dist/components/content-text-block.js +66 -0
  219. package/dist/components/content-text-block.js.map +1 -0
  220. package/dist/components/content-tout-block.d.ts +11 -0
  221. package/dist/components/content-tout-block.js +46 -0
  222. package/dist/components/content-tout-block.js.map +1 -0
  223. package/dist/components/content-video.d.ts +11 -0
  224. package/dist/components/content-video.js +141 -0
  225. package/dist/components/content-video.js.map +1 -0
  226. package/dist/components/index.d.ts +33 -0
  227. package/dist/components/index.js +4 -0
  228. package/dist/components/index.js.map +1 -0
  229. package/dist/components/swiper.js +3608 -0
  230. package/dist/components/swiper.js.map +1 -0
  231. package/dist/components/utils.js +106 -0
  232. package/dist/components/utils.js.map +1 -0
  233. package/dist/components/video.es.js +64201 -0
  234. package/dist/components/video.es.js.map +1 -0
  235. package/dist/components/window-resize-service.js +33 -0
  236. package/dist/components/window-resize-service.js.map +1 -0
  237. package/dist/content-blocks/content-blocks.esm.js +2 -0
  238. package/dist/content-blocks/content-blocks.esm.js.map +1 -0
  239. package/dist/content-blocks/index.esm.js +2 -0
  240. package/dist/content-blocks/index.esm.js.map +1 -0
  241. package/dist/content-blocks/p-03ca48aa.js +2 -0
  242. package/dist/content-blocks/p-03ca48aa.js.map +1 -0
  243. package/dist/content-blocks/p-0ee5bbb6.entry.js +2 -0
  244. package/dist/content-blocks/p-0ee5bbb6.entry.js.map +1 -0
  245. package/dist/content-blocks/p-193fa2c0.entry.js +2 -0
  246. package/dist/content-blocks/p-193fa2c0.entry.js.map +1 -0
  247. package/dist/content-blocks/p-1b699607.js +2 -0
  248. package/dist/content-blocks/p-1b699607.js.map +1 -0
  249. package/dist/content-blocks/p-1efe0577.entry.js +2 -0
  250. package/dist/content-blocks/p-1efe0577.entry.js.map +1 -0
  251. package/dist/content-blocks/p-2357f07a.entry.js +2 -0
  252. package/dist/content-blocks/p-2357f07a.entry.js.map +1 -0
  253. package/dist/content-blocks/p-363e8357.entry.js +2 -0
  254. package/dist/content-blocks/p-363e8357.entry.js.map +1 -0
  255. package/dist/content-blocks/p-36793013.entry.js +10 -0
  256. package/dist/content-blocks/p-36793013.entry.js.map +1 -0
  257. package/dist/content-blocks/p-3a170c2c.entry.js +2 -0
  258. package/dist/content-blocks/p-3a170c2c.entry.js.map +1 -0
  259. package/dist/content-blocks/p-43a91cc7.js +29 -0
  260. package/dist/content-blocks/p-43a91cc7.js.map +1 -0
  261. package/dist/content-blocks/p-6d43a03c.js +2 -0
  262. package/dist/content-blocks/p-6d43a03c.js.map +1 -0
  263. package/dist/content-blocks/p-89fb0d8f.js +2 -0
  264. package/dist/content-blocks/p-89fb0d8f.js.map +1 -0
  265. package/dist/content-blocks/p-a7dfb547.entry.js +2 -0
  266. package/dist/content-blocks/p-a7dfb547.entry.js.map +1 -0
  267. package/dist/content-blocks/p-b27d54cb.entry.js +2 -0
  268. package/dist/content-blocks/p-b27d54cb.entry.js.map +1 -0
  269. package/dist/content-blocks/p-bf1cfb7b.js +3 -0
  270. package/dist/content-blocks/p-bf1cfb7b.js.map +1 -0
  271. package/dist/content-blocks/p-c5891e59.js +2 -0
  272. package/dist/content-blocks/p-c5891e59.js.map +1 -0
  273. package/dist/content-blocks/p-cd552ce2.js +2 -0
  274. package/dist/content-blocks/p-cd552ce2.js.map +1 -0
  275. package/dist/content-blocks/p-ce179781.entry.js +2 -0
  276. package/dist/content-blocks/p-ce179781.entry.js.map +1 -0
  277. package/dist/content-blocks/p-d3503dde.entry.js +2 -0
  278. package/dist/content-blocks/p-d3503dde.entry.js.map +1 -0
  279. package/dist/content-blocks/p-dca7ab2c.entry.js +2 -0
  280. package/dist/content-blocks/p-dca7ab2c.entry.js.map +1 -0
  281. package/dist/content-blocks/sass/_mixins.scss +249 -0
  282. package/dist/content-blocks/sass/_variables.scss +18 -0
  283. package/dist/esm/BehaviorSubject-bc7e0e99.js +637 -0
  284. package/dist/esm/BehaviorSubject-bc7e0e99.js.map +1 -0
  285. package/dist/esm/Youtube-6c271d8d.js +805 -0
  286. package/dist/esm/Youtube-6c271d8d.js.map +1 -0
  287. package/dist/esm/content-accordion.entry.js +110 -0
  288. package/dist/esm/content-accordion.entry.js.map +1 -0
  289. package/dist/esm/content-blocks.js +20 -0
  290. package/dist/esm/content-blocks.js.map +1 -0
  291. package/dist/esm/content-button_4.entry.js +2158 -0
  292. package/dist/esm/content-button_4.entry.js.map +1 -0
  293. package/dist/esm/content-carousel-cf7daf22.js +1469 -0
  294. package/dist/esm/content-carousel-cf7daf22.js.map +1 -0
  295. package/dist/esm/content-carousel.entry.js +5 -0
  296. package/dist/esm/content-carousel.entry.js.map +1 -0
  297. package/dist/esm/content-grid-formatter.entry.js +46 -0
  298. package/dist/esm/content-grid-formatter.entry.js.map +1 -0
  299. package/dist/esm/content-hero-block.entry.js +42 -0
  300. package/dist/esm/content-hero-block.entry.js.map +1 -0
  301. package/dist/esm/content-image.entry.js +91 -0
  302. package/dist/esm/content-image.entry.js.map +1 -0
  303. package/dist/esm/content-navigation-block.entry.js +58 -0
  304. package/dist/esm/content-navigation-block.entry.js.map +1 -0
  305. package/dist/esm/content-split-block.entry.js +32 -0
  306. package/dist/esm/content-split-block.entry.js.map +1 -0
  307. package/dist/esm/content-tabs.entry.js +215 -0
  308. package/dist/esm/content-tabs.entry.js.map +1 -0
  309. package/dist/esm/content-text-block.entry.js +44 -0
  310. package/dist/esm/content-text-block.entry.js.map +1 -0
  311. package/dist/esm/content-tout-block.entry.js +28 -0
  312. package/dist/esm/content-tout-block.entry.js.map +1 -0
  313. package/dist/esm/content-video.entry.js +110 -0
  314. package/dist/esm/content-video.entry.js.map +1 -0
  315. package/dist/esm/index-6701e2ba.js +2087 -0
  316. package/dist/esm/index-6701e2ba.js.map +1 -0
  317. package/dist/esm/index.js +3 -0
  318. package/dist/esm/index.js.map +1 -0
  319. package/dist/esm/loader.js +11 -0
  320. package/dist/esm/loader.js.map +1 -0
  321. package/dist/esm/polyfills/core-js.js +11 -0
  322. package/dist/esm/polyfills/dom.js +79 -0
  323. package/dist/esm/polyfills/es5-html-element.js +1 -0
  324. package/dist/esm/polyfills/index.js +34 -0
  325. package/dist/esm/polyfills/system.js +6 -0
  326. package/dist/esm/swiper-977c310f.js +3610 -0
  327. package/dist/esm/swiper-977c310f.js.map +1 -0
  328. package/dist/esm/utils-27374a56.js +106 -0
  329. package/dist/esm/utils-27374a56.js.map +1 -0
  330. package/dist/esm/video.es-e4c3f886.js +64201 -0
  331. package/dist/esm/video.es-e4c3f886.js.map +1 -0
  332. package/dist/esm/window-resize-service-8a52f08c.js +33 -0
  333. package/dist/esm/window-resize-service-8a52f08c.js.map +1 -0
  334. package/dist/index.cjs.js +1 -0
  335. package/dist/index.js +1 -0
  336. package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +33 -0
  337. package/dist/types/blocks/content-split-block/content-split-block.d.ts +27 -0
  338. package/dist/types/blocks/content-text-block/content-text-block.d.ts +44 -0
  339. package/dist/types/blocks/content-tout-block/content-tout-block.d.ts +22 -0
  340. package/dist/types/components/content-accordion/content-accordion.d.ts +12 -0
  341. package/dist/types/components/content-accordion/libraries/w3_disclosure_button.d.ts +4 -0
  342. package/dist/types/components/content-carousel/content-carousel.d.ts +36 -0
  343. package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +31 -0
  344. package/dist/types/components/content-overlay/content-overlay.d.ts +69 -0
  345. package/dist/types/components/content-overlay/libraries/aria-dialog.d.ts +5 -0
  346. package/dist/types/components/content-overlay/libraries/aria-utilities.d.ts +5 -0
  347. package/dist/types/components/content-tabs/content-tabs.d.ts +10 -0
  348. package/dist/types/components/content-tabs/libraries/w3_tabs.d.ts +4 -0
  349. package/dist/types/components.d.ts +994 -0
  350. package/dist/types/elements/content-button/content-button.d.ts +55 -0
  351. package/dist/types/elements/content-image/content-image.d.ts +56 -0
  352. package/dist/types/elements/content-line/content-line.d.ts +56 -0
  353. package/dist/types/elements/content-video/content-video.d.ts +77 -0
  354. package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +52 -0
  355. package/dist/types/formatters/content-spacer/content-spacer.d.ts +73 -0
  356. package/dist/types/globalScript.d.ts +1 -0
  357. package/dist/types/index.d.ts +3 -0
  358. package/dist/types/services/content-events-service.d.ts +11 -0
  359. package/dist/types/services/window-resize-service.d.ts +11 -0
  360. package/dist/types/stencil-public-runtime.d.ts +1652 -0
  361. package/dist/types/typings.d.ts +11 -0
  362. package/dist/types/utils/utils.d.ts +13 -0
  363. package/loader/cdn.js +3 -0
  364. package/loader/index.cjs.js +3 -0
  365. package/loader/index.d.ts +21 -0
  366. package/loader/index.es2017.js +3 -0
  367. package/loader/index.js +4 -0
  368. package/loader/package.json +11 -0
  369. package/package.json +65 -0
@@ -0,0 +1,2048 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { W as WindowResizeService } from './window-resize-service.js';
3
+ import { b as getCurrentValue } from './utils.js';
4
+
5
+ /*!
6
+ * tabbable 6.2.0
7
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
8
+ */
9
+ // NOTE: separate `:not()` selectors has broader browser support than the newer
10
+ // `:not([inert], [inert] *)` (Feb 2023)
11
+ // CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
12
+ // the entire query to fail, resulting in no nodes found, which will break a lot
13
+ // of things... so we have to rely on JS to identify nodes inside an inert container
14
+ var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
15
+ var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
16
+ var NoElement = typeof Element === 'undefined';
17
+ var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
18
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
19
+ var _element$getRootNode;
20
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
21
+ } : function (element) {
22
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
23
+ };
24
+
25
+ /**
26
+ * Determines if a node is inert or in an inert ancestor.
27
+ * @param {Element} [node]
28
+ * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
29
+ * see if any of them are inert. If false, only `node` itself is considered.
30
+ * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
31
+ * False if `node` is falsy.
32
+ */
33
+ var isInert = function isInert(node, lookUp) {
34
+ var _node$getAttribute;
35
+ if (lookUp === void 0) {
36
+ lookUp = true;
37
+ }
38
+ // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
39
+ // JS API property; we have to check the attribute, which can either be empty or 'true';
40
+ // if it's `null` (not specified) or 'false', it's an active element
41
+ var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
42
+ var inert = inertAtt === '' || inertAtt === 'true';
43
+
44
+ // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
45
+ // if it weren't for `matches()` not being a function on shadow roots; the following
46
+ // code works for any kind of node
47
+ // CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
48
+ // so it likely would not support `:is([inert] *)` either...
49
+ var result = inert || lookUp && node && isInert(node.parentNode); // recursive
50
+
51
+ return result;
52
+ };
53
+
54
+ /**
55
+ * Determines if a node's content is editable.
56
+ * @param {Element} [node]
57
+ * @returns True if it's content-editable; false if it's not or `node` is falsy.
58
+ */
59
+ var isContentEditable = function isContentEditable(node) {
60
+ var _node$getAttribute2;
61
+ // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
62
+ // to use the attribute directly to check for this, which can either be empty or 'true';
63
+ // if it's `null` (not specified) or 'false', it's a non-editable element
64
+ var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
65
+ return attValue === '' || attValue === 'true';
66
+ };
67
+
68
+ /**
69
+ * @param {Element} el container to check in
70
+ * @param {boolean} includeContainer add container to check
71
+ * @param {(node: Element) => boolean} filter filter candidates
72
+ * @returns {Element[]}
73
+ */
74
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
75
+ // even if `includeContainer=false`, we still have to check it for inertness because
76
+ // if it's inert, all its children are inert
77
+ if (isInert(el)) {
78
+ return [];
79
+ }
80
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
81
+ if (includeContainer && matches.call(el, candidateSelector)) {
82
+ candidates.unshift(el);
83
+ }
84
+ candidates = candidates.filter(filter);
85
+ return candidates;
86
+ };
87
+
88
+ /**
89
+ * @callback GetShadowRoot
90
+ * @param {Element} element to check for shadow root
91
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
92
+ */
93
+
94
+ /**
95
+ * @callback ShadowRootFilter
96
+ * @param {Element} shadowHostNode the element which contains shadow content
97
+ * @returns {boolean} true if a shadow root could potentially contain valid candidates.
98
+ */
99
+
100
+ /**
101
+ * @typedef {Object} CandidateScope
102
+ * @property {Element} scopeParent contains inner candidates
103
+ * @property {Element[]} candidates list of candidates found in the scope parent
104
+ */
105
+
106
+ /**
107
+ * @typedef {Object} IterativeOptions
108
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
109
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
110
+ * or a boolean stating if it has an undisclosed shadow root
111
+ * @property {(node: Element) => boolean} filter filter candidates
112
+ * @property {boolean} flatten if true then result will flatten any CandidateScope into the returned list
113
+ * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
114
+ */
115
+
116
+ /**
117
+ * @param {Element[]} elements list of element containers to match candidates from
118
+ * @param {boolean} includeContainer add container list to check
119
+ * @param {IterativeOptions} options
120
+ * @returns {Array.<Element|CandidateScope>}
121
+ */
122
+ var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
123
+ var candidates = [];
124
+ var elementsToCheck = Array.from(elements);
125
+ while (elementsToCheck.length) {
126
+ var element = elementsToCheck.shift();
127
+ if (isInert(element, false)) {
128
+ // no need to look up since we're drilling down
129
+ // anything inside this container will also be inert
130
+ continue;
131
+ }
132
+ if (element.tagName === 'SLOT') {
133
+ // add shadow dom slot scope (slot itself cannot be focusable)
134
+ var assigned = element.assignedElements();
135
+ var content = assigned.length ? assigned : element.children;
136
+ var nestedCandidates = getCandidatesIteratively(content, true, options);
137
+ if (options.flatten) {
138
+ candidates.push.apply(candidates, nestedCandidates);
139
+ } else {
140
+ candidates.push({
141
+ scopeParent: element,
142
+ candidates: nestedCandidates
143
+ });
144
+ }
145
+ } else {
146
+ // check candidate element
147
+ var validCandidate = matches.call(element, candidateSelector);
148
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
149
+ candidates.push(element);
150
+ }
151
+
152
+ // iterate over shadow content if possible
153
+ var shadowRoot = element.shadowRoot ||
154
+ // check for an undisclosed shadow
155
+ typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
156
+
157
+ // no inert look up because we're already drilling down and checking for inertness
158
+ // on the way down, so all containers to this root node should have already been
159
+ // vetted as non-inert
160
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
161
+ if (shadowRoot && validShadowRoot) {
162
+ // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
163
+ // shadow exists, so look at light dom children as fallback BUT create a scope for any
164
+ // child candidates found because they're likely slotted elements (elements that are
165
+ // children of the web component element (which has the shadow), in the light dom, but
166
+ // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
167
+ // _after_ we return from this recursive call
168
+ var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
169
+ if (options.flatten) {
170
+ candidates.push.apply(candidates, _nestedCandidates);
171
+ } else {
172
+ candidates.push({
173
+ scopeParent: element,
174
+ candidates: _nestedCandidates
175
+ });
176
+ }
177
+ } else {
178
+ // there's not shadow so just dig into the element's (light dom) children
179
+ // __without__ giving the element special scope treatment
180
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
181
+ }
182
+ }
183
+ }
184
+ return candidates;
185
+ };
186
+
187
+ /**
188
+ * @private
189
+ * Determines if the node has an explicitly specified `tabindex` attribute.
190
+ * @param {HTMLElement} node
191
+ * @returns {boolean} True if so; false if not.
192
+ */
193
+ var hasTabIndex = function hasTabIndex(node) {
194
+ return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
195
+ };
196
+
197
+ /**
198
+ * Determine the tab index of a given node.
199
+ * @param {HTMLElement} node
200
+ * @returns {number} Tab order (negative, 0, or positive number).
201
+ * @throws {Error} If `node` is falsy.
202
+ */
203
+ var getTabIndex = function getTabIndex(node) {
204
+ if (!node) {
205
+ throw new Error('No node provided');
206
+ }
207
+ if (node.tabIndex < 0) {
208
+ // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
209
+ // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
210
+ // yet they are still part of the regular tab order; in FF, they get a default
211
+ // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
212
+ // order, consider their tab index to be 0.
213
+ // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
214
+ // so if they don't have a tabindex attribute specifically set, assume it's 0.
215
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
216
+ return 0;
217
+ }
218
+ }
219
+ return node.tabIndex;
220
+ };
221
+
222
+ /**
223
+ * Determine the tab index of a given node __for sort order purposes__.
224
+ * @param {HTMLElement} node
225
+ * @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
226
+ * has tabIndex -1, but needs to be sorted by document order in order for its content to be
227
+ * inserted into the correct sort position.
228
+ * @returns {number} Tab order (negative, 0, or positive number).
229
+ */
230
+ var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
231
+ var tabIndex = getTabIndex(node);
232
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
233
+ return 0;
234
+ }
235
+ return tabIndex;
236
+ };
237
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
238
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
239
+ };
240
+ var isInput = function isInput(node) {
241
+ return node.tagName === 'INPUT';
242
+ };
243
+ var isHiddenInput = function isHiddenInput(node) {
244
+ return isInput(node) && node.type === 'hidden';
245
+ };
246
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
247
+ var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
248
+ return child.tagName === 'SUMMARY';
249
+ });
250
+ return r;
251
+ };
252
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
253
+ for (var i = 0; i < nodes.length; i++) {
254
+ if (nodes[i].checked && nodes[i].form === form) {
255
+ return nodes[i];
256
+ }
257
+ }
258
+ };
259
+ var isTabbableRadio = function isTabbableRadio(node) {
260
+ if (!node.name) {
261
+ return true;
262
+ }
263
+ var radioScope = node.form || getRootNode(node);
264
+ var queryRadios = function queryRadios(name) {
265
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
266
+ };
267
+ var radioSet;
268
+ if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
269
+ radioSet = queryRadios(window.CSS.escape(node.name));
270
+ } else {
271
+ try {
272
+ radioSet = queryRadios(node.name);
273
+ } catch (err) {
274
+ // eslint-disable-next-line no-console
275
+ console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
276
+ return false;
277
+ }
278
+ }
279
+ var checked = getCheckedRadio(radioSet, node.form);
280
+ return !checked || checked === node;
281
+ };
282
+ var isRadio = function isRadio(node) {
283
+ return isInput(node) && node.type === 'radio';
284
+ };
285
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
286
+ return isRadio(node) && !isTabbableRadio(node);
287
+ };
288
+
289
+ // determines if a node is ultimately attached to the window's document
290
+ var isNodeAttached = function isNodeAttached(node) {
291
+ var _nodeRoot;
292
+ // The root node is the shadow root if the node is in a shadow DOM; some document otherwise
293
+ // (but NOT _the_ document; see second 'If' comment below for more).
294
+ // If rootNode is shadow root, it'll have a host, which is the element to which the shadow
295
+ // is attached, and the one we need to check if it's in the document or not (because the
296
+ // shadow, and all nodes it contains, is never considered in the document since shadows
297
+ // behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,
298
+ // is hidden, or is not in the document itself but is detached, it will affect the shadow's
299
+ // visibility, including all the nodes it contains). The host could be any normal node,
300
+ // or a custom element (i.e. web component). Either way, that's the one that is considered
301
+ // part of the document, not the shadow root, nor any of its children (i.e. the node being
302
+ // tested).
303
+ // To further complicate things, we have to look all the way up until we find a shadow HOST
304
+ // that is attached (or find none) because the node might be in nested shadows...
305
+ // If rootNode is not a shadow root, it won't have a host, and so rootNode should be the
306
+ // document (per the docs) and while it's a Document-type object, that document does not
307
+ // appear to be the same as the node's `ownerDocument` for some reason, so it's safer
308
+ // to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
309
+ // using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
310
+ // node is actually detached.
311
+ // NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
312
+ // if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
313
+ // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
314
+ // `ownerDocument` will be `null`, hence the optional chaining on it.
315
+ var nodeRoot = node && getRootNode(node);
316
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
317
+
318
+ // in some cases, a detached node will return itself as the root instead of a document or
319
+ // shadow root object, in which case, we shouldn't try to look further up the host chain
320
+ var attached = false;
321
+ if (nodeRoot && nodeRoot !== node) {
322
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
323
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
324
+ while (!attached && nodeRootHost) {
325
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
326
+ // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
327
+ // which means we need to get the host's host and check if that parent host is contained
328
+ // in (i.e. attached to) the document
329
+ nodeRoot = getRootNode(nodeRootHost);
330
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
331
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
332
+ }
333
+ }
334
+ return attached;
335
+ };
336
+ var isZeroArea = function isZeroArea(node) {
337
+ var _node$getBoundingClie = node.getBoundingClientRect(),
338
+ width = _node$getBoundingClie.width,
339
+ height = _node$getBoundingClie.height;
340
+ return width === 0 && height === 0;
341
+ };
342
+ var isHidden = function isHidden(node, _ref) {
343
+ var displayCheck = _ref.displayCheck,
344
+ getShadowRoot = _ref.getShadowRoot;
345
+ // NOTE: visibility will be `undefined` if node is detached from the document
346
+ // (see notes about this further down), which means we will consider it visible
347
+ // (this is legacy behavior from a very long way back)
348
+ // NOTE: we check this regardless of `displayCheck="none"` because this is a
349
+ // _visibility_ check, not a _display_ check
350
+ if (getComputedStyle(node).visibility === 'hidden') {
351
+ return true;
352
+ }
353
+ var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
354
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
355
+ if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
356
+ return true;
357
+ }
358
+ if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
359
+ if (typeof getShadowRoot === 'function') {
360
+ // figure out if we should consider the node to be in an undisclosed shadow and use the
361
+ // 'non-zero-area' fallback
362
+ var originalNode = node;
363
+ while (node) {
364
+ var parentElement = node.parentElement;
365
+ var rootNode = getRootNode(node);
366
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
367
+ ) {
368
+ // node has an undisclosed shadow which means we can only treat it as a black box, so we
369
+ // fall back to a non-zero-area test
370
+ return isZeroArea(node);
371
+ } else if (node.assignedSlot) {
372
+ // iterate up slot
373
+ node = node.assignedSlot;
374
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
375
+ // cross shadow boundary
376
+ node = rootNode.host;
377
+ } else {
378
+ // iterate up normal dom
379
+ node = parentElement;
380
+ }
381
+ }
382
+ node = originalNode;
383
+ }
384
+ // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
385
+ // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
386
+ // it might be a falsy value, which means shadow DOM support is disabled
387
+
388
+ // Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
389
+ // now we can just test to see if it would normally be visible or not, provided it's
390
+ // attached to the main document.
391
+ // NOTE: We must consider case where node is inside a shadow DOM and given directly to
392
+ // `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
393
+
394
+ if (isNodeAttached(node)) {
395
+ // this works wherever the node is: if there's at least one client rect, it's
396
+ // somehow displayed; it also covers the CSS 'display: contents' case where the
397
+ // node itself is hidden in place of its contents; and there's no need to search
398
+ // up the hierarchy either
399
+ return !node.getClientRects().length;
400
+ }
401
+
402
+ // Else, the node isn't attached to the document, which means the `getClientRects()`
403
+ // API will __always__ return zero rects (this can happen, for example, if React
404
+ // is used to render nodes onto a detached tree, as confirmed in this thread:
405
+ // https://github.com/facebook/react/issues/9117#issuecomment-284228870)
406
+ //
407
+ // It also means that even window.getComputedStyle(node).display will return `undefined`
408
+ // because styles are only computed for nodes that are in the document.
409
+ //
410
+ // NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable
411
+ // somehow. Though it was never stated officially, anyone who has ever used tabbable
412
+ // APIs on nodes in detached containers has actually implicitly used tabbable in what
413
+ // was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially
414
+ // considering __everything__ to be visible because of the innability to determine styles.
415
+ //
416
+ // v6.0.0: As of this major release, the default 'full' option __no longer treats detached
417
+ // nodes as visible with the 'none' fallback.__
418
+ if (displayCheck !== 'legacy-full') {
419
+ return true; // hidden
420
+ }
421
+ // else, fallback to 'none' mode and consider the node visible
422
+ } else if (displayCheck === 'non-zero-area') {
423
+ // NOTE: Even though this tests that the node's client rect is non-zero to determine
424
+ // whether it's displayed, and that a detached node will __always__ have a zero-area
425
+ // client rect, we don't special-case for whether the node is attached or not. In
426
+ // this mode, we do want to consider nodes that have a zero area to be hidden at all
427
+ // times, and that includes attached or not.
428
+ return isZeroArea(node);
429
+ }
430
+
431
+ // visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
432
+ // it's visible
433
+ return false;
434
+ };
435
+
436
+ // form fields (nested) inside a disabled fieldset are not focusable/tabbable
437
+ // unless they are in the _first_ <legend> element of the top-most disabled
438
+ // fieldset
439
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
440
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
441
+ var parentNode = node.parentElement;
442
+ // check if `node` is contained in a disabled <fieldset>
443
+ while (parentNode) {
444
+ if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
445
+ // look for the first <legend> among the children of the disabled <fieldset>
446
+ for (var i = 0; i < parentNode.children.length; i++) {
447
+ var child = parentNode.children.item(i);
448
+ // when the first <legend> (in document order) is found
449
+ if (child.tagName === 'LEGEND') {
450
+ // if its parent <fieldset> is not nested in another disabled <fieldset>,
451
+ // return whether `node` is a descendant of its first <legend>
452
+ return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
453
+ }
454
+ }
455
+ // the disabled <fieldset> containing `node` has no <legend>
456
+ return true;
457
+ }
458
+ parentNode = parentNode.parentElement;
459
+ }
460
+ }
461
+
462
+ // else, node's tabbable/focusable state should not be affected by a fieldset's
463
+ // enabled/disabled state
464
+ return false;
465
+ };
466
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
467
+ if (node.disabled ||
468
+ // we must do an inert look up to filter out any elements inside an inert ancestor
469
+ // because we're limited in the type of selectors we can use in JSDom (see related
470
+ // note related to `candidateSelectors`)
471
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
472
+ // For a details element with a summary, the summary element gets the focus
473
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
474
+ return false;
475
+ }
476
+ return true;
477
+ };
478
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
479
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
480
+ return false;
481
+ }
482
+ return true;
483
+ };
484
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
485
+ var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
486
+ if (isNaN(tabIndex) || tabIndex >= 0) {
487
+ return true;
488
+ }
489
+ // If a custom element has an explicit negative tabindex,
490
+ // browsers will not allow tab targeting said element's children.
491
+ return false;
492
+ };
493
+
494
+ /**
495
+ * @param {Array.<Element|CandidateScope>} candidates
496
+ * @returns Element[]
497
+ */
498
+ var sortByOrder = function sortByOrder(candidates) {
499
+ var regularTabbables = [];
500
+ var orderedTabbables = [];
501
+ candidates.forEach(function (item, i) {
502
+ var isScope = !!item.scopeParent;
503
+ var element = isScope ? item.scopeParent : item;
504
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
505
+ var elements = isScope ? sortByOrder(item.candidates) : element;
506
+ if (candidateTabindex === 0) {
507
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
508
+ } else {
509
+ orderedTabbables.push({
510
+ documentOrder: i,
511
+ tabIndex: candidateTabindex,
512
+ item: item,
513
+ isScope: isScope,
514
+ content: elements
515
+ });
516
+ }
517
+ });
518
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
519
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
520
+ return acc;
521
+ }, []).concat(regularTabbables);
522
+ };
523
+ var tabbable = function tabbable(container, options) {
524
+ options = options || {};
525
+ var candidates;
526
+ if (options.getShadowRoot) {
527
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
528
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
529
+ flatten: false,
530
+ getShadowRoot: options.getShadowRoot,
531
+ shadowRootFilter: isValidShadowRootTabbable
532
+ });
533
+ } else {
534
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
535
+ }
536
+ return sortByOrder(candidates);
537
+ };
538
+ var focusable = function focusable(container, options) {
539
+ options = options || {};
540
+ var candidates;
541
+ if (options.getShadowRoot) {
542
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
543
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
544
+ flatten: true,
545
+ getShadowRoot: options.getShadowRoot
546
+ });
547
+ } else {
548
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
549
+ }
550
+ return candidates;
551
+ };
552
+ var isTabbable = function isTabbable(node, options) {
553
+ options = options || {};
554
+ if (!node) {
555
+ throw new Error('No node provided');
556
+ }
557
+ if (matches.call(node, candidateSelector) === false) {
558
+ return false;
559
+ }
560
+ return isNodeMatchingSelectorTabbable(options, node);
561
+ };
562
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
563
+ var isFocusable = function isFocusable(node, options) {
564
+ options = options || {};
565
+ if (!node) {
566
+ throw new Error('No node provided');
567
+ }
568
+ if (matches.call(node, focusableCandidateSelector) === false) {
569
+ return false;
570
+ }
571
+ return isNodeMatchingSelectorFocusable(options, node);
572
+ };
573
+
574
+ /*!
575
+ * focus-trap 7.5.2
576
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
577
+ */
578
+
579
+ function ownKeys(object, enumerableOnly) {
580
+ var keys = Object.keys(object);
581
+ if (Object.getOwnPropertySymbols) {
582
+ var symbols = Object.getOwnPropertySymbols(object);
583
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
584
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
585
+ })), keys.push.apply(keys, symbols);
586
+ }
587
+ return keys;
588
+ }
589
+ function _objectSpread2(target) {
590
+ for (var i = 1; i < arguments.length; i++) {
591
+ var source = null != arguments[i] ? arguments[i] : {};
592
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
593
+ _defineProperty(target, key, source[key]);
594
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
595
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
596
+ });
597
+ }
598
+ return target;
599
+ }
600
+ function _defineProperty(obj, key, value) {
601
+ key = _toPropertyKey(key);
602
+ if (key in obj) {
603
+ Object.defineProperty(obj, key, {
604
+ value: value,
605
+ enumerable: true,
606
+ configurable: true,
607
+ writable: true
608
+ });
609
+ } else {
610
+ obj[key] = value;
611
+ }
612
+ return obj;
613
+ }
614
+ function _toPrimitive(input, hint) {
615
+ if (typeof input !== "object" || input === null) return input;
616
+ var prim = input[Symbol.toPrimitive];
617
+ if (prim !== undefined) {
618
+ var res = prim.call(input, hint || "default");
619
+ if (typeof res !== "object") return res;
620
+ throw new TypeError("@@toPrimitive must return a primitive value.");
621
+ }
622
+ return (hint === "string" ? String : Number)(input);
623
+ }
624
+ function _toPropertyKey(arg) {
625
+ var key = _toPrimitive(arg, "string");
626
+ return typeof key === "symbol" ? key : String(key);
627
+ }
628
+
629
+ var activeFocusTraps = {
630
+ activateTrap: function activateTrap(trapStack, trap) {
631
+ if (trapStack.length > 0) {
632
+ var activeTrap = trapStack[trapStack.length - 1];
633
+ if (activeTrap !== trap) {
634
+ activeTrap.pause();
635
+ }
636
+ }
637
+ var trapIndex = trapStack.indexOf(trap);
638
+ if (trapIndex === -1) {
639
+ trapStack.push(trap);
640
+ } else {
641
+ // move this existing trap to the front of the queue
642
+ trapStack.splice(trapIndex, 1);
643
+ trapStack.push(trap);
644
+ }
645
+ },
646
+ deactivateTrap: function deactivateTrap(trapStack, trap) {
647
+ var trapIndex = trapStack.indexOf(trap);
648
+ if (trapIndex !== -1) {
649
+ trapStack.splice(trapIndex, 1);
650
+ }
651
+ if (trapStack.length > 0) {
652
+ trapStack[trapStack.length - 1].unpause();
653
+ }
654
+ }
655
+ };
656
+ var isSelectableInput = function isSelectableInput(node) {
657
+ return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
658
+ };
659
+ var isEscapeEvent = function isEscapeEvent(e) {
660
+ return (e === null || e === void 0 ? void 0 : e.key) === 'Escape' || (e === null || e === void 0 ? void 0 : e.key) === 'Esc' || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
661
+ };
662
+ var isTabEvent = function isTabEvent(e) {
663
+ return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
664
+ };
665
+
666
+ // checks for TAB by default
667
+ var isKeyForward = function isKeyForward(e) {
668
+ return isTabEvent(e) && !e.shiftKey;
669
+ };
670
+
671
+ // checks for SHIFT+TAB by default
672
+ var isKeyBackward = function isKeyBackward(e) {
673
+ return isTabEvent(e) && e.shiftKey;
674
+ };
675
+ var delay = function delay(fn) {
676
+ return setTimeout(fn, 0);
677
+ };
678
+
679
+ // Array.find/findIndex() are not supported on IE; this replicates enough
680
+ // of Array.findIndex() for our needs
681
+ var findIndex = function findIndex(arr, fn) {
682
+ var idx = -1;
683
+ arr.every(function (value, i) {
684
+ if (fn(value)) {
685
+ idx = i;
686
+ return false; // break
687
+ }
688
+
689
+ return true; // next
690
+ });
691
+
692
+ return idx;
693
+ };
694
+
695
+ /**
696
+ * Get an option's value when it could be a plain value, or a handler that provides
697
+ * the value.
698
+ * @param {*} value Option's value to check.
699
+ * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
700
+ * @returns {*} The `value`, or the handler's returned value.
701
+ */
702
+ var valueOrHandler = function valueOrHandler(value) {
703
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
704
+ params[_key - 1] = arguments[_key];
705
+ }
706
+ return typeof value === 'function' ? value.apply(void 0, params) : value;
707
+ };
708
+ var getActualTarget = function getActualTarget(event) {
709
+ // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
710
+ // shadow host. However, event.target.composedPath() will be an array of
711
+ // nodes "clicked" from inner-most (the actual element inside the shadow) to
712
+ // outer-most (the host HTML document). If we have access to composedPath(),
713
+ // then use its first element; otherwise, fall back to event.target (and
714
+ // this only works for an _open_ shadow DOM; otherwise,
715
+ // composedPath()[0] === event.target always).
716
+ return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
717
+ };
718
+
719
+ // NOTE: this must be _outside_ `createFocusTrap()` to make sure all traps in this
720
+ // current instance use the same stack if `userOptions.trapStack` isn't specified
721
+ var internalTrapStack = [];
722
+ var createFocusTrap = function createFocusTrap(elements, userOptions) {
723
+ // SSR: a live trap shouldn't be created in this type of environment so this
724
+ // should be safe code to execute if the `document` option isn't specified
725
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
726
+ var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
727
+ var config = _objectSpread2({
728
+ returnFocusOnDeactivate: true,
729
+ escapeDeactivates: true,
730
+ delayInitialFocus: true,
731
+ isKeyForward: isKeyForward,
732
+ isKeyBackward: isKeyBackward
733
+ }, userOptions);
734
+ var state = {
735
+ // containers given to createFocusTrap()
736
+ // @type {Array<HTMLElement>}
737
+ containers: [],
738
+ // list of objects identifying tabbable nodes in `containers` in the trap
739
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
740
+ // is active, but the trap should never get to a state where there isn't at least one group
741
+ // with at least one tabbable node in it (that would lead to an error condition that would
742
+ // result in an error being thrown)
743
+ // @type {Array<{
744
+ // container: HTMLElement,
745
+ // tabbableNodes: Array<HTMLElement>, // empty if none
746
+ // focusableNodes: Array<HTMLElement>, // empty if none
747
+ // posTabIndexesFound: boolean,
748
+ // firstTabbableNode: HTMLElement|undefined,
749
+ // lastTabbableNode: HTMLElement|undefined,
750
+ // firstDomTabbableNode: HTMLElement|undefined,
751
+ // lastDomTabbableNode: HTMLElement|undefined,
752
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
753
+ // }>}
754
+ containerGroups: [],
755
+ // same order/length as `containers` list
756
+
757
+ // references to objects in `containerGroups`, but only those that actually have
758
+ // tabbable nodes in them
759
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
760
+ // the same length
761
+ tabbableGroups: [],
762
+ nodeFocusedBeforeActivation: null,
763
+ mostRecentlyFocusedNode: null,
764
+ active: false,
765
+ paused: false,
766
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
767
+ // has been delayed during activation
768
+ delayInitialFocusTimer: undefined,
769
+ // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
770
+ recentNavEvent: undefined
771
+ };
772
+ var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
773
+
774
+ /**
775
+ * Gets a configuration option value.
776
+ * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
777
+ * value will be taken from this object. Otherwise, value will be taken from base configuration.
778
+ * @param {string} optionName Name of the option whose value is sought.
779
+ * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
780
+ * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
781
+ */
782
+ var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
783
+ return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
784
+ };
785
+
786
+ /**
787
+ * Finds the index of the container that contains the element.
788
+ * @param {HTMLElement} element
789
+ * @param {Event} [event] If available, and `element` isn't directly found in any container,
790
+ * the event's composed path is used to see if includes any known trap containers in the
791
+ * case where the element is inside a Shadow DOM.
792
+ * @returns {number} Index of the container in either `state.containers` or
793
+ * `state.containerGroups` (the order/length of these lists are the same); -1
794
+ * if the element isn't found.
795
+ */
796
+ var findContainerIndex = function findContainerIndex(element, event) {
797
+ var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
798
+ // NOTE: search `containerGroups` because it's possible a group contains no tabbable
799
+ // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
800
+ // and we still need to find the element in there
801
+ return state.containerGroups.findIndex(function (_ref) {
802
+ var container = _ref.container,
803
+ tabbableNodes = _ref.tabbableNodes;
804
+ return container.contains(element) || ( // fall back to explicit tabbable search which will take into consideration any
805
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
806
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
807
+ // look inside web components even if open)
808
+ composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
809
+ return node === element;
810
+ });
811
+ });
812
+ };
813
+
814
+ /**
815
+ * Gets the node for the given option, which is expected to be an option that
816
+ * can be either a DOM node, a string that is a selector to get a node, `false`
817
+ * (if a node is explicitly NOT given), or a function that returns any of these
818
+ * values.
819
+ * @param {string} optionName
820
+ * @returns {undefined | false | HTMLElement | SVGElement} Returns
821
+ * `undefined` if the option is not specified; `false` if the option
822
+ * resolved to `false` (node explicitly not given); otherwise, the resolved
823
+ * DOM node.
824
+ * @throws {Error} If the option is set, not `false`, and is not, or does not
825
+ * resolve to a node.
826
+ */
827
+ var getNodeForOption = function getNodeForOption(optionName) {
828
+ var optionValue = config[optionName];
829
+ if (typeof optionValue === 'function') {
830
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
831
+ params[_key2 - 1] = arguments[_key2];
832
+ }
833
+ optionValue = optionValue.apply(void 0, params);
834
+ }
835
+ if (optionValue === true) {
836
+ optionValue = undefined; // use default value
837
+ }
838
+
839
+ if (!optionValue) {
840
+ if (optionValue === undefined || optionValue === false) {
841
+ return optionValue;
842
+ }
843
+ // else, empty string (invalid), null (invalid), 0 (invalid)
844
+
845
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
846
+ }
847
+ var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
848
+
849
+ if (typeof optionValue === 'string') {
850
+ node = doc.querySelector(optionValue); // resolve to node, or null if fails
851
+ if (!node) {
852
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
853
+ }
854
+ }
855
+ return node;
856
+ };
857
+ var getInitialFocusNode = function getInitialFocusNode() {
858
+ var node = getNodeForOption('initialFocus');
859
+
860
+ // false explicitly indicates we want no initialFocus at all
861
+ if (node === false) {
862
+ return false;
863
+ }
864
+ if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
865
+ // option not specified nor focusable: use fallback options
866
+ if (findContainerIndex(doc.activeElement) >= 0) {
867
+ node = doc.activeElement;
868
+ } else {
869
+ var firstTabbableGroup = state.tabbableGroups[0];
870
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
871
+
872
+ // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
873
+ node = firstTabbableNode || getNodeForOption('fallbackFocus');
874
+ }
875
+ }
876
+ if (!node) {
877
+ throw new Error('Your focus-trap needs to have at least one focusable element');
878
+ }
879
+ return node;
880
+ };
881
+ var updateTabbableNodes = function updateTabbableNodes() {
882
+ state.containerGroups = state.containers.map(function (container) {
883
+ var tabbableNodes = tabbable(container, config.tabbableOptions);
884
+
885
+ // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
886
+ // are a superset of tabbable nodes since nodes with negative `tabindex` attributes
887
+ // are focusable but not tabbable
888
+ var focusableNodes = focusable(container, config.tabbableOptions);
889
+ var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
890
+ var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
891
+ var firstDomTabbableNode = focusableNodes.find(function (node) {
892
+ return isTabbable(node);
893
+ });
894
+ var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
895
+ return isTabbable(node);
896
+ });
897
+ var posTabIndexesFound = !!tabbableNodes.find(function (node) {
898
+ return getTabIndex(node) > 0;
899
+ });
900
+ return {
901
+ container: container,
902
+ tabbableNodes: tabbableNodes,
903
+ focusableNodes: focusableNodes,
904
+ /** True if at least one node with positive `tabindex` was found in this container. */
905
+ posTabIndexesFound: posTabIndexesFound,
906
+ /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
907
+ firstTabbableNode: firstTabbableNode,
908
+ /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
909
+ lastTabbableNode: lastTabbableNode,
910
+ // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
911
+ // would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
912
+ // because that API doesn't work with Shadow DOM as well as it should (@see
913
+ // https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
914
+ // to address an edge case related to positive tabindex support, this seems like a much easier,
915
+ // "close enough most of the time" alternative for positive tabindexes which should generally
916
+ // be avoided anyway...
917
+ /** First tabbable node in container, __DOM__ order; `undefined` if none. */
918
+ firstDomTabbableNode: firstDomTabbableNode,
919
+ /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
920
+ lastDomTabbableNode: lastDomTabbableNode,
921
+ /**
922
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
923
+ * in this container, if any.
924
+ * @param {HTMLElement} node
925
+ * @param {boolean} [forward] True if going in forward tab order; false if going
926
+ * in reverse.
927
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
928
+ */
929
+ nextTabbableNode: function nextTabbableNode(node) {
930
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
931
+ var nodeIdx = tabbableNodes.indexOf(node);
932
+ if (nodeIdx < 0) {
933
+ // either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
934
+ // since `node` should at least have been focusable, we assume that's the case and mimic
935
+ // what browsers do, which is set focus to the next node in __document position order__,
936
+ // regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
937
+ // above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
938
+ // basic DOM order
939
+ if (forward) {
940
+ return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
941
+ return isTabbable(el);
942
+ });
943
+ }
944
+ return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
945
+ return isTabbable(el);
946
+ });
947
+ }
948
+ return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
949
+ }
950
+ };
951
+ });
952
+ state.tabbableGroups = state.containerGroups.filter(function (group) {
953
+ return group.tabbableNodes.length > 0;
954
+ });
955
+
956
+ // throw if no groups have tabbable nodes and we don't have a fallback focus node either
957
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
958
+ ) {
959
+ throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
960
+ }
961
+
962
+ // NOTE: Positive tabindexes are only properly supported in single-container traps because
963
+ // doing it across multiple containers where tabindexes could be all over the place
964
+ // would require Tabbable to support multiple containers, would require additional
965
+ // specialized Shadow DOM support, and would require Tabbable's multi-container support
966
+ // to look at those containers in document position order rather than user-provided
967
+ // order (as they are treated in Focus-trap, for legacy reasons). See discussion on
968
+ // https://github.com/focus-trap/focus-trap/issues/375 for more details.
969
+ if (state.containerGroups.find(function (g) {
970
+ return g.posTabIndexesFound;
971
+ }) && state.containerGroups.length > 1) {
972
+ throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
973
+ }
974
+ };
975
+ var tryFocus = function tryFocus(node) {
976
+ if (node === false) {
977
+ return;
978
+ }
979
+ if (node === doc.activeElement) {
980
+ return;
981
+ }
982
+ if (!node || !node.focus) {
983
+ tryFocus(getInitialFocusNode());
984
+ return;
985
+ }
986
+ node.focus({
987
+ preventScroll: !!config.preventScroll
988
+ });
989
+ // NOTE: focus() API does not trigger focusIn event so set MRU node manually
990
+ state.mostRecentlyFocusedNode = node;
991
+ if (isSelectableInput(node)) {
992
+ node.select();
993
+ }
994
+ };
995
+ var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
996
+ var node = getNodeForOption('setReturnFocus', previousActiveElement);
997
+ return node ? node : node === false ? false : previousActiveElement;
998
+ };
999
+
1000
+ /**
1001
+ * Finds the next node (in either direction) where focus should move according to a
1002
+ * keyboard focus-in event.
1003
+ * @param {Object} params
1004
+ * @param {Node} [params.target] Known target __from which__ to navigate, if any.
1005
+ * @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
1006
+ * will be used to determine the `target`). Ignored if `target` is specified.
1007
+ * @param {boolean} [params.isBackward] True if focus should move backward.
1008
+ * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
1009
+ * determined given the current state of the trap.
1010
+ */
1011
+ var findNextNavNode = function findNextNavNode(_ref2) {
1012
+ var target = _ref2.target,
1013
+ event = _ref2.event,
1014
+ _ref2$isBackward = _ref2.isBackward,
1015
+ isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
1016
+ target = target || getActualTarget(event);
1017
+ updateTabbableNodes();
1018
+ var destinationNode = null;
1019
+ if (state.tabbableGroups.length > 0) {
1020
+ // make sure the target is actually contained in a group
1021
+ // NOTE: the target may also be the container itself if it's focusable
1022
+ // with tabIndex='-1' and was given initial focus
1023
+ var containerIndex = findContainerIndex(target, event);
1024
+ var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
1025
+ if (containerIndex < 0) {
1026
+ // target not found in any group: quite possible focus has escaped the trap,
1027
+ // so bring it back into...
1028
+ if (isBackward) {
1029
+ // ...the last node in the last group
1030
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
1031
+ } else {
1032
+ // ...the first node in the first group
1033
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
1034
+ }
1035
+ } else if (isBackward) {
1036
+ // REVERSE
1037
+
1038
+ // is the target the first tabbable node in a group?
1039
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
1040
+ var firstTabbableNode = _ref3.firstTabbableNode;
1041
+ return target === firstTabbableNode;
1042
+ });
1043
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
1044
+ // an exception case where the target is either the container itself, or
1045
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
1046
+ // and user clicked on it or node was programmatically given focus)
1047
+ // and is not followed by any other tabbable node, in which
1048
+ // case, we should handle shift+tab as if focus were on the container's
1049
+ // first tabbable node, and go to the last tabbable node of the LAST group
1050
+ startOfGroupIndex = containerIndex;
1051
+ }
1052
+ if (startOfGroupIndex >= 0) {
1053
+ // YES: then shift+tab should go to the last tabbable node in the
1054
+ // previous group (and wrap around to the last tabbable node of
1055
+ // the LAST group if it's the first tabbable node of the FIRST group)
1056
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
1057
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
1058
+ destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
1059
+ } else if (!isTabEvent(event)) {
1060
+ // user must have customized the nav keys so we have to move focus manually _within_
1061
+ // the active group: do this based on the order determined by tabbable()
1062
+ destinationNode = containerGroup.nextTabbableNode(target, false);
1063
+ }
1064
+ } else {
1065
+ // FORWARD
1066
+
1067
+ // is the target the last tabbable node in a group?
1068
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
1069
+ var lastTabbableNode = _ref4.lastTabbableNode;
1070
+ return target === lastTabbableNode;
1071
+ });
1072
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
1073
+ // an exception case where the target is the container itself, or
1074
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
1075
+ // and user clicked on it or node was programmatically given focus)
1076
+ // and is not followed by any other tabbable node, in which
1077
+ // case, we should handle tab as if focus were on the container's
1078
+ // last tabbable node, and go to the first tabbable node of the FIRST group
1079
+ lastOfGroupIndex = containerIndex;
1080
+ }
1081
+ if (lastOfGroupIndex >= 0) {
1082
+ // YES: then tab should go to the first tabbable node in the next
1083
+ // group (and wrap around to the first tabbable node of the FIRST
1084
+ // group if it's the last tabbable node of the LAST group)
1085
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
1086
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
1087
+ destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
1088
+ } else if (!isTabEvent(event)) {
1089
+ // user must have customized the nav keys so we have to move focus manually _within_
1090
+ // the active group: do this based on the order determined by tabbable()
1091
+ destinationNode = containerGroup.nextTabbableNode(target);
1092
+ }
1093
+ }
1094
+ } else {
1095
+ // no groups available
1096
+ // NOTE: the fallbackFocus option does not support returning false to opt-out
1097
+ destinationNode = getNodeForOption('fallbackFocus');
1098
+ }
1099
+ return destinationNode;
1100
+ };
1101
+
1102
+ // This needs to be done on mousedown and touchstart instead of click
1103
+ // so that it precedes the focus event.
1104
+ var checkPointerDown = function checkPointerDown(e) {
1105
+ var target = getActualTarget(e);
1106
+ if (findContainerIndex(target, e) >= 0) {
1107
+ // allow the click since it ocurred inside the trap
1108
+ return;
1109
+ }
1110
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1111
+ // immediately deactivate the trap
1112
+ trap.deactivate({
1113
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
1114
+ // which will result in the outside click setting focus to the node
1115
+ // that was clicked (and if not focusable, to "nothing"); by setting
1116
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
1117
+ // on activation (or the configured `setReturnFocus` node), whether the
1118
+ // outside click was on a focusable node or not
1119
+ returnFocus: config.returnFocusOnDeactivate
1120
+ });
1121
+ return;
1122
+ }
1123
+
1124
+ // This is needed for mobile devices.
1125
+ // (If we'll only let `click` events through,
1126
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
1127
+ if (valueOrHandler(config.allowOutsideClick, e)) {
1128
+ // allow the click outside the trap to take place
1129
+ return;
1130
+ }
1131
+
1132
+ // otherwise, prevent the click
1133
+ e.preventDefault();
1134
+ };
1135
+
1136
+ // In case focus escapes the trap for some strange reason, pull it back in.
1137
+ // NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
1138
+ // scrolling if the node that got focused was out of view; there's nothing we can do to
1139
+ // prevent that from happening by the time we discover that focus escaped
1140
+ var checkFocusIn = function checkFocusIn(event) {
1141
+ var target = getActualTarget(event);
1142
+ var targetContained = findContainerIndex(target, event) >= 0;
1143
+
1144
+ // In Firefox when you Tab out of an iframe the Document is briefly focused.
1145
+ if (targetContained || target instanceof Document) {
1146
+ if (targetContained) {
1147
+ state.mostRecentlyFocusedNode = target;
1148
+ }
1149
+ } else {
1150
+ // escaped! pull it back in to where it just left
1151
+ event.stopImmediatePropagation();
1152
+
1153
+ // focus will escape if the MRU node had a positive tab index and user tried to nav forward;
1154
+ // it will also escape if the MRU node had a 0 tab index and user tried to nav backward
1155
+ // toward a node with a positive tab index
1156
+ var nextNode; // next node to focus, if we find one
1157
+ var navAcrossContainers = true;
1158
+ if (state.mostRecentlyFocusedNode) {
1159
+ if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
1160
+ // MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
1161
+ var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
1162
+ // there MAY not be any tabbable nodes in the container if there are at least 2 containers
1163
+ // and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
1164
+ // with at least one tabbable node in order to function, so this could be the other container
1165
+ // with nothing tabbable in it)
1166
+ var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
1167
+ if (tabbableNodes.length > 0) {
1168
+ // MRU tab index MAY not be found if the MRU node is focusable but not tabbable
1169
+ var mruTabIdx = tabbableNodes.findIndex(function (node) {
1170
+ return node === state.mostRecentlyFocusedNode;
1171
+ });
1172
+ if (mruTabIdx >= 0) {
1173
+ if (config.isKeyForward(state.recentNavEvent)) {
1174
+ if (mruTabIdx + 1 < tabbableNodes.length) {
1175
+ nextNode = tabbableNodes[mruTabIdx + 1];
1176
+ navAcrossContainers = false;
1177
+ }
1178
+ // else, don't wrap within the container as focus should move to next/previous
1179
+ // container
1180
+ } else {
1181
+ if (mruTabIdx - 1 >= 0) {
1182
+ nextNode = tabbableNodes[mruTabIdx - 1];
1183
+ navAcrossContainers = false;
1184
+ }
1185
+ // else, don't wrap within the container as focus should move to next/previous
1186
+ // container
1187
+ }
1188
+ // else, don't find in container order without considering direction too
1189
+ }
1190
+ }
1191
+ // else, no tabbable nodes in that container (which means we must have at least one other
1192
+ // container with at least one tabbable node in it, otherwise focus-trap would've thrown
1193
+ // an error the last time updateTabbableNodes() was run): find next node among all known
1194
+ // containers
1195
+ } else {
1196
+ // check to see if there's at least one tabbable node with a positive tab index inside
1197
+ // the trap because focus seems to escape when navigating backward from a tabbable node
1198
+ // with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
1199
+ // the greatest positive tab index like it should)
1200
+ if (!state.containerGroups.some(function (g) {
1201
+ return g.tabbableNodes.some(function (n) {
1202
+ return getTabIndex(n) > 0;
1203
+ });
1204
+ })) {
1205
+ // no containers with tabbable nodes with positive tab indexes which means the focus
1206
+ // escaped for some other reason and we should just execute the fallback to the
1207
+ // MRU node or initial focus node, if any
1208
+ navAcrossContainers = false;
1209
+ }
1210
+ }
1211
+ } else {
1212
+ // no MRU node means we're likely in some initial condition when the trap has just
1213
+ // been activated and initial focus hasn't been given yet, in which case we should
1214
+ // fall through to trying to focus the initial focus node, which is what should
1215
+ // happen below at this point in the logic
1216
+ navAcrossContainers = false;
1217
+ }
1218
+ if (navAcrossContainers) {
1219
+ nextNode = findNextNavNode({
1220
+ // move FROM the MRU node, not event-related node (which will be the node that is
1221
+ // outside the trap causing the focus escape we're trying to fix)
1222
+ target: state.mostRecentlyFocusedNode,
1223
+ isBackward: config.isKeyBackward(state.recentNavEvent)
1224
+ });
1225
+ }
1226
+ if (nextNode) {
1227
+ tryFocus(nextNode);
1228
+ } else {
1229
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1230
+ }
1231
+ }
1232
+ state.recentNavEvent = undefined; // clear
1233
+ };
1234
+
1235
+ // Hijack key nav events on the first and last focusable nodes of the trap,
1236
+ // in order to prevent focus from escaping. If it escapes for even a
1237
+ // moment it can end up scrolling the page and causing confusion so we
1238
+ // kind of need to capture the action at the keydown phase.
1239
+ var checkKeyNav = function checkKeyNav(event) {
1240
+ var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1241
+ state.recentNavEvent = event;
1242
+ var destinationNode = findNextNavNode({
1243
+ event: event,
1244
+ isBackward: isBackward
1245
+ });
1246
+ if (destinationNode) {
1247
+ if (isTabEvent(event)) {
1248
+ // since tab natively moves focus, we wouldn't have a destination node unless we
1249
+ // were on the edge of a container and had to move to the next/previous edge, in
1250
+ // which case we want to prevent default to keep the browser from moving focus
1251
+ // to where it normally would
1252
+ event.preventDefault();
1253
+ }
1254
+ tryFocus(destinationNode);
1255
+ }
1256
+ // else, let the browser take care of [shift+]tab and move the focus
1257
+ };
1258
+
1259
+ var checkKey = function checkKey(event) {
1260
+ if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
1261
+ event.preventDefault();
1262
+ trap.deactivate();
1263
+ return;
1264
+ }
1265
+ if (config.isKeyForward(event) || config.isKeyBackward(event)) {
1266
+ checkKeyNav(event, config.isKeyBackward(event));
1267
+ }
1268
+ };
1269
+ var checkClick = function checkClick(e) {
1270
+ var target = getActualTarget(e);
1271
+ if (findContainerIndex(target, e) >= 0) {
1272
+ return;
1273
+ }
1274
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
1275
+ return;
1276
+ }
1277
+ if (valueOrHandler(config.allowOutsideClick, e)) {
1278
+ return;
1279
+ }
1280
+ e.preventDefault();
1281
+ e.stopImmediatePropagation();
1282
+ };
1283
+
1284
+ //
1285
+ // EVENT LISTENERS
1286
+ //
1287
+
1288
+ var addListeners = function addListeners() {
1289
+ if (!state.active) {
1290
+ return;
1291
+ }
1292
+
1293
+ // There can be only one listening focus trap at a time
1294
+ activeFocusTraps.activateTrap(trapStack, trap);
1295
+
1296
+ // Delay ensures that the focused element doesn't capture the event
1297
+ // that caused the focus trap activation.
1298
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
1299
+ tryFocus(getInitialFocusNode());
1300
+ }) : tryFocus(getInitialFocusNode());
1301
+ doc.addEventListener('focusin', checkFocusIn, true);
1302
+ doc.addEventListener('mousedown', checkPointerDown, {
1303
+ capture: true,
1304
+ passive: false
1305
+ });
1306
+ doc.addEventListener('touchstart', checkPointerDown, {
1307
+ capture: true,
1308
+ passive: false
1309
+ });
1310
+ doc.addEventListener('click', checkClick, {
1311
+ capture: true,
1312
+ passive: false
1313
+ });
1314
+ doc.addEventListener('keydown', checkKey, {
1315
+ capture: true,
1316
+ passive: false
1317
+ });
1318
+ return trap;
1319
+ };
1320
+ var removeListeners = function removeListeners() {
1321
+ if (!state.active) {
1322
+ return;
1323
+ }
1324
+ doc.removeEventListener('focusin', checkFocusIn, true);
1325
+ doc.removeEventListener('mousedown', checkPointerDown, true);
1326
+ doc.removeEventListener('touchstart', checkPointerDown, true);
1327
+ doc.removeEventListener('click', checkClick, true);
1328
+ doc.removeEventListener('keydown', checkKey, true);
1329
+ return trap;
1330
+ };
1331
+
1332
+ //
1333
+ // MUTATION OBSERVER
1334
+ //
1335
+
1336
+ var checkDomRemoval = function checkDomRemoval(mutations) {
1337
+ var isFocusedNodeRemoved = mutations.some(function (mutation) {
1338
+ var removedNodes = Array.from(mutation.removedNodes);
1339
+ return removedNodes.some(function (node) {
1340
+ return node === state.mostRecentlyFocusedNode;
1341
+ });
1342
+ });
1343
+
1344
+ // If the currently focused is removed then browsers will move focus to the
1345
+ // <body> element. If this happens, try to move focus back into the trap.
1346
+ if (isFocusedNodeRemoved) {
1347
+ tryFocus(getInitialFocusNode());
1348
+ }
1349
+ };
1350
+
1351
+ // Use MutationObserver - if supported - to detect if focused node is removed
1352
+ // from the DOM.
1353
+ var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
1354
+ var updateObservedNodes = function updateObservedNodes() {
1355
+ if (!mutationObserver) {
1356
+ return;
1357
+ }
1358
+ mutationObserver.disconnect();
1359
+ if (state.active && !state.paused) {
1360
+ state.containers.map(function (container) {
1361
+ mutationObserver.observe(container, {
1362
+ subtree: true,
1363
+ childList: true
1364
+ });
1365
+ });
1366
+ }
1367
+ };
1368
+
1369
+ //
1370
+ // TRAP DEFINITION
1371
+ //
1372
+
1373
+ trap = {
1374
+ get active() {
1375
+ return state.active;
1376
+ },
1377
+ get paused() {
1378
+ return state.paused;
1379
+ },
1380
+ activate: function activate(activateOptions) {
1381
+ if (state.active) {
1382
+ return this;
1383
+ }
1384
+ var onActivate = getOption(activateOptions, 'onActivate');
1385
+ var onPostActivate = getOption(activateOptions, 'onPostActivate');
1386
+ var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
1387
+ if (!checkCanFocusTrap) {
1388
+ updateTabbableNodes();
1389
+ }
1390
+ state.active = true;
1391
+ state.paused = false;
1392
+ state.nodeFocusedBeforeActivation = doc.activeElement;
1393
+ onActivate === null || onActivate === void 0 ? void 0 : onActivate();
1394
+ var finishActivation = function finishActivation() {
1395
+ if (checkCanFocusTrap) {
1396
+ updateTabbableNodes();
1397
+ }
1398
+ addListeners();
1399
+ updateObservedNodes();
1400
+ onPostActivate === null || onPostActivate === void 0 ? void 0 : onPostActivate();
1401
+ };
1402
+ if (checkCanFocusTrap) {
1403
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
1404
+ return this;
1405
+ }
1406
+ finishActivation();
1407
+ return this;
1408
+ },
1409
+ deactivate: function deactivate(deactivateOptions) {
1410
+ if (!state.active) {
1411
+ return this;
1412
+ }
1413
+ var options = _objectSpread2({
1414
+ onDeactivate: config.onDeactivate,
1415
+ onPostDeactivate: config.onPostDeactivate,
1416
+ checkCanReturnFocus: config.checkCanReturnFocus
1417
+ }, deactivateOptions);
1418
+ clearTimeout(state.delayInitialFocusTimer); // noop if undefined
1419
+ state.delayInitialFocusTimer = undefined;
1420
+ removeListeners();
1421
+ state.active = false;
1422
+ state.paused = false;
1423
+ updateObservedNodes();
1424
+ activeFocusTraps.deactivateTrap(trapStack, trap);
1425
+ var onDeactivate = getOption(options, 'onDeactivate');
1426
+ var onPostDeactivate = getOption(options, 'onPostDeactivate');
1427
+ var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
1428
+ var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
1429
+ onDeactivate === null || onDeactivate === void 0 ? void 0 : onDeactivate();
1430
+ var finishDeactivation = function finishDeactivation() {
1431
+ delay(function () {
1432
+ if (returnFocus) {
1433
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1434
+ }
1435
+ onPostDeactivate === null || onPostDeactivate === void 0 ? void 0 : onPostDeactivate();
1436
+ });
1437
+ };
1438
+ if (returnFocus && checkCanReturnFocus) {
1439
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
1440
+ return this;
1441
+ }
1442
+ finishDeactivation();
1443
+ return this;
1444
+ },
1445
+ pause: function pause(pauseOptions) {
1446
+ if (state.paused || !state.active) {
1447
+ return this;
1448
+ }
1449
+ var onPause = getOption(pauseOptions, 'onPause');
1450
+ var onPostPause = getOption(pauseOptions, 'onPostPause');
1451
+ state.paused = true;
1452
+ onPause === null || onPause === void 0 ? void 0 : onPause();
1453
+ removeListeners();
1454
+ updateObservedNodes();
1455
+ onPostPause === null || onPostPause === void 0 ? void 0 : onPostPause();
1456
+ return this;
1457
+ },
1458
+ unpause: function unpause(unpauseOptions) {
1459
+ if (!state.paused || !state.active) {
1460
+ return this;
1461
+ }
1462
+ var onUnpause = getOption(unpauseOptions, 'onUnpause');
1463
+ var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
1464
+ state.paused = false;
1465
+ onUnpause === null || onUnpause === void 0 ? void 0 : onUnpause();
1466
+ updateTabbableNodes();
1467
+ addListeners();
1468
+ updateObservedNodes();
1469
+ onPostUnpause === null || onPostUnpause === void 0 ? void 0 : onPostUnpause();
1470
+ return this;
1471
+ },
1472
+ updateContainerElements: function updateContainerElements(containerElements) {
1473
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
1474
+ state.containers = elementsAsArray.map(function (element) {
1475
+ return typeof element === 'string' ? doc.querySelector(element) : element;
1476
+ });
1477
+ if (state.active) {
1478
+ updateTabbableNodes();
1479
+ }
1480
+ updateObservedNodes();
1481
+ return this;
1482
+ }
1483
+ };
1484
+
1485
+ // initialize container elements
1486
+ trap.updateContainerElements(elements);
1487
+ return trap;
1488
+ };
1489
+
1490
+ /**
1491
+ * @namespace aria
1492
+ */
1493
+ var aria$1 = aria$1 || {};
1494
+ aria$1.Utils = aria$1.Utils || {};
1495
+ // Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
1496
+ aria$1.Utils.matches = function (element, selector) {
1497
+ return element.matches(selector);
1498
+ };
1499
+ aria$1.Utils.remove = function (item) {
1500
+ if (item.remove && typeof item.remove === 'function') {
1501
+ return item.remove();
1502
+ }
1503
+ if (item.parentNode &&
1504
+ item.parentNode.removeChild &&
1505
+ typeof item.parentNode.removeChild === 'function') {
1506
+ return item.parentNode.removeChild(item);
1507
+ }
1508
+ return false;
1509
+ };
1510
+ aria$1.Utils.isFocusable = function (element) {
1511
+ if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {
1512
+ return true;
1513
+ }
1514
+ if (element.disabled) {
1515
+ return false;
1516
+ }
1517
+ switch (element.nodeName) {
1518
+ case 'A':
1519
+ return !!element.href && element.rel != 'ignore';
1520
+ case 'INPUT':
1521
+ return element.type != 'hidden' && element.type != 'file';
1522
+ case 'BUTTON':
1523
+ case 'SELECT':
1524
+ case 'TEXTAREA':
1525
+ return true;
1526
+ default:
1527
+ return false;
1528
+ }
1529
+ };
1530
+ aria$1.Utils.getAncestorBySelector = function (element, selector) {
1531
+ if (!aria$1.Utils.matches(element, selector + ' ' + element.tagName)) {
1532
+ // Element is not inside an element that matches selector
1533
+ return null;
1534
+ }
1535
+ // Move up the DOM tree until a parent matching the selector is found
1536
+ var currentNode = element;
1537
+ var ancestor = null;
1538
+ while (ancestor === null) {
1539
+ if (aria$1.Utils.matches(currentNode.parentNode, selector)) {
1540
+ ancestor = currentNode.parentNode;
1541
+ }
1542
+ else {
1543
+ currentNode = currentNode.parentNode;
1544
+ }
1545
+ }
1546
+ return ancestor;
1547
+ };
1548
+ aria$1.Utils.hasClass = function (element, className) {
1549
+ return (new RegExp('(\\s|^)' + className + '(\\s|$)')).test(element.className);
1550
+ };
1551
+ aria$1.Utils.addClass = function (element, className) {
1552
+ if (!aria$1.Utils.hasClass(element, className)) {
1553
+ element.className += ' ' + className;
1554
+ }
1555
+ };
1556
+ aria$1.Utils.removeClass = function (element, className) {
1557
+ var classRegex = new RegExp('(\\s|^)' + className + '(\\s|$)');
1558
+ element.className = element.className.replace(classRegex, ' ').trim();
1559
+ };
1560
+ aria$1.Utils.bindMethods = function (object) {
1561
+ var methodNames = Array.prototype.slice.call(arguments, 1);
1562
+ methodNames.forEach(function (method) {
1563
+ object[method] = object[method].bind(object);
1564
+ });
1565
+ };
1566
+ window.aria = aria$1;
1567
+
1568
+ /*
1569
+ * This content is licensed according to the W3C Software License at
1570
+ * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
1571
+ */
1572
+ /**
1573
+ * @namespace aria
1574
+ */
1575
+ var aria = aria || {};
1576
+ aria.Utils = aria.Utils || {};
1577
+ // Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
1578
+ aria.Utils.matches = function (element, selector) {
1579
+ return element.matches(selector);
1580
+ };
1581
+ aria.Utils.remove = function (item) {
1582
+ if (item.remove && typeof item.remove === 'function') {
1583
+ return item.remove();
1584
+ }
1585
+ if (item.parentNode &&
1586
+ item.parentNode.removeChild &&
1587
+ typeof item.parentNode.removeChild === 'function') {
1588
+ return item.parentNode.removeChild(item);
1589
+ }
1590
+ return false;
1591
+ };
1592
+ aria.Utils.isFocusable = function (element) {
1593
+ if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {
1594
+ return true;
1595
+ }
1596
+ if (element.disabled) {
1597
+ return false;
1598
+ }
1599
+ switch (element.nodeName) {
1600
+ case 'A':
1601
+ return !!element.href && element.rel != 'ignore';
1602
+ case 'INPUT':
1603
+ return element.type != 'hidden' && element.type != 'file';
1604
+ case 'BUTTON':
1605
+ case 'SELECT':
1606
+ case 'TEXTAREA':
1607
+ return true;
1608
+ default:
1609
+ return false;
1610
+ }
1611
+ };
1612
+ aria.Utils.getAncestorBySelector = function (element, selector) {
1613
+ if (!aria.Utils.matches(element, selector + ' ' + element.tagName)) {
1614
+ // Element is not inside an element that matches selector
1615
+ return null;
1616
+ }
1617
+ // Move up the DOM tree until a parent matching the selector is found
1618
+ var currentNode = element;
1619
+ var ancestor = null;
1620
+ while (ancestor === null) {
1621
+ if (aria.Utils.matches(currentNode.parentNode, selector)) {
1622
+ ancestor = currentNode.parentNode;
1623
+ }
1624
+ else {
1625
+ currentNode = currentNode.parentNode;
1626
+ }
1627
+ }
1628
+ return ancestor;
1629
+ };
1630
+ aria.Utils.hasClass = function (element, className) {
1631
+ return (new RegExp('(\\s|^)' + className + '(\\s|$)')).test(element.className);
1632
+ };
1633
+ aria.Utils.addClass = function (element, className) {
1634
+ if (!aria.Utils.hasClass(element, className)) {
1635
+ element.className += ' ' + className;
1636
+ }
1637
+ };
1638
+ aria.Utils.removeClass = function (element, className) {
1639
+ var classRegex = new RegExp('(\\s|^)' + className + '(\\s|$)');
1640
+ element.className = element.className.replace(classRegex, ' ').trim();
1641
+ };
1642
+ aria.Utils.bindMethods = function (object) {
1643
+ var methodNames = Array.prototype.slice.call(arguments, 1);
1644
+ methodNames.forEach(function (method) {
1645
+ object[method] = object[method].bind(object);
1646
+ });
1647
+ };
1648
+ /*
1649
+ * When util functions move focus around, set this true so the focus listener
1650
+ * can ignore the events.
1651
+ */
1652
+ aria.Utils.IgnoreUtilFocusChanges = false;
1653
+ aria.Utils.dialogOpenClass = 'has-dialog';
1654
+ /**
1655
+ * @desc Set focus on descendant nodes until the first focusable element is
1656
+ * found.
1657
+ * @param element
1658
+ * DOM node for which to find the first focusable descendant.
1659
+ * @returns
1660
+ * true if a focusable element is found and focus is set.
1661
+ */
1662
+ aria.Utils.focusFirstDescendant = function (element) {
1663
+ for (var i = 0; i < element.childNodes.length; i++) {
1664
+ var child = element.childNodes[i];
1665
+ if (aria.Utils.attemptFocus(child) ||
1666
+ aria.Utils.focusFirstDescendant(child)) {
1667
+ return true;
1668
+ }
1669
+ }
1670
+ return false;
1671
+ }; // end focusFirstDescendant
1672
+ /**
1673
+ * @desc Find the last descendant node that is focusable.
1674
+ * @param element
1675
+ * DOM node for which to find the last focusable descendant.
1676
+ * @returns
1677
+ * true if a focusable element is found and focus is set.
1678
+ */
1679
+ aria.Utils.focusLastDescendant = function (element) {
1680
+ for (var i = element.childNodes.length - 1; i >= 0; i--) {
1681
+ var child = element.childNodes[i];
1682
+ if (aria.Utils.attemptFocus(child) ||
1683
+ aria.Utils.focusLastDescendant(child)) {
1684
+ return true;
1685
+ }
1686
+ }
1687
+ return false;
1688
+ }; // end focusLastDescendant
1689
+ /**
1690
+ * @desc Set Attempt to set focus on the current node.
1691
+ * @param element
1692
+ * The node to attempt to focus on.
1693
+ * @returns
1694
+ * true if element is focused.
1695
+ */
1696
+ aria.Utils.attemptFocus = function (element) {
1697
+ if (!aria.Utils.isFocusable(element)) {
1698
+ return false;
1699
+ }
1700
+ aria.Utils.IgnoreUtilFocusChanges = true;
1701
+ try {
1702
+ element.focus();
1703
+ }
1704
+ catch (e) {
1705
+ }
1706
+ aria.Utils.IgnoreUtilFocusChanges = false;
1707
+ return (document.activeElement === element);
1708
+ }; // end attemptFocus
1709
+ /* Modals can open modals. Keep track of them with this array. */
1710
+ aria.OpenDialogList = aria.OpenDialogList || new Array(0);
1711
+ /**
1712
+ * @returns the last opened dialog (the current dialog)
1713
+ */
1714
+ aria.getCurrentDialog = function () {
1715
+ if (aria.OpenDialogList && aria.OpenDialogList.length) {
1716
+ return aria.OpenDialogList[aria.OpenDialogList.length - 1];
1717
+ }
1718
+ };
1719
+ aria.closeCurrentDialog = function () {
1720
+ var currentDialog = aria.getCurrentDialog();
1721
+ if (currentDialog) {
1722
+ currentDialog.close();
1723
+ return true;
1724
+ }
1725
+ return false;
1726
+ };
1727
+ aria.handleEscape = function (event) {
1728
+ if (event.key === 'Escape' && aria.closeCurrentDialog()) {
1729
+ event.stopPropagation();
1730
+ }
1731
+ };
1732
+ document.addEventListener('keyup', aria.handleEscape);
1733
+ /**
1734
+ * @constructor
1735
+ * @desc Dialog object providing modal focus management.
1736
+ *
1737
+ * Assumptions: The element serving as the dialog container is present in the
1738
+ * DOM and hidden. The dialog container has role='dialog'.
1739
+ *
1740
+ * @param dialogNode
1741
+ * The element serving as the dialog container.
1742
+ * @param focusAfterClosed
1743
+ * Either the DOM node or the ID of the DOM node to focus when the
1744
+ * dialog closes.
1745
+ * @param focusFirst
1746
+ * Optional parameter containing either the DOM node or the ID of the
1747
+ * DOM node to focus when the dialog opens. If not specified, the
1748
+ * first focusable element in the dialog will receive focus.
1749
+ */
1750
+ aria.Dialog = function (dialogNode, focusAfterClosed, focusFirst, isFullScreen) {
1751
+ this.dialogNode = dialogNode;
1752
+ if (this.dialogNode === null) {
1753
+ throw new Error('No element found');
1754
+ }
1755
+ var validRoles = ['dialog', 'alertdialog'];
1756
+ var isDialog = (this.dialogNode.getAttribute('role') || '')
1757
+ .trim()
1758
+ .split(/\s+/g)
1759
+ .some(function (token) {
1760
+ return validRoles.some(function (role) {
1761
+ return token === role;
1762
+ });
1763
+ });
1764
+ if (!isDialog) {
1765
+ throw new Error('Dialog() requires a DOM element with ARIA role of dialog or alertdialog.');
1766
+ }
1767
+ // Wrap in an individual backdrop element if one doesn't exist
1768
+ // Native <dialog> elements use the ::backdrop pseudo-element, which
1769
+ // works similarly.
1770
+ var backdropClass = 'content-overlay-background';
1771
+ if (this.dialogNode.parentNode.classList.contains(backdropClass)) {
1772
+ this.backdropNode = this.dialogNode.parentNode;
1773
+ }
1774
+ else {
1775
+ this.backdropNode = document.createElement('div');
1776
+ this.backdropNode.className = backdropClass;
1777
+ this.dialogNode.parentNode.insertBefore(this.backdropNode, this.dialogNode);
1778
+ this.backdropNode.appendChild(this.dialogNode);
1779
+ }
1780
+ this.backdropNode.classList.add('active');
1781
+ setTimeout(() => {
1782
+ this.backdropNode.classList.add('transition');
1783
+ }, 1);
1784
+ // Disable scroll on the body element
1785
+ this.isFullscreen = isFullScreen;
1786
+ if (isFullScreen) {
1787
+ document.body.classList.add(aria.Utils.dialogOpenClass);
1788
+ }
1789
+ if (typeof focusAfterClosed === 'string') {
1790
+ this.focusAfterClosed = document.getElementById(focusAfterClosed);
1791
+ }
1792
+ else if (typeof focusAfterClosed === 'object') {
1793
+ this.focusAfterClosed = focusAfterClosed;
1794
+ }
1795
+ else {
1796
+ throw new Error('the focusAfterClosed parameter is required for the aria.Dialog constructor.');
1797
+ }
1798
+ if (typeof focusFirst === 'string') {
1799
+ this.focusFirst = document.getElementById(focusFirst);
1800
+ }
1801
+ else if (typeof focusFirst === 'object') {
1802
+ this.focusFirst = focusFirst;
1803
+ }
1804
+ else {
1805
+ this.focusFirst = null;
1806
+ }
1807
+ // Bracket the dialog node with two invisible, focusable nodes.
1808
+ // While this dialog is open, we use these to make sure that focus never
1809
+ // leaves the document even if dialogNode is the first or last node.
1810
+ var preDiv = document.createElement('div');
1811
+ this.preNode = this.dialogNode.parentNode.insertBefore(preDiv, this.dialogNode);
1812
+ this.preNode.tabIndex = 0;
1813
+ var postDiv = document.createElement('div');
1814
+ this.postNode = this.dialogNode.parentNode.insertBefore(postDiv, this.dialogNode.nextSibling);
1815
+ this.postNode.tabIndex = 0;
1816
+ // If this modal is opening on top of one that is already open,
1817
+ // get rid of the document focus listener of the open dialog.
1818
+ if (aria.OpenDialogList.length > 0) {
1819
+ aria.getCurrentDialog().removeListeners();
1820
+ }
1821
+ if (isFullScreen) {
1822
+ this.addListeners();
1823
+ }
1824
+ aria.OpenDialogList.push(this);
1825
+ this.dialogNode.className = 'content-overlay-dialog'; // make visible
1826
+ if (this.focusFirst) {
1827
+ this.focusFirst.focus();
1828
+ }
1829
+ else {
1830
+ aria.Utils.focusFirstDescendant(this.dialogNode);
1831
+ }
1832
+ this.lastFocus = document.activeElement;
1833
+ }; // end Dialog constructor
1834
+ /**
1835
+ * @desc
1836
+ * Hides the current top dialog,
1837
+ * removes listeners of the top dialog,
1838
+ * restore listeners of a parent dialog if one was open under the one that just closed,
1839
+ * and sets focus on the element specified for focusAfterClosed.
1840
+ */
1841
+ aria.Dialog.prototype.close = function () {
1842
+ aria.OpenDialogList.pop();
1843
+ this.removeListeners();
1844
+ aria.Utils.remove(this.preNode);
1845
+ aria.Utils.remove(this.postNode);
1846
+ this.dialogNode.className = 'hidden';
1847
+ this.backdropNode.classList.remove('active');
1848
+ this.backdropNode.classList.remove('transition');
1849
+ this.focusAfterClosed.focus();
1850
+ // If a dialog was open underneath this one, restore its listeners.
1851
+ if (aria.OpenDialogList.length > 0 && aria.OpenDialogList.filter(dialog => dialog.isFullscreen === true).length) {
1852
+ aria.getCurrentDialog().addListeners();
1853
+ }
1854
+ else {
1855
+ document.body.classList.remove(aria.Utils.dialogOpenClass);
1856
+ }
1857
+ this.dialogNode.dispatchEvent(new CustomEvent("ariaDialog.closed", {
1858
+ bubbles: true,
1859
+ "detail": {}
1860
+ }));
1861
+ }; // end close
1862
+ /**
1863
+ * @desc
1864
+ * Hides the current dialog and replaces it with another.
1865
+ *
1866
+ * @param newDialogId
1867
+ * ID of the dialog that will replace the currently open top dialog.
1868
+ * @param newFocusAfterClosed
1869
+ * Optional ID or DOM node specifying where to place focus when the new dialog closes.
1870
+ * If not specified, focus will be placed on the element specified by the dialog being replaced.
1871
+ * @param newFocusFirst
1872
+ * Optional ID or DOM node specifying where to place focus in the new dialog when it opens.
1873
+ * If not specified, the first focusable element will receive focus.
1874
+ */
1875
+ aria.Dialog.prototype.replace = function (newDialogId, newFocusAfterClosed, newFocusFirst) {
1876
+ // var closedDialog = aria.getCurrentDialog();
1877
+ aria.OpenDialogList.pop();
1878
+ this.removeListeners();
1879
+ aria.Utils.remove(this.preNode);
1880
+ aria.Utils.remove(this.postNode);
1881
+ this.dialogNode.className = 'hidden';
1882
+ this.backdropNode.classList.remove('active');
1883
+ this.backdropNode.classList.remove('transition');
1884
+ var focusAfterClosed = newFocusAfterClosed || this.focusAfterClosed;
1885
+ new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);
1886
+ // var dialog = new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);
1887
+ }; // end replace
1888
+ aria.Dialog.prototype.addListeners = function () {
1889
+ document.addEventListener('focus', this.trapFocus, true);
1890
+ }; // end addListeners
1891
+ aria.Dialog.prototype.removeListeners = function () {
1892
+ document.removeEventListener('focus', this.trapFocus, true);
1893
+ }; // end removeListeners
1894
+ aria.Dialog.prototype.trapFocus = function (event) {
1895
+ if (aria.Utils.IgnoreUtilFocusChanges) {
1896
+ return;
1897
+ }
1898
+ var currentDialog = aria.getCurrentDialog();
1899
+ if (currentDialog.dialogNode.contains(event.target)) {
1900
+ currentDialog.lastFocus = event.target;
1901
+ }
1902
+ else {
1903
+ aria.Utils.focusFirstDescendant(currentDialog.dialogNode);
1904
+ if (currentDialog.lastFocus == document.activeElement) {
1905
+ aria.Utils.focusLastDescendant(currentDialog.dialogNode);
1906
+ }
1907
+ currentDialog.lastFocus = document.activeElement;
1908
+ }
1909
+ }; // end trapFocus
1910
+ aria.closeDialog = function (closeButton) {
1911
+ var topDialog = aria.getCurrentDialog();
1912
+ if (topDialog.dialogNode.contains(closeButton)) {
1913
+ topDialog.close();
1914
+ }
1915
+ }; // end closeDialog
1916
+ aria.replaceDialog = function (newDialogId, newFocusAfterClosed, newFocusFirst) {
1917
+ var topDialog = aria.getCurrentDialog();
1918
+ if (topDialog.dialogNode.contains(document.activeElement)) {
1919
+ topDialog.replace(newDialogId, newFocusAfterClosed, newFocusFirst);
1920
+ }
1921
+ }; // end replaceDialog
1922
+ window.aria = aria;
1923
+
1924
+ const contentOverlayCss = "@charset \"UTF-8\";.content-block-overlay-container{position:relative;display:block}content-overlay{display:block;position:relative;visibility:hidden}content-overlay.hydrated{visibility:inherit}content-overlay .content-overlay__content>*[slot=content]{height:100%}content-overlay.content-overlay-inactive{display:none}content-overlay.content-overlay-active{display:block}content-overlay[vertical-position=left]{align-items:flex-start}content-overlay[vertical-position=center]{align-items:center}content-overlay[vertical-position=right]{align-items:flex-end}content-overlay[vertical-position=top]{justify-content:flex-start}content-overlay[vertical-position=center]{justify-content:center}content-overlay[vertical-position=bottom]{justify-content:flex-end}content-overlay .content-overlay-background{background:rgba(255, 255, 255, 0.8);bottom:0;display:none;top:0;z-index:100000;right:0;left:0}content-overlay .content-overlay-background.active{display:block}content-overlay .content-overlay__header{display:flex;align-items:center}content-overlay .content-overlay__close{order:2;margin-left:auto;cursor:pointer;z-index:1;appearance:none;background:none;border:none}content-overlay .content-overlay__close:after{content:\"×\";font-size:2.5rem}content-overlay.content-overlay--fullscreen .content-overlay-background{position:fixed}content-overlay.content-overlay--absolute{position:absolute;box-sizing:border-box;z-index:100000;height:100%;width:100%;top:0;left:0}content-overlay.content-overlay--absolute .content-overlay-background{position:absolute}content-overlay.content-overlay--absolute .content-overlay__content,content-overlay.content-overlay--fullscreen .content-overlay__content{flex:1;overflow:hidden}content-overlay [role=dialog]{display:flex;flex-direction:column;height:100%;justify-content:flex-start}content-overlay [role=dialog].hidden{display:none}body.has-dialog{overflow:hidden}";
1925
+
1926
+ const ContentOverlay$1 = /*@__PURE__*/ proxyCustomElement(class ContentOverlay extends HTMLElement {
1927
+ constructor() {
1928
+ super();
1929
+ this.__registerHost();
1930
+ this.contentOverlayActivated = createEvent(this, "contentOverlayActivated", 7);
1931
+ this.target = undefined;
1932
+ this.fullScreen = 'true';
1933
+ this.styleClass = undefined;
1934
+ this.horizontalAlignment = 'center';
1935
+ this.verticalAlignment = 'center';
1936
+ this.closeTitle = 'Close Overlay';
1937
+ this.isActive = false;
1938
+ this.activeClass = '';
1939
+ this.isFullScreen = false;
1940
+ }
1941
+ onContentBlockActivated(event) {
1942
+ if (this.hostElement.getAttribute('id') === event.detail.getAttribute('id')) {
1943
+ event.preventDefault();
1944
+ this.openOverlay();
1945
+ }
1946
+ }
1947
+ async openOverlay() {
1948
+ if (this.isActive) {
1949
+ return false;
1950
+ }
1951
+ if (this.target) {
1952
+ let targetElement = document.getElementById(this.target);
1953
+ if (targetElement) {
1954
+ targetElement.classList.add('content-block-overlay-container');
1955
+ }
1956
+ }
1957
+ else if (this.isFullScreen) {
1958
+ if (document.querySelectorAll(`#${this.hostElement.getAttribute('id')}`).length === 1) ;
1959
+ }
1960
+ if (this.contentSlot) {
1961
+ this.isActive = true;
1962
+ this.setComputedActiveClass();
1963
+ this.focusTrap = createFocusTrap(this.hostElement, {
1964
+ onDeactivate: () => {
1965
+ this.isActive = false;
1966
+ this.setComputedActiveClass();
1967
+ }
1968
+ });
1969
+ }
1970
+ this.contentOverlayActivated.emit(this.hostElement);
1971
+ }
1972
+ async closeOverlay() {
1973
+ this.focusTrap.deactivate();
1974
+ }
1975
+ setComputedActiveClass() {
1976
+ let positioningValue = 'static';
1977
+ if (this.target) {
1978
+ positioningValue = 'absolute';
1979
+ }
1980
+ if (this.isFullScreen) {
1981
+ positioningValue = 'fullscreen';
1982
+ }
1983
+ this.activeClass = `content-overlay ${this.isActive ? 'content-overlay-active' : 'content-overlay-inactive'} content-overlay--${positioningValue} ${getCurrentValue(this.styleClass)}`;
1984
+ }
1985
+ ;
1986
+ componentWillLoad() {
1987
+ return Promise.allSettled([
1988
+ WindowResizeService.registerProp(this.horizontalAlignment).subscribe(newValue => this.horizontalAlignment = newValue),
1989
+ WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => this.verticalAlignment = newValue),
1990
+ WindowResizeService.registerProp(this.fullScreen).subscribe(newValue => {
1991
+ if (!this.target)
1992
+ this.isFullScreen = newValue === 'true';
1993
+ }),
1994
+ WindowResizeService.breakpointIndex$.subscribe(() => {
1995
+ this.setComputedActiveClass();
1996
+ }),
1997
+ ]);
1998
+ }
1999
+ componentDidLoad() {
2000
+ this.contentSlot = this.hostElement.querySelector('[slot="content"]');
2001
+ }
2002
+ closeOverlayButtonClicked(event) {
2003
+ event.preventDefault();
2004
+ this.closeOverlay();
2005
+ }
2006
+ render() {
2007
+ return (h(Host, { class: this.activeClass }, h("div", { class: "content-block-overlay-container" }, h("div", { class: `content-overlay-background ${this.isActive ? 'active' : ''}` }, h("div", { ref: element => this.dialogElement = element, role: "dialog", "aria-modal": "true", class: this.isActive ? 'active' : 'hidden', "aria-expanded": "false" }, h("div", { class: "content-overlay__header" }, h("button", { onClick: e => this.closeOverlayButtonClicked(e), class: "content-overlay__close", title: this.closeTitle }, h("slot", { name: "closeButton" })), h("slot", { name: "header" })), h("div", { ref: element => this.contentElement = element, class: "content-overlay__content" }, h("slot", { name: "content" })))))));
2008
+ }
2009
+ componentDidRender() {
2010
+ if (this.isActive && !this.focusTrap.active) {
2011
+ this.focusTrap.activate();
2012
+ }
2013
+ }
2014
+ get hostElement() { return this; }
2015
+ static get style() { return contentOverlayCss; }
2016
+ }, [4, "content-overlay", {
2017
+ "target": [1],
2018
+ "fullScreen": [1, "full-screen"],
2019
+ "styleClass": [1, "style-class"],
2020
+ "horizontalAlignment": [1537, "horizontal-alignment"],
2021
+ "verticalAlignment": [1537, "vertical-alignment"],
2022
+ "closeTitle": [1, "close-title"],
2023
+ "isActive": [32],
2024
+ "activeClass": [32],
2025
+ "isFullScreen": [32],
2026
+ "openOverlay": [64],
2027
+ "closeOverlay": [64]
2028
+ }, [[0, "contentBlockActivated", "onContentBlockActivated"]]]);
2029
+ function defineCustomElement$1() {
2030
+ if (typeof customElements === "undefined") {
2031
+ return;
2032
+ }
2033
+ const components = ["content-overlay"];
2034
+ components.forEach(tagName => { switch (tagName) {
2035
+ case "content-overlay":
2036
+ if (!customElements.get(tagName)) {
2037
+ customElements.define(tagName, ContentOverlay$1);
2038
+ }
2039
+ break;
2040
+ } });
2041
+ }
2042
+
2043
+ const ContentOverlay = ContentOverlay$1;
2044
+ const defineCustomElement = defineCustomElement$1;
2045
+
2046
+ export { ContentOverlay, defineCustomElement };
2047
+
2048
+ //# sourceMappingURL=content-overlay.js.map