@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
|
@@ -2,86 +2,519 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index$
|
|
6
|
-
const ionicGlobal = require('./ionic-global-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
require('./
|
|
16
|
-
require('./
|
|
5
|
+
const index$3 = require('./index-eaa0d16e.js');
|
|
6
|
+
const ionicGlobal = require('./ionic-global-f2d95fd3.js');
|
|
7
|
+
const index$2 = require('./index-9fca5d6f.js');
|
|
8
|
+
const frameworkDelegate = require('./framework-delegate-437c0645.js');
|
|
9
|
+
const helpers = require('./helpers-cb08f5ae.js');
|
|
10
|
+
const keyboard = require('./keyboard-79afcba2.js');
|
|
11
|
+
const index$4 = require('./index-b2a479e4.js');
|
|
12
|
+
const index = require('./index-57b9fa9e.js');
|
|
13
|
+
const overlays = require('./overlays-f7d24abf.js');
|
|
14
|
+
const theme = require('./theme-fc63803b.js');
|
|
15
|
+
const index$5 = require('./index-1b07c737.js');
|
|
16
|
+
const animation = require('./animation-9bea118f.js');
|
|
17
|
+
const cubicBezier = require('./cubic-bezier-0b702a31.js');
|
|
18
|
+
const index$1 = require('./index-643851c6.js');
|
|
19
|
+
require('./hardware-back-button-25372ec7.js');
|
|
20
|
+
require('./gesture-controller-00a6b02f.js');
|
|
17
21
|
|
|
22
|
+
/*!
|
|
23
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
24
|
+
*/
|
|
25
|
+
var Style;
|
|
26
|
+
(function (Style) {
|
|
27
|
+
Style["Dark"] = "DARK";
|
|
28
|
+
Style["Light"] = "LIGHT";
|
|
29
|
+
Style["Default"] = "DEFAULT";
|
|
30
|
+
})(Style || (Style = {}));
|
|
31
|
+
const StatusBar = {
|
|
32
|
+
getEngine() {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = index.win === null || index.win === void 0 ? void 0 : index.win.Capacitor) === null || _a === void 0 ? void 0 : _a.isPluginAvailable('StatusBar')) && (index.win === null || index.win === void 0 ? void 0 : index.win.Capacitor.Plugins.StatusBar);
|
|
35
|
+
},
|
|
36
|
+
supportsDefaultStatusBarStyle() {
|
|
37
|
+
var _a;
|
|
38
|
+
/**
|
|
39
|
+
* The 'DEFAULT' status bar style was added
|
|
40
|
+
* to the @capacitor/status-bar plugin in Capacitor 3.
|
|
41
|
+
* PluginHeaders is only supported in Capacitor 3+,
|
|
42
|
+
* so we can use this to detect Capacitor 3.
|
|
43
|
+
*/
|
|
44
|
+
return !!((_a = index.win === null || index.win === void 0 ? void 0 : index.win.Capacitor) === null || _a === void 0 ? void 0 : _a.PluginHeaders);
|
|
45
|
+
},
|
|
46
|
+
setStyle(options) {
|
|
47
|
+
const engine = this.getEngine();
|
|
48
|
+
if (!engine) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
engine.setStyle(options);
|
|
52
|
+
},
|
|
53
|
+
getStyle: async function () {
|
|
54
|
+
const engine = this.getEngine();
|
|
55
|
+
if (!engine) {
|
|
56
|
+
return Style.Default;
|
|
57
|
+
}
|
|
58
|
+
const { style } = await engine.getInfo();
|
|
59
|
+
return style;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/*!
|
|
64
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* Use y = mx + b to
|
|
68
|
+
* figure out the backdrop value
|
|
69
|
+
* at a particular x coordinate. This
|
|
70
|
+
* is useful when the backdrop does
|
|
71
|
+
* not begin to fade in until after
|
|
72
|
+
* the 0 breakpoint.
|
|
73
|
+
*/
|
|
74
|
+
const getBackdropValueForSheet = (x, backdropBreakpoint) => {
|
|
75
|
+
/**
|
|
76
|
+
* We will use these points:
|
|
77
|
+
* (backdropBreakpoint, 0)
|
|
78
|
+
* (maxBreakpoint, 1)
|
|
79
|
+
* We know that at the beginning breakpoint,
|
|
80
|
+
* the backdrop will be hidden. We also
|
|
81
|
+
* know that at the maxBreakpoint, the backdrop
|
|
82
|
+
* must be fully visible. maxBreakpoint should
|
|
83
|
+
* always be 1 even if the maximum value
|
|
84
|
+
* of the breakpoints array is not 1 since
|
|
85
|
+
* the animation runs from a progress of 0
|
|
86
|
+
* to a progress of 1.
|
|
87
|
+
* m = (y2 - y1) / (x2 - x1)
|
|
88
|
+
*
|
|
89
|
+
* This is simplified from:
|
|
90
|
+
* m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
|
|
91
|
+
*
|
|
92
|
+
* If the backdropBreakpoint is 1, we return 0 as the
|
|
93
|
+
* backdrop is completely hidden.
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
if (backdropBreakpoint === 1) {
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
const slope = 1 / (1 - backdropBreakpoint);
|
|
100
|
+
/**
|
|
101
|
+
* From here, compute b which is
|
|
102
|
+
* the backdrop opacity if the offset
|
|
103
|
+
* is 0. If the backdrop does not
|
|
104
|
+
* begin to fade in until after the
|
|
105
|
+
* 0 breakpoint, this b value will be
|
|
106
|
+
* negative. This is fine as we never pass
|
|
107
|
+
* b directly into the animation keyframes.
|
|
108
|
+
* b = y - mx
|
|
109
|
+
* Use a known point: (backdropBreakpoint, 0)
|
|
110
|
+
* This is simplified from:
|
|
111
|
+
* b = 0 - (backdropBreakpoint * slope)
|
|
112
|
+
*/
|
|
113
|
+
const b = -(backdropBreakpoint * slope);
|
|
114
|
+
/**
|
|
115
|
+
* Finally, we can now determine the
|
|
116
|
+
* backdrop offset given an arbitrary
|
|
117
|
+
* gesture offset.
|
|
118
|
+
*/
|
|
119
|
+
return x * slope + b;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* The tablet/desktop card modal activates
|
|
123
|
+
* when the window width is >= 768.
|
|
124
|
+
* At that point, the presenting element
|
|
125
|
+
* is not transformed, so we do not need to
|
|
126
|
+
* adjust the status bar color.
|
|
127
|
+
*
|
|
128
|
+
* Note: We check supportsDefaultStatusBarStyle so that
|
|
129
|
+
* Capacitor <= 2 users do not get their status bar
|
|
130
|
+
* stuck in an inconsistent state due to a lack of
|
|
131
|
+
* support for Style.Default.
|
|
132
|
+
*/
|
|
133
|
+
const setCardStatusBarDark = () => {
|
|
134
|
+
if (!index.win || index.win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
StatusBar.setStyle({ style: Style.Dark });
|
|
138
|
+
};
|
|
139
|
+
const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
|
|
140
|
+
if (!index.win || index.win.innerWidth >= 768 || !StatusBar.supportsDefaultStatusBarStyle()) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
StatusBar.setStyle({ style: defaultStyle });
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/*!
|
|
147
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
148
|
+
*/
|
|
149
|
+
const handleCanDismiss = async (el, animation) => {
|
|
150
|
+
/**
|
|
151
|
+
* If canDismiss is not a function
|
|
152
|
+
* then we can return early. If canDismiss is `true`,
|
|
153
|
+
* then canDismissBlocksGesture is `false` as canDismiss
|
|
154
|
+
* will never interrupt the gesture. As a result,
|
|
155
|
+
* this code block is never reached. If canDismiss is `false`,
|
|
156
|
+
* then we never dismiss.
|
|
157
|
+
*/
|
|
158
|
+
if (typeof el.canDismiss !== 'function') {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Run the canDismiss callback.
|
|
163
|
+
* If the function returns `true`,
|
|
164
|
+
* then we can proceed with dismiss.
|
|
165
|
+
*/
|
|
166
|
+
const shouldDismiss = await el.canDismiss(undefined, overlays.GESTURE);
|
|
167
|
+
if (!shouldDismiss) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* If canDismiss resolved after the snap
|
|
172
|
+
* back animation finished, we can
|
|
173
|
+
* dismiss immediately.
|
|
174
|
+
*
|
|
175
|
+
* If canDismiss resolved before the snap
|
|
176
|
+
* back animation finished, we need to
|
|
177
|
+
* wait until the snap back animation is
|
|
178
|
+
* done before dismissing.
|
|
179
|
+
*/
|
|
180
|
+
if (animation.isRunning()) {
|
|
181
|
+
animation.onFinish(() => {
|
|
182
|
+
el.dismiss(undefined, 'handler');
|
|
183
|
+
}, { oneTimeCallback: true });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
el.dismiss(undefined, 'handler');
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* This function lets us simulate a realistic spring-like animation
|
|
191
|
+
* when swiping down on the modal.
|
|
192
|
+
* There are two forces that we need to use to compute the spring physics:
|
|
193
|
+
*
|
|
194
|
+
* 1. Stiffness, k: This is a measure of resistance applied a spring.
|
|
195
|
+
* 2. Dampening, c: This value has the effect of reducing or preventing oscillation.
|
|
196
|
+
*
|
|
197
|
+
* Using these two values, we can calculate the Spring Force and the Dampening Force
|
|
198
|
+
* to compute the total force applied to a spring.
|
|
199
|
+
*
|
|
200
|
+
* Spring Force: This force pulls a spring back into its equilibrium position.
|
|
201
|
+
* Hooke's Law tells us that that spring force (FS) = kX.
|
|
202
|
+
* k is the stiffness of a spring, and X is the displacement of the spring from its
|
|
203
|
+
* equilibrium position. In this case, it is the amount by which the free end
|
|
204
|
+
* of a spring was displaced (stretched/pushed) from its "relaxed" position.
|
|
205
|
+
*
|
|
206
|
+
* Dampening Force: This force slows down motion. Without it, a spring would oscillate forever.
|
|
207
|
+
* The dampening force, FD, can be found via this formula: FD = -cv
|
|
208
|
+
* where c the dampening value and v is velocity.
|
|
209
|
+
*
|
|
210
|
+
* Therefore, the resulting force that is exerted on the block is:
|
|
211
|
+
* F = FS + FD = -kX - cv
|
|
212
|
+
*
|
|
213
|
+
* Newton's 2nd Law tells us that F = ma:
|
|
214
|
+
* ma = -kX - cv.
|
|
215
|
+
*
|
|
216
|
+
* For Ionic's purposes, we can assume that m = 1:
|
|
217
|
+
* a = -kX - cv
|
|
218
|
+
*
|
|
219
|
+
* Imagine a block attached to the end of a spring. At equilibrium
|
|
220
|
+
* the block is at position x = 1.
|
|
221
|
+
* Pressing on the block moves it to position x = 0;
|
|
222
|
+
* So, to calculate the displacement, we need to take the
|
|
223
|
+
* current position and subtract the previous position from it.
|
|
224
|
+
* X = x - x0 = 0 - 1 = -1.
|
|
225
|
+
*
|
|
226
|
+
* For Ionic's purposes, we are only pushing on the spring modal
|
|
227
|
+
* so we have a max position of 1.
|
|
228
|
+
* As a result, we can expand displacement to this formula:
|
|
229
|
+
* X = x - 1
|
|
230
|
+
*
|
|
231
|
+
* a = -k(x - 1) - cv
|
|
232
|
+
*
|
|
233
|
+
* We can represent the motion of something as a function of time: f(t) = x.
|
|
234
|
+
* The derivative of position gives us the velocity: f'(t)
|
|
235
|
+
* The derivative of the velocity gives us the acceleration: f''(t)
|
|
236
|
+
*
|
|
237
|
+
* We can substitute the formula above with these values:
|
|
238
|
+
*
|
|
239
|
+
* f"(t) = -k * (f(t) - 1) - c * f'(t)
|
|
240
|
+
*
|
|
241
|
+
* This is called a differential equation.
|
|
242
|
+
*
|
|
243
|
+
* We know that at t = 0, we are at x = 0 because the modal does not move: f(0) = 0
|
|
244
|
+
* This means our velocity is also zero: f'(0) = 0.
|
|
245
|
+
*
|
|
246
|
+
* We can cheat a bit and plug the formula into Wolfram Alpha.
|
|
247
|
+
* However, we need to pick stiffness and dampening values:
|
|
248
|
+
* k = 0.57
|
|
249
|
+
* c = 15
|
|
250
|
+
*
|
|
251
|
+
* I picked these as they are fairly close to native iOS's spring effect
|
|
252
|
+
* with the modal.
|
|
253
|
+
*
|
|
254
|
+
* What we plug in is this: f(0) = 0; f'(0) = 0; f''(t) = -0.57(f(t) - 1) - 15f'(t)
|
|
255
|
+
*
|
|
256
|
+
* The result is a formula that lets us calculate the acceleration
|
|
257
|
+
* for a given time t.
|
|
258
|
+
* Note: This is the approximate form of the solution. Wolfram Alpha will
|
|
259
|
+
* give you a complex differential equation too.
|
|
260
|
+
*/
|
|
261
|
+
const calculateSpringStep = (t) => {
|
|
262
|
+
return 0.00255275 * 2.71828 ** (-14.9619 * t) - 1.00255 * 2.71828 ** (-0.0380968 * t) + 1;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/*!
|
|
266
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
267
|
+
*/
|
|
18
268
|
// Defaults for the card swipe animation
|
|
19
269
|
const SwipeToCloseDefaults = {
|
|
20
270
|
MIN_PRESENTING_SCALE: 0.93,
|
|
21
271
|
};
|
|
22
|
-
const createSwipeToCloseGesture = (el, animation, onDismiss) => {
|
|
272
|
+
const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) => {
|
|
273
|
+
/**
|
|
274
|
+
* The step value at which a card modal
|
|
275
|
+
* is eligible for dismissing via gesture.
|
|
276
|
+
*/
|
|
277
|
+
const DISMISS_THRESHOLD = 0.5;
|
|
23
278
|
const height = el.offsetHeight;
|
|
24
279
|
let isOpen = false;
|
|
280
|
+
let canDismissBlocksGesture = false;
|
|
281
|
+
let contentEl = null;
|
|
282
|
+
let scrollEl = null;
|
|
283
|
+
const canDismissMaxStep = 0.2;
|
|
284
|
+
let initialScrollY = true;
|
|
285
|
+
let lastStep = 0;
|
|
286
|
+
const getScrollY = () => {
|
|
287
|
+
if (contentEl && index$2.isIonContent(contentEl)) {
|
|
288
|
+
return contentEl.scrollY;
|
|
289
|
+
/**
|
|
290
|
+
* Custom scroll containers are intended to be
|
|
291
|
+
* used with virtual scrolling, so we assume
|
|
292
|
+
* there is scrolling in this case.
|
|
293
|
+
*/
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
25
299
|
const canStart = (detail) => {
|
|
26
300
|
const target = detail.event.target;
|
|
27
|
-
if (target === null ||
|
|
28
|
-
!target.closest) {
|
|
301
|
+
if (target === null || !target.closest) {
|
|
29
302
|
return true;
|
|
30
303
|
}
|
|
31
|
-
|
|
32
|
-
|
|
304
|
+
/**
|
|
305
|
+
* If we are swiping on the content,
|
|
306
|
+
* swiping should only be possible if
|
|
307
|
+
* the content is scrolled all the way
|
|
308
|
+
* to the top so that we do not interfere
|
|
309
|
+
* with scrolling.
|
|
310
|
+
*
|
|
311
|
+
* We cannot assume that the `ion-content`
|
|
312
|
+
* target will remain consistent between
|
|
313
|
+
* swipes. For example, when using
|
|
314
|
+
* ion-nav within a card modal it is
|
|
315
|
+
* possible to swipe, push a view, and then
|
|
316
|
+
* swipe again. The target content will not
|
|
317
|
+
* be the same between swipes.
|
|
318
|
+
*/
|
|
319
|
+
contentEl = index$2.findClosestIonContent(target);
|
|
320
|
+
if (contentEl) {
|
|
321
|
+
/**
|
|
322
|
+
* The card should never swipe to close
|
|
323
|
+
* on the content with a refresher.
|
|
324
|
+
* Note: We cannot solve this by making the
|
|
325
|
+
* swipeToClose gesture have a higher priority
|
|
326
|
+
* than the refresher gesture as the iOS native
|
|
327
|
+
* refresh gesture uses a scroll listener in
|
|
328
|
+
* addition to a gesture.
|
|
329
|
+
*
|
|
330
|
+
* Note: Do not use getScrollElement here
|
|
331
|
+
* because we need this to be a synchronous
|
|
332
|
+
* operation, and getScrollElement is
|
|
333
|
+
* asynchronous.
|
|
334
|
+
*/
|
|
335
|
+
if (index$2.isIonContent(contentEl)) {
|
|
336
|
+
const root = helpers.getElementRoot(contentEl);
|
|
337
|
+
scrollEl = root.querySelector('.inner-scroll');
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
scrollEl = contentEl;
|
|
341
|
+
}
|
|
342
|
+
const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
|
|
343
|
+
return !hasRefresherInContent && scrollEl.scrollTop === 0;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Card should be swipeable on all
|
|
347
|
+
* parts of the modal except for the footer.
|
|
348
|
+
*/
|
|
349
|
+
const footer = target.closest('ion-footer');
|
|
350
|
+
if (footer === null) {
|
|
33
351
|
return true;
|
|
34
352
|
}
|
|
35
|
-
// Target is in the content or the footer so do not start the gesture.
|
|
36
|
-
// We could be more nuanced here and allow it for content that
|
|
37
|
-
// does not need to scroll.
|
|
38
353
|
return false;
|
|
39
354
|
};
|
|
40
|
-
const onStart = () => {
|
|
41
|
-
|
|
355
|
+
const onStart = (detail) => {
|
|
356
|
+
const { deltaY } = detail;
|
|
357
|
+
/**
|
|
358
|
+
* Get the initial scrollY value so
|
|
359
|
+
* that we can correctly reset the scrollY
|
|
360
|
+
* prop when the gesture ends.
|
|
361
|
+
*/
|
|
362
|
+
initialScrollY = getScrollY();
|
|
363
|
+
/**
|
|
364
|
+
* If canDismiss is anything other than `true`
|
|
365
|
+
* then users should be able to swipe down
|
|
366
|
+
* until a threshold is hit. At that point,
|
|
367
|
+
* the card modal should not proceed any further.
|
|
368
|
+
* TODO (FW-937)
|
|
369
|
+
* Remove undefined check
|
|
370
|
+
*/
|
|
371
|
+
canDismissBlocksGesture = el.canDismiss !== undefined && el.canDismiss !== true;
|
|
372
|
+
/**
|
|
373
|
+
* If we are pulling down, then
|
|
374
|
+
* it is possible we are pulling on the
|
|
375
|
+
* content. We do not want scrolling to
|
|
376
|
+
* happen at the same time as the gesture.
|
|
377
|
+
*/
|
|
378
|
+
if (deltaY > 0 && contentEl) {
|
|
379
|
+
index$2.disableContentScrollY(contentEl);
|
|
380
|
+
}
|
|
381
|
+
animation.progressStart(true, isOpen ? 1 : 0);
|
|
42
382
|
};
|
|
43
383
|
const onMove = (detail) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
384
|
+
const { deltaY } = detail;
|
|
385
|
+
/**
|
|
386
|
+
* If we are pulling down, then
|
|
387
|
+
* it is possible we are pulling on the
|
|
388
|
+
* content. We do not want scrolling to
|
|
389
|
+
* happen at the same time as the gesture.
|
|
390
|
+
*/
|
|
391
|
+
if (deltaY > 0 && contentEl) {
|
|
392
|
+
index$2.disableContentScrollY(contentEl);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* If we are swiping on the content
|
|
396
|
+
* then the swipe gesture should only
|
|
397
|
+
* happen if we are pulling down.
|
|
398
|
+
*
|
|
399
|
+
* However, if we pull up and
|
|
400
|
+
* then down such that the scroll position
|
|
401
|
+
* returns to 0, we should be able to swipe
|
|
402
|
+
* the card.
|
|
403
|
+
*/
|
|
404
|
+
const step = detail.deltaY / height;
|
|
405
|
+
/**
|
|
406
|
+
* Check if user is swiping down and
|
|
407
|
+
* if we have a canDismiss value that
|
|
408
|
+
* should block the gesture from
|
|
409
|
+
* proceeding,
|
|
410
|
+
*/
|
|
411
|
+
const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
|
|
412
|
+
/**
|
|
413
|
+
* If we are blocking the gesture from dismissing,
|
|
414
|
+
* set the max step value so that the sheet cannot be
|
|
415
|
+
* completely hidden.
|
|
416
|
+
*/
|
|
417
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
418
|
+
/**
|
|
419
|
+
* If we are blocking the gesture from
|
|
420
|
+
* dismissing, calculate the spring modifier value
|
|
421
|
+
* this will be added to the starting breakpoint
|
|
422
|
+
* value to give the gesture a spring-like feeling.
|
|
423
|
+
* Note that the starting breakpoint is always 0,
|
|
424
|
+
* so we omit adding 0 to the result.
|
|
425
|
+
*/
|
|
426
|
+
const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
|
|
427
|
+
const clampedStep = helpers.clamp(0.0001, processedStep, maxStep);
|
|
428
|
+
animation.progressStep(clampedStep);
|
|
429
|
+
/**
|
|
430
|
+
* When swiping down half way, the status bar style
|
|
431
|
+
* should be reset to its default value.
|
|
432
|
+
*
|
|
433
|
+
* We track lastStep so that we do not fire these
|
|
434
|
+
* functions on every onMove, only when the user has
|
|
435
|
+
* crossed a certain threshold.
|
|
436
|
+
*/
|
|
437
|
+
if (clampedStep >= DISMISS_THRESHOLD && lastStep < DISMISS_THRESHOLD) {
|
|
438
|
+
setCardStatusBarDefault(statusBarStyle);
|
|
439
|
+
/**
|
|
440
|
+
* However, if we swipe back up, then the
|
|
441
|
+
* status bar style should be set to have light
|
|
442
|
+
* text on a dark background.
|
|
443
|
+
*/
|
|
444
|
+
}
|
|
445
|
+
else if (clampedStep < DISMISS_THRESHOLD && lastStep >= DISMISS_THRESHOLD) {
|
|
446
|
+
setCardStatusBarDark();
|
|
447
|
+
}
|
|
448
|
+
lastStep = clampedStep;
|
|
46
449
|
};
|
|
47
450
|
const onEnd = (detail) => {
|
|
48
451
|
const velocity = detail.velocityY;
|
|
49
|
-
const step =
|
|
452
|
+
const step = detail.deltaY / height;
|
|
453
|
+
const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
|
|
454
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
455
|
+
const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
|
|
456
|
+
const clampedStep = helpers.clamp(0.0001, processedStep, maxStep);
|
|
50
457
|
const threshold = (detail.deltaY + velocity * 1000) / height;
|
|
51
|
-
|
|
52
|
-
|
|
458
|
+
/**
|
|
459
|
+
* If canDismiss blocks
|
|
460
|
+
* the swipe gesture, then the
|
|
461
|
+
* animation can never complete until
|
|
462
|
+
* canDismiss is checked.
|
|
463
|
+
*/
|
|
464
|
+
const shouldComplete = !isAttemptingDismissWithCanDismiss && threshold >= DISMISS_THRESHOLD;
|
|
465
|
+
let newStepValue = shouldComplete ? -0.001 : 0.001;
|
|
53
466
|
if (!shouldComplete) {
|
|
54
467
|
animation.easing('cubic-bezier(1, 0, 0.68, 0.28)');
|
|
55
|
-
newStepValue += cubicBezier.getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1],
|
|
468
|
+
newStepValue += cubicBezier.getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], clampedStep)[0];
|
|
56
469
|
}
|
|
57
470
|
else {
|
|
58
471
|
animation.easing('cubic-bezier(0.32, 0.72, 0, 1)');
|
|
59
|
-
newStepValue += cubicBezier.getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1],
|
|
472
|
+
newStepValue += cubicBezier.getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], clampedStep)[0];
|
|
60
473
|
}
|
|
61
|
-
const duration =
|
|
474
|
+
const duration = shouldComplete
|
|
475
|
+
? computeDuration(step * height, velocity)
|
|
476
|
+
: computeDuration((1 - clampedStep) * height, velocity);
|
|
62
477
|
isOpen = shouldComplete;
|
|
63
478
|
gesture.enable(false);
|
|
479
|
+
if (contentEl) {
|
|
480
|
+
index$2.resetContentScrollY(contentEl, initialScrollY);
|
|
481
|
+
}
|
|
64
482
|
animation
|
|
65
483
|
.onFinish(() => {
|
|
66
484
|
if (!shouldComplete) {
|
|
67
485
|
gesture.enable(true);
|
|
68
486
|
}
|
|
69
487
|
})
|
|
70
|
-
.progressEnd(
|
|
71
|
-
|
|
488
|
+
.progressEnd(shouldComplete ? 1 : 0, newStepValue, duration);
|
|
489
|
+
/**
|
|
490
|
+
* If the canDismiss value blocked the gesture
|
|
491
|
+
* from proceeding, then we should ignore whatever
|
|
492
|
+
* shouldComplete is. Whether or not the modal
|
|
493
|
+
* animation should complete is now determined by
|
|
494
|
+
* canDismiss.
|
|
495
|
+
*
|
|
496
|
+
* If the user swiped >25% of the way
|
|
497
|
+
* to the max step, then we should
|
|
498
|
+
* check canDismiss. 25% was chosen
|
|
499
|
+
* to avoid accidental swipes.
|
|
500
|
+
*/
|
|
501
|
+
if (isAttemptingDismissWithCanDismiss && clampedStep > maxStep / 4) {
|
|
502
|
+
handleCanDismiss(el, animation);
|
|
503
|
+
}
|
|
504
|
+
else if (shouldComplete) {
|
|
72
505
|
onDismiss();
|
|
73
506
|
}
|
|
74
507
|
};
|
|
75
|
-
const gesture = index.createGesture({
|
|
508
|
+
const gesture = index$1.createGesture({
|
|
76
509
|
el,
|
|
77
510
|
gestureName: 'modalSwipeToClose',
|
|
78
|
-
gesturePriority:
|
|
511
|
+
gesturePriority: 39,
|
|
79
512
|
direction: 'y',
|
|
80
513
|
threshold: 10,
|
|
81
514
|
canStart,
|
|
82
515
|
onStart,
|
|
83
516
|
onMove,
|
|
84
|
-
onEnd
|
|
517
|
+
onEnd,
|
|
85
518
|
});
|
|
86
519
|
return gesture;
|
|
87
520
|
};
|
|
@@ -89,55 +522,113 @@ const computeDuration = (remaining, velocity) => {
|
|
|
89
522
|
return helpers.clamp(400, remaining / Math.abs(velocity * 1.1), 500);
|
|
90
523
|
};
|
|
91
524
|
|
|
92
|
-
|
|
93
|
-
*
|
|
525
|
+
/*!
|
|
526
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
94
527
|
*/
|
|
95
|
-
const
|
|
528
|
+
const createSheetEnterAnimation = (opts) => {
|
|
529
|
+
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
530
|
+
/**
|
|
531
|
+
* If the backdropBreakpoint is undefined, then the backdrop
|
|
532
|
+
* should always fade in. If the backdropBreakpoint came before the
|
|
533
|
+
* current breakpoint, then the backdrop should be fading in.
|
|
534
|
+
*/
|
|
535
|
+
const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
|
|
536
|
+
const initialBackdrop = shouldShowBackdrop ? `calc(var(--backdrop-opacity) * ${currentBreakpoint})` : '0';
|
|
537
|
+
const backdropAnimation = animation.createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
|
|
538
|
+
if (shouldShowBackdrop) {
|
|
539
|
+
backdropAnimation
|
|
540
|
+
.beforeStyles({
|
|
541
|
+
'pointer-events': 'none',
|
|
542
|
+
})
|
|
543
|
+
.afterClearStyles(['pointer-events']);
|
|
544
|
+
}
|
|
545
|
+
const wrapperAnimation = animation.createAnimation('wrapperAnimation').keyframes([
|
|
546
|
+
{ offset: 0, opacity: 1, transform: 'translateY(100%)' },
|
|
547
|
+
{ offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
548
|
+
]);
|
|
549
|
+
return { wrapperAnimation, backdropAnimation };
|
|
550
|
+
};
|
|
551
|
+
const createSheetLeaveAnimation = (opts) => {
|
|
552
|
+
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
553
|
+
/**
|
|
554
|
+
* Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
|
|
555
|
+
* is defined, so we need to account for that offset by figuring out
|
|
556
|
+
* what the current backdrop value should be.
|
|
557
|
+
*/
|
|
558
|
+
const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
|
|
559
|
+
const defaultBackdrop = [
|
|
560
|
+
{ offset: 0, opacity: backdropValue },
|
|
561
|
+
{ offset: 1, opacity: 0 },
|
|
562
|
+
];
|
|
563
|
+
const customBackdrop = [
|
|
564
|
+
{ offset: 0, opacity: backdropValue },
|
|
565
|
+
{ offset: backdropBreakpoint, opacity: 0 },
|
|
566
|
+
{ offset: 1, opacity: 0 },
|
|
567
|
+
];
|
|
568
|
+
const backdropAnimation = animation.createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
|
|
569
|
+
const wrapperAnimation = animation.createAnimation('wrapperAnimation').keyframes([
|
|
570
|
+
{ offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
571
|
+
{ offset: 1, opacity: 1, transform: `translateY(100%)` },
|
|
572
|
+
]);
|
|
573
|
+
return { wrapperAnimation, backdropAnimation };
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
/*!
|
|
577
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
578
|
+
*/
|
|
579
|
+
const createEnterAnimation$1 = () => {
|
|
96
580
|
const backdropAnimation = animation.createAnimation()
|
|
97
|
-
.addElement(baseEl.querySelector('ion-backdrop'))
|
|
98
581
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
99
582
|
.beforeStyles({
|
|
100
|
-
'pointer-events': 'none'
|
|
583
|
+
'pointer-events': 'none',
|
|
101
584
|
})
|
|
102
585
|
.afterClearStyles(['pointer-events']);
|
|
103
|
-
const wrapperAnimation = animation.createAnimation()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
586
|
+
const wrapperAnimation = animation.createAnimation().fromTo('transform', 'translateY(100vh)', 'translateY(0vh)');
|
|
587
|
+
return { backdropAnimation, wrapperAnimation };
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* iOS Modal Enter Animation for the Card presentation style
|
|
591
|
+
*/
|
|
592
|
+
const iosEnterAnimation = (baseEl, opts) => {
|
|
593
|
+
const { presentingEl, currentBreakpoint } = opts;
|
|
594
|
+
const root = helpers.getElementRoot(baseEl);
|
|
595
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$1();
|
|
596
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
597
|
+
wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
|
|
598
|
+
const baseAnimation = animation.createAnimation('entering-base')
|
|
108
599
|
.addElement(baseEl)
|
|
109
600
|
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
110
601
|
.duration(500)
|
|
111
602
|
.addAnimation(wrapperAnimation);
|
|
112
603
|
if (presentingEl) {
|
|
113
604
|
const isMobile = window.innerWidth < 768;
|
|
114
|
-
const hasCardModal =
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
605
|
+
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
606
|
+
const presentingElRoot = helpers.getElementRoot(presentingEl);
|
|
607
|
+
const presentingAnimation = animation.createAnimation().beforeStyles({
|
|
608
|
+
transform: 'translateY(0)',
|
|
118
609
|
'transform-origin': 'top center',
|
|
119
|
-
|
|
610
|
+
overflow: 'hidden',
|
|
120
611
|
});
|
|
121
612
|
const bodyEl = document.body;
|
|
122
613
|
if (isMobile) {
|
|
123
614
|
/**
|
|
124
615
|
* Fallback for browsers that does not support `max()` (ex: Firefox)
|
|
125
616
|
* No need to worry about statusbar padding since engines like Gecko
|
|
126
|
-
* are not used as the engine for
|
|
617
|
+
* are not used as the engine for standalone Cordova/Capacitor apps
|
|
127
618
|
*/
|
|
128
|
-
const transformOffset =
|
|
619
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
129
620
|
const modalTransform = hasCardModal ? '-10px' : transformOffset;
|
|
130
621
|
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
131
622
|
const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
|
|
132
623
|
presentingAnimation
|
|
133
624
|
.afterStyles({
|
|
134
|
-
|
|
625
|
+
transform: finalTransform,
|
|
135
626
|
})
|
|
136
627
|
.beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
|
|
137
628
|
.addElement(presentingEl)
|
|
138
629
|
.keyframes([
|
|
139
630
|
{ offset: 0, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
|
|
140
|
-
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' }
|
|
631
|
+
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
|
|
141
632
|
]);
|
|
142
633
|
baseAnimation.addAnimation(presentingAnimation);
|
|
143
634
|
}
|
|
@@ -147,25 +638,25 @@ const iosEnterAnimation = (baseEl, presentingEl) => {
|
|
|
147
638
|
wrapperAnimation.fromTo('opacity', '0', '1');
|
|
148
639
|
}
|
|
149
640
|
else {
|
|
150
|
-
const toPresentingScale =
|
|
641
|
+
const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
|
|
151
642
|
const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
152
643
|
presentingAnimation
|
|
153
644
|
.afterStyles({
|
|
154
|
-
|
|
645
|
+
transform: finalTransform,
|
|
155
646
|
})
|
|
156
|
-
.addElement(
|
|
647
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
157
648
|
.keyframes([
|
|
158
649
|
{ offset: 0, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
|
|
159
|
-
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform }
|
|
650
|
+
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform },
|
|
160
651
|
]);
|
|
161
652
|
const shadowAnimation = animation.createAnimation()
|
|
162
653
|
.afterStyles({
|
|
163
|
-
|
|
654
|
+
transform: finalTransform,
|
|
164
655
|
})
|
|
165
|
-
.addElement(
|
|
656
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
166
657
|
.keyframes([
|
|
167
658
|
{ offset: 0, opacity: '1', transform: 'translateY(0) scale(1)' },
|
|
168
|
-
{ offset: 1, opacity: '0', transform: finalTransform }
|
|
659
|
+
{ offset: 1, opacity: '0', transform: finalTransform },
|
|
169
660
|
]);
|
|
170
661
|
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
171
662
|
}
|
|
@@ -177,50 +668,55 @@ const iosEnterAnimation = (baseEl, presentingEl) => {
|
|
|
177
668
|
return baseAnimation;
|
|
178
669
|
};
|
|
179
670
|
|
|
671
|
+
/*!
|
|
672
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
673
|
+
*/
|
|
674
|
+
const createLeaveAnimation$1 = () => {
|
|
675
|
+
const backdropAnimation = animation.createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
676
|
+
const wrapperAnimation = animation.createAnimation().fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
|
|
677
|
+
return { backdropAnimation, wrapperAnimation };
|
|
678
|
+
};
|
|
180
679
|
/**
|
|
181
680
|
* iOS Modal Leave Animation
|
|
182
681
|
*/
|
|
183
|
-
const iosLeaveAnimation = (baseEl,
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
.fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
|
|
191
|
-
const baseAnimation = animation.createAnimation()
|
|
682
|
+
const iosLeaveAnimation = (baseEl, opts, duration = 500) => {
|
|
683
|
+
const { presentingEl, currentBreakpoint } = opts;
|
|
684
|
+
const root = helpers.getElementRoot(baseEl);
|
|
685
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation$1();
|
|
686
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
687
|
+
wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
|
|
688
|
+
const baseAnimation = animation.createAnimation('leaving-base')
|
|
192
689
|
.addElement(baseEl)
|
|
193
690
|
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
194
691
|
.duration(duration)
|
|
195
692
|
.addAnimation(wrapperAnimation);
|
|
196
693
|
if (presentingEl) {
|
|
197
694
|
const isMobile = window.innerWidth < 768;
|
|
198
|
-
const hasCardModal =
|
|
695
|
+
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
696
|
+
const presentingElRoot = helpers.getElementRoot(presentingEl);
|
|
199
697
|
const presentingAnimation = animation.createAnimation()
|
|
200
698
|
.beforeClearStyles(['transform'])
|
|
201
699
|
.afterClearStyles(['transform'])
|
|
202
|
-
.onFinish(currentStep => {
|
|
700
|
+
.onFinish((currentStep) => {
|
|
203
701
|
// only reset background color if this is the last card-style modal
|
|
204
702
|
if (currentStep !== 1) {
|
|
205
703
|
return;
|
|
206
704
|
}
|
|
207
705
|
presentingEl.style.setProperty('overflow', '');
|
|
208
|
-
const numModals = Array.from(bodyEl.querySelectorAll('ion-modal')).filter(m => m.presentingElement !== undefined).length;
|
|
706
|
+
const numModals = Array.from(bodyEl.querySelectorAll('ion-modal')).filter((m) => m.presentingElement !== undefined).length;
|
|
209
707
|
if (numModals <= 1) {
|
|
210
708
|
bodyEl.style.setProperty('background-color', '');
|
|
211
709
|
}
|
|
212
710
|
});
|
|
213
711
|
const bodyEl = document.body;
|
|
214
712
|
if (isMobile) {
|
|
215
|
-
const transformOffset =
|
|
713
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
216
714
|
const modalTransform = hasCardModal ? '-10px' : transformOffset;
|
|
217
715
|
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
218
716
|
const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
|
|
219
|
-
presentingAnimation
|
|
220
|
-
.addElement(presentingEl)
|
|
221
|
-
.keyframes([
|
|
717
|
+
presentingAnimation.addElement(presentingEl).keyframes([
|
|
222
718
|
{ offset: 0, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
|
|
223
|
-
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' }
|
|
719
|
+
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
|
|
224
720
|
]);
|
|
225
721
|
baseAnimation.addAnimation(presentingAnimation);
|
|
226
722
|
}
|
|
@@ -230,25 +726,25 @@ const iosLeaveAnimation = (baseEl, presentingEl, duration = 500) => {
|
|
|
230
726
|
wrapperAnimation.fromTo('opacity', '1', '0');
|
|
231
727
|
}
|
|
232
728
|
else {
|
|
233
|
-
const toPresentingScale =
|
|
729
|
+
const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
|
|
234
730
|
const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
235
731
|
presentingAnimation
|
|
236
|
-
.addElement(
|
|
732
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
237
733
|
.afterStyles({
|
|
238
|
-
|
|
734
|
+
transform: 'translate3d(0, 0, 0)',
|
|
239
735
|
})
|
|
240
736
|
.keyframes([
|
|
241
737
|
{ offset: 0, filter: 'contrast(0.85)', transform: finalTransform },
|
|
242
|
-
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' }
|
|
738
|
+
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
|
|
243
739
|
]);
|
|
244
740
|
const shadowAnimation = animation.createAnimation()
|
|
245
|
-
.addElement(
|
|
741
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
246
742
|
.afterStyles({
|
|
247
|
-
|
|
743
|
+
transform: 'translateY(0) scale(1)',
|
|
248
744
|
})
|
|
249
745
|
.keyframes([
|
|
250
746
|
{ offset: 0, opacity: '0', transform: finalTransform },
|
|
251
|
-
{ offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' }
|
|
747
|
+
{ offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' },
|
|
252
748
|
]);
|
|
253
749
|
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
254
750
|
}
|
|
@@ -260,81 +756,424 @@ const iosLeaveAnimation = (baseEl, presentingEl, duration = 500) => {
|
|
|
260
756
|
return baseAnimation;
|
|
261
757
|
};
|
|
262
758
|
|
|
263
|
-
|
|
264
|
-
*
|
|
759
|
+
/*!
|
|
760
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
265
761
|
*/
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
const backdropAnimation = animation.createAnimation();
|
|
269
|
-
const wrapperAnimation = animation.createAnimation();
|
|
270
|
-
backdropAnimation
|
|
271
|
-
.addElement(baseEl.querySelector('ion-backdrop'))
|
|
762
|
+
const createEnterAnimation = () => {
|
|
763
|
+
const backdropAnimation = animation.createAnimation()
|
|
272
764
|
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
273
765
|
.beforeStyles({
|
|
274
|
-
'pointer-events': 'none'
|
|
766
|
+
'pointer-events': 'none',
|
|
275
767
|
})
|
|
276
768
|
.afterClearStyles(['pointer-events']);
|
|
277
|
-
wrapperAnimation
|
|
278
|
-
.addElement(baseEl.querySelector('.modal-wrapper'))
|
|
279
|
-
.keyframes([
|
|
769
|
+
const wrapperAnimation = animation.createAnimation().keyframes([
|
|
280
770
|
{ offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
|
|
281
|
-
{ offset: 1, opacity: 1, transform:
|
|
771
|
+
{ offset: 1, opacity: 1, transform: `translateY(0px)` },
|
|
282
772
|
]);
|
|
283
|
-
return
|
|
773
|
+
return { backdropAnimation, wrapperAnimation };
|
|
774
|
+
};
|
|
775
|
+
/**
|
|
776
|
+
* Md Modal Enter Animation
|
|
777
|
+
*/
|
|
778
|
+
const mdEnterAnimation = (baseEl, opts) => {
|
|
779
|
+
const { currentBreakpoint } = opts;
|
|
780
|
+
const root = helpers.getElementRoot(baseEl);
|
|
781
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation();
|
|
782
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
783
|
+
wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
|
|
784
|
+
return animation.createAnimation()
|
|
284
785
|
.addElement(baseEl)
|
|
285
786
|
.easing('cubic-bezier(0.36,0.66,0.04,1)')
|
|
286
787
|
.duration(280)
|
|
287
788
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
288
789
|
};
|
|
289
790
|
|
|
791
|
+
/*!
|
|
792
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
793
|
+
*/
|
|
794
|
+
const createLeaveAnimation = () => {
|
|
795
|
+
const backdropAnimation = animation.createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
796
|
+
const wrapperAnimation = animation.createAnimation().keyframes([
|
|
797
|
+
{ offset: 0, opacity: 0.99, transform: `translateY(0px)` },
|
|
798
|
+
{ offset: 1, opacity: 0, transform: 'translateY(40px)' },
|
|
799
|
+
]);
|
|
800
|
+
return { backdropAnimation, wrapperAnimation };
|
|
801
|
+
};
|
|
290
802
|
/**
|
|
291
803
|
* Md Modal Leave Animation
|
|
292
804
|
*/
|
|
293
|
-
const mdLeaveAnimation = (baseEl) => {
|
|
294
|
-
const
|
|
295
|
-
const
|
|
296
|
-
const wrapperAnimation =
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
.fromTo('opacity', 'var(--backdrop-opacity)', 0.0);
|
|
301
|
-
wrapperAnimation
|
|
302
|
-
.addElement(wrapperEl)
|
|
303
|
-
.keyframes([
|
|
304
|
-
{ offset: 0, opacity: 0.99, transform: 'translateY(0px)' },
|
|
305
|
-
{ offset: 1, opacity: 0, transform: 'translateY(40px)' }
|
|
306
|
-
]);
|
|
307
|
-
return baseAnimation
|
|
308
|
-
.addElement(baseEl)
|
|
805
|
+
const mdLeaveAnimation = (baseEl, opts) => {
|
|
806
|
+
const { currentBreakpoint } = opts;
|
|
807
|
+
const root = helpers.getElementRoot(baseEl);
|
|
808
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();
|
|
809
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
810
|
+
wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
|
|
811
|
+
return animation.createAnimation()
|
|
309
812
|
.easing('cubic-bezier(0.47,0,0.745,0.715)')
|
|
310
813
|
.duration(200)
|
|
311
814
|
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
312
815
|
};
|
|
313
816
|
|
|
314
|
-
|
|
817
|
+
/*!
|
|
818
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
819
|
+
*/
|
|
820
|
+
const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
|
|
821
|
+
// Defaults for the sheet swipe animation
|
|
822
|
+
const defaultBackdrop = [
|
|
823
|
+
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
824
|
+
{ offset: 1, opacity: 0.01 },
|
|
825
|
+
];
|
|
826
|
+
const customBackdrop = [
|
|
827
|
+
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
828
|
+
{ offset: 1 - backdropBreakpoint, opacity: 0 },
|
|
829
|
+
{ offset: 1, opacity: 0 },
|
|
830
|
+
];
|
|
831
|
+
const SheetDefaults = {
|
|
832
|
+
WRAPPER_KEYFRAMES: [
|
|
833
|
+
{ offset: 0, transform: 'translateY(0%)' },
|
|
834
|
+
{ offset: 1, transform: 'translateY(100%)' },
|
|
835
|
+
],
|
|
836
|
+
BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
|
|
837
|
+
};
|
|
838
|
+
const contentEl = baseEl.querySelector('ion-content');
|
|
839
|
+
const height = wrapperEl.clientHeight;
|
|
840
|
+
let currentBreakpoint = initialBreakpoint;
|
|
841
|
+
let offset = 0;
|
|
842
|
+
let canDismissBlocksGesture = false;
|
|
843
|
+
const canDismissMaxStep = 0.95;
|
|
844
|
+
const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
|
|
845
|
+
const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
|
|
846
|
+
const maxBreakpoint = breakpoints[breakpoints.length - 1];
|
|
847
|
+
const minBreakpoint = breakpoints[0];
|
|
848
|
+
const enableBackdrop = () => {
|
|
849
|
+
baseEl.style.setProperty('pointer-events', 'auto');
|
|
850
|
+
backdropEl.style.setProperty('pointer-events', 'auto');
|
|
851
|
+
/**
|
|
852
|
+
* When the backdrop is enabled, elements such
|
|
853
|
+
* as inputs should not be focusable outside
|
|
854
|
+
* the sheet.
|
|
855
|
+
*/
|
|
856
|
+
baseEl.classList.remove('ion-disable-focus-trap');
|
|
857
|
+
};
|
|
858
|
+
const disableBackdrop = () => {
|
|
859
|
+
baseEl.style.setProperty('pointer-events', 'none');
|
|
860
|
+
backdropEl.style.setProperty('pointer-events', 'none');
|
|
861
|
+
/**
|
|
862
|
+
* When the backdrop is enabled, elements such
|
|
863
|
+
* as inputs should not be focusable outside
|
|
864
|
+
* the sheet.
|
|
865
|
+
* Adding this class disables focus trapping
|
|
866
|
+
* for the sheet temporarily.
|
|
867
|
+
*/
|
|
868
|
+
baseEl.classList.add('ion-disable-focus-trap');
|
|
869
|
+
};
|
|
870
|
+
/**
|
|
871
|
+
* After the entering animation completes,
|
|
872
|
+
* we need to set the animation to go from
|
|
873
|
+
* offset 0 to offset 1 so that users can
|
|
874
|
+
* swipe in any direction. We then set the
|
|
875
|
+
* animation offset to the current breakpoint
|
|
876
|
+
* so there is no flickering.
|
|
877
|
+
*/
|
|
878
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
879
|
+
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
880
|
+
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
881
|
+
animation.progressStart(true, 1 - currentBreakpoint);
|
|
882
|
+
/**
|
|
883
|
+
* If backdrop is not enabled, then content
|
|
884
|
+
* behind modal should be clickable. To do this, we need
|
|
885
|
+
* to remove pointer-events from ion-modal as a whole.
|
|
886
|
+
* ion-backdrop and .modal-wrapper always have pointer-events: auto
|
|
887
|
+
* applied, so the modal content can still be interacted with.
|
|
888
|
+
*/
|
|
889
|
+
const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
|
|
890
|
+
if (shouldEnableBackdrop) {
|
|
891
|
+
enableBackdrop();
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
disableBackdrop();
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
if (contentEl && currentBreakpoint !== maxBreakpoint) {
|
|
898
|
+
contentEl.scrollY = false;
|
|
899
|
+
}
|
|
900
|
+
const canStart = (detail) => {
|
|
901
|
+
/**
|
|
902
|
+
* If the sheet is fully expanded and
|
|
903
|
+
* the user is swiping on the content,
|
|
904
|
+
* the gesture should not start to
|
|
905
|
+
* allow for scrolling on the content.
|
|
906
|
+
*/
|
|
907
|
+
const content = detail.event.target.closest('ion-content');
|
|
908
|
+
currentBreakpoint = getCurrentBreakpoint();
|
|
909
|
+
if (currentBreakpoint === 1 && content) {
|
|
910
|
+
return false;
|
|
911
|
+
}
|
|
912
|
+
return true;
|
|
913
|
+
};
|
|
914
|
+
const onStart = () => {
|
|
915
|
+
/**
|
|
916
|
+
* If canDismiss is anything other than `true`
|
|
917
|
+
* then users should be able to swipe down
|
|
918
|
+
* until a threshold is hit. At that point,
|
|
919
|
+
* the card modal should not proceed any further.
|
|
920
|
+
*
|
|
921
|
+
* canDismiss is never fired via gesture if there is
|
|
922
|
+
* no 0 breakpoint. However, it can be fired if the user
|
|
923
|
+
* presses Esc or the hardware back button.
|
|
924
|
+
* TODO (FW-937)
|
|
925
|
+
* Remove undefined check
|
|
926
|
+
*/
|
|
927
|
+
canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
|
|
928
|
+
/**
|
|
929
|
+
* If swiping on the content
|
|
930
|
+
* we should disable scrolling otherwise
|
|
931
|
+
* the sheet will expand and the content will scroll.
|
|
932
|
+
*/
|
|
933
|
+
if (contentEl) {
|
|
934
|
+
contentEl.scrollY = false;
|
|
935
|
+
}
|
|
936
|
+
helpers.raf(() => {
|
|
937
|
+
/**
|
|
938
|
+
* Dismisses the open keyboard when the sheet drag gesture is started.
|
|
939
|
+
* Sets the focus onto the modal element.
|
|
940
|
+
*/
|
|
941
|
+
baseEl.focus();
|
|
942
|
+
});
|
|
943
|
+
animation.progressStart(true, 1 - currentBreakpoint);
|
|
944
|
+
};
|
|
945
|
+
const onMove = (detail) => {
|
|
946
|
+
/**
|
|
947
|
+
* Given the change in gesture position on the Y axis,
|
|
948
|
+
* compute where the offset of the animation should be
|
|
949
|
+
* relative to where the user dragged.
|
|
950
|
+
*/
|
|
951
|
+
const initialStep = 1 - currentBreakpoint;
|
|
952
|
+
const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
|
|
953
|
+
const step = initialStep + detail.deltaY / height;
|
|
954
|
+
const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture;
|
|
955
|
+
/**
|
|
956
|
+
* If we are blocking the gesture from dismissing,
|
|
957
|
+
* set the max step value so that the sheet cannot be
|
|
958
|
+
* completely hidden.
|
|
959
|
+
*/
|
|
960
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
961
|
+
/**
|
|
962
|
+
* If we are blocking the gesture from
|
|
963
|
+
* dismissing, calculate the spring modifier value
|
|
964
|
+
* this will be added to the starting breakpoint
|
|
965
|
+
* value to give the gesture a spring-like feeling.
|
|
966
|
+
* Note that when isAttemptingDismissWithCanDismiss is true,
|
|
967
|
+
* the modifier is always added to the breakpoint that
|
|
968
|
+
* appears right after the 0 breakpoint.
|
|
969
|
+
*
|
|
970
|
+
* Note that this modifier is essentially the progression
|
|
971
|
+
* between secondToLastBreakpoint and maxStep which is
|
|
972
|
+
* why we subtract secondToLastBreakpoint. This lets us get
|
|
973
|
+
* the result as a value from 0 to 1.
|
|
974
|
+
*/
|
|
975
|
+
const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined
|
|
976
|
+
? secondToLastBreakpoint +
|
|
977
|
+
calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint))
|
|
978
|
+
: step;
|
|
979
|
+
offset = helpers.clamp(0.0001, processedStep, maxStep);
|
|
980
|
+
animation.progressStep(offset);
|
|
981
|
+
};
|
|
982
|
+
const onEnd = (detail) => {
|
|
983
|
+
/**
|
|
984
|
+
* When the gesture releases, we need to determine
|
|
985
|
+
* the closest breakpoint to snap to.
|
|
986
|
+
*/
|
|
987
|
+
const velocity = detail.velocityY;
|
|
988
|
+
const threshold = (detail.deltaY + velocity * 350) / height;
|
|
989
|
+
const diff = currentBreakpoint - threshold;
|
|
990
|
+
const closest = breakpoints.reduce((a, b) => {
|
|
991
|
+
return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
|
|
992
|
+
});
|
|
993
|
+
moveSheetToBreakpoint({
|
|
994
|
+
breakpoint: closest,
|
|
995
|
+
breakpointOffset: offset,
|
|
996
|
+
canDismiss: canDismissBlocksGesture,
|
|
997
|
+
});
|
|
998
|
+
};
|
|
999
|
+
const moveSheetToBreakpoint = (options) => {
|
|
1000
|
+
const { breakpoint, canDismiss, breakpointOffset } = options;
|
|
1001
|
+
/**
|
|
1002
|
+
* canDismiss should only prevent snapping
|
|
1003
|
+
* when users are trying to dismiss. If canDismiss
|
|
1004
|
+
* is present but the user is trying to swipe upwards,
|
|
1005
|
+
* we should allow that to happen,
|
|
1006
|
+
*/
|
|
1007
|
+
const shouldPreventDismiss = canDismiss && breakpoint === 0;
|
|
1008
|
+
const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
|
|
1009
|
+
const shouldRemainOpen = snapToBreakpoint !== 0;
|
|
1010
|
+
currentBreakpoint = 0;
|
|
1011
|
+
/**
|
|
1012
|
+
* Update the animation so that it plays from
|
|
1013
|
+
* the last offset to the closest snap point.
|
|
1014
|
+
*/
|
|
1015
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
1016
|
+
wrapperAnimation.keyframes([
|
|
1017
|
+
{ offset: 0, transform: `translateY(${breakpointOffset * 100}%)` },
|
|
1018
|
+
{ offset: 1, transform: `translateY(${(1 - snapToBreakpoint) * 100}%)` },
|
|
1019
|
+
]);
|
|
1020
|
+
backdropAnimation.keyframes([
|
|
1021
|
+
{
|
|
1022
|
+
offset: 0,
|
|
1023
|
+
opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
offset: 1,
|
|
1027
|
+
opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
|
|
1028
|
+
},
|
|
1029
|
+
]);
|
|
1030
|
+
animation.progressStep(0);
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Gesture should remain disabled until the
|
|
1034
|
+
* snapping animation completes.
|
|
1035
|
+
*/
|
|
1036
|
+
gesture.enable(false);
|
|
1037
|
+
if (shouldPreventDismiss) {
|
|
1038
|
+
handleCanDismiss(baseEl, animation);
|
|
1039
|
+
}
|
|
1040
|
+
else if (!shouldRemainOpen) {
|
|
1041
|
+
onDismiss();
|
|
1042
|
+
}
|
|
1043
|
+
return new Promise((resolve) => {
|
|
1044
|
+
animation
|
|
1045
|
+
.onFinish(() => {
|
|
1046
|
+
if (shouldRemainOpen) {
|
|
1047
|
+
/**
|
|
1048
|
+
* Once the snapping animation completes,
|
|
1049
|
+
* we need to reset the animation to go
|
|
1050
|
+
* from 0 to 1 so users can swipe in any direction.
|
|
1051
|
+
* We then set the animation offset to the current
|
|
1052
|
+
* breakpoint so that it starts at the snapped position.
|
|
1053
|
+
*/
|
|
1054
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
1055
|
+
helpers.raf(() => {
|
|
1056
|
+
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
1057
|
+
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
1058
|
+
animation.progressStart(true, 1 - snapToBreakpoint);
|
|
1059
|
+
currentBreakpoint = snapToBreakpoint;
|
|
1060
|
+
onBreakpointChange(currentBreakpoint);
|
|
1061
|
+
/**
|
|
1062
|
+
* If the sheet is fully expanded, we can safely
|
|
1063
|
+
* enable scrolling again.
|
|
1064
|
+
*/
|
|
1065
|
+
if (contentEl && currentBreakpoint === breakpoints[breakpoints.length - 1]) {
|
|
1066
|
+
contentEl.scrollY = true;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Backdrop should become enabled
|
|
1070
|
+
* after the backdropBreakpoint value
|
|
1071
|
+
*/
|
|
1072
|
+
const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
|
|
1073
|
+
if (shouldEnableBackdrop) {
|
|
1074
|
+
enableBackdrop();
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
disableBackdrop();
|
|
1078
|
+
}
|
|
1079
|
+
gesture.enable(true);
|
|
1080
|
+
resolve();
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
else {
|
|
1084
|
+
gesture.enable(true);
|
|
1085
|
+
resolve();
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
else {
|
|
1089
|
+
resolve();
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* This must be a one time callback
|
|
1093
|
+
* otherwise a new callback will
|
|
1094
|
+
* be added every time onEnd runs.
|
|
1095
|
+
*/
|
|
1096
|
+
}, { oneTimeCallback: true })
|
|
1097
|
+
.progressEnd(1, 0, 500);
|
|
1098
|
+
});
|
|
1099
|
+
};
|
|
1100
|
+
const gesture = index$1.createGesture({
|
|
1101
|
+
el: wrapperEl,
|
|
1102
|
+
gestureName: 'modalSheet',
|
|
1103
|
+
gesturePriority: 40,
|
|
1104
|
+
direction: 'y',
|
|
1105
|
+
threshold: 10,
|
|
1106
|
+
canStart,
|
|
1107
|
+
onStart,
|
|
1108
|
+
onMove,
|
|
1109
|
+
onEnd,
|
|
1110
|
+
});
|
|
1111
|
+
return {
|
|
1112
|
+
gesture,
|
|
1113
|
+
moveSheetToBreakpoint,
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
const modalIosCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:flex;position:absolute;align-items:center;justify-content:center;outline:none;contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);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);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;margin-left:auto;margin-right:auto;position:absolute;width:36px;height:5px;transform:translateZ(0);border:0;background:var(--ion-color-step-350, #c0c0be);cursor:pointer;z-index:11}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.modal-handle{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}.modal-handle::before{padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;transform:translate(-50%, -50%);content:\"\"}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.modal-handle::before{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: 1px){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: 1px){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius);border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.modal-card) .modal-wrapper,:host-context([dir=rtl]).modal-card .modal-wrapper{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius);border-bottom-right-radius:0;border-bottom-left-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{box-shadow:none}:host(.modal-card) .modal-shadow{box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius);border-bottom-right-radius:0;border-bottom-left-radius:0}:host-context([dir=rtl]):host(.modal-sheet) .modal-wrapper,:host-context([dir=rtl]).modal-sheet .modal-wrapper{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius);border-bottom-right-radius:0;border-bottom-left-radius:0}";
|
|
315
1118
|
|
|
316
|
-
const modalMdCss = "
|
|
1119
|
+
const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:flex;position:absolute;align-items:center;justify-content:center;outline:none;contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);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);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px;--ion-safe-area-top:0px;--ion-safe-area-bottom:0px;--ion-safe-area-right:0px;--ion-safe-area-left:0px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;margin-left:auto;margin-right:auto;position:absolute;width:36px;height:5px;transform:translateZ(0);border:0;background:var(--ion-color-step-350, #c0c0be);cursor:pointer;z-index:11}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.modal-handle{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}.modal-handle::before{padding-left:4px;padding-right:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;transform:translate(-50%, -50%);content:\"\"}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.modal-handle::before{padding-left:unset;padding-right:unset;-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px}}:host(.modal-sheet){--height:calc(100% - (var(--ion-safe-area-top) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{transform:translate3d(0, 40px, 0);opacity:0.01}";
|
|
317
1120
|
|
|
318
1121
|
const Modal = class {
|
|
319
1122
|
constructor(hostRef) {
|
|
320
|
-
index$
|
|
321
|
-
this.didPresent = index$
|
|
322
|
-
this.willPresent = index$
|
|
323
|
-
this.willDismiss = index$
|
|
324
|
-
this.didDismiss = index$
|
|
1123
|
+
index$3.registerInstance(this, hostRef);
|
|
1124
|
+
this.didPresent = index$3.createEvent(this, "ionModalDidPresent", 7);
|
|
1125
|
+
this.willPresent = index$3.createEvent(this, "ionModalWillPresent", 7);
|
|
1126
|
+
this.willDismiss = index$3.createEvent(this, "ionModalWillDismiss", 7);
|
|
1127
|
+
this.didDismiss = index$3.createEvent(this, "ionModalDidDismiss", 7);
|
|
1128
|
+
this.ionBreakpointDidChange = index$3.createEvent(this, "ionBreakpointDidChange", 7);
|
|
1129
|
+
this.didPresentShorthand = index$3.createEvent(this, "didPresent", 7);
|
|
1130
|
+
this.willPresentShorthand = index$3.createEvent(this, "willPresent", 7);
|
|
1131
|
+
this.willDismissShorthand = index$3.createEvent(this, "willDismiss", 7);
|
|
1132
|
+
this.didDismissShorthand = index$3.createEvent(this, "didDismiss", 7);
|
|
1133
|
+
this.modalIndex = modalIds++;
|
|
1134
|
+
this.coreDelegate = frameworkDelegate.CoreDelegate();
|
|
1135
|
+
this.isSheetModal = false;
|
|
1136
|
+
this.inheritedAttributes = {};
|
|
1137
|
+
this.inline = false;
|
|
325
1138
|
// Whether or not modal is being dismissed via gesture
|
|
326
1139
|
this.gestureAnimationDismissing = false;
|
|
327
1140
|
this.presented = false;
|
|
1141
|
+
/** @internal */
|
|
1142
|
+
this.hasController = false;
|
|
328
1143
|
/**
|
|
329
1144
|
* If `true`, the keyboard will be automatically dismissed when the overlay is presented.
|
|
330
1145
|
*/
|
|
331
1146
|
this.keyboardClose = true;
|
|
1147
|
+
/**
|
|
1148
|
+
* A decimal value between 0 and 1 that indicates the
|
|
1149
|
+
* point after which the backdrop will begin to fade in
|
|
1150
|
+
* when using a sheet modal. Prior to this point, the
|
|
1151
|
+
* backdrop will be hidden and the content underneath
|
|
1152
|
+
* the sheet can be interacted with. This value is exclusive
|
|
1153
|
+
* meaning the backdrop will become active after the value
|
|
1154
|
+
* specified.
|
|
1155
|
+
*/
|
|
1156
|
+
this.backdropBreakpoint = 0;
|
|
1157
|
+
/**
|
|
1158
|
+
* The interaction behavior for the sheet modal when the handle is pressed.
|
|
1159
|
+
*
|
|
1160
|
+
* Defaults to `"none"`, which means the modal will not change size or position when the handle is pressed.
|
|
1161
|
+
* Set to `"cycle"` to let the modal cycle between available breakpoints when pressed.
|
|
1162
|
+
*
|
|
1163
|
+
* Handle behavior is unavailable when the `handle` property is set to `false` or
|
|
1164
|
+
* when the `breakpoints` property is not set (using a fullscreen or card modal).
|
|
1165
|
+
*/
|
|
1166
|
+
this.handleBehavior = 'none';
|
|
332
1167
|
/**
|
|
333
1168
|
* If `true`, the modal will be dismissed when the backdrop is clicked.
|
|
334
1169
|
*/
|
|
335
1170
|
this.backdropDismiss = true;
|
|
336
1171
|
/**
|
|
337
1172
|
* If `true`, a backdrop will be displayed behind the modal.
|
|
1173
|
+
* This property controls whether or not the backdrop
|
|
1174
|
+
* darkens the screen when the modal is presented.
|
|
1175
|
+
* It does not control whether or not the backdrop
|
|
1176
|
+
* is active or present in the DOM.
|
|
338
1177
|
*/
|
|
339
1178
|
this.showBackdrop = true;
|
|
340
1179
|
/**
|
|
@@ -343,16 +1182,74 @@ const Modal = class {
|
|
|
343
1182
|
this.animated = true;
|
|
344
1183
|
/**
|
|
345
1184
|
* If `true`, the modal can be swiped to dismiss. Only applies in iOS mode.
|
|
1185
|
+
* @deprecated - To prevent modals from dismissing, use canDismiss instead.
|
|
346
1186
|
*/
|
|
347
1187
|
this.swipeToClose = false;
|
|
1188
|
+
/**
|
|
1189
|
+
* If `true`, the modal will open. If `false`, the modal will close.
|
|
1190
|
+
* Use this if you need finer grained control over presentation, otherwise
|
|
1191
|
+
* just use the modalController or the `trigger` property.
|
|
1192
|
+
* Note: `isOpen` will not automatically be set back to `false` when
|
|
1193
|
+
* the modal dismisses. You will need to do that in your code.
|
|
1194
|
+
*/
|
|
1195
|
+
this.isOpen = false;
|
|
1196
|
+
/**
|
|
1197
|
+
* If `true`, the component passed into `ion-modal` will
|
|
1198
|
+
* automatically be mounted when the modal is created. The
|
|
1199
|
+
* component will remain mounted even when the modal is dismissed.
|
|
1200
|
+
* However, the component will be destroyed when the modal is
|
|
1201
|
+
* destroyed. This property is not reactive and should only be
|
|
1202
|
+
* used when initially creating a modal.
|
|
1203
|
+
*
|
|
1204
|
+
* Note: This feature only applies to inline modals in JavaScript
|
|
1205
|
+
* frameworks such as Angular, React, and Vue.
|
|
1206
|
+
*/
|
|
1207
|
+
this.keepContentsMounted = false;
|
|
1208
|
+
this.configureTriggerInteraction = () => {
|
|
1209
|
+
const { trigger, el, destroyTriggerInteraction } = this;
|
|
1210
|
+
if (destroyTriggerInteraction) {
|
|
1211
|
+
destroyTriggerInteraction();
|
|
1212
|
+
}
|
|
1213
|
+
const triggerEl = trigger !== undefined ? document.getElementById(trigger) : null;
|
|
1214
|
+
if (!triggerEl) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const configureTriggerInteraction = (trigEl, modalEl) => {
|
|
1218
|
+
const openModal = () => {
|
|
1219
|
+
modalEl.present();
|
|
1220
|
+
};
|
|
1221
|
+
trigEl.addEventListener('click', openModal);
|
|
1222
|
+
return () => {
|
|
1223
|
+
trigEl.removeEventListener('click', openModal);
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
this.destroyTriggerInteraction = configureTriggerInteraction(triggerEl, el);
|
|
1227
|
+
};
|
|
1228
|
+
this.onHandleClick = () => {
|
|
1229
|
+
const { sheetTransition, handleBehavior } = this;
|
|
1230
|
+
if (handleBehavior !== 'cycle' || sheetTransition !== undefined) {
|
|
1231
|
+
/**
|
|
1232
|
+
* The sheet modal should not advance to the next breakpoint
|
|
1233
|
+
* if the handle behavior is not `cycle` or if the handle
|
|
1234
|
+
* is clicked while the sheet is moving to a breakpoint.
|
|
1235
|
+
*/
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
this.moveToNextBreakpoint();
|
|
1239
|
+
};
|
|
348
1240
|
this.onBackdropTap = () => {
|
|
1241
|
+
const { sheetTransition } = this;
|
|
1242
|
+
if (sheetTransition !== undefined) {
|
|
1243
|
+
/**
|
|
1244
|
+
* When the handle is double clicked at the largest breakpoint,
|
|
1245
|
+
* it will start to move to the first breakpoint. While transitioning,
|
|
1246
|
+
* the backdrop will often receive the second click. We prevent the
|
|
1247
|
+
* backdrop from dismissing the modal while moving between breakpoints.
|
|
1248
|
+
*/
|
|
1249
|
+
return;
|
|
1250
|
+
}
|
|
349
1251
|
this.dismiss(undefined, overlays.BACKDROP);
|
|
350
1252
|
};
|
|
351
|
-
this.onDismiss = (ev) => {
|
|
352
|
-
ev.stopPropagation();
|
|
353
|
-
ev.preventDefault();
|
|
354
|
-
this.dismiss();
|
|
355
|
-
};
|
|
356
1253
|
this.onLifecycle = (modalEvent) => {
|
|
357
1254
|
const el = this.usersElement;
|
|
358
1255
|
const name = LIFECYCLE_MAP[modalEvent.type];
|
|
@@ -360,22 +1257,124 @@ const Modal = class {
|
|
|
360
1257
|
const ev = new CustomEvent(name, {
|
|
361
1258
|
bubbles: false,
|
|
362
1259
|
cancelable: false,
|
|
363
|
-
detail: modalEvent.detail
|
|
1260
|
+
detail: modalEvent.detail,
|
|
364
1261
|
});
|
|
365
1262
|
el.dispatchEvent(ev);
|
|
366
1263
|
}
|
|
367
1264
|
};
|
|
368
1265
|
}
|
|
369
|
-
|
|
1266
|
+
onIsOpenChange(newValue, oldValue) {
|
|
1267
|
+
if (newValue === true && oldValue === false) {
|
|
1268
|
+
this.present();
|
|
1269
|
+
}
|
|
1270
|
+
else if (newValue === false && oldValue === true) {
|
|
1271
|
+
this.dismiss();
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
onTriggerChange() {
|
|
1275
|
+
this.configureTriggerInteraction();
|
|
1276
|
+
}
|
|
1277
|
+
async swipeToCloseChanged(enable) {
|
|
370
1278
|
if (this.gesture) {
|
|
371
1279
|
this.gesture.enable(enable);
|
|
372
1280
|
}
|
|
373
1281
|
else if (enable) {
|
|
374
|
-
this.initSwipeToClose();
|
|
1282
|
+
await this.initSwipeToClose();
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
breakpointsChanged(breakpoints) {
|
|
1286
|
+
if (breakpoints !== undefined) {
|
|
1287
|
+
this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
|
|
375
1288
|
}
|
|
376
1289
|
}
|
|
377
1290
|
connectedCallback() {
|
|
378
|
-
|
|
1291
|
+
const { configureTriggerInteraction, el } = this;
|
|
1292
|
+
overlays.prepareOverlay(el);
|
|
1293
|
+
configureTriggerInteraction();
|
|
1294
|
+
}
|
|
1295
|
+
disconnectedCallback() {
|
|
1296
|
+
const { destroyTriggerInteraction } = this;
|
|
1297
|
+
if (destroyTriggerInteraction) {
|
|
1298
|
+
destroyTriggerInteraction();
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
componentWillLoad() {
|
|
1302
|
+
const { breakpoints, initialBreakpoint, swipeToClose, el } = this;
|
|
1303
|
+
this.inheritedAttributes = helpers.inheritAttributes(el, ['aria-label', 'role']);
|
|
1304
|
+
/**
|
|
1305
|
+
* If user has custom ID set then we should
|
|
1306
|
+
* not assign the default incrementing ID.
|
|
1307
|
+
*/
|
|
1308
|
+
this.modalId = this.el.hasAttribute('id') ? this.el.getAttribute('id') : `ion-modal-${this.modalIndex}`;
|
|
1309
|
+
const isSheetModal = (this.isSheetModal = breakpoints !== undefined && initialBreakpoint !== undefined);
|
|
1310
|
+
if (isSheetModal) {
|
|
1311
|
+
this.currentBreakpoint = this.initialBreakpoint;
|
|
1312
|
+
}
|
|
1313
|
+
if (breakpoints !== undefined && initialBreakpoint !== undefined && !breakpoints.includes(initialBreakpoint)) {
|
|
1314
|
+
index$4.printIonWarning('Your breakpoints array must include the initialBreakpoint value.');
|
|
1315
|
+
}
|
|
1316
|
+
if (swipeToClose) {
|
|
1317
|
+
index$4.printIonWarning('swipeToClose has been deprecated in favor of canDismiss.\n\nIf you want a card modal to be swipeable, set canDismiss to `true`. In the next major release of Ionic, swipeToClose will be removed, and all card modals will be swipeable by default.');
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
componentDidLoad() {
|
|
1321
|
+
/**
|
|
1322
|
+
* If modal was rendered with isOpen="true"
|
|
1323
|
+
* then we should open modal immediately.
|
|
1324
|
+
*/
|
|
1325
|
+
if (this.isOpen === true) {
|
|
1326
|
+
helpers.raf(() => this.present());
|
|
1327
|
+
}
|
|
1328
|
+
this.breakpointsChanged(this.breakpoints);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Determines whether or not an overlay
|
|
1332
|
+
* is being used inline or via a controller/JS
|
|
1333
|
+
* and returns the correct delegate.
|
|
1334
|
+
* By default, subsequent calls to getDelegate
|
|
1335
|
+
* will use a cached version of the delegate.
|
|
1336
|
+
* This is useful for calling dismiss after
|
|
1337
|
+
* present so that the correct delegate is given.
|
|
1338
|
+
*/
|
|
1339
|
+
getDelegate(force = false) {
|
|
1340
|
+
if (this.workingDelegate && !force) {
|
|
1341
|
+
return {
|
|
1342
|
+
delegate: this.workingDelegate,
|
|
1343
|
+
inline: this.inline,
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* If using overlay inline
|
|
1348
|
+
* we potentially need to use the coreDelegate
|
|
1349
|
+
* so that this works in vanilla JS apps.
|
|
1350
|
+
* If a developer has presented this component
|
|
1351
|
+
* via a controller, then we can assume
|
|
1352
|
+
* the component is already in the
|
|
1353
|
+
* correct place.
|
|
1354
|
+
*/
|
|
1355
|
+
const parentEl = this.el.parentNode;
|
|
1356
|
+
const inline = (this.inline = parentEl !== null && !this.hasController);
|
|
1357
|
+
const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
|
|
1358
|
+
return { inline, delegate };
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Determines whether or not the
|
|
1362
|
+
* modal is allowed to dismiss based
|
|
1363
|
+
* on the state of the canDismiss prop.
|
|
1364
|
+
*/
|
|
1365
|
+
async checkCanDismiss(data, role) {
|
|
1366
|
+
const { canDismiss } = this;
|
|
1367
|
+
/**
|
|
1368
|
+
* TODO (FW-937) - Remove the following check in
|
|
1369
|
+
* the next major release of Ionic.
|
|
1370
|
+
*/
|
|
1371
|
+
if (canDismiss === undefined) {
|
|
1372
|
+
return true;
|
|
1373
|
+
}
|
|
1374
|
+
if (typeof canDismiss === 'function') {
|
|
1375
|
+
return canDismiss(data, role);
|
|
1376
|
+
}
|
|
1377
|
+
return canDismiss;
|
|
379
1378
|
}
|
|
380
1379
|
/**
|
|
381
1380
|
* Present the modal overlay after it has been created.
|
|
@@ -384,29 +1383,102 @@ const Modal = class {
|
|
|
384
1383
|
if (this.presented) {
|
|
385
1384
|
return;
|
|
386
1385
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
1386
|
+
/**
|
|
1387
|
+
* When using an inline modal
|
|
1388
|
+
* and dismissing a modal it is possible to
|
|
1389
|
+
* quickly present the modal while it is
|
|
1390
|
+
* dismissing. We need to await any current
|
|
1391
|
+
* transition to allow the dismiss to finish
|
|
1392
|
+
* before presenting again.
|
|
1393
|
+
*/
|
|
1394
|
+
if (this.currentTransition !== undefined) {
|
|
1395
|
+
await this.currentTransition;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* If the modal is presented multiple times (inline modals), we
|
|
1399
|
+
* need to reset the current breakpoint to the initial breakpoint.
|
|
1400
|
+
*/
|
|
1401
|
+
this.currentBreakpoint = this.initialBreakpoint;
|
|
1402
|
+
const data = Object.assign(Object.assign({}, this.componentProps), { modal: this.el });
|
|
1403
|
+
const { inline, delegate } = this.getDelegate(true);
|
|
1404
|
+
this.usersElement = await frameworkDelegate.attachComponent(delegate, this.el, this.component, ['ion-page'], data, inline);
|
|
1405
|
+
await index$5.deepReady(this.usersElement);
|
|
1406
|
+
index$3.writeTask(() => this.el.classList.add('show-modal'));
|
|
1407
|
+
this.currentTransition = overlays.present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
1408
|
+
presentingEl: this.presentingElement,
|
|
1409
|
+
currentBreakpoint: this.initialBreakpoint,
|
|
1410
|
+
backdropBreakpoint: this.backdropBreakpoint,
|
|
1411
|
+
});
|
|
1412
|
+
/**
|
|
1413
|
+
* TODO (FW-937) - In the next major release of Ionic, all card modals
|
|
1414
|
+
* will be swipeable by default. canDismiss will be used to determine if the
|
|
1415
|
+
* modal can be dismissed. This check should change to check the presence of
|
|
1416
|
+
* presentingElement instead.
|
|
1417
|
+
*
|
|
1418
|
+
* If we did not do this check, then not using swipeToClose would mean you could
|
|
1419
|
+
* not run canDismiss on swipe as there would be no swipe gesture created.
|
|
1420
|
+
*/
|
|
1421
|
+
const hasCardModal = this.presentingElement !== undefined && (this.swipeToClose || this.canDismiss !== undefined);
|
|
1422
|
+
/**
|
|
1423
|
+
* We need to change the status bar at the
|
|
1424
|
+
* start of the animation so that it completes
|
|
1425
|
+
* by the time the card animation is done.
|
|
1426
|
+
*/
|
|
1427
|
+
if (hasCardModal && ionicGlobal.getIonMode(this) === 'ios') {
|
|
1428
|
+
// Cache the original status bar color before the modal is presented
|
|
1429
|
+
this.statusBarStyle = await StatusBar.getStyle();
|
|
1430
|
+
setCardStatusBarDark();
|
|
1431
|
+
}
|
|
1432
|
+
await this.currentTransition;
|
|
1433
|
+
if (this.isSheetModal) {
|
|
1434
|
+
this.initSheetGesture();
|
|
390
1435
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
await index$2.deepReady(this.usersElement);
|
|
394
|
-
index$1.writeTask(() => this.el.classList.add('show-modal'));
|
|
395
|
-
await overlays.present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, this.presentingElement);
|
|
396
|
-
if (this.swipeToClose) {
|
|
397
|
-
this.initSwipeToClose();
|
|
1436
|
+
else if (hasCardModal) {
|
|
1437
|
+
await this.initSwipeToClose();
|
|
398
1438
|
}
|
|
1439
|
+
/* tslint:disable-next-line */
|
|
1440
|
+
if (typeof window !== 'undefined') {
|
|
1441
|
+
this.keyboardOpenCallback = () => {
|
|
1442
|
+
if (this.gesture) {
|
|
1443
|
+
/**
|
|
1444
|
+
* When the native keyboard is opened and the webview
|
|
1445
|
+
* is resized, the gesture implementation will become unresponsive
|
|
1446
|
+
* and enter a free-scroll mode.
|
|
1447
|
+
*
|
|
1448
|
+
* When the keyboard is opened, we disable the gesture for
|
|
1449
|
+
* a single frame and re-enable once the contents have repositioned
|
|
1450
|
+
* from the keyboard placement.
|
|
1451
|
+
*/
|
|
1452
|
+
this.gesture.enable(false);
|
|
1453
|
+
helpers.raf(() => {
|
|
1454
|
+
if (this.gesture) {
|
|
1455
|
+
this.gesture.enable(true);
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
window.addEventListener(keyboard.KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
|
|
1461
|
+
}
|
|
1462
|
+
this.currentTransition = undefined;
|
|
399
1463
|
}
|
|
400
1464
|
initSwipeToClose() {
|
|
1465
|
+
var _a;
|
|
401
1466
|
if (ionicGlobal.getIonMode(this) !== 'ios') {
|
|
402
1467
|
return;
|
|
403
1468
|
}
|
|
1469
|
+
const { el } = this;
|
|
404
1470
|
// All of the elements needed for the swipe gesture
|
|
405
1471
|
// should be in the DOM and referenced by now, except
|
|
406
1472
|
// for the presenting el
|
|
407
1473
|
const animationBuilder = this.leaveAnimation || ionicGlobal.config.get('modalLeave', iosLeaveAnimation);
|
|
408
|
-
const ani = this.animation = animationBuilder(
|
|
409
|
-
|
|
1474
|
+
const ani = (this.animation = animationBuilder(el, { presentingEl: this.presentingElement }));
|
|
1475
|
+
const contentEl = index$2.findIonContent(el);
|
|
1476
|
+
if (!contentEl) {
|
|
1477
|
+
index$2.printIonContentErrorMsg(el);
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
const statusBarStyle = (_a = this.statusBarStyle) !== null && _a !== void 0 ? _a : Style.Default;
|
|
1481
|
+
this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
|
|
410
1482
|
/**
|
|
411
1483
|
* While the gesture animation is finishing
|
|
412
1484
|
* it is possible for a user to tap the backdrop.
|
|
@@ -419,12 +1491,53 @@ const Modal = class {
|
|
|
419
1491
|
*/
|
|
420
1492
|
this.gestureAnimationDismissing = true;
|
|
421
1493
|
this.animation.onFinish(async () => {
|
|
422
|
-
await this.dismiss(undefined,
|
|
1494
|
+
await this.dismiss(undefined, overlays.GESTURE);
|
|
423
1495
|
this.gestureAnimationDismissing = false;
|
|
424
1496
|
});
|
|
425
1497
|
});
|
|
426
1498
|
this.gesture.enable(true);
|
|
427
1499
|
}
|
|
1500
|
+
initSheetGesture() {
|
|
1501
|
+
const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
|
|
1502
|
+
if (!wrapperEl || initialBreakpoint === undefined) {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const animationBuilder = this.enterAnimation || ionicGlobal.config.get('modalEnter', iosEnterAnimation);
|
|
1506
|
+
const ani = (this.animation = animationBuilder(this.el, {
|
|
1507
|
+
presentingEl: this.presentingElement,
|
|
1508
|
+
currentBreakpoint: initialBreakpoint,
|
|
1509
|
+
backdropBreakpoint,
|
|
1510
|
+
}));
|
|
1511
|
+
ani.progressStart(true, 1);
|
|
1512
|
+
const { gesture, moveSheetToBreakpoint } = createSheetGesture(this.el, this.backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, ani, this.sortedBreakpoints, () => { var _a; return (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : 0; }, () => this.sheetOnDismiss(), (breakpoint) => {
|
|
1513
|
+
if (this.currentBreakpoint !== breakpoint) {
|
|
1514
|
+
this.currentBreakpoint = breakpoint;
|
|
1515
|
+
this.ionBreakpointDidChange.emit({ breakpoint });
|
|
1516
|
+
}
|
|
1517
|
+
});
|
|
1518
|
+
this.gesture = gesture;
|
|
1519
|
+
this.moveSheetToBreakpoint = moveSheetToBreakpoint;
|
|
1520
|
+
this.gesture.enable(true);
|
|
1521
|
+
}
|
|
1522
|
+
sheetOnDismiss() {
|
|
1523
|
+
/**
|
|
1524
|
+
* While the gesture animation is finishing
|
|
1525
|
+
* it is possible for a user to tap the backdrop.
|
|
1526
|
+
* This would result in the dismiss animation
|
|
1527
|
+
* being played again. Typically this is avoided
|
|
1528
|
+
* by setting `presented = false` on the overlay
|
|
1529
|
+
* component; however, we cannot do that here as
|
|
1530
|
+
* that would prevent the element from being
|
|
1531
|
+
* removed from the DOM.
|
|
1532
|
+
*/
|
|
1533
|
+
this.gestureAnimationDismissing = true;
|
|
1534
|
+
this.animation.onFinish(async () => {
|
|
1535
|
+
this.currentBreakpoint = 0;
|
|
1536
|
+
this.ionBreakpointDidChange.emit({ breakpoint: this.currentBreakpoint });
|
|
1537
|
+
await this.dismiss(undefined, overlays.GESTURE);
|
|
1538
|
+
this.gestureAnimationDismissing = false;
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
428
1541
|
/**
|
|
429
1542
|
* Dismiss the modal overlay after it has been presented.
|
|
430
1543
|
*
|
|
@@ -432,18 +1545,64 @@ const Modal = class {
|
|
|
432
1545
|
* @param role The role of the element that is dismissing the modal. For example, 'cancel' or 'backdrop'.
|
|
433
1546
|
*/
|
|
434
1547
|
async dismiss(data, role) {
|
|
435
|
-
|
|
1548
|
+
var _a;
|
|
1549
|
+
if (this.gestureAnimationDismissing && role !== overlays.GESTURE) {
|
|
1550
|
+
return false;
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* If a canDismiss handler is responsible
|
|
1554
|
+
* for calling the dismiss method, we should
|
|
1555
|
+
* not run the canDismiss check again.
|
|
1556
|
+
*/
|
|
1557
|
+
if (role !== 'handler' && !(await this.checkCanDismiss(data, role))) {
|
|
436
1558
|
return false;
|
|
437
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* We need to start the status bar change
|
|
1562
|
+
* before the animation so that the change
|
|
1563
|
+
* finishes when the dismiss animation does.
|
|
1564
|
+
* TODO (FW-937)
|
|
1565
|
+
*/
|
|
1566
|
+
const hasCardModal = this.presentingElement !== undefined && (this.swipeToClose || this.canDismiss !== undefined);
|
|
1567
|
+
if (hasCardModal && ionicGlobal.getIonMode(this) === 'ios') {
|
|
1568
|
+
setCardStatusBarDefault(this.statusBarStyle);
|
|
1569
|
+
}
|
|
1570
|
+
/* tslint:disable-next-line */
|
|
1571
|
+
if (typeof window !== 'undefined' && this.keyboardOpenCallback) {
|
|
1572
|
+
window.removeEventListener(keyboard.KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* When using an inline modal
|
|
1576
|
+
* and presenting a modal it is possible to
|
|
1577
|
+
* quickly dismiss the modal while it is
|
|
1578
|
+
* presenting. We need to await any current
|
|
1579
|
+
* transition to allow the present to finish
|
|
1580
|
+
* before dismissing again.
|
|
1581
|
+
*/
|
|
1582
|
+
if (this.currentTransition !== undefined) {
|
|
1583
|
+
await this.currentTransition;
|
|
1584
|
+
}
|
|
438
1585
|
const enteringAnimation = overlays.activeAnimations.get(this) || [];
|
|
439
|
-
|
|
1586
|
+
this.currentTransition = overlays.dismiss(this, data, role, 'modalLeave', iosLeaveAnimation, mdLeaveAnimation, {
|
|
1587
|
+
presentingEl: this.presentingElement,
|
|
1588
|
+
currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
|
|
1589
|
+
backdropBreakpoint: this.backdropBreakpoint,
|
|
1590
|
+
});
|
|
1591
|
+
const dismissed = await this.currentTransition;
|
|
440
1592
|
if (dismissed) {
|
|
441
|
-
|
|
1593
|
+
const { delegate } = this.getDelegate();
|
|
1594
|
+
await frameworkDelegate.detachComponent(delegate, this.usersElement);
|
|
1595
|
+
index$3.writeTask(() => this.el.classList.remove('show-modal'));
|
|
442
1596
|
if (this.animation) {
|
|
443
1597
|
this.animation.destroy();
|
|
444
1598
|
}
|
|
445
|
-
|
|
1599
|
+
if (this.gesture) {
|
|
1600
|
+
this.gesture.destroy();
|
|
1601
|
+
}
|
|
1602
|
+
enteringAnimation.forEach((ani) => ani.destroy());
|
|
446
1603
|
}
|
|
1604
|
+
this.currentBreakpoint = undefined;
|
|
1605
|
+
this.currentTransition = undefined;
|
|
447
1606
|
this.animation = undefined;
|
|
448
1607
|
return dismissed;
|
|
449
1608
|
}
|
|
@@ -459,24 +1618,95 @@ const Modal = class {
|
|
|
459
1618
|
onWillDismiss() {
|
|
460
1619
|
return overlays.eventMethod(this.el, 'ionModalWillDismiss');
|
|
461
1620
|
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Move a sheet style modal to a specific breakpoint. The breakpoint value must
|
|
1623
|
+
* be a value defined in your `breakpoints` array.
|
|
1624
|
+
*/
|
|
1625
|
+
async setCurrentBreakpoint(breakpoint) {
|
|
1626
|
+
if (!this.isSheetModal) {
|
|
1627
|
+
index$4.printIonWarning('setCurrentBreakpoint is only supported on sheet modals.');
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
if (!this.breakpoints.includes(breakpoint)) {
|
|
1631
|
+
index$4.printIonWarning(`Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.`);
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1634
|
+
const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints } = this;
|
|
1635
|
+
if (currentBreakpoint === breakpoint) {
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
if (moveSheetToBreakpoint) {
|
|
1639
|
+
this.sheetTransition = moveSheetToBreakpoint({
|
|
1640
|
+
breakpoint,
|
|
1641
|
+
breakpointOffset: 1 - currentBreakpoint,
|
|
1642
|
+
canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints[0] === 0,
|
|
1643
|
+
});
|
|
1644
|
+
await this.sheetTransition;
|
|
1645
|
+
this.sheetTransition = undefined;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Returns the current breakpoint of a sheet style modal
|
|
1650
|
+
*/
|
|
1651
|
+
async getCurrentBreakpoint() {
|
|
1652
|
+
return this.currentBreakpoint;
|
|
1653
|
+
}
|
|
1654
|
+
async moveToNextBreakpoint() {
|
|
1655
|
+
const { breakpoints, currentBreakpoint } = this;
|
|
1656
|
+
if (!breakpoints || currentBreakpoint == null) {
|
|
1657
|
+
/**
|
|
1658
|
+
* If the modal does not have breakpoints and/or the current
|
|
1659
|
+
* breakpoint is not set, we can't move to the next breakpoint.
|
|
1660
|
+
*/
|
|
1661
|
+
return false;
|
|
1662
|
+
}
|
|
1663
|
+
const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
|
|
1664
|
+
const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
|
|
1665
|
+
const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
|
|
1666
|
+
const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
|
|
1667
|
+
/**
|
|
1668
|
+
* Sets the current breakpoint to the next available breakpoint.
|
|
1669
|
+
* If the current breakpoint is the last breakpoint, we set the current
|
|
1670
|
+
* breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
|
|
1671
|
+
*/
|
|
1672
|
+
await this.setCurrentBreakpoint(nextBreakpoint);
|
|
1673
|
+
return true;
|
|
1674
|
+
}
|
|
462
1675
|
render() {
|
|
463
|
-
const { htmlAttributes } = this;
|
|
1676
|
+
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes } = this;
|
|
1677
|
+
const showHandle = handle !== false && isSheetModal;
|
|
464
1678
|
const mode = ionicGlobal.getIonMode(this);
|
|
465
|
-
|
|
1679
|
+
const { modalId } = this;
|
|
1680
|
+
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
|
1681
|
+
const isHandleCycle = handleBehavior === 'cycle';
|
|
1682
|
+
return (index$3.h(index$3.Host, Object.assign({ "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
|
|
466
1683
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
467
|
-
}, class: Object.assign({ [mode]: true, [`modal-card`]:
|
|
1684
|
+
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, 'overlay-hidden': true }, theme.getClassMap(this.cssClass)), id: modalId, onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle }), index$3.h("ion-backdrop", { ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && index$3.h("div", { class: "modal-shadow" }), index$3.h("div", Object.assign({
|
|
1685
|
+
/*
|
|
1686
|
+
role and aria-modal must be used on the
|
|
1687
|
+
same element. They must also be set inside the
|
|
1688
|
+
shadow DOM otherwise ion-button will not be highlighted
|
|
1689
|
+
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
1690
|
+
*/
|
|
1691
|
+
role: "dialog"
|
|
1692
|
+
}, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (index$3.h("button", { class: "modal-handle",
|
|
1693
|
+
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
1694
|
+
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle" })), index$3.h("slot", null))));
|
|
468
1695
|
}
|
|
469
|
-
get el() { return index$
|
|
1696
|
+
get el() { return index$3.getElement(this); }
|
|
470
1697
|
static get watchers() { return {
|
|
1698
|
+
"isOpen": ["onIsOpenChange"],
|
|
1699
|
+
"trigger": ["onTriggerChange"],
|
|
471
1700
|
"swipeToClose": ["swipeToCloseChanged"]
|
|
472
1701
|
}; }
|
|
473
1702
|
};
|
|
474
1703
|
const LIFECYCLE_MAP = {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
1704
|
+
ionModalDidPresent: 'ionViewDidEnter',
|
|
1705
|
+
ionModalWillPresent: 'ionViewWillEnter',
|
|
1706
|
+
ionModalWillDismiss: 'ionViewWillLeave',
|
|
1707
|
+
ionModalDidDismiss: 'ionViewDidLeave',
|
|
479
1708
|
};
|
|
1709
|
+
let modalIds = 0;
|
|
480
1710
|
Modal.style = {
|
|
481
1711
|
ios: modalIosCss,
|
|
482
1712
|
md: modalMdCss
|