@swisspost/design-system-components 9.0.1 → 10.0.0-next.38
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/.config/bindings.angular.js +4 -0
- package/dist/cjs/breakpoints-cdf1b747.js +59 -0
- package/dist/cjs/check-non-empty-bd99d236.js +15 -0
- package/dist/cjs/check-one-of-75d270b5.js +13 -0
- package/dist/cjs/check-type-cdbf6d29.js +21 -0
- package/dist/cjs/check-url-220a286c.js +19 -0
- package/dist/cjs/event-guard-efabc84f.js +47 -0
- package/dist/cjs/fade-72d5ef55.js +14 -0
- package/dist/cjs/get-root-8102fecd.js +17 -0
- package/dist/cjs/index-23e36ff7.js +37 -0
- package/dist/cjs/{index-e1f32cce.js → index-b60129c4.js} +35 -15
- package/dist/cjs/index.browser-4af21c17.js +16 -0
- package/dist/cjs/index.cjs.js +57 -28
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/long-press-event-6e62d113.js +266 -0
- package/dist/cjs/{package-93f142ae.js → package-3e61e6f3.js} +1 -1
- package/dist/cjs/{post-accordion-60af96cf.js → post-accordion-e54524be.js} +11 -12
- package/dist/cjs/post-accordion-item-86f11a16.js +64 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +10 -6
- package/dist/cjs/post-accordion.cjs.entry.js +6 -4
- package/dist/cjs/post-avatar-22bfd12e.js +145 -0
- package/dist/cjs/post-avatar.cjs.entry.js +14 -0
- package/dist/cjs/post-back-to-top-f682ea05.js +96 -0
- package/dist/cjs/post-back-to-top.cjs.entry.js +16 -0
- package/dist/cjs/post-banner-5c749a94.js +92 -0
- package/dist/cjs/post-banner.cjs.entry.js +20 -0
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +18 -0
- package/dist/cjs/post-breadcrumbs-76f55ae5.js +120 -0
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +13 -0
- package/dist/cjs/post-card-control-161a7102.js +269 -0
- package/dist/cjs/post-card-control.cjs.entry.js +6 -5
- package/dist/cjs/post-closebutton_15.cjs.entry.js +36 -0
- package/dist/cjs/{post-collapsible-trigger-3de8fe4e.js → post-collapsible-trigger-6cdf4481.js} +62 -76
- package/dist/cjs/post-collapsible_2.cjs.entry.js +11 -7
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer-15d78645.js +38 -0
- package/dist/cjs/post-footer.cjs.entry.js +12 -0
- package/dist/cjs/post-linkarea-095d1928.js +30 -0
- package/dist/cjs/post-linkarea.cjs.entry.js +11 -0
- package/dist/cjs/post-menu-item-387e079b.js +68 -0
- package/dist/cjs/post-popover-388c8091.js +135 -0
- package/dist/cjs/post-popover.cjs.entry.js +4 -3
- package/dist/cjs/{post-rating-21f9c46d.js → post-rating-246e4d89.js} +4 -4
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-0e9d0e06.js +34 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +6 -4
- package/dist/cjs/{post-tab-panel-dd58f425.js → post-tab-panel-f952714f.js} +5 -4
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
- package/dist/cjs/{post-tabs-83191b9a.js → post-tabs-97c30d81.js} +14 -16
- package/dist/cjs/post-tabs.cjs.entry.js +5 -4
- package/dist/cjs/post-tag-58003cf0.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/post-togglebutton-87c984d8.js +4494 -0
- package/dist/cjs/{post-tooltip-782f020b.js → post-tooltip-28e7711a.js} +10 -6
- package/dist/cjs/{post-tooltip-trigger-b2aeb636.js → post-tooltip-trigger-cbc53d14.js} +17 -280
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +5 -4
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -4
- package/dist/cjs/slide-cd1f09b3.js +28 -0
- package/dist/collection/animations/collapse.js +8 -6
- package/dist/collection/animations/fade.js +6 -2
- package/dist/collection/animations/slide.js +23 -0
- package/dist/collection/collection-manifest.json +22 -3
- package/dist/collection/components/post-accordion/post-accordion.css +1 -1
- package/dist/collection/components/post-accordion/post-accordion.js +8 -10
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +30 -16
- package/dist/collection/components/post-avatar/post-avatar.css +1 -0
- package/dist/collection/components/post-avatar/post-avatar.js +233 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +127 -0
- package/dist/collection/components/post-banner/banner-types.js +1 -0
- package/dist/collection/components/post-banner/post-banner.css +1 -0
- package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +44 -72
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +96 -0
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -0
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +160 -0
- package/dist/collection/components/post-card-control/post-card-control.css +1 -31
- package/dist/collection/components/post-card-control/post-card-control.js +20 -24
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -0
- package/dist/collection/components/post-closebutton/post-closebutton.js +23 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +6 -3
- package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +43 -45
- package/dist/collection/components/post-footer/post-footer.css +1 -0
- package/dist/collection/components/post-footer/post-footer.js +75 -0
- package/dist/collection/components/post-header/post-header.css +1 -0
- package/dist/collection/components/post-header/post-header.js +320 -0
- package/dist/collection/components/post-icon/post-icon.js +58 -55
- package/dist/collection/components/post-language-option/post-language-option.css +1 -0
- package/dist/collection/components/post-language-option/post-language-option.js +237 -0
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
- package/dist/collection/components/post-language-switch/post-language-switch.js +186 -0
- package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
- package/dist/collection/components/post-linkarea/post-linkarea.css +1 -0
- package/dist/collection/components/post-linkarea/post-linkarea.js +30 -0
- package/dist/collection/components/post-list/post-list.css +1 -0
- package/dist/collection/components/post-list/post-list.js +88 -0
- package/dist/collection/components/post-list-item/post-list-item.css +1 -0
- package/dist/collection/components/post-list-item/post-list-item.js +26 -0
- package/dist/collection/components/post-logo/post-logo.css +1 -1
- package/dist/collection/components/post-logo/post-logo.js +2 -2
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +184 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +275 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +133 -0
- package/dist/collection/components/post-menu/post-menu.css +1 -0
- package/dist/collection/components/post-menu/post-menu.js +294 -0
- package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +120 -0
- package/dist/collection/components/post-popover/post-popover.css +1 -31
- package/dist/collection/components/post-popover/post-popover.js +16 -13
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -31
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +39 -6
- package/dist/collection/components/post-rating/post-rating.css +1 -31
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +1 -31
- package/dist/collection/components/post-tab-header/post-tab-header.js +6 -5
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +4 -3
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +7 -15
- package/dist/collection/components/post-tag/post-tag.css +1 -31
- package/dist/collection/components/post-tag/post-tag.js +2 -2
- package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +74 -0
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +6 -3
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +14 -14
- package/dist/collection/index.js +21 -2
- package/dist/collection/utils/attribute-observer.js +6 -5
- package/dist/collection/utils/breakpoints.js +52 -0
- package/dist/collection/utils/component-on-ready.js +4 -4
- package/dist/collection/utils/debounce.js +2 -1
- package/dist/collection/utils/environment.js +2 -0
- package/dist/collection/utils/event-guard.js +43 -0
- package/dist/collection/utils/get-focusable-children.js +33 -0
- package/dist/collection/utils/get-root.js +6 -1
- package/dist/collection/utils/index.js +5 -0
- package/dist/collection/utils/is-motion-reduced.js +2 -1
- package/dist/collection/utils/property-checkers/check-non-empty.js +6 -2
- package/dist/collection/utils/property-checkers/check-one-of.js +8 -3
- package/dist/collection/utils/property-checkers/check-pattern.js +8 -3
- package/dist/collection/utils/property-checkers/check-type.js +11 -6
- package/dist/collection/utils/property-checkers/check-url.js +11 -6
- package/dist/collection/utils/property-checkers/empty-or.js +5 -2
- package/dist/collection/utils/sass-export.js +8 -5
- package/dist/components/breakpoints.js +56 -0
- package/dist/components/check-non-empty.js +6 -2
- package/dist/components/check-one-of.js +8 -3
- package/dist/components/check-type.js +11 -6
- package/dist/components/event-guard.js +45 -0
- package/dist/components/fade.js +6 -2
- package/dist/components/get-focusable-children.js +35 -0
- package/dist/components/get-root.js +15 -0
- package/dist/components/index.browser.js +14 -0
- package/dist/components/index.js +21 -2
- package/dist/components/index2.js +25 -12
- package/dist/components/long-press-event.js +264 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +37 -18
- package/dist/components/post-accordion2.js +8 -9
- package/dist/components/post-avatar.d.ts +11 -0
- package/dist/components/post-avatar.js +6 -0
- package/dist/components/post-avatar2.js +170 -0
- package/dist/components/post-back-to-top.d.ts +11 -0
- package/dist/components/post-back-to-top.js +6 -0
- package/dist/components/post-back-to-top2.js +121 -0
- package/dist/components/post-banner.d.ts +11 -0
- package/dist/components/post-banner.js +6 -0
- package/dist/components/post-banner2.js +127 -0
- package/dist/components/post-breadcrumb-item.d.ts +11 -0
- package/dist/components/post-breadcrumb-item.js +6 -0
- package/dist/components/post-breadcrumb-item2.js +82 -0
- package/dist/components/post-breadcrumbs.d.ts +11 -0
- package/dist/components/post-breadcrumbs.js +6 -0
- package/dist/components/post-breadcrumbs2.js +177 -0
- package/dist/components/post-card-control2.js +16 -19
- package/dist/components/post-closebutton.d.ts +11 -0
- package/dist/components/post-closebutton.js +6 -0
- package/dist/components/post-closebutton2.js +39 -0
- package/dist/components/post-collapsible-trigger2.js +47 -64
- package/dist/components/post-collapsible2.js +17 -12
- package/dist/components/post-footer.d.ts +11 -0
- package/dist/components/post-footer.js +6 -0
- package/dist/components/post-footer2.js +78 -0
- package/dist/components/post-header.d.ts +11 -0
- package/dist/components/post-header.js +6 -0
- package/dist/components/post-header2.js +399 -0
- package/dist/components/post-icon2.js +59 -55
- package/dist/components/post-language-option.d.ts +11 -0
- package/dist/components/post-language-option.js +6 -0
- package/dist/components/post-language-option2.js +103 -0
- package/dist/components/post-language-switch.d.ts +11 -0
- package/dist/components/post-language-switch.js +6 -0
- package/dist/components/post-language-switch2.js +145 -0
- package/dist/components/post-linkarea.d.ts +11 -0
- package/dist/components/post-linkarea.js +6 -0
- package/dist/components/post-linkarea2.js +43 -0
- package/dist/components/post-list-item.d.ts +11 -0
- package/dist/components/post-list-item.js +6 -0
- package/dist/components/post-list-item2.js +36 -0
- package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/dist/components/post-list.js +6 -0
- package/dist/components/post-list2.js +54 -0
- package/dist/components/post-logo2.js +4 -3
- package/dist/components/post-mainnavigation.d.ts +11 -0
- package/dist/components/post-mainnavigation.js +6 -0
- package/dist/components/post-mainnavigation2.js +183 -0
- package/dist/components/post-megadropdown-trigger.d.ts +11 -0
- package/dist/components/post-megadropdown-trigger.js +6 -0
- package/dist/components/post-megadropdown-trigger2.js +121 -0
- package/dist/components/post-megadropdown.d.ts +11 -0
- package/dist/components/post-megadropdown.js +6 -0
- package/dist/components/post-megadropdown2.js +190 -0
- package/dist/components/post-menu-item.d.ts +11 -0
- package/dist/components/post-menu-item.js +6 -0
- package/dist/components/post-menu-item2.js +27 -0
- package/dist/components/post-menu-trigger.d.ts +11 -0
- package/dist/components/post-menu-trigger.js +6 -0
- package/dist/components/post-menu-trigger2.js +109 -0
- package/dist/components/post-menu.d.ts +11 -0
- package/dist/components/post-menu.js +6 -0
- package/dist/components/post-menu2.js +192 -0
- package/dist/components/post-popover2.js +20 -16
- package/dist/components/post-popovercontainer2.js +788 -73
- package/dist/components/post-rating2.js +2 -2
- package/dist/components/post-tab-header2.js +8 -6
- package/dist/components/post-tab-panel2.js +4 -3
- package/dist/components/post-tabs2.js +11 -13
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/post-togglebutton.d.ts +11 -0
- package/dist/components/post-togglebutton.js +6 -0
- package/dist/components/post-togglebutton2.js +62 -0
- package/dist/components/post-tooltip-trigger2.js +14 -277
- package/dist/components/post-tooltip2.js +7 -3
- package/dist/components/slide.js +25 -0
- package/dist/docs.json +1977 -287
- package/dist/esm/breakpoints-7812702e.js +56 -0
- package/dist/esm/check-non-empty-258a56b3.js +13 -0
- package/dist/esm/check-one-of-0bee20f5.js +11 -0
- package/dist/esm/check-type-37d5d307.js +19 -0
- package/dist/esm/check-url-17962bc8.js +17 -0
- package/dist/esm/event-guard-538ee077.js +45 -0
- package/dist/esm/fade-1f3cacf4.js +11 -0
- package/dist/esm/get-root-1b1af46f.js +15 -0
- package/dist/esm/index-8f8fe5b0.js +32 -0
- package/dist/esm/{index-e1b64755.js → index-f4d19816.js} +35 -15
- package/dist/esm/index.browser-ff103197.js +14 -0
- package/dist/esm/index.js +33 -23
- package/dist/esm/loader.js +3 -3
- package/dist/esm/long-press-event-04d24397.js +264 -0
- package/dist/esm/package-33ac2576.js +3 -0
- package/dist/esm/{post-accordion-bcfe7e61.js → post-accordion-03796d13.js} +11 -12
- package/dist/esm/post-accordion-item-d29c49e5.js +62 -0
- package/dist/esm/post-accordion-item.entry.js +10 -6
- package/dist/esm/post-accordion.entry.js +6 -4
- package/dist/esm/post-avatar-639dc17a.js +143 -0
- package/dist/esm/post-avatar.entry.js +6 -0
- package/dist/esm/post-back-to-top-8099279e.js +94 -0
- package/dist/esm/post-back-to-top.entry.js +8 -0
- package/dist/esm/post-banner-54834fbf.js +90 -0
- package/dist/esm/post-banner.entry.js +12 -0
- package/dist/esm/post-breadcrumb-item_2.entry.js +9 -0
- package/dist/esm/post-breadcrumbs-caf56014.js +118 -0
- package/dist/esm/post-breadcrumbs.entry.js +5 -0
- package/dist/esm/post-card-control-b063586b.js +267 -0
- package/dist/esm/post-card-control.entry.js +6 -5
- package/dist/esm/post-closebutton_15.entry.js +14 -0
- package/dist/esm/{post-collapsible-trigger-3168178e.js → post-collapsible-trigger-727bcde1.js} +62 -76
- package/dist/esm/post-collapsible_2.entry.js +11 -7
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer-16f1a8de.js +36 -0
- package/dist/esm/post-footer.entry.js +4 -0
- package/dist/esm/post-linkarea-4e4228fb.js +28 -0
- package/dist/esm/post-linkarea.entry.js +3 -0
- package/dist/esm/post-menu-item-e9dd8173.js +65 -0
- package/dist/esm/post-popover-46ede6b5.js +133 -0
- package/dist/esm/post-popover.entry.js +4 -3
- package/dist/esm/{post-rating-0fd5de37.js → post-rating-8d0d970b.js} +4 -4
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-8224c7c2.js +32 -0
- package/dist/esm/post-tab-header.entry.js +6 -4
- package/dist/esm/{post-tab-panel-6b1219e0.js → post-tab-panel-dfdeccd3.js} +5 -4
- package/dist/esm/post-tab-panel.entry.js +4 -3
- package/dist/esm/{post-tabs-b8ff3c5d.js → post-tabs-fabd0569.js} +14 -16
- package/dist/esm/post-tabs.entry.js +5 -4
- package/dist/esm/post-tag-13994238.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/post-togglebutton-87967c5b.js +4478 -0
- package/dist/esm/{post-tooltip-aa745743.js → post-tooltip-eecaa4c7.js} +10 -6
- package/dist/esm/{post-tooltip-trigger-ce0b4106.js → post-tooltip-trigger-642cbb22.js} +17 -280
- package/dist/esm/post-tooltip-trigger.entry.js +5 -4
- package/dist/esm/post-tooltip.entry.js +5 -4
- package/dist/esm/slide-cd2850ee.js +25 -0
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0539071d.js +1 -0
- package/dist/post-components/p-0889c759.js +1 -0
- package/dist/post-components/p-0dcd25ab.js +1 -0
- package/dist/post-components/p-181c73d5.js +1 -0
- package/dist/post-components/p-19317b15.js +8 -0
- package/dist/post-components/p-1ef9415b.js +1 -0
- package/dist/post-components/p-24d0695f.entry.js +1 -0
- package/dist/post-components/p-2e50a07d.entry.js +1 -0
- package/dist/post-components/p-30eb4d87.js +1 -0
- package/dist/post-components/p-46008c18.entry.js +1 -0
- package/dist/post-components/p-47ab2c2b.entry.js +1 -0
- package/dist/post-components/p-4c049de0.entry.js +1 -0
- package/dist/post-components/p-4c4acc32.entry.js +1 -0
- package/dist/post-components/p-5d473fcd.js +1 -0
- package/dist/post-components/p-5d539b30.js +1 -0
- package/dist/post-components/p-64e3de38.js +1 -0
- package/dist/post-components/p-6783e509.entry.js +1 -0
- package/dist/post-components/p-692ba59d.js +1 -0
- package/dist/post-components/p-6933fb57.entry.js +1 -0
- package/dist/post-components/p-6b31a76a.js +1 -0
- package/dist/post-components/p-72197a6b.js +1 -0
- package/dist/post-components/p-722ffaae.js +1 -0
- package/dist/post-components/p-7709c14a.js +1 -0
- package/dist/post-components/p-77910344.entry.js +1 -0
- package/dist/post-components/p-80e5100e.entry.js +1 -0
- package/dist/post-components/p-84fbf49c.js +1 -0
- package/dist/post-components/p-85fdc2d3.js +1 -0
- package/dist/post-components/p-8c09291c.js +1 -0
- package/dist/post-components/p-8db32dab.js +8 -0
- package/dist/post-components/p-93da1a5f.js +1 -0
- package/dist/post-components/p-9b052461.js +1 -0
- package/dist/post-components/p-9b8ee310.entry.js +1 -0
- package/dist/post-components/{p-3eab790d.js → p-9e461613.js} +2 -2
- package/dist/post-components/p-9efb84d3.entry.js +1 -0
- package/dist/post-components/p-9fbf2f82.entry.js +1 -0
- package/dist/post-components/p-a07f85ee.js +1 -0
- package/dist/post-components/p-a25019de.js +1 -0
- package/dist/post-components/p-a710ee00.js +1 -0
- package/dist/post-components/p-b94e5b4d.entry.js +1 -0
- package/dist/post-components/p-c2348d3d.js +1 -0
- package/dist/post-components/p-c65f32b0.js +1 -0
- package/dist/post-components/p-c6b03446.entry.js +1 -0
- package/dist/post-components/p-d0dfd5f9.js +1 -0
- package/dist/post-components/p-d45df336.js +1 -0
- package/dist/post-components/p-d4890d50.entry.js +1 -0
- package/dist/post-components/p-d5210531.entry.js +1 -0
- package/dist/post-components/p-dd39c542.entry.js +1 -0
- package/dist/post-components/p-df6c8a4c.js +1 -0
- package/dist/post-components/p-e068a41e.js +1 -0
- package/dist/post-components/p-e585c6fe.js +1 -0
- package/dist/post-components/p-f2c4a48d.js +1 -0
- package/dist/post-components/p-f31b9b5d.entry.js +1 -0
- package/dist/post-components/p-f58252d5.entry.js +1 -0
- package/dist/post-components/p-fda767f0.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/animations/collapse.d.ts +2 -2
- package/dist/types/animations/fade.d.ts +2 -2
- package/dist/types/animations/slide.d.ts +2 -0
- package/dist/types/components/post-accordion/post-accordion.d.ts +1 -1
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +8 -2
- package/dist/types/components/post-avatar/post-avatar.d.ts +51 -0
- package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +21 -0
- package/dist/types/components/post-banner/banner-types.d.ts +2 -0
- package/dist/types/components/post-banner/post-banner.d.ts +49 -0
- package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +20 -0
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +30 -0
- package/dist/types/components/post-card-control/post-card-control.d.ts +9 -9
- package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
- package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +9 -14
- package/dist/types/components/post-footer/post-footer.d.ts +23 -0
- package/dist/types/components/post-header/post-header.d.ts +52 -0
- package/dist/types/components/post-icon/post-icon.d.ts +10 -6
- package/dist/types/components/post-language-option/post-language-option.d.ts +49 -0
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +39 -0
- package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
- package/dist/types/components/post-linkarea/post-linkarea.d.ts +5 -0
- package/dist/types/components/post-list/post-list.d.ts +24 -0
- package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
- package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +46 -0
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +59 -0
- package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +33 -0
- package/dist/types/components/post-menu/post-menu.d.ts +49 -0
- package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
- package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +28 -0
- package/dist/types/components/post-popover/post-popover.d.ts +6 -4
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +9 -1
- package/dist/types/components/post-tab-header/post-tab-header.d.ts +1 -1
- package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
- package/dist/types/components/post-tag/post-tag.d.ts +2 -2
- package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
- package/dist/types/components/post-tooltip/post-tooltip.d.ts +1 -0
- package/dist/types/components/post-tooltip-trigger/post-tooltip-trigger.d.ts +0 -1
- package/dist/types/components.d.ts +603 -50
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/.config/bindings.angular.d.ts +2 -0
- package/dist/types/index.d.ts +22 -3
- package/dist/types/popover-fn.d.ts +11 -0
- package/dist/types/utils/attribute-observer.d.ts +1 -1
- package/dist/types/utils/breakpoints.d.ts +12 -0
- package/dist/types/utils/component-on-ready.d.ts +1 -1
- package/dist/types/utils/environment.d.ts +2 -0
- package/dist/types/utils/event-guard.d.ts +4 -0
- package/dist/types/utils/get-focusable-children.d.ts +1 -0
- package/dist/types/utils/get-root.d.ts +5 -1
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/property-checkers/check-non-empty.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-one-of.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-pattern.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-type.d.ts +3 -1
- package/dist/types/utils/property-checkers/check-url.d.ts +3 -1
- package/dist/types/utils/property-checkers/index.d.ts +12 -4
- package/dist/types/utils/sass-export.d.ts +5 -1
- package/loaders/breakpoints.js +56 -0
- package/loaders/check-non-empty.js +6 -2
- package/loaders/check-one-of.js +8 -3
- package/loaders/check-type.js +11 -6
- package/loaders/event-guard.js +45 -0
- package/loaders/fade.js +6 -2
- package/loaders/get-focusable-children.js +35 -0
- package/loaders/get-root.js +15 -0
- package/loaders/index.browser.js +14 -0
- package/loaders/index.d.ts +40 -2
- package/loaders/index.js +22 -2
- package/loaders/index2.js +25 -12
- package/loaders/long-press-event.js +264 -0
- package/loaders/package.js +1 -1
- package/loaders/post-accordion-item.js +1 -82
- package/loaders/post-accordion-item2.js +103 -0
- package/loaders/post-accordion.js +8 -9
- package/loaders/post-avatar.d.ts +11 -0
- package/loaders/post-avatar.js +173 -0
- package/loaders/post-back-to-top.d.ts +11 -0
- package/loaders/post-back-to-top.js +124 -0
- package/loaders/post-banner.d.ts +11 -0
- package/loaders/post-banner.js +130 -0
- package/loaders/post-breadcrumb-item.d.ts +11 -0
- package/loaders/post-breadcrumb-item.js +6 -0
- package/loaders/post-breadcrumb-item2.js +82 -0
- package/loaders/post-breadcrumbs.d.ts +11 -0
- package/loaders/post-breadcrumbs.js +180 -0
- package/loaders/post-card-control.js +16 -19
- package/loaders/post-closebutton.d.ts +11 -0
- package/loaders/post-closebutton.js +42 -0
- package/loaders/post-collapsible-trigger2.js +47 -64
- package/loaders/post-collapsible2.js +16 -11
- package/loaders/post-footer.d.ts +11 -0
- package/loaders/post-footer.js +81 -0
- package/loaders/post-header.d.ts +11 -0
- package/loaders/post-header.js +402 -0
- package/loaders/post-icon2.js +59 -55
- package/loaders/post-language-option.d.ts +11 -0
- package/loaders/post-language-option.js +106 -0
- package/loaders/post-language-switch.d.ts +11 -0
- package/loaders/post-language-switch.js +148 -0
- package/loaders/post-linkarea.d.ts +11 -0
- package/loaders/post-linkarea.js +46 -0
- package/loaders/post-list-item.d.ts +11 -0
- package/loaders/post-list-item.js +39 -0
- package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
- package/loaders/post-list.js +57 -0
- package/loaders/post-logo.js +5 -4
- package/loaders/post-mainnavigation.d.ts +11 -0
- package/loaders/post-mainnavigation.js +186 -0
- package/loaders/post-megadropdown-trigger.d.ts +11 -0
- package/loaders/post-megadropdown-trigger.js +124 -0
- package/loaders/post-megadropdown.d.ts +11 -0
- package/loaders/post-megadropdown.js +193 -0
- package/loaders/post-menu-item.d.ts +11 -0
- package/loaders/post-menu-item.js +6 -0
- package/loaders/post-menu-item2.js +27 -0
- package/loaders/post-menu-trigger.d.ts +11 -0
- package/loaders/post-menu-trigger.js +6 -0
- package/loaders/post-menu-trigger2.js +109 -0
- package/loaders/post-menu.d.ts +11 -0
- package/loaders/post-menu.js +6 -0
- package/loaders/post-menu2.js +192 -0
- package/loaders/post-popover.js +20 -16
- package/loaders/post-popovercontainer2.js +788 -73
- package/loaders/post-rating.js +2 -2
- package/loaders/post-tab-header.js +8 -6
- package/loaders/post-tab-panel.js +4 -3
- package/loaders/post-tabs.js +11 -13
- package/loaders/post-tag.js +2 -2
- package/loaders/post-togglebutton.d.ts +11 -0
- package/loaders/post-togglebutton.js +65 -0
- package/loaders/post-tooltip-trigger.js +14 -277
- package/loaders/post-tooltip.js +7 -3
- package/loaders/slide.js +25 -0
- package/package.json +45 -33
- package/dist/cjs/check-non-empty-eeaa8f77.js +0 -11
- package/dist/cjs/check-one-of-f4f5d0c0.js +0 -8
- package/dist/cjs/check-type-64af82a9.js +0 -16
- package/dist/cjs/fade-35a3633a.js +0 -10
- package/dist/cjs/index-824d2b71.js +0 -39
- package/dist/cjs/post-accordion-item-744c881d.js +0 -52
- package/dist/cjs/post-alert-2a768f58.js +0 -99
- package/dist/cjs/post-alert.cjs.entry.js +0 -17
- package/dist/cjs/post-card-control-197c8e44.js +0 -272
- package/dist/cjs/post-icon-df629079.js +0 -139
- package/dist/cjs/post-icon.cjs.entry.js +0 -16
- package/dist/cjs/post-logo-7caeb918.js +0 -39
- package/dist/cjs/post-logo.cjs.entry.js +0 -15
- package/dist/cjs/post-popover-090c3d01.js +0 -131
- package/dist/cjs/post-popovercontainer-872681bf.js +0 -2281
- package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
- package/dist/cjs/post-tab-header-422d0f03.js +0 -32
- package/dist/cjs/post-tag-c72183f2.js +0 -47
- package/dist/collection/components/post-alert/alert-types.js +0 -1
- package/dist/collection/components/post-alert/post-alert.css +0 -35
- package/dist/components/post-alert.js +0 -6
- package/dist/components/post-alert2.js +0 -136
- package/dist/esm/check-non-empty-58bd6b17.js +0 -9
- package/dist/esm/check-one-of-6b3ef8eb.js +0 -6
- package/dist/esm/check-type-8828dbe4.js +0 -14
- package/dist/esm/fade-7fd71785.js +0 -7
- package/dist/esm/index-69587a51.js +0 -34
- package/dist/esm/package-45827c3b.js +0 -3
- package/dist/esm/post-accordion-item-8869c90b.js +0 -50
- package/dist/esm/post-alert-21fd0068.js +0 -97
- package/dist/esm/post-alert.entry.js +0 -9
- package/dist/esm/post-card-control-60c132dc.js +0 -270
- package/dist/esm/post-icon-2e2e18ad.js +0 -137
- package/dist/esm/post-icon.entry.js +0 -8
- package/dist/esm/post-logo-f364eb72.js +0 -37
- package/dist/esm/post-logo.entry.js +0 -7
- package/dist/esm/post-popover-697201cd.js +0 -129
- package/dist/esm/post-popovercontainer-2b5f37fb.js +0 -2279
- package/dist/esm/post-popovercontainer.entry.js +0 -3
- package/dist/esm/post-tab-header-c8898fa2.js +0 -30
- package/dist/esm/post-tag-83470f28.js +0 -45
- package/dist/post-components/p-08dc45bb.entry.js +0 -1
- package/dist/post-components/p-1a48d1b0.js +0 -1
- package/dist/post-components/p-2737eaf5.js +0 -1
- package/dist/post-components/p-2b61a526.entry.js +0 -1
- package/dist/post-components/p-3f5bf5d9.entry.js +0 -1
- package/dist/post-components/p-40e5bb56.entry.js +0 -1
- package/dist/post-components/p-4a3f67ab.js +0 -1
- package/dist/post-components/p-56ca6bb5.js +0 -1
- package/dist/post-components/p-58cbb854.entry.js +0 -1
- package/dist/post-components/p-5c557e64.js +0 -1
- package/dist/post-components/p-5ce2abc9.entry.js +0 -1
- package/dist/post-components/p-5f08d625.js +0 -15
- package/dist/post-components/p-611b3c41.js +0 -1
- package/dist/post-components/p-7069ac74.entry.js +0 -1
- package/dist/post-components/p-755b2746.js +0 -1
- package/dist/post-components/p-788e64fb.js +0 -1
- package/dist/post-components/p-799cf60e.js +0 -1
- package/dist/post-components/p-7bbcc8ee.js +0 -1
- package/dist/post-components/p-7cdf9571.entry.js +0 -1
- package/dist/post-components/p-7e4181ce.entry.js +0 -1
- package/dist/post-components/p-9409f729.js +0 -1
- package/dist/post-components/p-a07846ea.js +0 -1
- package/dist/post-components/p-a4560368.js +0 -1
- package/dist/post-components/p-a503cb2c.entry.js +0 -1
- package/dist/post-components/p-b095519d.js +0 -1
- package/dist/post-components/p-b46e2451.js +0 -1
- package/dist/post-components/p-b7207224.js +0 -1
- package/dist/post-components/p-bafc0491.js +0 -1
- package/dist/post-components/p-c078fd94.entry.js +0 -1
- package/dist/post-components/p-c0aebe5e.entry.js +0 -1
- package/dist/post-components/p-c7e4acde.js +0 -1
- package/dist/post-components/p-ca71a3ff.entry.js +0 -1
- package/dist/post-components/p-d582cc10.js +0 -1
- package/dist/post-components/p-e49f57c0.entry.js +0 -1
- package/dist/post-components/p-eb712f9b.entry.js +0 -1
- package/dist/post-components/p-eebd060d.js +0 -1
- package/dist/post-components/p-f7cead60.entry.js +0 -1
- package/dist/post-components/p-ffd75503.js +0 -1
- package/dist/types/components/post-alert/alert-types.d.ts +0 -2
- package/dist/types/components/post-alert/post-alert.d.ts +0 -54
- package/loaders/post-alert.js +0 -139
|
@@ -1,2281 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-e1f32cce.js');
|
|
4
|
-
const _package = require('./package-93f142ae.js');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Custom positioning reference element.
|
|
8
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
12
|
-
const alignments = ['start', 'end'];
|
|
13
|
-
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
14
|
-
const min = Math.min;
|
|
15
|
-
const max = Math.max;
|
|
16
|
-
const round = Math.round;
|
|
17
|
-
const floor = Math.floor;
|
|
18
|
-
const createCoords = v => ({
|
|
19
|
-
x: v,
|
|
20
|
-
y: v
|
|
21
|
-
});
|
|
22
|
-
const oppositeSideMap = {
|
|
23
|
-
left: 'right',
|
|
24
|
-
right: 'left',
|
|
25
|
-
bottom: 'top',
|
|
26
|
-
top: 'bottom'
|
|
27
|
-
};
|
|
28
|
-
const oppositeAlignmentMap = {
|
|
29
|
-
start: 'end',
|
|
30
|
-
end: 'start'
|
|
31
|
-
};
|
|
32
|
-
function clamp(start, value, end) {
|
|
33
|
-
return max(start, min(value, end));
|
|
34
|
-
}
|
|
35
|
-
function evaluate(value, param) {
|
|
36
|
-
return typeof value === 'function' ? value(param) : value;
|
|
37
|
-
}
|
|
38
|
-
function getSide(placement) {
|
|
39
|
-
return placement.split('-')[0];
|
|
40
|
-
}
|
|
41
|
-
function getAlignment(placement) {
|
|
42
|
-
return placement.split('-')[1];
|
|
43
|
-
}
|
|
44
|
-
function getOppositeAxis(axis) {
|
|
45
|
-
return axis === 'x' ? 'y' : 'x';
|
|
46
|
-
}
|
|
47
|
-
function getAxisLength(axis) {
|
|
48
|
-
return axis === 'y' ? 'height' : 'width';
|
|
49
|
-
}
|
|
50
|
-
function getSideAxis(placement) {
|
|
51
|
-
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
52
|
-
}
|
|
53
|
-
function getAlignmentAxis(placement) {
|
|
54
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
55
|
-
}
|
|
56
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
57
|
-
if (rtl === void 0) {
|
|
58
|
-
rtl = false;
|
|
59
|
-
}
|
|
60
|
-
const alignment = getAlignment(placement);
|
|
61
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
62
|
-
const length = getAxisLength(alignmentAxis);
|
|
63
|
-
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
64
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
65
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
66
|
-
}
|
|
67
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
68
|
-
}
|
|
69
|
-
function getExpandedPlacements(placement) {
|
|
70
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
71
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
72
|
-
}
|
|
73
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
74
|
-
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
75
|
-
}
|
|
76
|
-
function getSideList(side, isStart, rtl) {
|
|
77
|
-
const lr = ['left', 'right'];
|
|
78
|
-
const rl = ['right', 'left'];
|
|
79
|
-
const tb = ['top', 'bottom'];
|
|
80
|
-
const bt = ['bottom', 'top'];
|
|
81
|
-
switch (side) {
|
|
82
|
-
case 'top':
|
|
83
|
-
case 'bottom':
|
|
84
|
-
if (rtl) return isStart ? rl : lr;
|
|
85
|
-
return isStart ? lr : rl;
|
|
86
|
-
case 'left':
|
|
87
|
-
case 'right':
|
|
88
|
-
return isStart ? tb : bt;
|
|
89
|
-
default:
|
|
90
|
-
return [];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
94
|
-
const alignment = getAlignment(placement);
|
|
95
|
-
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
96
|
-
if (alignment) {
|
|
97
|
-
list = list.map(side => side + "-" + alignment);
|
|
98
|
-
if (flipAlignment) {
|
|
99
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return list;
|
|
103
|
-
}
|
|
104
|
-
function getOppositePlacement(placement) {
|
|
105
|
-
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
106
|
-
}
|
|
107
|
-
function expandPaddingObject(padding) {
|
|
108
|
-
return {
|
|
109
|
-
top: 0,
|
|
110
|
-
right: 0,
|
|
111
|
-
bottom: 0,
|
|
112
|
-
left: 0,
|
|
113
|
-
...padding
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function getPaddingObject(padding) {
|
|
117
|
-
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
118
|
-
top: padding,
|
|
119
|
-
right: padding,
|
|
120
|
-
bottom: padding,
|
|
121
|
-
left: padding
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function rectToClientRect(rect) {
|
|
125
|
-
const {
|
|
126
|
-
x,
|
|
127
|
-
y,
|
|
128
|
-
width,
|
|
129
|
-
height
|
|
130
|
-
} = rect;
|
|
131
|
-
return {
|
|
132
|
-
width,
|
|
133
|
-
height,
|
|
134
|
-
top: y,
|
|
135
|
-
left: x,
|
|
136
|
-
right: x + width,
|
|
137
|
-
bottom: y + height,
|
|
138
|
-
x,
|
|
139
|
-
y
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
144
|
-
let {
|
|
145
|
-
reference,
|
|
146
|
-
floating
|
|
147
|
-
} = _ref;
|
|
148
|
-
const sideAxis = getSideAxis(placement);
|
|
149
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
150
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
151
|
-
const side = getSide(placement);
|
|
152
|
-
const isVertical = sideAxis === 'y';
|
|
153
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
154
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
155
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
156
|
-
let coords;
|
|
157
|
-
switch (side) {
|
|
158
|
-
case 'top':
|
|
159
|
-
coords = {
|
|
160
|
-
x: commonX,
|
|
161
|
-
y: reference.y - floating.height
|
|
162
|
-
};
|
|
163
|
-
break;
|
|
164
|
-
case 'bottom':
|
|
165
|
-
coords = {
|
|
166
|
-
x: commonX,
|
|
167
|
-
y: reference.y + reference.height
|
|
168
|
-
};
|
|
169
|
-
break;
|
|
170
|
-
case 'right':
|
|
171
|
-
coords = {
|
|
172
|
-
x: reference.x + reference.width,
|
|
173
|
-
y: commonY
|
|
174
|
-
};
|
|
175
|
-
break;
|
|
176
|
-
case 'left':
|
|
177
|
-
coords = {
|
|
178
|
-
x: reference.x - floating.width,
|
|
179
|
-
y: commonY
|
|
180
|
-
};
|
|
181
|
-
break;
|
|
182
|
-
default:
|
|
183
|
-
coords = {
|
|
184
|
-
x: reference.x,
|
|
185
|
-
y: reference.y
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
switch (getAlignment(placement)) {
|
|
189
|
-
case 'start':
|
|
190
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
191
|
-
break;
|
|
192
|
-
case 'end':
|
|
193
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
return coords;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
201
|
-
* next to a given reference element.
|
|
202
|
-
*
|
|
203
|
-
* This export does not have any `platform` interface logic. You will need to
|
|
204
|
-
* write one for the platform you are using Floating UI with.
|
|
205
|
-
*/
|
|
206
|
-
const computePosition$1 = async (reference, floating, config) => {
|
|
207
|
-
const {
|
|
208
|
-
placement = 'bottom',
|
|
209
|
-
strategy = 'absolute',
|
|
210
|
-
middleware = [],
|
|
211
|
-
platform
|
|
212
|
-
} = config;
|
|
213
|
-
const validMiddleware = middleware.filter(Boolean);
|
|
214
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
215
|
-
let rects = await platform.getElementRects({
|
|
216
|
-
reference,
|
|
217
|
-
floating,
|
|
218
|
-
strategy
|
|
219
|
-
});
|
|
220
|
-
let {
|
|
221
|
-
x,
|
|
222
|
-
y
|
|
223
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
224
|
-
let statefulPlacement = placement;
|
|
225
|
-
let middlewareData = {};
|
|
226
|
-
let resetCount = 0;
|
|
227
|
-
for (let i = 0; i < validMiddleware.length; i++) {
|
|
228
|
-
const {
|
|
229
|
-
name,
|
|
230
|
-
fn
|
|
231
|
-
} = validMiddleware[i];
|
|
232
|
-
const {
|
|
233
|
-
x: nextX,
|
|
234
|
-
y: nextY,
|
|
235
|
-
data,
|
|
236
|
-
reset
|
|
237
|
-
} = await fn({
|
|
238
|
-
x,
|
|
239
|
-
y,
|
|
240
|
-
initialPlacement: placement,
|
|
241
|
-
placement: statefulPlacement,
|
|
242
|
-
strategy,
|
|
243
|
-
middlewareData,
|
|
244
|
-
rects,
|
|
245
|
-
platform,
|
|
246
|
-
elements: {
|
|
247
|
-
reference,
|
|
248
|
-
floating
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
x = nextX != null ? nextX : x;
|
|
252
|
-
y = nextY != null ? nextY : y;
|
|
253
|
-
middlewareData = {
|
|
254
|
-
...middlewareData,
|
|
255
|
-
[name]: {
|
|
256
|
-
...middlewareData[name],
|
|
257
|
-
...data
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
if (reset && resetCount <= 50) {
|
|
261
|
-
resetCount++;
|
|
262
|
-
if (typeof reset === 'object') {
|
|
263
|
-
if (reset.placement) {
|
|
264
|
-
statefulPlacement = reset.placement;
|
|
265
|
-
}
|
|
266
|
-
if (reset.rects) {
|
|
267
|
-
rects = reset.rects === true ? await platform.getElementRects({
|
|
268
|
-
reference,
|
|
269
|
-
floating,
|
|
270
|
-
strategy
|
|
271
|
-
}) : reset.rects;
|
|
272
|
-
}
|
|
273
|
-
({
|
|
274
|
-
x,
|
|
275
|
-
y
|
|
276
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
277
|
-
}
|
|
278
|
-
i = -1;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return {
|
|
282
|
-
x,
|
|
283
|
-
y,
|
|
284
|
-
placement: statefulPlacement,
|
|
285
|
-
strategy,
|
|
286
|
-
middlewareData
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
292
|
-
* element is overflowing a given clipping boundary on each side.
|
|
293
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
294
|
-
* - negative = how many pixels left before it will overflow
|
|
295
|
-
* - 0 = lies flush with the boundary
|
|
296
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
297
|
-
*/
|
|
298
|
-
async function detectOverflow(state, options) {
|
|
299
|
-
var _await$platform$isEle;
|
|
300
|
-
if (options === void 0) {
|
|
301
|
-
options = {};
|
|
302
|
-
}
|
|
303
|
-
const {
|
|
304
|
-
x,
|
|
305
|
-
y,
|
|
306
|
-
platform,
|
|
307
|
-
rects,
|
|
308
|
-
elements,
|
|
309
|
-
strategy
|
|
310
|
-
} = state;
|
|
311
|
-
const {
|
|
312
|
-
boundary = 'clippingAncestors',
|
|
313
|
-
rootBoundary = 'viewport',
|
|
314
|
-
elementContext = 'floating',
|
|
315
|
-
altBoundary = false,
|
|
316
|
-
padding = 0
|
|
317
|
-
} = evaluate(options, state);
|
|
318
|
-
const paddingObject = getPaddingObject(padding);
|
|
319
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
320
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
321
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
322
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
323
|
-
boundary,
|
|
324
|
-
rootBoundary,
|
|
325
|
-
strategy
|
|
326
|
-
}));
|
|
327
|
-
const rect = elementContext === 'floating' ? {
|
|
328
|
-
...rects.floating,
|
|
329
|
-
x,
|
|
330
|
-
y
|
|
331
|
-
} : rects.reference;
|
|
332
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
333
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
334
|
-
x: 1,
|
|
335
|
-
y: 1
|
|
336
|
-
} : {
|
|
337
|
-
x: 1,
|
|
338
|
-
y: 1
|
|
339
|
-
};
|
|
340
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
341
|
-
elements,
|
|
342
|
-
rect,
|
|
343
|
-
offsetParent,
|
|
344
|
-
strategy
|
|
345
|
-
}) : rect);
|
|
346
|
-
return {
|
|
347
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
348
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
349
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
350
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Provides data to position an inner element of the floating element so that it
|
|
356
|
-
* appears centered to the reference element.
|
|
357
|
-
* @see https://floating-ui.com/docs/arrow
|
|
358
|
-
*/
|
|
359
|
-
const arrow$1 = options => ({
|
|
360
|
-
name: 'arrow',
|
|
361
|
-
options,
|
|
362
|
-
async fn(state) {
|
|
363
|
-
const {
|
|
364
|
-
x,
|
|
365
|
-
y,
|
|
366
|
-
placement,
|
|
367
|
-
rects,
|
|
368
|
-
platform,
|
|
369
|
-
elements,
|
|
370
|
-
middlewareData
|
|
371
|
-
} = state;
|
|
372
|
-
// Since `element` is required, we don't Partial<> the type.
|
|
373
|
-
const {
|
|
374
|
-
element,
|
|
375
|
-
padding = 0
|
|
376
|
-
} = evaluate(options, state) || {};
|
|
377
|
-
if (element == null) {
|
|
378
|
-
return {};
|
|
379
|
-
}
|
|
380
|
-
const paddingObject = getPaddingObject(padding);
|
|
381
|
-
const coords = {
|
|
382
|
-
x,
|
|
383
|
-
y
|
|
384
|
-
};
|
|
385
|
-
const axis = getAlignmentAxis(placement);
|
|
386
|
-
const length = getAxisLength(axis);
|
|
387
|
-
const arrowDimensions = await platform.getDimensions(element);
|
|
388
|
-
const isYAxis = axis === 'y';
|
|
389
|
-
const minProp = isYAxis ? 'top' : 'left';
|
|
390
|
-
const maxProp = isYAxis ? 'bottom' : 'right';
|
|
391
|
-
const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
|
|
392
|
-
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
393
|
-
const startDiff = coords[axis] - rects.reference[axis];
|
|
394
|
-
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
395
|
-
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
396
|
-
|
|
397
|
-
// DOM platform can return `window` as the `offsetParent`.
|
|
398
|
-
if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
|
|
399
|
-
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
400
|
-
}
|
|
401
|
-
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
402
|
-
|
|
403
|
-
// If the padding is large enough that it causes the arrow to no longer be
|
|
404
|
-
// centered, modify the padding so that it is centered.
|
|
405
|
-
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
406
|
-
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
407
|
-
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
408
|
-
|
|
409
|
-
// Make sure the arrow doesn't overflow the floating element if the center
|
|
410
|
-
// point is outside the floating element's bounds.
|
|
411
|
-
const min$1 = minPadding;
|
|
412
|
-
const max = clientSize - arrowDimensions[length] - maxPadding;
|
|
413
|
-
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
414
|
-
const offset = clamp(min$1, center, max);
|
|
415
|
-
|
|
416
|
-
// If the reference is small enough that the arrow's padding causes it to
|
|
417
|
-
// to point to nothing for an aligned placement, adjust the offset of the
|
|
418
|
-
// floating element itself. To ensure `shift()` continues to take action,
|
|
419
|
-
// a single reset is performed when this is true.
|
|
420
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
421
|
-
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
422
|
-
return {
|
|
423
|
-
[axis]: coords[axis] + alignmentOffset,
|
|
424
|
-
data: {
|
|
425
|
-
[axis]: offset,
|
|
426
|
-
centerOffset: center - offset - alignmentOffset,
|
|
427
|
-
...(shouldAddOffset && {
|
|
428
|
-
alignmentOffset
|
|
429
|
-
})
|
|
430
|
-
},
|
|
431
|
-
reset: shouldAddOffset
|
|
432
|
-
};
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
|
|
436
|
-
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
437
|
-
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
438
|
-
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
439
|
-
if (alignment) {
|
|
440
|
-
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
441
|
-
}
|
|
442
|
-
return true;
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Optimizes the visibility of the floating element by choosing the placement
|
|
447
|
-
* that has the most space available automatically, without needing to specify a
|
|
448
|
-
* preferred placement. Alternative to `flip`.
|
|
449
|
-
* @see https://floating-ui.com/docs/autoPlacement
|
|
450
|
-
*/
|
|
451
|
-
const autoPlacement = function (options) {
|
|
452
|
-
if (options === void 0) {
|
|
453
|
-
options = {};
|
|
454
|
-
}
|
|
455
|
-
return {
|
|
456
|
-
name: 'autoPlacement',
|
|
457
|
-
options,
|
|
458
|
-
async fn(state) {
|
|
459
|
-
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
460
|
-
const {
|
|
461
|
-
rects,
|
|
462
|
-
middlewareData,
|
|
463
|
-
placement,
|
|
464
|
-
platform,
|
|
465
|
-
elements
|
|
466
|
-
} = state;
|
|
467
|
-
const {
|
|
468
|
-
crossAxis = false,
|
|
469
|
-
alignment,
|
|
470
|
-
allowedPlacements = placements,
|
|
471
|
-
autoAlignment = true,
|
|
472
|
-
...detectOverflowOptions
|
|
473
|
-
} = evaluate(options, state);
|
|
474
|
-
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
475
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
476
|
-
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
477
|
-
const currentPlacement = placements$1[currentIndex];
|
|
478
|
-
if (currentPlacement == null) {
|
|
479
|
-
return {};
|
|
480
|
-
}
|
|
481
|
-
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
482
|
-
|
|
483
|
-
// Make `computeCoords` start from the right place.
|
|
484
|
-
if (placement !== currentPlacement) {
|
|
485
|
-
return {
|
|
486
|
-
reset: {
|
|
487
|
-
placement: placements$1[0]
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
492
|
-
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
493
|
-
placement: currentPlacement,
|
|
494
|
-
overflows: currentOverflows
|
|
495
|
-
}];
|
|
496
|
-
const nextPlacement = placements$1[currentIndex + 1];
|
|
497
|
-
|
|
498
|
-
// There are more placements to check.
|
|
499
|
-
if (nextPlacement) {
|
|
500
|
-
return {
|
|
501
|
-
data: {
|
|
502
|
-
index: currentIndex + 1,
|
|
503
|
-
overflows: allOverflows
|
|
504
|
-
},
|
|
505
|
-
reset: {
|
|
506
|
-
placement: nextPlacement
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
511
|
-
const alignment = getAlignment(d.placement);
|
|
512
|
-
return [d.placement, alignment && crossAxis ?
|
|
513
|
-
// Check along the mainAxis and main crossAxis side.
|
|
514
|
-
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
515
|
-
// Check only the mainAxis.
|
|
516
|
-
d.overflows[0], d.overflows];
|
|
517
|
-
}).sort((a, b) => a[1] - b[1]);
|
|
518
|
-
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
519
|
-
// Aligned placements should not check their opposite crossAxis
|
|
520
|
-
// side.
|
|
521
|
-
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
522
|
-
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
523
|
-
if (resetPlacement !== placement) {
|
|
524
|
-
return {
|
|
525
|
-
data: {
|
|
526
|
-
index: currentIndex + 1,
|
|
527
|
-
overflows: allOverflows
|
|
528
|
-
},
|
|
529
|
-
reset: {
|
|
530
|
-
placement: resetPlacement
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
return {};
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
541
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
542
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
543
|
-
* @see https://floating-ui.com/docs/flip
|
|
544
|
-
*/
|
|
545
|
-
const flip$1 = function (options) {
|
|
546
|
-
if (options === void 0) {
|
|
547
|
-
options = {};
|
|
548
|
-
}
|
|
549
|
-
return {
|
|
550
|
-
name: 'flip',
|
|
551
|
-
options,
|
|
552
|
-
async fn(state) {
|
|
553
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
554
|
-
const {
|
|
555
|
-
placement,
|
|
556
|
-
middlewareData,
|
|
557
|
-
rects,
|
|
558
|
-
initialPlacement,
|
|
559
|
-
platform,
|
|
560
|
-
elements
|
|
561
|
-
} = state;
|
|
562
|
-
const {
|
|
563
|
-
mainAxis: checkMainAxis = true,
|
|
564
|
-
crossAxis: checkCrossAxis = true,
|
|
565
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
566
|
-
fallbackStrategy = 'bestFit',
|
|
567
|
-
fallbackAxisSideDirection = 'none',
|
|
568
|
-
flipAlignment = true,
|
|
569
|
-
...detectOverflowOptions
|
|
570
|
-
} = evaluate(options, state);
|
|
571
|
-
|
|
572
|
-
// If a reset by the arrow was caused due to an alignment offset being
|
|
573
|
-
// added, we should skip any logic now since `flip()` has already done its
|
|
574
|
-
// work.
|
|
575
|
-
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
576
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
577
|
-
return {};
|
|
578
|
-
}
|
|
579
|
-
const side = getSide(placement);
|
|
580
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
581
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
582
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
583
|
-
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
584
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
585
|
-
}
|
|
586
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
587
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
588
|
-
const overflows = [];
|
|
589
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
590
|
-
if (checkMainAxis) {
|
|
591
|
-
overflows.push(overflow[side]);
|
|
592
|
-
}
|
|
593
|
-
if (checkCrossAxis) {
|
|
594
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
|
595
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
596
|
-
}
|
|
597
|
-
overflowsData = [...overflowsData, {
|
|
598
|
-
placement,
|
|
599
|
-
overflows
|
|
600
|
-
}];
|
|
601
|
-
|
|
602
|
-
// One or more sides is overflowing.
|
|
603
|
-
if (!overflows.every(side => side <= 0)) {
|
|
604
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
605
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
606
|
-
const nextPlacement = placements[nextIndex];
|
|
607
|
-
if (nextPlacement) {
|
|
608
|
-
// Try next placement and re-run the lifecycle.
|
|
609
|
-
return {
|
|
610
|
-
data: {
|
|
611
|
-
index: nextIndex,
|
|
612
|
-
overflows: overflowsData
|
|
613
|
-
},
|
|
614
|
-
reset: {
|
|
615
|
-
placement: nextPlacement
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
621
|
-
// then find the placement that fits the best on the main crossAxis side.
|
|
622
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
623
|
-
|
|
624
|
-
// Otherwise fallback.
|
|
625
|
-
if (!resetPlacement) {
|
|
626
|
-
switch (fallbackStrategy) {
|
|
627
|
-
case 'bestFit':
|
|
628
|
-
{
|
|
629
|
-
var _overflowsData$map$so;
|
|
630
|
-
const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
|
|
631
|
-
if (placement) {
|
|
632
|
-
resetPlacement = placement;
|
|
633
|
-
}
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
case 'initialPlacement':
|
|
637
|
-
resetPlacement = initialPlacement;
|
|
638
|
-
break;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
if (placement !== resetPlacement) {
|
|
642
|
-
return {
|
|
643
|
-
reset: {
|
|
644
|
-
placement: resetPlacement
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return {};
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
};
|
|
653
|
-
|
|
654
|
-
function getSideOffsets(overflow, rect) {
|
|
655
|
-
return {
|
|
656
|
-
top: overflow.top - rect.height,
|
|
657
|
-
right: overflow.right - rect.width,
|
|
658
|
-
bottom: overflow.bottom - rect.height,
|
|
659
|
-
left: overflow.left - rect.width
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
function isAnySideFullyClipped(overflow) {
|
|
663
|
-
return sides.some(side => overflow[side] >= 0);
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Provides data to hide the floating element in applicable situations, such as
|
|
667
|
-
* when it is not in the same clipping context as the reference element.
|
|
668
|
-
* @see https://floating-ui.com/docs/hide
|
|
669
|
-
*/
|
|
670
|
-
const hide = function (options) {
|
|
671
|
-
if (options === void 0) {
|
|
672
|
-
options = {};
|
|
673
|
-
}
|
|
674
|
-
return {
|
|
675
|
-
name: 'hide',
|
|
676
|
-
options,
|
|
677
|
-
async fn(state) {
|
|
678
|
-
const {
|
|
679
|
-
rects
|
|
680
|
-
} = state;
|
|
681
|
-
const {
|
|
682
|
-
strategy = 'referenceHidden',
|
|
683
|
-
...detectOverflowOptions
|
|
684
|
-
} = evaluate(options, state);
|
|
685
|
-
switch (strategy) {
|
|
686
|
-
case 'referenceHidden':
|
|
687
|
-
{
|
|
688
|
-
const overflow = await detectOverflow(state, {
|
|
689
|
-
...detectOverflowOptions,
|
|
690
|
-
elementContext: 'reference'
|
|
691
|
-
});
|
|
692
|
-
const offsets = getSideOffsets(overflow, rects.reference);
|
|
693
|
-
return {
|
|
694
|
-
data: {
|
|
695
|
-
referenceHiddenOffsets: offsets,
|
|
696
|
-
referenceHidden: isAnySideFullyClipped(offsets)
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
case 'escaped':
|
|
701
|
-
{
|
|
702
|
-
const overflow = await detectOverflow(state, {
|
|
703
|
-
...detectOverflowOptions,
|
|
704
|
-
altBoundary: true
|
|
705
|
-
});
|
|
706
|
-
const offsets = getSideOffsets(overflow, rects.floating);
|
|
707
|
-
return {
|
|
708
|
-
data: {
|
|
709
|
-
escapedOffsets: offsets,
|
|
710
|
-
escaped: isAnySideFullyClipped(offsets)
|
|
711
|
-
}
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
default:
|
|
715
|
-
{
|
|
716
|
-
return {};
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
};
|
|
722
|
-
|
|
723
|
-
function getBoundingRect(rects) {
|
|
724
|
-
const minX = min(...rects.map(rect => rect.left));
|
|
725
|
-
const minY = min(...rects.map(rect => rect.top));
|
|
726
|
-
const maxX = max(...rects.map(rect => rect.right));
|
|
727
|
-
const maxY = max(...rects.map(rect => rect.bottom));
|
|
728
|
-
return {
|
|
729
|
-
x: minX,
|
|
730
|
-
y: minY,
|
|
731
|
-
width: maxX - minX,
|
|
732
|
-
height: maxY - minY
|
|
733
|
-
};
|
|
734
|
-
}
|
|
735
|
-
function getRectsByLine(rects) {
|
|
736
|
-
const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
|
|
737
|
-
const groups = [];
|
|
738
|
-
let prevRect = null;
|
|
739
|
-
for (let i = 0; i < sortedRects.length; i++) {
|
|
740
|
-
const rect = sortedRects[i];
|
|
741
|
-
if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
|
|
742
|
-
groups.push([rect]);
|
|
743
|
-
} else {
|
|
744
|
-
groups[groups.length - 1].push(rect);
|
|
745
|
-
}
|
|
746
|
-
prevRect = rect;
|
|
747
|
-
}
|
|
748
|
-
return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Provides improved positioning for inline reference elements that can span
|
|
752
|
-
* over multiple lines, such as hyperlinks or range selections.
|
|
753
|
-
* @see https://floating-ui.com/docs/inline
|
|
754
|
-
*/
|
|
755
|
-
const inline$1 = function (options) {
|
|
756
|
-
if (options === void 0) {
|
|
757
|
-
options = {};
|
|
758
|
-
}
|
|
759
|
-
return {
|
|
760
|
-
name: 'inline',
|
|
761
|
-
options,
|
|
762
|
-
async fn(state) {
|
|
763
|
-
const {
|
|
764
|
-
placement,
|
|
765
|
-
elements,
|
|
766
|
-
rects,
|
|
767
|
-
platform,
|
|
768
|
-
strategy
|
|
769
|
-
} = state;
|
|
770
|
-
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
771
|
-
// ClientRect's bounds, despite the event listener being triggered. A
|
|
772
|
-
// padding of 2 seems to handle this issue.
|
|
773
|
-
const {
|
|
774
|
-
padding = 2,
|
|
775
|
-
x,
|
|
776
|
-
y
|
|
777
|
-
} = evaluate(options, state);
|
|
778
|
-
const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
|
|
779
|
-
const clientRects = getRectsByLine(nativeClientRects);
|
|
780
|
-
const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
|
|
781
|
-
const paddingObject = getPaddingObject(padding);
|
|
782
|
-
function getBoundingClientRect() {
|
|
783
|
-
// There are two rects and they are disjoined.
|
|
784
|
-
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
785
|
-
// Find the first rect in which the point is fully inside.
|
|
786
|
-
return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
// There are 2 or more connected rects.
|
|
790
|
-
if (clientRects.length >= 2) {
|
|
791
|
-
if (getSideAxis(placement) === 'y') {
|
|
792
|
-
const firstRect = clientRects[0];
|
|
793
|
-
const lastRect = clientRects[clientRects.length - 1];
|
|
794
|
-
const isTop = getSide(placement) === 'top';
|
|
795
|
-
const top = firstRect.top;
|
|
796
|
-
const bottom = lastRect.bottom;
|
|
797
|
-
const left = isTop ? firstRect.left : lastRect.left;
|
|
798
|
-
const right = isTop ? firstRect.right : lastRect.right;
|
|
799
|
-
const width = right - left;
|
|
800
|
-
const height = bottom - top;
|
|
801
|
-
return {
|
|
802
|
-
top,
|
|
803
|
-
bottom,
|
|
804
|
-
left,
|
|
805
|
-
right,
|
|
806
|
-
width,
|
|
807
|
-
height,
|
|
808
|
-
x: left,
|
|
809
|
-
y: top
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
const isLeftSide = getSide(placement) === 'left';
|
|
813
|
-
const maxRight = max(...clientRects.map(rect => rect.right));
|
|
814
|
-
const minLeft = min(...clientRects.map(rect => rect.left));
|
|
815
|
-
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
816
|
-
const top = measureRects[0].top;
|
|
817
|
-
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
818
|
-
const left = minLeft;
|
|
819
|
-
const right = maxRight;
|
|
820
|
-
const width = right - left;
|
|
821
|
-
const height = bottom - top;
|
|
822
|
-
return {
|
|
823
|
-
top,
|
|
824
|
-
bottom,
|
|
825
|
-
left,
|
|
826
|
-
right,
|
|
827
|
-
width,
|
|
828
|
-
height,
|
|
829
|
-
x: left,
|
|
830
|
-
y: top
|
|
831
|
-
};
|
|
832
|
-
}
|
|
833
|
-
return fallback;
|
|
834
|
-
}
|
|
835
|
-
const resetRects = await platform.getElementRects({
|
|
836
|
-
reference: {
|
|
837
|
-
getBoundingClientRect
|
|
838
|
-
},
|
|
839
|
-
floating: elements.floating,
|
|
840
|
-
strategy
|
|
841
|
-
});
|
|
842
|
-
if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
|
|
843
|
-
return {
|
|
844
|
-
reset: {
|
|
845
|
-
rects: resetRects
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
return {};
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
855
|
-
// Derivable.
|
|
856
|
-
|
|
857
|
-
async function convertValueToCoords(state, options) {
|
|
858
|
-
const {
|
|
859
|
-
placement,
|
|
860
|
-
platform,
|
|
861
|
-
elements
|
|
862
|
-
} = state;
|
|
863
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
864
|
-
const side = getSide(placement);
|
|
865
|
-
const alignment = getAlignment(placement);
|
|
866
|
-
const isVertical = getSideAxis(placement) === 'y';
|
|
867
|
-
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
868
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
869
|
-
const rawValue = evaluate(options, state);
|
|
870
|
-
let {
|
|
871
|
-
mainAxis,
|
|
872
|
-
crossAxis,
|
|
873
|
-
alignmentAxis
|
|
874
|
-
} = typeof rawValue === 'number' ? {
|
|
875
|
-
mainAxis: rawValue,
|
|
876
|
-
crossAxis: 0,
|
|
877
|
-
alignmentAxis: null
|
|
878
|
-
} : {
|
|
879
|
-
mainAxis: 0,
|
|
880
|
-
crossAxis: 0,
|
|
881
|
-
alignmentAxis: null,
|
|
882
|
-
...rawValue
|
|
883
|
-
};
|
|
884
|
-
if (alignment && typeof alignmentAxis === 'number') {
|
|
885
|
-
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
886
|
-
}
|
|
887
|
-
return isVertical ? {
|
|
888
|
-
x: crossAxis * crossAxisMulti,
|
|
889
|
-
y: mainAxis * mainAxisMulti
|
|
890
|
-
} : {
|
|
891
|
-
x: mainAxis * mainAxisMulti,
|
|
892
|
-
y: crossAxis * crossAxisMulti
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* Modifies the placement by translating the floating element along the
|
|
898
|
-
* specified axes.
|
|
899
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
900
|
-
* object may be passed.
|
|
901
|
-
* @see https://floating-ui.com/docs/offset
|
|
902
|
-
*/
|
|
903
|
-
const offset$1 = function (options) {
|
|
904
|
-
if (options === void 0) {
|
|
905
|
-
options = 0;
|
|
906
|
-
}
|
|
907
|
-
return {
|
|
908
|
-
name: 'offset',
|
|
909
|
-
options,
|
|
910
|
-
async fn(state) {
|
|
911
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
912
|
-
const {
|
|
913
|
-
x,
|
|
914
|
-
y,
|
|
915
|
-
placement,
|
|
916
|
-
middlewareData
|
|
917
|
-
} = state;
|
|
918
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
919
|
-
|
|
920
|
-
// If the placement is the same and the arrow caused an alignment offset
|
|
921
|
-
// then we don't need to change the positioning coordinates.
|
|
922
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
923
|
-
return {};
|
|
924
|
-
}
|
|
925
|
-
return {
|
|
926
|
-
x: x + diffCoords.x,
|
|
927
|
-
y: y + diffCoords.y,
|
|
928
|
-
data: {
|
|
929
|
-
...diffCoords,
|
|
930
|
-
placement
|
|
931
|
-
}
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
|
-
};
|
|
936
|
-
|
|
937
|
-
/**
|
|
938
|
-
* Optimizes the visibility of the floating element by shifting it in order to
|
|
939
|
-
* keep it in view when it will overflow the clipping boundary.
|
|
940
|
-
* @see https://floating-ui.com/docs/shift
|
|
941
|
-
*/
|
|
942
|
-
const shift$1 = function (options) {
|
|
943
|
-
if (options === void 0) {
|
|
944
|
-
options = {};
|
|
945
|
-
}
|
|
946
|
-
return {
|
|
947
|
-
name: 'shift',
|
|
948
|
-
options,
|
|
949
|
-
async fn(state) {
|
|
950
|
-
const {
|
|
951
|
-
x,
|
|
952
|
-
y,
|
|
953
|
-
placement
|
|
954
|
-
} = state;
|
|
955
|
-
const {
|
|
956
|
-
mainAxis: checkMainAxis = true,
|
|
957
|
-
crossAxis: checkCrossAxis = false,
|
|
958
|
-
limiter = {
|
|
959
|
-
fn: _ref => {
|
|
960
|
-
let {
|
|
961
|
-
x,
|
|
962
|
-
y
|
|
963
|
-
} = _ref;
|
|
964
|
-
return {
|
|
965
|
-
x,
|
|
966
|
-
y
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
...detectOverflowOptions
|
|
971
|
-
} = evaluate(options, state);
|
|
972
|
-
const coords = {
|
|
973
|
-
x,
|
|
974
|
-
y
|
|
975
|
-
};
|
|
976
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
977
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
978
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
979
|
-
let mainAxisCoord = coords[mainAxis];
|
|
980
|
-
let crossAxisCoord = coords[crossAxis];
|
|
981
|
-
if (checkMainAxis) {
|
|
982
|
-
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
983
|
-
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
984
|
-
const min = mainAxisCoord + overflow[minSide];
|
|
985
|
-
const max = mainAxisCoord - overflow[maxSide];
|
|
986
|
-
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
987
|
-
}
|
|
988
|
-
if (checkCrossAxis) {
|
|
989
|
-
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
990
|
-
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
991
|
-
const min = crossAxisCoord + overflow[minSide];
|
|
992
|
-
const max = crossAxisCoord - overflow[maxSide];
|
|
993
|
-
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
994
|
-
}
|
|
995
|
-
const limitedCoords = limiter.fn({
|
|
996
|
-
...state,
|
|
997
|
-
[mainAxis]: mainAxisCoord,
|
|
998
|
-
[crossAxis]: crossAxisCoord
|
|
999
|
-
});
|
|
1000
|
-
return {
|
|
1001
|
-
...limitedCoords,
|
|
1002
|
-
data: {
|
|
1003
|
-
x: limitedCoords.x - x,
|
|
1004
|
-
y: limitedCoords.y - y
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
}
|
|
1008
|
-
};
|
|
1009
|
-
};
|
|
1010
|
-
/**
|
|
1011
|
-
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
1012
|
-
*/
|
|
1013
|
-
const limitShift$1 = function (options) {
|
|
1014
|
-
if (options === void 0) {
|
|
1015
|
-
options = {};
|
|
1016
|
-
}
|
|
1017
|
-
return {
|
|
1018
|
-
options,
|
|
1019
|
-
fn(state) {
|
|
1020
|
-
const {
|
|
1021
|
-
x,
|
|
1022
|
-
y,
|
|
1023
|
-
placement,
|
|
1024
|
-
rects,
|
|
1025
|
-
middlewareData
|
|
1026
|
-
} = state;
|
|
1027
|
-
const {
|
|
1028
|
-
offset = 0,
|
|
1029
|
-
mainAxis: checkMainAxis = true,
|
|
1030
|
-
crossAxis: checkCrossAxis = true
|
|
1031
|
-
} = evaluate(options, state);
|
|
1032
|
-
const coords = {
|
|
1033
|
-
x,
|
|
1034
|
-
y
|
|
1035
|
-
};
|
|
1036
|
-
const crossAxis = getSideAxis(placement);
|
|
1037
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
1038
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1039
|
-
let crossAxisCoord = coords[crossAxis];
|
|
1040
|
-
const rawOffset = evaluate(offset, state);
|
|
1041
|
-
const computedOffset = typeof rawOffset === 'number' ? {
|
|
1042
|
-
mainAxis: rawOffset,
|
|
1043
|
-
crossAxis: 0
|
|
1044
|
-
} : {
|
|
1045
|
-
mainAxis: 0,
|
|
1046
|
-
crossAxis: 0,
|
|
1047
|
-
...rawOffset
|
|
1048
|
-
};
|
|
1049
|
-
if (checkMainAxis) {
|
|
1050
|
-
const len = mainAxis === 'y' ? 'height' : 'width';
|
|
1051
|
-
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
1052
|
-
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
1053
|
-
if (mainAxisCoord < limitMin) {
|
|
1054
|
-
mainAxisCoord = limitMin;
|
|
1055
|
-
} else if (mainAxisCoord > limitMax) {
|
|
1056
|
-
mainAxisCoord = limitMax;
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
if (checkCrossAxis) {
|
|
1060
|
-
var _middlewareData$offse, _middlewareData$offse2;
|
|
1061
|
-
const len = mainAxis === 'y' ? 'width' : 'height';
|
|
1062
|
-
const isOriginSide = ['top', 'left'].includes(getSide(placement));
|
|
1063
|
-
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
1064
|
-
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
1065
|
-
if (crossAxisCoord < limitMin) {
|
|
1066
|
-
crossAxisCoord = limitMin;
|
|
1067
|
-
} else if (crossAxisCoord > limitMax) {
|
|
1068
|
-
crossAxisCoord = limitMax;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
return {
|
|
1072
|
-
[mainAxis]: mainAxisCoord,
|
|
1073
|
-
[crossAxis]: crossAxisCoord
|
|
1074
|
-
};
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
};
|
|
1078
|
-
|
|
1079
|
-
/**
|
|
1080
|
-
* Provides data that allows you to change the size of the floating element —
|
|
1081
|
-
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
1082
|
-
* width of the reference element.
|
|
1083
|
-
* @see https://floating-ui.com/docs/size
|
|
1084
|
-
*/
|
|
1085
|
-
const size$1 = function (options) {
|
|
1086
|
-
if (options === void 0) {
|
|
1087
|
-
options = {};
|
|
1088
|
-
}
|
|
1089
|
-
return {
|
|
1090
|
-
name: 'size',
|
|
1091
|
-
options,
|
|
1092
|
-
async fn(state) {
|
|
1093
|
-
const {
|
|
1094
|
-
placement,
|
|
1095
|
-
rects,
|
|
1096
|
-
platform,
|
|
1097
|
-
elements
|
|
1098
|
-
} = state;
|
|
1099
|
-
const {
|
|
1100
|
-
apply = () => {},
|
|
1101
|
-
...detectOverflowOptions
|
|
1102
|
-
} = evaluate(options, state);
|
|
1103
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1104
|
-
const side = getSide(placement);
|
|
1105
|
-
const alignment = getAlignment(placement);
|
|
1106
|
-
const isYAxis = getSideAxis(placement) === 'y';
|
|
1107
|
-
const {
|
|
1108
|
-
width,
|
|
1109
|
-
height
|
|
1110
|
-
} = rects.floating;
|
|
1111
|
-
let heightSide;
|
|
1112
|
-
let widthSide;
|
|
1113
|
-
if (side === 'top' || side === 'bottom') {
|
|
1114
|
-
heightSide = side;
|
|
1115
|
-
widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
|
|
1116
|
-
} else {
|
|
1117
|
-
widthSide = side;
|
|
1118
|
-
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
1119
|
-
}
|
|
1120
|
-
const overflowAvailableHeight = height - overflow[heightSide];
|
|
1121
|
-
const overflowAvailableWidth = width - overflow[widthSide];
|
|
1122
|
-
const noShift = !state.middlewareData.shift;
|
|
1123
|
-
let availableHeight = overflowAvailableHeight;
|
|
1124
|
-
let availableWidth = overflowAvailableWidth;
|
|
1125
|
-
if (isYAxis) {
|
|
1126
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1127
|
-
availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
|
|
1128
|
-
} else {
|
|
1129
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1130
|
-
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
1131
|
-
}
|
|
1132
|
-
if (noShift && !alignment) {
|
|
1133
|
-
const xMin = max(overflow.left, 0);
|
|
1134
|
-
const xMax = max(overflow.right, 0);
|
|
1135
|
-
const yMin = max(overflow.top, 0);
|
|
1136
|
-
const yMax = max(overflow.bottom, 0);
|
|
1137
|
-
if (isYAxis) {
|
|
1138
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1139
|
-
} else {
|
|
1140
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
await apply({
|
|
1144
|
-
...state,
|
|
1145
|
-
availableWidth,
|
|
1146
|
-
availableHeight
|
|
1147
|
-
});
|
|
1148
|
-
const nextDimensions = await platform.getDimensions(elements.floating);
|
|
1149
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1150
|
-
return {
|
|
1151
|
-
reset: {
|
|
1152
|
-
rects: true
|
|
1153
|
-
}
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
return {};
|
|
1157
|
-
}
|
|
1158
|
-
};
|
|
1159
|
-
};
|
|
1160
|
-
|
|
1161
|
-
function getNodeName(node) {
|
|
1162
|
-
if (isNode(node)) {
|
|
1163
|
-
return (node.nodeName || '').toLowerCase();
|
|
1164
|
-
}
|
|
1165
|
-
// Mocked nodes in testing environments may not be instances of Node. By
|
|
1166
|
-
// returning `#document` an infinite loop won't occur.
|
|
1167
|
-
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
1168
|
-
return '#document';
|
|
1169
|
-
}
|
|
1170
|
-
function getWindow(node) {
|
|
1171
|
-
var _node$ownerDocument;
|
|
1172
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
1173
|
-
}
|
|
1174
|
-
function getDocumentElement(node) {
|
|
1175
|
-
var _ref;
|
|
1176
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1177
|
-
}
|
|
1178
|
-
function isNode(value) {
|
|
1179
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1180
|
-
}
|
|
1181
|
-
function isElement(value) {
|
|
1182
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1183
|
-
}
|
|
1184
|
-
function isHTMLElement(value) {
|
|
1185
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1186
|
-
}
|
|
1187
|
-
function isShadowRoot(value) {
|
|
1188
|
-
// Browsers without `ShadowRoot` support.
|
|
1189
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
1190
|
-
return false;
|
|
1191
|
-
}
|
|
1192
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1193
|
-
}
|
|
1194
|
-
function isOverflowElement(element) {
|
|
1195
|
-
const {
|
|
1196
|
-
overflow,
|
|
1197
|
-
overflowX,
|
|
1198
|
-
overflowY,
|
|
1199
|
-
display
|
|
1200
|
-
} = getComputedStyle(element);
|
|
1201
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
1202
|
-
}
|
|
1203
|
-
function isTableElement(element) {
|
|
1204
|
-
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1205
|
-
}
|
|
1206
|
-
function isTopLayer(element) {
|
|
1207
|
-
return [':popover-open', ':modal'].some(selector => {
|
|
1208
|
-
try {
|
|
1209
|
-
return element.matches(selector);
|
|
1210
|
-
} catch (e) {
|
|
1211
|
-
return false;
|
|
1212
|
-
}
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1215
|
-
function isContainingBlock(elementOrCss) {
|
|
1216
|
-
const webkit = isWebKit();
|
|
1217
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
1218
|
-
|
|
1219
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1220
|
-
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
1221
|
-
}
|
|
1222
|
-
function getContainingBlock(element) {
|
|
1223
|
-
let currentNode = getParentNode(element);
|
|
1224
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1225
|
-
if (isContainingBlock(currentNode)) {
|
|
1226
|
-
return currentNode;
|
|
1227
|
-
} else if (isTopLayer(currentNode)) {
|
|
1228
|
-
return null;
|
|
1229
|
-
}
|
|
1230
|
-
currentNode = getParentNode(currentNode);
|
|
1231
|
-
}
|
|
1232
|
-
return null;
|
|
1233
|
-
}
|
|
1234
|
-
function isWebKit() {
|
|
1235
|
-
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
1236
|
-
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
1237
|
-
}
|
|
1238
|
-
function isLastTraversableNode(node) {
|
|
1239
|
-
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
1240
|
-
}
|
|
1241
|
-
function getComputedStyle(element) {
|
|
1242
|
-
return getWindow(element).getComputedStyle(element);
|
|
1243
|
-
}
|
|
1244
|
-
function getNodeScroll(element) {
|
|
1245
|
-
if (isElement(element)) {
|
|
1246
|
-
return {
|
|
1247
|
-
scrollLeft: element.scrollLeft,
|
|
1248
|
-
scrollTop: element.scrollTop
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
return {
|
|
1252
|
-
scrollLeft: element.scrollX,
|
|
1253
|
-
scrollTop: element.scrollY
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
function getParentNode(node) {
|
|
1257
|
-
if (getNodeName(node) === 'html') {
|
|
1258
|
-
return node;
|
|
1259
|
-
}
|
|
1260
|
-
const result =
|
|
1261
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
1262
|
-
node.assignedSlot ||
|
|
1263
|
-
// DOM Element detected.
|
|
1264
|
-
node.parentNode ||
|
|
1265
|
-
// ShadowRoot detected.
|
|
1266
|
-
isShadowRoot(node) && node.host ||
|
|
1267
|
-
// Fallback.
|
|
1268
|
-
getDocumentElement(node);
|
|
1269
|
-
return isShadowRoot(result) ? result.host : result;
|
|
1270
|
-
}
|
|
1271
|
-
function getNearestOverflowAncestor(node) {
|
|
1272
|
-
const parentNode = getParentNode(node);
|
|
1273
|
-
if (isLastTraversableNode(parentNode)) {
|
|
1274
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1275
|
-
}
|
|
1276
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1277
|
-
return parentNode;
|
|
1278
|
-
}
|
|
1279
|
-
return getNearestOverflowAncestor(parentNode);
|
|
1280
|
-
}
|
|
1281
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1282
|
-
var _node$ownerDocument2;
|
|
1283
|
-
if (list === void 0) {
|
|
1284
|
-
list = [];
|
|
1285
|
-
}
|
|
1286
|
-
if (traverseIframes === void 0) {
|
|
1287
|
-
traverseIframes = true;
|
|
1288
|
-
}
|
|
1289
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1290
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1291
|
-
const win = getWindow(scrollableAncestor);
|
|
1292
|
-
if (isBody) {
|
|
1293
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
1294
|
-
}
|
|
1295
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
function getCssDimensions(element) {
|
|
1299
|
-
const css = getComputedStyle(element);
|
|
1300
|
-
// In testing environments, the `width` and `height` properties are empty
|
|
1301
|
-
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
1302
|
-
let width = parseFloat(css.width) || 0;
|
|
1303
|
-
let height = parseFloat(css.height) || 0;
|
|
1304
|
-
const hasOffset = isHTMLElement(element);
|
|
1305
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1306
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1307
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1308
|
-
if (shouldFallback) {
|
|
1309
|
-
width = offsetWidth;
|
|
1310
|
-
height = offsetHeight;
|
|
1311
|
-
}
|
|
1312
|
-
return {
|
|
1313
|
-
width,
|
|
1314
|
-
height,
|
|
1315
|
-
$: shouldFallback
|
|
1316
|
-
};
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
function unwrapElement(element) {
|
|
1320
|
-
return !isElement(element) ? element.contextElement : element;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
function getScale(element) {
|
|
1324
|
-
const domElement = unwrapElement(element);
|
|
1325
|
-
if (!isHTMLElement(domElement)) {
|
|
1326
|
-
return createCoords(1);
|
|
1327
|
-
}
|
|
1328
|
-
const rect = domElement.getBoundingClientRect();
|
|
1329
|
-
const {
|
|
1330
|
-
width,
|
|
1331
|
-
height,
|
|
1332
|
-
$
|
|
1333
|
-
} = getCssDimensions(domElement);
|
|
1334
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1335
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1336
|
-
|
|
1337
|
-
// 0, NaN, or Infinity should always fallback to 1.
|
|
1338
|
-
|
|
1339
|
-
if (!x || !Number.isFinite(x)) {
|
|
1340
|
-
x = 1;
|
|
1341
|
-
}
|
|
1342
|
-
if (!y || !Number.isFinite(y)) {
|
|
1343
|
-
y = 1;
|
|
1344
|
-
}
|
|
1345
|
-
return {
|
|
1346
|
-
x,
|
|
1347
|
-
y
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1351
|
-
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
1352
|
-
function getVisualOffsets(element) {
|
|
1353
|
-
const win = getWindow(element);
|
|
1354
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
1355
|
-
return noOffsets;
|
|
1356
|
-
}
|
|
1357
|
-
return {
|
|
1358
|
-
x: win.visualViewport.offsetLeft,
|
|
1359
|
-
y: win.visualViewport.offsetTop
|
|
1360
|
-
};
|
|
1361
|
-
}
|
|
1362
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1363
|
-
if (isFixed === void 0) {
|
|
1364
|
-
isFixed = false;
|
|
1365
|
-
}
|
|
1366
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1367
|
-
return false;
|
|
1368
|
-
}
|
|
1369
|
-
return isFixed;
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1373
|
-
if (includeScale === void 0) {
|
|
1374
|
-
includeScale = false;
|
|
1375
|
-
}
|
|
1376
|
-
if (isFixedStrategy === void 0) {
|
|
1377
|
-
isFixedStrategy = false;
|
|
1378
|
-
}
|
|
1379
|
-
const clientRect = element.getBoundingClientRect();
|
|
1380
|
-
const domElement = unwrapElement(element);
|
|
1381
|
-
let scale = createCoords(1);
|
|
1382
|
-
if (includeScale) {
|
|
1383
|
-
if (offsetParent) {
|
|
1384
|
-
if (isElement(offsetParent)) {
|
|
1385
|
-
scale = getScale(offsetParent);
|
|
1386
|
-
}
|
|
1387
|
-
} else {
|
|
1388
|
-
scale = getScale(element);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1392
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1393
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1394
|
-
let width = clientRect.width / scale.x;
|
|
1395
|
-
let height = clientRect.height / scale.y;
|
|
1396
|
-
if (domElement) {
|
|
1397
|
-
const win = getWindow(domElement);
|
|
1398
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1399
|
-
let currentWin = win;
|
|
1400
|
-
let currentIFrame = currentWin.frameElement;
|
|
1401
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1402
|
-
const iframeScale = getScale(currentIFrame);
|
|
1403
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1404
|
-
const css = getComputedStyle(currentIFrame);
|
|
1405
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1406
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1407
|
-
x *= iframeScale.x;
|
|
1408
|
-
y *= iframeScale.y;
|
|
1409
|
-
width *= iframeScale.x;
|
|
1410
|
-
height *= iframeScale.y;
|
|
1411
|
-
x += left;
|
|
1412
|
-
y += top;
|
|
1413
|
-
currentWin = getWindow(currentIFrame);
|
|
1414
|
-
currentIFrame = currentWin.frameElement;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
return rectToClientRect({
|
|
1418
|
-
width,
|
|
1419
|
-
height,
|
|
1420
|
-
x,
|
|
1421
|
-
y
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1426
|
-
let {
|
|
1427
|
-
elements,
|
|
1428
|
-
rect,
|
|
1429
|
-
offsetParent,
|
|
1430
|
-
strategy
|
|
1431
|
-
} = _ref;
|
|
1432
|
-
const isFixed = strategy === 'fixed';
|
|
1433
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1434
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1435
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1436
|
-
return rect;
|
|
1437
|
-
}
|
|
1438
|
-
let scroll = {
|
|
1439
|
-
scrollLeft: 0,
|
|
1440
|
-
scrollTop: 0
|
|
1441
|
-
};
|
|
1442
|
-
let scale = createCoords(1);
|
|
1443
|
-
const offsets = createCoords(0);
|
|
1444
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1445
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1446
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1447
|
-
scroll = getNodeScroll(offsetParent);
|
|
1448
|
-
}
|
|
1449
|
-
if (isHTMLElement(offsetParent)) {
|
|
1450
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1451
|
-
scale = getScale(offsetParent);
|
|
1452
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1453
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
return {
|
|
1457
|
-
width: rect.width * scale.x,
|
|
1458
|
-
height: rect.height * scale.y,
|
|
1459
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1460
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1461
|
-
};
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
function getClientRects(element) {
|
|
1465
|
-
return Array.from(element.getClientRects());
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
function getWindowScrollBarX(element) {
|
|
1469
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1470
|
-
// incorrect for RTL.
|
|
1471
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
// Gets the entire size of the scrollable document area, even extending outside
|
|
1475
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1476
|
-
function getDocumentRect(element) {
|
|
1477
|
-
const html = getDocumentElement(element);
|
|
1478
|
-
const scroll = getNodeScroll(element);
|
|
1479
|
-
const body = element.ownerDocument.body;
|
|
1480
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1481
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1482
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1483
|
-
const y = -scroll.scrollTop;
|
|
1484
|
-
if (getComputedStyle(body).direction === 'rtl') {
|
|
1485
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
1486
|
-
}
|
|
1487
|
-
return {
|
|
1488
|
-
width,
|
|
1489
|
-
height,
|
|
1490
|
-
x,
|
|
1491
|
-
y
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
function getViewportRect(element, strategy) {
|
|
1496
|
-
const win = getWindow(element);
|
|
1497
|
-
const html = getDocumentElement(element);
|
|
1498
|
-
const visualViewport = win.visualViewport;
|
|
1499
|
-
let width = html.clientWidth;
|
|
1500
|
-
let height = html.clientHeight;
|
|
1501
|
-
let x = 0;
|
|
1502
|
-
let y = 0;
|
|
1503
|
-
if (visualViewport) {
|
|
1504
|
-
width = visualViewport.width;
|
|
1505
|
-
height = visualViewport.height;
|
|
1506
|
-
const visualViewportBased = isWebKit();
|
|
1507
|
-
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
1508
|
-
x = visualViewport.offsetLeft;
|
|
1509
|
-
y = visualViewport.offsetTop;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
return {
|
|
1513
|
-
width,
|
|
1514
|
-
height,
|
|
1515
|
-
x,
|
|
1516
|
-
y
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
// Returns the inner client rect, subtracting scrollbars if present.
|
|
1521
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
1522
|
-
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1523
|
-
const top = clientRect.top + element.clientTop;
|
|
1524
|
-
const left = clientRect.left + element.clientLeft;
|
|
1525
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
1526
|
-
const width = element.clientWidth * scale.x;
|
|
1527
|
-
const height = element.clientHeight * scale.y;
|
|
1528
|
-
const x = left * scale.x;
|
|
1529
|
-
const y = top * scale.y;
|
|
1530
|
-
return {
|
|
1531
|
-
width,
|
|
1532
|
-
height,
|
|
1533
|
-
x,
|
|
1534
|
-
y
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1538
|
-
let rect;
|
|
1539
|
-
if (clippingAncestor === 'viewport') {
|
|
1540
|
-
rect = getViewportRect(element, strategy);
|
|
1541
|
-
} else if (clippingAncestor === 'document') {
|
|
1542
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
1543
|
-
} else if (isElement(clippingAncestor)) {
|
|
1544
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1545
|
-
} else {
|
|
1546
|
-
const visualOffsets = getVisualOffsets(element);
|
|
1547
|
-
rect = {
|
|
1548
|
-
...clippingAncestor,
|
|
1549
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
1550
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
return rectToClientRect(rect);
|
|
1554
|
-
}
|
|
1555
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
1556
|
-
const parentNode = getParentNode(element);
|
|
1557
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
1558
|
-
return false;
|
|
1559
|
-
}
|
|
1560
|
-
return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
1564
|
-
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
1565
|
-
// of the given element up the tree.
|
|
1566
|
-
function getClippingElementAncestors(element, cache) {
|
|
1567
|
-
const cachedResult = cache.get(element);
|
|
1568
|
-
if (cachedResult) {
|
|
1569
|
-
return cachedResult;
|
|
1570
|
-
}
|
|
1571
|
-
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1572
|
-
let currentContainingBlockComputedStyle = null;
|
|
1573
|
-
const elementIsFixed = getComputedStyle(element).position === 'fixed';
|
|
1574
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1575
|
-
|
|
1576
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1577
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1578
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
1579
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
1580
|
-
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
1581
|
-
currentContainingBlockComputedStyle = null;
|
|
1582
|
-
}
|
|
1583
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
1584
|
-
if (shouldDropCurrentNode) {
|
|
1585
|
-
// Drop non-containing blocks.
|
|
1586
|
-
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1587
|
-
} else {
|
|
1588
|
-
// Record last containing block for next iteration.
|
|
1589
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
1590
|
-
}
|
|
1591
|
-
currentNode = getParentNode(currentNode);
|
|
1592
|
-
}
|
|
1593
|
-
cache.set(element, result);
|
|
1594
|
-
return result;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
// Gets the maximum area that the element is visible in due to any number of
|
|
1598
|
-
// clipping ancestors.
|
|
1599
|
-
function getClippingRect(_ref) {
|
|
1600
|
-
let {
|
|
1601
|
-
element,
|
|
1602
|
-
boundary,
|
|
1603
|
-
rootBoundary,
|
|
1604
|
-
strategy
|
|
1605
|
-
} = _ref;
|
|
1606
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1607
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1608
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
1609
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
1610
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
1611
|
-
accRect.top = max(rect.top, accRect.top);
|
|
1612
|
-
accRect.right = min(rect.right, accRect.right);
|
|
1613
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
1614
|
-
accRect.left = max(rect.left, accRect.left);
|
|
1615
|
-
return accRect;
|
|
1616
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
1617
|
-
return {
|
|
1618
|
-
width: clippingRect.right - clippingRect.left,
|
|
1619
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
1620
|
-
x: clippingRect.left,
|
|
1621
|
-
y: clippingRect.top
|
|
1622
|
-
};
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
function getDimensions(element) {
|
|
1626
|
-
const {
|
|
1627
|
-
width,
|
|
1628
|
-
height
|
|
1629
|
-
} = getCssDimensions(element);
|
|
1630
|
-
return {
|
|
1631
|
-
width,
|
|
1632
|
-
height
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1637
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1638
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1639
|
-
const isFixed = strategy === 'fixed';
|
|
1640
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
1641
|
-
let scroll = {
|
|
1642
|
-
scrollLeft: 0,
|
|
1643
|
-
scrollTop: 0
|
|
1644
|
-
};
|
|
1645
|
-
const offsets = createCoords(0);
|
|
1646
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1647
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1648
|
-
scroll = getNodeScroll(offsetParent);
|
|
1649
|
-
}
|
|
1650
|
-
if (isOffsetParentAnElement) {
|
|
1651
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
1652
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1653
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1654
|
-
} else if (documentElement) {
|
|
1655
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
1659
|
-
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
1660
|
-
return {
|
|
1661
|
-
x,
|
|
1662
|
-
y,
|
|
1663
|
-
width: rect.width,
|
|
1664
|
-
height: rect.height
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
function isStaticPositioned(element) {
|
|
1669
|
-
return getComputedStyle(element).position === 'static';
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
1673
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1674
|
-
return null;
|
|
1675
|
-
}
|
|
1676
|
-
if (polyfill) {
|
|
1677
|
-
return polyfill(element);
|
|
1678
|
-
}
|
|
1679
|
-
return element.offsetParent;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1683
|
-
// such as table ancestors and cross browser bugs.
|
|
1684
|
-
function getOffsetParent(element, polyfill) {
|
|
1685
|
-
const win = getWindow(element);
|
|
1686
|
-
if (isTopLayer(element)) {
|
|
1687
|
-
return win;
|
|
1688
|
-
}
|
|
1689
|
-
if (!isHTMLElement(element)) {
|
|
1690
|
-
let svgOffsetParent = getParentNode(element);
|
|
1691
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1692
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1693
|
-
return svgOffsetParent;
|
|
1694
|
-
}
|
|
1695
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1696
|
-
}
|
|
1697
|
-
return win;
|
|
1698
|
-
}
|
|
1699
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1700
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1701
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1702
|
-
}
|
|
1703
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1704
|
-
return win;
|
|
1705
|
-
}
|
|
1706
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
const getElementRects = async function (data) {
|
|
1710
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1711
|
-
const getDimensionsFn = this.getDimensions;
|
|
1712
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1713
|
-
return {
|
|
1714
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1715
|
-
floating: {
|
|
1716
|
-
x: 0,
|
|
1717
|
-
y: 0,
|
|
1718
|
-
width: floatingDimensions.width,
|
|
1719
|
-
height: floatingDimensions.height
|
|
1720
|
-
}
|
|
1721
|
-
};
|
|
1722
|
-
};
|
|
1723
|
-
|
|
1724
|
-
function isRTL(element) {
|
|
1725
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
const platform = {
|
|
1729
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
1730
|
-
getDocumentElement,
|
|
1731
|
-
getClippingRect,
|
|
1732
|
-
getOffsetParent,
|
|
1733
|
-
getElementRects,
|
|
1734
|
-
getClientRects,
|
|
1735
|
-
getDimensions,
|
|
1736
|
-
getScale,
|
|
1737
|
-
isElement,
|
|
1738
|
-
isRTL
|
|
1739
|
-
};
|
|
1740
|
-
|
|
1741
|
-
// https://samthor.au/2021/observing-dom/
|
|
1742
|
-
function observeMove(element, onMove) {
|
|
1743
|
-
let io = null;
|
|
1744
|
-
let timeoutId;
|
|
1745
|
-
const root = getDocumentElement(element);
|
|
1746
|
-
function cleanup() {
|
|
1747
|
-
var _io;
|
|
1748
|
-
clearTimeout(timeoutId);
|
|
1749
|
-
(_io = io) == null || _io.disconnect();
|
|
1750
|
-
io = null;
|
|
1751
|
-
}
|
|
1752
|
-
function refresh(skip, threshold) {
|
|
1753
|
-
if (skip === void 0) {
|
|
1754
|
-
skip = false;
|
|
1755
|
-
}
|
|
1756
|
-
if (threshold === void 0) {
|
|
1757
|
-
threshold = 1;
|
|
1758
|
-
}
|
|
1759
|
-
cleanup();
|
|
1760
|
-
const {
|
|
1761
|
-
left,
|
|
1762
|
-
top,
|
|
1763
|
-
width,
|
|
1764
|
-
height
|
|
1765
|
-
} = element.getBoundingClientRect();
|
|
1766
|
-
if (!skip) {
|
|
1767
|
-
onMove();
|
|
1768
|
-
}
|
|
1769
|
-
if (!width || !height) {
|
|
1770
|
-
return;
|
|
1771
|
-
}
|
|
1772
|
-
const insetTop = floor(top);
|
|
1773
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
1774
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
1775
|
-
const insetLeft = floor(left);
|
|
1776
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
1777
|
-
const options = {
|
|
1778
|
-
rootMargin,
|
|
1779
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
1780
|
-
};
|
|
1781
|
-
let isFirstUpdate = true;
|
|
1782
|
-
function handleObserve(entries) {
|
|
1783
|
-
const ratio = entries[0].intersectionRatio;
|
|
1784
|
-
if (ratio !== threshold) {
|
|
1785
|
-
if (!isFirstUpdate) {
|
|
1786
|
-
return refresh();
|
|
1787
|
-
}
|
|
1788
|
-
if (!ratio) {
|
|
1789
|
-
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
1790
|
-
// to prevent an infinite loop of updates.
|
|
1791
|
-
timeoutId = setTimeout(() => {
|
|
1792
|
-
refresh(false, 1e-7);
|
|
1793
|
-
}, 1000);
|
|
1794
|
-
} else {
|
|
1795
|
-
refresh(false, ratio);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
isFirstUpdate = false;
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
// Older browsers don't support a `document` as the root and will throw an
|
|
1802
|
-
// error.
|
|
1803
|
-
try {
|
|
1804
|
-
io = new IntersectionObserver(handleObserve, {
|
|
1805
|
-
...options,
|
|
1806
|
-
// Handle <iframe>s
|
|
1807
|
-
root: root.ownerDocument
|
|
1808
|
-
});
|
|
1809
|
-
} catch (e) {
|
|
1810
|
-
io = new IntersectionObserver(handleObserve, options);
|
|
1811
|
-
}
|
|
1812
|
-
io.observe(element);
|
|
1813
|
-
}
|
|
1814
|
-
refresh(true);
|
|
1815
|
-
return cleanup;
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
/**
|
|
1819
|
-
* Automatically updates the position of the floating element when necessary.
|
|
1820
|
-
* Should only be called when the floating element is mounted on the DOM or
|
|
1821
|
-
* visible on the screen.
|
|
1822
|
-
* @returns cleanup function that should be invoked when the floating element is
|
|
1823
|
-
* removed from the DOM or hidden from the screen.
|
|
1824
|
-
* @see https://floating-ui.com/docs/autoUpdate
|
|
1825
|
-
*/
|
|
1826
|
-
function autoUpdate(reference, floating, update, options) {
|
|
1827
|
-
if (options === void 0) {
|
|
1828
|
-
options = {};
|
|
1829
|
-
}
|
|
1830
|
-
const {
|
|
1831
|
-
ancestorScroll = true,
|
|
1832
|
-
ancestorResize = true,
|
|
1833
|
-
elementResize = typeof ResizeObserver === 'function',
|
|
1834
|
-
layoutShift = typeof IntersectionObserver === 'function',
|
|
1835
|
-
animationFrame = false
|
|
1836
|
-
} = options;
|
|
1837
|
-
const referenceEl = unwrapElement(reference);
|
|
1838
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
1839
|
-
ancestors.forEach(ancestor => {
|
|
1840
|
-
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
1841
|
-
passive: true
|
|
1842
|
-
});
|
|
1843
|
-
ancestorResize && ancestor.addEventListener('resize', update);
|
|
1844
|
-
});
|
|
1845
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
1846
|
-
let reobserveFrame = -1;
|
|
1847
|
-
let resizeObserver = null;
|
|
1848
|
-
if (elementResize) {
|
|
1849
|
-
resizeObserver = new ResizeObserver(_ref => {
|
|
1850
|
-
let [firstEntry] = _ref;
|
|
1851
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
1852
|
-
// Prevent update loops when using the `size` middleware.
|
|
1853
|
-
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
1854
|
-
resizeObserver.unobserve(floating);
|
|
1855
|
-
cancelAnimationFrame(reobserveFrame);
|
|
1856
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
1857
|
-
var _resizeObserver;
|
|
1858
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1859
|
-
});
|
|
1860
|
-
}
|
|
1861
|
-
update();
|
|
1862
|
-
});
|
|
1863
|
-
if (referenceEl && !animationFrame) {
|
|
1864
|
-
resizeObserver.observe(referenceEl);
|
|
1865
|
-
}
|
|
1866
|
-
resizeObserver.observe(floating);
|
|
1867
|
-
}
|
|
1868
|
-
let frameId;
|
|
1869
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1870
|
-
if (animationFrame) {
|
|
1871
|
-
frameLoop();
|
|
1872
|
-
}
|
|
1873
|
-
function frameLoop() {
|
|
1874
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
1875
|
-
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
1876
|
-
update();
|
|
1877
|
-
}
|
|
1878
|
-
prevRefRect = nextRefRect;
|
|
1879
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
1880
|
-
}
|
|
1881
|
-
update();
|
|
1882
|
-
return () => {
|
|
1883
|
-
var _resizeObserver2;
|
|
1884
|
-
ancestors.forEach(ancestor => {
|
|
1885
|
-
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
1886
|
-
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
1887
|
-
});
|
|
1888
|
-
cleanupIo == null || cleanupIo();
|
|
1889
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1890
|
-
resizeObserver = null;
|
|
1891
|
-
if (animationFrame) {
|
|
1892
|
-
cancelAnimationFrame(frameId);
|
|
1893
|
-
}
|
|
1894
|
-
};
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
/**
|
|
1898
|
-
* Modifies the placement by translating the floating element along the
|
|
1899
|
-
* specified axes.
|
|
1900
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1901
|
-
* object may be passed.
|
|
1902
|
-
* @see https://floating-ui.com/docs/offset
|
|
1903
|
-
*/
|
|
1904
|
-
const offset = offset$1;
|
|
1905
|
-
|
|
1906
|
-
/**
|
|
1907
|
-
* Optimizes the visibility of the floating element by choosing the placement
|
|
1908
|
-
* that has the most space available automatically, without needing to specify a
|
|
1909
|
-
* preferred placement. Alternative to `flip`.
|
|
1910
|
-
* @see https://floating-ui.com/docs/autoPlacement
|
|
1911
|
-
*/
|
|
1912
|
-
autoPlacement;
|
|
1913
|
-
|
|
1914
|
-
/**
|
|
1915
|
-
* Optimizes the visibility of the floating element by shifting it in order to
|
|
1916
|
-
* keep it in view when it will overflow the clipping boundary.
|
|
1917
|
-
* @see https://floating-ui.com/docs/shift
|
|
1918
|
-
*/
|
|
1919
|
-
const shift = shift$1;
|
|
1920
|
-
|
|
1921
|
-
/**
|
|
1922
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1923
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1924
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
1925
|
-
* @see https://floating-ui.com/docs/flip
|
|
1926
|
-
*/
|
|
1927
|
-
const flip = flip$1;
|
|
1928
|
-
|
|
1929
|
-
/**
|
|
1930
|
-
* Provides data that allows you to change the size of the floating element —
|
|
1931
|
-
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
1932
|
-
* width of the reference element.
|
|
1933
|
-
* @see https://floating-ui.com/docs/size
|
|
1934
|
-
*/
|
|
1935
|
-
const size = size$1;
|
|
1936
|
-
|
|
1937
|
-
/**
|
|
1938
|
-
* Provides data to hide the floating element in applicable situations, such as
|
|
1939
|
-
* when it is not in the same clipping context as the reference element.
|
|
1940
|
-
* @see https://floating-ui.com/docs/hide
|
|
1941
|
-
*/
|
|
1942
|
-
hide;
|
|
1943
|
-
|
|
1944
|
-
/**
|
|
1945
|
-
* Provides data to position an inner element of the floating element so that it
|
|
1946
|
-
* appears centered to the reference element.
|
|
1947
|
-
* @see https://floating-ui.com/docs/arrow
|
|
1948
|
-
*/
|
|
1949
|
-
const arrow = arrow$1;
|
|
1950
|
-
|
|
1951
|
-
/**
|
|
1952
|
-
* Provides improved positioning for inline reference elements that can span
|
|
1953
|
-
* over multiple lines, such as hyperlinks or range selections.
|
|
1954
|
-
* @see https://floating-ui.com/docs/inline
|
|
1955
|
-
*/
|
|
1956
|
-
const inline = inline$1;
|
|
1957
|
-
|
|
1958
|
-
/**
|
|
1959
|
-
* Built-in `limiter` that will stop `shift()` at a certain point.
|
|
1960
|
-
*/
|
|
1961
|
-
const limitShift = limitShift$1;
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1965
|
-
* next to a given reference element.
|
|
1966
|
-
*/
|
|
1967
|
-
const computePosition = (reference, floating, options) => {
|
|
1968
|
-
// This caches the expensive `getClippingElementAncestors` function so that
|
|
1969
|
-
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
1970
|
-
// single call. If other functions become expensive, we can add them as well.
|
|
1971
|
-
const cache = new Map();
|
|
1972
|
-
const mergedOptions = {
|
|
1973
|
-
platform,
|
|
1974
|
-
...options
|
|
1975
|
-
};
|
|
1976
|
-
const platformWithCache = {
|
|
1977
|
-
...mergedOptions.platform,
|
|
1978
|
-
_c: cache
|
|
1979
|
-
};
|
|
1980
|
-
return computePosition$1(reference, floating, {
|
|
1981
|
-
...mergedOptions,
|
|
1982
|
-
platform: platformWithCache
|
|
1983
|
-
});
|
|
1984
|
-
};
|
|
1985
|
-
|
|
1986
|
-
(()=>{var c=class extends Event{oldState;newState;constructor(t,{oldState:o="",newState:r="",...i}={}){super(t,i),this.oldState=String(o||""),this.newState=String(r||"");}},R=new WeakMap;function A(e,t,o){R.set(e,setTimeout(()=>{R.has(e)&&e.dispatchEvent(new c("toggle",{cancelable:!1,oldState:t,newState:o}));},0));}var D=globalThis.ShadowRoot||function(){},z=globalThis.HTMLDialogElement||function(){},M=new WeakMap,p=new WeakMap,h=new WeakMap;function L(e){return h.get(e)||"hidden"}var b=new WeakMap;function O(e){let t=e.popoverTargetElement;if(!(t instanceof HTMLElement))return;let o=L(t);e.popoverTargetAction==="show"&&o==="showing"||e.popoverTargetAction==="hide"&&o==="hidden"||(o==="showing"?m(t,!0,!0):d(t,!1)&&(b.set(t,e),S(t)));}function d(e,t){return !(e.popover!=="auto"&&e.popover!=="manual"||!e.isConnected||t&&L(e)!=="showing"||!t&&L(e)!=="hidden"||e instanceof z&&e.hasAttribute("open")||document.fullscreenElement===e)}function N(e){return e?Array.from(p.get(e.ownerDocument)||[]).indexOf(e)+1:0}function V(e){let t=W(e),o=U(e);return N(t)>N(o)?t:o}function y(e){let t=p.get(e);for(let o of t||[])if(!o.isConnected)t.delete(o);else return o;return null}function v(e){return typeof e.getRootNode=="function"?e.getRootNode():e.parentNode?v(e.parentNode):e}function W(e){for(;e;){if(e instanceof HTMLElement&&e.popover==="auto"&&h.get(e)==="showing")return e;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function U(e){for(;e;){let t=e.popoverTargetElement;if(t instanceof HTMLElement)return t;if(e=e.parentElement||v(e),e instanceof D&&(e=e.host),e instanceof Document)return}}function G(e){let t=new Map,o=0,r=e.ownerDocument;for(let a of p.get(r)||[])t.set(a,o),o+=1;t.set(e,o),o+=1;let i=null;function l(a){let g=W(a);if(g===null)return null;let n=t.get(g);(i===null||t.get(i)<n)&&(i=g);}return l(e?.parentElement),i}function Q(e){return e.hidden||e instanceof D||(e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement||e instanceof HTMLFieldSetElement)&&e.disabled||e instanceof HTMLInputElement&&e.type==="hidden"||e instanceof HTMLAnchorElement&&e.href===""?!1:typeof e.tabIndex=="number"&&e.tabIndex!==-1}function _(e){if(e.shadowRoot&&e.shadowRoot.delegatesFocus!==!0)return null;let t=e;t.shadowRoot&&(t=t.shadowRoot);let o=t.querySelector("[autofocus]");if(o)return o;{let l=t.querySelectorAll("slot");for(let a of l){let g=a.assignedElements({flatten:!0});for(let n of g){if(n.hasAttribute("autofocus"))return n;if(o=n.querySelector("[autofocus]"),o)return o}}}let r=e.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT),i=r.currentNode;for(;i;){if(Q(i))return i;i=r.nextNode();}}function $(e){_(e)?.focus();}var H=new WeakMap;function S(e){if(!d(e,!1))return;let t=e.ownerDocument;if(!e.dispatchEvent(new c("beforetoggle",{cancelable:!0,oldState:"closed",newState:"open"}))||!d(e,!1))return;let o=!1;if(e.popover==="auto"){let i=e.getAttribute("popover"),l=G(e)||t;if(T(l,!1,!0),i!==e.getAttribute("popover")||!d(e,!1))return}y(t)||(o=!0),H.delete(e);let r=t.activeElement;e.classList.add(":popover-open"),h.set(e,"showing"),M.has(t)||M.set(t,new Set),M.get(t).add(e),$(e),e.popover==="auto"&&(p.has(t)||p.set(t,new Set),p.get(t).add(e),q(b.get(e),!0)),o&&r&&e.popover==="auto"&&H.set(e,r),A(e,"closed","open");}function m(e,t=!1,o=!1){if(!d(e,!0))return;let r=e.ownerDocument;if(e.popover==="auto"&&(T(e,t,o),!d(e,!0))||(q(b.get(e),!1),b.delete(e),o&&(e.dispatchEvent(new c("beforetoggle",{oldState:"open",newState:"closed"})),!d(e,!0))))return;M.get(r)?.delete(e),p.get(r)?.delete(e),e.classList.remove(":popover-open"),h.set(e,"hidden"),o&&A(e,"open","closed");let i=H.get(e);i&&(H.delete(e),t&&i.focus());}function F(e,t=!1,o=!1){let r=y(e);for(;r;)m(r,t,o),r=y(e);}function T(e,t,o){let r=e.ownerDocument||e;if(e instanceof Document)return F(r,t,o);let i=null,l=!1;for(let a of p.get(r)||[])if(a===e)l=!0;else if(l){i=a;break}if(!l)return F(r,t,o);for(;i&&L(i)==="showing"&&p.get(r)?.size;)m(i,t,o);}var P=new WeakMap;function x(e){if(!e.isTrusted)return;let t=e.composedPath()[0];if(!t)return;let o=t.ownerDocument;if(!y(o))return;let i=V(t);if(i&&e.type==="pointerdown")P.set(o,i);else if(e.type==="pointerup"){let l=P.get(o)===i;P.delete(o),l&&T(i||o,!1,!0);}}var k=new WeakMap;function q(e,t=!1){if(!e)return;k.has(e)||k.set(e,e.getAttribute("aria-expanded"));let o=e.popoverTargetElement;if(o instanceof HTMLElement&&o.popover==="auto")e.setAttribute("aria-expanded",String(t));else {let r=k.get(e);r?e.setAttribute("aria-expanded",r):e.removeAttribute("aria-expanded");}}var B=globalThis.ShadowRoot||function(){};function j(){return typeof HTMLElement<"u"&&typeof HTMLElement.prototype=="object"&&"popover"in HTMLElement.prototype}function f(e,t,o){let r=e[t];Object.defineProperty(e,t,{value(i){return r.call(this,o(i))}});}var J=/(^|[^\\]):popover-open\b/g,C=`
|
|
1987
|
-
:where([popover]) {
|
|
1988
|
-
position: fixed;
|
|
1989
|
-
z-index: 2147483647;
|
|
1990
|
-
inset: 0;
|
|
1991
|
-
padding: 0.25em;
|
|
1992
|
-
width: fit-content;
|
|
1993
|
-
height: fit-content;
|
|
1994
|
-
border-width: initial;
|
|
1995
|
-
border-color: initial;
|
|
1996
|
-
border-image: initial;
|
|
1997
|
-
border-style: solid;
|
|
1998
|
-
background-color: canvas;
|
|
1999
|
-
color: canvastext;
|
|
2000
|
-
overflow: auto;
|
|
2001
|
-
margin: auto;
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
:where(dialog[popover][open]) {
|
|
2005
|
-
display: revert;
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
:where([anchor].\\:popover-open) {
|
|
2009
|
-
inset: auto;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
:where([anchor]:popover-open) {
|
|
2013
|
-
inset: auto;
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
@supports not (background-color: canvas) {
|
|
2017
|
-
:where([popover]) {
|
|
2018
|
-
background-color: white;
|
|
2019
|
-
color: black;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
@supports (width: -moz-fit-content) {
|
|
2024
|
-
:where([popover]) {
|
|
2025
|
-
width: -moz-fit-content;
|
|
2026
|
-
height: -moz-fit-content;
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
@supports not (inset: 0) {
|
|
2031
|
-
:where([popover]) {
|
|
2032
|
-
top: 0;
|
|
2033
|
-
left: 0;
|
|
2034
|
-
right: 0;
|
|
2035
|
-
bottom: 0;
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
:where([popover]:not(.\\:popover-open)) {
|
|
2040
|
-
display: none;
|
|
2041
|
-
}
|
|
2042
|
-
`,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
|
|
2043
|
-
|
|
2044
|
-
const postPopovercontainerCss = "@keyframes popIn{from{transform:scale(0.9);opacity:0;transition-property:transform,opacity,overlay,display;transition-behavior:allow-discrete;transition-duration:var(--post-transition-duration, 0.35s);transition-timing-function:linear(0, 0.007, 0.029 2.2%, 0.118 4.7%, 0.625 14.4%, 0.826 19%, 0.902, 0.962, 1.008 26.1%, 1.041 28.7%, 1.064 32.1%, 1.07 36%, 1.061 40.5%, 1.015 53.4%, 0.999 61.6%, 0.995 71.2%, 1)}to{opacity:1;transform:scale(1)}}/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *//*!\n * Copyright 2021 by Swiss Post, Information Technology\n */@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}:where(post-popovercontainer){background-color:rgba(0,0,0,0);border:rgba(0,0,0,0);position:fixed;margin:0;padding:0;overflow:visible}:where(post-popovercontainer)>div{box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);width:max-content;display:flex;align-items:center;max-width:100%;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px}:where(post-popovercontainer)>div.animate-pop-in{animation:popIn .25s ease-out forwards}:where(post-popovercontainer)[tooltip]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}:where(post-popovercontainer)[safe-space]::after{content:\"\";position:fixed;inset:0;z-index:-1;pointer-events:auto}:where(post-popovercontainer)[safe-space=triangle]::after{clip-path:polygon(var(--post-safe-space-cursor-x, 0) var(--post-safe-space-cursor-y, 0), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)))}:where(post-popovercontainer)[safe-space=trapezoid]::after{clip-path:polygon(var(--post-safe-space-trigger-x-start, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-start, 0)), var(--post-safe-space-trigger-x-end, var(--post-safe-space-trigger-x, 0)) var(--post-safe-space-trigger-y, var(--post-safe-space-trigger-y-end, 0)), var(--post-safe-space-popover-x-end, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-end, 0)), var(--post-safe-space-popover-x-start, var(--post-safe-space-popover-x, 0)) var(--post-safe-space-popover-y, var(--post-safe-space-popover-y-start, 0)))}:where(post-popovercontainer):has(.arrow)>div{filter:drop-shadow(1px 2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(2px 4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(4px 8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.top)>div{filter:drop-shadow(0px -2px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(0px -4px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(0px -8px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.left)>div{filter:drop-shadow(-2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(-4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(-8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer):has(.arrow.right)>div{filter:drop-shadow(2px 0px 3px hsla(216, 9%, 11%, 0.15)) drop-shadow(4px 0px 6px hsla(225, 17%, 9%, 0.15)) drop-shadow(8px 0px 12px hsla(225, 7%, 11%, 0.15))}:where(post-popovercontainer) .arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}:where(post-popovercontainer) .arrow.top{border-block-start:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.right{border-block-start:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.left{border-block-end:2px solid rgba(0,0,0,0);border-inline-start:2px solid rgba(0,0,0,0)}:where(post-popovercontainer) .arrow.bottom{border-block-end:2px solid rgba(0,0,0,0);border-inline-end:2px solid rgba(0,0,0,0)}";
|
|
2045
|
-
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
2046
|
-
|
|
2047
|
-
const PostPopovercontainer = class {
|
|
2048
|
-
constructor(hostRef) {
|
|
2049
|
-
index.registerInstance(this, hostRef);
|
|
2050
|
-
this.postToggle = index.createEvent(this, "postToggle", 7);
|
|
2051
|
-
this.placement = 'top';
|
|
2052
|
-
this.edgeGap = 8;
|
|
2053
|
-
this.animation = null;
|
|
2054
|
-
this.arrow = false;
|
|
2055
|
-
this.safeSpace = undefined;
|
|
2056
|
-
}
|
|
2057
|
-
/**
|
|
2058
|
-
* Updates cursor position for safe space feature when popover is open.
|
|
2059
|
-
* Sets CSS custom properties for dynamic styling of safe area.
|
|
2060
|
-
* @param event MouseEvent with cursor position
|
|
2061
|
-
*/
|
|
2062
|
-
mouseTrackingHandler(event) {
|
|
2063
|
-
this.host.style.setProperty('--post-safe-space-cursor-x', `${event.clientX}px`);
|
|
2064
|
-
this.host.style.setProperty('--post-safe-space-cursor-y', `${event.clientY}px`);
|
|
2065
|
-
}
|
|
2066
|
-
componentDidLoad() {
|
|
2067
|
-
this.host.setAttribute('popover', '');
|
|
2068
|
-
this.host.addEventListener('beforetoggle', this.handleToggle.bind(this));
|
|
2069
|
-
}
|
|
2070
|
-
disconnectedCallback() {
|
|
2071
|
-
if (typeof this.clearAutoUpdate === 'function') {
|
|
2072
|
-
this.clearAutoUpdate();
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
/**
|
|
2076
|
-
* Programmatically display the popovercontainer
|
|
2077
|
-
* @param target An element with [data-popover-target="id"] where the popovercontainer should be shown
|
|
2078
|
-
*/
|
|
2079
|
-
async show(target) {
|
|
2080
|
-
if (!this.toggleTimeoutId) {
|
|
2081
|
-
this.eventTarget = target;
|
|
2082
|
-
this.calculatePosition();
|
|
2083
|
-
this.host.showPopover();
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
/**
|
|
2087
|
-
* Programmatically hide the popovercontainer
|
|
2088
|
-
*/
|
|
2089
|
-
async hide() {
|
|
2090
|
-
if (!this.toggleTimeoutId) {
|
|
2091
|
-
this.eventTarget = null;
|
|
2092
|
-
this.host.hidePopover();
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
/**
|
|
2096
|
-
* Toggle popovercontainer display
|
|
2097
|
-
* @param target An element with [data-popover-target="id"] where the popovercontainer should be shown
|
|
2098
|
-
* @param force Pass true to always show or false to always hide
|
|
2099
|
-
*/
|
|
2100
|
-
async toggle(target, force) {
|
|
2101
|
-
// Prevent instant double toggle
|
|
2102
|
-
if (!this.toggleTimeoutId) {
|
|
2103
|
-
this.eventTarget = target;
|
|
2104
|
-
this.calculatePosition();
|
|
2105
|
-
this.host.togglePopover(force);
|
|
2106
|
-
this.toggleTimeoutId = null;
|
|
2107
|
-
}
|
|
2108
|
-
return this.host.matches(':where(:popover-open, .popover-open)');
|
|
2109
|
-
}
|
|
2110
|
-
/**
|
|
2111
|
-
* Start or stop auto updates based on popovercontainer events.
|
|
2112
|
-
* Popovercontainers can be closed or opened with other methods than class members,
|
|
2113
|
-
* therefore listening to the toggle event is safer for cleaning up.
|
|
2114
|
-
* @param e ToggleEvent
|
|
2115
|
-
*/
|
|
2116
|
-
handleToggle(e) {
|
|
2117
|
-
this.toggleTimeoutId = window.setTimeout(() => (this.toggleTimeoutId = null), 10);
|
|
2118
|
-
const isOpen = e.newState === 'open';
|
|
2119
|
-
if (isOpen) {
|
|
2120
|
-
this.startAutoupdates();
|
|
2121
|
-
if (this.safeSpace)
|
|
2122
|
-
window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
2123
|
-
}
|
|
2124
|
-
else {
|
|
2125
|
-
if (typeof this.clearAutoUpdate === 'function')
|
|
2126
|
-
this.clearAutoUpdate();
|
|
2127
|
-
if (this.safeSpace)
|
|
2128
|
-
window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
2129
|
-
}
|
|
2130
|
-
this.postToggle.emit(isOpen);
|
|
2131
|
-
}
|
|
2132
|
-
/**
|
|
2133
|
-
* Start listening for DOM updates, scroll events etc. that have
|
|
2134
|
-
* an influence on popovercontainer positioning
|
|
2135
|
-
*/
|
|
2136
|
-
startAutoupdates() {
|
|
2137
|
-
this.clearAutoUpdate = autoUpdate(this.eventTarget, this.host, this.calculatePosition.bind(this));
|
|
2138
|
-
}
|
|
2139
|
-
async calculatePosition() {
|
|
2140
|
-
const { x, y, middlewareData, placement } = await this.computeMainPosition();
|
|
2141
|
-
const currentPlacement = placement.split('-')[0];
|
|
2142
|
-
// Position popover
|
|
2143
|
-
this.host.style.left = `${x}px`;
|
|
2144
|
-
this.host.style.top = `${y}px`;
|
|
2145
|
-
// Position arrow if enabled
|
|
2146
|
-
if (this.arrow && middlewareData.arrow) {
|
|
2147
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
2148
|
-
const staticSide = PostPopovercontainer.STATIC_SIDES[currentPlacement];
|
|
2149
|
-
if (staticSide) {
|
|
2150
|
-
Object.assign(this.arrowRef.style, {
|
|
2151
|
-
left: arrowX ? `${arrowX}px` : '',
|
|
2152
|
-
top: arrowY ? `${arrowY}px` : '',
|
|
2153
|
-
[staticSide]: '-7px',
|
|
2154
|
-
});
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
// Handle safe space if enabled
|
|
2158
|
-
if (this.safeSpace && this.eventTarget) {
|
|
2159
|
-
await this.updateSafeSpaceBoundaries(currentPlacement);
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
async computeMainPosition() {
|
|
2163
|
-
const gap = this.edgeGap;
|
|
2164
|
-
const middleware = [
|
|
2165
|
-
flip(),
|
|
2166
|
-
inline(),
|
|
2167
|
-
shift({
|
|
2168
|
-
padding: gap,
|
|
2169
|
-
limiter: limitShift({
|
|
2170
|
-
offset: 32,
|
|
2171
|
-
}),
|
|
2172
|
-
}),
|
|
2173
|
-
size({
|
|
2174
|
-
apply({ availableWidth, elements }) {
|
|
2175
|
-
Object.assign(elements.floating.style, {
|
|
2176
|
-
maxWidth: `${availableWidth - gap * 2}px`,
|
|
2177
|
-
});
|
|
2178
|
-
},
|
|
2179
|
-
}),
|
|
2180
|
-
offset(this.arrow ? gap + 4 : gap),
|
|
2181
|
-
];
|
|
2182
|
-
if (this.arrow) {
|
|
2183
|
-
middleware.push(arrow({ element: this.arrowRef, padding: gap }));
|
|
2184
|
-
}
|
|
2185
|
-
return computePosition(this.eventTarget, this.host, {
|
|
2186
|
-
placement: this.placement || 'top',
|
|
2187
|
-
strategy: 'fixed',
|
|
2188
|
-
middleware,
|
|
2189
|
-
});
|
|
2190
|
-
}
|
|
2191
|
-
async updateSafeSpaceBoundaries(currentPlacement) {
|
|
2192
|
-
const targetRect = this.eventTarget.getBoundingClientRect();
|
|
2193
|
-
const popoverRect = this.host.getBoundingClientRect();
|
|
2194
|
-
const isVertical = currentPlacement === 'top' || currentPlacement === 'bottom';
|
|
2195
|
-
// Helper function to get positioning data based on placement
|
|
2196
|
-
const getPositioningData = (placement, popoverRect, targetRect) => {
|
|
2197
|
-
if (placement === 'top' || placement === 'bottom') {
|
|
2198
|
-
return {
|
|
2199
|
-
popover: {
|
|
2200
|
-
y: placement === 'top' ? popoverRect.bottom : popoverRect.top,
|
|
2201
|
-
xStart: popoverRect.left,
|
|
2202
|
-
xEnd: popoverRect.right,
|
|
2203
|
-
},
|
|
2204
|
-
trigger: {
|
|
2205
|
-
y: placement === 'top' ? targetRect.top : targetRect.bottom,
|
|
2206
|
-
xStart: targetRect.left,
|
|
2207
|
-
xEnd: targetRect.right,
|
|
2208
|
-
},
|
|
2209
|
-
};
|
|
2210
|
-
}
|
|
2211
|
-
else {
|
|
2212
|
-
// left or right
|
|
2213
|
-
return {
|
|
2214
|
-
popover: {
|
|
2215
|
-
x: placement === 'left' ? popoverRect.right : popoverRect.left,
|
|
2216
|
-
yStart: popoverRect.top,
|
|
2217
|
-
yEnd: popoverRect.bottom,
|
|
2218
|
-
},
|
|
2219
|
-
trigger: {
|
|
2220
|
-
x: placement === 'left' ? targetRect.left : targetRect.right,
|
|
2221
|
-
yStart: targetRect.top,
|
|
2222
|
-
yEnd: targetRect.bottom,
|
|
2223
|
-
},
|
|
2224
|
-
};
|
|
2225
|
-
}
|
|
2226
|
-
};
|
|
2227
|
-
const posData = getPositioningData(currentPlacement, popoverRect, targetRect);
|
|
2228
|
-
// Clear previous values
|
|
2229
|
-
PostPopovercontainer.PROPERTIES_TO_CLEAR.forEach(prop => {
|
|
2230
|
-
this.host.style.removeProperty(prop);
|
|
2231
|
-
});
|
|
2232
|
-
if (isVertical) {
|
|
2233
|
-
// For top/bottom placement
|
|
2234
|
-
this.host.style.setProperty('--post-safe-space-popover-y', `${posData.popover.y}px`);
|
|
2235
|
-
this.host.style.setProperty('--post-safe-space-popover-x-start', `${posData.popover.xStart}px`);
|
|
2236
|
-
this.host.style.setProperty('--post-safe-space-popover-x-end', `${posData.popover.xEnd}px`);
|
|
2237
|
-
this.host.style.setProperty('--post-safe-space-trigger-y', `${posData.trigger.y}px`);
|
|
2238
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-start', `${posData.trigger.xStart}px`);
|
|
2239
|
-
this.host.style.setProperty('--post-safe-space-trigger-x-end', `${posData.trigger.xEnd}px`);
|
|
2240
|
-
}
|
|
2241
|
-
else {
|
|
2242
|
-
// For left/right placement
|
|
2243
|
-
this.host.style.setProperty('--post-safe-space-popover-x', `${posData.popover.x}px`);
|
|
2244
|
-
this.host.style.setProperty('--post-safe-space-popover-y-start', `${posData.popover.yStart}px`);
|
|
2245
|
-
this.host.style.setProperty('--post-safe-space-popover-y-end', `${posData.popover.yEnd}px`);
|
|
2246
|
-
this.host.style.setProperty('--post-safe-space-trigger-x', `${posData.trigger.x}px`);
|
|
2247
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-start', `${posData.trigger.yStart}px`);
|
|
2248
|
-
this.host.style.setProperty('--post-safe-space-trigger-y-end', `${posData.trigger.yEnd}px`);
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
render() {
|
|
2252
|
-
const animationClass = this.animation ? `animate-${this.animation}` : '';
|
|
2253
|
-
return (index.h(index.Host, { key: '98ea26b46803e8aa98cc2cec53798d994c0ff856', "data-version": _package.version }, index.h("div", { key: '230fa7df2963b36e67a4559f07010f7213240e3c', class: animationClass }, this.arrow && (index.h("span", { key: '58647eb14ef84ff04b04b7dec0bbb38b9bcd4b69', class: "arrow", ref: el => {
|
|
2254
|
-
this.arrowRef = el;
|
|
2255
|
-
} })), index.h("slot", { key: 'de0afc53f013ac7d4cdd06e0e2d7746a8e0971dc' }))));
|
|
2256
|
-
}
|
|
2257
|
-
get host() { return index.getElement(this); }
|
|
2258
|
-
};
|
|
2259
|
-
PostPopovercontainer.STATIC_SIDES = {
|
|
2260
|
-
top: 'bottom',
|
|
2261
|
-
right: 'left',
|
|
2262
|
-
bottom: 'top',
|
|
2263
|
-
left: 'right',
|
|
2264
|
-
};
|
|
2265
|
-
PostPopovercontainer.PROPERTIES_TO_CLEAR = [
|
|
2266
|
-
'--post-safe-space-popover-x',
|
|
2267
|
-
'--post-safe-space-popover-y',
|
|
2268
|
-
'--post-safe-space-popover-x-start',
|
|
2269
|
-
'--post-safe-space-popover-x-end',
|
|
2270
|
-
'--post-safe-space-popover-y-start',
|
|
2271
|
-
'--post-safe-space-popover-y-end',
|
|
2272
|
-
'--post-safe-space-trigger-x',
|
|
2273
|
-
'--post-safe-space-trigger-y',
|
|
2274
|
-
'--post-safe-space-trigger-x-start',
|
|
2275
|
-
'--post-safe-space-trigger-x-end',
|
|
2276
|
-
'--post-safe-space-trigger-y-start',
|
|
2277
|
-
'--post-safe-space-trigger-y-end',
|
|
2278
|
-
];
|
|
2279
|
-
PostPopovercontainer.style = PostPopovercontainerStyle0;
|
|
2280
|
-
|
|
2281
|
-
exports.PostPopovercontainer = PostPopovercontainer;
|