@tamagui/popover 1.61.2 → 1.62.0

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.
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: !0 });
10
+ }, __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from == "object" || typeof from == "function")
12
+ for (let key of __getOwnPropNames(from))
13
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
+ mod
23
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
+ var Popover_exports = {};
25
+ __export(Popover_exports, {
26
+ Popover: () => Popover,
27
+ PopoverAnchor: () => PopoverAnchor,
28
+ PopoverArrow: () => PopoverArrow,
29
+ PopoverClose: () => PopoverClose,
30
+ PopoverContent: () => PopoverContent,
31
+ PopoverContext: () => PopoverContext,
32
+ PopoverTrigger: () => PopoverTrigger,
33
+ usePopoverContext: () => usePopoverContext
34
+ });
35
+ module.exports = __toCommonJS(Popover_exports);
36
+ var import_polyfill_dev = require("@tamagui/polyfill-dev"), import_adapt = require("@tamagui/adapt"), import_animate = require("@tamagui/animate"), import_aria_hidden = require("@tamagui/aria-hidden"), import_compose_refs = require("@tamagui/compose-refs"), import_core = require("@tamagui/core"), import_floating = require("@tamagui/floating"), import_focus_scope = require("@tamagui/focus-scope"), import_popper = require("@tamagui/popper"), import_portal = require("@tamagui/portal"), import_remove_scroll = require("@tamagui/remove-scroll"), import_sheet = require("@tamagui/sheet"), import_stacks = require("@tamagui/stacks"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_react_freeze = require("react-freeze"), import_react_native = require("react-native"), import_useFloatingContext = require("./useFloatingContext"), import_jsx_runtime = require("react/jsx-runtime");
37
+ const PopoverContext = (0, import_core.createStyledContext)({}), usePopoverContext = () => React.useContext(PopoverContext), PopoverAnchor = React.forwardRef(
38
+ function(props, forwardedRef) {
39
+ const context = usePopoverContext(), { onCustomAnchorAdd, onCustomAnchorRemove } = context;
40
+ return React.useEffect(() => (onCustomAnchorAdd(), () => onCustomAnchorRemove()), [onCustomAnchorAdd, onCustomAnchorRemove]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperAnchor, { ...props, ref: forwardedRef });
41
+ }
42
+ ), PopoverTrigger = React.forwardRef(
43
+ function(props, forwardedRef) {
44
+ const context = usePopoverContext(), composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef), trigger = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
+ import_core.View,
46
+ {
47
+ "aria-haspopup": "dialog",
48
+ "aria-expanded": context.open,
49
+ "data-state": getState(context.open),
50
+ ...props,
51
+ ref: composedTriggerRef,
52
+ onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
53
+ }
54
+ );
55
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperAnchor, { asChild: !0, children: trigger });
56
+ }
57
+ ), PopoverContent = import_popper.PopperContentFrame.extractable(
58
+ React.forwardRef(
59
+ function(props, forwardedRef) {
60
+ const {
61
+ allowPinchZoom,
62
+ trapFocus,
63
+ disableRemoveScroll = !0,
64
+ zIndex,
65
+ ...contentImplProps
66
+ } = props, context = usePopoverContext(), contentRef = React.useRef(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), isRightClickOutsideRef = React.useRef(!1);
67
+ return React.useEffect(() => {
68
+ if (!context.open)
69
+ return;
70
+ const content = contentRef.current;
71
+ if (content)
72
+ return (0, import_aria_hidden.hideOthers)(content);
73
+ }, [context.open]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContentPortal, { zIndex: props.zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Stack, { pointerEvents: context.open ? "auto" : "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ PopoverContentImpl,
75
+ {
76
+ ...contentImplProps,
77
+ disableRemoveScroll,
78
+ ref: composedRefs,
79
+ trapFocus: trapFocus ?? context.open,
80
+ disableOutsidePointerEvents: !0,
81
+ onCloseAutoFocus: (0, import_core.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
82
+ event.preventDefault(), isRightClickOutsideRef.current || context.triggerRef.current?.focus();
83
+ }),
84
+ onPointerDownOutside: (0, import_core.composeEventHandlers)(
85
+ props.onPointerDownOutside,
86
+ (event) => {
87
+ const originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
88
+ isRightClickOutsideRef.current = isRightClick;
89
+ },
90
+ { checkDefaultPrevented: !1 }
91
+ ),
92
+ onFocusOutside: (0, import_core.composeEventHandlers)(
93
+ props.onFocusOutside,
94
+ (event) => event.preventDefault(),
95
+ { checkDefaultPrevented: !1 }
96
+ )
97
+ }
98
+ ) }) });
99
+ }
100
+ )
101
+ );
102
+ function PopoverRepropagateContext(props) {
103
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperContext.Provider, { ...props.popperContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContext.Provider, { ...props.context, children: props.children }) });
104
+ }
105
+ function PopoverContentPortal(props) {
106
+ const zIndex = props.zIndex ?? 15e4, context = usePopoverContext(), popperContext = (0, import_popper.usePopperContext)(), themeName = (0, import_core.useThemeName)();
107
+ let contents = props.children;
108
+ return (import_react_native.Platform.OS === "android" || import_react_native.Platform.OS === "ios") && (contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverRepropagateContext, { popperContext, context, children: props.children })), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Theme, { forceClassName: !0, name: themeName, children: [
109
+ !!context.open && !context.breakpointActive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
+ import_stacks.YStack,
111
+ {
112
+ fullscreen: !0,
113
+ onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
114
+ }
115
+ ),
116
+ contents
117
+ ] }) });
118
+ }
119
+ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
120
+ const {
121
+ trapFocus,
122
+ onOpenAutoFocus,
123
+ onCloseAutoFocus,
124
+ disableOutsidePointerEvents,
125
+ disableFocusScope,
126
+ onEscapeKeyDown,
127
+ onPointerDownOutside,
128
+ onFocusOutside,
129
+ onInteractOutside,
130
+ children,
131
+ disableRemoveScroll,
132
+ freezeContentsWhenHidden,
133
+ ...contentProps
134
+ } = props, context = usePopoverContext(), { open, keepChildrenMounted } = context, popperContext = (0, import_popper.usePopperContext)(), [isFullyHidden, setIsFullyHidden] = React.useState(!context.open), contents = React.useMemo(() => import_core.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "contents" }, children }) : children, [children]);
135
+ if (open && isFullyHidden && setIsFullyHidden(!1), !keepChildrenMounted && isFullyHidden)
136
+ return null;
137
+ if (context.breakpointActive) {
138
+ const childrenWithoutScrollView = React.Children.toArray(children).map((child) => React.isValidElement(child) && child.type === import_react_native.ScrollView ? child.props.children : child);
139
+ let content = childrenWithoutScrollView;
140
+ return (import_react_native.Platform.OS === "android" || import_react_native.Platform.OS === "ios") && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperContext.Provider, { ...popperContext, children: childrenWithoutScrollView })), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { hostName: `${context.id}PopoverContents`, children: content });
141
+ }
142
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ import_animate.Animate,
144
+ {
145
+ type: "presence",
146
+ present: !!open,
147
+ keepChildrenMounted,
148
+ onExitComplete: () => {
149
+ setIsFullyHidden(!0);
150
+ },
151
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ FreezeToLastContents,
153
+ {
154
+ freeze: !!(isFullyHidden && freezeContentsWhenHidden),
155
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
+ import_popper.PopperContent,
157
+ {
158
+ "data-state": getState(open),
159
+ id: context.contentId,
160
+ ref: forwardedRef,
161
+ ...contentProps,
162
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
163
+ import_remove_scroll.RemoveScroll,
164
+ {
165
+ enabled: disableRemoveScroll ? !1 : open,
166
+ allowPinchZoom: !0,
167
+ removeScrollBar: !1,
168
+ style: {
169
+ display: "contents"
170
+ },
171
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
172
+ import_focus_scope.FocusScope,
173
+ {
174
+ loop: !0,
175
+ enabled: disableFocusScope ? !1 : open,
176
+ trapped: trapFocus,
177
+ onMountAutoFocus: onOpenAutoFocus,
178
+ onUnmountAutoFocus: onCloseAutoFocus,
179
+ children: contents
180
+ }
181
+ )
182
+ }
183
+ )
184
+ },
185
+ context.contentId
186
+ )
187
+ }
188
+ )
189
+ }
190
+ );
191
+ }), FreezeToLastContents = (props) => {
192
+ const last = React.useRef();
193
+ return props.freeze || (last.current = props.children), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_freeze.Freeze, { placeholder: last.current, ...props });
194
+ }, PopoverClose = React.forwardRef(
195
+ function(props, forwardedRef) {
196
+ const context = usePopoverContext();
197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
+ import_stacks.YStack,
199
+ {
200
+ ...props,
201
+ ref: forwardedRef,
202
+ componentName: "PopoverClose",
203
+ onPress: (0, import_core.composeEventHandlers)(
204
+ props.onPress,
205
+ () => context.onOpenChange(!1)
206
+ )
207
+ }
208
+ );
209
+ }
210
+ ), PopoverArrow = React.forwardRef(
211
+ function(props, forwardedRef) {
212
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperArrow, { componentName: "PopoverArrow", ...props, ref: forwardedRef });
213
+ }
214
+ ), Popover = (0, import_core.withStaticProperties)(
215
+ function(props) {
216
+ const {
217
+ children,
218
+ open: openProp,
219
+ defaultOpen,
220
+ onOpenChange,
221
+ keepChildrenMounted,
222
+ ...restProps
223
+ } = props, id = React.useId(), { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
224
+ Contents: React.useCallback(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${id}PopoverContents` }), [])
225
+ }), sheetBreakpoint = when, triggerRef = React.useRef(null), [hasCustomAnchor, setHasCustomAnchor] = React.useState(!1), [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
226
+ prop: openProp,
227
+ defaultProp: defaultOpen || !1,
228
+ onChange: onOpenChange
229
+ }), breakpointActive = useSheetBreakpointActive(sheetBreakpoint), floatingContext = (0, import_useFloatingContext.useFloatingContext)({ open, setOpen, breakpointActive }), popoverContext = {
230
+ id,
231
+ sheetBreakpoint,
232
+ contentId: React.useId(),
233
+ triggerRef,
234
+ open,
235
+ breakpointActive,
236
+ onOpenChange: setOpen,
237
+ onOpenToggle: (0, import_core.useEvent)(() => {
238
+ open && breakpointActive || setOpen(!open);
239
+ }),
240
+ hasCustomAnchor,
241
+ onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(!0), []),
242
+ onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(!1), []),
243
+ keepChildrenMounted
244
+ }, contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.Popper, { stayInFrame: !0, ...restProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContext.Provider, { ...popoverContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverSheetController, { onOpenChange: setOpen, children }) }) });
245
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: import_core.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_floating.FloatingOverrideContext.Provider, { value: floatingContext, children: contents }) : contents });
246
+ },
247
+ {
248
+ Anchor: PopoverAnchor,
249
+ Arrow: PopoverArrow,
250
+ Trigger: PopoverTrigger,
251
+ Content: PopoverContent,
252
+ Close: PopoverClose,
253
+ Adapt: import_adapt.Adapt,
254
+ ScrollView: import_react_native.ScrollView,
255
+ Sheet: import_sheet.Sheet.Controlled
256
+ }
257
+ );
258
+ function getState(open) {
259
+ return open ? "open" : "closed";
260
+ }
261
+ const PopoverSheetController = (props) => {
262
+ const context = usePopoverContext(), showSheet = useShowPopoverSheet(context), breakpointActive = context.breakpointActive, getShowSheet = (0, import_core.useGet)(showSheet);
263
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
264
+ import_sheet.SheetController,
265
+ {
266
+ onOpenChange: (val) => {
267
+ getShowSheet() && props.onOpenChange(val);
268
+ },
269
+ open: context.open,
270
+ hidden: breakpointActive === !1,
271
+ children: props.children
272
+ }
273
+ );
274
+ }, useSheetBreakpointActive = (breakpoint) => {
275
+ const media = (0, import_core.useMedia)();
276
+ return typeof breakpoint == "boolean" || !breakpoint ? !!breakpoint : media[breakpoint];
277
+ }, useShowPopoverSheet = (context) => {
278
+ const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint);
279
+ return context.open === !1 ? !1 : breakpointActive;
280
+ };
281
+ // Annotate the CommonJS export names for ESM import in node:
282
+ 0 && (module.exports = {
283
+ Popover,
284
+ PopoverAnchor,
285
+ PopoverArrow,
286
+ PopoverClose,
287
+ PopoverContent,
288
+ PopoverContext,
289
+ PopoverTrigger,
290
+ usePopoverContext
291
+ });
292
+ //# sourceMappingURL=Popover.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Popover.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAO,kCAEP,eAAsC,2BACtC,iBAAwB,6BACxB,qBAA2B,iCAC3B,sBAAgC,kCAChC,cAgBO,0BAEP,kBAAwC,8BACxC,qBAA4C,iCAC5C,gBAWO,4BACP,gBAA+C,4BAC/C,uBAAgD,mCAChD,eAAuC,2BACvC,gBAAoC,4BACpC,gCAAqC,4CACrC,QAAuB,2BACvB,sBAAuB,yBACvB,sBAAqC,yBAErC,4BAAmC,iCA+CxB;AApBJ,MAAM,qBAAiB,iCAAyC,CAAC,CAAQ,GAEnE,oBAAoB,MAAM,MAAM,WAAW,cAAc,GAQzD,gBAAgB,MAAM;AAAA,EACjC,SAAuB,OAA2B,cAAc;AAC9D,UAAM,UAAU,kBAAkB,GAC5B,EAAE,mBAAmB,qBAAqB,IAAI;AAEpD,iBAAM,UAAU,OACd,kBAAkB,GACX,MAAM,qBAAqB,IACjC,CAAC,mBAAmB,oBAAoB,CAAC,GAErC,4CAAC,8BAAc,GAAG,OAAO,KAAK,cAAc;AAAA,EACrD;AACF,GAQa,iBAAiB,MAAM;AAAA,EAClC,SAAwB,OAA4B,cAAc;AAChE,UAAM,UAAU,kBAAkB,GAC5B,yBAAqB,qCAAgB,cAAc,QAAQ,UA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AAA,MAE1B;AAAA,MACA,MAAM,QAAQ;AAAA,MACd,QAAQ,qBAAqB;AAAA,MAE5B,gBAAM;AAAA;AAAA,EACT;AAEJ,GAEM,2BAA2B,CAAC,eAAgD;AAChF,QAAM,YAAQ,sBAAS;AACvB,SAAI,OAAO,cAAe,aAAa,CAAC,aAC/B,CAAC,CAAC,aAEJ,MAAM,UAAU;AACzB,GAEM,sBAAsB,CAAC,YAAiC;AAC5D,QAAM,mBAAmB,yBAAyB,QAAQ,eAAe;AACzE,SAAO,QAAQ,SAAS,KAAQ,KAAQ;AAC1C;",
5
+ "names": []
6
+ }
package/dist/cjs/index.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
6
+ if (from && typeof from == "object" || typeof from == "function")
8
7
  for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
9
  return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
10
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
12
  var src_exports = {};
17
13
  module.exports = __toCommonJS(src_exports);
18
14
  __reExport(src_exports, require("./Popover"), module.exports);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,iCADd;",
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,iCADd;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from == "object" || typeof from == "function")
8
+ for (let key of __getOwnPropNames(from))
9
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ return to;
11
+ }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
12
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
+ var src_exports = {};
14
+ module.exports = __toCommonJS(src_exports);
15
+ __reExport(src_exports, require("./Popover"), module.exports);
16
+ __reExport(src_exports, require("./useFloatingContext"), module.exports);
17
+ // Annotate the CommonJS export names for ESM import in node:
18
+ 0 && (module.exports = {
19
+ ...require("./Popover"),
20
+ ...require("./useFloatingContext")
21
+ });
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "mappings": ";;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,sBAAd;AACA,wBAAc,iCADd;",
5
+ "names": []
6
+ }
@@ -1,36 +1,30 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
5
  var __export = (target, all) => {
7
6
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
12
10
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
12
  return to;
17
13
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
15
  var useFloatingContext_exports = {};
20
16
  __export(useFloatingContext_exports, {
21
17
  useFloatingContext: () => useFloatingContext
22
18
  });
23
19
  module.exports = __toCommonJS(useFloatingContext_exports);
24
- var import_react = require("@floating-ui/react");
25
- var import_react2 = require("react");
20
+ var import_react = require("@floating-ui/react"), import_react2 = require("react");
26
21
  const useFloatingContext = ({ open, setOpen, breakpointActive }) => (0, import_react2.useCallback)(
27
22
  (props) => {
28
23
  const floating = (0, import_react.useFloating)({
29
24
  ...props,
30
25
  open,
31
26
  onOpenChange: setOpen
32
- });
33
- const { getReferenceProps, getFloatingProps } = (0, import_react.useInteractions)([
27
+ }), { getReferenceProps, getFloatingProps } = (0, import_react.useInteractions)([
34
28
  // useFocus(floating.context, {
35
29
  // enabled: !breakpointActive,
36
30
  // keyboardOnly: true,
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AAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,CAAC,MAAM,SAAS,gBAAgB;AAClC;",
5
5
  "names": ["import_react"]
6
6
  }
@@ -5,17 +5,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __export = (target, all) => {
7
7
  for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
12
11
  for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
13
  return to;
17
14
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
19
16
  var useFloatingContext_native_exports = {};
20
17
  __export(useFloatingContext_native_exports, {
21
18
  useFloatingContext: () => useFloatingContext
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/useFloatingContext.native.tsx"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AAG5B,MAAM,qBAAqB,UAAM,0BAAY,MAAM;AAAC,GAAG,CAAC,CAAC;",
4
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AAG5B,MAAM,qBAAqB,UAAM,0BAAY,MAAM;AAAC,GAAG,CAAC,CAAC;",
5
5
  "names": []
6
6
  }