@yahoo/uds-mobile 2.15.0 → 2.17.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 +27 -24
- package/dist/bin/fixtures/dist/index.mjs +14 -0
- package/dist/components/Input.cjs +16 -13
- package/dist/components/Input.d.cts.map +1 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +16 -13
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputHelpText.cjs +52 -0
- package/dist/components/InputHelpText.d.cts +37 -0
- package/dist/components/InputHelpText.d.cts.map +1 -0
- package/dist/components/InputHelpText.d.ts +37 -0
- package/dist/components/InputHelpText.d.ts.map +1 -0
- package/dist/components/InputHelpText.js +52 -0
- package/dist/components/InputHelpText.js.map +1 -0
- package/dist/components/Toast/Toast.cjs +141 -0
- package/dist/components/Toast/Toast.d.cts +38 -0
- package/dist/components/Toast/Toast.d.cts.map +1 -0
- package/dist/components/Toast/Toast.d.ts +38 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.js +141 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.cjs +88 -0
- package/dist/components/Toast/ToastAnimatedItem.d.cts +27 -0
- package/dist/components/Toast/ToastAnimatedItem.d.cts.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.d.ts +27 -0
- package/dist/components/Toast/ToastAnimatedItem.d.ts.map +1 -0
- package/dist/components/Toast/ToastAnimatedItem.js +87 -0
- package/dist/components/Toast/ToastAnimatedItem.js.map +1 -0
- package/dist/components/Toast/ToastItem.cjs +35 -0
- package/dist/components/Toast/ToastItem.d.cts +25 -0
- package/dist/components/Toast/ToastItem.d.cts.map +1 -0
- package/dist/components/Toast/ToastItem.d.ts +25 -0
- package/dist/components/Toast/ToastItem.d.ts.map +1 -0
- package/dist/components/Toast/ToastItem.js +35 -0
- package/dist/components/Toast/ToastItem.js.map +1 -0
- package/dist/components/Toast/ToastProvider.cjs +144 -0
- package/dist/components/Toast/ToastProvider.d.cts +58 -0
- package/dist/components/Toast/ToastProvider.d.cts.map +1 -0
- package/dist/components/Toast/ToastProvider.d.ts +58 -0
- package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/Toast/ToastProvider.js +143 -0
- package/dist/components/Toast/ToastProvider.js.map +1 -0
- package/dist/components/Toast/ToastViewport.cjs +48 -0
- package/dist/components/Toast/ToastViewport.d.cts +42 -0
- package/dist/components/Toast/ToastViewport.d.cts.map +1 -0
- package/dist/components/Toast/ToastViewport.d.ts +42 -0
- package/dist/components/Toast/ToastViewport.d.ts.map +1 -0
- package/dist/components/Toast/ToastViewport.js +48 -0
- package/dist/components/Toast/ToastViewport.js.map +1 -0
- package/dist/components/Toast/createToast.cjs +21 -0
- package/dist/components/Toast/createToast.d.cts +10 -0
- package/dist/components/Toast/createToast.d.cts.map +1 -0
- package/dist/components/Toast/createToast.d.ts +10 -0
- package/dist/components/Toast/createToast.d.ts.map +1 -0
- package/dist/components/Toast/createToast.js +20 -0
- package/dist/components/Toast/createToast.js.map +1 -0
- package/dist/components/Toast/index.cjs +10 -0
- package/dist/components/Toast/index.d.cts +6 -0
- package/dist/components/Toast/index.d.ts +6 -0
- package/dist/components/Toast/index.js +5 -0
- package/dist/components/Toast/types.cjs +1 -0
- package/dist/components/Toast/types.d.cts +113 -0
- package/dist/components/Toast/types.d.cts.map +1 -0
- package/dist/components/Toast/types.d.ts +113 -0
- package/dist/components/Toast/types.d.ts.map +1 -0
- package/dist/components/Toast/types.js +1 -0
- package/dist/components/Toast/useToastController.cjs +286 -0
- package/dist/components/Toast/useToastController.d.cts +25 -0
- package/dist/components/Toast/useToastController.d.cts.map +1 -0
- package/dist/components/Toast/useToastController.d.ts +25 -0
- package/dist/components/Toast/useToastController.d.ts.map +1 -0
- package/dist/components/Toast/useToastController.js +286 -0
- package/dist/components/Toast/useToastController.js.map +1 -0
- package/dist/components/Toast/utils.cjs +69 -0
- package/dist/components/Toast/utils.d.cts +27 -0
- package/dist/components/Toast/utils.d.cts.map +1 -0
- package/dist/components/Toast/utils.d.ts +27 -0
- package/dist/components/Toast/utils.d.ts.map +1 -0
- package/dist/components/Toast/utils.js +55 -0
- package/dist/components/Toast/utils.js.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.cjs +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.cts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts +17 -0
- package/dist/components/internal/Overlay/OverlayPortal.d.ts.map +1 -0
- package/dist/components/internal/Overlay/OverlayPortal.js +20 -0
- package/dist/components/internal/Overlay/OverlayPortal.js.map +1 -0
- package/dist/components/internal/Overlay/index.cjs +6 -0
- package/dist/components/internal/Overlay/index.d.cts +5 -0
- package/dist/components/internal/Overlay/index.d.ts +5 -0
- package/dist/components/internal/Overlay/index.js +4 -0
- package/dist/components/internal/Overlay/types.cjs +1 -0
- package/dist/components/internal/Overlay/types.d.cts +21 -0
- package/dist/components/internal/Overlay/types.d.cts.map +1 -0
- package/dist/components/internal/Overlay/types.d.ts +21 -0
- package/dist/components/internal/Overlay/types.d.ts.map +1 -0
- package/dist/components/internal/Overlay/types.js +1 -0
- package/dist/components/internal/Overlay/useControllableState.cjs +34 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.cts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts +18 -0
- package/dist/components/internal/Overlay/useControllableState.d.ts.map +1 -0
- package/dist/components/internal/Overlay/useControllableState.js +34 -0
- package/dist/components/internal/Overlay/useControllableState.js.map +1 -0
- package/dist/jest/mocks/gesture-handler.cjs +38 -0
- package/dist/jest/mocks/gesture-handler.d.cts +41 -0
- package/dist/jest/mocks/gesture-handler.d.cts.map +1 -0
- package/dist/jest/mocks/gesture-handler.d.ts +41 -0
- package/dist/jest/mocks/gesture-handler.d.ts.map +1 -0
- package/dist/jest/mocks/gesture-handler.js +37 -0
- package/dist/jest/mocks/gesture-handler.js.map +1 -0
- package/dist/jest/mocks/safe-area-context.cjs +35 -0
- package/dist/jest/mocks/safe-area-context.d.cts +43 -0
- package/dist/jest/mocks/safe-area-context.d.cts.map +1 -0
- package/dist/jest/mocks/safe-area-context.d.ts +43 -0
- package/dist/jest/mocks/safe-area-context.d.ts.map +1 -0
- package/dist/jest/mocks/safe-area-context.js +32 -0
- package/dist/jest/mocks/safe-area-context.js.map +1 -0
- package/dist/jest/mocks/screens.cjs +8 -0
- package/dist/jest/mocks/screens.d.cts +12 -0
- package/dist/jest/mocks/screens.d.cts.map +1 -0
- package/dist/jest/mocks/screens.d.ts +12 -0
- package/dist/jest/mocks/screens.d.ts.map +1 -0
- package/dist/jest/mocks/screens.js +9 -0
- package/dist/jest/mocks/screens.js.map +1 -0
- package/dist/jest/mocks/styles.cjs +38 -1
- package/dist/jest/mocks/styles.d.cts +3 -2
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts +3 -2
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +38 -2
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/portal.cjs +1 -0
- package/dist/portal.d.cts +6 -1
- package/dist/portal.d.cts.map +1 -1
- package/dist/portal.d.ts +6 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +1 -1
- package/dist/portal.js.map +1 -1
- package/dist/types/dist/index.d.cts +4 -1
- package/dist/types/dist/index.d.cts.map +1 -1
- package/dist/types/dist/index.d.ts +4 -1
- package/dist/types/dist/index.d.ts.map +1 -1
- package/fonts/index.cjs +209 -209
- package/fonts/index.mjs +209 -209
- package/generated/styles.cjs +114 -0
- package/generated/styles.d.ts +29 -0
- package/generated/styles.mjs +114 -0
- package/generated/unistyles.d.ts +110 -0
- package/package.json +21 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastProps } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/Toast.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* **A toast notification for short, non-blocking system feedback.**
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* Toast renders the configured mobile toast surface. It supports variant icons,
|
|
11
|
+
* message or custom content, an optional action button, and an optional dismiss
|
|
12
|
+
* affordance.
|
|
13
|
+
*
|
|
14
|
+
* This component only renders the visual toast. Use ToastProvider, useToast, or
|
|
15
|
+
* createToast for floating toast state, queueing, placement, timers, and motion.
|
|
16
|
+
*
|
|
17
|
+
* @category Feedback
|
|
18
|
+
* @platform mobile
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import { Toast } from '@yahoo/uds-mobile/Toast';
|
|
23
|
+
*
|
|
24
|
+
* <Toast variant="info" message="Draft saved" />
|
|
25
|
+
* <Toast
|
|
26
|
+
* variant="success"
|
|
27
|
+
* message="Message archived"
|
|
28
|
+
* actionButton="Undo"
|
|
29
|
+
* onActionPress={() => {}}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @see {@link ToastProvider} for floating toast state and placement
|
|
34
|
+
*/
|
|
35
|
+
declare const Toast: _$react.NamedExoticComponent<ToastProps>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Toast };
|
|
38
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"mappings":";;;;;;;;AAS0C;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCpC,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { IconSlot } from "../IconSlot.js";
|
|
3
|
+
import { Text as Text$1 } from "../Text.js";
|
|
4
|
+
import { Button } from "../Button.js";
|
|
5
|
+
import { memo, useCallback, useMemo } from "react";
|
|
6
|
+
import { ActivityIndicator, Pressable, StyleSheet, View } from "react-native";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { toastStyles } from "../../../generated/styles";
|
|
9
|
+
//#region src/components/Toast/Toast.tsx
|
|
10
|
+
const TOAST_ICON_MAP = {
|
|
11
|
+
error: "Error",
|
|
12
|
+
info: "Info",
|
|
13
|
+
loading: "Progress",
|
|
14
|
+
success: "CheckCircle",
|
|
15
|
+
warning: "Warning"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* **A toast notification for short, non-blocking system feedback.**
|
|
19
|
+
*
|
|
20
|
+
* @description
|
|
21
|
+
* Toast renders the configured mobile toast surface. It supports variant icons,
|
|
22
|
+
* message or custom content, an optional action button, and an optional dismiss
|
|
23
|
+
* affordance.
|
|
24
|
+
*
|
|
25
|
+
* This component only renders the visual toast. Use ToastProvider, useToast, or
|
|
26
|
+
* createToast for floating toast state, queueing, placement, timers, and motion.
|
|
27
|
+
*
|
|
28
|
+
* @category Feedback
|
|
29
|
+
* @platform mobile
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* import { Toast } from '@yahoo/uds-mobile/Toast';
|
|
34
|
+
*
|
|
35
|
+
* <Toast variant="info" message="Draft saved" />
|
|
36
|
+
* <Toast
|
|
37
|
+
* variant="success"
|
|
38
|
+
* message="Message archived"
|
|
39
|
+
* actionButton="Undo"
|
|
40
|
+
* onActionPress={() => {}}
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link ToastProvider} for floating toast state and placement
|
|
45
|
+
*/
|
|
46
|
+
const Toast = memo(function Toast({ id, size: _size = "default", variant = "info", message, children, actionButton, onActionPress, onClickActionButton, onClose, onClickCloseButton, startIcon, closeIcon = "Cross", dismissible, closeAccessibilityLabel = "Dismiss", style, ref, ...rest }) {
|
|
47
|
+
toastStyles.useVariants({ variant });
|
|
48
|
+
const icon = startIcon === void 0 ? TOAST_ICON_MAP[variant] : startIcon;
|
|
49
|
+
const hasContent = message !== void 0 && message !== null;
|
|
50
|
+
const actionHandler = onActionPress ?? onClickActionButton;
|
|
51
|
+
const isDismissible = dismissible ?? closeIcon !== false;
|
|
52
|
+
const handleActionPress = useCallback(() => {
|
|
53
|
+
actionHandler?.();
|
|
54
|
+
}, [actionHandler]);
|
|
55
|
+
const handleClosePress = useCallback(() => {
|
|
56
|
+
onClose?.(id);
|
|
57
|
+
onClickCloseButton?.(id);
|
|
58
|
+
}, [
|
|
59
|
+
id,
|
|
60
|
+
onClickCloseButton,
|
|
61
|
+
onClose
|
|
62
|
+
]);
|
|
63
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
64
|
+
ref,
|
|
65
|
+
accessibilityLiveRegion: "polite",
|
|
66
|
+
accessibilityRole: "alert",
|
|
67
|
+
style: useMemo(() => [
|
|
68
|
+
toastStyles.root,
|
|
69
|
+
internalStyles.root,
|
|
70
|
+
style
|
|
71
|
+
], [style, toastStyles.root]),
|
|
72
|
+
...rest,
|
|
73
|
+
children: [
|
|
74
|
+
icon !== false && (variant === "loading" && startIcon === void 0 ? /* @__PURE__ */ jsx(ActivityIndicator, {
|
|
75
|
+
size: toastStyles.icon.fontSize,
|
|
76
|
+
color: toastStyles.icon.color,
|
|
77
|
+
style: internalStyles.icon
|
|
78
|
+
}) : /* @__PURE__ */ jsx(IconSlot, {
|
|
79
|
+
icon,
|
|
80
|
+
variant: "fill",
|
|
81
|
+
size: toastStyles.icon.iconSizeToken ?? "md",
|
|
82
|
+
style: [toastStyles.icon, internalStyles.icon],
|
|
83
|
+
accessibilityElementsHidden: true,
|
|
84
|
+
importantForAccessibility: "no"
|
|
85
|
+
})),
|
|
86
|
+
/* @__PURE__ */ jsx(View, {
|
|
87
|
+
style: internalStyles.content,
|
|
88
|
+
children: hasContent ? /* @__PURE__ */ jsx(Text$1, {
|
|
89
|
+
style: [toastStyles.label, toastStyles.text],
|
|
90
|
+
children: message
|
|
91
|
+
}) : children
|
|
92
|
+
}),
|
|
93
|
+
actionButton && actionHandler && /* @__PURE__ */ jsx(Button, {
|
|
94
|
+
size: "sm",
|
|
95
|
+
variant: "secondary",
|
|
96
|
+
disableEffects: true,
|
|
97
|
+
onPress: handleActionPress,
|
|
98
|
+
children: actionButton
|
|
99
|
+
}),
|
|
100
|
+
isDismissible && closeIcon !== false && /* @__PURE__ */ jsx(Pressable, {
|
|
101
|
+
accessibilityLabel: closeAccessibilityLabel,
|
|
102
|
+
accessibilityRole: "button",
|
|
103
|
+
hitSlop: 12,
|
|
104
|
+
onPress: handleClosePress,
|
|
105
|
+
style: internalStyles.closeButton,
|
|
106
|
+
children: /* @__PURE__ */ jsx(IconSlot, {
|
|
107
|
+
icon: closeIcon,
|
|
108
|
+
variant: "outline",
|
|
109
|
+
size: toastStyles.closeIcon.iconSizeToken ?? "sm",
|
|
110
|
+
style: toastStyles.closeIcon,
|
|
111
|
+
accessibilityElementsHidden: true,
|
|
112
|
+
importantForAccessibility: "no"
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
Toast.displayName = "Toast";
|
|
119
|
+
const internalStyles = StyleSheet.create({
|
|
120
|
+
root: {
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
alignSelf: "stretch",
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
maxWidth: "100%",
|
|
125
|
+
width: "100%"
|
|
126
|
+
},
|
|
127
|
+
icon: { flexShrink: 0 },
|
|
128
|
+
content: {
|
|
129
|
+
flex: 1,
|
|
130
|
+
minWidth: 0
|
|
131
|
+
},
|
|
132
|
+
closeButton: {
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
flexShrink: 0,
|
|
135
|
+
justifyContent: "center"
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
//#endregion
|
|
139
|
+
export { Toast };
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.js","names":["Text"],"sources":["../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import type { ToastVariant } from '@yahoo/uds-types';\nimport { memo, useCallback, useMemo } from 'react';\nimport { ActivityIndicator, Pressable, StyleSheet, View } from 'react-native';\n\nimport { toastStyles } from '../../../generated/styles';\nimport { Button } from '../Button';\nimport type { IconSlotType } from '../IconSlot';\nimport { IconSlot } from '../IconSlot';\nimport { Text } from '../Text';\nimport type { ToastProps } from './types';\n\nconst TOAST_ICON_MAP: Record<ToastVariant, IconSlotType> = {\n error: 'Error',\n info: 'Info',\n loading: 'Progress',\n success: 'CheckCircle',\n warning: 'Warning',\n};\n\n/**\n * **A toast notification for short, non-blocking system feedback.**\n *\n * @description\n * Toast renders the configured mobile toast surface. It supports variant icons,\n * message or custom content, an optional action button, and an optional dismiss\n * affordance.\n *\n * This component only renders the visual toast. Use ToastProvider, useToast, or\n * createToast for floating toast state, queueing, placement, timers, and motion.\n *\n * @category Feedback\n * @platform mobile\n *\n * @example\n * ```tsx\n * import { Toast } from '@yahoo/uds-mobile/Toast';\n *\n * <Toast variant=\"info\" message=\"Draft saved\" />\n * <Toast\n * variant=\"success\"\n * message=\"Message archived\"\n * actionButton=\"Undo\"\n * onActionPress={() => {}}\n * />\n * ```\n *\n * @see {@link ToastProvider} for floating toast state and placement\n */\nconst Toast = memo(function Toast({\n id,\n size: _size = 'default',\n variant = 'info',\n message,\n children,\n actionButton,\n onActionPress,\n onClickActionButton,\n onClose,\n onClickCloseButton,\n startIcon,\n closeIcon = 'Cross',\n dismissible,\n closeAccessibilityLabel = 'Dismiss',\n style,\n ref,\n ...rest\n}: ToastProps) {\n toastStyles.useVariants({ variant });\n\n const icon = startIcon === undefined ? TOAST_ICON_MAP[variant] : startIcon;\n const hasContent = message !== undefined && message !== null;\n const actionHandler = onActionPress ?? onClickActionButton;\n const isDismissible = dismissible ?? closeIcon !== false;\n\n const handleActionPress = useCallback(() => {\n actionHandler?.();\n }, [actionHandler]);\n\n const handleClosePress = useCallback(() => {\n onClose?.(id);\n onClickCloseButton?.(id);\n }, [id, onClickCloseButton, onClose]);\n\n const rootStyle = useMemo(\n () => [toastStyles.root, internalStyles.root, style],\n [style, toastStyles.root],\n );\n\n return (\n <View\n ref={ref}\n accessibilityLiveRegion=\"polite\"\n accessibilityRole=\"alert\"\n style={rootStyle}\n {...rest}\n >\n {icon !== false &&\n (variant === 'loading' && startIcon === undefined ? (\n <ActivityIndicator\n size={toastStyles.icon.fontSize}\n color={toastStyles.icon.color}\n style={internalStyles.icon}\n />\n ) : (\n <IconSlot\n icon={icon}\n variant=\"fill\"\n size={toastStyles.icon.iconSizeToken ?? 'md'}\n style={[toastStyles.icon, internalStyles.icon]}\n accessibilityElementsHidden\n importantForAccessibility=\"no\"\n />\n ))}\n\n <View style={internalStyles.content}>\n {hasContent ? (\n <Text style={[toastStyles.label, toastStyles.text]}>{message}</Text>\n ) : (\n children\n )}\n </View>\n\n {actionButton && actionHandler && (\n <Button size=\"sm\" variant=\"secondary\" disableEffects onPress={handleActionPress}>\n {actionButton}\n </Button>\n )}\n\n {isDismissible && closeIcon !== false && (\n <Pressable\n accessibilityLabel={closeAccessibilityLabel}\n accessibilityRole=\"button\"\n hitSlop={12}\n onPress={handleClosePress}\n style={internalStyles.closeButton}\n >\n <IconSlot\n icon={closeIcon}\n variant=\"outline\"\n size={toastStyles.closeIcon.iconSizeToken ?? 'sm'}\n style={toastStyles.closeIcon}\n accessibilityElementsHidden\n importantForAccessibility=\"no\"\n />\n </Pressable>\n )}\n </View>\n );\n});\n\nToast.displayName = 'Toast';\n\nconst internalStyles = StyleSheet.create({\n root: {\n alignItems: 'center',\n alignSelf: 'stretch',\n flexDirection: 'row',\n maxWidth: '100%',\n width: '100%',\n },\n icon: {\n flexShrink: 0,\n },\n content: {\n flex: 1,\n minWidth: 0,\n },\n closeButton: {\n alignItems: 'center',\n flexShrink: 0,\n justifyContent: 'center',\n },\n});\n\nexport { Toast };\n"],"mappings":";;;;;;;;;AAWA,MAAM,iBAAqD;CACzD,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,MAAM,QAAQ,KAAK,SAAS,MAAM,EAChC,IACA,MAAM,QAAQ,WACd,UAAU,QACV,SACA,UACA,cACA,eACA,qBACA,SACA,oBACA,WACA,YAAY,SACZ,aACA,0BAA0B,WAC1B,OACA,KACA,GAAG,QACU;CACb,YAAY,YAAY,EAAE,SAAS,CAAC;CAEpC,MAAM,OAAO,cAAc,KAAA,IAAY,eAAe,WAAW;CACjE,MAAM,aAAa,YAAY,KAAA,KAAa,YAAY;CACxD,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,gBAAgB,eAAe,cAAc;CAEnD,MAAM,oBAAoB,kBAAkB;EAC1C,iBAAiB;IAChB,CAAC,cAAc,CAAC;CAEnB,MAAM,mBAAmB,kBAAkB;EACzC,UAAU,GAAG;EACb,qBAAqB,GAAG;IACvB;EAAC;EAAI;EAAoB;EAAQ,CAAC;CAOrC,OACE,qBAAC,MAAD;EACO;EACL,yBAAwB;EACxB,mBAAkB;EAClB,OAVc,cACV;GAAC,YAAY;GAAM,eAAe;GAAM;GAAM,EACpD,CAAC,OAAO,YAAY,KAAK,CAQP;EAChB,GAAI;YALN;GAOG,SAAS,UACP,YAAY,aAAa,cAAc,KAAA,IACtC,oBAAC,mBAAD;IACE,MAAM,YAAY,KAAK;IACvB,OAAO,YAAY,KAAK;IACxB,OAAO,eAAe;IACtB,CAAA,GAEF,oBAAC,UAAD;IACQ;IACN,SAAQ;IACR,MAAM,YAAY,KAAK,iBAAiB;IACxC,OAAO,CAAC,YAAY,MAAM,eAAe,KAAK;IAC9C,6BAAA;IACA,2BAA0B;IAC1B,CAAA;GAGN,oBAAC,MAAD;IAAM,OAAO,eAAe;cACzB,aACC,oBAACA,QAAD;KAAM,OAAO,CAAC,YAAY,OAAO,YAAY,KAAK;eAAG;KAAe,CAAA,GAEpE;IAEG,CAAA;GAEN,gBAAgB,iBACf,oBAAC,QAAD;IAAQ,MAAK;IAAK,SAAQ;IAAY,gBAAA;IAAe,SAAS;cAC3D;IACM,CAAA;GAGV,iBAAiB,cAAc,SAC9B,oBAAC,WAAD;IACE,oBAAoB;IACpB,mBAAkB;IAClB,SAAS;IACT,SAAS;IACT,OAAO,eAAe;cAEtB,oBAAC,UAAD;KACE,MAAM;KACN,SAAQ;KACR,MAAM,YAAY,UAAU,iBAAiB;KAC7C,OAAO,YAAY;KACnB,6BAAA;KACA,2BAA0B;KAC1B,CAAA;IACQ,CAAA;GAET;;EAET;AAEF,MAAM,cAAc;AAEpB,MAAM,iBAAiB,WAAW,OAAO;CACvC,MAAM;EACJ,YAAY;EACZ,WAAW;EACX,eAAe;EACf,UAAU;EACV,OAAO;EACR;CACD,MAAM,EACJ,YAAY,GACb;CACD,SAAS;EACP,MAAM;EACN,UAAU;EACX;CACD,aAAa;EACX,YAAY;EACZ,YAAY;EACZ,gBAAgB;EACjB;CACF,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Toast_ToastItem = require("./ToastItem.cjs");
|
|
5
|
+
const require_components_Toast_utils = require("./utils.cjs");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
let react_native = require("react-native");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let react_native_reanimated = require("react-native-reanimated");
|
|
10
|
+
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
11
|
+
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
12
|
+
//#region src/components/Toast/ToastAnimatedItem.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Internal animated wrapper for a visible toast.
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* ToastAnimatedItem owns enter and exit transitions, reduced-motion handling,
|
|
18
|
+
* and vertical swipe-to-dismiss. It delegates visual rendering to ToastItem.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
function ToastAnimatedItem({ toast, hide, reduceMotion }) {
|
|
23
|
+
const progress = (0, react_native_reanimated.useSharedValue)(reduceMotion && !toast.isExiting ? 1 : 0);
|
|
24
|
+
const dragY = (0, react_native_reanimated.useSharedValue)(0);
|
|
25
|
+
const direction = toast.placement === "top-center" ? -1 : 1;
|
|
26
|
+
const isDismissible = toast.dismissible ?? toast.closeIcon !== false;
|
|
27
|
+
const handleSwipeDismiss = (0, react.useCallback)(() => {
|
|
28
|
+
toast.onClose?.(toast.id);
|
|
29
|
+
toast.onClickCloseButton?.(toast.id);
|
|
30
|
+
hide(toast.id);
|
|
31
|
+
}, [hide, toast]);
|
|
32
|
+
(0, react.useEffect)(() => {
|
|
33
|
+
progress.value = (0, react_native_reanimated.withTiming)(toast.isExiting ? 0 : 1, {
|
|
34
|
+
duration: reduceMotion ? 0 : toast.isExiting ? 150 : 200,
|
|
35
|
+
easing: toast.isExiting ? react_native_reanimated.Easing.bezier(.4, 0, 1, 1) : react_native_reanimated.Easing.bezier(0, 0, .2, 1)
|
|
36
|
+
});
|
|
37
|
+
}, [
|
|
38
|
+
progress,
|
|
39
|
+
reduceMotion,
|
|
40
|
+
toast.isExiting
|
|
41
|
+
]);
|
|
42
|
+
const panGesture = (0, react.useMemo)(() => react_native_gesture_handler.Gesture.Pan().enabled(isDismissible && !toast.isExiting).activeOffsetY([-8, 8]).failOffsetX([-24, 24]).onChange((event) => {
|
|
43
|
+
"worklet";
|
|
44
|
+
dragY.value = event.translationY * direction > 0 ? event.translationY : event.translationY * require_components_Toast_utils.TOAST_SWIPE_OPPOSITE_DIRECTION_FACTOR;
|
|
45
|
+
}).onFinalize((event) => {
|
|
46
|
+
"worklet";
|
|
47
|
+
const signedTranslation = event.translationY * direction;
|
|
48
|
+
const signedVelocity = event.velocityY * direction;
|
|
49
|
+
if (signedTranslation > 50 || signedVelocity > 500) {
|
|
50
|
+
dragY.value = (0, react_native_reanimated.withTiming)(96 * direction, {
|
|
51
|
+
duration: reduceMotion ? 0 : 150,
|
|
52
|
+
easing: react_native_reanimated.Easing.bezier(.4, 0, 1, 1)
|
|
53
|
+
}, () => {
|
|
54
|
+
(0, react_native_reanimated.runOnJS)(handleSwipeDismiss)();
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
dragY.value = (0, react_native_reanimated.withTiming)(0, {
|
|
59
|
+
duration: reduceMotion ? 0 : 150,
|
|
60
|
+
easing: react_native_reanimated.Easing.bezier(0, 0, .2, 1)
|
|
61
|
+
});
|
|
62
|
+
}), [
|
|
63
|
+
direction,
|
|
64
|
+
dragY,
|
|
65
|
+
handleSwipeDismiss,
|
|
66
|
+
isDismissible,
|
|
67
|
+
reduceMotion,
|
|
68
|
+
toast.isExiting
|
|
69
|
+
]);
|
|
70
|
+
const animatedStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
71
|
+
opacity: progress.value,
|
|
72
|
+
transform: [{ translateY: (1 - progress.value) * 16 * direction + dragY.value }, { scale: .98 + progress.value * .02 }]
|
|
73
|
+
}));
|
|
74
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
75
|
+
gesture: panGesture,
|
|
76
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
77
|
+
pointerEvents: toast.isExiting ? "none" : "auto",
|
|
78
|
+
style: [styles.item, animatedStyle],
|
|
79
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Toast_ToastItem.ToastItem, {
|
|
80
|
+
toast,
|
|
81
|
+
hide
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const styles = react_native.StyleSheet.create({ item: { alignSelf: "stretch" } });
|
|
87
|
+
//#endregion
|
|
88
|
+
exports.ToastAnimatedItem = ToastAnimatedItem;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastController, ToastRecord } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/ToastAnimatedItem.d.ts
|
|
6
|
+
interface ToastAnimatedItemProps {
|
|
7
|
+
toast: ToastRecord;
|
|
8
|
+
hide: ToastController['hide'];
|
|
9
|
+
reduceMotion: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Internal animated wrapper for a visible toast.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* ToastAnimatedItem owns enter and exit transitions, reduced-motion handling,
|
|
16
|
+
* and vertical swipe-to-dismiss. It delegates visual rendering to ToastItem.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
declare function ToastAnimatedItem({
|
|
21
|
+
toast,
|
|
22
|
+
hide,
|
|
23
|
+
reduceMotion
|
|
24
|
+
}: ToastAnimatedItemProps): _$react.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ToastAnimatedItem };
|
|
27
|
+
//# sourceMappingURL=ToastAnimatedItem.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastAnimatedItem.d.cts","names":[],"sources":["../../../src/components/Toast/ToastAnimatedItem.tsx"],"mappings":";;;;;UAuBU,sBAAA;EACR,KAAA,EAAO,WAAA;EACP,IAAA,EAAM,eAAA;EACN,YAAA;AAAA;;;;;;;;;;iBAYO,iBAAA,CAAA;EAAoB,KAAA;EAAO,IAAA;EAAM;AAAA,GAAgB,sBAAA,GAAsB,OAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastController, ToastRecord } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/ToastAnimatedItem.d.ts
|
|
6
|
+
interface ToastAnimatedItemProps {
|
|
7
|
+
toast: ToastRecord;
|
|
8
|
+
hide: ToastController['hide'];
|
|
9
|
+
reduceMotion: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Internal animated wrapper for a visible toast.
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* ToastAnimatedItem owns enter and exit transitions, reduced-motion handling,
|
|
16
|
+
* and vertical swipe-to-dismiss. It delegates visual rendering to ToastItem.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
declare function ToastAnimatedItem({
|
|
21
|
+
toast,
|
|
22
|
+
hide,
|
|
23
|
+
reduceMotion
|
|
24
|
+
}: ToastAnimatedItemProps): _$react.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { ToastAnimatedItem };
|
|
27
|
+
//# sourceMappingURL=ToastAnimatedItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastAnimatedItem.d.ts","names":[],"sources":["../../../src/components/Toast/ToastAnimatedItem.tsx"],"mappings":";;;;;UAuBU,sBAAA;EACR,KAAA,EAAO,WAAA;EACP,IAAA,EAAM,eAAA;EACN,YAAA;AAAA;;;;;;;;;;iBAYO,iBAAA,CAAA;EAAoB,KAAA;EAAO,IAAA;EAAM;AAAA,GAAgB,sBAAA,GAAsB,OAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { ToastItem } from "./ToastItem.js";
|
|
3
|
+
import { TOAST_SWIPE_OPPOSITE_DIRECTION_FACTOR } from "./utils.js";
|
|
4
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import Animated, { Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
8
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
9
|
+
//#region src/components/Toast/ToastAnimatedItem.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Internal animated wrapper for a visible toast.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* ToastAnimatedItem owns enter and exit transitions, reduced-motion handling,
|
|
15
|
+
* and vertical swipe-to-dismiss. It delegates visual rendering to ToastItem.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
function ToastAnimatedItem({ toast, hide, reduceMotion }) {
|
|
20
|
+
const progress = useSharedValue(reduceMotion && !toast.isExiting ? 1 : 0);
|
|
21
|
+
const dragY = useSharedValue(0);
|
|
22
|
+
const direction = toast.placement === "top-center" ? -1 : 1;
|
|
23
|
+
const isDismissible = toast.dismissible ?? toast.closeIcon !== false;
|
|
24
|
+
const handleSwipeDismiss = useCallback(() => {
|
|
25
|
+
toast.onClose?.(toast.id);
|
|
26
|
+
toast.onClickCloseButton?.(toast.id);
|
|
27
|
+
hide(toast.id);
|
|
28
|
+
}, [hide, toast]);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
progress.value = withTiming(toast.isExiting ? 0 : 1, {
|
|
31
|
+
duration: reduceMotion ? 0 : toast.isExiting ? 150 : 200,
|
|
32
|
+
easing: toast.isExiting ? Easing.bezier(.4, 0, 1, 1) : Easing.bezier(0, 0, .2, 1)
|
|
33
|
+
});
|
|
34
|
+
}, [
|
|
35
|
+
progress,
|
|
36
|
+
reduceMotion,
|
|
37
|
+
toast.isExiting
|
|
38
|
+
]);
|
|
39
|
+
const panGesture = useMemo(() => Gesture.Pan().enabled(isDismissible && !toast.isExiting).activeOffsetY([-8, 8]).failOffsetX([-24, 24]).onChange((event) => {
|
|
40
|
+
"worklet";
|
|
41
|
+
dragY.value = event.translationY * direction > 0 ? event.translationY : event.translationY * TOAST_SWIPE_OPPOSITE_DIRECTION_FACTOR;
|
|
42
|
+
}).onFinalize((event) => {
|
|
43
|
+
"worklet";
|
|
44
|
+
const signedTranslation = event.translationY * direction;
|
|
45
|
+
const signedVelocity = event.velocityY * direction;
|
|
46
|
+
if (signedTranslation > 50 || signedVelocity > 500) {
|
|
47
|
+
dragY.value = withTiming(96 * direction, {
|
|
48
|
+
duration: reduceMotion ? 0 : 150,
|
|
49
|
+
easing: Easing.bezier(.4, 0, 1, 1)
|
|
50
|
+
}, () => {
|
|
51
|
+
runOnJS(handleSwipeDismiss)();
|
|
52
|
+
});
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
dragY.value = withTiming(0, {
|
|
56
|
+
duration: reduceMotion ? 0 : 150,
|
|
57
|
+
easing: Easing.bezier(0, 0, .2, 1)
|
|
58
|
+
});
|
|
59
|
+
}), [
|
|
60
|
+
direction,
|
|
61
|
+
dragY,
|
|
62
|
+
handleSwipeDismiss,
|
|
63
|
+
isDismissible,
|
|
64
|
+
reduceMotion,
|
|
65
|
+
toast.isExiting
|
|
66
|
+
]);
|
|
67
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
68
|
+
opacity: progress.value,
|
|
69
|
+
transform: [{ translateY: (1 - progress.value) * 16 * direction + dragY.value }, { scale: .98 + progress.value * .02 }]
|
|
70
|
+
}));
|
|
71
|
+
return /* @__PURE__ */ jsx(GestureDetector, {
|
|
72
|
+
gesture: panGesture,
|
|
73
|
+
children: /* @__PURE__ */ jsx(Animated.View, {
|
|
74
|
+
pointerEvents: toast.isExiting ? "none" : "auto",
|
|
75
|
+
style: [styles.item, animatedStyle],
|
|
76
|
+
children: /* @__PURE__ */ jsx(ToastItem, {
|
|
77
|
+
toast,
|
|
78
|
+
hide
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const styles = StyleSheet.create({ item: { alignSelf: "stretch" } });
|
|
84
|
+
//#endregion
|
|
85
|
+
export { ToastAnimatedItem };
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=ToastAnimatedItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastAnimatedItem.js","names":[],"sources":["../../../src/components/Toast/ToastAnimatedItem.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n Easing,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\n\nimport { ToastItem } from './ToastItem';\nimport type { ToastController, ToastRecord } from './types';\nimport {\n TOAST_ANIMATION_TRANSLATE_OFFSET,\n TOAST_ENTER_ANIMATION_DURATION,\n TOAST_EXIT_ANIMATION_DURATION,\n TOAST_SWIPE_DISMISS_TRANSLATE_OFFSET,\n TOAST_SWIPE_DISMISS_TRANSLATION,\n TOAST_SWIPE_DISMISS_VELOCITY,\n TOAST_SWIPE_OPPOSITE_DIRECTION_FACTOR,\n} from './utils';\n\ninterface ToastAnimatedItemProps {\n toast: ToastRecord;\n hide: ToastController['hide'];\n reduceMotion: boolean;\n}\n\n/**\n * Internal animated wrapper for a visible toast.\n *\n * @description\n * ToastAnimatedItem owns enter and exit transitions, reduced-motion handling,\n * and vertical swipe-to-dismiss. It delegates visual rendering to ToastItem.\n *\n * @internal\n */\nfunction ToastAnimatedItem({ toast, hide, reduceMotion }: ToastAnimatedItemProps) {\n const progress = useSharedValue(reduceMotion && !toast.isExiting ? 1 : 0);\n const dragY = useSharedValue(0);\n const direction = toast.placement === 'top-center' ? -1 : 1;\n const isDismissible = toast.dismissible ?? toast.closeIcon !== false;\n\n const handleSwipeDismiss = useCallback(() => {\n toast.onClose?.(toast.id);\n toast.onClickCloseButton?.(toast.id);\n hide(toast.id);\n }, [hide, toast]);\n\n useEffect(() => {\n progress.value = withTiming(toast.isExiting ? 0 : 1, {\n duration: reduceMotion\n ? 0\n : toast.isExiting\n ? TOAST_EXIT_ANIMATION_DURATION\n : TOAST_ENTER_ANIMATION_DURATION,\n easing: toast.isExiting ? Easing.bezier(0.4, 0, 1, 1) : Easing.bezier(0, 0, 0.2, 1),\n });\n }, [progress, reduceMotion, toast.isExiting]);\n\n const panGesture = useMemo(\n () =>\n Gesture.Pan()\n .enabled(isDismissible && !toast.isExiting)\n .activeOffsetY([-8, 8])\n .failOffsetX([-24, 24])\n .onChange((event) => {\n 'worklet';\n const isDismissDirection = event.translationY * direction > 0;\n dragY.value = isDismissDirection\n ? event.translationY\n : event.translationY * TOAST_SWIPE_OPPOSITE_DIRECTION_FACTOR;\n })\n .onFinalize((event) => {\n 'worklet';\n const signedTranslation = event.translationY * direction;\n const signedVelocity = event.velocityY * direction;\n const shouldDismiss =\n signedTranslation > TOAST_SWIPE_DISMISS_TRANSLATION ||\n signedVelocity > TOAST_SWIPE_DISMISS_VELOCITY;\n\n if (shouldDismiss) {\n dragY.value = withTiming(\n TOAST_SWIPE_DISMISS_TRANSLATE_OFFSET * direction,\n {\n duration: reduceMotion ? 0 : TOAST_EXIT_ANIMATION_DURATION,\n easing: Easing.bezier(0.4, 0, 1, 1),\n },\n () => {\n runOnJS(handleSwipeDismiss)();\n },\n );\n return;\n }\n\n dragY.value = withTiming(0, {\n duration: reduceMotion ? 0 : TOAST_EXIT_ANIMATION_DURATION,\n easing: Easing.bezier(0, 0, 0.2, 1),\n });\n }),\n [direction, dragY, handleSwipeDismiss, isDismissible, reduceMotion, toast.isExiting],\n );\n\n const animatedStyle = useAnimatedStyle(() => ({\n opacity: progress.value,\n transform: [\n {\n translateY:\n (1 - progress.value) * TOAST_ANIMATION_TRANSLATE_OFFSET * direction + dragY.value,\n },\n { scale: 0.98 + progress.value * 0.02 },\n ],\n }));\n\n return (\n <GestureDetector gesture={panGesture}>\n <Animated.View\n pointerEvents={toast.isExiting ? 'none' : 'auto'}\n style={[styles.item, animatedStyle]}\n >\n <ToastItem toast={toast} hide={hide} />\n </Animated.View>\n </GestureDetector>\n );\n}\n\nconst styles = StyleSheet.create({\n item: {\n alignSelf: 'stretch',\n },\n});\n\nexport { ToastAnimatedItem };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,SAAS,kBAAkB,EAAE,OAAO,MAAM,gBAAwC;CAChF,MAAM,WAAW,eAAe,gBAAgB,CAAC,MAAM,YAAY,IAAI,EAAE;CACzE,MAAM,QAAQ,eAAe,EAAE;CAC/B,MAAM,YAAY,MAAM,cAAc,eAAe,KAAK;CAC1D,MAAM,gBAAgB,MAAM,eAAe,MAAM,cAAc;CAE/D,MAAM,qBAAqB,kBAAkB;EAC3C,MAAM,UAAU,MAAM,GAAG;EACzB,MAAM,qBAAqB,MAAM,GAAG;EACpC,KAAK,MAAM,GAAG;IACb,CAAC,MAAM,MAAM,CAAC;CAEjB,gBAAgB;EACd,SAAS,QAAQ,WAAW,MAAM,YAAY,IAAI,GAAG;GACnD,UAAU,eACN,IACA,MAAM,YAAA,MAAA;GAGV,QAAQ,MAAM,YAAY,OAAO,OAAO,IAAK,GAAG,GAAG,EAAE,GAAG,OAAO,OAAO,GAAG,GAAG,IAAK,EAAE;GACpF,CAAC;IACD;EAAC;EAAU;EAAc,MAAM;EAAU,CAAC;CAE7C,MAAM,aAAa,cAEf,QAAQ,KAAK,CACV,QAAQ,iBAAiB,CAAC,MAAM,UAAU,CAC1C,cAAc,CAAC,IAAI,EAAE,CAAC,CACtB,YAAY,CAAC,KAAK,GAAG,CAAC,CACtB,UAAU,UAAU;AACnB;EAEA,MAAM,QADqB,MAAM,eAAe,YAAY,IAExD,MAAM,eACN,MAAM,eAAe;GACzB,CACD,YAAY,UAAU;AACrB;EACA,MAAM,oBAAoB,MAAM,eAAe;EAC/C,MAAM,iBAAiB,MAAM,YAAY;EAKzC,IAHE,oBAAA,MACA,iBAAA,KAEiB;GACjB,MAAM,QAAQ,WAAA,KAC2B,WACvC;IACE,UAAU,eAAe,IAAA;IACzB,QAAQ,OAAO,OAAO,IAAK,GAAG,GAAG,EAAE;IACpC,QACK;IACJ,QAAQ,mBAAmB,EAAE;KAEhC;GACD;;EAGF,MAAM,QAAQ,WAAW,GAAG;GAC1B,UAAU,eAAe,IAAA;GACzB,QAAQ,OAAO,OAAO,GAAG,GAAG,IAAK,EAAE;GACpC,CAAC;GACF,EACN;EAAC;EAAW;EAAO;EAAoB;EAAe;EAAc,MAAM;EAAU,CACrF;CAED,MAAM,gBAAgB,wBAAwB;EAC5C,SAAS,SAAS;EAClB,WAAW,CACT,EACE,aACG,IAAI,SAAS,SAAA,KAA4C,YAAY,MAAM,OAC/E,EACD,EAAE,OAAO,MAAO,SAAS,QAAQ,KAAM,CACxC;EACF,EAAE;CAEH,OACE,oBAAC,iBAAD;EAAiB,SAAS;YACxB,oBAAC,SAAS,MAAV;GACE,eAAe,MAAM,YAAY,SAAS;GAC1C,OAAO,CAAC,OAAO,MAAM,cAAc;aAEnC,oBAAC,WAAD;IAAkB;IAAa;IAAQ,CAAA;GACzB,CAAA;EACA,CAAA;;AAItB,MAAM,SAAS,WAAW,OAAO,EAC/B,MAAM,EACJ,WAAW,WACZ,EACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_Toast_Toast = require("./Toast.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
//#region src/components/Toast/ToastItem.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Internal adapter from a ToastRecord to the public Toast renderer.
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* ToastItem removes provider-only fields from a toast record, wires action and
|
|
12
|
+
* close callbacks to the toast controller, and passes renderable props to Toast.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function ToastItem({ toast, hide }) {
|
|
17
|
+
const { closeOnAction, createdAt: _createdAt, autoClose: _autoClose, isExiting: _isExiting, onActionPress, onClickActionButton, onClickCloseButton, onClose, onHide: _onHide, onShow: _onShow, placement: _placement, ...toastProps } = toast;
|
|
18
|
+
const handleActionPress = () => {
|
|
19
|
+
onActionPress?.();
|
|
20
|
+
onClickActionButton?.();
|
|
21
|
+
if (closeOnAction) hide(toast.id);
|
|
22
|
+
};
|
|
23
|
+
const handleClose = (id) => {
|
|
24
|
+
onClose?.(id);
|
|
25
|
+
onClickCloseButton?.(id);
|
|
26
|
+
hide(toast.id);
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Toast_Toast.Toast, {
|
|
29
|
+
...toastProps,
|
|
30
|
+
onActionPress: handleActionPress,
|
|
31
|
+
onClose: handleClose
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.ToastItem = ToastItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastController, ToastRecord } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/ToastItem.d.ts
|
|
6
|
+
interface ToastItemProps {
|
|
7
|
+
toast: ToastRecord;
|
|
8
|
+
hide: ToastController['hide'];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Internal adapter from a ToastRecord to the public Toast renderer.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* ToastItem removes provider-only fields from a toast record, wires action and
|
|
15
|
+
* close callbacks to the toast controller, and passes renderable props to Toast.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
declare function ToastItem({
|
|
20
|
+
toast,
|
|
21
|
+
hide
|
|
22
|
+
}: ToastItemProps): _$react.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ToastItem };
|
|
25
|
+
//# sourceMappingURL=ToastItem.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastItem.d.cts","names":[],"sources":["../../../src/components/Toast/ToastItem.tsx"],"mappings":";;;;;UAGU,cAAA;EACR,KAAA,EAAO,WAAA;EACP,IAAA,EAAM,eAAA;AAAA;;;;;;;;;;iBAYC,SAAA,CAAA;EAAY,KAAA;EAAO;AAAA,GAAQ,cAAA,GAAc,OAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { ToastController, ToastRecord } from "./types.js";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Toast/ToastItem.d.ts
|
|
6
|
+
interface ToastItemProps {
|
|
7
|
+
toast: ToastRecord;
|
|
8
|
+
hide: ToastController['hide'];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Internal adapter from a ToastRecord to the public Toast renderer.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* ToastItem removes provider-only fields from a toast record, wires action and
|
|
15
|
+
* close callbacks to the toast controller, and passes renderable props to Toast.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
declare function ToastItem({
|
|
20
|
+
toast,
|
|
21
|
+
hide
|
|
22
|
+
}: ToastItemProps): _$react.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ToastItem };
|
|
25
|
+
//# sourceMappingURL=ToastItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastItem.d.ts","names":[],"sources":["../../../src/components/Toast/ToastItem.tsx"],"mappings":";;;;;UAGU,cAAA;EACR,KAAA,EAAO,WAAA;EACP,IAAA,EAAM,eAAA;AAAA;;;;;;;;;;iBAYC,SAAA,CAAA;EAAY,KAAA;EAAO;AAAA,GAAQ,cAAA,GAAc,OAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { Toast } from "./Toast.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/Toast/ToastItem.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Internal adapter from a ToastRecord to the public Toast renderer.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* ToastItem removes provider-only fields from a toast record, wires action and
|
|
10
|
+
* close callbacks to the toast controller, and passes renderable props to Toast.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function ToastItem({ toast, hide }) {
|
|
15
|
+
const { closeOnAction, createdAt: _createdAt, autoClose: _autoClose, isExiting: _isExiting, onActionPress, onClickActionButton, onClickCloseButton, onClose, onHide: _onHide, onShow: _onShow, placement: _placement, ...toastProps } = toast;
|
|
16
|
+
const handleActionPress = () => {
|
|
17
|
+
onActionPress?.();
|
|
18
|
+
onClickActionButton?.();
|
|
19
|
+
if (closeOnAction) hide(toast.id);
|
|
20
|
+
};
|
|
21
|
+
const handleClose = (id) => {
|
|
22
|
+
onClose?.(id);
|
|
23
|
+
onClickCloseButton?.(id);
|
|
24
|
+
hide(toast.id);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(Toast, {
|
|
27
|
+
...toastProps,
|
|
28
|
+
onActionPress: handleActionPress,
|
|
29
|
+
onClose: handleClose
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ToastItem };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=ToastItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastItem.js","names":[],"sources":["../../../src/components/Toast/ToastItem.tsx"],"sourcesContent":["import { Toast } from './Toast';\nimport type { ToastController, ToastRecord } from './types';\n\ninterface ToastItemProps {\n toast: ToastRecord;\n hide: ToastController['hide'];\n}\n\n/**\n * Internal adapter from a ToastRecord to the public Toast renderer.\n *\n * @description\n * ToastItem removes provider-only fields from a toast record, wires action and\n * close callbacks to the toast controller, and passes renderable props to Toast.\n *\n * @internal\n */\nfunction ToastItem({ toast, hide }: ToastItemProps) {\n const {\n closeOnAction,\n createdAt: _createdAt,\n autoClose: _autoClose,\n isExiting: _isExiting,\n onActionPress,\n onClickActionButton,\n onClickCloseButton,\n onClose,\n onHide: _onHide,\n onShow: _onShow,\n placement: _placement,\n ...toastProps\n } = toast;\n\n const handleActionPress = () => {\n onActionPress?.();\n onClickActionButton?.();\n\n if (closeOnAction) {\n hide(toast.id);\n }\n };\n\n const handleClose = (id?: string) => {\n onClose?.(id);\n onClickCloseButton?.(id);\n hide(toast.id);\n };\n\n return <Toast {...toastProps} onActionPress={handleActionPress} onClose={handleClose} />;\n}\n\nexport { ToastItem };\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAS,UAAU,EAAE,OAAO,QAAwB;CAClD,MAAM,EACJ,eACA,WAAW,YACX,WAAW,YACX,WAAW,YACX,eACA,qBACA,oBACA,SACA,QAAQ,SACR,QAAQ,SACR,WAAW,YACX,GAAG,eACD;CAEJ,MAAM,0BAA0B;EAC9B,iBAAiB;EACjB,uBAAuB;EAEvB,IAAI,eACF,KAAK,MAAM,GAAG;;CAIlB,MAAM,eAAe,OAAgB;EACnC,UAAU,GAAG;EACb,qBAAqB,GAAG;EACxB,KAAK,MAAM,GAAG;;CAGhB,OAAO,oBAAC,OAAD;EAAO,GAAI;EAAY,eAAe;EAAmB,SAAS;EAAe,CAAA"}
|