@swisspost/design-system-components 10.4.0 → 10.6.0

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 (340) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/breakpoints-Kruvy8Dm.js +47 -0
  3. package/dist/cjs/{create-validator-decorator-BtgLWaMJ.js → create-validator-decorator-Cy5yN6u9.js} +1 -1
  4. package/dist/cjs/{event-from-CwMw19f8.js → event-from-CTcQxB9-.js} +19 -13
  5. package/dist/cjs/{index-CW10QvjR.js → index-B3PXzvDk.js} +1 -1
  6. package/dist/cjs/{breakpoints-B0Olgvgc.js → index-CggFmZ8n.js} +0 -42
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/{one-of-vJeW7S4_.js → one-of-CRFrfihj.js} +1 -1
  9. package/dist/cjs/{package-CL8OSAS4.js → package-pKyFPwiA.js} +1 -1
  10. package/dist/cjs/{pattern-Zmn3wpyp.js → pattern-D329DFcf.js} +1 -1
  11. package/dist/cjs/post-accordion_2.cjs.entry.js +7 -7
  12. package/dist/cjs/post-autocomplete.cjs.entry.js +70 -55
  13. package/dist/cjs/post-avatar.cjs.entry.js +7 -7
  14. package/dist/cjs/post-back-to-top.cjs.entry.js +25 -13
  15. package/dist/cjs/post-banner.cjs.entry.js +6 -13
  16. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +42 -12
  17. package/dist/cjs/post-breadcrumbs.cjs.entry.js +222 -71
  18. package/dist/cjs/post-closebutton_14.cjs.entry.js +431 -233
  19. package/dist/cjs/post-collapsible_2.cjs.entry.js +9 -9
  20. package/dist/cjs/post-components.cjs.js +2 -2
  21. package/dist/cjs/post-date-picker.cjs.entry.js +18 -16
  22. package/dist/cjs/post-footer.cjs.entry.js +8 -8
  23. package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
  24. package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
  25. package/dist/cjs/post-listbox.cjs.entry.js +6 -6
  26. package/dist/cjs/post-number-input.cjs.entry.js +7 -6
  27. package/dist/cjs/post-pagination.cjs.entry.js +6 -6
  28. package/dist/cjs/post-popover-trigger.cjs.entry.js +8 -8
  29. package/dist/cjs/post-popover.cjs.entry.js +11 -11
  30. package/dist/cjs/post-progressbar.cjs.entry.js +5 -5
  31. package/dist/cjs/post-rating.cjs.entry.js +7 -7
  32. package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +8 -8
  33. package/dist/cjs/post-side-navigation.cjs.entry.js +9 -9
  34. package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
  35. package/dist/cjs/post-stepper.cjs.entry.js +8 -8
  36. package/dist/cjs/post-tab-item.cjs.entry.js +7 -7
  37. package/dist/cjs/post-tab-panel.cjs.entry.js +7 -7
  38. package/dist/cjs/post-tabs.cjs.entry.js +9 -9
  39. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +8 -8
  40. package/dist/cjs/post-tooltip.cjs.entry.js +6 -6
  41. package/dist/cjs/{required-DRnPokVn.js → required-DhAEd0c7.js} +1 -1
  42. package/dist/cjs/{type-CNcU_-B2.js → type-2Ma9dvHs.js} +1 -1
  43. package/dist/cjs/{url-DgJ3lXQz.js → url-DePscsTj.js} +1 -1
  44. package/dist/collection/components/post-autocomplete/post-autocomplete.js +65 -50
  45. package/dist/collection/components/post-back-to-top/post-back-to-top.js +19 -7
  46. package/dist/collection/components/post-banner/post-banner.js +2 -17
  47. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
  48. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +59 -4
  49. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
  50. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +249 -71
  51. package/dist/collection/components/post-closebutton/post-closebutton.js +7 -8
  52. package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
  53. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +2 -2
  54. package/dist/collection/components/post-date-picker/native-mask-element.js +1 -1
  55. package/dist/collection/components/post-date-picker/post-date-picker.js +11 -9
  56. package/dist/collection/components/post-footer/post-footer.js +2 -2
  57. package/dist/collection/components/post-header/post-header.js +2 -2
  58. package/dist/collection/components/post-icon/post-icon.js +1 -1
  59. package/dist/collection/components/post-language-menu/post-language-menu.js +1 -1
  60. package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
  61. package/dist/collection/components/post-listbox/post-listbox.js +2 -2
  62. package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
  63. package/dist/collection/components/post-logo/post-logo.js +1 -1
  64. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
  65. package/dist/collection/components/post-megadropdown/post-megadropdown.js +3 -3
  66. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
  67. package/dist/collection/components/post-menu/post-menu.js +23 -8
  68. package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
  69. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
  70. package/dist/collection/components/post-number-input/post-number-input.js +2 -2
  71. package/dist/collection/components/post-popover/post-popover.css +1 -1
  72. package/dist/collection/components/post-popover/post-popover.js +4 -4
  73. package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +3 -3
  74. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +71 -43
  75. package/dist/collection/components/post-progressbar/post-progressbar.js +1 -1
  76. package/dist/collection/components/post-rating/post-rating.js +1 -1
  77. package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
  78. package/dist/collection/components/post-side-navigation/post-side-navigation.js +1 -1
  79. package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js +1 -1
  80. package/dist/collection/components/post-stepper/post-stepper.js +1 -1
  81. package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
  82. package/dist/collection/components/post-tab-item/post-tab-item.js +2 -2
  83. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  84. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  85. package/dist/collection/components/post-tabs/post-tabs.js +2 -2
  86. package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
  87. package/dist/collection/components/post-tooltip/post-tooltip.js +2 -2
  88. package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +2 -2
  89. package/dist/collection/utils/breakpoints.js +11 -9
  90. package/dist/collection/utils/closable-target.js +38 -0
  91. package/dist/collection/utils/event-from.js +18 -13
  92. package/dist/collection/utils/floating-ui.js +72 -0
  93. package/dist/collection/utils/index.js +1 -0
  94. package/dist/components/breakpoints.js +1 -1
  95. package/dist/components/event-from.js +1 -1
  96. package/dist/components/index2.js +1 -0
  97. package/dist/components/package.js +1 -1
  98. package/dist/components/post-autocomplete.js +1 -1
  99. package/dist/components/post-back-to-top.js +1 -1
  100. package/dist/components/post-banner.js +1 -1
  101. package/dist/components/post-breadcrumb-item.js +1 -1
  102. package/dist/components/post-breadcrumbs.js +1 -1
  103. package/dist/components/post-closebutton2.js +1 -1
  104. package/dist/components/post-collapsible-trigger2.js +1 -1
  105. package/dist/components/post-collapsible2.js +1 -1
  106. package/dist/components/post-date-picker.js +1 -1
  107. package/dist/components/post-footer.js +1 -1
  108. package/dist/components/post-header.js +1 -1
  109. package/dist/components/post-icon2.js +1 -1
  110. package/dist/components/post-linkarea.js +1 -1
  111. package/dist/components/post-listbox-option.js +1 -1
  112. package/dist/components/post-listbox.js +1 -1
  113. package/dist/components/post-logo.js +1 -1
  114. package/dist/components/post-mainnavigation.js +1 -1
  115. package/dist/components/post-megadropdown-trigger.js +1 -1
  116. package/dist/components/post-megadropdown.js +1 -1
  117. package/dist/components/post-menu-item2.js +1 -1
  118. package/dist/components/post-menu-trigger2.js +1 -1
  119. package/dist/components/post-menu2.js +1 -1
  120. package/dist/components/post-number-input.js +1 -1
  121. package/dist/components/post-popover-trigger.js +1 -1
  122. package/dist/components/post-popover.js +1 -1
  123. package/dist/components/post-popovercontainer2.js +1 -1
  124. package/dist/components/post-progressbar.js +1 -1
  125. package/dist/components/post-rating.js +1 -1
  126. package/dist/components/post-side-navigation-trigger.js +1 -1
  127. package/dist/components/post-side-navigation.js +1 -1
  128. package/dist/components/post-stepper-item.js +1 -1
  129. package/dist/components/post-stepper.js +1 -1
  130. package/dist/components/post-tab-item.js +1 -1
  131. package/dist/components/post-tab-panel.js +1 -1
  132. package/dist/components/post-tabs.js +1 -1
  133. package/dist/components/post-togglebutton2.js +1 -1
  134. package/dist/components/post-tooltip-trigger.js +1 -1
  135. package/dist/components/post-tooltip.js +1 -1
  136. package/dist/components/react/index.js +1 -1
  137. package/dist/components/react/{p-Bwko4UKh.js → p-3RU9XwVO.js} +1 -1
  138. package/dist/components/react/p-5LuCes5o.js +1 -0
  139. package/dist/components/react/p-B1TcktiB.js +1 -0
  140. package/dist/components/react/{p-4wtxqxXu.js → p-B2jsM_Ov.js} +1 -1
  141. package/dist/components/react/p-BEcxHjuM.js +1 -0
  142. package/dist/components/react/p-BN2dfUQ0.js +1 -0
  143. package/dist/components/react/p-BPUhha1U.js +1 -0
  144. package/dist/{post-components/p-C-lLRsYC.js → components/react/p-BdLRXQqY.js} +1 -1
  145. package/dist/components/react/{p-BSb74xQy.js → p-Bnb_TyDh.js} +1 -1
  146. package/dist/components/react/p-CVVXnYLU.js +1 -0
  147. package/dist/components/react/{p-9RCG8BWM.js → p-CcDLIogT.js} +1 -1
  148. package/dist/components/react/{p-CSmrQ__L.js → p-CdggfEzz.js} +1 -1
  149. package/dist/components/react/p-CnN4Jdtv.js +1 -0
  150. package/dist/components/react/{p-D-imniYA.js → p-CzsG0uCA.js} +1 -1
  151. package/dist/components/react/p-DeO0rZ1T.js +1 -0
  152. package/dist/components/react/p-DffT6evQ.js +1 -0
  153. package/dist/components/react/p-T8T3po4z.js +1 -0
  154. package/dist/components/react/p-WXzzOdnl.js +1 -0
  155. package/dist/components/react/p-bR8vy6-s.js +1 -0
  156. package/dist/components/react/{p-B1kYo1K9.js → p-m1-sOx5T.js} +1 -1
  157. package/dist/components/react/post-accordion-item.js +1 -1
  158. package/dist/components/react/post-accordion.js +1 -1
  159. package/dist/components/react/post-autocomplete.js +1 -1
  160. package/dist/components/react/post-avatar.js +1 -1
  161. package/dist/components/react/post-back-to-top.js +1 -1
  162. package/dist/components/react/post-banner.js +1 -1
  163. package/dist/components/react/post-breadcrumb-item.js +1 -1
  164. package/dist/components/react/post-breadcrumbs.js +1 -1
  165. package/dist/components/react/post-closebutton.js +1 -1
  166. package/dist/components/react/post-collapsible-trigger.js +1 -1
  167. package/dist/components/react/post-collapsible.js +1 -1
  168. package/dist/components/react/post-date-picker.js +1 -1
  169. package/dist/components/react/post-footer.js +1 -1
  170. package/dist/components/react/post-header.js +1 -1
  171. package/dist/components/react/post-icon.js +1 -1
  172. package/dist/components/react/post-language-menu-item.js +1 -1
  173. package/dist/components/react/post-language-menu.js +1 -1
  174. package/dist/components/react/post-linkarea.js +1 -1
  175. package/dist/components/react/post-listbox-option.js +1 -1
  176. package/dist/components/react/post-listbox.js +1 -1
  177. package/dist/components/react/post-logo.js +1 -1
  178. package/dist/components/react/post-mainnavigation.js +1 -1
  179. package/dist/components/react/post-megadropdown-trigger.js +1 -1
  180. package/dist/components/react/post-megadropdown.js +1 -1
  181. package/dist/components/react/post-menu-item.js +1 -1
  182. package/dist/components/react/post-menu-trigger.js +1 -1
  183. package/dist/components/react/post-menu.js +1 -1
  184. package/dist/components/react/post-number-input.js +1 -1
  185. package/dist/components/react/post-pagination.js +1 -1
  186. package/dist/components/react/post-popover-trigger.js +1 -1
  187. package/dist/components/react/post-popover.js +1 -1
  188. package/dist/components/react/post-popovercontainer.js +1 -1
  189. package/dist/components/react/post-progressbar.js +1 -1
  190. package/dist/components/react/post-rating.js +1 -1
  191. package/dist/components/react/post-side-navigation-trigger.js +1 -1
  192. package/dist/components/react/post-side-navigation.js +1 -1
  193. package/dist/components/react/post-stepper-item.js +1 -1
  194. package/dist/components/react/post-stepper.js +1 -1
  195. package/dist/components/react/post-tab-item.js +1 -1
  196. package/dist/components/react/post-tab-panel.js +1 -1
  197. package/dist/components/react/post-tabs.js +1 -1
  198. package/dist/components/react/post-togglebutton.js +1 -1
  199. package/dist/components/react/post-tooltip-trigger.js +1 -1
  200. package/dist/components/react/post-tooltip.js +1 -1
  201. package/dist/docs.json +118 -27
  202. package/dist/esm/breakpoints-I1j7a0bW.js +45 -0
  203. package/dist/esm/{create-validator-decorator-CNUaQboh.js → create-validator-decorator-C2XlYkNB.js} +1 -1
  204. package/dist/esm/{event-from-rEfV4v4a.js → event-from-BEcxHjuM.js} +19 -14
  205. package/dist/esm/{index-sn7oKSwC.js → index-BjziJWh2.js} +1 -1
  206. package/dist/esm/{breakpoints-BQ3HlJPr.js → index-bR8vy6-s.js} +1 -42
  207. package/dist/esm/loader.js +3 -3
  208. package/dist/esm/{one-of-C6Ironyj.js → one-of-Do1iao-k.js} +1 -1
  209. package/dist/esm/{package-tTf1w3A9.js → package-T8T3po4z.js} +1 -1
  210. package/dist/esm/{pattern-57oD--q3.js → pattern-BZDucOTq.js} +1 -1
  211. package/dist/esm/post-accordion_2.entry.js +7 -7
  212. package/dist/esm/post-autocomplete.entry.js +70 -55
  213. package/dist/esm/post-avatar.entry.js +7 -7
  214. package/dist/esm/post-back-to-top.entry.js +25 -13
  215. package/dist/esm/post-banner.entry.js +6 -13
  216. package/dist/esm/post-breadcrumb-item.entry.js +42 -12
  217. package/dist/esm/post-breadcrumbs.entry.js +222 -71
  218. package/dist/esm/post-closebutton_14.entry.js +430 -232
  219. package/dist/esm/post-collapsible_2.entry.js +9 -9
  220. package/dist/esm/post-components.js +3 -3
  221. package/dist/esm/post-date-picker.entry.js +18 -16
  222. package/dist/esm/post-footer.entry.js +8 -8
  223. package/dist/esm/post-linkarea.entry.js +3 -3
  224. package/dist/esm/post-listbox-option.entry.js +4 -4
  225. package/dist/esm/post-listbox.entry.js +6 -6
  226. package/dist/esm/post-number-input.entry.js +6 -5
  227. package/dist/esm/post-pagination.entry.js +6 -6
  228. package/dist/esm/post-popover-trigger.entry.js +8 -8
  229. package/dist/esm/post-popover.entry.js +11 -11
  230. package/dist/esm/post-progressbar.entry.js +5 -5
  231. package/dist/esm/post-rating.entry.js +7 -7
  232. package/dist/esm/post-side-navigation-trigger.entry.js +8 -8
  233. package/dist/esm/post-side-navigation.entry.js +9 -9
  234. package/dist/esm/post-stepper-item.entry.js +3 -3
  235. package/dist/esm/post-stepper.entry.js +8 -8
  236. package/dist/esm/post-tab-item.entry.js +7 -7
  237. package/dist/esm/post-tab-panel.entry.js +7 -7
  238. package/dist/esm/post-tabs.entry.js +9 -9
  239. package/dist/esm/post-tooltip-trigger.entry.js +8 -8
  240. package/dist/esm/post-tooltip.entry.js +6 -6
  241. package/dist/esm/{required-D2rl2XZJ.js → required-B0X7uy13.js} +1 -1
  242. package/dist/esm/{type-CGynDrfh.js → type-CF1dOg6D.js} +1 -1
  243. package/dist/esm/{url-1wyUfUv-.js → url-BL7d6iWZ.js} +1 -1
  244. package/dist/post-components/{p-167191e5.entry.js → p-0e922531.entry.js} +1 -1
  245. package/dist/post-components/{p-cf6eacab.entry.js → p-1ec27142.entry.js} +1 -1
  246. package/dist/post-components/{p-da217dbc.entry.js → p-2005eb98.entry.js} +1 -1
  247. package/dist/post-components/p-2cff5b3a.entry.js +1 -0
  248. package/dist/post-components/p-53bd2128.entry.js +1 -0
  249. package/dist/post-components/{p-212c71e4.entry.js → p-59b30e90.entry.js} +1 -1
  250. package/dist/post-components/{p-beed9922.entry.js → p-60550edb.entry.js} +1 -1
  251. package/dist/post-components/p-655ded00.entry.js +1 -0
  252. package/dist/post-components/p-76cc3c9a.entry.js +1 -0
  253. package/dist/post-components/{p-3149d866.entry.js → p-8012cc3b.entry.js} +1 -1
  254. package/dist/post-components/p-819c93de.entry.js +1 -0
  255. package/dist/post-components/p-840acd3c.entry.js +1 -0
  256. package/dist/post-components/p-87b1034f.entry.js +1 -0
  257. package/dist/post-components/p-88f754e9.entry.js +1 -0
  258. package/dist/post-components/p-9S_5_Zh8.js +1 -0
  259. package/dist/post-components/p-BEcxHjuM.js +1 -0
  260. package/dist/post-components/p-BYfu3J2D.js +1 -0
  261. package/dist/post-components/p-BjziJWh2.js +2 -0
  262. package/dist/post-components/p-BoYe-VVx.js +1 -0
  263. package/dist/post-components/p-CbbADNiv.js +1 -0
  264. package/dist/post-components/p-DgnQe03V.js +1 -0
  265. package/dist/post-components/p-DlKbBdcP.js +1 -0
  266. package/dist/post-components/p-I1j7a0bW.js +1 -0
  267. package/dist/post-components/p-T8T3po4z.js +1 -0
  268. package/dist/post-components/{p-a01ea634.entry.js → p-a32d3050.entry.js} +1 -1
  269. package/dist/post-components/p-b4229624.entry.js +1 -0
  270. package/dist/post-components/{p-96bf6b01.entry.js → p-b9faa76b.entry.js} +1 -1
  271. package/dist/post-components/p-bR8vy6-s.js +1 -0
  272. package/dist/post-components/{p-70fbe469.entry.js → p-ba1b4ba0.entry.js} +1 -1
  273. package/dist/post-components/p-c0ae13b7.entry.js +1 -0
  274. package/dist/post-components/p-c9dcdebb.entry.js +1 -0
  275. package/dist/post-components/p-ccf8020b.entry.js +1 -0
  276. package/dist/post-components/p-cd68d3a2.entry.js +1 -0
  277. package/dist/post-components/p-cdc7b8d3.entry.js +1 -0
  278. package/dist/post-components/{p-1cf5bc67.entry.js → p-d7c9a969.entry.js} +1 -1
  279. package/dist/post-components/p-db11f781.entry.js +1 -0
  280. package/dist/post-components/{p-0323b0f3.entry.js → p-dc285087.entry.js} +1 -1
  281. package/dist/post-components/{p-e8d9723e.entry.js → p-de6f1816.entry.js} +1 -1
  282. package/dist/post-components/p-dec8bd99.entry.js +1 -0
  283. package/dist/post-components/p-f9a8ee94.entry.js +1 -0
  284. package/dist/post-components/post-components.css +2 -2
  285. package/dist/post-components/post-components.esm.js +1 -1
  286. package/dist/types/components/post-autocomplete/post-autocomplete.d.ts +18 -6
  287. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -1
  288. package/dist/types/components/post-banner/post-banner.d.ts +0 -1
  289. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +12 -1
  290. package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +54 -14
  291. package/dist/types/components/post-closebutton/post-closebutton.d.ts +1 -1
  292. package/dist/types/components/post-menu/post-menu.d.ts +1 -0
  293. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +8 -5
  294. package/dist/types/components.d.ts +38 -7
  295. package/dist/types/utils/breakpoints.d.ts +1 -0
  296. package/dist/types/utils/closable-target.d.ts +5 -0
  297. package/dist/types/utils/event-from.d.ts +8 -0
  298. package/dist/types/utils/floating-ui.d.ts +12 -0
  299. package/dist/types/utils/index.d.ts +1 -0
  300. package/hydrate/index.js +1085 -665
  301. package/hydrate/index.mjs +1085 -665
  302. package/package.json +31 -22
  303. package/dist/components/react/p-BXqGI600.js +0 -1
  304. package/dist/components/react/p-B_WnO-QF.js +0 -1
  305. package/dist/components/react/p-BaB8wJvk.js +0 -1
  306. package/dist/components/react/p-Bji_4dfL.js +0 -1
  307. package/dist/components/react/p-CX2E_IXB.js +0 -1
  308. package/dist/components/react/p-CwmQwirr.js +0 -1
  309. package/dist/components/react/p-D17tCsFk.js +0 -1
  310. package/dist/components/react/p-DD1c_IgL.js +0 -1
  311. package/dist/components/react/p-Df31eVdi.js +0 -1
  312. package/dist/components/react/p-I0dqoE80.js +0 -1
  313. package/dist/components/react/p-rEfV4v4a.js +0 -1
  314. package/dist/components/react/p-tTf1w3A9.js +0 -1
  315. package/dist/post-components/p-06ddd73b.entry.js +0 -1
  316. package/dist/post-components/p-090e52db.entry.js +0 -1
  317. package/dist/post-components/p-292a9784.entry.js +0 -1
  318. package/dist/post-components/p-2de6fe62.entry.js +0 -1
  319. package/dist/post-components/p-39ff8127.entry.js +0 -1
  320. package/dist/post-components/p-3a968b19.entry.js +0 -1
  321. package/dist/post-components/p-472_tiaS.js +0 -1
  322. package/dist/post-components/p-58422de1.entry.js +0 -1
  323. package/dist/post-components/p-5873a90c.entry.js +0 -1
  324. package/dist/post-components/p-986fa1c1.entry.js +0 -1
  325. package/dist/post-components/p-BQ3HlJPr.js +0 -1
  326. package/dist/post-components/p-B_FOhVrp.js +0 -1
  327. package/dist/post-components/p-CeNqFJV7.js +0 -1
  328. package/dist/post-components/p-DYDdaLz-.js +0 -1
  329. package/dist/post-components/p-DoNhJ2D7.js +0 -1
  330. package/dist/post-components/p-b1d2384a.entry.js +0 -1
  331. package/dist/post-components/p-b535fc10.entry.js +0 -1
  332. package/dist/post-components/p-b99e6621.entry.js +0 -1
  333. package/dist/post-components/p-bf83a3fb.entry.js +0 -1
  334. package/dist/post-components/p-c46bc56f.entry.js +0 -1
  335. package/dist/post-components/p-ce8132a9.entry.js +0 -1
  336. package/dist/post-components/p-d72e830b.entry.js +0 -1
  337. package/dist/post-components/p-e08d26f4.entry.js +0 -1
  338. package/dist/post-components/p-rEfV4v4a.js +0 -1
  339. package/dist/post-components/p-sn7oKSwC.js +0 -2
  340. package/dist/post-components/p-tTf1w3A9.js +0 -1
@@ -1,20 +1,59 @@
1
- import { r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-sn7oKSwC.js';
2
- import { t as throttle, b as breakpoint } from './breakpoints-BQ3HlJPr.js';
3
- import { v as version } from './package-tTf1w3A9.js';
4
- import { O as OneOf } from './one-of-C6Ironyj.js';
5
- import { R as Required } from './required-D2rl2XZJ.js';
1
+ import { r as registerInstance, h, H as Host, a as getElement, c as createEvent } from './index-BjziJWh2.js';
2
+ import { b as breakpoint } from './breakpoints-I1j7a0bW.js';
3
+ import { f as findClosestAcrossShadow, E as EventFrom } from './event-from-BEcxHjuM.js';
4
+ import { v as version } from './package-T8T3po4z.js';
5
+ import { O as OneOf } from './one-of-Do1iao-k.js';
6
+ import { R as Required } from './required-B0X7uy13.js';
6
7
  import { f as fade } from './fade-DsgPYmAa.js';
7
- import { E as EventFrom } from './event-from-rEfV4v4a.js';
8
8
  import { g as getDeepFocusableChildren, a as getFocusableChildren } from './get-focusable-children-DxYnH2ye.js';
9
- import { T as Type } from './type-CGynDrfh.js';
9
+ import { t as throttle } from './index-bR8vy6-s.js';
10
+ import { T as Type } from './type-CF1dOg6D.js';
10
11
  import { n as nanoid } from './nanoid-8LXe8Zt_.js';
11
- import { P as Pattern } from './pattern-57oD--q3.js';
12
- import { U as Url } from './url-1wyUfUv-.js';
12
+ import { P as Pattern } from './pattern-BZDucOTq.js';
13
+ import { U as Url } from './url-BL7d6iWZ.js';
13
14
  import { r as resolveEasing } from './utils-CoDiS_Ik.js';
14
15
  import { f as fadeSlide } from './fade-slide-CvOvauo9.js';
15
16
  import { P as PLACEMENT_TYPES } from './placement-DRiVosES.js';
16
17
  import { g as getRoot } from './get-root-08F-DB-d.js';
17
- import './create-validator-decorator-CNUaQboh.js';
18
+ import './create-validator-decorator-C2XlYkNB.js';
19
+
20
+ const CLOSABLE_TARGETS = [
21
+ {
22
+ predicate: el => el.localName === 'post-banner',
23
+ close: el => void el.dismiss(),
24
+ },
25
+ {
26
+ predicate: el => el.localName === 'post-popover',
27
+ close: el => void el.hide(),
28
+ },
29
+ {
30
+ predicate: el => el.localName === 'post-popovercontainer',
31
+ close: el => void el.hide(),
32
+ },
33
+ {
34
+ predicate: el => el.localName === 'post-collapsible',
35
+ close: el => void el.toggle(false),
36
+ },
37
+ {
38
+ predicate: el => el.localName === 'post-accordion-item',
39
+ close: el => void el.toggle(false),
40
+ },
41
+ {
42
+ predicate: el => el.localName === 'dialog',
43
+ close: el => el.close(),
44
+ },
45
+ {
46
+ predicate: el => el.hasAttribute('popover'),
47
+ close: el => el.togglePopover(false),
48
+ },
49
+ ];
50
+ function findClosableTarget(start) {
51
+ const el = findClosestAcrossShadow(start, (el) => CLOSABLE_TARGETS.some(t => t.predicate(el)));
52
+ if (!el)
53
+ return null;
54
+ const match = CLOSABLE_TARGETS.find(t => t.predicate(el));
55
+ return { element: el, close: () => match.close(el) };
56
+ }
18
57
 
19
58
  const BUTTON_TYPES = ['button', 'reset'];
20
59
  const PLACEMENT = ['manual', 'auto'];
@@ -44,7 +83,7 @@ const PostClosebutton = class {
44
83
  }
45
84
  /**
46
85
  * The "type" attribute used for the close button
47
-
86
+
48
87
  */
49
88
  this.buttonType = 'button';
50
89
  /**
@@ -55,6 +94,10 @@ const PostClosebutton = class {
55
94
  * The size of the close button.
56
95
  */
57
96
  this.size = 'default';
97
+ this.handleClick = () => {
98
+ const target = findClosableTarget(this.host);
99
+ target?.close();
100
+ };
58
101
  }
59
102
  componentDidLoad() {
60
103
  if (globalThis.MutationObserver) {
@@ -79,13 +122,8 @@ const PostClosebutton = class {
79
122
  console.error(`The \`${this.host.localName}\` component requires content for accessibility.`);
80
123
  }
81
124
  }
82
- handleClick() {
83
- if (this.buttonType === 'reset')
84
- this.internals.form?.reset();
85
- this.host.closest('dialog')?.close();
86
- }
87
125
  render() {
88
- return (h(Host, { key: '22ac2b07e9a8a8f8d157423fea1bcedb2c4f9b11', "data-version": version }, h("button", { key: '91eb413a2546f131e4c97c28340374addbf2c7a7', type: this.buttonType, class: "btn btn-icon btn-secondary btn-sm", onClick: () => this.handleClick() }, h("post-icon", { key: '02202b3df2e5830aeb267921c924c1e75508d546', "aria-hidden": "true", name: "closex" }), h("span", { key: 'c691c845dd58b4f975c33791d29518428ade6ee8', ref: el => (this.visuallyHidden = el), class: "visually-hidden" }, h("slot", { key: '3fd42b82ef1d1ea76343e0c69f421a2916c26006' })))));
126
+ return (h(Host, { key: 'b8e2214b904f5167fa3753aab947418891236fcf', "data-version": version }, h("button", { key: '224ca42d3be187062ba9717e4a534ff34eeafaf7', type: this.buttonType, class: "btn btn-icon btn-secondary btn-sm", onClick: this.handleClick }, h("post-icon", { key: '5b289691599d6f9a3bb0fa7a28c71eecd1f5aee7', "aria-hidden": "true", name: "closex" }), h("span", { key: 'e22045f15b3dc8b8b228eb4282114e10db68b186', ref: el => (this.visuallyHidden = el), class: "visually-hidden" }, h("slot", { key: 'e492390c995a993ffc8988a1c90a41e59fbe39f5' })))));
89
127
  }
90
128
  static get formAssociated() { return true; }
91
129
  get host() { return getElement(this); }
@@ -432,10 +470,10 @@ const PostHeader = class {
432
470
  render() {
433
471
  const onDesktop = this.device === 'desktop';
434
472
  const onTabletAndMobile = this.device !== 'desktop';
435
- return (h(Host, { key: 'cdd9dc28893d6b4707e70cc4c8fd0940903e9062', "data-version": version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, h("header", { key: '528563b69ff8f0452775b386a98de59e934c802d' }, h("div", { key: '1f0ab8f7288a63bdd8070bebc5651ffdc9ebfd42', class: "global-header" }, h("div", { key: 'd25d70eddb6d4edeb3be26b313b57980761979bf', class: "section" }, h("div", { key: 'fe284d8015bff65be10e2231147523640c4910d4', class: "logo" }, h("slot", { key: '0c6854d79f4e9695e99961481337b327af8c142c', name: "post-logo" })), h("div", { key: '6d0b33a967dc32760f3d3cf74fc794a1cb622327', class: "sliding-controls" }, onDesktop && (h("div", { key: '6ae13d6b39c19d3953fc719b0fca5cfbfa1c57b7', class: "audience" }, h("slot", { key: '49d3954b3c54d898ad473a0bf7d2566f2764638c', name: "audience" }))), h("slot", { key: 'c19c56d0b5c56c278b33c16ded66473fb44bfa3d', name: "global-nav-primary" }), (onDesktop || !this.hasMainNav) && [
473
+ return (h(Host, { key: 'd288ef2e58942c2cbc5da673076548c97eef04ed', "data-version": version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, h("header", { key: '5357f3edf382dec9b552fdfe9fb51d0878de697c' }, h("div", { key: 'bafa11390b33056e5a3d1a8a2922fd3a43a25020', class: "global-header" }, h("div", { key: '2d54e8d2931864880ff7a28aea64625e775ce327', class: "section" }, h("div", { key: 'b3a87bbf3b87213e22043d58a7298d0cff530cdf', class: "logo" }, h("slot", { key: '9d559b9231dc23841e277d3f4633cdeba2da12b2', name: "post-logo" })), h("div", { key: '64ebd463868ce8b417023651e745e33331feb908', class: "sliding-controls" }, onDesktop && (h("div", { key: 'b4e7d7231a0d8bebe620d41cb655c3686449b19f', class: "audience" }, h("slot", { key: '0781a76b1853a842dc74ec2a2a649f7de487e148', name: "audience" }))), h("slot", { key: '25f1d5b34a5aa950014214f810f3acca95dbbe80', name: "global-nav-primary" }), (onDesktop || !this.hasMainNav) && [
436
474
  h("slot", { key: "global-nav-secondary", name: "global-nav-secondary" }),
437
475
  h("slot", { key: "language-menu", name: "language-menu" }),
438
- ], h("slot", { key: 'a7c75b4628234c282ea9556b7965a4e469783913', name: "post-login" }), onTabletAndMobile && this.hasMainNav && (h("post-togglebutton", { key: 'e120687caa66facfb9721b6b6a8bc8691966a429', class: "burger-button", ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, h("span", { key: '43fd450ae79386d2c9bf29eb546cc66c399564e4' }, this.textMenu), h("post-icon", { key: '863c5284f9f8b38e8e72390ead96eb7cccda9dd5', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), h("post-icon", { key: 'f4ed6301b1836c51b0dbf9ee51040bb62dd06beb', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), h("div", { key: 'e5c314eae3e25b9bfb23fcbe95684ea7bc99be41', ref: el => (this.localHeader = el), class: { 'local-header': true, 'megadropdown-open': this.megadropdownOpen } }, h("div", { key: '60dd8029f12ec03493b5ce81bc3e3b8338cd80e6', class: "section" }, h("slot", { key: '8bbaa11f39bdf2ceb513fe698913c0350ca78776', name: "side-nav" }), h("slot", { key: '0c1d5da1e42a1d96005c66de9c675c91dc2c8518', name: "title" }), this.hasTitle && h("slot", { key: '8a2bb6822ba8033545e76b8f9a96f9bc7f498c9c', name: "local-nav" }), onDesktop && h("slot", { key: '9c8df8ae91ad85ab58f9ee0bfef6a661fee59814', name: "main-nav" }), onDesktop && !this.hasTitle && h("slot", { key: '85197bf72379b567c782bb54dbf77e6c17060895', name: "local-nav" }))), this.hasBurgerMenu && this.renderBurgerMenu())));
476
+ ], h("slot", { key: 'd7121e5e9ddf825f96a3a82e65ff135c61891adb', name: "post-login" }), onTabletAndMobile && this.hasMainNav && (h("post-togglebutton", { key: 'dd0bcf9cfd96d4ffa44fc549d518d7b39d287156', class: "burger-button", ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, h("span", { key: '23004cb12733a7081f828d33327cc26adafe3888' }, this.textMenu), h("post-icon", { key: '7fb36892eadfcce0a85d964c411aeafc3fbbde1b', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), h("post-icon", { key: 'a41292205573c03f25d225d4f4296f75ffe6c7ce', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), h("div", { key: '7d6d1424881bb5277210c86b194dfb9e5dcb7c59', ref: el => (this.localHeader = el), class: { 'local-header': true, 'megadropdown-open': this.megadropdownOpen } }, h("div", { key: '724a8d3f79112875ba343470f9d0b753ce5d4861', class: "section" }, h("slot", { key: '688aafdec4e4d5565f3d0a9d9bd9bb7bc78152be', name: "side-nav" }), h("slot", { key: '12590bfb4bfcc8c565f008a8e3d75b5951eb73bc', name: "title" }), this.hasTitle && h("slot", { key: 'd862de0f3aaba5ea22a26c387ea7e93dc0c5e79c', name: "local-nav" }), onDesktop && h("slot", { key: '1a25ec6694bc8b2c06e21449dc566f36595afbb5', name: "main-nav" }), onDesktop && !this.hasTitle && h("slot", { key: '987c26ee73fb19049fdd19de79b537b71e2771de', name: "local-nav" }))), this.hasBurgerMenu && this.renderBurgerMenu())));
439
477
  }
440
478
  get host() { return getElement(this); }
441
479
  static get watchers() { return {
@@ -565,7 +603,7 @@ const PostIcon = class {
565
603
  }).filter(([_key, value]) => value !== null));
566
604
  }
567
605
  render() {
568
- return (h(Host, { key: 'ce81db69bf77d09a0a331bac48cdaede7ff3cb8e', "data-version": version }, h("span", { key: '211f999da845687289fd991421f4315a090a67ba', style: this.getStyles() })));
606
+ return (h(Host, { key: '405ccfde4206c14f044575d0b23998d93a03ffb6', "data-version": version }, h("span", { key: 'ad70ccf63add4b881ef6096ae460e13fba09f508', style: this.getStyles() })));
569
607
  }
570
608
  get host() { return getElement(this); }
571
609
  };
@@ -630,7 +668,7 @@ const PostLanguageMenu = class {
630
668
  }
631
669
  componentDidLoad() {
632
670
  // Initially set variants and active language
633
- // Handles cases where the language-menu is rendered after the language-options have been rendered
671
+ // Handles cases where the language-menu is rendered after the language-menu-items have been rendered
634
672
  this.updateChildrenVariant();
635
673
  }
636
674
  /**
@@ -798,7 +836,7 @@ const PostLogo = class {
798
836
  render() {
799
837
  const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
800
838
  const LogoTag = logoLink ? 'a' : 'span';
801
- return (h(Host, { key: 'b9d1a0fcdbbb7789863bd89d0cb1154f432d7749', "data-version": version }, h(LogoTag, { key: 'e9e5f76950b4e95a9dc8d8f961c75f635007b61f', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, h("span", { key: '7f9647d7fc00d1e79e544cbdd11fce5313b2bc83', class: "description" }, h("slot", { key: '8eb8bb0385b14a98aadf1cd956d74972179bee6b', onSlotchange: () => this.checkDescription() })), h("svg", { key: '1bc78071d7ee521a249452af9f8b34108297205c', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: '9d10890ce19c40c38a976dbbbcb9e3939611f765', id: "Logo" }, h("rect", { key: 'c0f9312024721329e2427a623c78658d094d039c', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '36f41cc32b0a1d92ba4c1b8cb56e9c6f2b454a4f', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: 'e32537010333ac42f7614203062b424c4feb819f', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
839
+ return (h(Host, { key: '1f69b0ddc0ecf2fde47423cd7824fcbe76e4a529', "data-version": version }, h(LogoTag, { key: '096736bd50a6dd43e02a104e7e81897cb286db60', class: `logo ${logoLink ? 'logo-link' : ''}`, ...(logoLink ? { href: logoLink } : {}) }, h("span", { key: 'bc49b9591424f02744f771eb1079911f02ceca33', class: "description" }, h("slot", { key: 'ea905eac805e2a9940bfe50aa222bef738d15d27', onSlotchange: () => this.checkDescription() })), h("svg", { key: '482d94c38347017269dabd0ab3d15f4ede14f187', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'fcd3dc56e8a0e448abe65b557639a8bea8ca580f', id: "Logo" }, h("rect", { key: '11ed7bad596ee07301f1c1101ddded089ef2bf99', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '6ab9d28c8492c746a2620cff62dbd92a59a00aff', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: '8b96cee7ee8ad1ec3c22aaf7928f7a711c05c828', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
802
840
  }
803
841
  get host() { return getElement(this); }
804
842
  };
@@ -938,7 +976,7 @@ const PostMainnavigation = class {
938
976
  }, NAVBAR_DISABLE_DURATION);
939
977
  }
940
978
  render() {
941
- return (h(Host, { key: '374379b09ad5578002153a0a80afaf9308f1c964', version: version, class: this.canScroll ? 'scrollable' : '' }, h("div", { key: 'b78537cec32cd23c7908482d73b7624e4662b1c8', "aria-hidden": "true", class: { 'scroll-control scroll-left': true, 'd-none': !this.canScrollLeft }, onMouseDown: e => this.handleScrollButtonClick(e, 'left') }, h("post-icon", { key: 'd196c0f3b480f5ede486945c684afe4a06a96af0', "aria-hidden": "true", name: "chevronleft" })), h("nav", { key: '5ee27a1b6cfc8aa59820514708485b334837c09d', ref: el => (this.navbar = el), "aria-label": this.textMain }, h("slot", { key: 'e0a1719713e59899ec4fd1ff057ab5e3c13f7069' })), h("div", { key: 'd1e2b456cadec20bb9c857fee23a3955ab20a2b2', "aria-hidden": "true", class: { 'scroll-control scroll-right': true, 'd-none': !this.canScrollRight }, onMouseDown: e => this.handleScrollButtonClick(e, 'right') }, h("post-icon", { key: 'dec56cf1fb67c5afb597936d0f99e6389517819f', "aria-hidden": "true", name: "chevronright" }))));
979
+ return (h(Host, { key: 'cf7b2328a41b41ca28956120b8042590655e7bb2', version: version, class: this.canScroll ? 'scrollable' : '' }, h("div", { key: 'a25c55cf7b11a11ce86fb134dd57dbdad3d30301', "aria-hidden": "true", class: { 'scroll-control scroll-left': true, 'd-none': !this.canScrollLeft }, onMouseDown: e => this.handleScrollButtonClick(e, 'left') }, h("post-icon", { key: '013778591637d5ee0ac2cd2bf3f23c677ba2a13f', "aria-hidden": "true", name: "chevronleft" })), h("nav", { key: 'a007b7be57429580de35865e5eff0c54378d0a8e', ref: el => (this.navbar = el), "aria-label": this.textMain }, h("slot", { key: 'bc8e1db18430ee43b5963539fbaa65e1fb1b0c55' })), h("div", { key: 'cdb413fedc9a90c712db0fe5d6ab760a426ff632', "aria-hidden": "true", class: { 'scroll-control scroll-right': true, 'd-none': !this.canScrollRight }, onMouseDown: e => this.handleScrollButtonClick(e, 'right') }, h("post-icon", { key: 'b2df569a79881b3a044556ba9c0f2e2b0646e78b', "aria-hidden": "true", name: "chevronright" }))));
942
980
  }
943
981
  get host() { return getElement(this); }
944
982
  };
@@ -961,6 +999,8 @@ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators,
961
999
  return c > 3 && r && Object.defineProperty(target, key, r), r;
962
1000
  };
963
1001
  const PostMegadropdown = class {
1002
+ /** Tracks the currently active dropdown instance. */
1003
+ static { this.activeDropdown = null; }
964
1004
  get megadropdownTrigger() {
965
1005
  const hostId = this.host.getAttribute('id');
966
1006
  return hostId ? document.querySelector(`post-megadropdown-trigger[for="${hostId}"]`) : null;
@@ -1242,12 +1282,10 @@ const PostMegadropdown = class {
1242
1282
  }
1243
1283
  render() {
1244
1284
  const containerStyle = this.isVisible ? {} : { display: 'none' };
1245
- return (h(Host, { key: 'd181a65a25eafbbc645c717ee2f447caf1ab040a', version: version }, h("div", { key: '7bd6003c2e696e64a14b98a94e6c67d66d143192', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, h("div", { key: 'c79d10e279a37d94c2849ce4cac7bf4d260a0ca3', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: '7e7769acb5391cb33958b1bd9739583e25def2cc', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: 'fe7b63bd6b9daff336e599cd9ca43338a36fa595', class: "megadropdown-content" }, h("slot", { key: 'cc19bcec12adee943391ec818bcfa8cd8290cb49' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button", size: "small", placement: "manual" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack))))));
1285
+ return (h(Host, { key: 'c0854fff62bf5e8de1597e46051aea5f300ee686', version: version }, h("div", { key: '1f4f66b74d7129481d76f1eec15a924b2c37718c', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, h("div", { key: 'af743442fe3ad6211cddccddf5d0803de9f501b5', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: '35a03b2ee32498aa157140d4e6916cbf66655e5c', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: '6c4efb52e7bb04c4f40d5b3f739ca69771c48602', class: "megadropdown-content" }, h("slot", { key: '2b3200495cf23fe049734de9de9a5a1f4c9b09f3' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button", size: "small", placement: "manual" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack))))));
1246
1286
  }
1247
1287
  get host() { return getElement(this); }
1248
1288
  };
1249
- /** Tracks the currently active dropdown instance. */
1250
- PostMegadropdown.activeDropdown = null;
1251
1289
  __decorate$4([
1252
1290
  Required(),
1253
1291
  Type('string')
@@ -1329,7 +1367,7 @@ const PostMegadropdownTrigger = class {
1329
1367
  this.megadropdown.toggle();
1330
1368
  }
1331
1369
  render() {
1332
- return (h(Host, { key: '7dea071ab1a606e7427631e45a1521aef0be85fe', "data-version": version }, h("button", { key: '4486549cfbad6f00de4a44c7af550dac428b9450', 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: '566388f5cc5fd7eb4227de6fcd0205a3c3c0d54d' }, h("span", { key: 'e874004dc5a3d8bf3a422c9b783c24dd6968cf74', innerHTML: this.slottedContent }), h("span", { key: 'd89b1f6867f2b41934edb4a0865aebbdb21741a9', "aria-hidden": "true" }, h("slot", { key: 'fed72c4e9ad605db0d65c1c32e91976ae3147a4b' }))), h("post-icon", { key: '882e65fd30695db2b8a74be8258e69eed90b8f78', name: "chevrondown" }))));
1370
+ return (h(Host, { key: '7e6201e3cdea96113bbebdeeb805acff557c8bbb', "data-version": version }, h("button", { key: '1863f48dbd6e98b7a2b226b7c3b25b16a38c644b', 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: 'dee7e77e45914a3e40a9f5027570bef0035dfdf2' }, h("span", { key: '362865f7946f14f45ecdb240e81f09370e3f6d10', innerHTML: this.slottedContent }), h("span", { key: 'd61eb63433aa65631f787646df2c6705c3d6e7a1', "aria-hidden": "true" }, h("slot", { key: 'c831f7299fe3c80b8229c861e01e09a2ee481bc8' }))), h("post-icon", { key: 'bcc8ed53293e16d4571e989a491760f98425b298', name: "chevrondown" }))));
1333
1371
  }
1334
1372
  get host() { return getElement(this); }
1335
1373
  };
@@ -1460,17 +1498,32 @@ const PostMenu = class {
1460
1498
  this.toggleMenu.emit(this.isVisible);
1461
1499
  if (this.isVisible) {
1462
1500
  this.lastFocusedElement = this.root?.activeElement;
1463
- requestAnimationFrame(() => {
1464
- const menuItems = this.getSlottedItems();
1465
- if (menuItems.length > 0) {
1466
- menuItems[0].focus();
1467
- }
1468
- });
1501
+ // Only focus the first item if the trigger was keyboard-focus-visible
1502
+ // that's the browser's own signal for a keyboard-driven interaction.
1503
+ if (this.wasFocusVisible(this.lastFocusedElement)) {
1504
+ requestAnimationFrame(() => {
1505
+ const menuItems = this.getSlottedItems();
1506
+ if (menuItems.length > 0) {
1507
+ menuItems[0].focus();
1508
+ }
1509
+ });
1510
+ }
1469
1511
  }
1470
1512
  else if (this.lastFocusedElement) {
1471
1513
  this.lastFocusedElement.focus();
1472
1514
  }
1473
1515
  }
1516
+ wasFocusVisible(element) {
1517
+ if (!element)
1518
+ return false;
1519
+ try {
1520
+ return element.matches(':focus-visible');
1521
+ }
1522
+ catch {
1523
+ // Not supported, fall back to always focusing
1524
+ return true;
1525
+ }
1526
+ }
1474
1527
  controlKeyDownHandler(e) {
1475
1528
  const menuItems = this.getSlottedItems();
1476
1529
  if (menuItems.length === 0) {
@@ -1522,7 +1575,7 @@ const PostMenu = class {
1522
1575
  ]));
1523
1576
  }
1524
1577
  render() {
1525
- return (h(Host, { key: 'ec2d0c28803ab242f28e942c52d03b38d40f3704', "data-version": version }, h("post-popovercontainer", { key: 'c2bbf5c95e200aecbdc55b94676ab1b1b0a32d13', onPostShow: this.handlePostShown.bind(this), onPostBeforeToggle: this.handlePostBeforeToggle.bind(this), placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '80e56e976e944955f72b504b33ee3a16117f4551', part: "post-menu" }, h("slot", { key: 'cab13b8104f0be049e31fe5b3eca3af85bec0869', name: "header" }), h("slot", { key: 'acbbd8565bb90c91dad4713fbc4e8c50d10390e8' })))));
1578
+ return (h(Host, { key: '22441c2bef0402f10e77b96b8a5d48a0648615f7', "data-version": version }, h("post-popovercontainer", { key: '8b37fe55d58a3a486e947266348b55408999a8bb', onPostShow: this.handlePostShown.bind(this), onPostBeforeToggle: this.handlePostBeforeToggle.bind(this), placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '2679eb9c4a95585b8aaf74e29f026c84b10aa6f3', part: "post-menu" }, h("slot", { key: '0da58a1bde1bdb4c1f8b7b19ca8cbde14d7946fc', name: "header" }), h("slot", { key: '801f7bc59d4d3267728b9adf0750dbea76a7652c' })))));
1526
1579
  }
1527
1580
  get host() { return getElement(this); }
1528
1581
  };
@@ -1541,7 +1594,7 @@ __decorate$2([
1541
1594
  ], PostMenu.prototype, "handlePostBeforeToggle", null);
1542
1595
  PostMenu.style = postMenuCss();
1543
1596
 
1544
- const postMenuItemCss = () => `post-menu-item button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;width:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button{background-color:ButtonFace !important}post-menu-item button:hover{background-color:Highlight !important}}post-menu-item a{text-decoration:none}post-menu-item button,post-menu-item a{position:relative;display:flex;align-items:center;padding:8px 12px 8px 16px;gap:12px;font-size:.875rem;color:#050400;border-radius:0}post-menu-item button post-icon,post-menu-item a post-icon{width:16px;height:16px;margin-block:4px}@media screen and (min-width: 780px){post-menu-item button,post-menu-item a{font-size:1rem;padding-block:12px;gap:16px}post-menu-item button post-icon,post-menu-item a post-icon{width:24px;height:24px;margin:0}}@media screen and (min-width: 1024px){post-menu-item button,post-menu-item a{font-size:1.25rem;padding-block:13px}}post-menu-item button:focus-visible,post-menu-item a:focus-visible{outline-offset:2px !important;border-radius:4px}post-menu-item button:hover,post-menu-item a:hover{background-color:#504f4b;color:#fff}`;
1597
+ const postMenuItemCss = () => `post-menu-item button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;width:100%}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-menu-item button{background-color:ButtonFace !important}post-menu-item button:hover{background-color:Highlight !important}}post-menu-item button,post-menu-item a{position:relative;display:flex;align-items:center;padding:8px 12px 8px 16px;gap:12px;font-size:.875rem;color:#050400;border-radius:0;text-decoration:none}@media screen and (min-width: 780px){post-menu-item button,post-menu-item a{font-size:1rem;padding-block:12px;gap:16px}}@media screen and (min-width: 1024px){post-menu-item button,post-menu-item a{font-size:1.25rem;padding-block:13px}}post-menu-item button:focus-visible,post-menu-item a:focus-visible{outline-offset:2px !important;border-radius:4px}post-menu-item button:hover,post-menu-item a:hover{background-color:#504f4b;color:#fff}post-menu-item button post-icon,post-menu-item a post-icon{width:16px;height:16px;margin-block:4px}@media screen and (min-width: 780px){post-menu-item button post-icon,post-menu-item a post-icon{width:24px;height:24px;margin:0}}`;
1545
1598
 
1546
1599
  const PostMenuItem = class {
1547
1600
  constructor(hostRef) {
@@ -1621,7 +1674,7 @@ const PostMenuTrigger = class {
1621
1674
  return null;
1622
1675
  }
1623
1676
  render() {
1624
- return (h(Host, { key: '2e0560835a4202f9a84990a60305bf7dc8adbc98', "data-version": version }, h("slot", { key: 'd175e8bc5ddb253476f9795d7b0b2df2797c46aa' })));
1677
+ return (h(Host, { key: 'f75522d28e9a45c80846a191cff3ea2eb51b5bde', "data-version": version }, h("slot", { key: 'bc70e3ddc8dc372611c00a4cda52cd35ede02a3f' })));
1625
1678
  }
1626
1679
  get host() { return getElement(this); }
1627
1680
  };
@@ -1636,6 +1689,7 @@ PostMenuTrigger.style = postMenuTriggerCss();
1636
1689
  * @see https://floating-ui.com/docs/virtual-elements
1637
1690
  */
1638
1691
 
1692
+ const sides = ['top', 'right', 'bottom', 'left'];
1639
1693
  const min = Math.min;
1640
1694
  const max = Math.max;
1641
1695
  const round = Math.round;
@@ -1728,12 +1782,12 @@ function getOppositePlacement(placement) {
1728
1782
  return oppositeSideMap[side] + placement.slice(side.length);
1729
1783
  }
1730
1784
  function expandPaddingObject(padding) {
1785
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
1731
1786
  return {
1732
- top: 0,
1733
- right: 0,
1734
- bottom: 0,
1735
- left: 0,
1736
- ...padding
1787
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
1788
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
1789
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
1790
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
1737
1791
  };
1738
1792
  }
1739
1793
  function getPaddingObject(padding) {
@@ -1808,13 +1862,9 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
1808
1862
  y: reference.y
1809
1863
  };
1810
1864
  }
1811
- switch (getAlignment(placement)) {
1812
- case 'start':
1813
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
1814
- break;
1815
- case 'end':
1816
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
1817
- break;
1865
+ const alignment = getAlignment(placement);
1866
+ if (alignment) {
1867
+ coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);
1818
1868
  }
1819
1869
  return coords;
1820
1870
  }
@@ -1863,10 +1913,7 @@ async function detectOverflow(state, options) {
1863
1913
  height: rects.floating.height
1864
1914
  } : rects.reference;
1865
1915
  const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
1866
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1867
- x: 1,
1868
- y: 1
1869
- } : {
1916
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
1870
1917
  x: 1,
1871
1918
  y: 1
1872
1919
  };
@@ -2039,17 +2086,16 @@ const arrow$1 = options => ({
2039
2086
 
2040
2087
  // Make sure the arrow doesn't overflow the floating element if the center
2041
2088
  // point is outside the floating element's bounds.
2042
- const min$1 = minPadding;
2043
2089
  const max = clientSize - arrowDimensions[length] - maxPadding;
2044
2090
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
2045
- const offset = clamp(min$1, center, max);
2091
+ const offset = clamp(minPadding, center, max);
2046
2092
 
2047
2093
  // If the reference is small enough that the arrow's padding causes it to
2048
2094
  // to point to nothing for an aligned placement, adjust the offset of the
2049
2095
  // floating element itself. To ensure `shift()` continues to take action,
2050
2096
  // a single reset is performed when this is true.
2051
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
2052
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
2097
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
2098
+ const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;
2053
2099
  return {
2054
2100
  [axis]: coords[axis] + alignmentOffset,
2055
2101
  data: {
@@ -2196,6 +2242,76 @@ const flip$1 = function (options) {
2196
2242
  };
2197
2243
  };
2198
2244
 
2245
+ function getSideOffsets(overflow, rect) {
2246
+ return {
2247
+ top: overflow.top - rect.height,
2248
+ right: overflow.right - rect.width,
2249
+ bottom: overflow.bottom - rect.height,
2250
+ left: overflow.left - rect.width
2251
+ };
2252
+ }
2253
+ function isAnySideFullyClipped(overflow) {
2254
+ return sides.some(side => overflow[side] >= 0);
2255
+ }
2256
+ /**
2257
+ * Provides data to hide the floating element in applicable situations, such as
2258
+ * when it is not in the same clipping context as the reference element.
2259
+ * @see https://floating-ui.com/docs/hide
2260
+ */
2261
+ const hide$1 = function (options) {
2262
+ if (options === void 0) {
2263
+ options = {};
2264
+ }
2265
+ return {
2266
+ name: 'hide',
2267
+ options,
2268
+ async fn(state) {
2269
+ const {
2270
+ rects,
2271
+ platform
2272
+ } = state;
2273
+ const {
2274
+ strategy = 'referenceHidden',
2275
+ ...detectOverflowOptions
2276
+ } = evaluate(options, state);
2277
+ switch (strategy) {
2278
+ case 'referenceHidden':
2279
+ {
2280
+ const overflow = await platform.detectOverflow(state, {
2281
+ ...detectOverflowOptions,
2282
+ elementContext: 'reference'
2283
+ });
2284
+ const offsets = getSideOffsets(overflow, rects.reference);
2285
+ return {
2286
+ data: {
2287
+ referenceHiddenOffsets: offsets,
2288
+ referenceHidden: isAnySideFullyClipped(offsets)
2289
+ }
2290
+ };
2291
+ }
2292
+ case 'escaped':
2293
+ {
2294
+ const overflow = await platform.detectOverflow(state, {
2295
+ ...detectOverflowOptions,
2296
+ altBoundary: true
2297
+ });
2298
+ const offsets = getSideOffsets(overflow, rects.floating);
2299
+ return {
2300
+ data: {
2301
+ escapedOffsets: offsets,
2302
+ escaped: isAnySideFullyClipped(offsets)
2303
+ }
2304
+ };
2305
+ }
2306
+ default:
2307
+ {
2308
+ return {};
2309
+ }
2310
+ }
2311
+ }
2312
+ };
2313
+ };
2314
+
2199
2315
  function getBoundingRect(rects) {
2200
2316
  const minX = min(...rects.map(rect => rect.left));
2201
2317
  const minY = min(...rects.map(rect => rect.top));
@@ -2252,12 +2368,19 @@ const inline$1 = function (options) {
2252
2368
  y
2253
2369
  } = evaluate(options, state);
2254
2370
  const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
2371
+
2372
+ // No rects (e.g. a hidden or detached reference, or a collapsed range) —
2373
+ // keep the existing reference rect rather than resetting to an invalid
2374
+ // one with non-finite values.
2375
+ if (!nativeClientRects.length) {
2376
+ return {};
2377
+ }
2255
2378
  const clientRects = getRectsByLine(nativeClientRects);
2256
2379
  const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
2257
2380
  const paddingObject = getPaddingObject(padding);
2258
2381
  function getBoundingClientRect() {
2259
2382
  // There are two rects and they are disjoined.
2260
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
2383
+ if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {
2261
2384
  // Find the first rect in which the point is fully inside.
2262
2385
  return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
2263
2386
  }
@@ -2272,18 +2395,12 @@ const inline$1 = function (options) {
2272
2395
  const bottom = lastRect.bottom;
2273
2396
  const left = isTop ? firstRect.left : lastRect.left;
2274
2397
  const right = isTop ? firstRect.right : lastRect.right;
2275
- const width = right - left;
2276
- const height = bottom - top;
2277
- return {
2278
- top,
2279
- bottom,
2280
- left,
2281
- right,
2282
- width,
2283
- height,
2398
+ return rectToClientRect({
2284
2399
  x: left,
2285
- y: top
2286
- };
2400
+ y: top,
2401
+ width: right - left,
2402
+ height: bottom - top
2403
+ });
2287
2404
  }
2288
2405
  const isLeftSide = getSide(placement) === 'left';
2289
2406
  const maxRight = max(...clientRects.map(rect => rect.right));
@@ -2291,20 +2408,12 @@ const inline$1 = function (options) {
2291
2408
  const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
2292
2409
  const top = measureRects[0].top;
2293
2410
  const bottom = measureRects[measureRects.length - 1].bottom;
2294
- const left = minLeft;
2295
- const right = maxRight;
2296
- const width = right - left;
2297
- const height = bottom - top;
2298
- return {
2299
- top,
2300
- bottom,
2301
- left,
2302
- right,
2303
- width,
2304
- height,
2305
- x: left,
2306
- y: top
2307
- };
2411
+ return rectToClientRect({
2412
+ x: minLeft,
2413
+ y: top,
2414
+ width: maxRight - minLeft,
2415
+ height: bottom - top
2416
+ });
2308
2417
  }
2309
2418
  return fallback;
2310
2419
  }
@@ -2454,23 +2563,16 @@ const shift$1 = function (options) {
2454
2563
  y
2455
2564
  };
2456
2565
  const overflow = await platform.detectOverflow(state, detectOverflowOptions);
2457
- const crossAxis = getSideAxis(getSide(placement));
2566
+ const crossAxis = getSideAxis(placement);
2458
2567
  const mainAxis = getOppositeAxis(crossAxis);
2459
2568
  let mainAxisCoord = coords[mainAxis];
2460
2569
  let crossAxisCoord = coords[crossAxis];
2570
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);
2461
2571
  if (checkMainAxis) {
2462
- const minSide = mainAxis === 'y' ? 'top' : 'left';
2463
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
2464
- const min = mainAxisCoord + overflow[minSide];
2465
- const max = mainAxisCoord - overflow[maxSide];
2466
- mainAxisCoord = clamp(min, mainAxisCoord, max);
2572
+ mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
2467
2573
  }
2468
2574
  if (checkCrossAxis) {
2469
- const minSide = crossAxis === 'y' ? 'top' : 'left';
2470
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
2471
- const min = crossAxisCoord + overflow[minSide];
2472
- const max = crossAxisCoord - overflow[maxSide];
2473
- crossAxisCoord = clamp(min, crossAxisCoord, max);
2575
+ crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
2474
2576
  }
2475
2577
  const limitedCoords = limiter.fn({
2476
2578
  ...state,
@@ -2501,6 +2603,7 @@ const limitShift$1 = function (options) {
2501
2603
  return {
2502
2604
  options,
2503
2605
  fn(state) {
2606
+ var _rawOffset$mainAxis, _rawOffset$crossAxis;
2504
2607
  const {
2505
2608
  x,
2506
2609
  y,
@@ -2526,9 +2629,8 @@ const limitShift$1 = function (options) {
2526
2629
  mainAxis: rawOffset,
2527
2630
  crossAxis: 0
2528
2631
  } : {
2529
- mainAxis: 0,
2530
- crossAxis: 0,
2531
- ...rawOffset
2632
+ mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
2633
+ crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
2532
2634
  };
2533
2635
  if (checkMainAxis) {
2534
2636
  const len = mainAxis === 'y' ? 'height' : 'width';
@@ -2560,6 +2662,12 @@ const limitShift$1 = function (options) {
2560
2662
  };
2561
2663
  };
2562
2664
 
2665
+ // Method syntax keeps callback parameters bivariant, but expressing the
2666
+ // explicit `| undefined` required by `exactOptionalPropertyTypes` needs
2667
+ // property syntax, which is contravariant under `strictFunctionTypes`.
2668
+ // Extracting the function from a method position restores that bivariance so
2669
+ // consumers can still assign callbacks with narrower parameter types.
2670
+
2563
2671
  /**
2564
2672
  * Provides data that allows you to change the size of the floating element —
2565
2673
  * for instance, prevent it from overflowing the clipping boundary or match the
@@ -2574,7 +2682,6 @@ const size$1 = function (options) {
2574
2682
  name: 'size',
2575
2683
  options,
2576
2684
  async fn(state) {
2577
- var _state$middlewareData, _state$middlewareData2;
2578
2685
  const {
2579
2686
  placement,
2580
2687
  rects,
@@ -2606,24 +2713,21 @@ const size$1 = function (options) {
2606
2713
  const maximumClippingWidth = width - overflow.left - overflow.right;
2607
2714
  const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
2608
2715
  const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
2609
- const noShift = !state.middlewareData.shift;
2716
+ const shiftData = state.middlewareData.shift;
2717
+ const noShift = !shiftData;
2610
2718
  let availableHeight = overflowAvailableHeight;
2611
2719
  let availableWidth = overflowAvailableWidth;
2612
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
2720
+ if (shiftData != null && shiftData.enabled.x) {
2613
2721
  availableWidth = maximumClippingWidth;
2614
2722
  }
2615
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
2723
+ if (shiftData != null && shiftData.enabled.y) {
2616
2724
  availableHeight = maximumClippingHeight;
2617
2725
  }
2618
2726
  if (noShift && !alignment) {
2619
- const xMin = max(overflow.left, 0);
2620
- const xMax = max(overflow.right, 0);
2621
- const yMin = max(overflow.top, 0);
2622
- const yMax = max(overflow.bottom, 0);
2623
2727
  if (isYAxis) {
2624
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
2728
+ availableWidth = width - 2 * max(overflow.left, overflow.right);
2625
2729
  } else {
2626
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
2730
+ availableHeight = height - 2 * max(overflow.top, overflow.bottom);
2627
2731
  }
2628
2732
  }
2629
2733
  await apply({
@@ -2779,7 +2883,7 @@ function getParentNode(node) {
2779
2883
  function getNearestOverflowAncestor(node) {
2780
2884
  const parentNode = getParentNode(node);
2781
2885
  if (isLastTraversableNode(parentNode)) {
2782
- return node.ownerDocument ? node.ownerDocument.body : node.body;
2886
+ return (node.ownerDocument || node).body;
2783
2887
  }
2784
2888
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
2785
2889
  return parentNode;
@@ -2876,10 +2980,7 @@ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
2876
2980
  if (isFixed === void 0) {
2877
2981
  isFixed = false;
2878
2982
  }
2879
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
2880
- return false;
2881
- }
2882
- return isFixed;
2983
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
2883
2984
  }
2884
2985
 
2885
2986
  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
@@ -2906,12 +3007,12 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
2906
3007
  let y = (clientRect.top + visualOffsets.y) / scale.y;
2907
3008
  let width = clientRect.width / scale.x;
2908
3009
  let height = clientRect.height / scale.y;
2909
- if (domElement) {
3010
+ if (domElement && offsetParent) {
2910
3011
  const win = getWindow(domElement);
2911
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
3012
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2912
3013
  let currentWin = win;
2913
3014
  let currentIFrame = getFrameElement(currentWin);
2914
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
3015
+ while (currentIFrame && offsetWin !== currentWin) {
2915
3016
  const iframeScale = getScale(currentIFrame);
2916
3017
  const iframeRect = currentIFrame.getBoundingClientRect();
2917
3018
  const css = getComputedStyle$1(currentIFrame);
@@ -2975,7 +3076,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2975
3076
  let scale = createCoords(1);
2976
3077
  const offsets = createCoords(0);
2977
3078
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
2978
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3079
+ if (isOffsetParentAnElement || !isFixed) {
2979
3080
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2980
3081
  scroll = getNodeScroll(offsetParent);
2981
3082
  }
@@ -2996,18 +3097,17 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2996
3097
  }
2997
3098
 
2998
3099
  function getClientRects(element) {
2999
- return Array.from(element.getClientRects());
3100
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
3000
3101
  }
3001
3102
 
3002
3103
  // Gets the entire size of the scrollable document area, even extending outside
3003
3104
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
3004
- function getDocumentRect(element) {
3005
- const html = getDocumentElement(element);
3006
- const scroll = getNodeScroll(element);
3007
- const body = element.ownerDocument.body;
3105
+ function getDocumentRect(html) {
3106
+ const scroll = getNodeScroll(html);
3107
+ const body = html.ownerDocument.body;
3008
3108
  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
3009
3109
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
3010
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
3110
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
3011
3111
  const y = -scroll.scrollTop;
3012
3112
  if (getComputedStyle$1(body).direction === 'rtl') {
3013
3113
  x += max(html.clientWidth, body.clientWidth) - width;
@@ -3024,7 +3124,11 @@ function getDocumentRect(element) {
3024
3124
  // calculation is affected by unusual styles.
3025
3125
  // Most scrollbars leave 15-18px of space.
3026
3126
  const SCROLLBAR_MAX = 25;
3027
- function getViewportRect(element, strategy) {
3127
+ function getViewportRect(element, strategy, rootBoundary) {
3128
+ if (rootBoundary === void 0) {
3129
+ rootBoundary = 'viewport';
3130
+ }
3131
+ const isLayoutViewport = rootBoundary === 'layoutViewport';
3028
3132
  const win = getWindow(element);
3029
3133
  const html = getDocumentElement(element);
3030
3134
  const visualViewport = win.visualViewport;
@@ -3033,31 +3137,42 @@ function getViewportRect(element, strategy) {
3033
3137
  let x = 0;
3034
3138
  let y = 0;
3035
3139
  if (visualViewport) {
3036
- width = visualViewport.width;
3037
- height = visualViewport.height;
3038
- const visualViewportBased = isWebKit();
3039
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
3040
- x = visualViewport.offsetLeft;
3041
- y = visualViewport.offsetTop;
3140
+ // Client coordinates are relative to the layout viewport, except in
3141
+ // WebKit with an `absolute` strategy, where they are relative to the
3142
+ // visual viewport.
3143
+ const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';
3144
+ if (isLayoutViewport) {
3145
+ if (!layoutRelativeClientCoords) {
3146
+ x = -visualViewport.offsetLeft;
3147
+ y = -visualViewport.offsetTop;
3148
+ }
3149
+ } else {
3150
+ width = visualViewport.width;
3151
+ height = visualViewport.height;
3152
+ if (layoutRelativeClientCoords) {
3153
+ x = visualViewport.offsetLeft;
3154
+ y = visualViewport.offsetTop;
3155
+ }
3042
3156
  }
3043
3157
  }
3044
3158
  const windowScrollbarX = getWindowScrollBarX(html);
3045
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
3046
- // visual width of the <html> but this is not considered in the size
3047
- // of `html.clientWidth`.
3159
+ // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks
3160
+ // the visual width but isn't reflected in `html.clientWidth`, so subtract it.
3161
+ // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also
3162
+ // reserves an empty inline-start gutter that clips nothing, so exclude just
3163
+ // the one scrollbar-side gutter — halve the measured (two-gutter) total. A
3164
+ // left-side scrollbar (`windowScrollbarX > 0`) is already handled by
3165
+ // `getHTMLOffset`/`visualViewport.width`; skip it here.
3048
3166
  if (windowScrollbarX <= 0) {
3049
3167
  const doc = html.ownerDocument;
3050
3168
  const body = doc.body;
3051
3169
  const bodyStyles = getComputedStyle(body);
3052
3170
  const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
3053
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
3054
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
3055
- width -= clippingStableScrollbarWidth;
3171
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
3172
+ const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;
3173
+ if (gutter <= SCROLLBAR_MAX) {
3174
+ width -= gutter;
3056
3175
  }
3057
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
3058
- // If the <body> scrollbar is on the left, the width needs to be extended
3059
- // by the scrollbar amount so there isn't extra space on the right.
3060
- width += windowScrollbarX;
3061
3176
  }
3062
3177
  return {
3063
3178
  width,
@@ -3072,7 +3187,7 @@ function getInnerBoundingClientRect(element, strategy) {
3072
3187
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
3073
3188
  const top = clientRect.top + element.clientTop;
3074
3189
  const left = clientRect.left + element.clientLeft;
3075
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
3190
+ const scale = getScale(element);
3076
3191
  const width = element.clientWidth * scale.x;
3077
3192
  const height = element.clientHeight * scale.y;
3078
3193
  const x = left * scale.x;
@@ -3086,8 +3201,8 @@ function getInnerBoundingClientRect(element, strategy) {
3086
3201
  }
3087
3202
  function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
3088
3203
  let rect;
3089
- if (clippingAncestor === 'viewport') {
3090
- rect = getViewportRect(element, strategy);
3204
+ if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {
3205
+ rect = getViewportRect(element, strategy, clippingAncestor);
3091
3206
  } else if (clippingAncestor === 'document') {
3092
3207
  rect = getDocumentRect(getDocumentElement(element));
3093
3208
  } else if (isElement(clippingAncestor)) {
@@ -3103,13 +3218,6 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
3103
3218
  }
3104
3219
  return rectToClientRect(rect);
3105
3220
  }
3106
- function hasFixedPositionAncestor(element, stopNode) {
3107
- const parentNode = getParentNode(element);
3108
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
3109
- return false;
3110
- }
3111
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
3112
- }
3113
3221
 
3114
3222
  // A "clipping ancestor" is an `overflow` element with the characteristic of
3115
3223
  // clipping (or hiding) child elements. This returns all clipping ancestors
@@ -3120,7 +3228,7 @@ function getClippingElementAncestors(element, cache) {
3120
3228
  return cachedResult;
3121
3229
  }
3122
3230
  let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
3123
- let currentContainingBlockComputedStyle = null;
3231
+ let lastKeptComputedStyle = null;
3124
3232
  const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
3125
3233
  let currentNode = elementIsFixed ? getParentNode(element) : element;
3126
3234
 
@@ -3128,16 +3236,20 @@ function getClippingElementAncestors(element, cache) {
3128
3236
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
3129
3237
  const computedStyle = getComputedStyle$1(currentNode);
3130
3238
  const currentNodeIsContaining = isContainingBlock(currentNode);
3131
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
3132
- currentContainingBlockComputedStyle = null;
3133
- }
3134
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
3239
+ // Position of the containing block chain below the current node. A fixed
3240
+ // element whose containing block hasn't been found yet is a fixed chain.
3241
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';
3242
+
3243
+ // A non-containing ancestor does not clip the element when the chain
3244
+ // below it escapes it: a fixed chain escapes all ancestors up to the
3245
+ // next containing block, an absolute chain escapes static ancestors.
3246
+ const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');
3135
3247
  if (shouldDropCurrentNode) {
3136
3248
  // Drop non-containing blocks.
3137
3249
  result = result.filter(ancestor => ancestor !== currentNode);
3138
3250
  } else {
3139
- // Record last containing block for next iteration.
3140
- currentContainingBlockComputedStyle = computedStyle;
3251
+ // The kept node carries the chain position for the next iteration.
3252
+ lastKeptComputedStyle = computedStyle;
3141
3253
  }
3142
3254
  currentNode = getParentNode(currentNode);
3143
3255
  }
@@ -3147,7 +3259,7 @@ function getClippingElementAncestors(element, cache) {
3147
3259
 
3148
3260
  // Gets the maximum area that the element is visible in due to any number of
3149
3261
  // clipping ancestors.
3150
- function getClippingRect(_ref) {
3262
+ function getClippingRect$1(_ref) {
3151
3263
  let {
3152
3264
  element,
3153
3265
  boundary,
@@ -3197,13 +3309,7 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3197
3309
  scrollTop: 0
3198
3310
  };
3199
3311
  const offsets = createCoords(0);
3200
-
3201
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
3202
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
3203
- function setLeftRTLScrollbarOffset() {
3204
- offsets.x = getWindowScrollBarX(documentElement);
3205
- }
3206
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
3312
+ if (isOffsetParentAnElement || !isFixed) {
3207
3313
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
3208
3314
  scroll = getNodeScroll(offsetParent);
3209
3315
  }
@@ -3211,12 +3317,13 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
3211
3317
  const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
3212
3318
  offsets.x = offsetRect.x + offsetParent.clientLeft;
3213
3319
  offsets.y = offsetRect.y + offsetParent.clientTop;
3214
- } else if (documentElement) {
3215
- setLeftRTLScrollbarOffset();
3216
3320
  }
3217
3321
  }
3218
- if (isFixed && !isOffsetParentAnElement && documentElement) {
3219
- setLeftRTLScrollbarOffset();
3322
+
3323
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
3324
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
3325
+ if (!isOffsetParentAnElement && documentElement) {
3326
+ offsets.x = getWindowScrollBarX(documentElement);
3220
3327
  }
3221
3328
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
3222
3329
  const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
@@ -3301,7 +3408,7 @@ function isRTL(element) {
3301
3408
  const platform = {
3302
3409
  convertOffsetParentRelativeRectToViewportRelativeRect,
3303
3410
  getDocumentElement,
3304
- getClippingRect,
3411
+ getClippingRect: getClippingRect$1,
3305
3412
  getOffsetParent,
3306
3413
  getElementRects,
3307
3414
  getClientRects,
@@ -3316,7 +3423,7 @@ function rectsAreEqual(a, b) {
3316
3423
  }
3317
3424
 
3318
3425
  // https://samthor.au/2021/observing-dom/
3319
- function observeMove(element, onMove) {
3426
+ function observeMove(element, onMove, ancestorResize) {
3320
3427
  let io = null;
3321
3428
  let timeoutId;
3322
3429
  const root = getDocumentElement(element);
@@ -3359,13 +3466,22 @@ function observeMove(element, onMove) {
3359
3466
  let isFirstUpdate = true;
3360
3467
  function handleObserve(entries) {
3361
3468
  const ratio = entries[0].intersectionRatio;
3469
+
3470
+ // The entry is a snapshot, so the reference may have moved since the
3471
+ // intersection was computed (under performance constraints, or between
3472
+ // consecutive frames of a multi-frame layout shift). The reported ratio
3473
+ // and the observed area are stale in that case and cannot be trusted to
3474
+ // detect subsequent movement, so refresh regardless of the ratio.
3475
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3476
+ return refresh();
3477
+ }
3362
3478
  if (ratio !== threshold) {
3363
3479
  if (!isFirstUpdate) {
3364
3480
  return refresh();
3365
3481
  }
3366
3482
  if (!ratio) {
3367
- // If the reference is clipped, the ratio is 0. Throttle the refresh
3368
- // to prevent an infinite loop of updates.
3483
+ // If the reference is clipped in place, the ratio is 0. Throttle
3484
+ // the refresh to prevent an infinite loop of updates.
3369
3485
  timeoutId = setTimeout(() => {
3370
3486
  refresh(false, 1e-7);
3371
3487
  }, 1000);
@@ -3373,16 +3489,6 @@ function observeMove(element, onMove) {
3373
3489
  refresh(false, ratio);
3374
3490
  }
3375
3491
  }
3376
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
3377
- // It's possible that even though the ratio is reported as 1, the
3378
- // element is not actually fully within the IntersectionObserver's root
3379
- // area anymore. This can happen under performance constraints. This may
3380
- // be a bug in the browser's IntersectionObserver implementation. To
3381
- // work around this, we compare the element's bounding rect now with
3382
- // what it was at the time we created the IntersectionObserver. If they
3383
- // are not equal then the element moved, so we refresh.
3384
- refresh();
3385
- }
3386
3492
  isFirstUpdate = false;
3387
3493
  }
3388
3494
 
@@ -3399,8 +3505,18 @@ function observeMove(element, onMove) {
3399
3505
  }
3400
3506
  io.observe(element);
3401
3507
  }
3508
+ const win = getWindow(element);
3509
+ // The window is a resize ancestor, so when `ancestorResize` is enabled its
3510
+ // listener already runs the update on resize. Here we only need to rebuild
3511
+ // the `IntersectionObserver` for the new root size, skipping a redundant
3512
+ // update. When `ancestorResize` is disabled, this becomes the sole update.
3513
+ const handleResize = () => refresh(ancestorResize);
3514
+ win.addEventListener('resize', handleResize);
3402
3515
  refresh(true);
3403
- return cleanup;
3516
+ return () => {
3517
+ win.removeEventListener('resize', handleResize);
3518
+ cleanup();
3519
+ };
3404
3520
  }
3405
3521
 
3406
3522
  /**
@@ -3425,12 +3541,10 @@ function autoUpdate(reference, floating, update, options) {
3425
3541
  const referenceEl = unwrapElement(reference);
3426
3542
  const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
3427
3543
  ancestors.forEach(ancestor => {
3428
- ancestorScroll && ancestor.addEventListener('scroll', update, {
3429
- passive: true
3430
- });
3544
+ ancestorScroll && ancestor.addEventListener('scroll', update);
3431
3545
  ancestorResize && ancestor.addEventListener('resize', update);
3432
3546
  });
3433
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
3547
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
3434
3548
  let reobserveFrame = -1;
3435
3549
  let resizeObserver = null;
3436
3550
  if (elementResize) {
@@ -3516,6 +3630,13 @@ const flip = flip$1;
3516
3630
  */
3517
3631
  const size = size$1;
3518
3632
 
3633
+ /**
3634
+ * Provides data to hide the floating element in applicable situations, such as
3635
+ * when it is not in the same clipping context as the reference element.
3636
+ * @see https://floating-ui.com/docs/hide
3637
+ */
3638
+ const hide = hide$1;
3639
+
3519
3640
  /**
3520
3641
  * Provides data to position an inner element of the floating element so that it
3521
3642
  * appears centered to the reference element.
@@ -3544,11 +3665,9 @@ const computePosition = (reference, floating, options) => {
3544
3665
  // multiple lifecycle resets re-use the same result. It only lives for a
3545
3666
  // single call. If other functions become expensive, we can add them as well.
3546
3667
  const cache = new Map();
3547
- const mergedOptions = {
3548
- platform,
3549
- ...options
3550
- };
3668
+ const mergedOptions = options != null ? options : {};
3551
3669
  const platformWithCache = {
3670
+ ...platform,
3552
3671
  ...mergedOptions.platform,
3553
3672
  _c: cache
3554
3673
  };
@@ -4365,6 +4484,77 @@ function apply() {
4365
4484
  injectStyles(document);
4366
4485
  }
4367
4486
 
4487
+ /**
4488
+ * This utility is covered by the end-to-end tests under 'clipping' in `popovercontainer.cy.ts`.
4489
+ */
4490
+ const CLIPPING_RECT_CACHE = Symbol('Clipping Rect Cache');
4491
+ /**
4492
+ * A custom floating UI platform that restricts clipping rectangles to the safe area.
4493
+ */
4494
+ const safeAreaPlatform = { ...platform, getClippingRect };
4495
+ /**
4496
+ * Computes the clipping rectangle of an element while accounting for the safe area.
4497
+ */
4498
+ async function getClippingRect(...args) {
4499
+ const element = args[0].element;
4500
+ // Check whether the clipping rectangle of the given element has already been computed during
4501
+ // this pass.
4502
+ const hit = this[CLIPPING_RECT_CACHE].get(element);
4503
+ if (hit)
4504
+ return hit;
4505
+ // Compute the clipping rectangle with the Floating UI DOM platform, then restrict it to the safe
4506
+ // area.
4507
+ const clippingRect = await platform.getClippingRect.apply(this, args);
4508
+ applySafeArea(clippingRect, element);
4509
+ this[CLIPPING_RECT_CACHE].set(element, clippingRect);
4510
+ return clippingRect;
4511
+ }
4512
+ /**
4513
+ * Restricts the `clippingRect` computed for `element` to the safe area, modifying it in place.
4514
+ *
4515
+ * The safe area only applies to elements that the header can actually cover, which excludes
4516
+ * elements without a header on their page, elements on a top layer and elements within the header.
4517
+ */
4518
+ function applySafeArea(clippingRect, element) {
4519
+ const headerElement = element.ownerDocument.querySelector('post-header');
4520
+ if (headerElement === null)
4521
+ return;
4522
+ let parent = element;
4523
+ while (!isLastTraversableNode(parent)) {
4524
+ parent = getParentNode(parent);
4525
+ if (!isHTMLElement(parent))
4526
+ continue;
4527
+ // Do not apply the safe area of the header to
4528
+ // - elements that are on a top layer, such as a dialog.
4529
+ // - elements that are located within the header itself.
4530
+ if (isTopLayer(parent) || parent === headerElement)
4531
+ return;
4532
+ }
4533
+ const headerRect = headerElement.getBoundingClientRect();
4534
+ const top = Math.max(clippingRect.y, headerRect.bottom);
4535
+ clippingRect.height -= top - clippingRect.y;
4536
+ clippingRect.y = top;
4537
+ }
4538
+ /**
4539
+ * Computes the coordinates that will position the `floating` element next to a given `reference`
4540
+ * element while accounting for the safe area.
4541
+ *
4542
+ * The safe area is the part of the viewport that the header does not cover. Restricting the
4543
+ * clipping rectangles to it makes floating elements behave as if they were clipped by the header.
4544
+ */
4545
+ const computePositionWithSafeArea = (reference, floating, options) => {
4546
+ // Adapted from https://github.com/floating-ui/floating-ui/blob/27629b74ba36ab8ceb2a968051927b9b69511a3b/packages/dom/src/index.ts#L15
4547
+ options ??= {};
4548
+ return computePosition(reference, floating, {
4549
+ ...options,
4550
+ platform: {
4551
+ ...safeAreaPlatform,
4552
+ ...options.platform,
4553
+ [CLIPPING_RECT_CACHE]: new Map(),
4554
+ },
4555
+ });
4556
+ };
4557
+
4368
4558
  const postPopovercontainerCss = () => `@layer polyfill{@supports not selector(:popover-open){:host([popover]:not(.\\:popover-open)){display:none}}}:host{background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:host>div{box-shadow:var(--post-device-elevation-300);width:max-content;max-width:100%;color:var(--post-current-fg);background-color:var(--post-current-bg);border-radius:4px;position:relative}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host>div{border:2px solid rgba(0,0,0,0)}}:host [part=post-popovercontainer-border-mask]{display:none;position:absolute;inset:0;border-radius:4px;pointer-events:none}:host .arrow{--post-popovercontainer-arrow-border: var(--post-popovercontainer-arrow-border-width, 0px) solid var(--post-popovercontainer-arrow-border-color, transparent);position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:host .arrow[dynamic-placement=top]{border-bottom-right-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=right]{border-bottom-left-radius:2px;border-bottom:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=bottom]{border-top-left-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-left:var(--post-popovercontainer-arrow-border)}:host .arrow[dynamic-placement=left]{border-top-right-radius:2px;border-top:var(--post-popovercontainer-arrow-border);border-right:var(--post-popovercontainer-arrow-border)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .arrow[dynamic-placement=top]{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);bottom:-0.3796735336rem !important}:host .arrow[dynamic-placement=left]{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0);right:-0.3796735336rem !important}:host .arrow[dynamic-placement=right]{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);left:-0.3796735336rem !important}:host .arrow[dynamic-placement=bottom]{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0);top:-0.3796735336rem !important}}:host([tooltip]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:host([safe-space])::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:auto}:host([safe-space=triangle])::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:host([safe-space=trapezoid])::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:host(:not(:has(.arrow)))>div{box-shadow:var(--post-device-elevation-300)}:host(:has(.arrow))>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:host(:has(.arrow[dynamic-placement=top]))>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:host(:has(.arrow[dynamic-placement=left]))>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:host(:has(.arrow[dynamic-placement=right]))>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}`;
4369
4559
 
4370
4560
  var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -4381,6 +4571,30 @@ const ANIMATIONS = {
4381
4571
  'pop-in': popIn,
4382
4572
  };
4383
4573
  const PostPopovercontainer = class {
4574
+ static {
4575
+ this.STATIC_SIDES = {
4576
+ top: 'bottom',
4577
+ right: 'left',
4578
+ bottom: 'top',
4579
+ left: 'right',
4580
+ };
4581
+ }
4582
+ static {
4583
+ this.PROPERTIES_TO_CLEAR = [
4584
+ '--post-safe-space-popover-x',
4585
+ '--post-safe-space-popover-y',
4586
+ '--post-safe-space-popover-x-start',
4587
+ '--post-safe-space-popover-x-end',
4588
+ '--post-safe-space-popover-y-start',
4589
+ '--post-safe-space-popover-y-end',
4590
+ '--post-safe-space-trigger-x',
4591
+ '--post-safe-space-trigger-y',
4592
+ '--post-safe-space-trigger-x-start',
4593
+ '--post-safe-space-trigger-x-end',
4594
+ '--post-safe-space-trigger-y-start',
4595
+ '--post-safe-space-trigger-y-end',
4596
+ ];
4597
+ }
4384
4598
  constructor(hostRef) {
4385
4599
  registerInstance(this, hostRef);
4386
4600
  this.postBeforeShow = createEvent(this, "postBeforeShow");
@@ -4442,7 +4656,7 @@ const PostPopovercontainer = class {
4442
4656
  if (this.toggleTimeoutId || !target)
4443
4657
  return;
4444
4658
  this.eventTarget = target;
4445
- this.calculatePosition();
4659
+ this.updatePosition();
4446
4660
  this.host.showPopover();
4447
4661
  }
4448
4662
  /**
@@ -4468,7 +4682,7 @@ const PostPopovercontainer = class {
4468
4682
  this.eventTarget = target;
4469
4683
  // Prevent instant double toggle
4470
4684
  if (!this.toggleTimeoutId) {
4471
- this.calculatePosition();
4685
+ this.updatePosition();
4472
4686
  this.host.togglePopover(force);
4473
4687
  this.toggleTimeoutId = null;
4474
4688
  }
@@ -4580,17 +4794,14 @@ const PostPopovercontainer = class {
4580
4794
  startAutoupdates() {
4581
4795
  if (!this.eventTarget || !this.host)
4582
4796
  return;
4583
- this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
4584
- }
4585
- /**
4586
- * Retrieves the dynamic height of the header
4587
- */
4588
- getHeaderHeight() {
4589
- const header = document.querySelector('post-header');
4590
- return header ? Number.parseFloat(getComputedStyle(header).height) : 0;
4797
+ this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.updatePosition.bind(this));
4591
4798
  }
4592
- async calculatePosition() {
4593
- const { x, y, middlewareData, placement } = await this.computeMainPosition();
4799
+ async updatePosition() {
4800
+ const { x, y, middlewareData, placement } = await this.calculatePosition();
4801
+ // Hide the popover if the target is outside the viewport
4802
+ if (middlewareData.hide?.referenceHidden) {
4803
+ this.host.hidePopover();
4804
+ }
4594
4805
  const currentPlacement = placement.split('-')[0];
4595
4806
  this.dynamicPlacement = currentPlacement;
4596
4807
  // Position popover
@@ -4615,13 +4826,15 @@ const PostPopovercontainer = class {
4615
4826
  await this.updateSafeSpaceBoundaries(currentPlacement);
4616
4827
  }
4617
4828
  }
4618
- async computeMainPosition() {
4829
+ async calculatePosition() {
4619
4830
  const gap = this.edgeGap;
4620
4831
  const isAligned = (this.placement || 'top').includes('-');
4621
- const flipMiddleware = flip({
4622
- padding: this.getHeaderHeight(),
4623
- crossAxis: false,
4624
- });
4832
+ const flipMiddleware = [
4833
+ // Flip the popover if the target moves outside the viewport
4834
+ flip({ elementContext: 'reference', crossAxis: false }),
4835
+ // Flip the popover if the popover itself moves outside the viewport
4836
+ flip({ elementContext: 'floating', crossAxis: false }),
4837
+ ];
4625
4838
  const shiftMiddleware = shift({
4626
4839
  padding: gap,
4627
4840
  limiter: limitShift({
@@ -4633,7 +4846,7 @@ const PostPopovercontainer = class {
4633
4846
  inline(),
4634
4847
  // Per floating-ui docs: for aligned placements (e.g. bottom-end),
4635
4848
  // flip should come before shift. For non-aligned, shift before flip.
4636
- ...(isAligned ? [flipMiddleware, shiftMiddleware] : [shiftMiddleware, flipMiddleware]),
4849
+ ...(isAligned ? [...flipMiddleware, shiftMiddleware] : [shiftMiddleware, ...flipMiddleware]),
4637
4850
  size({
4638
4851
  apply({ availableWidth, elements }) {
4639
4852
  Object.assign(elements.floating.style, {
@@ -4645,7 +4858,12 @@ const PostPopovercontainer = class {
4645
4858
  if (this.arrow) {
4646
4859
  middleware.push(arrow({ element: this.arrowRef, padding: gap }));
4647
4860
  }
4648
- return computePosition(this.eventTarget, this.host, {
4861
+ // Automatically hide the popover if the target moves outside the scrollport.
4862
+ if (this.autoHide) {
4863
+ // Per floating-ui docs: hide should generally be placed at the end.
4864
+ middleware.push(hide({ strategy: 'referenceHidden' }));
4865
+ }
4866
+ return computePositionWithSafeArea(this.eventTarget, this.host, {
4649
4867
  placement: this.placement || 'top',
4650
4868
  strategy: 'fixed',
4651
4869
  middleware,
@@ -4712,32 +4930,12 @@ const PostPopovercontainer = class {
4712
4930
  }
4713
4931
  }
4714
4932
  render() {
4715
- return (h(Host, { key: 'bffef7c8067f21aa99c45deaaf2bc122ea455191', "data-version": version, popover: "auto" }, h("div", { key: '023339edd5b36827e0051179bee464236bccc62a', part: "post-popovercontainer-content", class: "popover-content" }, this.arrow && (h("span", { key: 'ae921c38aa8c33ad8b37453a56d22ee7b4b9950c', "dynamic-placement": this.dynamicPlacement, class: "arrow", ref: el => {
4933
+ return (h(Host, { key: 'f3ea4bfc9a59faa2fbf1e413a1ec648f598a6779', "data-version": version, popover: "auto" }, h("div", { key: 'a328c73c7e08eca1e423fcbe736798188cca2a87', part: "post-popovercontainer-content", class: "popover-content" }, this.arrow && (h("span", { key: '8fad0095fb8d8c903ba84a639b4efc3e321c6aef', "dynamic-placement": this.dynamicPlacement, class: "arrow", ref: el => {
4716
4934
  this.arrowRef = el;
4717
- } })), h("span", { key: 'f7c2720a3bedb808855628482c5b1f377e2719a8', part: "post-popovercontainer-border-mask" }), h("slot", { key: 'e0fee3fded9fea41bc0260f45be0375e236463f9' }))));
4935
+ } })), h("span", { key: 'deadbcc5892ed545a64b4a0e5e0936e0dd1feb70', part: "post-popovercontainer-border-mask" }), h("slot", { key: '48c4db7ab222f3ef18157ce19d8ba15d75441f98' }))));
4718
4936
  }
4719
4937
  get host() { return getElement(this); }
4720
4938
  };
4721
- PostPopovercontainer.STATIC_SIDES = {
4722
- top: 'bottom',
4723
- right: 'left',
4724
- bottom: 'top',
4725
- left: 'right',
4726
- };
4727
- PostPopovercontainer.PROPERTIES_TO_CLEAR = [
4728
- '--post-safe-space-popover-x',
4729
- '--post-safe-space-popover-y',
4730
- '--post-safe-space-popover-x-start',
4731
- '--post-safe-space-popover-x-end',
4732
- '--post-safe-space-popover-y-start',
4733
- '--post-safe-space-popover-y-end',
4734
- '--post-safe-space-trigger-x',
4735
- '--post-safe-space-trigger-y',
4736
- '--post-safe-space-trigger-x-start',
4737
- '--post-safe-space-trigger-x-end',
4738
- '--post-safe-space-trigger-y-start',
4739
- '--post-safe-space-trigger-y-end',
4740
- ];
4741
4939
  __decorate([
4742
4940
  OneOf(PLACEMENT_TYPES)
4743
4941
  ], PostPopovercontainer.prototype, "placement", void 0);
@@ -4778,7 +4976,7 @@ const PostTogglebutton = class {
4778
4976
  });
4779
4977
  }
4780
4978
  render() {
4781
- return (h(Host, { key: '7b935b808aa1ebbe97ac37bed25bfc215513097f', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: 'd06f112049850f8d7bdffd5e0b70440bae41010b' })));
4979
+ return (h(Host, { key: '81fa9d922480059096e4146c10cf2ef72357b482', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '4e8d793e3867ba4c9c8e17d509652309a79f032a' })));
4782
4980
  }
4783
4981
  get host() { return getElement(this); }
4784
4982
  };