@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.
- package/dist/cjs/Toast.cjs +149 -141
- package/dist/cjs/Toast.native.js +149 -142
- package/dist/cjs/Toast.native.js.map +1 -1
- package/dist/cjs/ToastAnnounce.cjs +78 -72
- package/dist/cjs/ToastAnnounce.native.js +85 -79
- package/dist/cjs/ToastAnnounce.native.js.map +1 -1
- package/dist/cjs/ToastComposable.cjs +780 -591
- package/dist/cjs/ToastComposable.native.js +863 -706
- package/dist/cjs/ToastComposable.native.js.map +1 -1
- package/dist/cjs/ToastImperative.cjs +99 -80
- package/dist/cjs/ToastImperative.native.js +104 -96
- package/dist/cjs/ToastImperative.native.js.map +1 -1
- package/dist/cjs/ToastImpl.cjs +300 -238
- package/dist/cjs/ToastImpl.native.js +309 -271
- package/dist/cjs/ToastImpl.native.js.map +1 -1
- package/dist/cjs/ToastItemFrame.cjs +143 -0
- package/dist/cjs/ToastItemFrame.native.js +148 -0
- package/dist/cjs/ToastItemFrame.native.js.map +1 -0
- package/dist/cjs/ToastPortal.cjs +23 -18
- package/dist/cjs/ToastPortal.native.js +27 -22
- package/dist/cjs/ToastPortal.native.js.map +1 -1
- package/dist/cjs/ToastProvider.cjs +102 -98
- package/dist/cjs/ToastProvider.native.js +108 -106
- package/dist/cjs/ToastProvider.native.js.map +1 -1
- package/dist/cjs/ToastState.cjs +218 -155
- package/dist/cjs/ToastState.native.js +270 -203
- package/dist/cjs/ToastState.native.js.map +1 -1
- package/dist/cjs/ToastViewport.cjs +274 -233
- package/dist/cjs/ToastViewport.native.js +301 -273
- package/dist/cjs/ToastViewport.native.js.map +1 -1
- package/dist/cjs/Toaster.cjs +71 -233
- package/dist/cjs/Toaster.native.js +72 -289
- package/dist/cjs/Toaster.native.js.map +1 -1
- package/dist/cjs/constants.cjs +14 -12
- package/dist/cjs/constants.native.js +14 -12
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/createNativeToast.cjs +43 -35
- package/dist/cjs/createNativeToast.native.js +42 -30
- package/dist/cjs/createNativeToast.native.js.map +1 -1
- package/dist/cjs/dispatchNativeToast.cjs +47 -0
- package/dist/cjs/dispatchNativeToast.native.js +52 -0
- package/dist/cjs/dispatchNativeToast.native.js.map +1 -0
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +7 -5
- package/dist/cjs/types.native.js +7 -5
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useAnimatedDragGesture.cjs +184 -83
- package/dist/cjs/useAnimatedDragGesture.native.js +193 -79
- package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/cjs/useReducedMotion.cjs +44 -30
- package/dist/cjs/useReducedMotion.native.js +52 -43
- package/dist/cjs/useReducedMotion.native.js.map +1 -1
- package/dist/cjs/useToastAnimations.cjs +233 -155
- package/dist/cjs/useToastAnimations.native.js +246 -170
- package/dist/cjs/useToastAnimations.native.js.map +1 -1
- package/dist/cjs/v2.cjs +36 -0
- package/dist/cjs/v2.native.js +39 -0
- package/dist/cjs/v2.native.js.map +1 -0
- package/dist/esm/Toast.mjs +112 -106
- package/dist/esm/Toast.mjs.map +1 -1
- package/dist/esm/Toast.native.js +112 -107
- package/dist/esm/Toast.native.js.map +1 -1
- package/dist/esm/ToastAnnounce.mjs +46 -42
- package/dist/esm/ToastAnnounce.mjs.map +1 -1
- package/dist/esm/ToastAnnounce.native.js +52 -48
- package/dist/esm/ToastAnnounce.native.js.map +1 -1
- package/dist/esm/ToastComposable.mjs +742 -555
- package/dist/esm/ToastComposable.mjs.map +1 -1
- package/dist/esm/ToastComposable.native.js +825 -670
- package/dist/esm/ToastComposable.native.js.map +1 -1
- package/dist/esm/ToastImperative.mjs +71 -54
- package/dist/esm/ToastImperative.mjs.map +1 -1
- package/dist/esm/ToastImperative.native.js +76 -70
- package/dist/esm/ToastImperative.native.js.map +1 -1
- package/dist/esm/ToastImpl.mjs +261 -201
- package/dist/esm/ToastImpl.mjs.map +1 -1
- package/dist/esm/ToastImpl.native.js +270 -234
- package/dist/esm/ToastImpl.native.js.map +1 -1
- package/dist/esm/ToastItemFrame.mjs +114 -0
- package/dist/esm/ToastItemFrame.mjs.map +1 -0
- package/dist/esm/ToastItemFrame.native.js +116 -0
- package/dist/esm/ToastItemFrame.native.js.map +1 -0
- package/dist/esm/ToastPortal.mjs +8 -5
- package/dist/esm/ToastPortal.mjs.map +1 -1
- package/dist/esm/ToastPortal.native.js +12 -9
- package/dist/esm/ToastPortal.native.js.map +1 -1
- package/dist/esm/ToastProvider.mjs +71 -69
- package/dist/esm/ToastProvider.mjs.map +1 -1
- package/dist/esm/ToastProvider.native.js +77 -77
- package/dist/esm/ToastProvider.native.js.map +1 -1
- package/dist/esm/ToastState.mjs +205 -144
- package/dist/esm/ToastState.mjs.map +1 -1
- package/dist/esm/ToastState.native.js +258 -193
- package/dist/esm/ToastState.native.js.map +1 -1
- package/dist/esm/ToastViewport.mjs +238 -199
- package/dist/esm/ToastViewport.mjs.map +1 -1
- package/dist/esm/ToastViewport.native.js +265 -239
- package/dist/esm/ToastViewport.native.js.map +1 -1
- package/dist/esm/Toaster.mjs +45 -209
- package/dist/esm/Toaster.mjs.map +1 -1
- package/dist/esm/Toaster.native.js +46 -265
- package/dist/esm/Toaster.native.js.map +1 -1
- package/dist/esm/constants.mjs +2 -2
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +2 -2
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/createNativeToast.mjs +29 -24
- package/dist/esm/createNativeToast.mjs.map +1 -1
- package/dist/esm/createNativeToast.native.js +27 -18
- package/dist/esm/createNativeToast.native.js.map +1 -1
- package/dist/esm/dispatchNativeToast.mjs +22 -0
- package/dist/esm/dispatchNativeToast.mjs.map +1 -0
- package/dist/esm/dispatchNativeToast.native.js +24 -0
- package/dist/esm/dispatchNativeToast.native.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/useAnimatedDragGesture.mjs +160 -61
- package/dist/esm/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/esm/useAnimatedDragGesture.native.js +167 -55
- package/dist/esm/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/esm/useReducedMotion.mjs +18 -6
- package/dist/esm/useReducedMotion.mjs.map +1 -1
- package/dist/esm/useReducedMotion.native.js +25 -18
- package/dist/esm/useReducedMotion.native.js.map +1 -1
- package/dist/esm/useToastAnimations.mjs +206 -130
- package/dist/esm/useToastAnimations.mjs.map +1 -1
- package/dist/esm/useToastAnimations.native.js +218 -144
- package/dist/esm/useToastAnimations.native.js.map +1 -1
- package/dist/esm/v2.mjs +6 -0
- package/dist/esm/v2.mjs.map +1 -0
- package/dist/esm/v2.native.js +6 -0
- package/dist/esm/v2.native.js.map +1 -0
- package/dist/jsx/Toast.mjs +112 -106
- package/dist/jsx/Toast.mjs.map +1 -1
- package/dist/jsx/Toast.native.js +149 -142
- package/dist/jsx/Toast.native.js.map +1 -1
- package/dist/jsx/ToastAnnounce.mjs +46 -42
- package/dist/jsx/ToastAnnounce.mjs.map +1 -1
- package/dist/jsx/ToastAnnounce.native.js +85 -79
- package/dist/jsx/ToastAnnounce.native.js.map +1 -1
- package/dist/jsx/ToastComposable.mjs +742 -555
- package/dist/jsx/ToastComposable.mjs.map +1 -1
- package/dist/jsx/ToastComposable.native.js +863 -706
- package/dist/jsx/ToastComposable.native.js.map +1 -1
- package/dist/jsx/ToastImperative.mjs +71 -54
- package/dist/jsx/ToastImperative.mjs.map +1 -1
- package/dist/jsx/ToastImperative.native.js +104 -96
- package/dist/jsx/ToastImperative.native.js.map +1 -1
- package/dist/jsx/ToastImpl.mjs +261 -201
- package/dist/jsx/ToastImpl.mjs.map +1 -1
- package/dist/jsx/ToastImpl.native.js +309 -271
- package/dist/jsx/ToastImpl.native.js.map +1 -1
- package/dist/jsx/ToastItemFrame.mjs +114 -0
- package/dist/jsx/ToastItemFrame.mjs.map +1 -0
- package/dist/jsx/ToastItemFrame.native.js +148 -0
- package/dist/jsx/ToastItemFrame.native.js.map +1 -0
- package/dist/jsx/ToastPortal.mjs +8 -5
- package/dist/jsx/ToastPortal.mjs.map +1 -1
- package/dist/jsx/ToastPortal.native.js +27 -22
- package/dist/jsx/ToastPortal.native.js.map +1 -1
- package/dist/jsx/ToastProvider.mjs +71 -69
- package/dist/jsx/ToastProvider.mjs.map +1 -1
- package/dist/jsx/ToastProvider.native.js +108 -106
- package/dist/jsx/ToastProvider.native.js.map +1 -1
- package/dist/jsx/ToastState.mjs +205 -144
- package/dist/jsx/ToastState.mjs.map +1 -1
- package/dist/jsx/ToastState.native.js +270 -203
- package/dist/jsx/ToastState.native.js.map +1 -1
- package/dist/jsx/ToastViewport.mjs +238 -199
- package/dist/jsx/ToastViewport.mjs.map +1 -1
- package/dist/jsx/ToastViewport.native.js +301 -273
- package/dist/jsx/ToastViewport.native.js.map +1 -1
- package/dist/jsx/Toaster.mjs +45 -209
- package/dist/jsx/Toaster.mjs.map +1 -1
- package/dist/jsx/Toaster.native.js +72 -289
- package/dist/jsx/Toaster.native.js.map +1 -1
- package/dist/jsx/constants.mjs +2 -2
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.js +14 -12
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/createNativeToast.mjs +29 -24
- package/dist/jsx/createNativeToast.mjs.map +1 -1
- package/dist/jsx/createNativeToast.native.js +42 -30
- package/dist/jsx/createNativeToast.native.js.map +1 -1
- package/dist/jsx/dispatchNativeToast.mjs +22 -0
- package/dist/jsx/dispatchNativeToast.mjs.map +1 -0
- package/dist/jsx/dispatchNativeToast.native.js +52 -0
- package/dist/jsx/dispatchNativeToast.native.js.map +1 -0
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/types.native.js +7 -5
- package/dist/jsx/useAnimatedDragGesture.mjs +160 -61
- package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -1
- package/dist/jsx/useAnimatedDragGesture.native.js +193 -79
- package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -1
- package/dist/jsx/useReducedMotion.mjs +18 -6
- package/dist/jsx/useReducedMotion.mjs.map +1 -1
- package/dist/jsx/useReducedMotion.native.js +52 -43
- package/dist/jsx/useReducedMotion.native.js.map +1 -1
- package/dist/jsx/useToastAnimations.mjs +206 -130
- package/dist/jsx/useToastAnimations.mjs.map +1 -1
- package/dist/jsx/useToastAnimations.native.js +246 -170
- package/dist/jsx/useToastAnimations.native.js.map +1 -1
- package/dist/jsx/v2.mjs +6 -0
- package/dist/jsx/v2.mjs.map +1 -0
- package/dist/jsx/v2.native.js +39 -0
- package/dist/jsx/v2.native.js.map +1 -0
- package/package.json +42 -29
- package/src/ToastComposable.tsx +1380 -0
- package/src/ToastImpl.tsx +14 -2
- package/src/ToastItemFrame.tsx +136 -0
- package/src/ToastPortal.tsx +2 -2
- package/src/ToastProvider.tsx +8 -1
- package/src/ToastState.ts +398 -0
- package/src/ToastViewport.tsx +4 -3
- package/src/Toaster.tsx +181 -0
- package/src/createNativeToast.native.tsx +4 -0
- package/src/createNativeToast.tsx +18 -24
- package/src/dispatchNativeToast.ts +43 -0
- package/src/useAnimatedDragGesture.native.ts +255 -0
- package/src/useAnimatedDragGesture.ts +319 -0
- package/src/useReducedMotion.ts +59 -0
- package/src/useToastAnimations.ts +372 -0
- package/src/v2.ts +31 -0
- package/types/ToastComposable.d.ts +199 -0
- package/types/ToastComposable.d.ts.map +1 -1
- package/types/ToastImpl.d.ts.map +1 -1
- package/types/ToastItemFrame.d.ts +25 -0
- package/types/ToastItemFrame.d.ts.map +1 -0
- package/types/ToastPortal.d.ts.map +1 -1
- package/types/ToastProvider.d.ts +1 -1
- package/types/ToastProvider.d.ts.map +1 -1
- package/types/ToastState.d.ts +179 -0
- package/types/ToastState.d.ts.map +1 -1
- package/types/ToastViewport.d.ts.map +1 -1
- package/types/Toaster.d.ts +112 -0
- package/types/Toaster.d.ts.map +1 -1
- package/types/createNativeToast.d.ts +5 -0
- package/types/createNativeToast.d.ts.map +1 -1
- package/types/createNativeToast.native.d.ts +1 -0
- package/types/createNativeToast.native.d.ts.map +1 -1
- package/types/dispatchNativeToast.d.ts +12 -0
- package/types/dispatchNativeToast.d.ts.map +1 -0
- package/types/useAnimatedDragGesture.d.ts +33 -0
- package/types/useAnimatedDragGesture.d.ts.map +1 -1
- package/types/useAnimatedDragGesture.native.d.ts +33 -0
- package/types/useAnimatedDragGesture.native.d.ts.map +1 -1
- package/types/useReducedMotion.d.ts +6 -0
- package/types/useToastAnimations.d.ts +50 -0
- package/types/useToastAnimations.d.ts.map +1 -1
- package/types/v2.d.ts +10 -0
- package/types/v2.d.ts.map +1 -0
- package/v2/index.cjs +2 -0
- package/v2/index.js +2 -0
- package/v2/index.native.cjs +2 -0
- package/v2/index.native.js +2 -0
- package/LICENSE +0 -21
- package/dist/cjs/Toast.js +0 -119
- package/dist/cjs/Toast.js.map +0 -6
- package/dist/cjs/ToastAnnounce.js +0 -72
- package/dist/cjs/ToastAnnounce.js.map +0 -6
- package/dist/cjs/ToastComposable.js +0 -548
- package/dist/cjs/ToastComposable.js.map +0 -6
- package/dist/cjs/ToastImperative.js +0 -71
- package/dist/cjs/ToastImperative.js.map +0 -6
- package/dist/cjs/ToastImpl.js +0 -227
- package/dist/cjs/ToastImpl.js.map +0 -6
- package/dist/cjs/ToastItem.cjs +0 -526
- package/dist/cjs/ToastItem.js +0 -409
- package/dist/cjs/ToastItem.js.map +0 -6
- package/dist/cjs/ToastItem.native.js +0 -614
- package/dist/cjs/ToastItem.native.js.map +0 -1
- package/dist/cjs/ToastPortal.js +0 -26
- package/dist/cjs/ToastPortal.js.map +0 -6
- package/dist/cjs/ToastProvider.js +0 -105
- package/dist/cjs/ToastProvider.js.map +0 -6
- package/dist/cjs/ToastState.js +0 -160
- package/dist/cjs/ToastState.js.map +0 -6
- package/dist/cjs/ToastViewport.js +0 -263
- package/dist/cjs/ToastViewport.js.map +0 -6
- package/dist/cjs/Toaster.js +0 -204
- package/dist/cjs/Toaster.js.map +0 -6
- package/dist/cjs/constants.js +0 -22
- package/dist/cjs/constants.js.map +0 -6
- package/dist/cjs/createNativeToast.js +0 -44
- package/dist/cjs/createNativeToast.js.map +0 -6
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/types.js.map +0 -6
- package/dist/cjs/useAnimatedDragGesture.js +0 -97
- package/dist/cjs/useAnimatedDragGesture.js.map +0 -6
- package/dist/cjs/useDragGesture.cjs +0 -129
- package/dist/cjs/useDragGesture.js +0 -100
- package/dist/cjs/useDragGesture.js.map +0 -6
- package/dist/cjs/useDragGesture.native.js +0 -146
- package/dist/cjs/useDragGesture.native.js.map +0 -1
- package/dist/cjs/useReducedMotion.js +0 -53
- package/dist/cjs/useReducedMotion.js.map +0 -6
- package/dist/cjs/useToastAnimations.js +0 -144
- package/dist/cjs/useToastAnimations.js.map +0 -6
- package/dist/cjs/v1.cjs +0 -31
- package/dist/cjs/v1.js +0 -26
- package/dist/cjs/v1.js.map +0 -6
- package/dist/cjs/v1.native.js +0 -34
- package/dist/cjs/v1.native.js.map +0 -1
- package/dist/esm/Toast.js +0 -107
- package/dist/esm/Toast.js.map +0 -6
- package/dist/esm/ToastAnnounce.js +0 -55
- package/dist/esm/ToastAnnounce.js.map +0 -6
- package/dist/esm/ToastComposable.js +0 -543
- package/dist/esm/ToastComposable.js.map +0 -6
- package/dist/esm/ToastImperative.js +0 -50
- package/dist/esm/ToastImperative.js.map +0 -6
- package/dist/esm/ToastImpl.js +0 -225
- package/dist/esm/ToastImpl.js.map +0 -6
- package/dist/esm/ToastItem.js +0 -393
- package/dist/esm/ToastItem.js.map +0 -6
- package/dist/esm/ToastItem.mjs +0 -492
- package/dist/esm/ToastItem.mjs.map +0 -1
- package/dist/esm/ToastItem.native.js +0 -577
- package/dist/esm/ToastItem.native.js.map +0 -1
- package/dist/esm/ToastPortal.js +0 -13
- package/dist/esm/ToastPortal.js.map +0 -6
- package/dist/esm/ToastProvider.js +0 -87
- package/dist/esm/ToastProvider.js.map +0 -6
- package/dist/esm/ToastState.js +0 -144
- package/dist/esm/ToastState.js.map +0 -6
- package/dist/esm/ToastViewport.js +0 -250
- package/dist/esm/ToastViewport.js.map +0 -6
- package/dist/esm/Toaster.js +0 -188
- package/dist/esm/Toaster.js.map +0 -6
- package/dist/esm/constants.js +0 -6
- package/dist/esm/constants.js.map +0 -6
- package/dist/esm/createNativeToast.js +0 -28
- package/dist/esm/createNativeToast.js.map +0 -6
- package/dist/esm/types.js +0 -1
- package/dist/esm/types.js.map +0 -6
- package/dist/esm/useAnimatedDragGesture.js +0 -73
- package/dist/esm/useAnimatedDragGesture.js.map +0 -6
- package/dist/esm/useDragGesture.js +0 -76
- package/dist/esm/useDragGesture.js.map +0 -6
- package/dist/esm/useDragGesture.mjs +0 -95
- package/dist/esm/useDragGesture.mjs.map +0 -1
- package/dist/esm/useDragGesture.native.js +0 -109
- package/dist/esm/useDragGesture.native.js.map +0 -1
- package/dist/esm/useReducedMotion.js +0 -30
- package/dist/esm/useReducedMotion.js.map +0 -6
- package/dist/esm/useToastAnimations.js +0 -122
- package/dist/esm/useToastAnimations.js.map +0 -6
- package/dist/esm/v1.js +0 -17
- package/dist/esm/v1.js.map +0 -6
- package/dist/esm/v1.mjs +0 -3
- package/dist/esm/v1.mjs.map +0 -1
- package/dist/esm/v1.native.js +0 -3
- package/dist/esm/v1.native.js.map +0 -1
- package/dist/jsx/Toast.js +0 -107
- package/dist/jsx/Toast.js.map +0 -6
- package/dist/jsx/ToastAnnounce.js +0 -55
- package/dist/jsx/ToastAnnounce.js.map +0 -6
- package/dist/jsx/ToastComposable.js +0 -543
- package/dist/jsx/ToastComposable.js.map +0 -6
- package/dist/jsx/ToastImperative.js +0 -50
- package/dist/jsx/ToastImperative.js.map +0 -6
- package/dist/jsx/ToastImpl.js +0 -225
- package/dist/jsx/ToastImpl.js.map +0 -6
- package/dist/jsx/ToastItem.js +0 -393
- package/dist/jsx/ToastItem.js.map +0 -6
- package/dist/jsx/ToastItem.mjs +0 -492
- package/dist/jsx/ToastItem.mjs.map +0 -1
- package/dist/jsx/ToastItem.native.js +0 -614
- package/dist/jsx/ToastItem.native.js.map +0 -1
- package/dist/jsx/ToastPortal.js +0 -13
- package/dist/jsx/ToastPortal.js.map +0 -6
- package/dist/jsx/ToastProvider.js +0 -87
- package/dist/jsx/ToastProvider.js.map +0 -6
- package/dist/jsx/ToastState.js +0 -144
- package/dist/jsx/ToastState.js.map +0 -6
- package/dist/jsx/ToastViewport.js +0 -250
- package/dist/jsx/ToastViewport.js.map +0 -6
- package/dist/jsx/Toaster.js +0 -188
- package/dist/jsx/Toaster.js.map +0 -6
- package/dist/jsx/constants.js +0 -6
- package/dist/jsx/constants.js.map +0 -6
- package/dist/jsx/createNativeToast.js +0 -28
- package/dist/jsx/createNativeToast.js.map +0 -6
- package/dist/jsx/types.js +0 -1
- package/dist/jsx/types.js.map +0 -6
- package/dist/jsx/useAnimatedDragGesture.js +0 -73
- package/dist/jsx/useAnimatedDragGesture.js.map +0 -6
- package/dist/jsx/useDragGesture.js +0 -76
- package/dist/jsx/useDragGesture.js.map +0 -6
- package/dist/jsx/useDragGesture.mjs +0 -95
- package/dist/jsx/useDragGesture.mjs.map +0 -1
- package/dist/jsx/useDragGesture.native.js +0 -146
- package/dist/jsx/useDragGesture.native.js.map +0 -1
- package/dist/jsx/useReducedMotion.js +0 -30
- package/dist/jsx/useReducedMotion.js.map +0 -6
- package/dist/jsx/useToastAnimations.js +0 -122
- package/dist/jsx/useToastAnimations.js.map +0 -6
- package/dist/jsx/v1.js +0 -17
- package/dist/jsx/v1.js.map +0 -6
- package/dist/jsx/v1.mjs +0 -3
- package/dist/jsx/v1.mjs.map +0 -1
- package/dist/jsx/v1.native.js +0 -34
- package/dist/jsx/v1.native.js.map +0 -1
- package/types/ToastItem.d.ts.map +0 -1
- package/types/useDragGesture.d.ts.map +0 -1
- package/types/useDragGesture.native.d.ts.map +0 -1
- package/types/v1.d.ts.map +0 -1
package/dist/cjs/Toaster.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var Toaster_exports = {};
|
|
24
|
-
__export(Toaster_exports, {
|
|
25
|
-
Toaster: () => Toaster
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(Toaster_exports);
|
|
28
|
-
var import_animate_presence = require("@tamagui/animate-presence"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), React = __toESM(require("react"), 1), import_ToastItem = require("./ToastItem"), import_ToastState = require("./ToastState"), import_useReducedMotion = require("./useReducedMotion"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
-
const VISIBLE_TOASTS_AMOUNT = 4, VIEWPORT_OFFSET = 24, TOAST_GAP = 14, TOAST_LIFETIME = 4e3;
|
|
30
|
-
function resolveSwipeDirection(direction, position) {
|
|
31
|
-
if (direction !== "auto")
|
|
32
|
-
return direction;
|
|
33
|
-
const [yPosition, xPosition] = position.split("-");
|
|
34
|
-
return xPosition === "left" ? "left" : xPosition === "right" ? "right" : yPosition === "top" ? "up" : "down";
|
|
35
|
-
}
|
|
36
|
-
const TOAST_WIDTH = 356, ToasterFrame = (0, import_core.styled)(import_core.View, {
|
|
37
|
-
name: "Toaster",
|
|
38
|
-
variants: {
|
|
39
|
-
unstyled: {
|
|
40
|
-
false: {
|
|
41
|
-
position: import_constants.isWeb ? "fixed" : "absolute",
|
|
42
|
-
zIndex: 1e5,
|
|
43
|
-
pointerEvents: "box-none",
|
|
44
|
-
maxWidth: "100%",
|
|
45
|
-
// need min-height to contain absolutely positioned toasts
|
|
46
|
-
// toasts will overflow upward/downward from their anchor position
|
|
47
|
-
minHeight: 1
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
defaultVariants: {
|
|
52
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
53
|
-
}
|
|
54
|
-
}), Toaster = React.forwardRef(
|
|
55
|
-
function(props, _ref) {
|
|
56
|
-
const {
|
|
57
|
-
position = "bottom-right",
|
|
58
|
-
width = TOAST_WIDTH,
|
|
59
|
-
expand = !1,
|
|
60
|
-
visibleToasts = VISIBLE_TOASTS_AMOUNT,
|
|
61
|
-
gap = TOAST_GAP,
|
|
62
|
-
duration = TOAST_LIFETIME,
|
|
63
|
-
offset = VIEWPORT_OFFSET,
|
|
64
|
-
hotkey = ["altKey", "KeyT"],
|
|
65
|
-
swipeDirection = "auto",
|
|
66
|
-
swipeThreshold = 50,
|
|
67
|
-
closeButton = !1,
|
|
68
|
-
theme: themeProp,
|
|
69
|
-
icons,
|
|
70
|
-
toastOptions,
|
|
71
|
-
containerAriaLabel = "Notifications",
|
|
72
|
-
disableNative = !1,
|
|
73
|
-
burntOptions,
|
|
74
|
-
notificationOptions,
|
|
75
|
-
className,
|
|
76
|
-
style,
|
|
77
|
-
reducedMotion: reducedMotionProp
|
|
78
|
-
} = props, reducedMotion = (0, import_useReducedMotion.useReducedMotion)(reducedMotionProp), [toasts, setToasts] = React.useState([]), [heights, setHeights] = React.useState([]), [expanded, setExpanded] = React.useState(!1), [interacting, setInteracting] = React.useState(!1), listRef = React.useRef(null), lastFocusedElementRef = React.useRef(null), isFocusWithinRef = React.useRef(!1), hoverTimeoutRef = React.useRef(null), hoverCooldownRef = React.useRef(!1);
|
|
79
|
-
React.useEffect(() => import_ToastState.ToastState.subscribe((toast) => {
|
|
80
|
-
if (toast.dismiss) {
|
|
81
|
-
setToasts(
|
|
82
|
-
(toasts2) => toasts2.map((t) => t.id === toast.id ? { ...t, delete: !0 } : t)
|
|
83
|
-
);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
setToasts((toasts2) => {
|
|
87
|
-
const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast.id);
|
|
88
|
-
return indexOfExistingToast !== -1 ? [
|
|
89
|
-
...toasts2.slice(0, indexOfExistingToast),
|
|
90
|
-
{ ...toasts2[indexOfExistingToast], ...toast },
|
|
91
|
-
...toasts2.slice(indexOfExistingToast + 1)
|
|
92
|
-
] : [toast, ...toasts2];
|
|
93
|
-
});
|
|
94
|
-
}), []), React.useEffect(() => {
|
|
95
|
-
toasts.length <= 1 && setExpanded(!1);
|
|
96
|
-
}, [toasts.length]), React.useEffect(() => {
|
|
97
|
-
if (!import_constants.isWeb) return;
|
|
98
|
-
const handleKeyDown = (event) => {
|
|
99
|
-
hotkey.length > 0 && hotkey.every((key) => event[key] || event.code === key) && (setExpanded(!0), listRef.current?.focus()), event.code === "Escape" && (document.activeElement === listRef.current || listRef.current?.contains(document.activeElement)) && setExpanded(!1);
|
|
100
|
-
};
|
|
101
|
-
return document.addEventListener("keydown", handleKeyDown), () => document.removeEventListener("keydown", handleKeyDown);
|
|
102
|
-
}, [hotkey]), React.useEffect(() => {
|
|
103
|
-
if (!(!import_constants.isWeb || !listRef.current))
|
|
104
|
-
return () => {
|
|
105
|
-
lastFocusedElementRef.current && (lastFocusedElementRef.current.focus({ preventScroll: !0 }), lastFocusedElementRef.current = null, isFocusWithinRef.current = !1);
|
|
106
|
-
};
|
|
107
|
-
}, []), React.useEffect(() => () => {
|
|
108
|
-
hoverTimeoutRef.current && clearTimeout(hoverTimeoutRef.current);
|
|
109
|
-
}, []);
|
|
110
|
-
const removeToast = React.useCallback((toastToRemove) => {
|
|
111
|
-
hoverCooldownRef.current = !0, setTimeout(() => {
|
|
112
|
-
hoverCooldownRef.current = !1;
|
|
113
|
-
}, 300), setToasts((toasts2) => (toasts2.find((toast) => toast.id === toastToRemove.id)?.delete || import_ToastState.ToastState.dismiss(toastToRemove.id), toasts2.filter(({ id }) => id !== toastToRemove.id)));
|
|
114
|
-
}, []), [yPosition, xPosition] = position.split("-"), offsetStyles = React.useMemo(() => {
|
|
115
|
-
const styles = {}, defaultOffset = typeof offset == "number" ? offset : VIEWPORT_OFFSET, offsetObj = typeof offset == "object" ? offset : {
|
|
116
|
-
top: defaultOffset,
|
|
117
|
-
right: defaultOffset,
|
|
118
|
-
bottom: defaultOffset,
|
|
119
|
-
left: defaultOffset
|
|
120
|
-
};
|
|
121
|
-
return yPosition === "top" ? styles.top = offsetObj.top ?? defaultOffset : styles.bottom = offsetObj.bottom ?? defaultOffset, xPosition === "left" ? styles.left = offsetObj.left ?? defaultOffset : xPosition === "right" ? styles.right = offsetObj.right ?? defaultOffset : (styles.left = "50%", styles.transform = "translateX(-50%)"), styles;
|
|
122
|
-
}, [offset, yPosition, xPosition]), currentTheme = (0, import_core.useThemeName)(), resolvedTheme = themeProp === "system" || !themeProp ? currentTheme?.includes("dark") ? "dark" : "light" : themeProp, hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
123
|
-
if (toasts.length === 0)
|
|
124
|
-
return null;
|
|
125
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
-
ToasterFrame,
|
|
127
|
-
{
|
|
128
|
-
ref: listRef,
|
|
129
|
-
width,
|
|
130
|
-
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
131
|
-
tabIndex: -1,
|
|
132
|
-
"aria-live": "polite",
|
|
133
|
-
"aria-relevant": "additions text",
|
|
134
|
-
"aria-atomic": !1,
|
|
135
|
-
style: { ...offsetStyles, ...style },
|
|
136
|
-
className,
|
|
137
|
-
"data-y-position": yPosition,
|
|
138
|
-
"data-x-position": xPosition,
|
|
139
|
-
onMouseEnter: () => {
|
|
140
|
-
toasts.length > 1 && !interacting && !hoverCooldownRef.current && (hoverTimeoutRef.current = setTimeout(() => {
|
|
141
|
-
setExpanded(!0);
|
|
142
|
-
}, 50));
|
|
143
|
-
},
|
|
144
|
-
onMouseMove: () => {
|
|
145
|
-
toasts.length > 1 && !interacting && !expanded && !hoverCooldownRef.current && (hoverTimeoutRef.current || (hoverTimeoutRef.current = setTimeout(() => {
|
|
146
|
-
setExpanded(!0);
|
|
147
|
-
}, 50)));
|
|
148
|
-
},
|
|
149
|
-
onMouseLeave: () => {
|
|
150
|
-
hoverTimeoutRef.current && (clearTimeout(hoverTimeoutRef.current), hoverTimeoutRef.current = null), interacting || setExpanded(!1);
|
|
151
|
-
},
|
|
152
|
-
onPointerDown: () => {
|
|
153
|
-
hoverTimeoutRef.current && (clearTimeout(hoverTimeoutRef.current), hoverTimeoutRef.current = null), setInteracting(!0);
|
|
154
|
-
},
|
|
155
|
-
onPointerUp: () => setInteracting(!1),
|
|
156
|
-
...import_constants.isWeb && {
|
|
157
|
-
onBlur: (event) => {
|
|
158
|
-
isFocusWithinRef.current && !event.currentTarget.contains(
|
|
159
|
-
event.relatedTarget
|
|
160
|
-
) && (isFocusWithinRef.current = !1, lastFocusedElementRef.current && (lastFocusedElementRef.current.focus({ preventScroll: !0 }), lastFocusedElementRef.current = null));
|
|
161
|
-
},
|
|
162
|
-
onFocus: (event) => {
|
|
163
|
-
isFocusWithinRef.current || (isFocusWithinRef.current = !0, lastFocusedElementRef.current = event.relatedTarget);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { children: toasts.map((toast, index) => {
|
|
167
|
-
const isVisible = index < visibleToasts, isFront = index === 0, heightBeforeMe = toasts.slice(0, index).reduce((sum, t) => {
|
|
168
|
-
const h = heights.find((h2) => h2.toastId === t.id);
|
|
169
|
-
return sum + (h?.height ?? 55);
|
|
170
|
-
}, 0);
|
|
171
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
-
import_ToastItem.ToastItem,
|
|
173
|
-
{
|
|
174
|
-
toast,
|
|
175
|
-
index,
|
|
176
|
-
expanded: expanded || expand,
|
|
177
|
-
interacting,
|
|
178
|
-
position,
|
|
179
|
-
visibleToasts,
|
|
180
|
-
removeToast,
|
|
181
|
-
heights,
|
|
182
|
-
setHeights,
|
|
183
|
-
heightBeforeMe,
|
|
184
|
-
duration: toast.duration ?? toastOptions?.duration ?? duration,
|
|
185
|
-
gap,
|
|
186
|
-
swipeDirection: resolveSwipeDirection(swipeDirection, position),
|
|
187
|
-
swipeThreshold,
|
|
188
|
-
closeButton: toast.closeButton ?? closeButton,
|
|
189
|
-
icons,
|
|
190
|
-
disableNative,
|
|
191
|
-
burntOptions,
|
|
192
|
-
notificationOptions,
|
|
193
|
-
reducedMotion
|
|
194
|
-
},
|
|
195
|
-
toast.id
|
|
196
|
-
);
|
|
197
|
-
}) })
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
return import_constants.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { name: resolvedTheme, children: content }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { name: resolvedTheme, children: content });
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
Toaster.displayName = "Toaster";
|
|
204
|
-
//# sourceMappingURL=Toaster.js.map
|
package/dist/cjs/Toaster.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Toaster.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAgC,sCAChC,mBAAsB,+BAEtB,cAAkD,0BAClD,gBAAuB,4BACvB,QAAuB,8BACvB,mBAA0B,wBAG1B,oBAA2B,yBAE3B,0BAAiC,+BA6enB;AA1ed,MAAM,wBAAwB,GACxB,kBAAkB,IAClB,YAAY,IACZ,iBAAiB;AAMvB,SAAS,sBACP,WACA,UACiC;AACjC,MAAI,cAAc;AAChB,WAAO;AAIT,QAAM,CAAC,WAAW,SAAS,IAAI,SAAS,MAAM,GAAG;AAMjD,SAAI,cAAc,SAAe,SAC7B,cAAc,UAAgB,UAG3B,cAAc,QAAQ,OAAO;AACtC;AAgBA,MAAM,cAAc,KAEd,mBAAe,oBAAO,kBAAM;AAAA,EAChC,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,UAAU,yBAAS,UAAkB;AAAA,QACrC,QAAQ;AA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AAC,OAAO,UAAU;AAC5B,gBAAM,YAAY,QAAQ,eACpB,UAAU,UAAU,GAIpB,iBAAiB,OAAO,MAAM,GAAG,KAAK,EAAE,OAAO,CAAC,KAAK,MAAM;AAC/D,kBAAM,IAAI,QAAQ,KAAK,CAACC,OAAMA,GAAE,YAAY,EAAE,EAAE;AAChD,mBAAO,OAAO,GAAG,UAAU;AAAA,UAC7B,GAAG,CAAC;AAEJ,iBACE;AAAA,YAAC;AAAA;AAAA,cAEC;AAAA,cACA;AAAA,cACA,UAAU,YAAY;AAAA,cACtB;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA,UAAU,MAAM,YAAY,cAAc,YAAY;AAAA,cACtD;AAAA,cACA,gBAAgB,sBAAsB,gBAAgB,QAAQ;AAAA,cAC9D;AAAA,cACA,aAAa,MAAM,eAAe;AAAA,cAClC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,YApBK,MAAM;AAAA,UAqBb;AAAA,QAEJ,CAAC,GACH;AAAA;AAAA,IACF;AAIF,WAAI,yBAEA,4CAAC,wBACC,sDAAC,qBAAM,MAAM,eAAuB,mBAAQ,GAC9C,IAIG,4CAAC,qBAAM,MAAM,eAAuB,mBAAQ;AAAA,EACrD;AACF;AAEA,QAAQ,cAAc;",
|
|
5
|
-
"names": ["toasts", "h"]
|
|
6
|
-
}
|
package/dist/cjs/constants.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var constants_exports = {};
|
|
16
|
-
__export(constants_exports, {
|
|
17
|
-
TOAST_CONTEXT: () => TOAST_CONTEXT,
|
|
18
|
-
TOAST_NAME: () => TOAST_NAME
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(constants_exports);
|
|
21
|
-
const TOAST_NAME = "Toast", TOAST_CONTEXT = "Toast";
|
|
22
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var createNativeToast_exports = {};
|
|
16
|
-
__export(createNativeToast_exports, {
|
|
17
|
-
createNativeToast: () => createNativeToast,
|
|
18
|
-
hideNativeToast: () => hideNativeToast
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(createNativeToast_exports);
|
|
21
|
-
const createNativeToast = (title, { message, notificationOptions }) => {
|
|
22
|
-
if (!("Notification" in window))
|
|
23
|
-
return console.error("This browser does not support notifications"), !1;
|
|
24
|
-
if (Notification.permission === "denied") return !1;
|
|
25
|
-
const showNotification = () => new Notification(title, {
|
|
26
|
-
body: message,
|
|
27
|
-
...notificationOptions
|
|
28
|
-
});
|
|
29
|
-
return Notification.permission === "granted" ? {
|
|
30
|
-
nativeToastRef: showNotification()
|
|
31
|
-
} : (Notification.requestPermission().then((permission) => {
|
|
32
|
-
if (permission === "granted")
|
|
33
|
-
return {
|
|
34
|
-
nativeToastRef: showNotification()
|
|
35
|
-
};
|
|
36
|
-
}), !0);
|
|
37
|
-
}, hideNativeToast = (ref) => {
|
|
38
|
-
if (!("Notification" in window)) {
|
|
39
|
-
console.error("This browser does not support notifications");
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
ref && ref.close();
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=createNativeToast.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/createNativeToast.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,oBAA0C,CACrD,OACA,EAAE,SAAS,oBAAoB,MAC5B;AACH,MAAI,EAAE,kBAAkB;AACtB,mBAAQ,MAAM,6CAA6C,GACpD;AAGT,MAAI,aAAa,eAAe,SAAU,QAAO;AACjD,QAAM,mBAAmB,MACF,IAAI,aAAa,OAAO;AAAA,IAC3C,MAAM;AAAA,IACN,GAAG;AAAA,EACL,CAAC;AAKH,SAAI,aAAa,eAAe,YAEvB;AAAA,IACL,gBAFmB,iBAAiB;AAAA,EAGtC,KAEF,aAAa,kBAAkB,EAAE,KAAK,CAAC,eAAe;AACpD,QAAI,eAAe;AAEjB,aAAO;AAAA,QACL,gBAFmB,iBAAiB;AAAA,MAGtC;AAAA,EAEJ,CAAC,GACM;AACT,GAEa,kBAAsC,CAAC,QAAQ;AAC1D,MAAI,EAAE,kBAAkB,SAAS;AAC/B,YAAQ,MAAM,6CAA6C;AAC3D;AAAA,EACF;AAEA,EAAI,OACF,IAAI,MAAM;AAEd;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var index_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(index_exports);
|
|
14
|
-
__reExport(index_exports, require("./Toast"), module.exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
package/dist/cjs/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
};
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var types_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(types_exports);
|
|
14
|
-
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var useAnimatedDragGesture_exports = {};
|
|
24
|
-
__export(useAnimatedDragGesture_exports, {
|
|
25
|
-
useAnimatedDragGesture: () => useAnimatedDragGesture
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(useAnimatedDragGesture_exports);
|
|
28
|
-
var React = __toESM(require("react"), 1);
|
|
29
|
-
const VELOCITY_THRESHOLD = 0.11;
|
|
30
|
-
function resisted(delta, maxResist = 25) {
|
|
31
|
-
if (delta >= 0) return delta;
|
|
32
|
-
const pastBoundary = Math.abs(delta), resistedDistance = Math.sqrt(pastBoundary) * 2;
|
|
33
|
-
return -Math.min(resistedDistance, maxResist);
|
|
34
|
-
}
|
|
35
|
-
function useAnimatedDragGesture(options) {
|
|
36
|
-
const {
|
|
37
|
-
direction,
|
|
38
|
-
threshold,
|
|
39
|
-
disabled,
|
|
40
|
-
expanded,
|
|
41
|
-
onDragMove,
|
|
42
|
-
onDragStart,
|
|
43
|
-
onDismiss,
|
|
44
|
-
onCancel
|
|
45
|
-
} = options, [isDragging, setIsDragging] = React.useState(!1), dragStartRef = React.useRef(null), lockedDirectionRef = React.useRef(null), isHorizontal = direction === "left" || direction === "right" || direction === "horizontal", isVertical = direction === "up" || direction === "down" || direction === "vertical", handlePointerDown = React.useCallback(
|
|
46
|
-
(event) => {
|
|
47
|
-
disabled || event.button !== 0 || (window.getSelection()?.toString().length ?? 0) > 0 || (event.target.setPointerCapture(event.pointerId), dragStartRef.current = {
|
|
48
|
-
startX: event.clientX,
|
|
49
|
-
startY: event.clientY,
|
|
50
|
-
startTime: Date.now()
|
|
51
|
-
}, setIsDragging(!0), onDragStart?.());
|
|
52
|
-
},
|
|
53
|
-
[disabled, onDragStart]
|
|
54
|
-
), handlePointerMove = React.useCallback(
|
|
55
|
-
(event) => {
|
|
56
|
-
if (!dragStartRef.current || disabled) return;
|
|
57
|
-
const deltaX = event.clientX - dragStartRef.current.startX, deltaY = event.clientY - dragStartRef.current.startY;
|
|
58
|
-
!lockedDirectionRef.current && (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1) && (lockedDirectionRef.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y");
|
|
59
|
-
let offsetX = 0, offsetY = 0;
|
|
60
|
-
expanded ? lockedDirectionRef.current === "x" && isHorizontal ? direction === "right" ? offsetX = deltaX > 0 ? deltaX : resisted(deltaX) : direction === "left" ? offsetX = deltaX < 0 ? deltaX : -resisted(-deltaX) : offsetX = deltaX : lockedDirectionRef.current === "y" && isVertical && (direction === "down" ? offsetY = deltaY > 0 ? deltaY : resisted(deltaY) : direction === "up" ? offsetY = deltaY < 0 ? deltaY : -resisted(-deltaY) : offsetY = deltaY) : direction === "right" ? (offsetX = deltaX > 0 ? deltaX : resisted(deltaX), offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "left" ? (offsetX = deltaX < 0 ? deltaX : -resisted(-deltaX), offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "down" ? (offsetY = deltaY > 0 ? deltaY : resisted(deltaY), offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)) : direction === "up" ? (offsetY = deltaY < 0 ? deltaY : -resisted(-deltaY), offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)) : direction === "horizontal" ? (offsetX = deltaX, offsetY = deltaY > 0 ? -resisted(-deltaY) : resisted(deltaY)) : direction === "vertical" && (offsetY = deltaY, offsetX = deltaX > 0 ? -resisted(-deltaX) : resisted(deltaX)), onDragMove(offsetX, offsetY);
|
|
61
|
-
},
|
|
62
|
-
[disabled, direction, expanded, isHorizontal, isVertical, onDragMove]
|
|
63
|
-
), handlePointerUp = React.useCallback(
|
|
64
|
-
(event) => {
|
|
65
|
-
if (!dragStartRef.current || disabled) return;
|
|
66
|
-
const deltaX = event.clientX - dragStartRef.current.startX, deltaY = event.clientY - dragStartRef.current.startY, timeTaken = Date.now() - dragStartRef.current.startTime, velocityX = Math.abs(deltaX) / timeTaken, velocityY = Math.abs(deltaY) / timeTaken, lockedDirection = lockedDirectionRef.current, isLockedToWrongAxis = lockedDirection === "y" && isHorizontal || lockedDirection === "x" && isVertical, relevantDelta = isHorizontal ? deltaX : deltaY, relevantVelocity = isHorizontal ? velocityX : velocityY, passedThreshold = Math.abs(relevantDelta) >= threshold, hasVelocity = relevantVelocity > VELOCITY_THRESHOLD;
|
|
67
|
-
let exitDirection = null;
|
|
68
|
-
isLockedToWrongAxis || (direction === "right" && deltaX > 0 ? exitDirection = "right" : direction === "left" && deltaX < 0 ? exitDirection = "left" : direction === "horizontal" ? Math.abs(deltaX) > Math.abs(deltaY) && (exitDirection = deltaX > 0 ? "right" : "left") : direction === "down" && deltaY > 0 ? exitDirection = "down" : direction === "up" && deltaY < 0 ? exitDirection = "up" : direction === "vertical" && Math.abs(deltaY) > Math.abs(deltaX) && (exitDirection = deltaY > 0 ? "down" : "up"));
|
|
69
|
-
const shouldDismiss = exitDirection && (passedThreshold || hasVelocity);
|
|
70
|
-
try {
|
|
71
|
-
event.target.releasePointerCapture(event.pointerId);
|
|
72
|
-
} catch {
|
|
73
|
-
}
|
|
74
|
-
dragStartRef.current = null, lockedDirectionRef.current = null, setIsDragging(!1), shouldDismiss && exitDirection ? onDismiss(exitDirection, relevantVelocity) : onCancel();
|
|
75
|
-
},
|
|
76
|
-
[disabled, direction, threshold, isHorizontal, isVertical, onDismiss, onCancel]
|
|
77
|
-
), handlePointerCancel = React.useCallback(
|
|
78
|
-
(event) => {
|
|
79
|
-
try {
|
|
80
|
-
event.target.releasePointerCapture(event.pointerId);
|
|
81
|
-
} catch {
|
|
82
|
-
}
|
|
83
|
-
dragStartRef.current = null, lockedDirectionRef.current = null, setIsDragging(!1), onCancel();
|
|
84
|
-
},
|
|
85
|
-
[onCancel]
|
|
86
|
-
);
|
|
87
|
-
return {
|
|
88
|
-
isDragging,
|
|
89
|
-
gestureHandlers: {
|
|
90
|
-
onPointerDown: handlePointerDown,
|
|
91
|
-
onPointerMove: handlePointerMove,
|
|
92
|
-
onPointerUp: handlePointerUp,
|
|
93
|
-
onPointerCancel: handlePointerCancel
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=useAnimatedDragGesture.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useAnimatedDragGesture.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,YAAuB;AAyBvB,MAAM,qBAAqB;AAM3B,SAAS,SAAS,OAAe,YAAY,IAAY;AACvD,MAAI,SAAS,EAAG,QAAO;AACvB,QAAM,eAAe,KAAK,IAAI,KAAK,GAC7B,mBAAmB,KAAK,KAAK,YAAY,IAAI;AACnD,SAAO,CAAC,KAAK,IAAI,kBAAkB,SAAS;AAC9C;AAEO,SAAS,uBAAuB,SAAwC;AAC7E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,SAEE,CAAC,YAAY,aAAa,IAAI,MAAM,SAAS,EAAK,GAElD,eAAe,MAAM,OAA6B,IAAI,GACtD,qBAAqB,MAAM,OAAyB,IAAI,GAExD,eACJ,cAAc,UAAU,cAAc,WAAW,cAAc,cAC3D,aACJ,cAAc,QAAQ,cAAc,UAAU,cAAc,YAExD,oBAAoB,MAAM;AAAA,IAC9B,CAAC,UAA8B;AAM7B,MALI,YACA,MAAM,WAAW,MAGC,OAAO,aAAa,GAAG,SAAS,EAAE,UAAU,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SAAS,IAAG,gBAAgB,OAClD,cAAc,cACjB,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,MACpC,gBAAgB,SAAS,IAAI,SAAS;AAK5C,YAAM,gBAAgB,kBAAkB,mBAAmB;AAG3D,UAAI;AACD,QAAC,MAAM,OAAuB,sBAAsB,MAAM,SAAS;AAAA,MACtE,QAAQ;AAAA,MAER;AAGA,mBAAa,UAAU,MACvB,mBAAmB,UAAU,MAC7B,cAAc,EAAK,GAEf,iBAAiB,gBACnB,UAAU,eAAe,gBAAgB,IAEzC,SAAS;AAAA,IAEb;AAAA,IACA,CAAC,UAAU,WAAW,WAAW,cAAc,YAAY,WAAW,QAAQ;AAAA,EAChF,GAEM,sBAAsB,MAAM;AAAA,IAChC,CAAC,UAA8B;AAE7B,UAAI;AACD,QAAC,MAAM,OAAuB,sBAAsB,MAAM,SAAS;AAAA,MACtE,QAAQ;AAAA,MAER;AAEA,mBAAa,UAAU,MACvB,mBAAmB,UAAU,MAC7B,cAAc,EAAK,GACnB,SAAS;AAAA,IACX;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AASA,SAAO;AAAA,IACL;AAAA,IACA,iBATsB;AAAA,MACtB,eAAe;AAAA,MACf,eAAe;AAAA,MACf,aAAa;AAAA,MACb,iBAAiB;AAAA,IACnB;AAAA,EAKA;AACF;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
-
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: !0
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
__copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
-
get: () => from[key],
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
-
value: mod,
|
|
27
|
-
enumerable: !0
|
|
28
|
-
}) : target, mod)),
|
|
29
|
-
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
-
value: !0
|
|
31
|
-
}), mod);
|
|
32
|
-
var useDragGesture_exports = {};
|
|
33
|
-
__export(useDragGesture_exports, {
|
|
34
|
-
useDragGesture: () => useDragGesture
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(useDragGesture_exports);
|
|
37
|
-
var React = __toESM(require("react"), 1);
|
|
38
|
-
const VELOCITY_THRESHOLD = 0.11;
|
|
39
|
-
function resisted(delta, maxResist = 25) {
|
|
40
|
-
if (delta >= 0) return delta;
|
|
41
|
-
const pastBoundary = Math.abs(delta),
|
|
42
|
-
resistedDistance = Math.sqrt(pastBoundary) * 2;
|
|
43
|
-
return -Math.min(resistedDistance, maxResist);
|
|
44
|
-
}
|
|
45
|
-
function useDragGesture(options) {
|
|
46
|
-
const {
|
|
47
|
-
direction,
|
|
48
|
-
threshold,
|
|
49
|
-
onDragStart,
|
|
50
|
-
onDragEnd,
|
|
51
|
-
onDragCancel,
|
|
52
|
-
disabled
|
|
53
|
-
} = options,
|
|
54
|
-
[dragState, setDragState] = React.useState({
|
|
55
|
-
isDragging: !1,
|
|
56
|
-
offsetX: 0,
|
|
57
|
-
offsetY: 0,
|
|
58
|
-
velocityX: 0,
|
|
59
|
-
velocityY: 0
|
|
60
|
-
}),
|
|
61
|
-
dragStartRef = React.useRef(null),
|
|
62
|
-
lockedDirectionRef = React.useRef(null),
|
|
63
|
-
isHorizontal = direction === "left" || direction === "right" || direction === "horizontal",
|
|
64
|
-
isVertical = direction === "up" || direction === "down" || direction === "vertical",
|
|
65
|
-
handlePointerDown = React.useCallback(event => {
|
|
66
|
-
disabled || event.button === 0 && (event.target.setPointerCapture(event.pointerId), dragStartRef.current = {
|
|
67
|
-
startX: event.clientX,
|
|
68
|
-
startY: event.clientY,
|
|
69
|
-
startTime: Date.now()
|
|
70
|
-
}, setDragState(prev => ({
|
|
71
|
-
...prev,
|
|
72
|
-
isDragging: !0
|
|
73
|
-
})), onDragStart?.());
|
|
74
|
-
}, [disabled, onDragStart]),
|
|
75
|
-
handlePointerMove = React.useCallback(event => {
|
|
76
|
-
if (!dragStartRef.current || disabled) return;
|
|
77
|
-
const deltaX = event.clientX - dragStartRef.current.startX,
|
|
78
|
-
deltaY = event.clientY - dragStartRef.current.startY;
|
|
79
|
-
!lockedDirectionRef.current && (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1) && (lockedDirectionRef.current = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y");
|
|
80
|
-
let offsetX = 0,
|
|
81
|
-
offsetY = 0;
|
|
82
|
-
lockedDirectionRef.current === "x" && isHorizontal ? direction === "right" ? offsetX = deltaX > 0 ? deltaX : resisted(deltaX) : direction === "left" ? offsetX = deltaX < 0 ? deltaX : -resisted(-deltaX) : offsetX = deltaX : lockedDirectionRef.current === "y" && isVertical && (direction === "down" ? offsetY = deltaY > 0 ? deltaY : resisted(deltaY) : direction === "up" ? offsetY = deltaY < 0 ? deltaY : -resisted(-deltaY) : offsetY = deltaY), setDragState(prev => ({
|
|
83
|
-
...prev,
|
|
84
|
-
offsetX,
|
|
85
|
-
offsetY
|
|
86
|
-
}));
|
|
87
|
-
}, [disabled, direction, isHorizontal, isVertical]),
|
|
88
|
-
handlePointerUp = React.useCallback(event => {
|
|
89
|
-
if (!dragStartRef.current || disabled) return;
|
|
90
|
-
const deltaX = event.clientX - dragStartRef.current.startX,
|
|
91
|
-
deltaY = event.clientY - dragStartRef.current.startY,
|
|
92
|
-
timeTaken = Date.now() - dragStartRef.current.startTime,
|
|
93
|
-
velocityX = Math.abs(deltaX) / timeTaken,
|
|
94
|
-
velocityY = Math.abs(deltaY) / timeTaken,
|
|
95
|
-
relevantDelta = isHorizontal ? deltaX : deltaY,
|
|
96
|
-
relevantVelocity = isHorizontal ? velocityX : velocityY,
|
|
97
|
-
passedThreshold = Math.abs(relevantDelta) >= threshold,
|
|
98
|
-
hasVelocity = relevantVelocity > VELOCITY_THRESHOLD;
|
|
99
|
-
let isCorrectDirection = !1;
|
|
100
|
-
(direction === "right" && deltaX > 0 || direction === "left" && deltaX < 0 || direction === "horizontal" && Math.abs(deltaX) > Math.abs(deltaY) || direction === "down" && deltaY > 0 || direction === "up" && deltaY < 0 || direction === "vertical" && Math.abs(deltaY) > Math.abs(deltaX)) && (isCorrectDirection = !0);
|
|
101
|
-
const shouldDismiss = isCorrectDirection && (passedThreshold || hasVelocity);
|
|
102
|
-
dragStartRef.current = null, lockedDirectionRef.current = null, shouldDismiss ? onDragEnd?.(!0) : (setDragState({
|
|
103
|
-
isDragging: !1,
|
|
104
|
-
offsetX: 0,
|
|
105
|
-
offsetY: 0,
|
|
106
|
-
velocityX: 0,
|
|
107
|
-
velocityY: 0
|
|
108
|
-
}), onDragCancel?.());
|
|
109
|
-
}, [disabled, direction, threshold, isHorizontal, onDragEnd, onDragCancel]),
|
|
110
|
-
handlePointerCancel = React.useCallback(() => {
|
|
111
|
-
dragStartRef.current = null, lockedDirectionRef.current = null, setDragState({
|
|
112
|
-
isDragging: !1,
|
|
113
|
-
offsetX: 0,
|
|
114
|
-
offsetY: 0,
|
|
115
|
-
velocityX: 0,
|
|
116
|
-
velocityY: 0
|
|
117
|
-
}), onDragCancel?.();
|
|
118
|
-
}, [onDragCancel]);
|
|
119
|
-
return {
|
|
120
|
-
dragState,
|
|
121
|
-
gestureHandlers: {
|
|
122
|
-
onPointerDown: handlePointerDown,
|
|
123
|
-
onPointerMove: handlePointerMove,
|
|
124
|
-
onPointerUp: handlePointerUp,
|
|
125
|
-
onPointerCancel: handlePointerCancel
|
|
126
|
-
},
|
|
127
|
-
resetDrag: handlePointerCancel
|
|
128
|
-
};
|
|
129
|
-
}
|