@tamagui/dialog 1.135.3 → 1.135.4-1761749240853

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,293 +1,432 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from "@tamagui/adapt";
3
- import { AnimatePresence } from "@tamagui/animate-presence";
4
- import { composeRefs, useComposedRefs } from "@tamagui/compose-refs";
5
- import { isAndroid, isIos, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
6
- import { createStyledContext, getExpandedShorthand, LayoutMeasurementController, styled, Theme, useThemeName, View } from "@tamagui/core";
7
- import { createContext } from "@tamagui/create-context";
8
- import { Dismissable } from "@tamagui/dismissable";
9
- import { FocusScope, FocusScopeController } from "@tamagui/focus-scope";
10
- import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
11
- import { Portal, PortalItem, resolveViewZIndex, USE_NATIVE_PORTAL } from "@tamagui/portal";
12
- import { RemoveScroll } from "@tamagui/remove-scroll";
13
- import { Overlay, Sheet, SheetController } from "@tamagui/sheet";
14
- import { ButtonNestingContext, ThemeableStack, YStack } from "@tamagui/stacks";
15
- import { H2, Paragraph } from "@tamagui/text";
16
- import { useControllableState } from "@tamagui/use-controllable-state";
17
- import { StackZIndexContext } from "@tamagui/z-index-stack";
18
- import * as React from "react";
19
- var DialogContext = createStyledContext(
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var Dialog_exports = {};
35
+ __export(Dialog_exports, {
36
+ Dialog: () => Dialog,
37
+ DialogClose: () => DialogClose,
38
+ DialogContent: () => DialogContent,
39
+ DialogContext: () => DialogContext,
40
+ DialogDescription: () => DialogDescription,
41
+ DialogOverlay: () => DialogOverlay,
42
+ DialogOverlayFrame: () => DialogOverlayFrame,
43
+ DialogPortal: () => DialogPortal,
44
+ DialogPortalFrame: () => DialogPortalFrame,
45
+ DialogProvider: () => DialogProvider,
46
+ DialogTitle: () => DialogTitle,
47
+ DialogTrigger: () => DialogTrigger,
48
+ DialogWarningProvider: () => DialogWarningProvider,
49
+ useDialogContext: () => useDialogContext
50
+ });
51
+ module.exports = __toCommonJS(Dialog_exports);
52
+ var import_jsx_runtime = require("react/jsx-runtime"),
53
+ import_adapt = require("@tamagui/adapt"),
54
+ import_animate_presence = require("@tamagui/animate-presence"),
55
+ import_compose_refs = require("@tamagui/compose-refs"),
56
+ import_constants = require("@tamagui/constants"),
57
+ import_core = require("@tamagui/core"),
58
+ import_create_context = require("@tamagui/create-context"),
59
+ import_dismissable = require("@tamagui/dismissable"),
60
+ import_focus_scope = require("@tamagui/focus-scope"),
61
+ import_helpers = require("@tamagui/helpers"),
62
+ import_portal = require("@tamagui/portal"),
63
+ import_remove_scroll = require("@tamagui/remove-scroll"),
64
+ import_sheet = require("@tamagui/sheet"),
65
+ import_stacks = require("@tamagui/stacks"),
66
+ import_text = require("@tamagui/text"),
67
+ import_use_controllable_state = require("@tamagui/use-controllable-state"),
68
+ import_z_index_stack = require("@tamagui/z-index-stack"),
69
+ React = __toESM(require("react"), 1);
70
+ function _instanceof(left, right) {
71
+ return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
72
+ }
73
+ var DialogContext = (0, import_core.createStyledContext)(
20
74
  // since we always provide this we can avoid setting here
21
- {},
22
- "Dialog__"
23
- ), { useStyledContext: useDialogContext, Provider: DialogProvider } = DialogContext, DialogTriggerFrame = styled(View, {
24
- name: "DialogTrigger"
25
- }), DialogTrigger = DialogTriggerFrame.styleable(function(props, forwardedRef) {
26
- var { scope, ...triggerProps } = props, isInsideButton = React.useContext(ButtonNestingContext), context = useDialogContext(scope), composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
27
- return /* @__PURE__ */ _jsx(ButtonNestingContext.Provider, {
28
- value: !0,
29
- children: /* @__PURE__ */ _jsx(DialogTriggerFrame, {
30
- tag: 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
- });
40
- }), DialogPortalFrame = styled(YStack, {
41
- pointerEvents: "none",
42
- tag: "dialog",
43
- variants: {
44
- unstyled: {
45
- false: {
46
- alignItems: "center",
47
- justifyContent: "center",
48
- fullscreen: !0,
49
- "$platform-web": {
50
- // undo dialog styles
51
- borderWidth: 0,
52
- backgroundColor: "transparent",
53
- color: "inherit",
54
- maxInlineSize: "none",
55
- margin: 0,
56
- width: "auto",
57
- height: "auto",
58
- // ensure always in frame and right height
59
- maxHeight: "100vh",
60
- position: "fixed"
75
+ {}, "Dialog__"),
76
+ {
77
+ useStyledContext: useDialogContext,
78
+ Provider: DialogProvider
79
+ } = DialogContext,
80
+ DialogTriggerFrame = (0, import_core.styled)(import_core.View, {
81
+ name: "DialogTrigger"
82
+ }),
83
+ DialogTrigger = DialogTriggerFrame.styleable(function (props, forwardedRef) {
84
+ var {
85
+ scope,
86
+ ...triggerProps
87
+ } = props,
88
+ isInsideButton = React.useContext(import_stacks.ButtonNestingContext),
89
+ context = useDialogContext(scope),
90
+ composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
91
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, {
92
+ value: !0,
93
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogTriggerFrame, {
94
+ tag: isInsideButton ? "span" : "button",
95
+ "aria-haspopup": "dialog",
96
+ "aria-expanded": context.open,
97
+ "aria-controls": context.contentId,
98
+ "data-state": getState(context.open),
99
+ ...triggerProps,
100
+ ref: composedTriggerRef,
101
+ onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.onOpenToggle)
102
+ })
103
+ });
104
+ }),
105
+ DialogPortalFrame = (0, import_core.styled)(import_stacks.YStack, {
106
+ pointerEvents: "none",
107
+ tag: "dialog",
108
+ variants: {
109
+ unstyled: {
110
+ false: {
111
+ alignItems: "center",
112
+ justifyContent: "center",
113
+ fullscreen: !0,
114
+ "$platform-web": {
115
+ // undo dialog styles
116
+ borderWidth: 0,
117
+ backgroundColor: "transparent",
118
+ color: "inherit",
119
+ maxInlineSize: "none",
120
+ margin: 0,
121
+ width: "auto",
122
+ height: "auto",
123
+ // ensure always in frame and right height
124
+ maxHeight: "100vh",
125
+ position: "fixed"
126
+ }
61
127
  }
62
128
  }
129
+ },
130
+ defaultVariants: {
131
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
63
132
  }
64
- },
65
- defaultVariants: {
66
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
67
- }
68
- }), needsRepropagation = isAndroid || isIos && !USE_NATIVE_PORTAL, DialogPortalItem = function(param) {
69
- var { context, children } = param, themeName = useThemeName(), isAdapted = useAdaptIsActive(context.adaptScope), adaptContext = useAdaptContext(context.adaptScope), content = /* @__PURE__ */ _jsx(Theme, {
70
- name: themeName,
71
- children
72
- });
73
- return needsRepropagation && (content = /* @__PURE__ */ _jsx(ProvideAdaptContext, {
74
- ...adaptContext,
75
- children: /* @__PURE__ */ _jsx(DialogProvider, {
76
- ...context,
133
+ }),
134
+ needsRepropagation = import_constants.isAndroid || import_constants.isIos && !import_portal.USE_NATIVE_PORTAL,
135
+ DialogPortalItem = function (param) {
136
+ var {
137
+ context,
138
+ children
139
+ } = param,
140
+ themeName = (0, import_core.useThemeName)(),
141
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope),
142
+ adaptContext = (0, import_adapt.useAdaptContext)(context.adaptScope),
143
+ content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Theme, {
144
+ name: themeName,
145
+ children
146
+ });
147
+ return needsRepropagation && (content = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.ProvideAdaptContext, {
148
+ ...adaptContext,
149
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogProvider, {
150
+ ...context,
151
+ children: content
152
+ })
153
+ })), isAdapted ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.AdaptPortalContents, {
154
+ scope: context.adaptScope,
155
+ children: content
156
+ }) : context.modal ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
157
+ hostName: context.modal ? "root" : context.adaptScope,
77
158
  children: content
78
- })
79
- })), isAdapted ? /* @__PURE__ */ _jsx(AdaptPortalContents, {
80
- scope: context.adaptScope,
81
- children: content
82
- }) : context.modal ? /* @__PURE__ */ _jsx(PortalItem, {
83
- hostName: context.modal ? "root" : context.adaptScope,
84
- children: content
85
- }) : content;
86
- }, DialogPortal = /* @__PURE__ */ React.forwardRef(function(props, forwardRef) {
87
- var { scope, forceMount, children, ...frameProps } = props, dialogRef = React.useRef(null), ref = composeRefs(dialogRef, forwardRef), context = useDialogContext(scope), isMountedOrOpen = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React.useState(!isMountedOrOpen), isAdapted = useAdaptIsActive(context.adaptScope), isVisible = isMountedOrOpen ? !0 : !isFullyHidden;
88
- isMountedOrOpen && isFullyHidden && setIsFullyHidden(!1), isWeb && useIsomorphicLayoutEffect(function() {
89
- var node = dialogRef.current;
90
- node instanceof HTMLDialogElement && (isVisible ? node.show() : node.close());
91
- }, [
92
- isVisible
93
- ]);
94
- var handleExitComplete = React.useCallback(function() {
95
- setIsFullyHidden(!0);
96
- }, []), zIndex = getExpandedShorthand("zIndex", props), contents = /* @__PURE__ */ _jsx(StackZIndexContext, {
97
- zIndex: resolveViewZIndex(zIndex),
98
- children: /* @__PURE__ */ _jsx(AnimatePresence, {
159
+ }) : content;
160
+ },
161
+ DialogPortal = /* @__PURE__ */React.forwardRef(function (props, forwardRef) {
162
+ var {
163
+ scope,
164
+ forceMount,
165
+ children,
166
+ ...frameProps
167
+ } = props,
168
+ dialogRef = React.useRef(null),
169
+ ref = (0, import_compose_refs.composeRefs)(dialogRef, forwardRef),
170
+ context = useDialogContext(scope),
171
+ isMountedOrOpen = forceMount || context.open,
172
+ [isFullyHidden, setIsFullyHidden] = React.useState(!isMountedOrOpen),
173
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope),
174
+ isVisible = isMountedOrOpen ? !0 : !isFullyHidden;
175
+ isMountedOrOpen && isFullyHidden && setIsFullyHidden(!1), import_constants.isWeb && (0, import_constants.useIsomorphicLayoutEffect)(function () {
176
+ var node = dialogRef.current;
177
+ _instanceof(node, HTMLDialogElement) && (isVisible ? node.show() : node.close());
178
+ }, [isVisible]);
179
+ var handleExitComplete = React.useCallback(function () {
180
+ setIsFullyHidden(!0);
181
+ }, []),
182
+ zIndex = (0, import_core.getExpandedShorthand)("zIndex", props),
183
+ contents = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_z_index_stack.StackZIndexContext, {
184
+ zIndex: (0, import_portal.resolveViewZIndex)(zIndex),
185
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
186
+ passThrough: isAdapted,
187
+ onExitComplete: handleExitComplete,
188
+ children: isMountedOrOpen || isAdapted ? children : null
189
+ })
190
+ }),
191
+ framedContents =
192
+ // NOTE: we remove the inner frame, but not the portal itself
193
+ // saw a bug when we removed and re-added portals that caused stale inner contents of the portal
194
+ // seems like a React bug itself but leaving this for now as it fixes
195
+ isFullyHidden && !isAdapted ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.LayoutMeasurementController, {
196
+ disable: !isMountedOrOpen,
197
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogPortalFrame, {
198
+ ref,
199
+ ...(import_constants.isWeb && isMountedOrOpen && {
200
+ "aria-modal": !0
201
+ }),
202
+ // passThrough={isAdapted}
203
+ pointerEvents: isMountedOrOpen ? "auto" : "none",
204
+ ...frameProps,
205
+ className: "_no_backdrop " + (frameProps.className || ""),
206
+ children: contents
207
+ })
208
+ });
209
+ return import_constants.isWeb ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_portal.Portal, {
210
+ zIndex,
211
+ // set to 1000 which "boosts" it 1000 above baseline for current context
212
+ // this makes sure its above (this first 1k) popovers on the same layer
213
+ stackZIndex: 1e3,
99
214
  passThrough: isAdapted,
100
- onExitComplete: handleExitComplete,
101
- children: isMountedOrOpen || isAdapted ? children : null
102
- })
103
- }), framedContents = (
104
- // NOTE: we remove the inner frame, but not the portal itself
105
- // saw a bug when we removed and re-added portals that caused stale inner contents of the portal
106
- // seems like a React bug itself but leaving this for now as it fixes
107
- isFullyHidden && !isAdapted ? null : /* @__PURE__ */ _jsx(LayoutMeasurementController, {
108
- disable: !isMountedOrOpen,
109
- children: /* @__PURE__ */ _jsx(DialogPortalFrame, {
110
- ref,
111
- ...isWeb && isMountedOrOpen && {
112
- "aria-modal": !0
113
- },
114
- // passThrough={isAdapted}
115
- pointerEvents: isMountedOrOpen ? "auto" : "none",
116
- ...frameProps,
117
- className: "_no_backdrop " + (frameProps.className || ""),
118
- children: contents
215
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(PassthroughTheme, {
216
+ passThrough: isAdapted,
217
+ children: framedContents
119
218
  })
120
- })
121
- );
122
- return isWeb ? /* @__PURE__ */ _jsx(Portal, {
123
- zIndex,
124
- // set to 1000 which "boosts" it 1000 above baseline for current context
125
- // this makes sure its above (this first 1k) popovers on the same layer
126
- stackZIndex: 1e3,
127
- passThrough: isAdapted,
128
- children: /* @__PURE__ */ _jsx(PassthroughTheme, {
129
- passThrough: isAdapted,
219
+ }) : isAdapted ? framedContents : /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogPortalItem, {
220
+ context,
130
221
  children: framedContents
131
- })
132
- }) : isAdapted ? framedContents : /* @__PURE__ */ _jsx(DialogPortalItem, {
133
- context,
134
- children: framedContents
135
- });
136
- }), PassthroughTheme = function(param) {
137
- var { children, passThrough } = param, themeName = useThemeName();
138
- return /* @__PURE__ */ _jsx(Theme, {
139
- passThrough,
140
- name: themeName,
141
- forceClassName: !0,
142
- children
143
- });
144
- }, OVERLAY_NAME = "DialogOverlay", DialogOverlayFrame = styled(Overlay, {
145
- name: OVERLAY_NAME
146
- }), DialogOverlay = DialogOverlayFrame.styleable(function(param, forwardedRef) {
147
- var { scope, ...props } = param, context = useDialogContext(scope), { forceMount = context.forceMount, ...overlayProps } = props, isAdapted = useAdaptIsActive(context.adaptScope);
148
- return !forceMount && (!context.modal || isAdapted) ? null : /* @__PURE__ */ _jsx(DialogOverlayFrame, {
149
- "data-state": getState(context.open),
150
- // TODO: this will be apply for v2
151
- // onPress={() => {
152
- // // if the overlay is pressed, close the dialog
153
- // context.onOpenChange(false)
154
- // }}
155
- // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
156
- pointerEvents: context.open ? "auto" : "none",
157
- ...overlayProps,
158
- ref: forwardedRef
159
- });
160
- }), CONTENT_NAME = "DialogContent", DialogContentFrame = styled(ThemeableStack, {
161
- name: CONTENT_NAME,
162
- variants: {
163
- size: {
164
- "...size": function(val, extras) {
165
- return {};
166
- }
167
- },
168
- unstyled: {
169
- false: {
170
- position: "relative",
171
- backgrounded: !0,
172
- padded: !0,
173
- radiused: !0,
174
- elevate: !0,
175
- zIndex: 1e5
176
- }
177
- }
222
+ });
223
+ }),
224
+ PassthroughTheme = function (param) {
225
+ var {
226
+ children,
227
+ passThrough
228
+ } = param,
229
+ themeName = (0, import_core.useThemeName)();
230
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_core.Theme, {
231
+ passThrough,
232
+ name: themeName,
233
+ forceClassName: !0,
234
+ children
235
+ });
178
236
  },
179
- defaultVariants: {
180
- size: "$true",
181
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
182
- }
183
- }), DialogContent = DialogContentFrame.styleable(function(param, forwardedRef) {
184
- var { scope, ...props } = param, context = useDialogContext(scope), { forceMount = context.forceMount, ...contentProps } = props, contents = /* @__PURE__ */ _jsx(_Fragment, {
185
- children: context.modal ? /* @__PURE__ */ _jsx(DialogContentModal, {
186
- context,
187
- ...contentProps,
188
- ref: forwardedRef
189
- }) : /* @__PURE__ */ _jsx(DialogContentNonModal, {
190
- context,
191
- ...contentProps,
237
+ OVERLAY_NAME = "DialogOverlay",
238
+ DialogOverlayFrame = (0, import_core.styled)(import_sheet.Overlay, {
239
+ name: OVERLAY_NAME
240
+ }),
241
+ DialogOverlay = DialogOverlayFrame.styleable(function (param, forwardedRef) {
242
+ var {
243
+ scope,
244
+ ...props
245
+ } = param,
246
+ context = useDialogContext(scope),
247
+ {
248
+ forceMount = context.forceMount,
249
+ ...overlayProps
250
+ } = props,
251
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
252
+ return !forceMount && (!context.modal || isAdapted) ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogOverlayFrame, {
253
+ "data-state": getState(context.open),
254
+ // TODO: this will be apply for v2
255
+ // onPress={() => {
256
+ // // if the overlay is pressed, close the dialog
257
+ // context.onOpenChange(false)
258
+ // }}
259
+ // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
260
+ pointerEvents: context.open ? "auto" : "none",
261
+ ...overlayProps,
192
262
  ref: forwardedRef
193
- })
194
- });
195
- return !isWeb || context.disableRemoveScroll ? contents : /* @__PURE__ */ _jsx(RemoveScroll, {
196
- enabled: context.open,
197
- children: /* @__PURE__ */ _jsx("div", {
198
- "data-remove-scroll-container": !0,
199
- className: "_dsp_contents",
200
- children: contents
201
- })
202
- });
203
- }), DialogContentModal = /* @__PURE__ */ React.forwardRef(function(param, forwardedRef) {
204
- var { children, context, ...props } = param, contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
205
- return /* @__PURE__ */ _jsx(DialogContentImpl, {
206
- ...props,
207
- context,
208
- ref: composedRefs,
209
- // we make sure focus isn't trapped once `DialogContent` has been closed
210
- // (closed !== unmounted when animating out)
211
- trapFocus: context.open,
212
- disableOutsidePointerEvents: !0,
213
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, function(event) {
214
- var _context_triggerRef_current;
215
- event.preventDefault(), (_context_triggerRef_current = context.triggerRef.current) === null || _context_triggerRef_current === void 0 || _context_triggerRef_current.focus();
216
- }),
217
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, function(event) {
218
- var originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
219
- isRightClick && event.preventDefault();
220
- }),
221
- // When focus is trapped, a `focusout` event may still happen.
222
- // We make sure we don't trigger our `onDismiss` in such case.
223
- onFocusOutside: composeEventHandlers(props.onFocusOutside, function(event) {
224
- return event.preventDefault();
225
- }),
226
- ...!props.unstyled && {
227
- outlineStyle: "none"
228
- },
229
- children
230
- });
231
- }), DialogContentNonModal = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
232
- var hasInteractedOutsideRef = React.useRef(!1);
233
- return /* @__PURE__ */ _jsx(DialogContentImpl, {
234
- ...props,
235
- ref: forwardedRef,
236
- trapFocus: !1,
237
- disableOutsidePointerEvents: !1,
238
- onCloseAutoFocus: function(event) {
239
- var _props_onCloseAutoFocus;
240
- if ((_props_onCloseAutoFocus = props.onCloseAutoFocus) === null || _props_onCloseAutoFocus === void 0 || _props_onCloseAutoFocus.call(props, event), !event.defaultPrevented) {
241
- if (!hasInteractedOutsideRef.current) {
242
- var _props_context_triggerRef_current;
243
- (_props_context_triggerRef_current = props.context.triggerRef.current) === null || _props_context_triggerRef_current === void 0 || _props_context_triggerRef_current.focus();
263
+ });
264
+ }),
265
+ CONTENT_NAME = "DialogContent",
266
+ DialogContentFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
267
+ name: CONTENT_NAME,
268
+ variants: {
269
+ size: {
270
+ "...size": function (val, extras) {
271
+ return {};
272
+ }
273
+ },
274
+ unstyled: {
275
+ false: {
276
+ position: "relative",
277
+ backgrounded: !0,
278
+ padded: !0,
279
+ radiused: !0,
280
+ elevate: !0,
281
+ zIndex: 1e5
244
282
  }
245
- event.preventDefault();
246
283
  }
247
- hasInteractedOutsideRef.current = !1;
248
284
  },
249
- onInteractOutside: function(event) {
250
- var _props_onInteractOutside;
251
- (_props_onInteractOutside = props.onInteractOutside) === null || _props_onInteractOutside === void 0 || _props_onInteractOutside.call(props, event), event.defaultPrevented || (hasInteractedOutsideRef.current = !0);
252
- var target = event.target, trigger = props.context.triggerRef.current;
253
- if (trigger instanceof HTMLElement) {
254
- var targetIsTrigger = trigger.contains(target);
255
- targetIsTrigger && event.preventDefault();
256
- }
285
+ defaultVariants: {
286
+ size: "$true",
287
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
257
288
  }
258
- });
259
- }), DialogContentImpl = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
260
- var { trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, context, ...contentProps } = props, contentRef = React.useRef(
261
- // TODO react 19 type workaround
262
- void 0
263
- ), composedRefs = useComposedRefs(forwardedRef, contentRef), isAdapted = useAdaptIsActive(context.adaptScope);
264
- if (isAdapted)
265
- return !isWeb && !context.open ? null : /* @__PURE__ */ _jsx(DialogPortalItem, {
289
+ }),
290
+ DialogContent = DialogContentFrame.styleable(function (param, forwardedRef) {
291
+ var {
292
+ scope,
293
+ ...props
294
+ } = param,
295
+ context = useDialogContext(scope),
296
+ {
297
+ forceMount = context.forceMount,
298
+ ...contentProps
299
+ } = props,
300
+ contents = /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
301
+ children: context.modal ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogContentModal, {
302
+ context,
303
+ ...contentProps,
304
+ ref: forwardedRef
305
+ }) : /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogContentNonModal, {
306
+ context,
307
+ ...contentProps,
308
+ ref: forwardedRef
309
+ })
310
+ });
311
+ return !import_constants.isWeb || context.disableRemoveScroll ? contents : /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_remove_scroll.RemoveScroll, {
312
+ enabled: context.open,
313
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
314
+ "data-remove-scroll-container": !0,
315
+ className: "_dsp_contents",
316
+ children: contents
317
+ })
318
+ });
319
+ }),
320
+ DialogContentModal = /* @__PURE__ */React.forwardRef(function (param, forwardedRef) {
321
+ var {
322
+ children,
323
+ context,
324
+ ...props
325
+ } = param,
326
+ contentRef = React.useRef(null),
327
+ composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.contentRef, contentRef);
328
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogContentImpl, {
329
+ ...props,
330
+ context,
331
+ ref: composedRefs,
332
+ // we make sure focus isn't trapped once `DialogContent` has been closed
333
+ // (closed !== unmounted when animating out)
334
+ trapFocus: context.open,
335
+ disableOutsidePointerEvents: !0,
336
+ onCloseAutoFocus: (0, import_helpers.composeEventHandlers)(props.onCloseAutoFocus, function (event) {
337
+ var _context_triggerRef_current;
338
+ event.preventDefault(), (_context_triggerRef_current = context.triggerRef.current) === null || _context_triggerRef_current === void 0 || _context_triggerRef_current.focus();
339
+ }),
340
+ onPointerDownOutside: (0, import_helpers.composeEventHandlers)(props.onPointerDownOutside, function (event) {
341
+ var originalEvent = event.detail.originalEvent,
342
+ ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0,
343
+ isRightClick = originalEvent.button === 2 || ctrlLeftClick;
344
+ isRightClick && event.preventDefault();
345
+ }),
346
+ // When focus is trapped, a `focusout` event may still happen.
347
+ // We make sure we don't trigger our `onDismiss` in such case.
348
+ onFocusOutside: (0, import_helpers.composeEventHandlers)(props.onFocusOutside, function (event) {
349
+ return event.preventDefault();
350
+ }),
351
+ ...(!props.unstyled && {
352
+ outlineStyle: "none"
353
+ }),
354
+ children
355
+ });
356
+ }),
357
+ DialogContentNonModal = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
358
+ var hasInteractedOutsideRef = React.useRef(!1);
359
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogContentImpl, {
360
+ ...props,
361
+ ref: forwardedRef,
362
+ trapFocus: !1,
363
+ disableOutsidePointerEvents: !1,
364
+ onCloseAutoFocus: function (event) {
365
+ var _props_onCloseAutoFocus;
366
+ if ((_props_onCloseAutoFocus = props.onCloseAutoFocus) === null || _props_onCloseAutoFocus === void 0 || _props_onCloseAutoFocus.call(props, event), !event.defaultPrevented) {
367
+ if (!hasInteractedOutsideRef.current) {
368
+ var _props_context_triggerRef_current;
369
+ (_props_context_triggerRef_current = props.context.triggerRef.current) === null || _props_context_triggerRef_current === void 0 || _props_context_triggerRef_current.focus();
370
+ }
371
+ event.preventDefault();
372
+ }
373
+ hasInteractedOutsideRef.current = !1;
374
+ },
375
+ onInteractOutside: function (event) {
376
+ var _props_onInteractOutside;
377
+ (_props_onInteractOutside = props.onInteractOutside) === null || _props_onInteractOutside === void 0 || _props_onInteractOutside.call(props, event), event.defaultPrevented || (hasInteractedOutsideRef.current = !0);
378
+ var target = event.target,
379
+ trigger = props.context.triggerRef.current;
380
+ if (_instanceof(trigger, HTMLElement)) {
381
+ var targetIsTrigger = trigger.contains(target);
382
+ targetIsTrigger && event.preventDefault();
383
+ }
384
+ }
385
+ });
386
+ }),
387
+ DialogContentImpl = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
388
+ var {
389
+ trapFocus,
390
+ onOpenAutoFocus,
391
+ onCloseAutoFocus,
392
+ disableOutsidePointerEvents,
393
+ onEscapeKeyDown,
394
+ onPointerDownOutside,
395
+ onFocusOutside,
396
+ onInteractOutside,
397
+ context,
398
+ ...contentProps
399
+ } = props,
400
+ contentRef = React.useRef(
401
+ // TODO react 19 type workaround
402
+ void 0),
403
+ composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef),
404
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
405
+ if (isAdapted) return !import_constants.isWeb && !context.open ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogPortalItem, {
266
406
  context,
267
407
  children: contentProps.children
268
408
  });
269
- var contents = /* @__PURE__ */ _jsx(DialogContentFrame, {
270
- ref: composedRefs,
271
- id: context.contentId,
272
- "aria-describedby": context.descriptionId,
273
- "aria-labelledby": context.titleId,
274
- "data-state": getState(context.open),
275
- ...contentProps
276
- });
277
- return isWeb ? /* @__PURE__ */ _jsxs(_Fragment, {
278
- children: [
279
- /* @__PURE__ */ _jsx(Dismissable, {
409
+ var contents = /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogContentFrame, {
410
+ ref: composedRefs,
411
+ id: context.contentId,
412
+ "aria-describedby": context.descriptionId,
413
+ "aria-labelledby": context.titleId,
414
+ "data-state": getState(context.open),
415
+ ...contentProps
416
+ });
417
+ return import_constants.isWeb ? /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
418
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_dismissable.Dismissable, {
280
419
  disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
281
420
  forceUnmount: !context.open,
282
421
  onEscapeKeyDown,
283
422
  onPointerDownOutside,
284
423
  onFocusOutside,
285
424
  onInteractOutside,
286
- onDismiss: function() {
425
+ onDismiss: function () {
287
426
  var _context_onOpenChange;
288
427
  return context == null || (_context_onOpenChange = context.onOpenChange) === null || _context_onOpenChange === void 0 ? void 0 : _context_onOpenChange.call(context, !1);
289
428
  },
290
- children: /* @__PURE__ */ _jsx(FocusScope, {
429
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_focus_scope.FocusScope, {
291
430
  loop: !0,
292
431
  enabled: context.open,
293
432
  trapped: trapFocus,
@@ -296,159 +435,197 @@ var DialogContext = createStyledContext(
296
435
  onUnmountAutoFocus: onCloseAutoFocus,
297
436
  children: contents
298
437
  })
299
- }),
300
- process.env.NODE_ENV === "development" && /* @__PURE__ */ _jsxs(_Fragment, {
301
- children: [
302
- /* @__PURE__ */ _jsx(TitleWarning, {
303
- titleId: context.titleId
304
- }),
305
- /* @__PURE__ */ _jsx(DescriptionWarning, {
306
- contentRef,
307
- descriptionId: context.descriptionId
308
- })
309
- ]
438
+ }), process.env.NODE_ENV === "development" && /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
439
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(TitleWarning, {
440
+ titleId: context.titleId
441
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(DescriptionWarning, {
442
+ contentRef,
443
+ descriptionId: context.descriptionId
444
+ })]
445
+ })]
446
+ }) : contents;
447
+ }),
448
+ DialogTitleFrame = (0, import_core.styled)(import_text.H2, {
449
+ name: "DialogTitle"
450
+ }),
451
+ DialogTitle = DialogTitleFrame.styleable(function (props, forwardedRef) {
452
+ var {
453
+ scope,
454
+ ...titleProps
455
+ } = props,
456
+ context = useDialogContext(scope);
457
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogTitleFrame, {
458
+ id: context.titleId,
459
+ ...titleProps,
460
+ ref: forwardedRef
461
+ });
462
+ }),
463
+ DialogDescriptionFrame = (0, import_core.styled)(import_text.Paragraph, {
464
+ name: "DialogDescription"
465
+ }),
466
+ DialogDescription = DialogDescriptionFrame.styleable(function (props, forwardedRef) {
467
+ var {
468
+ scope,
469
+ ...descriptionProps
470
+ } = props,
471
+ context = useDialogContext(scope);
472
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogDescriptionFrame, {
473
+ id: context.descriptionId,
474
+ ...descriptionProps,
475
+ ref: forwardedRef
476
+ });
477
+ }),
478
+ CLOSE_NAME = "DialogClose",
479
+ DialogCloseFrame = (0, import_core.styled)(import_core.View, {
480
+ name: CLOSE_NAME,
481
+ tag: "button"
482
+ }),
483
+ DialogClose = DialogCloseFrame.styleable(function (props, forwardedRef) {
484
+ var {
485
+ scope,
486
+ displayWhenAdapted,
487
+ ...closeProps
488
+ } = props,
489
+ context = useDialogContext(scope),
490
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope),
491
+ isInsideButton = React.useContext(import_stacks.ButtonNestingContext);
492
+ return isAdapted && !displayWhenAdapted ? null : /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogCloseFrame, {
493
+ accessibilityLabel: "Dialog Close",
494
+ tag: isInsideButton ? "span" : "button",
495
+ ...closeProps,
496
+ ref: forwardedRef,
497
+ onPress: (0, import_helpers.composeEventHandlers)(props.onPress, function () {
498
+ context.onOpenChange(!1);
310
499
  })
311
- ]
312
- }) : contents;
313
- }), DialogTitleFrame = styled(H2, {
314
- name: "DialogTitle"
315
- }), DialogTitle = DialogTitleFrame.styleable(function(props, forwardedRef) {
316
- var { scope, ...titleProps } = props, context = useDialogContext(scope);
317
- return /* @__PURE__ */ _jsx(DialogTitleFrame, {
318
- id: context.titleId,
319
- ...titleProps,
320
- ref: forwardedRef
321
- });
322
- }), DialogDescriptionFrame = styled(Paragraph, {
323
- name: "DialogDescription"
324
- }), DialogDescription = DialogDescriptionFrame.styleable(function(props, forwardedRef) {
325
- var { scope, ...descriptionProps } = props, context = useDialogContext(scope);
326
- return /* @__PURE__ */ _jsx(DialogDescriptionFrame, {
327
- id: context.descriptionId,
328
- ...descriptionProps,
329
- ref: forwardedRef
330
- });
331
- }), CLOSE_NAME = "DialogClose", DialogCloseFrame = styled(View, {
332
- name: CLOSE_NAME,
333
- tag: "button"
334
- }), DialogClose = DialogCloseFrame.styleable(function(props, forwardedRef) {
335
- var { scope, displayWhenAdapted, ...closeProps } = props, context = useDialogContext(scope), isAdapted = useAdaptIsActive(context.adaptScope), isInsideButton = React.useContext(ButtonNestingContext);
336
- return isAdapted && !displayWhenAdapted ? null : /* @__PURE__ */ _jsx(DialogCloseFrame, {
337
- accessibilityLabel: "Dialog Close",
338
- tag: isInsideButton ? "span" : "button",
339
- ...closeProps,
340
- ref: forwardedRef,
341
- onPress: composeEventHandlers(props.onPress, function() {
342
- context.onOpenChange(!1);
343
- })
500
+ });
344
501
  });
345
- });
346
502
  function getState(open) {
347
503
  return open ? "open" : "closed";
348
504
  }
349
- var TITLE_WARNING_NAME = "DialogTitleWarning", [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {
350
- contentName: CONTENT_NAME,
351
- titleName: "DialogTitle",
352
- docsSlug: "dialog"
353
- }), TitleWarning = function(param) {
354
- var { titleId } = param;
355
- if (process.env.NODE_ENV === "development") {
356
- var titleWarningContext = useWarningContext(TITLE_WARNING_NAME), MESSAGE = `\`${titleWarningContext.contentName}\` wants a \`${titleWarningContext.titleName}\` to be accessible. If you want to hide the \`${titleWarningContext.titleName}\`, wrap it with <VisuallyHidden />.`;
357
- React.useEffect(function() {
358
- if (isWeb && titleId) {
359
- var hasTitle = document.getElementById(titleId);
360
- hasTitle || console.warn(MESSAGE);
361
- }
362
- }, [
363
- MESSAGE,
505
+ var TITLE_WARNING_NAME = "DialogTitleWarning",
506
+ [DialogWarningProvider, useWarningContext] = (0, import_create_context.createContext)(TITLE_WARNING_NAME, {
507
+ contentName: CONTENT_NAME,
508
+ titleName: "DialogTitle",
509
+ docsSlug: "dialog"
510
+ }),
511
+ TitleWarning = function (param) {
512
+ var {
364
513
  titleId
365
- ]);
366
- }
367
- return null;
368
- }, DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning", DescriptionWarning = function(param) {
369
- var { contentRef, descriptionId } = param;
370
- if (process.env.NODE_ENV === "development") {
371
- var descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME), MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
372
- React.useEffect(function() {
373
- if (isWeb) {
374
- var contentNode = contentRef.current;
375
- if (contentNode instanceof HTMLElement) {
376
- var describedById = contentNode.getAttribute("aria-describedby");
377
- if (descriptionId && describedById) {
378
- var hasDescription = document.getElementById(descriptionId);
379
- hasDescription || console.warn(MESSAGE);
380
- }
514
+ } = param;
515
+ if (process.env.NODE_ENV === "development") {
516
+ var titleWarningContext = useWarningContext(TITLE_WARNING_NAME),
517
+ MESSAGE = `\`${titleWarningContext.contentName}\` wants a \`${titleWarningContext.titleName}\` to be accessible. If you want to hide the \`${titleWarningContext.titleName}\`, wrap it with <VisuallyHidden />.`;
518
+ React.useEffect(function () {
519
+ if (import_constants.isWeb && titleId) {
520
+ var hasTitle = document.getElementById(titleId);
521
+ hasTitle || console.warn(MESSAGE);
381
522
  }
382
- }
383
- }, [
384
- MESSAGE,
523
+ }, [MESSAGE, titleId]);
524
+ }
525
+ return null;
526
+ },
527
+ DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning",
528
+ DescriptionWarning = function (param) {
529
+ var {
385
530
  contentRef,
386
531
  descriptionId
387
- ]);
388
- }
389
- return null;
390
- }, Dialog = withStaticProperties(/* @__PURE__ */ React.forwardRef(function(props, ref) {
391
- var { scope = "", children, open: openProp, defaultOpen = !1, onOpenChange, modal = !0, disableRemoveScroll = !1 } = props, baseId = React.useId(), dialogId = `Dialog-${scope}-${baseId}`, contentId = `${dialogId}-content`, titleId = `${dialogId}-title`, descriptionId = `${dialogId}-description`, triggerRef = React.useRef(null), contentRef = React.useRef(null), [open, setOpen] = useControllableState({
392
- prop: openProp,
393
- defaultProp: defaultOpen,
394
- onChange: onOpenChange
395
- }), onOpenToggle = React.useCallback(function() {
396
- setOpen(function(prevOpen) {
397
- return !prevOpen;
398
- });
399
- }, [
400
- setOpen
401
- ]), adaptScope = `DialogAdapt${scope}`, context = {
402
- dialogScope: scope,
403
- adaptScope,
404
- triggerRef,
405
- contentRef,
406
- contentId,
407
- titleId,
408
- descriptionId,
409
- open,
410
- onOpenChange: setOpen,
411
- onOpenToggle,
412
- modal,
413
- disableRemoveScroll
414
- };
415
- return React.useImperativeHandle(ref, function() {
416
- return {
417
- open: setOpen
418
- };
419
- }, [
420
- setOpen
421
- ]), /* @__PURE__ */ _jsx(AdaptParent, {
422
- scope: adaptScope,
423
- portal: {
424
- forwardProps: props
425
- },
426
- children: /* @__PURE__ */ _jsx(DialogProvider, {
427
- scope,
428
- ...context,
429
- children: /* @__PURE__ */ _jsx(DialogSheetController, {
532
+ } = param;
533
+ if (process.env.NODE_ENV === "development") {
534
+ var descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME),
535
+ MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
536
+ React.useEffect(function () {
537
+ if (import_constants.isWeb) {
538
+ var contentNode = contentRef.current;
539
+ if (_instanceof(contentNode, HTMLElement)) {
540
+ var describedById = contentNode.getAttribute("aria-describedby");
541
+ if (descriptionId && describedById) {
542
+ var hasDescription = document.getElementById(descriptionId);
543
+ hasDescription || console.warn(MESSAGE);
544
+ }
545
+ }
546
+ }
547
+ }, [MESSAGE, contentRef, descriptionId]);
548
+ }
549
+ return null;
550
+ },
551
+ Dialog = (0, import_helpers.withStaticProperties)(/* @__PURE__ */React.forwardRef(function (props, ref) {
552
+ var {
553
+ scope = "",
554
+ children,
555
+ open: openProp,
556
+ defaultOpen = !1,
557
+ onOpenChange,
558
+ modal = !0,
559
+ disableRemoveScroll = !1
560
+ } = props,
561
+ baseId = React.useId(),
562
+ dialogId = `Dialog-${scope}-${baseId}`,
563
+ contentId = `${dialogId}-content`,
564
+ titleId = `${dialogId}-title`,
565
+ descriptionId = `${dialogId}-description`,
566
+ triggerRef = React.useRef(null),
567
+ contentRef = React.useRef(null),
568
+ [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
569
+ prop: openProp,
570
+ defaultProp: defaultOpen,
571
+ onChange: onOpenChange
572
+ }),
573
+ onOpenToggle = React.useCallback(function () {
574
+ setOpen(function (prevOpen) {
575
+ return !prevOpen;
576
+ });
577
+ }, [setOpen]),
578
+ adaptScope = `DialogAdapt${scope}`,
579
+ context = {
580
+ dialogScope: scope,
581
+ adaptScope,
582
+ triggerRef,
583
+ contentRef,
584
+ contentId,
585
+ titleId,
586
+ descriptionId,
587
+ open,
430
588
  onOpenChange: setOpen,
589
+ onOpenToggle,
590
+ modal,
591
+ disableRemoveScroll
592
+ };
593
+ return React.useImperativeHandle(ref, function () {
594
+ return {
595
+ open: setOpen
596
+ };
597
+ }, [setOpen]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_adapt.AdaptParent, {
598
+ scope: adaptScope,
599
+ portal: {
600
+ forwardProps: props
601
+ },
602
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogProvider, {
431
603
  scope,
432
- children
604
+ ...context,
605
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(DialogSheetController, {
606
+ onOpenChange: setOpen,
607
+ scope,
608
+ children
609
+ })
433
610
  })
434
- })
611
+ });
612
+ }), {
613
+ Trigger: DialogTrigger,
614
+ Portal: DialogPortal,
615
+ Overlay: DialogOverlay,
616
+ Content: DialogContent,
617
+ Title: DialogTitle,
618
+ Description: DialogDescription,
619
+ Close: DialogClose,
620
+ Sheet: import_sheet.Sheet.Controlled,
621
+ FocusScope: import_focus_scope.FocusScopeController,
622
+ Adapt: import_adapt.Adapt
435
623
  });
436
- }), {
437
- Trigger: DialogTrigger,
438
- Portal: DialogPortal,
439
- Overlay: DialogOverlay,
440
- Content: DialogContent,
441
- Title: DialogTitle,
442
- Description: DialogDescription,
443
- Close: DialogClose,
444
- Sheet: Sheet.Controlled,
445
- FocusScope: FocusScopeController,
446
- Adapt
447
- });
448
- var DialogSheetController = function(props) {
449
- var context = useDialogContext(props.scope), isAdapted = useAdaptIsActive(context.adaptScope);
450
- return /* @__PURE__ */ _jsx(SheetController, {
451
- onOpenChange: function(val) {
624
+ var DialogSheetController = function (props) {
625
+ var context = useDialogContext(props.scope),
626
+ isAdapted = (0, import_adapt.useAdaptIsActive)(context.adaptScope);
627
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_sheet.SheetController, {
628
+ onOpenChange: function (val) {
452
629
  if (isAdapted) {
453
630
  var _props_onOpenChange;
454
631
  (_props_onOpenChange = props.onOpenChange) === null || _props_onOpenChange === void 0 || _props_onOpenChange.call(props, val);
@@ -459,20 +636,4 @@ var DialogSheetController = function(props) {
459
636
  children: props.children
460
637
  });
461
638
  };
462
- export {
463
- Dialog,
464
- DialogClose,
465
- DialogContent,
466
- DialogContext,
467
- DialogDescription,
468
- DialogOverlay,
469
- DialogOverlayFrame,
470
- DialogPortal,
471
- DialogPortalFrame,
472
- DialogProvider,
473
- DialogTitle,
474
- DialogTrigger,
475
- DialogWarningProvider,
476
- useDialogContext
477
- };
478
- //# sourceMappingURL=Dialog.js.map
639
+ //# sourceMappingURL=Dialog.native.js.map