@tamagui/popover 1.68.6 → 1.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Popover.js +111 -90
- package/dist/cjs/Popover.js.map +1 -1
- package/dist/cjs/Popover.native.js +111 -90
- package/dist/cjs/Popover.native.js.map +1 -1
- package/dist/esm/Popover.js +110 -89
- package/dist/esm/Popover.js.map +1 -1
- package/dist/jsx/Popover.js +93 -82
- package/dist/jsx/Popover.js.map +1 -1
- package/dist/jsx/Popover.native.js +94 -83
- package/dist/jsx/Popover.native.js.map +1 -1
- package/package.json +18 -18
- package/src/Popover.tsx +178 -132
- package/types/Popover.d.ts +29 -9
- package/types/Popover.d.ts.map +1 -1
package/dist/esm/Popover.js
CHANGED
|
@@ -37,76 +37,79 @@ import { Freeze } from "react-freeze";
|
|
|
37
37
|
import { Platform, ScrollView } from "react-native";
|
|
38
38
|
import { useFloatingContext } from "./useFloatingContext";
|
|
39
39
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
40
|
-
const PopoverContext = createStyledContext({}), usePopoverContext =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const POPOVER_SCOPE = "PopoverScope", PopoverContext = createStyledContext({}), usePopoverContext = PopoverContext.useStyledContext, PopoverAnchor = React.forwardRef(function(props, forwardedRef) {
|
|
41
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), { onCustomAnchorAdd, onCustomAnchorRemove } = context || {};
|
|
42
|
+
return React.useEffect(() => (onCustomAnchorAdd(), () => onCustomAnchorRemove()), [onCustomAnchorAdd, onCustomAnchorRemove]), /* @__PURE__ */ jsx(
|
|
43
|
+
PopperAnchor,
|
|
44
|
+
{
|
|
45
|
+
__scopePopper: __scopePopover || POPOVER_SCOPE,
|
|
46
|
+
...rest,
|
|
47
|
+
ref: forwardedRef
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}), PopoverTrigger = React.forwardRef(function(props, forwardedRef) {
|
|
51
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef), trigger = /* @__PURE__ */ jsx(
|
|
52
|
+
View,
|
|
53
|
+
{
|
|
54
|
+
"aria-haspopup": "dialog",
|
|
55
|
+
"aria-expanded": context.open,
|
|
56
|
+
"data-state": getState(context.open),
|
|
57
|
+
...rest,
|
|
58
|
+
ref: composedTriggerRef,
|
|
59
|
+
onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperAnchor, { __scopePopper: __scopePopover || POPOVER_SCOPE, asChild: !0, children: trigger });
|
|
63
|
+
}), PopoverContent = PopperContentFrame.extractable(
|
|
64
|
+
React.forwardRef(function(props, forwardedRef) {
|
|
65
|
+
const {
|
|
66
|
+
allowPinchZoom,
|
|
67
|
+
trapFocus,
|
|
68
|
+
disableRemoveScroll = !0,
|
|
69
|
+
zIndex,
|
|
70
|
+
__scopePopover,
|
|
71
|
+
...contentImplProps
|
|
72
|
+
} = props, context = usePopoverContext(__scopePopover), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), isRightClickOutsideRef = React.useRef(!1);
|
|
73
|
+
return React.useEffect(() => {
|
|
74
|
+
if (!context.open)
|
|
75
|
+
return;
|
|
76
|
+
const content = contentRef.current;
|
|
77
|
+
if (content)
|
|
78
|
+
return hideOthers(content);
|
|
79
|
+
}, [context.open]), /* @__PURE__ */ jsx(PopoverContentPortal, { __scopePopover, zIndex: props.zIndex, children: /* @__PURE__ */ jsx(Stack, { pointerEvents: context.open ? "auto" : "none", children: /* @__PURE__ */ jsx(
|
|
80
|
+
PopoverContentImpl,
|
|
49
81
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
82
|
+
...contentImplProps,
|
|
83
|
+
disableRemoveScroll,
|
|
84
|
+
ref: composedRefs,
|
|
85
|
+
__scopePopover,
|
|
86
|
+
trapFocus: trapFocus ?? context.open,
|
|
87
|
+
disableOutsidePointerEvents: !0,
|
|
88
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
89
|
+
event.preventDefault(), isRightClickOutsideRef.current || context.triggerRef.current?.focus();
|
|
90
|
+
}),
|
|
91
|
+
onPointerDownOutside: composeEventHandlers(
|
|
92
|
+
props.onPointerDownOutside,
|
|
93
|
+
(event) => {
|
|
94
|
+
const originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
95
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
96
|
+
},
|
|
97
|
+
{ checkDefaultPrevented: !1 }
|
|
98
|
+
),
|
|
99
|
+
onFocusOutside: composeEventHandlers(
|
|
100
|
+
props.onFocusOutside,
|
|
101
|
+
(event) => event.preventDefault(),
|
|
102
|
+
{ checkDefaultPrevented: !1 }
|
|
103
|
+
)
|
|
56
104
|
}
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
), PopoverContent = PopperContentFrame.extractable(
|
|
61
|
-
React.forwardRef(
|
|
62
|
-
function(props, forwardedRef) {
|
|
63
|
-
const {
|
|
64
|
-
allowPinchZoom,
|
|
65
|
-
trapFocus,
|
|
66
|
-
disableRemoveScroll = !0,
|
|
67
|
-
zIndex,
|
|
68
|
-
...contentImplProps
|
|
69
|
-
} = props, context = usePopoverContext(), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), isRightClickOutsideRef = React.useRef(!1);
|
|
70
|
-
return React.useEffect(() => {
|
|
71
|
-
if (!context.open)
|
|
72
|
-
return;
|
|
73
|
-
const content = contentRef.current;
|
|
74
|
-
if (content)
|
|
75
|
-
return hideOthers(content);
|
|
76
|
-
}, [context.open]), /* @__PURE__ */ jsx(PopoverContentPortal, { zIndex: props.zIndex, children: /* @__PURE__ */ jsx(Stack, { pointerEvents: context.open ? "auto" : "none", children: /* @__PURE__ */ jsx(
|
|
77
|
-
PopoverContentImpl,
|
|
78
|
-
{
|
|
79
|
-
...contentImplProps,
|
|
80
|
-
disableRemoveScroll,
|
|
81
|
-
ref: composedRefs,
|
|
82
|
-
trapFocus: trapFocus ?? context.open,
|
|
83
|
-
disableOutsidePointerEvents: !0,
|
|
84
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
85
|
-
event.preventDefault(), isRightClickOutsideRef.current || context.triggerRef.current?.focus();
|
|
86
|
-
}),
|
|
87
|
-
onPointerDownOutside: composeEventHandlers(
|
|
88
|
-
props.onPointerDownOutside,
|
|
89
|
-
(event) => {
|
|
90
|
-
const originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
91
|
-
isRightClickOutsideRef.current = isRightClick;
|
|
92
|
-
},
|
|
93
|
-
{ checkDefaultPrevented: !1 }
|
|
94
|
-
),
|
|
95
|
-
onFocusOutside: composeEventHandlers(
|
|
96
|
-
props.onFocusOutside,
|
|
97
|
-
(event) => event.preventDefault(),
|
|
98
|
-
{ checkDefaultPrevented: !1 }
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
) }) });
|
|
102
|
-
}
|
|
103
|
-
)
|
|
105
|
+
) }) });
|
|
106
|
+
})
|
|
104
107
|
);
|
|
105
108
|
function PopoverRepropagateContext(props) {
|
|
106
109
|
return /* @__PURE__ */ jsx(PopperContext.Provider, { ...props.popperContext, children: /* @__PURE__ */ jsx(PopoverContext.Provider, { ...props.context, children: props.children }) });
|
|
107
110
|
}
|
|
108
111
|
function PopoverContentPortal(props) {
|
|
109
|
-
const zIndex = props.zIndex ?? 15e4, context = usePopoverContext(), popperContext = usePopperContext(), themeName = useThemeName();
|
|
112
|
+
const { __scopePopover } = props, zIndex = props.zIndex ?? 15e4, context = usePopoverContext(__scopePopover), popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE), themeName = useThemeName();
|
|
110
113
|
let contents = props.children;
|
|
111
114
|
return (Platform.OS === "android" || Platform.OS === "ios") && (contents = /* @__PURE__ */ jsx(PopoverRepropagateContext, { popperContext, context, children: props.children })), /* @__PURE__ */ jsx(Portal, { zIndex, children: /* @__PURE__ */ jsxs(Theme, { forceClassName: !0, name: themeName, children: [
|
|
112
115
|
!!context.open && !context.breakpointActive && /* @__PURE__ */ jsx(
|
|
@@ -122,6 +125,7 @@ function PopoverContentPortal(props) {
|
|
|
122
125
|
const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
123
126
|
const {
|
|
124
127
|
trapFocus,
|
|
128
|
+
__scopePopover,
|
|
125
129
|
onOpenAutoFocus,
|
|
126
130
|
onCloseAutoFocus,
|
|
127
131
|
disableOutsidePointerEvents,
|
|
@@ -134,13 +138,20 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
134
138
|
disableRemoveScroll,
|
|
135
139
|
freezeContentsWhenHidden,
|
|
136
140
|
...contentProps
|
|
137
|
-
} = props, context = usePopoverContext(), { open, keepChildrenMounted } = context, popperContext = usePopperContext(), [isFullyHidden, setIsFullyHidden] = React.useState(!context.open), contents = React.useMemo(() => isWeb ? /* @__PURE__ */ jsx("div", { style: { display: "contents" }, children }) : children, [children]);
|
|
141
|
+
} = props, context = usePopoverContext(__scopePopover), { open, keepChildrenMounted } = context, popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE), [isFullyHidden, setIsFullyHidden] = React.useState(!context.open), contents = React.useMemo(() => isWeb ? /* @__PURE__ */ jsx("div", { style: { display: "contents" }, children }) : children, [children]);
|
|
138
142
|
if (open && isFullyHidden && setIsFullyHidden(!1), !keepChildrenMounted && isFullyHidden)
|
|
139
143
|
return null;
|
|
140
144
|
if (context.breakpointActive) {
|
|
141
145
|
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => React.isValidElement(child) && child.type === ScrollView ? child.props.children : child);
|
|
142
146
|
let content = childrenWithoutScrollView;
|
|
143
|
-
return (Platform.OS === "android" || Platform.OS === "ios") && (content = /* @__PURE__ */ jsx(
|
|
147
|
+
return (Platform.OS === "android" || Platform.OS === "ios") && (content = /* @__PURE__ */ jsx(
|
|
148
|
+
PopperContext.Provider,
|
|
149
|
+
{
|
|
150
|
+
scope: __scopePopover || POPOVER_SCOPE,
|
|
151
|
+
...popperContext,
|
|
152
|
+
children: childrenWithoutScrollView
|
|
153
|
+
}
|
|
154
|
+
)), /* @__PURE__ */ jsx(PortalItem, { hostName: `${context.id}PopoverContents`, children: content });
|
|
144
155
|
}
|
|
145
156
|
return /* @__PURE__ */ jsx(
|
|
146
157
|
Animate,
|
|
@@ -158,6 +169,7 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
158
169
|
children: /* @__PURE__ */ jsx(
|
|
159
170
|
PopperContent,
|
|
160
171
|
{
|
|
172
|
+
__scopePopper: __scopePopover || POPOVER_SCOPE,
|
|
161
173
|
"data-state": getState(open),
|
|
162
174
|
id: context.contentId,
|
|
163
175
|
ref: forwardedRef,
|
|
@@ -194,33 +206,39 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
194
206
|
}), FreezeToLastContents = (props) => {
|
|
195
207
|
const last = React.useRef();
|
|
196
208
|
return props.freeze || (last.current = props.children), /* @__PURE__ */ jsx(Freeze, { placeholder: last.current, ...props });
|
|
197
|
-
}, PopoverClose = React.forwardRef(
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
onPress
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
209
|
+
}, PopoverClose = React.forwardRef(function(props, forwardedRef) {
|
|
210
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover);
|
|
211
|
+
return /* @__PURE__ */ jsx(
|
|
212
|
+
YStack,
|
|
213
|
+
{
|
|
214
|
+
...rest,
|
|
215
|
+
ref: forwardedRef,
|
|
216
|
+
componentName: "PopoverClose",
|
|
217
|
+
onPress: composeEventHandlers(
|
|
218
|
+
props.onPress,
|
|
219
|
+
() => context.onOpenChange(!1)
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}), PopoverArrow = React.forwardRef(function(props, forwardedRef) {
|
|
224
|
+
const { __scopePopover, ...rest } = props;
|
|
225
|
+
return /* @__PURE__ */ jsx(
|
|
226
|
+
PopperArrow,
|
|
227
|
+
{
|
|
228
|
+
__scopePopper: __scopePopover || POPOVER_SCOPE,
|
|
229
|
+
componentName: "PopoverArrow",
|
|
230
|
+
...rest,
|
|
231
|
+
ref: forwardedRef
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}), Popover = withStaticProperties(
|
|
218
235
|
function(props) {
|
|
219
236
|
const {
|
|
220
237
|
children,
|
|
221
238
|
open: openProp,
|
|
222
239
|
defaultOpen,
|
|
223
240
|
onOpenChange,
|
|
241
|
+
__scopePopover,
|
|
224
242
|
keepChildrenMounted,
|
|
225
243
|
...restProps
|
|
226
244
|
} = props, id = React.useId(), { when, AdaptProvider } = useAdaptParent({
|
|
@@ -244,7 +262,7 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
244
262
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(!0), []),
|
|
245
263
|
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(!1), []),
|
|
246
264
|
keepChildrenMounted
|
|
247
|
-
}, contents = /* @__PURE__ */ jsx(Popper, { stayInFrame: !0, ...restProps, children: /* @__PURE__ */ jsx(PopoverContext.Provider, { ...popoverContext, children: /* @__PURE__ */ jsx(PopoverSheetController, { onOpenChange: setOpen, children }) }) });
|
|
265
|
+
}, contents = /* @__PURE__ */ jsx(Popper, { __scopePopper: __scopePopover || POPOVER_SCOPE, stayInFrame: !0, ...restProps, children: /* @__PURE__ */ jsx(PopoverContext.Provider, { scope: __scopePopover, ...popoverContext, children: /* @__PURE__ */ jsx(PopoverSheetController, { onOpenChange: setOpen, children }) }) });
|
|
248
266
|
return /* @__PURE__ */ jsx(AdaptProvider, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: floatingContext, children: contents }) : contents });
|
|
249
267
|
},
|
|
250
268
|
{
|
|
@@ -261,8 +279,11 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
261
279
|
function getState(open) {
|
|
262
280
|
return open ? "open" : "closed";
|
|
263
281
|
}
|
|
264
|
-
const PopoverSheetController = (
|
|
265
|
-
|
|
282
|
+
const PopoverSheetController = ({
|
|
283
|
+
__scopePopover,
|
|
284
|
+
...props
|
|
285
|
+
}) => {
|
|
286
|
+
const context = usePopoverContext(__scopePopover), showSheet = useShowPopoverSheet(context), breakpointActive = context.breakpointActive, getShowSheet = useGet(showSheet);
|
|
266
287
|
return /* @__PURE__ */ jsx(
|
|
267
288
|
SheetController,
|
|
268
289
|
{
|
package/dist/esm/Popover.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Popover.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,
|
|
4
|
+
"mappings": "AAAA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,eAAe;AACxB,SAAS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A,MAAM,yBAAyB,CAAC;AAAA,EAC9B;AAAA,EACA,GAAG;AACL,MAGO;AACL,QAAM,UAAU,kBAAkB,cAAc,GAC1C,YAAY,oBAAoB,OAAO,GACvC,mBAAmB,QAAQ,kBAC3B,eAAe,OAAO,SAAS;AAErC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAc,CAAC,QAAQ;AACrB,QAAI,aAAa,KACf,MAAM,aAAa,GAAG;AAAA,MAE1B;AAAA,MACA,MAAM,QAAQ;AAAA,MACd,QAAQ,qBAAqB;AAAA,MAE5B,gBAAM;AAAA;AAAA,EACT;AAEJ,GAEM,2BAA2B,CAAC,eAAgD;AAChF,QAAM,QAAQ,SAAS;AACvB,SAAI,OAAO,cAAe,aAAa,CAAC,aAC/B,CAAC,CAAC,aAEJ,MAAM,UAAU;AACzB,GAEM,sBAAsB,CAAC,YAAiC;AAC5D,QAAM,mBAAmB,yBAAyB,QAAQ,eAAe;AACzE,SAAO,QAAQ,SAAS,KAAQ,KAAQ;AAC1C;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/jsx/Popover.js
CHANGED
|
@@ -36,70 +36,70 @@ import * as React from "react";
|
|
|
36
36
|
import { Freeze } from "react-freeze";
|
|
37
37
|
import { Platform, ScrollView } from "react-native";
|
|
38
38
|
import { useFloatingContext } from "./useFloatingContext";
|
|
39
|
-
const PopoverContext = createStyledContext({}), usePopoverContext =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
), PopoverContent = PopperContentFrame.extractable(
|
|
57
|
-
React.forwardRef(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)
|
|
39
|
+
const POPOVER_SCOPE = "PopoverScope", PopoverContext = createStyledContext({}), usePopoverContext = PopoverContext.useStyledContext, PopoverAnchor = React.forwardRef(function(props, forwardedRef) {
|
|
40
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), { onCustomAnchorAdd, onCustomAnchorRemove } = context || {};
|
|
41
|
+
return React.useEffect(() => (onCustomAnchorAdd(), () => onCustomAnchorRemove()), [onCustomAnchorAdd, onCustomAnchorRemove]), <PopperAnchor
|
|
42
|
+
__scopePopper={__scopePopover || POPOVER_SCOPE}
|
|
43
|
+
{...rest}
|
|
44
|
+
ref={forwardedRef}
|
|
45
|
+
/>;
|
|
46
|
+
}), PopoverTrigger = React.forwardRef(function(props, forwardedRef) {
|
|
47
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover), composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef), trigger = <View
|
|
48
|
+
aria-haspopup="dialog"
|
|
49
|
+
aria-expanded={context.open}
|
|
50
|
+
data-state={getState(context.open)}
|
|
51
|
+
{...rest}
|
|
52
|
+
ref={composedTriggerRef}
|
|
53
|
+
onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}
|
|
54
|
+
/>;
|
|
55
|
+
return context.hasCustomAnchor ? trigger : <PopperAnchor __scopePopper={__scopePopover || POPOVER_SCOPE} asChild>{trigger}</PopperAnchor>;
|
|
56
|
+
}), PopoverContent = PopperContentFrame.extractable(
|
|
57
|
+
React.forwardRef(function(props, forwardedRef) {
|
|
58
|
+
const {
|
|
59
|
+
allowPinchZoom,
|
|
60
|
+
trapFocus,
|
|
61
|
+
disableRemoveScroll = !0,
|
|
62
|
+
zIndex,
|
|
63
|
+
__scopePopover,
|
|
64
|
+
...contentImplProps
|
|
65
|
+
} = props, context = usePopoverContext(__scopePopover), contentRef = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, contentRef), isRightClickOutsideRef = React.useRef(!1);
|
|
66
|
+
return React.useEffect(() => {
|
|
67
|
+
if (!context.open)
|
|
68
|
+
return;
|
|
69
|
+
const content = contentRef.current;
|
|
70
|
+
if (content)
|
|
71
|
+
return hideOthers(content);
|
|
72
|
+
}, [context.open]), <PopoverContentPortal __scopePopover={__scopePopover} zIndex={props.zIndex}><Stack pointerEvents={context.open ? "auto" : "none"}><PopoverContentImpl
|
|
73
|
+
{...contentImplProps}
|
|
74
|
+
disableRemoveScroll={disableRemoveScroll}
|
|
75
|
+
ref={composedRefs}
|
|
76
|
+
__scopePopover={__scopePopover}
|
|
77
|
+
trapFocus={trapFocus ?? context.open}
|
|
78
|
+
disableOutsidePointerEvents
|
|
79
|
+
onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
80
|
+
event.preventDefault(), isRightClickOutsideRef.current || context.triggerRef.current?.focus();
|
|
81
|
+
})}
|
|
82
|
+
onPointerDownOutside={composeEventHandlers(
|
|
83
|
+
props.onPointerDownOutside,
|
|
84
|
+
(event) => {
|
|
85
|
+
const originalEvent = event.detail.originalEvent, ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === !0, isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
86
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
87
|
+
},
|
|
88
|
+
{ checkDefaultPrevented: !1 }
|
|
89
|
+
)}
|
|
90
|
+
onFocusOutside={composeEventHandlers(
|
|
91
|
+
props.onFocusOutside,
|
|
92
|
+
(event) => event.preventDefault(),
|
|
93
|
+
{ checkDefaultPrevented: !1 }
|
|
94
|
+
)}
|
|
95
|
+
/></Stack></PopoverContentPortal>;
|
|
96
|
+
})
|
|
97
97
|
);
|
|
98
98
|
function PopoverRepropagateContext(props) {
|
|
99
99
|
return <PopperContext.Provider {...props.popperContext}><PopoverContext.Provider {...props.context}>{props.children}</PopoverContext.Provider></PopperContext.Provider>;
|
|
100
100
|
}
|
|
101
101
|
function PopoverContentPortal(props) {
|
|
102
|
-
const zIndex = props.zIndex ?? 15e4, context = usePopoverContext(), popperContext = usePopperContext(), themeName = useThemeName();
|
|
102
|
+
const { __scopePopover } = props, zIndex = props.zIndex ?? 15e4, context = usePopoverContext(__scopePopover), popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE), themeName = useThemeName();
|
|
103
103
|
let contents = props.children;
|
|
104
104
|
return (Platform.OS === "android" || Platform.OS === "ios") && (contents = <PopoverRepropagateContext popperContext={popperContext} context={context}>{props.children}</PopoverRepropagateContext>), <Portal zIndex={zIndex}><Theme forceClassName name={themeName}>
|
|
105
105
|
{!!context.open && !context.breakpointActive && <YStack
|
|
@@ -112,6 +112,7 @@ function PopoverContentPortal(props) {
|
|
|
112
112
|
const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
113
113
|
const {
|
|
114
114
|
trapFocus,
|
|
115
|
+
__scopePopover,
|
|
115
116
|
onOpenAutoFocus,
|
|
116
117
|
onCloseAutoFocus,
|
|
117
118
|
disableOutsidePointerEvents,
|
|
@@ -124,13 +125,16 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
124
125
|
disableRemoveScroll,
|
|
125
126
|
freezeContentsWhenHidden,
|
|
126
127
|
...contentProps
|
|
127
|
-
} = props, context = usePopoverContext(), { open, keepChildrenMounted } = context, popperContext = usePopperContext(), [isFullyHidden, setIsFullyHidden] = React.useState(!context.open), contents = React.useMemo(() => isWeb ? <div style={{ display: "contents" }}>{children}</div> : children, [children]);
|
|
128
|
+
} = props, context = usePopoverContext(__scopePopover), { open, keepChildrenMounted } = context, popperContext = usePopperContext(__scopePopover || POPOVER_SCOPE), [isFullyHidden, setIsFullyHidden] = React.useState(!context.open), contents = React.useMemo(() => isWeb ? <div style={{ display: "contents" }}>{children}</div> : children, [children]);
|
|
128
129
|
if (open && isFullyHidden && setIsFullyHidden(!1), !keepChildrenMounted && isFullyHidden)
|
|
129
130
|
return null;
|
|
130
131
|
if (context.breakpointActive) {
|
|
131
132
|
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => React.isValidElement(child) && child.type === ScrollView ? child.props.children : child);
|
|
132
133
|
let content = childrenWithoutScrollView;
|
|
133
|
-
return (Platform.OS === "android" || Platform.OS === "ios") && (content = <PopperContext.Provider
|
|
134
|
+
return (Platform.OS === "android" || Platform.OS === "ios") && (content = <PopperContext.Provider
|
|
135
|
+
scope={__scopePopover || POPOVER_SCOPE}
|
|
136
|
+
{...popperContext}
|
|
137
|
+
>{childrenWithoutScrollView}</PopperContext.Provider>), <PortalItem hostName={`${context.id}PopoverContents`}>{content}</PortalItem>;
|
|
134
138
|
}
|
|
135
139
|
const freeze = !!(isFullyHidden && freezeContentsWhenHidden);
|
|
136
140
|
return <Animate
|
|
@@ -143,6 +147,7 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
143
147
|
><FreezeToLastContents
|
|
144
148
|
freeze={freeze}
|
|
145
149
|
><PopperContent
|
|
150
|
+
__scopePopper={__scopePopover || POPOVER_SCOPE}
|
|
146
151
|
key={context.contentId}
|
|
147
152
|
data-state={getState(open)}
|
|
148
153
|
id={context.contentId}
|
|
@@ -165,30 +170,33 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
165
170
|
}), FreezeToLastContents = (props) => {
|
|
166
171
|
const last = React.useRef();
|
|
167
172
|
return props.freeze || (last.current = props.children), <Freeze placeholder={last.current} {...props} />;
|
|
168
|
-
}, PopoverClose = React.forwardRef(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
onPress
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
}, PopoverClose = React.forwardRef(function(props, forwardedRef) {
|
|
174
|
+
const { __scopePopover, ...rest } = props, context = usePopoverContext(__scopePopover);
|
|
175
|
+
return <YStack
|
|
176
|
+
{...rest}
|
|
177
|
+
ref={forwardedRef}
|
|
178
|
+
componentName="PopoverClose"
|
|
179
|
+
onPress={composeEventHandlers(
|
|
180
|
+
props.onPress,
|
|
181
|
+
() => context.onOpenChange(!1)
|
|
182
|
+
)}
|
|
183
|
+
/>;
|
|
184
|
+
}), PopoverArrow = React.forwardRef(function(props, forwardedRef) {
|
|
185
|
+
const { __scopePopover, ...rest } = props;
|
|
186
|
+
return <PopperArrow
|
|
187
|
+
__scopePopper={__scopePopover || POPOVER_SCOPE}
|
|
188
|
+
componentName="PopoverArrow"
|
|
189
|
+
{...rest}
|
|
190
|
+
ref={forwardedRef}
|
|
191
|
+
/>;
|
|
192
|
+
}), Popover = withStaticProperties(
|
|
186
193
|
function(props) {
|
|
187
194
|
const {
|
|
188
195
|
children,
|
|
189
196
|
open: openProp,
|
|
190
197
|
defaultOpen,
|
|
191
198
|
onOpenChange,
|
|
199
|
+
__scopePopover,
|
|
192
200
|
keepChildrenMounted,
|
|
193
201
|
...restProps
|
|
194
202
|
} = props, id = React.useId(), { when, AdaptProvider } = useAdaptParent({
|
|
@@ -212,7 +220,7 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
212
220
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(!0), []),
|
|
213
221
|
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(!1), []),
|
|
214
222
|
keepChildrenMounted
|
|
215
|
-
}, contents = <Popper stayInFrame {...restProps}><PopoverContext.Provider {...popoverContext}><PopoverSheetController onOpenChange={setOpen}>{children}</PopoverSheetController></PopoverContext.Provider></Popper>;
|
|
223
|
+
}, contents = <Popper __scopePopper={__scopePopover || POPOVER_SCOPE} stayInFrame {...restProps}><PopoverContext.Provider scope={__scopePopover} {...popoverContext}><PopoverSheetController onOpenChange={setOpen}>{children}</PopoverSheetController></PopoverContext.Provider></Popper>;
|
|
216
224
|
return <AdaptProvider>{isWeb ? <FloatingOverrideContext.Provider value={floatingContext}>{contents}</FloatingOverrideContext.Provider> : contents}</AdaptProvider>;
|
|
217
225
|
},
|
|
218
226
|
{
|
|
@@ -229,8 +237,11 @@ const PopoverContentImpl = React.forwardRef(function(props, forwardedRef) {
|
|
|
229
237
|
function getState(open) {
|
|
230
238
|
return open ? "open" : "closed";
|
|
231
239
|
}
|
|
232
|
-
const PopoverSheetController = (
|
|
233
|
-
|
|
240
|
+
const PopoverSheetController = ({
|
|
241
|
+
__scopePopover,
|
|
242
|
+
...props
|
|
243
|
+
}) => {
|
|
244
|
+
const context = usePopoverContext(__scopePopover), showSheet = useShowPopoverSheet(context), breakpointActive = context.breakpointActive, getShowSheet = useGet(showSheet);
|
|
234
245
|
return <SheetController
|
|
235
246
|
onOpenChange={(val) => {
|
|
236
247
|
getShowSheet() && props.onOpenChange(val);
|
package/dist/jsx/Popover.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Popover.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,
|
|
4
|
+
"mappings": "AAAA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AACh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