@swisspost/design-system-components 9.0.0-next.32 → 9.0.0-next.34
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/dist/cjs/{attribute-observer-6d8b886b.js → attribute-observer-c3a805b2.js} +3 -1
- package/dist/cjs/{breakpoints-c6247c71.js → breakpoints-cdf1b747.js} +12 -7
- package/dist/cjs/event-guard-efabc84f.js +47 -0
- package/dist/cjs/get-root-8102fecd.js +17 -0
- package/dist/cjs/{index-d6bf2c66.js → index-b60129c4.js} +2 -2
- package/dist/cjs/index.cjs.js +25 -25
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/long-press-event-6e62d113.js +266 -0
- package/dist/cjs/{package-6f8f430c.js → package-3426e8f7.js} +1 -1
- package/dist/cjs/{post-accordion-e3a6d78e.js → post-accordion-3ac8dca8.js} +10 -12
- package/dist/cjs/{post-accordion-item-7ed1f630.js → post-accordion-item-aace6bc2.js} +10 -10
- package/dist/cjs/post-accordion-item.cjs.entry.js +5 -3
- package/dist/cjs/post-accordion.cjs.entry.js +5 -3
- package/dist/cjs/{post-avatar-de8ec197.js → post-avatar-53abd22f.js} +5 -4
- package/dist/cjs/post-avatar.cjs.entry.js +4 -3
- package/dist/cjs/post-back-to-top-b231fc1c.js +96 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +4 -3
- package/dist/cjs/{post-banner-bf523706.js → post-banner-e6d14bf1.js} +4 -8
- package/dist/cjs/post-banner.cjs.entry.js +4 -3
- package/dist/cjs/{post-breadcrumb-da55143a.js → post-breadcrumb-a929f2a6.js} +30 -22
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +4 -3
- package/dist/cjs/post-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/{post-card-control-0bcd7d16.js → post-card-control-cbee7b86.js} +26 -40
- package/dist/cjs/post-card-control.cjs.entry.js +4 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +6 -5
- package/dist/cjs/{post-collapsible-trigger-a5e4451d.js → post-collapsible-trigger-d1cb592a.js} +39 -46
- package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -5
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-footer-b15fee73.js → post-footer-4290dafc.js} +11 -11
- package/dist/cjs/post-footer.cjs.entry.js +4 -4
- package/dist/cjs/{post-linkarea-8c85bf5e.js → post-linkarea-f22f4f92.js} +5 -5
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/{post-menu-item-509877cd.js → post-menu-item-afabaa61.js} +4 -4
- package/dist/cjs/{post-popover-1213aa19.js → post-popover-a4c72d38.js} +16 -14
- package/dist/cjs/post-popover.cjs.entry.js +5 -4
- package/dist/cjs/{post-rating-e1f8a668.js → post-rating-b87616fc.js} +4 -14
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-889a6c64.js → post-tab-header-45cb6bb4.js} +5 -4
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-300f39a9.js → post-tab-panel-00d16ba7.js} +4 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-dc281228.js → post-tabs-2c3a89d0.js} +5 -12
- package/dist/cjs/post-tabs.cjs.entry.js +4 -3
- package/dist/cjs/{post-tag-fd9e586f.js → post-tag-370a2f4d.js} +3 -3
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-togglebutton-ad6ae1e4.js → post-togglebutton-2c9552e3.js} +969 -471
- package/dist/cjs/{post-tooltip-52d690e4.js → post-tooltip-4d4d2ea9.js} +39 -296
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/collection/animations/collapse.js +3 -1
- package/dist/collection/components/post-accordion/post-accordion.js +6 -10
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +6 -8
- package/dist/collection/components/post-avatar/post-avatar.js +3 -4
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +37 -19
- package/dist/collection/components/post-banner/post-banner.js +0 -6
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +16 -19
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +0 -2
- package/dist/collection/components/post-card-control/post-card-control.js +24 -40
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -0
- package/dist/collection/components/post-closebutton/post-closebutton.js +12 -2
- package/dist/collection/components/post-collapsible/post-collapsible.js +4 -10
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +29 -32
- package/dist/collection/components/post-footer/post-footer.js +8 -9
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +16 -19
- package/dist/collection/components/post-icon/post-icon.js +5 -7
- package/dist/collection/components/post-language-option/post-language-option.js +1 -10
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +25 -31
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +2 -2
- package/dist/collection/components/post-list/post-list.js +1 -3
- package/dist/collection/components/post-list-item/post-list-item.js +1 -2
- package/dist/collection/components/post-logo/post-logo.js +1 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +98 -182
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +20 -30
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +42 -36
- package/dist/collection/components/post-menu/post-menu.js +51 -52
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +13 -15
- package/dist/collection/components/post-popover/post-popover.js +12 -12
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +30 -33
- package/dist/collection/components/post-rating/post-rating.js +1 -12
- package/dist/collection/components/post-tab-header/post-tab-header.js +2 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -3
- package/dist/collection/components/post-tabs/post-tabs.js +1 -10
- package/dist/collection/components/post-tag/post-tag.js +0 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +10 -11
- package/dist/collection/components/post-tooltip/post-tooltip.js +36 -32
- package/dist/collection/utils/attribute-observer.js +2 -1
- package/dist/collection/utils/breakpoints.js +9 -7
- package/dist/collection/utils/environment.js +2 -0
- package/dist/collection/utils/event-guard.js +43 -0
- package/dist/collection/utils/get-root.js +6 -1
- package/dist/collection/utils/index.js +5 -0
- package/dist/collection/utils/is-motion-reduced.js +2 -1
- package/dist/components/attribute-observer.js +3 -1
- package/dist/components/breakpoints.js +12 -8
- package/dist/components/event-guard.js +45 -0
- package/dist/components/get-root.js +7 -1
- package/dist/components/long-press-event.js +264 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +8 -8
- package/dist/components/post-accordion2.js +8 -10
- package/dist/components/post-avatar2.js +4 -3
- package/dist/components/post-back-to-top2.js +40 -20
- package/dist/components/post-banner2.js +2 -6
- package/dist/components/post-breadcrumb-item2.js +2 -2
- package/dist/components/post-breadcrumb2.js +28 -20
- package/dist/components/post-card-control2.js +25 -39
- package/dist/components/post-closebutton2.js +8 -3
- package/dist/components/post-collapsible-trigger2.js +33 -35
- package/dist/components/post-collapsible2.js +9 -12
- package/dist/components/post-footer2.js +8 -8
- package/dist/components/post-header2.js +18 -20
- package/dist/components/post-icon2.js +6 -6
- package/dist/components/post-language-option2.js +3 -10
- package/dist/components/post-language-switch2.js +28 -31
- package/dist/components/post-linkarea2.js +5 -4
- package/dist/components/post-list-item2.js +2 -2
- package/dist/components/post-list2.js +2 -3
- package/dist/components/post-logo2.js +3 -2
- package/dist/components/post-mainnavigation2.js +94 -182
- package/dist/components/post-megadropdown-trigger2.js +44 -36
- package/dist/components/post-megadropdown2.js +22 -31
- package/dist/components/post-menu-trigger2.js +15 -15
- package/dist/components/post-menu2.js +53 -52
- package/dist/components/post-popover2.js +14 -12
- package/dist/components/post-popovercontainer2.js +638 -36
- package/dist/components/post-rating2.js +2 -12
- package/dist/components/post-tab-header2.js +4 -3
- package/dist/components/post-tab-panel2.js +3 -3
- package/dist/components/post-tabs2.js +3 -10
- package/dist/components/post-tag2.js +1 -1
- package/dist/components/post-togglebutton2.js +12 -11
- package/dist/components/post-tooltip2.js +37 -294
- package/dist/docs.json +21 -15
- package/dist/esm/{attribute-observer-2f203993.js → attribute-observer-009deee5.js} +3 -1
- package/dist/esm/{breakpoints-bbe0c54e.js → breakpoints-7812702e.js} +12 -8
- package/dist/esm/event-guard-538ee077.js +45 -0
- package/dist/esm/get-root-1b1af46f.js +15 -0
- package/dist/esm/{index-3419e46d.js → index-f4d19816.js} +2 -2
- package/dist/esm/index.js +25 -25
- package/dist/esm/loader.js +3 -3
- package/dist/esm/long-press-event-04d24397.js +264 -0
- package/dist/esm/package-8986a24c.js +3 -0
- package/dist/esm/{post-accordion-7b6fb9c3.js → post-accordion-577b52a0.js} +10 -12
- package/dist/esm/{post-accordion-item-d40c0b26.js → post-accordion-item-99053b41.js} +10 -10
- package/dist/esm/post-accordion-item.entry.js +5 -3
- package/dist/esm/post-accordion.entry.js +5 -3
- package/dist/esm/{post-avatar-04ca6e3e.js → post-avatar-2914706c.js} +5 -4
- package/dist/esm/post-avatar.entry.js +4 -3
- package/dist/esm/post-back-to-top-4c7b1b47.js +94 -0
- package/dist/esm/post-back-to-top.entry.js +4 -3
- package/dist/esm/{post-banner-7c37e3ef.js → post-banner-295fd0f5.js} +4 -8
- package/dist/esm/post-banner.entry.js +4 -3
- package/dist/esm/{post-breadcrumb-59e4d655.js → post-breadcrumb-1abfb312.js} +30 -22
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -3
- package/dist/esm/post-breadcrumb.entry.js +4 -4
- package/dist/esm/{post-card-control-5471488b.js → post-card-control-ad72d4f8.js} +26 -40
- package/dist/esm/post-card-control.entry.js +4 -3
- package/dist/esm/post-closebutton_15.entry.js +6 -5
- package/dist/esm/{post-collapsible-trigger-1f6d816e.js → post-collapsible-trigger-6b4ece20.js} +39 -46
- package/dist/esm/post-collapsible_2.entry.js +6 -5
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-footer-d30f4dc8.js → post-footer-a5105e66.js} +11 -11
- package/dist/esm/post-footer.entry.js +4 -4
- package/dist/esm/{post-linkarea-8e1a561e.js → post-linkarea-22f97a88.js} +5 -5
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/{post-menu-item-0c8477eb.js → post-menu-item-9465a1f3.js} +4 -4
- package/dist/esm/{post-popover-c43969ca.js → post-popover-e9b4569c.js} +16 -14
- package/dist/esm/post-popover.entry.js +5 -4
- package/dist/esm/{post-rating-94148df7.js → post-rating-ae16e3c9.js} +4 -14
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-82df0ba9.js → post-tab-header-11f23150.js} +5 -4
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-a6512f53.js → post-tab-panel-0f3a952e.js} +4 -4
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-d26ce341.js → post-tabs-1192509c.js} +5 -12
- package/dist/esm/post-tabs.entry.js +4 -3
- package/dist/esm/{post-tag-41d1667e.js → post-tag-8be0a71c.js} +3 -3
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-togglebutton-4f94bddb.js → post-togglebutton-b634fc7c.js} +969 -471
- package/dist/esm/{post-tooltip-20f916db.js → post-tooltip-f64bd0cc.js} +39 -296
- package/dist/esm/post-tooltip.entry.js +5 -4
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0889c759.js +1 -0
- package/dist/post-components/p-0f398677.js +1 -0
- package/dist/post-components/p-1038fc25.js +1 -0
- package/dist/post-components/p-30f94eca.entry.js +1 -0
- package/dist/post-components/p-31bb6dc5.entry.js +1 -0
- package/dist/post-components/p-32173742.js +1 -0
- package/dist/post-components/p-338a2507.js +1 -0
- package/dist/post-components/p-36540dd6.entry.js +1 -0
- package/dist/post-components/p-3aa766a6.js +1 -0
- package/dist/post-components/p-3b0158b3.js +1 -0
- package/dist/post-components/p-40db8cd5.js +1 -0
- package/dist/post-components/p-44f13ce4.entry.js +1 -0
- package/dist/post-components/p-46a9324f.entry.js +1 -0
- package/dist/post-components/p-49c5aa99.js +1 -0
- package/dist/post-components/p-4cd4a936.entry.js +1 -0
- package/dist/post-components/p-548ef2f5.entry.js +1 -0
- package/dist/post-components/p-58f453dd.js +1 -0
- package/dist/post-components/p-5f54b77f.js +1 -0
- package/dist/post-components/p-60bb7f26.js +1 -0
- package/dist/post-components/p-60bfa4be.entry.js +1 -0
- package/dist/post-components/p-6b31a76a.js +1 -0
- package/dist/post-components/p-6ee81c5d.js +1 -0
- package/dist/post-components/p-6faad212.entry.js +1 -0
- package/dist/post-components/p-722ffaae.js +1 -0
- package/dist/post-components/p-74a0b44c.entry.js +1 -0
- package/dist/post-components/{p-28e77ad3.js → p-78b4c699.js} +1 -1
- package/dist/post-components/p-7aa0468b.entry.js +1 -0
- package/dist/post-components/p-7afc495e.entry.js +1 -0
- package/dist/post-components/p-8db32dab.js +8 -0
- package/dist/post-components/p-96034ba4.entry.js +1 -0
- package/dist/post-components/p-9aaf9f54.js +1 -0
- package/dist/post-components/{p-5c758f41.js → p-9e461613.js} +1 -1
- package/dist/post-components/p-ab4073be.js +1 -0
- package/dist/post-components/p-abd7eb91.js +8 -0
- package/dist/post-components/p-afb8a487.entry.js +1 -0
- package/dist/post-components/p-b003b381.js +1 -0
- package/dist/post-components/p-b97dea1e.entry.js +1 -0
- package/dist/post-components/p-be37cf2a.js +1 -0
- package/dist/post-components/p-c31b56ed.js +1 -0
- package/dist/post-components/p-ccbb51fe.js +1 -0
- package/dist/post-components/p-d3900385.entry.js +1 -0
- package/dist/post-components/p-ef49153c.entry.js +1 -0
- package/dist/post-components/p-f27e5691.js +1 -0
- package/dist/post-components/p-f553019f.entry.js +1 -0
- package/dist/post-components/p-ffc1db17.entry.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +1 -1
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +3 -1
- package/dist/types/components/post-card-control/post-card-control.d.ts +1 -1
- package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +9 -14
- package/dist/types/components/post-footer/post-footer.d.ts +2 -2
- package/dist/types/components/post-header/post-header.d.ts +1 -0
- package/dist/types/components/post-icon/post-icon.d.ts +0 -1
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +5 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +14 -39
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +2 -0
- package/dist/types/components/post-menu/post-menu.d.ts +1 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +3 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +6 -1
- package/dist/types/components.d.ts +4 -4
- package/dist/types/popover-fn.d.ts +11 -0
- package/dist/types/utils/environment.d.ts +2 -0
- package/dist/types/utils/event-guard.d.ts +4 -0
- package/dist/types/utils/get-root.d.ts +4 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/loaders/attribute-observer.js +3 -1
- package/loaders/breakpoints.js +12 -8
- package/loaders/event-guard.js +45 -0
- package/loaders/get-root.js +7 -1
- package/loaders/index.js +3 -3
- package/loaders/long-press-event.js +264 -0
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item2.js +8 -8
- package/loaders/post-accordion.js +8 -10
- package/loaders/post-avatar.js +4 -3
- package/loaders/post-back-to-top.js +40 -20
- package/loaders/post-banner.js +2 -6
- package/loaders/post-breadcrumb-item2.js +2 -2
- package/loaders/post-breadcrumb.js +28 -20
- package/loaders/post-card-control.js +25 -39
- package/loaders/post-closebutton.js +8 -3
- package/loaders/post-collapsible-trigger2.js +33 -35
- package/loaders/post-collapsible2.js +9 -12
- package/loaders/post-footer.js +8 -8
- package/loaders/post-header.js +18 -20
- package/loaders/post-icon2.js +6 -6
- package/loaders/post-language-option.js +3 -10
- package/loaders/post-language-switch.js +28 -31
- package/loaders/post-linkarea.js +5 -4
- package/loaders/post-list-item.js +2 -2
- package/loaders/post-list.js +2 -3
- package/loaders/post-logo.js +3 -2
- package/loaders/post-mainnavigation.js +94 -182
- package/loaders/post-megadropdown-trigger.js +44 -36
- package/loaders/post-megadropdown.js +22 -31
- package/loaders/post-menu-trigger2.js +15 -15
- package/loaders/post-menu2.js +53 -52
- package/loaders/post-popover.js +14 -12
- package/loaders/post-popovercontainer2.js +638 -36
- package/loaders/post-rating.js +2 -12
- package/loaders/post-tab-header.js +4 -3
- package/loaders/post-tab-panel.js +3 -3
- package/loaders/post-tabs.js +3 -10
- package/loaders/post-tag.js +1 -1
- package/loaders/post-togglebutton.js +12 -11
- package/loaders/post-tooltip.js +37 -294
- package/package.json +5 -5
- package/dist/cjs/debounce-158fd76f.js +0 -13
- package/dist/cjs/get-root-7a3498ef.js +0 -11
- package/dist/cjs/post-back-to-top-6a1c1ba4.js +0 -76
- package/dist/components/debounce.js +0 -11
- package/dist/esm/debounce-e54c7131.js +0 -11
- package/dist/esm/get-root-7af2e0d1.js +0 -9
- package/dist/esm/package-70367d05.js +0 -3
- package/dist/esm/post-back-to-top-abe253c1.js +0 -74
- package/dist/post-components/p-015361b5.entry.js +0 -1
- package/dist/post-components/p-077edb8c.js +0 -1
- package/dist/post-components/p-08a13d05.js +0 -1
- package/dist/post-components/p-08c3b919.entry.js +0 -1
- package/dist/post-components/p-0d7b0c2e.entry.js +0 -1
- package/dist/post-components/p-12f9a91e.entry.js +0 -1
- package/dist/post-components/p-20137c6a.entry.js +0 -1
- package/dist/post-components/p-21254d9c.entry.js +0 -1
- package/dist/post-components/p-22513a27.entry.js +0 -1
- package/dist/post-components/p-3638e50d.js +0 -1
- package/dist/post-components/p-4397f28e.js +0 -1
- package/dist/post-components/p-494a2a31.js +0 -1
- package/dist/post-components/p-509987da.entry.js +0 -1
- package/dist/post-components/p-5aeb3656.js +0 -1
- package/dist/post-components/p-5d0bb74d.js +0 -1
- package/dist/post-components/p-5e0f6c12.js +0 -1
- package/dist/post-components/p-5f89f4e8.entry.js +0 -1
- package/dist/post-components/p-6213f0dc.entry.js +0 -1
- package/dist/post-components/p-6ad7bf0f.js +0 -1
- package/dist/post-components/p-6f058a98.js +0 -1
- package/dist/post-components/p-737d76cb.js +0 -15
- package/dist/post-components/p-753a1935.js +0 -1
- package/dist/post-components/p-88a2cdaa.js +0 -1
- package/dist/post-components/p-90935fdd.js +0 -1
- package/dist/post-components/p-931c4523.js +0 -1
- package/dist/post-components/p-9748a355.js +0 -1
- package/dist/post-components/p-97865e22.entry.js +0 -1
- package/dist/post-components/p-a200c9c7.js +0 -1
- package/dist/post-components/p-a35c235a.entry.js +0 -1
- package/dist/post-components/p-a4264a61.entry.js +0 -1
- package/dist/post-components/p-a54c63d0.entry.js +0 -1
- package/dist/post-components/p-aebe402d.entry.js +0 -1
- package/dist/post-components/p-b43e79e3.entry.js +0 -1
- package/dist/post-components/p-c0c71e37.js +0 -1
- package/dist/post-components/p-c0ca344d.js +0 -1
- package/dist/post-components/p-c554fcf3.js +0 -1
- package/dist/post-components/p-cff7c06f.entry.js +0 -1
- package/dist/post-components/p-d1f70a05.entry.js +0 -1
- package/dist/post-components/p-dc67e6de.entry.js +0 -1
- package/dist/post-components/p-e1baac59.js +0 -1
- package/dist/post-components/p-f1ceccf3.js +0 -1
- package/dist/post-components/p-fc91cbc2.js +0 -1
- package/loaders/debounce.js +0 -11
|
@@ -2,234 +2,152 @@ import { Host, h } from "@stencil/core";
|
|
|
2
2
|
import { version } from "../../../../package";
|
|
3
3
|
const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
|
|
4
4
|
const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
|
|
5
|
-
const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
|
|
6
|
-
const NAVIGATION_ITEM_SELECTOR = 'post-list-item :is(a, button):not(post-megadropdown *)';
|
|
7
5
|
export class PostMainnavigation {
|
|
8
6
|
constructor() {
|
|
9
7
|
this.canScrollLeft = false;
|
|
10
8
|
this.canScrollRight = false;
|
|
11
|
-
this.
|
|
9
|
+
this.scrollRight = this.scrollRight.bind(this);
|
|
10
|
+
this.scrollLeft = this.scrollLeft.bind(this);
|
|
11
|
+
this.handleMutations = this.handleMutations.bind(this);
|
|
12
|
+
this.checkScrollability = this.checkScrollability.bind(this);
|
|
13
|
+
this.resizeObserver = new ResizeObserver(this.checkScrollability);
|
|
14
|
+
this.mutationObserver = new MutationObserver(this.handleMutations);
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
25
|
-
// Recalculate scrollability after DOM changes
|
|
26
|
-
this.checkScrollability();
|
|
27
|
-
});
|
|
28
|
-
host;
|
|
29
|
-
/**
|
|
30
|
-
* Update navbar translation when 'translateAmount' changes and recalculate scrollability
|
|
31
|
-
*/
|
|
32
|
-
onTranslateAmountChanges(value) {
|
|
33
|
-
this.navbar.style.marginInlineStart = `-${value}px`;
|
|
34
|
-
this.checkScrollability();
|
|
16
|
+
componentDidLoad() {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
this.fixLayoutShift();
|
|
19
|
+
this.checkScrollability();
|
|
20
|
+
});
|
|
21
|
+
// Observe the navbar for size changes
|
|
22
|
+
this.resizeObserver.observe(this.navbar);
|
|
23
|
+
// Observe the navabar for mutation changes
|
|
24
|
+
this.mutationObserver.observe(this.navbar, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
|
|
25
|
+
// Ensure the scroll buttons are correctly displayed or hidden whenever the navbar is scrolled
|
|
26
|
+
this.navbar.addEventListener('scrollend', this.checkScrollability);
|
|
35
27
|
}
|
|
36
28
|
/**
|
|
37
|
-
*
|
|
38
|
-
* This ensures that we can interact with the header for mobile menu toggling.
|
|
29
|
+
* Disconnects observers and remove event listeners when the main navigation is removed from the DOM.
|
|
39
30
|
*/
|
|
40
|
-
|
|
41
|
-
this.
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
this.mutationObserver.disconnect();
|
|
33
|
+
this.resizeObserver.disconnect();
|
|
34
|
+
this.navbar.removeEventListener('scrollend', this.checkScrollability);
|
|
42
35
|
}
|
|
43
36
|
/**
|
|
44
|
-
*
|
|
37
|
+
* Stops the repeated scrolling when the mouse button is released.
|
|
45
38
|
*/
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
if (this.resizeObserver) {
|
|
50
|
-
this.resizeObserver.disconnect();
|
|
51
|
-
}
|
|
39
|
+
stopScrolling() {
|
|
40
|
+
if (this.scrollRepeatInterval)
|
|
41
|
+
clearInterval(this.scrollRepeatInterval);
|
|
52
42
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.checkScrollability();
|
|
43
|
+
async handleMutations(mutations) {
|
|
44
|
+
const addedNodes = mutations.flatMap((mutation) => {
|
|
45
|
+
return Array.from(mutation.addedNodes);
|
|
57
46
|
});
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
this.resizeObserver.observe(this.navbar);
|
|
61
|
-
const navList = this.navigationList;
|
|
62
|
-
if (navList) {
|
|
63
|
-
this.resizeObserver.observe(navList);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
this.mutationObserver.observe(this.navigationList, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
|
|
47
|
+
// Wait for all elements to be hydrated
|
|
48
|
+
await Promise.all(addedNodes.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
67
49
|
this.fixLayoutShift();
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
this.checkScrollability();
|
|
51
|
+
}
|
|
52
|
+
get navigationItems() {
|
|
53
|
+
return Array.from(this.navbar.querySelectorAll(':is(a, button):not(post-megadropdown *)'));
|
|
70
54
|
}
|
|
71
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Hack to fix the layout shift due to bold text on active elements
|
|
57
|
+
*/
|
|
72
58
|
fixLayoutShift() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
this.navigationItems
|
|
60
|
+
.filter(item => !item.matches(':has(.nav-el-active)'))
|
|
61
|
+
.forEach(item => {
|
|
62
|
+
item.innerHTML = `
|
|
63
|
+
<span class="nav-el-active">${item.innerHTML}</span>
|
|
64
|
+
<span class="nav-el-inactive" aria-hidden="true">${item.innerHTML}</span>
|
|
65
|
+
`;
|
|
66
|
+
});
|
|
77
67
|
}
|
|
78
68
|
handleBackButtonClick() {
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
const header = this.navbar.closest('post-header');
|
|
70
|
+
if (header)
|
|
71
|
+
header.toggleMobileMenu();
|
|
81
72
|
}
|
|
82
73
|
/**
|
|
83
|
-
*
|
|
74
|
+
* Returns whether scrolling is enabled in either the left or right direction.
|
|
84
75
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (!this.canScroll || !focusedElement.matches(NAVIGATION_ITEM_SELECTOR))
|
|
88
|
-
return;
|
|
89
|
-
// We need to move the element into the view before it is focused to avoid browser default behavior
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
this.withoutTransition(() => {
|
|
92
|
-
// Try scrolling in both directions, only the necessary translation will actually occur
|
|
93
|
-
this.translateRightTo(focusedElement);
|
|
94
|
-
this.translateLeftTo(focusedElement);
|
|
95
|
-
focusedElement.focus();
|
|
96
|
-
});
|
|
76
|
+
get canScroll() {
|
|
77
|
+
return this.canScrollLeft || this.canScrollRight;
|
|
97
78
|
}
|
|
98
79
|
/**
|
|
99
80
|
* Checks if scrolling is possible in either direction (left or right) and updates the state accordingly.
|
|
100
81
|
*/
|
|
101
82
|
checkScrollability() {
|
|
102
|
-
const { scrollWidth, clientWidth } = this.navbar;
|
|
103
|
-
const couldScroll = this.canScroll;
|
|
83
|
+
const { scrollLeft, scrollWidth, clientWidth } = this.navbar;
|
|
104
84
|
if (scrollWidth === clientWidth) {
|
|
105
85
|
// If scroll width equals client width, scrolling is disabled in both directions
|
|
106
86
|
this.canScrollLeft = this.canScrollRight = false;
|
|
107
87
|
}
|
|
108
88
|
else {
|
|
109
|
-
this.canScrollLeft =
|
|
110
|
-
this.canScrollRight = clientWidth +
|
|
111
|
-
}
|
|
112
|
-
if (couldScroll && !this.canScroll) {
|
|
113
|
-
this.withoutTransition(() => (this.translationAmount = 0));
|
|
89
|
+
this.canScrollLeft = Math.floor(scrollLeft) > 0; // Scrolling left is possible if not at the start
|
|
90
|
+
this.canScrollRight = Math.ceil(clientWidth + scrollLeft) < scrollWidth; // Scrolling right is possible if not at the end
|
|
114
91
|
}
|
|
115
92
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Returns whether scrolling is enabled in either the left or right direction.
|
|
118
|
-
*/
|
|
119
|
-
get canScroll() {
|
|
120
|
-
return this.canScrollLeft || this.canScrollRight;
|
|
121
|
-
}
|
|
122
93
|
/**
|
|
123
94
|
* Handles the scrolling behavior when a user clicks on the left or right scroll buttons.
|
|
124
95
|
*/
|
|
125
|
-
handleScrollButtonClick(direction) {
|
|
126
|
-
if (!this.canScroll)
|
|
96
|
+
handleScrollButtonClick(e, direction) {
|
|
97
|
+
if (!this.canScroll || e.button !== 0)
|
|
127
98
|
return;
|
|
128
99
|
// Disable interaction with the navbar during scrolling
|
|
129
|
-
this.
|
|
130
|
-
//
|
|
131
|
-
this.
|
|
100
|
+
this.temporarilyDisableNavbar();
|
|
101
|
+
// Set up the correct scroll function
|
|
102
|
+
const scroll = direction === 'right' ? this.scrollRight : this.scrollLeft;
|
|
103
|
+
scroll();
|
|
132
104
|
// Repeat the scrolling action while the button is held down
|
|
133
105
|
this.scrollRepeatInterval = setInterval(() => {
|
|
134
|
-
|
|
106
|
+
scroll();
|
|
135
107
|
}, SCROLL_REPEAT_INTERVAL);
|
|
136
108
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const couldScroll = direction === 'left' ? this.translateLeftTo(item, true) : this.translateRightTo(item, true);
|
|
150
|
-
if (couldScroll)
|
|
151
|
-
break;
|
|
109
|
+
scrollRight() {
|
|
110
|
+
const scrollRightLeftEdge = document
|
|
111
|
+
.querySelector('.scroll-right')
|
|
112
|
+
.getBoundingClientRect().left;
|
|
113
|
+
for (const navigationItem of this.navigationItems) {
|
|
114
|
+
const { right, width } = navigationItem.getBoundingClientRect();
|
|
115
|
+
// Scroll to the first navigation item that is less than 75% visible
|
|
116
|
+
const isThreeQuartersVisible = right - 0.25 * width < scrollRightLeftEdge;
|
|
117
|
+
if (!isThreeQuartersVisible) {
|
|
118
|
+
this.navbar.scrollBy({ left: right - scrollRightLeftEdge });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
152
121
|
}
|
|
153
122
|
}
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
// Calculate the maximum translation amount to prevent scrolling past the end of the content
|
|
168
|
-
const maximumTranslation = this.navbar.scrollWidth - this.host.clientWidth;
|
|
169
|
-
// Adjust the translation amount, ensuring it doesn't exceed the maximum scrollable area
|
|
170
|
-
const { marginRight } = getComputedStyle(this.navigationList);
|
|
171
|
-
this.translationAmount =
|
|
172
|
-
Math.min(this.translationAmount + translationIncrease, maximumTranslation) +
|
|
173
|
-
parseInt(marginRight);
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
translateLeftTo(navigationItem, skipSmallTranslation = false) {
|
|
177
|
-
const listItem = navigationItem.closest('post-list-item');
|
|
178
|
-
// Get the left edge position of the list item relative to the left of the screen
|
|
179
|
-
const leftEdgePosition = listItem.offsetLeft;
|
|
180
|
-
// Calculate the first visible position on the screen to the left, right after the left scroll button
|
|
181
|
-
const firstVisiblePosition = this.leftScrollButton.clientWidth;
|
|
182
|
-
// If the item is already fully visible, no translation is needed
|
|
183
|
-
if (leftEdgePosition > firstVisiblePosition)
|
|
184
|
-
return false;
|
|
185
|
-
const translationDecrease = firstVisiblePosition - leftEdgePosition + 1; // + 1 because offset values are rounded
|
|
186
|
-
// If the required scroll distance is too small (less than half the width of the item), don't perform the scroll
|
|
187
|
-
if (skipSmallTranslation && translationDecrease < listItem.clientWidth / 2)
|
|
188
|
-
return false;
|
|
189
|
-
// Calculate the minimum allowed translation amount (no negative scrolling allowed)
|
|
190
|
-
const minimumTranslation = 0;
|
|
191
|
-
// Adjust the translation amount, ensuring it doesn't go below the minimum scrollable area
|
|
192
|
-
const { marginLeft } = getComputedStyle(this.navigationList);
|
|
193
|
-
this.translationAmount = Math.max(this.translationAmount - translationDecrease - parseInt(marginLeft), minimumTranslation);
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Returns the navigation list container element
|
|
198
|
-
*/
|
|
199
|
-
get navigationList() {
|
|
200
|
-
return this.navbar.querySelector(NAVIGATION_LIST_SELECTOR);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Returns the navigation items
|
|
204
|
-
*/
|
|
205
|
-
get navigationItems() {
|
|
206
|
-
return this.navbar.querySelectorAll(NAVIGATION_ITEM_SELECTOR);
|
|
123
|
+
scrollLeft() {
|
|
124
|
+
const scrollLeftRightEdge = document
|
|
125
|
+
.querySelector('.scroll-left')
|
|
126
|
+
.getBoundingClientRect().right;
|
|
127
|
+
for (const navigationItem of this.navigationItems.reverse()) {
|
|
128
|
+
const { left, width } = navigationItem.getBoundingClientRect();
|
|
129
|
+
// Scroll to the first navigation item that is less than 75% visible
|
|
130
|
+
const isThreeQuartersVisible = left + 0.25 * width > scrollLeftRightEdge;
|
|
131
|
+
if (!isThreeQuartersVisible) {
|
|
132
|
+
this.navbar.scrollBy({ left: left - scrollLeftRightEdge });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
207
136
|
}
|
|
208
137
|
/**
|
|
209
138
|
* Temporarily disables interactions with the navbar during scrolling to prevent accidental clicks.
|
|
210
139
|
* Re-enables interactions after a brief delay to avoid blocking the user entirely.
|
|
211
140
|
*/
|
|
212
|
-
|
|
141
|
+
temporarilyDisableNavbar() {
|
|
213
142
|
if (this.navbarDisableTimer)
|
|
214
143
|
clearTimeout(this.navbarDisableTimer);
|
|
215
|
-
this.navbar.
|
|
144
|
+
this.navbar.setAttribute('inert', '');
|
|
216
145
|
this.navbarDisableTimer = setTimeout(() => {
|
|
217
|
-
this.navbar.
|
|
146
|
+
this.navbar.removeAttribute('inert');
|
|
218
147
|
}, NAVBAR_DISABLE_DURATION);
|
|
219
148
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Allows to translate the navbar without a transition
|
|
222
|
-
*/
|
|
223
|
-
withoutTransition(callback) {
|
|
224
|
-
const transition = this.navbar.style.transition;
|
|
225
|
-
this.navbar.style.transition = 'none';
|
|
226
|
-
callback();
|
|
227
|
-
setTimeout(() => {
|
|
228
|
-
this.navbar.style.transition = transition;
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
149
|
render() {
|
|
232
|
-
return (h(Host, { key: '
|
|
150
|
+
return (h(Host, { key: '6cd850555585d87eb25e3f6892b8010f5e4d23d6', slot: "post-mainnavigation", version: version }, h("div", { key: '3411008120d072920f4de0b71c9dc014748f1390', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '2e3747380cb546bd6da77e5ffba2403586205a55', name: "back-button" })), h("div", { key: 'e9eedd836b3f679ba2861109db2d0811c1142677', "aria-hidden": "true", class: { 'scroll-control scroll-left': true, 'd-none': !this.canScrollLeft }, onMouseDown: e => this.handleScrollButtonClick(e, 'left') }, h("post-icon", { key: '628511a2c1812a08828e1aa2b51f26ad01a5a2cf', "aria-hidden": "true", name: "chevronleft" })), h("nav", { key: '1b660d65e1984e8701a98a369046f391fd177338', ref: el => (this.navbar = el) }, h("slot", { key: '0eb35366ac0bd58509afd6a12f68c2b09396a497' })), h("div", { key: '11145ad6602e2df78d3c3f4643cc6e4e960775aa', "aria-hidden": "true", class: { 'scroll-control scroll-right': true, 'd-none': !this.canScrollRight }, onMouseDown: e => this.handleScrollButtonClick(e, 'right') }, h("post-icon", { key: '26e795cd00221dbfb1a7632453d0d48993584b0b', "aria-hidden": "true", name: "chevronright" }))));
|
|
233
151
|
}
|
|
234
152
|
static get is() { return "post-mainnavigation"; }
|
|
235
153
|
static get originalStyleUrls() {
|
|
@@ -245,17 +163,9 @@ export class PostMainnavigation {
|
|
|
245
163
|
static get states() {
|
|
246
164
|
return {
|
|
247
165
|
"canScrollLeft": {},
|
|
248
|
-
"canScrollRight": {}
|
|
249
|
-
"translationAmount": {}
|
|
166
|
+
"canScrollRight": {}
|
|
250
167
|
};
|
|
251
168
|
}
|
|
252
|
-
static get elementRef() { return "host"; }
|
|
253
|
-
static get watchers() {
|
|
254
|
-
return [{
|
|
255
|
-
"propName": "translationAmount",
|
|
256
|
-
"methodName": "onTranslateAmountChanges"
|
|
257
|
-
}];
|
|
258
|
-
}
|
|
259
169
|
static get listeners() {
|
|
260
170
|
return [{
|
|
261
171
|
"name": "mouseup",
|
|
@@ -263,6 +173,12 @@ export class PostMainnavigation {
|
|
|
263
173
|
"target": "window",
|
|
264
174
|
"capture": false,
|
|
265
175
|
"passive": true
|
|
176
|
+
}, {
|
|
177
|
+
"name": "mouseleave",
|
|
178
|
+
"method": "stopScrolling",
|
|
179
|
+
"target": "window",
|
|
180
|
+
"capture": false,
|
|
181
|
+
"passive": true
|
|
266
182
|
}];
|
|
267
183
|
}
|
|
268
184
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;inset-block-start:100%;inset-inline-start:0;border-radius:0}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;position:fixed;inset-block-start:var(--header-navigation-current-inset);inset-inline:0;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height));border-block-start:unset;overflow-y:auto;overscroll-behavior:contain}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}@media screen and (min-width: 1024px){.megadropdown-container{max-height:calc(100vh - var(--header-height) - 48px);overflow-y:auto}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-block:0 8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-block:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:"";background-color:#050400;inset-block-end:0;inset-inline-start:0;width:100%;height:2px;position:absolute}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-block-end:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}
|
|
1
|
+
@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;inset-block-start:100%;inset-inline-start:0;border-radius:0}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;position:fixed;inset-block-start:var(--header-navigation-current-inset);inset-inline:0;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));border-block-start:unset;overflow-y:auto;overscroll-behavior:contain}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}@media screen and (min-width: 1024px){.megadropdown-container{max-height:calc(100vh - var(--post-header-height) - 48px);overflow-y:auto}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-block:0 8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-block:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:"";background-color:#050400;inset-block-end:0;inset-inline-start:0;width:100%;height:2px;position:absolute}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-block-end:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}
|
|
@@ -4,28 +4,34 @@ import { version } from "../../../../package";
|
|
|
4
4
|
import { breakpoint } from "../../utils/breakpoints";
|
|
5
5
|
export class PostMegadropdown {
|
|
6
6
|
constructor() {
|
|
7
|
+
this.handleClickOutside = (event) => {
|
|
8
|
+
if (this.device !== 'desktop')
|
|
9
|
+
return;
|
|
10
|
+
const target = event.target;
|
|
11
|
+
if (this.host.contains(target)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (target instanceof HTMLElement) {
|
|
15
|
+
const trigger = target.closest('post-megadropdown-trigger');
|
|
16
|
+
if (trigger) {
|
|
17
|
+
const targetDropdownId = trigger.getAttribute('for');
|
|
18
|
+
if (targetDropdownId !== this.host.id) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
this.hide(false);
|
|
24
|
+
};
|
|
7
25
|
this.device = breakpoint.get('name');
|
|
8
26
|
this.isVisible = false;
|
|
9
27
|
this.animationClass = null;
|
|
10
28
|
}
|
|
11
|
-
firstFocusableEl;
|
|
12
|
-
lastFocusableEl;
|
|
13
|
-
host;
|
|
14
|
-
/** Tracks the currently active dropdown instance. */
|
|
15
|
-
static activeDropdown = null;
|
|
16
29
|
breakpointChange(e) {
|
|
17
30
|
this.device = e.detail;
|
|
18
31
|
if (this.device === 'desktop' && this.isVisible) {
|
|
19
32
|
this.animationClass = null;
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Emits when the dropdown is shown or hidden.
|
|
24
|
-
* The event payload is an object.
|
|
25
|
-
* `isVisible` is true when the dropdown gets opened and false when it gets closed
|
|
26
|
-
* `focusParent` determines whether after the closing of the mega dropdown, the focus should go back to the trigger parent or naturally go to the next focusable element in the page
|
|
27
|
-
**/
|
|
28
|
-
postToggleMegadropdown;
|
|
29
35
|
disconnectedCallback() {
|
|
30
36
|
this.removeListeners();
|
|
31
37
|
window.removeEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
|
|
@@ -105,24 +111,6 @@ export class PostMegadropdown {
|
|
|
105
111
|
this.removeListeners();
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
|
-
handleClickOutside = (event) => {
|
|
109
|
-
if (this.device !== 'desktop')
|
|
110
|
-
return;
|
|
111
|
-
const target = event.target;
|
|
112
|
-
if (this.host.contains(target)) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (target instanceof HTMLElement) {
|
|
116
|
-
const trigger = target.closest('post-megadropdown-trigger');
|
|
117
|
-
if (trigger) {
|
|
118
|
-
const targetDropdownId = trigger.getAttribute('for');
|
|
119
|
-
if (targetDropdownId !== this.host.id) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
this.hide(false);
|
|
125
|
-
};
|
|
126
114
|
addListeners() {
|
|
127
115
|
this.host.addEventListener('keydown', e => this.keyboardHandler(e));
|
|
128
116
|
document.addEventListener('keyup', e => this.handleTabOutside(e));
|
|
@@ -283,3 +271,5 @@ export class PostMegadropdown {
|
|
|
283
271
|
}
|
|
284
272
|
static get elementRef() { return "host"; }
|
|
285
273
|
}
|
|
274
|
+
/** Tracks the currently active dropdown instance. */
|
|
275
|
+
PostMegadropdown.activeDropdown = null;
|
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { version } from "../../../../package";
|
|
3
3
|
import { checkType } from "../../utils/index";
|
|
4
|
+
import { eventGuard } from "../../utils/event-gua";
|
|
4
5
|
export class PostMegadropdownTrigger {
|
|
5
6
|
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* Reference to the slotted button within the trigger, if present.
|
|
9
|
+
* Used to manage click and key events for mega dropdown control.
|
|
10
|
+
*/
|
|
11
|
+
this.slottedButton = null;
|
|
12
|
+
/**
|
|
13
|
+
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
14
|
+
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
15
|
+
*/
|
|
16
|
+
this.wasExpanded = false;
|
|
17
|
+
this.handleKeyDown = (event) => {
|
|
18
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
this.handleToggle();
|
|
21
|
+
if (this.megadropdown && !this.ariaExpanded) {
|
|
22
|
+
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.handleToggleMegadropdown = (event) => {
|
|
27
|
+
eventGuard(this.host, event, { targetLocalName: 'post-megadropdown' }, () => {
|
|
28
|
+
if (event.target.id === this.for) {
|
|
29
|
+
this.ariaExpanded = event.detail.isVisible;
|
|
30
|
+
// Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
|
|
31
|
+
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
this.slottedButton?.focus();
|
|
34
|
+
}, 100);
|
|
35
|
+
}
|
|
36
|
+
this.wasExpanded = this.ariaExpanded;
|
|
37
|
+
if (this.slottedButton) {
|
|
38
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
6
43
|
this.for = undefined;
|
|
7
44
|
this.ariaExpanded = false;
|
|
8
45
|
}
|
|
9
|
-
host;
|
|
10
|
-
/**
|
|
11
|
-
* Reference to the slotted button within the trigger, if present.
|
|
12
|
-
* Used to manage click and key events for mega dropdown control.
|
|
13
|
-
*/
|
|
14
|
-
slottedButton = null;
|
|
15
|
-
/**
|
|
16
|
-
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
17
|
-
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
18
|
-
*/
|
|
19
|
-
wasExpanded = false;
|
|
20
46
|
/**
|
|
21
47
|
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
22
48
|
* @param forValue - The new value of the `for` property.
|
|
@@ -38,33 +64,10 @@ export class PostMegadropdownTrigger {
|
|
|
38
64
|
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
39
65
|
}
|
|
40
66
|
}
|
|
41
|
-
handleKeyDown = (event) => {
|
|
42
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
this.handleToggle();
|
|
45
|
-
if (this.megadropdown && !this.ariaExpanded) {
|
|
46
|
-
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
67
|
componentDidLoad() {
|
|
51
68
|
this.validateControlFor();
|
|
52
69
|
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
53
|
-
document.addEventListener('postToggleMegadropdown',
|
|
54
|
-
if (event.target.id === this.for) {
|
|
55
|
-
this.ariaExpanded = event.detail.isVisible;
|
|
56
|
-
// Focus on the trigger parent of the dropdown after it's closed if close button had been clicked
|
|
57
|
-
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
this.slottedButton?.focus();
|
|
60
|
-
}, 100);
|
|
61
|
-
}
|
|
62
|
-
this.wasExpanded = this.ariaExpanded;
|
|
63
|
-
if (this.slottedButton) {
|
|
64
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
70
|
+
document.addEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
|
|
68
71
|
this.slottedButton = this.host.querySelector('button');
|
|
69
72
|
if (this.slottedButton) {
|
|
70
73
|
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
@@ -77,8 +80,11 @@ export class PostMegadropdownTrigger {
|
|
|
77
80
|
console.warn('No button found within post-megadropdown-trigger');
|
|
78
81
|
}
|
|
79
82
|
}
|
|
83
|
+
disconnectedCallback() {
|
|
84
|
+
document.removeEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
|
|
85
|
+
}
|
|
80
86
|
render() {
|
|
81
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: '86b85efede8d9b19f3f0560f500f33f5e172177f', "data-version": version, "tab-index": "-1" }, h("button", { key: '0f810e4c38bc4abf23ac60ab27b36d408e7ced0d' }, h("slot", { key: '2a522ac7e15ef8ac077b73cdebf629b89ea173c6' }))));
|
|
82
88
|
}
|
|
83
89
|
static get is() { return "post-megadropdown-trigger"; }
|
|
84
90
|
static get originalStyleUrls() {
|