@tamagui/toast 1.0.1-beta.151 → 1.0.1-beta.154

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