voyager-ionic-core 8.3.4 → 8.4.1
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/components/alert.js +7 -5
- package/components/backdrop.js +1 -1
- package/components/button.js +2 -2
- package/components/buttons.js +2 -2
- package/components/checkbox.js +7 -5
- package/components/content.js +446 -0
- package/components/header.js +375 -0
- package/components/index4.js +2 -2
- package/components/ion-app.js +1 -1
- package/components/ion-avatar.js +1 -1
- package/components/ion-back-button.js +2 -2
- package/components/ion-badge.js +2 -2
- package/components/ion-breadcrumb.js +4 -4
- package/components/ion-breadcrumbs.js +2 -2
- package/components/ion-card-content.js +1 -1
- package/components/ion-card-header.js +2 -2
- package/components/ion-card-subtitle.js +2 -2
- package/components/ion-card-title.js +2 -2
- package/components/ion-card.js +1 -1
- package/components/ion-chip.js +2 -2
- package/components/ion-col.js +2 -2
- package/components/ion-content.js +1 -441
- package/components/ion-datetime-button.js +2 -2
- package/components/ion-datetime.js +2 -2
- package/components/ion-fab-button.js +2 -2
- package/components/ion-fab-list.js +2 -2
- package/components/ion-fab.js +2 -2
- package/components/ion-footer.js +2 -2
- package/components/ion-grid.js +2 -2
- package/components/ion-header.js +1 -351
- package/components/ion-img.js +1 -1
- package/components/ion-infinite-scroll-content.js +2 -2
- package/components/ion-infinite-scroll.js +1 -1
- package/components/ion-input-password-toggle.js +3 -3
- package/components/ion-input.js +3 -3
- package/components/ion-item-divider.js +2 -2
- package/components/ion-item-group.js +1 -1
- package/components/ion-item-option.js +2 -2
- package/components/ion-item-options.js +1 -1
- package/components/ion-item-sliding.js +3 -1
- package/components/ion-loading.js +2 -2
- package/components/ion-menu-button.js +2 -2
- package/components/ion-menu-toggle.js +2 -2
- package/components/ion-menu.js +47 -20
- package/components/ion-modal.js +1 -1737
- package/components/ion-nav-link.js +1 -1
- package/components/ion-nav.js +1 -1
- package/components/ion-note.js +2 -2
- package/components/ion-picker-legacy.js +2 -2
- package/components/ion-progress-bar.js +1 -1
- package/components/ion-range.js +3 -3
- package/components/ion-refresher-content.js +1 -1
- package/components/ion-refresher.js +1 -1
- package/components/ion-reorder-group.js +1 -1
- package/components/ion-reorder.js +1 -1
- package/components/ion-router-link.js +2 -2
- package/components/ion-router-outlet.js +1 -1
- package/components/ion-row.js +1 -1
- package/components/ion-searchbar.js +4 -4
- package/components/ion-segment-button.js +24 -5
- package/components/ion-segment-content.d.ts +11 -0
- package/components/ion-segment-content.js +37 -0
- package/components/ion-segment-view.d.ts +11 -0
- package/components/ion-segment-view.js +140 -0
- package/components/ion-segment.js +110 -15
- package/components/ion-select-modal.d.ts +11 -0
- package/components/ion-select-modal.js +9 -0
- package/components/ion-select-option.js +1 -1
- package/components/ion-select.js +114 -41
- package/components/ion-skeleton-text.js +2 -2
- package/components/ion-split-pane.js +2 -2
- package/components/ion-tab-bar.js +2 -2
- package/components/ion-tab-button.js +2 -2
- package/components/ion-tab.js +2 -2
- package/components/ion-tabs.js +1 -1
- package/components/ion-text.js +2 -2
- package/components/ion-textarea.js +2 -2
- package/components/ion-thumbnail.js +1 -1
- package/components/ion-title.js +1 -70
- package/components/ion-toast.js +4 -4
- package/components/ion-toggle.js +3 -3
- package/components/ion-toolbar.js +1 -88
- package/components/label.js +2 -2
- package/components/list-header.js +2 -2
- package/components/list.js +1 -1
- package/components/modal.js +1742 -0
- package/components/overlays.js +27 -12
- package/components/picker-column-option.js +2 -2
- package/components/picker-column.js +3 -3
- package/components/picker-column2.js +2 -2
- package/components/picker.js +2 -2
- package/components/popover.js +2 -2
- package/components/radio-group.js +12 -4
- package/components/radio.js +7 -5
- package/components/ripple-effect.js +1 -1
- package/components/select-modal.js +197 -0
- package/components/select-popover.js +1 -1
- package/components/spinner.js +1 -1
- package/components/title.js +75 -0
- package/components/toolbar.js +93 -0
- package/dist/cjs/{index-9cd00dc3.js → index-8e789962.js} +2 -2
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/ion-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/ion-alert.cjs.entry.js +8 -6
- package/dist/cjs/ion-app_8.cjs.entry.js +36 -17
- package/dist/cjs/ion-avatar_3.cjs.entry.js +4 -4
- package/dist/cjs/ion-back-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +6 -6
- package/dist/cjs/ion-button_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-card_5.cjs.entry.js +8 -8
- package/dist/cjs/ion-checkbox.cjs.entry.js +5 -4
- package/dist/cjs/ion-chip.cjs.entry.js +2 -2
- package/dist/cjs/ion-col_3.cjs.entry.js +5 -5
- package/dist/cjs/ion-datetime-button.cjs.entry.js +2 -2
- package/dist/cjs/ion-datetime_3.cjs.entry.js +7 -7
- package/dist/cjs/ion-fab_3.cjs.entry.js +6 -6
- package/dist/cjs/ion-img.cjs.entry.js +1 -1
- package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-input-password-toggle.cjs.entry.js +3 -3
- package/dist/cjs/ion-input.cjs.entry.js +3 -3
- package/dist/cjs/ion-item-option_3.cjs.entry.js +6 -4
- package/dist/cjs/ion-item_8.cjs.entry.js +12 -12
- package/dist/cjs/ion-loading.cjs.entry.js +3 -3
- package/dist/cjs/ion-menu_3.cjs.entry.js +52 -25
- package/dist/cjs/ion-modal.cjs.entry.js +5 -5
- package/dist/cjs/ion-nav_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-picker-column-option.cjs.entry.js +2 -2
- package/dist/cjs/ion-picker-column.cjs.entry.js +3 -3
- package/dist/cjs/ion-picker.cjs.entry.js +2 -2
- package/dist/cjs/ion-popover.cjs.entry.js +3 -3
- package/dist/cjs/ion-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/ion-radio_2.cjs.entry.js +17 -8
- package/dist/cjs/ion-range.cjs.entry.js +3 -3
- package/dist/cjs/ion-refresher_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-reorder_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-ripple-effect.cjs.entry.js +1 -1
- package/dist/cjs/ion-route_4.cjs.entry.js +2 -2
- package/dist/cjs/ion-searchbar.cjs.entry.js +4 -4
- package/dist/cjs/ion-segment-content.cjs.entry.js +23 -0
- package/dist/cjs/ion-segment-view.cjs.entry.js +122 -0
- package/dist/cjs/ion-segment_2.cjs.entry.js +132 -19
- package/dist/cjs/ion-select-modal.cjs.entry.js +111 -0
- package/dist/cjs/ion-select_3.cjs.entry.js +40 -15
- package/dist/cjs/ion-spinner.cjs.entry.js +1 -1
- package/dist/cjs/ion-split-pane.cjs.entry.js +2 -2
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +4 -4
- package/dist/cjs/ion-tab_2.cjs.entry.js +3 -3
- package/dist/cjs/ion-text.cjs.entry.js +2 -2
- package/dist/cjs/ion-textarea.cjs.entry.js +2 -2
- package/dist/cjs/ion-toast.cjs.entry.js +5 -5
- package/dist/cjs/ion-toggle.cjs.entry.js +3 -3
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{overlays-ba0f6986.js → overlays-aa669eb8.js} +26 -11
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/alert/alert.js +7 -5
- package/dist/collection/components/app/app.js +1 -1
- package/dist/collection/components/avatar/avatar.js +1 -1
- package/dist/collection/components/back-button/back-button.js +2 -2
- package/dist/collection/components/backdrop/backdrop.js +1 -1
- package/dist/collection/components/badge/badge.js +2 -2
- package/dist/collection/components/breadcrumb/breadcrumb.js +4 -4
- package/dist/collection/components/breadcrumbs/breadcrumbs.js +2 -2
- package/dist/collection/components/button/button.js +2 -2
- package/dist/collection/components/buttons/buttons.js +2 -2
- package/dist/collection/components/card/card.js +1 -1
- package/dist/collection/components/card-content/card-content.js +1 -1
- package/dist/collection/components/card-header/card-header.js +2 -2
- package/dist/collection/components/card-subtitle/card-subtitle.js +2 -2
- package/dist/collection/components/card-title/card-title.js +2 -2
- package/dist/collection/components/checkbox/checkbox.js +29 -4
- package/dist/collection/components/chip/chip.js +2 -2
- package/dist/collection/components/col/col.js +2 -2
- package/dist/collection/components/content/content.js +3 -3
- package/dist/collection/components/datetime/datetime.js +2 -2
- package/dist/collection/components/datetime-button/datetime-button.js +2 -2
- package/dist/collection/components/fab/fab.js +2 -2
- package/dist/collection/components/fab-button/fab-button.js +2 -2
- package/dist/collection/components/fab-list/fab-list.js +2 -2
- package/dist/collection/components/footer/footer.js +2 -2
- package/dist/collection/components/grid/grid.js +2 -2
- package/dist/collection/components/header/header.js +2 -2
- package/dist/collection/components/header/header.utils.js +21 -2
- package/dist/collection/components/img/img.js +1 -1
- package/dist/collection/components/infinite-scroll/infinite-scroll.js +1 -1
- package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +2 -2
- package/dist/collection/components/input/input.js +3 -3
- package/dist/collection/components/input-password-toggle/input-password-toggle.js +3 -3
- package/dist/collection/components/item-divider/item-divider.js +2 -2
- package/dist/collection/components/item-group/item-group.js +1 -1
- package/dist/collection/components/item-option/item-option.js +2 -2
- package/dist/collection/components/item-options/item-options.js +1 -1
- package/dist/collection/components/item-sliding/item-sliding.js +3 -1
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/list/list.js +1 -1
- package/dist/collection/components/list-header/list-header.js +2 -2
- package/dist/collection/components/loading/loading.js +2 -2
- package/dist/collection/components/menu/menu.js +75 -27
- package/dist/collection/components/menu-button/menu-button.js +2 -2
- package/dist/collection/components/menu-toggle/menu-toggle.js +2 -2
- package/dist/collection/components/modal/modal.js +4 -4
- package/dist/collection/components/nav/nav.js +1 -1
- package/dist/collection/components/nav-link/nav-link.js +1 -1
- package/dist/collection/components/note/note.js +2 -2
- package/dist/collection/components/picker/picker.js +2 -2
- package/dist/collection/components/picker-column/picker-column.js +3 -3
- package/dist/collection/components/picker-column-option/picker-column-option.js +2 -2
- package/dist/collection/components/picker-legacy/picker.js +2 -2
- package/dist/collection/components/picker-legacy-column/picker-column.js +2 -2
- package/dist/collection/components/popover/popover.js +2 -2
- package/dist/collection/components/progress-bar/progress-bar.js +1 -1
- package/dist/collection/components/radio/radio.js +9 -7
- package/dist/collection/components/radio-group/radio-group.js +34 -3
- package/dist/collection/components/range/range.js +3 -3
- package/dist/collection/components/refresher/refresher.js +1 -1
- package/dist/collection/components/refresher-content/refresher-content.js +1 -1
- package/dist/collection/components/reorder/reorder.js +1 -1
- package/dist/collection/components/reorder-group/reorder-group.js +1 -1
- package/dist/collection/components/ripple-effect/ripple-effect.js +1 -1
- package/dist/collection/components/router-link/router-link.js +2 -2
- package/dist/collection/components/router-outlet/router-outlet.js +1 -1
- package/dist/collection/components/row/row.js +1 -1
- package/dist/collection/components/searchbar/searchbar.js +4 -4
- package/dist/collection/components/segment/segment.js +115 -14
- package/dist/collection/components/segment-button/segment-button.js +40 -5
- package/dist/collection/components/segment-content/segment-content.css +6 -0
- package/dist/collection/components/segment-content/segment-content.js +21 -0
- package/dist/collection/components/segment-view/segment-view-interface.js +1 -0
- package/dist/collection/components/segment-view/segment-view.ios.css +83 -0
- package/dist/collection/components/segment-view/segment-view.js +227 -0
- package/dist/collection/components/segment-view/segment-view.md.css +83 -0
- package/dist/collection/components/select/select.js +61 -16
- package/dist/collection/components/select-modal/select-modal-interface.js +1 -0
- package/dist/collection/components/select-modal/select-modal.ios.css +3 -0
- package/dist/collection/components/select-modal/select-modal.js +159 -0
- package/dist/collection/components/select-modal/select-modal.md.css +110 -0
- package/dist/collection/components/select-modal/test/fixtures.js +48 -0
- package/dist/collection/components/select-option/select-option.js +1 -1
- package/dist/collection/components/select-popover/select-popover.js +1 -1
- package/dist/collection/components/skeleton-text/skeleton-text.js +2 -2
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/split-pane/split-pane.js +2 -2
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-bar/tab-bar.js +2 -2
- package/dist/collection/components/tab-button/tab-button.js +2 -2
- package/dist/collection/components/tabs/tabs.js +1 -1
- package/dist/collection/components/text/text.js +2 -2
- package/dist/collection/components/textarea/textarea.js +2 -2
- package/dist/collection/components/thumbnail/thumbnail.js +1 -1
- package/dist/collection/components/title/title.js +2 -2
- package/dist/collection/components/toast/toast.ios.css +1 -1
- package/dist/collection/components/toast/toast.js +2 -2
- package/dist/collection/components/toast/toast.md.css +1 -1
- package/dist/collection/components/toggle/toggle.js +3 -3
- package/dist/collection/components/toolbar/toolbar.js +2 -2
- package/dist/collection/utils/focus-trap.js +8 -2
- package/dist/collection/utils/menu-controller/index.js +2 -2
- package/dist/collection/utils/overlays.js +19 -9
- package/dist/docs.json +426 -29
- package/dist/esm/{index-fe1782b1.js → index-24b48b06.js} +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/ion-action-sheet.entry.js +1 -1
- package/dist/esm/ion-alert.entry.js +8 -6
- package/dist/esm/ion-app_8.entry.js +36 -17
- package/dist/esm/ion-avatar_3.entry.js +4 -4
- package/dist/esm/ion-back-button.entry.js +2 -2
- package/dist/esm/ion-backdrop.entry.js +1 -1
- package/dist/esm/ion-breadcrumb_2.entry.js +6 -6
- package/dist/esm/ion-button_2.entry.js +2 -2
- package/dist/esm/ion-card_5.entry.js +8 -8
- package/dist/esm/ion-checkbox.entry.js +5 -4
- package/dist/esm/ion-chip.entry.js +2 -2
- package/dist/esm/ion-col_3.entry.js +5 -5
- package/dist/esm/ion-datetime-button.entry.js +2 -2
- package/dist/esm/ion-datetime_3.entry.js +7 -7
- package/dist/esm/ion-fab_3.entry.js +6 -6
- package/dist/esm/ion-img.entry.js +1 -1
- package/dist/esm/ion-infinite-scroll_2.entry.js +3 -3
- package/dist/esm/ion-input-password-toggle.entry.js +3 -3
- package/dist/esm/ion-input.entry.js +3 -3
- package/dist/esm/ion-item-option_3.entry.js +6 -4
- package/dist/esm/ion-item_8.entry.js +12 -12
- package/dist/esm/ion-loading.entry.js +3 -3
- package/dist/esm/ion-menu_3.entry.js +52 -25
- package/dist/esm/ion-modal.entry.js +5 -5
- package/dist/esm/ion-nav_2.entry.js +2 -2
- package/dist/esm/ion-picker-column-option.entry.js +2 -2
- package/dist/esm/ion-picker-column.entry.js +3 -3
- package/dist/esm/ion-picker.entry.js +2 -2
- package/dist/esm/ion-popover.entry.js +3 -3
- package/dist/esm/ion-progress-bar.entry.js +1 -1
- package/dist/esm/ion-radio_2.entry.js +17 -8
- package/dist/esm/ion-range.entry.js +3 -3
- package/dist/esm/ion-refresher_2.entry.js +2 -2
- package/dist/esm/ion-reorder_2.entry.js +2 -2
- package/dist/esm/ion-ripple-effect.entry.js +1 -1
- package/dist/esm/ion-route_4.entry.js +2 -2
- package/dist/esm/ion-searchbar.entry.js +4 -4
- package/dist/esm/ion-segment-content.entry.js +19 -0
- package/dist/esm/ion-segment-view.entry.js +118 -0
- package/dist/esm/ion-segment_2.entry.js +132 -19
- package/dist/esm/ion-select-modal.entry.js +107 -0
- package/dist/esm/ion-select_3.entry.js +40 -15
- package/dist/esm/ion-spinner.entry.js +1 -1
- package/dist/esm/ion-split-pane.entry.js +2 -2
- package/dist/esm/ion-tab-bar_2.entry.js +4 -4
- package/dist/esm/ion-tab_2.entry.js +3 -3
- package/dist/esm/ion-text.entry.js +2 -2
- package/dist/esm/ion-textarea.entry.js +2 -2
- package/dist/esm/ion-toast.entry.js +5 -5
- package/dist/esm/ion-toggle.entry.js +3 -3
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{overlays-ae10d43d.js → overlays-e7b9d6d9.js} +27 -12
- package/dist/esm-es5/{index-fe1782b1.js → index-24b48b06.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
- package/dist/esm-es5/ion-alert.entry.js +1 -1
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-avatar_3.entry.js +1 -1
- package/dist/esm-es5/ion-back-button.entry.js +1 -1
- package/dist/esm-es5/ion-backdrop.entry.js +1 -1
- package/dist/esm-es5/ion-breadcrumb_2.entry.js +1 -1
- package/dist/esm-es5/ion-button_2.entry.js +1 -1
- package/dist/esm-es5/ion-card_5.entry.js +1 -1
- package/dist/esm-es5/ion-checkbox.entry.js +2 -2
- package/dist/esm-es5/ion-chip.entry.js +1 -1
- package/dist/esm-es5/ion-col_3.entry.js +1 -1
- package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-fab_3.entry.js +1 -1
- package/dist/esm-es5/ion-img.entry.js +1 -1
- package/dist/esm-es5/ion-infinite-scroll_2.entry.js +1 -1
- package/dist/esm-es5/ion-input-password-toggle.entry.js +1 -1
- package/dist/esm-es5/ion-input.entry.js +1 -1
- package/dist/esm-es5/ion-item-option_3.entry.js +1 -1
- package/dist/esm-es5/ion-item_8.entry.js +1 -1
- package/dist/esm-es5/ion-loading.entry.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-modal.entry.js +1 -1
- package/dist/esm-es5/ion-nav_2.entry.js +1 -1
- package/dist/esm-es5/ion-picker-column-option.entry.js +1 -1
- package/dist/esm-es5/ion-picker-column.entry.js +1 -1
- package/dist/esm-es5/ion-picker.entry.js +1 -1
- package/dist/esm-es5/ion-popover.entry.js +1 -1
- package/dist/esm-es5/ion-progress-bar.entry.js +1 -1
- package/dist/esm-es5/ion-radio_2.entry.js +1 -1
- package/dist/esm-es5/ion-range.entry.js +1 -1
- package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
- package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
- package/dist/esm-es5/ion-ripple-effect.entry.js +1 -1
- package/dist/esm-es5/ion-route_4.entry.js +1 -1
- package/dist/esm-es5/ion-searchbar.entry.js +1 -1
- package/dist/esm-es5/ion-segment-content.entry.js +4 -0
- package/dist/esm-es5/ion-segment-view.entry.js +4 -0
- package/dist/esm-es5/ion-segment_2.entry.js +1 -1
- package/dist/esm-es5/ion-select-modal.entry.js +4 -0
- package/dist/esm-es5/ion-select_3.entry.js +1 -1
- package/dist/esm-es5/ion-spinner.entry.js +1 -1
- package/dist/esm-es5/ion-split-pane.entry.js +1 -1
- package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
- package/dist/esm-es5/ion-tab_2.entry.js +1 -1
- package/dist/esm-es5/ion-text.entry.js +1 -1
- package/dist/esm-es5/ion-textarea.entry.js +1 -1
- package/dist/esm-es5/ion-toast.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/overlays-e7b9d6d9.js +4 -0
- package/dist/html.html-data.json +65 -2
- package/dist/ionic/index.esm.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-313ccc01.system.entry.js → p-01186920.system.entry.js} +1 -1
- package/dist/ionic/{p-7251fed5.entry.js → p-04909654.entry.js} +1 -1
- package/dist/ionic/{p-e3e1e3de.entry.js → p-081a4ce4.entry.js} +1 -1
- package/dist/ionic/p-0aa833fb.system.js +4 -0
- package/dist/ionic/{p-79e7be3a.system.entry.js → p-1046866e.system.entry.js} +1 -1
- package/dist/ionic/p-12a722b8.system.entry.js +4 -0
- package/dist/ionic/{p-41c89b8d.entry.js → p-12c45a7c.entry.js} +1 -1
- package/dist/ionic/p-14be4015.entry.js +4 -0
- package/dist/ionic/{p-c71f301f.system.entry.js → p-14e159ea.system.entry.js} +1 -1
- package/dist/ionic/p-15e76dd1.entry.js +4 -0
- package/dist/ionic/{p-003eecb9.entry.js → p-16188af7.entry.js} +1 -1
- package/dist/ionic/p-16799667.system.entry.js +4 -0
- package/dist/ionic/p-16bfb979.system.entry.js +4 -0
- package/dist/ionic/{p-8836d0eb.system.entry.js → p-17a9ca63.system.entry.js} +1 -1
- package/dist/ionic/{p-b54fc1ae.entry.js → p-19ec4f42.entry.js} +1 -1
- package/dist/ionic/{p-8b6232a6.system.entry.js → p-1e010627.system.entry.js} +2 -2
- package/dist/ionic/{p-cdb11938.system.entry.js → p-1e67b266.system.entry.js} +1 -1
- package/dist/ionic/{p-0790b342.system.entry.js → p-1fe02220.system.entry.js} +1 -1
- package/dist/ionic/{p-836d39d4.system.entry.js → p-2172893e.system.entry.js} +1 -1
- package/dist/ionic/{p-4a0a4204.system.entry.js → p-2507278c.system.entry.js} +1 -1
- package/dist/ionic/{p-75c0dc65.system.entry.js → p-2799c6d3.system.entry.js} +1 -1
- package/dist/ionic/{p-a879ecb7.system.entry.js → p-2abae1cc.system.entry.js} +1 -1
- package/dist/ionic/{p-293ed6ac.system.entry.js → p-2b838f86.system.entry.js} +1 -1
- package/dist/ionic/p-2b9b78c7.entry.js +4 -0
- package/dist/ionic/{p-f0ab13a8.system.entry.js → p-2bd0ae94.system.entry.js} +1 -1
- package/dist/ionic/{p-4a82bd1c.system.entry.js → p-2e46590d.system.entry.js} +1 -1
- package/dist/ionic/{p-148b8abb.entry.js → p-2fc0dafe.entry.js} +1 -1
- package/dist/ionic/p-322c5fb4.system.js +2 -2
- package/dist/ionic/{p-60cc7986.entry.js → p-33a8a71b.entry.js} +1 -1
- package/dist/ionic/{p-18105026.system.entry.js → p-37cb43bd.system.entry.js} +1 -1
- package/dist/ionic/{p-be71fe0f.system.entry.js → p-404aede0.system.entry.js} +1 -1
- package/dist/ionic/p-424eb140.system.entry.js +4 -0
- package/dist/ionic/{p-b7657e8d.entry.js → p-4439fc2a.entry.js} +1 -1
- package/dist/ionic/{p-c34659b9.entry.js → p-45693d7e.entry.js} +1 -1
- package/dist/ionic/p-49a0e74c.entry.js +4 -0
- package/dist/ionic/{p-fd0cb4ef.entry.js → p-4ec778aa.entry.js} +1 -1
- package/dist/ionic/p-508d024a.entry.js +4 -0
- package/dist/ionic/{p-f559ac5b.entry.js → p-51796b2d.entry.js} +1 -1
- package/dist/ionic/{p-9ece8dcf.entry.js → p-52d7a191.entry.js} +1 -1
- package/dist/ionic/{p-ce705aac.system.entry.js → p-567de071.system.entry.js} +1 -1
- package/dist/ionic/{p-95823c62.system.entry.js → p-5823babc.system.entry.js} +2 -2
- package/dist/ionic/{p-baffaf8d.system.entry.js → p-58d5df0c.system.entry.js} +1 -1
- package/dist/ionic/{p-521eca2e.entry.js → p-5ab1b709.entry.js} +1 -1
- package/dist/ionic/{p-8d44cf1f.entry.js → p-5b932840.entry.js} +1 -1
- package/dist/ionic/{p-53add985.system.entry.js → p-5fce0c0b.system.entry.js} +1 -1
- package/dist/ionic/p-626fd66d.system.entry.js +4 -0
- package/dist/ionic/{p-233e6c93.entry.js → p-62af944c.entry.js} +1 -1
- package/dist/ionic/{p-00b01a55.system.entry.js → p-63b0abde.system.entry.js} +1 -1
- package/dist/ionic/{p-ad9b5007.system.entry.js → p-6416c34c.system.entry.js} +1 -1
- package/dist/ionic/{p-857ca696.system.entry.js → p-6499df44.system.entry.js} +1 -1
- package/dist/ionic/p-69666e8a.system.entry.js +4 -0
- package/dist/ionic/{p-9e208825.entry.js → p-6b280620.entry.js} +1 -1
- package/dist/ionic/{p-5e842258.entry.js → p-6d32975a.entry.js} +1 -1
- package/dist/ionic/p-6d6cedc5.entry.js +4 -0
- package/dist/ionic/p-73dc4950.entry.js +4 -0
- package/dist/ionic/{p-fcd71204.system.entry.js → p-7458862e.system.entry.js} +1 -1
- package/dist/ionic/{p-a3711608.system.entry.js → p-797eeea8.system.entry.js} +1 -1
- package/dist/ionic/{p-f8c8b9ba.entry.js → p-7b9a2b23.entry.js} +1 -1
- package/dist/ionic/{p-bd25d639.system.entry.js → p-7ddc46c3.system.entry.js} +1 -1
- package/dist/ionic/{p-6817cf42.system.entry.js → p-7ed1657c.system.entry.js} +1 -1
- package/dist/ionic/p-908d6080.entry.js +4 -0
- package/dist/ionic/{p-af999a31.entry.js → p-937a7e21.entry.js} +1 -1
- package/dist/ionic/p-942b5e13.entry.js +4 -0
- package/dist/ionic/{p-4c8fceb0.entry.js → p-95775830.entry.js} +1 -1
- package/dist/ionic/{p-6ceb04b5.entry.js → p-982315a6.entry.js} +1 -1
- package/dist/ionic/{p-973f0b15.system.entry.js → p-98231c01.system.entry.js} +1 -1
- package/dist/ionic/{p-25928b83.system.entry.js → p-985a7e17.system.entry.js} +1 -1
- package/dist/ionic/{p-e3a5da9d.entry.js → p-98ff6b32.entry.js} +1 -1
- package/dist/ionic/{p-6e85e450.entry.js → p-9df2c6fb.entry.js} +1 -1
- package/dist/ionic/{p-d58f21d2.entry.js → p-9e33104d.entry.js} +1 -1
- package/dist/ionic/{p-da263d8e.entry.js → p-9fa07aec.entry.js} +1 -1
- package/dist/ionic/{p-9910f786.entry.js → p-a43467d8.entry.js} +1 -1
- package/dist/ionic/{p-6b8893dd.entry.js → p-a61cba41.entry.js} +1 -1
- package/dist/ionic/p-adbc4bdf.entry.js +4 -0
- package/dist/ionic/{p-49bc6544.entry.js → p-afecb188.entry.js} +1 -1
- package/dist/ionic/p-b2272f51.system.entry.js +4 -0
- package/dist/ionic/{p-be715dd3.system.entry.js → p-b335ffed.system.entry.js} +1 -1
- package/dist/ionic/{p-6d50faff.entry.js → p-b79ba17c.entry.js} +1 -1
- package/dist/ionic/{p-e3f13b08.js → p-b82d4cab.js} +1 -1
- package/dist/ionic/{p-68c4df55.entry.js → p-b9d7015f.entry.js} +1 -1
- package/dist/ionic/{p-7243df6f.entry.js → p-bb0db172.entry.js} +1 -1
- package/dist/ionic/{p-df83e308.system.entry.js → p-bc36ad98.system.entry.js} +1 -1
- package/dist/ionic/{p-773d118d.entry.js → p-bdad26e3.entry.js} +1 -1
- package/dist/ionic/p-c29f8157.system.entry.js +4 -0
- package/dist/ionic/p-c2b74d92.system.entry.js +4 -0
- package/dist/ionic/{p-176b372f.entry.js → p-c41ac815.entry.js} +1 -1
- package/dist/ionic/{p-79b12fda.system.js → p-c449820c.system.js} +1 -1
- package/dist/ionic/{p-5417b9bb.entry.js → p-c9f3a539.entry.js} +1 -1
- package/dist/ionic/{p-2ea1ca4f.system.entry.js → p-ca065903.system.entry.js} +1 -1
- package/dist/ionic/{p-2ca6eac2.system.entry.js → p-cac0e0b3.system.entry.js} +1 -1
- package/dist/ionic/{p-3c968c7f.system.entry.js → p-d18ab582.system.entry.js} +2 -2
- package/dist/ionic/{p-92d7a3d1.entry.js → p-d7aa6b00.entry.js} +1 -1
- package/dist/ionic/{p-21cfd4de.entry.js → p-da074ff7.entry.js} +1 -1
- package/dist/ionic/{p-89a0a446.entry.js → p-de930745.entry.js} +1 -1
- package/dist/ionic/{p-960803fc.system.entry.js → p-e4ee80be.system.entry.js} +1 -1
- package/dist/ionic/{p-d754c709.system.entry.js → p-e4f69534.system.entry.js} +1 -1
- package/dist/ionic/{p-dda5c73d.entry.js → p-e563a35c.entry.js} +1 -1
- package/dist/ionic/p-e6635685.js +4 -0
- package/dist/ionic/{p-7740e32c.system.js → p-e7ed4a7f.system.js} +1 -1
- package/dist/ionic/{p-0373d924.system.entry.js → p-ebf042e0.system.entry.js} +1 -1
- package/dist/ionic/{p-9b6c6302.system.entry.js → p-ed75fcfb.system.entry.js} +1 -1
- package/dist/ionic/{p-01503bbd.system.entry.js → p-f3102647.system.entry.js} +1 -1
- package/dist/ionic/p-fbf284c7.entry.js +4 -0
- package/dist/ionic/{p-6562e0a9.system.entry.js → p-fca6ef5f.system.entry.js} +1 -1
- package/dist/ionic/p-fec61c32.entry.js +4 -0
- package/dist/ionic/{p-b0180ce1.system.entry.js → p-ffd131f9.system.entry.js} +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +2 -1
- package/dist/types/components/menu/menu-interface.d.ts +5 -2
- package/dist/types/components/menu/menu.d.ts +6 -6
- package/dist/types/components/radio/radio.d.ts +1 -1
- package/dist/types/components/radio-group/radio-group.d.ts +2 -0
- package/dist/types/components/segment/segment.d.ts +21 -1
- package/dist/types/components/segment-button/segment-button.d.ts +4 -0
- package/dist/types/components/segment-content/segment-content.d.ts +4 -0
- package/dist/types/components/segment-view/segment-view-interface.d.ts +4 -0
- package/dist/types/components/segment-view/segment-view.d.ts +55 -0
- package/dist/types/components/select/select-interface.d.ts +1 -1
- package/dist/types/components/select/select.d.ts +5 -4
- package/dist/types/components/select-modal/select-modal-interface.d.ts +10 -0
- package/dist/types/components/select-modal/select-modal.d.ts +16 -0
- package/dist/types/components/select-modal/test/fixtures.d.ts +16 -0
- package/dist/types/components.d.ts +104 -13
- package/dist/types/utils/focus-trap.d.ts +1 -1
- package/dist/types/utils/overlays-interface.d.ts +1 -1
- package/hydrate/index.js +695 -228
- package/hydrate/index.mjs +695 -228
- package/package.json +1 -1
- package/dist/esm-es5/overlays-ae10d43d.js +0 -4
- package/dist/ionic/p-04fc24ee.system.js +0 -4
- package/dist/ionic/p-110e03be.system.entry.js +0 -4
- package/dist/ionic/p-2200e26b.entry.js +0 -4
- package/dist/ionic/p-44d1539c.system.entry.js +0 -4
- package/dist/ionic/p-53854390.entry.js +0 -4
- package/dist/ionic/p-5800e441.entry.js +0 -4
- package/dist/ionic/p-5c831f49.js +0 -4
- package/dist/ionic/p-63d65dbc.system.entry.js +0 -4
- package/dist/ionic/p-72ffd137.system.entry.js +0 -4
- package/dist/ionic/p-82ab7ccb.entry.js +0 -4
- package/dist/ionic/p-87a4407b.entry.js +0 -4
- package/dist/ionic/p-9172535c.entry.js +0 -4
- package/dist/ionic/p-93f37ceb.system.entry.js +0 -4
- package/dist/ionic/p-9895e7f3.entry.js +0 -4
- package/dist/ionic/p-a0c88dc2.system.entry.js +0 -4
- package/dist/ionic/p-a89dac49.entry.js +0 -4
- package/dist/ionic/p-f88ebc36.entry.js +0 -4
|
@@ -0,0 +1,1742 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
+
*/
|
|
4
|
+
import { proxyCustomElement, HTMLElement, createEvent, writeTask, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { a as findClosestIonContent, i as isIonContent, d as disableContentScrollY, r as resetContentScrollY, f as findIonContent, p as printIonContentErrorMsg } from './index8.js';
|
|
6
|
+
import { C as CoreDelegate, a as attachComponent, d as detachComponent } from './framework-delegate.js';
|
|
7
|
+
import { g as getElementRoot, k as clamp, r as raf, d as inheritAttributes, j as hasLazyBuild } from './helpers.js';
|
|
8
|
+
import { c as createLockController } from './lock-controller.js';
|
|
9
|
+
import { p as printIonWarning } from './index6.js';
|
|
10
|
+
import { g as getCapacitor } from './capacitor.js';
|
|
11
|
+
import { G as GESTURE, O as OVERLAY_GESTURE_PRIORITY, F as FOCUS_TRAP_DISABLE_CLASS, e as createTriggerController, B as BACKDROP, j as prepareOverlay, k as setOverlayId, f as present, g as dismiss, h as eventMethod } from './overlays.js';
|
|
12
|
+
import { g as getClassMap } from './theme.js';
|
|
13
|
+
import { e as deepReady, w as waitForMount } from './index2.js';
|
|
14
|
+
import { b as getIonMode, c as config } from './ionic-global.js';
|
|
15
|
+
import { KEYBOARD_DID_OPEN } from './keyboard2.js';
|
|
16
|
+
import { c as createAnimation } from './animation.js';
|
|
17
|
+
import { g as getTimeGivenProgression } from './cubic-bezier.js';
|
|
18
|
+
import { createGesture } from './index3.js';
|
|
19
|
+
import { w as win } from './index5.js';
|
|
20
|
+
import { d as defineCustomElement$1 } from './backdrop.js';
|
|
21
|
+
|
|
22
|
+
var Style;
|
|
23
|
+
(function (Style) {
|
|
24
|
+
Style["Dark"] = "DARK";
|
|
25
|
+
Style["Light"] = "LIGHT";
|
|
26
|
+
Style["Default"] = "DEFAULT";
|
|
27
|
+
})(Style || (Style = {}));
|
|
28
|
+
const StatusBar = {
|
|
29
|
+
getEngine() {
|
|
30
|
+
const capacitor = getCapacitor();
|
|
31
|
+
if (capacitor === null || capacitor === void 0 ? void 0 : capacitor.isPluginAvailable('StatusBar')) {
|
|
32
|
+
return capacitor.Plugins.StatusBar;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
},
|
|
36
|
+
setStyle(options) {
|
|
37
|
+
const engine = this.getEngine();
|
|
38
|
+
if (!engine) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
engine.setStyle(options);
|
|
42
|
+
},
|
|
43
|
+
getStyle: async function () {
|
|
44
|
+
const engine = this.getEngine();
|
|
45
|
+
if (!engine) {
|
|
46
|
+
return Style.Default;
|
|
47
|
+
}
|
|
48
|
+
const { style } = await engine.getInfo();
|
|
49
|
+
return style;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Use y = mx + b to
|
|
55
|
+
* figure out the backdrop value
|
|
56
|
+
* at a particular x coordinate. This
|
|
57
|
+
* is useful when the backdrop does
|
|
58
|
+
* not begin to fade in until after
|
|
59
|
+
* the 0 breakpoint.
|
|
60
|
+
*/
|
|
61
|
+
const getBackdropValueForSheet = (x, backdropBreakpoint) => {
|
|
62
|
+
/**
|
|
63
|
+
* We will use these points:
|
|
64
|
+
* (backdropBreakpoint, 0)
|
|
65
|
+
* (maxBreakpoint, 1)
|
|
66
|
+
* We know that at the beginning breakpoint,
|
|
67
|
+
* the backdrop will be hidden. We also
|
|
68
|
+
* know that at the maxBreakpoint, the backdrop
|
|
69
|
+
* must be fully visible. maxBreakpoint should
|
|
70
|
+
* always be 1 even if the maximum value
|
|
71
|
+
* of the breakpoints array is not 1 since
|
|
72
|
+
* the animation runs from a progress of 0
|
|
73
|
+
* to a progress of 1.
|
|
74
|
+
* m = (y2 - y1) / (x2 - x1)
|
|
75
|
+
*
|
|
76
|
+
* This is simplified from:
|
|
77
|
+
* m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
|
|
78
|
+
*
|
|
79
|
+
* If the backdropBreakpoint is 1, we return 0 as the
|
|
80
|
+
* backdrop is completely hidden.
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
if (backdropBreakpoint === 1) {
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const slope = 1 / (1 - backdropBreakpoint);
|
|
87
|
+
/**
|
|
88
|
+
* From here, compute b which is
|
|
89
|
+
* the backdrop opacity if the offset
|
|
90
|
+
* is 0. If the backdrop does not
|
|
91
|
+
* begin to fade in until after the
|
|
92
|
+
* 0 breakpoint, this b value will be
|
|
93
|
+
* negative. This is fine as we never pass
|
|
94
|
+
* b directly into the animation keyframes.
|
|
95
|
+
* b = y - mx
|
|
96
|
+
* Use a known point: (backdropBreakpoint, 0)
|
|
97
|
+
* This is simplified from:
|
|
98
|
+
* b = 0 - (backdropBreakpoint * slope)
|
|
99
|
+
*/
|
|
100
|
+
const b = -(backdropBreakpoint * slope);
|
|
101
|
+
/**
|
|
102
|
+
* Finally, we can now determine the
|
|
103
|
+
* backdrop offset given an arbitrary
|
|
104
|
+
* gesture offset.
|
|
105
|
+
*/
|
|
106
|
+
return x * slope + b;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* The tablet/desktop card modal activates
|
|
110
|
+
* when the window width is >= 768.
|
|
111
|
+
* At that point, the presenting element
|
|
112
|
+
* is not transformed, so we do not need to
|
|
113
|
+
* adjust the status bar color.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
const setCardStatusBarDark = () => {
|
|
117
|
+
if (!win || win.innerWidth >= 768) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
StatusBar.setStyle({ style: Style.Dark });
|
|
121
|
+
};
|
|
122
|
+
const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
|
|
123
|
+
if (!win || win.innerWidth >= 768) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
StatusBar.setStyle({ style: defaultStyle });
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleCanDismiss = async (el, animation) => {
|
|
130
|
+
/**
|
|
131
|
+
* If canDismiss is not a function
|
|
132
|
+
* then we can return early. If canDismiss is `true`,
|
|
133
|
+
* then canDismissBlocksGesture is `false` as canDismiss
|
|
134
|
+
* will never interrupt the gesture. As a result,
|
|
135
|
+
* this code block is never reached. If canDismiss is `false`,
|
|
136
|
+
* then we never dismiss.
|
|
137
|
+
*/
|
|
138
|
+
if (typeof el.canDismiss !== 'function') {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Run the canDismiss callback.
|
|
143
|
+
* If the function returns `true`,
|
|
144
|
+
* then we can proceed with dismiss.
|
|
145
|
+
*/
|
|
146
|
+
const shouldDismiss = await el.canDismiss(undefined, GESTURE);
|
|
147
|
+
if (!shouldDismiss) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* If canDismiss resolved after the snap
|
|
152
|
+
* back animation finished, we can
|
|
153
|
+
* dismiss immediately.
|
|
154
|
+
*
|
|
155
|
+
* If canDismiss resolved before the snap
|
|
156
|
+
* back animation finished, we need to
|
|
157
|
+
* wait until the snap back animation is
|
|
158
|
+
* done before dismissing.
|
|
159
|
+
*/
|
|
160
|
+
if (animation.isRunning()) {
|
|
161
|
+
animation.onFinish(() => {
|
|
162
|
+
el.dismiss(undefined, 'handler');
|
|
163
|
+
}, { oneTimeCallback: true });
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
el.dismiss(undefined, 'handler');
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* This function lets us simulate a realistic spring-like animation
|
|
171
|
+
* when swiping down on the modal.
|
|
172
|
+
* There are two forces that we need to use to compute the spring physics:
|
|
173
|
+
*
|
|
174
|
+
* 1. Stiffness, k: This is a measure of resistance applied a spring.
|
|
175
|
+
* 2. Dampening, c: This value has the effect of reducing or preventing oscillation.
|
|
176
|
+
*
|
|
177
|
+
* Using these two values, we can calculate the Spring Force and the Dampening Force
|
|
178
|
+
* to compute the total force applied to a spring.
|
|
179
|
+
*
|
|
180
|
+
* Spring Force: This force pulls a spring back into its equilibrium position.
|
|
181
|
+
* Hooke's Law tells us that that spring force (FS) = kX.
|
|
182
|
+
* k is the stiffness of a spring, and X is the displacement of the spring from its
|
|
183
|
+
* equilibrium position. In this case, it is the amount by which the free end
|
|
184
|
+
* of a spring was displaced (stretched/pushed) from its "relaxed" position.
|
|
185
|
+
*
|
|
186
|
+
* Dampening Force: This force slows down motion. Without it, a spring would oscillate forever.
|
|
187
|
+
* The dampening force, FD, can be found via this formula: FD = -cv
|
|
188
|
+
* where c the dampening value and v is velocity.
|
|
189
|
+
*
|
|
190
|
+
* Therefore, the resulting force that is exerted on the block is:
|
|
191
|
+
* F = FS + FD = -kX - cv
|
|
192
|
+
*
|
|
193
|
+
* Newton's 2nd Law tells us that F = ma:
|
|
194
|
+
* ma = -kX - cv.
|
|
195
|
+
*
|
|
196
|
+
* For Ionic's purposes, we can assume that m = 1:
|
|
197
|
+
* a = -kX - cv
|
|
198
|
+
*
|
|
199
|
+
* Imagine a block attached to the end of a spring. At equilibrium
|
|
200
|
+
* the block is at position x = 1.
|
|
201
|
+
* Pressing on the block moves it to position x = 0;
|
|
202
|
+
* So, to calculate the displacement, we need to take the
|
|
203
|
+
* current position and subtract the previous position from it.
|
|
204
|
+
* X = x - x0 = 0 - 1 = -1.
|
|
205
|
+
*
|
|
206
|
+
* For Ionic's purposes, we are only pushing on the spring modal
|
|
207
|
+
* so we have a max position of 1.
|
|
208
|
+
* As a result, we can expand displacement to this formula:
|
|
209
|
+
* X = x - 1
|
|
210
|
+
*
|
|
211
|
+
* a = -k(x - 1) - cv
|
|
212
|
+
*
|
|
213
|
+
* We can represent the motion of something as a function of time: f(t) = x.
|
|
214
|
+
* The derivative of position gives us the velocity: f'(t)
|
|
215
|
+
* The derivative of the velocity gives us the acceleration: f''(t)
|
|
216
|
+
*
|
|
217
|
+
* We can substitute the formula above with these values:
|
|
218
|
+
*
|
|
219
|
+
* f"(t) = -k * (f(t) - 1) - c * f'(t)
|
|
220
|
+
*
|
|
221
|
+
* This is called a differential equation.
|
|
222
|
+
*
|
|
223
|
+
* We know that at t = 0, we are at x = 0 because the modal does not move: f(0) = 0
|
|
224
|
+
* This means our velocity is also zero: f'(0) = 0.
|
|
225
|
+
*
|
|
226
|
+
* We can cheat a bit and plug the formula into Wolfram Alpha.
|
|
227
|
+
* However, we need to pick stiffness and dampening values:
|
|
228
|
+
* k = 0.57
|
|
229
|
+
* c = 15
|
|
230
|
+
*
|
|
231
|
+
* I picked these as they are fairly close to native iOS's spring effect
|
|
232
|
+
* with the modal.
|
|
233
|
+
*
|
|
234
|
+
* What we plug in is this: f(0) = 0; f'(0) = 0; f''(t) = -0.57(f(t) - 1) - 15f'(t)
|
|
235
|
+
*
|
|
236
|
+
* The result is a formula that lets us calculate the acceleration
|
|
237
|
+
* for a given time t.
|
|
238
|
+
* Note: This is the approximate form of the solution. Wolfram Alpha will
|
|
239
|
+
* give you a complex differential equation too.
|
|
240
|
+
*/
|
|
241
|
+
const calculateSpringStep = (t) => {
|
|
242
|
+
return 0.00255275 * 2.71828 ** (-14.9619 * t) - 1.00255 * 2.71828 ** (-0.0380968 * t) + 1;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Defaults for the card swipe animation
|
|
246
|
+
const SwipeToCloseDefaults = {
|
|
247
|
+
MIN_PRESENTING_SCALE: 0.915,
|
|
248
|
+
};
|
|
249
|
+
const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) => {
|
|
250
|
+
/**
|
|
251
|
+
* The step value at which a card modal
|
|
252
|
+
* is eligible for dismissing via gesture.
|
|
253
|
+
*/
|
|
254
|
+
const DISMISS_THRESHOLD = 0.5;
|
|
255
|
+
const height = el.offsetHeight;
|
|
256
|
+
let isOpen = false;
|
|
257
|
+
let canDismissBlocksGesture = false;
|
|
258
|
+
let contentEl = null;
|
|
259
|
+
let scrollEl = null;
|
|
260
|
+
const canDismissMaxStep = 0.2;
|
|
261
|
+
let initialScrollY = true;
|
|
262
|
+
let lastStep = 0;
|
|
263
|
+
const getScrollY = () => {
|
|
264
|
+
if (contentEl && isIonContent(contentEl)) {
|
|
265
|
+
return contentEl.scrollY;
|
|
266
|
+
/**
|
|
267
|
+
* Custom scroll containers are intended to be
|
|
268
|
+
* used with virtual scrolling, so we assume
|
|
269
|
+
* there is scrolling in this case.
|
|
270
|
+
*/
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
const canStart = (detail) => {
|
|
277
|
+
const target = detail.event.target;
|
|
278
|
+
if (target === null || !target.closest) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* If we are swiping on the content,
|
|
283
|
+
* swiping should only be possible if
|
|
284
|
+
* the content is scrolled all the way
|
|
285
|
+
* to the top so that we do not interfere
|
|
286
|
+
* with scrolling.
|
|
287
|
+
*
|
|
288
|
+
* We cannot assume that the `ion-content`
|
|
289
|
+
* target will remain consistent between
|
|
290
|
+
* swipes. For example, when using
|
|
291
|
+
* ion-nav within a card modal it is
|
|
292
|
+
* possible to swipe, push a view, and then
|
|
293
|
+
* swipe again. The target content will not
|
|
294
|
+
* be the same between swipes.
|
|
295
|
+
*/
|
|
296
|
+
contentEl = findClosestIonContent(target);
|
|
297
|
+
if (contentEl) {
|
|
298
|
+
/**
|
|
299
|
+
* The card should never swipe to close
|
|
300
|
+
* on the content with a refresher.
|
|
301
|
+
* Note: We cannot solve this by making the
|
|
302
|
+
* swipeToClose gesture have a higher priority
|
|
303
|
+
* than the refresher gesture as the iOS native
|
|
304
|
+
* refresh gesture uses a scroll listener in
|
|
305
|
+
* addition to a gesture.
|
|
306
|
+
*
|
|
307
|
+
* Note: Do not use getScrollElement here
|
|
308
|
+
* because we need this to be a synchronous
|
|
309
|
+
* operation, and getScrollElement is
|
|
310
|
+
* asynchronous.
|
|
311
|
+
*/
|
|
312
|
+
if (isIonContent(contentEl)) {
|
|
313
|
+
const root = getElementRoot(contentEl);
|
|
314
|
+
scrollEl = root.querySelector('.inner-scroll');
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
scrollEl = contentEl;
|
|
318
|
+
}
|
|
319
|
+
const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
|
|
320
|
+
return !hasRefresherInContent && scrollEl.scrollTop === 0;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Card should be swipeable on all
|
|
324
|
+
* parts of the modal except for the footer.
|
|
325
|
+
*/
|
|
326
|
+
const footer = target.closest('ion-footer');
|
|
327
|
+
if (footer === null) {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
};
|
|
332
|
+
const onStart = (detail) => {
|
|
333
|
+
const { deltaY } = detail;
|
|
334
|
+
/**
|
|
335
|
+
* Get the initial scrollY value so
|
|
336
|
+
* that we can correctly reset the scrollY
|
|
337
|
+
* prop when the gesture ends.
|
|
338
|
+
*/
|
|
339
|
+
initialScrollY = getScrollY();
|
|
340
|
+
/**
|
|
341
|
+
* If canDismiss is anything other than `true`
|
|
342
|
+
* then users should be able to swipe down
|
|
343
|
+
* until a threshold is hit. At that point,
|
|
344
|
+
* the card modal should not proceed any further.
|
|
345
|
+
* TODO (FW-937)
|
|
346
|
+
* Remove undefined check
|
|
347
|
+
*/
|
|
348
|
+
canDismissBlocksGesture = el.canDismiss !== undefined && el.canDismiss !== true;
|
|
349
|
+
/**
|
|
350
|
+
* If we are pulling down, then
|
|
351
|
+
* it is possible we are pulling on the
|
|
352
|
+
* content. We do not want scrolling to
|
|
353
|
+
* happen at the same time as the gesture.
|
|
354
|
+
*/
|
|
355
|
+
if (deltaY > 0 && contentEl) {
|
|
356
|
+
disableContentScrollY(contentEl);
|
|
357
|
+
}
|
|
358
|
+
animation.progressStart(true, isOpen ? 1 : 0);
|
|
359
|
+
};
|
|
360
|
+
const onMove = (detail) => {
|
|
361
|
+
const { deltaY } = detail;
|
|
362
|
+
/**
|
|
363
|
+
* If we are pulling down, then
|
|
364
|
+
* it is possible we are pulling on the
|
|
365
|
+
* content. We do not want scrolling to
|
|
366
|
+
* happen at the same time as the gesture.
|
|
367
|
+
*/
|
|
368
|
+
if (deltaY > 0 && contentEl) {
|
|
369
|
+
disableContentScrollY(contentEl);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* If we are swiping on the content
|
|
373
|
+
* then the swipe gesture should only
|
|
374
|
+
* happen if we are pulling down.
|
|
375
|
+
*
|
|
376
|
+
* However, if we pull up and
|
|
377
|
+
* then down such that the scroll position
|
|
378
|
+
* returns to 0, we should be able to swipe
|
|
379
|
+
* the card.
|
|
380
|
+
*/
|
|
381
|
+
const step = detail.deltaY / height;
|
|
382
|
+
/**
|
|
383
|
+
* Check if user is swiping down and
|
|
384
|
+
* if we have a canDismiss value that
|
|
385
|
+
* should block the gesture from
|
|
386
|
+
* proceeding,
|
|
387
|
+
*/
|
|
388
|
+
const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
|
|
389
|
+
/**
|
|
390
|
+
* If we are blocking the gesture from dismissing,
|
|
391
|
+
* set the max step value so that the sheet cannot be
|
|
392
|
+
* completely hidden.
|
|
393
|
+
*/
|
|
394
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
395
|
+
/**
|
|
396
|
+
* If we are blocking the gesture from
|
|
397
|
+
* dismissing, calculate the spring modifier value
|
|
398
|
+
* this will be added to the starting breakpoint
|
|
399
|
+
* value to give the gesture a spring-like feeling.
|
|
400
|
+
* Note that the starting breakpoint is always 0,
|
|
401
|
+
* so we omit adding 0 to the result.
|
|
402
|
+
*/
|
|
403
|
+
const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
|
|
404
|
+
const clampedStep = clamp(0.0001, processedStep, maxStep);
|
|
405
|
+
animation.progressStep(clampedStep);
|
|
406
|
+
/**
|
|
407
|
+
* When swiping down half way, the status bar style
|
|
408
|
+
* should be reset to its default value.
|
|
409
|
+
*
|
|
410
|
+
* We track lastStep so that we do not fire these
|
|
411
|
+
* functions on every onMove, only when the user has
|
|
412
|
+
* crossed a certain threshold.
|
|
413
|
+
*/
|
|
414
|
+
if (clampedStep >= DISMISS_THRESHOLD && lastStep < DISMISS_THRESHOLD) {
|
|
415
|
+
setCardStatusBarDefault(statusBarStyle);
|
|
416
|
+
/**
|
|
417
|
+
* However, if we swipe back up, then the
|
|
418
|
+
* status bar style should be set to have light
|
|
419
|
+
* text on a dark background.
|
|
420
|
+
*/
|
|
421
|
+
}
|
|
422
|
+
else if (clampedStep < DISMISS_THRESHOLD && lastStep >= DISMISS_THRESHOLD) {
|
|
423
|
+
setCardStatusBarDark();
|
|
424
|
+
}
|
|
425
|
+
lastStep = clampedStep;
|
|
426
|
+
};
|
|
427
|
+
const onEnd = (detail) => {
|
|
428
|
+
const velocity = detail.velocityY;
|
|
429
|
+
const step = detail.deltaY / height;
|
|
430
|
+
const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
|
|
431
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
432
|
+
const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
|
|
433
|
+
const clampedStep = clamp(0.0001, processedStep, maxStep);
|
|
434
|
+
const threshold = (detail.deltaY + velocity * 1000) / height;
|
|
435
|
+
/**
|
|
436
|
+
* If canDismiss blocks
|
|
437
|
+
* the swipe gesture, then the
|
|
438
|
+
* animation can never complete until
|
|
439
|
+
* canDismiss is checked.
|
|
440
|
+
*/
|
|
441
|
+
const shouldComplete = !isAttemptingDismissWithCanDismiss && threshold >= DISMISS_THRESHOLD;
|
|
442
|
+
let newStepValue = shouldComplete ? -0.001 : 0.001;
|
|
443
|
+
if (!shouldComplete) {
|
|
444
|
+
animation.easing('cubic-bezier(1, 0, 0.68, 0.28)');
|
|
445
|
+
newStepValue += getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], clampedStep)[0];
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
animation.easing('cubic-bezier(0.32, 0.72, 0, 1)');
|
|
449
|
+
newStepValue += getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], clampedStep)[0];
|
|
450
|
+
}
|
|
451
|
+
const duration = shouldComplete
|
|
452
|
+
? computeDuration(step * height, velocity)
|
|
453
|
+
: computeDuration((1 - clampedStep) * height, velocity);
|
|
454
|
+
isOpen = shouldComplete;
|
|
455
|
+
gesture.enable(false);
|
|
456
|
+
if (contentEl) {
|
|
457
|
+
resetContentScrollY(contentEl, initialScrollY);
|
|
458
|
+
}
|
|
459
|
+
animation
|
|
460
|
+
.onFinish(() => {
|
|
461
|
+
if (!shouldComplete) {
|
|
462
|
+
gesture.enable(true);
|
|
463
|
+
}
|
|
464
|
+
})
|
|
465
|
+
.progressEnd(shouldComplete ? 1 : 0, newStepValue, duration);
|
|
466
|
+
/**
|
|
467
|
+
* If the canDismiss value blocked the gesture
|
|
468
|
+
* from proceeding, then we should ignore whatever
|
|
469
|
+
* shouldComplete is. Whether or not the modal
|
|
470
|
+
* animation should complete is now determined by
|
|
471
|
+
* canDismiss.
|
|
472
|
+
*
|
|
473
|
+
* If the user swiped >25% of the way
|
|
474
|
+
* to the max step, then we should
|
|
475
|
+
* check canDismiss. 25% was chosen
|
|
476
|
+
* to avoid accidental swipes.
|
|
477
|
+
*/
|
|
478
|
+
if (isAttemptingDismissWithCanDismiss && clampedStep > maxStep / 4) {
|
|
479
|
+
handleCanDismiss(el, animation);
|
|
480
|
+
}
|
|
481
|
+
else if (shouldComplete) {
|
|
482
|
+
onDismiss();
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
const gesture = createGesture({
|
|
486
|
+
el,
|
|
487
|
+
gestureName: 'modalSwipeToClose',
|
|
488
|
+
gesturePriority: OVERLAY_GESTURE_PRIORITY,
|
|
489
|
+
direction: 'y',
|
|
490
|
+
threshold: 10,
|
|
491
|
+
canStart,
|
|
492
|
+
onStart,
|
|
493
|
+
onMove,
|
|
494
|
+
onEnd,
|
|
495
|
+
});
|
|
496
|
+
return gesture;
|
|
497
|
+
};
|
|
498
|
+
const computeDuration = (remaining, velocity) => {
|
|
499
|
+
return clamp(400, remaining / Math.abs(velocity * 1.1), 500);
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const createSheetEnterAnimation = (opts) => {
|
|
503
|
+
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
504
|
+
/**
|
|
505
|
+
* If the backdropBreakpoint is undefined, then the backdrop
|
|
506
|
+
* should always fade in. If the backdropBreakpoint came before the
|
|
507
|
+
* current breakpoint, then the backdrop should be fading in.
|
|
508
|
+
*/
|
|
509
|
+
const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
|
|
510
|
+
const initialBackdrop = shouldShowBackdrop ? `calc(var(--backdrop-opacity) * ${currentBreakpoint})` : '0';
|
|
511
|
+
const backdropAnimation = createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
|
|
512
|
+
if (shouldShowBackdrop) {
|
|
513
|
+
backdropAnimation
|
|
514
|
+
.beforeStyles({
|
|
515
|
+
'pointer-events': 'none',
|
|
516
|
+
})
|
|
517
|
+
.afterClearStyles(['pointer-events']);
|
|
518
|
+
}
|
|
519
|
+
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
520
|
+
{ offset: 0, opacity: 1, transform: 'translateY(100%)' },
|
|
521
|
+
{ offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
522
|
+
]);
|
|
523
|
+
return { wrapperAnimation, backdropAnimation };
|
|
524
|
+
};
|
|
525
|
+
const createSheetLeaveAnimation = (opts) => {
|
|
526
|
+
const { currentBreakpoint, backdropBreakpoint } = opts;
|
|
527
|
+
/**
|
|
528
|
+
* Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
|
|
529
|
+
* is defined, so we need to account for that offset by figuring out
|
|
530
|
+
* what the current backdrop value should be.
|
|
531
|
+
*/
|
|
532
|
+
const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
|
|
533
|
+
const defaultBackdrop = [
|
|
534
|
+
{ offset: 0, opacity: backdropValue },
|
|
535
|
+
{ offset: 1, opacity: 0 },
|
|
536
|
+
];
|
|
537
|
+
const customBackdrop = [
|
|
538
|
+
{ offset: 0, opacity: backdropValue },
|
|
539
|
+
{ offset: backdropBreakpoint, opacity: 0 },
|
|
540
|
+
{ offset: 1, opacity: 0 },
|
|
541
|
+
];
|
|
542
|
+
const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
|
|
543
|
+
const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
|
|
544
|
+
{ offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
|
|
545
|
+
{ offset: 1, opacity: 1, transform: `translateY(100%)` },
|
|
546
|
+
]);
|
|
547
|
+
return { wrapperAnimation, backdropAnimation };
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
const createEnterAnimation$1 = () => {
|
|
551
|
+
const backdropAnimation = createAnimation()
|
|
552
|
+
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
553
|
+
.beforeStyles({
|
|
554
|
+
'pointer-events': 'none',
|
|
555
|
+
})
|
|
556
|
+
.afterClearStyles(['pointer-events']);
|
|
557
|
+
const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(100vh)', 'translateY(0vh)');
|
|
558
|
+
return { backdropAnimation, wrapperAnimation };
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* iOS Modal Enter Animation for the Card presentation style
|
|
562
|
+
*/
|
|
563
|
+
const iosEnterAnimation = (baseEl, opts) => {
|
|
564
|
+
const { presentingEl, currentBreakpoint } = opts;
|
|
565
|
+
const root = getElementRoot(baseEl);
|
|
566
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$1();
|
|
567
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
568
|
+
wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
|
|
569
|
+
const baseAnimation = createAnimation('entering-base')
|
|
570
|
+
.addElement(baseEl)
|
|
571
|
+
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
572
|
+
.duration(500)
|
|
573
|
+
.addAnimation(wrapperAnimation);
|
|
574
|
+
if (presentingEl) {
|
|
575
|
+
const isMobile = window.innerWidth < 768;
|
|
576
|
+
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
577
|
+
const presentingElRoot = getElementRoot(presentingEl);
|
|
578
|
+
const presentingAnimation = createAnimation().beforeStyles({
|
|
579
|
+
transform: 'translateY(0)',
|
|
580
|
+
'transform-origin': 'top center',
|
|
581
|
+
overflow: 'hidden',
|
|
582
|
+
});
|
|
583
|
+
const appEl = baseEl.closest('ion-app');
|
|
584
|
+
if (isMobile && appEl) {
|
|
585
|
+
/**
|
|
586
|
+
* Fallback for browsers that does not support `max()` (ex: Firefox)
|
|
587
|
+
* No need to worry about statusbar padding since engines like Gecko
|
|
588
|
+
* are not used as the engine for standalone Cordova/Capacitor apps
|
|
589
|
+
*/
|
|
590
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
591
|
+
const modalTransform = hasCardModal ? '-10px' : transformOffset;
|
|
592
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
593
|
+
const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
|
|
594
|
+
presentingAnimation
|
|
595
|
+
.afterStyles({
|
|
596
|
+
transform: finalTransform,
|
|
597
|
+
})
|
|
598
|
+
.beforeAddWrite(() => appEl.style.setProperty('background-color', 'black'))
|
|
599
|
+
.addElement(presentingEl)
|
|
600
|
+
.keyframes([
|
|
601
|
+
{ offset: 0, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
|
|
602
|
+
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
|
|
603
|
+
]);
|
|
604
|
+
baseAnimation.addAnimation(presentingAnimation);
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
baseAnimation.addAnimation(backdropAnimation);
|
|
608
|
+
if (!hasCardModal) {
|
|
609
|
+
wrapperAnimation.fromTo('opacity', '0', '1');
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
|
|
613
|
+
const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
614
|
+
presentingAnimation
|
|
615
|
+
.afterStyles({
|
|
616
|
+
transform: finalTransform,
|
|
617
|
+
})
|
|
618
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
619
|
+
.keyframes([
|
|
620
|
+
{ offset: 0, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
|
|
621
|
+
{ offset: 1, filter: 'contrast(0.85)', transform: finalTransform },
|
|
622
|
+
]);
|
|
623
|
+
const shadowAnimation = createAnimation()
|
|
624
|
+
.afterStyles({
|
|
625
|
+
transform: finalTransform,
|
|
626
|
+
})
|
|
627
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
628
|
+
.keyframes([
|
|
629
|
+
{ offset: 0, opacity: '1', transform: 'translateY(0) scale(1)' },
|
|
630
|
+
{ offset: 1, opacity: '0', transform: finalTransform },
|
|
631
|
+
]);
|
|
632
|
+
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
baseAnimation.addAnimation(backdropAnimation);
|
|
638
|
+
}
|
|
639
|
+
return baseAnimation;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
const createLeaveAnimation$1 = () => {
|
|
643
|
+
const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
644
|
+
const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
|
|
645
|
+
return { backdropAnimation, wrapperAnimation };
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* iOS Modal Leave Animation
|
|
649
|
+
*/
|
|
650
|
+
const iosLeaveAnimation = (baseEl, opts, duration = 500) => {
|
|
651
|
+
const { presentingEl, currentBreakpoint } = opts;
|
|
652
|
+
const root = getElementRoot(baseEl);
|
|
653
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation$1();
|
|
654
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
655
|
+
wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
|
|
656
|
+
const baseAnimation = createAnimation('leaving-base')
|
|
657
|
+
.addElement(baseEl)
|
|
658
|
+
.easing('cubic-bezier(0.32,0.72,0,1)')
|
|
659
|
+
.duration(duration)
|
|
660
|
+
.addAnimation(wrapperAnimation);
|
|
661
|
+
const appEl = baseEl.closest('ion-app');
|
|
662
|
+
if (presentingEl && appEl) {
|
|
663
|
+
const isMobile = window.innerWidth < 768;
|
|
664
|
+
const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
|
|
665
|
+
const presentingElRoot = getElementRoot(presentingEl);
|
|
666
|
+
const presentingAnimation = createAnimation()
|
|
667
|
+
.beforeClearStyles(['transform'])
|
|
668
|
+
.afterClearStyles(['transform'])
|
|
669
|
+
.onFinish((currentStep) => {
|
|
670
|
+
// only reset background color if this is the last card-style modal
|
|
671
|
+
if (currentStep !== 1) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
presentingEl.style.setProperty('overflow', '');
|
|
675
|
+
const numModals = Array.from(appEl.querySelectorAll('ion-modal:not(.overlay-hidden)')).filter((m) => m.presentingElement !== undefined).length;
|
|
676
|
+
if (numModals <= 1) {
|
|
677
|
+
appEl.style.setProperty('background-color', '');
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
if (isMobile) {
|
|
681
|
+
const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
|
|
682
|
+
const modalTransform = hasCardModal ? '-10px' : transformOffset;
|
|
683
|
+
const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
|
|
684
|
+
const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
|
|
685
|
+
presentingAnimation.addElement(presentingEl).keyframes([
|
|
686
|
+
{ offset: 0, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
|
|
687
|
+
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
|
|
688
|
+
]);
|
|
689
|
+
baseAnimation.addAnimation(presentingAnimation);
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
baseAnimation.addAnimation(backdropAnimation);
|
|
693
|
+
if (!hasCardModal) {
|
|
694
|
+
wrapperAnimation.fromTo('opacity', '1', '0');
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
|
|
698
|
+
const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
|
|
699
|
+
presentingAnimation
|
|
700
|
+
.addElement(presentingElRoot.querySelector('.modal-wrapper'))
|
|
701
|
+
.afterStyles({
|
|
702
|
+
transform: 'translate3d(0, 0, 0)',
|
|
703
|
+
})
|
|
704
|
+
.keyframes([
|
|
705
|
+
{ offset: 0, filter: 'contrast(0.85)', transform: finalTransform },
|
|
706
|
+
{ offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
|
|
707
|
+
]);
|
|
708
|
+
const shadowAnimation = createAnimation()
|
|
709
|
+
.addElement(presentingElRoot.querySelector('.modal-shadow'))
|
|
710
|
+
.afterStyles({
|
|
711
|
+
transform: 'translateY(0) scale(1)',
|
|
712
|
+
})
|
|
713
|
+
.keyframes([
|
|
714
|
+
{ offset: 0, opacity: '0', transform: finalTransform },
|
|
715
|
+
{ offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' },
|
|
716
|
+
]);
|
|
717
|
+
baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
baseAnimation.addAnimation(backdropAnimation);
|
|
723
|
+
}
|
|
724
|
+
return baseAnimation;
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
const createEnterAnimation = () => {
|
|
728
|
+
const backdropAnimation = createAnimation()
|
|
729
|
+
.fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
|
730
|
+
.beforeStyles({
|
|
731
|
+
'pointer-events': 'none',
|
|
732
|
+
})
|
|
733
|
+
.afterClearStyles(['pointer-events']);
|
|
734
|
+
const wrapperAnimation = createAnimation().keyframes([
|
|
735
|
+
{ offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
|
|
736
|
+
{ offset: 1, opacity: 1, transform: `translateY(0px)` },
|
|
737
|
+
]);
|
|
738
|
+
return { backdropAnimation, wrapperAnimation };
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Md Modal Enter Animation
|
|
742
|
+
*/
|
|
743
|
+
const mdEnterAnimation = (baseEl, opts) => {
|
|
744
|
+
const { currentBreakpoint } = opts;
|
|
745
|
+
const root = getElementRoot(baseEl);
|
|
746
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation();
|
|
747
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
748
|
+
wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
|
|
749
|
+
return createAnimation()
|
|
750
|
+
.addElement(baseEl)
|
|
751
|
+
.easing('cubic-bezier(0.36,0.66,0.04,1)')
|
|
752
|
+
.duration(280)
|
|
753
|
+
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
const createLeaveAnimation = () => {
|
|
757
|
+
const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
|
758
|
+
const wrapperAnimation = createAnimation().keyframes([
|
|
759
|
+
{ offset: 0, opacity: 0.99, transform: `translateY(0px)` },
|
|
760
|
+
{ offset: 1, opacity: 0, transform: 'translateY(40px)' },
|
|
761
|
+
]);
|
|
762
|
+
return { backdropAnimation, wrapperAnimation };
|
|
763
|
+
};
|
|
764
|
+
/**
|
|
765
|
+
* Md Modal Leave Animation
|
|
766
|
+
*/
|
|
767
|
+
const mdLeaveAnimation = (baseEl, opts) => {
|
|
768
|
+
const { currentBreakpoint } = opts;
|
|
769
|
+
const root = getElementRoot(baseEl);
|
|
770
|
+
const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();
|
|
771
|
+
backdropAnimation.addElement(root.querySelector('ion-backdrop'));
|
|
772
|
+
wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
|
|
773
|
+
return createAnimation()
|
|
774
|
+
.easing('cubic-bezier(0.47,0,0.745,0.715)')
|
|
775
|
+
.duration(200)
|
|
776
|
+
.addAnimation([backdropAnimation, wrapperAnimation]);
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
|
|
780
|
+
// Defaults for the sheet swipe animation
|
|
781
|
+
const defaultBackdrop = [
|
|
782
|
+
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
783
|
+
{ offset: 1, opacity: 0.01 },
|
|
784
|
+
];
|
|
785
|
+
const customBackdrop = [
|
|
786
|
+
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
787
|
+
{ offset: 1 - backdropBreakpoint, opacity: 0 },
|
|
788
|
+
{ offset: 1, opacity: 0 },
|
|
789
|
+
];
|
|
790
|
+
const SheetDefaults = {
|
|
791
|
+
WRAPPER_KEYFRAMES: [
|
|
792
|
+
{ offset: 0, transform: 'translateY(0%)' },
|
|
793
|
+
{ offset: 1, transform: 'translateY(100%)' },
|
|
794
|
+
],
|
|
795
|
+
BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
|
|
796
|
+
};
|
|
797
|
+
const contentEl = baseEl.querySelector('ion-content');
|
|
798
|
+
const height = wrapperEl.clientHeight;
|
|
799
|
+
let currentBreakpoint = initialBreakpoint;
|
|
800
|
+
let offset = 0;
|
|
801
|
+
let canDismissBlocksGesture = false;
|
|
802
|
+
const canDismissMaxStep = 0.95;
|
|
803
|
+
const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
|
|
804
|
+
const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
|
|
805
|
+
const maxBreakpoint = breakpoints[breakpoints.length - 1];
|
|
806
|
+
const minBreakpoint = breakpoints[0];
|
|
807
|
+
const enableBackdrop = () => {
|
|
808
|
+
baseEl.style.setProperty('pointer-events', 'auto');
|
|
809
|
+
backdropEl.style.setProperty('pointer-events', 'auto');
|
|
810
|
+
/**
|
|
811
|
+
* When the backdrop is enabled, elements such
|
|
812
|
+
* as inputs should not be focusable outside
|
|
813
|
+
* the sheet.
|
|
814
|
+
*/
|
|
815
|
+
baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS);
|
|
816
|
+
};
|
|
817
|
+
const disableBackdrop = () => {
|
|
818
|
+
baseEl.style.setProperty('pointer-events', 'none');
|
|
819
|
+
backdropEl.style.setProperty('pointer-events', 'none');
|
|
820
|
+
/**
|
|
821
|
+
* When the backdrop is enabled, elements such
|
|
822
|
+
* as inputs should not be focusable outside
|
|
823
|
+
* the sheet.
|
|
824
|
+
* Adding this class disables focus trapping
|
|
825
|
+
* for the sheet temporarily.
|
|
826
|
+
*/
|
|
827
|
+
baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* After the entering animation completes,
|
|
831
|
+
* we need to set the animation to go from
|
|
832
|
+
* offset 0 to offset 1 so that users can
|
|
833
|
+
* swipe in any direction. We then set the
|
|
834
|
+
* animation offset to the current breakpoint
|
|
835
|
+
* so there is no flickering.
|
|
836
|
+
*/
|
|
837
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
838
|
+
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
839
|
+
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
840
|
+
animation.progressStart(true, 1 - currentBreakpoint);
|
|
841
|
+
/**
|
|
842
|
+
* If backdrop is not enabled, then content
|
|
843
|
+
* behind modal should be clickable. To do this, we need
|
|
844
|
+
* to remove pointer-events from ion-modal as a whole.
|
|
845
|
+
* ion-backdrop and .modal-wrapper always have pointer-events: auto
|
|
846
|
+
* applied, so the modal content can still be interacted with.
|
|
847
|
+
*/
|
|
848
|
+
const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
|
|
849
|
+
if (shouldEnableBackdrop) {
|
|
850
|
+
enableBackdrop();
|
|
851
|
+
}
|
|
852
|
+
else {
|
|
853
|
+
disableBackdrop();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (contentEl && currentBreakpoint !== maxBreakpoint) {
|
|
857
|
+
contentEl.scrollY = false;
|
|
858
|
+
}
|
|
859
|
+
const canStart = (detail) => {
|
|
860
|
+
/**
|
|
861
|
+
* If we are swiping on the content, swiping should only be possible if the content
|
|
862
|
+
* is scrolled all the way to the top so that we do not interfere with scrolling.
|
|
863
|
+
*
|
|
864
|
+
* We cannot assume that the `ion-content` target will remain consistent between swipes.
|
|
865
|
+
* For example, when using ion-nav within a modal it is possible to swipe, push a view,
|
|
866
|
+
* and then swipe again. The target content will not be the same between swipes.
|
|
867
|
+
*/
|
|
868
|
+
const contentEl = findClosestIonContent(detail.event.target);
|
|
869
|
+
currentBreakpoint = getCurrentBreakpoint();
|
|
870
|
+
if (currentBreakpoint === 1 && contentEl) {
|
|
871
|
+
/**
|
|
872
|
+
* The modal should never swipe to close on the content with a refresher.
|
|
873
|
+
* Note 1: We cannot solve this by making this gesture have a higher priority than
|
|
874
|
+
* the refresher gesture as the iOS native refresh gesture uses a scroll listener in
|
|
875
|
+
* addition to a gesture.
|
|
876
|
+
*
|
|
877
|
+
* Note 2: Do not use getScrollElement here because we need this to be a synchronous
|
|
878
|
+
* operation, and getScrollElement is asynchronous.
|
|
879
|
+
*/
|
|
880
|
+
const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
|
|
881
|
+
const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
|
|
882
|
+
return !hasRefresherInContent && scrollEl.scrollTop === 0;
|
|
883
|
+
}
|
|
884
|
+
return true;
|
|
885
|
+
};
|
|
886
|
+
const onStart = (detail) => {
|
|
887
|
+
/**
|
|
888
|
+
* If canDismiss is anything other than `true`
|
|
889
|
+
* then users should be able to swipe down
|
|
890
|
+
* until a threshold is hit. At that point,
|
|
891
|
+
* the card modal should not proceed any further.
|
|
892
|
+
*
|
|
893
|
+
* canDismiss is never fired via gesture if there is
|
|
894
|
+
* no 0 breakpoint. However, it can be fired if the user
|
|
895
|
+
* presses Esc or the hardware back button.
|
|
896
|
+
* TODO (FW-937)
|
|
897
|
+
* Remove undefined check
|
|
898
|
+
*/
|
|
899
|
+
canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
|
|
900
|
+
/**
|
|
901
|
+
* If we are pulling down, then it is possible we are pulling on the content.
|
|
902
|
+
* We do not want scrolling to happen at the same time as the gesture.
|
|
903
|
+
*/
|
|
904
|
+
if (detail.deltaY > 0 && contentEl) {
|
|
905
|
+
contentEl.scrollY = false;
|
|
906
|
+
}
|
|
907
|
+
raf(() => {
|
|
908
|
+
/**
|
|
909
|
+
* Dismisses the open keyboard when the sheet drag gesture is started.
|
|
910
|
+
* Sets the focus onto the modal element.
|
|
911
|
+
*/
|
|
912
|
+
baseEl.focus();
|
|
913
|
+
});
|
|
914
|
+
animation.progressStart(true, 1 - currentBreakpoint);
|
|
915
|
+
};
|
|
916
|
+
const onMove = (detail) => {
|
|
917
|
+
/**
|
|
918
|
+
* If we are pulling down, then it is possible we are pulling on the content.
|
|
919
|
+
* We do not want scrolling to happen at the same time as the gesture.
|
|
920
|
+
* This accounts for when the user scrolls down, scrolls all the way up, and then
|
|
921
|
+
* pulls down again such that the modal should start to move.
|
|
922
|
+
*/
|
|
923
|
+
if (detail.deltaY > 0 && contentEl) {
|
|
924
|
+
contentEl.scrollY = false;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Given the change in gesture position on the Y axis,
|
|
928
|
+
* compute where the offset of the animation should be
|
|
929
|
+
* relative to where the user dragged.
|
|
930
|
+
*/
|
|
931
|
+
const initialStep = 1 - currentBreakpoint;
|
|
932
|
+
const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
|
|
933
|
+
const step = initialStep + detail.deltaY / height;
|
|
934
|
+
const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture;
|
|
935
|
+
/**
|
|
936
|
+
* If we are blocking the gesture from dismissing,
|
|
937
|
+
* set the max step value so that the sheet cannot be
|
|
938
|
+
* completely hidden.
|
|
939
|
+
*/
|
|
940
|
+
const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
|
|
941
|
+
/**
|
|
942
|
+
* If we are blocking the gesture from
|
|
943
|
+
* dismissing, calculate the spring modifier value
|
|
944
|
+
* this will be added to the starting breakpoint
|
|
945
|
+
* value to give the gesture a spring-like feeling.
|
|
946
|
+
* Note that when isAttemptingDismissWithCanDismiss is true,
|
|
947
|
+
* the modifier is always added to the breakpoint that
|
|
948
|
+
* appears right after the 0 breakpoint.
|
|
949
|
+
*
|
|
950
|
+
* Note that this modifier is essentially the progression
|
|
951
|
+
* between secondToLastBreakpoint and maxStep which is
|
|
952
|
+
* why we subtract secondToLastBreakpoint. This lets us get
|
|
953
|
+
* the result as a value from 0 to 1.
|
|
954
|
+
*/
|
|
955
|
+
const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined
|
|
956
|
+
? secondToLastBreakpoint +
|
|
957
|
+
calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint))
|
|
958
|
+
: step;
|
|
959
|
+
offset = clamp(0.0001, processedStep, maxStep);
|
|
960
|
+
animation.progressStep(offset);
|
|
961
|
+
};
|
|
962
|
+
const onEnd = (detail) => {
|
|
963
|
+
/**
|
|
964
|
+
* When the gesture releases, we need to determine
|
|
965
|
+
* the closest breakpoint to snap to.
|
|
966
|
+
*/
|
|
967
|
+
const velocity = detail.velocityY;
|
|
968
|
+
const threshold = (detail.deltaY + velocity * 350) / height;
|
|
969
|
+
const diff = currentBreakpoint - threshold;
|
|
970
|
+
const closest = breakpoints.reduce((a, b) => {
|
|
971
|
+
return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
|
|
972
|
+
});
|
|
973
|
+
moveSheetToBreakpoint({
|
|
974
|
+
breakpoint: closest,
|
|
975
|
+
breakpointOffset: offset,
|
|
976
|
+
canDismiss: canDismissBlocksGesture,
|
|
977
|
+
/**
|
|
978
|
+
* The swipe is user-driven, so we should
|
|
979
|
+
* always animate when the gesture ends.
|
|
980
|
+
*/
|
|
981
|
+
animated: true,
|
|
982
|
+
});
|
|
983
|
+
};
|
|
984
|
+
const moveSheetToBreakpoint = (options) => {
|
|
985
|
+
const { breakpoint, canDismiss, breakpointOffset, animated } = options;
|
|
986
|
+
/**
|
|
987
|
+
* canDismiss should only prevent snapping
|
|
988
|
+
* when users are trying to dismiss. If canDismiss
|
|
989
|
+
* is present but the user is trying to swipe upwards,
|
|
990
|
+
* we should allow that to happen,
|
|
991
|
+
*/
|
|
992
|
+
const shouldPreventDismiss = canDismiss && breakpoint === 0;
|
|
993
|
+
const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
|
|
994
|
+
const shouldRemainOpen = snapToBreakpoint !== 0;
|
|
995
|
+
currentBreakpoint = 0;
|
|
996
|
+
/**
|
|
997
|
+
* Update the animation so that it plays from
|
|
998
|
+
* the last offset to the closest snap point.
|
|
999
|
+
*/
|
|
1000
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
1001
|
+
wrapperAnimation.keyframes([
|
|
1002
|
+
{ offset: 0, transform: `translateY(${breakpointOffset * 100}%)` },
|
|
1003
|
+
{ offset: 1, transform: `translateY(${(1 - snapToBreakpoint) * 100}%)` },
|
|
1004
|
+
]);
|
|
1005
|
+
backdropAnimation.keyframes([
|
|
1006
|
+
{
|
|
1007
|
+
offset: 0,
|
|
1008
|
+
opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
offset: 1,
|
|
1012
|
+
opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
|
|
1013
|
+
},
|
|
1014
|
+
]);
|
|
1015
|
+
animation.progressStep(0);
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Gesture should remain disabled until the
|
|
1019
|
+
* snapping animation completes.
|
|
1020
|
+
*/
|
|
1021
|
+
gesture.enable(false);
|
|
1022
|
+
if (shouldPreventDismiss) {
|
|
1023
|
+
handleCanDismiss(baseEl, animation);
|
|
1024
|
+
}
|
|
1025
|
+
else if (!shouldRemainOpen) {
|
|
1026
|
+
onDismiss();
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* If the sheet is going to be fully expanded then we should enable
|
|
1030
|
+
* scrolling immediately. The sheet modal animation takes ~500ms to finish
|
|
1031
|
+
* so if we wait until then there is a visible delay for when scrolling is
|
|
1032
|
+
* re-enabled. Native iOS allows for scrolling on the sheet modal as soon
|
|
1033
|
+
* as the gesture is released, so we align with that.
|
|
1034
|
+
*/
|
|
1035
|
+
if (contentEl && snapToBreakpoint === breakpoints[breakpoints.length - 1]) {
|
|
1036
|
+
contentEl.scrollY = true;
|
|
1037
|
+
}
|
|
1038
|
+
return new Promise((resolve) => {
|
|
1039
|
+
animation
|
|
1040
|
+
.onFinish(() => {
|
|
1041
|
+
if (shouldRemainOpen) {
|
|
1042
|
+
/**
|
|
1043
|
+
* Once the snapping animation completes,
|
|
1044
|
+
* we need to reset the animation to go
|
|
1045
|
+
* from 0 to 1 so users can swipe in any direction.
|
|
1046
|
+
* We then set the animation offset to the current
|
|
1047
|
+
* breakpoint so that it starts at the snapped position.
|
|
1048
|
+
*/
|
|
1049
|
+
if (wrapperAnimation && backdropAnimation) {
|
|
1050
|
+
raf(() => {
|
|
1051
|
+
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
1052
|
+
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
1053
|
+
animation.progressStart(true, 1 - snapToBreakpoint);
|
|
1054
|
+
currentBreakpoint = snapToBreakpoint;
|
|
1055
|
+
onBreakpointChange(currentBreakpoint);
|
|
1056
|
+
/**
|
|
1057
|
+
* Backdrop should become enabled
|
|
1058
|
+
* after the backdropBreakpoint value
|
|
1059
|
+
*/
|
|
1060
|
+
const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint;
|
|
1061
|
+
if (shouldEnableBackdrop) {
|
|
1062
|
+
enableBackdrop();
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
disableBackdrop();
|
|
1066
|
+
}
|
|
1067
|
+
gesture.enable(true);
|
|
1068
|
+
resolve();
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
gesture.enable(true);
|
|
1073
|
+
resolve();
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
resolve();
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* This must be a one time callback
|
|
1081
|
+
* otherwise a new callback will
|
|
1082
|
+
* be added every time onEnd runs.
|
|
1083
|
+
*/
|
|
1084
|
+
}, { oneTimeCallback: true })
|
|
1085
|
+
.progressEnd(1, 0, animated ? 500 : 0);
|
|
1086
|
+
});
|
|
1087
|
+
};
|
|
1088
|
+
const gesture = createGesture({
|
|
1089
|
+
el: wrapperEl,
|
|
1090
|
+
gestureName: 'modalSheet',
|
|
1091
|
+
gesturePriority: 40,
|
|
1092
|
+
direction: 'y',
|
|
1093
|
+
threshold: 10,
|
|
1094
|
+
canStart,
|
|
1095
|
+
onStart,
|
|
1096
|
+
onMove,
|
|
1097
|
+
onEnd,
|
|
1098
|
+
});
|
|
1099
|
+
return {
|
|
1100
|
+
gesture,
|
|
1101
|
+
moveSheetToBreakpoint,
|
|
1102
|
+
};
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
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:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);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);-webkit-box-shadow:var(--box-shadow);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;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}: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{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;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);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}";
|
|
1106
|
+
const IonModalIosStyle0 = modalIosCss;
|
|
1107
|
+
|
|
1108
|
+
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:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);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);-webkit-box-shadow:var(--box-shadow);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;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}: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{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}";
|
|
1109
|
+
const IonModalMdStyle0 = modalMdCss;
|
|
1110
|
+
|
|
1111
|
+
const Modal = /*@__PURE__*/ proxyCustomElement(class Modal extends HTMLElement {
|
|
1112
|
+
constructor() {
|
|
1113
|
+
super();
|
|
1114
|
+
this.__registerHost();
|
|
1115
|
+
this.__attachShadow();
|
|
1116
|
+
this.didPresent = createEvent(this, "ionModalDidPresent", 7);
|
|
1117
|
+
this.willPresent = createEvent(this, "ionModalWillPresent", 7);
|
|
1118
|
+
this.willDismiss = createEvent(this, "ionModalWillDismiss", 7);
|
|
1119
|
+
this.didDismiss = createEvent(this, "ionModalDidDismiss", 7);
|
|
1120
|
+
this.ionBreakpointDidChange = createEvent(this, "ionBreakpointDidChange", 7);
|
|
1121
|
+
this.didPresentShorthand = createEvent(this, "didPresent", 7);
|
|
1122
|
+
this.willPresentShorthand = createEvent(this, "willPresent", 7);
|
|
1123
|
+
this.willDismissShorthand = createEvent(this, "willDismiss", 7);
|
|
1124
|
+
this.didDismissShorthand = createEvent(this, "didDismiss", 7);
|
|
1125
|
+
this.ionMount = createEvent(this, "ionMount", 7);
|
|
1126
|
+
this.lockController = createLockController();
|
|
1127
|
+
this.triggerController = createTriggerController();
|
|
1128
|
+
this.coreDelegate = CoreDelegate();
|
|
1129
|
+
this.isSheetModal = false;
|
|
1130
|
+
this.inheritedAttributes = {};
|
|
1131
|
+
this.inline = false;
|
|
1132
|
+
// Whether or not modal is being dismissed via gesture
|
|
1133
|
+
this.gestureAnimationDismissing = false;
|
|
1134
|
+
this.onHandleClick = () => {
|
|
1135
|
+
const { sheetTransition, handleBehavior } = this;
|
|
1136
|
+
if (handleBehavior !== 'cycle' || sheetTransition !== undefined) {
|
|
1137
|
+
/**
|
|
1138
|
+
* The sheet modal should not advance to the next breakpoint
|
|
1139
|
+
* if the handle behavior is not `cycle` or if the handle
|
|
1140
|
+
* is clicked while the sheet is moving to a breakpoint.
|
|
1141
|
+
*/
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
this.moveToNextBreakpoint();
|
|
1145
|
+
};
|
|
1146
|
+
this.onBackdropTap = () => {
|
|
1147
|
+
const { sheetTransition } = this;
|
|
1148
|
+
if (sheetTransition !== undefined) {
|
|
1149
|
+
/**
|
|
1150
|
+
* When the handle is double clicked at the largest breakpoint,
|
|
1151
|
+
* it will start to move to the first breakpoint. While transitioning,
|
|
1152
|
+
* the backdrop will often receive the second click. We prevent the
|
|
1153
|
+
* backdrop from dismissing the modal while moving between breakpoints.
|
|
1154
|
+
*/
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
this.dismiss(undefined, BACKDROP);
|
|
1158
|
+
};
|
|
1159
|
+
this.onLifecycle = (modalEvent) => {
|
|
1160
|
+
const el = this.usersElement;
|
|
1161
|
+
const name = LIFECYCLE_MAP[modalEvent.type];
|
|
1162
|
+
if (el && name) {
|
|
1163
|
+
const ev = new CustomEvent(name, {
|
|
1164
|
+
bubbles: false,
|
|
1165
|
+
cancelable: false,
|
|
1166
|
+
detail: modalEvent.detail,
|
|
1167
|
+
});
|
|
1168
|
+
el.dispatchEvent(ev);
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
this.presented = false;
|
|
1172
|
+
this.hasController = false;
|
|
1173
|
+
this.overlayIndex = undefined;
|
|
1174
|
+
this.delegate = undefined;
|
|
1175
|
+
this.keyboardClose = true;
|
|
1176
|
+
this.enterAnimation = undefined;
|
|
1177
|
+
this.leaveAnimation = undefined;
|
|
1178
|
+
this.breakpoints = undefined;
|
|
1179
|
+
this.initialBreakpoint = undefined;
|
|
1180
|
+
this.backdropBreakpoint = 0;
|
|
1181
|
+
this.handle = undefined;
|
|
1182
|
+
this.handleBehavior = 'none';
|
|
1183
|
+
this.component = undefined;
|
|
1184
|
+
this.componentProps = undefined;
|
|
1185
|
+
this.cssClass = undefined;
|
|
1186
|
+
this.backdropDismiss = true;
|
|
1187
|
+
this.showBackdrop = true;
|
|
1188
|
+
this.animated = true;
|
|
1189
|
+
this.presentingElement = undefined;
|
|
1190
|
+
this.htmlAttributes = undefined;
|
|
1191
|
+
this.isOpen = false;
|
|
1192
|
+
this.trigger = undefined;
|
|
1193
|
+
this.keepContentsMounted = false;
|
|
1194
|
+
this.focusTrap = true;
|
|
1195
|
+
this.canDismiss = true;
|
|
1196
|
+
}
|
|
1197
|
+
onIsOpenChange(newValue, oldValue) {
|
|
1198
|
+
if (newValue === true && oldValue === false) {
|
|
1199
|
+
this.present();
|
|
1200
|
+
}
|
|
1201
|
+
else if (newValue === false && oldValue === true) {
|
|
1202
|
+
this.dismiss();
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
triggerChanged() {
|
|
1206
|
+
const { trigger, el, triggerController } = this;
|
|
1207
|
+
if (trigger) {
|
|
1208
|
+
triggerController.addClickListener(el, trigger);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
breakpointsChanged(breakpoints) {
|
|
1212
|
+
if (breakpoints !== undefined) {
|
|
1213
|
+
this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
connectedCallback() {
|
|
1217
|
+
const { el } = this;
|
|
1218
|
+
prepareOverlay(el);
|
|
1219
|
+
this.triggerChanged();
|
|
1220
|
+
}
|
|
1221
|
+
disconnectedCallback() {
|
|
1222
|
+
this.triggerController.removeClickListener();
|
|
1223
|
+
}
|
|
1224
|
+
componentWillLoad() {
|
|
1225
|
+
var _a;
|
|
1226
|
+
const { breakpoints, initialBreakpoint, el, htmlAttributes } = this;
|
|
1227
|
+
const isSheetModal = (this.isSheetModal = breakpoints !== undefined && initialBreakpoint !== undefined);
|
|
1228
|
+
const attributesToInherit = ['aria-label', 'role'];
|
|
1229
|
+
this.inheritedAttributes = inheritAttributes(el, attributesToInherit);
|
|
1230
|
+
/**
|
|
1231
|
+
* When using a controller modal you can set attributes
|
|
1232
|
+
* using the htmlAttributes property. Since the above attributes
|
|
1233
|
+
* need to be inherited inside of the modal, we need to look
|
|
1234
|
+
* and see if these attributes are being set via htmlAttributes.
|
|
1235
|
+
*
|
|
1236
|
+
* We could alternatively move this to componentDidLoad to simplify the work
|
|
1237
|
+
* here, but we'd then need to make inheritedAttributes a State variable,
|
|
1238
|
+
* thus causing another render to always happen after the first render.
|
|
1239
|
+
*/
|
|
1240
|
+
if (htmlAttributes !== undefined) {
|
|
1241
|
+
attributesToInherit.forEach((attribute) => {
|
|
1242
|
+
const attributeValue = htmlAttributes[attribute];
|
|
1243
|
+
if (attributeValue) {
|
|
1244
|
+
/**
|
|
1245
|
+
* If an attribute we need to inherit was
|
|
1246
|
+
* set using htmlAttributes then add it to
|
|
1247
|
+
* inheritedAttributes and remove it from htmlAttributes.
|
|
1248
|
+
* This ensures the attribute is inherited and not
|
|
1249
|
+
* set on the host.
|
|
1250
|
+
*
|
|
1251
|
+
* In this case, if an inherited attribute is set
|
|
1252
|
+
* on the host element and using htmlAttributes then
|
|
1253
|
+
* htmlAttributes wins, but that's not a pattern that we recommend.
|
|
1254
|
+
* The only time you'd need htmlAttributes is when using modalController.
|
|
1255
|
+
*/
|
|
1256
|
+
this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attribute]: htmlAttributes[attribute] });
|
|
1257
|
+
delete htmlAttributes[attribute];
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
if (isSheetModal) {
|
|
1262
|
+
this.currentBreakpoint = this.initialBreakpoint;
|
|
1263
|
+
}
|
|
1264
|
+
if (breakpoints !== undefined && initialBreakpoint !== undefined && !breakpoints.includes(initialBreakpoint)) {
|
|
1265
|
+
printIonWarning('Your breakpoints array must include the initialBreakpoint value.');
|
|
1266
|
+
}
|
|
1267
|
+
if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
1268
|
+
setOverlayId(this.el);
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
componentDidLoad() {
|
|
1272
|
+
/**
|
|
1273
|
+
* If modal was rendered with isOpen="true"
|
|
1274
|
+
* then we should open modal immediately.
|
|
1275
|
+
*/
|
|
1276
|
+
if (this.isOpen === true) {
|
|
1277
|
+
raf(() => this.present());
|
|
1278
|
+
}
|
|
1279
|
+
this.breakpointsChanged(this.breakpoints);
|
|
1280
|
+
/**
|
|
1281
|
+
* When binding values in frameworks such as Angular
|
|
1282
|
+
* it is possible for the value to be set after the Web Component
|
|
1283
|
+
* initializes but before the value watcher is set up in Stencil.
|
|
1284
|
+
* As a result, the watcher callback may not be fired.
|
|
1285
|
+
* We work around this by manually calling the watcher
|
|
1286
|
+
* callback when the component has loaded and the watcher
|
|
1287
|
+
* is configured.
|
|
1288
|
+
*/
|
|
1289
|
+
this.triggerChanged();
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Determines whether or not an overlay
|
|
1293
|
+
* is being used inline or via a controller/JS
|
|
1294
|
+
* and returns the correct delegate.
|
|
1295
|
+
* By default, subsequent calls to getDelegate
|
|
1296
|
+
* will use a cached version of the delegate.
|
|
1297
|
+
* This is useful for calling dismiss after
|
|
1298
|
+
* present so that the correct delegate is given.
|
|
1299
|
+
*/
|
|
1300
|
+
getDelegate(force = false) {
|
|
1301
|
+
if (this.workingDelegate && !force) {
|
|
1302
|
+
return {
|
|
1303
|
+
delegate: this.workingDelegate,
|
|
1304
|
+
inline: this.inline,
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* If using overlay inline
|
|
1309
|
+
* we potentially need to use the coreDelegate
|
|
1310
|
+
* so that this works in vanilla JS apps.
|
|
1311
|
+
* If a developer has presented this component
|
|
1312
|
+
* via a controller, then we can assume
|
|
1313
|
+
* the component is already in the
|
|
1314
|
+
* correct place.
|
|
1315
|
+
*/
|
|
1316
|
+
const parentEl = this.el.parentNode;
|
|
1317
|
+
const inline = (this.inline = parentEl !== null && !this.hasController);
|
|
1318
|
+
const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
|
|
1319
|
+
return { inline, delegate };
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Determines whether or not the
|
|
1323
|
+
* modal is allowed to dismiss based
|
|
1324
|
+
* on the state of the canDismiss prop.
|
|
1325
|
+
*/
|
|
1326
|
+
async checkCanDismiss(data, role) {
|
|
1327
|
+
const { canDismiss } = this;
|
|
1328
|
+
if (typeof canDismiss === 'function') {
|
|
1329
|
+
return canDismiss(data, role);
|
|
1330
|
+
}
|
|
1331
|
+
return canDismiss;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Present the modal overlay after it has been created.
|
|
1335
|
+
*/
|
|
1336
|
+
async present() {
|
|
1337
|
+
const unlock = await this.lockController.lock();
|
|
1338
|
+
if (this.presented) {
|
|
1339
|
+
unlock();
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
const { presentingElement, el } = this;
|
|
1343
|
+
/**
|
|
1344
|
+
* If the modal is presented multiple times (inline modals), we
|
|
1345
|
+
* need to reset the current breakpoint to the initial breakpoint.
|
|
1346
|
+
*/
|
|
1347
|
+
this.currentBreakpoint = this.initialBreakpoint;
|
|
1348
|
+
const { inline, delegate } = this.getDelegate(true);
|
|
1349
|
+
/**
|
|
1350
|
+
* Emit ionMount so JS Frameworks have an opportunity
|
|
1351
|
+
* to add the child component to the DOM. The child
|
|
1352
|
+
* component will be assigned to this.usersElement below.
|
|
1353
|
+
*/
|
|
1354
|
+
this.ionMount.emit();
|
|
1355
|
+
this.usersElement = await attachComponent(delegate, el, this.component, ['ion-page'], this.componentProps, inline);
|
|
1356
|
+
/**
|
|
1357
|
+
* When using the lazy loaded build of Stencil, we need to wait
|
|
1358
|
+
* for every Stencil component instance to be ready before presenting
|
|
1359
|
+
* otherwise there can be a flash of unstyled content. With the
|
|
1360
|
+
* custom elements bundle we need to wait for the JS framework
|
|
1361
|
+
* mount the inner contents of the overlay otherwise WebKit may
|
|
1362
|
+
* get the transition incorrect.
|
|
1363
|
+
*/
|
|
1364
|
+
if (hasLazyBuild(el)) {
|
|
1365
|
+
await deepReady(this.usersElement);
|
|
1366
|
+
/**
|
|
1367
|
+
* If keepContentsMounted="true" then the
|
|
1368
|
+
* JS Framework has already mounted the inner
|
|
1369
|
+
* contents so there is no need to wait.
|
|
1370
|
+
* Otherwise, we need to wait for the JS
|
|
1371
|
+
* Framework to mount the inner contents
|
|
1372
|
+
* of this component.
|
|
1373
|
+
*/
|
|
1374
|
+
}
|
|
1375
|
+
else if (!this.keepContentsMounted) {
|
|
1376
|
+
await waitForMount();
|
|
1377
|
+
}
|
|
1378
|
+
writeTask(() => this.el.classList.add('show-modal'));
|
|
1379
|
+
const hasCardModal = presentingElement !== undefined;
|
|
1380
|
+
/**
|
|
1381
|
+
* We need to change the status bar at the
|
|
1382
|
+
* start of the animation so that it completes
|
|
1383
|
+
* by the time the card animation is done.
|
|
1384
|
+
*/
|
|
1385
|
+
if (hasCardModal && getIonMode(this) === 'ios') {
|
|
1386
|
+
// Cache the original status bar color before the modal is presented
|
|
1387
|
+
this.statusBarStyle = await StatusBar.getStyle();
|
|
1388
|
+
setCardStatusBarDark();
|
|
1389
|
+
}
|
|
1390
|
+
await present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
|
|
1391
|
+
presentingEl: presentingElement,
|
|
1392
|
+
currentBreakpoint: this.initialBreakpoint,
|
|
1393
|
+
backdropBreakpoint: this.backdropBreakpoint,
|
|
1394
|
+
});
|
|
1395
|
+
/* tslint:disable-next-line */
|
|
1396
|
+
if (typeof window !== 'undefined') {
|
|
1397
|
+
/**
|
|
1398
|
+
* This needs to be setup before any
|
|
1399
|
+
* non-transition async work so it can be dereferenced
|
|
1400
|
+
* in the dismiss method. The dismiss method
|
|
1401
|
+
* only waits for the entering transition
|
|
1402
|
+
* to finish. It does not wait for all of the `present`
|
|
1403
|
+
* method to resolve.
|
|
1404
|
+
*/
|
|
1405
|
+
this.keyboardOpenCallback = () => {
|
|
1406
|
+
if (this.gesture) {
|
|
1407
|
+
/**
|
|
1408
|
+
* When the native keyboard is opened and the webview
|
|
1409
|
+
* is resized, the gesture implementation will become unresponsive
|
|
1410
|
+
* and enter a free-scroll mode.
|
|
1411
|
+
*
|
|
1412
|
+
* When the keyboard is opened, we disable the gesture for
|
|
1413
|
+
* a single frame and re-enable once the contents have repositioned
|
|
1414
|
+
* from the keyboard placement.
|
|
1415
|
+
*/
|
|
1416
|
+
this.gesture.enable(false);
|
|
1417
|
+
raf(() => {
|
|
1418
|
+
if (this.gesture) {
|
|
1419
|
+
this.gesture.enable(true);
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
};
|
|
1424
|
+
window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
|
|
1425
|
+
}
|
|
1426
|
+
if (this.isSheetModal) {
|
|
1427
|
+
this.initSheetGesture();
|
|
1428
|
+
}
|
|
1429
|
+
else if (hasCardModal) {
|
|
1430
|
+
this.initSwipeToClose();
|
|
1431
|
+
}
|
|
1432
|
+
unlock();
|
|
1433
|
+
}
|
|
1434
|
+
initSwipeToClose() {
|
|
1435
|
+
var _a;
|
|
1436
|
+
if (getIonMode(this) !== 'ios') {
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
const { el } = this;
|
|
1440
|
+
// All of the elements needed for the swipe gesture
|
|
1441
|
+
// should be in the DOM and referenced by now, except
|
|
1442
|
+
// for the presenting el
|
|
1443
|
+
const animationBuilder = this.leaveAnimation || config.get('modalLeave', iosLeaveAnimation);
|
|
1444
|
+
const ani = (this.animation = animationBuilder(el, { presentingEl: this.presentingElement }));
|
|
1445
|
+
const contentEl = findIonContent(el);
|
|
1446
|
+
if (!contentEl) {
|
|
1447
|
+
printIonContentErrorMsg(el);
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
const statusBarStyle = (_a = this.statusBarStyle) !== null && _a !== void 0 ? _a : Style.Default;
|
|
1451
|
+
this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
|
|
1452
|
+
/**
|
|
1453
|
+
* While the gesture animation is finishing
|
|
1454
|
+
* it is possible for a user to tap the backdrop.
|
|
1455
|
+
* This would result in the dismiss animation
|
|
1456
|
+
* being played again. Typically this is avoided
|
|
1457
|
+
* by setting `presented = false` on the overlay
|
|
1458
|
+
* component; however, we cannot do that here as
|
|
1459
|
+
* that would prevent the element from being
|
|
1460
|
+
* removed from the DOM.
|
|
1461
|
+
*/
|
|
1462
|
+
this.gestureAnimationDismissing = true;
|
|
1463
|
+
/**
|
|
1464
|
+
* Reset the status bar style as the dismiss animation
|
|
1465
|
+
* starts otherwise the status bar will be the wrong
|
|
1466
|
+
* color for the duration of the dismiss animation.
|
|
1467
|
+
* The dismiss method does this as well, but
|
|
1468
|
+
* in this case it's only called once the animation
|
|
1469
|
+
* has finished.
|
|
1470
|
+
*/
|
|
1471
|
+
setCardStatusBarDefault(this.statusBarStyle);
|
|
1472
|
+
this.animation.onFinish(async () => {
|
|
1473
|
+
await this.dismiss(undefined, GESTURE);
|
|
1474
|
+
this.gestureAnimationDismissing = false;
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
this.gesture.enable(true);
|
|
1478
|
+
}
|
|
1479
|
+
initSheetGesture() {
|
|
1480
|
+
const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
|
|
1481
|
+
if (!wrapperEl || initialBreakpoint === undefined) {
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
const animationBuilder = this.enterAnimation || config.get('modalEnter', iosEnterAnimation);
|
|
1485
|
+
const ani = (this.animation = animationBuilder(this.el, {
|
|
1486
|
+
presentingEl: this.presentingElement,
|
|
1487
|
+
currentBreakpoint: initialBreakpoint,
|
|
1488
|
+
backdropBreakpoint,
|
|
1489
|
+
}));
|
|
1490
|
+
ani.progressStart(true, 1);
|
|
1491
|
+
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) => {
|
|
1492
|
+
if (this.currentBreakpoint !== breakpoint) {
|
|
1493
|
+
this.currentBreakpoint = breakpoint;
|
|
1494
|
+
this.ionBreakpointDidChange.emit({ breakpoint });
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
this.gesture = gesture;
|
|
1498
|
+
this.moveSheetToBreakpoint = moveSheetToBreakpoint;
|
|
1499
|
+
this.gesture.enable(true);
|
|
1500
|
+
}
|
|
1501
|
+
sheetOnDismiss() {
|
|
1502
|
+
/**
|
|
1503
|
+
* While the gesture animation is finishing
|
|
1504
|
+
* it is possible for a user to tap the backdrop.
|
|
1505
|
+
* This would result in the dismiss animation
|
|
1506
|
+
* being played again. Typically this is avoided
|
|
1507
|
+
* by setting `presented = false` on the overlay
|
|
1508
|
+
* component; however, we cannot do that here as
|
|
1509
|
+
* that would prevent the element from being
|
|
1510
|
+
* removed from the DOM.
|
|
1511
|
+
*/
|
|
1512
|
+
this.gestureAnimationDismissing = true;
|
|
1513
|
+
this.animation.onFinish(async () => {
|
|
1514
|
+
this.currentBreakpoint = 0;
|
|
1515
|
+
this.ionBreakpointDidChange.emit({ breakpoint: this.currentBreakpoint });
|
|
1516
|
+
await this.dismiss(undefined, GESTURE);
|
|
1517
|
+
this.gestureAnimationDismissing = false;
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
/**
|
|
1521
|
+
* Dismiss the modal overlay after it has been presented.
|
|
1522
|
+
*
|
|
1523
|
+
* @param data Any data to emit in the dismiss events.
|
|
1524
|
+
* @param role The role of the element that is dismissing the modal. For example, 'cancel' or 'backdrop'.
|
|
1525
|
+
*
|
|
1526
|
+
* This is a no-op if the overlay has not been presented yet. If you want
|
|
1527
|
+
* to remove an overlay from the DOM that was never presented, use the
|
|
1528
|
+
* [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
|
|
1529
|
+
*/
|
|
1530
|
+
async dismiss(data, role) {
|
|
1531
|
+
var _a;
|
|
1532
|
+
if (this.gestureAnimationDismissing && role !== GESTURE) {
|
|
1533
|
+
return false;
|
|
1534
|
+
}
|
|
1535
|
+
/**
|
|
1536
|
+
* Because the canDismiss check below is async,
|
|
1537
|
+
* we need to claim a lock before the check happens,
|
|
1538
|
+
* in case the dismiss transition does run.
|
|
1539
|
+
*/
|
|
1540
|
+
const unlock = await this.lockController.lock();
|
|
1541
|
+
/**
|
|
1542
|
+
* If a canDismiss handler is responsible
|
|
1543
|
+
* for calling the dismiss method, we should
|
|
1544
|
+
* not run the canDismiss check again.
|
|
1545
|
+
*/
|
|
1546
|
+
if (role !== 'handler' && !(await this.checkCanDismiss(data, role))) {
|
|
1547
|
+
unlock();
|
|
1548
|
+
return false;
|
|
1549
|
+
}
|
|
1550
|
+
const { presentingElement } = this;
|
|
1551
|
+
/**
|
|
1552
|
+
* We need to start the status bar change
|
|
1553
|
+
* before the animation so that the change
|
|
1554
|
+
* finishes when the dismiss animation does.
|
|
1555
|
+
*/
|
|
1556
|
+
const hasCardModal = presentingElement !== undefined;
|
|
1557
|
+
if (hasCardModal && getIonMode(this) === 'ios') {
|
|
1558
|
+
setCardStatusBarDefault(this.statusBarStyle);
|
|
1559
|
+
}
|
|
1560
|
+
/* tslint:disable-next-line */
|
|
1561
|
+
if (typeof window !== 'undefined' && this.keyboardOpenCallback) {
|
|
1562
|
+
window.removeEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
|
|
1563
|
+
this.keyboardOpenCallback = undefined;
|
|
1564
|
+
}
|
|
1565
|
+
const dismissed = await dismiss(this, data, role, 'modalLeave', iosLeaveAnimation, mdLeaveAnimation, {
|
|
1566
|
+
presentingEl: presentingElement,
|
|
1567
|
+
currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
|
|
1568
|
+
backdropBreakpoint: this.backdropBreakpoint,
|
|
1569
|
+
});
|
|
1570
|
+
if (dismissed) {
|
|
1571
|
+
const { delegate } = this.getDelegate();
|
|
1572
|
+
await detachComponent(delegate, this.usersElement);
|
|
1573
|
+
writeTask(() => this.el.classList.remove('show-modal'));
|
|
1574
|
+
if (this.animation) {
|
|
1575
|
+
this.animation.destroy();
|
|
1576
|
+
}
|
|
1577
|
+
if (this.gesture) {
|
|
1578
|
+
this.gesture.destroy();
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
this.currentBreakpoint = undefined;
|
|
1582
|
+
this.animation = undefined;
|
|
1583
|
+
unlock();
|
|
1584
|
+
return dismissed;
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns a promise that resolves when the modal did dismiss.
|
|
1588
|
+
*/
|
|
1589
|
+
onDidDismiss() {
|
|
1590
|
+
return eventMethod(this.el, 'ionModalDidDismiss');
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Returns a promise that resolves when the modal will dismiss.
|
|
1594
|
+
*/
|
|
1595
|
+
onWillDismiss() {
|
|
1596
|
+
return eventMethod(this.el, 'ionModalWillDismiss');
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Move a sheet style modal to a specific breakpoint. The breakpoint value must
|
|
1600
|
+
* be a value defined in your `breakpoints` array.
|
|
1601
|
+
*/
|
|
1602
|
+
async setCurrentBreakpoint(breakpoint) {
|
|
1603
|
+
if (!this.isSheetModal) {
|
|
1604
|
+
printIonWarning('setCurrentBreakpoint is only supported on sheet modals.');
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
if (!this.breakpoints.includes(breakpoint)) {
|
|
1608
|
+
printIonWarning(`Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.`);
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints, animated } = this;
|
|
1612
|
+
if (currentBreakpoint === breakpoint) {
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
if (moveSheetToBreakpoint) {
|
|
1616
|
+
this.sheetTransition = moveSheetToBreakpoint({
|
|
1617
|
+
breakpoint,
|
|
1618
|
+
breakpointOffset: 1 - currentBreakpoint,
|
|
1619
|
+
canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints[0] === 0,
|
|
1620
|
+
animated,
|
|
1621
|
+
});
|
|
1622
|
+
await this.sheetTransition;
|
|
1623
|
+
this.sheetTransition = undefined;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* Returns the current breakpoint of a sheet style modal
|
|
1628
|
+
*/
|
|
1629
|
+
async getCurrentBreakpoint() {
|
|
1630
|
+
return this.currentBreakpoint;
|
|
1631
|
+
}
|
|
1632
|
+
async moveToNextBreakpoint() {
|
|
1633
|
+
const { breakpoints, currentBreakpoint } = this;
|
|
1634
|
+
if (!breakpoints || currentBreakpoint == null) {
|
|
1635
|
+
/**
|
|
1636
|
+
* If the modal does not have breakpoints and/or the current
|
|
1637
|
+
* breakpoint is not set, we can't move to the next breakpoint.
|
|
1638
|
+
*/
|
|
1639
|
+
return false;
|
|
1640
|
+
}
|
|
1641
|
+
const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
|
|
1642
|
+
const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
|
|
1643
|
+
const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
|
|
1644
|
+
const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
|
|
1645
|
+
/**
|
|
1646
|
+
* Sets the current breakpoint to the next available breakpoint.
|
|
1647
|
+
* If the current breakpoint is the last breakpoint, we set the current
|
|
1648
|
+
* breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
|
|
1649
|
+
*/
|
|
1650
|
+
await this.setCurrentBreakpoint(nextBreakpoint);
|
|
1651
|
+
return true;
|
|
1652
|
+
}
|
|
1653
|
+
render() {
|
|
1654
|
+
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap } = this;
|
|
1655
|
+
const showHandle = handle !== false && isSheetModal;
|
|
1656
|
+
const mode = getIonMode(this);
|
|
1657
|
+
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
|
1658
|
+
const isHandleCycle = handleBehavior === 'cycle';
|
|
1659
|
+
return (h(Host, Object.assign({ key: 'b4da5111fe4719fa450c39b2d4bd884a302a7924', "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
|
|
1660
|
+
zIndex: `${20000 + this.overlayIndex}`,
|
|
1661
|
+
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle }), h("ion-backdrop", { key: 'c12dbf747e0eb914eaf1331798548ffc7e147763', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && h("div", { key: 'da546ee80c6576b5acc66e959fd5009e0b9a8160', class: "modal-shadow" }), h("div", Object.assign({ key: '306ebe6427440ad5f7ed36d590e562d15a503b75',
|
|
1662
|
+
/*
|
|
1663
|
+
role and aria-modal must be used on the
|
|
1664
|
+
same element. They must also be set inside the
|
|
1665
|
+
shadow DOM otherwise ion-button will not be highlighted
|
|
1666
|
+
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
1667
|
+
*/
|
|
1668
|
+
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: 'c5d17e346fe255a7c0cacbbf15c0083f2d09c488', class: "modal-handle",
|
|
1669
|
+
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
1670
|
+
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", { key: '5cc714170a00b67f3eda0cd1d6f37c1489a99c83' }))));
|
|
1671
|
+
}
|
|
1672
|
+
get el() { return this; }
|
|
1673
|
+
static get watchers() { return {
|
|
1674
|
+
"isOpen": ["onIsOpenChange"],
|
|
1675
|
+
"trigger": ["triggerChanged"]
|
|
1676
|
+
}; }
|
|
1677
|
+
static get style() { return {
|
|
1678
|
+
ios: IonModalIosStyle0,
|
|
1679
|
+
md: IonModalMdStyle0
|
|
1680
|
+
}; }
|
|
1681
|
+
}, [33, "ion-modal", {
|
|
1682
|
+
"hasController": [4, "has-controller"],
|
|
1683
|
+
"overlayIndex": [2, "overlay-index"],
|
|
1684
|
+
"delegate": [16],
|
|
1685
|
+
"keyboardClose": [4, "keyboard-close"],
|
|
1686
|
+
"enterAnimation": [16],
|
|
1687
|
+
"leaveAnimation": [16],
|
|
1688
|
+
"breakpoints": [16],
|
|
1689
|
+
"initialBreakpoint": [2, "initial-breakpoint"],
|
|
1690
|
+
"backdropBreakpoint": [2, "backdrop-breakpoint"],
|
|
1691
|
+
"handle": [4],
|
|
1692
|
+
"handleBehavior": [1, "handle-behavior"],
|
|
1693
|
+
"component": [1],
|
|
1694
|
+
"componentProps": [16],
|
|
1695
|
+
"cssClass": [1, "css-class"],
|
|
1696
|
+
"backdropDismiss": [4, "backdrop-dismiss"],
|
|
1697
|
+
"showBackdrop": [4, "show-backdrop"],
|
|
1698
|
+
"animated": [4],
|
|
1699
|
+
"presentingElement": [16],
|
|
1700
|
+
"htmlAttributes": [16],
|
|
1701
|
+
"isOpen": [4, "is-open"],
|
|
1702
|
+
"trigger": [1],
|
|
1703
|
+
"keepContentsMounted": [4, "keep-contents-mounted"],
|
|
1704
|
+
"focusTrap": [4, "focus-trap"],
|
|
1705
|
+
"canDismiss": [4, "can-dismiss"],
|
|
1706
|
+
"presented": [32],
|
|
1707
|
+
"present": [64],
|
|
1708
|
+
"dismiss": [64],
|
|
1709
|
+
"onDidDismiss": [64],
|
|
1710
|
+
"onWillDismiss": [64],
|
|
1711
|
+
"setCurrentBreakpoint": [64],
|
|
1712
|
+
"getCurrentBreakpoint": [64]
|
|
1713
|
+
}, undefined, {
|
|
1714
|
+
"isOpen": ["onIsOpenChange"],
|
|
1715
|
+
"trigger": ["triggerChanged"]
|
|
1716
|
+
}]);
|
|
1717
|
+
const LIFECYCLE_MAP = {
|
|
1718
|
+
ionModalDidPresent: 'ionViewDidEnter',
|
|
1719
|
+
ionModalWillPresent: 'ionViewWillEnter',
|
|
1720
|
+
ionModalWillDismiss: 'ionViewWillLeave',
|
|
1721
|
+
ionModalDidDismiss: 'ionViewDidLeave',
|
|
1722
|
+
};
|
|
1723
|
+
function defineCustomElement() {
|
|
1724
|
+
if (typeof customElements === "undefined") {
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
const components = ["ion-modal", "ion-backdrop"];
|
|
1728
|
+
components.forEach(tagName => { switch (tagName) {
|
|
1729
|
+
case "ion-modal":
|
|
1730
|
+
if (!customElements.get(tagName)) {
|
|
1731
|
+
customElements.define(tagName, Modal);
|
|
1732
|
+
}
|
|
1733
|
+
break;
|
|
1734
|
+
case "ion-backdrop":
|
|
1735
|
+
if (!customElements.get(tagName)) {
|
|
1736
|
+
defineCustomElement$1();
|
|
1737
|
+
}
|
|
1738
|
+
break;
|
|
1739
|
+
} });
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
export { Modal as M, defineCustomElement as d };
|