@ukic/canary-web-components 2.0.0-canary.7 → 2.0.0-canary.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/helpers-93c5fc92.js +198 -0
- package/dist/cjs/helpers-93c5fc92.js.map +1 -0
- package/dist/cjs/{helpers-00b08718.js → helpers-b525d45a.js} +2 -2
- package/dist/cjs/helpers-b525d45a.js.map +1 -0
- package/dist/cjs/ic-accordion-group.cjs.entry.js +6 -2
- package/dist/cjs/ic-accordion-group.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
- package/dist/cjs/ic-alert.cjs.entry.js +1 -1
- package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
- package/dist/cjs/ic-badge.cjs.entry.js +4 -3
- package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ic-button_3.cjs.entry.js +23 -12
- package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-card.cjs.entry.js +5 -6
- package/dist/cjs/ic-card.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ic-chip.cjs.entry.js +1 -1
- package/dist/cjs/ic-data-entity.cjs.entry.js +3 -6
- package/dist/cjs/ic-data-entity.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-data-row.cjs.entry.js +21 -35
- package/dist/cjs/ic-data-row.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ic-divider.cjs.entry.js +1 -1
- package/dist/cjs/ic-empty-state.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-footer.cjs.entry.js +1 -1
- package/dist/cjs/ic-hero.cjs.entry.js +1 -1
- package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js +12 -10
- package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-input-label_2.cjs.entry.js +1 -1
- package/dist/cjs/ic-link.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-menu-with-multi.cjs.entry.js +2599 -0
- package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
- package/dist/cjs/ic-pagination-bar.cjs.entry.js +2 -18
- package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-pagination_4.cjs.entry.js +21 -13
- package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
- package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
- package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-select-with-multi.cjs.entry.js +837 -0
- package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
- package/dist/cjs/ic-step.cjs.entry.js +1 -1
- package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
- package/dist/cjs/ic-switch.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/ic-tab.cjs.entry.js +1 -1
- package/dist/cjs/ic-theme.cjs.entry.js +1 -1
- package/dist/cjs/ic-toast.cjs.entry.js +1 -1
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js +184 -0
- package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -0
- package/dist/cjs/ic-toggle-button.cjs.entry.js +6 -3
- package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
- package/dist/cjs/ic-top-navigation.cjs.entry.js +1 -1
- package/dist/cjs/ic-typography.cjs.entry.js +1 -1
- package/dist/cjs/index-4cf27b16.js +12 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/ic-menu-with-multi/ic-menu.css +701 -0
- package/dist/collection/components/ic-menu-with-multi/ic-menu.js +1458 -0
- package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -0
- package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js +880 -0
- package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js.map +1 -0
- package/dist/collection/components/ic-select-with-multi/assets/Check.svg +3 -0
- package/dist/collection/components/ic-select-with-multi/assets/Clear.svg +3 -0
- package/dist/collection/components/ic-select-with-multi/assets/Expand.svg +3 -0
- package/dist/collection/components/ic-select-with-multi/ic-select.css +693 -0
- package/dist/collection/components/ic-select-with-multi/ic-select.js +1649 -0
- package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -0
- package/dist/collection/components/ic-select-with-multi/story-data.js +216 -0
- package/dist/collection/components/ic-select-with-multi/story-data.js.map +1 -0
- package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js +146 -0
- package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js.map +1 -0
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js +2040 -0
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js.map +1 -0
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js +1518 -0
- package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js.map +1 -0
- package/dist/collection/utils/constants.js +28 -0
- package/dist/collection/utils/constants.js.map +1 -0
- package/dist/collection/utils/helpers.js +168 -5
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/types.js +13 -0
- package/dist/collection/utils/types.js.map +1 -0
- package/dist/components/helpers.js +1 -1
- package/dist/components/helpers.js.map +1 -1
- package/dist/components/helpers2.js +183 -0
- package/dist/components/helpers2.js.map +1 -0
- package/dist/components/ic-accordion-group.js +7 -2
- package/dist/components/ic-accordion-group.js.map +1 -1
- package/dist/components/ic-badge.js +3 -2
- package/dist/components/ic-badge.js.map +1 -1
- package/dist/components/ic-button2.js +22 -11
- package/dist/components/ic-button2.js.map +1 -1
- package/dist/components/ic-card.js +5 -18
- package/dist/components/ic-card.js.map +1 -1
- package/dist/components/ic-data-entity.js +3 -6
- package/dist/components/ic-data-entity.js.map +1 -1
- package/dist/components/ic-data-row.js +20 -34
- package/dist/components/ic-data-row.js.map +1 -1
- package/dist/components/ic-input-component-container2.js +6 -5
- package/dist/components/ic-input-component-container2.js.map +1 -1
- package/dist/components/ic-menu-with-multi.d.ts +11 -0
- package/dist/components/ic-menu-with-multi.js +8 -0
- package/dist/components/ic-menu-with-multi.js.map +1 -0
- package/dist/components/ic-menu2.js +5 -4
- package/dist/components/ic-menu2.js.map +1 -1
- package/dist/components/ic-menu3.js +2665 -0
- package/dist/components/ic-menu3.js.map +1 -0
- package/dist/components/ic-pagination-bar2.js +1 -17
- package/dist/components/ic-pagination-bar2.js.map +1 -1
- package/dist/components/ic-popover-menu.js +1 -1
- package/dist/components/ic-popover-menu.js.map +1 -1
- package/dist/components/ic-search-bar.js.map +1 -1
- package/dist/components/ic-select-with-multi.d.ts +11 -0
- package/dist/components/ic-select-with-multi.js +962 -0
- package/dist/components/ic-select-with-multi.js.map +1 -0
- package/dist/components/ic-select2.js +22 -13
- package/dist/components/ic-select2.js.map +1 -1
- package/dist/components/ic-toggle-button-group.js +210 -0
- package/dist/components/ic-toggle-button-group.js.map +1 -0
- package/dist/components/ic-toggle-button.js +5 -2
- package/dist/components/ic-toggle-button.js.map +1 -1
- package/dist/core/core.css +8 -5
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-9ce5f082.entry.js → p-045359e1.entry.js} +2 -2
- package/dist/core/{p-7276339a.entry.js → p-10fb4c46.entry.js} +2 -2
- package/dist/core/{p-d9342548.entry.js → p-169bfa51.entry.js} +2 -2
- package/dist/core/{p-5746577f.entry.js → p-1ca332ca.entry.js} +2 -2
- package/dist/core/{p-c345a874.entry.js → p-204ace96.entry.js} +2 -2
- package/dist/core/p-21150122.entry.js +2 -0
- package/dist/core/p-21150122.entry.js.map +1 -0
- package/dist/core/{p-f436630b.entry.js → p-2eac7dcc.entry.js} +2 -2
- package/dist/core/{p-b43bd4f3.entry.js → p-3803a5b5.entry.js} +2 -2
- package/dist/core/{p-24945ee5.entry.js → p-452985d9.entry.js} +2 -2
- package/dist/core/p-452985d9.entry.js.map +1 -0
- package/dist/core/{p-ca262cdc.entry.js → p-4753bac8.entry.js} +2 -2
- package/dist/core/{p-3d2fcf84.entry.js → p-4baa0916.entry.js} +2 -2
- package/dist/core/{p-79b71c18.entry.js → p-4f413fc0.entry.js} +2 -2
- package/dist/core/{p-051b8266.entry.js → p-595be57d.entry.js} +2 -2
- package/dist/core/{p-434780c8.entry.js → p-5ae93c16.entry.js} +2 -2
- package/dist/core/{p-ff1d23cd.entry.js → p-5e0c830b.entry.js} +2 -2
- package/dist/core/p-624d4f5f.entry.js +2 -0
- package/dist/core/p-624d4f5f.entry.js.map +1 -0
- package/dist/core/{p-c263542a.entry.js → p-6933f8e9.entry.js} +2 -2
- package/dist/core/{p-32f18701.entry.js → p-6c3044b6.entry.js} +2 -2
- package/dist/core/{p-da4f0a58.entry.js → p-73be1251.entry.js} +2 -2
- package/dist/core/{p-d49660e0.entry.js → p-75dac3d1.entry.js} +2 -2
- package/dist/core/{p-a3ab9f4c.entry.js → p-76915584.entry.js} +2 -2
- package/dist/core/p-76915584.entry.js.map +1 -0
- package/dist/core/{p-88971cea.entry.js → p-7ef8d616.entry.js} +2 -2
- package/dist/core/{p-9fd84c69.entry.js → p-81ddc39d.entry.js} +2 -2
- package/dist/core/{p-fbb1fba0.entry.js → p-869954a2.entry.js} +2 -2
- package/dist/core/{p-3c859b9e.entry.js → p-88d54b72.entry.js} +2 -2
- package/dist/core/{p-5e94fae8.entry.js → p-8b08d8fe.entry.js} +2 -2
- package/dist/core/p-8b08d8fe.entry.js.map +1 -0
- package/dist/core/{p-d78fd9f3.entry.js → p-917c5721.entry.js} +2 -2
- package/dist/core/{p-2094c844.entry.js → p-942282cd.entry.js} +2 -2
- package/dist/core/p-99cad6c2.js +2 -0
- package/dist/core/p-99cad6c2.js.map +1 -0
- package/dist/core/p-9caf19eb.js +2 -0
- package/dist/core/p-9caf19eb.js.map +1 -0
- package/dist/core/{p-966ab920.entry.js → p-a0f8efb2.entry.js} +2 -2
- package/dist/core/{p-7632acc6.entry.js → p-a31031a5.entry.js} +2 -2
- package/dist/core/{p-a7d52bd1.entry.js → p-a434c3d4.entry.js} +2 -2
- package/dist/core/{p-95d3cd52.entry.js → p-a43c12cd.entry.js} +2 -2
- package/dist/core/{p-aafb2c79.entry.js → p-a50c3b9e.entry.js} +2 -2
- package/dist/core/{p-28fb7cca.entry.js → p-ab09986c.entry.js} +2 -2
- package/dist/core/p-ab09986c.entry.js.map +1 -0
- package/dist/core/p-ac4e40a7.entry.js +2 -0
- package/dist/core/p-ac4e40a7.entry.js.map +1 -0
- package/dist/core/{p-7dfd61bb.entry.js → p-b82dcc29.entry.js} +2 -2
- package/dist/core/{p-337b6e05.entry.js → p-ba86928c.entry.js} +2 -2
- package/dist/core/{p-f827e4c0.entry.js → p-c125b65a.entry.js} +2 -2
- package/dist/core/{p-27aa95e7.entry.js → p-c34848da.entry.js} +2 -2
- package/dist/core/{p-3b9f3a07.entry.js → p-d8469ac0.entry.js} +2 -2
- package/dist/core/{p-a2f366c7.entry.js → p-db9c03c0.entry.js} +2 -2
- package/dist/core/{p-6de46cb7.entry.js → p-e0462b23.entry.js} +2 -2
- package/dist/core/p-e0462b23.entry.js.map +1 -0
- package/dist/core/p-e0a94f2d.entry.js +2 -0
- package/dist/core/p-e0a94f2d.entry.js.map +1 -0
- package/dist/core/{p-116b18fe.entry.js → p-e3997d60.entry.js} +2 -2
- package/dist/core/p-e79e0292.entry.js +2 -0
- package/dist/core/p-e79e0292.entry.js.map +1 -0
- package/dist/core/{p-0d181ac8.entry.js → p-e834344e.entry.js} +2 -2
- package/dist/core/p-f14454b1.entry.js +2 -0
- package/dist/core/{p-93c5b849.entry.js.map → p-f14454b1.entry.js.map} +1 -1
- package/dist/core/{p-a162744e.entry.js → p-f3c840cd.entry.js} +2 -2
- package/dist/core/{p-a162744e.entry.js.map → p-f3c840cd.entry.js.map} +1 -1
- package/dist/core/{p-7b849cb5.entry.js → p-f6888309.entry.js} +2 -2
- package/dist/core/p-f74a8752.entry.js +2 -0
- package/dist/core/p-f74a8752.entry.js.map +1 -0
- package/dist/core/{p-4df42c76.entry.js → p-f7a14c01.entry.js} +2 -2
- package/dist/core/{p-d5cc084b.entry.js → p-f843da01.entry.js} +2 -2
- package/dist/core/{p-d5cc084b.entry.js.map → p-f843da01.entry.js.map} +1 -1
- package/dist/core/{p-0f0509ee.entry.js → p-fc5611e2.entry.js} +2 -2
- package/dist/core/p-fc5611e2.entry.js.map +1 -0
- package/dist/core/p-fde45b29.entry.js +2 -0
- package/dist/core/p-fde45b29.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/{helpers-d06dc4ed.js → helpers-12b4266a.js} +2 -2
- package/dist/esm/helpers-12b4266a.js.map +1 -0
- package/dist/esm/helpers-5271897c.js +183 -0
- package/dist/esm/helpers-5271897c.js.map +1 -0
- package/dist/esm/ic-accordion-group.entry.js +6 -2
- package/dist/esm/ic-accordion-group.entry.js.map +1 -1
- package/dist/esm/ic-accordion.entry.js +1 -1
- package/dist/esm/ic-alert.entry.js +1 -1
- package/dist/esm/ic-back-to-top.entry.js +1 -1
- package/dist/esm/ic-badge.entry.js +4 -3
- package/dist/esm/ic-badge.entry.js.map +1 -1
- package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
- package/dist/esm/ic-breadcrumb.entry.js +1 -1
- package/dist/esm/ic-button_3.entry.js +23 -12
- package/dist/esm/ic-button_3.entry.js.map +1 -1
- package/dist/esm/ic-card.entry.js +5 -6
- package/dist/esm/ic-card.entry.js.map +1 -1
- package/dist/esm/ic-checkbox-group.entry.js +1 -1
- package/dist/esm/ic-checkbox.entry.js +1 -1
- package/dist/esm/ic-chip.entry.js +1 -1
- package/dist/esm/ic-data-entity.entry.js +3 -6
- package/dist/esm/ic-data-entity.entry.js.map +1 -1
- package/dist/esm/ic-data-row.entry.js +21 -35
- package/dist/esm/ic-data-row.entry.js.map +1 -1
- package/dist/esm/ic-dialog.entry.js +1 -1
- package/dist/esm/ic-divider.entry.js +1 -1
- package/dist/esm/ic-empty-state.entry.js +1 -1
- package/dist/esm/ic-footer-link-group.entry.js +1 -1
- package/dist/esm/ic-footer-link.entry.js +1 -1
- package/dist/esm/ic-footer.entry.js +1 -1
- package/dist/esm/ic-hero.entry.js +1 -1
- package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
- package/dist/esm/ic-input-component-container_3.entry.js +12 -10
- package/dist/esm/ic-input-component-container_3.entry.js.map +1 -1
- package/dist/esm/ic-input-label_2.entry.js +1 -1
- package/dist/esm/ic-link.entry.js +1 -1
- package/dist/esm/ic-menu-group.entry.js +1 -1
- package/dist/esm/ic-menu-item.entry.js +1 -1
- package/dist/esm/ic-menu-with-multi.entry.js +2595 -0
- package/dist/esm/ic-menu-with-multi.entry.js.map +1 -0
- package/dist/esm/ic-navigation-button.entry.js +1 -1
- package/dist/esm/ic-navigation-group.entry.js +1 -1
- package/dist/esm/ic-navigation-item.entry.js +1 -1
- package/dist/esm/ic-navigation-menu.entry.js +1 -1
- package/dist/esm/ic-page-header.entry.js +1 -1
- package/dist/esm/ic-pagination-bar.entry.js +1 -17
- package/dist/esm/ic-pagination-bar.entry.js.map +1 -1
- package/dist/esm/ic-pagination_4.entry.js +21 -13
- package/dist/esm/ic-pagination_4.entry.js.map +1 -1
- package/dist/esm/ic-popover-menu.entry.js +1 -1
- package/dist/esm/ic-popover-menu.entry.js.map +1 -1
- package/dist/esm/ic-radio-group.entry.js +1 -1
- package/dist/esm/ic-radio-option.entry.js +1 -1
- package/dist/esm/ic-search-bar.entry.js +1 -1
- package/dist/esm/ic-search-bar.entry.js.map +1 -1
- package/dist/esm/ic-select-with-multi.entry.js +833 -0
- package/dist/esm/ic-select-with-multi.entry.js.map +1 -0
- package/dist/esm/ic-side-navigation.entry.js +1 -1
- package/dist/esm/ic-status-tag.entry.js +1 -1
- package/dist/esm/ic-step.entry.js +1 -1
- package/dist/esm/ic-stepper.entry.js +1 -1
- package/dist/esm/ic-switch.entry.js +1 -1
- package/dist/esm/ic-tab-group.entry.js +1 -1
- package/dist/esm/ic-tab-panel.entry.js +1 -1
- package/dist/esm/ic-tab.entry.js +1 -1
- package/dist/esm/ic-theme.entry.js +1 -1
- package/dist/esm/ic-toast.entry.js +1 -1
- package/dist/esm/ic-toggle-button-group.entry.js +180 -0
- package/dist/esm/ic-toggle-button-group.entry.js.map +1 -0
- package/dist/esm/ic-toggle-button.entry.js +6 -3
- package/dist/esm/ic-toggle-button.entry.js.map +1 -1
- package/dist/esm/ic-top-navigation.entry.js +1 -1
- package/dist/esm/ic-typography.entry.js +1 -1
- package/dist/esm/index-93509377.js +12 -0
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +208 -0
- package/dist/types/components/ic-select-with-multi/ic-select.d.ts +289 -0
- package/dist/types/components/ic-select-with-multi/story-data.d.ts +32 -0
- package/dist/types/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.d.ts +1 -0
- package/dist/types/components.d.ts +531 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/helpers.d.ts +61 -2
- package/dist/types/utils/types.d.ts +16 -0
- package/hydrate/index.js +6795 -2907
- package/package.json +3 -3
- package/dist/cjs/helpers-00b08718.js.map +0 -1
- package/dist/core/p-0f0509ee.entry.js.map +0 -1
- package/dist/core/p-24945ee5.entry.js.map +0 -1
- package/dist/core/p-28fb7cca.entry.js.map +0 -1
- package/dist/core/p-2aad58b6.js +0 -2
- package/dist/core/p-2aad58b6.js.map +0 -1
- package/dist/core/p-38314d45.entry.js +0 -2
- package/dist/core/p-38314d45.entry.js.map +0 -1
- package/dist/core/p-5e94fae8.entry.js.map +0 -1
- package/dist/core/p-6de46cb7.entry.js.map +0 -1
- package/dist/core/p-93c5b849.entry.js +0 -2
- package/dist/core/p-9fdd7d73.entry.js +0 -2
- package/dist/core/p-9fdd7d73.entry.js.map +0 -1
- package/dist/core/p-a3ab9f4c.entry.js.map +0 -1
- package/dist/core/p-c9b11488.entry.js +0 -2
- package/dist/core/p-c9b11488.entry.js.map +0 -1
- package/dist/core/p-f163a406.entry.js +0 -2
- package/dist/core/p-f163a406.entry.js.map +0 -1
- package/dist/esm/helpers-d06dc4ed.js.map +0 -1
- /package/dist/core/{p-9ce5f082.entry.js.map → p-045359e1.entry.js.map} +0 -0
- /package/dist/core/{p-7276339a.entry.js.map → p-10fb4c46.entry.js.map} +0 -0
- /package/dist/core/{p-d9342548.entry.js.map → p-169bfa51.entry.js.map} +0 -0
- /package/dist/core/{p-5746577f.entry.js.map → p-1ca332ca.entry.js.map} +0 -0
- /package/dist/core/{p-c345a874.entry.js.map → p-204ace96.entry.js.map} +0 -0
- /package/dist/core/{p-f436630b.entry.js.map → p-2eac7dcc.entry.js.map} +0 -0
- /package/dist/core/{p-b43bd4f3.entry.js.map → p-3803a5b5.entry.js.map} +0 -0
- /package/dist/core/{p-ca262cdc.entry.js.map → p-4753bac8.entry.js.map} +0 -0
- /package/dist/core/{p-3d2fcf84.entry.js.map → p-4baa0916.entry.js.map} +0 -0
- /package/dist/core/{p-79b71c18.entry.js.map → p-4f413fc0.entry.js.map} +0 -0
- /package/dist/core/{p-051b8266.entry.js.map → p-595be57d.entry.js.map} +0 -0
- /package/dist/core/{p-434780c8.entry.js.map → p-5ae93c16.entry.js.map} +0 -0
- /package/dist/core/{p-ff1d23cd.entry.js.map → p-5e0c830b.entry.js.map} +0 -0
- /package/dist/core/{p-c263542a.entry.js.map → p-6933f8e9.entry.js.map} +0 -0
- /package/dist/core/{p-32f18701.entry.js.map → p-6c3044b6.entry.js.map} +0 -0
- /package/dist/core/{p-da4f0a58.entry.js.map → p-73be1251.entry.js.map} +0 -0
- /package/dist/core/{p-d49660e0.entry.js.map → p-75dac3d1.entry.js.map} +0 -0
- /package/dist/core/{p-88971cea.entry.js.map → p-7ef8d616.entry.js.map} +0 -0
- /package/dist/core/{p-9fd84c69.entry.js.map → p-81ddc39d.entry.js.map} +0 -0
- /package/dist/core/{p-fbb1fba0.entry.js.map → p-869954a2.entry.js.map} +0 -0
- /package/dist/core/{p-3c859b9e.entry.js.map → p-88d54b72.entry.js.map} +0 -0
- /package/dist/core/{p-d78fd9f3.entry.js.map → p-917c5721.entry.js.map} +0 -0
- /package/dist/core/{p-2094c844.entry.js.map → p-942282cd.entry.js.map} +0 -0
- /package/dist/core/{p-966ab920.entry.js.map → p-a0f8efb2.entry.js.map} +0 -0
- /package/dist/core/{p-7632acc6.entry.js.map → p-a31031a5.entry.js.map} +0 -0
- /package/dist/core/{p-a7d52bd1.entry.js.map → p-a434c3d4.entry.js.map} +0 -0
- /package/dist/core/{p-95d3cd52.entry.js.map → p-a43c12cd.entry.js.map} +0 -0
- /package/dist/core/{p-aafb2c79.entry.js.map → p-a50c3b9e.entry.js.map} +0 -0
- /package/dist/core/{p-7dfd61bb.entry.js.map → p-b82dcc29.entry.js.map} +0 -0
- /package/dist/core/{p-337b6e05.entry.js.map → p-ba86928c.entry.js.map} +0 -0
- /package/dist/core/{p-f827e4c0.entry.js.map → p-c125b65a.entry.js.map} +0 -0
- /package/dist/core/{p-27aa95e7.entry.js.map → p-c34848da.entry.js.map} +0 -0
- /package/dist/core/{p-3b9f3a07.entry.js.map → p-d8469ac0.entry.js.map} +0 -0
- /package/dist/core/{p-a2f366c7.entry.js.map → p-db9c03c0.entry.js.map} +0 -0
- /package/dist/core/{p-116b18fe.entry.js.map → p-e3997d60.entry.js.map} +0 -0
- /package/dist/core/{p-0d181ac8.entry.js.map → p-e834344e.entry.js.map} +0 -0
- /package/dist/core/{p-7b849cb5.entry.js.map → p-f6888309.entry.js.map} +0 -0
- /package/dist/core/{p-4df42c76.entry.js.map → p-f7a14c01.entry.js.map} +0 -0
@@ -0,0 +1,2665 @@
|
|
1
|
+
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
|
+
import { i as isMacDevice, o as onComponentRequiredPropUndefined, g as getOptionsWithoutGroupTitlesCount } from './helpers2.js';
|
3
|
+
import { d as defineCustomElement$4 } from './ic-button2.js';
|
4
|
+
import { d as defineCustomElement$3 } from './ic-loading-indicator2.js';
|
5
|
+
import { d as defineCustomElement$2 } from './ic-tooltip2.js';
|
6
|
+
import { d as defineCustomElement$1 } from './ic-typography2.js';
|
7
|
+
|
8
|
+
var top = 'top';
|
9
|
+
var bottom = 'bottom';
|
10
|
+
var right = 'right';
|
11
|
+
var left = 'left';
|
12
|
+
var auto = 'auto';
|
13
|
+
var basePlacements = [top, bottom, right, left];
|
14
|
+
var start = 'start';
|
15
|
+
var end = 'end';
|
16
|
+
var clippingParents = 'clippingParents';
|
17
|
+
var viewport = 'viewport';
|
18
|
+
var popper = 'popper';
|
19
|
+
var reference = 'reference';
|
20
|
+
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
21
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
22
|
+
}, []);
|
23
|
+
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
24
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
25
|
+
}, []); // modifiers that need to read the DOM
|
26
|
+
|
27
|
+
var beforeRead = 'beforeRead';
|
28
|
+
var read = 'read';
|
29
|
+
var afterRead = 'afterRead'; // pure-logic modifiers
|
30
|
+
|
31
|
+
var beforeMain = 'beforeMain';
|
32
|
+
var main = 'main';
|
33
|
+
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
34
|
+
|
35
|
+
var beforeWrite = 'beforeWrite';
|
36
|
+
var write = 'write';
|
37
|
+
var afterWrite = 'afterWrite';
|
38
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
39
|
+
|
40
|
+
function getNodeName(element) {
|
41
|
+
return element ? (element.nodeName || '').toLowerCase() : null;
|
42
|
+
}
|
43
|
+
|
44
|
+
function getWindow(node) {
|
45
|
+
if (node == null) {
|
46
|
+
return window;
|
47
|
+
}
|
48
|
+
|
49
|
+
if (node.toString() !== '[object Window]') {
|
50
|
+
var ownerDocument = node.ownerDocument;
|
51
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
52
|
+
}
|
53
|
+
|
54
|
+
return node;
|
55
|
+
}
|
56
|
+
|
57
|
+
function isElement(node) {
|
58
|
+
var OwnElement = getWindow(node).Element;
|
59
|
+
return node instanceof OwnElement || node instanceof Element;
|
60
|
+
}
|
61
|
+
|
62
|
+
function isHTMLElement(node) {
|
63
|
+
var OwnElement = getWindow(node).HTMLElement;
|
64
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
65
|
+
}
|
66
|
+
|
67
|
+
function isShadowRoot(node) {
|
68
|
+
// IE 11 has no ShadowRoot
|
69
|
+
if (typeof ShadowRoot === 'undefined') {
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
|
73
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
74
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
75
|
+
}
|
76
|
+
|
77
|
+
// and applies them to the HTMLElements such as popper and arrow
|
78
|
+
|
79
|
+
function applyStyles(_ref) {
|
80
|
+
var state = _ref.state;
|
81
|
+
Object.keys(state.elements).forEach(function (name) {
|
82
|
+
var style = state.styles[name] || {};
|
83
|
+
var attributes = state.attributes[name] || {};
|
84
|
+
var element = state.elements[name]; // arrow is optional + virtual elements
|
85
|
+
|
86
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
87
|
+
return;
|
88
|
+
} // Flow doesn't support to extend this property, but it's the most
|
89
|
+
// effective way to apply styles to an HTMLElement
|
90
|
+
// $FlowFixMe[cannot-write]
|
91
|
+
|
92
|
+
|
93
|
+
Object.assign(element.style, style);
|
94
|
+
Object.keys(attributes).forEach(function (name) {
|
95
|
+
var value = attributes[name];
|
96
|
+
|
97
|
+
if (value === false) {
|
98
|
+
element.removeAttribute(name);
|
99
|
+
} else {
|
100
|
+
element.setAttribute(name, value === true ? '' : value);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
});
|
104
|
+
}
|
105
|
+
|
106
|
+
function effect$2(_ref2) {
|
107
|
+
var state = _ref2.state;
|
108
|
+
var initialStyles = {
|
109
|
+
popper: {
|
110
|
+
position: state.options.strategy,
|
111
|
+
left: '0',
|
112
|
+
top: '0',
|
113
|
+
margin: '0'
|
114
|
+
},
|
115
|
+
arrow: {
|
116
|
+
position: 'absolute'
|
117
|
+
},
|
118
|
+
reference: {}
|
119
|
+
};
|
120
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
121
|
+
state.styles = initialStyles;
|
122
|
+
|
123
|
+
if (state.elements.arrow) {
|
124
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
125
|
+
}
|
126
|
+
|
127
|
+
return function () {
|
128
|
+
Object.keys(state.elements).forEach(function (name) {
|
129
|
+
var element = state.elements[name];
|
130
|
+
var attributes = state.attributes[name] || {};
|
131
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
132
|
+
|
133
|
+
var style = styleProperties.reduce(function (style, property) {
|
134
|
+
style[property] = '';
|
135
|
+
return style;
|
136
|
+
}, {}); // arrow is optional + virtual elements
|
137
|
+
|
138
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
|
142
|
+
Object.assign(element.style, style);
|
143
|
+
Object.keys(attributes).forEach(function (attribute) {
|
144
|
+
element.removeAttribute(attribute);
|
145
|
+
});
|
146
|
+
});
|
147
|
+
};
|
148
|
+
} // eslint-disable-next-line import/no-unused-modules
|
149
|
+
|
150
|
+
|
151
|
+
const applyStyles$1 = {
|
152
|
+
name: 'applyStyles',
|
153
|
+
enabled: true,
|
154
|
+
phase: 'write',
|
155
|
+
fn: applyStyles,
|
156
|
+
effect: effect$2,
|
157
|
+
requires: ['computeStyles']
|
158
|
+
};
|
159
|
+
|
160
|
+
function getBasePlacement(placement) {
|
161
|
+
return placement.split('-')[0];
|
162
|
+
}
|
163
|
+
|
164
|
+
var max = Math.max;
|
165
|
+
var min = Math.min;
|
166
|
+
var round = Math.round;
|
167
|
+
|
168
|
+
function getUAString() {
|
169
|
+
var uaData = navigator.userAgentData;
|
170
|
+
|
171
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
172
|
+
return uaData.brands.map(function (item) {
|
173
|
+
return item.brand + "/" + item.version;
|
174
|
+
}).join(' ');
|
175
|
+
}
|
176
|
+
|
177
|
+
return navigator.userAgent;
|
178
|
+
}
|
179
|
+
|
180
|
+
function isLayoutViewport() {
|
181
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
182
|
+
}
|
183
|
+
|
184
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
185
|
+
if (includeScale === void 0) {
|
186
|
+
includeScale = false;
|
187
|
+
}
|
188
|
+
|
189
|
+
if (isFixedStrategy === void 0) {
|
190
|
+
isFixedStrategy = false;
|
191
|
+
}
|
192
|
+
|
193
|
+
var clientRect = element.getBoundingClientRect();
|
194
|
+
var scaleX = 1;
|
195
|
+
var scaleY = 1;
|
196
|
+
|
197
|
+
if (includeScale && isHTMLElement(element)) {
|
198
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
199
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
200
|
+
}
|
201
|
+
|
202
|
+
var _ref = isElement(element) ? getWindow(element) : window,
|
203
|
+
visualViewport = _ref.visualViewport;
|
204
|
+
|
205
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
206
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
207
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
208
|
+
var width = clientRect.width / scaleX;
|
209
|
+
var height = clientRect.height / scaleY;
|
210
|
+
return {
|
211
|
+
width: width,
|
212
|
+
height: height,
|
213
|
+
top: y,
|
214
|
+
right: x + width,
|
215
|
+
bottom: y + height,
|
216
|
+
left: x,
|
217
|
+
x: x,
|
218
|
+
y: y
|
219
|
+
};
|
220
|
+
}
|
221
|
+
|
222
|
+
// means it doesn't take into account transforms.
|
223
|
+
|
224
|
+
function getLayoutRect(element) {
|
225
|
+
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
226
|
+
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
227
|
+
|
228
|
+
var width = element.offsetWidth;
|
229
|
+
var height = element.offsetHeight;
|
230
|
+
|
231
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
232
|
+
width = clientRect.width;
|
233
|
+
}
|
234
|
+
|
235
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
236
|
+
height = clientRect.height;
|
237
|
+
}
|
238
|
+
|
239
|
+
return {
|
240
|
+
x: element.offsetLeft,
|
241
|
+
y: element.offsetTop,
|
242
|
+
width: width,
|
243
|
+
height: height
|
244
|
+
};
|
245
|
+
}
|
246
|
+
|
247
|
+
function contains(parent, child) {
|
248
|
+
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
249
|
+
|
250
|
+
if (parent.contains(child)) {
|
251
|
+
return true;
|
252
|
+
} // then fallback to custom implementation with Shadow DOM support
|
253
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
254
|
+
var next = child;
|
255
|
+
|
256
|
+
do {
|
257
|
+
if (next && parent.isSameNode(next)) {
|
258
|
+
return true;
|
259
|
+
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
260
|
+
|
261
|
+
|
262
|
+
next = next.parentNode || next.host;
|
263
|
+
} while (next);
|
264
|
+
} // Give up, the result is false
|
265
|
+
|
266
|
+
|
267
|
+
return false;
|
268
|
+
}
|
269
|
+
|
270
|
+
function getComputedStyle(element) {
|
271
|
+
return getWindow(element).getComputedStyle(element);
|
272
|
+
}
|
273
|
+
|
274
|
+
function isTableElement(element) {
|
275
|
+
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
276
|
+
}
|
277
|
+
|
278
|
+
function getDocumentElement(element) {
|
279
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
280
|
+
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
281
|
+
element.document) || window.document).documentElement;
|
282
|
+
}
|
283
|
+
|
284
|
+
function getParentNode(element) {
|
285
|
+
if (getNodeName(element) === 'html') {
|
286
|
+
return element;
|
287
|
+
}
|
288
|
+
|
289
|
+
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
290
|
+
// $FlowFixMe[incompatible-return]
|
291
|
+
// $FlowFixMe[prop-missing]
|
292
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
293
|
+
element.parentNode || ( // DOM Element detected
|
294
|
+
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
295
|
+
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
296
|
+
getDocumentElement(element) // fallback
|
297
|
+
|
298
|
+
);
|
299
|
+
}
|
300
|
+
|
301
|
+
function getTrueOffsetParent(element) {
|
302
|
+
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
303
|
+
getComputedStyle(element).position === 'fixed') {
|
304
|
+
return null;
|
305
|
+
}
|
306
|
+
|
307
|
+
return element.offsetParent;
|
308
|
+
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
309
|
+
// return the containing block
|
310
|
+
|
311
|
+
|
312
|
+
function getContainingBlock(element) {
|
313
|
+
var isFirefox = /firefox/i.test(getUAString());
|
314
|
+
var isIE = /Trident/i.test(getUAString());
|
315
|
+
|
316
|
+
if (isIE && isHTMLElement(element)) {
|
317
|
+
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
318
|
+
var elementCss = getComputedStyle(element);
|
319
|
+
|
320
|
+
if (elementCss.position === 'fixed') {
|
321
|
+
return null;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
|
325
|
+
var currentNode = getParentNode(element);
|
326
|
+
|
327
|
+
if (isShadowRoot(currentNode)) {
|
328
|
+
currentNode = currentNode.host;
|
329
|
+
}
|
330
|
+
|
331
|
+
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
332
|
+
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
333
|
+
// create a containing block.
|
334
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
335
|
+
|
336
|
+
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
337
|
+
return currentNode;
|
338
|
+
} else {
|
339
|
+
currentNode = currentNode.parentNode;
|
340
|
+
}
|
341
|
+
}
|
342
|
+
|
343
|
+
return null;
|
344
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
345
|
+
// such as table ancestors and cross browser bugs.
|
346
|
+
|
347
|
+
|
348
|
+
function getOffsetParent(element) {
|
349
|
+
var window = getWindow(element);
|
350
|
+
var offsetParent = getTrueOffsetParent(element);
|
351
|
+
|
352
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
353
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
354
|
+
}
|
355
|
+
|
356
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
357
|
+
return window;
|
358
|
+
}
|
359
|
+
|
360
|
+
return offsetParent || getContainingBlock(element) || window;
|
361
|
+
}
|
362
|
+
|
363
|
+
function getMainAxisFromPlacement(placement) {
|
364
|
+
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
365
|
+
}
|
366
|
+
|
367
|
+
function within(min$1, value, max$1) {
|
368
|
+
return max(min$1, min(value, max$1));
|
369
|
+
}
|
370
|
+
function withinMaxClamp(min, value, max) {
|
371
|
+
var v = within(min, value, max);
|
372
|
+
return v > max ? max : v;
|
373
|
+
}
|
374
|
+
|
375
|
+
function getFreshSideObject() {
|
376
|
+
return {
|
377
|
+
top: 0,
|
378
|
+
right: 0,
|
379
|
+
bottom: 0,
|
380
|
+
left: 0
|
381
|
+
};
|
382
|
+
}
|
383
|
+
|
384
|
+
function mergePaddingObject(paddingObject) {
|
385
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
386
|
+
}
|
387
|
+
|
388
|
+
function expandToHashMap(value, keys) {
|
389
|
+
return keys.reduce(function (hashMap, key) {
|
390
|
+
hashMap[key] = value;
|
391
|
+
return hashMap;
|
392
|
+
}, {});
|
393
|
+
}
|
394
|
+
|
395
|
+
var toPaddingObject = function toPaddingObject(padding, state) {
|
396
|
+
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
397
|
+
placement: state.placement
|
398
|
+
})) : padding;
|
399
|
+
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
400
|
+
};
|
401
|
+
|
402
|
+
function arrow(_ref) {
|
403
|
+
var _state$modifiersData$;
|
404
|
+
|
405
|
+
var state = _ref.state,
|
406
|
+
name = _ref.name,
|
407
|
+
options = _ref.options;
|
408
|
+
var arrowElement = state.elements.arrow;
|
409
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
410
|
+
var basePlacement = getBasePlacement(state.placement);
|
411
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
412
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
413
|
+
var len = isVertical ? 'height' : 'width';
|
414
|
+
|
415
|
+
if (!arrowElement || !popperOffsets) {
|
416
|
+
return;
|
417
|
+
}
|
418
|
+
|
419
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
420
|
+
var arrowRect = getLayoutRect(arrowElement);
|
421
|
+
var minProp = axis === 'y' ? top : left;
|
422
|
+
var maxProp = axis === 'y' ? bottom : right;
|
423
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
424
|
+
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
425
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
426
|
+
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
427
|
+
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
428
|
+
// outside of the popper bounds
|
429
|
+
|
430
|
+
var min = paddingObject[minProp];
|
431
|
+
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
432
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
433
|
+
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
434
|
+
|
435
|
+
var axisProp = axis;
|
436
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
437
|
+
}
|
438
|
+
|
439
|
+
function effect$1(_ref2) {
|
440
|
+
var state = _ref2.state,
|
441
|
+
options = _ref2.options;
|
442
|
+
var _options$element = options.element,
|
443
|
+
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
444
|
+
|
445
|
+
if (arrowElement == null) {
|
446
|
+
return;
|
447
|
+
} // CSS selector
|
448
|
+
|
449
|
+
|
450
|
+
if (typeof arrowElement === 'string') {
|
451
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
452
|
+
|
453
|
+
if (!arrowElement) {
|
454
|
+
return;
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
459
|
+
return;
|
460
|
+
}
|
461
|
+
|
462
|
+
state.elements.arrow = arrowElement;
|
463
|
+
} // eslint-disable-next-line import/no-unused-modules
|
464
|
+
|
465
|
+
|
466
|
+
const arrow$1 = {
|
467
|
+
name: 'arrow',
|
468
|
+
enabled: true,
|
469
|
+
phase: 'main',
|
470
|
+
fn: arrow,
|
471
|
+
effect: effect$1,
|
472
|
+
requires: ['popperOffsets'],
|
473
|
+
requiresIfExists: ['preventOverflow']
|
474
|
+
};
|
475
|
+
|
476
|
+
function getVariation(placement) {
|
477
|
+
return placement.split('-')[1];
|
478
|
+
}
|
479
|
+
|
480
|
+
var unsetSides = {
|
481
|
+
top: 'auto',
|
482
|
+
right: 'auto',
|
483
|
+
bottom: 'auto',
|
484
|
+
left: 'auto'
|
485
|
+
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
486
|
+
// Zooming can change the DPR, but it seems to report a value that will
|
487
|
+
// cleanly divide the values into the appropriate subpixels.
|
488
|
+
|
489
|
+
function roundOffsetsByDPR(_ref, win) {
|
490
|
+
var x = _ref.x,
|
491
|
+
y = _ref.y;
|
492
|
+
var dpr = win.devicePixelRatio || 1;
|
493
|
+
return {
|
494
|
+
x: round(x * dpr) / dpr || 0,
|
495
|
+
y: round(y * dpr) / dpr || 0
|
496
|
+
};
|
497
|
+
}
|
498
|
+
|
499
|
+
function mapToStyles(_ref2) {
|
500
|
+
var _Object$assign2;
|
501
|
+
|
502
|
+
var popper = _ref2.popper,
|
503
|
+
popperRect = _ref2.popperRect,
|
504
|
+
placement = _ref2.placement,
|
505
|
+
variation = _ref2.variation,
|
506
|
+
offsets = _ref2.offsets,
|
507
|
+
position = _ref2.position,
|
508
|
+
gpuAcceleration = _ref2.gpuAcceleration,
|
509
|
+
adaptive = _ref2.adaptive,
|
510
|
+
roundOffsets = _ref2.roundOffsets,
|
511
|
+
isFixed = _ref2.isFixed;
|
512
|
+
var _offsets$x = offsets.x,
|
513
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
514
|
+
_offsets$y = offsets.y,
|
515
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
516
|
+
|
517
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
518
|
+
x: x,
|
519
|
+
y: y
|
520
|
+
}) : {
|
521
|
+
x: x,
|
522
|
+
y: y
|
523
|
+
};
|
524
|
+
|
525
|
+
x = _ref3.x;
|
526
|
+
y = _ref3.y;
|
527
|
+
var hasX = offsets.hasOwnProperty('x');
|
528
|
+
var hasY = offsets.hasOwnProperty('y');
|
529
|
+
var sideX = left;
|
530
|
+
var sideY = top;
|
531
|
+
var win = window;
|
532
|
+
|
533
|
+
if (adaptive) {
|
534
|
+
var offsetParent = getOffsetParent(popper);
|
535
|
+
var heightProp = 'clientHeight';
|
536
|
+
var widthProp = 'clientWidth';
|
537
|
+
|
538
|
+
if (offsetParent === getWindow(popper)) {
|
539
|
+
offsetParent = getDocumentElement(popper);
|
540
|
+
|
541
|
+
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
542
|
+
heightProp = 'scrollHeight';
|
543
|
+
widthProp = 'scrollWidth';
|
544
|
+
}
|
545
|
+
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
546
|
+
|
547
|
+
|
548
|
+
offsetParent = offsetParent;
|
549
|
+
|
550
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
551
|
+
sideY = bottom;
|
552
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
553
|
+
offsetParent[heightProp];
|
554
|
+
y -= offsetY - popperRect.height;
|
555
|
+
y *= gpuAcceleration ? 1 : -1;
|
556
|
+
}
|
557
|
+
|
558
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
559
|
+
sideX = right;
|
560
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
561
|
+
offsetParent[widthProp];
|
562
|
+
x -= offsetX - popperRect.width;
|
563
|
+
x *= gpuAcceleration ? 1 : -1;
|
564
|
+
}
|
565
|
+
}
|
566
|
+
|
567
|
+
var commonStyles = Object.assign({
|
568
|
+
position: position
|
569
|
+
}, adaptive && unsetSides);
|
570
|
+
|
571
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
572
|
+
x: x,
|
573
|
+
y: y
|
574
|
+
}, getWindow(popper)) : {
|
575
|
+
x: x,
|
576
|
+
y: y
|
577
|
+
};
|
578
|
+
|
579
|
+
x = _ref4.x;
|
580
|
+
y = _ref4.y;
|
581
|
+
|
582
|
+
if (gpuAcceleration) {
|
583
|
+
var _Object$assign;
|
584
|
+
|
585
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
586
|
+
}
|
587
|
+
|
588
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
589
|
+
}
|
590
|
+
|
591
|
+
function computeStyles(_ref5) {
|
592
|
+
var state = _ref5.state,
|
593
|
+
options = _ref5.options;
|
594
|
+
var _options$gpuAccelerat = options.gpuAcceleration,
|
595
|
+
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
596
|
+
_options$adaptive = options.adaptive,
|
597
|
+
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
598
|
+
_options$roundOffsets = options.roundOffsets,
|
599
|
+
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
600
|
+
var commonStyles = {
|
601
|
+
placement: getBasePlacement(state.placement),
|
602
|
+
variation: getVariation(state.placement),
|
603
|
+
popper: state.elements.popper,
|
604
|
+
popperRect: state.rects.popper,
|
605
|
+
gpuAcceleration: gpuAcceleration,
|
606
|
+
isFixed: state.options.strategy === 'fixed'
|
607
|
+
};
|
608
|
+
|
609
|
+
if (state.modifiersData.popperOffsets != null) {
|
610
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
611
|
+
offsets: state.modifiersData.popperOffsets,
|
612
|
+
position: state.options.strategy,
|
613
|
+
adaptive: adaptive,
|
614
|
+
roundOffsets: roundOffsets
|
615
|
+
})));
|
616
|
+
}
|
617
|
+
|
618
|
+
if (state.modifiersData.arrow != null) {
|
619
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
620
|
+
offsets: state.modifiersData.arrow,
|
621
|
+
position: 'absolute',
|
622
|
+
adaptive: false,
|
623
|
+
roundOffsets: roundOffsets
|
624
|
+
})));
|
625
|
+
}
|
626
|
+
|
627
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
628
|
+
'data-popper-placement': state.placement
|
629
|
+
});
|
630
|
+
} // eslint-disable-next-line import/no-unused-modules
|
631
|
+
|
632
|
+
|
633
|
+
const computeStyles$1 = {
|
634
|
+
name: 'computeStyles',
|
635
|
+
enabled: true,
|
636
|
+
phase: 'beforeWrite',
|
637
|
+
fn: computeStyles,
|
638
|
+
data: {}
|
639
|
+
};
|
640
|
+
|
641
|
+
var passive = {
|
642
|
+
passive: true
|
643
|
+
};
|
644
|
+
|
645
|
+
function effect(_ref) {
|
646
|
+
var state = _ref.state,
|
647
|
+
instance = _ref.instance,
|
648
|
+
options = _ref.options;
|
649
|
+
var _options$scroll = options.scroll,
|
650
|
+
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
651
|
+
_options$resize = options.resize,
|
652
|
+
resize = _options$resize === void 0 ? true : _options$resize;
|
653
|
+
var window = getWindow(state.elements.popper);
|
654
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
655
|
+
|
656
|
+
if (scroll) {
|
657
|
+
scrollParents.forEach(function (scrollParent) {
|
658
|
+
scrollParent.addEventListener('scroll', instance.update, passive);
|
659
|
+
});
|
660
|
+
}
|
661
|
+
|
662
|
+
if (resize) {
|
663
|
+
window.addEventListener('resize', instance.update, passive);
|
664
|
+
}
|
665
|
+
|
666
|
+
return function () {
|
667
|
+
if (scroll) {
|
668
|
+
scrollParents.forEach(function (scrollParent) {
|
669
|
+
scrollParent.removeEventListener('scroll', instance.update, passive);
|
670
|
+
});
|
671
|
+
}
|
672
|
+
|
673
|
+
if (resize) {
|
674
|
+
window.removeEventListener('resize', instance.update, passive);
|
675
|
+
}
|
676
|
+
};
|
677
|
+
} // eslint-disable-next-line import/no-unused-modules
|
678
|
+
|
679
|
+
|
680
|
+
const eventListeners = {
|
681
|
+
name: 'eventListeners',
|
682
|
+
enabled: true,
|
683
|
+
phase: 'write',
|
684
|
+
fn: function fn() {},
|
685
|
+
effect: effect,
|
686
|
+
data: {}
|
687
|
+
};
|
688
|
+
|
689
|
+
var hash$1 = {
|
690
|
+
left: 'right',
|
691
|
+
right: 'left',
|
692
|
+
bottom: 'top',
|
693
|
+
top: 'bottom'
|
694
|
+
};
|
695
|
+
function getOppositePlacement(placement) {
|
696
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
697
|
+
return hash$1[matched];
|
698
|
+
});
|
699
|
+
}
|
700
|
+
|
701
|
+
var hash = {
|
702
|
+
start: 'end',
|
703
|
+
end: 'start'
|
704
|
+
};
|
705
|
+
function getOppositeVariationPlacement(placement) {
|
706
|
+
return placement.replace(/start|end/g, function (matched) {
|
707
|
+
return hash[matched];
|
708
|
+
});
|
709
|
+
}
|
710
|
+
|
711
|
+
function getWindowScroll(node) {
|
712
|
+
var win = getWindow(node);
|
713
|
+
var scrollLeft = win.pageXOffset;
|
714
|
+
var scrollTop = win.pageYOffset;
|
715
|
+
return {
|
716
|
+
scrollLeft: scrollLeft,
|
717
|
+
scrollTop: scrollTop
|
718
|
+
};
|
719
|
+
}
|
720
|
+
|
721
|
+
function getWindowScrollBarX(element) {
|
722
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
723
|
+
// incorrect for RTL.
|
724
|
+
// Popper 1 is broken in this case and never had a bug report so let's assume
|
725
|
+
// it's not an issue. I don't think anyone ever specifies width on <html>
|
726
|
+
// anyway.
|
727
|
+
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
728
|
+
// this (e.g. Edge 2019, IE11, Safari)
|
729
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
730
|
+
}
|
731
|
+
|
732
|
+
function getViewportRect(element, strategy) {
|
733
|
+
var win = getWindow(element);
|
734
|
+
var html = getDocumentElement(element);
|
735
|
+
var visualViewport = win.visualViewport;
|
736
|
+
var width = html.clientWidth;
|
737
|
+
var height = html.clientHeight;
|
738
|
+
var x = 0;
|
739
|
+
var y = 0;
|
740
|
+
|
741
|
+
if (visualViewport) {
|
742
|
+
width = visualViewport.width;
|
743
|
+
height = visualViewport.height;
|
744
|
+
var layoutViewport = isLayoutViewport();
|
745
|
+
|
746
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
747
|
+
x = visualViewport.offsetLeft;
|
748
|
+
y = visualViewport.offsetTop;
|
749
|
+
}
|
750
|
+
}
|
751
|
+
|
752
|
+
return {
|
753
|
+
width: width,
|
754
|
+
height: height,
|
755
|
+
x: x + getWindowScrollBarX(element),
|
756
|
+
y: y
|
757
|
+
};
|
758
|
+
}
|
759
|
+
|
760
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
761
|
+
|
762
|
+
function getDocumentRect(element) {
|
763
|
+
var _element$ownerDocumen;
|
764
|
+
|
765
|
+
var html = getDocumentElement(element);
|
766
|
+
var winScroll = getWindowScroll(element);
|
767
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
768
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
769
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
770
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
771
|
+
var y = -winScroll.scrollTop;
|
772
|
+
|
773
|
+
if (getComputedStyle(body || html).direction === 'rtl') {
|
774
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
775
|
+
}
|
776
|
+
|
777
|
+
return {
|
778
|
+
width: width,
|
779
|
+
height: height,
|
780
|
+
x: x,
|
781
|
+
y: y
|
782
|
+
};
|
783
|
+
}
|
784
|
+
|
785
|
+
function isScrollParent(element) {
|
786
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
787
|
+
var _getComputedStyle = getComputedStyle(element),
|
788
|
+
overflow = _getComputedStyle.overflow,
|
789
|
+
overflowX = _getComputedStyle.overflowX,
|
790
|
+
overflowY = _getComputedStyle.overflowY;
|
791
|
+
|
792
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
793
|
+
}
|
794
|
+
|
795
|
+
function getScrollParent(node) {
|
796
|
+
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
797
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
798
|
+
return node.ownerDocument.body;
|
799
|
+
}
|
800
|
+
|
801
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
802
|
+
return node;
|
803
|
+
}
|
804
|
+
|
805
|
+
return getScrollParent(getParentNode(node));
|
806
|
+
}
|
807
|
+
|
808
|
+
/*
|
809
|
+
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
810
|
+
until we get to the top window object. This list is what we attach scroll listeners
|
811
|
+
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
812
|
+
reference element's position.
|
813
|
+
*/
|
814
|
+
|
815
|
+
function listScrollParents(element, list) {
|
816
|
+
var _element$ownerDocumen;
|
817
|
+
|
818
|
+
if (list === void 0) {
|
819
|
+
list = [];
|
820
|
+
}
|
821
|
+
|
822
|
+
var scrollParent = getScrollParent(element);
|
823
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
824
|
+
var win = getWindow(scrollParent);
|
825
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
826
|
+
var updatedList = list.concat(target);
|
827
|
+
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
828
|
+
updatedList.concat(listScrollParents(getParentNode(target)));
|
829
|
+
}
|
830
|
+
|
831
|
+
function rectToClientRect(rect) {
|
832
|
+
return Object.assign({}, rect, {
|
833
|
+
left: rect.x,
|
834
|
+
top: rect.y,
|
835
|
+
right: rect.x + rect.width,
|
836
|
+
bottom: rect.y + rect.height
|
837
|
+
});
|
838
|
+
}
|
839
|
+
|
840
|
+
function getInnerBoundingClientRect(element, strategy) {
|
841
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
842
|
+
rect.top = rect.top + element.clientTop;
|
843
|
+
rect.left = rect.left + element.clientLeft;
|
844
|
+
rect.bottom = rect.top + element.clientHeight;
|
845
|
+
rect.right = rect.left + element.clientWidth;
|
846
|
+
rect.width = element.clientWidth;
|
847
|
+
rect.height = element.clientHeight;
|
848
|
+
rect.x = rect.left;
|
849
|
+
rect.y = rect.top;
|
850
|
+
return rect;
|
851
|
+
}
|
852
|
+
|
853
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
854
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
855
|
+
} // A "clipping parent" is an overflowable container with the characteristic of
|
856
|
+
// clipping (or hiding) overflowing elements with a position different from
|
857
|
+
// `initial`
|
858
|
+
|
859
|
+
|
860
|
+
function getClippingParents(element) {
|
861
|
+
var clippingParents = listScrollParents(getParentNode(element));
|
862
|
+
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
863
|
+
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
864
|
+
|
865
|
+
if (!isElement(clipperElement)) {
|
866
|
+
return [];
|
867
|
+
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
868
|
+
|
869
|
+
|
870
|
+
return clippingParents.filter(function (clippingParent) {
|
871
|
+
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
872
|
+
});
|
873
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
874
|
+
// clipping parents
|
875
|
+
|
876
|
+
|
877
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
878
|
+
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
879
|
+
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
880
|
+
var firstClippingParent = clippingParents[0];
|
881
|
+
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
882
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
883
|
+
accRect.top = max(rect.top, accRect.top);
|
884
|
+
accRect.right = min(rect.right, accRect.right);
|
885
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
886
|
+
accRect.left = max(rect.left, accRect.left);
|
887
|
+
return accRect;
|
888
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
889
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
890
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
891
|
+
clippingRect.x = clippingRect.left;
|
892
|
+
clippingRect.y = clippingRect.top;
|
893
|
+
return clippingRect;
|
894
|
+
}
|
895
|
+
|
896
|
+
function computeOffsets(_ref) {
|
897
|
+
var reference = _ref.reference,
|
898
|
+
element = _ref.element,
|
899
|
+
placement = _ref.placement;
|
900
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
901
|
+
var variation = placement ? getVariation(placement) : null;
|
902
|
+
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
903
|
+
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
904
|
+
var offsets;
|
905
|
+
|
906
|
+
switch (basePlacement) {
|
907
|
+
case top:
|
908
|
+
offsets = {
|
909
|
+
x: commonX,
|
910
|
+
y: reference.y - element.height
|
911
|
+
};
|
912
|
+
break;
|
913
|
+
|
914
|
+
case bottom:
|
915
|
+
offsets = {
|
916
|
+
x: commonX,
|
917
|
+
y: reference.y + reference.height
|
918
|
+
};
|
919
|
+
break;
|
920
|
+
|
921
|
+
case right:
|
922
|
+
offsets = {
|
923
|
+
x: reference.x + reference.width,
|
924
|
+
y: commonY
|
925
|
+
};
|
926
|
+
break;
|
927
|
+
|
928
|
+
case left:
|
929
|
+
offsets = {
|
930
|
+
x: reference.x - element.width,
|
931
|
+
y: commonY
|
932
|
+
};
|
933
|
+
break;
|
934
|
+
|
935
|
+
default:
|
936
|
+
offsets = {
|
937
|
+
x: reference.x,
|
938
|
+
y: reference.y
|
939
|
+
};
|
940
|
+
}
|
941
|
+
|
942
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
943
|
+
|
944
|
+
if (mainAxis != null) {
|
945
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
946
|
+
|
947
|
+
switch (variation) {
|
948
|
+
case start:
|
949
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
950
|
+
break;
|
951
|
+
|
952
|
+
case end:
|
953
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
954
|
+
break;
|
955
|
+
}
|
956
|
+
}
|
957
|
+
|
958
|
+
return offsets;
|
959
|
+
}
|
960
|
+
|
961
|
+
function detectOverflow(state, options) {
|
962
|
+
if (options === void 0) {
|
963
|
+
options = {};
|
964
|
+
}
|
965
|
+
|
966
|
+
var _options = options,
|
967
|
+
_options$placement = _options.placement,
|
968
|
+
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
969
|
+
_options$strategy = _options.strategy,
|
970
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
971
|
+
_options$boundary = _options.boundary,
|
972
|
+
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
973
|
+
_options$rootBoundary = _options.rootBoundary,
|
974
|
+
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
975
|
+
_options$elementConte = _options.elementContext,
|
976
|
+
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
977
|
+
_options$altBoundary = _options.altBoundary,
|
978
|
+
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
979
|
+
_options$padding = _options.padding,
|
980
|
+
padding = _options$padding === void 0 ? 0 : _options$padding;
|
981
|
+
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
982
|
+
var altContext = elementContext === popper ? reference : popper;
|
983
|
+
var popperRect = state.rects.popper;
|
984
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
985
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
986
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
987
|
+
var popperOffsets = computeOffsets({
|
988
|
+
reference: referenceClientRect,
|
989
|
+
element: popperRect,
|
990
|
+
strategy: 'absolute',
|
991
|
+
placement: placement
|
992
|
+
});
|
993
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
994
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
995
|
+
// 0 or negative = within the clipping rect
|
996
|
+
|
997
|
+
var overflowOffsets = {
|
998
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
999
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
1000
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
1001
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
1002
|
+
};
|
1003
|
+
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
1004
|
+
|
1005
|
+
if (elementContext === popper && offsetData) {
|
1006
|
+
var offset = offsetData[placement];
|
1007
|
+
Object.keys(overflowOffsets).forEach(function (key) {
|
1008
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
1009
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
1010
|
+
overflowOffsets[key] += offset[axis] * multiply;
|
1011
|
+
});
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
return overflowOffsets;
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
function computeAutoPlacement(state, options) {
|
1018
|
+
if (options === void 0) {
|
1019
|
+
options = {};
|
1020
|
+
}
|
1021
|
+
|
1022
|
+
var _options = options,
|
1023
|
+
placement = _options.placement,
|
1024
|
+
boundary = _options.boundary,
|
1025
|
+
rootBoundary = _options.rootBoundary,
|
1026
|
+
padding = _options.padding,
|
1027
|
+
flipVariations = _options.flipVariations,
|
1028
|
+
_options$allowedAutoP = _options.allowedAutoPlacements,
|
1029
|
+
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
1030
|
+
var variation = getVariation(placement);
|
1031
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
1032
|
+
return getVariation(placement) === variation;
|
1033
|
+
}) : basePlacements;
|
1034
|
+
var allowedPlacements = placements$1.filter(function (placement) {
|
1035
|
+
return allowedAutoPlacements.indexOf(placement) >= 0;
|
1036
|
+
});
|
1037
|
+
|
1038
|
+
if (allowedPlacements.length === 0) {
|
1039
|
+
allowedPlacements = placements$1;
|
1040
|
+
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
1041
|
+
|
1042
|
+
|
1043
|
+
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
1044
|
+
acc[placement] = detectOverflow(state, {
|
1045
|
+
placement: placement,
|
1046
|
+
boundary: boundary,
|
1047
|
+
rootBoundary: rootBoundary,
|
1048
|
+
padding: padding
|
1049
|
+
})[getBasePlacement(placement)];
|
1050
|
+
return acc;
|
1051
|
+
}, {});
|
1052
|
+
return Object.keys(overflows).sort(function (a, b) {
|
1053
|
+
return overflows[a] - overflows[b];
|
1054
|
+
});
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
function getExpandedFallbackPlacements(placement) {
|
1058
|
+
if (getBasePlacement(placement) === auto) {
|
1059
|
+
return [];
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
var oppositePlacement = getOppositePlacement(placement);
|
1063
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
function flip(_ref) {
|
1067
|
+
var state = _ref.state,
|
1068
|
+
options = _ref.options,
|
1069
|
+
name = _ref.name;
|
1070
|
+
|
1071
|
+
if (state.modifiersData[name]._skip) {
|
1072
|
+
return;
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
var _options$mainAxis = options.mainAxis,
|
1076
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
1077
|
+
_options$altAxis = options.altAxis,
|
1078
|
+
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
1079
|
+
specifiedFallbackPlacements = options.fallbackPlacements,
|
1080
|
+
padding = options.padding,
|
1081
|
+
boundary = options.boundary,
|
1082
|
+
rootBoundary = options.rootBoundary,
|
1083
|
+
altBoundary = options.altBoundary,
|
1084
|
+
_options$flipVariatio = options.flipVariations,
|
1085
|
+
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
1086
|
+
allowedAutoPlacements = options.allowedAutoPlacements;
|
1087
|
+
var preferredPlacement = state.options.placement;
|
1088
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
1089
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
1090
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
1091
|
+
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
1092
|
+
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
1093
|
+
placement: placement,
|
1094
|
+
boundary: boundary,
|
1095
|
+
rootBoundary: rootBoundary,
|
1096
|
+
padding: padding,
|
1097
|
+
flipVariations: flipVariations,
|
1098
|
+
allowedAutoPlacements: allowedAutoPlacements
|
1099
|
+
}) : placement);
|
1100
|
+
}, []);
|
1101
|
+
var referenceRect = state.rects.reference;
|
1102
|
+
var popperRect = state.rects.popper;
|
1103
|
+
var checksMap = new Map();
|
1104
|
+
var makeFallbackChecks = true;
|
1105
|
+
var firstFittingPlacement = placements[0];
|
1106
|
+
|
1107
|
+
for (var i = 0; i < placements.length; i++) {
|
1108
|
+
var placement = placements[i];
|
1109
|
+
|
1110
|
+
var _basePlacement = getBasePlacement(placement);
|
1111
|
+
|
1112
|
+
var isStartVariation = getVariation(placement) === start;
|
1113
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
1114
|
+
var len = isVertical ? 'width' : 'height';
|
1115
|
+
var overflow = detectOverflow(state, {
|
1116
|
+
placement: placement,
|
1117
|
+
boundary: boundary,
|
1118
|
+
rootBoundary: rootBoundary,
|
1119
|
+
altBoundary: altBoundary,
|
1120
|
+
padding: padding
|
1121
|
+
});
|
1122
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
1123
|
+
|
1124
|
+
if (referenceRect[len] > popperRect[len]) {
|
1125
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
1129
|
+
var checks = [];
|
1130
|
+
|
1131
|
+
if (checkMainAxis) {
|
1132
|
+
checks.push(overflow[_basePlacement] <= 0);
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
if (checkAltAxis) {
|
1136
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
if (checks.every(function (check) {
|
1140
|
+
return check;
|
1141
|
+
})) {
|
1142
|
+
firstFittingPlacement = placement;
|
1143
|
+
makeFallbackChecks = false;
|
1144
|
+
break;
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
checksMap.set(placement, checks);
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
if (makeFallbackChecks) {
|
1151
|
+
// `2` may be desired in some cases – research later
|
1152
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
1153
|
+
|
1154
|
+
var _loop = function _loop(_i) {
|
1155
|
+
var fittingPlacement = placements.find(function (placement) {
|
1156
|
+
var checks = checksMap.get(placement);
|
1157
|
+
|
1158
|
+
if (checks) {
|
1159
|
+
return checks.slice(0, _i).every(function (check) {
|
1160
|
+
return check;
|
1161
|
+
});
|
1162
|
+
}
|
1163
|
+
});
|
1164
|
+
|
1165
|
+
if (fittingPlacement) {
|
1166
|
+
firstFittingPlacement = fittingPlacement;
|
1167
|
+
return "break";
|
1168
|
+
}
|
1169
|
+
};
|
1170
|
+
|
1171
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
1172
|
+
var _ret = _loop(_i);
|
1173
|
+
|
1174
|
+
if (_ret === "break") break;
|
1175
|
+
}
|
1176
|
+
}
|
1177
|
+
|
1178
|
+
if (state.placement !== firstFittingPlacement) {
|
1179
|
+
state.modifiersData[name]._skip = true;
|
1180
|
+
state.placement = firstFittingPlacement;
|
1181
|
+
state.reset = true;
|
1182
|
+
}
|
1183
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1184
|
+
|
1185
|
+
|
1186
|
+
const flip$1 = {
|
1187
|
+
name: 'flip',
|
1188
|
+
enabled: true,
|
1189
|
+
phase: 'main',
|
1190
|
+
fn: flip,
|
1191
|
+
requiresIfExists: ['offset'],
|
1192
|
+
data: {
|
1193
|
+
_skip: false
|
1194
|
+
}
|
1195
|
+
};
|
1196
|
+
|
1197
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
1198
|
+
if (preventedOffsets === void 0) {
|
1199
|
+
preventedOffsets = {
|
1200
|
+
x: 0,
|
1201
|
+
y: 0
|
1202
|
+
};
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
return {
|
1206
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
1207
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
1208
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
1209
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
1210
|
+
};
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
function isAnySideFullyClipped(overflow) {
|
1214
|
+
return [top, right, bottom, left].some(function (side) {
|
1215
|
+
return overflow[side] >= 0;
|
1216
|
+
});
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
function hide(_ref) {
|
1220
|
+
var state = _ref.state,
|
1221
|
+
name = _ref.name;
|
1222
|
+
var referenceRect = state.rects.reference;
|
1223
|
+
var popperRect = state.rects.popper;
|
1224
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
1225
|
+
var referenceOverflow = detectOverflow(state, {
|
1226
|
+
elementContext: 'reference'
|
1227
|
+
});
|
1228
|
+
var popperAltOverflow = detectOverflow(state, {
|
1229
|
+
altBoundary: true
|
1230
|
+
});
|
1231
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
1232
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
1233
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
1234
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
1235
|
+
state.modifiersData[name] = {
|
1236
|
+
referenceClippingOffsets: referenceClippingOffsets,
|
1237
|
+
popperEscapeOffsets: popperEscapeOffsets,
|
1238
|
+
isReferenceHidden: isReferenceHidden,
|
1239
|
+
hasPopperEscaped: hasPopperEscaped
|
1240
|
+
};
|
1241
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
1242
|
+
'data-popper-reference-hidden': isReferenceHidden,
|
1243
|
+
'data-popper-escaped': hasPopperEscaped
|
1244
|
+
});
|
1245
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1246
|
+
|
1247
|
+
|
1248
|
+
const hide$1 = {
|
1249
|
+
name: 'hide',
|
1250
|
+
enabled: true,
|
1251
|
+
phase: 'main',
|
1252
|
+
requiresIfExists: ['preventOverflow'],
|
1253
|
+
fn: hide
|
1254
|
+
};
|
1255
|
+
|
1256
|
+
function distanceAndSkiddingToXY(placement, rects, offset) {
|
1257
|
+
var basePlacement = getBasePlacement(placement);
|
1258
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
1259
|
+
|
1260
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
1261
|
+
placement: placement
|
1262
|
+
})) : offset,
|
1263
|
+
skidding = _ref[0],
|
1264
|
+
distance = _ref[1];
|
1265
|
+
|
1266
|
+
skidding = skidding || 0;
|
1267
|
+
distance = (distance || 0) * invertDistance;
|
1268
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
1269
|
+
x: distance,
|
1270
|
+
y: skidding
|
1271
|
+
} : {
|
1272
|
+
x: skidding,
|
1273
|
+
y: distance
|
1274
|
+
};
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
function offset(_ref2) {
|
1278
|
+
var state = _ref2.state,
|
1279
|
+
options = _ref2.options,
|
1280
|
+
name = _ref2.name;
|
1281
|
+
var _options$offset = options.offset,
|
1282
|
+
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
1283
|
+
var data = placements.reduce(function (acc, placement) {
|
1284
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
1285
|
+
return acc;
|
1286
|
+
}, {});
|
1287
|
+
var _data$state$placement = data[state.placement],
|
1288
|
+
x = _data$state$placement.x,
|
1289
|
+
y = _data$state$placement.y;
|
1290
|
+
|
1291
|
+
if (state.modifiersData.popperOffsets != null) {
|
1292
|
+
state.modifiersData.popperOffsets.x += x;
|
1293
|
+
state.modifiersData.popperOffsets.y += y;
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
state.modifiersData[name] = data;
|
1297
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1298
|
+
|
1299
|
+
|
1300
|
+
const offset$1 = {
|
1301
|
+
name: 'offset',
|
1302
|
+
enabled: true,
|
1303
|
+
phase: 'main',
|
1304
|
+
requires: ['popperOffsets'],
|
1305
|
+
fn: offset
|
1306
|
+
};
|
1307
|
+
|
1308
|
+
function popperOffsets(_ref) {
|
1309
|
+
var state = _ref.state,
|
1310
|
+
name = _ref.name;
|
1311
|
+
// Offsets are the actual position the popper needs to have to be
|
1312
|
+
// properly positioned near its reference element
|
1313
|
+
// This is the most basic placement, and will be adjusted by
|
1314
|
+
// the modifiers in the next step
|
1315
|
+
state.modifiersData[name] = computeOffsets({
|
1316
|
+
reference: state.rects.reference,
|
1317
|
+
element: state.rects.popper,
|
1318
|
+
strategy: 'absolute',
|
1319
|
+
placement: state.placement
|
1320
|
+
});
|
1321
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1322
|
+
|
1323
|
+
|
1324
|
+
const popperOffsets$1 = {
|
1325
|
+
name: 'popperOffsets',
|
1326
|
+
enabled: true,
|
1327
|
+
phase: 'read',
|
1328
|
+
fn: popperOffsets,
|
1329
|
+
data: {}
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
function getAltAxis(axis) {
|
1333
|
+
return axis === 'x' ? 'y' : 'x';
|
1334
|
+
}
|
1335
|
+
|
1336
|
+
function preventOverflow(_ref) {
|
1337
|
+
var state = _ref.state,
|
1338
|
+
options = _ref.options,
|
1339
|
+
name = _ref.name;
|
1340
|
+
var _options$mainAxis = options.mainAxis,
|
1341
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
1342
|
+
_options$altAxis = options.altAxis,
|
1343
|
+
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
1344
|
+
boundary = options.boundary,
|
1345
|
+
rootBoundary = options.rootBoundary,
|
1346
|
+
altBoundary = options.altBoundary,
|
1347
|
+
padding = options.padding,
|
1348
|
+
_options$tether = options.tether,
|
1349
|
+
tether = _options$tether === void 0 ? true : _options$tether,
|
1350
|
+
_options$tetherOffset = options.tetherOffset,
|
1351
|
+
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
1352
|
+
var overflow = detectOverflow(state, {
|
1353
|
+
boundary: boundary,
|
1354
|
+
rootBoundary: rootBoundary,
|
1355
|
+
padding: padding,
|
1356
|
+
altBoundary: altBoundary
|
1357
|
+
});
|
1358
|
+
var basePlacement = getBasePlacement(state.placement);
|
1359
|
+
var variation = getVariation(state.placement);
|
1360
|
+
var isBasePlacement = !variation;
|
1361
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
1362
|
+
var altAxis = getAltAxis(mainAxis);
|
1363
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
1364
|
+
var referenceRect = state.rects.reference;
|
1365
|
+
var popperRect = state.rects.popper;
|
1366
|
+
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
1367
|
+
placement: state.placement
|
1368
|
+
})) : tetherOffset;
|
1369
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
1370
|
+
mainAxis: tetherOffsetValue,
|
1371
|
+
altAxis: tetherOffsetValue
|
1372
|
+
} : Object.assign({
|
1373
|
+
mainAxis: 0,
|
1374
|
+
altAxis: 0
|
1375
|
+
}, tetherOffsetValue);
|
1376
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
1377
|
+
var data = {
|
1378
|
+
x: 0,
|
1379
|
+
y: 0
|
1380
|
+
};
|
1381
|
+
|
1382
|
+
if (!popperOffsets) {
|
1383
|
+
return;
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
if (checkMainAxis) {
|
1387
|
+
var _offsetModifierState$;
|
1388
|
+
|
1389
|
+
var mainSide = mainAxis === 'y' ? top : left;
|
1390
|
+
var altSide = mainAxis === 'y' ? bottom : right;
|
1391
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
1392
|
+
var offset = popperOffsets[mainAxis];
|
1393
|
+
var min$1 = offset + overflow[mainSide];
|
1394
|
+
var max$1 = offset - overflow[altSide];
|
1395
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
1396
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
1397
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
1398
|
+
// outside the reference bounds
|
1399
|
+
|
1400
|
+
var arrowElement = state.elements.arrow;
|
1401
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
1402
|
+
width: 0,
|
1403
|
+
height: 0
|
1404
|
+
};
|
1405
|
+
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
1406
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
1407
|
+
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
1408
|
+
// to include its full size in the calculation. If the reference is small
|
1409
|
+
// and near the edge of a boundary, the popper can overflow even if the
|
1410
|
+
// reference is not overflowing as well (e.g. virtual elements with no
|
1411
|
+
// width or height)
|
1412
|
+
|
1413
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
1414
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
1415
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
1416
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
1417
|
+
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
1418
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
1419
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
1420
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
1421
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
1422
|
+
popperOffsets[mainAxis] = preventedOffset;
|
1423
|
+
data[mainAxis] = preventedOffset - offset;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
if (checkAltAxis) {
|
1427
|
+
var _offsetModifierState$2;
|
1428
|
+
|
1429
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
1430
|
+
|
1431
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
1432
|
+
|
1433
|
+
var _offset = popperOffsets[altAxis];
|
1434
|
+
|
1435
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
1436
|
+
|
1437
|
+
var _min = _offset + overflow[_mainSide];
|
1438
|
+
|
1439
|
+
var _max = _offset - overflow[_altSide];
|
1440
|
+
|
1441
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
1442
|
+
|
1443
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
1444
|
+
|
1445
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
1446
|
+
|
1447
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
1448
|
+
|
1449
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
1450
|
+
|
1451
|
+
popperOffsets[altAxis] = _preventedOffset;
|
1452
|
+
data[altAxis] = _preventedOffset - _offset;
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
state.modifiersData[name] = data;
|
1456
|
+
} // eslint-disable-next-line import/no-unused-modules
|
1457
|
+
|
1458
|
+
|
1459
|
+
const preventOverflow$1 = {
|
1460
|
+
name: 'preventOverflow',
|
1461
|
+
enabled: true,
|
1462
|
+
phase: 'main',
|
1463
|
+
fn: preventOverflow,
|
1464
|
+
requiresIfExists: ['offset']
|
1465
|
+
};
|
1466
|
+
|
1467
|
+
function getHTMLElementScroll(element) {
|
1468
|
+
return {
|
1469
|
+
scrollLeft: element.scrollLeft,
|
1470
|
+
scrollTop: element.scrollTop
|
1471
|
+
};
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
function getNodeScroll(node) {
|
1475
|
+
if (node === getWindow(node) || !isHTMLElement(node)) {
|
1476
|
+
return getWindowScroll(node);
|
1477
|
+
} else {
|
1478
|
+
return getHTMLElementScroll(node);
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
function isElementScaled(element) {
|
1483
|
+
var rect = element.getBoundingClientRect();
|
1484
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
1485
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
1486
|
+
return scaleX !== 1 || scaleY !== 1;
|
1487
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
1488
|
+
// Composite means it takes into account transforms as well as layout.
|
1489
|
+
|
1490
|
+
|
1491
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
1492
|
+
if (isFixed === void 0) {
|
1493
|
+
isFixed = false;
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
1497
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
1498
|
+
var documentElement = getDocumentElement(offsetParent);
|
1499
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
1500
|
+
var scroll = {
|
1501
|
+
scrollLeft: 0,
|
1502
|
+
scrollTop: 0
|
1503
|
+
};
|
1504
|
+
var offsets = {
|
1505
|
+
x: 0,
|
1506
|
+
y: 0
|
1507
|
+
};
|
1508
|
+
|
1509
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
1510
|
+
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
1511
|
+
isScrollParent(documentElement)) {
|
1512
|
+
scroll = getNodeScroll(offsetParent);
|
1513
|
+
}
|
1514
|
+
|
1515
|
+
if (isHTMLElement(offsetParent)) {
|
1516
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
1517
|
+
offsets.x += offsetParent.clientLeft;
|
1518
|
+
offsets.y += offsetParent.clientTop;
|
1519
|
+
} else if (documentElement) {
|
1520
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
1521
|
+
}
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
return {
|
1525
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
1526
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
1527
|
+
width: rect.width,
|
1528
|
+
height: rect.height
|
1529
|
+
};
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
function order(modifiers) {
|
1533
|
+
var map = new Map();
|
1534
|
+
var visited = new Set();
|
1535
|
+
var result = [];
|
1536
|
+
modifiers.forEach(function (modifier) {
|
1537
|
+
map.set(modifier.name, modifier);
|
1538
|
+
}); // On visiting object, check for its dependencies and visit them recursively
|
1539
|
+
|
1540
|
+
function sort(modifier) {
|
1541
|
+
visited.add(modifier.name);
|
1542
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
1543
|
+
requires.forEach(function (dep) {
|
1544
|
+
if (!visited.has(dep)) {
|
1545
|
+
var depModifier = map.get(dep);
|
1546
|
+
|
1547
|
+
if (depModifier) {
|
1548
|
+
sort(depModifier);
|
1549
|
+
}
|
1550
|
+
}
|
1551
|
+
});
|
1552
|
+
result.push(modifier);
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
modifiers.forEach(function (modifier) {
|
1556
|
+
if (!visited.has(modifier.name)) {
|
1557
|
+
// check for visited object
|
1558
|
+
sort(modifier);
|
1559
|
+
}
|
1560
|
+
});
|
1561
|
+
return result;
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
function orderModifiers(modifiers) {
|
1565
|
+
// order based on dependencies
|
1566
|
+
var orderedModifiers = order(modifiers); // order based on phase
|
1567
|
+
|
1568
|
+
return modifierPhases.reduce(function (acc, phase) {
|
1569
|
+
return acc.concat(orderedModifiers.filter(function (modifier) {
|
1570
|
+
return modifier.phase === phase;
|
1571
|
+
}));
|
1572
|
+
}, []);
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
function debounce(fn) {
|
1576
|
+
var pending;
|
1577
|
+
return function () {
|
1578
|
+
if (!pending) {
|
1579
|
+
pending = new Promise(function (resolve) {
|
1580
|
+
Promise.resolve().then(function () {
|
1581
|
+
pending = undefined;
|
1582
|
+
resolve(fn());
|
1583
|
+
});
|
1584
|
+
});
|
1585
|
+
}
|
1586
|
+
|
1587
|
+
return pending;
|
1588
|
+
};
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
function mergeByName(modifiers) {
|
1592
|
+
var merged = modifiers.reduce(function (merged, current) {
|
1593
|
+
var existing = merged[current.name];
|
1594
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
1595
|
+
options: Object.assign({}, existing.options, current.options),
|
1596
|
+
data: Object.assign({}, existing.data, current.data)
|
1597
|
+
}) : current;
|
1598
|
+
return merged;
|
1599
|
+
}, {}); // IE11 does not support Object.values
|
1600
|
+
|
1601
|
+
return Object.keys(merged).map(function (key) {
|
1602
|
+
return merged[key];
|
1603
|
+
});
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
var DEFAULT_OPTIONS = {
|
1607
|
+
placement: 'bottom',
|
1608
|
+
modifiers: [],
|
1609
|
+
strategy: 'absolute'
|
1610
|
+
};
|
1611
|
+
|
1612
|
+
function areValidElements() {
|
1613
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
1614
|
+
args[_key] = arguments[_key];
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
return !args.some(function (element) {
|
1618
|
+
return !(element && typeof element.getBoundingClientRect === 'function');
|
1619
|
+
});
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
function popperGenerator(generatorOptions) {
|
1623
|
+
if (generatorOptions === void 0) {
|
1624
|
+
generatorOptions = {};
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
var _generatorOptions = generatorOptions,
|
1628
|
+
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
1629
|
+
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
1630
|
+
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
1631
|
+
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
1632
|
+
return function createPopper(reference, popper, options) {
|
1633
|
+
if (options === void 0) {
|
1634
|
+
options = defaultOptions;
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
var state = {
|
1638
|
+
placement: 'bottom',
|
1639
|
+
orderedModifiers: [],
|
1640
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
1641
|
+
modifiersData: {},
|
1642
|
+
elements: {
|
1643
|
+
reference: reference,
|
1644
|
+
popper: popper
|
1645
|
+
},
|
1646
|
+
attributes: {},
|
1647
|
+
styles: {}
|
1648
|
+
};
|
1649
|
+
var effectCleanupFns = [];
|
1650
|
+
var isDestroyed = false;
|
1651
|
+
var instance = {
|
1652
|
+
state: state,
|
1653
|
+
setOptions: function setOptions(setOptionsAction) {
|
1654
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
1655
|
+
cleanupModifierEffects();
|
1656
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
1657
|
+
state.scrollParents = {
|
1658
|
+
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
1659
|
+
popper: listScrollParents(popper)
|
1660
|
+
}; // Orders the modifiers based on their dependencies and `phase`
|
1661
|
+
// properties
|
1662
|
+
|
1663
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
1664
|
+
|
1665
|
+
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
1666
|
+
return m.enabled;
|
1667
|
+
});
|
1668
|
+
runModifierEffects();
|
1669
|
+
return instance.update();
|
1670
|
+
},
|
1671
|
+
// Sync update – it will always be executed, even if not necessary. This
|
1672
|
+
// is useful for low frequency updates where sync behavior simplifies the
|
1673
|
+
// logic.
|
1674
|
+
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
1675
|
+
// prefer the async Popper#update method
|
1676
|
+
forceUpdate: function forceUpdate() {
|
1677
|
+
if (isDestroyed) {
|
1678
|
+
return;
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
var _state$elements = state.elements,
|
1682
|
+
reference = _state$elements.reference,
|
1683
|
+
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
1684
|
+
// anymore
|
1685
|
+
|
1686
|
+
if (!areValidElements(reference, popper)) {
|
1687
|
+
return;
|
1688
|
+
} // Store the reference and popper rects to be read by modifiers
|
1689
|
+
|
1690
|
+
|
1691
|
+
state.rects = {
|
1692
|
+
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
1693
|
+
popper: getLayoutRect(popper)
|
1694
|
+
}; // Modifiers have the ability to reset the current update cycle. The
|
1695
|
+
// most common use case for this is the `flip` modifier changing the
|
1696
|
+
// placement, which then needs to re-run all the modifiers, because the
|
1697
|
+
// logic was previously ran for the previous placement and is therefore
|
1698
|
+
// stale/incorrect
|
1699
|
+
|
1700
|
+
state.reset = false;
|
1701
|
+
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
1702
|
+
// is filled with the initial data specified by the modifier. This means
|
1703
|
+
// it doesn't persist and is fresh on each update.
|
1704
|
+
// To ensure persistent data, use `${name}#persistent`
|
1705
|
+
|
1706
|
+
state.orderedModifiers.forEach(function (modifier) {
|
1707
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
1708
|
+
});
|
1709
|
+
|
1710
|
+
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
1711
|
+
if (state.reset === true) {
|
1712
|
+
state.reset = false;
|
1713
|
+
index = -1;
|
1714
|
+
continue;
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
var _state$orderedModifie = state.orderedModifiers[index],
|
1718
|
+
fn = _state$orderedModifie.fn,
|
1719
|
+
_state$orderedModifie2 = _state$orderedModifie.options,
|
1720
|
+
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
1721
|
+
name = _state$orderedModifie.name;
|
1722
|
+
|
1723
|
+
if (typeof fn === 'function') {
|
1724
|
+
state = fn({
|
1725
|
+
state: state,
|
1726
|
+
options: _options,
|
1727
|
+
name: name,
|
1728
|
+
instance: instance
|
1729
|
+
}) || state;
|
1730
|
+
}
|
1731
|
+
}
|
1732
|
+
},
|
1733
|
+
// Async and optimistically optimized update – it will not be executed if
|
1734
|
+
// not necessary (debounced to run at most once-per-tick)
|
1735
|
+
update: debounce(function () {
|
1736
|
+
return new Promise(function (resolve) {
|
1737
|
+
instance.forceUpdate();
|
1738
|
+
resolve(state);
|
1739
|
+
});
|
1740
|
+
}),
|
1741
|
+
destroy: function destroy() {
|
1742
|
+
cleanupModifierEffects();
|
1743
|
+
isDestroyed = true;
|
1744
|
+
}
|
1745
|
+
};
|
1746
|
+
|
1747
|
+
if (!areValidElements(reference, popper)) {
|
1748
|
+
return instance;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
instance.setOptions(options).then(function (state) {
|
1752
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
1753
|
+
options.onFirstUpdate(state);
|
1754
|
+
}
|
1755
|
+
}); // Modifiers have the ability to execute arbitrary code before the first
|
1756
|
+
// update cycle runs. They will be executed in the same order as the update
|
1757
|
+
// cycle. This is useful when a modifier adds some persistent data that
|
1758
|
+
// other modifiers need to use, but the modifier is run after the dependent
|
1759
|
+
// one.
|
1760
|
+
|
1761
|
+
function runModifierEffects() {
|
1762
|
+
state.orderedModifiers.forEach(function (_ref) {
|
1763
|
+
var name = _ref.name,
|
1764
|
+
_ref$options = _ref.options,
|
1765
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
1766
|
+
effect = _ref.effect;
|
1767
|
+
|
1768
|
+
if (typeof effect === 'function') {
|
1769
|
+
var cleanupFn = effect({
|
1770
|
+
state: state,
|
1771
|
+
name: name,
|
1772
|
+
instance: instance,
|
1773
|
+
options: options
|
1774
|
+
});
|
1775
|
+
|
1776
|
+
var noopFn = function noopFn() {};
|
1777
|
+
|
1778
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
1779
|
+
}
|
1780
|
+
});
|
1781
|
+
}
|
1782
|
+
|
1783
|
+
function cleanupModifierEffects() {
|
1784
|
+
effectCleanupFns.forEach(function (fn) {
|
1785
|
+
return fn();
|
1786
|
+
});
|
1787
|
+
effectCleanupFns = [];
|
1788
|
+
}
|
1789
|
+
|
1790
|
+
return instance;
|
1791
|
+
};
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
1795
|
+
var createPopper = /*#__PURE__*/popperGenerator({
|
1796
|
+
defaultModifiers: defaultModifiers
|
1797
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
1798
|
+
|
1799
|
+
const Check = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
1800
|
+
<path d="M8.79502 15.875L4.62502 11.705L3.20502 13.115L8.79502 18.705L20.795 6.70501L19.385 5.29501L8.79502 15.875Z" fill="currentColor"/>
|
1801
|
+
</svg>
|
1802
|
+
`;
|
1803
|
+
|
1804
|
+
const icMenuCss = "html.sc-ic-menu-with-multi{line-height:1.15;-webkit-text-size-adjust:100%}body.sc-ic-menu-with-multi{margin:0}main.sc-ic-menu-with-multi{display:block}h1.sc-ic-menu-with-multi{font-size:2em;margin:0.67em 0}hr.sc-ic-menu-with-multi{box-sizing:content-box;height:0;overflow:visible}pre.sc-ic-menu-with-multi{font-family:monospace, monospace;font-size:1em}a.sc-ic-menu-with-multi{background-color:transparent}abbr[title].sc-ic-menu-with-multi{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b.sc-ic-menu-with-multi,strong.sc-ic-menu-with-multi{font-weight:bolder}code.sc-ic-menu-with-multi,kbd.sc-ic-menu-with-multi,samp.sc-ic-menu-with-multi{font-family:monospace, monospace;font-size:1em}small.sc-ic-menu-with-multi{font-size:80%}sub.sc-ic-menu-with-multi,sup.sc-ic-menu-with-multi{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub.sc-ic-menu-with-multi{bottom:-0.25em}sup.sc-ic-menu-with-multi{top:-0.5em}img.sc-ic-menu-with-multi{border-style:none}button.sc-ic-menu-with-multi,input.sc-ic-menu-with-multi,optgroup.sc-ic-menu-with-multi,select.sc-ic-menu-with-multi,textarea.sc-ic-menu-with-multi{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button.sc-ic-menu-with-multi,input.sc-ic-menu-with-multi{overflow:visible}button.sc-ic-menu-with-multi,select.sc-ic-menu-with-multi{text-transform:none}button.sc-ic-menu-with-multi,[type=\"button\"].sc-ic-menu-with-multi,[type=\"reset\"].sc-ic-menu-with-multi,[type=\"submit\"].sc-ic-menu-with-multi{-webkit-appearance:button}button.sc-ic-menu-with-multi::-moz-focus-inner,[type=\"button\"].sc-ic-menu-with-multi::-moz-focus-inner,[type=\"reset\"].sc-ic-menu-with-multi::-moz-focus-inner,[type=\"submit\"].sc-ic-menu-with-multi::-moz-focus-inner{border-style:none;padding:0}button.sc-ic-menu-with-multi:-moz-focusring,[type=\"button\"].sc-ic-menu-with-multi:-moz-focusring,[type=\"reset\"].sc-ic-menu-with-multi:-moz-focusring,[type=\"submit\"].sc-ic-menu-with-multi:-moz-focusring{outline:1px dotted ButtonText}fieldset.sc-ic-menu-with-multi{padding:0.35em 0.75em 0.625em}legend.sc-ic-menu-with-multi{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress.sc-ic-menu-with-multi{vertical-align:baseline}textarea.sc-ic-menu-with-multi{overflow:auto}[type=\"checkbox\"].sc-ic-menu-with-multi,[type=\"radio\"].sc-ic-menu-with-multi{box-sizing:border-box;padding:0}[type=\"number\"].sc-ic-menu-with-multi::-webkit-inner-spin-button,[type=\"number\"].sc-ic-menu-with-multi::-webkit-outer-spin-button{height:auto}[type=\"search\"].sc-ic-menu-with-multi{-webkit-appearance:textfield;outline-offset:-2px}[type=\"search\"].sc-ic-menu-with-multi::-webkit-search-decoration{-webkit-appearance:none}.sc-ic-menu-with-multi::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details.sc-ic-menu-with-multi{display:block}summary.sc-ic-menu-with-multi{display:list-item}template.sc-ic-menu-with-multi{display:none}[hidden].sc-ic-menu-with-multi{display:none}html.sc-ic-menu-with-multi,body.sc-ic-menu-with-multi,div.sc-ic-menu-with-multi,span.sc-ic-menu-with-multi,applet.sc-ic-menu-with-multi,object.sc-ic-menu-with-multi,iframe.sc-ic-menu-with-multi,h1.sc-ic-menu-with-multi,h2.sc-ic-menu-with-multi,h3.sc-ic-menu-with-multi,h4.sc-ic-menu-with-multi,h5.sc-ic-menu-with-multi,h6.sc-ic-menu-with-multi,p.sc-ic-menu-with-multi,blockquote.sc-ic-menu-with-multi,pre.sc-ic-menu-with-multi,a.sc-ic-menu-with-multi,abbr.sc-ic-menu-with-multi,acronym.sc-ic-menu-with-multi,address.sc-ic-menu-with-multi,big.sc-ic-menu-with-multi,cite.sc-ic-menu-with-multi,code.sc-ic-menu-with-multi,del.sc-ic-menu-with-multi,dfn.sc-ic-menu-with-multi,em.sc-ic-menu-with-multi,img.sc-ic-menu-with-multi,ins.sc-ic-menu-with-multi,kbd.sc-ic-menu-with-multi,q.sc-ic-menu-with-multi,s.sc-ic-menu-with-multi,samp.sc-ic-menu-with-multi,small.sc-ic-menu-with-multi,strike.sc-ic-menu-with-multi,strong.sc-ic-menu-with-multi,sub.sc-ic-menu-with-multi,sup.sc-ic-menu-with-multi,tt.sc-ic-menu-with-multi,var.sc-ic-menu-with-multi,b.sc-ic-menu-with-multi,u.sc-ic-menu-with-multi,i.sc-ic-menu-with-multi,center.sc-ic-menu-with-multi,dl.sc-ic-menu-with-multi,dt.sc-ic-menu-with-multi,dd.sc-ic-menu-with-multi,ol.sc-ic-menu-with-multi,ul.sc-ic-menu-with-multi,li.sc-ic-menu-with-multi,fieldset.sc-ic-menu-with-multi,form.sc-ic-menu-with-multi,label.sc-ic-menu-with-multi,legend.sc-ic-menu-with-multi,table.sc-ic-menu-with-multi,caption.sc-ic-menu-with-multi,tbody.sc-ic-menu-with-multi,tfoot.sc-ic-menu-with-multi,thead.sc-ic-menu-with-multi,tr.sc-ic-menu-with-multi,th.sc-ic-menu-with-multi,td.sc-ic-menu-with-multi,article.sc-ic-menu-with-multi,aside.sc-ic-menu-with-multi,canvas.sc-ic-menu-with-multi,details.sc-ic-menu-with-multi,embed.sc-ic-menu-with-multi,figure.sc-ic-menu-with-multi,figcaption.sc-ic-menu-with-multi,footer.sc-ic-menu-with-multi,header.sc-ic-menu-with-multi,hgroup.sc-ic-menu-with-multi,menu.sc-ic-menu-with-multi,nav.sc-ic-menu-with-multi,output.sc-ic-menu-with-multi,ruby.sc-ic-menu-with-multi,section.sc-ic-menu-with-multi,summary.sc-ic-menu-with-multi,time.sc-ic-menu-with-multi,mark.sc-ic-menu-with-multi,audio.sc-ic-menu-with-multi,video.sc-ic-menu-with-multi{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}@media (prefers-reduced-motion: no-preference){.open.sc-ic-menu-with-multi-h .menu.sc-ic-menu-with-multi{transition:max-height var(--ic-transition-duration-slow)}}.sc-ic-menu-with-multi-h{max-height:0;width:var(--menu-width, var(--input-width, 20rem));min-width:20rem;color:var(--ic-color-primary-text);background-color:var(--ic-architectural-white);position:relative;z-index:var(--ic-z-index-menu);box-sizing:border-box;box-shadow:var(--ic-elevation-overlay);border-radius:var(--ic-border-radius)}.open.sc-ic-menu-with-multi-h:not(.no-focus):focus-within{box-shadow:var(--ic-border-focus);outline:var(--ic-hc-focus-outline)}.select-all-focused.sc-ic-menu-with-multi-h{box-shadow:var(--ic-elevation-overlay) !important}#retry-button.sc-ic-menu-with-multi::part(button){height:var(--ic-space-lg)}.small.sc-ic-menu-with-multi #retry-button.sc-ic-menu-with-multi::part(button){height:var(--ic-space-md)}.on-dialog.sc-ic-menu-with-multi-h{inset:auto !important}.menu.sc-ic-menu-with-multi{text-decoration:none;list-style-type:none;border-radius:1px;background-color:var(--ic-architectural-white);visibility:hidden;max-height:0;overflow-y:hidden}.menu.sc-ic-menu-with-multi:has(+.option-bar).sc-ic-menu-with-multi{border-radius:0 0 1px 1px}.menu-scroll.sc-ic-menu-with-multi{overflow-y:auto}.menu.sc-ic-menu-with-multi:focus-visible{outline:none}.open.sc-ic-menu-with-multi-h{max-height:none;display:flex;flex-direction:column-reverse;border:var(--ic-border-width) solid var(--ic-architectural-400);transition:box-shadow var(--ic-easing-transition-fast)}.open.sc-ic-menu-with-multi-h .menu.sc-ic-menu-with-multi{visibility:visible;max-height:calc(var(--ic-space-xl) * 10 + var(--ic-space-xxxs))}.open.sc-ic-menu-with-multi-h .option-bar.sc-ic-menu-with-multi{visibility:visible}.open.sc-ic-menu-with-multi-h .select-all-button.sc-ic-menu-with-multi{display:block}.full-width.sc-ic-menu-with-multi-h{width:100%}.option.sc-ic-menu-with-multi{padding:var(--ic-space-xs) calc(var(--ic-space-xs) - var(--ic-space-1px));cursor:pointer;display:flex;align-items:center}.loading-option.sc-ic-menu-with-multi p.sc-ic-menu-with-multi{margin-bottom:0 !important}.option.sc-ic-menu-with-multi:not(.loading-option){justify-content:space-between}.small.sc-ic-menu-with-multi-h .option.sc-ic-menu-with-multi{padding:var(--ic-space-xxs) calc(var(--ic-space-xs) - var(--ic-space-1px))}.large.sc-ic-menu-with-multi-h .option.sc-ic-menu-with-multi{padding:var(--ic-space-sm) calc(var(--ic-space-xs) - var(--ic-space-1px))}.option.sc-ic-menu-with-multi:last-child{border-radius:0 0 1px 1px}.sc-ic-menu-with-multi:not(.menu:has(+.option-bar)).sc-ic-menu-with-multi .option.sc-ic-menu-with-multi:first-child{border-radius:1px 1px 0 0}.option.sc-ic-menu-with-multi:not(.disabled-option):hover{background-color:var(--ic-action-dark-bg-hover)}.option.sc-ic-menu-with-multi:not(.disabled-option):active{background-color:var(--ic-action-dark-bg-active)}.option.sc-ic-menu-with-multi:focus-visible{outline:var(--ic-hc-focus-outline)}.option.sc-ic-menu-with-multi:not(.disabled-option) .option-description.sc-ic-menu-with-multi{color:var(--ic-color-secondary-text)}.option.sc-ic-menu-with-multi .option-label.sc-ic-menu-with-multi{display:flex;flex-direction:row;align-items:top}.option.sc-ic-menu-with-multi .option-element.sc-ic-menu-with-multi{margin-top:var(--ic-space-xxs)}.option.sc-ic-menu-with-multi .option-icon.sc-ic-menu-with-multi{height:var(--ic-space-md);width:var(--ic-space-md);margin-top:var(--ic-space-xxs);margin-right:var(--ic-space-xxxs)}.option-text-container.sc-ic-menu-with-multi{pointer-events:none;max-width:calc(var(--ic-space-lg) * 10 + var(--ic-space-xl))}.option.loading-option.sc-ic-menu-with-multi .option-text-container.sc-ic-menu-with-multi{margin-left:calc(var(--ic-space-xs) + var(--ic-space-xxxs));color:var(--ic-color-secondary-text)}.error-icon-svg.sc-ic-menu-with-multi{height:var(--ic-space-md);width:var(--ic-space-md);fill:var(--ic-status-error);align-self:center;display:flex;margin-right:calc(var(--ic-space-xxs) * 1.2)}.loading-error-info.sc-ic-menu-with-multi{display:flex}.check-icon.sc-ic-menu-with-multi{height:var(--ic-space-lg);min-width:var(--ic-space-lg);width:var(--ic-space-lg);margin-left:var(--ic-space-xs);pointer-events:none}.focused-option.sc-ic-menu-with-multi .check-icon.sc-ic-menu-with-multi *.sc-ic-menu-with-multi{fill:currentcolor}.option-group-title.sc-ic-menu-with-multi{padding:var(--ic-space-lg) calc(var(--ic-space-xs) - var(--ic-space-1px))\n var(--ic-space-xs);color:var(--ic-color-tertiary-text)}.small.sc-ic-menu-with-multi-h .option-group-title.sc-ic-menu-with-multi{padding:var(--ic-space-sm) calc(var(--ic-space-xs) - var(--ic-space-1px))\n var(--ic-space-xxs)}.last-recommended-option.sc-ic-menu-with-multi{border-bottom:var(--ic-border-default)}.disabled-option.sc-ic-menu-with-multi{color:var(--ic-architectural-200);cursor:default;pointer-events:none}.focused-option.sc-ic-menu-with-multi,.focused-option.sc-ic-menu-with-multi .option-description.sc-ic-menu-with-multi{background-color:var(--ic-focus-blue) !important;color:var(--ic-color-white-text) !important}.no-results.sc-ic-menu-with-multi-h li.sc-ic-menu-with-multi{cursor:no-drop}.no-results.sc-ic-menu-with-multi-h li.sc-ic-menu-with-multi:hover{background-color:transparent}.option-bar.sc-ic-menu-with-multi{padding:var(--ic-space-xxs) var(--ic-space-xs);display:flex;align-items:center;justify-content:space-between;background-color:var(--ic-architectural-40);visibility:hidden;border-bottom:var(--ic-border-width) solid var(--ic-architectural-400);border-radius:1px 1px 0 0}.option-bar.sc-ic-menu-with-multi p.sc-ic-menu-with-multi{margin-bottom:0 !important}.large.sc-ic-menu-with-multi-h .option-bar.sc-ic-menu-with-multi{padding:var(--ic-space-xs)}.select-all-button.sc-ic-menu-with-multi{display:none}.select-all-button.sc-ic-menu-with-multi:focus{z-index:calc(var(--ic-z-index-menu) + 1)}@media (forced-colors: active){.focused-option.sc-ic-menu-with-multi:focus{outline:none;border:0.125rem solid transparent}}";
|
1805
|
+
|
1806
|
+
const Menu = /*@__PURE__*/ proxyCustomElement(class Menu extends HTMLElement$1 {
|
1807
|
+
constructor() {
|
1808
|
+
super();
|
1809
|
+
this.__registerHost();
|
1810
|
+
this.menuKeyPress = createEvent(this, "menuKeyPress", 7);
|
1811
|
+
this.menuOptionId = createEvent(this, "menuOptionId", 7);
|
1812
|
+
this.menuOptionSelect = createEvent(this, "menuOptionSelect", 7);
|
1813
|
+
this.menuOptionSelectAll = createEvent(this, "menuOptionSelectAll", 7);
|
1814
|
+
this.menuStateChange = createEvent(this, "menuStateChange", 7);
|
1815
|
+
this.retryButtonClicked = createEvent(this, "retryButtonClicked", 7);
|
1816
|
+
this.timeoutBlur = createEvent(this, "timeoutBlur", 7);
|
1817
|
+
this.ungroupedOptionsSet = createEvent(this, "ungroupedOptionsSet", 7);
|
1818
|
+
this.activeDescendantAttr = "aria-activedescendant"; // Prevent duplicate literal string lint error
|
1819
|
+
this.clearButtonId = "clear-button"; // Prevent duplicate literal string lint error
|
1820
|
+
this.disabledOptionSelected = false;
|
1821
|
+
this.hasPreviouslyBlurred = false;
|
1822
|
+
this.hasTimedOut = false;
|
1823
|
+
this.isLoading = false;
|
1824
|
+
this.isMultiSelect = false;
|
1825
|
+
this.isSearchBar = false;
|
1826
|
+
this.isSearchableSelect = false;
|
1827
|
+
this.multiOptionClicked = null;
|
1828
|
+
this.preventClickOpen = false; // Prevents menu re-opening immediately after it is closed on blur when clicking input.
|
1829
|
+
this.preventMenuFocus = false; // (When multiple) ensures focus moves straight to select all button from menu.
|
1830
|
+
this.ungroupedOptions = [];
|
1831
|
+
this.handleClearListener = () => {
|
1832
|
+
this.optionHighlighted = "";
|
1833
|
+
};
|
1834
|
+
this.handleSubmitSearch = () => {
|
1835
|
+
const highlightedOptionIndex = this.options.findIndex((option) => option[this.valueField] === this.optionHighlighted);
|
1836
|
+
this.setInputValue(highlightedOptionIndex);
|
1837
|
+
};
|
1838
|
+
this.handleMenuChange = (open, focusInput) => {
|
1839
|
+
this.menuStateChange.emit({ open, focusInput });
|
1840
|
+
if (!open) {
|
1841
|
+
if (focusInput !== false) {
|
1842
|
+
this.inputEl.focus();
|
1843
|
+
this.preventClickOpen = false;
|
1844
|
+
}
|
1845
|
+
// Reset optionHighlighted so previously highlighted option doesn't get reselected when Enter pressed
|
1846
|
+
if (this.isMultiSelect) {
|
1847
|
+
this.optionHighlighted = undefined;
|
1848
|
+
this.multiOptionClicked = null;
|
1849
|
+
}
|
1850
|
+
}
|
1851
|
+
};
|
1852
|
+
this.setNextOptionValue = (selectedOptionIndex) => {
|
1853
|
+
if (this.ungroupedOptions[selectedOptionIndex + 1]) {
|
1854
|
+
this.menuOptionSelect.emit({
|
1855
|
+
value: this.ungroupedOptions[selectedOptionIndex + 1][this.valueField],
|
1856
|
+
optionId: this.getOptionId(this.ungroupedOptions[selectedOptionIndex + 1][this.valueField]),
|
1857
|
+
});
|
1858
|
+
}
|
1859
|
+
else {
|
1860
|
+
this.menuOptionSelect.emit({
|
1861
|
+
value: this.ungroupedOptions[0][this.valueField],
|
1862
|
+
optionId: this.getOptionId(this.ungroupedOptions[0][this.valueField]),
|
1863
|
+
});
|
1864
|
+
}
|
1865
|
+
};
|
1866
|
+
this.setPreviousOptionValue = (selectedOptionIndex) => {
|
1867
|
+
if (this.ungroupedOptions[selectedOptionIndex - 1]) {
|
1868
|
+
this.menuOptionSelect.emit({
|
1869
|
+
value: this.ungroupedOptions[selectedOptionIndex - 1][this.valueField],
|
1870
|
+
optionId: this.getOptionId(this.ungroupedOptions[selectedOptionIndex - 1][this.valueField]),
|
1871
|
+
});
|
1872
|
+
}
|
1873
|
+
else {
|
1874
|
+
this.menuOptionSelect.emit({
|
1875
|
+
value: this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField],
|
1876
|
+
optionId: this.getOptionId(this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField]),
|
1877
|
+
});
|
1878
|
+
}
|
1879
|
+
};
|
1880
|
+
this.getParentEl = (parent) => {
|
1881
|
+
if (parent.tagName === "IC-SEARCH-BAR") {
|
1882
|
+
this.isSearchBar = true;
|
1883
|
+
}
|
1884
|
+
else if (parent.tagName === "IC-SELECT" ||
|
1885
|
+
parent.tagName === "IC-SELECT-WITH-MULTI") {
|
1886
|
+
if (parent.getAttribute("searchable") !== null &&
|
1887
|
+
parent.getAttribute("searchable") !== undefined) {
|
1888
|
+
this.isSearchableSelect = true;
|
1889
|
+
}
|
1890
|
+
else if (parent.getAttribute("multiple") !== null &&
|
1891
|
+
parent.getAttribute("multiple") !== undefined) {
|
1892
|
+
this.isMultiSelect = true;
|
1893
|
+
}
|
1894
|
+
}
|
1895
|
+
};
|
1896
|
+
// Open menu when up or down arrow keys are pressed
|
1897
|
+
this.arrowBehaviour = (event) => {
|
1898
|
+
event.preventDefault();
|
1899
|
+
this.handleMenuChange(true);
|
1900
|
+
};
|
1901
|
+
this.getMenuOptions = () => this.isSearchBar ? this.options : this.ungroupedOptions;
|
1902
|
+
// Set option that is focused and so should show focus state
|
1903
|
+
this.setHighlightedOption = (highlightedIndex) => {
|
1904
|
+
const menuOptions = this.getMenuOptions();
|
1905
|
+
menuOptions[highlightedIndex] &&
|
1906
|
+
!menuOptions[highlightedIndex].timedOut &&
|
1907
|
+
(this.optionHighlighted =
|
1908
|
+
menuOptions[highlightedIndex][this.valueField] || undefined);
|
1909
|
+
};
|
1910
|
+
// Determines keyboard behaviour when selection is automatic
|
1911
|
+
// (i.e. you don't have to press Enter select an option - just focus on it)
|
1912
|
+
// and menu is closed
|
1913
|
+
this.autoSetInputValueKeyboardOpen = (event) => {
|
1914
|
+
const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
|
1915
|
+
this.keyboardNav = false;
|
1916
|
+
switch (event.key) {
|
1917
|
+
case "ArrowDown":
|
1918
|
+
this.keyboardNav = true;
|
1919
|
+
this.arrowBehaviour(event);
|
1920
|
+
this.setNextOptionValue(selectedOptionIndex);
|
1921
|
+
break;
|
1922
|
+
case "ArrowUp":
|
1923
|
+
this.keyboardNav = true;
|
1924
|
+
this.arrowBehaviour(event);
|
1925
|
+
this.setPreviousOptionValue(selectedOptionIndex);
|
1926
|
+
break;
|
1927
|
+
case " ":
|
1928
|
+
case "Enter":
|
1929
|
+
if (event.target.id !== this.clearButtonId) {
|
1930
|
+
this.handleMenuChange(true);
|
1931
|
+
}
|
1932
|
+
break;
|
1933
|
+
}
|
1934
|
+
};
|
1935
|
+
this.selectHighlightedOption = (target, options, highlightedOptionIndex) => {
|
1936
|
+
if (!this.isLoading && !this.hasTimedOut) {
|
1937
|
+
this.keyboardNav = true;
|
1938
|
+
}
|
1939
|
+
const isOpen = this.isSearchBar || this.isSearchableSelect || this.open;
|
1940
|
+
if (isOpen) {
|
1941
|
+
if (highlightedOptionIndex >= 0) {
|
1942
|
+
if (options[highlightedOptionIndex] !== undefined) {
|
1943
|
+
if (this.isSearchBar &&
|
1944
|
+
options[highlightedOptionIndex].disabled === true) {
|
1945
|
+
this.disabledOptionSelected = true;
|
1946
|
+
}
|
1947
|
+
else {
|
1948
|
+
this.setInputValue(highlightedOptionIndex);
|
1949
|
+
this.value = options[highlightedOptionIndex][this.valueField];
|
1950
|
+
}
|
1951
|
+
}
|
1952
|
+
}
|
1953
|
+
else {
|
1954
|
+
this.setInputValue(highlightedOptionIndex);
|
1955
|
+
}
|
1956
|
+
}
|
1957
|
+
else if (target.id !== this.clearButtonId &&
|
1958
|
+
this.isMultiSelect) {
|
1959
|
+
this.handleMenuChange(true);
|
1960
|
+
}
|
1961
|
+
};
|
1962
|
+
// Determines keyboard behaviour when selection is manual (i.e. when you have to press Enter to select an option)
|
1963
|
+
this.manualSetInputValueKeyboardOpen = (event) => {
|
1964
|
+
const menuOptions = this.getMenuOptions();
|
1965
|
+
this.keyboardNav = false;
|
1966
|
+
const highlightedOptionIndex = menuOptions.findIndex((option) => option[this.valueField] === this.optionHighlighted);
|
1967
|
+
const clickedMultiOptionIndex = menuOptions.findIndex((option) => option[this.valueField] === this.multiOptionClicked);
|
1968
|
+
const getOptionId = (index) => { var _a; return (_a = Array.from(this.el.querySelectorAll("li"))[index]) === null || _a === void 0 ? void 0 : _a.id; };
|
1969
|
+
// Space press should be equivalent to Enter when multi-select
|
1970
|
+
if (event.key === " " && this.isMultiSelect) {
|
1971
|
+
this.selectHighlightedOption(event.target, menuOptions, highlightedOptionIndex);
|
1972
|
+
}
|
1973
|
+
else {
|
1974
|
+
switch (event.key) {
|
1975
|
+
case "ArrowDown":
|
1976
|
+
this.keyboardNav = true;
|
1977
|
+
this.arrowBehaviour(event);
|
1978
|
+
if (this.multiOptionClicked) {
|
1979
|
+
// Set focus to option last clicked
|
1980
|
+
// Prevents it resetting to the top of the menu when user switches to using keyboard
|
1981
|
+
this.setHighlightedOption(clickedMultiOptionIndex);
|
1982
|
+
this.multiOptionClicked = null;
|
1983
|
+
}
|
1984
|
+
else if (highlightedOptionIndex < menuOptions.length - 1) {
|
1985
|
+
this.setHighlightedOption(highlightedOptionIndex + 1);
|
1986
|
+
this.menuOptionId.emit({
|
1987
|
+
optionId: getOptionId(highlightedOptionIndex + 1),
|
1988
|
+
});
|
1989
|
+
}
|
1990
|
+
else {
|
1991
|
+
this.setHighlightedOption(0);
|
1992
|
+
this.menuOptionId.emit({
|
1993
|
+
optionId: getOptionId(0),
|
1994
|
+
});
|
1995
|
+
}
|
1996
|
+
this.preventIncorrectTabOrder = false;
|
1997
|
+
this.focusFromSearchKeypress = false;
|
1998
|
+
break;
|
1999
|
+
case "ArrowUp":
|
2000
|
+
this.keyboardNav = true;
|
2001
|
+
this.arrowBehaviour(event);
|
2002
|
+
if (this.multiOptionClicked) {
|
2003
|
+
// Set focus to option last clicked
|
2004
|
+
// Prevents it resetting to the bottom of the menu when user switches to using keyboard
|
2005
|
+
this.setHighlightedOption(clickedMultiOptionIndex);
|
2006
|
+
this.multiOptionClicked = null;
|
2007
|
+
}
|
2008
|
+
else if (highlightedOptionIndex <= 0 ||
|
2009
|
+
highlightedOptionIndex > menuOptions.length + 1) {
|
2010
|
+
this.setHighlightedOption(menuOptions.length - 1);
|
2011
|
+
this.menuOptionId.emit({
|
2012
|
+
optionId: getOptionId(menuOptions.length - 1),
|
2013
|
+
});
|
2014
|
+
}
|
2015
|
+
else {
|
2016
|
+
this.setHighlightedOption(highlightedOptionIndex - 1);
|
2017
|
+
this.menuOptionId.emit({
|
2018
|
+
optionId: getOptionId(highlightedOptionIndex - 1),
|
2019
|
+
});
|
2020
|
+
}
|
2021
|
+
this.preventIncorrectTabOrder = false;
|
2022
|
+
this.focusFromSearchKeypress = false;
|
2023
|
+
break;
|
2024
|
+
case "Home":
|
2025
|
+
this.keyboardNav = true;
|
2026
|
+
event.preventDefault();
|
2027
|
+
this.arrowBehaviour(event);
|
2028
|
+
this.setHighlightedOption(0);
|
2029
|
+
this.menuOptionId.emit({
|
2030
|
+
optionId: getOptionId(0),
|
2031
|
+
});
|
2032
|
+
break;
|
2033
|
+
case "End":
|
2034
|
+
this.keyboardNav = true;
|
2035
|
+
event.preventDefault();
|
2036
|
+
this.arrowBehaviour(event);
|
2037
|
+
this.setHighlightedOption(menuOptions.length - 1);
|
2038
|
+
this.menuOptionId.emit({
|
2039
|
+
optionId: getOptionId(menuOptions.length - 1),
|
2040
|
+
});
|
2041
|
+
break;
|
2042
|
+
case " ":
|
2043
|
+
if (this.isSearchBar || this.isSearchableSelect) {
|
2044
|
+
break;
|
2045
|
+
}
|
2046
|
+
else {
|
2047
|
+
if (event.target.id !== this.clearButtonId) {
|
2048
|
+
this.handleMenuChange(true);
|
2049
|
+
}
|
2050
|
+
}
|
2051
|
+
break;
|
2052
|
+
case "Enter":
|
2053
|
+
event.preventDefault();
|
2054
|
+
this.selectHighlightedOption(event.target, menuOptions, highlightedOptionIndex);
|
2055
|
+
break;
|
2056
|
+
case "Escape":
|
2057
|
+
if (this.open) {
|
2058
|
+
event.stopImmediatePropagation();
|
2059
|
+
}
|
2060
|
+
this.handleMenuChange(false);
|
2061
|
+
this.menuOptionId.emit({ optionId: undefined });
|
2062
|
+
break;
|
2063
|
+
case "a":
|
2064
|
+
// Checks if Cmd (meta) key is pressed if Mac device (while excluding meta key on Windows)
|
2065
|
+
// Otherwise, if a different OS, checks Ctrl key
|
2066
|
+
if ((isMacDevice() && event.metaKey) ||
|
2067
|
+
(!isMacDevice() && event.ctrlKey)) {
|
2068
|
+
this.emitSelectAll();
|
2069
|
+
}
|
2070
|
+
break;
|
2071
|
+
case "Shift":
|
2072
|
+
case "Tab":
|
2073
|
+
if (this.isSearchBar) {
|
2074
|
+
this.keyboardNav = true;
|
2075
|
+
}
|
2076
|
+
if (this.isMultiSelect) {
|
2077
|
+
if (this.open && !event.shiftKey && this.selectAllButton) {
|
2078
|
+
event.preventDefault();
|
2079
|
+
this.selectAllButton.focus(); // Move focus to select all button instead of focused option
|
2080
|
+
this.preventMenuFocus = true;
|
2081
|
+
this.preventClickOpen = true;
|
2082
|
+
this.optionHighlighted = undefined; // Stop any option focus states showing when focus moved to select all button
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
else {
|
2086
|
+
this.preventIncorrectTabOrder = true;
|
2087
|
+
}
|
2088
|
+
break;
|
2089
|
+
case "Backspace":
|
2090
|
+
if (this.isSearchBar) {
|
2091
|
+
this.parentEl.setFocus();
|
2092
|
+
if (this.searchMode === "navigation")
|
2093
|
+
this.setHighlightedOption(0);
|
2094
|
+
}
|
2095
|
+
else if (this.isSearchableSelect) {
|
2096
|
+
this.parentEl.setFocus();
|
2097
|
+
}
|
2098
|
+
this.focusFromSearchKeypress = true;
|
2099
|
+
break;
|
2100
|
+
default:
|
2101
|
+
if (event.key !== "Tab") {
|
2102
|
+
if (this.isSearchBar) {
|
2103
|
+
this.parentEl.setFocus();
|
2104
|
+
if (this.searchMode === "navigation")
|
2105
|
+
this.setHighlightedOption(0);
|
2106
|
+
}
|
2107
|
+
else if (this.isSearchableSelect) {
|
2108
|
+
this.parentEl.setFocus();
|
2109
|
+
}
|
2110
|
+
this.focusFromSearchKeypress = true;
|
2111
|
+
break;
|
2112
|
+
}
|
2113
|
+
}
|
2114
|
+
}
|
2115
|
+
};
|
2116
|
+
this.setInputValue = (highlightedOptionIndex) => {
|
2117
|
+
const menuOptions = this.getMenuOptions();
|
2118
|
+
if (menuOptions[highlightedOptionIndex] !== undefined) {
|
2119
|
+
this.menuOptionSelect.emit({
|
2120
|
+
value: menuOptions[highlightedOptionIndex][this.valueField],
|
2121
|
+
});
|
2122
|
+
if (this.closeOnSelect) {
|
2123
|
+
this.optionHighlighted = undefined;
|
2124
|
+
this.menuOptionId.emit({ optionId: undefined });
|
2125
|
+
}
|
2126
|
+
}
|
2127
|
+
if (this.closeOnSelect) {
|
2128
|
+
if (!this.hasTimedOut) {
|
2129
|
+
this.handleMenuChange(false);
|
2130
|
+
}
|
2131
|
+
else {
|
2132
|
+
this.parentEl.setFocus();
|
2133
|
+
}
|
2134
|
+
}
|
2135
|
+
};
|
2136
|
+
this.handleOptionClick = (event) => {
|
2137
|
+
const { value, label } = event.target.dataset;
|
2138
|
+
this.menuOptionSelect.emit({ value, label });
|
2139
|
+
this.optionHighlighted = undefined;
|
2140
|
+
if (this.isMultiSelect) {
|
2141
|
+
this.multiOptionClicked = value;
|
2142
|
+
}
|
2143
|
+
else {
|
2144
|
+
this.handleMenuChange(false);
|
2145
|
+
}
|
2146
|
+
};
|
2147
|
+
this.handleRetry = () => {
|
2148
|
+
this.retryButtonClicked.emit({ value: this.value });
|
2149
|
+
};
|
2150
|
+
this.handleRetryKeyDown = (ev) => {
|
2151
|
+
if (ev.key === "Enter" || ev.key === " ") {
|
2152
|
+
ev.preventDefault();
|
2153
|
+
this.retryButtonClicked.emit({ value: this.value, keyPressed: ev.key });
|
2154
|
+
}
|
2155
|
+
};
|
2156
|
+
this.handleBlur = (event) => {
|
2157
|
+
if (event.relatedTarget !== this.inputEl) {
|
2158
|
+
if (event.relatedTarget === this.selectAllButton) {
|
2159
|
+
this.menu.removeAttribute(this.activeDescendantAttr);
|
2160
|
+
}
|
2161
|
+
if (!(this.menu.contains(event.relatedTarget) ||
|
2162
|
+
event.relatedTarget === this.selectAllButton)) {
|
2163
|
+
this.handleMenuChange(false, this.hasPreviouslyBlurred);
|
2164
|
+
this.menu.removeAttribute(this.activeDescendantAttr);
|
2165
|
+
}
|
2166
|
+
}
|
2167
|
+
else {
|
2168
|
+
this.handleMenuChange(false);
|
2169
|
+
this.preventClickOpen = true;
|
2170
|
+
this.menu.removeAttribute(this.activeDescendantAttr);
|
2171
|
+
}
|
2172
|
+
if (!this.isSearchBar)
|
2173
|
+
this.hasPreviouslyBlurred = !!event.relatedTarget;
|
2174
|
+
};
|
2175
|
+
this.handleMouseDown = (event) => {
|
2176
|
+
event.preventDefault();
|
2177
|
+
};
|
2178
|
+
this.handleMenuKeyDown = (event) => {
|
2179
|
+
if (this.activationType === "automatic") {
|
2180
|
+
this.autoSetValueOnMenuKeyDown(event);
|
2181
|
+
}
|
2182
|
+
else if (this.activationType === "manual" && !this.isSearchBar) {
|
2183
|
+
this.manualSetInputValueKeyboardOpen(event);
|
2184
|
+
}
|
2185
|
+
};
|
2186
|
+
this.handleMenuKeyUp = (event) => {
|
2187
|
+
if (event.key === "Tab" && event.shiftKey) {
|
2188
|
+
this.preventClickOpen = false;
|
2189
|
+
}
|
2190
|
+
if (event.key === "Enter" && this.disabledOptionSelected) {
|
2191
|
+
this.disabledOptionSelected = false;
|
2192
|
+
event.stopImmediatePropagation();
|
2193
|
+
}
|
2194
|
+
};
|
2195
|
+
this.handleSelectAllClick = () => {
|
2196
|
+
this.keyboardNav = false;
|
2197
|
+
this.menu.focus();
|
2198
|
+
this.emitSelectAll();
|
2199
|
+
};
|
2200
|
+
this.handleSelectAllBlur = (event) => {
|
2201
|
+
this.el.classList.remove("select-all-focused");
|
2202
|
+
if (!this.menu.contains(event.relatedTarget)) {
|
2203
|
+
this.handleMenuChange(false, false);
|
2204
|
+
}
|
2205
|
+
};
|
2206
|
+
this.handleSelectAllFocus = () => {
|
2207
|
+
this.el.classList.add("select-all-focused");
|
2208
|
+
};
|
2209
|
+
// Fix for Safari - select all button click was causing menu to close
|
2210
|
+
this.handleSelectAllMouseDown = (event) => {
|
2211
|
+
event.preventDefault();
|
2212
|
+
};
|
2213
|
+
this.emitSelectAll = () => {
|
2214
|
+
var _a;
|
2215
|
+
// Select all if there is either no value or not all options are selected
|
2216
|
+
// 'true' means select all, 'false' means clear all
|
2217
|
+
this.menuOptionSelectAll.emit({
|
2218
|
+
select: !this.value || !(((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) === this.ungroupedOptions.length),
|
2219
|
+
});
|
2220
|
+
};
|
2221
|
+
this.emitMenuKeyPress = (isNavKey, key) => {
|
2222
|
+
this.menuKeyPress.emit({ isNavKey: isNavKey, key: key });
|
2223
|
+
};
|
2224
|
+
// Determines keyboard behaviour when selection is automatic
|
2225
|
+
// (i.e. you don't have to press Enter select an option - just focus on it)
|
2226
|
+
// and menu is focused
|
2227
|
+
this.autoSetValueOnMenuKeyDown = (event) => {
|
2228
|
+
event.cancelBubble = true;
|
2229
|
+
const selectedOptionIndex = this.ungroupedOptions.findIndex((option) => option[this.valueField] === this.value);
|
2230
|
+
const isSearchableSelect = this.inputEl.tagName === "INPUT";
|
2231
|
+
this.keyboardNav = false;
|
2232
|
+
switch (event.key) {
|
2233
|
+
case " ":
|
2234
|
+
event.preventDefault();
|
2235
|
+
break;
|
2236
|
+
case "ArrowUp":
|
2237
|
+
if (!this.hasTimedOut) {
|
2238
|
+
event.preventDefault();
|
2239
|
+
this.setPreviousOptionValue(selectedOptionIndex);
|
2240
|
+
this.keyboardNav = true;
|
2241
|
+
}
|
2242
|
+
break;
|
2243
|
+
case "ArrowDown":
|
2244
|
+
if (!this.hasTimedOut) {
|
2245
|
+
event.preventDefault();
|
2246
|
+
this.setNextOptionValue(selectedOptionIndex);
|
2247
|
+
this.keyboardNav = true;
|
2248
|
+
}
|
2249
|
+
break;
|
2250
|
+
case "Home":
|
2251
|
+
this.menuOptionSelect.emit({
|
2252
|
+
value: this.ungroupedOptions[0][this.valueField],
|
2253
|
+
});
|
2254
|
+
this.keyboardNav = true;
|
2255
|
+
break;
|
2256
|
+
case "End":
|
2257
|
+
this.menuOptionSelect.emit({
|
2258
|
+
value: this.ungroupedOptions[this.ungroupedOptions.length - 1][this.valueField],
|
2259
|
+
});
|
2260
|
+
this.keyboardNav = true;
|
2261
|
+
break;
|
2262
|
+
case "Enter":
|
2263
|
+
!this.hasTimedOut && this.handleMenuChange(false);
|
2264
|
+
break;
|
2265
|
+
case "Escape":
|
2266
|
+
this.handleMenuChange(false);
|
2267
|
+
break;
|
2268
|
+
case "Backspace":
|
2269
|
+
if (isSearchableSelect) {
|
2270
|
+
this.inputEl.focus();
|
2271
|
+
}
|
2272
|
+
break;
|
2273
|
+
case "Shift":
|
2274
|
+
break;
|
2275
|
+
default:
|
2276
|
+
if (isSearchableSelect && event.key !== "Tab" && !this.hasTimedOut) {
|
2277
|
+
this.inputEl.focus();
|
2278
|
+
}
|
2279
|
+
if (event.key.length === 1) {
|
2280
|
+
this.keyboardNav = true;
|
2281
|
+
}
|
2282
|
+
break;
|
2283
|
+
}
|
2284
|
+
this.emitMenuKeyPress(this.keyboardNav, event.key);
|
2285
|
+
};
|
2286
|
+
this.getOptionId = (value) => {
|
2287
|
+
return `${this.menuId}-${value}`;
|
2288
|
+
};
|
2289
|
+
this.getOptionAriaLabel = (option, parentOption) => {
|
2290
|
+
let ariaLabel = option[this.labelField];
|
2291
|
+
if (option.description) {
|
2292
|
+
ariaLabel = `${ariaLabel}, ${option.description}`;
|
2293
|
+
}
|
2294
|
+
if (option.element) {
|
2295
|
+
ariaLabel = `${ariaLabel}, ${option.element.ariaLabel}`;
|
2296
|
+
}
|
2297
|
+
if (parentOption) {
|
2298
|
+
return `${ariaLabel}, ${parentOption[this.labelField]} group`;
|
2299
|
+
}
|
2300
|
+
else {
|
2301
|
+
return ariaLabel;
|
2302
|
+
}
|
2303
|
+
};
|
2304
|
+
this.getSortedOptions = (options) => {
|
2305
|
+
let sorted = [];
|
2306
|
+
if (options.sort) {
|
2307
|
+
sorted = options.sort((optionA, optionB) => optionA.recommended && !optionB.recommended ? -1 : 0);
|
2308
|
+
}
|
2309
|
+
return sorted;
|
2310
|
+
};
|
2311
|
+
this.isManualMode = this.activationType === "manual";
|
2312
|
+
this.scrollToSelected = (menu) => {
|
2313
|
+
const selectedOption = this.selectOnEnter
|
2314
|
+
? this.el.querySelector(`li[data-value="${this.optionHighlighted}"]`)
|
2315
|
+
: menu.querySelector(".option[aria-selected='true']");
|
2316
|
+
if (selectedOption) {
|
2317
|
+
const elTop = selectedOption.offsetTop + selectedOption.offsetHeight;
|
2318
|
+
if (elTop > menu.scrollTop + menu.offsetHeight ||
|
2319
|
+
elTop < menu.scrollTop + menu.offsetHeight) {
|
2320
|
+
menu.scrollTop = selectedOption.offsetTop;
|
2321
|
+
}
|
2322
|
+
// 'aria-activedescendant' affects screen reader focus
|
2323
|
+
// https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/#kbd_focus_activedescendant
|
2324
|
+
this.menu.setAttribute(this.activeDescendantAttr, selectedOption.id);
|
2325
|
+
selectedOption.focus();
|
2326
|
+
}
|
2327
|
+
};
|
2328
|
+
// Set 'ungroupedOptions' variable and emit its value
|
2329
|
+
// - this is all the options with disabled options and group titles removed
|
2330
|
+
this.loadUngroupedOptions = () => {
|
2331
|
+
if (this.options.length > 0 && this.options.map) {
|
2332
|
+
this.options.map((option) => {
|
2333
|
+
if (option.children) {
|
2334
|
+
option.children.map((option) => !option.disabled && this.ungroupedOptions.push(option));
|
2335
|
+
}
|
2336
|
+
else if (!option.disabled) {
|
2337
|
+
this.ungroupedOptions.push(option);
|
2338
|
+
}
|
2339
|
+
});
|
2340
|
+
}
|
2341
|
+
this.ungroupedOptions = this.getSortedOptions(this.ungroupedOptions);
|
2342
|
+
this.ungroupedOptionsSet.emit({ options: this.ungroupedOptions });
|
2343
|
+
};
|
2344
|
+
this.setMenuScrollbar = () => {
|
2345
|
+
let optionsHeight = 0;
|
2346
|
+
this.el
|
2347
|
+
.querySelectorAll(".option")
|
2348
|
+
.forEach((option) => (optionsHeight += option.clientHeight));
|
2349
|
+
if (optionsHeight >= 320) {
|
2350
|
+
this.menu.classList.add("menu-scroll");
|
2351
|
+
}
|
2352
|
+
};
|
2353
|
+
this.handleTimeoutBlur = (ev) => {
|
2354
|
+
this.timeoutBlur.emit({ ev });
|
2355
|
+
};
|
2356
|
+
this.optionContent = (option, selected) => {
|
2357
|
+
return (h(Fragment, null, option.loading && h("ic-loading-indicator", { size: "icon" }), h("div", { class: "option-text-container" }, h("div", { class: "option-label" }, option.icon && (h("div", { class: "option-icon", innerHTML: option.icon, "aria-hidden": "true" })), h("ic-typography", { variant: "body", "aria-hidden": "true" }, h("p", null, option[this.labelField]))), option.description && (h("ic-typography", { id: `${this.getOptionId(option[this.valueField])}-description`, class: "option-description", variant: "caption", "aria-hidden": "true" }, h("p", null, option.description))), option.element && (h("div", { class: "option-element", innerHTML: option.element.component, "aria-hidden": "true" }))), !!option[this.valueField] &&
|
2358
|
+
!!this.value &&
|
2359
|
+
selected &&
|
2360
|
+
this.parentEl.tagName !== "IC-SEARCH-BAR" && (h("span", { class: "check-icon", innerHTML: Check }))));
|
2361
|
+
};
|
2362
|
+
this.displayOption = (option, selected, index, parentOption) => {
|
2363
|
+
const { open, keyboardNav, isManualMode, initialOptionsListRender, optionHighlighted, options, } = this;
|
2364
|
+
return (h("li", { id: this.getOptionId(option[this.valueField]), class: {
|
2365
|
+
option: true,
|
2366
|
+
"focused-option": isManualMode
|
2367
|
+
? (keyboardNav || initialOptionsListRender) &&
|
2368
|
+
option[this.valueField] === optionHighlighted
|
2369
|
+
: keyboardNav && selected,
|
2370
|
+
"last-recommended-option": option.recommended &&
|
2371
|
+
options[index + 1] &&
|
2372
|
+
!options[index + 1].recommended,
|
2373
|
+
"disabled-option": option.disabled,
|
2374
|
+
"loading-option": option.loading,
|
2375
|
+
timeout: option.timedOut,
|
2376
|
+
}, role: "option", tabindex: open &&
|
2377
|
+
(selected || option[this.valueField] === optionHighlighted) &&
|
2378
|
+
keyboardNav
|
2379
|
+
? "0"
|
2380
|
+
: "-1", "aria-label": this.getOptionAriaLabel(option, parentOption), "aria-selected": selected ? "true" : "false", "aria-disabled": option.disabled ? "true" : "false", onClick: !option.timedOut && !option.loading && this.handleOptionClick, onBlur: this.handleBlur, onMouseDown: this.handleMouseDown, "data-value": option[this.valueField], "data-label": option[this.labelField] }, option.timedOut ? (h(Fragment, null, h("div", { class: "loading-error-info" }, h("svg", { class: "error-icon-svg", "aria-labelledby": "error-title", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#000000" }, h("title", { id: "error-title" }, "Error"), h("g", { id: "close-octagon" }, h("path", { id: "Vector", d: "M8.77 3L3.5 8.27V15.73L8.77 21H16.23L21.5 15.73V8.27L16.23 3M8.91 7L12.5 10.59L16.09 7L17.5 8.41L13.91 12L17.5 15.59L16.09 17L12.5 13.41L8.91 17L7.5 15.59L11.09 12L7.5 8.41" }))), h("ic-typography", { variant: "label" }, option[this.labelField])), h("ic-button", { size: "small", variant: "tertiary", onClick: this.handleRetry, onKeyDown: this.handleRetryKeyDown, onBlur: this.handleTimeoutBlur, id: "retry-button" }, "Retry"))) : (this.optionContent(option, selected))));
|
2381
|
+
};
|
2382
|
+
this.focusFromSearchKeypress = false;
|
2383
|
+
this.initialOptionsListRender = false;
|
2384
|
+
this.keyboardNav = false;
|
2385
|
+
this.optionHighlighted = undefined;
|
2386
|
+
this.preventIncorrectTabOrder = false;
|
2387
|
+
this.menuOptions = undefined;
|
2388
|
+
this.activationType = "automatic";
|
2389
|
+
this.anchorEl = undefined;
|
2390
|
+
this.autoFocusOnSelected = true;
|
2391
|
+
this.closeOnSelect = true;
|
2392
|
+
this.fullWidth = false;
|
2393
|
+
this.inputEl = undefined;
|
2394
|
+
this.inputLabel = undefined;
|
2395
|
+
this.labelField = "label";
|
2396
|
+
this.menuId = undefined;
|
2397
|
+
this.open = undefined;
|
2398
|
+
this.parentEl = undefined;
|
2399
|
+
this.searchMode = "navigation";
|
2400
|
+
this.selectOnEnter = false;
|
2401
|
+
this.size = "default";
|
2402
|
+
this.small = false;
|
2403
|
+
this.options = undefined;
|
2404
|
+
this.value = undefined;
|
2405
|
+
this.valueField = "value";
|
2406
|
+
}
|
2407
|
+
watchOpenHandler() {
|
2408
|
+
if (!this.open && this.popperInstance) {
|
2409
|
+
this.popperInstance.destroy();
|
2410
|
+
this.popperInstance = null;
|
2411
|
+
}
|
2412
|
+
}
|
2413
|
+
watchOptionsHandler(newOptions) {
|
2414
|
+
this.hasTimedOut = newOptions.some((opt) => opt.timedOut);
|
2415
|
+
this.isLoading = newOptions.some((opt) => opt.loading);
|
2416
|
+
this.ungroupedOptions = [];
|
2417
|
+
this.loadUngroupedOptions();
|
2418
|
+
}
|
2419
|
+
connectedCallback() {
|
2420
|
+
this.getParentEl(this.parentEl);
|
2421
|
+
if (this.isSearchBar) {
|
2422
|
+
if (this.searchMode === "navigation")
|
2423
|
+
this.setHighlightedOption(0);
|
2424
|
+
this.initialOptionsListRender = true;
|
2425
|
+
}
|
2426
|
+
}
|
2427
|
+
disconnectedCallback() {
|
2428
|
+
if (this.popperInstance) {
|
2429
|
+
this.popperInstance.destroy();
|
2430
|
+
}
|
2431
|
+
this.parentEl.removeEventListener("icClear", this.handleClearListener);
|
2432
|
+
this.parentEl.removeEventListener("icSubmitSearch", this.handleSubmitSearch);
|
2433
|
+
}
|
2434
|
+
componentWillLoad() {
|
2435
|
+
var _a, _b;
|
2436
|
+
this.loadUngroupedOptions();
|
2437
|
+
this.parentEl.addEventListener("icClear", this.handleClearListener);
|
2438
|
+
this.parentEl.addEventListener("icSubmitSearch", this.handleSubmitSearch);
|
2439
|
+
this.hasTimedOut = (_a = this.options) === null || _a === void 0 ? void 0 : _a.some((opt) => opt.timedOut);
|
2440
|
+
this.isLoading = (_b = this.options) === null || _b === void 0 ? void 0 : _b.some((opt) => opt.loading);
|
2441
|
+
}
|
2442
|
+
componentDidLoad() {
|
2443
|
+
if (this.isSearchBar &&
|
2444
|
+
this.parentEl.disableFilter) {
|
2445
|
+
this.focusFromSearchKeypress = true;
|
2446
|
+
}
|
2447
|
+
onComponentRequiredPropUndefined([
|
2448
|
+
{ prop: this.open, propName: "open" },
|
2449
|
+
{ prop: this.options, propName: "options" },
|
2450
|
+
{ prop: this.menuId, propName: "menu-id" },
|
2451
|
+
{ prop: this.inputLabel, propName: "input-label" },
|
2452
|
+
//NOTE: no check for value, input-el or anchor-el as otherwise get console errors on first load of select component
|
2453
|
+
], "Menu");
|
2454
|
+
}
|
2455
|
+
componentDidUpdate() {
|
2456
|
+
const inputValueInOptions = this.options.some((option) => option[this.valueField] === this.value);
|
2457
|
+
const optionHighlightedIsSet = this.optionHighlighted !== null &&
|
2458
|
+
this.optionHighlighted !== undefined &&
|
2459
|
+
this.optionHighlighted !== "";
|
2460
|
+
if (this.open && this.options.length !== 0 && !this.preventMenuFocus) {
|
2461
|
+
if (this.value &&
|
2462
|
+
this.keyboardNav &&
|
2463
|
+
inputValueInOptions &&
|
2464
|
+
this.autoFocusOnSelected &&
|
2465
|
+
!this.isSearchableSelect) {
|
2466
|
+
this.scrollToSelected(this.menu);
|
2467
|
+
}
|
2468
|
+
else if (optionHighlightedIsSet &&
|
2469
|
+
!this.focusFromSearchKeypress &&
|
2470
|
+
!this.preventIncorrectTabOrder) {
|
2471
|
+
const highlightedEl = this.el.querySelector(`li[data-value="${this.optionHighlighted}"]`);
|
2472
|
+
if (highlightedEl) {
|
2473
|
+
this.menu.setAttribute(this.activeDescendantAttr, highlightedEl.id);
|
2474
|
+
highlightedEl.focus();
|
2475
|
+
}
|
2476
|
+
}
|
2477
|
+
else if (this.inputEl.tagName !== "IC-TEXT-FIELD" &&
|
2478
|
+
this.inputEl.tagName !== "INPUT") {
|
2479
|
+
this.menu.focus();
|
2480
|
+
}
|
2481
|
+
}
|
2482
|
+
if (this.open && !this.value && this.selectOnEnter) {
|
2483
|
+
this.scrollToSelected(this.menu);
|
2484
|
+
}
|
2485
|
+
this.preventMenuFocus = false;
|
2486
|
+
}
|
2487
|
+
componentDidRender() {
|
2488
|
+
if (this.open && !this.popperInstance && this.anchorEl) {
|
2489
|
+
this.initPopperJs(this.anchorEl);
|
2490
|
+
}
|
2491
|
+
if (this.open && !!this.options.length) {
|
2492
|
+
this.setMenuScrollbar();
|
2493
|
+
}
|
2494
|
+
}
|
2495
|
+
/**
|
2496
|
+
* @internal If menu is opened with the mouse, emit menuStateChange custom event.
|
2497
|
+
*/
|
2498
|
+
async handleClickOpen() {
|
2499
|
+
if (!this.preventClickOpen) {
|
2500
|
+
this.menuStateChange.emit({ open: !this.open });
|
2501
|
+
this.keyboardNav = false;
|
2502
|
+
}
|
2503
|
+
this.preventClickOpen = false;
|
2504
|
+
}
|
2505
|
+
/**
|
2506
|
+
* Used alongside activationType
|
2507
|
+
* If menu is opened via keyboard navigation (i.e. Enter, ArrowUp or ArrowDown), emit optionSelect custom event.
|
2508
|
+
* @param {KeyboardEvent} event - keyboard event
|
2509
|
+
*/
|
2510
|
+
async handleKeyboardOpen(event) {
|
2511
|
+
this.keyboardNav = false;
|
2512
|
+
if (this.activationType === "automatic") {
|
2513
|
+
this.autoSetInputValueKeyboardOpen(event);
|
2514
|
+
}
|
2515
|
+
else {
|
2516
|
+
this.manualSetInputValueKeyboardOpen(event);
|
2517
|
+
}
|
2518
|
+
}
|
2519
|
+
/**
|
2520
|
+
* @internal Used to highlight the first option in the menu.
|
2521
|
+
*/
|
2522
|
+
async handleSetFirstOption() {
|
2523
|
+
this.setHighlightedOption(0);
|
2524
|
+
}
|
2525
|
+
/**
|
2526
|
+
* @internal Used to initialize popperJS with an anchor element.
|
2527
|
+
* 5/12/2023: Tested with Floating UI, however, discovered inconsistent
|
2528
|
+
* boundary behaviour so sticking with PopperJS.
|
2529
|
+
*/
|
2530
|
+
async initPopperJs(anchor) {
|
2531
|
+
// Placements set to "-start" to accommodate for custom menu width - menu should always be aligned to the left
|
2532
|
+
this.popperInstance = createPopper(anchor, this.el, {
|
2533
|
+
placement: "bottom-start",
|
2534
|
+
modifiers: [
|
2535
|
+
{
|
2536
|
+
name: "offset",
|
2537
|
+
options: {
|
2538
|
+
offset: [0, 7],
|
2539
|
+
},
|
2540
|
+
},
|
2541
|
+
{
|
2542
|
+
name: "flip",
|
2543
|
+
options: {
|
2544
|
+
fallbackPlacements: ["top-start"],
|
2545
|
+
rootBoundary: "viewport",
|
2546
|
+
},
|
2547
|
+
},
|
2548
|
+
],
|
2549
|
+
});
|
2550
|
+
}
|
2551
|
+
render() {
|
2552
|
+
const { inputLabel, options, menuId, value, fullWidth, hasTimedOut, isLoading, size, small, open, inputEl, keyboardNav, } = this;
|
2553
|
+
const selectAllButtonText = `${(value === null || value === void 0 ? void 0 : value.length) === this.ungroupedOptions.length ? "Clear" : "Select"} all`;
|
2554
|
+
const hasNoResults = this.el.classList.contains("no-results");
|
2555
|
+
return (h(Host, { class: {
|
2556
|
+
"full-width": fullWidth,
|
2557
|
+
"no-focus": (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) === "INPUT" ||
|
2558
|
+
hasTimedOut ||
|
2559
|
+
isLoading ||
|
2560
|
+
hasNoResults,
|
2561
|
+
small: small,
|
2562
|
+
[size]: true,
|
2563
|
+
open: open && options.length !== 0,
|
2564
|
+
multiple: this.isMultiSelect,
|
2565
|
+
} }, options.length !== 0 && (h("ul", { id: menuId, class: "menu", role: "listbox", "aria-label": `${inputLabel} pop-up`, "aria-multiselectable": this.isMultiSelect ? "true" : "false", tabindex: open && !keyboardNav && (inputEl === null || inputEl === void 0 ? void 0 : inputEl.tagName) !== "INPUT" ? "0" : "-1", ref: (el) => (this.menu = el), onKeyDown: this.handleMenuKeyDown, onKeyUp: this.handleMenuKeyUp, onBlur: this.handleBlur }, this.getSortedOptions(options).map((option, index) => {
|
2566
|
+
if (option.children) {
|
2567
|
+
if (option.children.length > 0) {
|
2568
|
+
return (h("div", null, h("ic-typography", { class: "option-group-title", role: "presentation", variant: "subtitle-small" }, h("p", null, option[this.labelField])), option.children.map((childOption) => childOption.label &&
|
2569
|
+
this.displayOption(childOption, this.isMultiSelect
|
2570
|
+
? value === null || value === void 0 ? void 0 : value.includes(childOption[this.valueField])
|
2571
|
+
: childOption[this.valueField] === value, index, option))));
|
2572
|
+
}
|
2573
|
+
else {
|
2574
|
+
return null;
|
2575
|
+
}
|
2576
|
+
}
|
2577
|
+
else {
|
2578
|
+
// Display option only if it has a label (rather than displaying an empty space)
|
2579
|
+
return (option.label &&
|
2580
|
+
this.displayOption(option, this.isMultiSelect
|
2581
|
+
? value === null || value === void 0 ? void 0 : value.includes(option[this.valueField])
|
2582
|
+
: option[this.valueField] === value, index));
|
2583
|
+
}
|
2584
|
+
}))), options.length !== 0 &&
|
2585
|
+
this.isMultiSelect &&
|
2586
|
+
!isLoading &&
|
2587
|
+
!hasTimedOut &&
|
2588
|
+
!hasNoResults && (h("div", { class: "option-bar" }, h("ic-typography", null, h("p", null, `${value ? value.length : 0}/${getOptionsWithoutGroupTitlesCount(this.options)} selected`)), h("ic-button", { class: "select-all-button", "aria-label": `${selectAllButtonText} options for ${inputLabel}`, ref: (el) => (this.selectAllButton = el), variant: "tertiary", onClick: this.handleSelectAllClick, onMouseDown: this.handleSelectAllMouseDown, onBlur: this.handleSelectAllBlur, onFocus: this.handleSelectAllFocus, size: size === "small" ? "small" : "default" }, selectAllButtonText)))));
|
2589
|
+
}
|
2590
|
+
get el() { return this; }
|
2591
|
+
static get watchers() { return {
|
2592
|
+
"open": ["watchOpenHandler"],
|
2593
|
+
"options": ["watchOptionsHandler"]
|
2594
|
+
}; }
|
2595
|
+
static get style() { return icMenuCss; }
|
2596
|
+
}, [2, "ic-menu-with-multi", {
|
2597
|
+
"activationType": [1, "activation-type"],
|
2598
|
+
"anchorEl": [16],
|
2599
|
+
"autoFocusOnSelected": [4, "auto-focus-on-selected"],
|
2600
|
+
"closeOnSelect": [4, "close-on-select"],
|
2601
|
+
"fullWidth": [4, "full-width"],
|
2602
|
+
"inputEl": [16],
|
2603
|
+
"inputLabel": [1, "input-label"],
|
2604
|
+
"labelField": [1, "label-field"],
|
2605
|
+
"menuId": [1, "menu-id"],
|
2606
|
+
"open": [516],
|
2607
|
+
"parentEl": [16],
|
2608
|
+
"searchMode": [1, "search-mode"],
|
2609
|
+
"selectOnEnter": [4, "select-on-enter"],
|
2610
|
+
"size": [1],
|
2611
|
+
"small": [4],
|
2612
|
+
"options": [16],
|
2613
|
+
"value": [1025],
|
2614
|
+
"valueField": [1, "value-field"],
|
2615
|
+
"focusFromSearchKeypress": [32],
|
2616
|
+
"initialOptionsListRender": [32],
|
2617
|
+
"keyboardNav": [32],
|
2618
|
+
"optionHighlighted": [32],
|
2619
|
+
"preventIncorrectTabOrder": [32],
|
2620
|
+
"menuOptions": [32],
|
2621
|
+
"handleClickOpen": [64],
|
2622
|
+
"handleKeyboardOpen": [64],
|
2623
|
+
"handleSetFirstOption": [64],
|
2624
|
+
"initPopperJs": [64]
|
2625
|
+
}, undefined, {
|
2626
|
+
"open": ["watchOpenHandler"],
|
2627
|
+
"options": ["watchOptionsHandler"]
|
2628
|
+
}]);
|
2629
|
+
function defineCustomElement() {
|
2630
|
+
if (typeof customElements === "undefined") {
|
2631
|
+
return;
|
2632
|
+
}
|
2633
|
+
const components = ["ic-menu-with-multi", "ic-button", "ic-loading-indicator", "ic-tooltip", "ic-typography"];
|
2634
|
+
components.forEach(tagName => { switch (tagName) {
|
2635
|
+
case "ic-menu-with-multi":
|
2636
|
+
if (!customElements.get(tagName)) {
|
2637
|
+
customElements.define(tagName, Menu);
|
2638
|
+
}
|
2639
|
+
break;
|
2640
|
+
case "ic-button":
|
2641
|
+
if (!customElements.get(tagName)) {
|
2642
|
+
defineCustomElement$4();
|
2643
|
+
}
|
2644
|
+
break;
|
2645
|
+
case "ic-loading-indicator":
|
2646
|
+
if (!customElements.get(tagName)) {
|
2647
|
+
defineCustomElement$3();
|
2648
|
+
}
|
2649
|
+
break;
|
2650
|
+
case "ic-tooltip":
|
2651
|
+
if (!customElements.get(tagName)) {
|
2652
|
+
defineCustomElement$2();
|
2653
|
+
}
|
2654
|
+
break;
|
2655
|
+
case "ic-typography":
|
2656
|
+
if (!customElements.get(tagName)) {
|
2657
|
+
defineCustomElement$1();
|
2658
|
+
}
|
2659
|
+
break;
|
2660
|
+
} });
|
2661
|
+
}
|
2662
|
+
|
2663
|
+
export { Menu as M, defineCustomElement as d };
|
2664
|
+
|
2665
|
+
//# sourceMappingURL=ic-menu3.js.map
|