@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,5 +1,1013 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-6bfe6554.js';
|
|
2
|
+
import { v as version } from './package-cf78d928.js';
|
|
3
|
+
import { s as slideUp, a as slideDown } from './slide-3422b8a3.js';
|
|
4
|
+
import { c as checkEmptyOrOneOf, d as checkEmptyOrType, b as checkEmptyOrUrl } from './index-b49c9904.js';
|
|
5
|
+
import { c as checkNonEmpty } from './check-non-empty-58bd6b17.js';
|
|
6
|
+
import { c as checkType } from './check-type-8828dbe4.js';
|
|
7
|
+
import { n as nanoid } from './index.browser-51485f85.js';
|
|
8
|
+
import { g as getRoot } from './get-root-7af2e0d1.js';
|
|
9
|
+
|
|
10
|
+
const PostClosebutton = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
registerInstance(this, hostRef);
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return (h(Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": version }, h("button", { key: 'ece4ca00fedfd0ee76a971ca2a9cf0cf9a1e7f0c', class: "btn btn-icon-close", type: "button" }, h("post-icon", { key: 'c14a15906a1f229d642c2a8aea456f7a4acc5619', "aria-hidden": "true", name: "closex" }), h("span", { key: '94757c5e870f57ec8ba0c52fc5bb2a1f6eed91c2', class: "visually-hidden" }, h("slot", { key: 'a76c388cceca0b7d4da01b8e737e65f24d11df23' })))));
|
|
16
|
+
}
|
|
17
|
+
get host() { return getElement(this); }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Throttle execution of a function. Especially useful for rate limiting
|
|
24
|
+
* execution of handlers on events like resize and scroll.
|
|
25
|
+
*
|
|
26
|
+
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
27
|
+
* are most useful.
|
|
28
|
+
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
29
|
+
* as-is, to `callback` when the throttled-function is executed.
|
|
30
|
+
* @param {object} [options] - An object to configure options.
|
|
31
|
+
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
32
|
+
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
33
|
+
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
34
|
+
* `delay` milliseconds, the internal counter is reset).
|
|
35
|
+
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
36
|
+
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
37
|
+
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
38
|
+
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
39
|
+
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
40
|
+
*
|
|
41
|
+
* @returns {Function} A new, throttled, function.
|
|
42
|
+
*/
|
|
43
|
+
function throttle (delay, callback, options) {
|
|
44
|
+
var _ref = options || {},
|
|
45
|
+
_ref$noTrailing = _ref.noTrailing,
|
|
46
|
+
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
47
|
+
_ref$noLeading = _ref.noLeading,
|
|
48
|
+
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
49
|
+
_ref$debounceMode = _ref.debounceMode,
|
|
50
|
+
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
51
|
+
/*
|
|
52
|
+
* After wrapper has stopped being called, this timeout ensures that
|
|
53
|
+
* `callback` is executed at the proper times in `throttle` and `end`
|
|
54
|
+
* debounce modes.
|
|
55
|
+
*/
|
|
56
|
+
var timeoutID;
|
|
57
|
+
var cancelled = false;
|
|
58
|
+
|
|
59
|
+
// Keep track of the last time `callback` was executed.
|
|
60
|
+
var lastExec = 0;
|
|
61
|
+
|
|
62
|
+
// Function to clear existing timeout
|
|
63
|
+
function clearExistingTimeout() {
|
|
64
|
+
if (timeoutID) {
|
|
65
|
+
clearTimeout(timeoutID);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Function to cancel next exec
|
|
70
|
+
function cancel(options) {
|
|
71
|
+
var _ref2 = options || {},
|
|
72
|
+
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
73
|
+
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
74
|
+
clearExistingTimeout();
|
|
75
|
+
cancelled = !upcomingOnly;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
80
|
+
* functionality and when executed will limit the rate at which `callback`
|
|
81
|
+
* is executed.
|
|
82
|
+
*/
|
|
83
|
+
function wrapper() {
|
|
84
|
+
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
85
|
+
arguments_[_key] = arguments[_key];
|
|
86
|
+
}
|
|
87
|
+
var self = this;
|
|
88
|
+
var elapsed = Date.now() - lastExec;
|
|
89
|
+
if (cancelled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Execute `callback` and update the `lastExec` timestamp.
|
|
94
|
+
function exec() {
|
|
95
|
+
lastExec = Date.now();
|
|
96
|
+
callback.apply(self, arguments_);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/*
|
|
100
|
+
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
101
|
+
* to allow future `callback` executions.
|
|
102
|
+
*/
|
|
103
|
+
function clear() {
|
|
104
|
+
timeoutID = undefined;
|
|
105
|
+
}
|
|
106
|
+
if (!noLeading && debounceMode && !timeoutID) {
|
|
107
|
+
/*
|
|
108
|
+
* Since `wrapper` is being called for the first time and
|
|
109
|
+
* `debounceMode` is true (at begin), execute `callback`
|
|
110
|
+
* and noLeading != true.
|
|
111
|
+
*/
|
|
112
|
+
exec();
|
|
113
|
+
}
|
|
114
|
+
clearExistingTimeout();
|
|
115
|
+
if (debounceMode === undefined && elapsed > delay) {
|
|
116
|
+
if (noLeading) {
|
|
117
|
+
/*
|
|
118
|
+
* In throttle mode with noLeading, if `delay` time has
|
|
119
|
+
* been exceeded, update `lastExec` and schedule `callback`
|
|
120
|
+
* to execute after `delay` ms.
|
|
121
|
+
*/
|
|
122
|
+
lastExec = Date.now();
|
|
123
|
+
if (!noTrailing) {
|
|
124
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
/*
|
|
128
|
+
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
129
|
+
* `callback`.
|
|
130
|
+
*/
|
|
131
|
+
exec();
|
|
132
|
+
}
|
|
133
|
+
} else if (noTrailing !== true) {
|
|
134
|
+
/*
|
|
135
|
+
* In trailing throttle mode, since `delay` time has not been
|
|
136
|
+
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
137
|
+
* recent execution.
|
|
138
|
+
*
|
|
139
|
+
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
140
|
+
* after `delay` ms.
|
|
141
|
+
*
|
|
142
|
+
* If `debounceMode` is false (at end), schedule `callback` to
|
|
143
|
+
* execute after `delay` ms.
|
|
144
|
+
*/
|
|
145
|
+
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
wrapper.cancel = cancel;
|
|
149
|
+
|
|
150
|
+
// Return the wrapper function.
|
|
151
|
+
return wrapper;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
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)}}";
|
|
155
|
+
const PostHeaderStyle0 = postHeaderCss;
|
|
156
|
+
|
|
157
|
+
const PostHeader = class {
|
|
158
|
+
constructor(hostRef) {
|
|
159
|
+
registerInstance(this, hostRef);
|
|
160
|
+
this.scrollParent = null;
|
|
161
|
+
this.throttledScroll = () => this.handleScrollEvent();
|
|
162
|
+
this.throttledResize = throttle(50, () => this.handleResize());
|
|
163
|
+
this.device = null;
|
|
164
|
+
this.mobileMenuExtended = false;
|
|
165
|
+
}
|
|
166
|
+
componentWillRender() {
|
|
167
|
+
this.scrollParent = this.getScrollParent(this.host);
|
|
168
|
+
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
169
|
+
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
170
|
+
this.handleResize();
|
|
171
|
+
this.handleScrollEvent();
|
|
172
|
+
}
|
|
173
|
+
frozeBody(isMobileMenuExtended) {
|
|
174
|
+
document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Toggles the mobile navigation.
|
|
178
|
+
*/
|
|
179
|
+
async toggleMobileMenu() {
|
|
180
|
+
if (this.device === 'desktop')
|
|
181
|
+
return;
|
|
182
|
+
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
183
|
+
? slideUp(this.mobileMenu)
|
|
184
|
+
: slideDown(this.mobileMenu);
|
|
185
|
+
// Update the state of the toggle button
|
|
186
|
+
const menuButton = this.host.querySelector('post-togglebutton');
|
|
187
|
+
menuButton.toggled = !this.mobileMenuExtended;
|
|
188
|
+
// Toggle menu visibility before it slides down and after it slides back up
|
|
189
|
+
if (this.mobileMenuExtended)
|
|
190
|
+
await this.mobileMenuAnimation.finished;
|
|
191
|
+
this.mobileMenuExtended = !this.mobileMenuExtended;
|
|
192
|
+
if (!this.mobileMenuExtended)
|
|
193
|
+
await this.mobileMenuAnimation.finished;
|
|
194
|
+
}
|
|
195
|
+
handleScrollEvent() {
|
|
196
|
+
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
197
|
+
const st = Math.max(0, this.scrollParent instanceof Document
|
|
198
|
+
? this.scrollParent.documentElement.scrollTop
|
|
199
|
+
: this.scrollParent.scrollTop);
|
|
200
|
+
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
201
|
+
}
|
|
202
|
+
getScrollParent(node) {
|
|
203
|
+
let currentParent = node.parentElement;
|
|
204
|
+
while (currentParent) {
|
|
205
|
+
if (currentParent.nodeName === 'BODY') {
|
|
206
|
+
return document;
|
|
207
|
+
}
|
|
208
|
+
if (this.isScrollable(currentParent)) {
|
|
209
|
+
return currentParent;
|
|
210
|
+
}
|
|
211
|
+
currentParent = currentParent.parentElement;
|
|
212
|
+
}
|
|
213
|
+
return document;
|
|
214
|
+
}
|
|
215
|
+
isScrollable(node) {
|
|
216
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
const style = getComputedStyle(node);
|
|
220
|
+
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
221
|
+
const value = style.getPropertyValue(propertyName);
|
|
222
|
+
return value === 'auto' || value === 'scroll';
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
handleResize() {
|
|
226
|
+
var _a;
|
|
227
|
+
const previousDevice = this.device;
|
|
228
|
+
let newDevice;
|
|
229
|
+
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
230
|
+
if (width >= 1024) {
|
|
231
|
+
newDevice = 'desktop';
|
|
232
|
+
}
|
|
233
|
+
else if (width >= 600) {
|
|
234
|
+
newDevice = 'tablet';
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
newDevice = 'mobile';
|
|
238
|
+
}
|
|
239
|
+
// Close any open mobile menu
|
|
240
|
+
if (newDevice === 'desktop' && this.mobileMenuExtended) {
|
|
241
|
+
this.toggleMobileMenu();
|
|
242
|
+
this.mobileMenuAnimation.finish(); // no animation
|
|
243
|
+
}
|
|
244
|
+
const mhh = (_a = this.host.shadowRoot.querySelector('.title-header')) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
245
|
+
this.host.style.setProperty('--main-header-height', `${mhh}px`);
|
|
246
|
+
// Apply only on change for doing work only when necessary
|
|
247
|
+
if (newDevice !== previousDevice) {
|
|
248
|
+
this.device = newDevice;
|
|
249
|
+
window.requestAnimationFrame(() => {
|
|
250
|
+
this.switchLanguageSwitchMode();
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
switchLanguageSwitchMode() {
|
|
255
|
+
var _a;
|
|
256
|
+
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
257
|
+
(_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
|
|
258
|
+
}
|
|
259
|
+
render() {
|
|
260
|
+
const navigationClasses = ['navigation'];
|
|
261
|
+
if (this.mobileMenuExtended) {
|
|
262
|
+
navigationClasses.push('extended');
|
|
263
|
+
}
|
|
264
|
+
return (h(Host, { key: '008e84568ce41249365d93169b2f94cd988601d0', version: version }, h("div", { key: 'f6415c30b3bfacd01a65166c7f0a3afc37676cc8', class: "global-header" }, h("div", { key: 'dc1465a3a68ce8c66c7da644d992c37d8d09ccc4', class: "global-sub" }, h("div", { key: '490b4afe502465bc20ccc41149533929987f2fab', class: "logo" }, h("slot", { key: '28ee1cdb2804f6315fffa2c319a1e2fa1e54ad08', name: "post-logo" }))), h("div", { key: '777d715f4718bb6738665f3d65c9ee4729a977de', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: 'c1ddbfdecc96fe3a6efb930d8475ee880059d372', name: "meta-navigation" }), h("slot", { key: 'df1ccf5c36ea4a05812c3983961389c42c42ddb9', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'ace2dda9a3f3d898934c7d47c84e2475fb555e5d', name: "post-language-switch" }), h("div", { key: '3e8d94d9534d5daaa2f8e6ca5cc0833e78a49224', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '58e3637f103411f5e577dba931caf884f46a6e47', name: "post-togglebutton" })))), h("div", { key: 'f90ff065ed795fc780c90768e5c0ab5a431bec8d', class: 'title-header ' + (this.mobileMenuExtended ? 'title-header-mobile-extended' : '') }, h("slot", { key: 'a1aaaf02da073b9e7de82e84c93745afa6a8c4e9', name: "title" }), h("div", { key: '84ae2f8b846536130967362de160e054049c8489', class: "global-sub" }, h("slot", { key: '8a845cd7f87b3a2c2fba7ffc1ace31e87f6329d9', name: "local-controls" }), h("slot", { key: 'f3822b883fc88436a84d3ca7f840946af992417e' }))), h("div", { key: '8e0390c6c2b9a71488eea73c9207d0c336c9b75d', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { key: '5fc2db060eb962c313fc4c9ab67032e990ff54c6', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { key: '7b9147dcf5de01865785d417c8d1966efb891ace', class: "navigation-footer" }, h("slot", { key: '6e163a7dad7b0b0fc02493cd15152179d4242980', name: "meta-navigation" }), h("slot", { key: 'e8fd19eeed8a99d69ccd8635e36cd0256ed4424b', name: "post-language-switch" }))))));
|
|
265
|
+
}
|
|
266
|
+
get host() { return getElement(this); }
|
|
267
|
+
static get watchers() { return {
|
|
268
|
+
"mobileMenuExtended": ["frozeBody"]
|
|
269
|
+
}; }
|
|
270
|
+
};
|
|
271
|
+
PostHeader.style = PostHeaderStyle0;
|
|
272
|
+
|
|
273
|
+
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)}}";
|
|
274
|
+
const PostIconStyle0 = postIconCss;
|
|
275
|
+
|
|
276
|
+
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
277
|
+
const ANIMATION_NAMES = [
|
|
278
|
+
'cylon',
|
|
279
|
+
'cylon-vertical',
|
|
280
|
+
'spin',
|
|
281
|
+
'spin-reverse',
|
|
282
|
+
'fade',
|
|
283
|
+
'throb',
|
|
284
|
+
];
|
|
285
|
+
const ANIMATION_KEYS = [...ANIMATION_NAMES];
|
|
286
|
+
const PostIcon = class {
|
|
287
|
+
constructor(hostRef) {
|
|
288
|
+
registerInstance(this, hostRef);
|
|
289
|
+
this.animation = null;
|
|
290
|
+
this.base = null;
|
|
291
|
+
this.flipH = false;
|
|
292
|
+
this.flipV = false;
|
|
293
|
+
this.name = undefined;
|
|
294
|
+
this.rotate = null;
|
|
295
|
+
this.scale = null;
|
|
296
|
+
}
|
|
297
|
+
validateAnimation(newValue = this.animation) {
|
|
298
|
+
if (newValue !== undefined)
|
|
299
|
+
checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon "animation" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);
|
|
300
|
+
}
|
|
301
|
+
validateBase(newValue = this.base) {
|
|
302
|
+
checkEmptyOrType(newValue, 'string', 'The post-icon "base" prop should be a string.');
|
|
303
|
+
}
|
|
304
|
+
validateFlipH(newValue = this.flipH) {
|
|
305
|
+
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipH" prop should be a boolean.');
|
|
306
|
+
}
|
|
307
|
+
validateFlipV(newValue = this.flipV) {
|
|
308
|
+
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
|
|
309
|
+
}
|
|
310
|
+
validateName(newValue = this.name) {
|
|
311
|
+
checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
|
|
312
|
+
checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
|
|
313
|
+
}
|
|
314
|
+
validateRotate(newValue = this.rotate) {
|
|
315
|
+
checkEmptyOrType(newValue, 'number', 'The post-icon "rotate" prop should be a number.');
|
|
316
|
+
}
|
|
317
|
+
validateScale(newValue = this.scale) {
|
|
318
|
+
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
319
|
+
}
|
|
320
|
+
getPath() {
|
|
321
|
+
var _a, _b, _c, _d, _e, _f;
|
|
322
|
+
// Construct icon path from different possible sources
|
|
323
|
+
const metaBase = (_b = (_a = document.head
|
|
324
|
+
.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;
|
|
325
|
+
const baseHref = (_c = document.getElementsByTagName('base')[0]) === null || _c === void 0 ? void 0 : _c.href;
|
|
326
|
+
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(/\/\/$/, '/');
|
|
327
|
+
const fileName = `${this.name}.svg`;
|
|
328
|
+
const filePath = `${fileBase}${fileName}`;
|
|
329
|
+
return new URL(filePath, window.location.origin).toString();
|
|
330
|
+
}
|
|
331
|
+
getStyles() {
|
|
332
|
+
const path = this.getPath();
|
|
333
|
+
return Object.entries({
|
|
334
|
+
'-webkit-mask-image': `url(${path})`,
|
|
335
|
+
'mask-image': `url('${path}')`,
|
|
336
|
+
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
337
|
+
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
338
|
+
})
|
|
339
|
+
.filter(([_key, value]) => value !== null)
|
|
340
|
+
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
341
|
+
}
|
|
342
|
+
componentDidLoad() {
|
|
343
|
+
this.validateBase();
|
|
344
|
+
this.validateName();
|
|
345
|
+
this.validateFlipH();
|
|
346
|
+
this.validateFlipV();
|
|
347
|
+
this.validateScale();
|
|
348
|
+
this.validateRotate();
|
|
349
|
+
this.validateAnimation();
|
|
350
|
+
}
|
|
351
|
+
render() {
|
|
352
|
+
return (h(Host, { key: '70e13e357929d2601de3b61f46f9a717ba491fd5', "data-version": version }, h("span", { key: 'a0c40175bfa6bd06f3498dc056685c8396b6e706', style: this.getStyles() })));
|
|
353
|
+
}
|
|
354
|
+
get host() { return getElement(this); }
|
|
355
|
+
static get watchers() { return {
|
|
356
|
+
"animation": ["validateAnimation"],
|
|
357
|
+
"base": ["validateBase"],
|
|
358
|
+
"flipH": ["validateFlipH"],
|
|
359
|
+
"flipV": ["validateFlipV"],
|
|
360
|
+
"name": ["validateName"],
|
|
361
|
+
"rotate": ["validateRotate"],
|
|
362
|
+
"scale": ["validateScale"]
|
|
363
|
+
}; }
|
|
364
|
+
};
|
|
365
|
+
PostIcon.style = PostIconStyle0;
|
|
366
|
+
|
|
367
|
+
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}";
|
|
368
|
+
const PostLanguageOptionStyle0 = postLanguageOptionCss;
|
|
369
|
+
|
|
370
|
+
const PostLanguageOption = class {
|
|
371
|
+
constructor(hostRef) {
|
|
372
|
+
registerInstance(this, hostRef);
|
|
373
|
+
this.postChange = createEvent(this, "postChange", 7);
|
|
374
|
+
this.code = undefined;
|
|
375
|
+
this.active = undefined;
|
|
376
|
+
this.variant = undefined;
|
|
377
|
+
this.name = undefined;
|
|
378
|
+
this.url = undefined;
|
|
379
|
+
}
|
|
380
|
+
validateCode(value = this.code) {
|
|
381
|
+
checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
|
|
382
|
+
}
|
|
383
|
+
validateActiveProp(value = this.active) {
|
|
384
|
+
checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
|
|
385
|
+
}
|
|
386
|
+
validateName(value = this.name) {
|
|
387
|
+
checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
|
|
388
|
+
}
|
|
389
|
+
validateUrl(value = this.url) {
|
|
390
|
+
checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
|
|
391
|
+
}
|
|
392
|
+
componentDidLoad() {
|
|
393
|
+
this.validateCode();
|
|
394
|
+
this.validateActiveProp();
|
|
395
|
+
this.validateName();
|
|
396
|
+
this.validateUrl();
|
|
397
|
+
if (!this.name && this.isNameRequired()) {
|
|
398
|
+
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Selects the language option programmatically.
|
|
403
|
+
*/
|
|
404
|
+
async select() {
|
|
405
|
+
this.active = true;
|
|
406
|
+
this.emitChange();
|
|
407
|
+
}
|
|
408
|
+
emitChange() {
|
|
409
|
+
this.postChange.emit(this.code);
|
|
410
|
+
}
|
|
411
|
+
isNameRequired() {
|
|
412
|
+
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
413
|
+
}
|
|
414
|
+
render() {
|
|
415
|
+
const lang = this.code.toLowerCase();
|
|
416
|
+
const emitOnKeyDown = (e) => {
|
|
417
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
418
|
+
this.emitChange();
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
return (h(Host, { key: '6a7c4af5ab0a953cc2c70621efc6fff905638900', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
422
|
+
}
|
|
423
|
+
get host() { return getElement(this); }
|
|
424
|
+
static get watchers() { return {
|
|
425
|
+
"code": ["validateCode"],
|
|
426
|
+
"active": ["validateActiveProp"],
|
|
427
|
+
"name": ["validateName"],
|
|
428
|
+
"url": ["validateUrl"]
|
|
429
|
+
}; }
|
|
430
|
+
};
|
|
431
|
+
PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
432
|
+
|
|
433
|
+
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
434
|
+
|
|
435
|
+
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)}";
|
|
436
|
+
const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
437
|
+
|
|
438
|
+
const PostLanguageSwitch = class {
|
|
439
|
+
constructor(hostRef) {
|
|
440
|
+
registerInstance(this, hostRef);
|
|
441
|
+
this.menuId = `p${nanoid(11)}`;
|
|
442
|
+
this.caption = undefined;
|
|
443
|
+
this.description = undefined;
|
|
444
|
+
this.variant = 'list';
|
|
445
|
+
this.activeLang = undefined;
|
|
446
|
+
}
|
|
447
|
+
validateCaption(value = this.caption) {
|
|
448
|
+
checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
|
|
449
|
+
}
|
|
450
|
+
validateDescription(value = this.description) {
|
|
451
|
+
checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
|
|
452
|
+
}
|
|
453
|
+
validateVariant(value = this.variant) {
|
|
454
|
+
checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
|
|
455
|
+
}
|
|
456
|
+
connectedCallback() {
|
|
457
|
+
this.updateChildrenVariant();
|
|
458
|
+
// Get the active language based on children's active state
|
|
459
|
+
this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
|
|
460
|
+
.find(el => el.getAttribute('active') == 'true')
|
|
461
|
+
.getAttribute('code');
|
|
462
|
+
}
|
|
463
|
+
// Update post-language-option variant to have the correct style
|
|
464
|
+
updateChildrenVariant() {
|
|
465
|
+
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
466
|
+
el.setAttribute('variant', this.variant);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
componentWillUpdate() {
|
|
470
|
+
this.updateChildrenVariant();
|
|
471
|
+
}
|
|
472
|
+
componentDidLoad() {
|
|
473
|
+
this.validateCaption();
|
|
474
|
+
this.validateDescription();
|
|
475
|
+
this.validateVariant();
|
|
476
|
+
// Detects a change in the active language
|
|
477
|
+
this.host.addEventListener('postChange', (el) => {
|
|
478
|
+
this.activeLang = el.detail;
|
|
479
|
+
// Update the active state in the children post-language-option components
|
|
480
|
+
this.host.querySelectorAll('post-language-option').forEach(lang => {
|
|
481
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
482
|
+
lang.setAttribute('active', 'true');
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
lang.setAttribute('active', 'false');
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
// Hides the dropdown when an option has been clicked
|
|
489
|
+
if (this.variant === 'menu') {
|
|
490
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
491
|
+
menu.toggle(menu);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
renderList() {
|
|
496
|
+
return (h(Host, { "data-version": version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, h("slot", null)));
|
|
497
|
+
}
|
|
498
|
+
renderDropdown() {
|
|
499
|
+
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container" }, h("slot", null))));
|
|
500
|
+
}
|
|
501
|
+
render() {
|
|
502
|
+
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
503
|
+
}
|
|
504
|
+
get host() { return getElement(this); }
|
|
505
|
+
static get watchers() { return {
|
|
506
|
+
"caption": ["validateCaption"],
|
|
507
|
+
"description": ["validateDescription"],
|
|
508
|
+
"variant": ["validateVariant"]
|
|
509
|
+
}; }
|
|
510
|
+
};
|
|
511
|
+
PostLanguageSwitch.style = PostLanguageSwitchStyle0;
|
|
512
|
+
|
|
513
|
+
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}";
|
|
514
|
+
const PostListStyle0 = postListCss;
|
|
515
|
+
|
|
516
|
+
const PostList = class {
|
|
517
|
+
constructor(hostRef) {
|
|
518
|
+
registerInstance(this, hostRef);
|
|
519
|
+
this.titleId = undefined;
|
|
520
|
+
this.titleHidden = false;
|
|
521
|
+
this.horizontal = false;
|
|
522
|
+
}
|
|
523
|
+
componentWillLoad() {
|
|
524
|
+
/**
|
|
525
|
+
* Get the id set on the host element or use a random id by default
|
|
526
|
+
*/
|
|
527
|
+
this.titleId = `title-${this.host.id || nanoid(6)}`;
|
|
528
|
+
}
|
|
529
|
+
componentDidLoad() {
|
|
530
|
+
this.checkTitle();
|
|
531
|
+
}
|
|
532
|
+
checkTitle() {
|
|
533
|
+
if (!this.titleEl.textContent.trim()) {
|
|
534
|
+
throw new Error('Please provide a title to the list component. Title is mandatory for accessibility purposes.');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
render() {
|
|
538
|
+
return (h(Host, { key: '70594af566e1fe34ce0b9ebe1a8cbbc868dab973', "data-version": version }, h("div", { key: '27b6c4af3d51a0d83f968ec751b6bcf46feb7d05', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: 'a913bd018199bb031e3d96d487bd528831453387' })), h("div", { key: 'e1a3ddecc643a78f57b91cc9ccb0de6b02302a47', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: 'bd7c6df300d28fe0b9f1dd3135eb42da00e731b9', name: "post-list-item" }))));
|
|
539
|
+
}
|
|
540
|
+
get host() { return getElement(this); }
|
|
541
|
+
};
|
|
542
|
+
PostList.style = PostListStyle0;
|
|
543
|
+
|
|
544
|
+
const postListItemCss = ":host{display:flex}";
|
|
545
|
+
const PostListItemStyle0 = postListItemCss;
|
|
546
|
+
|
|
547
|
+
const PostListItem = class {
|
|
548
|
+
constructor(hostRef) {
|
|
549
|
+
registerInstance(this, hostRef);
|
|
550
|
+
}
|
|
551
|
+
connectedCallback() {
|
|
552
|
+
this.host.setAttribute('slot', 'post-list-item');
|
|
553
|
+
}
|
|
554
|
+
render() {
|
|
555
|
+
return (h(Host, { key: 'f7b26e05f1fa8bab9909dcee305dbf74960671eb', role: "listitem", slot: "post-list-item" }, h("slot", { key: '3d75b0acf3f4a89c64c447e8d182bbc9a4f930a0' })));
|
|
556
|
+
}
|
|
557
|
+
get host() { return getElement(this); }
|
|
558
|
+
};
|
|
559
|
+
PostListItem.style = PostListItemStyle0;
|
|
560
|
+
|
|
561
|
+
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}";
|
|
562
|
+
const PostLogoStyle0 = postLogoCss;
|
|
563
|
+
|
|
564
|
+
const PostLogo = class {
|
|
565
|
+
constructor(hostRef) {
|
|
566
|
+
registerInstance(this, hostRef);
|
|
567
|
+
this.url = undefined;
|
|
568
|
+
}
|
|
569
|
+
validateUrl() {
|
|
570
|
+
checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
|
|
571
|
+
}
|
|
572
|
+
componentDidLoad() {
|
|
573
|
+
this.validateUrl();
|
|
574
|
+
this.checkDescription();
|
|
575
|
+
}
|
|
576
|
+
checkDescription() {
|
|
577
|
+
if (!this.host.textContent) {
|
|
578
|
+
console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
render() {
|
|
582
|
+
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
583
|
+
const LogoTag = logoLink ? 'a' : 'span';
|
|
584
|
+
return (h(Host, { key: 'c20cf7b8d3684d33cf9b85448a560a93cd4df118', "data-version": version }, h(LogoTag, Object.assign({ key: '16f5f647935c87124d7bf1be5dd5fb4c6d56a76f', class: `logo ${logoLink ? 'logo-link' : ''}` }, (logoLink ? { href: logoLink } : {})), h("span", { key: '1373265c0c2271069c1ee540fb6d5576e67dd923', class: "description" }, h("slot", { key: 'd52c8c0d28e8292f7a30733dc195e1e1e32edf2a', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'ad1c0ff356325415a1f99c4bc941895d1448801a', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'ca8015671b16c192d44a1b48699e45ff7adc6123', id: "Logo" }, h("rect", { key: 'e862e2ea34630326ca6f6eea164f227b138d44c1', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), 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" }), 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" }))))));
|
|
585
|
+
}
|
|
586
|
+
get host() { return getElement(this); }
|
|
587
|
+
static get watchers() { return {
|
|
588
|
+
"url": ["validateUrl"]
|
|
589
|
+
}; }
|
|
590
|
+
};
|
|
591
|
+
PostLogo.style = PostLogoStyle0;
|
|
592
|
+
|
|
593
|
+
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}";
|
|
594
|
+
const PostMainnavigationStyle0 = postMainnavigationCss;
|
|
595
|
+
|
|
596
|
+
const PostMainnavigation = class {
|
|
597
|
+
constructor(hostRef) {
|
|
598
|
+
registerInstance(this, hostRef);
|
|
599
|
+
this.postToggle = createEvent(this, "postToggle", 7);
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Retrieves a reference to the closest 'post-header' element when the main navigation is added to the DOM.
|
|
603
|
+
*/
|
|
604
|
+
connectedCallback() {
|
|
605
|
+
this.header = this.host.closest('post-header');
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Cleans up references and disconnects the MutationObserver when the main navigation is removed from the DOM.
|
|
609
|
+
*/
|
|
610
|
+
disconnectedCallback() {
|
|
611
|
+
this.header = null;
|
|
612
|
+
}
|
|
613
|
+
handleBackButtonClick() {
|
|
614
|
+
if (this.header)
|
|
615
|
+
this.header.toggleMobileMenu();
|
|
616
|
+
}
|
|
617
|
+
render() {
|
|
618
|
+
return (h(Host, { key: '23d1cc3919d15543bf409e8fa25be02973532a12', slot: "post-mainnavigation" }, h("div", { key: '8d35b8b7715fbac387361706a03a10e4af481301', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '01899ddef2cdc321ff7383eec310877335e951a7', name: "back-button" })), h("nav", { key: '3237225f2608b28355e669e11189ba1ccc9c593a' }, h("slot", { key: '32105f3acf726a590631896c707a2149706a90d5' }))));
|
|
619
|
+
}
|
|
620
|
+
get host() { return getElement(this); }
|
|
621
|
+
};
|
|
622
|
+
PostMainnavigation.style = PostMainnavigationStyle0;
|
|
623
|
+
|
|
624
|
+
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}}";
|
|
625
|
+
const PostMegadropdownStyle0 = postMegadropdownCss;
|
|
626
|
+
|
|
627
|
+
const PostMegadropdown = class {
|
|
628
|
+
constructor(hostRef) {
|
|
629
|
+
registerInstance(this, hostRef);
|
|
630
|
+
this.postToggleMegadropdown = createEvent(this, "postToggleMegadropdown", 7);
|
|
631
|
+
this.isVisible = false;
|
|
632
|
+
this.animationClass = null;
|
|
633
|
+
}
|
|
634
|
+
componentDidLoad() {
|
|
635
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
636
|
+
this.isVisible = event.detail;
|
|
637
|
+
this.postToggleMegadropdown.emit(this.isVisible);
|
|
638
|
+
});
|
|
639
|
+
this.popoverRef.addEventListener('animationend', () => {
|
|
640
|
+
if (this.animationClass === 'slide-out') {
|
|
641
|
+
this.hide();
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Toggles the dropdown visibility based on its current state.
|
|
647
|
+
*/
|
|
648
|
+
async toggle(target) {
|
|
649
|
+
this.isVisible ? this.hide() : await this.show(target);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Displays the popover dropdown
|
|
653
|
+
*
|
|
654
|
+
* @param target - The HTML element relative to which the popover dropdown should be displayed.
|
|
655
|
+
*/
|
|
656
|
+
async show(target) {
|
|
657
|
+
if (this.popoverRef) {
|
|
658
|
+
await this.popoverRef.show(target);
|
|
659
|
+
this.animationClass = 'slide-in';
|
|
660
|
+
}
|
|
661
|
+
else {
|
|
662
|
+
console.error('show: popoverRef is null or undefined');
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Hides the popover dropdown
|
|
667
|
+
*/
|
|
668
|
+
hide() {
|
|
669
|
+
if (this.popoverRef) {
|
|
670
|
+
this.popoverRef.hide();
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
console.error('hide: popoverRef is null or undefined');
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
handleBackButtonClick() {
|
|
677
|
+
this.animationClass = 'slide-out';
|
|
678
|
+
}
|
|
679
|
+
handleCloseButtonClick() {
|
|
680
|
+
this.popoverRef.hide();
|
|
681
|
+
}
|
|
682
|
+
handleFocusout(event) {
|
|
683
|
+
const relatedTarget = event.relatedTarget;
|
|
684
|
+
const megadropdown = this.popoverRef.querySelector('.megadropdown');
|
|
685
|
+
if (!megadropdown.contains(relatedTarget)) {
|
|
686
|
+
this.hide();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
render() {
|
|
690
|
+
return (h(Host, { key: 'cb7df3441b1c064045c6d27cd7e20376a62de57c' }, h("post-popovercontainer", { key: '8c2de3df3d1dd59187f463d751654958326dde02', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, h("div", { key: '392182e1d6206c969fc64b1758d121e1ab6361f3', class: "megadropdown", onFocusout: e => this.handleFocusout(e) }, h("div", { key: '45742e41d227d0481436bd49de065044a2ce5e35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '5607a569924faba3be599b6e1f53f4a8704b2f05', name: "back-button" })), h("div", { key: 'c1a99e2d25af71fc3122e1173549ad7fe1d920b7', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, h("slot", { key: '82059d749600e18e63c836d5ab6697eb50ec91cf', name: "close-button" })), h("slot", { key: 'eea5e876c1ae5558a3c5c6301b298e564d8b75b0', name: "megadropdown-title" }), h("div", { key: '16b0f351786aef2827ce08163a554e49c40f224b', class: "megadropdown-content" }, h("slot", { key: '97e5230769b01070e488f71704740ec27de9f2d4' }))))));
|
|
691
|
+
}
|
|
692
|
+
get host() { return getElement(this); }
|
|
693
|
+
};
|
|
694
|
+
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
695
|
+
|
|
696
|
+
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
|
|
697
|
+
const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
698
|
+
|
|
699
|
+
const PostMegadropdownTrigger = class {
|
|
700
|
+
constructor(hostRef) {
|
|
701
|
+
registerInstance(this, hostRef);
|
|
702
|
+
/**
|
|
703
|
+
* Reference to the slotted button within the trigger, if present.
|
|
704
|
+
* Used to manage click and key events for mega dropdown control.
|
|
705
|
+
*/
|
|
706
|
+
this.slottedButton = null;
|
|
707
|
+
this.for = undefined;
|
|
708
|
+
this.ariaExpanded = false;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
712
|
+
* @param forValue - The new value of the `for` property.
|
|
713
|
+
*/
|
|
714
|
+
validateControlFor(forValue = this.for) {
|
|
715
|
+
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
716
|
+
}
|
|
717
|
+
get megadropdown() {
|
|
718
|
+
const ref = document.getElementById(this.for);
|
|
719
|
+
return ref && ref.localName === 'post-megadropdown'
|
|
720
|
+
? ref
|
|
721
|
+
: null;
|
|
722
|
+
}
|
|
723
|
+
handleToggle() {
|
|
724
|
+
if (this.megadropdown) {
|
|
725
|
+
this.megadropdown.toggle(this.host);
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
componentDidLoad() {
|
|
732
|
+
this.validateControlFor();
|
|
733
|
+
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
734
|
+
document.addEventListener('postToggleMegadropdown', (event) => {
|
|
735
|
+
if (event.target.id === this.for) {
|
|
736
|
+
this.ariaExpanded = event.detail;
|
|
737
|
+
if (this.slottedButton) {
|
|
738
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
this.slottedButton = this.host.querySelector('button');
|
|
743
|
+
if (this.slottedButton) {
|
|
744
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
745
|
+
this.slottedButton.addEventListener('click', () => {
|
|
746
|
+
this.handleToggle();
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
console.warn('No button found within post-megadropdown-trigger');
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
render() {
|
|
754
|
+
return (h(Host, { key: 'ba9b6922d4f4eac596f7d1310a5a1bf534b156d8', "data-version": version, "tab-index": "-1" }, h("button", { key: '5fe4ea7f385897606f472ea72be84399e76550e2' }, h("slot", { key: '333f583f0db191599c4be9be9647789b2ea1ecaf' }))));
|
|
755
|
+
}
|
|
756
|
+
get host() { return getElement(this); }
|
|
757
|
+
static get watchers() { return {
|
|
758
|
+
"for": ["validateControlFor"]
|
|
759
|
+
}; }
|
|
760
|
+
};
|
|
761
|
+
PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
|
|
762
|
+
|
|
763
|
+
const focusableSelector = `:where(${[
|
|
764
|
+
'button',
|
|
765
|
+
'input:not([type="hidden"])',
|
|
766
|
+
'[tabindex]',
|
|
767
|
+
'select',
|
|
768
|
+
'textarea',
|
|
769
|
+
'[contenteditable]',
|
|
770
|
+
'a[href]',
|
|
771
|
+
'iframe',
|
|
772
|
+
'audio[controls]',
|
|
773
|
+
'video[controls]',
|
|
774
|
+
'area[href]',
|
|
775
|
+
'details > summary:first-of-type',
|
|
776
|
+
].join(',')})`;
|
|
777
|
+
const focusDisablingSelector = `:where(${[
|
|
778
|
+
'[inert]',
|
|
779
|
+
'[inert] *',
|
|
780
|
+
':disabled',
|
|
781
|
+
'dialog:not([open]) *',
|
|
782
|
+
'[popover]:not(:popover-open) *',
|
|
783
|
+
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
784
|
+
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
785
|
+
'[tabindex^="-"]',
|
|
786
|
+
].join(',')})`;
|
|
787
|
+
const getFocusableChildren = (element) => {
|
|
788
|
+
return element.querySelectorAll(`& > ${focusableSelector}:not(${focusDisablingSelector})`);
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
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}";
|
|
792
|
+
const PostMenuStyle0 = postMenuCss;
|
|
793
|
+
|
|
794
|
+
const PostMenu = class {
|
|
795
|
+
constructor(hostRef) {
|
|
796
|
+
registerInstance(this, hostRef);
|
|
797
|
+
this.toggleMenu = createEvent(this, "toggleMenu", 7);
|
|
798
|
+
this.lastFocusedElement = null;
|
|
799
|
+
this.KEYCODES = {
|
|
800
|
+
SPACE: ' ',
|
|
801
|
+
ENTER: 'Enter',
|
|
802
|
+
UP: 'ArrowUp',
|
|
803
|
+
DOWN: 'ArrowDown',
|
|
804
|
+
TAB: 'Tab',
|
|
805
|
+
HOME: 'Home',
|
|
806
|
+
END: 'End',
|
|
807
|
+
ESCAPE: 'Escape',
|
|
808
|
+
};
|
|
809
|
+
this.handleKeyDown = (e) => {
|
|
810
|
+
e.stopPropagation();
|
|
811
|
+
if (e.key === this.KEYCODES.ESCAPE) {
|
|
812
|
+
this.toggle(this.host);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
816
|
+
this.controlKeyDownHandler(e);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
this.handleClick = (e) => {
|
|
820
|
+
const target = e.target;
|
|
821
|
+
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
822
|
+
this.toggle(this.host);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
this.placement = 'bottom';
|
|
826
|
+
this.isVisible = false;
|
|
827
|
+
}
|
|
828
|
+
connectedCallback() {
|
|
829
|
+
this.root = getRoot(this.host);
|
|
830
|
+
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
831
|
+
this.host.addEventListener('click', this.handleClick);
|
|
832
|
+
}
|
|
833
|
+
disconnectedCallback() {
|
|
834
|
+
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
835
|
+
this.host.removeEventListener('click', this.handleClick);
|
|
836
|
+
}
|
|
837
|
+
componentDidLoad() {
|
|
838
|
+
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
839
|
+
this.isVisible = event.detail;
|
|
840
|
+
this.toggleMenu.emit(this.isVisible);
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Toggles the menu visibility based on its current state.
|
|
845
|
+
*/
|
|
846
|
+
async toggle(target) {
|
|
847
|
+
this.isVisible ? await this.hide() : await this.show(target);
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Displays the popover menu, focusing the first menu item.
|
|
851
|
+
*
|
|
852
|
+
* @param target - The HTML element relative to which the popover menu should be displayed.
|
|
853
|
+
*/
|
|
854
|
+
async show(target) {
|
|
855
|
+
if (this.popoverRef) {
|
|
856
|
+
await this.popoverRef.show(target);
|
|
857
|
+
this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
858
|
+
const menuItems = this.getSlottedItems();
|
|
859
|
+
if (menuItems.length > 0) {
|
|
860
|
+
menuItems[0].focus();
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
console.error('show: popoverRef is null or undefined');
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Hides the popover menu and restores focus to the previously focused element.
|
|
869
|
+
*/
|
|
870
|
+
async hide() {
|
|
871
|
+
if (this.popoverRef) {
|
|
872
|
+
await this.popoverRef.hide();
|
|
873
|
+
if (this.lastFocusedElement) {
|
|
874
|
+
this.lastFocusedElement.focus();
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
else {
|
|
878
|
+
console.error('hide: popoverRef is null or undefined');
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
controlKeyDownHandler(e) {
|
|
882
|
+
const menuItems = this.getSlottedItems();
|
|
883
|
+
if (!menuItems.length) {
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
let currentIndex = menuItems.findIndex(el => {
|
|
887
|
+
// Check if the item is currently focused within its rendered scope (document or shadow root)
|
|
888
|
+
return el === getRoot(el).activeElement;
|
|
889
|
+
});
|
|
890
|
+
switch (e.key) {
|
|
891
|
+
case this.KEYCODES.UP:
|
|
892
|
+
e.preventDefault();
|
|
893
|
+
currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
|
|
894
|
+
break;
|
|
895
|
+
case this.KEYCODES.DOWN:
|
|
896
|
+
e.preventDefault();
|
|
897
|
+
currentIndex = (currentIndex + 1) % menuItems.length;
|
|
898
|
+
break;
|
|
899
|
+
case this.KEYCODES.HOME:
|
|
900
|
+
currentIndex = 0;
|
|
901
|
+
break;
|
|
902
|
+
case this.KEYCODES.END:
|
|
903
|
+
currentIndex = menuItems.length - 1;
|
|
904
|
+
break;
|
|
905
|
+
case this.KEYCODES.SPACE:
|
|
906
|
+
case this.KEYCODES.ENTER:
|
|
907
|
+
this.toggle(this.host);
|
|
908
|
+
return;
|
|
909
|
+
case this.KEYCODES.TAB:
|
|
910
|
+
this.toggle(this.host);
|
|
911
|
+
break;
|
|
912
|
+
}
|
|
913
|
+
if (menuItems[currentIndex]) {
|
|
914
|
+
menuItems[currentIndex].focus();
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
getSlottedItems() {
|
|
918
|
+
const slot = this.host.shadowRoot.querySelector('slot');
|
|
919
|
+
const slottedElements = slot ? slot.assignedElements() : [];
|
|
920
|
+
return (slottedElements
|
|
921
|
+
// If the element is a slot, get the assigned elements
|
|
922
|
+
.flatMap(el => (el instanceof HTMLSlotElement ? el.assignedElements() : el))
|
|
923
|
+
// Filter out elements that have a 'menuitem' role
|
|
924
|
+
.filter(el => el.getAttribute('role') === 'menuitem')
|
|
925
|
+
// For each menu item, get any focusable children (e.g., buttons, links)
|
|
926
|
+
.flatMap(el => Array.from(getFocusableChildren(el))));
|
|
927
|
+
}
|
|
928
|
+
render() {
|
|
929
|
+
return (h(Host, { key: '68c4661d3ab9256dadbbe3243247456c090b728e', "data-version": version }, h("post-popovercontainer", { key: 'b6cb0624239e0ed5aeadac63ffb1b1f7fb0e873e', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '608f677ae715eb09ed46fde9912241dc35673e06', class: "popover-container", part: "popover-container" }, h("slot", { key: '83f84b7b29b4d7c9d4e0924026ca7469c1f0cfb0' })))));
|
|
930
|
+
}
|
|
931
|
+
get host() { return getElement(this); }
|
|
932
|
+
};
|
|
933
|
+
PostMenu.style = PostMenuStyle0;
|
|
934
|
+
|
|
935
|
+
const postMenuTriggerCss = ":host{display:inline-block}";
|
|
936
|
+
const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
937
|
+
|
|
938
|
+
const PostMenuTrigger = class {
|
|
939
|
+
constructor(hostRef) {
|
|
940
|
+
registerInstance(this, hostRef);
|
|
941
|
+
/**
|
|
942
|
+
* Reference to the slotted button within the trigger, if present.
|
|
943
|
+
* Used to manage click and key events for menu control.
|
|
944
|
+
*/
|
|
945
|
+
this.slottedButton = null;
|
|
946
|
+
this.handleKeyDown = (e) => {
|
|
947
|
+
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
948
|
+
e.preventDefault();
|
|
949
|
+
this.handleToggle();
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
this.for = undefined;
|
|
953
|
+
this.ariaExpanded = false;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
957
|
+
* @param forValue - The new value of the `for` property.
|
|
958
|
+
*/
|
|
959
|
+
validateControlFor(forValue = this.for) {
|
|
960
|
+
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
961
|
+
}
|
|
962
|
+
get menu() {
|
|
963
|
+
const ref = this.root.getElementById(this.for);
|
|
964
|
+
return ref && ref.localName === 'post-menu' ? ref : null;
|
|
965
|
+
}
|
|
966
|
+
handleToggle() {
|
|
967
|
+
const menu = this.menu;
|
|
968
|
+
if (menu && this.slottedButton) {
|
|
969
|
+
this.ariaExpanded = !this.ariaExpanded;
|
|
970
|
+
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
971
|
+
menu.toggle(this.host);
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
componentDidLoad() {
|
|
978
|
+
this.root = getRoot(this.host);
|
|
979
|
+
this.validateControlFor();
|
|
980
|
+
this.slottedButton = this.host.querySelector('button');
|
|
981
|
+
// Check if the slottedButton is within a web component
|
|
982
|
+
if (!this.slottedButton) {
|
|
983
|
+
const webComponent = this.host.querySelector('.menu-trigger-webc');
|
|
984
|
+
if (webComponent.shadowRoot) {
|
|
985
|
+
const slottedButton = webComponent.shadowRoot.querySelector('button');
|
|
986
|
+
if (slottedButton) {
|
|
987
|
+
this.slottedButton = slottedButton;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (this.slottedButton) {
|
|
992
|
+
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
993
|
+
this.slottedButton.addEventListener('click', () => {
|
|
994
|
+
this.handleToggle();
|
|
995
|
+
});
|
|
996
|
+
this.slottedButton.addEventListener('keydown', this.handleKeyDown);
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
console.warn('No button found within post-menu-trigger');
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
render() {
|
|
1003
|
+
return (h(Host, { key: '5bdaebd0c1f46fda5804c0e8d39ab3e714b523c5', "data-version": version, "tab-index": "-1" }, h("slot", { key: 'ffee26535991d712f44cb1859a5976ec89ad772a' })));
|
|
1004
|
+
}
|
|
1005
|
+
get host() { return getElement(this); }
|
|
1006
|
+
static get watchers() { return {
|
|
1007
|
+
"for": ["validateControlFor"]
|
|
1008
|
+
}; }
|
|
1009
|
+
};
|
|
1010
|
+
PostMenuTrigger.style = PostMenuTriggerStyle0;
|
|
3
1011
|
|
|
4
1012
|
/**
|
|
5
1013
|
* Custom positioning reference element.
|
|
@@ -1156,6 +2164,9 @@ const size$1 = function (options) {
|
|
|
1156
2164
|
};
|
|
1157
2165
|
};
|
|
1158
2166
|
|
|
2167
|
+
function hasWindow() {
|
|
2168
|
+
return typeof window !== 'undefined';
|
|
2169
|
+
}
|
|
1159
2170
|
function getNodeName(node) {
|
|
1160
2171
|
if (isNode(node)) {
|
|
1161
2172
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -1174,17 +2185,25 @@ function getDocumentElement(node) {
|
|
|
1174
2185
|
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1175
2186
|
}
|
|
1176
2187
|
function isNode(value) {
|
|
2188
|
+
if (!hasWindow()) {
|
|
2189
|
+
return false;
|
|
2190
|
+
}
|
|
1177
2191
|
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1178
2192
|
}
|
|
1179
2193
|
function isElement(value) {
|
|
2194
|
+
if (!hasWindow()) {
|
|
2195
|
+
return false;
|
|
2196
|
+
}
|
|
1180
2197
|
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1181
2198
|
}
|
|
1182
2199
|
function isHTMLElement(value) {
|
|
2200
|
+
if (!hasWindow()) {
|
|
2201
|
+
return false;
|
|
2202
|
+
}
|
|
1183
2203
|
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1184
2204
|
}
|
|
1185
2205
|
function isShadowRoot(value) {
|
|
1186
|
-
|
|
1187
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
2206
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
1188
2207
|
return false;
|
|
1189
2208
|
}
|
|
1190
2209
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
@@ -1195,7 +2214,7 @@ function isOverflowElement(element) {
|
|
|
1195
2214
|
overflowX,
|
|
1196
2215
|
overflowY,
|
|
1197
2216
|
display
|
|
1198
|
-
} = getComputedStyle(element);
|
|
2217
|
+
} = getComputedStyle$1(element);
|
|
1199
2218
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1200
2219
|
}
|
|
1201
2220
|
function isTableElement(element) {
|
|
@@ -1212,10 +2231,11 @@ function isTopLayer(element) {
|
|
|
1212
2231
|
}
|
|
1213
2232
|
function isContainingBlock(elementOrCss) {
|
|
1214
2233
|
const webkit = isWebKit();
|
|
1215
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2234
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1216
2235
|
|
|
1217
2236
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1218
|
-
|
|
2237
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
2238
|
+
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));
|
|
1219
2239
|
}
|
|
1220
2240
|
function getContainingBlock(element) {
|
|
1221
2241
|
let currentNode = getParentNode(element);
|
|
@@ -1236,7 +2256,7 @@ function isWebKit() {
|
|
|
1236
2256
|
function isLastTraversableNode(node) {
|
|
1237
2257
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1238
2258
|
}
|
|
1239
|
-
function getComputedStyle(element) {
|
|
2259
|
+
function getComputedStyle$1(element) {
|
|
1240
2260
|
return getWindow(element).getComputedStyle(element);
|
|
1241
2261
|
}
|
|
1242
2262
|
function getNodeScroll(element) {
|
|
@@ -1288,13 +2308,17 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1288
2308
|
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1289
2309
|
const win = getWindow(scrollableAncestor);
|
|
1290
2310
|
if (isBody) {
|
|
1291
|
-
|
|
2311
|
+
const frameElement = getFrameElement(win);
|
|
2312
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1292
2313
|
}
|
|
1293
2314
|
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1294
2315
|
}
|
|
2316
|
+
function getFrameElement(win) {
|
|
2317
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
2318
|
+
}
|
|
1295
2319
|
|
|
1296
2320
|
function getCssDimensions(element) {
|
|
1297
|
-
const css = getComputedStyle(element);
|
|
2321
|
+
const css = getComputedStyle$1(element);
|
|
1298
2322
|
// In testing environments, the `width` and `height` properties are empty
|
|
1299
2323
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1300
2324
|
let width = parseFloat(css.width) || 0;
|
|
@@ -1395,11 +2419,11 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1395
2419
|
const win = getWindow(domElement);
|
|
1396
2420
|
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1397
2421
|
let currentWin = win;
|
|
1398
|
-
let currentIFrame = currentWin
|
|
2422
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1399
2423
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1400
2424
|
const iframeScale = getScale(currentIFrame);
|
|
1401
2425
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1402
|
-
const css = getComputedStyle(currentIFrame);
|
|
2426
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
1403
2427
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1404
2428
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1405
2429
|
x *= iframeScale.x;
|
|
@@ -1409,7 +2433,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1409
2433
|
x += left;
|
|
1410
2434
|
y += top;
|
|
1411
2435
|
currentWin = getWindow(currentIFrame);
|
|
1412
|
-
currentIFrame = currentWin
|
|
2436
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1413
2437
|
}
|
|
1414
2438
|
}
|
|
1415
2439
|
return rectToClientRect({
|
|
@@ -1420,6 +2444,31 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1420
2444
|
});
|
|
1421
2445
|
}
|
|
1422
2446
|
|
|
2447
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
2448
|
+
// incorrect for RTL.
|
|
2449
|
+
function getWindowScrollBarX(element, rect) {
|
|
2450
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
2451
|
+
if (!rect) {
|
|
2452
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
2453
|
+
}
|
|
2454
|
+
return rect.left + leftScroll;
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
2458
|
+
if (ignoreScrollbarX === void 0) {
|
|
2459
|
+
ignoreScrollbarX = false;
|
|
2460
|
+
}
|
|
2461
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
2462
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
2463
|
+
// RTL <body> scrollbar.
|
|
2464
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
2465
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
2466
|
+
return {
|
|
2467
|
+
x,
|
|
2468
|
+
y
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
|
|
1423
2472
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1424
2473
|
let {
|
|
1425
2474
|
elements,
|
|
@@ -1451,11 +2500,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1451
2500
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1452
2501
|
}
|
|
1453
2502
|
}
|
|
2503
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
1454
2504
|
return {
|
|
1455
2505
|
width: rect.width * scale.x,
|
|
1456
2506
|
height: rect.height * scale.y,
|
|
1457
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1458
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
2507
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
2508
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1459
2509
|
};
|
|
1460
2510
|
}
|
|
1461
2511
|
|
|
@@ -1463,12 +2513,6 @@ function getClientRects(element) {
|
|
|
1463
2513
|
return Array.from(element.getClientRects());
|
|
1464
2514
|
}
|
|
1465
2515
|
|
|
1466
|
-
function getWindowScrollBarX(element) {
|
|
1467
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1468
|
-
// incorrect for RTL.
|
|
1469
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
2516
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1473
2517
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1474
2518
|
function getDocumentRect(element) {
|
|
@@ -1479,7 +2523,7 @@ function getDocumentRect(element) {
|
|
|
1479
2523
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1480
2524
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1481
2525
|
const y = -scroll.scrollTop;
|
|
1482
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2526
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1483
2527
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1484
2528
|
}
|
|
1485
2529
|
return {
|
|
@@ -1543,9 +2587,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1543
2587
|
} else {
|
|
1544
2588
|
const visualOffsets = getVisualOffsets(element);
|
|
1545
2589
|
rect = {
|
|
1546
|
-
...clippingAncestor,
|
|
1547
2590
|
x: clippingAncestor.x - visualOffsets.x,
|
|
1548
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
2591
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
2592
|
+
width: clippingAncestor.width,
|
|
2593
|
+
height: clippingAncestor.height
|
|
1549
2594
|
};
|
|
1550
2595
|
}
|
|
1551
2596
|
return rectToClientRect(rect);
|
|
@@ -1555,7 +2600,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
1555
2600
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1556
2601
|
return false;
|
|
1557
2602
|
}
|
|
1558
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2603
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1559
2604
|
}
|
|
1560
2605
|
|
|
1561
2606
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1568,12 +2613,12 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1568
2613
|
}
|
|
1569
2614
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1570
2615
|
let currentContainingBlockComputedStyle = null;
|
|
1571
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2616
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1572
2617
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1573
2618
|
|
|
1574
2619
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1575
2620
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1576
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2621
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1577
2622
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1578
2623
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1579
2624
|
currentContainingBlockComputedStyle = null;
|
|
@@ -1650,11 +2695,14 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1650
2695
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1651
2696
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1652
2697
|
} else if (documentElement) {
|
|
2698
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
2699
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
1653
2700
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1654
2701
|
}
|
|
1655
2702
|
}
|
|
1656
|
-
const
|
|
1657
|
-
const
|
|
2703
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2704
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2705
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1658
2706
|
return {
|
|
1659
2707
|
x,
|
|
1660
2708
|
y,
|
|
@@ -1664,17 +2712,26 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1664
2712
|
}
|
|
1665
2713
|
|
|
1666
2714
|
function isStaticPositioned(element) {
|
|
1667
|
-
return getComputedStyle(element).position === 'static';
|
|
2715
|
+
return getComputedStyle$1(element).position === 'static';
|
|
1668
2716
|
}
|
|
1669
2717
|
|
|
1670
2718
|
function getTrueOffsetParent(element, polyfill) {
|
|
1671
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2719
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1672
2720
|
return null;
|
|
1673
2721
|
}
|
|
1674
2722
|
if (polyfill) {
|
|
1675
2723
|
return polyfill(element);
|
|
1676
2724
|
}
|
|
1677
|
-
|
|
2725
|
+
let rawOffsetParent = element.offsetParent;
|
|
2726
|
+
|
|
2727
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
2728
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
2729
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
2730
|
+
// non-static.
|
|
2731
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
2732
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
2733
|
+
}
|
|
2734
|
+
return rawOffsetParent;
|
|
1678
2735
|
}
|
|
1679
2736
|
|
|
1680
2737
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
@@ -1720,7 +2777,7 @@ const getElementRects = async function (data) {
|
|
|
1720
2777
|
};
|
|
1721
2778
|
|
|
1722
2779
|
function isRTL(element) {
|
|
1723
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2780
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
1724
2781
|
}
|
|
1725
2782
|
|
|
1726
2783
|
const platform = {
|
|
@@ -1736,6 +2793,10 @@ const platform = {
|
|
|
1736
2793
|
isRTL
|
|
1737
2794
|
};
|
|
1738
2795
|
|
|
2796
|
+
function rectsAreEqual(a, b) {
|
|
2797
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
1739
2800
|
// https://samthor.au/2021/observing-dom/
|
|
1740
2801
|
function observeMove(element, onMove) {
|
|
1741
2802
|
let io = null;
|
|
@@ -1755,12 +2816,13 @@ function observeMove(element, onMove) {
|
|
|
1755
2816
|
threshold = 1;
|
|
1756
2817
|
}
|
|
1757
2818
|
cleanup();
|
|
2819
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
1758
2820
|
const {
|
|
1759
2821
|
left,
|
|
1760
2822
|
top,
|
|
1761
2823
|
width,
|
|
1762
2824
|
height
|
|
1763
|
-
} =
|
|
2825
|
+
} = elementRectForRootMargin;
|
|
1764
2826
|
if (!skip) {
|
|
1765
2827
|
onMove();
|
|
1766
2828
|
}
|
|
@@ -1793,6 +2855,16 @@ function observeMove(element, onMove) {
|
|
|
1793
2855
|
refresh(false, ratio);
|
|
1794
2856
|
}
|
|
1795
2857
|
}
|
|
2858
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
2859
|
+
// It's possible that even though the ratio is reported as 1, the
|
|
2860
|
+
// element is not actually fully within the IntersectionObserver's root
|
|
2861
|
+
// area anymore. This can happen under performance constraints. This may
|
|
2862
|
+
// be a bug in the browser's IntersectionObserver implementation. To
|
|
2863
|
+
// work around this, we compare the element's bounding rect now with
|
|
2864
|
+
// what it was at the time we created the IntersectionObserver. If they
|
|
2865
|
+
// are not equal then the element moved, so we refresh.
|
|
2866
|
+
refresh();
|
|
2867
|
+
}
|
|
1796
2868
|
isFirstUpdate = false;
|
|
1797
2869
|
}
|
|
1798
2870
|
|
|
@@ -1870,7 +2942,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1870
2942
|
}
|
|
1871
2943
|
function frameLoop() {
|
|
1872
2944
|
const nextRefRect = getBoundingClientRect(reference);
|
|
1873
|
-
if (prevRefRect && (
|
|
2945
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
1874
2946
|
update();
|
|
1875
2947
|
}
|
|
1876
2948
|
prevRefRect = nextRefRect;
|
|
@@ -2039,7 +3111,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
2039
3111
|
}
|
|
2040
3112
|
`,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();})();
|
|
2041
3113
|
|
|
2042
|
-
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;
|
|
3114
|
+
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)}";
|
|
2043
3115
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
2044
3116
|
|
|
2045
3117
|
const SIDE_MAP = {
|
|
@@ -2053,6 +3125,7 @@ const PostPopovercontainer = class {
|
|
|
2053
3125
|
registerInstance(this, hostRef);
|
|
2054
3126
|
this.postToggle = createEvent(this, "postToggle", 7);
|
|
2055
3127
|
this.placement = 'top';
|
|
3128
|
+
this.edgeGap = 8;
|
|
2056
3129
|
this.arrow = false;
|
|
2057
3130
|
}
|
|
2058
3131
|
componentDidLoad() {
|
|
@@ -2124,11 +3197,12 @@ const PostPopovercontainer = class {
|
|
|
2124
3197
|
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2125
3198
|
}
|
|
2126
3199
|
async calculatePosition() {
|
|
3200
|
+
const gap = this.edgeGap;
|
|
2127
3201
|
const middleware = [
|
|
2128
3202
|
flip(),
|
|
2129
3203
|
inline(),
|
|
2130
3204
|
shift({
|
|
2131
|
-
padding:
|
|
3205
|
+
padding: gap,
|
|
2132
3206
|
// Prevents shifting away from the anchor too far, while shifting as far as possible
|
|
2133
3207
|
// https://floating-ui.com/docs/shift#limiter
|
|
2134
3208
|
limiter: limitShift({
|
|
@@ -2138,14 +3212,14 @@ const PostPopovercontainer = class {
|
|
|
2138
3212
|
size({
|
|
2139
3213
|
apply({ availableWidth, elements }) {
|
|
2140
3214
|
Object.assign(elements.floating.style, {
|
|
2141
|
-
maxWidth: `${availableWidth -
|
|
3215
|
+
maxWidth: `${availableWidth - gap * 2}px`,
|
|
2142
3216
|
});
|
|
2143
3217
|
},
|
|
2144
3218
|
}),
|
|
2145
|
-
offset(this.arrow ?
|
|
3219
|
+
offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
|
|
2146
3220
|
];
|
|
2147
3221
|
if (this.arrow) {
|
|
2148
|
-
middleware.push(arrow({ element: this.arrowRef, padding:
|
|
3222
|
+
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
2149
3223
|
}
|
|
2150
3224
|
const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
|
|
2151
3225
|
placement: this.placement || 'top',
|
|
@@ -2173,12 +3247,49 @@ const PostPopovercontainer = class {
|
|
|
2173
3247
|
}
|
|
2174
3248
|
}
|
|
2175
3249
|
render() {
|
|
2176
|
-
return (h(Host, { key: '
|
|
3250
|
+
return (h(Host, { key: '844302edb3852f99229d4f4ccacf82cd78588435', "data-version": version }, this.arrow && (h("span", { key: 'ae293d24ef24282bfcaeb7f545653a563e5246d5', class: "arrow", ref: el => {
|
|
2177
3251
|
this.arrowRef = el;
|
|
2178
|
-
} })), h("slot", { key: '
|
|
3252
|
+
} })), h("slot", { key: '61dd3072a5217099028e3dd4b22fa845ea2f5970' })));
|
|
2179
3253
|
}
|
|
2180
3254
|
get host() { return getElement(this); }
|
|
2181
3255
|
};
|
|
2182
3256
|
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2183
3257
|
|
|
2184
|
-
|
|
3258
|
+
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}";
|
|
3259
|
+
const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
3260
|
+
|
|
3261
|
+
const PostTogglebutton = class {
|
|
3262
|
+
constructor(hostRef) {
|
|
3263
|
+
registerInstance(this, hostRef);
|
|
3264
|
+
this.handleClick = () => {
|
|
3265
|
+
this.toggled = !this.toggled;
|
|
3266
|
+
};
|
|
3267
|
+
this.handleKeydown = (event) => {
|
|
3268
|
+
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3269
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
3270
|
+
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3271
|
+
this.host.click();
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3274
|
+
this.toggled = false;
|
|
3275
|
+
}
|
|
3276
|
+
validateToggled(value = this.toggled) {
|
|
3277
|
+
checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
|
|
3278
|
+
}
|
|
3279
|
+
componentWillLoad() {
|
|
3280
|
+
this.validateToggled();
|
|
3281
|
+
// add event listener to not override listener that might be set on the host
|
|
3282
|
+
this.host.addEventListener('click', () => this.handleClick());
|
|
3283
|
+
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
3284
|
+
}
|
|
3285
|
+
render() {
|
|
3286
|
+
return (h(Host, { key: '461f72ebada75a99921b7a166f67f2547aa6465e', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: 'cd5f4cc4df687cceacb3ea6c125b7b62f01b2712' })));
|
|
3287
|
+
}
|
|
3288
|
+
get host() { return getElement(this); }
|
|
3289
|
+
static get watchers() { return {
|
|
3290
|
+
"toggled": ["validateToggled"]
|
|
3291
|
+
}; }
|
|
3292
|
+
};
|
|
3293
|
+
PostTogglebutton.style = PostTogglebuttonStyle0;
|
|
3294
|
+
|
|
3295
|
+
export { PostClosebutton as P, PostHeader as a, PostIcon as b, PostLanguageOption as c, PostLanguageSwitch as d, PostList as e, PostListItem as f, PostLogo as g, PostMainnavigation as h, PostMegadropdown as i, PostMegadropdownTrigger as j, PostMenu as k, PostMenuTrigger as l, PostPopovercontainer as m, PostTogglebutton as n };
|