@swisspost/design-system-components 9.0.0-next.21 → 9.0.0-next.23

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.
Files changed (182) hide show
  1. package/dist/cjs/breakpoints-c6247c71.js +54 -0
  2. package/dist/cjs/index.cjs.js +21 -20
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{package-c6bc9e82.js → package-fdebc7ce.js} +1 -1
  5. package/dist/cjs/{post-accordion-d1345784.js → post-accordion-d6ddb379.js} +1 -1
  6. package/dist/cjs/{post-accordion-item-a796d803.js → post-accordion-item-61aed72f.js} +1 -1
  7. package/dist/cjs/post-accordion-item.cjs.entry.js +2 -2
  8. package/dist/cjs/post-accordion.cjs.entry.js +2 -2
  9. package/dist/cjs/{post-avatar-b4e96354.js → post-avatar-b5d6aaa9.js} +1 -1
  10. package/dist/cjs/post-avatar.cjs.entry.js +2 -2
  11. package/dist/cjs/{post-back-to-top-fc541c6b.js → post-back-to-top-80cbf486.js} +1 -1
  12. package/dist/cjs/post-back-to-top.cjs.entry.js +2 -2
  13. package/dist/cjs/{post-banner-46522b4f.js → post-banner-72f433b1.js} +1 -1
  14. package/dist/cjs/post-banner.cjs.entry.js +2 -2
  15. package/dist/cjs/{post-breadcrumb-799d34da.js → post-breadcrumb-63107527.js} +1 -1
  16. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +2 -2
  17. package/dist/cjs/post-breadcrumb.cjs.entry.js +2 -2
  18. package/dist/cjs/{post-card-control-7bf7d3f2.js → post-card-control-dfb221d5.js} +1 -1
  19. package/dist/cjs/post-card-control.cjs.entry.js +2 -2
  20. package/dist/cjs/post-closebutton_15.cjs.entry.js +3 -2
  21. package/dist/cjs/{post-collapsible-trigger-0568e3ec.js → post-collapsible-trigger-e24eae7e.js} +1 -1
  22. package/dist/cjs/post-collapsible_2.cjs.entry.js +2 -2
  23. package/dist/cjs/post-components.cjs.js +1 -1
  24. package/dist/cjs/{post-footer-f87a556b.js → post-footer-cfa3cc4c.js} +3 -53
  25. package/dist/cjs/post-footer.cjs.entry.js +3 -2
  26. package/dist/cjs/{post-linkarea-0ccf93fc.js → post-linkarea-9e808259.js} +1 -1
  27. package/dist/cjs/post-linkarea.cjs.entry.js +2 -2
  28. package/dist/cjs/{post-menu-item-eba24c40.js → post-menu-item-0e147e2c.js} +1 -1
  29. package/dist/cjs/{post-popover-35f679f6.js → post-popover-bddabf57.js} +1 -1
  30. package/dist/cjs/post-popover.cjs.entry.js +2 -2
  31. package/dist/cjs/{post-rating-d12fa214.js → post-rating-f4c48349.js} +1 -1
  32. package/dist/cjs/post-rating.cjs.entry.js +2 -2
  33. package/dist/cjs/{post-tab-header-89dca04b.js → post-tab-header-246cd064.js} +1 -1
  34. package/dist/cjs/post-tab-header.cjs.entry.js +2 -2
  35. package/dist/cjs/{post-tab-panel-ad1ab180.js → post-tab-panel-0e494e5c.js} +1 -1
  36. package/dist/cjs/post-tab-panel.cjs.entry.js +2 -2
  37. package/dist/cjs/{post-tabs-0db75745.js → post-tabs-3ead6ac7.js} +1 -1
  38. package/dist/cjs/post-tabs.cjs.entry.js +2 -2
  39. package/dist/cjs/{post-tag-396a46c9.js → post-tag-f62abd13.js} +1 -1
  40. package/dist/cjs/post-tag.cjs.entry.js +2 -2
  41. package/dist/cjs/{post-togglebutton-69983699.js → post-togglebutton-63708f9f.js} +84 -50
  42. package/dist/cjs/{post-tooltip-7174ea97.js → post-tooltip-2f80afc8.js} +1 -1
  43. package/dist/cjs/post-tooltip.cjs.entry.js +2 -2
  44. package/dist/collection/components/post-header/post-header.css +1 -1
  45. package/dist/collection/components/post-header/post-header.js +50 -33
  46. package/dist/collection/components/post-language-option/post-language-option.css +1 -1
  47. package/dist/collection/components/post-language-switch/post-language-switch.js +1 -1
  48. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  49. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +16 -4
  50. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  51. package/dist/collection/components/post-megadropdown/post-megadropdown.js +15 -10
  52. package/dist/components/breakpoints.js +52 -0
  53. package/dist/components/package.js +1 -1
  54. package/dist/components/post-footer2.js +1 -51
  55. package/dist/components/post-header2.js +184 -34
  56. package/dist/components/post-language-option2.js +1 -1
  57. package/dist/components/post-language-switch2.js +1 -1
  58. package/dist/components/post-mainnavigation2.js +17 -5
  59. package/dist/components/post-megadropdown2.js +15 -10
  60. package/dist/docs.json +2 -2
  61. package/dist/esm/breakpoints-bbe0c54e.js +52 -0
  62. package/dist/esm/index.js +21 -20
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/package-30b5445a.js +3 -0
  65. package/dist/esm/{post-accordion-f6d1834d.js → post-accordion-72896a6b.js} +1 -1
  66. package/dist/esm/{post-accordion-item-7cb93300.js → post-accordion-item-42446f00.js} +1 -1
  67. package/dist/esm/post-accordion-item.entry.js +2 -2
  68. package/dist/esm/post-accordion.entry.js +2 -2
  69. package/dist/esm/{post-avatar-96108967.js → post-avatar-3d552832.js} +1 -1
  70. package/dist/esm/post-avatar.entry.js +2 -2
  71. package/dist/esm/{post-back-to-top-7f8a61c8.js → post-back-to-top-dbfe00b0.js} +1 -1
  72. package/dist/esm/post-back-to-top.entry.js +2 -2
  73. package/dist/esm/{post-banner-bb69bce8.js → post-banner-3ec35c25.js} +1 -1
  74. package/dist/esm/post-banner.entry.js +2 -2
  75. package/dist/esm/{post-breadcrumb-9d9efa4e.js → post-breadcrumb-640a1b7a.js} +1 -1
  76. package/dist/esm/post-breadcrumb-item_2.entry.js +2 -2
  77. package/dist/esm/post-breadcrumb.entry.js +2 -2
  78. package/dist/esm/{post-card-control-fdced7d5.js → post-card-control-549f9ac0.js} +1 -1
  79. package/dist/esm/post-card-control.entry.js +2 -2
  80. package/dist/esm/post-closebutton_15.entry.js +3 -2
  81. package/dist/esm/{post-collapsible-trigger-17b2f067.js → post-collapsible-trigger-76749a79.js} +1 -1
  82. package/dist/esm/post-collapsible_2.entry.js +2 -2
  83. package/dist/esm/post-components.js +1 -1
  84. package/dist/esm/{post-footer-2dcd8159.js → post-footer-2fb4d20e.js} +2 -52
  85. package/dist/esm/post-footer.entry.js +3 -2
  86. package/dist/esm/{post-linkarea-06c5144d.js → post-linkarea-d7dbf30c.js} +1 -1
  87. package/dist/esm/post-linkarea.entry.js +2 -2
  88. package/dist/esm/{post-menu-item-e917bf99.js → post-menu-item-80d44823.js} +1 -1
  89. package/dist/esm/{post-popover-67a3cbf2.js → post-popover-1fb2446b.js} +1 -1
  90. package/dist/esm/post-popover.entry.js +2 -2
  91. package/dist/esm/{post-rating-9613bee8.js → post-rating-e9a95e85.js} +1 -1
  92. package/dist/esm/post-rating.entry.js +2 -2
  93. package/dist/esm/{post-tab-header-dff3a025.js → post-tab-header-aa2be14d.js} +1 -1
  94. package/dist/esm/post-tab-header.entry.js +2 -2
  95. package/dist/esm/{post-tab-panel-2b3f82a8.js → post-tab-panel-15f4254a.js} +1 -1
  96. package/dist/esm/post-tab-panel.entry.js +2 -2
  97. package/dist/esm/{post-tabs-46d1165f.js → post-tabs-07612298.js} +1 -1
  98. package/dist/esm/post-tabs.entry.js +2 -2
  99. package/dist/esm/{post-tag-4176268e.js → post-tag-b9d3bb0f.js} +1 -1
  100. package/dist/esm/post-tag.entry.js +2 -2
  101. package/dist/esm/{post-togglebutton-5892c5bd.js → post-togglebutton-5f0e2508.js} +84 -50
  102. package/dist/esm/{post-tooltip-5a45a569.js → post-tooltip-b1309328.js} +1 -1
  103. package/dist/esm/post-tooltip.entry.js +2 -2
  104. package/dist/post-components/index.esm.js +1 -1
  105. package/dist/post-components/p-32caa5d5.entry.js +1 -0
  106. package/dist/post-components/{p-fe8c300c.js → p-33963539.js} +1 -1
  107. package/dist/post-components/p-3994c72c.entry.js +1 -0
  108. package/dist/post-components/p-442957b7.entry.js +1 -0
  109. package/dist/post-components/p-449caeba.entry.js +1 -0
  110. package/dist/post-components/{p-04895a54.js → p-4f6694d4.js} +1 -1
  111. package/dist/post-components/p-513e4b41.entry.js +1 -0
  112. package/dist/post-components/{p-b9bf5a5f.js → p-530bedb1.js} +1 -1
  113. package/dist/post-components/{p-52790b8b.js → p-534ca692.js} +1 -1
  114. package/dist/post-components/p-5556960c.entry.js +1 -0
  115. package/dist/post-components/p-590c8681.entry.js +1 -0
  116. package/dist/post-components/p-5aeb3656.js +1 -0
  117. package/dist/post-components/p-68e0803e.entry.js +1 -0
  118. package/dist/post-components/p-6be78a63.entry.js +1 -0
  119. package/dist/post-components/{p-67a45f16.js → p-745ce238.js} +1 -1
  120. package/dist/post-components/{p-4f41f63e.js → p-75627a39.js} +1 -1
  121. package/dist/post-components/{p-59ca0a13.js → p-7b526da4.js} +1 -1
  122. package/dist/post-components/{p-2b1281af.js → p-7c08cad2.js} +1 -1
  123. package/dist/post-components/{p-12a11565.js → p-819f6f7e.js} +1 -1
  124. package/dist/post-components/p-8891c692.entry.js +1 -0
  125. package/dist/post-components/p-88b5add2.js +1 -0
  126. package/dist/post-components/{p-12573893.js → p-9f986e3d.js} +1 -1
  127. package/dist/post-components/p-a1cbef0b.entry.js +1 -0
  128. package/dist/post-components/{p-79c552fb.js → p-b1b5248c.js} +1 -1
  129. package/dist/post-components/p-b54c207a.js +1 -0
  130. package/dist/post-components/{p-803b7598.js → p-b559d89c.js} +1 -1
  131. package/dist/post-components/{p-98fcf90b.entry.js → p-b5f43c76.entry.js} +1 -1
  132. package/dist/post-components/{p-47cb31dd.js → p-b6e041ee.js} +1 -1
  133. package/dist/post-components/{p-30af1d48.js → p-bbf9ba02.js} +1 -1
  134. package/dist/post-components/p-ca01c184.js +1 -0
  135. package/dist/post-components/{p-07a0a626.js → p-d993dd37.js} +1 -1
  136. package/dist/post-components/p-d9e7aec4.entry.js +1 -0
  137. package/dist/post-components/p-da18066a.entry.js +1 -0
  138. package/dist/post-components/{p-dd4a5c0a.entry.js → p-e2da4e76.entry.js} +1 -1
  139. package/dist/post-components/p-e3d794b1.entry.js +1 -0
  140. package/dist/post-components/{p-c6b3a926.js → p-eba6a679.js} +1 -1
  141. package/dist/post-components/p-f175148d.entry.js +1 -0
  142. package/dist/post-components/{p-017dc6c7.js → p-f1995b47.js} +1 -1
  143. package/dist/post-components/p-f5a940f4.entry.js +1 -0
  144. package/dist/post-components/p-fcb60a95.entry.js +1 -0
  145. package/dist/post-components/post-components.esm.js +1 -1
  146. package/dist/types/components/post-header/post-header.d.ts +7 -5
  147. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +1 -0
  148. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +5 -3
  149. package/dist/types/components.d.ts +3 -0
  150. package/loaders/breakpoints.js +52 -0
  151. package/loaders/index.js +2 -1
  152. package/loaders/package.js +1 -1
  153. package/loaders/post-footer.js +1 -51
  154. package/loaders/post-header.js +184 -34
  155. package/loaders/post-language-option.js +1 -1
  156. package/loaders/post-language-switch.js +1 -1
  157. package/loaders/post-mainnavigation.js +17 -5
  158. package/loaders/post-megadropdown.js +15 -10
  159. package/package.json +3 -3
  160. package/dist/components/index3.js +0 -135
  161. package/dist/esm/package-5614c98b.js +0 -3
  162. package/dist/post-components/p-0227b899.js +0 -1
  163. package/dist/post-components/p-04c38bfe.entry.js +0 -1
  164. package/dist/post-components/p-1289b0a7.entry.js +0 -1
  165. package/dist/post-components/p-1542a80e.entry.js +0 -1
  166. package/dist/post-components/p-254a9bd2.entry.js +0 -1
  167. package/dist/post-components/p-28500934.entry.js +0 -1
  168. package/dist/post-components/p-2c69e7f2.entry.js +0 -1
  169. package/dist/post-components/p-30132b19.entry.js +0 -1
  170. package/dist/post-components/p-3bdeb686.entry.js +0 -1
  171. package/dist/post-components/p-5aaa5703.entry.js +0 -1
  172. package/dist/post-components/p-6d8ac9bd.entry.js +0 -1
  173. package/dist/post-components/p-77cc2a5e.entry.js +0 -1
  174. package/dist/post-components/p-7dd05e6d.entry.js +0 -1
  175. package/dist/post-components/p-994fae4c.entry.js +0 -1
  176. package/dist/post-components/p-a805515a.entry.js +0 -1
  177. package/dist/post-components/p-b5b48f66.entry.js +0 -1
  178. package/dist/post-components/p-c9dd3cdb.entry.js +0 -1
  179. package/dist/post-components/p-cb5e4a06.js +0 -1
  180. package/dist/post-components/p-e6d54838.entry.js +0 -1
  181. package/dist/post-components/p-f4b0cc7d.js +0 -1
  182. package/loaders/index3.js +0 -135
@@ -1 +1 @@
1
- *,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}: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:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.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{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left: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;border-block-end:1px solid #e1e0dc}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@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{border-bottom:1px solid #e1e0dc}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@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;background:#fff;inset-block-end:calc(100dvh - var(--header-height))}::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{height:calc(100dvh - var(--header-height));display:flex;flex-direction:column}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){background-color:#fafafa;gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}
1
+ *,::before,::after{box-sizing:border-box}:host{z-index:1020;position:relative}: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:calc((var(--global-header-height) - var(--global-header-reduced-height))*-1)}}.global-sub{display:flex;align-items:center;gap:24px}.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{height:calc(var(--global-header-height) - var(--header-scroll-top))}}::slotted(ul){margin-block:0 !important;list-style:none;display:flex;padding-left: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;bottom:-1px;z-index:1}@media screen and (min-width: 1024px){.local-header{z-index:3;inset-block-start:calc(-1*(var(--local-header-height) - var(--main-navigation-height)) + var(--global-header-reduced-height));padding-block-start:18px;box-shadow:var(--post-device-elevation-300)}}@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{bottom:0}.local-header:not(.local-header-mobile-extended){box-shadow:var(--post-device-elevation-300)}}.local-sub{margin-inline-end:16px}::slotted(.list-inline){margin:0 !important;z-index:3 !important;position:relative !important}::slotted(h1){margin:0 !important;flex-shrink:10;z-index:3}@media screen and (min-width: 600px){::slotted(h1){margin-inline-start:12px !important}}@media screen and (max-width: 599.98px){::slotted(h1){margin-inline-start:8px !important}}@media screen and (min-width: 1024px){::slotted(h1){font-size:28px !important;line-height:34px !important}}@media screen and (max-width: 1023.98px){::slotted(h1){font-size:20px !important;max-width:calc(100vw - 8px - 16px)}}@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;background:#fff;inset-block-end:calc(100dvh - var(--header-height))}::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{height:calc(100dvh - var(--header-height));display:flex;flex-direction:column}.navigation.extended.scroll-y{overflow-y:auto}.navigation.extended ::slotted(post-mainnavigation){flex-grow:1 !important}::slotted(post-mainnavigation){background-color:#fafafa;gap:32px}.navigation-footer{background-color:#f0efed;gap:24px}}@media screen and (max-width: 599.98px){::slotted(post-mainnavigation),.navigation-footer{padding-inline:16px}}
@@ -16,17 +16,23 @@ export class PostHeader {
16
16
  constructor() {
17
17
  this.device = null;
18
18
  this.mobileMenuExtended = false;
19
+ this.megadropdownOpen = false;
19
20
  }
20
21
  firstFocusableEl;
21
22
  lastFocusableEl;
22
- scrollParent = null;
23
+ scrollListenerElement = null;
24
+ overflowElement = null;
23
25
  mobileMenu;
24
26
  mobileMenuAnimation;
25
27
  throttledScroll = () => this.handleScrollEvent();
26
28
  throttledResize = throttle(50, () => this.handleResize());
27
29
  componentWillRender() {
28
- this.scrollParent = this.getScrollParent(this.host);
29
- this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
30
+ this.scrollListenerElement = this.getScrollParent();
31
+ this.overflowElement =
32
+ this.scrollListenerElement === document
33
+ ? document.documentElement
34
+ : this.scrollListenerElement;
35
+ this.scrollListenerElement.addEventListener('scroll', this.throttledScroll, { passive: true });
30
36
  window.addEventListener('resize', this.throttledResize, { passive: true });
31
37
  this.handleResize();
32
38
  this.handleScrollEvent();
@@ -34,18 +40,24 @@ export class PostHeader {
34
40
  }
35
41
  componentDidLoad() {
36
42
  this.updateLocalHeaderHeight();
43
+ // Check if the mega dropdown is expanded
44
+ document.addEventListener('postToggleMegadropdown', (event) => {
45
+ this.megadropdownOpen = event.detail.isVisible;
46
+ });
47
+ this.host.addEventListener('click', this.handleLinkClick.bind(this));
37
48
  }
38
49
  // Clean up possible side effects when post-header is disconnected
39
50
  disconnectedCallback() {
40
51
  this.mobileMenuExtended = false;
41
- document.body.style.overflow = '';
52
+ this.overflowElement.style.overflow = '';
42
53
  this.host.removeEventListener('keydown', e => {
43
54
  this.keyboardHandler(e);
44
55
  });
56
+ this.host.removeEventListener('click', this.handleLinkClick.bind(this));
45
57
  }
46
58
  host;
47
59
  frozeBody(isMobileMenuExtended) {
48
- document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
60
+ this.overflowElement.style.overflow = isMobileMenuExtended ? 'hidden' : '';
49
61
  if (isMobileMenuExtended) {
50
62
  this.host.addEventListener('keydown', e => {
51
63
  this.keyboardHandler(e);
@@ -110,42 +122,43 @@ export class PostHeader {
110
122
  }
111
123
  }
112
124
  }
125
+ getScrollParent() {
126
+ let parent = this.host.parentElement;
127
+ if (parent.tagName === 'BODY') {
128
+ parent = document;
129
+ }
130
+ return parent;
131
+ }
113
132
  handleScrollEvent() {
114
133
  // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
115
- const st = Math.max(0, this.scrollParent instanceof Document
116
- ? this.scrollParent.documentElement.scrollTop
117
- : this.scrollParent.scrollTop);
134
+ const st = Math.max(0, this.scrollListenerElement instanceof Document
135
+ ? this.scrollListenerElement.documentElement.scrollTop
136
+ : this.scrollListenerElement.scrollTop);
118
137
  this.host.style.setProperty('--header-scroll-top', `${st}px`);
119
138
  }
120
- getScrollParent(node) {
121
- let currentParent = node.parentElement;
122
- while (currentParent) {
123
- if (currentParent.nodeName === 'BODY') {
124
- return document;
125
- }
126
- if (this.isScrollable(currentParent)) {
127
- return currentParent;
128
- }
129
- currentParent = currentParent.parentElement;
130
- }
131
- return document;
132
- }
133
- isScrollable(node) {
134
- if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
135
- return false;
136
- }
137
- const style = getComputedStyle(node);
138
- return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
139
- const value = style.getPropertyValue(propertyName);
140
- return value === 'auto' || value === 'scroll';
141
- });
142
- }
143
139
  updateLocalHeaderHeight() {
144
140
  requestAnimationFrame(() => {
145
141
  const mhh = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
146
142
  this.host.style.setProperty('--local-header-height', `${mhh}px`);
147
143
  });
148
144
  }
145
+ handleLinkClick(event) {
146
+ const target = event.target;
147
+ const isLinkInMainNav = target.closest('post-mainnavigation a');
148
+ const isLinkInMegadropdown = target.closest('post-megadropdown a');
149
+ if (!isLinkInMainNav && !isLinkInMegadropdown) {
150
+ return;
151
+ }
152
+ if (this.mobileMenuExtended && (isLinkInMainNav || isLinkInMegadropdown)) {
153
+ this.toggleMobileMenu();
154
+ }
155
+ if (this.device === 'desktop' && isLinkInMegadropdown) {
156
+ const megadropdownLink = target.closest('post-megadropdown a');
157
+ if (megadropdownLink) {
158
+ target.closest('post-megadropdown').hide(true);
159
+ }
160
+ }
161
+ }
149
162
  handleResize() {
150
163
  const previousDevice = this.device;
151
164
  let newDevice;
@@ -185,10 +198,13 @@ export class PostHeader {
185
198
  if (this.mobileMenuExtended) {
186
199
  navigationClasses.push('extended');
187
200
  }
201
+ if (!this.megadropdownOpen) {
202
+ navigationClasses.push('scroll-y');
203
+ }
188
204
  return (h("div", { ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, 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" })))));
189
205
  }
190
206
  render() {
191
- return (h(Host, { key: '45452d2c2f6ac9a067ce71330ea898a797040cca', version: version }, h("div", { key: 'c50478141de45d0a718b18c0edc416eb9c832fde', class: "global-header" }, h("div", { key: 'a2ddc2de9a94fb3b16928fe9c1ac3b3ae61ff9bf', class: "global-sub" }, h("div", { key: '30083683ff7683202118471473f2a0ed98a1c920', class: "logo" }, h("slot", { key: '028bd4a8f03a228378b09a80dce8654d52c30e5c', name: "post-logo" }))), h("div", { key: '853bcf2e6c8a95d88f62795cef8d8e58c8996811', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '40e3027a4e4358b7a614558ed7e1f59fa65ed312', name: "meta-navigation" }), h("slot", { key: '31c141cc45aa12441557d9b817630328df3d3778', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'afe4b2c3123a89c1a4390578c22e89dfff7be655', name: "post-language-switch" }), h("div", { key: 'aea74d0c7f25288afa18b5aeb3e557216d695ec3', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '1efed8b7c823ef49b89120ed2e23f151c64b9c0e', name: "post-togglebutton" })))), h("div", { key: 'e09df2136d01c0516d0166f505055615cf1d70d3', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '491f9bbcb2743519f544b24ae6f00405be85e589', name: "title" }), h("div", { key: 'e85c0a76597832a6966e989111b4508579fb9c4d', class: "local-sub" }, h("slot", { key: 'f2d504ea6a3d7592a15551e6be8cb0c1ba220fbc', name: "local-controls" }), h("slot", { key: 'e0dd0f9c12e0c6bf5d5d66cb29139af59f7c0b4d' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
207
+ return (h(Host, { key: 'd92b8f3fbf93f1defc6eff9d7283c7452962f1d9', version: version }, h("div", { key: '2d4d19e4aab0bb294c95b4ed672aaac0d0ad23e9', class: "global-header" }, h("div", { key: '069ae5f4ad46baa0245dd97966738a1d4be8d954', class: "global-sub" }, h("div", { key: 'f48c56b8dab12bc8e9a19628d4bc9f7a99ebfd8a', class: "logo" }, h("slot", { key: '663d5f7aa39ec7ff68dd90f24472740ab49d6838', name: "post-logo" }))), h("div", { key: '6a0c11629c5d58d63b49cf99f87fa5858d05c5b0', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: 'ecc46275f314af761ab96fc209133e5f011d25e1', name: "meta-navigation" }), h("slot", { key: '92d41365424c09e07750be9f561d08d062d25c37', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: '6c4d7640261933e939a0cde1cf73d26024e4fcfc', name: "post-language-switch" }), h("div", { key: '39e2ee687469c80f36559d3e50210203e20e2854', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: 'f8e746e4dfef7f2427a78ac40b81f4cfd9422d95', name: "post-togglebutton" })))), h("div", { key: '90ca0666714d3e87600bd0ba160dcec289d9ed98', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '08eb843b431faceac96aaada6714bd86c26f41f5', name: "title" }), h("div", { key: '04542458a9e4aa804daf74d17471a3849e62071e', class: "local-sub" }, h("slot", { key: 'c8c2bc0a9d8433776241c1121a04feb13c34b30c', name: "local-controls" }), h("slot", { key: 'c0b60ab9499dbb9bf08a7e104bac218accd16861' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
192
208
  }
193
209
  static get is() { return "post-header"; }
194
210
  static get encapsulation() { return "shadow"; }
@@ -205,7 +221,8 @@ export class PostHeader {
205
221
  static get states() {
206
222
  return {
207
223
  "device": {},
208
- "mobileMenuExtended": {}
224
+ "mobileMenuExtended": {},
225
+ "megadropdownOpen": {}
209
226
  };
210
227
  }
211
228
  static get events() {
@@ -1,3 +1,3 @@
1
1
  /*!
2
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: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:inherit;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}post-language-option:where([variant=list]):not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}post-language-option:where([variant=list]):not([active=false]) :hover{color:#fff}post-language-option:where([variant=menu]){width:100%}post-language-option:where([variant=menu]):not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative;width:100%}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}
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:inherit;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}post-language-option:where([variant=list])[active]:not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}post-language-option:where([variant=menu]){width:100%}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:24px;box-sizing:border-box;position:relative;width:100%}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}
@@ -55,7 +55,7 @@ export class PostLanguageSwitch {
55
55
  // Hides the dropdown when an option has been clicked
56
56
  if (this.variant === 'menu') {
57
57
  const menu = this.host.shadowRoot.querySelector('post-menu');
58
- menu.toggle(menu);
58
+ menu.hide();
59
59
  }
60
60
  });
61
61
  }
@@ -1 +1 @@
1
- post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:4px}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:"";mask-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:24px;width:24px}@media screen and (min-width: 1024px){post-mainnavigation{display:block}post-mainnavigation nav{max-width:100vw;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button 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;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}
1
+ post-mainnavigation post-list-item>a{text-decoration:none;border-radius:0}post-mainnavigation post-list-item post-megadropdown-trigger button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-align:start}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button{background-color:ButtonFace !important}post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:Highlight !important}}post-mainnavigation post-list-item post-megadropdown-trigger button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-mainnavigation post-list-item post-megadropdown-trigger button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item post-megadropdown-trigger button{flex:0 0 fit-content;white-space:nowrap;display:flex;align-items:center;justify-content:space-between}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}post-mainnavigation post-list-item>a:focus-visible,post-mainnavigation post-list-item post-megadropdown-trigger button:focus-visible{border-radius:4px}post-mainnavigation .back-button post-icon{transform:rotate(180deg)}@media screen and (max-width: 1023.98px){post-mainnavigation .back-button{font-size:16px}}@media screen and (max-width: 599.98px){post-mainnavigation .back-button{font-size:14px}}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{content:"";mask-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m23.6 13.2-7.5 7.6-7.6-7.6.9-.9 6.6 6.6 6.6-6.6z'/%3E%3C/svg%3E");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;height:24px;width:24px}@media screen and (min-width: 1024px){post-mainnavigation{display:block}post-mainnavigation nav{max-width:100%;background:#fff;max-height:var(--main-navigation-height);user-select:none;transition:margin 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{z-index:4;position:absolute;inset-block-end:0;overflow:hidden}post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button 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;background:#fff;padding:16px;box-shadow:var(--post-device-elevation-500);line-height:100%;height:var(--main-navigation-height)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){post-mainnavigation .left-scroll-button button,post-mainnavigation .right-scroll-button button{background-color:ButtonFace !important}post-mainnavigation .left-scroll-button button:hover,post-mainnavigation .right-scroll-button button:hover{background-color:Highlight !important}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button button post-icon,post-mainnavigation .right-scroll-button button post-icon{font-size:1rem}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button.d-none,post-mainnavigation .right-scroll-button.d-none{display:none}}@media screen and (min-width: 1024px){post-mainnavigation .left-scroll-button{inset-inline-start:0;padding-inline-end:2rem}}@media screen and (min-width: 1024px){post-mainnavigation .right-scroll-button{inset-inline-end:0;padding-inline-start:2rem}}@media screen and (min-width: 1024px){post-mainnavigation post-list>[role=list]{flex-direction:row;max-width:100vw}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{position:sticky;padding-inline:12px;height:var(--main-navigation-height);gap:4px;font-size:16px;z-index:4}post-mainnavigation post-list-item>a .nav-el-active,post-mainnavigation post-list-item>button .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-active{font-weight:700;text-align:center;opacity:0}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{position:absolute;opacity:1;text-align:center;width:100%;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff;font-weight:700}post-mainnavigation post-list-item>a.selected .nav-el-active,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item>button.selected .nav-el-active,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-active,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-active{opacity:1}post-mainnavigation post-list-item>a.selected .nav-el-inactive,post-mainnavigation post-list-item>a[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item>button.selected .nav-el-inactive,post-mainnavigation post-list-item>button[aria-expanded=true] .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button.selected .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true] .nav-el-inactive{opacity:0}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}}@media screen and (min-width: 1024px)and (max-width: 599.98px){post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{font-size:14px}}@media screen and (min-width: 1024px){post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{padding-inline-end:12px;transition:border-block-end-color 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{width:calc(100% - 28px)}post-mainnavigation post-list-item>button::after,post-mainnavigation post-list-item post-megadropdown-trigger button::after{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}post-mainnavigation post-list-item>button.selected::after,post-mainnavigation post-list-item>button[aria-expanded=true]::after,post-mainnavigation post-list-item post-megadropdown-trigger button.selected::after,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]::after{transform:rotate(180deg)}}@media screen and (min-width: 1024px){post-mainnavigation post-megadropdown button:not(.btn-icon-close),post-mainnavigation post-megadropdown a{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-megadropdown button:not(.btn-icon-close)::before,post-mainnavigation post-megadropdown a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-megadropdown button:not(.btn-icon-close).selected,post-mainnavigation post-megadropdown button:not(.btn-icon-close)[aria-expanded=true],post-mainnavigation post-megadropdown a.selected,post-mainnavigation post-megadropdown a[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover,post-mainnavigation post-megadropdown a:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-megadropdown button:not(.btn-icon-close):hover::before,post-mainnavigation post-megadropdown a:hover::before{background-color:#504f4b}}@media screen and (min-width: 1024px){post-mainnavigation [slot=back-button]{display:none}}@media screen and (max-width: 1023.98px){post-mainnavigation nav{transform:none !important}post-mainnavigation .left-scroll-button,post-mainnavigation .right-scroll-button{display:none}post-mainnavigation post-list-item>a,post-mainnavigation post-list-item>button,post-mainnavigation post-list-item post-megadropdown-trigger button{width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative}post-mainnavigation post-list-item>a::before,post-mainnavigation post-list-item>button::before,post-mainnavigation post-list-item post-megadropdown-trigger button::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}post-mainnavigation post-list-item>a.selected,post-mainnavigation post-list-item>a[aria-expanded=true],post-mainnavigation post-list-item>button.selected,post-mainnavigation post-list-item>button[aria-expanded=true],post-mainnavigation post-list-item post-megadropdown-trigger button.selected,post-mainnavigation post-list-item post-megadropdown-trigger button[aria-expanded=true]{background-color:#050400;color:#fff}post-mainnavigation post-list-item>a:hover,post-mainnavigation post-list-item>button:hover,post-mainnavigation post-list-item post-megadropdown-trigger button:hover{background-color:#504f4b;color:#fff}post-mainnavigation post-list-item>a:hover::before,post-mainnavigation post-list-item>button:hover::before,post-mainnavigation post-list-item post-megadropdown-trigger button:hover::before{background-color:#504f4b}post-mainnavigation post-list-item>a .nav-el-inactive,post-mainnavigation post-list-item>button .nav-el-inactive,post-mainnavigation post-list-item post-megadropdown-trigger button .nav-el-inactive{display:none}post-mainnavigation>button::after,post-mainnavigation post-megadropdown-trigger button::after{transform:rotate(-90deg)}}post-mainnavigation .back-button .btn{padding-inline:0}
@@ -1,5 +1,4 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import { throttle } from "throttle-debounce";
3
2
  const SCROLL_REPEAT_INTERVAL = 100; // Interval for repeated scrolling when holding down scroll button
4
3
  const NAVBAR_DISABLE_DURATION = 400; // Duration to temporarily disable navbar interactions during scrolling
5
4
  const NAVIGATION_LIST_SELECTOR = 'post-list > [role="list"]:not(post-megadropdown *)';
@@ -16,6 +15,7 @@ export class PostMainnavigation {
16
15
  leftScrollButton;
17
16
  scrollRepeatInterval;
18
17
  navbarDisableTimer;
18
+ resizeObserver;
19
19
  mutationObserver = new MutationObserver(async (mutations) => {
20
20
  // Wait for all elements to be hydrated
21
21
  await Promise.all(mutations
@@ -45,13 +45,25 @@ export class PostMainnavigation {
45
45
  disconnectedCallback() {
46
46
  this.header = null;
47
47
  this.mutationObserver.disconnect();
48
+ if (this.resizeObserver) {
49
+ this.resizeObserver.disconnect();
50
+ }
48
51
  }
49
52
  componentDidLoad() {
50
53
  setTimeout(() => this.checkScrollability()); // Initial check to determine if scrolling is needed
54
+ this.resizeObserver = new ResizeObserver(() => {
55
+ this.checkScrollability();
56
+ });
57
+ // Observe the navbar and the navigation list for size changes
58
+ if (this.navbar) {
59
+ this.resizeObserver.observe(this.navbar);
60
+ const navList = this.navigationList;
61
+ if (navList) {
62
+ this.resizeObserver.observe(navList);
63
+ }
64
+ }
51
65
  this.mutationObserver.observe(this.navigationList, { subtree: true, childList: true }); // Recheck scrollability when navigation list changes
52
66
  this.fixLayoutShift();
53
- window.addEventListener('resize', // Recheck scrollability on window resize
54
- throttle(100, () => this.checkScrollability()));
55
67
  // Handle focus changes and adjust scroll as needed
56
68
  this.navbar.addEventListener('focusin', e => this.adjustTranslation(e));
57
69
  }
@@ -216,7 +228,7 @@ export class PostMainnavigation {
216
228
  });
217
229
  }
218
230
  render() {
219
- return (h(Host, { key: 'd9be56167f714c041eb05283832986ec38c451cd', slot: "post-mainnavigation" }, h("div", { key: '5852c66b93a6eb9697fd7c7b1379e748804c6917', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '0d4d98897fb5a8f8cf1c0871037ac01023c41cc2', name: "back-button" })), h("nav", { key: 'c60635b5db5a54b9e7661b92eeec29ed6d453cfe', ref: el => (this.navbar = el) }, h("slot", { key: 'd83facd6cb8c2a892ad432e42357123660c647ed' })), h("div", { key: 'e9afc48596b3e877d9efb9a4189abb8c84aadb6d', class: `left-scroll-button${this.canScrollLeft ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: 'ef11720ec4f6d7811eb10027871a336e46ba6b84', type: "button", tabindex: "-1", ref: el => (this.leftScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('left') }, h("post-icon", { key: 'f85ff2ef87841409f4b4f6c33e6d0dca4c764cc6', "aria-hidden": "true", name: "chevronleft" }))), h("div", { key: '181dc100ddedcba3f07b5f0ff9aedf165499f74f', class: `right-scroll-button${this.canScrollRight ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: '83a8a824fcfe499207f6030e11381e68d530c67d', type: "button", tabindex: "-1", ref: el => (this.rightScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('right') }, h("post-icon", { key: '52caec8a9a8c15e97ea5702ec3fe30bd4777c728', "aria-hidden": "true", name: "chevronright" })))));
231
+ return (h(Host, { key: '3c740536fd968e22d22a8117766df12800e6eb6e', slot: "post-mainnavigation" }, h("div", { key: '113602ca8b5ee48c290b31b77329b34d85df40bd', onClick: () => this.handleBackButtonClick(), class: "back-button" }, h("slot", { key: '6cd5e18449f1a9340a6c35c0b97385f0a4bf6ede', name: "back-button" })), h("nav", { key: '6fb39c4a929f973468407928b43f877233fa9326', ref: el => (this.navbar = el) }, h("slot", { key: 'dd9957b2dea293bc7153239f817ac76f37db3728' })), h("div", { key: '3942637952cec7095dbbcfa16aea1a3768a52fdb', class: `left-scroll-button${this.canScrollLeft ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: '381b0aef119a161e6e3ac8f396ef8a214df0c439', type: "button", tabindex: "-1", ref: el => (this.leftScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('left') }, h("post-icon", { key: '632835cf735a1d5487d1e18861622318041b9fb3', "aria-hidden": "true", name: "chevronleft" }))), h("div", { key: '2cb6c7222c5e755ba1fdfc8c9e68d73299efe0de', class: `right-scroll-button${this.canScrollRight ? '' : ' d-none'}`, "aria-hidden": "true" }, h("button", { key: 'd665cde32ea285134522a00689accf3cc40c927c', type: "button", tabindex: "-1", ref: el => (this.rightScrollButton = el), onMouseDown: () => this.handleScrollButtonClick('right') }, h("post-icon", { key: '13530078ad9aa9b48bdfd5bd78c8aa8d6ea910d0', "aria-hidden": "true", name: "chevronright" })))));
220
232
  }
221
233
  static get is() { return "post-mainnavigation"; }
222
234
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- @keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;border-top:1px solid #e1e0dc;width:100%;top:100%;left:0;border-radius:0}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;top:0 !important;left:0;width:100%;position:fixed;height:calc(100dvh - var(--header-height));max-height:calc(100dvh - var(--header-height));border-top:unset;overflow:auto}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:"";background-color:#050400;bottom:0;width:100%;height:2px;position:absolute;left:0}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}
1
+ @keyframes slide-in{0%{transform:translateX(100%)}100%{transform:translateX(0%)}}@keyframes slide-out{from{transform:translateX(0%)}to{transform:translateX(100%)}}@keyframes slide-down{from{transform:translateY(-100%)}to{transform:translateY(0%)}}@keyframes slide-up{0%{transform:translateY(0%)}100%{transform:translateY(-100%)}}*,::before,::after{box-sizing:border-box}.megadropdown-container{box-shadow:0 8px 6px rgba(0,0,0,.16);position:absolute;background-color:#fafafa;border:none;z-index:1;width:100%;top:100%;left:0;border-radius:0}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.megadropdown-container{border-block-end:1px solid CanvasText}}.megadropdown-container.slide-in{animation:slide-down 350ms forwards}.megadropdown-container.slide-out{animation:slide-up 350ms forwards}@media screen and (max-width: 1023.98px){.megadropdown-container{z-index:4;top:0 !important;left:0;width:100%;position:fixed;height:calc(100dvh - var(--header-height));max-height:calc(100dvh - var(--header-height));border-top:unset;overflow:auto}.megadropdown-container.slide-in{animation:slide-in 350ms forwards}.megadropdown-container.slide-out{animation:slide-out 350ms forwards}}.megadropdown{padding:31px 40px 40px;background-color:#fafafa}@media screen and (max-width: 1023.98px){.megadropdown{display:flex;flex-direction:column;width:inherit;padding:16px 32px 24px}}@media screen and (max-width: 599.98px){.megadropdown{padding-inline:16px}}.megadropdown .megadropdown-content{gap:1.5rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(15vw, 100%), 1fr));grid-auto-rows:1fr auto;grid-auto-flow:dense}@media screen and (max-width: 1023.98px){.megadropdown .megadropdown-content{grid-template-columns:repeat(auto-fit, minmax(min(35vw, 100%), 1fr))}}@media screen and (max-width: 599.98px){.megadropdown .megadropdown-content{grid-template-columns:1fr}}.megadropdown h2{display:none;margin-top:0;margin-bottom:8px;font-weight:900}.megadropdown h2 a{text-decoration:none;display:none;font-weight:inherit;border-bottom:0;border-top:0}@media screen and (max-width: 1023.98px){.megadropdown h2{display:block;font-size:1.25rem}}@media screen and (max-width: 599.98px){.megadropdown h2{font-size:1.125rem}}.megadropdown post-list{display:grid;grid-row:span 2;grid-template-rows:subgrid;row-gap:0px}.megadropdown post-list>[role=list]{flex-direction:unset;display:unset}.megadropdown post-list>*{width:100%}.megadropdown post-list .list-title{display:flex;flex-direction:column-reverse;height:100%}.megadropdown post-list .list-title h3{font-size:20px;display:block;font-weight:900}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:16px 12px 14px 8px}.megadropdown post-list .list-title h3:not(:has(a)){position:relative}.megadropdown post-list .list-title h3:not(:has(a))::before{content:"";background-color:#050400;bottom:0;width:100%;height:2px;position:absolute;left:0}.megadropdown post-list .list-title h3 a{border-radius:0;text-decoration:none;font-size:inherit;display:flex;align-items:center;justify-content:space-between;min-height:53px;width:100%;min-width:100%;height:48px;padding-inline:8px 12px;gap:16px;font-weight:400;position:relative;height:unset;font-weight:900}.megadropdown post-list .list-title h3 a::before{content:"";background-color:#050400;bottom:0;width:100%;height:1px;position:absolute;left:0}.megadropdown post-list .list-title h3 a.selected,.megadropdown post-list .list-title h3 a[aria-expanded=true]{background-color:#050400;color:#fff}.megadropdown post-list .list-title h3 a:hover{background-color:#504f4b;color:#fff}.megadropdown post-list .list-title h3 a:hover::before{background-color:#504f4b}.megadropdown post-list .list-title h3 a::before{height:2px}@media screen and (max-width: 1023.98px){.megadropdown post-list .list-title h3{font-size:1rem}.megadropdown post-list .list-title h3:not(:has(a)),.megadropdown post-list .list-title h3 a{padding:14px 12px 12px 8px}}@media screen and (max-width: 599.98px){.megadropdown post-list .list-title h3{font-size:.875rem}}.megadropdown post-list-item>a{padding-block:13px 12px;padding-inline-start:8px;display:flex;text-decoration:none;width:100%;min-width:100%;height:auto;min-height:48px;white-space:normal;word-break:break-word}.megadropdown post-list-item>a:hover{border-block-width:0}@media screen and (min-width: 1024px){.megadropdown post-list-item>a{font-size:1.25rem}}@media screen and (max-width: 1023.98px){.megadropdown post-list-item>a{padding-block:12px 11px}}@media screen and (max-width: 599.98px){.megadropdown post-list-item>a{font-size:.875rem}}.megadropdown .back-button{display:none;margin-bottom:2rem}.megadropdown .back-button .btn{width:auto}@media screen and (max-width: 1023.98px){.megadropdown .back-button{order:-1;display:block}}.megadropdown .close-button{position:absolute;top:1rem;right:1rem}@media screen and (max-width: 1023.98px){.megadropdown .close-button{display:none}}
@@ -1,17 +1,23 @@
1
1
  import { getFocusableChildren } from "../../utils/get-focusable-children";
2
2
  import { h, Host } from "@stencil/core";
3
+ import { breakpoint } from "../../utils/breakpoints";
3
4
  export class PostMegadropdown {
4
5
  constructor() {
5
- this.device = undefined;
6
+ this.device = breakpoint.get('name');
6
7
  this.isVisible = false;
7
8
  this.animationClass = null;
8
9
  }
9
- header;
10
10
  firstFocusableEl;
11
11
  lastFocusableEl;
12
12
  host;
13
13
  /** Tracks the currently active dropdown instance. */
14
14
  static activeDropdown = null;
15
+ breakpointChange(e) {
16
+ this.device = e.detail;
17
+ if (this.device === 'desktop' && this.isVisible) {
18
+ this.animationClass = null;
19
+ }
20
+ }
15
21
  /**
16
22
  * Emits when the dropdown is shown or hidden.
17
23
  * The event payload is an object.
@@ -21,6 +27,7 @@ export class PostMegadropdown {
21
27
  postToggleMegadropdown;
22
28
  disconnectedCallback() {
23
29
  this.removeListeners();
30
+ window.removeEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
24
31
  if (PostMegadropdown.activeDropdown === this) {
25
32
  PostMegadropdown.activeDropdown = null;
26
33
  }
@@ -66,16 +73,14 @@ export class PostMegadropdown {
66
73
  this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
67
74
  this.animationClass = 'slide-out';
68
75
  }
76
+ /**
77
+ * Sets focus to the first focusable element within the component.
78
+ */
69
79
  async focusFirst() {
70
80
  this.firstFocusableEl?.focus();
71
81
  }
72
82
  connectedCallback() {
73
- this.header = this.host.closest('post-header');
74
- if (this.header) {
75
- this.header.addEventListener('postUpdateDevice', (event) => {
76
- this.device = event.detail;
77
- });
78
- }
83
+ window.addEventListener('postBreakpoint:name', this.breakpointChange.bind(this));
79
84
  }
80
85
  /**
81
86
  * Forces the dropdown to close without animation.
@@ -150,7 +155,7 @@ export class PostMegadropdown {
150
155
  }
151
156
  render() {
152
157
  const containerStyle = this.isVisible ? {} : { display: 'none' };
153
- return (h(Host, { key: '1475e9ff941f5333d5cfe4f00157f8b2fc826b5e' }, h("div", { key: 'f3da1ec8abc7d00be7020821be69ea3af16f3ad2', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: 'f02279d454c7413080ce52711fe0cb923950d066', class: "megadropdown" }, h("slot", { key: '87da859d1a8408c3a49ea1ab050ea5f27de45ec2', name: "megadropdown-title" }), h("div", { key: 'c389959cf97c2ea69dd7b3f6945071e0c1793458', class: "megadropdown-content" }, h("slot", { key: '1a1241624a5b5421de0e4a3a54ddba3eb1e0834f' })), h("div", { key: 'f8fad723719e1505730f679dfff6428f3a5f1340', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: '6ca62ac352810b6d3642ee69433de4aac4089117', name: "back-button" })), h("div", { key: '16200fc7dee7d5535399e0450e39a816f04dffd6', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: 'e9478713c07f69011f397af3e3ffa6a3b8b7fb6a', name: "close-button" }))))));
158
+ return (h(Host, { key: '56fa590bb7f9f96a235ac867e5fa813d3af85e0e' }, h("div", { key: 'b2c7b68296103caa71a2a50f5637b7ffb6c07439', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: 'adb9e8e0017c030c7b2d296c50ac6f7a0807c0cd', class: "megadropdown" }, h("slot", { key: '081e04f3a23c1f1578d1a57e3c4485627b3370bf', name: "megadropdown-title" }), h("div", { key: 'ce46885e7c2992cbee84ed4712cac476c37d764a', class: "megadropdown-content" }, h("slot", { key: '57aa14b27969ab85d078ea42b440fc689d602ffa' })), h("div", { key: 'bfbd760c4f8ef244adf9f51517df22065e0b6cf7', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: '5cab958bc29dca98b1eeac97b844d26324f045bf', name: "back-button" })), h("div", { key: '8a959443f689a9bb318bedd2089493d291529250', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '212685a6a63c5af4eccec78a80d6a8c3d7a2bbe9', name: "close-button" }))))));
154
159
  }
155
160
  static get is() { return "post-megadropdown"; }
156
161
  static get originalStyleUrls() {
@@ -258,7 +263,7 @@ export class PostMegadropdown {
258
263
  "return": "Promise<void>"
259
264
  },
260
265
  "docs": {
261
- "text": "",
266
+ "text": "Sets focus to the first focusable element within the component.",
262
267
  "tags": []
263
268
  }
264
269
  }
@@ -0,0 +1,52 @@
1
+ class Breakpoint {
2
+ breakpointMap;
3
+ current = {
4
+ key: '',
5
+ name: '',
6
+ };
7
+ constructor() {
8
+ if (!this.breakpointMap) {
9
+ const keys = this.getStyles('--post-breakpoint-keys');
10
+ const names = this.getStyles('--post-breakpoint-names');
11
+ const widths = this.getStyles('--post-breakpoint-widths');
12
+ this.breakpointMap = widths
13
+ .map((width, i) => ({
14
+ minWidth: Number(width),
15
+ key: keys[i],
16
+ name: names[i],
17
+ }))
18
+ .reverse();
19
+ window.addEventListener('resize', () => this.updateHandler(), { passive: true });
20
+ }
21
+ }
22
+ getStyles(propertyName) {
23
+ const styles = getComputedStyle(document.documentElement);
24
+ return (styles
25
+ .getPropertyValue(propertyName)
26
+ ?.split(',')
27
+ .map(w => w.trim()) ?? []);
28
+ }
29
+ updateHandler(emitEvents = true) {
30
+ const calculated = this.breakpointMap.find(({ minWidth }) => innerWidth >= minWidth);
31
+ if (this.current.key !== calculated.key) {
32
+ this.current.key = calculated.key;
33
+ if (emitEvents)
34
+ this.dispatchEvent('key');
35
+ }
36
+ if (this.current.name !== calculated.name) {
37
+ this.current.name = calculated.name;
38
+ if (emitEvents)
39
+ this.dispatchEvent('name');
40
+ }
41
+ }
42
+ dispatchEvent(type) {
43
+ window.dispatchEvent(new CustomEvent(`postBreakpoint:${type}`, { detail: this.current[type] }));
44
+ }
45
+ get(type) {
46
+ this.updateHandler(false);
47
+ return this.current[type];
48
+ }
49
+ }
50
+ const breakpoint = new Breakpoint();
51
+
52
+ export { breakpoint as b };
@@ -1,3 +1,3 @@
1
- const version = "9.0.0-next.21";
1
+ const version = "9.0.0-next.23";
2
2
 
3
3
  export { version as v };
@@ -1,61 +1,11 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { v as version } from './package.js';
3
+ import { b as breakpoint } from './breakpoints.js';
3
4
  import { d as defineCustomElement$4 } from './post-accordion-item2.js';
4
5
  import { d as defineCustomElement$3 } from './post-collapsible2.js';
5
6
  import { d as defineCustomElement$2 } from './post-collapsible-trigger2.js';
6
7
  import { d as defineCustomElement$1 } from './post-icon2.js';
7
8
 
8
- class Breakpoint {
9
- breakpointMap;
10
- current = {
11
- key: '',
12
- name: '',
13
- };
14
- constructor() {
15
- if (!this.breakpointMap) {
16
- const keys = this.getStyles('--post-breakpoint-keys');
17
- const names = this.getStyles('--post-breakpoint-names');
18
- const widths = this.getStyles('--post-breakpoint-widths');
19
- this.breakpointMap = widths
20
- .map((width, i) => ({
21
- minWidth: Number(width),
22
- key: keys[i],
23
- name: names[i],
24
- }))
25
- .reverse();
26
- window.addEventListener('resize', () => this.updateHandler(), { passive: true });
27
- }
28
- }
29
- getStyles(propertyName) {
30
- const styles = getComputedStyle(document.documentElement);
31
- return (styles
32
- .getPropertyValue(propertyName)
33
- ?.split(',')
34
- .map(w => w.trim()) ?? []);
35
- }
36
- updateHandler(emitEvents = true) {
37
- const calculated = this.breakpointMap.find(({ minWidth }) => innerWidth >= minWidth);
38
- if (this.current.key !== calculated.key) {
39
- this.current.key = calculated.key;
40
- if (emitEvents)
41
- this.dispatchEvent('key');
42
- }
43
- if (this.current.name !== calculated.name) {
44
- this.current.name = calculated.name;
45
- if (emitEvents)
46
- this.dispatchEvent('name');
47
- }
48
- }
49
- dispatchEvent(type) {
50
- window.dispatchEvent(new CustomEvent(`postBreakpoint:${type}`, { detail: this.current[type] }));
51
- }
52
- get(type) {
53
- this.updateHandler(false);
54
- return this.current[type];
55
- }
56
- }
57
- const breakpoint = new Breakpoint();
58
-
59
9
  const postFooterCss = ":host{display:block}footer{background-color:#fc0;--post-footer-container-padding-block:32px;--post-footer-container-padding-inline:16px;--post-footer-container-max-width:1200px;--post-footer-grid-template:auto / auto;--post-footer-grid-row-gap:0;--post-footer-grid-column-gap:0;--post-footer-grid-margin-block-end:24px;--post-footer-grid-padding-block-end:0;--post-footer-column-flex-direction:column;--post-footer-column-align-items:start;--post-footer-column-gap:0;--post-footer-post-list-flex-direction:column;--post-footer-post-list-gap:8px;--post-footer-post-list-align-items:start;--post-footer-socialmedia-margin-block-end:var(--post-footer-grid-margin-block-end);--post-footer-app-margin-block-end:var(--post-footer-grid-margin-block-end);--post-footer-businesssectors-margin-block-end:var(--post-footer-grid-margin-block-end);--post-footer-meta-margin-block-end:16px;--post-footer-meta-font-size:inherit;--post-footer-copyright-font-size:var(--post-footer-meta-font-size)}@media screen and (min-width: 600px){footer{--post-footer-container-padding-block:40px;--post-footer-grid-template:repeat(2, auto) / repeat(2, auto);--post-footer-grid-row-gap:32px;--post-footer-grid-column-gap:16px;--post-footer-grid-margin-block-end:32px;--post-footer-grid-padding-block-end:32px;--post-footer-post-list-flex-direction:row;--post-footer-post-list-gap:16px;--post-footer-post-list-align-items:center;--post-footer-meta-margin-block-end:8px}}@media screen and (min-width: 780px){footer{--post-footer-container-padding-inline:40px}}@media screen and (min-width: 1024px){footer{--post-footer-container-padding-block:56px;--post-footer-grid-template:auto / repeat(4, auto);--post-footer-grid-row-gap:0;--post-footer-grid-column-gap:24px;--post-footer-grid-margin-block-end:40px;--post-footer-column-flex-direction:row;--post-footer-column-align-items:center;--post-footer-column-gap:32px;--post-footer-post-list-gap:24px;--post-footer-businesssectors-margin-block-end:24px;--post-footer-meta-font-size:16px}}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.footer-container{box-sizing:content-box;margin:0 auto;padding:var(--post-footer-container-padding-block) var(--post-footer-container-padding-inline);max-width:var(--post-footer-container-max-width)}.footer-grid{display:grid;grid-template:var(--post-footer-grid-template);row-gap:var(--post-footer-grid-row-gap);column-gap:var(--post-footer-grid-column-gap);margin-block-end:var(--post-footer-grid-margin-block-end);padding-block-end:var(--post-footer-grid-padding-block-end)}.footer-grid ::part(button),.footer-grid ::part(body){padding-inline:0}.footer-column{display:flex;flex-direction:var(--post-footer-column-flex-direction);flex-wrap:wrap;justify-content:space-between;align-items:var(--post-footer-column-align-items);column-gap:var(--post-footer-column-gap)}.footer-socialmedia ::slotted(post-list),.footer-app ::slotted(post-list),.footer-businesssectors ::slotted(post-list),.footer-meta ::slotted(post-list){display:flex !important;flex-direction:var(--post-footer-post-list-flex-direction) !important;gap:var(--post-footer-post-list-gap) !important;align-items:var(--post-footer-post-list-align-items) !important}.footer-socialmedia{margin-block-end:var(--post-footer-socialmedia-margin-block-end)}.footer-app{margin-block-end:var(--post-footer-app-margin-block-end)}.footer-businesssectors{margin-block-end:var(--post-footer-businesssectors-margin-block-end)}.footer-meta{margin-block-end:var(--post-footer-meta-margin-block-end);font-size:var(--post-footer-meta-font-size)}.footer-copyright{display:flex;flex-wrap:wrap;column-gap:.5rem;font-size:var(--post-footer-copyright-font-size)}";
60
10
  const PostFooterStyle0 = postFooterCss;
61
11