@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,51 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* tabbable 6.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
-
|
|
46
|
-
//
|
|
47
|
-
|
|
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$
|
|
53
|
+
var _node$getAttribute;
|
|
59
54
|
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
|
|
60
|
-
// to use the attribute directly
|
|
61
|
-
//
|
|
62
|
-
var attValue = node
|
|
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 (
|
|
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
|
|
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 (
|
|
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 =
|
|
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 = !
|
|
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 =
|
|
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)
|
|
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,
|
|
321
|
-
attached = !!((_nodeRootHost = nodeRootHost)
|
|
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
|
|
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)
|
|
329
|
-
attached = !!((_nodeRootHost2 = 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
|
-
|
|
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' ||
|
|
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
|
|
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
|
|
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 ?
|
|
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 =
|
|
543
|
+
candidates = _getCandidatesIteratively([container], options.includeContainer, {
|
|
526
544
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
527
545
|
flatten: false,
|
|
528
546
|
getShadowRoot: options.getShadowRoot,
|
|
529
|
-
shadowRootFilter:
|
|
547
|
+
shadowRootFilter: isShadowRootTabbable
|
|
530
548
|
});
|
|
531
549
|
} else {
|
|
532
550
|
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
533
551
|
}
|
|
534
|
-
return
|
|
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 =
|
|
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.
|
|
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),
|
|
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
|
|
599
|
-
|
|
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(
|
|
613
|
-
if (
|
|
614
|
-
var
|
|
615
|
-
if (
|
|
616
|
-
var
|
|
617
|
-
if (
|
|
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 (
|
|
697
|
+
return ("string" === r ? String : Number)(t);
|
|
621
698
|
}
|
|
622
|
-
function _toPropertyKey(
|
|
623
|
-
var
|
|
624
|
-
return
|
|
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
|
-
|
|
630
|
-
|
|
631
|
-
|
|
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
|
-
|
|
650
|
-
|
|
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
|
-
|
|
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
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
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) || (
|
|
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
|
-
* @
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
1102
|
+
return _getActiveElement(activeElement.shadowRoot);
|
|
989
1103
|
}
|
|
990
1104
|
return activeElement;
|
|
991
1105
|
};
|
|
992
|
-
var
|
|
1106
|
+
var _tryFocus = function tryFocus(node) {
|
|
993
1107
|
if (node === false) {
|
|
994
1108
|
return;
|
|
995
1109
|
}
|
|
996
|
-
if (node ===
|
|
1110
|
+
if (node === _getActiveElement(document)) {
|
|
997
1111
|
return;
|
|
998
1112
|
}
|
|
999
1113
|
if (!node || !node.focus) {
|
|
1000
|
-
|
|
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',
|
|
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(
|
|
1029
|
-
var target =
|
|
1030
|
-
event =
|
|
1031
|
-
|
|
1032
|
-
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 =
|
|
1057
|
-
var 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 =
|
|
1086
|
-
var 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
|
-
|
|
1360
|
+
_tryFocus(nextNode);
|
|
1245
1361
|
} else {
|
|
1246
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1317
|
-
}) :
|
|
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',
|
|
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',
|
|
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
|
-
|
|
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
|
-
|
|
1405
|
-
|
|
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
|
-
|
|
1408
|
-
|
|
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
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
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
|
-
|
|
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 (
|
|
1689
|
+
if (!state.active) {
|
|
1464
1690
|
return this;
|
|
1465
1691
|
}
|
|
1466
|
-
|
|
1467
|
-
|
|
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.
|
|
1696
|
+
if (!state.active) {
|
|
1477
1697
|
return this;
|
|
1478
1698
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
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
|