@ionic/core 7.5.7-dev.11701274462.156e6f06 → 7.5.7-dev.11701896424.13d40ac9

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 (379) hide show
  1. package/components/animation.js +11 -12
  2. package/components/checkbox.js +0 -2
  3. package/components/data.js +64 -14
  4. package/components/index4.js +12 -10
  5. package/components/index5.js +22 -0
  6. package/components/input-shims.js +7 -12
  7. package/components/input.utils.js +2 -3
  8. package/components/ion-datetime.js +38 -19
  9. package/components/ion-input.js +8 -31
  10. package/components/ion-modal.js +2 -2
  11. package/components/ion-range.js +0 -2
  12. package/components/ion-select.js +29 -44
  13. package/components/ion-skeleton-text.js +1 -14
  14. package/components/ion-textarea.js +7 -30
  15. package/components/ion-toast.js +74 -419
  16. package/components/ion-toggle.js +0 -2
  17. package/components/item.js +2 -2
  18. package/components/label.js +2 -2
  19. package/components/overlays.js +1 -2
  20. package/components/picker-column-internal.js +7 -12
  21. package/components/radio-group.js +0 -2
  22. package/components/radio.js +2 -42
  23. package/dist/cjs/{animation-d101aa7a.js → animation-1083855c.js} +12 -13
  24. package/dist/cjs/{button-active-ba107e4e.js → button-active-af897e0e.js} +1 -1
  25. package/dist/cjs/{capacitor-f68447d3.js → capacitor-2ffba62a.js} +1 -1
  26. package/dist/cjs/{data-c8d21093.js → data-912a6f37.js} +64 -14
  27. package/dist/cjs/{haptic-a74c2767.js → haptic-678abc9f.js} +1 -1
  28. package/dist/cjs/index-306a7476.js +32 -0
  29. package/dist/cjs/{index-56d41f51.js → index-573877f3.js} +2 -2
  30. package/dist/cjs/{index-e9634bc9.js → index-9f379eaa.js} +1 -1
  31. package/dist/cjs/{index-4f0c67e1.js → index-d7561763.js} +13 -11
  32. package/dist/cjs/index.cjs.js +8 -8
  33. package/dist/cjs/{input-shims-3e3f35b9.js → input-shims-b0a75a01.js} +10 -15
  34. package/dist/cjs/{input.utils-bdb6953c.js → input.utils-0fe3097c.js} +3 -4
  35. package/dist/cjs/ion-action-sheet.cjs.entry.js +6 -6
  36. package/dist/cjs/ion-alert.cjs.entry.js +6 -6
  37. package/dist/cjs/ion-app_8.cjs.entry.js +8 -8
  38. package/dist/cjs/ion-checkbox.cjs.entry.js +0 -2
  39. package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
  40. package/dist/cjs/ion-datetime_3.cjs.entry.js +44 -25
  41. package/dist/cjs/ion-input.cjs.entry.js +11 -34
  42. package/dist/cjs/ion-item_8.cjs.entry.js +4 -17
  43. package/dist/cjs/ion-loading.cjs.entry.js +3 -3
  44. package/dist/cjs/ion-menu_3.cjs.entry.js +5 -5
  45. package/dist/cjs/ion-modal.cjs.entry.js +8 -8
  46. package/dist/cjs/ion-nav_2.cjs.entry.js +1 -1
  47. package/dist/cjs/ion-picker-column-internal.cjs.entry.js +10 -14
  48. package/dist/cjs/ion-popover.cjs.entry.js +4 -4
  49. package/dist/cjs/ion-radio_2.cjs.entry.js +1 -6
  50. package/dist/cjs/ion-range.cjs.entry.js +0 -2
  51. package/dist/cjs/ion-refresher_2.cjs.entry.js +4 -4
  52. package/dist/cjs/ion-reorder_2.cjs.entry.js +3 -3
  53. package/dist/cjs/ion-select_3.cjs.entry.js +35 -51
  54. package/dist/cjs/ion-tab-bar_2.cjs.entry.js +4 -4
  55. package/dist/cjs/ion-textarea.cjs.entry.js +10 -33
  56. package/dist/cjs/ion-toast.cjs.entry.js +92 -434
  57. package/dist/cjs/ion-toggle.cjs.entry.js +3 -5
  58. package/dist/cjs/ionic.cjs.js +1 -1
  59. package/dist/cjs/{ios.transition-f4caf640.js → ios.transition-ac909bc8.js} +3 -3
  60. package/dist/cjs/{keyboard-840107b3.js → keyboard-38f2bb7b.js} +3 -3
  61. package/dist/cjs/{keyboard-controller-019f42df.js → keyboard-controller-50beb83a.js} +2 -2
  62. package/dist/cjs/{keyboard-43df0428.js → keyboard-fd7db491.js} +1 -1
  63. package/dist/cjs/loader.cjs.js +1 -1
  64. package/dist/cjs/{md.transition-33331e93.js → md.transition-907af519.js} +3 -3
  65. package/dist/cjs/{notch-controller-c22d1344.js → notch-controller-f4f6af5d.js} +1 -1
  66. package/dist/cjs/{overlays-4d8897dc.js → overlays-2ffc5f27.js} +1 -3
  67. package/dist/collection/collection-manifest.json +2 -2
  68. package/dist/collection/components/checkbox/checkbox.js +0 -2
  69. package/dist/collection/components/datetime/datetime.ios.css +0 -1
  70. package/dist/collection/components/datetime/datetime.js +36 -17
  71. package/dist/collection/components/datetime/datetime.md.css +0 -1
  72. package/dist/collection/components/datetime/test/manipulation.spec.js +133 -1
  73. package/dist/collection/components/datetime/test/prefer-wheel/datetime.spec.js +27 -0
  74. package/dist/collection/components/datetime/utils/manipulation.js +65 -15
  75. package/dist/collection/components/input/input.ios.css +3 -10
  76. package/dist/collection/components/input/input.js +6 -31
  77. package/dist/collection/components/input/input.md.css +12 -13
  78. package/dist/collection/components/item/item.ios.css +3 -26
  79. package/dist/collection/components/item/item.md.css +3 -26
  80. package/dist/collection/components/item/test/basic/item.e2e.js +1 -1
  81. package/dist/collection/components/item/test/disabled/item.e2e.js +1 -0
  82. package/dist/collection/components/item/test/text/item.e2e.js +14 -0
  83. package/dist/collection/components/label/label.ios.css +3 -14
  84. package/dist/collection/components/label/label.md.css +3 -14
  85. package/dist/collection/components/modal/gestures/swipe-to-close.js +1 -2
  86. package/dist/collection/components/note/test/a11y/note.e2e.js +0 -43
  87. package/dist/collection/components/picker-column-internal/picker-column-internal.ios.css +3 -11
  88. package/dist/collection/components/picker-column-internal/picker-column-internal.js +5 -27
  89. package/dist/collection/components/picker-column-internal/picker-column-internal.md.css +3 -11
  90. package/dist/collection/components/picker-column-internal/test/disabled/picker-column-internal.e2e.js +5 -34
  91. package/dist/collection/components/radio/radio.js +2 -5
  92. package/dist/collection/components/radio-group/radio-group.js +0 -24
  93. package/dist/collection/components/range/range.js +0 -2
  94. package/dist/collection/components/select/select.ios.css +7 -61
  95. package/dist/collection/components/select/select.js +28 -45
  96. package/dist/collection/components/select/select.md.css +19 -64
  97. package/dist/collection/components/select/test/item/select.e2e.js +0 -13
  98. package/dist/collection/components/select/test/label/select.e2e.js +1 -1
  99. package/dist/collection/components/select/test/legacy/wrapping/select.e2e.js +1 -1
  100. package/dist/collection/components/skeleton-text/skeleton-text.js +0 -39
  101. package/dist/collection/components/textarea/textarea.ios.css +5 -37
  102. package/dist/collection/components/textarea/textarea.js +5 -30
  103. package/dist/collection/components/textarea/textarea.md.css +14 -47
  104. package/dist/collection/components/toast/animations/ios.enter.js +1 -2
  105. package/dist/collection/components/toast/animations/md.enter.js +3 -4
  106. package/dist/collection/components/toast/animations/utils.js +14 -20
  107. package/dist/collection/components/toast/test/toast.spec.js +0 -80
  108. package/dist/collection/components/toast/toast.ios.css +10 -10
  109. package/dist/collection/components/toast/toast.js +1 -104
  110. package/dist/collection/components/toast/toast.md.css +0 -10
  111. package/dist/collection/components/toggle/toggle.js +0 -2
  112. package/dist/collection/utils/animation/animation.js +11 -12
  113. package/dist/collection/utils/animation/test/animation.spec.js +0 -16
  114. package/dist/collection/utils/browser/index.js +22 -0
  115. package/dist/collection/utils/forms/index.js +0 -1
  116. package/dist/collection/utils/input-shims/input-shims.js +6 -12
  117. package/dist/collection/utils/menu-controller/index.js +12 -10
  118. package/dist/collection/utils/overlays.js +0 -1
  119. package/dist/collection/utils/slot-mutation-controller.js +2 -3
  120. package/dist/docs.json +12 -137
  121. package/dist/esm/{animation-cf3dd234.js → animation-8aa13916.js} +12 -13
  122. package/dist/esm/{button-active-47196c40.js → button-active-ce5cba4c.js} +1 -1
  123. package/dist/esm/{capacitor-f1f25364.js → capacitor-b4979570.js} +1 -1
  124. package/dist/esm/{data-44d9e816.js → data-316b33f5.js} +64 -14
  125. package/dist/esm/{haptic-1a66d69f.js → haptic-1243b917.js} +1 -1
  126. package/dist/esm/{index-23c05a55.js → index-0aa6e61f.js} +13 -11
  127. package/dist/esm/{index-702b3cd3.js → index-6a0ccabb.js} +2 -2
  128. package/dist/esm/index-7a14ecec.js +29 -0
  129. package/dist/esm/{index-c9e82353.js → index-f0cc4e14.js} +1 -1
  130. package/dist/esm/index.js +8 -8
  131. package/dist/esm/{input-shims-1d767845.js → input-shims-d0c93e5d.js} +9 -14
  132. package/dist/esm/{input.utils-2cf5e372.js → input.utils-ec063df4.js} +3 -4
  133. package/dist/esm/ion-action-sheet.entry.js +6 -6
  134. package/dist/esm/ion-alert.entry.js +6 -6
  135. package/dist/esm/ion-app_8.entry.js +8 -8
  136. package/dist/esm/ion-checkbox.entry.js +0 -2
  137. package/dist/esm/ion-datetime-button.entry.js +1 -1
  138. package/dist/esm/ion-datetime_3.entry.js +44 -25
  139. package/dist/esm/ion-input.entry.js +11 -34
  140. package/dist/esm/ion-item_8.entry.js +4 -17
  141. package/dist/esm/ion-loading.entry.js +3 -3
  142. package/dist/esm/ion-menu_3.entry.js +5 -5
  143. package/dist/esm/ion-modal.entry.js +8 -8
  144. package/dist/esm/ion-nav_2.entry.js +1 -1
  145. package/dist/esm/ion-picker-column-internal.entry.js +10 -14
  146. package/dist/esm/ion-popover.entry.js +4 -4
  147. package/dist/esm/ion-radio_2.entry.js +1 -6
  148. package/dist/esm/ion-range.entry.js +0 -2
  149. package/dist/esm/ion-refresher_2.entry.js +4 -4
  150. package/dist/esm/ion-reorder_2.entry.js +3 -3
  151. package/dist/esm/ion-select_3.entry.js +31 -47
  152. package/dist/esm/ion-tab-bar_2.entry.js +4 -4
  153. package/dist/esm/ion-textarea.entry.js +10 -33
  154. package/dist/esm/ion-toast.entry.js +75 -417
  155. package/dist/esm/ion-toggle.entry.js +3 -5
  156. package/dist/esm/ionic.js +1 -1
  157. package/dist/esm/{ios.transition-c3e77862.js → ios.transition-1651c430.js} +3 -3
  158. package/dist/esm/{keyboard-b6230bfb.js → keyboard-b063f012.js} +1 -1
  159. package/dist/esm/{keyboard-9f771a04.js → keyboard-b551279d.js} +3 -3
  160. package/dist/esm/{keyboard-controller-3f0faa10.js → keyboard-controller-0c2dce71.js} +2 -2
  161. package/dist/esm/loader.js +1 -1
  162. package/dist/esm/{md.transition-1173eca9.js → md.transition-66f18369.js} +3 -3
  163. package/dist/esm/{notch-controller-3f79197e.js → notch-controller-8c9c0e54.js} +1 -1
  164. package/dist/esm/{overlays-34169295.js → overlays-6c9feb7e.js} +2 -3
  165. package/dist/esm-es5/{animation-cf3dd234.js → animation-8aa13916.js} +1 -1
  166. package/dist/esm-es5/{button-active-47196c40.js → button-active-ce5cba4c.js} +1 -1
  167. package/dist/esm-es5/{capacitor-f1f25364.js → capacitor-b4979570.js} +1 -1
  168. package/dist/esm-es5/data-316b33f5.js +4 -0
  169. package/dist/esm-es5/{haptic-1a66d69f.js → haptic-1243b917.js} +1 -1
  170. package/dist/esm-es5/index-0aa6e61f.js +4 -0
  171. package/dist/esm-es5/{index-702b3cd3.js → index-6a0ccabb.js} +1 -1
  172. package/dist/esm-es5/index-f0cc4e14.js +4 -0
  173. package/dist/esm-es5/index.js +1 -1
  174. package/dist/esm-es5/input-shims-d0c93e5d.js +4 -0
  175. package/dist/esm-es5/input.utils-ec063df4.js +4 -0
  176. package/dist/esm-es5/ion-action-sheet.entry.js +1 -1
  177. package/dist/esm-es5/ion-alert.entry.js +1 -1
  178. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  179. package/dist/esm-es5/ion-checkbox.entry.js +1 -1
  180. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  181. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  182. package/dist/esm-es5/ion-input.entry.js +1 -1
  183. package/dist/esm-es5/ion-item_8.entry.js +1 -1
  184. package/dist/esm-es5/ion-loading.entry.js +1 -1
  185. package/dist/esm-es5/ion-menu_3.entry.js +1 -1
  186. package/dist/esm-es5/ion-modal.entry.js +1 -1
  187. package/dist/esm-es5/ion-nav_2.entry.js +1 -1
  188. package/dist/esm-es5/ion-picker-column-internal.entry.js +1 -1
  189. package/dist/esm-es5/ion-popover.entry.js +1 -1
  190. package/dist/esm-es5/ion-radio_2.entry.js +1 -1
  191. package/dist/esm-es5/ion-range.entry.js +1 -1
  192. package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
  193. package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
  194. package/dist/esm-es5/ion-select_3.entry.js +1 -1
  195. package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
  196. package/dist/esm-es5/ion-textarea.entry.js +1 -1
  197. package/dist/esm-es5/ion-toast.entry.js +1 -1
  198. package/dist/esm-es5/ion-toggle.entry.js +1 -1
  199. package/dist/esm-es5/ionic.js +1 -1
  200. package/dist/esm-es5/{ios.transition-c3e77862.js → ios.transition-1651c430.js} +1 -1
  201. package/dist/esm-es5/{keyboard-b6230bfb.js → keyboard-b063f012.js} +1 -1
  202. package/dist/esm-es5/{keyboard-9f771a04.js → keyboard-b551279d.js} +1 -1
  203. package/dist/esm-es5/{keyboard-controller-3f0faa10.js → keyboard-controller-0c2dce71.js} +1 -1
  204. package/dist/esm-es5/loader.js +1 -1
  205. package/dist/esm-es5/md.transition-66f18369.js +4 -0
  206. package/dist/esm-es5/{notch-controller-3f79197e.js → notch-controller-8c9c0e54.js} +1 -1
  207. package/dist/esm-es5/{overlays-34169295.js → overlays-6c9feb7e.js} +1 -1
  208. package/dist/html.html-data.json +1 -14
  209. package/dist/ionic/index.esm.js +1 -1
  210. package/dist/ionic/ionic.esm.js +1 -1
  211. package/dist/ionic/p-014e8840.system.js +4 -0
  212. package/dist/ionic/{p-83a455fd.system.js → p-09d142b3.system.js} +1 -1
  213. package/dist/ionic/p-0d8e9393.entry.js +4 -0
  214. package/dist/ionic/{p-3abf5b7a.entry.js → p-0dc0d9b5.entry.js} +1 -1
  215. package/dist/ionic/{p-54824705.system.entry.js → p-0e23256e.system.entry.js} +1 -1
  216. package/dist/ionic/{p-e9e5755c.system.js → p-14b4348c.system.js} +1 -1
  217. package/dist/ionic/{p-ea9addc8.system.entry.js → p-18e01b30.system.entry.js} +1 -1
  218. package/dist/ionic/{p-823890d5.system.entry.js → p-1cb5f2f8.system.entry.js} +1 -1
  219. package/dist/ionic/p-1e5165db.system.entry.js +4 -0
  220. package/dist/ionic/p-20cf4994.js +4 -0
  221. package/dist/ionic/p-276afddd.js +4 -0
  222. package/dist/ionic/p-2e8e0045.js +4 -0
  223. package/dist/ionic/{p-d61a2cee.system.entry.js → p-34d2de14.system.entry.js} +1 -1
  224. package/dist/ionic/p-352c0232.system.entry.js +4 -0
  225. package/dist/ionic/p-3602001b.system.js +4 -0
  226. package/dist/ionic/p-3632220b.system.js +4 -0
  227. package/dist/ionic/{p-37c69d34.system.entry.js → p-377c636c.system.entry.js} +1 -1
  228. package/dist/ionic/{p-fce6b76a.system.entry.js → p-39044fe6.system.entry.js} +1 -1
  229. package/dist/ionic/{p-e5fd9f10.js → p-3bad5c1a.js} +1 -1
  230. package/dist/ionic/p-3ce8c3e3.entry.js +4 -0
  231. package/dist/ionic/p-40903d34.system.js +1 -1
  232. package/dist/ionic/{p-958f1c70.system.js → p-41477ad9.system.js} +1 -1
  233. package/dist/ionic/{p-a135e3ba.js → p-419eb426.js} +1 -1
  234. package/dist/ionic/p-4794e0ac.system.entry.js +4 -0
  235. package/dist/ionic/{p-587afb80.system.entry.js → p-4a142496.system.entry.js} +1 -1
  236. package/dist/ionic/p-4cd588b3.system.entry.js +4 -0
  237. package/dist/ionic/p-4dbac22d.entry.js +4 -0
  238. package/dist/ionic/p-4fa201a7.entry.js +4 -0
  239. package/dist/ionic/{p-4c80afe1.system.entry.js → p-587be954.system.entry.js} +1 -1
  240. package/dist/ionic/p-5c299019.entry.js +4 -0
  241. package/dist/ionic/{p-f36112b4.entry.js → p-64296b15.entry.js} +1 -1
  242. package/dist/ionic/{p-1abc74d9.entry.js → p-64ed03a3.entry.js} +1 -1
  243. package/dist/ionic/p-67aab78f.js +4 -0
  244. package/dist/ionic/{p-03ed6107.system.entry.js → p-67e644bd.system.entry.js} +1 -1
  245. package/dist/ionic/{p-cc615985.system.entry.js → p-67ed452a.system.entry.js} +1 -1
  246. package/dist/ionic/p-67eecef4.system.js +4 -0
  247. package/dist/ionic/p-6d812360.system.entry.js +4 -0
  248. package/dist/ionic/{p-67951604.system.js → p-702d85d8.system.js} +1 -1
  249. package/dist/ionic/p-7176cea3.entry.js +4 -0
  250. package/dist/ionic/{p-8b15ca22.entry.js → p-73411c1b.entry.js} +1 -1
  251. package/dist/ionic/p-77e7a9c8.entry.js +4 -0
  252. package/dist/ionic/{p-8ad82eb3.entry.js → p-79e83e0a.entry.js} +1 -1
  253. package/dist/ionic/p-7f85ffa9.js +4 -0
  254. package/dist/ionic/{p-2a41d4d1.js → p-800ef057.js} +1 -1
  255. package/dist/ionic/{p-11cb4e19.js → p-81c818e7.js} +1 -1
  256. package/dist/ionic/p-88980f5f.system.entry.js +4 -0
  257. package/dist/ionic/{p-5885e9af.js → p-8cf94fc1.js} +1 -1
  258. package/dist/ionic/{p-3e655d4c.entry.js → p-8e1bded3.entry.js} +1 -1
  259. package/dist/ionic/p-97c65aa5.js +4 -0
  260. package/dist/ionic/{p-d48872b1.system.js → p-97e31c0a.system.js} +1 -1
  261. package/dist/ionic/p-9ab6f3e6.system.js +4 -0
  262. package/dist/ionic/p-9b89cbde.js +4 -0
  263. package/dist/ionic/{p-fe1f93f2.js → p-a0b6d438.js} +1 -1
  264. package/dist/ionic/p-a21b8d05.entry.js +4 -0
  265. package/dist/ionic/p-a5c1e6ce.entry.js +4 -0
  266. package/dist/ionic/{p-c4de53af.system.js → p-a936d224.system.js} +1 -1
  267. package/dist/ionic/{p-aec8a70a.system.js → p-ab4cff27.system.js} +1 -1
  268. package/dist/ionic/p-b0cee324.entry.js +4 -0
  269. package/dist/ionic/p-b1142133.entry.js +4 -0
  270. package/dist/ionic/p-b203659a.system.entry.js +4 -0
  271. package/dist/ionic/{p-6797887a.entry.js → p-b2a74a72.entry.js} +1 -1
  272. package/dist/ionic/{p-9292fd42.system.js → p-b4b4bb29.system.js} +1 -1
  273. package/dist/ionic/p-b6f8ee31.entry.js +4 -0
  274. package/dist/ionic/{p-31189dae.entry.js → p-b91fe549.entry.js} +1 -1
  275. package/dist/ionic/{p-6a309574.js → p-b923f3d7.js} +1 -1
  276. package/dist/ionic/{p-f9a641fa.system.js → p-bba2ce59.system.js} +1 -1
  277. package/dist/ionic/{p-5e6bc319.system.entry.js → p-bed722c4.system.entry.js} +1 -1
  278. package/dist/ionic/{p-21b4981c.system.js → p-c4042875.system.js} +1 -1
  279. package/dist/ionic/p-cc196b34.js +4 -0
  280. package/dist/ionic/{p-e7d20dfb.system.js → p-ccdcb022.system.js} +1 -1
  281. package/dist/ionic/{p-fcb148dc.system.entry.js → p-cf425ec5.system.entry.js} +1 -1
  282. package/dist/ionic/p-d1de1188.js +4 -0
  283. package/dist/ionic/p-d21bfe66.system.entry.js +4 -0
  284. package/dist/ionic/p-d3952bd5.system.entry.js +4 -0
  285. package/dist/ionic/{p-196f2123.system.entry.js → p-ddfc4ef4.system.entry.js} +1 -1
  286. package/dist/ionic/{p-c1e725db.entry.js → p-deab76dc.entry.js} +1 -1
  287. package/dist/ionic/p-dfa756ed.system.js +4 -0
  288. package/dist/ionic/p-e6b240a0.js +4 -0
  289. package/dist/ionic/{p-64ab3eb3.entry.js → p-f37b4b79.entry.js} +1 -1
  290. package/dist/ionic/{p-7047a40c.system.entry.js → p-f3c82f74.system.entry.js} +1 -1
  291. package/dist/ionic/{p-b673ee9b.entry.js → p-f54ddd19.entry.js} +1 -1
  292. package/dist/ionic/p-ff5a10f9.system.js +4 -0
  293. package/dist/types/components/datetime/utils/manipulation.d.ts +34 -7
  294. package/dist/types/components/input/input.d.ts +0 -2
  295. package/dist/types/components/picker-column-internal/picker-column-internal.d.ts +0 -4
  296. package/dist/types/components/radio-group/radio-group-interface.d.ts +0 -1
  297. package/dist/types/components/radio-group/radio-group.d.ts +1 -8
  298. package/dist/types/components/router/router.d.ts +1 -2
  299. package/dist/types/components/select/select.d.ts +1 -6
  300. package/dist/types/components/skeleton-text/skeleton-text.d.ts +1 -9
  301. package/dist/types/components/textarea/textarea.d.ts +0 -2
  302. package/dist/types/components/toast/animations/utils.d.ts +4 -15
  303. package/dist/types/components/toast/toast-interface.d.ts +0 -2
  304. package/dist/types/components/toast/toast.d.ts +1 -28
  305. package/dist/types/components.d.ts +6 -45
  306. package/dist/types/interface.d.ts +5 -1
  307. package/dist/types/utils/animation/animation-interface.d.ts +4 -4
  308. package/dist/types/utils/browser/index.d.ts +2 -11
  309. package/dist/types/utils/forms/index.d.ts +0 -1
  310. package/dist/types/utils/hardware-back-button.d.ts +0 -4
  311. package/dist/types/utils/overlays.d.ts +0 -1
  312. package/dist/types/utils/slot-mutation-controller.d.ts +2 -2
  313. package/hydrate/index.js +276 -659
  314. package/package.json +1 -1
  315. package/dist/cjs/compare-with-utils-c0444525.js +0 -44
  316. package/dist/cjs/index-c8d52405.js +0 -10
  317. package/dist/collection/components/datetime/test/disabled/datetime.spec.js +0 -33
  318. package/dist/collection/components/input/test/slot/input.e2e.js +0 -51
  319. package/dist/collection/components/radio-group/test/radio-group.spec.js +0 -69
  320. package/dist/collection/components/select/test/slot/select.e2e.js +0 -67
  321. package/dist/collection/components/textarea/test/slot/textarea.e2e.js +0 -51
  322. package/dist/collection/components/toast/gestures/swipe-to-dismiss.js +0 -267
  323. package/dist/collection/components/toast/test/swipe-gesture/toast.e2e.js +0 -84
  324. package/dist/collection/components/toast/test/toast-config.spec.js +0 -25
  325. package/dist/collection/utils/forms/compare-with-utils.js +0 -39
  326. package/dist/esm/compare-with-utils-4928c09d.js +0 -41
  327. package/dist/esm/index-a5d50daf.js +0 -7
  328. package/dist/esm-es5/compare-with-utils-4928c09d.js +0 -4
  329. package/dist/esm-es5/data-44d9e816.js +0 -4
  330. package/dist/esm-es5/index-23c05a55.js +0 -4
  331. package/dist/esm-es5/index-c9e82353.js +0 -4
  332. package/dist/esm-es5/input-shims-1d767845.js +0 -4
  333. package/dist/esm-es5/input.utils-2cf5e372.js +0 -4
  334. package/dist/esm-es5/md.transition-1173eca9.js +0 -4
  335. package/dist/ionic/p-0547e914.entry.js +0 -4
  336. package/dist/ionic/p-131761b4.entry.js +0 -4
  337. package/dist/ionic/p-17240d90.js +0 -4
  338. package/dist/ionic/p-1cf5e8d6.entry.js +0 -4
  339. package/dist/ionic/p-2207f3c2.js +0 -4
  340. package/dist/ionic/p-27eb8a91.system.entry.js +0 -4
  341. package/dist/ionic/p-314c4dee.js +0 -4
  342. package/dist/ionic/p-385c51f8.system.entry.js +0 -4
  343. package/dist/ionic/p-3bc3d880.system.js +0 -4
  344. package/dist/ionic/p-43716898.js +0 -4
  345. package/dist/ionic/p-450a26bf.js +0 -4
  346. package/dist/ionic/p-485668f0.entry.js +0 -4
  347. package/dist/ionic/p-48c59094.system.entry.js +0 -4
  348. package/dist/ionic/p-494e75ad.js +0 -4
  349. package/dist/ionic/p-561cc050.system.js +0 -4
  350. package/dist/ionic/p-671dbd61.js +0 -4
  351. package/dist/ionic/p-693cabd5.entry.js +0 -4
  352. package/dist/ionic/p-70dcf429.js +0 -4
  353. package/dist/ionic/p-710cea83.system.js +0 -4
  354. package/dist/ionic/p-7b44e419.js +0 -4
  355. package/dist/ionic/p-80a9b397.entry.js +0 -4
  356. package/dist/ionic/p-8ddfecbf.entry.js +0 -4
  357. package/dist/ionic/p-98712253.system.entry.js +0 -4
  358. package/dist/ionic/p-9c6787e2.entry.js +0 -4
  359. package/dist/ionic/p-a11c1aff.system.entry.js +0 -4
  360. package/dist/ionic/p-a31099a4.entry.js +0 -4
  361. package/dist/ionic/p-a6bc00ab.entry.js +0 -4
  362. package/dist/ionic/p-ad4b4f73.system.entry.js +0 -4
  363. package/dist/ionic/p-b8c3f071.system.js +0 -4
  364. package/dist/ionic/p-be0f6600.system.js +0 -4
  365. package/dist/ionic/p-c2db1374.system.js +0 -4
  366. package/dist/ionic/p-c3547c7a.system.js +0 -4
  367. package/dist/ionic/p-c700acef.system.js +0 -4
  368. package/dist/ionic/p-d4fba36b.system.entry.js +0 -4
  369. package/dist/ionic/p-e5b8f2f7.js +0 -4
  370. package/dist/ionic/p-f43f4102.entry.js +0 -4
  371. package/dist/ionic/p-f5d78105.entry.js +0 -4
  372. package/dist/ionic/p-f7769c83.js +0 -4
  373. package/dist/ionic/p-fcc23f25.system.entry.js +0 -4
  374. package/dist/ionic/p-fdcf04c3.system.entry.js +0 -4
  375. package/dist/types/components/toast/gestures/swipe-to-dismiss.d.ts +0 -9
  376. package/dist/types/utils/forms/compare-with-utils.d.ts +0 -18
  377. /package/dist/esm-es5/{index-a5d50daf.js → index-7a14ecec.js} +0 -0
  378. /package/dist/ionic/{p-792919fd.system.js → p-0e94957a.system.js} +0 -0
  379. /package/dist/ionic/{p-7b30edcc.js → p-b347cfd1.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "7.5.7-dev.11701274462.156e6f06",
3
+ "version": "7.5.7-dev.11701896424.13d40ac9",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",
@@ -1,44 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- 'use strict';
5
-
6
- /**
7
- * Uses the compareWith param to compare two values to determine if they are equal.
8
- *
9
- * @param currentValue The current value of the control.
10
- * @param compareValue The value to compare against.
11
- * @param compareWith The function or property name to use to compare values.
12
- */
13
- const compareOptions = (currentValue, compareValue, compareWith) => {
14
- if (typeof compareWith === 'function') {
15
- return compareWith(currentValue, compareValue);
16
- }
17
- else if (typeof compareWith === 'string') {
18
- return currentValue[compareWith] === compareValue[compareWith];
19
- }
20
- else {
21
- return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;
22
- }
23
- };
24
- /**
25
- * Compares a value against the current value(s) to determine if it is selected.
26
- *
27
- * @param currentValue The current value of the control.
28
- * @param compareValue The value to compare against.
29
- * @param compareWith The function or property name to use to compare values.
30
- */
31
- const isOptionSelected = (currentValue, compareValue, compareWith) => {
32
- if (currentValue === undefined) {
33
- return false;
34
- }
35
- if (Array.isArray(currentValue)) {
36
- return currentValue.some((val) => compareOptions(val, compareValue, compareWith));
37
- }
38
- else {
39
- return compareOptions(currentValue, compareValue, compareWith);
40
- }
41
- };
42
-
43
- exports.compareOptions = compareOptions;
44
- exports.isOptionSelected = isOptionSelected;
@@ -1,10 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- 'use strict';
5
-
6
- const win = typeof window !== 'undefined' ? window : undefined;
7
- const doc = typeof document !== 'undefined' ? document : undefined;
8
-
9
- exports.doc = doc;
10
- exports.win = win;
@@ -1,33 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { h } from "@stencil/core";
5
- import { newSpecPage } from "@stencil/core/testing";
6
- import { Datetime } from "../../../datetime/datetime";
7
- import { PickerColumnInternal } from "../../../picker-column-internal/picker-column-internal";
8
- import { PickerInternal } from "../../../picker-internal/picker-internal";
9
- describe('ion-datetime disabled', () => {
10
- beforeEach(() => {
11
- // IntersectionObserver isn't available in test environment
12
- const mockIntersectionObserver = jest.fn();
13
- mockIntersectionObserver.mockReturnValue({
14
- observe: () => null,
15
- unobserve: () => null,
16
- disconnect: () => null,
17
- });
18
- global.IntersectionObserver = mockIntersectionObserver;
19
- });
20
- it('picker should be disabled in prefer wheel mode', async () => {
21
- const page = await newSpecPage({
22
- components: [Datetime, PickerColumnInternal, PickerInternal],
23
- template: () => (h("ion-datetime", { id: "inline-datetime-wheel", disabled: true, "prefer-wheel": true, value: "2022-04-21T00:00:00" })),
24
- });
25
- await page.waitForChanges();
26
- const datetime = page.body.querySelector('ion-datetime');
27
- const columns = datetime.shadowRoot.querySelectorAll('ion-picker-column-internal');
28
- await expect(columns.length).toEqual(4);
29
- columns.forEach((column) => {
30
- expect(column.disabled).toBe(true);
31
- });
32
- });
33
- });
@@ -1,51 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { expect } from "@playwright/test";
5
- import { configs, test } from "../../../../utils/test/playwright/index";
6
- configs().forEach(({ title, screenshot, config }) => {
7
- test.describe(title('input: start and end slots (visual checks)'), () => {
8
- test('should not have visual regressions with a start-positioned label', async ({ page }) => {
9
- await page.setContent(`
10
- <ion-input label-placement="start" fill="solid" value="100" label="Weight" clear-input="true">
11
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
12
- <ion-label slot="end">lbs</ion-label>
13
- </ion-input>
14
- `, config);
15
- const input = page.locator('ion-input');
16
- await expect(input).toHaveScreenshot(screenshot(`input-slots-label-start`));
17
- });
18
- test('should not have visual regressions with a floating label', async ({ page }) => {
19
- await page.setContent(`
20
- <ion-input label-placement="floating" fill="solid" value="100" label="Weight" clear-input="true">
21
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
22
- <ion-label slot="end">lbs</ion-label>
23
- </ion-input>
24
- `, config);
25
- const input = page.locator('ion-input');
26
- await expect(input).toHaveScreenshot(screenshot(`input-slots-label-floating`));
27
- });
28
- });
29
- });
30
- configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
31
- test.describe(title('input: start and end slots (functionality checks)'), () => {
32
- test('should raise floating label when there is content in the start slot', async ({ page }) => {
33
- await page.setContent(`
34
- <ion-input label-placement="floating" fill="solid" label="Weight">
35
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
36
- </ion-input>
37
- `, config);
38
- const input = page.locator('ion-input');
39
- await expect(input).toHaveClass(/label-floating/);
40
- });
41
- test('should raise floating label when there is content in the end slot', async ({ page }) => {
42
- await page.setContent(`
43
- <ion-input label-placement="floating" fill="solid" label="Weight">
44
- <ion-icon slot="end" name="barbell" aria-hidden="true"></ion-icon>
45
- </ion-input>
46
- `, config);
47
- const input = page.locator('ion-input');
48
- await expect(input).toHaveClass(/label-floating/);
49
- });
50
- });
51
- });
@@ -1,69 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { h } from "@stencil/core";
5
- import { newSpecPage } from "@stencil/core/testing";
6
- import { Radio } from "../../radio/radio";
7
- import { RadioGroup } from "../radio-group";
8
- describe('ion-radio-group', () => {
9
- it('should correctly set value when using compareWith string', async () => {
10
- const page = await newSpecPage({
11
- components: [Radio, RadioGroup],
12
- template: () => (h("ion-radio-group", { compareWith: "value", value: { label: 'Blue', value: 'blue' } }, h("ion-radio", { value: { label: 'Red', value: 'red' } }, "Red"), h("ion-radio", { value: { label: 'Blue', value: 'blue' } }, "Blue"), h("ion-radio", { value: { label: 'Green', value: 'green' } }, "Green"))),
13
- });
14
- const radioGroup = page.body.querySelector('ion-radio-group');
15
- const radios = document.querySelectorAll('ion-radio');
16
- await radios[2].click();
17
- await page.waitForChanges();
18
- expect(radios[2].getAttribute('aria-checked')).toBe('true');
19
- expect(radioGroup.value).toEqual({
20
- label: 'Green',
21
- value: 'green',
22
- });
23
- });
24
- it('should correctly set value when using compareWith function', async () => {
25
- const page = await newSpecPage({
26
- components: [Radio, RadioGroup],
27
- template: () => (h("ion-radio-group", { value: { label: 'Blue', value: 'blue' } }, h("ion-radio", { value: { label: 'Red', value: 'red' } }, "Red"), h("ion-radio", { value: { label: 'Blue', value: 'blue' } }, "Blue"), h("ion-radio", { value: { label: 'Green', value: 'green' } }, "Green"))),
28
- });
29
- const radioGroup = page.body.querySelector('ion-radio-group');
30
- const radios = document.querySelectorAll('ion-radio');
31
- radioGroup.compareWith = (a, b) => a.value === b.value;
32
- await radios[2].click();
33
- await page.waitForChanges();
34
- expect(radios[2].getAttribute('aria-checked')).toBe('true');
35
- expect(radioGroup.value).toEqual({
36
- label: 'Green',
37
- value: 'green',
38
- });
39
- });
40
- it('should correctly set value when using compareWith null', async () => {
41
- const page = await newSpecPage({
42
- components: [RadioGroup, Radio],
43
- template: () => (h("ion-radio-group", { compareWith: null, value: "blue" }, h("ion-radio", { value: "red" }, "Red"), h("br", null), h("ion-radio", { value: "blue" }, "Blue"), h("br", null), h("ion-radio", { value: "green" }, "Green"))),
44
- });
45
- const radioGroup = page.body.querySelector('ion-radio-group');
46
- const radios = document.querySelectorAll('ion-radio');
47
- await radios[2].click();
48
- await page.waitForChanges();
49
- expect(radios[2].getAttribute('aria-checked')).toBe('true');
50
- expect(radioGroup.value).toEqual('green');
51
- });
52
- it('should work with different parameter types', async () => {
53
- const page = await newSpecPage({
54
- components: [Radio, RadioGroup],
55
- template: () => (h("ion-radio-group", { value: 2 }, h("ion-radio", { value: 1 }, "Option #1"), h("ion-radio", { value: 2 }, "Option #2"), h("ion-radio", { value: 3 }, "Option #3"))),
56
- });
57
- const radioGroup = page.body.querySelector('ion-radio-group');
58
- radioGroup.compareWith = (val1, val2) => {
59
- // convert val1 to a number
60
- return +val1 === val2;
61
- };
62
- const radios = document.querySelectorAll('ion-radio');
63
- await expect(radios[1].getAttribute('aria-checked')).toBe('true');
64
- await radios[2].click();
65
- await page.waitForChanges();
66
- expect(radios[2].getAttribute('aria-checked')).toBe('true');
67
- expect(radioGroup.value).toEqual(3);
68
- });
69
- });
@@ -1,67 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { expect } from "@playwright/test";
5
- import { configs, test } from "../../../../utils/test/playwright/index";
6
- configs().forEach(({ title, screenshot, config }) => {
7
- test.describe(title('select: start and end slots (visual checks)'), () => {
8
- test('should not have visual regressions with a start-positioned label', async ({ page }) => {
9
- await page.setContent(`
10
- <ion-select label-placement="start" fill="solid" placeholder="Select weight" label="Weight">
11
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
12
- <ion-label slot="end">lbs</ion-label>
13
- </ion-select>
14
- `, config);
15
- const select = page.locator('ion-select');
16
- await expect(select).toHaveScreenshot(screenshot(`select-slots-label-start`));
17
- });
18
- test('should not have visual regressions with a floating label', async ({ page }) => {
19
- await page.setContent(`
20
- <ion-select label-placement="floating" fill="solid" placeholder="Select weight" label="Weight">
21
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
22
- <ion-label slot="end">lbs</ion-label>
23
- </ion-select>
24
- `, config);
25
- const select = page.locator('ion-select');
26
- await expect(select).toHaveScreenshot(screenshot(`select-slots-label-floating`));
27
- });
28
- });
29
- });
30
- configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
31
- test.describe(title('select: start and end slots (functionality checks)'), () => {
32
- test('should raise floating label when there is content in the start slot', async ({ page }) => {
33
- await page.setContent(`
34
- <ion-select label-placement="floating" fill="solid" label="Weight">
35
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
36
- </ion-select>
37
- `, config);
38
- const select = page.locator('ion-select');
39
- await expect(select).toHaveClass(/label-floating/);
40
- });
41
- test('should raise floating label when there is content in the end slot', async ({ page }) => {
42
- await page.setContent(`
43
- <ion-select label-placement="floating" fill="solid" label="Weight">
44
- <ion-icon slot="end" name="barbell" aria-hidden="true"></ion-icon>
45
- </ion-select>
46
- `, config);
47
- const select = page.locator('ion-select');
48
- await expect(select).toHaveClass(/label-floating/);
49
- });
50
- test('should not open select when slotted buttons are clicked', async ({ page }) => {
51
- await page.setContent(`
52
- <ion-select label="Favorite Pizza" placeholder="Select a pizza">
53
- <ion-select-option value="pepperoni">Pepperoni</ion-select-option>
54
- <ion-select-option value="supreme">Supreme</ion-select-option>
55
- <ion-select-option value="chicken">Chicken</ion-select-option>
56
- <ion-button fill="clear" slot="end" aria-label="Show/hide password">
57
- <ion-icon slot="icon-only" name="eye" aria-hidden="true"></ion-icon>
58
- </ion-button>
59
- </ion-select>
60
- `, config);
61
- await page.click('ion-select ion-button[slot="end"]');
62
- await page.waitForChanges();
63
- const select = page.locator('ion-select');
64
- await expect(select).not.toHaveClass(/select-expanded/);
65
- });
66
- });
67
- });
@@ -1,51 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { expect } from "@playwright/test";
5
- import { configs, test } from "../../../../utils/test/playwright/index";
6
- configs().forEach(({ title, screenshot, config }) => {
7
- test.describe(title('textarea: start and end slots (visual checks)'), () => {
8
- test('should not have visual regressions with a start-positioned label', async ({ page }) => {
9
- await page.setContent(`
10
- <ion-textarea label-placement="start" fill="solid" value="100" label="Weight">
11
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
12
- <ion-label slot="end">lbs</ion-label>
13
- </ion-textarea>
14
- `, config);
15
- const textarea = page.locator('ion-textarea');
16
- await expect(textarea).toHaveScreenshot(screenshot(`textarea-slots-label-start`));
17
- });
18
- test('should not have visual regressions with a floating label', async ({ page }) => {
19
- await page.setContent(`
20
- <ion-textarea label-placement="floating" fill="solid" value="100" label="Weight">
21
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
22
- <ion-label slot="end">lbs</ion-label>
23
- </ion-textarea>
24
- `, config);
25
- const textarea = page.locator('ion-textarea');
26
- await expect(textarea).toHaveScreenshot(screenshot(`textarea-slots-label-floating`));
27
- });
28
- });
29
- });
30
- configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
31
- test.describe(title('textarea: start and end slots (functionality checks)'), () => {
32
- test('should raise floating label when there is content in the start slot', async ({ page }) => {
33
- await page.setContent(`
34
- <ion-textarea label-placement="floating" fill="solid" label="Weight">
35
- <ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
36
- </ion-textarea>
37
- `, config);
38
- const textarea = page.locator('ion-textarea');
39
- await expect(textarea).toHaveClass(/label-floating/);
40
- });
41
- test('should raise floating label when there is content in the end slot', async ({ page }) => {
42
- await page.setContent(`
43
- <ion-textarea label-placement="floating" fill="solid" label="Weight">
44
- <ion-icon slot="end" name="barbell" aria-hidden="true"></ion-icon>
45
- </ion-textarea>
46
- `, config);
47
- const textarea = page.locator('ion-textarea');
48
- await expect(textarea).toHaveClass(/label-floating/);
49
- });
50
- });
51
- });
@@ -1,267 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import { Build } from "@stencil/core";
5
- import { createAnimation } from "../../../utils/animation/animation";
6
- import { createGesture } from "../../../utils/gesture/index";
7
- import { getElementRoot } from "../../../utils/helpers";
8
- import { OVERLAY_GESTURE_PRIORITY } from "../../../utils/overlays";
9
- import { getOffsetForMiddlePosition } from "../animations/utils";
10
- /**
11
- * Create a gesture that allows the Toast
12
- * to be swiped to dismiss.
13
- * @param el - The Toast element
14
- * @param toastPosition - The last computed position of the Toast. This is computed in the "present" method.
15
- * @param onDismiss - A callback to fire when the Toast was swiped to dismiss.
16
- */
17
- export const createSwipeToDismissGesture = (el, toastPosition, onDismiss) => {
18
- /**
19
- * Users should swipe on the visible toast wrapper
20
- * rather than on ion-toast which covers the entire screen.
21
- * When testing the class instance the inner wrapper will not
22
- * be defined. As a result, we use a placeholder element in those environments.
23
- */
24
- const wrapperEl = Build.isTesting
25
- ? document.createElement('div')
26
- : getElementRoot(el).querySelector('.toast-wrapper');
27
- const hostElHeight = el.clientHeight;
28
- const wrapperElBox = wrapperEl.getBoundingClientRect();
29
- /**
30
- * The maximum amount that
31
- * the toast can be swiped. This should
32
- * account for the wrapper element's height
33
- * too so the toast can be swiped offscreen
34
- * completely.
35
- */
36
- let MAX_SWIPE_DISTANCE = 0;
37
- /**
38
- * The step value at which a toast
39
- * is eligible for dismissing via gesture.
40
- */
41
- const DISMISS_THRESHOLD = 0.5;
42
- /**
43
- * The middle position Toast starts 50% of the way
44
- * through the animation, so we need to use this
45
- * as the starting point for our step values.
46
- */
47
- const STEP_OFFSET = el.position === 'middle' ? 0.5 : 0;
48
- /**
49
- * When the Toast is at the top users will be
50
- * swiping up. As a result, the delta values will be
51
- * negative numbers which will result in negative steps
52
- * and thresholds. As a result, we need to make those numbers
53
- * positive.
54
- */
55
- const INVERSION_FACTOR = el.position === 'top' ? -1 : 1;
56
- /**
57
- * The top offset that places the
58
- * toast in the middle of the screen.
59
- * Only needed when position="middle".
60
- */
61
- const topPosition = getOffsetForMiddlePosition(hostElHeight, wrapperElBox.height);
62
- const SWIPE_UP_DOWN_KEYFRAMES = [
63
- { offset: 0, transform: `translateY(-${topPosition + wrapperElBox.height}px)` },
64
- { offset: 0.5, transform: `translateY(0px)` },
65
- { offset: 1, transform: `translateY(${topPosition + wrapperElBox.height}px)` },
66
- ];
67
- const swipeAnimation = createAnimation('toast-swipe-to-dismiss-animation')
68
- .addElement(wrapperEl)
69
- /**
70
- * The specific value here does not actually
71
- * matter. We just need this to be a positive
72
- * value so the animation does not jump
73
- * to the end when the user beings to drag.
74
- */
75
- .duration(100);
76
- switch (el.position) {
77
- case 'middle':
78
- MAX_SWIPE_DISTANCE = hostElHeight + wrapperElBox.height;
79
- swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES);
80
- /**
81
- * Toast can be swiped up or down but
82
- * should start in the middle of the screen.
83
- */
84
- swipeAnimation.progressStart(true, 0.5);
85
- break;
86
- case 'top':
87
- /**
88
- * The bottom edge of the wrapper
89
- * includes the distance between the top
90
- * of the screen and the top of the wrapper
91
- * as well as the wrapper height so the wrapper
92
- * can be dragged fully offscreen.
93
- */
94
- MAX_SWIPE_DISTANCE = wrapperElBox.bottom;
95
- swipeAnimation.keyframes([
96
- { offset: 0, transform: `translateY(${toastPosition.top})` },
97
- { offset: 1, transform: 'translateY(-100%)' },
98
- ]);
99
- swipeAnimation.progressStart(true, 0);
100
- break;
101
- case 'bottom':
102
- default:
103
- /**
104
- * This computes the distance between the
105
- * top of the wrapper and the bottom of the
106
- * screen including the height of the wrapper
107
- * element so it can be dragged fully offscreen.
108
- */
109
- MAX_SWIPE_DISTANCE = hostElHeight - wrapperElBox.top;
110
- swipeAnimation.keyframes([
111
- { offset: 0, transform: `translateY(${toastPosition.bottom})` },
112
- { offset: 1, transform: 'translateY(100%)' },
113
- ]);
114
- swipeAnimation.progressStart(true, 0);
115
- break;
116
- }
117
- const computeStep = (delta) => {
118
- return (delta * INVERSION_FACTOR) / MAX_SWIPE_DISTANCE;
119
- };
120
- const onMove = (detail) => {
121
- const step = STEP_OFFSET + computeStep(detail.deltaY);
122
- swipeAnimation.progressStep(step);
123
- };
124
- const onEnd = (detail) => {
125
- const velocity = detail.velocityY;
126
- const threshold = ((detail.deltaY + velocity * 1000) / MAX_SWIPE_DISTANCE) * INVERSION_FACTOR;
127
- /**
128
- * Disable the gesture for the remainder of the animation.
129
- * It will be re-enabled if the toast animates back to
130
- * its initial presented position.
131
- */
132
- gesture.enable(false);
133
- let shouldDismiss = true;
134
- let playTo = 1;
135
- let step = 0;
136
- let remainingDistance = 0;
137
- if (el.position === 'middle') {
138
- /**
139
- * A middle positioned Toast appears
140
- * in the middle of the screen (at animation offset 0.5).
141
- * As a result, the threshold will be calculated relative
142
- * to this starting position. In other words at animation offset 0.5
143
- * the threshold will be 0. We want the middle Toast to be eligible
144
- * for dismiss when the user has swiped either half way up or down the
145
- * screen. As a result, we divide DISMISS_THRESHOLD in half. We also
146
- * consider when the threshold is a negative in the event the
147
- * user drags up (since the deltaY will also be negative).
148
- */
149
- shouldDismiss = threshold >= DISMISS_THRESHOLD / 2 || threshold <= -DISMISS_THRESHOLD / 2;
150
- /**
151
- * Since we are replacing the keyframes
152
- * below the animation always starts from
153
- * the beginning of the new keyframes.
154
- * Similarly, we are always playing to
155
- * the end of the new keyframes.
156
- */
157
- playTo = 1;
158
- step = 0;
159
- /**
160
- * The Toast should animate from wherever its
161
- * current position is to the desired end state.
162
- *
163
- * To begin, we get the current position of the
164
- * Toast for its starting state.
165
- */
166
- const wrapperElBox = wrapperEl.getBoundingClientRect();
167
- const startOffset = wrapperElBox.top - topPosition;
168
- const startPosition = `${startOffset}px`;
169
- /**
170
- * If the deltaY is negative then the user is swiping
171
- * up, so the Toast should animate to the top of the screen.
172
- * If the deltaY is positive then the user is swiping
173
- * down, so the Toast should animate to the bottom of the screen.
174
- * We also account for when the deltaY is 0, but realistically
175
- * that should never happen because it means the user did not drag
176
- * the toast.
177
- */
178
- const offsetFactor = detail.deltaY <= 0 ? -1 : 1;
179
- const endOffset = (topPosition + wrapperElBox.height) * offsetFactor;
180
- /**
181
- * If the Toast should dismiss
182
- * then we need to figure out which edge of
183
- * the screen it should animate towards.
184
- * By default, the Toast will come
185
- * back to its default state in the
186
- * middle of the screen.
187
- */
188
- const endPosition = shouldDismiss ? `${endOffset}px` : '0px';
189
- const KEYFRAMES = [
190
- { offset: 0, transform: `translateY(${startPosition})` },
191
- { offset: 1, transform: `translateY(${endPosition})` },
192
- ];
193
- swipeAnimation.keyframes(KEYFRAMES);
194
- /**
195
- * Compute the remaining amount of pixels the
196
- * toast needs to move to be fully dismissed.
197
- */
198
- remainingDistance = endOffset - startOffset;
199
- }
200
- else {
201
- shouldDismiss = threshold >= DISMISS_THRESHOLD;
202
- playTo = shouldDismiss ? 1 : 0;
203
- step = computeStep(detail.deltaY);
204
- /**
205
- * Compute the remaining amount of pixels the
206
- * toast needs to move to be fully dismissed.
207
- */
208
- const remainingStepAmount = shouldDismiss ? 1 - step : step;
209
- remainingDistance = remainingStepAmount * MAX_SWIPE_DISTANCE;
210
- }
211
- /**
212
- * The animation speed should depend on how quickly
213
- * the user flicks the toast across the screen. However,
214
- * it should be no slower than 200ms.
215
- * We use Math.abs on the remainingDistance because that value
216
- * can be negative when swiping up on a middle position toast.
217
- */
218
- const duration = Math.min(Math.abs(remainingDistance) / Math.abs(velocity), 200);
219
- swipeAnimation
220
- .onFinish(() => {
221
- if (shouldDismiss) {
222
- onDismiss();
223
- swipeAnimation.destroy();
224
- }
225
- else {
226
- if (el.position === 'middle') {
227
- /**
228
- * If the toast snapped back to
229
- * the middle of the screen we need
230
- * to reset the keyframes
231
- * so the toast can be swiped
232
- * up or down again.
233
- */
234
- swipeAnimation.keyframes(SWIPE_UP_DOWN_KEYFRAMES).progressStart(true, 0.5);
235
- }
236
- else {
237
- swipeAnimation.progressStart(true, 0);
238
- }
239
- /**
240
- * If the toast did not dismiss then
241
- * the user should be able to swipe again.
242
- */
243
- gesture.enable(true);
244
- }
245
- /**
246
- * This must be a one time callback
247
- * otherwise a new callback will
248
- * be added every time onEnd runs.
249
- */
250
- }, { oneTimeCallback: true })
251
- .progressEnd(playTo, step, duration);
252
- };
253
- const gesture = createGesture({
254
- el: wrapperEl,
255
- gestureName: 'toast-swipe-to-dismiss',
256
- gesturePriority: OVERLAY_GESTURE_PRIORITY,
257
- /**
258
- * Toast only supports vertical swipes.
259
- * This needs to be updated if we later
260
- * support horizontal swipes.
261
- */
262
- direction: 'y',
263
- onMove,
264
- onEnd,
265
- });
266
- return gesture;
267
- };