@tamagui/toast 2.0.0-rc.8 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/dist/cjs/Toast.cjs +149 -141
  2. package/dist/cjs/Toast.native.js +149 -142
  3. package/dist/cjs/Toast.native.js.map +1 -1
  4. package/dist/cjs/ToastAnnounce.cjs +78 -72
  5. package/dist/cjs/ToastAnnounce.native.js +85 -79
  6. package/dist/cjs/ToastAnnounce.native.js.map +1 -1
  7. package/dist/cjs/ToastComposable.cjs +780 -591
  8. package/dist/cjs/ToastComposable.native.js +863 -706
  9. package/dist/cjs/ToastComposable.native.js.map +1 -1
  10. package/dist/cjs/ToastImperative.cjs +99 -80
  11. package/dist/cjs/ToastImperative.native.js +104 -96
  12. package/dist/cjs/ToastImperative.native.js.map +1 -1
  13. package/dist/cjs/ToastImpl.cjs +300 -238
  14. package/dist/cjs/ToastImpl.native.js +309 -271
  15. package/dist/cjs/ToastImpl.native.js.map +1 -1
  16. package/dist/cjs/ToastItemFrame.cjs +143 -0
  17. package/dist/cjs/ToastItemFrame.native.js +148 -0
  18. package/dist/cjs/ToastItemFrame.native.js.map +1 -0
  19. package/dist/cjs/ToastPortal.cjs +23 -18
  20. package/dist/cjs/ToastPortal.native.js +27 -22
  21. package/dist/cjs/ToastPortal.native.js.map +1 -1
  22. package/dist/cjs/ToastProvider.cjs +102 -98
  23. package/dist/cjs/ToastProvider.native.js +108 -106
  24. package/dist/cjs/ToastProvider.native.js.map +1 -1
  25. package/dist/cjs/ToastState.cjs +218 -155
  26. package/dist/cjs/ToastState.native.js +270 -203
  27. package/dist/cjs/ToastState.native.js.map +1 -1
  28. package/dist/cjs/ToastViewport.cjs +274 -233
  29. package/dist/cjs/ToastViewport.native.js +301 -273
  30. package/dist/cjs/ToastViewport.native.js.map +1 -1
  31. package/dist/cjs/Toaster.cjs +71 -233
  32. package/dist/cjs/Toaster.native.js +72 -289
  33. package/dist/cjs/Toaster.native.js.map +1 -1
  34. package/dist/cjs/constants.cjs +14 -12
  35. package/dist/cjs/constants.native.js +14 -12
  36. package/dist/cjs/constants.native.js.map +1 -1
  37. package/dist/cjs/createNativeToast.cjs +43 -35
  38. package/dist/cjs/createNativeToast.native.js +42 -30
  39. package/dist/cjs/createNativeToast.native.js.map +1 -1
  40. package/dist/cjs/dispatchNativeToast.cjs +47 -0
  41. package/dist/cjs/dispatchNativeToast.native.js +52 -0
  42. package/dist/cjs/dispatchNativeToast.native.js.map +1 -0
  43. package/dist/cjs/index.cjs +7 -5
  44. package/dist/cjs/index.native.js +7 -5
  45. package/dist/cjs/index.native.js.map +1 -1
  46. package/dist/cjs/types.cjs +7 -5
  47. package/dist/cjs/types.native.js +7 -5
  48. package/dist/cjs/types.native.js.map +1 -1
  49. package/dist/cjs/useAnimatedDragGesture.cjs +184 -83
  50. package/dist/cjs/useAnimatedDragGesture.native.js +193 -79
  51. package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
  52. package/dist/cjs/useReducedMotion.cjs +44 -30
  53. package/dist/cjs/useReducedMotion.native.js +52 -43
  54. package/dist/cjs/useReducedMotion.native.js.map +1 -1
  55. package/dist/cjs/useToastAnimations.cjs +233 -155
  56. package/dist/cjs/useToastAnimations.native.js +246 -170
  57. package/dist/cjs/useToastAnimations.native.js.map +1 -1
  58. package/dist/cjs/v2.cjs +36 -0
  59. package/dist/cjs/v2.native.js +39 -0
  60. package/dist/cjs/v2.native.js.map +1 -0
  61. package/dist/esm/Toast.mjs +112 -106
  62. package/dist/esm/Toast.mjs.map +1 -1
  63. package/dist/esm/Toast.native.js +112 -107
  64. package/dist/esm/Toast.native.js.map +1 -1
  65. package/dist/esm/ToastAnnounce.mjs +46 -42
  66. package/dist/esm/ToastAnnounce.mjs.map +1 -1
  67. package/dist/esm/ToastAnnounce.native.js +52 -48
  68. package/dist/esm/ToastAnnounce.native.js.map +1 -1
  69. package/dist/esm/ToastComposable.mjs +742 -555
  70. package/dist/esm/ToastComposable.mjs.map +1 -1
  71. package/dist/esm/ToastComposable.native.js +825 -670
  72. package/dist/esm/ToastComposable.native.js.map +1 -1
  73. package/dist/esm/ToastImperative.mjs +71 -54
  74. package/dist/esm/ToastImperative.mjs.map +1 -1
  75. package/dist/esm/ToastImperative.native.js +76 -70
  76. package/dist/esm/ToastImperative.native.js.map +1 -1
  77. package/dist/esm/ToastImpl.mjs +261 -201
  78. package/dist/esm/ToastImpl.mjs.map +1 -1
  79. package/dist/esm/ToastImpl.native.js +270 -234
  80. package/dist/esm/ToastImpl.native.js.map +1 -1
  81. package/dist/esm/ToastItemFrame.mjs +114 -0
  82. package/dist/esm/ToastItemFrame.mjs.map +1 -0
  83. package/dist/esm/ToastItemFrame.native.js +116 -0
  84. package/dist/esm/ToastItemFrame.native.js.map +1 -0
  85. package/dist/esm/ToastPortal.mjs +8 -5
  86. package/dist/esm/ToastPortal.mjs.map +1 -1
  87. package/dist/esm/ToastPortal.native.js +12 -9
  88. package/dist/esm/ToastPortal.native.js.map +1 -1
  89. package/dist/esm/ToastProvider.mjs +71 -69
  90. package/dist/esm/ToastProvider.mjs.map +1 -1
  91. package/dist/esm/ToastProvider.native.js +77 -77
  92. package/dist/esm/ToastProvider.native.js.map +1 -1
  93. package/dist/esm/ToastState.mjs +205 -144
  94. package/dist/esm/ToastState.mjs.map +1 -1
  95. package/dist/esm/ToastState.native.js +258 -193
  96. package/dist/esm/ToastState.native.js.map +1 -1
  97. package/dist/esm/ToastViewport.mjs +238 -199
  98. package/dist/esm/ToastViewport.mjs.map +1 -1
  99. package/dist/esm/ToastViewport.native.js +265 -239
  100. package/dist/esm/ToastViewport.native.js.map +1 -1
  101. package/dist/esm/Toaster.mjs +45 -209
  102. package/dist/esm/Toaster.mjs.map +1 -1
  103. package/dist/esm/Toaster.native.js +46 -265
  104. package/dist/esm/Toaster.native.js.map +1 -1
  105. package/dist/esm/constants.mjs +2 -2
  106. package/dist/esm/constants.mjs.map +1 -1
  107. package/dist/esm/constants.native.js +2 -2
  108. package/dist/esm/constants.native.js.map +1 -1
  109. package/dist/esm/createNativeToast.mjs +29 -24
  110. package/dist/esm/createNativeToast.mjs.map +1 -1
  111. package/dist/esm/createNativeToast.native.js +27 -18
  112. package/dist/esm/createNativeToast.native.js.map +1 -1
  113. package/dist/esm/dispatchNativeToast.mjs +22 -0
  114. package/dist/esm/dispatchNativeToast.mjs.map +1 -0
  115. package/dist/esm/dispatchNativeToast.native.js +24 -0
  116. package/dist/esm/dispatchNativeToast.native.js.map +1 -0
  117. package/dist/esm/index.js +1 -1
  118. package/dist/esm/index.js.map +1 -6
  119. package/dist/esm/useAnimatedDragGesture.mjs +160 -61
  120. package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
  121. package/dist/esm/useAnimatedDragGesture.native.js +167 -55
  122. package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
  123. package/dist/esm/useReducedMotion.mjs +18 -6
  124. package/dist/esm/useReducedMotion.mjs.map +1 -1
  125. package/dist/esm/useReducedMotion.native.js +25 -18
  126. package/dist/esm/useReducedMotion.native.js.map +1 -1
  127. package/dist/esm/useToastAnimations.mjs +206 -130
  128. package/dist/esm/useToastAnimations.mjs.map +1 -1
  129. package/dist/esm/useToastAnimations.native.js +218 -144
  130. package/dist/esm/useToastAnimations.native.js.map +1 -1
  131. package/dist/esm/v2.mjs +6 -0
  132. package/dist/esm/v2.mjs.map +1 -0
  133. package/dist/esm/v2.native.js +6 -0
  134. package/dist/esm/v2.native.js.map +1 -0
  135. package/dist/jsx/Toast.mjs +112 -106
  136. package/dist/jsx/Toast.mjs.map +1 -1
  137. package/dist/jsx/Toast.native.js +149 -142
  138. package/dist/jsx/Toast.native.js.map +1 -1
  139. package/dist/jsx/ToastAnnounce.mjs +46 -42
  140. package/dist/jsx/ToastAnnounce.mjs.map +1 -1
  141. package/dist/jsx/ToastAnnounce.native.js +85 -79
  142. package/dist/jsx/ToastAnnounce.native.js.map +1 -1
  143. package/dist/jsx/ToastComposable.mjs +742 -555
  144. package/dist/jsx/ToastComposable.mjs.map +1 -1
  145. package/dist/jsx/ToastComposable.native.js +863 -706
  146. package/dist/jsx/ToastComposable.native.js.map +1 -1
  147. package/dist/jsx/ToastImperative.mjs +71 -54
  148. package/dist/jsx/ToastImperative.mjs.map +1 -1
  149. package/dist/jsx/ToastImperative.native.js +104 -96
  150. package/dist/jsx/ToastImperative.native.js.map +1 -1
  151. package/dist/jsx/ToastImpl.mjs +261 -201
  152. package/dist/jsx/ToastImpl.mjs.map +1 -1
  153. package/dist/jsx/ToastImpl.native.js +309 -271
  154. package/dist/jsx/ToastImpl.native.js.map +1 -1
  155. package/dist/jsx/ToastItemFrame.mjs +114 -0
  156. package/dist/jsx/ToastItemFrame.mjs.map +1 -0
  157. package/dist/jsx/ToastItemFrame.native.js +148 -0
  158. package/dist/jsx/ToastItemFrame.native.js.map +1 -0
  159. package/dist/jsx/ToastPortal.mjs +8 -5
  160. package/dist/jsx/ToastPortal.mjs.map +1 -1
  161. package/dist/jsx/ToastPortal.native.js +27 -22
  162. package/dist/jsx/ToastPortal.native.js.map +1 -1
  163. package/dist/jsx/ToastProvider.mjs +71 -69
  164. package/dist/jsx/ToastProvider.mjs.map +1 -1
  165. package/dist/jsx/ToastProvider.native.js +108 -106
  166. package/dist/jsx/ToastProvider.native.js.map +1 -1
  167. package/dist/jsx/ToastState.mjs +205 -144
  168. package/dist/jsx/ToastState.mjs.map +1 -1
  169. package/dist/jsx/ToastState.native.js +270 -203
  170. package/dist/jsx/ToastState.native.js.map +1 -1
  171. package/dist/jsx/ToastViewport.mjs +238 -199
  172. package/dist/jsx/ToastViewport.mjs.map +1 -1
  173. package/dist/jsx/ToastViewport.native.js +301 -273
  174. package/dist/jsx/ToastViewport.native.js.map +1 -1
  175. package/dist/jsx/Toaster.mjs +45 -209
  176. package/dist/jsx/Toaster.mjs.map +1 -1
  177. package/dist/jsx/Toaster.native.js +72 -289
  178. package/dist/jsx/Toaster.native.js.map +1 -1
  179. package/dist/jsx/constants.mjs +2 -2
  180. package/dist/jsx/constants.mjs.map +1 -1
  181. package/dist/jsx/constants.native.js +14 -12
  182. package/dist/jsx/constants.native.js.map +1 -1
  183. package/dist/jsx/createNativeToast.mjs +29 -24
  184. package/dist/jsx/createNativeToast.mjs.map +1 -1
  185. package/dist/jsx/createNativeToast.native.js +42 -30
  186. package/dist/jsx/createNativeToast.native.js.map +1 -1
  187. package/dist/jsx/dispatchNativeToast.mjs +22 -0
  188. package/dist/jsx/dispatchNativeToast.mjs.map +1 -0
  189. package/dist/jsx/dispatchNativeToast.native.js +52 -0
  190. package/dist/jsx/dispatchNativeToast.native.js.map +1 -0
  191. package/dist/jsx/index.js +1 -1
  192. package/dist/jsx/index.js.map +1 -6
  193. package/dist/jsx/index.native.js +7 -5
  194. package/dist/jsx/types.native.js +7 -5
  195. package/dist/jsx/useAnimatedDragGesture.mjs +160 -61
  196. package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
  197. package/dist/jsx/useAnimatedDragGesture.native.js +193 -79
  198. package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
  199. package/dist/jsx/useReducedMotion.mjs +18 -6
  200. package/dist/jsx/useReducedMotion.mjs.map +1 -1
  201. package/dist/jsx/useReducedMotion.native.js +52 -43
  202. package/dist/jsx/useReducedMotion.native.js.map +1 -1
  203. package/dist/jsx/useToastAnimations.mjs +206 -130
  204. package/dist/jsx/useToastAnimations.mjs.map +1 -1
  205. package/dist/jsx/useToastAnimations.native.js +246 -170
  206. package/dist/jsx/useToastAnimations.native.js.map +1 -1
  207. package/dist/jsx/v2.mjs +6 -0
  208. package/dist/jsx/v2.mjs.map +1 -0
  209. package/dist/jsx/v2.native.js +39 -0
  210. package/dist/jsx/v2.native.js.map +1 -0
  211. package/package.json +42 -29
  212. package/src/ToastComposable.tsx +1380 -0
  213. package/src/ToastImpl.tsx +14 -2
  214. package/src/ToastItemFrame.tsx +136 -0
  215. package/src/ToastPortal.tsx +2 -2
  216. package/src/ToastProvider.tsx +8 -1
  217. package/src/ToastState.ts +398 -0
  218. package/src/ToastViewport.tsx +4 -3
  219. package/src/Toaster.tsx +181 -0
  220. package/src/createNativeToast.native.tsx +4 -0
  221. package/src/createNativeToast.tsx +18 -24
  222. package/src/dispatchNativeToast.ts +43 -0
  223. package/src/useAnimatedDragGesture.native.ts +255 -0
  224. package/src/useAnimatedDragGesture.ts +319 -0
  225. package/src/useReducedMotion.ts +59 -0
  226. package/src/useToastAnimations.ts +372 -0
  227. package/src/v2.ts +31 -0
  228. package/types/ToastComposable.d.ts +199 -0
  229. package/types/ToastComposable.d.ts.map +1 -1
  230. package/types/ToastImpl.d.ts.map +1 -1
  231. package/types/ToastItemFrame.d.ts +25 -0
  232. package/types/ToastItemFrame.d.ts.map +1 -0
  233. package/types/ToastPortal.d.ts.map +1 -1
  234. package/types/ToastProvider.d.ts +1 -1
  235. package/types/ToastProvider.d.ts.map +1 -1
  236. package/types/ToastState.d.ts +179 -0
  237. package/types/ToastState.d.ts.map +1 -1
  238. package/types/ToastViewport.d.ts.map +1 -1
  239. package/types/Toaster.d.ts +112 -0
  240. package/types/Toaster.d.ts.map +1 -1
  241. package/types/createNativeToast.d.ts +5 -0
  242. package/types/createNativeToast.d.ts.map +1 -1
  243. package/types/createNativeToast.native.d.ts +1 -0
  244. package/types/createNativeToast.native.d.ts.map +1 -1
  245. package/types/dispatchNativeToast.d.ts +12 -0
  246. package/types/dispatchNativeToast.d.ts.map +1 -0
  247. package/types/useAnimatedDragGesture.d.ts +33 -0
  248. package/types/useAnimatedDragGesture.d.ts.map +1 -1
  249. package/types/useAnimatedDragGesture.native.d.ts +33 -0
  250. package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
  251. package/types/useReducedMotion.d.ts +6 -0
  252. package/types/useToastAnimations.d.ts +50 -0
  253. package/types/useToastAnimations.d.ts.map +1 -1
  254. package/types/v2.d.ts +10 -0
  255. package/types/v2.d.ts.map +1 -0
  256. package/v2/index.cjs +2 -0
  257. package/v2/index.js +2 -0
  258. package/v2/index.native.cjs +2 -0
  259. package/v2/index.native.js +2 -0
  260. package/LICENSE +0 -21
  261. package/dist/cjs/Toast.js +0 -119
  262. package/dist/cjs/Toast.js.map +0 -6
  263. package/dist/cjs/ToastAnnounce.js +0 -72
  264. package/dist/cjs/ToastAnnounce.js.map +0 -6
  265. package/dist/cjs/ToastComposable.js +0 -548
  266. package/dist/cjs/ToastComposable.js.map +0 -6
  267. package/dist/cjs/ToastImperative.js +0 -71
  268. package/dist/cjs/ToastImperative.js.map +0 -6
  269. package/dist/cjs/ToastImpl.js +0 -227
  270. package/dist/cjs/ToastImpl.js.map +0 -6
  271. package/dist/cjs/ToastItem.cjs +0 -526
  272. package/dist/cjs/ToastItem.js +0 -409
  273. package/dist/cjs/ToastItem.js.map +0 -6
  274. package/dist/cjs/ToastItem.native.js +0 -614
  275. package/dist/cjs/ToastItem.native.js.map +0 -1
  276. package/dist/cjs/ToastPortal.js +0 -26
  277. package/dist/cjs/ToastPortal.js.map +0 -6
  278. package/dist/cjs/ToastProvider.js +0 -105
  279. package/dist/cjs/ToastProvider.js.map +0 -6
  280. package/dist/cjs/ToastState.js +0 -160
  281. package/dist/cjs/ToastState.js.map +0 -6
  282. package/dist/cjs/ToastViewport.js +0 -263
  283. package/dist/cjs/ToastViewport.js.map +0 -6
  284. package/dist/cjs/Toaster.js +0 -204
  285. package/dist/cjs/Toaster.js.map +0 -6
  286. package/dist/cjs/constants.js +0 -22
  287. package/dist/cjs/constants.js.map +0 -6
  288. package/dist/cjs/createNativeToast.js +0 -44
  289. package/dist/cjs/createNativeToast.js.map +0 -6
  290. package/dist/cjs/index.js +0 -15
  291. package/dist/cjs/index.js.map +0 -6
  292. package/dist/cjs/types.js +0 -14
  293. package/dist/cjs/types.js.map +0 -6
  294. package/dist/cjs/useAnimatedDragGesture.js +0 -97
  295. package/dist/cjs/useAnimatedDragGesture.js.map +0 -6
  296. package/dist/cjs/useDragGesture.cjs +0 -129
  297. package/dist/cjs/useDragGesture.js +0 -100
  298. package/dist/cjs/useDragGesture.js.map +0 -6
  299. package/dist/cjs/useDragGesture.native.js +0 -146
  300. package/dist/cjs/useDragGesture.native.js.map +0 -1
  301. package/dist/cjs/useReducedMotion.js +0 -53
  302. package/dist/cjs/useReducedMotion.js.map +0 -6
  303. package/dist/cjs/useToastAnimations.js +0 -144
  304. package/dist/cjs/useToastAnimations.js.map +0 -6
  305. package/dist/cjs/v1.cjs +0 -31
  306. package/dist/cjs/v1.js +0 -26
  307. package/dist/cjs/v1.js.map +0 -6
  308. package/dist/cjs/v1.native.js +0 -34
  309. package/dist/cjs/v1.native.js.map +0 -1
  310. package/dist/esm/Toast.js +0 -107
  311. package/dist/esm/Toast.js.map +0 -6
  312. package/dist/esm/ToastAnnounce.js +0 -55
  313. package/dist/esm/ToastAnnounce.js.map +0 -6
  314. package/dist/esm/ToastComposable.js +0 -543
  315. package/dist/esm/ToastComposable.js.map +0 -6
  316. package/dist/esm/ToastImperative.js +0 -50
  317. package/dist/esm/ToastImperative.js.map +0 -6
  318. package/dist/esm/ToastImpl.js +0 -225
  319. package/dist/esm/ToastImpl.js.map +0 -6
  320. package/dist/esm/ToastItem.js +0 -393
  321. package/dist/esm/ToastItem.js.map +0 -6
  322. package/dist/esm/ToastItem.mjs +0 -492
  323. package/dist/esm/ToastItem.mjs.map +0 -1
  324. package/dist/esm/ToastItem.native.js +0 -577
  325. package/dist/esm/ToastItem.native.js.map +0 -1
  326. package/dist/esm/ToastPortal.js +0 -13
  327. package/dist/esm/ToastPortal.js.map +0 -6
  328. package/dist/esm/ToastProvider.js +0 -87
  329. package/dist/esm/ToastProvider.js.map +0 -6
  330. package/dist/esm/ToastState.js +0 -144
  331. package/dist/esm/ToastState.js.map +0 -6
  332. package/dist/esm/ToastViewport.js +0 -250
  333. package/dist/esm/ToastViewport.js.map +0 -6
  334. package/dist/esm/Toaster.js +0 -188
  335. package/dist/esm/Toaster.js.map +0 -6
  336. package/dist/esm/constants.js +0 -6
  337. package/dist/esm/constants.js.map +0 -6
  338. package/dist/esm/createNativeToast.js +0 -28
  339. package/dist/esm/createNativeToast.js.map +0 -6
  340. package/dist/esm/types.js +0 -1
  341. package/dist/esm/types.js.map +0 -6
  342. package/dist/esm/useAnimatedDragGesture.js +0 -73
  343. package/dist/esm/useAnimatedDragGesture.js.map +0 -6
  344. package/dist/esm/useDragGesture.js +0 -76
  345. package/dist/esm/useDragGesture.js.map +0 -6
  346. package/dist/esm/useDragGesture.mjs +0 -95
  347. package/dist/esm/useDragGesture.mjs.map +0 -1
  348. package/dist/esm/useDragGesture.native.js +0 -109
  349. package/dist/esm/useDragGesture.native.js.map +0 -1
  350. package/dist/esm/useReducedMotion.js +0 -30
  351. package/dist/esm/useReducedMotion.js.map +0 -6
  352. package/dist/esm/useToastAnimations.js +0 -122
  353. package/dist/esm/useToastAnimations.js.map +0 -6
  354. package/dist/esm/v1.js +0 -17
  355. package/dist/esm/v1.js.map +0 -6
  356. package/dist/esm/v1.mjs +0 -3
  357. package/dist/esm/v1.mjs.map +0 -1
  358. package/dist/esm/v1.native.js +0 -3
  359. package/dist/esm/v1.native.js.map +0 -1
  360. package/dist/jsx/Toast.js +0 -107
  361. package/dist/jsx/Toast.js.map +0 -6
  362. package/dist/jsx/ToastAnnounce.js +0 -55
  363. package/dist/jsx/ToastAnnounce.js.map +0 -6
  364. package/dist/jsx/ToastComposable.js +0 -543
  365. package/dist/jsx/ToastComposable.js.map +0 -6
  366. package/dist/jsx/ToastImperative.js +0 -50
  367. package/dist/jsx/ToastImperative.js.map +0 -6
  368. package/dist/jsx/ToastImpl.js +0 -225
  369. package/dist/jsx/ToastImpl.js.map +0 -6
  370. package/dist/jsx/ToastItem.js +0 -393
  371. package/dist/jsx/ToastItem.js.map +0 -6
  372. package/dist/jsx/ToastItem.mjs +0 -492
  373. package/dist/jsx/ToastItem.mjs.map +0 -1
  374. package/dist/jsx/ToastItem.native.js +0 -614
  375. package/dist/jsx/ToastItem.native.js.map +0 -1
  376. package/dist/jsx/ToastPortal.js +0 -13
  377. package/dist/jsx/ToastPortal.js.map +0 -6
  378. package/dist/jsx/ToastProvider.js +0 -87
  379. package/dist/jsx/ToastProvider.js.map +0 -6
  380. package/dist/jsx/ToastState.js +0 -144
  381. package/dist/jsx/ToastState.js.map +0 -6
  382. package/dist/jsx/ToastViewport.js +0 -250
  383. package/dist/jsx/ToastViewport.js.map +0 -6
  384. package/dist/jsx/Toaster.js +0 -188
  385. package/dist/jsx/Toaster.js.map +0 -6
  386. package/dist/jsx/constants.js +0 -6
  387. package/dist/jsx/constants.js.map +0 -6
  388. package/dist/jsx/createNativeToast.js +0 -28
  389. package/dist/jsx/createNativeToast.js.map +0 -6
  390. package/dist/jsx/types.js +0 -1
  391. package/dist/jsx/types.js.map +0 -6
  392. package/dist/jsx/useAnimatedDragGesture.js +0 -73
  393. package/dist/jsx/useAnimatedDragGesture.js.map +0 -6
  394. package/dist/jsx/useDragGesture.js +0 -76
  395. package/dist/jsx/useDragGesture.js.map +0 -6
  396. package/dist/jsx/useDragGesture.mjs +0 -95
  397. package/dist/jsx/useDragGesture.mjs.map +0 -1
  398. package/dist/jsx/useDragGesture.native.js +0 -146
  399. package/dist/jsx/useDragGesture.native.js.map +0 -1
  400. package/dist/jsx/useReducedMotion.js +0 -30
  401. package/dist/jsx/useReducedMotion.js.map +0 -6
  402. package/dist/jsx/useToastAnimations.js +0 -122
  403. package/dist/jsx/useToastAnimations.js.map +0 -6
  404. package/dist/jsx/v1.js +0 -17
  405. package/dist/jsx/v1.js.map +0 -6
  406. package/dist/jsx/v1.mjs +0 -3
  407. package/dist/jsx/v1.mjs.map +0 -1
  408. package/dist/jsx/v1.native.js +0 -34
  409. package/dist/jsx/v1.native.js.map +0 -1
  410. package/types/ToastItem.d.ts.map +0 -1
  411. package/types/useDragGesture.d.ts.map +0 -1
  412. package/types/useDragGesture.native.d.ts.map +0 -1
  413. package/types/v1.d.ts.map +0 -1
@@ -4,33 +4,35 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var ToastImpl_exports = {};
35
37
  __export(ToastImpl_exports, {
36
38
  ToastImpl: () => ToastImpl,
@@ -38,237 +40,266 @@ __export(ToastImpl_exports, {
38
40
  useToastInteractiveContext: () => useToastInteractiveContext
39
41
  });
40
42
  module.exports = __toCommonJS(ToastImpl_exports);
41
- var import_jsx_runtime = require("react/jsx-runtime"),
42
- import_animate_presence = require("@tamagui/animate-presence"),
43
- import_compose_refs = require("@tamagui/compose-refs"),
44
- import_constants = require("@tamagui/constants"),
45
- import_core = require("@tamagui/core"),
46
- import_dismissable = require("@tamagui/dismissable"),
47
- import_helpers = require("@tamagui/helpers"),
48
- import_portal = require("@tamagui/portal"),
49
- import_stacks = require("@tamagui/stacks"),
50
- React = __toESM(require("react"), 1),
51
- import_react_native = require("react-native"),
52
- import_constants2 = require("./constants.native.js"),
53
- import_ToastAnnounce = require("./ToastAnnounce.native.js"),
54
- import_ToastProvider = require("./ToastProvider.native.js"),
55
- import_ToastViewport = require("./ToastViewport.native.js"),
56
- ToastImplFrame = (0, import_core.styled)(import_stacks.YStack, {
57
- name: "ToastImpl",
58
- tabIndex: 0,
59
- variants: {
60
- unstyled: {
61
- false: {
62
- focusStyle: {
63
- outlineStyle: "solid",
64
- outlineWidth: 2,
65
- outlineColor: "$outlineColor"
66
- },
67
- backgroundColor: "$color6",
68
- borderRadius: "$4",
69
- paddingHorizontal: "$4",
70
- paddingVertical: "$3",
71
- marginHorizontal: "auto",
72
- marginVertical: "$1",
73
- elevation: "$3"
74
- }
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var import_animate_presence = require("@tamagui/animate-presence");
45
+ var import_compose_refs = require("@tamagui/compose-refs");
46
+ var import_constants = require("@tamagui/constants");
47
+ var import_core = require("@tamagui/core");
48
+ var import_dismissable = require("@tamagui/dismissable");
49
+ var import_helpers = require("@tamagui/helpers");
50
+ var import_portal = require("@tamagui/portal");
51
+ var import_stacks = require("@tamagui/stacks");
52
+ var React = __toESM(require("react"), 1);
53
+ var import_constants2 = require("./constants.native.js");
54
+ var import_ToastAnnounce = require("./ToastAnnounce.native.js");
55
+ var import_ToastProvider = require("./ToastProvider.native.js");
56
+ var import_ToastViewport = require("./ToastViewport.native.js");
57
+ var getPanResponder = function () {
58
+ return require("react-native").PanResponder;
59
+ };
60
+ var ToastImplFrame = (0, import_core.styled)(import_stacks.YStack, {
61
+ name: "ToastImpl",
62
+ tabIndex: 0,
63
+ variants: {
64
+ unstyled: {
65
+ false: {
66
+ focusStyle: {
67
+ outlineStyle: "solid",
68
+ outlineWidth: 2,
69
+ outlineColor: "$outlineColor"
70
+ },
71
+ backgroundColor: "$color6",
72
+ borderRadius: "$4",
73
+ paddingHorizontal: "$4",
74
+ paddingVertical: "$3",
75
+ marginHorizontal: "auto",
76
+ marginVertical: "$1",
77
+ elevation: "$3"
75
78
  }
76
- },
77
- defaultVariants: {
78
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
79
79
  }
80
- }),
81
- {
82
- Provider: ToastInteractiveProvider,
83
- useStyledContext: useToastInteractiveContext
84
- } = (0, import_core.createStyledContext)({
85
- onClose() {}
86
- }),
87
- ToastImpl = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
88
- var {
89
- scope,
90
- type = "foreground",
91
- duration: durationProp,
92
- open,
93
- onClose,
94
- onEscapeKeyDown,
95
- onPause,
96
- onResume,
97
- onSwipeStart,
98
- onSwipeMove,
99
- onSwipeCancel,
100
- onSwipeEnd,
101
- viewportName = "default",
102
- ...toastProps
103
- } = props,
104
- isPresent = (0, import_animate_presence.useIsPresent)(),
105
- context = (0, import_ToastProvider.useToastProviderContext)(scope),
106
- [node, setNode] = React.useState(null),
107
- composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, setNode),
108
- duration = durationProp || context.duration,
109
- closeTimerStartTimeRef = React.useRef(0),
110
- closeTimerRemainingTimeRef = React.useRef(duration),
111
- closeTimerRef = React.useRef(0),
112
- {
113
- onToastAdd,
114
- onToastRemove
115
- } = context,
116
- viewport = React.useMemo(function () {
117
- return context.viewports[viewportName];
118
- }, [context.viewports, viewportName]),
119
- handleClose = (0, import_core.useEvent)(function () {
120
- if (isPresent) {
121
- if (import_constants.isWeb) {
122
- var isFocusInToast = node?.contains(document.activeElement);
123
- isFocusInToast && viewport?.focus();
124
- }
125
- onClose();
126
- }
127
- }),
128
- startTimer = React.useCallback(function (duration2) {
129
- !duration2 || duration2 === Number.POSITIVE_INFINITY || (clearTimeout(closeTimerRef.current), closeTimerStartTimeRef.current = (/* @__PURE__ */new Date()).getTime(), closeTimerRef.current = setTimeout(handleClose, duration2));
130
- }, [handleClose]),
131
- handleResume = React.useCallback(function () {
132
- startTimer(closeTimerRemainingTimeRef.current), onResume?.();
133
- }, [onResume, startTimer]),
134
- handlePause = React.useCallback(function () {
135
- var elapsedTime = (/* @__PURE__ */new Date()).getTime() - closeTimerStartTimeRef.current;
136
- closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime, window.clearTimeout(closeTimerRef.current), onPause?.();
137
- }, [onPause]);
138
- React.useEffect(function () {
139
- if (import_constants.isWeb && viewport) return viewport.addEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.addEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume), function () {
140
- viewport.removeEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.removeEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
141
- };
142
- }, [viewport, duration, onPause, onResume, startTimer]), React.useEffect(function () {
143
- open && !context.isClosePausedRef.current && startTimer(duration);
144
- }, [open, duration, context.isClosePausedRef, startTimer]), React.useEffect(function () {
145
- return onToastAdd(), function () {
146
- return onToastRemove();
80
+ },
81
+ defaultVariants: {
82
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
83
+ }
84
+ });
85
+ var {
86
+ Provider: ToastInteractiveProvider,
87
+ useStyledContext: useToastInteractiveContext
88
+ } = (0, import_core.createStyledContext)({
89
+ onClose() {}
90
+ });
91
+ var ToastImpl = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
92
+ var {
93
+ scope,
94
+ type = "foreground",
95
+ duration: durationProp,
96
+ open,
97
+ onClose,
98
+ onEscapeKeyDown,
99
+ onPause,
100
+ onResume,
101
+ onSwipeStart,
102
+ onSwipeMove,
103
+ onSwipeCancel,
104
+ onSwipeEnd,
105
+ viewportName = "default",
106
+ ...toastProps
107
+ } = props;
108
+ var isPresent = (0, import_animate_presence.useIsPresent)();
109
+ var context = (0, import_ToastProvider.useToastProviderContext)(scope);
110
+ var [node, setNode] = React.useState(null);
111
+ var composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, setNode);
112
+ var duration = durationProp || context.duration;
113
+ var closeTimerStartTimeRef = React.useRef(0);
114
+ var closeTimerRemainingTimeRef = React.useRef(duration);
115
+ var closeTimerRef = React.useRef(0);
116
+ var {
117
+ onToastAdd,
118
+ onToastRemove
119
+ } = context;
120
+ var viewport = React.useMemo(function () {
121
+ return context.viewports[viewportName];
122
+ }, [context.viewports, viewportName]);
123
+ var handleClose = (0, import_core.useEvent)(function () {
124
+ if (!isPresent) return;
125
+ if (import_constants.isWeb) {
126
+ if (node === null || node === void 0 ? void 0 : node.contains(document.activeElement)) viewport === null || viewport === void 0 || viewport.focus();
127
+ }
128
+ onClose();
129
+ });
130
+ var startTimer = React.useCallback(function (duration2) {
131
+ if (!duration2 || duration2 === Number.POSITIVE_INFINITY) return;
132
+ clearTimeout(closeTimerRef.current);
133
+ closeTimerStartTimeRef.current = (/* @__PURE__ */new Date()).getTime();
134
+ closeTimerRef.current = setTimeout(handleClose, duration2);
135
+ }, [handleClose]);
136
+ var handleResume = React.useCallback(function () {
137
+ startTimer(closeTimerRemainingTimeRef.current);
138
+ onResume === null || onResume === void 0 || onResume();
139
+ }, [onResume, startTimer]);
140
+ var handlePause = React.useCallback(function () {
141
+ var elapsedTime = (/* @__PURE__ */new Date()).getTime() - closeTimerStartTimeRef.current;
142
+ closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;
143
+ window.clearTimeout(closeTimerRef.current);
144
+ onPause === null || onPause === void 0 || onPause();
145
+ }, [onPause]);
146
+ React.useEffect(function () {
147
+ if (!import_constants.isWeb) return;
148
+ if (viewport) {
149
+ viewport.addEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause);
150
+ viewport.addEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
151
+ return function () {
152
+ viewport.removeEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause);
153
+ viewport.removeEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
147
154
  };
148
- }, [onToastAdd, onToastRemove]);
149
- var announceTextContent = React.useMemo(function () {
150
- return import_constants.isWeb && node ? getAnnounceTextContent(node) : null;
151
- }, [node]),
152
- isHorizontalSwipe = ["left", "right", "horizontal"].includes(context.swipeDirection),
153
- {
154
- animationDriver
155
- } = (0, import_core.useConfiguration)();
156
- if (!animationDriver) throw new Error("Must set animations in tamagui.config.ts");
157
- var {
158
- useAnimatedNumber,
159
- useAnimatedNumberStyle
160
- } = animationDriver,
161
- animatedNumber = useAnimatedNumber(0),
162
- _animationDriver_NumberView,
163
- _ref,
164
- AnimatedView = (_ref = (_animationDriver_NumberView = animationDriver.NumberView) !== null && _animationDriver_NumberView !== void 0 ? _animationDriver_NumberView : animationDriver.View) !== null && _ref !== void 0 ? _ref : import_core.View,
165
- animatedStyles = useAnimatedNumberStyle(animatedNumber, function (val) {
166
- "worklet";
155
+ }
156
+ }, [viewport, duration, onPause, onResume, startTimer]);
157
+ React.useEffect(function () {
158
+ if (open && !context.isClosePausedRef.current) startTimer(duration);
159
+ }, [open, duration, context.isClosePausedRef, startTimer]);
160
+ React.useEffect(function () {
161
+ onToastAdd();
162
+ return function () {
163
+ return onToastRemove();
164
+ };
165
+ }, [onToastAdd, onToastRemove]);
166
+ var announceTextContent = React.useMemo(function () {
167
+ if (!import_constants.isWeb) return null;
168
+ return node ? getAnnounceTextContent(node) : null;
169
+ }, [node]);
170
+ var isHorizontalSwipe = ["left", "right", "horizontal"].includes(context.swipeDirection);
171
+ var {
172
+ animationDriver
173
+ } = (0, import_core.useConfiguration)();
174
+ if (!animationDriver) throw new Error("Must set animations in tamagui.config.ts");
175
+ var {
176
+ useAnimatedNumber,
177
+ useAnimatedNumberStyle
178
+ } = animationDriver;
179
+ var animatedNumber = useAnimatedNumber(0);
180
+ var _animationDriver_NumberView, _ref;
181
+ var AnimatedView = (_ref = (_animationDriver_NumberView = animationDriver["NumberView"]) !== null && _animationDriver_NumberView !== void 0 ? _animationDriver_NumberView : animationDriver.View) !== null && _ref !== void 0 ? _ref : import_core.View;
182
+ var animatedStyles = useAnimatedNumberStyle(animatedNumber, function (val) {
183
+ "worklet";
167
184
 
168
- return {
169
- transform: [isHorizontalSwipe ? {
170
- translateX: val
171
- } : {
172
- translateY: val
173
- }]
185
+ return {
186
+ transform: [isHorizontalSwipe ? {
187
+ translateX: val
188
+ } : {
189
+ translateY: val
190
+ }]
191
+ };
192
+ });
193
+ var panResponder = React.useMemo(function () {
194
+ var PanResponder = getPanResponder();
195
+ if (!PanResponder) return null;
196
+ return PanResponder.create({
197
+ onMoveShouldSetPanResponder: function (e, gesture) {
198
+ if (shouldGrantGestureMove(context.swipeDirection, gesture)) {
199
+ onSwipeStart === null || onSwipeStart === void 0 || onSwipeStart(e);
200
+ return true;
201
+ }
202
+ return false;
203
+ },
204
+ onPanResponderGrant: function (e) {
205
+ if (!import_constants.isWeb) handlePause === null || handlePause === void 0 || handlePause();
206
+ },
207
+ onPanResponderMove: function (e, gesture) {
208
+ var {
209
+ x,
210
+ y
211
+ } = getGestureDistance(context.swipeDirection, gesture);
212
+ var delta = {
213
+ x,
214
+ y
174
215
  };
175
- }),
176
- panResponder = React.useMemo(function () {
177
- return import_react_native.PanResponder.create({
178
- onMoveShouldSetPanResponder: function (e, gesture) {
179
- var shouldMove = shouldGrantGestureMove(context.swipeDirection, gesture);
180
- return shouldMove ? (onSwipeStart?.(e), !0) : !1;
181
- },
182
- onPanResponderGrant: function (e) {
183
- import_constants.isWeb || handlePause?.();
184
- },
185
- onPanResponderMove: function (e, gesture) {
186
- var {
187
- x,
188
- y
189
- } = getGestureDistance(context.swipeDirection, gesture),
190
- delta = {
191
- x,
192
- y
193
- };
194
- animatedNumber.setValue(isHorizontalSwipe ? x : y, {
195
- type: "direct"
196
- }), isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold) && onSwipeEnd?.(e), onSwipeMove?.(e);
197
- },
198
- onPanResponderEnd: function (e, param) {
199
- var {
200
- dx,
201
- dy
202
- } = param;
203
- isDeltaInDirection({
204
- x: dx,
205
- y: dy
206
- }, context.swipeDirection, context.swipeThreshold) || (import_constants.isWeb || handleResume?.(), onSwipeCancel?.(e), animatedNumber.setValue(0, {
207
- type: "spring"
208
- }));
209
- }
216
+ animatedNumber.setValue(isHorizontalSwipe ? x : y, {
217
+ type: "direct"
210
218
  });
211
- }, [handlePause, handleResume]),
212
- themeName = (0, import_core.useThemeName)();
213
- return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
214
- children: [announceTextContent && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounce, {
219
+ if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) onSwipeEnd === null || onSwipeEnd === void 0 || onSwipeEnd(e);
220
+ onSwipeMove === null || onSwipeMove === void 0 || onSwipeMove(e);
221
+ },
222
+ onPanResponderEnd: function (e, param) {
223
+ var {
224
+ dx,
225
+ dy
226
+ } = param;
227
+ if (!isDeltaInDirection({
228
+ x: dx,
229
+ y: dy
230
+ }, context.swipeDirection, context.swipeThreshold)) {
231
+ if (!import_constants.isWeb) handleResume === null || handleResume === void 0 || handleResume();
232
+ onSwipeCancel === null || onSwipeCancel === void 0 || onSwipeCancel(e);
233
+ animatedNumber.setValue(0, {
234
+ type: "spring"
235
+ });
236
+ }
237
+ }
238
+ });
239
+ }, [handlePause, handleResume]);
240
+ var themeName = (0, import_core.useThemeName)();
241
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
242
+ children: [announceTextContent && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounce, {
243
+ scope,
244
+ role: "status",
245
+ "aria-live": type === "foreground" ? "assertive" : "polite",
246
+ "aria-atomic": true,
247
+ children: announceTextContent
248
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
249
+ hostName: viewportName !== null && viewportName !== void 0 ? viewportName : "default",
250
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastInteractiveProvider, {
215
251
  scope,
216
- // toasts are always role=status to avoid stuttering issues with role=alert in SRs
217
- role: "status",
218
- "aria-live": type === "foreground" ? "assertive" : "polite",
219
- "aria-atomic": !0,
220
- children: announceTextContent
221
- }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
222
- hostName: viewportName ?? "default",
223
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastInteractiveProvider, {
224
- scope,
225
- onClose: function () {
226
- handleClose();
227
- },
228
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dismissable.Dismissable, {
229
- // asChild
230
- onEscapeKeyDown: (0, import_helpers.composeEventHandlers)(onEscapeKeyDown, function () {
231
- context.isFocusedToastEscapeKeyDownRef.current || handleClose(), context.isFocusedToastEscapeKeyDownRef.current = !1;
232
- }),
233
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Theme, {
234
- contain: !0,
235
- forceClassName: !0,
236
- name: themeName,
237
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AnimatedView, {
238
- ...panResponder?.panHandlers,
239
- style: [{
240
- margin: "auto"
241
- }, animatedStyles],
242
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastProvider.Collection.ItemSlot, {
243
- scope: context.toastScope,
244
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastImplFrame, {
245
- // Ensure toasts are announced as status list or status when focused
246
- role: "status",
247
- "aria-live": "off",
248
- "aria-atomic": !0,
249
- "data-state": open ? "open" : "closed",
250
- "data-swipe-direction": context.swipeDirection,
251
- pointerEvents: "auto",
252
- "$platform-web": {
253
- touchAction: "none",
254
- userSelect: "none"
255
- },
256
- ...toastProps,
257
- ref: composedRefs,
258
- ...(import_constants.isWeb && {
259
- onKeyDown: (0, import_helpers.composeEventHandlers)(props.onKeyDown, function (event) {
260
- event.key === "Escape" && (onEscapeKeyDown?.(event), event.defaultPrevented || (context.isFocusedToastEscapeKeyDownRef.current = !0, handleClose()));
261
- })
252
+ onClose: function () {
253
+ handleClose();
254
+ },
255
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dismissable.Dismissable, {
256
+ onEscapeKeyDown: (0, import_helpers.composeEventHandlers)(onEscapeKeyDown, function () {
257
+ if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();
258
+ context.isFocusedToastEscapeKeyDownRef.current = false;
259
+ }),
260
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Theme, {
261
+ contain: true,
262
+ forceClassName: true,
263
+ name: themeName,
264
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AnimatedView, {
265
+ ...(panResponder === null || panResponder === void 0 ? void 0 : panResponder.panHandlers),
266
+ style: [{
267
+ margin: "auto"
268
+ }, animatedStyles],
269
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastProvider.Collection.ItemSlot, {
270
+ scope: context.toastScope,
271
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastImplFrame, {
272
+ role: "status",
273
+ "aria-live": "off",
274
+ "aria-atomic": true,
275
+ "data-state": open ? "open" : "closed",
276
+ "data-swipe-direction": context.swipeDirection,
277
+ pointerEvents: "auto",
278
+ "$platform-web": {
279
+ touchAction: "none",
280
+ userSelect: "none"
281
+ },
282
+ ...toastProps,
283
+ ref: composedRefs,
284
+ ...(import_constants.isWeb && {
285
+ onKeyDown: (0, import_helpers.composeEventHandlers)(props.onKeyDown, function (event) {
286
+ if (event.key !== "Escape") return;
287
+ onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
288
+ if (!event.defaultPrevented) {
289
+ context.isFocusedToastEscapeKeyDownRef.current = true;
290
+ handleClose();
291
+ }
262
292
  })
263
293
  })
264
294
  })
265
295
  })
266
296
  })
267
297
  })
268
- }, props.id)
269
- })]
270
- });
298
+ })
299
+ }, props.id)
300
+ })]
271
301
  });
302
+ });
272
303
  ToastImpl.propTypes = {
273
304
  type(props) {
274
305
  if (props.type && !["foreground", "background"].includes(props.type)) {
@@ -279,48 +310,55 @@ ToastImpl.propTypes = {
279
310
  }
280
311
  };
281
312
  var isDeltaInDirection = function (delta, direction) {
282
- var threshold = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0,
283
- deltaX = Math.abs(delta.x),
284
- deltaY = Math.abs(delta.y),
285
- isDeltaX = deltaX > deltaY;
286
- return direction === "left" || direction === "right" || direction === "horizontal" ? isDeltaX && deltaX > threshold : !isDeltaX && deltaY > threshold;
313
+ var threshold = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
314
+ var deltaX = Math.abs(delta.x);
315
+ var deltaY = Math.abs(delta.y);
316
+ var isDeltaX = deltaX > deltaY;
317
+ if (direction === "left" || direction === "right" || direction === "horizontal") return isDeltaX && deltaX > threshold;
318
+ return !isDeltaX && deltaY > threshold;
287
319
  };
288
320
  function getAnnounceTextContent(container) {
289
321
  if (!import_constants.isWeb) return "";
290
- var textContent = [],
291
- childNodes = Array.from(container.childNodes);
292
- return childNodes.forEach(function (node) {
293
- if (node.nodeType === node.TEXT_NODE && node.textContent && textContent.push(node.textContent), isHTMLElement(node)) {
294
- var isHidden = node.ariaHidden || node.hidden || node.style.display === "none",
295
- isExcluded = node.dataset.toastAnnounceExclude === "";
322
+ var textContent = [];
323
+ Array.from(container.childNodes).forEach(function (node) {
324
+ if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);
325
+ if (isHTMLElement(node)) {
326
+ var isHidden = node.ariaHidden || node.hidden || node.style.display === "none";
327
+ var isExcluded = node.dataset.toastAnnounceExclude === "";
296
328
  if (!isHidden) if (isExcluded) {
297
329
  var altText = node.dataset.toastAnnounceAlt;
298
- altText && textContent.push(altText);
330
+ if (altText) textContent.push(altText);
299
331
  } else textContent.push(...getAnnounceTextContent(node));
300
332
  }
301
- }), textContent;
333
+ });
334
+ return textContent;
302
335
  }
303
336
  function isHTMLElement(node) {
304
337
  return node.nodeType === node.ELEMENT_NODE;
305
338
  }
306
- var GESTURE_GRANT_THRESHOLD = 10,
307
- shouldGrantGestureMove = function (dir, param) {
308
- var {
309
- dx,
310
- dy
311
- } = param;
312
- return (dir === "horizontal" || dir === "left") && dx < -GESTURE_GRANT_THRESHOLD || (dir === "horizontal" || dir === "right") && dx > GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "up") && dy > -GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "down") && dy < GESTURE_GRANT_THRESHOLD;
313
- },
314
- getGestureDistance = function (dir, param) {
315
- var {
316
- dx,
317
- dy
318
- } = param,
319
- y = 0,
320
- x = 0;
321
- return dir === "horizontal" ? x = dx : dir === "left" ? x = Math.min(0, dx) : dir === "right" ? x = Math.max(0, dx) : dir === "vertical" ? y = dy : dir === "up" ? y = Math.min(0, dy) : dir === "down" && (y = Math.max(0, dy)), {
322
- x,
323
- y
324
- };
339
+ var GESTURE_GRANT_THRESHOLD = 10;
340
+ var shouldGrantGestureMove = function (dir, param) {
341
+ var {
342
+ dx,
343
+ dy
344
+ } = param;
345
+ if ((dir === "horizontal" || dir === "left") && dx < -GESTURE_GRANT_THRESHOLD) return true;
346
+ if ((dir === "horizontal" || dir === "right") && dx > GESTURE_GRANT_THRESHOLD) return true;
347
+ if ((dir === "vertical" || dir === "up") && dy > -GESTURE_GRANT_THRESHOLD) return true;
348
+ if ((dir === "vertical" || dir === "down") && dy < GESTURE_GRANT_THRESHOLD) return true;
349
+ return false;
350
+ };
351
+ var getGestureDistance = function (dir, param) {
352
+ var {
353
+ dx,
354
+ dy
355
+ } = param;
356
+ var y = 0;
357
+ var x = 0;
358
+ if (dir === "horizontal") x = dx;else if (dir === "left") x = Math.min(0, dx);else if (dir === "right") x = Math.max(0, dx);else if (dir === "vertical") y = dy;else if (dir === "up") y = Math.min(0, dy);else if (dir === "down") y = Math.max(0, dy);
359
+ return {
360
+ x,
361
+ y
325
362
  };
363
+ };
326
364
  //# sourceMappingURL=ToastImpl.native.js.map