@swisspost/design-system-components 9.0.0-next.1 → 9.0.0-next.11
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/check-type-64af82a9.js +16 -0
- package/dist/cjs/check-url-3ffdd2fb.js +14 -0
- package/dist/cjs/debounce-1151afe3.js +12 -0
- package/dist/cjs/get-root-7a3498ef.js +11 -0
- package/dist/cjs/{index-01f30442.js → index-5d4e0aed.js} +4 -27
- package/dist/cjs/{index-c15bd800.js → index-f1b08cdb.js} +45 -16
- package/dist/cjs/index.browser-2f65f583.js +15 -0
- package/dist/cjs/index.cjs.js +51 -24
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-c7d01968.js → package-5fdfea90.js} +1 -1
- package/dist/cjs/{post-accordion-e29956c4.js → post-accordion-dabc9271.js} +3 -3
- package/dist/cjs/post-accordion-item-9dadc543.js +64 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +7 -4
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/post-avatar-fddda407.js +148 -0
- package/dist/cjs/post-avatar.cjs.entry.js +13 -0
- package/dist/cjs/post-back-to-top-6dfbcd1b.js +75 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
- package/dist/cjs/post-banner-6df79142.js +91 -0
- package/dist/cjs/post-banner.cjs.entry.js +19 -0
- package/dist/cjs/post-breadcrumb-b05fb572.js +111 -0
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
- package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-97ed732c.js +272 -0
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +34 -0
- package/dist/cjs/{post-collapsible-trigger-32549d33.js → post-collapsible-trigger-94f1bbd9.js} +14 -26
- package/dist/cjs/post-collapsible_2.cjs.entry.js +8 -4
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer-f95510e4.js +84 -0
- package/dist/cjs/post-footer.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-106036fa.js +69 -0
- package/dist/cjs/{post-popover-cfc1b31b.js → post-popover-cc55d371.js} +4 -4
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-b9b8b6f3.js → post-rating-4aa3fabb.js} +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-1eee4cbf.js +33 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-300a0618.js → post-tab-panel-77162d5b.js} +5 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
- package/dist/cjs/{post-tabs-b06f799b.js → post-tabs-ee832221.js} +9 -7
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tag-8778a125.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-popovercontainer-c0b86b11.js → post-togglebutton-00632399.js} +1167 -42
- package/dist/cjs/{post-tooltip-8d7e64f6.js → post-tooltip-d3dd17b2.js} +31 -19
- package/dist/cjs/post-tooltip.cjs.entry.js +6 -4
- package/dist/cjs/slide-5d51abe8.js +28 -0
- package/dist/collection/animations/slide.js +23 -0
- package/dist/collection/collection-manifest.json +21 -3
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +26 -9
- package/dist/collection/components/post-avatar/post-avatar.css +3 -0
- package/dist/collection/components/post-avatar/post-avatar.js +237 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +107 -0
- package/dist/collection/components/post-banner/banner-types.js +1 -0
- package/dist/collection/components/post-banner/post-banner.css +3 -0
- package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +41 -69
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +161 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +93 -0
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +8 -8
- package/dist/collection/components/post-closebutton/post-closebutton.js +12 -0
- package/dist/collection/components/post-collapsible/post-collapsible.js +5 -3
- package/dist/collection/components/post-footer/post-footer.css +1 -0
- package/dist/collection/components/post-footer/post-footer.js +75 -0
- package/dist/collection/components/post-header/post-header.css +1 -0
- package/dist/collection/components/post-header/post-header.js +172 -0
- package/dist/collection/components/post-icon/post-icon.js +22 -30
- package/dist/collection/components/post-language-option/post-language-option.css +3 -0
- package/dist/collection/components/post-language-option/post-language-option.js +219 -0
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
- package/dist/collection/components/post-language-switch/post-language-switch.js +163 -0
- package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
- package/dist/collection/components/post-list/post-list.css +3 -0
- package/dist/collection/components/post-list/post-list.js +88 -0
- package/dist/collection/components/post-list-item/post-list-item.css +1 -0
- package/dist/collection/components/post-list-item/post-list-item.js +25 -0
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-logo/post-logo.js +2 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +52 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +158 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +104 -0
- package/dist/collection/components/post-menu/post-menu.css +3 -0
- package/dist/collection/components/post-menu/post-menu.js +280 -0
- package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +114 -0
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +2 -2
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +27 -7
- package/dist/collection/components/post-rating/post-rating.css +1 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +3 -2
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +3 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +6 -4
- package/dist/collection/components/post-tag/post-tag.css +1 -1
- package/dist/collection/components/post-tag/post-tag.js +2 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +74 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +29 -13
- package/dist/collection/index.js +20 -2
- package/dist/collection/utils/breakpoints.js +46 -0
- package/dist/collection/utils/get-focusable-children.js +27 -0
- package/dist/components/debounce.js +10 -0
- package/dist/components/get-root.js +9 -0
- package/dist/components/index.browser.js +13 -0
- package/dist/components/index.js +20 -2
- package/dist/components/index2.js +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +33 -13
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/post-avatar.d.ts +11 -0
- package/dist/components/post-avatar.js +6 -0
- package/dist/components/post-avatar2.js +173 -0
- package/dist/components/post-back-to-top.d.ts +11 -0
- package/dist/components/post-back-to-top.js +6 -0
- package/dist/components/post-back-to-top2.js +100 -0
- package/dist/components/post-banner.d.ts +11 -0
- package/dist/components/post-banner.js +6 -0
- package/dist/components/post-banner2.js +126 -0
- package/dist/components/post-breadcrumb-item.d.ts +11 -0
- package/dist/components/post-breadcrumb-item.js +6 -0
- package/dist/components/post-breadcrumb-item2.js +82 -0
- package/dist/components/post-breadcrumb.d.ts +11 -0
- package/dist/components/post-breadcrumb.js +6 -0
- package/dist/components/post-breadcrumb2.js +168 -0
- package/dist/components/post-card-control2.js +3 -3
- package/dist/components/post-closebutton.d.ts +11 -0
- package/dist/components/post-closebutton.js +6 -0
- package/dist/components/post-closebutton2.js +34 -0
- package/dist/components/post-collapsible-trigger2.js +2 -17
- package/dist/components/post-collapsible2.js +6 -4
- package/dist/components/post-footer.d.ts +11 -0
- package/dist/components/post-footer.js +6 -0
- package/dist/components/post-footer2.js +124 -0
- package/dist/components/post-header.d.ts +11 -0
- package/dist/components/post-header.js +6 -0
- package/dist/components/post-header2.js +279 -0
- package/dist/components/post-icon2.js +24 -28
- package/dist/components/post-language-option.d.ts +11 -0
- package/dist/components/post-language-option.js +6 -0
- package/dist/components/post-language-option2.js +98 -0
- package/dist/components/post-language-switch.d.ts +11 -0
- package/dist/components/post-language-switch.js +6 -0
- package/dist/components/post-language-switch2.js +135 -0
- package/dist/components/post-list-item.d.ts +11 -0
- package/dist/components/post-list-item.js +6 -0
- package/dist/components/post-list-item2.js +35 -0
- package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/dist/components/post-list.js +6 -0
- package/dist/components/post-list2.js +54 -0
- package/dist/components/post-logo2.js +3 -3
- package/dist/components/post-mainnavigation.d.ts +11 -0
- package/dist/components/post-mainnavigation.js +6 -0
- package/dist/components/post-mainnavigation2.js +48 -0
- package/dist/components/post-megadropdown-trigger.d.ts +11 -0
- package/dist/components/post-megadropdown-trigger.js +6 -0
- package/dist/components/post-megadropdown-trigger2.js +91 -0
- package/dist/components/post-megadropdown.d.ts +11 -0
- package/dist/components/post-megadropdown.js +6 -0
- package/dist/components/post-megadropdown2.js +100 -0
- package/dist/components/post-menu-item.d.ts +11 -0
- package/dist/components/post-menu-item.js +6 -0
- package/dist/components/post-menu-item2.js +27 -0
- package/dist/components/post-menu-trigger.d.ts +11 -0
- package/dist/components/post-menu-trigger.js +6 -0
- package/dist/components/post-menu-trigger2.js +102 -0
- package/dist/components/post-menu.d.ts +11 -0
- package/dist/components/post-menu.js +6 -0
- package/dist/components/post-menu2.js +204 -0
- package/dist/components/post-popover2.js +2 -2
- package/dist/components/post-popovercontainer2.js +95 -28
- package/dist/components/post-rating2.js +2 -2
- package/dist/components/post-tab-header2.js +4 -3
- package/dist/components/post-tab-panel2.js +3 -2
- package/dist/components/post-tabs2.js +7 -5
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/post-togglebutton.d.ts +11 -0
- package/dist/components/post-togglebutton.js +6 -0
- package/dist/components/post-togglebutton2.js +61 -0
- package/dist/components/post-tooltip2.js +29 -17
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +1875 -288
- package/dist/esm/check-type-8828dbe4.js +14 -0
- package/dist/esm/check-url-a974431e.js +12 -0
- package/dist/esm/debounce-abe98cc2.js +10 -0
- package/dist/esm/get-root-7af2e0d1.js +9 -0
- package/dist/esm/{index-0b56fc28.js → index-6bfe6554.js} +45 -16
- package/dist/esm/index-b49c9904.js +24 -0
- package/dist/esm/index.browser-51485f85.js +13 -0
- package/dist/esm/index.js +28 -19
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-cf78d928.js +3 -0
- package/dist/esm/{post-accordion-3a7b3f3c.js → post-accordion-25df8744.js} +3 -3
- package/dist/esm/post-accordion-item-33fb36df.js +62 -0
- package/dist/esm/post-accordion-item.entry.js +7 -4
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/post-avatar-731aafd6.js +146 -0
- package/dist/esm/post-avatar.entry.js +5 -0
- package/dist/esm/post-back-to-top-3a6b6203.js +73 -0
- package/dist/esm/post-back-to-top.entry.js +7 -0
- package/dist/esm/post-banner-b2eb796c.js +89 -0
- package/dist/esm/post-banner.entry.js +11 -0
- package/dist/esm/post-breadcrumb-0a99384c.js +109 -0
- package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
- package/dist/esm/post-breadcrumb.entry.js +5 -0
- package/dist/esm/post-card-control-ff272e38.js +270 -0
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/post-closebutton_15.entry.js +12 -0
- package/dist/esm/{post-collapsible-trigger-8d7e027b.js → post-collapsible-trigger-7fc4d61c.js} +11 -23
- package/dist/esm/post-collapsible_2.entry.js +8 -4
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer-97bbd770.js +82 -0
- package/dist/esm/post-footer.entry.js +3 -0
- package/dist/esm/post-menu-item-ae066299.js +66 -0
- package/dist/esm/{post-popover-972c5ea7.js → post-popover-62e33068.js} +4 -4
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-rating-cca784ae.js → post-rating-ee73a51b.js} +4 -4
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-dac84177.js +31 -0
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-633a5e6b.js → post-tab-panel-5e35e7df.js} +5 -4
- package/dist/esm/post-tab-panel.entry.js +4 -3
- package/dist/esm/{post-tabs-74ded897.js → post-tabs-b614a577.js} +9 -7
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tag-413626e4.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-popovercontainer-2485b7d9.js → post-togglebutton-caf0000b.js} +1154 -43
- package/dist/esm/{post-tooltip-0457467f.js → post-tooltip-b0f1b147.js} +31 -19
- package/dist/esm/post-tooltip.entry.js +6 -4
- package/dist/esm/slide-3422b8a3.js +25 -0
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-012a39b8.js +1 -0
- package/dist/post-components/p-0a74bc53.js +1 -0
- package/dist/post-components/p-0addae0c.entry.js +1 -0
- package/dist/post-components/p-0e216cc4.js +2 -0
- package/dist/post-components/p-128b11b3.js +1 -0
- package/dist/post-components/p-13ae0f4d.entry.js +1 -0
- package/dist/post-components/p-15173f46.js +1 -0
- package/dist/post-components/p-189a07cf.entry.js +1 -0
- package/dist/post-components/p-18b84db7.entry.js +1 -0
- package/dist/post-components/p-2571a1be.entry.js +1 -0
- package/dist/post-components/p-2747a945.js +1 -0
- package/dist/post-components/p-32165625.js +1 -0
- package/dist/post-components/p-42ef1d9f.entry.js +1 -0
- package/dist/post-components/p-465e9eee.entry.js +1 -0
- package/dist/post-components/p-4a3f67ab.js +1 -0
- package/dist/post-components/p-515e0f96.js +1 -0
- package/dist/post-components/p-5467b223.js +1 -0
- package/dist/post-components/p-5959f2bd.js +1 -0
- package/dist/post-components/p-60ea48ce.js +1 -0
- package/dist/post-components/p-61cff5d9.entry.js +1 -0
- package/dist/post-components/p-723ad003.entry.js +1 -0
- package/dist/post-components/p-73863597.js +1 -0
- package/dist/post-components/p-761723b6.js +1 -0
- package/dist/post-components/p-7c966321.js +1 -0
- package/dist/post-components/p-8e808ae6.js +1 -0
- package/dist/post-components/p-92611da2.entry.js +1 -0
- package/dist/post-components/p-990db73a.js +1 -0
- package/dist/post-components/p-99b12d43.entry.js +1 -0
- package/dist/post-components/p-9fbb33c2.entry.js +1 -0
- package/dist/post-components/p-a43a3cdb.js +1 -0
- package/dist/post-components/p-ad770600.entry.js +1 -0
- package/dist/post-components/p-af48ed67.entry.js +1 -0
- package/dist/post-components/p-b22656b1.js +1 -0
- package/dist/post-components/p-c4139fb9.js +1 -0
- package/dist/post-components/p-cc55b611.js +1 -0
- package/dist/post-components/{p-01a8fe6a.js → p-d45f8861.js} +3 -3
- package/dist/post-components/p-d4f93f2b.js +1 -0
- package/dist/post-components/p-dc11a5d5.entry.js +1 -0
- package/dist/post-components/{p-41094063.js → p-df9ea014.js} +1 -1
- package/dist/post-components/p-e1dc7f01.entry.js +1 -0
- package/dist/post-components/p-e533625e.js +1 -0
- package/dist/post-components/p-f0da081f.entry.js +1 -0
- package/dist/post-components/p-f380a026.entry.js +1 -0
- package/dist/post-components/p-fbcc89be.js +1 -0
- package/dist/post-components/p-fc91cbc2.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/slide.d.ts +2 -0
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +7 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +51 -0
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
- package/dist/types/components/post-banner/banner-types.d.ts +2 -0
- package/dist/types/components/post-banner/post-banner.d.ts +49 -0
- package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +16 -0
- package/dist/types/components/post-card-control/post-card-control.d.ts +7 -7
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
- package/dist/types/components/post-footer/post-footer.d.ts +23 -0
- package/dist/types/components/post-header/post-header.d.ts +33 -0
- package/dist/types/components/post-icon/post-icon.d.ts +3 -6
- package/dist/types/components/post-language-option/post-language-option.d.ts +45 -0
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
- package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
- package/dist/types/components/post-list/post-list.d.ts +24 -0
- package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
- package/dist/types/components/post-logo/post-logo.d.ts +1 -1
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +19 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +36 -0
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +25 -0
- package/dist/types/components/post-menu/post-menu.d.ts +48 -0
- package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +27 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +4 -0
- package/dist/types/components/post-tag/post-tag.d.ts +1 -1
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
- package/dist/types/components.d.ts +570 -44
- package/dist/types/index.d.ts +20 -2
- package/dist/types/utils/breakpoints.d.ts +11 -0
- package/dist/types/utils/get-focusable-children.d.ts +1 -0
- package/dist/types/utils/get-root.d.ts +1 -1
- package/loaders/debounce.js +10 -0
- package/loaders/get-root.js +9 -0
- package/loaders/index.browser.js +13 -0
- package/loaders/index.d.ts +38 -2
- package/loaders/index.js +20 -2
- package/loaders/index2.js +1 -1
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +1 -81
- package/loaders/post-accordion-item2.js +103 -0
- package/loaders/post-accordion.js +1 -1
- package/loaders/post-avatar.d.ts +11 -0
- package/loaders/post-avatar.js +176 -0
- package/loaders/post-back-to-top.d.ts +11 -0
- package/loaders/post-back-to-top.js +103 -0
- package/loaders/post-banner.d.ts +11 -0
- package/loaders/post-banner.js +129 -0
- package/loaders/post-breadcrumb-item.d.ts +11 -0
- package/loaders/post-breadcrumb-item.js +6 -0
- package/loaders/post-breadcrumb-item2.js +82 -0
- package/loaders/post-breadcrumb.d.ts +11 -0
- package/loaders/post-breadcrumb.js +171 -0
- package/loaders/post-card-control.js +3 -3
- package/loaders/post-closebutton.d.ts +11 -0
- package/loaders/post-closebutton.js +37 -0
- package/loaders/post-collapsible-trigger2.js +2 -17
- package/loaders/post-collapsible2.js +5 -3
- package/loaders/post-footer.d.ts +11 -0
- package/loaders/post-footer.js +127 -0
- package/loaders/post-header.d.ts +11 -0
- package/loaders/post-header.js +282 -0
- package/loaders/post-icon2.js +24 -28
- package/loaders/post-language-option.d.ts +11 -0
- package/loaders/post-language-option.js +101 -0
- package/loaders/post-language-switch.d.ts +11 -0
- package/loaders/post-language-switch.js +138 -0
- package/loaders/post-list-item.d.ts +11 -0
- package/loaders/post-list-item.js +38 -0
- package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/loaders/post-list.js +57 -0
- package/loaders/post-logo.js +4 -4
- package/loaders/post-mainnavigation.d.ts +11 -0
- package/loaders/post-mainnavigation.js +51 -0
- package/loaders/post-megadropdown-trigger.d.ts +11 -0
- package/loaders/post-megadropdown-trigger.js +94 -0
- package/loaders/post-megadropdown.d.ts +11 -0
- package/loaders/post-megadropdown.js +103 -0
- package/loaders/post-menu-item.d.ts +11 -0
- package/loaders/post-menu-item.js +6 -0
- package/loaders/post-menu-item2.js +27 -0
- package/loaders/post-menu-trigger.d.ts +11 -0
- package/loaders/post-menu-trigger.js +6 -0
- package/loaders/post-menu-trigger2.js +102 -0
- package/loaders/post-menu.d.ts +11 -0
- package/loaders/post-menu.js +6 -0
- package/loaders/post-menu2.js +204 -0
- package/loaders/post-popover.js +2 -2
- package/loaders/post-popovercontainer2.js +95 -28
- package/loaders/post-rating.js +2 -2
- package/loaders/post-tab-header.js +4 -3
- package/loaders/post-tab-panel.js +3 -2
- package/loaders/post-tabs.js +7 -5
- package/loaders/post-tag.js +2 -2
- package/loaders/post-togglebutton.d.ts +11 -0
- package/loaders/post-togglebutton.js +64 -0
- package/loaders/post-tooltip.js +28 -16
- package/loaders/slide.js +25 -0
- package/package.json +16 -13
- package/dist/cjs/post-accordion-item-dc4d1801.js +0 -51
- package/dist/cjs/post-alert-106c34ac.js +0 -98
- package/dist/cjs/post-alert.cjs.entry.js +0 -16
- package/dist/cjs/post-card-control-69769d1a.js +0 -272
- package/dist/cjs/post-icon-221d976f.js +0 -104
- package/dist/cjs/post-icon.cjs.entry.js +0 -15
- package/dist/cjs/post-logo-e6cb079f.js +0 -39
- package/dist/cjs/post-logo.cjs.entry.js +0 -14
- package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
- package/dist/cjs/post-tab-header-43310d08.js +0 -32
- package/dist/cjs/post-tag-d7ac3cbb.js +0 -47
- package/dist/collection/components/post-alert/alert-types.js +0 -1
- package/dist/collection/components/post-alert/post-alert.css +0 -7
- package/dist/components/post-alert.js +0 -6
- package/dist/components/post-alert2.js +0 -136
- package/dist/esm/index-f41b763f.js +0 -46
- package/dist/esm/package-bc6404e2.js +0 -3
- package/dist/esm/post-accordion-item-55d1e771.js +0 -49
- package/dist/esm/post-alert-6c908130.js +0 -96
- package/dist/esm/post-alert.entry.js +0 -8
- package/dist/esm/post-card-control-9fff6efc.js +0 -270
- package/dist/esm/post-icon-d59ad345.js +0 -102
- package/dist/esm/post-icon.entry.js +0 -7
- package/dist/esm/post-logo-a1487634.js +0 -37
- package/dist/esm/post-logo.entry.js +0 -6
- package/dist/esm/post-popovercontainer.entry.js +0 -3
- package/dist/esm/post-tab-header-dd2cb68e.js +0 -30
- package/dist/esm/post-tag-f60a71fd.js +0 -45
- package/dist/post-components/p-0e0c11f9.entry.js +0 -1
- package/dist/post-components/p-124fe6c8.js +0 -1
- package/dist/post-components/p-15c6739e.entry.js +0 -1
- package/dist/post-components/p-2180e02d.entry.js +0 -1
- package/dist/post-components/p-22ec06ae.entry.js +0 -1
- package/dist/post-components/p-26bbd8e5.entry.js +0 -1
- package/dist/post-components/p-2b43665d.js +0 -1
- package/dist/post-components/p-2d1f85f4.js +0 -1
- package/dist/post-components/p-464ce10a.entry.js +0 -1
- package/dist/post-components/p-51eff367.js +0 -1
- package/dist/post-components/p-586f7f53.entry.js +0 -1
- package/dist/post-components/p-65031b20.entry.js +0 -1
- package/dist/post-components/p-6d9c46f4.js +0 -1
- package/dist/post-components/p-6f12f3e5.js +0 -1
- package/dist/post-components/p-718eb560.js +0 -1
- package/dist/post-components/p-78407640.entry.js +0 -1
- package/dist/post-components/p-79a40235.entry.js +0 -1
- package/dist/post-components/p-7ab513fc.js +0 -1
- package/dist/post-components/p-9cba7d2f.js +0 -1
- package/dist/post-components/p-9eb27378.entry.js +0 -1
- package/dist/post-components/p-a528acc4.js +0 -1
- package/dist/post-components/p-aa8e43c3.js +0 -1
- package/dist/post-components/p-b68c86a7.js +0 -1
- package/dist/post-components/p-b8db0e0a.entry.js +0 -1
- package/dist/post-components/p-bcd5843c.entry.js +0 -1
- package/dist/post-components/p-c21b810d.js +0 -1
- package/dist/post-components/p-c386219b.js +0 -1
- package/dist/post-components/p-d2f9de94.js +0 -2
- package/dist/post-components/p-deb4131c.js +0 -1
- package/dist/post-components/p-e7c67ff0.entry.js +0 -1
- package/dist/post-components/p-f10e2bb1.entry.js +0 -1
- package/dist/types/components/post-alert/alert-types.d.ts +0 -2
- package/dist/types/components/post-alert/post-alert.d.ts +0 -54
- package/loaders/post-alert.js +0 -139
|
@@ -1,7 +1,1015 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-f1b08cdb.js');
|
|
4
|
+
const _package = require('./package-5fdfea90.js');
|
|
5
|
+
const slide = require('./slide-5d51abe8.js');
|
|
6
|
+
const index$1 = require('./index-5d4e0aed.js');
|
|
7
|
+
const checkNonEmpty = require('./check-non-empty-eeaa8f77.js');
|
|
8
|
+
const checkType = require('./check-type-64af82a9.js');
|
|
9
|
+
const index_browser = require('./index.browser-2f65f583.js');
|
|
10
|
+
const getRoot = require('./get-root-7a3498ef.js');
|
|
11
|
+
|
|
12
|
+
const PostClosebutton = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return (index.h(index.Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": _package.version }, index.h("button", { key: 'ece4ca00fedfd0ee76a971ca2a9cf0cf9a1e7f0c', class: "btn btn-icon-close", type: "button" }, index.h("post-icon", { key: 'c14a15906a1f229d642c2a8aea456f7a4acc5619', "aria-hidden": "true", name: "closex" }), index.h("span", { key: '94757c5e870f57ec8ba0c52fc5bb2a1f6eed91c2', class: "visually-hidden" }, index.h("slot", { key: 'a76c388cceca0b7d4da01b8e737e65f24d11df23' })))));
|
|
18
|
+
}
|
|
19
|
+
get host() { return index.getElement(this); }
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
26
|
+
* execution of handlers on events like resize and scroll.
|
|
27
|
+
*
|
|
28
|
+
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
29
|
+
* are most useful.
|
|
30
|
+
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
31
|
+
* as-is, to `callback` when the throttled-function is executed.
|
|
32
|
+
* @param {object} [options] - An object to configure options.
|
|
33
|
+
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
34
|
+
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
35
|
+
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
36
|
+
* `delay` milliseconds, the internal counter is reset).
|
|
37
|
+
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
38
|
+
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
39
|
+
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
40
|
+
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
41
|
+
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
42
|
+
*
|
|
43
|
+
* @returns {Function} A new, throttled, function.
|
|
44
|
+
*/
|
|
45
|
+
function throttle (delay, callback, options) {
|
|
46
|
+
var _ref = options || {},
|
|
47
|
+
_ref$noTrailing = _ref.noTrailing,
|
|
48
|
+
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
49
|
+
_ref$noLeading = _ref.noLeading,
|
|
50
|
+
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
51
|
+
_ref$debounceMode = _ref.debounceMode,
|
|
52
|
+
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
53
|
+
/*
|
|
54
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
55
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
56
|
+
* debounce modes.
|
|
57
|
+
*/
|
|
58
|
+
var timeoutID;
|
|
59
|
+
var cancelled = false;
|
|
60
|
+
|
|
61
|
+
// Keep track of the last time `callback` was executed.
|
|
62
|
+
var lastExec = 0;
|
|
63
|
+
|
|
64
|
+
// Function to clear existing timeout
|
|
65
|
+
function clearExistingTimeout() {
|
|
66
|
+
if (timeoutID) {
|
|
67
|
+
clearTimeout(timeoutID);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Function to cancel next exec
|
|
72
|
+
function cancel(options) {
|
|
73
|
+
var _ref2 = options || {},
|
|
74
|
+
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
75
|
+
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
76
|
+
clearExistingTimeout();
|
|
77
|
+
cancelled = !upcomingOnly;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
82
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
83
|
+
* is executed.
|
|
84
|
+
*/
|
|
85
|
+
function wrapper() {
|
|
86
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
87
|
+
arguments_[_key] = arguments[_key];
|
|
88
|
+
}
|
|
89
|
+
var self = this;
|
|
90
|
+
var elapsed = Date.now() - lastExec;
|
|
91
|
+
if (cancelled) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Execute `callback` and update the `lastExec` timestamp.
|
|
96
|
+
function exec() {
|
|
97
|
+
lastExec = Date.now();
|
|
98
|
+
callback.apply(self, arguments_);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
103
|
+
* to allow future `callback` executions.
|
|
104
|
+
*/
|
|
105
|
+
function clear() {
|
|
106
|
+
timeoutID = undefined;
|
|
107
|
+
}
|
|
108
|
+
if (!noLeading && debounceMode && !timeoutID) {
|
|
109
|
+
/*
|
|
110
|
+
* Since `wrapper` is being called for the first time and
|
|
111
|
+
* `debounceMode` is true (at begin), execute `callback`
|
|
112
|
+
* and noLeading != true.
|
|
113
|
+
*/
|
|
114
|
+
exec();
|
|
115
|
+
}
|
|
116
|
+
clearExistingTimeout();
|
|
117
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
118
|
+
if (noLeading) {
|
|
119
|
+
/*
|
|
120
|
+
* In throttle mode with noLeading, if `delay` time has
|
|
121
|
+
* been exceeded, update `lastExec` and schedule `callback`
|
|
122
|
+
* to execute after `delay` ms.
|
|
123
|
+
*/
|
|
124
|
+
lastExec = Date.now();
|
|
125
|
+
if (!noTrailing) {
|
|
126
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
/*
|
|
130
|
+
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
131
|
+
* `callback`.
|
|
132
|
+
*/
|
|
133
|
+
exec();
|
|
134
|
+
}
|
|
135
|
+
} else if (noTrailing !== true) {
|
|
136
|
+
/*
|
|
137
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
138
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
139
|
+
* recent execution.
|
|
140
|
+
*
|
|
141
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
142
|
+
* after `delay` ms.
|
|
143
|
+
*
|
|
144
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
145
|
+
* execute after `delay` ms.
|
|
146
|
+
*/
|
|
147
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
wrapper.cancel = cancel;
|
|
151
|
+
|
|
152
|
+
// Return the wrapper function.
|
|
153
|
+
return wrapper;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--global-header-minimal-height:24px;--main-header-height:56px;--main-header-min-height:56px;--header-height:calc(var(--global-header-height) + var(--main-header-height))}@media screen and (min-width: 1024px){:host{display:block;position:sticky;inset-inline:0;inset-block-start:calc(-1*(var(--global-header-height) + var(--main-header-height) - var(--global-header-minimal-height)));box-shadow:var(--post-core-elevation-3)}}@media screen and (max-width: 1023.99px){:host{--global-header-height:64px;--main-header-height:48px;--main-header-min-height:48px}}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;align-items:center;position:sticky;padding-inline:var(--post-core-dimension-4);height:var(--global-header-height);z-index:1}@media screen and (max-width: 1023.99px){.global-header{inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{padding-inline-end:var(--post-core-dimension-12);top:calc((var(--global-header-height) - var(--global-header-minimal-height))*-1)}}slot[name=post-logo]{align-self:flex-end}.global-sub{display:flex;align-items:center;gap:var(--post-core-dimension-24)}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-minimal-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0;list-style:none;display:flex;padding-left:0;gap:1rem;flex-shrink:0 !important}.title-header{display:flex;align-items:center;gap:var(--post-core-dimension-8);min-height:var(--main-header-min-height);justify-content:space-between;background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.title-header{padding:var(--post-core-dimension-18) var(--post-core-dimension-16) var(--post-core-dimension-4) var(--post-core-dimension-12)}}@media screen and (max-width: 1023.99px){.title-header{position:sticky;z-index:1;inset-block-start:var(--global-header-height);padding-inline:var(--post-core-dimension-8) var(--post-core-dimension-16);padding-block:var(--post-core-dimension-9);flex-wrap:wrap}.title-header.title-header-mobile-extended{border-bottom:1px solid var(--post-core-color-sandgrey-012)}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important;flex-shrink:10}@media screen and (min-width: 1024px){::slotted(h1){font-size:var(--post-core-font-size-28) !important}}@media screen and (max-width: 1023.99px){::slotted(h1){font-size:var(--post-core-font-size-20) !important;max-width:calc(100vw - var(--post-core-dimension-8) - var(--post-core-dimension-16))}}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{background:var(--post-core-color-brand-white)}@media screen and (min-width: 1024px){.navigation{position:sticky;z-index:1;inset-block-start:var(--global-header-minimal-height)}}@media screen and (max-width: 1023.99px){.navigation{position:fixed;inset-inline:0;inset-block-end:calc(100vh - var(--header-height));box-shadow:var(--post-core-elevation-3);min-height:var(--post-core-dimension-10);max-height:calc(100vh - var(--header-height));overflow:auto}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:var(--post-core-dimension-16) var(--post-core-dimension-24);padding-inline:var(--post-core-dimension-32)}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}::slotted(post-mainnavigation){background-color:var(--post-core-color-sandgrey-002);gap:var(--post-core-dimension-32)}.navigation-footer{background-color:var(--post-core-color-sandgrey-006);gap:var(--post-core-dimension-24)}}";
|
|
157
|
+
const PostHeaderStyle0 = postHeaderCss;
|
|
158
|
+
|
|
159
|
+
const PostHeader = class {
|
|
160
|
+
constructor(hostRef) {
|
|
161
|
+
index.registerInstance(this, hostRef);
|
|
162
|
+
this.scrollParent = null;
|
|
163
|
+
this.throttledScroll = () => this.handleScrollEvent();
|
|
164
|
+
this.throttledResize = throttle(50, () => this.handleResize());
|
|
165
|
+
this.device = null;
|
|
166
|
+
this.mobileMenuExtended = false;
|
|
167
|
+
}
|
|
168
|
+
componentWillRender() {
|
|
169
|
+
this.scrollParent = this.getScrollParent(this.host);
|
|
170
|
+
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
171
|
+
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
172
|
+
this.handleResize();
|
|
173
|
+
this.handleScrollEvent();
|
|
174
|
+
}
|
|
175
|
+
frozeBody(isMobileMenuExtended) {
|
|
176
|
+
document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Toggles the mobile navigation.
|
|
180
|
+
*/
|
|
181
|
+
async toggleMobileMenu() {
|
|
182
|
+
if (this.device === 'desktop')
|
|
183
|
+
return;
|
|
184
|
+
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
185
|
+
? slide.slideUp(this.mobileMenu)
|
|
186
|
+
: slide.slideDown(this.mobileMenu);
|
|
187
|
+
// Update the state of the toggle button
|
|
188
|
+
const menuButton = this.host.querySelector('post-togglebutton');
|
|
189
|
+
menuButton.toggled = !this.mobileMenuExtended;
|
|
190
|
+
// Toggle menu visibility before it slides down and after it slides back up
|
|
191
|
+
if (this.mobileMenuExtended)
|
|
192
|
+
await this.mobileMenuAnimation.finished;
|
|
193
|
+
this.mobileMenuExtended = !this.mobileMenuExtended;
|
|
194
|
+
if (!this.mobileMenuExtended)
|
|
195
|
+
await this.mobileMenuAnimation.finished;
|
|
196
|
+
}
|
|
197
|
+
handleScrollEvent() {
|
|
198
|
+
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
199
|
+
const st = Math.max(0, this.scrollParent instanceof Document
|
|
200
|
+
? this.scrollParent.documentElement.scrollTop
|
|
201
|
+
: this.scrollParent.scrollTop);
|
|
202
|
+
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
203
|
+
}
|
|
204
|
+
getScrollParent(node) {
|
|
205
|
+
let currentParent = node.parentElement;
|
|
206
|
+
while (currentParent) {
|
|
207
|
+
if (currentParent.nodeName === 'BODY') {
|
|
208
|
+
return document;
|
|
209
|
+
}
|
|
210
|
+
if (this.isScrollable(currentParent)) {
|
|
211
|
+
return currentParent;
|
|
212
|
+
}
|
|
213
|
+
currentParent = currentParent.parentElement;
|
|
214
|
+
}
|
|
215
|
+
return document;
|
|
216
|
+
}
|
|
217
|
+
isScrollable(node) {
|
|
218
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
const style = getComputedStyle(node);
|
|
222
|
+
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
223
|
+
const value = style.getPropertyValue(propertyName);
|
|
224
|
+
return value === 'auto' || value === 'scroll';
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
handleResize() {
|
|
228
|
+
var _a;
|
|
229
|
+
const previousDevice = this.device;
|
|
230
|
+
let newDevice;
|
|
231
|
+
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
232
|
+
if (width >= 1024) {
|
|
233
|
+
newDevice = 'desktop';
|
|
234
|
+
}
|
|
235
|
+
else if (width >= 600) {
|
|
236
|
+
newDevice = 'tablet';
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
newDevice = 'mobile';
|
|
240
|
+
}
|
|
241
|
+
// Close any open mobile menu
|
|
242
|
+
if (newDevice === 'desktop' && this.mobileMenuExtended) {
|
|
243
|
+
this.toggleMobileMenu();
|
|
244
|
+
this.mobileMenuAnimation.finish(); // no animation
|
|
245
|
+
}
|
|
246
|
+
const mhh = (_a = this.host.shadowRoot.querySelector('.title-header')) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
247
|
+
this.host.style.setProperty('--main-header-height', `${mhh}px`);
|
|
248
|
+
// Apply only on change for doing work only when necessary
|
|
249
|
+
if (newDevice !== previousDevice) {
|
|
250
|
+
this.device = newDevice;
|
|
251
|
+
window.requestAnimationFrame(() => {
|
|
252
|
+
this.switchLanguageSwitchMode();
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
switchLanguageSwitchMode() {
|
|
257
|
+
var _a;
|
|
258
|
+
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
259
|
+
(_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
|
|
260
|
+
}
|
|
261
|
+
render() {
|
|
262
|
+
const navigationClasses = ['navigation'];
|
|
263
|
+
if (this.mobileMenuExtended) {
|
|
264
|
+
navigationClasses.push('extended');
|
|
265
|
+
}
|
|
266
|
+
return (index.h(index.Host, { key: '008e84568ce41249365d93169b2f94cd988601d0', version: _package.version }, index.h("div", { key: 'f6415c30b3bfacd01a65166c7f0a3afc37676cc8', class: "global-header" }, index.h("div", { key: 'dc1465a3a68ce8c66c7da644d992c37d8d09ccc4', class: "global-sub" }, index.h("div", { key: '490b4afe502465bc20ccc41149533929987f2fab', class: "logo" }, index.h("slot", { key: '28ee1cdb2804f6315fffa2c319a1e2fa1e54ad08', name: "post-logo" }))), index.h("div", { key: '777d715f4718bb6738665f3d65c9ee4729a977de', class: "global-sub" }, this.device === 'desktop' && index.h("slot", { key: 'c1ddbfdecc96fe3a6efb930d8475ee880059d372', name: "meta-navigation" }), index.h("slot", { key: 'df1ccf5c36ea4a05812c3983961389c42c42ddb9', name: "global-controls" }), this.device === 'desktop' && index.h("slot", { key: 'ace2dda9a3f3d898934c7d47c84e2475fb555e5d', name: "post-language-switch" }), index.h("div", { key: '3e8d94d9534d5daaa2f8e6ca5cc0833e78a49224', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, index.h("slot", { key: '58e3637f103411f5e577dba931caf884f46a6e47', name: "post-togglebutton" })))), index.h("div", { key: 'f90ff065ed795fc780c90768e5c0ab5a431bec8d', class: 'title-header ' + (this.mobileMenuExtended ? 'title-header-mobile-extended' : '') }, index.h("slot", { key: 'a1aaaf02da073b9e7de82e84c93745afa6a8c4e9', name: "title" }), index.h("div", { key: '84ae2f8b846536130967362de160e054049c8489', class: "global-sub" }, index.h("slot", { key: '8a845cd7f87b3a2c2fba7ffc1ace31e87f6329d9', name: "local-controls" }), index.h("slot", { key: 'f3822b883fc88436a84d3ca7f840946af992417e' }))), index.h("div", { key: '8e0390c6c2b9a71488eea73c9207d0c336c9b75d', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, index.h("slot", { key: '5fc2db060eb962c313fc4c9ab67032e990ff54c6', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (index.h("div", { key: '7b9147dcf5de01865785d417c8d1966efb891ace', class: "navigation-footer" }, index.h("slot", { key: '6e163a7dad7b0b0fc02493cd15152179d4242980', name: "meta-navigation" }), index.h("slot", { key: 'e8fd19eeed8a99d69ccd8635e36cd0256ed4424b', name: "post-language-switch" }))))));
|
|
267
|
+
}
|
|
268
|
+
get host() { return index.getElement(this); }
|
|
269
|
+
static get watchers() { return {
|
|
270
|
+
"mobileMenuExtended": ["frozeBody"]
|
|
271
|
+
}; }
|
|
272
|
+
};
|
|
273
|
+
PostHeader.style = PostHeaderStyle0;
|
|
274
|
+
|
|
275
|
+
const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
|
|
276
|
+
const PostIconStyle0 = postIconCss;
|
|
277
|
+
|
|
278
|
+
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
279
|
+
const ANIMATION_NAMES = [
|
|
280
|
+
'cylon',
|
|
281
|
+
'cylon-vertical',
|
|
282
|
+
'spin',
|
|
283
|
+
'spin-reverse',
|
|
284
|
+
'fade',
|
|
285
|
+
'throb',
|
|
286
|
+
];
|
|
287
|
+
const ANIMATION_KEYS = [...ANIMATION_NAMES];
|
|
288
|
+
const PostIcon = class {
|
|
289
|
+
constructor(hostRef) {
|
|
290
|
+
index.registerInstance(this, hostRef);
|
|
291
|
+
this.animation = null;
|
|
292
|
+
this.base = null;
|
|
293
|
+
this.flipH = false;
|
|
294
|
+
this.flipV = false;
|
|
295
|
+
this.name = undefined;
|
|
296
|
+
this.rotate = null;
|
|
297
|
+
this.scale = null;
|
|
298
|
+
}
|
|
299
|
+
validateAnimation(newValue = this.animation) {
|
|
300
|
+
if (newValue !== undefined)
|
|
301
|
+
index$1.checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon "animation" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);
|
|
302
|
+
}
|
|
303
|
+
validateBase(newValue = this.base) {
|
|
304
|
+
index$1.checkEmptyOrType(newValue, 'string', 'The post-icon "base" prop should be a string.');
|
|
305
|
+
}
|
|
306
|
+
validateFlipH(newValue = this.flipH) {
|
|
307
|
+
index$1.checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipH" prop should be a boolean.');
|
|
308
|
+
}
|
|
309
|
+
validateFlipV(newValue = this.flipV) {
|
|
310
|
+
index$1.checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
|
|
311
|
+
}
|
|
312
|
+
validateName(newValue = this.name) {
|
|
313
|
+
checkNonEmpty.checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
|
|
314
|
+
checkType.checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
|
|
315
|
+
}
|
|
316
|
+
validateRotate(newValue = this.rotate) {
|
|
317
|
+
index$1.checkEmptyOrType(newValue, 'number', 'The post-icon "rotate" prop should be a number.');
|
|
318
|
+
}
|
|
319
|
+
validateScale(newValue = this.scale) {
|
|
320
|
+
index$1.checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
321
|
+
}
|
|
322
|
+
getPath() {
|
|
323
|
+
var _a, _b, _c, _d, _e, _f;
|
|
324
|
+
// Construct icon path from different possible sources
|
|
325
|
+
const metaBase = (_b = (_a = document.head
|
|
326
|
+
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-post-icon-base')) !== null && _b !== void 0 ? _b : null;
|
|
327
|
+
const baseHref = (_c = document.getElementsByTagName('base')[0]) === null || _c === void 0 ? void 0 : _c.href;
|
|
328
|
+
const fileBase = `${(_f = (_e = (_d = this.base) !== null && _d !== void 0 ? _d : metaBase) !== null && _e !== void 0 ? _e : baseHref) !== null && _f !== void 0 ? _f : CDN_URL}/`.replace(/\/\/$/, '/');
|
|
329
|
+
const fileName = `${this.name}.svg`;
|
|
330
|
+
const filePath = `${fileBase}${fileName}`;
|
|
331
|
+
return new URL(filePath, window.location.origin).toString();
|
|
332
|
+
}
|
|
333
|
+
getStyles() {
|
|
334
|
+
const path = this.getPath();
|
|
335
|
+
return Object.entries({
|
|
336
|
+
'-webkit-mask-image': `url(${path})`,
|
|
337
|
+
'mask-image': `url('${path}')`,
|
|
338
|
+
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
339
|
+
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
340
|
+
})
|
|
341
|
+
.filter(([_key, value]) => value !== null)
|
|
342
|
+
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
343
|
+
}
|
|
344
|
+
componentDidLoad() {
|
|
345
|
+
this.validateBase();
|
|
346
|
+
this.validateName();
|
|
347
|
+
this.validateFlipH();
|
|
348
|
+
this.validateFlipV();
|
|
349
|
+
this.validateScale();
|
|
350
|
+
this.validateRotate();
|
|
351
|
+
this.validateAnimation();
|
|
352
|
+
}
|
|
353
|
+
render() {
|
|
354
|
+
return (index.h(index.Host, { key: '70e13e357929d2601de3b61f46f9a717ba491fd5', "data-version": _package.version }, index.h("span", { key: 'a0c40175bfa6bd06f3498dc056685c8396b6e706', style: this.getStyles() })));
|
|
355
|
+
}
|
|
356
|
+
get host() { return index.getElement(this); }
|
|
357
|
+
static get watchers() { return {
|
|
358
|
+
"animation": ["validateAnimation"],
|
|
359
|
+
"base": ["validateBase"],
|
|
360
|
+
"flipH": ["validateFlipH"],
|
|
361
|
+
"flipV": ["validateFlipV"],
|
|
362
|
+
"name": ["validateName"],
|
|
363
|
+
"rotate": ["validateRotate"],
|
|
364
|
+
"scale": ["validateScale"]
|
|
365
|
+
}; }
|
|
366
|
+
};
|
|
367
|
+
PostIcon.style = PostIconStyle0;
|
|
368
|
+
|
|
369
|
+
const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-language-option{display:inline-block}post-language-option button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}post-language-option a{color:inherit;text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding);border-radius:2px}post-language-option :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){width:40px;height:40px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}post-language-option:where([variant=list]) :is(a,button)[aria-current=true],post-language-option:where([variant=list]) :is(a,button)[aria-current=page]{background-color:#050400;color:#fff}post-language-option:where([variant=list]) :is(a,button)[aria-current=true]:hover,post-language-option:where([variant=list]) :is(a,button)[aria-current=page]:hover{background-color:#504f4b}post-language-option:where([variant=menu]){width:100%}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative;left:-1px;width:calc(100% + 2px)}post-language-option:where([variant=menu]) :is(a,button)[aria-current=true]::after,post-language-option:where([variant=menu]) :is(a,button)[aria-current=page]::after{content:\"\";left:0;height:3px;background-color:#050400;width:100%;display:block;position:absolute;bottom:3px}post-language-option:where([variant=menu]) :is(a,button)[aria-current=true]:hover::after,post-language-option:where([variant=menu]) :is(a,button)[aria-current=page]:hover::after{background-color:#504f4b}post-language-option:where([variant=menu]) :is(a,button):hover{color:#504f4b}";
|
|
370
|
+
const PostLanguageOptionStyle0 = postLanguageOptionCss;
|
|
371
|
+
|
|
372
|
+
const PostLanguageOption = class {
|
|
373
|
+
constructor(hostRef) {
|
|
374
|
+
index.registerInstance(this, hostRef);
|
|
375
|
+
this.postChange = index.createEvent(this, "postChange", 7);
|
|
376
|
+
this.code = undefined;
|
|
377
|
+
this.active = undefined;
|
|
378
|
+
this.variant = undefined;
|
|
379
|
+
this.name = undefined;
|
|
380
|
+
this.url = undefined;
|
|
381
|
+
}
|
|
382
|
+
validateCode(value = this.code) {
|
|
383
|
+
checkType.checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
|
|
384
|
+
}
|
|
385
|
+
validateActiveProp(value = this.active) {
|
|
386
|
+
index$1.checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
|
|
387
|
+
}
|
|
388
|
+
validateName(value = this.name) {
|
|
389
|
+
index$1.checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
|
|
390
|
+
}
|
|
391
|
+
validateUrl(value = this.url) {
|
|
392
|
+
index$1.checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
|
|
393
|
+
}
|
|
394
|
+
componentDidLoad() {
|
|
395
|
+
this.validateCode();
|
|
396
|
+
this.validateActiveProp();
|
|
397
|
+
this.validateName();
|
|
398
|
+
this.validateUrl();
|
|
399
|
+
if (!this.name && this.isNameRequired()) {
|
|
400
|
+
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Selects the language option programmatically.
|
|
405
|
+
*/
|
|
406
|
+
async select() {
|
|
407
|
+
this.active = true;
|
|
408
|
+
this.emitChange();
|
|
409
|
+
}
|
|
410
|
+
emitChange() {
|
|
411
|
+
this.postChange.emit(this.code);
|
|
412
|
+
}
|
|
413
|
+
isNameRequired() {
|
|
414
|
+
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
415
|
+
}
|
|
416
|
+
render() {
|
|
417
|
+
const lang = this.code.toLowerCase();
|
|
418
|
+
const emitOnKeyDown = (e) => {
|
|
419
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
420
|
+
this.emitChange();
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
return (index.h(index.Host, { key: '6a7c4af5ab0a953cc2c70621efc6fff905638900', "data-version": _package.version, role: this.variant ? `${this.variant}item` : null }, this.url ? (index.h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null))) : (index.h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null)))));
|
|
424
|
+
}
|
|
425
|
+
get host() { return index.getElement(this); }
|
|
426
|
+
static get watchers() { return {
|
|
427
|
+
"code": ["validateCode"],
|
|
428
|
+
"active": ["validateActiveProp"],
|
|
429
|
+
"name": ["validateName"],
|
|
430
|
+
"url": ["validateUrl"]
|
|
431
|
+
}; }
|
|
432
|
+
};
|
|
433
|
+
PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
434
|
+
|
|
435
|
+
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
436
|
+
|
|
437
|
+
const postLanguageSwitchCss = ":host{display:block}@media screen and (max-width: 1023.99px){:host{display:flex !important;gap:.5rem}}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:var(--post-core-dimension-6);border-radius:var(--post-core-dimension-24);font-size:var(--post-core-font-size-16);padding:var(--post-core-dimension-3) var(--post-core-dimension-10)}.post-language-switch-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:var(--post-core-dimension-16);width:var(--post-core-dimension-16)}";
|
|
438
|
+
const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
439
|
+
|
|
440
|
+
const PostLanguageSwitch = class {
|
|
441
|
+
constructor(hostRef) {
|
|
442
|
+
index.registerInstance(this, hostRef);
|
|
443
|
+
this.menuId = `p${index_browser.nanoid(11)}`;
|
|
444
|
+
this.caption = undefined;
|
|
445
|
+
this.description = undefined;
|
|
446
|
+
this.variant = 'list';
|
|
447
|
+
this.activeLang = undefined;
|
|
448
|
+
}
|
|
449
|
+
validateCaption(value = this.caption) {
|
|
450
|
+
checkType.checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
|
|
451
|
+
}
|
|
452
|
+
validateDescription(value = this.description) {
|
|
453
|
+
checkType.checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
|
|
454
|
+
}
|
|
455
|
+
validateVariant(value = this.variant) {
|
|
456
|
+
index$1.checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
|
|
457
|
+
}
|
|
458
|
+
connectedCallback() {
|
|
459
|
+
this.updateChildrenVariant();
|
|
460
|
+
// Get the active language based on children's active state
|
|
461
|
+
this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
|
|
462
|
+
.find(el => el.getAttribute('active') == 'true')
|
|
463
|
+
.getAttribute('code');
|
|
464
|
+
}
|
|
465
|
+
// Update post-language-option variant to have the correct style
|
|
466
|
+
updateChildrenVariant() {
|
|
467
|
+
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
468
|
+
el.setAttribute('variant', this.variant);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
componentWillUpdate() {
|
|
472
|
+
this.updateChildrenVariant();
|
|
473
|
+
}
|
|
474
|
+
componentDidLoad() {
|
|
475
|
+
this.validateCaption();
|
|
476
|
+
this.validateDescription();
|
|
477
|
+
this.validateVariant();
|
|
478
|
+
// Detects a change in the active language
|
|
479
|
+
this.host.addEventListener('postChange', (el) => {
|
|
480
|
+
this.activeLang = el.detail;
|
|
481
|
+
// Update the active state in the children post-language-option components
|
|
482
|
+
this.host.querySelectorAll('post-language-option').forEach(lang => {
|
|
483
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
484
|
+
lang.setAttribute('active', 'true');
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
lang.setAttribute('active', 'false');
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
// Hides the dropdown when an option has been clicked
|
|
491
|
+
if (this.variant === 'menu') {
|
|
492
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
493
|
+
menu.toggle(menu);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
renderList() {
|
|
498
|
+
return (index.h(index.Host, { "data-version": _package.version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, index.h("slot", null)));
|
|
499
|
+
}
|
|
500
|
+
renderDropdown() {
|
|
501
|
+
return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), index.h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), index.h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container" }, index.h("slot", null))));
|
|
502
|
+
}
|
|
503
|
+
render() {
|
|
504
|
+
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
505
|
+
}
|
|
506
|
+
get host() { return index.getElement(this); }
|
|
507
|
+
static get watchers() { return {
|
|
508
|
+
"caption": ["validateCaption"],
|
|
509
|
+
"description": ["validateDescription"],
|
|
510
|
+
"variant": ["validateVariant"]
|
|
511
|
+
}; }
|
|
512
|
+
};
|
|
513
|
+
PostLanguageSwitch.style = PostLanguageSwitchStyle0;
|
|
514
|
+
|
|
515
|
+
const postListCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */post-list{display:flex;flex-direction:column;gap:var(--post-list-title-gap, 0)}post-list>[role=list]{display:flex;flex-direction:column;gap:var(--post-list-item-gap, 0)}post-list:where([horizontal]:not([horizontal=false])){flex-direction:row;align-items:center}post-list:where([horizontal]:not([horizontal=false]))>[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}";
|
|
516
|
+
const PostListStyle0 = postListCss;
|
|
517
|
+
|
|
518
|
+
const PostList = class {
|
|
519
|
+
constructor(hostRef) {
|
|
520
|
+
index.registerInstance(this, hostRef);
|
|
521
|
+
this.titleId = undefined;
|
|
522
|
+
this.titleHidden = false;
|
|
523
|
+
this.horizontal = false;
|
|
524
|
+
}
|
|
525
|
+
componentWillLoad() {
|
|
526
|
+
/**
|
|
527
|
+
* Get the id set on the host element or use a random id by default
|
|
528
|
+
*/
|
|
529
|
+
this.titleId = `title-${this.host.id || index_browser.nanoid(6)}`;
|
|
530
|
+
}
|
|
531
|
+
componentDidLoad() {
|
|
532
|
+
this.checkTitle();
|
|
533
|
+
}
|
|
534
|
+
checkTitle() {
|
|
535
|
+
if (!this.titleEl.textContent.trim()) {
|
|
536
|
+
throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
render() {
|
|
540
|
+
return (index.h(index.Host, { key: '70594af566e1fe34ce0b9ebe1a8cbbc868dab973', "data-version": _package.version }, index.h("div", { key: '27b6c4af3d51a0d83f968ec751b6bcf46feb7d05', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, index.h("slot", { key: 'a913bd018199bb031e3d96d487bd528831453387' })), index.h("div", { key: 'e1a3ddecc643a78f57b91cc9ccb0de6b02302a47', role: "list", "aria-labelledby": this.titleId }, index.h("slot", { key: 'bd7c6df300d28fe0b9f1dd3135eb42da00e731b9', name: "post-list-item" }))));
|
|
541
|
+
}
|
|
542
|
+
get host() { return index.getElement(this); }
|
|
543
|
+
};
|
|
544
|
+
PostList.style = PostListStyle0;
|
|
545
|
+
|
|
546
|
+
const postListItemCss = ":host{display:flex}";
|
|
547
|
+
const PostListItemStyle0 = postListItemCss;
|
|
548
|
+
|
|
549
|
+
const PostListItem = class {
|
|
550
|
+
constructor(hostRef) {
|
|
551
|
+
index.registerInstance(this, hostRef);
|
|
552
|
+
}
|
|
553
|
+
connectedCallback() {
|
|
554
|
+
this.host.setAttribute('slot', 'post-list-item');
|
|
555
|
+
}
|
|
556
|
+
render() {
|
|
557
|
+
return (index.h(index.Host, { key: 'f7b26e05f1fa8bab9909dcee305dbf74960671eb', role: "listitem", slot: "post-list-item" }, index.h("slot", { key: '3d75b0acf3f4a89c64c447e8d182bbc9a4f930a0' })));
|
|
558
|
+
}
|
|
559
|
+
get host() { return index.getElement(this); }
|
|
560
|
+
};
|
|
561
|
+
PostListItem.style = PostListItemStyle0;
|
|
562
|
+
|
|
563
|
+
const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.logo-link{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.logo-link :focus,:focus-visible{border-radius:2px}";
|
|
564
|
+
const PostLogoStyle0 = postLogoCss;
|
|
565
|
+
|
|
566
|
+
const PostLogo = class {
|
|
567
|
+
constructor(hostRef) {
|
|
568
|
+
index.registerInstance(this, hostRef);
|
|
569
|
+
this.url = undefined;
|
|
570
|
+
}
|
|
571
|
+
validateUrl() {
|
|
572
|
+
index$1.checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
|
|
573
|
+
}
|
|
574
|
+
componentDidLoad() {
|
|
575
|
+
this.validateUrl();
|
|
576
|
+
this.checkDescription();
|
|
577
|
+
}
|
|
578
|
+
checkDescription() {
|
|
579
|
+
if (!this.host.textContent) {
|
|
580
|
+
console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
render() {
|
|
584
|
+
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
585
|
+
const LogoTag = logoLink ? 'a' : 'span';
|
|
586
|
+
return (index.h(index.Host, { key: 'c20cf7b8d3684d33cf9b85448a560a93cd4df118', "data-version": _package.version }, index.h(LogoTag, Object.assign({ key: '16f5f647935c87124d7bf1be5dd5fb4c6d56a76f', class: `logo ${logoLink ? 'logo-link' : ''}` }, (logoLink ? { href: logoLink } : {})), index.h("span", { key: '1373265c0c2271069c1ee540fb6d5576e67dd923', class: "description" }, index.h("slot", { key: 'd52c8c0d28e8292f7a30733dc195e1e1e32edf2a', onSlotchange: () => this.checkDescription() })), index.h("svg", { key: 'ad1c0ff356325415a1f99c4bc941895d1448801a', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, index.h("g", { key: 'ca8015671b16c192d44a1b48699e45ff7adc6123', id: "Logo" }, index.h("rect", { key: 'e862e2ea34630326ca6f6eea164f227b138d44c1', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), index.h("polygon", { key: 'd25e571bd67524c33c343312826e37dafedf918c', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), index.h("path", { key: 'a053c52cf9de963d52bc6a0f078a986c836b6038', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
|
|
587
|
+
}
|
|
588
|
+
get host() { return index.getElement(this); }
|
|
589
|
+
static get watchers() { return {
|
|
590
|
+
"url": ["validateUrl"]
|
|
591
|
+
}; }
|
|
592
|
+
};
|
|
593
|
+
PostLogo.style = PostLogoStyle0;
|
|
594
|
+
|
|
595
|
+
const postMainnavigationCss = "post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item>button:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:var(--post-core-dimension-4);z-index:1}@media screen and (min-width: 1024px){post-mainnavigation nav{position:relative;max-width:100vw;max-height:var(--post-core-dimension-56);user-select:none}post-mainnavigation post-list{margin-inline:var(--post-core-dimension-4)}post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline:var(--post-core-dimension-12);height:var(--post-core-dimension-56);gap:var(--post-core-dimension-4);font-size:var(--post-core-font-size-16);border-block:0 solid rgba(0,0,0,0);border-block-end-color:currentColor}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{border-block-width:var(--post-core-dimension-2)}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{border-block-width:var(--post-core-dimension-4);font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:var(--post-core-dimension-12);transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{content:\"\";mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:var(--post-core-dimension-24);width:var(--post-core-dimension-24);transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.99px){post-mainnavigation post-list>[role=list]{transform:none !important}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;height:var(--post-core-dimension-48);padding-inline-end:var(--post-core-dimension-6);gap:var(--post-core-dimension-16);border-block:var(--post-core-dimension-1) solid rgba(0,0,0,0);border-block-end-color:currentColor;font-weight:var(--post-core-font-weight-700)}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button.selected{border-block-width:var(--post-core-dimension-3)}post-mainnavigation post-list-item>a:hover::after,post-mainnavigation post-list-item>button:hover::after,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::after{content:\"\";display:block;mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.667 5.333H18.8L29.467 16H0v1.333h29.467L18.8 28h1.867L32 16.667z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;width:var(--post-core-dimension-24);height:var(--post-core-dimension-24)}}post-mainnavigation .back-button .btn{padding-inline:0}";
|
|
596
|
+
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
597
|
+
|
|
598
|
+
const PostMainnavigation = class {
|
|
599
|
+
constructor(hostRef) {
|
|
600
|
+
index.registerInstance(this, hostRef);
|
|
601
|
+
this.postToggle = index.createEvent(this, "postToggle", 7);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
|
|
605
|
+
*/
|
|
606
|
+
connectedCallback() {
|
|
607
|
+
this.header = this.host.closest('post-header');
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
|
|
611
|
+
*/
|
|
612
|
+
disconnectedCallback() {
|
|
613
|
+
this.header = null;
|
|
614
|
+
}
|
|
615
|
+
handleBackButtonClick() {
|
|
616
|
+
if (this.header)
|
|
617
|
+
this.header.toggleMobileMenu();
|
|
618
|
+
}
|
|
619
|
+
render() {
|
|
620
|
+
return (index.h(index.Host, { key: '23d1cc3919d15543bf409e8fa25be02973532a12', slot: "post-mainnavigation" }, index.h("div", { key: '8d35b8b7715fbac387361706a03a10e4af481301', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: '01899ddef2cdc321ff7383eec310877335e951a7', name: "back-button" })), index.h("nav", { key: '3237225f2608b28355e669e11189ba1ccc9c593a' }, index.h("slot", { key: '32105f3acf726a590631896c707a2149706a90d5' }))));
|
|
621
|
+
}
|
|
622
|
+
get host() { return index.getElement(this); }
|
|
623
|
+
};
|
|
624
|
+
PostMainnavigation.style = PostMainnavigationStyle0;
|
|
625
|
+
|
|
626
|
+
const postMegadropdownCss = "@keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}*,::before,::after{box-sizing:border-box}post-popovercontainer{background-color:#fafafa;border:none;border-top:1px solid #e1e0dc;width:100%;border-radius:0;box-shadow:0 8px 6px rgba(0,0,0,.16)}@media screen and (max-width: 1023.99px){post-popovercontainer{position:absolute;top:var(--header-height) !important;bottom:0;left:0;width:100%;height:auto;border-top:unset}post-popovercontainer.slide-in{animation:slide-in;animation-duration:350ms;animation-fill-mode:forwards}post-popovercontainer.slide-out{animation:slide-out;animation-duration:350ms;animation-fill-mode:forwards}}.megadropdown{padding:31px 40px 40px}@media screen and (max-width: 1023.99px){.megadropdown{padding:16px 32px 24px}}.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.99px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.99px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown h2{display:block;font-size:20px}}.megadropdown a:hover{border-block-width:0}.megadropdown a:hover::after{content:unset}.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;border-bottom:1px solid #050400;padding:15px 12px 14px 0;display:block;font-weight:900}.megadropdown post-list .list-title h3 a{text-decoration:none;width:100%;font-size:inherit;display:inline-block;font-weight:inherit;height:unset;padding:0;border:0}@media screen and (max-width: 1023.99px){.megadropdown post-list .list-title h3{font-size:16px;padding:12px 12px 11px 0}}.megadropdown post-list-item{border-bottom:1px solid #050400}.megadropdown post-list-item>a{padding:13px 12px 12px 0;display:block;text-decoration:none;width:100%;border-bottom:0;height:auto;border-top:0}@media screen and (max-width: 1023.99px){.megadropdown post-list-item>a{padding:12px 12px 11px 0}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}.megadropdown .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.99px){.megadropdown .back-button{display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.99px){.megadropdown .close-button{display:none}}";
|
|
627
|
+
const PostMegadropdownStyle0 = postMegadropdownCss;
|
|
628
|
+
|
|
629
|
+
const PostMegadropdown = class {
|
|
630
|
+
constructor(hostRef) {
|
|
631
|
+
index.registerInstance(this, hostRef);
|
|
632
|
+
this.postToggleMegadropdown = index.createEvent(this, "postToggleMegadropdown", 7);
|
|
633
|
+
this.isVisible = false;
|
|
634
|
+
this.animationClass = null;
|
|
635
|
+
}
|
|
636
|
+
componentDidLoad() {
|
|
637
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
638
|
+
this.isVisible = event.detail;
|
|
639
|
+
this.postToggleMegadropdown.emit(this.isVisible);
|
|
640
|
+
});
|
|
641
|
+
this.popoverRef.addEventListener('animationend', () => {
|
|
642
|
+
if (this.animationClass === 'slide-out') {
|
|
643
|
+
this.hide();
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Toggles the dropdown visibility based on its current state.
|
|
649
|
+
*/
|
|
650
|
+
async toggle(target) {
|
|
651
|
+
this.isVisible ? this.hide() : await this.show(target);
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Displays the popover dropdown
|
|
655
|
+
*
|
|
656
|
+
* @param target - The HTML element relative to which the popover dropdown should be displayed.
|
|
657
|
+
*/
|
|
658
|
+
async show(target) {
|
|
659
|
+
if (this.popoverRef) {
|
|
660
|
+
await this.popoverRef.show(target);
|
|
661
|
+
this.animationClass = 'slide-in';
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
console.error('show: popoverRef is null or undefined');
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Hides the popover dropdown
|
|
669
|
+
*/
|
|
670
|
+
hide() {
|
|
671
|
+
if (this.popoverRef) {
|
|
672
|
+
this.popoverRef.hide();
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
console.error('hide: popoverRef is null or undefined');
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
handleBackButtonClick() {
|
|
679
|
+
this.animationClass = 'slide-out';
|
|
680
|
+
}
|
|
681
|
+
handleCloseButtonClick() {
|
|
682
|
+
this.popoverRef.hide();
|
|
683
|
+
}
|
|
684
|
+
handleFocusout(event) {
|
|
685
|
+
const relatedTarget = event.relatedTarget;
|
|
686
|
+
const megadropdown = this.popoverRef.querySelector('.megadropdown');
|
|
687
|
+
if (!megadropdown.contains(relatedTarget)) {
|
|
688
|
+
this.hide();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
render() {
|
|
692
|
+
return (index.h(index.Host, { key: 'cb7df3441b1c064045c6d27cd7e20376a62de57c' }, index.h("post-popovercontainer", { key: '8c2de3df3d1dd59187f463d751654958326dde02', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, index.h("div", { key: '392182e1d6206c969fc64b1758d121e1ab6361f3', class: "megadropdown", onFocusout: e => this.handleFocusout(e) }, index.h("div", { key: '45742e41d227d0481436bd49de065044a2ce5e35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, index.h("slot", { key: '5607a569924faba3be599b6e1f53f4a8704b2f05', name: "back-button" })), index.h("div", { key: 'c1a99e2d25af71fc3122e1173549ad7fe1d920b7', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, index.h("slot", { key: '82059d749600e18e63c836d5ab6697eb50ec91cf', name: "close-button" })), index.h("slot", { key: 'eea5e876c1ae5558a3c5c6301b298e564d8b75b0', name: "megadropdown-title" }), index.h("div", { key: '16b0f351786aef2827ce08163a554e49c40f224b', class: "megadropdown-content" }, index.h("slot", { key: '97e5230769b01070e488f71704740ec27de9f2d4' }))))));
|
|
693
|
+
}
|
|
694
|
+
get host() { return index.getElement(this); }
|
|
695
|
+
};
|
|
696
|
+
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
697
|
+
|
|
698
|
+
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
|
|
699
|
+
const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
700
|
+
|
|
701
|
+
const PostMegadropdownTrigger = class {
|
|
702
|
+
constructor(hostRef) {
|
|
703
|
+
index.registerInstance(this, hostRef);
|
|
704
|
+
/**
|
|
705
|
+
* Reference to the slotted button within the trigger, if present.
|
|
706
|
+
* Used to manage click and key events for mega dropdown control.
|
|
707
|
+
*/
|
|
708
|
+
this.slottedButton = null;
|
|
709
|
+
this.for = undefined;
|
|
710
|
+
this.ariaExpanded = false;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
714
|
+
* @param forValue - The new value of the `for` property.
|
|
715
|
+
*/
|
|
716
|
+
validateControlFor(forValue = this.for) {
|
|
717
|
+
checkType.checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
718
|
+
}
|
|
719
|
+
get megadropdown() {
|
|
720
|
+
const ref = document.getElementById(this.for);
|
|
721
|
+
return ref && ref.localName === 'post-megadropdown'
|
|
722
|
+
? ref
|
|
723
|
+
: null;
|
|
724
|
+
}
|
|
725
|
+
handleToggle() {
|
|
726
|
+
if (this.megadropdown) {
|
|
727
|
+
this.megadropdown.toggle(this.host);
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
componentDidLoad() {
|
|
734
|
+
this.validateControlFor();
|
|
735
|
+
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
736
|
+
document.addEventListener('postToggleMegadropdown', (event) => {
|
|
737
|
+
if (event.target.id === this.for) {
|
|
738
|
+
this.ariaExpanded = event.detail;
|
|
739
|
+
if (this.slottedButton) {
|
|
740
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
this.slottedButton = this.host.querySelector('button');
|
|
745
|
+
if (this.slottedButton) {
|
|
746
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
747
|
+
this.slottedButton.addEventListener('click', () => {
|
|
748
|
+
this.handleToggle();
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
console.warn('No button found within post-megadropdown-trigger');
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
render() {
|
|
756
|
+
return (index.h(index.Host, { key: 'ba9b6922d4f4eac596f7d1310a5a1bf534b156d8', "data-version": _package.version, "tab-index": "-1" }, index.h("button", { key: '5fe4ea7f385897606f472ea72be84399e76550e2' }, index.h("slot", { key: '333f583f0db191599c4be9be9647789b2ea1ecaf' }))));
|
|
757
|
+
}
|
|
758
|
+
get host() { return index.getElement(this); }
|
|
759
|
+
static get watchers() { return {
|
|
760
|
+
"for": ["validateControlFor"]
|
|
761
|
+
}; }
|
|
762
|
+
};
|
|
763
|
+
PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
|
|
764
|
+
|
|
765
|
+
const focusableSelector = `:where(${[
|
|
766
|
+
'button',
|
|
767
|
+
'input:not([type="hidden"])',
|
|
768
|
+
'[tabindex]',
|
|
769
|
+
'select',
|
|
770
|
+
'textarea',
|
|
771
|
+
'[contenteditable]',
|
|
772
|
+
'a[href]',
|
|
773
|
+
'iframe',
|
|
774
|
+
'audio[controls]',
|
|
775
|
+
'video[controls]',
|
|
776
|
+
'area[href]',
|
|
777
|
+
'details > summary:first-of-type',
|
|
778
|
+
].join(',')})`;
|
|
779
|
+
const focusDisablingSelector = `:where(${[
|
|
780
|
+
'[inert]',
|
|
781
|
+
'[inert] *',
|
|
782
|
+
':disabled',
|
|
783
|
+
'dialog:not([open]) *',
|
|
784
|
+
'[popover]:not(:popover-open) *',
|
|
785
|
+
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
786
|
+
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
787
|
+
'[tabindex^="-"]',
|
|
788
|
+
].join(',')})`;
|
|
789
|
+
const getFocusableChildren = (element) => {
|
|
790
|
+
return element.querySelectorAll(`& > ${focusableSelector}:not(${focusDisablingSelector})`);
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
const postMenuCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}post-popovercontainer{padding:var(--post-menu-padding);background-color:var(--post-menu-bg, #ffffff);border-color:var(--post-menu-bg, #ffffff)}.popover-container{display:flex;flex-direction:column}";
|
|
794
|
+
const PostMenuStyle0 = postMenuCss;
|
|
795
|
+
|
|
796
|
+
const PostMenu = class {
|
|
797
|
+
constructor(hostRef) {
|
|
798
|
+
index.registerInstance(this, hostRef);
|
|
799
|
+
this.toggleMenu = index.createEvent(this, "toggleMenu", 7);
|
|
800
|
+
this.lastFocusedElement = null;
|
|
801
|
+
this.KEYCODES = {
|
|
802
|
+
SPACE: ' ',
|
|
803
|
+
ENTER: 'Enter',
|
|
804
|
+
UP: 'ArrowUp',
|
|
805
|
+
DOWN: 'ArrowDown',
|
|
806
|
+
TAB: 'Tab',
|
|
807
|
+
HOME: 'Home',
|
|
808
|
+
END: 'End',
|
|
809
|
+
ESCAPE: 'Escape',
|
|
810
|
+
};
|
|
811
|
+
this.handleKeyDown = (e) => {
|
|
812
|
+
e.stopPropagation();
|
|
813
|
+
if (e.key === this.KEYCODES.ESCAPE) {
|
|
814
|
+
this.toggle(this.host);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
818
|
+
this.controlKeyDownHandler(e);
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
this.handleClick = (e) => {
|
|
822
|
+
const target = e.target;
|
|
823
|
+
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
824
|
+
this.toggle(this.host);
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
this.placement = 'bottom';
|
|
828
|
+
this.isVisible = false;
|
|
829
|
+
}
|
|
830
|
+
connectedCallback() {
|
|
831
|
+
this.root = getRoot.getRoot(this.host);
|
|
832
|
+
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
833
|
+
this.host.addEventListener('click', this.handleClick);
|
|
834
|
+
}
|
|
835
|
+
disconnectedCallback() {
|
|
836
|
+
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
837
|
+
this.host.removeEventListener('click', this.handleClick);
|
|
838
|
+
}
|
|
839
|
+
componentDidLoad() {
|
|
840
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
841
|
+
this.isVisible = event.detail;
|
|
842
|
+
this.toggleMenu.emit(this.isVisible);
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Toggles the menu visibility based on its current state.
|
|
847
|
+
*/
|
|
848
|
+
async toggle(target) {
|
|
849
|
+
this.isVisible ? await this.hide() : await this.show(target);
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Displays the popover menu, focusing the first menu item.
|
|
853
|
+
*
|
|
854
|
+
* @param target - The HTML element relative to which the popover menu should be displayed.
|
|
855
|
+
*/
|
|
856
|
+
async show(target) {
|
|
857
|
+
if (this.popoverRef) {
|
|
858
|
+
await this.popoverRef.show(target);
|
|
859
|
+
this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
860
|
+
const menuItems = this.getSlottedItems();
|
|
861
|
+
if (menuItems.length > 0) {
|
|
862
|
+
menuItems[0].focus();
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
console.error('show: popoverRef is null or undefined');
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Hides the popover menu and restores focus to the previously focused element.
|
|
871
|
+
*/
|
|
872
|
+
async hide() {
|
|
873
|
+
if (this.popoverRef) {
|
|
874
|
+
await this.popoverRef.hide();
|
|
875
|
+
if (this.lastFocusedElement) {
|
|
876
|
+
this.lastFocusedElement.focus();
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
console.error('hide: popoverRef is null or undefined');
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
controlKeyDownHandler(e) {
|
|
884
|
+
const menuItems = this.getSlottedItems();
|
|
885
|
+
if (!menuItems.length) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
let currentIndex = menuItems.findIndex(el => {
|
|
889
|
+
// Check if the item is currently focused within its rendered scope (document or shadow root)
|
|
890
|
+
return el === getRoot.getRoot(el).activeElement;
|
|
891
|
+
});
|
|
892
|
+
switch (e.key) {
|
|
893
|
+
case this.KEYCODES.UP:
|
|
894
|
+
e.preventDefault();
|
|
895
|
+
currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
|
|
896
|
+
break;
|
|
897
|
+
case this.KEYCODES.DOWN:
|
|
898
|
+
e.preventDefault();
|
|
899
|
+
currentIndex = (currentIndex + 1) % menuItems.length;
|
|
900
|
+
break;
|
|
901
|
+
case this.KEYCODES.HOME:
|
|
902
|
+
currentIndex = 0;
|
|
903
|
+
break;
|
|
904
|
+
case this.KEYCODES.END:
|
|
905
|
+
currentIndex = menuItems.length - 1;
|
|
906
|
+
break;
|
|
907
|
+
case this.KEYCODES.SPACE:
|
|
908
|
+
case this.KEYCODES.ENTER:
|
|
909
|
+
this.toggle(this.host);
|
|
910
|
+
return;
|
|
911
|
+
case this.KEYCODES.TAB:
|
|
912
|
+
this.toggle(this.host);
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
if (menuItems[currentIndex]) {
|
|
916
|
+
menuItems[currentIndex].focus();
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
getSlottedItems() {
|
|
920
|
+
const slot = this.host.shadowRoot.querySelector('slot');
|
|
921
|
+
const slottedElements = slot ? slot.assignedElements() : [];
|
|
922
|
+
return (slottedElements
|
|
923
|
+
// If the element is a slot, get the assigned elements
|
|
924
|
+
.flatMap(el => (el instanceof HTMLSlotElement ? el.assignedElements() : el))
|
|
925
|
+
// Filter out elements that have a 'menuitem' role
|
|
926
|
+
.filter(el => el.getAttribute('role') === 'menuitem')
|
|
927
|
+
// For each menu item, get any focusable children (e.g., buttons, links)
|
|
928
|
+
.flatMap(el => Array.from(getFocusableChildren(el))));
|
|
929
|
+
}
|
|
930
|
+
render() {
|
|
931
|
+
return (index.h(index.Host, { key: '68c4661d3ab9256dadbbe3243247456c090b728e', "data-version": _package.version }, index.h("post-popovercontainer", { key: 'b6cb0624239e0ed5aeadac63ffb1b1f7fb0e873e', placement: this.placement, ref: e => (this.popoverRef = e) }, index.h("div", { key: '608f677ae715eb09ed46fde9912241dc35673e06', class: "popover-container", part: "popover-container" }, index.h("slot", { key: '83f84b7b29b4d7c9d4e0924026ca7469c1f0cfb0' })))));
|
|
932
|
+
}
|
|
933
|
+
get host() { return index.getElement(this); }
|
|
934
|
+
};
|
|
935
|
+
PostMenu.style = PostMenuStyle0;
|
|
936
|
+
|
|
937
|
+
const postMenuTriggerCss = ":host{display:inline-block}";
|
|
938
|
+
const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
939
|
+
|
|
940
|
+
const PostMenuTrigger = class {
|
|
941
|
+
constructor(hostRef) {
|
|
942
|
+
index.registerInstance(this, hostRef);
|
|
943
|
+
/**
|
|
944
|
+
* Reference to the slotted button within the trigger, if present.
|
|
945
|
+
* Used to manage click and key events for menu control.
|
|
946
|
+
*/
|
|
947
|
+
this.slottedButton = null;
|
|
948
|
+
this.handleKeyDown = (e) => {
|
|
949
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
950
|
+
e.preventDefault();
|
|
951
|
+
this.handleToggle();
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
this.for = undefined;
|
|
955
|
+
this.ariaExpanded = false;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
959
|
+
* @param forValue - The new value of the `for` property.
|
|
960
|
+
*/
|
|
961
|
+
validateControlFor(forValue = this.for) {
|
|
962
|
+
checkType.checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
963
|
+
}
|
|
964
|
+
get menu() {
|
|
965
|
+
const ref = this.root.getElementById(this.for);
|
|
966
|
+
return ref && ref.localName === 'post-menu' ? ref : null;
|
|
967
|
+
}
|
|
968
|
+
handleToggle() {
|
|
969
|
+
const menu = this.menu;
|
|
970
|
+
if (menu && this.slottedButton) {
|
|
971
|
+
this.ariaExpanded = !this.ariaExpanded;
|
|
972
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
973
|
+
menu.toggle(this.host);
|
|
974
|
+
}
|
|
975
|
+
else {
|
|
976
|
+
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
componentDidLoad() {
|
|
980
|
+
this.root = getRoot.getRoot(this.host);
|
|
981
|
+
this.validateControlFor();
|
|
982
|
+
this.slottedButton = this.host.querySelector('button');
|
|
983
|
+
// Check if the slottedButton is within a web component
|
|
984
|
+
if (!this.slottedButton) {
|
|
985
|
+
const webComponent = this.host.querySelector('.menu-trigger-webc');
|
|
986
|
+
if (webComponent.shadowRoot) {
|
|
987
|
+
const slottedButton = webComponent.shadowRoot.querySelector('button');
|
|
988
|
+
if (slottedButton) {
|
|
989
|
+
this.slottedButton = slottedButton;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
if (this.slottedButton) {
|
|
994
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
995
|
+
this.slottedButton.addEventListener('click', () => {
|
|
996
|
+
this.handleToggle();
|
|
997
|
+
});
|
|
998
|
+
this.slottedButton.addEventListener('keydown', this.handleKeyDown);
|
|
999
|
+
}
|
|
1000
|
+
else {
|
|
1001
|
+
console.warn('No button found within post-menu-trigger');
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
render() {
|
|
1005
|
+
return (index.h(index.Host, { key: '5bdaebd0c1f46fda5804c0e8d39ab3e714b523c5', "data-version": _package.version, "tab-index": "-1" }, index.h("slot", { key: 'ffee26535991d712f44cb1859a5976ec89ad772a' })));
|
|
1006
|
+
}
|
|
1007
|
+
get host() { return index.getElement(this); }
|
|
1008
|
+
static get watchers() { return {
|
|
1009
|
+
"for": ["validateControlFor"]
|
|
1010
|
+
}; }
|
|
1011
|
+
};
|
|
1012
|
+
PostMenuTrigger.style = PostMenuTriggerStyle0;
|
|
5
1013
|
|
|
6
1014
|
/**
|
|
7
1015
|
* Custom positioning reference element.
|
|
@@ -1158,6 +2166,9 @@ const size$1 = function (options) {
|
|
|
1158
2166
|
};
|
|
1159
2167
|
};
|
|
1160
2168
|
|
|
2169
|
+
function hasWindow() {
|
|
2170
|
+
return typeof window !== 'undefined';
|
|
2171
|
+
}
|
|
1161
2172
|
function getNodeName(node) {
|
|
1162
2173
|
if (isNode(node)) {
|
|
1163
2174
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -1176,17 +2187,25 @@ function getDocumentElement(node) {
|
|
|
1176
2187
|
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1177
2188
|
}
|
|
1178
2189
|
function isNode(value) {
|
|
2190
|
+
if (!hasWindow()) {
|
|
2191
|
+
return false;
|
|
2192
|
+
}
|
|
1179
2193
|
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1180
2194
|
}
|
|
1181
2195
|
function isElement(value) {
|
|
2196
|
+
if (!hasWindow()) {
|
|
2197
|
+
return false;
|
|
2198
|
+
}
|
|
1182
2199
|
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1183
2200
|
}
|
|
1184
2201
|
function isHTMLElement(value) {
|
|
2202
|
+
if (!hasWindow()) {
|
|
2203
|
+
return false;
|
|
2204
|
+
}
|
|
1185
2205
|
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1186
2206
|
}
|
|
1187
2207
|
function isShadowRoot(value) {
|
|
1188
|
-
|
|
1189
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
2208
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
1190
2209
|
return false;
|
|
1191
2210
|
}
|
|
1192
2211
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
@@ -1197,7 +2216,7 @@ function isOverflowElement(element) {
|
|
|
1197
2216
|
overflowX,
|
|
1198
2217
|
overflowY,
|
|
1199
2218
|
display
|
|
1200
|
-
} = getComputedStyle(element);
|
|
2219
|
+
} = getComputedStyle$1(element);
|
|
1201
2220
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1202
2221
|
}
|
|
1203
2222
|
function isTableElement(element) {
|
|
@@ -1214,10 +2233,11 @@ function isTopLayer(element) {
|
|
|
1214
2233
|
}
|
|
1215
2234
|
function isContainingBlock(elementOrCss) {
|
|
1216
2235
|
const webkit = isWebKit();
|
|
1217
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2236
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1218
2237
|
|
|
1219
2238
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1220
|
-
|
|
2239
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
2240
|
+
return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
1221
2241
|
}
|
|
1222
2242
|
function getContainingBlock(element) {
|
|
1223
2243
|
let currentNode = getParentNode(element);
|
|
@@ -1238,7 +2258,7 @@ function isWebKit() {
|
|
|
1238
2258
|
function isLastTraversableNode(node) {
|
|
1239
2259
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1240
2260
|
}
|
|
1241
|
-
function getComputedStyle(element) {
|
|
2261
|
+
function getComputedStyle$1(element) {
|
|
1242
2262
|
return getWindow(element).getComputedStyle(element);
|
|
1243
2263
|
}
|
|
1244
2264
|
function getNodeScroll(element) {
|
|
@@ -1290,13 +2310,17 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1290
2310
|
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1291
2311
|
const win = getWindow(scrollableAncestor);
|
|
1292
2312
|
if (isBody) {
|
|
1293
|
-
|
|
2313
|
+
const frameElement = getFrameElement(win);
|
|
2314
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1294
2315
|
}
|
|
1295
2316
|
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1296
2317
|
}
|
|
2318
|
+
function getFrameElement(win) {
|
|
2319
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2320
|
+
}
|
|
1297
2321
|
|
|
1298
2322
|
function getCssDimensions(element) {
|
|
1299
|
-
const css = getComputedStyle(element);
|
|
2323
|
+
const css = getComputedStyle$1(element);
|
|
1300
2324
|
// In testing environments, the `width` and `height` properties are empty
|
|
1301
2325
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1302
2326
|
let width = parseFloat(css.width) || 0;
|
|
@@ -1397,11 +2421,11 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1397
2421
|
const win = getWindow(domElement);
|
|
1398
2422
|
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1399
2423
|
let currentWin = win;
|
|
1400
|
-
let currentIFrame = currentWin
|
|
2424
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1401
2425
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1402
2426
|
const iframeScale = getScale(currentIFrame);
|
|
1403
2427
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1404
|
-
const css = getComputedStyle(currentIFrame);
|
|
2428
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
1405
2429
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1406
2430
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1407
2431
|
x *= iframeScale.x;
|
|
@@ -1411,7 +2435,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1411
2435
|
x += left;
|
|
1412
2436
|
y += top;
|
|
1413
2437
|
currentWin = getWindow(currentIFrame);
|
|
1414
|
-
currentIFrame = currentWin
|
|
2438
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1415
2439
|
}
|
|
1416
2440
|
}
|
|
1417
2441
|
return rectToClientRect({
|
|
@@ -1422,6 +2446,31 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1422
2446
|
});
|
|
1423
2447
|
}
|
|
1424
2448
|
|
|
2449
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
2450
|
+
// incorrect for RTL.
|
|
2451
|
+
function getWindowScrollBarX(element, rect) {
|
|
2452
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2453
|
+
if (!rect) {
|
|
2454
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2455
|
+
}
|
|
2456
|
+
return rect.left + leftScroll;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
2460
|
+
if (ignoreScrollbarX === void 0) {
|
|
2461
|
+
ignoreScrollbarX = false;
|
|
2462
|
+
}
|
|
2463
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2464
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
2465
|
+
// RTL <body> scrollbar.
|
|
2466
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
2467
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
2468
|
+
return {
|
|
2469
|
+
x,
|
|
2470
|
+
y
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
|
|
1425
2474
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1426
2475
|
let {
|
|
1427
2476
|
elements,
|
|
@@ -1453,11 +2502,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1453
2502
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1454
2503
|
}
|
|
1455
2504
|
}
|
|
2505
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
1456
2506
|
return {
|
|
1457
2507
|
width: rect.width * scale.x,
|
|
1458
2508
|
height: rect.height * scale.y,
|
|
1459
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1460
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
2509
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2510
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1461
2511
|
};
|
|
1462
2512
|
}
|
|
1463
2513
|
|
|
@@ -1465,12 +2515,6 @@ function getClientRects(element) {
|
|
|
1465
2515
|
return Array.from(element.getClientRects());
|
|
1466
2516
|
}
|
|
1467
2517
|
|
|
1468
|
-
function getWindowScrollBarX(element) {
|
|
1469
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1470
|
-
// incorrect for RTL.
|
|
1471
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
2518
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1475
2519
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1476
2520
|
function getDocumentRect(element) {
|
|
@@ -1481,7 +2525,7 @@ function getDocumentRect(element) {
|
|
|
1481
2525
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1482
2526
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1483
2527
|
const y = -scroll.scrollTop;
|
|
1484
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2528
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1485
2529
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1486
2530
|
}
|
|
1487
2531
|
return {
|
|
@@ -1545,9 +2589,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1545
2589
|
} else {
|
|
1546
2590
|
const visualOffsets = getVisualOffsets(element);
|
|
1547
2591
|
rect = {
|
|
1548
|
-
...clippingAncestor,
|
|
1549
2592
|
x: clippingAncestor.x - visualOffsets.x,
|
|
1550
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
2593
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
2594
|
+
width: clippingAncestor.width,
|
|
2595
|
+
height: clippingAncestor.height
|
|
1551
2596
|
};
|
|
1552
2597
|
}
|
|
1553
2598
|
return rectToClientRect(rect);
|
|
@@ -1557,7 +2602,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
1557
2602
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1558
2603
|
return false;
|
|
1559
2604
|
}
|
|
1560
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2605
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1561
2606
|
}
|
|
1562
2607
|
|
|
1563
2608
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1570,12 +2615,12 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1570
2615
|
}
|
|
1571
2616
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1572
2617
|
let currentContainingBlockComputedStyle = null;
|
|
1573
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2618
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1574
2619
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1575
2620
|
|
|
1576
2621
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1577
2622
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1578
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2623
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1579
2624
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1580
2625
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1581
2626
|
currentContainingBlockComputedStyle = null;
|
|
@@ -1652,11 +2697,14 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1652
2697
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1653
2698
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1654
2699
|
} else if (documentElement) {
|
|
2700
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
2701
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
1655
2702
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1656
2703
|
}
|
|
1657
2704
|
}
|
|
1658
|
-
const
|
|
1659
|
-
const
|
|
2705
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2706
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2707
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1660
2708
|
return {
|
|
1661
2709
|
x,
|
|
1662
2710
|
y,
|
|
@@ -1666,17 +2714,26 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1666
2714
|
}
|
|
1667
2715
|
|
|
1668
2716
|
function isStaticPositioned(element) {
|
|
1669
|
-
return getComputedStyle(element).position === 'static';
|
|
2717
|
+
return getComputedStyle$1(element).position === 'static';
|
|
1670
2718
|
}
|
|
1671
2719
|
|
|
1672
2720
|
function getTrueOffsetParent(element, polyfill) {
|
|
1673
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2721
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1674
2722
|
return null;
|
|
1675
2723
|
}
|
|
1676
2724
|
if (polyfill) {
|
|
1677
2725
|
return polyfill(element);
|
|
1678
2726
|
}
|
|
1679
|
-
|
|
2727
|
+
let rawOffsetParent = element.offsetParent;
|
|
2728
|
+
|
|
2729
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
2730
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
2731
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
2732
|
+
// non-static.
|
|
2733
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
2734
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
2735
|
+
}
|
|
2736
|
+
return rawOffsetParent;
|
|
1680
2737
|
}
|
|
1681
2738
|
|
|
1682
2739
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
@@ -1722,7 +2779,7 @@ const getElementRects = async function (data) {
|
|
|
1722
2779
|
};
|
|
1723
2780
|
|
|
1724
2781
|
function isRTL(element) {
|
|
1725
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2782
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
1726
2783
|
}
|
|
1727
2784
|
|
|
1728
2785
|
const platform = {
|
|
@@ -1738,6 +2795,10 @@ const platform = {
|
|
|
1738
2795
|
isRTL
|
|
1739
2796
|
};
|
|
1740
2797
|
|
|
2798
|
+
function rectsAreEqual(a, b) {
|
|
2799
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
1741
2802
|
// https://samthor.au/2021/observing-dom/
|
|
1742
2803
|
function observeMove(element, onMove) {
|
|
1743
2804
|
let io = null;
|
|
@@ -1757,12 +2818,13 @@ function observeMove(element, onMove) {
|
|
|
1757
2818
|
threshold = 1;
|
|
1758
2819
|
}
|
|
1759
2820
|
cleanup();
|
|
2821
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1760
2822
|
const {
|
|
1761
2823
|
left,
|
|
1762
2824
|
top,
|
|
1763
2825
|
width,
|
|
1764
2826
|
height
|
|
1765
|
-
} =
|
|
2827
|
+
} = elementRectForRootMargin;
|
|
1766
2828
|
if (!skip) {
|
|
1767
2829
|
onMove();
|
|
1768
2830
|
}
|
|
@@ -1795,6 +2857,16 @@ function observeMove(element, onMove) {
|
|
|
1795
2857
|
refresh(false, ratio);
|
|
1796
2858
|
}
|
|
1797
2859
|
}
|
|
2860
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
2861
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
2862
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
2863
|
+
// area anymore. This can happen under performance constraints. This may
|
|
2864
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
2865
|
+
// work around this, we compare the element's bounding rect now with
|
|
2866
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
2867
|
+
// are not equal then the element moved, so we refresh.
|
|
2868
|
+
refresh();
|
|
2869
|
+
}
|
|
1798
2870
|
isFirstUpdate = false;
|
|
1799
2871
|
}
|
|
1800
2872
|
|
|
@@ -1872,7 +2944,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1872
2944
|
}
|
|
1873
2945
|
function frameLoop() {
|
|
1874
2946
|
const nextRefRect = getBoundingClientRect(reference);
|
|
1875
|
-
if (prevRefRect && (
|
|
2947
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1876
2948
|
update();
|
|
1877
2949
|
}
|
|
1878
2950
|
prevRefRect = nextRefRect;
|
|
@@ -2041,7 +3113,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
2041
3113
|
}
|
|
2042
3114
|
`,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
|
|
2043
3115
|
|
|
2044
|
-
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;
|
|
3116
|
+
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);background:var(--post-current-palette-bg);color:var(--post-current-palette-fg);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
|
|
2045
3117
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
2046
3118
|
|
|
2047
3119
|
const SIDE_MAP = {
|
|
@@ -2055,6 +3127,7 @@ const PostPopovercontainer = class {
|
|
|
2055
3127
|
index.registerInstance(this, hostRef);
|
|
2056
3128
|
this.postToggle = index.createEvent(this, "postToggle", 7);
|
|
2057
3129
|
this.placement = 'top';
|
|
3130
|
+
this.edgeGap = 8;
|
|
2058
3131
|
this.arrow = false;
|
|
2059
3132
|
}
|
|
2060
3133
|
componentDidLoad() {
|
|
@@ -2126,11 +3199,12 @@ const PostPopovercontainer = class {
|
|
|
2126
3199
|
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2127
3200
|
}
|
|
2128
3201
|
async calculatePosition() {
|
|
3202
|
+
const gap = this.edgeGap;
|
|
2129
3203
|
const middleware = [
|
|
2130
3204
|
flip(),
|
|
2131
3205
|
inline(),
|
|
2132
3206
|
shift({
|
|
2133
|
-
padding:
|
|
3207
|
+
padding: gap,
|
|
2134
3208
|
// Prevents shifting away from the anchor too far, while shifting as far as possible
|
|
2135
3209
|
// https://floating-ui.com/docs/shift#limiter
|
|
2136
3210
|
limiter: limitShift({
|
|
@@ -2140,14 +3214,14 @@ const PostPopovercontainer = class {
|
|
|
2140
3214
|
size({
|
|
2141
3215
|
apply({ availableWidth, elements }) {
|
|
2142
3216
|
Object.assign(elements.floating.style, {
|
|
2143
|
-
maxWidth: `${availableWidth -
|
|
3217
|
+
maxWidth: `${availableWidth - gap * 2}px`,
|
|
2144
3218
|
});
|
|
2145
3219
|
},
|
|
2146
3220
|
}),
|
|
2147
|
-
offset(this.arrow ?
|
|
3221
|
+
offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
|
|
2148
3222
|
];
|
|
2149
3223
|
if (this.arrow) {
|
|
2150
|
-
middleware.push(arrow({ element: this.arrowRef, padding:
|
|
3224
|
+
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
2151
3225
|
}
|
|
2152
3226
|
const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
|
|
2153
3227
|
placement: this.placement || 'top',
|
|
@@ -2175,12 +3249,63 @@ const PostPopovercontainer = class {
|
|
|
2175
3249
|
}
|
|
2176
3250
|
}
|
|
2177
3251
|
render() {
|
|
2178
|
-
return (index.h(index.Host, { key: '
|
|
3252
|
+
return (index.h(index.Host, { key: '844302edb3852f99229d4f4ccacf82cd78588435', "data-version": _package.version }, this.arrow && (index.h("span", { key: 'ae293d24ef24282bfcaeb7f545653a563e5246d5', class: "arrow", ref: el => {
|
|
2179
3253
|
this.arrowRef = el;
|
|
2180
|
-
} })), index.h("slot", { key: '
|
|
3254
|
+
} })), index.h("slot", { key: '61dd3072a5217099028e3dd4b22fa845ea2f5970' })));
|
|
2181
3255
|
}
|
|
2182
3256
|
get host() { return index.getElement(this); }
|
|
2183
3257
|
};
|
|
2184
3258
|
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2185
3259
|
|
|
3260
|
+
const postTogglebuttonCss = ":host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}";
|
|
3261
|
+
const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
3262
|
+
|
|
3263
|
+
const PostTogglebutton = class {
|
|
3264
|
+
constructor(hostRef) {
|
|
3265
|
+
index.registerInstance(this, hostRef);
|
|
3266
|
+
this.handleClick = () => {
|
|
3267
|
+
this.toggled = !this.toggled;
|
|
3268
|
+
};
|
|
3269
|
+
this.handleKeydown = (event) => {
|
|
3270
|
+
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3271
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
3272
|
+
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3273
|
+
this.host.click();
|
|
3274
|
+
}
|
|
3275
|
+
};
|
|
3276
|
+
this.toggled = false;
|
|
3277
|
+
}
|
|
3278
|
+
validateToggled(value = this.toggled) {
|
|
3279
|
+
checkType.checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
|
|
3280
|
+
}
|
|
3281
|
+
componentWillLoad() {
|
|
3282
|
+
this.validateToggled();
|
|
3283
|
+
// add event listener to not override listener that might be set on the host
|
|
3284
|
+
this.host.addEventListener('click', () => this.handleClick());
|
|
3285
|
+
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
3286
|
+
}
|
|
3287
|
+
render() {
|
|
3288
|
+
return (index.h(index.Host, { key: '461f72ebada75a99921b7a166f67f2547aa6465e', "data-version": _package.version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, index.h("slot", { key: 'cd5f4cc4df687cceacb3ea6c125b7b62f01b2712' })));
|
|
3289
|
+
}
|
|
3290
|
+
get host() { return index.getElement(this); }
|
|
3291
|
+
static get watchers() { return {
|
|
3292
|
+
"toggled": ["validateToggled"]
|
|
3293
|
+
}; }
|
|
3294
|
+
};
|
|
3295
|
+
PostTogglebutton.style = PostTogglebuttonStyle0;
|
|
3296
|
+
|
|
3297
|
+
exports.PostClosebutton = PostClosebutton;
|
|
3298
|
+
exports.PostHeader = PostHeader;
|
|
3299
|
+
exports.PostIcon = PostIcon;
|
|
3300
|
+
exports.PostLanguageOption = PostLanguageOption;
|
|
3301
|
+
exports.PostLanguageSwitch = PostLanguageSwitch;
|
|
3302
|
+
exports.PostList = PostList;
|
|
3303
|
+
exports.PostListItem = PostListItem;
|
|
3304
|
+
exports.PostLogo = PostLogo;
|
|
3305
|
+
exports.PostMainnavigation = PostMainnavigation;
|
|
3306
|
+
exports.PostMegadropdown = PostMegadropdown;
|
|
3307
|
+
exports.PostMegadropdownTrigger = PostMegadropdownTrigger;
|
|
3308
|
+
exports.PostMenu = PostMenu;
|
|
3309
|
+
exports.PostMenuTrigger = PostMenuTrigger;
|
|
2186
3310
|
exports.PostPopovercontainer = PostPopovercontainer;
|
|
3311
|
+
exports.PostTogglebutton = PostTogglebutton;
|