@yahoo/uds-mobile 2.16.0 → 2.18.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.
Files changed (236) hide show
  1. package/dist/bin/fixtures/dist/index.mjs +14 -0
  2. package/dist/bin/generateTheme.mjs +7 -2
  3. package/dist/bin/mobile/scripts/utils/configToRNMappings.mjs +4 -0
  4. package/dist/components/Popover/Popover.cjs +92 -0
  5. package/dist/components/Popover/Popover.d.cts +26 -0
  6. package/dist/components/Popover/Popover.d.cts.map +1 -0
  7. package/dist/components/Popover/Popover.d.ts +26 -0
  8. package/dist/components/Popover/Popover.d.ts.map +1 -0
  9. package/dist/components/Popover/Popover.js +92 -0
  10. package/dist/components/Popover/Popover.js.map +1 -0
  11. package/dist/components/Popover/PopoverContent.cjs +124 -0
  12. package/dist/components/Popover/PopoverContent.d.cts +15 -0
  13. package/dist/components/Popover/PopoverContent.d.cts.map +1 -0
  14. package/dist/components/Popover/PopoverContent.d.ts +15 -0
  15. package/dist/components/Popover/PopoverContent.d.ts.map +1 -0
  16. package/dist/components/Popover/PopoverContent.js +124 -0
  17. package/dist/components/Popover/PopoverContent.js.map +1 -0
  18. package/dist/components/Popover/PopoverContext.cjs +14 -0
  19. package/dist/components/Popover/PopoverContext.d.cts +10 -0
  20. package/dist/components/Popover/PopoverContext.d.cts.map +1 -0
  21. package/dist/components/Popover/PopoverContext.d.ts +10 -0
  22. package/dist/components/Popover/PopoverContext.d.ts.map +1 -0
  23. package/dist/components/Popover/PopoverContext.js +13 -0
  24. package/dist/components/Popover/PopoverContext.js.map +1 -0
  25. package/dist/components/Popover/PopoverDescription.cjs +23 -0
  26. package/dist/components/Popover/PopoverDescription.d.cts +15 -0
  27. package/dist/components/Popover/PopoverDescription.d.cts.map +1 -0
  28. package/dist/components/Popover/PopoverDescription.d.ts +15 -0
  29. package/dist/components/Popover/PopoverDescription.d.ts.map +1 -0
  30. package/dist/components/Popover/PopoverDescription.js +23 -0
  31. package/dist/components/Popover/PopoverDescription.js.map +1 -0
  32. package/dist/components/Popover/PopoverDismiss.cjs +22 -0
  33. package/dist/components/Popover/PopoverDismiss.d.cts +15 -0
  34. package/dist/components/Popover/PopoverDismiss.d.cts.map +1 -0
  35. package/dist/components/Popover/PopoverDismiss.d.ts +15 -0
  36. package/dist/components/Popover/PopoverDismiss.d.ts.map +1 -0
  37. package/dist/components/Popover/PopoverDismiss.js +22 -0
  38. package/dist/components/Popover/PopoverDismiss.js.map +1 -0
  39. package/dist/components/Popover/PopoverFrame.cjs +56 -0
  40. package/dist/components/Popover/PopoverFrame.d.cts +23 -0
  41. package/dist/components/Popover/PopoverFrame.d.cts.map +1 -0
  42. package/dist/components/Popover/PopoverFrame.d.ts +23 -0
  43. package/dist/components/Popover/PopoverFrame.d.ts.map +1 -0
  44. package/dist/components/Popover/PopoverFrame.js +55 -0
  45. package/dist/components/Popover/PopoverFrame.js.map +1 -0
  46. package/dist/components/Popover/PopoverPortalLayer.cjs +45 -0
  47. package/dist/components/Popover/PopoverPortalLayer.d.cts +15 -0
  48. package/dist/components/Popover/PopoverPortalLayer.d.cts.map +1 -0
  49. package/dist/components/Popover/PopoverPortalLayer.d.ts +15 -0
  50. package/dist/components/Popover/PopoverPortalLayer.d.ts.map +1 -0
  51. package/dist/components/Popover/PopoverPortalLayer.js +45 -0
  52. package/dist/components/Popover/PopoverPortalLayer.js.map +1 -0
  53. package/dist/components/Popover/PopoverSurface.cjs +228 -0
  54. package/dist/components/Popover/PopoverSurface.d.cts +26 -0
  55. package/dist/components/Popover/PopoverSurface.d.cts.map +1 -0
  56. package/dist/components/Popover/PopoverSurface.d.ts +26 -0
  57. package/dist/components/Popover/PopoverSurface.d.ts.map +1 -0
  58. package/dist/components/Popover/PopoverSurface.js +227 -0
  59. package/dist/components/Popover/PopoverSurface.js.map +1 -0
  60. package/dist/components/Popover/PopoverTitle.cjs +23 -0
  61. package/dist/components/Popover/PopoverTitle.d.cts +15 -0
  62. package/dist/components/Popover/PopoverTitle.d.cts.map +1 -0
  63. package/dist/components/Popover/PopoverTitle.d.ts +15 -0
  64. package/dist/components/Popover/PopoverTitle.d.ts.map +1 -0
  65. package/dist/components/Popover/PopoverTitle.js +23 -0
  66. package/dist/components/Popover/PopoverTitle.js.map +1 -0
  67. package/dist/components/Popover/PopoverTrigger.cjs +88 -0
  68. package/dist/components/Popover/PopoverTrigger.d.cts +15 -0
  69. package/dist/components/Popover/PopoverTrigger.d.cts.map +1 -0
  70. package/dist/components/Popover/PopoverTrigger.d.ts +15 -0
  71. package/dist/components/Popover/PopoverTrigger.d.ts.map +1 -0
  72. package/dist/components/Popover/PopoverTrigger.js +88 -0
  73. package/dist/components/Popover/PopoverTrigger.js.map +1 -0
  74. package/dist/components/Popover/index.cjs +14 -0
  75. package/dist/components/Popover/index.d.cts +9 -0
  76. package/dist/components/Popover/index.d.ts +9 -0
  77. package/dist/components/Popover/index.js +8 -0
  78. package/dist/components/Popover/popoverFrameGeometry.cjs +177 -0
  79. package/dist/components/Popover/popoverFrameGeometry.d.cts +48 -0
  80. package/dist/components/Popover/popoverFrameGeometry.d.cts.map +1 -0
  81. package/dist/components/Popover/popoverFrameGeometry.d.ts +48 -0
  82. package/dist/components/Popover/popoverFrameGeometry.d.ts.map +1 -0
  83. package/dist/components/Popover/popoverFrameGeometry.js +177 -0
  84. package/dist/components/Popover/popoverFrameGeometry.js.map +1 -0
  85. package/dist/components/Popover/popoverLayer.cjs +16 -0
  86. package/dist/components/Popover/popoverLayer.d.cts +8 -0
  87. package/dist/components/Popover/popoverLayer.d.cts.map +1 -0
  88. package/dist/components/Popover/popoverLayer.d.ts +8 -0
  89. package/dist/components/Popover/popoverLayer.d.ts.map +1 -0
  90. package/dist/components/Popover/popoverLayer.js +16 -0
  91. package/dist/components/Popover/popoverLayer.js.map +1 -0
  92. package/dist/components/Popover/types.cjs +1 -0
  93. package/dist/components/Popover/types.d.cts +170 -0
  94. package/dist/components/Popover/types.d.cts.map +1 -0
  95. package/dist/components/Popover/types.d.ts +170 -0
  96. package/dist/components/Popover/types.d.ts.map +1 -0
  97. package/dist/components/Popover/types.js +1 -0
  98. package/dist/components/Toast/Toast.cjs +141 -0
  99. package/dist/components/Toast/Toast.d.cts +38 -0
  100. package/dist/components/Toast/Toast.d.cts.map +1 -0
  101. package/dist/components/Toast/Toast.d.ts +38 -0
  102. package/dist/components/Toast/Toast.d.ts.map +1 -0
  103. package/dist/components/Toast/Toast.js +141 -0
  104. package/dist/components/Toast/Toast.js.map +1 -0
  105. package/dist/components/Toast/ToastAnimatedItem.cjs +88 -0
  106. package/dist/components/Toast/ToastAnimatedItem.d.cts +27 -0
  107. package/dist/components/Toast/ToastAnimatedItem.d.cts.map +1 -0
  108. package/dist/components/Toast/ToastAnimatedItem.d.ts +27 -0
  109. package/dist/components/Toast/ToastAnimatedItem.d.ts.map +1 -0
  110. package/dist/components/Toast/ToastAnimatedItem.js +87 -0
  111. package/dist/components/Toast/ToastAnimatedItem.js.map +1 -0
  112. package/dist/components/Toast/ToastItem.cjs +35 -0
  113. package/dist/components/Toast/ToastItem.d.cts +25 -0
  114. package/dist/components/Toast/ToastItem.d.cts.map +1 -0
  115. package/dist/components/Toast/ToastItem.d.ts +25 -0
  116. package/dist/components/Toast/ToastItem.d.ts.map +1 -0
  117. package/dist/components/Toast/ToastItem.js +35 -0
  118. package/dist/components/Toast/ToastItem.js.map +1 -0
  119. package/dist/components/Toast/ToastProvider.cjs +144 -0
  120. package/dist/components/Toast/ToastProvider.d.cts +58 -0
  121. package/dist/components/Toast/ToastProvider.d.cts.map +1 -0
  122. package/dist/components/Toast/ToastProvider.d.ts +58 -0
  123. package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
  124. package/dist/components/Toast/ToastProvider.js +143 -0
  125. package/dist/components/Toast/ToastProvider.js.map +1 -0
  126. package/dist/components/Toast/ToastViewport.cjs +48 -0
  127. package/dist/components/Toast/ToastViewport.d.cts +42 -0
  128. package/dist/components/Toast/ToastViewport.d.cts.map +1 -0
  129. package/dist/components/Toast/ToastViewport.d.ts +42 -0
  130. package/dist/components/Toast/ToastViewport.d.ts.map +1 -0
  131. package/dist/components/Toast/ToastViewport.js +48 -0
  132. package/dist/components/Toast/ToastViewport.js.map +1 -0
  133. package/dist/components/Toast/createToast.cjs +21 -0
  134. package/dist/components/Toast/createToast.d.cts +10 -0
  135. package/dist/components/Toast/createToast.d.cts.map +1 -0
  136. package/dist/components/Toast/createToast.d.ts +10 -0
  137. package/dist/components/Toast/createToast.d.ts.map +1 -0
  138. package/dist/components/Toast/createToast.js +20 -0
  139. package/dist/components/Toast/createToast.js.map +1 -0
  140. package/dist/components/Toast/index.cjs +10 -0
  141. package/dist/components/Toast/index.d.cts +6 -0
  142. package/dist/components/Toast/index.d.ts +6 -0
  143. package/dist/components/Toast/index.js +5 -0
  144. package/dist/components/Toast/types.cjs +1 -0
  145. package/dist/components/Toast/types.d.cts +113 -0
  146. package/dist/components/Toast/types.d.cts.map +1 -0
  147. package/dist/components/Toast/types.d.ts +113 -0
  148. package/dist/components/Toast/types.d.ts.map +1 -0
  149. package/dist/components/Toast/types.js +1 -0
  150. package/dist/components/Toast/useToastController.cjs +286 -0
  151. package/dist/components/Toast/useToastController.d.cts +25 -0
  152. package/dist/components/Toast/useToastController.d.cts.map +1 -0
  153. package/dist/components/Toast/useToastController.d.ts +25 -0
  154. package/dist/components/Toast/useToastController.d.ts.map +1 -0
  155. package/dist/components/Toast/useToastController.js +286 -0
  156. package/dist/components/Toast/useToastController.js.map +1 -0
  157. package/dist/components/Toast/utils.cjs +69 -0
  158. package/dist/components/Toast/utils.d.cts +27 -0
  159. package/dist/components/Toast/utils.d.cts.map +1 -0
  160. package/dist/components/Toast/utils.d.ts +27 -0
  161. package/dist/components/Toast/utils.d.ts.map +1 -0
  162. package/dist/components/Toast/utils.js +55 -0
  163. package/dist/components/Toast/utils.js.map +1 -0
  164. package/dist/components/internal/Overlay/index.cjs +4 -0
  165. package/dist/components/internal/Overlay/index.d.cts +4 -2
  166. package/dist/components/internal/Overlay/index.d.ts +4 -2
  167. package/dist/components/internal/Overlay/index.js +3 -1
  168. package/dist/components/internal/Overlay/types.d.cts +47 -1
  169. package/dist/components/internal/Overlay/types.d.cts.map +1 -1
  170. package/dist/components/internal/Overlay/types.d.ts +47 -1
  171. package/dist/components/internal/Overlay/types.d.ts.map +1 -1
  172. package/dist/components/internal/Overlay/useAnchoredPosition.cjs +225 -0
  173. package/dist/components/internal/Overlay/useAnchoredPosition.d.cts +22 -0
  174. package/dist/components/internal/Overlay/useAnchoredPosition.d.cts.map +1 -0
  175. package/dist/components/internal/Overlay/useAnchoredPosition.d.ts +22 -0
  176. package/dist/components/internal/Overlay/useAnchoredPosition.d.ts.map +1 -0
  177. package/dist/components/internal/Overlay/useAnchoredPosition.js +225 -0
  178. package/dist/components/internal/Overlay/useAnchoredPosition.js.map +1 -0
  179. package/dist/components/internal/Overlay/useOverlayDismiss.cjs +22 -0
  180. package/dist/components/internal/Overlay/useOverlayDismiss.d.cts +12 -0
  181. package/dist/components/internal/Overlay/useOverlayDismiss.d.cts.map +1 -0
  182. package/dist/components/internal/Overlay/useOverlayDismiss.d.ts +12 -0
  183. package/dist/components/internal/Overlay/useOverlayDismiss.d.ts.map +1 -0
  184. package/dist/components/internal/Overlay/useOverlayDismiss.js +22 -0
  185. package/dist/components/internal/Overlay/useOverlayDismiss.js.map +1 -0
  186. package/dist/jest/mocks/gesture-handler.cjs +38 -0
  187. package/dist/jest/mocks/gesture-handler.d.cts +41 -0
  188. package/dist/jest/mocks/gesture-handler.d.cts.map +1 -0
  189. package/dist/jest/mocks/gesture-handler.d.ts +41 -0
  190. package/dist/jest/mocks/gesture-handler.d.ts.map +1 -0
  191. package/dist/jest/mocks/gesture-handler.js +37 -0
  192. package/dist/jest/mocks/gesture-handler.js.map +1 -0
  193. package/dist/jest/mocks/react-native.cjs +14 -0
  194. package/dist/jest/mocks/react-native.d.cts +29 -1
  195. package/dist/jest/mocks/react-native.d.cts.map +1 -1
  196. package/dist/jest/mocks/react-native.d.ts +29 -1
  197. package/dist/jest/mocks/react-native.d.ts.map +1 -1
  198. package/dist/jest/mocks/react-native.js +13 -1
  199. package/dist/jest/mocks/react-native.js.map +1 -1
  200. package/dist/jest/mocks/safe-area-context.cjs +35 -0
  201. package/dist/jest/mocks/safe-area-context.d.cts +43 -0
  202. package/dist/jest/mocks/safe-area-context.d.cts.map +1 -0
  203. package/dist/jest/mocks/safe-area-context.d.ts +43 -0
  204. package/dist/jest/mocks/safe-area-context.d.ts.map +1 -0
  205. package/dist/jest/mocks/safe-area-context.js +32 -0
  206. package/dist/jest/mocks/safe-area-context.js.map +1 -0
  207. package/dist/jest/mocks/screens.cjs +8 -0
  208. package/dist/jest/mocks/screens.d.cts +12 -0
  209. package/dist/jest/mocks/screens.d.cts.map +1 -0
  210. package/dist/jest/mocks/screens.d.ts +12 -0
  211. package/dist/jest/mocks/screens.d.ts.map +1 -0
  212. package/dist/jest/mocks/screens.js +9 -0
  213. package/dist/jest/mocks/screens.js.map +1 -0
  214. package/dist/jest/mocks/styles.cjs +98 -1
  215. package/dist/jest/mocks/styles.d.cts +6 -2
  216. package/dist/jest/mocks/styles.d.cts.map +1 -1
  217. package/dist/jest/mocks/styles.d.ts +6 -2
  218. package/dist/jest/mocks/styles.d.ts.map +1 -1
  219. package/dist/jest/mocks/styles.js +95 -2
  220. package/dist/jest/mocks/styles.js.map +1 -1
  221. package/dist/jest/setup.cjs +46 -3
  222. package/dist/jest/setup.d.cts.map +1 -1
  223. package/dist/jest/setup.d.ts.map +1 -1
  224. package/dist/jest/setup.js +46 -3
  225. package/dist/jest/setup.js.map +1 -1
  226. package/dist/types/dist/index.d.cts +4 -1
  227. package/dist/types/dist/index.d.cts.map +1 -1
  228. package/dist/types/dist/index.d.ts +4 -1
  229. package/dist/types/dist/index.d.ts.map +1 -1
  230. package/fonts/index.cjs +211 -211
  231. package/fonts/index.mjs +211 -211
  232. package/generated/styles.cjs +6 -0
  233. package/generated/styles.d.ts +13 -1
  234. package/generated/styles.mjs +6 -0
  235. package/generated/unistyles.d.ts +13 -0
  236. package/package.json +21 -1
@@ -0,0 +1,141 @@
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_IconSlot = require("../IconSlot.cjs");
5
+ const require_components_Text = require("../Text.cjs");
6
+ const require_components_Button = require("../Button.cjs");
7
+ let react = require("react");
8
+ let react_native = require("react-native");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ let generated_styles = require("../../../generated/styles");
11
+ //#region src/components/Toast/Toast.tsx
12
+ const TOAST_ICON_MAP = {
13
+ error: "Error",
14
+ info: "Info",
15
+ loading: "Progress",
16
+ success: "CheckCircle",
17
+ warning: "Warning"
18
+ };
19
+ /**
20
+ * **A toast notification for short, non-blocking system feedback.**
21
+ *
22
+ * @description
23
+ * Toast renders the configured mobile toast surface. It supports variant icons,
24
+ * message or custom content, an optional action button, and an optional dismiss
25
+ * affordance.
26
+ *
27
+ * This component only renders the visual toast. Use ToastProvider, useToast, or
28
+ * createToast for floating toast state, queueing, placement, timers, and motion.
29
+ *
30
+ * @category Feedback
31
+ * @platform mobile
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * import { Toast } from '@yahoo/uds-mobile/Toast';
36
+ *
37
+ * <Toast variant="info" message="Draft saved" />
38
+ * <Toast
39
+ * variant="success"
40
+ * message="Message archived"
41
+ * actionButton="Undo"
42
+ * onActionPress={() => {}}
43
+ * />
44
+ * ```
45
+ *
46
+ * @see {@link ToastProvider} for floating toast state and placement
47
+ */
48
+ const Toast = (0, react.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 }) {
49
+ generated_styles.toastStyles.useVariants({ variant });
50
+ const icon = startIcon === void 0 ? TOAST_ICON_MAP[variant] : startIcon;
51
+ const hasContent = message !== void 0 && message !== null;
52
+ const actionHandler = onActionPress ?? onClickActionButton;
53
+ const isDismissible = dismissible ?? closeIcon !== false;
54
+ const handleActionPress = (0, react.useCallback)(() => {
55
+ actionHandler?.();
56
+ }, [actionHandler]);
57
+ const handleClosePress = (0, react.useCallback)(() => {
58
+ onClose?.(id);
59
+ onClickCloseButton?.(id);
60
+ }, [
61
+ id,
62
+ onClickCloseButton,
63
+ onClose
64
+ ]);
65
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
66
+ ref,
67
+ accessibilityLiveRegion: "polite",
68
+ accessibilityRole: "alert",
69
+ style: (0, react.useMemo)(() => [
70
+ generated_styles.toastStyles.root,
71
+ internalStyles.root,
72
+ style
73
+ ], [style, generated_styles.toastStyles.root]),
74
+ ...rest,
75
+ children: [
76
+ icon !== false && (variant === "loading" && startIcon === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ActivityIndicator, {
77
+ size: generated_styles.toastStyles.icon.fontSize,
78
+ color: generated_styles.toastStyles.icon.color,
79
+ style: internalStyles.icon
80
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
81
+ icon,
82
+ variant: "fill",
83
+ size: generated_styles.toastStyles.icon.iconSizeToken ?? "md",
84
+ style: [generated_styles.toastStyles.icon, internalStyles.icon],
85
+ accessibilityElementsHidden: true,
86
+ importantForAccessibility: "no"
87
+ })),
88
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
89
+ style: internalStyles.content,
90
+ children: hasContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
91
+ style: [generated_styles.toastStyles.label, generated_styles.toastStyles.text],
92
+ children: message
93
+ }) : children
94
+ }),
95
+ actionButton && actionHandler && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Button.Button, {
96
+ size: "sm",
97
+ variant: "secondary",
98
+ disableEffects: true,
99
+ onPress: handleActionPress,
100
+ children: actionButton
101
+ }),
102
+ isDismissible && closeIcon !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Pressable, {
103
+ accessibilityLabel: closeAccessibilityLabel,
104
+ accessibilityRole: "button",
105
+ hitSlop: 12,
106
+ onPress: handleClosePress,
107
+ style: internalStyles.closeButton,
108
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
109
+ icon: closeIcon,
110
+ variant: "outline",
111
+ size: generated_styles.toastStyles.closeIcon.iconSizeToken ?? "sm",
112
+ style: generated_styles.toastStyles.closeIcon,
113
+ accessibilityElementsHidden: true,
114
+ importantForAccessibility: "no"
115
+ })
116
+ })
117
+ ]
118
+ });
119
+ });
120
+ Toast.displayName = "Toast";
121
+ const internalStyles = react_native.StyleSheet.create({
122
+ root: {
123
+ alignItems: "center",
124
+ alignSelf: "stretch",
125
+ flexDirection: "row",
126
+ maxWidth: "100%",
127
+ width: "100%"
128
+ },
129
+ icon: { flexShrink: 0 },
130
+ content: {
131
+ flex: 1,
132
+ minWidth: 0
133
+ },
134
+ closeButton: {
135
+ alignItems: "center",
136
+ flexShrink: 0,
137
+ justifyContent: "center"
138
+ }
139
+ });
140
+ //#endregion
141
+ exports.Toast = Toast;
@@ -0,0 +1,38 @@
1
+
2
+ import { ToastProps } from "./types.cjs";
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.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.cts","names":[],"sources":["../../../src/components/Toast/Toast.tsx"],"mappings":";;;;;;;;AAS0C;;;;;;;;;;;;;;;;;;;;;;;;;;cAuCpC,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
@@ -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;