@swisspost/design-system-components 9.0.0-next.0 → 9.0.0-next.10
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-ebef502e.js → package-aaec3cba.js} +1 -1
- package/dist/cjs/{post-accordion-677c6891.js → post-accordion-85bf5e0a.js} +13 -11
- package/dist/cjs/post-accordion-item-957b3464.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-58540591.js +148 -0
- package/dist/cjs/post-avatar.cjs.entry.js +13 -0
- package/dist/cjs/post-back-to-top-db5c7d01.js +75 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
- package/dist/cjs/post-banner-727866d5.js +91 -0
- package/dist/cjs/post-banner.cjs.entry.js +19 -0
- package/dist/cjs/post-breadcrumb-cacca682.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-f5d72ddc.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-4f44ca4a.js → post-collapsible-trigger-067d1f4c.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-beeb36c8.js +84 -0
- package/dist/cjs/post-footer.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-e0e214b9.js +69 -0
- package/dist/cjs/post-popover-7acbdf17.js +104 -0
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-ac9e71aa.js → post-rating-ac1b9b3c.js} +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-a3d28719.js +33 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-787bcd5d.js → post-tab-panel-4562e265.js} +5 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
- package/dist/cjs/{post-tabs-1b7aad55.js → post-tabs-80f65e1d.js} +9 -7
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tag-5741a78d.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-popovercontainer-322d3160.js → post-togglebutton-245e33f1.js} +1082 -21
- package/dist/cjs/{post-tooltip-d1d2cd3a.js → post-tooltip-cefce5e1.js} +46 -15
- 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/post-accordion.js +12 -10
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +28 -12
- 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 -29
- 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.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 -29
- package/dist/collection/components/post-popover/post-popover.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +26 -6
- package/dist/collection/components/post-rating/post-rating.css +1 -29
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -29
- 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 -29
- 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 +51 -9
- 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 +34 -14
- package/dist/components/post-accordion2.js +11 -9
- 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 +2 -2
- 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 +10 -7
- 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 +44 -13
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +1836 -236
- 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-2ee42825.js +3 -0
- package/dist/esm/{post-accordion-19ca8bf9.js → post-accordion-3bf30525.js} +13 -11
- package/dist/esm/post-accordion-item-6683fbed.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-3ddb4c79.js +146 -0
- package/dist/esm/post-avatar.entry.js +5 -0
- package/dist/esm/post-back-to-top-15ee2771.js +73 -0
- package/dist/esm/post-back-to-top.entry.js +7 -0
- package/dist/esm/post-banner-fc407f6e.js +89 -0
- package/dist/esm/post-banner.entry.js +11 -0
- package/dist/esm/post-breadcrumb-6252b112.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-cb3dfc60.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-8f54e5b6.js → post-collapsible-trigger-b727bf7e.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-7a03a9bb.js +82 -0
- package/dist/esm/post-footer.entry.js +3 -0
- package/dist/esm/post-menu-item-3e168ecd.js +66 -0
- package/dist/esm/post-popover-bff5cffd.js +102 -0
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-rating-8e22d522.js → post-rating-ce595a65.js} +4 -4
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-c864586f.js +31 -0
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-b9605846.js → post-tab-panel-800425b8.js} +5 -4
- package/dist/esm/post-tab-panel.entry.js +4 -3
- package/dist/esm/{post-tabs-fb024b14.js → post-tabs-e5aa8b08.js} +9 -7
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tag-fc3df50a.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-popovercontainer-17d2b256.js → post-togglebutton-101dd3bd.js} +1069 -22
- package/dist/esm/{post-tooltip-02e413ba.js → post-tooltip-e8484aea.js} +46 -15
- 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-02bb5231.js +1 -0
- package/dist/post-components/p-0e216cc4.js +2 -0
- package/dist/post-components/p-11880d55.js +1 -0
- package/dist/post-components/p-1489d777.entry.js +1 -0
- package/dist/post-components/p-19707347.entry.js +1 -0
- package/dist/post-components/{p-ec1f1966.js → p-1d3acbfd.js} +1 -1
- package/dist/post-components/p-24476696.js +1 -0
- package/dist/post-components/p-25f6efab.entry.js +1 -0
- package/dist/post-components/p-27ad2d1f.js +1 -0
- package/dist/post-components/p-29626238.entry.js +1 -0
- package/dist/post-components/p-339488ba.entry.js +1 -0
- package/dist/post-components/p-3de1151e.js +1 -0
- package/dist/post-components/p-413d1fff.js +1 -0
- package/dist/post-components/p-47095b84.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-5b0703a4.entry.js +1 -0
- package/dist/post-components/p-618b8929.js +1 -0
- package/dist/post-components/p-66c8d0a2.entry.js +1 -0
- package/dist/post-components/p-6e6e5447.entry.js +1 -0
- package/dist/post-components/p-80b282a2.js +1 -0
- package/dist/post-components/p-86a1ad40.js +1 -0
- package/dist/post-components/p-97647d03.entry.js +1 -0
- package/dist/post-components/p-98f1d284.js +1 -0
- package/dist/post-components/p-9e287cb5.js +1 -0
- package/dist/post-components/p-a3694196.js +1 -0
- package/dist/post-components/p-adc79d26.entry.js +1 -0
- package/dist/post-components/p-b22656b1.js +1 -0
- package/dist/post-components/p-bcf94111.entry.js +1 -0
- package/dist/post-components/p-bd87a2b5.entry.js +1 -0
- package/dist/post-components/p-bec07e51.js +1 -0
- package/dist/post-components/p-bec09df9.entry.js +1 -0
- package/dist/post-components/p-d1d9c9a5.js +1 -0
- package/dist/post-components/p-d4f93f2b.js +1 -0
- package/dist/post-components/p-db2ac0a2.entry.js +1 -0
- package/dist/post-components/p-e93a4bd0.entry.js +1 -0
- package/dist/post-components/p-eed26f43.js +1 -0
- package/dist/post-components/p-f35d5d4a.entry.js +1 -0
- package/dist/post-components/p-fa6c79b8.entry.js +1 -0
- package/dist/post-components/{p-e387c0c9.js → p-faf15ec1.js} +3 -3
- package/dist/post-components/p-fc09ac69.js +1 -0
- package/dist/post-components/p-fc91cbc2.js +1 -0
- package/dist/post-components/p-ffcd735f.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/post-accordion.d.ts +1 -1
- 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/post-tooltip/post-tooltip.d.ts +4 -1
- package/dist/types/components.d.ts +574 -47
- 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 +11 -9
- 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 +3 -3
- 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 +10 -7
- 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 +43 -12
- package/loaders/slide.js +25 -0
- package/package.json +9 -6
- package/dist/cjs/post-accordion-item-8d1d6c81.js +0 -51
- package/dist/cjs/post-alert-ea75de0d.js +0 -98
- package/dist/cjs/post-alert.cjs.entry.js +0 -16
- package/dist/cjs/post-card-control-51ee3823.js +0 -272
- package/dist/cjs/post-icon-dc878de4.js +0 -104
- package/dist/cjs/post-icon.cjs.entry.js +0 -15
- package/dist/cjs/post-logo-da45aef5.js +0 -39
- package/dist/cjs/post-logo.cjs.entry.js +0 -14
- package/dist/cjs/post-popover-aac764c7.js +0 -104
- package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
- package/dist/cjs/post-tab-header-3baf22e0.js +0 -32
- package/dist/cjs/post-tag-e4bcdb75.js +0 -47
- package/dist/collection/components/post-alert/alert-types.js +0 -1
- package/dist/collection/components/post-alert/post-alert.css +0 -35
- 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-a8cae03d.js +0 -3
- package/dist/esm/post-accordion-item-3232ff67.js +0 -49
- package/dist/esm/post-alert-2636c0e2.js +0 -96
- package/dist/esm/post-alert.entry.js +0 -8
- package/dist/esm/post-card-control-0844cad9.js +0 -270
- package/dist/esm/post-icon-1a682b9e.js +0 -102
- package/dist/esm/post-icon.entry.js +0 -7
- package/dist/esm/post-logo-904c4701.js +0 -37
- package/dist/esm/post-logo.entry.js +0 -6
- package/dist/esm/post-popover-14d083d4.js +0 -102
- package/dist/esm/post-popovercontainer.entry.js +0 -3
- package/dist/esm/post-tab-header-96287c94.js +0 -30
- package/dist/esm/post-tag-58311692.js +0 -45
- package/dist/post-components/p-04e79a2c.entry.js +0 -1
- package/dist/post-components/p-05794f1f.entry.js +0 -1
- package/dist/post-components/p-079c7726.js +0 -1
- package/dist/post-components/p-10b043fc.js +0 -1
- package/dist/post-components/p-1c63cb03.js +0 -1
- package/dist/post-components/p-2e7cc4c6.entry.js +0 -1
- package/dist/post-components/p-370edca6.js +0 -1
- package/dist/post-components/p-3c3e8b19.js +0 -1
- package/dist/post-components/p-429b886d.js +0 -1
- package/dist/post-components/p-44564a68.js +0 -1
- package/dist/post-components/p-47420c6f.entry.js +0 -1
- package/dist/post-components/p-4973d1c7.entry.js +0 -1
- package/dist/post-components/p-6007889b.entry.js +0 -1
- package/dist/post-components/p-69bcb15f.entry.js +0 -1
- package/dist/post-components/p-771bd293.js +0 -1
- package/dist/post-components/p-8c0372c2.entry.js +0 -1
- package/dist/post-components/p-92ce53bc.entry.js +0 -1
- package/dist/post-components/p-991dff03.entry.js +0 -1
- package/dist/post-components/p-a0b62b51.js +0 -1
- package/dist/post-components/p-a2fa8c1d.entry.js +0 -1
- package/dist/post-components/p-ab6ce1d7.js +0 -1
- package/dist/post-components/p-b96307d5.entry.js +0 -1
- package/dist/post-components/p-d2f9de94.js +0 -2
- package/dist/post-components/p-de2ce222.js +0 -1
- package/dist/post-components/p-deb4131c.js +0 -1
- package/dist/post-components/p-e37ff727.entry.js +0 -1
- package/dist/post-components/p-eb3f324e.entry.js +0 -1
- package/dist/post-components/p-ee8845de.js +0 -1
- package/dist/post-components/p-fb1fb618.entry.js +0 -1
- package/dist/post-components/p-fbc24b84.js +0 -1
- package/dist/post-components/p-ff12fd7a.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-2ee42825.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}";
|
|
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: 'f2dc1deb73accc57667421b81aa7e20e4d984175', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: '52beb8265a7e31abcac2604bfcfabd0e39694161', class: "description" }, h("slot", { key: '8dfe1dc86d569f2ff9701491b5e9770521794822', onSlotchange: () => this.checkDescription() })), h("svg", { key: 'ecb4df5672c3d910980fc651c9e3afc716ebc607', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'eeba0f4822f0b06f7fc0fdde430c05690eb98f95', id: "Logo" }, h("rect", { key: 'b301434ef5c4a2c36ea51b3ffbefe7933f4ed111', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: 'a7f79c6d19e7abe674adc479ac2399c99f60d04f', 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: '8e8b6b8aa7e359c20058a7844a86e732f78365e2', 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:\"\";-webkit-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\");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;-webkit-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\");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.
|
|
@@ -1195,7 +2203,7 @@ function isOverflowElement(element) {
|
|
|
1195
2203
|
overflowX,
|
|
1196
2204
|
overflowY,
|
|
1197
2205
|
display
|
|
1198
|
-
} = getComputedStyle(element);
|
|
2206
|
+
} = getComputedStyle$1(element);
|
|
1199
2207
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1200
2208
|
}
|
|
1201
2209
|
function isTableElement(element) {
|
|
@@ -1212,7 +2220,7 @@ function isTopLayer(element) {
|
|
|
1212
2220
|
}
|
|
1213
2221
|
function isContainingBlock(elementOrCss) {
|
|
1214
2222
|
const webkit = isWebKit();
|
|
1215
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2223
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1216
2224
|
|
|
1217
2225
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1218
2226
|
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
@@ -1236,7 +2244,7 @@ function isWebKit() {
|
|
|
1236
2244
|
function isLastTraversableNode(node) {
|
|
1237
2245
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1238
2246
|
}
|
|
1239
|
-
function getComputedStyle(element) {
|
|
2247
|
+
function getComputedStyle$1(element) {
|
|
1240
2248
|
return getWindow(element).getComputedStyle(element);
|
|
1241
2249
|
}
|
|
1242
2250
|
function getNodeScroll(element) {
|
|
@@ -1294,7 +2302,7 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1294
2302
|
}
|
|
1295
2303
|
|
|
1296
2304
|
function getCssDimensions(element) {
|
|
1297
|
-
const css = getComputedStyle(element);
|
|
2305
|
+
const css = getComputedStyle$1(element);
|
|
1298
2306
|
// In testing environments, the `width` and `height` properties are empty
|
|
1299
2307
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1300
2308
|
let width = parseFloat(css.width) || 0;
|
|
@@ -1399,7 +2407,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1399
2407
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1400
2408
|
const iframeScale = getScale(currentIFrame);
|
|
1401
2409
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1402
|
-
const css = getComputedStyle(currentIFrame);
|
|
2410
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
1403
2411
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1404
2412
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1405
2413
|
x *= iframeScale.x;
|
|
@@ -1479,7 +2487,7 @@ function getDocumentRect(element) {
|
|
|
1479
2487
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1480
2488
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1481
2489
|
const y = -scroll.scrollTop;
|
|
1482
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
2490
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
1483
2491
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1484
2492
|
}
|
|
1485
2493
|
return {
|
|
@@ -1555,7 +2563,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
1555
2563
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1556
2564
|
return false;
|
|
1557
2565
|
}
|
|
1558
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2566
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1559
2567
|
}
|
|
1560
2568
|
|
|
1561
2569
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -1568,12 +2576,12 @@ function getClippingElementAncestors(element, cache) {
|
|
|
1568
2576
|
}
|
|
1569
2577
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1570
2578
|
let currentContainingBlockComputedStyle = null;
|
|
1571
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2579
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1572
2580
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1573
2581
|
|
|
1574
2582
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1575
2583
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1576
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
2584
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1577
2585
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1578
2586
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1579
2587
|
currentContainingBlockComputedStyle = null;
|
|
@@ -1664,11 +2672,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1664
2672
|
}
|
|
1665
2673
|
|
|
1666
2674
|
function isStaticPositioned(element) {
|
|
1667
|
-
return getComputedStyle(element).position === 'static';
|
|
2675
|
+
return getComputedStyle$1(element).position === 'static';
|
|
1668
2676
|
}
|
|
1669
2677
|
|
|
1670
2678
|
function getTrueOffsetParent(element, polyfill) {
|
|
1671
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2679
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
1672
2680
|
return null;
|
|
1673
2681
|
}
|
|
1674
2682
|
if (polyfill) {
|
|
@@ -1720,7 +2728,7 @@ const getElementRects = async function (data) {
|
|
|
1720
2728
|
};
|
|
1721
2729
|
|
|
1722
2730
|
function isRTL(element) {
|
|
1723
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
2731
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
1724
2732
|
}
|
|
1725
2733
|
|
|
1726
2734
|
const platform = {
|
|
@@ -2039,7 +3047,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
2039
3047
|
}
|
|
2040
3048
|
`,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
3049
|
|
|
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;
|
|
3050
|
+
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
3051
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
2044
3052
|
|
|
2045
3053
|
const SIDE_MAP = {
|
|
@@ -2053,6 +3061,7 @@ const PostPopovercontainer = class {
|
|
|
2053
3061
|
registerInstance(this, hostRef);
|
|
2054
3062
|
this.postToggle = createEvent(this, "postToggle", 7);
|
|
2055
3063
|
this.placement = 'top';
|
|
3064
|
+
this.edgeGap = 8;
|
|
2056
3065
|
this.arrow = false;
|
|
2057
3066
|
}
|
|
2058
3067
|
componentDidLoad() {
|
|
@@ -2124,11 +3133,12 @@ const PostPopovercontainer = class {
|
|
|
2124
3133
|
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2125
3134
|
}
|
|
2126
3135
|
async calculatePosition() {
|
|
3136
|
+
const gap = this.edgeGap;
|
|
2127
3137
|
const middleware = [
|
|
2128
3138
|
flip(),
|
|
2129
3139
|
inline(),
|
|
2130
3140
|
shift({
|
|
2131
|
-
padding:
|
|
3141
|
+
padding: gap,
|
|
2132
3142
|
// Prevents shifting away from the anchor too far, while shifting as far as possible
|
|
2133
3143
|
// https://floating-ui.com/docs/shift#limiter
|
|
2134
3144
|
limiter: limitShift({
|
|
@@ -2138,14 +3148,14 @@ const PostPopovercontainer = class {
|
|
|
2138
3148
|
size({
|
|
2139
3149
|
apply({ availableWidth, elements }) {
|
|
2140
3150
|
Object.assign(elements.floating.style, {
|
|
2141
|
-
maxWidth: `${availableWidth -
|
|
3151
|
+
maxWidth: `${availableWidth - gap * 2}px`,
|
|
2142
3152
|
});
|
|
2143
3153
|
},
|
|
2144
3154
|
}),
|
|
2145
|
-
offset(this.arrow ?
|
|
3155
|
+
offset(this.arrow ? gap + 4 : gap), // 4px outside of element to account for focus outline + ~arrow size
|
|
2146
3156
|
];
|
|
2147
3157
|
if (this.arrow) {
|
|
2148
|
-
middleware.push(arrow({ element: this.arrowRef, padding:
|
|
3158
|
+
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
2149
3159
|
}
|
|
2150
3160
|
const { x, y, middlewareData, placement: currentPlacement, } = await computePosition(this.eventTarget, this.host, {
|
|
2151
3161
|
placement: this.placement || 'top',
|
|
@@ -2173,12 +3183,49 @@ const PostPopovercontainer = class {
|
|
|
2173
3183
|
}
|
|
2174
3184
|
}
|
|
2175
3185
|
render() {
|
|
2176
|
-
return (h(Host, { key: '
|
|
3186
|
+
return (h(Host, { key: '844302edb3852f99229d4f4ccacf82cd78588435', "data-version": version }, this.arrow && (h("span", { key: 'ae293d24ef24282bfcaeb7f545653a563e5246d5', class: "arrow", ref: el => {
|
|
2177
3187
|
this.arrowRef = el;
|
|
2178
|
-
} })), h("slot", { key: '
|
|
3188
|
+
} })), h("slot", { key: '61dd3072a5217099028e3dd4b22fa845ea2f5970' })));
|
|
2179
3189
|
}
|
|
2180
3190
|
get host() { return getElement(this); }
|
|
2181
3191
|
};
|
|
2182
3192
|
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2183
3193
|
|
|
2184
|
-
|
|
3194
|
+
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}";
|
|
3195
|
+
const PostTogglebuttonStyle0 = postTogglebuttonCss;
|
|
3196
|
+
|
|
3197
|
+
const PostTogglebutton = class {
|
|
3198
|
+
constructor(hostRef) {
|
|
3199
|
+
registerInstance(this, hostRef);
|
|
3200
|
+
this.handleClick = () => {
|
|
3201
|
+
this.toggled = !this.toggled;
|
|
3202
|
+
};
|
|
3203
|
+
this.handleKeydown = (event) => {
|
|
3204
|
+
// perform a click when enter or spaced are pressed to mimic the button behavior
|
|
3205
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
3206
|
+
event.preventDefault(); // prevents the page from scrolling when space is pressed
|
|
3207
|
+
this.host.click();
|
|
3208
|
+
}
|
|
3209
|
+
};
|
|
3210
|
+
this.toggled = false;
|
|
3211
|
+
}
|
|
3212
|
+
validateToggled(value = this.toggled) {
|
|
3213
|
+
checkType(value, 'boolean', 'The "toggled" property of the post-togglebutton must be a boolean.');
|
|
3214
|
+
}
|
|
3215
|
+
componentWillLoad() {
|
|
3216
|
+
this.validateToggled();
|
|
3217
|
+
// add event listener to not override listener that might be set on the host
|
|
3218
|
+
this.host.addEventListener('click', () => this.handleClick());
|
|
3219
|
+
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
3220
|
+
}
|
|
3221
|
+
render() {
|
|
3222
|
+
return (h(Host, { key: '461f72ebada75a99921b7a166f67f2547aa6465e', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: 'cd5f4cc4df687cceacb3ea6c125b7b62f01b2712' })));
|
|
3223
|
+
}
|
|
3224
|
+
get host() { return getElement(this); }
|
|
3225
|
+
static get watchers() { return {
|
|
3226
|
+
"toggled": ["validateToggled"]
|
|
3227
|
+
}; }
|
|
3228
|
+
};
|
|
3229
|
+
PostTogglebutton.style = PostTogglebuttonStyle0;
|
|
3230
|
+
|
|
3231
|
+
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 };
|