@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.
- package/dist/cjs/ToastComposable.cjs +773 -882
- package/dist/cjs/ToastComposable.native.cjs +924 -0
- package/dist/cjs/ToastComposable.native.js +854 -966
- package/dist/cjs/ToastComposable.native.js.map +1 -1
- package/dist/cjs/ToastItemFrame.cjs +48 -119
- package/dist/cjs/ToastItemFrame.native.cjs +76 -0
- package/dist/cjs/ToastItemFrame.native.js +50 -120
- package/dist/cjs/ToastItemFrame.native.js.map +1 -1
- package/dist/cjs/ToastState.cjs +281 -290
- package/dist/cjs/ToastState.native.cjs +312 -0
- package/dist/cjs/ToastState.native.js +280 -290
- package/dist/cjs/ToastState.native.js.map +1 -1
- package/dist/cjs/createNativeToast.cjs +38 -44
- package/dist/cjs/createNativeToast.native.cjs +54 -0
- package/dist/cjs/createNativeToast.native.js +36 -40
- package/dist/cjs/createNativeToast.native.js.map +1 -1
- package/dist/cjs/dispatchNativeToast.cjs +32 -35
- package/dist/cjs/dispatchNativeToast.native.cjs +48 -0
- package/dist/cjs/dispatchNativeToast.native.js +34 -36
- package/dist/cjs/dispatchNativeToast.native.js.map +1 -1
- package/dist/cjs/index.cjs +25 -12
- package/dist/cjs/index.native.cjs +35 -0
- package/dist/cjs/index.native.js +26 -12
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useAnimatedDragGesture.cjs +197 -194
- package/dist/cjs/useAnimatedDragGesture.native.cjs +210 -0
- package/dist/cjs/useAnimatedDragGesture.native.js +179 -191
- package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/cjs/useReducedMotion.cjs +47 -55
- package/dist/cjs/useReducedMotion.native.cjs +74 -0
- package/dist/cjs/useReducedMotion.native.js +53 -60
- package/dist/cjs/useReducedMotion.native.js.map +1 -1
- package/dist/cjs/useToastAnimations.cjs +198 -270
- package/dist/cjs/useToastAnimations.native.cjs +229 -0
- package/dist/cjs/useToastAnimations.native.js +205 -276
- package/dist/cjs/useToastAnimations.native.js.map +1 -1
- package/dist/esm/ToastComposable.mjs +752 -854
- package/dist/esm/ToastComposable.mjs.map +1 -1
- package/dist/esm/ToastComposable.native.js +834 -940
- package/dist/esm/ToastComposable.native.js.map +1 -1
- package/dist/esm/ToastItemFrame.mjs +31 -99
- package/dist/esm/ToastItemFrame.mjs.map +1 -1
- package/dist/esm/ToastItemFrame.native.js +34 -102
- package/dist/esm/ToastItemFrame.native.js.map +1 -1
- package/dist/esm/ToastState.mjs +266 -273
- package/dist/esm/ToastState.mjs.map +1 -1
- package/dist/esm/ToastState.native.js +265 -274
- package/dist/esm/ToastState.native.js.map +1 -1
- package/dist/esm/createNativeToast.mjs +22 -26
- package/dist/esm/createNativeToast.mjs.map +1 -1
- package/dist/esm/createNativeToast.native.js +21 -23
- package/dist/esm/createNativeToast.native.js.map +1 -1
- package/dist/esm/dispatchNativeToast.mjs +19 -17
- package/dist/esm/dispatchNativeToast.mjs.map +1 -1
- package/dist/esm/dispatchNativeToast.native.js +21 -19
- package/dist/esm/dispatchNativeToast.native.js.map +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.mjs +5 -2
- package/dist/esm/index.native.js +5 -2
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useAnimatedDragGesture.mjs +181 -168
- package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/esm/useAnimatedDragGesture.native.js +163 -166
- package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/esm/useReducedMotion.mjs +31 -29
- package/dist/esm/useReducedMotion.mjs.map +1 -1
- package/dist/esm/useReducedMotion.native.js +37 -35
- package/dist/esm/useReducedMotion.native.js.map +1 -1
- package/dist/esm/useToastAnimations.mjs +183 -245
- package/dist/esm/useToastAnimations.mjs.map +1 -1
- package/dist/esm/useToastAnimations.native.js +190 -252
- package/dist/esm/useToastAnimations.native.js.map +1 -1
- package/dist/jsx/ToastComposable.mjs +752 -854
- package/dist/jsx/ToastComposable.mjs.map +1 -1
- package/dist/jsx/ToastComposable.native.cjs +924 -0
- package/dist/jsx/ToastComposable.native.js +854 -966
- package/dist/jsx/ToastComposable.native.js.map +1 -1
- package/dist/jsx/ToastItemFrame.mjs +31 -99
- package/dist/jsx/ToastItemFrame.mjs.map +1 -1
- package/dist/jsx/ToastItemFrame.native.cjs +76 -0
- package/dist/jsx/ToastItemFrame.native.js +50 -120
- package/dist/jsx/ToastItemFrame.native.js.map +1 -1
- package/dist/jsx/ToastState.mjs +266 -273
- package/dist/jsx/ToastState.mjs.map +1 -1
- package/dist/jsx/ToastState.native.cjs +312 -0
- package/dist/jsx/ToastState.native.js +280 -290
- package/dist/jsx/ToastState.native.js.map +1 -1
- package/dist/jsx/createNativeToast.mjs +22 -26
- package/dist/jsx/createNativeToast.mjs.map +1 -1
- package/dist/jsx/createNativeToast.native.cjs +54 -0
- package/dist/jsx/createNativeToast.native.js +36 -40
- package/dist/jsx/createNativeToast.native.js.map +1 -1
- package/dist/jsx/dispatchNativeToast.mjs +19 -17
- package/dist/jsx/dispatchNativeToast.mjs.map +1 -1
- package/dist/jsx/dispatchNativeToast.native.cjs +48 -0
- package/dist/jsx/dispatchNativeToast.native.js +34 -36
- package/dist/jsx/dispatchNativeToast.native.js.map +1 -1
- package/dist/jsx/index.js +5 -2
- package/dist/jsx/index.mjs +5 -2
- package/dist/jsx/index.native.cjs +35 -0
- package/dist/jsx/index.native.js +26 -12
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +19 -0
- package/dist/jsx/types.native.js +10 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/dist/jsx/useAnimatedDragGesture.mjs +181 -168
- package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/jsx/useAnimatedDragGesture.native.cjs +210 -0
- package/dist/jsx/useAnimatedDragGesture.native.js +179 -191
- package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/jsx/useReducedMotion.mjs +31 -29
- package/dist/jsx/useReducedMotion.mjs.map +1 -1
- package/dist/jsx/useReducedMotion.native.cjs +74 -0
- package/dist/jsx/useReducedMotion.native.js +53 -60
- package/dist/jsx/useReducedMotion.native.js.map +1 -1
- package/dist/jsx/useToastAnimations.mjs +183 -245
- package/dist/jsx/useToastAnimations.mjs.map +1 -1
- package/dist/jsx/useToastAnimations.native.cjs +229 -0
- package/dist/jsx/useToastAnimations.native.js +205 -276
- package/dist/jsx/useToastAnimations.native.js.map +1 -1
- package/package.json +20 -37
- package/src/ToastComposable.tsx +55 -97
- package/src/ToastItemFrame.tsx +22 -81
- package/src/ToastState.ts +1 -0
- package/src/index.ts +34 -2
- package/src/types.ts +11 -0
- package/src/useAnimatedDragGesture.native.ts +1 -1
- package/src/useAnimatedDragGesture.ts +1 -1
- package/src/useToastAnimations.ts +20 -36
- package/types/ToastComposable.d.ts +124 -47
- package/types/ToastComposable.d.ts.map +1 -1
- package/types/ToastItemFrame.d.ts +52 -21
- package/types/ToastItemFrame.d.ts.map +1 -1
- package/types/ToastState.d.ts +15 -11
- package/types/ToastState.d.ts.map +1 -1
- package/types/index.d.ts +6 -2
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +1 -0
- package/types/types.d.ts.map +1 -1
- package/types/useAnimatedDragGesture.d.ts +1 -1
- package/types/useAnimatedDragGesture.d.ts.map +1 -1
- package/types/useAnimatedDragGesture.native.d.ts +1 -1
- package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
- package/types/useToastAnimations.d.ts +2 -8
- package/types/useToastAnimations.d.ts.map +1 -1
- package/dist/cjs/Toast.cjs +0 -178
- package/dist/cjs/Toast.native.js +0 -181
- package/dist/cjs/Toast.native.js.map +0 -1
- package/dist/cjs/ToastAnnounce.cjs +0 -103
- package/dist/cjs/ToastAnnounce.native.js +0 -111
- package/dist/cjs/ToastAnnounce.native.js.map +0 -1
- package/dist/cjs/ToastImperative.cjs +0 -119
- package/dist/cjs/ToastImperative.native.js +0 -130
- package/dist/cjs/ToastImperative.native.js.map +0 -1
- package/dist/cjs/ToastImpl.cjs +0 -354
- package/dist/cjs/ToastImpl.native.js +0 -364
- package/dist/cjs/ToastImpl.native.js.map +0 -1
- package/dist/cjs/ToastPortal.cjs +0 -49
- package/dist/cjs/ToastPortal.native.js +0 -52
- package/dist/cjs/ToastPortal.native.js.map +0 -1
- package/dist/cjs/ToastProvider.cjs +0 -150
- package/dist/cjs/ToastProvider.native.js +0 -161
- package/dist/cjs/ToastProvider.native.js.map +0 -1
- package/dist/cjs/ToastViewport.cjs +0 -319
- package/dist/cjs/ToastViewport.native.js +0 -343
- package/dist/cjs/ToastViewport.native.js.map +0 -1
- package/dist/cjs/Toaster.cjs +0 -87
- package/dist/cjs/Toaster.native.js +0 -91
- package/dist/cjs/Toaster.native.js.map +0 -1
- package/dist/cjs/constants.cjs +0 -30
- package/dist/cjs/constants.native.js +0 -33
- package/dist/cjs/constants.native.js.map +0 -1
- package/dist/cjs/v2.cjs +0 -36
- package/dist/cjs/v2.native.js +0 -39
- package/dist/cjs/v2.native.js.map +0 -1
- package/dist/esm/Toast.mjs +0 -137
- package/dist/esm/Toast.mjs.map +0 -1
- package/dist/esm/Toast.native.js +0 -137
- package/dist/esm/Toast.native.js.map +0 -1
- package/dist/esm/ToastAnnounce.mjs +0 -66
- package/dist/esm/ToastAnnounce.mjs.map +0 -1
- package/dist/esm/ToastAnnounce.native.js +0 -71
- package/dist/esm/ToastAnnounce.native.js.map +0 -1
- package/dist/esm/ToastImperative.mjs +0 -80
- package/dist/esm/ToastImperative.mjs.map +0 -1
- package/dist/esm/ToastImperative.native.js +0 -88
- package/dist/esm/ToastImperative.native.js.map +0 -1
- package/dist/esm/ToastImpl.mjs +0 -316
- package/dist/esm/ToastImpl.mjs.map +0 -1
- package/dist/esm/ToastImpl.native.js +0 -329
- package/dist/esm/ToastImpl.native.js.map +0 -1
- package/dist/esm/ToastPortal.mjs +0 -24
- package/dist/esm/ToastPortal.mjs.map +0 -1
- package/dist/esm/ToastPortal.native.js +0 -24
- package/dist/esm/ToastPortal.native.js.map +0 -1
- package/dist/esm/ToastProvider.mjs +0 -110
- package/dist/esm/ToastProvider.mjs.map +0 -1
- package/dist/esm/ToastProvider.native.js +0 -118
- package/dist/esm/ToastProvider.native.js.map +0 -1
- package/dist/esm/ToastViewport.mjs +0 -280
- package/dist/esm/ToastViewport.mjs.map +0 -1
- package/dist/esm/ToastViewport.native.js +0 -301
- package/dist/esm/ToastViewport.native.js.map +0 -1
- package/dist/esm/Toaster.mjs +0 -51
- package/dist/esm/Toaster.mjs.map +0 -1
- package/dist/esm/Toaster.native.js +0 -52
- package/dist/esm/Toaster.native.js.map +0 -1
- package/dist/esm/constants.mjs +0 -4
- package/dist/esm/constants.mjs.map +0 -1
- package/dist/esm/constants.native.js +0 -4
- package/dist/esm/constants.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/v2.mjs +0 -6
- package/dist/esm/v2.mjs.map +0 -1
- package/dist/esm/v2.native.js +0 -6
- package/dist/esm/v2.native.js.map +0 -1
- package/dist/jsx/Toast.mjs +0 -137
- package/dist/jsx/Toast.mjs.map +0 -1
- package/dist/jsx/Toast.native.js +0 -181
- package/dist/jsx/Toast.native.js.map +0 -1
- package/dist/jsx/ToastAnnounce.mjs +0 -66
- package/dist/jsx/ToastAnnounce.mjs.map +0 -1
- package/dist/jsx/ToastAnnounce.native.js +0 -111
- package/dist/jsx/ToastAnnounce.native.js.map +0 -1
- package/dist/jsx/ToastImperative.mjs +0 -80
- package/dist/jsx/ToastImperative.mjs.map +0 -1
- package/dist/jsx/ToastImperative.native.js +0 -130
- package/dist/jsx/ToastImperative.native.js.map +0 -1
- package/dist/jsx/ToastImpl.mjs +0 -316
- package/dist/jsx/ToastImpl.mjs.map +0 -1
- package/dist/jsx/ToastImpl.native.js +0 -364
- package/dist/jsx/ToastImpl.native.js.map +0 -1
- package/dist/jsx/ToastPortal.mjs +0 -24
- package/dist/jsx/ToastPortal.mjs.map +0 -1
- package/dist/jsx/ToastPortal.native.js +0 -52
- package/dist/jsx/ToastPortal.native.js.map +0 -1
- package/dist/jsx/ToastProvider.mjs +0 -110
- package/dist/jsx/ToastProvider.mjs.map +0 -1
- package/dist/jsx/ToastProvider.native.js +0 -161
- package/dist/jsx/ToastProvider.native.js.map +0 -1
- package/dist/jsx/ToastViewport.mjs +0 -280
- package/dist/jsx/ToastViewport.mjs.map +0 -1
- package/dist/jsx/ToastViewport.native.js +0 -343
- package/dist/jsx/ToastViewport.native.js.map +0 -1
- package/dist/jsx/Toaster.mjs +0 -51
- package/dist/jsx/Toaster.mjs.map +0 -1
- package/dist/jsx/Toaster.native.js +0 -91
- package/dist/jsx/Toaster.native.js.map +0 -1
- package/dist/jsx/constants.mjs +0 -4
- package/dist/jsx/constants.mjs.map +0 -1
- package/dist/jsx/constants.native.js +0 -33
- package/dist/jsx/constants.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/v2.mjs +0 -6
- package/dist/jsx/v2.mjs.map +0 -1
- package/dist/jsx/v2.native.js +0 -39
- package/dist/jsx/v2.native.js.map +0 -1
- package/src/Toast.tsx +0 -219
- package/src/ToastAnnounce.tsx +0 -103
- package/src/ToastImperative.tsx +0 -192
- package/src/ToastImpl.tsx +0 -514
- package/src/ToastPortal.tsx +0 -19
- package/src/ToastProvider.tsx +0 -204
- package/src/ToastViewport.tsx +0 -430
- package/src/Toaster.tsx +0 -181
- package/src/constants.ts +0 -2
- package/src/v2.ts +0 -31
- package/types/Toast.d.ts +0 -84
- package/types/Toast.d.ts.map +0 -1
- package/types/ToastAnnounce.d.ts +0 -18
- package/types/ToastAnnounce.d.ts.map +0 -1
- package/types/ToastImperative.d.ts +0 -95
- package/types/ToastImperative.d.ts.map +0 -1
- package/types/ToastImpl.d.ts +0 -109
- package/types/ToastImpl.d.ts.map +0 -1
- package/types/ToastPortal.d.ts +0 -8
- package/types/ToastPortal.d.ts.map +0 -1
- package/types/ToastProvider.d.ts +0 -92
- package/types/ToastProvider.d.ts.map +0 -1
- package/types/ToastViewport.d.ts +0 -75
- package/types/ToastViewport.d.ts.map +0 -1
- package/types/Toaster.d.ts +0 -112
- package/types/Toaster.d.ts.map +0 -1
- package/types/constants.d.ts +0 -3
- package/types/constants.d.ts.map +0 -1
- package/types/v2.d.ts +0 -10
- package/types/v2.d.ts.map +0 -1
- package/v2/index.cjs +0 -2
- package/v2/index.js +0 -2
- package/v2/index.native.cjs +0 -2
- package/v2/index.native.js +0 -2
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/toast",
|
|
3
|
-
"version": "
|
|
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": "
|
|
48
|
-
"@tamagui/collection": "
|
|
49
|
-
"@tamagui/compose-refs": "
|
|
50
|
-
"@tamagui/constants": "
|
|
51
|
-
"@tamagui/core": "
|
|
52
|
-
"@tamagui/create-context": "
|
|
53
|
-
"@tamagui/dismissable": "
|
|
54
|
-
"@tamagui/helpers": "
|
|
55
|
-
"@tamagui/native": "
|
|
56
|
-
"@tamagui/polyfill-dev": "
|
|
57
|
-
"@tamagui/portal": "
|
|
58
|
-
"@tamagui/stacks": "
|
|
59
|
-
"@tamagui/start-transition": "
|
|
60
|
-
"@tamagui/text": "
|
|
61
|
-
"@tamagui/use-controllable-state": "
|
|
62
|
-
"@tamagui/visually-hidden": "
|
|
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": "
|
|
55
|
+
"@tamagui/build": "3.0.0-beta.643.1",
|
|
66
56
|
"react": ">=19",
|
|
67
|
-
"react-native": "0.
|
|
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",
|
package/src/ToastComposable.tsx
CHANGED
|
@@ -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 './
|
|
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 =
|
|
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
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
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
|
|
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 =
|
|
501
|
-
|
|
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="
|
|
775
|
+
<XStack alignItems="flex-start" gap="3">
|
|
778
776
|
<ToastIcon />
|
|
779
777
|
|
|
780
|
-
<YStack flex={1} gap="
|
|
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="
|
|
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="
|
|
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="
|
|
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
|
|
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 =
|
|
903
|
-
|
|
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
|
-
|
|
1151
|
+
aria-label={rest['aria-label']}
|
|
1167
1152
|
{...dataAttributes}
|
|
1168
1153
|
transition={
|
|
1169
1154
|
isDragging || ctx.reducedMotion ? undefined : removed ? '200ms' : '400ms'
|
|
1170
1155
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
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
|
-
|
|
1188
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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="
|
|
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="
|
|
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
|
|
package/src/ToastItemFrame.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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/
|
|
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
|
-
|
|
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 -
|
|
30
|
-
*
|
|
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
|
-
|
|
40
|
+
displayName: 'ToastItem',
|
|
35
41
|
userSelect: 'none',
|
|
36
42
|
cursor: 'default',
|
|
37
|
-
|
|
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
|
-
|
|
51
|
+
displayName: 'ToastClose',
|
|
71
52
|
render: 'button',
|
|
72
53
|
alignItems: 'center',
|
|
73
54
|
justifyContent: 'center',
|
|
74
55
|
cursor: 'pointer',
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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 './
|
|
16
|
+
import type { SwipeDirection } from './types'
|
|
17
17
|
|
|
18
18
|
export interface UseAnimatedDragGestureOptions {
|
|
19
19
|
direction: SwipeDirection
|