@tamagui/popover 1.0.1-beta.21 → 1.0.1-beta.211

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,17 +1,21 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ import { jsx } from "react/jsx-runtime";
3
2
  import "@tamagui/polyfill-dev";
4
- import {
5
- useDismiss,
6
- useFloating,
7
- useFocus,
8
- useInteractions,
9
- useRole
10
- } from "@floating-ui/react-dom-interactions";
11
3
  import { AnimatePresence } from "@tamagui/animate-presence";
4
+ import { hideOthers } from "@tamagui/aria-hidden";
12
5
  import { useComposedRefs } from "@tamagui/compose-refs";
13
- import { composeEventHandlers, useId, withStaticProperties } from "@tamagui/core";
6
+ import {
7
+ Theme,
8
+ composeEventHandlers,
9
+ isWeb,
10
+ useEvent,
11
+ useGet,
12
+ useId,
13
+ useMedia,
14
+ useThemeName,
15
+ withStaticProperties
16
+ } from "@tamagui/core";
14
17
  import { createContextScope } from "@tamagui/create-context";
18
+ import { FocusScope } from "@tamagui/focus-scope";
15
19
  import {
16
20
  FloatingOverrideContext,
17
21
  Popper,
@@ -20,10 +24,14 @@ import {
20
24
  PopperContent,
21
25
  createPopperScope
22
26
  } from "@tamagui/popper";
23
- import { Portal } from "@tamagui/portal";
27
+ import { Portal, PortalHost, PortalItem } from "@tamagui/portal";
28
+ import { RemoveScroll } from "@tamagui/remove-scroll";
29
+ import { ControlledSheet, SheetController } from "@tamagui/sheet";
24
30
  import { YStack } from "@tamagui/stacks";
25
31
  import { useControllableState } from "@tamagui/use-controllable-state";
26
32
  import * as React from "react";
33
+ import { ScrollView } from "react-native";
34
+ import { useDismiss, useFloating, useFocus, useInteractions, useRole } from "./floating";
27
35
  const POPOVER_NAME = "Popover";
28
36
  const [createPopoverContext, createPopoverScopeInternal] = createContextScope(POPOVER_NAME, [
29
37
  createPopperScope
@@ -33,232 +41,326 @@ const createPopoverScope = createPopoverScopeInternal;
33
41
  const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
34
42
  const __PopoverProviderInternal = PopoverProviderInternal;
35
43
  const ANCHOR_NAME = "PopoverAnchor";
36
- const PopoverAnchor = React.forwardRef((props, forwardedRef) => {
37
- const { __scopePopover, ...anchorProps } = props;
38
- const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
39
- const popperScope = usePopoverScope(__scopePopover);
40
- const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
41
- React.useEffect(() => {
42
- onCustomAnchorAdd();
43
- return () => onCustomAnchorRemove();
44
- }, [onCustomAnchorAdd, onCustomAnchorRemove]);
45
- return /* @__PURE__ */ React.createElement(PopperAnchor, {
46
- ...popperScope,
47
- ...anchorProps,
48
- ref: forwardedRef
49
- });
50
- });
44
+ const PopoverAnchor = React.forwardRef(
45
+ (props, forwardedRef) => {
46
+ const { __scopePopover, ...anchorProps } = props;
47
+ const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
48
+ const popperScope = usePopoverScope(__scopePopover);
49
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
50
+ React.useEffect(() => {
51
+ onCustomAnchorAdd();
52
+ return () => onCustomAnchorRemove();
53
+ }, [onCustomAnchorAdd, onCustomAnchorRemove]);
54
+ return /* @__PURE__ */ jsx(PopperAnchor, {
55
+ ...popperScope,
56
+ ...anchorProps,
57
+ ref: forwardedRef
58
+ });
59
+ }
60
+ );
51
61
  PopoverAnchor.displayName = ANCHOR_NAME;
52
62
  const TRIGGER_NAME = "PopoverTrigger";
53
- const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
54
- const { __scopePopover, ...triggerProps } = props;
55
- const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
56
- const popperScope = usePopoverScope(__scopePopover);
57
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
58
- const trigger = /* @__PURE__ */ React.createElement(YStack, {
59
- "aria-haspopup": "dialog",
60
- "aria-expanded": context.open,
61
- "aria-controls": context.contentId,
62
- "data-state": getState(context.open),
63
- ...triggerProps,
64
- ref: composedTriggerRef,
65
- onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
66
- });
67
- return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React.createElement(PopperAnchor, {
68
- asChild: true,
69
- ...popperScope
70
- }, trigger);
71
- });
63
+ const PopoverTrigger = React.forwardRef(
64
+ (props, forwardedRef) => {
65
+ const { __scopePopover, ...triggerProps } = props;
66
+ const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
67
+ const popperScope = usePopoverScope(__scopePopover);
68
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
69
+ const trigger = /* @__PURE__ */ jsx(YStack, {
70
+ "aria-haspopup": "dialog",
71
+ "aria-expanded": context.open,
72
+ "data-state": getState(context.open),
73
+ ...triggerProps,
74
+ ref: composedTriggerRef,
75
+ onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
76
+ });
77
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperAnchor, {
78
+ asChild: true,
79
+ ...popperScope,
80
+ children: trigger
81
+ });
82
+ }
83
+ );
72
84
  PopoverTrigger.displayName = TRIGGER_NAME;
73
85
  const CONTENT_NAME = "PopoverContent";
74
- const PopoverContent = React.forwardRef((props, forwardedRef) => {
75
- const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
76
- return context.modal ? /* @__PURE__ */ React.createElement(PopoverContentModal, {
77
- ...props,
78
- ref: forwardedRef
79
- }) : /* @__PURE__ */ React.createElement(PopoverContentNonModal, {
80
- ...props,
81
- ref: forwardedRef
82
- });
83
- });
84
- PopoverContent.displayName = CONTENT_NAME;
85
- const PopoverContentModal = React.forwardRef((props, forwardedRef) => {
86
- const { allowPinchZoom, ...contentModalProps } = props;
87
- const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
88
- const contentRef = React.useRef(null);
89
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
90
- const isRightClickOutsideRef = React.useRef(false);
91
- const PortalWrapper = context.modal ? Portal : React.Fragment;
92
- return /* @__PURE__ */ React.createElement(PortalWrapper, null, /* @__PURE__ */ React.createElement(PopoverContentImpl, {
93
- ...contentModalProps,
94
- ref: composedRefs,
95
- trapFocus: context.open,
96
- disableOutsidePointerEvents: true,
97
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
98
- var _a;
99
- event.preventDefault();
100
- if (!isRightClickOutsideRef.current)
101
- (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
102
- }),
103
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
104
- console.log("pinter outside", event);
105
- const originalEvent = event.detail.originalEvent;
106
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
107
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
108
- isRightClickOutsideRef.current = isRightClick;
109
- }, { checkDefaultPrevented: false }),
110
- onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => event.preventDefault(), { checkDefaultPrevented: false })
111
- }));
112
- });
113
- const PopoverContentNonModal = React.forwardRef((props, forwardedRef) => {
114
- const { ...contentNonModalProps } = props;
115
- const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
116
- const hasInteractedOutsideRef = React.useRef(false);
117
- const PortalWrapper = context.modal ? Portal : React.Fragment;
118
- return /* @__PURE__ */ React.createElement(PortalWrapper, null, /* @__PURE__ */ React.createElement(PopoverContentImpl, {
119
- ...contentNonModalProps,
120
- ref: forwardedRef,
121
- trapFocus: false,
122
- disableOutsidePointerEvents: false,
123
- onCloseAutoFocus: (event) => {
124
- var _a, _b;
125
- (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
126
- if (!event.defaultPrevented) {
127
- if (!hasInteractedOutsideRef.current)
128
- (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
129
- event.preventDefault();
130
- }
131
- hasInteractedOutsideRef.current = false;
132
- },
133
- onInteractOutside: (event) => {
134
- var _a, _b;
135
- (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
136
- if (!event.defaultPrevented)
137
- hasInteractedOutsideRef.current = true;
138
- const target = event.target;
139
- const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
140
- if (targetIsTrigger)
141
- event.preventDefault();
86
+ const PopoverContent = React.forwardRef(
87
+ (props, forwardedRef) => {
88
+ const { allowPinchZoom, trapFocus, disableRemoveScroll = true, ...contentModalProps } = props;
89
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
90
+ const contentRef = React.useRef(null);
91
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
92
+ const isRightClickOutsideRef = React.useRef(false);
93
+ const themeName = useThemeName();
94
+ React.useEffect(() => {
95
+ if (!context.open)
96
+ return;
97
+ const content = contentRef.current;
98
+ if (content)
99
+ return hideOthers(content);
100
+ }, [context.open]);
101
+ return /* @__PURE__ */ jsx(Portal, {
102
+ zIndex: props.zIndex ?? 1e3,
103
+ children: /* @__PURE__ */ jsx(Theme, {
104
+ name: themeName,
105
+ children: /* @__PURE__ */ jsx(PopoverContentImpl, {
106
+ ...contentModalProps,
107
+ disableRemoveScroll,
108
+ ref: composedRefs,
109
+ trapFocus: trapFocus ?? context.open,
110
+ disableOutsidePointerEvents: true,
111
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
112
+ var _a;
113
+ event.preventDefault();
114
+ if (!isRightClickOutsideRef.current)
115
+ (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
116
+ }),
117
+ onPointerDownOutside: composeEventHandlers(
118
+ props.onPointerDownOutside,
119
+ (event) => {
120
+ const originalEvent = event.detail.originalEvent;
121
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
122
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
123
+ isRightClickOutsideRef.current = isRightClick;
124
+ },
125
+ { checkDefaultPrevented: false }
126
+ ),
127
+ onFocusOutside: composeEventHandlers(
128
+ props.onFocusOutside,
129
+ (event) => event.preventDefault(),
130
+ { checkDefaultPrevented: false }
131
+ )
132
+ })
133
+ })
134
+ });
135
+ }
136
+ );
137
+ const PopoverContentImpl = React.forwardRef(
138
+ (props, forwardedRef) => {
139
+ const {
140
+ __scopePopover,
141
+ trapFocus,
142
+ onOpenAutoFocus,
143
+ onCloseAutoFocus,
144
+ disableOutsidePointerEvents,
145
+ onEscapeKeyDown,
146
+ onPointerDownOutside,
147
+ onFocusOutside,
148
+ onInteractOutside,
149
+ children,
150
+ disableRemoveScroll,
151
+ ...contentProps
152
+ } = props;
153
+ const popperScope = usePopoverScope(__scopePopover);
154
+ const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover);
155
+ const showSheet = useShowPopoverSheet(context);
156
+ if (showSheet) {
157
+ const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {
158
+ if (React.isValidElement(child)) {
159
+ if (child.type === PopoverScrollView) {
160
+ return child.props.children;
161
+ }
162
+ }
163
+ return child;
164
+ });
165
+ return /* @__PURE__ */ jsx(PortalItem, {
166
+ hostName: `${context.scopeKey}SheetContents`,
167
+ children: childrenWithoutScrollView
168
+ });
142
169
  }
143
- }));
144
- });
145
- const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
146
- const {
147
- __scopePopover,
148
- trapFocus,
149
- onOpenAutoFocus,
150
- onCloseAutoFocus,
151
- disableOutsidePointerEvents,
152
- onEscapeKeyDown,
153
- onPointerDownOutside,
154
- onFocusOutside,
155
- onInteractOutside,
156
- ...contentProps
157
- } = props;
158
- const context = usePopoverInternalContext(CONTENT_NAME, __scopePopover);
159
- const popperScope = usePopoverScope(__scopePopover);
160
- return /* @__PURE__ */ React.createElement(AnimatePresence, null, !!context.open && /* @__PURE__ */ React.createElement(PopperContent, {
161
- "data-state": getState(context.open),
162
- id: context.contentId,
163
- pointerEvents: "auto",
164
- ...popperScope,
165
- ...contentProps,
166
- ref: forwardedRef
167
- }));
168
- });
170
+ return /* @__PURE__ */ jsx(AnimatePresence, {
171
+ children: !!context.open && /* @__PURE__ */ jsx(PopperContent, {
172
+ "data-state": getState(context.open),
173
+ id: context.contentId,
174
+ pointerEvents: "auto",
175
+ ...popperScope,
176
+ ...contentProps,
177
+ ref: forwardedRef,
178
+ children: /* @__PURE__ */ jsx(RemoveScroll, {
179
+ enabled: disableRemoveScroll ? false : context.open,
180
+ allowPinchZoom: true,
181
+ removeScrollBar: false,
182
+ style: {
183
+ display: "contents"
184
+ },
185
+ children: trapFocus === false ? children : /* @__PURE__ */ jsx(FocusScope, {
186
+ loop: true,
187
+ trapped: trapFocus ?? context.open,
188
+ onMountAutoFocus: onOpenAutoFocus,
189
+ onUnmountAutoFocus: onCloseAutoFocus,
190
+ children: /* @__PURE__ */ jsx("div", {
191
+ style: { display: "contents" },
192
+ children
193
+ })
194
+ })
195
+ })
196
+ }, "popper-content")
197
+ });
198
+ }
199
+ );
169
200
  const CLOSE_NAME = "PopoverClose";
170
- const PopoverClose = React.forwardRef((props, forwardedRef) => {
171
- const { __scopePopover, ...closeProps } = props;
172
- const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
173
- return /* @__PURE__ */ React.createElement(YStack, {
174
- ...closeProps,
175
- ref: forwardedRef,
176
- onPress: composeEventHandlers(props.onPress, () => context.onOpenChange(false))
177
- });
178
- });
201
+ const PopoverClose = React.forwardRef(
202
+ (props, forwardedRef) => {
203
+ const { __scopePopover, ...closeProps } = props;
204
+ const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
205
+ return /* @__PURE__ */ jsx(YStack, {
206
+ ...closeProps,
207
+ ref: forwardedRef,
208
+ onPress: composeEventHandlers(props.onPress, () => context.onOpenChange(false))
209
+ });
210
+ }
211
+ );
179
212
  PopoverClose.displayName = CLOSE_NAME;
180
213
  const ARROW_NAME = "PopoverArrow";
181
- const PopoverArrow = React.forwardRef((props, forwardedRef) => {
182
- const { __scopePopover, ...arrowProps } = props;
183
- const popperScope = usePopoverScope(__scopePopover);
184
- return /* @__PURE__ */ React.createElement(PopperArrow, {
185
- ...popperScope,
186
- ...arrowProps,
187
- ref: forwardedRef
188
- });
189
- });
214
+ const PopoverArrow = React.forwardRef(
215
+ (props, forwardedRef) => {
216
+ const { __scopePopover, ...arrowProps } = props;
217
+ const popperScope = usePopoverScope(__scopePopover);
218
+ return /* @__PURE__ */ jsx(PopperArrow, {
219
+ ...popperScope,
220
+ ...arrowProps,
221
+ ref: forwardedRef
222
+ });
223
+ }
224
+ );
190
225
  PopoverArrow.displayName = ARROW_NAME;
191
- const Popover = withStaticProperties((props) => {
192
- const {
193
- __scopePopover,
194
- children,
195
- open: openProp,
196
- defaultOpen,
197
- onOpenChange,
198
- modal = true,
199
- ...restProps
200
- } = props;
201
- const popperScope = usePopoverScope(__scopePopover);
202
- const triggerRef = React.useRef(null);
203
- const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
204
- const [open, setOpen] = useControllableState({
205
- prop: openProp,
206
- defaultProp: defaultOpen || false,
207
- onChange: onOpenChange
226
+ const SHEET_CONTENTS_NAME = "PopoverSheetContents";
227
+ const PopoverSheetContents = ({ __scopePopover }) => {
228
+ const context = usePopoverInternalContext(SHEET_CONTENTS_NAME, __scopePopover);
229
+ return /* @__PURE__ */ jsx(PortalHost, {
230
+ name: `${context.scopeKey}SheetContents`
231
+ });
232
+ };
233
+ PopoverSheetContents.displayName = SHEET_CONTENTS_NAME;
234
+ const PopoverScrollView = React.forwardRef((props, ref) => {
235
+ return /* @__PURE__ */ jsx(ScrollView, {
236
+ ref,
237
+ ...props
208
238
  });
209
- const useFloatingFn = /* @__PURE__ */ __name((props2) => {
210
- const floating = useFloating({
211
- ...props2,
212
- open,
213
- onOpenChange: setOpen
214
- });
215
- const { getReferenceProps, getFloatingProps } = useInteractions([
216
- useFocus(floating.context),
217
- useRole(floating.context, { role: "dialog" }),
218
- useDismiss(floating.context)
219
- ]);
220
- return {
221
- ...floating,
222
- getReferenceProps,
223
- getFloatingProps
224
- };
225
- }, "useFloatingFn");
226
- const useFloatingContext = React.useCallback(useFloatingFn, [open]);
227
- return /* @__PURE__ */ React.createElement(FloatingOverrideContext.Provider, {
228
- value: useFloatingContext
229
- }, /* @__PURE__ */ React.createElement(Popper, {
230
- ...popperScope,
231
- ...restProps
232
- }, /* @__PURE__ */ React.createElement(PopoverProviderInternal, {
233
- scope: __scopePopover,
234
- contentId: useId(),
235
- triggerRef,
236
- open,
237
- onOpenChange: setOpen,
238
- onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
239
- hasCustomAnchor,
240
- onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
241
- onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
242
- modal
243
- }, children)));
244
- }, {
245
- Anchor: PopoverAnchor,
246
- Arrow: PopoverArrow,
247
- Trigger: PopoverTrigger,
248
- Content: PopoverContent,
249
- Close: PopoverClose
250
239
  });
240
+ const Popover = withStaticProperties(
241
+ (props) => {
242
+ const {
243
+ __scopePopover,
244
+ children,
245
+ open: openProp,
246
+ defaultOpen,
247
+ onOpenChange,
248
+ sheetBreakpoint = false,
249
+ ...restProps
250
+ } = props;
251
+ const popperScope = usePopoverScope(__scopePopover);
252
+ const triggerRef = React.useRef(null);
253
+ const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
254
+ const [open, setOpen] = useControllableState({
255
+ prop: openProp,
256
+ defaultProp: defaultOpen || false,
257
+ onChange: onOpenChange
258
+ });
259
+ const breakpointActive = useSheetBreakpointActive(sheetBreakpoint);
260
+ const useFloatingContext = React.useCallback(
261
+ (props2) => {
262
+ const floating = useFloating({
263
+ ...props2,
264
+ open,
265
+ onOpenChange: setOpen
266
+ });
267
+ const { getReferenceProps, getFloatingProps } = useInteractions([
268
+ useFocus(floating.context, {
269
+ enabled: !breakpointActive
270
+ }),
271
+ useRole(floating.context, { role: "dialog" }),
272
+ useDismiss(floating.context, {
273
+ enabled: !breakpointActive
274
+ })
275
+ ]);
276
+ return {
277
+ ...floating,
278
+ getReferenceProps,
279
+ getFloatingProps
280
+ };
281
+ },
282
+ [breakpointActive, open, setOpen]
283
+ );
284
+ return /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {
285
+ value: useFloatingContext,
286
+ children: /* @__PURE__ */ jsx(Popper, {
287
+ ...popperScope,
288
+ stayInFrame: true,
289
+ ...restProps,
290
+ children: /* @__PURE__ */ jsx(PopoverProviderInternal, {
291
+ scope: __scopePopover,
292
+ scopeKey: __scopePopover ? Object.keys(__scopePopover)[0] : "",
293
+ sheetBreakpoint,
294
+ contentId: useId(),
295
+ triggerRef,
296
+ open,
297
+ onOpenChange: setOpen,
298
+ onOpenToggle: useEvent(() => {
299
+ if (open && breakpointActive) {
300
+ return;
301
+ }
302
+ setOpen(!open);
303
+ }),
304
+ hasCustomAnchor,
305
+ onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
306
+ onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
307
+ children: /* @__PURE__ */ jsx(PopoverSheetController, {
308
+ onOpenChange: setOpen,
309
+ __scopePopover,
310
+ children
311
+ })
312
+ })
313
+ })
314
+ });
315
+ },
316
+ {
317
+ Anchor: PopoverAnchor,
318
+ Arrow: PopoverArrow,
319
+ Trigger: PopoverTrigger,
320
+ Content: PopoverContent,
321
+ Close: PopoverClose,
322
+ SheetContents: PopoverSheetContents,
323
+ ScrollView: PopoverScrollView,
324
+ Sheet: ControlledSheet
325
+ }
326
+ );
251
327
  Popover.displayName = POPOVER_NAME;
252
328
  function getState(open) {
253
329
  return open ? "open" : "closed";
254
330
  }
255
- __name(getState, "getState");
331
+ const PopoverSheetController = (props) => {
332
+ const context = usePopoverInternalContext("PopoverSheetController", props.__scopePopover);
333
+ const showSheet = useShowPopoverSheet(context);
334
+ const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint);
335
+ const getShowSheet = useGet(showSheet);
336
+ return /* @__PURE__ */ jsx(SheetController, {
337
+ onOpenChange: (val) => {
338
+ if (getShowSheet()) {
339
+ props.onOpenChange(val);
340
+ }
341
+ },
342
+ open: context.open,
343
+ hidden: breakpointActive === false,
344
+ children: props.children
345
+ });
346
+ };
347
+ const useSheetBreakpointActive = (breakpoint) => {
348
+ const media = useMedia();
349
+ return breakpoint ? media[breakpoint] : false;
350
+ };
351
+ const useShowPopoverSheet = (context) => {
352
+ if (!isWeb)
353
+ return true;
354
+ const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint);
355
+ return context.open === false ? false : breakpointActive;
356
+ };
256
357
  export {
257
358
  Popover,
258
359
  PopoverAnchor,
259
360
  PopoverArrow,
260
361
  PopoverClose,
261
362
  PopoverContent,
363
+ PopoverSheetContents,
262
364
  PopoverTrigger,
263
365
  __PopoverProviderInternal,
264
366
  createPopoverScope,