@pod-os/elements 0.7.1-92705ee.0 → 0.7.1-a71f01c.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{animation-5840e4df.js → animation-9bea118f.js} +115 -84
- package/dist/cjs/{app-globals-1aedd05c.js → app-globals-6352043e.js} +1 -1
- package/dist/cjs/{cubic-bezier-dcb7bfef.js → cubic-bezier-0b702a31.js} +13 -12
- package/dist/cjs/data-0c9489d7.js +1510 -0
- package/dist/cjs/dir-011f46ea.js +20 -0
- package/dist/cjs/elements.cjs.js +5 -5
- package/dist/cjs/focus-visible-2624ec15.js +76 -0
- package/dist/cjs/framework-delegate-437c0645.js +119 -0
- package/dist/cjs/{gesture-controller-fbbe9a65.js → gesture-controller-00a6b02f.js} +6 -2
- package/dist/cjs/{haptic-09e73337.js → haptic-7358cb0b.js} +37 -8
- package/dist/cjs/{hardware-back-button-01027575.js → hardware-back-button-25372ec7.js} +11 -8
- package/dist/cjs/{helpers-398ced09.js → helpers-cb08f5ae.js} +115 -15
- package/dist/cjs/{index-2067b305.js → index-1b07c737.js} +35 -24
- package/dist/cjs/{index-68ae43d2.js → index-2dc3637c.js} +34 -28
- package/dist/cjs/index-57b9fa9e.js +30 -0
- package/dist/cjs/{index-d01d9183.js → index-643851c6.js} +34 -19
- package/dist/cjs/index-731691ca.js +48 -0
- package/dist/cjs/{index-6bbae9b1.js → index-7d56774d.js} +12 -8
- package/dist/cjs/index-9fca5d6f.js +140 -0
- package/dist/cjs/index-b2a479e4.js +38 -0
- package/dist/cjs/{index-b4a9ece2.js → index-eaa0d16e.js} +7 -0
- package/dist/cjs/{tap-click-f24cb477.js → index-ed2ce04f.js} +37 -19
- package/dist/cjs/{input-shims-e959d9e2.js → input-shims-427999f7.js} +89 -38
- package/dist/cjs/ion-accordion-group.cjs.entry.js +205 -0
- package/dist/cjs/ion-accordion.cjs.entry.js +336 -0
- package/dist/cjs/ion-action-sheet_3.cjs.entry.js +865 -0
- package/dist/cjs/{ion-app_45.cjs.entry.js → ion-app_46.cjs.entry.js} +1906 -1492
- package/dist/cjs/ion-avatar.cjs.entry.js +2 -2
- package/dist/cjs/ion-back-button.cjs.entry.js +12 -11
- package/dist/cjs/ion-backdrop.cjs.entry.js +4 -4
- package/dist/cjs/ion-breadcrumb.cjs.entry.js +101 -0
- package/dist/cjs/ion-breadcrumbs.cjs.entry.js +137 -0
- package/dist/cjs/ion-buttons_3.cjs.entry.js +799 -0
- package/dist/cjs/ion-card-subtitle.cjs.entry.js +4 -4
- package/dist/cjs/{ion-list-header_3.cjs.entry.js → ion-checkbox_4.cjs.entry.js} +124 -23
- package/dist/cjs/ion-chip.cjs.entry.js +5 -10
- package/dist/cjs/ion-datetime-button.cjs.entry.js +346 -0
- package/dist/cjs/ion-datetime.cjs.entry.js +1548 -856
- package/dist/cjs/ion-fab-button.cjs.entry.js +26 -9
- package/dist/cjs/ion-fab-list.cjs.entry.js +4 -4
- package/dist/cjs/ion-fab.cjs.entry.js +15 -13
- package/dist/cjs/ion-img.cjs.entry.js +28 -4
- package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +5 -5
- package/dist/cjs/ion-infinite-scroll.cjs.entry.js +13 -13
- package/dist/cjs/ion-input.cjs.entry.js +57 -23
- package/dist/cjs/ion-item-option.cjs.entry.js +8 -8
- package/dist/cjs/ion-item-options.cjs.entry.js +5 -5
- package/dist/cjs/ion-item-sliding.cjs.entry.js +59 -63
- package/dist/cjs/ion-loading.cjs.entry.js +38 -37
- package/dist/cjs/ion-menu-button.cjs.entry.js +14 -12
- package/dist/cjs/ion-menu-toggle.cjs.entry.js +8 -7
- package/dist/cjs/ion-menu.cjs.entry.js +71 -57
- package/dist/cjs/ion-modal.cjs.entry.js +1386 -156
- package/dist/cjs/ion-nav-link.cjs.entry.js +5 -2
- package/dist/cjs/ion-nav.cjs.entry.js +177 -171
- package/dist/cjs/ion-picker-column.cjs.entry.js +25 -27
- package/dist/cjs/ion-picker.cjs.entry.js +22 -17
- package/dist/cjs/ion-popover.cjs.entry.js +1208 -182
- package/dist/cjs/ion-range.cjs.entry.js +137 -57
- package/dist/cjs/ion-refresher-content.cjs.entry.js +7 -12
- package/dist/cjs/ion-refresher.cjs.entry.js +150 -148
- package/dist/cjs/ion-reorder-group.cjs.entry.js +42 -35
- package/dist/cjs/ion-reorder.cjs.entry.js +5 -4
- package/dist/cjs/ion-route-redirect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route.cjs.entry.js +1 -1
- package/dist/cjs/ion-router-link.cjs.entry.js +5 -5
- package/dist/cjs/ion-router-outlet.cjs.entry.js +24 -20
- package/dist/cjs/ion-router.cjs.entry.js +291 -194
- package/dist/cjs/ion-segment-button.cjs.entry.js +10 -17
- package/dist/cjs/ion-segment.cjs.entry.js +127 -26
- package/dist/cjs/ion-select-option.cjs.entry.js +3 -3
- package/dist/cjs/ion-select.cjs.entry.js +113 -78
- package/dist/cjs/ion-slide.cjs.entry.js +3 -3
- package/dist/cjs/ion-slides.cjs.entry.js +26 -27
- package/dist/cjs/ion-spinner.cjs.entry.js +10 -9
- package/dist/cjs/ion-split-pane.cjs.entry.js +16 -12
- package/dist/cjs/ion-tab-bar.cjs.entry.js +16 -23
- package/dist/cjs/ion-tab-button.cjs.entry.js +6 -6
- package/dist/cjs/ion-tab.cjs.entry.js +4 -4
- package/dist/cjs/ion-tabs.cjs.entry.js +4 -5
- package/dist/cjs/ion-text.cjs.entry.js +3 -3
- package/dist/cjs/ion-textarea.cjs.entry.js +31 -29
- package/dist/cjs/ion-thumbnail.cjs.entry.js +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +50 -60
- package/dist/cjs/ion-toggle.cjs.entry.js +41 -22
- package/dist/cjs/ion-virtual-scroll.cjs.entry.js +39 -31
- package/dist/cjs/{ionic-global-56e10eb5.js → ionic-global-f2d95fd3.js} +112 -93
- package/dist/cjs/{ios.transition-32e4623d.js → ios.transition-0f31ec9a.js} +78 -53
- package/dist/cjs/{keyboard-9e8103e4.js → keyboard-79afcba2.js} +6 -3
- package/dist/cjs/keyboard-controller-a934d106.js +42 -0
- package/dist/cjs/loader.cjs.js +5 -5
- package/dist/cjs/{md.transition-169c54f0.js → md.transition-d2a33a23.js} +15 -17
- package/dist/cjs/{menu-toggle-util-087678e0.js → menu-toggle-util-0a43ff7c.js} +5 -2
- package/dist/cjs/{overlays-49fe9ba7.js → overlays-f7d24abf.js} +190 -72
- package/dist/cjs/spinner-configs-cd0abbeb.js +147 -0
- package/dist/cjs/{status-tap-ada894ff.js → status-tap-beaa3a71.js} +10 -5
- package/dist/cjs/{swipe-back-c4a778df.js → swipe-back-666ea8e6.js} +34 -15
- package/dist/cjs/{theme-2259d0f5.js → theme-fc63803b.js} +9 -5
- package/dist/collection/collection-manifest.json +10 -4
- package/dist/collection/components/pos-rich-link/pos-rich-link.js +1 -1
- package/dist/components/ResourceAware.js +5 -0
- package/dist/components/action-sheet.js +309 -0
- package/dist/{esm/ion-alert.entry.js → components/alert.js} +150 -105
- package/dist/{esm/animation-fe6ed422.js → components/animation.js} +115 -84
- package/dist/components/app.js +112 -0
- package/dist/components/backdrop.js +82 -0
- package/dist/components/badge.js +42 -0
- package/dist/{esm/button-active-fd9d6d91.js → components/button-active.js} +9 -6
- package/dist/components/button.js +207 -0
- package/dist/{esm/ion-buttons.entry.js → components/buttons.js} +28 -12
- package/dist/components/card-content.js +40 -0
- package/dist/components/card-header.js +51 -0
- package/dist/components/card-title.js +43 -0
- package/dist/components/card.js +102 -0
- package/dist/{esm/ion-checkbox.entry.js → components/checkbox.js} +42 -24
- package/dist/components/col.js +161 -0
- package/dist/components/content.js +356 -0
- package/dist/{esm/cubic-bezier-108b8579.js → components/cubic-bezier.js} +13 -12
- package/dist/components/data.js +1463 -0
- package/dist/components/dir.js +18 -0
- package/dist/components/focus-visible.js +74 -0
- package/dist/components/footer.js +149 -0
- package/dist/components/framework-delegate.js +115 -0
- package/dist/{esm/gesture-controller-8f35af24.js → components/gesture-controller.js} +6 -2
- package/dist/components/grid.js +41 -0
- package/dist/{esm/haptic-c424e670.js → components/haptic.js} +38 -9
- package/dist/{esm/hardware-back-button-bb4c578a.js → components/hardware-back-button.js} +11 -8
- package/dist/components/header.js +360 -0
- package/dist/{esm/helpers-44e3bd9f.js → components/helpers.js} +113 -16
- package/dist/components/icon.js +367 -0
- package/dist/components/index.d.ts +41 -0
- package/dist/components/index.js +123 -0
- package/dist/components/index10.js +28 -0
- package/dist/{esm/tap-click-a7e55ef5.js → components/index11.js} +37 -19
- package/dist/components/index2.js +25 -0
- package/dist/{esm/index-8d682224.js → components/index3.js} +12 -8
- package/dist/components/index4.js +34 -0
- package/dist/components/index5.js +128 -0
- package/dist/{esm/index-97199683.js → components/index6.js} +34 -28
- package/dist/{esm/index-8a463a85.js → components/index7.js} +35 -24
- package/dist/{custom-elements/index.js → components/index8.js} +1049 -20945
- package/dist/{esm/index-3a1bd803.js → components/index9.js} +35 -20
- package/dist/{custom-elements → components}/input-shims.js +88 -38
- package/dist/components/ion-accordion-group.js +228 -0
- package/dist/components/ion-accordion.js +365 -0
- package/dist/components/ion-action-sheet.js +6 -0
- package/dist/components/ion-alert.js +6 -0
- package/dist/components/ion-app.js +6 -0
- package/dist/components/ion-avatar.js +39 -0
- package/dist/components/ion-back-button.js +128 -0
- package/dist/components/ion-backdrop.js +6 -0
- package/dist/components/ion-badge.js +6 -0
- package/dist/components/ion-breadcrumb.js +135 -0
- package/dist/components/ion-breadcrumbs.js +158 -0
- package/dist/components/ion-button.js +6 -0
- package/dist/components/ion-buttons.js +6 -0
- package/dist/components/ion-card-content.js +6 -0
- package/dist/components/ion-card-header.js +6 -0
- package/dist/components/ion-card-subtitle.js +46 -0
- package/dist/components/ion-card-title.js +6 -0
- package/dist/components/ion-card.js +6 -0
- package/dist/components/ion-checkbox.js +6 -0
- package/dist/components/ion-chip.js +59 -0
- package/dist/components/ion-col.js +6 -0
- package/dist/components/ion-content.js +6 -0
- package/dist/components/ion-datetime-button.js +375 -0
- package/dist/components/ion-datetime.js +1802 -0
- package/dist/components/ion-fab-button.js +149 -0
- package/dist/components/ion-fab-list.js +62 -0
- package/dist/components/ion-fab.js +97 -0
- package/dist/components/ion-footer.js +6 -0
- package/dist/components/ion-grid.js +6 -0
- package/dist/components/ion-header.js +6 -0
- package/dist/components/ion-icon.js +6 -0
- package/dist/components/ion-img.js +120 -0
- package/dist/components/ion-infinite-scroll-content.js +59 -0
- package/dist/components/ion-infinite-scroll.js +223 -0
- package/dist/components/ion-input.js +352 -0
- package/dist/components/ion-item-divider.js +6 -0
- package/dist/components/ion-item-group.js +6 -0
- package/dist/components/ion-item-option.js +89 -0
- package/dist/components/ion-item-options.js +63 -0
- package/dist/components/ion-item-sliding.js +419 -0
- package/dist/components/ion-item.js +6 -0
- package/dist/components/ion-label.js +6 -0
- package/dist/components/ion-list-header.js +6 -0
- package/dist/components/ion-list.js +6 -0
- package/dist/components/ion-loading.js +256 -0
- package/dist/components/ion-menu-button.js +107 -0
- package/dist/components/ion-menu-toggle.js +62 -0
- package/dist/components/ion-menu.js +611 -0
- package/dist/components/ion-modal.js +1765 -0
- package/dist/components/ion-nav-link.js +65 -0
- package/dist/components/ion-nav.js +905 -0
- package/dist/components/ion-note.js +6 -0
- package/dist/components/ion-picker-column-internal.js +6 -0
- package/dist/components/ion-picker-column.js +6 -0
- package/dist/components/ion-picker-internal.js +6 -0
- package/dist/components/ion-picker.js +263 -0
- package/dist/components/ion-popover.js +6 -0
- package/dist/components/ion-progress-bar.js +6 -0
- package/dist/components/ion-radio-group.js +6 -0
- package/dist/components/ion-radio.js +6 -0
- package/dist/components/ion-range.js +550 -0
- package/dist/components/ion-refresher-content.js +64 -0
- package/dist/components/ion-refresher.js +826 -0
- package/dist/components/ion-reorder-group.js +303 -0
- package/dist/components/ion-reorder.js +58 -0
- package/dist/components/ion-ripple-effect.js +6 -0
- package/dist/components/ion-route-redirect.js +40 -0
- package/dist/components/ion-route.js +68 -0
- package/dist/components/ion-router-link.js +59 -0
- package/dist/components/ion-router-outlet.js +223 -0
- package/dist/components/ion-router.js +852 -0
- package/dist/components/ion-row.js +6 -0
- package/dist/components/ion-searchbar.js +6 -0
- package/dist/components/ion-segment-button.js +128 -0
- package/dist/components/ion-segment.js +463 -0
- package/dist/components/ion-select-option.js +44 -0
- package/dist/components/ion-select-popover.js +6 -0
- package/dist/components/ion-select.js +596 -0
- package/dist/components/ion-skeleton-text.js +6 -0
- package/dist/components/ion-slide.js +38 -0
- package/dist/components/ion-slides.js +423 -0
- package/dist/components/ion-spinner.js +6 -0
- package/dist/components/ion-split-pane.js +179 -0
- package/dist/components/ion-tab-bar.js +86 -0
- package/dist/components/ion-tab-button.js +132 -0
- package/dist/components/ion-tab.js +86 -0
- package/dist/components/ion-tabs.js +176 -0
- package/dist/components/ion-text.js +40 -0
- package/dist/components/ion-textarea.js +287 -0
- package/dist/components/ion-thumbnail.js +34 -0
- package/dist/components/ion-title.js +6 -0
- package/dist/components/ion-toast.js +317 -0
- package/dist/components/ion-toggle.js +207 -0
- package/dist/components/ion-toolbar.js +6 -0
- package/dist/components/ion-virtual-scroll.js +588 -0
- package/dist/components/ionic-global.js +226 -0
- package/dist/{custom-elements → components}/ios.transition.js +75 -50
- package/dist/components/item-divider.js +54 -0
- package/dist/components/item-group.js +41 -0
- package/dist/components/item.js +323 -0
- package/dist/components/keyboard-controller.js +40 -0
- package/dist/{custom-elements → components}/keyboard.js +6 -3
- package/dist/components/label.js +95 -0
- package/dist/components/list-header.js +45 -0
- package/dist/components/list.js +66 -0
- package/dist/{custom-elements → components}/md.transition.js +12 -14
- package/dist/{esm/menu-toggle-util-562dfc9c.js → components/menu-toggle-util.js} +5 -2
- package/dist/components/note.js +42 -0
- package/dist/{esm/overlays-fc9a0625.js → components/overlays.js} +188 -72
- package/dist/components/picker-column-internal.js +315 -0
- package/dist/components/picker-column.js +343 -0
- package/dist/components/picker-internal.js +486 -0
- package/dist/components/popover.js +1440 -0
- package/dist/components/pos-app-browser.d.ts +11 -0
- package/dist/components/pos-app-browser.js +299 -0
- package/dist/components/pos-app-generic.d.ts +11 -0
- package/dist/components/pos-app-generic.js +6 -0
- package/dist/components/pos-app-generic2.js +194 -0
- package/dist/components/pos-app-image-viewer.d.ts +11 -0
- package/dist/components/pos-app-image-viewer.js +6 -0
- package/dist/components/pos-app-image-viewer2.js +162 -0
- package/dist/components/pos-app-rdf-document.d.ts +11 -0
- package/dist/components/pos-app-rdf-document.js +6 -0
- package/dist/components/pos-app-rdf-document2.js +170 -0
- package/dist/components/pos-app.d.ts +11 -0
- package/dist/components/pos-app.js +6 -0
- package/dist/components/pos-app2.js +53 -0
- package/dist/components/pos-description.d.ts +11 -0
- package/dist/components/pos-description.js +6 -0
- package/dist/components/pos-description2.js +38 -0
- package/dist/components/pos-image.d.ts +11 -0
- package/dist/components/pos-image.js +6 -0
- package/dist/components/pos-image2.js +117 -0
- package/dist/components/pos-label.d.ts +11 -0
- package/dist/components/pos-label.js +6 -0
- package/dist/components/pos-label2.js +38 -0
- package/dist/components/pos-literals.d.ts +11 -0
- package/dist/components/pos-literals.js +6 -0
- package/dist/components/pos-literals2.js +87 -0
- package/dist/components/pos-login.d.ts +11 -0
- package/dist/components/pos-login.js +6 -0
- package/dist/components/pos-login2.js +120 -0
- package/dist/components/pos-navigation-bar.d.ts +11 -0
- package/dist/components/pos-navigation-bar.js +6 -0
- package/dist/components/pos-navigation-bar2.js +52 -0
- package/dist/components/pos-picture.d.ts +11 -0
- package/dist/components/pos-picture.js +6 -0
- package/dist/components/pos-picture2.js +62 -0
- package/dist/components/pos-relations.d.ts +11 -0
- package/dist/components/pos-relations.js +6 -0
- package/dist/components/pos-relations2.js +135 -0
- package/dist/components/pos-resource.d.ts +11 -0
- package/dist/components/pos-resource.js +6 -0
- package/dist/components/pos-resource2.js +126 -0
- package/dist/components/pos-reverse-relations.d.ts +11 -0
- package/dist/components/pos-reverse-relations.js +6 -0
- package/dist/components/pos-reverse-relations2.js +135 -0
- package/dist/components/pos-rich-link.d.ts +11 -0
- package/dist/components/pos-rich-link.js +6 -0
- package/dist/components/pos-rich-link2.js +106 -0
- package/dist/components/pos-router.d.ts +11 -0
- package/dist/components/pos-router.js +6 -0
- package/dist/components/pos-router2.js +813 -0
- package/dist/components/pos-subjects.d.ts +11 -0
- package/dist/components/pos-subjects.js +6 -0
- package/dist/components/pos-subjects2.js +125 -0
- package/dist/components/pos-type-badges.d.ts +11 -0
- package/dist/components/pos-type-badges.js +6 -0
- package/dist/components/pos-type-badges2.js +69 -0
- package/dist/components/pos-type-router.d.ts +11 -0
- package/dist/components/pos-type-router.js +6 -0
- package/dist/components/pos-type-router2.js +241 -0
- package/dist/components/progress-bar.js +91 -0
- package/dist/components/radio-group.js +139 -0
- package/dist/components/radio.js +135 -0
- package/dist/components/ripple-effect.js +107 -0
- package/dist/components/row.js +31 -0
- package/dist/components/searchbar.js +412 -0
- package/dist/components/select-popover.js +174 -0
- package/dist/components/session.js +202 -0
- package/dist/components/skeleton-text.js +46 -0
- package/dist/components/spinner.js +224 -0
- package/dist/{custom-elements → components}/status-tap.js +8 -4
- package/dist/{custom-elements → components}/swipe-back.js +33 -13
- package/dist/{custom-elements → components}/swiper.bundle.js +0 -0
- package/dist/{esm/theme-d21826a7.js → components/theme.js} +9 -5
- package/dist/components/title.js +66 -0
- package/dist/components/toolbar.js +87 -0
- package/dist/elements/elements.css +1 -1
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/p-00f19b1d.js +4 -0
- package/dist/elements/p-0587332d.entry.js +1 -0
- package/dist/elements/p-07f54139.entry.js +7 -0
- package/dist/elements/{p-cfc0e54d.js → p-0991c811.js} +3 -0
- package/dist/elements/p-0a69a563.entry.js +1 -0
- package/dist/elements/p-0d284fe0.entry.js +1 -0
- package/dist/elements/p-116437b0.entry.js +13 -0
- package/dist/elements/p-12880671.entry.js +1 -0
- package/dist/elements/p-14ccd586.entry.js +1 -0
- package/dist/elements/{p-83d45051.entry.js → p-14df6ac0.entry.js} +1 -1
- package/dist/elements/{p-e860be6a.entry.js → p-17079f06.entry.js} +1 -1
- package/dist/elements/p-19e4a688.js +4 -0
- package/dist/elements/p-1afc4eb4.js +4 -0
- package/dist/elements/p-1beaf6bf.js +4 -0
- package/dist/elements/p-1d1c6a6f.entry.js +1 -0
- package/dist/elements/{p-31d30e42.entry.js → p-1d98f84b.entry.js} +1 -1
- package/dist/elements/p-1e617706.entry.js +7 -0
- package/dist/elements/p-278ca4c9.js +4 -0
- package/dist/elements/p-27f5629c.entry.js +1 -0
- package/dist/elements/p-29c0f03f.js +4 -0
- package/dist/elements/p-2a629468.entry.js +4 -0
- package/dist/elements/p-2da59aca.js +4 -0
- package/dist/elements/p-3152143f.js +4 -0
- package/dist/elements/p-343ff720.entry.js +7 -0
- package/dist/elements/p-36d4c9a8.js +4 -0
- package/dist/elements/p-3a30dfb2.entry.js +1 -0
- package/dist/elements/p-3c013bf1.entry.js +1 -0
- package/dist/elements/{p-74ba1e42.entry.js → p-3c318da5.entry.js} +1 -1
- package/dist/elements/p-3cee3222.entry.js +1 -0
- package/dist/elements/p-3d0f59af.entry.js +7 -0
- package/dist/elements/p-41cb5688.entry.js +1 -0
- package/dist/elements/p-480b3c4f.entry.js +1 -0
- package/dist/elements/p-4e9d8f18.entry.js +1 -0
- package/dist/elements/p-53e23176.js +2 -0
- package/dist/elements/p-548524f3.js +4 -0
- package/dist/elements/p-5739fa41.entry.js +1 -0
- package/dist/elements/p-5808c505.js +1 -0
- package/dist/elements/p-58a8cc2a.js +4 -0
- package/dist/elements/p-6035415e.entry.js +1 -0
- package/dist/elements/p-60eeae90.js +4 -0
- package/dist/elements/p-667550a9.entry.js +14 -0
- package/dist/elements/p-67777478.entry.js +1 -0
- package/dist/elements/p-6ab826e1.entry.js +1 -0
- package/dist/elements/p-6f5a2827.entry.js +1 -0
- package/dist/elements/p-7916ecc5.entry.js +1 -0
- package/dist/elements/p-79f06b80.entry.js +1 -0
- package/dist/elements/p-7d0def79.js +5 -0
- package/dist/elements/p-8112afea.js +4 -0
- package/dist/elements/p-83678d7d.entry.js +4 -0
- package/dist/elements/p-87e45c94.entry.js +1 -0
- package/dist/elements/p-8f80768f.entry.js +4 -0
- package/dist/elements/p-8fe0433b.js +4 -0
- package/dist/elements/{p-4cb27b48.entry.js → p-9147d82b.entry.js} +1 -1
- package/dist/elements/p-96aeb07a.entry.js +1 -0
- package/dist/elements/p-97abb434.entry.js +1 -0
- package/dist/elements/p-98497a4b.entry.js +1 -0
- package/dist/elements/p-9c719139.js +4 -0
- package/dist/elements/p-9ca37332.js +4 -0
- package/dist/elements/{p-37de7110.js → p-9d48def2.js} +3 -0
- package/dist/elements/p-a805f2f9.entry.js +1 -0
- package/dist/elements/p-a86a5bfa.entry.js +1 -0
- package/dist/elements/{p-9c1dbe52.entry.js → p-ac34eab7.entry.js} +1 -1
- package/dist/elements/p-ad366eab.entry.js +4 -0
- package/dist/elements/p-aef3a931.js +7 -0
- package/dist/elements/p-b0537eb3.entry.js +1 -0
- package/dist/elements/p-b41e66f0.entry.js +1 -0
- package/dist/elements/p-b47e7091.entry.js +1 -0
- package/dist/elements/p-b840320e.js +4 -0
- package/dist/elements/p-b934ac5d.entry.js +1 -0
- package/dist/elements/p-bc63f4b6.entry.js +1 -0
- package/dist/elements/p-bd12806f.entry.js +1 -0
- package/dist/elements/p-bf90022d.entry.js +4 -0
- package/dist/elements/p-c16d38d5.js +4 -0
- package/dist/elements/p-c84205a3.js +4 -0
- package/dist/elements/{p-06675ac7.entry.js → p-cbe318f8.entry.js} +1 -1
- package/dist/elements/p-cfed7395.js +4 -0
- package/dist/elements/p-d3e75c94.entry.js +1 -0
- package/dist/elements/p-d8e7ebf4.entry.js +7 -0
- package/dist/elements/p-d9880221.entry.js +4 -0
- package/dist/elements/p-da5db8fb.entry.js +1 -0
- package/dist/elements/{p-91fe653f.js → p-dcc6b03c.js} +3 -0
- package/dist/elements/{p-305e246c.entry.js → p-dd846020.entry.js} +1 -1
- package/dist/elements/p-dffd8689.js +4 -0
- package/dist/elements/p-e3bcb6e8.entry.js +1 -0
- package/dist/elements/p-e495a095.js +4 -0
- package/dist/elements/p-e59d9789.entry.js +1 -0
- package/dist/elements/p-e5fc7d42.entry.js +1 -0
- package/dist/elements/{p-aaa8393e.entry.js → p-eb137e9d.entry.js} +1 -1
- package/dist/elements/p-f4e54a17.js +7 -0
- package/dist/elements/p-f67d0717.entry.js +1 -0
- package/dist/elements/p-f7f4c640.js +1 -0
- package/dist/elements/p-f851b91a.js +4 -0
- package/dist/elements/p-fb27ee76.entry.js +1 -0
- package/dist/elements/p-fbddca35.entry.js +1 -0
- package/dist/elements/p-fdac5f3a.js +4 -0
- package/dist/elements/p-feb0cea8.entry.js +4 -0
- package/dist/esm/animation-801a007a.js +986 -0
- package/dist/esm/{app-globals-27d92837.js → app-globals-05a3abfb.js} +1 -1
- package/dist/esm/cubic-bezier-538b6253.js +90 -0
- package/dist/esm/data-62c81c24.js +1463 -0
- package/dist/esm/dir-defb16c6.js +18 -0
- package/dist/esm/elements.js +5 -5
- package/dist/esm/focus-visible-78d55799.js +74 -0
- package/dist/esm/framework-delegate-7e2b767b.js +115 -0
- package/dist/esm/gesture-controller-c466ff14.js +195 -0
- package/dist/esm/haptic-e7d5ef4d.js +135 -0
- package/dist/esm/hardware-back-button-242191a7.js +71 -0
- package/dist/esm/helpers-aeff219b.js +410 -0
- package/dist/esm/index-0dbaca1a.js +28 -0
- package/dist/esm/index-1f3d8582.js +34 -0
- package/dist/esm/index-2be9a18b.js +312 -0
- package/dist/esm/index-51e4a829.js +137 -0
- package/dist/esm/index-6048aed6.js +224 -0
- package/dist/esm/index-65ecd543.js +25 -0
- package/dist/{custom-elements/tap-click.js → esm/index-b212db1c.js} +37 -19
- package/dist/esm/{index-e4deec27.js → index-cb938ffb.js} +7 -1
- package/dist/esm/index-d39eb62b.js +463 -0
- package/dist/esm/index-ebf7f059.js +128 -0
- package/dist/esm/{input-shims-3b48722f.js → input-shims-8a389148.js} +89 -38
- package/dist/esm/ion-accordion-group.entry.js +201 -0
- package/dist/esm/ion-accordion.entry.js +332 -0
- package/dist/esm/ion-action-sheet_3.entry.js +859 -0
- package/dist/esm/{ion-app_45.entry.js → ion-app_46.entry.js} +1906 -1493
- package/dist/esm/ion-avatar.entry.js +2 -2
- package/dist/esm/ion-back-button.entry.js +12 -11
- package/dist/esm/ion-backdrop.entry.js +4 -4
- package/dist/esm/ion-breadcrumb.entry.js +97 -0
- package/dist/esm/ion-breadcrumbs.entry.js +133 -0
- package/dist/esm/ion-buttons_3.entry.js +793 -0
- package/dist/esm/ion-card-subtitle.entry.js +4 -4
- package/dist/esm/{ion-list-header_3.entry.js → ion-checkbox_4.entry.js} +124 -24
- package/dist/esm/ion-chip.entry.js +5 -10
- package/dist/esm/ion-datetime-button.entry.js +342 -0
- package/dist/esm/ion-datetime.entry.js +1548 -856
- package/dist/esm/ion-fab-button.entry.js +26 -9
- package/dist/esm/ion-fab-list.entry.js +4 -4
- package/dist/esm/ion-fab.entry.js +15 -13
- package/dist/esm/ion-img.entry.js +28 -4
- package/dist/esm/ion-infinite-scroll-content.entry.js +5 -5
- package/dist/esm/ion-infinite-scroll.entry.js +13 -13
- package/dist/esm/ion-input.entry.js +57 -23
- package/dist/esm/ion-item-option.entry.js +8 -8
- package/dist/esm/ion-item-options.entry.js +5 -5
- package/dist/esm/ion-item-sliding.entry.js +59 -63
- package/dist/esm/ion-loading.entry.js +38 -37
- package/dist/esm/ion-menu-button.entry.js +14 -12
- package/dist/esm/ion-menu-toggle.entry.js +8 -7
- package/dist/esm/ion-menu.entry.js +71 -57
- package/dist/esm/ion-modal.entry.js +1377 -147
- package/dist/esm/ion-nav-link.entry.js +5 -2
- package/dist/esm/ion-nav.entry.js +177 -171
- package/dist/esm/ion-picker-column.entry.js +25 -27
- package/dist/esm/ion-picker.entry.js +22 -17
- package/dist/esm/ion-popover.entry.js +1208 -182
- package/dist/esm/ion-range.entry.js +137 -57
- package/dist/esm/ion-refresher-content.entry.js +7 -12
- package/dist/esm/ion-refresher.entry.js +149 -147
- package/dist/esm/ion-reorder-group.entry.js +42 -35
- package/dist/esm/ion-reorder.entry.js +5 -4
- package/dist/esm/ion-route-redirect.entry.js +1 -1
- package/dist/esm/ion-route.entry.js +1 -1
- package/dist/esm/ion-router-link.entry.js +5 -5
- package/dist/esm/ion-router-outlet.entry.js +24 -20
- package/dist/esm/ion-router.entry.js +291 -194
- package/dist/esm/ion-segment-button.entry.js +10 -17
- package/dist/esm/ion-segment.entry.js +127 -26
- package/dist/esm/ion-select-option.entry.js +3 -3
- package/dist/esm/ion-select.entry.js +113 -78
- package/dist/esm/ion-slide.entry.js +3 -3
- package/dist/esm/ion-slides.entry.js +26 -27
- package/dist/esm/ion-spinner.entry.js +10 -9
- package/dist/esm/ion-split-pane.entry.js +16 -12
- package/dist/esm/ion-tab-bar.entry.js +16 -23
- package/dist/esm/ion-tab-button.entry.js +6 -6
- package/dist/esm/ion-tab.entry.js +4 -4
- package/dist/esm/ion-tabs.entry.js +4 -5
- package/dist/esm/ion-text.entry.js +3 -3
- package/dist/esm/ion-textarea.entry.js +31 -29
- package/dist/esm/ion-thumbnail.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +50 -60
- package/dist/esm/ion-toggle.entry.js +41 -22
- package/dist/esm/ion-virtual-scroll.entry.js +39 -31
- package/dist/esm/{ionic-global-2e28f7c7.js → ionic-global-6cd57191.js} +112 -93
- package/dist/esm/{ios.transition-a783e3cd.js → ios.transition-bbd952f2.js} +78 -53
- package/dist/esm/{keyboard-e6abcb80.js → keyboard-413afe04.js} +6 -3
- package/dist/esm/keyboard-controller-33693bc2.js +40 -0
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{md.transition-5a4a8c82.js → md.transition-5170a6d3.js} +15 -17
- package/dist/esm/menu-toggle-util-82bf888a.js +12 -0
- package/dist/esm/overlays-bd4abb68.js +502 -0
- package/dist/esm/spinner-configs-cbcd1f62.js +145 -0
- package/dist/esm/{status-tap-69e62ad6.js → status-tap-ad757b8a.js} +10 -5
- package/dist/esm/swipe-back-7ef22876.js +69 -0
- package/dist/esm/theme-7cf2cab0.js +43 -0
- package/dist/types/components.d.ts +0 -13
- package/package.json +7 -8
- package/dist/cjs/button-active-c14dab31.js +0 -66
- package/dist/cjs/focus-visible-16c98640.js +0 -45
- package/dist/cjs/framework-delegate-c45292a3.js +0 -37
- package/dist/cjs/ion-action-sheet.cjs.entry.js +0 -265
- package/dist/cjs/ion-alert.cjs.entry.js +0 -456
- package/dist/cjs/ion-buttons.cjs.entry.js +0 -42
- package/dist/cjs/ion-checkbox.cjs.entry.js +0 -117
- package/dist/cjs/ion-note.cjs.entry.js +0 -29
- package/dist/cjs/ion-select-popover.cjs.entry.js +0 -35
- package/dist/cjs/spinner-configs-fb16b986.js +0 -112
- package/dist/cjs/test-component.cjs.entry.js +0 -13
- package/dist/collection/test/TestComponent.js +0 -3
- package/dist/collection/test/mockPodOS.js +0 -35
- package/dist/collection/test/renderFunctionalComponent.js +0 -8
- package/dist/custom-elements/focus-visible.js +0 -43
- package/dist/custom-elements/index.d.ts +0 -165
- package/dist/elements/p-03bda390.js +0 -1
- package/dist/elements/p-0be044f1.entry.js +0 -1
- package/dist/elements/p-119c7c6c.entry.js +0 -1
- package/dist/elements/p-14c7c3ea.entry.js +0 -1
- package/dist/elements/p-1d4a2c61.js +0 -1
- package/dist/elements/p-1d894ac4.entry.js +0 -1
- package/dist/elements/p-1dafa1ce.entry.js +0 -1
- package/dist/elements/p-23b89ccb.entry.js +0 -1
- package/dist/elements/p-2c03b9ab.entry.js +0 -1
- package/dist/elements/p-346985f2.js +0 -1
- package/dist/elements/p-360f1c62.entry.js +0 -1
- package/dist/elements/p-373e1f25.entry.js +0 -1
- package/dist/elements/p-40547acb.entry.js +0 -1
- package/dist/elements/p-40b68014.entry.js +0 -1
- package/dist/elements/p-42e4f702.entry.js +0 -1
- package/dist/elements/p-489807e5.js +0 -1
- package/dist/elements/p-4ad72d54.entry.js +0 -1
- package/dist/elements/p-4cca7b5e.entry.js +0 -1
- package/dist/elements/p-4f24d306.js +0 -1
- package/dist/elements/p-519d6a53.entry.js +0 -1
- package/dist/elements/p-536e8e52.entry.js +0 -1
- package/dist/elements/p-599bb53f.entry.js +0 -1
- package/dist/elements/p-5eb7a546.js +0 -1
- package/dist/elements/p-60df2bed.entry.js +0 -1
- package/dist/elements/p-65133e33.js +0 -1
- package/dist/elements/p-6693fce8.js +0 -1
- package/dist/elements/p-689bdcc1.entry.js +0 -1
- package/dist/elements/p-70713b3d.entry.js +0 -1
- package/dist/elements/p-707d5d76.js +0 -1
- package/dist/elements/p-7212b7f2.js +0 -1
- package/dist/elements/p-73992898.entry.js +0 -1
- package/dist/elements/p-792c1e0f.entry.js +0 -1
- package/dist/elements/p-7e5300af.js +0 -2
- package/dist/elements/p-8068987c.entry.js +0 -1
- package/dist/elements/p-83accf46.entry.js +0 -1
- package/dist/elements/p-86635d06.entry.js +0 -1
- package/dist/elements/p-874c2b44.js +0 -1
- package/dist/elements/p-89c12ce8.entry.js +0 -1
- package/dist/elements/p-8bcba3f7.entry.js +0 -1
- package/dist/elements/p-8c759f51.entry.js +0 -1
- package/dist/elements/p-8f945e6b.entry.js +0 -1
- package/dist/elements/p-9300ab6a.js +0 -1
- package/dist/elements/p-93cacd51.entry.js +0 -1
- package/dist/elements/p-9408d0b4.entry.js +0 -1
- package/dist/elements/p-98c79eda.js +0 -1
- package/dist/elements/p-99f8abed.js +0 -1
- package/dist/elements/p-9ca7e079.js +0 -1
- package/dist/elements/p-a4648b74.entry.js +0 -1
- package/dist/elements/p-aab0f63c.js +0 -1
- package/dist/elements/p-ad4e2295.entry.js +0 -1
- package/dist/elements/p-afb8f7d5.entry.js +0 -1
- package/dist/elements/p-b055ec44.js +0 -1
- package/dist/elements/p-b078d63b.entry.js +0 -1
- package/dist/elements/p-b3460325.entry.js +0 -1
- package/dist/elements/p-b5406b58.entry.js +0 -1
- package/dist/elements/p-b5ef0c91.entry.js +0 -1
- package/dist/elements/p-b6ba623e.entry.js +0 -1
- package/dist/elements/p-b9926d8b.entry.js +0 -1
- package/dist/elements/p-bfd4cfcd.entry.js +0 -1
- package/dist/elements/p-c08dd7d0.entry.js +0 -1
- package/dist/elements/p-c0db9c51.entry.js +0 -1
- package/dist/elements/p-c1e7fbfb.js +0 -1
- package/dist/elements/p-ca69d6c9.js +0 -1
- package/dist/elements/p-cc4cb1ac.entry.js +0 -1
- package/dist/elements/p-cf8a7031.entry.js +0 -1
- package/dist/elements/p-cff82b6f.js +0 -1
- package/dist/elements/p-d01009b8.entry.js +0 -67
- package/dist/elements/p-d6d1e65f.entry.js +0 -1
- package/dist/elements/p-d9462b66.entry.js +0 -1
- package/dist/elements/p-e2e0fee9.entry.js +0 -1
- package/dist/elements/p-e642b266.entry.js +0 -1
- package/dist/elements/p-e953934f.entry.js +0 -1
- package/dist/elements/p-f0474f46.js +0 -1
- package/dist/elements/p-f10a94f6.entry.js +0 -1
- package/dist/elements/p-f2426182.entry.js +0 -1
- package/dist/elements/p-f327fd21.js +0 -1
- package/dist/elements/p-f84987ee.js +0 -1
- package/dist/elements/p-f8a3367d.entry.js +0 -1
- package/dist/esm/focus-visible-edb28f19.js +0 -43
- package/dist/esm/framework-delegate-9cd8048f.js +0 -34
- package/dist/esm/ion-action-sheet.entry.js +0 -261
- package/dist/esm/ion-note.entry.js +0 -25
- package/dist/esm/ion-select-popover.entry.js +0 -31
- package/dist/esm/spinner-configs-aaf2a1a9.js +0 -110
- package/dist/esm/swipe-back-d84cfc8a.js +0 -50
- package/dist/esm/test-component.entry.js +0 -9
- package/dist/types/test/TestComponent.d.ts +0 -2
- package/dist/types/test/mockPodOS.d.ts +0 -11
- package/dist/types/test/renderFunctionalComponent.d.ts +0 -1
|
@@ -1,247 +1,971 @@
|
|
|
1
|
-
import { r as registerInstance,
|
|
2
|
-
import { g as getIonMode } from './ionic-global-
|
|
3
|
-
import { a as attachComponent, d as detachComponent } from './framework-delegate-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import './
|
|
9
|
-
import './hardware-back-button-
|
|
1
|
+
import { r as registerInstance, d as createEvent, h, H as Host, c as getElement } from './index-cb938ffb.js';
|
|
2
|
+
import { g as getIonMode, a as isPlatform } from './ionic-global-6cd57191.js';
|
|
3
|
+
import { C as CoreDelegate, a as attachComponent, d as detachComponent } from './framework-delegate-7e2b767b.js';
|
|
4
|
+
import { r as raf, g as getElementRoot, e as addEventListener } from './helpers-aeff219b.js';
|
|
5
|
+
import { B as BACKDROP, p as prepareOverlay, d as dismiss, e as eventMethod, a as present, j as focusFirstDescendant } from './overlays-bd4abb68.js';
|
|
6
|
+
import { g as getClassMap } from './theme-7cf2cab0.js';
|
|
7
|
+
import { d as deepReady } from './index-6048aed6.js';
|
|
8
|
+
import { c as createAnimation } from './animation-801a007a.js';
|
|
9
|
+
import './hardware-back-button-242191a7.js';
|
|
10
|
+
import './index-0dbaca1a.js';
|
|
10
11
|
|
|
12
|
+
/*!
|
|
13
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
14
|
+
*/
|
|
11
15
|
/**
|
|
12
|
-
*
|
|
16
|
+
* Returns the dimensions of the popover
|
|
17
|
+
* arrow on `ios` mode. If arrow is disabled
|
|
18
|
+
* returns (0, 0).
|
|
13
19
|
*/
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
const getArrowDimensions = (arrowEl) => {
|
|
21
|
+
if (!arrowEl) {
|
|
22
|
+
return { arrowWidth: 0, arrowHeight: 0 };
|
|
23
|
+
}
|
|
24
|
+
const { width, height } = arrowEl.getBoundingClientRect();
|
|
25
|
+
return { arrowWidth: width, arrowHeight: height };
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns the recommended dimensions of the popover
|
|
29
|
+
* that takes into account whether or not the width
|
|
30
|
+
* should match the trigger width.
|
|
31
|
+
*/
|
|
32
|
+
const getPopoverDimensions = (size, contentEl, triggerEl) => {
|
|
18
33
|
const contentDimentions = contentEl.getBoundingClientRect();
|
|
19
|
-
const contentWidth = contentDimentions.width;
|
|
20
34
|
const contentHeight = contentDimentions.height;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
let contentWidth = contentDimentions.width;
|
|
36
|
+
if (size === 'cover' && triggerEl) {
|
|
37
|
+
const triggerDimensions = triggerEl.getBoundingClientRect();
|
|
38
|
+
contentWidth = triggerDimensions.width;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
contentWidth,
|
|
42
|
+
contentHeight,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const configureDismissInteraction = (triggerEl, triggerAction, popoverEl, parentPopoverEl) => {
|
|
46
|
+
let dismissCallbacks = [];
|
|
47
|
+
const root = getElementRoot(parentPopoverEl);
|
|
48
|
+
const parentContentEl = root.querySelector('.popover-content');
|
|
49
|
+
switch (triggerAction) {
|
|
50
|
+
case 'hover':
|
|
51
|
+
dismissCallbacks = [
|
|
52
|
+
{
|
|
53
|
+
/**
|
|
54
|
+
* Do not use mouseover here
|
|
55
|
+
* as this will causes the event to
|
|
56
|
+
* be dispatched on each underlying
|
|
57
|
+
* element rather than on the popover
|
|
58
|
+
* content as a whole.
|
|
59
|
+
*/
|
|
60
|
+
eventName: 'mouseenter',
|
|
61
|
+
callback: (ev) => {
|
|
62
|
+
/**
|
|
63
|
+
* Do not dismiss the popover is we
|
|
64
|
+
* are hovering over its trigger.
|
|
65
|
+
* This would be easier if we used mouseover
|
|
66
|
+
* but this would cause the event to be dispatched
|
|
67
|
+
* more often than we would like, potentially
|
|
68
|
+
* causing performance issues.
|
|
69
|
+
*/
|
|
70
|
+
const element = document.elementFromPoint(ev.clientX, ev.clientY);
|
|
71
|
+
if (element === triggerEl) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
popoverEl.dismiss(undefined, undefined, false);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
break;
|
|
79
|
+
case 'context-menu':
|
|
80
|
+
case 'click':
|
|
81
|
+
default:
|
|
82
|
+
dismissCallbacks = [
|
|
83
|
+
{
|
|
84
|
+
eventName: 'click',
|
|
85
|
+
callback: (ev) => {
|
|
86
|
+
/**
|
|
87
|
+
* Do not dismiss the popover is we
|
|
88
|
+
* are hovering over its trigger.
|
|
89
|
+
*/
|
|
90
|
+
const target = ev.target;
|
|
91
|
+
const closestTrigger = target.closest('[data-ion-popover-trigger]');
|
|
92
|
+
if (closestTrigger === triggerEl) {
|
|
93
|
+
/**
|
|
94
|
+
* stopPropagation here so if the
|
|
95
|
+
* popover has dismissOnSelect="true"
|
|
96
|
+
* the popover does not dismiss since
|
|
97
|
+
* we just clicked a trigger element.
|
|
98
|
+
*/
|
|
99
|
+
ev.stopPropagation();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
popoverEl.dismiss(undefined, undefined, false);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
dismissCallbacks.forEach(({ eventName, callback }) => parentContentEl.addEventListener(eventName, callback));
|
|
109
|
+
return () => {
|
|
110
|
+
dismissCallbacks.forEach(({ eventName, callback }) => parentContentEl.removeEventListener(eventName, callback));
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Configures the triggerEl to respond
|
|
115
|
+
* to user interaction based upon the triggerAction
|
|
116
|
+
* prop that devs have defined.
|
|
117
|
+
*/
|
|
118
|
+
const configureTriggerInteraction = (triggerEl, triggerAction, popoverEl) => {
|
|
119
|
+
let triggerCallbacks = [];
|
|
120
|
+
/**
|
|
121
|
+
* Based upon the kind of trigger interaction
|
|
122
|
+
* the user wants, we setup the correct event
|
|
123
|
+
* listeners.
|
|
124
|
+
*/
|
|
125
|
+
switch (triggerAction) {
|
|
126
|
+
case 'hover':
|
|
127
|
+
let hoverTimeout;
|
|
128
|
+
triggerCallbacks = [
|
|
129
|
+
{
|
|
130
|
+
eventName: 'mouseenter',
|
|
131
|
+
callback: async (ev) => {
|
|
132
|
+
ev.stopPropagation();
|
|
133
|
+
if (hoverTimeout) {
|
|
134
|
+
clearTimeout(hoverTimeout);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Hovering over a trigger should not
|
|
138
|
+
* immediately open the next popover.
|
|
139
|
+
*/
|
|
140
|
+
hoverTimeout = setTimeout(() => {
|
|
141
|
+
raf(() => {
|
|
142
|
+
popoverEl.presentFromTrigger(ev);
|
|
143
|
+
hoverTimeout = undefined;
|
|
144
|
+
});
|
|
145
|
+
}, 100);
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
eventName: 'mouseleave',
|
|
150
|
+
callback: (ev) => {
|
|
151
|
+
if (hoverTimeout) {
|
|
152
|
+
clearTimeout(hoverTimeout);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* If mouse is over another popover
|
|
156
|
+
* that is not this popover then we should
|
|
157
|
+
* close this popover.
|
|
158
|
+
*/
|
|
159
|
+
const target = ev.relatedTarget;
|
|
160
|
+
if (!target) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (target.closest('ion-popover') !== popoverEl) {
|
|
164
|
+
popoverEl.dismiss(undefined, undefined, false);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
/**
|
|
170
|
+
* stopPropagation here prevents the popover
|
|
171
|
+
* from dismissing when dismiss-on-select="true".
|
|
172
|
+
*/
|
|
173
|
+
eventName: 'click',
|
|
174
|
+
callback: (ev) => ev.stopPropagation(),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
eventName: 'ionPopoverActivateTrigger',
|
|
178
|
+
callback: (ev) => popoverEl.presentFromTrigger(ev, true),
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
break;
|
|
182
|
+
case 'context-menu':
|
|
183
|
+
triggerCallbacks = [
|
|
184
|
+
{
|
|
185
|
+
eventName: 'contextmenu',
|
|
186
|
+
callback: (ev) => {
|
|
187
|
+
/**
|
|
188
|
+
* Prevents the platform context
|
|
189
|
+
* menu from appearing.
|
|
190
|
+
*/
|
|
191
|
+
ev.preventDefault();
|
|
192
|
+
popoverEl.presentFromTrigger(ev);
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
eventName: 'click',
|
|
197
|
+
callback: (ev) => ev.stopPropagation(),
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
eventName: 'ionPopoverActivateTrigger',
|
|
201
|
+
callback: (ev) => popoverEl.presentFromTrigger(ev, true),
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
break;
|
|
205
|
+
case 'click':
|
|
206
|
+
default:
|
|
207
|
+
triggerCallbacks = [
|
|
208
|
+
{
|
|
209
|
+
/**
|
|
210
|
+
* Do not do a stopPropagation() here
|
|
211
|
+
* because if you had two click triggers
|
|
212
|
+
* then clicking the first trigger and then
|
|
213
|
+
* clicking the second trigger would not cause
|
|
214
|
+
* the first popover to dismiss.
|
|
215
|
+
*/
|
|
216
|
+
eventName: 'click',
|
|
217
|
+
callback: (ev) => popoverEl.presentFromTrigger(ev),
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
eventName: 'ionPopoverActivateTrigger',
|
|
221
|
+
callback: (ev) => popoverEl.presentFromTrigger(ev, true),
|
|
222
|
+
},
|
|
223
|
+
];
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
triggerCallbacks.forEach(({ eventName, callback }) => triggerEl.addEventListener(eventName, callback));
|
|
227
|
+
triggerEl.setAttribute('data-ion-popover-trigger', 'true');
|
|
228
|
+
return () => {
|
|
229
|
+
triggerCallbacks.forEach(({ eventName, callback }) => triggerEl.removeEventListener(eventName, callback));
|
|
230
|
+
triggerEl.removeAttribute('data-ion-popover-trigger');
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Returns the index of an ion-item in an array of ion-items.
|
|
235
|
+
*/
|
|
236
|
+
const getIndexOfItem = (items, item) => {
|
|
237
|
+
if (!item || item.tagName !== 'ION-ITEM') {
|
|
238
|
+
return -1;
|
|
239
|
+
}
|
|
240
|
+
return items.findIndex((el) => el === item);
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Given an array of elements and a currently focused ion-item
|
|
244
|
+
* returns the next ion-item relative to the focused one or
|
|
245
|
+
* undefined.
|
|
246
|
+
*/
|
|
247
|
+
const getNextItem = (items, currentItem) => {
|
|
248
|
+
const currentItemIndex = getIndexOfItem(items, currentItem);
|
|
249
|
+
return items[currentItemIndex + 1];
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Given an array of elements and a currently focused ion-item
|
|
253
|
+
* returns the previous ion-item relative to the focused one or
|
|
254
|
+
* undefined.
|
|
255
|
+
*/
|
|
256
|
+
const getPrevItem = (items, currentItem) => {
|
|
257
|
+
const currentItemIndex = getIndexOfItem(items, currentItem);
|
|
258
|
+
return items[currentItemIndex - 1];
|
|
259
|
+
};
|
|
260
|
+
/** Focus the internal button of the ion-item */
|
|
261
|
+
const focusItem = (item) => {
|
|
262
|
+
const root = getElementRoot(item);
|
|
263
|
+
const button = root.querySelector('button');
|
|
264
|
+
if (button) {
|
|
265
|
+
raf(() => button.focus());
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Returns `true` if `el` has been designated
|
|
270
|
+
* as a trigger element for an ion-popover.
|
|
271
|
+
*/
|
|
272
|
+
const isTriggerElement = (el) => el.hasAttribute('data-ion-popover-trigger');
|
|
273
|
+
const configureKeyboardInteraction = (popoverEl) => {
|
|
274
|
+
const callback = async (ev) => {
|
|
275
|
+
var _a;
|
|
276
|
+
const activeElement = document.activeElement;
|
|
277
|
+
let items = [];
|
|
278
|
+
const targetTagName = (_a = ev.target) === null || _a === void 0 ? void 0 : _a.tagName;
|
|
279
|
+
/**
|
|
280
|
+
* Only handle custom keyboard interactions for the host popover element
|
|
281
|
+
* and children ion-item elements.
|
|
282
|
+
*/
|
|
283
|
+
if (targetTagName !== 'ION-POPOVER' && targetTagName !== 'ION-ITEM') {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Complex selectors with :not() are :not supported
|
|
288
|
+
* in older versions of Chromium so we need to do a
|
|
289
|
+
* try/catch here so errors are not thrown.
|
|
290
|
+
*/
|
|
291
|
+
try {
|
|
292
|
+
/**
|
|
293
|
+
* Select all ion-items that are not children of child popovers.
|
|
294
|
+
* i.e. only select ion-item elements that are part of this popover
|
|
295
|
+
*/
|
|
296
|
+
items = Array.from(popoverEl.querySelectorAll('ion-item:not(ion-popover ion-popover *):not([disabled])'));
|
|
297
|
+
/* eslint-disable-next-line */
|
|
298
|
+
}
|
|
299
|
+
catch (_b) { }
|
|
300
|
+
switch (ev.key) {
|
|
301
|
+
/**
|
|
302
|
+
* If we are in a child popover
|
|
303
|
+
* then pressing the left arrow key
|
|
304
|
+
* should close this popover and move
|
|
305
|
+
* focus to the popover that presented
|
|
306
|
+
* this one.
|
|
307
|
+
*/
|
|
308
|
+
case 'ArrowLeft':
|
|
309
|
+
const parentPopover = await popoverEl.getParentPopover();
|
|
310
|
+
if (parentPopover) {
|
|
311
|
+
popoverEl.dismiss(undefined, undefined, false);
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
314
|
+
/**
|
|
315
|
+
* ArrowDown should move focus to the next focusable ion-item.
|
|
316
|
+
*/
|
|
317
|
+
case 'ArrowDown':
|
|
318
|
+
// Disable movement/scroll with keyboard
|
|
319
|
+
ev.preventDefault();
|
|
320
|
+
const nextItem = getNextItem(items, activeElement);
|
|
321
|
+
if (nextItem !== undefined) {
|
|
322
|
+
focusItem(nextItem);
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
/**
|
|
326
|
+
* ArrowUp should move focus to the previous focusable ion-item.
|
|
327
|
+
*/
|
|
328
|
+
case 'ArrowUp':
|
|
329
|
+
// Disable movement/scroll with keyboard
|
|
330
|
+
ev.preventDefault();
|
|
331
|
+
const prevItem = getPrevItem(items, activeElement);
|
|
332
|
+
if (prevItem !== undefined) {
|
|
333
|
+
focusItem(prevItem);
|
|
334
|
+
}
|
|
335
|
+
break;
|
|
336
|
+
/**
|
|
337
|
+
* Home should move focus to the first focusable ion-item.
|
|
338
|
+
*/
|
|
339
|
+
case 'Home':
|
|
340
|
+
ev.preventDefault();
|
|
341
|
+
const firstItem = items[0];
|
|
342
|
+
if (firstItem !== undefined) {
|
|
343
|
+
focusItem(firstItem);
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
/**
|
|
347
|
+
* End should move focus to the last focusable ion-item.
|
|
348
|
+
*/
|
|
349
|
+
case 'End':
|
|
350
|
+
ev.preventDefault();
|
|
351
|
+
const lastItem = items[items.length - 1];
|
|
352
|
+
if (lastItem !== undefined) {
|
|
353
|
+
focusItem(lastItem);
|
|
354
|
+
}
|
|
355
|
+
break;
|
|
356
|
+
/**
|
|
357
|
+
* ArrowRight, Spacebar, or Enter should activate
|
|
358
|
+
* the currently focused trigger item to open a
|
|
359
|
+
* popover if the element is a trigger item.
|
|
360
|
+
*/
|
|
361
|
+
case 'ArrowRight':
|
|
362
|
+
case ' ':
|
|
363
|
+
case 'Enter':
|
|
364
|
+
if (activeElement && isTriggerElement(activeElement)) {
|
|
365
|
+
const rightEvent = new CustomEvent('ionPopoverActivateTrigger');
|
|
366
|
+
activeElement.dispatchEvent(rightEvent);
|
|
367
|
+
}
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
39
370
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
371
|
+
popoverEl.addEventListener('keydown', callback);
|
|
372
|
+
return () => popoverEl.removeEventListener('keydown', callback);
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Positions a popover by taking into account
|
|
376
|
+
* the reference point, preferred side, alignment
|
|
377
|
+
* and viewport dimensions.
|
|
378
|
+
*/
|
|
379
|
+
const getPopoverPosition = (isRTL, contentWidth, contentHeight, arrowWidth, arrowHeight, reference, side, align, defaultPosition, triggerEl, event) => {
|
|
380
|
+
var _a;
|
|
381
|
+
let referenceCoordinates = {
|
|
382
|
+
top: 0,
|
|
383
|
+
left: 0,
|
|
384
|
+
width: 0,
|
|
385
|
+
height: 0,
|
|
43
386
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
387
|
+
/**
|
|
388
|
+
* Calculate position relative to the
|
|
389
|
+
* x-y coordinates in the event that
|
|
390
|
+
* was passed in
|
|
391
|
+
*/
|
|
392
|
+
switch (reference) {
|
|
393
|
+
case 'event':
|
|
394
|
+
if (!event) {
|
|
395
|
+
return defaultPosition;
|
|
396
|
+
}
|
|
397
|
+
const mouseEv = event;
|
|
398
|
+
referenceCoordinates = {
|
|
399
|
+
top: mouseEv.clientY,
|
|
400
|
+
left: mouseEv.clientX,
|
|
401
|
+
width: 1,
|
|
402
|
+
height: 1,
|
|
403
|
+
};
|
|
404
|
+
break;
|
|
405
|
+
/**
|
|
406
|
+
* Calculate position relative to the bounding
|
|
407
|
+
* box on either the trigger element
|
|
408
|
+
* specified via the `trigger` prop or
|
|
409
|
+
* the target specified on the event
|
|
410
|
+
* that was passed in.
|
|
411
|
+
*/
|
|
412
|
+
case 'trigger':
|
|
413
|
+
default:
|
|
414
|
+
const customEv = event;
|
|
415
|
+
/**
|
|
416
|
+
* ionShadowTarget is used when we need to align the
|
|
417
|
+
* popover with an element inside of the shadow root
|
|
418
|
+
* of an Ionic component. Ex: Presenting a popover
|
|
419
|
+
* by clicking on the collapsed indicator inside
|
|
420
|
+
* of `ion-breadcrumb` and centering it relative
|
|
421
|
+
* to the indicator rather than `ion-breadcrumb`
|
|
422
|
+
* as a whole.
|
|
423
|
+
*/
|
|
424
|
+
const actualTriggerEl = (triggerEl ||
|
|
425
|
+
((_a = customEv === null || customEv === void 0 ? void 0 : customEv.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) ||
|
|
426
|
+
(customEv === null || customEv === void 0 ? void 0 : customEv.target));
|
|
427
|
+
if (!actualTriggerEl) {
|
|
428
|
+
return defaultPosition;
|
|
429
|
+
}
|
|
430
|
+
const triggerBoundingBox = actualTriggerEl.getBoundingClientRect();
|
|
431
|
+
referenceCoordinates = {
|
|
432
|
+
top: triggerBoundingBox.top,
|
|
433
|
+
left: triggerBoundingBox.left,
|
|
434
|
+
width: triggerBoundingBox.width,
|
|
435
|
+
height: triggerBoundingBox.height,
|
|
436
|
+
};
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Get top/left offset that would allow
|
|
441
|
+
* popover to be positioned on the
|
|
442
|
+
* preferred side of the reference.
|
|
443
|
+
*/
|
|
444
|
+
const coordinates = calculatePopoverSide(side, referenceCoordinates, contentWidth, contentHeight, arrowWidth, arrowHeight, isRTL);
|
|
445
|
+
/**
|
|
446
|
+
* Get the top/left adjustments that
|
|
447
|
+
* would allow the popover content
|
|
448
|
+
* to have the correct alignment.
|
|
449
|
+
*/
|
|
450
|
+
const alignedCoordinates = calculatePopoverAlign(align, side, referenceCoordinates, contentWidth, contentHeight);
|
|
451
|
+
const top = coordinates.top + alignedCoordinates.top;
|
|
452
|
+
const left = coordinates.left + alignedCoordinates.left;
|
|
453
|
+
const { arrowTop, arrowLeft } = calculateArrowPosition(side, arrowWidth, arrowHeight, top, left, contentWidth, contentHeight, isRTL);
|
|
454
|
+
const { originX, originY } = calculatePopoverOrigin(side, align, isRTL);
|
|
455
|
+
return { top, left, referenceCoordinates, arrowTop, arrowLeft, originX, originY };
|
|
456
|
+
};
|
|
457
|
+
/**
|
|
458
|
+
* Determines the transform-origin
|
|
459
|
+
* of the popover animation so that it
|
|
460
|
+
* is in line with what the side and alignment
|
|
461
|
+
* prop values are. Currently only used
|
|
462
|
+
* with the MD animation.
|
|
463
|
+
*/
|
|
464
|
+
const calculatePopoverOrigin = (side, align, isRTL) => {
|
|
465
|
+
switch (side) {
|
|
466
|
+
case 'top':
|
|
467
|
+
return { originX: getOriginXAlignment(align), originY: 'bottom' };
|
|
468
|
+
case 'bottom':
|
|
469
|
+
return { originX: getOriginXAlignment(align), originY: 'top' };
|
|
470
|
+
case 'left':
|
|
471
|
+
return { originX: 'right', originY: getOriginYAlignment(align) };
|
|
472
|
+
case 'right':
|
|
473
|
+
return { originX: 'left', originY: getOriginYAlignment(align) };
|
|
474
|
+
case 'start':
|
|
475
|
+
return { originX: isRTL ? 'left' : 'right', originY: getOriginYAlignment(align) };
|
|
476
|
+
case 'end':
|
|
477
|
+
return { originX: isRTL ? 'right' : 'left', originY: getOriginYAlignment(align) };
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
const getOriginXAlignment = (align) => {
|
|
481
|
+
switch (align) {
|
|
482
|
+
case 'start':
|
|
483
|
+
return 'left';
|
|
484
|
+
case 'center':
|
|
485
|
+
return 'center';
|
|
486
|
+
case 'end':
|
|
487
|
+
return 'right';
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
const getOriginYAlignment = (align) => {
|
|
491
|
+
switch (align) {
|
|
492
|
+
case 'start':
|
|
493
|
+
return 'top';
|
|
494
|
+
case 'center':
|
|
495
|
+
return 'center';
|
|
496
|
+
case 'end':
|
|
497
|
+
return 'bottom';
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Calculates where the arrow positioning
|
|
502
|
+
* should be relative to the popover content.
|
|
503
|
+
*/
|
|
504
|
+
const calculateArrowPosition = (side, arrowWidth, arrowHeight, top, left, contentWidth, contentHeight, isRTL) => {
|
|
505
|
+
/**
|
|
506
|
+
* Note: When side is left, right, start, or end, the arrow is
|
|
507
|
+
* been rotated using a `transform`, so to move the arrow up or down
|
|
508
|
+
* by its dimension, you need to use `arrowWidth`.
|
|
509
|
+
*/
|
|
510
|
+
const leftPosition = {
|
|
511
|
+
arrowTop: top + contentHeight / 2 - arrowWidth / 2,
|
|
512
|
+
arrowLeft: left + contentWidth - arrowWidth / 2,
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
515
|
+
* Move the arrow to the left by arrowWidth and then
|
|
516
|
+
* again by half of its width because we have rotated
|
|
517
|
+
* the arrow using a transform.
|
|
518
|
+
*/
|
|
519
|
+
const rightPosition = { arrowTop: top + contentHeight / 2 - arrowWidth / 2, arrowLeft: left - arrowWidth * 1.5 };
|
|
520
|
+
switch (side) {
|
|
521
|
+
case 'top':
|
|
522
|
+
return { arrowTop: top + contentHeight, arrowLeft: left + contentWidth / 2 - arrowWidth / 2 };
|
|
523
|
+
case 'bottom':
|
|
524
|
+
return { arrowTop: top - arrowHeight, arrowLeft: left + contentWidth / 2 - arrowWidth / 2 };
|
|
525
|
+
case 'left':
|
|
526
|
+
return leftPosition;
|
|
527
|
+
case 'right':
|
|
528
|
+
return rightPosition;
|
|
529
|
+
case 'start':
|
|
530
|
+
return isRTL ? rightPosition : leftPosition;
|
|
531
|
+
case 'end':
|
|
532
|
+
return isRTL ? leftPosition : rightPosition;
|
|
533
|
+
default:
|
|
534
|
+
return { arrowTop: 0, arrowLeft: 0 };
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Calculates the required top/left
|
|
539
|
+
* values needed to position the popover
|
|
540
|
+
* content on the side specified in the
|
|
541
|
+
* `side` prop.
|
|
542
|
+
*/
|
|
543
|
+
const calculatePopoverSide = (side, triggerBoundingBox, contentWidth, contentHeight, arrowWidth, arrowHeight, isRTL) => {
|
|
544
|
+
const sideLeft = {
|
|
545
|
+
top: triggerBoundingBox.top,
|
|
546
|
+
left: triggerBoundingBox.left - contentWidth - arrowWidth,
|
|
547
|
+
};
|
|
548
|
+
const sideRight = {
|
|
549
|
+
top: triggerBoundingBox.top,
|
|
550
|
+
left: triggerBoundingBox.left + triggerBoundingBox.width + arrowWidth,
|
|
551
|
+
};
|
|
552
|
+
switch (side) {
|
|
553
|
+
case 'top':
|
|
554
|
+
return {
|
|
555
|
+
top: triggerBoundingBox.top - contentHeight - arrowHeight,
|
|
556
|
+
left: triggerBoundingBox.left,
|
|
557
|
+
};
|
|
558
|
+
case 'right':
|
|
559
|
+
return sideRight;
|
|
560
|
+
case 'bottom':
|
|
561
|
+
return {
|
|
562
|
+
top: triggerBoundingBox.top + triggerBoundingBox.height + arrowHeight,
|
|
563
|
+
left: triggerBoundingBox.left,
|
|
564
|
+
};
|
|
565
|
+
case 'left':
|
|
566
|
+
return sideLeft;
|
|
567
|
+
case 'start':
|
|
568
|
+
return isRTL ? sideRight : sideLeft;
|
|
569
|
+
case 'end':
|
|
570
|
+
return isRTL ? sideLeft : sideRight;
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* Calculates the required top/left
|
|
575
|
+
* offset values needed to provide the
|
|
576
|
+
* correct alignment regardless while taking
|
|
577
|
+
* into account the side the popover is on.
|
|
578
|
+
*/
|
|
579
|
+
const calculatePopoverAlign = (align, side, triggerBoundingBox, contentWidth, contentHeight) => {
|
|
580
|
+
switch (align) {
|
|
581
|
+
case 'center':
|
|
582
|
+
return calculatePopoverCenterAlign(side, triggerBoundingBox, contentWidth, contentHeight);
|
|
583
|
+
case 'end':
|
|
584
|
+
return calculatePopoverEndAlign(side, triggerBoundingBox, contentWidth, contentHeight);
|
|
585
|
+
case 'start':
|
|
586
|
+
default:
|
|
587
|
+
return { top: 0, left: 0 };
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* Calculate the end alignment for
|
|
592
|
+
* the popover. If side is on the x-axis
|
|
593
|
+
* then the align values refer to the top
|
|
594
|
+
* and bottom margins of the content.
|
|
595
|
+
* If side is on the y-axis then the
|
|
596
|
+
* align values refer to the left and right
|
|
597
|
+
* margins of the content.
|
|
598
|
+
*/
|
|
599
|
+
const calculatePopoverEndAlign = (side, triggerBoundingBox, contentWidth, contentHeight) => {
|
|
600
|
+
switch (side) {
|
|
601
|
+
case 'start':
|
|
602
|
+
case 'end':
|
|
603
|
+
case 'left':
|
|
604
|
+
case 'right':
|
|
605
|
+
return {
|
|
606
|
+
top: -(contentHeight - triggerBoundingBox.height),
|
|
607
|
+
left: 0,
|
|
608
|
+
};
|
|
609
|
+
case 'top':
|
|
610
|
+
case 'bottom':
|
|
611
|
+
default:
|
|
612
|
+
return {
|
|
613
|
+
top: 0,
|
|
614
|
+
left: -(contentWidth - triggerBoundingBox.width),
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
/**
|
|
619
|
+
* Calculate the center alignment for
|
|
620
|
+
* the popover. If side is on the x-axis
|
|
621
|
+
* then the align values refer to the top
|
|
622
|
+
* and bottom margins of the content.
|
|
623
|
+
* If side is on the y-axis then the
|
|
624
|
+
* align values refer to the left and right
|
|
625
|
+
* margins of the content.
|
|
626
|
+
*/
|
|
627
|
+
const calculatePopoverCenterAlign = (side, triggerBoundingBox, contentWidth, contentHeight) => {
|
|
628
|
+
switch (side) {
|
|
629
|
+
case 'start':
|
|
630
|
+
case 'end':
|
|
631
|
+
case 'left':
|
|
632
|
+
case 'right':
|
|
633
|
+
return {
|
|
634
|
+
top: -(contentHeight / 2 - triggerBoundingBox.height / 2),
|
|
635
|
+
left: 0,
|
|
636
|
+
};
|
|
637
|
+
case 'top':
|
|
638
|
+
case 'bottom':
|
|
639
|
+
default:
|
|
640
|
+
return {
|
|
641
|
+
top: 0,
|
|
642
|
+
left: -(contentWidth / 2 - triggerBoundingBox.width / 2),
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Adjusts popover positioning coordinates
|
|
648
|
+
* such that popover does not appear offscreen
|
|
649
|
+
* or overlapping safe area bounds.
|
|
650
|
+
*/
|
|
651
|
+
const calculateWindowAdjustment = (side, coordTop, coordLeft, bodyPadding, bodyWidth, bodyHeight, contentWidth, contentHeight, safeAreaMargin, contentOriginX, contentOriginY, triggerCoordinates, coordArrowTop = 0, coordArrowLeft = 0, arrowHeight = 0) => {
|
|
652
|
+
let arrowTop = coordArrowTop;
|
|
653
|
+
const arrowLeft = coordArrowLeft;
|
|
654
|
+
let left = coordLeft;
|
|
655
|
+
let top = coordTop;
|
|
656
|
+
let bottom;
|
|
657
|
+
let originX = contentOriginX;
|
|
658
|
+
let originY = contentOriginY;
|
|
48
659
|
let checkSafeAreaLeft = false;
|
|
49
660
|
let checkSafeAreaRight = false;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
661
|
+
const triggerTop = triggerCoordinates
|
|
662
|
+
? triggerCoordinates.top + triggerCoordinates.height
|
|
663
|
+
: bodyHeight / 2 - contentHeight / 2;
|
|
664
|
+
const triggerHeight = triggerCoordinates ? triggerCoordinates.height : 0;
|
|
665
|
+
let addPopoverBottomClass = false;
|
|
666
|
+
/**
|
|
667
|
+
* Adjust popover so it does not
|
|
668
|
+
* go off the left of the screen.
|
|
669
|
+
*/
|
|
670
|
+
if (left < bodyPadding + safeAreaMargin) {
|
|
671
|
+
left = bodyPadding;
|
|
56
672
|
checkSafeAreaLeft = true;
|
|
57
|
-
|
|
673
|
+
originX = 'left';
|
|
674
|
+
/**
|
|
675
|
+
* Adjust popover so it does not
|
|
676
|
+
* go off the right of the screen.
|
|
677
|
+
*/
|
|
58
678
|
}
|
|
59
|
-
else if (contentWidth +
|
|
60
|
-
// Ok, so we're on the right side of the screen,
|
|
61
|
-
// but now we need to make sure we're still a bit further right
|
|
62
|
-
// cus....notchurally... Again, 25 is random. It works tho
|
|
679
|
+
else if (contentWidth + bodyPadding + left + safeAreaMargin > bodyWidth) {
|
|
63
680
|
checkSafeAreaRight = true;
|
|
64
|
-
|
|
681
|
+
left = bodyWidth - contentWidth - bodyPadding;
|
|
65
682
|
originX = 'right';
|
|
66
683
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
684
|
+
/**
|
|
685
|
+
* Adjust popover so it does not
|
|
686
|
+
* go off the top of the screen.
|
|
687
|
+
* If popover is on the left or the right of
|
|
688
|
+
* the trigger, then we should not adjust top
|
|
689
|
+
* margins.
|
|
690
|
+
*/
|
|
691
|
+
if (triggerTop + triggerHeight + contentHeight > bodyHeight && (side === 'top' || side === 'bottom')) {
|
|
692
|
+
if (triggerTop - contentHeight > 0) {
|
|
693
|
+
/**
|
|
694
|
+
* While we strive to align the popover with the trigger
|
|
695
|
+
* on smaller screens this is not always possible. As a result,
|
|
696
|
+
* we adjust the popover up so that it does not hang
|
|
697
|
+
* off the bottom of the screen. However, we do not want to move
|
|
698
|
+
* the popover up so much that it goes off the top of the screen.
|
|
699
|
+
*
|
|
700
|
+
* We chose 12 here so that the popover position looks a bit nicer as
|
|
701
|
+
* it is not right up against the edge of the screen.
|
|
702
|
+
*/
|
|
703
|
+
top = Math.max(12, triggerTop - contentHeight - triggerHeight - (arrowHeight - 1));
|
|
704
|
+
arrowTop = top + contentHeight;
|
|
705
|
+
originY = 'bottom';
|
|
706
|
+
addPopoverBottomClass = true;
|
|
707
|
+
/**
|
|
708
|
+
* If not enough room for popover to appear
|
|
709
|
+
* above trigger, then cut it off.
|
|
710
|
+
*/
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
bottom = bodyPadding;
|
|
714
|
+
}
|
|
77
715
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
716
|
+
return {
|
|
717
|
+
top,
|
|
718
|
+
left,
|
|
719
|
+
bottom,
|
|
720
|
+
originX,
|
|
721
|
+
originY,
|
|
722
|
+
checkSafeAreaLeft,
|
|
723
|
+
checkSafeAreaRight,
|
|
724
|
+
arrowTop,
|
|
725
|
+
arrowLeft,
|
|
726
|
+
addPopoverBottomClass,
|
|
727
|
+
};
|
|
728
|
+
};
|
|
729
|
+
const shouldShowArrow = (side, didAdjustBounds = false, ev, trigger) => {
|
|
730
|
+
/**
|
|
731
|
+
* If no event provided and
|
|
732
|
+
* we do not have a trigger,
|
|
733
|
+
* then this popover was likely
|
|
734
|
+
* presented via the popoverController
|
|
735
|
+
* or users called `present` manually.
|
|
736
|
+
* In this case, the arrow should not be
|
|
737
|
+
* shown as we do not have a reference.
|
|
738
|
+
*/
|
|
739
|
+
if (!ev && !trigger) {
|
|
740
|
+
return false;
|
|
84
741
|
}
|
|
85
|
-
|
|
86
|
-
|
|
742
|
+
/**
|
|
743
|
+
* If popover is on the left or the right
|
|
744
|
+
* of a trigger, but we needed to adjust the
|
|
745
|
+
* popover due to screen bounds, then we should
|
|
746
|
+
* hide the arrow as it will never be pointing
|
|
747
|
+
* at the trigger.
|
|
748
|
+
*/
|
|
749
|
+
if (side !== 'top' && side !== 'bottom' && didAdjustBounds) {
|
|
750
|
+
return false;
|
|
87
751
|
}
|
|
88
|
-
|
|
752
|
+
return true;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
/*!
|
|
756
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
757
|
+
*/
|
|
758
|
+
const POPOVER_IOS_BODY_PADDING = 5;
|
|
759
|
+
/**
|
|
760
|
+
* iOS Popover Enter Animation
|
|
761
|
+
*/
|
|
762
|
+
const iosEnterAnimation = (baseEl, opts) => {
|
|
763
|
+
var _a;
|
|
764
|
+
const { event: ev, size, trigger, reference, side, align } = opts;
|
|
765
|
+
const doc = baseEl.ownerDocument;
|
|
766
|
+
const isRTL = doc.dir === 'rtl';
|
|
767
|
+
const bodyWidth = doc.defaultView.innerWidth;
|
|
768
|
+
const bodyHeight = doc.defaultView.innerHeight;
|
|
769
|
+
const root = getElementRoot(baseEl);
|
|
770
|
+
const contentEl = root.querySelector('.popover-content');
|
|
771
|
+
const arrowEl = root.querySelector('.popover-arrow');
|
|
772
|
+
const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
|
|
773
|
+
const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);
|
|
774
|
+
const { arrowWidth, arrowHeight } = getArrowDimensions(arrowEl);
|
|
775
|
+
const defaultPosition = {
|
|
776
|
+
top: bodyHeight / 2 - contentHeight / 2,
|
|
777
|
+
left: bodyWidth / 2 - contentWidth / 2,
|
|
778
|
+
originX: isRTL ? 'right' : 'left',
|
|
779
|
+
originY: 'top',
|
|
780
|
+
};
|
|
781
|
+
const results = getPopoverPosition(isRTL, contentWidth, contentHeight, arrowWidth, arrowHeight, reference, side, align, defaultPosition, trigger, ev);
|
|
782
|
+
const padding = size === 'cover' ? 0 : POPOVER_IOS_BODY_PADDING;
|
|
783
|
+
const margin = size === 'cover' ? 0 : 25;
|
|
784
|
+
const { originX, originY, top, left, bottom, checkSafeAreaLeft, checkSafeAreaRight, arrowTop, arrowLeft, addPopoverBottomClass, } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, margin, results.originX, results.originY, results.referenceCoordinates, results.arrowTop, results.arrowLeft, arrowHeight);
|
|
89
785
|
const baseAnimation = createAnimation();
|
|
90
786
|
const backdropAnimation = createAnimation();
|
|
91
787
|
const wrapperAnimation = createAnimation();
|
|
92
788
|
backdropAnimation
|
|
93
|
-
.addElement(
|
|
789
|
+
.addElement(root.querySelector('ion-backdrop'))
|
|
94
790
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
95
791
|
.beforeStyles({
|
|
96
|
-
'pointer-events': 'none'
|
|
792
|
+
'pointer-events': 'none',
|
|
97
793
|
})
|
|
98
794
|
.afterClearStyles(['pointer-events']);
|
|
99
|
-
wrapperAnimation
|
|
100
|
-
.addElement(baseEl.querySelector('.popover-wrapper'))
|
|
101
|
-
.fromTo('opacity', 0.01, 1);
|
|
795
|
+
wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).fromTo('opacity', 0.01, 1);
|
|
102
796
|
return baseAnimation
|
|
103
|
-
.addElement(baseEl)
|
|
104
797
|
.easing('ease')
|
|
105
798
|
.duration(100)
|
|
799
|
+
.beforeAddWrite(() => {
|
|
800
|
+
if (size === 'cover') {
|
|
801
|
+
baseEl.style.setProperty('--width', `${contentWidth}px`);
|
|
802
|
+
}
|
|
803
|
+
if (addPopoverBottomClass) {
|
|
804
|
+
baseEl.classList.add('popover-bottom');
|
|
805
|
+
}
|
|
806
|
+
if (bottom !== undefined) {
|
|
807
|
+
contentEl.style.setProperty('bottom', `${bottom}px`);
|
|
808
|
+
}
|
|
809
|
+
const safeAreaLeft = ' + var(--ion-safe-area-left, 0)';
|
|
810
|
+
const safeAreaRight = ' - var(--ion-safe-area-right, 0)';
|
|
811
|
+
let leftValue = `${left}px`;
|
|
812
|
+
if (checkSafeAreaLeft) {
|
|
813
|
+
leftValue = `${left}px${safeAreaLeft}`;
|
|
814
|
+
}
|
|
815
|
+
if (checkSafeAreaRight) {
|
|
816
|
+
leftValue = `${left}px${safeAreaRight}`;
|
|
817
|
+
}
|
|
818
|
+
contentEl.style.setProperty('top', `calc(${top}px + var(--offset-y, 0))`);
|
|
819
|
+
contentEl.style.setProperty('left', `calc(${leftValue} + var(--offset-x, 0))`);
|
|
820
|
+
contentEl.style.setProperty('transform-origin', `${originY} ${originX}`);
|
|
821
|
+
if (arrowEl !== null) {
|
|
822
|
+
const didAdjustBounds = results.top !== top || results.left !== left;
|
|
823
|
+
const showArrow = shouldShowArrow(side, didAdjustBounds, ev, trigger);
|
|
824
|
+
if (showArrow) {
|
|
825
|
+
arrowEl.style.setProperty('top', `calc(${arrowTop}px + var(--offset-y, 0))`);
|
|
826
|
+
arrowEl.style.setProperty('left', `calc(${arrowLeft}px + var(--offset-x, 0))`);
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
arrowEl.style.setProperty('display', 'none');
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
})
|
|
106
833
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
107
834
|
};
|
|
108
|
-
const POPOVER_IOS_BODY_PADDING = 5;
|
|
109
835
|
|
|
836
|
+
/*!
|
|
837
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
838
|
+
*/
|
|
110
839
|
/**
|
|
111
840
|
* iOS Popover Leave Animation
|
|
112
841
|
*/
|
|
113
842
|
const iosLeaveAnimation = (baseEl) => {
|
|
843
|
+
const root = getElementRoot(baseEl);
|
|
844
|
+
const contentEl = root.querySelector('.popover-content');
|
|
845
|
+
const arrowEl = root.querySelector('.popover-arrow');
|
|
114
846
|
const baseAnimation = createAnimation();
|
|
115
847
|
const backdropAnimation = createAnimation();
|
|
116
848
|
const wrapperAnimation = createAnimation();
|
|
117
|
-
backdropAnimation
|
|
118
|
-
|
|
119
|
-
.fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
120
|
-
wrapperAnimation
|
|
121
|
-
.addElement(baseEl.querySelector('.popover-wrapper'))
|
|
122
|
-
.fromTo('opacity', 0.99, 0);
|
|
849
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
850
|
+
wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).fromTo('opacity', 0.99, 0);
|
|
123
851
|
return baseAnimation
|
|
124
|
-
.addElement(baseEl)
|
|
125
852
|
.easing('ease')
|
|
126
|
-
.
|
|
853
|
+
.afterAddWrite(() => {
|
|
854
|
+
baseEl.style.removeProperty('--width');
|
|
855
|
+
baseEl.classList.remove('popover-bottom');
|
|
856
|
+
contentEl.style.removeProperty('top');
|
|
857
|
+
contentEl.style.removeProperty('left');
|
|
858
|
+
contentEl.style.removeProperty('bottom');
|
|
859
|
+
contentEl.style.removeProperty('transform-origin');
|
|
860
|
+
if (arrowEl) {
|
|
861
|
+
arrowEl.style.removeProperty('top');
|
|
862
|
+
arrowEl.style.removeProperty('left');
|
|
863
|
+
arrowEl.style.removeProperty('display');
|
|
864
|
+
}
|
|
865
|
+
})
|
|
866
|
+
.duration(300)
|
|
127
867
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
128
868
|
};
|
|
129
869
|
|
|
870
|
+
/*!
|
|
871
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
872
|
+
*/
|
|
873
|
+
const POPOVER_MD_BODY_PADDING = 12;
|
|
130
874
|
/**
|
|
131
875
|
* Md Popover Enter Animation
|
|
132
876
|
*/
|
|
133
|
-
const mdEnterAnimation = (baseEl,
|
|
134
|
-
|
|
877
|
+
const mdEnterAnimation = (baseEl, opts) => {
|
|
878
|
+
var _a;
|
|
879
|
+
const { event: ev, size, trigger, reference, side, align } = opts;
|
|
135
880
|
const doc = baseEl.ownerDocument;
|
|
136
881
|
const isRTL = doc.dir === 'rtl';
|
|
137
|
-
let originY = 'top';
|
|
138
|
-
let originX = isRTL ? 'right' : 'left';
|
|
139
|
-
const contentEl = baseEl.querySelector('.popover-content');
|
|
140
|
-
const contentDimentions = contentEl.getBoundingClientRect();
|
|
141
|
-
const contentWidth = contentDimentions.width;
|
|
142
|
-
const contentHeight = contentDimentions.height;
|
|
143
882
|
const bodyWidth = doc.defaultView.innerWidth;
|
|
144
883
|
const bodyHeight = doc.defaultView.innerHeight;
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
: bodyHeight / 2 - contentHeight / 2
|
|
151
|
-
|
|
152
|
-
?
|
|
153
|
-
|
|
154
|
-
: targetDim.left
|
|
155
|
-
: bodyWidth / 2 - contentWidth / 2;
|
|
156
|
-
const targetHeight = (targetDim && targetDim.height) || 0;
|
|
157
|
-
const popoverCSS = {
|
|
158
|
-
top: targetTop,
|
|
159
|
-
left: targetLeft
|
|
884
|
+
const root = getElementRoot(baseEl);
|
|
885
|
+
const contentEl = root.querySelector('.popover-content');
|
|
886
|
+
const referenceSizeEl = trigger || ((_a = ev === null || ev === void 0 ? void 0 : ev.detail) === null || _a === void 0 ? void 0 : _a.ionShadowTarget) || (ev === null || ev === void 0 ? void 0 : ev.target);
|
|
887
|
+
const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);
|
|
888
|
+
const defaultPosition = {
|
|
889
|
+
top: bodyHeight / 2 - contentHeight / 2,
|
|
890
|
+
left: bodyWidth / 2 - contentWidth / 2,
|
|
891
|
+
originX: isRTL ? 'right' : 'left',
|
|
892
|
+
originY: 'top',
|
|
160
893
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (popoverCSS.left < POPOVER_MD_BODY_PADDING) {
|
|
165
|
-
popoverCSS.left = POPOVER_MD_BODY_PADDING;
|
|
166
|
-
// Same origin in this case for both LTR & RTL
|
|
167
|
-
// Note: in LTR, originX is already 'left'
|
|
168
|
-
originX = 'left';
|
|
169
|
-
}
|
|
170
|
-
else if (contentWidth + POPOVER_MD_BODY_PADDING + popoverCSS.left >
|
|
171
|
-
bodyWidth) {
|
|
172
|
-
popoverCSS.left = bodyWidth - contentWidth - POPOVER_MD_BODY_PADDING;
|
|
173
|
-
// Same origin in this case for both LTR & RTL
|
|
174
|
-
// Note: in RTL, originX is already 'right'
|
|
175
|
-
originX = 'right';
|
|
176
|
-
}
|
|
177
|
-
// If the popover when popped down stretches past bottom of screen,
|
|
178
|
-
// make it pop up if there's room above
|
|
179
|
-
if (targetTop + targetHeight + contentHeight > bodyHeight &&
|
|
180
|
-
targetTop - contentHeight > 0) {
|
|
181
|
-
popoverCSS.top = targetTop - contentHeight - targetHeight;
|
|
182
|
-
baseEl.className = baseEl.className + ' popover-bottom';
|
|
183
|
-
originY = 'bottom';
|
|
184
|
-
// If there isn't room for it to pop up above the target cut it off
|
|
185
|
-
}
|
|
186
|
-
else if (targetTop + targetHeight + contentHeight > bodyHeight) {
|
|
187
|
-
contentEl.style.bottom = POPOVER_MD_BODY_PADDING + 'px';
|
|
188
|
-
}
|
|
894
|
+
const results = getPopoverPosition(isRTL, contentWidth, contentHeight, 0, 0, reference, side, align, defaultPosition, trigger, ev);
|
|
895
|
+
const padding = size === 'cover' ? 0 : POPOVER_MD_BODY_PADDING;
|
|
896
|
+
const { originX, originY, top, left, bottom } = calculateWindowAdjustment(side, results.top, results.left, padding, bodyWidth, bodyHeight, contentWidth, contentHeight, 0, results.originX, results.originY, results.referenceCoordinates);
|
|
189
897
|
const baseAnimation = createAnimation();
|
|
190
898
|
const backdropAnimation = createAnimation();
|
|
191
899
|
const wrapperAnimation = createAnimation();
|
|
192
900
|
const contentAnimation = createAnimation();
|
|
193
901
|
const viewportAnimation = createAnimation();
|
|
194
902
|
backdropAnimation
|
|
195
|
-
.addElement(
|
|
903
|
+
.addElement(root.querySelector('ion-backdrop'))
|
|
196
904
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
197
905
|
.beforeStyles({
|
|
198
|
-
'pointer-events': 'none'
|
|
906
|
+
'pointer-events': 'none',
|
|
199
907
|
})
|
|
200
908
|
.afterClearStyles(['pointer-events']);
|
|
201
|
-
wrapperAnimation
|
|
202
|
-
.addElement(baseEl.querySelector('.popover-wrapper'))
|
|
203
|
-
.fromTo('opacity', 0.01, 1);
|
|
909
|
+
wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).duration(150).fromTo('opacity', 0.01, 1);
|
|
204
910
|
contentAnimation
|
|
205
911
|
.addElement(contentEl)
|
|
206
912
|
.beforeStyles({
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
'transform-origin': `${originY} ${originX}
|
|
913
|
+
top: `calc(${top}px + var(--offset-y, 0px))`,
|
|
914
|
+
left: `calc(${left}px + var(--offset-x, 0px))`,
|
|
915
|
+
'transform-origin': `${originY} ${originX}`,
|
|
916
|
+
})
|
|
917
|
+
.beforeAddWrite(() => {
|
|
918
|
+
if (bottom !== undefined) {
|
|
919
|
+
contentEl.style.setProperty('bottom', `${bottom}px`);
|
|
920
|
+
}
|
|
210
921
|
})
|
|
211
|
-
.fromTo('transform', 'scale(0.
|
|
212
|
-
viewportAnimation
|
|
213
|
-
.addElement(baseEl.querySelector('.popover-viewport'))
|
|
214
|
-
.fromTo('opacity', 0.01, 1);
|
|
922
|
+
.fromTo('transform', 'scale(0.8)', 'scale(1)');
|
|
923
|
+
viewportAnimation.addElement(root.querySelector('.popover-viewport')).fromTo('opacity', 0.01, 1);
|
|
215
924
|
return baseAnimation
|
|
216
|
-
.addElement(baseEl)
|
|
217
925
|
.easing('cubic-bezier(0.36,0.66,0.04,1)')
|
|
218
926
|
.duration(300)
|
|
927
|
+
.beforeAddWrite(() => {
|
|
928
|
+
if (size === 'cover') {
|
|
929
|
+
baseEl.style.setProperty('--width', `${contentWidth}px`);
|
|
930
|
+
}
|
|
931
|
+
if (originY === 'bottom') {
|
|
932
|
+
baseEl.classList.add('popover-bottom');
|
|
933
|
+
}
|
|
934
|
+
})
|
|
219
935
|
.addAnimation([backdropAnimation, wrapperAnimation, contentAnimation, viewportAnimation]);
|
|
220
936
|
};
|
|
221
937
|
|
|
938
|
+
/*!
|
|
939
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
940
|
+
*/
|
|
222
941
|
/**
|
|
223
942
|
* Md Popover Leave Animation
|
|
224
943
|
*/
|
|
225
944
|
const mdLeaveAnimation = (baseEl) => {
|
|
945
|
+
const root = getElementRoot(baseEl);
|
|
946
|
+
const contentEl = root.querySelector('.popover-content');
|
|
226
947
|
const baseAnimation = createAnimation();
|
|
227
948
|
const backdropAnimation = createAnimation();
|
|
228
949
|
const wrapperAnimation = createAnimation();
|
|
229
|
-
backdropAnimation
|
|
230
|
-
|
|
231
|
-
.fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
232
|
-
wrapperAnimation
|
|
233
|
-
.addElement(baseEl.querySelector('.popover-wrapper'))
|
|
234
|
-
.fromTo('opacity', 0.99, 0);
|
|
950
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop')).fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
951
|
+
wrapperAnimation.addElement(root.querySelector('.popover-wrapper')).fromTo('opacity', 0.99, 0);
|
|
235
952
|
return baseAnimation
|
|
236
|
-
.addElement(baseEl)
|
|
237
953
|
.easing('ease')
|
|
238
|
-
.
|
|
954
|
+
.afterAddWrite(() => {
|
|
955
|
+
baseEl.style.removeProperty('--width');
|
|
956
|
+
baseEl.classList.remove('popover-bottom');
|
|
957
|
+
contentEl.style.removeProperty('top');
|
|
958
|
+
contentEl.style.removeProperty('left');
|
|
959
|
+
contentEl.style.removeProperty('bottom');
|
|
960
|
+
contentEl.style.removeProperty('transform-origin');
|
|
961
|
+
})
|
|
962
|
+
.duration(150)
|
|
239
963
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
240
964
|
};
|
|
241
965
|
|
|
242
|
-
const popoverIosCss = "
|
|
966
|
+
const popoverIosCss = ":host{--background:var(--ion-background-color, #fff);--min-width:0;--min-height:0;--max-width:auto;--height:auto;--offset-x:0px;--offset-y:0px;left:0;right:0;top:0;bottom:0;display:flex;position:fixed;align-items:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);z-index:1001}:host(.popover-nested){pointer-events:none}:host(.popover-nested) .popover-wrapper{pointer-events:auto}:host(.overlay-hidden){display:none}.popover-wrapper{opacity:0;z-index:10}.popover-content{display:flex;position:absolute;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);box-shadow:var(--box-shadow);overflow:auto;z-index:10}.popover-viewport{--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px;display:flex;flex-direction:column;overflow:hidden}:host(.popover-nested.popover-side-left){--offset-x:5px}:host(.popover-nested.popover-side-right){--offset-x:-5px}:host(.popover-nested.popover-side-start){--offset-x:5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-start),:host-context([dir=rtl]).popover-nested.popover-side-start{--offset-x:-5px}:host(.popover-nested.popover-side-end){--offset-x:-5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-end),:host-context([dir=rtl]).popover-nested.popover-side-end{--offset-x:5px}:host{--width:200px;--max-height:90%;--box-shadow:none;--backdrop-opacity:var(--ion-backdrop-opacity, 0.08)}:host(.popover-desktop){--box-shadow:0px 4px 16px 0px rgba(0, 0, 0, 0.12)}.popover-content{border-radius:10px}:host(.popover-desktop) .popover-content{border:0.5px solid var(--ion-color-step-100, #e6e6e6)}.popover-arrow{display:block;position:absolute;width:20px;height:10px;overflow:hidden}.popover-arrow::after{left:3px;top:3px;border-radius:3px;position:absolute;width:14px;height:14px;transform:rotate(45deg);background:var(--background);content:\"\";z-index:10}[dir=rtl] .popover-arrow::after,:host-context([dir=rtl]) .popover-arrow::after{left:unset;right:unset;right:3px}:host(.popover-bottom) .popover-arrow{top:auto;bottom:-10px}:host(.popover-bottom) .popover-arrow::after{top:-6px}:host(.popover-side-left) .popover-arrow{transform:rotate(90deg)}:host(.popover-side-right) .popover-arrow{transform:rotate(-90deg)}:host(.popover-side-top) .popover-arrow{transform:rotate(180deg)}:host(.popover-side-start) .popover-arrow{transform:rotate(90deg)}:host-context([dir=rtl]):host(.popover-side-start) .popover-arrow,:host-context([dir=rtl]).popover-side-start .popover-arrow{transform:rotate(-90deg)}:host(.popover-side-end) .popover-arrow{transform:rotate(-90deg)}:host-context([dir=rtl]):host(.popover-side-end) .popover-arrow,:host-context([dir=rtl]).popover-side-end .popover-arrow{transform:rotate(90deg)}@supports (backdrop-filter: blur(0)){:host(.popover-translucent) .popover-content,:host(.popover-translucent) .popover-arrow::after{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);backdrop-filter:saturate(180%) blur(20px)}}";
|
|
243
967
|
|
|
244
|
-
const popoverMdCss = "
|
|
968
|
+
const popoverMdCss = ":host{--background:var(--ion-background-color, #fff);--min-width:0;--min-height:0;--max-width:auto;--height:auto;--offset-x:0px;--offset-y:0px;left:0;right:0;top:0;bottom:0;display:flex;position:fixed;align-items:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);z-index:1001}:host(.popover-nested){pointer-events:none}:host(.popover-nested) .popover-wrapper{pointer-events:auto}:host(.overlay-hidden){display:none}.popover-wrapper{opacity:0;z-index:10}.popover-content{display:flex;position:absolute;flex-direction:column;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);box-shadow:var(--box-shadow);overflow:auto;z-index:10}.popover-viewport{--ion-safe-area-top:0px;--ion-safe-area-right:0px;--ion-safe-area-bottom:0px;--ion-safe-area-left:0px;display:flex;flex-direction:column;overflow:hidden}:host(.popover-nested.popover-side-left){--offset-x:5px}:host(.popover-nested.popover-side-right){--offset-x:-5px}:host(.popover-nested.popover-side-start){--offset-x:5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-start),:host-context([dir=rtl]).popover-nested.popover-side-start{--offset-x:-5px}:host(.popover-nested.popover-side-end){--offset-x:-5px}:host-context([dir=rtl]):host(.popover-nested.popover-side-end),:host-context([dir=rtl]).popover-nested.popover-side-end{--offset-x:5px}:host{--width:250px;--max-height:90%;--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}.popover-content{border-radius:4px;transform-origin:left top}[dir=rtl] .popover-content,:host-context([dir=rtl]) .popover-content{transform-origin:right top}.popover-viewport{transition-delay:100ms}";
|
|
245
969
|
|
|
246
970
|
const Popover = class {
|
|
247
971
|
constructor(hostRef) {
|
|
@@ -250,7 +974,19 @@ const Popover = class {
|
|
|
250
974
|
this.willPresent = createEvent(this, "ionPopoverWillPresent", 7);
|
|
251
975
|
this.willDismiss = createEvent(this, "ionPopoverWillDismiss", 7);
|
|
252
976
|
this.didDismiss = createEvent(this, "ionPopoverDidDismiss", 7);
|
|
977
|
+
this.didPresentShorthand = createEvent(this, "didPresent", 7);
|
|
978
|
+
this.willPresentShorthand = createEvent(this, "willPresent", 7);
|
|
979
|
+
this.willDismissShorthand = createEvent(this, "willDismiss", 7);
|
|
980
|
+
this.didDismissShorthand = createEvent(this, "didDismiss", 7);
|
|
981
|
+
this.ionMount = createEvent(this, "ionMount", 7);
|
|
982
|
+
this.parentPopover = null;
|
|
983
|
+
this.popoverIndex = popoverIds++;
|
|
984
|
+
this.coreDelegate = CoreDelegate();
|
|
985
|
+
this.inline = false;
|
|
986
|
+
this.focusDescendantOnPresent = false;
|
|
253
987
|
this.presented = false;
|
|
988
|
+
/** @internal */
|
|
989
|
+
this.hasController = false;
|
|
254
990
|
/**
|
|
255
991
|
* If `true`, the keyboard will be automatically dismissed when the overlay is presented.
|
|
256
992
|
*/
|
|
@@ -261,6 +997,10 @@ const Popover = class {
|
|
|
261
997
|
this.backdropDismiss = true;
|
|
262
998
|
/**
|
|
263
999
|
* If `true`, a backdrop will be displayed behind the popover.
|
|
1000
|
+
* This property controls whether or not the backdrop
|
|
1001
|
+
* darkens the screen when the popover is presented.
|
|
1002
|
+
* It does not control whether or not the backdrop
|
|
1003
|
+
* is active or present in the DOM.
|
|
264
1004
|
*/
|
|
265
1005
|
this.showBackdrop = true;
|
|
266
1006
|
/**
|
|
@@ -273,11 +1013,82 @@ const Popover = class {
|
|
|
273
1013
|
* If `true`, the popover will animate.
|
|
274
1014
|
*/
|
|
275
1015
|
this.animated = true;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
1016
|
+
/**
|
|
1017
|
+
* Describes what kind of interaction with the trigger that
|
|
1018
|
+
* should cause the popover to open. Does not apply when the `trigger`
|
|
1019
|
+
* property is `undefined`.
|
|
1020
|
+
* If `'click'`, the popover will be presented when the trigger is left clicked.
|
|
1021
|
+
* If `'hover'`, the popover will be presented when a pointer hovers over the trigger.
|
|
1022
|
+
* If `'context-menu'`, the popover will be presented when the trigger is right
|
|
1023
|
+
* clicked on desktop and long pressed on mobile. This will also prevent your
|
|
1024
|
+
* device's normal context menu from appearing.
|
|
1025
|
+
*/
|
|
1026
|
+
this.triggerAction = 'click';
|
|
1027
|
+
/**
|
|
1028
|
+
* Describes how to calculate the popover width.
|
|
1029
|
+
* If `'cover'`, the popover width will match the width of the trigger.
|
|
1030
|
+
* If `'auto'`, the popover width will be determined by the content in
|
|
1031
|
+
* the popover.
|
|
1032
|
+
*/
|
|
1033
|
+
this.size = 'auto';
|
|
1034
|
+
/**
|
|
1035
|
+
* If `true`, the popover will be automatically
|
|
1036
|
+
* dismissed when the content has been clicked.
|
|
1037
|
+
*/
|
|
1038
|
+
this.dismissOnSelect = false;
|
|
1039
|
+
/**
|
|
1040
|
+
* Describes what to position the popover relative to.
|
|
1041
|
+
* If `'trigger'`, the popover will be positioned relative
|
|
1042
|
+
* to the trigger button. If passing in an event, this is
|
|
1043
|
+
* determined via event.target.
|
|
1044
|
+
* If `'event'`, the popover will be positioned relative
|
|
1045
|
+
* to the x/y coordinates of the trigger action. If passing
|
|
1046
|
+
* in an event, this is determined via event.clientX and event.clientY.
|
|
1047
|
+
*/
|
|
1048
|
+
this.reference = 'trigger';
|
|
1049
|
+
/**
|
|
1050
|
+
* Describes which side of the `reference` point to position
|
|
1051
|
+
* the popover on. The `'start'` and `'end'` values are RTL-aware,
|
|
1052
|
+
* and the `'left'` and `'right'` values are not.
|
|
1053
|
+
*/
|
|
1054
|
+
this.side = 'bottom';
|
|
1055
|
+
/**
|
|
1056
|
+
* If `true`, the popover will display an arrow that points at the
|
|
1057
|
+
* `reference` when running in `ios` mode. Does not apply in `md` mode.
|
|
1058
|
+
*/
|
|
1059
|
+
this.arrow = true;
|
|
1060
|
+
/**
|
|
1061
|
+
* If `true`, the popover will open. If `false`, the popover will close.
|
|
1062
|
+
* Use this if you need finer grained control over presentation, otherwise
|
|
1063
|
+
* just use the popoverController or the `trigger` property.
|
|
1064
|
+
* Note: `isOpen` will not automatically be set back to `false` when
|
|
1065
|
+
* the popover dismisses. You will need to do that in your code.
|
|
1066
|
+
*/
|
|
1067
|
+
this.isOpen = false;
|
|
1068
|
+
/**
|
|
1069
|
+
* @internal
|
|
1070
|
+
*
|
|
1071
|
+
* If `true` the popover will not register its own keyboard event handlers.
|
|
1072
|
+
* This allows the contents of the popover to handle their own keyboard interactions.
|
|
1073
|
+
*
|
|
1074
|
+
* If `false`, the popover will register its own keyboard event handlers for
|
|
1075
|
+
* navigating `ion-list` items within a popover (up/down/home/end/etc.).
|
|
1076
|
+
* This will also cancel browser keyboard event bindings to prevent scroll
|
|
1077
|
+
* behavior in a popover using a list of items.
|
|
1078
|
+
*/
|
|
1079
|
+
this.keyboardEvents = false;
|
|
1080
|
+
/**
|
|
1081
|
+
* If `true`, the component passed into `ion-popover` will
|
|
1082
|
+
* automatically be mounted when the popover is created. The
|
|
1083
|
+
* component will remain mounted even when the popover is dismissed.
|
|
1084
|
+
* However, the component will be destroyed when the popover is
|
|
1085
|
+
* destroyed. This property is not reactive and should only be
|
|
1086
|
+
* used when initially creating a popover.
|
|
1087
|
+
*
|
|
1088
|
+
* Note: This feature only applies to inline popovers in JavaScript
|
|
1089
|
+
* frameworks such as Angular, React, and Vue.
|
|
1090
|
+
*/
|
|
1091
|
+
this.keepContentsMounted = false;
|
|
281
1092
|
this.onBackdropTap = () => {
|
|
282
1093
|
this.dismiss(undefined, BACKDROP);
|
|
283
1094
|
};
|
|
@@ -288,44 +1099,251 @@ const Popover = class {
|
|
|
288
1099
|
const event = new CustomEvent(name, {
|
|
289
1100
|
bubbles: false,
|
|
290
1101
|
cancelable: false,
|
|
291
|
-
detail: modalEvent.detail
|
|
1102
|
+
detail: modalEvent.detail,
|
|
292
1103
|
});
|
|
293
1104
|
el.dispatchEvent(event);
|
|
294
1105
|
}
|
|
295
1106
|
};
|
|
1107
|
+
this.configureTriggerInteraction = () => {
|
|
1108
|
+
const { trigger, triggerAction, el, destroyTriggerInteraction } = this;
|
|
1109
|
+
if (destroyTriggerInteraction) {
|
|
1110
|
+
destroyTriggerInteraction();
|
|
1111
|
+
}
|
|
1112
|
+
const triggerEl = (this.triggerEl = trigger !== undefined ? document.getElementById(trigger) : null);
|
|
1113
|
+
if (!triggerEl) {
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
this.destroyTriggerInteraction = configureTriggerInteraction(triggerEl, triggerAction, el);
|
|
1117
|
+
};
|
|
1118
|
+
this.configureKeyboardInteraction = () => {
|
|
1119
|
+
const { destroyKeyboardInteraction, el } = this;
|
|
1120
|
+
if (destroyKeyboardInteraction) {
|
|
1121
|
+
destroyKeyboardInteraction();
|
|
1122
|
+
}
|
|
1123
|
+
this.destroyKeyboardInteraction = configureKeyboardInteraction(el);
|
|
1124
|
+
};
|
|
1125
|
+
this.configureDismissInteraction = () => {
|
|
1126
|
+
const { destroyDismissInteraction, parentPopover, triggerAction, triggerEl, el } = this;
|
|
1127
|
+
if (!parentPopover || !triggerEl) {
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
if (destroyDismissInteraction) {
|
|
1131
|
+
destroyDismissInteraction();
|
|
1132
|
+
}
|
|
1133
|
+
this.destroyDismissInteraction = configureDismissInteraction(triggerEl, triggerAction, el, parentPopover);
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
onTriggerChange() {
|
|
1137
|
+
this.configureTriggerInteraction();
|
|
1138
|
+
}
|
|
1139
|
+
onIsOpenChange(newValue, oldValue) {
|
|
1140
|
+
if (newValue === true && oldValue === false) {
|
|
1141
|
+
this.present();
|
|
1142
|
+
}
|
|
1143
|
+
else if (newValue === false && oldValue === true) {
|
|
1144
|
+
this.dismiss();
|
|
1145
|
+
}
|
|
296
1146
|
}
|
|
297
1147
|
connectedCallback() {
|
|
298
|
-
|
|
1148
|
+
const { configureTriggerInteraction, el } = this;
|
|
1149
|
+
prepareOverlay(el);
|
|
1150
|
+
configureTriggerInteraction();
|
|
1151
|
+
}
|
|
1152
|
+
disconnectedCallback() {
|
|
1153
|
+
const { destroyTriggerInteraction } = this;
|
|
1154
|
+
if (destroyTriggerInteraction) {
|
|
1155
|
+
destroyTriggerInteraction();
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
componentWillLoad() {
|
|
1159
|
+
/**
|
|
1160
|
+
* If user has custom ID set then we should
|
|
1161
|
+
* not assign the default incrementing ID.
|
|
1162
|
+
*/
|
|
1163
|
+
this.popoverId = this.el.hasAttribute('id') ? this.el.getAttribute('id') : `ion-popover-${this.popoverIndex}`;
|
|
1164
|
+
this.parentPopover = this.el.closest(`ion-popover:not(#${this.popoverId})`);
|
|
1165
|
+
if (this.alignment === undefined) {
|
|
1166
|
+
this.alignment = getIonMode(this) === 'ios' ? 'center' : 'start';
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
componentDidLoad() {
|
|
1170
|
+
const { parentPopover, isOpen } = this;
|
|
1171
|
+
/**
|
|
1172
|
+
* If popover was rendered with isOpen="true"
|
|
1173
|
+
* then we should open popover immediately.
|
|
1174
|
+
*/
|
|
1175
|
+
if (isOpen === true) {
|
|
1176
|
+
raf(() => this.present());
|
|
1177
|
+
}
|
|
1178
|
+
if (parentPopover) {
|
|
1179
|
+
addEventListener(parentPopover, 'ionPopoverWillDismiss', () => {
|
|
1180
|
+
this.dismiss(undefined, undefined, false);
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* When opening a popover from a trigger, we should not be
|
|
1186
|
+
* modifying the `event` prop from inside the component.
|
|
1187
|
+
* Additionally, when pressing the "Right" arrow key, we need
|
|
1188
|
+
* to shift focus to the first descendant in the newly presented
|
|
1189
|
+
* popover.
|
|
1190
|
+
*
|
|
1191
|
+
* @internal
|
|
1192
|
+
*/
|
|
1193
|
+
async presentFromTrigger(event, focusDescendant = false) {
|
|
1194
|
+
this.focusDescendantOnPresent = focusDescendant;
|
|
1195
|
+
await this.present(event);
|
|
1196
|
+
this.focusDescendantOnPresent = false;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Determines whether or not an overlay
|
|
1200
|
+
* is being used inline or via a controller/JS
|
|
1201
|
+
* and returns the correct delegate.
|
|
1202
|
+
* By default, subsequent calls to getDelegate
|
|
1203
|
+
* will use a cached version of the delegate.
|
|
1204
|
+
* This is useful for calling dismiss after
|
|
1205
|
+
* present so that the correct delegate is given.
|
|
1206
|
+
*/
|
|
1207
|
+
getDelegate(force = false) {
|
|
1208
|
+
if (this.workingDelegate && !force) {
|
|
1209
|
+
return {
|
|
1210
|
+
delegate: this.workingDelegate,
|
|
1211
|
+
inline: this.inline,
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* If using overlay inline
|
|
1216
|
+
* we potentially need to use the coreDelegate
|
|
1217
|
+
* so that this works in vanilla JS apps.
|
|
1218
|
+
* If a developer has presented this component
|
|
1219
|
+
* via a controller, then we can assume
|
|
1220
|
+
* the component is already in the
|
|
1221
|
+
* correct place.
|
|
1222
|
+
*/
|
|
1223
|
+
const parentEl = this.el.parentNode;
|
|
1224
|
+
const inline = (this.inline = parentEl !== null && !this.hasController);
|
|
1225
|
+
const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
|
|
1226
|
+
return { inline, delegate };
|
|
299
1227
|
}
|
|
300
1228
|
/**
|
|
301
1229
|
* Present the popover overlay after it has been created.
|
|
1230
|
+
* Developers can pass a mouse, touch, or pointer event
|
|
1231
|
+
* to position the popover relative to where that event
|
|
1232
|
+
* was dispatched.
|
|
302
1233
|
*/
|
|
303
|
-
async present() {
|
|
1234
|
+
async present(event) {
|
|
304
1235
|
if (this.presented) {
|
|
305
1236
|
return;
|
|
306
1237
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
1238
|
+
/**
|
|
1239
|
+
* When using an inline popover
|
|
1240
|
+
* and dismissing a popover it is possible to
|
|
1241
|
+
* quickly present the popover while it is
|
|
1242
|
+
* dismissing. We need to await any current
|
|
1243
|
+
* transition to allow the dismiss to finish
|
|
1244
|
+
* before presenting again.
|
|
1245
|
+
*/
|
|
1246
|
+
if (this.currentTransition !== undefined) {
|
|
1247
|
+
await this.currentTransition;
|
|
310
1248
|
}
|
|
311
1249
|
const data = Object.assign(Object.assign({}, this.componentProps), { popover: this.el });
|
|
312
|
-
|
|
1250
|
+
const { inline, delegate } = this.getDelegate(true);
|
|
1251
|
+
this.usersElement = await attachComponent(delegate, this.el, this.component, ['popover-viewport'], data, inline);
|
|
313
1252
|
await deepReady(this.usersElement);
|
|
314
|
-
|
|
1253
|
+
if (!this.keyboardEvents) {
|
|
1254
|
+
this.configureKeyboardInteraction();
|
|
1255
|
+
}
|
|
1256
|
+
this.configureDismissInteraction();
|
|
1257
|
+
this.ionMount.emit();
|
|
1258
|
+
return new Promise((resolve) => {
|
|
1259
|
+
/**
|
|
1260
|
+
* Wait two request animation frame loops before presenting the popover.
|
|
1261
|
+
* This allows the framework implementations enough time to mount
|
|
1262
|
+
* the popover contents, so the bounding box is set when the popover
|
|
1263
|
+
* transition starts.
|
|
1264
|
+
*
|
|
1265
|
+
* On Angular and React, a single raf is enough time, but for Vue
|
|
1266
|
+
* we need to wait two rafs. As a result we are using two rafs for
|
|
1267
|
+
* all frameworks to ensure the popover is presented correctly.
|
|
1268
|
+
*/
|
|
1269
|
+
raf(() => {
|
|
1270
|
+
raf(async () => {
|
|
1271
|
+
this.currentTransition = present(this, 'popoverEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
1272
|
+
event: event || this.event,
|
|
1273
|
+
size: this.size,
|
|
1274
|
+
trigger: this.triggerEl,
|
|
1275
|
+
reference: this.reference,
|
|
1276
|
+
side: this.side,
|
|
1277
|
+
align: this.alignment,
|
|
1278
|
+
});
|
|
1279
|
+
await this.currentTransition;
|
|
1280
|
+
this.currentTransition = undefined;
|
|
1281
|
+
/**
|
|
1282
|
+
* If popover is nested and was
|
|
1283
|
+
* presented using the "Right" arrow key,
|
|
1284
|
+
* we need to move focus to the first
|
|
1285
|
+
* descendant inside of the popover.
|
|
1286
|
+
*/
|
|
1287
|
+
if (this.focusDescendantOnPresent) {
|
|
1288
|
+
focusFirstDescendant(this.el, this.el);
|
|
1289
|
+
}
|
|
1290
|
+
resolve();
|
|
1291
|
+
});
|
|
1292
|
+
});
|
|
1293
|
+
});
|
|
315
1294
|
}
|
|
316
1295
|
/**
|
|
317
1296
|
* Dismiss the popover overlay after it has been presented.
|
|
318
1297
|
*
|
|
319
1298
|
* @param data Any data to emit in the dismiss events.
|
|
320
1299
|
* @param role The role of the element that is dismissing the popover. For example, 'cancel' or 'backdrop'.
|
|
1300
|
+
* @param dismissParentPopover If `true`, dismissing this popover will also dismiss
|
|
1301
|
+
* a parent popover if this popover is nested. Defaults to `true`.
|
|
321
1302
|
*/
|
|
322
|
-
async dismiss(data, role) {
|
|
323
|
-
|
|
1303
|
+
async dismiss(data, role, dismissParentPopover = true) {
|
|
1304
|
+
/**
|
|
1305
|
+
* When using an inline popover
|
|
1306
|
+
* and presenting a popover it is possible to
|
|
1307
|
+
* quickly dismiss the popover while it is
|
|
1308
|
+
* presenting. We need to await any current
|
|
1309
|
+
* transition to allow the present to finish
|
|
1310
|
+
* before dismissing again.
|
|
1311
|
+
*/
|
|
1312
|
+
if (this.currentTransition !== undefined) {
|
|
1313
|
+
await this.currentTransition;
|
|
1314
|
+
}
|
|
1315
|
+
const { destroyKeyboardInteraction, destroyDismissInteraction } = this;
|
|
1316
|
+
if (dismissParentPopover && this.parentPopover) {
|
|
1317
|
+
this.parentPopover.dismiss(data, role, dismissParentPopover);
|
|
1318
|
+
}
|
|
1319
|
+
this.currentTransition = dismiss(this, data, role, 'popoverLeave', iosLeaveAnimation, mdLeaveAnimation, this.event);
|
|
1320
|
+
const shouldDismiss = await this.currentTransition;
|
|
324
1321
|
if (shouldDismiss) {
|
|
325
|
-
|
|
1322
|
+
if (destroyKeyboardInteraction) {
|
|
1323
|
+
destroyKeyboardInteraction();
|
|
1324
|
+
this.destroyKeyboardInteraction = undefined;
|
|
1325
|
+
}
|
|
1326
|
+
if (destroyDismissInteraction) {
|
|
1327
|
+
destroyDismissInteraction();
|
|
1328
|
+
this.destroyDismissInteraction = undefined;
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* If using popover inline
|
|
1332
|
+
* we potentially need to use the coreDelegate
|
|
1333
|
+
* so that this works in vanilla JS apps
|
|
1334
|
+
*/
|
|
1335
|
+
const { delegate } = this.getDelegate();
|
|
1336
|
+
await detachComponent(delegate, this.usersElement);
|
|
326
1337
|
}
|
|
1338
|
+
this.currentTransition = undefined;
|
|
327
1339
|
return shouldDismiss;
|
|
328
1340
|
}
|
|
1341
|
+
/**
|
|
1342
|
+
* @internal
|
|
1343
|
+
*/
|
|
1344
|
+
async getParentPopover() {
|
|
1345
|
+
return this.parentPopover;
|
|
1346
|
+
}
|
|
329
1347
|
/**
|
|
330
1348
|
* Returns a promise that resolves when the popover did dismiss.
|
|
331
1349
|
*/
|
|
@@ -340,19 +1358,27 @@ const Popover = class {
|
|
|
340
1358
|
}
|
|
341
1359
|
render() {
|
|
342
1360
|
const mode = getIonMode(this);
|
|
343
|
-
const { onLifecycle, htmlAttributes } = this;
|
|
1361
|
+
const { onLifecycle, popoverId, parentPopover, dismissOnSelect, side, arrow, htmlAttributes } = this;
|
|
1362
|
+
const desktop = isPlatform('desktop');
|
|
1363
|
+
const enableArrow = arrow && !parentPopover;
|
|
344
1364
|
return (h(Host, Object.assign({ "aria-modal": "true", "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
|
|
345
1365
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
346
|
-
}, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [mode]: true, 'popover-translucent': this.translucent }), onIonPopoverDidPresent: onLifecycle, onIonPopoverWillPresent: onLifecycle, onIonPopoverWillDismiss: onLifecycle, onIonPopoverDidDismiss: onLifecycle,
|
|
1366
|
+
}, id: popoverId, class: Object.assign(Object.assign({}, getClassMap(this.cssClass)), { [mode]: true, 'popover-translucent': this.translucent, 'overlay-hidden': true, 'popover-desktop': desktop, [`popover-side-${side}`]: true, 'popover-nested': !!parentPopover }), onIonPopoverDidPresent: onLifecycle, onIonPopoverWillPresent: onLifecycle, onIonPopoverWillDismiss: onLifecycle, onIonPopoverDidDismiss: onLifecycle, onIonBackdropTap: this.onBackdropTap }), !parentPopover && h("ion-backdrop", { tappable: this.backdropDismiss, visible: this.showBackdrop, part: "backdrop" }), h("div", { class: "popover-wrapper ion-overlay-wrapper", onClick: dismissOnSelect ? () => this.dismiss() : undefined }, enableArrow && h("div", { class: "popover-arrow", part: "arrow" }), h("div", { class: "popover-content", part: "content" }, h("slot", null)))));
|
|
347
1367
|
}
|
|
348
1368
|
get el() { return getElement(this); }
|
|
1369
|
+
static get watchers() { return {
|
|
1370
|
+
"trigger": ["onTriggerChange"],
|
|
1371
|
+
"triggerAction": ["onTriggerChange"],
|
|
1372
|
+
"isOpen": ["onIsOpenChange"]
|
|
1373
|
+
}; }
|
|
349
1374
|
};
|
|
350
1375
|
const LIFECYCLE_MAP = {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
1376
|
+
ionPopoverDidPresent: 'ionViewDidEnter',
|
|
1377
|
+
ionPopoverWillPresent: 'ionViewWillEnter',
|
|
1378
|
+
ionPopoverWillDismiss: 'ionViewWillLeave',
|
|
1379
|
+
ionPopoverDidDismiss: 'ionViewDidLeave',
|
|
355
1380
|
};
|
|
1381
|
+
let popoverIds = 0;
|
|
356
1382
|
Popover.style = {
|
|
357
1383
|
ios: popoverIosCss,
|
|
358
1384
|
md: popoverMdCss
|