@tamagui/dialog 1.1.8 → 1.1.9
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/cjs/Dialog.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -66,16 +70,19 @@ const DialogTrigger = React.forwardRef(
|
|
|
66
70
|
const { __scopeDialog, ...triggerProps } = props;
|
|
67
71
|
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
68
72
|
const composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
|
|
69
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
DialogTriggerFrame,
|
|
75
|
+
{
|
|
76
|
+
tag: "button",
|
|
77
|
+
"aria-haspopup": "dialog",
|
|
78
|
+
"aria-expanded": context.open,
|
|
79
|
+
"aria-controls": context.contentId,
|
|
80
|
+
"data-state": getState(context.open),
|
|
81
|
+
...triggerProps,
|
|
82
|
+
ref: composedTriggerRef,
|
|
83
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
79
86
|
}
|
|
80
87
|
);
|
|
81
88
|
DialogTrigger.displayName = TRIGGER_NAME;
|
|
@@ -99,14 +106,7 @@ const DialogPortalFrame = (0, import_core.styled)(import_stacks.YStack, {
|
|
|
99
106
|
const DialogPortalItem = (props) => {
|
|
100
107
|
const themeName = (0, import_core.useThemeName)();
|
|
101
108
|
const context = useDialogContext(PORTAL_NAME, props.__scopeDialog);
|
|
102
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
|
|
103
|
-
hostName: props.hostName,
|
|
104
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItemContent, {
|
|
105
|
-
...props,
|
|
106
|
-
themeName,
|
|
107
|
-
context
|
|
108
|
-
})
|
|
109
|
-
});
|
|
109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { hostName: props.hostName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItemContent, { ...props, themeName, context }) });
|
|
110
110
|
};
|
|
111
111
|
function DialogPortalItemContent(props) {
|
|
112
112
|
const {
|
|
@@ -127,14 +127,7 @@ function DialogPortalItemContent(props) {
|
|
|
127
127
|
direction: spaceDirection
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogProvider, {
|
|
131
|
-
scope: __scopeDialog,
|
|
132
|
-
...context,
|
|
133
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, {
|
|
134
|
-
name: themeName,
|
|
135
|
-
children: childrenSpaced
|
|
136
|
-
})
|
|
137
|
-
});
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogProvider, { scope: __scopeDialog, ...context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { name: themeName, children: childrenSpaced }) });
|
|
138
131
|
}
|
|
139
132
|
const DialogPortal = (props) => {
|
|
140
133
|
const { __scopeDialog, forceMount, children, ...frameProps } = props;
|
|
@@ -144,12 +137,15 @@ const DialogPortal = (props) => {
|
|
|
144
137
|
if (isShowing && isFullyHidden) {
|
|
145
138
|
setIsFullyHidden(false);
|
|
146
139
|
}
|
|
147
|
-
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
import_animate_presence.AnimatePresence,
|
|
142
|
+
{
|
|
143
|
+
onExitComplete: () => {
|
|
144
|
+
setIsFullyHidden(true);
|
|
145
|
+
},
|
|
146
|
+
children: isShowing ? children : null
|
|
147
|
+
}
|
|
148
|
+
);
|
|
153
149
|
const isSheet = useShowDialogSheet(context);
|
|
154
150
|
if (isSheet) {
|
|
155
151
|
return children;
|
|
@@ -158,18 +154,7 @@ const DialogPortal = (props) => {
|
|
|
158
154
|
if (isFullyHidden) {
|
|
159
155
|
return null;
|
|
160
156
|
}
|
|
161
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItem, {
|
|
162
|
-
__scopeDialog,
|
|
163
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, {
|
|
164
|
-
scope: __scopeDialog,
|
|
165
|
-
forceMount,
|
|
166
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalFrame, {
|
|
167
|
-
pointerEvents: isShowing ? "auto" : "none",
|
|
168
|
-
...frameProps,
|
|
169
|
-
children: contents
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
});
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItem, { __scopeDialog, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeDialog, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalFrame, { pointerEvents: isShowing ? "auto" : "none", ...frameProps, children: contents }) }) });
|
|
173
158
|
}
|
|
174
159
|
return contents;
|
|
175
160
|
};
|
|
@@ -191,23 +176,26 @@ const DialogOverlay = React.forwardRef(
|
|
|
191
176
|
return null;
|
|
192
177
|
}
|
|
193
178
|
}
|
|
194
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlayImpl, {
|
|
195
|
-
context,
|
|
196
|
-
...overlayProps,
|
|
197
|
-
ref: forwardedRef
|
|
198
|
-
});
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlayImpl, { context, ...overlayProps, ref: forwardedRef });
|
|
199
180
|
}
|
|
200
181
|
);
|
|
201
182
|
DialogOverlay.displayName = OVERLAY_NAME;
|
|
202
183
|
const DialogOverlayImpl = React.forwardRef(
|
|
203
184
|
(props, forwardedRef) => {
|
|
204
185
|
const { context, ...overlayProps } = props;
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
186
|
+
return (
|
|
187
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
188
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
DialogOverlayFrame,
|
|
191
|
+
{
|
|
192
|
+
"data-state": getState(context.open),
|
|
193
|
+
pointerEvents: context.open ? "auto" : "none",
|
|
194
|
+
...overlayProps,
|
|
195
|
+
ref: forwardedRef
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
);
|
|
211
199
|
}
|
|
212
200
|
);
|
|
213
201
|
const CONTENT_NAME = "DialogContent";
|
|
@@ -236,29 +224,21 @@ const DialogContent = DialogContentFrame.extractable(
|
|
|
236
224
|
const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog);
|
|
237
225
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
238
226
|
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
239
|
-
const contents = context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentModal, {
|
|
240
|
-
context,
|
|
241
|
-
...contentProps,
|
|
242
|
-
ref: forwardedRef
|
|
243
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentNonModal, {
|
|
244
|
-
context,
|
|
245
|
-
...contentProps,
|
|
246
|
-
ref: forwardedRef
|
|
247
|
-
});
|
|
227
|
+
const contents = context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentModal, { context, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentNonModal, { context, ...contentProps, ref: forwardedRef });
|
|
248
228
|
if (!import_core.isWeb) {
|
|
249
229
|
return contents;
|
|
250
230
|
}
|
|
251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
children: contents
|
|
260
|
-
}
|
|
261
|
-
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
+
import_remove_scroll.RemoveScroll,
|
|
233
|
+
{
|
|
234
|
+
forwardProps: true,
|
|
235
|
+
enabled: context.open,
|
|
236
|
+
allowPinchZoom: context.allowPinchZoom,
|
|
237
|
+
shards: [context.contentRef],
|
|
238
|
+
removeScrollBar: false,
|
|
239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "_dsp_contents", children: contents })
|
|
240
|
+
}
|
|
241
|
+
);
|
|
262
242
|
}
|
|
263
243
|
)
|
|
264
244
|
);
|
|
@@ -276,67 +256,73 @@ const DialogContentModal = React.forwardRef(
|
|
|
276
256
|
return (0, import_aria_hidden.hideOthers)(content);
|
|
277
257
|
}, [context.open]);
|
|
278
258
|
}
|
|
279
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
260
|
+
DialogContentImpl,
|
|
261
|
+
{
|
|
262
|
+
...props,
|
|
263
|
+
context,
|
|
264
|
+
ref: composedRefs,
|
|
265
|
+
disableOutsidePointerEvents: true,
|
|
266
|
+
onCloseAutoFocus: (0, import_core.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
|
|
267
|
+
var _a;
|
|
268
|
+
event.preventDefault();
|
|
269
|
+
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
270
|
+
}),
|
|
271
|
+
onPointerDownOutside: (0, import_core.composeEventHandlers)(
|
|
272
|
+
props.onPointerDownOutside,
|
|
273
|
+
(event) => {
|
|
274
|
+
const originalEvent = event["detail"].originalEvent;
|
|
275
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
276
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
277
|
+
if (isRightClick)
|
|
278
|
+
event.preventDefault();
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
onFocusOutside: (0, import_core.composeEventHandlers)(
|
|
282
|
+
props.onFocusOutside,
|
|
283
|
+
(event) => event.preventDefault()
|
|
284
|
+
),
|
|
285
|
+
children
|
|
286
|
+
}
|
|
287
|
+
);
|
|
305
288
|
}
|
|
306
289
|
);
|
|
307
290
|
const DialogContentNonModal = React.forwardRef(
|
|
308
291
|
(props, forwardedRef) => {
|
|
309
292
|
const hasInteractedOutsideRef = React.useRef(false);
|
|
310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
294
|
+
DialogContentImpl,
|
|
295
|
+
{
|
|
296
|
+
...props,
|
|
297
|
+
ref: forwardedRef,
|
|
298
|
+
trapFocus: false,
|
|
299
|
+
disableOutsidePointerEvents: false,
|
|
300
|
+
onCloseAutoFocus: (event) => {
|
|
301
|
+
var _a, _b;
|
|
302
|
+
(_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
|
|
303
|
+
if (!event.defaultPrevented) {
|
|
304
|
+
if (!hasInteractedOutsideRef.current) {
|
|
305
|
+
(_b = props.context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
306
|
+
}
|
|
307
|
+
event.preventDefault();
|
|
321
308
|
}
|
|
322
|
-
|
|
309
|
+
hasInteractedOutsideRef.current = false;
|
|
310
|
+
},
|
|
311
|
+
onInteractOutside: (event) => {
|
|
312
|
+
var _a;
|
|
313
|
+
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
314
|
+
if (!event.defaultPrevented)
|
|
315
|
+
hasInteractedOutsideRef.current = true;
|
|
316
|
+
const target = event.target;
|
|
317
|
+
const trigger = props.context.triggerRef.current;
|
|
318
|
+
if (!(trigger instanceof HTMLElement))
|
|
319
|
+
return;
|
|
320
|
+
const targetIsTrigger = trigger.contains(target);
|
|
321
|
+
if (targetIsTrigger)
|
|
322
|
+
event.preventDefault();
|
|
323
323
|
}
|
|
324
|
-
hasInteractedOutsideRef.current = false;
|
|
325
|
-
},
|
|
326
|
-
onInteractOutside: (event) => {
|
|
327
|
-
var _a;
|
|
328
|
-
(_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
|
|
329
|
-
if (!event.defaultPrevented)
|
|
330
|
-
hasInteractedOutsideRef.current = true;
|
|
331
|
-
const target = event.target;
|
|
332
|
-
const trigger = props.context.triggerRef.current;
|
|
333
|
-
if (!(trigger instanceof HTMLElement))
|
|
334
|
-
return;
|
|
335
|
-
const targetIsTrigger = trigger.contains(target);
|
|
336
|
-
if (targetIsTrigger)
|
|
337
|
-
event.preventDefault();
|
|
338
324
|
}
|
|
339
|
-
|
|
325
|
+
);
|
|
340
326
|
}
|
|
341
327
|
);
|
|
342
328
|
const DialogContentImpl = React.forwardRef(
|
|
@@ -357,55 +343,58 @@ const DialogContentImpl = React.forwardRef(
|
|
|
357
343
|
const contentRef = React.useRef(null);
|
|
358
344
|
const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
|
|
359
345
|
const showSheet = useShowDialogSheet(context);
|
|
360
|
-
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
346
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
347
|
+
DialogContentFrame,
|
|
348
|
+
{
|
|
349
|
+
id: context.contentId,
|
|
350
|
+
"aria-describedby": context.descriptionId,
|
|
351
|
+
"aria-labelledby": context.titleId,
|
|
352
|
+
"data-state": getState(context.open),
|
|
353
|
+
...contentProps
|
|
354
|
+
}
|
|
355
|
+
);
|
|
367
356
|
if (showSheet) {
|
|
368
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItem, {
|
|
369
|
-
hostName: getSheetContentsName(context),
|
|
370
|
-
children: contentProps.children
|
|
371
|
-
});
|
|
357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortalItem, { hostName: getSheetContentsName(context), children: contentProps.children });
|
|
372
358
|
}
|
|
373
359
|
if (!import_core.isWeb) {
|
|
374
360
|
return contents;
|
|
375
361
|
}
|
|
376
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
377
|
-
|
|
378
|
-
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
363
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
364
|
+
import_focus_scope.FocusScope,
|
|
365
|
+
{
|
|
379
366
|
loop: true,
|
|
380
367
|
trapped: trapFocus,
|
|
381
368
|
onMountAutoFocus: onOpenAutoFocus,
|
|
382
369
|
forceUnmount: !context.open,
|
|
383
370
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
384
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
372
|
+
import_dismissable.Dismissable,
|
|
373
|
+
{
|
|
374
|
+
disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
|
|
375
|
+
forceUnmount: !context.open,
|
|
376
|
+
onEscapeKeyDown,
|
|
377
|
+
onPointerDownOutside,
|
|
378
|
+
onFocusOutside,
|
|
379
|
+
onInteractOutside,
|
|
380
|
+
ref: composedRefs,
|
|
381
|
+
onDismiss: () => context.onOpenChange(false),
|
|
382
|
+
children: contents
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
process.env.NODE_ENV === "development" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TitleWarning, { titleId: context.titleId }),
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
390
|
+
DescriptionWarning,
|
|
391
|
+
{
|
|
392
|
+
contentRef,
|
|
393
|
+
descriptionId: context.descriptionId
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
] })
|
|
397
|
+
] });
|
|
409
398
|
}
|
|
410
399
|
);
|
|
411
400
|
const TITLE_NAME = "DialogTitle";
|
|
@@ -416,11 +405,7 @@ const DialogTitle = React.forwardRef(
|
|
|
416
405
|
(props, forwardedRef) => {
|
|
417
406
|
const { __scopeDialog, ...titleProps } = props;
|
|
418
407
|
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
419
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitleFrame, {
|
|
420
|
-
id: context.titleId,
|
|
421
|
-
...titleProps,
|
|
422
|
-
ref: forwardedRef
|
|
423
|
-
});
|
|
408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitleFrame, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
424
409
|
}
|
|
425
410
|
);
|
|
426
411
|
DialogTitle.displayName = TITLE_NAME;
|
|
@@ -432,11 +417,14 @@ const DialogDescription = React.forwardRef(
|
|
|
432
417
|
(props, forwardedRef) => {
|
|
433
418
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
434
419
|
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
435
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
421
|
+
DialogDescriptionFrame,
|
|
422
|
+
{
|
|
423
|
+
id: context.descriptionId,
|
|
424
|
+
...descriptionProps,
|
|
425
|
+
ref: forwardedRef
|
|
426
|
+
}
|
|
427
|
+
);
|
|
440
428
|
}
|
|
441
429
|
);
|
|
442
430
|
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
@@ -449,15 +437,18 @@ const DialogClose = React.forwardRef(
|
|
|
449
437
|
if (isSheet && !displayWhenAdapted) {
|
|
450
438
|
return null;
|
|
451
439
|
}
|
|
452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
(
|
|
459
|
-
|
|
460
|
-
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
441
|
+
import_stacks.YStack,
|
|
442
|
+
{
|
|
443
|
+
tag: "button",
|
|
444
|
+
...closeProps,
|
|
445
|
+
ref: forwardedRef,
|
|
446
|
+
onPress: (0, import_core.composeEventHandlers)(
|
|
447
|
+
props.onPress,
|
|
448
|
+
() => context.onOpenChange(false)
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
);
|
|
461
452
|
}
|
|
462
453
|
);
|
|
463
454
|
DialogClose.displayName = CLOSE_NAME;
|
|
@@ -562,10 +553,7 @@ const Dialog = (0, import_core.withStaticProperties)(
|
|
|
562
553
|
const { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
563
554
|
Contents: React.useCallback(
|
|
564
555
|
(props2) => {
|
|
565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
|
|
566
|
-
forwardProps: props2,
|
|
567
|
-
name: sheetContentsName
|
|
568
|
-
});
|
|
556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { forwardProps: props2, name: sheetContentsName });
|
|
569
557
|
},
|
|
570
558
|
[sheetContentsName]
|
|
571
559
|
)
|
|
@@ -577,17 +565,7 @@ const Dialog = (0, import_core.withStaticProperties)(
|
|
|
577
565
|
}),
|
|
578
566
|
[setOpen]
|
|
579
567
|
);
|
|
580
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, {
|
|
581
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogProvider, {
|
|
582
|
-
...context,
|
|
583
|
-
sheetBreakpoint: when,
|
|
584
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogSheetController, {
|
|
585
|
-
onOpenChange: setOpen,
|
|
586
|
-
__scopeDialog,
|
|
587
|
-
children
|
|
588
|
-
})
|
|
589
|
-
})
|
|
590
|
-
});
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogProvider, { ...context, sheetBreakpoint: when, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogSheetController, { onOpenChange: setOpen, __scopeDialog, children }) }) });
|
|
591
569
|
}),
|
|
592
570
|
{
|
|
593
571
|
Trigger: DialogTrigger,
|
|
@@ -606,10 +584,7 @@ const DialogSheetContents = ({
|
|
|
606
584
|
name,
|
|
607
585
|
...props
|
|
608
586
|
}) => {
|
|
609
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
|
|
610
|
-
forwardProps: props,
|
|
611
|
-
name
|
|
612
|
-
});
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { forwardProps: props, name });
|
|
613
588
|
};
|
|
614
589
|
DialogSheetContents.displayName = SHEET_CONTENTS_NAME;
|
|
615
590
|
const getSheetContentsName = ({
|
|
@@ -621,16 +596,19 @@ const DialogSheetController = (props) => {
|
|
|
621
596
|
const showSheet = useShowDialogSheet(context);
|
|
622
597
|
const breakpointActive = useSheetBreakpointActive(context);
|
|
623
598
|
const getShowSheet = (0, import_core.useGet)(showSheet);
|
|
624
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
600
|
+
import_sheet.SheetController,
|
|
601
|
+
{
|
|
602
|
+
onOpenChange: (val) => {
|
|
603
|
+
if (getShowSheet()) {
|
|
604
|
+
props.onOpenChange(val);
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
open: context.open,
|
|
608
|
+
hidden: breakpointActive === false,
|
|
609
|
+
children: props.children
|
|
610
|
+
}
|
|
611
|
+
);
|
|
634
612
|
};
|
|
635
613
|
const useSheetBreakpointActive = (context) => {
|
|
636
614
|
const media = (0, import_core.useMedia)();
|