@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.
- package/README.md +2 -2
- package/dist/cjs/breakpoints-Kruvy8Dm.js +47 -0
- package/dist/cjs/{create-validator-decorator-BtgLWaMJ.js → create-validator-decorator-Cy5yN6u9.js} +1 -1
- package/dist/cjs/{event-from-CwMw19f8.js → event-from-CTcQxB9-.js} +19 -13
- package/dist/cjs/{index-CW10QvjR.js → index-B3PXzvDk.js} +1 -1
- package/dist/cjs/{breakpoints-B0Olgvgc.js → index-CggFmZ8n.js} +0 -42
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{one-of-vJeW7S4_.js → one-of-CRFrfihj.js} +1 -1
- package/dist/cjs/{package-CL8OSAS4.js → package-pKyFPwiA.js} +1 -1
- package/dist/cjs/{pattern-Zmn3wpyp.js → pattern-D329DFcf.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +7 -7
- package/dist/cjs/post-autocomplete.cjs.entry.js +70 -55
- package/dist/cjs/post-avatar.cjs.entry.js +7 -7
- package/dist/cjs/post-back-to-top.cjs.entry.js +25 -13
- package/dist/cjs/post-banner.cjs.entry.js +6 -13
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +42 -12
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +222 -71
- package/dist/cjs/post-closebutton_14.cjs.entry.js +431 -233
- package/dist/cjs/post-collapsible_2.cjs.entry.js +9 -9
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +18 -16
- package/dist/cjs/post-footer.cjs.entry.js +8 -8
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
- package/dist/cjs/post-listbox.cjs.entry.js +6 -6
- package/dist/cjs/post-number-input.cjs.entry.js +7 -6
- package/dist/cjs/post-pagination.cjs.entry.js +6 -6
- package/dist/cjs/post-popover-trigger.cjs.entry.js +8 -8
- package/dist/cjs/post-popover.cjs.entry.js +11 -11
- package/dist/cjs/post-progressbar.cjs.entry.js +5 -5
- package/dist/cjs/post-rating.cjs.entry.js +7 -7
- package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +8 -8
- package/dist/cjs/post-side-navigation.cjs.entry.js +9 -9
- package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
- package/dist/cjs/post-stepper.cjs.entry.js +8 -8
- package/dist/cjs/post-tab-item.cjs.entry.js +7 -7
- package/dist/cjs/post-tab-panel.cjs.entry.js +7 -7
- package/dist/cjs/post-tabs.cjs.entry.js +9 -9
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +8 -8
- package/dist/cjs/post-tooltip.cjs.entry.js +6 -6
- package/dist/cjs/{required-DRnPokVn.js → required-DhAEd0c7.js} +1 -1
- package/dist/cjs/{type-CNcU_-B2.js → type-2Ma9dvHs.js} +1 -1
- package/dist/cjs/{url-DgJ3lXQz.js → url-DePscsTj.js} +1 -1
- package/dist/collection/components/post-autocomplete/post-autocomplete.js +65 -50
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +19 -7
- package/dist/collection/components/post-banner/post-banner.js +2 -17
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +59 -4
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +249 -71
- package/dist/collection/components/post-closebutton/post-closebutton.js +7 -8
- package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +2 -2
- package/dist/collection/components/post-date-picker/native-mask-element.js +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.js +11 -9
- package/dist/collection/components/post-footer/post-footer.js +2 -2
- package/dist/collection/components/post-header/post-header.js +2 -2
- package/dist/collection/components/post-icon/post-icon.js +1 -1
- package/dist/collection/components/post-language-menu/post-language-menu.js +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
- package/dist/collection/components/post-listbox/post-listbox.js +2 -2
- package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
- package/dist/collection/components/post-logo/post-logo.js +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +3 -3
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
- package/dist/collection/components/post-menu/post-menu.js +23 -8
- package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
- package/dist/collection/components/post-number-input/post-number-input.js +2 -2
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +4 -4
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +3 -3
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +71 -43
- package/dist/collection/components/post-progressbar/post-progressbar.js +1 -1
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.js +1 -1
- package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js +1 -1
- package/dist/collection/components/post-stepper/post-stepper.js +1 -1
- package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
- package/dist/collection/components/post-tab-item/post-tab-item.js +2 -2
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +2 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +2 -2
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +2 -2
- package/dist/collection/utils/breakpoints.js +11 -9
- package/dist/collection/utils/closable-target.js +38 -0
- package/dist/collection/utils/event-from.js +18 -13
- package/dist/collection/utils/floating-ui.js +72 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/components/breakpoints.js +1 -1
- package/dist/components/event-from.js +1 -1
- package/dist/components/index2.js +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-autocomplete.js +1 -1
- package/dist/components/post-back-to-top.js +1 -1
- package/dist/components/post-banner.js +1 -1
- package/dist/components/post-breadcrumb-item.js +1 -1
- package/dist/components/post-breadcrumbs.js +1 -1
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-collapsible-trigger2.js +1 -1
- package/dist/components/post-collapsible2.js +1 -1
- package/dist/components/post-date-picker.js +1 -1
- package/dist/components/post-footer.js +1 -1
- package/dist/components/post-header.js +1 -1
- package/dist/components/post-icon2.js +1 -1
- package/dist/components/post-linkarea.js +1 -1
- package/dist/components/post-listbox-option.js +1 -1
- package/dist/components/post-listbox.js +1 -1
- package/dist/components/post-logo.js +1 -1
- package/dist/components/post-mainnavigation.js +1 -1
- package/dist/components/post-megadropdown-trigger.js +1 -1
- package/dist/components/post-megadropdown.js +1 -1
- package/dist/components/post-menu-item2.js +1 -1
- package/dist/components/post-menu-trigger2.js +1 -1
- package/dist/components/post-menu2.js +1 -1
- package/dist/components/post-number-input.js +1 -1
- package/dist/components/post-popover-trigger.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-popovercontainer2.js +1 -1
- package/dist/components/post-progressbar.js +1 -1
- package/dist/components/post-rating.js +1 -1
- package/dist/components/post-side-navigation-trigger.js +1 -1
- package/dist/components/post-side-navigation.js +1 -1
- package/dist/components/post-stepper-item.js +1 -1
- package/dist/components/post-stepper.js +1 -1
- package/dist/components/post-tab-item.js +1 -1
- package/dist/components/post-tab-panel.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/post-togglebutton2.js +1 -1
- package/dist/components/post-tooltip-trigger.js +1 -1
- package/dist/components/post-tooltip.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/{p-Bwko4UKh.js → p-3RU9XwVO.js} +1 -1
- package/dist/components/react/p-5LuCes5o.js +1 -0
- package/dist/components/react/p-B1TcktiB.js +1 -0
- package/dist/components/react/{p-4wtxqxXu.js → p-B2jsM_Ov.js} +1 -1
- package/dist/components/react/p-BEcxHjuM.js +1 -0
- package/dist/components/react/p-BN2dfUQ0.js +1 -0
- package/dist/components/react/p-BPUhha1U.js +1 -0
- package/dist/{post-components/p-C-lLRsYC.js → components/react/p-BdLRXQqY.js} +1 -1
- package/dist/components/react/{p-BSb74xQy.js → p-Bnb_TyDh.js} +1 -1
- package/dist/components/react/p-CVVXnYLU.js +1 -0
- package/dist/components/react/{p-9RCG8BWM.js → p-CcDLIogT.js} +1 -1
- package/dist/components/react/{p-CSmrQ__L.js → p-CdggfEzz.js} +1 -1
- package/dist/components/react/p-CnN4Jdtv.js +1 -0
- package/dist/components/react/{p-D-imniYA.js → p-CzsG0uCA.js} +1 -1
- package/dist/components/react/p-DeO0rZ1T.js +1 -0
- package/dist/components/react/p-DffT6evQ.js +1 -0
- package/dist/components/react/p-T8T3po4z.js +1 -0
- package/dist/components/react/p-WXzzOdnl.js +1 -0
- package/dist/components/react/p-bR8vy6-s.js +1 -0
- package/dist/components/react/{p-B1kYo1K9.js → p-m1-sOx5T.js} +1 -1
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-autocomplete.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +1 -1
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +1 -1
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-date-picker.js +1 -1
- package/dist/components/react/post-footer.js +1 -1
- package/dist/components/react/post-header.js +1 -1
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-menu-item.js +1 -1
- package/dist/components/react/post-language-menu.js +1 -1
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-listbox-option.js +1 -1
- package/dist/components/react/post-listbox.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +1 -1
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +1 -1
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-number-input.js +1 -1
- package/dist/components/react/post-pagination.js +1 -1
- package/dist/components/react/post-popover-trigger.js +1 -1
- package/dist/components/react/post-popover.js +1 -1
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-progressbar.js +1 -1
- package/dist/components/react/post-rating.js +1 -1
- package/dist/components/react/post-side-navigation-trigger.js +1 -1
- package/dist/components/react/post-side-navigation.js +1 -1
- package/dist/components/react/post-stepper-item.js +1 -1
- package/dist/components/react/post-stepper.js +1 -1
- package/dist/components/react/post-tab-item.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +1 -1
- package/dist/docs.json +118 -27
- package/dist/esm/breakpoints-I1j7a0bW.js +45 -0
- package/dist/esm/{create-validator-decorator-CNUaQboh.js → create-validator-decorator-C2XlYkNB.js} +1 -1
- package/dist/esm/{event-from-rEfV4v4a.js → event-from-BEcxHjuM.js} +19 -14
- package/dist/esm/{index-sn7oKSwC.js → index-BjziJWh2.js} +1 -1
- package/dist/esm/{breakpoints-BQ3HlJPr.js → index-bR8vy6-s.js} +1 -42
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{one-of-C6Ironyj.js → one-of-Do1iao-k.js} +1 -1
- package/dist/esm/{package-tTf1w3A9.js → package-T8T3po4z.js} +1 -1
- package/dist/esm/{pattern-57oD--q3.js → pattern-BZDucOTq.js} +1 -1
- package/dist/esm/post-accordion_2.entry.js +7 -7
- package/dist/esm/post-autocomplete.entry.js +70 -55
- package/dist/esm/post-avatar.entry.js +7 -7
- package/dist/esm/post-back-to-top.entry.js +25 -13
- package/dist/esm/post-banner.entry.js +6 -13
- package/dist/esm/post-breadcrumb-item.entry.js +42 -12
- package/dist/esm/post-breadcrumbs.entry.js +222 -71
- package/dist/esm/post-closebutton_14.entry.js +430 -232
- package/dist/esm/post-collapsible_2.entry.js +9 -9
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +18 -16
- package/dist/esm/post-footer.entry.js +8 -8
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/post-listbox-option.entry.js +4 -4
- package/dist/esm/post-listbox.entry.js +6 -6
- package/dist/esm/post-number-input.entry.js +6 -5
- package/dist/esm/post-pagination.entry.js +6 -6
- package/dist/esm/post-popover-trigger.entry.js +8 -8
- package/dist/esm/post-popover.entry.js +11 -11
- package/dist/esm/post-progressbar.entry.js +5 -5
- package/dist/esm/post-rating.entry.js +7 -7
- package/dist/esm/post-side-navigation-trigger.entry.js +8 -8
- package/dist/esm/post-side-navigation.entry.js +9 -9
- package/dist/esm/post-stepper-item.entry.js +3 -3
- package/dist/esm/post-stepper.entry.js +8 -8
- package/dist/esm/post-tab-item.entry.js +7 -7
- package/dist/esm/post-tab-panel.entry.js +7 -7
- package/dist/esm/post-tabs.entry.js +9 -9
- package/dist/esm/post-tooltip-trigger.entry.js +8 -8
- package/dist/esm/post-tooltip.entry.js +6 -6
- package/dist/esm/{required-D2rl2XZJ.js → required-B0X7uy13.js} +1 -1
- package/dist/esm/{type-CGynDrfh.js → type-CF1dOg6D.js} +1 -1
- package/dist/esm/{url-1wyUfUv-.js → url-BL7d6iWZ.js} +1 -1
- package/dist/post-components/{p-167191e5.entry.js → p-0e922531.entry.js} +1 -1
- package/dist/post-components/{p-cf6eacab.entry.js → p-1ec27142.entry.js} +1 -1
- package/dist/post-components/{p-da217dbc.entry.js → p-2005eb98.entry.js} +1 -1
- package/dist/post-components/p-2cff5b3a.entry.js +1 -0
- package/dist/post-components/p-53bd2128.entry.js +1 -0
- package/dist/post-components/{p-212c71e4.entry.js → p-59b30e90.entry.js} +1 -1
- package/dist/post-components/{p-beed9922.entry.js → p-60550edb.entry.js} +1 -1
- package/dist/post-components/p-655ded00.entry.js +1 -0
- package/dist/post-components/p-76cc3c9a.entry.js +1 -0
- package/dist/post-components/{p-3149d866.entry.js → p-8012cc3b.entry.js} +1 -1
- package/dist/post-components/p-819c93de.entry.js +1 -0
- package/dist/post-components/p-840acd3c.entry.js +1 -0
- package/dist/post-components/p-87b1034f.entry.js +1 -0
- package/dist/post-components/p-88f754e9.entry.js +1 -0
- package/dist/post-components/p-9S_5_Zh8.js +1 -0
- package/dist/post-components/p-BEcxHjuM.js +1 -0
- package/dist/post-components/p-BYfu3J2D.js +1 -0
- package/dist/post-components/p-BjziJWh2.js +2 -0
- package/dist/post-components/p-BoYe-VVx.js +1 -0
- package/dist/post-components/p-CbbADNiv.js +1 -0
- package/dist/post-components/p-DgnQe03V.js +1 -0
- package/dist/post-components/p-DlKbBdcP.js +1 -0
- package/dist/post-components/p-I1j7a0bW.js +1 -0
- package/dist/post-components/p-T8T3po4z.js +1 -0
- package/dist/post-components/{p-a01ea634.entry.js → p-a32d3050.entry.js} +1 -1
- package/dist/post-components/p-b4229624.entry.js +1 -0
- package/dist/post-components/{p-96bf6b01.entry.js → p-b9faa76b.entry.js} +1 -1
- package/dist/post-components/p-bR8vy6-s.js +1 -0
- package/dist/post-components/{p-70fbe469.entry.js → p-ba1b4ba0.entry.js} +1 -1
- package/dist/post-components/p-c0ae13b7.entry.js +1 -0
- package/dist/post-components/p-c9dcdebb.entry.js +1 -0
- package/dist/post-components/p-ccf8020b.entry.js +1 -0
- package/dist/post-components/p-cd68d3a2.entry.js +1 -0
- package/dist/post-components/p-cdc7b8d3.entry.js +1 -0
- package/dist/post-components/{p-1cf5bc67.entry.js → p-d7c9a969.entry.js} +1 -1
- package/dist/post-components/p-db11f781.entry.js +1 -0
- package/dist/post-components/{p-0323b0f3.entry.js → p-dc285087.entry.js} +1 -1
- package/dist/post-components/{p-e8d9723e.entry.js → p-de6f1816.entry.js} +1 -1
- package/dist/post-components/p-dec8bd99.entry.js +1 -0
- package/dist/post-components/p-f9a8ee94.entry.js +1 -0
- package/dist/post-components/post-components.css +2 -2
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-autocomplete/post-autocomplete.d.ts +18 -6
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +2 -1
- package/dist/types/components/post-banner/post-banner.d.ts +0 -1
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +12 -1
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +54 -14
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +1 -1
- package/dist/types/components/post-menu/post-menu.d.ts +1 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +8 -5
- package/dist/types/components.d.ts +38 -7
- package/dist/types/utils/breakpoints.d.ts +1 -0
- package/dist/types/utils/closable-target.d.ts +5 -0
- package/dist/types/utils/event-from.d.ts +8 -0
- package/dist/types/utils/floating-ui.d.ts +12 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/hydrate/index.js +1085 -665
- package/hydrate/index.mjs +1085 -665
- package/package.json +31 -22
- package/dist/components/react/p-BXqGI600.js +0 -1
- package/dist/components/react/p-B_WnO-QF.js +0 -1
- package/dist/components/react/p-BaB8wJvk.js +0 -1
- package/dist/components/react/p-Bji_4dfL.js +0 -1
- package/dist/components/react/p-CX2E_IXB.js +0 -1
- package/dist/components/react/p-CwmQwirr.js +0 -1
- package/dist/components/react/p-D17tCsFk.js +0 -1
- package/dist/components/react/p-DD1c_IgL.js +0 -1
- package/dist/components/react/p-Df31eVdi.js +0 -1
- package/dist/components/react/p-I0dqoE80.js +0 -1
- package/dist/components/react/p-rEfV4v4a.js +0 -1
- package/dist/components/react/p-tTf1w3A9.js +0 -1
- package/dist/post-components/p-06ddd73b.entry.js +0 -1
- package/dist/post-components/p-090e52db.entry.js +0 -1
- package/dist/post-components/p-292a9784.entry.js +0 -1
- package/dist/post-components/p-2de6fe62.entry.js +0 -1
- package/dist/post-components/p-39ff8127.entry.js +0 -1
- package/dist/post-components/p-3a968b19.entry.js +0 -1
- package/dist/post-components/p-472_tiaS.js +0 -1
- package/dist/post-components/p-58422de1.entry.js +0 -1
- package/dist/post-components/p-5873a90c.entry.js +0 -1
- package/dist/post-components/p-986fa1c1.entry.js +0 -1
- package/dist/post-components/p-BQ3HlJPr.js +0 -1
- package/dist/post-components/p-B_FOhVrp.js +0 -1
- package/dist/post-components/p-CeNqFJV7.js +0 -1
- package/dist/post-components/p-DYDdaLz-.js +0 -1
- package/dist/post-components/p-DoNhJ2D7.js +0 -1
- package/dist/post-components/p-b1d2384a.entry.js +0 -1
- package/dist/post-components/p-b535fc10.entry.js +0 -1
- package/dist/post-components/p-b99e6621.entry.js +0 -1
- package/dist/post-components/p-bf83a3fb.entry.js +0 -1
- package/dist/post-components/p-c46bc56f.entry.js +0 -1
- package/dist/post-components/p-ce8132a9.entry.js +0 -1
- package/dist/post-components/p-d72e830b.entry.js +0 -1
- package/dist/post-components/p-e08d26f4.entry.js +0 -1
- package/dist/post-components/p-rEfV4v4a.js +0 -1
- package/dist/post-components/p-sn7oKSwC.js +0 -2
- package/dist/post-components/p-tTf1w3A9.js +0 -1
|
@@ -12,10 +12,11 @@ import { Build, h, Host, } from "@stencil/core";
|
|
|
12
12
|
import { OneOf, Type } from "../../utils/index";
|
|
13
13
|
import { version } from "../../../../package";
|
|
14
14
|
import { PLACEMENT_TYPES } from "../../types/index";
|
|
15
|
-
import { arrow, autoUpdate,
|
|
15
|
+
import { arrow, autoUpdate, flip, hide, inline, limitShift, offset, shift, size, } from "@floating-ui/dom";
|
|
16
16
|
// Polyfill for popovers, can be removed when https://caniuse.com/?search=popover is green
|
|
17
17
|
import { popIn } from "../../animations/pop-in";
|
|
18
18
|
import { apply, isSupported } from "@oddbird/popover-polyfill/fn";
|
|
19
|
+
import { computePositionWithSafeArea } from "../../utils/floating-ui";
|
|
19
20
|
const ANIMATIONS = {
|
|
20
21
|
'pop-in': popIn,
|
|
21
22
|
};
|
|
@@ -23,6 +24,30 @@ const ANIMATIONS = {
|
|
|
23
24
|
* @slot - Default slot for placing content inside the popovercontainer.
|
|
24
25
|
*/
|
|
25
26
|
export class PostPopovercontainer {
|
|
27
|
+
static {
|
|
28
|
+
this.STATIC_SIDES = {
|
|
29
|
+
top: 'bottom',
|
|
30
|
+
right: 'left',
|
|
31
|
+
bottom: 'top',
|
|
32
|
+
left: 'right',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.PROPERTIES_TO_CLEAR = [
|
|
37
|
+
'--post-safe-space-popover-x',
|
|
38
|
+
'--post-safe-space-popover-y',
|
|
39
|
+
'--post-safe-space-popover-x-start',
|
|
40
|
+
'--post-safe-space-popover-x-end',
|
|
41
|
+
'--post-safe-space-popover-y-start',
|
|
42
|
+
'--post-safe-space-popover-y-end',
|
|
43
|
+
'--post-safe-space-trigger-x',
|
|
44
|
+
'--post-safe-space-trigger-y',
|
|
45
|
+
'--post-safe-space-trigger-x-start',
|
|
46
|
+
'--post-safe-space-trigger-x-end',
|
|
47
|
+
'--post-safe-space-trigger-y-start',
|
|
48
|
+
'--post-safe-space-trigger-y-end',
|
|
49
|
+
];
|
|
50
|
+
}
|
|
26
51
|
constructor() {
|
|
27
52
|
this.toggleTimeoutId = null;
|
|
28
53
|
this.hasOpenedOnce = true;
|
|
@@ -78,7 +103,7 @@ export class PostPopovercontainer {
|
|
|
78
103
|
if (this.toggleTimeoutId || !target)
|
|
79
104
|
return;
|
|
80
105
|
this.eventTarget = target;
|
|
81
|
-
this.
|
|
106
|
+
this.updatePosition();
|
|
82
107
|
this.host.showPopover();
|
|
83
108
|
}
|
|
84
109
|
/**
|
|
@@ -104,7 +129,7 @@ export class PostPopovercontainer {
|
|
|
104
129
|
this.eventTarget = target;
|
|
105
130
|
// Prevent instant double toggle
|
|
106
131
|
if (!this.toggleTimeoutId) {
|
|
107
|
-
this.
|
|
132
|
+
this.updatePosition();
|
|
108
133
|
this.host.togglePopover(force);
|
|
109
134
|
this.toggleTimeoutId = null;
|
|
110
135
|
}
|
|
@@ -216,17 +241,14 @@ export class PostPopovercontainer {
|
|
|
216
241
|
startAutoupdates() {
|
|
217
242
|
if (!this.eventTarget || !this.host)
|
|
218
243
|
return;
|
|
219
|
-
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.
|
|
244
|
+
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.updatePosition.bind(this));
|
|
220
245
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
async calculatePosition() {
|
|
229
|
-
const { x, y, middlewareData, placement } = await this.computeMainPosition();
|
|
246
|
+
async updatePosition() {
|
|
247
|
+
const { x, y, middlewareData, placement } = await this.calculatePosition();
|
|
248
|
+
// Hide the popover if the target is outside the viewport
|
|
249
|
+
if (middlewareData.hide?.referenceHidden) {
|
|
250
|
+
this.host.hidePopover();
|
|
251
|
+
}
|
|
230
252
|
const currentPlacement = placement.split('-')[0];
|
|
231
253
|
this.dynamicPlacement = currentPlacement;
|
|
232
254
|
// Position popover
|
|
@@ -251,13 +273,15 @@ export class PostPopovercontainer {
|
|
|
251
273
|
await this.updateSafeSpaceBoundaries(currentPlacement);
|
|
252
274
|
}
|
|
253
275
|
}
|
|
254
|
-
async
|
|
276
|
+
async calculatePosition() {
|
|
255
277
|
const gap = this.edgeGap;
|
|
256
278
|
const isAligned = (this.placement || 'top').includes('-');
|
|
257
|
-
const flipMiddleware =
|
|
258
|
-
|
|
259
|
-
crossAxis: false,
|
|
260
|
-
|
|
279
|
+
const flipMiddleware = [
|
|
280
|
+
// Flip the popover if the target moves outside the viewport
|
|
281
|
+
flip({ elementContext: 'reference', crossAxis: false }),
|
|
282
|
+
// Flip the popover if the popover itself moves outside the viewport
|
|
283
|
+
flip({ elementContext: 'floating', crossAxis: false }),
|
|
284
|
+
];
|
|
261
285
|
const shiftMiddleware = shift({
|
|
262
286
|
padding: gap,
|
|
263
287
|
limiter: limitShift({
|
|
@@ -269,7 +293,7 @@ export class PostPopovercontainer {
|
|
|
269
293
|
inline(),
|
|
270
294
|
// Per floating-ui docs: for aligned placements (e.g. bottom-end),
|
|
271
295
|
// flip should come before shift. For non-aligned, shift before flip.
|
|
272
|
-
...(isAligned ? [flipMiddleware, shiftMiddleware] : [shiftMiddleware, flipMiddleware]),
|
|
296
|
+
...(isAligned ? [...flipMiddleware, shiftMiddleware] : [shiftMiddleware, ...flipMiddleware]),
|
|
273
297
|
size({
|
|
274
298
|
apply({ availableWidth, elements }) {
|
|
275
299
|
Object.assign(elements.floating.style, {
|
|
@@ -281,7 +305,12 @@ export class PostPopovercontainer {
|
|
|
281
305
|
if (this.arrow) {
|
|
282
306
|
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
283
307
|
}
|
|
284
|
-
|
|
308
|
+
// Automatically hide the popover if the target moves outside the scrollport.
|
|
309
|
+
if (this.autoHide) {
|
|
310
|
+
// Per floating-ui docs: hide should generally be placed at the end.
|
|
311
|
+
middleware.push(hide({ strategy: 'referenceHidden' }));
|
|
312
|
+
}
|
|
313
|
+
return computePositionWithSafeArea(this.eventTarget, this.host, {
|
|
285
314
|
placement: this.placement || 'top',
|
|
286
315
|
strategy: 'fixed',
|
|
287
316
|
middleware,
|
|
@@ -348,9 +377,9 @@ export class PostPopovercontainer {
|
|
|
348
377
|
}
|
|
349
378
|
}
|
|
350
379
|
render() {
|
|
351
|
-
return (h(Host, { key: '
|
|
380
|
+
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 => {
|
|
352
381
|
this.arrowRef = el;
|
|
353
|
-
} })), h("span", { key: '
|
|
382
|
+
} })), h("span", { key: 'deadbcc5892ed545a64b4a0e5e0936e0dd1feb70', part: "post-popovercontainer-border-mask" }), h("slot", { key: '48c4db7ab222f3ef18157ce19d8ba15d75441f98' }))));
|
|
354
383
|
}
|
|
355
384
|
static get is() { return "post-popovercontainer"; }
|
|
356
385
|
static get encapsulation() { return "shadow"; }
|
|
@@ -376,7 +405,7 @@ export class PostPopovercontainer {
|
|
|
376
405
|
"Placement": {
|
|
377
406
|
"location": "import",
|
|
378
407
|
"path": "@floating-ui/dom",
|
|
379
|
-
"id": "../../node_modules/.pnpm/@floating-ui+dom@1.
|
|
408
|
+
"id": "../../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts::Placement",
|
|
380
409
|
"referenceLocation": "Placement"
|
|
381
410
|
}
|
|
382
411
|
}
|
|
@@ -470,6 +499,25 @@ export class PostPopovercontainer {
|
|
|
470
499
|
"setter": false,
|
|
471
500
|
"reflect": true,
|
|
472
501
|
"attribute": "safe-space"
|
|
502
|
+
},
|
|
503
|
+
"autoHide": {
|
|
504
|
+
"type": "boolean",
|
|
505
|
+
"mutable": false,
|
|
506
|
+
"complexType": {
|
|
507
|
+
"original": "boolean",
|
|
508
|
+
"resolved": "boolean",
|
|
509
|
+
"references": {}
|
|
510
|
+
},
|
|
511
|
+
"required": false,
|
|
512
|
+
"optional": true,
|
|
513
|
+
"docs": {
|
|
514
|
+
"tags": [],
|
|
515
|
+
"text": "Whether to automatically hide the popover when the target moves outside the scrollport.\n\nIf the `post-header` can cover the target, the popover will also be hidden as soon as the\ntarget scrolls behind it."
|
|
516
|
+
},
|
|
517
|
+
"getter": false,
|
|
518
|
+
"setter": false,
|
|
519
|
+
"reflect": false,
|
|
520
|
+
"attribute": "auto-hide"
|
|
473
521
|
}
|
|
474
522
|
};
|
|
475
523
|
}
|
|
@@ -642,26 +690,6 @@ export class PostPopovercontainer {
|
|
|
642
690
|
}
|
|
643
691
|
static get elementRef() { return "host"; }
|
|
644
692
|
}
|
|
645
|
-
PostPopovercontainer.STATIC_SIDES = {
|
|
646
|
-
top: 'bottom',
|
|
647
|
-
right: 'left',
|
|
648
|
-
bottom: 'top',
|
|
649
|
-
left: 'right',
|
|
650
|
-
};
|
|
651
|
-
PostPopovercontainer.PROPERTIES_TO_CLEAR = [
|
|
652
|
-
'--post-safe-space-popover-x',
|
|
653
|
-
'--post-safe-space-popover-y',
|
|
654
|
-
'--post-safe-space-popover-x-start',
|
|
655
|
-
'--post-safe-space-popover-x-end',
|
|
656
|
-
'--post-safe-space-popover-y-start',
|
|
657
|
-
'--post-safe-space-popover-y-end',
|
|
658
|
-
'--post-safe-space-trigger-x',
|
|
659
|
-
'--post-safe-space-trigger-y',
|
|
660
|
-
'--post-safe-space-trigger-x-start',
|
|
661
|
-
'--post-safe-space-trigger-x-end',
|
|
662
|
-
'--post-safe-space-trigger-y-start',
|
|
663
|
-
'--post-safe-space-trigger-y-end',
|
|
664
|
-
];
|
|
665
693
|
__decorate([
|
|
666
694
|
OneOf(PLACEMENT_TYPES)
|
|
667
695
|
], PostPopovercontainer.prototype, "placement", void 0);
|
|
@@ -43,7 +43,7 @@ export class PostProgressbar {
|
|
|
43
43
|
const max = this.getEffectiveMax();
|
|
44
44
|
const value = this.getEffectiveValue(min, max);
|
|
45
45
|
const percentage = ((value - min) / (max - min)) * 100;
|
|
46
|
-
return (h(Host, { key: '
|
|
46
|
+
return (h(Host, { key: 'c29b1fa3dca89d999c2a55bd58c9c7450ed767c6', role: "progressbar", "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max }, h("div", { key: 'aaff038be7bdaf99de1e94c7479c2b57947195ac', class: "progress-value", style: { '--post-progressbar-value': `${percentage}%` } })));
|
|
47
47
|
}
|
|
48
48
|
static get is() { return "post-progressbar"; }
|
|
49
49
|
static get encapsulation() { return "shadow"; }
|
|
@@ -83,7 +83,7 @@ export class PostRating {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
|
-
return (h(Host, { key: '
|
|
86
|
+
return (h(Host, { key: '727813875ba5d754ec17f4a2b151c0c6cd4ab5ca', "data-version": version }, h("div", { key: '1ac7e5db0098568c16551a4850442e4c8f0e686b', role: "slider", class: "rating", tabindex: "0", "aria-label": this.label, "aria-valuemin": "0", "aria-valuemax": this.stars, "aria-valuenow": this.currentRating, "aria-valuetext": `${this.currentRating} / ${this.stars}`, "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.keydownHandler, onBlur: this.blurHandler }, Array.from({ length: this.stars }).map((v, i) => (h("div", { key: `star-${v}`, "aria-hidden": "true", class: {
|
|
87
87
|
'star': true,
|
|
88
88
|
'before-hover': i < this.hoveredIndex,
|
|
89
89
|
'active': i < Math.round(this.currentRating),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{
|
|
1
|
+
:host{display:flex}:host,:host dialog{background-color:var(--post-scheme-color-palette-bg-2);border-inline-end:var(--post-device-border-width-alternative1) solid var(--post-scheme-color-interactive-primary-enabled-stroke4)}:host dialog{overflow:visible;width:var(--post-core-dimension-296);bottom:auto;right:auto;border:none;padding:0;max-height:100dvh;transform:translateX(-100%);transition-property:transform,overlay,display;transition-behavior:allow-discrete;transition-duration:350ms;box-shadow:var(--post-device-elevation-300)}:host dialog[open]{transform:translateX(0)}@starting-style{:host dialog[open]{transform:translateX(-100%)}}@media(prefers-reduced-motion: reduce){:host dialog{transition:none}}:host post-closebutton{transform:translate(50%, 0)}
|
|
@@ -129,7 +129,7 @@ export class PostSideNavigation {
|
|
|
129
129
|
} }, h("slot", null), h("post-closebutton", { onClick: () => this.hide() }, this.textClose)));
|
|
130
130
|
}
|
|
131
131
|
render() {
|
|
132
|
-
return (h(Host, { key: '
|
|
132
|
+
return (h(Host, { key: 'f7d9b4e515e5085d78e452298bdfbfb2325e7422', "data-version": version }, this.device === 'desktop' ? this.renderNav() : this.renderDialog()));
|
|
133
133
|
}
|
|
134
134
|
static get is() { return "post-side-navigation"; }
|
|
135
135
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js
CHANGED
|
@@ -85,7 +85,7 @@ export class PostSideNavigationTrigger {
|
|
|
85
85
|
await this.sideNavigation?.toggle();
|
|
86
86
|
}
|
|
87
87
|
render() {
|
|
88
|
-
return (h(Host, { key: '
|
|
88
|
+
return (h(Host, { key: '1c908083562ec5ca01cd9410c72ac78ae11ce72f', "data-version": version }, h("slot", { key: '38f63424e8c66b4bf926418b57555dc676d24d45' })));
|
|
89
89
|
}
|
|
90
90
|
static get is() { return "post-side-navigation-trigger"; }
|
|
91
91
|
static get encapsulation() { return "shadow"; }
|
|
@@ -104,7 +104,7 @@ export class PostStepper {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
render() {
|
|
107
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'e6d1f0498cb3de68badef6428cfe8fdff73b879b', "data-version": version }, h("ol", { key: '4c10c32d36eaeeb19712f7d99dcba7d5337d89a1' }, h("slot", { key: 'ced502f01025f44c09747299cf60c82ebcd905da', onSlotchange: () => this.updateSteps() })), h("div", { key: '93cfc9fbd328d4a384c56ccf1f884053643f88e6', class: "active-step", "aria-hidden": "true" }, h("span", { key: '076fad4efc393852d024157011a0e86d90ecfe99', class: "active-step-label" }, this.mobileActiveStepLabel), h("span", { key: '814817862389cd55859aec49205fae255cbbf1d7', innerHTML: this.mobileActiveStepName }))));
|
|
108
108
|
}
|
|
109
109
|
static get is() { return "post-stepper"; }
|
|
110
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,7 +2,7 @@ import { version } from "../../../../package";
|
|
|
2
2
|
import { h, Host } from "@stencil/core";
|
|
3
3
|
export class PostStepperItem {
|
|
4
4
|
render() {
|
|
5
|
-
return (h(Host, { key: '
|
|
5
|
+
return (h(Host, { key: 'f41ae27d8de89912b3aa34d9c89f5ec69f3df301', "data-version": version, role: "listitem" }, h("span", { key: '00a0dd2eb3fb020e49c5782245e1f3e72c77e780', class: "stepper-item-content" }, h("span", { key: 'bc9932083d295b92db24ddd22cb18a755db5ad11', class: "step-hidden-label visually-hidden" }), h("span", { key: 'efe2d809c82c1d7de9e0cdf4e52b924943afa0bf', class: "label" }, h("slot", { key: '47aceca3fc331ef91da60674dbc2af5ea7e76ec8' })))));
|
|
6
6
|
}
|
|
7
7
|
static get is() { return "post-stepper-item"; }
|
|
8
8
|
static get encapsulation() { return "shadow"; }
|
|
@@ -44,9 +44,9 @@ export class PostTabItem {
|
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
46
|
const isSSR = Build.isServer;
|
|
47
|
-
return (h(Host, { key: '
|
|
47
|
+
return (h(Host, { key: '0c98772d01658e932be9982b6983eb3c1f0c4053', id: this.tabId, role: this.isPagesVariant ? undefined : 'tab', "data-version": version, "data-pages-variant": this.isPagesVariant.toString(), "aria-selected": this.isPagesVariant ? undefined : 'false', "aria-disabled": this.disabled ? 'true' : undefined, tabindex: this.isPagesVariant ? undefined : '-1', class: `${this.isPagesVariant ? 'nav-item' : 'tab-title'}${isSSR && !this.isPagesVariant ? ' ssr' : ''}`, style: isSSR && !this.isPagesVariant
|
|
48
48
|
? { '--active': `var(--post-tab-item-${this.name}, 0)` }
|
|
49
|
-
: undefined }, h("slot", { key: '
|
|
49
|
+
: undefined }, h("slot", { key: 'fba27566a1226e560161f839df050666763bdce5' })));
|
|
50
50
|
}
|
|
51
51
|
static get is() { return "post-tab-item"; }
|
|
52
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -21,7 +21,7 @@ export class PostTabPanel {
|
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
23
|
const isSSR = Build.isServer;
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '2b02063bf2e67f4e826155759f28a1ae47b0c8e0', "data-version": version, id: this.panelId, role: "tabpanel", slot: "panels", style: isSSR ? { display: `var(--post-tab-panel-${this.for}, none)` } : undefined }, h("slot", { key: 'b4c39e035d0f49f5654b030f4aada27fbebb122c' })));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "post-tab-panel"; }
|
|
27
27
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{display:block}:host .tabs-wrapper{position:relative;display:flex;align-items:center}:host .tabs-wrapper button.scroll-btn{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;display:flex;align-items:center;justify-content:center;transition:background-color 100ms,border-color 100ms,color 100ms;cursor:pointer}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn{background-color:ButtonFace !important}:host .tabs-wrapper button.scroll-btn:hover{background-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn post-icon{color:currentColor}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn post-icon{color:Highlight}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:hover post-icon{color:canvas}}:host .tabs-wrapper button.scroll-btn[hidden]{display:none}:host .tabs-wrapper button.scroll-btn{outline-offset:var(--post-device-spacing-padding-44) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .tabs-wrapper .tabs{overflow-x:hidden;background-color:rgba(0,0,0,0) !important;display:flex;flex-wrap:nowrap;align-items:end;overscroll-behavior-x:contain;white-space:nowrap;margin-block:0;padding-inline-start:0;list-style:none}:host(.page-tabs){overflow:visible !important}:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1*(var(--post-container-offset)))}:host(.page-tabs) .tabs-wrapper button.scroll-btn{color:var(--post-scheme-color-interactive-primary-enabled-fg5);background-color:var(--post-scheme-color-interactive-primary-enabled-bg5);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke);position:absolute;z-index:2;box-shadow:var(--post-device-elevation-200);border-radius:var(--post-device-border-radius-2)}:host(.page-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-primary-hover-fg4);background-color:var(--post-scheme-color-interactive-primary-hover-bg8)}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-left{inset-inline-start:0;border-inline-start:none;border-radius:0 var(--post-device-border-radius-2) var(--post-device-border-radius-2) 0}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-right{inset-inline-end:0;border-inline-end:none;border-radius:var(--post-device-border-radius-2) 0 0 var(--post-device-border-radius-2)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn{background-color:Highlight;color:HighlightText}}:host(.page-tabs) .tabs-wrapper::after{content:"";position:absolute;inset-block-end:0;inset-inline-start:0;width:100%;height:var(--post-device-border-width-default);background-color:var(--post-palette-color-nested-tabs-page-stroke)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{background-color:LinkText}}:host(.page-tabs) .tabs-wrapper .tabs{padding-inline:calc(var(--post-container-offset));gap:var(--post-device-spacing-gap-inline-5);scrollbar-width:none}:host(.page-tabs) .tabs-wrapper .tabs::-webkit-scrollbar{display:none}:host(.page-tabs:not([size=small])) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.page-tabs[size=small]) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.content-tabs) .tabs-wrapper button.scroll-btn{flex-shrink:0;color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{color:HighlightText}}:host(post-tabs:not([size=small])) button.scroll-btn{height:var(--post-device-sizing-interactive-button-height-10);width:var(--post-device-sizing-interactive-button-width-1);border-radius:var(--post-device-border-radius-2)}:host(post-tabs:not([size=small])) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size5);width:var(--post-device-sizing-interactive-icon-size5)}:host(.page-tabs:not([size=small])) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-39) var(--post-device-spacing-padding-40)}:host(.page-tabs:not([size=small])) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-40) var(--post-device-spacing-padding-39)}:host([size=small]) button.scroll-btn{height:var(--post-device-sizing-interactive-button-size-1);width:var(--post-device-sizing-interactive-button-size-1);border-radius:var(--post-device-border-radius-2)}:host([size=small]) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4)}:host(.page-tabs[size=small]) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-42) var(--post-device-spacing-padding-43)}:host(.page-tabs[size=small]) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-43) var(--post-device-spacing-padding-42)}
|
|
1
|
+
:host{display:block}:host .tabs-wrapper{position:relative;display:flex;align-items:center}:host .tabs-wrapper button.scroll-btn{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;display:flex;align-items:center;justify-content:center;transition:background-color 100ms,border-color 100ms,color 100ms;cursor:pointer}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn{background-color:ButtonFace !important}:host .tabs-wrapper button.scroll-btn:hover{background-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn post-icon{color:currentColor}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn post-icon{color:Highlight}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:hover post-icon{color:canvas}}:host .tabs-wrapper button.scroll-btn[hidden]{display:none}:host .tabs-wrapper button.scroll-btn{outline-offset:var(--post-device-spacing-padding-44) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .tabs-wrapper .tabs{overflow-x:hidden;background-color:rgba(0,0,0,0) !important;display:flex;flex-wrap:nowrap;align-items:end;overscroll-behavior-x:contain;white-space:nowrap;margin-block:0;padding-inline-start:0;list-style:none}:host(.page-tabs){overflow:visible !important}:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1*(var(--post-container-offset)))}@media screen and (min-width: 1024px){:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1 * (var(--post-container-offset)) + 20px)}:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 var(--post-palette-color-nested-tabs-page-stroke),-20px 0 0 var(--post-palette-color-nested-tabs-page-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 LinkText,-20px 0 0 LinkText}}:host(.page-tabs) .tabs-wrapper button.scroll-btn{color:var(--post-scheme-color-interactive-primary-enabled-fg5);background-color:var(--post-scheme-color-interactive-primary-enabled-bg5);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke);position:absolute;z-index:2;box-shadow:var(--post-device-elevation-200);border-radius:var(--post-device-border-radius-2)}:host(.page-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-primary-hover-fg4);background-color:var(--post-scheme-color-interactive-primary-hover-bg8)}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-left{inset-inline-start:0;border-inline-start:none;border-radius:0 var(--post-device-border-radius-2) var(--post-device-border-radius-2) 0}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-right{inset-inline-end:0;border-inline-end:none;border-radius:var(--post-device-border-radius-2) 0 0 var(--post-device-border-radius-2)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn{background-color:Highlight;color:HighlightText}}:host(.page-tabs) .tabs-wrapper::after{content:"";position:absolute;inset-block-end:0;inset-inline-start:0;width:100%;height:var(--post-device-border-width-default);background-color:var(--post-palette-color-nested-tabs-page-stroke)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{background-color:LinkText}}:host(.page-tabs) .tabs-wrapper .tabs{padding-inline:calc(var(--post-container-offset));gap:var(--post-device-spacing-gap-inline-5);scrollbar-width:none}:host(.page-tabs) .tabs-wrapper .tabs::-webkit-scrollbar{display:none}:host(.page-tabs:not([size=small])) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.page-tabs[size=small]) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.content-tabs) .tabs-wrapper button.scroll-btn{flex-shrink:0;color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{color:HighlightText}}:host(post-tabs:not([size=small])) button.scroll-btn{height:var(--post-device-sizing-interactive-button-height-10);width:var(--post-device-sizing-interactive-button-width-1);border-radius:var(--post-device-border-radius-2)}:host(post-tabs:not([size=small])) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size5);width:var(--post-device-sizing-interactive-icon-size5)}:host(.page-tabs:not([size=small])) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-39) var(--post-device-spacing-padding-40)}:host(.page-tabs:not([size=small])) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-40) var(--post-device-spacing-padding-39)}:host([size=small]) button.scroll-btn{height:var(--post-device-sizing-interactive-button-size-1);width:var(--post-device-sizing-interactive-button-size-1);border-radius:var(--post-device-border-radius-2)}:host([size=small]) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4)}:host(.page-tabs[size=small]) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-42) var(--post-device-spacing-padding-43)}:host(.page-tabs[size=small]) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-43) var(--post-device-spacing-padding-42)}
|
|
@@ -427,10 +427,10 @@ export class PostTabs {
|
|
|
427
427
|
}
|
|
428
428
|
: undefined;
|
|
429
429
|
const style = isSSR && !this.isPagesVariant ? tabStyle : undefined;
|
|
430
|
-
return (h(Host, { key: '
|
|
430
|
+
return (h(Host, { key: 'fb65fd2589517dd6d86e86435ec6b3a3b64b093d', "data-version": version, style: style }, h("div", { key: 'dbcdd791af381ccc23953acb38a8e71527a804ee', class: "tabs-wrapper", part: "post-tabs" }, h("button", { key: '20ce30515d80b282aa93f20a1f3281a1ef0f6359', ref: el => (this.leftScrollButton = el), class: "scroll-btn scroll-btn-left", type: "button", "aria-label": this.textPrevTabItems, tabindex: this.showLeftScrollButton ? 0 : -1, hidden: !this.showLeftScrollButton, onClick: () => this.scrollTabs('prev') }, h("post-icon", { key: '9a5402a28656d7a4459b9b848425bd15a45a0fce', name: "chevronleft" })), h(TabsContainer, { key: 'e821db02fd66aef6cf7a9fb5d925b0906571f3b6', ref: el => (this.tabsContainer = el), class: "tabs", role: this.isPagesVariant ? undefined : 'tablist', "aria-label": this.isPagesVariant ? this.label : undefined }, h("slot", { key: 'e3650e43ac269173cb58f1624f02778bf094573c', onSlotchange: () => {
|
|
431
431
|
this.moveMisplacedTabs();
|
|
432
432
|
this.enableTabs();
|
|
433
|
-
} })), h("button", { key: '
|
|
433
|
+
} })), h("button", { key: '4345a9bc121ce187022cddf019d5c86d875a70e9', ref: el => (this.rightScrollButton = el), class: "scroll-btn scroll-btn-right", type: "button", "aria-label": this.textNextTabItems, tabindex: this.showRightScrollButton ? 0 : -1, hidden: !this.showRightScrollButton, onClick: () => this.scrollTabs('next') }, h("post-icon", { key: '2df749c1a4e506d9940ce61e077d0f0f330b7342', name: "chevronright" }))), !this.isPagesVariant && (h("div", { key: '184db29a5826af78d142ed1489be33c45831970b', class: "tab-content", part: "post-tabs-content" }, h("slot", { key: '4a984c7de97f2f89e7fd0f829f5bc62e2323f056', name: "panels", onSlotchange: () => this.moveMisplacedPanels() })))));
|
|
434
434
|
}
|
|
435
435
|
static get is() { return "post-tabs"; }
|
|
436
436
|
static get encapsulation() { return "shadow"; }
|
|
@@ -29,7 +29,7 @@ export class PostTogglebutton {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
|
-
return (h(Host, { key: '
|
|
32
|
+
return (h(Host, { key: '81fa9d922480059096e4146c10cf2ef72357b482', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '4e8d793e3867ba4c9c8e17d509652309a79f032a' })));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "post-togglebutton"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -67,7 +67,7 @@ export class PostTooltip {
|
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
69
|
const popoverClass = `${this.arrow ? 'has-arrow' : ''}`;
|
|
70
|
-
return (h(Host, { key: '
|
|
70
|
+
return (h(Host, { key: '62d5983e0ef32f851166d0c1d2c457cac0809fdf', "data-version": version }, h("post-popovercontainer", { key: '10150540956510724ab4832ecceb421a7013d983', safeSpace: "trapezoid", class: popoverClass, role: "tooltip", arrow: this.arrow, placement: this.placement, autoHide: true, onPostBeforeToggle: e => this.handleBeforeToggle(e), ref: (el) => (this.popoverRef = el) }, h("slot", { key: 'cdfaf0e916afa55ec3f1a7f64003101985560e27' }))));
|
|
71
71
|
}
|
|
72
72
|
static get is() { return "post-tooltip"; }
|
|
73
73
|
static get encapsulation() { return "shadow"; }
|
|
@@ -93,7 +93,7 @@ export class PostTooltip {
|
|
|
93
93
|
"Placement": {
|
|
94
94
|
"location": "import",
|
|
95
95
|
"path": "@floating-ui/dom",
|
|
96
|
-
"id": "../../node_modules/.pnpm/@floating-ui+dom@1.
|
|
96
|
+
"id": "../../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts::Placement",
|
|
97
97
|
"referenceLocation": "Placement"
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -44,7 +44,7 @@ export class PostTooltipTrigger {
|
|
|
44
44
|
// Load ally.js lazily; setupTrigger uses optional chaining to handle the
|
|
45
45
|
// case where it hasn't loaded yet (falls back to adding tabindex="0").
|
|
46
46
|
import('ally.js/is/focusable').then(m => {
|
|
47
|
-
isFocusable
|
|
47
|
+
isFocusable ??= m.default;
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -180,7 +180,7 @@ export class PostTooltipTrigger {
|
|
|
180
180
|
this.tooltip?.hide();
|
|
181
181
|
}
|
|
182
182
|
render() {
|
|
183
|
-
return (h(Host, { key: '
|
|
183
|
+
return (h(Host, { key: '55adc12f457aa8a5dd4357ed27876b0e526f7ae3', "data-version": version }, h("slot", { key: '84da1734ae1c1ac9376caa693108e3ed54bf176f', onSlotchange: () => this.handleSlotChange() })));
|
|
184
184
|
}
|
|
185
185
|
static get is() { return "post-tooltip-trigger"; }
|
|
186
186
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { throttle } from "throttle-debounce";
|
|
2
1
|
class Breakpoint {
|
|
3
2
|
constructor() {
|
|
4
3
|
this.breakpoints = [
|
|
5
|
-
{ key: 'xl', device: 'desktop', minWidth: 1280 },
|
|
6
|
-
{ key: 'lg', device: 'desktop', minWidth: 1024 },
|
|
7
|
-
{ key: 'md', device: 'tablet', minWidth: 780 },
|
|
8
|
-
{ key: 'sm', device: 'tablet', minWidth: 600 },
|
|
9
|
-
{ key: 'xs', device: 'mobile', minWidth: 0 },
|
|
4
|
+
{ key: 'xl', device: 'desktop', minWidth: 1280, mediaQuery: '(min-width: 1280px)' },
|
|
5
|
+
{ key: 'lg', device: 'desktop', minWidth: 1024, mediaQuery: '(min-width: 1024px)' },
|
|
6
|
+
{ key: 'md', device: 'tablet', minWidth: 780, mediaQuery: '(min-width: 780px)' },
|
|
7
|
+
{ key: 'sm', device: 'tablet', minWidth: 600, mediaQuery: '(min-width: 600px)' },
|
|
8
|
+
{ key: 'xs', device: 'mobile', minWidth: 0, mediaQuery: '(min-width: 0px)' },
|
|
10
9
|
];
|
|
11
10
|
this.resizeObserver = globalThis.ResizeObserver
|
|
12
11
|
? new ResizeObserver(() => this.updateCurrentBreakpoint())
|
|
13
12
|
: null;
|
|
14
|
-
this.updateCurrentBreakpoint =
|
|
13
|
+
this.updateCurrentBreakpoint = (options = { emitEvents: true }) => {
|
|
15
14
|
const previousBreakpoint = this.currentBreakpoint;
|
|
16
15
|
const newBreakpoint = this.breakpoints.find(breakpoint => {
|
|
17
|
-
return
|
|
16
|
+
return globalThis.matchMedia
|
|
17
|
+
? globalThis.matchMedia(breakpoint.mediaQuery).matches
|
|
18
|
+
: breakpoint.minWidth <= document.documentElement.clientWidth;
|
|
18
19
|
});
|
|
19
20
|
if (!newBreakpoint)
|
|
20
21
|
return;
|
|
@@ -22,9 +23,10 @@ class Breakpoint {
|
|
|
22
23
|
if (!options.emitEvents)
|
|
23
24
|
return;
|
|
24
25
|
Object.keys(this.currentBreakpoint)
|
|
26
|
+
.filter(key => key !== 'mediaQuery')
|
|
25
27
|
.filter(key => !previousBreakpoint || this.currentBreakpoint[key] !== previousBreakpoint[key])
|
|
26
28
|
.forEach((key) => this.dispatchEvent(key));
|
|
27
|
-
}
|
|
29
|
+
};
|
|
28
30
|
if (this.resizeObserver) {
|
|
29
31
|
this.updateCurrentBreakpoint({ emitEvents: false });
|
|
30
32
|
this.resizeObserver.observe(document.body);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { findClosestAcrossShadow } from "./event-from";
|
|
2
|
+
const CLOSABLE_TARGETS = [
|
|
3
|
+
{
|
|
4
|
+
predicate: el => el.localName === 'post-banner',
|
|
5
|
+
close: el => void el.dismiss(),
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
predicate: el => el.localName === 'post-popover',
|
|
9
|
+
close: el => void el.hide(),
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
predicate: el => el.localName === 'post-popovercontainer',
|
|
13
|
+
close: el => void el.hide(),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
predicate: el => el.localName === 'post-collapsible',
|
|
17
|
+
close: el => void el.toggle(false),
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
predicate: el => el.localName === 'post-accordion-item',
|
|
21
|
+
close: el => void el.toggle(false),
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
predicate: el => el.localName === 'dialog',
|
|
25
|
+
close: el => el.close(),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
predicate: el => el.hasAttribute('popover'),
|
|
29
|
+
close: el => el.togglePopover(false),
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
export function findClosableTarget(start) {
|
|
33
|
+
const el = findClosestAcrossShadow(start, (el) => CLOSABLE_TARGETS.some(t => t.predicate(el)));
|
|
34
|
+
if (!el)
|
|
35
|
+
return null;
|
|
36
|
+
const match = CLOSABLE_TARGETS.find(t => t.predicate(el));
|
|
37
|
+
return { element: el, close: () => match.close(el) };
|
|
38
|
+
}
|
|
@@ -89,29 +89,34 @@ export function EventFrom(tag, option) {
|
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Traverses up the DOM (including crossing shadow DOM boundaries) to find the closest ancestor
|
|
92
|
-
*
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
92
|
+
* matching the given predicate.
|
|
93
|
+
* @param start - The starting element
|
|
94
|
+
* @param predicate - A type guard used to test each ancestor
|
|
95
95
|
* @returns The closest matching ancestor or null if none found
|
|
96
96
|
*/
|
|
97
|
-
function
|
|
98
|
-
let current =
|
|
97
|
+
export function findClosestAcrossShadow(start, predicate) {
|
|
98
|
+
let current = start;
|
|
99
99
|
while (current) {
|
|
100
|
-
if (current
|
|
100
|
+
if (predicate(current)) {
|
|
101
101
|
return current;
|
|
102
102
|
}
|
|
103
|
-
// Check regular parent first
|
|
104
103
|
if (current.parentElement) {
|
|
105
104
|
current = current.parentElement;
|
|
106
105
|
}
|
|
107
|
-
// If no parentElement, check if we're in a shadow root
|
|
108
|
-
else if (current.parentNode instanceof ShadowRoot) {
|
|
109
|
-
current = current.parentNode.host;
|
|
110
|
-
}
|
|
111
|
-
// No more parents to check
|
|
112
106
|
else {
|
|
113
|
-
|
|
107
|
+
// Duck-typed ShadowRoot check (nodeType 11 + host) instead of `instanceof ShadowRoot`,
|
|
108
|
+
// since some test environments (e.g. JSDOM) only partially implement it.
|
|
109
|
+
const parent = current.parentNode;
|
|
110
|
+
if (parent !== null && parent.nodeType === 11 && 'host' in parent) {
|
|
111
|
+
current = parent.host;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
current = null;
|
|
115
|
+
}
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
return null;
|
|
117
119
|
}
|
|
120
|
+
function findClosestParentWithTag(element, tagName) {
|
|
121
|
+
return findClosestAcrossShadow(element, (el) => el.localName === tagName);
|
|
122
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This utility is covered by the end-to-end tests under 'clipping' in `popovercontainer.cy.ts`.
|
|
3
|
+
*/
|
|
4
|
+
import { computePosition, platform as domPlatform } from "@floating-ui/dom";
|
|
5
|
+
import { getParentNode, isHTMLElement, isLastTraversableNode, isTopLayer, } from "@floating-ui/utils/dom";
|
|
6
|
+
const CLIPPING_RECT_CACHE = Symbol('Clipping Rect Cache');
|
|
7
|
+
/**
|
|
8
|
+
* A custom floating UI platform that restricts clipping rectangles to the safe area.
|
|
9
|
+
*/
|
|
10
|
+
const safeAreaPlatform = { ...domPlatform, getClippingRect };
|
|
11
|
+
/**
|
|
12
|
+
* Computes the clipping rectangle of an element while accounting for the safe area.
|
|
13
|
+
*/
|
|
14
|
+
async function getClippingRect(...args) {
|
|
15
|
+
const element = args[0].element;
|
|
16
|
+
// Check whether the clipping rectangle of the given element has already been computed during
|
|
17
|
+
// this pass.
|
|
18
|
+
const hit = this[CLIPPING_RECT_CACHE].get(element);
|
|
19
|
+
if (hit)
|
|
20
|
+
return hit;
|
|
21
|
+
// Compute the clipping rectangle with the Floating UI DOM platform, then restrict it to the safe
|
|
22
|
+
// area.
|
|
23
|
+
const clippingRect = await domPlatform.getClippingRect.apply(this, args);
|
|
24
|
+
applySafeArea(clippingRect, element);
|
|
25
|
+
this[CLIPPING_RECT_CACHE].set(element, clippingRect);
|
|
26
|
+
return clippingRect;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Restricts the `clippingRect` computed for `element` to the safe area, modifying it in place.
|
|
30
|
+
*
|
|
31
|
+
* The safe area only applies to elements that the header can actually cover, which excludes
|
|
32
|
+
* elements without a header on their page, elements on a top layer and elements within the header.
|
|
33
|
+
*/
|
|
34
|
+
function applySafeArea(clippingRect, element) {
|
|
35
|
+
const headerElement = element.ownerDocument.querySelector('post-header');
|
|
36
|
+
if (headerElement === null)
|
|
37
|
+
return;
|
|
38
|
+
let parent = element;
|
|
39
|
+
while (!isLastTraversableNode(parent)) {
|
|
40
|
+
parent = getParentNode(parent);
|
|
41
|
+
if (!isHTMLElement(parent))
|
|
42
|
+
continue;
|
|
43
|
+
// Do not apply the safe area of the header to
|
|
44
|
+
// - elements that are on a top layer, such as a dialog.
|
|
45
|
+
// - elements that are located within the header itself.
|
|
46
|
+
if (isTopLayer(parent) || parent === headerElement)
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const headerRect = headerElement.getBoundingClientRect();
|
|
50
|
+
const top = Math.max(clippingRect.y, headerRect.bottom);
|
|
51
|
+
clippingRect.height -= top - clippingRect.y;
|
|
52
|
+
clippingRect.y = top;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Computes the coordinates that will position the `floating` element next to a given `reference`
|
|
56
|
+
* element while accounting for the safe area.
|
|
57
|
+
*
|
|
58
|
+
* The safe area is the part of the viewport that the header does not cover. Restricting the
|
|
59
|
+
* clipping rectangles to it makes floating elements behave as if they were clipped by the header.
|
|
60
|
+
*/
|
|
61
|
+
export const computePositionWithSafeArea = (reference, floating, options) => {
|
|
62
|
+
// Adapted from https://github.com/floating-ui/floating-ui/blob/27629b74ba36ab8ceb2a968051927b9b69511a3b/packages/dom/src/index.ts#L15
|
|
63
|
+
options ??= {};
|
|
64
|
+
return computePosition(reference, floating, {
|
|
65
|
+
...options,
|
|
66
|
+
platform: {
|
|
67
|
+
...safeAreaPlatform,
|
|
68
|
+
...options.platform,
|
|
69
|
+
[CLIPPING_RECT_CACHE]: new Map(),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|