@content-blocks/js 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +111 -3
  3. package/THIRD-PARTY-NOTICES.md +21 -0
  4. package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -2
  5. package/dist/cjs/content-accordion.cjs.entry.js +87 -0
  6. package/dist/cjs/content-blocks.cjs.js +35 -11
  7. package/dist/cjs/content-button.cjs.entry.js +113 -0
  8. package/dist/cjs/content-carousel.cjs.entry.js +153 -47
  9. package/dist/cjs/content-grid-formatter.cjs.entry.js +102 -0
  10. package/dist/cjs/content-hero-block.cjs.entry.js +45 -0
  11. package/dist/cjs/content-image.cjs.entry.js +153 -0
  12. package/dist/cjs/content-line.cjs.entry.js +61 -0
  13. package/dist/cjs/content-navigation-block.cjs.entry.js +51 -34
  14. package/dist/cjs/content-overlay.cjs.entry.js +641 -0
  15. package/dist/cjs/content-spacer.cjs.entry.js +75 -0
  16. package/dist/cjs/content-split-block.cjs.entry.js +22 -19
  17. package/dist/cjs/content-tabs.cjs.entry.js +38 -21
  18. package/dist/cjs/content-text-block.cjs.entry.js +63 -0
  19. package/dist/cjs/content-tout-block.cjs.entry.js +34 -0
  20. package/dist/cjs/{content-accordion_11.cjs.entry.js → content-video.cjs.entry.js} +14541 -12905
  21. package/dist/cjs/{focus-trap.esm-7bc384a0.js → focus-trap.esm-ZwN-anf1.js} +484 -190
  22. package/dist/cjs/{index-2e0ce692.js → index-B1U6Gweq.js} +348 -246
  23. package/dist/cjs/index-ClnpH9XB.js +2170 -0
  24. package/dist/cjs/index-CyalvZJn.js +1719 -0
  25. package/dist/cjs/index-DUvWvBDN.js +290 -0
  26. package/dist/cjs/index-voGY4Tkl.js +4705 -0
  27. package/dist/cjs/index.cjs.js +2 -5
  28. package/dist/cjs/loader.cjs.js +3 -8
  29. package/dist/cjs/responsive-component-C5eJS82z.js +171 -0
  30. package/dist/cjs/responsive-component-DMdnQIPV.js +171 -0
  31. package/dist/cjs/swiper-KLYbvU1K.js +3931 -0
  32. package/dist/cjs/{swiper-8221f4e8.js → swiper-_Z8Y4IJI.js} +269 -236
  33. package/dist/cjs/utils-BCHaRGm_.js +462 -0
  34. package/dist/cjs/{utils-df044337.js → utils-C3gXIS2t.js} +51 -49
  35. package/dist/cjs/utils-DUvWvBDN.js +290 -0
  36. package/dist/collection/blocks/content-hero-block/content-hero-block.css +1 -1
  37. package/dist/collection/blocks/content-hero-block/content-hero-block.js +33 -48
  38. package/dist/collection/blocks/content-split-block/content-split-block.css +16 -5
  39. package/dist/collection/blocks/content-split-block/content-split-block.js +29 -48
  40. package/dist/collection/blocks/content-text-block/content-text-block.js +65 -59
  41. package/dist/collection/blocks/content-tout-block/content-tout-block.css +3 -0
  42. package/dist/collection/blocks/content-tout-block/content-tout-block.js +22 -47
  43. package/dist/collection/collection-manifest.json +8 -5
  44. package/dist/collection/components/content-accordion/content-accordion.css +20 -1
  45. package/dist/collection/components/content-accordion/content-accordion.js +67 -33
  46. package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js +0 -1
  47. package/dist/collection/components/content-carousel/content-carousel.css +60 -4
  48. package/dist/collection/components/content-carousel/content-carousel.js +294 -44
  49. package/dist/collection/components/content-navigation-block/content-navigation-block.css +15 -1
  50. package/dist/collection/components/content-navigation-block/content-navigation-block.js +86 -42
  51. package/dist/collection/components/content-overlay/content-overlay.css +36 -5
  52. package/dist/collection/components/content-overlay/content-overlay.js +181 -120
  53. package/dist/collection/components/content-overlay/libraries/aria-dialog.js +0 -1
  54. package/dist/collection/components/content-overlay/libraries/aria-utilities.js +0 -1
  55. package/dist/collection/components/content-tabs/content-tabs.js +7 -49
  56. package/dist/collection/components/content-tabs/libraries/w3_tabs.js +0 -1
  57. package/dist/collection/elements/content-button/content-button.css +8 -7
  58. package/dist/collection/elements/content-button/content-button.js +103 -84
  59. package/dist/collection/elements/content-image/content-image.css +3 -1
  60. package/dist/collection/elements/content-image/content-image.js +176 -95
  61. package/dist/collection/elements/content-line/content-line.js +63 -54
  62. package/dist/collection/elements/content-video/content-video.css +1 -1
  63. package/dist/collection/elements/content-video/content-video.js +123 -73
  64. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +8 -2
  65. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +167 -89
  66. package/dist/collection/formatters/content-spacer/content-spacer.js +86 -209
  67. package/dist/collection/global/content-blocks-reset.css +77 -0
  68. package/dist/collection/index.js +1 -1
  69. package/dist/collection/sass/_mixins.scss +21 -5
  70. package/dist/collection/sass/_variables.scss +15 -15
  71. package/dist/collection/setupFiles.js +0 -1
  72. package/dist/collection/site/site.js +67 -0
  73. package/dist/collection/utils/breakpoints.js +162 -0
  74. package/dist/collection/utils/responsive-component.js +249 -0
  75. package/dist/collection/utils/utils.js +32 -42
  76. package/dist/components/content-accordion.js +65 -44
  77. package/dist/components/content-button.js +89 -43
  78. package/dist/components/content-carousel.js +172 -55
  79. package/dist/components/content-grid-formatter.js +127 -3
  80. package/dist/components/content-hero-block.js +33 -26
  81. package/dist/components/content-image.js +127 -71
  82. package/dist/components/content-line.js +56 -35
  83. package/dist/components/content-navigation-block.js +62 -39
  84. package/dist/components/content-overlay.js +128 -67
  85. package/dist/components/content-spacer.js +70 -54
  86. package/dist/components/content-split-block.js +33 -32
  87. package/dist/components/content-tabs.js +46 -25
  88. package/dist/components/content-text-block.js +55 -35
  89. package/dist/components/content-tout-block.js +29 -27
  90. package/dist/components/content-video.js +14605 -11951
  91. package/dist/{esm/focus-trap.esm-8fb54175.js → components/focus-trap.esm.js} +484 -190
  92. package/dist/components/index.d.ts +2 -0
  93. package/dist/components/index.js +3 -3
  94. package/dist/components/{p-5a91aa1b.js → index2.js} +348 -246
  95. package/dist/components/p-BWRCeMvO.js +1 -0
  96. package/dist/components/p-CYF5GU_q.js +1 -0
  97. package/dist/components/p-DXUoPIwl.js +10 -0
  98. package/dist/components/p-D_Ll4QNj.js +1 -0
  99. package/dist/components/p-DhIoW7H3.js +1 -0
  100. package/dist/components/responsive-component.js +168 -0
  101. package/dist/components/{p-e5dc4ea4.js → swiper.js} +268 -235
  102. package/dist/components/utils.js +4969 -0
  103. package/dist/{esm/utils-1c9f0ec1.js → components/utils2.js} +51 -50
  104. package/dist/content-blocks/content-accordion.entry.js +85 -0
  105. package/dist/content-blocks/content-blocks.esm.js +47 -2
  106. package/dist/content-blocks/content-button.entry.js +111 -0
  107. package/dist/content-blocks/content-carousel.entry.js +188 -0
  108. package/dist/content-blocks/content-grid-formatter.entry.js +100 -0
  109. package/dist/content-blocks/content-hero-block.entry.js +43 -0
  110. package/dist/content-blocks/content-image.entry.js +151 -0
  111. package/dist/content-blocks/content-line.entry.js +59 -0
  112. package/dist/content-blocks/content-navigation-block.entry.js +105 -0
  113. package/dist/content-blocks/content-overlay.entry.js +639 -0
  114. package/dist/content-blocks/content-spacer.entry.js +73 -0
  115. package/dist/content-blocks/content-split-block.entry.js +34 -0
  116. package/dist/content-blocks/content-tabs.entry.js +245 -0
  117. package/dist/content-blocks/content-text-block.entry.js +61 -0
  118. package/dist/content-blocks/content-tout-block.entry.js +32 -0
  119. package/dist/{esm/content-accordion_11.entry.js → content-blocks/content-video.entry.js} +14516 -12868
  120. package/dist/{components/p-a2fedf8a.js → content-blocks/focus-trap.esm-DXUoPIwl.js} +484 -190
  121. package/dist/content-blocks/global/content-blocks-reset.css +77 -0
  122. package/dist/content-blocks/index-BFDJMblF.js +4690 -0
  123. package/dist/{esm/index-f45a9c45.js → content-blocks/index-P1YnSd-O.js} +348 -246
  124. package/dist/content-blocks/index.esm.js +1 -2
  125. package/dist/content-blocks/p-008457f0.entry.js +1 -0
  126. package/dist/content-blocks/p-052692f1.entry.js +1 -0
  127. package/dist/content-blocks/p-0f71bd32.entry.js +1 -0
  128. package/dist/content-blocks/p-1f154617.entry.js +1 -0
  129. package/dist/content-blocks/p-2554ebd8.entry.js +1 -0
  130. package/dist/content-blocks/p-4afd6511.entry.js +1 -0
  131. package/dist/content-blocks/p-78d5de9f.entry.js +1 -0
  132. package/dist/content-blocks/p-7bcf7e7e.entry.js +1 -0
  133. package/dist/content-blocks/p-9058031c.entry.js +1 -0
  134. package/dist/content-blocks/p-9c41ac23.entry.js +17 -0
  135. package/dist/content-blocks/p-CLwOzPEO.js +3 -0
  136. package/dist/content-blocks/p-CYF5GU_q.js +1 -0
  137. package/dist/content-blocks/p-CjR_4mPu.js +1 -0
  138. package/dist/content-blocks/p-DQuL1Twl.js +1 -0
  139. package/dist/content-blocks/p-DXUoPIwl.js +10 -0
  140. package/dist/content-blocks/p-D_Ll4QNj.js +1 -0
  141. package/dist/content-blocks/p-DhIoW7H3.js +1 -0
  142. package/dist/content-blocks/p-DzYwy_62.js +1 -0
  143. package/dist/content-blocks/p-b2e6358a.entry.js +1 -0
  144. package/dist/content-blocks/p-c783bc68.entry.js +1 -0
  145. package/dist/content-blocks/p-e3d81e15.entry.js +1 -0
  146. package/dist/content-blocks/p-f23b4aae.entry.js +1 -0
  147. package/dist/content-blocks/p-f75c9094.entry.js +1 -0
  148. package/dist/content-blocks/responsive-component-BsLrcKbS.js +169 -0
  149. package/dist/content-blocks/sass/_mixins.scss +21 -5
  150. package/dist/content-blocks/sass/_variables.scss +15 -15
  151. package/dist/{esm/swiper-e9621adb.js → content-blocks/swiper-nBv069TB.js} +268 -235
  152. package/dist/{components/p-b85cfa86.js → content-blocks/utils--SDsQnWS.js} +51 -50
  153. package/dist/content-blocks/utils-Bak__24s.js +280 -0
  154. package/dist/docs.d.ts +480 -0
  155. package/dist/docs.json +5312 -0
  156. package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -2
  157. package/dist/esm/content-accordion.entry.js +85 -0
  158. package/dist/esm/content-blocks.js +33 -8
  159. package/dist/esm/content-button.entry.js +111 -0
  160. package/dist/esm/content-carousel.entry.js +153 -45
  161. package/dist/esm/content-grid-formatter.entry.js +100 -0
  162. package/dist/esm/content-hero-block.entry.js +43 -0
  163. package/dist/esm/content-image.entry.js +151 -0
  164. package/dist/esm/content-line.entry.js +59 -0
  165. package/dist/esm/content-navigation-block.entry.js +51 -32
  166. package/dist/esm/content-overlay.entry.js +639 -0
  167. package/dist/esm/content-spacer.entry.js +73 -0
  168. package/dist/esm/content-split-block.entry.js +22 -17
  169. package/dist/esm/content-tabs.entry.js +38 -19
  170. package/dist/esm/content-text-block.entry.js +61 -0
  171. package/dist/esm/content-tout-block.entry.js +32 -0
  172. package/dist/esm/content-video.entry.js +72033 -0
  173. package/dist/esm/focus-trap.esm-DXUoPIwl.js +1801 -0
  174. package/dist/esm/index-BASCLGuP.js +1713 -0
  175. package/dist/esm/index-BFDJMblF.js +4690 -0
  176. package/dist/esm/index-CLwOzPEO.js +2161 -0
  177. package/dist/esm/index-CjR_4mPu.js +280 -0
  178. package/dist/esm/index-P1YnSd-O.js +5397 -0
  179. package/dist/esm/index.js +1 -3
  180. package/dist/esm/loader.js +3 -6
  181. package/dist/esm/responsive-component-BsLrcKbS.js +169 -0
  182. package/dist/esm/responsive-component-D7dJHMp0.js +169 -0
  183. package/dist/esm/swiper-CtypHPwF.js +3928 -0
  184. package/dist/esm/swiper-nBv069TB.js +3941 -0
  185. package/dist/esm/utils--SDsQnWS.js +460 -0
  186. package/dist/esm/utils-Bak__24s.js +280 -0
  187. package/dist/esm/utils-CYF5GU_q.js +438 -0
  188. package/dist/node_modules/video.js/dist/video-js.min.css +1 -0
  189. package/dist/test/axe.js +60 -0
  190. package/dist/types/Users/shahrukceo/Developer/content-blocks/packages/js/.stencil/test/axe.d.ts +16 -0
  191. package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +7 -11
  192. package/dist/types/blocks/content-split-block/content-split-block.d.ts +5 -9
  193. package/dist/types/blocks/content-text-block/content-text-block.d.ts +4 -9
  194. package/dist/types/blocks/content-tout-block/content-tout-block.d.ts +5 -10
  195. package/dist/types/components/content-accordion/content-accordion.d.ts +4 -3
  196. package/dist/types/components/content-accordion/libraries/w3_disclosure_button.d.ts +0 -1
  197. package/dist/types/components/content-carousel/content-carousel.d.ts +44 -7
  198. package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +14 -8
  199. package/dist/types/components/content-overlay/content-overlay.d.ts +15 -16
  200. package/dist/types/components/content-overlay/libraries/aria-dialog.d.ts +0 -1
  201. package/dist/types/components/content-overlay/libraries/aria-utilities.d.ts +0 -1
  202. package/dist/types/components/content-tabs/content-tabs.d.ts +4 -10
  203. package/dist/types/components/content-tabs/libraries/w3_tabs.d.ts +0 -1
  204. package/dist/types/components.d.ts +892 -198
  205. package/dist/types/elements/content-button/content-button.d.ts +8 -13
  206. package/dist/types/elements/content-image/content-image.d.ts +15 -9
  207. package/dist/types/elements/content-line/content-line.d.ts +5 -12
  208. package/dist/types/elements/content-video/content-video.d.ts +6 -11
  209. package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +14 -9
  210. package/dist/types/formatters/content-spacer/content-spacer.d.ts +4 -36
  211. package/dist/types/index.d.ts +3 -1
  212. package/dist/types/setupFiles.d.ts +0 -1
  213. package/dist/types/stencil-public-runtime.d.ts +265 -60
  214. package/dist/types/typings.d.ts +10 -0
  215. package/dist/types/utils/breakpoints.d.ts +57 -0
  216. package/dist/types/utils/responsive-component.d.ts +49 -0
  217. package/dist/types/utils/utils.d.ts +11 -8
  218. package/loader/cdn.js +1 -0
  219. package/loader/index.cjs.js +1 -0
  220. package/loader/index.d.ts +24 -0
  221. package/loader/index.es2017.js +1 -0
  222. package/loader/index.js +2 -0
  223. package/package.json +74 -64
  224. package/dist/cjs/BehaviorSubject-12116537.js +0 -655
  225. package/dist/cjs/BehaviorSubject-12116537.js.map +0 -1
  226. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  227. package/dist/cjs/content-accordion_11.cjs.entry.js.map +0 -1
  228. package/dist/cjs/content-blocks.cjs.js.map +0 -1
  229. package/dist/cjs/content-carousel.cjs.entry.js.map +0 -1
  230. package/dist/cjs/content-navigation-block.cjs.entry.js.map +0 -1
  231. package/dist/cjs/content-split-block.cjs.entry.js.map +0 -1
  232. package/dist/cjs/content-tabs.cjs.entry.js.map +0 -1
  233. package/dist/cjs/focus-trap.esm-7bc384a0.js.map +0 -1
  234. package/dist/cjs/index-2e0ce692.js.map +0 -1
  235. package/dist/cjs/index-8af2820a.js +0 -1650
  236. package/dist/cjs/index-8af2820a.js.map +0 -1
  237. package/dist/cjs/index.cjs.js.map +0 -1
  238. package/dist/cjs/loader.cjs.js.map +0 -1
  239. package/dist/cjs/swiper-8221f4e8.js.map +0 -1
  240. package/dist/cjs/utils-df044337.js.map +0 -1
  241. package/dist/cjs/utils-f8ccab0a.js +0 -126
  242. package/dist/cjs/utils-f8ccab0a.js.map +0 -1
  243. package/dist/cjs/window-resize-service-65a5a370.js +0 -37
  244. package/dist/cjs/window-resize-service-65a5a370.js.map +0 -1
  245. package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +0 -1
  246. package/dist/collection/blocks/content-split-block/content-split-block.js.map +0 -1
  247. package/dist/collection/blocks/content-text-block/content-text-block.js.map +0 -1
  248. package/dist/collection/blocks/content-tout-block/content-tout-block.js.map +0 -1
  249. package/dist/collection/components/content-accordion/content-accordion.js.map +0 -1
  250. package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js.map +0 -1
  251. package/dist/collection/components/content-carousel/content-carousel.js.map +0 -1
  252. package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +0 -1
  253. package/dist/collection/components/content-overlay/content-overlay.js.map +0 -1
  254. package/dist/collection/components/content-overlay/libraries/aria-dialog.js.map +0 -1
  255. package/dist/collection/components/content-overlay/libraries/aria-utilities.js.map +0 -1
  256. package/dist/collection/components/content-tabs/content-tabs.js.map +0 -1
  257. package/dist/collection/components/content-tabs/libraries/w3_tabs.js.map +0 -1
  258. package/dist/collection/elements/content-button/content-button.js.map +0 -1
  259. package/dist/collection/elements/content-image/content-image.js.map +0 -1
  260. package/dist/collection/elements/content-line/content-line.js.map +0 -1
  261. package/dist/collection/elements/content-video/content-video.js.map +0 -1
  262. package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +0 -1
  263. package/dist/collection/formatters/content-spacer/content-spacer.js.map +0 -1
  264. package/dist/collection/globalScript.js +0 -15
  265. package/dist/collection/globalScript.js.map +0 -1
  266. package/dist/collection/index.js.map +0 -1
  267. package/dist/collection/services/content-events-service.js +0 -23
  268. package/dist/collection/services/content-events-service.js.map +0 -1
  269. package/dist/collection/services/window-resize-service.js +0 -31
  270. package/dist/collection/services/window-resize-service.js.map +0 -1
  271. package/dist/collection/setupFiles.js.map +0 -1
  272. package/dist/collection/stories/ContentHeroBlock.stories.js +0 -51
  273. package/dist/collection/stories/ContentHeroBlock.stories.js.map +0 -1
  274. package/dist/collection/stories/ContentNavigationBlock.stories.js +0 -33
  275. package/dist/collection/stories/ContentNavigationBlock.stories.js.map +0 -1
  276. package/dist/collection/stories/ContentSpacer.stories.js +0 -20
  277. package/dist/collection/stories/ContentSpacer.stories.js.map +0 -1
  278. package/dist/collection/stories/ContentTextBlock.stories.js +0 -17
  279. package/dist/collection/stories/ContentTextBlock.stories.js.map +0 -1
  280. package/dist/collection/stories/ContentToutBlock.stories.js +0 -17
  281. package/dist/collection/stories/ContentToutBlock.stories.js.map +0 -1
  282. package/dist/collection/stories/FullPageExample.stories.js +0 -432
  283. package/dist/collection/stories/FullPageExample.stories.js.map +0 -1
  284. package/dist/collection/stories/assets/accessibility.svg +0 -5
  285. package/dist/collection/stories/assets/discord.svg +0 -15
  286. package/dist/collection/stories/assets/github.svg +0 -3
  287. package/dist/collection/stories/assets/tutorials.svg +0 -12
  288. package/dist/collection/stories/assets/youtube.svg +0 -4
  289. package/dist/collection/utils/utils.js.map +0 -1
  290. package/dist/components/content-accordion.js.map +0 -1
  291. package/dist/components/content-button.js.map +0 -1
  292. package/dist/components/content-carousel.js.map +0 -1
  293. package/dist/components/content-grid-formatter.js.map +0 -1
  294. package/dist/components/content-hero-block.js.map +0 -1
  295. package/dist/components/content-image.js.map +0 -1
  296. package/dist/components/content-line.js.map +0 -1
  297. package/dist/components/content-navigation-block.js.map +0 -1
  298. package/dist/components/content-overlay.js.map +0 -1
  299. package/dist/components/content-spacer.js.map +0 -1
  300. package/dist/components/content-split-block.js.map +0 -1
  301. package/dist/components/content-tabs.js.map +0 -1
  302. package/dist/components/content-text-block.js.map +0 -1
  303. package/dist/components/content-tout-block.js.map +0 -1
  304. package/dist/components/content-video.js.map +0 -1
  305. package/dist/components/index.js.map +0 -1
  306. package/dist/components/p-26483b46.js +0 -35
  307. package/dist/components/p-26483b46.js.map +0 -1
  308. package/dist/components/p-5a91aa1b.js.map +0 -1
  309. package/dist/components/p-74be971f.js +0 -652
  310. package/dist/components/p-74be971f.js.map +0 -1
  311. package/dist/components/p-7a436263.js +0 -122
  312. package/dist/components/p-7a436263.js.map +0 -1
  313. package/dist/components/p-a2fedf8a.js.map +0 -1
  314. package/dist/components/p-b85cfa86.js.map +0 -1
  315. package/dist/components/p-e28db040.js +0 -1452
  316. package/dist/components/p-e28db040.js.map +0 -1
  317. package/dist/components/p-e5dc4ea4.js.map +0 -1
  318. package/dist/components/p-e9bce2ab.js +0 -88
  319. package/dist/components/p-e9bce2ab.js.map +0 -1
  320. package/dist/content-blocks/content-blocks.esm.js.map +0 -1
  321. package/dist/content-blocks/index.esm.js.map +0 -1
  322. package/dist/content-blocks/p-13c3cc4f.js +0 -3
  323. package/dist/content-blocks/p-13c3cc4f.js.map +0 -1
  324. package/dist/content-blocks/p-398760b3.entry.js +0 -26
  325. package/dist/content-blocks/p-398760b3.entry.js.map +0 -1
  326. package/dist/content-blocks/p-5422c25b.entry.js +0 -2
  327. package/dist/content-blocks/p-5422c25b.entry.js.map +0 -1
  328. package/dist/content-blocks/p-5a91aa1b.js +0 -2
  329. package/dist/content-blocks/p-5a91aa1b.js.map +0 -1
  330. package/dist/content-blocks/p-650d1757.js +0 -2
  331. package/dist/content-blocks/p-650d1757.js.map +0 -1
  332. package/dist/content-blocks/p-74be971f.js +0 -2
  333. package/dist/content-blocks/p-74be971f.js.map +0 -1
  334. package/dist/content-blocks/p-a2fedf8a.js +0 -10
  335. package/dist/content-blocks/p-a2fedf8a.js.map +0 -1
  336. package/dist/content-blocks/p-b305392e.entry.js +0 -2
  337. package/dist/content-blocks/p-b305392e.entry.js.map +0 -1
  338. package/dist/content-blocks/p-b85cfa86.js +0 -2
  339. package/dist/content-blocks/p-b85cfa86.js.map +0 -1
  340. package/dist/content-blocks/p-cc7397cf.js +0 -2
  341. package/dist/content-blocks/p-cc7397cf.js.map +0 -1
  342. package/dist/content-blocks/p-d62775d7.entry.js +0 -2
  343. package/dist/content-blocks/p-d62775d7.entry.js.map +0 -1
  344. package/dist/content-blocks/p-e1255160.js +0 -2
  345. package/dist/content-blocks/p-e1255160.js.map +0 -1
  346. package/dist/content-blocks/p-e5dc4ea4.js +0 -2
  347. package/dist/content-blocks/p-e5dc4ea4.js.map +0 -1
  348. package/dist/content-blocks/p-f73f934a.entry.js +0 -2
  349. package/dist/content-blocks/p-f73f934a.entry.js.map +0 -1
  350. package/dist/esm/BehaviorSubject-f7a12fd8.js +0 -652
  351. package/dist/esm/BehaviorSubject-f7a12fd8.js.map +0 -1
  352. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  353. package/dist/esm/content-accordion_11.entry.js.map +0 -1
  354. package/dist/esm/content-blocks.js.map +0 -1
  355. package/dist/esm/content-carousel.entry.js.map +0 -1
  356. package/dist/esm/content-navigation-block.entry.js.map +0 -1
  357. package/dist/esm/content-split-block.entry.js.map +0 -1
  358. package/dist/esm/content-tabs.entry.js.map +0 -1
  359. package/dist/esm/focus-trap.esm-8fb54175.js.map +0 -1
  360. package/dist/esm/index-ec24af7a.js +0 -1621
  361. package/dist/esm/index-ec24af7a.js.map +0 -1
  362. package/dist/esm/index-f45a9c45.js.map +0 -1
  363. package/dist/esm/index.js.map +0 -1
  364. package/dist/esm/loader.js.map +0 -1
  365. package/dist/esm/swiper-e9621adb.js.map +0 -1
  366. package/dist/esm/utils-1c9f0ec1.js.map +0 -1
  367. package/dist/esm/utils-9a901aa9.js +0 -122
  368. package/dist/esm/utils-9a901aa9.js.map +0 -1
  369. package/dist/esm/window-resize-service-354f2ac5.js +0 -35
  370. package/dist/esm/window-resize-service-354f2ac5.js.map +0 -1
  371. package/dist/types/globalScript.d.ts +0 -1
  372. package/dist/types/old-components.d.ts +0 -1239
  373. package/dist/types/services/content-events-service.d.ts +0 -11
  374. package/dist/types/services/window-resize-service.d.ts +0 -11
  375. package/dist/types/stories/ContentHeroBlock.stories.d.ts +0 -11
  376. package/dist/types/stories/ContentNavigationBlock.stories.d.ts +0 -9
  377. package/dist/types/stories/ContentSpacer.stories.d.ts +0 -15
  378. package/dist/types/stories/ContentTextBlock.stories.d.ts +0 -9
  379. package/dist/types/stories/ContentToutBlock.stories.d.ts +0 -9
  380. package/dist/types/stories/FullPageExample.stories.d.ts +0 -10
@@ -1,51 +1,46 @@
1
1
  'use strict';
2
2
 
3
3
  /*!
4
- * tabbable 6.2.0
4
+ * tabbable 6.5.1
5
5
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
6
6
  */
7
7
  // NOTE: separate `:not()` selectors has broader browser support than the newer
8
8
  // `:not([inert], [inert] *)` (Feb 2023)
9
- // CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
10
- // the entire query to fail, resulting in no nodes found, which will break a lot
11
- // of things... so we have to rely on JS to identify nodes inside an inert container
12
- 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])'];
9
+ var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'area[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
13
10
  var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
14
11
  var NoElement = typeof Element === 'undefined';
15
12
  var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
16
13
  var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
17
- var _element$getRootNode;
18
- return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
14
+ return element == null || element.getRootNode == null ? void 0 : element.getRootNode();
19
15
  } : function (element) {
20
- return element === null || element === void 0 ? void 0 : element.ownerDocument;
16
+ return element == null ? void 0 : element.ownerDocument;
21
17
  };
22
18
 
23
19
  /**
24
20
  * Determines if a node is inert or in an inert ancestor.
25
- * @param {Element} [node]
21
+ * @param {Node} [node]
26
22
  * @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
27
23
  * see if any of them are inert. If false, only `node` itself is considered.
28
24
  * @returns {boolean} True if inert itself or by way of being in an inert ancestor.
29
25
  * False if `node` is falsy.
30
26
  */
31
- var isInert = function isInert(node, lookUp) {
32
- var _node$getAttribute;
27
+ var _isInert = function isInert(node, lookUp) {
33
28
  if (lookUp === void 0) {
34
29
  lookUp = true;
35
30
  }
36
31
  // CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
37
32
  // JS API property; we have to check the attribute, which can either be empty or 'true';
38
33
  // if it's `null` (not specified) or 'false', it's an active element
39
- 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');
34
+ var inertAtt = node == null || node.getAttribute == null ? void 0 : node.getAttribute('inert');
40
35
  var inert = inertAtt === '' || inertAtt === 'true';
41
36
 
42
37
  // NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
43
38
  // if it weren't for `matches()` not being a function on shadow roots; the following
44
39
  // code works for any kind of node
45
- // CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
46
- // so it likely would not support `:is([inert] *)` either...
47
- var result = inert || lookUp && node && isInert(node.parentNode); // recursive
48
-
40
+ var result = inert || lookUp && node && (
41
+ // closest does not exist on shadow roots, so we fall back to a manual
42
+ // lookup upward, in case it is not defined.
43
+ typeof node.closest === 'function' ? node.closest('[inert]') : _isInert(node.parentNode));
49
44
  return result;
50
45
  };
51
46
 
@@ -55,12 +50,12 @@ var isInert = function isInert(node, lookUp) {
55
50
  * @returns True if it's content-editable; false if it's not or `node` is falsy.
56
51
  */
57
52
  var isContentEditable = function isContentEditable(node) {
58
- var _node$getAttribute2;
53
+ var _node$getAttribute;
59
54
  // CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
60
- // to use the attribute directly to check for this, which can either be empty or 'true';
61
- // if it's `null` (not specified) or 'false', it's a non-editable element
62
- 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');
63
- return attValue === '' || attValue === 'true';
55
+ // to use the case-insensitive attribute directly: empty, 'true', and 'plaintext-only'
56
+ // are editable states; `null` (not specified) and 'false' are not.
57
+ var attValue = node == null || node.getAttribute == null || (_node$getAttribute = node.getAttribute('contenteditable')) == null ? void 0 : _node$getAttribute.toLowerCase();
58
+ return attValue === '' || attValue === 'true' || attValue === 'plaintext-only';
64
59
  };
65
60
 
66
61
  /**
@@ -71,8 +66,8 @@ var isContentEditable = function isContentEditable(node) {
71
66
  */
72
67
  var getCandidates = function getCandidates(el, includeContainer, filter) {
73
68
  // even if `includeContainer=false`, we still have to check it for inertness because
74
- // if it's inert, all its children are inert
75
- if (isInert(el)) {
69
+ // if it's inert (either by itself or via its parent), then all its children are inert
70
+ if (_isInert(el)) {
76
71
  return [];
77
72
  }
78
73
  var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
@@ -117,12 +112,12 @@ var getCandidates = function getCandidates(el, includeContainer, filter) {
117
112
  * @param {IterativeOptions} options
118
113
  * @returns {Array.<Element|CandidateScope>}
119
114
  */
120
- var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
115
+ var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
121
116
  var candidates = [];
122
117
  var elementsToCheck = Array.from(elements);
123
118
  while (elementsToCheck.length) {
124
119
  var element = elementsToCheck.shift();
125
- if (isInert(element, false)) {
120
+ if (_isInert(element, false)) {
126
121
  // no need to look up since we're drilling down
127
122
  // anything inside this container will also be inert
128
123
  continue;
@@ -131,7 +126,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
131
126
  // add shadow dom slot scope (slot itself cannot be focusable)
132
127
  var assigned = element.assignedElements();
133
128
  var content = assigned.length ? assigned : element.children;
134
- var nestedCandidates = getCandidatesIteratively(content, true, options);
129
+ var nestedCandidates = _getCandidatesIteratively(content, true, options);
135
130
  if (options.flatten) {
136
131
  candidates.push.apply(candidates, nestedCandidates);
137
132
  } else {
@@ -155,7 +150,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
155
150
  // no inert look up because we're already drilling down and checking for inertness
156
151
  // on the way down, so all containers to this root node should have already been
157
152
  // vetted as non-inert
158
- var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
153
+ var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
159
154
  if (shadowRoot && validShadowRoot) {
160
155
  // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
161
156
  // shadow exists, so look at light dom children as fallback BUT create a scope for any
@@ -163,7 +158,7 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
163
158
  // children of the web component element (which has the shadow), in the light dom, but
164
159
  // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
165
160
  // _after_ we return from this recursive call
166
- var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
161
+ var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
167
162
  if (options.flatten) {
168
163
  candidates.push.apply(candidates, _nestedCandidates);
169
164
  } else {
@@ -311,22 +306,22 @@ var isNodeAttached = function isNodeAttached(node) {
311
306
  // from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
312
307
  // `ownerDocument` will be `null`, hence the optional chaining on it.
313
308
  var nodeRoot = node && getRootNode(node);
314
- var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
309
+ var nodeRootHost = (_nodeRoot = nodeRoot) == null ? void 0 : _nodeRoot.host;
315
310
 
316
311
  // in some cases, a detached node will return itself as the root instead of a document or
317
312
  // shadow root object, in which case, we shouldn't try to look further up the host chain
318
313
  var attached = false;
319
314
  if (nodeRoot && nodeRoot !== node) {
320
- var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
321
- 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));
315
+ var _nodeRootHost, _node$ownerDocument;
316
+ attached = !!((_nodeRootHost = nodeRootHost) != null && (_nodeRootHost = _nodeRootHost.ownerDocument) != null && _nodeRootHost.contains(nodeRootHost) || node != null && (_node$ownerDocument = node.ownerDocument) != null && _node$ownerDocument.contains(node));
322
317
  while (!attached && nodeRootHost) {
323
- var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
318
+ var _nodeRoot2, _nodeRootHost2;
324
319
  // since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
325
320
  // which means we need to get the host's host and check if that parent host is contained
326
321
  // in (i.e. attached to) the document
327
322
  nodeRoot = getRootNode(nodeRootHost);
328
- nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
329
- attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
323
+ nodeRootHost = (_nodeRoot2 = nodeRoot) == null ? void 0 : _nodeRoot2.host;
324
+ attached = !!((_nodeRootHost2 = nodeRootHost) != null && (_nodeRootHost2 = _nodeRootHost2.ownerDocument) != null && _nodeRootHost2.contains(nodeRootHost));
330
325
  }
331
326
  }
332
327
  return attached;
@@ -340,12 +335,36 @@ var isZeroArea = function isZeroArea(node) {
340
335
  var isHidden = function isHidden(node, _ref) {
341
336
  var displayCheck = _ref.displayCheck,
342
337
  getShadowRoot = _ref.getShadowRoot;
338
+ if (displayCheck === 'full-native') {
339
+ if ('checkVisibility' in node) {
340
+ // Chrome >= 105, Edge >= 105, Firefox >= 106, Safari >= 17.4
341
+ // @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility#browser_compatibility
342
+ var visible = node.checkVisibility({
343
+ // Checking opacity might be desirable for some use cases, but natively,
344
+ // opacity zero elements _are_ focusable and tabbable.
345
+ checkOpacity: false,
346
+ opacityProperty: false,
347
+ contentVisibilityAuto: true,
348
+ visibilityProperty: true,
349
+ // This is an alias for `visibilityProperty`. Contemporary browsers
350
+ // support both. However, this alias has wider browser support (Chrome
351
+ // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
352
+ // we include it anyway.
353
+ checkVisibilityCSS: true
354
+ });
355
+ return !visible;
356
+ }
357
+ // Fall through to manual visibility checks
358
+ }
359
+
343
360
  // NOTE: visibility will be `undefined` if node is detached from the document
344
361
  // (see notes about this further down), which means we will consider it visible
345
362
  // (this is legacy behavior from a very long way back)
346
363
  // NOTE: we check this regardless of `displayCheck="none"` because this is a
347
364
  // _visibility_ check, not a _display_ check
348
- if (getComputedStyle(node).visibility === 'hidden') {
365
+ var _getComputedStyle = getComputedStyle(node),
366
+ visibility = _getComputedStyle.visibility;
367
+ if (visibility === 'hidden' || visibility === 'collapse') {
349
368
  return true;
350
369
  }
351
370
  var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
@@ -353,7 +372,10 @@ var isHidden = function isHidden(node, _ref) {
353
372
  if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
354
373
  return true;
355
374
  }
356
- if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
375
+ if (!displayCheck || displayCheck === 'full' ||
376
+ // full-native can run this branch when it falls through in case
377
+ // Element#checkVisibility is unsupported
378
+ displayCheck === 'full-native' || displayCheck === 'legacy-full') {
357
379
  if (typeof getShadowRoot === 'function') {
358
380
  // figure out if we should consider the node to be in an undisclosed shadow and use the
359
381
  // 'non-zero-area' fallback
@@ -462,11 +484,7 @@ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
462
484
  return false;
463
485
  };
464
486
  var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
465
- if (node.disabled ||
466
- // we must do an inert look up to filter out any elements inside an inert ancestor
467
- // because we're limited in the type of selectors we can use in JSDom (see related
468
- // note related to `candidateSelectors`)
469
- isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
487
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) ||
470
488
  // For a details element with a summary, the summary element gets the focus
471
489
  isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
472
490
  return false;
@@ -479,7 +497,7 @@ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(opt
479
497
  }
480
498
  return true;
481
499
  };
482
- var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
500
+ var isShadowRootTabbable = function isShadowRootTabbable(shadowHostNode) {
483
501
  var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
484
502
  if (isNaN(tabIndex) || tabIndex >= 0) {
485
503
  return true;
@@ -493,14 +511,14 @@ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNod
493
511
  * @param {Array.<Element|CandidateScope>} candidates
494
512
  * @returns Element[]
495
513
  */
496
- var sortByOrder = function sortByOrder(candidates) {
514
+ var _sortByOrder = function sortByOrder(candidates) {
497
515
  var regularTabbables = [];
498
516
  var orderedTabbables = [];
499
517
  candidates.forEach(function (item, i) {
500
518
  var isScope = !!item.scopeParent;
501
519
  var element = isScope ? item.scopeParent : item;
502
520
  var candidateTabindex = getSortOrderTabIndex(element, isScope);
503
- var elements = isScope ? sortByOrder(item.candidates) : element;
521
+ var elements = isScope ? _sortByOrder(item.candidates) : element;
504
522
  if (candidateTabindex === 0) {
505
523
  isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
506
524
  } else {
@@ -522,22 +540,22 @@ var tabbable = function tabbable(container, options) {
522
540
  options = options || {};
523
541
  var candidates;
524
542
  if (options.getShadowRoot) {
525
- candidates = getCandidatesIteratively([container], options.includeContainer, {
543
+ candidates = _getCandidatesIteratively([container], options.includeContainer, {
526
544
  filter: isNodeMatchingSelectorTabbable.bind(null, options),
527
545
  flatten: false,
528
546
  getShadowRoot: options.getShadowRoot,
529
- shadowRootFilter: isValidShadowRootTabbable
547
+ shadowRootFilter: isShadowRootTabbable
530
548
  });
531
549
  } else {
532
550
  candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
533
551
  }
534
- return sortByOrder(candidates);
552
+ return _sortByOrder(candidates);
535
553
  };
536
554
  var focusable = function focusable(container, options) {
537
555
  options = options || {};
538
556
  var candidates;
539
557
  if (options.getShadowRoot) {
540
- candidates = getCandidatesIteratively([container], options.includeContainer, {
558
+ candidates = _getCandidatesIteratively([container], options.includeContainer, {
541
559
  filter: isNodeMatchingSelectorFocusable.bind(null, options),
542
560
  flatten: true,
543
561
  getShadowRoot: options.getShadowRoot
@@ -557,7 +575,7 @@ var isTabbable = function isTabbable(node, options) {
557
575
  }
558
576
  return isNodeMatchingSelectorTabbable(options, node);
559
577
  };
560
- var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
578
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert]):not([inert] *)').join(',');
561
579
  var isFocusable = function isFocusable(node, options) {
562
580
  options = options || {};
563
581
  if (!node) {
@@ -570,10 +588,80 @@ var isFocusable = function isFocusable(node, options) {
570
588
  };
571
589
 
572
590
  /*!
573
- * focus-trap 7.5.4
591
+ * focus-trap 7.8.0
574
592
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
575
593
  */
576
594
 
595
+ function _arrayLikeToArray(r, a) {
596
+ (null == a || a > r.length) && (a = r.length);
597
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
598
+ return n;
599
+ }
600
+ function _arrayWithoutHoles(r) {
601
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
602
+ }
603
+ function _createForOfIteratorHelper(r, e) {
604
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
605
+ if (!t) {
606
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
607
+ t && (r = t);
608
+ var n = 0,
609
+ F = function () {};
610
+ return {
611
+ s: F,
612
+ n: function () {
613
+ return n >= r.length ? {
614
+ done: true
615
+ } : {
616
+ done: false,
617
+ value: r[n++]
618
+ };
619
+ },
620
+ e: function (r) {
621
+ throw r;
622
+ },
623
+ f: F
624
+ };
625
+ }
626
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
627
+ }
628
+ var o,
629
+ a = true,
630
+ u = false;
631
+ return {
632
+ s: function () {
633
+ t = t.call(r);
634
+ },
635
+ n: function () {
636
+ var r = t.next();
637
+ return a = r.done, r;
638
+ },
639
+ e: function (r) {
640
+ u = true, o = r;
641
+ },
642
+ f: function () {
643
+ try {
644
+ a || null == t.return || t.return();
645
+ } finally {
646
+ if (u) throw o;
647
+ }
648
+ }
649
+ };
650
+ }
651
+ function _defineProperty(e, r, t) {
652
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
653
+ value: t,
654
+ enumerable: true,
655
+ configurable: true,
656
+ writable: true
657
+ }) : e[r] = t, e;
658
+ }
659
+ function _iterableToArray(r) {
660
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
661
+ }
662
+ function _nonIterableSpread() {
663
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
664
+ }
577
665
  function ownKeys(e, r) {
578
666
  var t = Object.keys(e);
579
667
  if (Object.getOwnPropertySymbols) {
@@ -587,7 +675,7 @@ function ownKeys(e, r) {
587
675
  function _objectSpread2(e) {
588
676
  for (var r = 1; r < arguments.length; r++) {
589
677
  var t = null != arguments[r] ? arguments[r] : {};
590
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
678
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
591
679
  _defineProperty(e, r, t[r]);
592
680
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
593
681
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
@@ -595,42 +683,44 @@ function _objectSpread2(e) {
595
683
  }
596
684
  return e;
597
685
  }
598
- function _defineProperty(obj, key, value) {
599
- key = _toPropertyKey(key);
600
- if (key in obj) {
601
- Object.defineProperty(obj, key, {
602
- value: value,
603
- enumerable: true,
604
- configurable: true,
605
- writable: true
606
- });
607
- } else {
608
- obj[key] = value;
609
- }
610
- return obj;
686
+ function _toConsumableArray(r) {
687
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
611
688
  }
612
- function _toPrimitive(input, hint) {
613
- if (typeof input !== "object" || input === null) return input;
614
- var prim = input[Symbol.toPrimitive];
615
- if (prim !== undefined) {
616
- var res = prim.call(input, hint || "default");
617
- if (typeof res !== "object") return res;
689
+ function _toPrimitive(t, r) {
690
+ if ("object" != typeof t || !t) return t;
691
+ var e = t[Symbol.toPrimitive];
692
+ if (void 0 !== e) {
693
+ var i = e.call(t, r);
694
+ if ("object" != typeof i) return i;
618
695
  throw new TypeError("@@toPrimitive must return a primitive value.");
619
696
  }
620
- return (hint === "string" ? String : Number)(input);
697
+ return ("string" === r ? String : Number)(t);
621
698
  }
622
- function _toPropertyKey(arg) {
623
- var key = _toPrimitive(arg, "string");
624
- return typeof key === "symbol" ? key : String(key);
699
+ function _toPropertyKey(t) {
700
+ var i = _toPrimitive(t, "string");
701
+ return "symbol" == typeof i ? i : i + "";
702
+ }
703
+ function _unsupportedIterableToArray(r, a) {
704
+ if (r) {
705
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
706
+ var t = {}.toString.call(r).slice(8, -1);
707
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
708
+ }
625
709
  }
626
710
 
627
711
  var activeFocusTraps = {
712
+ // Returns the trap from the top of the stack.
713
+ getActiveTrap: function getActiveTrap(trapStack) {
714
+ if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) {
715
+ return trapStack[trapStack.length - 1];
716
+ }
717
+ return null;
718
+ },
719
+ // Pauses the currently active trap, then adds a new trap to the stack.
628
720
  activateTrap: function activateTrap(trapStack, trap) {
629
- if (trapStack.length > 0) {
630
- var activeTrap = trapStack[trapStack.length - 1];
631
- if (activeTrap !== trap) {
632
- activeTrap.pause();
633
- }
721
+ var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
722
+ if (trap !== activeTrap) {
723
+ activeFocusTraps.pauseTrap(trapStack);
634
724
  }
635
725
  var trapIndex = trapStack.indexOf(trap);
636
726
  if (trapIndex === -1) {
@@ -641,13 +731,24 @@ var activeFocusTraps = {
641
731
  trapStack.push(trap);
642
732
  }
643
733
  },
734
+ // Removes the trap from the top of the stack, then unpauses the next trap down.
644
735
  deactivateTrap: function deactivateTrap(trapStack, trap) {
645
736
  var trapIndex = trapStack.indexOf(trap);
646
737
  if (trapIndex !== -1) {
647
738
  trapStack.splice(trapIndex, 1);
648
739
  }
649
- if (trapStack.length > 0) {
650
- trapStack[trapStack.length - 1].unpause();
740
+ activeFocusTraps.unpauseTrap(trapStack);
741
+ },
742
+ // Pauses the trap at the top of the stack.
743
+ pauseTrap: function pauseTrap(trapStack) {
744
+ var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
745
+ activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true);
746
+ },
747
+ // Unpauses the trap at the top of the stack.
748
+ unpauseTrap: function unpauseTrap(trapStack) {
749
+ var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
750
+ if (activeTrap && !activeTrap._isManuallyPaused()) {
751
+ activeTrap._setPausedState(false);
651
752
  }
652
753
  }
653
754
  };
@@ -674,22 +775,6 @@ var delay = function delay(fn) {
674
775
  return setTimeout(fn, 0);
675
776
  };
676
777
 
677
- // Array.find/findIndex() are not supported on IE; this replicates enough
678
- // of Array.findIndex() for our needs
679
- var findIndex = function findIndex(arr, fn) {
680
- var idx = -1;
681
- arr.every(function (value, i) {
682
- if (fn(value)) {
683
- idx = i;
684
- return false; // break
685
- }
686
-
687
- return true; // next
688
- });
689
-
690
- return idx;
691
- };
692
-
693
778
  /**
694
779
  * Get an option's value when it could be a plain value, or a handler that provides
695
780
  * the value.
@@ -726,29 +811,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
726
811
  returnFocusOnDeactivate: true,
727
812
  escapeDeactivates: true,
728
813
  delayInitialFocus: true,
814
+ isolateSubtrees: false,
729
815
  isKeyForward: isKeyForward,
730
816
  isKeyBackward: isKeyBackward
731
817
  }, userOptions);
732
818
  var state = {
733
819
  // containers given to createFocusTrap()
734
- // @type {Array<HTMLElement>}
820
+ /** @type {Array<HTMLElement>} */
735
821
  containers: [],
736
822
  // list of objects identifying tabbable nodes in `containers` in the trap
737
823
  // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
738
824
  // is active, but the trap should never get to a state where there isn't at least one group
739
825
  // with at least one tabbable node in it (that would lead to an error condition that would
740
826
  // result in an error being thrown)
741
- // @type {Array<{
742
- // container: HTMLElement,
743
- // tabbableNodes: Array<HTMLElement>, // empty if none
744
- // focusableNodes: Array<HTMLElement>, // empty if none
745
- // posTabIndexesFound: boolean,
746
- // firstTabbableNode: HTMLElement|undefined,
747
- // lastTabbableNode: HTMLElement|undefined,
748
- // firstDomTabbableNode: HTMLElement|undefined,
749
- // lastDomTabbableNode: HTMLElement|undefined,
750
- // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
751
- // }>}
827
+ /** @type {Array<{
828
+ * container: HTMLElement,
829
+ * tabbableNodes: Array<HTMLElement>, // empty if none
830
+ * focusableNodes: Array<HTMLElement>, // empty if none
831
+ * posTabIndexesFound: boolean,
832
+ * firstTabbableNode: HTMLElement|undefined,
833
+ * lastTabbableNode: HTMLElement|undefined,
834
+ * firstDomTabbableNode: HTMLElement|undefined,
835
+ * lastDomTabbableNode: HTMLElement|undefined,
836
+ * nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
837
+ * }>}
838
+ */
752
839
  containerGroups: [],
753
840
  // same order/length as `containers` list
754
841
 
@@ -757,10 +844,17 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
757
844
  // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
758
845
  // the same length
759
846
  tabbableGroups: [],
847
+ // references to nodes that are siblings to the ancestors of this trap's containers.
848
+ /** @type {Set<HTMLElement>} */
849
+ adjacentElements: new Set(),
850
+ // references to nodes that were inert or aria-hidden before the trap was activated.
851
+ /** @type {Set<HTMLElement>} */
852
+ alreadySilent: new Set(),
760
853
  nodeFocusedBeforeActivation: null,
761
854
  mostRecentlyFocusedNode: null,
762
855
  active: false,
763
856
  paused: false,
857
+ manuallyPaused: false,
764
858
  // timer ID for when delayInitialFocus is true and initial focus in this trap
765
859
  // has been delayed during activation
766
860
  delayInitialFocusTimer: undefined,
@@ -799,7 +893,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
799
893
  return state.containerGroups.findIndex(function (_ref) {
800
894
  var container = _ref.container,
801
895
  tabbableNodes = _ref.tabbableNodes;
802
- return container.contains(element) || ( // fall back to explicit tabbable search which will take into consideration any
896
+ return container.contains(element) || (// fall back to explicit tabbable search which will take into consideration any
803
897
  // web components if the `tabbableOptions.getShadowRoot` option was used for
804
898
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
805
899
  // look inside web components even if open)
@@ -815,25 +909,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
815
909
  * (if a node is explicitly NOT given), or a function that returns any of these
816
910
  * values.
817
911
  * @param {string} optionName
818
- * @returns {undefined | false | HTMLElement | SVGElement} Returns
819
- * `undefined` if the option is not specified; `false` if the option
820
- * resolved to `false` (node explicitly not given); otherwise, the resolved
821
- * DOM node.
912
+ * @param {Object} options
913
+ * @param {boolean} [options.hasFallback] True if the option could be a selector string
914
+ * and the option allows for a fallback scenario in the case where the selector is
915
+ * valid but does not match a node (i.e. the queried node doesn't exist in the DOM).
916
+ * @param {Array} [options.params] Params to pass to the option if it's a function.
917
+ * @returns {undefined | null | false | HTMLElement | SVGElement} Returns
918
+ * `undefined` if the option is not specified; `null` if the option didn't resolve
919
+ * to a node but `options.hasFallback=true`, `false` if the option resolved to `false`
920
+ * (node explicitly not given); otherwise, the resolved DOM node.
822
921
  * @throws {Error} If the option is set, not `false`, and is not, or does not
823
- * resolve to a node.
922
+ * resolve to a node, unless the option is a selector string and `options.hasFallback=true`.
824
923
  */
825
924
  var getNodeForOption = function getNodeForOption(optionName) {
925
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
926
+ _ref2$hasFallback = _ref2.hasFallback,
927
+ hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback,
928
+ _ref2$params = _ref2.params,
929
+ params = _ref2$params === void 0 ? [] : _ref2$params;
826
930
  var optionValue = config[optionName];
827
931
  if (typeof optionValue === 'function') {
828
- for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
829
- params[_key2 - 1] = arguments[_key2];
830
- }
831
- optionValue = optionValue.apply(void 0, params);
932
+ optionValue = optionValue.apply(void 0, _toConsumableArray(params));
832
933
  }
833
934
  if (optionValue === true) {
834
935
  optionValue = undefined; // use default value
835
936
  }
836
-
837
937
  if (!optionValue) {
838
938
  if (optionValue === undefined || optionValue === false) {
839
939
  return optionValue;
@@ -845,21 +945,31 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
845
945
  var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
846
946
 
847
947
  if (typeof optionValue === 'string') {
848
- node = doc.querySelector(optionValue); // resolve to node, or null if fails
948
+ try {
949
+ node = doc.querySelector(optionValue); // resolve to node, or null if fails
950
+ } catch (err) {
951
+ throw new Error("`".concat(optionName, "` appears to be an invalid selector; error=\"").concat(err.message, "\""));
952
+ }
849
953
  if (!node) {
850
- throw new Error("`".concat(optionName, "` as selector refers to no known node"));
954
+ if (!hasFallback) {
955
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
956
+ }
957
+ // else, `node` MUST be `null` because that's what `Document.querySelector()` returns
958
+ // if the selector is valid but doesn't match anything
851
959
  }
852
960
  }
853
961
  return node;
854
962
  };
855
963
  var getInitialFocusNode = function getInitialFocusNode() {
856
- var node = getNodeForOption('initialFocus');
964
+ var node = getNodeForOption('initialFocus', {
965
+ hasFallback: true
966
+ });
857
967
 
858
968
  // false explicitly indicates we want no initialFocus at all
859
969
  if (node === false) {
860
970
  return false;
861
971
  }
862
- if (node === undefined || !isFocusable(node, config.tabbableOptions)) {
972
+ if (node === undefined || node && !isFocusable(node, config.tabbableOptions)) {
863
973
  // option not specified nor focusable: use fallback options
864
974
  if (findContainerIndex(doc.activeElement) >= 0) {
865
975
  node = doc.activeElement;
@@ -870,6 +980,10 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
870
980
  // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
871
981
  node = firstTabbableNode || getNodeForOption('fallbackFocus');
872
982
  }
983
+ } else if (node === null) {
984
+ // option is a VALID selector string that doesn't yield a node: use the `fallbackFocus`
985
+ // option instead of the default behavior when the option isn't specified at all
986
+ node = getNodeForOption('fallbackFocus');
873
987
  }
874
988
  if (!node) {
875
989
  throw new Error('Your focus-trap needs to have at least one focusable element');
@@ -979,25 +1093,25 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
979
1093
  *
980
1094
  * @returns {HTMLElement} The element that currently has the focus
981
1095
  **/
982
- var getActiveElement = function getActiveElement(el) {
1096
+ var _getActiveElement = function getActiveElement(el) {
983
1097
  var activeElement = el.activeElement;
984
1098
  if (!activeElement) {
985
1099
  return;
986
1100
  }
987
1101
  if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) {
988
- return getActiveElement(activeElement.shadowRoot);
1102
+ return _getActiveElement(activeElement.shadowRoot);
989
1103
  }
990
1104
  return activeElement;
991
1105
  };
992
- var tryFocus = function tryFocus(node) {
1106
+ var _tryFocus = function tryFocus(node) {
993
1107
  if (node === false) {
994
1108
  return;
995
1109
  }
996
- if (node === getActiveElement(document)) {
1110
+ if (node === _getActiveElement(document)) {
997
1111
  return;
998
1112
  }
999
1113
  if (!node || !node.focus) {
1000
- tryFocus(getInitialFocusNode());
1114
+ _tryFocus(getInitialFocusNode());
1001
1115
  return;
1002
1116
  }
1003
1117
  node.focus({
@@ -1010,7 +1124,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1010
1124
  }
1011
1125
  };
1012
1126
  var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
1013
- var node = getNodeForOption('setReturnFocus', previousActiveElement);
1127
+ var node = getNodeForOption('setReturnFocus', {
1128
+ params: [previousActiveElement]
1129
+ });
1014
1130
  return node ? node : node === false ? false : previousActiveElement;
1015
1131
  };
1016
1132
 
@@ -1025,11 +1141,11 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1025
1141
  * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
1026
1142
  * determined given the current state of the trap.
1027
1143
  */
1028
- var findNextNavNode = function findNextNavNode(_ref2) {
1029
- var target = _ref2.target,
1030
- event = _ref2.event,
1031
- _ref2$isBackward = _ref2.isBackward,
1032
- isBackward = _ref2$isBackward === void 0 ? false : _ref2$isBackward;
1144
+ var findNextNavNode = function findNextNavNode(_ref3) {
1145
+ var target = _ref3.target,
1146
+ event = _ref3.event,
1147
+ _ref3$isBackward = _ref3.isBackward,
1148
+ isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward;
1033
1149
  target = target || getActualTarget(event);
1034
1150
  updateTabbableNodes();
1035
1151
  var destinationNode = null;
@@ -1053,8 +1169,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1053
1169
  // REVERSE
1054
1170
 
1055
1171
  // is the target the first tabbable node in a group?
1056
- var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
1057
- var firstTabbableNode = _ref3.firstTabbableNode;
1172
+ var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref4) {
1173
+ var firstTabbableNode = _ref4.firstTabbableNode;
1058
1174
  return target === firstTabbableNode;
1059
1175
  });
1060
1176
  if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
@@ -1082,8 +1198,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1082
1198
  // FORWARD
1083
1199
 
1084
1200
  // is the target the last tabbable node in a group?
1085
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
1086
- var lastTabbableNode = _ref4.lastTabbableNode;
1201
+ var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) {
1202
+ var lastTabbableNode = _ref5.lastTabbableNode;
1087
1203
  return target === lastTabbableNode;
1088
1204
  });
1089
1205
  if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
@@ -1241,9 +1357,9 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1241
1357
  });
1242
1358
  }
1243
1359
  if (nextNode) {
1244
- tryFocus(nextNode);
1360
+ _tryFocus(nextNode);
1245
1361
  } else {
1246
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1362
+ _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
1247
1363
  }
1248
1364
  }
1249
1365
  state.recentNavEvent = undefined; // clear
@@ -1268,19 +1384,21 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1268
1384
  // to where it normally would
1269
1385
  event.preventDefault();
1270
1386
  }
1271
- tryFocus(destinationNode);
1387
+ _tryFocus(destinationNode);
1272
1388
  }
1273
1389
  // else, let the browser take care of [shift+]tab and move the focus
1274
1390
  };
1391
+ var checkTabKey = function checkTabKey(event) {
1392
+ if (config.isKeyForward(event) || config.isKeyBackward(event)) {
1393
+ checkKeyNav(event, config.isKeyBackward(event));
1394
+ }
1395
+ };
1275
1396
 
1276
- var checkKey = function checkKey(event) {
1397
+ // we use a different event phase for the Escape key to allow canceling the event and checking for this in escapeDeactivates
1398
+ var checkEscapeKey = function checkEscapeKey(event) {
1277
1399
  if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
1278
1400
  event.preventDefault();
1279
1401
  trap.deactivate();
1280
- return;
1281
- }
1282
- if (config.isKeyForward(event) || config.isKeyBackward(event)) {
1283
- checkKeyNav(event, config.isKeyBackward(event));
1284
1402
  }
1285
1403
  };
1286
1404
  var checkClick = function checkClick(e) {
@@ -1313,8 +1431,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1313
1431
  // Delay ensures that the focused element doesn't capture the event
1314
1432
  // that caused the focus trap activation.
1315
1433
  state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
1316
- tryFocus(getInitialFocusNode());
1317
- }) : tryFocus(getInitialFocusNode());
1434
+ _tryFocus(getInitialFocusNode());
1435
+ }) : _tryFocus(getInitialFocusNode());
1318
1436
  doc.addEventListener('focusin', checkFocusIn, true);
1319
1437
  doc.addEventListener('mousedown', checkPointerDown, {
1320
1438
  capture: true,
@@ -1328,12 +1446,81 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1328
1446
  capture: true,
1329
1447
  passive: false
1330
1448
  });
1331
- doc.addEventListener('keydown', checkKey, {
1449
+ doc.addEventListener('keydown', checkTabKey, {
1332
1450
  capture: true,
1333
1451
  passive: false
1334
1452
  });
1453
+ doc.addEventListener('keydown', checkEscapeKey);
1335
1454
  return trap;
1336
1455
  };
1456
+
1457
+ /**
1458
+ * Traverses up the DOM from each of `containers`, collecting references to
1459
+ * the elements that are siblings to `container` or an ancestor of `container`.
1460
+ * @param {Array<HTMLElement>} containers
1461
+ */
1462
+ var collectAdjacentElements = function collectAdjacentElements(containers) {
1463
+ // Re-activate all adjacent elements & clear previous collection.
1464
+ if (state.active && !state.paused) {
1465
+ trap._setSubtreeIsolation(false);
1466
+ }
1467
+ state.adjacentElements.clear();
1468
+ state.alreadySilent.clear();
1469
+
1470
+ // Collect all ancestors of all containers to avoid redundant processing.
1471
+ var containerAncestors = new Set();
1472
+ var adjacentElements = new Set();
1473
+
1474
+ // Compile all elements adjacent to the focus trap containers & lineage.
1475
+ var _iterator = _createForOfIteratorHelper(containers),
1476
+ _step;
1477
+ try {
1478
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1479
+ var container = _step.value;
1480
+ containerAncestors.add(container);
1481
+ var insideShadowRoot = typeof ShadowRoot !== 'undefined' && container.getRootNode() instanceof ShadowRoot;
1482
+ var current = container;
1483
+ while (current) {
1484
+ containerAncestors.add(current);
1485
+ var parent = current.parentElement;
1486
+ var siblings = [];
1487
+ if (parent) {
1488
+ siblings = parent.children;
1489
+ } else if (!parent && insideShadowRoot) {
1490
+ siblings = current.getRootNode().children;
1491
+ parent = current.getRootNode().host;
1492
+ insideShadowRoot = typeof ShadowRoot !== 'undefined' && parent.getRootNode() instanceof ShadowRoot;
1493
+ }
1494
+
1495
+ // Add all the children, we'll remove container lineage later.
1496
+ var _iterator2 = _createForOfIteratorHelper(siblings),
1497
+ _step2;
1498
+ try {
1499
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1500
+ var child = _step2.value;
1501
+ adjacentElements.add(child);
1502
+ }
1503
+ } catch (err) {
1504
+ _iterator2.e(err);
1505
+ } finally {
1506
+ _iterator2.f();
1507
+ }
1508
+ current = parent;
1509
+ }
1510
+ }
1511
+
1512
+ // Multi-container traps may overlap.
1513
+ // Remove elements within container lineages.
1514
+ } catch (err) {
1515
+ _iterator.e(err);
1516
+ } finally {
1517
+ _iterator.f();
1518
+ }
1519
+ containerAncestors.forEach(function (el) {
1520
+ adjacentElements["delete"](el);
1521
+ });
1522
+ state.adjacentElements = adjacentElements;
1523
+ };
1337
1524
  var removeListeners = function removeListeners() {
1338
1525
  if (!state.active) {
1339
1526
  return;
@@ -1342,7 +1529,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1342
1529
  doc.removeEventListener('mousedown', checkPointerDown, true);
1343
1530
  doc.removeEventListener('touchstart', checkPointerDown, true);
1344
1531
  doc.removeEventListener('click', checkClick, true);
1345
- doc.removeEventListener('keydown', checkKey, true);
1532
+ doc.removeEventListener('keydown', checkTabKey, true);
1533
+ doc.removeEventListener('keydown', checkEscapeKey);
1346
1534
  return trap;
1347
1535
  };
1348
1536
 
@@ -1361,7 +1549,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1361
1549
  // If the currently focused is removed then browsers will move focus to the
1362
1550
  // <body> element. If this happens, try to move focus back into the trap.
1363
1551
  if (isFocusedNodeRemoved) {
1364
- tryFocus(getInitialFocusNode());
1552
+ _tryFocus(getInitialFocusNode());
1365
1553
  }
1366
1554
  };
1367
1555
 
@@ -1401,26 +1589,55 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1401
1589
  var onActivate = getOption(activateOptions, 'onActivate');
1402
1590
  var onPostActivate = getOption(activateOptions, 'onPostActivate');
1403
1591
  var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
1404
- if (!checkCanFocusTrap) {
1405
- updateTabbableNodes();
1592
+
1593
+ // If a currently-active trap is isolating its subtree, we need to remove
1594
+ // that isolation to allow the new trap to find tabbable nodes.
1595
+ var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack);
1596
+ var revertState = false;
1597
+ if (preexistingTrap && !preexistingTrap.paused) {
1598
+ var _preexistingTrap$_set;
1599
+ // [#1729] method MAY not exist if using `trapStack` option to share stack with older
1600
+ // versions of Focus-trap in the same DOM so use optional chaining here just in case
1601
+ // since this is a trap we may not have created from this instance of the library
1602
+ (_preexistingTrap$_set = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set === void 0 || _preexistingTrap$_set.call(preexistingTrap, false);
1603
+ revertState = true;
1406
1604
  }
1407
- state.active = true;
1408
- state.paused = false;
1409
- state.nodeFocusedBeforeActivation = doc.activeElement;
1410
- onActivate === null || onActivate === void 0 || onActivate();
1411
- var finishActivation = function finishActivation() {
1412
- if (checkCanFocusTrap) {
1605
+ try {
1606
+ if (!checkCanFocusTrap) {
1413
1607
  updateTabbableNodes();
1414
1608
  }
1415
- addListeners();
1416
- updateObservedNodes();
1417
- onPostActivate === null || onPostActivate === void 0 || onPostActivate();
1418
- };
1419
- if (checkCanFocusTrap) {
1420
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
1421
- return this;
1609
+ state.active = true;
1610
+ state.paused = false;
1611
+ state.nodeFocusedBeforeActivation = _getActiveElement(doc);
1612
+ onActivate === null || onActivate === void 0 || onActivate();
1613
+ var finishActivation = function finishActivation() {
1614
+ if (checkCanFocusTrap) {
1615
+ updateTabbableNodes();
1616
+ }
1617
+ addListeners();
1618
+ updateObservedNodes();
1619
+ if (config.isolateSubtrees) {
1620
+ trap._setSubtreeIsolation(true);
1621
+ }
1622
+ onPostActivate === null || onPostActivate === void 0 || onPostActivate();
1623
+ };
1624
+ if (checkCanFocusTrap) {
1625
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
1626
+ return this;
1627
+ }
1628
+ finishActivation();
1629
+ } catch (error) {
1630
+ // If our activation throws an exception and the stack hasn't changed,
1631
+ // we need to re-enable the prior trap's subtree isolation.
1632
+ if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) {
1633
+ var _preexistingTrap$_set2;
1634
+ // [#1729] method MAY not exist if using `trapStack` option to share stack with older
1635
+ // versions of Focus-trap in the same DOM so use optional chaining here just in case
1636
+ // since this is a trap we may not have created from this instance of the library
1637
+ (_preexistingTrap$_set2 = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set2 === void 0 || _preexistingTrap$_set2.call(preexistingTrap, true);
1638
+ }
1639
+ throw error;
1422
1640
  }
1423
- finishActivation();
1424
1641
  return this;
1425
1642
  },
1426
1643
  deactivate: function deactivate(deactivateOptions) {
@@ -1434,6 +1651,15 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1434
1651
  }, deactivateOptions);
1435
1652
  clearTimeout(state.delayInitialFocusTimer); // noop if undefined
1436
1653
  state.delayInitialFocusTimer = undefined;
1654
+
1655
+ // Prior to removing this trap from the trapStack, we need to remove any applications of `inert`.
1656
+ // This allows the next trap down to update its tabbable nodes properly.
1657
+ //
1658
+ // If this trap is not top of the stack, don't change any current isolation.
1659
+ if (!state.paused) {
1660
+ trap._setSubtreeIsolation(false);
1661
+ }
1662
+ state.alreadySilent.clear();
1437
1663
  removeListeners();
1438
1664
  state.active = false;
1439
1665
  state.paused = false;
@@ -1447,7 +1673,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1447
1673
  var finishDeactivation = function finishDeactivation() {
1448
1674
  delay(function () {
1449
1675
  if (returnFocus) {
1450
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1676
+ _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
1451
1677
  }
1452
1678
  onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate();
1453
1679
  });
@@ -1460,44 +1686,114 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1460
1686
  return this;
1461
1687
  },
1462
1688
  pause: function pause(pauseOptions) {
1463
- if (state.paused || !state.active) {
1689
+ if (!state.active) {
1464
1690
  return this;
1465
1691
  }
1466
- var onPause = getOption(pauseOptions, 'onPause');
1467
- var onPostPause = getOption(pauseOptions, 'onPostPause');
1468
- state.paused = true;
1469
- onPause === null || onPause === void 0 || onPause();
1470
- removeListeners();
1471
- updateObservedNodes();
1472
- onPostPause === null || onPostPause === void 0 || onPostPause();
1473
- return this;
1692
+ state.manuallyPaused = true;
1693
+ return this._setPausedState(true, pauseOptions);
1474
1694
  },
1475
1695
  unpause: function unpause(unpauseOptions) {
1476
- if (!state.paused || !state.active) {
1696
+ if (!state.active) {
1477
1697
  return this;
1478
1698
  }
1479
- var onUnpause = getOption(unpauseOptions, 'onUnpause');
1480
- var onPostUnpause = getOption(unpauseOptions, 'onPostUnpause');
1481
- state.paused = false;
1482
- onUnpause === null || onUnpause === void 0 || onUnpause();
1483
- updateTabbableNodes();
1484
- addListeners();
1485
- updateObservedNodes();
1486
- onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
1487
- return this;
1699
+ state.manuallyPaused = false;
1700
+ if (trapStack[trapStack.length - 1] !== this) {
1701
+ return this;
1702
+ }
1703
+ return this._setPausedState(false, unpauseOptions);
1488
1704
  },
1489
1705
  updateContainerElements: function updateContainerElements(containerElements) {
1490
1706
  var elementsAsArray = [].concat(containerElements).filter(Boolean);
1491
1707
  state.containers = elementsAsArray.map(function (element) {
1492
1708
  return typeof element === 'string' ? doc.querySelector(element) : element;
1493
1709
  });
1710
+ if (config.isolateSubtrees) {
1711
+ collectAdjacentElements(state.containers);
1712
+ }
1494
1713
  if (state.active) {
1495
1714
  updateTabbableNodes();
1715
+ if (config.isolateSubtrees && !state.paused) {
1716
+ trap._setSubtreeIsolation(true);
1717
+ }
1496
1718
  }
1497
1719
  updateObservedNodes();
1498
1720
  return this;
1499
1721
  }
1500
1722
  };
1723
+ Object.defineProperties(trap, {
1724
+ _isManuallyPaused: {
1725
+ value: function value() {
1726
+ return state.manuallyPaused;
1727
+ }
1728
+ },
1729
+ _setPausedState: {
1730
+ value: function value(paused, options) {
1731
+ if (state.paused === paused) {
1732
+ return this;
1733
+ }
1734
+ state.paused = paused;
1735
+ if (paused) {
1736
+ var onPause = getOption(options, 'onPause');
1737
+ var onPostPause = getOption(options, 'onPostPause');
1738
+ onPause === null || onPause === void 0 || onPause();
1739
+ removeListeners();
1740
+ updateObservedNodes();
1741
+ trap._setSubtreeIsolation(false);
1742
+ onPostPause === null || onPostPause === void 0 || onPostPause();
1743
+ } else {
1744
+ var onUnpause = getOption(options, 'onUnpause');
1745
+ var onPostUnpause = getOption(options, 'onPostUnpause');
1746
+ onUnpause === null || onUnpause === void 0 || onUnpause();
1747
+ trap._setSubtreeIsolation(true);
1748
+ updateTabbableNodes();
1749
+ addListeners();
1750
+ updateObservedNodes();
1751
+ onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
1752
+ }
1753
+ return this;
1754
+ }
1755
+ },
1756
+ _setSubtreeIsolation: {
1757
+ value: function value(isEnabled) {
1758
+ if (config.isolateSubtrees) {
1759
+ state.adjacentElements.forEach(function (el) {
1760
+ var _el$getAttribute;
1761
+ if (isEnabled) {
1762
+ switch (config.isolateSubtrees) {
1763
+ case 'aria-hidden':
1764
+ // check both attribute and property to ensure initial state is captured
1765
+ // correctly across different browsers and test environments (like JSDOM)
1766
+ if (el.ariaHidden === 'true' || ((_el$getAttribute = el.getAttribute('aria-hidden')) === null || _el$getAttribute === void 0 ? void 0 : _el$getAttribute.toLowerCase()) === 'true') {
1767
+ state.alreadySilent.add(el);
1768
+ }
1769
+ el.setAttribute('aria-hidden', 'true');
1770
+ break;
1771
+ default:
1772
+ // check both attribute and property to ensure initial state is captured
1773
+ // correctly across different browsers and test environments (like JSDOM)
1774
+ if (el.inert || el.hasAttribute('inert')) {
1775
+ state.alreadySilent.add(el);
1776
+ }
1777
+ el.setAttribute('inert', true);
1778
+ break;
1779
+ }
1780
+ } else {
1781
+ if (state.alreadySilent.has(el)) ; else {
1782
+ switch (config.isolateSubtrees) {
1783
+ case 'aria-hidden':
1784
+ el.removeAttribute('aria-hidden');
1785
+ break;
1786
+ default:
1787
+ el.removeAttribute('inert');
1788
+ break;
1789
+ }
1790
+ }
1791
+ }
1792
+ });
1793
+ }
1794
+ }
1795
+ }
1796
+ });
1501
1797
 
1502
1798
  // initialize container elements
1503
1799
  trap.updateContainerElements(elements);
@@ -1505,5 +1801,3 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
1505
1801
  };
1506
1802
 
1507
1803
  exports.createFocusTrap = createFocusTrap;
1508
-
1509
- //# sourceMappingURL=focus-trap.esm-7bc384a0.js.map