@tamagui/popover 1.0.0-beta.6

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,315 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __copyProps = (to, from, except, desc) => {
42
+ if (from && typeof from === "object" || typeof from === "function") {
43
+ for (let key of __getOwnPropNames(from))
44
+ if (!__hasOwnProp.call(to, key) && key !== except)
45
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
46
+ }
47
+ return to;
48
+ };
49
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
50
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
51
+ var Popover_exports = {};
52
+ __export(Popover_exports, {
53
+ Popover: () => Popover,
54
+ PopoverAnchor: () => PopoverAnchor,
55
+ PopoverArrow: () => PopoverArrow,
56
+ PopoverClose: () => PopoverClose,
57
+ PopoverContent: () => PopoverContent,
58
+ PopoverTrigger: () => PopoverTrigger,
59
+ __PopoverProviderInternal: () => __PopoverProviderInternal,
60
+ createPopoverScope: () => createPopoverScope,
61
+ usePopoverScope: () => usePopoverScope
62
+ });
63
+ module.exports = __toCommonJS(Popover_exports);
64
+ var import_polyfill_dev = require("@tamagui/polyfill-dev");
65
+ var import_react_dom_interactions = require("@floating-ui/react-dom-interactions");
66
+ var import_animate_presence = require("@tamagui/animate-presence");
67
+ var import_compose_refs = require("@tamagui/compose-refs");
68
+ var import_core = require("@tamagui/core");
69
+ var import_create_context = require("@tamagui/create-context");
70
+ var import_popper = require("@tamagui/popper");
71
+ var import_portal = require("@tamagui/portal");
72
+ var import_stacks = require("@tamagui/stacks");
73
+ var import_use_controllable_state = require("@tamagui/use-controllable-state");
74
+ var React = __toESM(require("react"));
75
+ const POPOVER_NAME = "Popover";
76
+ const [createPopoverContext, createPopoverScopeInternal] = (0, import_create_context.createContextScope)(POPOVER_NAME, [
77
+ import_popper.createPopperScope
78
+ ]);
79
+ const usePopoverScope = (0, import_popper.createPopperScope)();
80
+ const createPopoverScope = createPopoverScopeInternal;
81
+ const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
82
+ const __PopoverProviderInternal = PopoverProviderInternal;
83
+ const ANCHOR_NAME = "PopoverAnchor";
84
+ const PopoverAnchor = React.forwardRef((props, forwardedRef) => {
85
+ const _a = props, { __scopePopover } = _a, anchorProps = __objRest(_a, ["__scopePopover"]);
86
+ const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
87
+ const popperScope = usePopoverScope(__scopePopover);
88
+ const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
89
+ React.useEffect(() => {
90
+ onCustomAnchorAdd();
91
+ return () => onCustomAnchorRemove();
92
+ }, [onCustomAnchorAdd, onCustomAnchorRemove]);
93
+ return /* @__PURE__ */ React.createElement(import_popper.PopperAnchor, __spreadProps(__spreadValues(__spreadValues({}, popperScope), anchorProps), {
94
+ ref: forwardedRef
95
+ }));
96
+ });
97
+ PopoverAnchor.displayName = ANCHOR_NAME;
98
+ const TRIGGER_NAME = "PopoverTrigger";
99
+ const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
100
+ const _a = props, { __scopePopover } = _a, triggerProps = __objRest(_a, ["__scopePopover"]);
101
+ const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
102
+ const popperScope = usePopoverScope(__scopePopover);
103
+ const composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
104
+ const trigger = /* @__PURE__ */ React.createElement(import_stacks.YStack, __spreadProps(__spreadValues({
105
+ "aria-haspopup": "dialog",
106
+ "aria-expanded": context.open,
107
+ "aria-controls": context.contentId,
108
+ "data-state": getState(context.open)
109
+ }, triggerProps), {
110
+ ref: composedTriggerRef,
111
+ onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
112
+ }));
113
+ return context.hasCustomAnchor ? trigger : /* @__PURE__ */ React.createElement(import_popper.PopperAnchor, __spreadValues({
114
+ asChild: true
115
+ }, popperScope), trigger);
116
+ });
117
+ PopoverTrigger.displayName = TRIGGER_NAME;
118
+ const CONTENT_NAME = "PopoverContent";
119
+ const PopoverContent = React.forwardRef((props, forwardedRef) => {
120
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
121
+ return context.modal ? /* @__PURE__ */ React.createElement(PopoverContentModal, __spreadProps(__spreadValues({}, props), {
122
+ ref: forwardedRef
123
+ })) : /* @__PURE__ */ React.createElement(PopoverContentNonModal, __spreadProps(__spreadValues({}, props), {
124
+ ref: forwardedRef
125
+ }));
126
+ });
127
+ PopoverContent.displayName = CONTENT_NAME;
128
+ const PopoverContentModal = React.forwardRef((props, forwardedRef) => {
129
+ const _a = props, { allowPinchZoom, portalled = true } = _a, contentModalProps = __objRest(_a, ["allowPinchZoom", "portalled"]);
130
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
131
+ const contentRef = React.useRef(null);
132
+ const composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef);
133
+ const isRightClickOutsideRef = React.useRef(false);
134
+ const PortalWrapper = portalled ? import_portal.Portal : React.Fragment;
135
+ return /* @__PURE__ */ React.createElement(PortalWrapper, null, /* @__PURE__ */ React.createElement(PopoverContentImpl, __spreadProps(__spreadValues({}, contentModalProps), {
136
+ ref: composedRefs,
137
+ trapFocus: context.open,
138
+ disableOutsidePointerEvents: true,
139
+ onCloseAutoFocus: (0, import_core.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
140
+ var _a2;
141
+ event.preventDefault();
142
+ if (!isRightClickOutsideRef.current)
143
+ (_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
144
+ }),
145
+ onPointerDownOutside: (0, import_core.composeEventHandlers)(props.onPointerDownOutside, (event) => {
146
+ console.log("pinter outside", event);
147
+ const originalEvent = event.detail.originalEvent;
148
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
149
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
150
+ isRightClickOutsideRef.current = isRightClick;
151
+ }, { checkDefaultPrevented: false }),
152
+ onFocusOutside: (0, import_core.composeEventHandlers)(props.onFocusOutside, (event) => event.preventDefault(), { checkDefaultPrevented: false })
153
+ })));
154
+ });
155
+ const PopoverContentNonModal = React.forwardRef((props, forwardedRef) => {
156
+ const _a = props, { portalled = true } = _a, contentNonModalProps = __objRest(_a, ["portalled"]);
157
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
158
+ const hasInteractedOutsideRef = React.useRef(false);
159
+ const PortalWrapper = React.Fragment;
160
+ return /* @__PURE__ */ React.createElement(PortalWrapper, null, /* @__PURE__ */ React.createElement(PopoverContentImpl, __spreadProps(__spreadValues({}, contentNonModalProps), {
161
+ ref: forwardedRef,
162
+ trapFocus: false,
163
+ disableOutsidePointerEvents: false,
164
+ onCloseAutoFocus: (event) => {
165
+ var _a2, _b;
166
+ (_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
167
+ if (!event.defaultPrevented) {
168
+ if (!hasInteractedOutsideRef.current)
169
+ (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
170
+ event.preventDefault();
171
+ }
172
+ hasInteractedOutsideRef.current = false;
173
+ },
174
+ onInteractOutside: (event) => {
175
+ var _a2, _b;
176
+ (_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
177
+ if (!event.defaultPrevented)
178
+ hasInteractedOutsideRef.current = true;
179
+ const target = event.target;
180
+ const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
181
+ if (targetIsTrigger)
182
+ event.preventDefault();
183
+ }
184
+ })));
185
+ });
186
+ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
187
+ const _a = props, {
188
+ __scopePopover,
189
+ trapFocus,
190
+ onOpenAutoFocus,
191
+ onCloseAutoFocus,
192
+ disableOutsidePointerEvents,
193
+ onEscapeKeyDown,
194
+ onPointerDownOutside,
195
+ onFocusOutside,
196
+ onInteractOutside
197
+ } = _a, contentProps = __objRest(_a, [
198
+ "__scopePopover",
199
+ "trapFocus",
200
+ "onOpenAutoFocus",
201
+ "onCloseAutoFocus",
202
+ "disableOutsidePointerEvents",
203
+ "onEscapeKeyDown",
204
+ "onPointerDownOutside",
205
+ "onFocusOutside",
206
+ "onInteractOutside"
207
+ ]);
208
+ const context = usePopoverInternalContext(CONTENT_NAME, __scopePopover);
209
+ const popperScope = usePopoverScope(__scopePopover);
210
+ return /* @__PURE__ */ React.createElement(import_animate_presence.AnimatePresence, null, !!context.open && /* @__PURE__ */ React.createElement(import_popper.PopperContent, __spreadProps(__spreadValues(__spreadValues({
211
+ "data-state": getState(context.open),
212
+ id: context.contentId,
213
+ pointerEvents: "auto"
214
+ }, popperScope), contentProps), {
215
+ ref: forwardedRef
216
+ })));
217
+ });
218
+ const CLOSE_NAME = "PopoverClose";
219
+ const PopoverClose = React.forwardRef((props, forwardedRef) => {
220
+ const _a = props, { __scopePopover } = _a, closeProps = __objRest(_a, ["__scopePopover"]);
221
+ const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
222
+ return /* @__PURE__ */ React.createElement(import_stacks.YStack, __spreadProps(__spreadValues({}, closeProps), {
223
+ ref: forwardedRef,
224
+ onPress: (0, import_core.composeEventHandlers)(props.onPress, () => context.onOpenChange(false))
225
+ }));
226
+ });
227
+ PopoverClose.displayName = CLOSE_NAME;
228
+ const ARROW_NAME = "PopoverArrow";
229
+ const PopoverArrow = React.forwardRef((props, forwardedRef) => {
230
+ const _a = props, { __scopePopover } = _a, arrowProps = __objRest(_a, ["__scopePopover"]);
231
+ const popperScope = usePopoverScope(__scopePopover);
232
+ return /* @__PURE__ */ React.createElement(import_popper.PopperArrow, __spreadProps(__spreadValues(__spreadValues({}, popperScope), arrowProps), {
233
+ ref: forwardedRef
234
+ }));
235
+ });
236
+ PopoverArrow.displayName = ARROW_NAME;
237
+ const Popover = (0, import_core.withStaticProperties)((props) => {
238
+ const _a = props, {
239
+ __scopePopover,
240
+ children,
241
+ open: openProp,
242
+ defaultOpen,
243
+ onOpenChange,
244
+ modal = false
245
+ } = _a, restProps = __objRest(_a, [
246
+ "__scopePopover",
247
+ "children",
248
+ "open",
249
+ "defaultOpen",
250
+ "onOpenChange",
251
+ "modal"
252
+ ]);
253
+ const popperScope = usePopoverScope(__scopePopover);
254
+ const triggerRef = React.useRef(null);
255
+ const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
256
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
257
+ prop: openProp,
258
+ defaultProp: defaultOpen || false,
259
+ onChange: onOpenChange
260
+ });
261
+ const useFloatingFn = /* @__PURE__ */ __name((props2) => {
262
+ const floating = (0, import_react_dom_interactions.useFloating)(__spreadProps(__spreadValues({}, props2), {
263
+ open,
264
+ onOpenChange: setOpen
265
+ }));
266
+ const { getReferenceProps, getFloatingProps } = (0, import_react_dom_interactions.useInteractions)([
267
+ (0, import_react_dom_interactions.useFocus)(floating.context),
268
+ (0, import_react_dom_interactions.useRole)(floating.context, { role: "dialog" }),
269
+ (0, import_react_dom_interactions.useDismiss)(floating.context)
270
+ ]);
271
+ return __spreadProps(__spreadValues({}, floating), {
272
+ getReferenceProps,
273
+ getFloatingProps
274
+ });
275
+ }, "useFloatingFn");
276
+ const useFloatingContext = React.useCallback(useFloatingFn, [open]);
277
+ return /* @__PURE__ */ React.createElement(import_popper.FloatingOverrideContext.Provider, {
278
+ value: useFloatingContext
279
+ }, /* @__PURE__ */ React.createElement(import_popper.Popper, __spreadValues(__spreadValues({}, popperScope), restProps), /* @__PURE__ */ React.createElement(PopoverProviderInternal, {
280
+ scope: __scopePopover,
281
+ contentId: (0, import_core.useId)(),
282
+ triggerRef,
283
+ open,
284
+ onOpenChange: setOpen,
285
+ onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
286
+ hasCustomAnchor,
287
+ onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
288
+ onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
289
+ modal
290
+ }, children)));
291
+ }, {
292
+ Anchor: PopoverAnchor,
293
+ Arrow: PopoverArrow,
294
+ Trigger: PopoverTrigger,
295
+ Content: PopoverContent,
296
+ Close: PopoverClose
297
+ });
298
+ Popover.displayName = POPOVER_NAME;
299
+ function getState(open) {
300
+ return open ? "open" : "closed";
301
+ }
302
+ __name(getState, "getState");
303
+ // Annotate the CommonJS export names for ESM import in node:
304
+ 0 && (module.exports = {
305
+ Popover,
306
+ PopoverAnchor,
307
+ PopoverArrow,
308
+ PopoverClose,
309
+ PopoverContent,
310
+ PopoverTrigger,
311
+ __PopoverProviderInternal,
312
+ createPopoverScope,
313
+ usePopoverScope
314
+ });
315
+ //# sourceMappingURL=Popover.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Popover.tsx"],
4
+ "sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport {\n useDelayGroup,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers, useId, withStaticProperties } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\n// import { DismissableLayer } from '@tamagui/react-dismissable-layer'\n// import { useFocusGuards } from '@tamagui/react-focus-guards'\n// import { FocusScope } from '@tamagui/react-focus-scope'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperContent,\n PopperContentProps,\n PopperProps,\n UseFloatingFn,\n createPopperScope,\n} from '@tamagui/popper'\nimport { Portal } from '@tamagui/portal'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\n// import { hideOthers } from 'aria-hidden'\nimport * as React from 'react'\nimport { GestureResponderEvent, View } from 'react-native'\n\n// import { RemoveScroll } from 'react-remove-scroll'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n])\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\n\ntype PopoverContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>\n contentId?: string\n open: boolean\n onOpenChange(open: boolean): void\n onOpenToggle(): void\n hasCustomAnchor: boolean\n onCustomAnchorAdd(): void\n onCustomAnchorRemove(): void\n modal: boolean\n}\n\nconst [PopoverProviderInternal, usePopoverInternalContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME)\n\nexport const __PopoverProviderInternal = PopoverProviderInternal\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor'\n\ntype PopoverAnchorElement = HTMLElement | View\nexport type PopoverAnchorProps = YStackProps\n\nexport const PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props: ScopedProps<PopoverAnchorProps>, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props\n const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context\n\n React.useEffect(() => {\n onCustomAnchorAdd()\n return () => onCustomAnchorRemove()\n }, [onCustomAnchorAdd, onCustomAnchorRemove])\n\n return <PopperAnchor {...popperScope} {...anchorProps} ref={forwardedRef} />\n }\n)\n\nPopoverAnchor.displayName = ANCHOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger'\n\ntype PopoverTriggerElement = HTMLElement | View\nexport type PopoverTriggerProps = YStackProps\n\nexport const PopoverTrigger = React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n (props: ScopedProps<PopoverTriggerProps>, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props\n const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n\n const trigger = (\n <YStack\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n }\n)\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n /**\n * Whether the `Popover` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean\n}\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\nexport const PopoverContent = React.forwardRef<PopoverContentTypeElement, PopoverContentProps>(\n (props: ScopedProps<PopoverContentProps>, forwardedRef) => {\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n return context.modal ? (\n <PopoverContentModal {...props} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...props} ref={forwardedRef} />\n )\n }\n)\n\nPopoverContent.displayName = CONTENT_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype RemoveScrollProps = any //React.ComponentProps<typeof RemoveScroll>\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nconst PopoverContentModal = React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(\n (props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const { allowPinchZoom, portalled = true, ...contentModalProps } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const isRightClickOutsideRef = React.useRef(false)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n // React.useEffect(() => {\n // const content = contentRef.current\n // if (content) return hideOthers(content)\n // }, [])\n\n const PortalWrapper = portalled ? Portal : React.Fragment\n\n return (\n <PortalWrapper>\n {/* <RemoveScroll allowPinchZoom={allowPinchZoom}> */}\n <PopoverContentImpl\n {...contentModalProps}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n console.log('pinter outside', event)\n // @ts-expect-error\n const originalEvent = event.detail.originalEvent\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n isRightClickOutsideRef.current = isRightClick\n },\n { checkDefaultPrevented: false }\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkDefaultPrevented: false }\n )}\n />\n {/* </RemoveScroll> */}\n </PortalWrapper>\n )\n }\n)\n\nconst PopoverContentNonModal = React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(\n (props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const { portalled = true, ...contentNonModalProps } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const hasInteractedOutsideRef = React.useRef(false)\n const PortalWrapper = React.Fragment //portalled ? Portal : React.Fragment\n\n return (\n <PortalWrapper>\n <PopoverContentImpl\n {...contentNonModalProps}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event)\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus()\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault()\n }\n\n hasInteractedOutsideRef.current = false\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event)\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n // @ts-ignore\n const target = event.target as HTMLElement\n const targetIsTrigger = context.triggerRef.current?.contains(target)\n if (targetIsTrigger) event.preventDefault()\n }}\n />\n </PortalWrapper>\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\n// TODO\ntype FocusScopeProps = {\n /**\n * Whether focus should be trapped within the FocusScope\n * (default: false)\n */\n trapped?: boolean\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n */\n onMountAutoFocus?: (event: GestureResponderEvent) => void\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n */\n onUnmountAutoFocus?: (event: GestureResponderEvent) => void\n}\n\ntype DismissableLayerProps = {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside the `DismissableLayer`.\n * Users will need to click twice on outside elements to interact with them:\n * Once to close the `DismissableLayer`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when the a pointer event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: (event: GestureResponderEvent) => void\n // onPointerDownOutside?: (event: MouseEvent | TouchEvent) => void\n\n /**\n * Event handler called when the focus moves outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onFocusOutside?: (event: React.FocusEvent) => void\n\n /**\n * Event handler called when an interaction happens outside the `DismissableLayer`.\n * Specifically, when a pointer event happens outside of the `DismissableLayer` or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: (event: GestureResponderEvent) => void\n // onInteractOutside?: (event: MouseEvent | TouchEvent | React.FocusEvent) => void\n\n /** Callback called when the `DismissableLayer` should be dismissed */\n onDismiss?: () => void\n}\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n}\n\nconst PopoverContentImpl = React.forwardRef<PopoverContentImplElement, PopoverContentImplProps>(\n (props: ScopedProps<PopoverContentImplProps>, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props\n const context = usePopoverInternalContext(CONTENT_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (beacuse of the `Portal`)\n // useFocusGuards()\n\n // <FocusScope\n // asChild\n // loop\n // trapped={trapFocus}\n // onMountAutoFocus={onOpenAutoFocus}\n // onUnmountAutoFocus={onCloseAutoFocus}\n // >\n // <DismissableLayer\n // asChild\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // onPointerDownOutside={onPointerDownOutside}\n // onFocusOutside={onFocusOutside}\n // onDismiss={() => context.onOpenChange(false)}\n // >\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n data-state={getState(context.open)}\n // role=\"dialog\"\n id={context.contentId}\n pointerEvents=\"auto\"\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n />\n )}\n </AnimatePresence>\n )\n // </DismissableLayer>\n // </FocusScope>\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose'\n\ntype PopoverCloseElement = HTMLElement | View\nexport type PopoverCloseProps = YStackProps\n\nexport const PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n (props: ScopedProps<PopoverCloseProps>, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props\n const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover)\n return (\n <YStack\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))}\n />\n )\n }\n)\n\nPopoverClose.displayName = CLOSE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopoverArrow'\n\ntype PopoverArrowElement = HTMLElement | View\nexport type PopoverArrowProps = YStackProps\n\nexport const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n (props: ScopedProps<PopoverArrowProps>, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props\n const popperScope = usePopoverScope(__scopePopover)\n return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n }\n)\n\nPopoverArrow.displayName = ARROW_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport type PopoverProps = PopperProps & {\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n modal?: boolean\n}\n\nexport const Popover = withStaticProperties(\n ((props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange: setOpen,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useFocus(floating.context),\n useRole(floating.context, { role: 'dialog' }),\n useDismiss(floating.context),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [open])\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n <Popper {...popperScope} {...restProps}>\n <PopoverProviderInternal\n scope={__scopePopover}\n contentId={useId()}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n }\n)\n\nPopover.displayName = POPOVER_NAME\n\n/* -----------------------------------------------------------------------------------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C;AAAA,IACvE,sBAAsB,MAAM,YAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,CAAC;AAAA,IAC3E;AAAA,KAEC,QACH,CACF,CACF;AAEJ,GACA;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT,CACF;AAEA,QAAQ,cAAc;AAItB,kBAAkB,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var src_exports = {};
16
+ module.exports = __toCommonJS(src_exports);
17
+ __reExport(src_exports, require("./Popover"), module.exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "sourcesContent": ["export * from './Popover'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,sBAAd;",
6
+ "names": []
7
+ }
@@ -0,0 +1,267 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import "@tamagui/polyfill-dev";
4
+ import {
5
+ useDismiss,
6
+ useFloating,
7
+ useFocus,
8
+ useInteractions,
9
+ useRole
10
+ } from "@floating-ui/react-dom-interactions";
11
+ import { AnimatePresence } from "@tamagui/animate-presence";
12
+ import { useComposedRefs } from "@tamagui/compose-refs";
13
+ import { composeEventHandlers, useId, withStaticProperties } from "@tamagui/core";
14
+ import { createContextScope } from "@tamagui/create-context";
15
+ import {
16
+ FloatingOverrideContext,
17
+ Popper,
18
+ PopperAnchor,
19
+ PopperArrow,
20
+ PopperContent,
21
+ createPopperScope
22
+ } from "@tamagui/popper";
23
+ import { Portal } from "@tamagui/portal";
24
+ import { YStack } from "@tamagui/stacks";
25
+ import { useControllableState } from "@tamagui/use-controllable-state";
26
+ import * as React from "react";
27
+ const POPOVER_NAME = "Popover";
28
+ const [createPopoverContext, createPopoverScopeInternal] = createContextScope(POPOVER_NAME, [
29
+ createPopperScope
30
+ ]);
31
+ const usePopoverScope = createPopperScope();
32
+ const createPopoverScope = createPopoverScopeInternal;
33
+ const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
34
+ const __PopoverProviderInternal = PopoverProviderInternal;
35
+ 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
+ });
51
+ PopoverAnchor.displayName = ANCHOR_NAME;
52
+ 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
+ });
72
+ PopoverTrigger.displayName = TRIGGER_NAME;
73
+ 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, portalled = true, ...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 = portalled ? 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 { portalled = true, ...contentNonModalProps } = props;
115
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
116
+ const hasInteractedOutsideRef = React.useRef(false);
117
+ const PortalWrapper = 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();
142
+ }
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
+ });
169
+ 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
+ });
179
+ PopoverClose.displayName = CLOSE_NAME;
180
+ 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
+ });
190
+ PopoverArrow.displayName = ARROW_NAME;
191
+ const Popover = withStaticProperties((props) => {
192
+ const {
193
+ __scopePopover,
194
+ children,
195
+ open: openProp,
196
+ defaultOpen,
197
+ onOpenChange,
198
+ modal = false,
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
208
+ });
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
+ });
251
+ Popover.displayName = POPOVER_NAME;
252
+ function getState(open) {
253
+ return open ? "open" : "closed";
254
+ }
255
+ __name(getState, "getState");
256
+ export {
257
+ Popover,
258
+ PopoverAnchor,
259
+ PopoverArrow,
260
+ PopoverClose,
261
+ PopoverContent,
262
+ PopoverTrigger,
263
+ __PopoverProviderInternal,
264
+ createPopoverScope,
265
+ usePopoverScope
266
+ };
267
+ //# sourceMappingURL=Popover.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Popover.tsx"],
4
+ "sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport {\n useDelayGroup,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport { composeEventHandlers, useId, withStaticProperties } from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\n// import { DismissableLayer } from '@tamagui/react-dismissable-layer'\n// import { useFocusGuards } from '@tamagui/react-focus-guards'\n// import { FocusScope } from '@tamagui/react-focus-scope'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperContent,\n PopperContentProps,\n PopperProps,\n UseFloatingFn,\n createPopperScope,\n} from '@tamagui/popper'\nimport { Portal } from '@tamagui/portal'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\n// import { hideOthers } from 'aria-hidden'\nimport * as React from 'react'\nimport { GestureResponderEvent, View } from 'react-native'\n\n// import { RemoveScroll } from 'react-remove-scroll'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n])\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\n\ntype PopoverContextValue = {\n triggerRef: React.RefObject<HTMLButtonElement>\n contentId?: string\n open: boolean\n onOpenChange(open: boolean): void\n onOpenToggle(): void\n hasCustomAnchor: boolean\n onCustomAnchorAdd(): void\n onCustomAnchorRemove(): void\n modal: boolean\n}\n\nconst [PopoverProviderInternal, usePopoverInternalContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME)\n\nexport const __PopoverProviderInternal = PopoverProviderInternal\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor'\n\ntype PopoverAnchorElement = HTMLElement | View\nexport type PopoverAnchorProps = YStackProps\n\nexport const PopoverAnchor = React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n (props: ScopedProps<PopoverAnchorProps>, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props\n const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context\n\n React.useEffect(() => {\n onCustomAnchorAdd()\n return () => onCustomAnchorRemove()\n }, [onCustomAnchorAdd, onCustomAnchorRemove])\n\n return <PopperAnchor {...popperScope} {...anchorProps} ref={forwardedRef} />\n }\n)\n\nPopoverAnchor.displayName = ANCHOR_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger'\n\ntype PopoverTriggerElement = HTMLElement | View\nexport type PopoverTriggerProps = YStackProps\n\nexport const PopoverTrigger = React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n (props: ScopedProps<PopoverTriggerProps>, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props\n const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef)\n\n const trigger = (\n <YStack\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n }\n)\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n /**\n * Whether the `Popover` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean\n}\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\nexport const PopoverContent = React.forwardRef<PopoverContentTypeElement, PopoverContentProps>(\n (props: ScopedProps<PopoverContentProps>, forwardedRef) => {\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n return context.modal ? (\n <PopoverContentModal {...props} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...props} ref={forwardedRef} />\n )\n }\n)\n\nPopoverContent.displayName = CONTENT_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype RemoveScrollProps = any //React.ComponentProps<typeof RemoveScroll>\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nconst PopoverContentModal = React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(\n (props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const { allowPinchZoom, portalled = true, ...contentModalProps } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const contentRef = React.useRef<HTMLDivElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, contentRef)\n const isRightClickOutsideRef = React.useRef(false)\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n // React.useEffect(() => {\n // const content = contentRef.current\n // if (content) return hideOthers(content)\n // }, [])\n\n const PortalWrapper = portalled ? Portal : React.Fragment\n\n return (\n <PortalWrapper>\n {/* <RemoveScroll allowPinchZoom={allowPinchZoom}> */}\n <PopoverContentImpl\n {...contentModalProps}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault()\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus()\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n console.log('pinter outside', event)\n // @ts-expect-error\n const originalEvent = event.detail.originalEvent\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick\n isRightClickOutsideRef.current = isRightClick\n },\n { checkDefaultPrevented: false }\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkDefaultPrevented: false }\n )}\n />\n {/* </RemoveScroll> */}\n </PortalWrapper>\n )\n }\n)\n\nconst PopoverContentNonModal = React.forwardRef<PopoverContentTypeElement, PopoverContentTypeProps>(\n (props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const { portalled = true, ...contentNonModalProps } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const hasInteractedOutsideRef = React.useRef(false)\n const PortalWrapper = React.Fragment //portalled ? Portal : React.Fragment\n\n return (\n <PortalWrapper>\n <PopoverContentImpl\n {...contentNonModalProps}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event)\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus()\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault()\n }\n\n hasInteractedOutsideRef.current = false\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event)\n\n if (!event.defaultPrevented) hasInteractedOutsideRef.current = true\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n //\n // We use `onInteractOutside` as some browsers also\n // focus on pointer down, creating the same issue.\n // @ts-ignore\n const target = event.target as HTMLElement\n const targetIsTrigger = context.triggerRef.current?.contains(target)\n if (targetIsTrigger) event.preventDefault()\n }}\n />\n </PortalWrapper>\n )\n }\n)\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\n// TODO\ntype FocusScopeProps = {\n /**\n * Whether focus should be trapped within the FocusScope\n * (default: false)\n */\n trapped?: boolean\n\n /**\n * Event handler called when auto-focusing on mount.\n * Can be prevented.\n */\n onMountAutoFocus?: (event: GestureResponderEvent) => void\n\n /**\n * Event handler called when auto-focusing on unmount.\n * Can be prevented.\n */\n onUnmountAutoFocus?: (event: GestureResponderEvent) => void\n}\n\ntype DismissableLayerProps = {\n /**\n * When `true`, hover/focus/click interactions will be disabled on elements outside the `DismissableLayer`.\n * Users will need to click twice on outside elements to interact with them:\n * Once to close the `DismissableLayer`, and again to trigger the element.\n */\n disableOutsidePointerEvents?: boolean\n\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n\n /**\n * Event handler called when the a pointer event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: (event: GestureResponderEvent) => void\n // onPointerDownOutside?: (event: MouseEvent | TouchEvent) => void\n\n /**\n * Event handler called when the focus moves outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onFocusOutside?: (event: React.FocusEvent) => void\n\n /**\n * Event handler called when an interaction happens outside the `DismissableLayer`.\n * Specifically, when a pointer event happens outside of the `DismissableLayer` or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: (event: GestureResponderEvent) => void\n // onInteractOutside?: (event: MouseEvent | TouchEvent | React.FocusEvent) => void\n\n /** Callback called when the `DismissableLayer` should be dismissed */\n onDismiss?: () => void\n}\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped']\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus']\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus']\n}\n\nconst PopoverContentImpl = React.forwardRef<PopoverContentImplElement, PopoverContentImplProps>(\n (props: ScopedProps<PopoverContentImplProps>, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props\n const context = usePopoverInternalContext(CONTENT_NAME, __scopePopover)\n const popperScope = usePopoverScope(__scopePopover)\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (beacuse of the `Portal`)\n // useFocusGuards()\n\n // <FocusScope\n // asChild\n // loop\n // trapped={trapFocus}\n // onMountAutoFocus={onOpenAutoFocus}\n // onUnmountAutoFocus={onCloseAutoFocus}\n // >\n // <DismissableLayer\n // asChild\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // onPointerDownOutside={onPointerDownOutside}\n // onFocusOutside={onFocusOutside}\n // onDismiss={() => context.onOpenChange(false)}\n // >\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n data-state={getState(context.open)}\n // role=\"dialog\"\n id={context.contentId}\n pointerEvents=\"auto\"\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n />\n )}\n </AnimatePresence>\n )\n // </DismissableLayer>\n // </FocusScope>\n }\n)\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose'\n\ntype PopoverCloseElement = HTMLElement | View\nexport type PopoverCloseProps = YStackProps\n\nexport const PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n (props: ScopedProps<PopoverCloseProps>, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props\n const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover)\n return (\n <YStack\n {...closeProps}\n ref={forwardedRef}\n onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))}\n />\n )\n }\n)\n\nPopoverClose.displayName = CLOSE_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'PopoverArrow'\n\ntype PopoverArrowElement = HTMLElement | View\nexport type PopoverArrowProps = YStackProps\n\nexport const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n (props: ScopedProps<PopoverArrowProps>, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props\n const popperScope = usePopoverScope(__scopePopover)\n return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n }\n)\n\nPopoverArrow.displayName = ARROW_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport type PopoverProps = PopperProps & {\n children?: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n modal?: boolean\n}\n\nexport const Popover = withStaticProperties(\n ((props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n })\n\n const useFloatingFn: UseFloatingFn = (props) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange: setOpen,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useFocus(floating.context),\n useRole(floating.context, { role: 'dialog' }),\n useDismiss(floating.context),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [open])\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n <Popper {...popperScope} {...restProps}>\n <PopoverProviderInternal\n scope={__scopePopover}\n contentId={useId()}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n }\n)\n\nPopover.displayName = POPOVER_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n"],
5
+ "mappings": ";;AAEA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AACA;AAEA;AAIA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AACA;AACA;AAEA;AAKA,MAAM,eAAe;AAGrB,MAAM,CAAC,sBAAsB,8BAA8B,mBAAmB,cAAc;AAAA,EAC1F;AACF,CAAC;AACM,MAAM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ACF;AAAA,EACF,GAhBqC;AAkBrC,QAAM,qBAAqB,MAAM,YAAY,eAAe,CAAC,IAAI,CAAC;AAElE,SACE,oCAAC,wBAAwB,UAAxB;AAAA,IAAiC,OAAO;AAAA,KACvC,oCAAC;AAAA,OAAW;AAAA,OAAiB;AAAA,KAC3B,oCAAC;AAAA,IACC,OAAO;AAAA,IACP,WAAW,MAAM;AAAA,IACjB;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,cAAc,MAAM,YAAY,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,GAAG,CAAC,OAAO,CAAC;AAAA,IACjF;AAAA,IACA,mBAAmB,MAAM,YAAY,MAAM,mBAAmB,IAAI,GAAG,CAAC,CAAC;AAAA,IACvE,sBAAsB,MAAM,YAAY,MAAM,mBAAmB,KAAK,GAAG,CAAC,CAAC;AAAA,IAC3E;AAAA,KAEC,QACH,CACF,CACF;AAEJ,GACA;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT,CACF;AAEA,QAAQ,cAAc;AAItB,kBAAkB,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Popover";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "sourcesContent": ["export * from './Popover'\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,199 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import "@tamagui/polyfill-dev";
4
+ import {
5
+ useDismiss,
6
+ useFloating,
7
+ useFocus,
8
+ useInteractions,
9
+ useRole
10
+ } from "@floating-ui/react-dom-interactions";
11
+ import { AnimatePresence } from "@tamagui/animate-presence";
12
+ import { useComposedRefs } from "@tamagui/compose-refs";
13
+ import { composeEventHandlers, useId, withStaticProperties } from "@tamagui/core";
14
+ import { createContextScope } from "@tamagui/create-context";
15
+ import {
16
+ FloatingOverrideContext,
17
+ Popper,
18
+ PopperAnchor,
19
+ PopperArrow,
20
+ PopperContent,
21
+ createPopperScope
22
+ } from "@tamagui/popper";
23
+ import { Portal } from "@tamagui/portal";
24
+ import { YStack } from "@tamagui/stacks";
25
+ import { useControllableState } from "@tamagui/use-controllable-state";
26
+ import * as React from "react";
27
+ const POPOVER_NAME = "Popover";
28
+ const [createPopoverContext, createPopoverScopeInternal] = createContextScope(POPOVER_NAME, [
29
+ createPopperScope
30
+ ]);
31
+ const usePopoverScope = createPopperScope();
32
+ const createPopoverScope = createPopoverScopeInternal;
33
+ const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
34
+ const __PopoverProviderInternal = PopoverProviderInternal;
35
+ 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 <PopperAnchor {...popperScope} {...anchorProps} ref={forwardedRef} />;
46
+ });
47
+ PopoverAnchor.displayName = ANCHOR_NAME;
48
+ const TRIGGER_NAME = "PopoverTrigger";
49
+ const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
50
+ const { __scopePopover, ...triggerProps } = props;
51
+ const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
52
+ const popperScope = usePopoverScope(__scopePopover);
53
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
54
+ const trigger = <YStack aria-haspopup="dialog" aria-expanded={context.open} aria-controls={context.contentId} data-state={getState(context.open)} {...triggerProps} ref={composedTriggerRef} onPress={composeEventHandlers(props.onPress, context.onOpenToggle)} />;
55
+ return context.hasCustomAnchor ? trigger : <PopperAnchor asChild {...popperScope}>{trigger}</PopperAnchor>;
56
+ });
57
+ PopoverTrigger.displayName = TRIGGER_NAME;
58
+ const CONTENT_NAME = "PopoverContent";
59
+ const PopoverContent = React.forwardRef((props, forwardedRef) => {
60
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
61
+ return context.modal ? <PopoverContentModal {...props} ref={forwardedRef} /> : <PopoverContentNonModal {...props} ref={forwardedRef} />;
62
+ });
63
+ PopoverContent.displayName = CONTENT_NAME;
64
+ const PopoverContentModal = React.forwardRef((props, forwardedRef) => {
65
+ const { allowPinchZoom, portalled = true, ...contentModalProps } = props;
66
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
67
+ const contentRef = React.useRef(null);
68
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
69
+ const isRightClickOutsideRef = React.useRef(false);
70
+ const PortalWrapper = portalled ? Portal : React.Fragment;
71
+ return <PortalWrapper><PopoverContentImpl {...contentModalProps} ref={composedRefs} trapFocus={context.open} disableOutsidePointerEvents onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
72
+ var _a;
73
+ event.preventDefault();
74
+ if (!isRightClickOutsideRef.current)
75
+ (_a = context.triggerRef.current) == null ? void 0 : _a.focus();
76
+ })} onPointerDownOutside={composeEventHandlers(props.onPointerDownOutside, (event) => {
77
+ console.log("pinter outside", event);
78
+ const originalEvent = event.detail.originalEvent;
79
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
80
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
81
+ isRightClickOutsideRef.current = isRightClick;
82
+ }, { checkDefaultPrevented: false })} onFocusOutside={composeEventHandlers(props.onFocusOutside, (event) => event.preventDefault(), { checkDefaultPrevented: false })} /></PortalWrapper>;
83
+ });
84
+ const PopoverContentNonModal = React.forwardRef((props, forwardedRef) => {
85
+ const { portalled = true, ...contentNonModalProps } = props;
86
+ const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
87
+ const hasInteractedOutsideRef = React.useRef(false);
88
+ const PortalWrapper = React.Fragment;
89
+ return <PortalWrapper><PopoverContentImpl {...contentNonModalProps} ref={forwardedRef} trapFocus={false} disableOutsidePointerEvents={false} onCloseAutoFocus={(event) => {
90
+ var _a, _b;
91
+ (_a = props.onCloseAutoFocus) == null ? void 0 : _a.call(props, event);
92
+ if (!event.defaultPrevented) {
93
+ if (!hasInteractedOutsideRef.current)
94
+ (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
95
+ event.preventDefault();
96
+ }
97
+ hasInteractedOutsideRef.current = false;
98
+ }} onInteractOutside={(event) => {
99
+ var _a, _b;
100
+ (_a = props.onInteractOutside) == null ? void 0 : _a.call(props, event);
101
+ if (!event.defaultPrevented)
102
+ hasInteractedOutsideRef.current = true;
103
+ const target = event.target;
104
+ const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
105
+ if (targetIsTrigger)
106
+ event.preventDefault();
107
+ }} /></PortalWrapper>;
108
+ });
109
+ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
110
+ const {
111
+ __scopePopover,
112
+ trapFocus,
113
+ onOpenAutoFocus,
114
+ onCloseAutoFocus,
115
+ disableOutsidePointerEvents,
116
+ onEscapeKeyDown,
117
+ onPointerDownOutside,
118
+ onFocusOutside,
119
+ onInteractOutside,
120
+ ...contentProps
121
+ } = props;
122
+ const context = usePopoverInternalContext(CONTENT_NAME, __scopePopover);
123
+ const popperScope = usePopoverScope(__scopePopover);
124
+ return <AnimatePresence>{!!context.open && <PopperContent data-state={getState(context.open)} id={context.contentId} pointerEvents="auto" {...popperScope} {...contentProps} ref={forwardedRef} />}</AnimatePresence>;
125
+ });
126
+ const CLOSE_NAME = "PopoverClose";
127
+ const PopoverClose = React.forwardRef((props, forwardedRef) => {
128
+ const { __scopePopover, ...closeProps } = props;
129
+ const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
130
+ return <YStack {...closeProps} ref={forwardedRef} onPress={composeEventHandlers(props.onPress, () => context.onOpenChange(false))} />;
131
+ });
132
+ PopoverClose.displayName = CLOSE_NAME;
133
+ const ARROW_NAME = "PopoverArrow";
134
+ const PopoverArrow = React.forwardRef((props, forwardedRef) => {
135
+ const { __scopePopover, ...arrowProps } = props;
136
+ const popperScope = usePopoverScope(__scopePopover);
137
+ return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />;
138
+ });
139
+ PopoverArrow.displayName = ARROW_NAME;
140
+ const Popover = withStaticProperties((props) => {
141
+ const {
142
+ __scopePopover,
143
+ children,
144
+ open: openProp,
145
+ defaultOpen,
146
+ onOpenChange,
147
+ modal = false,
148
+ ...restProps
149
+ } = props;
150
+ const popperScope = usePopoverScope(__scopePopover);
151
+ const triggerRef = React.useRef(null);
152
+ const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
153
+ const [open, setOpen] = useControllableState({
154
+ prop: openProp,
155
+ defaultProp: defaultOpen || false,
156
+ onChange: onOpenChange
157
+ });
158
+ const useFloatingFn = /* @__PURE__ */ __name((props2) => {
159
+ const floating = useFloating({
160
+ ...props2,
161
+ open,
162
+ onOpenChange: setOpen
163
+ });
164
+ const { getReferenceProps, getFloatingProps } = useInteractions([
165
+ useFocus(floating.context),
166
+ useRole(floating.context, { role: "dialog" }),
167
+ useDismiss(floating.context)
168
+ ]);
169
+ return {
170
+ ...floating,
171
+ getReferenceProps,
172
+ getFloatingProps
173
+ };
174
+ }, "useFloatingFn");
175
+ const useFloatingContext = React.useCallback(useFloatingFn, [open]);
176
+ return <FloatingOverrideContext.Provider value={useFloatingContext}><Popper {...popperScope} {...restProps}><PopoverProviderInternal scope={__scopePopover} contentId={useId()} triggerRef={triggerRef} open={open} onOpenChange={setOpen} onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])} hasCustomAnchor={hasCustomAnchor} onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])} onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])} modal={modal}>{children}</PopoverProviderInternal></Popper></FloatingOverrideContext.Provider>;
177
+ }, {
178
+ Anchor: PopoverAnchor,
179
+ Arrow: PopoverArrow,
180
+ Trigger: PopoverTrigger,
181
+ Content: PopoverContent,
182
+ Close: PopoverClose
183
+ });
184
+ Popover.displayName = POPOVER_NAME;
185
+ function getState(open) {
186
+ return open ? "open" : "closed";
187
+ }
188
+ __name(getState, "getState");
189
+ export {
190
+ Popover,
191
+ PopoverAnchor,
192
+ PopoverArrow,
193
+ PopoverClose,
194
+ PopoverContent,
195
+ PopoverTrigger,
196
+ __PopoverProviderInternal,
197
+ createPopoverScope,
198
+ usePopoverScope
199
+ };
@@ -0,0 +1 @@
1
+ export * from "./Popover";
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@tamagui/popover",
3
+ "version": "1.0.0-beta.6",
4
+ "sideEffects": true,
5
+ "source": "src/index.ts",
6
+ "typings": "types",
7
+ "main": "dist/cjs",
8
+ "module": "dist/esm",
9
+ "module:jsx": "dist/jsx",
10
+ "files": [
11
+ "types",
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build": "tamagui-build",
16
+ "watch": "tamagui-build --watch",
17
+ "clean": "tamagui-build clean",
18
+ "clean:build": "tamagui-build clean:build"
19
+ },
20
+ "dependencies": {
21
+ "@floating-ui/react-dom-interactions": "^0.4.0",
22
+ "@tamagui/animate-presence": "^1.0.0-beta.6",
23
+ "@tamagui/compose-refs": "^1.0.0-beta.6",
24
+ "@tamagui/core": "^1.0.0-beta.6",
25
+ "@tamagui/create-context": "^1.0.0-beta.6",
26
+ "@tamagui/polyfill-dev": "^1.0.0-beta.6",
27
+ "@tamagui/popper": "^1.0.0-beta.6",
28
+ "@tamagui/portal": "^1.0.0-beta.6",
29
+ "@tamagui/stacks": "^1.0.0-beta.6",
30
+ "@tamagui/use-controllable-state": "^1.0.0-beta.6"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "*",
34
+ "react-dom": "*",
35
+ "react-native": "*"
36
+ },
37
+ "devDependencies": {
38
+ "@tamagui/build": "^1.0.0-beta.6",
39
+ "@types/react-dom": "^18.0.3",
40
+ "@types/react-native": "^0.67.3",
41
+ "react": "*",
42
+ "react-dom": "*",
43
+ "react-native": "*"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }
@@ -0,0 +1,153 @@
1
+ import '@tamagui/polyfill-dev';
2
+ import type { Scope } from '@tamagui/create-context';
3
+ import { PopperContentProps, PopperProps } from '@tamagui/popper';
4
+ import { YStackProps } from '@tamagui/stacks';
5
+ import * as React from 'react';
6
+ import { GestureResponderEvent, View } from 'react-native';
7
+ export declare const usePopoverScope: (scope: Scope<any>) => {
8
+ [__scopeProp: string]: Scope<any>;
9
+ };
10
+ export declare const createPopoverScope: import("@tamagui/create-context").CreateScope;
11
+ declare type PopoverContextValue = {
12
+ triggerRef: React.RefObject<HTMLButtonElement>;
13
+ contentId?: string;
14
+ open: boolean;
15
+ onOpenChange(open: boolean): void;
16
+ onOpenToggle(): void;
17
+ hasCustomAnchor: boolean;
18
+ onCustomAnchorAdd(): void;
19
+ onCustomAnchorRemove(): void;
20
+ modal: boolean;
21
+ };
22
+ export declare const __PopoverProviderInternal: {
23
+ (props: PopoverContextValue & {
24
+ scope: Scope<PopoverContextValue>;
25
+ children: React.ReactNode;
26
+ }): JSX.Element;
27
+ displayName: string;
28
+ };
29
+ declare type PopoverAnchorElement = HTMLElement | View;
30
+ export declare type PopoverAnchorProps = YStackProps;
31
+ export declare const PopoverAnchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
32
+ fullscreen?: boolean | undefined;
33
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
34
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
35
+ fullscreen?: boolean | undefined;
36
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
37
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
38
+ fullscreen?: boolean | undefined;
39
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
40
+ }>> & React.RefAttributes<PopoverAnchorElement>>;
41
+ declare type PopoverTriggerElement = HTMLElement | View;
42
+ export declare type PopoverTriggerProps = YStackProps;
43
+ export declare const PopoverTrigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
44
+ fullscreen?: boolean | undefined;
45
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
46
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
47
+ fullscreen?: boolean | undefined;
48
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
49
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
50
+ fullscreen?: boolean | undefined;
51
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
52
+ }>> & React.RefAttributes<PopoverTriggerElement>>;
53
+ export interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
54
+ allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
55
+ portalled?: boolean;
56
+ }
57
+ export declare type PopoverContentProps = PopoverContentTypeProps;
58
+ export declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentTypeProps & React.RefAttributes<HTMLElement | View>>;
59
+ declare type RemoveScrollProps = any;
60
+ declare type FocusScopeProps = {
61
+ trapped?: boolean;
62
+ onMountAutoFocus?: (event: GestureResponderEvent) => void;
63
+ onUnmountAutoFocus?: (event: GestureResponderEvent) => void;
64
+ };
65
+ declare type DismissableLayerProps = {
66
+ disableOutsidePointerEvents?: boolean;
67
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
68
+ onPointerDownOutside?: (event: GestureResponderEvent) => void;
69
+ onFocusOutside?: (event: React.FocusEvent) => void;
70
+ onInteractOutside?: (event: GestureResponderEvent) => void;
71
+ onDismiss?: () => void;
72
+ };
73
+ export interface PopoverContentImplProps extends PopperContentProps, Omit<DismissableLayerProps, 'onDismiss'> {
74
+ trapFocus?: FocusScopeProps['trapped'];
75
+ onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
76
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
77
+ }
78
+ declare type PopoverCloseElement = HTMLElement | View;
79
+ export declare type PopoverCloseProps = YStackProps;
80
+ export declare const PopoverClose: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
81
+ fullscreen?: boolean | undefined;
82
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
83
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
84
+ fullscreen?: boolean | undefined;
85
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
86
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
87
+ fullscreen?: boolean | undefined;
88
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
89
+ }>> & React.RefAttributes<PopoverCloseElement>>;
90
+ declare type PopoverArrowElement = HTMLElement | View;
91
+ export declare type PopoverArrowProps = YStackProps;
92
+ export declare const PopoverArrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
93
+ fullscreen?: boolean | undefined;
94
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
95
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
96
+ fullscreen?: boolean | undefined;
97
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
98
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
99
+ fullscreen?: boolean | undefined;
100
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
101
+ }>> & React.RefAttributes<PopoverArrowElement>>;
102
+ export declare type PopoverProps = PopperProps & {
103
+ children?: React.ReactNode;
104
+ open?: boolean;
105
+ defaultOpen?: boolean;
106
+ onOpenChange?: (open: boolean) => void;
107
+ modal?: boolean;
108
+ };
109
+ export declare const Popover: React.FC<PopoverProps> & {
110
+ Anchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
111
+ fullscreen?: boolean | undefined;
112
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
113
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
114
+ fullscreen?: boolean | undefined;
115
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
116
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
117
+ fullscreen?: boolean | undefined;
118
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
119
+ }>> & React.RefAttributes<PopoverAnchorElement>>;
120
+ Arrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
121
+ fullscreen?: boolean | undefined;
122
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
123
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
124
+ fullscreen?: boolean | undefined;
125
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
126
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
127
+ fullscreen?: boolean | undefined;
128
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
129
+ }>> & React.RefAttributes<PopoverArrowElement>>;
130
+ Trigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
131
+ fullscreen?: boolean | undefined;
132
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
133
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
134
+ fullscreen?: boolean | undefined;
135
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
136
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
137
+ fullscreen?: boolean | undefined;
138
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
139
+ }>> & React.RefAttributes<PopoverTriggerElement>>;
140
+ Content: React.ForwardRefExoticComponent<PopoverContentTypeProps & React.RefAttributes<HTMLElement | View>>;
141
+ Close: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
142
+ fullscreen?: boolean | undefined;
143
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
144
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
145
+ fullscreen?: boolean | undefined;
146
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
147
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
148
+ fullscreen?: boolean | undefined;
149
+ elevation?: import("@tamagui/core").SizeTokens | undefined;
150
+ }>> & React.RefAttributes<PopoverCloseElement>>;
151
+ };
152
+ export {};
153
+ //# sourceMappingURL=Popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../src/Popover.tsx"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAc9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAKpD,OAAO,EAML,kBAAkB,EAClB,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGrD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAU1D,eAAO,MAAM,eAAe;;CAAsB,CAAA;AAClD,eAAO,MAAM,kBAAkB,+CAA6B,CAAA;AAE5D,aAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAA;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACjC,YAAY,IAAI,IAAI,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,iBAAiB,IAAI,I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