@tamagui/popover 1.1.7 → 1.1.9
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.
- package/dist/cjs/Popover.js +109 -133
- package/dist/cjs/Popover.js.map +2 -2
- package/dist/esm/Popover.js +112 -132
- package/dist/esm/Popover.js.map +2 -2
- package/dist/jsx/Popover.js +106 -49
- package/dist/jsx/Popover.js.map +2 -2
- package/package.json +17 -17
- package/src/Popover.tsx +66 -40
- package/types/Popover.d.ts +4 -3
- package/dist/cjs/floating.js +0 -37
- package/dist/cjs/floating.js.map +0 -7
- package/dist/cjs/floating.native.js +0 -59
- package/dist/cjs/floating.native.js.map +0 -7
- package/dist/esm/floating.js +0 -15
- package/dist/esm/floating.js.map +0 -7
- package/dist/esm/floating.native.js +0 -31
- package/dist/esm/floating.native.js.map +0 -7
- package/dist/jsx/floating.js +0 -15
- package/dist/jsx/floating.js.map +0 -7
- package/dist/jsx/floating.native.js +0 -31
- package/dist/jsx/floating.native.js.map +0 -7
- package/src/floating.native.ts +0 -18
- package/src/floating.ts +0 -8
- package/types/floating.d.ts +0 -2
- package/types/floating.native.d.ts +0 -15
package/dist/cjs/Popover.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -37,12 +41,14 @@ __export(Popover_exports, {
|
|
|
37
41
|
module.exports = __toCommonJS(Popover_exports);
|
|
38
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
43
|
var import_polyfill_dev = require("@tamagui/polyfill-dev");
|
|
44
|
+
var import_react_dom_interactions = require("@floating-ui/react-dom-interactions");
|
|
40
45
|
var import_adapt = require("@tamagui/adapt");
|
|
41
46
|
var import_animate_presence = require("@tamagui/animate-presence");
|
|
42
47
|
var import_aria_hidden = require("@tamagui/aria-hidden");
|
|
43
48
|
var import_compose_refs = require("@tamagui/compose-refs");
|
|
44
49
|
var import_core = require("@tamagui/core");
|
|
45
50
|
var import_create_context = require("@tamagui/create-context");
|
|
51
|
+
var import_floating = require("@tamagui/floating");
|
|
46
52
|
var import_focus_scope = require("@tamagui/focus-scope");
|
|
47
53
|
var import_popper = require("@tamagui/popper");
|
|
48
54
|
var import_portal = require("@tamagui/portal");
|
|
@@ -52,7 +58,6 @@ var import_stacks = require("@tamagui/stacks");
|
|
|
52
58
|
var import_use_controllable_state = require("@tamagui/use-controllable-state");
|
|
53
59
|
var React = __toESM(require("react"));
|
|
54
60
|
var import_react_native = require("react-native");
|
|
55
|
-
var import_floating = require("./floating");
|
|
56
61
|
const POPOVER_NAME = "Popover";
|
|
57
62
|
const [createPopoverContext, createPopoverScopeInternal] = (0, import_create_context.createContextScope)(
|
|
58
63
|
POPOVER_NAME,
|
|
@@ -73,11 +78,7 @@ const PopoverAnchor = React.forwardRef(
|
|
|
73
78
|
onCustomAnchorAdd();
|
|
74
79
|
return () => onCustomAnchorRemove();
|
|
75
80
|
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
76
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperAnchor, {
|
|
77
|
-
...popperScope,
|
|
78
|
-
...anchorProps,
|
|
79
|
-
ref: forwardedRef
|
|
80
|
-
});
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperAnchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
81
82
|
}
|
|
82
83
|
);
|
|
83
84
|
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
@@ -87,19 +88,18 @@ const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
|
|
|
87
88
|
const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
|
|
88
89
|
const popperScope = usePopoverScope(__scopePopover);
|
|
89
90
|
const composedTriggerRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, context.triggerRef);
|
|
90
|
-
const trigger = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
91
|
+
const trigger = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
import_stacks.YStack,
|
|
93
|
+
{
|
|
94
|
+
"aria-haspopup": "dialog",
|
|
95
|
+
"aria-expanded": context.open,
|
|
96
|
+
"data-state": getState(context.open),
|
|
97
|
+
...triggerProps,
|
|
98
|
+
ref: composedTriggerRef,
|
|
99
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperAnchor, { asChild: true, ...popperScope, children: trigger });
|
|
103
103
|
});
|
|
104
104
|
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
105
105
|
const CONTENT_NAME = "PopoverContent";
|
|
@@ -122,9 +122,9 @@ const PopoverContent = React.forwardRef((props, forwardedRef) => {
|
|
|
122
122
|
if (content)
|
|
123
123
|
return (0, import_aria_hidden.hideOthers)(content);
|
|
124
124
|
}, [context.open]);
|
|
125
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContentPortal, {
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContentPortal, { zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
+
PopoverContentImpl,
|
|
127
|
+
{
|
|
128
128
|
...contentModalProps,
|
|
129
129
|
disableRemoveScroll,
|
|
130
130
|
ref: composedRefs,
|
|
@@ -151,33 +151,28 @@ const PopoverContent = React.forwardRef((props, forwardedRef) => {
|
|
|
151
151
|
(event) => event.preventDefault(),
|
|
152
152
|
{ checkDefaultPrevented: false }
|
|
153
153
|
)
|
|
154
|
-
}
|
|
155
|
-
});
|
|
154
|
+
}
|
|
155
|
+
) });
|
|
156
156
|
});
|
|
157
157
|
function PopoverContentPortal(props) {
|
|
158
158
|
const themeName = (0, import_core.useThemeName)();
|
|
159
|
+
const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
|
|
159
160
|
let contents = props.children;
|
|
160
161
|
if (import_react_native.Platform.OS === "android") {
|
|
161
|
-
const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
|
|
162
162
|
const popperContext = (0, import_popper.usePopperContext)(CONTENT_NAME, context.popperScope);
|
|
163
|
-
contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperProvider, {
|
|
164
|
-
...popperContext,
|
|
165
|
-
scope: context.popperScope,
|
|
166
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverProviderInternal, {
|
|
167
|
-
scope: props.__scopePopover,
|
|
168
|
-
...context,
|
|
169
|
-
children: props.children
|
|
170
|
-
})
|
|
171
|
-
});
|
|
163
|
+
contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperProvider, { ...popperContext, scope: context.popperScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverProviderInternal, { scope: props.__scopePopover, ...context, children: props.children }) });
|
|
172
164
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
165
|
+
const zIndex = props.zIndex ?? 1e3;
|
|
166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { zIndex, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Theme, { forceClassName: true, name: themeName, children: [
|
|
167
|
+
!!context.open && !context.breakpointActive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
import_stacks.YStack,
|
|
169
|
+
{
|
|
170
|
+
fullscreen: true,
|
|
171
|
+
onPress: (0, import_core.composeEventHandlers)(props.onPress, context.onOpenToggle)
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Stack, { zIndex: zIndex + 1, children: contents })
|
|
175
|
+
] }) });
|
|
181
176
|
}
|
|
182
177
|
const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
183
178
|
const {
|
|
@@ -196,8 +191,7 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
196
191
|
} = props;
|
|
197
192
|
const popperScope = usePopoverScope(__scopePopover);
|
|
198
193
|
const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover);
|
|
199
|
-
|
|
200
|
-
if (showSheet) {
|
|
194
|
+
if (context.breakpointActive) {
|
|
201
195
|
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {
|
|
202
196
|
if (React.isValidElement(child)) {
|
|
203
197
|
if (child.type === PopoverScrollView) {
|
|
@@ -206,77 +200,72 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
206
200
|
}
|
|
207
201
|
return child;
|
|
208
202
|
});
|
|
209
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, {
|
|
210
|
-
hostName: `${context.scopeKey}SheetContents`,
|
|
211
|
-
children: childrenWithoutScrollView
|
|
212
|
-
});
|
|
203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { hostName: `${context.scopeKey}SheetContents`, children: childrenWithoutScrollView });
|
|
213
204
|
}
|
|
214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
|
|
215
|
-
|
|
205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { children: !!context.open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
206
|
+
import_popper.PopperContent,
|
|
207
|
+
{
|
|
216
208
|
"data-state": getState(context.open),
|
|
217
209
|
id: context.contentId,
|
|
218
210
|
pointerEvents: "auto",
|
|
211
|
+
ref: forwardedRef,
|
|
219
212
|
...popperScope,
|
|
220
213
|
...contentProps,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
|
+
import_remove_scroll.RemoveScroll,
|
|
216
|
+
{
|
|
217
|
+
enabled: disableRemoveScroll ? false : context.open,
|
|
218
|
+
allowPinchZoom: true,
|
|
219
|
+
removeScrollBar: false,
|
|
220
|
+
style: {
|
|
221
|
+
display: "contents"
|
|
222
|
+
},
|
|
223
|
+
children: trapFocus === false ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
+
import_focus_scope.FocusScope,
|
|
225
|
+
{
|
|
226
|
+
loop: true,
|
|
227
|
+
trapped: trapFocus ?? context.open,
|
|
228
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
229
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
230
|
+
children: import_core.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { display: "contents" }, children }) : children
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
},
|
|
236
|
+
context.contentId
|
|
237
|
+
) });
|
|
242
238
|
});
|
|
243
239
|
const CLOSE_NAME = "PopoverClose";
|
|
244
240
|
const PopoverClose = React.forwardRef(
|
|
245
241
|
(props, forwardedRef) => {
|
|
246
242
|
const { __scopePopover, ...closeProps } = props;
|
|
247
243
|
const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
|
|
248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
(
|
|
254
|
-
|
|
255
|
-
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
245
|
+
import_stacks.YStack,
|
|
246
|
+
{
|
|
247
|
+
...closeProps,
|
|
248
|
+
ref: forwardedRef,
|
|
249
|
+
onPress: (0, import_core.composeEventHandlers)(
|
|
250
|
+
props.onPress,
|
|
251
|
+
() => context.onOpenChange(false)
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
);
|
|
256
255
|
}
|
|
257
256
|
);
|
|
258
257
|
PopoverClose.displayName = CLOSE_NAME;
|
|
259
258
|
const ARROW_NAME = "PopoverArrow";
|
|
260
259
|
const PopoverArrow = React.forwardRef(
|
|
261
260
|
(props, forwardedRef) => {
|
|
262
|
-
if (!import_core.isWeb) {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
261
|
const { __scopePopover, ...arrowProps } = props;
|
|
266
262
|
const popperScope = usePopoverScope(__scopePopover);
|
|
267
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperArrow, {
|
|
268
|
-
...popperScope,
|
|
269
|
-
...arrowProps,
|
|
270
|
-
ref: forwardedRef
|
|
271
|
-
});
|
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.PopperArrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
272
264
|
}
|
|
273
265
|
);
|
|
274
266
|
PopoverArrow.displayName = ARROW_NAME;
|
|
275
267
|
const PopoverScrollView = React.forwardRef((props, ref) => {
|
|
276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.ScrollView, {
|
|
277
|
-
ref,
|
|
278
|
-
...props
|
|
279
|
-
});
|
|
268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.ScrollView, { ref, ...props });
|
|
280
269
|
});
|
|
281
270
|
const Popover = (0, import_core.withStaticProperties)(
|
|
282
271
|
(props) => {
|
|
@@ -292,9 +281,7 @@ const Popover = (0, import_core.withStaticProperties)(
|
|
|
292
281
|
const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId;
|
|
293
282
|
const { when, AdaptProvider } = (0, import_adapt.useAdaptParent)({
|
|
294
283
|
Contents: React.useCallback(() => {
|
|
295
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, {
|
|
296
|
-
name: `${id}SheetContents`
|
|
297
|
-
});
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalHost, { name: `${id}SheetContents` });
|
|
298
285
|
}, [])
|
|
299
286
|
});
|
|
300
287
|
const sheetBreakpoint = when;
|
|
@@ -310,14 +297,18 @@ const Popover = (0, import_core.withStaticProperties)(
|
|
|
310
297
|
const breakpointActive = useSheetBreakpointActive(sheetBreakpoint);
|
|
311
298
|
const useFloatingContext = React.useCallback(
|
|
312
299
|
(props2) => {
|
|
313
|
-
const floating = (0,
|
|
300
|
+
const floating = (0, import_react_dom_interactions.useFloating)({
|
|
314
301
|
...props2,
|
|
315
302
|
open,
|
|
316
303
|
onOpenChange: setOpen
|
|
317
304
|
});
|
|
318
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
319
|
-
|
|
320
|
-
|
|
305
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react_dom_interactions.useInteractions)([
|
|
306
|
+
// useFocus(floating.context, {
|
|
307
|
+
// enabled: !breakpointActive,
|
|
308
|
+
// keyboardOnly: true,
|
|
309
|
+
// }),
|
|
310
|
+
(0, import_react_dom_interactions.useRole)(floating.context, { role: "dialog" }),
|
|
311
|
+
(0, import_react_dom_interactions.useDismiss)(floating.context, {
|
|
321
312
|
enabled: !breakpointActive
|
|
322
313
|
})
|
|
323
314
|
]);
|
|
@@ -337,6 +328,7 @@ const Popover = (0, import_core.withStaticProperties)(
|
|
|
337
328
|
contentId: (0, import_core.useId)(),
|
|
338
329
|
triggerRef,
|
|
339
330
|
open,
|
|
331
|
+
breakpointActive,
|
|
340
332
|
onOpenChange: setOpen,
|
|
341
333
|
onOpenToggle: (0, import_core.useEvent)(() => {
|
|
342
334
|
if (open && breakpointActive) {
|
|
@@ -348,24 +340,8 @@ const Popover = (0, import_core.withStaticProperties)(
|
|
|
348
340
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
349
341
|
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
350
342
|
};
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
value: useFloatingContext,
|
|
354
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.Popper, {
|
|
355
|
-
...popperScope,
|
|
356
|
-
stayInFrame: true,
|
|
357
|
-
...restProps,
|
|
358
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverProviderInternal, {
|
|
359
|
-
...popoverContext,
|
|
360
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverSheetController, {
|
|
361
|
-
onOpenChange: setOpen,
|
|
362
|
-
__scopePopover,
|
|
363
|
-
children
|
|
364
|
-
})
|
|
365
|
-
})
|
|
366
|
-
})
|
|
367
|
-
})
|
|
368
|
-
});
|
|
343
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popper.Popper, { ...popperScope, stayInFrame: true, ...restProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverProviderInternal, { ...popoverContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverSheetController, { onOpenChange: setOpen, __scopePopover, children }) }) });
|
|
344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AdaptProvider, { children: import_core.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_floating.FloatingOverrideContext.Provider, { value: useFloatingContext, children: contents }) : contents });
|
|
369
345
|
},
|
|
370
346
|
{
|
|
371
347
|
Anchor: PopoverAnchor,
|
|
@@ -388,30 +364,30 @@ const PopoverSheetController = (props) => {
|
|
|
388
364
|
props.__scopePopover
|
|
389
365
|
);
|
|
390
366
|
const showSheet = useShowPopoverSheet(context);
|
|
391
|
-
const breakpointActive =
|
|
367
|
+
const breakpointActive = context.breakpointActive;
|
|
392
368
|
const getShowSheet = (0, import_core.useGet)(showSheet);
|
|
393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
370
|
+
import_sheet.SheetController,
|
|
371
|
+
{
|
|
372
|
+
onOpenChange: (val) => {
|
|
373
|
+
if (getShowSheet()) {
|
|
374
|
+
props.onOpenChange(val);
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
open: context.open,
|
|
378
|
+
hidden: breakpointActive === false,
|
|
379
|
+
children: props.children
|
|
380
|
+
}
|
|
381
|
+
);
|
|
403
382
|
};
|
|
404
383
|
const useSheetBreakpointActive = (breakpoint) => {
|
|
405
384
|
const media = (0, import_core.useMedia)();
|
|
406
|
-
if (!breakpoint)
|
|
407
|
-
return
|
|
408
|
-
|
|
409
|
-
return true;
|
|
385
|
+
if (typeof breakpoint === "boolean" || !breakpoint) {
|
|
386
|
+
return !!breakpoint;
|
|
387
|
+
}
|
|
410
388
|
return media[breakpoint];
|
|
411
389
|
};
|
|
412
390
|
const useShowPopoverSheet = (context) => {
|
|
413
|
-
if (!import_core.isWeb)
|
|
414
|
-
return true;
|
|
415
391
|
const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint);
|
|
416
392
|
return context.open === false ? false : breakpointActive;
|
|
417
393
|
};
|
package/dist/cjs/Popover.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Popover.tsx"],
|
|
4
|
-
"sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n MediaQueryKey,\n SizeTokens,\n Theme,\n composeEventHandlers,\n isWeb,\n useEvent,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\nimport { DismissableProps } from '@tamagui/dismissable'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperArrowProps,\n PopperContent,\n PopperContentProps,\n PopperProps,\n PopperProvider,\n createPopperScope,\n usePopperContext,\n} from '@tamagui/popper'\nimport { Portal, PortalHost, PortalItem } from '@tamagui/portal'\nimport { RemoveScroll, RemoveScrollProps } from '@tamagui/remove-scroll'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { YStack, YStackProps } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { Platform, ScrollView, ScrollViewProps, View } from 'react-native'\n\nimport type { UseFloatingProps } from './floating'\nimport { useDismiss, useFloating, useFocus, useInteractions, useRole } from './floating'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\n\nexport type PopoverProps = PopperProps & {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n}\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 size?: SizeTokens\n sheetBreakpoint: any\n scopeKey: string\n popperScope: any\n}\n\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(\n POPOVER_NAME,\n [createPopperScope]\n)\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\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<\n PopoverTriggerElement,\n 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 // TODO not matching\n // aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n})\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\nexport const PopoverContent = React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>((props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const {\n allowPinchZoom,\n trapFocus,\n disableRemoveScroll = true,\n zIndex,\n ...contentModalProps\n } = 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 if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <PopoverContentPortal zIndex={zIndex}>\n <PopoverContentImpl\n {...contentModalProps}\n disableRemoveScroll={disableRemoveScroll}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={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 const originalEvent = event.detail.originalEvent\n const ctrlLeftClick =\n 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 </PopoverContentPortal>\n )\n})\n\nfunction PopoverContentPortal(props: ScopedProps<PopoverContentTypeProps>) {\n const themeName = useThemeName()\n\n // on android we have to re-pass context\n let contents = props.children\n\n if (Platform.OS === 'android') {\n // ok conditional hooks by platform\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const popperContext = usePopperContext(CONTENT_NAME, context.popperScope)\n\n contents = (\n <PopperProvider {...popperContext} scope={context.popperScope}>\n <PopoverProviderInternal scope={props.__scopePopover} {...context}>\n {/* does this need to be props.__scopePopper? */}\n {props.children}\n </PopoverProviderInternal>\n </PopperProvider>\n )\n }\n\n return (\n <Portal zIndex={props.zIndex ?? 1000}>\n <Theme forceClassName name={themeName}>\n {contents}\n </Theme>\n </Portal>\n )\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableProps, 'onDismiss' | 'children'> {\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 disableRemoveScroll?: boolean\n}\n\nconst PopoverContentImpl = React.forwardRef<\n PopoverContentImplElement,\n 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 children,\n disableRemoveScroll,\n ...contentProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover)\n const showSheet = useShowPopoverSheet(context)\n\n if (showSheet) {\n // unwrap the PopoverScrollView if used, as it will use the SheetScrollView if that exists\n const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {\n if (React.isValidElement(child)) {\n if (child.type === PopoverScrollView) {\n return child.props.children\n }\n }\n return child\n })\n\n // doesn't show as popover yet on native, must use as sheet\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n {childrenWithoutScrollView}\n </PortalItem>\n )\n }\n\n // const handleDismiss = React.useCallback(() => context.onOpenChange(false), [])\n // <Dismissable\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // // onPointerDownOutside={onPointerDownOutside}\n // // onFocusOutside={onFocusOutside}\n // onDismiss={handleDismiss}\n // >\n\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n key=\"popper-content\"\n data-state={getState(context.open)}\n id={context.contentId}\n pointerEvents=\"auto\"\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n >\n <RemoveScroll\n enabled={disableRemoveScroll ? false : context.open}\n allowPinchZoom\n // causes lots of bugs on touch web on site\n removeScrollBar={false}\n style={{\n display: 'contents',\n }}\n >\n {trapFocus === false ? (\n children\n ) : (\n <FocusScope\n loop\n trapped={trapFocus ?? context.open}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <div style={{ display: 'contents' }}>{children}</div>\n </FocusScope>\n )}\n </RemoveScroll>\n </PopperContent>\n )}\n </AnimatePresence>\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 as any, () =>\n context.onOpenChange(false)\n )}\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 = PopperArrowProps\n\nexport const PopoverArrow = React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n (props: ScopedProps<PopoverArrowProps>, forwardedRef) => {\n // we dont show on native and i'm getting an err\n if (!isWeb) {\n return null\n }\n\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 * PopoverScrollView\n * -----------------------------------------------------------------------------------------------*/\n\nconst PopoverScrollView = React.forwardRef<ScrollView, ScrollViewProps>((props, ref) => {\n return <ScrollView ref={ref} {...props} />\n})\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Popover = withStaticProperties(\n ((props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...restProps\n } = props\n\n const internalId = useId()\n const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(() => {\n return <PortalHost name={`${id}SheetContents`} />\n }, []),\n })\n\n const sheetBreakpoint = when\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 transition: true,\n })\n\n const breakpointActive = useSheetBreakpointActive(sheetBreakpoint)\n\n const useFloatingContext = React.useCallback(\n (props: UseFloatingProps) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange: setOpen,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n // useFocus(floating.context, {\n // enabled: !breakpointActive,\n // keyboardOnly: true,\n // }),\n useRole(floating.context, { role: 'dialog' }),\n useDismiss(floating.context, {\n enabled: !breakpointActive,\n }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n }\n },\n [breakpointActive, open, setOpen]\n )\n\n const popoverContext = {\n scope: __scopePopover,\n scopeKey: id,\n popperScope: popperScope.__scopePopper,\n sheetBreakpoint,\n contentId: useId(),\n triggerRef,\n open,\n onOpenChange: setOpen,\n onOpenToggle: useEvent(() => {\n if (open && breakpointActive) {\n return\n }\n setOpen(!open)\n }),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n }\n\n // debug if changing too often\n // if (process.env.NODE_ENV === 'development') {\n // Object.keys(popoverContext).forEach((key) => {\n // React.useEffect(() => console.log(`changed`, key), [popoverContext[key]])\n // })\n // }\n\n return (\n <AdaptProvider>\n <FloatingOverrideContext.Provider value={useFloatingContext as any}>\n <Popper {...popperScope} stayInFrame {...restProps}>\n <PopoverProviderInternal {...popoverContext}>\n <PopoverSheetController\n onOpenChange={setOpen}\n __scopePopover={__scopePopover}\n >\n {children}\n </PopoverSheetController>\n </PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n </AdaptProvider>\n )\n }) as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n Adapt,\n ScrollView: PopoverScrollView,\n Sheet: ControlledSheet,\n }\n)\n\nPopover.displayName = POPOVER_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst PopoverSheetController = (\n props: ScopedProps<{\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }>\n) => {\n const context = usePopoverInternalContext(\n 'PopoverSheetController',\n props.__scopePopover\n )\n const showSheet = useShowPopoverSheet(context)\n const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint)\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useSheetBreakpointActive = (breakpoint?: MediaQueryKey | null | boolean) => {\n const media = useMedia()\n if (!breakpoint) return false\n if (breakpoint === true) return true\n return media[breakpoint]\n}\n\nconst useShowPopoverSheet = (context: PopoverContextValue) => {\n // for now always show as sheet on native\n if (!isWeb) return true\n const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["// adapted from radix-ui popover\n\nimport '@tamagui/polyfill-dev'\n\nimport type { UseFloatingProps } from '@floating-ui/react-dom-interactions'\nimport {\n useDismiss,\n useFloating,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { Adapt, useAdaptParent } from '@tamagui/adapt'\nimport { AnimatePresence } from '@tamagui/animate-presence'\nimport { hideOthers } from '@tamagui/aria-hidden'\nimport { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n GestureReponderEvent,\n MediaQueryKey,\n SizeTokens,\n Stack,\n TamaguiElement,\n Theme,\n composeEventHandlers,\n isWeb,\n useEvent,\n useGet,\n useId,\n useMedia,\n useThemeName,\n withStaticProperties,\n} from '@tamagui/core'\nimport type { Scope } from '@tamagui/create-context'\nimport { createContextScope } from '@tamagui/create-context'\nimport { DismissableProps } from '@tamagui/dismissable'\nimport { FloatingOverrideContext } from '@tamagui/floating'\nimport { FocusScope, FocusScopeProps } from '@tamagui/focus-scope'\nimport {\n Popper,\n PopperAnchor,\n PopperArrow,\n PopperArrowProps,\n PopperContent,\n PopperContentProps,\n PopperProps,\n PopperProvider,\n createPopperScope,\n usePopperContext,\n} from '@tamagui/popper'\nimport { Portal, PortalHost, PortalItem } from '@tamagui/portal'\nimport { RemoveScroll, RemoveScrollProps } from '@tamagui/remove-scroll'\nimport { ControlledSheet, SheetController } from '@tamagui/sheet'\nimport { SizableStack, XStack, YStack, YStackProps, ZStack } from '@tamagui/stacks'\nimport { useControllableState } from '@tamagui/use-controllable-state'\nimport * as React from 'react'\nimport { useEffect } from 'react'\nimport {\n GestureResponderEvent,\n Platform,\n ScrollView,\n ScrollViewProps,\n View,\n} from 'react-native'\n\nconst POPOVER_NAME = 'Popover'\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope }\n\nexport type PopoverProps = PopperProps & {\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n}\n\ntype PopoverContextValue = {\n triggerRef: React.RefObject<any>\n contentId?: string\n open: boolean\n onOpenChange(open: boolean): void\n onOpenToggle(): void\n hasCustomAnchor: boolean\n onCustomAnchorAdd(): void\n onCustomAnchorRemove(): void\n size?: SizeTokens\n sheetBreakpoint: any\n scopeKey: string\n popperScope: any\n breakpointActive?: boolean\n}\n\nconst [createPopoverContext, createPopoverScopeInternal] = createContextScope(\n POPOVER_NAME,\n [createPopperScope]\n)\nexport const usePopoverScope = createPopperScope()\nexport const createPopoverScope = createPopoverScopeInternal\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<\n PopoverTriggerElement,\n 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 // TODO not matching\n // aria-controls={context.contentId}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperAnchor asChild {...popperScope}>\n {trigger}\n </PopperAnchor>\n )\n})\n\nPopoverTrigger.displayName = TRIGGER_NAME\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent'\n\nexport type PopoverContentProps = PopoverContentTypeProps\n\ntype PopoverContentTypeElement = PopoverContentImplElement\n\nexport interface PopoverContentTypeProps\n extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {\n /**\n * @see https://github.com/theKashey/react-remove-scroll#usage\n */\n allowPinchZoom?: RemoveScrollProps['allowPinchZoom']\n}\n\nexport const PopoverContent = React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>((props: ScopedProps<PopoverContentTypeProps>, forwardedRef) => {\n const {\n allowPinchZoom,\n trapFocus,\n disableRemoveScroll = true,\n zIndex,\n ...contentModalProps\n } = props\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n const contentRef = React.useRef<any>(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 if (!context.open) return\n const content = contentRef.current\n if (content) return hideOthers(content)\n }, [context.open])\n\n return (\n <PopoverContentPortal zIndex={zIndex}>\n <PopoverContentImpl\n {...contentModalProps}\n disableRemoveScroll={disableRemoveScroll}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={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 const originalEvent = event.detail.originalEvent\n const ctrlLeftClick =\n 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 </PopoverContentPortal>\n )\n})\n\nfunction PopoverContentPortal(props: ScopedProps<PopoverContentTypeProps>) {\n const themeName = useThemeName()\n const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover)\n\n // on android we have to re-pass context\n let contents = props.children\n\n if (Platform.OS === 'android') {\n // ok conditional hooks by platform\n const popperContext = usePopperContext(CONTENT_NAME, context.popperScope)\n\n contents = (\n <PopperProvider {...popperContext} scope={context.popperScope}>\n <PopoverProviderInternal scope={props.__scopePopover} {...context}>\n {/* does this need to be props.__scopePopper? */}\n {props.children}\n </PopoverProviderInternal>\n </PopperProvider>\n )\n }\n\n const zIndex = props.zIndex ?? 1000\n\n // Portal the contents and add a transparent bg overlay to handle dismiss on native\n return (\n <Portal zIndex={zIndex}>\n <Theme forceClassName name={themeName}>\n {!!context.open && !context.breakpointActive && (\n <YStack\n fullscreen\n onPress={composeEventHandlers(props.onPress as any, context.onOpenToggle)}\n />\n )}\n <Stack zIndex={(zIndex as number) + 1}>{contents}</Stack>\n </Theme>\n </Portal>\n )\n}\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ElementRef<typeof PopperContent>\n\nexport interface PopoverContentImplProps\n extends PopperContentProps,\n Omit<DismissableProps, 'onDismiss' | 'children'> {\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 disableRemoveScroll?: boolean\n}\n\nconst PopoverContentImpl = React.forwardRef<\n PopoverContentImplElement,\n 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 children,\n disableRemoveScroll,\n ...contentProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover)\n\n if (context.breakpointActive) {\n // unwrap the PopoverScrollView if used, as it will use the SheetScrollView if that exists\n const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {\n if (React.isValidElement(child)) {\n if (child.type === PopoverScrollView) {\n return child.props.children\n }\n }\n return child\n })\n\n // doesn't show as popover yet on native, must use as sheet\n return (\n <PortalItem hostName={`${context.scopeKey}SheetContents`}>\n {childrenWithoutScrollView}\n </PortalItem>\n )\n }\n\n // const handleDismiss = React.useCallback((event: GestureResponderEvent) =>{\n // context.onOpenChange(false);\n // }, [])\n // <Dismissable\n // disableOutsidePointerEvents={disableOutsidePointerEvents}\n // // onInteractOutside={onInteractOutside}\n // onEscapeKeyDown={onEscapeKeyDown}\n // // onPointerDownOutside={onPointerDownOutside}\n // // onFocusOutside={onFocusOutside}\n // onDismiss={handleDismiss}\n // >\n\n return (\n <AnimatePresence>\n {!!context.open && (\n <PopperContent\n key={context.contentId}\n data-state={getState(context.open)}\n id={context.contentId}\n pointerEvents=\"auto\"\n ref={forwardedRef}\n {...popperScope}\n {...contentProps}\n >\n <RemoveScroll\n enabled={disableRemoveScroll ? false : context.open}\n allowPinchZoom\n // causes lots of bugs on touch web on site\n removeScrollBar={false}\n style={{\n display: 'contents',\n }}\n >\n {trapFocus === false ? (\n children\n ) : (\n <FocusScope\n loop\n trapped={trapFocus ?? context.open}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n {isWeb ? <div style={{ display: 'contents' }}>{children}</div> : children}\n </FocusScope>\n )}\n </RemoveScroll>\n </PopperContent>\n )}\n </AnimatePresence>\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 as any, () =>\n context.onOpenChange(false)\n )}\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 = PopperArrowProps\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 * PopoverScrollView\n * -----------------------------------------------------------------------------------------------*/\n\nconst PopoverScrollView = React.forwardRef<ScrollView, ScrollViewProps>((props, ref) => {\n return <ScrollView ref={ref} {...props} />\n})\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nexport const Popover = withStaticProperties(\n ((props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...restProps\n } = props\n\n const internalId = useId()\n const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId\n\n const { when, AdaptProvider } = useAdaptParent({\n Contents: React.useCallback(() => {\n return <PortalHost name={`${id}SheetContents`} />\n }, []),\n })\n\n const sheetBreakpoint = when\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<TamaguiElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen || false,\n onChange: onOpenChange,\n transition: true,\n })\n\n const breakpointActive = useSheetBreakpointActive(sheetBreakpoint)\n\n // Custom floating context to override the Popper on web\n const useFloatingContext = React.useCallback(\n (props: UseFloatingProps) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange: setOpen,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n // useFocus(floating.context, {\n // enabled: !breakpointActive,\n // keyboardOnly: true,\n // }),\n useRole(floating.context, { role: 'dialog' }),\n useDismiss(floating.context, {\n enabled: !breakpointActive,\n }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n }\n },\n [breakpointActive, open, setOpen]\n )\n\n const popoverContext = {\n scope: __scopePopover,\n scopeKey: id,\n popperScope: popperScope.__scopePopper,\n sheetBreakpoint,\n contentId: useId(),\n triggerRef,\n open,\n breakpointActive,\n onOpenChange: setOpen,\n onOpenToggle: useEvent(() => {\n if (open && breakpointActive) {\n return\n }\n setOpen(!open)\n }),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n }\n\n // debug if changing too often\n // if (process.env.NODE_ENV === 'development') {\n // Object.keys(popoverContext).forEach((key) => {\n // React.useEffect(() => console.log(`changed`, key), [popoverContext[key]])\n // })\n // }\n\n const contents = (\n <Popper {...popperScope} stayInFrame {...restProps}>\n <PopoverProviderInternal {...popoverContext}>\n <PopoverSheetController onOpenChange={setOpen} __scopePopover={__scopePopover}>\n {children}\n </PopoverSheetController>\n </PopoverProviderInternal>\n </Popper>\n )\n\n return (\n <AdaptProvider>\n {isWeb ? (\n <FloatingOverrideContext.Provider value={useFloatingContext as any}>\n {contents}\n </FloatingOverrideContext.Provider>\n ) : (\n contents\n )}\n </AdaptProvider>\n )\n }) as React.FC<PopoverProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: PopoverArrow,\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n Close: PopoverClose,\n Adapt,\n ScrollView: PopoverScrollView,\n Sheet: ControlledSheet,\n }\n)\n\nPopover.displayName = POPOVER_NAME\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed'\n}\n\nconst PopoverSheetController = (\n props: ScopedProps<{\n children: React.ReactNode\n onOpenChange: React.Dispatch<React.SetStateAction<boolean>>\n }>\n) => {\n const context = usePopoverInternalContext(\n 'PopoverSheetController',\n props.__scopePopover\n )\n const showSheet = useShowPopoverSheet(context)\n const breakpointActive = context.breakpointActive\n const getShowSheet = useGet(showSheet)\n return (\n <SheetController\n onOpenChange={(val) => {\n if (getShowSheet()) {\n props.onOpenChange(val)\n }\n }}\n open={context.open}\n hidden={breakpointActive === false}\n >\n {props.children}\n </SheetController>\n )\n}\n\nconst useSheetBreakpointActive = (breakpoint?: MediaQueryKey | null | boolean) => {\n const media = useMedia()\n if (typeof breakpoint === 'boolean' || !breakpoint) {\n return !!breakpoint\n }\n return media[breakpoint]\n}\n\nconst useShowPopoverSheet = (context: PopoverContextValue) => {\n const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint)\n return context.open === false ? false : breakpointActive\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0HW;AAxHX,0BAAO;AAGP,oCAKO;AACP,mBAAsC;AACtC,8BAAgC;AAChC,yBAA2B;AAC3B,0BAAgC;AAChC,kBAeO;AAEP,4BAAmC;AAEnC,sBAAwC;AACxC,yBAA4C;AAC5C,oBAWO;AACP,oBAA+C;AAC/C,2BAAgD;AAChD,mBAAiD;AACjD,oBAAkE;AAClE,oCAAqC;AACrC,YAAuB;AAEvB,0BAMO;AAEP,MAAM,eAAe;AA0BrB,MAAM,CAAC,sBAAsB,0BAA0B,QAAI;AAAA,EACzD;AAAA,EACA,CAAC,+BAAiB;AACpB;AACO,MAAM,sBAAkB,iCAAkB;AAC1C,MAAM,qBAAqB;AAElC,MAAM,CAAC,yBAAyB,yBAAyB,IACvD,qBAA0C,YAAY;AAEjD,MAAM,4BAA4B;AAMzC,MAAM,cAAc;AAKb,MAAM,gBAAgB,MAAM;AAAA,EACjC,CAAC,OAAw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