@swisspost/design-system-components 9.0.0-next.1 → 9.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/check-type-64af82a9.js +16 -0
- package/dist/cjs/check-url-3ffdd2fb.js +14 -0
- package/dist/cjs/debounce-1151afe3.js +12 -0
- package/dist/cjs/get-root-7a3498ef.js +11 -0
- package/dist/cjs/{index-01f30442.js → index-5d4e0aed.js} +4 -27
- package/dist/cjs/{index-c15bd800.js → index-f1b08cdb.js} +45 -16
- package/dist/cjs/index.browser-2f65f583.js +15 -0
- package/dist/cjs/index.cjs.js +51 -24
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-c7d01968.js → package-5fdfea90.js} +1 -1
- package/dist/cjs/{post-accordion-e29956c4.js → post-accordion-dabc9271.js} +3 -3
- package/dist/cjs/post-accordion-item-9dadc543.js +64 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +7 -4
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/post-avatar-fddda407.js +148 -0
- package/dist/cjs/post-avatar.cjs.entry.js +13 -0
- package/dist/cjs/post-back-to-top-6dfbcd1b.js +75 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
- package/dist/cjs/post-banner-6df79142.js +91 -0
- package/dist/cjs/post-banner.cjs.entry.js +19 -0
- package/dist/cjs/post-breadcrumb-b05fb572.js +111 -0
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
- package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-97ed732c.js +272 -0
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +34 -0
- package/dist/cjs/{post-collapsible-trigger-32549d33.js → post-collapsible-trigger-94f1bbd9.js} +14 -26
- package/dist/cjs/post-collapsible_2.cjs.entry.js +8 -4
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer-f95510e4.js +84 -0
- package/dist/cjs/post-footer.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-106036fa.js +69 -0
- package/dist/cjs/{post-popover-cfc1b31b.js → post-popover-cc55d371.js} +4 -4
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-b9b8b6f3.js → post-rating-4aa3fabb.js} +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-1eee4cbf.js +33 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +4 -3
- package/dist/cjs/{post-tab-panel-300a0618.js → post-tab-panel-77162d5b.js} +5 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
- package/dist/cjs/{post-tabs-b06f799b.js → post-tabs-ee832221.js} +9 -7
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tag-8778a125.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-popovercontainer-c0b86b11.js → post-togglebutton-00632399.js} +1167 -42
- package/dist/cjs/{post-tooltip-8d7e64f6.js → post-tooltip-d3dd17b2.js} +31 -19
- package/dist/cjs/post-tooltip.cjs.entry.js +6 -4
- package/dist/cjs/slide-5d51abe8.js +28 -0
- package/dist/collection/animations/slide.js +23 -0
- package/dist/collection/collection-manifest.json +21 -3
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +26 -9
- package/dist/collection/components/post-avatar/post-avatar.css +3 -0
- package/dist/collection/components/post-avatar/post-avatar.js +237 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +107 -0
- package/dist/collection/components/post-banner/banner-types.js +1 -0
- package/dist/collection/components/post-banner/post-banner.css +3 -0
- package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +41 -69
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
- package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +161 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +93 -0
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +8 -8
- package/dist/collection/components/post-closebutton/post-closebutton.js +12 -0
- package/dist/collection/components/post-collapsible/post-collapsible.js +5 -3
- package/dist/collection/components/post-footer/post-footer.css +1 -0
- package/dist/collection/components/post-footer/post-footer.js +75 -0
- package/dist/collection/components/post-header/post-header.css +1 -0
- package/dist/collection/components/post-header/post-header.js +172 -0
- package/dist/collection/components/post-icon/post-icon.js +22 -30
- package/dist/collection/components/post-language-option/post-language-option.css +3 -0
- package/dist/collection/components/post-language-option/post-language-option.js +219 -0
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
- package/dist/collection/components/post-language-switch/post-language-switch.js +163 -0
- package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
- package/dist/collection/components/post-list/post-list.css +3 -0
- package/dist/collection/components/post-list/post-list.js +88 -0
- package/dist/collection/components/post-list-item/post-list-item.css +1 -0
- package/dist/collection/components/post-list-item/post-list-item.js +25 -0
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-logo/post-logo.js +2 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +52 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +158 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +104 -0
- package/dist/collection/components/post-menu/post-menu.css +3 -0
- package/dist/collection/components/post-menu/post-menu.js +280 -0
- package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +114 -0
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +2 -2
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +27 -7
- package/dist/collection/components/post-rating/post-rating.css +1 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +3 -2
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +3 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +6 -4
- package/dist/collection/components/post-tag/post-tag.css +1 -1
- package/dist/collection/components/post-tag/post-tag.js +2 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +74 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +29 -13
- package/dist/collection/index.js +20 -2
- package/dist/collection/utils/breakpoints.js +46 -0
- package/dist/collection/utils/get-focusable-children.js +27 -0
- package/dist/components/debounce.js +10 -0
- package/dist/components/get-root.js +9 -0
- package/dist/components/index.browser.js +13 -0
- package/dist/components/index.js +20 -2
- package/dist/components/index2.js +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +33 -13
- package/dist/components/post-accordion2.js +1 -1
- package/dist/components/post-avatar.d.ts +11 -0
- package/dist/components/post-avatar.js +6 -0
- package/dist/components/post-avatar2.js +173 -0
- package/dist/components/post-back-to-top.d.ts +11 -0
- package/dist/components/post-back-to-top.js +6 -0
- package/dist/components/post-back-to-top2.js +100 -0
- package/dist/components/post-banner.d.ts +11 -0
- package/dist/components/post-banner.js +6 -0
- package/dist/components/post-banner2.js +126 -0
- package/dist/components/post-breadcrumb-item.d.ts +11 -0
- package/dist/components/post-breadcrumb-item.js +6 -0
- package/dist/components/post-breadcrumb-item2.js +82 -0
- package/dist/components/post-breadcrumb.d.ts +11 -0
- package/dist/components/post-breadcrumb.js +6 -0
- package/dist/components/post-breadcrumb2.js +168 -0
- package/dist/components/post-card-control2.js +3 -3
- package/dist/components/post-closebutton.d.ts +11 -0
- package/dist/components/post-closebutton.js +6 -0
- package/dist/components/post-closebutton2.js +34 -0
- package/dist/components/post-collapsible-trigger2.js +2 -17
- package/dist/components/post-collapsible2.js +6 -4
- package/dist/components/post-footer.d.ts +11 -0
- package/dist/components/post-footer.js +6 -0
- package/dist/components/post-footer2.js +124 -0
- package/dist/components/post-header.d.ts +11 -0
- package/dist/components/post-header.js +6 -0
- package/dist/components/post-header2.js +279 -0
- package/dist/components/post-icon2.js +24 -28
- package/dist/components/post-language-option.d.ts +11 -0
- package/dist/components/post-language-option.js +6 -0
- package/dist/components/post-language-option2.js +98 -0
- package/dist/components/post-language-switch.d.ts +11 -0
- package/dist/components/post-language-switch.js +6 -0
- package/dist/components/post-language-switch2.js +135 -0
- package/dist/components/post-list-item.d.ts +11 -0
- package/dist/components/post-list-item.js +6 -0
- package/dist/components/post-list-item2.js +35 -0
- package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/dist/components/post-list.js +6 -0
- package/dist/components/post-list2.js +54 -0
- package/dist/components/post-logo2.js +3 -3
- package/dist/components/post-mainnavigation.d.ts +11 -0
- package/dist/components/post-mainnavigation.js +6 -0
- package/dist/components/post-mainnavigation2.js +48 -0
- package/dist/components/post-megadropdown-trigger.d.ts +11 -0
- package/dist/components/post-megadropdown-trigger.js +6 -0
- package/dist/components/post-megadropdown-trigger2.js +91 -0
- package/dist/components/post-megadropdown.d.ts +11 -0
- package/dist/components/post-megadropdown.js +6 -0
- package/dist/components/post-megadropdown2.js +100 -0
- package/dist/components/post-menu-item.d.ts +11 -0
- package/dist/components/post-menu-item.js +6 -0
- package/dist/components/post-menu-item2.js +27 -0
- package/dist/components/post-menu-trigger.d.ts +11 -0
- package/dist/components/post-menu-trigger.js +6 -0
- package/dist/components/post-menu-trigger2.js +102 -0
- package/dist/components/post-menu.d.ts +11 -0
- package/dist/components/post-menu.js +6 -0
- package/dist/components/post-menu2.js +204 -0
- package/dist/components/post-popover2.js +2 -2
- package/dist/components/post-popovercontainer2.js +95 -28
- package/dist/components/post-rating2.js +2 -2
- package/dist/components/post-tab-header2.js +4 -3
- package/dist/components/post-tab-panel2.js +3 -2
- package/dist/components/post-tabs2.js +7 -5
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/post-togglebutton.d.ts +11 -0
- package/dist/components/post-togglebutton.js +6 -0
- package/dist/components/post-togglebutton2.js +61 -0
- package/dist/components/post-tooltip2.js +29 -17
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +1875 -288
- package/dist/esm/check-type-8828dbe4.js +14 -0
- package/dist/esm/check-url-a974431e.js +12 -0
- package/dist/esm/debounce-abe98cc2.js +10 -0
- package/dist/esm/get-root-7af2e0d1.js +9 -0
- package/dist/esm/{index-0b56fc28.js → index-6bfe6554.js} +45 -16
- package/dist/esm/index-b49c9904.js +24 -0
- package/dist/esm/index.browser-51485f85.js +13 -0
- package/dist/esm/index.js +28 -19
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-cf78d928.js +3 -0
- package/dist/esm/{post-accordion-3a7b3f3c.js → post-accordion-25df8744.js} +3 -3
- package/dist/esm/post-accordion-item-33fb36df.js +62 -0
- package/dist/esm/post-accordion-item.entry.js +7 -4
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/post-avatar-731aafd6.js +146 -0
- package/dist/esm/post-avatar.entry.js +5 -0
- package/dist/esm/post-back-to-top-3a6b6203.js +73 -0
- package/dist/esm/post-back-to-top.entry.js +7 -0
- package/dist/esm/post-banner-b2eb796c.js +89 -0
- package/dist/esm/post-banner.entry.js +11 -0
- package/dist/esm/post-breadcrumb-0a99384c.js +109 -0
- package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
- package/dist/esm/post-breadcrumb.entry.js +5 -0
- package/dist/esm/post-card-control-ff272e38.js +270 -0
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/post-closebutton_15.entry.js +12 -0
- package/dist/esm/{post-collapsible-trigger-8d7e027b.js → post-collapsible-trigger-7fc4d61c.js} +11 -23
- package/dist/esm/post-collapsible_2.entry.js +8 -4
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer-97bbd770.js +82 -0
- package/dist/esm/post-footer.entry.js +3 -0
- package/dist/esm/post-menu-item-ae066299.js +66 -0
- package/dist/esm/{post-popover-972c5ea7.js → post-popover-62e33068.js} +4 -4
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-rating-cca784ae.js → post-rating-ee73a51b.js} +4 -4
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-dac84177.js +31 -0
- package/dist/esm/post-tab-header.entry.js +4 -3
- package/dist/esm/{post-tab-panel-633a5e6b.js → post-tab-panel-5e35e7df.js} +5 -4
- package/dist/esm/post-tab-panel.entry.js +4 -3
- package/dist/esm/{post-tabs-74ded897.js → post-tabs-b614a577.js} +9 -7
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tag-413626e4.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-popovercontainer-2485b7d9.js → post-togglebutton-caf0000b.js} +1154 -43
- package/dist/esm/{post-tooltip-0457467f.js → post-tooltip-b0f1b147.js} +31 -19
- package/dist/esm/post-tooltip.entry.js +6 -4
- package/dist/esm/slide-3422b8a3.js +25 -0
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-012a39b8.js +1 -0
- package/dist/post-components/p-0a74bc53.js +1 -0
- package/dist/post-components/p-0addae0c.entry.js +1 -0
- package/dist/post-components/p-0e216cc4.js +2 -0
- package/dist/post-components/p-128b11b3.js +1 -0
- package/dist/post-components/p-13ae0f4d.entry.js +1 -0
- package/dist/post-components/p-15173f46.js +1 -0
- package/dist/post-components/p-189a07cf.entry.js +1 -0
- package/dist/post-components/p-18b84db7.entry.js +1 -0
- package/dist/post-components/p-2571a1be.entry.js +1 -0
- package/dist/post-components/p-2747a945.js +1 -0
- package/dist/post-components/p-32165625.js +1 -0
- package/dist/post-components/p-42ef1d9f.entry.js +1 -0
- package/dist/post-components/p-465e9eee.entry.js +1 -0
- package/dist/post-components/p-4a3f67ab.js +1 -0
- package/dist/post-components/p-515e0f96.js +1 -0
- package/dist/post-components/p-5467b223.js +1 -0
- package/dist/post-components/p-5959f2bd.js +1 -0
- package/dist/post-components/p-60ea48ce.js +1 -0
- package/dist/post-components/p-61cff5d9.entry.js +1 -0
- package/dist/post-components/p-723ad003.entry.js +1 -0
- package/dist/post-components/p-73863597.js +1 -0
- package/dist/post-components/p-761723b6.js +1 -0
- package/dist/post-components/p-7c966321.js +1 -0
- package/dist/post-components/p-8e808ae6.js +1 -0
- package/dist/post-components/p-92611da2.entry.js +1 -0
- package/dist/post-components/p-990db73a.js +1 -0
- package/dist/post-components/p-99b12d43.entry.js +1 -0
- package/dist/post-components/p-9fbb33c2.entry.js +1 -0
- package/dist/post-components/p-a43a3cdb.js +1 -0
- package/dist/post-components/p-ad770600.entry.js +1 -0
- package/dist/post-components/p-af48ed67.entry.js +1 -0
- package/dist/post-components/p-b22656b1.js +1 -0
- package/dist/post-components/p-c4139fb9.js +1 -0
- package/dist/post-components/p-cc55b611.js +1 -0
- package/dist/post-components/{p-01a8fe6a.js → p-d45f8861.js} +3 -3
- package/dist/post-components/p-d4f93f2b.js +1 -0
- package/dist/post-components/p-dc11a5d5.entry.js +1 -0
- package/dist/post-components/{p-41094063.js → p-df9ea014.js} +1 -1
- package/dist/post-components/p-e1dc7f01.entry.js +1 -0
- package/dist/post-components/p-e533625e.js +1 -0
- package/dist/post-components/p-f0da081f.entry.js +1 -0
- package/dist/post-components/p-f380a026.entry.js +1 -0
- package/dist/post-components/p-fbcc89be.js +1 -0
- package/dist/post-components/p-fc91cbc2.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/slide.d.ts +2 -0
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +7 -1
- package/dist/types/components/post-avatar/post-avatar.d.ts +51 -0
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
- package/dist/types/components/post-banner/banner-types.d.ts +2 -0
- package/dist/types/components/post-banner/post-banner.d.ts +49 -0
- package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +16 -0
- package/dist/types/components/post-card-control/post-card-control.d.ts +7 -7
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
- package/dist/types/components/post-footer/post-footer.d.ts +23 -0
- package/dist/types/components/post-header/post-header.d.ts +33 -0
- package/dist/types/components/post-icon/post-icon.d.ts +3 -6
- package/dist/types/components/post-language-option/post-language-option.d.ts +45 -0
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
- package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
- package/dist/types/components/post-list/post-list.d.ts +24 -0
- package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
- package/dist/types/components/post-logo/post-logo.d.ts +1 -1
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +19 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +36 -0
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +25 -0
- package/dist/types/components/post-menu/post-menu.d.ts +48 -0
- package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +27 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +4 -0
- package/dist/types/components/post-tag/post-tag.d.ts +1 -1
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
- package/dist/types/components.d.ts +570 -44
- package/dist/types/index.d.ts +20 -2
- package/dist/types/utils/breakpoints.d.ts +11 -0
- package/dist/types/utils/get-focusable-children.d.ts +1 -0
- package/dist/types/utils/get-root.d.ts +1 -1
- package/loaders/debounce.js +10 -0
- package/loaders/get-root.js +9 -0
- package/loaders/index.browser.js +13 -0
- package/loaders/index.d.ts +38 -2
- package/loaders/index.js +20 -2
- package/loaders/index2.js +1 -1
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +1 -81
- package/loaders/post-accordion-item2.js +103 -0
- package/loaders/post-accordion.js +1 -1
- package/loaders/post-avatar.d.ts +11 -0
- package/loaders/post-avatar.js +176 -0
- package/loaders/post-back-to-top.d.ts +11 -0
- package/loaders/post-back-to-top.js +103 -0
- package/loaders/post-banner.d.ts +11 -0
- package/loaders/post-banner.js +129 -0
- package/loaders/post-breadcrumb-item.d.ts +11 -0
- package/loaders/post-breadcrumb-item.js +6 -0
- package/loaders/post-breadcrumb-item2.js +82 -0
- package/loaders/post-breadcrumb.d.ts +11 -0
- package/loaders/post-breadcrumb.js +171 -0
- package/loaders/post-card-control.js +3 -3
- package/loaders/post-closebutton.d.ts +11 -0
- package/loaders/post-closebutton.js +37 -0
- package/loaders/post-collapsible-trigger2.js +2 -17
- package/loaders/post-collapsible2.js +5 -3
- package/loaders/post-footer.d.ts +11 -0
- package/loaders/post-footer.js +127 -0
- package/loaders/post-header.d.ts +11 -0
- package/loaders/post-header.js +282 -0
- package/loaders/post-icon2.js +24 -28
- package/loaders/post-language-option.d.ts +11 -0
- package/loaders/post-language-option.js +101 -0
- package/loaders/post-language-switch.d.ts +11 -0
- package/loaders/post-language-switch.js +138 -0
- package/loaders/post-list-item.d.ts +11 -0
- package/loaders/post-list-item.js +38 -0
- package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/loaders/post-list.js +57 -0
- package/loaders/post-logo.js +4 -4
- package/loaders/post-mainnavigation.d.ts +11 -0
- package/loaders/post-mainnavigation.js +51 -0
- package/loaders/post-megadropdown-trigger.d.ts +11 -0
- package/loaders/post-megadropdown-trigger.js +94 -0
- package/loaders/post-megadropdown.d.ts +11 -0
- package/loaders/post-megadropdown.js +103 -0
- package/loaders/post-menu-item.d.ts +11 -0
- package/loaders/post-menu-item.js +6 -0
- package/loaders/post-menu-item2.js +27 -0
- package/loaders/post-menu-trigger.d.ts +11 -0
- package/loaders/post-menu-trigger.js +6 -0
- package/loaders/post-menu-trigger2.js +102 -0
- package/loaders/post-menu.d.ts +11 -0
- package/loaders/post-menu.js +6 -0
- package/loaders/post-menu2.js +204 -0
- package/loaders/post-popover.js +2 -2
- package/loaders/post-popovercontainer2.js +95 -28
- package/loaders/post-rating.js +2 -2
- package/loaders/post-tab-header.js +4 -3
- package/loaders/post-tab-panel.js +3 -2
- package/loaders/post-tabs.js +7 -5
- package/loaders/post-tag.js +2 -2
- package/loaders/post-togglebutton.d.ts +11 -0
- package/loaders/post-togglebutton.js +64 -0
- package/loaders/post-tooltip.js +28 -16
- package/loaders/slide.js +25 -0
- package/package.json +16 -13
- package/dist/cjs/post-accordion-item-dc4d1801.js +0 -51
- package/dist/cjs/post-alert-106c34ac.js +0 -98
- package/dist/cjs/post-alert.cjs.entry.js +0 -16
- package/dist/cjs/post-card-control-69769d1a.js +0 -272
- package/dist/cjs/post-icon-221d976f.js +0 -104
- package/dist/cjs/post-icon.cjs.entry.js +0 -15
- package/dist/cjs/post-logo-e6cb079f.js +0 -39
- package/dist/cjs/post-logo.cjs.entry.js +0 -14
- package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
- package/dist/cjs/post-tab-header-43310d08.js +0 -32
- package/dist/cjs/post-tag-d7ac3cbb.js +0 -47
- package/dist/collection/components/post-alert/alert-types.js +0 -1
- package/dist/collection/components/post-alert/post-alert.css +0 -7
- package/dist/components/post-alert.js +0 -6
- package/dist/components/post-alert2.js +0 -136
- package/dist/esm/index-f41b763f.js +0 -46
- package/dist/esm/package-bc6404e2.js +0 -3
- package/dist/esm/post-accordion-item-55d1e771.js +0 -49
- package/dist/esm/post-alert-6c908130.js +0 -96
- package/dist/esm/post-alert.entry.js +0 -8
- package/dist/esm/post-card-control-9fff6efc.js +0 -270
- package/dist/esm/post-icon-d59ad345.js +0 -102
- package/dist/esm/post-icon.entry.js +0 -7
- package/dist/esm/post-logo-a1487634.js +0 -37
- package/dist/esm/post-logo.entry.js +0 -6
- package/dist/esm/post-popovercontainer.entry.js +0 -3
- package/dist/esm/post-tab-header-dd2cb68e.js +0 -30
- package/dist/esm/post-tag-f60a71fd.js +0 -45
- package/dist/post-components/p-0e0c11f9.entry.js +0 -1
- package/dist/post-components/p-124fe6c8.js +0 -1
- package/dist/post-components/p-15c6739e.entry.js +0 -1
- package/dist/post-components/p-2180e02d.entry.js +0 -1
- package/dist/post-components/p-22ec06ae.entry.js +0 -1
- package/dist/post-components/p-26bbd8e5.entry.js +0 -1
- package/dist/post-components/p-2b43665d.js +0 -1
- package/dist/post-components/p-2d1f85f4.js +0 -1
- package/dist/post-components/p-464ce10a.entry.js +0 -1
- package/dist/post-components/p-51eff367.js +0 -1
- package/dist/post-components/p-586f7f53.entry.js +0 -1
- package/dist/post-components/p-65031b20.entry.js +0 -1
- package/dist/post-components/p-6d9c46f4.js +0 -1
- package/dist/post-components/p-6f12f3e5.js +0 -1
- package/dist/post-components/p-718eb560.js +0 -1
- package/dist/post-components/p-78407640.entry.js +0 -1
- package/dist/post-components/p-79a40235.entry.js +0 -1
- package/dist/post-components/p-7ab513fc.js +0 -1
- package/dist/post-components/p-9cba7d2f.js +0 -1
- package/dist/post-components/p-9eb27378.entry.js +0 -1
- package/dist/post-components/p-a528acc4.js +0 -1
- package/dist/post-components/p-aa8e43c3.js +0 -1
- package/dist/post-components/p-b68c86a7.js +0 -1
- package/dist/post-components/p-b8db0e0a.entry.js +0 -1
- package/dist/post-components/p-bcd5843c.entry.js +0 -1
- package/dist/post-components/p-c21b810d.js +0 -1
- package/dist/post-components/p-c386219b.js +0 -1
- package/dist/post-components/p-d2f9de94.js +0 -2
- package/dist/post-components/p-deb4131c.js +0 -1
- package/dist/post-components/p-e7c67ff0.entry.js +0 -1
- package/dist/post-components/p-f10e2bb1.entry.js +0 -1
- package/dist/types/components/post-alert/alert-types.d.ts +0 -2
- package/dist/types/components/post-alert/post-alert.d.ts +0 -54
- package/loaders/post-alert.js +0 -139
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @slot post-logo - Should be used together with the `<post-logo>` component.
|
|
7
|
+
* @slot meta-navigation - Holds an `<ul>` with meta navigation links.
|
|
8
|
+
* @slot post-togglebutton - Holds the mobile menu toggler.
|
|
9
|
+
* @slot post-language-switch - Should be used with the `<post-language-switch>` component.
|
|
10
|
+
* @slot title - Holds the application title.
|
|
11
|
+
* @slot default - Custom controls or content, right aligned in the local header.
|
|
12
|
+
* @slot post-mainnavigation - Has a default slot because it's only meant to be used in the `<post-header>`.
|
|
13
|
+
*/
|
|
14
|
+
export class PostHeader {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.scrollParent = null;
|
|
17
|
+
this.throttledScroll = () => this.handleScrollEvent();
|
|
18
|
+
this.throttledResize = throttle(50, () => this.handleResize());
|
|
19
|
+
this.device = null;
|
|
20
|
+
this.mobileMenuExtended = false;
|
|
21
|
+
}
|
|
22
|
+
componentWillRender() {
|
|
23
|
+
this.scrollParent = this.getScrollParent(this.host);
|
|
24
|
+
this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
|
|
25
|
+
window.addEventListener('resize', this.throttledResize, { passive: true });
|
|
26
|
+
this.handleResize();
|
|
27
|
+
this.handleScrollEvent();
|
|
28
|
+
}
|
|
29
|
+
frozeBody(isMobileMenuExtended) {
|
|
30
|
+
document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Toggles the mobile navigation.
|
|
34
|
+
*/
|
|
35
|
+
async toggleMobileMenu() {
|
|
36
|
+
if (this.device === 'desktop')
|
|
37
|
+
return;
|
|
38
|
+
this.mobileMenuAnimation = this.mobileMenuExtended
|
|
39
|
+
? slideUp(this.mobileMenu)
|
|
40
|
+
: slideDown(this.mobileMenu);
|
|
41
|
+
// Update the state of the toggle button
|
|
42
|
+
const menuButton = this.host.querySelector('post-togglebutton');
|
|
43
|
+
menuButton.toggled = !this.mobileMenuExtended;
|
|
44
|
+
// Toggle menu visibility before it slides down and after it slides back up
|
|
45
|
+
if (this.mobileMenuExtended)
|
|
46
|
+
await this.mobileMenuAnimation.finished;
|
|
47
|
+
this.mobileMenuExtended = !this.mobileMenuExtended;
|
|
48
|
+
if (!this.mobileMenuExtended)
|
|
49
|
+
await this.mobileMenuAnimation.finished;
|
|
50
|
+
}
|
|
51
|
+
handleScrollEvent() {
|
|
52
|
+
// Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
|
|
53
|
+
const st = Math.max(0, this.scrollParent instanceof Document
|
|
54
|
+
? this.scrollParent.documentElement.scrollTop
|
|
55
|
+
: this.scrollParent.scrollTop);
|
|
56
|
+
this.host.style.setProperty('--header-scroll-top', `${st}px`);
|
|
57
|
+
}
|
|
58
|
+
getScrollParent(node) {
|
|
59
|
+
let currentParent = node.parentElement;
|
|
60
|
+
while (currentParent) {
|
|
61
|
+
if (currentParent.nodeName === 'BODY') {
|
|
62
|
+
return document;
|
|
63
|
+
}
|
|
64
|
+
if (this.isScrollable(currentParent)) {
|
|
65
|
+
return currentParent;
|
|
66
|
+
}
|
|
67
|
+
currentParent = currentParent.parentElement;
|
|
68
|
+
}
|
|
69
|
+
return document;
|
|
70
|
+
}
|
|
71
|
+
isScrollable(node) {
|
|
72
|
+
if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const style = getComputedStyle(node);
|
|
76
|
+
return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
|
|
77
|
+
const value = style.getPropertyValue(propertyName);
|
|
78
|
+
return value === 'auto' || value === 'scroll';
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
handleResize() {
|
|
82
|
+
var _a;
|
|
83
|
+
const previousDevice = this.device;
|
|
84
|
+
let newDevice;
|
|
85
|
+
const width = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
86
|
+
if (width >= 1024) {
|
|
87
|
+
newDevice = 'desktop';
|
|
88
|
+
}
|
|
89
|
+
else if (width >= 600) {
|
|
90
|
+
newDevice = 'tablet';
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
newDevice = 'mobile';
|
|
94
|
+
}
|
|
95
|
+
// Close any open mobile menu
|
|
96
|
+
if (newDevice === 'desktop' && this.mobileMenuExtended) {
|
|
97
|
+
this.toggleMobileMenu();
|
|
98
|
+
this.mobileMenuAnimation.finish(); // no animation
|
|
99
|
+
}
|
|
100
|
+
const mhh = (_a = this.host.shadowRoot.querySelector('.title-header')) === null || _a === void 0 ? void 0 : _a.clientHeight;
|
|
101
|
+
this.host.style.setProperty('--main-header-height', `${mhh}px`);
|
|
102
|
+
// Apply only on change for doing work only when necessary
|
|
103
|
+
if (newDevice !== previousDevice) {
|
|
104
|
+
this.device = newDevice;
|
|
105
|
+
window.requestAnimationFrame(() => {
|
|
106
|
+
this.switchLanguageSwitchMode();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
switchLanguageSwitchMode() {
|
|
111
|
+
var _a;
|
|
112
|
+
const variant = this.device === 'desktop' ? 'menu' : 'list';
|
|
113
|
+
(_a = this.host.querySelector('post-language-switch')) === null || _a === void 0 ? void 0 : _a.setAttribute('variant', variant);
|
|
114
|
+
}
|
|
115
|
+
render() {
|
|
116
|
+
const navigationClasses = ['navigation'];
|
|
117
|
+
if (this.mobileMenuExtended) {
|
|
118
|
+
navigationClasses.push('extended');
|
|
119
|
+
}
|
|
120
|
+
return (h(Host, { key: '008e84568ce41249365d93169b2f94cd988601d0', version: version }, h("div", { key: 'f6415c30b3bfacd01a65166c7f0a3afc37676cc8', class: "global-header" }, h("div", { key: 'dc1465a3a68ce8c66c7da644d992c37d8d09ccc4', class: "global-sub" }, h("div", { key: '490b4afe502465bc20ccc41149533929987f2fab', class: "logo" }, h("slot", { key: '28ee1cdb2804f6315fffa2c319a1e2fa1e54ad08', name: "post-logo" }))), h("div", { key: '777d715f4718bb6738665f3d65c9ee4729a977de', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: 'c1ddbfdecc96fe3a6efb930d8475ee880059d372', name: "meta-navigation" }), h("slot", { key: 'df1ccf5c36ea4a05812c3983961389c42c42ddb9', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'ace2dda9a3f3d898934c7d47c84e2475fb555e5d', name: "post-language-switch" }), h("div", { key: '3e8d94d9534d5daaa2f8e6ca5cc0833e78a49224', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '58e3637f103411f5e577dba931caf884f46a6e47', name: "post-togglebutton" })))), h("div", { key: 'f90ff065ed795fc780c90768e5c0ab5a431bec8d', class: 'title-header ' + (this.mobileMenuExtended ? 'title-header-mobile-extended' : '') }, h("slot", { key: 'a1aaaf02da073b9e7de82e84c93745afa6a8c4e9', name: "title" }), h("div", { key: '84ae2f8b846536130967362de160e054049c8489', class: "global-sub" }, h("slot", { key: '8a845cd7f87b3a2c2fba7ffc1ace31e87f6329d9', name: "local-controls" }), h("slot", { key: 'f3822b883fc88436a84d3ca7f840946af992417e' }))), h("div", { key: '8e0390c6c2b9a71488eea73c9207d0c336c9b75d', ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { key: '5fc2db060eb962c313fc4c9ab67032e990ff54c6', name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { key: '7b9147dcf5de01865785d417c8d1966efb891ace', class: "navigation-footer" }, h("slot", { key: '6e163a7dad7b0b0fc02493cd15152179d4242980', name: "meta-navigation" }), h("slot", { key: 'e8fd19eeed8a99d69ccd8635e36cd0256ed4424b', name: "post-language-switch" }))))));
|
|
121
|
+
}
|
|
122
|
+
static get is() { return "post-header"; }
|
|
123
|
+
static get encapsulation() { return "shadow"; }
|
|
124
|
+
static get originalStyleUrls() {
|
|
125
|
+
return {
|
|
126
|
+
"$": ["./post-header.scss"]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
static get styleUrls() {
|
|
130
|
+
return {
|
|
131
|
+
"$": ["post-header.css"]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
static get states() {
|
|
135
|
+
return {
|
|
136
|
+
"device": {},
|
|
137
|
+
"mobileMenuExtended": {}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
static get methods() {
|
|
141
|
+
return {
|
|
142
|
+
"toggleMobileMenu": {
|
|
143
|
+
"complexType": {
|
|
144
|
+
"signature": "() => Promise<void>",
|
|
145
|
+
"parameters": [],
|
|
146
|
+
"references": {
|
|
147
|
+
"Promise": {
|
|
148
|
+
"location": "global",
|
|
149
|
+
"id": "global::Promise"
|
|
150
|
+
},
|
|
151
|
+
"HTMLPostTogglebuttonElement": {
|
|
152
|
+
"location": "global",
|
|
153
|
+
"id": "global::HTMLPostTogglebuttonElement"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"return": "Promise<void>"
|
|
157
|
+
},
|
|
158
|
+
"docs": {
|
|
159
|
+
"text": "Toggles the mobile navigation.",
|
|
160
|
+
"tags": []
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
static get elementRef() { return "host"; }
|
|
166
|
+
static get watchers() {
|
|
167
|
+
return [{
|
|
168
|
+
"propName": "mobileMenuExtended",
|
|
169
|
+
"methodName": "frozeBody"
|
|
170
|
+
}];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -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;
|
|
@@ -49,39 +47,39 @@ export class PostIcon {
|
|
|
49
47
|
validateScale(newValue = this.scale) {
|
|
50
48
|
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.validateName();
|
|
55
|
-
this.validateFlipH();
|
|
56
|
-
this.validateFlipV();
|
|
57
|
-
this.validateScale();
|
|
58
|
-
this.validateRotate();
|
|
59
|
-
this.validateAnimation();
|
|
60
|
-
}
|
|
61
|
-
componentWillRender() {
|
|
62
|
-
this.setPath();
|
|
63
|
-
}
|
|
64
|
-
setPath() {
|
|
65
|
-
var _a, _b, _c, _d;
|
|
50
|
+
getPath() {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
66
52
|
// Construct icon path from different possible sources
|
|
67
53
|
const metaBase = (_b = (_a = document.head
|
|
68
54
|
.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
|
|
55
|
+
const baseHref = (_c = document.getElementsByTagName('base')[0]) === null || _c === void 0 ? void 0 : _c.href;
|
|
56
|
+
const fileBase = `${(_f = (_e = (_d = this.base) !== null && _d !== void 0 ? _d : metaBase) !== null && _e !== void 0 ? _e : baseHref) !== null && _f !== void 0 ? _f : CDN_URL}/`.replace(/\/\/$/, '/');
|
|
70
57
|
const fileName = `${this.name}.svg`;
|
|
71
58
|
const filePath = `${fileBase}${fileName}`;
|
|
72
|
-
|
|
59
|
+
return new URL(filePath, window.location.origin).toString();
|
|
73
60
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
'-webkit-mask-image': `url(
|
|
78
|
-
'mask-image': `url('${
|
|
61
|
+
getStyles() {
|
|
62
|
+
const path = this.getPath();
|
|
63
|
+
return Object.entries({
|
|
64
|
+
'-webkit-mask-image': `url(${path})`,
|
|
65
|
+
'mask-image': `url('${path}')`,
|
|
79
66
|
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
80
67
|
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
81
68
|
})
|
|
82
69
|
.filter(([_key, value]) => value !== null)
|
|
83
70
|
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
84
|
-
|
|
71
|
+
}
|
|
72
|
+
componentDidLoad() {
|
|
73
|
+
this.validateBase();
|
|
74
|
+
this.validateName();
|
|
75
|
+
this.validateFlipH();
|
|
76
|
+
this.validateFlipV();
|
|
77
|
+
this.validateScale();
|
|
78
|
+
this.validateRotate();
|
|
79
|
+
this.validateAnimation();
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
return (h(Host, { key: '70e13e357929d2601de3b61f46f9a717ba491fd5', "data-version": version }, h("span", { key: 'a0c40175bfa6bd06f3498dc056685c8396b6e706', style: this.getStyles() })));
|
|
85
83
|
}
|
|
86
84
|
static get is() { return "post-icon"; }
|
|
87
85
|
static get encapsulation() { return "shadow"; }
|
|
@@ -229,12 +227,6 @@ export class PostIcon {
|
|
|
229
227
|
}
|
|
230
228
|
};
|
|
231
229
|
}
|
|
232
|
-
static get states() {
|
|
233
|
-
return {
|
|
234
|
-
"svgStyles": {},
|
|
235
|
-
"svgOutput": {}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
230
|
static get elementRef() { return "host"; }
|
|
239
231
|
static get watchers() {
|
|
240
232
|
return [{
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 by Swiss Post, Information Technology
|
|
3
|
+
*/post-language-option{display:inline-block}post-language-option button{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}post-language-option a{color:inherit;text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;height:100%;width:100%;padding:var(--post-language-option-padding);border-radius:2px}post-language-option :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){width:40px;height:40px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}post-language-option:where([variant=list]) :is(a,button)[aria-current=true],post-language-option:where([variant=list]) :is(a,button)[aria-current=page]{background-color:#050400;color:#fff}post-language-option:where([variant=list]) :is(a,button)[aria-current=true]:hover,post-language-option:where([variant=list]) :is(a,button)[aria-current=page]:hover{background-color:#504f4b}post-language-option:where([variant=menu]){width:100%}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative;left:-1px;width:calc(100% + 2px)}post-language-option:where([variant=menu]) :is(a,button)[aria-current=true]::after,post-language-option:where([variant=menu]) :is(a,button)[aria-current=page]::after{content:"";left:0;height:3px;background-color:#050400;width:100%;display:block;position:absolute;bottom:3px}post-language-option:where([variant=menu]) :is(a,button)[aria-current=true]:hover::after,post-language-option:where([variant=menu]) :is(a,button)[aria-current=page]:hover::after{background-color:#504f4b}post-language-option:where([variant=menu]) :is(a,button):hover{color:#504f4b}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { checkEmptyOrType, checkType } from "../../utils/index";
|
|
3
|
+
import { version } from "../../../../package";
|
|
4
|
+
/**
|
|
5
|
+
* @slot default - Slot for placing the content inside the anchor or button.
|
|
6
|
+
*/
|
|
7
|
+
export class PostLanguageOption {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.code = undefined;
|
|
10
|
+
this.active = undefined;
|
|
11
|
+
this.variant = undefined;
|
|
12
|
+
this.name = undefined;
|
|
13
|
+
this.url = undefined;
|
|
14
|
+
}
|
|
15
|
+
validateCode(value = this.code) {
|
|
16
|
+
checkType(value, 'string', 'The "code" property of the post-language-option component must be a string.');
|
|
17
|
+
}
|
|
18
|
+
validateActiveProp(value = this.active) {
|
|
19
|
+
checkEmptyOrType(value, 'boolean', 'The "active" property of the post-language-option component must be a boolean value.');
|
|
20
|
+
}
|
|
21
|
+
validateName(value = this.name) {
|
|
22
|
+
checkEmptyOrType(value, 'string', 'The "name" property of the post-language-option component must be a string.');
|
|
23
|
+
}
|
|
24
|
+
validateUrl(value = this.url) {
|
|
25
|
+
checkEmptyOrType(value, 'string', 'The "url" property of the post-language-option component must be a valid URL.');
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.validateCode();
|
|
29
|
+
this.validateActiveProp();
|
|
30
|
+
this.validateName();
|
|
31
|
+
this.validateUrl();
|
|
32
|
+
if (!this.name && this.isNameRequired()) {
|
|
33
|
+
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Selects the language option programmatically.
|
|
38
|
+
*/
|
|
39
|
+
async select() {
|
|
40
|
+
this.active = true;
|
|
41
|
+
this.emitChange();
|
|
42
|
+
}
|
|
43
|
+
emitChange() {
|
|
44
|
+
this.postChange.emit(this.code);
|
|
45
|
+
}
|
|
46
|
+
isNameRequired() {
|
|
47
|
+
return this.host.textContent.toLowerCase() === this.code.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const lang = this.code.toLowerCase();
|
|
51
|
+
const emitOnKeyDown = (e) => {
|
|
52
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
53
|
+
this.emitChange();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return (h(Host, { key: '6a7c4af5ab0a953cc2c70621efc6fff905638900', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
57
|
+
}
|
|
58
|
+
static get is() { return "post-language-option"; }
|
|
59
|
+
static get originalStyleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["post-language-option.scss"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get styleUrls() {
|
|
65
|
+
return {
|
|
66
|
+
"$": ["post-language-option.css"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get properties() {
|
|
70
|
+
return {
|
|
71
|
+
"code": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "string",
|
|
76
|
+
"resolved": "string",
|
|
77
|
+
"references": {}
|
|
78
|
+
},
|
|
79
|
+
"required": true,
|
|
80
|
+
"optional": false,
|
|
81
|
+
"docs": {
|
|
82
|
+
"tags": [],
|
|
83
|
+
"text": "The ISO 639 language code, formatted according to [RFC 5646 (also known as BCP 47)](https://datatracker.ietf.org/doc/html/rfc5646). For example, \"de\"."
|
|
84
|
+
},
|
|
85
|
+
"attribute": "code",
|
|
86
|
+
"reflect": false
|
|
87
|
+
},
|
|
88
|
+
"active": {
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"mutable": true,
|
|
91
|
+
"complexType": {
|
|
92
|
+
"original": "boolean",
|
|
93
|
+
"resolved": "boolean",
|
|
94
|
+
"references": {}
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"optional": false,
|
|
98
|
+
"docs": {
|
|
99
|
+
"tags": [],
|
|
100
|
+
"text": "If set to `true`, the language option is considered the current language for the page."
|
|
101
|
+
},
|
|
102
|
+
"attribute": "active",
|
|
103
|
+
"reflect": true
|
|
104
|
+
},
|
|
105
|
+
"variant": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "SwitchVariant | null",
|
|
110
|
+
"resolved": "\"list\" | \"menu\"",
|
|
111
|
+
"references": {
|
|
112
|
+
"SwitchVariant": {
|
|
113
|
+
"location": "import",
|
|
114
|
+
"path": "../post-language-switch/switch-variants",
|
|
115
|
+
"id": "src/components/post-language-switch/switch-variants.ts::SwitchVariant"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": true,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": "The variant of the post-language-switch parent (dynamically set by the parent)"
|
|
124
|
+
},
|
|
125
|
+
"attribute": "variant",
|
|
126
|
+
"reflect": false
|
|
127
|
+
},
|
|
128
|
+
"name": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"mutable": false,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "string",
|
|
133
|
+
"resolved": "string",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": "The full name of the language. For example, \"Deutsch\"."
|
|
141
|
+
},
|
|
142
|
+
"attribute": "name",
|
|
143
|
+
"reflect": false
|
|
144
|
+
},
|
|
145
|
+
"url": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "string",
|
|
150
|
+
"resolved": "string",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "The URL used for the href attribute of the internal anchor.\nThis field is optional; if not provided, a button will be used internally instead of an anchor."
|
|
158
|
+
},
|
|
159
|
+
"attribute": "url",
|
|
160
|
+
"reflect": false
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
static get events() {
|
|
165
|
+
return [{
|
|
166
|
+
"method": "postChange",
|
|
167
|
+
"name": "postChange",
|
|
168
|
+
"bubbles": true,
|
|
169
|
+
"cancelable": true,
|
|
170
|
+
"composed": true,
|
|
171
|
+
"docs": {
|
|
172
|
+
"tags": [],
|
|
173
|
+
"text": "An event emitted when the language option is clicked. The payload is the ISO 639 code of the language."
|
|
174
|
+
},
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string",
|
|
177
|
+
"resolved": "string",
|
|
178
|
+
"references": {}
|
|
179
|
+
}
|
|
180
|
+
}];
|
|
181
|
+
}
|
|
182
|
+
static get methods() {
|
|
183
|
+
return {
|
|
184
|
+
"select": {
|
|
185
|
+
"complexType": {
|
|
186
|
+
"signature": "() => Promise<void>",
|
|
187
|
+
"parameters": [],
|
|
188
|
+
"references": {
|
|
189
|
+
"Promise": {
|
|
190
|
+
"location": "global",
|
|
191
|
+
"id": "global::Promise"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"return": "Promise<void>"
|
|
195
|
+
},
|
|
196
|
+
"docs": {
|
|
197
|
+
"text": "Selects the language option programmatically.",
|
|
198
|
+
"tags": []
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
static get elementRef() { return "host"; }
|
|
204
|
+
static get watchers() {
|
|
205
|
+
return [{
|
|
206
|
+
"propName": "code",
|
|
207
|
+
"methodName": "validateCode"
|
|
208
|
+
}, {
|
|
209
|
+
"propName": "active",
|
|
210
|
+
"methodName": "validateActiveProp"
|
|
211
|
+
}, {
|
|
212
|
+
"propName": "name",
|
|
213
|
+
"methodName": "validateName"
|
|
214
|
+
}, {
|
|
215
|
+
"propName": "url",
|
|
216
|
+
"methodName": "validateUrl"
|
|
217
|
+
}];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:host{display:block}@media screen and (max-width: 1023.99px){:host{display:flex !important;gap:.5rem}}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:var(--post-core-dimension-6);border-radius:var(--post-core-dimension-24);font-size:var(--post-core-font-size-16);padding:var(--post-core-dimension-3) var(--post-core-dimension-10)}.post-language-switch-trigger{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:var(--post-core-dimension-16);width:var(--post-core-dimension-16)}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { checkEmptyOrOneOf, checkType } from "../../utils/index";
|
|
3
|
+
import { version } from "../../../../package";
|
|
4
|
+
import { SWITCH_VARIANTS } from "./switch-variants";
|
|
5
|
+
import { nanoid } from "nanoid";
|
|
6
|
+
export class PostLanguageSwitch {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.menuId = `p${nanoid(11)}`;
|
|
9
|
+
this.caption = undefined;
|
|
10
|
+
this.description = undefined;
|
|
11
|
+
this.variant = 'list';
|
|
12
|
+
this.activeLang = undefined;
|
|
13
|
+
}
|
|
14
|
+
validateCaption(value = this.caption) {
|
|
15
|
+
checkType(value, 'string', 'The "caption" property of the post-language-switch component must be a string.');
|
|
16
|
+
}
|
|
17
|
+
validateDescription(value = this.description) {
|
|
18
|
+
checkType(value, 'string', 'The "description" property of the post-language-switch component must be a string.');
|
|
19
|
+
}
|
|
20
|
+
validateVariant(value = this.variant) {
|
|
21
|
+
checkEmptyOrOneOf(value, SWITCH_VARIANTS, `The "variant" property of the post-language-switch component must be: ${SWITCH_VARIANTS.join(', ')}`);
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
this.updateChildrenVariant();
|
|
25
|
+
// Get the active language based on children's active state
|
|
26
|
+
this.activeLang = Array.from(this.host.querySelectorAll('post-language-option'))
|
|
27
|
+
.find(el => el.getAttribute('active') == 'true')
|
|
28
|
+
.getAttribute('code');
|
|
29
|
+
}
|
|
30
|
+
// Update post-language-option variant to have the correct style
|
|
31
|
+
updateChildrenVariant() {
|
|
32
|
+
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
33
|
+
el.setAttribute('variant', this.variant);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
componentWillUpdate() {
|
|
37
|
+
this.updateChildrenVariant();
|
|
38
|
+
}
|
|
39
|
+
componentDidLoad() {
|
|
40
|
+
this.validateCaption();
|
|
41
|
+
this.validateDescription();
|
|
42
|
+
this.validateVariant();
|
|
43
|
+
// Detects a change in the active language
|
|
44
|
+
this.host.addEventListener('postChange', (el) => {
|
|
45
|
+
this.activeLang = el.detail;
|
|
46
|
+
// Update the active state in the children post-language-option components
|
|
47
|
+
this.host.querySelectorAll('post-language-option').forEach(lang => {
|
|
48
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
49
|
+
lang.setAttribute('active', 'true');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
lang.setAttribute('active', 'false');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// Hides the dropdown when an option has been clicked
|
|
56
|
+
if (this.variant === 'menu') {
|
|
57
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
58
|
+
menu.toggle(menu);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
renderList() {
|
|
63
|
+
return (h(Host, { "data-version": version, "aria-label": `${this.caption}, ${this.description}`, "aria-role": "list" }, h("slot", null)));
|
|
64
|
+
}
|
|
65
|
+
renderDropdown() {
|
|
66
|
+
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": `${this.caption}, ${this.description}` }, this.activeLang.toUpperCase(), h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container" }, h("slot", null))));
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
70
|
+
}
|
|
71
|
+
static get is() { return "post-language-switch"; }
|
|
72
|
+
static get encapsulation() { return "shadow"; }
|
|
73
|
+
static get originalStyleUrls() {
|
|
74
|
+
return {
|
|
75
|
+
"$": ["post-language-switch.scss"]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static get styleUrls() {
|
|
79
|
+
return {
|
|
80
|
+
"$": ["post-language-switch.css"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
static get properties() {
|
|
84
|
+
return {
|
|
85
|
+
"caption": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"mutable": false,
|
|
88
|
+
"complexType": {
|
|
89
|
+
"original": "string",
|
|
90
|
+
"resolved": "string",
|
|
91
|
+
"references": {}
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"optional": false,
|
|
95
|
+
"docs": {
|
|
96
|
+
"tags": [],
|
|
97
|
+
"text": "A title for the list of language options"
|
|
98
|
+
},
|
|
99
|
+
"attribute": "caption",
|
|
100
|
+
"reflect": false
|
|
101
|
+
},
|
|
102
|
+
"description": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "string",
|
|
107
|
+
"resolved": "string",
|
|
108
|
+
"references": {}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": "A descriptive text for the list of language options"
|
|
115
|
+
},
|
|
116
|
+
"attribute": "description",
|
|
117
|
+
"reflect": false
|
|
118
|
+
},
|
|
119
|
+
"variant": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"mutable": false,
|
|
122
|
+
"complexType": {
|
|
123
|
+
"original": "SwitchVariant",
|
|
124
|
+
"resolved": "\"list\" | \"menu\"",
|
|
125
|
+
"references": {
|
|
126
|
+
"SwitchVariant": {
|
|
127
|
+
"location": "import",
|
|
128
|
+
"path": "./switch-variants",
|
|
129
|
+
"id": "src/components/post-language-switch/switch-variants.ts::SwitchVariant"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": "Variant that determines the rendering of the language switch either as a list (used on mobile in the header) or a dropdown (used on desktop in the header)"
|
|
138
|
+
},
|
|
139
|
+
"attribute": "variant",
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"defaultValue": "'list'"
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
static get states() {
|
|
146
|
+
return {
|
|
147
|
+
"activeLang": {}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
static get elementRef() { return "host"; }
|
|
151
|
+
static get watchers() {
|
|
152
|
+
return [{
|
|
153
|
+
"propName": "caption",
|
|
154
|
+
"methodName": "validateCaption"
|
|
155
|
+
}, {
|
|
156
|
+
"propName": "description",
|
|
157
|
+
"methodName": "validateDescription"
|
|
158
|
+
}, {
|
|
159
|
+
"propName": "variant",
|
|
160
|
+
"methodName": "validateVariant"
|
|
161
|
+
}];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SWITCH_VARIANTS = ['list', 'menu'];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 by Swiss Post, Information Technology
|
|
3
|
+
*/post-list{display:flex;flex-direction:column;gap:var(--post-list-title-gap, 0)}post-list>[role=list]{display:flex;flex-direction:column;gap:var(--post-list-item-gap, 0)}post-list:where([horizontal]:not([horizontal=false])){flex-direction:row;align-items:center}post-list:where([horizontal]:not([horizontal=false]))>[role=list]{flex-direction:row;align-items:center}post-list>.list-title.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}post-list>.list-title.visually-hidden:not(caption){position:absolute !important}
|