@tamagui/dialog 1.0.1-beta.149 → 1.0.1-beta.152

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.
@@ -1,3 +1,4 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
2
  import { AnimatePresence } from "@tamagui/animate-presence";
2
3
  import { hideOthers } from "@tamagui/aria-hidden";
3
4
  import { useComposedRefs } from "@tamagui/compose-refs";
@@ -30,21 +31,23 @@ const TRIGGER_NAME = "DialogTrigger";
30
31
  const DialogTriggerFrame = styled(YStack, {
31
32
  name: TRIGGER_NAME
32
33
  });
33
- const DialogTrigger = React.forwardRef((props, forwardedRef) => {
34
- const { __scopeDialog, ...triggerProps } = props;
35
- const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
36
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
37
- return /* @__PURE__ */ React.createElement(DialogTriggerFrame, {
38
- tag: "button",
39
- "aria-haspopup": "dialog",
40
- "aria-expanded": context.open,
41
- "aria-controls": context.contentId,
42
- "data-state": getState(context.open),
43
- ...triggerProps,
44
- ref: composedTriggerRef,
45
- onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
46
- });
47
- });
34
+ const DialogTrigger = React.forwardRef(
35
+ (props, forwardedRef) => {
36
+ const { __scopeDialog, ...triggerProps } = props;
37
+ const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
38
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
39
+ return /* @__PURE__ */ jsx(DialogTriggerFrame, {
40
+ tag: "button",
41
+ "aria-haspopup": "dialog",
42
+ "aria-expanded": context.open,
43
+ "aria-controls": context.contentId,
44
+ "data-state": getState(context.open),
45
+ ...triggerProps,
46
+ ref: composedTriggerRef,
47
+ onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
48
+ });
49
+ }
50
+ );
48
51
  DialogTrigger.displayName = TRIGGER_NAME;
49
52
  const PORTAL_NAME = "DialogPortal";
50
53
  const [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
@@ -59,29 +62,39 @@ const DialogPortalFrame = styled(YStack, {
59
62
  maxHeight: "100vh"
60
63
  }
61
64
  });
62
- const DialogPortal = DialogPortalFrame.extractable((props) => {
63
- const { __scopeDialog, forceMount, children, ...frameProps } = props;
64
- const themeName = useThemeName();
65
- const context = useDialogContext(PORTAL_NAME, __scopeDialog);
66
- const isShowing = forceMount || context.open;
67
- const contents = /* @__PURE__ */ React.createElement(AnimatePresence, null, isShowing ? children : null);
68
- const isSheet = useShowDialogSheet(context);
69
- if (!context.modal || isSheet) {
70
- return contents;
65
+ const DialogPortal = DialogPortalFrame.extractable(
66
+ (props) => {
67
+ const { __scopeDialog, forceMount, children, ...frameProps } = props;
68
+ const themeName = useThemeName();
69
+ const context = useDialogContext(PORTAL_NAME, __scopeDialog);
70
+ const isShowing = forceMount || context.open;
71
+ const contents = /* @__PURE__ */ jsx(AnimatePresence, {
72
+ children: isShowing ? children : null
73
+ });
74
+ const isSheet = useShowDialogSheet(context);
75
+ if (!context.modal || isSheet) {
76
+ return contents;
77
+ }
78
+ return /* @__PURE__ */ jsx(PortalItem, {
79
+ children: /* @__PURE__ */ jsx(DialogProvider, {
80
+ scope: __scopeDialog,
81
+ ...context,
82
+ children: /* @__PURE__ */ jsx(Theme, {
83
+ name: themeName,
84
+ children: /* @__PURE__ */ jsx(PortalProvider, {
85
+ scope: __scopeDialog,
86
+ forceMount,
87
+ children: /* @__PURE__ */ jsx(DialogPortalFrame, {
88
+ pointerEvents: isShowing ? "auto" : "none",
89
+ ...frameProps,
90
+ children: contents
91
+ })
92
+ })
93
+ })
94
+ })
95
+ });
71
96
  }
72
- return /* @__PURE__ */ React.createElement(PortalItem, null, /* @__PURE__ */ React.createElement(DialogProvider, {
73
- scope: __scopeDialog,
74
- ...context
75
- }, /* @__PURE__ */ React.createElement(Theme, {
76
- name: themeName
77
- }, /* @__PURE__ */ React.createElement(PortalProvider, {
78
- scope: __scopeDialog,
79
- forceMount
80
- }, /* @__PURE__ */ React.createElement(DialogPortalFrame, {
81
- pointerEvents: isShowing ? "auto" : "none",
82
- ...frameProps
83
- }, contents)))));
84
- });
97
+ );
85
98
  DialogPortal.displayName = PORTAL_NAME;
86
99
  const OVERLAY_NAME = "DialogOverlay";
87
100
  const DialogOverlayFrame = styled(ThemeableStack, {
@@ -89,38 +102,43 @@ const DialogOverlayFrame = styled(ThemeableStack, {
89
102
  backgrounded: true,
90
103
  fullscreen: true
91
104
  });
92
- const DialogOverlay = React.forwardRef(({ __scopeDialog, ...props }, forwardedRef) => {
93
- const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog);
94
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
95
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
96
- const showSheet = useShowDialogSheet(context);
97
- if (!forceMount) {
98
- if (!context.modal || showSheet) {
99
- return null;
105
+ const DialogOverlay = React.forwardRef(
106
+ ({ __scopeDialog, ...props }, forwardedRef) => {
107
+ const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog);
108
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
109
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
110
+ const showSheet = useShowDialogSheet(context);
111
+ if (!forceMount) {
112
+ if (!context.modal || showSheet) {
113
+ return null;
114
+ }
100
115
  }
116
+ return /* @__PURE__ */ jsx(DialogOverlayImpl, {
117
+ context,
118
+ ...overlayProps,
119
+ ref: forwardedRef
120
+ });
101
121
  }
102
- return /* @__PURE__ */ React.createElement(DialogOverlayImpl, {
103
- context,
104
- ...overlayProps,
105
- ref: forwardedRef
106
- });
107
- });
122
+ );
108
123
  DialogOverlay.displayName = OVERLAY_NAME;
109
- const DialogOverlayImpl = React.forwardRef((props, forwardedRef) => {
110
- const { context, ...overlayProps } = props;
111
- return /* @__PURE__ */ React.createElement(RemoveScroll, {
112
- enabled: context.open,
113
- as: Slot,
114
- allowPinchZoom: context.allowPinchZoom,
115
- shards: [context.contentRef],
116
- removeScrollBar: false
117
- }, /* @__PURE__ */ React.createElement(DialogOverlayFrame, {
118
- "data-state": getState(context.open),
119
- pointerEvents: context.open ? "auto" : "none",
120
- ...overlayProps,
121
- ref: forwardedRef
122
- }));
123
- });
124
+ const DialogOverlayImpl = React.forwardRef(
125
+ (props, forwardedRef) => {
126
+ const { context, ...overlayProps } = props;
127
+ return /* @__PURE__ */ jsx(RemoveScroll, {
128
+ enabled: context.open,
129
+ as: Slot,
130
+ allowPinchZoom: context.allowPinchZoom,
131
+ shards: [context.contentRef],
132
+ removeScrollBar: false,
133
+ children: /* @__PURE__ */ jsx(DialogOverlayFrame, {
134
+ "data-state": getState(context.open),
135
+ pointerEvents: context.open ? "auto" : "none",
136
+ ...overlayProps,
137
+ ref: forwardedRef
138
+ })
139
+ });
140
+ }
141
+ );
124
142
  const CONTENT_NAME = "DialogContent";
125
143
  const DialogContentFrame = styled(ThemeableStack, {
126
144
  name: CONTENT_NAME,
@@ -141,144 +159,173 @@ const DialogContentFrame = styled(ThemeableStack, {
141
159
  size: "$4"
142
160
  }
143
161
  });
144
- const DialogContent = DialogContentFrame.extractable(React.forwardRef(({ __scopeDialog, ...props }, forwardedRef) => {
145
- const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog);
146
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
147
- const context = useDialogContext(CONTENT_NAME, __scopeDialog);
148
- return /* @__PURE__ */ React.createElement(React.Fragment, null, context.modal ? /* @__PURE__ */ React.createElement(DialogContentModal, {
149
- context,
150
- ...contentProps,
151
- ref: forwardedRef
152
- }) : /* @__PURE__ */ React.createElement(DialogContentNonModal, {
153
- context,
154
- ...contentProps,
155
- ref: forwardedRef
156
- }));
157
- }));
162
+ const DialogContent = DialogContentFrame.extractable(
163
+ React.forwardRef(
164
+ ({ __scopeDialog, ...props }, forwardedRef) => {
165
+ const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog);
166
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
167
+ const context = useDialogContext(CONTENT_NAME, __scopeDialog);
168
+ return /* @__PURE__ */ jsx(Fragment, {
169
+ children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, {
170
+ context,
171
+ ...contentProps,
172
+ ref: forwardedRef
173
+ }) : /* @__PURE__ */ jsx(DialogContentNonModal, {
174
+ context,
175
+ ...contentProps,
176
+ ref: forwardedRef
177
+ })
178
+ });
179
+ }
180
+ )
181
+ );
158
182
  DialogContent.displayName = CONTENT_NAME;
159
- const DialogContentModal = React.forwardRef(({ children, context, ...props }, forwardedRef) => {
160
- const contentRef = React.useRef(null);
161
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
162
- React.useEffect(() => {
163
- if (!context.open)
164
- return;
165
- const content = contentRef.current;
166
- if (content)
167
- return hideOthers(content);
168
- }, [context.open]);
169
- return /* @__PURE__ */ React.createElement(DialogContentImpl, {
170
- ...props,
171
- context,
172
- ref: composedRefs,
173
- trapFocus: context.open,
174
- disableOutsidePointerEvents: true,
175
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
176
- var _a;
177
- event.preventDefault();
178
- (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
179
- }),
180
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
181
- const originalEvent = event["detail"].originalEvent;
182
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
183
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
184
- if (isRightClick)
183
+ const DialogContentModal = React.forwardRef(
184
+ ({ children, context, ...props }, forwardedRef) => {
185
+ const contentRef = React.useRef(null);
186
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
187
+ React.useEffect(() => {
188
+ if (!context.open)
189
+ return;
190
+ const content = contentRef.current;
191
+ if (content)
192
+ return hideOthers(content);
193
+ }, [context.open]);
194
+ return /* @__PURE__ */ jsx(DialogContentImpl, {
195
+ ...props,
196
+ context,
197
+ ref: composedRefs,
198
+ trapFocus: context.open,
199
+ disableOutsidePointerEvents: true,
200
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
201
+ var _a;
185
202
  event.preventDefault();
186
- }),
187
- onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => event.preventDefault())
188
- }, children);
189
- });
190
- const DialogContentNonModal = React.forwardRef((props, forwardedRef) => {
191
- const hasInteractedOutsideRef = React.useRef(false);
192
- return /* @__PURE__ */ React.createElement(DialogContentImpl, {
193
- ...props,
194
- ref: forwardedRef,
195
- trapFocus: false,
196
- disableOutsidePointerEvents: false,
197
- onCloseAutoFocus: (event) => {
198
- var _a, _b;
199
- console.log("on close autofocus");
200
- (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
201
- if (!event.defaultPrevented) {
202
- if (!hasInteractedOutsideRef.current) {
203
- (_b = props.context.triggerRef.current) == null ? void 0 : _b.focus();
203
+ (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
204
+ }),
205
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
206
+ const originalEvent = event["detail"].originalEvent;
207
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
208
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
209
+ if (isRightClick)
210
+ event.preventDefault();
211
+ }),
212
+ onFocusOutside: composeEventHandlers(
213
+ props.onFocusOutside,
214
+ (event) => event.preventDefault()
215
+ ),
216
+ children
217
+ });
218
+ }
219
+ );
220
+ const DialogContentNonModal = React.forwardRef(
221
+ (props, forwardedRef) => {
222
+ const hasInteractedOutsideRef = React.useRef(false);
223
+ return /* @__PURE__ */ jsx(DialogContentImpl, {
224
+ ...props,
225
+ ref: forwardedRef,
226
+ trapFocus: false,
227
+ disableOutsidePointerEvents: false,
228
+ onCloseAutoFocus: (event) => {
229
+ var _a, _b;
230
+ console.log("on close autofocus");
231
+ (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
232
+ if (!event.defaultPrevented) {
233
+ if (!hasInteractedOutsideRef.current) {
234
+ (_b = props.context.triggerRef.current) == null ? void 0 : _b.focus();
235
+ }
236
+ event.preventDefault();
204
237
  }
205
- event.preventDefault();
238
+ hasInteractedOutsideRef.current = false;
239
+ },
240
+ onInteractOutside: (event) => {
241
+ var _a;
242
+ (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
243
+ if (!event.defaultPrevented)
244
+ hasInteractedOutsideRef.current = true;
245
+ const target = event.target;
246
+ const trigger = props.context.triggerRef.current;
247
+ if (!(trigger instanceof HTMLElement))
248
+ return;
249
+ const targetIsTrigger = trigger.contains(target);
250
+ if (targetIsTrigger)
251
+ event.preventDefault();
206
252
  }
207
- hasInteractedOutsideRef.current = false;
208
- },
209
- onInteractOutside: (event) => {
210
- var _a;
211
- (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
212
- if (!event.defaultPrevented)
213
- hasInteractedOutsideRef.current = true;
214
- const target = event.target;
215
- const trigger = props.context.triggerRef.current;
216
- if (!(trigger instanceof HTMLElement))
217
- return;
218
- const targetIsTrigger = trigger.contains(target);
219
- if (targetIsTrigger)
220
- event.preventDefault();
221
- }
222
- });
223
- });
224
- const DialogContentImpl = React.forwardRef((props, forwardedRef) => {
225
- const {
226
- __scopeDialog,
227
- trapFocus,
228
- onOpenAutoFocus,
229
- onCloseAutoFocus,
230
- disableOutsidePointerEvents,
231
- onEscapeKeyDown,
232
- onPointerDownOutside,
233
- onFocusOutside,
234
- onInteractOutside,
235
- context,
236
- ...contentProps
237
- } = props;
238
- const contentRef = React.useRef(null);
239
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
240
- const showSheet = useShowDialogSheet(context);
241
- const contents = /* @__PURE__ */ React.createElement(DialogContentFrame, {
242
- id: context.contentId,
243
- "aria-describedby": context.descriptionId,
244
- "aria-labelledby": context.titleId,
245
- "data-state": getState(context.open),
246
- ...contentProps
247
- });
248
- if (showSheet) {
249
- return /* @__PURE__ */ React.createElement(PortalItem, {
250
- hostName: `${context.scopeKey}SheetContents`
251
- }, contentProps.children);
253
+ });
252
254
  }
253
- if (!isWeb) {
254
- return contents;
255
+ );
256
+ const DialogContentImpl = React.forwardRef(
257
+ (props, forwardedRef) => {
258
+ const {
259
+ __scopeDialog,
260
+ trapFocus,
261
+ onOpenAutoFocus,
262
+ onCloseAutoFocus,
263
+ disableOutsidePointerEvents,
264
+ onEscapeKeyDown,
265
+ onPointerDownOutside,
266
+ onFocusOutside,
267
+ onInteractOutside,
268
+ context,
269
+ ...contentProps
270
+ } = props;
271
+ const contentRef = React.useRef(null);
272
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
273
+ const showSheet = useShowDialogSheet(context);
274
+ const contents = /* @__PURE__ */ jsx(DialogContentFrame, {
275
+ id: context.contentId,
276
+ "aria-describedby": context.descriptionId,
277
+ "aria-labelledby": context.titleId,
278
+ "data-state": getState(context.open),
279
+ ...contentProps
280
+ });
281
+ if (showSheet) {
282
+ return /* @__PURE__ */ jsx(PortalItem, {
283
+ hostName: `${context.scopeKey}SheetContents`,
284
+ children: contentProps.children
285
+ });
286
+ }
287
+ if (!isWeb) {
288
+ return contents;
289
+ }
290
+ return /* @__PURE__ */ jsxs(Fragment, {
291
+ children: [
292
+ /* @__PURE__ */ jsx(FocusScope, {
293
+ loop: true,
294
+ trapped: trapFocus,
295
+ onMountAutoFocus: onOpenAutoFocus,
296
+ forceUnmount: !context.open,
297
+ onUnmountAutoFocus: onCloseAutoFocus,
298
+ children: /* @__PURE__ */ jsx(Dismissable, {
299
+ disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
300
+ forceUnmount: !context.open,
301
+ onEscapeKeyDown,
302
+ onPointerDownOutside,
303
+ onFocusOutside,
304
+ onInteractOutside,
305
+ ref: composedRefs,
306
+ onDismiss: () => context.onOpenChange(false),
307
+ children: contents
308
+ })
309
+ }),
310
+ process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs(Fragment, {
311
+ children: [
312
+ /* @__PURE__ */ jsx(TitleWarning, {
313
+ titleId: context.titleId
314
+ }),
315
+ /* @__PURE__ */ jsx(DescriptionWarning, {
316
+ contentRef,
317
+ descriptionId: context.descriptionId
318
+ })
319
+ ]
320
+ })
321
+ ]
322
+ });
255
323
  }
256
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FocusScope, {
257
- loop: true,
258
- trapped: trapFocus,
259
- onMountAutoFocus: onOpenAutoFocus,
260
- forceUnmount: !context.open,
261
- onUnmountAutoFocus: onCloseAutoFocus
262
- }, /* @__PURE__ */ React.createElement(Dismissable, {
263
- disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
264
- forceUnmount: !context.open,
265
- onEscapeKeyDown,
266
- onPointerDownOutside,
267
- onFocusOutside,
268
- onInteractOutside,
269
- ref: composedRefs,
270
- onDismiss: () => context.onOpenChange(false)
271
- }, contents)), process.env.NODE_ENV === "development" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TitleWarning, {
272
- titleId: context.titleId
273
- }), /* @__PURE__ */ React.createElement(DescriptionWarning, {
274
- contentRef,
275
- descriptionId: context.descriptionId
276
- })));
277
- });
324
+ );
278
325
  const SHEET_CONTENTS_NAME = "DialogSheetContents";
279
326
  const DialogSheetContents = ({ __scopeDialog }) => {
280
327
  const context = useDialogContext(SHEET_CONTENTS_NAME, __scopeDialog);
281
- return /* @__PURE__ */ React.createElement(PortalHost, {
328
+ return /* @__PURE__ */ jsx(PortalHost, {
282
329
  name: `${context.scopeKey}SheetContents`
283
330
  });
284
331
  };
@@ -287,45 +334,51 @@ const TITLE_NAME = "DialogTitle";
287
334
  const DialogTitleFrame = styled(H2, {
288
335
  name: TITLE_NAME
289
336
  });
290
- const DialogTitle = React.forwardRef((props, forwardedRef) => {
291
- const { __scopeDialog, ...titleProps } = props;
292
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
293
- return /* @__PURE__ */ React.createElement(DialogTitleFrame, {
294
- id: context.titleId,
295
- ...titleProps,
296
- ref: forwardedRef
297
- });
298
- });
337
+ const DialogTitle = React.forwardRef(
338
+ (props, forwardedRef) => {
339
+ const { __scopeDialog, ...titleProps } = props;
340
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
341
+ return /* @__PURE__ */ jsx(DialogTitleFrame, {
342
+ id: context.titleId,
343
+ ...titleProps,
344
+ ref: forwardedRef
345
+ });
346
+ }
347
+ );
299
348
  DialogTitle.displayName = TITLE_NAME;
300
349
  const DialogDescriptionFrame = styled(Paragraph, {
301
350
  name: "DialogDescription"
302
351
  });
303
352
  const DESCRIPTION_NAME = "DialogDescription";
304
- const DialogDescription = React.forwardRef((props, forwardedRef) => {
305
- const { __scopeDialog, ...descriptionProps } = props;
306
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
307
- return /* @__PURE__ */ React.createElement(DialogDescriptionFrame, {
308
- id: context.descriptionId,
309
- ...descriptionProps,
310
- ref: forwardedRef
311
- });
312
- });
353
+ const DialogDescription = React.forwardRef(
354
+ (props, forwardedRef) => {
355
+ const { __scopeDialog, ...descriptionProps } = props;
356
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
357
+ return /* @__PURE__ */ jsx(DialogDescriptionFrame, {
358
+ id: context.descriptionId,
359
+ ...descriptionProps,
360
+ ref: forwardedRef
361
+ });
362
+ }
363
+ );
313
364
  DialogDescription.displayName = DESCRIPTION_NAME;
314
365
  const CLOSE_NAME = "DialogClose";
315
- const DialogClose = React.forwardRef((props, forwardedRef) => {
316
- const { __scopeDialog, ...closeProps } = props;
317
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
318
- const isSheet = useShowDialogSheet(context);
319
- if (isSheet) {
320
- return null;
366
+ const DialogClose = React.forwardRef(
367
+ (props, forwardedRef) => {
368
+ const { __scopeDialog, ...closeProps } = props;
369
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
370
+ const isSheet = useShowDialogSheet(context);
371
+ if (isSheet) {
372
+ return null;
373
+ }
374
+ return /* @__PURE__ */ jsx(YStack, {
375
+ tag: "button",
376
+ ...closeProps,
377
+ ref: forwardedRef,
378
+ onPress: composeEventHandlers(props.onPress, () => context.onOpenChange(false))
379
+ });
321
380
  }
322
- return /* @__PURE__ */ React.createElement(YStack, {
323
- tag: "button",
324
- ...closeProps,
325
- ref: forwardedRef,
326
- onPress: composeEventHandlers(props.onPress, () => context.onOpenChange(false))
327
- });
328
- });
381
+ );
329
382
  DialogClose.displayName = CLOSE_NAME;
330
383
  function getState(open) {
331
384
  return open ? "open" : "closed";
@@ -392,10 +445,14 @@ const DialogInner = React.forwardRef(function Dialog(props, ref) {
392
445
  defaultProp: defaultOpen,
393
446
  onChange: onOpenChange
394
447
  });
395
- React.useImperativeHandle(ref, () => ({
396
- open: setOpen
397
- }), [setOpen]);
398
- return /* @__PURE__ */ React.createElement(DialogProvider, {
448
+ React.useImperativeHandle(
449
+ ref,
450
+ () => ({
451
+ open: setOpen
452
+ }),
453
+ [setOpen]
454
+ );
455
+ return /* @__PURE__ */ jsx(DialogProvider, {
399
456
  scope: __scopeDialog,
400
457
  scopeKey: __scopeDialog ? Object.keys(__scopeDialog)[0] : "",
401
458
  triggerRef,
@@ -408,11 +465,13 @@ const DialogInner = React.forwardRef(function Dialog(props, ref) {
408
465
  onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
409
466
  modal,
410
467
  allowPinchZoom,
411
- sheetBreakpoint
412
- }, /* @__PURE__ */ React.createElement(DialogSheetController, {
413
- onChangeOpen: setOpen,
414
- __scopeDialog
415
- }, children));
468
+ sheetBreakpoint,
469
+ children: /* @__PURE__ */ jsx(DialogSheetController, {
470
+ onChangeOpen: setOpen,
471
+ __scopeDialog,
472
+ children
473
+ })
474
+ });
416
475
  });
417
476
  const Dialog2 = withStaticProperties(DialogInner, {
418
477
  Trigger: DialogTrigger,
@@ -430,15 +489,16 @@ const DialogSheetController = (props) => {
430
489
  const showSheet = useShowDialogSheet(context);
431
490
  const breakpointActive = useSheetBreakpointActive(context);
432
491
  const getShowSheet = useGet(showSheet);
433
- return /* @__PURE__ */ React.createElement(SheetController, {
492
+ return /* @__PURE__ */ jsx(SheetController, {
434
493
  onChangeOpen: (val) => {
435
494
  if (getShowSheet()) {
436
495
  props.onChangeOpen(val);
437
496
  }
438
497
  },
439
498
  open: context.open,
440
- hidden: breakpointActive === false
441
- }, props.children);
499
+ hidden: breakpointActive === false,
500
+ children: props.children
501
+ });
442
502
  };
443
503
  const useSheetBreakpointActive = (context) => {
444
504
  const media = useMedia();