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