@swisspost/design-system-components 10.0.0-next.54 → 10.0.0-next.56

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 (409) hide show
  1. package/dist/{components/react/p-CJ80BZ06.js → cjs/breakpoints-Df03Ct7n.js} +103 -5
  2. package/dist/cjs/debounce-BsIBi_-2.js +13 -0
  3. package/dist/cjs/environment-BQE9Unf_.js +52 -0
  4. package/dist/cjs/{event-from-CLvtSUKf.js → event-from-CwMw19f8.js} +2 -2
  5. package/dist/cjs/fade-CPQhl1fP.js +26 -0
  6. package/dist/cjs/fade-slide-dPhQa-I1.js +38 -0
  7. package/dist/cjs/{get-focusable-children-Bx63XUQg.js → get-focusable-children-ChETM1wK.js} +29 -21
  8. package/dist/cjs/{get-root-CyMf3Vsd.js → get-root-CUAv4k4C.js} +2 -2
  9. package/dist/cjs/{index-Cb8CTrOz.js → index-CKNxhb0S.js} +29 -13
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/{package-CvZxvdTJ.js → package-CY7IOoiw.js} +1 -1
  12. package/dist/cjs/post-accordion_2.cjs.entry.js +12 -12
  13. package/dist/cjs/post-avatar.cjs.entry.js +11 -11
  14. package/dist/cjs/post-back-to-top.cjs.entry.js +16 -40
  15. package/dist/cjs/post-banner.cjs.entry.js +11 -10
  16. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +7 -7
  17. package/dist/cjs/post-breadcrumbs.cjs.entry.js +22 -31
  18. package/dist/cjs/post-card-control.cjs.entry.js +16 -16
  19. package/dist/cjs/{post-closebutton_15.cjs.entry.js → post-closebutton_13.cjs.entry.js} +537 -507
  20. package/dist/cjs/post-collapsible_2.cjs.entry.js +39 -38
  21. package/dist/cjs/post-components.cjs.js +2 -2
  22. package/dist/cjs/post-env-test.cjs.entry.js +15 -0
  23. package/dist/cjs/post-footer.cjs.entry.js +21 -19
  24. package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
  25. package/dist/cjs/post-pagination.cjs.entry.js +589 -0
  26. package/dist/cjs/post-popover-trigger.cjs.entry.js +46 -30
  27. package/dist/cjs/post-popover.cjs.entry.js +12 -12
  28. package/dist/cjs/post-rating.cjs.entry.js +13 -13
  29. package/dist/cjs/post-stepper-item.cjs.entry.js +18 -0
  30. package/dist/cjs/post-stepper.cjs.entry.js +109 -0
  31. package/dist/cjs/post-tab-item.cjs.entry.js +49 -0
  32. package/dist/cjs/post-tab-panel.cjs.entry.js +9 -9
  33. package/dist/cjs/post-tabs.cjs.entry.js +191 -38
  34. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +8 -8
  35. package/dist/cjs/post-tooltip.cjs.entry.js +7 -7
  36. package/dist/cjs/utils-s05L2ulk.js +26 -0
  37. package/dist/collection/animations/collapse.js +3 -3
  38. package/dist/collection/animations/fade-slide.js +33 -0
  39. package/dist/collection/animations/fade.js +19 -7
  40. package/dist/collection/animations/index.js +2 -0
  41. package/dist/collection/animations/slide.js +25 -21
  42. package/dist/collection/animations/types.js +14 -0
  43. package/dist/collection/animations/utils.js +8 -0
  44. package/dist/collection/collection-manifest.json +8 -6
  45. package/dist/collection/components/post-accordion/post-accordion.css +1 -1
  46. package/dist/collection/components/post-accordion/post-accordion.js +2 -2
  47. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  48. package/dist/collection/components/post-accordion-item/post-accordion-item.js +4 -4
  49. package/dist/collection/components/post-avatar/post-avatar.css +1 -1
  50. package/dist/collection/components/post-avatar/post-avatar.js +1 -1
  51. package/dist/collection/components/post-back-to-top/post-back-to-top.js +14 -14
  52. package/dist/collection/components/post-banner/post-banner.css +4 -1
  53. package/dist/collection/components/post-banner/post-banner.js +3 -3
  54. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +1 -1
  55. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +28 -28
  56. package/dist/collection/components/post-card-control/post-card-control.js +3 -3
  57. package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
  58. package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
  59. package/dist/collection/components/post-collapsible/post-collapsible.js +27 -27
  60. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +6 -5
  61. package/dist/collection/components/post-footer/post-footer.css +1 -1
  62. package/dist/collection/components/post-footer/post-footer.js +18 -16
  63. package/dist/collection/components/post-header/post-header.css +1 -1
  64. package/dist/collection/components/post-header/post-header.js +186 -105
  65. package/dist/collection/components/post-icon/post-icon.js +6 -4
  66. package/dist/collection/components/post-language-menu/post-language-menu.css +1 -0
  67. package/dist/collection/components/{post-language-switch/post-language-switch.js → post-language-menu/post-language-menu.js} +25 -25
  68. package/dist/collection/components/post-language-menu-item/post-language-menu-item.css +1 -0
  69. package/dist/collection/components/{post-language-option/post-language-option.js → post-language-menu-item/post-language-menu-item.js} +14 -14
  70. package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
  71. package/dist/collection/components/post-logo/post-logo.css +3 -1
  72. package/dist/collection/components/post-logo/post-logo.js +1 -1
  73. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  74. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +41 -29
  75. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  76. package/dist/collection/components/post-megadropdown/post-megadropdown.js +184 -75
  77. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +3 -1
  78. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +80 -74
  79. package/dist/collection/components/post-menu/post-menu.css +1 -1
  80. package/dist/collection/components/post-menu/post-menu.js +35 -35
  81. package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
  82. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
  83. package/dist/collection/components/post-pagination/post-pagination.css +1 -0
  84. package/dist/collection/components/post-pagination/post-pagination.js +838 -0
  85. package/dist/collection/components/post-popover/post-popover.css +1 -1
  86. package/dist/collection/components/post-popover/post-popover.js +10 -10
  87. package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +43 -27
  88. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  89. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +45 -92
  90. package/dist/collection/components/post-rating/post-rating.js +3 -3
  91. package/dist/collection/components/post-stepper/post-stepper.css +1 -0
  92. package/dist/collection/components/post-stepper/post-stepper.js +207 -0
  93. package/dist/collection/components/post-stepper-item/post-stepper-item.css +7 -0
  94. package/dist/collection/components/post-stepper-item/post-stepper-item.js +18 -0
  95. package/dist/collection/components/post-tab-item/post-tab-item.css +1 -0
  96. package/dist/collection/components/post-tab-item/post-tab-item.js +86 -0
  97. package/dist/collection/components/post-tab-panel/post-tab-panel.js +9 -9
  98. package/dist/collection/components/post-tabs/post-tabs.js +230 -57
  99. package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
  100. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  101. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  102. package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
  103. package/dist/collection/utils/environment.js +47 -2
  104. package/dist/collection/utils/event-from.js +2 -2
  105. package/dist/collection/utils/get-focusable-children.js +29 -21
  106. package/dist/collection/utils/is-motion-reduced.js +1 -1
  107. package/dist/collection/utils/tests/environment/hydrate-app-helper.js +16 -0
  108. package/dist/collection/utils/tests/environment/post-env-test.js +9 -0
  109. package/dist/component-names.json +6 -5
  110. package/dist/components/breakpoints.js +90 -3
  111. package/dist/components/debounce.js +11 -0
  112. package/dist/components/environment.js +49 -0
  113. package/dist/components/event-from.js +2 -2
  114. package/dist/components/fade-slide.js +36 -0
  115. package/dist/components/fade.js +21 -8
  116. package/dist/components/get-focusable-children.js +29 -21
  117. package/dist/components/get-root.js +1 -1
  118. package/dist/components/index.d.ts +14 -10
  119. package/dist/components/index.js +7 -5
  120. package/dist/components/package.js +1 -1
  121. package/dist/components/post-accordion-item2.js +4 -5
  122. package/dist/components/post-accordion2.js +4 -5
  123. package/dist/components/post-avatar.js +3 -4
  124. package/dist/components/post-back-to-top.js +14 -40
  125. package/dist/components/post-banner.js +5 -6
  126. package/dist/components/post-breadcrumb-item2.js +2 -3
  127. package/dist/components/post-breadcrumbs.js +24 -34
  128. package/dist/components/post-card-control.js +4 -5
  129. package/dist/components/post-closebutton2.js +3 -4
  130. package/dist/components/post-collapsible-trigger2.js +10 -10
  131. package/dist/components/post-collapsible2.js +25 -25
  132. package/dist/components/{post-list.d.ts → post-env-test.d.ts} +4 -4
  133. package/dist/components/post-env-test.js +31 -0
  134. package/dist/components/post-footer.js +17 -16
  135. package/dist/components/post-header.js +156 -119
  136. package/dist/components/post-icon2.js +8 -6
  137. package/dist/components/post-language-menu-item.d.ts +11 -0
  138. package/dist/components/post-language-menu-item.js +98 -0
  139. package/dist/components/{post-language-switch.d.ts → post-language-menu.d.ts} +4 -4
  140. package/dist/components/post-language-menu.js +156 -0
  141. package/dist/components/post-linkarea.js +1 -1
  142. package/dist/components/post-logo.js +3 -4
  143. package/dist/components/post-mainnavigation.js +21 -32
  144. package/dist/components/post-megadropdown-trigger.js +72 -79
  145. package/dist/components/post-megadropdown.js +183 -78
  146. package/dist/components/post-menu-item2.js +1 -1
  147. package/dist/components/post-menu-trigger2.js +2 -3
  148. package/dist/components/post-menu2.js +35 -36
  149. package/dist/components/post-pagination.d.ts +11 -0
  150. package/dist/components/post-pagination.js +635 -0
  151. package/dist/components/post-popover-trigger.js +41 -26
  152. package/dist/components/post-popover.js +9 -10
  153. package/dist/components/post-popovercontainer2.js +44 -40
  154. package/dist/components/post-rating.js +3 -4
  155. package/dist/components/post-stepper-item.d.ts +11 -0
  156. package/dist/components/post-stepper-item.js +33 -0
  157. package/dist/components/{post-list-item.d.ts → post-stepper.d.ts} +4 -4
  158. package/dist/components/post-stepper.js +136 -0
  159. package/dist/components/{post-tab-header.d.ts → post-tab-item.d.ts} +4 -4
  160. package/dist/components/post-tab-item.js +70 -0
  161. package/dist/components/post-tab-panel.js +8 -9
  162. package/dist/components/post-tabs.js +192 -37
  163. package/dist/components/post-togglebutton.js +1 -51
  164. package/dist/components/post-togglebutton2.js +53 -0
  165. package/dist/components/post-tooltip-trigger.js +3 -3
  166. package/dist/components/post-tooltip.js +3 -4
  167. package/dist/components/react/index.js +1 -1
  168. package/dist/{cjs/breakpoints-CEkeixld.js → components/react/p-B8YiQ3mz.js} +89 -6
  169. package/dist/components/react/{p-2U_BGLjc.js → p-BOLlAY91.js} +9 -7
  170. package/dist/components/react/p-BVCjnh6Q.js +36 -0
  171. package/dist/components/react/{p-CBFgkSgY.js → p-BVGcVycs.js} +1 -1
  172. package/dist/components/react/{p-D4NSCxrX.js → p-BYCGzO-t.js} +13 -13
  173. package/dist/components/react/p-C9hMpmsD.js +11 -0
  174. package/dist/components/react/{p-BVXiQdHq.js → p-CJ13r5fi.js} +29 -21
  175. package/dist/components/react/{p-nSFSgY-P.js → p-CnZWXrbA.js} +40 -41
  176. package/dist/components/react/p-CoDiS_Ik.js +24 -0
  177. package/dist/components/react/p-CyniMNY-.js +54 -0
  178. package/dist/components/react/p-D5knoiyy.js +24 -0
  179. package/dist/components/react/{p-Ccgu_WOx.js → p-DBO6FfHt.js} +4 -5
  180. package/dist/components/react/{p-BfLuYwf7.js → p-DRfa3MOV.js} +26 -26
  181. package/dist/components/react/{p-BUxAs8N5.js → p-DYImHx0e.js} +4 -5
  182. package/dist/components/react/p-DZ5m2Ttg.js +3 -0
  183. package/dist/components/react/p-FxUVQ4Tx.js +49 -0
  184. package/dist/components/react/{p-BK474oMI.js → p-L36-yvgK.js} +2 -2
  185. package/dist/components/react/{p-DVxZMuPW.js → p-NCAcc7ZZ.js} +6 -7
  186. package/dist/components/react/{p-mENtrn2l.js → p-QNPIvxLq.js} +45 -41
  187. package/dist/components/react/{p-D3CFjhAf.js → p-_pLhqTys.js} +5 -6
  188. package/dist/components/react/p-c6yNOQwn.js +113 -0
  189. package/dist/components/react/{p-CzIKqBrS.js → p-rEfV4v4a.js} +2 -2
  190. package/dist/components/react/post-accordion-item.js +1 -1
  191. package/dist/components/react/post-accordion.js +1 -1
  192. package/dist/components/react/post-avatar.js +4 -5
  193. package/dist/components/react/post-back-to-top.js +16 -42
  194. package/dist/components/react/post-banner.js +7 -8
  195. package/dist/components/react/post-breadcrumb-item.js +1 -1
  196. package/dist/components/react/post-breadcrumbs.js +31 -41
  197. package/dist/components/react/post-card-control.js +6 -7
  198. package/dist/components/react/post-closebutton.js +1 -1
  199. package/dist/components/react/post-collapsible-trigger.js +1 -1
  200. package/dist/components/react/post-collapsible.js +1 -1
  201. package/dist/components/react/{post-list.d.ts → post-env-test.d.ts} +4 -4
  202. package/dist/components/react/post-env-test.js +32 -0
  203. package/dist/components/react/post-footer.js +23 -22
  204. package/dist/components/react/post-header.js +158 -121
  205. package/dist/components/react/post-icon.js +1 -1
  206. package/dist/components/react/post-language-menu-item.d.ts +11 -0
  207. package/dist/components/react/post-language-menu-item.js +99 -0
  208. package/dist/components/react/{post-language-option.d.ts → post-language-menu.d.ts} +4 -4
  209. package/dist/components/react/post-language-menu.js +157 -0
  210. package/dist/components/react/post-linkarea.js +2 -2
  211. package/dist/components/react/post-logo.js +4 -5
  212. package/dist/components/react/post-mainnavigation.js +23 -34
  213. package/dist/components/react/post-megadropdown-trigger.js +74 -81
  214. package/dist/components/react/post-megadropdown.js +185 -80
  215. package/dist/components/react/post-menu-item.js +1 -1
  216. package/dist/components/react/post-menu-trigger.js +1 -1
  217. package/dist/components/react/post-menu.js +1 -1
  218. package/dist/components/react/post-pagination.d.ts +11 -0
  219. package/dist/components/react/post-pagination.js +636 -0
  220. package/dist/components/react/post-popover-trigger.js +42 -27
  221. package/dist/components/react/post-popover.js +14 -15
  222. package/dist/components/react/post-popovercontainer.js +1 -1
  223. package/dist/components/react/post-rating.js +5 -6
  224. package/dist/components/react/post-stepper-item.d.ts +11 -0
  225. package/dist/components/react/post-stepper-item.js +34 -0
  226. package/dist/components/react/{post-list-item.d.ts → post-stepper.d.ts} +4 -4
  227. package/dist/components/react/post-stepper.js +137 -0
  228. package/dist/components/react/{post-tab-header.d.ts → post-tab-item.d.ts} +4 -4
  229. package/dist/components/react/post-tab-item.js +71 -0
  230. package/dist/components/react/post-tab-panel.js +9 -10
  231. package/dist/components/react/post-tabs.js +193 -38
  232. package/dist/components/react/post-togglebutton.js +1 -52
  233. package/dist/components/react/post-tooltip-trigger.js +4 -4
  234. package/dist/components/react/post-tooltip.js +5 -6
  235. package/dist/components/utils.js +24 -0
  236. package/dist/docs.json +968 -563
  237. package/dist/esm/{breakpoints-CJ80BZ06.js → breakpoints-DYoSKGHO.js} +90 -3
  238. package/dist/esm/debounce-C9hMpmsD.js +11 -0
  239. package/dist/esm/environment-CEmnRoA6.js +49 -0
  240. package/dist/esm/{event-from-CzIKqBrS.js → event-from-rEfV4v4a.js} +2 -2
  241. package/dist/esm/fade-DsgPYmAa.js +24 -0
  242. package/dist/esm/fade-slide-CvOvauo9.js +36 -0
  243. package/dist/esm/{get-focusable-children-D9ZHp2FP.js → get-focusable-children-BXNs2_sw.js} +29 -21
  244. package/dist/esm/{get-root-BkQ3CrLq.js → get-root-CXfAA093.js} +1 -1
  245. package/dist/esm/{index-CFNKgUjL.js → index-1ReqxAnI.js} +29 -13
  246. package/dist/esm/loader.js +3 -3
  247. package/dist/esm/package-DZ5m2Ttg.js +3 -0
  248. package/dist/esm/post-accordion_2.entry.js +10 -10
  249. package/dist/esm/post-avatar.entry.js +6 -6
  250. package/dist/esm/post-back-to-top.entry.js +16 -40
  251. package/dist/esm/post-banner.entry.js +10 -9
  252. package/dist/esm/post-breadcrumb-item_2.entry.js +6 -6
  253. package/dist/esm/post-breadcrumbs.entry.js +20 -29
  254. package/dist/esm/post-card-control.entry.js +6 -6
  255. package/dist/esm/{post-closebutton_15.entry.js → post-closebutton_13.entry.js} +518 -486
  256. package/dist/esm/post-collapsible_2.entry.js +36 -35
  257. package/dist/esm/post-components.js +3 -3
  258. package/dist/esm/post-env-test.entry.js +13 -0
  259. package/dist/esm/post-footer.entry.js +18 -16
  260. package/dist/esm/post-linkarea.entry.js +3 -3
  261. package/dist/esm/post-pagination.entry.js +587 -0
  262. package/dist/esm/post-popover-trigger.entry.js +44 -28
  263. package/dist/esm/post-popover.entry.js +11 -11
  264. package/dist/esm/post-rating.entry.js +5 -5
  265. package/dist/esm/post-stepper-item.entry.js +16 -0
  266. package/dist/esm/post-stepper.entry.js +107 -0
  267. package/dist/esm/post-tab-item.entry.js +47 -0
  268. package/dist/esm/post-tab-panel.entry.js +9 -9
  269. package/dist/esm/post-tabs.entry.js +191 -38
  270. package/dist/esm/post-tooltip-trigger.entry.js +5 -5
  271. package/dist/esm/post-tooltip.entry.js +6 -6
  272. package/dist/esm/utils-CoDiS_Ik.js +24 -0
  273. package/dist/post-components/{p-8f0fc02a.entry.js → p-130eb074.entry.js} +1 -1
  274. package/dist/post-components/p-13d018fe.entry.js +1 -0
  275. package/dist/post-components/p-143e5a84.entry.js +1 -0
  276. package/dist/post-components/p-1ReqxAnI.js +2 -0
  277. package/dist/post-components/p-2b220851.entry.js +1 -0
  278. package/dist/post-components/{p-96750e25.entry.js → p-390f111f.entry.js} +1 -1
  279. package/dist/post-components/p-3cf09fbd.entry.js +1 -0
  280. package/dist/post-components/p-52e584ca.entry.js +1 -0
  281. package/dist/post-components/p-56a4040c.entry.js +1 -0
  282. package/dist/post-components/p-675dab57.entry.js +1 -0
  283. package/dist/post-components/p-6857fd9d.entry.js +1 -0
  284. package/dist/post-components/p-7cd00e3e.entry.js +1 -0
  285. package/dist/post-components/p-7f5d2487.entry.js +1 -0
  286. package/dist/post-components/{p-bf41fe56.entry.js → p-88201353.entry.js} +1 -1
  287. package/dist/post-components/p-89360cd1.entry.js +1 -0
  288. package/dist/post-components/p-B7ebLhHc.js +1 -0
  289. package/dist/post-components/p-BVCjnh6Q.js +1 -0
  290. package/dist/post-components/p-BXNs2_sw.js +1 -0
  291. package/dist/post-components/p-C9hMpmsD.js +1 -0
  292. package/dist/post-components/p-CEmnRoA6.js +1 -0
  293. package/dist/post-components/p-CoDiS_Ik.js +1 -0
  294. package/dist/post-components/p-D5knoiyy.js +1 -0
  295. package/dist/post-components/p-DI-h_mEL.js +1 -0
  296. package/dist/post-components/p-DZ5m2Ttg.js +1 -0
  297. package/dist/post-components/p-a740eaed.entry.js +1 -0
  298. package/dist/post-components/{p-261b1452.entry.js → p-a79590f5.entry.js} +1 -1
  299. package/dist/post-components/p-b708d96a.entry.js +1 -0
  300. package/dist/post-components/p-bcf5786f.entry.js +1 -0
  301. package/dist/post-components/p-c92512f5.entry.js +1 -0
  302. package/dist/post-components/{p-658b1ccc.entry.js → p-d7cb3a61.entry.js} +1 -1
  303. package/dist/post-components/p-d7f33813.entry.js +1 -0
  304. package/dist/post-components/p-da97ee21.entry.js +1 -0
  305. package/dist/post-components/{p-11c204e0.entry.js → p-ed4db774.entry.js} +1 -1
  306. package/dist/post-components/post-components.css +1 -1
  307. package/dist/post-components/post-components.esm.js +1 -1
  308. package/dist/prebuild.js +46 -0
  309. package/dist/types/animations/collapse.d.ts +1 -0
  310. package/dist/types/animations/fade-slide.d.ts +11 -0
  311. package/dist/types/animations/fade.d.ts +2 -2
  312. package/dist/types/animations/index.d.ts +2 -0
  313. package/dist/types/animations/slide.d.ts +9 -2
  314. package/dist/types/animations/types.d.ts +13 -0
  315. package/dist/types/animations/utils.d.ts +2 -0
  316. package/dist/types/components/post-accordion-item/heading-levels.d.ts +1 -1
  317. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -2
  318. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -2
  319. package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +6 -6
  320. package/dist/types/components/post-collapsible/post-collapsible.d.ts +4 -5
  321. package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +1 -0
  322. package/dist/types/components/post-footer/post-footer.d.ts +4 -4
  323. package/dist/types/components/post-header/post-header.d.ts +28 -19
  324. package/dist/types/components/{post-language-switch/post-language-switch.d.ts → post-language-menu/post-language-menu.d.ts} +6 -6
  325. package/dist/types/components/{post-language-option/post-language-option.d.ts → post-language-menu-item/post-language-menu-item.d.ts} +5 -5
  326. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +6 -5
  327. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +20 -2
  328. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +17 -23
  329. package/dist/types/components/post-menu/post-menu.d.ts +4 -4
  330. package/dist/types/components/post-pagination/post-pagination.d.ts +224 -0
  331. package/dist/types/components/post-popover/post-popover.d.ts +3 -3
  332. package/dist/types/components/post-popover-trigger/post-popover-trigger.d.ts +2 -1
  333. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +13 -16
  334. package/dist/types/components/post-rating/post-rating.d.ts +1 -1
  335. package/dist/types/components/post-stepper/post-stepper.d.ts +39 -0
  336. package/dist/types/components/post-stepper-item/post-stepper-item.d.ts +3 -0
  337. package/dist/types/components/post-tab-item/post-tab-item.d.ts +19 -0
  338. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +3 -3
  339. package/dist/types/components/post-tabs/post-tabs.d.ts +33 -12
  340. package/dist/types/components.d.ts +357 -186
  341. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/prebuild.d.ts +9 -0
  342. package/dist/types/types/heading-levels.d.ts +1 -1
  343. package/dist/types/utils/environment.d.ts +25 -1
  344. package/dist/types/utils/get-focusable-children.d.ts +2 -2
  345. package/dist/types/utils/tests/environment/hydrate-app-helper.d.ts +5 -0
  346. package/dist/types/utils/tests/environment/post-env-test.d.ts +3 -0
  347. package/hydrate/index.js +1882 -833
  348. package/hydrate/index.mjs +1882 -833
  349. package/package.json +9 -11
  350. package/dist/cjs/fade-nS5zzDQS.js +0 -14
  351. package/dist/cjs/index-DtvYdwe1.js +0 -96
  352. package/dist/cjs/post-tab-header.cjs.entry.js +0 -31
  353. package/dist/collection/animations/slide-and-fade.js +0 -25
  354. package/dist/collection/components/post-language-option/post-language-option.css +0 -1
  355. package/dist/collection/components/post-language-switch/post-language-switch.css +0 -1
  356. package/dist/collection/components/post-list/post-list.css +0 -1
  357. package/dist/collection/components/post-list/post-list.js +0 -97
  358. package/dist/collection/components/post-list-item/post-list-item.css +0 -1
  359. package/dist/collection/components/post-list-item/post-list-item.js +0 -26
  360. package/dist/collection/components/post-tab-header/post-tab-header.css +0 -1
  361. package/dist/collection/components/post-tab-header/post-tab-header.js +0 -65
  362. package/dist/components/index2.js +0 -88
  363. package/dist/components/post-language-option.d.ts +0 -11
  364. package/dist/components/post-language-option.js +0 -99
  365. package/dist/components/post-language-switch.js +0 -157
  366. package/dist/components/post-list-item.js +0 -38
  367. package/dist/components/post-list.js +0 -61
  368. package/dist/components/post-tab-header.js +0 -52
  369. package/dist/components/react/p-BXRsHuTS.js +0 -3
  370. package/dist/components/react/p-CV7fm1rW.js +0 -88
  371. package/dist/components/react/p-Dj7qWba5.js +0 -114
  372. package/dist/components/react/p-SbIC4aZX.js +0 -11
  373. package/dist/components/react/post-language-option.js +0 -100
  374. package/dist/components/react/post-language-switch.d.ts +0 -11
  375. package/dist/components/react/post-language-switch.js +0 -158
  376. package/dist/components/react/post-list-item.js +0 -39
  377. package/dist/components/react/post-list.js +0 -62
  378. package/dist/components/react/post-tab-header.js +0 -53
  379. package/dist/esm/fade-SbIC4aZX.js +0 -11
  380. package/dist/esm/index-VmK3ABCB.js +0 -88
  381. package/dist/esm/package-BXRsHuTS.js +0 -3
  382. package/dist/esm/post-tab-header.entry.js +0 -29
  383. package/dist/post-components/p-02ea3ec5.entry.js +0 -1
  384. package/dist/post-components/p-0e92dbef.entry.js +0 -1
  385. package/dist/post-components/p-0ec2bdd7.entry.js +0 -1
  386. package/dist/post-components/p-197a0f25.entry.js +0 -1
  387. package/dist/post-components/p-3274ab81.entry.js +0 -1
  388. package/dist/post-components/p-77e43032.entry.js +0 -1
  389. package/dist/post-components/p-BXRsHuTS.js +0 -1
  390. package/dist/post-components/p-CBFgkSgY.js +0 -1
  391. package/dist/post-components/p-CFNKgUjL.js +0 -2
  392. package/dist/post-components/p-CJ80BZ06.js +0 -1
  393. package/dist/post-components/p-D9ZHp2FP.js +0 -1
  394. package/dist/post-components/p-SbIC4aZX.js +0 -1
  395. package/dist/post-components/p-VmK3ABCB.js +0 -1
  396. package/dist/post-components/p-b5b5e4b9.entry.js +0 -1
  397. package/dist/post-components/p-b8059ba1.entry.js +0 -1
  398. package/dist/post-components/p-d6134e24.entry.js +0 -1
  399. package/dist/post-components/p-e7029b9e.entry.js +0 -1
  400. package/dist/post-components/p-e90688ab.entry.js +0 -1
  401. package/dist/post-components/p-ea5da614.entry.js +0 -1
  402. package/dist/post-components/p-f1b815b6.entry.js +0 -1
  403. package/dist/types/animations/slide-and-fade.d.ts +0 -2
  404. package/dist/types/components/post-list/post-list.d.ts +0 -24
  405. package/dist/types/components/post-list-item/post-list-item.d.ts +0 -8
  406. package/dist/types/components/post-tab-header/post-tab-header.d.ts +0 -14
  407. /package/dist/collection/components/{post-language-switch → post-language-menu}/switch-variants.js +0 -0
  408. /package/dist/post-components/{p-CzIKqBrS.js → p-rEfV4v4a.js} +0 -0
  409. /package/dist/types/components/{post-language-switch → post-language-menu}/switch-variants.d.ts +0 -0
@@ -1,9 +1,29 @@
1
1
  import { getFocusableChildren } from "../../utils/get-focusable-children";
2
- import { h, Host } from "@stencil/core";
2
+ import { h, Host, } from "@stencil/core";
3
3
  import { version } from "../../../../package";
4
4
  import { breakpoint } from "../../utils/breakpoints";
5
+ import { slide } from "../../animations/index";
6
+ import { fadeSlide } from "../../animations/fade-slide";
7
+ import { checkRequiredAndType } from "../../utils/index";
5
8
  export class PostMegadropdown {
9
+ validateTextClose() {
10
+ checkRequiredAndType(this, 'textClose', 'string');
11
+ }
12
+ validateTextBack() {
13
+ checkRequiredAndType(this, 'textBack', 'string');
14
+ }
15
+ get megadropdownTrigger() {
16
+ const hostId = this.host.getAttribute('id');
17
+ return hostId ? document.querySelector(`post-megadropdown-trigger[for="${hostId}"]`) : null;
18
+ }
6
19
  constructor() {
20
+ this.currentAnimation = null;
21
+ this.isAnimating = false;
22
+ this.fsAnimationOptions = {
23
+ translate: -10,
24
+ duration: 350,
25
+ easing: 'headerEase',
26
+ };
7
27
  this.device = breakpoint.get('device');
8
28
  /**
9
29
  * Holds the current visibility state of the dropdown.
@@ -14,13 +34,17 @@ export class PostMegadropdown {
14
34
  this.trigger = false;
15
35
  /** Holds the current animation class. */
16
36
  this.animationClass = null;
17
- this.handleClickOutside = (event) => {
37
+ this.handleClickOutside = async (event) => {
18
38
  if (this.device !== 'desktop')
19
39
  return;
20
40
  const target = event.target;
21
41
  if (this.host.contains(target)) {
22
42
  return;
23
43
  }
44
+ // Ignore clicks on the trigger or its contents to prevent running hide() twice
45
+ if (this.megadropdownTrigger.contains(target)) {
46
+ return;
47
+ }
24
48
  if (target instanceof HTMLElement) {
25
49
  const trigger = target.closest('post-megadropdown-trigger');
26
50
  if (trigger) {
@@ -30,14 +54,11 @@ export class PostMegadropdown {
30
54
  }
31
55
  }
32
56
  }
33
- this.hide(false);
57
+ await this.hide(false);
34
58
  };
35
- }
36
- get megadropdownTrigger() {
37
- const hostId = this.host.getAttribute('id');
38
- return hostId
39
- ? document.querySelector(`post-megadropdown-trigger[for="${hostId}"] > button`)
40
- : null;
59
+ this.keyboardHandler = this.keyboardHandler.bind(this);
60
+ this.handleTabOutside = this.handleTabOutside.bind(this);
61
+ this.handleClickOutside = this.handleClickOutside.bind(this);
41
62
  }
42
63
  connectedCallback() {
43
64
  window.addEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
@@ -46,16 +67,17 @@ export class PostMegadropdown {
46
67
  this.getFocusableElements();
47
68
  }
48
69
  componentDidLoad() {
70
+ this.validateTextClose();
71
+ this.validateTextBack();
49
72
  this.checkInitialAriaCurrent();
50
73
  this.setupObserver();
51
74
  this.handleAriaCurrentChange([]);
52
75
  }
53
76
  disconnectedCallback() {
54
- this.removeListeners();
55
77
  window.removeEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
56
- if (PostMegadropdown.activeDropdown === this) {
78
+ if (PostMegadropdown.activeDropdown === this)
57
79
  PostMegadropdown.activeDropdown = null;
58
- }
80
+ this.removeListeners();
59
81
  if (this.defaultSlotObserver) {
60
82
  this.defaultSlotObserver.disconnect();
61
83
  }
@@ -64,41 +86,70 @@ export class PostMegadropdown {
64
86
  * Toggles the dropdown visibility based on its current state.
65
87
  */
66
88
  async toggle() {
67
- if (this.isVisible) {
68
- this.hide();
69
- }
70
- else {
71
- await this.show();
89
+ if (this.isAnimating) {
90
+ // If this is already animating towards a future state -> reverse intent
91
+ return this.isVisible ? this.show() : this.hide();
72
92
  }
93
+ return this.isVisible ? this.hide() : this.show();
73
94
  }
74
95
  /**
75
96
  * Displays the dropdown.
76
97
  */
77
98
  async show() {
99
+ if (this.device !== 'desktop') {
100
+ const trigger = this.megadropdownTrigger;
101
+ if (trigger)
102
+ this.megadropdownTitle = trigger.innerHTML;
103
+ }
78
104
  if (PostMegadropdown.activeDropdown && PostMegadropdown.activeDropdown !== this) {
79
105
  // Close the previously active dropdown without animation
80
106
  PostMegadropdown.activeDropdown.forceClose();
81
107
  }
82
- this.animationClass = 'slide-in';
108
+ this.cancelAnimation();
109
+ // Set the megadropdown visible and mark it as the active dropdown
83
110
  this.isVisible = true;
84
111
  PostMegadropdown.activeDropdown = this;
85
- this.postToggleMegadropdown.emit({ isVisible: this.isVisible });
86
- if (this.firstFocusableEl &&
87
- window.getComputedStyle(this.firstFocusableEl).display !== 'none') {
88
- this.firstFocusableEl.focus();
112
+ // Update trigger state
113
+ this.postToggleMegadropdown.emit({ isVisible: true });
114
+ try {
115
+ await this.animate('in');
116
+ this.focusFirst();
117
+ // After the megadropdown has finished entry animation
118
+ this.addListeners();
119
+ }
120
+ catch {
121
+ // Open animation was cancelled - reset state
122
+ this.removeListeners();
123
+ this.isVisible = false;
124
+ if (PostMegadropdown.activeDropdown === this)
125
+ PostMegadropdown.activeDropdown = null;
126
+ this.postToggleMegadropdown.emit({ isVisible: false, focusParent: true });
89
127
  }
90
- this.addListeners();
91
128
  }
92
129
  /**
93
130
  * Hides the dropdown with an animation.
94
131
  */
95
132
  async hide(focusParent = true, forceClose = false) {
96
- this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
97
133
  if (forceClose) {
98
134
  this.forceClose();
135
+ return;
99
136
  }
100
- else {
101
- this.animationClass = 'slide-out';
137
+ // Update trigger state
138
+ this.postToggleMegadropdown.emit({ isVisible: false, focusParent: focusParent });
139
+ try {
140
+ await this.animate('out');
141
+ // After the closing animation finishes set the megadropdown as non visible
142
+ this.isVisible = false;
143
+ this.removeListeners();
144
+ if (PostMegadropdown.activeDropdown === this)
145
+ PostMegadropdown.activeDropdown = null;
146
+ }
147
+ catch {
148
+ // Closing animation was cancelled - reset state
149
+ PostMegadropdown.activeDropdown = this;
150
+ this.addListeners();
151
+ this.isVisible = true;
152
+ this.postToggleMegadropdown.emit({ isVisible: true, focusParent: false });
102
153
  }
103
154
  }
104
155
  /**
@@ -107,68 +158,79 @@ export class PostMegadropdown {
107
158
  async focusFirst() {
108
159
  this.firstFocusableEl?.focus();
109
160
  }
110
- breakpointChange(e) {
111
- this.device = e.detail;
112
- if (this.device === 'desktop' && this.isVisible) {
113
- this.animationClass = null;
114
- }
115
- }
116
161
  /**
117
162
  * Forces the dropdown to close without animation.
118
163
  */
119
164
  forceClose() {
120
- this.isVisible = false;
121
- this.animationClass = null;
122
- this.postToggleMegadropdown.emit({ isVisible: this.isVisible, focusParent: false });
123
165
  this.removeListeners();
166
+ this.postToggleMegadropdown.emit({ isVisible: false, focusParent: false });
167
+ this.isVisible = false;
124
168
  }
125
- handleAnimationEnd() {
126
- if (this.animationClass === 'slide-out') {
127
- this.isVisible = false;
128
- this.animationClass = null;
129
- PostMegadropdown.activeDropdown = null;
130
- this.removeListeners();
169
+ // Run the respective animation
170
+ createAnimation(direction) {
171
+ if (this.device === 'desktop') {
172
+ return fadeSlide(this.animatedContainer, direction, this.fsAnimationOptions);
131
173
  }
174
+ return slide(this.animatedContainer, direction, {
175
+ translate: 100,
176
+ duration: 350,
177
+ easing: direction === 'in' ? 'ease-in' : 'ease-out',
178
+ });
179
+ }
180
+ async animate(direction) {
181
+ this.cancelAnimation();
182
+ this.currentAnimation = this.createAnimation(direction);
183
+ // Flag isAnimating used to avoid toggle() de-sync
184
+ this.isAnimating = true;
185
+ await this.currentAnimation.finished;
186
+ this.isAnimating = false;
187
+ this.currentAnimation = null;
188
+ }
189
+ cancelAnimation() {
190
+ this.currentAnimation?.cancel();
191
+ this.currentAnimation = null;
192
+ }
193
+ breakpointChange(e) {
194
+ this.device = e.detail;
195
+ this.cancelAnimation();
132
196
  }
133
197
  addListeners() {
134
- this.host.addEventListener('keydown', e => this.keyboardHandler(e));
135
- document.addEventListener('keyup', e => this.handleTabOutside(e));
198
+ this.host.addEventListener('keydown', this.keyboardHandler);
199
+ document.addEventListener('keyup', this.handleTabOutside);
136
200
  document.addEventListener('mousedown', this.handleClickOutside);
137
201
  }
138
202
  removeListeners() {
139
- this.host.removeEventListener('keydown', e => this.keyboardHandler(e));
140
- document.removeEventListener('keyup', e => this.handleTabOutside(e));
203
+ this.host.removeEventListener('keydown', this.keyboardHandler);
204
+ document.removeEventListener('keyup', this.handleTabOutside);
141
205
  document.removeEventListener('mousedown', this.handleClickOutside);
142
206
  }
143
207
  getFocusableElements() {
144
- const focusableEls = Array.from(this.host.querySelectorAll('post-list-item, h3, .back-button'));
145
- const focusableChildren = focusableEls.flatMap(el => Array.from(getFocusableChildren(el)));
146
- // Check for an overview link
147
- const overviewLink = this.host.querySelector('a[slot="megadropdown-overview-link"]');
148
- if (overviewLink) {
149
- focusableChildren.unshift(overviewLink);
150
- }
151
- this.firstFocusableEl = focusableChildren[0];
152
- this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
208
+ const focusableElements = [
209
+ ...getFocusableChildren(this.host),
210
+ ...getFocusableChildren(this.host.shadowRoot),
211
+ ];
212
+ this.firstFocusableEl = focusableElements[0];
213
+ this.lastFocusableEl = focusableElements[focusableElements.length - 1];
153
214
  }
154
215
  // Loop through the focusable children
155
216
  keyboardHandler(e) {
156
- if (e.key === 'Tab' && this.device !== 'desktop') {
157
- if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
158
- // If back tab (TAB + Shift) and first element is focused, focus goes to the last element of the megadropdown
159
- e.preventDefault();
160
- this.lastFocusableEl.focus();
161
- }
162
- else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
163
- // If TAB and last element is focused, focus goes back to the first element of the megadropdown
164
- e.preventDefault();
165
- this.firstFocusableEl.focus();
166
- }
217
+ if (e.key !== 'Tab' || this.device === 'desktop')
218
+ return;
219
+ const activeElement = this.host.shadowRoot.activeElement || document.activeElement;
220
+ if (e.shiftKey && activeElement === this.firstFocusableEl) {
221
+ // If back tab (TAB + Shift) and first element is focused, focus goes to the last element of the megadropdown
222
+ e.preventDefault();
223
+ this.lastFocusableEl.focus();
224
+ }
225
+ else if (!e.shiftKey && activeElement === this.lastFocusableEl) {
226
+ // If TAB and last element is focused, focus goes back to the first element of the megadropdown
227
+ e.preventDefault();
228
+ this.firstFocusableEl.focus();
167
229
  }
168
230
  }
169
231
  handleTabOutside(e) {
170
232
  if (e.key === 'Tab' && this.device === 'desktop') {
171
- if (!this.host.contains(e.target)) {
233
+ if (this.isVisible && !this.host.contains(e.target)) {
172
234
  this.hide(false);
173
235
  }
174
236
  }
@@ -194,14 +256,8 @@ export class PostMegadropdown {
194
256
  */
195
257
  setTriggerActive(isActive) {
196
258
  const trigger = this.megadropdownTrigger;
197
- if (!trigger)
198
- return;
199
- if (isActive) {
200
- trigger.classList.add('active');
201
- }
202
- else {
203
- trigger.classList.remove('active');
204
- }
259
+ if (trigger)
260
+ trigger.setAttribute('active', isActive.toString());
205
261
  }
206
262
  /**
207
263
  * Updates the megadropdown trigger state when the megadropdown content changes.
@@ -225,9 +281,10 @@ export class PostMegadropdown {
225
281
  }
226
282
  render() {
227
283
  const containerStyle = this.isVisible ? {} : { display: 'none' };
228
- return (h(Host, { key: 'd111d8d93a9b64018f3df88813da8f6d1c65759e', version: version }, h("div", { key: 'd7cb2b98624c9241108bc66cc11c15c0a2e7acf3', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: '9f0280b6f28f19ee7f9ba4707209b64b38759927', class: "megadropdown" }, h("slot", { key: '71f2521e1ab13406dd986c18a7c52e171148b0b0', name: "megadropdown-title" }), h("slot", { key: '148de1446aade76b074e155d07b70e775fc9612c', name: "megadropdown-overview-link" }), h("div", { key: '269c1e1db66acb7c274c720a9f715d29e875ef54', class: "megadropdown-content" }, h("slot", { key: '444040337c57e64bcc57f56415c4c40513ef0a5b' })), h("div", { key: 'f97d8c578ee19b5ba7d593e5d110e3b283255087', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: 'dc04da3a42714e2e8742ab8ed25bcc288a236294', name: "back-button" })), h("div", { key: '354eca51a5aef76d483a30e595bedfa95792d7ce', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '28693622360c0da91f3051426be545852c5ec337', name: "close-button" }))))));
284
+ return (h(Host, { key: 'f099891f24c60ca48ddceeadf754debdf3d8bff1', version: version }, h("div", { key: 'd964a72ec31632a6061f8c656fcc171bc584b764', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: 'b04d8fb83e5658365a1d722572d82237a7bf4eba', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: 'b7e654a69375c4e8f3af2e8ff65f0a5b7b2ee2cd', class: "megadropdown-content" }, h("slot", { key: '9608aa8b0d9458b593917e66e3fd4db9c447cac2' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack)))));
229
285
  }
230
286
  static get is() { return "post-megadropdown"; }
287
+ static get encapsulation() { return "shadow"; }
231
288
  static get originalStyleUrls() {
232
289
  return {
233
290
  "$": ["post-megadropdown.scss"]
@@ -238,11 +295,54 @@ export class PostMegadropdown {
238
295
  "$": ["post-megadropdown.css"]
239
296
  };
240
297
  }
298
+ static get properties() {
299
+ return {
300
+ "textClose": {
301
+ "type": "string",
302
+ "attribute": "text-close",
303
+ "mutable": false,
304
+ "complexType": {
305
+ "original": "string",
306
+ "resolved": "string",
307
+ "references": {}
308
+ },
309
+ "required": true,
310
+ "optional": false,
311
+ "docs": {
312
+ "tags": [],
313
+ "text": "An accessible label for the close button visible on desktop"
314
+ },
315
+ "getter": false,
316
+ "setter": false,
317
+ "reflect": true
318
+ },
319
+ "textBack": {
320
+ "type": "string",
321
+ "attribute": "text-back",
322
+ "mutable": false,
323
+ "complexType": {
324
+ "original": "string",
325
+ "resolved": "string",
326
+ "references": {}
327
+ },
328
+ "required": true,
329
+ "optional": false,
330
+ "docs": {
331
+ "tags": [],
332
+ "text": "A label for the back button visible on tablet and mobile"
333
+ },
334
+ "getter": false,
335
+ "setter": false,
336
+ "reflect": true
337
+ }
338
+ };
339
+ }
241
340
  static get states() {
242
341
  return {
243
342
  "device": {},
244
343
  "isVisible": {},
245
344
  "trigger": {},
345
+ "megadropdownTitle": {},
246
346
  "animationClass": {}
247
347
  };
248
348
  }
@@ -345,6 +445,15 @@ export class PostMegadropdown {
345
445
  };
346
446
  }
347
447
  static get elementRef() { return "host"; }
448
+ static get watchers() {
449
+ return [{
450
+ "propName": "textClose",
451
+ "methodName": "validateTextClose"
452
+ }, {
453
+ "propName": "textBack",
454
+ "methodName": "validateTextBack"
455
+ }];
456
+ }
348
457
  }
349
458
  /** Tracks the currently active dropdown instance. */
350
459
  PostMegadropdown.activeDropdown = null;
@@ -1 +1,3 @@
1
- post-megadropdown-trigger{width:100%;position:relative;z-index:3}@media screen and (max-width: 1023.98px){post-megadropdown-trigger{z-index:4}}
1
+ button{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;border:unset;font-weight:unset;display:flex;padding:.25rem .625rem;gap:.375rem;font-size:1rem;border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}button:hover{text-decoration:none}button:disabled{border-style:var(--post-core-border-style-dash)}button{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){button:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){button:is(a){color:LinkText;border:unset}button:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}button:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}button:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}button:hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg);color:var(--post-scheme-color-interactive-button-primary-enabled-fg)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active):hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}button{--post-nav-item-border-width: 1px;width:100%;justify-content:start;position:relative;padding:.75rem .75rem calc(.75rem - var(--post-nav-item-border-width)) .5rem;gap:1rem;border-radius:0;line-height:1.5;outline-color:currentColor !important;height:100%}button::before{content:"";background-color:#050400;position:absolute;inset-inline:0;inset-block-end:0;height:var(--post-nav-item-border-width)}button:hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg);color:var(--post-scheme-color-interactive-button-primary-hover-fg)}button:hover::before{background-color:rgba(0,0,0,0)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){box-shadow:none}button{outline-offset:calc(
2
+ -2px - var(--post-device-border-width-focus)
3
+ ) !important}button>post-icon:where(:last-child){margin-inline-start:auto}@media screen and (min-width: 0)and (max-width: 599.98px){button{padding:calc(.5rem + 1.5px) .75rem calc(.5rem + 1.5px - var(--post-nav-item-border-width)) .5rem;gap:.5rem;font-size:.875rem}button>post-icon{font-size:1rem}}@media screen and (min-width: 600px)and (max-width: 1023.98px){button>post-icon{font-size:1.5rem}}@media screen and (min-width: 1024px){button{padding:1rem .75rem;gap:.5rem}button::before{content:unset}}:host{position:relative;display:inline-block}button post-icon{transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1)}button:is([aria-current],[aria-pressed=true],[aria-expanded=true]) post-icon{transform:rotate(180deg)}button>span{position:relative}button>span>span[aria-hidden]{font-weight:700;visibility:hidden}button>span>span:not([aria-hidden]){position:absolute;inset:0}@media screen and (min-width: 1024px){button:is([aria-current],[aria-pressed=true],[aria-expanded=true],.active){font-weight:700}}@media screen and (max-width: 1023.98px){button post-icon{margin-inline-start:auto;transform:rotate(-90deg) !important}}
@@ -10,92 +10,77 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
10
10
  };
11
11
  import { h, Host } from "@stencil/core";
12
12
  import { version } from "../../../../package";
13
- import { checkRequiredAndType, EventFrom } from "../../utils/index";
13
+ import { checkRequiredAndType, EventFrom, IS_BROWSER } from "../../utils/index";
14
14
  export class PostMegadropdownTrigger {
15
+ validateFor() {
16
+ checkRequiredAndType(this, 'for', 'string');
17
+ }
15
18
  constructor() {
19
+ this.mutationObserver = new MutationObserver(this.cloneSlottedButton.bind(this));
20
+ this.isMegadropdownExpanded = false;
21
+ this.slottedContent = null;
16
22
  /**
17
- * Manages the accessibility attribute `aria-expanded` to indicate whether the associated mega dropdown is expanded or collapsed.
18
- */
19
- this.ariaExpanded = false;
20
- /**
21
- * Reference to the slotted button within the trigger, if present.
22
- * Used to manage click and key events for mega dropdown control.
23
- */
24
- this.slottedButton = null;
25
- /**
26
- * Tracks whether this trigger's dropdown was expanded before a state change.
27
- * Used to determine if this trigger should handle focus when its dropdown closes.
23
+ * Sets the trigger state to be active or inactive.
28
24
  */
29
- this.wasExpanded = false;
30
- this.handleKeyDown = (event) => {
31
- if (event.key === 'Enter' || event.key === ' ') {
32
- event.preventDefault();
33
- this.handleToggle();
34
- if (this.megadropdown && !this.ariaExpanded) {
35
- setTimeout(() => this.megadropdown.focusFirst(), 100);
36
- }
37
- }
38
- };
39
- this.handleToggleMegadropdown = (event) => {
40
- if (event.target.id === this.for) {
41
- this.ariaExpanded = event.detail.isVisible;
42
- // Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
43
- if (this.wasExpanded && !this.ariaExpanded && event.detail.focusParent) {
44
- setTimeout(() => {
45
- this.slottedButton?.focus();
46
- }, 100);
47
- }
48
- this.wasExpanded = this.ariaExpanded;
49
- if (this.slottedButton) {
50
- this.slottedButton.setAttribute('aria-expanded', this.ariaExpanded.toString());
51
- }
52
- }
53
- };
25
+ this.active = false;
26
+ this.onMegadropdownToggled = this.onMegadropdownToggled.bind(this);
54
27
  }
55
- /**
56
- * Watch for changes to the `for` property to validate its type and ensure it is a string.
57
- * @param forValue - The new value of the `for` property.
58
- */
59
- validateControlFor() {
60
- checkRequiredAndType(this, 'for', 'string');
28
+ connectedCallback() {
29
+ this.mutationObserver.observe(this.host, { childList: true, subtree: true });
30
+ }
31
+ componentWillLoad() {
32
+ this.cloneSlottedButton();
33
+ }
34
+ componentDidLoad() {
35
+ this.validateFor();
36
+ // Check if the mega dropdown attached to the trigger is expanded or not
37
+ if (IS_BROWSER)
38
+ document.addEventListener('postToggleMegadropdown', this.onMegadropdownToggled);
39
+ }
40
+ disconnectedCallback() {
41
+ document.removeEventListener('postToggleMegadropdown', this.onMegadropdownToggled);
42
+ }
43
+ cloneSlottedButton() {
44
+ this.slottedContent = this.host.innerHTML;
61
45
  }
62
46
  get megadropdown() {
63
47
  const ref = document.getElementById(this.for);
64
- return ref && ref.localName === 'post-megadropdown'
65
- ? ref
66
- : null;
67
- }
68
- handleToggle() {
69
- if (this.megadropdown) {
70
- this.megadropdown.toggle();
71
- }
72
- else {
48
+ if (ref?.localName !== 'post-megadropdown') {
73
49
  console.warn(`No post-megadropdown found with ID: ${this.for}`);
50
+ return null;
74
51
  }
52
+ return ref;
75
53
  }
76
- componentDidLoad() {
77
- this.validateControlFor();
78
- // Check if the mega dropdown attached to the trigger is expanded or not
79
- document.addEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
80
- this.slottedButton = this.host.querySelector('button');
81
- if (this.slottedButton) {
82
- this.slottedButton.setAttribute('aria-haspopup', 'menu');
83
- this.slottedButton.addEventListener('click', () => {
84
- this.handleToggle();
85
- });
86
- this.slottedButton.addEventListener('keydown', this.handleKeyDown);
87
- }
88
- else {
89
- console.warn('No button found within post-megadropdown-trigger');
90
- }
54
+ onClick() {
55
+ this.megadropdown?.toggle();
91
56
  }
92
- disconnectedCallback() {
93
- document.removeEventListener('postToggleMegadropdown', this.handleToggleMegadropdown);
57
+ onKeyDown(event) {
58
+ if (event.key !== 'Enter' && event.key !== ' ')
59
+ return;
60
+ const megadropdown = this.megadropdown;
61
+ if (!megadropdown)
62
+ return;
63
+ event.preventDefault();
64
+ this.megadropdown.toggle();
65
+ }
66
+ onMegadropdownToggled(event) {
67
+ if (event.target.id === this.for) {
68
+ const wasMegadropdownExpanded = this.isMegadropdownExpanded;
69
+ this.isMegadropdownExpanded = event.detail.isVisible;
70
+ const haveBeenClosed = wasMegadropdownExpanded && !this.isMegadropdownExpanded;
71
+ if (!haveBeenClosed || !event.detail.focusParent)
72
+ return;
73
+ // Focus on the trigger parent of the dropdown after it's closed if the close button had been clicked
74
+ setTimeout(() => {
75
+ this.interactiveButton.focus();
76
+ }, 100);
77
+ }
94
78
  }
95
79
  render() {
96
- return (h(Host, { key: '838bff4fe3feac679b522c2f7a166ac7aa5c2bf9', "data-version": version, "tab-index": "-1" }, h("button", { key: 'b5a90298610863e46447198642b5a27b8702aefc' }, h("slot", { key: '14c83456eb056f48143edcd2c532bca017c60171' }))));
80
+ return (h(Host, { key: '73479c3c80cda63b9f82ec584c962ffa53b7b85c', "data-version": version }, h("button", { key: 'e76d5077f1ac2e6c16e365799ea79f6985ec0d14', ref: el => (this.interactiveButton = el), type: "button", "aria-haspopup": "menu", "aria-expanded": this.isMegadropdownExpanded.toString(), onClick: this.onClick.bind(this), onKeyDown: this.onKeyDown.bind(this), class: { active: this.active } }, h("span", { key: 'a60b5838443ccd75fc08e07f791cb4ef088343f3' }, h("span", { key: 'da180bb66704712c0cba7b575ba260765a0df36f' }, h("slot", { key: 'c27dbc706a82fc49acb3414855e0e57d1dac0923' })), h("span", { key: '87ebe5fdcba5a160b2698965284fc5ce66d0fa90', "aria-hidden": "true", innerHTML: this.slottedContent })), h("post-icon", { key: '76f620188ebc3ad60b04523ea70ee4f3b642a2e8', name: "chevrondown" }))));
97
81
  }
98
82
  static get is() { return "post-megadropdown-trigger"; }
83
+ static get encapsulation() { return "shadow"; }
99
84
  static get originalStyleUrls() {
100
85
  return {
101
86
  "$": ["post-megadropdown-trigger.scss"]
@@ -108,6 +93,26 @@ export class PostMegadropdownTrigger {
108
93
  }
109
94
  static get properties() {
110
95
  return {
96
+ "active": {
97
+ "type": "boolean",
98
+ "attribute": "active",
99
+ "mutable": false,
100
+ "complexType": {
101
+ "original": "boolean",
102
+ "resolved": "boolean",
103
+ "references": {}
104
+ },
105
+ "required": false,
106
+ "optional": false,
107
+ "docs": {
108
+ "tags": [],
109
+ "text": "Sets the trigger state to be active or inactive."
110
+ },
111
+ "getter": false,
112
+ "setter": false,
113
+ "reflect": true,
114
+ "defaultValue": "false"
115
+ },
111
116
  "for": {
112
117
  "type": "string",
113
118
  "attribute": "for",
@@ -125,23 +130,24 @@ export class PostMegadropdownTrigger {
125
130
  },
126
131
  "getter": false,
127
132
  "setter": false,
128
- "reflect": false
133
+ "reflect": true
129
134
  }
130
135
  };
131
136
  }
132
137
  static get states() {
133
138
  return {
134
- "ariaExpanded": {}
139
+ "isMegadropdownExpanded": {},
140
+ "slottedContent": {}
135
141
  };
136
142
  }
137
143
  static get elementRef() { return "host"; }
138
144
  static get watchers() {
139
145
  return [{
140
146
  "propName": "for",
141
- "methodName": "validateControlFor"
147
+ "methodName": "validateFor"
142
148
  }];
143
149
  }
144
150
  }
145
151
  __decorate([
146
152
  EventFrom('post-megadropdown', { ignoreNestedComponents: false })
147
- ], PostMegadropdownTrigger.prototype, "handleToggleMegadropdown", void 0);
153
+ ], PostMegadropdownTrigger.prototype, "onMegadropdownToggled", null);
@@ -1 +1 @@
1
- :host{display:block}:where([part=menu]){display:flex;flex-direction:column;padding-block:.5rem}::slotted([slot=header]){margin-top:-0.5rem;padding:1rem;display:flex;align-items:center;gap:.5rem;border-block-end:1px solid #050400;font-weight:700}@media screen and (max-width: 1023.98px){::slotted([slot=header]){padding:.75rem 1rem}}@media screen and (max-width: 779.98px){::slotted([slot=header]){padding:.5rem 1rem}}
1
+ :host{display:block}:where([part=post-menu]){display:flex;flex-direction:column;padding-block:.5rem}::slotted([slot=header]){margin-top:-0.5rem;padding:1rem;display:flex;align-items:center;gap:.5rem;border-block-end:1px solid #050400;font-weight:700}@media screen and (max-width: 1023.98px){::slotted([slot=header]){padding:.75rem 1rem}}@media screen and (max-width: 779.98px){::slotted([slot=header]){padding:.5rem 1rem}}