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