@siemens/ix 1.4.0-beta.0 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{animation-dfe01edc.js → animation-d5cc0bec.js} +1 -1
- package/dist/cjs/{base-button-6ef79cb6.js → base-button-497db257.js} +1 -1
- package/dist/cjs/context-a0900b95.js +75 -0
- package/dist/cjs/{default-tree-item-4597cd84.js → default-tree-item-89cd1f3f.js} +1 -1
- package/dist/cjs/{flip-tile-state-c95639e5.js → flip-tile-state-b5ff5ea0.js} +1 -1
- package/dist/cjs/{alignment-24ae2e63.js → floating-ui.dom.esm-01fe5abe.js} +529 -401
- package/dist/cjs/index-f4b8e6ee.js +20 -0
- package/dist/cjs/index.cjs.js +12 -12
- package/dist/cjs/ix-animated-tab_2.cjs.entry.js +2 -2
- package/dist/cjs/ix-application-header.cjs.entry.js +25 -2
- package/dist/cjs/ix-basic-navigation.cjs.entry.js +16 -2
- package/dist/cjs/ix-breadcrumb_2.cjs.entry.js +1 -1
- package/dist/cjs/ix-burger-menu.cjs.entry.js +22 -0
- package/dist/cjs/ix-button.cjs.entry.js +3 -3
- package/dist/cjs/ix-category-filter.cjs.entry.js +2 -2
- package/dist/cjs/ix-divider.cjs.entry.js +19 -0
- package/dist/cjs/ix-dropdown-button.cjs.entry.js +5 -3
- package/dist/cjs/ix-dropdown-quick-actions.cjs.entry.js +19 -0
- package/dist/cjs/ix-dropdown_2.cjs.entry.js +92 -20
- package/dist/cjs/ix-event-list_2.cjs.entry.js +3 -3
- package/dist/cjs/ix-flip-tile_2.cjs.entry.js +1 -1
- package/dist/cjs/ix-group-context-menu.cjs.entry.js +0 -3
- package/dist/cjs/ix-group_3.cjs.entry.js +1 -1
- package/dist/cjs/ix-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/ix-menu_9.cjs.entry.js +47 -16
- package/dist/cjs/ix-modal-example.cjs.entry.js +1 -1
- package/dist/cjs/ix-modal_2.cjs.entry.js +3 -3
- package/dist/cjs/ix-select_2.cjs.entry.js +6 -4
- package/dist/cjs/ix-split-button_2.cjs.entry.js +2 -2
- package/dist/cjs/ix-tab-item.cjs.entry.js +1 -1
- package/dist/cjs/ix-tabs.cjs.entry.js +11 -4
- package/dist/cjs/ix-toast_2.cjs.entry.js +9 -5
- package/dist/cjs/ix-toggle.cjs.entry.js +1 -1
- package/dist/cjs/ix-tooltip.cjs.entry.js +127 -0
- package/dist/cjs/ix-tree_2.cjs.entry.js +2 -3
- package/dist/cjs/ix-typography.cjs.entry.js +38 -0
- package/dist/cjs/ix-upload.cjs.entry.js +1 -1
- package/dist/cjs/ix-validation-tooltip.cjs.entry.js +19 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{logical-filter-operator-467e2faf.js → logical-filter-operator-0faf70b8.js} +2 -2
- package/dist/cjs/{modal-2d0f9191.js → modal-a93045dd.js} +3 -3
- package/dist/cjs/{modal-utils-9ee0acda.js → modal-utils-b645989b.js} +1 -1
- package/dist/cjs/{mutation-observer-29bedada.js → mutation-observer-eaaa5399.js} +1 -1
- package/dist/cjs/my-component.cjs.entry.js +1 -1
- package/dist/cjs/{rwd.util-2326824e.js → rwd.util-9480f0b5.js} +1 -1
- package/dist/cjs/service-18dc5907.js +73 -0
- package/dist/cjs/siemens-ix.cjs.js +1 -1
- package/dist/cjs/{theme-switcher-f91c8d8d.js → theme-switcher-67669a35.js} +1 -1
- package/dist/cjs/{typed-event-5030cc6a.js → typed-event-f0f051da.js} +1 -1
- package/dist/cjs/{upload-file-state-923b2c65.js → upload-file-state-a79acf2b.js} +1 -1
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/animated-tab/animated-tab.css +1 -1
- package/dist/collection/components/animated-tab/animated-tab.js +1 -1
- package/dist/collection/components/animated-tabs/animated-tabs.css +4 -4
- package/dist/collection/components/animated-tabs/animated-tabs.js +1 -1
- package/dist/collection/components/application-header/application-header.css +8 -1
- package/dist/collection/components/application-header/application-header.js +31 -2
- package/dist/collection/components/basic-navigation/basic-navigation.css +6 -1
- package/dist/collection/components/basic-navigation/basic-navigation.js +21 -3
- package/dist/collection/components/blind/blind.css +5 -5
- package/dist/collection/components/blind/blind.js +1 -1
- package/dist/collection/components/breadcrumb/breadcrumb.css +4 -4
- package/dist/collection/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/collection/components/breadcrumb-item/breadcrumb-item.css +1 -1
- package/dist/collection/components/breadcrumb-item/breadcrumb-item.js +1 -1
- package/dist/collection/components/button/base-button.js +1 -1
- package/dist/collection/components/button/button.css +7 -2
- package/dist/collection/components/button/button.js +3 -3
- package/dist/collection/components/category-filter/category-filter.css +6 -6
- package/dist/collection/components/category-filter/category-filter.js +2 -2
- package/dist/collection/components/category-filter/filter-state.js +1 -1
- package/dist/collection/components/category-filter/input-state.js +1 -1
- package/dist/collection/components/category-filter/logical-filter-operator.js +1 -1
- package/dist/collection/components/chip/chip.css +4 -4
- package/dist/collection/components/chip/chip.js +1 -1
- package/dist/collection/components/counter-pill/counter-pill.css +7 -7
- package/dist/collection/components/counter-pill/counter-pill.js +1 -1
- package/dist/collection/components/date-picker/date-picker.css +2 -2
- package/dist/collection/components/date-picker/date-picker.js +2 -2
- package/dist/collection/components/date-time-card/date-time-card.css +2 -2
- package/dist/collection/components/date-time-card/date-time-card.js +1 -1
- package/dist/collection/components/datetime-picker/datetime-picker.css +2 -2
- package/dist/collection/components/datetime-picker/datetime-picker.js +1 -1
- package/dist/collection/components/divider/divider.css +16 -0
- package/dist/collection/components/divider/divider.js +29 -0
- package/dist/collection/components/drawer/drawer.css +3 -3
- package/dist/collection/components/drawer/drawer.js +1 -1
- package/dist/collection/components/dropdown/dropdown-trigger-event.js +1 -0
- package/dist/collection/components/dropdown/dropdown.css +9 -6
- package/dist/collection/components/dropdown/dropdown.js +142 -16
- package/dist/collection/components/dropdown-button/dropdown-button.css +15 -7
- package/dist/collection/components/dropdown-button/dropdown-button.js +6 -4
- package/dist/collection/components/dropdown-item/dropdown-item.css +16 -4
- package/dist/collection/components/dropdown-item/dropdown-item.js +3 -1
- package/dist/collection/components/dropdown-quick-actions/dropdown-quick-actions.css +36 -0
- package/dist/collection/components/dropdown-quick-actions/dropdown-quick-actions.js +29 -0
- package/dist/collection/components/event-list/event-list.css +1 -1
- package/dist/collection/components/event-list/event-list.js +1 -1
- package/dist/collection/components/event-list-item/event-list-item.css +21 -24
- package/dist/collection/components/event-list-item/event-list-item.js +1 -1
- package/dist/collection/components/expanding-search/expanding-search.css +4 -4
- package/dist/collection/components/expanding-search/expanding-search.js +1 -1
- package/dist/collection/components/filter-chip/filter-chip.css +4 -4
- package/dist/collection/components/filter-chip/filter-chip.js +1 -1
- package/dist/collection/components/flip-tile/flip-tile-state.js +1 -1
- package/dist/collection/components/flip-tile/flip-tile.css +4 -4
- package/dist/collection/components/flip-tile/flip-tile.js +1 -1
- package/dist/collection/components/flip-tile-content/flip-tile-content.css +1 -1
- package/dist/collection/components/flip-tile-content/flip-tile-content.js +1 -1
- package/dist/collection/components/group/group-context-menu.css +1 -1
- package/dist/collection/components/group/group-context-menu.js +1 -4
- package/dist/collection/components/group/group.css +12 -13
- package/dist/collection/components/group/group.js +1 -1
- package/dist/collection/components/group-dropdown-item/group-dropdown-item.css +1 -1
- package/dist/collection/components/group-dropdown-item/group-dropdown-item.js +1 -1
- package/dist/collection/components/group-item/group-item.css +5 -5
- package/dist/collection/components/group-item/group-item.js +1 -1
- package/dist/collection/components/icon/icon.css +2 -2
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/icon-button/icon-button.css +1 -1
- package/dist/collection/components/icon-button/icon-button.js +1 -1
- package/dist/collection/components/input-group/input-group.css +1 -1
- package/dist/collection/components/input-group/input-group.js +1 -1
- package/dist/collection/components/kpi/kpi.css +5 -5
- package/dist/collection/components/kpi/kpi.js +1 -1
- package/dist/collection/components/map-navigation/map-navigation.css +4 -4
- package/dist/collection/components/map-navigation/map-navigation.js +1 -1
- package/dist/collection/components/map-navigation-overlay/map-navigation-overlay.css +5 -5
- package/dist/collection/components/map-navigation-overlay/map-navigation-overlay.js +1 -1
- package/dist/collection/components/menu/burger-menu.css +72 -0
- package/dist/collection/components/menu/burger-menu.js +64 -0
- package/dist/collection/components/menu/menu.css +20 -37
- package/dist/collection/components/menu/menu.js +27 -11
- package/dist/collection/components/menu-about/menu-about.css +4 -4
- package/dist/collection/components/menu-about/menu-about.js +1 -1
- package/dist/collection/components/menu-about-item/menu-about-item.css +1 -1
- package/dist/collection/components/menu-about-item/menu-about-item.js +1 -1
- package/dist/collection/components/menu-about-news/menu-about-news.css +3 -3
- package/dist/collection/components/menu-about-news/menu-about-news.js +1 -1
- package/dist/collection/components/menu-avatar/menu-avatar.css +17 -5
- package/dist/collection/components/menu-avatar/menu-avatar.js +52 -3
- package/dist/collection/components/menu-avatar-item/menu-avatar-item.css +1 -1
- package/dist/collection/components/menu-avatar-item/menu-avatar-item.js +1 -1
- package/dist/collection/components/menu-item/menu-item.css +27 -27
- package/dist/collection/components/menu-item/menu-item.js +2 -1
- package/dist/collection/components/menu-settings/menu-settings.css +4 -4
- package/dist/collection/components/menu-settings/menu-settings.js +1 -1
- package/dist/collection/components/menu-settings-item/menu-settings-item.css +1 -1
- package/dist/collection/components/menu-settings-item/menu-settings-item.js +1 -1
- package/dist/collection/components/message-bar/message-bar.css +3 -3
- package/dist/collection/components/message-bar/message-bar.js +1 -1
- package/dist/collection/components/modal/modal-utils.js +1 -1
- package/dist/collection/components/modal/modal.css +2 -2
- package/dist/collection/components/modal/modal.js +1 -1
- package/dist/collection/components/modal-container/modal-container.css +1 -1
- package/dist/collection/components/modal-container/modal-container.js +1 -1
- package/dist/collection/components/my-component/example-modal.js +1 -1
- package/dist/collection/components/my-component/my-component.css +4 -4
- package/dist/collection/components/my-component/my-component.js +1 -1
- package/dist/collection/components/pill/pill.css +4 -4
- package/dist/collection/components/pill/pill.js +1 -1
- package/dist/collection/components/select/select.css +5 -5
- package/dist/collection/components/select/select.js +7 -5
- package/dist/collection/components/select-item/select-item.css +1 -1
- package/dist/collection/components/select-item/select-item.js +1 -1
- package/dist/collection/components/spinner/spinner.css +1 -1
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/split-button/split-button.css +10 -1
- package/dist/collection/components/split-button/split-button.js +2 -2
- package/dist/collection/components/split-button-item/split-button-item.css +1 -1
- package/dist/collection/components/split-button-item/split-button-item.js +1 -1
- package/dist/collection/components/tab-item/tab-item.css +5 -7
- package/dist/collection/components/tab-item/tab-item.js +1 -1
- package/dist/collection/components/tabs/tabs.css +4 -3
- package/dist/collection/components/tabs/tabs.js +13 -4
- package/dist/collection/components/tile/tile.css +3 -3
- package/dist/collection/components/tile/tile.js +1 -1
- package/dist/collection/components/time-picker/time-picker.css +2 -2
- package/dist/collection/components/time-picker/time-picker.js +1 -1
- package/dist/collection/components/toast/toast-container.js +1 -1
- package/dist/collection/components/toast/toast-utils.js +1 -1
- package/dist/collection/components/toast/toast.css +4 -4
- package/dist/collection/components/toast/toast.js +9 -5
- package/dist/collection/components/toggle/toggle.css +5 -4
- package/dist/collection/components/toggle/toggle.js +1 -1
- package/dist/collection/components/tooltip/tooltip.css +43 -0
- package/dist/collection/components/tooltip/tooltip.js +203 -0
- package/dist/collection/components/tree/tree.css +1 -1
- package/dist/collection/components/tree/tree.js +1 -1
- package/dist/collection/components/tree-item/default-tree-item.js +1 -1
- package/dist/collection/components/tree-item/tree-item.css +5 -5
- package/dist/collection/components/tree-item/tree-item.js +2 -3
- package/dist/collection/components/typography/types.js +14 -0
- package/dist/collection/components/typography/typography.css +146 -0
- package/dist/collection/components/typography/typography.js +63 -0
- package/dist/collection/components/upload/upload-file-state.js +1 -1
- package/dist/collection/components/upload/upload.css +3 -3
- package/dist/collection/components/upload/upload.js +1 -1
- package/dist/collection/components/utils/animation.js +1 -1
- package/dist/collection/components/utils/menu-service/menu-service.js +53 -0
- package/dist/collection/components/utils/mutation-observer.js +1 -1
- package/dist/collection/components/utils/rwd.util.js +1 -1
- package/dist/collection/components/utils/screen/context.js +29 -0
- package/dist/collection/components/utils/screen/index.js +9 -0
- package/dist/collection/components/utils/screen/mode.js +36 -0
- package/dist/collection/components/utils/screen/service.js +45 -0
- package/dist/collection/components/utils/typed-event.js +1 -1
- package/dist/collection/components/validation-tooltip/validation-tooltip.css +4 -4
- package/dist/collection/components/validation-tooltip/validation-tooltip.js +1 -1
- package/dist/collection/components/workflow-step/workflow-step.css +2 -2
- package/dist/collection/components/workflow-step/workflow-step.js +1 -1
- package/dist/collection/components/workflow-steps/workflow-steps.css +2 -2
- package/dist/collection/components/workflow-steps/workflow-steps.js +1 -1
- package/dist/collection/env.js +1 -1
- package/dist/collection/exports.js +2 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/tests/utils/test/index.js +9 -0
- package/dist/collection/tests/utils/test/matchMedia.mock.js +22 -0
- package/dist/collection/tests/utils/test/page.js +29 -0
- package/dist/collection/utils/test/index.js +1 -1
- package/dist/collection/utils/test/matchMedia.mock.js +22 -0
- package/dist/collection/utils/test/page.js +2 -2
- package/dist/components/animation.js +1 -1
- package/dist/components/application-header.js +33 -4
- package/dist/components/base-button.js +1 -1
- package/dist/components/burger-menu.js +35 -0
- package/dist/components/button.js +2 -2
- package/dist/components/dropdown-item.js +3 -1
- package/dist/components/dropdown.js +86 -14
- package/dist/components/{alignment.js → floating-ui.dom.esm.js} +529 -401
- package/dist/components/group-context-menu.js +0 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +7 -2
- package/dist/components/ix-basic-navigation.js +25 -5
- package/dist/components/ix-burger-menu.d.ts +11 -0
- package/dist/components/ix-burger-menu.js +6 -0
- package/dist/components/ix-category-filter.js +3 -3
- package/dist/components/ix-divider.d.ts +11 -0
- package/dist/components/ix-divider.js +33 -0
- package/dist/components/ix-dropdown-button.js +5 -3
- package/dist/components/ix-dropdown-quick-actions.d.ts +11 -0
- package/dist/components/ix-dropdown-quick-actions.js +33 -0
- package/dist/components/ix-event-list-item.js +1 -1
- package/dist/components/ix-flip-tile.js +1 -1
- package/dist/components/ix-group.js +1 -1
- package/dist/components/ix-map-navigation.js +8 -2
- package/dist/components/ix-menu-avatar.js +21 -2
- package/dist/components/ix-menu.js +31 -11
- package/dist/components/ix-modal-example.js +1 -1
- package/dist/components/ix-select.js +6 -4
- package/dist/components/ix-split-button.js +1 -1
- package/dist/components/ix-toggle.js +1 -1
- package/dist/components/ix-tooltip.d.ts +11 -0
- package/dist/components/ix-tooltip.js +152 -0
- package/dist/components/ix-tree.js +1 -1
- package/dist/components/ix-typography.d.ts +11 -0
- package/dist/components/ix-typography.js +6 -0
- package/dist/components/ix-upload.js +1 -1
- package/dist/components/ix-validation-tooltip.js +11 -1
- package/dist/components/menu-item.js +2 -2
- package/dist/components/modal-container.js +1 -1
- package/dist/components/mutation-observer.js +1 -1
- package/dist/components/my-component.js +1 -1
- package/dist/components/rwd.util.js +1 -1
- package/dist/components/service.js +139 -0
- package/dist/components/tab-item.js +1 -1
- package/dist/components/tabs.js +13 -4
- package/dist/components/toast.js +8 -4
- package/dist/components/tree-item.js +1 -2
- package/dist/components/typed-event.js +1 -1
- package/dist/components/typography.js +51 -0
- package/dist/esm/{animation-b667a4c4.js → animation-268dce50.js} +1 -1
- package/dist/esm/{base-button-0b6635df.js → base-button-5bfeb71c.js} +1 -1
- package/dist/esm/context-f6a2b727.js +71 -0
- package/dist/esm/{default-tree-item-638c435a.js → default-tree-item-91ff2c08.js} +1 -1
- package/dist/esm/{flip-tile-state-28a1f8ce.js → flip-tile-state-051bb2fd.js} +1 -1
- package/dist/esm/{alignment-f63c1b89.js → floating-ui.dom.esm-3130eda0.js} +529 -401
- package/dist/esm/index-6b660a23.js +20 -0
- package/dist/esm/index.js +12 -12
- package/dist/esm/ix-animated-tab_2.entry.js +2 -2
- package/dist/esm/ix-application-header.entry.js +25 -2
- package/dist/esm/ix-basic-navigation.entry.js +16 -2
- package/dist/esm/ix-breadcrumb_2.entry.js +1 -1
- package/dist/esm/ix-burger-menu.entry.js +18 -0
- package/dist/esm/ix-button.entry.js +3 -3
- package/dist/esm/ix-category-filter.entry.js +2 -2
- package/dist/esm/ix-divider.entry.js +15 -0
- package/dist/esm/ix-dropdown-button.entry.js +5 -3
- package/dist/esm/ix-dropdown-quick-actions.entry.js +15 -0
- package/dist/esm/ix-dropdown_2.entry.js +87 -15
- package/dist/esm/ix-event-list_2.entry.js +3 -3
- package/dist/esm/ix-flip-tile_2.entry.js +1 -1
- package/dist/esm/ix-group-context-menu.entry.js +0 -3
- package/dist/esm/ix-group_3.entry.js +1 -1
- package/dist/esm/ix-icon-button.entry.js +1 -1
- package/dist/esm/ix-menu_9.entry.js +47 -16
- package/dist/esm/ix-modal-example.entry.js +1 -1
- package/dist/esm/ix-modal_2.entry.js +3 -3
- package/dist/esm/ix-select_2.entry.js +6 -4
- package/dist/esm/ix-split-button_2.entry.js +2 -2
- package/dist/esm/ix-tab-item.entry.js +1 -1
- package/dist/esm/ix-tabs.entry.js +11 -4
- package/dist/esm/ix-toast_2.entry.js +9 -5
- package/dist/esm/ix-toggle.entry.js +1 -1
- package/dist/esm/ix-tooltip.entry.js +123 -0
- package/dist/esm/ix-tree_2.entry.js +2 -3
- package/dist/esm/ix-typography.entry.js +34 -0
- package/dist/esm/ix-upload.entry.js +1 -1
- package/dist/esm/ix-validation-tooltip.entry.js +11 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{logical-filter-operator-1bf83315.js → logical-filter-operator-15696001.js} +2 -2
- package/dist/esm/{modal-3618eb44.js → modal-64e18970.js} +3 -3
- package/dist/esm/{modal-utils-df50b35a.js → modal-utils-aecbcba5.js} +1 -1
- package/dist/esm/{mutation-observer-379959bb.js → mutation-observer-7d01bbea.js} +1 -1
- package/dist/esm/my-component.entry.js +1 -1
- package/dist/esm/{rwd.util-4a61a4b8.js → rwd.util-cfc2ea72.js} +1 -1
- package/dist/esm/service-fc436c5b.js +71 -0
- package/dist/esm/siemens-ix.js +1 -1
- package/dist/esm/{theme-switcher-9ecc9b69.js → theme-switcher-4b9e5cc2.js} +1 -1
- package/dist/esm/{typed-event-ab58c27e.js → typed-event-a230184a.js} +1 -1
- package/dist/esm/{upload-file-state-631bb8a2.js → upload-file-state-532a36d3.js} +1 -1
- package/dist/siemens-ix/index.esm.js +1 -1
- package/dist/siemens-ix/p-06d5ab35.entry.js +1 -0
- package/dist/siemens-ix/{p-3c754d90.entry.js → p-0bf4a256.entry.js} +1 -1
- package/dist/siemens-ix/{p-8c53c142.entry.js → p-122c7f57.entry.js} +1 -1
- package/dist/siemens-ix/p-1572aab3.js +1 -0
- package/dist/siemens-ix/{p-921da56a.entry.js → p-165c6a82.entry.js} +1 -1
- package/dist/siemens-ix/{p-9299617f.entry.js → p-20c88582.entry.js} +1 -1
- package/dist/siemens-ix/p-4b2265fd.entry.js +1 -0
- package/dist/siemens-ix/p-519b13aa.entry.js +1 -0
- package/dist/siemens-ix/p-529d7530.js +1 -0
- package/dist/siemens-ix/{p-783ce87b.entry.js → p-5b47360e.entry.js} +1 -1
- package/dist/siemens-ix/{p-a3a59238.entry.js → p-5ca7b937.entry.js} +1 -1
- package/dist/siemens-ix/p-5feec7a4.entry.js +1 -0
- package/dist/siemens-ix/p-622fb593.entry.js +1 -0
- package/dist/siemens-ix/p-63776469.entry.js +1 -0
- package/dist/siemens-ix/p-68ec0b51.entry.js +1 -0
- package/dist/siemens-ix/p-6b463b40.entry.js +1 -0
- package/dist/siemens-ix/p-6e5543fe.entry.js +1 -0
- package/dist/siemens-ix/p-71c91a11.entry.js +1 -0
- package/dist/siemens-ix/{p-ab35eaee.entry.js → p-72cc8632.entry.js} +1 -1
- package/dist/siemens-ix/{p-8c3bfc2f.js → p-75abd144.js} +1 -1
- package/dist/siemens-ix/p-8d2e0fb5.entry.js +1 -0
- package/dist/siemens-ix/p-94b440bc.entry.js +1 -0
- package/dist/siemens-ix/{p-70bd3dbf.entry.js → p-9eb8347c.entry.js} +1 -1
- package/dist/siemens-ix/p-9fa6a59b.entry.js +1 -0
- package/dist/siemens-ix/p-ac1d6617.entry.js +1 -0
- package/dist/siemens-ix/{p-f6e713f3.js → p-affb60fb.js} +1 -1
- package/dist/siemens-ix/p-b5599b0b.entry.js +1 -0
- package/dist/siemens-ix/{p-60b90da6.entry.js → p-b85458fb.entry.js} +1 -1
- package/dist/siemens-ix/p-c2b50878.entry.js +1 -0
- package/dist/siemens-ix/{p-50ed9d54.entry.js → p-d1a16c62.entry.js} +1 -1
- package/dist/siemens-ix/p-d1a8d791.entry.js +1 -0
- package/dist/siemens-ix/p-e4bda8e7.entry.js +1 -0
- package/dist/siemens-ix/p-e5fd4b34.entry.js +1 -0
- package/dist/siemens-ix/{p-404e81d2.entry.js → p-f0289f67.entry.js} +1 -1
- package/dist/siemens-ix/p-f34a16c6.js +1 -0
- package/dist/siemens-ix/p-feefa8c7.entry.js +1 -0
- package/dist/siemens-ix/siemens-ix.css +50 -48
- package/dist/siemens-ix/siemens-ix.esm.js +1 -1
- package/dist/types/components/application-header/application-header.d.ts +8 -0
- package/dist/types/components/basic-navigation/basic-navigation.d.ts +6 -1
- package/dist/types/components/button/button.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +1 -1
- package/dist/types/components/divider/divider.d.ts +6 -0
- package/dist/types/components/dropdown/dropdown-trigger-event.d.ts +4 -0
- package/dist/types/components/dropdown/dropdown.d.ts +18 -1
- package/dist/types/components/dropdown-button/dropdown-button.d.ts +1 -1
- package/dist/types/components/dropdown-quick-actions/dropdown-quick-actions.d.ts +6 -0
- package/dist/types/components/group/group-context-menu.d.ts +0 -2
- package/dist/types/components/menu/burger-menu.d.ts +10 -0
- package/dist/types/components/menu/menu.d.ts +3 -1
- package/dist/types/components/menu-avatar/menu-avatar.d.ts +12 -0
- package/dist/types/components/split-button/split-button.d.ts +1 -1
- package/dist/types/components/tabs/tabs.d.ts +3 -0
- package/dist/types/components/tooltip/tooltip.d.ts +39 -0
- package/dist/types/components/typography/types.d.ts +2 -0
- package/dist/types/components/typography/typography.d.ts +11 -0
- package/dist/types/components/utils/menu-service/menu-service.d.ts +13 -0
- package/dist/types/components/utils/screen/context.d.ts +4 -0
- package/dist/types/components/utils/screen/index.d.ts +1 -0
- package/dist/types/components/utils/screen/mode.d.ts +10 -0
- package/dist/types/components/utils/screen/service.d.ts +10 -0
- package/dist/types/components.d.ts +147 -6
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/tests/utils/test/index.d.ts +1 -0
- package/dist/types/tests/utils/test/page.d.ts +3 -0
- package/package.json +2 -2
- package/scss/_common-variables.scss +1 -1
- package/scss/_fonts.scss +1 -1
- package/scss/_z-index.scss +1 -1
- package/scss/components/_button-group.scss +1 -1
- package/scss/components/_buttons.scss +1 -1
- package/scss/components/_checkboxes.scss +5 -5
- package/scss/components/_dropdown.scss +5 -1
- package/scss/components/_forms.scss +13 -11
- package/scss/components/_input-group.scss +1 -1
- package/scss/components/_links.scss +1 -1
- package/scss/components/_modal.scss +1 -1
- package/scss/components/_radiobuttons.scss +1 -1
- package/scss/components/_shadows.scss +1 -1
- package/scss/components/_table.scss +1 -1
- package/scss/ix.scss +1 -1
- package/scss/mixins/_animations.scss +1 -1
- package/scss/mixins/_fonts.scss +1 -1
- package/scss/mixins/_hover.scss +1 -1
- package/scss/mixins/_shadows.scss +1 -1
- package/scss/mixins/_text-truncation.scss +1 -1
- package/scss/theme/classic-dark/_borderWidth.scss +1 -1
- package/scss/theme/classic-dark/_boxShadow.scss +1 -1
- package/scss/theme/classic-dark/_color.scss +3 -3
- package/scss/theme/classic-light/_borderWidth.scss +1 -1
- package/scss/theme/classic-light/_boxShadow.scss +1 -1
- package/scss/theme/classic-light/_color.scss +3 -3
- package/dist/siemens-ix/p-10158414.entry.js +0 -1
- package/dist/siemens-ix/p-2c5abec1.js +0 -1
- package/dist/siemens-ix/p-2c8e4dd1.entry.js +0 -1
- package/dist/siemens-ix/p-4ac5d916.entry.js +0 -1
- package/dist/siemens-ix/p-55663fd5.entry.js +0 -1
- package/dist/siemens-ix/p-6637ae65.entry.js +0 -1
- package/dist/siemens-ix/p-6df18451.entry.js +0 -1
- package/dist/siemens-ix/p-72cfbc1c.entry.js +0 -1
- package/dist/siemens-ix/p-b46155b7.entry.js +0 -1
- package/dist/siemens-ix/p-b7b753cc.entry.js +0 -1
- package/dist/siemens-ix/p-b9a66b74.entry.js +0 -1
- package/dist/siemens-ix/p-e51a110f.entry.js +0 -1
- package/dist/siemens-ix/p-e652328d.entry.js +0 -1
- package/dist/siemens-ix/p-e82905f0.entry.js +0 -1
- package/dist/siemens-ix/p-f05b01a4.entry.js +0 -1
- package/dist/siemens-ix/p-f1a1e8ee.entry.js +0 -1
- /package/dist/collection/components/{utils → button}/button-variants.js +0 -0
- /package/dist/siemens-ix/{p-da2cae32.js → p-076c29d1.js} +0 -0
- /package/dist/siemens-ix/{p-1d30454e.js → p-15bebd8a.js} +0 -0
- /package/dist/siemens-ix/{p-c8cc3bb3.js → p-21aa3602.js} +0 -0
- /package/dist/siemens-ix/{p-0a12b3df.js → p-2b33ead4.js} +0 -0
- /package/dist/siemens-ix/{p-bdd294d2.js → p-3b97bb69.js} +0 -0
- /package/dist/siemens-ix/{p-1c82637e.js → p-56ed024b.js} +0 -0
- /package/dist/siemens-ix/{p-b12006c6.js → p-5b39e04e.js} +0 -0
- /package/dist/siemens-ix/{p-4944ad0b.js → p-9ee41861.js} +0 -0
- /package/dist/siemens-ix/{p-96e46f99.js → p-b14308ed.js} +0 -0
- /package/dist/siemens-ix/{p-fbe40498.js → p-c0454c9a.js} +0 -0
- /package/dist/types/components/{utils → button}/button-variants.d.ts +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
return placement.split('-')[
|
|
3
|
+
function getAlignment(placement) {
|
|
4
|
+
return placement.split('-')[1];
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function getLengthFromAxis(axis) {
|
|
8
|
+
return axis === 'y' ? 'height' : 'width';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function getSide(placement) {
|
|
12
|
+
return placement.split('-')[0];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function getMainAxisFromPlacement(placement) {
|
|
16
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
@@ -29,7 +29,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
29
29
|
const side = getSide(placement);
|
|
30
30
|
const isVertical = mainAxis === 'x';
|
|
31
31
|
let coords;
|
|
32
|
-
|
|
33
32
|
switch (side) {
|
|
34
33
|
case 'top':
|
|
35
34
|
coords = {
|
|
@@ -37,45 +36,38 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
37
36
|
y: reference.y - floating.height
|
|
38
37
|
};
|
|
39
38
|
break;
|
|
40
|
-
|
|
41
39
|
case 'bottom':
|
|
42
40
|
coords = {
|
|
43
41
|
x: commonX,
|
|
44
42
|
y: reference.y + reference.height
|
|
45
43
|
};
|
|
46
44
|
break;
|
|
47
|
-
|
|
48
45
|
case 'right':
|
|
49
46
|
coords = {
|
|
50
47
|
x: reference.x + reference.width,
|
|
51
48
|
y: commonY
|
|
52
49
|
};
|
|
53
50
|
break;
|
|
54
|
-
|
|
55
51
|
case 'left':
|
|
56
52
|
coords = {
|
|
57
53
|
x: reference.x - floating.width,
|
|
58
54
|
y: commonY
|
|
59
55
|
};
|
|
60
56
|
break;
|
|
61
|
-
|
|
62
57
|
default:
|
|
63
58
|
coords = {
|
|
64
59
|
x: reference.x,
|
|
65
60
|
y: reference.y
|
|
66
61
|
};
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
switch (getAlignment$1(placement)) {
|
|
63
|
+
switch (getAlignment(placement)) {
|
|
70
64
|
case 'start':
|
|
71
65
|
coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
72
66
|
break;
|
|
73
|
-
|
|
74
67
|
case 'end':
|
|
75
68
|
coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
76
69
|
break;
|
|
77
70
|
}
|
|
78
|
-
|
|
79
71
|
return coords;
|
|
80
72
|
}
|
|
81
73
|
|
|
@@ -86,7 +78,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
86
78
|
* This export does not have any `platform` interface logic. You will need to
|
|
87
79
|
* write one for the platform you are using Floating UI with.
|
|
88
80
|
*/
|
|
89
|
-
|
|
90
81
|
const computePosition$1 = async (reference, floating, config) => {
|
|
91
82
|
const {
|
|
92
83
|
placement = 'bottom',
|
|
@@ -96,7 +87,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
96
87
|
} = config;
|
|
97
88
|
const validMiddleware = middleware.filter(Boolean);
|
|
98
89
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
99
|
-
|
|
100
90
|
let rects = await platform.getElementRects({
|
|
101
91
|
reference,
|
|
102
92
|
floating,
|
|
@@ -109,7 +99,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
109
99
|
let statefulPlacement = placement;
|
|
110
100
|
let middlewareData = {};
|
|
111
101
|
let resetCount = 0;
|
|
112
|
-
|
|
113
102
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
114
103
|
const {
|
|
115
104
|
name,
|
|
@@ -136,20 +125,19 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
136
125
|
});
|
|
137
126
|
x = nextX != null ? nextX : x;
|
|
138
127
|
y = nextY != null ? nextY : y;
|
|
139
|
-
middlewareData = {
|
|
140
|
-
|
|
128
|
+
middlewareData = {
|
|
129
|
+
...middlewareData,
|
|
130
|
+
[name]: {
|
|
131
|
+
...middlewareData[name],
|
|
141
132
|
...data
|
|
142
133
|
}
|
|
143
134
|
};
|
|
144
|
-
|
|
145
135
|
if (reset && resetCount <= 50) {
|
|
146
136
|
resetCount++;
|
|
147
|
-
|
|
148
137
|
if (typeof reset === 'object') {
|
|
149
138
|
if (reset.placement) {
|
|
150
139
|
statefulPlacement = reset.placement;
|
|
151
140
|
}
|
|
152
|
-
|
|
153
141
|
if (reset.rects) {
|
|
154
142
|
rects = reset.rects === true ? await platform.getElementRects({
|
|
155
143
|
reference,
|
|
@@ -157,18 +145,15 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
157
145
|
strategy
|
|
158
146
|
}) : reset.rects;
|
|
159
147
|
}
|
|
160
|
-
|
|
161
148
|
({
|
|
162
149
|
x,
|
|
163
150
|
y
|
|
164
151
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
165
152
|
}
|
|
166
|
-
|
|
167
153
|
i = -1;
|
|
168
154
|
continue;
|
|
169
155
|
}
|
|
170
156
|
}
|
|
171
|
-
|
|
172
157
|
return {
|
|
173
158
|
x,
|
|
174
159
|
y,
|
|
@@ -198,7 +183,8 @@ function getSideObjectFromPadding(padding) {
|
|
|
198
183
|
}
|
|
199
184
|
|
|
200
185
|
function rectToClientRect(rect) {
|
|
201
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
...rect,
|
|
202
188
|
top: rect.y,
|
|
203
189
|
left: rect.x,
|
|
204
190
|
right: rect.x + rect.width,
|
|
@@ -216,11 +202,9 @@ function rectToClientRect(rect) {
|
|
|
216
202
|
*/
|
|
217
203
|
async function detectOverflow(middlewareArguments, options) {
|
|
218
204
|
var _await$platform$isEle;
|
|
219
|
-
|
|
220
205
|
if (options === void 0) {
|
|
221
206
|
options = {};
|
|
222
207
|
}
|
|
223
|
-
|
|
224
208
|
const {
|
|
225
209
|
x,
|
|
226
210
|
y,
|
|
@@ -245,19 +229,29 @@ async function detectOverflow(middlewareArguments, options) {
|
|
|
245
229
|
rootBoundary,
|
|
246
230
|
strategy
|
|
247
231
|
}));
|
|
232
|
+
const rect = elementContext === 'floating' ? {
|
|
233
|
+
...rects.floating,
|
|
234
|
+
x,
|
|
235
|
+
y
|
|
236
|
+
} : rects.reference;
|
|
237
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
238
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
239
|
+
x: 1,
|
|
240
|
+
y: 1
|
|
241
|
+
} : {
|
|
242
|
+
x: 1,
|
|
243
|
+
y: 1
|
|
244
|
+
};
|
|
248
245
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
249
|
-
rect
|
|
250
|
-
|
|
251
|
-
y
|
|
252
|
-
} : rects.reference,
|
|
253
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
246
|
+
rect,
|
|
247
|
+
offsetParent,
|
|
254
248
|
strategy
|
|
255
|
-
}) :
|
|
249
|
+
}) : rect);
|
|
256
250
|
return {
|
|
257
|
-
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
258
|
-
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
259
|
-
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
260
|
-
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
251
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
252
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
253
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
254
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
261
255
|
};
|
|
262
256
|
}
|
|
263
257
|
|
|
@@ -276,13 +270,12 @@ function within(min$1$1, value, max$1$1) {
|
|
|
276
270
|
const arrow = options => ({
|
|
277
271
|
name: 'arrow',
|
|
278
272
|
options,
|
|
279
|
-
|
|
280
273
|
async fn(middlewareArguments) {
|
|
281
|
-
// Since `element` is required, we don't Partial<> the type
|
|
274
|
+
// Since `element` is required, we don't Partial<> the type.
|
|
282
275
|
const {
|
|
283
276
|
element,
|
|
284
277
|
padding = 0
|
|
285
|
-
} = options
|
|
278
|
+
} = options || {};
|
|
286
279
|
const {
|
|
287
280
|
x,
|
|
288
281
|
y,
|
|
@@ -290,19 +283,15 @@ const arrow = options => ({
|
|
|
290
283
|
rects,
|
|
291
284
|
platform
|
|
292
285
|
} = middlewareArguments;
|
|
293
|
-
|
|
294
286
|
if (element == null) {
|
|
295
|
-
|
|
296
287
|
return {};
|
|
297
288
|
}
|
|
298
|
-
|
|
299
289
|
const paddingObject = getSideObjectFromPadding(padding);
|
|
300
290
|
const coords = {
|
|
301
291
|
x,
|
|
302
292
|
y
|
|
303
293
|
};
|
|
304
294
|
const axis = getMainAxisFromPlacement(placement);
|
|
305
|
-
const alignment = getAlignment$1(placement);
|
|
306
295
|
const length = getLengthFromAxis(axis);
|
|
307
296
|
const arrowDimensions = await platform.getDimensions(element);
|
|
308
297
|
const minProp = axis === 'y' ? 'top' : 'left';
|
|
@@ -311,21 +300,23 @@ const arrow = options => ({
|
|
|
311
300
|
const startDiff = coords[axis] - rects.reference[axis];
|
|
312
301
|
const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
|
|
313
302
|
let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
314
|
-
|
|
315
303
|
if (clientSize === 0) {
|
|
316
304
|
clientSize = rects.floating[length];
|
|
317
305
|
}
|
|
306
|
+
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
318
307
|
|
|
319
|
-
|
|
320
|
-
// point is outside the floating element's bounds
|
|
321
|
-
|
|
308
|
+
// Make sure the arrow doesn't overflow the floating element if the center
|
|
309
|
+
// point is outside the floating element's bounds.
|
|
322
310
|
const min = paddingObject[minProp];
|
|
323
311
|
const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
|
|
324
312
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
325
|
-
const offset = within(min, center, max);
|
|
313
|
+
const offset = within(min, center, max);
|
|
326
314
|
|
|
327
|
-
|
|
328
|
-
|
|
315
|
+
// If the reference is small enough that the arrow's padding causes it to
|
|
316
|
+
// to point to nothing for an aligned placement, adjust the offset of the
|
|
317
|
+
// floating element itself. This stops `shift()` from taking action, but can
|
|
318
|
+
// be worked around by calling it again after the `arrow()` if desired.
|
|
319
|
+
const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min ? paddingObject[minProp] : paddingObject[maxProp]) - arrowDimensions[length] / 2 < 0;
|
|
329
320
|
const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
|
|
330
321
|
return {
|
|
331
322
|
[axis]: coords[axis] - alignmentOffset,
|
|
@@ -335,61 +326,55 @@ const arrow = options => ({
|
|
|
335
326
|
}
|
|
336
327
|
};
|
|
337
328
|
}
|
|
338
|
-
|
|
339
329
|
});
|
|
340
330
|
|
|
341
|
-
const
|
|
331
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
332
|
+
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
333
|
+
|
|
334
|
+
const oppositeSideMap = {
|
|
342
335
|
left: 'right',
|
|
343
336
|
right: 'left',
|
|
344
337
|
bottom: 'top',
|
|
345
338
|
top: 'bottom'
|
|
346
339
|
};
|
|
347
340
|
function getOppositePlacement(placement) {
|
|
348
|
-
return placement.replace(/left|right|bottom|top/g,
|
|
341
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
349
342
|
}
|
|
350
343
|
|
|
351
344
|
function getAlignmentSides(placement, rects, rtl) {
|
|
352
345
|
if (rtl === void 0) {
|
|
353
346
|
rtl = false;
|
|
354
347
|
}
|
|
355
|
-
|
|
356
|
-
const alignment = getAlignment$1(placement);
|
|
348
|
+
const alignment = getAlignment(placement);
|
|
357
349
|
const mainAxis = getMainAxisFromPlacement(placement);
|
|
358
350
|
const length = getLengthFromAxis(mainAxis);
|
|
359
351
|
let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
360
|
-
|
|
361
352
|
if (rects.reference[length] > rects.floating[length]) {
|
|
362
353
|
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
363
354
|
}
|
|
364
|
-
|
|
365
355
|
return {
|
|
366
356
|
main: mainAlignmentSide,
|
|
367
357
|
cross: getOppositePlacement(mainAlignmentSide)
|
|
368
358
|
};
|
|
369
359
|
}
|
|
370
360
|
|
|
371
|
-
const
|
|
361
|
+
const oppositeAlignmentMap = {
|
|
372
362
|
start: 'end',
|
|
373
363
|
end: 'start'
|
|
374
364
|
};
|
|
375
365
|
function getOppositeAlignmentPlacement(placement) {
|
|
376
|
-
return placement.replace(/start|end/g,
|
|
366
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
377
367
|
}
|
|
378
368
|
|
|
379
|
-
const sides = ['top', 'right', 'bottom', 'left'];
|
|
380
|
-
const allPlacements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
|
|
381
|
-
|
|
382
369
|
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
383
|
-
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment
|
|
370
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
384
371
|
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
385
372
|
if (alignment) {
|
|
386
|
-
return getAlignment
|
|
373
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
387
374
|
}
|
|
388
|
-
|
|
389
375
|
return true;
|
|
390
376
|
});
|
|
391
377
|
}
|
|
392
|
-
|
|
393
378
|
/**
|
|
394
379
|
* Automatically chooses the `placement` which has the most space available.
|
|
395
380
|
* @see https://floating-ui.com/docs/autoPlacement
|
|
@@ -398,17 +383,12 @@ const autoPlacement = function (options) {
|
|
|
398
383
|
if (options === void 0) {
|
|
399
384
|
options = {};
|
|
400
385
|
}
|
|
401
|
-
|
|
402
386
|
return {
|
|
403
387
|
name: 'autoPlacement',
|
|
404
388
|
options,
|
|
405
|
-
|
|
406
389
|
async fn(middlewareArguments) {
|
|
407
|
-
var _middlewareData$autoP, _middlewareData$autoP2,
|
|
408
|
-
|
|
390
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsSortedByLe;
|
|
409
391
|
const {
|
|
410
|
-
x,
|
|
411
|
-
y,
|
|
412
392
|
rects,
|
|
413
393
|
middlewareData,
|
|
414
394
|
placement,
|
|
@@ -416,42 +396,39 @@ const autoPlacement = function (options) {
|
|
|
416
396
|
elements
|
|
417
397
|
} = middlewareArguments;
|
|
418
398
|
const {
|
|
419
|
-
alignment
|
|
399
|
+
alignment,
|
|
420
400
|
allowedPlacements = allPlacements,
|
|
421
401
|
autoAlignment = true,
|
|
422
402
|
...detectOverflowOptions
|
|
423
403
|
} = options;
|
|
424
|
-
const placements = getPlacementList(alignment, autoAlignment, allowedPlacements);
|
|
404
|
+
const placements = alignment !== undefined || allowedPlacements === allPlacements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
425
405
|
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
426
|
-
const currentIndex = (_middlewareData$autoP =
|
|
406
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
427
407
|
const currentPlacement = placements[currentIndex];
|
|
428
|
-
|
|
429
408
|
if (currentPlacement == null) {
|
|
430
409
|
return {};
|
|
431
410
|
}
|
|
432
|
-
|
|
433
411
|
const {
|
|
434
412
|
main,
|
|
435
413
|
cross
|
|
436
|
-
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
414
|
+
} = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
437
415
|
|
|
416
|
+
// Make `computeCoords` start from the right place.
|
|
438
417
|
if (placement !== currentPlacement) {
|
|
439
418
|
return {
|
|
440
|
-
x,
|
|
441
|
-
y,
|
|
442
419
|
reset: {
|
|
443
420
|
placement: placements[0]
|
|
444
421
|
}
|
|
445
422
|
};
|
|
446
423
|
}
|
|
447
|
-
|
|
448
424
|
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main], overflow[cross]];
|
|
449
|
-
const allOverflows = [...((
|
|
425
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
450
426
|
placement: currentPlacement,
|
|
451
427
|
overflows: currentOverflows
|
|
452
428
|
}];
|
|
453
|
-
const nextPlacement = placements[currentIndex + 1];
|
|
429
|
+
const nextPlacement = placements[currentIndex + 1];
|
|
454
430
|
|
|
431
|
+
// There are more placements to check.
|
|
455
432
|
if (nextPlacement) {
|
|
456
433
|
return {
|
|
457
434
|
data: {
|
|
@@ -463,7 +440,6 @@ const autoPlacement = function (options) {
|
|
|
463
440
|
}
|
|
464
441
|
};
|
|
465
442
|
}
|
|
466
|
-
|
|
467
443
|
const placementsSortedByLeastOverflow = allOverflows.slice().sort((a, b) => a.overflows[0] - b.overflows[0]);
|
|
468
444
|
const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find(_ref => {
|
|
469
445
|
let {
|
|
@@ -471,8 +447,7 @@ const autoPlacement = function (options) {
|
|
|
471
447
|
} = _ref;
|
|
472
448
|
return overflows.every(overflow => overflow <= 0);
|
|
473
449
|
})) == null ? void 0 : _placementsSortedByLe.placement;
|
|
474
|
-
const resetPlacement = placementThatFitsOnAllSides
|
|
475
|
-
|
|
450
|
+
const resetPlacement = placementThatFitsOnAllSides || placementsSortedByLeastOverflow[0].placement;
|
|
476
451
|
if (resetPlacement !== placement) {
|
|
477
452
|
return {
|
|
478
453
|
data: {
|
|
@@ -484,10 +459,251 @@ const autoPlacement = function (options) {
|
|
|
484
459
|
}
|
|
485
460
|
};
|
|
486
461
|
}
|
|
462
|
+
return {};
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
function getExpandedPlacements(placement) {
|
|
468
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
469
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
function getSideList(side, isStart, rtl) {
|
|
473
|
+
const lr = ['left', 'right'];
|
|
474
|
+
const rl = ['right', 'left'];
|
|
475
|
+
const tb = ['top', 'bottom'];
|
|
476
|
+
const bt = ['bottom', 'top'];
|
|
477
|
+
switch (side) {
|
|
478
|
+
case 'top':
|
|
479
|
+
case 'bottom':
|
|
480
|
+
if (rtl) return isStart ? rl : lr;
|
|
481
|
+
return isStart ? lr : rl;
|
|
482
|
+
case 'left':
|
|
483
|
+
case 'right':
|
|
484
|
+
return isStart ? tb : bt;
|
|
485
|
+
default:
|
|
486
|
+
return [];
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
490
|
+
const alignment = getAlignment(placement);
|
|
491
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
492
|
+
if (alignment) {
|
|
493
|
+
list = list.map(side => side + "-" + alignment);
|
|
494
|
+
if (flipAlignment) {
|
|
495
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return list;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Changes the placement of the floating element to one that will fit if the
|
|
503
|
+
* initially specified `placement` does not.
|
|
504
|
+
* @see https://floating-ui.com/docs/flip
|
|
505
|
+
*/
|
|
506
|
+
const flip = function (options) {
|
|
507
|
+
if (options === void 0) {
|
|
508
|
+
options = {};
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
name: 'flip',
|
|
512
|
+
options,
|
|
513
|
+
async fn(middlewareArguments) {
|
|
514
|
+
var _middlewareData$flip;
|
|
515
|
+
const {
|
|
516
|
+
placement,
|
|
517
|
+
middlewareData,
|
|
518
|
+
rects,
|
|
519
|
+
initialPlacement,
|
|
520
|
+
platform,
|
|
521
|
+
elements
|
|
522
|
+
} = middlewareArguments;
|
|
523
|
+
const {
|
|
524
|
+
mainAxis: checkMainAxis = true,
|
|
525
|
+
crossAxis: checkCrossAxis = true,
|
|
526
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
527
|
+
fallbackStrategy = 'bestFit',
|
|
528
|
+
fallbackAxisSideDirection = 'none',
|
|
529
|
+
flipAlignment = true,
|
|
530
|
+
...detectOverflowOptions
|
|
531
|
+
} = options;
|
|
532
|
+
const side = getSide(placement);
|
|
533
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
534
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
535
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
536
|
+
if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
|
|
537
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
538
|
+
}
|
|
539
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
540
|
+
const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
|
|
541
|
+
const overflows = [];
|
|
542
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
543
|
+
if (checkMainAxis) {
|
|
544
|
+
overflows.push(overflow[side]);
|
|
545
|
+
}
|
|
546
|
+
if (checkCrossAxis) {
|
|
547
|
+
const {
|
|
548
|
+
main,
|
|
549
|
+
cross
|
|
550
|
+
} = getAlignmentSides(placement, rects, rtl);
|
|
551
|
+
overflows.push(overflow[main], overflow[cross]);
|
|
552
|
+
}
|
|
553
|
+
overflowsData = [...overflowsData, {
|
|
554
|
+
placement,
|
|
555
|
+
overflows
|
|
556
|
+
}];
|
|
487
557
|
|
|
558
|
+
// One or more sides is overflowing.
|
|
559
|
+
if (!overflows.every(side => side <= 0)) {
|
|
560
|
+
var _middlewareData$flip2;
|
|
561
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
562
|
+
const nextPlacement = placements[nextIndex];
|
|
563
|
+
if (nextPlacement) {
|
|
564
|
+
// Try next placement and re-run the lifecycle.
|
|
565
|
+
return {
|
|
566
|
+
data: {
|
|
567
|
+
index: nextIndex,
|
|
568
|
+
overflows: overflowsData
|
|
569
|
+
},
|
|
570
|
+
reset: {
|
|
571
|
+
placement: nextPlacement
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
let resetPlacement = 'bottom';
|
|
576
|
+
switch (fallbackStrategy) {
|
|
577
|
+
case 'bestFit':
|
|
578
|
+
{
|
|
579
|
+
var _overflowsData$map$so;
|
|
580
|
+
const placement = (_overflowsData$map$so = overflowsData.map(d => [d, 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].placement;
|
|
581
|
+
if (placement) {
|
|
582
|
+
resetPlacement = placement;
|
|
583
|
+
}
|
|
584
|
+
break;
|
|
585
|
+
}
|
|
586
|
+
case 'initialPlacement':
|
|
587
|
+
resetPlacement = initialPlacement;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
if (placement !== resetPlacement) {
|
|
591
|
+
return {
|
|
592
|
+
reset: {
|
|
593
|
+
placement: resetPlacement
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
}
|
|
488
598
|
return {};
|
|
489
599
|
}
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Provides improved positioning for inline reference elements that can span
|
|
605
|
+
* over multiple lines, such as hyperlinks or range selections.
|
|
606
|
+
* @see https://floating-ui.com/docs/inline
|
|
607
|
+
*/
|
|
608
|
+
const inline = function (options) {
|
|
609
|
+
if (options === void 0) {
|
|
610
|
+
options = {};
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
name: 'inline',
|
|
614
|
+
options,
|
|
615
|
+
async fn(middlewareArguments) {
|
|
616
|
+
const {
|
|
617
|
+
placement,
|
|
618
|
+
elements,
|
|
619
|
+
rects,
|
|
620
|
+
platform,
|
|
621
|
+
strategy
|
|
622
|
+
} = middlewareArguments;
|
|
623
|
+
// A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
624
|
+
// ClientRect's bounds, despite the event listener being triggered. A
|
|
625
|
+
// padding of 2 seems to handle this issue.
|
|
626
|
+
const {
|
|
627
|
+
padding = 2,
|
|
628
|
+
x,
|
|
629
|
+
y
|
|
630
|
+
} = options;
|
|
631
|
+
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
632
|
+
rect: rects.reference,
|
|
633
|
+
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
634
|
+
strategy
|
|
635
|
+
}) : rects.reference);
|
|
636
|
+
const clientRects = (await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || [];
|
|
637
|
+
const paddingObject = getSideObjectFromPadding(padding);
|
|
638
|
+
function getBoundingClientRect() {
|
|
639
|
+
// There are two rects and they are disjoined.
|
|
640
|
+
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
641
|
+
// Find the first rect in which the point is fully inside.
|
|
642
|
+
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;
|
|
643
|
+
}
|
|
490
644
|
|
|
645
|
+
// There are 2 or more connected rects.
|
|
646
|
+
if (clientRects.length >= 2) {
|
|
647
|
+
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
648
|
+
const firstRect = clientRects[0];
|
|
649
|
+
const lastRect = clientRects[clientRects.length - 1];
|
|
650
|
+
const isTop = getSide(placement) === 'top';
|
|
651
|
+
const top = firstRect.top;
|
|
652
|
+
const bottom = lastRect.bottom;
|
|
653
|
+
const left = isTop ? firstRect.left : lastRect.left;
|
|
654
|
+
const right = isTop ? firstRect.right : lastRect.right;
|
|
655
|
+
const width = right - left;
|
|
656
|
+
const height = bottom - top;
|
|
657
|
+
return {
|
|
658
|
+
top,
|
|
659
|
+
bottom,
|
|
660
|
+
left,
|
|
661
|
+
right,
|
|
662
|
+
width,
|
|
663
|
+
height,
|
|
664
|
+
x: left,
|
|
665
|
+
y: top
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
const isLeftSide = getSide(placement) === 'left';
|
|
669
|
+
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
670
|
+
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
671
|
+
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
672
|
+
const top = measureRects[0].top;
|
|
673
|
+
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
674
|
+
const left = minLeft;
|
|
675
|
+
const right = maxRight;
|
|
676
|
+
const width = right - left;
|
|
677
|
+
const height = bottom - top;
|
|
678
|
+
return {
|
|
679
|
+
top,
|
|
680
|
+
bottom,
|
|
681
|
+
left,
|
|
682
|
+
right,
|
|
683
|
+
width,
|
|
684
|
+
height,
|
|
685
|
+
x: left,
|
|
686
|
+
y: top
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
return fallback;
|
|
690
|
+
}
|
|
691
|
+
const resetRects = await platform.getElementRects({
|
|
692
|
+
reference: {
|
|
693
|
+
getBoundingClientRect
|
|
694
|
+
},
|
|
695
|
+
floating: elements.floating,
|
|
696
|
+
strategy
|
|
697
|
+
});
|
|
698
|
+
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) {
|
|
699
|
+
return {
|
|
700
|
+
reset: {
|
|
701
|
+
rects: resetRects
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
return {};
|
|
706
|
+
}
|
|
491
707
|
};
|
|
492
708
|
};
|
|
493
709
|
|
|
@@ -499,12 +715,13 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
499
715
|
} = middlewareArguments;
|
|
500
716
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
501
717
|
const side = getSide(placement);
|
|
502
|
-
const alignment = getAlignment
|
|
718
|
+
const alignment = getAlignment(placement);
|
|
503
719
|
const isVertical = getMainAxisFromPlacement(placement) === 'x';
|
|
504
720
|
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
505
721
|
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
506
|
-
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value;
|
|
722
|
+
const rawValue = typeof value === 'function' ? value(middlewareArguments) : value;
|
|
507
723
|
|
|
724
|
+
// eslint-disable-next-line prefer-const
|
|
508
725
|
let {
|
|
509
726
|
mainAxis,
|
|
510
727
|
crossAxis,
|
|
@@ -519,11 +736,9 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
519
736
|
alignmentAxis: null,
|
|
520
737
|
...rawValue
|
|
521
738
|
};
|
|
522
|
-
|
|
523
739
|
if (alignment && typeof alignmentAxis === 'number') {
|
|
524
740
|
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
525
741
|
}
|
|
526
|
-
|
|
527
742
|
return isVertical ? {
|
|
528
743
|
x: crossAxis * crossAxisMulti,
|
|
529
744
|
y: mainAxis * mainAxisMulti
|
|
@@ -532,20 +747,18 @@ async function convertValueToCoords(middlewareArguments, value) {
|
|
|
532
747
|
y: crossAxis * crossAxisMulti
|
|
533
748
|
};
|
|
534
749
|
}
|
|
750
|
+
|
|
535
751
|
/**
|
|
536
752
|
* Displaces the floating element from its reference element.
|
|
537
753
|
* @see https://floating-ui.com/docs/offset
|
|
538
754
|
*/
|
|
539
|
-
|
|
540
755
|
const offset = function (value) {
|
|
541
756
|
if (value === void 0) {
|
|
542
757
|
value = 0;
|
|
543
758
|
}
|
|
544
|
-
|
|
545
759
|
return {
|
|
546
760
|
name: 'offset',
|
|
547
761
|
options: value,
|
|
548
|
-
|
|
549
762
|
async fn(middlewareArguments) {
|
|
550
763
|
const {
|
|
551
764
|
x,
|
|
@@ -558,7 +771,6 @@ const offset = function (value) {
|
|
|
558
771
|
data: diffCoords
|
|
559
772
|
};
|
|
560
773
|
}
|
|
561
|
-
|
|
562
774
|
};
|
|
563
775
|
};
|
|
564
776
|
|
|
@@ -575,11 +787,9 @@ const shift = function (options) {
|
|
|
575
787
|
if (options === void 0) {
|
|
576
788
|
options = {};
|
|
577
789
|
}
|
|
578
|
-
|
|
579
790
|
return {
|
|
580
791
|
name: 'shift',
|
|
581
792
|
options,
|
|
582
|
-
|
|
583
793
|
async fn(middlewareArguments) {
|
|
584
794
|
const {
|
|
585
795
|
x,
|
|
@@ -612,7 +822,6 @@ const shift = function (options) {
|
|
|
612
822
|
const crossAxis = getCrossAxis(mainAxis);
|
|
613
823
|
let mainAxisCoord = coords[mainAxis];
|
|
614
824
|
let crossAxisCoord = coords[crossAxis];
|
|
615
|
-
|
|
616
825
|
if (checkMainAxis) {
|
|
617
826
|
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
618
827
|
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -620,7 +829,6 @@ const shift = function (options) {
|
|
|
620
829
|
const max = mainAxisCoord - overflow[maxSide];
|
|
621
830
|
mainAxisCoord = within(min, mainAxisCoord, max);
|
|
622
831
|
}
|
|
623
|
-
|
|
624
832
|
if (checkCrossAxis) {
|
|
625
833
|
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
626
834
|
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
@@ -628,173 +836,45 @@ const shift = function (options) {
|
|
|
628
836
|
const max = crossAxisCoord - overflow[maxSide];
|
|
629
837
|
crossAxisCoord = within(min, crossAxisCoord, max);
|
|
630
838
|
}
|
|
631
|
-
|
|
632
|
-
|
|
839
|
+
const limitedCoords = limiter.fn({
|
|
840
|
+
...middlewareArguments,
|
|
633
841
|
[mainAxis]: mainAxisCoord,
|
|
634
842
|
[crossAxis]: crossAxisCoord
|
|
635
843
|
});
|
|
636
|
-
return {
|
|
844
|
+
return {
|
|
845
|
+
...limitedCoords,
|
|
637
846
|
data: {
|
|
638
847
|
x: limitedCoords.x - x,
|
|
639
848
|
y: limitedCoords.y - y
|
|
640
849
|
}
|
|
641
850
|
};
|
|
642
851
|
}
|
|
643
|
-
|
|
644
852
|
};
|
|
645
853
|
};
|
|
646
854
|
|
|
647
|
-
/**
|
|
648
|
-
* Provides improved positioning for inline reference elements that can span
|
|
649
|
-
* over multiple lines, such as hyperlinks or range selections.
|
|
650
|
-
* @see https://floating-ui.com/docs/inline
|
|
651
|
-
*/
|
|
652
|
-
const inline = function (options) {
|
|
653
|
-
if (options === void 0) {
|
|
654
|
-
options = {};
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
return {
|
|
658
|
-
name: 'inline',
|
|
659
|
-
options,
|
|
660
|
-
|
|
661
|
-
async fn(middlewareArguments) {
|
|
662
|
-
var _await$platform$getCl;
|
|
663
|
-
|
|
664
|
-
const {
|
|
665
|
-
placement,
|
|
666
|
-
elements,
|
|
667
|
-
rects,
|
|
668
|
-
platform,
|
|
669
|
-
strategy
|
|
670
|
-
} = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
|
|
671
|
-
// ClientRect's bounds, despite the event listener being triggered. A
|
|
672
|
-
// padding of 2 seems to handle this issue.
|
|
673
|
-
|
|
674
|
-
const {
|
|
675
|
-
padding = 2,
|
|
676
|
-
x,
|
|
677
|
-
y
|
|
678
|
-
} = options;
|
|
679
|
-
const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
680
|
-
rect: rects.reference,
|
|
681
|
-
offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
|
|
682
|
-
strategy
|
|
683
|
-
}) : rects.reference);
|
|
684
|
-
const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
|
|
685
|
-
const paddingObject = getSideObjectFromPadding(padding);
|
|
686
|
-
|
|
687
|
-
function getBoundingClientRect() {
|
|
688
|
-
// There are two rects and they are disjoined
|
|
689
|
-
if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
|
|
690
|
-
var _clientRects$find;
|
|
691
|
-
|
|
692
|
-
// Find the first rect in which the point is fully inside
|
|
693
|
-
return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
|
|
694
|
-
} // There are 2 or more connected rects
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
if (clientRects.length >= 2) {
|
|
698
|
-
if (getMainAxisFromPlacement(placement) === 'x') {
|
|
699
|
-
const firstRect = clientRects[0];
|
|
700
|
-
const lastRect = clientRects[clientRects.length - 1];
|
|
701
|
-
const isTop = getSide(placement) === 'top';
|
|
702
|
-
const top = firstRect.top;
|
|
703
|
-
const bottom = lastRect.bottom;
|
|
704
|
-
const left = isTop ? firstRect.left : lastRect.left;
|
|
705
|
-
const right = isTop ? firstRect.right : lastRect.right;
|
|
706
|
-
const width = right - left;
|
|
707
|
-
const height = bottom - top;
|
|
708
|
-
return {
|
|
709
|
-
top,
|
|
710
|
-
bottom,
|
|
711
|
-
left,
|
|
712
|
-
right,
|
|
713
|
-
width,
|
|
714
|
-
height,
|
|
715
|
-
x: left,
|
|
716
|
-
y: top
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
const isLeftSide = getSide(placement) === 'left';
|
|
721
|
-
const maxRight = max$1(...clientRects.map(rect => rect.right));
|
|
722
|
-
const minLeft = min$1(...clientRects.map(rect => rect.left));
|
|
723
|
-
const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
724
|
-
const top = measureRects[0].top;
|
|
725
|
-
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
726
|
-
const left = minLeft;
|
|
727
|
-
const right = maxRight;
|
|
728
|
-
const width = right - left;
|
|
729
|
-
const height = bottom - top;
|
|
730
|
-
return {
|
|
731
|
-
top,
|
|
732
|
-
bottom,
|
|
733
|
-
left,
|
|
734
|
-
right,
|
|
735
|
-
width,
|
|
736
|
-
height,
|
|
737
|
-
x: left,
|
|
738
|
-
y: top
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
return fallback;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
const resetRects = await platform.getElementRects({
|
|
746
|
-
reference: {
|
|
747
|
-
getBoundingClientRect
|
|
748
|
-
},
|
|
749
|
-
floating: elements.floating,
|
|
750
|
-
strategy
|
|
751
|
-
});
|
|
752
|
-
|
|
753
|
-
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) {
|
|
754
|
-
return {
|
|
755
|
-
reset: {
|
|
756
|
-
rects: resetRects
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
return {};
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
};
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
function isWindow(value) {
|
|
768
|
-
return value && value.document && value.location && value.alert && value.setInterval;
|
|
769
|
-
}
|
|
770
855
|
function getWindow(node) {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (!isWindow(node)) {
|
|
776
|
-
const ownerDocument = node.ownerDocument;
|
|
777
|
-
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
return node;
|
|
856
|
+
var _node$ownerDocument;
|
|
857
|
+
return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
781
858
|
}
|
|
782
859
|
|
|
783
|
-
function getComputedStyle(element) {
|
|
860
|
+
function getComputedStyle$1(element) {
|
|
784
861
|
return getWindow(element).getComputedStyle(element);
|
|
785
862
|
}
|
|
786
863
|
|
|
787
864
|
function getNodeName(node) {
|
|
788
|
-
return
|
|
865
|
+
return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
|
|
789
866
|
}
|
|
790
867
|
|
|
868
|
+
let uaString;
|
|
791
869
|
function getUAString() {
|
|
870
|
+
if (uaString) {
|
|
871
|
+
return uaString;
|
|
872
|
+
}
|
|
792
873
|
const uaData = navigator.userAgentData;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
return
|
|
874
|
+
if (uaData && Array.isArray(uaData.brands)) {
|
|
875
|
+
uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
|
|
876
|
+
return uaString;
|
|
796
877
|
}
|
|
797
|
-
|
|
798
878
|
return navigator.userAgent;
|
|
799
879
|
}
|
|
800
880
|
|
|
@@ -812,19 +892,17 @@ function isShadowRoot(node) {
|
|
|
812
892
|
if (typeof ShadowRoot === 'undefined') {
|
|
813
893
|
return false;
|
|
814
894
|
}
|
|
815
|
-
|
|
816
895
|
const OwnElement = getWindow(node).ShadowRoot;
|
|
817
896
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
818
897
|
}
|
|
819
898
|
function isOverflowElement(element) {
|
|
820
|
-
// Firefox wants us to check `-x` and `-y` variations as well
|
|
821
899
|
const {
|
|
822
900
|
overflow,
|
|
823
901
|
overflowX,
|
|
824
902
|
overflowY,
|
|
825
903
|
display
|
|
826
|
-
} = getComputedStyle(element);
|
|
827
|
-
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
904
|
+
} = getComputedStyle$1(element);
|
|
905
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
828
906
|
}
|
|
829
907
|
function isTableElement(element) {
|
|
830
908
|
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
@@ -832,12 +910,14 @@ function isTableElement(element) {
|
|
|
832
910
|
function isContainingBlock(element) {
|
|
833
911
|
// TODO: Try and use feature detection here instead
|
|
834
912
|
const isFirefox = /firefox/i.test(getUAString());
|
|
835
|
-
const css = getComputedStyle(element);
|
|
836
|
-
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
|
|
913
|
+
const css = getComputedStyle$1(element);
|
|
914
|
+
const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
|
|
915
|
+
|
|
916
|
+
// This is non-exhaustive but covers the most common CSS properties that
|
|
837
917
|
// create a containing block.
|
|
838
918
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
839
|
-
|
|
840
|
-
|
|
919
|
+
return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some(
|
|
920
|
+
// TS 4.1 compat
|
|
841
921
|
value => {
|
|
842
922
|
const contain = css.contain;
|
|
843
923
|
return contain != null ? contain.includes(value) : false;
|
|
@@ -845,12 +925,14 @@ function isContainingBlock(element) {
|
|
|
845
925
|
}
|
|
846
926
|
function isLayoutViewport() {
|
|
847
927
|
// Not Safari
|
|
848
|
-
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
928
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
929
|
+
// Feature detection for this fails in various ways
|
|
849
930
|
// • Always-visible scrollbar or not
|
|
850
931
|
// • Width of <html>, etc.
|
|
851
932
|
// const vV = win.visualViewport;
|
|
852
933
|
// return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
|
|
853
934
|
}
|
|
935
|
+
|
|
854
936
|
function isLastTraversableNode(node) {
|
|
855
937
|
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
856
938
|
}
|
|
@@ -859,32 +941,105 @@ const min = Math.min;
|
|
|
859
941
|
const max = Math.max;
|
|
860
942
|
const round = Math.round;
|
|
861
943
|
|
|
862
|
-
function
|
|
863
|
-
|
|
944
|
+
function getCssDimensions(element) {
|
|
945
|
+
const css = getComputedStyle$1(element);
|
|
946
|
+
let width = parseFloat(css.width);
|
|
947
|
+
let height = parseFloat(css.height);
|
|
948
|
+
const offsetWidth = element.offsetWidth;
|
|
949
|
+
const offsetHeight = element.offsetHeight;
|
|
950
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
951
|
+
if (shouldFallback) {
|
|
952
|
+
width = offsetWidth;
|
|
953
|
+
height = offsetHeight;
|
|
954
|
+
}
|
|
955
|
+
return {
|
|
956
|
+
width,
|
|
957
|
+
height,
|
|
958
|
+
fallback: shouldFallback
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
function unwrapElement(element) {
|
|
963
|
+
return !isElement(element) ? element.contextElement : element;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
const FALLBACK_SCALE = {
|
|
967
|
+
x: 1,
|
|
968
|
+
y: 1
|
|
969
|
+
};
|
|
970
|
+
function getScale(element) {
|
|
971
|
+
const domElement = unwrapElement(element);
|
|
972
|
+
if (!isHTMLElement(domElement)) {
|
|
973
|
+
return FALLBACK_SCALE;
|
|
974
|
+
}
|
|
975
|
+
const rect = domElement.getBoundingClientRect();
|
|
976
|
+
const {
|
|
977
|
+
width,
|
|
978
|
+
height,
|
|
979
|
+
fallback
|
|
980
|
+
} = getCssDimensions(domElement);
|
|
981
|
+
let x = (fallback ? round(rect.width) : rect.width) / width;
|
|
982
|
+
let y = (fallback ? round(rect.height) : rect.height) / height;
|
|
983
|
+
|
|
984
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
864
985
|
|
|
986
|
+
if (!x || !Number.isFinite(x)) {
|
|
987
|
+
x = 1;
|
|
988
|
+
}
|
|
989
|
+
if (!y || !Number.isFinite(y)) {
|
|
990
|
+
y = 1;
|
|
991
|
+
}
|
|
992
|
+
return {
|
|
993
|
+
x,
|
|
994
|
+
y
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
999
|
+
var _win$visualViewport, _win$visualViewport2;
|
|
865
1000
|
if (includeScale === void 0) {
|
|
866
1001
|
includeScale = false;
|
|
867
1002
|
}
|
|
868
|
-
|
|
869
1003
|
if (isFixedStrategy === void 0) {
|
|
870
1004
|
isFixedStrategy = false;
|
|
871
1005
|
}
|
|
872
|
-
|
|
873
1006
|
const clientRect = element.getBoundingClientRect();
|
|
874
|
-
|
|
875
|
-
let
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1007
|
+
const domElement = unwrapElement(element);
|
|
1008
|
+
let scale = FALLBACK_SCALE;
|
|
1009
|
+
if (includeScale) {
|
|
1010
|
+
if (offsetParent) {
|
|
1011
|
+
if (isElement(offsetParent)) {
|
|
1012
|
+
scale = getScale(offsetParent);
|
|
1013
|
+
}
|
|
1014
|
+
} else {
|
|
1015
|
+
scale = getScale(element);
|
|
1016
|
+
}
|
|
880
1017
|
}
|
|
881
|
-
|
|
882
|
-
const win = isElement(element) ? getWindow(element) : window;
|
|
1018
|
+
const win = domElement ? getWindow(domElement) : window;
|
|
883
1019
|
const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
1020
|
+
let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
|
|
1021
|
+
let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
|
|
1022
|
+
let width = clientRect.width / scale.x;
|
|
1023
|
+
let height = clientRect.height / scale.y;
|
|
1024
|
+
if (domElement) {
|
|
1025
|
+
const win = getWindow(domElement);
|
|
1026
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1027
|
+
let currentIFrame = win.frameElement;
|
|
1028
|
+
while (currentIFrame && offsetParent && offsetWin !== win) {
|
|
1029
|
+
const iframeScale = getScale(currentIFrame);
|
|
1030
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1031
|
+
const css = getComputedStyle(currentIFrame);
|
|
1032
|
+
iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1033
|
+
iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1034
|
+
x *= iframeScale.x;
|
|
1035
|
+
y *= iframeScale.y;
|
|
1036
|
+
width *= iframeScale.x;
|
|
1037
|
+
height *= iframeScale.y;
|
|
1038
|
+
x += iframeRect.x;
|
|
1039
|
+
y += iframeRect.y;
|
|
1040
|
+
currentIFrame = getWindow(currentIFrame).frameElement;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
888
1043
|
return {
|
|
889
1044
|
width,
|
|
890
1045
|
height,
|
|
@@ -908,7 +1063,6 @@ function getNodeScroll(element) {
|
|
|
908
1063
|
scrollTop: element.scrollTop
|
|
909
1064
|
};
|
|
910
1065
|
}
|
|
911
|
-
|
|
912
1066
|
return {
|
|
913
1067
|
scrollLeft: element.pageXOffset,
|
|
914
1068
|
scrollTop: element.pageYOffset
|
|
@@ -921,16 +1075,10 @@ function getWindowScrollBarX(element) {
|
|
|
921
1075
|
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
922
1076
|
}
|
|
923
1077
|
|
|
924
|
-
function isScaled(element) {
|
|
925
|
-
const rect = getBoundingClientRect(element);
|
|
926
|
-
return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
1078
|
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
930
1079
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
931
1080
|
const documentElement = getDocumentElement(offsetParent);
|
|
932
|
-
const rect = getBoundingClientRect(element,
|
|
933
|
-
isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
|
|
1081
|
+
const rect = getBoundingClientRect(element, true, strategy === 'fixed', offsetParent);
|
|
934
1082
|
let scroll = {
|
|
935
1083
|
scrollLeft: 0,
|
|
936
1084
|
scrollTop: 0
|
|
@@ -939,12 +1087,10 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
939
1087
|
x: 0,
|
|
940
1088
|
y: 0
|
|
941
1089
|
};
|
|
942
|
-
|
|
943
1090
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
944
1091
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
945
1092
|
scroll = getNodeScroll(offsetParent);
|
|
946
1093
|
}
|
|
947
|
-
|
|
948
1094
|
if (isHTMLElement(offsetParent)) {
|
|
949
1095
|
const offsetRect = getBoundingClientRect(offsetParent, true);
|
|
950
1096
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
@@ -953,7 +1099,6 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
953
1099
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
954
1100
|
}
|
|
955
1101
|
}
|
|
956
|
-
|
|
957
1102
|
return {
|
|
958
1103
|
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
959
1104
|
y: rect.top + scroll.scrollTop - offsets.y,
|
|
@@ -966,26 +1111,26 @@ function getParentNode(node) {
|
|
|
966
1111
|
if (getNodeName(node) === 'html') {
|
|
967
1112
|
return node;
|
|
968
1113
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
node.assignedSlot ||
|
|
972
|
-
|
|
973
|
-
|
|
1114
|
+
const result =
|
|
1115
|
+
// Step into the shadow DOM of the parent of a slotted node
|
|
1116
|
+
node.assignedSlot ||
|
|
1117
|
+
// DOM Element detected
|
|
1118
|
+
node.parentNode || (
|
|
1119
|
+
// ShadowRoot detected
|
|
1120
|
+
isShadowRoot(node) ? node.host : null) ||
|
|
1121
|
+
// Fallback
|
|
974
1122
|
getDocumentElement(node);
|
|
975
1123
|
return isShadowRoot(result) ? result.host : result;
|
|
976
1124
|
}
|
|
977
1125
|
|
|
978
1126
|
function getTrueOffsetParent(element) {
|
|
979
|
-
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1127
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
980
1128
|
return null;
|
|
981
1129
|
}
|
|
982
|
-
|
|
983
1130
|
return element.offsetParent;
|
|
984
1131
|
}
|
|
985
|
-
|
|
986
1132
|
function getContainingBlock(element) {
|
|
987
1133
|
let currentNode = getParentNode(element);
|
|
988
|
-
|
|
989
1134
|
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
990
1135
|
if (isContainingBlock(currentNode)) {
|
|
991
1136
|
return currentNode;
|
|
@@ -993,40 +1138,25 @@ function getContainingBlock(element) {
|
|
|
993
1138
|
currentNode = getParentNode(currentNode);
|
|
994
1139
|
}
|
|
995
1140
|
}
|
|
996
|
-
|
|
997
1141
|
return null;
|
|
998
|
-
}
|
|
999
|
-
// such as table ancestors and cross browser bugs.
|
|
1000
|
-
|
|
1142
|
+
}
|
|
1001
1143
|
|
|
1144
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1145
|
+
// such as table ancestors and cross browser bugs.
|
|
1002
1146
|
function getOffsetParent(element) {
|
|
1003
1147
|
const window = getWindow(element);
|
|
1004
1148
|
let offsetParent = getTrueOffsetParent(element);
|
|
1005
|
-
|
|
1006
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
1149
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
1007
1150
|
offsetParent = getTrueOffsetParent(offsetParent);
|
|
1008
1151
|
}
|
|
1009
|
-
|
|
1010
|
-
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1152
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
|
|
1011
1153
|
return window;
|
|
1012
1154
|
}
|
|
1013
|
-
|
|
1014
1155
|
return offsetParent || getContainingBlock(element) || window;
|
|
1015
1156
|
}
|
|
1016
1157
|
|
|
1017
1158
|
function getDimensions(element) {
|
|
1018
|
-
|
|
1019
|
-
return {
|
|
1020
|
-
width: element.offsetWidth,
|
|
1021
|
-
height: element.offsetHeight
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
const rect = getBoundingClientRect(element);
|
|
1026
|
-
return {
|
|
1027
|
-
width: rect.width,
|
|
1028
|
-
height: rect.height
|
|
1029
|
-
};
|
|
1159
|
+
return getCssDimensions(element);
|
|
1030
1160
|
}
|
|
1031
1161
|
|
|
1032
1162
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
@@ -1037,39 +1167,42 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1037
1167
|
} = _ref;
|
|
1038
1168
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1039
1169
|
const documentElement = getDocumentElement(offsetParent);
|
|
1040
|
-
|
|
1041
1170
|
if (offsetParent === documentElement) {
|
|
1042
1171
|
return rect;
|
|
1043
1172
|
}
|
|
1044
|
-
|
|
1045
1173
|
let scroll = {
|
|
1046
1174
|
scrollLeft: 0,
|
|
1047
1175
|
scrollTop: 0
|
|
1048
1176
|
};
|
|
1177
|
+
let scale = {
|
|
1178
|
+
x: 1,
|
|
1179
|
+
y: 1
|
|
1180
|
+
};
|
|
1049
1181
|
const offsets = {
|
|
1050
1182
|
x: 0,
|
|
1051
1183
|
y: 0
|
|
1052
1184
|
};
|
|
1053
|
-
|
|
1054
1185
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
|
|
1055
1186
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1056
1187
|
scroll = getNodeScroll(offsetParent);
|
|
1057
1188
|
}
|
|
1058
|
-
|
|
1059
1189
|
if (isHTMLElement(offsetParent)) {
|
|
1060
|
-
const offsetRect = getBoundingClientRect(offsetParent
|
|
1190
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1191
|
+
scale = getScale(offsetParent);
|
|
1061
1192
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1062
1193
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1063
|
-
}
|
|
1194
|
+
}
|
|
1195
|
+
// This doesn't appear to need to be negated.
|
|
1064
1196
|
// else if (documentElement) {
|
|
1065
1197
|
// offsets.x = getWindowScrollBarX(documentElement);
|
|
1066
1198
|
// }
|
|
1067
|
-
|
|
1068
1199
|
}
|
|
1069
1200
|
|
|
1070
|
-
return {
|
|
1071
|
-
|
|
1072
|
-
|
|
1201
|
+
return {
|
|
1202
|
+
width: rect.width * scale.x,
|
|
1203
|
+
height: rect.height * scale.y,
|
|
1204
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1205
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1073
1206
|
};
|
|
1074
1207
|
}
|
|
1075
1208
|
|
|
@@ -1081,18 +1214,15 @@ function getViewportRect(element, strategy) {
|
|
|
1081
1214
|
let height = html.clientHeight;
|
|
1082
1215
|
let x = 0;
|
|
1083
1216
|
let y = 0;
|
|
1084
|
-
|
|
1085
1217
|
if (visualViewport) {
|
|
1086
1218
|
width = visualViewport.width;
|
|
1087
1219
|
height = visualViewport.height;
|
|
1088
1220
|
const layoutViewport = isLayoutViewport();
|
|
1089
|
-
|
|
1090
1221
|
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
1091
1222
|
x = visualViewport.offsetLeft;
|
|
1092
1223
|
y = visualViewport.offsetTop;
|
|
1093
1224
|
}
|
|
1094
1225
|
}
|
|
1095
|
-
|
|
1096
1226
|
return {
|
|
1097
1227
|
width,
|
|
1098
1228
|
height,
|
|
@@ -1101,11 +1231,10 @@ function getViewportRect(element, strategy) {
|
|
|
1101
1231
|
};
|
|
1102
1232
|
}
|
|
1103
1233
|
|
|
1234
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
1104
1235
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
1105
|
-
|
|
1106
1236
|
function getDocumentRect(element) {
|
|
1107
1237
|
var _element$ownerDocumen;
|
|
1108
|
-
|
|
1109
1238
|
const html = getDocumentElement(element);
|
|
1110
1239
|
const scroll = getNodeScroll(element);
|
|
1111
1240
|
const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
@@ -1113,11 +1242,9 @@ function getDocumentRect(element) {
|
|
|
1113
1242
|
const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
1114
1243
|
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1115
1244
|
const y = -scroll.scrollTop;
|
|
1116
|
-
|
|
1117
|
-
if (getComputedStyle(body || html).direction === 'rtl') {
|
|
1245
|
+
if (getComputedStyle$1(body || html).direction === 'rtl') {
|
|
1118
1246
|
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
1119
1247
|
}
|
|
1120
|
-
|
|
1121
1248
|
return {
|
|
1122
1249
|
width,
|
|
1123
1250
|
height,
|
|
@@ -1128,90 +1255,97 @@ function getDocumentRect(element) {
|
|
|
1128
1255
|
|
|
1129
1256
|
function getNearestOverflowAncestor(node) {
|
|
1130
1257
|
const parentNode = getParentNode(node);
|
|
1131
|
-
|
|
1132
1258
|
if (isLastTraversableNode(parentNode)) {
|
|
1133
1259
|
// @ts-ignore assume body is always available
|
|
1134
1260
|
return node.ownerDocument.body;
|
|
1135
1261
|
}
|
|
1136
|
-
|
|
1137
1262
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1138
1263
|
return parentNode;
|
|
1139
1264
|
}
|
|
1140
|
-
|
|
1141
1265
|
return getNearestOverflowAncestor(parentNode);
|
|
1142
1266
|
}
|
|
1143
1267
|
|
|
1144
1268
|
function getOverflowAncestors(node, list) {
|
|
1145
1269
|
var _node$ownerDocument;
|
|
1146
|
-
|
|
1147
1270
|
if (list === void 0) {
|
|
1148
1271
|
list = [];
|
|
1149
1272
|
}
|
|
1150
|
-
|
|
1151
1273
|
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1152
1274
|
const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
|
|
1153
1275
|
const win = getWindow(scrollableAncestor);
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1276
|
+
if (isBody) {
|
|
1277
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
|
|
1278
|
+
}
|
|
1279
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
|
|
1158
1280
|
}
|
|
1159
1281
|
|
|
1282
|
+
// Returns the inner client rect, subtracting scrollbars if present
|
|
1160
1283
|
function getInnerBoundingClientRect(element, strategy) {
|
|
1161
|
-
const clientRect = getBoundingClientRect(element,
|
|
1284
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
1162
1285
|
const top = clientRect.top + element.clientTop;
|
|
1163
1286
|
const left = clientRect.left + element.clientLeft;
|
|
1287
|
+
const scale = isHTMLElement(element) ? getScale(element) : {
|
|
1288
|
+
x: 1,
|
|
1289
|
+
y: 1
|
|
1290
|
+
};
|
|
1291
|
+
const width = element.clientWidth * scale.x;
|
|
1292
|
+
const height = element.clientHeight * scale.y;
|
|
1293
|
+
const x = left * scale.x;
|
|
1294
|
+
const y = top * scale.y;
|
|
1164
1295
|
return {
|
|
1165
|
-
top,
|
|
1166
|
-
left,
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
width
|
|
1172
|
-
height
|
|
1296
|
+
top: y,
|
|
1297
|
+
left: x,
|
|
1298
|
+
right: x + width,
|
|
1299
|
+
bottom: y + height,
|
|
1300
|
+
x,
|
|
1301
|
+
y,
|
|
1302
|
+
width,
|
|
1303
|
+
height
|
|
1173
1304
|
};
|
|
1174
1305
|
}
|
|
1175
|
-
|
|
1176
1306
|
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
1177
1307
|
if (clippingAncestor === 'viewport') {
|
|
1178
1308
|
return rectToClientRect(getViewportRect(element, strategy));
|
|
1179
1309
|
}
|
|
1180
|
-
|
|
1181
1310
|
if (isElement(clippingAncestor)) {
|
|
1182
1311
|
return getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
1183
1312
|
}
|
|
1184
|
-
|
|
1185
1313
|
return rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
1186
|
-
}
|
|
1187
|
-
// clipping (or hiding) overflowing elements with a position different from
|
|
1188
|
-
// `initial`
|
|
1189
|
-
|
|
1314
|
+
}
|
|
1190
1315
|
|
|
1191
|
-
|
|
1316
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
1317
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
1318
|
+
// of the given element up the tree.
|
|
1319
|
+
function getClippingElementAncestors(element, cache) {
|
|
1320
|
+
const cachedResult = cache.get(element);
|
|
1321
|
+
if (cachedResult) {
|
|
1322
|
+
return cachedResult;
|
|
1323
|
+
}
|
|
1192
1324
|
let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
1193
|
-
let
|
|
1194
|
-
|
|
1325
|
+
let currentContainingBlockComputedStyle = null;
|
|
1326
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
1327
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
1195
1328
|
|
|
1329
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1196
1330
|
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1197
|
-
const computedStyle = getComputedStyle(currentNode);
|
|
1198
|
-
|
|
1199
|
-
|
|
1331
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
1332
|
+
const containingBlock = isContainingBlock(currentNode);
|
|
1333
|
+
const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
|
|
1334
|
+
if (shouldDropCurrentNode) {
|
|
1200
1335
|
// Drop non-containing blocks
|
|
1201
1336
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
1202
1337
|
} else {
|
|
1203
1338
|
// Record last containing block for next iteration
|
|
1204
1339
|
currentContainingBlockComputedStyle = computedStyle;
|
|
1205
1340
|
}
|
|
1206
|
-
|
|
1207
1341
|
currentNode = getParentNode(currentNode);
|
|
1208
1342
|
}
|
|
1209
|
-
|
|
1343
|
+
cache.set(element, result);
|
|
1210
1344
|
return result;
|
|
1211
|
-
}
|
|
1212
|
-
// clipping ancestors
|
|
1213
|
-
|
|
1345
|
+
}
|
|
1214
1346
|
|
|
1347
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
1348
|
+
// clipping ancestors
|
|
1215
1349
|
function getClippingRect(_ref) {
|
|
1216
1350
|
let {
|
|
1217
1351
|
element,
|
|
@@ -1219,7 +1353,7 @@ function getClippingRect(_ref) {
|
|
|
1219
1353
|
rootBoundary,
|
|
1220
1354
|
strategy
|
|
1221
1355
|
} = _ref;
|
|
1222
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element) : [].concat(boundary);
|
|
1356
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1223
1357
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1224
1358
|
const firstClippingAncestor = clippingAncestors[0];
|
|
1225
1359
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
@@ -1245,22 +1379,26 @@ const platform = {
|
|
|
1245
1379
|
getDimensions,
|
|
1246
1380
|
getOffsetParent,
|
|
1247
1381
|
getDocumentElement,
|
|
1248
|
-
|
|
1382
|
+
getScale,
|
|
1383
|
+
async getElementRects(_ref) {
|
|
1249
1384
|
let {
|
|
1250
1385
|
reference,
|
|
1251
1386
|
floating,
|
|
1252
1387
|
strategy
|
|
1253
1388
|
} = _ref;
|
|
1389
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1390
|
+
const getDimensionsFn = this.getDimensions;
|
|
1254
1391
|
return {
|
|
1255
|
-
reference: getRectRelativeToOffsetParent(reference,
|
|
1256
|
-
floating: {
|
|
1392
|
+
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
1393
|
+
floating: {
|
|
1257
1394
|
x: 0,
|
|
1258
|
-
y: 0
|
|
1395
|
+
y: 0,
|
|
1396
|
+
...(await getDimensionsFn(floating))
|
|
1259
1397
|
}
|
|
1260
1398
|
};
|
|
1261
1399
|
},
|
|
1262
1400
|
getClientRects: element => Array.from(element.getClientRects()),
|
|
1263
|
-
isRTL: element => getComputedStyle(element).direction === 'rtl'
|
|
1401
|
+
isRTL: element => getComputedStyle$1(element).direction === 'rtl'
|
|
1264
1402
|
};
|
|
1265
1403
|
|
|
1266
1404
|
/**
|
|
@@ -1271,7 +1409,6 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1271
1409
|
if (options === void 0) {
|
|
1272
1410
|
options = {};
|
|
1273
1411
|
}
|
|
1274
|
-
|
|
1275
1412
|
const {
|
|
1276
1413
|
ancestorScroll: _ancestorScroll = true,
|
|
1277
1414
|
ancestorResize = true,
|
|
@@ -1287,54 +1424,42 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1287
1424
|
ancestorResize && ancestor.addEventListener('resize', update);
|
|
1288
1425
|
});
|
|
1289
1426
|
let observer = null;
|
|
1290
|
-
|
|
1291
1427
|
if (elementResize) {
|
|
1292
1428
|
let initialUpdate = true;
|
|
1293
1429
|
observer = new ResizeObserver(() => {
|
|
1294
1430
|
if (!initialUpdate) {
|
|
1295
1431
|
update();
|
|
1296
1432
|
}
|
|
1297
|
-
|
|
1298
1433
|
initialUpdate = false;
|
|
1299
1434
|
});
|
|
1300
1435
|
isElement(reference) && !animationFrame && observer.observe(reference);
|
|
1301
|
-
|
|
1302
1436
|
if (!isElement(reference) && reference.contextElement && !animationFrame) {
|
|
1303
1437
|
observer.observe(reference.contextElement);
|
|
1304
1438
|
}
|
|
1305
|
-
|
|
1306
1439
|
observer.observe(floating);
|
|
1307
1440
|
}
|
|
1308
|
-
|
|
1309
1441
|
let frameId;
|
|
1310
1442
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
1311
|
-
|
|
1312
1443
|
if (animationFrame) {
|
|
1313
1444
|
frameLoop();
|
|
1314
1445
|
}
|
|
1315
|
-
|
|
1316
1446
|
function frameLoop() {
|
|
1317
1447
|
const nextRefRect = getBoundingClientRect(reference);
|
|
1318
|
-
|
|
1319
1448
|
if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
|
|
1320
1449
|
update();
|
|
1321
1450
|
}
|
|
1322
|
-
|
|
1323
1451
|
prevRefRect = nextRefRect;
|
|
1324
1452
|
frameId = requestAnimationFrame(frameLoop);
|
|
1325
1453
|
}
|
|
1326
|
-
|
|
1327
1454
|
update();
|
|
1328
1455
|
return () => {
|
|
1329
1456
|
var _observer;
|
|
1330
|
-
|
|
1331
1457
|
ancestors.forEach(ancestor => {
|
|
1332
1458
|
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
1333
1459
|
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
1334
1460
|
});
|
|
1335
1461
|
(_observer = observer) == null ? void 0 : _observer.disconnect();
|
|
1336
1462
|
observer = null;
|
|
1337
|
-
|
|
1338
1463
|
if (animationFrame) {
|
|
1339
1464
|
cancelAnimationFrame(frameId);
|
|
1340
1465
|
}
|
|
@@ -1346,27 +1471,30 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1346
1471
|
* next to a reference element when it is given a certain CSS positioning
|
|
1347
1472
|
* strategy.
|
|
1348
1473
|
*/
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
}
|
|
1362
|
-
return
|
|
1363
|
-
|
|
1474
|
+
const computePosition = (reference, floating, options) => {
|
|
1475
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
1476
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
1477
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
1478
|
+
const cache = new Map();
|
|
1479
|
+
const mergedOptions = {
|
|
1480
|
+
platform,
|
|
1481
|
+
...options
|
|
1482
|
+
};
|
|
1483
|
+
const platformWithCache = {
|
|
1484
|
+
...mergedOptions.platform,
|
|
1485
|
+
_c: cache
|
|
1486
|
+
};
|
|
1487
|
+
return computePosition$1(reference, floating, {
|
|
1488
|
+
...mergedOptions,
|
|
1489
|
+
platform: platformWithCache
|
|
1490
|
+
});
|
|
1491
|
+
};
|
|
1364
1492
|
|
|
1365
1493
|
exports.arrow = arrow;
|
|
1366
1494
|
exports.autoPlacement = autoPlacement;
|
|
1367
1495
|
exports.autoUpdate = autoUpdate;
|
|
1368
1496
|
exports.computePosition = computePosition;
|
|
1369
|
-
exports.
|
|
1497
|
+
exports.flip = flip;
|
|
1370
1498
|
exports.inline = inline;
|
|
1371
1499
|
exports.offset = offset;
|
|
1372
1500
|
exports.shift = shift;
|