@swisspost/design-system-components 10.6.0 → 10.8.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/dist/cjs/{create-validator-decorator-Cy5yN6u9.js → create-validator-decorator-DVm_SDrR.js} +1 -1
- package/dist/cjs/{index-B3PXzvDk.js → index-DY4QxKNv.js} +5 -5
- package/dist/cjs/is-focus-visible-B3CqVQsX.js +19 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{one-of-CRFrfihj.js → one-of-qu7_EPxf.js} +1 -1
- package/dist/cjs/{package-pKyFPwiA.js → package-DAEQGHsE.js} +1 -1
- package/dist/cjs/{pattern-D329DFcf.js → pattern-EpwCKMyC.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +6 -6
- package/dist/cjs/post-autocomplete.cjs.entry.js +5 -5
- package/dist/cjs/post-avatar.cjs.entry.js +85 -61
- package/dist/cjs/post-back-to-top.cjs.entry.js +6 -6
- package/dist/cjs/post-banner.cjs.entry.js +5 -5
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +8 -8
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +7 -7
- package/dist/cjs/post-closebutton_14.cjs.entry.js +477 -593
- package/dist/cjs/post-collapsible_2.cjs.entry.js +13 -7
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +43 -27
- package/dist/cjs/post-footer.cjs.entry.js +6 -6
- package/dist/cjs/post-linkarea.cjs.entry.js +2 -2
- package/dist/cjs/post-listbox-option.cjs.entry.js +2 -2
- package/dist/cjs/post-listbox.cjs.entry.js +2 -2
- package/dist/cjs/post-number-input.cjs.entry.js +3 -3
- package/dist/cjs/post-pagination.cjs.entry.js +6 -6
- package/dist/cjs/post-popover-trigger.cjs.entry.js +4 -4
- package/dist/cjs/post-popover.cjs.entry.js +9 -9
- package/dist/cjs/post-progressbar.cjs.entry.js +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation.cjs.entry.js +14 -9
- package/dist/cjs/post-stepper-item.cjs.entry.js +2 -2
- package/dist/cjs/post-stepper.cjs.entry.js +6 -6
- package/dist/cjs/post-tab-item.cjs.entry.js +5 -5
- package/dist/cjs/post-tab-panel.cjs.entry.js +5 -5
- package/dist/cjs/post-tabs.cjs.entry.js +8 -8
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +6 -6
- package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
- package/dist/cjs/{required-DhAEd0c7.js → required-Dgzo-rb5.js} +1 -1
- package/dist/cjs/{type-2Ma9dvHs.js → type-DBRxpBZI.js} +1 -1
- package/dist/cjs/{url-DePscsTj.js → url-Dl1JABeP.js} +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-avatar/avatar-utils.js +1 -2
- package/dist/collection/components/post-avatar/post-avatar.js +77 -59
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
- package/dist/collection/components/post-banner/post-banner.css +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +9 -3
- package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
- package/dist/collection/components/post-date-picker/post-date-picker.js +36 -22
- package/dist/collection/components/post-footer/post-footer.css +1 -1
- package/dist/collection/components/post-header/post-header.css +1 -1
- package/dist/collection/components/post-header/post-header.js +38 -13
- package/dist/collection/components/post-language-menu/post-language-menu.css +1 -1
- package/dist/collection/components/post-language-menu/post-language-menu.js +1 -1
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +34 -16
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
- package/dist/collection/components/post-menu/post-menu.css +1 -1
- package/dist/collection/components/post-menu/post-menu.js +3 -14
- package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
- package/dist/collection/components/post-number-input/post-number-input.css +2 -2
- package/dist/collection/components/post-pagination/post-pagination.css +1 -1
- package/dist/collection/components/post-popover/post-popover.css +1 -1
- package/dist/collection/components/post-popover/post-popover.js +2 -2
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +211 -323
- package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.js +7 -3
- 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-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +3 -1
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
- package/dist/collection/utils/floating-ui/middleware/flip.js +77 -0
- package/dist/collection/utils/floating-ui/middleware/safe-space.js +52 -0
- package/dist/collection/utils/floating-ui/util.js +10 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/is-focus-visible.js +15 -0
- package/dist/components/is-focus-visible.js +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +1 -1
- package/dist/components/post-avatar.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-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-language-menu.js +1 -1
- package/dist/components/post-logo.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-menu2.js +1 -1
- package/dist/components/post-number-input.js +1 -1
- package/dist/components/post-pagination.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-popovercontainer2.js +1 -1
- package/dist/components/post-side-navigation.js +1 -1
- package/dist/components/post-tabs.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-5kW0ZF_f.js +1 -0
- package/dist/components/react/p-BMCit4BU.js +1 -0
- package/dist/components/react/p-BWwWKRO5.js +1 -0
- package/dist/components/react/p-BdiQsTQm.js +1 -0
- package/dist/components/react/p-BeRGbt65.js +1 -0
- package/dist/components/react/{p-DffT6evQ.js → p-C8i672qm.js} +1 -1
- package/dist/components/react/{p-m1-sOx5T.js → p-C_JY6ipN.js} +1 -1
- package/dist/components/react/p-DRJ9K8sv.js +1 -0
- package/dist/components/react/{p-CcDLIogT.js → p-DygUkCKz.js} +1 -1
- package/dist/components/react/p-DzYMQFK2.js +1 -0
- package/dist/components/react/{p-CzsG0uCA.js → p-E-8qAn1z.js} +1 -1
- package/dist/components/react/p-Q5LQWL2X.js +1 -0
- package/dist/components/react/{p-CdggfEzz.js → p-UXyZDQt4.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-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 +67 -45
- package/dist/esm/{create-validator-decorator-C2XlYkNB.js → create-validator-decorator-Cp_NUmrr.js} +1 -1
- package/dist/esm/{index-BjziJWh2.js → index-D0jX3Fts.js} +5 -5
- package/dist/esm/is-focus-visible-BWwWKRO5.js +17 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{one-of-Do1iao-k.js → one-of-B9locHPx.js} +1 -1
- package/dist/esm/{package-T8T3po4z.js → package-BdiQsTQm.js} +1 -1
- package/dist/esm/{pattern-BZDucOTq.js → pattern-BL3OBU8C.js} +1 -1
- package/dist/esm/post-accordion_2.entry.js +6 -6
- package/dist/esm/post-autocomplete.entry.js +5 -5
- package/dist/esm/post-avatar.entry.js +85 -61
- package/dist/esm/post-back-to-top.entry.js +6 -6
- package/dist/esm/post-banner.entry.js +5 -5
- package/dist/esm/post-breadcrumb-item.entry.js +8 -8
- package/dist/esm/post-breadcrumbs.entry.js +7 -7
- package/dist/esm/post-closebutton_14.entry.js +477 -593
- package/dist/esm/post-collapsible_2.entry.js +13 -7
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +43 -27
- package/dist/esm/post-footer.entry.js +6 -6
- package/dist/esm/post-linkarea.entry.js +2 -2
- package/dist/esm/post-listbox-option.entry.js +2 -2
- package/dist/esm/post-listbox.entry.js +2 -2
- package/dist/esm/post-number-input.entry.js +3 -3
- package/dist/esm/post-pagination.entry.js +6 -6
- package/dist/esm/post-popover-trigger.entry.js +4 -4
- package/dist/esm/post-popover.entry.js +9 -9
- package/dist/esm/post-progressbar.entry.js +3 -3
- package/dist/esm/post-rating.entry.js +5 -5
- package/dist/esm/post-side-navigation-trigger.entry.js +5 -5
- package/dist/esm/post-side-navigation.entry.js +14 -9
- package/dist/esm/post-stepper-item.entry.js +2 -2
- package/dist/esm/post-stepper.entry.js +6 -6
- package/dist/esm/post-tab-item.entry.js +5 -5
- package/dist/esm/post-tab-panel.entry.js +5 -5
- package/dist/esm/post-tabs.entry.js +8 -8
- package/dist/esm/post-tooltip-trigger.entry.js +6 -6
- package/dist/esm/post-tooltip.entry.js +8 -6
- package/dist/esm/{required-B0X7uy13.js → required-CDaQB1gC.js} +1 -1
- package/dist/esm/{type-CF1dOg6D.js → type-CQ7XuPCZ.js} +1 -1
- package/dist/esm/{url-BL7d6iWZ.js → url-B-86gtTK.js} +1 -1
- package/dist/post-components/p-0688d296.entry.js +1 -0
- package/dist/post-components/p-0b0b2f02.entry.js +1 -0
- package/dist/post-components/{p-c9dcdebb.entry.js → p-0d25c033.entry.js} +1 -1
- package/dist/post-components/{p-655ded00.entry.js → p-229d324e.entry.js} +1 -1
- package/dist/post-components/{p-88f754e9.entry.js → p-2a5312a7.entry.js} +1 -1
- package/dist/post-components/{p-ba1b4ba0.entry.js → p-330fd6cd.entry.js} +1 -1
- package/dist/post-components/p-3712133b.entry.js +1 -0
- package/dist/post-components/{p-87b1034f.entry.js → p-379780a3.entry.js} +1 -1
- package/dist/post-components/{p-dc285087.entry.js → p-3fdb8ebc.entry.js} +1 -1
- package/dist/post-components/{p-2005eb98.entry.js → p-456b0786.entry.js} +1 -1
- package/dist/post-components/p-4d30c65d.entry.js +1 -0
- package/dist/post-components/{p-de6f1816.entry.js → p-534ca27e.entry.js} +1 -1
- package/dist/post-components/p-5369b9c2.entry.js +1 -0
- package/dist/post-components/p-6833be12.entry.js +1 -0
- package/dist/post-components/p-6ad44691.entry.js +1 -0
- package/dist/post-components/{p-1ec27142.entry.js → p-82c62e90.entry.js} +1 -1
- package/dist/post-components/{p-8012cc3b.entry.js → p-91a2ef3c.entry.js} +1 -1
- package/dist/post-components/p-95f5d5ea.entry.js +1 -0
- package/dist/post-components/p-9dd286bf.entry.js +1 -0
- package/dist/post-components/p-9fedcfba.entry.js +1 -0
- package/dist/post-components/p-BCPv4bcY.js +1 -0
- package/dist/post-components/p-BWwWKRO5.js +1 -0
- package/dist/post-components/p-BdiQsTQm.js +1 -0
- package/dist/post-components/p-CP3LjuFR.js +1 -0
- package/dist/post-components/p-D0jX3Fts.js +2 -0
- package/dist/post-components/p-D6mVqZLg.js +1 -0
- package/dist/post-components/{p-DgnQe03V.js → p-DSaWK_q-.js} +1 -1
- package/dist/post-components/p-VPHnF9fB.js +1 -0
- package/dist/post-components/{p-f9a8ee94.entry.js → p-ab0500b7.entry.js} +1 -1
- package/dist/post-components/p-c123ecde.entry.js +1 -0
- package/dist/post-components/{p-cdc7b8d3.entry.js → p-d2de31b7.entry.js} +1 -1
- package/dist/post-components/p-dffeb751.entry.js +1 -0
- package/dist/post-components/{p-60550edb.entry.js → p-e11ccdbe.entry.js} +1 -1
- package/dist/post-components/{p-a32d3050.entry.js → p-e560767b.entry.js} +1 -1
- package/dist/post-components/p-ee7fade4.entry.js +1 -0
- package/dist/post-components/{p-2cff5b3a.entry.js → p-f2629077.entry.js} +1 -1
- package/dist/post-components/{p-d7c9a969.entry.js → p-f2b24bbd.entry.js} +1 -1
- package/dist/post-components/p-gv9b-Z15.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-avatar/avatar-utils.d.ts +0 -2
- package/dist/types/components/post-avatar/post-avatar.d.ts +11 -9
- package/dist/types/components/post-date-picker/post-date-picker.d.ts +4 -1
- package/dist/types/components/post-header/post-header.d.ts +5 -1
- package/dist/types/components/post-language-menu/post-language-menu.d.ts +3 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +1 -1
- package/dist/types/components/post-menu/post-menu.d.ts +0 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +74 -69
- package/dist/types/components.d.ts +39 -26
- package/dist/types/utils/floating-ui/middleware/flip.d.ts +14 -0
- package/dist/types/utils/floating-ui/middleware/safe-space.d.ts +10 -0
- package/dist/types/utils/floating-ui/util.d.ts +4 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/is-focus-visible.d.ts +5 -0
- package/dist/vrt/helpers/header-test-config.js +2 -1
- package/hydrate/index.js +564 -623
- package/hydrate/index.mjs +564 -623
- package/package.json +11 -10
- package/dist/components/react/p-3RU9XwVO.js +0 -1
- package/dist/components/react/p-B1TcktiB.js +0 -1
- package/dist/components/react/p-BN2dfUQ0.js +0 -1
- package/dist/components/react/p-BPUhha1U.js +0 -1
- package/dist/components/react/p-Bnb_TyDh.js +0 -1
- package/dist/components/react/p-T8T3po4z.js +0 -1
- package/dist/components/react/p-WXzzOdnl.js +0 -1
- package/dist/post-components/p-0e922531.entry.js +0 -1
- package/dist/post-components/p-53bd2128.entry.js +0 -1
- package/dist/post-components/p-59b30e90.entry.js +0 -1
- package/dist/post-components/p-76cc3c9a.entry.js +0 -1
- package/dist/post-components/p-819c93de.entry.js +0 -1
- package/dist/post-components/p-840acd3c.entry.js +0 -1
- package/dist/post-components/p-9S_5_Zh8.js +0 -1
- package/dist/post-components/p-BYfu3J2D.js +0 -1
- package/dist/post-components/p-BjziJWh2.js +0 -2
- package/dist/post-components/p-BoYe-VVx.js +0 -1
- package/dist/post-components/p-CbbADNiv.js +0 -1
- package/dist/post-components/p-DlKbBdcP.js +0 -1
- package/dist/post-components/p-T8T3po4z.js +0 -1
- package/dist/post-components/p-b4229624.entry.js +0 -1
- package/dist/post-components/p-b9faa76b.entry.js +0 -1
- package/dist/post-components/p-c0ae13b7.entry.js +0 -1
- package/dist/post-components/p-ccf8020b.entry.js +0 -1
- package/dist/post-components/p-cd68d3a2.entry.js +0 -1
- package/dist/post-components/p-db11f781.entry.js +0 -1
- package/dist/post-components/p-dec8bd99.entry.js +0 -1
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/vrt/helpers/header-variants.config.d.ts +0 -23
- package/dist/vrt/helpers/header-variants.config.js +0 -157
- /package/dist/collection/utils/{floating-ui.js → floating-ui/platform/safe-area.js} +0 -0
- /package/dist/types/utils/{floating-ui.d.ts → floating-ui/platform/safe-area.d.ts} +0 -0
|
@@ -8,78 +8,46 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
9
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
10
|
};
|
|
11
|
-
import { Build, h, Host, } from "@stencil/core";
|
|
12
|
-
import { OneOf, Type } from "../../utils/index";
|
|
13
11
|
import { version } from "../../../../package";
|
|
12
|
+
import { Build, h, Host, } from "@stencil/core";
|
|
13
|
+
import { popIn } from "../../animations/pop-in";
|
|
14
14
|
import { PLACEMENT_TYPES } from "../../types/index";
|
|
15
|
-
import {
|
|
15
|
+
import { OneOf, Type } from "../../utils/index";
|
|
16
|
+
import { arrow, autoUpdate, hide, inline, limitShift, shift, size, offset, } from "@floating-ui/dom";
|
|
17
|
+
import { getSide } from "@floating-ui/utils";
|
|
18
|
+
import { flip } from "../../utils/floating-ui/middleware/flip";
|
|
19
|
+
import { getOppositeSide } from "../../utils/floating-ui/util";
|
|
20
|
+
import { computePositionWithSafeArea } from "../../utils/floating-ui/platform/safe-area";
|
|
21
|
+
import { SAFE_SPACE_MIDDLEWARE, safeSpace } from "../../utils/floating-ui/middleware/safe-space";
|
|
16
22
|
// Polyfill for popovers, can be removed when https://caniuse.com/?search=popover is green
|
|
17
|
-
import { popIn } from "../../animations/pop-in";
|
|
18
23
|
import { apply, isSupported } from "@oddbird/popover-polyfill/fn";
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
};
|
|
24
|
+
const AVAILABLE_WIDTH_PROPERTY = '--post-popovercontainer-available-width';
|
|
25
|
+
const AVAILABLE_HEIGHT_PROPERTY = '--post-popovercontainer-available-height';
|
|
26
|
+
const SAFE_SPACE_PROPERTY = '--post-popovercontainer-safe-space';
|
|
23
27
|
/**
|
|
24
|
-
* @slot - Default slot for placing content inside the
|
|
28
|
+
* @slot - Default slot for placing content inside the popover.
|
|
25
29
|
*/
|
|
26
30
|
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
|
-
}
|
|
51
31
|
constructor() {
|
|
32
|
+
/** The element the popover is anchored to */
|
|
33
|
+
this.anchorRef = null;
|
|
34
|
+
this.arrowRef = null;
|
|
35
|
+
this.hasBeenOpened = false;
|
|
52
36
|
this.toggleTimeoutId = null;
|
|
53
|
-
this.
|
|
37
|
+
this.runningAnimation = null;
|
|
38
|
+
this.stopAutoUpdate = null;
|
|
54
39
|
/**
|
|
55
|
-
*
|
|
56
|
-
* Popovercontainers are automatically flipped to the opposite side if there is not enough available space and are shifted
|
|
57
|
-
* towards the viewport if they would overlap edge boundaries.
|
|
40
|
+
* Placement of the popover according to the floating-ui options.
|
|
58
41
|
*/
|
|
59
42
|
this.placement = 'top';
|
|
60
43
|
/**
|
|
61
|
-
* Gap between the edge of the
|
|
44
|
+
* Gap between the edge of the viewport and the popover.
|
|
62
45
|
*/
|
|
63
46
|
this.edgeGap = 8;
|
|
64
47
|
/**
|
|
65
|
-
*
|
|
48
|
+
* Show a little indicator arrow
|
|
66
49
|
*/
|
|
67
50
|
this.arrow = false;
|
|
68
|
-
/**
|
|
69
|
-
* Animation style
|
|
70
|
-
*/
|
|
71
|
-
this.animation = 'pop-in';
|
|
72
|
-
this.currentAnimation = null;
|
|
73
|
-
this.boundMouseTrackingHandler = this.mouseTrackingHandler.bind(this);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Updates cursor position for safe space feature when popover is open.
|
|
77
|
-
* Sets CSS custom properties for dynamic styling of safe area.
|
|
78
|
-
* @param event MouseEvent with cursor position
|
|
79
|
-
*/
|
|
80
|
-
mouseTrackingHandler(event) {
|
|
81
|
-
this.host.style.setProperty('--post-safe-space-cursor-x', `${event.clientX}px`);
|
|
82
|
-
this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
|
|
83
51
|
}
|
|
84
52
|
connectedCallback() {
|
|
85
53
|
if (Build.isBrowser && !isSupported()) {
|
|
@@ -90,296 +58,197 @@ export class PostPopovercontainer {
|
|
|
90
58
|
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
91
59
|
}
|
|
92
60
|
disconnectedCallback() {
|
|
93
|
-
|
|
94
|
-
this.clearAutoUpdate();
|
|
95
|
-
}
|
|
61
|
+
this.cleanup();
|
|
96
62
|
this.host.removeEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
97
63
|
}
|
|
64
|
+
cleanup() {
|
|
65
|
+
this.stopAutoUpdate?.();
|
|
66
|
+
if (this.runningAnimation) {
|
|
67
|
+
this.runningAnimation.cancel();
|
|
68
|
+
this.runningAnimation = null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
isOpen() {
|
|
72
|
+
return this.host?.matches(':where(:popover-open, .popover-open)');
|
|
73
|
+
}
|
|
74
|
+
getContent() {
|
|
75
|
+
return this.host?.shadowRoot.querySelector('[part="post-popovercontainer-content"]');
|
|
76
|
+
}
|
|
77
|
+
getContentMinSize() {
|
|
78
|
+
const content = this.getContent();
|
|
79
|
+
if (!content)
|
|
80
|
+
return {};
|
|
81
|
+
const { minWidth, minHeight } = getComputedStyle(content);
|
|
82
|
+
return {
|
|
83
|
+
width: Number.parseFloat(minWidth) || 0,
|
|
84
|
+
height: Number.parseFloat(minHeight) || 0,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
98
87
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @param
|
|
88
|
+
* Shows the popover.
|
|
89
|
+
* @param anchor the element that the popover is visually anchored to.
|
|
101
90
|
*/
|
|
102
|
-
async show(
|
|
103
|
-
if (this.toggleTimeoutId || !
|
|
91
|
+
async show(anchor) {
|
|
92
|
+
if (this.toggleTimeoutId || !anchor || this.isOpen())
|
|
104
93
|
return;
|
|
105
|
-
this.
|
|
106
|
-
this.updatePosition();
|
|
94
|
+
this.anchorRef = anchor;
|
|
107
95
|
this.host.showPopover();
|
|
108
96
|
}
|
|
109
97
|
/**
|
|
110
|
-
*
|
|
98
|
+
* Hides the popover.
|
|
111
99
|
*/
|
|
112
100
|
async hide() {
|
|
113
|
-
if (!this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
101
|
+
if (this.toggleTimeoutId || !this.isOpen())
|
|
102
|
+
return;
|
|
103
|
+
this.anchorRef = null;
|
|
104
|
+
this.host.hidePopover();
|
|
105
|
+
this.postHide.emit();
|
|
118
106
|
}
|
|
119
107
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
108
|
+
* Toggles the popover's state from hidden to showing and vice versa.
|
|
109
|
+
*
|
|
110
|
+
* If `state` is specified, the popover is forced to be shown if the is set to `true`, or hidden
|
|
111
|
+
* if it is set to `false`.
|
|
112
|
+
*
|
|
113
|
+
* @param anchor the element that the popover is visually anchored to.
|
|
114
|
+
* @param force the next state of the popover.
|
|
115
|
+
* @returns the new state of the popover: `true` if it is shown, `false` if it is hidden.
|
|
123
116
|
*/
|
|
124
|
-
async toggle(
|
|
125
|
-
const isOpen = this.
|
|
126
|
-
|
|
127
|
-
if (willOpen && !target)
|
|
117
|
+
async toggle(anchor, force) {
|
|
118
|
+
const isOpen = this.isOpen();
|
|
119
|
+
if (!this.host || this.toggleTimeoutId)
|
|
128
120
|
return isOpen;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
121
|
+
const shouldOpen = force === true || (force === undefined && !isOpen);
|
|
122
|
+
if (isOpen === shouldOpen || (shouldOpen && !anchor))
|
|
123
|
+
return isOpen;
|
|
124
|
+
this.anchorRef = shouldOpen ? anchor : null;
|
|
125
|
+
this.host.togglePopover(force);
|
|
126
|
+
this.toggleTimeoutId = null;
|
|
127
|
+
return this.isOpen();
|
|
137
128
|
}
|
|
138
129
|
/**
|
|
139
|
-
* Handles the popover
|
|
130
|
+
* Handles the popover's state transition from hidden to showing and vice versa.
|
|
140
131
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (typeof animationFn === 'function') {
|
|
148
|
-
this.runOpenAnimation(animationFn, content);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// No animation case
|
|
152
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
153
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
154
|
-
this.postToggle.emit({ isOpen: true });
|
|
155
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
156
|
-
if (this.hasOpenedOnce)
|
|
157
|
-
this.hasOpenedOnce = false;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (this.safeSpace) {
|
|
161
|
-
globalThis.addEventListener('mousemove', this.boundMouseTrackingHandler);
|
|
162
|
-
}
|
|
132
|
+
async handleToggle(event) {
|
|
133
|
+
this.toggleTimeoutId = globalThis.setTimeout(() => (this.toggleTimeoutId = null), 10);
|
|
134
|
+
if (event.newState === 'open')
|
|
135
|
+
await this.handleOpen();
|
|
136
|
+
else
|
|
137
|
+
await this.handleClose();
|
|
163
138
|
}
|
|
164
139
|
/**
|
|
165
|
-
* Handles the popover
|
|
140
|
+
* Handles the popover's state transition from hidden to showing, emitting related events.
|
|
166
141
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
142
|
+
async handleOpen() {
|
|
143
|
+
this.postBeforeToggle.emit({ willOpen: true });
|
|
144
|
+
this.postBeforeShow.emit({ first: !this.hasBeenOpened });
|
|
145
|
+
await this.updatePosition(true);
|
|
146
|
+
this.startAutoUpdate();
|
|
147
|
+
try {
|
|
148
|
+
await this.runOpenAnimation();
|
|
173
149
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
this.currentAnimation.cancel();
|
|
177
|
-
this.currentAnimation = null;
|
|
150
|
+
catch {
|
|
151
|
+
return;
|
|
178
152
|
}
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
153
|
+
this.postToggle.emit({ isOpen: true });
|
|
154
|
+
this.postShow.emit({ first: !this.hasBeenOpened });
|
|
155
|
+
this.hasBeenOpened = true;
|
|
182
156
|
}
|
|
183
157
|
/**
|
|
184
|
-
*
|
|
158
|
+
* Run the open animation for the popover.
|
|
185
159
|
*/
|
|
186
|
-
async runOpenAnimation(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
193
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
194
|
-
this.postToggle.emit({ isOpen: true });
|
|
195
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
this.currentAnimation = animation;
|
|
199
|
-
if (animation.playState === 'running') {
|
|
200
|
-
this.postBeforeToggle.emit({ willOpen: true });
|
|
201
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
202
|
-
}
|
|
203
|
-
await animation.finished;
|
|
204
|
-
this.postToggle.emit({ isOpen: true });
|
|
205
|
-
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
206
|
-
this.hasOpenedOnce = true;
|
|
207
|
-
}
|
|
208
|
-
catch (err) {
|
|
209
|
-
console.warn('Animation failed or was interrupted:', err);
|
|
210
|
-
// Reset all states to closing
|
|
211
|
-
this.postBeforeToggle.emit({ willOpen: false });
|
|
212
|
-
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
213
|
-
this.postToggle.emit({ isOpen: false });
|
|
214
|
-
}
|
|
215
|
-
finally {
|
|
216
|
-
if (this.currentAnimation === animation) {
|
|
217
|
-
this.currentAnimation = null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
160
|
+
async runOpenAnimation() {
|
|
161
|
+
const content = this.getContent();
|
|
162
|
+
if (!content)
|
|
163
|
+
return;
|
|
164
|
+
this.runningAnimation = popIn(content);
|
|
165
|
+
await this.runningAnimation.finished;
|
|
220
166
|
}
|
|
221
167
|
/**
|
|
222
|
-
*
|
|
223
|
-
* Popovercontainers can be closed or opened with other methods than class members,
|
|
224
|
-
* therefore listening to the toggle event is safer for cleaning up.
|
|
225
|
-
* @param e ToggleEvent
|
|
168
|
+
* Handles the popover's state transition from showing to hidden, emitting related events.
|
|
226
169
|
*/
|
|
227
|
-
|
|
228
|
-
this.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
170
|
+
async handleClose() {
|
|
171
|
+
this.postBeforeToggle.emit({ willOpen: false });
|
|
172
|
+
this.cleanup();
|
|
173
|
+
this.host.style.removeProperty(AVAILABLE_WIDTH_PROPERTY);
|
|
174
|
+
this.host.style.removeProperty(AVAILABLE_HEIGHT_PROPERTY);
|
|
175
|
+
this.host.style.removeProperty(SAFE_SPACE_PROPERTY);
|
|
176
|
+
this.postToggle.emit({ isOpen: false });
|
|
177
|
+
this.postHide.emit();
|
|
236
178
|
}
|
|
237
179
|
/**
|
|
238
|
-
*
|
|
239
|
-
* an influence on popovercontainer positioning
|
|
180
|
+
* Listen for changes that affect the popover's position and update it accordingly.
|
|
240
181
|
*/
|
|
241
|
-
|
|
242
|
-
if (!this.
|
|
182
|
+
startAutoUpdate() {
|
|
183
|
+
if (!this.host || !this.anchorRef)
|
|
243
184
|
return;
|
|
244
|
-
this.
|
|
185
|
+
this.stopAutoUpdate = autoUpdate(this.anchorRef, this.host, () => this.updatePosition(this.autoResize));
|
|
245
186
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Updates the position of the popover based on the anchor's position and the specified placement.
|
|
189
|
+
* @param withSize whether to resize the popover based on the available space.
|
|
190
|
+
*/
|
|
191
|
+
async updatePosition(withSize = false) {
|
|
192
|
+
const { x, y, middlewareData, placement } = await this.computePosition(withSize);
|
|
193
|
+
// Hide the popover if the anchor is outside the scrollport.
|
|
249
194
|
if (middlewareData.hide?.referenceHidden) {
|
|
250
195
|
this.host.hidePopover();
|
|
196
|
+
return;
|
|
251
197
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
// Position popover
|
|
198
|
+
this.side = getSide(placement);
|
|
199
|
+
// Position the popover.
|
|
255
200
|
this.host.style.left = `${x}px`;
|
|
256
201
|
this.host.style.top = `${y}px`;
|
|
257
|
-
// Position
|
|
258
|
-
if (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const halfSide = -0.5 * arrowSizePx;
|
|
263
|
-
if (staticSide) {
|
|
264
|
-
Object.assign(this.arrowRef.style, {
|
|
265
|
-
left: arrowX ? `${arrowX}px` : '',
|
|
266
|
-
top: arrowY ? `${arrowY}px` : '',
|
|
267
|
-
[staticSide]: `${halfSide}px`,
|
|
268
|
-
});
|
|
269
|
-
}
|
|
202
|
+
// Position the indicator arrow.
|
|
203
|
+
if (middlewareData.arrow) {
|
|
204
|
+
this.arrowRef.style.left = middlewareData.arrow.x ? `${middlewareData.arrow.x}px` : '';
|
|
205
|
+
this.arrowRef.style.top = middlewareData.arrow.y ? `${middlewareData.arrow.y}px` : '';
|
|
206
|
+
this.arrowRef.style[getOppositeSide(this.side)] = `-${this.arrowRef.offsetWidth / 2}px`;
|
|
270
207
|
}
|
|
271
|
-
//
|
|
272
|
-
if (
|
|
273
|
-
|
|
208
|
+
// Set the safe space polygon.
|
|
209
|
+
if (middlewareData[SAFE_SPACE_MIDDLEWARE]) {
|
|
210
|
+
this.host.style.setProperty(SAFE_SPACE_PROPERTY, middlewareData[SAFE_SPACE_MIDDLEWARE].polygon);
|
|
274
211
|
}
|
|
275
212
|
}
|
|
276
|
-
async
|
|
277
|
-
const
|
|
278
|
-
const isAligned = (this.placement || 'top').includes('-');
|
|
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
|
-
];
|
|
285
|
-
const shiftMiddleware = shift({
|
|
286
|
-
padding: gap,
|
|
287
|
-
limiter: limitShift({
|
|
288
|
-
offset: 32,
|
|
289
|
-
}),
|
|
290
|
-
});
|
|
213
|
+
async computePosition(withSize) {
|
|
214
|
+
const padding = this.edgeGap ?? 0;
|
|
291
215
|
const middleware = [
|
|
292
|
-
offset(this.offset ?? (this.arrow ?
|
|
216
|
+
offset(this.offset ?? (this.arrow ? padding + 4 : padding)),
|
|
293
217
|
inline(),
|
|
294
|
-
// Per floating-ui docs: for aligned placements (e.g. bottom-end),
|
|
295
|
-
// flip should come before shift. For non-aligned, shift before flip.
|
|
296
|
-
...(isAligned ? [...flipMiddleware, shiftMiddleware] : [shiftMiddleware, ...flipMiddleware]),
|
|
297
|
-
size({
|
|
298
|
-
apply({ availableWidth, elements }) {
|
|
299
|
-
Object.assign(elements.floating.style, {
|
|
300
|
-
maxWidth: `${availableWidth - gap * 2}px`,
|
|
301
|
-
});
|
|
302
|
-
},
|
|
303
|
-
}),
|
|
304
218
|
];
|
|
305
|
-
|
|
306
|
-
|
|
219
|
+
const flipMiddleware = flip({ padding, minSize: this.getContentMinSize() });
|
|
220
|
+
const shiftMiddleware = shift({ limiter: limitShift({ offset: 32 }), padding });
|
|
221
|
+
// `flip` should come before `shift` for edge-aligned placements
|
|
222
|
+
// (see https://floating-ui.com/docs/flip#combining-with-shift).
|
|
223
|
+
if (this.placement?.includes('-'))
|
|
224
|
+
middleware.push(flipMiddleware, shiftMiddleware);
|
|
225
|
+
else
|
|
226
|
+
middleware.push(shiftMiddleware, flipMiddleware);
|
|
227
|
+
if (withSize) {
|
|
228
|
+
middleware.push(size({
|
|
229
|
+
padding,
|
|
230
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
231
|
+
elements.floating.style.setProperty(AVAILABLE_WIDTH_PROPERTY, `${Math.max(0, availableWidth)}px`);
|
|
232
|
+
elements.floating.style.setProperty(AVAILABLE_HEIGHT_PROPERTY, `${Math.max(0, availableHeight)}px`);
|
|
233
|
+
},
|
|
234
|
+
}));
|
|
307
235
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
236
|
+
if (this.arrow)
|
|
237
|
+
middleware.push(arrow({ element: this.arrowRef, padding }));
|
|
238
|
+
if (this.safeSpace)
|
|
239
|
+
middleware.push(safeSpace());
|
|
240
|
+
// `hide` should generally be placed at the end of the middleware chain
|
|
241
|
+
// (see https://floating-ui.com/docs/hide#order).
|
|
242
|
+
if (this.autoHide)
|
|
311
243
|
middleware.push(hide({ strategy: 'referenceHidden' }));
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
placement: this.placement || 'top',
|
|
244
|
+
return computePositionWithSafeArea(this.anchorRef, this.host, {
|
|
245
|
+
placement: this.placement ?? 'top',
|
|
315
246
|
strategy: 'fixed',
|
|
316
247
|
middleware,
|
|
317
248
|
});
|
|
318
249
|
}
|
|
319
|
-
async updateSafeSpaceBoundaries(currentPlacement) {
|
|
320
|
-
const targetRect = this.eventTarget.getBoundingClientRect();
|
|
321
|
-
const popoverRect = this.host.getBoundingClientRect();
|
|
322
|
-
const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
|
|
323
|
-
// Helper function to get positioning data based on placement
|
|
324
|
-
const getPositioningData = (placement, popoverRect, targetRect) => {
|
|
325
|
-
if (placement === 'top' || placement === 'bottom') {
|
|
326
|
-
return {
|
|
327
|
-
popover: {
|
|
328
|
-
y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
|
|
329
|
-
xStart: popoverRect.left,
|
|
330
|
-
xEnd: popoverRect.right,
|
|
331
|
-
},
|
|
332
|
-
trigger: {
|
|
333
|
-
y: placement === 'top' ? targetRect.top : targetRect.bottom,
|
|
334
|
-
xStart: targetRect.left,
|
|
335
|
-
xEnd: targetRect.right,
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
// left or right
|
|
341
|
-
return {
|
|
342
|
-
popover: {
|
|
343
|
-
x: placement === 'left' ? popoverRect.right : popoverRect.left,
|
|
344
|
-
yStart: popoverRect.top,
|
|
345
|
-
yEnd: popoverRect.bottom,
|
|
346
|
-
},
|
|
347
|
-
trigger: {
|
|
348
|
-
x: placement === 'left' ? targetRect.left : targetRect.right,
|
|
349
|
-
yStart: targetRect.top,
|
|
350
|
-
yEnd: targetRect.bottom,
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
|
|
356
|
-
// Clear previous values
|
|
357
|
-
PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
|
|
358
|
-
this.host.style.removeProperty(prop);
|
|
359
|
-
});
|
|
360
|
-
if (isVertical) {
|
|
361
|
-
// For top/bottom placement
|
|
362
|
-
this.host.style.setProperty('--post-safe-space-popover-y', `${posData.popover.y}px`);
|
|
363
|
-
this.host.style.setProperty('--post-safe-space-popover-x-start', `${posData.popover.xStart}px`);
|
|
364
|
-
this.host.style.setProperty('--post-safe-space-popover-x-end', `${posData.popover.xEnd}px`);
|
|
365
|
-
this.host.style.setProperty('--post-safe-space-trigger-y', `${posData.trigger.y}px`);
|
|
366
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
|
|
367
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
// For left/right placement
|
|
371
|
-
this.host.style.setProperty('--post-safe-space-popover-x', `${posData.popover.x}px`);
|
|
372
|
-
this.host.style.setProperty('--post-safe-space-popover-y-start', `${posData.popover.yStart}px`);
|
|
373
|
-
this.host.style.setProperty('--post-safe-space-popover-y-end', `${posData.popover.yEnd}px`);
|
|
374
|
-
this.host.style.setProperty('--post-safe-space-trigger-x', `${posData.trigger.x}px`);
|
|
375
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
|
|
376
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
250
|
render() {
|
|
380
|
-
return (h(Host, { key: '
|
|
381
|
-
this.arrowRef = el;
|
|
382
|
-
} })), h("span", { key: 'deadbcc5892ed545a64b4a0e5e0936e0dd1feb70', part: "post-popovercontainer-border-mask" }), h("slot", { key: '48c4db7ab222f3ef18157ce19d8ba15d75441f98' }))));
|
|
251
|
+
return (h(Host, { key: 'd48b21174f74b790f8a72b4294e9f741c3b64d14', "data-version": version, popover: "auto" }, h("div", { key: '455e84294ecb36e25cc62582eb6c41058f24f6bc', part: "post-popovercontainer-content" }, this.arrow && (h("span", { key: '9d11f2596443876123eeaf5a02430d049c1c8b25', "data-side": this.side, class: "arrow", ref: el => (this.arrowRef = el) })), h("span", { key: 'a562460cdfa5539e7d9c23f1d044a2c045df5b9f', part: "post-popovercontainer-border-mask" }), h("slot", { key: '5aa546bbdf6c70e2a0afabf818d421581060f8a7' }))));
|
|
383
252
|
}
|
|
384
253
|
static get is() { return "post-popovercontainer"; }
|
|
385
254
|
static get encapsulation() { return "shadow"; }
|
|
@@ -414,7 +283,7 @@ export class PostPopovercontainer {
|
|
|
414
283
|
"optional": true,
|
|
415
284
|
"docs": {
|
|
416
285
|
"tags": [],
|
|
417
|
-
"text": "
|
|
286
|
+
"text": "Placement of the popover according to the floating-ui options."
|
|
418
287
|
},
|
|
419
288
|
"getter": false,
|
|
420
289
|
"setter": false,
|
|
@@ -434,7 +303,7 @@ export class PostPopovercontainer {
|
|
|
434
303
|
"optional": true,
|
|
435
304
|
"docs": {
|
|
436
305
|
"tags": [],
|
|
437
|
-
"text": "Gap between the edge of the
|
|
306
|
+
"text": "Gap between the edge of the viewport and the popover."
|
|
438
307
|
},
|
|
439
308
|
"getter": false,
|
|
440
309
|
"setter": false,
|
|
@@ -473,7 +342,7 @@ export class PostPopovercontainer {
|
|
|
473
342
|
"optional": true,
|
|
474
343
|
"docs": {
|
|
475
344
|
"tags": [],
|
|
476
|
-
"text": "
|
|
345
|
+
"text": "Show a little indicator arrow"
|
|
477
346
|
},
|
|
478
347
|
"getter": false,
|
|
479
348
|
"setter": false,
|
|
@@ -482,18 +351,18 @@ export class PostPopovercontainer {
|
|
|
482
351
|
"defaultValue": "false"
|
|
483
352
|
},
|
|
484
353
|
"safeSpace": {
|
|
485
|
-
"type": "
|
|
354
|
+
"type": "boolean",
|
|
486
355
|
"mutable": false,
|
|
487
356
|
"complexType": {
|
|
488
|
-
"original": "
|
|
489
|
-
"resolved": "
|
|
357
|
+
"original": "boolean",
|
|
358
|
+
"resolved": "boolean",
|
|
490
359
|
"references": {}
|
|
491
360
|
},
|
|
492
361
|
"required": false,
|
|
493
362
|
"optional": true,
|
|
494
363
|
"docs": {
|
|
495
364
|
"tags": [],
|
|
496
|
-
"text": "
|
|
365
|
+
"text": "Whether to add a space through which the mouse can move without the popover being hidden."
|
|
497
366
|
},
|
|
498
367
|
"getter": false,
|
|
499
368
|
"setter": false,
|
|
@@ -512,18 +381,37 @@ export class PostPopovercontainer {
|
|
|
512
381
|
"optional": true,
|
|
513
382
|
"docs": {
|
|
514
383
|
"tags": [],
|
|
515
|
-
"text": "Whether to automatically hide the popover when the
|
|
384
|
+
"text": "Whether to automatically hide the popover when the anchor moves outside the scrollport.\n\nIf the `post-header` can cover the anchor, the popover will also be hidden as soon as the\nanchor scrolls behind it."
|
|
516
385
|
},
|
|
517
386
|
"getter": false,
|
|
518
387
|
"setter": false,
|
|
519
388
|
"reflect": false,
|
|
520
389
|
"attribute": "auto-hide"
|
|
390
|
+
},
|
|
391
|
+
"autoResize": {
|
|
392
|
+
"type": "boolean",
|
|
393
|
+
"mutable": false,
|
|
394
|
+
"complexType": {
|
|
395
|
+
"original": "boolean",
|
|
396
|
+
"resolved": "boolean",
|
|
397
|
+
"references": {}
|
|
398
|
+
},
|
|
399
|
+
"required": false,
|
|
400
|
+
"optional": true,
|
|
401
|
+
"docs": {
|
|
402
|
+
"tags": [],
|
|
403
|
+
"text": "Whether to keep resizing the popover while it is open.\n\nEvery popover is sized once when it opens: the space available around the anchor, minus the\n`edgeGap`, becomes the maximum width and height of the popover. The placement is then\nrecalculated for that size.\n\nWith `autoResize`, the popover's size is recalculated on every position update, for example\nwhen the anchor moves while scrolling."
|
|
404
|
+
},
|
|
405
|
+
"getter": false,
|
|
406
|
+
"setter": false,
|
|
407
|
+
"reflect": false,
|
|
408
|
+
"attribute": "auto-resize"
|
|
521
409
|
}
|
|
522
410
|
};
|
|
523
411
|
}
|
|
524
412
|
static get states() {
|
|
525
413
|
return {
|
|
526
|
-
"
|
|
414
|
+
"side": {}
|
|
527
415
|
};
|
|
528
416
|
}
|
|
529
417
|
static get events() {
|
|
@@ -535,7 +423,7 @@ export class PostPopovercontainer {
|
|
|
535
423
|
"composed": true,
|
|
536
424
|
"docs": {
|
|
537
425
|
"tags": [],
|
|
538
|
-
"text": "
|
|
426
|
+
"text": "Emitted just before the popover is shown.\n\nThe payload contains a `first` boolean, that is set to `true` when the popover is about to be\nshown for the first time."
|
|
539
427
|
},
|
|
540
428
|
"complexType": {
|
|
541
429
|
"original": "{ first?: boolean }",
|
|
@@ -550,7 +438,7 @@ export class PostPopovercontainer {
|
|
|
550
438
|
"composed": true,
|
|
551
439
|
"docs": {
|
|
552
440
|
"tags": [],
|
|
553
|
-
"text": "
|
|
441
|
+
"text": "Emitted just after the popover is shown.\n\nThe payload contains a `first` boolean, that is set to `true` when the popover is shown for the\nfirst time."
|
|
554
442
|
},
|
|
555
443
|
"complexType": {
|
|
556
444
|
"original": "{ first?: boolean }",
|
|
@@ -565,7 +453,7 @@ export class PostPopovercontainer {
|
|
|
565
453
|
"composed": true,
|
|
566
454
|
"docs": {
|
|
567
455
|
"tags": [],
|
|
568
|
-
"text": "
|
|
456
|
+
"text": "Emitted just after the popover is hidden."
|
|
569
457
|
},
|
|
570
458
|
"complexType": {
|
|
571
459
|
"original": "any",
|
|
@@ -580,7 +468,7 @@ export class PostPopovercontainer {
|
|
|
580
468
|
"composed": true,
|
|
581
469
|
"docs": {
|
|
582
470
|
"tags": [],
|
|
583
|
-
"text": "
|
|
471
|
+
"text": "Emitted just before the popover's state changes.\n\nThe payload contains a `willOpen` boolean, that is set to `true` when the popover is about to\nbe shown, `false` when it is about to be hidden."
|
|
584
472
|
},
|
|
585
473
|
"complexType": {
|
|
586
474
|
"original": "{ willOpen: boolean }",
|
|
@@ -595,7 +483,7 @@ export class PostPopovercontainer {
|
|
|
595
483
|
"composed": true,
|
|
596
484
|
"docs": {
|
|
597
485
|
"tags": [],
|
|
598
|
-
"text": "
|
|
486
|
+
"text": "Emitted just after the popover's state changes.\n\nThe payload contains a `isOpen` boolean, that is set to `true` when the popover is shown,\n`false` when it is hidden."
|
|
599
487
|
},
|
|
600
488
|
"complexType": {
|
|
601
489
|
"original": "{ isOpen: boolean }",
|
|
@@ -608,11 +496,11 @@ export class PostPopovercontainer {
|
|
|
608
496
|
return {
|
|
609
497
|
"show": {
|
|
610
498
|
"complexType": {
|
|
611
|
-
"signature": "(
|
|
499
|
+
"signature": "(anchor: HTMLElement) => Promise<void>",
|
|
612
500
|
"parameters": [{
|
|
613
|
-
"name": "
|
|
501
|
+
"name": "anchor",
|
|
614
502
|
"type": "HTMLElement",
|
|
615
|
-
"docs": "
|
|
503
|
+
"docs": "the element that the popover is visually anchored to."
|
|
616
504
|
}],
|
|
617
505
|
"references": {
|
|
618
506
|
"Promise": {
|
|
@@ -627,10 +515,10 @@ export class PostPopovercontainer {
|
|
|
627
515
|
"return": "Promise<void>"
|
|
628
516
|
},
|
|
629
517
|
"docs": {
|
|
630
|
-
"text": "
|
|
518
|
+
"text": "Shows the popover.",
|
|
631
519
|
"tags": [{
|
|
632
520
|
"name": "param",
|
|
633
|
-
"text": "
|
|
521
|
+
"text": "anchor the element that the popover is visually anchored to."
|
|
634
522
|
}]
|
|
635
523
|
}
|
|
636
524
|
},
|
|
@@ -647,21 +535,21 @@ export class PostPopovercontainer {
|
|
|
647
535
|
"return": "Promise<void>"
|
|
648
536
|
},
|
|
649
537
|
"docs": {
|
|
650
|
-
"text": "
|
|
538
|
+
"text": "Hides the popover.",
|
|
651
539
|
"tags": []
|
|
652
540
|
}
|
|
653
541
|
},
|
|
654
542
|
"toggle": {
|
|
655
543
|
"complexType": {
|
|
656
|
-
"signature": "(
|
|
544
|
+
"signature": "(anchor: HTMLElement, force?: boolean) => Promise<boolean>",
|
|
657
545
|
"parameters": [{
|
|
658
|
-
"name": "
|
|
546
|
+
"name": "anchor",
|
|
659
547
|
"type": "HTMLElement",
|
|
660
|
-
"docs": "
|
|
548
|
+
"docs": "the element that the popover is visually anchored to."
|
|
661
549
|
}, {
|
|
662
550
|
"name": "force",
|
|
663
551
|
"type": "boolean",
|
|
664
|
-
"docs": "
|
|
552
|
+
"docs": "the next state of the popover."
|
|
665
553
|
}],
|
|
666
554
|
"references": {
|
|
667
555
|
"Promise": {
|
|
@@ -676,13 +564,16 @@ export class PostPopovercontainer {
|
|
|
676
564
|
"return": "Promise<boolean>"
|
|
677
565
|
},
|
|
678
566
|
"docs": {
|
|
679
|
-
"text": "
|
|
567
|
+
"text": "Toggles the popover's state from hidden to showing and vice versa.\n\nIf `state` is specified, the popover is forced to be shown if the is set to `true`, or hidden\nif it is set to `false`.",
|
|
680
568
|
"tags": [{
|
|
681
569
|
"name": "param",
|
|
682
|
-
"text": "
|
|
570
|
+
"text": "anchor the element that the popover is visually anchored to."
|
|
683
571
|
}, {
|
|
684
572
|
"name": "param",
|
|
685
|
-
"text": "force
|
|
573
|
+
"text": "force the next state of the popover."
|
|
574
|
+
}, {
|
|
575
|
+
"name": "returns",
|
|
576
|
+
"text": "the new state of the popover: `true` if it is shown, `false` if it is hidden."
|
|
686
577
|
}]
|
|
687
578
|
}
|
|
688
579
|
}
|
|
@@ -696,6 +587,3 @@ __decorate([
|
|
|
696
587
|
__decorate([
|
|
697
588
|
Type('number')
|
|
698
589
|
], PostPopovercontainer.prototype, "edgeGap", void 0);
|
|
699
|
-
__decorate([
|
|
700
|
-
OneOf(['triangle', 'trapezoid'])
|
|
701
|
-
], PostPopovercontainer.prototype, "safeSpace", void 0);
|