@tamagui/toast 2.7.7 → 3.0.0-beta.643.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/dist/cjs/ToastComposable.cjs +773 -882
  2. package/dist/cjs/ToastComposable.native.cjs +924 -0
  3. package/dist/cjs/ToastComposable.native.js +854 -966
  4. package/dist/cjs/ToastComposable.native.js.map +1 -1
  5. package/dist/cjs/ToastItemFrame.cjs +48 -119
  6. package/dist/cjs/ToastItemFrame.native.cjs +76 -0
  7. package/dist/cjs/ToastItemFrame.native.js +50 -120
  8. package/dist/cjs/ToastItemFrame.native.js.map +1 -1
  9. package/dist/cjs/ToastState.cjs +281 -290
  10. package/dist/cjs/ToastState.native.cjs +312 -0
  11. package/dist/cjs/ToastState.native.js +280 -290
  12. package/dist/cjs/ToastState.native.js.map +1 -1
  13. package/dist/cjs/createNativeToast.cjs +38 -44
  14. package/dist/cjs/createNativeToast.native.cjs +54 -0
  15. package/dist/cjs/createNativeToast.native.js +36 -40
  16. package/dist/cjs/createNativeToast.native.js.map +1 -1
  17. package/dist/cjs/dispatchNativeToast.cjs +32 -35
  18. package/dist/cjs/dispatchNativeToast.native.cjs +48 -0
  19. package/dist/cjs/dispatchNativeToast.native.js +34 -36
  20. package/dist/cjs/dispatchNativeToast.native.js.map +1 -1
  21. package/dist/cjs/index.cjs +25 -12
  22. package/dist/cjs/index.native.cjs +35 -0
  23. package/dist/cjs/index.native.js +26 -12
  24. package/dist/cjs/index.native.js.map +1 -1
  25. package/dist/cjs/types.cjs +10 -11
  26. package/dist/cjs/types.native.cjs +19 -0
  27. package/dist/cjs/types.native.js +10 -10
  28. package/dist/cjs/types.native.js.map +1 -1
  29. package/dist/cjs/useAnimatedDragGesture.cjs +197 -194
  30. package/dist/cjs/useAnimatedDragGesture.native.cjs +210 -0
  31. package/dist/cjs/useAnimatedDragGesture.native.js +179 -191
  32. package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
  33. package/dist/cjs/useReducedMotion.cjs +47 -55
  34. package/dist/cjs/useReducedMotion.native.cjs +74 -0
  35. package/dist/cjs/useReducedMotion.native.js +53 -60
  36. package/dist/cjs/useReducedMotion.native.js.map +1 -1
  37. package/dist/cjs/useToastAnimations.cjs +198 -270
  38. package/dist/cjs/useToastAnimations.native.cjs +229 -0
  39. package/dist/cjs/useToastAnimations.native.js +205 -276
  40. package/dist/cjs/useToastAnimations.native.js.map +1 -1
  41. package/dist/esm/ToastComposable.mjs +752 -854
  42. package/dist/esm/ToastComposable.mjs.map +1 -1
  43. package/dist/esm/ToastComposable.native.js +834 -940
  44. package/dist/esm/ToastComposable.native.js.map +1 -1
  45. package/dist/esm/ToastItemFrame.mjs +31 -99
  46. package/dist/esm/ToastItemFrame.mjs.map +1 -1
  47. package/dist/esm/ToastItemFrame.native.js +34 -102
  48. package/dist/esm/ToastItemFrame.native.js.map +1 -1
  49. package/dist/esm/ToastState.mjs +266 -273
  50. package/dist/esm/ToastState.mjs.map +1 -1
  51. package/dist/esm/ToastState.native.js +265 -274
  52. package/dist/esm/ToastState.native.js.map +1 -1
  53. package/dist/esm/createNativeToast.mjs +22 -26
  54. package/dist/esm/createNativeToast.mjs.map +1 -1
  55. package/dist/esm/createNativeToast.native.js +21 -23
  56. package/dist/esm/createNativeToast.native.js.map +1 -1
  57. package/dist/esm/dispatchNativeToast.mjs +19 -17
  58. package/dist/esm/dispatchNativeToast.mjs.map +1 -1
  59. package/dist/esm/dispatchNativeToast.native.js +21 -19
  60. package/dist/esm/dispatchNativeToast.native.js.map +1 -1
  61. package/dist/esm/index.js +5 -2
  62. package/dist/esm/index.mjs +5 -2
  63. package/dist/esm/index.native.js +5 -2
  64. package/dist/esm/types.mjs +0 -2
  65. package/dist/esm/types.native.js +0 -2
  66. package/dist/esm/useAnimatedDragGesture.mjs +181 -168
  67. package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
  68. package/dist/esm/useAnimatedDragGesture.native.js +163 -166
  69. package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
  70. package/dist/esm/useReducedMotion.mjs +31 -29
  71. package/dist/esm/useReducedMotion.mjs.map +1 -1
  72. package/dist/esm/useReducedMotion.native.js +37 -35
  73. package/dist/esm/useReducedMotion.native.js.map +1 -1
  74. package/dist/esm/useToastAnimations.mjs +183 -245
  75. package/dist/esm/useToastAnimations.mjs.map +1 -1
  76. package/dist/esm/useToastAnimations.native.js +190 -252
  77. package/dist/esm/useToastAnimations.native.js.map +1 -1
  78. package/dist/jsx/ToastComposable.mjs +752 -854
  79. package/dist/jsx/ToastComposable.mjs.map +1 -1
  80. package/dist/jsx/ToastComposable.native.cjs +924 -0
  81. package/dist/jsx/ToastComposable.native.js +854 -966
  82. package/dist/jsx/ToastComposable.native.js.map +1 -1
  83. package/dist/jsx/ToastItemFrame.mjs +31 -99
  84. package/dist/jsx/ToastItemFrame.mjs.map +1 -1
  85. package/dist/jsx/ToastItemFrame.native.cjs +76 -0
  86. package/dist/jsx/ToastItemFrame.native.js +50 -120
  87. package/dist/jsx/ToastItemFrame.native.js.map +1 -1
  88. package/dist/jsx/ToastState.mjs +266 -273
  89. package/dist/jsx/ToastState.mjs.map +1 -1
  90. package/dist/jsx/ToastState.native.cjs +312 -0
  91. package/dist/jsx/ToastState.native.js +280 -290
  92. package/dist/jsx/ToastState.native.js.map +1 -1
  93. package/dist/jsx/createNativeToast.mjs +22 -26
  94. package/dist/jsx/createNativeToast.mjs.map +1 -1
  95. package/dist/jsx/createNativeToast.native.cjs +54 -0
  96. package/dist/jsx/createNativeToast.native.js +36 -40
  97. package/dist/jsx/createNativeToast.native.js.map +1 -1
  98. package/dist/jsx/dispatchNativeToast.mjs +19 -17
  99. package/dist/jsx/dispatchNativeToast.mjs.map +1 -1
  100. package/dist/jsx/dispatchNativeToast.native.cjs +48 -0
  101. package/dist/jsx/dispatchNativeToast.native.js +34 -36
  102. package/dist/jsx/dispatchNativeToast.native.js.map +1 -1
  103. package/dist/jsx/index.js +5 -2
  104. package/dist/jsx/index.mjs +5 -2
  105. package/dist/jsx/index.native.cjs +35 -0
  106. package/dist/jsx/index.native.js +26 -12
  107. package/dist/jsx/index.native.js.map +1 -1
  108. package/dist/jsx/types.mjs +0 -2
  109. package/dist/jsx/types.native.cjs +19 -0
  110. package/dist/jsx/types.native.js +10 -10
  111. package/dist/jsx/types.native.js.map +1 -1
  112. package/dist/jsx/useAnimatedDragGesture.mjs +181 -168
  113. package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
  114. package/dist/jsx/useAnimatedDragGesture.native.cjs +210 -0
  115. package/dist/jsx/useAnimatedDragGesture.native.js +179 -191
  116. package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
  117. package/dist/jsx/useReducedMotion.mjs +31 -29
  118. package/dist/jsx/useReducedMotion.mjs.map +1 -1
  119. package/dist/jsx/useReducedMotion.native.cjs +74 -0
  120. package/dist/jsx/useReducedMotion.native.js +53 -60
  121. package/dist/jsx/useReducedMotion.native.js.map +1 -1
  122. package/dist/jsx/useToastAnimations.mjs +183 -245
  123. package/dist/jsx/useToastAnimations.mjs.map +1 -1
  124. package/dist/jsx/useToastAnimations.native.cjs +229 -0
  125. package/dist/jsx/useToastAnimations.native.js +205 -276
  126. package/dist/jsx/useToastAnimations.native.js.map +1 -1
  127. package/package.json +20 -37
  128. package/src/ToastComposable.tsx +55 -97
  129. package/src/ToastItemFrame.tsx +22 -81
  130. package/src/ToastState.ts +1 -0
  131. package/src/index.ts +34 -2
  132. package/src/types.ts +11 -0
  133. package/src/useAnimatedDragGesture.native.ts +1 -1
  134. package/src/useAnimatedDragGesture.ts +1 -1
  135. package/src/useToastAnimations.ts +20 -36
  136. package/types/ToastComposable.d.ts +124 -47
  137. package/types/ToastComposable.d.ts.map +1 -1
  138. package/types/ToastItemFrame.d.ts +52 -21
  139. package/types/ToastItemFrame.d.ts.map +1 -1
  140. package/types/ToastState.d.ts +15 -11
  141. package/types/ToastState.d.ts.map +1 -1
  142. package/types/index.d.ts +6 -2
  143. package/types/index.d.ts.map +1 -1
  144. package/types/types.d.ts +1 -0
  145. package/types/types.d.ts.map +1 -1
  146. package/types/useAnimatedDragGesture.d.ts +1 -1
  147. package/types/useAnimatedDragGesture.d.ts.map +1 -1
  148. package/types/useAnimatedDragGesture.native.d.ts +1 -1
  149. package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
  150. package/types/useToastAnimations.d.ts +2 -8
  151. package/types/useToastAnimations.d.ts.map +1 -1
  152. package/dist/cjs/Toast.cjs +0 -178
  153. package/dist/cjs/Toast.native.js +0 -181
  154. package/dist/cjs/Toast.native.js.map +0 -1
  155. package/dist/cjs/ToastAnnounce.cjs +0 -103
  156. package/dist/cjs/ToastAnnounce.native.js +0 -111
  157. package/dist/cjs/ToastAnnounce.native.js.map +0 -1
  158. package/dist/cjs/ToastImperative.cjs +0 -119
  159. package/dist/cjs/ToastImperative.native.js +0 -130
  160. package/dist/cjs/ToastImperative.native.js.map +0 -1
  161. package/dist/cjs/ToastImpl.cjs +0 -354
  162. package/dist/cjs/ToastImpl.native.js +0 -364
  163. package/dist/cjs/ToastImpl.native.js.map +0 -1
  164. package/dist/cjs/ToastPortal.cjs +0 -49
  165. package/dist/cjs/ToastPortal.native.js +0 -52
  166. package/dist/cjs/ToastPortal.native.js.map +0 -1
  167. package/dist/cjs/ToastProvider.cjs +0 -150
  168. package/dist/cjs/ToastProvider.native.js +0 -161
  169. package/dist/cjs/ToastProvider.native.js.map +0 -1
  170. package/dist/cjs/ToastViewport.cjs +0 -319
  171. package/dist/cjs/ToastViewport.native.js +0 -343
  172. package/dist/cjs/ToastViewport.native.js.map +0 -1
  173. package/dist/cjs/Toaster.cjs +0 -87
  174. package/dist/cjs/Toaster.native.js +0 -91
  175. package/dist/cjs/Toaster.native.js.map +0 -1
  176. package/dist/cjs/constants.cjs +0 -30
  177. package/dist/cjs/constants.native.js +0 -33
  178. package/dist/cjs/constants.native.js.map +0 -1
  179. package/dist/cjs/v2.cjs +0 -36
  180. package/dist/cjs/v2.native.js +0 -39
  181. package/dist/cjs/v2.native.js.map +0 -1
  182. package/dist/esm/Toast.mjs +0 -137
  183. package/dist/esm/Toast.mjs.map +0 -1
  184. package/dist/esm/Toast.native.js +0 -137
  185. package/dist/esm/Toast.native.js.map +0 -1
  186. package/dist/esm/ToastAnnounce.mjs +0 -66
  187. package/dist/esm/ToastAnnounce.mjs.map +0 -1
  188. package/dist/esm/ToastAnnounce.native.js +0 -71
  189. package/dist/esm/ToastAnnounce.native.js.map +0 -1
  190. package/dist/esm/ToastImperative.mjs +0 -80
  191. package/dist/esm/ToastImperative.mjs.map +0 -1
  192. package/dist/esm/ToastImperative.native.js +0 -88
  193. package/dist/esm/ToastImperative.native.js.map +0 -1
  194. package/dist/esm/ToastImpl.mjs +0 -316
  195. package/dist/esm/ToastImpl.mjs.map +0 -1
  196. package/dist/esm/ToastImpl.native.js +0 -329
  197. package/dist/esm/ToastImpl.native.js.map +0 -1
  198. package/dist/esm/ToastPortal.mjs +0 -24
  199. package/dist/esm/ToastPortal.mjs.map +0 -1
  200. package/dist/esm/ToastPortal.native.js +0 -24
  201. package/dist/esm/ToastPortal.native.js.map +0 -1
  202. package/dist/esm/ToastProvider.mjs +0 -110
  203. package/dist/esm/ToastProvider.mjs.map +0 -1
  204. package/dist/esm/ToastProvider.native.js +0 -118
  205. package/dist/esm/ToastProvider.native.js.map +0 -1
  206. package/dist/esm/ToastViewport.mjs +0 -280
  207. package/dist/esm/ToastViewport.mjs.map +0 -1
  208. package/dist/esm/ToastViewport.native.js +0 -301
  209. package/dist/esm/ToastViewport.native.js.map +0 -1
  210. package/dist/esm/Toaster.mjs +0 -51
  211. package/dist/esm/Toaster.mjs.map +0 -1
  212. package/dist/esm/Toaster.native.js +0 -52
  213. package/dist/esm/Toaster.native.js.map +0 -1
  214. package/dist/esm/constants.mjs +0 -4
  215. package/dist/esm/constants.mjs.map +0 -1
  216. package/dist/esm/constants.native.js +0 -4
  217. package/dist/esm/constants.native.js.map +0 -1
  218. package/dist/esm/index.js.map +0 -1
  219. package/dist/esm/index.mjs.map +0 -1
  220. package/dist/esm/index.native.js.map +0 -1
  221. package/dist/esm/types.mjs.map +0 -1
  222. package/dist/esm/types.native.js.map +0 -1
  223. package/dist/esm/v2.mjs +0 -6
  224. package/dist/esm/v2.mjs.map +0 -1
  225. package/dist/esm/v2.native.js +0 -6
  226. package/dist/esm/v2.native.js.map +0 -1
  227. package/dist/jsx/Toast.mjs +0 -137
  228. package/dist/jsx/Toast.mjs.map +0 -1
  229. package/dist/jsx/Toast.native.js +0 -181
  230. package/dist/jsx/Toast.native.js.map +0 -1
  231. package/dist/jsx/ToastAnnounce.mjs +0 -66
  232. package/dist/jsx/ToastAnnounce.mjs.map +0 -1
  233. package/dist/jsx/ToastAnnounce.native.js +0 -111
  234. package/dist/jsx/ToastAnnounce.native.js.map +0 -1
  235. package/dist/jsx/ToastImperative.mjs +0 -80
  236. package/dist/jsx/ToastImperative.mjs.map +0 -1
  237. package/dist/jsx/ToastImperative.native.js +0 -130
  238. package/dist/jsx/ToastImperative.native.js.map +0 -1
  239. package/dist/jsx/ToastImpl.mjs +0 -316
  240. package/dist/jsx/ToastImpl.mjs.map +0 -1
  241. package/dist/jsx/ToastImpl.native.js +0 -364
  242. package/dist/jsx/ToastImpl.native.js.map +0 -1
  243. package/dist/jsx/ToastPortal.mjs +0 -24
  244. package/dist/jsx/ToastPortal.mjs.map +0 -1
  245. package/dist/jsx/ToastPortal.native.js +0 -52
  246. package/dist/jsx/ToastPortal.native.js.map +0 -1
  247. package/dist/jsx/ToastProvider.mjs +0 -110
  248. package/dist/jsx/ToastProvider.mjs.map +0 -1
  249. package/dist/jsx/ToastProvider.native.js +0 -161
  250. package/dist/jsx/ToastProvider.native.js.map +0 -1
  251. package/dist/jsx/ToastViewport.mjs +0 -280
  252. package/dist/jsx/ToastViewport.mjs.map +0 -1
  253. package/dist/jsx/ToastViewport.native.js +0 -343
  254. package/dist/jsx/ToastViewport.native.js.map +0 -1
  255. package/dist/jsx/Toaster.mjs +0 -51
  256. package/dist/jsx/Toaster.mjs.map +0 -1
  257. package/dist/jsx/Toaster.native.js +0 -91
  258. package/dist/jsx/Toaster.native.js.map +0 -1
  259. package/dist/jsx/constants.mjs +0 -4
  260. package/dist/jsx/constants.mjs.map +0 -1
  261. package/dist/jsx/constants.native.js +0 -33
  262. package/dist/jsx/constants.native.js.map +0 -1
  263. package/dist/jsx/index.js.map +0 -1
  264. package/dist/jsx/index.mjs.map +0 -1
  265. package/dist/jsx/types.mjs.map +0 -1
  266. package/dist/jsx/v2.mjs +0 -6
  267. package/dist/jsx/v2.mjs.map +0 -1
  268. package/dist/jsx/v2.native.js +0 -39
  269. package/dist/jsx/v2.native.js.map +0 -1
  270. package/src/Toast.tsx +0 -219
  271. package/src/ToastAnnounce.tsx +0 -103
  272. package/src/ToastImperative.tsx +0 -192
  273. package/src/ToastImpl.tsx +0 -514
  274. package/src/ToastPortal.tsx +0 -19
  275. package/src/ToastProvider.tsx +0 -204
  276. package/src/ToastViewport.tsx +0 -430
  277. package/src/Toaster.tsx +0 -181
  278. package/src/constants.ts +0 -2
  279. package/src/v2.ts +0 -31
  280. package/types/Toast.d.ts +0 -84
  281. package/types/Toast.d.ts.map +0 -1
  282. package/types/ToastAnnounce.d.ts +0 -18
  283. package/types/ToastAnnounce.d.ts.map +0 -1
  284. package/types/ToastImperative.d.ts +0 -95
  285. package/types/ToastImperative.d.ts.map +0 -1
  286. package/types/ToastImpl.d.ts +0 -109
  287. package/types/ToastImpl.d.ts.map +0 -1
  288. package/types/ToastPortal.d.ts +0 -8
  289. package/types/ToastPortal.d.ts.map +0 -1
  290. package/types/ToastProvider.d.ts +0 -92
  291. package/types/ToastProvider.d.ts.map +0 -1
  292. package/types/ToastViewport.d.ts +0 -75
  293. package/types/ToastViewport.d.ts.map +0 -1
  294. package/types/Toaster.d.ts +0 -112
  295. package/types/Toaster.d.ts.map +0 -1
  296. package/types/constants.d.ts +0 -3
  297. package/types/constants.d.ts.map +0 -1
  298. package/types/v2.d.ts +0 -10
  299. package/types/v2.d.ts.map +0 -1
  300. package/v2/index.cjs +0 -2
  301. package/v2/index.js +0 -2
  302. package/v2/index.native.cjs +0 -2
  303. package/v2/index.native.js +0 -2
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@tamagui/toast",
3
- "version": "2.7.7",
3
+ "version": "3.0.0-beta.643.1",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
7
7
  "types",
8
- "dist",
9
- "v2"
8
+ "dist"
10
9
  ],
11
10
  "type": "module",
12
11
  "sideEffects": false,
@@ -23,15 +22,6 @@
23
22
  "import": "./dist/esm/index.mjs",
24
23
  "require": "./dist/cjs/index.cjs",
25
24
  "default": "./dist/esm/index.mjs"
26
- },
27
- "./v2": {
28
- "types": "./types/v2.d.ts",
29
- "react-native": "./dist/esm/v2.native.js",
30
- "browser": "./dist/esm/v2.mjs",
31
- "module": "./dist/esm/v2.mjs",
32
- "import": "./dist/esm/v2.mjs",
33
- "require": "./dist/cjs/v2.cjs",
34
- "default": "./dist/esm/v2.mjs"
35
25
  }
36
26
  },
37
27
  "publishConfig": {
@@ -44,39 +34,32 @@
44
34
  "clean:build": "tamagui-build clean:build"
45
35
  },
46
36
  "dependencies": {
47
- "@tamagui/animate-presence": "2.7.7",
48
- "@tamagui/collection": "2.7.7",
49
- "@tamagui/compose-refs": "2.7.7",
50
- "@tamagui/constants": "2.7.7",
51
- "@tamagui/core": "2.7.7",
52
- "@tamagui/create-context": "2.7.7",
53
- "@tamagui/dismissable": "2.7.7",
54
- "@tamagui/helpers": "2.7.7",
55
- "@tamagui/native": "2.7.7",
56
- "@tamagui/polyfill-dev": "2.7.7",
57
- "@tamagui/portal": "2.7.7",
58
- "@tamagui/stacks": "2.7.7",
59
- "@tamagui/start-transition": "2.7.7",
60
- "@tamagui/text": "2.7.7",
61
- "@tamagui/use-controllable-state": "2.7.7",
62
- "@tamagui/visually-hidden": "2.7.7"
37
+ "@tamagui/animate-presence": "3.0.0-beta.643.1",
38
+ "@tamagui/collection": "3.0.0-beta.643.1",
39
+ "@tamagui/compose-refs": "3.0.0-beta.643.1",
40
+ "@tamagui/constants": "3.0.0-beta.643.1",
41
+ "@tamagui/core": "3.0.0-beta.643.1",
42
+ "@tamagui/create-context": "3.0.0-beta.643.1",
43
+ "@tamagui/dismissable": "3.0.0-beta.643.1",
44
+ "@tamagui/helpers": "3.0.0-beta.643.1",
45
+ "@tamagui/native": "3.0.0-beta.643.1",
46
+ "@tamagui/polyfill-dev": "3.0.0-beta.643.1",
47
+ "@tamagui/portal": "3.0.0-beta.643.1",
48
+ "@tamagui/stacks": "3.0.0-beta.643.1",
49
+ "@tamagui/start-transition": "3.0.0-beta.643.1",
50
+ "@tamagui/text": "3.0.0-beta.643.1",
51
+ "@tamagui/use-controllable-state": "3.0.0-beta.643.1",
52
+ "@tamagui/visually-hidden": "3.0.0-beta.643.1"
63
53
  },
64
54
  "devDependencies": {
65
- "@tamagui/build": "2.7.7",
55
+ "@tamagui/build": "3.0.0-beta.643.1",
66
56
  "react": ">=19",
67
- "react-native": "0.83.2"
57
+ "react-native": "0.86.2"
68
58
  },
69
59
  "peerDependencies": {
70
60
  "react": ">=19"
71
61
  },
72
62
  "module:jsx": "dist/jsx",
73
- "typesVersions": {
74
- "*": {
75
- "v2": [
76
- "./types/v2.d.ts"
77
- ]
78
- }
79
- },
80
63
  "repository": {
81
64
  "type": "git",
82
65
  "url": "git+https://github.com/tamagui/tamagui.git",
@@ -1,3 +1,4 @@
1
+ import { createStyledHOC, createRefComponent } from '@tamagui/core'
1
2
  import { AnimatePresence } from '@tamagui/animate-presence'
2
3
  import { isWeb } from '@tamagui/constants'
3
4
  import { getGestureHandler } from '@tamagui/native'
@@ -16,7 +17,7 @@ import { Portal } from '@tamagui/portal'
16
17
  import { XStack, YStack } from '@tamagui/stacks'
17
18
  import { SizableText } from '@tamagui/text'
18
19
  import * as React from 'react'
19
- import type { SwipeDirection } from './ToastProvider'
20
+ import type { SwipeDirection } from './types'
20
21
  import type { ExternalToast, ToastT, ToastToDismiss, ToastType } from './ToastState'
21
22
  import { ToastState } from './ToastState'
22
23
  import type { BurntToastOptions } from './types'
@@ -85,10 +86,7 @@ interface ToastContextValue {
85
86
  icons?: ToastIcons
86
87
  }
87
88
 
88
- const ToastContext = createStyledContext<ToastContextValue>(
89
- {} as ToastContextValue,
90
- 'Toast__'
91
- )
89
+ const ToastContext = createStyledContext<ToastContextValue>({}, 'Toast__')
92
90
 
93
91
  const useToastContextValue = ToastContext.useStyledContext
94
92
 
@@ -151,6 +149,11 @@ export interface ToastIcons {
151
149
 
152
150
  export interface ToastRootProps {
153
151
  children: React.ReactNode
152
+ /**
153
+ * Only render toasts sent to this toaster id. Untargeted toasts render in
154
+ * roots without an id.
155
+ */
156
+ toasterId?: string
154
157
  /**
155
158
  * Position of the toasts on screen
156
159
  * @default 'bottom-right'
@@ -244,10 +247,11 @@ function resolveSwipeDirection(
244
247
  return 'horizontal'
245
248
  }
246
249
 
247
- const ToastRoot = React.forwardRef<TamaguiElement, ToastRootProps>(
250
+ const ToastRoot = createRefComponent<TamaguiElement, ToastRootProps>(
248
251
  function ToastRoot(props, _ref) {
249
252
  const {
250
253
  children,
254
+ toasterId,
251
255
  position = 'bottom-right',
252
256
  duration = TOAST_LIFETIME,
253
257
  gap = TOAST_GAP,
@@ -352,6 +356,10 @@ const ToastRoot = React.forwardRef<TamaguiElement, ToastRootProps>(
352
356
  return
353
357
  }
354
358
 
359
+ if ((toast as ToastT).toasterId !== toasterId) {
360
+ return
361
+ }
362
+
355
363
  // Native dispatch: intercept before entering state so no in-app toast renders.
356
364
  // On failure (e.g. permission denied), falls through to in-app.
357
365
  if (native) {
@@ -375,7 +383,7 @@ const ToastRoot = React.forwardRef<TamaguiElement, ToastRootProps>(
375
383
  return [toast as ToastT, ...toasts]
376
384
  })
377
385
  })
378
- }, [native, duration])
386
+ }, [native, duration, toasterId])
379
387
 
380
388
  // collapse when 1 toast left, or when a new toast is added while expanded
381
389
  const prevToastCountRef = React.useRef(toasts.length)
@@ -450,27 +458,16 @@ const ToastRoot = React.forwardRef<TamaguiElement, ToastRootProps>(
450
458
  * -----------------------------------------------------------------------------------------------*/
451
459
 
452
460
  const ToastViewportFrame = styled(View, {
453
- name: 'ToastViewport',
454
-
455
- variants: {
456
- unstyled: {
457
- false: {
458
- position: isWeb ? ('fixed' as any) : 'absolute',
459
- zIndex: 100000,
460
- pointerEvents: 'box-none',
461
- maxWidth: '100%',
462
- ...(isWeb && { width: 356 }),
463
- minHeight: 1,
464
- },
465
- },
466
- } as const,
467
-
468
- defaultVariants: {
469
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
470
- },
461
+ displayName: 'ToastViewport',
462
+ position: isWeb ? ('fixed' as any) : 'absolute',
463
+ zIndex: 100000,
464
+ pointerEvents: 'box-none',
465
+ maxWidth: '100%',
466
+ ...(isWeb && { width: 356 }),
467
+ minHeight: 1,
471
468
  })
472
469
 
473
- export interface ToastViewportProps extends GetProps<typeof ToastViewportFrame> {
470
+ export type ToastViewportProps = GetProps<typeof ToastViewportFrame> & {
474
471
  /**
475
472
  * Offset from screen edge
476
473
  * @default 24
@@ -497,8 +494,9 @@ export interface ToastViewportProps extends GetProps<typeof ToastViewportFrame>
497
494
  portalZIndex?: number
498
495
  }
499
496
 
500
- const ToastViewport = ToastViewportFrame.styleable<ToastViewportProps>(
501
- function ToastViewport(props, ref) {
497
+ const ToastViewport = createStyledHOC(
498
+ ToastViewportFrame,
499
+ function ToastViewport(props: ToastViewportProps, ref) {
502
500
  const {
503
501
  offset = VIEWPORT_OFFSET,
504
502
  hotkey = DEFAULT_HOTKEY,
@@ -774,33 +772,27 @@ function DefaultToastContent({ toast }: { toast: ToastT }) {
774
772
  typeof toast.description === 'function' ? toast.description() : toast.description
775
773
 
776
774
  return (
777
- <XStack alignItems="flex-start" gap="$3">
775
+ <XStack alignItems="flex-start" gap="3">
778
776
  <ToastIcon />
779
777
 
780
- <YStack flex={1} gap="$1">
778
+ <YStack flex={1} gap="1">
781
779
  {title && <ToastTitle>{title}</ToastTitle>}
782
780
  {description && <ToastDescription>{description}</ToastDescription>}
783
781
 
784
782
  {(toast.action || toast.cancel) && (
785
- <XStack gap="$2" marginTop="$2">
783
+ <XStack gap="2" marginTop="2">
786
784
  {toast.cancel && (
787
785
  <ToastActionFrame
788
- backgroundColor="transparent"
789
786
  onPress={(e: any) => {
790
787
  toast.cancel?.onClick?.(e)
791
788
  handleClose()
792
789
  }}
793
790
  >
794
- <SizableText size="$2" color="$color11">
795
- {toast.cancel.label}
796
- </SizableText>
791
+ <SizableText size="2">{toast.cancel.label}</SizableText>
797
792
  </ToastActionFrame>
798
793
  )}
799
794
  {toast.action && (
800
795
  <ToastActionFrame
801
- backgroundColor="$color12"
802
- hoverStyle={{ backgroundColor: '$color11' }}
803
- pressStyle={{ backgroundColor: '$color10' }}
804
796
  onPress={(e: any) => {
805
797
  toast.action?.onClick?.(e)
806
798
  if (!(e as any).defaultPrevented) {
@@ -808,9 +800,7 @@ function DefaultToastContent({ toast }: { toast: ToastT }) {
808
800
  }
809
801
  }}
810
802
  >
811
- <SizableText size="$2" fontWeight="600" color="$background">
812
- {toast.action.label}
813
- </SizableText>
803
+ <SizableText size="2">{toast.action.label}</SizableText>
814
804
  </ToastActionFrame>
815
805
  )}
816
806
  </XStack>
@@ -893,14 +883,15 @@ function DragWrapper({
893
883
  * ToastItem (the wrapper with stacking/drag)
894
884
  * -----------------------------------------------------------------------------------------------*/
895
885
 
896
- export interface ToastItemProps extends GetProps<typeof ToastItemFrame> {
886
+ export type ToastItemProps = GetProps<typeof ToastItemFrame> & {
897
887
  toast: ToastT
898
888
  index: number
899
889
  children: React.ReactNode
900
890
  }
901
891
 
902
- const ToastItemInner = ToastItemFrame.styleable<ToastItemProps>(
903
- function ToastItem(props, ref) {
892
+ const ToastItemInner = createStyledHOC(
893
+ ToastItemFrame,
894
+ function ToastItem(props: ToastItemProps, ref) {
904
895
  const { toast, index, children, ...rest } = props
905
896
  const ctx = useToastContext('Toast.Item')
906
897
 
@@ -1025,12 +1016,6 @@ const ToastItemInner = ToastItemFrame.styleable<ToastItemProps>(
1025
1016
  dragRef,
1026
1017
  } = useToastAnimations({
1027
1018
  reducedMotion: ctx.reducedMotion,
1028
- swipeAxis:
1029
- ctx.swipeDirection === 'up' ||
1030
- ctx.swipeDirection === 'down' ||
1031
- ctx.swipeDirection === 'vertical'
1032
- ? 'vertical'
1033
- : 'horizontal',
1034
1019
  })
1035
1020
 
1036
1021
  const { isDragging, gestureHandlers, gesture } = useAnimatedDragGesture({
@@ -1163,17 +1148,20 @@ const ToastItemInner = ToastItemFrame.styleable<ToastItemProps>(
1163
1148
  <ToastPositionWrapper
1164
1149
  ref={ref}
1165
1150
  testID={rest.testID}
1166
- accessibilityLabel={rest.accessibilityLabel}
1151
+ aria-label={rest['aria-label']}
1167
1152
  {...dataAttributes}
1168
1153
  transition={
1169
1154
  isDragging || ctx.reducedMotion ? undefined : removed ? '200ms' : '400ms'
1170
1155
  }
1171
- animateOnly={
1172
- isWeb ? ['transform', 'opacity', 'height'] : ['transform', 'opacity']
1156
+ y={
1157
+ ctx.reducedMotion
1158
+ ? stackY
1159
+ : `${stackY} enter:${isTop ? -80 : 80}px exit:${
1160
+ swipeOut ? (swipeExitYRef.current ?? stackY) : stackY
1161
+ }px`
1173
1162
  }
1174
- y={stackY}
1175
1163
  scale={stackScale}
1176
- opacity={computedOpacity}
1164
+ opacity={`${computedOpacity} enter:0 exit:0`}
1177
1165
  zIndex={computedZIndex}
1178
1166
  height={computedHeight}
1179
1167
  overflow="visible"
@@ -1184,15 +1172,8 @@ const ToastItemInner = ToastItemFrame.styleable<ToastItemProps>(
1184
1172
  !isFront && {
1185
1173
  style: { transformOrigin: isTop ? 'top center' : 'bottom center' },
1186
1174
  })}
1187
- enterStyle={
1188
- ctx.reducedMotion ? { opacity: 0 } : { opacity: 0, y: isTop ? -80 : 80 }
1189
- }
1190
- exitStyle={
1191
- ctx.reducedMotion
1192
- ? { opacity: 0 }
1193
- : swipeOut
1194
- ? { opacity: 0, y: swipeExitYRef.current ?? stackY, scale: stackScale }
1195
- : { opacity: 0, y: stackY, scale: stackScale }
1175
+ animateOnly={
1176
+ isWeb ? ['transform', 'opacity', 'height'] : ['transform', 'opacity']
1196
1177
  }
1197
1178
  >
1198
1179
  <DragWrapper
@@ -1252,50 +1233,26 @@ const ToastItemInner = ToastItemFrame.styleable<ToastItemProps>(
1252
1233
  * ToastTitle
1253
1234
  * -----------------------------------------------------------------------------------------------*/
1254
1235
 
1236
+ // Structural (unstyled) — text color/weight/size live in the tamagui skin
1237
+ // (code/ui/tamagui/src/components/Toast.tsx).
1255
1238
  const ToastTitle = styled(SizableText, {
1256
- name: 'ToastTitle',
1257
-
1258
- variants: {
1259
- unstyled: {
1260
- false: {
1261
- color: '$color',
1262
- fontWeight: '600',
1263
- size: '$4',
1264
- },
1265
- },
1266
- } as const,
1267
-
1268
- defaultVariants: {
1269
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
1270
- },
1239
+ displayName: 'ToastTitle',
1271
1240
  })
1272
1241
 
1273
1242
  /* -------------------------------------------------------------------------------------------------
1274
1243
  * ToastDescription
1275
1244
  * -----------------------------------------------------------------------------------------------*/
1276
1245
 
1246
+ // Structural (unstyled) — text color/size live in the tamagui skin.
1277
1247
  const ToastDescription = styled(SizableText, {
1278
- name: 'ToastDescription',
1279
-
1280
- variants: {
1281
- unstyled: {
1282
- false: {
1283
- color: '$color11',
1284
- size: '$2',
1285
- },
1286
- },
1287
- } as const,
1288
-
1289
- defaultVariants: {
1290
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
1291
- },
1248
+ displayName: 'ToastDescription',
1292
1249
  })
1293
1250
 
1294
1251
  /* -------------------------------------------------------------------------------------------------
1295
1252
  * ToastClose - auto-wired to dismiss current toast
1296
1253
  * -----------------------------------------------------------------------------------------------*/
1297
1254
 
1298
- const ToastClose = ToastCloseFrame.styleable(function ToastClose(props, ref) {
1255
+ const ToastClose = createStyledHOC(ToastCloseFrame, function ToastClose(props, ref) {
1299
1256
  // try to get handleClose from context, but allow manual override
1300
1257
  let handleClose: (() => void) | undefined
1301
1258
  try {
@@ -1318,7 +1275,7 @@ const ToastClose = ToastCloseFrame.styleable(function ToastClose(props, ref) {
1318
1275
  * ToastAction
1319
1276
  * -----------------------------------------------------------------------------------------------*/
1320
1277
 
1321
- const ToastAction = ToastActionFrame.styleable(function ToastAction(props, ref) {
1278
+ const ToastAction = createStyledHOC(ToastActionFrame, function ToastAction(props, ref) {
1322
1279
  return <ToastActionFrame ref={ref} {...props} />
1323
1280
  })
1324
1281
 
@@ -1343,7 +1300,7 @@ function ToastIcon(props: { children?: React.ReactNode }) {
1343
1300
  // if custom icon provided on toast, use it
1344
1301
  if (toast.icon !== undefined) {
1345
1302
  return (
1346
- <View flexShrink={0} marginTop="$0.5">
1303
+ <View flexShrink={0} marginTop="0-5">
1347
1304
  {toast.icon}
1348
1305
  </View>
1349
1306
  )
@@ -1356,7 +1313,7 @@ function ToastIcon(props: { children?: React.ReactNode }) {
1356
1313
  if (!icon) return null
1357
1314
 
1358
1315
  return (
1359
- <View flexShrink={0} marginTop="$0.5">
1316
+ <View flexShrink={0} marginTop="0-5">
1360
1317
  {icon}
1361
1318
  </View>
1362
1319
  )
@@ -1372,6 +1329,7 @@ export function useToasts() {
1372
1329
  toasts: ctx.toasts,
1373
1330
  expanded: ctx.expanded,
1374
1331
  position: ctx.position,
1332
+ closeButton: ctx.closeButton,
1375
1333
  }
1376
1334
  }
1377
1335
 
@@ -1,6 +1,12 @@
1
1
  /**
2
- * Shared visual styled components for toast items.
2
+ * Structural (unstyled) frames for toast items — the behavior-first primitives.
3
3
  * Shared across web and native — imported by ToastComposable.
4
+ *
5
+ * These keep ONLY the structural allowlist (layout, hit targets, positioning,
6
+ * cursor/userSelect, native `render:'button'`). The v2-look skin (background,
7
+ * border, radius, padding, shadow, hover/press/focus color styling, text color)
8
+ * lives in the tamagui skin (code/ui/tamagui/src/components/Toast.tsx), which is
9
+ * also the shadcn registry source.
4
10
  */
5
11
 
6
12
  import { styled } from '@tamagui/core'
@@ -9,12 +15,12 @@ import { SizableText } from '@tamagui/text'
9
15
 
10
16
  /* -------------------------------------------------------------------------------------------------
11
17
  * ToastPositionWrapper - handles absolute positioning and stacking animations
12
- * On web: uses Tamagui transition/enterStyle/exitStyle
18
+ * On web: uses Tamagui transition plus enter/exit clauses
13
19
  * On native: replaced by Animated.View with useAnimatedStyle
14
20
  * -----------------------------------------------------------------------------------------------*/
15
21
 
16
22
  export const ToastPositionWrapper = styled(YStack, {
17
- name: 'ToastPositionWrapper',
23
+ displayName: 'ToastPositionWrapper',
18
24
  pointerEvents: 'auto',
19
25
  position: 'absolute',
20
26
  left: 0,
@@ -26,111 +32,46 @@ export const ToastPositionWrapper = styled(YStack, {
26
32
  })
27
33
 
28
34
  /* -------------------------------------------------------------------------------------------------
29
- * ToastItemFrame - visual styling for the toast
30
- * Shared across web and native — the visual appearance of the toast card.
35
+ * ToastItemFrame - structural frame for the toast card (the visual skin lives in
36
+ * the tamagui Toast skin).
31
37
  * -----------------------------------------------------------------------------------------------*/
32
38
 
33
39
  export const ToastItemFrame = styled(YStack, {
34
- name: 'ToastItem',
40
+ displayName: 'ToastItem',
35
41
  userSelect: 'none',
36
42
  cursor: 'default',
37
- focusable: true,
38
-
39
- variants: {
40
- unstyled: {
41
- false: {
42
- backgroundColor: '$background',
43
- borderRadius: '$6',
44
- paddingHorizontal: '$4',
45
- paddingVertical: '$3',
46
- borderWidth: 1,
47
- borderColor: '$borderColor',
48
- shadowColor: 'rgba(0, 0, 0, 0.15)',
49
- shadowOffset: { width: 0, height: 4 },
50
- shadowRadius: 12,
51
- focusVisibleStyle: {
52
- outlineWidth: 2,
53
- outlineColor: '$color8',
54
- outlineStyle: 'solid',
55
- },
56
- },
57
- },
58
- } as const,
59
-
60
- defaultVariants: {
61
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
62
- },
43
+ tabIndex: 0,
63
44
  })
64
45
 
65
46
  /* -------------------------------------------------------------------------------------------------
66
- * ToastCloseFrame
47
+ * ToastCloseFrame - structural button (layout + hit target only).
67
48
  * -----------------------------------------------------------------------------------------------*/
68
49
 
69
50
  export const ToastCloseFrame = styled(XStack, {
70
- name: 'ToastClose',
51
+ displayName: 'ToastClose',
71
52
  render: 'button',
72
53
  alignItems: 'center',
73
54
  justifyContent: 'center',
74
55
  cursor: 'pointer',
75
-
76
- variants: {
77
- unstyled: {
78
- false: {
79
- width: 18,
80
- height: 18,
81
- borderRadius: '$10',
82
- backgroundColor: '$background',
83
- borderWidth: 1,
84
- borderColor: '$borderColor',
85
- shadowColor: 'rgba(0, 0, 0, 0.08)',
86
- shadowOffset: { width: 0, height: 1 },
87
- shadowRadius: 3,
88
- hoverStyle: { backgroundColor: '$color3' },
89
- pressStyle: { backgroundColor: '$color4' },
90
- },
91
- },
92
- } as const,
93
-
94
- defaultVariants: {
95
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
96
- },
56
+ width: 18,
57
+ height: 18,
97
58
  })
98
59
 
99
60
  /* -------------------------------------------------------------------------------------------------
100
- * ToastActionFrame - for action/cancel buttons with text
61
+ * ToastActionFrame - structural button for action/cancel buttons with text.
101
62
  * -----------------------------------------------------------------------------------------------*/
102
63
 
103
64
  export const ToastActionFrame = styled(XStack, {
104
- name: 'ToastAction',
65
+ displayName: 'ToastAction',
105
66
  render: 'button',
106
67
  alignItems: 'center',
107
68
  justifyContent: 'center',
108
69
  cursor: 'pointer',
109
-
110
- variants: {
111
- unstyled: {
112
- false: {
113
- borderRadius: '$2',
114
- paddingHorizontal: '$2',
115
- height: 24,
116
- backgroundColor: '$color5',
117
- hoverStyle: { backgroundColor: '$color6' },
118
- pressStyle: { backgroundColor: '$color7' },
119
- },
120
- },
121
- } as const,
122
-
123
- defaultVariants: {
124
- unstyled: process.env.TAMAGUI_HEADLESS === '1',
125
- },
70
+ height: 24,
126
71
  })
127
72
 
128
73
  /* -------------------------------------------------------------------------------------------------
129
- * DefaultCloseIcon
74
+ * DefaultCloseIcon - dependency-free glyph (inherits color; the skin sets it).
130
75
  * -----------------------------------------------------------------------------------------------*/
131
76
 
132
- export const DefaultCloseIcon = () => (
133
- <SizableText size="$1" color="$color11">
134
- ✕
135
- </SizableText>
136
- )
77
+ export const DefaultCloseIcon = () => <SizableText size="1">✕</SizableText>
package/src/ToastState.ts CHANGED
@@ -8,6 +8,7 @@ export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' | '
8
8
 
9
9
  export interface ToastT {
10
10
  id: string | number
11
+ toasterId?: string
11
12
  title: React.ReactNode | (() => React.ReactNode)
12
13
  description?: React.ReactNode | (() => React.ReactNode)
13
14
  type?: ToastType
package/src/index.ts CHANGED
@@ -1,3 +1,35 @@
1
- export * from './Toast'
2
- export type { SwipeDirection } from './ToastProvider'
1
+ // @tamagui/toast — the unstyled composable + imperative toast API. Most apps
2
+ // should import the styled version from `tamagui` instead; this package is the
3
+ // behavior layer the skin is built on.
4
+ //
5
+ // The old imperative surface (ToastProvider/ToastViewport/useToastController/
6
+ // useToastState) was removed in v3; see the upgrade guide. Native OS toasts are
7
+ // optional — install `burnt` and pass `native` only if you want them.
8
+
9
+ // composable component API
10
+ export { Toast, useToasts, useToastItem } from './ToastComposable'
11
+ export type {
12
+ ToastRootProps,
13
+ ToastViewportProps,
14
+ ToastItemProps,
15
+ ToastItemRenderProps,
16
+ ToastListProps,
17
+ ToastPosition,
18
+ ToastIcons,
19
+ } from './ToastComposable'
20
+
21
+ // imperative API
22
+ export { toast } from './ToastState'
23
+ export type {
24
+ ToastT,
25
+ ToastType,
26
+ ToastToDismiss,
27
+ ExternalToast,
28
+ PromiseT,
29
+ PromiseData,
30
+ ToastAction,
31
+ } from './ToastState'
32
+
33
+ export type { SwipeDirection } from './types'
3
34
  export type { BurntToastOptions, CreateNativeToastOptions, NativeToastRef } from './types'
35
+ export { requestNotificationPermission } from './createNativeToast'
package/src/types.ts CHANGED
@@ -1,3 +1,14 @@
1
+ // swipe-to-dismiss direction for the composable toast viewport (relocated here
2
+ // from the removed v1 ToastProvider so the v2 drag-gesture code can share it).
3
+ export type SwipeDirection =
4
+ | 'vertical'
5
+ | 'up'
6
+ | 'down'
7
+ | 'horizontal'
8
+ | 'left'
9
+ | 'right'
10
+ | 'auto'
11
+
1
12
  // from `burnt`
2
13
  type BurntLayout = {
3
14
  iconSize?: {
@@ -13,7 +13,7 @@ import { getGestureHandler } from '@tamagui/native'
13
13
  import * as React from 'react'
14
14
  import type { PanResponderGestureState } from 'react-native'
15
15
  import { PanResponder } from 'react-native'
16
- import type { SwipeDirection } from './ToastProvider'
16
+ import type { SwipeDirection } from './types'
17
17
 
18
18
  export interface UseAnimatedDragGestureOptions {
19
19
  direction: SwipeDirection
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import * as React from 'react'
7
- import type { SwipeDirection } from './ToastProvider'
7
+ import type { SwipeDirection } from './types'
8
8
 
9
9
  export interface UseAnimatedDragGestureOptions {
10
10
  direction: SwipeDirection