@tamagui/dialog 1.89.26 → 1.89.27-1708113113238

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.
@@ -3,15 +3,7 @@ import { AnimatePresence } from "@tamagui/animate-presence";
3
3
  import { hideOthers } from "@tamagui/aria-hidden";
4
4
  import { useComposedRefs } from "@tamagui/compose-refs";
5
5
  import { isWeb } from "@tamagui/constants";
6
- import {
7
- Theme,
8
- View,
9
- spacedChildren,
10
- styled,
11
- useGet,
12
- useMedia,
13
- useThemeName
14
- } from "@tamagui/core";
6
+ import { Theme, View, spacedChildren, styled, useGet, useMedia, useThemeName } from "@tamagui/core";
15
7
  import { createContext, createContextScope } from "@tamagui/create-context";
16
8
  import { Dismissable } from "@tamagui/dismissable";
17
9
  import { FocusScope } from "@tamagui/focus-scope";
@@ -23,133 +15,250 @@ import { ButtonNestingContext, ThemeableStack, YStack } from "@tamagui/stacks";
23
15
  import { H2, Paragraph } from "@tamagui/text";
24
16
  import { useControllableState } from "@tamagui/use-controllable-state";
25
17
  import * as React from "react";
26
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
27
- const DIALOG_NAME = "Dialog", [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME), [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME), TRIGGER_NAME = "DialogTrigger", DialogTriggerFrame = styled(View, {
28
- name: TRIGGER_NAME
29
- }), DialogTrigger = DialogTriggerFrame.styleable(
30
- (props, forwardedRef) => {
31
- const { __scopeDialog, ...triggerProps } = props, isInsideButton = React.useContext(ButtonNestingContext), context = useDialogContext(TRIGGER_NAME, __scopeDialog), composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
32
- return /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: !0, children: /* @__PURE__ */ jsx(
33
- DialogTriggerFrame,
34
- {
35
- tag: isInsideButton ? "span" : "button",
36
- "aria-haspopup": "dialog",
37
- "aria-expanded": context.open,
38
- "aria-controls": context.contentId,
39
- "data-state": getState(context.open),
40
- ...triggerProps,
41
- ref: composedTriggerRef,
42
- onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
18
+ function _array_like_to_array(arr, len) {
19
+ (len == null || len > arr.length) && (len = arr.length);
20
+ for (var i = 0, arr2 = new Array(len); i < len; i++)
21
+ arr2[i] = arr[i];
22
+ return arr2;
23
+ }
24
+ function _array_with_holes(arr) {
25
+ if (Array.isArray(arr))
26
+ return arr;
27
+ }
28
+ function _define_property(obj, key, value) {
29
+ return key in obj ? Object.defineProperty(obj, key, {
30
+ value,
31
+ enumerable: !0,
32
+ configurable: !0,
33
+ writable: !0
34
+ }) : obj[key] = value, obj;
35
+ }
36
+ function _instanceof(left, right) {
37
+ return right != null && typeof Symbol < "u" && right[Symbol.hasInstance] ? !!right[Symbol.hasInstance](left) : left instanceof right;
38
+ }
39
+ function _iterable_to_array_limit(arr, i) {
40
+ var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
41
+ if (_i != null) {
42
+ var _arr = [], _n = !0, _d = !1, _s, _e;
43
+ try {
44
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
45
+ ;
46
+ } catch (err) {
47
+ _d = !0, _e = err;
48
+ } finally {
49
+ try {
50
+ !_n && _i.return != null && _i.return();
51
+ } finally {
52
+ if (_d)
53
+ throw _e;
43
54
  }
44
- ) });
55
+ }
56
+ return _arr;
45
57
  }
46
- );
47
- DialogTrigger.displayName = TRIGGER_NAME;
48
- const PORTAL_NAME = "DialogPortal", [PortalProvider, usePortalContext] = createDialogContext(
49
- PORTAL_NAME,
50
- {
51
- forceMount: void 0
58
+ }
59
+ function _non_iterable_rest() {
60
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
61
+ }
62
+ function _object_spread(target) {
63
+ for (var i = 1; i < arguments.length; i++) {
64
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
65
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
66
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
67
+ }))), ownKeys2.forEach(function(key) {
68
+ _define_property(target, key, source[key]);
69
+ });
70
+ }
71
+ return target;
72
+ }
73
+ function ownKeys(object, enumerableOnly) {
74
+ var keys = Object.keys(object);
75
+ if (Object.getOwnPropertySymbols) {
76
+ var symbols = Object.getOwnPropertySymbols(object);
77
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
78
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
79
+ })), keys.push.apply(keys, symbols);
80
+ }
81
+ return keys;
82
+ }
83
+ function _object_spread_props(target, source) {
84
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
85
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
86
+ }), target;
87
+ }
88
+ function _object_without_properties(source, excluded) {
89
+ if (source == null)
90
+ return {};
91
+ var target = _object_without_properties_loose(source, excluded), key, i;
92
+ if (Object.getOwnPropertySymbols) {
93
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
94
+ for (i = 0; i < sourceSymbolKeys.length; i++)
95
+ key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
96
+ }
97
+ return target;
98
+ }
99
+ function _object_without_properties_loose(source, excluded) {
100
+ if (source == null)
101
+ return {};
102
+ var target = {}, sourceKeys = Object.keys(source), key, i;
103
+ for (i = 0; i < sourceKeys.length; i++)
104
+ key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
105
+ return target;
106
+ }
107
+ function _sliced_to_array(arr, i) {
108
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
109
+ }
110
+ function _unsupported_iterable_to_array(o, minLen) {
111
+ if (o) {
112
+ if (typeof o == "string")
113
+ return _array_like_to_array(o, minLen);
114
+ var n = Object.prototype.toString.call(o).slice(8, -1);
115
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
116
+ return Array.from(n);
117
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
118
+ return _array_like_to_array(o, minLen);
52
119
  }
53
- ), DialogPortalFrame = styled(YStack, {
120
+ }
121
+ var DIALOG_NAME = "Dialog", _createContextScope = _sliced_to_array(createContextScope(DIALOG_NAME), 2), createDialogContext = _createContextScope[0], createDialogScope = _createContextScope[1], _createDialogContext = _sliced_to_array(createDialogContext(DIALOG_NAME), 2), DialogProvider = _createDialogContext[0], useDialogContext = _createDialogContext[1], TRIGGER_NAME = "DialogTrigger", DialogTriggerFrame = styled(View, {
122
+ name: TRIGGER_NAME
123
+ }), DialogTrigger = DialogTriggerFrame.styleable(function(props, forwardedRef) {
124
+ var __scopeDialog = props.__scopeDialog, triggerProps = _object_without_properties(props, [
125
+ "__scopeDialog"
126
+ ]), isInsideButton = React.useContext(ButtonNestingContext), context = useDialogContext(TRIGGER_NAME, __scopeDialog), composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
127
+ return /* @__PURE__ */ React.createElement(ButtonNestingContext.Provider, {
128
+ value: !0
129
+ }, /* @__PURE__ */ React.createElement(DialogTriggerFrame, _object_spread_props(_object_spread({
130
+ tag: isInsideButton ? "span" : "button",
131
+ "aria-haspopup": "dialog",
132
+ "aria-expanded": context.open,
133
+ "aria-controls": context.contentId,
134
+ "data-state": getState(context.open)
135
+ }, triggerProps), {
136
+ ref: composedTriggerRef,
137
+ onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
138
+ })));
139
+ });
140
+ DialogTrigger.displayName = TRIGGER_NAME;
141
+ var PORTAL_NAME = "DialogPortal", _createDialogContext1 = _sliced_to_array(createDialogContext(PORTAL_NAME, {
142
+ forceMount: void 0
143
+ }), 2), PortalProvider = _createDialogContext1[0], usePortalContext = _createDialogContext1[1], DialogPortalFrame = styled(YStack, {
54
144
  variants: {
55
145
  unstyled: {
56
- false: {
146
+ false: _object_spread({
57
147
  alignItems: "center",
58
148
  justifyContent: "center",
59
149
  fullscreen: !0,
60
- zIndex: 1e5,
61
- ...isWeb && {
62
- maxHeight: "100vh",
63
- position: "fixed"
64
- }
65
- }
150
+ zIndex: 1e5
151
+ }, isWeb && {
152
+ maxHeight: "100vh",
153
+ position: "fixed"
154
+ })
66
155
  }
67
156
  },
68
157
  defaultVariants: {
69
158
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
70
159
  }
71
- }), DialogPortalItem = (props) => {
72
- const themeName = useThemeName(), context = useDialogContext(PORTAL_NAME, props.__scopeDialog);
73
- return /* @__PURE__ */ jsx(PortalItem, { hostName: props.hostName, children: /* @__PURE__ */ jsx(DialogPortalItemContent, { ...props, themeName, context }) });
160
+ }), DialogPortalItem = function(props) {
161
+ var themeName = useThemeName(), context = useDialogContext(PORTAL_NAME, props.__scopeDialog);
162
+ return /* @__PURE__ */ React.createElement(PortalItem, {
163
+ hostName: props.hostName
164
+ }, /* @__PURE__ */ React.createElement(DialogPortalItemContent, _object_spread_props(_object_spread({}, props), {
165
+ themeName,
166
+ context
167
+ })));
74
168
  };
75
169
  function DialogPortalItemContent(props) {
76
- const {
77
- __scopeDialog,
78
- children,
79
- context,
80
- themeName,
81
- space,
82
- spaceDirection,
83
- separator
84
- } = props;
85
- let childrenSpaced = children;
170
+ var __scopeDialog = props.__scopeDialog, children = props.children, context = props.context, themeName = props.themeName, space = props.space, spaceDirection = props.spaceDirection, separator = props.separator, childrenSpaced = children;
86
171
  return (space || separator) && (childrenSpaced = spacedChildren({
87
172
  children,
88
173
  separator,
89
174
  space,
90
175
  direction: spaceDirection
91
- })), /* @__PURE__ */ jsx(DialogProvider, { scope: __scopeDialog, ...context, children: /* @__PURE__ */ jsx(Theme, { name: themeName, children: childrenSpaced }) });
176
+ })), /* @__PURE__ */ React.createElement(DialogProvider, _object_spread({
177
+ scope: __scopeDialog
178
+ }, context), /* @__PURE__ */ React.createElement(Theme, {
179
+ name: themeName
180
+ }, childrenSpaced));
92
181
  }
93
- const DialogPortal = (props) => {
94
- const { __scopeDialog, forceMount, children, ...frameProps } = props, context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, [isFullyHidden, setIsFullyHidden] = React.useState(!isShowing);
182
+ var DialogPortal = function(props) {
183
+ var __scopeDialog = props.__scopeDialog, forceMount = props.forceMount, children = props.children, frameProps = _object_without_properties(props, [
184
+ "__scopeDialog",
185
+ "forceMount",
186
+ "children"
187
+ ]), context = useDialogContext(PORTAL_NAME, __scopeDialog), isShowing = forceMount || context.open, _React_useState = _sliced_to_array(React.useState(!isShowing), 2), isFullyHidden = _React_useState[0], setIsFullyHidden = _React_useState[1];
95
188
  isShowing && isFullyHidden && setIsFullyHidden(!1);
96
- const contents = /* @__PURE__ */ jsx(
97
- AnimatePresence,
98
- {
99
- onExitComplete: () => {
100
- setIsFullyHidden(!0);
101
- },
102
- children: isShowing ? children : null
189
+ var contents = /* @__PURE__ */ React.createElement(AnimatePresence, {
190
+ onExitComplete: function() {
191
+ setIsFullyHidden(!0);
103
192
  }
104
- );
105
- if (useShowDialogSheet(context))
193
+ }, isShowing ? children : null), isSheet = useShowDialogSheet(context);
194
+ if (isSheet)
106
195
  return children;
107
196
  if (context.modal) {
108
197
  if (isFullyHidden)
109
198
  return null;
110
- const framedContents = /* @__PURE__ */ jsx(PortalProvider, { scope: __scopeDialog, forceMount, children: /* @__PURE__ */ jsx(DialogPortalFrame, { pointerEvents: isShowing ? "auto" : "none", ...frameProps, children: contents }) });
111
- return isWeb ? /* @__PURE__ */ jsx(Portal, { zIndex: props.zIndex ?? 1e5, children: /* @__PURE__ */ jsx(PassthroughTheme, { children: framedContents }) }) : /* @__PURE__ */ jsx(DialogPortalItem, { __scopeDialog, children: framedContents });
199
+ var framedContents = /* @__PURE__ */ React.createElement(PortalProvider, {
200
+ scope: __scopeDialog,
201
+ forceMount
202
+ }, /* @__PURE__ */ React.createElement(DialogPortalFrame, _object_spread({
203
+ pointerEvents: isShowing ? "auto" : "none"
204
+ }, frameProps), contents));
205
+ if (isWeb) {
206
+ var _props_zIndex;
207
+ return /* @__PURE__ */ React.createElement(Portal, {
208
+ zIndex: (_props_zIndex = props.zIndex) !== null && _props_zIndex !== void 0 ? _props_zIndex : 1e5
209
+ }, /* @__PURE__ */ React.createElement(PassthroughTheme, null, framedContents));
210
+ }
211
+ return /* @__PURE__ */ React.createElement(DialogPortalItem, {
212
+ __scopeDialog
213
+ }, framedContents);
112
214
  }
113
215
  return contents;
114
216
  };
115
217
  DialogPortal.displayName = PORTAL_NAME;
116
- const PassthroughTheme = ({ children }) => {
117
- const themeName = useThemeName();
118
- return /* @__PURE__ */ jsx(Theme, { name: themeName, forceClassName: !0, children });
218
+ var PassthroughTheme = function(param) {
219
+ var children = param.children, themeName = useThemeName();
220
+ return /* @__PURE__ */ React.createElement(Theme, {
221
+ name: themeName,
222
+ forceClassName: !0
223
+ }, children);
119
224
  }, OVERLAY_NAME = "DialogOverlay", DialogOverlayFrame = styled(Overlay, {
120
225
  name: OVERLAY_NAME
121
- }), DialogOverlay = DialogOverlayFrame.extractable(
122
- React.forwardRef(
123
- ({ __scopeDialog, ...props }, forwardedRef) => {
124
- const portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog), { forceMount = portalContext.forceMount, ...overlayProps } = props, context = useDialogContext(OVERLAY_NAME, __scopeDialog), showSheet = useShowDialogSheet(context);
125
- return !forceMount && (!context.modal || showSheet) ? null : /* @__PURE__ */ jsx(DialogOverlayImpl, { context, ...overlayProps, ref: forwardedRef });
126
- }
127
- )
128
- );
226
+ }), DialogOverlay = DialogOverlayFrame.extractable(/* @__PURE__ */ React.forwardRef(function(_param, forwardedRef) {
227
+ var __scopeDialog = _param.__scopeDialog, props = _object_without_properties(_param, [
228
+ "__scopeDialog"
229
+ ]), portalContext = usePortalContext(OVERLAY_NAME, __scopeDialog), _props_forceMount = props.forceMount, forceMount = _props_forceMount === void 0 ? portalContext.forceMount : _props_forceMount, overlayProps = _object_without_properties(props, [
230
+ "forceMount"
231
+ ]), context = useDialogContext(OVERLAY_NAME, __scopeDialog), showSheet = useShowDialogSheet(context);
232
+ return !forceMount && (!context.modal || showSheet) ? null : /* @__PURE__ */ React.createElement(DialogOverlayImpl, _object_spread_props(_object_spread({
233
+ context
234
+ }, overlayProps), {
235
+ ref: forwardedRef
236
+ }));
237
+ }));
129
238
  DialogOverlay.displayName = OVERLAY_NAME;
130
- const DialogOverlayImpl = React.forwardRef(
131
- (props, forwardedRef) => {
132
- const { context, ...overlayProps } = props;
133
- return (
134
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
135
- // ie. when `Overlay` and `Content` are siblings
136
- /* @__PURE__ */ jsx(
137
- DialogOverlayFrame,
138
- {
139
- "data-state": getState(context.open),
140
- pointerEvents: context.open ? "auto" : "none",
141
- ...overlayProps,
142
- ref: forwardedRef
143
- }
144
- )
145
- );
146
- }
147
- ), CONTENT_NAME = "DialogContent", DialogContentFrame = styled(ThemeableStack, {
239
+ var DialogOverlayImpl = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
240
+ var context = props.context, overlayProps = _object_without_properties(props, [
241
+ "context"
242
+ ]);
243
+ return (
244
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
245
+ // ie. when `Overlay` and `Content` are siblings
246
+ /* @__PURE__ */ React.createElement(DialogOverlayFrame, _object_spread_props(_object_spread({
247
+ "data-state": getState(context.open),
248
+ // We re-enable pointer-events prevented by `Dialog.Content` to allow scrolling the overlay.
249
+ pointerEvents: context.open ? "auto" : "none"
250
+ }, overlayProps), {
251
+ ref: forwardedRef
252
+ }))
253
+ );
254
+ }), CONTENT_NAME = "DialogContent", DialogContentFrame = styled(ThemeableStack, {
148
255
  name: CONTENT_NAME,
149
256
  tag: "dialog",
150
257
  variants: {
151
258
  size: {
152
- "...size": (val, extras) => ({})
259
+ "...size": function(val, extras) {
260
+ return {};
261
+ }
153
262
  },
154
263
  unstyled: {
155
264
  false: {
@@ -166,323 +275,321 @@ const DialogOverlayImpl = React.forwardRef(
166
275
  size: "$true",
167
276
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
168
277
  }
169
- }), DialogContent = DialogContentFrame.extractable(
170
- React.forwardRef(
171
- ({ __scopeDialog, ...props }, forwardedRef) => {
172
- const portalContext = usePortalContext(CONTENT_NAME, __scopeDialog), { forceMount = portalContext.forceMount, ...contentProps } = props, context = useDialogContext(CONTENT_NAME, __scopeDialog), contents = context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { context, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { context, ...contentProps, ref: forwardedRef });
173
- return !isWeb || context.disableRemoveScroll ? contents : /* @__PURE__ */ jsx(
174
- RemoveScroll,
175
- {
176
- forwardProps: !0,
177
- enabled: context.open,
178
- allowPinchZoom: context.allowPinchZoom,
179
- shards: [context.contentRef],
180
- removeScrollBar: !1,
181
- children: /* @__PURE__ */ jsx("div", { "data-remove-scroll-container": !0, className: "_dsp_contents", children: contents })
182
- }
183
- );
184
- }
185
- )
186
- );
278
+ }), DialogContent = DialogContentFrame.extractable(/* @__PURE__ */ React.forwardRef(function(_param, forwardedRef) {
279
+ var __scopeDialog = _param.__scopeDialog, props = _object_without_properties(_param, [
280
+ "__scopeDialog"
281
+ ]), portalContext = usePortalContext(CONTENT_NAME, __scopeDialog), _props_forceMount = props.forceMount, forceMount = _props_forceMount === void 0 ? portalContext.forceMount : _props_forceMount, contentProps = _object_without_properties(props, [
282
+ "forceMount"
283
+ ]), context = useDialogContext(CONTENT_NAME, __scopeDialog), contents = context.modal ? /* @__PURE__ */ React.createElement(DialogContentModal, _object_spread_props(_object_spread({
284
+ context
285
+ }, contentProps), {
286
+ ref: forwardedRef
287
+ })) : /* @__PURE__ */ React.createElement(DialogContentNonModal, _object_spread_props(_object_spread({
288
+ context
289
+ }, contentProps), {
290
+ ref: forwardedRef
291
+ }));
292
+ return !isWeb || context.disableRemoveScroll ? contents : /* @__PURE__ */ React.createElement(RemoveScroll, {
293
+ forwardProps: !0,
294
+ enabled: context.open,
295
+ allowPinchZoom: context.allowPinchZoom,
296
+ shards: [
297
+ context.contentRef
298
+ ],
299
+ // causes lots of bugs on touch web on site
300
+ removeScrollBar: !1
301
+ }, /* @__PURE__ */ React.createElement("div", {
302
+ "data-remove-scroll-container": !0,
303
+ className: "_dsp_contents"
304
+ }, contents));
305
+ }));
187
306
  DialogContent.displayName = CONTENT_NAME;
188
- const DialogContentModal = React.forwardRef(
189
- ({ children, context, ...props }, forwardedRef) => {
190
- const contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
191
- return isWeb && React.useEffect(() => {
192
- if (!context.open)
193
- return;
194
- const content = contentRef.current;
307
+ var DialogContentModal = /* @__PURE__ */ React.forwardRef(function(_param, forwardedRef) {
308
+ var children = _param.children, context = _param.context, props = _object_without_properties(_param, [
309
+ "children",
310
+ "context"
311
+ ]), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
312
+ return isWeb && React.useEffect(function() {
313
+ if (context.open) {
314
+ var content = contentRef.current;
195
315
  if (content)
196
316
  return hideOthers(content);
197
- }, [context.open]), /* @__PURE__ */ jsx(
198
- DialogContentImpl,
199
- {
200
- ...props,
201
- context,
202
- ref: composedRefs,
203
- trapFocus: context.open,
204
- disableOutsidePointerEvents: !0,
205
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
206
- var _a;
207
- event.preventDefault(), (_a = context.triggerRef.current) == null || _a.focus();
208
- }),
209
- onPointerDownOutside: composeEventHandlers(
210
- props.onPointerDownOutside,
211
- (event) => {
212
- const originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0;
213
- (originalEvent.button === 2 || ctrlLeftClick) && event.preventDefault();
214
- }
215
- ),
216
- onFocusOutside: composeEventHandlers(
217
- props.onFocusOutside,
218
- (event) => event.preventDefault()
219
- ),
220
- ...!props.unstyled && {
221
- outlineStyle: "none"
222
- },
223
- children
224
- }
225
- );
226
- }
227
- ), DialogContentNonModal = React.forwardRef(
228
- (props, forwardedRef) => {
229
- const hasInteractedOutsideRef = React.useRef(!1);
230
- return /* @__PURE__ */ jsx(
231
- DialogContentImpl,
232
- {
233
- ...props,
234
- ref: forwardedRef,
235
- trapFocus: !1,
236
- disableOutsidePointerEvents: !1,
237
- onCloseAutoFocus: (event) => {
238
- var _a, _b;
239
- (_a = props.onCloseAutoFocus) == null || _a.call(props, event), event.defaultPrevented || (hasInteractedOutsideRef.current || (_b = props.context.triggerRef.current) == null || _b.focus(), event.preventDefault()), hasInteractedOutsideRef.current = !1;
240
- },
241
- onInteractOutside: (event) => {
242
- var _a;
243
- (_a = props.onInteractOutside) == null || _a.call(props, event), event.defaultPrevented || (hasInteractedOutsideRef.current = !0);
244
- const target = event.target, trigger = props.context.triggerRef.current;
245
- if (!(trigger instanceof HTMLElement))
246
- return;
247
- trigger.contains(target) && event.preventDefault();
317
+ }
318
+ }, [
319
+ context.open
320
+ ]), /* @__PURE__ */ React.createElement(DialogContentImpl, _object_spread(_object_spread_props(_object_spread({}, props), {
321
+ context,
322
+ ref: composedRefs,
323
+ // we make sure focus isn't trapped once `DialogContent` has been closed
324
+ // (closed !== unmounted when animating out)
325
+ trapFocus: context.open,
326
+ disableOutsidePointerEvents: !0,
327
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, function(event) {
328
+ var _context_triggerRef_current;
329
+ event.preventDefault(), (_context_triggerRef_current = context.triggerRef.current) === null || _context_triggerRef_current === void 0 || _context_triggerRef_current.focus();
330
+ }),
331
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, function(event) {
332
+ var originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
333
+ isRightClick && event.preventDefault();
334
+ }),
335
+ // When focus is trapped, a `focusout` event may still happen.
336
+ // We make sure we don't trigger our `onDismiss` in such case.
337
+ onFocusOutside: composeEventHandlers(props.onFocusOutside, function(event) {
338
+ return event.preventDefault();
339
+ })
340
+ }), !props.unstyled && {
341
+ outlineStyle: "none"
342
+ }), children);
343
+ }), DialogContentNonModal = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
344
+ var hasInteractedOutsideRef = React.useRef(!1);
345
+ return /* @__PURE__ */ React.createElement(DialogContentImpl, _object_spread_props(_object_spread({}, props), {
346
+ ref: forwardedRef,
347
+ trapFocus: !1,
348
+ disableOutsidePointerEvents: !1,
349
+ onCloseAutoFocus: function(event) {
350
+ var _props_onCloseAutoFocus;
351
+ if ((_props_onCloseAutoFocus = props.onCloseAutoFocus) === null || _props_onCloseAutoFocus === void 0 || _props_onCloseAutoFocus.call(props, event), !event.defaultPrevented) {
352
+ if (!hasInteractedOutsideRef.current) {
353
+ var _props_context_triggerRef_current;
354
+ (_props_context_triggerRef_current = props.context.triggerRef.current) === null || _props_context_triggerRef_current === void 0 || _props_context_triggerRef_current.focus();
248
355
  }
356
+ event.preventDefault();
249
357
  }
250
- );
251
- }
252
- ), DialogContentImpl = React.forwardRef(
253
- (props, forwardedRef) => {
254
- const {
255
- __scopeDialog,
256
- trapFocus,
257
- onOpenAutoFocus,
258
- onCloseAutoFocus,
259
- disableOutsidePointerEvents,
260
- onEscapeKeyDown,
261
- onPointerDownOutside,
262
- onFocusOutside,
263
- onInteractOutside,
264
- context,
265
- ...contentProps
266
- } = props, contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), showSheet = useShowDialogSheet(context), contents = /* @__PURE__ */ jsx(
267
- DialogContentFrame,
268
- {
269
- id: context.contentId,
270
- "aria-describedby": context.descriptionId,
271
- "aria-labelledby": context.titleId,
272
- "data-state": getState(context.open),
273
- ...contentProps
358
+ hasInteractedOutsideRef.current = !1;
359
+ },
360
+ onInteractOutside: function(event) {
361
+ var _props_onInteractOutside;
362
+ (_props_onInteractOutside = props.onInteractOutside) === null || _props_onInteractOutside === void 0 || _props_onInteractOutside.call(props, event), event.defaultPrevented || (hasInteractedOutsideRef.current = !0);
363
+ var target = event.target, trigger = props.context.triggerRef.current;
364
+ if (_instanceof(trigger, HTMLElement)) {
365
+ var targetIsTrigger = trigger.contains(target);
366
+ targetIsTrigger && event.preventDefault();
274
367
  }
275
- );
276
- return showSheet ? /* @__PURE__ */ jsx(DialogPortalItem, { hostName: getSheetContentsName(context), children: contentProps.children }) : isWeb ? /* @__PURE__ */ jsxs(Fragment, { children: [
277
- /* @__PURE__ */ jsx(
278
- Dismissable,
279
- {
280
- disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
281
- forceUnmount: !context.open,
282
- onEscapeKeyDown,
283
- onPointerDownOutside,
284
- onFocusOutside,
285
- onInteractOutside,
286
- ref: composedRefs,
287
- onDismiss: () => context.onOpenChange(!1),
288
- children: /* @__PURE__ */ jsx(
289
- FocusScope,
290
- {
291
- loop: !0,
292
- enabled: context.open,
293
- trapped: trapFocus,
294
- onMountAutoFocus: onOpenAutoFocus,
295
- forceUnmount: !context.open,
296
- onUnmountAutoFocus: onCloseAutoFocus,
297
- children: contents
298
- }
299
- )
300
- }
301
- ),
302
- process.env.NODE_ENV === "development" && /* @__PURE__ */ jsxs(Fragment, { children: [
303
- /* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
304
- /* @__PURE__ */ jsx(
305
- DescriptionWarning,
306
- {
307
- contentRef,
308
- descriptionId: context.descriptionId
309
- }
310
- )
311
- ] })
312
- ] }) : contents;
313
- }
314
- ), TITLE_NAME = "DialogTitle", DialogTitleFrame = styled(H2, {
368
+ }
369
+ }));
370
+ }), DialogContentImpl = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
371
+ var __scopeDialog = props.__scopeDialog, trapFocus = props.trapFocus, onOpenAutoFocus = props.onOpenAutoFocus, onCloseAutoFocus = props.onCloseAutoFocus, disableOutsidePointerEvents = props.disableOutsidePointerEvents, onEscapeKeyDown = props.onEscapeKeyDown, onPointerDownOutside = props.onPointerDownOutside, onFocusOutside = props.onFocusOutside, onInteractOutside = props.onInteractOutside, context = props.context, contentProps = _object_without_properties(props, [
372
+ "__scopeDialog",
373
+ "trapFocus",
374
+ "onOpenAutoFocus",
375
+ "onCloseAutoFocus",
376
+ "disableOutsidePointerEvents",
377
+ "onEscapeKeyDown",
378
+ "onPointerDownOutside",
379
+ "onFocusOutside",
380
+ "onInteractOutside",
381
+ "context"
382
+ ]), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), showSheet = useShowDialogSheet(context), contents = /* @__PURE__ */ React.createElement(DialogContentFrame, _object_spread({
383
+ id: context.contentId,
384
+ "aria-describedby": context.descriptionId,
385
+ "aria-labelledby": context.titleId,
386
+ "data-state": getState(context.open)
387
+ }, contentProps));
388
+ return showSheet ? /* @__PURE__ */ React.createElement(DialogPortalItem, {
389
+ hostName: getSheetContentsName(context)
390
+ }, contentProps.children) : isWeb ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Dismissable, {
391
+ disableOutsidePointerEvents: context.open && disableOutsidePointerEvents,
392
+ forceUnmount: !context.open,
393
+ onEscapeKeyDown,
394
+ onPointerDownOutside,
395
+ onFocusOutside,
396
+ onInteractOutside,
397
+ // @ts-ignore
398
+ ref: composedRefs,
399
+ onDismiss: function() {
400
+ return context.onOpenChange(!1);
401
+ }
402
+ }, /* @__PURE__ */ React.createElement(FocusScope, {
403
+ loop: !0,
404
+ enabled: context.open,
405
+ trapped: trapFocus,
406
+ onMountAutoFocus: onOpenAutoFocus,
407
+ forceUnmount: !context.open,
408
+ onUnmountAutoFocus: onCloseAutoFocus
409
+ }, contents)), process.env.NODE_ENV === "development" && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TitleWarning, {
410
+ titleId: context.titleId
411
+ }), /* @__PURE__ */ React.createElement(DescriptionWarning, {
412
+ contentRef,
413
+ descriptionId: context.descriptionId
414
+ }))) : contents;
415
+ }), TITLE_NAME = "DialogTitle", DialogTitleFrame = styled(H2, {
315
416
  name: TITLE_NAME
316
- }), DialogTitle = DialogTitleFrame.styleable(
317
- (props, forwardedRef) => {
318
- const { __scopeDialog, ...titleProps } = props, context = useDialogContext(TITLE_NAME, __scopeDialog);
319
- return /* @__PURE__ */ jsx(DialogTitleFrame, { id: context.titleId, ...titleProps, ref: forwardedRef });
320
- }
321
- );
417
+ }), DialogTitle = DialogTitleFrame.styleable(function(props, forwardedRef) {
418
+ var __scopeDialog = props.__scopeDialog, titleProps = _object_without_properties(props, [
419
+ "__scopeDialog"
420
+ ]), context = useDialogContext(TITLE_NAME, __scopeDialog);
421
+ return /* @__PURE__ */ React.createElement(DialogTitleFrame, _object_spread_props(_object_spread({
422
+ id: context.titleId
423
+ }, titleProps), {
424
+ ref: forwardedRef
425
+ }));
426
+ });
322
427
  DialogTitle.displayName = TITLE_NAME;
323
- const DialogDescriptionFrame = styled(Paragraph, {
428
+ var DialogDescriptionFrame = styled(Paragraph, {
324
429
  name: "DialogDescription"
325
- }), DESCRIPTION_NAME = "DialogDescription", DialogDescription = DialogDescriptionFrame.styleable(
326
- (props, forwardedRef) => {
327
- const { __scopeDialog, ...descriptionProps } = props, context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
328
- return /* @__PURE__ */ jsx(
329
- DialogDescriptionFrame,
330
- {
331
- id: context.descriptionId,
332
- ...descriptionProps,
333
- ref: forwardedRef
334
- }
335
- );
336
- }
337
- );
430
+ }), DESCRIPTION_NAME = "DialogDescription", DialogDescription = DialogDescriptionFrame.styleable(function(props, forwardedRef) {
431
+ var __scopeDialog = props.__scopeDialog, descriptionProps = _object_without_properties(props, [
432
+ "__scopeDialog"
433
+ ]), context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
434
+ return /* @__PURE__ */ React.createElement(DialogDescriptionFrame, _object_spread_props(_object_spread({
435
+ id: context.descriptionId
436
+ }, descriptionProps), {
437
+ ref: forwardedRef
438
+ }));
439
+ });
338
440
  DialogDescription.displayName = DESCRIPTION_NAME;
339
- const CLOSE_NAME = "DialogClose", DialogCloseFrame = styled(View, {
441
+ var CLOSE_NAME = "DialogClose", DialogCloseFrame = styled(View, {
340
442
  name: CLOSE_NAME,
341
443
  tag: "button"
342
- }), DialogClose = DialogCloseFrame.styleable(
343
- (props, forwardedRef) => {
344
- const { __scopeDialog, displayWhenAdapted, ...closeProps } = props, context = useDialogContext(CLOSE_NAME, __scopeDialog, {
345
- warn: !1,
346
- fallback: {}
347
- }), isSheet = useShowDialogSheet(context), isInsideButton = React.useContext(ButtonNestingContext);
348
- return isSheet && !displayWhenAdapted ? null : /* @__PURE__ */ jsx(
349
- DialogCloseFrame,
350
- {
351
- accessibilityLabel: "Dialog Close",
352
- tag: isInsideButton ? "span" : "button",
353
- ...closeProps,
354
- ref: forwardedRef,
355
- onPress: composeEventHandlers(
356
- props.onPress,
357
- () => context.onOpenChange(!1)
358
- )
359
- }
360
- );
361
- }
362
- );
444
+ }), DialogClose = DialogCloseFrame.styleable(function(props, forwardedRef) {
445
+ var __scopeDialog = props.__scopeDialog, displayWhenAdapted = props.displayWhenAdapted, closeProps = _object_without_properties(props, [
446
+ "__scopeDialog",
447
+ "displayWhenAdapted"
448
+ ]), context = useDialogContext(CLOSE_NAME, __scopeDialog, {
449
+ warn: !1,
450
+ fallback: {}
451
+ }), isSheet = useShowDialogSheet(context), isInsideButton = React.useContext(ButtonNestingContext);
452
+ return isSheet && !displayWhenAdapted ? null : /* @__PURE__ */ React.createElement(DialogCloseFrame, _object_spread_props(_object_spread({
453
+ accessibilityLabel: "Dialog Close",
454
+ tag: isInsideButton ? "span" : "button"
455
+ }, closeProps), {
456
+ ref: forwardedRef,
457
+ onPress: composeEventHandlers(props.onPress, function() {
458
+ return context.onOpenChange(!1);
459
+ })
460
+ }));
461
+ });
363
462
  function getState(open) {
364
463
  return open ? "open" : "closed";
365
464
  }
366
- const TITLE_WARNING_NAME = "DialogTitleWarning", [DialogWarningProvider, useWarningContext] = createContext(TITLE_WARNING_NAME, {
465
+ var TITLE_WARNING_NAME = "DialogTitleWarning", _createContext = _sliced_to_array(createContext(TITLE_WARNING_NAME, {
367
466
  contentName: CONTENT_NAME,
368
467
  titleName: TITLE_NAME,
369
468
  docsSlug: "dialog"
370
- }), TitleWarning = ({ titleId }) => {
469
+ }), 2), DialogWarningProvider = _createContext[0], useWarningContext = _createContext[1], TitleWarning = function(param) {
470
+ var titleId = param.titleId;
371
471
  if (process.env.NODE_ENV === "development") {
372
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME), MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
373
-
374
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.`;
375
- React.useEffect(() => {
376
- isWeb && titleId && (document.getElementById(titleId) || console.warn(MESSAGE));
377
- }, [MESSAGE, titleId]);
472
+ var titleWarningContext = useWarningContext(TITLE_WARNING_NAME), MESSAGE = "`".concat(titleWarningContext.contentName, "` requires a `").concat(titleWarningContext.titleName, "` for the component to be accessible for screen reader users.\n\nIf you want to hide the `").concat(titleWarningContext.titleName, "`, you can wrap it with our VisuallyHidden component.");
473
+ React.useEffect(function() {
474
+ if (isWeb && titleId) {
475
+ var hasTitle = document.getElementById(titleId);
476
+ hasTitle || console.warn(MESSAGE);
477
+ }
478
+ }, [
479
+ MESSAGE,
480
+ titleId
481
+ ]);
378
482
  }
379
483
  return null;
380
- }, DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning", DescriptionWarning = ({
381
- contentRef,
382
- descriptionId
383
- }) => {
484
+ }, DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning", DescriptionWarning = function(param) {
485
+ var contentRef = param.contentRef, descriptionId = param.descriptionId;
384
486
  if (process.env.NODE_ENV === "development") {
385
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;
386
- React.useEffect(() => {
387
- if (!isWeb)
388
- return;
389
- const contentNode = contentRef.current;
390
- if (!(contentNode instanceof HTMLElement))
391
- return;
392
- const describedById = contentNode.getAttribute("aria-describedby");
393
- descriptionId && describedById && (document.getElementById(descriptionId) || console.warn(MESSAGE));
394
- }, [MESSAGE, contentRef, descriptionId]);
487
+ var descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME), MESSAGE = "Warning: Missing `Description` or `aria-describedby={undefined}` for {".concat(descriptionWarningContext.contentName, "}.");
488
+ React.useEffect(function() {
489
+ if (isWeb) {
490
+ var contentNode = contentRef.current;
491
+ if (_instanceof(contentNode, HTMLElement)) {
492
+ var describedById = contentNode.getAttribute("aria-describedby");
493
+ if (descriptionId && describedById) {
494
+ var hasDescription = document.getElementById(descriptionId);
495
+ hasDescription || console.warn(MESSAGE);
496
+ }
497
+ }
498
+ }
499
+ }, [
500
+ MESSAGE,
501
+ contentRef,
502
+ descriptionId
503
+ ]);
395
504
  }
396
505
  return null;
397
- }, Dialog = withStaticProperties(
398
- React.forwardRef(function(props, ref) {
399
- const {
400
- __scopeDialog,
401
- children,
402
- open: openProp,
403
- defaultOpen = !1,
404
- onOpenChange,
405
- modal = !0,
406
- allowPinchZoom = !1,
407
- disableRemoveScroll = !1
408
- } = props, baseId = React.useId(), scopeId = `scope-${baseId}`, contentId = `content-${baseId}`, titleId = `title-${baseId}`, descriptionId = `description-${baseId}`, scopeKey = __scopeDialog ? Object.keys(__scopeDialog)[0] : scopeId, sheetContentsName = getSheetContentsName({ scopeKey, contentId }), triggerRef = React.useRef(null), contentRef = React.useRef(null), [open, setOpen] = useControllableState({
409
- prop: openProp,
410
- defaultProp: defaultOpen,
411
- onChange: onOpenChange
412
- }), onOpenToggle = React.useCallback(() => {
413
- setOpen((prevOpen) => !prevOpen);
414
- }, [setOpen]), context = {
415
- scope: __scopeDialog,
416
- scopeKey,
417
- triggerRef,
418
- contentRef,
419
- contentId,
420
- titleId,
421
- descriptionId,
422
- open,
423
- onOpenChange: setOpen,
424
- onOpenToggle,
425
- modal,
426
- allowPinchZoom
427
- }, { when, AdaptProvider } = useAdaptParent({
428
- Contents: React.useCallback(
429
- (props2) => /* @__PURE__ */ jsx(PortalHost, { forwardProps: props2, name: sheetContentsName }),
430
- [sheetContentsName]
431
- )
506
+ }, Dialog = withStaticProperties(/* @__PURE__ */ React.forwardRef(function(props, ref) {
507
+ var __scopeDialog = props.__scopeDialog, children = props.children, openProp = props.open, _props_defaultOpen = props.defaultOpen, defaultOpen = _props_defaultOpen === void 0 ? !1 : _props_defaultOpen, onOpenChange = props.onOpenChange, _props_modal = props.modal, modal = _props_modal === void 0 ? !0 : _props_modal, _props_allowPinchZoom = props.allowPinchZoom, allowPinchZoom = _props_allowPinchZoom === void 0 ? !1 : _props_allowPinchZoom, _props_disableRemoveScroll = props.disableRemoveScroll, disableRemoveScroll = _props_disableRemoveScroll === void 0 ? !1 : _props_disableRemoveScroll, baseId = React.useId(), scopeId = "scope-".concat(baseId), contentId = "content-".concat(baseId), titleId = "title-".concat(baseId), descriptionId = "description-".concat(baseId), scopeKey = __scopeDialog ? Object.keys(__scopeDialog)[0] : scopeId, sheetContentsName = getSheetContentsName({
508
+ scopeKey,
509
+ contentId
510
+ }), triggerRef = React.useRef(null), contentRef = React.useRef(null), _useControllableState = _sliced_to_array(useControllableState({
511
+ prop: openProp,
512
+ defaultProp: defaultOpen,
513
+ onChange: onOpenChange
514
+ }), 2), open = _useControllableState[0], setOpen = _useControllableState[1], onOpenToggle = React.useCallback(function() {
515
+ setOpen(function(prevOpen) {
516
+ return !prevOpen;
432
517
  });
433
- return React.useImperativeHandle(
434
- ref,
435
- () => ({
436
- open: setOpen
437
- }),
438
- [setOpen]
439
- ), /* @__PURE__ */ jsx(AdaptProvider, { children: /* @__PURE__ */ jsx(
440
- DialogProvider,
441
- {
442
- ...context,
443
- sheetBreakpoint: when,
444
- disableRemoveScroll,
445
- children: /* @__PURE__ */ jsx(DialogSheetController, { onOpenChange: setOpen, __scopeDialog, children })
446
- }
447
- ) });
448
- }),
449
- {
450
- Trigger: DialogTrigger,
451
- Portal: DialogPortal,
452
- Overlay: DialogOverlay,
453
- Content: DialogContent,
454
- Title: DialogTitle,
455
- Description: DialogDescription,
456
- Close: DialogClose,
457
- Sheet: Sheet.Controlled,
458
- Adapt
459
- }
460
- ), SHEET_CONTENTS_NAME = "DialogSheetContents", DialogSheetContents = ({
461
- name,
462
- ...props
463
- }) => /* @__PURE__ */ jsx(PortalHost, { forwardProps: props, name });
518
+ }, [
519
+ setOpen
520
+ ]), context = {
521
+ scope: __scopeDialog,
522
+ scopeKey,
523
+ triggerRef,
524
+ contentRef,
525
+ contentId,
526
+ titleId,
527
+ descriptionId,
528
+ open,
529
+ onOpenChange: setOpen,
530
+ onOpenToggle,
531
+ modal,
532
+ allowPinchZoom
533
+ }, _useAdaptParent = useAdaptParent({
534
+ Contents: React.useCallback(function(props2) {
535
+ return /* @__PURE__ */ React.createElement(PortalHost, {
536
+ forwardProps: props2,
537
+ name: sheetContentsName
538
+ });
539
+ }, [
540
+ sheetContentsName
541
+ ])
542
+ }), when = _useAdaptParent.when, AdaptProvider = _useAdaptParent.AdaptProvider;
543
+ return React.useImperativeHandle(ref, function() {
544
+ return {
545
+ open: setOpen
546
+ };
547
+ }, [
548
+ setOpen
549
+ ]), /* @__PURE__ */ React.createElement(AdaptProvider, null, /* @__PURE__ */ React.createElement(DialogProvider, _object_spread_props(_object_spread({}, context), {
550
+ sheetBreakpoint: when,
551
+ disableRemoveScroll
552
+ }), /* @__PURE__ */ React.createElement(DialogSheetController, {
553
+ onOpenChange: setOpen,
554
+ __scopeDialog
555
+ }, children)));
556
+ }), {
557
+ Trigger: DialogTrigger,
558
+ Portal: DialogPortal,
559
+ Overlay: DialogOverlay,
560
+ Content: DialogContent,
561
+ Title: DialogTitle,
562
+ Description: DialogDescription,
563
+ Close: DialogClose,
564
+ Sheet: Sheet.Controlled,
565
+ Adapt
566
+ }), SHEET_CONTENTS_NAME = "DialogSheetContents", DialogSheetContents = function(_param) {
567
+ var name = _param.name, props = _object_without_properties(_param, [
568
+ "name"
569
+ ]);
570
+ return /* @__PURE__ */ React.createElement(PortalHost, {
571
+ forwardProps: props,
572
+ name
573
+ });
574
+ };
464
575
  DialogSheetContents.displayName = SHEET_CONTENTS_NAME;
465
- const getSheetContentsName = ({
466
- scopeKey,
467
- contentId
468
- }) => `${scopeKey || contentId}SheetContents`, DialogSheetController = (props) => {
469
- const context = useDialogContext("DialogSheetController", props.__scopeDialog), showSheet = useShowDialogSheet(context), breakpointActive = useSheetBreakpointActive(context), getShowSheet = useGet(showSheet);
470
- return /* @__PURE__ */ jsx(
471
- SheetController,
472
- {
473
- onOpenChange: (val) => {
474
- getShowSheet() && props.onOpenChange(val);
475
- },
476
- open: context.open,
477
- hidden: breakpointActive === !1,
478
- children: props.children
479
- }
480
- );
481
- }, useSheetBreakpointActive = (context) => {
482
- const media = useMedia();
576
+ var getSheetContentsName = function(param) {
577
+ var scopeKey = param.scopeKey, contentId = param.contentId;
578
+ return "".concat(scopeKey || contentId, "SheetContents");
579
+ }, DialogSheetController = function(props) {
580
+ var context = useDialogContext("DialogSheetController", props.__scopeDialog), showSheet = useShowDialogSheet(context), breakpointActive = useSheetBreakpointActive(context), getShowSheet = useGet(showSheet);
581
+ return /* @__PURE__ */ React.createElement(SheetController, {
582
+ onOpenChange: function(val) {
583
+ getShowSheet() && props.onOpenChange(val);
584
+ },
585
+ open: context.open,
586
+ hidden: breakpointActive === !1
587
+ }, props.children);
588
+ }, useSheetBreakpointActive = function(context) {
589
+ var media = useMedia();
483
590
  return context.sheetBreakpoint ? context.sheetBreakpoint === !0 ? !0 : media[context.sheetBreakpoint] : !1;
484
- }, useShowDialogSheet = (context) => {
485
- const breakpointActive = useSheetBreakpointActive(context);
591
+ }, useShowDialogSheet = function(context) {
592
+ var breakpointActive = useSheetBreakpointActive(context);
486
593
  return context.open === !1 ? !1 : breakpointActive;
487
594
  };
488
595
  export {