@tamagui/dialog 1.1.8 → 1.1.10
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/Dialog.js +193 -215
- package/dist/cjs/Dialog.js.map +1 -1
- package/dist/esm/Dialog.js +189 -215
- package/dist/esm/Dialog.js.map +1 -1
- package/dist/jsx/Dialog.js +133 -55
- package/dist/jsx/Dialog.js.map +1 -1
- package/package.json +18 -18
package/dist/esm/Dialog.js
CHANGED
|
@@ -37,16 +37,19 @@ const DialogTrigger = React.forwardRef(
|
|
|
37
37
|
const { __scopeDialog, ...triggerProps } = props;
|
|
38
38
|
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
39
39
|
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
40
|
-
return /* @__PURE__ */ jsx(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
DialogTriggerFrame,
|
|
42
|
+
{
|
|
43
|
+
tag: "button",
|
|
44
|
+
"aria-haspopup": "dialog",
|
|
45
|
+
"aria-expanded": context.open,
|
|
46
|
+
"aria-controls": context.contentId,
|
|
47
|
+
"data-state": getState(context.open),
|
|
48
|
+
...triggerProps,
|
|
49
|
+
ref: composedTriggerRef,
|
|
50
|
+
onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
|
|
51
|
+
}
|
|
52
|
+
);
|
|
50
53
|
}
|
|
51
54
|
);
|
|
52
55
|
DialogTrigger.displayName = TRIGGER_NAME;
|
|
@@ -70,14 +73,7 @@ const DialogPortalFrame = styled(YStack, {
|
|
|
70
73
|
const DialogPortalItem = (props) => {
|
|
71
74
|
const themeName = useThemeName();
|
|
72
75
|
const context = useDialogContext(PORTAL_NAME, props.__scopeDialog);
|
|
73
|
-
return /* @__PURE__ */ jsx(PortalItem, {
|
|
74
|
-
hostName: props.hostName,
|
|
75
|
-
children: /* @__PURE__ */ jsx(DialogPortalItemContent, {
|
|
76
|
-
...props,
|
|
77
|
-
themeName,
|
|
78
|
-
context
|
|
79
|
-
})
|
|
80
|
-
});
|
|
76
|
+
return /* @__PURE__ */ jsx(PortalItem, { hostName: props.hostName, children: /* @__PURE__ */ jsx(DialogPortalItemContent, { ...props, themeName, context }) });
|
|
81
77
|
};
|
|
82
78
|
function DialogPortalItemContent(props) {
|
|
83
79
|
const {
|
|
@@ -98,14 +94,7 @@ function DialogPortalItemContent(props) {
|
|
|
98
94
|
direction: spaceDirection
|
|
99
95
|
});
|
|
100
96
|
}
|
|
101
|
-
return /* @__PURE__ */ jsx(DialogProvider, {
|
|
102
|
-
scope: __scopeDialog,
|
|
103
|
-
...context,
|
|
104
|
-
children: /* @__PURE__ */ jsx(Theme, {
|
|
105
|
-
name: themeName,
|
|
106
|
-
children: childrenSpaced
|
|
107
|
-
})
|
|
108
|
-
});
|
|
97
|
+
return /* @__PURE__ */ jsx(DialogProvider, { scope: __scopeDialog, ...context, children: /* @__PURE__ */ jsx(Theme, { name: themeName, children: childrenSpaced }) });
|
|
109
98
|
}
|
|
110
99
|
const DialogPortal = (props) => {
|
|
111
100
|
const { __scopeDialog, forceMount, children, ...frameProps } = props;
|
|
@@ -115,12 +104,15 @@ const DialogPortal = (props) => {
|
|
|
115
104
|
if (isShowing && isFullyHidden) {
|
|
116
105
|
setIsFullyHidden(false);
|
|
117
106
|
}
|
|
118
|
-
const contents = /* @__PURE__ */ jsx(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
const contents = /* @__PURE__ */ jsx(
|
|
108
|
+
AnimatePresence,
|
|
109
|
+
{
|
|
110
|
+
onExitComplete: () => {
|
|
111
|
+
setIsFullyHidden(true);
|
|
112
|
+
},
|
|
113
|
+
children: isShowing ? children : null
|
|
114
|
+
}
|
|
115
|
+
);
|
|
124
116
|
const isSheet = useShowDialogSheet(context);
|
|
125
117
|
if (isSheet) {
|
|
126
118
|
return children;
|
|
@@ -129,18 +121,7 @@ const DialogPortal = (props) => {
|
|
|
129
121
|
if (isFullyHidden) {
|
|
130
122
|
return null;
|
|
131
123
|
}
|
|
132
|
-
return /* @__PURE__ */ jsx(DialogPortalItem, {
|
|
133
|
-
__scopeDialog,
|
|
134
|
-
children: /* @__PURE__ */ jsx(PortalProvider, {
|
|
135
|
-
scope: __scopeDialog,
|
|
136
|
-
forceMount,
|
|
137
|
-
children: /* @__PURE__ */ jsx(DialogPortalFrame, {
|
|
138
|
-
pointerEvents: isShowing ? "auto" : "none",
|
|
139
|
-
...frameProps,
|
|
140
|
-
children: contents
|
|
141
|
-
})
|
|
142
|
-
})
|
|
143
|
-
});
|
|
124
|
+
return /* @__PURE__ */ jsx(DialogPortalItem, { __scopeDialog, children: /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: /* @__PURE__ */ jsx(DialogPortalFrame, { pointerEvents: isShowing ? "auto" : "none", ...frameProps, children: contents }) }) });
|
|
144
125
|
}
|
|
145
126
|
return contents;
|
|
146
127
|
};
|
|
@@ -162,23 +143,26 @@ const DialogOverlay = React.forwardRef(
|
|
|
162
143
|
return null;
|
|
163
144
|
}
|
|
164
145
|
}
|
|
165
|
-
return /* @__PURE__ */ jsx(DialogOverlayImpl, {
|
|
166
|
-
context,
|
|
167
|
-
...overlayProps,
|
|
168
|
-
ref: forwardedRef
|
|
169
|
-
});
|
|
146
|
+
return /* @__PURE__ */ jsx(DialogOverlayImpl, { context, ...overlayProps, ref: forwardedRef });
|
|
170
147
|
}
|
|
171
148
|
);
|
|
172
149
|
DialogOverlay.displayName = OVERLAY_NAME;
|
|
173
150
|
const DialogOverlayImpl = React.forwardRef(
|
|
174
151
|
(props, forwardedRef) => {
|
|
175
152
|
const { context, ...overlayProps } = props;
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
153
|
+
return (
|
|
154
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
155
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
156
|
+
/* @__PURE__ */ jsx(
|
|
157
|
+
DialogOverlayFrame,
|
|
158
|
+
{
|
|
159
|
+
"data-state": getState(context.open),
|
|
160
|
+
pointerEvents: context.open ? "auto" : "none",
|
|
161
|
+
...overlayProps,
|
|
162
|
+
ref: forwardedRef
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
);
|
|
182
166
|
}
|
|
183
167
|
);
|
|
184
168
|
const CONTENT_NAME = "DialogContent";
|
|
@@ -207,29 +191,21 @@ const DialogContent = DialogContentFrame.extractable(
|
|
|
207
191
|
const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog);
|
|
208
192
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
209
193
|
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
210
|
-
const contents = context.modal ? /* @__PURE__ */ jsx(DialogContentModal, {
|
|
211
|
-
context,
|
|
212
|
-
...contentProps,
|
|
213
|
-
ref: forwardedRef
|
|
214
|
-
}) : /* @__PURE__ */ jsx(DialogContentNonModal, {
|
|
215
|
-
context,
|
|
216
|
-
...contentProps,
|
|
217
|
-
ref: forwardedRef
|
|
218
|
-
});
|
|
194
|
+
const contents = context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { context, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { context, ...contentProps, ref: forwardedRef });
|
|
219
195
|
if (!isWeb) {
|
|
220
196
|
return contents;
|
|
221
197
|
}
|
|
222
|
-
return /* @__PURE__ */ jsx(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
children: contents
|
|
231
|
-
}
|
|
232
|
-
|
|
198
|
+
return /* @__PURE__ */ jsx(
|
|
199
|
+
RemoveScroll,
|
|
200
|
+
{
|
|
201
|
+
forwardProps: true,
|
|
202
|
+
enabled: context.open,
|
|
203
|
+
allowPinchZoom: context.allowPinchZoom,
|
|
204
|
+
shards: [context.contentRef],
|
|
205
|
+
removeScrollBar: false,
|
|
206
|
+
children: /* @__PURE__ */ jsx("div", { className: "_dsp_contents", children: contents })
|
|
207
|
+
}
|
|
208
|
+
);
|
|
233
209
|
}
|
|
234
210
|
)
|
|
235
211
|
);
|
|
@@ -247,67 +223,73 @@ const DialogContentModal = React.forwardRef(
|
|
|
247
223
|
return hideOthers(content);
|
|
248
224
|
}, [context.open]);
|
|
249
225
|
}
|
|
250
|
-
return /* @__PURE__ */ jsx(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
226
|
+
return /* @__PURE__ */ jsx(
|
|
227
|
+
DialogContentImpl,
|
|
228
|
+
{
|
|
229
|
+
...props,
|
|
230
|
+
context,
|
|
231
|
+
ref: composedRefs,
|
|
232
|
+
disableOutsidePointerEvents: true,
|
|
233
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
234
|
+
var _a;
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
237
|
+
}),
|
|
238
|
+
onPointerDownOutside: composeEventHandlers(
|
|
239
|
+
props.onPointerDownOutside,
|
|
240
|
+
(event) => {
|
|
241
|
+
const originalEvent = event["detail"].originalEvent;
|
|
242
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
243
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
244
|
+
if (isRightClick)
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
onFocusOutside: composeEventHandlers(
|
|
249
|
+
props.onFocusOutside,
|
|
250
|
+
(event) => event.preventDefault()
|
|
251
|
+
),
|
|
252
|
+
children
|
|
253
|
+
}
|
|
254
|
+
);
|
|
276
255
|
}
|
|
277
256
|
);
|
|
278
257
|
const DialogContentNonModal = React.forwardRef(
|
|
279
258
|
(props, forwardedRef) => {
|
|
280
259
|
const hasInteractedOutsideRef = React.useRef(false);
|
|
281
|
-
return /* @__PURE__ */ jsx(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
260
|
+
return /* @__PURE__ */ jsx(
|
|
261
|
+
DialogContentImpl,
|
|
262
|
+
{
|
|
263
|
+
...props,
|
|
264
|
+
ref: forwardedRef,
|
|
265
|
+
trapFocus: false,
|
|
266
|
+
disableOutsidePointerEvents: false,
|
|
267
|
+
onCloseAutoFocus: (event) => {
|
|
268
|
+
var _a, _b;
|
|
269
|
+
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
270
|
+
if (!event.defaultPrevented) {
|
|
271
|
+
if (!hasInteractedOutsideRef.current) {
|
|
272
|
+
(_b = props.context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
273
|
+
}
|
|
274
|
+
event.preventDefault();
|
|
292
275
|
}
|
|
293
|
-
|
|
276
|
+
hasInteractedOutsideRef.current = false;
|
|
277
|
+
},
|
|
278
|
+
onInteractOutside: (event) => {
|
|
279
|
+
var _a;
|
|
280
|
+
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
281
|
+
if (!event.defaultPrevented)
|
|
282
|
+
hasInteractedOutsideRef.current = true;
|
|
283
|
+
const target = event.target;
|
|
284
|
+
const trigger = props.context.triggerRef.current;
|
|
285
|
+
if (!(trigger instanceof HTMLElement))
|
|
286
|
+
return;
|
|
287
|
+
const targetIsTrigger = trigger.contains(target);
|
|
288
|
+
if (targetIsTrigger)
|
|
289
|
+
event.preventDefault();
|
|
294
290
|
}
|
|
295
|
-
hasInteractedOutsideRef.current = false;
|
|
296
|
-
},
|
|
297
|
-
onInteractOutside: (event) => {
|
|
298
|
-
var _a;
|
|
299
|
-
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
300
|
-
if (!event.defaultPrevented)
|
|
301
|
-
hasInteractedOutsideRef.current = true;
|
|
302
|
-
const target = event.target;
|
|
303
|
-
const trigger = props.context.triggerRef.current;
|
|
304
|
-
if (!(trigger instanceof HTMLElement))
|
|
305
|
-
return;
|
|
306
|
-
const targetIsTrigger = trigger.contains(target);
|
|
307
|
-
if (targetIsTrigger)
|
|
308
|
-
event.preventDefault();
|
|
309
291
|
}
|
|
310
|
-
|
|
292
|
+
);
|
|
311
293
|
}
|
|
312
294
|
);
|
|
313
295
|
const DialogContentImpl = React.forwardRef(
|
|
@@ -328,55 +310,58 @@ const DialogContentImpl = React.forwardRef(
|
|
|
328
310
|
const contentRef = React.useRef(null);
|
|
329
311
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
330
312
|
const showSheet = useShowDialogSheet(context);
|
|
331
|
-
const contents = /* @__PURE__ */ jsx(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
313
|
+
const contents = /* @__PURE__ */ jsx(
|
|
314
|
+
DialogContentFrame,
|
|
315
|
+
{
|
|
316
|
+
id: context.contentId,
|
|
317
|
+
"aria-describedby": context.descriptionId,
|
|
318
|
+
"aria-labelledby": context.titleId,
|
|
319
|
+
"data-state": getState(context.open),
|
|
320
|
+
...contentProps
|
|
321
|
+
}
|
|
322
|
+
);
|
|
338
323
|
if (showSheet) {
|
|
339
|
-
return /* @__PURE__ */ jsx(DialogPortalItem, {
|
|
340
|
-
hostName: getSheetContentsName(context),
|
|
341
|
-
children: contentProps.children
|
|
342
|
-
});
|
|
324
|
+
return /* @__PURE__ */ jsx(DialogPortalItem, { hostName: getSheetContentsName(context), children: contentProps.children });
|
|
343
325
|
}
|
|
344
326
|
if (!isWeb) {
|
|
345
327
|
return contents;
|
|
346
328
|
}
|
|
347
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
348
|
-
|
|
349
|
-
|
|
329
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
330
|
+
/* @__PURE__ */ jsx(
|
|
331
|
+
FocusScope,
|
|
332
|
+
{
|
|
350
333
|
loop: true,
|
|
351
334
|
trapped: trapFocus,
|
|
352
335
|
onMountAutoFocus: onOpenAutoFocus,
|
|
353
336
|
forceUnmount: !context.open,
|
|
354
337
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
355
|
-
children: /* @__PURE__ */ jsx(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
338
|
+
children: /* @__PURE__ */ jsx(
|
|
339
|
+
Dismissable,
|
|
340
|
+
{
|
|
341
|
+
disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
|
|
342
|
+
forceUnmount: !context.open,
|
|
343
|
+
onEscapeKeyDown,
|
|
344
|
+
onPointerDownOutside,
|
|
345
|
+
onFocusOutside,
|
|
346
|
+
onInteractOutside,
|
|
347
|
+
ref: composedRefs,
|
|
348
|
+
onDismiss: () => context.onOpenChange(false),
|
|
349
|
+
children: contents
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
355
|
+
/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
|
|
356
|
+
/* @__PURE__ */ jsx(
|
|
357
|
+
DescriptionWarning,
|
|
358
|
+
{
|
|
359
|
+
contentRef,
|
|
360
|
+
descriptionId: context.descriptionId
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
] })
|
|
364
|
+
] });
|
|
380
365
|
}
|
|
381
366
|
);
|
|
382
367
|
const TITLE_NAME = "DialogTitle";
|
|
@@ -387,11 +372,7 @@ const DialogTitle = React.forwardRef(
|
|
|
387
372
|
(props, forwardedRef) => {
|
|
388
373
|
const { __scopeDialog, ...titleProps } = props;
|
|
389
374
|
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
390
|
-
return /* @__PURE__ */ jsx(DialogTitleFrame, {
|
|
391
|
-
id: context.titleId,
|
|
392
|
-
...titleProps,
|
|
393
|
-
ref: forwardedRef
|
|
394
|
-
});
|
|
375
|
+
return /* @__PURE__ */ jsx(DialogTitleFrame, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
395
376
|
}
|
|
396
377
|
);
|
|
397
378
|
DialogTitle.displayName = TITLE_NAME;
|
|
@@ -403,11 +384,14 @@ const DialogDescription = React.forwardRef(
|
|
|
403
384
|
(props, forwardedRef) => {
|
|
404
385
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
405
386
|
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
406
|
-
return /* @__PURE__ */ jsx(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
387
|
+
return /* @__PURE__ */ jsx(
|
|
388
|
+
DialogDescriptionFrame,
|
|
389
|
+
{
|
|
390
|
+
id: context.descriptionId,
|
|
391
|
+
...descriptionProps,
|
|
392
|
+
ref: forwardedRef
|
|
393
|
+
}
|
|
394
|
+
);
|
|
411
395
|
}
|
|
412
396
|
);
|
|
413
397
|
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
@@ -420,15 +404,18 @@ const DialogClose = React.forwardRef(
|
|
|
420
404
|
if (isSheet && !displayWhenAdapted) {
|
|
421
405
|
return null;
|
|
422
406
|
}
|
|
423
|
-
return /* @__PURE__ */ jsx(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
407
|
+
return /* @__PURE__ */ jsx(
|
|
408
|
+
YStack,
|
|
409
|
+
{
|
|
410
|
+
tag: "button",
|
|
411
|
+
...closeProps,
|
|
412
|
+
ref: forwardedRef,
|
|
413
|
+
onPress: composeEventHandlers(
|
|
414
|
+
props.onPress,
|
|
415
|
+
() => context.onOpenChange(false)
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
);
|
|
432
419
|
}
|
|
433
420
|
);
|
|
434
421
|
DialogClose.displayName = CLOSE_NAME;
|
|
@@ -533,10 +520,7 @@ const Dialog = withStaticProperties(
|
|
|
533
520
|
const { when, AdaptProvider } = useAdaptParent({
|
|
534
521
|
Contents: React.useCallback(
|
|
535
522
|
(props2) => {
|
|
536
|
-
return /* @__PURE__ */ jsx(PortalHost, {
|
|
537
|
-
forwardProps: props2,
|
|
538
|
-
name: sheetContentsName
|
|
539
|
-
});
|
|
523
|
+
return /* @__PURE__ */ jsx(PortalHost, { forwardProps: props2, name: sheetContentsName });
|
|
540
524
|
},
|
|
541
525
|
[sheetContentsName]
|
|
542
526
|
)
|
|
@@ -548,17 +532,7 @@ const Dialog = withStaticProperties(
|
|
|
548
532
|
}),
|
|
549
533
|
[setOpen]
|
|
550
534
|
);
|
|
551
|
-
return /* @__PURE__ */ jsx(AdaptProvider, {
|
|
552
|
-
children: /* @__PURE__ */ jsx(DialogProvider, {
|
|
553
|
-
...context,
|
|
554
|
-
sheetBreakpoint: when,
|
|
555
|
-
children: /* @__PURE__ */ jsx(DialogSheetController, {
|
|
556
|
-
onOpenChange: setOpen,
|
|
557
|
-
__scopeDialog,
|
|
558
|
-
children
|
|
559
|
-
})
|
|
560
|
-
})
|
|
561
|
-
});
|
|
535
|
+
return /* @__PURE__ */ jsx(AdaptProvider, { children: /* @__PURE__ */ jsx(DialogProvider, { ...context, sheetBreakpoint: when, children: /* @__PURE__ */ jsx(DialogSheetController, { onOpenChange: setOpen, __scopeDialog, children }) }) });
|
|
562
536
|
}),
|
|
563
537
|
{
|
|
564
538
|
Trigger: DialogTrigger,
|
|
@@ -577,10 +551,7 @@ const DialogSheetContents = ({
|
|
|
577
551
|
name,
|
|
578
552
|
...props
|
|
579
553
|
}) => {
|
|
580
|
-
return /* @__PURE__ */ jsx(PortalHost, {
|
|
581
|
-
forwardProps: props,
|
|
582
|
-
name
|
|
583
|
-
});
|
|
554
|
+
return /* @__PURE__ */ jsx(PortalHost, { forwardProps: props, name });
|
|
584
555
|
};
|
|
585
556
|
DialogSheetContents.displayName = SHEET_CONTENTS_NAME;
|
|
586
557
|
const getSheetContentsName = ({
|
|
@@ -592,16 +563,19 @@ const DialogSheetController = (props) => {
|
|
|
592
563
|
const showSheet = useShowDialogSheet(context);
|
|
593
564
|
const breakpointActive = useSheetBreakpointActive(context);
|
|
594
565
|
const getShowSheet = useGet(showSheet);
|
|
595
|
-
return /* @__PURE__ */ jsx(
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
566
|
+
return /* @__PURE__ */ jsx(
|
|
567
|
+
SheetController,
|
|
568
|
+
{
|
|
569
|
+
onOpenChange: (val) => {
|
|
570
|
+
if (getShowSheet()) {
|
|
571
|
+
props.onOpenChange(val);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
open: context.open,
|
|
575
|
+
hidden: breakpointActive === false,
|
|
576
|
+
children: props.children
|
|
577
|
+
}
|
|
578
|
+
);
|
|
605
579
|
};
|
|
606
580
|
const useSheetBreakpointActive = (context) => {
|
|
607
581
|
const media = useMedia();
|