@hanzogui/toast 3.0.2 → 7.3.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 +81 -75
- package/dist/cjs/ToastAnnounce.native.js +86 -80
- package/dist/cjs/ToastAnnounce.native.js.map +1 -1
- package/dist/cjs/ToastComposable.cjs +933 -0
- package/dist/cjs/ToastComposable.native.js +1025 -0
- package/dist/cjs/ToastComposable.native.js.map +1 -0
- 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 +303 -241
- package/dist/cjs/ToastImpl.native.js +311 -273
- 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 +103 -99
- package/dist/cjs/ToastProvider.native.js +108 -106
- package/dist/cjs/ToastProvider.native.js.map +1 -1
- package/dist/cjs/ToastState.cjs +311 -0
- package/dist/cjs/ToastState.native.js +324 -0
- package/dist/cjs/ToastState.native.js.map +1 -0
- package/dist/cjs/ToastViewport.cjs +276 -235
- package/dist/cjs/ToastViewport.native.js +302 -274
- package/dist/cjs/ToastViewport.native.js.map +1 -1
- package/dist/cjs/Toaster.cjs +87 -0
- package/dist/cjs/Toaster.native.js +91 -0
- package/dist/cjs/Toaster.native.js.map +1 -0
- 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 +214 -0
- package/dist/cjs/useAnimatedDragGesture.native.js +224 -0
- package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/cjs/useReducedMotion.cjs +74 -0
- package/dist/cjs/useReducedMotion.native.js +83 -0
- package/dist/cjs/useReducedMotion.native.js.map +1 -0
- package/dist/cjs/useToastAnimations.cjs +294 -0
- package/dist/cjs/useToastAnimations.native.js +304 -0
- package/dist/cjs/useToastAnimations.native.js.map +1 -0
- 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 +895 -0
- package/dist/esm/ToastComposable.mjs.map +1 -0
- package/dist/esm/ToastComposable.native.js +984 -0
- package/dist/esm/ToastComposable.native.js.map +1 -0
- 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 +285 -0
- package/dist/esm/ToastState.mjs.map +1 -0
- package/dist/esm/ToastState.native.js +295 -0
- package/dist/esm/ToastState.native.js.map +1 -0
- 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 +51 -0
- package/dist/esm/Toaster.mjs.map +1 -0
- package/dist/esm/Toaster.native.js +52 -0
- package/dist/esm/Toaster.native.js.map +1 -0
- 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/useAnimatedDragGesture.mjs +178 -0
- package/dist/esm/useAnimatedDragGesture.mjs.map +1 -0
- package/dist/esm/useAnimatedDragGesture.native.js +185 -0
- package/dist/esm/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/esm/useReducedMotion.mjs +38 -0
- package/dist/esm/useReducedMotion.mjs.map +1 -0
- package/dist/esm/useReducedMotion.native.js +44 -0
- package/dist/esm/useReducedMotion.native.js.map +1 -0
- package/dist/esm/useToastAnimations.mjs +258 -0
- package/dist/esm/useToastAnimations.mjs.map +1 -0
- package/dist/esm/useToastAnimations.native.js +265 -0
- package/dist/esm/useToastAnimations.native.js.map +1 -0
- 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 +86 -80
- package/dist/jsx/ToastAnnounce.native.js.map +1 -1
- package/dist/jsx/ToastComposable.mjs +895 -0
- package/dist/jsx/ToastComposable.mjs.map +1 -0
- package/dist/jsx/ToastComposable.native.js +1025 -0
- package/dist/jsx/ToastComposable.native.js.map +1 -0
- 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 +311 -273
- 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 +285 -0
- package/dist/jsx/ToastState.mjs.map +1 -0
- package/dist/jsx/ToastState.native.js +324 -0
- package/dist/jsx/ToastState.native.js.map +1 -0
- package/dist/jsx/ToastViewport.mjs +238 -199
- package/dist/jsx/ToastViewport.mjs.map +1 -1
- package/dist/jsx/ToastViewport.native.js +302 -274
- package/dist/jsx/ToastViewport.native.js.map +1 -1
- package/dist/jsx/Toaster.mjs +51 -0
- package/dist/jsx/Toaster.mjs.map +1 -0
- package/dist/jsx/Toaster.native.js +91 -0
- package/dist/jsx/Toaster.native.js.map +1 -0
- 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.native.js +7 -5
- package/dist/jsx/types.native.js +7 -5
- package/dist/jsx/useAnimatedDragGesture.mjs +178 -0
- package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -0
- package/dist/jsx/useAnimatedDragGesture.native.js +224 -0
- package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/jsx/useReducedMotion.mjs +38 -0
- package/dist/jsx/useReducedMotion.mjs.map +1 -0
- package/dist/jsx/useReducedMotion.native.js +83 -0
- package/dist/jsx/useReducedMotion.native.js.map +1 -0
- package/dist/jsx/useToastAnimations.mjs +258 -0
- package/dist/jsx/useToastAnimations.mjs.map +1 -0
- package/dist/jsx/useToastAnimations.native.js +304 -0
- package/dist/jsx/useToastAnimations.native.js.map +1 -0
- 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 +43 -24
- package/src/Toast.tsx +2 -2
- package/src/ToastComposable.tsx +1380 -0
- package/src/ToastImpl.tsx +15 -3
- 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 +6 -5
- 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 +377 -0
- package/src/v2.ts +31 -0
- package/types/Toast.d.ts +34 -34
- package/types/Toast.d.ts.map +1 -0
- package/types/ToastAnnounce.d.ts +4 -4
- package/types/ToastAnnounce.d.ts.map +1 -0
- package/types/ToastComposable.d.ts +199 -0
- package/types/ToastComposable.d.ts.map +1 -0
- package/types/ToastImperative.d.ts +3 -3
- package/types/ToastImperative.d.ts.map +1 -0
- package/types/ToastImpl.d.ts +11 -11
- package/types/ToastImpl.d.ts.map +1 -0
- package/types/ToastItemFrame.d.ts +25 -0
- package/types/ToastItemFrame.d.ts.map +1 -0
- package/types/ToastPortal.d.ts +1 -1
- package/types/ToastPortal.d.ts.map +1 -0
- package/types/ToastProvider.d.ts +4 -4
- package/types/ToastProvider.d.ts.map +1 -0
- package/types/ToastState.d.ts +179 -0
- package/types/ToastState.d.ts.map +1 -0
- package/types/ToastViewport.d.ts +10 -10
- package/types/ToastViewport.d.ts.map +1 -0
- package/types/Toaster.d.ts +112 -0
- package/types/Toaster.d.ts.map +1 -0
- package/types/constants.d.ts.map +1 -0
- package/types/createNativeToast.d.ts +5 -0
- package/types/createNativeToast.d.ts.map +1 -0
- package/types/createNativeToast.native.d.ts +1 -0
- package/types/createNativeToast.native.d.ts.map +1 -0
- package/types/dispatchNativeToast.d.ts +12 -0
- package/types/dispatchNativeToast.d.ts.map +1 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts.map +1 -0
- package/types/useAnimatedDragGesture.d.ts +33 -0
- package/types/useAnimatedDragGesture.d.ts.map +1 -0
- package/types/useAnimatedDragGesture.native.d.ts +33 -0
- package/types/useAnimatedDragGesture.native.d.ts.map +1 -0
- package/types/useReducedMotion.d.ts +6 -0
- package/types/useReducedMotion.d.ts.map +1 -0
- package/types/useToastAnimations.d.ts +50 -0
- package/types/useToastAnimations.d.ts.map +1 -0
- 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
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for cross-animation-driver toast drag animations.
|
|
3
|
+
*
|
|
4
|
+
* Animation strategy (all cross-driver):
|
|
5
|
+
* - AnimatePresence => enter/exit styles
|
|
6
|
+
* - transition prop => non-interactive styles (stacking, scale, opacity)
|
|
7
|
+
* - useAnimatedNumber/Style => interactive styles (drag gestures only)
|
|
8
|
+
*
|
|
9
|
+
* This hook handles ONLY the drag gesture animations.
|
|
10
|
+
* Uses the same pattern as Sheet for universal animation support.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: For CSS driver, we use a ref-based approach with direct DOM manipulation
|
|
13
|
+
* because CSS driver's useAnimatedNumberStyle doesn't reactively update.
|
|
14
|
+
* For Motion/Reanimated drivers, we use the AnimatedView + motionValue pattern.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { isWeb } from '@hanzogui/constants'
|
|
18
|
+
import { useConfiguration, useEvent, View as GuiView } from '@hanzogui/core'
|
|
19
|
+
import * as React from 'react'
|
|
20
|
+
import type { Animated } from 'react-native'
|
|
21
|
+
|
|
22
|
+
export interface UseToastAnimationsOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Called when exit animation completes
|
|
25
|
+
*/
|
|
26
|
+
onExitComplete?: () => void
|
|
27
|
+
/**
|
|
28
|
+
* When true, animations complete instantly (accessibility)
|
|
29
|
+
*/
|
|
30
|
+
reducedMotion?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* Primary swipe axis — determines which animated value is tracked for style updates.
|
|
33
|
+
* 'horizontal' tracks translateX, 'vertical' tracks translateY.
|
|
34
|
+
*/
|
|
35
|
+
swipeAxis?: 'horizontal' | 'vertical'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ToastAnimationValues {
|
|
39
|
+
/** set drag offset directly (no animation, for gesture moves) */
|
|
40
|
+
setDragOffset: (x: number, y: number) => void
|
|
41
|
+
/** spring back to origin after cancelled drag */
|
|
42
|
+
springBack: (onComplete?: () => void) => void
|
|
43
|
+
/** animate out in a direction after successful swipe, with optional velocity for smooth continuation */
|
|
44
|
+
animateOut: (
|
|
45
|
+
direction: 'left' | 'right' | 'up' | 'down',
|
|
46
|
+
velocity?: number,
|
|
47
|
+
onComplete?: () => void
|
|
48
|
+
) => void
|
|
49
|
+
/** stop any running animations */
|
|
50
|
+
stop: () => void
|
|
51
|
+
/** the animated style to spread on the AnimatedView (for motion/reanimated drivers) */
|
|
52
|
+
animatedStyle: any
|
|
53
|
+
/** the animated view component from the driver */
|
|
54
|
+
AnimatedView: typeof Animated.View
|
|
55
|
+
/** ref to attach to the drag wrapper element (for CSS driver direct DOM updates) */
|
|
56
|
+
dragRef: React.RefObject<HTMLDivElement | null>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// tuned for snappy, premium feel like Sonner
|
|
60
|
+
const SPRING_CONFIG = {
|
|
61
|
+
type: 'spring' as const,
|
|
62
|
+
damping: 30,
|
|
63
|
+
stiffness: 400,
|
|
64
|
+
mass: 0.5,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const EXIT_DISTANCE = 200
|
|
68
|
+
|
|
69
|
+
// simple spring animation for CSS driver
|
|
70
|
+
function animateSpring(
|
|
71
|
+
element: HTMLElement,
|
|
72
|
+
fromX: number,
|
|
73
|
+
fromY: number,
|
|
74
|
+
toX: number,
|
|
75
|
+
toY: number,
|
|
76
|
+
config: {
|
|
77
|
+
damping?: number
|
|
78
|
+
stiffness?: number
|
|
79
|
+
mass?: number
|
|
80
|
+
initialVelocityX?: number
|
|
81
|
+
initialVelocityY?: number
|
|
82
|
+
fadeOut?: boolean
|
|
83
|
+
},
|
|
84
|
+
onComplete?: () => void
|
|
85
|
+
) {
|
|
86
|
+
const {
|
|
87
|
+
damping = 30,
|
|
88
|
+
stiffness = 400,
|
|
89
|
+
mass = 0.5,
|
|
90
|
+
initialVelocityX = 0,
|
|
91
|
+
initialVelocityY = 0,
|
|
92
|
+
fadeOut = false,
|
|
93
|
+
} = config
|
|
94
|
+
|
|
95
|
+
let x = fromX
|
|
96
|
+
let y = fromY
|
|
97
|
+
// use initial velocity from gesture for smooth continuation
|
|
98
|
+
let velocityX = initialVelocityX
|
|
99
|
+
let velocityY = initialVelocityY
|
|
100
|
+
let animationId: number | null = null
|
|
101
|
+
const targetX = toX
|
|
102
|
+
const targetY = toY
|
|
103
|
+
|
|
104
|
+
// for fade out, track progress based on distance traveled
|
|
105
|
+
const totalDistance = Math.sqrt((toX - fromX) ** 2 + (toY - fromY) ** 2) || 1
|
|
106
|
+
|
|
107
|
+
function step() {
|
|
108
|
+
// spring physics
|
|
109
|
+
const forceX = -stiffness * (x - targetX)
|
|
110
|
+
const forceY = -stiffness * (y - targetY)
|
|
111
|
+
const dampingForceX = -damping * velocityX
|
|
112
|
+
const dampingForceY = -damping * velocityY
|
|
113
|
+
|
|
114
|
+
const accelerationX = (forceX + dampingForceX) / mass
|
|
115
|
+
const accelerationY = (forceY + dampingForceY) / mass
|
|
116
|
+
|
|
117
|
+
velocityX += accelerationX * 0.016 // ~60fps
|
|
118
|
+
velocityY += accelerationY * 0.016
|
|
119
|
+
x += velocityX * 0.016
|
|
120
|
+
y += velocityY * 0.016
|
|
121
|
+
|
|
122
|
+
element.style.transform = `translate3d(${x}px, ${y}px, 0)`
|
|
123
|
+
|
|
124
|
+
// animate opacity based on progress toward target
|
|
125
|
+
if (fadeOut) {
|
|
126
|
+
const distanceTraveled = Math.sqrt((x - fromX) ** 2 + (y - fromY) ** 2)
|
|
127
|
+
const progress = Math.min(distanceTraveled / totalDistance, 1)
|
|
128
|
+
element.style.opacity = String(1 - progress)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// check if close enough to target and velocity is low
|
|
132
|
+
const distanceX = Math.abs(x - targetX)
|
|
133
|
+
const distanceY = Math.abs(y - targetY)
|
|
134
|
+
const speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY)
|
|
135
|
+
|
|
136
|
+
if (distanceX < 0.5 && distanceY < 0.5 && speed < 0.5) {
|
|
137
|
+
element.style.transform = `translate3d(${targetX}px, ${targetY}px, 0)`
|
|
138
|
+
if (fadeOut) {
|
|
139
|
+
element.style.opacity = '0'
|
|
140
|
+
}
|
|
141
|
+
onComplete?.()
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
animationId = requestAnimationFrame(step)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
animationId = requestAnimationFrame(step)
|
|
149
|
+
|
|
150
|
+
return () => {
|
|
151
|
+
if (animationId) {
|
|
152
|
+
cancelAnimationFrame(animationId)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function useToastAnimations(
|
|
158
|
+
options: UseToastAnimationsOptions = {}
|
|
159
|
+
): ToastAnimationValues {
|
|
160
|
+
const { onExitComplete, reducedMotion, swipeAxis = 'horizontal' } = options
|
|
161
|
+
|
|
162
|
+
const { animationDriver } = useConfiguration()
|
|
163
|
+
|
|
164
|
+
if (!animationDriver) {
|
|
165
|
+
throw new Error('Toast requires an animation driver to be set in GuiProvider')
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const { useAnimatedNumber, useAnimatedNumberStyle, useAnimatedNumbersStyle } =
|
|
169
|
+
animationDriver
|
|
170
|
+
const AnimatedView = (animationDriver.View ?? GuiView) as typeof Animated.View
|
|
171
|
+
|
|
172
|
+
// ref for direct DOM manipulation (CSS driver fallback)
|
|
173
|
+
const dragRef = React.useRef<HTMLDivElement>(null)
|
|
174
|
+
const cancelAnimationRef = React.useRef<(() => void) | null>(null)
|
|
175
|
+
const currentOffsetRef = React.useRef({ x: 0, y: 0 })
|
|
176
|
+
|
|
177
|
+
// on web, use direct DOM for drag (CSS driver has no reactive style updates)
|
|
178
|
+
// on native, use the animation driver's AnimatedView + animatedStyle
|
|
179
|
+
const useDirectDom = isWeb
|
|
180
|
+
|
|
181
|
+
// animated values for drag translation
|
|
182
|
+
const translateX = useAnimatedNumber(0)
|
|
183
|
+
const translateY = useAnimatedNumber(0)
|
|
184
|
+
|
|
185
|
+
// multi-value: both axes reactive in one animated style (off-thread on Reanimated)
|
|
186
|
+
const animatedStyleMulti = useAnimatedNumbersStyle
|
|
187
|
+
? useAnimatedNumbersStyle([translateX, translateY], (x: number, y: number) => {
|
|
188
|
+
'worklet'
|
|
189
|
+
return { transform: [{ translateX: x }, { translateY: y }] }
|
|
190
|
+
})
|
|
191
|
+
: null
|
|
192
|
+
|
|
193
|
+
// single-value fallback for drivers without useAnimatedNumbersStyle
|
|
194
|
+
const animatedStyleFallback = useAnimatedNumberStyle(
|
|
195
|
+
swipeAxis === 'vertical' ? translateY : translateX,
|
|
196
|
+
(primary) => {
|
|
197
|
+
'worklet'
|
|
198
|
+
const secondary =
|
|
199
|
+
swipeAxis === 'vertical' ? translateX.getValue() : translateY.getValue()
|
|
200
|
+
return swipeAxis === 'vertical'
|
|
201
|
+
? { transform: [{ translateX: secondary }, { translateY: primary }] }
|
|
202
|
+
: { transform: [{ translateX: primary }, { translateY: secondary }] }
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
const animatedStyle = animatedStyleMulti ?? animatedStyleFallback
|
|
207
|
+
|
|
208
|
+
// set drag offset directly (no animation) - used during gesture
|
|
209
|
+
const setDragOffset = useEvent((x: number, y: number) => {
|
|
210
|
+
// cancel any running animation (e.g., spring back from previous gesture)
|
|
211
|
+
cancelAnimationRef.current?.()
|
|
212
|
+
cancelAnimationRef.current = null
|
|
213
|
+
|
|
214
|
+
currentOffsetRef.current = { x, y }
|
|
215
|
+
|
|
216
|
+
if (useDirectDom && dragRef.current) {
|
|
217
|
+
// direct DOM manipulation for CSS driver
|
|
218
|
+
dragRef.current.style.transform = `translate3d(${x}px, ${y}px, 0)`
|
|
219
|
+
dragRef.current.style.opacity = '1' // reset in case previous animation faded it
|
|
220
|
+
} else {
|
|
221
|
+
// use animation driver for motion/reanimated
|
|
222
|
+
translateX.setValue(x, { type: 'direct' })
|
|
223
|
+
translateY.setValue(y, { type: 'direct' })
|
|
224
|
+
}
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
// spring back to origin after cancelled drag
|
|
228
|
+
const springBack = useEvent((onComplete?: () => void) => {
|
|
229
|
+
// cancel any running animation
|
|
230
|
+
cancelAnimationRef.current?.()
|
|
231
|
+
|
|
232
|
+
if (reducedMotion) {
|
|
233
|
+
// instant for reduced motion
|
|
234
|
+
if (useDirectDom && dragRef.current) {
|
|
235
|
+
dragRef.current.style.transform = 'translate3d(0px, 0px, 0)'
|
|
236
|
+
} else {
|
|
237
|
+
translateX.setValue(0, { type: 'direct' })
|
|
238
|
+
translateY.setValue(0, { type: 'direct' })
|
|
239
|
+
}
|
|
240
|
+
currentOffsetRef.current = { x: 0, y: 0 }
|
|
241
|
+
onComplete?.()
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (useDirectDom && dragRef.current) {
|
|
246
|
+
// use JS spring animation for CSS driver
|
|
247
|
+
const { x, y } = currentOffsetRef.current
|
|
248
|
+
cancelAnimationRef.current = animateSpring(
|
|
249
|
+
dragRef.current,
|
|
250
|
+
x,
|
|
251
|
+
y,
|
|
252
|
+
0,
|
|
253
|
+
0,
|
|
254
|
+
SPRING_CONFIG,
|
|
255
|
+
() => {
|
|
256
|
+
currentOffsetRef.current = { x: 0, y: 0 }
|
|
257
|
+
onComplete?.()
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
} else {
|
|
261
|
+
// use animation driver for motion/reanimated
|
|
262
|
+
translateX.setValue(0, SPRING_CONFIG)
|
|
263
|
+
translateY.setValue(0, SPRING_CONFIG, onComplete)
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
// animate out in a direction after successful swipe
|
|
268
|
+
// velocity is in px/ms from gesture, used for smooth momentum continuation
|
|
269
|
+
const animateOut = useEvent(
|
|
270
|
+
(
|
|
271
|
+
direction: 'left' | 'right' | 'up' | 'down',
|
|
272
|
+
velocity?: number,
|
|
273
|
+
onComplete?: () => void
|
|
274
|
+
) => {
|
|
275
|
+
// cancel any running animation
|
|
276
|
+
cancelAnimationRef.current?.()
|
|
277
|
+
|
|
278
|
+
const { x: curX, y: curY } = currentOffsetRef.current
|
|
279
|
+
|
|
280
|
+
// ensure exit target is always further than current drag position
|
|
281
|
+
// (user may have dragged past EXIT_DISTANCE already)
|
|
282
|
+
let exitX =
|
|
283
|
+
direction === 'left' ? -EXIT_DISTANCE : direction === 'right' ? EXIT_DISTANCE : 0
|
|
284
|
+
let exitY =
|
|
285
|
+
direction === 'up' ? -EXIT_DISTANCE : direction === 'down' ? EXIT_DISTANCE : 0
|
|
286
|
+
|
|
287
|
+
if (direction === 'left' && curX < exitX) exitX = curX - 50
|
|
288
|
+
else if (direction === 'right' && curX > exitX) exitX = curX + 50
|
|
289
|
+
if (direction === 'up' && curY < exitY) exitY = curY - 50
|
|
290
|
+
else if (direction === 'down' && curY > exitY) exitY = curY + 50
|
|
291
|
+
|
|
292
|
+
if (reducedMotion) {
|
|
293
|
+
// instant for reduced motion
|
|
294
|
+
if (useDirectDom && dragRef.current) {
|
|
295
|
+
dragRef.current.style.transform = `translate3d(${exitX}px, ${exitY}px, 0)`
|
|
296
|
+
} else {
|
|
297
|
+
translateX.setValue(exitX, { type: 'direct' })
|
|
298
|
+
translateY.setValue(exitY, { type: 'direct' })
|
|
299
|
+
}
|
|
300
|
+
onComplete?.()
|
|
301
|
+
onExitComplete?.()
|
|
302
|
+
return
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// convert velocity from px/ms to px/frame (assuming 60fps = 16.67ms/frame)
|
|
306
|
+
// multiply by ~500 to get a reasonable initial velocity for the spring
|
|
307
|
+
const velocityScale = (velocity ?? 0) * 500
|
|
308
|
+
const initialVelocityX =
|
|
309
|
+
direction === 'left' ? -velocityScale : direction === 'right' ? velocityScale : 0
|
|
310
|
+
const initialVelocityY =
|
|
311
|
+
direction === 'up' ? -velocityScale : direction === 'down' ? velocityScale : 0
|
|
312
|
+
|
|
313
|
+
// exit animation config - tuned for smooth momentum continuation
|
|
314
|
+
const exitConfig = {
|
|
315
|
+
damping: 25,
|
|
316
|
+
stiffness: 350,
|
|
317
|
+
mass: 0.4,
|
|
318
|
+
initialVelocityX,
|
|
319
|
+
initialVelocityY,
|
|
320
|
+
fadeOut: true,
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (useDirectDom && dragRef.current) {
|
|
324
|
+
// use JS spring animation for CSS driver
|
|
325
|
+
const { x, y } = currentOffsetRef.current
|
|
326
|
+
cancelAnimationRef.current = animateSpring(
|
|
327
|
+
dragRef.current,
|
|
328
|
+
x,
|
|
329
|
+
y,
|
|
330
|
+
exitX,
|
|
331
|
+
exitY,
|
|
332
|
+
exitConfig,
|
|
333
|
+
() => {
|
|
334
|
+
onComplete?.()
|
|
335
|
+
onExitComplete?.()
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
} else {
|
|
339
|
+
// animation driver path (reanimated/RN)
|
|
340
|
+
const springConfig = {
|
|
341
|
+
type: 'spring' as const,
|
|
342
|
+
damping: 25,
|
|
343
|
+
stiffness: 350,
|
|
344
|
+
mass: 0.4,
|
|
345
|
+
}
|
|
346
|
+
translateX.setValue(exitX, springConfig)
|
|
347
|
+
translateY.setValue(exitY, springConfig, () => {
|
|
348
|
+
onComplete?.()
|
|
349
|
+
onExitComplete?.()
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
const stop = useEvent(() => {
|
|
356
|
+
cancelAnimationRef.current?.()
|
|
357
|
+
translateX.stop()
|
|
358
|
+
translateY.stop()
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
// cleanup on unmount
|
|
362
|
+
React.useEffect(() => {
|
|
363
|
+
return () => {
|
|
364
|
+
cancelAnimationRef.current?.()
|
|
365
|
+
}
|
|
366
|
+
}, [])
|
|
367
|
+
|
|
368
|
+
return {
|
|
369
|
+
setDragOffset,
|
|
370
|
+
springBack,
|
|
371
|
+
animateOut,
|
|
372
|
+
stop,
|
|
373
|
+
animatedStyle,
|
|
374
|
+
AnimatedView,
|
|
375
|
+
dragRef,
|
|
376
|
+
}
|
|
377
|
+
}
|
package/src/v2.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Toast v2 - composable component API
|
|
2
|
+
export { Toast, useToasts, useToastItem } from './ToastComposable'
|
|
3
|
+
export type {
|
|
4
|
+
ToastRootProps,
|
|
5
|
+
ToastViewportProps,
|
|
6
|
+
ToastItemProps,
|
|
7
|
+
ToastItemRenderProps,
|
|
8
|
+
ToastListProps,
|
|
9
|
+
ToastPosition,
|
|
10
|
+
ToastIcons,
|
|
11
|
+
} from './ToastComposable'
|
|
12
|
+
|
|
13
|
+
// Toast v2 - imperative API
|
|
14
|
+
export { toast } from './ToastState'
|
|
15
|
+
export type {
|
|
16
|
+
ToastT,
|
|
17
|
+
ToastType,
|
|
18
|
+
ToastToDismiss,
|
|
19
|
+
ExternalToast,
|
|
20
|
+
PromiseT,
|
|
21
|
+
PromiseData,
|
|
22
|
+
ToastAction,
|
|
23
|
+
} from './ToastState'
|
|
24
|
+
|
|
25
|
+
// Toaster - all-in-one component (thin wrapper over composable API)
|
|
26
|
+
export { Toaster } from './Toaster'
|
|
27
|
+
export type { ToasterProps, ToasterPosition } from './Toaster'
|
|
28
|
+
|
|
29
|
+
export type { SwipeDirection } from './ToastProvider'
|
|
30
|
+
export type { BurntToastOptions, CreateNativeToastOptions, NativeToastRef } from './types'
|
|
31
|
+
export { requestNotificationPermission } from './createNativeToast'
|
package/types/Toast.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetProps, NativePlatform, NativeValue, GuiElement } from '@
|
|
1
|
+
import type { GetProps, NativePlatform, NativeValue, GuiElement } from '@hanzogui/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import type { CustomData } from './ToastImperative';
|
|
4
4
|
import { useToast, useToastController, useToastState } from './ToastImperative';
|
|
@@ -7,15 +7,15 @@ import type { ScopedProps, ToastProviderProps } from './ToastProvider';
|
|
|
7
7
|
import { ToastProvider } from './ToastProvider';
|
|
8
8
|
import type { ToastViewportProps } from './ToastViewport';
|
|
9
9
|
import { ToastViewport } from './ToastViewport';
|
|
10
|
-
declare const ToastTitle: import("@
|
|
10
|
+
declare const ToastTitle: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
11
11
|
unstyled?: boolean | undefined;
|
|
12
|
-
size?: import("@
|
|
13
|
-
}, import("@
|
|
12
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
13
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
14
14
|
type ToastTitleProps = GetProps<typeof ToastTitle>;
|
|
15
|
-
declare const ToastDescription: import("@
|
|
15
|
+
declare const ToastDescription: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
16
16
|
unstyled?: boolean | undefined;
|
|
17
|
-
size?: import("@
|
|
18
|
-
}, import("@
|
|
17
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
18
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
19
19
|
type ToastDescriptionProps = GetProps<typeof ToastDescription>;
|
|
20
20
|
type ToastActionProps = ScopedProps<ToastCloseProps & {
|
|
21
21
|
/**
|
|
@@ -26,54 +26,54 @@ type ToastActionProps = ScopedProps<ToastCloseProps & {
|
|
|
26
26
|
*/
|
|
27
27
|
altText: string;
|
|
28
28
|
}>;
|
|
29
|
-
declare const ToastCloseFrame: import("@
|
|
30
|
-
elevation?: number | import("@
|
|
29
|
+
declare const ToastCloseFrame: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, GuiElement, import("@hanzogui/core").RNViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
30
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
31
31
|
fullscreen?: boolean | undefined;
|
|
32
|
-
}, import("@
|
|
32
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
33
33
|
type ToastCloseFrameProps = GetProps<typeof ToastCloseFrame>;
|
|
34
34
|
type ToastCloseProps = ScopedProps<ToastCloseFrameProps & {}>;
|
|
35
|
-
declare const Toast: React.ForwardRefExoticComponent<Omit<import("@
|
|
35
|
+
declare const Toast: React.ForwardRefExoticComponent<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
36
36
|
unstyled?: boolean | undefined;
|
|
37
|
-
elevation?: number | import("@
|
|
37
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
38
38
|
fullscreen?: boolean | undefined;
|
|
39
|
-
}>, keyof ToastExtraProps> & ToastExtraProps & React.RefAttributes<GuiElement>> & import("@
|
|
39
|
+
}>, keyof ToastExtraProps> & ToastExtraProps & React.RefAttributes<GuiElement>> & import("@hanzogui/core").StaticComponentObject<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
40
40
|
unstyled?: boolean | undefined;
|
|
41
|
-
elevation?: number | import("@
|
|
41
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
42
42
|
fullscreen?: boolean | undefined;
|
|
43
|
-
}>, keyof ToastExtraProps> & ToastExtraProps, GuiElement, import("@
|
|
43
|
+
}>, keyof ToastExtraProps> & ToastExtraProps, GuiElement, import("@hanzogui/core").RNViewNonStyleProps & ToastExtraProps, import("@hanzogui/core").StackStyleBase, {
|
|
44
44
|
unstyled?: boolean | undefined;
|
|
45
|
-
elevation?: number | import("@
|
|
45
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
46
46
|
fullscreen?: boolean | undefined;
|
|
47
|
-
}, import("@
|
|
48
|
-
__tama: [Omit<import("@
|
|
47
|
+
}, import("@hanzogui/core").StaticConfigPublic> & Omit<import("@hanzogui/core").StaticConfigPublic, "staticConfig" | "styleable"> & {
|
|
48
|
+
__tama: [Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
49
49
|
unstyled?: boolean | undefined;
|
|
50
|
-
elevation?: number | import("@
|
|
50
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
51
51
|
fullscreen?: boolean | undefined;
|
|
52
|
-
}>, keyof ToastExtraProps> & ToastExtraProps, GuiElement, import("@
|
|
52
|
+
}>, keyof ToastExtraProps> & ToastExtraProps, GuiElement, import("@hanzogui/core").RNViewNonStyleProps & ToastExtraProps, import("@hanzogui/core").StackStyleBase, {
|
|
53
53
|
unstyled?: boolean | undefined;
|
|
54
|
-
elevation?: number | import("@
|
|
54
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
55
55
|
fullscreen?: boolean | undefined;
|
|
56
|
-
}, import("@
|
|
56
|
+
}, import("@hanzogui/core").StaticConfigPublic];
|
|
57
57
|
} & {
|
|
58
|
-
Title: import("@
|
|
58
|
+
Title: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
59
59
|
unstyled?: boolean | undefined;
|
|
60
|
-
size?: import("@
|
|
61
|
-
}, import("@
|
|
62
|
-
Description: import("@
|
|
60
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
61
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
62
|
+
Description: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
63
63
|
unstyled?: boolean | undefined;
|
|
64
|
-
size?: import("@
|
|
65
|
-
}, import("@
|
|
64
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
65
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
66
66
|
Action: React.ForwardRefExoticComponent<Omit<ToastActionProps, "scope"> & {
|
|
67
67
|
scope?: import("./ToastProvider").ToastScopes;
|
|
68
68
|
} & React.RefAttributes<GuiElement>>;
|
|
69
|
-
Close: React.ForwardRefExoticComponent<Omit<Omit<import("@
|
|
70
|
-
elevation?: number | import("@
|
|
69
|
+
Close: React.ForwardRefExoticComponent<Omit<Omit<import("@hanzogui/core").RNViewNonStyleProps, "elevation" | keyof import("@hanzogui/core").StackStyleBase | "fullscreen"> & import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & {
|
|
70
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
71
71
|
fullscreen?: boolean | undefined;
|
|
72
|
-
} & import("@
|
|
73
|
-
elevation?: number | import("@
|
|
72
|
+
} & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>> & import("@hanzogui/core").WithPseudoProps<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & {
|
|
73
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
74
74
|
fullscreen?: boolean | undefined;
|
|
75
|
-
} & import("@
|
|
76
|
-
elevation?: number | import("@
|
|
75
|
+
} & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>>> & import("@hanzogui/core").WithMediaProps<import("@hanzogui/core").WithThemeShorthandsAndPseudos<import("@hanzogui/core").StackStyleBase, {
|
|
76
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
77
77
|
fullscreen?: boolean | undefined;
|
|
78
78
|
}>>, "scope"> & {
|
|
79
79
|
scope?: import("./ToastProvider").ToastScopes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../src/Toast.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAMvF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAQ/C,QAAA,MAAM,UAAU;;;+CAed,CAAA;AAEF,KAAK,eAAe,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAQlD,QAAA,MAAM,gBAAgB;;;+CAepB,CAAA;AAEF,KAAK,qBAAqB,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAQ9D,KAAK,gBAAgB,GAAG,WAAW,CACjC,eAAe,GAAG;IAChB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;CAChB,CACF,CAAA;AA6BD,QAAA,MAAM,eAAe;;;+CAGnB,CAAA;AAEF,KAAK,oBAAoB,GAAG,QAAQ,CAAC,OAAO,eAAe,CAAC,CAAA;AAC5D,KAAK,eAAe,GAAG,WAAW,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;AAmE7D,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKT,CAAA;AAIF,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EAGb,QAAQ,EACR,kBAAkB,EAClB,aAAa,GACd,CAAA;AACD,YAAY,EAEV,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,cAAc,IAAI,mBAAmB,EAErC,WAAW,IAAI,gBAAgB,EAC/B,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,CAAA"}
|
package/types/ToastAnnounce.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { GetProps, GuiElement } from '@
|
|
2
|
-
import { VisuallyHidden } from '@
|
|
1
|
+
import type { GetProps, GuiElement } from '@hanzogui/core';
|
|
2
|
+
import { VisuallyHidden } from '@hanzogui/visually-hidden';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import type { ScopedProps } from './ToastProvider';
|
|
5
|
-
declare const ToastAnnounceExcludeFrame: import("@
|
|
5
|
+
declare const ToastAnnounceExcludeFrame: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, GuiElement, import("@hanzogui/core").RNViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {}, import("@hanzogui/core").StaticConfigPublic>;
|
|
6
6
|
type ToastAnnounceExcludeFrameProps = GetProps<typeof ToastAnnounceExcludeFrame>;
|
|
7
7
|
type ToastAnnounceExcludeExtraProps = {
|
|
8
8
|
altText?: string;
|
|
9
9
|
};
|
|
10
10
|
type ToastAnnounceExcludeProps = ToastAnnounceExcludeFrameProps & ToastAnnounceExcludeExtraProps;
|
|
11
|
-
declare const ToastAnnounceExclude: React.ForwardRefExoticComponent<Omit<import("@
|
|
11
|
+
declare const ToastAnnounceExclude: React.ForwardRefExoticComponent<Omit<import("@hanzogui/core").RNViewNonStyleProps, keyof import("@hanzogui/core").StackStyleBase> & import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>> & import("@hanzogui/core").WithPseudoProps<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>>> & import("@hanzogui/core").WithMediaProps<import("@hanzogui/core").WithThemeShorthandsAndPseudos<import("@hanzogui/core").StackStyleBase, {}>> & ToastAnnounceExcludeExtraProps & React.RefAttributes<GuiElement>>;
|
|
12
12
|
interface ToastAnnounceProps extends Omit<GetProps<typeof VisuallyHidden>, 'children'>, ScopedProps<{
|
|
13
13
|
children: string[];
|
|
14
14
|
}> {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastAnnounce.d.ts","sourceRoot":"","sources":["../src/ToastAnnounce.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAI1D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,QAAA,MAAM,yBAAyB,+NAE7B,CAAA;AAEF,KAAK,8BAA8B,GAAG,QAAQ,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEhF,KAAK,8BAA8B,GAAG;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,yBAAyB,GAAG,8BAA8B,GAC7D,8BAA8B,CAAA;AAEhC,QAAA,MAAM,oBAAoB,kyBAazB,CAAA;AAID,UAAU,kBACR,SACE,IAAI,CAAC,QAAQ,CAAC,OAAO,cAAc,CAAC,EAAE,UAAU,CAAC,EACjD,WAAW,CAAC;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;CAAG;AAE1C,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgC/C,CAAA;AAmBD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,CAAA"}
|