@tamagui/dialog 2.7.7 → 3.0.0-beta.643.1

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.
@@ -2,653 +2,605 @@ import { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptC
2
2
  import { Animate } from "@tamagui/animate";
3
3
  import { composeRefs, useComposedRefs } from "@tamagui/compose-refs";
4
4
  import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
5
- import { createStyledContext, getExpandedShorthand, LayoutMeasurementController, styled, Theme, useThemeName, View } from "@tamagui/core";
5
+ import { LayoutMeasurementController, Theme, View, createRefComponent, createStyledContext, createStyledHOC, getExpandedShorthand, styled, useThemeName } from "@tamagui/core";
6
6
  import { createContext } from "@tamagui/create-context";
7
7
  import { Dismissable } from "@tamagui/dismissable";
8
8
  import { FocusScope, FocusScopeController } from "@tamagui/focus-scope";
9
9
  import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
10
- import { needsPortalRepropagation, Portal, PortalItem, resolveViewZIndex } from "@tamagui/portal";
10
+ import { Portal, PortalItem, needsPortalRepropagation, resolveViewZIndex } from "@tamagui/portal";
11
11
  import { RemoveScroll } from "@tamagui/remove-scroll";
12
- import { SheetController } from "@tamagui/sheet/controller";
13
- import { ButtonNestingContext, ThemeableStack, YStack } from "@tamagui/stacks";
12
+ import { ButtonNestingContext, YStack } from "@tamagui/stacks";
14
13
  import { H2, Paragraph } from "@tamagui/text";
15
14
  import { useControllableState } from "@tamagui/use-controllable-state";
16
15
  import { StackZIndexContext } from "@tamagui/z-index-stack";
17
16
  import * as React from "react";
18
17
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
- const DialogContext = createStyledContext(
20
- // since we always provide this we can avoid setting here
21
- {}, "Dialog__");
22
- const {
23
- useStyledContext: useDialogContext,
24
- Provider: DialogProvider
25
- } = DialogContext;
26
- const DialogAdaptHiddenContext = React.createContext(true);
27
- const DialogTriggerFrame = styled(View, {
28
- name: "DialogTrigger"
29
- });
30
- const DialogTrigger = DialogTriggerFrame.styleable(function DialogTrigger2(props, forwardedRef) {
31
- const {
32
- scope,
33
- ...triggerProps
34
- } = props;
35
- const isInsideButton = React.useContext(ButtonNestingContext);
36
- const context = useDialogContext(scope);
37
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
38
- return /* @__PURE__ */jsx(ButtonNestingContext.Provider, {
39
- value: true,
40
- children: /* @__PURE__ */jsx(DialogTriggerFrame, {
41
- render: isInsideButton ? "span" : "button",
42
- "aria-haspopup": "dialog",
43
- "aria-expanded": context.open,
44
- "aria-controls": context.contentId,
45
- "data-state": getState(context.open),
46
- ...triggerProps,
47
- ref: composedTriggerRef,
48
- onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
49
- })
50
- });
18
+
19
+ const DialogContext = createStyledContext({}, "Dialog__");
20
+ const { useStyledContext: useDialogContext, Provider: DialogProvider } = DialogContext;
21
+ const DialogTriggerFrame = styled(View, { displayName: "DialogTrigger" });
22
+ const DialogTrigger = createStyledHOC(DialogTriggerFrame, function DialogTrigger2(props, forwardedRef) {
23
+ const { scope, ...triggerProps } = props;
24
+ const isInsideButton = React.useContext(ButtonNestingContext);
25
+ const context = useDialogContext(scope);
26
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
27
+ return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, {
28
+ value: props.asChild ? isInsideButton : true,
29
+ children: /* @__PURE__ */ jsx(DialogTriggerFrame, {
30
+ render: isInsideButton ? "span" : "button",
31
+ "aria-haspopup": "dialog",
32
+ "aria-expanded": context.open,
33
+ "aria-controls": context.contentId,
34
+ "data-state": getState(context.open),
35
+ ...triggerProps,
36
+ ref: composedTriggerRef,
37
+ onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
38
+ })
39
+ });
51
40
  });
52
41
  const DialogPortalFrame = styled(YStack, {
53
- pointerEvents: "none",
54
- render: "dialog",
55
- variants: {
56
- unstyled: {
57
- false: {
58
- alignItems: "center",
59
- justifyContent: "center",
60
- fullscreen: true,
61
- "$platform-web": {
62
- // undo dialog styles
63
- borderWidth: 0,
64
- backgroundColor: "transparent",
65
- color: "inherit",
66
- maxInlineSize: "none",
67
- margin: 0,
68
- width: "auto",
69
- height: "auto",
70
- // ensure always in frame and right height
71
- maxHeight: "100vh",
72
- position: "fixed",
73
- // ensure dialog inherits stacking context from portal wrapper
74
- zIndex: 1
75
- }
76
- }
77
- }
78
- },
79
- defaultVariants: {
80
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
81
- }
42
+ pointerEvents: "none",
43
+ alignItems: "center",
44
+ justifyContent: "center",
45
+ position: "absolute web:fixed",
46
+ inset: 0,
47
+ borderWidth: "web:0px",
48
+ backgroundColor: "web:transparent",
49
+ color: "web:inherit",
50
+ maxInlineSize: "web:none",
51
+ margin: "web:0px",
52
+ width: "web:auto",
53
+ height: "web:auto",
54
+ maxHeight: "web:100vh",
55
+ zIndex: "web:1",
56
+ render: "dialog"
82
57
  });
83
58
  const needsRepropagation = needsPortalRepropagation();
84
- const DialogPortalItem = ({
85
- context,
86
- children
87
- }) => {
88
- const themeName = useThemeName();
89
- const isAdapted = useAdaptIsActive(context.adaptScope);
90
- const adaptContext = useAdaptContext(context.adaptScope);
91
- let content = /* @__PURE__ */jsx(Theme, {
92
- name: themeName,
93
- children
94
- });
95
- if (needsRepropagation) {
96
- content = /* @__PURE__ */jsx(ProvideAdaptContext, {
97
- ...adaptContext,
98
- children: /* @__PURE__ */jsx(DialogProvider, {
99
- ...context,
100
- children: content
101
- })
102
- });
103
- }
104
- return isAdapted ? /* @__PURE__ */jsx(AdaptPortalContents, {
105
- scope: context.adaptScope,
106
- children: content
107
- }) : context.modal ? /* @__PURE__ */jsx(PortalItem, {
108
- hostName: context.modal ? "root" : context.adaptScope,
109
- children: content
110
- }) : content;
59
+ const DialogPortalItem = ({ context, children }) => {
60
+ const themeName = useThemeName();
61
+ const isAdapted = useAdaptIsActive(context.adaptScope);
62
+ const adaptContext = useAdaptContext(context.adaptScope);
63
+ let content = /* @__PURE__ */ jsx(Theme, {
64
+ name: themeName,
65
+ children
66
+ });
67
+ if (needsRepropagation) {
68
+ content = /* @__PURE__ */ jsx(ProvideAdaptContext, {
69
+ ...adaptContext,
70
+ children: /* @__PURE__ */ jsx(DialogProvider, {
71
+ ...context,
72
+ children: content
73
+ })
74
+ });
75
+ }
76
+ return isAdapted ? /* @__PURE__ */ jsx(AdaptPortalContents, {
77
+ scope: context.adaptScope,
78
+ children: content
79
+ }) : context.modal ? /* @__PURE__ */ jsx(PortalItem, {
80
+ hostName: "root",
81
+ children: content
82
+ }) : content;
111
83
  };
112
- const DialogPortal = React.forwardRef((props, forwardRef) => {
113
- const {
114
- scope,
115
- forceMount,
116
- children,
117
- ...frameProps
118
- } = props;
119
- const dialogRef = React.useRef(null);
120
- const ref = composeRefs(dialogRef, forwardRef);
121
- const context = useDialogContext(scope);
122
- const keepMounted = forceMount || context.keepChildrenMounted;
123
- const isAdapted = useAdaptIsActive(context.adaptScope);
124
- const [isFullyHidden, setIsFullyHidden] = React.useState(!context.open);
125
- if (context.open && isFullyHidden) {
126
- setIsFullyHidden(false);
127
- }
128
- const isVisible = context.open ? true : !isFullyHidden;
129
- if (isWeb) {
130
- useIsomorphicLayoutEffect(() => {
131
- const node = dialogRef.current;
132
- if (!(node instanceof HTMLDialogElement)) return;
133
- if (isVisible) {
134
- node.show?.();
135
- } else {
136
- node.close?.();
137
- }
138
- }, [isVisible]);
139
- }
140
- const onAnimationCompleteRef = React.useRef(context.onAnimationComplete);
141
- onAnimationCompleteRef.current = context.onAnimationComplete;
142
- const handleExitComplete = React.useCallback(() => {
143
- setIsFullyHidden(true);
144
- onAnimationCompleteRef.current?.({
145
- open: false
146
- });
147
- }, []);
148
- React.useEffect(() => {
149
- if (context.open && !isAdapted && onAnimationCompleteRef.current) {
150
- const tm = setTimeout(() => {
151
- onAnimationCompleteRef.current?.({
152
- open: true
153
- });
154
- }, 350);
155
- return () => clearTimeout(tm);
156
- }
157
- }, [context.open, isAdapted]);
158
- const zIndex = getExpandedShorthand("zIndex", props);
159
- const contents = /* @__PURE__ */jsx(StackZIndexContext, {
160
- zIndex: resolveViewZIndex(zIndex),
161
- children: /* @__PURE__ */jsx(Animate, {
162
- type: "presence",
163
- present: Boolean(context.open),
164
- keepChildrenMounted: Boolean(keepMounted),
165
- onExitComplete: handleExitComplete,
166
- passThrough: isAdapted,
167
- children
168
- })
169
- });
170
- const framedContents = isFullyHidden && !keepMounted && !isAdapted ? null : /* @__PURE__ */jsx(LayoutMeasurementController, {
171
- disable: !context.open,
172
- children: /* @__PURE__ */jsx(DialogPortalFrame, {
173
- ref,
174
- ...(isWeb && context.open && {
175
- "aria-modal": true
176
- }),
177
- pointerEvents: context.open ? "auto" : "none",
178
- ...frameProps,
179
- className: `_no_backdrop ` + (frameProps.className || ""),
180
- children: contents
181
- })
182
- });
183
- if (isWeb) {
184
- return /* @__PURE__ */jsx(Portal, {
185
- zIndex,
186
- stackZIndex: 1e5,
187
- passThrough: isAdapted,
188
- children: /* @__PURE__ */jsx(PassthroughTheme, {
189
- passThrough: isAdapted,
190
- children: framedContents
191
- })
192
- });
193
- }
194
- return isAdapted ? framedContents : /* @__PURE__ */jsx(DialogPortalItem, {
195
- context,
196
- children: framedContents
197
- });
84
+ const DialogPortal = createRefComponent((props, forwardedRef) => {
85
+ const { scope, forceMount, children, ...frameProps } = props;
86
+ const dialogRef = React.useRef(null);
87
+ const ref = composeRefs(dialogRef, forwardedRef);
88
+ const context = useDialogContext(scope);
89
+ const portalContext = forceMount ? {
90
+ ...context,
91
+ forceMount: true
92
+ } : context;
93
+ const keepMounted = forceMount || context.keepChildrenMounted;
94
+ const isAdapted = useAdaptIsActive(context.adaptScope);
95
+ const isVisible = context.open || context.hasPresentParts;
96
+ if (isWeb) {
97
+ useIsomorphicLayoutEffect(() => {
98
+ const node = dialogRef.current;
99
+ if (!(node instanceof HTMLDialogElement)) return;
100
+ if (isVisible) {
101
+ node.show?.();
102
+ } else {
103
+ node.close?.();
104
+ }
105
+ }, [isVisible]);
106
+ }
107
+ const zIndex = getExpandedShorthand("zIndex", props);
108
+ const contents = /* @__PURE__ */ jsx(StackZIndexContext, {
109
+ zIndex: resolveViewZIndex(zIndex),
110
+ children: /* @__PURE__ */ jsx(DialogProvider, {
111
+ scope: context.dialogScope,
112
+ ...portalContext,
113
+ children
114
+ })
115
+ });
116
+ const framedContents = !isVisible && !keepMounted && !isAdapted ? null : /* @__PURE__ */ jsx(LayoutMeasurementController, {
117
+ disable: !context.open,
118
+ children: /* @__PURE__ */ jsx(DialogPortalFrame, {
119
+ ref,
120
+ ...isWeb && context.open && context.modal && { "aria-modal": true },
121
+ pointerEvents: context.open && context.modal ? "auto" : "none",
122
+ ...frameProps,
123
+ className: `_no_backdrop ` + (frameProps.className || ""),
124
+ children: contents
125
+ })
126
+ });
127
+ if (isWeb) {
128
+ return /* @__PURE__ */ jsx(Portal, {
129
+ zIndex,
130
+ stackZIndex: 1e5,
131
+ passThrough: isAdapted,
132
+ hidden: !isVisible,
133
+ children: /* @__PURE__ */ jsx(PassthroughTheme, {
134
+ passThrough: isAdapted,
135
+ children: framedContents
136
+ })
137
+ });
138
+ }
139
+ return isAdapted ? framedContents : /* @__PURE__ */ jsx(DialogPortalItem, {
140
+ context: portalContext,
141
+ children: framedContents
142
+ });
198
143
  });
199
- const PassthroughTheme = ({
200
- children,
201
- passThrough
202
- }) => {
203
- const themeName = useThemeName();
204
- return /* @__PURE__ */jsx(Theme, {
205
- passThrough,
206
- name: themeName,
207
- forceClassName: true,
208
- children
209
- });
144
+ const PassthroughTheme = ({ children, passThrough }) => {
145
+ const themeName = useThemeName();
146
+ return /* @__PURE__ */ jsx(Theme, {
147
+ passThrough,
148
+ name: themeName,
149
+ forceClassName: true,
150
+ children
151
+ });
210
152
  };
153
+ function useDialogAnimationReporter(context) {
154
+ const onAnimationCompleteRef = React.useRef(context.onAnimationComplete);
155
+ onAnimationCompleteRef.current = context.onAnimationComplete;
156
+ const openRef = React.useRef(context.open);
157
+ const pendingTransitionRef = React.useRef(context.open ? true : null);
158
+ if (openRef.current !== context.open) {
159
+ openRef.current = context.open;
160
+ pendingTransitionRef.current = context.open;
161
+ }
162
+ const reportComplete = React.useCallback((open) => {
163
+ if (pendingTransitionRef.current !== open) return;
164
+ if (openRef.current !== open) return;
165
+ pendingTransitionRef.current = null;
166
+ onAnimationCompleteRef.current?.({ open });
167
+ }, []);
168
+ return React.useMemo(() => ({
169
+ onEnterComplete: () => reportComplete(true),
170
+ onExitComplete: () => reportComplete(false)
171
+ }), [reportComplete]);
172
+ }
173
+ function useDialogPartPresence(context, options) {
174
+ const [isFullyHidden, setIsFullyHidden] = React.useState(!context.open);
175
+ const reactId = React.useId();
176
+ const partPresenceId = `${context.contentId}-${options.id}-${reactId}`;
177
+ const keepMounted = options.forceMount || context.keepChildrenMounted;
178
+ const isPresent = context.open || !isFullyHidden;
179
+ useIsomorphicLayoutEffect(() => {
180
+ if (context.open && isFullyHidden) {
181
+ setIsFullyHidden(false);
182
+ }
183
+ }, [context.open, isFullyHidden]);
184
+ useIsomorphicLayoutEffect(() => {
185
+ if (options.disabled) return;
186
+ context.setPartPresence(partPresenceId, isPresent);
187
+ return () => {
188
+ context.setPartPresence(partPresenceId, false);
189
+ };
190
+ }, [
191
+ context.setPartPresence,
192
+ isPresent,
193
+ options.disabled,
194
+ partPresenceId
195
+ ]);
196
+ const onExitComplete = React.useCallback(() => {
197
+ setIsFullyHidden(true);
198
+ options.onExitComplete?.();
199
+ }, [options.onExitComplete]);
200
+ return {
201
+ keepMounted,
202
+ onExitComplete,
203
+ shouldRender: Boolean(keepMounted || context.open || !isFullyHidden)
204
+ };
205
+ }
211
206
  const OVERLAY_NAME = "DialogOverlay";
212
207
  const DialogOverlayFrame = styled(YStack, {
213
- name: OVERLAY_NAME,
214
- zIndex: 1,
215
- variants: {
216
- open: {
217
- true: {
218
- pointerEvents: "auto"
219
- },
220
- false: {
221
- pointerEvents: "none"
222
- }
223
- },
224
- unstyled: {
225
- false: {
226
- fullscreen: true,
227
- position: "absolute",
228
- backgroundColor: "$background",
229
- pointerEvents: "auto"
230
- }
231
- }
232
- },
233
- defaultVariants: {
234
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
235
- }
208
+ displayName: OVERLAY_NAME,
209
+ zIndex: 1,
210
+ inset: 0,
211
+ position: "absolute",
212
+ pointerEvents: "auto",
213
+ variants: { open: {
214
+ true: { pointerEvents: "auto" },
215
+ false: { pointerEvents: "none" }
216
+ } }
236
217
  });
237
- const DialogOverlay = DialogOverlayFrame.styleable(function DialogOverlay2({
238
- scope,
239
- ...props
240
- }, forwardedRef) {
241
- const context = useDialogContext(scope);
242
- const {
243
- forceMount = context.forceMount,
244
- ...overlayProps
245
- } = props;
246
- const isAdapted = useAdaptIsActive(context.adaptScope);
247
- if (!forceMount) {
248
- if (!context.modal || isAdapted) {
249
- return null;
250
- }
251
- }
252
- return /* @__PURE__ */jsx(DialogOverlayFrame, {
253
- "data-state": getState(context.open),
254
- pointerEvents: context.open ? "auto" : "none",
255
- ...overlayProps,
256
- ref: forwardedRef
257
- });
218
+ const DialogOverlay = createStyledHOC(DialogOverlayFrame, function DialogOverlay2({ scope, ...props }, forwardedRef) {
219
+ const context = useDialogContext(scope);
220
+ const { forceMount = context.forceMount, ...overlayProps } = props;
221
+ const isAdapted = useAdaptIsActive(context.adaptScope);
222
+ const presence = useDialogPartPresence(context, {
223
+ disabled: isAdapted,
224
+ forceMount,
225
+ id: "overlay"
226
+ });
227
+ if (!forceMount && isAdapted) {
228
+ return null;
229
+ }
230
+ if (!presence.shouldRender) {
231
+ return null;
232
+ }
233
+ return /* @__PURE__ */ jsx(Animate, {
234
+ type: "presence",
235
+ present: Boolean(context.open),
236
+ keepChildrenMounted: Boolean(presence.keepMounted),
237
+ onExitComplete: presence.onExitComplete,
238
+ passThrough: isAdapted,
239
+ children: /* @__PURE__ */ jsx(DialogOverlayFrame, {
240
+ "data-state": getState(context.open),
241
+ pointerEvents: context.open && context.modal ? "auto exit:none" : "none",
242
+ ...overlayProps,
243
+ ref: forwardedRef
244
+ }, `${context.contentId}-overlay`)
245
+ });
258
246
  });
259
247
  const CONTENT_NAME = "DialogContent";
260
- const DialogContentFrame = styled(ThemeableStack, {
261
- name: CONTENT_NAME,
262
- zIndex: 2,
263
- variants: {
264
- size: {
265
- "...size": (val, extras) => {
266
- return {};
267
- }
268
- },
269
- unstyled: {
270
- false: {
271
- position: "relative",
272
- backgroundColor: "$background",
273
- borderWidth: 1,
274
- borderColor: "$borderColor",
275
- padding: "$true",
276
- borderRadius: "$true",
277
- elevate: true,
278
- // Ensure content receives pointer events (fixes React 19 + display:contents inheritance)
279
- pointerEvents: "auto"
280
- }
281
- }
282
- },
283
- defaultVariants: {
284
- size: "$true",
285
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
286
- }
248
+ const DialogContentFrame = styled(YStack, {
249
+ displayName: CONTENT_NAME,
250
+ zIndex: 2,
251
+ position: "relative",
252
+ pointerEvents: "auto",
253
+ variants: {
254
+ elevate: { true: {
255
+ shadowColor: "shadow-color",
256
+ shadowRadius: 24,
257
+ shadowOffset: {
258
+ width: 0,
259
+ height: 12
260
+ }
261
+ } },
262
+ bordered: { true: {
263
+ borderWidth: 1,
264
+ borderColor: "border-color"
265
+ } }
266
+ }
287
267
  });
288
- const DialogContent = DialogContentFrame.styleable(function DialogContent2({
289
- scope,
290
- ...props
291
- }, forwardedRef) {
292
- const context = useDialogContext(scope);
293
- const contents = /* @__PURE__ */jsx(Fragment, {
294
- children: context.modal ? /* @__PURE__ */jsx(DialogContentModal, {
295
- context,
296
- ...props,
297
- ref: forwardedRef
298
- }) : /* @__PURE__ */jsx(DialogContentNonModal, {
299
- context,
300
- ...props,
301
- ref: forwardedRef
302
- })
303
- });
304
- if (!isWeb || context.disableRemoveScroll) {
305
- return contents;
306
- }
307
- return /* @__PURE__ */jsx(RemoveScroll, {
308
- enabled: context.open,
309
- children: /* @__PURE__ */jsx("div", {
310
- "data-remove-scroll-container": true,
311
- className: "_dsp_contents",
312
- children: contents
313
- })
314
- });
268
+ const DialogContent = createStyledHOC(DialogContentFrame, function DialogContent2({ scope, ...props }, forwardedRef) {
269
+ const context = useDialogContext(scope);
270
+ const isAdapted = useAdaptIsActive(context.adaptScope);
271
+ const reporter = useDialogAnimationReporter(context);
272
+ const onTransitionProp = props.onTransition;
273
+ const onTransition = React.useCallback((event) => {
274
+ if (event.phase === "end" && event.cause === "enter") {
275
+ reporter.onEnterComplete();
276
+ }
277
+ onTransitionProp?.(event);
278
+ }, [reporter.onEnterComplete, onTransitionProp]);
279
+ const presence = useDialogPartPresence(context, {
280
+ disabled: isAdapted,
281
+ forceMount: context.forceMount,
282
+ id: "content",
283
+ onExitComplete: reporter.onExitComplete
284
+ });
285
+ const contents = /* @__PURE__ */ jsx(Fragment, { children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, {
286
+ context,
287
+ ...props,
288
+ onTransition,
289
+ ref: forwardedRef
290
+ }) : /* @__PURE__ */ jsx(DialogContentNonModal, {
291
+ context,
292
+ ...props,
293
+ onTransition,
294
+ ref: forwardedRef
295
+ }) });
296
+ if (isAdapted) {
297
+ if (!isWeb || context.disableRemoveScroll) {
298
+ return contents;
299
+ }
300
+ return /* @__PURE__ */ jsx(RemoveScroll, {
301
+ enabled: context.open && context.modal,
302
+ children: /* @__PURE__ */ jsx("div", {
303
+ "data-remove-scroll-container": true,
304
+ className: "_dsp_contents",
305
+ children: contents
306
+ })
307
+ });
308
+ }
309
+ if (!presence.shouldRender) {
310
+ return null;
311
+ }
312
+ const animated = /* @__PURE__ */ jsx(Animate, {
313
+ type: "presence",
314
+ present: Boolean(context.open),
315
+ keepChildrenMounted: Boolean(presence.keepMounted),
316
+ onExitComplete: presence.onExitComplete,
317
+ children: /* @__PURE__ */ jsx(React.Fragment, { children: contents }, context.contentId)
318
+ });
319
+ if (!isWeb || context.disableRemoveScroll) {
320
+ return animated;
321
+ }
322
+ return /* @__PURE__ */ jsx(RemoveScroll, {
323
+ enabled: context.open && context.modal,
324
+ children: /* @__PURE__ */ jsx("div", {
325
+ "data-remove-scroll-container": true,
326
+ className: "_dsp_contents",
327
+ children: animated
328
+ })
329
+ });
315
330
  });
316
- const DialogContentModal = React.forwardRef(({
317
- children,
318
- context,
319
- ...props
320
- }, forwardedRef) => {
321
- const contentRef = React.useRef(null);
322
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
323
- return /* @__PURE__ */jsx(DialogContentImpl, {
324
- ...props,
325
- context,
326
- ref: composedRefs,
327
- trapFocus: context.open,
328
- disableOutsidePointerEvents: true,
329
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, event => {
330
- event.preventDefault();
331
- context.triggerRef.current?.focus();
332
- }),
333
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, event => {
334
- const originalEvent = event["detail"].originalEvent;
335
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
336
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
337
- if (isRightClick) event.preventDefault();
338
- }),
339
- onFocusOutside: composeEventHandlers(props.onFocusOutside, event => event.preventDefault()),
340
- ...(!props.unstyled && {
341
- outlineStyle: "none"
342
- }),
343
- children
344
- });
331
+ const DialogContentModal = createRefComponent(({ children, context: contextProp, ...props }, forwardedRef) => {
332
+ const context = useDialogContext(contextProp.dialogScope);
333
+ const contentRef = React.useRef(null);
334
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
335
+ return /* @__PURE__ */ jsx(DialogContentImpl, {
336
+ ...props,
337
+ context,
338
+ ref: composedRefs,
339
+ trapFocus: context.open,
340
+ disableOutsidePointerEvents: true,
341
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
342
+ event.cancel();
343
+ context.triggerRef.current?.focus();
344
+ }),
345
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
346
+ const originalEvent = event.event;
347
+ if (!originalEvent) return;
348
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
349
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
350
+ if (isRightClick) event.cancel();
351
+ }),
352
+ onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => event.cancel()),
353
+ outlineStyle: "none",
354
+ children
355
+ });
345
356
  });
346
- const DialogContentNonModal = React.forwardRef((props, forwardedRef) => {
347
- const hasInteractedOutsideRef = React.useRef(false);
348
- return /* @__PURE__ */jsx(DialogContentImpl, {
349
- ...props,
350
- ref: forwardedRef,
351
- trapFocus: false,
352
- disableOutsidePointerEvents: false,
353
- onCloseAutoFocus: event => {
354
- props.onCloseAutoFocus?.(event);
355
- if (!event.defaultPrevented) {
356
- if (!hasInteractedOutsideRef.current) {
357
- props.context.triggerRef.current?.focus();
358
- }
359
- event.preventDefault();
360
- }
361
- hasInteractedOutsideRef.current = false;
362
- },
363
- onInteractOutside: event => {
364
- props.onInteractOutside?.(event);
365
- if (!event.defaultPrevented) hasInteractedOutsideRef.current = true;
366
- const target = event.target;
367
- const trigger = props.context.triggerRef.current;
368
- if (!(trigger instanceof HTMLElement)) return;
369
- const targetIsTrigger = trigger.contains(target);
370
- if (targetIsTrigger) event.preventDefault();
371
- }
372
- });
357
+ const DialogContentNonModal = createRefComponent((props, forwardedRef) => {
358
+ const context = useDialogContext(props.context.dialogScope);
359
+ const hasInteractedOutsideRef = React.useRef(false);
360
+ return /* @__PURE__ */ jsx(DialogContentImpl, {
361
+ ...props,
362
+ context,
363
+ ref: forwardedRef,
364
+ trapFocus: false,
365
+ disableOutsidePointerEvents: false,
366
+ onCloseAutoFocus: (event) => {
367
+ props.onCloseAutoFocus?.(event);
368
+ if (!event.isCanceled) {
369
+ if (!hasInteractedOutsideRef.current) {
370
+ props.context.triggerRef.current?.focus();
371
+ }
372
+ event.cancel();
373
+ }
374
+ hasInteractedOutsideRef.current = false;
375
+ },
376
+ onInteractOutside: (event) => {
377
+ props.onInteractOutside?.(event);
378
+ if (!event.isCanceled) hasInteractedOutsideRef.current = true;
379
+ const target = event.event?.target;
380
+ const trigger = props.context.triggerRef.current;
381
+ if (!target || !(trigger instanceof HTMLElement)) return;
382
+ const targetIsTrigger = trigger.contains(target);
383
+ if (targetIsTrigger) event.cancel();
384
+ }
385
+ });
373
386
  });
374
- const DialogContentImpl = React.forwardRef((props, forwardedRef) => {
375
- const {
376
- trapFocus,
377
- onOpenAutoFocus,
378
- onCloseAutoFocus,
379
- disableOutsidePointerEvents,
380
- onEscapeKeyDown,
381
- onPointerDownOutside,
382
- onFocusOutside,
383
- onInteractOutside,
384
- context,
385
- ...contentProps
386
- } = props;
387
- const contentRef = React.useRef(null);
388
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
389
- const isAdapted = useAdaptIsActive(context.adaptScope);
390
- const isAdaptFullyHidden = React.useContext(DialogAdaptHiddenContext);
391
- if (isAdapted) {
392
- if (!context.open && !context.keepChildrenMounted && isAdaptFullyHidden) {
393
- return null;
394
- }
395
- return /* @__PURE__ */jsx(DialogPortalItem, {
396
- context,
397
- children: contentProps.children
398
- });
399
- }
400
- const contents = /* @__PURE__ */jsx(DialogContentFrame, {
401
- ref: composedRefs,
402
- id: context.contentId,
403
- role: "dialog",
404
- "aria-modal": context.modal,
405
- "aria-describedby": context.descriptionId,
406
- "aria-labelledby": context.titleId,
407
- "data-state": getState(context.open),
408
- pointerEvents: context.open ? "auto" : "none",
409
- ...contentProps
410
- });
411
- if (!isWeb) {
412
- return contents;
413
- }
414
- return /* @__PURE__ */jsxs(Fragment, {
415
- children: [/* @__PURE__ */jsx(Dismissable, {
416
- disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
417
- forceUnmount: !context.open,
418
- onEscapeKeyDown,
419
- onPointerDownOutside,
420
- onFocusOutside,
421
- onInteractOutside,
422
- onDismiss: () => context?.onOpenChange?.(false),
423
- children: /* @__PURE__ */jsx(FocusScope, {
424
- loop: true,
425
- enabled: context.open,
426
- trapped: trapFocus,
427
- onMountAutoFocus: onOpenAutoFocus,
428
- forceUnmount: !context.open,
429
- onUnmountAutoFocus: onCloseAutoFocus,
430
- children: contents
431
- })
432
- }), process.env.NODE_ENV === "development" && /* @__PURE__ */jsxs(Fragment, {
433
- children: [/* @__PURE__ */jsx(TitleWarning, {
434
- titleId: context.titleId
435
- }), /* @__PURE__ */jsx(DescriptionWarning, {
436
- contentRef,
437
- descriptionId: context.descriptionId
438
- })]
439
- })]
440
- });
387
+ const DialogContentImpl = createRefComponent((props, forwardedRef) => {
388
+ const { trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, context, onTransition, ...contentProps } = props;
389
+ const contentRef = React.useRef(null);
390
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
391
+ const isAdapted = useAdaptIsActive(context.adaptScope);
392
+ const adaptContext = useAdaptContext(context.adaptScope);
393
+ if (isAdapted) {
394
+ if (!context.open && !context.keepChildrenMounted && adaptContext.targetFullyHidden) {
395
+ return null;
396
+ }
397
+ return /* @__PURE__ */ jsx(DialogPortalItem, {
398
+ context,
399
+ children: contentProps.children
400
+ });
401
+ }
402
+ const contents = /* @__PURE__ */ jsx(DialogContentFrame, {
403
+ ref: composedRefs,
404
+ id: context.contentId,
405
+ role: "dialog",
406
+ "aria-modal": context.modal,
407
+ "aria-describedby": context.descriptionId,
408
+ "aria-labelledby": context.titleId,
409
+ "data-state": getState(context.open),
410
+ pointerEvents: context.open ? "auto" : "none",
411
+ onTransition,
412
+ ...contentProps
413
+ });
414
+ if (!isWeb) {
415
+ return contents;
416
+ }
417
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Dismissable, {
418
+ disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
419
+ forceUnmount: !context.open,
420
+ onEscapeKeyDown,
421
+ onPointerDownOutside,
422
+ onFocusOutside,
423
+ onInteractOutside,
424
+ onDismiss: () => context?.onOpenChange?.(false),
425
+ children: /* @__PURE__ */ jsx(FocusScope, {
426
+ loop: true,
427
+ enabled: context.open,
428
+ trapped: trapFocus,
429
+ onMountAutoFocus: onOpenAutoFocus,
430
+ forceUnmount: !context.open,
431
+ onUnmountAutoFocus: onCloseAutoFocus,
432
+ children: contents
433
+ })
434
+ }), process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }), /* @__PURE__ */ jsx(DescriptionWarning, {
435
+ contentRef,
436
+ descriptionId: context.descriptionId
437
+ })] })] });
441
438
  });
442
- const DialogTitleFrame = styled(H2, {
443
- name: "DialogTitle"
439
+ const DialogTitleFrame = styled(H2, { displayName: "DialogTitle" });
440
+ const DialogTitle = createStyledHOC(DialogTitleFrame, function DialogTitle2(props, forwardedRef) {
441
+ const { scope, ...titleProps } = props;
442
+ const context = useDialogContext(scope);
443
+ return /* @__PURE__ */ jsx(DialogTitleFrame, {
444
+ id: context.titleId,
445
+ ...titleProps,
446
+ ref: forwardedRef
447
+ });
444
448
  });
445
- const DialogTitle = DialogTitleFrame.styleable(function DialogTitle2(props, forwardedRef) {
446
- const {
447
- scope,
448
- ...titleProps
449
- } = props;
450
- const context = useDialogContext(scope);
451
- return /* @__PURE__ */jsx(DialogTitleFrame, {
452
- id: context.titleId,
453
- ...titleProps,
454
- ref: forwardedRef
455
- });
456
- });
457
- const DialogDescriptionFrame = styled(Paragraph, {
458
- name: "DialogDescription"
459
- });
460
- const DialogDescription = DialogDescriptionFrame.styleable(function DialogDescription2(props, forwardedRef) {
461
- const {
462
- scope,
463
- ...descriptionProps
464
- } = props;
465
- const context = useDialogContext(scope);
466
- return /* @__PURE__ */jsx(DialogDescriptionFrame, {
467
- id: context.descriptionId,
468
- ...descriptionProps,
469
- ref: forwardedRef
470
- });
449
+ const DialogDescriptionFrame = styled(Paragraph, { displayName: "DialogDescription" });
450
+ const DialogDescription = createStyledHOC(DialogDescriptionFrame, function DialogDescription2(props, forwardedRef) {
451
+ const { scope, ...descriptionProps } = props;
452
+ const context = useDialogContext(scope);
453
+ return /* @__PURE__ */ jsx(DialogDescriptionFrame, {
454
+ id: context.descriptionId,
455
+ ...descriptionProps,
456
+ ref: forwardedRef
457
+ });
471
458
  });
472
459
  const CLOSE_NAME = "DialogClose";
473
460
  const DialogCloseFrame = styled(View, {
474
- name: CLOSE_NAME,
475
- render: "button"
461
+ displayName: CLOSE_NAME,
462
+ render: "button"
476
463
  });
477
- const DialogClose = DialogCloseFrame.styleable((props, forwardedRef) => {
478
- const {
479
- scope,
480
- displayWhenAdapted,
481
- ...closeProps
482
- } = props;
483
- const context = useDialogContext(scope);
484
- const isAdapted = useAdaptIsActive(context.adaptScope);
485
- const isInsideButton = React.useContext(ButtonNestingContext);
486
- if (isAdapted && !displayWhenAdapted) {
487
- return null;
488
- }
489
- return /* @__PURE__ */jsx(DialogCloseFrame, {
490
- "aria-label": "Dialog Close",
491
- render: isInsideButton ? "span" : "button",
492
- ...closeProps,
493
- ref: forwardedRef,
494
- onPress: composeEventHandlers(props.onPress, () => {
495
- context.onOpenChange(false);
496
- })
497
- });
464
+ const DialogClose = createStyledHOC(DialogCloseFrame, (props, forwardedRef) => {
465
+ const { scope, displayWhenAdapted, ...closeProps } = props;
466
+ const context = useDialogContext(scope);
467
+ const isAdapted = useAdaptIsActive(context.adaptScope);
468
+ const isInsideButton = React.useContext(ButtonNestingContext);
469
+ if (isAdapted && !displayWhenAdapted) {
470
+ return null;
471
+ }
472
+ return /* @__PURE__ */ jsx(DialogCloseFrame, {
473
+ "aria-label": "Dialog Close",
474
+ render: isInsideButton ? "span" : "button",
475
+ ...closeProps,
476
+ ref: forwardedRef,
477
+ onPress: composeEventHandlers(props.onPress, () => {
478
+ context.onOpenChange(false);
479
+ })
480
+ });
498
481
  });
499
482
  function getState(open) {
500
- return open ? "open" : "closed";
483
+ return open ? "open" : "closed";
501
484
  }
502
485
  const TITLE_WARNING_NAME = "DialogTitleWarning";
503
486
  const [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {
504
- contentName: CONTENT_NAME,
505
- titleName: "DialogTitle",
506
- docsSlug: "dialog"
487
+ contentName: CONTENT_NAME,
488
+ titleName: "DialogTitle",
489
+ docsSlug: "dialog"
507
490
  });
508
- const TitleWarning = ({
509
- titleId
510
- }) => {
511
- if (process.env.NODE_ENV === "development") {
512
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
513
- const MESSAGE = `\`${titleWarningContext.contentName}\` wants a \`${titleWarningContext.titleName}\` to be accessible. If you want to hide the \`${titleWarningContext.titleName}\`, wrap it with <VisuallyHidden />.`;
514
- React.useEffect(() => {
515
- if (!isWeb) return;
516
- if (titleId) {
517
- const hasTitle = document.getElementById(titleId);
518
- if (!hasTitle) {
519
- console.warn(MESSAGE);
520
- }
521
- }
522
- }, [MESSAGE, titleId]);
523
- }
524
- return null;
491
+ const TitleWarning = ({ titleId }) => {
492
+ if (process.env.NODE_ENV === "development") {
493
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
494
+ const MESSAGE = `\`${titleWarningContext.contentName}\` wants a \`${titleWarningContext.titleName}\` to be accessible. If you want to hide the \`${titleWarningContext.titleName}\`, wrap it with <VisuallyHidden />.`;
495
+ React.useEffect(() => {
496
+ if (!isWeb) return;
497
+ if (titleId) {
498
+ const hasTitle = document.getElementById(titleId);
499
+ if (!hasTitle) {
500
+ console.warn(MESSAGE);
501
+ }
502
+ }
503
+ }, [MESSAGE, titleId]);
504
+ }
505
+ return null;
525
506
  };
526
507
  const DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
527
- const DescriptionWarning = ({
528
- contentRef,
529
- descriptionId
530
- }) => {
531
- if (process.env.NODE_ENV === "development") {
532
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
533
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
534
- React.useEffect(() => {
535
- if (!isWeb) return;
536
- const contentNode = contentRef.current;
537
- if (!(contentNode instanceof HTMLElement)) {
538
- return;
539
- }
540
- const describedById = contentNode.getAttribute("aria-describedby");
541
- if (descriptionId && describedById) {
542
- const hasDescription = document.getElementById(descriptionId);
543
- if (!hasDescription) {
544
- console.warn(MESSAGE);
545
- }
546
- }
547
- }, [MESSAGE, contentRef, descriptionId]);
548
- }
549
- return null;
508
+ const DescriptionWarning = ({ contentRef, descriptionId }) => {
509
+ if (process.env.NODE_ENV === "development") {
510
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
511
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
512
+ React.useEffect(() => {
513
+ if (!isWeb) return;
514
+ const contentNode = contentRef.current;
515
+ if (!(contentNode instanceof HTMLElement)) {
516
+ return;
517
+ }
518
+ const describedById = contentNode.getAttribute("aria-describedby");
519
+ if (descriptionId && describedById) {
520
+ const hasDescription = document.getElementById(descriptionId);
521
+ if (!hasDescription) {
522
+ console.warn(MESSAGE);
523
+ }
524
+ }
525
+ }, [
526
+ MESSAGE,
527
+ contentRef,
528
+ descriptionId
529
+ ]);
530
+ }
531
+ return null;
550
532
  };
551
- const Dialog = withStaticProperties(React.forwardRef(function Dialog2(props, ref) {
552
- const {
553
- scope = "",
554
- children,
555
- open: openProp,
556
- defaultOpen = false,
557
- onOpenChange,
558
- modal = true,
559
- keepChildrenMounted,
560
- disableRemoveScroll = false,
561
- onAnimationComplete
562
- } = props;
563
- const baseId = React.useId();
564
- const dialogId = `Dialog-${scope}-${baseId}`;
565
- const contentId = `${dialogId}-content`;
566
- const titleId = `${dialogId}-title`;
567
- const descriptionId = `${dialogId}-description`;
568
- const triggerRef = React.useRef(null);
569
- const contentRef = React.useRef(null);
570
- const [open, setOpen] = useControllableState({
571
- prop: openProp,
572
- defaultProp: defaultOpen,
573
- onChange: onOpenChange
574
- });
575
- const onOpenToggle = React.useCallback(() => {
576
- setOpen(prevOpen => !prevOpen);
577
- }, [setOpen]);
578
- const adaptScope = `DialogAdapt${scope}`;
579
- const context = {
580
- dialogScope: scope,
581
- adaptScope,
582
- triggerRef,
583
- contentRef,
584
- contentId,
585
- titleId,
586
- descriptionId,
587
- open,
588
- onOpenChange: setOpen,
589
- onOpenToggle,
590
- modal,
591
- keepChildrenMounted,
592
- disableRemoveScroll,
593
- onAnimationComplete
594
- };
595
- React.useImperativeHandle(ref, () => ({
596
- open: setOpen
597
- }), [setOpen]);
598
- return /* @__PURE__ */jsx(AdaptParent, {
599
- scope: adaptScope,
600
- portal: {
601
- forwardProps: props
602
- },
603
- children: /* @__PURE__ */jsx(DialogProvider, {
604
- scope,
605
- ...context,
606
- children: /* @__PURE__ */jsx(DialogSheetController, {
607
- onOpenChange: setOpen,
608
- scope,
609
- children
610
- })
611
- })
612
- });
533
+ const Dialog = withStaticProperties(createRefComponent(function Dialog2(props) {
534
+ const { scope = "", children, open: openProp, defaultOpen = false, onOpenChange, modal = true, keepChildrenMounted, disableRemoveScroll = false, onAnimationComplete } = props;
535
+ const baseId = React.useId();
536
+ const dialogId = `Dialog-${scope}-${baseId}`;
537
+ const contentId = `${dialogId}-content`;
538
+ const titleId = `${dialogId}-title`;
539
+ const descriptionId = `${dialogId}-description`;
540
+ const triggerRef = React.useRef(null);
541
+ const contentRef = React.useRef(null);
542
+ const presentPartIdsRef = React.useRef(/* @__PURE__ */ new Set());
543
+ const [presentPartCount, setPresentPartCount] = React.useState(0);
544
+ const [open, setOpen] = useControllableState({
545
+ prop: openProp,
546
+ defaultProp: defaultOpen,
547
+ onChange: onOpenChange
548
+ });
549
+ const onOpenToggle = React.useCallback(() => {
550
+ setOpen((prevOpen) => !prevOpen);
551
+ }, [setOpen]);
552
+ const adaptScope = `DialogAdapt${scope}`;
553
+ const setPartPresence = React.useCallback((id, present) => {
554
+ const presentPartIds = presentPartIdsRef.current;
555
+ const hasPart = presentPartIds.has(id);
556
+ if (present && !hasPart) {
557
+ presentPartIds.add(id);
558
+ setPresentPartCount(presentPartIds.size);
559
+ } else if (!present && hasPart) {
560
+ presentPartIds.delete(id);
561
+ setPresentPartCount(presentPartIds.size);
562
+ }
563
+ }, []);
564
+ const context = {
565
+ dialogScope: scope,
566
+ adaptScope,
567
+ triggerRef,
568
+ contentRef,
569
+ contentId,
570
+ titleId,
571
+ descriptionId,
572
+ open,
573
+ onOpenChange: setOpen,
574
+ onOpenToggle,
575
+ modal,
576
+ keepChildrenMounted,
577
+ disableRemoveScroll,
578
+ hasPresentParts: presentPartCount > 0,
579
+ setPartPresence,
580
+ onAnimationComplete
581
+ };
582
+ return /* @__PURE__ */ jsx(AdaptParent, {
583
+ scope: adaptScope,
584
+ open,
585
+ onOpenChange: setOpen,
586
+ state: context,
587
+ children: /* @__PURE__ */ jsx(DialogProvider, {
588
+ scope,
589
+ ...context,
590
+ children
591
+ })
592
+ });
613
593
  }), {
614
- Trigger: DialogTrigger,
615
- Portal: DialogPortal,
616
- Overlay: DialogOverlay,
617
- Content: DialogContent,
618
- Title: DialogTitle,
619
- Description: DialogDescription,
620
- Close: DialogClose,
621
- FocusScope: FocusScopeController,
622
- Adapt
594
+ Trigger: DialogTrigger,
595
+ Portal: DialogPortal,
596
+ Overlay: DialogOverlay,
597
+ Content: DialogContent,
598
+ Title: DialogTitle,
599
+ Description: DialogDescription,
600
+ Close: DialogClose,
601
+ FocusScope: FocusScopeController,
602
+ Adapt
623
603
  });
624
- const DialogSheetController = props => {
625
- const context = useDialogContext(props.scope);
626
- const isAdapted = useAdaptIsActive(context.adaptScope);
627
- const [isAdaptFullyHidden, setIsAdaptFullyHidden] = React.useState(!context.open);
628
- if (context.open && isAdaptFullyHidden) {
629
- setIsAdaptFullyHidden(false);
630
- }
631
- const handleSheetAnimationComplete = React.useCallback(({
632
- open
633
- }) => {
634
- if (!open) {
635
- setIsAdaptFullyHidden(true);
636
- }
637
- }, []);
638
- return /* @__PURE__ */jsx(SheetController, {
639
- onOpenChange: val => {
640
- if (isAdapted) {
641
- props.onOpenChange?.(val);
642
- }
643
- },
644
- onAnimationComplete: handleSheetAnimationComplete,
645
- open: context.open,
646
- hidden: !isAdapted,
647
- children: /* @__PURE__ */jsx(DialogAdaptHiddenContext.Provider, {
648
- value: isAdaptFullyHidden,
649
- children: props.children
650
- })
651
- });
652
- };
604
+
653
605
  export { Dialog, DialogClose, DialogContent, DialogContext, DialogDescription, DialogOverlay, DialogOverlayFrame, DialogPortal, DialogPortalFrame, DialogProvider, DialogTitle, DialogTrigger, DialogWarningProvider, useDialogContext };
654
606
  //# sourceMappingURL=Dialog.mjs.map