@ionic/core 8.7.18 → 8.7.19-dev.11772655618.1af0949f

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 (587) hide show
  1. package/components/index.d.ts +2 -0
  2. package/components/index.js +1 -114
  3. package/components/ion-accordion-group.js +1 -268
  4. package/components/ion-accordion.js +1 -456
  5. package/components/ion-action-sheet.js +1 -6
  6. package/components/ion-alert.js +1 -6
  7. package/components/ion-app.js +1 -132
  8. package/components/ion-avatar.js +1 -41
  9. package/components/ion-back-button.js +1 -130
  10. package/components/ion-backdrop.js +1 -6
  11. package/components/ion-badge.js +1 -47
  12. package/components/ion-breadcrumb.js +1 -137
  13. package/components/ion-breadcrumbs.js +1 -164
  14. package/components/ion-button.js +1 -6
  15. package/components/ion-buttons.js +1 -6
  16. package/components/ion-card-content.js +1 -45
  17. package/components/ion-card-header.js +1 -56
  18. package/components/ion-card-subtitle.js +1 -48
  19. package/components/ion-card-title.js +1 -48
  20. package/components/ion-card.js +1 -107
  21. package/components/ion-checkbox.js +1 -6
  22. package/components/ion-chip.js +1 -66
  23. package/components/ion-col.js +1 -163
  24. package/components/ion-content.js +1 -6
  25. package/components/ion-datetime-button.js +1 -383
  26. package/components/ion-datetime.js +1 -2047
  27. package/components/ion-fab-button.js +1 -151
  28. package/components/ion-fab-list.js +1 -73
  29. package/components/ion-fab.js +1 -101
  30. package/components/ion-footer.js +1 -179
  31. package/components/ion-grid.js +1 -46
  32. package/components/ion-header.js +1 -6
  33. package/components/ion-icon.js +1 -6
  34. package/components/ion-img.js +1 -133
  35. package/components/ion-infinite-scroll-content.js +1 -69
  36. package/components/ion-infinite-scroll.js +1 -236
  37. package/components/ion-input-otp.js +1 -682
  38. package/components/ion-input-password-toggle.js +1 -128
  39. package/components/ion-input.js +1 -646
  40. package/components/ion-item-divider.js +1 -59
  41. package/components/ion-item-group.js +1 -46
  42. package/components/ion-item-option.js +1 -91
  43. package/components/ion-item-options.js +1 -73
  44. package/components/ion-item-sliding.js +1 -457
  45. package/components/ion-item.js +1 -6
  46. package/components/ion-label.js +1 -6
  47. package/components/ion-list-header.js +1 -6
  48. package/components/ion-list.js +1 -6
  49. package/components/ion-loading.js +1 -343
  50. package/components/ion-menu-button.js +1 -109
  51. package/components/ion-menu-toggle.js +1 -64
  52. package/components/ion-menu.js +1 -741
  53. package/components/ion-modal.js +1 -6
  54. package/components/ion-nav-link.js +1 -64
  55. package/components/ion-nav.js +1 -951
  56. package/components/ion-note.js +1 -47
  57. package/components/ion-picker-column-option.js +1 -6
  58. package/components/ion-picker-column.js +1 -6
  59. package/components/ion-picker-legacy-column.js +1 -6
  60. package/components/ion-picker-legacy.js +1 -342
  61. package/components/ion-picker.js +1 -6
  62. package/components/ion-popover.js +1 -6
  63. package/components/ion-progress-bar.js +1 -100
  64. package/components/ion-radio-group.js +1 -6
  65. package/components/ion-radio.js +1 -6
  66. package/components/ion-range.js +1 -844
  67. package/components/ion-refresher-content.js +1 -88
  68. package/components/ion-refresher.js +1 -750
  69. package/components/ion-reorder-group.js +1 -322
  70. package/components/ion-reorder.js +1 -60
  71. package/components/ion-ripple-effect.js +1 -6
  72. package/components/ion-route-redirect.js +1 -45
  73. package/components/ion-route.js +1 -74
  74. package/components/ion-router-link.js +1 -61
  75. package/components/ion-router-outlet.js +1 -226
  76. package/components/ion-router.js +1 -840
  77. package/components/ion-row.js +1 -36
  78. package/components/ion-searchbar.js +1 -540
  79. package/components/ion-segment-button.js +1 -173
  80. package/components/ion-segment-content.js +1 -35
  81. package/components/ion-segment-view.js +1 -142
  82. package/components/ion-segment.js +1 -602
  83. package/components/ion-select-modal.js +1 -6
  84. package/components/ion-select-option.js +1 -46
  85. package/components/ion-select-popover.js +1 -6
  86. package/components/ion-select.js +1 -1035
  87. package/components/ion-skeleton-text.js +1 -64
  88. package/components/ion-spinner.js +1 -6
  89. package/components/ion-split-pane.js +1 -190
  90. package/components/ion-tab-bar.js +1 -135
  91. package/components/ion-tab-button.js +1 -127
  92. package/components/ion-tab.js +1 -82
  93. package/components/ion-tabs.js +1 -204
  94. package/components/ion-text.js +1 -42
  95. package/components/ion-textarea.js +1 -554
  96. package/components/ion-thumbnail.js +1 -36
  97. package/components/ion-title.js +1 -6
  98. package/components/ion-toast.js +1 -938
  99. package/components/ion-toggle.js +1 -360
  100. package/components/ion-toolbar.js +1 -6
  101. package/components/p-1KVKSLu5.js +4 -0
  102. package/{dist/ionic/p-DUt5fQmA.js → components/p-9VcRUwdB.js} +1 -1
  103. package/components/p-ApmKVjaE.js +4 -0
  104. package/components/p-B-hirT0v.js +1 -35
  105. package/components/p-B6FQ0cKR.js +4 -0
  106. package/components/p-B6HaBl3o.js +4 -0
  107. package/components/p-B8b1Ukl9.js +4 -0
  108. package/components/p-BFxT89Wl.js +4 -0
  109. package/components/p-BJoMtgfR.js +4 -0
  110. package/components/p-BNAG-aVv.js +4 -0
  111. package/{dist/ionic/p-D-eFFUkA.js → components/p-BR3tZJmu.js} +1 -1
  112. package/{dist/ionic/p-D0dMcSkw.js → components/p-BS1TtEiJ.js} +1 -1
  113. package/components/p-BSB38Tek.js +4 -0
  114. package/components/p-BTEOs1at.js +1 -192
  115. package/components/p-BTeL5HCK.js +4 -0
  116. package/{dist/ionic/p-DbQ5QkTP.js → components/p-BUbsoBOV.js} +1 -1
  117. package/components/p-BVnB3eEn.js +4 -0
  118. package/components/p-BYDc3hSE.js +4 -0
  119. package/components/p-BagjAGC0.js +4 -0
  120. package/components/p-BegtE7nr.js +4 -0
  121. package/components/p-BgwEQWW6.js +4 -0
  122. package/components/p-Bk2zuNWT.js +4 -0
  123. package/components/p-BmVRXR1y.js +1 -72
  124. package/components/p-Bum_LjMh.js +4 -0
  125. package/components/p-BxwWvu-b.js +4 -0
  126. package/components/p-C4jPsTQa.js +4 -0
  127. package/components/p-C53feagD.js +1 -15
  128. package/{dist/ionic/p-CwgG81ZD.js → components/p-C59ryAuS.js} +1 -1
  129. package/components/p-C7AoMl7c.js +4 -0
  130. package/components/p-CBzELu-H.js +4 -0
  131. package/components/p-CDfQnFrd.js +4 -0
  132. package/components/p-CH0NYjKq.js +4 -0
  133. package/components/p-CIGNaXM1.js +1 -10
  134. package/components/p-CO7fmmxt.js +1 -29
  135. package/components/p-CU1SSH8_.js +4 -0
  136. package/components/p-CVF7ukTk.js +4 -0
  137. package/components/p-CgfaEEem.js +4 -0
  138. package/components/p-CgqKJg96.js +4 -0
  139. package/components/p-Cl0B-RWe.js +1 -452
  140. package/components/p-CneGxKsZ.js +4 -0
  141. package/components/p-CoA-aqGF.js +4 -0
  142. package/{dist/ionic/p-DdR6rpbR.js → components/p-Cq8cQ0NL.js} +1 -1
  143. package/components/p-Csw8xuz4.js +4 -0
  144. package/components/p-CtWGkNnJ.js +1 -162
  145. package/components/p-Cwv-vmkN.js +4 -0
  146. package/{dist/ionic/p-BYEqWnSg.js → components/p-Cy5XSfIk.js} +1 -1
  147. package/components/p-Cyxa_4PV.js +4 -0
  148. package/components/p-Cz5nLPGT.js +4 -0
  149. package/components/p-D13Eaw-8.js +1 -76
  150. package/components/p-D6NJwNJN.js +4 -0
  151. package/components/p-D6Ynv7Xh.js +1 -141
  152. package/components/p-DHsZWn1l.js +4 -0
  153. package/components/p-DJMZehmW.js +4 -0
  154. package/components/p-DJztqcrH.js +1 -14
  155. package/components/p-DYdpXONG.js +4 -0
  156. package/components/p-DgbT0exM.js +4 -0
  157. package/components/p-DiVJyqlX.js +1 -40
  158. package/components/p-Dtdm8lKC.js +1 -44
  159. package/components/p-YLXPWgVj.js +4 -0
  160. package/components/p-ZjP4CjeZ.js +1 -4
  161. package/{dist/ionic/p-DCv9sLH2.js → components/p-ak_d-z48.js} +1 -1
  162. package/components/p-cyNmxje6.js +1 -155
  163. package/components/p-fpbh6w3f.js +4 -0
  164. package/components/p-hHmYLOfE.js +1 -87
  165. package/components/p-kvaDs24J.js +4 -0
  166. package/components/p-vEbVo2hO.js +4 -0
  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-CuMghsQ-.js → input-shims-Dl5cnc_e.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 +48 -43
  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 +75 -46
  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 +19 -17
  205. package/dist/cjs/ion-item_8.cjs.entry.js +48 -42
  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 +237 -59
  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 +205 -57
  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 +17 -13
  226. package/dist/cjs/ion-select_3.cjs.entry.js +33 -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 +12 -7
  260. package/dist/collection/components/datetime/datetime.js +43 -22
  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 +10 -5
  268. package/dist/collection/components/item-divider/item-divider.js +7 -3
  269. package/dist/collection/components/item-option/item-option.js +6 -3
  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 +6 -3
  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/gestures/sheet.js +120 -12
  278. package/dist/collection/components/modal/gestures/swipe-to-close.js +54 -1
  279. package/dist/collection/components/modal/modal.js +127 -45
  280. package/dist/collection/components/nav/nav.js +89 -45
  281. package/dist/collection/components/nav-link/nav-link.js +9 -5
  282. package/dist/collection/components/note/note.js +2 -1
  283. package/dist/collection/components/picker/picker.js +2 -1
  284. package/dist/collection/components/picker-column/picker-column.js +6 -3
  285. package/dist/collection/components/picker-column-option/picker-column-option.js +2 -1
  286. package/dist/collection/components/picker-legacy/picker.js +24 -12
  287. package/dist/collection/components/picker-legacy-column/picker-column.js +4 -2
  288. package/dist/collection/components/popover/popover.js +33 -17
  289. package/dist/collection/components/progress-bar/progress-bar.js +2 -1
  290. package/dist/collection/components/radio/radio.js +2 -1
  291. package/dist/collection/components/radio-group/radio-group.js +6 -3
  292. package/dist/collection/components/range/range.js +214 -53
  293. package/dist/collection/components/refresher/refresher.js +73 -5
  294. package/dist/collection/components/refresher-content/refresher-content.js +8 -4
  295. package/dist/collection/components/reorder-group/reorder-group.js +6 -3
  296. package/dist/collection/components/route/route.js +4 -2
  297. package/dist/collection/components/router/router.js +10 -5
  298. package/dist/collection/components/router-link/router-link.js +6 -3
  299. package/dist/collection/components/router-outlet/router-outlet.js +18 -9
  300. package/dist/collection/components/searchbar/searchbar.js +11 -6
  301. package/dist/collection/components/segment/segment.js +10 -5
  302. package/dist/collection/components/segment-button/segment-button.js +4 -2
  303. package/dist/collection/components/segment-view/segment-view.ios.css +2 -1
  304. package/dist/collection/components/segment-view/segment-view.js +30 -4
  305. package/dist/collection/components/segment-view/segment-view.md.css +2 -1
  306. package/dist/collection/components/select/select.js +17 -8
  307. package/dist/collection/components/select-modal/select-modal.js +27 -2
  308. package/dist/collection/components/select-popover/select-popover.js +2 -1
  309. package/dist/collection/components/skeleton-text/skeleton-text.js +2 -1
  310. package/dist/collection/components/spinner/spinner.js +4 -2
  311. package/dist/collection/components/tab/tab.js +4 -2
  312. package/dist/collection/components/tab-bar/tab-bar.js +4 -2
  313. package/dist/collection/components/tab-button/tab-button.js +4 -2
  314. package/dist/collection/components/tabs/tabs.js +4 -2
  315. package/dist/collection/components/text/text.js +2 -1
  316. package/dist/collection/components/textarea/textarea.js +10 -7
  317. package/dist/collection/components/title/title.js +4 -2
  318. package/dist/collection/components/toast/toast.js +34 -17
  319. package/dist/collection/components/toggle/toggle.js +4 -2
  320. package/dist/collection/components/toolbar/toolbar.js +2 -1
  321. package/dist/docs.d.ts +37 -0
  322. package/dist/docs.json +1186 -389
  323. package/dist/esm/{animation-Dt8bGnA-.js → animation-CnGMT4ji.js} +1 -1
  324. package/dist/esm/app-globals-DhZjtldk.js +9 -0
  325. package/dist/esm/{button-active-L570Swow.js → button-active-BBx21brx.js} +1 -1
  326. package/dist/esm/{config-mCdtaoPe.js → config-TO1rZH52.js} +1 -1
  327. package/dist/esm/{data-DCORV9FH.js → data-B9iGR5YO.js} +1 -1
  328. package/dist/esm/{framework-delegate-BYawdMXj.js → framework-delegate-CyxE1S_P.js} +1 -1
  329. package/dist/esm/{hardware-back-button-CPLxO-Ev.js → hardware-back-button-CTe4XmL7.js} +1 -1
  330. package/dist/esm/{helpers-DEn3pfjm.js → helpers-Tl8jw6S2.js} +1 -1
  331. package/dist/esm/{index-r2D9DEro.js → index-B-hkiOUh.js} +4 -4
  332. package/dist/esm/{index-CvDIirVx.js → index-B2KwgBLx.js} +5 -5
  333. package/dist/esm/{index-ceb5RaMT.js → index-BtUdxPjv.js} +2 -2
  334. package/dist/esm/{index-C8IsBmNU.js → index-IGIE5vDm.js} +503 -382
  335. package/dist/esm/{index-Bs3kT4bc.js → index-hW6eNZ3o.js} +2 -2
  336. package/dist/esm/index.js +12 -12
  337. package/dist/esm/{input-shims-D6H3ZaWt.js → input-shims-AaDhOpKN.js} +3 -3
  338. package/dist/esm/{input.utils-DrvTa8gz.js → input.utils-Bxa_DQ7-.js} +2 -2
  339. package/dist/esm/ion-accordion_2.entry.js +23 -15
  340. package/dist/esm/ion-action-sheet.entry.js +21 -15
  341. package/dist/esm/ion-alert.entry.js +25 -17
  342. package/dist/esm/ion-app_8.entry.js +48 -43
  343. package/dist/esm/ion-avatar_3.entry.js +12 -12
  344. package/dist/esm/ion-back-button.entry.js +7 -7
  345. package/dist/esm/ion-backdrop.entry.js +6 -6
  346. package/dist/esm/ion-breadcrumb_2.entry.js +20 -14
  347. package/dist/esm/ion-button_2.entry.js +36 -18
  348. package/dist/esm/ion-card_5.entry.js +23 -23
  349. package/dist/esm/ion-checkbox.entry.js +7 -7
  350. package/dist/esm/ion-chip.entry.js +6 -6
  351. package/dist/esm/ion-col_3.entry.js +8 -8
  352. package/dist/esm/ion-datetime-button.entry.js +8 -8
  353. package/dist/esm/ion-datetime_3.entry.js +75 -46
  354. package/dist/esm/ion-fab_3.entry.js +17 -13
  355. package/dist/esm/ion-img.entry.js +8 -6
  356. package/dist/esm/ion-infinite-scroll_2.entry.js +17 -13
  357. package/dist/esm/ion-input-otp.entry.js +16 -10
  358. package/dist/esm/ion-input-password-toggle.entry.js +9 -7
  359. package/dist/esm/ion-input.entry.js +21 -13
  360. package/dist/esm/ion-item-option_3.entry.js +19 -17
  361. package/dist/esm/ion-item_8.entry.js +48 -42
  362. package/dist/esm/ion-loading.entry.js +18 -14
  363. package/dist/esm/ion-menu_3.entry.js +30 -22
  364. package/dist/esm/ion-modal.entry.js +237 -59
  365. package/dist/esm/ion-nav_2.entry.js +14 -10
  366. package/dist/esm/ion-picker-column-option.entry.js +10 -8
  367. package/dist/esm/ion-picker-column.entry.js +11 -7
  368. package/dist/esm/ion-picker.entry.js +6 -6
  369. package/dist/esm/ion-popover.entry.js +21 -15
  370. package/dist/esm/ion-progress-bar.entry.js +7 -7
  371. package/dist/esm/ion-radio_2.entry.js +17 -13
  372. package/dist/esm/ion-range.entry.js +205 -57
  373. package/dist/esm/ion-refresher_2.entry.js +45 -14
  374. package/dist/esm/ion-reorder_2.entry.js +13 -11
  375. package/dist/esm/ion-ripple-effect.entry.js +4 -4
  376. package/dist/esm/ion-route_4.entry.js +20 -10
  377. package/dist/esm/ion-searchbar.entry.js +22 -12
  378. package/dist/esm/ion-segment-content.entry.js +3 -3
  379. package/dist/esm/ion-segment-view.entry.js +13 -8
  380. package/dist/esm/ion-segment_2.entry.js +26 -16
  381. package/dist/esm/ion-select-modal.entry.js +17 -13
  382. package/dist/esm/ion-select_3.entry.js +33 -24
  383. package/dist/esm/ion-spinner.entry.js +4 -4
  384. package/dist/esm/ion-split-pane.entry.js +15 -9
  385. package/dist/esm/ion-tab-bar_2.entry.js +14 -12
  386. package/dist/esm/ion-tab_2.entry.js +10 -8
  387. package/dist/esm/ion-text.entry.js +4 -4
  388. package/dist/esm/ion-textarea.entry.js +20 -14
  389. package/dist/esm/ion-toast.entry.js +21 -15
  390. package/dist/esm/ion-toggle.entry.js +10 -8
  391. package/dist/esm/{ionic-global-CDrldh-5.js → ionic-global-DfbeLwcV.js} +1 -1
  392. package/dist/esm/ionic.js +6 -6
  393. package/dist/esm/{ios.transition-BDzw0_Hm.js → ios.transition--aMF-pDH.js} +4 -4
  394. package/dist/esm/loader.js +5 -5
  395. package/dist/esm/{md.transition-BzDYi3qq.js → md.transition-BEVbfm8j.js} +4 -4
  396. package/dist/esm/{notch-controller-BwelN_JM.js → notch-controller-DAcvKU57.js} +1 -1
  397. package/dist/esm/{overlays-D5YkFThA.js → overlays-F8GHPo-e.js} +5 -5
  398. package/dist/esm/{status-tap-5DQ7Fc4V.js → status-tap-BfJqFSLF.js} +3 -3
  399. package/dist/esm/{swipe-back-BKw2CAHc.js → swipe-back-BZBFwTQV.js} +2 -2
  400. package/dist/html.html-data.json +117 -109
  401. package/dist/ionic/index.esm.js +1 -1
  402. package/dist/ionic/ionic.esm.js +1 -1
  403. package/dist/ionic/p-031b76f7.entry.js +4 -0
  404. package/dist/ionic/p-045a6a42.entry.js +4 -0
  405. package/dist/ionic/p-07506134.entry.js +4 -0
  406. package/dist/ionic/p-084c25b2.entry.js +4 -0
  407. package/dist/ionic/p-0d8b5c38.entry.js +4 -0
  408. package/dist/ionic/p-16813ce7.entry.js +4 -0
  409. package/dist/ionic/p-16b65553.entry.js +4 -0
  410. package/dist/ionic/p-1b02923f.entry.js +4 -0
  411. package/dist/ionic/{p-5c8f7253.entry.js → p-1b169fb6.entry.js} +1 -1
  412. package/dist/ionic/{p-915b3e3d.entry.js → p-23fac490.entry.js} +1 -1
  413. package/dist/ionic/{p-b8551510.entry.js → p-294f4bb5.entry.js} +1 -1
  414. package/dist/ionic/p-2a68388b.entry.js +4 -0
  415. package/dist/ionic/p-2f5a8140.entry.js +4 -0
  416. package/dist/ionic/{p-49d06882.entry.js → p-301c43f8.entry.js} +1 -1
  417. package/dist/ionic/{p-79bd78f9.entry.js → p-370a60ee.entry.js} +1 -1
  418. package/dist/ionic/p-3e143d1d.entry.js +4 -0
  419. package/dist/ionic/p-4819b469.entry.js +4 -0
  420. package/dist/ionic/p-4dd5e8e0.entry.js +4 -0
  421. package/dist/ionic/p-51c11c47.entry.js +4 -0
  422. package/dist/ionic/p-53f750a5.entry.js +4 -0
  423. package/dist/ionic/{p-7cad388a.entry.js → p-6af16209.entry.js} +1 -1
  424. package/dist/ionic/{p-7f98e710.entry.js → p-6b701daa.entry.js} +1 -1
  425. package/dist/ionic/p-6b97f2a3.entry.js +4 -0
  426. package/dist/ionic/p-71e322f7.entry.js +4 -0
  427. package/dist/ionic/p-7620be24.entry.js +4 -0
  428. package/dist/ionic/p-771b27a5.entry.js +4 -0
  429. package/dist/ionic/{p-906bb44d.entry.js → p-7ca71c83.entry.js} +1 -1
  430. package/dist/ionic/{p-11aa58d6.entry.js → p-80cac7a2.entry.js} +1 -1
  431. package/dist/ionic/p-96a2e768.entry.js +4 -0
  432. package/dist/ionic/{p-582824c5.entry.js → p-9833cf63.entry.js} +1 -1
  433. package/dist/ionic/p-9cbc6f1f.entry.js +4 -0
  434. package/dist/ionic/p-9cdbabbb.entry.js +4 -0
  435. package/dist/ionic/p-9eac4eb1.entry.js +4 -0
  436. package/dist/ionic/{p-675b1a31.entry.js → p-9fae83d8.entry.js} +1 -1
  437. package/dist/ionic/p-B8xlpH8p.js +4 -0
  438. package/dist/ionic/{p-C7hRNDhM.js → p-BAt5H1ac.js} +1 -1
  439. package/dist/ionic/p-BW_TRJm8.js +4 -0
  440. package/dist/ionic/{p-DDb5r57F.js → p-Bum7H1fw.js} +1 -1
  441. package/dist/ionic/p-BvFYtOdE.js +4 -0
  442. package/dist/ionic/{p-Dc45iWE4.js → p-BxIcPWoV.js} +1 -1
  443. package/dist/ionic/p-C0JvVFMv.js +4 -0
  444. package/dist/ionic/{p-CTfR9YZG.js → p-CGmVTdWh.js} +1 -1
  445. package/dist/ionic/{p-BOVrCkpJ.js → p-CYbRmDdy.js} +1 -1
  446. package/dist/ionic/{p-MUoJJJwd.js → p-CYvM5g3q.js} +1 -1
  447. package/dist/ionic/p-CmFz1Mjc.js +4 -0
  448. package/dist/ionic/p-CtA-yJYy.js +4 -0
  449. package/dist/ionic/p-D8HJQ1qq.js +4 -0
  450. package/dist/ionic/{p-B0q1YL7N.js → p-DB_iPQC-.js} +1 -1
  451. package/dist/ionic/{p-DNcfiJwE.js → p-DLbbmF9h.js} +1 -1
  452. package/dist/ionic/p-DTPR1Wpn.js +4 -0
  453. package/dist/ionic/p-DjriolRs.js +4 -0
  454. package/dist/ionic/p-DtVZDHlS.js +4 -0
  455. package/dist/ionic/p-IGIE5vDm.js +5 -0
  456. package/dist/ionic/{p-BFvmZNyx.js → p-NFFyoJ4Q.js} +1 -1
  457. package/dist/ionic/p-a805674e.entry.js +4 -0
  458. package/dist/ionic/{p-da7d04cc.entry.js → p-a84f2d21.entry.js} +1 -1
  459. package/dist/ionic/p-aa47f46e.entry.js +4 -0
  460. package/dist/ionic/{p-2668188b.entry.js → p-b325a113.entry.js} +1 -1
  461. package/dist/ionic/{p-d1f54e28.entry.js → p-b440381f.entry.js} +1 -1
  462. package/dist/ionic/p-b6e0ff03.entry.js +4 -0
  463. package/dist/ionic/{p-6f37536a.entry.js → p-bcaa827e.entry.js} +1 -1
  464. package/dist/ionic/{p-fb0271ae.entry.js → p-c3cce9d8.entry.js} +1 -1
  465. package/dist/ionic/{p-b0a7585c.entry.js → p-ca31010f.entry.js} +1 -1
  466. package/dist/ionic/p-d4e8b473.entry.js +4 -0
  467. package/dist/ionic/{p-9575b654.entry.js → p-e663bc5a.entry.js} +1 -1
  468. package/dist/ionic/p-e6c5f060.entry.js +4 -0
  469. package/dist/ionic/{p-652318c3.entry.js → p-e6cedcd7.entry.js} +1 -1
  470. package/dist/ionic/{p-fbb00634.entry.js → p-e863ffe8.entry.js} +1 -1
  471. package/dist/ionic/{p-0ca0fe9c.entry.js → p-f2deaceb.entry.js} +1 -1
  472. package/dist/ionic/{p-ac4eb91d.entry.js → p-f5dfb9a3.entry.js} +1 -1
  473. package/dist/ionic/{p-bce86e56.entry.js → p-f8186550.entry.js} +1 -1
  474. package/dist/ionic/p-fdbc90d4.entry.js +4 -0
  475. package/dist/ionic/p-gbVXD275.js +4 -0
  476. package/dist/ionic/p-hNN3VvaC.js +4 -0
  477. package/dist/types/components/datetime/datetime.d.ts +10 -0
  478. package/dist/types/components/header/header.utils.d.ts +2 -1
  479. package/dist/types/components/item/item.d.ts +2 -0
  480. package/dist/types/components/item-divider/item-divider.d.ts +3 -0
  481. package/dist/types/components/item-option/item-option.d.ts +2 -0
  482. package/dist/types/components/list-header/list-header.d.ts +2 -0
  483. package/dist/types/components/modal/gestures/sheet.d.ts +2 -2
  484. package/dist/types/components/modal/gestures/swipe-to-close.d.ts +2 -2
  485. package/dist/types/components/modal/modal-interface.d.ts +25 -0
  486. package/dist/types/components/modal/modal.d.ts +22 -1
  487. package/dist/types/components/range/range-interface.d.ts +1 -0
  488. package/dist/types/components/range/range.d.ts +44 -4
  489. package/dist/types/components/refresher/refresher-interface.d.ts +7 -0
  490. package/dist/types/components/refresher/refresher.d.ts +16 -3
  491. package/dist/types/components/segment-view/segment-view.d.ts +4 -0
  492. package/dist/types/components/select/select.d.ts +3 -0
  493. package/dist/types/components/select-modal/select-modal.d.ts +4 -0
  494. package/dist/types/components.d.ts +964 -191
  495. package/dist/types/interface.d.ts +2 -2
  496. package/dist/types/stencil-public-runtime.d.ts +126 -14
  497. package/dist/types/utils/gesture/listener.d.ts +2 -1
  498. package/hydrate/index.d.ts +12 -0
  499. package/hydrate/index.js +5632 -1421
  500. package/hydrate/index.mjs +5631 -1422
  501. package/package.json +2 -2
  502. package/components/p-B25GjpND.js +0 -71
  503. package/components/p-BANeLH_G.js +0 -290
  504. package/components/p-BBFQmhcD.js +0 -59
  505. package/components/p-BC-awmYt.js +0 -306
  506. package/components/p-BHbOsu99.js +0 -501
  507. package/components/p-BTlwXR9e.js +0 -73
  508. package/components/p-BcazQttQ.js +0 -612
  509. package/components/p-BdGshsIJ.js +0 -226
  510. package/components/p-BfS7vSpC.js +0 -147
  511. package/components/p-BhRFCLuX.js +0 -675
  512. package/components/p-Bhnhnzjz.js +0 -75
  513. package/components/p-BmcqD0EN.js +0 -153
  514. package/components/p-Boi6hecl.js +0 -115
  515. package/components/p-Bt_moUyl.js +0 -232
  516. package/components/p-Bxl5etF4.js +0 -146
  517. package/components/p-ByjmWt3s.js +0 -139
  518. package/components/p-C04oPyjT.js +0 -54
  519. package/components/p-C6dkQWq2.js +0 -1626
  520. package/components/p-CFZWrvIQ.js +0 -194
  521. package/components/p-CIJwkzL6.js +0 -195
  522. package/components/p-CL12ApCQ.js +0 -820
  523. package/components/p-CXJR56Oq.js +0 -564
  524. package/components/p-Cdm3dKWf.js +0 -108
  525. package/components/p-CslsoGzv.js +0 -192
  526. package/components/p-Cyd00tgZ.js +0 -167
  527. package/components/p-CzAJ3ArC.js +0 -380
  528. package/components/p-CzW34QBh.js +0 -12
  529. package/components/p-D0zXRwcr.js +0 -196
  530. package/components/p-D5hF6rwn.js +0 -339
  531. package/components/p-D8eD2iBA.js +0 -67
  532. package/components/p-DGOrLIyS.js +0 -481
  533. package/components/p-DK2Bn1Mc.js +0 -305
  534. package/components/p-DKRQWlK2.js +0 -598
  535. package/components/p-DNDUsygf.js +0 -128
  536. package/components/p-DTWZF6wg.js +0 -418
  537. package/components/p-DWoUQeZ3.js +0 -3012
  538. package/components/p-DX0w75a9.js +0 -420
  539. package/components/p-Dt8zaCLQ.js +0 -92
  540. package/components/p-DyFBFrV7.js +0 -264
  541. package/components/p-DyHPCMyn.js +0 -39
  542. package/components/p-LgLeKTkH.js +0 -112
  543. package/components/p-NhiRFRn9.js +0 -50
  544. package/components/p-OuiHmXO5.js +0 -646
  545. package/components/p-Wro9IPHE.js +0 -459
  546. package/components/p-aIWC4ZEV.js +0 -305
  547. package/components/p-c-XJ9XhZ.js +0 -915
  548. package/components/p-fVuFT3Wd.js +0 -78
  549. package/components/p-iyo0Toaz.js +0 -2822
  550. package/components/p-l_lso3Zl.js +0 -140
  551. package/components/p-mQp4lwQD.js +0 -1638
  552. package/dist/cjs/app-globals-Ciccnk9_.js +0 -10
  553. package/dist/esm/app-globals-BDSf8fOA.js +0 -8
  554. package/dist/ionic/p-11518b31.entry.js +0 -4
  555. package/dist/ionic/p-221a3d8c.entry.js +0 -4
  556. package/dist/ionic/p-2ac254dc.entry.js +0 -4
  557. package/dist/ionic/p-2bd1ea35.entry.js +0 -4
  558. package/dist/ionic/p-30333874.entry.js +0 -4
  559. package/dist/ionic/p-31db96da.entry.js +0 -4
  560. package/dist/ionic/p-34642fa1.entry.js +0 -4
  561. package/dist/ionic/p-35696017.entry.js +0 -4
  562. package/dist/ionic/p-363d1209.entry.js +0 -4
  563. package/dist/ionic/p-46a38cfd.entry.js +0 -4
  564. package/dist/ionic/p-4eec1a5e.entry.js +0 -4
  565. package/dist/ionic/p-530fcd71.entry.js +0 -4
  566. package/dist/ionic/p-5d6fb6e3.entry.js +0 -4
  567. package/dist/ionic/p-66fbe052.entry.js +0 -4
  568. package/dist/ionic/p-7babec72.entry.js +0 -4
  569. package/dist/ionic/p-82d5bb3d.entry.js +0 -4
  570. package/dist/ionic/p-97eb0812.entry.js +0 -4
  571. package/dist/ionic/p-9b6d46f2.entry.js +0 -4
  572. package/dist/ionic/p-BKc55Xev.js +0 -4
  573. package/dist/ionic/p-Bmgaetn_.js +0 -4
  574. package/dist/ionic/p-C8IsBmNU.js +0 -5
  575. package/dist/ionic/p-CJxh_yLS.js +0 -4
  576. package/dist/ionic/p-DZRJwG4S.js +0 -4
  577. package/dist/ionic/p-a4a9f5ae.entry.js +0 -4
  578. package/dist/ionic/p-b0ebf9f8.entry.js +0 -4
  579. package/dist/ionic/p-be263062.entry.js +0 -4
  580. package/dist/ionic/p-c175d792.entry.js +0 -4
  581. package/dist/ionic/p-cc2a9936.entry.js +0 -4
  582. package/dist/ionic/p-cc45bcbc.entry.js +0 -4
  583. package/dist/ionic/p-d0a2a1ab.entry.js +0 -4
  584. package/dist/ionic/p-e4c57008.entry.js +0 -4
  585. package/dist/ionic/p-e5d6d0f0.entry.js +0 -4
  586. package/dist/ionic/p-f1dfee25.entry.js +0 -4
  587. package/dist/ionic/p-f9f7b9db.entry.js +0 -4
@@ -1,2822 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { p as proxyCustomElement, H, e as createEvent, f as printIonWarning, w as writeTask, c as config, h, d as Host } from './p-DWoUQeZ3.js';
5
- import { a as findClosestIonContent, i as isIonContent, d as disableContentScrollY, r as resetContentScrollY, f as findIonContent, p as printIonContentErrorMsg } from './p-DNDUsygf.js';
6
- import { C as CoreDelegate, a as attachComponent, d as detachComponent } from './p-l_lso3Zl.js';
7
- import { f as clamp, g as getElementRoot, r as raf, d as inheritAttributes, k as hasLazyBuild } from './p-D5hF6rwn.js';
8
- import { c as createLockController } from './p-B-hirT0v.js';
9
- import { g as getCapacitor } from './p-CIGNaXM1.js';
10
- 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 './p-c-XJ9XhZ.js';
11
- import { g as getClassMap } from './p-DiVJyqlX.js';
12
- import { e as deepReady, w as waitForMount } from './p-DTWZF6wg.js';
13
- import { b as getIonMode } from './p-Bxl5etF4.js';
14
- import { KEYBOARD_DID_OPEN } from './p-D6Ynv7Xh.js';
15
- import { c as createAnimation } from './p-CL12ApCQ.js';
16
- import { g as getTimeGivenProgression } from './p-hHmYLOfE.js';
17
- import { createGesture } from './p-Cl0B-RWe.js';
18
- import { w as win } from './p-ZjP4CjeZ.js';
19
- import { d as defineCustomElement$1 } from './p-Bhnhnzjz.js';
20
-
21
- var Style;
22
- (function (Style) {
23
- Style["Dark"] = "DARK";
24
- Style["Light"] = "LIGHT";
25
- Style["Default"] = "DEFAULT";
26
- })(Style || (Style = {}));
27
- const StatusBar = {
28
- getEngine() {
29
- const capacitor = getCapacitor();
30
- if (capacitor === null || capacitor === void 0 ? void 0 : capacitor.isPluginAvailable('StatusBar')) {
31
- return capacitor.Plugins.StatusBar;
32
- }
33
- return undefined;
34
- },
35
- setStyle(options) {
36
- const engine = this.getEngine();
37
- if (!engine) {
38
- return;
39
- }
40
- engine.setStyle(options);
41
- },
42
- getStyle: async function () {
43
- const engine = this.getEngine();
44
- if (!engine) {
45
- return Style.Default;
46
- }
47
- const { style } = await engine.getInfo();
48
- return style;
49
- },
50
- };
51
-
52
- /**
53
- * Use y = mx + b to
54
- * figure out the backdrop value
55
- * at a particular x coordinate. This
56
- * is useful when the backdrop does
57
- * not begin to fade in until after
58
- * the 0 breakpoint.
59
- */
60
- const getBackdropValueForSheet = (x, backdropBreakpoint) => {
61
- /**
62
- * We will use these points:
63
- * (backdropBreakpoint, 0)
64
- * (maxBreakpoint, 1)
65
- * We know that at the beginning breakpoint,
66
- * the backdrop will be hidden. We also
67
- * know that at the maxBreakpoint, the backdrop
68
- * must be fully visible. maxBreakpoint should
69
- * always be 1 even if the maximum value
70
- * of the breakpoints array is not 1 since
71
- * the animation runs from a progress of 0
72
- * to a progress of 1.
73
- * m = (y2 - y1) / (x2 - x1)
74
- *
75
- * This is simplified from:
76
- * m = (1 - 0) / (maxBreakpoint - backdropBreakpoint)
77
- *
78
- * If the backdropBreakpoint is 1, we return 0 as the
79
- * backdrop is completely hidden.
80
- *
81
- */
82
- if (backdropBreakpoint === 1) {
83
- return 0;
84
- }
85
- const slope = 1 / (1 - backdropBreakpoint);
86
- /**
87
- * From here, compute b which is
88
- * the backdrop opacity if the offset
89
- * is 0. If the backdrop does not
90
- * begin to fade in until after the
91
- * 0 breakpoint, this b value will be
92
- * negative. This is fine as we never pass
93
- * b directly into the animation keyframes.
94
- * b = y - mx
95
- * Use a known point: (backdropBreakpoint, 0)
96
- * This is simplified from:
97
- * b = 0 - (backdropBreakpoint * slope)
98
- */
99
- const b = -(backdropBreakpoint * slope);
100
- /**
101
- * Finally, we can now determine the
102
- * backdrop offset given an arbitrary
103
- * gesture offset.
104
- */
105
- return x * slope + b;
106
- };
107
- /**
108
- * The tablet/desktop card modal activates
109
- * when the window width is >= 768.
110
- * At that point, the presenting element
111
- * is not transformed, so we do not need to
112
- * adjust the status bar color.
113
- *
114
- */
115
- const setCardStatusBarDark = () => {
116
- if (!win || win.innerWidth >= 768) {
117
- return;
118
- }
119
- StatusBar.setStyle({ style: Style.Dark });
120
- };
121
- const setCardStatusBarDefault = (defaultStyle = Style.Default) => {
122
- if (!win || win.innerWidth >= 768) {
123
- return;
124
- }
125
- StatusBar.setStyle({ style: defaultStyle });
126
- };
127
-
128
- const handleCanDismiss = async (el, animation) => {
129
- /**
130
- * If canDismiss is not a function
131
- * then we can return early. If canDismiss is `true`,
132
- * then canDismissBlocksGesture is `false` as canDismiss
133
- * will never interrupt the gesture. As a result,
134
- * this code block is never reached. If canDismiss is `false`,
135
- * then we never dismiss.
136
- */
137
- if (typeof el.canDismiss !== 'function') {
138
- return;
139
- }
140
- /**
141
- * Run the canDismiss callback.
142
- * If the function returns `true`,
143
- * then we can proceed with dismiss.
144
- */
145
- const shouldDismiss = await el.canDismiss(undefined, GESTURE);
146
- if (!shouldDismiss) {
147
- return;
148
- }
149
- /**
150
- * If canDismiss resolved after the snap
151
- * back animation finished, we can
152
- * dismiss immediately.
153
- *
154
- * If canDismiss resolved before the snap
155
- * back animation finished, we need to
156
- * wait until the snap back animation is
157
- * done before dismissing.
158
- */
159
- if (animation.isRunning()) {
160
- animation.onFinish(() => {
161
- el.dismiss(undefined, 'handler');
162
- }, { oneTimeCallback: true });
163
- }
164
- else {
165
- el.dismiss(undefined, 'handler');
166
- }
167
- };
168
- /**
169
- * This function lets us simulate a realistic spring-like animation
170
- * when swiping down on the modal.
171
- * There are two forces that we need to use to compute the spring physics:
172
- *
173
- * 1. Stiffness, k: This is a measure of resistance applied a spring.
174
- * 2. Dampening, c: This value has the effect of reducing or preventing oscillation.
175
- *
176
- * Using these two values, we can calculate the Spring Force and the Dampening Force
177
- * to compute the total force applied to a spring.
178
- *
179
- * Spring Force: This force pulls a spring back into its equilibrium position.
180
- * Hooke's Law tells us that that spring force (FS) = kX.
181
- * k is the stiffness of a spring, and X is the displacement of the spring from its
182
- * equilibrium position. In this case, it is the amount by which the free end
183
- * of a spring was displaced (stretched/pushed) from its "relaxed" position.
184
- *
185
- * Dampening Force: This force slows down motion. Without it, a spring would oscillate forever.
186
- * The dampening force, FD, can be found via this formula: FD = -cv
187
- * where c the dampening value and v is velocity.
188
- *
189
- * Therefore, the resulting force that is exerted on the block is:
190
- * F = FS + FD = -kX - cv
191
- *
192
- * Newton's 2nd Law tells us that F = ma:
193
- * ma = -kX - cv.
194
- *
195
- * For Ionic's purposes, we can assume that m = 1:
196
- * a = -kX - cv
197
- *
198
- * Imagine a block attached to the end of a spring. At equilibrium
199
- * the block is at position x = 1.
200
- * Pressing on the block moves it to position x = 0;
201
- * So, to calculate the displacement, we need to take the
202
- * current position and subtract the previous position from it.
203
- * X = x - x0 = 0 - 1 = -1.
204
- *
205
- * For Ionic's purposes, we are only pushing on the spring modal
206
- * so we have a max position of 1.
207
- * As a result, we can expand displacement to this formula:
208
- * X = x - 1
209
- *
210
- * a = -k(x - 1) - cv
211
- *
212
- * We can represent the motion of something as a function of time: f(t) = x.
213
- * The derivative of position gives us the velocity: f'(t)
214
- * The derivative of the velocity gives us the acceleration: f''(t)
215
- *
216
- * We can substitute the formula above with these values:
217
- *
218
- * f"(t) = -k * (f(t) - 1) - c * f'(t)
219
- *
220
- * This is called a differential equation.
221
- *
222
- * We know that at t = 0, we are at x = 0 because the modal does not move: f(0) = 0
223
- * This means our velocity is also zero: f'(0) = 0.
224
- *
225
- * We can cheat a bit and plug the formula into Wolfram Alpha.
226
- * However, we need to pick stiffness and dampening values:
227
- * k = 0.57
228
- * c = 15
229
- *
230
- * I picked these as they are fairly close to native iOS's spring effect
231
- * with the modal.
232
- *
233
- * What we plug in is this: f(0) = 0; f'(0) = 0; f''(t) = -0.57(f(t) - 1) - 15f'(t)
234
- *
235
- * The result is a formula that lets us calculate the acceleration
236
- * for a given time t.
237
- * Note: This is the approximate form of the solution. Wolfram Alpha will
238
- * give you a complex differential equation too.
239
- */
240
- const calculateSpringStep = (t) => {
241
- return 0.00255275 * 2.71828 ** (-14.9619 * t) - 1.00255 * 2.71828 ** (-0.0380968 * t) + 1;
242
- };
243
-
244
- // Defaults for the card swipe animation
245
- const SwipeToCloseDefaults = {
246
- MIN_PRESENTING_SCALE: 0.915,
247
- };
248
- const createSwipeToCloseGesture = (el, animation, statusBarStyle, onDismiss) => {
249
- /**
250
- * The step value at which a card modal
251
- * is eligible for dismissing via gesture.
252
- */
253
- const DISMISS_THRESHOLD = 0.5;
254
- const height = el.offsetHeight;
255
- let isOpen = false;
256
- let canDismissBlocksGesture = false;
257
- let contentEl = null;
258
- let scrollEl = null;
259
- const canDismissMaxStep = 0.2;
260
- let initialScrollY = true;
261
- let lastStep = 0;
262
- const getScrollY = () => {
263
- if (contentEl && isIonContent(contentEl)) {
264
- return contentEl.scrollY;
265
- /**
266
- * Custom scroll containers are intended to be
267
- * used with virtual scrolling, so we assume
268
- * there is scrolling in this case.
269
- */
270
- }
271
- else {
272
- return true;
273
- }
274
- };
275
- const canStart = (detail) => {
276
- const target = detail.event.target;
277
- if (target === null || !target.closest) {
278
- return true;
279
- }
280
- /**
281
- * If we are swiping on the content,
282
- * swiping should only be possible if
283
- * the content is scrolled all the way
284
- * to the top so that we do not interfere
285
- * with scrolling.
286
- *
287
- * We cannot assume that the `ion-content`
288
- * target will remain consistent between
289
- * swipes. For example, when using
290
- * ion-nav within a card modal it is
291
- * possible to swipe, push a view, and then
292
- * swipe again. The target content will not
293
- * be the same between swipes.
294
- */
295
- contentEl = findClosestIonContent(target);
296
- if (contentEl) {
297
- /**
298
- * The card should never swipe to close
299
- * on the content with a refresher.
300
- * Note: We cannot solve this by making the
301
- * swipeToClose gesture have a higher priority
302
- * than the refresher gesture as the iOS native
303
- * refresh gesture uses a scroll listener in
304
- * addition to a gesture.
305
- *
306
- * Note: Do not use getScrollElement here
307
- * because we need this to be a synchronous
308
- * operation, and getScrollElement is
309
- * asynchronous.
310
- */
311
- if (isIonContent(contentEl)) {
312
- const root = getElementRoot(contentEl);
313
- scrollEl = root.querySelector('.inner-scroll');
314
- }
315
- else {
316
- scrollEl = contentEl;
317
- }
318
- const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
319
- return !hasRefresherInContent && scrollEl.scrollTop === 0;
320
- }
321
- /**
322
- * Card should be swipeable on all
323
- * parts of the modal except for the footer.
324
- */
325
- const footer = target.closest('ion-footer');
326
- if (footer === null) {
327
- return true;
328
- }
329
- return false;
330
- };
331
- const onStart = (detail) => {
332
- const { deltaY } = detail;
333
- /**
334
- * Get the initial scrollY value so
335
- * that we can correctly reset the scrollY
336
- * prop when the gesture ends.
337
- */
338
- initialScrollY = getScrollY();
339
- /**
340
- * If canDismiss is anything other than `true`
341
- * then users should be able to swipe down
342
- * until a threshold is hit. At that point,
343
- * the card modal should not proceed any further.
344
- * TODO (FW-937)
345
- * Remove undefined check
346
- */
347
- canDismissBlocksGesture = el.canDismiss !== undefined && el.canDismiss !== true;
348
- /**
349
- * If we are pulling down, then
350
- * it is possible we are pulling on the
351
- * content. We do not want scrolling to
352
- * happen at the same time as the gesture.
353
- */
354
- if (deltaY > 0 && contentEl) {
355
- disableContentScrollY(contentEl);
356
- }
357
- animation.progressStart(true, isOpen ? 1 : 0);
358
- };
359
- const onMove = (detail) => {
360
- const { deltaY } = detail;
361
- /**
362
- * If we are pulling down, then
363
- * it is possible we are pulling on the
364
- * content. We do not want scrolling to
365
- * happen at the same time as the gesture.
366
- */
367
- if (deltaY > 0 && contentEl) {
368
- disableContentScrollY(contentEl);
369
- }
370
- /**
371
- * If we are swiping on the content
372
- * then the swipe gesture should only
373
- * happen if we are pulling down.
374
- *
375
- * However, if we pull up and
376
- * then down such that the scroll position
377
- * returns to 0, we should be able to swipe
378
- * the card.
379
- */
380
- const step = detail.deltaY / height;
381
- /**
382
- * Check if user is swiping down and
383
- * if we have a canDismiss value that
384
- * should block the gesture from
385
- * proceeding,
386
- */
387
- const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
388
- /**
389
- * If we are blocking the gesture from dismissing,
390
- * set the max step value so that the sheet cannot be
391
- * completely hidden.
392
- */
393
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
394
- /**
395
- * If we are blocking the gesture from
396
- * dismissing, calculate the spring modifier value
397
- * this will be added to the starting breakpoint
398
- * value to give the gesture a spring-like feeling.
399
- * Note that the starting breakpoint is always 0,
400
- * so we omit adding 0 to the result.
401
- */
402
- const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
403
- const clampedStep = clamp(0.0001, processedStep, maxStep);
404
- animation.progressStep(clampedStep);
405
- /**
406
- * When swiping down half way, the status bar style
407
- * should be reset to its default value.
408
- *
409
- * We track lastStep so that we do not fire these
410
- * functions on every onMove, only when the user has
411
- * crossed a certain threshold.
412
- */
413
- if (clampedStep >= DISMISS_THRESHOLD && lastStep < DISMISS_THRESHOLD) {
414
- setCardStatusBarDefault(statusBarStyle);
415
- /**
416
- * However, if we swipe back up, then the
417
- * status bar style should be set to have light
418
- * text on a dark background.
419
- */
420
- }
421
- else if (clampedStep < DISMISS_THRESHOLD && lastStep >= DISMISS_THRESHOLD) {
422
- setCardStatusBarDark();
423
- }
424
- lastStep = clampedStep;
425
- };
426
- const onEnd = (detail) => {
427
- const velocity = detail.velocityY;
428
- const step = detail.deltaY / height;
429
- const isAttemptingDismissWithCanDismiss = step >= 0 && canDismissBlocksGesture;
430
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
431
- const processedStep = isAttemptingDismissWithCanDismiss ? calculateSpringStep(step / maxStep) : step;
432
- const clampedStep = clamp(0.0001, processedStep, maxStep);
433
- const threshold = (detail.deltaY + velocity * 1000) / height;
434
- /**
435
- * If canDismiss blocks
436
- * the swipe gesture, then the
437
- * animation can never complete until
438
- * canDismiss is checked.
439
- */
440
- const shouldComplete = !isAttemptingDismissWithCanDismiss && threshold >= DISMISS_THRESHOLD;
441
- let newStepValue = shouldComplete ? -1e-3 : 0.001;
442
- if (!shouldComplete) {
443
- animation.easing('cubic-bezier(1, 0, 0.68, 0.28)');
444
- newStepValue += getTimeGivenProgression([0, 0], [1, 0], [0.68, 0.28], [1, 1], clampedStep)[0];
445
- }
446
- else {
447
- animation.easing('cubic-bezier(0.32, 0.72, 0, 1)');
448
- newStepValue += getTimeGivenProgression([0, 0], [0.32, 0.72], [0, 1], [1, 1], clampedStep)[0];
449
- }
450
- const duration = shouldComplete
451
- ? computeDuration(step * height, velocity)
452
- : computeDuration((1 - clampedStep) * height, velocity);
453
- isOpen = shouldComplete;
454
- gesture.enable(false);
455
- if (contentEl) {
456
- resetContentScrollY(contentEl, initialScrollY);
457
- }
458
- animation
459
- .onFinish(() => {
460
- if (!shouldComplete) {
461
- gesture.enable(true);
462
- }
463
- })
464
- .progressEnd(shouldComplete ? 1 : 0, newStepValue, duration);
465
- /**
466
- * If the canDismiss value blocked the gesture
467
- * from proceeding, then we should ignore whatever
468
- * shouldComplete is. Whether or not the modal
469
- * animation should complete is now determined by
470
- * canDismiss.
471
- *
472
- * If the user swiped >25% of the way
473
- * to the max step, then we should
474
- * check canDismiss. 25% was chosen
475
- * to avoid accidental swipes.
476
- */
477
- if (isAttemptingDismissWithCanDismiss && clampedStep > maxStep / 4) {
478
- handleCanDismiss(el, animation);
479
- }
480
- else if (shouldComplete) {
481
- onDismiss();
482
- }
483
- };
484
- const gesture = createGesture({
485
- el,
486
- gestureName: 'modalSwipeToClose',
487
- gesturePriority: OVERLAY_GESTURE_PRIORITY,
488
- direction: 'y',
489
- threshold: 10,
490
- canStart,
491
- onStart,
492
- onMove,
493
- onEnd,
494
- });
495
- return gesture;
496
- };
497
- const computeDuration = (remaining, velocity) => {
498
- return clamp(400, remaining / Math.abs(velocity * 1.1), 500);
499
- };
500
-
501
- const createSheetEnterAnimation = (opts) => {
502
- const { currentBreakpoint, backdropBreakpoint, expandToScroll } = opts;
503
- /**
504
- * If the backdropBreakpoint is undefined, then the backdrop
505
- * should always fade in. If the backdropBreakpoint came before the
506
- * current breakpoint, then the backdrop should be fading in.
507
- */
508
- const shouldShowBackdrop = backdropBreakpoint === undefined || backdropBreakpoint < currentBreakpoint;
509
- const initialBackdrop = shouldShowBackdrop ? `calc(var(--backdrop-opacity) * ${currentBreakpoint})` : '0';
510
- const backdropAnimation = createAnimation('backdropAnimation').fromTo('opacity', 0, initialBackdrop);
511
- if (shouldShowBackdrop) {
512
- backdropAnimation
513
- .beforeStyles({
514
- 'pointer-events': 'none',
515
- })
516
- .afterClearStyles(['pointer-events']);
517
- }
518
- const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
519
- { offset: 0, opacity: 1, transform: 'translateY(100%)' },
520
- { offset: 1, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
521
- ]);
522
- /**
523
- * This allows the content to be scrollable at any breakpoint.
524
- */
525
- const contentAnimation = !expandToScroll
526
- ? createAnimation('contentAnimation').keyframes([
527
- { offset: 0, opacity: 1, maxHeight: `${(1 - currentBreakpoint) * 100}%` },
528
- { offset: 1, opacity: 1, maxHeight: `${currentBreakpoint * 100}%` },
529
- ])
530
- : undefined;
531
- return { wrapperAnimation, backdropAnimation, contentAnimation };
532
- };
533
- const createSheetLeaveAnimation = (opts) => {
534
- const { currentBreakpoint, backdropBreakpoint } = opts;
535
- /**
536
- * Backdrop does not always fade in from 0 to 1 if backdropBreakpoint
537
- * is defined, so we need to account for that offset by figuring out
538
- * what the current backdrop value should be.
539
- */
540
- const backdropValue = `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(currentBreakpoint, backdropBreakpoint)})`;
541
- const defaultBackdrop = [
542
- { offset: 0, opacity: backdropValue },
543
- { offset: 1, opacity: 0 },
544
- ];
545
- const customBackdrop = [
546
- { offset: 0, opacity: backdropValue },
547
- { offset: backdropBreakpoint, opacity: 0 },
548
- { offset: 1, opacity: 0 },
549
- ];
550
- const backdropAnimation = createAnimation('backdropAnimation').keyframes(backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop);
551
- const wrapperAnimation = createAnimation('wrapperAnimation').keyframes([
552
- { offset: 0, opacity: 1, transform: `translateY(${100 - currentBreakpoint * 100}%)` },
553
- { offset: 1, opacity: 1, transform: `translateY(100%)` },
554
- ]);
555
- return { wrapperAnimation, backdropAnimation };
556
- };
557
-
558
- const createEnterAnimation$1 = () => {
559
- const backdropAnimation = createAnimation()
560
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
561
- .beforeStyles({
562
- 'pointer-events': 'none',
563
- })
564
- .afterClearStyles(['pointer-events']);
565
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(100vh)', 'translateY(0vh)');
566
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
567
- };
568
- /**
569
- * iOS Modal Enter Animation for the Card presentation style
570
- */
571
- const iosEnterAnimation = (baseEl, opts) => {
572
- const { presentingEl, currentBreakpoint, expandToScroll } = opts;
573
- const root = getElementRoot(baseEl);
574
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation$1();
575
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
576
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
577
- // The content animation is only added if scrolling is enabled for
578
- // all the breakpoints.
579
- !expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
580
- const baseAnimation = createAnimation('entering-base')
581
- .addElement(baseEl)
582
- .easing('cubic-bezier(0.32,0.72,0,1)')
583
- .duration(500)
584
- .addAnimation([wrapperAnimation]);
585
- if (contentAnimation) {
586
- baseAnimation.addAnimation(contentAnimation);
587
- }
588
- if (presentingEl) {
589
- const isPortrait = window.innerWidth < 768;
590
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
591
- const presentingElRoot = getElementRoot(presentingEl);
592
- const presentingAnimation = createAnimation().beforeStyles({
593
- transform: 'translateY(0)',
594
- 'transform-origin': 'top center',
595
- overflow: 'hidden',
596
- });
597
- const bodyEl = document.body;
598
- if (isPortrait) {
599
- /**
600
- * Fallback for browsers that does not support `max()` (ex: Firefox)
601
- * No need to worry about statusbar padding since engines like Gecko
602
- * are not used as the engine for standalone Cordova/Capacitor apps
603
- */
604
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
605
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
606
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
607
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
608
- presentingAnimation
609
- .afterStyles({
610
- transform: finalTransform,
611
- })
612
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
613
- .addElement(presentingEl)
614
- .keyframes([
615
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
616
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
617
- ]);
618
- baseAnimation.addAnimation(presentingAnimation);
619
- }
620
- else {
621
- baseAnimation.addAnimation(backdropAnimation);
622
- if (!hasCardModal) {
623
- wrapperAnimation.fromTo('opacity', '0', '1');
624
- }
625
- else {
626
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
627
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
628
- presentingAnimation
629
- .afterStyles({
630
- transform: finalTransform,
631
- })
632
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
633
- .keyframes([
634
- { offset: 0, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
635
- { offset: 1, filter: 'contrast(0.85)', transform: finalTransform },
636
- ]);
637
- const shadowAnimation = createAnimation()
638
- .afterStyles({
639
- transform: finalTransform,
640
- })
641
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
642
- .keyframes([
643
- { offset: 0, opacity: '1', transform: 'translateY(0) scale(1)' },
644
- { offset: 1, opacity: '0', transform: finalTransform },
645
- ]);
646
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
647
- }
648
- }
649
- }
650
- else {
651
- baseAnimation.addAnimation(backdropAnimation);
652
- }
653
- return baseAnimation;
654
- };
655
-
656
- const createLeaveAnimation$1 = () => {
657
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
658
- const wrapperAnimation = createAnimation().fromTo('transform', 'translateY(0vh)', 'translateY(100vh)');
659
- return { backdropAnimation, wrapperAnimation };
660
- };
661
- /**
662
- * iOS Modal Leave Animation
663
- */
664
- const iosLeaveAnimation = (baseEl, opts, duration = 500) => {
665
- const { presentingEl, currentBreakpoint } = opts;
666
- const root = getElementRoot(baseEl);
667
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation$1();
668
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
669
- wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')).beforeStyles({ opacity: 1 });
670
- const baseAnimation = createAnimation('leaving-base')
671
- .addElement(baseEl)
672
- .easing('cubic-bezier(0.32,0.72,0,1)')
673
- .duration(duration)
674
- .addAnimation(wrapperAnimation);
675
- if (presentingEl) {
676
- const isPortrait = window.innerWidth < 768;
677
- const hasCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
678
- const presentingElRoot = getElementRoot(presentingEl);
679
- const presentingAnimation = createAnimation()
680
- .beforeClearStyles(['transform'])
681
- .afterClearStyles(['transform'])
682
- .onFinish((currentStep) => {
683
- // only reset background color if this is the last card-style modal
684
- if (currentStep !== 1) {
685
- return;
686
- }
687
- presentingEl.style.setProperty('overflow', '');
688
- const numModals = Array.from(bodyEl.querySelectorAll('ion-modal:not(.overlay-hidden)')).filter((m) => m.presentingElement !== undefined).length;
689
- if (numModals <= 1) {
690
- bodyEl.style.setProperty('background-color', '');
691
- }
692
- });
693
- const bodyEl = document.body;
694
- if (isPortrait) {
695
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
696
- const modalTransform = hasCardModal ? '-10px' : transformOffset;
697
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
698
- const finalTransform = `translateY(${modalTransform}) scale(${toPresentingScale})`;
699
- presentingAnimation.addElement(presentingEl).keyframes([
700
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform, borderRadius: '10px 10px 0 0' },
701
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0px) scale(1)', borderRadius: '0px' },
702
- ]);
703
- baseAnimation.addAnimation(presentingAnimation);
704
- }
705
- else {
706
- baseAnimation.addAnimation(backdropAnimation);
707
- if (!hasCardModal) {
708
- wrapperAnimation.fromTo('opacity', '1', '0');
709
- }
710
- else {
711
- const toPresentingScale = hasCardModal ? SwipeToCloseDefaults.MIN_PRESENTING_SCALE : 1;
712
- const finalTransform = `translateY(-10px) scale(${toPresentingScale})`;
713
- presentingAnimation
714
- .addElement(presentingElRoot.querySelector('.modal-wrapper'))
715
- .afterStyles({
716
- transform: 'translate3d(0, 0, 0)',
717
- })
718
- .keyframes([
719
- { offset: 0, filter: 'contrast(0.85)', transform: finalTransform },
720
- { offset: 1, filter: 'contrast(1)', transform: 'translateY(0) scale(1)' },
721
- ]);
722
- const shadowAnimation = createAnimation()
723
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
724
- .afterStyles({
725
- transform: 'translateY(0) scale(1)',
726
- })
727
- .keyframes([
728
- { offset: 0, opacity: '0', transform: finalTransform },
729
- { offset: 1, opacity: '1', transform: 'translateY(0) scale(1)' },
730
- ]);
731
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
732
- }
733
- }
734
- }
735
- else {
736
- baseAnimation.addAnimation(backdropAnimation);
737
- }
738
- return baseAnimation;
739
- };
740
-
741
- /**
742
- * Transition animation from portrait view to landscape view
743
- * This handles the case where a card modal is open in portrait view
744
- * and the user switches to landscape view
745
- */
746
- const portraitToLandscapeTransition = (baseEl, opts, duration = 300) => {
747
- const { presentingEl } = opts;
748
- if (!presentingEl) {
749
- // No transition needed for non-card modals
750
- return createAnimation('portrait-to-landscape-transition');
751
- }
752
- const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
753
- const presentingElRoot = getElementRoot(presentingEl);
754
- const bodyEl = document.body;
755
- const baseAnimation = createAnimation('portrait-to-landscape-transition')
756
- .addElement(baseEl)
757
- .easing('cubic-bezier(0.32,0.72,0,1)')
758
- .duration(duration);
759
- const presentingAnimation = createAnimation().beforeStyles({
760
- transform: 'translateY(0)',
761
- 'transform-origin': 'top center',
762
- overflow: 'hidden',
763
- });
764
- if (!presentingElIsCardModal) {
765
- // The presenting element is not a card modal, so we do not
766
- // need to care about layering and modal-specific styles.
767
- const root = getElementRoot(baseEl);
768
- const wrapperAnimation = createAnimation()
769
- .addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
770
- .fromTo('opacity', '1', '1'); // Keep wrapper visible in landscape
771
- const backdropAnimation = createAnimation()
772
- .addElement(root.querySelector('ion-backdrop'))
773
- .fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
774
- // Animate presentingEl from portrait state back to normal
775
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
776
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
777
- const fromTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
778
- presentingAnimation
779
- .addElement(presentingEl)
780
- .afterStyles({
781
- transform: 'translateY(0px) scale(1)',
782
- 'border-radius': '0px',
783
- })
784
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', ''))
785
- .fromTo('transform', fromTransform, 'translateY(0px) scale(1)')
786
- .fromTo('filter', 'contrast(0.85)', 'contrast(1)')
787
- .fromTo('border-radius', '10px 10px 0 0', '0px');
788
- baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
789
- }
790
- else {
791
- // The presenting element is a card modal, so we do
792
- // need to care about layering and modal-specific styles.
793
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
794
- const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
795
- const toTransform = `translateY(0px) scale(1)`;
796
- presentingAnimation
797
- .addElement(presentingEl)
798
- .afterStyles({
799
- transform: toTransform,
800
- })
801
- .fromTo('transform', fromTransform, toTransform)
802
- .fromTo('filter', 'contrast(0.85)', 'contrast(1)');
803
- const shadowAnimation = createAnimation()
804
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
805
- .afterStyles({
806
- transform: toTransform,
807
- opacity: '0',
808
- })
809
- .fromTo('transform', fromTransform, toTransform);
810
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
811
- }
812
- return baseAnimation;
813
- };
814
- /**
815
- * Transition animation from landscape view to portrait view
816
- * This handles the case where a card modal is open in landscape view
817
- * and the user switches to portrait view
818
- */
819
- const landscapeToPortraitTransition = (baseEl, opts, duration = 300) => {
820
- const { presentingEl } = opts;
821
- if (!presentingEl) {
822
- // No transition needed for non-card modals
823
- return createAnimation('landscape-to-portrait-transition');
824
- }
825
- const presentingElIsCardModal = presentingEl.tagName === 'ION-MODAL' && presentingEl.presentingElement !== undefined;
826
- const presentingElRoot = getElementRoot(presentingEl);
827
- const bodyEl = document.body;
828
- const baseAnimation = createAnimation('landscape-to-portrait-transition')
829
- .addElement(baseEl)
830
- .easing('cubic-bezier(0.32,0.72,0,1)')
831
- .duration(duration);
832
- const presentingAnimation = createAnimation().beforeStyles({
833
- transform: 'translateY(0)',
834
- 'transform-origin': 'top center',
835
- overflow: 'hidden',
836
- });
837
- if (!presentingElIsCardModal) {
838
- // The presenting element is not a card modal, so we do not
839
- // need to care about layering and modal-specific styles.
840
- const root = getElementRoot(baseEl);
841
- const wrapperAnimation = createAnimation()
842
- .addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow'))
843
- .fromTo('opacity', '1', '1'); // Keep wrapper visible
844
- const backdropAnimation = createAnimation()
845
- .addElement(root.querySelector('ion-backdrop'))
846
- .fromTo('opacity', 'var(--backdrop-opacity)', 'var(--backdrop-opacity)'); // Keep backdrop visible
847
- // Animate presentingEl from normal state to portrait state
848
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)') ? '30px' : 'max(30px, var(--ion-safe-area-top))';
849
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
850
- const toTransform = `translateY(${transformOffset}) scale(${toPresentingScale})`;
851
- presentingAnimation
852
- .addElement(presentingEl)
853
- .afterStyles({
854
- transform: toTransform,
855
- })
856
- .beforeAddWrite(() => bodyEl.style.setProperty('background-color', 'black'))
857
- .keyframes([
858
- { offset: 0, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '0px' },
859
- { offset: 0.2, transform: 'translateY(0px) scale(1)', filter: 'contrast(1)', borderRadius: '10px 10px 0 0' },
860
- { offset: 1, transform: toTransform, filter: 'contrast(0.85)', borderRadius: '10px 10px 0 0' },
861
- ]);
862
- baseAnimation.addAnimation([presentingAnimation, wrapperAnimation, backdropAnimation]);
863
- }
864
- else {
865
- // The presenting element is also a card modal, so we need
866
- // to handle layering and modal-specific styles.
867
- const toPresentingScale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
868
- const fromTransform = `translateY(-10px) scale(${toPresentingScale})`;
869
- const toTransform = `translateY(0) scale(1)`;
870
- presentingAnimation
871
- .addElement(presentingEl)
872
- .afterStyles({
873
- transform: toTransform,
874
- })
875
- .fromTo('transform', fromTransform, toTransform);
876
- const shadowAnimation = createAnimation()
877
- .addElement(presentingElRoot.querySelector('.modal-shadow'))
878
- .afterStyles({
879
- transform: toTransform,
880
- opacity: '0',
881
- })
882
- .fromTo('transform', fromTransform, toTransform);
883
- baseAnimation.addAnimation([presentingAnimation, shadowAnimation]);
884
- }
885
- return baseAnimation;
886
- };
887
-
888
- const createEnterAnimation = () => {
889
- const backdropAnimation = createAnimation()
890
- .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
891
- .beforeStyles({
892
- 'pointer-events': 'none',
893
- })
894
- .afterClearStyles(['pointer-events']);
895
- const wrapperAnimation = createAnimation().keyframes([
896
- { offset: 0, opacity: 0.01, transform: 'translateY(40px)' },
897
- { offset: 1, opacity: 1, transform: `translateY(0px)` },
898
- ]);
899
- return { backdropAnimation, wrapperAnimation, contentAnimation: undefined };
900
- };
901
- /**
902
- * Md Modal Enter Animation
903
- */
904
- const mdEnterAnimation = (baseEl, opts) => {
905
- const { currentBreakpoint, expandToScroll } = opts;
906
- const root = getElementRoot(baseEl);
907
- const { wrapperAnimation, backdropAnimation, contentAnimation } = currentBreakpoint !== undefined ? createSheetEnterAnimation(opts) : createEnterAnimation();
908
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
909
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
910
- // The content animation is only added if scrolling is enabled for
911
- // all the breakpoints.
912
- !expandToScroll && (contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.addElement(baseEl.querySelector('.ion-page')));
913
- const baseAnimation = createAnimation()
914
- .addElement(baseEl)
915
- .easing('cubic-bezier(0.36,0.66,0.04,1)')
916
- .duration(280)
917
- .addAnimation([backdropAnimation, wrapperAnimation]);
918
- if (contentAnimation) {
919
- baseAnimation.addAnimation(contentAnimation);
920
- }
921
- return baseAnimation;
922
- };
923
-
924
- const createLeaveAnimation = () => {
925
- const backdropAnimation = createAnimation().fromTo('opacity', 'var(--backdrop-opacity)', 0);
926
- const wrapperAnimation = createAnimation().keyframes([
927
- { offset: 0, opacity: 0.99, transform: `translateY(0px)` },
928
- { offset: 1, opacity: 0, transform: 'translateY(40px)' },
929
- ]);
930
- return { backdropAnimation, wrapperAnimation };
931
- };
932
- /**
933
- * Md Modal Leave Animation
934
- */
935
- const mdLeaveAnimation = (baseEl, opts) => {
936
- const { currentBreakpoint } = opts;
937
- const root = getElementRoot(baseEl);
938
- const { wrapperAnimation, backdropAnimation } = currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();
939
- backdropAnimation.addElement(root.querySelector('ion-backdrop'));
940
- wrapperAnimation.addElement(root.querySelector('.modal-wrapper'));
941
- const baseAnimation = createAnimation()
942
- .easing('cubic-bezier(0.47,0,0.745,0.715)')
943
- .duration(200)
944
- .addAnimation([backdropAnimation, wrapperAnimation]);
945
- return baseAnimation;
946
- };
947
-
948
- const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], expandToScroll, getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
949
- // Defaults for the sheet swipe animation
950
- const defaultBackdrop = [
951
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
952
- { offset: 1, opacity: 0.01 },
953
- ];
954
- const customBackdrop = [
955
- { offset: 0, opacity: 'var(--backdrop-opacity)' },
956
- { offset: 1 - backdropBreakpoint, opacity: 0 },
957
- { offset: 1, opacity: 0 },
958
- ];
959
- const SheetDefaults = {
960
- WRAPPER_KEYFRAMES: [
961
- { offset: 0, transform: 'translateY(0%)' },
962
- { offset: 1, transform: 'translateY(100%)' },
963
- ],
964
- BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
965
- CONTENT_KEYFRAMES: [
966
- { offset: 0, maxHeight: '100%' },
967
- { offset: 1, maxHeight: '0%' },
968
- ],
969
- };
970
- const contentEl = baseEl.querySelector('ion-content');
971
- const height = wrapperEl.clientHeight;
972
- let currentBreakpoint = initialBreakpoint;
973
- let offset = 0;
974
- let canDismissBlocksGesture = false;
975
- let cachedScrollEl = null;
976
- let cachedFooterEls = null;
977
- let cachedFooterYPosition = null;
978
- let currentFooterState = null;
979
- const canDismissMaxStep = 0.95;
980
- const maxBreakpoint = breakpoints[breakpoints.length - 1];
981
- const minBreakpoint = breakpoints[0];
982
- const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
983
- const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
984
- const contentAnimation = animation.childAnimations.find((ani) => ani.id === 'contentAnimation');
985
- const enableBackdrop = () => {
986
- // Respect explicit opt-out of focus trapping/backdrop interactions
987
- // If focusTrap is false or showBackdrop is false, do not enable the backdrop or re-enable focus trap
988
- const el = baseEl;
989
- if (el.focusTrap === false || el.showBackdrop === false) {
990
- return;
991
- }
992
- baseEl.style.setProperty('pointer-events', 'auto');
993
- backdropEl.style.setProperty('pointer-events', 'auto');
994
- /**
995
- * When the backdrop is enabled, elements such
996
- * as inputs should not be focusable outside
997
- * the sheet.
998
- */
999
- baseEl.classList.remove(FOCUS_TRAP_DISABLE_CLASS);
1000
- };
1001
- const disableBackdrop = () => {
1002
- baseEl.style.setProperty('pointer-events', 'none');
1003
- backdropEl.style.setProperty('pointer-events', 'none');
1004
- /**
1005
- * When the backdrop is enabled, elements such
1006
- * as inputs should not be focusable outside
1007
- * the sheet.
1008
- * Adding this class disables focus trapping
1009
- * for the sheet temporarily.
1010
- */
1011
- baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
1012
- };
1013
- /**
1014
- * Toggles the footer to an absolute position while moving to prevent
1015
- * it from shaking while the sheet is being dragged.
1016
- * @param newPosition Whether the footer is in a moving or stationary position.
1017
- */
1018
- const swapFooterPosition = (newPosition) => {
1019
- if (!cachedFooterEls) {
1020
- cachedFooterEls = Array.from(baseEl.querySelectorAll('ion-footer'));
1021
- if (!cachedFooterEls.length) {
1022
- return;
1023
- }
1024
- }
1025
- const page = baseEl.querySelector('.ion-page');
1026
- currentFooterState = newPosition;
1027
- if (newPosition === 'stationary') {
1028
- cachedFooterEls.forEach((cachedFooterEl) => {
1029
- // Reset positioning styles to allow normal document flow
1030
- cachedFooterEl.classList.remove('modal-footer-moving');
1031
- cachedFooterEl.style.removeProperty('position');
1032
- cachedFooterEl.style.removeProperty('width');
1033
- cachedFooterEl.style.removeProperty('height');
1034
- cachedFooterEl.style.removeProperty('top');
1035
- cachedFooterEl.style.removeProperty('left');
1036
- page === null || page === void 0 ? void 0 : page.style.removeProperty('padding-bottom');
1037
- // Move to page
1038
- page === null || page === void 0 ? void 0 : page.appendChild(cachedFooterEl);
1039
- });
1040
- }
1041
- else {
1042
- let footerHeights = 0;
1043
- cachedFooterEls.forEach((cachedFooterEl, index) => {
1044
- // Get both the footer and document body positions
1045
- const cachedFooterElRect = cachedFooterEl.getBoundingClientRect();
1046
- const bodyRect = document.body.getBoundingClientRect();
1047
- // Calculate the total height of all footers
1048
- // so we can add padding to the page element
1049
- footerHeights += cachedFooterEl.clientHeight;
1050
- // Calculate absolute position relative to body
1051
- // We need to subtract the body's offsetTop to get true position within document.body
1052
- const absoluteTop = cachedFooterElRect.top - bodyRect.top;
1053
- const absoluteLeft = cachedFooterElRect.left - bodyRect.left;
1054
- // Capture the footer's current dimensions and store them in CSS variables for
1055
- // later use when applying absolute positioning.
1056
- cachedFooterEl.style.setProperty('--pinned-width', `${cachedFooterEl.clientWidth}px`);
1057
- cachedFooterEl.style.setProperty('--pinned-height', `${cachedFooterEl.clientHeight}px`);
1058
- cachedFooterEl.style.setProperty('--pinned-top', `${absoluteTop}px`);
1059
- cachedFooterEl.style.setProperty('--pinned-left', `${absoluteLeft}px`);
1060
- // Only cache the first footer's Y position
1061
- // This is used to determine if the sheet has been moved below the footer
1062
- // and needs to be swapped back to stationary so it collapses correctly.
1063
- if (index === 0) {
1064
- cachedFooterYPosition = absoluteTop;
1065
- // If there's a header, we need to combine the header height with the footer position
1066
- // because the header moves with the drag handle, so when it starts overlapping the footer,
1067
- // we need to account for that.
1068
- const header = baseEl.querySelector('ion-header');
1069
- if (header) {
1070
- cachedFooterYPosition -= header.clientHeight;
1071
- }
1072
- }
1073
- });
1074
- // Apply the pinning of styles after we've calculated everything
1075
- // so that we don't cause layouts to shift while calculating the footer positions.
1076
- // Otherwise, with multiple footers we'll end up capturing the wrong positions.
1077
- cachedFooterEls.forEach((cachedFooterEl) => {
1078
- // Add padding to the parent element to prevent content from being hidden
1079
- // when the footer is positioned absolutely. This has to be done before we
1080
- // make the footer absolutely positioned or we may accidentally cause the
1081
- // sheet to scroll.
1082
- page === null || page === void 0 ? void 0 : page.style.setProperty('padding-bottom', `${footerHeights}px`);
1083
- // Apply positioning styles to keep footer at bottom
1084
- cachedFooterEl.classList.add('modal-footer-moving');
1085
- // Apply our preserved styles to pin the footer
1086
- cachedFooterEl.style.setProperty('position', 'absolute');
1087
- cachedFooterEl.style.setProperty('width', 'var(--pinned-width)');
1088
- cachedFooterEl.style.setProperty('height', 'var(--pinned-height)');
1089
- cachedFooterEl.style.setProperty('top', 'var(--pinned-top)');
1090
- cachedFooterEl.style.setProperty('left', 'var(--pinned-left)');
1091
- // Move the element to the body when everything else is done
1092
- document.body.appendChild(cachedFooterEl);
1093
- });
1094
- }
1095
- };
1096
- /**
1097
- * After the entering animation completes,
1098
- * we need to set the animation to go from
1099
- * offset 0 to offset 1 so that users can
1100
- * swipe in any direction. We then set the
1101
- * animation offset to the current breakpoint
1102
- * so there is no flickering.
1103
- */
1104
- if (wrapperAnimation && backdropAnimation) {
1105
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
1106
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
1107
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
1108
- animation.progressStart(true, 1 - currentBreakpoint);
1109
- /**
1110
- * If backdrop is not enabled, then content
1111
- * behind modal should be clickable. To do this, we need
1112
- * to remove pointer-events from ion-modal as a whole.
1113
- * ion-backdrop and .modal-wrapper always have pointer-events: auto
1114
- * applied, so the modal content can still be interacted with.
1115
- */
1116
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint &&
1117
- baseEl.focusTrap !== false &&
1118
- baseEl.showBackdrop !== false;
1119
- if (shouldEnableBackdrop) {
1120
- enableBackdrop();
1121
- }
1122
- else {
1123
- disableBackdrop();
1124
- }
1125
- }
1126
- if (contentEl && currentBreakpoint !== maxBreakpoint && expandToScroll) {
1127
- contentEl.scrollY = false;
1128
- }
1129
- const canStart = (detail) => {
1130
- /**
1131
- * If we are swiping on the content, swiping should only be possible if the content
1132
- * is scrolled all the way to the top so that we do not interfere with scrolling.
1133
- *
1134
- * We cannot assume that the `ion-content` target will remain consistent between swipes.
1135
- * For example, when using ion-nav within a modal it is possible to swipe, push a view,
1136
- * and then swipe again. The target content will not be the same between swipes.
1137
- */
1138
- const contentEl = findClosestIonContent(detail.event.target);
1139
- currentBreakpoint = getCurrentBreakpoint();
1140
- /**
1141
- * If `expandToScroll` is disabled, we should not allow the swipe gesture
1142
- * to start if the content is not scrolled to the top.
1143
- */
1144
- if (!expandToScroll && contentEl) {
1145
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
1146
- return scrollEl.scrollTop === 0;
1147
- }
1148
- if (currentBreakpoint === 1 && contentEl) {
1149
- /**
1150
- * The modal should never swipe to close on the content with a refresher.
1151
- * Note 1: We cannot solve this by making this gesture have a higher priority than
1152
- * the refresher gesture as the iOS native refresh gesture uses a scroll listener in
1153
- * addition to a gesture.
1154
- *
1155
- * Note 2: Do not use getScrollElement here because we need this to be a synchronous
1156
- * operation, and getScrollElement is asynchronous.
1157
- */
1158
- const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
1159
- const hasRefresherInContent = !!contentEl.querySelector('ion-refresher');
1160
- return !hasRefresherInContent && scrollEl.scrollTop === 0;
1161
- }
1162
- return true;
1163
- };
1164
- const onStart = (detail) => {
1165
- /**
1166
- * If canDismiss is anything other than `true`
1167
- * then users should be able to swipe down
1168
- * until a threshold is hit. At that point,
1169
- * the card modal should not proceed any further.
1170
- *
1171
- * canDismiss is never fired via gesture if there is
1172
- * no 0 breakpoint. However, it can be fired if the user
1173
- * presses Esc or the hardware back button.
1174
- * TODO (FW-937)
1175
- * Remove undefined check
1176
- */
1177
- canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
1178
- /**
1179
- * Cache the scroll element reference when the gesture starts,
1180
- * this allows us to avoid querying the DOM for the target in onMove,
1181
- * which would impact performance significantly.
1182
- */
1183
- if (!expandToScroll) {
1184
- const targetEl = findClosestIonContent(detail.event.target);
1185
- cachedScrollEl =
1186
- targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl;
1187
- }
1188
- /**
1189
- * If expandToScroll is disabled, we need to swap
1190
- * the footer position to moving so that it doesn't shake
1191
- * while the sheet is being dragged.
1192
- */
1193
- if (!expandToScroll) {
1194
- swapFooterPosition('moving');
1195
- }
1196
- /**
1197
- * If we are pulling down, then it is possible we are pulling on the content.
1198
- * We do not want scrolling to happen at the same time as the gesture.
1199
- */
1200
- if (detail.deltaY > 0 && contentEl) {
1201
- contentEl.scrollY = false;
1202
- }
1203
- raf(() => {
1204
- /**
1205
- * Dismisses the open keyboard when the sheet drag gesture is started.
1206
- * Sets the focus onto the modal element.
1207
- */
1208
- baseEl.focus();
1209
- });
1210
- animation.progressStart(true, 1 - currentBreakpoint);
1211
- };
1212
- const onMove = (detail) => {
1213
- /**
1214
- * If `expandToScroll` is disabled, we need to see if we're currently below
1215
- * the footer element and the footer is in a stationary position. If so,
1216
- * we need to make the stationary the original position so that the footer
1217
- * collapses with the sheet.
1218
- */
1219
- if (!expandToScroll && cachedFooterYPosition !== null && currentFooterState !== null) {
1220
- // Check if we need to swap the footer position
1221
- if (detail.currentY >= cachedFooterYPosition && currentFooterState === 'moving') {
1222
- swapFooterPosition('stationary');
1223
- }
1224
- else if (detail.currentY < cachedFooterYPosition && currentFooterState === 'stationary') {
1225
- swapFooterPosition('moving');
1226
- }
1227
- }
1228
- /**
1229
- * If `expandToScroll` is disabled, and an upwards swipe gesture is done within
1230
- * the scrollable content, we should not allow the swipe gesture to continue.
1231
- */
1232
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl) {
1233
- return;
1234
- }
1235
- /**
1236
- * If we are pulling down, then it is possible we are pulling on the content.
1237
- * We do not want scrolling to happen at the same time as the gesture.
1238
- * This accounts for when the user scrolls down, scrolls all the way up, and then
1239
- * pulls down again such that the modal should start to move.
1240
- */
1241
- if (detail.deltaY > 0 && contentEl) {
1242
- contentEl.scrollY = false;
1243
- }
1244
- /**
1245
- * Given the change in gesture position on the Y axis,
1246
- * compute where the offset of the animation should be
1247
- * relative to where the user dragged.
1248
- */
1249
- const initialStep = 1 - currentBreakpoint;
1250
- const secondToLastBreakpoint = breakpoints.length > 1 ? 1 - breakpoints[1] : undefined;
1251
- const step = initialStep + detail.deltaY / height;
1252
- const isAttemptingDismissWithCanDismiss = secondToLastBreakpoint !== undefined && step >= secondToLastBreakpoint && canDismissBlocksGesture;
1253
- /**
1254
- * If we are blocking the gesture from dismissing,
1255
- * set the max step value so that the sheet cannot be
1256
- * completely hidden.
1257
- */
1258
- const maxStep = isAttemptingDismissWithCanDismiss ? canDismissMaxStep : 0.9999;
1259
- /**
1260
- * If we are blocking the gesture from
1261
- * dismissing, calculate the spring modifier value
1262
- * this will be added to the starting breakpoint
1263
- * value to give the gesture a spring-like feeling.
1264
- * Note that when isAttemptingDismissWithCanDismiss is true,
1265
- * the modifier is always added to the breakpoint that
1266
- * appears right after the 0 breakpoint.
1267
- *
1268
- * Note that this modifier is essentially the progression
1269
- * between secondToLastBreakpoint and maxStep which is
1270
- * why we subtract secondToLastBreakpoint. This lets us get
1271
- * the result as a value from 0 to 1.
1272
- */
1273
- const processedStep = isAttemptingDismissWithCanDismiss && secondToLastBreakpoint !== undefined
1274
- ? secondToLastBreakpoint +
1275
- calculateSpringStep((step - secondToLastBreakpoint) / (maxStep - secondToLastBreakpoint))
1276
- : step;
1277
- offset = clamp(0.0001, processedStep, maxStep);
1278
- animation.progressStep(offset);
1279
- };
1280
- const onEnd = (detail) => {
1281
- /**
1282
- * If expandToScroll is disabled, we should not allow the moveSheetToBreakpoint
1283
- * function to be called if the user is trying to swipe content upwards and the content
1284
- * is not scrolled to the top.
1285
- */
1286
- if (!expandToScroll && detail.deltaY <= 0 && cachedScrollEl && cachedScrollEl.scrollTop > 0) {
1287
- /**
1288
- * If expand to scroll is disabled, we need to make sure we swap the footer position
1289
- * back to stationary so that it will collapse correctly if the modal is dismissed without
1290
- * dragging (e.g. through a dismiss button).
1291
- * This can cause issues if the user has a modal with content that can be dragged, as we'll
1292
- * swap to moving on drag and if we don't swap back here then the footer will get stuck.
1293
- */
1294
- swapFooterPosition('stationary');
1295
- return;
1296
- }
1297
- /**
1298
- * When the gesture releases, we need to determine
1299
- * the closest breakpoint to snap to.
1300
- */
1301
- const velocity = detail.velocityY;
1302
- const threshold = (detail.deltaY + velocity * 350) / height;
1303
- const diff = currentBreakpoint - threshold;
1304
- const closest = breakpoints.reduce((a, b) => {
1305
- return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
1306
- });
1307
- moveSheetToBreakpoint({
1308
- breakpoint: closest,
1309
- breakpointOffset: offset,
1310
- canDismiss: canDismissBlocksGesture,
1311
- /**
1312
- * The swipe is user-driven, so we should
1313
- * always animate when the gesture ends.
1314
- */
1315
- animated: true,
1316
- });
1317
- };
1318
- const moveSheetToBreakpoint = (options) => {
1319
- const { breakpoint, canDismiss, breakpointOffset, animated } = options;
1320
- /**
1321
- * canDismiss should only prevent snapping
1322
- * when users are trying to dismiss. If canDismiss
1323
- * is present but the user is trying to swipe upwards,
1324
- * we should allow that to happen,
1325
- */
1326
- const shouldPreventDismiss = canDismiss && breakpoint === 0;
1327
- const snapToBreakpoint = shouldPreventDismiss ? currentBreakpoint : breakpoint;
1328
- const shouldRemainOpen = snapToBreakpoint !== 0;
1329
- currentBreakpoint = 0;
1330
- /**
1331
- * Update the animation so that it plays from
1332
- * the last offset to the closest snap point.
1333
- */
1334
- if (wrapperAnimation && backdropAnimation) {
1335
- wrapperAnimation.keyframes([
1336
- { offset: 0, transform: `translateY(${breakpointOffset * 100}%)` },
1337
- { offset: 1, transform: `translateY(${(1 - snapToBreakpoint) * 100}%)` },
1338
- ]);
1339
- backdropAnimation.keyframes([
1340
- {
1341
- offset: 0,
1342
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(1 - breakpointOffset, backdropBreakpoint)})`,
1343
- },
1344
- {
1345
- offset: 1,
1346
- opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
1347
- },
1348
- ]);
1349
- if (contentAnimation) {
1350
- /**
1351
- * The modal content should scroll at any breakpoint when expandToScroll
1352
- * is disabled. In order to do this, the content needs to be completely
1353
- * viewable so scrolling can access everything. Otherwise, the default
1354
- * behavior would show the content off the screen and only allow
1355
- * scrolling when the sheet is fully expanded.
1356
- */
1357
- contentAnimation.keyframes([
1358
- { offset: 0, maxHeight: `${(1 - breakpointOffset) * 100}%` },
1359
- { offset: 1, maxHeight: `${snapToBreakpoint * 100}%` },
1360
- ]);
1361
- }
1362
- animation.progressStep(0);
1363
- }
1364
- /**
1365
- * Gesture should remain disabled until the
1366
- * snapping animation completes.
1367
- */
1368
- gesture.enable(false);
1369
- if (shouldPreventDismiss) {
1370
- handleCanDismiss(baseEl, animation);
1371
- }
1372
- else if (!shouldRemainOpen) {
1373
- onDismiss();
1374
- }
1375
- /**
1376
- * Enables scrolling immediately if the sheet is about to fully expand
1377
- * or if it allows scrolling at any breakpoint. Without this, there would
1378
- * be a ~500ms delay while the modal animation completes, causing a
1379
- * noticeable lag. Native iOS allows scrolling as soon as the gesture is
1380
- * released, so we align with that behavior.
1381
- */
1382
- if (contentEl && (snapToBreakpoint === breakpoints[breakpoints.length - 1] || !expandToScroll)) {
1383
- contentEl.scrollY = true;
1384
- }
1385
- /**
1386
- * If expandToScroll is disabled and we're animating
1387
- * to close the sheet, we need to swap
1388
- * the footer position to stationary so that it
1389
- * will collapse correctly. We cannot just always swap
1390
- * here or it'll be jittery while animating movement.
1391
- */
1392
- if (!expandToScroll && snapToBreakpoint === 0) {
1393
- swapFooterPosition('stationary');
1394
- }
1395
- return new Promise((resolve) => {
1396
- animation
1397
- .onFinish(() => {
1398
- if (shouldRemainOpen) {
1399
- /**
1400
- * If expandToScroll is disabled, we need to swap
1401
- * the footer position to stationary so that it
1402
- * will act as it would by default.
1403
- */
1404
- if (!expandToScroll) {
1405
- swapFooterPosition('stationary');
1406
- }
1407
- /**
1408
- * Once the snapping animation completes,
1409
- * we need to reset the animation to go
1410
- * from 0 to 1 so users can swipe in any direction.
1411
- * We then set the animation offset to the current
1412
- * breakpoint so that it starts at the snapped position.
1413
- */
1414
- if (wrapperAnimation && backdropAnimation) {
1415
- raf(() => {
1416
- wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
1417
- backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
1418
- contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
1419
- animation.progressStart(true, 1 - snapToBreakpoint);
1420
- currentBreakpoint = snapToBreakpoint;
1421
- onBreakpointChange(currentBreakpoint);
1422
- /**
1423
- * Backdrop should become enabled
1424
- * after the backdropBreakpoint value
1425
- */
1426
- const shouldEnableBackdrop = currentBreakpoint > backdropBreakpoint &&
1427
- baseEl.focusTrap !== false &&
1428
- baseEl.showBackdrop !== false;
1429
- if (shouldEnableBackdrop) {
1430
- enableBackdrop();
1431
- }
1432
- else {
1433
- disableBackdrop();
1434
- }
1435
- gesture.enable(true);
1436
- resolve();
1437
- });
1438
- }
1439
- else {
1440
- gesture.enable(true);
1441
- resolve();
1442
- }
1443
- }
1444
- else {
1445
- resolve();
1446
- }
1447
- /**
1448
- * This must be a one time callback
1449
- * otherwise a new callback will
1450
- * be added every time onEnd runs.
1451
- */
1452
- }, { oneTimeCallback: true })
1453
- .progressEnd(1, 0, animated ? 500 : 0);
1454
- });
1455
- };
1456
- const gesture = createGesture({
1457
- el: wrapperEl,
1458
- gestureName: 'modalSheet',
1459
- gesturePriority: 40,
1460
- direction: 'y',
1461
- threshold: 10,
1462
- canStart,
1463
- onStart,
1464
- onMove,
1465
- onEnd,
1466
- });
1467
- return {
1468
- gesture,
1469
- moveSheetToBreakpoint,
1470
- };
1471
- };
1472
-
1473
- /**
1474
- * These thresholds match the SCSS media query breakpoints in modal.vars.scss
1475
- * that trigger the centered dialog layout (non-fullscreen modal).
1476
- *
1477
- * SCSS defines two height breakpoints: $modal-inset-min-height-small (600px)
1478
- * and $modal-inset-min-height-large (768px). We use the smaller one because
1479
- * that's the threshold where the modal transitions from fullscreen to centered
1480
- * dialog — the larger breakpoint only increases the dialog's height.
1481
- */
1482
- const MODAL_INSET_MIN_WIDTH = 768;
1483
- const MODAL_INSET_MIN_HEIGHT = 600;
1484
- const EDGE_THRESHOLD = 5;
1485
- /**
1486
- * Cache for resolved root safe-area-top value, invalidated once per frame.
1487
- */
1488
- let cachedRootSafeAreaTop = null;
1489
- let cacheInvalidationScheduled = false;
1490
- /**
1491
- * Determines if the current viewport meets the CSS media query conditions
1492
- * that cause regular modals to render as centered dialogs instead of fullscreen.
1493
- * Matches: @media (min-width: 768px) and (min-height: 600px)
1494
- */
1495
- const isCenteredDialogViewport = () => {
1496
- if (!win)
1497
- return false;
1498
- return win.matchMedia(`(min-width: ${MODAL_INSET_MIN_WIDTH}px) and (min-height: ${MODAL_INSET_MIN_HEIGHT}px)`)
1499
- .matches;
1500
- };
1501
- /**
1502
- * Resolves the current root --ion-safe-area-top value to pixels.
1503
- * Uses a temporary element because getComputedStyle on :root returns
1504
- * the declared value of custom properties (e.g. "env(safe-area-inset-top)")
1505
- * rather than a resolved number.
1506
- *
1507
- * Results are cached for the current frame to avoid repeated reflows.
1508
- */
1509
- const getRootSafeAreaTop = () => {
1510
- if (cachedRootSafeAreaTop !== null) {
1511
- return cachedRootSafeAreaTop;
1512
- }
1513
- const doc = win === null || win === void 0 ? void 0 : win.document;
1514
- if (!(doc === null || doc === void 0 ? void 0 : doc.body)) {
1515
- return 0;
1516
- }
1517
- const el = doc.createElement('div');
1518
- el.style.cssText =
1519
- 'position:fixed;visibility:hidden;pointer-events:none;top:0;left:0;' + 'padding-top:var(--ion-safe-area-top,0px);';
1520
- doc.body.appendChild(el);
1521
- const value = parseFloat(getComputedStyle(el).paddingTop) || 0;
1522
- el.remove();
1523
- cachedRootSafeAreaTop = value;
1524
- if (!cacheInvalidationScheduled) {
1525
- cacheInvalidationScheduled = true;
1526
- raf(() => {
1527
- cachedRootSafeAreaTop = null;
1528
- cacheInvalidationScheduled = false;
1529
- });
1530
- }
1531
- return value;
1532
- };
1533
- /**
1534
- * Returns the initial safe-area configuration based on modal type.
1535
- * This is called before animation starts and uses configuration-based prediction.
1536
- *
1537
- * @param context - Modal context information
1538
- * @returns SafeAreaConfig with initial safe-area values
1539
- */
1540
- const getInitialSafeAreaConfig = (context) => {
1541
- const { isSheetModal, isCardModal } = context;
1542
- // Sheet modals always zero top safe-area. The sheet height offset from the
1543
- // top edge is handled by --ion-modal-offset-top (set in modal.tsx) using
1544
- // the resolved root value, so --ion-safe-area-top is never needed for
1545
- // height calculation. Keeping it at 0px prevents header content from
1546
- // getting double-offset padding.
1547
- if (isSheetModal) {
1548
- return {
1549
- top: '0px',
1550
- bottom: 'inherit',
1551
- left: '0px',
1552
- right: '0px',
1553
- };
1554
- }
1555
- // Card modals need safe-area for height calculation.
1556
- // Note: isCardModal is already gated on mode === 'ios' by the caller.
1557
- if (isCardModal) {
1558
- return {
1559
- top: 'inherit',
1560
- bottom: 'inherit',
1561
- left: '0px',
1562
- right: '0px',
1563
- };
1564
- }
1565
- // On viewports that meet the centered dialog media query breakpoints,
1566
- // regular modals render as centered dialogs (not fullscreen), so they
1567
- // don't touch any screen edges and don't need safe-area insets.
1568
- if (isCenteredDialogViewport()) {
1569
- return {
1570
- top: '0px',
1571
- bottom: '0px',
1572
- left: '0px',
1573
- right: '0px',
1574
- };
1575
- }
1576
- // Fullscreen modals on phone - inherit all safe areas
1577
- return {
1578
- top: 'inherit',
1579
- bottom: 'inherit',
1580
- left: 'inherit',
1581
- right: 'inherit',
1582
- };
1583
- };
1584
- /**
1585
- * Returns safe-area configuration based on actual modal position.
1586
- * Detects which edges the modal overlaps with and only applies safe-area to those edges.
1587
- *
1588
- * Note: On Android edge-to-edge (API 36+), getBoundingClientRect() may report
1589
- * inconsistent values. Sheet and card modals avoid this by using configuration-based
1590
- * prediction instead. Regular modals use coordinate detection which works reliably
1591
- * on web and iOS; Android edge-to-edge may need a configuration-based fallback
1592
- * once a reliable detection mechanism is available.
1593
- *
1594
- * @param wrapperEl - The modal wrapper element to measure
1595
- * @returns SafeAreaConfig based on position
1596
- */
1597
- const getPositionBasedSafeAreaConfig = (wrapperEl) => {
1598
- var _a, _b;
1599
- const rect = wrapperEl.getBoundingClientRect();
1600
- const vh = (_a = win === null || win === void 0 ? void 0 : win.innerHeight) !== null && _a !== void 0 ? _a : 0;
1601
- const vw = (_b = win === null || win === void 0 ? void 0 : win.innerWidth) !== null && _b !== void 0 ? _b : 0;
1602
- // Only apply safe-area to sides where modal overlaps with screen edge
1603
- return {
1604
- top: rect.top <= EDGE_THRESHOLD ? 'inherit' : '0px',
1605
- bottom: rect.bottom >= vh - EDGE_THRESHOLD ? 'inherit' : '0px',
1606
- left: rect.left <= EDGE_THRESHOLD ? 'inherit' : '0px',
1607
- right: rect.right >= vw - EDGE_THRESHOLD ? 'inherit' : '0px',
1608
- };
1609
- };
1610
- /**
1611
- * Applies safe-area CSS custom property overrides to the modal host element.
1612
- *
1613
- * @param hostEl - The modal host element (ion-modal)
1614
- * @param config - Safe-area configuration to apply
1615
- */
1616
- const applySafeAreaOverrides = (hostEl, config) => {
1617
- hostEl.style.setProperty('--ion-safe-area-top', config.top);
1618
- hostEl.style.setProperty('--ion-safe-area-bottom', config.bottom);
1619
- hostEl.style.setProperty('--ion-safe-area-left', config.left);
1620
- hostEl.style.setProperty('--ion-safe-area-right', config.right);
1621
- };
1622
- /**
1623
- * Clears safe-area CSS custom property overrides from the modal host element.
1624
- *
1625
- * @param hostEl - The modal host element (ion-modal)
1626
- */
1627
- const clearSafeAreaOverrides = (hostEl) => {
1628
- hostEl.style.removeProperty('--ion-safe-area-top');
1629
- hostEl.style.removeProperty('--ion-safe-area-bottom');
1630
- hostEl.style.removeProperty('--ion-safe-area-left');
1631
- hostEl.style.removeProperty('--ion-safe-area-right');
1632
- };
1633
-
1634
- 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}}@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-modal-offset-top, 0px) + 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}";
1635
-
1636
- 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}}@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-modal-offset-top, 0px) + 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}";
1637
-
1638
- const Modal = /*@__PURE__*/ proxyCustomElement(class Modal extends H {
1639
- constructor(registerHost) {
1640
- super();
1641
- if (registerHost !== false) {
1642
- this.__registerHost();
1643
- }
1644
- this.__attachShadow();
1645
- this.didPresent = createEvent(this, "ionModalDidPresent", 7);
1646
- this.willPresent = createEvent(this, "ionModalWillPresent", 7);
1647
- this.willDismiss = createEvent(this, "ionModalWillDismiss", 7);
1648
- this.didDismiss = createEvent(this, "ionModalDidDismiss", 7);
1649
- this.ionBreakpointDidChange = createEvent(this, "ionBreakpointDidChange", 7);
1650
- this.didPresentShorthand = createEvent(this, "didPresent", 7);
1651
- this.willPresentShorthand = createEvent(this, "willPresent", 7);
1652
- this.willDismissShorthand = createEvent(this, "willDismiss", 7);
1653
- this.didDismissShorthand = createEvent(this, "didDismiss", 7);
1654
- this.ionMount = createEvent(this, "ionMount", 7);
1655
- this.lockController = createLockController();
1656
- this.triggerController = createTriggerController();
1657
- this.coreDelegate = CoreDelegate();
1658
- this.isSheetModal = false;
1659
- this.inheritedAttributes = {};
1660
- this.inline = false;
1661
- // Whether or not modal is being dismissed via gesture
1662
- this.gestureAnimationDismissing = false;
1663
- this.presented = false;
1664
- /** @internal */
1665
- this.hasController = false;
1666
- /**
1667
- * If `true`, the keyboard will be automatically dismissed when the overlay is presented.
1668
- */
1669
- this.keyboardClose = true;
1670
- /**
1671
- * Controls whether scrolling or dragging within the sheet modal expands
1672
- * it to a larger breakpoint. This only takes effect when `breakpoints`
1673
- * and `initialBreakpoint` are set.
1674
- *
1675
- * If `true`, scrolling or dragging anywhere in the modal will first expand
1676
- * it to the next breakpoint. Once fully expanded, scrolling will affect the
1677
- * content.
1678
- * If `false`, scrolling will always affect the content. The modal will
1679
- * only expand when dragging the header or handle. The modal will close when
1680
- * dragging the header or handle. It can also be closed when dragging the
1681
- * content, but only if the content is scrolled to the top.
1682
- */
1683
- this.expandToScroll = true;
1684
- /**
1685
- * A decimal value between 0 and 1 that indicates the
1686
- * point after which the backdrop will begin to fade in
1687
- * when using a sheet modal. Prior to this point, the
1688
- * backdrop will be hidden and the content underneath
1689
- * the sheet can be interacted with. This value is exclusive
1690
- * meaning the backdrop will become active after the value
1691
- * specified.
1692
- */
1693
- this.backdropBreakpoint = 0;
1694
- /**
1695
- * The interaction behavior for the sheet modal when the handle is pressed.
1696
- *
1697
- * Defaults to `"none"`, which means the modal will not change size or position when the handle is pressed.
1698
- * Set to `"cycle"` to let the modal cycle between available breakpoints when pressed.
1699
- *
1700
- * Handle behavior is unavailable when the `handle` property is set to `false` or
1701
- * when the `breakpoints` property is not set (using a fullscreen or card modal).
1702
- */
1703
- this.handleBehavior = 'none';
1704
- /**
1705
- * If `true`, the modal will be dismissed when the backdrop is clicked.
1706
- */
1707
- this.backdropDismiss = true;
1708
- /**
1709
- * If `true`, a backdrop will be displayed behind the modal.
1710
- * This property controls whether or not the backdrop
1711
- * darkens the screen when the modal is presented.
1712
- * It does not control whether or not the backdrop
1713
- * is active or present in the DOM.
1714
- */
1715
- this.showBackdrop = true;
1716
- /**
1717
- * If `true`, the modal will animate.
1718
- */
1719
- this.animated = true;
1720
- /**
1721
- * If `true`, the modal will open. If `false`, the modal will close.
1722
- * Use this if you need finer grained control over presentation, otherwise
1723
- * just use the modalController or the `trigger` property.
1724
- * Note: `isOpen` will not automatically be set back to `false` when
1725
- * the modal dismisses. You will need to do that in your code.
1726
- */
1727
- this.isOpen = false;
1728
- /**
1729
- * If `true`, the component passed into `ion-modal` will
1730
- * automatically be mounted when the modal is created. The
1731
- * component will remain mounted even when the modal is dismissed.
1732
- * However, the component will be destroyed when the modal is
1733
- * destroyed. This property is not reactive and should only be
1734
- * used when initially creating a modal.
1735
- *
1736
- * Note: This feature only applies to inline modals in JavaScript
1737
- * frameworks such as Angular, React, and Vue.
1738
- */
1739
- this.keepContentsMounted = false;
1740
- /**
1741
- * If `true`, focus will not be allowed to move outside of this overlay.
1742
- * If `false`, focus will be allowed to move outside of the overlay.
1743
- *
1744
- * In most scenarios this property should remain set to `true`. Setting
1745
- * this property to `false` can cause severe accessibility issues as users
1746
- * relying on assistive technologies may be able to move focus into
1747
- * a confusing state. We recommend only setting this to `false` when
1748
- * absolutely necessary.
1749
- *
1750
- * Developers may want to consider disabling focus trapping if this
1751
- * overlay presents a non-Ionic overlay from a 3rd party library.
1752
- * Developers would disable focus trapping on the Ionic overlay
1753
- * when presenting the 3rd party overlay and then re-enable
1754
- * focus trapping when dismissing the 3rd party overlay and moving
1755
- * focus back to the Ionic overlay.
1756
- */
1757
- this.focusTrap = true;
1758
- /**
1759
- * Determines whether or not a modal can dismiss
1760
- * when calling the `dismiss` method.
1761
- *
1762
- * If the value is `true` or the value's function returns `true`, the modal will close when trying to dismiss.
1763
- * If the value is `false` or the value's function returns `false`, the modal will not close when trying to dismiss.
1764
- *
1765
- * See https://ionicframework.com/docs/troubleshooting/runtime#accessing-this
1766
- * if you need to access `this` from within the callback.
1767
- */
1768
- this.canDismiss = true;
1769
- this.onHandleClick = () => {
1770
- const { sheetTransition, handleBehavior } = this;
1771
- if (handleBehavior !== 'cycle' || sheetTransition !== undefined) {
1772
- /**
1773
- * The sheet modal should not advance to the next breakpoint
1774
- * if the handle behavior is not `cycle` or if the handle
1775
- * is clicked while the sheet is moving to a breakpoint.
1776
- */
1777
- return;
1778
- }
1779
- this.moveToNextBreakpoint();
1780
- };
1781
- this.onBackdropTap = () => {
1782
- const { sheetTransition } = this;
1783
- if (sheetTransition !== undefined) {
1784
- /**
1785
- * When the handle is double clicked at the largest breakpoint,
1786
- * it will start to move to the first breakpoint. While transitioning,
1787
- * the backdrop will often receive the second click. We prevent the
1788
- * backdrop from dismissing the modal while moving between breakpoints.
1789
- */
1790
- return;
1791
- }
1792
- this.dismiss(undefined, BACKDROP);
1793
- };
1794
- this.onLifecycle = (modalEvent) => {
1795
- const el = this.usersElement;
1796
- const name = LIFECYCLE_MAP[modalEvent.type];
1797
- if (el && name) {
1798
- const ev = new CustomEvent(name, {
1799
- bubbles: false,
1800
- cancelable: false,
1801
- detail: modalEvent.detail,
1802
- });
1803
- el.dispatchEvent(ev);
1804
- }
1805
- };
1806
- /**
1807
- * When the modal receives focus directly, pass focus to the handle
1808
- * if it exists and is focusable, otherwise let the focus trap handle it.
1809
- */
1810
- this.onModalFocus = (ev) => {
1811
- const { dragHandleEl, el } = this;
1812
- // Only handle focus if the modal itself was focused (not a child element)
1813
- if (ev.target === el && dragHandleEl && dragHandleEl.tabIndex !== -1) {
1814
- dragHandleEl.focus();
1815
- }
1816
- };
1817
- /**
1818
- * When the slot changes, we need to find all the modals in the slot
1819
- * and set the data-parent-ion-modal attribute on them so we can find them
1820
- * and dismiss them when we get dismissed.
1821
- * We need to do it this way because when a modal is opened, it's moved to
1822
- * the end of the body and is no longer an actual child of the modal.
1823
- */
1824
- this.onSlotChange = ({ target }) => {
1825
- const slot = target;
1826
- slot.assignedElements().forEach((el) => {
1827
- el.querySelectorAll('ion-modal').forEach((childModal) => {
1828
- // We don't need to write to the DOM if the modal is already tagged
1829
- // If this is a deeply nested modal, this effect should cascade so we don't
1830
- // need to worry about another modal claiming the same child.
1831
- if (childModal.getAttribute('data-parent-ion-modal') === null) {
1832
- childModal.setAttribute('data-parent-ion-modal', this.el.id);
1833
- }
1834
- });
1835
- });
1836
- };
1837
- }
1838
- onIsOpenChange(newValue, oldValue) {
1839
- if (newValue === true && oldValue === false) {
1840
- this.present();
1841
- }
1842
- else if (newValue === false && oldValue === true) {
1843
- this.dismiss();
1844
- }
1845
- }
1846
- triggerChanged() {
1847
- const { trigger, el, triggerController } = this;
1848
- if (trigger) {
1849
- triggerController.addClickListener(el, trigger);
1850
- }
1851
- }
1852
- onWindowResize() {
1853
- if (!this.presented)
1854
- return;
1855
- clearTimeout(this.resizeTimeout);
1856
- this.resizeTimeout = setTimeout(() => {
1857
- const context = this.getSafeAreaContext();
1858
- // iOS card modals: handle portrait/landscape view transitions
1859
- if (context.isCardModal && !this.enterAnimation && !this.leaveAnimation) {
1860
- this.handleViewTransition();
1861
- }
1862
- // Sheet modals: re-compute the internal offset property since safe-area
1863
- // values may change on device rotation (e.g., portrait notch vs landscape).
1864
- if (context.isSheetModal) {
1865
- this.updateSheetOffsetTop();
1866
- }
1867
- // Regular (non-sheet, non-card) modals: update safe-area overrides
1868
- // since the viewport may have crossed the centered-dialog breakpoint.
1869
- if (!context.isSheetModal && !context.isCardModal) {
1870
- this.updateSafeAreaOverrides();
1871
- // Re-evaluate fullscreen safe-area padding: clear first, then re-apply
1872
- if (this.wrapperEl) {
1873
- this.wrapperEl.style.removeProperty('height');
1874
- this.wrapperEl.style.removeProperty('padding-bottom');
1875
- }
1876
- this.applyFullscreenSafeArea();
1877
- }
1878
- }, 50); // Debounce to avoid excessive calls during active resizing
1879
- }
1880
- breakpointsChanged(breakpoints) {
1881
- if (breakpoints !== undefined) {
1882
- this.sortedBreakpoints = breakpoints.sort((a, b) => a - b);
1883
- }
1884
- }
1885
- connectedCallback() {
1886
- const { el } = this;
1887
- prepareOverlay(el);
1888
- this.triggerChanged();
1889
- }
1890
- disconnectedCallback() {
1891
- this.triggerController.removeClickListener();
1892
- this.cleanupViewTransitionListener();
1893
- this.cleanupParentRemovalObserver();
1894
- // Also called in dismiss() — intentional dual cleanup covers both
1895
- // dismiss-then-remove and direct DOM removal without dismiss.
1896
- this.cleanupSafeAreaOverrides();
1897
- }
1898
- componentWillLoad() {
1899
- var _a;
1900
- const { breakpoints, initialBreakpoint, el, htmlAttributes } = this;
1901
- const isSheetModal = (this.isSheetModal = breakpoints !== undefined && initialBreakpoint !== undefined);
1902
- const attributesToInherit = ['aria-label', 'role'];
1903
- this.inheritedAttributes = inheritAttributes(el, attributesToInherit);
1904
- // Cache original parent before modal gets moved to body during presentation
1905
- if (el.parentNode) {
1906
- this.cachedOriginalParent = el.parentNode;
1907
- }
1908
- /**
1909
- * When using a controller modal you can set attributes
1910
- * using the htmlAttributes property. Since the above attributes
1911
- * need to be inherited inside of the modal, we need to look
1912
- * and see if these attributes are being set via htmlAttributes.
1913
- *
1914
- * We could alternatively move this to componentDidLoad to simplify the work
1915
- * here, but we'd then need to make inheritedAttributes a State variable,
1916
- * thus causing another render to always happen after the first render.
1917
- */
1918
- if (htmlAttributes !== undefined) {
1919
- attributesToInherit.forEach((attribute) => {
1920
- const attributeValue = htmlAttributes[attribute];
1921
- if (attributeValue) {
1922
- /**
1923
- * If an attribute we need to inherit was
1924
- * set using htmlAttributes then add it to
1925
- * inheritedAttributes and remove it from htmlAttributes.
1926
- * This ensures the attribute is inherited and not
1927
- * set on the host.
1928
- *
1929
- * In this case, if an inherited attribute is set
1930
- * on the host element and using htmlAttributes then
1931
- * htmlAttributes wins, but that's not a pattern that we recommend.
1932
- * The only time you'd need htmlAttributes is when using modalController.
1933
- */
1934
- this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attribute]: htmlAttributes[attribute] });
1935
- delete htmlAttributes[attribute];
1936
- }
1937
- });
1938
- }
1939
- if (isSheetModal) {
1940
- this.currentBreakpoint = this.initialBreakpoint;
1941
- }
1942
- if (breakpoints !== undefined && initialBreakpoint !== undefined && !breakpoints.includes(initialBreakpoint)) {
1943
- printIonWarning('[ion-modal] - Your breakpoints array must include the initialBreakpoint value.');
1944
- }
1945
- if (!((_a = this.htmlAttributes) === null || _a === void 0 ? void 0 : _a.id)) {
1946
- setOverlayId(this.el);
1947
- }
1948
- }
1949
- componentDidLoad() {
1950
- /**
1951
- * If modal was rendered with isOpen="true"
1952
- * then we should open modal immediately.
1953
- */
1954
- if (this.isOpen === true) {
1955
- raf(() => this.present());
1956
- }
1957
- this.breakpointsChanged(this.breakpoints);
1958
- /**
1959
- * When binding values in frameworks such as Angular
1960
- * it is possible for the value to be set after the Web Component
1961
- * initializes but before the value watcher is set up in Stencil.
1962
- * As a result, the watcher callback may not be fired.
1963
- * We work around this by manually calling the watcher
1964
- * callback when the component has loaded and the watcher
1965
- * is configured.
1966
- */
1967
- this.triggerChanged();
1968
- }
1969
- /**
1970
- * Determines whether or not an overlay
1971
- * is being used inline or via a controller/JS
1972
- * and returns the correct delegate.
1973
- * By default, subsequent calls to getDelegate
1974
- * will use a cached version of the delegate.
1975
- * This is useful for calling dismiss after
1976
- * present so that the correct delegate is given.
1977
- */
1978
- getDelegate(force = false) {
1979
- if (this.workingDelegate && !force) {
1980
- return {
1981
- delegate: this.workingDelegate,
1982
- inline: this.inline,
1983
- };
1984
- }
1985
- /**
1986
- * If using overlay inline
1987
- * we potentially need to use the coreDelegate
1988
- * so that this works in vanilla JS apps.
1989
- * If a developer has presented this component
1990
- * via a controller, then we can assume
1991
- * the component is already in the
1992
- * correct place.
1993
- */
1994
- const parentEl = this.el.parentNode;
1995
- const inline = (this.inline = parentEl !== null && !this.hasController);
1996
- const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
1997
- return { inline, delegate };
1998
- }
1999
- /**
2000
- * Determines whether or not the
2001
- * modal is allowed to dismiss based
2002
- * on the state of the canDismiss prop.
2003
- */
2004
- async checkCanDismiss(data, role) {
2005
- const { canDismiss } = this;
2006
- if (typeof canDismiss === 'function') {
2007
- return canDismiss(data, role);
2008
- }
2009
- return canDismiss;
2010
- }
2011
- /**
2012
- * Present the modal overlay after it has been created.
2013
- */
2014
- async present() {
2015
- const unlock = await this.lockController.lock();
2016
- if (this.presented) {
2017
- unlock();
2018
- return;
2019
- }
2020
- const { presentingElement, el } = this;
2021
- /**
2022
- * If the modal is presented multiple times (inline modals), we
2023
- * need to reset the current breakpoint to the initial breakpoint.
2024
- */
2025
- this.currentBreakpoint = this.initialBreakpoint;
2026
- const { inline, delegate } = this.getDelegate(true);
2027
- /**
2028
- * Emit ionMount so JS Frameworks have an opportunity
2029
- * to add the child component to the DOM. The child
2030
- * component will be assigned to this.usersElement below.
2031
- */
2032
- this.ionMount.emit();
2033
- this.usersElement = await attachComponent(delegate, el, this.component, ['ion-page'], this.componentProps, inline);
2034
- /**
2035
- * When using the lazy loaded build of Stencil, we need to wait
2036
- * for every Stencil component instance to be ready before presenting
2037
- * otherwise there can be a flash of unstyled content. With the
2038
- * custom elements bundle we need to wait for the JS framework
2039
- * mount the inner contents of the overlay otherwise WebKit may
2040
- * get the transition incorrect.
2041
- */
2042
- if (hasLazyBuild(el)) {
2043
- await deepReady(this.usersElement);
2044
- /**
2045
- * If keepContentsMounted="true" then the
2046
- * JS Framework has already mounted the inner
2047
- * contents so there is no need to wait.
2048
- * Otherwise, we need to wait for the JS
2049
- * Framework to mount the inner contents
2050
- * of this component.
2051
- */
2052
- }
2053
- else if (!this.keepContentsMounted) {
2054
- await waitForMount();
2055
- }
2056
- writeTask(() => this.el.classList.add('show-modal'));
2057
- // Recalculate isSheetModal before safe-area setup because framework
2058
- // bindings (e.g., Angular) may not have been applied when componentWillLoad ran.
2059
- this.isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
2060
- // Set initial safe-area overrides before animation
2061
- this.setInitialSafeAreaOverrides();
2062
- const hasCardModal = presentingElement !== undefined;
2063
- /**
2064
- * We need to change the status bar at the
2065
- * start of the animation so that it completes
2066
- * by the time the card animation is done.
2067
- */
2068
- if (hasCardModal && getIonMode(this) === 'ios') {
2069
- // Cache the original status bar color before the modal is presented
2070
- this.statusBarStyle = await StatusBar.getStyle();
2071
- setCardStatusBarDark();
2072
- }
2073
- await present(this, 'modalEnter', iosEnterAnimation, mdEnterAnimation, {
2074
- presentingEl: presentingElement,
2075
- currentBreakpoint: this.initialBreakpoint,
2076
- backdropBreakpoint: this.backdropBreakpoint,
2077
- expandToScroll: this.expandToScroll,
2078
- });
2079
- // Update safe-area based on actual position after animation
2080
- this.updateSafeAreaOverrides();
2081
- // Apply fullscreen safe-area padding if needed
2082
- this.applyFullscreenSafeArea();
2083
- /* tslint:disable-next-line */
2084
- if (typeof window !== 'undefined') {
2085
- /**
2086
- * This needs to be setup before any
2087
- * non-transition async work so it can be dereferenced
2088
- * in the dismiss method. The dismiss method
2089
- * only waits for the entering transition
2090
- * to finish. It does not wait for all of the `present`
2091
- * method to resolve.
2092
- */
2093
- this.keyboardOpenCallback = () => {
2094
- if (this.gesture) {
2095
- /**
2096
- * When the native keyboard is opened and the webview
2097
- * is resized, the gesture implementation will become unresponsive
2098
- * and enter a free-scroll mode.
2099
- *
2100
- * When the keyboard is opened, we disable the gesture for
2101
- * a single frame and re-enable once the contents have repositioned
2102
- * from the keyboard placement.
2103
- */
2104
- this.gesture.enable(false);
2105
- raf(() => {
2106
- if (this.gesture) {
2107
- this.gesture.enable(true);
2108
- }
2109
- });
2110
- }
2111
- };
2112
- window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
2113
- }
2114
- if (this.isSheetModal) {
2115
- this.initSheetGesture();
2116
- }
2117
- else if (hasCardModal) {
2118
- this.initSwipeToClose();
2119
- }
2120
- // Initialize view transition listener for iOS card modals
2121
- this.initViewTransitionListener();
2122
- // Initialize parent removal observer
2123
- this.initParentRemovalObserver();
2124
- unlock();
2125
- }
2126
- initSwipeToClose() {
2127
- var _a;
2128
- if (getIonMode(this) !== 'ios') {
2129
- return;
2130
- }
2131
- const { el } = this;
2132
- // All of the elements needed for the swipe gesture
2133
- // should be in the DOM and referenced by now, except
2134
- // for the presenting el
2135
- const animationBuilder = this.leaveAnimation || config.get('modalLeave', iosLeaveAnimation);
2136
- const ani = (this.animation = animationBuilder(el, {
2137
- presentingEl: this.presentingElement,
2138
- expandToScroll: this.expandToScroll,
2139
- }));
2140
- const contentEl = findIonContent(el);
2141
- if (!contentEl) {
2142
- printIonContentErrorMsg(el);
2143
- return;
2144
- }
2145
- const statusBarStyle = (_a = this.statusBarStyle) !== null && _a !== void 0 ? _a : Style.Default;
2146
- this.gesture = createSwipeToCloseGesture(el, ani, statusBarStyle, () => {
2147
- /**
2148
- * While the gesture animation is finishing
2149
- * it is possible for a user to tap the backdrop.
2150
- * This would result in the dismiss animation
2151
- * being played again. Typically this is avoided
2152
- * by setting `presented = false` on the overlay
2153
- * component; however, we cannot do that here as
2154
- * that would prevent the element from being
2155
- * removed from the DOM.
2156
- */
2157
- this.gestureAnimationDismissing = true;
2158
- /**
2159
- * Reset the status bar style as the dismiss animation
2160
- * starts otherwise the status bar will be the wrong
2161
- * color for the duration of the dismiss animation.
2162
- * The dismiss method does this as well, but
2163
- * in this case it's only called once the animation
2164
- * has finished.
2165
- */
2166
- setCardStatusBarDefault(this.statusBarStyle);
2167
- this.animation.onFinish(async () => {
2168
- await this.dismiss(undefined, GESTURE);
2169
- this.gestureAnimationDismissing = false;
2170
- });
2171
- });
2172
- this.gesture.enable(true);
2173
- }
2174
- initSheetGesture() {
2175
- const { wrapperEl, initialBreakpoint, backdropBreakpoint } = this;
2176
- if (!wrapperEl || initialBreakpoint === undefined) {
2177
- return;
2178
- }
2179
- const animationBuilder = this.enterAnimation || config.get('modalEnter', iosEnterAnimation);
2180
- const ani = (this.animation = animationBuilder(this.el, {
2181
- presentingEl: this.presentingElement,
2182
- currentBreakpoint: initialBreakpoint,
2183
- backdropBreakpoint,
2184
- expandToScroll: this.expandToScroll,
2185
- }));
2186
- ani.progressStart(true, 1);
2187
- 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) => {
2188
- if (this.currentBreakpoint !== breakpoint) {
2189
- this.currentBreakpoint = breakpoint;
2190
- this.ionBreakpointDidChange.emit({ breakpoint });
2191
- }
2192
- });
2193
- this.gesture = gesture;
2194
- this.moveSheetToBreakpoint = moveSheetToBreakpoint;
2195
- this.gesture.enable(true);
2196
- /**
2197
- * When backdrop interaction is allowed, nested router outlets from child routes
2198
- * may block pointer events to parent content. Apply passthrough styles only when
2199
- * the modal was the sole content of a child route page.
2200
- * See https://github.com/ionic-team/ionic-framework/issues/30700
2201
- */
2202
- const backdropNotBlocking = this.showBackdrop === false || this.focusTrap === false || backdropBreakpoint > 0;
2203
- if (backdropNotBlocking) {
2204
- this.setupChildRoutePassthrough();
2205
- }
2206
- }
2207
- /**
2208
- * For sheet modals that allow background interaction, sets up pointer-events
2209
- * passthrough on child route page wrappers and nested router outlets.
2210
- */
2211
- setupChildRoutePassthrough() {
2212
- var _a;
2213
- // Cache the page parent for cleanup
2214
- this.cachedPageParent = this.getOriginalPageParent();
2215
- const pageParent = this.cachedPageParent;
2216
- // Skip ion-app (controller modals) and pages with visible sibling content next to the modal
2217
- if (!pageParent || pageParent.tagName === 'ION-APP') {
2218
- return;
2219
- }
2220
- const hasVisibleContent = Array.from(pageParent.children).some((child) => {
2221
- var _a;
2222
- return child !== this.el &&
2223
- !(child instanceof H && window.getComputedStyle(child).display === 'none') &&
2224
- child.tagName !== 'TEMPLATE' &&
2225
- child.tagName !== 'SLOT' &&
2226
- !(child.nodeType === Node.TEXT_NODE && !((_a = child.textContent) === null || _a === void 0 ? void 0 : _a.trim()));
2227
- });
2228
- if (hasVisibleContent) {
2229
- return;
2230
- }
2231
- // Child route case: page only contained the modal
2232
- pageParent.classList.add('ion-page-overlay-passthrough');
2233
- // Also make nested router outlets passthrough
2234
- const routerOutlet = pageParent.parentElement;
2235
- 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') {
2236
- routerOutlet.style.setProperty('pointer-events', 'none');
2237
- routerOutlet.setAttribute('data-overlay-passthrough', 'true');
2238
- }
2239
- }
2240
- /**
2241
- * Finds the ion-page ancestor of the modal's original parent location.
2242
- */
2243
- getOriginalPageParent() {
2244
- if (!this.cachedOriginalParent) {
2245
- return null;
2246
- }
2247
- let pageParent = this.cachedOriginalParent;
2248
- while (pageParent && !pageParent.classList.contains('ion-page')) {
2249
- pageParent = pageParent.parentElement;
2250
- }
2251
- return pageParent;
2252
- }
2253
- /**
2254
- * Removes passthrough styles added by setupChildRoutePassthrough.
2255
- */
2256
- cleanupChildRoutePassthrough() {
2257
- const pageParent = this.cachedPageParent;
2258
- if (!pageParent) {
2259
- return;
2260
- }
2261
- pageParent.classList.remove('ion-page-overlay-passthrough');
2262
- const routerOutlet = pageParent.parentElement;
2263
- if (routerOutlet === null || routerOutlet === void 0 ? void 0 : routerOutlet.hasAttribute('data-overlay-passthrough')) {
2264
- routerOutlet.style.removeProperty('pointer-events');
2265
- routerOutlet.removeAttribute('data-overlay-passthrough');
2266
- }
2267
- // Clear the cached reference
2268
- this.cachedPageParent = undefined;
2269
- }
2270
- sheetOnDismiss() {
2271
- /**
2272
- * While the gesture animation is finishing
2273
- * it is possible for a user to tap the backdrop.
2274
- * This would result in the dismiss animation
2275
- * being played again. Typically this is avoided
2276
- * by setting `presented = false` on the overlay
2277
- * component; however, we cannot do that here as
2278
- * that would prevent the element from being
2279
- * removed from the DOM.
2280
- */
2281
- this.gestureAnimationDismissing = true;
2282
- this.animation.onFinish(async () => {
2283
- this.currentBreakpoint = 0;
2284
- this.ionBreakpointDidChange.emit({ breakpoint: this.currentBreakpoint });
2285
- await this.dismiss(undefined, GESTURE);
2286
- this.gestureAnimationDismissing = false;
2287
- });
2288
- }
2289
- /**
2290
- * Dismiss the modal overlay after it has been presented.
2291
- * This is a no-op if the overlay has not been presented yet. If you want
2292
- * to remove an overlay from the DOM that was never presented, use the
2293
- * [remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) method.
2294
- *
2295
- * @param data Any data to emit in the dismiss events.
2296
- * @param role The role of the element that is dismissing the modal.
2297
- * For example, `cancel` or `backdrop`.
2298
- */
2299
- async dismiss(data, role) {
2300
- var _a;
2301
- if (this.gestureAnimationDismissing && role !== GESTURE) {
2302
- return false;
2303
- }
2304
- // Cancel any pending resize timeout to prevent stale updates during dismiss
2305
- clearTimeout(this.resizeTimeout);
2306
- this.resizeTimeout = undefined;
2307
- /**
2308
- * Because the canDismiss check below is async,
2309
- * we need to claim a lock before the check happens,
2310
- * in case the dismiss transition does run.
2311
- */
2312
- const unlock = await this.lockController.lock();
2313
- /**
2314
- * Dismiss all child modals. This is especially important in
2315
- * Angular and React because it's possible to lose control of a child
2316
- * modal when the parent modal is dismissed.
2317
- */
2318
- await this.dismissNestedModals();
2319
- /**
2320
- * If a canDismiss handler is responsible
2321
- * for calling the dismiss method, we should
2322
- * not run the canDismiss check again.
2323
- */
2324
- if (role !== 'handler' && !(await this.checkCanDismiss(data, role))) {
2325
- unlock();
2326
- return false;
2327
- }
2328
- const { presentingElement } = this;
2329
- /**
2330
- * We need to start the status bar change
2331
- * before the animation so that the change
2332
- * finishes when the dismiss animation does.
2333
- */
2334
- const hasCardModal = presentingElement !== undefined;
2335
- if (hasCardModal && getIonMode(this) === 'ios') {
2336
- setCardStatusBarDefault(this.statusBarStyle);
2337
- }
2338
- /* tslint:disable-next-line */
2339
- if (typeof window !== 'undefined' && this.keyboardOpenCallback) {
2340
- window.removeEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
2341
- this.keyboardOpenCallback = undefined;
2342
- }
2343
- const dismissed = await dismiss(this, data, role, 'modalLeave', iosLeaveAnimation, mdLeaveAnimation, {
2344
- presentingEl: presentingElement,
2345
- currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
2346
- backdropBreakpoint: this.backdropBreakpoint,
2347
- expandToScroll: this.expandToScroll,
2348
- });
2349
- if (dismissed) {
2350
- const { delegate } = this.getDelegate();
2351
- await detachComponent(delegate, this.usersElement);
2352
- writeTask(() => this.el.classList.remove('show-modal'));
2353
- if (this.animation) {
2354
- this.animation.destroy();
2355
- }
2356
- if (this.gesture) {
2357
- this.gesture.destroy();
2358
- }
2359
- this.cleanupViewTransitionListener();
2360
- this.cleanupParentRemovalObserver();
2361
- this.cleanupSafeAreaOverrides();
2362
- this.cleanupChildRoutePassthrough();
2363
- }
2364
- this.currentBreakpoint = undefined;
2365
- this.animation = undefined;
2366
- unlock();
2367
- return dismissed;
2368
- }
2369
- /**
2370
- * Returns a promise that resolves when the modal did dismiss.
2371
- */
2372
- onDidDismiss() {
2373
- return eventMethod(this.el, 'ionModalDidDismiss');
2374
- }
2375
- /**
2376
- * Returns a promise that resolves when the modal will dismiss.
2377
- */
2378
- onWillDismiss() {
2379
- return eventMethod(this.el, 'ionModalWillDismiss');
2380
- }
2381
- /**
2382
- * Move a sheet style modal to a specific breakpoint.
2383
- *
2384
- * @param breakpoint The breakpoint value to move the sheet modal to.
2385
- * Must be a value defined in your `breakpoints` array.
2386
- */
2387
- async setCurrentBreakpoint(breakpoint) {
2388
- if (!this.isSheetModal) {
2389
- printIonWarning('[ion-modal] - setCurrentBreakpoint is only supported on sheet modals.');
2390
- return;
2391
- }
2392
- if (!this.breakpoints.includes(breakpoint)) {
2393
- printIonWarning(`[ion-modal] - Attempted to set invalid breakpoint value ${breakpoint}. Please double check that the breakpoint value is part of your defined breakpoints.`);
2394
- return;
2395
- }
2396
- const { currentBreakpoint, moveSheetToBreakpoint, canDismiss, breakpoints, animated } = this;
2397
- if (currentBreakpoint === breakpoint) {
2398
- return;
2399
- }
2400
- if (moveSheetToBreakpoint) {
2401
- this.sheetTransition = moveSheetToBreakpoint({
2402
- breakpoint,
2403
- breakpointOffset: 1 - currentBreakpoint,
2404
- canDismiss: canDismiss !== undefined && canDismiss !== true && breakpoints[0] === 0,
2405
- animated,
2406
- });
2407
- await this.sheetTransition;
2408
- this.sheetTransition = undefined;
2409
- }
2410
- }
2411
- /**
2412
- * Returns the current breakpoint of a sheet style modal
2413
- */
2414
- async getCurrentBreakpoint() {
2415
- return this.currentBreakpoint;
2416
- }
2417
- async moveToNextBreakpoint() {
2418
- const { breakpoints, currentBreakpoint } = this;
2419
- if (!breakpoints || currentBreakpoint == null) {
2420
- /**
2421
- * If the modal does not have breakpoints and/or the current
2422
- * breakpoint is not set, we can't move to the next breakpoint.
2423
- */
2424
- return false;
2425
- }
2426
- const allowedBreakpoints = breakpoints.filter((b) => b !== 0);
2427
- const currentBreakpointIndex = allowedBreakpoints.indexOf(currentBreakpoint);
2428
- const nextBreakpointIndex = (currentBreakpointIndex + 1) % allowedBreakpoints.length;
2429
- const nextBreakpoint = allowedBreakpoints[nextBreakpointIndex];
2430
- /**
2431
- * Sets the current breakpoint to the next available breakpoint.
2432
- * If the current breakpoint is the last breakpoint, we set the current
2433
- * breakpoint to the first non-zero breakpoint to avoid dismissing the sheet.
2434
- */
2435
- await this.setCurrentBreakpoint(nextBreakpoint);
2436
- return true;
2437
- }
2438
- initViewTransitionListener() {
2439
- // Only enable for iOS card modals when no custom animations are provided
2440
- if (getIonMode(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
2441
- return;
2442
- }
2443
- // Set initial view state
2444
- this.currentViewIsPortrait = window.innerWidth < 768;
2445
- }
2446
- handleViewTransition() {
2447
- // Only run view transitions when the modal is presented
2448
- if (!this.presented) {
2449
- return;
2450
- }
2451
- const isPortrait = window.innerWidth < 768;
2452
- // Only transition if view state actually changed
2453
- if (this.currentViewIsPortrait === isPortrait) {
2454
- return;
2455
- }
2456
- // Cancel any ongoing transition animation
2457
- if (this.viewTransitionAnimation) {
2458
- this.viewTransitionAnimation.destroy();
2459
- this.viewTransitionAnimation = undefined;
2460
- }
2461
- const { presentingElement } = this;
2462
- if (!presentingElement) {
2463
- return;
2464
- }
2465
- // Create transition animation
2466
- let transitionAnimation;
2467
- if (this.currentViewIsPortrait && !isPortrait) {
2468
- // Portrait to landscape transition
2469
- transitionAnimation = portraitToLandscapeTransition(this.el, {
2470
- presentingEl: presentingElement});
2471
- }
2472
- else {
2473
- // Landscape to portrait transition
2474
- transitionAnimation = landscapeToPortraitTransition(this.el, {
2475
- presentingEl: presentingElement});
2476
- }
2477
- // Update state and play animation
2478
- this.currentViewIsPortrait = isPortrait;
2479
- this.viewTransitionAnimation = transitionAnimation;
2480
- transitionAnimation.play().then(() => {
2481
- this.viewTransitionAnimation = undefined;
2482
- // Wait for a layout pass after the transition so getBoundingClientRect()
2483
- // in getPositionBasedSafeAreaConfig() reflects the new dimensions.
2484
- raf(() => this.updateSafeAreaOverrides());
2485
- // After orientation transition, recreate the swipe-to-close gesture
2486
- // with updated animation that reflects the new presenting element state
2487
- this.reinitSwipeToClose();
2488
- });
2489
- }
2490
- cleanupViewTransitionListener() {
2491
- // Clear any pending resize timeout
2492
- if (this.resizeTimeout) {
2493
- clearTimeout(this.resizeTimeout);
2494
- this.resizeTimeout = undefined;
2495
- }
2496
- if (this.viewTransitionAnimation) {
2497
- this.viewTransitionAnimation.destroy();
2498
- this.viewTransitionAnimation = undefined;
2499
- }
2500
- }
2501
- reinitSwipeToClose() {
2502
- // Only reinitialize if we have a presenting element and are on iOS
2503
- if (getIonMode(this) !== 'ios' || !this.presentingElement) {
2504
- return;
2505
- }
2506
- // Clean up existing gesture and animation
2507
- if (this.gesture) {
2508
- this.gesture.destroy();
2509
- this.gesture = undefined;
2510
- }
2511
- if (this.animation) {
2512
- // Properly end the progress-based animation at initial state before destroying
2513
- // to avoid leaving modal in intermediate swipe position
2514
- this.animation.progressEnd(0, 0, 0);
2515
- this.animation.destroy();
2516
- this.animation = undefined;
2517
- }
2518
- // Force the modal back to the correct position or it could end up
2519
- // in a weird state after destroying the animation
2520
- raf(() => {
2521
- this.ensureCorrectModalPosition();
2522
- this.initSwipeToClose();
2523
- });
2524
- }
2525
- ensureCorrectModalPosition() {
2526
- const { el, presentingElement } = this;
2527
- const root = getElementRoot(el);
2528
- const wrapperEl = root.querySelector('.modal-wrapper');
2529
- if (wrapperEl) {
2530
- wrapperEl.style.transform = 'translateY(0vh)';
2531
- wrapperEl.style.opacity = '1';
2532
- }
2533
- if ((presentingElement === null || presentingElement === void 0 ? void 0 : presentingElement.tagName) === 'ION-MODAL') {
2534
- const isPortrait = window.innerWidth < 768;
2535
- if (isPortrait) {
2536
- const transformOffset = !CSS.supports('width', 'max(0px, 1px)')
2537
- ? '30px'
2538
- : 'max(30px, var(--ion-safe-area-top))';
2539
- const scale = SwipeToCloseDefaults.MIN_PRESENTING_SCALE;
2540
- presentingElement.style.transform = `translateY(${transformOffset}) scale(${scale})`;
2541
- }
2542
- else {
2543
- presentingElement.style.transform = 'translateY(0px) scale(1)';
2544
- }
2545
- }
2546
- }
2547
- async dismissNestedModals() {
2548
- const nestedModals = document.querySelectorAll(`ion-modal[data-parent-ion-modal="${this.el.id}"]`);
2549
- nestedModals === null || nestedModals === void 0 ? void 0 : nestedModals.forEach(async (modal) => {
2550
- await modal.dismiss(undefined, 'parent-dismissed');
2551
- });
2552
- }
2553
- initParentRemovalObserver() {
2554
- if (typeof MutationObserver === 'undefined') {
2555
- return;
2556
- }
2557
- // Only observe if we have a cached parent and are in browser environment
2558
- if (typeof window === 'undefined' || !this.cachedOriginalParent) {
2559
- return;
2560
- }
2561
- // Don't observe document or fragment nodes as they can't be "removed"
2562
- if (this.cachedOriginalParent.nodeType === Node.DOCUMENT_NODE ||
2563
- this.cachedOriginalParent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
2564
- return;
2565
- }
2566
- /**
2567
- * Don't observe for controller-based modals or when the parent is the
2568
- * app root (document.body or ion-app). These parents won't be removed,
2569
- * and observing document.body with subtree: true causes performance
2570
- * issues with frameworks like Angular during change detection.
2571
- */
2572
- if (this.hasController ||
2573
- this.cachedOriginalParent === document.body ||
2574
- this.cachedOriginalParent.tagName === 'ION-APP') {
2575
- return;
2576
- }
2577
- this.parentRemovalObserver = new MutationObserver((mutations) => {
2578
- mutations.forEach((mutation) => {
2579
- if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
2580
- // Check if our cached original parent was removed
2581
- const cachedParentWasRemoved = Array.from(mutation.removedNodes).some((node) => {
2582
- var _a, _b;
2583
- const isDirectMatch = node === this.cachedOriginalParent;
2584
- const isContainedMatch = this.cachedOriginalParent
2585
- ? (_b = (_a = node).contains) === null || _b === void 0 ? void 0 : _b.call(_a, this.cachedOriginalParent)
2586
- : false;
2587
- return isDirectMatch || isContainedMatch;
2588
- });
2589
- // Also check if parent is no longer connected to DOM
2590
- const cachedParentDisconnected = this.cachedOriginalParent && !this.cachedOriginalParent.isConnected;
2591
- if (cachedParentWasRemoved || cachedParentDisconnected) {
2592
- this.dismiss(undefined, 'parent-removed');
2593
- // Release the reference to the cached original parent
2594
- // so we don't have a memory leak
2595
- this.cachedOriginalParent = undefined;
2596
- }
2597
- }
2598
- });
2599
- });
2600
- // Observe document body with subtree to catch removals at any level
2601
- this.parentRemovalObserver.observe(document.body, {
2602
- childList: true,
2603
- subtree: true,
2604
- });
2605
- }
2606
- cleanupParentRemovalObserver() {
2607
- var _a;
2608
- (_a = this.parentRemovalObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
2609
- this.parentRemovalObserver = undefined;
2610
- }
2611
- /**
2612
- * Creates the context object for safe-area utilities.
2613
- */
2614
- getSafeAreaContext() {
2615
- return {
2616
- isSheetModal: this.isSheetModal,
2617
- isCardModal: this.presentingElement !== undefined && getIonMode(this) === 'ios',
2618
- presentingElement: this.presentingElement,
2619
- breakpoints: this.breakpoints,
2620
- currentBreakpoint: this.currentBreakpoint,
2621
- };
2622
- }
2623
- /**
2624
- * Sets initial safe-area overrides before modal animation.
2625
- * Called in present() before animation starts.
2626
- *
2627
- * For sheet modals, the SCSS --height formula uses --ion-modal-offset-top
2628
- * (an internal property) instead of --ion-safe-area-top. We resolve the
2629
- * root safe-area-top to pixels and set --ion-modal-offset-top, decoupling
2630
- * the height calculation from --ion-safe-area-top (which is zeroed for
2631
- * sheets to prevent header content from getting double-offset padding).
2632
- */
2633
- setInitialSafeAreaOverrides() {
2634
- const context = this.getSafeAreaContext();
2635
- const safeAreaConfig = getInitialSafeAreaConfig(context);
2636
- applySafeAreaOverrides(this.el, safeAreaConfig);
2637
- // Set the internal offset property with the resolved root safe-area-top value
2638
- if (context.isSheetModal) {
2639
- this.updateSheetOffsetTop();
2640
- }
2641
- }
2642
- /**
2643
- * Resolves the current root --ion-safe-area-top value and sets the
2644
- * internal --ion-modal-offset-top property on the host element.
2645
- * Called on present and on resize (e.g., device rotation changes safe-area).
2646
- */
2647
- updateSheetOffsetTop() {
2648
- const safeAreaTop = getRootSafeAreaTop();
2649
- this.el.style.setProperty('--ion-modal-offset-top', `${safeAreaTop}px`);
2650
- }
2651
- /**
2652
- * Updates safe-area overrides during dynamic state changes.
2653
- * Called after animations, during gestures, and on orientation changes.
2654
- */
2655
- updateSafeAreaOverrides() {
2656
- const { wrapperEl, el } = this;
2657
- const context = this.getSafeAreaContext();
2658
- // Sheet modals: safe-area is fully determined at presentation time
2659
- // (top is always 0px, height is frozen). Nothing to update.
2660
- if (context.isSheetModal)
2661
- return;
2662
- // Card modals have fixed safe-area requirements set by initial prediction.
2663
- if (context.isCardModal)
2664
- return;
2665
- // wrapperEl is required for position-based detection below
2666
- if (!wrapperEl)
2667
- return;
2668
- // Regular modals: use position-based detection to correctly handle both
2669
- // fullscreen modals and centered dialogs with custom dimensions.
2670
- const safeAreaConfig = getPositionBasedSafeAreaConfig(wrapperEl);
2671
- applySafeAreaOverrides(el, safeAreaConfig);
2672
- }
2673
- /**
2674
- * Applies padding-bottom to fullscreen modal wrapper to prevent
2675
- * content from overlapping system navigation bar.
2676
- */
2677
- applyFullscreenSafeArea() {
2678
- const { wrapperEl, el } = this;
2679
- if (!wrapperEl)
2680
- return;
2681
- const context = this.getSafeAreaContext();
2682
- if (context.isSheetModal || context.isCardModal)
2683
- return;
2684
- // Check for standard Ionic layout children (ion-content, ion-footer),
2685
- // searching one level deep for wrapped components (e.g.,
2686
- // <app-footer><ion-footer>...</ion-footer></app-footer>).
2687
- // Note: uses a manual loop instead of querySelector(':scope > ...') because
2688
- // Stencil's mock-doc (used in spec tests) does not support :scope.
2689
- let hasContent = false;
2690
- let hasFooter = false;
2691
- for (const child of Array.from(el.children)) {
2692
- if (child.tagName === 'ION-CONTENT')
2693
- hasContent = true;
2694
- if (child.tagName === 'ION-FOOTER')
2695
- hasFooter = true;
2696
- for (const grandchild of Array.from(child.children)) {
2697
- if (grandchild.tagName === 'ION-CONTENT')
2698
- hasContent = true;
2699
- if (grandchild.tagName === 'ION-FOOTER')
2700
- hasFooter = true;
2701
- }
2702
- }
2703
- // Only apply wrapper padding for standard Ionic layouts (has ion-content
2704
- // but no ion-footer). Custom modals with raw HTML are fully
2705
- // developer-controlled and should not be modified.
2706
- if (!hasContent || hasFooter)
2707
- return;
2708
- // Reduce wrapper height by safe-area and add equivalent padding so the
2709
- // total visual size stays the same but the flex content area shrinks.
2710
- // Using height + padding instead of box-sizing: border-box avoids
2711
- // breaking custom modals that set --border-width (border-box would
2712
- // include the border inside the height, changing the layout).
2713
- wrapperEl.style.setProperty('height', 'calc(var(--height) - var(--ion-safe-area-bottom, 0px))');
2714
- wrapperEl.style.setProperty('padding-bottom', 'var(--ion-safe-area-bottom, 0px)');
2715
- }
2716
- /**
2717
- * Clears all safe-area overrides and padding from wrapper.
2718
- */
2719
- cleanupSafeAreaOverrides() {
2720
- clearSafeAreaOverrides(this.el);
2721
- // Remove internal sheet offset property
2722
- this.el.style.removeProperty('--ion-modal-offset-top');
2723
- if (this.wrapperEl) {
2724
- this.wrapperEl.style.removeProperty('height');
2725
- this.wrapperEl.style.removeProperty('padding-bottom');
2726
- }
2727
- }
2728
- render() {
2729
- const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap, expandToScroll, } = this;
2730
- const showHandle = handle !== false && isSheetModal;
2731
- const mode = getIonMode(this);
2732
- const isCardModal = presentingElement !== undefined && mode === 'ios';
2733
- const isHandleCycle = handleBehavior === 'cycle';
2734
- const isSheetModalWithHandle = isSheetModal && showHandle;
2735
- return (h(Host, Object.assign({ key: '952cbd52d1fc737332a23d523b02d5fa60abf30a', "no-router": true,
2736
- // Allow the modal to be navigable when the handle is focusable
2737
- tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
2738
- zIndex: `${20000 + this.overlayIndex}`,
2739
- }, 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: '66e3658cfcc2961d99ecc1174f26b1794ceb65e9', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && h("div", { key: '3d1b9b26daf87374e2029d0e0a7fc09b9257fd77', class: "modal-shadow" }), h("div", Object.assign({ key: 'e652c2b3eb66afa8367d94c3b14ba0e825877a82',
2740
- /*
2741
- role and aria-modal must be used on the
2742
- same element. They must also be set inside the
2743
- shadow DOM otherwise ion-button will not be highlighted
2744
- when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
2745
- */
2746
- role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '41662183450e8ef2f7d96dac2bea5952bad8b7a5', class: "modal-handle",
2747
- // Prevents the handle from receiving keyboard focus when it does not cycle
2748
- 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: '4aac4e2928929b9e5e59b33c83395182105da529', onSlotchange: this.onSlotChange }))));
2749
- }
2750
- get el() { return this; }
2751
- static get watchers() { return {
2752
- "isOpen": ["onIsOpenChange"],
2753
- "trigger": ["triggerChanged"]
2754
- }; }
2755
- static get style() { return {
2756
- ios: modalIosCss,
2757
- md: modalMdCss
2758
- }; }
2759
- }, [289, "ion-modal", {
2760
- "hasController": [4, "has-controller"],
2761
- "overlayIndex": [2, "overlay-index"],
2762
- "delegate": [16],
2763
- "keyboardClose": [4, "keyboard-close"],
2764
- "enterAnimation": [16],
2765
- "leaveAnimation": [16],
2766
- "breakpoints": [16],
2767
- "expandToScroll": [4, "expand-to-scroll"],
2768
- "initialBreakpoint": [2, "initial-breakpoint"],
2769
- "backdropBreakpoint": [2, "backdrop-breakpoint"],
2770
- "handle": [4],
2771
- "handleBehavior": [1, "handle-behavior"],
2772
- "component": [1],
2773
- "componentProps": [16],
2774
- "cssClass": [1, "css-class"],
2775
- "backdropDismiss": [4, "backdrop-dismiss"],
2776
- "showBackdrop": [4, "show-backdrop"],
2777
- "animated": [4],
2778
- "presentingElement": [16],
2779
- "htmlAttributes": [16],
2780
- "isOpen": [4, "is-open"],
2781
- "trigger": [1],
2782
- "keepContentsMounted": [4, "keep-contents-mounted"],
2783
- "focusTrap": [4, "focus-trap"],
2784
- "canDismiss": [4, "can-dismiss"],
2785
- "isSheetModal": [32],
2786
- "presented": [32],
2787
- "present": [64],
2788
- "dismiss": [64],
2789
- "onDidDismiss": [64],
2790
- "onWillDismiss": [64],
2791
- "setCurrentBreakpoint": [64],
2792
- "getCurrentBreakpoint": [64]
2793
- }, [[9, "resize", "onWindowResize"]], {
2794
- "isOpen": ["onIsOpenChange"],
2795
- "trigger": ["triggerChanged"]
2796
- }]);
2797
- const LIFECYCLE_MAP = {
2798
- ionModalDidPresent: 'ionViewDidEnter',
2799
- ionModalWillPresent: 'ionViewWillEnter',
2800
- ionModalWillDismiss: 'ionViewWillLeave',
2801
- ionModalDidDismiss: 'ionViewDidLeave',
2802
- };
2803
- function defineCustomElement() {
2804
- if (typeof customElements === "undefined") {
2805
- return;
2806
- }
2807
- const components = ["ion-modal", "ion-backdrop"];
2808
- components.forEach(tagName => { switch (tagName) {
2809
- case "ion-modal":
2810
- if (!customElements.get(tagName)) {
2811
- customElements.define(tagName, Modal);
2812
- }
2813
- break;
2814
- case "ion-backdrop":
2815
- if (!customElements.get(tagName)) {
2816
- defineCustomElement$1();
2817
- }
2818
- break;
2819
- } });
2820
- }
2821
-
2822
- export { Modal as M, defineCustomElement as d };