@swisspost/design-system-components 10.0.0-next.55 → 10.0.0-next.57
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/{components/react/p-CJ80BZ06.js → cjs/breakpoints-Df03Ct7n.js} +103 -5
- package/dist/cjs/debounce-BsIBi_-2.js +13 -0
- package/dist/cjs/environment-BQE9Unf_.js +52 -0
- package/dist/cjs/{event-from-CLvtSUKf.js → event-from-CwMw19f8.js} +2 -2
- package/dist/cjs/fade-CPQhl1fP.js +26 -0
- package/dist/cjs/fade-slide-dPhQa-I1.js +38 -0
- package/dist/cjs/{get-focusable-children-Bx63XUQg.js → get-focusable-children-ChETM1wK.js} +29 -21
- package/dist/cjs/{get-root-CyMf3Vsd.js → get-root-CUAv4k4C.js} +2 -2
- package/dist/cjs/{index-B4gYpuJF.js → index-B4rc1pqu.js} +2150 -292
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-DkJrv93P.js → package-uQ5oiSiN.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +19 -15
- package/dist/cjs/post-avatar.cjs.entry.js +27 -17
- package/dist/cjs/post-back-to-top.cjs.entry.js +23 -43
- package/dist/cjs/post-banner.cjs.entry.js +15 -12
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +14 -12
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +33 -34
- package/dist/cjs/post-card-control.cjs.entry.js +42 -26
- package/dist/cjs/{post-closebutton_15.cjs.entry.js → post-closebutton_13.cjs.entry.js} +618 -531
- package/dist/cjs/post-collapsible_2.cjs.entry.js +41 -37
- package/dist/cjs/post-components.cjs.js +3 -3
- package/dist/cjs/post-env-test.cjs.entry.js +15 -0
- package/dist/cjs/post-footer.cjs.entry.js +24 -20
- package/dist/cjs/post-linkarea.cjs.entry.js +5 -5
- package/dist/cjs/post-pagination.cjs.entry.js +615 -0
- package/dist/cjs/post-popover-trigger.cjs.entry.js +54 -34
- package/dist/cjs/post-popover.cjs.entry.js +26 -17
- package/dist/cjs/post-rating.cjs.entry.js +24 -18
- package/dist/cjs/post-stepper-item.cjs.entry.js +5 -5
- package/dist/cjs/post-stepper.cjs.entry.js +40 -29
- package/dist/cjs/post-tab-item.cjs.entry.js +51 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +13 -11
- package/dist/cjs/post-tabs.cjs.entry.js +195 -40
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +13 -11
- package/dist/cjs/post-tooltip.cjs.entry.js +14 -12
- package/dist/cjs/utils-s05L2ulk.js +26 -0
- package/dist/collection/animations/collapse.js +3 -3
- package/dist/collection/animations/fade-slide.js +33 -0
- package/dist/collection/animations/fade.js +19 -7
- package/dist/collection/animations/index.js +2 -0
- package/dist/collection/animations/slide.js +25 -21
- package/dist/collection/animations/types.js +14 -0
- package/dist/collection/animations/utils.js +8 -0
- package/dist/collection/collection-manifest.json +8 -8
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +5 -4
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +9 -8
- package/dist/collection/components/post-avatar/post-avatar.js +11 -11
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +15 -15
- package/dist/collection/components/post-banner/post-banner.css +4 -1
- package/dist/collection/components/post-banner/post-banner.js +6 -5
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +3 -3
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +29 -29
- package/dist/collection/components/post-card-control/post-card-control.js +18 -18
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
- package/dist/collection/components/post-closebutton/post-closebutton.js +4 -3
- package/dist/collection/components/post-collapsible/post-collapsible.js +28 -28
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +3 -3
- package/dist/collection/components/post-footer/post-footer.css +1 -1
- package/dist/collection/components/post-footer/post-footer.js +18 -16
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +144 -82
- package/dist/collection/components/post-icon/post-icon.js +18 -16
- package/dist/collection/components/post-language-menu/post-language-menu.css +1 -0
- package/dist/collection/components/{post-language-switch/post-language-switch.js → post-language-menu/post-language-menu.js} +45 -36
- package/dist/collection/components/post-language-menu-item/post-language-menu-item.css +1 -0
- package/dist/collection/components/{post-language-option/post-language-option.js → post-language-menu-item/post-language-menu-item.js} +24 -23
- package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
- package/dist/collection/components/post-logo/post-logo.css +3 -1
- package/dist/collection/components/post-logo/post-logo.js +3 -3
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +41 -29
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +183 -74
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +3 -1
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +81 -75
- package/dist/collection/components/post-menu/post-menu.css +1 -1
- package/dist/collection/components/post-menu/post-menu.js +39 -38
- package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +3 -3
- package/dist/collection/components/post-pagination/post-pagination.css +1 -0
- package/dist/collection/components/post-pagination/post-pagination.js +838 -0
- package/dist/collection/components/post-popover/post-popover.js +22 -16
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +45 -29
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +82 -131
- package/dist/collection/components/post-rating/post-rating.js +7 -7
- package/dist/collection/components/post-stepper/post-stepper.js +38 -35
- package/dist/collection/components/post-stepper-item/post-stepper-item.css +2 -2
- package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
- package/dist/collection/components/post-tab-item/post-tab-item.css +1 -0
- package/dist/collection/components/post-tab-item/post-tab-item.js +86 -0
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +10 -10
- package/dist/collection/components/post-tabs/post-tabs.js +232 -59
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +2 -2
- package/dist/collection/components/post-tooltip/post-tooltip.js +9 -27
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +4 -4
- package/dist/collection/utils/environment.js +47 -2
- package/dist/collection/utils/event-from.js +2 -2
- package/dist/collection/utils/get-focusable-children.js +29 -21
- package/dist/collection/utils/is-motion-reduced.js +1 -1
- package/dist/collection/utils/tests/environment/hydrate-app-helper.js +16 -0
- package/dist/collection/utils/tests/environment/post-env-test.js +9 -0
- package/dist/component-names.json +4 -5
- package/dist/components/breakpoints.js +1 -178
- package/dist/components/debounce.js +1 -0
- package/dist/components/environment.js +1 -0
- package/dist/components/event-from.js +1 -119
- package/dist/components/fade-slide.js +1 -0
- package/dist/components/fade.js +1 -11
- package/dist/components/focusable.js +1 -5018
- package/dist/components/get-focusable-children.js +1 -64
- package/dist/components/get-root.js +1 -15
- package/dist/components/heading-levels.js +1 -3
- package/dist/components/index.browser.js +1 -14
- package/dist/components/index.d.ts +11 -10
- package/dist/components/index.js +1 -39
- package/dist/components/long-press-event.js +1 -257
- package/dist/components/package.js +1 -3
- package/dist/components/post-accordion-item.js +1 -6
- package/dist/components/post-accordion-item2.js +1 -113
- package/dist/components/post-accordion.js +1 -6
- package/dist/components/post-accordion2.js +1 -138
- package/dist/components/post-avatar.js +1 -217
- package/dist/components/post-back-to-top.js +1 -144
- package/dist/components/post-banner.js +1 -98
- package/dist/components/post-breadcrumb-item.js +1 -6
- package/dist/components/post-breadcrumb-item2.js +1 -79
- package/dist/components/post-breadcrumbs.js +1 -196
- package/dist/components/post-card-control.js +1 -326
- package/dist/components/post-closebutton.js +1 -6
- package/dist/components/post-closebutton2.js +1 -77
- package/dist/components/post-collapsible-trigger.js +1 -6
- package/dist/components/post-collapsible-trigger2.js +1 -136
- package/dist/components/post-collapsible.js +1 -6
- package/dist/components/post-collapsible2.js +1 -110
- package/dist/components/{post-list.d.ts → post-env-test.d.ts} +4 -4
- package/dist/components/post-env-test.js +1 -0
- package/dist/components/post-footer.js +1 -116
- package/dist/components/post-header.js +1 -372
- package/dist/components/post-icon.js +1 -6
- package/dist/components/post-icon2.js +1 -159
- package/dist/components/post-language-menu-item.d.ts +11 -0
- package/dist/components/post-language-menu-item.js +1 -0
- package/dist/components/{post-language-switch.d.ts → post-language-menu.d.ts} +4 -4
- package/dist/components/post-language-menu.js +1 -0
- package/dist/components/post-linkarea.js +1 -58
- package/dist/components/post-logo.js +1 -58
- package/dist/components/post-mainnavigation.js +1 -180
- package/dist/components/post-megadropdown-trigger.js +1 -136
- package/dist/components/post-megadropdown.js +1 -267
- package/dist/components/post-menu-item.js +1 -6
- package/dist/components/post-menu-item2.js +1 -30
- package/dist/components/post-menu-trigger.js +1 -6
- package/dist/components/post-menu-trigger2.js +1 -110
- package/dist/components/post-menu.js +1 -6
- package/dist/components/post-menu2.js +1 -242
- package/dist/components/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
- package/dist/components/post-pagination.js +1 -0
- package/dist/components/post-popover-trigger.js +1 -132
- package/dist/components/post-popover.js +1 -118
- package/dist/components/post-popovercontainer.js +1 -6
- package/dist/components/post-popovercontainer2.js +1 -3127
- package/dist/components/post-rating.js +1 -148
- package/dist/components/post-stepper-item.js +1 -33
- package/dist/components/post-stepper.js +1 -134
- package/dist/components/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
- package/dist/components/post-tab-item.js +1 -0
- package/dist/components/post-tab-panel.js +1 -54
- package/dist/components/post-tabs.js +1 -196
- package/dist/components/post-togglebutton.js +1 -56
- package/dist/components/post-togglebutton2.js +1 -0
- package/dist/components/post-tooltip-trigger.js +1 -206
- package/dist/components/post-tooltip.js +1 -114
- package/dist/components/react/index.d.ts +2 -0
- package/dist/components/react/index.js +1 -2315
- package/dist/components/react/p-B8YiQ3mz.js +1 -0
- package/dist/components/react/p-BC5nlBvn.js +1 -0
- package/dist/components/react/p-BLchVpF6.js +1 -14
- package/dist/components/react/p-BVCjnh6Q.js +1 -0
- package/dist/{post-components/p-CBFgkSgY.js → components/react/p-BVGcVycs.js} +1 -1
- package/dist/components/react/p-B_XPj2c8.js +1 -0
- package/dist/components/react/p-BllOMLDs.js +1 -0
- package/dist/components/react/p-BmRNjQUZ.js +1 -0
- package/dist/components/react/p-ByFh05IW.js +1 -0
- package/dist/components/react/p-C9hMpmsD.js +1 -0
- package/dist/components/react/p-CJ13r5fi.js +1 -0
- package/dist/components/react/p-CZvbetqX.js +1 -0
- package/dist/components/react/p-C_2k3G1c.js +1 -257
- package/dist/components/react/p-CoDiS_Ik.js +1 -0
- package/dist/components/react/p-Cou17ld8.js +1 -0
- package/dist/components/react/p-D5knoiyy.js +1 -0
- package/dist/components/react/p-D9DDtvFM.js +1 -0
- package/dist/components/react/p-DY2U5CQt.js +1 -0
- package/dist/components/react/p-DjIHLduJ.js +1 -3
- package/dist/components/react/p-DpATRD2W.js +1 -0
- package/dist/components/react/p-FxUVQ4Tx.js +1 -0
- package/dist/components/react/p-HygIVKXC.js +1 -5018
- package/dist/components/react/p-YR7U0Z_g.js +1 -0
- package/dist/components/react/p-ZeKXASQs.js +1 -0
- package/dist/components/react/p-r4txK0AC.js +1 -3
- package/dist/components/react/p-sSn0kXFi.js +1 -0
- package/dist/components/react/post-accordion-item.js +1 -6
- package/dist/components/react/post-accordion.js +1 -6
- package/dist/components/react/post-avatar.js +1 -218
- package/dist/components/react/post-back-to-top.js +1 -145
- package/dist/components/react/post-banner.js +1 -99
- package/dist/components/react/post-breadcrumb-item.js +1 -6
- package/dist/components/react/post-breadcrumbs.js +1 -197
- package/dist/components/react/post-card-control.js +1 -327
- package/dist/components/react/post-closebutton.js +1 -6
- package/dist/components/react/post-collapsible-trigger.js +1 -6
- package/dist/components/react/post-collapsible.js +1 -6
- package/dist/components/react/{post-list.d.ts → post-env-test.d.ts} +4 -4
- package/dist/components/react/post-env-test.js +1 -0
- package/dist/components/react/post-footer.js +1 -117
- package/dist/components/react/post-header.js +1 -373
- package/dist/components/react/post-icon.js +1 -6
- package/dist/components/react/post-language-menu-item.d.ts +11 -0
- package/dist/components/react/post-language-menu-item.js +1 -0
- package/dist/components/react/{post-language-option.d.ts → post-language-menu.d.ts} +4 -4
- package/dist/components/react/post-language-menu.js +1 -0
- package/dist/components/react/post-linkarea.js +1 -59
- package/dist/components/react/post-logo.js +1 -59
- package/dist/components/react/post-mainnavigation.js +1 -181
- package/dist/components/react/post-megadropdown-trigger.js +1 -137
- package/dist/components/react/post-megadropdown.js +1 -268
- package/dist/components/react/post-menu-item.js +1 -6
- package/dist/components/react/post-menu-trigger.js +1 -6
- package/dist/components/react/post-menu.js +1 -6
- package/dist/components/react/{post-tab-header.d.ts → post-pagination.d.ts} +4 -4
- package/dist/components/react/post-pagination.js +1 -0
- package/dist/components/react/post-popover-trigger.js +1 -133
- package/dist/components/react/post-popover.js +1 -119
- package/dist/components/react/post-popovercontainer.js +1 -6
- package/dist/components/react/post-rating.js +1 -149
- package/dist/components/react/post-stepper-item.js +1 -34
- package/dist/components/react/post-stepper.js +1 -135
- package/dist/components/react/{post-list-item.d.ts → post-tab-item.d.ts} +4 -4
- package/dist/components/react/post-tab-item.js +1 -0
- package/dist/components/react/post-tab-panel.js +1 -55
- package/dist/components/react/post-tabs.js +1 -197
- package/dist/components/react/post-togglebutton.js +1 -57
- package/dist/components/react/post-tooltip-trigger.js +1 -207
- package/dist/components/react/post-tooltip.js +1 -115
- package/dist/components/switch-variants.js +1 -3
- package/dist/components/utils.js +1 -0
- package/dist/docs.d.ts +11 -0
- package/dist/docs.json +873 -631
- package/dist/{cjs/breakpoints-CEkeixld.js → esm/breakpoints-DYoSKGHO.js} +89 -6
- package/dist/esm/debounce-C9hMpmsD.js +11 -0
- package/dist/esm/environment-CEmnRoA6.js +49 -0
- package/dist/{components/react/p-CzIKqBrS.js → esm/event-from-rEfV4v4a.js} +2 -2
- package/dist/esm/fade-DsgPYmAa.js +24 -0
- package/dist/esm/fade-slide-CvOvauo9.js +36 -0
- package/dist/esm/{get-focusable-children-D9ZHp2FP.js → get-focusable-children-BXNs2_sw.js} +29 -21
- package/dist/{components/react/p-CBFgkSgY.js → esm/get-root-CXfAA093.js} +1 -1
- package/dist/esm/{index-wEFJ-c34.js → index-CDZBzSdV.js} +2150 -292
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-CZvbetqX.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +17 -13
- package/dist/esm/post-avatar.entry.js +22 -12
- package/dist/esm/post-back-to-top.entry.js +23 -43
- package/dist/esm/post-banner.entry.js +14 -11
- package/dist/esm/post-breadcrumb-item_2.entry.js +13 -11
- package/dist/esm/post-breadcrumbs.entry.js +31 -32
- package/dist/esm/post-card-control.entry.js +32 -16
- package/dist/esm/{post-closebutton_15.entry.js → post-closebutton_13.entry.js} +599 -510
- package/dist/esm/post-collapsible_2.entry.js +38 -34
- package/dist/esm/post-components.js +4 -4
- package/dist/esm/post-env-test.entry.js +13 -0
- package/dist/esm/post-footer.entry.js +21 -17
- package/dist/esm/post-linkarea.entry.js +5 -5
- package/dist/esm/post-pagination.entry.js +613 -0
- package/dist/esm/post-popover-trigger.entry.js +52 -32
- package/dist/esm/post-popover.entry.js +25 -16
- package/dist/esm/post-rating.entry.js +16 -10
- package/dist/esm/post-stepper-item.entry.js +5 -5
- package/dist/esm/post-stepper.entry.js +39 -28
- package/dist/esm/post-tab-item.entry.js +49 -0
- package/dist/esm/post-tab-panel.entry.js +13 -11
- package/dist/esm/post-tabs.entry.js +195 -40
- package/dist/esm/post-tooltip-trigger.entry.js +10 -8
- package/dist/esm/post-tooltip.entry.js +13 -11
- package/dist/esm/utils-CoDiS_Ik.js +24 -0
- package/dist/post-components/p-09ba7cf9.entry.js +1 -0
- package/dist/post-components/p-0c091898.entry.js +1 -0
- package/dist/post-components/{p-cd03e6f2.entry.js → p-0e97fcfd.entry.js} +1 -1
- package/dist/post-components/p-296f1dd5.entry.js +1 -0
- package/dist/post-components/p-32ad2b21.entry.js +1 -0
- package/dist/post-components/p-366c28cb.entry.js +1 -0
- package/dist/post-components/p-41ae68d5.entry.js +1 -0
- package/dist/post-components/p-448e7265.entry.js +1 -0
- package/dist/post-components/p-554da188.entry.js +1 -0
- package/dist/post-components/p-5912f8f1.entry.js +1 -0
- package/dist/post-components/p-790f300d.entry.js +1 -0
- package/dist/post-components/p-7ed5a493.entry.js +1 -0
- package/dist/post-components/p-85bea1b6.entry.js +1 -0
- package/dist/post-components/p-8bcff4d2.entry.js +1 -0
- package/dist/post-components/p-9dc9c245.entry.js +1 -0
- package/dist/post-components/p-B7ebLhHc.js +1 -0
- package/dist/post-components/p-BVCjnh6Q.js +1 -0
- package/dist/post-components/p-BXNs2_sw.js +1 -0
- package/dist/post-components/p-C9hMpmsD.js +1 -0
- package/dist/post-components/p-CDZBzSdV.js +2 -0
- package/dist/post-components/p-CEmnRoA6.js +1 -0
- package/dist/post-components/p-CZvbetqX.js +1 -0
- package/dist/post-components/p-CoDiS_Ik.js +1 -0
- package/dist/post-components/p-D5knoiyy.js +1 -0
- package/dist/post-components/p-DI-h_mEL.js +1 -0
- package/dist/post-components/p-a06f9695.entry.js +1 -0
- package/dist/post-components/p-a191f1df.entry.js +1 -0
- package/dist/post-components/p-c5d19d62.entry.js +1 -0
- package/dist/post-components/{p-24dc54d1.entry.js → p-c8c4d05b.entry.js} +1 -1
- package/dist/post-components/{p-57288cb2.entry.js → p-d1a5c980.entry.js} +1 -1
- package/dist/post-components/p-d4e2c556.entry.js +1 -0
- package/dist/post-components/p-f96a310c.entry.js +1 -0
- package/dist/post-components/p-fab2327d.entry.js +1 -0
- package/dist/post-components/p-rEfV4v4a.js +1 -0
- package/dist/post-components/post-components.css +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/prebuild.js +46 -0
- package/dist/types/animations/collapse.d.ts +1 -0
- package/dist/types/animations/fade-slide.d.ts +11 -0
- package/dist/types/animations/fade.d.ts +2 -2
- package/dist/types/animations/index.d.ts +2 -0
- package/dist/types/animations/slide.d.ts +9 -2
- package/dist/types/animations/types.d.ts +13 -0
- package/dist/types/animations/utils.d.ts +2 -0
- package/dist/types/components/post-accordion-item/heading-levels.d.ts +1 -1
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -2
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -2
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +6 -6
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +4 -5
- package/dist/types/components/post-footer/post-footer.d.ts +4 -4
- package/dist/types/components/post-header/post-header.d.ts +23 -13
- package/dist/types/components/{post-language-switch/post-language-switch.d.ts → post-language-menu/post-language-menu.d.ts} +12 -11
- package/dist/types/components/{post-language-option/post-language-option.d.ts → post-language-menu-item/post-language-menu-item.d.ts} +5 -5
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +6 -5
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +20 -2
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +17 -23
- package/dist/types/components/post-menu/post-menu.d.ts +4 -4
- package/dist/types/components/post-pagination/post-pagination.d.ts +224 -0
- package/dist/types/components/post-popover/post-popover.d.ts +4 -3
- package/dist/types/components/post-popover-trigger/post-popover-trigger.d.ts +2 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +23 -21
- package/dist/types/components/post-rating/post-rating.d.ts +1 -1
- package/dist/types/components/post-stepper/post-stepper.d.ts +9 -8
- package/dist/types/components/post-tab-item/post-tab-item.d.ts +19 -0
- package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +3 -3
- package/dist/types/components/post-tabs/post-tabs.d.ts +33 -12
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +1 -5
- package/dist/types/components.d.ts +322 -219
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/prebuild.d.ts +9 -0
- package/dist/types/stencil-public-runtime.d.ts +147 -10
- package/dist/types/types/heading-levels.d.ts +1 -1
- package/dist/types/utils/environment.d.ts +25 -1
- package/dist/types/utils/get-focusable-children.d.ts +2 -2
- package/dist/types/utils/tests/environment/hydrate-app-helper.d.ts +5 -0
- package/dist/types/utils/tests/environment/post-env-test.d.ts +3 -0
- package/hydrate/index.d.ts +14 -0
- package/hydrate/index.js +7494 -2714
- package/hydrate/index.mjs +7493 -2715
- package/package.json +7 -8
- package/dist/cjs/fade-nS5zzDQS.js +0 -14
- package/dist/cjs/index-UFKR6Ok0.js +0 -98
- package/dist/cjs/post-tab-header.cjs.entry.js +0 -31
- package/dist/collection/animations/slide-and-fade.js +0 -25
- package/dist/collection/components/post-language-option/post-language-option.css +0 -1
- package/dist/collection/components/post-language-switch/post-language-switch.css +0 -1
- package/dist/collection/components/post-list/post-list.css +0 -1
- package/dist/collection/components/post-list/post-list.js +0 -97
- 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 -26
- package/dist/collection/components/post-tab-header/post-tab-header.css +0 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +0 -65
- package/dist/components/index2.js +0 -89
- package/dist/components/post-language-option.d.ts +0 -11
- package/dist/components/post-language-option.js +0 -99
- package/dist/components/post-language-switch.js +0 -157
- package/dist/components/post-list-item.js +0 -38
- package/dist/components/post-list.js +0 -61
- package/dist/components/post-tab-header.js +0 -52
- package/dist/components/react/p-BVXiQdHq.js +0 -64
- package/dist/components/react/p-BhxZzOEC.js +0 -3
- package/dist/components/react/p-CSAMO7iJ.js +0 -243
- package/dist/components/react/p-CYkf_7Y5.js +0 -89
- package/dist/components/react/p-Ccrl2AQn.js +0 -111
- package/dist/components/react/p-CewRvBtg.js +0 -139
- package/dist/components/react/p-Cwiv86_f.js +0 -111
- package/dist/components/react/p-D2waO0Zc.js +0 -31
- package/dist/components/react/p-DBPOV12C.js +0 -160
- package/dist/components/react/p-DVGEExot.js +0 -3128
- package/dist/components/react/p-Djvj8fd2.js +0 -80
- package/dist/components/react/p-LtiDhYis.js +0 -137
- package/dist/components/react/p-SbIC4aZX.js +0 -11
- package/dist/components/react/p-XrZzCOKT.js +0 -78
- package/dist/components/react/p-v3pOrMNQ.js +0 -114
- package/dist/components/react/post-language-option.js +0 -100
- package/dist/components/react/post-language-switch.d.ts +0 -11
- package/dist/components/react/post-language-switch.js +0 -158
- package/dist/components/react/post-list-item.js +0 -39
- package/dist/components/react/post-list.js +0 -62
- package/dist/components/react/post-tab-header.js +0 -53
- package/dist/esm/breakpoints-CJ80BZ06.js +0 -178
- package/dist/esm/event-from-CzIKqBrS.js +0 -119
- package/dist/esm/fade-SbIC4aZX.js +0 -11
- package/dist/esm/get-root-BkQ3CrLq.js +0 -15
- package/dist/esm/index-Beaz8wEe.js +0 -89
- package/dist/esm/package-BhxZzOEC.js +0 -3
- package/dist/esm/post-tab-header.entry.js +0 -29
- package/dist/post-components/p-01e678c9.entry.js +0 -1
- package/dist/post-components/p-034a453f.entry.js +0 -1
- package/dist/post-components/p-15a4cdbf.entry.js +0 -1
- package/dist/post-components/p-2a2030bf.entry.js +0 -1
- package/dist/post-components/p-2ed84cc3.entry.js +0 -1
- package/dist/post-components/p-3228968f.entry.js +0 -1
- package/dist/post-components/p-3c01ddfe.entry.js +0 -1
- package/dist/post-components/p-748b1f01.entry.js +0 -1
- package/dist/post-components/p-7745e46e.entry.js +0 -1
- package/dist/post-components/p-7f635728.entry.js +0 -1
- package/dist/post-components/p-82c178a3.entry.js +0 -1
- package/dist/post-components/p-9b5f8319.entry.js +0 -1
- package/dist/post-components/p-Beaz8wEe.js +0 -1
- package/dist/post-components/p-BhxZzOEC.js +0 -1
- package/dist/post-components/p-CJ80BZ06.js +0 -1
- package/dist/post-components/p-D9ZHp2FP.js +0 -1
- package/dist/post-components/p-SbIC4aZX.js +0 -1
- package/dist/post-components/p-a9644e54.entry.js +0 -1
- package/dist/post-components/p-af030a3a.entry.js +0 -1
- package/dist/post-components/p-b8ba8139.entry.js +0 -1
- package/dist/post-components/p-db935e8e.entry.js +0 -1
- package/dist/post-components/p-e62e1f57.entry.js +0 -1
- package/dist/post-components/p-fb4b1641.entry.js +0 -1
- package/dist/post-components/p-wEFJ-c34.js +0 -2
- package/dist/types/animations/slide-and-fade.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-tab-header/post-tab-header.d.ts +0 -14
- /package/dist/collection/components/{post-language-switch → post-language-menu}/switch-variants.js +0 -0
- /package/dist/{post-components/p-CzIKqBrS.js → components/react/p-rEfV4v4a.js} +0 -0
- /package/dist/types/components/{post-language-switch → post-language-menu}/switch-variants.d.ts +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var _package = require('./package-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var getFocusableChildren = require('./get-focusable-children-
|
|
8
|
-
var eventFrom = require('./event-from-
|
|
3
|
+
var index = require('./index-B4rc1pqu.js');
|
|
4
|
+
var _package = require('./package-uQ5oiSiN.js');
|
|
5
|
+
var breakpoints = require('./breakpoints-Df03Ct7n.js');
|
|
6
|
+
var fade = require('./fade-CPQhl1fP.js');
|
|
7
|
+
var getFocusableChildren = require('./get-focusable-children-ChETM1wK.js');
|
|
8
|
+
var eventFrom = require('./event-from-CwMw19f8.js');
|
|
9
|
+
var environment = require('./environment-BQE9Unf_.js');
|
|
9
10
|
var index_browser = require('./index.browser-Doj636JV.js');
|
|
11
|
+
var utils = require('./utils-s05L2ulk.js');
|
|
12
|
+
var fadeSlide = require('./fade-slide-dPhQa-I1.js');
|
|
10
13
|
var placement = require('./placement-qEFR9hmI.js');
|
|
11
|
-
var getRoot = require('./get-root-
|
|
14
|
+
var getRoot = require('./get-root-CUAv4k4C.js');
|
|
12
15
|
|
|
13
16
|
const BUTTON_TYPES = ['button', 'submit', 'reset'];
|
|
14
17
|
|
|
15
|
-
const postClosebuttonCss =
|
|
18
|
+
const postClosebuttonCss = () => `.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}post-closebutton .btn{padding:0;border:unset;min-height:unset;min-width:unset;width:var(--post-device-sizing-notification-1);height:var(--post-device-sizing-notification-1);border-radius:var(--post-device-border-radius-round);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);display:flex;align-items:center;justify-content:center}post-closebutton .btn>post-icon{min-width:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4);height:var(--post-device-sizing-interactive-icon-size4)}post-closebutton .btn{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-closebutton .btn: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-closebutton .btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-closebutton .btn: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-closebutton .btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-closebutton .btn:not(:disabled):hover,post-closebutton .btn.pretend-hover{cursor:pointer;background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-closebutton .btn:not(:disabled):hover,post-closebutton .btn.pretend-hover{color:HighlightText !important}}`;
|
|
16
19
|
|
|
17
20
|
const PostClosebutton = class {
|
|
18
21
|
constructor(hostRef) {
|
|
@@ -24,7 +27,7 @@ const PostClosebutton = class {
|
|
|
24
27
|
this.buttonType = 'button';
|
|
25
28
|
}
|
|
26
29
|
validateButtonType() {
|
|
27
|
-
|
|
30
|
+
breakpoints.checkEmptyOrOneOf(this, 'buttonType', BUTTON_TYPES);
|
|
28
31
|
}
|
|
29
32
|
componentDidLoad() {
|
|
30
33
|
this.checkContent();
|
|
@@ -48,40 +51,45 @@ const PostClosebutton = class {
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
render() {
|
|
51
|
-
return (index.h(index.Host, { key: '
|
|
54
|
+
return (index.h(index.Host, { key: '6965a8cb5fb765b4fcec0439ceeafe19d34970c2', "data-version": _package.version }, index.h("button", { key: '7e718f70b0a4ac79e9439784dac46bd1ffd60fd1', class: "btn", type: this.buttonType }, index.h("post-icon", { key: '70acda3fbe6c9420f0be708fde6b29a7d5337d13', "aria-hidden": "true", name: "closex" }), index.h("span", { key: '899b3814c0898b521e4166e1cd951af628558e78', class: "visually-hidden" }, index.h("slot", { key: 'b13d0e95fd567c86e93e5185389909c7c0e7107d' })))));
|
|
52
55
|
}
|
|
53
56
|
get host() { return index.getElement(this); }
|
|
54
57
|
static get watchers() { return {
|
|
55
|
-
"buttonType": [
|
|
58
|
+
"buttonType": [{
|
|
59
|
+
"validateButtonType": 0
|
|
60
|
+
}]
|
|
56
61
|
}; }
|
|
57
62
|
};
|
|
58
|
-
PostClosebutton.style = postClosebuttonCss;
|
|
63
|
+
PostClosebutton.style = postClosebuttonCss();
|
|
59
64
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
65
|
+
/**
|
|
66
|
+
* Used by PostMegadropdown (burger menu)
|
|
67
|
+
*/
|
|
68
|
+
const defaultOptions = {
|
|
69
|
+
translate: 100,
|
|
70
|
+
duration: 500,
|
|
71
|
+
easing: 'ease',
|
|
72
|
+
fill: 'none',
|
|
73
|
+
};
|
|
74
|
+
function animateSlide(el, keyframes, options) {
|
|
75
|
+
const { duration, easing, fill } = { ...defaultOptions, ...options };
|
|
76
|
+
return el.animate(keyframes, { duration, easing: utils.resolveEasing(easing), fill });
|
|
72
77
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
function slide(el, direction, options = {}) {
|
|
79
|
+
const mergedOptions = {
|
|
80
|
+
...defaultOptions,
|
|
81
|
+
...options,
|
|
82
|
+
};
|
|
83
|
+
const { translate } = mergedOptions;
|
|
84
|
+
const baseKeyframes = [
|
|
85
|
+
{ transform: `translateX(${translate}%)` },
|
|
86
|
+
{ transform: 'translateX(0)' },
|
|
87
|
+
];
|
|
88
|
+
const keyframes = direction === 'in' ? baseKeyframes : [...baseKeyframes].reverse();
|
|
89
|
+
return animateSlide(el, keyframes, options);
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
const postHeaderCss =
|
|
92
|
+
const postHeaderCss = () => `:host{--post-global-header-top:calc( var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height) );--post-header-top:calc(var(--post-header-reduced-height) - var(--post-header-expanded-height));--post-logo-height:calc( var(--post-global-header-expanded-height) - var(--post-header-scroll-top, 0px) );--post-global-controls-top:clamp( 1000 * (var(--post-global-header-reduced-height) - var(--post-global-header-expanded-height)), calc( -1 * min(var(--post-header-scroll-top, 0px) / 4, var(--post-global-header-reduced-height)) ), 0px )}@media screen and (min-width: 1024px){:host{--post-header-gap:0.25rem;--post-global-header-padding-inline-start:0.25rem;--post-global-header-padding-inline-end:0.5rem;--post-local-header-padding-inline-start:0.75rem;--post-local-header-padding-inline-end:0.5rem}}@media screen and (min-width: 600px)and (max-width: 1023.98px){:host{--post-header-gap:0.75rem 0.25rem;--post-global-header-padding-inline-start:0.25rem;--post-global-header-padding-inline-end:0.25rem;--post-local-header-padding-inline-start:0.75rem;--post-local-header-padding-inline-end:0.25rem;--post-local-header-padding-block:0rem;--post-burger-menu-padding-inline:2.5rem;--post-burger-menu-body-gap:2rem;--post-burger-menu-footer-gap:1.5rem}}@media screen and (min-width: 600px)and (max-width: 779.98px){:host{--post-burger-menu-padding-inline:1rem}}@media screen and (min-width: 0)and (max-width: 599.98px){:host{--post-header-gap:0.75rem 0.25rem;--post-global-header-padding-inline-start:0rem;--post-global-header-padding-inline-end:0.5rem;--post-local-header-padding-inline-start:0.5rem;--post-local-header-padding-inline-end:0.5rem;--post-local-header-padding-block:0rem;--post-burger-menu-padding-inline:1rem;--post-burger-menu-body-gap:1.5rem;--post-burger-menu-footer-gap:1rem}}:host(:not([full-width])),:host([full-width=false]){--post-header-content-max-width:1440px}:host([data-expanded]),:host([data-menu-extended]){--post-header-top:0;--post-global-header-top:-0.001px;--post-global-controls-top:0;--post-logo-height:var(--post-global-header-expanded-height)}*,::before,::after{box-sizing:border-box}:host,header,.global-header,.local-header{transition:inset-block-start 150ms cubic-bezier(0.4, 0, 0.2, 1)}.global-header,.local-header,.burger-menu{box-shadow:var(--post-device-elevation-300)}.section,.navigation,.sliding-controls{display:flex;align-items:center;justify-content:space-between;gap:var(--post-header-gap);flex-wrap:wrap}.section{max-width:var(--post-header-content-max-width);margin-inline:auto}:host{container-type:inline-size;display:block;position:sticky;inset-block-start:var(--post-header-top);z-index:1020}:host post-togglebutton{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:.25rem .625rem;gap:.375rem;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}:host post-togglebutton:hover{text-decoration:none}:host post-togglebutton:disabled{border-style:var(--post-core-border-style-dash)}:host post-togglebutton{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host post-togglebutton: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){:host post-togglebutton:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host post-togglebutton: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){:host post-togglebutton:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host post-togglebutton:is(a){color:LinkText;border:unset}:host post-togglebutton:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}:host post-togglebutton:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}:host post-togglebutton:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}:host post-togglebutton: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)}:host post-togglebutton:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg);color:var(--post-scheme-color-interactive-button-primary-enabled-fg)}:host post-togglebutton:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}@media screen and (min-width: 0)and (max-width: 599.98px){:host post-togglebutton{padding:.625rem}:host post-togglebutton>:not(post-icon){display:none}:host post-togglebutton>post-icon{font-size:1.5rem}}.global-header{z-index:2;position:sticky;inset-block-start:var(--post-global-header-top);background-color:#fc0}.global-header .section{height:var(--post-global-header-expanded-height);padding-inline-start:var(--post-global-header-padding-inline-start);padding-inline-end:var(--post-global-header-padding-inline-end)}.global-header:has(~.local-header:not(.no-title.no-navigation)),.global-header:has(~.burger-menu.extended){box-shadow:none}.global-header .logo{align-self:flex-end;width:var(--post-global-header-expanded-height);height:var(--post-logo-height);min-height:var(--post-global-header-reduced-height);max-height:100%;margin-inline-end:calc(1.25rem - var(--post-header-gap))}.global-header .sliding-controls{flex-grow:1;justify-content:flex-end;position:relative;inset-block-start:var(--post-global-controls-top)}.global-header .audience{margin-inline-end:auto}.global-header.no-audience .audience{display:none}.local-header{position:relative;background-color:#fff}.local-header .section{min-height:var(--post-local-header-expanded-min-height);padding-inline-start:var(--post-local-header-padding-inline-start);padding-inline-end:var(--post-local-header-padding-inline-end);padding-block:var(--post-local-header-padding-block)}.local-header:not(.no-title,.no-navigation) .section{padding-block-start:1.125rem}.local-header.no-title.no-navigation{display:none}.local-header:has(.navigation.megadropdown-open),.local-header:has(~.burger-menu.extended){box-shadow:none}.local-header:has(.navigation.megadropdown-open)::after,.local-header:has(~.burger-menu.extended)::after{content:"";display:block;position:absolute;inset-inline:0;inset-block-end:0;height:1px;background-color:#e1e0dc}.local-header .navigation{flex:1 0 100%;height:var(--post-main-navigation-height);margin-inline-start:calc(-1*var(--post-local-header-padding-inline-start));max-width:100cqw}.local-header.no-navigation .navigation{display:none}.local-header .local-nav{flex:0 0 auto}.local-header.no-local-nav .navigation{margin-inline-end:calc(-1*var(--post-local-header-padding-inline-end))}.local-header.no-local-nav .local-nav{display:none}.burger-menu{z-index:-1;position:absolute;inset-inline:0;inset-block-start:100%;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));overflow:hidden auto;display:flex;flex-direction:column;background-color:#fafafa}.burger-menu.extended.megadropdown-open{overflow:hidden}.burger-menu:not(.extended){transform:translateY(-100%);display:none}.burger-menu:not(.extended)>*{display:none}.burger-menu .burger-menu-body,.burger-menu .burger-menu-footer{display:flex;flex-direction:column;padding-inline:var(--post-burger-menu-padding-inline)}.burger-menu .burger-menu-body{flex-grow:1;padding-block:1.5rem;gap:var(--post-burger-menu-body-gap)}.burger-menu .burger-menu-footer{background-color:#f0efed;padding-block:1rem 1.5rem;gap:var(--post-burger-menu-footer-gap)}.burger-menu .local-nav{min-height:3.5rem;display:flex;align-items:center;justify-content:flex-end;padding-inline:.25rem}.burger-menu.no-local-nav .local-nav{display:none}`;
|
|
85
93
|
|
|
86
94
|
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
87
95
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -111,6 +119,12 @@ const PostHeader = class {
|
|
|
111
119
|
}
|
|
112
120
|
return document.body;
|
|
113
121
|
}
|
|
122
|
+
validateFullWidth() {
|
|
123
|
+
breakpoints.checkRequiredAndType(this, 'fullWidth', 'boolean');
|
|
124
|
+
}
|
|
125
|
+
validateTextMenu() {
|
|
126
|
+
breakpoints.checkRequiredAndType(this, 'textMenu', 'string');
|
|
127
|
+
}
|
|
114
128
|
lockBody(newValue, _oldValue, propName) {
|
|
115
129
|
const scrollParent = this.scrollParent;
|
|
116
130
|
const burgerMenuExtended = propName === 'burgerMenuExtended' ? newValue : this.burgerMenuExtended;
|
|
@@ -126,13 +140,21 @@ const PostHeader = class {
|
|
|
126
140
|
constructor(hostRef) {
|
|
127
141
|
index.registerInstance(this, hostRef);
|
|
128
142
|
this.throttledResize = breakpoints.throttle(50, () => this.updateLocalHeaderHeight());
|
|
143
|
+
this.animationOptions = {
|
|
144
|
+
duration: 350,
|
|
145
|
+
easing: 'headerEase',
|
|
146
|
+
};
|
|
129
147
|
this.device = breakpoints.breakpoint.get('device');
|
|
130
148
|
this.hasNavigation = false;
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
149
|
+
this.hasLocalNav = false;
|
|
150
|
+
this.hasAudience = false;
|
|
133
151
|
this.hasTitle = false;
|
|
134
152
|
this.burgerMenuExtended = false;
|
|
135
153
|
this.megadropdownOpen = false;
|
|
154
|
+
/**
|
|
155
|
+
* Makes the header content span the full width on screens larger than 1440px.
|
|
156
|
+
*/
|
|
157
|
+
this.fullWidth = false;
|
|
136
158
|
this.breakpointChange = (e) => {
|
|
137
159
|
this.device = e.detail;
|
|
138
160
|
this.switchLanguageSwitchMode();
|
|
@@ -146,15 +168,14 @@ const PostHeader = class {
|
|
|
146
168
|
this.megadropdownOpen = false;
|
|
147
169
|
}
|
|
148
170
|
};
|
|
149
|
-
this.megadropdownStateHandler = (event) => {
|
|
150
|
-
this.megadropdownOpen = event.detail.isVisible;
|
|
151
|
-
};
|
|
152
171
|
this.handleScrollEvent = this.handleScrollEvent.bind(this);
|
|
153
172
|
this.updateScrollParentHeight = this.updateScrollParentHeight.bind(this);
|
|
154
173
|
this.updateLocalHeaderHeight = this.updateLocalHeaderHeight.bind(this);
|
|
155
174
|
this.keyboardHandler = this.keyboardHandler.bind(this);
|
|
156
175
|
this.handleLinkClick = this.handleLinkClick.bind(this);
|
|
176
|
+
this.megadropdownStateHandler = this.megadropdownStateHandler.bind(this);
|
|
157
177
|
this.checkSlottedContent = this.checkSlottedContent.bind(this);
|
|
178
|
+
this.megadropdownStateHandler = this.megadropdownStateHandler.bind(this);
|
|
158
179
|
}
|
|
159
180
|
connectedCallback() {
|
|
160
181
|
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
@@ -165,7 +186,6 @@ const PostHeader = class {
|
|
|
165
186
|
passive: true,
|
|
166
187
|
});
|
|
167
188
|
document.addEventListener('postToggleMegadropdown', this.megadropdownStateHandler);
|
|
168
|
-
this.host.addEventListener('click', this.handleLinkClick);
|
|
169
189
|
window.addEventListener('postBreakpoint:device', this.breakpointChange);
|
|
170
190
|
this.handleScrollParentResize();
|
|
171
191
|
this.lockBody(false, this.burgerMenuExtended, 'burgerMenuExtended');
|
|
@@ -176,11 +196,14 @@ const PostHeader = class {
|
|
|
176
196
|
this.switchLanguageSwitchMode();
|
|
177
197
|
}
|
|
178
198
|
componentDidRender() {
|
|
199
|
+
this.validateTextMenu();
|
|
200
|
+
this.validateFullWidth();
|
|
179
201
|
this.getFocusableElements();
|
|
180
202
|
this.handleLocalHeaderResize();
|
|
181
203
|
}
|
|
182
204
|
componentDidLoad() {
|
|
183
205
|
this.updateLocalHeaderHeight();
|
|
206
|
+
this.host.shadowRoot.addEventListener('click', this.handleLinkClick);
|
|
184
207
|
}
|
|
185
208
|
// Clean up possible side effects when post-header is disconnected
|
|
186
209
|
disconnectedCallback() {
|
|
@@ -192,7 +215,9 @@ const PostHeader = class {
|
|
|
192
215
|
scrollParent.removeEventListener('scroll', this.handleScrollEvent);
|
|
193
216
|
document.removeEventListener('postToggleMegadropdown', this.megadropdownStateHandler);
|
|
194
217
|
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
195
|
-
this.host.
|
|
218
|
+
if (this.host.shadowRoot) {
|
|
219
|
+
this.host.shadowRoot.removeEventListener('click', this.handleLinkClick);
|
|
220
|
+
}
|
|
196
221
|
if (this.scrollParentResizeObserver) {
|
|
197
222
|
this.scrollParentResizeObserver.disconnect();
|
|
198
223
|
this.scrollParentResizeObserver = null;
|
|
@@ -208,11 +233,9 @@ const PostHeader = class {
|
|
|
208
233
|
this.burgerMenuExtended = false;
|
|
209
234
|
}
|
|
210
235
|
async closeBurgerMenu() {
|
|
211
|
-
this.burgerMenuAnimation
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
menuButton.toggled = false;
|
|
215
|
-
}
|
|
236
|
+
this.burgerMenuAnimation?.finish();
|
|
237
|
+
if (this.burgerMenuButton)
|
|
238
|
+
this.burgerMenuButton.toggled = false;
|
|
216
239
|
this.burgerMenuExtended = false;
|
|
217
240
|
}
|
|
218
241
|
/**
|
|
@@ -222,18 +245,18 @@ const PostHeader = class {
|
|
|
222
245
|
if (this.device === 'desktop')
|
|
223
246
|
return;
|
|
224
247
|
this.burgerMenuAnimation = this.burgerMenuExtended
|
|
225
|
-
?
|
|
226
|
-
:
|
|
248
|
+
? fade.fade(this.burgerMenu, 'out', this.animationOptions)
|
|
249
|
+
: fade.fade(this.burgerMenu, 'in', this.animationOptions);
|
|
227
250
|
// Update the state of the toggle button
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
menuButton.toggled = force ?? !this.burgerMenuExtended;
|
|
251
|
+
if (this.burgerMenuButton)
|
|
252
|
+
this.burgerMenuButton.toggled = force ?? !this.burgerMenuExtended;
|
|
231
253
|
if (this.burgerMenuExtended) {
|
|
232
254
|
// Wait for the close animation to finish before hiding megadropdowns
|
|
233
255
|
await this.burgerMenuAnimation.finished;
|
|
234
256
|
this.burgerMenuExtended = force ?? !this.burgerMenuExtended;
|
|
235
257
|
if (this.burgerMenuExtended === false) {
|
|
236
258
|
this.closeAllMegadropdowns();
|
|
259
|
+
this.burgerMenu.scrollTop = 0;
|
|
237
260
|
}
|
|
238
261
|
}
|
|
239
262
|
else {
|
|
@@ -244,37 +267,31 @@ const PostHeader = class {
|
|
|
244
267
|
}
|
|
245
268
|
}
|
|
246
269
|
}
|
|
270
|
+
megadropdownStateHandler(event) {
|
|
271
|
+
this.megadropdownOpen = event.detail.isVisible;
|
|
272
|
+
}
|
|
247
273
|
// Get all the focusable elements in the post-header burger menu
|
|
248
274
|
getFocusableElements() {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
];
|
|
255
|
-
// Add the main toggle menu button to the list of focusable children
|
|
256
|
-
const focusableChildren = [
|
|
257
|
-
this.host.querySelector('post-togglebutton'),
|
|
258
|
-
...focusableEls.flatMap(el => Array.from(getFocusableChildren.getFocusableChildren(el))),
|
|
259
|
-
];
|
|
260
|
-
this.firstFocusableEl = focusableChildren[0];
|
|
261
|
-
this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
|
|
262
|
-
}
|
|
263
|
-
getMenuButton() {
|
|
264
|
-
return this.host.querySelector('post-togglebutton');
|
|
275
|
+
if (!this.burgerMenu)
|
|
276
|
+
return;
|
|
277
|
+
const focusableElements = [this.burgerMenuButton];
|
|
278
|
+
focusableElements.push(...getFocusableChildren.getDeepFocusableChildren(this.localHeader, el => !el.matches('post-megadropdown')), ...getFocusableChildren.getDeepFocusableChildren(this.burgerMenu, el => !el.matches('post-megadropdown')));
|
|
279
|
+
this.firstFocusableEl = focusableElements[0];
|
|
280
|
+
this.lastFocusableEl = focusableElements[focusableElements.length - 1];
|
|
265
281
|
}
|
|
266
282
|
keyboardHandler(e) {
|
|
267
|
-
if (e.key
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
283
|
+
if (e.key !== 'Tab' || !this.burgerMenuExtended)
|
|
284
|
+
return;
|
|
285
|
+
const activeElement = this.host.shadowRoot.activeElement || document.activeElement;
|
|
286
|
+
if (e.shiftKey && activeElement === this.firstFocusableEl) {
|
|
287
|
+
// If back tab (Tab + Shift) and first element is focused, focus goes to the last element of the megadropdown
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
this.lastFocusableEl.focus();
|
|
290
|
+
}
|
|
291
|
+
else if (!e.shiftKey && activeElement === this.lastFocusableEl) {
|
|
292
|
+
// If Tab and last element is focused, focus goes back to the first element of the megadropdown
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
this.firstFocusableEl.focus();
|
|
278
295
|
}
|
|
279
296
|
}
|
|
280
297
|
closeAllMegadropdowns() {
|
|
@@ -334,21 +351,28 @@ const PostHeader = class {
|
|
|
334
351
|
}
|
|
335
352
|
}
|
|
336
353
|
checkSlottedContent() {
|
|
337
|
-
this.hasNavigation = !!this.host.querySelector('[slot="
|
|
338
|
-
this.
|
|
339
|
-
this.
|
|
354
|
+
this.hasNavigation = !!this.host.querySelector('[slot="main-nav"]');
|
|
355
|
+
this.hasLocalNav = !!this.host.querySelector('[slot="local-nav"]');
|
|
356
|
+
this.hasAudience = !!this.host.querySelector('[slot="audience"]');
|
|
340
357
|
this.hasTitle = !!this.host.querySelector('[slot="title"]');
|
|
341
358
|
}
|
|
342
359
|
switchLanguageSwitchMode() {
|
|
343
360
|
const variant = this.hasBurgerMenu ? 'list' : 'menu';
|
|
344
|
-
Array.from(this.host.querySelectorAll('post-language-
|
|
361
|
+
Array.from(this.host.querySelectorAll('post-language-menu')).forEach(languageSwitch => {
|
|
345
362
|
languageSwitch?.setAttribute('variant', variant);
|
|
346
363
|
});
|
|
347
364
|
}
|
|
348
|
-
onFocusChange() {
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
365
|
+
onFocusChange(e) {
|
|
366
|
+
const alwaysVisibleElements = this.device === 'desktop'
|
|
367
|
+
? '.navigation' // logo isn’t included since it would be too small to focus on effectively.
|
|
368
|
+
: '.global-header, .burger-menu';
|
|
369
|
+
const isHeaderExpanded =
|
|
370
|
+
// ensure the expanded state stays accurate during focus changes,
|
|
371
|
+
// e.g., when the focused element is removed from the DOM
|
|
372
|
+
// during a window resize
|
|
373
|
+
e.target === document.activeElement &&
|
|
374
|
+
this.host.matches(':focus-within') &&
|
|
375
|
+
!this.host.shadowRoot.querySelector(`:where(${alwaysVisibleElements}):focus-within`);
|
|
352
376
|
if (isHeaderExpanded) {
|
|
353
377
|
this.host.setAttribute('data-expanded', '');
|
|
354
378
|
}
|
|
@@ -357,42 +381,54 @@ const PostHeader = class {
|
|
|
357
381
|
}
|
|
358
382
|
}
|
|
359
383
|
renderNavigation() {
|
|
384
|
+
const localNav = !this.hasTitle && (index.h("div", { class: "local-nav" }, index.h("slot", { name: "local-nav" })));
|
|
360
385
|
if (this.device === 'desktop') {
|
|
361
|
-
return (index.h("div", { class: { 'navigation': true, 'megadropdown-open': this.megadropdownOpen } }, index.h("slot", { name: "
|
|
386
|
+
return (index.h("div", { class: { 'navigation': true, 'megadropdown-open': this.megadropdownOpen } }, index.h("slot", { name: "main-nav" }), localNav));
|
|
362
387
|
}
|
|
363
388
|
return (index.h("div", { class: {
|
|
364
389
|
'burger-menu': true,
|
|
365
390
|
'extended': this.burgerMenuExtended,
|
|
366
|
-
'no-
|
|
367
|
-
|
|
391
|
+
'no-local-nav': !this.hasLocalNav,
|
|
392
|
+
'megadropdown-open': this.megadropdownOpen,
|
|
393
|
+
}, style: { '--post-header-navigation-current-inset': `${this.burgerMenu?.scrollTop ?? 0}px` }, ref: el => (this.burgerMenu = el) }, localNav, index.h("div", { class: "burger-menu-body" }, index.h("slot", { name: "audience" }), index.h("slot", { name: "main-nav" })), index.h("div", { class: "burger-menu-footer" }, index.h("slot", { name: "global-nav-secondary" }), index.h("slot", { name: "language-menu" }))));
|
|
368
394
|
}
|
|
369
395
|
render() {
|
|
370
|
-
return (index.h(index.Host, { key: '
|
|
396
|
+
return (index.h(index.Host, { key: '3f5431ebd9b726f8a73ee4a0b8b406d11bab5cf2', "data-version": _package.version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, index.h("header", { key: 'ea55944e7f5f0750e3cb229a94b2aef7738c397a' }, index.h("div", { key: 'f70653f47812b951519cc001a42d4827f327cffd', class: {
|
|
371
397
|
'global-header': true,
|
|
372
|
-
'no-
|
|
373
|
-
} }, index.h("div", { key: '
|
|
374
|
-
index.h("slot", { key: '
|
|
375
|
-
index.h("slot", { key: '
|
|
376
|
-
], index.h("slot", { key: '
|
|
398
|
+
'no-audience': !this.hasAudience,
|
|
399
|
+
} }, index.h("div", { key: '60d43f32a71169d6d4314b9cc4d8a9e11ec7834e', class: "section" }, index.h("div", { key: 'ce0f3a9fff1225456f823189093fe960d3f49033', class: "logo" }, index.h("slot", { key: 'd96003c9bafbe7914b84a9f7b80ab8ed4bd71ddb', name: "post-logo" })), index.h("div", { key: 'c85e70b4a9adbdd4d95c4ff8a53248b9b707ff2b', class: "sliding-controls" }, this.device === 'desktop' && (index.h("div", { key: 'd297bba4782a50df1942d96a4eea6c9aeb76965d', class: "audience" }, index.h("slot", { key: '8a923e9a27d811c204d212843b611885b1a2b257', name: "audience" }))), index.h("slot", { key: '44a6294e62add92191e5ee8f6b0606a2e367a3d5', name: "global-nav-primary" }), !this.hasBurgerMenu && [
|
|
400
|
+
index.h("slot", { key: '843b9a656a289b51aea5db4634323999286ccb64', name: "global-nav-secondary" }),
|
|
401
|
+
index.h("slot", { key: '55268cf25f98a76c377ad48c2578f2f8b3a5b025', name: "language-menu" }),
|
|
402
|
+
], index.h("slot", { key: '7885e754087572e48a0a62cccbbae3ea70a56bd3', name: "post-login" }), this.hasNavigation && this.device !== 'desktop' && (index.h("div", { key: '7713dede3877c4bd97cae59d78ea0a38daa15a8e', onClick: () => this.toggleBurgerMenu(), class: "burger-menu-toggle" }, index.h("slot", { key: '611df14f6646ae994ad090a482c20f09c3e1a39a', name: "post-togglebutton" }))), this.hasNavigation && this.device !== 'desktop' && (index.h("post-togglebutton", { key: 'e932a70cfd057cec4670867581e380d313cc23d1', ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, index.h("span", { key: 'c418e4ca4698ebefc5c7410cf6037620db0314f9' }, this.textMenu), index.h("post-icon", { key: '438bfc7ee2f0d853fa92385c8e0f159608d76313', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), index.h("post-icon", { key: 'd6b48e5078b8e96d3fc8fef27a50544b3ed58355', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), index.h("div", { key: '0909b5778d908f48521abd7635bfd6eb320fc16a', ref: el => (this.localHeader = el), class: {
|
|
377
403
|
'local-header': true,
|
|
378
404
|
'no-title': !this.hasTitle,
|
|
379
|
-
'no-
|
|
405
|
+
'no-audience': !this.hasAudience,
|
|
380
406
|
'no-navigation': this.device !== 'desktop' || !this.hasNavigation,
|
|
381
|
-
'no-
|
|
382
|
-
} }, index.h("slot", { key: '
|
|
407
|
+
'no-local-nav': !this.hasLocalNav,
|
|
408
|
+
} }, index.h("div", { key: 'b5d0280efefc560a89f3a1cbeeeaec1b90a82359', class: "section" }, index.h("slot", { key: 'b0f25a30d6970cde7b1b9e3c1de1ffb667e4cb97', name: "title" }), this.hasTitle && index.h("slot", { key: '9140fb3550e1f71824add9f90b43cf622223a4a1', name: "local-nav" }), this.device === 'desktop' && this.renderNavigation())), this.device !== 'desktop' && this.renderNavigation())));
|
|
383
409
|
}
|
|
384
410
|
get host() { return index.getElement(this); }
|
|
385
411
|
static get watchers() { return {
|
|
386
|
-
"
|
|
387
|
-
|
|
412
|
+
"fullWidth": [{
|
|
413
|
+
"validateFullWidth": 0
|
|
414
|
+
}],
|
|
415
|
+
"textMenu": [{
|
|
416
|
+
"validateTextMenu": 0
|
|
417
|
+
}],
|
|
418
|
+
"device": [{
|
|
419
|
+
"lockBody": 0
|
|
420
|
+
}],
|
|
421
|
+
"burgerMenuExtended": [{
|
|
422
|
+
"lockBody": 0
|
|
423
|
+
}]
|
|
388
424
|
}; }
|
|
389
425
|
};
|
|
390
426
|
__decorate$3([
|
|
391
427
|
eventFrom.EventFrom('post-megadropdown')
|
|
392
|
-
], PostHeader.prototype, "megadropdownStateHandler",
|
|
393
|
-
PostHeader.style = postHeaderCss;
|
|
428
|
+
], PostHeader.prototype, "megadropdownStateHandler", null);
|
|
429
|
+
PostHeader.style = postHeaderCss();
|
|
394
430
|
|
|
395
|
-
const postIconCss =
|
|
431
|
+
const postIconCss = () => `:host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}`;
|
|
396
432
|
|
|
397
433
|
const CDN_URL = `https://unpkg.com/@swisspost/design-system-icons@${_package.version}/public/post-icons/`;
|
|
398
434
|
const ANIMATION_NAMES = [
|
|
@@ -417,19 +453,19 @@ const PostIcon = class {
|
|
|
417
453
|
this.flipV = false;
|
|
418
454
|
}
|
|
419
455
|
validateAnimation() {
|
|
420
|
-
|
|
456
|
+
breakpoints.checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
|
|
421
457
|
}
|
|
422
458
|
validateBase() {
|
|
423
|
-
|
|
459
|
+
breakpoints.checkEmptyOrType(this, 'base', 'string');
|
|
424
460
|
}
|
|
425
461
|
validateName() {
|
|
426
|
-
|
|
462
|
+
breakpoints.checkRequiredAndType(this, 'name', 'string');
|
|
427
463
|
}
|
|
428
464
|
validateRotate() {
|
|
429
|
-
|
|
465
|
+
breakpoints.checkEmptyOrType(this, 'rotate', 'number');
|
|
430
466
|
}
|
|
431
467
|
validateScale() {
|
|
432
|
-
|
|
468
|
+
breakpoints.checkEmptyOrType(this, 'scale', 'number');
|
|
433
469
|
}
|
|
434
470
|
/**
|
|
435
471
|
* Construct the icon URL according to the following rules:
|
|
@@ -444,19 +480,21 @@ const PostIcon = class {
|
|
|
444
480
|
**/
|
|
445
481
|
getUrl() {
|
|
446
482
|
const fileName = `${this.name}.svg`;
|
|
447
|
-
if (!
|
|
483
|
+
if (!environment.IS_BROWSER && !this.base) {
|
|
448
484
|
return `${CDN_URL}${fileName}`;
|
|
449
485
|
}
|
|
450
486
|
const isAbsolute = (url) => /^https?:\/\//.test(url);
|
|
451
487
|
const normalizeUrl = (url) => (url && !url.endsWith('/') ? `${url}/` : url);
|
|
452
488
|
const cleanUrl = (url) => url.replace(/([^:])\/\//g, '$1/');
|
|
453
|
-
const currentDomain =
|
|
454
|
-
const baseHref =
|
|
489
|
+
const currentDomain = environment.IS_BROWSER ? window.location.origin : '';
|
|
490
|
+
const baseHref = environment.IS_BROWSER
|
|
455
491
|
? document.querySelector('base[href]')?.getAttribute('href') || ''
|
|
456
492
|
: '';
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
493
|
+
let metaIconBase = '';
|
|
494
|
+
if (environment.IS_BROWSER) {
|
|
495
|
+
const metaTag = document.querySelector('meta[name="design-system-settings"]');
|
|
496
|
+
metaIconBase = metaTag?.getAttribute('data-post-icon-base') || '';
|
|
497
|
+
}
|
|
460
498
|
// Function to build the first part of the URL when 'this.base' or 'metaIconBase' are relative
|
|
461
499
|
const buildUrlWithBase = (relativeUrl) => {
|
|
462
500
|
const normalizedHref = normalizeUrl(baseHref);
|
|
@@ -503,85 +541,32 @@ const PostIcon = class {
|
|
|
503
541
|
this.validateAnimation();
|
|
504
542
|
}
|
|
505
543
|
render() {
|
|
506
|
-
return (index.h(index.Host, { key: '
|
|
544
|
+
return (index.h(index.Host, { key: 'fe1b4d0541c75c1ed0adb92111d106ed874a9b2f', "data-version": _package.version }, index.h("span", { key: 'ca2b749e407d9ec54eb881c6662b59626e16083d', style: this.getStyles() })));
|
|
507
545
|
}
|
|
508
546
|
get host() { return index.getElement(this); }
|
|
509
547
|
static get watchers() { return {
|
|
510
|
-
"animation": [
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
"
|
|
514
|
-
|
|
548
|
+
"animation": [{
|
|
549
|
+
"validateAnimation": 0
|
|
550
|
+
}],
|
|
551
|
+
"base": [{
|
|
552
|
+
"validateBase": 0
|
|
553
|
+
}],
|
|
554
|
+
"name": [{
|
|
555
|
+
"validateName": 0
|
|
556
|
+
}],
|
|
557
|
+
"rotate": [{
|
|
558
|
+
"validateRotate": 0
|
|
559
|
+
}],
|
|
560
|
+
"scale": [{
|
|
561
|
+
"validateScale": 0
|
|
562
|
+
}]
|
|
515
563
|
}; }
|
|
516
564
|
};
|
|
517
|
-
PostIcon.style = postIconCss;
|
|
565
|
+
PostIcon.style = postIconCss();
|
|
518
566
|
|
|
519
567
|
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
520
568
|
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
const PostLanguageOption = class {
|
|
524
|
-
constructor(hostRef) {
|
|
525
|
-
index.registerInstance(this, hostRef);
|
|
526
|
-
this.postChange = index.createEvent(this, "postChange");
|
|
527
|
-
this.postLanguageOptionInitiallyActive = index.createEvent(this, "postLanguageOptionInitiallyActive");
|
|
528
|
-
}
|
|
529
|
-
validateCode() {
|
|
530
|
-
index$1.checkRequiredAndType(this, 'code', 'string');
|
|
531
|
-
}
|
|
532
|
-
validateVariant() {
|
|
533
|
-
index$1.checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
|
|
534
|
-
}
|
|
535
|
-
validateName() {
|
|
536
|
-
index$1.checkEmptyOrType(this, 'name', 'string');
|
|
537
|
-
}
|
|
538
|
-
validateUrl() {
|
|
539
|
-
index$1.checkEmptyOrUrl(this, 'url');
|
|
540
|
-
}
|
|
541
|
-
componentDidLoad() {
|
|
542
|
-
this.validateCode();
|
|
543
|
-
this.validateName();
|
|
544
|
-
this.validateUrl();
|
|
545
|
-
if (!this.name && this.isNameRequired()) {
|
|
546
|
-
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
547
|
-
}
|
|
548
|
-
if (this.active) {
|
|
549
|
-
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Selects the language option programmatically.
|
|
554
|
-
*/
|
|
555
|
-
async select() {
|
|
556
|
-
this.active = true;
|
|
557
|
-
this.emitChange();
|
|
558
|
-
}
|
|
559
|
-
emitChange() {
|
|
560
|
-
this.postChange.emit(this.code);
|
|
561
|
-
}
|
|
562
|
-
isNameRequired() {
|
|
563
|
-
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
564
|
-
}
|
|
565
|
-
render() {
|
|
566
|
-
const lang = this.code.toLowerCase();
|
|
567
|
-
const emitOnKeyDown = (e) => {
|
|
568
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
569
|
-
this.emitChange();
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
return (index.h(index.Host, { key: '06ba54de702d5014b34f1b0cb6396cb947ac3ca6', "data-version": _package.version, role: this.variant === 'list' ? 'listitem' : undefined }, this.url ? (index.h("a", { "aria-current": this.active ? 'page' : undefined, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null), index.h("span", { class: "visually-hidden" }, this.name))) : (index.h("button", { "aria-current": this.active ? 'true' : undefined, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null), index.h("span", { class: "visually-hidden" }, this.name)))));
|
|
573
|
-
}
|
|
574
|
-
get host() { return index.getElement(this); }
|
|
575
|
-
static get watchers() { return {
|
|
576
|
-
"code": ["validateCode"],
|
|
577
|
-
"variant": ["validateVariant"],
|
|
578
|
-
"name": ["validateName"],
|
|
579
|
-
"url": ["validateUrl"]
|
|
580
|
-
}; }
|
|
581
|
-
};
|
|
582
|
-
PostLanguageOption.style = postLanguageOptionCss;
|
|
583
|
-
|
|
584
|
-
const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.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:24px;width:24px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{border:1px solid ButtonBorder}.post-language-switch-trigger[aria-expanded=true] post-icon,.post-language-switch-trigger:hover post-icon{color:HighlightText}}post-menu::part(menu){padding-block:0}.post-language-switch-list{margin-top:1rem}";
|
|
569
|
+
const postLanguageMenuCss = () => `:host{display:flex !important}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.post-language-menu-dropdown-container{display:flex;flex-direction:column}.post-language-menu-trigger{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:.25rem .625rem;gap:.375rem;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);text-transform:uppercase;cursor:pointer}.post-language-menu-trigger:hover{text-decoration:none}.post-language-menu-trigger:disabled{border-style:var(--post-core-border-style-dash)}.post-language-menu-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-menu-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-menu-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-menu-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-menu-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-menu-trigger:is(a){color:LinkText;border:unset}.post-language-menu-trigger:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}.post-language-menu-trigger:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}.post-language-menu-trigger:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}.post-language-menu-trigger: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-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg);color:var(--post-scheme-color-interactive-button-primary-enabled-fg)}.post-language-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}.post-language-menu-trigger post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}.post-language-menu-trigger:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}post-menu::part(post-menu){padding-block:0}.post-language-menu-list{margin-top:1rem}`;
|
|
585
570
|
|
|
586
571
|
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
587
572
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -593,7 +578,7 @@ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
593
578
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
594
579
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
595
580
|
};
|
|
596
|
-
const
|
|
581
|
+
const PostLanguageMenu = class {
|
|
597
582
|
constructor(hostRef) {
|
|
598
583
|
index.registerInstance(this, hostRef);
|
|
599
584
|
this.menuId = `p${index_browser.nanoid(11)}`;
|
|
@@ -604,32 +589,40 @@ const PostLanguageSwitch = class {
|
|
|
604
589
|
this.variant = 'list';
|
|
605
590
|
}
|
|
606
591
|
get languageOptions() {
|
|
607
|
-
return Array.from(this.host.querySelectorAll('post-language-
|
|
592
|
+
return Array.from(this.host.querySelectorAll('post-language-menu-item'));
|
|
608
593
|
}
|
|
609
|
-
|
|
610
|
-
|
|
594
|
+
validateTextChangeLanguage() {
|
|
595
|
+
breakpoints.checkRequiredAndType(this, 'textChangeLanguage', 'string');
|
|
611
596
|
}
|
|
612
|
-
|
|
613
|
-
|
|
597
|
+
validateTextCurrentLanguage() {
|
|
598
|
+
breakpoints.checkRequiredAndPattern(this, 'textCurrentLanguage', /#name\b/);
|
|
614
599
|
}
|
|
615
600
|
validateVariant() {
|
|
616
|
-
|
|
601
|
+
breakpoints.checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
|
|
617
602
|
this.updateChildrenVariant();
|
|
618
603
|
}
|
|
604
|
+
/* The complete accessible description */
|
|
605
|
+
get description() {
|
|
606
|
+
const activeLanguage = this.activeLang &&
|
|
607
|
+
document.querySelector(`post-language-menu-item[code="${this.activeLang}"]`);
|
|
608
|
+
return activeLanguage
|
|
609
|
+
? this.textCurrentLanguage.replace(/#name/g, activeLanguage.name)
|
|
610
|
+
: undefined;
|
|
611
|
+
}
|
|
619
612
|
componentDidLoad() {
|
|
620
|
-
this.
|
|
621
|
-
this.
|
|
613
|
+
this.validateTextChangeLanguage();
|
|
614
|
+
this.validateTextCurrentLanguage();
|
|
622
615
|
this.validateVariant();
|
|
623
616
|
// Initially set variants and active language
|
|
624
|
-
// Handles cases where the language-
|
|
617
|
+
// Handles cases where the language-menu is rendered after the language-options have been rendered
|
|
625
618
|
this.updateChildrenVariant();
|
|
626
619
|
}
|
|
627
620
|
/**
|
|
628
|
-
* Listen for the postChange event and guard it to run only for events originating from a <post-language-
|
|
621
|
+
* Listen for the postChange event and guard it to run only for events originating from a <post-language-menu-item> element.
|
|
629
622
|
*/
|
|
630
623
|
handlePostChange(event) {
|
|
631
624
|
this.activeLang = event.detail;
|
|
632
|
-
// Update the active state in the children post-language-
|
|
625
|
+
// Update the active state in the children post-language-menu-item components
|
|
633
626
|
this.languageOptions.forEach(lang => {
|
|
634
627
|
if (lang.code && lang.code === this.activeLang) {
|
|
635
628
|
lang.setAttribute('active', '');
|
|
@@ -645,98 +638,124 @@ const PostLanguageSwitch = class {
|
|
|
645
638
|
}
|
|
646
639
|
}
|
|
647
640
|
/**
|
|
648
|
-
* Handles cases where the language
|
|
649
|
-
* @param event Initially emitted by <post-
|
|
641
|
+
* Handles cases where the language menu is being rendered before options are available
|
|
642
|
+
* @param event Initially emitted by <post-language-menu-item>
|
|
650
643
|
*/
|
|
651
644
|
handleInitiallyActive(event) {
|
|
652
645
|
this.activeLang = event.detail;
|
|
653
646
|
}
|
|
654
|
-
// Update post-language-
|
|
647
|
+
// Update post-language-menu-item variant to have the correct style
|
|
655
648
|
updateChildrenVariant() {
|
|
656
649
|
this.languageOptions.forEach(el => {
|
|
657
650
|
el.setAttribute('variant', this.variant);
|
|
658
651
|
});
|
|
659
652
|
}
|
|
660
653
|
renderList() {
|
|
661
|
-
return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "post-language-
|
|
654
|
+
return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "post-language-menu-list", role: "list", "aria-label": this.textChangeLanguage, "aria-describedby": this.listSpanId }, index.h("span", { id: this.listSpanId, class: "visually-hidden" }, this.description), index.h("slot", null))));
|
|
662
655
|
}
|
|
663
656
|
renderDropdown() {
|
|
664
|
-
return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-
|
|
657
|
+
return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-menu-trigger" }, this.activeLang, index.h("span", { class: "visually-hidden" }, this.textChangeLanguage), index.h("span", { class: "visually-hidden" }, this.description), index.h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), index.h("post-menu", { id: this.menuId, class: "post-language-menu-dropdown-container", label: this.textChangeLanguage, placement: "bottom-end" }, index.h("slot", null))));
|
|
665
658
|
}
|
|
666
659
|
render() {
|
|
667
660
|
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
668
661
|
}
|
|
669
662
|
get host() { return index.getElement(this); }
|
|
670
663
|
static get watchers() { return {
|
|
671
|
-
"
|
|
672
|
-
|
|
673
|
-
|
|
664
|
+
"textChangeLanguage": [{
|
|
665
|
+
"validateTextChangeLanguage": 0
|
|
666
|
+
}],
|
|
667
|
+
"textCurrentLanguage": [{
|
|
668
|
+
"validateTextCurrentLanguage": 0
|
|
669
|
+
}],
|
|
670
|
+
"variant": [{
|
|
671
|
+
"validateVariant": 0
|
|
672
|
+
}]
|
|
674
673
|
}; }
|
|
675
674
|
};
|
|
676
675
|
__decorate$2([
|
|
677
|
-
eventFrom.EventFrom('post-language-
|
|
678
|
-
],
|
|
679
|
-
|
|
676
|
+
eventFrom.EventFrom('post-language-menu-item')
|
|
677
|
+
], PostLanguageMenu.prototype, "handlePostChange", null);
|
|
678
|
+
PostLanguageMenu.style = postLanguageMenuCss();
|
|
680
679
|
|
|
681
|
-
const
|
|
680
|
+
const postLanguageMenuItemCss = () => `post-language-menu-item{display:inline-block}post-language-menu-item button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-menu-item button{background-color:ButtonFace !important}post-language-menu-item button:hover{background-color:Highlight !important}}post-language-menu-item button .visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}post-language-menu-item a{color:var(--post-current-fg);text-decoration:none}post-language-menu-item :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-transform:uppercase}post-language-menu-item :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-menu-item :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-menu-item :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-menu-item :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-menu-item :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-menu-item:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-menu-item:where([variant=list]) :is(a,button):hover{color:#504f4b}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-menu-item:where([variant=list]) :is(a,button){border:1px solid ButtonBorder;color:ButtonText}}post-language-menu-item:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-menu-item:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:Highlight !important;color:HighlightText}}post-language-menu-item:where([variant=menu]){min-width:72px}post-language-menu-item:where([variant=menu])[active]:not([active=false]){display:none}post-language-menu-item:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:16px;box-sizing:border-box;justify-content:flex-start;position:relative;border-radius:0}post-language-menu-item:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}post-language-menu-item:where([variant=menu]):first-child :is(a,button){border-start-start-radius:4px;border-start-end-radius:4px}post-language-menu-item:where([variant=menu]):last-child :is(a,button){border-end-start-radius:4px;border-end-end-radius:4px}`;
|
|
682
681
|
|
|
683
|
-
const
|
|
682
|
+
const PostLanguageMenuItem = class {
|
|
684
683
|
constructor(hostRef) {
|
|
685
684
|
index.registerInstance(this, hostRef);
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
*/
|
|
689
|
-
this.titleHidden = false;
|
|
690
|
-
/**
|
|
691
|
-
* The list can become horizontal by setting `horizontal="true"` or just `horizontal`
|
|
692
|
-
*/
|
|
693
|
-
this.horizontal = false;
|
|
685
|
+
this.postChange = index.createEvent(this, "postChange");
|
|
686
|
+
this.postLanguageMenuItemInitiallyActive = index.createEvent(this, "postLanguageMenuItemInitiallyActive");
|
|
694
687
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
* Get the id set on the host element or use a random id by default
|
|
698
|
-
*/
|
|
699
|
-
this.titleId = `title-${this.host.id || index_browser.nanoid(6)}`;
|
|
688
|
+
validateCode() {
|
|
689
|
+
breakpoints.checkRequiredAndType(this, 'code', 'string');
|
|
700
690
|
}
|
|
701
|
-
|
|
702
|
-
|
|
691
|
+
validateVariant() {
|
|
692
|
+
breakpoints.checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
|
|
703
693
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
694
|
+
validateName() {
|
|
695
|
+
breakpoints.checkEmptyOrType(this, 'name', 'string');
|
|
696
|
+
}
|
|
697
|
+
validateUrl() {
|
|
698
|
+
breakpoints.checkEmptyOrUrl(this, 'url');
|
|
699
|
+
}
|
|
700
|
+
componentDidLoad() {
|
|
701
|
+
this.validateCode();
|
|
702
|
+
this.validateName();
|
|
703
|
+
this.validateUrl();
|
|
704
|
+
if (!this.name && this.isNameRequired()) {
|
|
705
|
+
throw new Error('The "name" property of the post-language-menu-item component is required when the full language name is not displayed.');
|
|
706
|
+
}
|
|
707
|
+
if (this.active) {
|
|
708
|
+
this.postLanguageMenuItemInitiallyActive.emit(this.code);
|
|
707
709
|
}
|
|
708
710
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
+
/**
|
|
712
|
+
* Selects the language option programmatically.
|
|
713
|
+
*/
|
|
714
|
+
async select() {
|
|
715
|
+
this.active = true;
|
|
716
|
+
this.emitChange();
|
|
711
717
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
PostList.style = postListCss;
|
|
715
|
-
|
|
716
|
-
const postListItemCss = ":host{display:flex}";
|
|
717
|
-
|
|
718
|
-
const PostListItem = class {
|
|
719
|
-
constructor(hostRef) {
|
|
720
|
-
index.registerInstance(this, hostRef);
|
|
718
|
+
emitChange() {
|
|
719
|
+
this.postChange.emit(this.code);
|
|
721
720
|
}
|
|
722
|
-
|
|
723
|
-
this.host.
|
|
721
|
+
isNameRequired() {
|
|
722
|
+
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
724
723
|
}
|
|
725
724
|
render() {
|
|
726
|
-
|
|
725
|
+
const lang = this.code.toLowerCase();
|
|
726
|
+
const emitOnKeyDown = (e) => {
|
|
727
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
728
|
+
this.emitChange();
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
return (index.h(index.Host, { key: 'f95d1aba997cbb1b7b4805428443a35e9db4c8e6', "data-version": _package.version, role: this.variant === 'list' ? 'listitem' : undefined }, this.url ? (index.h("a", { "aria-current": this.active ? 'page' : undefined, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null), index.h("span", { class: "visually-hidden" }, this.name))) : (index.h("button", { "aria-current": this.active ? 'true' : undefined, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null), index.h("span", { class: "visually-hidden" }, this.name)))));
|
|
727
732
|
}
|
|
728
733
|
get host() { return index.getElement(this); }
|
|
734
|
+
static get watchers() { return {
|
|
735
|
+
"code": [{
|
|
736
|
+
"validateCode": 0
|
|
737
|
+
}],
|
|
738
|
+
"variant": [{
|
|
739
|
+
"validateVariant": 0
|
|
740
|
+
}],
|
|
741
|
+
"name": [{
|
|
742
|
+
"validateName": 0
|
|
743
|
+
}],
|
|
744
|
+
"url": [{
|
|
745
|
+
"validateUrl": 0
|
|
746
|
+
}]
|
|
747
|
+
}; }
|
|
729
748
|
};
|
|
730
|
-
|
|
749
|
+
PostLanguageMenuItem.style = postLanguageMenuItemCss();
|
|
731
750
|
|
|
732
|
-
const postLogoCss =
|
|
751
|
+
const postLogoCss = () => `:host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.logo-link{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.logo-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.logo-link{outline-offset:calc( -2px - var(--post-device-border-width-focus) ) !important}.logo-link :focus,:focus-visible{border-radius:.5rem}`;
|
|
733
752
|
|
|
734
753
|
const PostLogo = class {
|
|
735
754
|
constructor(hostRef) {
|
|
736
755
|
index.registerInstance(this, hostRef);
|
|
737
756
|
}
|
|
738
757
|
validateUrl() {
|
|
739
|
-
|
|
758
|
+
breakpoints.checkEmptyOrUrl(this, 'url');
|
|
740
759
|
}
|
|
741
760
|
componentDidLoad() {
|
|
742
761
|
this.validateUrl();
|
|
@@ -750,34 +769,38 @@ const PostLogo = class {
|
|
|
750
769
|
render() {
|
|
751
770
|
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
752
771
|
const LogoTag = logoLink ? 'a' : 'span';
|
|
753
|
-
return (index.h(index.Host, { key: '
|
|
772
|
+
return (index.h(index.Host, { key: 'c433a75f67606eeb5bcc52825f3f9a3c30bbaa4b', "data-version": _package.version }, index.h(LogoTag, { key: 'ab323bbad61548226f75a77df4f95315a9f6a31d', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, index.h("span", { key: 'af7f93ac30e9ee7f2d2b02451f6a00764bc29c28', class: "description" }, index.h("slot", { key: 'd7ab10f5a8076d40ac310398390f38bcbc9790f3', onSlotchange: () => this.checkDescription() })), index.h("svg", { key: '02f954f34f91f7666a480dbbdeacb6e0e5bfc993', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, index.h("g", { key: '04dd994e423ba9675c1b83b51e66c32898cd9b47', id: "Logo" }, index.h("rect", { key: 'e2c61f0848276c5c93f08e88be2b6470559b0957', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), index.h("polygon", { key: '149967b476d723c3a3ee0e80474b600a31c2857f', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), index.h("path", { key: '9deb7a46d7fd69c38ae499f12741593955df716d', 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" }))))));
|
|
754
773
|
}
|
|
755
774
|
get host() { return index.getElement(this); }
|
|
756
775
|
static get watchers() { return {
|
|
757
|
-
"url": [
|
|
776
|
+
"url": [{
|
|
777
|
+
"validateUrl": 0
|
|
778
|
+
}]
|
|
758
779
|
}; }
|
|
759
780
|
};
|
|
760
|
-
PostLogo.style = postLogoCss;
|
|
781
|
+
PostLogo.style = postLogoCss();
|
|
761
782
|
|
|
762
|
-
const postMainnavigationCss = ":root{--post-icon-chevrondown:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxkZWZzPjxzeW1ib2wgaWQ9ImktY2hldnJvbmRvd24iPjxzeW1ib2wgaWQ9InMxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij48cGF0aCBkPSJNMi4wMSA1LjIyYzAtLjE5LjA3LS4zOC4yMi0uNTMuMjktLjI5Ljc3LS4yOSAxLjA2IDBsNC43MiA0LjcyIDQuNzItNC43MmMuMjktLjI5Ljc3LS4yOSAxLjA2IDBzLjI5Ljc3IDAgMS4wNmwtNS43OCA1Ljc4LTUuNzgtNS43OGEuNzQuNzQgMCAwIDEtLjIyLS41MyIvPjwvc3ltYm9sPjxzeW1ib2wgaWQ9InMyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMy4yNiA3Ljg1YzAtLjIyLjA4LS40NS4yNi0uNjIuMzQtLjM0LjktLjM0IDEuMjQgMGw3LjI2IDcuMjYgNy4yNi03LjI2Yy4zNC0uMzQuOS0uMzQgMS4yNCAwcy4zNC45IDAgMS4yNGwtOC41IDguNS04LjUxLTguNWEuOS45IDAgMCAxLS4yNi0uNjJaIi8+PC9zeW1ib2w+PHN5bWJvbCBpZD0iczMyIiB2aWV3Qm94PSIwIDAgMzIgMzIiPjxwYXRoIGQ9Ik00LjUgMTAuNTRjMC0uMjYuMS0uNTEuMjktLjcxYS45OTYuOTk2IDAgMCAxIDEuNDEgMGw5Ljc5IDkuNzkgOS44LTkuOGEuOTk2Ljk5NiAwIDEgMSAxLjQxIDEuNDFMMTUuOTkgMjIuNDQgNC44IDExLjI1Yy0uMi0uMi0uMjktLjQ1LS4yOS0uNzFaIi8+PC9zeW1ib2w+PHN5bWJvbCBpZD0iczQwIiB2aWV3Qm94PSIwIDAgNDAgNDAiPjxwYXRoIGQ9Ik01LjggMTMuMTdhMS4xMjMgMS4xMjMgMCAwIDEgMS45Mi0uOEwyMC4wNSAyNC43bDEyLjM0LTEyLjM0Yy40NC0uNDQgMS4xNS0uNDQgMS41OSAwcy40NCAxLjE1IDAgMS41OUwyMC4wNSAyNy44OCA2LjEzIDEzLjk3Yy0uMjItLjIyLS4zMy0uNTEtLjMzLS44Ii8+PC9zeW1ib2w+PHN5bWJvbCBpZD0iczQ4IiB2aWV3Qm94PSIwIDAgNDggNDgiPjxwYXRoIGQ9Ik03IDE1Ljg3YzAtLjMyLjEyLS42NC4zNy0uODhhMS4yNSAxLjI1IDAgMCAxIDEuNzcgMGwxNC44NyAxNC44NyAxNC44OC0xNC44OGMuNDktLjQ5IDEuMjgtLjQ5IDEuNzcgMHMuNDkgMS4yOCAwIDEuNzdMMjQuMDIgMzMuMzkgNy4zNyAxNi43NWMtLjI0LS4yNC0uMzctLjU2LS4zNy0uODgiLz48L3N5bWJvbD48c3ltYm9sIGlkPSJzNjQiIHZpZXdCb3g9IjAgMCA2NCA2NCI+PHBhdGggZD0iTTkuNjMgMjEuMjRhMS4zOCAxLjM4IDAgMCAxIDIuMzUtLjk3TDMyLjAxIDQwLjNsMjAuMDQtMjAuMDRjLjU0LS41NCAxLjQxLS41NCAxLjk1IDBzLjU0IDEuNDEgMCAxLjk1TDMyLjAxIDQ0LjE5IDEwLjAzIDIyLjIyYy0uMjctLjI3LS40LS42Mi0uNC0uOTdaTTAgLjAzaDY0djY0SDB6Ii8+PC9zeW1ib2w+PHVzZSBzdHlsZT0iZGlzcGxheTogdmFyKC0tczE2LCBub25lKSIgaHJlZj0iI3MxNiIvPjx1c2Ugc3R5bGU9ImRpc3BsYXk6IHZhcigtLXMyNCwgbm9uZSkiIGhyZWY9IiNzMjQiLz48dXNlIHN0eWxlPSJkaXNwbGF5OiB2YXIoLS1zMzIsIG5vbmUpIiBocmVmPSIjczMyIi8+PHVzZSBzdHlsZT0iZGlzcGxheTogdmFyKC0tczQwLCBub25lKSIgaHJlZj0iI3M0MCIvPjx1c2Ugc3R5bGU9ImRpc3BsYXk6IHZhcigtLXM0OCwgbm9uZSkiIGhyZWY9IiNzNDgiLz48dXNlIHN0eWxlPSJkaXNwbGF5OiB2YXIoLS1zNjQsIG5vbmUpIiBocmVmPSIjczY0Ii8+PC9zeW1ib2w+PC9kZWZzPjxzdHlsZT5AbWVkaWEgKG1heC13aWR0aDogMjMuOThweCkge2d7LS1zMTY6YmxvY2s7fX1AbWVkaWEgKG1pbi13aWR0aDogMjRweCkgYW5kIChtYXgtd2lkdGg6IDMxLjk4cHgpIHtney0tczI0OmJsb2NrO319QG1lZGlhIChtaW4td2lkdGg6IDMycHgpIGFuZCAobWF4LXdpZHRoOiAzOS45OHB4KSB7Z3stLXMzMjpibG9jazt9fUBtZWRpYSAobWluLXdpZHRoOiA0MHB4KSBhbmQgKG1heC13aWR0aDogNDcuOThweCkge2d7LS1zNDA6YmxvY2s7fX1AbWVkaWEgKG1pbi13aWR0aDogNDhweCkgYW5kIChtYXgtd2lkdGg6IDYzLjk4cHgpIHtney0tczQ4OmJsb2NrO319QG1lZGlhIChtaW4td2lkdGg6IDY0cHgpIHtney0tczY0OmJsb2NrO319PC9zdHlsZT48Zz48dXNlIGhyZWY9IiNpLWNoZXZyb25kb3duIi8+PC9nPjwvc3ZnPg==\")}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:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a: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 post-megadropdown-trigger button:focus-visible{border-radius:4px;z-index:2}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:\"\";mask-image:var(--post-icon-chevrondown);background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:24px;width:24px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation>button,post-mainnavigation post-megadropdown-trigger button{border:1px solid ButtonBorder !important}post-mainnavigation>button:hover::after,post-mainnavigation>button[aria-expanded=true]::after,post-mainnavigation post-megadropdown-trigger button:hover::after,post-mainnavigation post-megadropdown-trigger button[aria-expanded=true]::after{color:HighlightText}}post-header:not([data-burger-menu])>post-mainnavigation{display:flex;height:var(--post-main-navigation-height, 0);background:#fff;user-select:none}post-header:not([data-burger-menu])>post-mainnavigation nav{flex:1 1 auto;scroll-behavior:smooth}post-header:not([data-burger-menu])>post-mainnavigation.scrollable,post-header:not([data-burger-menu])>post-mainnavigation.scrollable nav{overflow:hidden}post-header:not([data-burger-menu])>post-mainnavigation .scroll-control{z-index:2;cursor:pointer;padding:1rem;background:#fff;box-shadow:var(--post-device-elevation-500);line-height:1}post-header:not([data-burger-menu])>post-mainnavigation .scroll-control.scroll-left{margin-inline-end:-3rem}post-header:not([data-burger-menu])>post-mainnavigation .scroll-control.scroll-right{margin-inline-start:-3rem}post-header:not([data-burger-menu])>post-mainnavigation .scroll-control.d-none{display:none}post-header:not([data-burger-menu])>post-mainnavigation .scroll-control post-icon{font-size:1rem}post-header:not([data-burger-menu])>post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--post-main-navigation-height, 0);gap:4px;font-size:16px}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;inset-inline-start:0}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a.active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-current=page]:not(post-megadropdown *),post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-expanded=true],post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button.active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-current=page]:not(post-megadropdown *),post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-expanded=true],post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button.active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-current=page]:not(post-megadropdown *),post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff;font-weight:700}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a.active .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-current=page]:not(post-megadropdown *) .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button.active .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-current=page]:not(post-megadropdown *) .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button.active .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-current=page]:not(post-megadropdown *) .nav-el-active,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a.active .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-current=page]:not(post-megadropdown *) .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button.active .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-current=page]:not(post-megadropdown *) .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button.active .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-current=page]:not(post-megadropdown *) .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a:hover,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button:hover,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}@media screen and (max-width: 599.98px){post-header:not([data-burger-menu])>post-mainnavigation post-list-item>a,post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button .nav-el-inactive,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button::after,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button::after{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-header:not([data-burger-menu])>post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-header:not([data-burger-menu])>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *)),post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *))::before,post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *)).active,post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *))[aria-current=page],post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *))[aria-expanded=true],post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a.active,post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a[aria-current=page],post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *)):hover,post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown button:not(:is(post-closebutton *)):hover::before,post-header:not([data-burger-menu])>post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}post-header[data-burger-menu]>post-mainnavigation nav{transform:none !important}post-header[data-burger-menu]>post-mainnavigation .scroll-control{display:none}post-header[data-burger-menu]>post-mainnavigation post-list-item>a,post-header[data-burger-menu]>post-mainnavigation post-list-item>button,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-header[data-burger-menu]>post-mainnavigation post-list-item>a::before,post-header[data-burger-menu]>post-mainnavigation post-list-item>button::before,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:\"\";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-header[data-burger-menu]>post-mainnavigation post-list-item>a.active,post-header[data-burger-menu]>post-mainnavigation post-list-item>a[aria-current=page],post-header[data-burger-menu]>post-mainnavigation post-list-item>a[aria-expanded=true],post-header[data-burger-menu]>post-mainnavigation post-list-item>button.active,post-header[data-burger-menu]>post-mainnavigation post-list-item>button[aria-current=page],post-header[data-burger-menu]>post-mainnavigation post-list-item>button[aria-expanded=true],post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button.active,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-current=page],post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff}post-header[data-burger-menu]>post-mainnavigation post-list-item>a:hover,post-header[data-burger-menu]>post-mainnavigation post-list-item>button:hover,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-header[data-burger-menu]>post-mainnavigation post-list-item>a:hover::before,post-header[data-burger-menu]>post-mainnavigation post-list-item>button:hover::before,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-header[data-burger-menu]>post-mainnavigation post-list-item>a .nav-el-inactive,post-header[data-burger-menu]>post-mainnavigation post-list-item>button .nav-el-inactive,post-header[data-burger-menu]>post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-header[data-burger-menu]>post-mainnavigation>button::after,post-header[data-burger-menu]>post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}";
|
|
783
|
+
const postMainnavigationCss = () => `:host{display:flex;user-select:none;max-width:var(--post-header-content-max-width)}@media screen and (min-width: 1024px){:host{overflow:hidden}}nav{flex:1 1 auto}@media screen and (min-width: 1024px){nav{scroll-behavior:smooth;max-width:100vw;overflow:hidden;height:var(--post-main-navigation-height)}}.scroll-control{z-index:1;cursor:pointer;padding:1rem;background:#fff;box-shadow:var(--post-device-elevation-500);line-height:1}.scroll-control.scroll-left{margin-inline-end:-3rem}.scroll-control.scroll-right{margin-inline-start:-3rem}.scroll-control.d-none{display:none}.scroll-control post-icon{font-size:1rem}`;
|
|
763
784
|
|
|
764
785
|
const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
|
|
765
786
|
const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
|
|
766
787
|
const PostMainnavigation = class {
|
|
788
|
+
validateTextMain() {
|
|
789
|
+
breakpoints.checkRequiredAndType(this, 'textMain', 'string');
|
|
790
|
+
}
|
|
767
791
|
constructor(hostRef) {
|
|
768
792
|
index.registerInstance(this, hostRef);
|
|
769
793
|
this.canScrollLeft = false;
|
|
770
794
|
this.canScrollRight = false;
|
|
771
795
|
this.scrollRight = this.scrollRight.bind(this);
|
|
772
796
|
this.scrollLeft = this.scrollLeft.bind(this);
|
|
773
|
-
this.handleMutations = this.handleMutations.bind(this);
|
|
774
797
|
this.checkScrollability = this.checkScrollability.bind(this);
|
|
775
798
|
this.resizeObserver = new ResizeObserver(this.checkScrollability);
|
|
776
|
-
this.mutationObserver = new MutationObserver(this.
|
|
799
|
+
this.mutationObserver = new MutationObserver(this.checkScrollability);
|
|
777
800
|
}
|
|
778
801
|
componentDidLoad() {
|
|
802
|
+
this.validateTextMain();
|
|
779
803
|
setTimeout(() => {
|
|
780
|
-
this.fixLayoutShift();
|
|
781
804
|
this.checkScrollability();
|
|
782
805
|
});
|
|
783
806
|
// Observe the navbar for size changes
|
|
@@ -802,30 +825,8 @@ const PostMainnavigation = class {
|
|
|
802
825
|
if (this.scrollRepeatInterval)
|
|
803
826
|
clearInterval(this.scrollRepeatInterval);
|
|
804
827
|
}
|
|
805
|
-
async handleMutations(mutations) {
|
|
806
|
-
const addedNodes = mutations.flatMap((mutation) => {
|
|
807
|
-
return Array.from(mutation.addedNodes);
|
|
808
|
-
});
|
|
809
|
-
// Wait for all elements to be hydrated
|
|
810
|
-
await Promise.all(addedNodes.map((item) => item.componentOnReady ? item.componentOnReady() : Promise.resolve(item)));
|
|
811
|
-
this.fixLayoutShift();
|
|
812
|
-
this.checkScrollability();
|
|
813
|
-
}
|
|
814
828
|
get navigationItems() {
|
|
815
|
-
return Array.from(this.
|
|
816
|
-
}
|
|
817
|
-
/**
|
|
818
|
-
* Hack to fix the layout shift due to bold text on active elements
|
|
819
|
-
*/
|
|
820
|
-
fixLayoutShift() {
|
|
821
|
-
this.navigationItems
|
|
822
|
-
.filter(item => !item.matches(':has(.nav-el-active)'))
|
|
823
|
-
.forEach(item => {
|
|
824
|
-
item.innerHTML = `
|
|
825
|
-
<span class="nav-el-active">${item.innerHTML}</span>
|
|
826
|
-
<span class="nav-el-inactive" aria-hidden="true">${item.innerHTML}</span>
|
|
827
|
-
`;
|
|
828
|
-
});
|
|
829
|
+
return Array.from(this.host.querySelectorAll('a:not(post-megadropdown *), post-megadropdown-trigger'));
|
|
829
830
|
}
|
|
830
831
|
/**
|
|
831
832
|
* Returns whether scrolling is enabled in either the left or right direction.
|
|
@@ -864,7 +865,7 @@ const PostMainnavigation = class {
|
|
|
864
865
|
}, SCROLL_REPEAT_INTERVAL);
|
|
865
866
|
}
|
|
866
867
|
scrollRight() {
|
|
867
|
-
const scrollRightLeftEdge =
|
|
868
|
+
const scrollRightLeftEdge = this.host.shadowRoot
|
|
868
869
|
.querySelector('.scroll-right')
|
|
869
870
|
.getBoundingClientRect().left;
|
|
870
871
|
for (const navigationItem of this.navigationItems) {
|
|
@@ -878,7 +879,7 @@ const PostMainnavigation = class {
|
|
|
878
879
|
}
|
|
879
880
|
}
|
|
880
881
|
scrollLeft() {
|
|
881
|
-
const scrollLeftRightEdge =
|
|
882
|
+
const scrollLeftRightEdge = this.host.shadowRoot
|
|
882
883
|
.querySelector('.scroll-left')
|
|
883
884
|
.getBoundingClientRect().right;
|
|
884
885
|
for (const navigationItem of this.navigationItems.reverse()) {
|
|
@@ -904,17 +905,40 @@ const PostMainnavigation = class {
|
|
|
904
905
|
}, NAVBAR_DISABLE_DURATION);
|
|
905
906
|
}
|
|
906
907
|
render() {
|
|
907
|
-
return (index.h(index.Host, { key: '
|
|
908
|
+
return (index.h(index.Host, { key: 'b6bfb6256a2a129a16737b9d97da629842c6b2d5', version: _package.version, class: this.canScroll ? 'scrollable' : '' }, index.h("div", { key: '3c250f1a09bf9d1c88d4469bb820be4d2ae3dc0a', "aria-hidden": "true", class: { 'scroll-control scroll-left': true, 'd-none': !this.canScrollLeft }, onMouseDown: e => this.handleScrollButtonClick(e, 'left') }, index.h("post-icon", { key: '8bfdcafdb2594ef323a9cf2408f2c45158fd1632', "aria-hidden": "true", name: "chevronleft" })), index.h("nav", { key: 'c1d1043ec8448346414a1bbc5cd95b3fe0d0e790', ref: el => (this.navbar = el), "aria-label": this.textMain }, index.h("slot", { key: 'cc078e4c7d8e24c77027f94598af09be5b80498c' })), index.h("div", { key: '1fe3c4fae7a9b2cb8bee6677ae528b2cd11d9fa9', "aria-hidden": "true", class: { 'scroll-control scroll-right': true, 'd-none': !this.canScrollRight }, onMouseDown: e => this.handleScrollButtonClick(e, 'right') }, index.h("post-icon", { key: '6636d014fd1862d9cbb2116da5cd303f83c7c0f3', "aria-hidden": "true", name: "chevronright" }))));
|
|
908
909
|
}
|
|
910
|
+
get host() { return index.getElement(this); }
|
|
911
|
+
static get watchers() { return {
|
|
912
|
+
"textMain": [{
|
|
913
|
+
"validateTextMain": 0
|
|
914
|
+
}]
|
|
915
|
+
}; }
|
|
909
916
|
};
|
|
910
|
-
PostMainnavigation.style = postMainnavigationCss;
|
|
917
|
+
PostMainnavigation.style = postMainnavigationCss();
|
|
911
918
|
|
|
912
|
-
const postMegadropdownCss =
|
|
919
|
+
const postMegadropdownCss = () => `*,::before,::after{box-sizing:border-box}.megadropdown{position:absolute;inset-inline:0;overflow-y:auto;background-color:#fafafa;box-shadow:var(--post-device-elevation-300)}@media screen and (min-width: 1024px){.megadropdown{z-index:-1;inset-block-start:100%}.megadropdown.slide-in{animation:slide-down 350ms forwards}.megadropdown.slide-out{animation:slide-up 350ms forwards}}@media screen and (max-width: 1023.98px){.megadropdown{z-index:1;inset-block-start:var(--post-header-navigation-current-inset);overscroll-behavior:contain}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown{border-block-end:1px solid CanvasText}}.section{width:100%;max-width:var(--post-header-content-max-width);margin-inline:auto;position:relative}@media screen and (min-width: 1024px){.section{max-height:calc(100vh - var(--post-header-height) - 3rem);padding:2rem 2.5rem 2.5rem}}@media screen and (max-width: 1023.98px){.section{display:flex;flex-direction:column;height:calc(min(var(--post-header-scroll-parent-height, 100dvh),100dvh) - var(--post-header-height));padding-inline:var(--post-burger-menu-padding-inline);padding-block:1.5rem}}.megadropdown-title{margin-block:0 1rem;font-weight:950}@media screen and (min-width: 600px)and (max-width: 1023.98px){.megadropdown-title{font-size:1.25rem}}@media screen and (min-width: 0)and (max-width: 599.98px){.megadropdown-title{font-size:1.125rem}}.back-button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7);border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);order:-1;width:fit-content;padding-inline:0}.back-button:hover{text-decoration:none}.back-button:disabled{border-style:var(--post-core-border-style-dash)}.back-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}.back-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){.back-button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.back-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){.back-button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.back-button:is(a){color:LinkText;border:unset}.back-button:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}.back-button:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}.back-button:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}.back-button>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.back-button: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)}@media screen and (min-width: 600px)and (max-width: 1023.98px){.back-button{margin-block-end:2rem}}@media screen and (min-width: 0)and (max-width: 599.98px){.back-button{margin-block-end:1.5rem}}.close-button{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}@media screen and (max-width: 1023.98px){.close-button{display:none}}`;
|
|
913
920
|
|
|
914
921
|
const PostMegadropdown = class {
|
|
922
|
+
validateTextClose() {
|
|
923
|
+
breakpoints.checkRequiredAndType(this, 'textClose', 'string');
|
|
924
|
+
}
|
|
925
|
+
validateTextBack() {
|
|
926
|
+
breakpoints.checkRequiredAndType(this, 'textBack', 'string');
|
|
927
|
+
}
|
|
928
|
+
get megadropdownTrigger() {
|
|
929
|
+
const hostId = this.host.getAttribute('id');
|
|
930
|
+
return hostId ? document.querySelector(`post-megadropdown-trigger[for="${hostId}"]`) : null;
|
|
931
|
+
}
|
|
915
932
|
constructor(hostRef) {
|
|
916
933
|
index.registerInstance(this, hostRef);
|
|
917
934
|
this.postToggleMegadropdown = index.createEvent(this, "postToggleMegadropdown");
|
|
935
|
+
this.currentAnimation = null;
|
|
936
|
+
this.isAnimating = false;
|
|
937
|
+
this.fsAnimationOptions = {
|
|
938
|
+
translate: -10,
|
|
939
|
+
duration: 350,
|
|
940
|
+
easing: 'headerEase',
|
|
941
|
+
};
|
|
918
942
|
this.device = breakpoints.breakpoint.get('device');
|
|
919
943
|
/**
|
|
920
944
|
* Holds the current visibility state of the dropdown.
|
|
@@ -925,13 +949,17 @@ const PostMegadropdown = class {
|
|
|
925
949
|
this.trigger = false;
|
|
926
950
|
/** Holds the current animation class. */
|
|
927
951
|
this.animationClass = null;
|
|
928
|
-
this.handleClickOutside = (event) => {
|
|
952
|
+
this.handleClickOutside = async (event) => {
|
|
929
953
|
if (this.device !== 'desktop')
|
|
930
954
|
return;
|
|
931
955
|
const target = event.target;
|
|
932
956
|
if (this.host.contains(target)) {
|
|
933
957
|
return;
|
|
934
958
|
}
|
|
959
|
+
// Ignore clicks on the trigger or its contents to prevent running hide() twice
|
|
960
|
+
if (this.megadropdownTrigger.contains(target)) {
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
935
963
|
if (target instanceof HTMLElement) {
|
|
936
964
|
const trigger = target.closest('post-megadropdown-trigger');
|
|
937
965
|
if (trigger) {
|
|
@@ -941,14 +969,11 @@ const PostMegadropdown = class {
|
|
|
941
969
|
}
|
|
942
970
|
}
|
|
943
971
|
}
|
|
944
|
-
this.hide(false);
|
|
972
|
+
await this.hide(false);
|
|
945
973
|
};
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
return hostId
|
|
950
|
-
? document.querySelector(`post-megadropdown-trigger[for="${hostId}"] > button`)
|
|
951
|
-
: null;
|
|
974
|
+
this.keyboardHandler = this.keyboardHandler.bind(this);
|
|
975
|
+
this.handleTabOutside = this.handleTabOutside.bind(this);
|
|
976
|
+
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
952
977
|
}
|
|
953
978
|
connectedCallback() {
|
|
954
979
|
window.addEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
|
|
@@ -957,16 +982,17 @@ const PostMegadropdown = class {
|
|
|
957
982
|
this.getFocusableElements();
|
|
958
983
|
}
|
|
959
984
|
componentDidLoad() {
|
|
985
|
+
this.validateTextClose();
|
|
986
|
+
this.validateTextBack();
|
|
960
987
|
this.checkInitialAriaCurrent();
|
|
961
988
|
this.setupObserver();
|
|
962
989
|
this.handleAriaCurrentChange([]);
|
|
963
990
|
}
|
|
964
991
|
disconnectedCallback() {
|
|
965
|
-
this.removeListeners();
|
|
966
992
|
window.removeEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
|
|
967
|
-
if (PostMegadropdown.activeDropdown === this)
|
|
993
|
+
if (PostMegadropdown.activeDropdown === this)
|
|
968
994
|
PostMegadropdown.activeDropdown = null;
|
|
969
|
-
|
|
995
|
+
this.removeListeners();
|
|
970
996
|
if (this.defaultSlotObserver) {
|
|
971
997
|
this.defaultSlotObserver.disconnect();
|
|
972
998
|
}
|
|
@@ -975,41 +1001,70 @@ const PostMegadropdown = class {
|
|
|
975
1001
|
* Toggles the dropdown visibility based on its current state.
|
|
976
1002
|
*/
|
|
977
1003
|
async toggle() {
|
|
978
|
-
if (this.
|
|
979
|
-
this
|
|
980
|
-
|
|
981
|
-
else {
|
|
982
|
-
await this.show();
|
|
1004
|
+
if (this.isAnimating) {
|
|
1005
|
+
// If this is already animating towards a future state -> reverse intent
|
|
1006
|
+
return this.isVisible ? this.show() : this.hide();
|
|
983
1007
|
}
|
|
1008
|
+
return this.isVisible ? this.hide() : this.show();
|
|
984
1009
|
}
|
|
985
1010
|
/**
|
|
986
1011
|
* Displays the dropdown.
|
|
987
1012
|
*/
|
|
988
1013
|
async show() {
|
|
1014
|
+
if (this.device !== 'desktop') {
|
|
1015
|
+
const trigger = this.megadropdownTrigger;
|
|
1016
|
+
if (trigger)
|
|
1017
|
+
this.megadropdownTitle = trigger.innerHTML;
|
|
1018
|
+
}
|
|
989
1019
|
if (PostMegadropdown.activeDropdown && PostMegadropdown.activeDropdown !== this) {
|
|
990
1020
|
// Close the previously active dropdown without animation
|
|
991
1021
|
PostMegadropdown.activeDropdown.forceClose();
|
|
992
1022
|
}
|
|
993
|
-
this.
|
|
1023
|
+
this.cancelAnimation();
|
|
1024
|
+
// Set the megadropdown visible and mark it as the active dropdown
|
|
994
1025
|
this.isVisible = true;
|
|
995
1026
|
PostMegadropdown.activeDropdown = this;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
this.
|
|
1027
|
+
// Update trigger state
|
|
1028
|
+
this.postToggleMegadropdown.emit({ isVisible: true });
|
|
1029
|
+
try {
|
|
1030
|
+
await this.animate('in');
|
|
1031
|
+
this.focusFirst();
|
|
1032
|
+
// After the megadropdown has finished entry animation
|
|
1033
|
+
this.addListeners();
|
|
1034
|
+
}
|
|
1035
|
+
catch {
|
|
1036
|
+
// Open animation was cancelled - reset state
|
|
1037
|
+
this.removeListeners();
|
|
1038
|
+
this.isVisible = false;
|
|
1039
|
+
if (PostMegadropdown.activeDropdown === this)
|
|
1040
|
+
PostMegadropdown.activeDropdown = null;
|
|
1041
|
+
this.postToggleMegadropdown.emit({ isVisible: false, focusParent: true });
|
|
1000
1042
|
}
|
|
1001
|
-
this.addListeners();
|
|
1002
1043
|
}
|
|
1003
1044
|
/**
|
|
1004
1045
|
* Hides the dropdown with an animation.
|
|
1005
1046
|
*/
|
|
1006
1047
|
async hide(focusParent = true, forceClose = false) {
|
|
1007
|
-
this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
|
|
1008
1048
|
if (forceClose) {
|
|
1009
1049
|
this.forceClose();
|
|
1050
|
+
return;
|
|
1010
1051
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1052
|
+
// Update trigger state
|
|
1053
|
+
this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
|
|
1054
|
+
try {
|
|
1055
|
+
await this.animate('out');
|
|
1056
|
+
// After the closing animation finishes set the megadropdown as non visible
|
|
1057
|
+
this.isVisible = false;
|
|
1058
|
+
this.removeListeners();
|
|
1059
|
+
if (PostMegadropdown.activeDropdown === this)
|
|
1060
|
+
PostMegadropdown.activeDropdown = null;
|
|
1061
|
+
}
|
|
1062
|
+
catch {
|
|
1063
|
+
// Closing animation was cancelled - reset state
|
|
1064
|
+
PostMegadropdown.activeDropdown = this;
|
|
1065
|
+
this.addListeners();
|
|
1066
|
+
this.isVisible = true;
|
|
1067
|
+
this.postToggleMegadropdown.emit({ isVisible: true, focusParent: false });
|
|
1013
1068
|
}
|
|
1014
1069
|
}
|
|
1015
1070
|
/**
|
|
@@ -1018,63 +1073,74 @@ const PostMegadropdown = class {
|
|
|
1018
1073
|
async focusFirst() {
|
|
1019
1074
|
this.firstFocusableEl?.focus();
|
|
1020
1075
|
}
|
|
1021
|
-
breakpointChange(e) {
|
|
1022
|
-
this.device = e.detail;
|
|
1023
|
-
if (this.device === 'desktop' && this.isVisible) {
|
|
1024
|
-
this.animationClass = null;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
1076
|
/**
|
|
1028
1077
|
* Forces the dropdown to close without animation.
|
|
1029
1078
|
*/
|
|
1030
1079
|
forceClose() {
|
|
1031
|
-
this.isVisible = false;
|
|
1032
|
-
this.animationClass = null;
|
|
1033
|
-
this.postToggleMegadropdown.emit({ isVisible: this.isVisible, focusParent: false });
|
|
1034
1080
|
this.removeListeners();
|
|
1081
|
+
this.postToggleMegadropdown.emit({ isVisible: false, focusParent: false });
|
|
1082
|
+
this.isVisible = false;
|
|
1035
1083
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
this.
|
|
1040
|
-
PostMegadropdown.activeDropdown = null;
|
|
1041
|
-
this.removeListeners();
|
|
1084
|
+
// Run the respective animation
|
|
1085
|
+
createAnimation(direction) {
|
|
1086
|
+
if (this.device === 'desktop') {
|
|
1087
|
+
return fadeSlide.fadeSlide(this.animatedContainer, direction, this.fsAnimationOptions);
|
|
1042
1088
|
}
|
|
1089
|
+
return slide(this.animatedContainer, direction, {
|
|
1090
|
+
translate: 100,
|
|
1091
|
+
duration: 350,
|
|
1092
|
+
easing: direction === 'in' ? 'ease-in' : 'ease-out',
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
async animate(direction) {
|
|
1096
|
+
this.cancelAnimation();
|
|
1097
|
+
this.currentAnimation = this.createAnimation(direction);
|
|
1098
|
+
// Flag isAnimating used to avoid toggle() de-sync
|
|
1099
|
+
this.isAnimating = true;
|
|
1100
|
+
await this.currentAnimation.finished;
|
|
1101
|
+
this.isAnimating = false;
|
|
1102
|
+
this.currentAnimation = null;
|
|
1103
|
+
}
|
|
1104
|
+
cancelAnimation() {
|
|
1105
|
+
this.currentAnimation?.cancel();
|
|
1106
|
+
this.currentAnimation = null;
|
|
1107
|
+
}
|
|
1108
|
+
breakpointChange(e) {
|
|
1109
|
+
this.device = e.detail;
|
|
1110
|
+
this.cancelAnimation();
|
|
1043
1111
|
}
|
|
1044
1112
|
addListeners() {
|
|
1045
|
-
this.host.addEventListener('keydown',
|
|
1046
|
-
document.addEventListener('keyup',
|
|
1113
|
+
this.host.addEventListener('keydown', this.keyboardHandler);
|
|
1114
|
+
document.addEventListener('keyup', this.handleTabOutside);
|
|
1047
1115
|
document.addEventListener('mousedown', this.handleClickOutside);
|
|
1048
1116
|
}
|
|
1049
1117
|
removeListeners() {
|
|
1050
|
-
this.host.removeEventListener('keydown',
|
|
1051
|
-
document.removeEventListener('keyup',
|
|
1118
|
+
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
1119
|
+
document.removeEventListener('keyup', this.handleTabOutside);
|
|
1052
1120
|
document.removeEventListener('mousedown', this.handleClickOutside);
|
|
1053
1121
|
}
|
|
1054
1122
|
getFocusableElements() {
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
}
|
|
1062
|
-
this.firstFocusableEl = focusableChildren[0];
|
|
1063
|
-
this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
|
|
1123
|
+
const focusableElements = [
|
|
1124
|
+
...getFocusableChildren.getFocusableChildren(this.host),
|
|
1125
|
+
...getFocusableChildren.getFocusableChildren(this.host.shadowRoot),
|
|
1126
|
+
];
|
|
1127
|
+
this.firstFocusableEl = focusableElements[0];
|
|
1128
|
+
this.lastFocusableEl = focusableElements[focusableElements.length - 1];
|
|
1064
1129
|
}
|
|
1065
1130
|
// Loop through the focusable children
|
|
1066
1131
|
keyboardHandler(e) {
|
|
1067
|
-
if (e.key
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1132
|
+
if (e.key !== 'Tab' || this.device === 'desktop')
|
|
1133
|
+
return;
|
|
1134
|
+
const activeElement = this.host.shadowRoot.activeElement || document.activeElement;
|
|
1135
|
+
if (e.shiftKey && activeElement === this.firstFocusableEl) {
|
|
1136
|
+
// If back tab (TAB + Shift) and first element is focused, focus goes to the last element of the megadropdown
|
|
1137
|
+
e.preventDefault();
|
|
1138
|
+
this.lastFocusableEl.focus();
|
|
1139
|
+
}
|
|
1140
|
+
else if (!e.shiftKey && activeElement === this.lastFocusableEl) {
|
|
1141
|
+
// If TAB and last element is focused, focus goes back to the first element of the megadropdown
|
|
1142
|
+
e.preventDefault();
|
|
1143
|
+
this.firstFocusableEl.focus();
|
|
1078
1144
|
}
|
|
1079
1145
|
}
|
|
1080
1146
|
handleTabOutside(e) {
|
|
@@ -1105,14 +1171,8 @@ const PostMegadropdown = class {
|
|
|
1105
1171
|
*/
|
|
1106
1172
|
setTriggerActive(isActive) {
|
|
1107
1173
|
const trigger = this.megadropdownTrigger;
|
|
1108
|
-
if (
|
|
1109
|
-
|
|
1110
|
-
if (isActive) {
|
|
1111
|
-
trigger.classList.add('active');
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
trigger.classList.remove('active');
|
|
1115
|
-
}
|
|
1174
|
+
if (trigger)
|
|
1175
|
+
trigger.setAttribute('active', isActive.toString());
|
|
1116
1176
|
}
|
|
1117
1177
|
/**
|
|
1118
1178
|
* Updates the megadropdown trigger state when the megadropdown content changes.
|
|
@@ -1136,15 +1196,23 @@ const PostMegadropdown = class {
|
|
|
1136
1196
|
}
|
|
1137
1197
|
render() {
|
|
1138
1198
|
const containerStyle = this.isVisible ? {} : { display: 'none' };
|
|
1139
|
-
return (index.h(index.Host, { key: '
|
|
1199
|
+
return (index.h(index.Host, { key: '02194ee3593dd471e2fc3aadb1d69041d613ce0a', version: _package.version }, index.h("div", { key: '77ab3faeb3705ac0d97ab0d72cc3fbf12c19badc', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, index.h("div", { key: '5d8b3ef651c3eb19f08e3ccd6c9356e01463a2e0', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (index.h("p", { key: 'e99a5751ea896f3ab55dc9bf58635f7b2fef2a1c', class: "megadropdown-title" }, this.megadropdownTitle)), index.h("div", { key: 'a0a1bfa04de139d48c825df8fdb24f93e031ea66', class: "megadropdown-content" }, index.h("slot", { key: '68e44ce30fec1efed2855490b5d9af56ba41e004' })), this.device === 'desktop' ? (index.h("post-closebutton", { onClick: () => this.hide(true), class: "close-button" }, this.textClose)) : (index.h("button", { onClick: () => this.hide(true), class: "back-button" }, index.h("post-icon", { name: "arrowleft" }), this.textBack))))));
|
|
1140
1200
|
}
|
|
1141
1201
|
get host() { return index.getElement(this); }
|
|
1202
|
+
static get watchers() { return {
|
|
1203
|
+
"textClose": [{
|
|
1204
|
+
"validateTextClose": 0
|
|
1205
|
+
}],
|
|
1206
|
+
"textBack": [{
|
|
1207
|
+
"validateTextBack": 0
|
|
1208
|
+
}]
|
|
1209
|
+
}; }
|
|
1142
1210
|
};
|
|
1143
1211
|
/** Tracks the currently active dropdown instance. */
|
|
1144
1212
|
PostMegadropdown.activeDropdown = null;
|
|
1145
|
-
PostMegadropdown.style = postMegadropdownCss;
|
|
1213
|
+
PostMegadropdown.style = postMegadropdownCss();
|
|
1146
1214
|
|
|
1147
|
-
const postMegadropdownTriggerCss =
|
|
1215
|
+
const postMegadropdownTriggerCss = () => `button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:.25rem .625rem;gap:.375rem;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}button:hover{text-decoration:none}button:disabled{border-style:var(--post-core-border-style-dash)}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}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){button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){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){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(a){color:LinkText;border:unset}button:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}button:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}button:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}button: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)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg);color:var(--post-scheme-color-interactive-button-primary-enabled-fg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}button{--post-nav-item-border-width:1px;width:100%;justify-content:start;position:relative;padding:.75rem .75rem calc(.75rem - var(--post-nav-item-border-width)) .5rem;gap:1rem;border-radius:0;line-height:1.5;outline-color:currentColor !important;height:100%}button::before{content:"";background-color:#050400;position:absolute;inset-inline:0;inset-block-end:0;height:var(--post-nav-item-border-width)}button:hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}button:hover::before{background-color:rgba(0,0,0,0)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:none}button{outline-offset:calc( -2px - var(--post-device-border-width-focus) ) !important}button>post-icon:where(:last-child){margin-inline-start:auto}@media screen and (min-width: 0)and (max-width: 599.98px){button{padding:calc(.5rem + 1.5px) .75rem calc(.5rem + 1.5px - var(--post-nav-item-border-width)) .5rem;gap:.5rem;font-size:.875rem}button>post-icon{font-size:1rem}}@media screen and (min-width: 600px)and (max-width: 1023.98px){button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){button{padding:1rem .75rem;gap:.5rem}button::before{content:unset}}:host{position:relative;display:inline-block}button post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}button>span{position:relative}button>span>span[aria-hidden]{font-weight:700;visibility:hidden}button>span>span:not([aria-hidden]){position:absolute;inset:0}@media screen and (min-width: 1024px){button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){font-weight:700}}@media screen and (max-width: 1023.98px){button post-icon{margin-inline-start:auto;transform:rotate(-90deg) !important}}`;
|
|
1148
1216
|
|
|
1149
1217
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1150
1218
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1157,101 +1225,87 @@ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
1157
1225
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1158
1226
|
};
|
|
1159
1227
|
const PostMegadropdownTrigger = class {
|
|
1228
|
+
validateFor() {
|
|
1229
|
+
breakpoints.checkRequiredAndType(this, 'for', 'string');
|
|
1230
|
+
}
|
|
1160
1231
|
constructor(hostRef) {
|
|
1161
1232
|
index.registerInstance(this, hostRef);
|
|
1233
|
+
this.mutationObserver = new MutationObserver(this.cloneSlottedButton.bind(this));
|
|
1234
|
+
this.isMegadropdownExpanded = false;
|
|
1235
|
+
this.slottedContent = null;
|
|
1162
1236
|
/**
|
|
1163
|
-
*
|
|
1164
|
-
*/
|
|
1165
|
-
this.ariaExpanded = false;
|
|
1166
|
-
/**
|
|
1167
|
-
* Reference to the slotted button within the trigger, if present.
|
|
1168
|
-
* Used to manage click and key events for mega dropdown control.
|
|
1237
|
+
* Sets the trigger state to be active or inactive.
|
|
1169
1238
|
*/
|
|
1170
|
-
this.
|
|
1171
|
-
|
|
1172
|
-
* Tracks whether this trigger's dropdown was expanded before a state change.
|
|
1173
|
-
* Used to determine if this trigger should handle focus when its dropdown closes.
|
|
1174
|
-
*/
|
|
1175
|
-
this.wasExpanded = false;
|
|
1176
|
-
this.handleKeyDown = (event) => {
|
|
1177
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
1178
|
-
event.preventDefault();
|
|
1179
|
-
this.handleToggle();
|
|
1180
|
-
if (this.megadropdown && !this.ariaExpanded) {
|
|
1181
|
-
setTimeout(() => this.megadropdown.focusFirst(), 100);
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
};
|
|
1185
|
-
this.handleToggleMegadropdown = (event) => {
|
|
1186
|
-
if (event.target.id === this.for) {
|
|
1187
|
-
this.ariaExpanded = event.detail.isVisible;
|
|
1188
|
-
// Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
|
|
1189
|
-
if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
|
|
1190
|
-
setTimeout(() => {
|
|
1191
|
-
this.slottedButton?.focus();
|
|
1192
|
-
}, 100);
|
|
1193
|
-
}
|
|
1194
|
-
this.wasExpanded = this.ariaExpanded;
|
|
1195
|
-
if (this.slottedButton) {
|
|
1196
|
-
this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1239
|
+
this.active = false;
|
|
1240
|
+
this.onMegadropdownToggled = this.onMegadropdownToggled.bind(this);
|
|
1200
1241
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1242
|
+
connectedCallback() {
|
|
1243
|
+
this.mutationObserver.observe(this.host, { childList: true, subtree: true });
|
|
1244
|
+
}
|
|
1245
|
+
componentWillLoad() {
|
|
1246
|
+
this.cloneSlottedButton();
|
|
1247
|
+
}
|
|
1248
|
+
componentDidLoad() {
|
|
1249
|
+
this.validateFor();
|
|
1250
|
+
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
1251
|
+
if (environment.IS_BROWSER)
|
|
1252
|
+
document.addEventListener('postToggleMegadropdown', this.onMegadropdownToggled);
|
|
1253
|
+
}
|
|
1254
|
+
disconnectedCallback() {
|
|
1255
|
+
document.removeEventListener('postToggleMegadropdown', this.onMegadropdownToggled);
|
|
1256
|
+
}
|
|
1257
|
+
cloneSlottedButton() {
|
|
1258
|
+
this.slottedContent = this.host.innerHTML;
|
|
1207
1259
|
}
|
|
1208
1260
|
get megadropdown() {
|
|
1209
1261
|
const ref = document.getElementById(this.for);
|
|
1210
|
-
|
|
1211
|
-
? ref
|
|
1212
|
-
: null;
|
|
1213
|
-
}
|
|
1214
|
-
handleToggle() {
|
|
1215
|
-
if (this.megadropdown) {
|
|
1216
|
-
this.megadropdown.toggle();
|
|
1217
|
-
}
|
|
1218
|
-
else {
|
|
1262
|
+
if (ref?.localName !== 'post-megadropdown') {
|
|
1219
1263
|
console.warn(`No post-megadropdown found with ID: ${this.for}`);
|
|
1264
|
+
return null;
|
|
1220
1265
|
}
|
|
1266
|
+
return ref;
|
|
1221
1267
|
}
|
|
1222
|
-
|
|
1223
|
-
this.
|
|
1224
|
-
// Check if the mega dropdown attached to the trigger is expanded or not
|
|
1225
|
-
document.addEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
|
|
1226
|
-
this.slottedButton = this.host.querySelector('button');
|
|
1227
|
-
if (this.slottedButton) {
|
|
1228
|
-
this.slottedButton.setAttribute('aria-haspopup', 'menu');
|
|
1229
|
-
this.slottedButton.addEventListener('click', () => {
|
|
1230
|
-
this.handleToggle();
|
|
1231
|
-
});
|
|
1232
|
-
this.slottedButton.addEventListener('keydown', this.handleKeyDown);
|
|
1233
|
-
}
|
|
1234
|
-
else {
|
|
1235
|
-
console.warn('No button found within post-megadropdown-trigger');
|
|
1236
|
-
}
|
|
1268
|
+
onClick() {
|
|
1269
|
+
this.megadropdown?.toggle();
|
|
1237
1270
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1271
|
+
onKeyDown(event) {
|
|
1272
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
1273
|
+
return;
|
|
1274
|
+
const megadropdown = this.megadropdown;
|
|
1275
|
+
if (!megadropdown)
|
|
1276
|
+
return;
|
|
1277
|
+
event.preventDefault();
|
|
1278
|
+
this.megadropdown.toggle();
|
|
1279
|
+
}
|
|
1280
|
+
onMegadropdownToggled(event) {
|
|
1281
|
+
if (event.target.id === this.for) {
|
|
1282
|
+
const wasMegadropdownExpanded = this.isMegadropdownExpanded;
|
|
1283
|
+
this.isMegadropdownExpanded = event.detail.isVisible;
|
|
1284
|
+
const haveBeenClosed = wasMegadropdownExpanded && !this.isMegadropdownExpanded;
|
|
1285
|
+
if (!haveBeenClosed || !event.detail.focusParent)
|
|
1286
|
+
return;
|
|
1287
|
+
// Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
|
|
1288
|
+
setTimeout(() => {
|
|
1289
|
+
this.interactiveButton.focus();
|
|
1290
|
+
}, 100);
|
|
1291
|
+
}
|
|
1240
1292
|
}
|
|
1241
1293
|
render() {
|
|
1242
|
-
return (index.h(index.Host, { key: '
|
|
1294
|
+
return (index.h(index.Host, { key: 'e2fccf83b9957d929e8014bcaae51511ddbb3e8f', "data-version": _package.version }, index.h("button", { key: '1b796d6f5e3be99db7037dce808a42a7ca82cff7', ref: el => (this.interactiveButton = el), type: "button", "aria-haspopup": "menu", "aria-expanded": this.isMegadropdownExpanded.toString(), onClick: this.onClick.bind(this), onKeyDown: this.onKeyDown.bind(this), class: { active: this.active } }, index.h("span", { key: '4de2cc323cfb9d7288ca950ba20c9072cf4b9a38' }, index.h("span", { key: '64829988553f7086a8d79e15a3282d2e577bc6ba' }, index.h("slot", { key: '8e59c15428d9a201ef38419db3f502be82458462' })), index.h("span", { key: '323e643fc73b41b4dfb6ae813a3132b99e671ae6', "aria-hidden": "true", innerHTML: this.slottedContent })), index.h("post-icon", { key: '8a48e81632b6e290f6176a006e5adf5cf871ef45', name: "chevrondown" }))));
|
|
1243
1295
|
}
|
|
1244
1296
|
get host() { return index.getElement(this); }
|
|
1245
1297
|
static get watchers() { return {
|
|
1246
|
-
"for": [
|
|
1298
|
+
"for": [{
|
|
1299
|
+
"validateFor": 0
|
|
1300
|
+
}]
|
|
1247
1301
|
}; }
|
|
1248
1302
|
};
|
|
1249
1303
|
__decorate$1([
|
|
1250
1304
|
eventFrom.EventFrom('post-megadropdown', { ignoreNestedComponents: false })
|
|
1251
|
-
], PostMegadropdownTrigger.prototype, "
|
|
1252
|
-
PostMegadropdownTrigger.style = postMegadropdownTriggerCss;
|
|
1305
|
+
], PostMegadropdownTrigger.prototype, "onMegadropdownToggled", null);
|
|
1306
|
+
PostMegadropdownTrigger.style = postMegadropdownTriggerCss();
|
|
1253
1307
|
|
|
1254
|
-
const postMenuCss =
|
|
1308
|
+
const postMenuCss = () => `:host{display:block}:where([part=post-menu]){display:flex;flex-direction:column;padding-block:.5rem}::slotted([slot=header]){margin-top:-0.5rem;padding:1rem;display:flex;align-items:center;gap:.5rem;border-block-end:1px solid #050400;font-weight:700}@media screen and (max-width: 1023.98px){::slotted([slot=header]){padding:.75rem 1rem}}@media screen and (max-width: 779.98px){::slotted([slot=header]){padding:.5rem 1rem}}`;
|
|
1255
1309
|
|
|
1256
1310
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1257
1311
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1300,35 +1354,6 @@ const PostMenu = class {
|
|
|
1300
1354
|
this.controlKeyDownHandler(e);
|
|
1301
1355
|
}
|
|
1302
1356
|
};
|
|
1303
|
-
this.handlePostShown = (event) => {
|
|
1304
|
-
// Only for the first open
|
|
1305
|
-
if (event.detail.first) {
|
|
1306
|
-
// Add "menu" and "menuitem" aria roles and aria-label
|
|
1307
|
-
this.host.setAttribute('role', 'menu');
|
|
1308
|
-
const menuItems = this.getSlottedItems();
|
|
1309
|
-
for (const item of menuItems) {
|
|
1310
|
-
item.setAttribute('role', 'menuitem');
|
|
1311
|
-
}
|
|
1312
|
-
if (this.label)
|
|
1313
|
-
this.host.setAttribute('aria-label', this.label);
|
|
1314
|
-
}
|
|
1315
|
-
};
|
|
1316
|
-
this.handlePostToggled = (event) => {
|
|
1317
|
-
this.isVisible = event.detail.isOpen;
|
|
1318
|
-
this.toggleMenu.emit(this.isVisible);
|
|
1319
|
-
if (this.isVisible) {
|
|
1320
|
-
this.lastFocusedElement = this.root?.activeElement;
|
|
1321
|
-
requestAnimationFrame(() => {
|
|
1322
|
-
const menuItems = this.getSlottedItems();
|
|
1323
|
-
if (menuItems.length > 0) {
|
|
1324
|
-
menuItems[0].focus();
|
|
1325
|
-
}
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
|
-
else if (this.lastFocusedElement) {
|
|
1329
|
-
this.lastFocusedElement.focus();
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
1357
|
this.handleClick = (e) => {
|
|
1333
1358
|
const target = e.target;
|
|
1334
1359
|
if (['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA'].includes(target.tagName)) {
|
|
@@ -1337,10 +1362,10 @@ const PostMenu = class {
|
|
|
1337
1362
|
};
|
|
1338
1363
|
}
|
|
1339
1364
|
validatePlacement() {
|
|
1340
|
-
|
|
1365
|
+
breakpoints.checkEmptyOrOneOf(this, 'placement', placement.PLACEMENT_TYPES);
|
|
1341
1366
|
}
|
|
1342
1367
|
validateLabel() {
|
|
1343
|
-
|
|
1368
|
+
breakpoints.checkRequiredAndType(this, 'label', 'string');
|
|
1344
1369
|
}
|
|
1345
1370
|
connectedCallback() {
|
|
1346
1371
|
this.root = getRoot.getRoot(this.host);
|
|
@@ -1390,6 +1415,35 @@ const PostMenu = class {
|
|
|
1390
1415
|
console.error('hide: popoverRef is null or undefined');
|
|
1391
1416
|
}
|
|
1392
1417
|
}
|
|
1418
|
+
handlePostShown(event) {
|
|
1419
|
+
// Only for the first open
|
|
1420
|
+
if (event.detail.first) {
|
|
1421
|
+
// Add "menu" and "menuitem" aria roles and aria-label
|
|
1422
|
+
this.host.setAttribute('role', 'menu');
|
|
1423
|
+
const menuItems = this.getSlottedItems();
|
|
1424
|
+
for (const item of menuItems) {
|
|
1425
|
+
item.setAttribute('role', 'menuitem');
|
|
1426
|
+
}
|
|
1427
|
+
if (this.label)
|
|
1428
|
+
this.host.setAttribute('aria-label', this.label);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
handlePostBeforeToggle(event) {
|
|
1432
|
+
this.isVisible = event.detail.willOpen;
|
|
1433
|
+
this.toggleMenu.emit(this.isVisible);
|
|
1434
|
+
if (this.isVisible) {
|
|
1435
|
+
this.lastFocusedElement = this.root?.activeElement;
|
|
1436
|
+
requestAnimationFrame(() => {
|
|
1437
|
+
const menuItems = this.getSlottedItems();
|
|
1438
|
+
if (menuItems.length > 0) {
|
|
1439
|
+
menuItems[0].focus();
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
else if (this.lastFocusedElement) {
|
|
1444
|
+
this.lastFocusedElement.focus();
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1393
1447
|
controlKeyDownHandler(e) {
|
|
1394
1448
|
const menuItems = this.getSlottedItems();
|
|
1395
1449
|
if (!menuItems.length) {
|
|
@@ -1437,23 +1491,27 @@ const PostMenu = class {
|
|
|
1437
1491
|
.flatMap(el => Array.from(getFocusableChildren.getFocusableChildren(el))));
|
|
1438
1492
|
}
|
|
1439
1493
|
render() {
|
|
1440
|
-
return (index.h(index.Host, { key: '
|
|
1494
|
+
return (index.h(index.Host, { key: 'b8eed085445b840a741ee5115c10ef4e9b3fb387', "data-version": _package.version }, index.h("post-popovercontainer", { key: '4d885d0d4a23c5b29312588bccdc0cbbf7e3da23', onPostShow: this.handlePostShown.bind(this), onPostBeforeToggle: this.handlePostBeforeToggle.bind(this), placement: this.placement, ref: e => (this.popoverRef = e) }, index.h("div", { key: '69ed7ce44051026ca85f6a6cd25aeb1f2ef56a3c', part: "post-menu" }, index.h("slot", { key: '431d56f067986a0eded7b15c6dbc4ab0662a5b86', name: "header" }), index.h("slot", { key: '3b906c3a19cce7372de493b5dfe90d1587925a2c' })))));
|
|
1441
1495
|
}
|
|
1442
1496
|
get host() { return index.getElement(this); }
|
|
1443
1497
|
static get watchers() { return {
|
|
1444
|
-
"placement": [
|
|
1445
|
-
|
|
1498
|
+
"placement": [{
|
|
1499
|
+
"validatePlacement": 0
|
|
1500
|
+
}],
|
|
1501
|
+
"label": [{
|
|
1502
|
+
"validateLabel": 0
|
|
1503
|
+
}]
|
|
1446
1504
|
}; }
|
|
1447
1505
|
};
|
|
1448
1506
|
__decorate([
|
|
1449
1507
|
eventFrom.EventFrom('post-popovercontainer')
|
|
1450
|
-
], PostMenu.prototype, "handlePostShown",
|
|
1508
|
+
], PostMenu.prototype, "handlePostShown", null);
|
|
1451
1509
|
__decorate([
|
|
1452
1510
|
eventFrom.EventFrom('post-popovercontainer')
|
|
1453
|
-
], PostMenu.prototype, "
|
|
1454
|
-
PostMenu.style = postMenuCss;
|
|
1511
|
+
], PostMenu.prototype, "handlePostBeforeToggle", null);
|
|
1512
|
+
PostMenu.style = postMenuCss();
|
|
1455
1513
|
|
|
1456
|
-
const postMenuTriggerCss =
|
|
1514
|
+
const postMenuTriggerCss = () => `:host{display:inline-block}`;
|
|
1457
1515
|
|
|
1458
1516
|
const PostMenuTrigger = class {
|
|
1459
1517
|
constructor(hostRef) {
|
|
@@ -1479,7 +1537,7 @@ const PostMenuTrigger = class {
|
|
|
1479
1537
|
* @param forValue - The new value of the `for` property.
|
|
1480
1538
|
*/
|
|
1481
1539
|
validateControlFor() {
|
|
1482
|
-
|
|
1540
|
+
breakpoints.checkRequiredAndType(this, 'for', 'string');
|
|
1483
1541
|
}
|
|
1484
1542
|
get menu() {
|
|
1485
1543
|
const ref = this.root.getElementById(this.for);
|
|
@@ -1528,14 +1586,16 @@ const PostMenuTrigger = class {
|
|
|
1528
1586
|
}
|
|
1529
1587
|
}
|
|
1530
1588
|
render() {
|
|
1531
|
-
return (index.h(index.Host, { key: '
|
|
1589
|
+
return (index.h(index.Host, { key: '13701a50f739c2252ab296e13c657e1d4c51444b', "data-version": _package.version, "tab-index": "-1" }, index.h("slot", { key: 'dc5fd68d917d3cfe2a9703553b1fba4047770260' })));
|
|
1532
1590
|
}
|
|
1533
1591
|
get host() { return index.getElement(this); }
|
|
1534
1592
|
static get watchers() { return {
|
|
1535
|
-
"for": [
|
|
1593
|
+
"for": [{
|
|
1594
|
+
"validateControlFor": 0
|
|
1595
|
+
}]
|
|
1536
1596
|
}; }
|
|
1537
1597
|
};
|
|
1538
|
-
PostMenuTrigger.style = postMenuTriggerCss;
|
|
1598
|
+
PostMenuTrigger.style = postMenuTriggerCss();
|
|
1539
1599
|
|
|
1540
1600
|
/**
|
|
1541
1601
|
* Custom positioning reference element.
|
|
@@ -4258,8 +4318,11 @@ function popIn(el) {
|
|
|
4258
4318
|
});
|
|
4259
4319
|
}
|
|
4260
4320
|
|
|
4261
|
-
const postPopovercontainerCss =
|
|
4321
|
+
const postPopovercontainerCss = () => `@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:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer)>div{border:2px solid rgba(0,0,0,0)}}: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):not(:has(.arrow))>div{box-shadow:var(--post-device-elevation-300)}: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{--arrow-size: 0.5825rem;position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow[dynamic-placement=top]{border-bottom-right-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=right]{border-bottom-left-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=bottom]{border-top-left-radius:2px}:where(post-popovercontainer) .arrow[dynamic-placement=left]{border-top-right-radius:2px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:where(post-popovercontainer) .arrow[dynamic-placement=top]{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);bottom:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=left]{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);right:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=right]{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);left:-0.3796735336rem !important}:where(post-popovercontainer) .arrow[dynamic-placement=bottom]{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);top:-0.3796735336rem !important}}`;
|
|
4262
4322
|
|
|
4323
|
+
const ANIMATIONS = {
|
|
4324
|
+
'pop-in': popIn,
|
|
4325
|
+
};
|
|
4263
4326
|
const PostPopovercontainer = class {
|
|
4264
4327
|
constructor(hostRef) {
|
|
4265
4328
|
index.registerInstance(this, hostRef);
|
|
@@ -4279,28 +4342,24 @@ const PostPopovercontainer = class {
|
|
|
4279
4342
|
* Gap between the edge of the page and the popovercontainer
|
|
4280
4343
|
*/
|
|
4281
4344
|
this.edgeGap = 8;
|
|
4282
|
-
/**
|
|
4283
|
-
* Animation style
|
|
4284
|
-
*/
|
|
4285
|
-
this.animation = null;
|
|
4286
4345
|
/**
|
|
4287
4346
|
* Whether or not to display a little pointer arrow
|
|
4288
4347
|
*/
|
|
4289
4348
|
this.arrow = false;
|
|
4290
4349
|
/**
|
|
4291
|
-
*
|
|
4350
|
+
* Animation style
|
|
4292
4351
|
*/
|
|
4293
|
-
this.
|
|
4352
|
+
this.animation = 'pop-in';
|
|
4294
4353
|
this.currentAnimation = null;
|
|
4295
4354
|
}
|
|
4296
4355
|
validatePlacement() {
|
|
4297
|
-
|
|
4356
|
+
breakpoints.checkEmptyOrOneOf(this, 'placement', placement.PLACEMENT_TYPES);
|
|
4298
4357
|
}
|
|
4299
4358
|
validateEdgeGap() {
|
|
4300
|
-
|
|
4359
|
+
breakpoints.checkEmptyOrType(this, 'edgeGap', 'number');
|
|
4301
4360
|
}
|
|
4302
4361
|
validateSafeSpace() {
|
|
4303
|
-
|
|
4362
|
+
breakpoints.checkEmptyOrOneOf(this, 'safeSpace', ['triangle', 'trapezoid']);
|
|
4304
4363
|
}
|
|
4305
4364
|
/**
|
|
4306
4365
|
* Updates cursor position for safe space feature when popover is open.
|
|
@@ -4312,11 +4371,14 @@ const PostPopovercontainer = class {
|
|
|
4312
4371
|
this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
|
|
4313
4372
|
}
|
|
4314
4373
|
connectedCallback() {
|
|
4315
|
-
if (
|
|
4374
|
+
if (environment.IS_BROWSER && !isSupported()) {
|
|
4316
4375
|
apply();
|
|
4317
4376
|
}
|
|
4318
4377
|
}
|
|
4319
4378
|
componentDidLoad() {
|
|
4379
|
+
this.validatePlacement();
|
|
4380
|
+
this.validateEdgeGap();
|
|
4381
|
+
this.validateSafeSpace();
|
|
4320
4382
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
4321
4383
|
}
|
|
4322
4384
|
disconnectedCallback() {
|
|
@@ -4327,7 +4389,7 @@ const PostPopovercontainer = class {
|
|
|
4327
4389
|
}
|
|
4328
4390
|
/**
|
|
4329
4391
|
* Programmatically display the popovercontainer
|
|
4330
|
-
* @param target A focusable element inside the
|
|
4392
|
+
* @param target A focusable element inside the trigger component that controls the popover
|
|
4331
4393
|
*/
|
|
4332
4394
|
async show(target) {
|
|
4333
4395
|
if (this.toggleTimeoutId)
|
|
@@ -4336,15 +4398,44 @@ const PostPopovercontainer = class {
|
|
|
4336
4398
|
this.calculatePosition();
|
|
4337
4399
|
this.host.showPopover();
|
|
4338
4400
|
}
|
|
4401
|
+
/**
|
|
4402
|
+
* Programmatically hide the popovercontainer
|
|
4403
|
+
*/
|
|
4404
|
+
async hide() {
|
|
4405
|
+
if (!this.toggleTimeoutId) {
|
|
4406
|
+
this.eventTarget = null;
|
|
4407
|
+
this.host.hidePopover();
|
|
4408
|
+
this.postHide.emit();
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
/**
|
|
4412
|
+
* Toggle popovercontainer display
|
|
4413
|
+
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
4414
|
+
* @param force Pass true to always show or false to always hide
|
|
4415
|
+
*/
|
|
4416
|
+
async toggle(target, force) {
|
|
4417
|
+
this.eventTarget = target;
|
|
4418
|
+
// Prevent instant double toggle
|
|
4419
|
+
if (!this.toggleTimeoutId) {
|
|
4420
|
+
this.calculatePosition();
|
|
4421
|
+
this.host.togglePopover(force);
|
|
4422
|
+
this.toggleTimeoutId = null;
|
|
4423
|
+
}
|
|
4424
|
+
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
4425
|
+
}
|
|
4339
4426
|
/**
|
|
4340
4427
|
* Handles the popover opening process and emits related events.
|
|
4341
4428
|
*/
|
|
4342
|
-
|
|
4429
|
+
open() {
|
|
4343
4430
|
const content = this.host.querySelector('.popover-content');
|
|
4344
4431
|
this.startAutoupdates();
|
|
4345
4432
|
if (content) {
|
|
4346
|
-
|
|
4347
|
-
|
|
4433
|
+
const animationFn = ANIMATIONS[this.animation];
|
|
4434
|
+
// Only run the animation if it corresponds to a valid, registered animation function
|
|
4435
|
+
if (typeof animationFn === 'function') {
|
|
4436
|
+
this.runOpenAnimation(animationFn, content);
|
|
4437
|
+
}
|
|
4438
|
+
else {
|
|
4348
4439
|
// No animation case
|
|
4349
4440
|
this.postBeforeToggle.emit({ willOpen: true });
|
|
4350
4441
|
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
@@ -4353,9 +4444,6 @@ const PostPopovercontainer = class {
|
|
|
4353
4444
|
if (this.hasOpenedOnce)
|
|
4354
4445
|
this.hasOpenedOnce = false;
|
|
4355
4446
|
}
|
|
4356
|
-
else {
|
|
4357
|
-
this.runOpenAnimation(content);
|
|
4358
|
-
}
|
|
4359
4447
|
}
|
|
4360
4448
|
if (this.safeSpace) {
|
|
4361
4449
|
window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
@@ -4364,7 +4452,7 @@ const PostPopovercontainer = class {
|
|
|
4364
4452
|
/**
|
|
4365
4453
|
* Handles the popover closing process and emits related events.
|
|
4366
4454
|
*/
|
|
4367
|
-
|
|
4455
|
+
close() {
|
|
4368
4456
|
if (typeof this.clearAutoUpdate === 'function') {
|
|
4369
4457
|
this.clearAutoUpdate();
|
|
4370
4458
|
}
|
|
@@ -4372,7 +4460,7 @@ const PostPopovercontainer = class {
|
|
|
4372
4460
|
window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
4373
4461
|
}
|
|
4374
4462
|
// Cancel any running animation
|
|
4375
|
-
if (this.
|
|
4463
|
+
if (this.currentAnimation) {
|
|
4376
4464
|
this.currentAnimation.cancel();
|
|
4377
4465
|
this.currentAnimation = null;
|
|
4378
4466
|
}
|
|
@@ -4383,10 +4471,18 @@ const PostPopovercontainer = class {
|
|
|
4383
4471
|
/**
|
|
4384
4472
|
* Runs the animation and emits the toggle/show/hide events in the correct timing
|
|
4385
4473
|
*/
|
|
4386
|
-
async runOpenAnimation(element) {
|
|
4474
|
+
async runOpenAnimation(animationFn, element) {
|
|
4387
4475
|
let animation;
|
|
4388
4476
|
try {
|
|
4389
|
-
animation =
|
|
4477
|
+
animation = animationFn(element);
|
|
4478
|
+
if (!animation) {
|
|
4479
|
+
// Fallback: no animation, just emit open events directly
|
|
4480
|
+
this.postBeforeToggle.emit({ willOpen: true });
|
|
4481
|
+
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
4482
|
+
this.postToggle.emit({ isOpen: true });
|
|
4483
|
+
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
4484
|
+
return;
|
|
4485
|
+
}
|
|
4390
4486
|
this.currentAnimation = animation;
|
|
4391
4487
|
if (animation.playState === 'running') {
|
|
4392
4488
|
this.postBeforeToggle.emit({ willOpen: true });
|
|
@@ -4410,31 +4506,6 @@ const PostPopovercontainer = class {
|
|
|
4410
4506
|
}
|
|
4411
4507
|
}
|
|
4412
4508
|
}
|
|
4413
|
-
/**
|
|
4414
|
-
* Programmatically hide the popovercontainer
|
|
4415
|
-
*/
|
|
4416
|
-
async hide() {
|
|
4417
|
-
if (!this.toggleTimeoutId) {
|
|
4418
|
-
this.eventTarget = null;
|
|
4419
|
-
this.host.hidePopover();
|
|
4420
|
-
this.postHide.emit();
|
|
4421
|
-
}
|
|
4422
|
-
}
|
|
4423
|
-
/**
|
|
4424
|
-
* Toggle popovercontainer display
|
|
4425
|
-
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
4426
|
-
* @param force Pass true to always show or false to always hide
|
|
4427
|
-
*/
|
|
4428
|
-
async toggle(target, force) {
|
|
4429
|
-
this.eventTarget = target;
|
|
4430
|
-
// Prevent instant double toggle
|
|
4431
|
-
if (!this.toggleTimeoutId) {
|
|
4432
|
-
this.calculatePosition();
|
|
4433
|
-
this.host.togglePopover(force);
|
|
4434
|
-
this.toggleTimeoutId = null;
|
|
4435
|
-
}
|
|
4436
|
-
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
4437
|
-
}
|
|
4438
4509
|
/**
|
|
4439
4510
|
* Start or stop auto updates based on popovercontainer events.
|
|
4440
4511
|
* Popovercontainers can be closed or opened with other methods than class members,
|
|
@@ -4456,6 +4527,8 @@ const PostPopovercontainer = class {
|
|
|
4456
4527
|
* an influence on popovercontainer positioning
|
|
4457
4528
|
*/
|
|
4458
4529
|
startAutoupdates() {
|
|
4530
|
+
if (!this.eventTarget || !this.host)
|
|
4531
|
+
return;
|
|
4459
4532
|
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
4460
4533
|
}
|
|
4461
4534
|
/**
|
|
@@ -4468,6 +4541,7 @@ const PostPopovercontainer = class {
|
|
|
4468
4541
|
async calculatePosition() {
|
|
4469
4542
|
const { x, y, middlewareData, placement } = await this.computeMainPosition();
|
|
4470
4543
|
const currentPlacement = placement.split('-')[0];
|
|
4544
|
+
this.dynamicPlacement = currentPlacement;
|
|
4471
4545
|
// Position popover
|
|
4472
4546
|
this.host.style.left = `${x}px`;
|
|
4473
4547
|
this.host.style.top = `${y}px`;
|
|
@@ -4475,11 +4549,20 @@ const PostPopovercontainer = class {
|
|
|
4475
4549
|
if (this.arrow && middlewareData.arrow) {
|
|
4476
4550
|
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
4477
4551
|
const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
|
|
4552
|
+
const rootFontSize = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
4553
|
+
// Calculate dynamically the half side which provides the static side offset
|
|
4554
|
+
const arrowSizeValue = getComputedStyle(this.arrowRef)
|
|
4555
|
+
.getPropertyValue('--arrow-size')
|
|
4556
|
+
.trim();
|
|
4557
|
+
const arrowSizePx = arrowSizeValue.endsWith('rem')
|
|
4558
|
+
? Number.parseFloat(arrowSizeValue) * rootFontSize
|
|
4559
|
+
: Number.parseFloat(arrowSizeValue);
|
|
4560
|
+
const halfSide = -0.5 * arrowSizePx;
|
|
4478
4561
|
if (staticSide) {
|
|
4479
4562
|
Object.assign(this.arrowRef.style, {
|
|
4480
4563
|
left: arrowX ? `${arrowX}px` : '',
|
|
4481
4564
|
top: arrowY ? `${arrowY}px` : '',
|
|
4482
|
-
[staticSide]:
|
|
4565
|
+
[staticSide]: `${halfSide}px`,
|
|
4483
4566
|
});
|
|
4484
4567
|
}
|
|
4485
4568
|
}
|
|
@@ -4580,15 +4663,21 @@ const PostPopovercontainer = class {
|
|
|
4580
4663
|
}
|
|
4581
4664
|
}
|
|
4582
4665
|
render() {
|
|
4583
|
-
return (index.h(index.Host, { key: '
|
|
4666
|
+
return (index.h(index.Host, { key: 'f675b14ed97d7f2931781549df8aafd9072faa96', "data-version": _package.version, popover: "auto" }, index.h("div", { key: 'f66186a7448f60b9f9dcb1b3cbe047a74a85dc7b', class: "popover-content" }, this.arrow && (index.h("span", { key: 'd0f8f2baa005522140ac1ef49a0bccc13be72c72', "dynamic-placement": this.dynamicPlacement, class: "arrow", ref: el => {
|
|
4584
4667
|
this.arrowRef = el;
|
|
4585
|
-
} })), index.h("slot", { key: '
|
|
4668
|
+
} })), index.h("slot", { key: '5fbdad6fa76951f4d886ef0ab57e7471ac38c59d' }))));
|
|
4586
4669
|
}
|
|
4587
4670
|
get host() { return index.getElement(this); }
|
|
4588
4671
|
static get watchers() { return {
|
|
4589
|
-
"placement": [
|
|
4590
|
-
|
|
4591
|
-
|
|
4672
|
+
"placement": [{
|
|
4673
|
+
"validatePlacement": 0
|
|
4674
|
+
}],
|
|
4675
|
+
"edgeGap": [{
|
|
4676
|
+
"validateEdgeGap": 0
|
|
4677
|
+
}],
|
|
4678
|
+
"safeSpace": [{
|
|
4679
|
+
"validateSafeSpace": 0
|
|
4680
|
+
}]
|
|
4592
4681
|
}; }
|
|
4593
4682
|
};
|
|
4594
4683
|
PostPopovercontainer.STATIC_SIDES = {
|
|
@@ -4611,9 +4700,9 @@ PostPopovercontainer.PROPERTIES_TO_CLEAR = [
|
|
|
4611
4700
|
'--post-safe-space-trigger-y-start',
|
|
4612
4701
|
'--post-safe-space-trigger-y-end',
|
|
4613
4702
|
];
|
|
4614
|
-
PostPopovercontainer.style = postPopovercontainerCss;
|
|
4703
|
+
PostPopovercontainer.style = postPopovercontainerCss();
|
|
4615
4704
|
|
|
4616
|
-
const postTogglebuttonCss =
|
|
4705
|
+
const postTogglebuttonCss = () => `:host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}`;
|
|
4617
4706
|
|
|
4618
4707
|
const PostTogglebutton = class {
|
|
4619
4708
|
constructor(hostRef) {
|
|
@@ -4639,19 +4728,17 @@ const PostTogglebutton = class {
|
|
|
4639
4728
|
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
4640
4729
|
}
|
|
4641
4730
|
render() {
|
|
4642
|
-
return (index.h(index.Host, { key: '
|
|
4731
|
+
return (index.h(index.Host, { key: 'e0708bda008257aeab8e9ad82c33c66eff4aedb6', "data-version": _package.version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, index.h("slot", { key: 'a10862573155edbef1a88bd8a1f9f8abf9dbe4c0' })));
|
|
4643
4732
|
}
|
|
4644
4733
|
get host() { return index.getElement(this); }
|
|
4645
4734
|
};
|
|
4646
|
-
PostTogglebutton.style = postTogglebuttonCss;
|
|
4735
|
+
PostTogglebutton.style = postTogglebuttonCss();
|
|
4647
4736
|
|
|
4648
4737
|
exports.post_closebutton = PostClosebutton;
|
|
4649
4738
|
exports.post_header = PostHeader;
|
|
4650
4739
|
exports.post_icon = PostIcon;
|
|
4651
|
-
exports.
|
|
4652
|
-
exports.
|
|
4653
|
-
exports.post_list = PostList;
|
|
4654
|
-
exports.post_list_item = PostListItem;
|
|
4740
|
+
exports.post_language_menu = PostLanguageMenu;
|
|
4741
|
+
exports.post_language_menu_item = PostLanguageMenuItem;
|
|
4655
4742
|
exports.post_logo = PostLogo;
|
|
4656
4743
|
exports.post_mainnavigation = PostMainnavigation;
|
|
4657
4744
|
exports.post_megadropdown = PostMegadropdown;
|