@swisspost/design-system-components 9.0.0-next.3 → 9.0.0-next.31
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/.config/bindings.angular.js +4 -0
- package/dist/cjs/{attribute-observer-10f08c04.js → attribute-observer-6d8b886b.js} +4 -4
- package/dist/cjs/breakpoints-c6247c71.js +54 -0
- package/dist/cjs/check-non-empty-bd99d236.js +15 -0
- package/dist/cjs/check-one-of-75d270b5.js +13 -0
- package/dist/cjs/check-type-cdbf6d29.js +21 -0
- package/dist/cjs/check-url-220a286c.js +19 -0
- package/dist/cjs/debounce-158fd76f.js +13 -0
- package/dist/cjs/fade-72d5ef55.js +14 -0
- package/dist/cjs/get-root-7a3498ef.js +11 -0
- package/dist/cjs/index-23e36ff7.js +37 -0
- package/dist/cjs/{index-e1f32cce.js → index-d6bf2c66.js} +30 -18
- package/dist/cjs/index.browser-2f65f583.js +15 -0
- package/dist/cjs/index.cjs.js +56 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-ef26e62c.js → package-a1fbac54.js} +1 -1
- package/dist/cjs/{post-accordion-3878bf43.js → post-accordion-b9b8560b.js} +9 -8
- package/dist/cjs/post-accordion-item-0901683a.js +64 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +8 -5
- package/dist/cjs/post-accordion.cjs.entry.js +4 -4
- package/dist/cjs/{post-avatar-2bcfc016.js → post-avatar-cfdfe811.js} +10 -14
- package/dist/cjs/post-avatar.cjs.entry.js +4 -4
- package/dist/cjs/post-back-to-top-6f1e9011.js +76 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
- package/dist/cjs/post-banner-404dc94a.js +96 -0
- package/dist/cjs/post-banner.cjs.entry.js +19 -0
- package/dist/cjs/post-breadcrumb-c21c84f4.js +112 -0
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
- package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-a6318276.js +283 -0
- package/dist/cjs/post-card-control.cjs.entry.js +5 -5
- package/dist/cjs/post-closebutton_15.cjs.entry.js +35 -0
- package/dist/cjs/{post-collapsible-trigger-6ae59c64.js → post-collapsible-trigger-be86fb6c.js} +50 -56
- package/dist/cjs/post-collapsible_2.cjs.entry.js +10 -6
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer-b2d22ab2.js +38 -0
- package/dist/cjs/post-footer.cjs.entry.js +12 -0
- package/dist/cjs/post-linkarea-32b1ad0e.js +30 -0
- package/dist/cjs/post-linkarea.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-de3b5248.js +68 -0
- package/dist/cjs/post-popover-18867edc.js +110 -0
- package/dist/cjs/post-popover.cjs.entry.js +4 -4
- package/dist/cjs/{post-rating-1d2c59b7.js → post-rating-af90656e.js} +16 -6
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-0204f3de.js +33 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +5 -4
- package/dist/cjs/{post-tab-panel-80b1f3ee.js → post-tab-panel-72bc27b9.js} +6 -5
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
- package/dist/cjs/{post-tabs-c2d42035.js → post-tabs-fa187aec.js} +23 -16
- package/dist/cjs/post-tabs.cjs.entry.js +4 -4
- package/dist/cjs/post-tag-bbc449d9.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/post-togglebutton-b9e25ee3.js +3963 -0
- package/dist/cjs/{post-tooltip-9a120b2e.js → post-tooltip-41fd9477.js} +38 -25
- package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
- package/dist/cjs/slide-cd1f09b3.js +28 -0
- package/dist/collection/animations/collapse.js +5 -5
- package/dist/collection/animations/fade.js +6 -2
- package/dist/collection/animations/slide.js +23 -0
- package/dist/collection/collection-manifest.json +20 -3
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +5 -3
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +26 -9
- package/dist/collection/components/post-avatar/post-avatar.js +8 -11
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +109 -0
- package/dist/collection/components/post-banner/banner-types.js +1 -0
- package/dist/collection/components/post-banner/post-banner.css +3 -0
- package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +50 -72
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +163 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +98 -0
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +55 -43
- package/dist/collection/components/post-closebutton/post-closebutton.js +13 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +15 -6
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +21 -20
- package/dist/collection/components/post-footer/post-footer.css +1 -0
- package/dist/collection/components/post-footer/post-footer.js +76 -0
- package/dist/collection/components/post-header/post-header.css +1 -0
- package/dist/collection/components/post-header/post-header.js +323 -0
- package/dist/collection/components/post-icon/post-icon.js +79 -46
- package/dist/collection/components/post-language-option/post-language-option.css +1 -1
- package/dist/collection/components/post-language-option/post-language-option.js +65 -10
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
- package/dist/collection/components/post-language-switch/post-language-switch.js +192 -0
- package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -0
- package/dist/collection/components/post-linkarea/post-linkarea.js +30 -0
- package/dist/collection/components/post-list/post-list.css +3 -0
- package/dist/collection/components/post-list/post-list.js +90 -0
- package/dist/collection/components/post-list-item/post-list-item.css +1 -0
- package/dist/collection/components/post-list-item/post-list-item.js +27 -0
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-logo/post-logo.js +3 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +268 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +285 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +127 -0
- package/dist/collection/components/post-menu/post-menu.css +3 -0
- package/dist/collection/components/post-menu/post-menu.js +295 -0
- package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +122 -0
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +14 -7
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +203 -39
- package/dist/collection/components/post-rating/post-rating.css +1 -1
- package/dist/collection/components/post-rating/post-rating.js +13 -2
- package/dist/collection/components/post-tab-header/post-tab-header.css +2 -2
- package/dist/collection/components/post-tab-header/post-tab-header.js +6 -4
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +4 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +17 -14
- package/dist/collection/components/post-tag/post-tag.css +1 -1
- package/dist/collection/components/post-tag/post-tag.js +3 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +75 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +35 -17
- package/dist/collection/index.js +19 -2
- package/dist/collection/utils/attribute-observer.js +4 -4
- package/dist/collection/utils/breakpoints.js +50 -0
- package/dist/collection/utils/component-on-ready.js +4 -4
- package/dist/collection/utils/debounce.js +2 -1
- package/dist/collection/utils/get-focusable-children.js +33 -0
- package/dist/collection/utils/property-checkers/check-non-empty.js +6 -2
- package/dist/collection/utils/property-checkers/check-one-of.js +8 -3
- package/dist/collection/utils/property-checkers/check-pattern.js +8 -3
- package/dist/collection/utils/property-checkers/check-type.js +11 -6
- package/dist/collection/utils/property-checkers/check-url.js +11 -6
- package/dist/collection/utils/property-checkers/empty-or.js +5 -2
- package/dist/collection/utils/sass-export.js +8 -5
- package/dist/components/attribute-observer.js +4 -4
- package/dist/components/breakpoints.js +52 -0
- package/dist/components/check-non-empty.js +6 -2
- package/dist/components/check-one-of.js +8 -3
- package/dist/components/check-type.js +11 -6
- package/dist/components/debounce.js +11 -0
- package/dist/components/fade.js +6 -2
- package/dist/components/get-focusable-children.js +35 -0
- package/dist/components/get-root.js +9 -0
- package/dist/components/index.browser.js +13 -0
- package/dist/components/index.js +19 -2
- package/dist/components/index2.js +25 -12
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +33 -14
- package/dist/components/post-accordion2.js +6 -5
- package/dist/components/post-avatar2.js +7 -11
- package/dist/components/post-back-to-top.d.ts +11 -0
- package/dist/components/post-back-to-top.js +6 -0
- package/dist/components/post-back-to-top2.js +101 -0
- package/dist/components/post-banner.d.ts +11 -0
- package/dist/components/post-banner.js +6 -0
- package/dist/components/post-banner2.js +131 -0
- package/dist/components/post-breadcrumb-item.d.ts +11 -0
- package/dist/components/post-breadcrumb-item.js +6 -0
- package/dist/components/post-breadcrumb-item2.js +82 -0
- package/dist/components/post-breadcrumb.d.ts +11 -0
- package/dist/components/post-breadcrumb.js +6 -0
- package/dist/components/post-breadcrumb2.js +169 -0
- package/dist/components/post-card-control2.js +50 -39
- package/dist/components/post-closebutton.d.ts +11 -0
- package/dist/components/post-closebutton.js +6 -0
- package/dist/components/post-closebutton2.js +34 -0
- package/dist/components/post-collapsible-trigger2.js +23 -38
- package/dist/components/post-collapsible2.js +22 -14
- package/dist/components/post-footer.d.ts +11 -0
- package/dist/components/post-footer.js +6 -0
- package/dist/components/post-footer2.js +78 -0
- package/dist/components/post-header.d.ts +11 -0
- package/dist/components/post-header.js +6 -0
- package/dist/components/post-header2.js +401 -0
- package/dist/components/post-icon2.js +81 -45
- package/dist/components/post-language-option2.js +32 -14
- package/dist/components/post-language-switch.d.ts +11 -0
- package/dist/components/post-language-switch.js +6 -0
- package/dist/components/post-language-switch2.js +148 -0
- package/dist/components/post-linkarea.d.ts +11 -0
- package/dist/components/post-linkarea.js +6 -0
- package/dist/components/post-linkarea2.js +42 -0
- package/dist/components/post-list-item.d.ts +11 -0
- package/dist/components/post-list-item.js +6 -0
- package/dist/components/post-list-item2.js +36 -0
- package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/dist/components/post-list.js +6 -0
- package/dist/components/post-list2.js +55 -0
- package/dist/components/post-logo2.js +4 -4
- package/dist/components/post-mainnavigation.d.ts +11 -0
- package/dist/components/post-mainnavigation.js +6 -0
- package/dist/components/post-mainnavigation2.js +271 -0
- package/dist/components/post-megadropdown-trigger.d.ts +11 -0
- package/dist/components/post-megadropdown-trigger.js +6 -0
- package/dist/components/post-megadropdown-trigger2.js +113 -0
- package/dist/components/post-megadropdown.d.ts +11 -0
- package/dist/components/post-megadropdown.js +6 -0
- package/dist/components/post-megadropdown2.js +199 -0
- package/dist/components/post-menu-item.d.ts +11 -0
- package/dist/components/post-menu-item.js +6 -0
- package/dist/components/post-menu-item2.js +27 -0
- package/dist/components/post-menu-trigger.d.ts +11 -0
- package/dist/components/post-menu-trigger.js +6 -0
- package/dist/components/post-menu-trigger2.js +109 -0
- package/dist/components/post-menu.d.ts +11 -0
- package/dist/components/post-menu.js +6 -0
- package/dist/components/post-menu2.js +191 -0
- package/dist/components/post-popover2.js +14 -8
- package/dist/components/post-popovercontainer2.js +249 -72
- package/dist/components/post-rating2.js +14 -4
- package/dist/components/post-tab-header2.js +7 -6
- package/dist/components/post-tab-panel2.js +4 -3
- package/dist/components/post-tabs2.js +20 -13
- package/dist/components/post-tag2.js +3 -3
- package/dist/components/post-togglebutton.d.ts +11 -0
- package/dist/components/post-togglebutton.js +6 -0
- package/dist/components/post-togglebutton2.js +61 -0
- package/dist/components/post-tooltip2.js +35 -22
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +1653 -186
- package/dist/esm/{attribute-observer-37fa950a.js → attribute-observer-2f203993.js} +4 -4
- package/dist/esm/breakpoints-bbe0c54e.js +52 -0
- package/dist/esm/check-non-empty-258a56b3.js +13 -0
- package/dist/esm/check-one-of-0bee20f5.js +11 -0
- package/dist/esm/check-type-37d5d307.js +19 -0
- package/dist/esm/check-url-17962bc8.js +17 -0
- package/dist/esm/debounce-e54c7131.js +11 -0
- package/dist/esm/fade-1f3cacf4.js +11 -0
- package/dist/esm/get-root-7af2e0d1.js +9 -0
- package/dist/esm/{index-e1b64755.js → index-3419e46d.js} +30 -18
- package/dist/esm/index-8f8fe5b0.js +32 -0
- package/dist/esm/index.browser-51485f85.js +13 -0
- package/dist/esm/index.js +33 -24
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-8a1c1ec5.js +3 -0
- package/dist/esm/{post-accordion-01d49d83.js → post-accordion-3cfa5952.js} +9 -8
- package/dist/esm/post-accordion-item-3c760745.js +62 -0
- package/dist/esm/post-accordion-item.entry.js +8 -5
- package/dist/esm/post-accordion.entry.js +4 -4
- package/dist/esm/{post-avatar-6f24d1ab.js → post-avatar-ea5b904a.js} +10 -14
- package/dist/esm/post-avatar.entry.js +4 -4
- package/dist/esm/post-back-to-top-472452ca.js +74 -0
- package/dist/esm/post-back-to-top.entry.js +7 -0
- package/dist/esm/post-banner-a55185e3.js +94 -0
- package/dist/esm/post-banner.entry.js +11 -0
- package/dist/esm/post-breadcrumb-53aebbe1.js +110 -0
- package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
- package/dist/esm/post-breadcrumb.entry.js +5 -0
- package/dist/esm/post-card-control-667d0db8.js +281 -0
- package/dist/esm/post-card-control.entry.js +5 -5
- package/dist/esm/post-closebutton_15.entry.js +13 -0
- package/dist/esm/{post-collapsible-trigger-654bf2b0.js → post-collapsible-trigger-a8dae8e5.js} +49 -55
- package/dist/esm/post-collapsible_2.entry.js +10 -6
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer-72fa9233.js +36 -0
- package/dist/esm/post-footer.entry.js +4 -0
- package/dist/esm/post-linkarea-ec7139a7.js +28 -0
- package/dist/esm/post-linkarea.entry.js +3 -0
- package/dist/esm/post-menu-item-663b69ea.js +65 -0
- package/dist/esm/post-popover-33b11e03.js +108 -0
- package/dist/esm/post-popover.entry.js +4 -4
- package/dist/esm/{post-rating-3cd3e97b.js → post-rating-4b878fdb.js} +16 -6
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-cc1a5af4.js +31 -0
- package/dist/esm/post-tab-header.entry.js +5 -4
- package/dist/esm/{post-tab-panel-163e6c99.js → post-tab-panel-4d075c9a.js} +6 -5
- package/dist/esm/post-tab-panel.entry.js +4 -3
- package/dist/esm/{post-tabs-8cb1bce9.js → post-tabs-435d6842.js} +23 -16
- package/dist/esm/post-tabs.entry.js +4 -4
- package/dist/esm/post-tag-3302db4b.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/post-togglebutton-fdda47b1.js +3947 -0
- package/dist/esm/{post-tooltip-dc7e1a21.js → post-tooltip-d501e42e.js} +38 -25
- package/dist/esm/post-tooltip.entry.js +8 -6
- package/dist/esm/slide-cd2850ee.js +25 -0
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0c945b7d.js +1 -0
- package/dist/post-components/p-0fc4c0f7.entry.js +1 -0
- package/dist/post-components/p-181c73d5.js +1 -0
- package/dist/post-components/p-1e3f36d8.js +1 -0
- package/dist/post-components/p-23bbd444.js +1 -0
- package/dist/post-components/p-251361a3.entry.js +1 -0
- package/dist/post-components/p-338e7b28.js +1 -0
- package/dist/post-components/p-37d32092.js +1 -0
- package/dist/post-components/p-44bf0821.entry.js +1 -0
- package/dist/post-components/p-4766cb56.entry.js +1 -0
- package/dist/post-components/p-4859cf12.entry.js +1 -0
- package/dist/post-components/p-4dfe5596.js +1 -0
- package/dist/post-components/p-5959f2bd.js +1 -0
- package/dist/post-components/p-5aeb3656.js +1 -0
- package/dist/post-components/p-5beca2e1.js +1 -0
- package/dist/post-components/p-5c52db92.entry.js +1 -0
- package/dist/post-components/{p-3eab790d.js → p-5c758f41.js} +1 -1
- package/dist/post-components/p-5e612dc3.entry.js +1 -0
- package/dist/post-components/p-64e3de38.js +1 -0
- package/dist/post-components/p-66dcff86.js +1 -0
- package/dist/post-components/p-7709c14a.js +1 -0
- package/dist/post-components/p-77a4c79d.js +1 -0
- package/dist/post-components/p-8442e784.entry.js +1 -0
- package/dist/post-components/p-85fdc2d3.js +1 -0
- package/dist/post-components/p-8926be2f.entry.js +1 -0
- package/dist/post-components/p-8a5e87de.js +1 -0
- package/dist/post-components/p-8b7112e2.js +1 -0
- package/dist/post-components/p-8e989dc8.entry.js +1 -0
- package/dist/post-components/p-913e3850.entry.js +1 -0
- package/dist/post-components/p-945dfe27.js +1 -0
- package/dist/post-components/p-9513a8cc.entry.js +1 -0
- package/dist/post-components/p-9748a355.js +1 -0
- package/dist/post-components/p-9b052461.js +1 -0
- package/dist/post-components/p-9e0a5dee.entry.js +1 -0
- package/dist/post-components/p-a357201d.entry.js +1 -0
- package/dist/post-components/p-a7ca86ab.js +1 -0
- package/dist/post-components/p-ac77dc5d.entry.js +1 -0
- package/dist/post-components/p-b030fea7.entry.js +1 -0
- package/dist/post-components/{p-0ad93d89.js → p-b3f80a8d.js} +3 -3
- package/dist/post-components/p-b6e2ef6b.js +1 -0
- package/dist/post-components/p-baaa2cdd.entry.js +1 -0
- package/dist/post-components/p-d45df336.js +1 -0
- package/dist/post-components/p-d9609f91.js +1 -0
- package/dist/post-components/p-dbd973a2.js +1 -0
- package/dist/post-components/p-e1baac59.js +1 -0
- package/dist/post-components/p-e585c6fe.js +1 -0
- package/dist/post-components/p-f2d8b5b9.js +1 -0
- package/dist/post-components/p-f5f8a7a5.entry.js +1 -0
- package/dist/post-components/p-f9322b9f.entry.js +1 -0
- package/dist/post-components/p-fc91cbc2.js +1 -0
- package/dist/post-components/p-ff6877b8.js +1 -0
- package/dist/post-components/p-ff87f8cb.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/collapse.d.ts +2 -2
- package/dist/types/animations/fade.d.ts +2 -2
- package/dist/types/animations/slide.d.ts +2 -0
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +8 -2
- package/dist/types/components/post-avatar/post-avatar.d.ts +1 -1
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
- package/dist/types/components/post-banner/banner-types.d.ts +2 -0
- package/dist/types/components/post-banner/post-banner.d.ts +49 -0
- package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +20 -0
- package/dist/types/components/post-card-control/post-card-control.d.ts +9 -9
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
- package/dist/types/components/post-footer/post-footer.d.ts +23 -0
- package/dist/types/components/post-header/post-header.d.ts +51 -0
- package/dist/types/components/post-icon/post-icon.d.ts +13 -11
- package/dist/types/components/post-language-option/post-language-option.d.ts +13 -4
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +39 -0
- package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
- package/dist/types/components/post-linkarea/post-linkarea.d.ts +5 -0
- package/dist/types/components/post-list/post-list.d.ts +24 -0
- package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +71 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +59 -0
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +31 -0
- package/dist/types/components/post-menu/post-menu.d.ts +48 -0
- package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +28 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +27 -1
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +1 -1
- package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
- package/dist/types/components/post-tag/post-tag.d.ts +1 -1
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
- package/dist/types/components.d.ts +532 -76
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/.config/bindings.angular.d.ts +2 -0
- package/dist/types/index.d.ts +20 -3
- package/dist/types/utils/attribute-observer.d.ts +1 -1
- package/dist/types/utils/breakpoints.d.ts +12 -0
- package/dist/types/utils/component-on-ready.d.ts +1 -1
- package/dist/types/utils/get-focusable-children.d.ts +1 -0
- package/dist/types/utils/get-root.d.ts +1 -1
- package/dist/types/utils/property-checkers/check-non-empty.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-one-of.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-pattern.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-type.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-url.d.ts +3 -1
- package/dist/types/utils/property-checkers/index.d.ts +12 -4
- package/dist/types/utils/sass-export.d.ts +5 -1
- package/loaders/attribute-observer.js +4 -4
- package/loaders/breakpoints.js +52 -0
- package/loaders/check-non-empty.js +6 -2
- package/loaders/check-one-of.js +8 -3
- package/loaders/check-type.js +11 -6
- package/loaders/debounce.js +11 -0
- package/loaders/fade.js +6 -2
- package/loaders/get-focusable-children.js +35 -0
- package/loaders/get-root.js +9 -0
- package/loaders/index.browser.js +13 -0
- package/loaders/index.d.ts +36 -2
- package/loaders/index.js +20 -2
- package/loaders/index2.js +25 -12
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +1 -82
- package/loaders/post-accordion-item2.js +103 -0
- package/loaders/post-accordion.js +6 -5
- package/loaders/post-avatar.js +7 -11
- package/loaders/post-back-to-top.d.ts +11 -0
- package/loaders/post-back-to-top.js +104 -0
- package/loaders/post-banner.d.ts +11 -0
- package/loaders/post-banner.js +134 -0
- package/loaders/post-breadcrumb-item.d.ts +11 -0
- package/loaders/post-breadcrumb-item.js +6 -0
- package/loaders/post-breadcrumb-item2.js +82 -0
- package/loaders/post-breadcrumb.d.ts +11 -0
- package/loaders/post-breadcrumb.js +172 -0
- package/loaders/post-card-control.js +50 -39
- package/loaders/post-closebutton.d.ts +11 -0
- package/loaders/post-closebutton.js +37 -0
- package/loaders/post-collapsible-trigger2.js +23 -38
- package/loaders/post-collapsible2.js +21 -13
- package/loaders/post-footer.d.ts +11 -0
- package/loaders/post-footer.js +81 -0
- package/loaders/post-header.d.ts +11 -0
- package/loaders/post-header.js +404 -0
- package/loaders/post-icon2.js +81 -45
- package/loaders/post-language-option.js +31 -13
- package/loaders/post-language-switch.d.ts +11 -0
- package/loaders/post-language-switch.js +151 -0
- package/loaders/post-linkarea.d.ts +11 -0
- package/loaders/post-linkarea.js +45 -0
- package/loaders/post-list-item.d.ts +11 -0
- package/loaders/post-list-item.js +39 -0
- package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/loaders/post-list.js +58 -0
- package/loaders/post-logo.js +5 -5
- package/loaders/post-mainnavigation.d.ts +11 -0
- package/loaders/post-mainnavigation.js +274 -0
- package/loaders/post-megadropdown-trigger.d.ts +11 -0
- package/loaders/post-megadropdown-trigger.js +116 -0
- package/loaders/post-megadropdown.d.ts +11 -0
- package/loaders/post-megadropdown.js +202 -0
- package/loaders/post-menu-item.d.ts +11 -0
- package/loaders/post-menu-item.js +6 -0
- package/loaders/post-menu-item2.js +27 -0
- package/loaders/post-menu-trigger.d.ts +11 -0
- package/loaders/post-menu-trigger.js +6 -0
- package/loaders/post-menu-trigger2.js +109 -0
- package/loaders/post-menu.d.ts +11 -0
- package/loaders/post-menu.js +6 -0
- package/loaders/post-menu2.js +191 -0
- package/loaders/post-popover.js +14 -8
- package/loaders/post-popovercontainer2.js +249 -72
- package/loaders/post-rating.js +14 -4
- package/loaders/post-tab-header.js +7 -6
- package/loaders/post-tab-panel.js +4 -3
- package/loaders/post-tabs.js +20 -13
- package/loaders/post-tag.js +3 -3
- package/loaders/post-togglebutton.d.ts +11 -0
- package/loaders/post-togglebutton.js +64 -0
- package/loaders/post-tooltip.js +34 -21
- package/loaders/slide.js +25 -0
- package/package.json +26 -20
- package/dist/cjs/check-non-empty-eeaa8f77.js +0 -11
- package/dist/cjs/check-one-of-f4f5d0c0.js +0 -8
- package/dist/cjs/fade-35a3633a.js +0 -10
- package/dist/cjs/index-01f30442.js +0 -52
- package/dist/cjs/post-accordion-item-0278e6e2.js +0 -52
- package/dist/cjs/post-alert-5f795d9c.js +0 -98
- package/dist/cjs/post-alert.cjs.entry.js +0 -16
- package/dist/cjs/post-card-control-5ffcd201.js +0 -272
- package/dist/cjs/post-icon-1f71aa0f.js +0 -104
- package/dist/cjs/post-icon.cjs.entry.js +0 -15
- package/dist/cjs/post-language-option-4a3ecaeb.js +0 -67
- package/dist/cjs/post-language-option.cjs.entry.js +0 -14
- package/dist/cjs/post-logo-7070d727.js +0 -39
- package/dist/cjs/post-logo.cjs.entry.js +0 -14
- package/dist/cjs/post-popover-de1b8d95.js +0 -104
- package/dist/cjs/post-popovercontainer-6a25713a.js +0 -2186
- package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
- package/dist/cjs/post-tab-header-877676bf.js +0 -32
- package/dist/cjs/post-tag-5e2c7798.js +0 -47
- package/dist/collection/components/post-alert/alert-types.js +0 -1
- package/dist/collection/components/post-alert/post-alert.css +0 -7
- package/dist/components/post-alert.js +0 -6
- package/dist/components/post-alert2.js +0 -136
- package/dist/esm/check-non-empty-58bd6b17.js +0 -9
- package/dist/esm/check-one-of-6b3ef8eb.js +0 -6
- package/dist/esm/fade-7fd71785.js +0 -7
- package/dist/esm/index-f41b763f.js +0 -46
- package/dist/esm/package-0311770e.js +0 -3
- package/dist/esm/post-accordion-item-366f385b.js +0 -50
- package/dist/esm/post-alert-5a69f40d.js +0 -96
- package/dist/esm/post-alert.entry.js +0 -8
- package/dist/esm/post-card-control-2a7939c3.js +0 -270
- package/dist/esm/post-icon-885f17e9.js +0 -102
- package/dist/esm/post-icon.entry.js +0 -7
- package/dist/esm/post-language-option-0c2818aa.js +0 -65
- package/dist/esm/post-language-option.entry.js +0 -6
- package/dist/esm/post-logo-dd425f2e.js +0 -37
- package/dist/esm/post-logo.entry.js +0 -6
- package/dist/esm/post-popover-7d44a85c.js +0 -102
- package/dist/esm/post-popovercontainer-e6d11d81.js +0 -2184
- package/dist/esm/post-popovercontainer.entry.js +0 -3
- package/dist/esm/post-tab-header-776a991a.js +0 -30
- package/dist/esm/post-tag-deefcc86.js +0 -45
- package/dist/post-components/p-048538ea.js +0 -1
- package/dist/post-components/p-0a1f5e13.entry.js +0 -1
- package/dist/post-components/p-0a4318ff.js +0 -1
- package/dist/post-components/p-0d64ef0c.entry.js +0 -1
- package/dist/post-components/p-1198a5f2.entry.js +0 -1
- package/dist/post-components/p-13d1bef7.entry.js +0 -1
- package/dist/post-components/p-16d057a6.js +0 -1
- package/dist/post-components/p-1a091fca.entry.js +0 -1
- package/dist/post-components/p-1f35b0ba.entry.js +0 -1
- package/dist/post-components/p-246a6d28.js +0 -1
- package/dist/post-components/p-2737eaf5.js +0 -1
- package/dist/post-components/p-3aa5e1e5.js +0 -1
- package/dist/post-components/p-3d3795f9.js +0 -1
- package/dist/post-components/p-3fabf6e4.entry.js +0 -1
- package/dist/post-components/p-4f0617e6.js +0 -1
- package/dist/post-components/p-53bacbbc.js +0 -1
- package/dist/post-components/p-5c8cb76f.entry.js +0 -1
- package/dist/post-components/p-5eee8d31.entry.js +0 -1
- package/dist/post-components/p-60e72b25.js +0 -1
- package/dist/post-components/p-611b3c41.js +0 -1
- package/dist/post-components/p-66ed33a9.js +0 -1
- package/dist/post-components/p-681b751d.entry.js +0 -1
- package/dist/post-components/p-6adeaa6c.js +0 -1
- package/dist/post-components/p-6b6a1e82.entry.js +0 -1
- package/dist/post-components/p-752e6a98.entry.js +0 -1
- package/dist/post-components/p-8734876e.js +0 -1
- package/dist/post-components/p-9ac2a947.js +0 -1
- package/dist/post-components/p-9d211a45.js +0 -1
- package/dist/post-components/p-b095519d.js +0 -1
- package/dist/post-components/p-b38eaabf.js +0 -1
- package/dist/post-components/p-cdfcc758.entry.js +0 -1
- package/dist/post-components/p-d50d4ec1.entry.js +0 -1
- package/dist/post-components/p-d785856c.js +0 -1
- package/dist/post-components/p-deb4131c.js +0 -1
- package/dist/post-components/p-e18f3639.js +0 -1
- package/dist/post-components/p-f1b7797f.entry.js +0 -1
- package/dist/post-components/p-f6efc76b.entry.js +0 -1
- package/dist/post-components/p-f825d681.js +0 -1
- package/dist/post-components/p-fff1c2ee.entry.js +0 -1
- package/dist/types/components/post-alert/alert-types.d.ts +0 -2
- package/dist/types/components/post-alert/post-alert.d.ts +0 -54
- package/loaders/post-alert.js +0 -139
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative;--global-header-top: calc( (var(--global-header-height) - var(--global-header-reduced-height)) * -1 );--local-header-top: calc( -1 * (var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height) );--logo-height: calc(var(--global-header-height) - var(--header-scroll-top));--global-controls-top: calc(min((var(--header-scroll-top) / 4), 20px) * -1)}:host:has(.global-sub>*:not(.logo):focus-within),:host:has(.local-sub:focus-within){--global-header-top: 0;--local-header-top: var(--global-header-height);--logo-height: var(--global-header-height);--global-controls-top: 0}:host(:not(:has([slot=title]))) .local-header{padding-block-start:0}:host(:not(:has([slot=title]))) .local-sub{display:none}.d-flex{display:flex}.space-between{justify-content:space-between}.global-header{background-color:#fc0;display:flex;justify-content:space-between;position:sticky;padding-inline:4px;height:var(--global-header-height)}@media screen and (max-width: 1023.98px){.global-header{z-index:3;inset-block-start:0}}@media screen and (min-width: 1024px){.global-header{z-index:5;padding-inline-end:12px;inset-block-start:var(--global-header-top);transition:inset-block-start .2s ease-in-out}}.global-sub{display:flex;align-items:center;gap:24px}@media screen and (min-width: 1024px){.global-sub:not(:has(.logo)){position:relative;transition:inset-block-start .2s ease-in-out;inset-block-start:var(--global-controls-top)}}.align-end{align-items:flex-end}.logo{flex:1 0 auto;height:var(--global-header-height);width:var(--global-header-height);min-height:var(--global-header-reduced-height);align-self:flex-end}@media screen and (min-width: 1024px){.logo{transition:height .2 ease-in-out;height:var(--logo-height)}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-inline-start:0;gap:1rem;flex-shrink:0 !important}.local-header{display:flex;position:sticky;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:4px;min-height:var(--local-header-min-height);background:#fff;transition:box-shadow .2s ease-in-out}.local-header::after{content:"";position:absolute;width:100%;height:1px;background-color:#e1e0dc;inset-block-end:-1px;z-index:1}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.local-header::after{background-color:Highlight}}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:var(--local-header-top);padding-block-start:18px;box-shadow:var(--post-device-elevation-300);transition:box-shadow .2s ease-in-out,inset-block-start .2s ease-in-out}}@media screen and (max-width: 1023.98px){.local-header{z-index:2;inset-block-start:var(--global-header-height);padding-block:12px;flex-wrap:wrap;gap:16px}.local-header.local-header-mobile-extended::after{inset-block-end:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:8px}@media screen and (max-width: 1023.98px){.local-sub{margin-inline-end:4px}}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}@media screen and (min-width: 1024px){.mobile-toggle{display:none}}.navigation{width:100%}@media screen and (min-width: 1024px){.navigation{inset-block-start:var(--global-header-reduced-height)}.navigation::before{display:block;content:"";position:absolute;inset:0;z-index:2;background:#fff}}@media screen and (max-width: 1023.98px){.navigation{position:fixed;z-index:1;inset-inline:0;inset-block-start:calc(var(--header-scroll-top) + var(--header-height))}.mobile-menu{background-color:#fafafa}::slotted(post-mainnavigation),.navigation-footer{display:none;flex-direction:column;padding-block:16px 24px;padding-inline:32px}.navigation.extended ::slotted(post-mainnavigation),.navigation.extended .navigation-footer{display:flex}.navigation.extended>div{display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden;height:calc(min(var(--header-scroll-parent-height, 100dvh),100dvh) - var(--header-height))}.navigation.extended.megadropdown-open>div{overflow-y:hidden}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
|
+
import { throttle } from "throttle-debounce";
|
|
3
|
+
import { version } from "../../../../package";
|
|
4
|
+
import { slideDown, slideUp } from "../../animations/slide";
|
|
5
|
+
import { getFocusableChildren } from "../../utils/get-focusable-children";
|
|
6
|
+
/**
|
|
7
|
+
* @slot post-logo - Should be used together with the `<post-logo>` component.
|
|
8
|
+
* @slot meta-navigation - Holds an `<ul>` with meta navigation links.
|
|
9
|
+
* @slot post-togglebutton - Holds the mobile menu toggler.
|
|
10
|
+
* @slot post-language-switch - Should be used with the `<post-language-switch>` component.
|
|
11
|
+
* @slot title - Holds the application title.
|
|
12
|
+
* @slot default - Custom controls or content, right aligned in the local header.
|
|
13
|
+
* @slot post-mainnavigation - Has a default slot because it's only meant to be used in the `<post-header>`.
|
|
14
|
+
*/
|
|
15
|
+
export class PostHeader {
|
|
16
|
+
firstFocusableEl;
|
|
17
|
+
lastFocusableEl;
|
|
18
|
+
mobileMenu;
|
|
19
|
+
mobileMenuAnimation;
|
|
20
|
+
throttledResize = throttle(50, () => this.handleResize());
|
|
21
|
+
scrollParentResizeObserver;
|
|
22
|
+
localHeaderResizeObserver;
|
|
23
|
+
get scrollParent() {
|
|
24
|
+
const frozenScrollParent = document.querySelector('[data-post-scroll-locked]');
|
|
25
|
+
if (frozenScrollParent)
|
|
26
|
+
return frozenScrollParent;
|
|
27
|
+
let element = this.host.parentElement;
|
|
28
|
+
while (element) {
|
|
29
|
+
const overflow = getComputedStyle(element).overflowY;
|
|
30
|
+
if (['auto', 'scroll'].includes(overflow)) {
|
|
31
|
+
return element;
|
|
32
|
+
}
|
|
33
|
+
element = element.parentElement;
|
|
34
|
+
}
|
|
35
|
+
return document.body;
|
|
36
|
+
}
|
|
37
|
+
host;
|
|
38
|
+
lockBody(newValue, _oldValue, propName) {
|
|
39
|
+
const scrollParent = this.scrollParent;
|
|
40
|
+
const mobileMenuExtended = propName === 'mobileMenuExtended' ? newValue : this.mobileMenuExtended;
|
|
41
|
+
if (this.device !== 'desktop' && mobileMenuExtended) {
|
|
42
|
+
scrollParent.setAttribute('data-post-scroll-locked', '');
|
|
43
|
+
this.host.addEventListener('keydown', this.keyboardHandler);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
scrollParent.removeAttribute('data-post-scroll-locked');
|
|
47
|
+
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* An event emitted when the device has changed
|
|
52
|
+
*/
|
|
53
|
+
postUpdateDevice;
|
|
54
|
+
constructor() {
|
|
55
|
+
this.device = null;
|
|
56
|
+
this.mobileMenuExtended = false;
|
|
57
|
+
this.megadropdownOpen = false;
|
|
58
|
+
this.handleScrollEvent = this.handleScrollEvent.bind(this);
|
|
59
|
+
this.updateScrollParentHeight = this.updateScrollParentHeight.bind(this);
|
|
60
|
+
this.updateLocalHeaderHeight = this.updateLocalHeaderHeight.bind(this);
|
|
61
|
+
this.megedropdownStateHandler = this.megedropdownStateHandler.bind(this);
|
|
62
|
+
this.keyboardHandler = this.keyboardHandler.bind(this);
|
|
63
|
+
this.handleLinkClick = this.handleLinkClick.bind(this);
|
|
64
|
+
}
|
|
65
|
+
connectedCallback() {
|
|
66
|
+
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
67
|
+
window.addEventListener('scroll', this.handleScrollEvent, {
|
|
68
|
+
passive: true,
|
|
69
|
+
});
|
|
70
|
+
this.scrollParent.addEventListener('scroll', this.handleScrollEvent, {
|
|
71
|
+
passive: true,
|
|
72
|
+
});
|
|
73
|
+
document.addEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
|
|
74
|
+
this.host.addEventListener('click', this.handleLinkClick);
|
|
75
|
+
this.handleResize();
|
|
76
|
+
this.handleScrollEvent();
|
|
77
|
+
this.handleScrollParentResize();
|
|
78
|
+
this.lockBody(false, this.mobileMenuExtended, 'mobileMenuExtended');
|
|
79
|
+
}
|
|
80
|
+
componentDidRender() {
|
|
81
|
+
this.getFocusableElements();
|
|
82
|
+
this.handleLocalHeaderResize();
|
|
83
|
+
}
|
|
84
|
+
// Clean up possible side effects when post-header is disconnected
|
|
85
|
+
disconnectedCallback() {
|
|
86
|
+
const scrollParent = this.scrollParent;
|
|
87
|
+
window.removeEventListener('resize', this.throttledResize);
|
|
88
|
+
window.removeEventListener('scroll', this.handleScrollEvent);
|
|
89
|
+
scrollParent.removeEventListener('scroll', this.handleScrollEvent);
|
|
90
|
+
document.removeEventListener('postToggleMegadropdown', this.megedropdownStateHandler);
|
|
91
|
+
this.host.removeEventListener('keydown', this.keyboardHandler);
|
|
92
|
+
this.host.removeEventListener('click', this.handleLinkClick);
|
|
93
|
+
if (this.scrollParentResizeObserver) {
|
|
94
|
+
this.scrollParentResizeObserver.disconnect();
|
|
95
|
+
this.scrollParentResizeObserver = null;
|
|
96
|
+
}
|
|
97
|
+
if (this.localHeaderResizeObserver) {
|
|
98
|
+
this.localHeaderResizeObserver.disconnect();
|
|
99
|
+
this.localHeaderResizeObserver = null;
|
|
100
|
+
}
|
|
101
|
+
this.mobileMenuExtended = false;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Toggles the mobile navigation.
|
|
105
|
+
*/
|
|
106
|
+
async toggleMobileMenu(force) {
|
|
107
|
+
if (this.device === 'desktop')
|
|
108
|
+
return;
|
|
109
|
+
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
110
|
+
? slideUp(this.mobileMenu)
|
|
111
|
+
: slideDown(this.mobileMenu);
|
|
112
|
+
// Update the state of the toggle button
|
|
113
|
+
const menuButton = this.host.querySelector('post-togglebutton');
|
|
114
|
+
menuButton.toggled = force ?? !this.mobileMenuExtended;
|
|
115
|
+
// Toggle menu visibility before it slides down and after it slides back up
|
|
116
|
+
if (this.mobileMenuExtended)
|
|
117
|
+
await this.mobileMenuAnimation.finished;
|
|
118
|
+
this.mobileMenuExtended = force ?? !this.mobileMenuExtended;
|
|
119
|
+
if (this.mobileMenuExtended === false) {
|
|
120
|
+
Array.from(this.host.querySelectorAll('post-megadropdown')).forEach(dropdown => {
|
|
121
|
+
dropdown.hide(false, true);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
megedropdownStateHandler(event) {
|
|
126
|
+
this.megadropdownOpen = event.detail.isVisible;
|
|
127
|
+
}
|
|
128
|
+
// Get all the focusable elements in the post-header mobile menu
|
|
129
|
+
getFocusableElements() {
|
|
130
|
+
// Get elements in the correct order (different as the DOM order)
|
|
131
|
+
const focusableEls = [
|
|
132
|
+
...Array.from(this.host.querySelectorAll('.list-inline:not([slot="meta-navigation"]) > li')),
|
|
133
|
+
...Array.from(this.host.querySelectorAll('nav > post-list > div > post-list-item, post-mainnavigation > .back-button, post-megadropdown-trigger')),
|
|
134
|
+
...Array.from(this.host.querySelectorAll('.list-inline[slot="meta-navigation"] > li, post-language-option')),
|
|
135
|
+
];
|
|
136
|
+
// Add the main toggle menu button to the list of focusable children
|
|
137
|
+
const focusableChildren = [
|
|
138
|
+
this.host.querySelector('post-togglebutton'),
|
|
139
|
+
...focusableEls.flatMap(el => Array.from(getFocusableChildren(el))),
|
|
140
|
+
];
|
|
141
|
+
this.firstFocusableEl = focusableChildren[0];
|
|
142
|
+
this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
|
|
143
|
+
}
|
|
144
|
+
keyboardHandler(e) {
|
|
145
|
+
if (e.key === 'Tab' && this.mobileMenuExtended) {
|
|
146
|
+
if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
|
|
147
|
+
// If back tab (Tab + Shift) and first element is focused, focus goes to the last element of the megadropdown
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
this.lastFocusableEl.focus();
|
|
150
|
+
}
|
|
151
|
+
else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
|
|
152
|
+
// If Tab and last element is focused, focus goes back to the first element of the megadropdown
|
|
153
|
+
e.preventDefault();
|
|
154
|
+
this.firstFocusableEl.focus();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
handleScrollEvent() {
|
|
159
|
+
const scrollTop = this.scrollParent === document.body ? window.scrollY : this.scrollParent.scrollTop;
|
|
160
|
+
this.host.style.setProperty('--header-scroll-top', `${scrollTop}px`);
|
|
161
|
+
}
|
|
162
|
+
updateLocalHeaderHeight() {
|
|
163
|
+
const localHeaderHeight = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
|
|
164
|
+
this.host.style.setProperty('--local-header-height', `${localHeaderHeight}px`);
|
|
165
|
+
}
|
|
166
|
+
updateScrollParentHeight() {
|
|
167
|
+
this.host.style.setProperty('--header-scroll-parent-height', `${this.scrollParent.clientHeight}px`);
|
|
168
|
+
}
|
|
169
|
+
handleLinkClick(event) {
|
|
170
|
+
const target = event.target;
|
|
171
|
+
const isLinkInMainNav = target.closest('post-mainnavigation a');
|
|
172
|
+
const isLinkInMegadropdown = target.closest('post-megadropdown a');
|
|
173
|
+
if (!isLinkInMainNav && !isLinkInMegadropdown) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (this.mobileMenuExtended && (isLinkInMainNav || isLinkInMegadropdown)) {
|
|
177
|
+
this.toggleMobileMenu(false);
|
|
178
|
+
}
|
|
179
|
+
if (this.device === 'desktop' && isLinkInMegadropdown) {
|
|
180
|
+
const megadropdownLink = target.closest('post-megadropdown a');
|
|
181
|
+
if (megadropdownLink) {
|
|
182
|
+
target.closest('post-megadropdown').hide(true);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
handleResize() {
|
|
187
|
+
const previousDevice = this.device;
|
|
188
|
+
let newDevice;
|
|
189
|
+
const width = window?.innerWidth;
|
|
190
|
+
if (width >= 1024) {
|
|
191
|
+
newDevice = 'desktop';
|
|
192
|
+
}
|
|
193
|
+
else if (width >= 600) {
|
|
194
|
+
newDevice = 'tablet';
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
newDevice = 'mobile';
|
|
198
|
+
}
|
|
199
|
+
// Apply only on change for doing work only when necessary
|
|
200
|
+
if (newDevice !== previousDevice) {
|
|
201
|
+
this.device = newDevice;
|
|
202
|
+
this.postUpdateDevice.emit(this.device);
|
|
203
|
+
window.requestAnimationFrame(() => {
|
|
204
|
+
this.switchLanguageSwitchMode();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
handleScrollParentResize() {
|
|
209
|
+
if (this.scrollParent) {
|
|
210
|
+
this.scrollParentResizeObserver = new ResizeObserver(this.updateScrollParentHeight);
|
|
211
|
+
this.scrollParentResizeObserver.observe(this.scrollParent);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
handleLocalHeaderResize() {
|
|
215
|
+
const localHeader = this.host.shadowRoot.querySelector('.local-header');
|
|
216
|
+
if (localHeader && !this.localHeaderResizeObserver) {
|
|
217
|
+
this.localHeaderResizeObserver = new ResizeObserver(this.updateLocalHeaderHeight);
|
|
218
|
+
this.localHeaderResizeObserver.observe(localHeader);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
switchLanguageSwitchMode() {
|
|
222
|
+
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
223
|
+
Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
|
|
224
|
+
languageSwitch?.setAttribute('variant', variant);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
renderNavigation() {
|
|
228
|
+
const navigationClasses = ['navigation'];
|
|
229
|
+
const mobileMenuScrollTop = this.mobileMenu?.scrollTop ?? 0;
|
|
230
|
+
if (this.mobileMenuExtended) {
|
|
231
|
+
navigationClasses.push('extended');
|
|
232
|
+
}
|
|
233
|
+
if (this.megadropdownOpen) {
|
|
234
|
+
navigationClasses.push('megadropdown-open');
|
|
235
|
+
}
|
|
236
|
+
return (h("div", { class: navigationClasses.join(' '), style: { '--header-navigation-current-inset': `${mobileMenuScrollTop}px` } }, h("div", { class: "mobile-menu", ref: el => (this.mobileMenu = el) }, h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { class: "navigation-footer" }, h("slot", { name: "meta-navigation" }), h("slot", { name: "post-language-switch" }))))));
|
|
237
|
+
}
|
|
238
|
+
render() {
|
|
239
|
+
return (h(Host, { key: '1cc6cb8fb53d744a3e857b39fe6d59dcc52616f6', version: version }, h("div", { key: 'f2b0993095d6173cd6e6652f68a6d86cccaca0cf', class: "global-header" }, h("div", { key: '3199a8bfe40e617b9aa41235a836b0346afe3f5f', class: "global-sub" }, h("div", { key: 'acf05b7b78ca758b75b4c999a262506dc43b1692', class: "logo" }, h("slot", { key: '21d50a2e983f3572ce33828fd69a3eff01983206', name: "post-logo" }))), h("div", { key: '7222c559dca81ae94b18a5a88825169fa05b887e', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '4948c8d13318987f9c419ac73d901e558f763d0d', name: "meta-navigation" }), h("slot", { key: '2a10e4dc73716b3fd39fd9fb534678c6203f60e3', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: '5786dcda4ca017500916ea4c9da604da46a0e2f5', name: "post-language-switch" }), h("div", { key: 'a2326d26003bb8101dc0236426b26f1f11bdd9df', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: 'e75d428c8a5644bcd979607de1ca85ad435e096d', name: "post-togglebutton" })))), h("div", { key: 'c40d1e10ce6e13e2cae5f8395ad9281dce50975e', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: 'e37002ea2d9d74fdfa0773cb2ca90f7e9560f193', name: "title" }), h("div", { key: 'fe1e158e00458d1232c5b0e9ae22c63e77b25ac6', class: "local-sub" }, h("slot", { key: '4b504f9652a403cf89b0a371a803251923758155', name: "local-controls" }), h("slot", { key: 'c02b89240f8df106f138bc14312031511c5462f6' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
|
|
240
|
+
}
|
|
241
|
+
static get is() { return "post-header"; }
|
|
242
|
+
static get encapsulation() { return "shadow"; }
|
|
243
|
+
static get originalStyleUrls() {
|
|
244
|
+
return {
|
|
245
|
+
"$": ["./post-header.scss"]
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
static get styleUrls() {
|
|
249
|
+
return {
|
|
250
|
+
"$": ["post-header.css"]
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
static get states() {
|
|
254
|
+
return {
|
|
255
|
+
"device": {},
|
|
256
|
+
"mobileMenuExtended": {},
|
|
257
|
+
"megadropdownOpen": {}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
static get events() {
|
|
261
|
+
return [{
|
|
262
|
+
"method": "postUpdateDevice",
|
|
263
|
+
"name": "postUpdateDevice",
|
|
264
|
+
"bubbles": true,
|
|
265
|
+
"cancelable": true,
|
|
266
|
+
"composed": true,
|
|
267
|
+
"docs": {
|
|
268
|
+
"tags": [],
|
|
269
|
+
"text": "An event emitted when the device has changed"
|
|
270
|
+
},
|
|
271
|
+
"complexType": {
|
|
272
|
+
"original": "DEVICE_SIZE",
|
|
273
|
+
"resolved": "\"desktop\" | \"mobile\" | \"tablet\"",
|
|
274
|
+
"references": {
|
|
275
|
+
"DEVICE_SIZE": {
|
|
276
|
+
"location": "local",
|
|
277
|
+
"path": "/home/runner/work/design-system/design-system/packages/components/src/components/post-header/post-header.tsx",
|
|
278
|
+
"id": "src/components/post-header/post-header.tsx::DEVICE_SIZE"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}];
|
|
283
|
+
}
|
|
284
|
+
static get methods() {
|
|
285
|
+
return {
|
|
286
|
+
"toggleMobileMenu": {
|
|
287
|
+
"complexType": {
|
|
288
|
+
"signature": "(force?: boolean) => Promise<void>",
|
|
289
|
+
"parameters": [{
|
|
290
|
+
"name": "force",
|
|
291
|
+
"type": "boolean",
|
|
292
|
+
"docs": ""
|
|
293
|
+
}],
|
|
294
|
+
"references": {
|
|
295
|
+
"Promise": {
|
|
296
|
+
"location": "global",
|
|
297
|
+
"id": "global::Promise"
|
|
298
|
+
},
|
|
299
|
+
"HTMLPostTogglebuttonElement": {
|
|
300
|
+
"location": "global",
|
|
301
|
+
"id": "global::HTMLPostTogglebuttonElement"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
"return": "Promise<void>"
|
|
305
|
+
},
|
|
306
|
+
"docs": {
|
|
307
|
+
"text": "Toggles the mobile navigation.",
|
|
308
|
+
"tags": []
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
static get elementRef() { return "host"; }
|
|
314
|
+
static get watchers() {
|
|
315
|
+
return [{
|
|
316
|
+
"propName": "device",
|
|
317
|
+
"methodName": "lockBody"
|
|
318
|
+
}, {
|
|
319
|
+
"propName": "mobileMenuExtended",
|
|
320
|
+
"methodName": "lockBody"
|
|
321
|
+
}];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { checkNonEmpty, checkType, checkEmptyOrType, checkEmptyOrOneOf } from "../../utils/index";
|
|
3
3
|
import { version } from "../../../../package";
|
|
4
|
-
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
4
|
+
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons/';
|
|
5
5
|
const ANIMATION_NAMES = [
|
|
6
6
|
'cylon',
|
|
7
7
|
'cylon-vertical',
|
|
@@ -16,8 +16,6 @@ const ANIMATION_KEYS = [...ANIMATION_NAMES];
|
|
|
16
16
|
*/
|
|
17
17
|
export class PostIcon {
|
|
18
18
|
constructor() {
|
|
19
|
-
this.svgStyles = undefined;
|
|
20
|
-
this.svgOutput = undefined;
|
|
21
19
|
this.animation = null;
|
|
22
20
|
this.base = null;
|
|
23
21
|
this.flipH = false;
|
|
@@ -26,28 +24,91 @@ export class PostIcon {
|
|
|
26
24
|
this.rotate = null;
|
|
27
25
|
this.scale = null;
|
|
28
26
|
}
|
|
27
|
+
isSSR = typeof window === 'undefined';
|
|
28
|
+
host;
|
|
29
29
|
validateAnimation(newValue = this.animation) {
|
|
30
30
|
if (newValue !== undefined)
|
|
31
|
-
checkEmptyOrOneOf(
|
|
31
|
+
checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
|
|
32
32
|
}
|
|
33
|
-
validateBase(
|
|
34
|
-
checkEmptyOrType(
|
|
33
|
+
validateBase() {
|
|
34
|
+
checkEmptyOrType(this, 'base', 'string');
|
|
35
35
|
}
|
|
36
|
-
validateFlipH(
|
|
37
|
-
checkEmptyOrType(
|
|
36
|
+
validateFlipH() {
|
|
37
|
+
checkEmptyOrType(this, 'flipH', 'boolean');
|
|
38
38
|
}
|
|
39
|
-
validateFlipV(
|
|
40
|
-
checkEmptyOrType(
|
|
39
|
+
validateFlipV() {
|
|
40
|
+
checkEmptyOrType(this, 'flipV', 'boolean');
|
|
41
41
|
}
|
|
42
|
-
validateName(
|
|
43
|
-
checkNonEmpty(
|
|
44
|
-
checkType(
|
|
42
|
+
validateName() {
|
|
43
|
+
checkNonEmpty(this, 'name');
|
|
44
|
+
checkType(this, 'name', 'string');
|
|
45
45
|
}
|
|
46
|
-
validateRotate(
|
|
47
|
-
checkEmptyOrType(
|
|
46
|
+
validateRotate() {
|
|
47
|
+
checkEmptyOrType(this, 'rotate', 'number');
|
|
48
48
|
}
|
|
49
|
-
validateScale(
|
|
50
|
-
checkEmptyOrType(
|
|
49
|
+
validateScale() {
|
|
50
|
+
checkEmptyOrType(this, 'scale', 'number');
|
|
51
|
+
}
|
|
52
|
+
// Construct the icon url from different possible sources
|
|
53
|
+
getUrl() {
|
|
54
|
+
let url;
|
|
55
|
+
const file = `${this.name}.svg`;
|
|
56
|
+
// the first definition object which defines a domain, will be used to set the domain of the file url
|
|
57
|
+
// the first definition object which defines a slug, will be used to set the slug of the file url
|
|
58
|
+
const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
|
|
59
|
+
if (!this.isSSR) {
|
|
60
|
+
urlDefinitions.push(this.getUrlDefinition(document.head
|
|
61
|
+
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')
|
|
62
|
+
?.getAttribute('data-post-icon-base'), 'relative'));
|
|
63
|
+
urlDefinitions.push(this.getUrlDefinition(document.querySelector('base[href]')?.getAttribute('href'), 'both'));
|
|
64
|
+
}
|
|
65
|
+
// in case no definition defines a domain, a relative url is used to load the icon
|
|
66
|
+
const origin = urlDefinitions.find(d => d.definesDomain)?.url?.origin;
|
|
67
|
+
// in case no definition defines a slug either, the cdn url is used as a fallback
|
|
68
|
+
const slug = urlDefinitions.find(d => d.definesSlug)?.url?.pathname;
|
|
69
|
+
if (origin && slug) {
|
|
70
|
+
url = `${origin}${slug}${file}`;
|
|
71
|
+
}
|
|
72
|
+
else if (!origin && slug) {
|
|
73
|
+
url = `${slug}${file}`;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
url = `${CDN_URL}${file}`;
|
|
77
|
+
}
|
|
78
|
+
return url;
|
|
79
|
+
}
|
|
80
|
+
getUrlDefinition(url, allow) {
|
|
81
|
+
return {
|
|
82
|
+
url: this.getUrlObject(url),
|
|
83
|
+
definesDomain: allow !== 'relative' ? this.definesDomain(url) : false,
|
|
84
|
+
definesSlug: allow !== 'absolute' ? this.definesSlug(url) : false,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
getUrlObject(url) {
|
|
88
|
+
if (url) {
|
|
89
|
+
url = url?.endsWith('/') ? url : `${url}/`;
|
|
90
|
+
return new URL(url, 'https://url.base');
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
definesDomain(url) {
|
|
97
|
+
return url ? /^https?:\/\//.test(url) : false;
|
|
98
|
+
}
|
|
99
|
+
definesSlug(url) {
|
|
100
|
+
return Boolean(/^\/.+/.test(this.getUrlObject(url)?.pathname));
|
|
101
|
+
}
|
|
102
|
+
getStyles() {
|
|
103
|
+
const url = this.getUrl();
|
|
104
|
+
return Object.entries({
|
|
105
|
+
'-webkit-mask-image': `url(${url})`,
|
|
106
|
+
'mask-image': `url('${url}')`,
|
|
107
|
+
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
108
|
+
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
109
|
+
})
|
|
110
|
+
.filter(([_key, value]) => value !== null)
|
|
111
|
+
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
51
112
|
}
|
|
52
113
|
componentDidLoad() {
|
|
53
114
|
this.validateBase();
|
|
@@ -58,30 +119,8 @@ export class PostIcon {
|
|
|
58
119
|
this.validateRotate();
|
|
59
120
|
this.validateAnimation();
|
|
60
121
|
}
|
|
61
|
-
componentWillRender() {
|
|
62
|
-
this.setPath();
|
|
63
|
-
}
|
|
64
|
-
setPath() {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
66
|
-
// Construct icon path from different possible sources
|
|
67
|
-
const metaBase = (_b = (_a = document.head
|
|
68
|
-
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-post-icon-base')) !== null && _b !== void 0 ? _b : null;
|
|
69
|
-
const fileBase = `${(_d = (_c = this.base) !== null && _c !== void 0 ? _c : metaBase) !== null && _d !== void 0 ? _d : CDN_URL}/`.replace(/\/\/$/, '/');
|
|
70
|
-
const fileName = `${this.name}.svg`;
|
|
71
|
-
const filePath = `${fileBase}${fileName}`;
|
|
72
|
-
this.path = new URL(filePath, window.location.origin).toString();
|
|
73
|
-
}
|
|
74
122
|
render() {
|
|
75
|
-
|
|
76
|
-
const svgStyles = Object.entries({
|
|
77
|
-
'-webkit-mask-image': `url('${this.path}')`,
|
|
78
|
-
'mask-image': `url('${this.path}')`,
|
|
79
|
-
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
80
|
-
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
81
|
-
})
|
|
82
|
-
.filter(([_key, value]) => value !== null)
|
|
83
|
-
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
84
|
-
return (h(Host, { key: '5def9850dfccafe1ed1499fa042d7c1358256f38', "data-version": version }, h("span", { key: '663ec6e0079669d23be3bad4890cdd580145c05b', style: svgStyles })));
|
|
123
|
+
return (h(Host, { key: 'c80aaf693f730902c4ae57ca78360eee5dedf624', "data-version": version }, h("span", { key: '7e01e1cf7e4fec380e8f054d3cc8fa5404c7a829', style: this.getStyles() })));
|
|
85
124
|
}
|
|
86
125
|
static get is() { return "post-icon"; }
|
|
87
126
|
static get encapsulation() { return "shadow"; }
|
|
@@ -229,12 +268,6 @@ export class PostIcon {
|
|
|
229
268
|
}
|
|
230
269
|
};
|
|
231
270
|
}
|
|
232
|
-
static get states() {
|
|
233
|
-
return {
|
|
234
|
-
"svgStyles": {},
|
|
235
|
-
"svgOutput": {}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
271
|
static get elementRef() { return "host"; }
|
|
239
272
|
static get watchers() {
|
|
240
273
|
return [{
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2021 by Swiss Post, Information Technology
|
|
3
|
-
|
|
3
|
+
*/post-language-option{display:inline-block}post-language-option 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-option button{background-color:ButtonFace !important}post-language-option button:hover{background-color:Highlight !important}}post-language-option a{color:var(--post-scheme-color-surface-default-fg);text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:2px;text-transform:uppercase}post-language-option :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-option: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-option:where([variant=list]) :is(a,button){border:1px solid ButtonBorder;color:ButtonText}}post-language-option: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-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:Highlight !important;color:HighlightText}}post-language-option:where([variant=menu]){min-width:72px}post-language-option:where([variant=menu])[active]:not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:16px;box-sizing:border-box;justify-content:flex-start;position:relative}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}
|
|
@@ -8,20 +8,22 @@ export class PostLanguageOption {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
this.code = undefined;
|
|
10
10
|
this.active = undefined;
|
|
11
|
+
this.variant = undefined;
|
|
11
12
|
this.name = undefined;
|
|
12
13
|
this.url = undefined;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
host;
|
|
16
|
+
validateCode() {
|
|
17
|
+
checkType(this, 'code', 'string');
|
|
16
18
|
}
|
|
17
|
-
validateActiveProp(
|
|
18
|
-
checkEmptyOrType(
|
|
19
|
+
validateActiveProp() {
|
|
20
|
+
checkEmptyOrType(this, 'active', 'boolean');
|
|
19
21
|
}
|
|
20
|
-
validateName(
|
|
21
|
-
checkEmptyOrType(
|
|
22
|
+
validateName() {
|
|
23
|
+
checkEmptyOrType(this, 'name', 'string');
|
|
22
24
|
}
|
|
23
|
-
validateUrl(
|
|
24
|
-
checkEmptyOrType(
|
|
25
|
+
validateUrl() {
|
|
26
|
+
checkEmptyOrType(this, 'url', 'string');
|
|
25
27
|
}
|
|
26
28
|
componentDidLoad() {
|
|
27
29
|
this.validateCode();
|
|
@@ -31,7 +33,18 @@ export class PostLanguageOption {
|
|
|
31
33
|
if (!this.name && this.isNameRequired()) {
|
|
32
34
|
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
33
35
|
}
|
|
36
|
+
if (this.active) {
|
|
37
|
+
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
38
|
+
}
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
42
|
+
*/
|
|
43
|
+
postChange;
|
|
44
|
+
/**
|
|
45
|
+
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
46
|
+
*/
|
|
47
|
+
postLanguageOptionInitiallyActive;
|
|
35
48
|
/**
|
|
36
49
|
* Selects the language option programmatically.
|
|
37
50
|
*/
|
|
@@ -47,10 +60,14 @@ export class PostLanguageOption {
|
|
|
47
60
|
}
|
|
48
61
|
render() {
|
|
49
62
|
const lang = this.code.toLowerCase();
|
|
50
|
-
|
|
63
|
+
const emitOnKeyDown = (e) => {
|
|
64
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
65
|
+
this.emitChange();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return (h(Host, { key: '404caa6a507637810b672c5decf4e3af300733ac', "data-version": version }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
51
69
|
}
|
|
52
70
|
static get is() { return "post-language-option"; }
|
|
53
|
-
static get encapsulation() { return "shadow"; }
|
|
54
71
|
static get originalStyleUrls() {
|
|
55
72
|
return {
|
|
56
73
|
"$": ["post-language-option.scss"]
|
|
@@ -97,6 +114,29 @@ export class PostLanguageOption {
|
|
|
97
114
|
"attribute": "active",
|
|
98
115
|
"reflect": true
|
|
99
116
|
},
|
|
117
|
+
"variant": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "SwitchVariant | null",
|
|
122
|
+
"resolved": "\"list\" | \"menu\"",
|
|
123
|
+
"references": {
|
|
124
|
+
"SwitchVariant": {
|
|
125
|
+
"location": "import",
|
|
126
|
+
"path": "../post-language-switch/switch-variants",
|
|
127
|
+
"id": "src/components/post-language-switch/switch-variants.ts::SwitchVariant"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": true,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": "To communicate the variant prop from the parent (post-language-switch) component to the child (post-language-option) component. See parent docs for a description about the property itself."
|
|
136
|
+
},
|
|
137
|
+
"attribute": "variant",
|
|
138
|
+
"reflect": false
|
|
139
|
+
},
|
|
100
140
|
"name": {
|
|
101
141
|
"type": "string",
|
|
102
142
|
"mutable": false,
|
|
@@ -149,6 +189,21 @@ export class PostLanguageOption {
|
|
|
149
189
|
"resolved": "string",
|
|
150
190
|
"references": {}
|
|
151
191
|
}
|
|
192
|
+
}, {
|
|
193
|
+
"method": "postLanguageOptionInitiallyActive",
|
|
194
|
+
"name": "postLanguageOptionInitiallyActive",
|
|
195
|
+
"bubbles": true,
|
|
196
|
+
"cancelable": true,
|
|
197
|
+
"composed": true,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "An event emitted when the language option is initially active. The payload is the ISO 639 code of the language."
|
|
201
|
+
},
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "string",
|
|
204
|
+
"resolved": "string",
|
|
205
|
+
"references": {}
|
|
206
|
+
}
|
|
152
207
|
}];
|
|
153
208
|
}
|
|
154
209
|
static get methods() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:host{display:flex !important;flex-wrap:wrap;gap:.5rem}.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 12px}@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}}
|