react-native-bread 0.1.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/README.md +148 -0
- package/lib/commonjs/icons/CloseIcon.js +22 -0
- package/lib/commonjs/icons/CloseIcon.js.map +1 -0
- package/lib/commonjs/icons/GreenCheck.js +27 -0
- package/lib/commonjs/icons/GreenCheck.js.map +1 -0
- package/lib/commonjs/icons/InfoIcon.js +24 -0
- package/lib/commonjs/icons/InfoIcon.js.map +1 -0
- package/lib/commonjs/icons/RedX.js +27 -0
- package/lib/commonjs/icons/RedX.js.map +1 -0
- package/lib/commonjs/icons/index.js +34 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/index.js +59 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/toast-api.js +127 -0
- package/lib/commonjs/toast-api.js.map +1 -0
- package/lib/commonjs/toast-provider.js +71 -0
- package/lib/commonjs/toast-provider.js.map +1 -0
- package/lib/commonjs/toast-store.js +278 -0
- package/lib/commonjs/toast-store.js.map +1 -0
- package/lib/commonjs/toast.js +445 -0
- package/lib/commonjs/toast.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/icons/CloseIcon.js +16 -0
- package/lib/module/icons/CloseIcon.js.map +1 -0
- package/lib/module/icons/GreenCheck.js +21 -0
- package/lib/module/icons/GreenCheck.js.map +1 -0
- package/lib/module/icons/InfoIcon.js +18 -0
- package/lib/module/icons/InfoIcon.js.map +1 -0
- package/lib/module/icons/RedX.js +21 -0
- package/lib/module/icons/RedX.js.map +1 -0
- package/lib/module/icons/index.js +7 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/toast-api.js +124 -0
- package/lib/module/toast-api.js.map +1 -0
- package/lib/module/toast-provider.js +67 -0
- package/lib/module/toast-provider.js.map +1 -0
- package/lib/module/toast-store.js +274 -0
- package/lib/module/toast-store.js.map +1 -0
- package/lib/module/toast.js +439 -0
- package/lib/module/toast.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/icons/CloseIcon.d.ts +3 -0
- package/lib/typescript/icons/CloseIcon.d.ts.map +1 -0
- package/lib/typescript/icons/GreenCheck.d.ts +3 -0
- package/lib/typescript/icons/GreenCheck.d.ts.map +1 -0
- package/lib/typescript/icons/InfoIcon.d.ts +3 -0
- package/lib/typescript/icons/InfoIcon.d.ts.map +1 -0
- package/lib/typescript/icons/RedX.d.ts +3 -0
- package/lib/typescript/icons/RedX.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +5 -0
- package/lib/typescript/icons/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/toast-api.d.ts +109 -0
- package/lib/typescript/toast-api.d.ts.map +1 -0
- package/lib/typescript/toast-provider.d.ts +52 -0
- package/lib/typescript/toast-provider.d.ts.map +1 -0
- package/lib/typescript/toast-store.d.ts +26 -0
- package/lib/typescript/toast-store.d.ts.map +1 -0
- package/lib/typescript/toast.d.ts +2 -0
- package/lib/typescript/toast.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +101 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/icons/CloseIcon.tsx +10 -0
- package/src/icons/GreenCheck.tsx +16 -0
- package/src/icons/InfoIcon.tsx +12 -0
- package/src/icons/RedX.tsx +16 -0
- package/src/icons/index.ts +4 -0
- package/src/index.ts +26 -0
- package/src/toast-api.ts +213 -0
- package/src/toast-provider.tsx +81 -0
- package/src/toast-store.ts +270 -0
- package/src/toast.tsx +417 -0
- package/src/types.ts +121 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from "react-native";
|
|
5
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
6
|
+
import Animated, { Easing, interpolate, interpolateColor, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
7
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
|
+
import { scheduleOnRN } from "react-native-worklets";
|
|
9
|
+
import { CloseIcon, GreenCheck, InfoIcon, RedX } from "./icons/index.js";
|
|
10
|
+
import { toastStore } from "./toast-store.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
const ICON_SIZE = 28;
|
|
13
|
+
|
|
14
|
+
/** Default icon for each toast type */
|
|
15
|
+
const DefaultIcon = ({
|
|
16
|
+
type,
|
|
17
|
+
accentColor
|
|
18
|
+
}) => {
|
|
19
|
+
switch (type) {
|
|
20
|
+
case "success":
|
|
21
|
+
return /*#__PURE__*/_jsx(GreenCheck, {
|
|
22
|
+
width: 36,
|
|
23
|
+
height: 36,
|
|
24
|
+
fill: accentColor
|
|
25
|
+
});
|
|
26
|
+
case "error":
|
|
27
|
+
return /*#__PURE__*/_jsx(RedX, {
|
|
28
|
+
width: ICON_SIZE,
|
|
29
|
+
height: ICON_SIZE,
|
|
30
|
+
fill: accentColor
|
|
31
|
+
});
|
|
32
|
+
case "loading":
|
|
33
|
+
return /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
34
|
+
size: ICON_SIZE,
|
|
35
|
+
color: accentColor
|
|
36
|
+
});
|
|
37
|
+
case "info":
|
|
38
|
+
return /*#__PURE__*/_jsx(InfoIcon, {
|
|
39
|
+
width: ICON_SIZE,
|
|
40
|
+
height: ICON_SIZE,
|
|
41
|
+
fill: accentColor
|
|
42
|
+
});
|
|
43
|
+
default:
|
|
44
|
+
return /*#__PURE__*/_jsx(GreenCheck, {
|
|
45
|
+
width: 36,
|
|
46
|
+
height: 36,
|
|
47
|
+
fill: accentColor
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Resolves the icon to render - checks per-toast, then config, then default */
|
|
53
|
+
const resolveIcon = (type, accentColor, customIcon, configIcon) => {
|
|
54
|
+
// Per-toast custom icon takes priority
|
|
55
|
+
if (customIcon) {
|
|
56
|
+
if (typeof customIcon === "function") {
|
|
57
|
+
return customIcon({
|
|
58
|
+
color: accentColor,
|
|
59
|
+
size: ICON_SIZE
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return customIcon;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Config-level custom icon
|
|
66
|
+
if (configIcon) {
|
|
67
|
+
return configIcon({
|
|
68
|
+
color: accentColor,
|
|
69
|
+
size: ICON_SIZE
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Default icon
|
|
74
|
+
return /*#__PURE__*/_jsx(DefaultIcon, {
|
|
75
|
+
type: type,
|
|
76
|
+
accentColor: accentColor
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const AnimatedIcon = ({
|
|
80
|
+
type,
|
|
81
|
+
accentColor,
|
|
82
|
+
customIcon,
|
|
83
|
+
configIcon
|
|
84
|
+
}) => {
|
|
85
|
+
const progress = useSharedValue(0);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
progress.value = withTiming(1, {
|
|
88
|
+
duration: 350,
|
|
89
|
+
easing: Easing.out(Easing.back(1.5))
|
|
90
|
+
});
|
|
91
|
+
}, [progress]);
|
|
92
|
+
const style = useAnimatedStyle(() => ({
|
|
93
|
+
opacity: progress.value,
|
|
94
|
+
transform: [{
|
|
95
|
+
scale: 0.7 + progress.value * 0.3
|
|
96
|
+
}]
|
|
97
|
+
}));
|
|
98
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
99
|
+
style: style,
|
|
100
|
+
children: resolveIcon(type, accentColor, customIcon, configIcon)
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// singleton instance
|
|
105
|
+
export const ToastContainer = () => {
|
|
106
|
+
const [visibleToasts, setVisibleToasts] = useState([]);
|
|
107
|
+
const [theme, setTheme] = useState(() => toastStore.getTheme());
|
|
108
|
+
const {
|
|
109
|
+
top,
|
|
110
|
+
bottom
|
|
111
|
+
} = useSafeAreaInsets();
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const initialState = toastStore.getState();
|
|
114
|
+
setVisibleToasts(initialState.visibleToasts);
|
|
115
|
+
setTheme(toastStore.getTheme());
|
|
116
|
+
return toastStore.subscribe(state => {
|
|
117
|
+
setVisibleToasts(state.visibleToasts);
|
|
118
|
+
setTheme(toastStore.getTheme());
|
|
119
|
+
});
|
|
120
|
+
}, []);
|
|
121
|
+
|
|
122
|
+
// Calculate visual index for each toast (exiting toasts don't count)
|
|
123
|
+
const getVisualIndex = useCallback(toastId => {
|
|
124
|
+
let visualIndex = 0;
|
|
125
|
+
for (const t of visibleToasts) {
|
|
126
|
+
if (t.id === toastId) break;
|
|
127
|
+
if (!t.isExiting) visualIndex++;
|
|
128
|
+
}
|
|
129
|
+
return visualIndex;
|
|
130
|
+
}, [visibleToasts]);
|
|
131
|
+
|
|
132
|
+
// Memoize the reversed array to avoid recreating on each render
|
|
133
|
+
const reversedToasts = useMemo(() => [...visibleToasts].reverse(), [visibleToasts]);
|
|
134
|
+
if (visibleToasts.length === 0) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const isBottom = theme.position === "bottom";
|
|
138
|
+
const inset = isBottom ? bottom : top;
|
|
139
|
+
const positionStyle = isBottom ? {
|
|
140
|
+
bottom: inset + theme.offset + 2
|
|
141
|
+
} : {
|
|
142
|
+
top: inset + theme.offset + 2
|
|
143
|
+
};
|
|
144
|
+
return /*#__PURE__*/_jsx(View, {
|
|
145
|
+
style: [styles.container, positionStyle],
|
|
146
|
+
pointerEvents: "box-none",
|
|
147
|
+
children: reversedToasts.map(toast => {
|
|
148
|
+
const index = toast.isExiting ? -1 : getVisualIndex(toast.id);
|
|
149
|
+
return /*#__PURE__*/_jsx(MemoizedToastItem, {
|
|
150
|
+
toast: toast,
|
|
151
|
+
index: index,
|
|
152
|
+
theme: theme,
|
|
153
|
+
position: theme.position
|
|
154
|
+
}, toast.id);
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const EASING = Easing.bezier(0.25, 0.1, 0.25, 1.0);
|
|
159
|
+
const ToY = 0;
|
|
160
|
+
const Duration = 400;
|
|
161
|
+
const ExitDuration = 350;
|
|
162
|
+
const MaxDragDown = 60;
|
|
163
|
+
const ToastItem = ({
|
|
164
|
+
toast,
|
|
165
|
+
index,
|
|
166
|
+
theme,
|
|
167
|
+
position
|
|
168
|
+
}) => {
|
|
169
|
+
const progress = useSharedValue(0);
|
|
170
|
+
const translationY = useSharedValue(0);
|
|
171
|
+
const isBeingDragged = useSharedValue(false);
|
|
172
|
+
const shouldDismiss = useSharedValue(false);
|
|
173
|
+
|
|
174
|
+
// Position-based animation values
|
|
175
|
+
const isBottom = position === "bottom";
|
|
176
|
+
const entryFromY = isBottom ? 80 : -80;
|
|
177
|
+
const exitToY = isBottom ? 100 : -100;
|
|
178
|
+
|
|
179
|
+
// Stack position animation
|
|
180
|
+
const stackIndex = useSharedValue(index);
|
|
181
|
+
|
|
182
|
+
// Title color animation on variant change
|
|
183
|
+
const colorProgress = useSharedValue(1);
|
|
184
|
+
const fromColor = useSharedValue(theme.colors[toast.type].accent);
|
|
185
|
+
const toColor = useSharedValue(theme.colors[toast.type].accent);
|
|
186
|
+
|
|
187
|
+
// Refs for tracking previous values to avoid unnecessary animations
|
|
188
|
+
const lastHandledType = useRef(toast.type);
|
|
189
|
+
const prevIndex = useRef(index);
|
|
190
|
+
const hasEntered = useRef(false);
|
|
191
|
+
|
|
192
|
+
// Combined animation effect for entry, exit, color transitions, and stack position
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
// Entry animation (only once on mount)
|
|
195
|
+
if (!hasEntered.current && !toast.isExiting) {
|
|
196
|
+
progress.value = withTiming(1, {
|
|
197
|
+
duration: Duration,
|
|
198
|
+
easing: EASING
|
|
199
|
+
});
|
|
200
|
+
hasEntered.current = true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Exit animation when isExiting becomes true
|
|
204
|
+
if (toast.isExiting) {
|
|
205
|
+
progress.value = withTiming(0, {
|
|
206
|
+
duration: ExitDuration,
|
|
207
|
+
easing: EASING
|
|
208
|
+
});
|
|
209
|
+
translationY.value = withTiming(exitToY, {
|
|
210
|
+
duration: ExitDuration,
|
|
211
|
+
easing: EASING
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Color transition when type changes
|
|
216
|
+
if (toast.type !== lastHandledType.current) {
|
|
217
|
+
fromColor.value = theme.colors[lastHandledType.current].accent;
|
|
218
|
+
toColor.value = theme.colors[toast.type].accent;
|
|
219
|
+
lastHandledType.current = toast.type;
|
|
220
|
+
colorProgress.value = 0;
|
|
221
|
+
colorProgress.value = withTiming(1, {
|
|
222
|
+
duration: 300,
|
|
223
|
+
easing: EASING
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Stack position animation when index changes
|
|
228
|
+
if (index >= 0 && prevIndex.current !== index) {
|
|
229
|
+
stackIndex.value = withTiming(index, {
|
|
230
|
+
duration: 300,
|
|
231
|
+
easing: EASING
|
|
232
|
+
});
|
|
233
|
+
prevIndex.current = index;
|
|
234
|
+
}
|
|
235
|
+
}, [toast.isExiting, toast.type, index, progress, translationY, fromColor, toColor, colorProgress, stackIndex, exitToY, theme.colors]);
|
|
236
|
+
const titleColorStyle = useAnimatedStyle(() => ({
|
|
237
|
+
color: interpolateColor(colorProgress.value, [0, 1], [fromColor.value, toColor.value])
|
|
238
|
+
}));
|
|
239
|
+
const dismissToast = useCallback(() => {
|
|
240
|
+
toastStore.hide(toast.id);
|
|
241
|
+
}, [toast.id]);
|
|
242
|
+
const panGesture = Gesture.Pan().onStart(() => {
|
|
243
|
+
"worklet";
|
|
244
|
+
|
|
245
|
+
isBeingDragged.value = true;
|
|
246
|
+
shouldDismiss.value = false;
|
|
247
|
+
}).onUpdate(event => {
|
|
248
|
+
"worklet";
|
|
249
|
+
|
|
250
|
+
const rawY = event.translationY;
|
|
251
|
+
// For top: negative Y = dismiss direction, positive Y = resistance
|
|
252
|
+
// For bottom: positive Y = dismiss direction, negative Y = resistance
|
|
253
|
+
const dismissDrag = isBottom ? rawY : -rawY;
|
|
254
|
+
const resistDrag = isBottom ? -rawY : rawY;
|
|
255
|
+
if (dismissDrag > 0) {
|
|
256
|
+
// Moving toward dismiss direction
|
|
257
|
+
const clampedY = isBottom ? Math.min(rawY, 180) : Math.max(rawY, -180);
|
|
258
|
+
translationY.value = clampedY;
|
|
259
|
+
if (dismissDrag > 40 || (isBottom ? event.velocityY > 300 : event.velocityY < -300)) {
|
|
260
|
+
shouldDismiss.value = true;
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
// Moving away from edge - apply resistance
|
|
264
|
+
const exponentialDrag = MaxDragDown * (1 - Math.exp(-resistDrag / 250));
|
|
265
|
+
translationY.value = isBottom ? -Math.min(exponentialDrag, MaxDragDown) : Math.min(exponentialDrag, MaxDragDown);
|
|
266
|
+
shouldDismiss.value = false;
|
|
267
|
+
}
|
|
268
|
+
}).onEnd(() => {
|
|
269
|
+
"worklet";
|
|
270
|
+
|
|
271
|
+
isBeingDragged.value = false;
|
|
272
|
+
if (shouldDismiss.value) {
|
|
273
|
+
progress.value = withTiming(0, {
|
|
274
|
+
duration: ExitDuration,
|
|
275
|
+
easing: EASING
|
|
276
|
+
});
|
|
277
|
+
const exitOffset = isBottom ? 200 : -200;
|
|
278
|
+
translationY.value = withTiming(translationY.value + exitOffset, {
|
|
279
|
+
duration: ExitDuration,
|
|
280
|
+
easing: EASING
|
|
281
|
+
});
|
|
282
|
+
scheduleOnRN(dismissToast);
|
|
283
|
+
} else {
|
|
284
|
+
translationY.value = withTiming(0, {
|
|
285
|
+
duration: 650,
|
|
286
|
+
easing: EASING
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
291
|
+
const baseTranslateY = interpolate(progress.value, [0, 1], [entryFromY, ToY]);
|
|
292
|
+
|
|
293
|
+
// Stack offset: each toast behind moves away from edge (up for top, down for bottom)
|
|
294
|
+
const stackOffsetY = isBottom ? stackIndex.value * 10 : stackIndex.value * -10;
|
|
295
|
+
|
|
296
|
+
// Stack scale: each toast behind scales down by 0.05
|
|
297
|
+
const stackScale = 1 - stackIndex.value * 0.05;
|
|
298
|
+
const finalTranslateY = baseTranslateY + translationY.value + stackOffsetY;
|
|
299
|
+
const progressOpacity = interpolate(progress.value, [0, 1], [0, 1]);
|
|
300
|
+
// For top: dragging up (negative) fades out. For bottom: dragging down (positive) fades out
|
|
301
|
+
const dismissDirection = isBottom ? translationY.value : -translationY.value;
|
|
302
|
+
const dragOpacity = dismissDirection > 0 ? interpolate(dismissDirection, [0, 130], [1, 0], "clamp") : 1;
|
|
303
|
+
const opacity = progressOpacity * dragOpacity;
|
|
304
|
+
const dragScale = interpolate(Math.abs(translationY.value), [0, 50], [1, 0.98], "clamp");
|
|
305
|
+
const scale = stackScale * dragScale;
|
|
306
|
+
return {
|
|
307
|
+
transform: [{
|
|
308
|
+
translateY: finalTranslateY
|
|
309
|
+
}, {
|
|
310
|
+
scale
|
|
311
|
+
}],
|
|
312
|
+
opacity,
|
|
313
|
+
zIndex: 1000 - stackIndex.value
|
|
314
|
+
};
|
|
315
|
+
});
|
|
316
|
+
const accentColor = theme.colors[toast.type].accent;
|
|
317
|
+
const backgroundColor = theme.colors[toast.type].background;
|
|
318
|
+
const verticalAnchor = isBottom ? {
|
|
319
|
+
bottom: 0
|
|
320
|
+
} : {
|
|
321
|
+
top: 0
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// Per-toast overrides from options
|
|
325
|
+
const {
|
|
326
|
+
options
|
|
327
|
+
} = toast;
|
|
328
|
+
const customIcon = options?.icon;
|
|
329
|
+
const configIcon = theme.icons[toast.type];
|
|
330
|
+
|
|
331
|
+
// Resolve dismissible and showCloseButton (per-toast overrides config)
|
|
332
|
+
const isDismissible = options?.dismissible ?? theme.dismissible;
|
|
333
|
+
const shouldShowCloseButton = toast.type !== "loading" && (options?.showCloseButton ?? theme.showCloseButton);
|
|
334
|
+
|
|
335
|
+
// Enable/disable gesture based on dismissible setting
|
|
336
|
+
const gesture = isDismissible ? panGesture : Gesture.Pan().enabled(false);
|
|
337
|
+
return /*#__PURE__*/_jsx(GestureDetector, {
|
|
338
|
+
gesture: gesture,
|
|
339
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
340
|
+
style: [styles.toast, verticalAnchor, {
|
|
341
|
+
backgroundColor
|
|
342
|
+
}, theme.toastStyle, options?.style, animatedStyle],
|
|
343
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
344
|
+
style: styles.content,
|
|
345
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
346
|
+
style: styles.icon,
|
|
347
|
+
children: /*#__PURE__*/_jsx(AnimatedIcon, {
|
|
348
|
+
type: toast.type,
|
|
349
|
+
accentColor: accentColor,
|
|
350
|
+
customIcon: customIcon,
|
|
351
|
+
configIcon: configIcon
|
|
352
|
+
}, toast.type)
|
|
353
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
354
|
+
style: styles.textContainer,
|
|
355
|
+
children: [/*#__PURE__*/_jsx(Animated.Text, {
|
|
356
|
+
maxFontSizeMultiplier: 1.35,
|
|
357
|
+
allowFontScaling: false,
|
|
358
|
+
style: [styles.title, theme.titleStyle, options?.titleStyle, titleColorStyle],
|
|
359
|
+
children: toast.title
|
|
360
|
+
}), toast.description && /*#__PURE__*/_jsx(Text, {
|
|
361
|
+
allowFontScaling: false,
|
|
362
|
+
maxFontSizeMultiplier: 1.35,
|
|
363
|
+
style: [styles.description, theme.descriptionStyle, options?.descriptionStyle],
|
|
364
|
+
children: toast.description
|
|
365
|
+
})]
|
|
366
|
+
}), shouldShowCloseButton && /*#__PURE__*/_jsx(Pressable, {
|
|
367
|
+
style: styles.closeButton,
|
|
368
|
+
onPress: dismissToast,
|
|
369
|
+
hitSlop: 12,
|
|
370
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
371
|
+
width: 20,
|
|
372
|
+
height: 20
|
|
373
|
+
})
|
|
374
|
+
})]
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
const MemoizedToastItem = /*#__PURE__*/memo(ToastItem);
|
|
380
|
+
const styles = StyleSheet.create({
|
|
381
|
+
container: {
|
|
382
|
+
position: "absolute",
|
|
383
|
+
left: 16,
|
|
384
|
+
right: 16,
|
|
385
|
+
zIndex: 1000
|
|
386
|
+
},
|
|
387
|
+
closeButton: {
|
|
388
|
+
padding: 4,
|
|
389
|
+
alignItems: "center",
|
|
390
|
+
justifyContent: "center"
|
|
391
|
+
},
|
|
392
|
+
icon: {
|
|
393
|
+
width: 48,
|
|
394
|
+
height: 48,
|
|
395
|
+
alignItems: "center",
|
|
396
|
+
justifyContent: "center",
|
|
397
|
+
marginLeft: 8
|
|
398
|
+
},
|
|
399
|
+
content: {
|
|
400
|
+
alignItems: "center",
|
|
401
|
+
flexDirection: "row",
|
|
402
|
+
gap: 12,
|
|
403
|
+
minHeight: 36
|
|
404
|
+
},
|
|
405
|
+
description: {
|
|
406
|
+
color: "#6B7280",
|
|
407
|
+
fontSize: 12,
|
|
408
|
+
fontWeight: "500",
|
|
409
|
+
lineHeight: 16
|
|
410
|
+
},
|
|
411
|
+
textContainer: {
|
|
412
|
+
flex: 1,
|
|
413
|
+
gap: 1,
|
|
414
|
+
justifyContent: "center"
|
|
415
|
+
},
|
|
416
|
+
title: {
|
|
417
|
+
fontSize: 14,
|
|
418
|
+
fontWeight: "700",
|
|
419
|
+
lineHeight: 20
|
|
420
|
+
},
|
|
421
|
+
toast: {
|
|
422
|
+
borderRadius: 20,
|
|
423
|
+
borderCurve: "continuous",
|
|
424
|
+
position: "absolute",
|
|
425
|
+
left: 0,
|
|
426
|
+
right: 0,
|
|
427
|
+
paddingHorizontal: 12,
|
|
428
|
+
paddingVertical: 10,
|
|
429
|
+
shadowColor: "#000",
|
|
430
|
+
shadowOffset: {
|
|
431
|
+
width: 0,
|
|
432
|
+
height: 8
|
|
433
|
+
},
|
|
434
|
+
shadowOpacity: 0.05,
|
|
435
|
+
shadowRadius: 24,
|
|
436
|
+
elevation: 8
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","useCallback","useEffect","useMemo","useRef","useState","ActivityIndicator","Pressable","StyleSheet","Text","View","Gesture","GestureDetector","Animated","Easing","interpolate","interpolateColor","useAnimatedStyle","useSharedValue","withTiming","useSafeAreaInsets","scheduleOnRN","CloseIcon","GreenCheck","InfoIcon","RedX","toastStore","jsx","_jsx","jsxs","_jsxs","ICON_SIZE","DefaultIcon","type","accentColor","width","height","fill","size","color","resolveIcon","customIcon","configIcon","AnimatedIcon","progress","value","duration","easing","out","back","style","opacity","transform","scale","children","ToastContainer","visibleToasts","setVisibleToasts","theme","setTheme","getTheme","top","bottom","initialState","getState","subscribe","state","getVisualIndex","toastId","visualIndex","t","id","isExiting","reversedToasts","reverse","length","isBottom","position","inset","positionStyle","offset","styles","container","pointerEvents","map","toast","index","MemoizedToastItem","EASING","bezier","ToY","Duration","ExitDuration","MaxDragDown","ToastItem","translationY","isBeingDragged","shouldDismiss","entryFromY","exitToY","stackIndex","colorProgress","fromColor","colors","accent","toColor","lastHandledType","prevIndex","hasEntered","current","titleColorStyle","dismissToast","hide","panGesture","Pan","onStart","onUpdate","event","rawY","dismissDrag","resistDrag","clampedY","Math","min","max","velocityY","exponentialDrag","exp","onEnd","exitOffset","animatedStyle","baseTranslateY","stackOffsetY","stackScale","finalTranslateY","progressOpacity","dismissDirection","dragOpacity","dragScale","abs","translateY","zIndex","backgroundColor","background","verticalAnchor","options","icon","icons","isDismissible","dismissible","shouldShowCloseButton","showCloseButton","gesture","enabled","toastStyle","content","textContainer","maxFontSizeMultiplier","allowFontScaling","title","titleStyle","description","descriptionStyle","closeButton","onPress","hitSlop","create","left","right","padding","alignItems","justifyContent","marginLeft","flexDirection","gap","minHeight","fontSize","fontWeight","lineHeight","flex","borderRadius","borderCurve","paddingHorizontal","paddingVertical","shadowColor","shadowOffset","shadowOpacity","shadowRadius","elevation"],"sourceRoot":"../../src","sources":["toast.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAkBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC/F,SAASC,iBAAiB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AACnF,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,MAAM,EACNC,WAAW,EACXC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,kBAAS;AAC/D,SAAmEC,UAAU,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGrG,MAAMC,SAAS,GAAG,EAAE;;AAEpB;AACA,MAAMC,WAAW,GAAGA,CAAC;EAAEC,IAAI;EAAEC;AAAsD,CAAC,KAAK;EACvF,QAAQD,IAAI;IACV,KAAK,SAAS;MACZ,oBAAOL,IAAA,CAACL,UAAU;QAACY,KAAK,EAAE,EAAG;QAACC,MAAM,EAAE,EAAG;QAACC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ACDd,WAAW,EAAE;IACX1H,KAAK,EAAE,SAAS;IAChByI,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAE;EACd,CAAC;EACDtB,aAAa,EAAE;IACbuB,IAAI,EAAE,CAAC;IACPL,GAAG,EAAE,CAAC;IACNH,cAAc,EAAE;EAClB,CAAC;EACDZ,KAAK,EAAE;IACLiB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,UAAU,EAAE;EACd,CAAC;EACD7F,KAAK,EAAE;IACL+F,YAAY,EAAE,EAAE;IAChBC,WAAW,EAAE,YAAY;IACzBxG,QAAQ,EAAE,UAAU;IACpB0F,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRc,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEtJ,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCsJ,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,EAAE;IAChBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloseIcon.d.ts","sourceRoot":"","sources":["../../../src/icons/CloseIcon.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAQ,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,SAAS,GAAI,OAAO,QAAQ,4CAOxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GreenCheck.d.ts","sourceRoot":"","sources":["../../../src/icons/GreenCheck.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAQ,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,UAAU,GAAI,OAAO,QAAQ,4CAazC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoIcon.d.ts","sourceRoot":"","sources":["../../../src/icons/InfoIcon.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAQ,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,QAAQ,GAAI,OAAO,QAAQ,4CASvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedX.d.ts","sourceRoot":"","sources":["../../../src/icons/RedX.tsx"],"names":[],"mappings":"AAAA,OAAY,EAAQ,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAO,MAAM,IAAI,GAAI,OAAO,QAAQ,4CAanC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CloseIcon, GreenCheck, InfoIcon, RedX } from "./icons";
|
|
2
|
+
export { ToastContainer } from "./toast";
|
|
3
|
+
export { toast } from "./toast-api";
|
|
4
|
+
export { BreadLoaf } from "./toast-provider";
|
|
5
|
+
export { toastStore } from "./toast-store";
|
|
6
|
+
export type { ErrorMessageInput, IconProps, IconRenderFn, MessageInput, PromiseMessages, PromiseResult, Toast, ToastConfig, ToastOptions, ToastPosition, ToastState, ToastType, ToastTypeColors, } from "./types";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,SAAS,EACT,eAAe,GAChB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { PromiseMessages, PromiseResult, ToastOptions, ToastType } from "./types";
|
|
2
|
+
/** Second parameter can be a string (description) or options object */
|
|
3
|
+
type DescriptionOrOptions = string | ToastOptions;
|
|
4
|
+
type BaseToastFn = ((title: string, description?: string, type?: ToastType, duration?: number) => void) & {
|
|
5
|
+
/**
|
|
6
|
+
* Show a success toast with a green checkmark icon.
|
|
7
|
+
* @param title - The toast title
|
|
8
|
+
* @param descriptionOrOptions - Description string OR options object with description, duration, icon, style, etc.
|
|
9
|
+
* @param duration - Duration in ms (default: 4000). Ignored if options object is passed.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Simple usage
|
|
13
|
+
* toast.success("Saved!", "Your changes have been saved");
|
|
14
|
+
*
|
|
15
|
+
* // With options
|
|
16
|
+
* toast.success("Saved!", {
|
|
17
|
+
* description: "Your changes have been saved",
|
|
18
|
+
* duration: 5000,
|
|
19
|
+
* icon: <CustomIcon />,
|
|
20
|
+
* style: { borderRadius: 8 },
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
success: (title: string, descriptionOrOptions?: DescriptionOrOptions, duration?: number) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Show an error toast with a red X icon.
|
|
27
|
+
* @param title - The toast title
|
|
28
|
+
* @param descriptionOrOptions - Description string OR options object
|
|
29
|
+
* @param duration - Duration in ms (default: 4000). Ignored if options object is passed.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* toast.error("Failed", "Something went wrong");
|
|
33
|
+
* toast.error("Failed", { description: "Something went wrong", icon: <CustomErrorIcon /> });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
error: (title: string, descriptionOrOptions?: DescriptionOrOptions, duration?: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Show an info toast with a blue info icon.
|
|
39
|
+
* @param title - The toast title
|
|
40
|
+
* @param descriptionOrOptions - Description string OR options object
|
|
41
|
+
* @param duration - Duration in ms (default: 4000). Ignored if options object is passed.
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* toast.info("Tip", "Swipe up to dismiss");
|
|
45
|
+
* toast.info("Tip", { description: "Swipe up to dismiss", style: { backgroundColor: '#f0f9ff' } });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
info: (title: string, descriptionOrOptions?: DescriptionOrOptions, duration?: number) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Show a loading toast that automatically transitions to success or error
|
|
51
|
+
* based on the promise result. Great for async operations like API calls.
|
|
52
|
+
* @param promise - The promise to track
|
|
53
|
+
* @param messages - Configuration for loading, success, and error states
|
|
54
|
+
* @returns Promise result with `{ data, success: true }` or `{ error, success: false }`
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* toast.promise(fetchUser(id), {
|
|
58
|
+
* loading: { title: "Loading...", description: "Fetching user data" },
|
|
59
|
+
* success: { title: "Done!", description: "User loaded" },
|
|
60
|
+
* error: (err) => ({ title: "Error", description: err.message }),
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
promise: <T>(promise: Promise<T>, messages: PromiseMessages) => Promise<PromiseResult<T>>;
|
|
65
|
+
/**
|
|
66
|
+
* Dismiss a specific toast by its ID.
|
|
67
|
+
* @param id - The toast ID to dismiss
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* toast.dismiss("toast-123");
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
dismiss: (id: string) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Dismiss all visible toasts immediately.
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* toast.dismissAll();
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
dismissAll: () => void;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Toast API for showing notifications.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { toast } from 'react-native-bread';
|
|
89
|
+
*
|
|
90
|
+
* // Basic toasts
|
|
91
|
+
* toast.success("Saved!", "Your changes have been saved");
|
|
92
|
+
* toast.error("Error", "Something went wrong");
|
|
93
|
+
* toast.info("Tip", "Swipe up to dismiss");
|
|
94
|
+
*
|
|
95
|
+
* // Promise toast (loading → success/error)
|
|
96
|
+
* toast.promise(apiCall(), {
|
|
97
|
+
* loading: { title: "Loading..." },
|
|
98
|
+
* success: { title: "Done!" },
|
|
99
|
+
* error: (err) => ({ title: "Failed", description: err.message }),
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* // Dismiss toasts
|
|
103
|
+
* toast.dismiss(id);
|
|
104
|
+
* toast.dismissAll();
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
export declare const toast: BaseToastFn;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=toast-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-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