@tamagui/toast 1.0.1-beta.150 → 1.0.1-beta.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/Toast.js CHANGED
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
21
24
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
25
  var Toast_exports = {};
23
26
  __export(Toast_exports, {
@@ -37,6 +40,7 @@ __export(Toast_exports, {
37
40
  Viewport: () => Viewport
38
41
  });
39
42
  module.exports = __toCommonJS(Toast_exports);
43
+ var import_jsx_runtime = require("react/jsx-runtime");
40
44
  var import_compose_refs = require("@tamagui/compose-refs");
41
45
  var import_core = require("@tamagui/core");
42
46
  var import_portal = require("@tamagui/portal");
@@ -60,7 +64,7 @@ const ToastProvider = (props) => {
60
64
  const [toastCount, setToastCount] = React.useState(0);
61
65
  const isFocusedToastEscapeKeyDownRef = React.useRef(false);
62
66
  const isClosePausedRef = React.useRef(false);
63
- return /* @__PURE__ */ React.createElement(ToastProviderProvider, {
67
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastProviderProvider, {
64
68
  scope: __scopeToast,
65
69
  label,
66
70
  duration,
@@ -72,8 +76,9 @@ const ToastProvider = (props) => {
72
76
  onToastAdd: React.useCallback(() => setToastCount((prevCount) => prevCount + 1), []),
73
77
  onToastRemove: React.useCallback(() => setToastCount((prevCount) => prevCount - 1), []),
74
78
  isFocusedToastEscapeKeyDownRef,
75
- isClosePausedRef
76
- }, children);
79
+ isClosePausedRef,
80
+ children
81
+ });
77
82
  };
78
83
  ToastProvider.propTypes = {
79
84
  label(props) {
@@ -89,199 +94,223 @@ const VIEWPORT_NAME = "ToastViewport";
89
94
  const VIEWPORT_DEFAULT_HOTKEY = ["F8"];
90
95
  const VIEWPORT_PAUSE = "toast.viewportPause";
91
96
  const VIEWPORT_RESUME = "toast.viewportResume";
92
- const ToastViewport = React.forwardRef((props, forwardedRef) => {
93
- const {
94
- __scopeToast,
95
- hotkey = VIEWPORT_DEFAULT_HOTKEY,
96
- label = "Notifications ({hotkey})",
97
- ...viewportProps
98
- } = props;
99
- const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);
100
- const wrapperRef = React.useRef(null);
101
- const headFocusProxyRef = React.useRef(null);
102
- const tailFocusProxyRef = React.useRef(null);
103
- const ref = React.useRef(null);
104
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, context.onViewportChange);
105
- const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
106
- const hasToasts = context.toastCount > 0;
107
- React.useEffect(() => {
108
- const handleKeyDown = (event) => {
109
- var _a;
110
- const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
111
- if (isHotkeyPressed)
112
- (_a = ref.current) == null ? void 0 : _a.focus();
113
- };
114
- document.addEventListener("keydown", handleKeyDown);
115
- return () => document.removeEventListener("keydown", handleKeyDown);
116
- }, [hotkey]);
117
- React.useEffect(() => {
118
- const wrapper = wrapperRef.current;
119
- const viewport = ref.current;
120
- if (wrapper && viewport) {
121
- const handlePause = () => {
122
- const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);
123
- context.isClosePausedRef.current = true;
124
- };
125
- const handleResume = () => {
126
- const resumeEvent = new CustomEvent(VIEWPORT_RESUME);
127
- context.isClosePausedRef.current = false;
128
- };
129
- wrapper.addEventListener("focusin", handlePause);
130
- wrapper.addEventListener("focusout", handleResume);
131
- wrapper.addEventListener("pointerenter", handlePause);
132
- wrapper.addEventListener("pointerleave", handleResume);
133
- window.addEventListener("blur", handlePause);
134
- window.addEventListener("focus", handleResume);
135
- return () => {
136
- wrapper.removeEventListener("focusin", handlePause);
137
- wrapper.removeEventListener("focusout", handleResume);
138
- wrapper.removeEventListener("pointerenter", handlePause);
139
- wrapper.removeEventListener("pointerleave", handleResume);
140
- window.removeEventListener("blur", handlePause);
141
- window.removeEventListener("focus", handleResume);
142
- };
143
- }
144
- }, [context.isClosePausedRef]);
145
- React.useEffect(() => {
146
- const viewport = ref.current;
147
- if (viewport) {
97
+ const ToastViewport = React.forwardRef(
98
+ (props, forwardedRef) => {
99
+ const {
100
+ __scopeToast,
101
+ hotkey = VIEWPORT_DEFAULT_HOTKEY,
102
+ label = "Notifications ({hotkey})",
103
+ ...viewportProps
104
+ } = props;
105
+ const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);
106
+ const wrapperRef = React.useRef(null);
107
+ const headFocusProxyRef = React.useRef(null);
108
+ const tailFocusProxyRef = React.useRef(null);
109
+ const ref = React.useRef(null);
110
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref, context.onViewportChange);
111
+ const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
112
+ const hasToasts = context.toastCount > 0;
113
+ React.useEffect(() => {
148
114
  const handleKeyDown = (event) => {
149
115
  var _a;
150
- const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
151
- const isTabKey = event.key === "Tab" && !isMetaKey;
152
- if (isTabKey) {
153
- const focusedElement = document.activeElement;
154
- const isTabbingBackwards = event.shiftKey;
155
- const targetIsViewport = event.target === viewport;
156
- if (targetIsViewport && isTabbingBackwards) {
157
- (_a = headFocusProxyRef.current) == null ? void 0 : _a.focus();
158
- return;
159
- }
160
- const tabbingDirection = isTabbingBackwards ? "backwards" : "forwards";
161
- }
162
- };
163
- return () => {
116
+ const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
117
+ if (isHotkeyPressed)
118
+ (_a = ref.current) == null ? void 0 : _a.focus();
164
119
  };
165
- }
166
- }, []);
167
- return null;
168
- });
120
+ document.addEventListener("keydown", handleKeyDown);
121
+ return () => document.removeEventListener("keydown", handleKeyDown);
122
+ }, [hotkey]);
123
+ React.useEffect(() => {
124
+ const wrapper = wrapperRef.current;
125
+ const viewport = ref.current;
126
+ if (wrapper && viewport) {
127
+ const handlePause = () => {
128
+ const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);
129
+ context.isClosePausedRef.current = true;
130
+ };
131
+ const handleResume = () => {
132
+ const resumeEvent = new CustomEvent(VIEWPORT_RESUME);
133
+ context.isClosePausedRef.current = false;
134
+ };
135
+ wrapper.addEventListener("focusin", handlePause);
136
+ wrapper.addEventListener("focusout", handleResume);
137
+ wrapper.addEventListener("pointerenter", handlePause);
138
+ wrapper.addEventListener("pointerleave", handleResume);
139
+ window.addEventListener("blur", handlePause);
140
+ window.addEventListener("focus", handleResume);
141
+ return () => {
142
+ wrapper.removeEventListener("focusin", handlePause);
143
+ wrapper.removeEventListener("focusout", handleResume);
144
+ wrapper.removeEventListener("pointerenter", handlePause);
145
+ wrapper.removeEventListener("pointerleave", handleResume);
146
+ window.removeEventListener("blur", handlePause);
147
+ window.removeEventListener("focus", handleResume);
148
+ };
149
+ }
150
+ }, [context.isClosePausedRef]);
151
+ React.useEffect(
152
+ () => {
153
+ const viewport = ref.current;
154
+ if (viewport) {
155
+ const handleKeyDown = (event) => {
156
+ var _a;
157
+ const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
158
+ const isTabKey = event.key === "Tab" && !isMetaKey;
159
+ if (isTabKey) {
160
+ const focusedElement = document.activeElement;
161
+ const isTabbingBackwards = event.shiftKey;
162
+ const targetIsViewport = event.target === viewport;
163
+ if (targetIsViewport && isTabbingBackwards) {
164
+ (_a = headFocusProxyRef.current) == null ? void 0 : _a.focus();
165
+ return;
166
+ }
167
+ const tabbingDirection = isTabbingBackwards ? "backwards" : "forwards";
168
+ }
169
+ };
170
+ return () => {
171
+ };
172
+ }
173
+ },
174
+ []
175
+ );
176
+ return null;
177
+ }
178
+ );
169
179
  ToastViewport.displayName = VIEWPORT_NAME;
170
180
  const FOCUS_PROXY_NAME = "ToastFocusProxy";
171
- const FocusProxy = React.forwardRef((props, forwardedRef) => {
172
- const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;
173
- const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);
174
- return /* @__PURE__ */ React.createElement(import_visually_hidden.VisuallyHidden, {
175
- "aria-hidden": true,
176
- tabIndex: 0,
177
- ...proxyProps,
178
- ref: forwardedRef,
179
- position: import_core.isWeb ? "fixed" : "absolute",
180
- onFocus: (event) => {
181
- var _a;
182
- const prevFocusedElement = event.relatedTarget;
183
- const isFocusFromOutsideViewport = !((_a = context.viewport) == null ? void 0 : _a.contains(prevFocusedElement));
184
- if (isFocusFromOutsideViewport)
185
- onFocusFromOutsideViewport();
186
- }
187
- });
188
- });
181
+ const FocusProxy = React.forwardRef(
182
+ (props, forwardedRef) => {
183
+ const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;
184
+ const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);
185
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_visually_hidden.VisuallyHidden, {
186
+ "aria-hidden": true,
187
+ tabIndex: 0,
188
+ ...proxyProps,
189
+ ref: forwardedRef,
190
+ position: import_core.isWeb ? "fixed" : "absolute",
191
+ onFocus: (event) => {
192
+ var _a;
193
+ const prevFocusedElement = event.relatedTarget;
194
+ const isFocusFromOutsideViewport = !((_a = context.viewport) == null ? void 0 : _a.contains(prevFocusedElement));
195
+ if (isFocusFromOutsideViewport)
196
+ onFocusFromOutsideViewport();
197
+ }
198
+ });
199
+ }
200
+ );
189
201
  FocusProxy.displayName = FOCUS_PROXY_NAME;
190
202
  const TOAST_NAME = "Toast";
191
203
  const TOAST_SWIPE_START = "toast.swipeStart";
192
204
  const TOAST_SWIPE_MOVE = "toast.swipeMove";
193
205
  const TOAST_SWIPE_CANCEL = "toast.swipeCancel";
194
206
  const TOAST_SWIPE_END = "toast.swipeEnd";
195
- const Toast = React.forwardRef((props, forwardedRef) => {
196
- const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;
197
- const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
198
- prop: openProp,
199
- defaultProp: defaultOpen || true,
200
- onChange: onOpenChange
201
- });
202
- return /* @__PURE__ */ React.createElement(ToastImpl, {
203
- open,
204
- ...toastProps,
205
- ref: forwardedRef,
206
- onClose: () => setOpen(false)
207
- });
208
- });
207
+ const Toast = React.forwardRef(
208
+ (props, forwardedRef) => {
209
+ const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;
210
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
211
+ prop: openProp,
212
+ defaultProp: defaultOpen || true,
213
+ onChange: onOpenChange
214
+ });
215
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastImpl, {
216
+ open,
217
+ ...toastProps,
218
+ ref: forwardedRef,
219
+ onClose: () => setOpen(false)
220
+ });
221
+ }
222
+ );
209
223
  Toast.displayName = TOAST_NAME;
210
224
  const [ToastInteractiveProvider, useToastInteractiveContext] = {};
211
- const ToastImpl = React.forwardRef((props, forwardedRef) => {
212
- const {
213
- __scopeToast,
214
- type = "foreground",
215
- duration: durationProp,
216
- open,
217
- onClose,
218
- onEscapeKeyDown,
219
- onSwipeStart,
220
- onSwipeMove,
221
- onSwipeCancel,
222
- onSwipeEnd,
223
- ...toastProps
224
- } = props;
225
- const context = useToastProviderContext(TOAST_NAME, __scopeToast);
226
- const ref = React.useRef(null);
227
- const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
228
- const pointerStartRef = React.useRef(null);
229
- const swipeDeltaRef = React.useRef(null);
230
- const duration = durationProp || context.duration;
231
- const closeTimerStartTimeRef = React.useRef(0);
232
- const closeTimerRemainingTimeRef = React.useRef(duration);
233
- const closeTimerRef = React.useRef(0);
234
- const { onToastAdd, onToastRemove } = context;
235
- const handleClose = (0, import_core.useEvent)(() => {
236
- onClose();
237
- });
238
- const startTimer = React.useCallback((duration2) => {
239
- if (!duration2 || duration2 === Infinity)
240
- return;
241
- window.clearTimeout(closeTimerRef.current);
242
- closeTimerStartTimeRef.current = new Date().getTime();
243
- closeTimerRef.current = window.setTimeout(handleClose, duration2);
244
- }, [handleClose]);
245
- React.useEffect(() => {
246
- const viewport = context.viewport;
247
- if (viewport) {
248
- const handleResume = () => {
249
- startTimer(closeTimerRemainingTimeRef.current);
250
- };
251
- const handlePause = () => {
252
- const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
253
- closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;
225
+ const ToastImpl = React.forwardRef(
226
+ (props, forwardedRef) => {
227
+ const {
228
+ __scopeToast,
229
+ type = "foreground",
230
+ duration: durationProp,
231
+ open,
232
+ onClose,
233
+ onEscapeKeyDown,
234
+ onSwipeStart,
235
+ onSwipeMove,
236
+ onSwipeCancel,
237
+ onSwipeEnd,
238
+ ...toastProps
239
+ } = props;
240
+ const context = useToastProviderContext(TOAST_NAME, __scopeToast);
241
+ const ref = React.useRef(null);
242
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
243
+ const pointerStartRef = React.useRef(null);
244
+ const swipeDeltaRef = React.useRef(null);
245
+ const duration = durationProp || context.duration;
246
+ const closeTimerStartTimeRef = React.useRef(0);
247
+ const closeTimerRemainingTimeRef = React.useRef(duration);
248
+ const closeTimerRef = React.useRef(0);
249
+ const { onToastAdd, onToastRemove } = context;
250
+ const handleClose = (0, import_core.useEvent)(() => {
251
+ onClose();
252
+ });
253
+ const startTimer = React.useCallback(
254
+ (duration2) => {
255
+ if (!duration2 || duration2 === Infinity)
256
+ return;
254
257
  window.clearTimeout(closeTimerRef.current);
255
- };
256
- viewport.addEventListener(VIEWPORT_PAUSE, handlePause);
257
- viewport.addEventListener(VIEWPORT_RESUME, handleResume);
258
- return () => {
259
- viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);
260
- viewport.removeEventListener(VIEWPORT_RESUME, handleResume);
261
- };
262
- }
263
- }, [context.viewport, duration, startTimer]);
264
- React.useEffect(() => {
265
- if (open && !context.isClosePausedRef.current)
266
- startTimer(duration);
267
- }, [open, duration, context.isClosePausedRef, startTimer]);
268
- React.useEffect(() => {
269
- onToastAdd();
270
- return () => onToastRemove();
271
- }, [onToastAdd, onToastRemove]);
272
- if (!context.viewport)
273
- return null;
274
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ToastAnnounce, {
275
- __scopeToast,
276
- role: "status",
277
- "aria-live": type === "foreground" ? "assertive" : "polite",
278
- "aria-atomic": true
279
- }, props.children), /* @__PURE__ */ React.createElement(ToastInteractiveProvider, {
280
- scope: __scopeToast,
281
- isInteractive: true,
282
- onClose: handleClose
283
- }, ReactDOM.createPortal(/* @__PURE__ */ React.createElement("div", null), context.viewport)));
284
- });
258
+ closeTimerStartTimeRef.current = new Date().getTime();
259
+ closeTimerRef.current = window.setTimeout(handleClose, duration2);
260
+ },
261
+ [handleClose]
262
+ );
263
+ React.useEffect(() => {
264
+ const viewport = context.viewport;
265
+ if (viewport) {
266
+ const handleResume = () => {
267
+ startTimer(closeTimerRemainingTimeRef.current);
268
+ };
269
+ const handlePause = () => {
270
+ const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
271
+ closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;
272
+ window.clearTimeout(closeTimerRef.current);
273
+ };
274
+ viewport.addEventListener(VIEWPORT_PAUSE, handlePause);
275
+ viewport.addEventListener(VIEWPORT_RESUME, handleResume);
276
+ return () => {
277
+ viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);
278
+ viewport.removeEventListener(VIEWPORT_RESUME, handleResume);
279
+ };
280
+ }
281
+ }, [context.viewport, duration, startTimer]);
282
+ React.useEffect(() => {
283
+ if (open && !context.isClosePausedRef.current)
284
+ startTimer(duration);
285
+ }, [open, duration, context.isClosePausedRef, startTimer]);
286
+ React.useEffect(() => {
287
+ onToastAdd();
288
+ return () => onToastRemove();
289
+ }, [onToastAdd, onToastRemove]);
290
+ if (!context.viewport)
291
+ return null;
292
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
293
+ children: [
294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastAnnounce, {
295
+ __scopeToast,
296
+ role: "status",
297
+ "aria-live": type === "foreground" ? "assertive" : "polite",
298
+ "aria-atomic": true,
299
+ children: props.children
300
+ }),
301
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastInteractiveProvider, {
302
+ scope: __scopeToast,
303
+ isInteractive: true,
304
+ onClose: handleClose,
305
+ children: ReactDOM.createPortal(
306
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {}),
307
+ context.viewport
308
+ )
309
+ })
310
+ ]
311
+ });
312
+ }
313
+ );
285
314
  ToastImpl.propTypes = {
286
315
  type(props) {
287
316
  if (props.type && !["foreground", "background"].includes(props.type)) {
@@ -309,44 +338,64 @@ const ToastAnnounce = (props) => {
309
338
  const timer = window.setTimeout(() => setIsAnnounced(true), 1e3);
310
339
  return () => window.clearTimeout(timer);
311
340
  }, []);
312
- return isAnnounced ? null : /* @__PURE__ */ React.createElement(React.Fragment, null, fragment && /* @__PURE__ */ React.createElement(import_portal.Portal, {
313
- container: fragment,
314
- ref: setRootFragmentNode
315
- }, context.label, " ", children), /* @__PURE__ */ React.createElement(import_portal.Portal, {
316
- asChild: true
317
- }, /* @__PURE__ */ React.createElement(import_visually_hidden.VisuallyHidden, {
318
- ...announceProps
319
- }, renderAnnounceText && announceTextContent)));
341
+ return isAnnounced ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
342
+ children: [
343
+ fragment && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_portal.Portal, {
344
+ container: fragment,
345
+ ref: setRootFragmentNode,
346
+ children: [
347
+ context.label,
348
+ " ",
349
+ children
350
+ ]
351
+ }),
352
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, {
353
+ asChild: true,
354
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_visually_hidden.VisuallyHidden, {
355
+ ...announceProps,
356
+ children: renderAnnounceText && announceTextContent
357
+ })
358
+ })
359
+ ]
360
+ });
320
361
  };
321
362
  const TITLE_NAME = "ToastTitle";
322
- const ToastTitle = React.forwardRef((props, forwardedRef) => {
323
- const { __scopeToast, ...titleProps } = props;
324
- return /* @__PURE__ */ React.createElement(import_stacks.YStack, {
325
- ...titleProps,
326
- ref: forwardedRef
327
- });
328
- });
363
+ const ToastTitle = React.forwardRef(
364
+ (props, forwardedRef) => {
365
+ const { __scopeToast, ...titleProps } = props;
366
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
367
+ ...titleProps,
368
+ ref: forwardedRef
369
+ });
370
+ }
371
+ );
329
372
  ToastTitle.displayName = TITLE_NAME;
330
373
  const DESCRIPTION_NAME = "ToastDescription";
331
- const ToastDescription = React.forwardRef((props, forwardedRef) => {
332
- const { __scopeToast, ...descriptionProps } = props;
333
- return /* @__PURE__ */ React.createElement(import_stacks.YStack, {
334
- ...descriptionProps,
335
- ref: forwardedRef
336
- });
337
- });
374
+ const ToastDescription = React.forwardRef(
375
+ (props, forwardedRef) => {
376
+ const { __scopeToast, ...descriptionProps } = props;
377
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
378
+ ...descriptionProps,
379
+ ref: forwardedRef
380
+ });
381
+ }
382
+ );
338
383
  ToastDescription.displayName = DESCRIPTION_NAME;
339
384
  const ACTION_NAME = "ToastAction";
340
- const ToastAction = React.forwardRef((props, forwardedRef) => {
341
- const { altText, ...actionProps } = props;
342
- const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);
343
- if (!altText)
344
- return null;
345
- return context.isInteractive ? /* @__PURE__ */ React.createElement(ToastClose, {
346
- ...actionProps,
347
- ref: forwardedRef
348
- }) : /* @__PURE__ */ React.createElement("span", null, altText);
349
- });
385
+ const ToastAction = React.forwardRef(
386
+ (props, forwardedRef) => {
387
+ const { altText, ...actionProps } = props;
388
+ const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);
389
+ if (!altText)
390
+ return null;
391
+ return context.isInteractive ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastClose, {
392
+ ...actionProps,
393
+ ref: forwardedRef
394
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
395
+ children: altText
396
+ });
397
+ }
398
+ );
350
399
  ToastAction.propTypes = {
351
400
  altText(props) {
352
401
  if (!props.altText) {
@@ -357,16 +406,18 @@ ToastAction.propTypes = {
357
406
  };
358
407
  ToastAction.displayName = ACTION_NAME;
359
408
  const CLOSE_NAME = "ToastClose";
360
- const ToastClose = React.forwardRef((props, forwardedRef) => {
361
- const { __scopeToast, ...closeProps } = props;
362
- const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);
363
- return interactiveContext.isInteractive ? /* @__PURE__ */ React.createElement(import_stacks.YStack, {
364
- tag: "button",
365
- ...closeProps,
366
- ref: forwardedRef,
367
- onPress: (0, import_core.composeEventHandlers)(props.onPress, interactiveContext.onClose)
368
- }) : null;
369
- });
409
+ const ToastClose = React.forwardRef(
410
+ (props, forwardedRef) => {
411
+ const { __scopeToast, ...closeProps } = props;
412
+ const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);
413
+ return interactiveContext.isInteractive ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.YStack, {
414
+ tag: "button",
415
+ ...closeProps,
416
+ ref: forwardedRef,
417
+ onPress: (0, import_core.composeEventHandlers)(props.onPress, interactiveContext.onClose)
418
+ }) : null;
419
+ }
420
+ );
370
421
  ToastClose.displayName = CLOSE_NAME;
371
422
  function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
372
423
  const currentTarget = detail.originalEvent.currentTarget;