@ionic/core 8.7.17-dev.11771865171.14f4c2cf → 8.7.17-dev.11771959013.18adabe2

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.
Files changed (522) hide show
  1. package/components/action-sheet.js +1 -561
  2. package/components/alert.js +1 -610
  3. package/components/animation.js +1 -817
  4. package/components/backdrop.js +1 -72
  5. package/components/button-active.js +1 -64
  6. package/components/button.js +1 -303
  7. package/components/buttons.js +1 -56
  8. package/components/capacitor.js +1 -10
  9. package/components/checkbox.js +1 -261
  10. package/components/config.js +1 -192
  11. package/components/content.js +1 -475
  12. package/components/cubic-bezier.js +1 -87
  13. package/components/data.js +1 -1635
  14. package/components/dir.js +1 -15
  15. package/components/focus-visible.js +1 -72
  16. package/components/framework-delegate.js +1 -137
  17. package/components/gesture-controller.js +1 -192
  18. package/components/haptic.js +1 -155
  19. package/components/hardware-back-button.js +1 -112
  20. package/components/header.js +1 -417
  21. package/components/helpers.js +1 -336
  22. package/components/icon.js +1 -456
  23. package/components/index.d.ts +2 -0
  24. package/components/index.js +1 -115
  25. package/components/index2.js +1 -416
  26. package/components/index3.js +1 -452
  27. package/components/index4.js +1 -118
  28. package/components/index5.js +1 -303
  29. package/components/index6.js +1 -29
  30. package/components/index7.js +1 -164
  31. package/components/index8.js +1 -125
  32. package/components/index9.js +1 -4
  33. package/components/input-shims.js +1 -624
  34. package/components/input.utils.js +1 -144
  35. package/components/ion-accordion-group.js +1 -269
  36. package/components/ion-accordion.js +1 -457
  37. package/components/ion-action-sheet.js +1 -6
  38. package/components/ion-alert.js +1 -6
  39. package/components/ion-app.js +1 -128
  40. package/components/ion-avatar.js +1 -41
  41. package/components/ion-back-button.js +1 -131
  42. package/components/ion-backdrop.js +1 -6
  43. package/components/ion-badge.js +1 -47
  44. package/components/ion-breadcrumb.js +1 -137
  45. package/components/ion-breadcrumbs.js +1 -164
  46. package/components/ion-button.js +1 -6
  47. package/components/ion-buttons.js +1 -6
  48. package/components/ion-card-content.js +1 -45
  49. package/components/ion-card-header.js +1 -56
  50. package/components/ion-card-subtitle.js +1 -48
  51. package/components/ion-card-title.js +1 -48
  52. package/components/ion-card.js +1 -107
  53. package/components/ion-checkbox.js +1 -6
  54. package/components/ion-chip.js +1 -66
  55. package/components/ion-col.js +1 -163
  56. package/components/ion-content.js +1 -6
  57. package/components/ion-datetime-button.js +1 -384
  58. package/components/ion-datetime.js +1 -2046
  59. package/components/ion-fab-button.js +1 -151
  60. package/components/ion-fab-list.js +1 -66
  61. package/components/ion-fab.js +1 -101
  62. package/components/ion-footer.js +1 -159
  63. package/components/ion-grid.js +1 -46
  64. package/components/ion-header.js +1 -6
  65. package/components/ion-icon.js +1 -6
  66. package/components/ion-img.js +1 -124
  67. package/components/ion-infinite-scroll-content.js +1 -70
  68. package/components/ion-infinite-scroll.js +1 -236
  69. package/components/ion-input-otp.js +1 -683
  70. package/components/ion-input-password-toggle.js +1 -129
  71. package/components/ion-input.js +1 -617
  72. package/components/ion-item-divider.js +1 -59
  73. package/components/ion-item-group.js +1 -46
  74. package/components/ion-item-option.js +1 -91
  75. package/components/ion-item-options.js +1 -73
  76. package/components/ion-item-sliding.js +1 -458
  77. package/components/ion-item.js +1 -6
  78. package/components/ion-label.js +1 -6
  79. package/components/ion-list-header.js +1 -6
  80. package/components/ion-list.js +1 -6
  81. package/components/ion-loading.js +1 -344
  82. package/components/ion-menu-button.js +1 -110
  83. package/components/ion-menu-toggle.js +1 -64
  84. package/components/ion-menu.js +1 -745
  85. package/components/ion-modal.js +1 -6
  86. package/components/ion-nav-link.js +1 -64
  87. package/components/ion-nav.js +1 -956
  88. package/components/ion-note.js +1 -47
  89. package/components/ion-picker-column-option.js +1 -6
  90. package/components/ion-picker-column.js +1 -6
  91. package/components/ion-picker-legacy-column.js +1 -6
  92. package/components/ion-picker-legacy.js +1 -343
  93. package/components/ion-picker.js +1 -6
  94. package/components/ion-popover.js +1 -6
  95. package/components/ion-progress-bar.js +1 -101
  96. package/components/ion-radio-group.js +1 -6
  97. package/components/ion-radio.js +1 -6
  98. package/components/ion-range.js +1 -966
  99. package/components/ion-refresher-content.js +1 -89
  100. package/components/ion-refresher.js +1 -751
  101. package/components/ion-reorder-group.js +1 -322
  102. package/components/ion-reorder.js +1 -60
  103. package/components/ion-ripple-effect.js +1 -6
  104. package/components/ion-route-redirect.js +1 -45
  105. package/components/ion-route.js +1 -74
  106. package/components/ion-router-link.js +1 -61
  107. package/components/ion-router-outlet.js +1 -227
  108. package/components/ion-router.js +1 -841
  109. package/components/ion-row.js +1 -36
  110. package/components/ion-searchbar.js +1 -530
  111. package/components/ion-segment-button.js +1 -174
  112. package/components/ion-segment-content.js +1 -35
  113. package/components/ion-segment-view.js +1 -142
  114. package/components/ion-segment.js +1 -602
  115. package/components/ion-select-modal.js +1 -6
  116. package/components/ion-select-option.js +1 -46
  117. package/components/ion-select-popover.js +1 -6
  118. package/components/ion-select.js +1 -1037
  119. package/components/ion-skeleton-text.js +1 -65
  120. package/components/ion-spinner.js +1 -6
  121. package/components/ion-split-pane.js +1 -197
  122. package/components/ion-tab-bar.js +1 -115
  123. package/components/ion-tab-button.js +1 -128
  124. package/components/ion-tab.js +1 -91
  125. package/components/ion-tabs.js +1 -205
  126. package/components/ion-text.js +1 -42
  127. package/components/ion-textarea.js +1 -554
  128. package/components/ion-thumbnail.js +1 -36
  129. package/components/ion-title.js +1 -6
  130. package/components/ion-toast.js +1 -941
  131. package/components/ion-toggle.js +1 -361
  132. package/components/ion-toolbar.js +1 -6
  133. package/components/ionic-global.js +1 -144
  134. package/components/ios.transition.js +1 -672
  135. package/components/item.js +1 -302
  136. package/components/keyboard-controller.js +1 -162
  137. package/components/keyboard.js +1 -141
  138. package/components/keyboard2.js +1 -76
  139. package/components/label.js +1 -100
  140. package/components/list-header.js +1 -47
  141. package/components/list.js +1 -68
  142. package/components/lock-controller.js +1 -35
  143. package/components/md.transition.js +1 -51
  144. package/components/menu-toggle-util.js +1 -9
  145. package/components/modal.js +1 -2511
  146. package/components/notch-controller.js +1 -150
  147. package/components/overlays.js +1 -912
  148. package/components/picker-column-option.js +1 -136
  149. package/components/picker-column.js +1 -595
  150. package/components/picker-column2.js +1 -377
  151. package/components/picker.js +1 -498
  152. package/components/popover.js +1 -1502
  153. package/components/radio-group.js +1 -287
  154. package/components/radio.js +1 -229
  155. package/components/refresher.utils.js +1 -193
  156. package/components/ripple-effect.js +1 -109
  157. package/components/select-modal.js +1 -196
  158. package/components/select-popover.js +1 -189
  159. package/components/spinner.js +1 -224
  160. package/components/status-tap.js +1 -36
  161. package/components/swipe-back.js +1 -75
  162. package/components/theme.js +1 -40
  163. package/components/title.js +1 -70
  164. package/components/toolbar.js +1 -89
  165. package/components/validity.js +1 -14
  166. package/components/watch-options.js +1 -44
  167. package/dist/cjs/{animation-Bt3H9L1C.js → animation-Dg4yiuR2.js} +1 -1
  168. package/dist/cjs/app-globals-CLI8xCmk.js +11 -0
  169. package/dist/cjs/{button-active-CMc8cD90.js → button-active-FscMI17-.js} +1 -1
  170. package/dist/cjs/{config-C5fsO43a.js → config-BukYi_pW.js} +1 -1
  171. package/dist/cjs/{data-JwZKaIQB.js → data-BYlBjkMU.js} +1 -1
  172. package/dist/cjs/{framework-delegate-DMJRBuDi.js → framework-delegate-CRgp8o_p.js} +1 -1
  173. package/dist/cjs/{hardware-back-button-VCK4V3mG.js → hardware-back-button-C4rMJ5uI.js} +1 -1
  174. package/dist/cjs/{helpers-DrTqNghc.js → helpers-CxTYJdbT.js} +1 -1
  175. package/dist/cjs/{index-094mMFB-.js → index-C845Ti6K.js} +4 -4
  176. package/dist/cjs/{index-DrMUZJj6.js → index-CFUwM5x_.js} +5 -5
  177. package/dist/cjs/{index-D6Wc6v08.js → index-CqT-2gKy.js} +503 -382
  178. package/dist/cjs/{index-CO6eryBo.js → index-MbaBbWXk.js} +2 -2
  179. package/dist/cjs/{index-C534ULug.js → index-YcSftOMz.js} +2 -2
  180. package/dist/cjs/index.cjs.js +12 -12
  181. package/dist/cjs/{input-shims-CW0KUFTQ.js → input-shims-DlFhYYTs.js} +3 -3
  182. package/dist/cjs/{input.utils-B_QROI2g.js → input.utils-DmeJ8dmo.js} +2 -2
  183. package/dist/cjs/ion-accordion_2.cjs.entry.js +23 -15
  184. package/dist/cjs/ion-action-sheet.cjs.entry.js +21 -15
  185. package/dist/cjs/ion-alert.cjs.entry.js +25 -17
  186. package/dist/cjs/ion-app_8.cjs.entry.js +44 -40
  187. package/dist/cjs/ion-avatar_3.cjs.entry.js +12 -12
  188. package/dist/cjs/ion-back-button.cjs.entry.js +7 -7
  189. package/dist/cjs/ion-backdrop.cjs.entry.js +6 -6
  190. package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +20 -14
  191. package/dist/cjs/ion-button_2.cjs.entry.js +36 -18
  192. package/dist/cjs/ion-card_5.cjs.entry.js +23 -23
  193. package/dist/cjs/ion-checkbox.cjs.entry.js +7 -7
  194. package/dist/cjs/ion-chip.cjs.entry.js +6 -6
  195. package/dist/cjs/ion-col_3.cjs.entry.js +8 -8
  196. package/dist/cjs/ion-datetime-button.cjs.entry.js +8 -8
  197. package/dist/cjs/ion-datetime_3.cjs.entry.js +67 -39
  198. package/dist/cjs/ion-fab_3.cjs.entry.js +17 -13
  199. package/dist/cjs/ion-img.cjs.entry.js +8 -6
  200. package/dist/cjs/ion-infinite-scroll_2.cjs.entry.js +17 -13
  201. package/dist/cjs/ion-input-otp.cjs.entry.js +16 -10
  202. package/dist/cjs/ion-input-password-toggle.cjs.entry.js +9 -7
  203. package/dist/cjs/ion-input.cjs.entry.js +21 -13
  204. package/dist/cjs/ion-item-option_3.cjs.entry.js +17 -15
  205. package/dist/cjs/ion-item_8.cjs.entry.js +42 -36
  206. package/dist/cjs/ion-loading.cjs.entry.js +18 -14
  207. package/dist/cjs/ion-menu_3.cjs.entry.js +30 -22
  208. package/dist/cjs/ion-modal.cjs.entry.js +19 -15
  209. package/dist/cjs/ion-nav_2.cjs.entry.js +14 -10
  210. package/dist/cjs/ion-picker-column-option.cjs.entry.js +10 -8
  211. package/dist/cjs/ion-picker-column.cjs.entry.js +11 -7
  212. package/dist/cjs/ion-picker.cjs.entry.js +6 -6
  213. package/dist/cjs/ion-popover.cjs.entry.js +21 -15
  214. package/dist/cjs/ion-progress-bar.cjs.entry.js +7 -7
  215. package/dist/cjs/ion-radio_2.cjs.entry.js +17 -13
  216. package/dist/cjs/ion-range.cjs.entry.js +40 -24
  217. package/dist/cjs/ion-refresher_2.cjs.entry.js +45 -14
  218. package/dist/cjs/ion-reorder_2.cjs.entry.js +13 -11
  219. package/dist/cjs/ion-ripple-effect.cjs.entry.js +4 -4
  220. package/dist/cjs/ion-route_4.cjs.entry.js +20 -10
  221. package/dist/cjs/ion-searchbar.cjs.entry.js +22 -12
  222. package/dist/cjs/ion-segment-content.cjs.entry.js +3 -3
  223. package/dist/cjs/ion-segment-view.cjs.entry.js +13 -8
  224. package/dist/cjs/ion-segment_2.cjs.entry.js +26 -16
  225. package/dist/cjs/ion-select-modal.cjs.entry.js +12 -12
  226. package/dist/cjs/ion-select_3.cjs.entry.js +32 -24
  227. package/dist/cjs/ion-spinner.cjs.entry.js +4 -4
  228. package/dist/cjs/ion-split-pane.cjs.entry.js +15 -9
  229. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +14 -12
  230. package/dist/cjs/ion-tab_2.cjs.entry.js +10 -8
  231. package/dist/cjs/ion-text.cjs.entry.js +4 -4
  232. package/dist/cjs/ion-textarea.cjs.entry.js +20 -14
  233. package/dist/cjs/ion-toast.cjs.entry.js +21 -15
  234. package/dist/cjs/ion-toggle.cjs.entry.js +10 -8
  235. package/dist/cjs/{ionic-global-HMVqOFGO.js → ionic-global-Bc3kJi1Z.js} +1 -1
  236. package/dist/cjs/ionic.cjs.js +5 -5
  237. package/dist/cjs/{ios.transition-BOt_uW73.js → ios.transition-trBiC95R.js} +4 -4
  238. package/dist/cjs/loader.cjs.js +4 -4
  239. package/dist/cjs/{md.transition-Dt968VXB.js → md.transition-CUQECuvD.js} +4 -4
  240. package/dist/cjs/{notch-controller-Bzqhjm4f.js → notch-controller-sD-lTpdc.js} +1 -1
  241. package/dist/cjs/{overlays-B2b-TTbl.js → overlays-C2jiBSNQ.js} +5 -5
  242. package/dist/cjs/{status-tap-g0sWWkXk.js → status-tap-CCJk5VgT.js} +3 -3
  243. package/dist/cjs/{swipe-back-BIayeNOD.js → swipe-back-BGhTQ1CU.js} +2 -2
  244. package/dist/collection/collection-manifest.json +2 -2
  245. package/dist/collection/components/accordion-group/accordion-group.js +4 -2
  246. package/dist/collection/components/action-sheet/action-sheet.js +20 -10
  247. package/dist/collection/components/alert/alert.js +24 -12
  248. package/dist/collection/components/back-button/back-button.js +4 -2
  249. package/dist/collection/components/badge/badge.js +2 -1
  250. package/dist/collection/components/breadcrumb/breadcrumb.js +8 -4
  251. package/dist/collection/components/breadcrumbs/breadcrumbs.js +4 -2
  252. package/dist/collection/components/button/button.js +6 -3
  253. package/dist/collection/components/card/card.js +6 -3
  254. package/dist/collection/components/card-header/card-header.js +2 -1
  255. package/dist/collection/components/card-subtitle/card-subtitle.js +2 -1
  256. package/dist/collection/components/card-title/card-title.js +2 -1
  257. package/dist/collection/components/checkbox/checkbox.js +4 -2
  258. package/dist/collection/components/chip/chip.js +2 -1
  259. package/dist/collection/components/content/content.js +8 -4
  260. package/dist/collection/components/datetime/datetime.js +34 -15
  261. package/dist/collection/components/datetime-button/datetime-button.js +2 -1
  262. package/dist/collection/components/fab-button/fab-button.js +6 -3
  263. package/dist/collection/components/infinite-scroll-content/infinite-scroll-content.js +4 -2
  264. package/dist/collection/components/input/input.js +11 -6
  265. package/dist/collection/components/input-otp/input-otp.js +8 -4
  266. package/dist/collection/components/input-password-toggle/input-password-toggle.js +4 -2
  267. package/dist/collection/components/item/item.js +6 -3
  268. package/dist/collection/components/item-divider/item-divider.js +2 -1
  269. package/dist/collection/components/item-option/item-option.js +2 -1
  270. package/dist/collection/components/item-options/item-options.js +2 -1
  271. package/dist/collection/components/item-sliding/item-sliding.js +2 -1
  272. package/dist/collection/components/label/label.js +6 -3
  273. package/dist/collection/components/list-header/list-header.js +2 -1
  274. package/dist/collection/components/loading/loading.js +22 -11
  275. package/dist/collection/components/menu/menu.js +10 -5
  276. package/dist/collection/components/menu-button/menu-button.js +2 -1
  277. package/dist/collection/components/modal/modal.js +27 -14
  278. package/dist/collection/components/nav/nav.js +89 -45
  279. package/dist/collection/components/nav-link/nav-link.js +9 -5
  280. package/dist/collection/components/note/note.js +2 -1
  281. package/dist/collection/components/picker/picker.js +2 -1
  282. package/dist/collection/components/picker-column/picker-column.js +6 -3
  283. package/dist/collection/components/picker-column-option/picker-column-option.js +2 -1
  284. package/dist/collection/components/picker-legacy/picker.js +24 -12
  285. package/dist/collection/components/picker-legacy-column/picker-column.js +4 -2
  286. package/dist/collection/components/popover/popover.js +33 -17
  287. package/dist/collection/components/progress-bar/progress-bar.js +2 -1
  288. package/dist/collection/components/radio/radio.js +2 -1
  289. package/dist/collection/components/radio-group/radio-group.js +6 -3
  290. package/dist/collection/components/range/range.js +26 -17
  291. package/dist/collection/components/refresher/refresher.js +73 -5
  292. package/dist/collection/components/refresher-content/refresher-content.js +8 -4
  293. package/dist/collection/components/reorder-group/reorder-group.js +6 -3
  294. package/dist/collection/components/route/route.js +4 -2
  295. package/dist/collection/components/router/router.js +10 -5
  296. package/dist/collection/components/router-link/router-link.js +6 -3
  297. package/dist/collection/components/router-outlet/router-outlet.js +18 -9
  298. package/dist/collection/components/searchbar/searchbar.js +11 -6
  299. package/dist/collection/components/segment/segment.js +10 -5
  300. package/dist/collection/components/segment-button/segment-button.js +4 -2
  301. package/dist/collection/components/segment-view/segment-view.ios.css +2 -1
  302. package/dist/collection/components/segment-view/segment-view.js +30 -4
  303. package/dist/collection/components/segment-view/segment-view.md.css +2 -1
  304. package/dist/collection/components/select/select.js +16 -8
  305. package/dist/collection/components/select-modal/select-modal.js +2 -1
  306. package/dist/collection/components/select-popover/select-popover.js +2 -1
  307. package/dist/collection/components/skeleton-text/skeleton-text.js +2 -1
  308. package/dist/collection/components/spinner/spinner.js +4 -2
  309. package/dist/collection/components/tab/tab.js +4 -2
  310. package/dist/collection/components/tab-bar/tab-bar.js +4 -2
  311. package/dist/collection/components/tab-button/tab-button.js +4 -2
  312. package/dist/collection/components/tabs/tabs.js +4 -2
  313. package/dist/collection/components/text/text.js +2 -1
  314. package/dist/collection/components/textarea/textarea.js +10 -7
  315. package/dist/collection/components/title/title.js +4 -2
  316. package/dist/collection/components/toast/toast.js +34 -17
  317. package/dist/collection/components/toggle/toggle.js +4 -2
  318. package/dist/collection/components/toolbar/toolbar.js +2 -1
  319. package/dist/docs.d.ts +37 -0
  320. package/dist/docs.json +885 -380
  321. package/dist/esm/{animation-Dt8bGnA-.js → animation-CnGMT4ji.js} +1 -1
  322. package/dist/esm/app-globals-DhZjtldk.js +9 -0
  323. package/dist/esm/{button-active-L570Swow.js → button-active-BBx21brx.js} +1 -1
  324. package/dist/esm/{config-mCdtaoPe.js → config-TO1rZH52.js} +1 -1
  325. package/dist/esm/{data-DCORV9FH.js → data-B9iGR5YO.js} +1 -1
  326. package/dist/esm/{framework-delegate-BYawdMXj.js → framework-delegate-CyxE1S_P.js} +1 -1
  327. package/dist/esm/{hardware-back-button-CPLxO-Ev.js → hardware-back-button-CTe4XmL7.js} +1 -1
  328. package/dist/esm/{helpers-DEn3pfjm.js → helpers-Tl8jw6S2.js} +1 -1
  329. package/dist/esm/{index-r2D9DEro.js → index-B-hkiOUh.js} +4 -4
  330. package/dist/esm/{index-CvDIirVx.js → index-B2KwgBLx.js} +5 -5
  331. package/dist/esm/{index-ceb5RaMT.js → index-BtUdxPjv.js} +2 -2
  332. package/dist/esm/{index-C8IsBmNU.js → index-IGIE5vDm.js} +503 -382
  333. package/dist/esm/{index-Bs3kT4bc.js → index-hW6eNZ3o.js} +2 -2
  334. package/dist/esm/index.js +12 -12
  335. package/dist/esm/{input-shims-DyOpfTg6.js → input-shims-C1hAaHcP.js} +3 -3
  336. package/dist/esm/{input.utils-DrvTa8gz.js → input.utils-Bxa_DQ7-.js} +2 -2
  337. package/dist/esm/ion-accordion_2.entry.js +23 -15
  338. package/dist/esm/ion-action-sheet.entry.js +21 -15
  339. package/dist/esm/ion-alert.entry.js +25 -17
  340. package/dist/esm/ion-app_8.entry.js +44 -40
  341. package/dist/esm/ion-avatar_3.entry.js +12 -12
  342. package/dist/esm/ion-back-button.entry.js +7 -7
  343. package/dist/esm/ion-backdrop.entry.js +6 -6
  344. package/dist/esm/ion-breadcrumb_2.entry.js +20 -14
  345. package/dist/esm/ion-button_2.entry.js +36 -18
  346. package/dist/esm/ion-card_5.entry.js +23 -23
  347. package/dist/esm/ion-checkbox.entry.js +7 -7
  348. package/dist/esm/ion-chip.entry.js +6 -6
  349. package/dist/esm/ion-col_3.entry.js +8 -8
  350. package/dist/esm/ion-datetime-button.entry.js +8 -8
  351. package/dist/esm/ion-datetime_3.entry.js +67 -39
  352. package/dist/esm/ion-fab_3.entry.js +17 -13
  353. package/dist/esm/ion-img.entry.js +8 -6
  354. package/dist/esm/ion-infinite-scroll_2.entry.js +17 -13
  355. package/dist/esm/ion-input-otp.entry.js +16 -10
  356. package/dist/esm/ion-input-password-toggle.entry.js +9 -7
  357. package/dist/esm/ion-input.entry.js +21 -13
  358. package/dist/esm/ion-item-option_3.entry.js +17 -15
  359. package/dist/esm/ion-item_8.entry.js +42 -36
  360. package/dist/esm/ion-loading.entry.js +18 -14
  361. package/dist/esm/ion-menu_3.entry.js +30 -22
  362. package/dist/esm/ion-modal.entry.js +19 -15
  363. package/dist/esm/ion-nav_2.entry.js +14 -10
  364. package/dist/esm/ion-picker-column-option.entry.js +10 -8
  365. package/dist/esm/ion-picker-column.entry.js +11 -7
  366. package/dist/esm/ion-picker.entry.js +6 -6
  367. package/dist/esm/ion-popover.entry.js +21 -15
  368. package/dist/esm/ion-progress-bar.entry.js +7 -7
  369. package/dist/esm/ion-radio_2.entry.js +17 -13
  370. package/dist/esm/ion-range.entry.js +40 -24
  371. package/dist/esm/ion-refresher_2.entry.js +45 -14
  372. package/dist/esm/ion-reorder_2.entry.js +13 -11
  373. package/dist/esm/ion-ripple-effect.entry.js +4 -4
  374. package/dist/esm/ion-route_4.entry.js +20 -10
  375. package/dist/esm/ion-searchbar.entry.js +22 -12
  376. package/dist/esm/ion-segment-content.entry.js +3 -3
  377. package/dist/esm/ion-segment-view.entry.js +13 -8
  378. package/dist/esm/ion-segment_2.entry.js +26 -16
  379. package/dist/esm/ion-select-modal.entry.js +12 -12
  380. package/dist/esm/ion-select_3.entry.js +32 -24
  381. package/dist/esm/ion-spinner.entry.js +4 -4
  382. package/dist/esm/ion-split-pane.entry.js +15 -9
  383. package/dist/esm/ion-tab-bar_2.entry.js +14 -12
  384. package/dist/esm/ion-tab_2.entry.js +10 -8
  385. package/dist/esm/ion-text.entry.js +4 -4
  386. package/dist/esm/ion-textarea.entry.js +20 -14
  387. package/dist/esm/ion-toast.entry.js +21 -15
  388. package/dist/esm/ion-toggle.entry.js +10 -8
  389. package/dist/esm/{ionic-global-CDrldh-5.js → ionic-global-DfbeLwcV.js} +1 -1
  390. package/dist/esm/ionic.js +6 -6
  391. package/dist/esm/{ios.transition-BDzw0_Hm.js → ios.transition--aMF-pDH.js} +4 -4
  392. package/dist/esm/loader.js +5 -5
  393. package/dist/esm/{md.transition-BzDYi3qq.js → md.transition-BEVbfm8j.js} +4 -4
  394. package/dist/esm/{notch-controller-BwelN_JM.js → notch-controller-DAcvKU57.js} +1 -1
  395. package/dist/esm/{overlays-D5YkFThA.js → overlays-F8GHPo-e.js} +5 -5
  396. package/dist/esm/{status-tap-5DQ7Fc4V.js → status-tap-BfJqFSLF.js} +3 -3
  397. package/dist/esm/{swipe-back-BKw2CAHc.js → swipe-back-BZBFwTQV.js} +2 -2
  398. package/dist/html.html-data.json +113 -109
  399. package/dist/ionic/index.esm.js +1 -1
  400. package/dist/ionic/ionic.esm.js +1 -1
  401. package/dist/ionic/{p-316c0420.entry.js → p-025d2d32.entry.js} +1 -1
  402. package/dist/ionic/p-02acdef4.entry.js +4 -0
  403. package/dist/ionic/p-04e2c388.entry.js +4 -0
  404. package/dist/ionic/{p-370e4237.entry.js → p-074344b8.entry.js} +1 -1
  405. package/dist/ionic/p-13ade5c8.entry.js +4 -0
  406. package/dist/ionic/p-1b02923f.entry.js +4 -0
  407. package/dist/ionic/p-1bd477a9.entry.js +4 -0
  408. package/dist/ionic/{p-d2489bf2.entry.js → p-1fa1406c.entry.js} +1 -1
  409. package/dist/ionic/{p-46d74291.entry.js → p-1fd588a7.entry.js} +1 -1
  410. package/dist/ionic/p-239a27a4.entry.js +4 -0
  411. package/dist/ionic/{p-94de5cfa.entry.js → p-277abec1.entry.js} +1 -1
  412. package/dist/ionic/{p-dd1aef77.entry.js → p-28d7852f.entry.js} +1 -1
  413. package/dist/ionic/{p-49d06882.entry.js → p-301c43f8.entry.js} +1 -1
  414. package/dist/ionic/{p-79bd78f9.entry.js → p-370a60ee.entry.js} +1 -1
  415. package/dist/ionic/p-3e143d1d.entry.js +4 -0
  416. package/dist/ionic/p-4431ef7e.entry.js +4 -0
  417. package/dist/ionic/p-463767ce.entry.js +4 -0
  418. package/dist/ionic/p-4f888343.entry.js +4 -0
  419. package/dist/ionic/p-51c11c47.entry.js +4 -0
  420. package/dist/ionic/p-56050077.entry.js +4 -0
  421. package/dist/ionic/p-6a3a5aae.entry.js +4 -0
  422. package/dist/ionic/p-6b97f2a3.entry.js +4 -0
  423. package/dist/ionic/p-77de9c60.entry.js +4 -0
  424. package/dist/ionic/{p-51a60e0f.entry.js → p-7c72d482.entry.js} +1 -1
  425. package/dist/ionic/p-7d20f4f8.entry.js +4 -0
  426. package/dist/ionic/{p-11aa58d6.entry.js → p-80cac7a2.entry.js} +1 -1
  427. package/dist/ionic/p-91fc7352.entry.js +4 -0
  428. package/dist/ionic/p-93845421.entry.js +4 -0
  429. package/dist/ionic/{p-3a6caca9.entry.js → p-964090ef.entry.js} +1 -1
  430. package/dist/ionic/p-96a2e768.entry.js +4 -0
  431. package/dist/ionic/{p-d126e8d3.entry.js → p-9745651b.entry.js} +1 -1
  432. package/dist/ionic/{p-f9061316.entry.js → p-9802c88e.entry.js} +1 -1
  433. package/dist/ionic/{p-582824c5.entry.js → p-9833cf63.entry.js} +1 -1
  434. package/dist/ionic/p-9d1676bb.entry.js +4 -0
  435. package/dist/ionic/{p-675b1a31.entry.js → p-9fae83d8.entry.js} +1 -1
  436. package/dist/ionic/{p-CwgG81ZD.js → p-B8xlpH8p.js} +1 -1
  437. package/dist/ionic/{p-C7hRNDhM.js → p-BAt5H1ac.js} +1 -1
  438. package/dist/ionic/p-BW_TRJm8.js +4 -0
  439. package/dist/ionic/{p-DDb5r57F.js → p-Bum7H1fw.js} +1 -1
  440. package/dist/ionic/{p-D0dMcSkw.js → p-BvFYtOdE.js} +1 -1
  441. package/dist/ionic/{p-Dc45iWE4.js → p-BxIcPWoV.js} +1 -1
  442. package/dist/ionic/{p-BYEqWnSg.js → p-C0JvVFMv.js} +1 -1
  443. package/dist/ionic/{p-CTfR9YZG.js → p-CGmVTdWh.js} +1 -1
  444. package/dist/ionic/{p-BOVrCkpJ.js → p-CYbRmDdy.js} +1 -1
  445. package/dist/ionic/{p-D-eFFUkA.js → p-CmFz1Mjc.js} +1 -1
  446. package/dist/ionic/p-CtA-yJYy.js +4 -0
  447. package/dist/ionic/p-D8HJQ1qq.js +4 -0
  448. package/dist/ionic/{p-B0q1YL7N.js → p-DB_iPQC-.js} +1 -1
  449. package/dist/ionic/{p-DNcfiJwE.js → p-DLbbmF9h.js} +1 -1
  450. package/dist/ionic/{p-DdR6rpbR.js → p-DTPR1Wpn.js} +1 -1
  451. package/dist/ionic/{p-DCv9sLH2.js → p-DjriolRs.js} +1 -1
  452. package/dist/ionic/p-DtVZDHlS.js +4 -0
  453. package/dist/ionic/{p-QHYY4sjU.js → p-GWUGgWx6.js} +1 -1
  454. package/dist/ionic/p-IGIE5vDm.js +5 -0
  455. package/dist/ionic/{p-BFvmZNyx.js → p-NFFyoJ4Q.js} +1 -1
  456. package/dist/ionic/{p-86f53961.entry.js → p-a287e18e.entry.js} +1 -1
  457. package/dist/ionic/p-a805674e.entry.js +4 -0
  458. package/dist/ionic/p-a81ae2cd.entry.js +4 -0
  459. package/dist/ionic/{p-da7d04cc.entry.js → p-a84f2d21.entry.js} +1 -1
  460. package/dist/ionic/{p-dbbe606a.entry.js → p-b2d5238b.entry.js} +1 -1
  461. package/dist/ionic/{p-d1f54e28.entry.js → p-b440381f.entry.js} +1 -1
  462. package/dist/ionic/{p-72c38b88.entry.js → p-b4d52b58.entry.js} +1 -1
  463. package/dist/ionic/{p-2a939845.entry.js → p-b67a2114.entry.js} +1 -1
  464. package/dist/ionic/{p-c73627c8.entry.js → p-bced1f3e.entry.js} +1 -1
  465. package/dist/ionic/p-c1c9b2bb.entry.js +4 -0
  466. package/dist/ionic/{p-f8f22cc0.entry.js → p-c3e65e45.entry.js} +1 -1
  467. package/dist/ionic/{p-b0a7585c.entry.js → p-ca31010f.entry.js} +1 -1
  468. package/dist/ionic/p-cbf245b5.entry.js +4 -0
  469. package/dist/ionic/p-d68b665a.entry.js +4 -0
  470. package/dist/ionic/{p-9575b654.entry.js → p-e663bc5a.entry.js} +1 -1
  471. package/dist/ionic/p-efe86ed9.entry.js +4 -0
  472. package/dist/ionic/{p-ac4eb91d.entry.js → p-f5dfb9a3.entry.js} +1 -1
  473. package/dist/ionic/{p-DbQ5QkTP.js → p-gbVXD275.js} +1 -1
  474. package/dist/ionic/p-hNN3VvaC.js +4 -0
  475. package/dist/types/components/datetime/datetime.d.ts +9 -0
  476. package/dist/types/components/header/header.utils.d.ts +2 -1
  477. package/dist/types/components/refresher/refresher-interface.d.ts +7 -0
  478. package/dist/types/components/refresher/refresher.d.ts +16 -3
  479. package/dist/types/components/segment-view/segment-view.d.ts +4 -0
  480. package/dist/types/components/select/select.d.ts +3 -0
  481. package/dist/types/components.d.ts +937 -189
  482. package/dist/types/interface.d.ts +1 -1
  483. package/dist/types/stencil-public-runtime.d.ts +126 -14
  484. package/dist/types/utils/gesture/listener.d.ts +2 -1
  485. package/hydrate/index.d.ts +12 -0
  486. package/hydrate/index.js +5189 -1322
  487. package/hydrate/index.mjs +5188 -1323
  488. package/package.json +2 -2
  489. package/dist/cjs/app-globals-Ciccnk9_.js +0 -10
  490. package/dist/esm/app-globals-BDSf8fOA.js +0 -8
  491. package/dist/ionic/p-020af078.entry.js +0 -4
  492. package/dist/ionic/p-074839fc.entry.js +0 -4
  493. package/dist/ionic/p-0dfa5a37.entry.js +0 -4
  494. package/dist/ionic/p-11518b31.entry.js +0 -4
  495. package/dist/ionic/p-29721c43.entry.js +0 -4
  496. package/dist/ionic/p-31f7095f.entry.js +0 -4
  497. package/dist/ionic/p-34642fa1.entry.js +0 -4
  498. package/dist/ionic/p-35696017.entry.js +0 -4
  499. package/dist/ionic/p-40c261a3.entry.js +0 -4
  500. package/dist/ionic/p-4e41ea20.entry.js +0 -4
  501. package/dist/ionic/p-6241ce47.entry.js +0 -4
  502. package/dist/ionic/p-639dd543.entry.js +0 -4
  503. package/dist/ionic/p-6444c606.entry.js +0 -4
  504. package/dist/ionic/p-6d070558.entry.js +0 -4
  505. package/dist/ionic/p-7268efa5.entry.js +0 -4
  506. package/dist/ionic/p-7babec72.entry.js +0 -4
  507. package/dist/ionic/p-88367362.entry.js +0 -4
  508. package/dist/ionic/p-91840a80.entry.js +0 -4
  509. package/dist/ionic/p-991a3dd9.entry.js +0 -4
  510. package/dist/ionic/p-BKc55Xev.js +0 -4
  511. package/dist/ionic/p-Bmgaetn_.js +0 -4
  512. package/dist/ionic/p-C8IsBmNU.js +0 -5
  513. package/dist/ionic/p-CJxh_yLS.js +0 -4
  514. package/dist/ionic/p-DUt5fQmA.js +0 -4
  515. package/dist/ionic/p-DZRJwG4S.js +0 -4
  516. package/dist/ionic/p-a127bee2.entry.js +0 -4
  517. package/dist/ionic/p-b3d44509.entry.js +0 -4
  518. package/dist/ionic/p-c19f63d0.entry.js +0 -4
  519. package/dist/ionic/p-cc45bcbc.entry.js +0 -4
  520. package/dist/ionic/p-d0a2a1ab.entry.js +0 -4
  521. package/dist/ionic/p-d3014190.entry.js +0 -4
  522. package/dist/ionic/p-db82892c.entry.js +0 -4
@@ -1,2514 +1,4 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
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 { f as clamp, g as getElementRoot, r as raf, d as inheritAttributes, k as hasLazyBuild } from './helpers.js';
8
- import { c as createLockController } from './lock-controller.js';
9
- import { p as printIonWarning, c as config } from './index4.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 } from './ionic-global.js';
15
- import { KEYBOARD_DID_OPEN } from './keyboard.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 './index9.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 ? -1e-3 : 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, expandToScroll } = 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
- /**
524
- * This allows the content to be scrollable at any breakpoint.
525
- */
526
- const contentAnimation = !expandToScroll
527
- ? createAnimation('contentAnimation').keyframes([
528
- { offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint) * 100}%` },
529
- { offset: 1, opacity: 1, maxHeight: `${currentBreakpoint * 100}%` },
530
- ])
531
- : undefined;
532
- return { wrapperAnimation, backdropAnimation, contentAnimation };
533
- };
534
- const createSheetLeaveAnimation = (opts) => {
535
- const { currentBreakpoint, backdropBreakpoint } = opts;
536
- /**
537
- * Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
538
- * is defined, so we need to account for that offset by figuring out
539
- * what the current backdrop value should be.
540
- */
541
- const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
542
- const defaultBackdrop = [
543
- { offset: 0, opacity: backdropValue },
544
- { offset: 1, opacity: 0 },
545
- ];
546
- const customBackdrop = [
547
- { offset: 0, opacity: backdropValue },
548
- { offset: backdropBreakpoint, opacity: 0 },
549
- { offset: 1, opacity: 0 },
550
- ];
551
- const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
552
- const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
553
- { offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
554
- { offset: 1, opacity: 1, transform: `translateY(100%)` },
555
- ]);
556
- return { wrapperAnimation, backdropAnimation };
557
- };
558
-
559
- const createEnterAnimation$1 = () => {
560
- const backdropAnimation = createAnimation()
561
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
562
- .beforeStyles({
563
- 'pointer-events': 'none',
564
- })
565
- .afterClearStyles(['pointer-events']);
566
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(100vh)', 'translateY(0vh)');
567
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
568
- };
569
- /**
570
- * iOS Modal Enter Animation for the Card presentation style
571
- */
572
- const iosEnterAnimation = (baseEl, opts) => {
573
- const { presentingEl, currentBreakpoint, expandToScroll } = opts;
574
- const root = getElementRoot(baseEl);
575
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$1();
576
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
577
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
578
- // The content animation is only added if scrolling is enabled for
579
- // all the breakpoints.
580
- !expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
581
- const baseAnimation = createAnimation('entering-base')
582
- .addElement(baseEl)
583
- .easing('cubic-bezier(0.32,0.72,0,1)')
584
- .duration(500)
585
- .addAnimation([wrapperAnimation]);
586
- if (contentAnimation) {
587
- baseAnimation.addAnimation(contentAnimation);
588
- }
589
- if (presentingEl) {
590
- const isPortrait = window.innerWidth < 768;
591
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
592
- const presentingElRoot = getElementRoot(presentingEl);
593
- const presentingAnimation = createAnimation().beforeStyles({
594
- transform: 'translateY(0)',
595
- 'transform-origin': 'top center',
596
- overflow: 'hidden',
597
- });
598
- const bodyEl = document.body;
599
- if (isPortrait) {
600
- /**
601
- * Fallback for browsers that does not support `max()` (ex: Firefox)
602
- * No need to worry about statusbar padding since engines like Gecko
603
- * are not used as the engine for standalone Cordova/Capacitor apps
604
- */
605
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
606
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
607
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
608
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
609
- presentingAnimation
610
- .afterStyles({
611
- transform: finalTransform,
612
- })
613
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
614
- .addElement(presentingEl)
615
- .keyframes([
616
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
617
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
618
- ]);
619
- baseAnimation.addAnimation(presentingAnimation);
620
- }
621
- else {
622
- baseAnimation.addAnimation(backdropAnimation);
623
- if (!hasCardModal) {
624
- wrapperAnimation.fromTo('opacity', '0', '1');
625
- }
626
- else {
627
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
628
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
629
- presentingAnimation
630
- .afterStyles({
631
- transform: finalTransform,
632
- })
633
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
634
- .keyframes([
635
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
636
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform },
637
- ]);
638
- const shadowAnimation = createAnimation()
639
- .afterStyles({
640
- transform: finalTransform,
641
- })
642
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
643
- .keyframes([
644
- { offset: 0, opacity: '1', transform: 'translateY(0) scale(1)' },
645
- { offset: 1, opacity: '0', transform: finalTransform },
646
- ]);
647
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
648
- }
649
- }
650
- }
651
- else {
652
- baseAnimation.addAnimation(backdropAnimation);
653
- }
654
- return baseAnimation;
655
- };
656
-
657
- const createLeaveAnimation$1 = () => {
658
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
659
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
660
- return { backdropAnimation, wrapperAnimation };
661
- };
662
- /**
663
- * iOS Modal Leave Animation
664
- */
665
- const iosLeaveAnimation = (baseEl, opts, duration = 500) => {
666
- const { presentingEl, currentBreakpoint } = opts;
667
- const root = getElementRoot(baseEl);
668
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation$1();
669
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
670
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
671
- const baseAnimation = createAnimation('leaving-base')
672
- .addElement(baseEl)
673
- .easing('cubic-bezier(0.32,0.72,0,1)')
674
- .duration(duration)
675
- .addAnimation(wrapperAnimation);
676
- if (presentingEl) {
677
- const isPortrait = window.innerWidth < 768;
678
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
679
- const presentingElRoot = getElementRoot(presentingEl);
680
- const presentingAnimation = createAnimation()
681
- .beforeClearStyles(['transform'])
682
- .afterClearStyles(['transform'])
683
- .onFinish((currentStep) => {
684
- // only reset background color if this is the last card-style modal
685
- if (currentStep !== 1) {
686
- return;
687
- }
688
- presentingEl.style.setProperty('overflow', '');
689
- const numModals = Array.from(bodyEl.querySelectorAll('ion-modal:not(.overlay-hidden)')).filter((m) => m.presentingElement !== undefined).length;
690
- if (numModals <= 1) {
691
- bodyEl.style.setProperty('background-color', '');
692
- }
693
- });
694
- const bodyEl = document.body;
695
- if (isPortrait) {
696
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
697
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
698
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
699
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
700
- presentingAnimation.addElement(presentingEl).keyframes([
701
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
702
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
703
- ]);
704
- baseAnimation.addAnimation(presentingAnimation);
705
- }
706
- else {
707
- baseAnimation.addAnimation(backdropAnimation);
708
- if (!hasCardModal) {
709
- wrapperAnimation.fromTo('opacity', '1', '0');
710
- }
711
- else {
712
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
713
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
714
- presentingAnimation
715
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
716
- .afterStyles({
717
- transform: 'translate3d(0, 0, 0)',
718
- })
719
- .keyframes([
720
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform },
721
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
722
- ]);
723
- const shadowAnimation = createAnimation()
724
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
725
- .afterStyles({
726
- transform: 'translateY(0) scale(1)',
727
- })
728
- .keyframes([
729
- { offset: 0, opacity: '0', transform: finalTransform },
730
- { offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' },
731
- ]);
732
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
733
- }
734
- }
735
- }
736
- else {
737
- baseAnimation.addAnimation(backdropAnimation);
738
- }
739
- return baseAnimation;
740
- };
741
-
742
- /**
743
- * Transition animation from portrait view to landscape view
744
- * This handles the case where a card modal is open in portrait view
745
- * and the user switches to landscape view
746
- */
747
- const portraitToLandscapeTransition = (baseEl, opts, duration = 300) => {
748
- const { presentingEl } = opts;
749
- if (!presentingEl) {
750
- // No transition needed for non-card modals
751
- return createAnimation('portrait-to-landscape-transition');
752
- }
753
- const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
754
- const presentingElRoot = getElementRoot(presentingEl);
755
- const bodyEl = document.body;
756
- const baseAnimation = createAnimation('portrait-to-landscape-transition')
757
- .addElement(baseEl)
758
- .easing('cubic-bezier(0.32,0.72,0,1)')
759
- .duration(duration);
760
- const presentingAnimation = createAnimation().beforeStyles({
761
- transform: 'translateY(0)',
762
- 'transform-origin': 'top center',
763
- overflow: 'hidden',
764
- });
765
- if (!presentingElIsCardModal) {
766
- // The presenting element is not a card modal, so we do not
767
- // need to care about layering and modal-specific styles.
768
- const root = getElementRoot(baseEl);
769
- const wrapperAnimation = createAnimation()
770
- .addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
771
- .fromTo('opacity', '1', '1'); // Keep wrapper visible in landscape
772
- const backdropAnimation = createAnimation()
773
- .addElement(root.querySelector('ion-backdrop'))
774
- .fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
775
- // Animate presentingEl from portrait state back to normal
776
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
777
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
778
- const fromTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
779
- presentingAnimation
780
- .addElement(presentingEl)
781
- .afterStyles({
782
- transform: 'translateY(0px) scale(1)',
783
- 'border-radius': '0px',
784
- })
785
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', ''))
786
- .fromTo('transform', fromTransform, 'translateY(0px) scale(1)')
787
- .fromTo('filter', 'contrast(0.85)', 'contrast(1)')
788
- .fromTo('border-radius', '10px 10px 0 0', '0px');
789
- baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
790
- }
791
- else {
792
- // The presenting element is a card modal, so we do
793
- // need to care about layering and modal-specific styles.
794
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
795
- const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
796
- const toTransform = `translateY(0px) scale(1)`;
797
- presentingAnimation
798
- .addElement(presentingEl)
799
- .afterStyles({
800
- transform: toTransform,
801
- })
802
- .fromTo('transform', fromTransform, toTransform)
803
- .fromTo('filter', 'contrast(0.85)', 'contrast(1)');
804
- const shadowAnimation = createAnimation()
805
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
806
- .afterStyles({
807
- transform: toTransform,
808
- opacity: '0',
809
- })
810
- .fromTo('transform', fromTransform, toTransform);
811
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
812
- }
813
- return baseAnimation;
814
- };
815
- /**
816
- * Transition animation from landscape view to portrait view
817
- * This handles the case where a card modal is open in landscape view
818
- * and the user switches to portrait view
819
- */
820
- const landscapeToPortraitTransition = (baseEl, opts, duration = 300) => {
821
- const { presentingEl } = opts;
822
- if (!presentingEl) {
823
- // No transition needed for non-card modals
824
- return createAnimation('landscape-to-portrait-transition');
825
- }
826
- const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
827
- const presentingElRoot = getElementRoot(presentingEl);
828
- const bodyEl = document.body;
829
- const baseAnimation = createAnimation('landscape-to-portrait-transition')
830
- .addElement(baseEl)
831
- .easing('cubic-bezier(0.32,0.72,0,1)')
832
- .duration(duration);
833
- const presentingAnimation = createAnimation().beforeStyles({
834
- transform: 'translateY(0)',
835
- 'transform-origin': 'top center',
836
- overflow: 'hidden',
837
- });
838
- if (!presentingElIsCardModal) {
839
- // The presenting element is not a card modal, so we do not
840
- // need to care about layering and modal-specific styles.
841
- const root = getElementRoot(baseEl);
842
- const wrapperAnimation = createAnimation()
843
- .addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
844
- .fromTo('opacity', '1', '1'); // Keep wrapper visible
845
- const backdropAnimation = createAnimation()
846
- .addElement(root.querySelector('ion-backdrop'))
847
- .fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
848
- // Animate presentingEl from normal state to portrait state
849
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
850
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
851
- const toTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
852
- presentingAnimation
853
- .addElement(presentingEl)
854
- .afterStyles({
855
- transform: toTransform,
856
- })
857
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
858
- .keyframes([
859
- { offset: 0, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '0px' },
860
- { offset: 0.2, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '10px 10px 0 0' },
861
- { offset: 1, transform: toTransform, filter: 'contrast(0.85)', borderRadius: '10px 10px 0 0' },
862
- ]);
863
- baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
864
- }
865
- else {
866
- // The presenting element is also a card modal, so we need
867
- // to handle layering and modal-specific styles.
868
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
869
- const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
870
- const toTransform = `translateY(0) scale(1)`;
871
- presentingAnimation
872
- .addElement(presentingEl)
873
- .afterStyles({
874
- transform: toTransform,
875
- })
876
- .fromTo('transform', fromTransform, toTransform);
877
- const shadowAnimation = createAnimation()
878
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
879
- .afterStyles({
880
- transform: toTransform,
881
- opacity: '0',
882
- })
883
- .fromTo('transform', fromTransform, toTransform);
884
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
885
- }
886
- return baseAnimation;
887
- };
888
-
889
- const createEnterAnimation = () => {
890
- const backdropAnimation = createAnimation()
891
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
892
- .beforeStyles({
893
- 'pointer-events': 'none',
894
- })
895
- .afterClearStyles(['pointer-events']);
896
- const wrapperAnimation = createAnimation().keyframes([
897
- { offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
898
- { offset: 1, opacity: 1, transform: `translateY(0px)` },
899
- ]);
900
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
901
- };
902
- /**
903
- * Md Modal Enter Animation
904
- */
905
- const mdEnterAnimation = (baseEl, opts) => {
906
- const { currentBreakpoint, expandToScroll } = opts;
907
- const root = getElementRoot(baseEl);
908
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation();
909
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
910
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
911
- // The content animation is only added if scrolling is enabled for
912
- // all the breakpoints.
913
- !expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
914
- const baseAnimation = createAnimation()
915
- .addElement(baseEl)
916
- .easing('cubic-bezier(0.36,0.66,0.04,1)')
917
- .duration(280)
918
- .addAnimation([backdropAnimation, wrapperAnimation]);
919
- if (contentAnimation) {
920
- baseAnimation.addAnimation(contentAnimation);
921
- }
922
- return baseAnimation;
923
- };
924
-
925
- const createLeaveAnimation = () => {
926
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
927
- const wrapperAnimation = createAnimation().keyframes([
928
- { offset: 0, opacity: 0.99, transform: `translateY(0px)` },
929
- { offset: 1, opacity: 0, transform: 'translateY(40px)' },
930
- ]);
931
- return { backdropAnimation, wrapperAnimation };
932
- };
933
- /**
934
- * Md Modal Leave Animation
935
- */
936
- const mdLeaveAnimation = (baseEl, opts) => {
937
- const { currentBreakpoint } = opts;
938
- const root = getElementRoot(baseEl);
939
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();
940
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
941
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
942
- const baseAnimation = createAnimation()
943
- .easing('cubic-bezier(0.47,0,0.745,0.715)')
944
- .duration(200)
945
- .addAnimation([backdropAnimation, wrapperAnimation]);
946
- return baseAnimation;
947
- };
948
-
949
- const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
950
- // Defaults for the sheet swipe animation
951
- const defaultBackdrop = [
952
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
953
- { offset: 1, opacity: 0.01 },
954
- ];
955
- const customBackdrop = [
956
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
957
- { offset: 1 - backdropBreakpoint, opacity: 0 },
958
- { offset: 1, opacity: 0 },
959
- ];
960
- const SheetDefaults = {
961
- WRAPPER_KEYFRAMES: [
962
- { offset: 0, transform: 'translateY(0%)' },
963
- { offset: 1, transform: 'translateY(100%)' },
964
- ],
965
- BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
966
- CONTENT_KEYFRAMES: [
967
- { offset: 0, maxHeight: '100%' },
968
- { offset: 1, maxHeight: '0%' },
969
- ],
970
- };
971
- const contentEl = baseEl.querySelector('ion-content');
972
- const height = wrapperEl.clientHeight;
973
- let currentBreakpoint = initialBreakpoint;
974
- let offset = 0;
975
- let canDismissBlocksGesture = false;
976
- let cachedScrollEl = null;
977
- let cachedFooterEls = null;
978
- let cachedFooterYPosition = null;
979
- let currentFooterState = null;
980
- const canDismissMaxStep = 0.95;
981
- const maxBreakpoint = breakpoints[breakpoints.length - 1];
982
- const minBreakpoint = breakpoints[0];
983
- const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
984
- const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
985
- const contentAnimation = animation.childAnimations.find((ani) => ani.id === 'contentAnimation');
986
- const enableBackdrop = () => {
987
- // Respect explicit opt-out of focus trapping/backdrop interactions
988
- // If focusTrap is false or showBackdrop is false, do not enable the backdrop or re-enable focus trap
989
- const el = baseEl;
990
- if (el.focusTrap === false || el.showBackdrop === false) {
991
- return;
992
- }
993
- baseEl.style.setProperty('pointer-events', 'auto');
994
- backdropEl.style.setProperty('pointer-events', 'auto');
995
- /**
996
- * When the backdrop is enabled, elements such
997
- * as inputs should not be focusable outside
998
- * the sheet.
999
- */
1000
- baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS);
1001
- };
1002
- const disableBackdrop = () => {
1003
- baseEl.style.setProperty('pointer-events', 'none');
1004
- backdropEl.style.setProperty('pointer-events', 'none');
1005
- /**
1006
- * When the backdrop is enabled, elements such
1007
- * as inputs should not be focusable outside
1008
- * the sheet.
1009
- * Adding this class disables focus trapping
1010
- * for the sheet temporarily.
1011
- */
1012
- baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
1013
- };
1014
- /**
1015
- * Toggles the footer to an absolute position while moving to prevent
1016
- * it from shaking while the sheet is being dragged.
1017
- * @param newPosition Whether the footer is in a moving or stationary position.
1018
- */
1019
- const swapFooterPosition = (newPosition) => {
1020
- if (!cachedFooterEls) {
1021
- cachedFooterEls = Array.from(baseEl.querySelectorAll('ion-footer'));
1022
- if (!cachedFooterEls.length) {
1023
- return;
1024
- }
1025
- }
1026
- const page = baseEl.querySelector('.ion-page');
1027
- currentFooterState = newPosition;
1028
- if (newPosition === 'stationary') {
1029
- cachedFooterEls.forEach((cachedFooterEl) => {
1030
- // Reset positioning styles to allow normal document flow
1031
- cachedFooterEl.classList.remove('modal-footer-moving');
1032
- cachedFooterEl.style.removeProperty('position');
1033
- cachedFooterEl.style.removeProperty('width');
1034
- cachedFooterEl.style.removeProperty('height');
1035
- cachedFooterEl.style.removeProperty('top');
1036
- cachedFooterEl.style.removeProperty('left');
1037
- page === null || page === void 0 ? void 0 : page.style.removeProperty('padding-bottom');
1038
- // Move to page
1039
- page === null || page === void 0 ? void 0 : page.appendChild(cachedFooterEl);
1040
- });
1041
- }
1042
- else {
1043
- let footerHeights = 0;
1044
- cachedFooterEls.forEach((cachedFooterEl, index) => {
1045
- // Get both the footer and document body positions
1046
- const cachedFooterElRect = cachedFooterEl.getBoundingClientRect();
1047
- const bodyRect = document.body.getBoundingClientRect();
1048
- // Calculate the total height of all footers
1049
- // so we can add padding to the page element
1050
- footerHeights += cachedFooterEl.clientHeight;
1051
- // Calculate absolute position relative to body
1052
- // We need to subtract the body's offsetTop to get true position within document.body
1053
- const absoluteTop = cachedFooterElRect.top - bodyRect.top;
1054
- const absoluteLeft = cachedFooterElRect.left - bodyRect.left;
1055
- // Capture the footer's current dimensions and store them in CSS variables for
1056
- // later use when applying absolute positioning.
1057
- cachedFooterEl.style.setProperty('--pinned-width', `${cachedFooterEl.clientWidth}px`);
1058
- cachedFooterEl.style.setProperty('--pinned-height', `${cachedFooterEl.clientHeight}px`);
1059
- cachedFooterEl.style.setProperty('--pinned-top', `${absoluteTop}px`);
1060
- cachedFooterEl.style.setProperty('--pinned-left', `${absoluteLeft}px`);
1061
- // Only cache the first footer's Y position
1062
- // This is used to determine if the sheet has been moved below the footer
1063
- // and needs to be swapped back to stationary so it collapses correctly.
1064
- if (index === 0) {
1065
- cachedFooterYPosition = absoluteTop;
1066
- // If there's a header, we need to combine the header height with the footer position
1067
- // because the header moves with the drag handle, so when it starts overlapping the footer,
1068
- // we need to account for that.
1069
- const header = baseEl.querySelector('ion-header');
1070
- if (header) {
1071
- cachedFooterYPosition -= header.clientHeight;
1072
- }
1073
- }
1074
- });
1075
- // Apply the pinning of styles after we've calculated everything
1076
- // so that we don't cause layouts to shift while calculating the footer positions.
1077
- // Otherwise, with multiple footers we'll end up capturing the wrong positions.
1078
- cachedFooterEls.forEach((cachedFooterEl) => {
1079
- // Add padding to the parent element to prevent content from being hidden
1080
- // when the footer is positioned absolutely. This has to be done before we
1081
- // make the footer absolutely positioned or we may accidentally cause the
1082
- // sheet to scroll.
1083
- page === null || page === void 0 ? void 0 : page.style.setProperty('padding-bottom', `${footerHeights}px`);
1084
- // Apply positioning styles to keep footer at bottom
1085
- cachedFooterEl.classList.add('modal-footer-moving');
1086
- // Apply our preserved styles to pin the footer
1087
- cachedFooterEl.style.setProperty('position', 'absolute');
1088
- cachedFooterEl.style.setProperty('width', 'var(--pinned-width)');
1089
- cachedFooterEl.style.setProperty('height', 'var(--pinned-height)');
1090
- cachedFooterEl.style.setProperty('top', 'var(--pinned-top)');
1091
- cachedFooterEl.style.setProperty('left', 'var(--pinned-left)');
1092
- // Move the element to the body when everything else is done
1093
- document.body.appendChild(cachedFooterEl);
1094
- });
1095
- }
1096
- };
1097
- /**
1098
- * After the entering animation completes,
1099
- * we need to set the animation to go from
1100
- * offset 0 to offset 1 so that users can
1101
- * swipe in any direction. We then set the
1102
- * animation offset to the current breakpoint
1103
- * so there is no flickering.
1104
- */
1105
- if (wrapperAnimation && backdropAnimation) {
1106
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
1107
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
1108
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
1109
- animation.progressStart(true, 1 - currentBreakpoint);
1110
- /**
1111
- * If backdrop is not enabled, then content
1112
- * behind modal should be clickable. To do this, we need
1113
- * to remove pointer-events from ion-modal as a whole.
1114
- * ion-backdrop and .modal-wrapper always have pointer-events: auto
1115
- * applied, so the modal content can still be interacted with.
1116
- */
1117
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint &&
1118
- baseEl.focusTrap !== false &&
1119
- baseEl.showBackdrop !== false;
1120
- if (shouldEnableBackdrop) {
1121
- enableBackdrop();
1122
- }
1123
- else {
1124
- disableBackdrop();
1125
- }
1126
- }
1127
- if (contentEl && currentBreakpoint !== maxBreakpoint && expandToScroll) {
1128
- contentEl.scrollY = false;
1129
- }
1130
- const canStart = (detail) => {
1131
- /**
1132
- * If we are swiping on the content, swiping should only be possible if the content
1133
- * is scrolled all the way to the top so that we do not interfere with scrolling.
1134
- *
1135
- * We cannot assume that the `ion-content` target will remain consistent between swipes.
1136
- * For example, when using ion-nav within a modal it is possible to swipe, push a view,
1137
- * and then swipe again. The target content will not be the same between swipes.
1138
- */
1139
- const contentEl = findClosestIonContent(detail.event.target);
1140
- currentBreakpoint = getCurrentBreakpoint();
1141
- /**
1142
- * If `expandToScroll` is disabled, we should not allow the swipe gesture
1143
- * to start if the content is not scrolled to the top.
1144
- */
1145
- if (!expandToScroll && contentEl) {
1146
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
1147
- return scrollEl.scrollTop === 0;
1148
- }
1149
- if (currentBreakpoint === 1 && contentEl) {
1150
- /**
1151
- * The modal should never swipe to close on the content with a refresher.
1152
- * Note 1: We cannot solve this by making this gesture have a higher priority than
1153
- * the refresher gesture as the iOS native refresh gesture uses a scroll listener in
1154
- * addition to a gesture.
1155
- *
1156
- * Note 2: Do not use getScrollElement here because we need this to be a synchronous
1157
- * operation, and getScrollElement is asynchronous.
1158
- */
1159
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
1160
- const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
1161
- return !hasRefresherInContent && scrollEl.scrollTop === 0;
1162
- }
1163
- return true;
1164
- };
1165
- const onStart = (detail) => {
1166
- /**
1167
- * If canDismiss is anything other than `true`
1168
- * then users should be able to swipe down
1169
- * until a threshold is hit. At that point,
1170
- * the card modal should not proceed any further.
1171
- *
1172
- * canDismiss is never fired via gesture if there is
1173
- * no 0 breakpoint. However, it can be fired if the user
1174
- * presses Esc or the hardware back button.
1175
- * TODO (FW-937)
1176
- * Remove undefined check
1177
- */
1178
- canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
1179
- /**
1180
- * Cache the scroll element reference when the gesture starts,
1181
- * this allows us to avoid querying the DOM for the target in onMove,
1182
- * which would impact performance significantly.
1183
- */
1184
- if (!expandToScroll) {
1185
- const targetEl = findClosestIonContent(detail.event.target);
1186
- cachedScrollEl =
1187
- targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl;
1188
- }
1189
- /**
1190
- * If expandToScroll is disabled, we need to swap
1191
- * the footer position to moving so that it doesn't shake
1192
- * while the sheet is being dragged.
1193
- */
1194
- if (!expandToScroll) {
1195
- swapFooterPosition('moving');
1196
- }
1197
- /**
1198
- * If we are pulling down, then it is possible we are pulling on the content.
1199
- * We do not want scrolling to happen at the same time as the gesture.
1200
- */
1201
- if (detail.deltaY > 0 && contentEl) {
1202
- contentEl.scrollY = false;
1203
- }
1204
- raf(() => {
1205
- /**
1206
- * Dismisses the open keyboard when the sheet drag gesture is started.
1207
- * Sets the focus onto the modal element.
1208
- */
1209
- baseEl.focus();
1210
- });
1211
- animation.progressStart(true, 1 - currentBreakpoint);
1212
- };
1213
- const onMove = (detail) => {
1214
- /**
1215
- * If `expandToScroll` is disabled, we need to see if we're currently below
1216
- * the footer element and the footer is in a stationary position. If so,
1217
- * we need to make the stationary the original position so that the footer
1218
- * collapses with the sheet.
1219
- */
1220
- if (!expandToScroll && cachedFooterYPosition !== null && currentFooterState !== null) {
1221
- // Check if we need to swap the footer position
1222
- if (detail.currentY >= cachedFooterYPosition && currentFooterState === 'moving') {
1223
- swapFooterPosition('stationary');
1224
- }
1225
- else if (detail.currentY < cachedFooterYPosition && currentFooterState === 'stationary') {
1226
- swapFooterPosition('moving');
1227
- }
1228
- }
1229
- /**
1230
- * If `expandToScroll` is disabled, and an upwards swipe gesture is done within
1231
- * the scrollable content, we should not allow the swipe gesture to continue.
1232
- */
1233
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl) {
1234
- return;
1235
- }
1236
- /**
1237
- * If we are pulling down, then it is possible we are pulling on the content.
1238
- * We do not want scrolling to happen at the same time as the gesture.
1239
- * This accounts for when the user scrolls down, scrolls all the way up, and then
1240
- * pulls down again such that the modal should start to move.
1241
- */
1242
- if (detail.deltaY > 0 && contentEl) {
1243
- contentEl.scrollY = false;
1244
- }
1245
- /**
1246
- * Given the change in gesture position on the Y axis,
1247
- * compute where the offset of the animation should be
1248
- * relative to where the user dragged.
1249
- */
1250
- const initialStep = 1 - currentBreakpoint;
1251
- const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
1252
- const step = initialStep + detail.deltaY / height;
1253
- const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture;
1254
- /**
1255
- * If we are blocking the gesture from dismissing,
1256
- * set the max step value so that the sheet cannot be
1257
- * completely hidden.
1258
- */
1259
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
1260
- /**
1261
- * If we are blocking the gesture from
1262
- * dismissing, calculate the spring modifier value
1263
- * this will be added to the starting breakpoint
1264
- * value to give the gesture a spring-like feeling.
1265
- * Note that when isAttemptingDismissWithCanDismiss is true,
1266
- * the modifier is always added to the breakpoint that
1267
- * appears right after the 0 breakpoint.
1268
- *
1269
- * Note that this modifier is essentially the progression
1270
- * between secondToLastBreakpoint and maxStep which is
1271
- * why we subtract secondToLastBreakpoint. This lets us get
1272
- * the result as a value from 0 to 1.
1273
- */
1274
- const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined
1275
- ? secondToLastBreakpoint +
1276
- calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint))
1277
- : step;
1278
- offset = clamp(0.0001, processedStep, maxStep);
1279
- animation.progressStep(offset);
1280
- };
1281
- const onEnd = (detail) => {
1282
- /**
1283
- * If expandToScroll is disabled, we should not allow the moveSheetToBreakpoint
1284
- * function to be called if the user is trying to swipe content upwards and the content
1285
- * is not scrolled to the top.
1286
- */
1287
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl && cachedScrollEl.scrollTop > 0) {
1288
- /**
1289
- * If expand to scroll is disabled, we need to make sure we swap the footer position
1290
- * back to stationary so that it will collapse correctly if the modal is dismissed without
1291
- * dragging (e.g. through a dismiss button).
1292
- * This can cause issues if the user has a modal with content that can be dragged, as we'll
1293
- * swap to moving on drag and if we don't swap back here then the footer will get stuck.
1294
- */
1295
- swapFooterPosition('stationary');
1296
- return;
1297
- }
1298
- /**
1299
- * When the gesture releases, we need to determine
1300
- * the closest breakpoint to snap to.
1301
- */
1302
- const velocity = detail.velocityY;
1303
- const threshold = (detail.deltaY + velocity * 350) / height;
1304
- const diff = currentBreakpoint - threshold;
1305
- const closest = breakpoints.reduce((a, b) => {
1306
- return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
1307
- });
1308
- moveSheetToBreakpoint({
1309
- breakpoint: closest,
1310
- breakpointOffset: offset,
1311
- canDismiss: canDismissBlocksGesture,
1312
- /**
1313
- * The swipe is user-driven, so we should
1314
- * always animate when the gesture ends.
1315
- */
1316
- animated: true,
1317
- });
1318
- };
1319
- const moveSheetToBreakpoint = (options) => {
1320
- const { breakpoint, canDismiss, breakpointOffset, animated } = options;
1321
- /**
1322
- * canDismiss should only prevent snapping
1323
- * when users are trying to dismiss. If canDismiss
1324
- * is present but the user is trying to swipe upwards,
1325
- * we should allow that to happen,
1326
- */
1327
- const shouldPreventDismiss = canDismiss && breakpoint === 0;
1328
- const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
1329
- const shouldRemainOpen = snapToBreakpoint !== 0;
1330
- currentBreakpoint = 0;
1331
- /**
1332
- * Update the animation so that it plays from
1333
- * the last offset to the closest snap point.
1334
- */
1335
- if (wrapperAnimation && backdropAnimation) {
1336
- wrapperAnimation.keyframes([
1337
- { offset: 0, transform: `translateY(${breakpointOffset * 100}%)` },
1338
- { offset: 1, transform: `translateY(${(1 - snapToBreakpoint) * 100}%)` },
1339
- ]);
1340
- backdropAnimation.keyframes([
1341
- {
1342
- offset: 0,
1343
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
1344
- },
1345
- {
1346
- offset: 1,
1347
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
1348
- },
1349
- ]);
1350
- if (contentAnimation) {
1351
- /**
1352
- * The modal content should scroll at any breakpoint when expandToScroll
1353
- * is disabled. In order to do this, the content needs to be completely
1354
- * viewable so scrolling can access everything. Otherwise, the default
1355
- * behavior would show the content off the screen and only allow
1356
- * scrolling when the sheet is fully expanded.
1357
- */
1358
- contentAnimation.keyframes([
1359
- { offset: 0, maxHeight: `${(1 - breakpointOffset) * 100}%` },
1360
- { offset: 1, maxHeight: `${snapToBreakpoint * 100}%` },
1361
- ]);
1362
- }
1363
- animation.progressStep(0);
1364
- }
1365
- /**
1366
- * Gesture should remain disabled until the
1367
- * snapping animation completes.
1368
- */
1369
- gesture.enable(false);
1370
- if (shouldPreventDismiss) {
1371
- handleCanDismiss(baseEl, animation);
1372
- }
1373
- else if (!shouldRemainOpen) {
1374
- onDismiss();
1375
- }
1376
- /**
1377
- * Enables scrolling immediately if the sheet is about to fully expand
1378
- * or if it allows scrolling at any breakpoint. Without this, there would
1379
- * be a ~500ms delay while the modal animation completes, causing a
1380
- * noticeable lag. Native iOS allows scrolling as soon as the gesture is
1381
- * released, so we align with that behavior.
1382
- */
1383
- if (contentEl && (snapToBreakpoint === breakpoints[breakpoints.length - 1] || !expandToScroll)) {
1384
- contentEl.scrollY = true;
1385
- }
1386
- /**
1387
- * If expandToScroll is disabled and we're animating
1388
- * to close the sheet, we need to swap
1389
- * the footer position to stationary so that it
1390
- * will collapse correctly. We cannot just always swap
1391
- * here or it'll be jittery while animating movement.
1392
- */
1393
- if (!expandToScroll && snapToBreakpoint === 0) {
1394
- swapFooterPosition('stationary');
1395
- }
1396
- return new Promise((resolve) => {
1397
- animation
1398
- .onFinish(() => {
1399
- if (shouldRemainOpen) {
1400
- /**
1401
- * If expandToScroll is disabled, we need to swap
1402
- * the footer position to stationary so that it
1403
- * will act as it would by default.
1404
- */
1405
- if (!expandToScroll) {
1406
- swapFooterPosition('stationary');
1407
- }
1408
- /**
1409
- * Once the snapping animation completes,
1410
- * we need to reset the animation to go
1411
- * from 0 to 1 so users can swipe in any direction.
1412
- * We then set the animation offset to the current
1413
- * breakpoint so that it starts at the snapped position.
1414
- */
1415
- if (wrapperAnimation && backdropAnimation) {
1416
- raf(() => {
1417
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
1418
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
1419
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
1420
- animation.progressStart(true, 1 - snapToBreakpoint);
1421
- currentBreakpoint = snapToBreakpoint;
1422
- onBreakpointChange(currentBreakpoint);
1423
- /**
1424
- * Backdrop should become enabled
1425
- * after the backdropBreakpoint value
1426
- */
1427
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint &&
1428
- baseEl.focusTrap !== false &&
1429
- baseEl.showBackdrop !== false;
1430
- if (shouldEnableBackdrop) {
1431
- enableBackdrop();
1432
- }
1433
- else {
1434
- disableBackdrop();
1435
- }
1436
- gesture.enable(true);
1437
- resolve();
1438
- });
1439
- }
1440
- else {
1441
- gesture.enable(true);
1442
- resolve();
1443
- }
1444
- }
1445
- else {
1446
- resolve();
1447
- }
1448
- /**
1449
- * This must be a one time callback
1450
- * otherwise a new callback will
1451
- * be added every time onEnd runs.
1452
- */
1453
- }, { oneTimeCallback: true })
1454
- .progressEnd(1, 0, animated ? 500 : 0);
1455
- });
1456
- };
1457
- const gesture = createGesture({
1458
- el: wrapperEl,
1459
- gestureName: 'modalSheet',
1460
- gesturePriority: 40,
1461
- direction: 'y',
1462
- threshold: 10,
1463
- canStart,
1464
- onStart,
1465
- onMove,
1466
- onEnd,
1467
- });
1468
- return {
1469
- gesture,
1470
- moveSheetToBreakpoint,
1471
- };
1472
- };
1473
-
1474
- 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(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}: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}";
1475
-
1476
- 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(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}: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}";
1477
-
1478
- const Modal = /*@__PURE__*/ proxyCustomElement(class Modal extends HTMLElement {
1479
- constructor(registerHost) {
1480
- super();
1481
- if (registerHost !== false) {
1482
- this.__registerHost();
1483
- }
1484
- this.__attachShadow();
1485
- this.didPresent = createEvent(this, "ionModalDidPresent", 7);
1486
- this.willPresent = createEvent(this, "ionModalWillPresent", 7);
1487
- this.willDismiss = createEvent(this, "ionModalWillDismiss", 7);
1488
- this.didDismiss = createEvent(this, "ionModalDidDismiss", 7);
1489
- this.ionBreakpointDidChange = createEvent(this, "ionBreakpointDidChange", 7);
1490
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
1491
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
1492
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
1493
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
1494
- this.ionMount = createEvent(this, "ionMount", 7);
1495
- this.lockController = createLockController();
1496
- this.triggerController = createTriggerController();
1497
- this.coreDelegate = CoreDelegate();
1498
- this.isSheetModal = false;
1499
- this.inheritedAttributes = {};
1500
- this.inline = false;
1501
- // Whether or not modal is being dismissed via gesture
1502
- this.gestureAnimationDismissing = false;
1503
- this.presented = false;
1504
- /** @internal */
1505
- this.hasController = false;
1506
- /**
1507
- * If `true`, the keyboard will be automatically dismissed when the overlay is presented.
1508
- */
1509
- this.keyboardClose = true;
1510
- /**
1511
- * Controls whether scrolling or dragging within the sheet modal expands
1512
- * it to a larger breakpoint. This only takes effect when `breakpoints`
1513
- * and `initialBreakpoint` are set.
1514
- *
1515
- * If `true`, scrolling or dragging anywhere in the modal will first expand
1516
- * it to the next breakpoint. Once fully expanded, scrolling will affect the
1517
- * content.
1518
- * If `false`, scrolling will always affect the content. The modal will
1519
- * only expand when dragging the header or handle. The modal will close when
1520
- * dragging the header or handle. It can also be closed when dragging the
1521
- * content, but only if the content is scrolled to the top.
1522
- */
1523
- this.expandToScroll = true;
1524
- /**
1525
- * A decimal value between 0 and 1 that indicates the
1526
- * point after which the backdrop will begin to fade in
1527
- * when using a sheet modal. Prior to this point, the
1528
- * backdrop will be hidden and the content underneath
1529
- * the sheet can be interacted with. This value is exclusive
1530
- * meaning the backdrop will become active after the value
1531
- * specified.
1532
- */
1533
- this.backdropBreakpoint = 0;
1534
- /**
1535
- * The interaction behavior for the sheet modal when the handle is pressed.
1536
- *
1537
- * Defaults to `"none"`, which means the modal will not change size or position when the handle is pressed.
1538
- * Set to `"cycle"` to let the modal cycle between available breakpoints when pressed.
1539
- *
1540
- * Handle behavior is unavailable when the `handle` property is set to `false` or
1541
- * when the `breakpoints` property is not set (using a fullscreen or card modal).
1542
- */
1543
- this.handleBehavior = 'none';
1544
- /**
1545
- * If `true`, the modal will be dismissed when the backdrop is clicked.
1546
- */
1547
- this.backdropDismiss = true;
1548
- /**
1549
- * If `true`, a backdrop will be displayed behind the modal.
1550
- * This property controls whether or not the backdrop
1551
- * darkens the screen when the modal is presented.
1552
- * It does not control whether or not the backdrop
1553
- * is active or present in the DOM.
1554
- */
1555
- this.showBackdrop = true;
1556
- /**
1557
- * If `true`, the modal will animate.
1558
- */
1559
- this.animated = true;
1560
- /**
1561
- * If `true`, the modal will open. If `false`, the modal will close.
1562
- * Use this if you need finer grained control over presentation, otherwise
1563
- * just use the modalController or the `trigger` property.
1564
- * Note: `isOpen` will not automatically be set back to `false` when
1565
- * the modal dismisses. You will need to do that in your code.
1566
- */
1567
- this.isOpen = false;
1568
- /**
1569
- * If `true`, the component passed into `ion-modal` will
1570
- * automatically be mounted when the modal is created. The
1571
- * component will remain mounted even when the modal is dismissed.
1572
- * However, the component will be destroyed when the modal is
1573
- * destroyed. This property is not reactive and should only be
1574
- * used when initially creating a modal.
1575
- *
1576
- * Note: This feature only applies to inline modals in JavaScript
1577
- * frameworks such as Angular, React, and Vue.
1578
- */
1579
- this.keepContentsMounted = false;
1580
- /**
1581
- * If `true`, focus will not be allowed to move outside of this overlay.
1582
- * If `false`, focus will be allowed to move outside of the overlay.
1583
- *
1584
- * In most scenarios this property should remain set to `true`. Setting
1585
- * this property to `false` can cause severe accessibility issues as users
1586
- * relying on assistive technologies may be able to move focus into
1587
- * a confusing state. We recommend only setting this to `false` when
1588
- * absolutely necessary.
1589
- *
1590
- * Developers may want to consider disabling focus trapping if this
1591
- * overlay presents a non-Ionic overlay from a 3rd party library.
1592
- * Developers would disable focus trapping on the Ionic overlay
1593
- * when presenting the 3rd party overlay and then re-enable
1594
- * focus trapping when dismissing the 3rd party overlay and moving
1595
- * focus back to the Ionic overlay.
1596
- */
1597
- this.focusTrap = true;
1598
- /**
1599
- * Determines whether or not a modal can dismiss
1600
- * when calling the `dismiss` method.
1601
- *
1602
- * If the value is `true` or the value's function returns `true`, the modal will close when trying to dismiss.
1603
- * If the value is `false` or the value's function returns `false`, the modal will not close when trying to dismiss.
1604
- *
1605
- * See https://ionicframework.com/docs/troubleshooting/runtime#accessing-this
1606
- * if you need to access `this` from within the callback.
1607
- */
1608
- this.canDismiss = true;
1609
- this.onHandleClick = () => {
1610
- const { sheetTransition, handleBehavior } = this;
1611
- if (handleBehavior !== 'cycle' || sheetTransition !== undefined) {
1612
- /**
1613
- * The sheet modal should not advance to the next breakpoint
1614
- * if the handle behavior is not `cycle` or if the handle
1615
- * is clicked while the sheet is moving to a breakpoint.
1616
- */
1617
- return;
1618
- }
1619
- this.moveToNextBreakpoint();
1620
- };
1621
- this.onBackdropTap = () => {
1622
- const { sheetTransition } = this;
1623
- if (sheetTransition !== undefined) {
1624
- /**
1625
- * When the handle is double clicked at the largest breakpoint,
1626
- * it will start to move to the first breakpoint. While transitioning,
1627
- * the backdrop will often receive the second click. We prevent the
1628
- * backdrop from dismissing the modal while moving between breakpoints.
1629
- */
1630
- return;
1631
- }
1632
- this.dismiss(undefined, BACKDROP);
1633
- };
1634
- this.onLifecycle = (modalEvent) => {
1635
- const el = this.usersElement;
1636
- const name = LIFECYCLE_MAP[modalEvent.type];
1637
- if (el && name) {
1638
- const ev = new CustomEvent(name, {
1639
- bubbles: false,
1640
- cancelable: false,
1641
- detail: modalEvent.detail,
1642
- });
1643
- el.dispatchEvent(ev);
1644
- }
1645
- };
1646
- /**
1647
- * When the modal receives focus directly, pass focus to the handle
1648
- * if it exists and is focusable, otherwise let the focus trap handle it.
1649
- */
1650
- this.onModalFocus = (ev) => {
1651
- const { dragHandleEl, el } = this;
1652
- // Only handle focus if the modal itself was focused (not a child element)
1653
- if (ev.target === el && dragHandleEl && dragHandleEl.tabIndex !== -1) {
1654
- dragHandleEl.focus();
1655
- }
1656
- };
1657
- /**
1658
- * When the slot changes, we need to find all the modals in the slot
1659
- * and set the data-parent-ion-modal attribute on them so we can find them
1660
- * and dismiss them when we get dismissed.
1661
- * We need to do it this way because when a modal is opened, it's moved to
1662
- * the end of the body and is no longer an actual child of the modal.
1663
- */
1664
- this.onSlotChange = ({ target }) => {
1665
- const slot = target;
1666
- slot.assignedElements().forEach((el) => {
1667
- el.querySelectorAll('ion-modal').forEach((childModal) => {
1668
- // We don't need to write to the DOM if the modal is already tagged
1669
- // If this is a deeply nested modal, this effect should cascade so we don't
1670
- // need to worry about another modal claiming the same child.
1671
- if (childModal.getAttribute('data-parent-ion-modal') === null) {
1672
- childModal.setAttribute('data-parent-ion-modal', this.el.id);
1673
- }
1674
- });
1675
- });
1676
- };
1677
- }
1678
- onIsOpenChange(newValue, oldValue) {
1679
- if (newValue === true && oldValue === false) {
1680
- this.present();
1681
- }
1682
- else if (newValue === false && oldValue === true) {
1683
- this.dismiss();
1684
- }
1685
- }
1686
- triggerChanged() {
1687
- const { trigger, el, triggerController } = this;
1688
- if (trigger) {
1689
- triggerController.addClickListener(el, trigger);
1690
- }
1691
- }
1692
- onWindowResize() {
1693
- // Only handle resize for iOS card modals when no custom animations are provided
1694
- if (getIonMode(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
1695
- return;
1696
- }
1697
- clearTimeout(this.resizeTimeout);
1698
- this.resizeTimeout = setTimeout(() => {
1699
- this.handleViewTransition();
1700
- }, 50); // Debounce to avoid excessive calls during active resizing
1701
- }
1702
- breakpointsChanged(breakpoints) {
1703
- if (breakpoints !== undefined) {
1704
- this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
1705
- }
1706
- }
1707
- connectedCallback() {
1708
- const { el } = this;
1709
- prepareOverlay(el);
1710
- this.triggerChanged();
1711
- }
1712
- disconnectedCallback() {
1713
- this.triggerController.removeClickListener();
1714
- this.cleanupViewTransitionListener();
1715
- this.cleanupParentRemovalObserver();
1716
- }
1717
- componentWillLoad() {
1718
- var _a;
1719
- const { breakpoints, initialBreakpoint, el, htmlAttributes } = this;
1720
- const isSheetModal = (this.isSheetModal = breakpoints !== undefined && initialBreakpoint !== undefined);
1721
- const attributesToInherit = ['aria-label', 'role'];
1722
- this.inheritedAttributes = inheritAttributes(el, attributesToInherit);
1723
- // Cache original parent before modal gets moved to body during presentation
1724
- if (el.parentNode) {
1725
- this.cachedOriginalParent = el.parentNode;
1726
- }
1727
- /**
1728
- * When using a controller modal you can set attributes
1729
- * using the htmlAttributes property. Since the above attributes
1730
- * need to be inherited inside of the modal, we need to look
1731
- * and see if these attributes are being set via htmlAttributes.
1732
- *
1733
- * We could alternatively move this to componentDidLoad to simplify the work
1734
- * here, but we'd then need to make inheritedAttributes a State variable,
1735
- * thus causing another render to always happen after the first render.
1736
- */
1737
- if (htmlAttributes !== undefined) {
1738
- attributesToInherit.forEach((attribute) => {
1739
- const attributeValue = htmlAttributes[attribute];
1740
- if (attributeValue) {
1741
- /**
1742
- * If an attribute we need to inherit was
1743
- * set using htmlAttributes then add it to
1744
- * inheritedAttributes and remove it from htmlAttributes.
1745
- * This ensures the attribute is inherited and not
1746
- * set on the host.
1747
- *
1748
- * In this case, if an inherited attribute is set
1749
- * on the host element and using htmlAttributes then
1750
- * htmlAttributes wins, but that's not a pattern that we recommend.
1751
- * The only time you'd need htmlAttributes is when using modalController.
1752
- */
1753
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attribute]: htmlAttributes[attribute] });
1754
- delete htmlAttributes[attribute];
1755
- }
1756
- });
1757
- }
1758
- if (isSheetModal) {
1759
- this.currentBreakpoint = this.initialBreakpoint;
1760
- }
1761
- if (breakpoints !== undefined && initialBreakpoint !== undefined && !breakpoints.includes(initialBreakpoint)) {
1762
- printIonWarning('[ion-modal] - Your breakpoints array must include the initialBreakpoint value.');
1763
- }
1764
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
1765
- setOverlayId(this.el);
1766
- }
1767
- }
1768
- componentDidLoad() {
1769
- /**
1770
- * If modal was rendered with isOpen="true"
1771
- * then we should open modal immediately.
1772
- */
1773
- if (this.isOpen === true) {
1774
- raf(() => this.present());
1775
- }
1776
- this.breakpointsChanged(this.breakpoints);
1777
- /**
1778
- * When binding values in frameworks such as Angular
1779
- * it is possible for the value to be set after the Web Component
1780
- * initializes but before the value watcher is set up in Stencil.
1781
- * As a result, the watcher callback may not be fired.
1782
- * We work around this by manually calling the watcher
1783
- * callback when the component has loaded and the watcher
1784
- * is configured.
1785
- */
1786
- this.triggerChanged();
1787
- }
1788
- /**
1789
- * Determines whether or not an overlay
1790
- * is being used inline or via a controller/JS
1791
- * and returns the correct delegate.
1792
- * By default, subsequent calls to getDelegate
1793
- * will use a cached version of the delegate.
1794
- * This is useful for calling dismiss after
1795
- * present so that the correct delegate is given.
1796
- */
1797
- getDelegate(force = false) {
1798
- if (this.workingDelegate && !force) {
1799
- return {
1800
- delegate: this.workingDelegate,
1801
- inline: this.inline,
1802
- };
1803
- }
1804
- /**
1805
- * If using overlay inline
1806
- * we potentially need to use the coreDelegate
1807
- * so that this works in vanilla JS apps.
1808
- * If a developer has presented this component
1809
- * via a controller, then we can assume
1810
- * the component is already in the
1811
- * correct place.
1812
- */
1813
- const parentEl = this.el.parentNode;
1814
- const inline = (this.inline = parentEl !== null && !this.hasController);
1815
- const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
1816
- return { inline, delegate };
1817
- }
1818
- /**
1819
- * Determines whether or not the
1820
- * modal is allowed to dismiss based
1821
- * on the state of the canDismiss prop.
1822
- */
1823
- async checkCanDismiss(data, role) {
1824
- const { canDismiss } = this;
1825
- if (typeof canDismiss === 'function') {
1826
- return canDismiss(data, role);
1827
- }
1828
- return canDismiss;
1829
- }
1830
- /**
1831
- * Present the modal overlay after it has been created.
1832
- */
1833
- async present() {
1834
- const unlock = await this.lockController.lock();
1835
- if (this.presented) {
1836
- unlock();
1837
- return;
1838
- }
1839
- const { presentingElement, el } = this;
1840
- /**
1841
- * If the modal is presented multiple times (inline modals), we
1842
- * need to reset the current breakpoint to the initial breakpoint.
1843
- */
1844
- this.currentBreakpoint = this.initialBreakpoint;
1845
- const { inline, delegate } = this.getDelegate(true);
1846
- /**
1847
- * Emit ionMount so JS Frameworks have an opportunity
1848
- * to add the child component to the DOM. The child
1849
- * component will be assigned to this.usersElement below.
1850
- */
1851
- this.ionMount.emit();
1852
- this.usersElement = await attachComponent(delegate, el, this.component, ['ion-page'], this.componentProps, inline);
1853
- /**
1854
- * When using the lazy loaded build of Stencil, we need to wait
1855
- * for every Stencil component instance to be ready before presenting
1856
- * otherwise there can be a flash of unstyled content. With the
1857
- * custom elements bundle we need to wait for the JS framework
1858
- * mount the inner contents of the overlay otherwise WebKit may
1859
- * get the transition incorrect.
1860
- */
1861
- if (hasLazyBuild(el)) {
1862
- await deepReady(this.usersElement);
1863
- /**
1864
- * If keepContentsMounted="true" then the
1865
- * JS Framework has already mounted the inner
1866
- * contents so there is no need to wait.
1867
- * Otherwise, we need to wait for the JS
1868
- * Framework to mount the inner contents
1869
- * of this component.
1870
- */
1871
- }
1872
- else if (!this.keepContentsMounted) {
1873
- await waitForMount();
1874
- }
1875
- writeTask(() => this.el.classList.add('show-modal'));
1876
- const hasCardModal = presentingElement !== undefined;
1877
- /**
1878
- * We need to change the status bar at the
1879
- * start of the animation so that it completes
1880
- * by the time the card animation is done.
1881
- */
1882
- if (hasCardModal && getIonMode(this) === 'ios') {
1883
- // Cache the original status bar color before the modal is presented
1884
- this.statusBarStyle = await StatusBar.getStyle();
1885
- setCardStatusBarDark();
1886
- }
1887
- await present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
1888
- presentingEl: presentingElement,
1889
- currentBreakpoint: this.initialBreakpoint,
1890
- backdropBreakpoint: this.backdropBreakpoint,
1891
- expandToScroll: this.expandToScroll,
1892
- });
1893
- /* tslint:disable-next-line */
1894
- if (typeof window !== 'undefined') {
1895
- /**
1896
- * This needs to be setup before any
1897
- * non-transition async work so it can be dereferenced
1898
- * in the dismiss method. The dismiss method
1899
- * only waits for the entering transition
1900
- * to finish. It does not wait for all of the `present`
1901
- * method to resolve.
1902
- */
1903
- this.keyboardOpenCallback = () => {
1904
- if (this.gesture) {
1905
- /**
1906
- * When the native keyboard is opened and the webview
1907
- * is resized, the gesture implementation will become unresponsive
1908
- * and enter a free-scroll mode.
1909
- *
1910
- * When the keyboard is opened, we disable the gesture for
1911
- * a single frame and re-enable once the contents have repositioned
1912
- * from the keyboard placement.
1913
- */
1914
- this.gesture.enable(false);
1915
- raf(() => {
1916
- if (this.gesture) {
1917
- this.gesture.enable(true);
1918
- }
1919
- });
1920
- }
1921
- };
1922
- window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
1923
- }
1924
- /**
1925
- * Recalculate isSheetModal because framework bindings (e.g., Angular)
1926
- * may not have been applied when componentWillLoad ran.
1927
- */
1928
- const isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
1929
- this.isSheetModal = isSheetModal;
1930
- if (isSheetModal) {
1931
- this.initSheetGesture();
1932
- }
1933
- else if (hasCardModal) {
1934
- this.initSwipeToClose();
1935
- }
1936
- // Initialize view transition listener for iOS card modals
1937
- this.initViewTransitionListener();
1938
- // Initialize parent removal observer
1939
- this.initParentRemovalObserver();
1940
- unlock();
1941
- }
1942
- initSwipeToClose() {
1943
- var _a;
1944
- if (getIonMode(this) !== 'ios') {
1945
- return;
1946
- }
1947
- const { el } = this;
1948
- // All of the elements needed for the swipe gesture
1949
- // should be in the DOM and referenced by now, except
1950
- // for the presenting el
1951
- const animationBuilder = this.leaveAnimation || config.get('modalLeave', iosLeaveAnimation);
1952
- const ani = (this.animation = animationBuilder(el, {
1953
- presentingEl: this.presentingElement,
1954
- expandToScroll: this.expandToScroll,
1955
- }));
1956
- const contentEl = findIonContent(el);
1957
- if (!contentEl) {
1958
- printIonContentErrorMsg(el);
1959
- return;
1960
- }
1961
- const statusBarStyle = (_a = this.statusBarStyle) !== null && _a !== void 0 ? _a : Style.Default;
1962
- this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
1963
- /**
1964
- * While the gesture animation is finishing
1965
- * it is possible for a user to tap the backdrop.
1966
- * This would result in the dismiss animation
1967
- * being played again. Typically this is avoided
1968
- * by setting `presented = false` on the overlay
1969
- * component; however, we cannot do that here as
1970
- * that would prevent the element from being
1971
- * removed from the DOM.
1972
- */
1973
- this.gestureAnimationDismissing = true;
1974
- /**
1975
- * Reset the status bar style as the dismiss animation
1976
- * starts otherwise the status bar will be the wrong
1977
- * color for the duration of the dismiss animation.
1978
- * The dismiss method does this as well, but
1979
- * in this case it's only called once the animation
1980
- * has finished.
1981
- */
1982
- setCardStatusBarDefault(this.statusBarStyle);
1983
- this.animation.onFinish(async () => {
1984
- await this.dismiss(undefined, GESTURE);
1985
- this.gestureAnimationDismissing = false;
1986
- });
1987
- });
1988
- this.gesture.enable(true);
1989
- }
1990
- initSheetGesture() {
1991
- const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
1992
- if (!wrapperEl || initialBreakpoint === undefined) {
1993
- return;
1994
- }
1995
- const animationBuilder = this.enterAnimation || config.get('modalEnter', iosEnterAnimation);
1996
- const ani = (this.animation = animationBuilder(this.el, {
1997
- presentingEl: this.presentingElement,
1998
- currentBreakpoint: initialBreakpoint,
1999
- backdropBreakpoint,
2000
- expandToScroll: this.expandToScroll,
2001
- }));
2002
- ani.progressStart(true, 1);
2003
- const { gesture, moveSheetToBreakpoint } = createSheetGesture(this.el, this.backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, ani, this.sortedBreakpoints, this.expandToScroll, () => { var _a; return (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : 0; }, () => this.sheetOnDismiss(), (breakpoint) => {
2004
- if (this.currentBreakpoint !== breakpoint) {
2005
- this.currentBreakpoint = breakpoint;
2006
- this.ionBreakpointDidChange.emit({ breakpoint });
2007
- }
2008
- });
2009
- this.gesture = gesture;
2010
- this.moveSheetToBreakpoint = moveSheetToBreakpoint;
2011
- this.gesture.enable(true);
2012
- /**
2013
- * When backdrop interaction is allowed, nested router outlets from child routes
2014
- * may block pointer events to parent content. Apply passthrough styles only when
2015
- * the modal was the sole content of a child route page.
2016
- * See https://github.com/ionic-team/ionic-framework/issues/30700
2017
- */
2018
- const backdropNotBlocking = this.showBackdrop === false || this.focusTrap === false || backdropBreakpoint > 0;
2019
- if (backdropNotBlocking) {
2020
- this.setupChildRoutePassthrough();
2021
- }
2022
- }
2023
- /**
2024
- * For sheet modals that allow background interaction, sets up pointer-events
2025
- * passthrough on child route page wrappers and nested router outlets.
2026
- */
2027
- setupChildRoutePassthrough() {
2028
- var _a;
2029
- // Cache the page parent for cleanup
2030
- this.cachedPageParent = this.getOriginalPageParent();
2031
- const pageParent = this.cachedPageParent;
2032
- // Skip ion-app (controller modals) and pages with visible sibling content next to the modal
2033
- if (!pageParent || pageParent.tagName === 'ION-APP') {
2034
- return;
2035
- }
2036
- const hasVisibleContent = Array.from(pageParent.children).some((child) => {
2037
- var _a;
2038
- return child !== this.el &&
2039
- !(child instanceof HTMLElement && window.getComputedStyle(child).display === 'none') &&
2040
- child.tagName !== 'TEMPLATE' &&
2041
- child.tagName !== 'SLOT' &&
2042
- !(child.nodeType === Node.TEXT_NODE && !((_a = child.textContent) === null || _a === void 0 ? void 0 : _a.trim()));
2043
- });
2044
- if (hasVisibleContent) {
2045
- return;
2046
- }
2047
- // Child route case: page only contained the modal
2048
- pageParent.classList.add('ion-page-overlay-passthrough');
2049
- // Also make nested router outlets passthrough
2050
- const routerOutlet = pageParent.parentElement;
2051
- if ((routerOutlet === null || routerOutlet === void 0 ? void 0 : routerOutlet.tagName) === 'ION-ROUTER-OUTLET' && ((_a = routerOutlet.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) !== 'ION-APP') {
2052
- routerOutlet.style.setProperty('pointer-events', 'none');
2053
- routerOutlet.setAttribute('data-overlay-passthrough', 'true');
2054
- }
2055
- }
2056
- /**
2057
- * Finds the ion-page ancestor of the modal's original parent location.
2058
- */
2059
- getOriginalPageParent() {
2060
- if (!this.cachedOriginalParent) {
2061
- return null;
2062
- }
2063
- let pageParent = this.cachedOriginalParent;
2064
- while (pageParent && !pageParent.classList.contains('ion-page')) {
2065
- pageParent = pageParent.parentElement;
2066
- }
2067
- return pageParent;
2068
- }
2069
- /**
2070
- * Removes passthrough styles added by setupChildRoutePassthrough.
2071
- */
2072
- cleanupChildRoutePassthrough() {
2073
- const pageParent = this.cachedPageParent;
2074
- if (!pageParent) {
2075
- return;
2076
- }
2077
- pageParent.classList.remove('ion-page-overlay-passthrough');
2078
- const routerOutlet = pageParent.parentElement;
2079
- if (routerOutlet === null || routerOutlet === void 0 ? void 0 : routerOutlet.hasAttribute('data-overlay-passthrough')) {
2080
- routerOutlet.style.removeProperty('pointer-events');
2081
- routerOutlet.removeAttribute('data-overlay-passthrough');
2082
- }
2083
- // Clear the cached reference
2084
- this.cachedPageParent = undefined;
2085
- }
2086
- sheetOnDismiss() {
2087
- /**
2088
- * While the gesture animation is finishing
2089
- * it is possible for a user to tap the backdrop.
2090
- * This would result in the dismiss animation
2091
- * being played again. Typically this is avoided
2092
- * by setting `presented = false` on the overlay
2093
- * component; however, we cannot do that here as
2094
- * that would prevent the element from being
2095
- * removed from the DOM.
2096
- */
2097
- this.gestureAnimationDismissing = true;
2098
- this.animation.onFinish(async () => {
2099
- this.currentBreakpoint = 0;
2100
- this.ionBreakpointDidChange.emit({ breakpoint: this.currentBreakpoint });
2101
- await this.dismiss(undefined, GESTURE);
2102
- this.gestureAnimationDismissing = false;
2103
- });
2104
- }
2105
- /**
2106
- * Dismiss the modal overlay after it has been presented.
2107
- * This is a no-op if the overlay has not been presented yet. If you want
2108
- * to remove an overlay from the DOM that was never presented, use the
2109
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
2110
- *
2111
- * @param data Any data to emit in the dismiss events.
2112
- * @param role The role of the element that is dismissing the modal.
2113
- * For example, `cancel` or `backdrop`.
2114
- */
2115
- async dismiss(data, role) {
2116
- var _a;
2117
- if (this.gestureAnimationDismissing && role !== GESTURE) {
2118
- return false;
2119
- }
2120
- /**
2121
- * Because the canDismiss check below is async,
2122
- * we need to claim a lock before the check happens,
2123
- * in case the dismiss transition does run.
2124
- */
2125
- const unlock = await this.lockController.lock();
2126
- /**
2127
- * Dismiss all child modals. This is especially important in
2128
- * Angular and React because it's possible to lose control of a child
2129
- * modal when the parent modal is dismissed.
2130
- */
2131
- await this.dismissNestedModals();
2132
- /**
2133
- * If a canDismiss handler is responsible
2134
- * for calling the dismiss method, we should
2135
- * not run the canDismiss check again.
2136
- */
2137
- if (role !== 'handler' && !(await this.checkCanDismiss(data, role))) {
2138
- unlock();
2139
- return false;
2140
- }
2141
- const { presentingElement } = this;
2142
- /**
2143
- * We need to start the status bar change
2144
- * before the animation so that the change
2145
- * finishes when the dismiss animation does.
2146
- */
2147
- const hasCardModal = presentingElement !== undefined;
2148
- if (hasCardModal && getIonMode(this) === 'ios') {
2149
- setCardStatusBarDefault(this.statusBarStyle);
2150
- }
2151
- /* tslint:disable-next-line */
2152
- if (typeof window !== 'undefined' && this.keyboardOpenCallback) {
2153
- window.removeEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
2154
- this.keyboardOpenCallback = undefined;
2155
- }
2156
- const dismissed = await dismiss(this, data, role, 'modalLeave', iosLeaveAnimation, mdLeaveAnimation, {
2157
- presentingEl: presentingElement,
2158
- currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
2159
- backdropBreakpoint: this.backdropBreakpoint,
2160
- expandToScroll: this.expandToScroll,
2161
- });
2162
- if (dismissed) {
2163
- const { delegate } = this.getDelegate();
2164
- await detachComponent(delegate, this.usersElement);
2165
- writeTask(() => this.el.classList.remove('show-modal'));
2166
- if (this.animation) {
2167
- this.animation.destroy();
2168
- }
2169
- if (this.gesture) {
2170
- this.gesture.destroy();
2171
- }
2172
- this.cleanupViewTransitionListener();
2173
- this.cleanupParentRemovalObserver();
2174
- this.cleanupChildRoutePassthrough();
2175
- }
2176
- this.currentBreakpoint = undefined;
2177
- this.animation = undefined;
2178
- unlock();
2179
- return dismissed;
2180
- }
2181
- /**
2182
- * Returns a promise that resolves when the modal did dismiss.
2183
- */
2184
- onDidDismiss() {
2185
- return eventMethod(this.el, 'ionModalDidDismiss');
2186
- }
2187
- /**
2188
- * Returns a promise that resolves when the modal will dismiss.
2189
- */
2190
- onWillDismiss() {
2191
- return eventMethod(this.el, 'ionModalWillDismiss');
2192
- }
2193
- /**
2194
- * Move a sheet style modal to a specific breakpoint.
2195
- *
2196
- * @param breakpoint The breakpoint value to move the sheet modal to.
2197
- * Must be a value defined in your `breakpoints` array.
2198
- */
2199
- async setCurrentBreakpoint(breakpoint) {
2200
- if (!this.isSheetModal) {
2201
- printIonWarning('[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.');
2202
- return;
2203
- }
2204
- if (!this.breakpoints.includes(breakpoint)) {
2205
- printIonWarning(`[ion-modal] - Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.`);
2206
- return;
2207
- }
2208
- const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints, animated } = this;
2209
- if (currentBreakpoint === breakpoint) {
2210
- return;
2211
- }
2212
- if (moveSheetToBreakpoint) {
2213
- this.sheetTransition = moveSheetToBreakpoint({
2214
- breakpoint,
2215
- breakpointOffset: 1 - currentBreakpoint,
2216
- canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints[0] === 0,
2217
- animated,
2218
- });
2219
- await this.sheetTransition;
2220
- this.sheetTransition = undefined;
2221
- }
2222
- }
2223
- /**
2224
- * Returns the current breakpoint of a sheet style modal
2225
- */
2226
- async getCurrentBreakpoint() {
2227
- return this.currentBreakpoint;
2228
- }
2229
- async moveToNextBreakpoint() {
2230
- const { breakpoints, currentBreakpoint } = this;
2231
- if (!breakpoints || currentBreakpoint == null) {
2232
- /**
2233
- * If the modal does not have breakpoints and/or the current
2234
- * breakpoint is not set, we can't move to the next breakpoint.
2235
- */
2236
- return false;
2237
- }
2238
- const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
2239
- const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
2240
- const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
2241
- const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
2242
- /**
2243
- * Sets the current breakpoint to the next available breakpoint.
2244
- * If the current breakpoint is the last breakpoint, we set the current
2245
- * breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
2246
- */
2247
- await this.setCurrentBreakpoint(nextBreakpoint);
2248
- return true;
2249
- }
2250
- initViewTransitionListener() {
2251
- // Only enable for iOS card modals when no custom animations are provided
2252
- if (getIonMode(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
2253
- return;
2254
- }
2255
- // Set initial view state
2256
- this.currentViewIsPortrait = window.innerWidth < 768;
2257
- }
2258
- handleViewTransition() {
2259
- // Only run view transitions when the modal is presented
2260
- if (!this.presented) {
2261
- return;
2262
- }
2263
- const isPortrait = window.innerWidth < 768;
2264
- // Only transition if view state actually changed
2265
- if (this.currentViewIsPortrait === isPortrait) {
2266
- return;
2267
- }
2268
- // Cancel any ongoing transition animation
2269
- if (this.viewTransitionAnimation) {
2270
- this.viewTransitionAnimation.destroy();
2271
- this.viewTransitionAnimation = undefined;
2272
- }
2273
- const { presentingElement } = this;
2274
- if (!presentingElement) {
2275
- return;
2276
- }
2277
- // Create transition animation
2278
- let transitionAnimation;
2279
- if (this.currentViewIsPortrait && !isPortrait) {
2280
- // Portrait to landscape transition
2281
- transitionAnimation = portraitToLandscapeTransition(this.el, {
2282
- presentingEl: presentingElement});
2283
- }
2284
- else {
2285
- // Landscape to portrait transition
2286
- transitionAnimation = landscapeToPortraitTransition(this.el, {
2287
- presentingEl: presentingElement});
2288
- }
2289
- // Update state and play animation
2290
- this.currentViewIsPortrait = isPortrait;
2291
- this.viewTransitionAnimation = transitionAnimation;
2292
- transitionAnimation.play().then(() => {
2293
- this.viewTransitionAnimation = undefined;
2294
- // After orientation transition, recreate the swipe-to-close gesture
2295
- // with updated animation that reflects the new presenting element state
2296
- this.reinitSwipeToClose();
2297
- });
2298
- }
2299
- cleanupViewTransitionListener() {
2300
- // Clear any pending resize timeout
2301
- if (this.resizeTimeout) {
2302
- clearTimeout(this.resizeTimeout);
2303
- this.resizeTimeout = undefined;
2304
- }
2305
- if (this.viewTransitionAnimation) {
2306
- this.viewTransitionAnimation.destroy();
2307
- this.viewTransitionAnimation = undefined;
2308
- }
2309
- }
2310
- reinitSwipeToClose() {
2311
- // Only reinitialize if we have a presenting element and are on iOS
2312
- if (getIonMode(this) !== 'ios' || !this.presentingElement) {
2313
- return;
2314
- }
2315
- // Clean up existing gesture and animation
2316
- if (this.gesture) {
2317
- this.gesture.destroy();
2318
- this.gesture = undefined;
2319
- }
2320
- if (this.animation) {
2321
- // Properly end the progress-based animation at initial state before destroying
2322
- // to avoid leaving modal in intermediate swipe position
2323
- this.animation.progressEnd(0, 0, 0);
2324
- this.animation.destroy();
2325
- this.animation = undefined;
2326
- }
2327
- // Force the modal back to the correct position or it could end up
2328
- // in a weird state after destroying the animation
2329
- raf(() => {
2330
- this.ensureCorrectModalPosition();
2331
- this.initSwipeToClose();
2332
- });
2333
- }
2334
- ensureCorrectModalPosition() {
2335
- const { el, presentingElement } = this;
2336
- const root = getElementRoot(el);
2337
- const wrapperEl = root.querySelector('.modal-wrapper');
2338
- if (wrapperEl) {
2339
- wrapperEl.style.transform = 'translateY(0vh)';
2340
- wrapperEl.style.opacity = '1';
2341
- }
2342
- if ((presentingElement === null || presentingElement === void 0 ? void 0 : presentingElement.tagName) === 'ION-MODAL') {
2343
- const isPortrait = window.innerWidth < 768;
2344
- if (isPortrait) {
2345
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)')
2346
- ? '30px'
2347
- : 'max(30px, var(--ion-safe-area-top))';
2348
- const scale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
2349
- presentingElement.style.transform = `translateY(${transformOffset}) scale(${scale})`;
2350
- }
2351
- else {
2352
- presentingElement.style.transform = 'translateY(0px) scale(1)';
2353
- }
2354
- }
2355
- }
2356
- async dismissNestedModals() {
2357
- const nestedModals = document.querySelectorAll(`ion-modal[data-parent-ion-modal="${this.el.id}"]`);
2358
- nestedModals === null || nestedModals === void 0 ? void 0 : nestedModals.forEach(async (modal) => {
2359
- await modal.dismiss(undefined, 'parent-dismissed');
2360
- });
2361
- }
2362
- initParentRemovalObserver() {
2363
- if (typeof MutationObserver === 'undefined') {
2364
- return;
2365
- }
2366
- // Only observe if we have a cached parent and are in browser environment
2367
- if (typeof window === 'undefined' || !this.cachedOriginalParent) {
2368
- return;
2369
- }
2370
- // Don't observe document or fragment nodes as they can't be "removed"
2371
- if (this.cachedOriginalParent.nodeType === Node.DOCUMENT_NODE ||
2372
- this.cachedOriginalParent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
2373
- return;
2374
- }
2375
- /**
2376
- * Don't observe for controller-based modals or when the parent is the
2377
- * app root (document.body or ion-app). These parents won't be removed,
2378
- * and observing document.body with subtree: true causes performance
2379
- * issues with frameworks like Angular during change detection.
2380
- */
2381
- if (this.hasController ||
2382
- this.cachedOriginalParent === document.body ||
2383
- this.cachedOriginalParent.tagName === 'ION-APP') {
2384
- return;
2385
- }
2386
- this.parentRemovalObserver = new MutationObserver((mutations) => {
2387
- mutations.forEach((mutation) => {
2388
- if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
2389
- // Check if our cached original parent was removed
2390
- const cachedParentWasRemoved = Array.from(mutation.removedNodes).some((node) => {
2391
- var _a, _b;
2392
- const isDirectMatch = node === this.cachedOriginalParent;
2393
- const isContainedMatch = this.cachedOriginalParent
2394
- ? (_b = (_a = node).contains) === null || _b === void 0 ? void 0 : _b.call(_a, this.cachedOriginalParent)
2395
- : false;
2396
- return isDirectMatch || isContainedMatch;
2397
- });
2398
- // Also check if parent is no longer connected to DOM
2399
- const cachedParentDisconnected = this.cachedOriginalParent && !this.cachedOriginalParent.isConnected;
2400
- if (cachedParentWasRemoved || cachedParentDisconnected) {
2401
- this.dismiss(undefined, 'parent-removed');
2402
- // Release the reference to the cached original parent
2403
- // so we don't have a memory leak
2404
- this.cachedOriginalParent = undefined;
2405
- }
2406
- }
2407
- });
2408
- });
2409
- // Observe document body with subtree to catch removals at any level
2410
- this.parentRemovalObserver.observe(document.body, {
2411
- childList: true,
2412
- subtree: true,
2413
- });
2414
- }
2415
- cleanupParentRemovalObserver() {
2416
- var _a;
2417
- (_a = this.parentRemovalObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
2418
- this.parentRemovalObserver = undefined;
2419
- }
2420
- render() {
2421
- const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap, expandToScroll, } = this;
2422
- const showHandle = handle !== false && isSheetModal;
2423
- const mode = getIonMode(this);
2424
- const isCardModal = presentingElement !== undefined && mode === 'ios';
2425
- const isHandleCycle = handleBehavior === 'cycle';
2426
- const isSheetModalWithHandle = isSheetModal && showHandle;
2427
- return (h(Host, Object.assign({ key: '87328006ea6c75ebc518ace300438492a567223e', "no-router": true,
2428
- // Allow the modal to be navigable when the handle is focusable
2429
- tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
2430
- zIndex: `${20000 + this.overlayIndex}`,
2431
- }, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, '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, onFocus: this.onModalFocus }), h("ion-backdrop", { key: 'ee94ff8e09b691dd4ad4e4db1720f06bc3c5a469', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && h("div", { key: 'bffd69b4635c22d9f249725bd952c1e93d5615c7', class: "modal-shadow" }), h("div", Object.assign({ key: '1d394d3c68916e464ff1fbf5242419f4a3d3cca1',
2432
- /*
2433
- role and aria-modal must be used on the
2434
- same element. They must also be set inside the
2435
- shadow DOM otherwise ion-button will not be highlighted
2436
- when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
2437
- */
2438
- role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '2dcf58792018e557e0c323baad2d672bc99c0bb1', class: "modal-handle",
2439
- // Prevents the handle from receiving keyboard focus when it does not cycle
2440
- tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), h("slot", { key: '44164b1e8710c3895400ad9f44ecd99873874ad5', onSlotchange: this.onSlotChange }))));
2441
- }
2442
- get el() { return this; }
2443
- static get watchers() { return {
2444
- "isOpen": ["onIsOpenChange"],
2445
- "trigger": ["triggerChanged"]
2446
- }; }
2447
- static get style() { return {
2448
- ios: modalIosCss,
2449
- md: modalMdCss
2450
- }; }
2451
- }, [289, "ion-modal", {
2452
- "hasController": [4, "has-controller"],
2453
- "overlayIndex": [2, "overlay-index"],
2454
- "delegate": [16],
2455
- "keyboardClose": [4, "keyboard-close"],
2456
- "enterAnimation": [16],
2457
- "leaveAnimation": [16],
2458
- "breakpoints": [16],
2459
- "expandToScroll": [4, "expand-to-scroll"],
2460
- "initialBreakpoint": [2, "initial-breakpoint"],
2461
- "backdropBreakpoint": [2, "backdrop-breakpoint"],
2462
- "handle": [4],
2463
- "handleBehavior": [1, "handle-behavior"],
2464
- "component": [1],
2465
- "componentProps": [16],
2466
- "cssClass": [1, "css-class"],
2467
- "backdropDismiss": [4, "backdrop-dismiss"],
2468
- "showBackdrop": [4, "show-backdrop"],
2469
- "animated": [4],
2470
- "presentingElement": [16],
2471
- "htmlAttributes": [16],
2472
- "isOpen": [4, "is-open"],
2473
- "trigger": [1],
2474
- "keepContentsMounted": [4, "keep-contents-mounted"],
2475
- "focusTrap": [4, "focus-trap"],
2476
- "canDismiss": [4, "can-dismiss"],
2477
- "isSheetModal": [32],
2478
- "presented": [32],
2479
- "present": [64],
2480
- "dismiss": [64],
2481
- "onDidDismiss": [64],
2482
- "onWillDismiss": [64],
2483
- "setCurrentBreakpoint": [64],
2484
- "getCurrentBreakpoint": [64]
2485
- }, [[9, "resize", "onWindowResize"]], {
2486
- "isOpen": ["onIsOpenChange"],
2487
- "trigger": ["triggerChanged"]
2488
- }]);
2489
- const LIFECYCLE_MAP = {
2490
- ionModalDidPresent: 'ionViewDidEnter',
2491
- ionModalWillPresent: 'ionViewWillEnter',
2492
- ionModalWillDismiss: 'ionViewWillLeave',
2493
- ionModalDidDismiss: 'ionViewDidLeave',
2494
- };
2495
- function defineCustomElement() {
2496
- if (typeof customElements === "undefined") {
2497
- return;
2498
- }
2499
- const components = ["ion-modal", "ion-backdrop"];
2500
- components.forEach(tagName => { switch (tagName) {
2501
- case "ion-modal":
2502
- if (!customElements.get(tagName)) {
2503
- customElements.define(tagName, Modal);
2504
- }
2505
- break;
2506
- case "ion-backdrop":
2507
- if (!customElements.get(tagName)) {
2508
- defineCustomElement$1();
2509
- }
2510
- break;
2511
- } });
2512
- }
2513
-
2514
- export { Modal as M, defineCustomElement as d };
4
+ import{proxyCustomElement as t,HTMLElement as o,createEvent as i,writeTask as a,h as e,Host as r,transformTag as s}from"@stencil/core/internal/client";import{a as n,i as d,d as l,r as h,f as p,p as c}from"./index8.js";import{C as m,a as f,d as b}from"./framework-delegate.js";import{f as u,g as v,r as x,d as w,k as g}from"./helpers.js";import{c as k}from"./lock-controller.js";import{p as y,c as A}from"./index4.js";import{g as Y}from"./capacitor.js";import{G as D,O as E,F as S,e as B,B as O,j as C,k as T,f as M,g as P,h as j}from"./overlays.js";import{g as $}from"./theme.js";import{e as I,w as R}from"./index2.js";import{b as L}from"./ionic-global.js";import{KEYBOARD_DID_OPEN as z}from"./keyboard.js";import{c as N}from"./animation.js";import{g as W}from"./cubic-bezier.js";import{createGesture as H}from"./index3.js";import{w as V}from"./index9.js";import{d as F}from"./backdrop.js";var K;!function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"}(K||(K={}));const Z={getEngine(){const t=Y();if(null==t?void 0:t.isPluginAvailable("StatusBar"))return t.Plugins.StatusBar},setStyle(t){const o=this.getEngine();o&&o.setStyle(t)},getStyle:async function(){const t=this.getEngine();if(!t)return K.Default;const{style:o}=await t.getInfo();return o}},G=(t,o)=>{if(1===o)return 0;const i=1/(1-o);return t*i+-o*i},U=()=>{!V||V.innerWidth>=768||Z.setStyle({style:K.Dark})},_=(t=K.Default)=>{!V||V.innerWidth>=768||Z.setStyle({style:t})},q=async(t,o)=>{"function"==typeof t.canDismiss&&await t.canDismiss(void 0,D)&&(o.isRunning()?o.onFinish((()=>{t.dismiss(void 0,"handler")}),{oneTimeCallback:!0}):t.dismiss(void 0,"handler"))},J=t=>.00255275*2.71828**(-14.9619*t)-1.00255*2.71828**(-.0380968*t)+1,Q=.915,X=(t,o)=>u(400,t/Math.abs(1.1*o),500),tt=t=>{const{currentBreakpoint:o,backdropBreakpoint:i,expandToScroll:a}=t,e=void 0===i||i<o,r=e?`calc(var(--backdrop-opacity) * ${o})`:"0",s=N("backdropAnimation").fromTo("opacity",0,r);return e&&s.beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),{wrapperAnimation:N("wrapperAnimation").keyframes([{offset:0,opacity:1,transform:"translateY(100%)"},{offset:1,opacity:1,transform:`translateY(${100-100*o}%)`}]),backdropAnimation:s,contentAnimation:a?void 0:N("contentAnimation").keyframes([{offset:0,opacity:1,maxHeight:100*(1-o)+"%"},{offset:1,opacity:1,maxHeight:100*o+"%"}])}},ot=t=>{const{currentBreakpoint:o,backdropBreakpoint:i}=t,a=`calc(var(--backdrop-opacity) * ${G(o,i)})`,e=[{offset:0,opacity:a},{offset:1,opacity:0}],r=[{offset:0,opacity:a},{offset:i,opacity:0},{offset:1,opacity:0}],s=N("backdropAnimation").keyframes(0!==i?r:e);return{wrapperAnimation:N("wrapperAnimation").keyframes([{offset:0,opacity:1,transform:`translateY(${100-100*o}%)`},{offset:1,opacity:1,transform:"translateY(100%)"}]),backdropAnimation:s}},it=(t,o)=>{const{presentingEl:i,currentBreakpoint:a,expandToScroll:e}=o,r=v(t),{wrapperAnimation:s,backdropAnimation:n,contentAnimation:d}=void 0!==a?tt(o):{backdropAnimation:N().fromTo("opacity",.01,"var(--backdrop-opacity)").beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),wrapperAnimation:N().fromTo("transform","translateY(100vh)","translateY(0vh)"),contentAnimation:void 0};n.addElement(r.querySelector("ion-backdrop")),s.addElement(r.querySelectorAll(".modal-wrapper, .modal-shadow")).beforeStyles({opacity:1}),!e&&(null==d||d.addElement(t.querySelector(".ion-page")));const l=N("entering-base").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(500).addAnimation([s]);if(d&&l.addAnimation(d),i){const t=window.innerWidth<768,o="ION-MODAL"===i.tagName&&void 0!==i.presentingElement,a=v(i),e=N().beforeStyles({transform:"translateY(0)","transform-origin":"top center",overflow:"hidden"}),r=document.body;if(t){const t=CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px",a=`translateY(${o?"-10px":t}) scale(0.915)`;e.afterStyles({transform:a}).beforeAddWrite((()=>r.style.setProperty("background-color","black"))).addElement(i).keyframes([{offset:0,filter:"contrast(1)",transform:"translateY(0px) scale(1)",borderRadius:"0px"},{offset:1,filter:"contrast(0.85)",transform:a,borderRadius:"10px 10px 0 0"}]),l.addAnimation(e)}else if(l.addAnimation(n),o){const t=`translateY(-10px) scale(${o?Q:1})`;e.afterStyles({transform:t}).addElement(a.querySelector(".modal-wrapper")).keyframes([{offset:0,filter:"contrast(1)",transform:"translateY(0) scale(1)"},{offset:1,filter:"contrast(0.85)",transform:t}]);const i=N().afterStyles({transform:t}).addElement(a.querySelector(".modal-shadow")).keyframes([{offset:0,opacity:"1",transform:"translateY(0) scale(1)"},{offset:1,opacity:"0",transform:t}]);l.addAnimation([e,i])}else s.fromTo("opacity","0","1")}else l.addAnimation(n);return l},at=(t,o,i=500)=>{const{presentingEl:a,currentBreakpoint:e}=o,r=v(t),{wrapperAnimation:s,backdropAnimation:n}=void 0!==e?ot(o):{backdropAnimation:N().fromTo("opacity","var(--backdrop-opacity)",0),wrapperAnimation:N().fromTo("transform","translateY(0vh)","translateY(100vh)")};n.addElement(r.querySelector("ion-backdrop")),s.addElement(r.querySelectorAll(".modal-wrapper, .modal-shadow")).beforeStyles({opacity:1});const d=N("leaving-base").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(i).addAnimation(s);if(a){const t=window.innerWidth<768,o="ION-MODAL"===a.tagName&&void 0!==a.presentingElement,i=v(a),e=N().beforeClearStyles(["transform"]).afterClearStyles(["transform"]).onFinish((t=>{1===t&&(a.style.setProperty("overflow",""),Array.from(r.querySelectorAll("ion-modal:not(.overlay-hidden)")).filter((t=>void 0!==t.presentingElement)).length<=1&&r.style.setProperty("background-color",""))})),r=document.body;if(t){const t=CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px",i=`translateY(${o?"-10px":t}) scale(0.915)`;e.addElement(a).keyframes([{offset:0,filter:"contrast(0.85)",transform:i,borderRadius:"10px 10px 0 0"},{offset:1,filter:"contrast(1)",transform:"translateY(0px) scale(1)",borderRadius:"0px"}]),d.addAnimation(e)}else if(d.addAnimation(n),o){const t=`translateY(-10px) scale(${o?Q:1})`;e.addElement(i.querySelector(".modal-wrapper")).afterStyles({transform:"translate3d(0, 0, 0)"}).keyframes([{offset:0,filter:"contrast(0.85)",transform:t},{offset:1,filter:"contrast(1)",transform:"translateY(0) scale(1)"}]);const a=N().addElement(i.querySelector(".modal-shadow")).afterStyles({transform:"translateY(0) scale(1)"}).keyframes([{offset:0,opacity:"0",transform:t},{offset:1,opacity:"1",transform:"translateY(0) scale(1)"}]);d.addAnimation([e,a])}else s.fromTo("opacity","1","0")}else d.addAnimation(n);return d},et=(t,o)=>{const{currentBreakpoint:i,expandToScroll:a}=o,e=v(t),{wrapperAnimation:r,backdropAnimation:s,contentAnimation:n}=void 0!==i?tt(o):{backdropAnimation:N().fromTo("opacity",.01,"var(--backdrop-opacity)").beforeStyles({"pointer-events":"none"}).afterClearStyles(["pointer-events"]),wrapperAnimation:N().keyframes([{offset:0,opacity:.01,transform:"translateY(40px)"},{offset:1,opacity:1,transform:"translateY(0px)"}]),contentAnimation:void 0};s.addElement(e.querySelector("ion-backdrop")),r.addElement(e.querySelector(".modal-wrapper")),!a&&(null==n||n.addElement(t.querySelector(".ion-page")));const d=N().addElement(t).easing("cubic-bezier(0.36,0.66,0.04,1)").duration(280).addAnimation([s,r]);return n&&d.addAnimation(n),d},rt=(t,o)=>{const{currentBreakpoint:i}=o,a=v(t),{wrapperAnimation:e,backdropAnimation:r}=void 0!==i?ot(o):{backdropAnimation:N().fromTo("opacity","var(--backdrop-opacity)",0),wrapperAnimation:N().keyframes([{offset:0,opacity:.99,transform:"translateY(0px)"},{offset:1,opacity:0,transform:"translateY(40px)"}])};return r.addElement(a.querySelector("ion-backdrop")),e.addElement(a.querySelector(".modal-wrapper")),N().easing("cubic-bezier(0.47,0,0.745,0.715)").duration(200).addAnimation([r,e])},st=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.didPresent=i(this,"ionModalDidPresent",7),this.willPresent=i(this,"ionModalWillPresent",7),this.willDismiss=i(this,"ionModalWillDismiss",7),this.didDismiss=i(this,"ionModalDidDismiss",7),this.ionBreakpointDidChange=i(this,"ionBreakpointDidChange",7),this.didPresentShorthand=i(this,"didPresent",7),this.willPresentShorthand=i(this,"willPresent",7),this.willDismissShorthand=i(this,"willDismiss",7),this.didDismissShorthand=i(this,"didDismiss",7),this.ionMount=i(this,"ionMount",7),this.lockController=k(),this.triggerController=B(),this.coreDelegate=m(),this.isSheetModal=!1,this.inheritedAttributes={},this.inline=!1,this.gestureAnimationDismissing=!1,this.presented=!1,this.hasController=!1,this.keyboardClose=!0,this.expandToScroll=!0,this.backdropBreakpoint=0,this.handleBehavior="none",this.backdropDismiss=!0,this.showBackdrop=!0,this.animated=!0,this.isOpen=!1,this.keepContentsMounted=!1,this.focusTrap=!0,this.canDismiss=!0,this.onHandleClick=()=>{const{sheetTransition:t,handleBehavior:o}=this;"cycle"===o&&void 0===t&&this.moveToNextBreakpoint()},this.onBackdropTap=()=>{const{sheetTransition:t}=this;void 0===t&&this.dismiss(void 0,O)},this.onLifecycle=t=>{const o=this.usersElement,i=nt[t.type];if(o&&i){const a=new CustomEvent(i,{bubbles:!1,cancelable:!1,detail:t.detail});o.dispatchEvent(a)}},this.onModalFocus=t=>{const{dragHandleEl:o,el:i}=this;t.target===i&&o&&-1!==o.tabIndex&&o.focus()},this.onSlotChange=({target:t})=>{t.assignedElements().forEach((t=>{t.querySelectorAll("ion-modal").forEach((t=>{null===t.getAttribute("data-parent-ion-modal")&&t.setAttribute("data-parent-ion-modal",this.el.id)}))}))}}onIsOpenChange(t,o){!0===t&&!1===o?this.present():!1===t&&!0===o&&this.dismiss()}triggerChanged(){const{trigger:t,el:o,triggerController:i}=this;t&&i.addClickListener(o,t)}onWindowResize(){"ios"!==L(this)||!this.presentingElement||this.enterAnimation||this.leaveAnimation||(clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout((()=>{this.handleViewTransition()}),50))}breakpointsChanged(t){void 0!==t&&(this.sortedBreakpoints=t.sort(((t,o)=>t-o)))}connectedCallback(){const{el:t}=this;C(t),this.triggerChanged()}disconnectedCallback(){this.triggerController.removeClickListener(),this.cleanupViewTransitionListener(),this.cleanupParentRemovalObserver()}componentWillLoad(){var t;const{breakpoints:o,initialBreakpoint:i,el:a,htmlAttributes:e}=this,r=this.isSheetModal=void 0!==o&&void 0!==i,s=["aria-label","role"];this.inheritedAttributes=w(a,s),a.parentNode&&(this.cachedOriginalParent=a.parentNode),void 0!==e&&s.forEach((t=>{e[t]&&(this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:e[t]}),delete e[t])})),r&&(this.currentBreakpoint=this.initialBreakpoint),void 0===o||void 0===i||o.includes(i)||y("[ion-modal] - Your breakpoints array must include the initialBreakpoint value."),(null===(t=this.htmlAttributes)||void 0===t?void 0:t.id)||T(this.el)}componentDidLoad(){!0===this.isOpen&&x((()=>this.present())),this.breakpointsChanged(this.breakpoints),this.triggerChanged()}getDelegate(t=!1){if(this.workingDelegate&&!t)return{delegate:this.workingDelegate,inline:this.inline};const o=this.inline=null!==this.el.parentNode&&!this.hasController;return{inline:o,delegate:this.workingDelegate=o?this.delegate||this.coreDelegate:this.delegate}}async checkCanDismiss(t,o){const{canDismiss:i}=this;return"function"==typeof i?i(t,o):i}async present(){const t=await this.lockController.lock();if(this.presented)return void t();const{presentingElement:o,el:i}=this;this.currentBreakpoint=this.initialBreakpoint;const{inline:e,delegate:r}=this.getDelegate(!0);this.ionMount.emit(),this.usersElement=await f(r,i,this.component,["ion-page"],this.componentProps,e),g(i)?await I(this.usersElement):this.keepContentsMounted||await R(),a((()=>this.el.classList.add("show-modal")));const s=void 0!==o;s&&"ios"===L(this)&&(this.statusBarStyle=await Z.getStyle(),U()),await M(this,"modalEnter",it,et,{presentingEl:o,currentBreakpoint:this.initialBreakpoint,backdropBreakpoint:this.backdropBreakpoint,expandToScroll:this.expandToScroll}),"undefined"!=typeof window&&(this.keyboardOpenCallback=()=>{this.gesture&&(this.gesture.enable(!1),x((()=>{this.gesture&&this.gesture.enable(!0)})))},window.addEventListener(z,this.keyboardOpenCallback));const n=void 0!==this.breakpoints&&void 0!==this.initialBreakpoint;this.isSheetModal=n,n?this.initSheetGesture():s&&this.initSwipeToClose(),this.initViewTransitionListener(),this.initParentRemovalObserver(),t()}initSwipeToClose(){var t;if("ios"!==L(this))return;const{el:o}=this,i=this.leaveAnimation||A.get("modalLeave",at),a=this.animation=i(o,{presentingEl:this.presentingElement,expandToScroll:this.expandToScroll});if(!p(o))return void c(o);const e=null!==(t=this.statusBarStyle)&&void 0!==t?t:K.Default;this.gesture=((t,o,i,a)=>{const e=.5,r=t.offsetHeight;let s=!1,p=!1,c=null,m=null,f=!0,b=0;const x=H({el:t,gestureName:"modalSwipeToClose",gesturePriority:E,direction:"y",threshold:10,canStart:t=>{const o=t.event.target;if(null===o||!o.closest)return!0;if(c=n(o),c){if(d(c)){const t=v(c);m=t.querySelector(".inner-scroll")}else m=c;return!c.querySelector("ion-refresher")&&0===m.scrollTop}return null===o.closest("ion-footer")},onStart:i=>{const{deltaY:a}=i;f=!c||!d(c)||c.scrollY,p=void 0!==t.canDismiss&&!0!==t.canDismiss,a>0&&c&&l(c),o.progressStart(!0,s?1:0)},onMove:t=>{const{deltaY:a}=t;a>0&&c&&l(c);const s=t.deltaY/r,n=s>=0&&p,d=n?.2:.9999,h=n?J(s/d):s,m=u(1e-4,h,d);o.progressStep(m),m>=e&&b<e?_(i):m<e&&b>=e&&U(),b=m},onEnd:i=>{const n=i.velocityY,d=i.deltaY/r,l=d>=0&&p,m=l?.2:.9999,b=l?J(d/m):d,v=u(1e-4,b,m),w=!l&&(i.deltaY+1e3*n)/r>=e;let g=w?-.001:.001;w?(o.easing("cubic-bezier(0.32, 0.72, 0, 1)"),g+=W([0,0],[.32,.72],[0,1],[1,1],v)[0]):(o.easing("cubic-bezier(1, 0, 0.68, 0.28)"),g+=W([0,0],[1,0],[.68,.28],[1,1],v)[0]);const k=X(w?d*r:(1-v)*r,n);s=w,x.enable(!1),c&&h(c,f),o.onFinish((()=>{w||x.enable(!0)})).progressEnd(w?1:0,g,k),l&&v>m/4?q(t,o):w&&a()}});return x})(o,a,e,(()=>{this.gestureAnimationDismissing=!0,_(this.statusBarStyle),this.animation.onFinish((async()=>{await this.dismiss(void 0,D),this.gestureAnimationDismissing=!1}))})),this.gesture.enable(!0)}initSheetGesture(){const{wrapperEl:t,initialBreakpoint:o,backdropBreakpoint:i}=this;if(!t||void 0===o)return;const a=this.enterAnimation||A.get("modalEnter",it),e=this.animation=a(this.el,{presentingEl:this.presentingElement,currentBreakpoint:o,backdropBreakpoint:i,expandToScroll:this.expandToScroll});e.progressStart(!0,1);const{gesture:r,moveSheetToBreakpoint:s}=((t,o,i,a,e,r,s=[],l,h,p,c)=>{const m={WRAPPER_KEYFRAMES:[{offset:0,transform:"translateY(0%)"},{offset:1,transform:"translateY(100%)"}],BACKDROP_KEYFRAMES:0!==e?[{offset:0,opacity:"var(--backdrop-opacity)"},{offset:1-e,opacity:0},{offset:1,opacity:0}]:[{offset:0,opacity:"var(--backdrop-opacity)"},{offset:1,opacity:.01}],CONTENT_KEYFRAMES:[{offset:0,maxHeight:"100%"},{offset:1,maxHeight:"0%"}]},f=t.querySelector("ion-content"),b=i.clientHeight;let w=a,g=0,k=!1,y=null,A=null,Y=null,D=null;const E=s[s.length-1],B=s[0],O=r.childAnimations.find((t=>"wrapperAnimation"===t.id)),C=r.childAnimations.find((t=>"backdropAnimation"===t.id)),T=r.childAnimations.find((t=>"contentAnimation"===t.id)),M=()=>{!1!==t.focusTrap&&!1!==t.showBackdrop&&(t.style.setProperty("pointer-events","auto"),o.style.setProperty("pointer-events","auto"),t.classList.remove(S))},P=()=>{t.style.setProperty("pointer-events","none"),o.style.setProperty("pointer-events","none"),t.classList.add(S)},j=o=>{if(!A&&(A=Array.from(t.querySelectorAll("ion-footer")),!A.length))return;const i=t.querySelector(".ion-page");if(D=o,"stationary"===o)A.forEach((t=>{t.classList.remove("modal-footer-moving"),t.style.removeProperty("position"),t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("top"),t.style.removeProperty("left"),null==i||i.style.removeProperty("padding-bottom"),null==i||i.appendChild(t)}));else{let o=0;A.forEach(((i,a)=>{const e=i.getBoundingClientRect(),r=document.body.getBoundingClientRect();o+=i.clientHeight;const s=e.top-r.top,n=e.left-r.left;if(i.style.setProperty("--pinned-width",`${i.clientWidth}px`),i.style.setProperty("--pinned-height",`${i.clientHeight}px`),i.style.setProperty("--pinned-top",`${s}px`),i.style.setProperty("--pinned-left",`${n}px`),0===a){Y=s;const o=t.querySelector("ion-header");o&&(Y-=o.clientHeight)}})),A.forEach((t=>{null==i||i.style.setProperty("padding-bottom",`${o}px`),t.classList.add("modal-footer-moving"),t.style.setProperty("position","absolute"),t.style.setProperty("width","var(--pinned-width)"),t.style.setProperty("height","var(--pinned-height)"),t.style.setProperty("top","var(--pinned-top)"),t.style.setProperty("left","var(--pinned-left)"),document.body.appendChild(t)}))}};O&&C&&(O.keyframes([...m.WRAPPER_KEYFRAMES]),C.keyframes([...m.BACKDROP_KEYFRAMES]),null==T||T.keyframes([...m.CONTENT_KEYFRAMES]),r.progressStart(!0,1-w),w>e&&!1!==t.focusTrap&&!1!==t.showBackdrop?M():P()),f&&w!==E&&l&&(f.scrollY=!1);const $=o=>{const{breakpoint:i,canDismiss:a,breakpointOffset:n,animated:d}=o,h=a&&0===i,b=h?w:i,u=0!==b;return w=0,O&&C&&(O.keyframes([{offset:0,transform:`translateY(${100*n}%)`},{offset:1,transform:`translateY(${100*(1-b)}%)`}]),C.keyframes([{offset:0,opacity:`calc(var(--backdrop-opacity) * ${G(1-n,e)})`},{offset:1,opacity:`calc(var(--backdrop-opacity) * ${G(b,e)})`}]),T&&T.keyframes([{offset:0,maxHeight:100*(1-n)+"%"},{offset:1,maxHeight:100*b+"%"}]),r.progressStep(0)),I.enable(!1),h?q(t,r):u||p(),!f||b!==s[s.length-1]&&l||(f.scrollY=!0),l||0!==b||j("stationary"),new Promise((o=>{r.onFinish((()=>{u?(l||j("stationary"),O&&C?x((()=>{O.keyframes([...m.WRAPPER_KEYFRAMES]),C.keyframes([...m.BACKDROP_KEYFRAMES]),null==T||T.keyframes([...m.CONTENT_KEYFRAMES]),r.progressStart(!0,1-b),w=b,c(w),w>e&&!1!==t.focusTrap&&!1!==t.showBackdrop?M():P(),I.enable(!0),o()})):(I.enable(!0),o())):o()}),{oneTimeCallback:!0}).progressEnd(1,0,d?500:0)}))},I=H({el:i,gestureName:"modalSheet",gesturePriority:40,direction:"y",threshold:10,canStart:t=>{const o=n(t.event.target);if(w=h(),!l&&o)return 0===(d(o)?v(o).querySelector(".inner-scroll"):o).scrollTop;if(1===w&&o){const t=d(o)?v(o).querySelector(".inner-scroll"):o;return!o.querySelector("ion-refresher")&&0===t.scrollTop}return!0},onStart:o=>{if(k=void 0!==t.canDismiss&&!0!==t.canDismiss&&0===B,!l){const t=n(o.event.target);y=t&&d(t)?v(t).querySelector(".inner-scroll"):t}l||j("moving"),o.deltaY>0&&f&&(f.scrollY=!1),x((()=>{t.focus()})),r.progressStart(!0,1-w)},onMove:t=>{if(l||null===Y||null===D||(t.currentY>=Y&&"moving"===D?j("stationary"):t.currentY<Y&&"stationary"===D&&j("moving")),!l&&t.deltaY<=0&&y)return;t.deltaY>0&&f&&(f.scrollY=!1);const o=s.length>1?1-s[1]:void 0,i=1-w+t.deltaY/b,a=void 0!==o&&i>=o&&k,e=a?.95:.9999,n=a&&void 0!==o?o+J((i-o)/(e-o)):i;g=u(1e-4,n,e),r.progressStep(g)},onEnd:t=>{if(!l&&t.deltaY<=0&&y&&y.scrollTop>0)return void j("stationary");const o=w-(t.deltaY+350*t.velocityY)/b,i=s.reduce(((t,i)=>Math.abs(i-o)<Math.abs(t-o)?i:t));$({breakpoint:i,breakpointOffset:g,canDismiss:k,animated:!0})}});return{gesture:I,moveSheetToBreakpoint:$}})(this.el,this.backdropEl,t,o,i,e,this.sortedBreakpoints,this.expandToScroll,(()=>{var t;return null!==(t=this.currentBreakpoint)&&void 0!==t?t:0}),(()=>this.sheetOnDismiss()),(t=>{this.currentBreakpoint!==t&&(this.currentBreakpoint=t,this.ionBreakpointDidChange.emit({breakpoint:t}))}));this.gesture=r,this.moveSheetToBreakpoint=s,this.gesture.enable(!0),(!1===this.showBackdrop||!1===this.focusTrap||i>0)&&this.setupChildRoutePassthrough()}setupChildRoutePassthrough(){var t;this.cachedPageParent=this.getOriginalPageParent();const i=this.cachedPageParent;if(!i||"ION-APP"===i.tagName)return;const a=Array.from(i.children).some((t=>{var i;return!(t===this.el||t instanceof o&&"none"===window.getComputedStyle(t).display||"TEMPLATE"===t.tagName||"SLOT"===t.tagName||t.nodeType===Node.TEXT_NODE&&!(null===(i=t.textContent)||void 0===i?void 0:i.trim()))}));if(a)return;i.classList.add("ion-page-overlay-passthrough");const e=i.parentElement;"ION-ROUTER-OUTLET"===(null==e?void 0:e.tagName)&&"ION-APP"!==(null===(t=e.parentElement)||void 0===t?void 0:t.tagName)&&(e.style.setProperty("pointer-events","none"),e.setAttribute("data-overlay-passthrough","true"))}getOriginalPageParent(){if(!this.cachedOriginalParent)return null;let t=this.cachedOriginalParent;for(;t&&!t.classList.contains("ion-page");)t=t.parentElement;return t}cleanupChildRoutePassthrough(){const t=this.cachedPageParent;if(!t)return;t.classList.remove("ion-page-overlay-passthrough");const o=t.parentElement;(null==o?void 0:o.hasAttribute("data-overlay-passthrough"))&&(o.style.removeProperty("pointer-events"),o.removeAttribute("data-overlay-passthrough")),this.cachedPageParent=void 0}sheetOnDismiss(){this.gestureAnimationDismissing=!0,this.animation.onFinish((async()=>{this.currentBreakpoint=0,this.ionBreakpointDidChange.emit({breakpoint:this.currentBreakpoint}),await this.dismiss(void 0,D),this.gestureAnimationDismissing=!1}))}async dismiss(t,o){var i;if(this.gestureAnimationDismissing&&o!==D)return!1;const e=await this.lockController.lock();if(await this.dismissNestedModals(),"handler"!==o&&!await this.checkCanDismiss(t,o))return e(),!1;const{presentingElement:r}=this;void 0!==r&&"ios"===L(this)&&_(this.statusBarStyle),"undefined"!=typeof window&&this.keyboardOpenCallback&&(window.removeEventListener(z,this.keyboardOpenCallback),this.keyboardOpenCallback=void 0);const s=await P(this,t,o,"modalLeave",at,rt,{presentingEl:r,currentBreakpoint:null!==(i=this.currentBreakpoint)&&void 0!==i?i:this.initialBreakpoint,backdropBreakpoint:this.backdropBreakpoint,expandToScroll:this.expandToScroll});if(s){const{delegate:t}=this.getDelegate();await b(t,this.usersElement),a((()=>this.el.classList.remove("show-modal"))),this.animation&&this.animation.destroy(),this.gesture&&this.gesture.destroy(),this.cleanupViewTransitionListener(),this.cleanupParentRemovalObserver(),this.cleanupChildRoutePassthrough()}return this.currentBreakpoint=void 0,this.animation=void 0,e(),s}onDidDismiss(){return j(this.el,"ionModalDidDismiss")}onWillDismiss(){return j(this.el,"ionModalWillDismiss")}async setCurrentBreakpoint(t){if(!this.isSheetModal)return void y("[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.");if(!this.breakpoints.includes(t))return void y(`[ion-modal] - Attempted to set invalid breakpoint value ${t}. Please double check that the breakpoint value is part of your defined breakpoints.`);const{currentBreakpoint:o,moveSheetToBreakpoint:i,canDismiss:a,breakpoints:e,animated:r}=this;o!==t&&i&&(this.sheetTransition=i({breakpoint:t,breakpointOffset:1-o,canDismiss:void 0!==a&&!0!==a&&0===e[0],animated:r}),await this.sheetTransition,this.sheetTransition=void 0)}async getCurrentBreakpoint(){return this.currentBreakpoint}async moveToNextBreakpoint(){const{breakpoints:t,currentBreakpoint:o}=this;if(!t||null==o)return!1;const i=t.filter((t=>0!==t)),a=i.indexOf(o),e=i[(a+1)%i.length];return await this.setCurrentBreakpoint(e),!0}initViewTransitionListener(){"ios"!==L(this)||!this.presentingElement||this.enterAnimation||this.leaveAnimation||(this.currentViewIsPortrait=window.innerWidth<768)}handleViewTransition(){if(!this.presented)return;const t=window.innerWidth<768;if(this.currentViewIsPortrait===t)return;this.viewTransitionAnimation&&(this.viewTransitionAnimation.destroy(),this.viewTransitionAnimation=void 0);const{presentingElement:o}=this;if(!o)return;let i;i=this.currentViewIsPortrait&&!t?((t,o,i=300)=>{const{presentingEl:a}=o;if(!a)return N("portrait-to-landscape-transition");const e="ION-MODAL"===a.tagName&&void 0!==a.presentingElement,r=v(a),s=document.body,n=N("portrait-to-landscape-transition").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(i),d=N().beforeStyles({transform:"translateY(0)","transform-origin":"top center",overflow:"hidden"});if(e){const t="translateY(-10px) scale(0.915)",o="translateY(0px) scale(1)";d.addElement(a).afterStyles({transform:o}).fromTo("transform",t,o).fromTo("filter","contrast(0.85)","contrast(1)");const i=N().addElement(r.querySelector(".modal-shadow")).afterStyles({transform:o,opacity:"0"}).fromTo("transform",t,o);n.addAnimation([d,i])}else{const o=v(t),i=N().addElement(o.querySelectorAll(".modal-wrapper, .modal-shadow")).fromTo("opacity","1","1"),e=N().addElement(o.querySelector("ion-backdrop")).fromTo("opacity","var(--backdrop-opacity)","var(--backdrop-opacity)"),r=`translateY(${CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px"}) scale(0.915)`;d.addElement(a).afterStyles({transform:"translateY(0px) scale(1)","border-radius":"0px"}).beforeAddWrite((()=>s.style.setProperty("background-color",""))).fromTo("transform",r,"translateY(0px) scale(1)").fromTo("filter","contrast(0.85)","contrast(1)").fromTo("border-radius","10px 10px 0 0","0px"),n.addAnimation([d,i,e])}return n})(this.el,{presentingEl:o}):((t,o,i=300)=>{const{presentingEl:a}=o;if(!a)return N("landscape-to-portrait-transition");const e="ION-MODAL"===a.tagName&&void 0!==a.presentingElement,r=v(a),s=document.body,n=N("landscape-to-portrait-transition").addElement(t).easing("cubic-bezier(0.32,0.72,0,1)").duration(i),d=N().beforeStyles({transform:"translateY(0)","transform-origin":"top center",overflow:"hidden"});if(e){const t="translateY(-10px) scale(0.915)",o="translateY(0) scale(1)";d.addElement(a).afterStyles({transform:o}).fromTo("transform",t,o);const i=N().addElement(r.querySelector(".modal-shadow")).afterStyles({transform:o,opacity:"0"}).fromTo("transform",t,o);n.addAnimation([d,i])}else{const o=v(t),i=N().addElement(o.querySelectorAll(".modal-wrapper, .modal-shadow")).fromTo("opacity","1","1"),e=N().addElement(o.querySelector("ion-backdrop")).fromTo("opacity","var(--backdrop-opacity)","var(--backdrop-opacity)"),r=`translateY(${CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px"}) scale(0.915)`;d.addElement(a).afterStyles({transform:r}).beforeAddWrite((()=>s.style.setProperty("background-color","black"))).keyframes([{offset:0,transform:"translateY(0px) scale(1)",filter:"contrast(1)",borderRadius:"0px"},{offset:.2,transform:"translateY(0px) scale(1)",filter:"contrast(1)",borderRadius:"10px 10px 0 0"},{offset:1,transform:r,filter:"contrast(0.85)",borderRadius:"10px 10px 0 0"}]),n.addAnimation([d,i,e])}return n})(this.el,{presentingEl:o}),this.currentViewIsPortrait=t,this.viewTransitionAnimation=i,i.play().then((()=>{this.viewTransitionAnimation=void 0,this.reinitSwipeToClose()}))}cleanupViewTransitionListener(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=void 0),this.viewTransitionAnimation&&(this.viewTransitionAnimation.destroy(),this.viewTransitionAnimation=void 0)}reinitSwipeToClose(){"ios"===L(this)&&this.presentingElement&&(this.gesture&&(this.gesture.destroy(),this.gesture=void 0),this.animation&&(this.animation.progressEnd(0,0,0),this.animation.destroy(),this.animation=void 0),x((()=>{this.ensureCorrectModalPosition(),this.initSwipeToClose()})))}ensureCorrectModalPosition(){const{el:t,presentingElement:o}=this,i=v(t).querySelector(".modal-wrapper");if(i&&(i.style.transform="translateY(0vh)",i.style.opacity="1"),"ION-MODAL"===(null==o?void 0:o.tagName))if(window.innerWidth<768){const t=CSS.supports("width","max(0px, 1px)")?"max(30px, var(--ion-safe-area-top))":"30px";o.style.transform=`translateY(${t}) scale(0.915)`}else o.style.transform="translateY(0px) scale(1)"}async dismissNestedModals(){const t=document.querySelectorAll(`ion-modal[data-parent-ion-modal="${this.el.id}"]`);null==t||t.forEach((async t=>{await t.dismiss(void 0,"parent-dismissed")}))}initParentRemovalObserver(){"undefined"!=typeof MutationObserver&&"undefined"!=typeof window&&this.cachedOriginalParent&&this.cachedOriginalParent.nodeType!==Node.DOCUMENT_NODE&&this.cachedOriginalParent.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(this.hasController||this.cachedOriginalParent===document.body||"ION-APP"===this.cachedOriginalParent.tagName||(this.parentRemovalObserver=new MutationObserver((t=>{t.forEach((t=>{"childList"===t.type&&t.removedNodes.length>0&&(Array.from(t.removedNodes).some((t=>{var o,i;const a=t===this.cachedOriginalParent,e=!!this.cachedOriginalParent&&(null===(i=(o=t).contains)||void 0===i?void 0:i.call(o,this.cachedOriginalParent));return a||e}))||this.cachedOriginalParent&&!this.cachedOriginalParent.isConnected)&&(this.dismiss(void 0,"parent-removed"),this.cachedOriginalParent=void 0)}))})),this.parentRemovalObserver.observe(document.body,{childList:!0,subtree:!0})))}cleanupParentRemovalObserver(){var t;null===(t=this.parentRemovalObserver)||void 0===t||t.disconnect(),this.parentRemovalObserver=void 0}render(){const{handle:t,isSheetModal:o,presentingElement:i,htmlAttributes:a,handleBehavior:s,inheritedAttributes:n,focusTrap:d,expandToScroll:l}=this,h=!1!==t&&o,p=L(this),c=void 0!==i&&"ios"===p,m="cycle"===s;return e(r,Object.assign({key:"87328006ea6c75ebc518ace300438492a567223e","no-router":!0,tabIndex:m&&o&&h?0:-1},a,{style:{zIndex:`${2e4+this.overlayIndex}`},class:Object.assign({[p]:!0,"modal-default":!c&&!o,"modal-card":c,"modal-sheet":o,"modal-no-expand-scroll":o&&!l,"overlay-hidden":!0,[S]:!1===d},$(this.cssClass)),onIonBackdropTap:this.onBackdropTap,onIonModalDidPresent:this.onLifecycle,onIonModalWillPresent:this.onLifecycle,onIonModalWillDismiss:this.onLifecycle,onIonModalDidDismiss:this.onLifecycle,onFocus:this.onModalFocus}),e("ion-backdrop",{key:"ee94ff8e09b691dd4ad4e4db1720f06bc3c5a469",ref:t=>this.backdropEl=t,visible:this.showBackdrop,tappable:this.backdropDismiss,part:"backdrop"}),"ios"===p&&e("div",{key:"bffd69b4635c22d9f249725bd952c1e93d5615c7",class:"modal-shadow"}),e("div",Object.assign({key:"1d394d3c68916e464ff1fbf5242419f4a3d3cca1",role:"dialog"},n,{"aria-modal":"true",class:"modal-wrapper ion-overlay-wrapper",part:"content",ref:t=>this.wrapperEl=t}),h&&e("button",{key:"2dcf58792018e557e0c323baad2d672bc99c0bb1",class:"modal-handle",tabIndex:m?0:-1,"aria-label":"Activate to adjust the size of the dialog overlaying the screen",onClick:m?this.onHandleClick:void 0,part:"handle",ref:t=>this.dragHandleEl=t}),e("slot",{key:"44164b1e8710c3895400ad9f44ecd99873874ad5",onSlotchange:this.onSlotChange})))}get el(){return this}static get watchers(){return{isOpen:[{onIsOpenChange:0}],trigger:[{triggerChanged:0}]}}static get style(){return{ios:':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(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}: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}',md:':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(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}: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}'}}},[289,"ion-modal",{hasController:[4,"has-controller"],overlayIndex:[2,"overlay-index"],delegate:[16],keyboardClose:[4,"keyboard-close"],enterAnimation:[16],leaveAnimation:[16],breakpoints:[16],expandToScroll:[4,"expand-to-scroll"],initialBreakpoint:[2,"initial-breakpoint"],backdropBreakpoint:[2,"backdrop-breakpoint"],handle:[4],handleBehavior:[1,"handle-behavior"],component:[1],componentProps:[16],cssClass:[1,"css-class"],backdropDismiss:[4,"backdrop-dismiss"],showBackdrop:[4,"show-backdrop"],animated:[4],presentingElement:[16],htmlAttributes:[16],isOpen:[4,"is-open"],trigger:[1],keepContentsMounted:[4,"keep-contents-mounted"],focusTrap:[4,"focus-trap"],canDismiss:[4,"can-dismiss"],isSheetModal:[32],presented:[32],present:[64],dismiss:[64],onDidDismiss:[64],onWillDismiss:[64],setCurrentBreakpoint:[64],getCurrentBreakpoint:[64]},[[9,"resize","onWindowResize"]],{isOpen:[{onIsOpenChange:0}],trigger:[{triggerChanged:0}]}]),nt={ionModalDidPresent:"ionViewDidEnter",ionModalWillPresent:"ionViewWillEnter",ionModalWillDismiss:"ionViewWillLeave",ionModalDidDismiss:"ionViewDidLeave"};function dt(){"undefined"!=typeof customElements&&["ion-modal","ion-backdrop"].forEach((t=>{switch(t){case"ion-modal":customElements.get(s(t))||customElements.define(s(t),st);break;case"ion-backdrop":customElements.get(s(t))||F()}}))}export{st as M,dt as d}