@swisspost/design-system-components 9.0.0-next.9 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-5d4e0aed.js → index-824d2b71.js} +12 -2
- package/dist/cjs/{index-010dc207.js → index-e1f32cce.js} +17 -30
- package/dist/cjs/index.cjs.js +26 -50
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-8e810a59.js → package-3ed88bb9.js} +1 -1
- package/dist/cjs/{post-accordion-b9df8522.js → post-accordion-9ef382e8.js} +3 -3
- package/dist/cjs/post-accordion-item-5f685bee.js +52 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +4 -5
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/post-alert-88adc668.js +99 -0
- package/dist/cjs/{post-banner.cjs.entry.js → post-alert.cjs.entry.js} +5 -6
- package/dist/cjs/post-card-control-c6e5c427.js +272 -0
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/{post-collapsible-trigger-143cf84a.js → post-collapsible-trigger-1764e6dc.js} +24 -11
- package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -7
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-icon-f735da00.js +139 -0
- package/dist/cjs/post-icon.cjs.entry.js +16 -0
- package/dist/cjs/post-logo-2cd8ae98.js +39 -0
- package/dist/cjs/post-logo.cjs.entry.js +15 -0
- package/dist/cjs/post-popover-36c854a4.js +131 -0
- package/dist/cjs/post-popover.cjs.entry.js +3 -4
- package/dist/cjs/{post-togglebutton-0984a694.js → post-popovercontainer-cb4793c1.js} +148 -1106
- package/dist/cjs/post-popovercontainer.cjs.entry.js +11 -0
- package/dist/cjs/post-rating-d5073d8d.js +88 -0
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-b756d9b1.js +32 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-panel-60f211a5.js → post-tab-panel-97b79ecd.js} +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-1f797ce4.js → post-tabs-834497f2.js} +5 -5
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tag-c70fb945.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/post-tooltip-20ebe011.js +69 -0
- package/dist/cjs/{post-tooltip-38c839a4.js → post-tooltip-trigger-6f4c9748.js} +507 -557
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +12 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -8
- package/dist/collection/collection-manifest.json +4 -21
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +2 -2
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +10 -24
- package/dist/collection/components/post-alert/alert-types.js +1 -0
- package/dist/collection/components/post-alert/post-alert.css +35 -0
- package/dist/collection/components/{post-banner/post-banner.js → post-alert/post-alert.js} +68 -39
- package/dist/collection/components/post-card-control/post-card-control.css +30 -2
- package/dist/collection/components/post-card-control/post-card-control.js +8 -8
- package/dist/collection/components/post-collapsible/post-collapsible.js +2 -4
- package/dist/collection/components/post-icon/post-icon.css +1 -1
- package/dist/collection/components/post-icon/post-icon.js +52 -13
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-popover/post-popover.css +30 -2
- package/dist/collection/components/post-popover/post-popover.js +10 -6
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +31 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +180 -52
- package/dist/collection/components/post-rating/post-rating.css +29 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +29 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +2 -2
- package/dist/collection/components/post-tag/post-tag.css +29 -1
- package/dist/collection/components/post-tag/post-tag.js +2 -2
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +60 -213
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.css +1 -0
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +230 -0
- package/dist/collection/index.js +3 -20
- package/dist/components/index.js +3 -20
- package/dist/components/index2.js +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +12 -30
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/{post-list.d.ts → post-alert.d.ts} +4 -4
- package/dist/components/post-alert.js +6 -0
- package/dist/components/post-alert2.js +136 -0
- package/dist/components/post-card-control2.js +3 -3
- package/dist/components/post-collapsible-trigger2.js +17 -2
- package/dist/components/post-collapsible2.js +3 -5
- package/dist/components/post-icon2.js +54 -15
- package/dist/components/post-logo2.js +1 -1
- package/dist/components/post-popover2.js +35 -8
- package/dist/components/post-popovercontainer2.js +136 -41
- package/dist/components/post-rating2.js +2 -2
- package/dist/components/post-tab-header2.js +2 -2
- package/dist/components/post-tab-panel2.js +1 -1
- package/dist/components/post-tabs2.js +3 -3
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/{post-breadcrumb-item.d.ts → post-tooltip-trigger.d.ts} +4 -4
- package/dist/components/post-tooltip-trigger.js +6 -0
- package/dist/components/post-tooltip-trigger2.js +4968 -0
- package/dist/components/post-tooltip2.js +32 -4962
- package/dist/docs.json +401 -1776
- package/dist/esm/{index-b49c9904.js → index-69587a51.js} +12 -2
- package/dist/esm/{index-fb8d6be7.js → index-e1b64755.js} +17 -30
- package/dist/esm/index.js +20 -27
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-983f957d.js +3 -0
- package/dist/esm/{post-accordion-ee54a3ef.js → post-accordion-ad570427.js} +3 -3
- package/dist/esm/post-accordion-item-4db0aa2a.js +50 -0
- package/dist/esm/post-accordion-item.entry.js +4 -5
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/post-alert-1e9fbdfa.js +97 -0
- package/dist/esm/post-alert.entry.js +9 -0
- package/dist/esm/post-card-control-ccb189a8.js +270 -0
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/{post-collapsible-trigger-1c7833f8.js → post-collapsible-trigger-45fe328a.js} +22 -9
- package/dist/esm/post-collapsible_2.entry.js +4 -7
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-icon-3fc4dd7d.js +137 -0
- package/dist/esm/post-icon.entry.js +8 -0
- package/dist/esm/post-logo-e6cdea13.js +37 -0
- package/dist/esm/post-logo.entry.js +7 -0
- package/dist/esm/post-popover-afdf4906.js +129 -0
- package/dist/esm/post-popover.entry.js +3 -4
- package/dist/esm/{post-togglebutton-395bf3f0.js → post-popovercontainer-b19b7606.js} +149 -1093
- package/dist/esm/post-popovercontainer.entry.js +3 -0
- package/dist/esm/post-rating-f60024fa.js +86 -0
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-333e15d5.js +30 -0
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/{post-tab-panel-cafd9e04.js → post-tab-panel-0ddb05a2.js} +3 -3
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-beef8eae.js → post-tabs-ab7853cf.js} +5 -5
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tag-4a7d14b9.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/post-tooltip-c03cd719.js +67 -0
- package/dist/esm/{post-tooltip-b298039a.js → post-tooltip-trigger-1fefc8ad.js} +507 -557
- package/dist/esm/post-tooltip-trigger.entry.js +4 -0
- package/dist/esm/post-tooltip.entry.js +3 -8
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0a45da5e.entry.js +1 -0
- package/dist/post-components/p-12e82863.entry.js +1 -0
- package/dist/post-components/p-1386b77d.js +1 -0
- package/dist/post-components/p-1528b798.js +1 -0
- package/dist/post-components/p-18dc1299.entry.js +1 -0
- package/dist/post-components/p-1a8f6c84.entry.js +1 -0
- package/dist/post-components/p-256453ca.js +1 -0
- package/dist/post-components/p-3272ebad.js +1 -0
- package/dist/post-components/p-3596035e.js +1 -0
- package/dist/post-components/p-3668f4fa.entry.js +1 -0
- package/dist/post-components/p-375845d4.js +1 -0
- package/dist/post-components/p-381de59d.entry.js +1 -0
- package/dist/post-components/{p-c0ae9886.js → p-3eab790d.js} +1 -1
- package/dist/post-components/p-4e68c514.js +1 -0
- package/dist/post-components/p-4eb5d9a1.entry.js +1 -0
- package/dist/post-components/p-61a7d216.js +1 -0
- package/dist/post-components/p-788e64fb.js +1 -0
- package/dist/post-components/p-7d5b41d1.js +1 -0
- package/dist/post-components/p-82ea24e7.js +1 -0
- package/dist/post-components/p-85c4d04f.js +1 -0
- package/dist/post-components/p-85c6d001.entry.js +1 -0
- package/dist/post-components/p-8e555dda.js +15 -0
- package/dist/post-components/p-962a6f36.entry.js +1 -0
- package/dist/post-components/p-a76c71bc.js +1 -0
- package/dist/post-components/p-a7e8fd41.entry.js +1 -0
- package/dist/post-components/p-ac216bd0.entry.js +1 -0
- package/dist/post-components/p-b17ecbee.entry.js +1 -0
- package/dist/post-components/p-bb4227ad.entry.js +1 -0
- package/dist/post-components/p-bc294d0b.js +1 -0
- package/dist/post-components/p-d0b3c5d3.entry.js +1 -0
- package/dist/post-components/p-d4e148d8.entry.js +1 -0
- package/dist/post-components/p-d9809281.js +1 -0
- package/dist/post-components/p-eb1e7a49.js +1 -0
- package/dist/post-components/p-f35291d5.entry.js +1 -0
- package/dist/post-components/p-fc3bfe08.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-accordion/post-accordion.d.ts +1 -1
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +1 -7
- package/dist/types/components/post-alert/alert-types.d.ts +2 -0
- package/dist/types/components/post-alert/post-alert.d.ts +54 -0
- package/dist/types/components/post-card-control/post-card-control.d.ts +7 -7
- package/dist/types/components/post-icon/post-icon.d.ts +1 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +31 -13
- package/dist/types/components/post-tag/post-tag.d.ts +1 -1
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +20 -34
- package/dist/types/components/post-tooltip-trigger/post-tooltip-trigger.d.ts +47 -0
- package/dist/types/components.d.ts +124 -590
- package/dist/types/index.d.ts +3 -20
- package/loaders/index.d.ts +4 -38
- package/loaders/index.js +4 -21
- package/loaders/index2.js +1 -1
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +82 -1
- package/loaders/post-accordion.js +1 -1
- package/loaders/{post-list.d.ts → post-alert.d.ts} +4 -4
- package/loaders/post-alert.js +139 -0
- package/loaders/post-card-control.js +3 -3
- package/loaders/post-collapsible-trigger2.js +17 -2
- package/loaders/post-collapsible2.js +3 -5
- package/loaders/post-icon2.js +54 -15
- package/loaders/post-logo.js +2 -2
- package/loaders/post-popover.js +35 -8
- package/loaders/post-popovercontainer2.js +136 -41
- package/loaders/post-rating.js +2 -2
- package/loaders/post-tab-header.js +2 -2
- package/loaders/post-tab-panel.js +1 -1
- package/loaders/post-tabs.js +3 -3
- package/loaders/post-tag.js +2 -2
- package/loaders/{post-avatar.d.ts → post-tooltip-trigger.d.ts} +4 -4
- package/loaders/post-tooltip-trigger.js +4971 -0
- package/loaders/post-tooltip.js +32 -4962
- package/package.json +6 -9
- package/dist/cjs/attribute-observer-10f08c04.js +0 -27
- package/dist/cjs/check-url-3ffdd2fb.js +0 -14
- package/dist/cjs/debounce-1151afe3.js +0 -12
- package/dist/cjs/get-root-7a3498ef.js +0 -11
- package/dist/cjs/post-accordion-item-ecc6749f.js +0 -63
- package/dist/cjs/post-avatar-f7236084.js +0 -148
- package/dist/cjs/post-avatar.cjs.entry.js +0 -13
- package/dist/cjs/post-back-to-top-60762f8e.js +0 -75
- package/dist/cjs/post-back-to-top.cjs.entry.js +0 -15
- package/dist/cjs/post-banner-9662f22c.js +0 -90
- package/dist/cjs/post-breadcrumb-b40732fc.js +0 -111
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +0 -17
- package/dist/cjs/post-breadcrumb.cjs.entry.js +0 -13
- package/dist/cjs/post-card-control-039c9a4b.js +0 -272
- package/dist/cjs/post-closebutton_15.cjs.entry.js +0 -33
- package/dist/cjs/post-footer-5f7fdf96.js +0 -84
- package/dist/cjs/post-footer.cjs.entry.js +0 -11
- package/dist/cjs/post-menu-item-bb0b0b9e.js +0 -74
- package/dist/cjs/post-popover-d0ce9dc6.js +0 -104
- package/dist/cjs/post-rating-1082197c.js +0 -88
- package/dist/cjs/post-tab-header-4b6d8d54.js +0 -32
- package/dist/cjs/post-tag-ddaaaedc.js +0 -47
- package/dist/cjs/slide-5d51abe8.js +0 -28
- package/dist/collection/animations/slide.js +0 -23
- package/dist/collection/components/post-avatar/post-avatar.css +0 -3
- package/dist/collection/components/post-avatar/post-avatar.js +0 -237
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +0 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +0 -107
- package/dist/collection/components/post-banner/banner-types.js +0 -1
- package/dist/collection/components/post-banner/post-banner.css +0 -3
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +0 -3
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +0 -161
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +0 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +0 -93
- package/dist/collection/components/post-closebutton/post-closebutton.js +0 -12
- package/dist/collection/components/post-footer/post-footer.css +0 -1
- package/dist/collection/components/post-footer/post-footer.js +0 -75
- package/dist/collection/components/post-header/post-header.css +0 -1
- package/dist/collection/components/post-header/post-header.js +0 -160
- package/dist/collection/components/post-language-option/post-language-option.css +0 -3
- package/dist/collection/components/post-language-option/post-language-option.js +0 -215
- package/dist/collection/components/post-language-switch/post-language-switch.css +0 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +0 -163
- package/dist/collection/components/post-language-switch/switch-variants.js +0 -1
- package/dist/collection/components/post-list/post-list.css +0 -3
- package/dist/collection/components/post-list/post-list.js +0 -87
- package/dist/collection/components/post-list-item/post-list-item.css +0 -1
- package/dist/collection/components/post-list-item/post-list-item.js +0 -25
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +0 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +0 -52
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +0 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +0 -151
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +0 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +0 -104
- package/dist/collection/components/post-menu/post-menu.css +0 -3
- package/dist/collection/components/post-menu/post-menu.js +0 -280
- package/dist/collection/components/post-menu-item/post-menu-item.css +0 -1
- package/dist/collection/components/post-menu-item/post-menu-item.js +0 -20
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +0 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +0 -114
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +0 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +0 -74
- package/dist/collection/utils/breakpoints.js +0 -46
- package/dist/collection/utils/is-focusable.js +0 -26
- package/dist/components/attribute-observer.js +0 -25
- package/dist/components/debounce.js +0 -10
- package/dist/components/get-root.js +0 -9
- package/dist/components/post-avatar.d.ts +0 -11
- package/dist/components/post-avatar.js +0 -6
- package/dist/components/post-avatar2.js +0 -173
- package/dist/components/post-back-to-top.d.ts +0 -11
- package/dist/components/post-back-to-top.js +0 -6
- package/dist/components/post-back-to-top2.js +0 -100
- package/dist/components/post-banner.d.ts +0 -11
- package/dist/components/post-banner.js +0 -6
- package/dist/components/post-banner2.js +0 -125
- package/dist/components/post-breadcrumb-item.js +0 -6
- package/dist/components/post-breadcrumb-item2.js +0 -82
- package/dist/components/post-breadcrumb.d.ts +0 -11
- package/dist/components/post-breadcrumb.js +0 -6
- package/dist/components/post-breadcrumb2.js +0 -168
- package/dist/components/post-closebutton.d.ts +0 -11
- package/dist/components/post-closebutton.js +0 -6
- package/dist/components/post-closebutton2.js +0 -34
- package/dist/components/post-footer.d.ts +0 -11
- package/dist/components/post-footer.js +0 -6
- package/dist/components/post-footer2.js +0 -124
- package/dist/components/post-header.d.ts +0 -11
- package/dist/components/post-header.js +0 -6
- package/dist/components/post-header2.js +0 -276
- package/dist/components/post-language-option.d.ts +0 -11
- package/dist/components/post-language-option.js +0 -6
- package/dist/components/post-language-option2.js +0 -94
- package/dist/components/post-language-switch.d.ts +0 -11
- package/dist/components/post-language-switch.js +0 -6
- package/dist/components/post-language-switch2.js +0 -146
- package/dist/components/post-list-item.d.ts +0 -11
- package/dist/components/post-list-item.js +0 -6
- package/dist/components/post-list-item2.js +0 -35
- package/dist/components/post-list.js +0 -6
- package/dist/components/post-list2.js +0 -53
- package/dist/components/post-mainnavigation.d.ts +0 -11
- package/dist/components/post-mainnavigation.js +0 -6
- package/dist/components/post-mainnavigation2.js +0 -48
- package/dist/components/post-megadropdown-trigger.d.ts +0 -11
- package/dist/components/post-megadropdown-trigger.js +0 -6
- package/dist/components/post-megadropdown-trigger2.js +0 -91
- package/dist/components/post-megadropdown.d.ts +0 -11
- package/dist/components/post-megadropdown.js +0 -6
- package/dist/components/post-megadropdown2.js +0 -93
- package/dist/components/post-menu-item.d.ts +0 -11
- package/dist/components/post-menu-item.js +0 -6
- package/dist/components/post-menu-item2.js +0 -33
- package/dist/components/post-menu-trigger.d.ts +0 -11
- package/dist/components/post-menu-trigger.js +0 -6
- package/dist/components/post-menu-trigger2.js +0 -102
- package/dist/components/post-menu.d.ts +0 -11
- package/dist/components/post-menu.js +0 -6
- package/dist/components/post-menu2.js +0 -203
- package/dist/components/post-togglebutton.d.ts +0 -11
- package/dist/components/post-togglebutton.js +0 -6
- package/dist/components/post-togglebutton2.js +0 -61
- package/dist/components/slide.js +0 -25
- package/dist/esm/attribute-observer-37fa950a.js +0 -25
- package/dist/esm/check-url-a974431e.js +0 -12
- package/dist/esm/debounce-abe98cc2.js +0 -10
- package/dist/esm/get-root-7af2e0d1.js +0 -9
- package/dist/esm/package-4d81f3c2.js +0 -3
- package/dist/esm/post-accordion-item-e10452dc.js +0 -61
- package/dist/esm/post-avatar-5572fa73.js +0 -146
- package/dist/esm/post-avatar.entry.js +0 -5
- package/dist/esm/post-back-to-top-1d823c43.js +0 -73
- package/dist/esm/post-back-to-top.entry.js +0 -7
- package/dist/esm/post-banner-78480475.js +0 -88
- package/dist/esm/post-banner.entry.js +0 -10
- package/dist/esm/post-breadcrumb-aaa77f74.js +0 -109
- package/dist/esm/post-breadcrumb-item_2.entry.js +0 -8
- package/dist/esm/post-breadcrumb.entry.js +0 -5
- package/dist/esm/post-card-control-862aa961.js +0 -270
- package/dist/esm/post-closebutton_15.entry.js +0 -11
- package/dist/esm/post-footer-b18875e7.js +0 -82
- package/dist/esm/post-footer.entry.js +0 -3
- package/dist/esm/post-menu-item-2906384b.js +0 -71
- package/dist/esm/post-popover-2432bb3f.js +0 -102
- package/dist/esm/post-rating-95cbdbb8.js +0 -86
- package/dist/esm/post-tab-header-dfea00ea.js +0 -30
- package/dist/esm/post-tag-a77e7af6.js +0 -45
- package/dist/esm/slide-3422b8a3.js +0 -25
- package/dist/post-components/p-0711f76d.entry.js +0 -1
- package/dist/post-components/p-095a06f6.entry.js +0 -1
- package/dist/post-components/p-0b5a5f32.js +0 -1
- package/dist/post-components/p-135fa60f.js +0 -1
- package/dist/post-components/p-18e38d8a.js +0 -1
- package/dist/post-components/p-2e1ec074.entry.js +0 -1
- package/dist/post-components/p-4202b433.entry.js +0 -1
- package/dist/post-components/p-45773f59.js +0 -1
- package/dist/post-components/p-4953de7e.js +0 -1
- package/dist/post-components/p-4f67c5f5.entry.js +0 -1
- package/dist/post-components/p-4f9746f6.js +0 -15
- package/dist/post-components/p-5075c672.entry.js +0 -1
- package/dist/post-components/p-515e0f96.js +0 -1
- package/dist/post-components/p-5467b223.js +0 -1
- package/dist/post-components/p-67036798.entry.js +0 -1
- package/dist/post-components/p-6adeaa6c.js +0 -1
- package/dist/post-components/p-6d953fb2.js +0 -1
- package/dist/post-components/p-6edb0ac5.js +0 -1
- package/dist/post-components/p-6f8f39ca.js +0 -1
- package/dist/post-components/p-7503a623.js +0 -1
- package/dist/post-components/p-761b24c7.entry.js +0 -1
- package/dist/post-components/p-77c4c1d2.js +0 -1
- package/dist/post-components/p-7cf0c2ad.js +0 -1
- package/dist/post-components/p-856c14d6.entry.js +0 -1
- package/dist/post-components/p-866bf50a.entry.js +0 -1
- package/dist/post-components/p-8d621781.js +0 -1
- package/dist/post-components/p-8fe2d72c.entry.js +0 -1
- package/dist/post-components/p-9ad5088f.entry.js +0 -1
- package/dist/post-components/p-a1d2b90e.js +0 -1
- package/dist/post-components/p-a521419d.entry.js +0 -1
- package/dist/post-components/p-aa538648.js +0 -1
- package/dist/post-components/p-afdbee2f.js +0 -1
- package/dist/post-components/p-b02817f2.entry.js +0 -1
- package/dist/post-components/p-b157dcba.entry.js +0 -1
- package/dist/post-components/p-b22656b1.js +0 -1
- package/dist/post-components/p-bdbd11cb.js +0 -1
- package/dist/post-components/p-c537e196.entry.js +0 -1
- package/dist/post-components/p-d4f93f2b.js +0 -1
- package/dist/post-components/p-dca4246a.entry.js +0 -1
- package/dist/post-components/p-f319b026.js +0 -1
- package/dist/post-components/p-f4b7b379.js +0 -1
- package/dist/post-components/p-fac66087.entry.js +0 -1
- package/dist/post-components/p-fc91cbc2.js +0 -1
- package/dist/types/animations/slide.d.ts +0 -2
- package/dist/types/components/post-avatar/post-avatar.d.ts +0 -51
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +0 -19
- package/dist/types/components/post-banner/banner-types.d.ts +0 -2
- package/dist/types/components/post-banner/post-banner.d.ts +0 -49
- package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +0 -30
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +0 -16
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +0 -7
- package/dist/types/components/post-footer/post-footer.d.ts +0 -23
- package/dist/types/components/post-header/post-header.d.ts +0 -24
- package/dist/types/components/post-language-option/post-language-option.d.ts +0 -45
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +0 -31
- package/dist/types/components/post-language-switch/switch-variants.d.ts +0 -2
- package/dist/types/components/post-list/post-list.d.ts +0 -24
- package/dist/types/components/post-list-item/post-list-item.d.ts +0 -8
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +0 -19
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +0 -35
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +0 -25
- package/dist/types/components/post-menu/post-menu.d.ts +0 -48
- package/dist/types/components/post-menu-item/post-menu-item.d.ts +0 -4
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +0 -27
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +0 -15
- package/dist/types/utils/breakpoints.d.ts +0 -11
- package/dist/types/utils/is-focusable.d.ts +0 -1
- package/loaders/attribute-observer.js +0 -25
- package/loaders/debounce.js +0 -10
- package/loaders/get-root.js +0 -9
- package/loaders/post-accordion-item2.js +0 -102
- package/loaders/post-avatar.js +0 -176
- package/loaders/post-back-to-top.d.ts +0 -11
- package/loaders/post-back-to-top.js +0 -103
- package/loaders/post-banner.d.ts +0 -11
- package/loaders/post-banner.js +0 -128
- package/loaders/post-breadcrumb-item.d.ts +0 -11
- package/loaders/post-breadcrumb-item.js +0 -6
- package/loaders/post-breadcrumb-item2.js +0 -82
- package/loaders/post-breadcrumb.d.ts +0 -11
- package/loaders/post-breadcrumb.js +0 -171
- package/loaders/post-closebutton.d.ts +0 -11
- package/loaders/post-closebutton.js +0 -37
- package/loaders/post-footer.d.ts +0 -11
- package/loaders/post-footer.js +0 -127
- package/loaders/post-header.d.ts +0 -11
- package/loaders/post-header.js +0 -279
- package/loaders/post-language-option.d.ts +0 -11
- package/loaders/post-language-option.js +0 -97
- package/loaders/post-language-switch.d.ts +0 -11
- package/loaders/post-language-switch.js +0 -149
- package/loaders/post-list-item.d.ts +0 -11
- package/loaders/post-list-item.js +0 -38
- package/loaders/post-list.js +0 -56
- package/loaders/post-mainnavigation.d.ts +0 -11
- package/loaders/post-mainnavigation.js +0 -51
- package/loaders/post-megadropdown-trigger.d.ts +0 -11
- package/loaders/post-megadropdown-trigger.js +0 -94
- package/loaders/post-megadropdown.d.ts +0 -11
- package/loaders/post-megadropdown.js +0 -96
- package/loaders/post-menu-item.d.ts +0 -11
- package/loaders/post-menu-item.js +0 -6
- package/loaders/post-menu-item2.js +0 -33
- package/loaders/post-menu-trigger.d.ts +0 -11
- package/loaders/post-menu-trigger.js +0 -6
- package/loaders/post-menu-trigger2.js +0 -102
- package/loaders/post-menu.d.ts +0 -11
- package/loaders/post-menu.js +0 -6
- package/loaders/post-menu2.js +0 -203
- package/loaders/post-togglebutton.d.ts +0 -11
- package/loaders/post-togglebutton.js +0 -64
- package/loaders/slide.js +0 -25
|
@@ -1,1005 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement
|
|
2
|
-
import { v as version } from './package-
|
|
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 { g as getRoot } from './get-root-7af2e0d1.js';
|
|
8
|
-
|
|
9
|
-
const PostClosebutton = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
registerInstance(this, hostRef);
|
|
12
|
-
}
|
|
13
|
-
render() {
|
|
14
|
-
return (h(Host, { key: 'cb5be35247053b1227c32f7949baca51ccc31081', "data-version": version }, h("button", { key: 'b68dc109cc7a9a99b85fc995447bc7c0b0ddc3bf', class: "btn btn-icon-close" }, h("post-icon", { key: '9276c885e5b48092a0a24285ec6cd4301a4fc032', "aria-hidden": "true", name: "closex" }), h("span", { key: '3e04657ab677186830d80b8dabe769d70b6b8e8e', class: "visually-hidden" }, h("slot", { key: 'c2c9e8df9f62516a1b88b1dbc3949287fbaa3991' })))));
|
|
15
|
-
}
|
|
16
|
-
get host() { return getElement(this); }
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Throttle execution of a function. Especially useful for rate limiting
|
|
23
|
-
* execution of handlers on events like resize and scroll.
|
|
24
|
-
*
|
|
25
|
-
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
26
|
-
* are most useful.
|
|
27
|
-
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
28
|
-
* as-is, to `callback` when the throttled-function is executed.
|
|
29
|
-
* @param {object} [options] - An object to configure options.
|
|
30
|
-
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
31
|
-
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
32
|
-
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
33
|
-
* `delay` milliseconds, the internal counter is reset).
|
|
34
|
-
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
35
|
-
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
36
|
-
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
37
|
-
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
38
|
-
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Function} A new, throttled, function.
|
|
41
|
-
*/
|
|
42
|
-
function throttle (delay, callback, options) {
|
|
43
|
-
var _ref = options || {},
|
|
44
|
-
_ref$noTrailing = _ref.noTrailing,
|
|
45
|
-
noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
|
|
46
|
-
_ref$noLeading = _ref.noLeading,
|
|
47
|
-
noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
|
|
48
|
-
_ref$debounceMode = _ref.debounceMode,
|
|
49
|
-
debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
|
|
50
|
-
/*
|
|
51
|
-
* After wrapper has stopped being called, this timeout ensures that
|
|
52
|
-
* `callback` is executed at the proper times in `throttle` and `end`
|
|
53
|
-
* debounce modes.
|
|
54
|
-
*/
|
|
55
|
-
var timeoutID;
|
|
56
|
-
var cancelled = false;
|
|
57
|
-
|
|
58
|
-
// Keep track of the last time `callback` was executed.
|
|
59
|
-
var lastExec = 0;
|
|
60
|
-
|
|
61
|
-
// Function to clear existing timeout
|
|
62
|
-
function clearExistingTimeout() {
|
|
63
|
-
if (timeoutID) {
|
|
64
|
-
clearTimeout(timeoutID);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Function to cancel next exec
|
|
69
|
-
function cancel(options) {
|
|
70
|
-
var _ref2 = options || {},
|
|
71
|
-
_ref2$upcomingOnly = _ref2.upcomingOnly,
|
|
72
|
-
upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
73
|
-
clearExistingTimeout();
|
|
74
|
-
cancelled = !upcomingOnly;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/*
|
|
78
|
-
* The `wrapper` function encapsulates all of the throttling / debouncing
|
|
79
|
-
* functionality and when executed will limit the rate at which `callback`
|
|
80
|
-
* is executed.
|
|
81
|
-
*/
|
|
82
|
-
function wrapper() {
|
|
83
|
-
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
84
|
-
arguments_[_key] = arguments[_key];
|
|
85
|
-
}
|
|
86
|
-
var self = this;
|
|
87
|
-
var elapsed = Date.now() - lastExec;
|
|
88
|
-
if (cancelled) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Execute `callback` and update the `lastExec` timestamp.
|
|
93
|
-
function exec() {
|
|
94
|
-
lastExec = Date.now();
|
|
95
|
-
callback.apply(self, arguments_);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/*
|
|
99
|
-
* If `debounceMode` is true (at begin) this is used to clear the flag
|
|
100
|
-
* to allow future `callback` executions.
|
|
101
|
-
*/
|
|
102
|
-
function clear() {
|
|
103
|
-
timeoutID = undefined;
|
|
104
|
-
}
|
|
105
|
-
if (!noLeading && debounceMode && !timeoutID) {
|
|
106
|
-
/*
|
|
107
|
-
* Since `wrapper` is being called for the first time and
|
|
108
|
-
* `debounceMode` is true (at begin), execute `callback`
|
|
109
|
-
* and noLeading != true.
|
|
110
|
-
*/
|
|
111
|
-
exec();
|
|
112
|
-
}
|
|
113
|
-
clearExistingTimeout();
|
|
114
|
-
if (debounceMode === undefined && elapsed > delay) {
|
|
115
|
-
if (noLeading) {
|
|
116
|
-
/*
|
|
117
|
-
* In throttle mode with noLeading, if `delay` time has
|
|
118
|
-
* been exceeded, update `lastExec` and schedule `callback`
|
|
119
|
-
* to execute after `delay` ms.
|
|
120
|
-
*/
|
|
121
|
-
lastExec = Date.now();
|
|
122
|
-
if (!noTrailing) {
|
|
123
|
-
timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
/*
|
|
127
|
-
* In throttle mode without noLeading, if `delay` time has been exceeded, execute
|
|
128
|
-
* `callback`.
|
|
129
|
-
*/
|
|
130
|
-
exec();
|
|
131
|
-
}
|
|
132
|
-
} else if (noTrailing !== true) {
|
|
133
|
-
/*
|
|
134
|
-
* In trailing throttle mode, since `delay` time has not been
|
|
135
|
-
* exceeded, schedule `callback` to execute `delay` ms after most
|
|
136
|
-
* recent execution.
|
|
137
|
-
*
|
|
138
|
-
* If `debounceMode` is true (at begin), schedule `clear` to execute
|
|
139
|
-
* after `delay` ms.
|
|
140
|
-
*
|
|
141
|
-
* If `debounceMode` is false (at end), schedule `callback` to
|
|
142
|
-
* execute after `delay` ms.
|
|
143
|
-
*/
|
|
144
|
-
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
wrapper.cancel = cancel;
|
|
148
|
-
|
|
149
|
-
// Return the wrapper function.
|
|
150
|
-
return wrapper;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const postHeaderCss = "*,::before,::after{box-sizing:border-box}:host{--global-header-height:72px;--global-header-minimal-height:24px;--main-header-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}}.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);height:var(--global-header-height)}.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}.title-header{display:flex;align-items:center;gap:var(--post-core-dimension-4);height:var(--main-header-height);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)}}:host(:not(:has([slot=title]))) .title-header{display:none}::slotted(h1){margin:0 !important}@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}}@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)}}";
|
|
154
|
-
const PostHeaderStyle0 = postHeaderCss;
|
|
155
|
-
|
|
156
|
-
const PostHeader = class {
|
|
157
|
-
constructor(hostRef) {
|
|
158
|
-
registerInstance(this, hostRef);
|
|
159
|
-
this.scrollParent = null;
|
|
160
|
-
this.throttledScroll = () => this.handleScrollEvent();
|
|
161
|
-
this.throttledResize = throttle(50, () => this.handleResize());
|
|
162
|
-
this.device = null;
|
|
163
|
-
this.mobileMenuExtended = false;
|
|
164
|
-
}
|
|
165
|
-
componentWillRender() {
|
|
166
|
-
this.scrollParent = this.getScrollParent(this.host);
|
|
167
|
-
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
168
|
-
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
169
|
-
this.handleResize();
|
|
170
|
-
this.handleScrollEvent();
|
|
171
|
-
}
|
|
172
|
-
frozeBody(isMobileMenuExtended) {
|
|
173
|
-
document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Toggles the mobile navigation.
|
|
177
|
-
*/
|
|
178
|
-
async toggleMobileMenu() {
|
|
179
|
-
if (this.device === 'desktop')
|
|
180
|
-
return;
|
|
181
|
-
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
182
|
-
? slideUp(this.mobileMenu)
|
|
183
|
-
: slideDown(this.mobileMenu);
|
|
184
|
-
// Update the state of the toggle button
|
|
185
|
-
const menuButton = this.host.querySelector('post-togglebutton');
|
|
186
|
-
menuButton.toggled = !this.mobileMenuExtended;
|
|
187
|
-
// Toggle menu visibility before it slides down and after it slides back up
|
|
188
|
-
if (this.mobileMenuExtended)
|
|
189
|
-
await this.mobileMenuAnimation.finished;
|
|
190
|
-
this.mobileMenuExtended = !this.mobileMenuExtended;
|
|
191
|
-
if (!this.mobileMenuExtended)
|
|
192
|
-
await this.mobileMenuAnimation.finished;
|
|
193
|
-
}
|
|
194
|
-
handleScrollEvent() {
|
|
195
|
-
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
196
|
-
const st = Math.max(0, this.scrollParent instanceof Document
|
|
197
|
-
? this.scrollParent.documentElement.scrollTop
|
|
198
|
-
: this.scrollParent.scrollTop);
|
|
199
|
-
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
200
|
-
}
|
|
201
|
-
getScrollParent(node) {
|
|
202
|
-
let currentParent = node.parentElement;
|
|
203
|
-
while (currentParent) {
|
|
204
|
-
if (currentParent.nodeName === 'BODY') {
|
|
205
|
-
return document;
|
|
206
|
-
}
|
|
207
|
-
if (this.isScrollable(currentParent)) {
|
|
208
|
-
return currentParent;
|
|
209
|
-
}
|
|
210
|
-
currentParent = currentParent.parentElement;
|
|
211
|
-
}
|
|
212
|
-
return document;
|
|
213
|
-
}
|
|
214
|
-
isScrollable(node) {
|
|
215
|
-
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
const style = getComputedStyle(node);
|
|
219
|
-
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
220
|
-
const value = style.getPropertyValue(propertyName);
|
|
221
|
-
return value === 'auto' || value === 'scroll';
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
handleResize() {
|
|
225
|
-
const previousDevice = this.device;
|
|
226
|
-
let newDevice;
|
|
227
|
-
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
228
|
-
if (width >= 1024) {
|
|
229
|
-
newDevice = 'desktop';
|
|
230
|
-
}
|
|
231
|
-
else if (width >= 600) {
|
|
232
|
-
newDevice = 'tablet';
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
newDevice = 'mobile';
|
|
236
|
-
}
|
|
237
|
-
// Close any open mobile menu
|
|
238
|
-
if (newDevice === 'desktop' && this.mobileMenuExtended) {
|
|
239
|
-
this.toggleMobileMenu();
|
|
240
|
-
this.mobileMenuAnimation.finish(); // no animation
|
|
241
|
-
}
|
|
242
|
-
// Apply only on change for doing work only when necessary
|
|
243
|
-
if (newDevice !== previousDevice) {
|
|
244
|
-
this.device = newDevice;
|
|
245
|
-
window.requestAnimationFrame(() => {
|
|
246
|
-
this.switchLanguageSwitchMode();
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
switchLanguageSwitchMode() {
|
|
251
|
-
var _a;
|
|
252
|
-
const variant = this.device === 'desktop' ? 'dropdown' : 'list';
|
|
253
|
-
(_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
|
|
254
|
-
}
|
|
255
|
-
render() {
|
|
256
|
-
const navigationClasses = ['navigation'];
|
|
257
|
-
if (this.mobileMenuExtended) {
|
|
258
|
-
navigationClasses.push('extended');
|
|
259
|
-
}
|
|
260
|
-
return (h(Host, { key: 'd96b46b64946ef425059463d127fa1188c99ea58', version: version }, h("div", { key: '831ebc53d0f598a99e72d46a1530c2c34c196948', class: "global-header" }, h("div", { key: '69f3b3bc47a61810eea3ae60d7b2423af1750416', class: "global-sub" }, h("div", { key: 'ad6d36c7e7f029edfdee223ab1df664a1b7002f8', class: "logo" }, h("slot", { key: '95adfc2ad9e63fde9eef3cc71b63247e140fba3d', name: "post-logo" }))), h("div", { key: '741e62693a4df8558213c85d7a837efb8b0cfa6d', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '992844b617955cb77079a175fcaaf54943a6eef2', name: "meta-navigation" }), h("slot", { key: '4384ae4c04d239bf1b1947ba6d1457ae6879a5cf', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'c5b33b6bfb8c00d44710ec997a80d56720aab760', name: "post-language-switch" }), h("div", { key: '25a629a419c94fc4789eb374b87cf7c159b746c6', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '3f3078832237abc5a6df79b4a57fe20fae926aa3', name: "post-togglebutton" })))), h("div", { key: 'e11ca83bc108d4677e849b7386ad7bd09d8c9331', class: "title-header d-flex space-between align-center" }, h("slot", { key: '87430ad15ab09f800b714be45be00a50e5b7dc0a', name: "title" }), h("div", { key: '494a198d3ee8185a26b16fce97a85bed01d6b3f7', class: "global-sub" }, h("slot", { key: '8a54e3d1366d39c11d64c0de90f35a4330836428', name: "local-controls" }), h("slot", { key: '63f841457e0f7b7722a3f8b1ea83ff0d78d9c08e' }))), h("div", { key: '90cf667c412d90f8e466e7e7925fa4a2f8223ad8', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { key: 'a046286cb6cc770bfb8fb4439cdacac7c351001b', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { key: '6e0ad5841ef53daf0c0885b75efdf12d69f4a72d', class: "navigation-footer" }, h("slot", { key: '1eaebace0d5e37794867ae2a317a104726bb873a', name: "meta-navigation" }), h("slot", { key: '79217cd6fd16d4c6ef3e8aaa656e6dc0a8842b23', name: "post-language-switch" }))))));
|
|
261
|
-
}
|
|
262
|
-
get host() { return getElement(this); }
|
|
263
|
-
static get watchers() { return {
|
|
264
|
-
"mobileMenuExtended": ["frozeBody"]
|
|
265
|
-
}; }
|
|
266
|
-
};
|
|
267
|
-
PostHeader.style = PostHeaderStyle0;
|
|
268
|
-
|
|
269
|
-
const postIconCss = ":host{container-name:post-icon;container-type:inline-size;display:inline-block;width:1em;height:1em;vertical-align:-0.15em}svg{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color}@container post-icon (max-width: 23.98px){svg{--pis-16: block}}@container post-icon (min-width: 24px) and (max-width: 31.98px){svg{--pis-24: block}}@container post-icon (min-width: 32px) and (max-width: 39.98px){svg{--pis-32: block}}@container post-icon (min-width: 40px) and (max-width: 47.98px){svg{--pis-40: block}}@container post-icon (min-width: 48px) and (max-width: 63.98px){svg{--pis-48: block}}@container post-icon (min-width: 64px){svg{--pis-64: block}}: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)}}";
|
|
270
|
-
const PostIconStyle0 = postIconCss;
|
|
271
|
-
|
|
272
|
-
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
273
|
-
const ANIMATION_NAMES = [
|
|
274
|
-
'cylon',
|
|
275
|
-
'cylon-vertical',
|
|
276
|
-
'spin',
|
|
277
|
-
'spin-reverse',
|
|
278
|
-
'fade',
|
|
279
|
-
'throb',
|
|
280
|
-
];
|
|
281
|
-
const ANIMATION_KEYS = [...ANIMATION_NAMES];
|
|
282
|
-
const PostIcon = class {
|
|
283
|
-
constructor(hostRef) {
|
|
284
|
-
registerInstance(this, hostRef);
|
|
285
|
-
this.animation = null;
|
|
286
|
-
this.base = null;
|
|
287
|
-
this.flipH = false;
|
|
288
|
-
this.flipV = false;
|
|
289
|
-
this.name = undefined;
|
|
290
|
-
this.rotate = null;
|
|
291
|
-
this.scale = null;
|
|
292
|
-
}
|
|
293
|
-
validateAnimation(newValue = this.animation) {
|
|
294
|
-
if (newValue !== undefined)
|
|
295
|
-
checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon "animation" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);
|
|
296
|
-
}
|
|
297
|
-
validateBase(newValue = this.base) {
|
|
298
|
-
checkEmptyOrType(newValue, 'string', 'The post-icon "base" prop should be a string.');
|
|
299
|
-
}
|
|
300
|
-
validateFlipH(newValue = this.flipH) {
|
|
301
|
-
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipH" prop should be a boolean.');
|
|
302
|
-
}
|
|
303
|
-
validateFlipV(newValue = this.flipV) {
|
|
304
|
-
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
|
|
305
|
-
}
|
|
306
|
-
validateName(newValue = this.name) {
|
|
307
|
-
checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
|
|
308
|
-
checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
|
|
309
|
-
}
|
|
310
|
-
validateRotate(newValue = this.rotate) {
|
|
311
|
-
checkEmptyOrType(newValue, 'number', 'The post-icon "rotate" prop should be a number.');
|
|
312
|
-
}
|
|
313
|
-
validateScale(newValue = this.scale) {
|
|
314
|
-
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
315
|
-
}
|
|
316
|
-
getPath() {
|
|
317
|
-
var _a, _b, _c, _d, _e, _f;
|
|
318
|
-
// Construct icon path from different possible sources
|
|
319
|
-
const metaBase = (_b = (_a = document.head
|
|
320
|
-
.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;
|
|
321
|
-
const baseHref = (_c = document.getElementsByTagName('base')[0]) === null || _c === void 0 ? void 0 : _c.href;
|
|
322
|
-
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(/\/\/$/, '/');
|
|
323
|
-
const fileName = `${this.name}.svg#i-${this.name}`;
|
|
324
|
-
const filePath = `${fileBase}${fileName}`;
|
|
325
|
-
return new URL(filePath, window.location.origin).toString();
|
|
326
|
-
}
|
|
327
|
-
getStyles() {
|
|
328
|
-
return Object.entries({
|
|
329
|
-
transform: (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
330
|
-
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
331
|
-
})
|
|
332
|
-
.filter(([_key, value]) => value !== null)
|
|
333
|
-
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
334
|
-
}
|
|
335
|
-
componentDidLoad() {
|
|
336
|
-
this.validateBase();
|
|
337
|
-
this.validateName();
|
|
338
|
-
this.validateFlipH();
|
|
339
|
-
this.validateFlipV();
|
|
340
|
-
this.validateScale();
|
|
341
|
-
this.validateRotate();
|
|
342
|
-
this.validateAnimation();
|
|
343
|
-
}
|
|
344
|
-
render() {
|
|
345
|
-
return (h(Host, { key: '7864661c5ba45508fa3902c49fd0da1d6c026795', "data-version": version }, h("svg", { key: '588f70bd81afc4cc5a312388aa6225bc9c853b57', style: this.getStyles() }, h("use", { key: 'c4505cf12ddf083ad86b3b9304ffbf37ac3489d1', href: this.getPath() }))));
|
|
346
|
-
}
|
|
347
|
-
get host() { return getElement(this); }
|
|
348
|
-
static get watchers() { return {
|
|
349
|
-
"animation": ["validateAnimation"],
|
|
350
|
-
"base": ["validateBase"],
|
|
351
|
-
"flipH": ["validateFlipH"],
|
|
352
|
-
"flipV": ["validateFlipV"],
|
|
353
|
-
"name": ["validateName"],
|
|
354
|
-
"rotate": ["validateRotate"],
|
|
355
|
-
"scale": ["validateScale"]
|
|
356
|
-
}; }
|
|
357
|
-
};
|
|
358
|
-
PostIcon.style = PostIconStyle0;
|
|
359
|
-
|
|
360
|
-
const postLanguageOptionCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block;width:fit-content}button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}a{color:inherit;text-decoration:none}:is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding)}.post-language-option-list{border-radius:2px;width:40px;height:40px}.post-language-option-list{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-list: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-list:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-option-list: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-list:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-option-list[aria-current=true],.post-language-option-list[aria-current=page]{background-color:#050400;color:#fff}.post-language-option-dropdown{padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative}.post-language-option-dropdown[aria-current=true]::after,.post-language-option-dropdown[aria-current=page]::after{content:\"\";left:-2px;height:3px;background-color:#504f4b;width:calc(100% + 4px);display:block;position:absolute;bottom:3px}.post-language-option-dropdown[aria-current=true]:focus::after,.post-language-option-dropdown[aria-current=page]:focus::after{width:calc(100% - 5px);left:2px}";
|
|
361
|
-
const PostLanguageOptionStyle0 = postLanguageOptionCss;
|
|
362
|
-
|
|
363
|
-
const PostLanguageOption = class {
|
|
364
|
-
constructor(hostRef) {
|
|
365
|
-
registerInstance(this, hostRef);
|
|
366
|
-
this.postChange = createEvent(this, "postChange", 7);
|
|
367
|
-
this.code = undefined;
|
|
368
|
-
this.active = undefined;
|
|
369
|
-
this.variant = undefined;
|
|
370
|
-
this.name = undefined;
|
|
371
|
-
this.url = undefined;
|
|
372
|
-
}
|
|
373
|
-
validateCode(value = this.code) {
|
|
374
|
-
checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
|
|
375
|
-
}
|
|
376
|
-
validateActiveProp(value = this.active) {
|
|
377
|
-
checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
|
|
378
|
-
}
|
|
379
|
-
validateName(value = this.name) {
|
|
380
|
-
checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
|
|
381
|
-
}
|
|
382
|
-
validateUrl(value = this.url) {
|
|
383
|
-
checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
|
|
384
|
-
}
|
|
385
|
-
componentDidLoad() {
|
|
386
|
-
this.validateCode();
|
|
387
|
-
this.validateActiveProp();
|
|
388
|
-
this.validateName();
|
|
389
|
-
this.validateUrl();
|
|
390
|
-
if (!this.name && this.isNameRequired()) {
|
|
391
|
-
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Selects the language option programmatically.
|
|
396
|
-
*/
|
|
397
|
-
async select() {
|
|
398
|
-
this.active = true;
|
|
399
|
-
this.emitChange();
|
|
400
|
-
}
|
|
401
|
-
emitChange() {
|
|
402
|
-
this.postChange.emit(this.code);
|
|
403
|
-
}
|
|
404
|
-
isNameRequired() {
|
|
405
|
-
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
406
|
-
}
|
|
407
|
-
render() {
|
|
408
|
-
const lang = this.code.toLowerCase();
|
|
409
|
-
return (h(Host, { key: '9a3f49ee993b69393ea8f81b671cd5482049ff1c', "data-version": version, role: "listitem" }, this.url ? (h("a", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange() }, h("slot", null))) : (h("button", { class: this.variant ? `post-language-option-${this.variant}` : '', "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange() }, h("slot", null)))));
|
|
410
|
-
}
|
|
411
|
-
get host() { return getElement(this); }
|
|
412
|
-
static get watchers() { return {
|
|
413
|
-
"code": ["validateCode"],
|
|
414
|
-
"active": ["validateActiveProp"],
|
|
415
|
-
"name": ["validateName"],
|
|
416
|
-
"url": ["validateUrl"]
|
|
417
|
-
}; }
|
|
418
|
-
};
|
|
419
|
-
PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
420
|
-
|
|
421
|
-
const SWITCH_VARIANTS = ['list', 'dropdown'];
|
|
422
|
-
|
|
423
|
-
const urlAlphabet =
|
|
424
|
-
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
425
|
-
|
|
426
|
-
let nanoid = (size = 21) => {
|
|
427
|
-
let id = '';
|
|
428
|
-
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
|
|
429
|
-
while (size--) {
|
|
430
|
-
id += urlAlphabet[bytes[size] & 63];
|
|
431
|
-
}
|
|
432
|
-
return id
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
const postLanguageSwitchCss = ":host{display:block}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.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
|
-
componentShouldUpdate() {
|
|
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 === 'dropdown') {
|
|
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 }, h("div", { 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 || crypto.randomUUID()}`;
|
|
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: '4f982e717530514589c5528553b70463d678b676', "data-version": version }, h("div", { key: 'cc65ed208f48e7a22482af96fd069d05363f2617', ref: el => (this.titleEl = el), id: this.titleId, class: `list-title${this.titleHidden ? ' visually-hidden' : ''}` }, h("slot", { key: '0f8bbeade50b59e53767ce2169dd57bb79644705' })), h("div", { key: '7fa5de37a169e6f76928c2088c46ee747427887e', role: "list", "aria-labelledby": this.titleId }, h("slot", { key: '86b4d71b83671babb61dd12e842710d67350a09e', 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: 'aa9a31c64e3e8ba5dcac1d03b54ab3c886149c1f', role: "listitem", slot: "post-list-item" }, h("slot", { key: '06353140f8917fc5373de6d56708467af2ef52b2' })));
|
|
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: 'b8d47e2530eb39f7b05370b4cea0b728cb00a1fb', "data-version": version, slot: "post-logo" }, h(LogoTag, Object.assign({ key: '47a4d88622aab30e652a08827e221dacda36cb48', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: '4eb6ad1bc6c165197b6bcce8fe1146eb9d48fb21', class: "description" }, h("slot", { key: 'c66a4385f19711daab6f4ba87d5f78f59ad8b263', onSlotchange: () => this.checkDescription() })), h("svg", { key: '824643e64a3fb0914082f8f78a11753d66c98842', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'e4f63d237c1fe1128005f29ea604c865f6b50943', id: "Logo" }, h("rect", { key: '34fec89177fb5461318d3e8fcc725f32dd97057a', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '5600de7c21a8e363fffa35710a3f41e4295b76c7', 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: '719be82825355704c4eac3c60fb461f6303734f7', 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)}}";
|
|
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: 'f21c438ac0bbcb08e08fd419589bf92b7d8b3a61', slot: "post-mainnavigation" }, h("div", { key: '1925f47932d7e842e8b9f059d7ade955c577fa50', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: 'fe18f6859a6d79c7ae701b65a31be1eab9c8b2ac', name: "back-button" })), h("nav", { key: 'ad2b0a52bc0bcf78a3c3340ba163ee6167be2c73' }, h("slot", { key: '8fc7b01cc0f3729cd2c12c4967ec87891fe0dcf5' }))));
|
|
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{--post-global-header-height:72px;--post-main-header-height:56px;--post-header-height:calc(var(--post-global-header-height) + var(--post-main-header-height));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{--post-global-header-height:64px;position:absolute;top:var(--post-header-height) !important;bottom:0;left:0;width:100%;height:auto}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
|
-
render() {
|
|
683
|
-
return (h(Host, { key: 'cfd4e6c7bb87c50e471d304a4b4f086266e1c2fe' }, h("post-popovercontainer", { key: '31dc3a5e98a5c60a4db8d47375491a6f3957af0b', class: this.animationClass, placement: "bottom", "edge-gap": "0", ref: el => (this.popoverRef = el) }, h("div", { key: '7001d0e108544a0244af088be0bde49f90a3dea3', class: "megadropdown" }, h("div", { key: '513b0710163e8f58677b6b50d2ba2d241cf9ff35', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '5457c0b9bfff045f39f470e600b5aa31036c0807', name: "back-button" })), h("div", { key: 'c3314a4ae4f386224a2db7fe32203f72f6a1b284', onClick: () => this.handleCloseButtonClick(), class: "close-button" }, h("slot", { key: '8feeec24fe5f2522ba1a54ab0b7c682d3a152086', name: "close-button" })), h("slot", { key: '6d9426756a809ed26045c9cd56cacf0f36aa9400', name: "megadropdown-title" }), h("div", { key: 'fd3b0ac7998eec76700ccc6668d8b2e3fcc4c63a', class: "megadropdown-content" }, h("slot", { key: '23638936fdffa224de9631bfd599c0872202a30d' }))))));
|
|
684
|
-
}
|
|
685
|
-
get host() { return getElement(this); }
|
|
686
|
-
};
|
|
687
|
-
PostMegadropdown.style = PostMegadropdownStyle0;
|
|
688
|
-
|
|
689
|
-
const postMegadropdownTriggerCss = "post-megadropdown-trigger{width:100%}";
|
|
690
|
-
const PostMegadropdownTriggerStyle0 = postMegadropdownTriggerCss;
|
|
691
|
-
|
|
692
|
-
const PostMegadropdownTrigger = class {
|
|
693
|
-
constructor(hostRef) {
|
|
694
|
-
registerInstance(this, hostRef);
|
|
695
|
-
/**
|
|
696
|
-
* Reference to the slotted button within the trigger, if present.
|
|
697
|
-
* Used to manage click and key events for mega dropdown control.
|
|
698
|
-
*/
|
|
699
|
-
this.slottedButton = null;
|
|
700
|
-
this.for = undefined;
|
|
701
|
-
this.ariaExpanded = false;
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
705
|
-
* @param forValue - The new value of the `for` property.
|
|
706
|
-
*/
|
|
707
|
-
validateControlFor(forValue = this.for) {
|
|
708
|
-
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
709
|
-
}
|
|
710
|
-
get megadropdown() {
|
|
711
|
-
const ref = document.getElementById(this.for);
|
|
712
|
-
return ref && ref.localName === 'post-megadropdown'
|
|
713
|
-
? ref
|
|
714
|
-
: null;
|
|
715
|
-
}
|
|
716
|
-
handleToggle() {
|
|
717
|
-
if (this.megadropdown) {
|
|
718
|
-
this.megadropdown.toggle(this.host);
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
componentDidLoad() {
|
|
725
|
-
this.validateControlFor();
|
|
726
|
-
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
727
|
-
document.addEventListener('postToggleMegadropdown', (event) => {
|
|
728
|
-
if (event.target.id === this.for) {
|
|
729
|
-
this.ariaExpanded = event.detail;
|
|
730
|
-
if (this.slottedButton) {
|
|
731
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
this.slottedButton = this.host.querySelector('button');
|
|
736
|
-
if (this.slottedButton) {
|
|
737
|
-
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
738
|
-
this.slottedButton.addEventListener('click', () => {
|
|
739
|
-
this.handleToggle();
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
console.warn('No button found within post-megadropdown-trigger');
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
render() {
|
|
747
|
-
return (h(Host, { key: '4ab919adeaa51fc12d45131fa540c76fb3ba73d9', "data-version": version, "tab-index": "-1" }, h("button", { key: 'e7dac321691cdb19a4874fd0b2097227d077af35' }, h("slot", { key: 'beffc38d2d35a67e74364c3b40b6d39896aa4de3' }))));
|
|
748
|
-
}
|
|
749
|
-
get host() { return getElement(this); }
|
|
750
|
-
static get watchers() { return {
|
|
751
|
-
"for": ["validateControlFor"]
|
|
752
|
-
}; }
|
|
753
|
-
};
|
|
754
|
-
PostMegadropdownTrigger.style = PostMegadropdownTriggerStyle0;
|
|
755
|
-
|
|
756
|
-
const focusableSelector = `:where(${[
|
|
757
|
-
'button',
|
|
758
|
-
'input:not([type="hidden"])',
|
|
759
|
-
'[tabindex]',
|
|
760
|
-
'select',
|
|
761
|
-
'textarea',
|
|
762
|
-
'[contenteditable]',
|
|
763
|
-
'a[href]',
|
|
764
|
-
'iframe',
|
|
765
|
-
'audio[controls]',
|
|
766
|
-
'video[controls]',
|
|
767
|
-
'area[href]',
|
|
768
|
-
'details > summary:first-of-type',
|
|
769
|
-
].join(',')})`;
|
|
770
|
-
const focusDisablingSelector = `:where(${[
|
|
771
|
-
'[inert]',
|
|
772
|
-
'[inert] *',
|
|
773
|
-
':disabled',
|
|
774
|
-
'dialog:not([open]) *',
|
|
775
|
-
'[popover]:not(:popover-open) *',
|
|
776
|
-
'details:not([open]) > *:not(details > summary:first-of-type)',
|
|
777
|
-
'details:not([open]) > *:not(details > summary:first-of-type) *',
|
|
778
|
-
].join(',')})`;
|
|
779
|
-
const isFocusable = (element) => {
|
|
780
|
-
return (element === null || element === void 0 ? void 0 : element.matches(focusableSelector)) && !(element === null || element === void 0 ? void 0 : element.matches(focusDisablingSelector));
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
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)}";
|
|
784
|
-
const PostMenuStyle0 = postMenuCss;
|
|
785
|
-
|
|
786
|
-
const PostMenu = class {
|
|
787
|
-
constructor(hostRef) {
|
|
788
|
-
registerInstance(this, hostRef);
|
|
789
|
-
this.toggleMenu = createEvent(this, "toggleMenu", 7);
|
|
790
|
-
this.lastFocusedElement = null;
|
|
791
|
-
this.KEYCODES = {
|
|
792
|
-
SPACE: ' ',
|
|
793
|
-
ENTER: 'Enter',
|
|
794
|
-
UP: 'ArrowUp',
|
|
795
|
-
DOWN: 'ArrowDown',
|
|
796
|
-
TAB: 'Tab',
|
|
797
|
-
HOME: 'Home',
|
|
798
|
-
END: 'End',
|
|
799
|
-
ESCAPE: 'Escape',
|
|
800
|
-
};
|
|
801
|
-
this.handleKeyDown = (e) => {
|
|
802
|
-
e.stopPropagation();
|
|
803
|
-
if (e.key === this.KEYCODES.ESCAPE) {
|
|
804
|
-
this.toggle(this.host);
|
|
805
|
-
return;
|
|
806
|
-
}
|
|
807
|
-
if (Object.values(this.KEYCODES).includes(e.key)) {
|
|
808
|
-
this.controlKeyDownHandler(e);
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
this.handleClick = (e) => {
|
|
812
|
-
const target = e.target;
|
|
813
|
-
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
814
|
-
this.toggle(this.host);
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
this.placement = 'bottom';
|
|
818
|
-
this.isVisible = false;
|
|
819
|
-
}
|
|
820
|
-
connectedCallback() {
|
|
821
|
-
this.root = getRoot(this.host);
|
|
822
|
-
this.host.addEventListener('keydown', this.handleKeyDown);
|
|
823
|
-
this.host.addEventListener('click', this.handleClick);
|
|
824
|
-
}
|
|
825
|
-
disconnectedCallback() {
|
|
826
|
-
this.host.removeEventListener('keydown', this.handleKeyDown);
|
|
827
|
-
this.host.removeEventListener('click', this.handleClick);
|
|
828
|
-
}
|
|
829
|
-
componentDidLoad() {
|
|
830
|
-
this.popoverRef.addEventListener('postToggle', (event) => {
|
|
831
|
-
this.isVisible = event.detail;
|
|
832
|
-
this.toggleMenu.emit(this.isVisible);
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* Toggles the menu visibility based on its current state.
|
|
837
|
-
*/
|
|
838
|
-
async toggle(target) {
|
|
839
|
-
this.isVisible ? await this.hide() : await this.show(target);
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Displays the popover menu, focusing the first menu item.
|
|
843
|
-
*
|
|
844
|
-
* @param target - The HTML element relative to which the popover menu should be displayed.
|
|
845
|
-
*/
|
|
846
|
-
async show(target) {
|
|
847
|
-
if (this.popoverRef) {
|
|
848
|
-
await this.popoverRef.show(target);
|
|
849
|
-
this.lastFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
850
|
-
const menuItems = this.getSlottedItems();
|
|
851
|
-
if (menuItems.length > 0) {
|
|
852
|
-
menuItems[0].focus();
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
else {
|
|
856
|
-
console.error('show: popoverRef is null or undefined');
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Hides the popover menu and restores focus to the previously focused element.
|
|
861
|
-
*/
|
|
862
|
-
async hide() {
|
|
863
|
-
if (this.popoverRef) {
|
|
864
|
-
await this.popoverRef.hide();
|
|
865
|
-
if (this.lastFocusedElement) {
|
|
866
|
-
this.lastFocusedElement.focus();
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
console.error('hide: popoverRef is null or undefined');
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
controlKeyDownHandler(e) {
|
|
874
|
-
const menuItems = this.getSlottedItems();
|
|
875
|
-
if (!menuItems.length) {
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
const currentFocusedElement = this.root.activeElement; // Use root's activeElement
|
|
879
|
-
let currentIndex = menuItems.findIndex(el => el === currentFocusedElement);
|
|
880
|
-
switch (e.key) {
|
|
881
|
-
case this.KEYCODES.UP:
|
|
882
|
-
e.preventDefault();
|
|
883
|
-
currentIndex = (currentIndex - 1 + menuItems.length) % menuItems.length;
|
|
884
|
-
break;
|
|
885
|
-
case this.KEYCODES.DOWN:
|
|
886
|
-
e.preventDefault();
|
|
887
|
-
currentIndex = (currentIndex + 1) % menuItems.length;
|
|
888
|
-
break;
|
|
889
|
-
case this.KEYCODES.HOME:
|
|
890
|
-
currentIndex = 0;
|
|
891
|
-
break;
|
|
892
|
-
case this.KEYCODES.END:
|
|
893
|
-
currentIndex = menuItems.length - 1;
|
|
894
|
-
break;
|
|
895
|
-
case this.KEYCODES.SPACE:
|
|
896
|
-
case this.KEYCODES.ENTER:
|
|
897
|
-
this.toggle(this.host);
|
|
898
|
-
return;
|
|
899
|
-
case this.KEYCODES.TAB:
|
|
900
|
-
this.toggle(this.host);
|
|
901
|
-
break;
|
|
902
|
-
}
|
|
903
|
-
if (menuItems[currentIndex]) {
|
|
904
|
-
menuItems[currentIndex].focus();
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
getSlottedItems() {
|
|
908
|
-
const slot = this.host.shadowRoot.querySelector('slot');
|
|
909
|
-
const slottedElements = slot ? slot.assignedElements() : [];
|
|
910
|
-
const menuItems = slottedElements
|
|
911
|
-
.filter(el => el.tagName === 'POST-MENU-ITEM')
|
|
912
|
-
.map(el => {
|
|
913
|
-
const slot = el.shadowRoot.querySelector('slot');
|
|
914
|
-
const assignedElements = slot ? slot.assignedElements() : [];
|
|
915
|
-
return assignedElements.filter(isFocusable);
|
|
916
|
-
})
|
|
917
|
-
.flat();
|
|
918
|
-
return menuItems;
|
|
919
|
-
}
|
|
920
|
-
render() {
|
|
921
|
-
return (h(Host, { key: '48e04f36dc7a3d8ed81b9570d1a4c931ace3cadd', "data-version": version }, h("post-popovercontainer", { key: '58532143bd7a8be7ea77cbd0a929fa74ee0ee890', placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '967bf8aa936611ac6d533d9a8a1e176ee84b2a73', class: "popover-container", part: "popover-container" }, h("slot", { key: '4eb6b7fe34e8ea1df0d7cd8de31b57452442c3bb' })))));
|
|
922
|
-
}
|
|
923
|
-
get host() { return getElement(this); }
|
|
924
|
-
};
|
|
925
|
-
PostMenu.style = PostMenuStyle0;
|
|
926
|
-
|
|
927
|
-
const postMenuTriggerCss = ":host{display:inline-block}";
|
|
928
|
-
const PostMenuTriggerStyle0 = postMenuTriggerCss;
|
|
929
|
-
|
|
930
|
-
const PostMenuTrigger = class {
|
|
931
|
-
constructor(hostRef) {
|
|
932
|
-
registerInstance(this, hostRef);
|
|
933
|
-
/**
|
|
934
|
-
* Reference to the slotted button within the trigger, if present.
|
|
935
|
-
* Used to manage click and key events for menu control.
|
|
936
|
-
*/
|
|
937
|
-
this.slottedButton = null;
|
|
938
|
-
this.handleKeyDown = (e) => {
|
|
939
|
-
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
940
|
-
e.preventDefault();
|
|
941
|
-
this.handleToggle();
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
this.for = undefined;
|
|
945
|
-
this.ariaExpanded = false;
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
949
|
-
* @param forValue - The new value of the `for` property.
|
|
950
|
-
*/
|
|
951
|
-
validateControlFor(forValue = this.for) {
|
|
952
|
-
checkType(forValue, 'string', 'The "for" property is required and should be a string.');
|
|
953
|
-
}
|
|
954
|
-
get menu() {
|
|
955
|
-
const ref = this.root.getElementById(this.for);
|
|
956
|
-
return ref && ref.localName === 'post-menu' ? ref : null;
|
|
957
|
-
}
|
|
958
|
-
handleToggle() {
|
|
959
|
-
const menu = this.menu;
|
|
960
|
-
if (menu && this.slottedButton) {
|
|
961
|
-
this.ariaExpanded = !this.ariaExpanded;
|
|
962
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
963
|
-
menu.toggle(this.host);
|
|
964
|
-
}
|
|
965
|
-
else {
|
|
966
|
-
console.warn(`No post-menu found with ID: ${this.for}`);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
componentDidLoad() {
|
|
970
|
-
this.root = getRoot(this.host);
|
|
971
|
-
this.validateControlFor();
|
|
972
|
-
this.slottedButton = this.host.querySelector('button');
|
|
973
|
-
// Check if the slottedButton is within a web component
|
|
974
|
-
if (!this.slottedButton) {
|
|
975
|
-
const webComponent = this.host.querySelector('.menu-trigger-webc');
|
|
976
|
-
if (webComponent.shadowRoot) {
|
|
977
|
-
const slottedButton = webComponent.shadowRoot.querySelector('button');
|
|
978
|
-
if (slottedButton) {
|
|
979
|
-
this.slottedButton = slottedButton;
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
if (this.slottedButton) {
|
|
984
|
-
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
985
|
-
this.slottedButton.addEventListener('click', () => {
|
|
986
|
-
this.handleToggle();
|
|
987
|
-
});
|
|
988
|
-
this.slottedButton.addEventListener('keydown', this.handleKeyDown);
|
|
989
|
-
}
|
|
990
|
-
else {
|
|
991
|
-
console.warn('No button found within post-menu-trigger');
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
render() {
|
|
995
|
-
return (h(Host, { key: '64e9e7e6448160c7b52fc732b5107e94e9776678', "data-version": version, "tab-index": "-1" }, h("slot", { key: '711d641147cec0c26c7a3917f9302f1bbbee0d73' })));
|
|
996
|
-
}
|
|
997
|
-
get host() { return getElement(this); }
|
|
998
|
-
static get watchers() { return {
|
|
999
|
-
"for": ["validateControlFor"]
|
|
1000
|
-
}; }
|
|
1001
|
-
};
|
|
1002
|
-
PostMenuTrigger.style = PostMenuTriggerStyle0;
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-e1b64755.js';
|
|
2
|
+
import { v as version } from './package-983f957d.js';
|
|
1003
3
|
|
|
1004
4
|
/**
|
|
1005
5
|
* Custom positioning reference element.
|
|
@@ -2195,7 +1195,7 @@ function isOverflowElement(element) {
|
|
|
2195
1195
|
overflowX,
|
|
2196
1196
|
overflowY,
|
|
2197
1197
|
display
|
|
2198
|
-
} = getComputedStyle
|
|
1198
|
+
} = getComputedStyle(element);
|
|
2199
1199
|
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
2200
1200
|
}
|
|
2201
1201
|
function isTableElement(element) {
|
|
@@ -2212,7 +1212,7 @@ function isTopLayer(element) {
|
|
|
2212
1212
|
}
|
|
2213
1213
|
function isContainingBlock(elementOrCss) {
|
|
2214
1214
|
const webkit = isWebKit();
|
|
2215
|
-
const css = isElement(elementOrCss) ? getComputedStyle
|
|
1215
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
2216
1216
|
|
|
2217
1217
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2218
1218
|
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));
|
|
@@ -2236,7 +1236,7 @@ function isWebKit() {
|
|
|
2236
1236
|
function isLastTraversableNode(node) {
|
|
2237
1237
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
2238
1238
|
}
|
|
2239
|
-
function getComputedStyle
|
|
1239
|
+
function getComputedStyle(element) {
|
|
2240
1240
|
return getWindow(element).getComputedStyle(element);
|
|
2241
1241
|
}
|
|
2242
1242
|
function getNodeScroll(element) {
|
|
@@ -2294,7 +1294,7 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
2294
1294
|
}
|
|
2295
1295
|
|
|
2296
1296
|
function getCssDimensions(element) {
|
|
2297
|
-
const css = getComputedStyle
|
|
1297
|
+
const css = getComputedStyle(element);
|
|
2298
1298
|
// In testing environments, the `width` and `height` properties are empty
|
|
2299
1299
|
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
2300
1300
|
let width = parseFloat(css.width) || 0;
|
|
@@ -2399,7 +1399,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
2399
1399
|
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
2400
1400
|
const iframeScale = getScale(currentIFrame);
|
|
2401
1401
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
2402
|
-
const css = getComputedStyle
|
|
1402
|
+
const css = getComputedStyle(currentIFrame);
|
|
2403
1403
|
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
2404
1404
|
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
2405
1405
|
x *= iframeScale.x;
|
|
@@ -2479,7 +1479,7 @@ function getDocumentRect(element) {
|
|
|
2479
1479
|
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
2480
1480
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
2481
1481
|
const y = -scroll.scrollTop;
|
|
2482
|
-
if (getComputedStyle
|
|
1482
|
+
if (getComputedStyle(body).direction === 'rtl') {
|
|
2483
1483
|
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2484
1484
|
}
|
|
2485
1485
|
return {
|
|
@@ -2555,7 +1555,7 @@ function hasFixedPositionAncestor(element, stopNode) {
|
|
|
2555
1555
|
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2556
1556
|
return false;
|
|
2557
1557
|
}
|
|
2558
|
-
return getComputedStyle
|
|
1558
|
+
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2559
1559
|
}
|
|
2560
1560
|
|
|
2561
1561
|
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
@@ -2568,12 +1568,12 @@ function getClippingElementAncestors(element, cache) {
|
|
|
2568
1568
|
}
|
|
2569
1569
|
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
2570
1570
|
let currentContainingBlockComputedStyle = null;
|
|
2571
|
-
const elementIsFixed = getComputedStyle
|
|
1571
|
+
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
2572
1572
|
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2573
1573
|
|
|
2574
1574
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
2575
1575
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2576
|
-
const computedStyle = getComputedStyle
|
|
1576
|
+
const computedStyle = getComputedStyle(currentNode);
|
|
2577
1577
|
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2578
1578
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2579
1579
|
currentContainingBlockComputedStyle = null;
|
|
@@ -2664,11 +1664,11 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
2664
1664
|
}
|
|
2665
1665
|
|
|
2666
1666
|
function isStaticPositioned(element) {
|
|
2667
|
-
return getComputedStyle
|
|
1667
|
+
return getComputedStyle(element).position === 'static';
|
|
2668
1668
|
}
|
|
2669
1669
|
|
|
2670
1670
|
function getTrueOffsetParent(element, polyfill) {
|
|
2671
|
-
if (!isHTMLElement(element) || getComputedStyle
|
|
1671
|
+
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
2672
1672
|
return null;
|
|
2673
1673
|
}
|
|
2674
1674
|
if (polyfill) {
|
|
@@ -2720,7 +1720,7 @@ const getElementRects = async function (data) {
|
|
|
2720
1720
|
};
|
|
2721
1721
|
|
|
2722
1722
|
function isRTL(element) {
|
|
2723
|
-
return getComputedStyle
|
|
1723
|
+
return getComputedStyle(element).direction === 'rtl';
|
|
2724
1724
|
}
|
|
2725
1725
|
|
|
2726
1726
|
const platform = {
|
|
@@ -3039,34 +2039,40 @@ const computePosition = (reference, floating, options) => {
|
|
|
3039
2039
|
}
|
|
3040
2040
|
`,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();})();
|
|
3041
2041
|
|
|
3042
|
-
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);
|
|
2042
|
+
const postPopovercontainerCss = "@keyframes popIn{from{transform:scale(0.9);opacity:0;transition-property:transform,opacity,overlay,display;transition-behavior:allow-discrete;transition-duration:var(--post-transition-duration, 0.35s);transition-timing-function:linear(0, 0.007, 0.029 2.2%, 0.118 4.7%, 0.625 14.4%, 0.826 19%, 0.902, 0.962, 1.008 26.1%, 1.041 28.7%, 1.064 32.1%, 1.07 36%, 1.061 40.5%, 1.015 53.4%, 0.999 61.6%, 0.995 71.2%, 1)}to{opacity:1;transform:scale(1)}}/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *//*!\n * Copyright 2021 by Swiss Post, Information Technology\n */@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);width:max-content;display:flex;align-items:center;max-width:100%;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px}:where(post-popovercontainer)>div.animate-pop-in{animation:popIn .25s ease-out forwards}: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)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}: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-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}";
|
|
3043
2043
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
3044
2044
|
|
|
3045
|
-
const SIDE_MAP = {
|
|
3046
|
-
top: 'bottom',
|
|
3047
|
-
right: 'left',
|
|
3048
|
-
bottom: 'top',
|
|
3049
|
-
left: 'right',
|
|
3050
|
-
};
|
|
3051
2045
|
const PostPopovercontainer = class {
|
|
3052
2046
|
constructor(hostRef) {
|
|
3053
2047
|
registerInstance(this, hostRef);
|
|
3054
2048
|
this.postToggle = createEvent(this, "postToggle", 7);
|
|
3055
2049
|
this.placement = 'top';
|
|
3056
2050
|
this.edgeGap = 8;
|
|
2051
|
+
this.animation = null;
|
|
3057
2052
|
this.arrow = false;
|
|
2053
|
+
this.safeSpace = undefined;
|
|
2054
|
+
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Updates cursor position for safe space feature when popover is open.
|
|
2057
|
+
* Sets CSS custom properties for dynamic styling of safe area.
|
|
2058
|
+
* @param event MouseEvent with cursor position
|
|
2059
|
+
*/
|
|
2060
|
+
mouseTrackingHandler(event) {
|
|
2061
|
+
this.host.style.setProperty('--post-safe-space-cursor-x', `${event.clientX}px`);
|
|
2062
|
+
this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
|
|
3058
2063
|
}
|
|
3059
2064
|
componentDidLoad() {
|
|
3060
2065
|
this.host.setAttribute('popover', '');
|
|
3061
2066
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
3062
2067
|
}
|
|
3063
2068
|
disconnectedCallback() {
|
|
3064
|
-
if (typeof this.clearAutoUpdate === 'function')
|
|
2069
|
+
if (typeof this.clearAutoUpdate === 'function') {
|
|
3065
2070
|
this.clearAutoUpdate();
|
|
2071
|
+
}
|
|
3066
2072
|
}
|
|
3067
2073
|
/**
|
|
3068
|
-
* Programmatically display the
|
|
3069
|
-
* @param target An element with [data-
|
|
2074
|
+
* Programmatically display the popovercontainer
|
|
2075
|
+
* @param target An element with [data-popover-target="id"] where the popovercontainer should be shown
|
|
3070
2076
|
*/
|
|
3071
2077
|
async show(target) {
|
|
3072
2078
|
if (!this.toggleTimeoutId) {
|
|
@@ -3076,7 +2082,7 @@ const PostPopovercontainer = class {
|
|
|
3076
2082
|
}
|
|
3077
2083
|
}
|
|
3078
2084
|
/**
|
|
3079
|
-
* Programmatically hide
|
|
2085
|
+
* Programmatically hide the popovercontainer
|
|
3080
2086
|
*/
|
|
3081
2087
|
async hide() {
|
|
3082
2088
|
if (!this.toggleTimeoutId) {
|
|
@@ -3085,8 +2091,8 @@ const PostPopovercontainer = class {
|
|
|
3085
2091
|
}
|
|
3086
2092
|
}
|
|
3087
2093
|
/**
|
|
3088
|
-
* Toggle
|
|
3089
|
-
* @param target An element with [data-
|
|
2094
|
+
* Toggle popovercontainer display
|
|
2095
|
+
* @param target An element with [data-popover-target="id"] where the popovercontainer should be shown
|
|
3090
2096
|
* @param force Pass true to always show or false to always hide
|
|
3091
2097
|
*/
|
|
3092
2098
|
async toggle(target, force) {
|
|
@@ -3097,11 +2103,11 @@ const PostPopovercontainer = class {
|
|
|
3097
2103
|
this.host.togglePopover(force);
|
|
3098
2104
|
this.toggleTimeoutId = null;
|
|
3099
2105
|
}
|
|
3100
|
-
return this.host.matches(':where(:popover-open, .popover-open');
|
|
2106
|
+
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
3101
2107
|
}
|
|
3102
2108
|
/**
|
|
3103
|
-
* Start or stop auto updates based on
|
|
3104
|
-
*
|
|
2109
|
+
* Start or stop auto updates based on popovercontainer events.
|
|
2110
|
+
* Popovercontainers can be closed or opened with other methods than class members,
|
|
3105
2111
|
* therefore listening to the toggle event is safer for cleaning up.
|
|
3106
2112
|
* @param e ToggleEvent
|
|
3107
2113
|
*/
|
|
@@ -3110,29 +2116,54 @@ const PostPopovercontainer = class {
|
|
|
3110
2116
|
const isOpen = e.newState === 'open';
|
|
3111
2117
|
if (isOpen) {
|
|
3112
2118
|
this.startAutoupdates();
|
|
2119
|
+
if (this.safeSpace)
|
|
2120
|
+
window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
3113
2121
|
}
|
|
3114
2122
|
else {
|
|
3115
2123
|
if (typeof this.clearAutoUpdate === 'function')
|
|
3116
2124
|
this.clearAutoUpdate();
|
|
2125
|
+
if (this.safeSpace)
|
|
2126
|
+
window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
3117
2127
|
}
|
|
3118
2128
|
this.postToggle.emit(isOpen);
|
|
3119
2129
|
}
|
|
3120
2130
|
/**
|
|
3121
2131
|
* Start listening for DOM updates, scroll events etc. that have
|
|
3122
|
-
* an influence on
|
|
2132
|
+
* an influence on popovercontainer positioning
|
|
3123
2133
|
*/
|
|
3124
2134
|
startAutoupdates() {
|
|
3125
2135
|
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
3126
2136
|
}
|
|
3127
2137
|
async calculatePosition() {
|
|
2138
|
+
const { x, y, middlewareData, placement } = await this.computeMainPosition();
|
|
2139
|
+
const currentPlacement = placement.split('-')[0];
|
|
2140
|
+
// Position popover
|
|
2141
|
+
this.host.style.left = `${x}px`;
|
|
2142
|
+
this.host.style.top = `${y}px`;
|
|
2143
|
+
// Position arrow if enabled
|
|
2144
|
+
if (this.arrow && middlewareData.arrow) {
|
|
2145
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
2146
|
+
const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
|
|
2147
|
+
if (staticSide) {
|
|
2148
|
+
Object.assign(this.arrowRef.style, {
|
|
2149
|
+
left: arrowX ? `${arrowX}px` : '',
|
|
2150
|
+
top: arrowY ? `${arrowY}px` : '',
|
|
2151
|
+
[staticSide]: '-7px',
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
// Handle safe space if enabled
|
|
2156
|
+
if (this.safeSpace && this.eventTarget) {
|
|
2157
|
+
await this.updateSafeSpaceBoundaries(currentPlacement);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
async computeMainPosition() {
|
|
3128
2161
|
const gap = this.edgeGap;
|
|
3129
2162
|
const middleware = [
|
|
3130
2163
|
flip(),
|
|
3131
2164
|
inline(),
|
|
3132
2165
|
shift({
|
|
3133
2166
|
padding: gap,
|
|
3134
|
-
// Prevents shifting away from the anchor too far, while shifting as far as possible
|
|
3135
|
-
// https://floating-ui.com/docs/shift#limiter
|
|
3136
2167
|
limiter: limitShift({
|
|
3137
2168
|
offset: 32,
|
|
3138
2169
|
}),
|
|
@@ -3144,80 +2175,105 @@ const PostPopovercontainer = class {
|
|
|
3144
2175
|
});
|
|
3145
2176
|
},
|
|
3146
2177
|
}),
|
|
3147
|
-
offset(this.arrow ? gap + 4 : gap),
|
|
2178
|
+
offset(this.arrow ? gap + 4 : gap),
|
|
3148
2179
|
];
|
|
3149
2180
|
if (this.arrow) {
|
|
3150
2181
|
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
3151
2182
|
}
|
|
3152
|
-
|
|
2183
|
+
return computePosition(this.eventTarget, this.host, {
|
|
3153
2184
|
placement: this.placement || 'top',
|
|
3154
2185
|
strategy: 'fixed',
|
|
3155
2186
|
middleware,
|
|
3156
2187
|
});
|
|
3157
|
-
// Tooltip
|
|
3158
|
-
this.host.style.left = `${x}px`;
|
|
3159
|
-
this.host.style.top = `${y}px`;
|
|
3160
|
-
// Arrow
|
|
3161
|
-
if (this.arrow) {
|
|
3162
|
-
// Tutorial: https://codesandbox.io/s/mystifying-kare-ee3hmh?file=/src/index.js
|
|
3163
|
-
const side = currentPlacement.split('-')[0];
|
|
3164
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
3165
|
-
const staticSide = SIDE_MAP[side];
|
|
3166
|
-
const offsetBorderLineJoin = 2;
|
|
3167
|
-
Object.assign(this.arrowRef.style, {
|
|
3168
|
-
top: arrowY ? `${arrowY}px` : '',
|
|
3169
|
-
left: arrowX ? `${arrowX}px` : '',
|
|
3170
|
-
[staticSide]: `${-this.arrowRef.offsetWidth / 2 - offsetBorderLineJoin}px`,
|
|
3171
|
-
});
|
|
3172
|
-
// Add position as a class to be able to style arrow for HCM
|
|
3173
|
-
this.arrowRef.classList.remove(...Object.values(SIDE_MAP));
|
|
3174
|
-
this.arrowRef.classList.add(staticSide);
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
render() {
|
|
3178
|
-
return (h(Host, { key: '23e391236e263f7ae7c66c994b2847bcba269b37', "data-version": version }, this.arrow && (h("span", { key: '6c6053b2fd315a5940a2c3493182249782b2492c', class: "arrow", ref: el => {
|
|
3179
|
-
this.arrowRef = el;
|
|
3180
|
-
} })), h("slot", { key: 'ff998f110f42a22e886eba398285c41d94718bab' })));
|
|
3181
2188
|
}
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
const
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
2189
|
+
async updateSafeSpaceBoundaries(currentPlacement) {
|
|
2190
|
+
const targetRect = this.eventTarget.getBoundingClientRect();
|
|
2191
|
+
const popoverRect = this.host.getBoundingClientRect();
|
|
2192
|
+
const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
|
|
2193
|
+
// Helper function to get positioning data based on placement
|
|
2194
|
+
const getPositioningData = (placement, popoverRect, targetRect) => {
|
|
2195
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
2196
|
+
return {
|
|
2197
|
+
popover: {
|
|
2198
|
+
y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
|
|
2199
|
+
xStart: popoverRect.left,
|
|
2200
|
+
xEnd: popoverRect.right,
|
|
2201
|
+
},
|
|
2202
|
+
trigger: {
|
|
2203
|
+
y: placement === 'top' ? targetRect.top : targetRect.bottom,
|
|
2204
|
+
xStart: targetRect.left,
|
|
2205
|
+
xEnd: targetRect.right,
|
|
2206
|
+
},
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
else {
|
|
2210
|
+
// left or right
|
|
2211
|
+
return {
|
|
2212
|
+
popover: {
|
|
2213
|
+
x: placement === 'left' ? popoverRect.right : popoverRect.left,
|
|
2214
|
+
yStart: popoverRect.top,
|
|
2215
|
+
yEnd: popoverRect.bottom,
|
|
2216
|
+
},
|
|
2217
|
+
trigger: {
|
|
2218
|
+
x: placement === 'left' ? targetRect.left : targetRect.right,
|
|
2219
|
+
yStart: targetRect.top,
|
|
2220
|
+
yEnd: targetRect.bottom,
|
|
2221
|
+
},
|
|
2222
|
+
};
|
|
3200
2223
|
}
|
|
3201
2224
|
};
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
2225
|
+
const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
|
|
2226
|
+
// Clear previous values
|
|
2227
|
+
PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
|
|
2228
|
+
this.host.style.removeProperty(prop);
|
|
2229
|
+
});
|
|
2230
|
+
if (isVertical) {
|
|
2231
|
+
// For top/bottom placement
|
|
2232
|
+
this.host.style.setProperty('--post-safe-space-popover-y', `${posData.popover.y}px`);
|
|
2233
|
+
this.host.style.setProperty('--post-safe-space-popover-x-start', `${posData.popover.xStart}px`);
|
|
2234
|
+
this.host.style.setProperty('--post-safe-space-popover-x-end', `${posData.popover.xEnd}px`);
|
|
2235
|
+
this.host.style.setProperty('--post-safe-space-trigger-y', `${posData.trigger.y}px`);
|
|
2236
|
+
this.host.style.setProperty('--post-safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
|
|
2237
|
+
this.host.style.setProperty('--post-safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
|
|
2238
|
+
}
|
|
2239
|
+
else {
|
|
2240
|
+
// For left/right placement
|
|
2241
|
+
this.host.style.setProperty('--post-safe-space-popover-x', `${posData.popover.x}px`);
|
|
2242
|
+
this.host.style.setProperty('--post-safe-space-popover-y-start', `${posData.popover.yStart}px`);
|
|
2243
|
+
this.host.style.setProperty('--post-safe-space-popover-y-end', `${posData.popover.yEnd}px`);
|
|
2244
|
+
this.host.style.setProperty('--post-safe-space-trigger-x', `${posData.trigger.x}px`);
|
|
2245
|
+
this.host.style.setProperty('--post-safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
|
|
2246
|
+
this.host.style.setProperty('--post-safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
|
|
2247
|
+
}
|
|
3212
2248
|
}
|
|
3213
2249
|
render() {
|
|
3214
|
-
|
|
2250
|
+
const animationClass = this.animation ? `animate-${this.animation}` : '';
|
|
2251
|
+
return (h(Host, { key: '98ea26b46803e8aa98cc2cec53798d994c0ff856', "data-version": version }, h("div", { key: '230fa7df2963b36e67a4559f07010f7213240e3c', class: animationClass }, this.arrow && (h("span", { key: '58647eb14ef84ff04b04b7dec0bbb38b9bcd4b69', class: "arrow", ref: el => {
|
|
2252
|
+
this.arrowRef = el;
|
|
2253
|
+
} })), h("slot", { key: 'de0afc53f013ac7d4cdd06e0e2d7746a8e0971dc' }))));
|
|
3215
2254
|
}
|
|
3216
2255
|
get host() { return getElement(this); }
|
|
3217
|
-
static get watchers() { return {
|
|
3218
|
-
"toggled": ["validateToggled"]
|
|
3219
|
-
}; }
|
|
3220
2256
|
};
|
|
3221
|
-
|
|
2257
|
+
PostPopovercontainer.STATIC_SIDES = {
|
|
2258
|
+
top: 'bottom',
|
|
2259
|
+
right: 'left',
|
|
2260
|
+
bottom: 'top',
|
|
2261
|
+
left: 'right',
|
|
2262
|
+
};
|
|
2263
|
+
PostPopovercontainer.PROPERTIES_TO_CLEAR = [
|
|
2264
|
+
'--post-safe-space-popover-x',
|
|
2265
|
+
'--post-safe-space-popover-y',
|
|
2266
|
+
'--post-safe-space-popover-x-start',
|
|
2267
|
+
'--post-safe-space-popover-x-end',
|
|
2268
|
+
'--post-safe-space-popover-y-start',
|
|
2269
|
+
'--post-safe-space-popover-y-end',
|
|
2270
|
+
'--post-safe-space-trigger-x',
|
|
2271
|
+
'--post-safe-space-trigger-y',
|
|
2272
|
+
'--post-safe-space-trigger-x-start',
|
|
2273
|
+
'--post-safe-space-trigger-x-end',
|
|
2274
|
+
'--post-safe-space-trigger-y-start',
|
|
2275
|
+
'--post-safe-space-trigger-y-end',
|
|
2276
|
+
];
|
|
2277
|
+
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
3222
2278
|
|
|
3223
|
-
export {
|
|
2279
|
+
export { PostPopovercontainer as P };
|