@tamagui/popover 1.30.7 → 1.30.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 +49 -85
- package/dist/cjs/Popover.js.map +2 -2
- package/dist/esm/Popover.js +49 -84
- package/dist/esm/Popover.js.map +2 -2
- package/dist/jsx/Popover.js +46 -86
- package/dist/jsx/Popover.js.map +2 -2
- package/dist/jsx/Popover.mjs +46 -86
- package/dist/jsx/Popover.mjs.map +2 -2
- package/package.json +18 -19
- package/src/Popover.tsx +75 -137
- package/types/Popover.d.ts +18 -134
- package/types/Popover.d.ts.map +1 -1
package/dist/jsx/Popover.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Stack,
|
|
8
8
|
Theme,
|
|
9
9
|
composeEventHandlers,
|
|
10
|
+
createStyledContext,
|
|
10
11
|
isWeb,
|
|
11
12
|
useEvent,
|
|
12
13
|
useGet,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
useThemeName,
|
|
15
16
|
withStaticProperties
|
|
16
17
|
} from "@tamagui/core";
|
|
17
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
18
18
|
import { FloatingOverrideContext } from "@tamagui/floating";
|
|
19
19
|
import { FocusScope } from "@tamagui/focus-scope";
|
|
20
20
|
import {
|
|
@@ -23,8 +23,7 @@ import {
|
|
|
23
23
|
PopperArrow,
|
|
24
24
|
PopperContent,
|
|
25
25
|
PopperContentFrame,
|
|
26
|
-
|
|
27
|
-
createPopperScope,
|
|
26
|
+
PopperContext,
|
|
28
27
|
usePopperContext
|
|
29
28
|
} from "@tamagui/popper";
|
|
30
29
|
import { Portal, PortalHost, PortalItem } from "@tamagui/portal";
|
|
@@ -35,48 +34,34 @@ import { useControllableState } from "@tamagui/use-controllable-state";
|
|
|
35
34
|
import * as React from "react";
|
|
36
35
|
import { Platform, ScrollView } from "react-native";
|
|
37
36
|
import { useFloatingContext } from "./useFloatingContext";
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
POPOVER_NAME,
|
|
41
|
-
[createPopperScope]
|
|
42
|
-
);
|
|
43
|
-
const usePopoverScope = createPopperScope();
|
|
44
|
-
const createPopoverScope = createPopoverScopeInternal;
|
|
45
|
-
const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
|
|
46
|
-
const __PopoverProviderInternal = PopoverProviderInternal;
|
|
47
|
-
const ANCHOR_NAME = "PopoverAnchor";
|
|
37
|
+
const PopoverContext = createStyledContext({});
|
|
38
|
+
const usePopoverContext = () => React.useContext(PopoverContext);
|
|
48
39
|
const PopoverAnchor = React.forwardRef(
|
|
49
|
-
(props, forwardedRef)
|
|
50
|
-
const
|
|
51
|
-
const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
|
|
52
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
40
|
+
function PopoverAnchor2(props, forwardedRef) {
|
|
41
|
+
const context = usePopoverContext();
|
|
53
42
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
54
43
|
React.useEffect(() => {
|
|
55
44
|
onCustomAnchorAdd();
|
|
56
45
|
return () => onCustomAnchorRemove();
|
|
57
46
|
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
58
|
-
return <PopperAnchor {...
|
|
47
|
+
return <PopperAnchor {...props} ref={forwardedRef} />;
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
const PopoverTrigger = React.forwardRef(
|
|
51
|
+
function PopoverTrigger2(props, forwardedRef) {
|
|
52
|
+
const context = usePopoverContext();
|
|
53
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
54
|
+
const trigger = <YStack
|
|
55
|
+
aria-haspopup="dialog"
|
|
56
|
+
aria-expanded={context.open}
|
|
57
|
+
data-state={getState(context.open)}
|
|
58
|
+
{...props}
|
|
59
|
+
ref={composedTriggerRef}
|
|
60
|
+
onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}
|
|
61
|
+
/>;
|
|
62
|
+
return context.hasCustomAnchor ? trigger : <PopperAnchor asChild>{trigger}</PopperAnchor>;
|
|
59
63
|
}
|
|
60
64
|
);
|
|
61
|
-
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
62
|
-
const TRIGGER_NAME = "PopoverTrigger";
|
|
63
|
-
const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
|
|
64
|
-
const { __scopePopover, ...triggerProps } = props;
|
|
65
|
-
const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
|
|
66
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
67
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
68
|
-
const trigger = <YStack
|
|
69
|
-
aria-haspopup="dialog"
|
|
70
|
-
aria-expanded={context.open}
|
|
71
|
-
data-state={getState(context.open)}
|
|
72
|
-
{...triggerProps}
|
|
73
|
-
ref={composedTriggerRef}
|
|
74
|
-
onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}
|
|
75
|
-
/>;
|
|
76
|
-
return context.hasCustomAnchor ? trigger : <PopperAnchor asChild {...popperScope}>{trigger}</PopperAnchor>;
|
|
77
|
-
});
|
|
78
|
-
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
79
|
-
const CONTENT_NAME = "PopoverContent";
|
|
80
65
|
const PopoverContent = PopperContentFrame.extractable(
|
|
81
66
|
React.forwardRef(
|
|
82
67
|
function PopoverContent2(props, forwardedRef) {
|
|
@@ -87,7 +72,7 @@ const PopoverContent = PopperContentFrame.extractable(
|
|
|
87
72
|
zIndex,
|
|
88
73
|
...contentImplProps
|
|
89
74
|
} = props;
|
|
90
|
-
const context =
|
|
75
|
+
const context = usePopoverContext();
|
|
91
76
|
const contentRef = React.useRef(null);
|
|
92
77
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
93
78
|
const isRightClickOutsideRef = React.useRef(false);
|
|
@@ -128,18 +113,17 @@ const PopoverContent = PopperContentFrame.extractable(
|
|
|
128
113
|
}
|
|
129
114
|
)
|
|
130
115
|
);
|
|
116
|
+
function PopoverRepropagateContext(props) {
|
|
117
|
+
const context = usePopoverContext();
|
|
118
|
+
const popperContext = usePopperContext();
|
|
119
|
+
return <PopperContext.Provider {...popperContext}><PopoverContext.Provider {...context}>{props.children}</PopoverContext.Provider></PopperContext.Provider>;
|
|
120
|
+
}
|
|
131
121
|
function PopoverContentPortal(props) {
|
|
132
122
|
const themeName = useThemeName();
|
|
133
|
-
const context =
|
|
123
|
+
const context = usePopoverContext();
|
|
134
124
|
let contents = props.children;
|
|
135
125
|
if (Platform.OS === "android") {
|
|
136
|
-
|
|
137
|
-
contents = <PopperProvider {...popperContext} scope={context.popperScope}><PopoverProviderInternal scope={props.__scopePopover} {...context}>
|
|
138
|
-
{
|
|
139
|
-
/* does this need to be props.__scopePopper? */
|
|
140
|
-
}
|
|
141
|
-
{props.children}
|
|
142
|
-
</PopoverProviderInternal></PopperProvider>;
|
|
126
|
+
contents = <PopoverRepropagateContext>{props.children}</PopoverRepropagateContext>;
|
|
143
127
|
}
|
|
144
128
|
const zIndex = props.zIndex ?? 15e4;
|
|
145
129
|
return <Portal zIndex={zIndex}><Theme forceClassName name={themeName}>
|
|
@@ -152,7 +136,6 @@ function PopoverContentPortal(props) {
|
|
|
152
136
|
}
|
|
153
137
|
const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
154
138
|
const {
|
|
155
|
-
__scopePopover,
|
|
156
139
|
trapFocus,
|
|
157
140
|
onOpenAutoFocus,
|
|
158
141
|
onCloseAutoFocus,
|
|
@@ -165,8 +148,7 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
165
148
|
disableRemoveScroll,
|
|
166
149
|
...contentProps
|
|
167
150
|
} = props;
|
|
168
|
-
const
|
|
169
|
-
const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover);
|
|
151
|
+
const context = usePopoverContext();
|
|
170
152
|
const [isFullyHidden, setIsFullyHidden] = React.useState(!context.open);
|
|
171
153
|
if (context.breakpointActive) {
|
|
172
154
|
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {
|
|
@@ -177,7 +159,7 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
177
159
|
}
|
|
178
160
|
return child;
|
|
179
161
|
});
|
|
180
|
-
return <PortalItem hostName={`${context.
|
|
162
|
+
return <PortalItem hostName={`${context.id}PopoverContents`}>{childrenWithoutScrollView}</PortalItem>;
|
|
181
163
|
}
|
|
182
164
|
if (context.open && isFullyHidden) {
|
|
183
165
|
setIsFullyHidden(false);
|
|
@@ -195,7 +177,6 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
195
177
|
id={context.contentId}
|
|
196
178
|
pointerEvents="auto"
|
|
197
179
|
ref={forwardedRef}
|
|
198
|
-
{...popperScope}
|
|
199
180
|
{...contentProps}
|
|
200
181
|
><RemoveScroll
|
|
201
182
|
enabled={disableRemoveScroll ? false : context.open}
|
|
@@ -211,14 +192,13 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
211
192
|
onUnmountAutoFocus={onCloseAutoFocus}
|
|
212
193
|
>{isWeb ? <div style={{ display: "contents" }}>{children}</div> : children}</FocusScope>}</RemoveScroll></PopperContent>}</AnimatePresence>;
|
|
213
194
|
});
|
|
214
|
-
const CLOSE_NAME = "PopoverClose";
|
|
215
195
|
const PopoverClose = React.forwardRef(
|
|
216
|
-
(props, forwardedRef)
|
|
217
|
-
const
|
|
218
|
-
const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
|
|
196
|
+
function PopoverClose2(props, forwardedRef) {
|
|
197
|
+
const context = usePopoverContext();
|
|
219
198
|
return <YStack
|
|
220
|
-
{...
|
|
199
|
+
{...props}
|
|
221
200
|
ref={forwardedRef}
|
|
201
|
+
componentName="PopoverClose"
|
|
222
202
|
onPress={composeEventHandlers(
|
|
223
203
|
props.onPress,
|
|
224
204
|
() => context.onOpenChange(false)
|
|
@@ -226,38 +206,24 @@ const PopoverClose = React.forwardRef(
|
|
|
226
206
|
/>;
|
|
227
207
|
}
|
|
228
208
|
);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
(props, forwardedRef) => {
|
|
233
|
-
const { __scopePopover, ...arrowProps } = props;
|
|
234
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
235
|
-
return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />;
|
|
209
|
+
const PopoverArrow = React.forwardRef(
|
|
210
|
+
function PopoverArrow2(props, forwardedRef) {
|
|
211
|
+
return <PopperArrow componentName="PopoverArrow" {...props} ref={forwardedRef} />;
|
|
236
212
|
}
|
|
237
213
|
);
|
|
238
|
-
PopoverArrow.displayName = ARROW_NAME;
|
|
239
214
|
const PopoverScrollView = React.forwardRef((props, ref) => {
|
|
240
215
|
return <ScrollView ref={ref} {...props} />;
|
|
241
216
|
});
|
|
242
217
|
const Popover = withStaticProperties(
|
|
243
218
|
function Popover2(props) {
|
|
244
|
-
const {
|
|
245
|
-
|
|
246
|
-
children,
|
|
247
|
-
open: openProp,
|
|
248
|
-
defaultOpen,
|
|
249
|
-
onOpenChange,
|
|
250
|
-
...restProps
|
|
251
|
-
} = props;
|
|
252
|
-
const internalId = React.useId();
|
|
253
|
-
const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId;
|
|
219
|
+
const { children, open: openProp, defaultOpen, onOpenChange, ...restProps } = props;
|
|
220
|
+
const id = React.useId();
|
|
254
221
|
const { when, AdaptProvider } = useAdaptParent({
|
|
255
222
|
Contents: React.useCallback(() => {
|
|
256
223
|
return <PortalHost name={`${id}PopoverContents`} />;
|
|
257
224
|
}, [])
|
|
258
225
|
});
|
|
259
226
|
const sheetBreakpoint = when;
|
|
260
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
261
227
|
const triggerRef = React.useRef(null);
|
|
262
228
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
263
229
|
const [open, setOpen] = useControllableState({
|
|
@@ -269,9 +235,7 @@ const Popover = withStaticProperties(
|
|
|
269
235
|
const breakpointActive = useSheetBreakpointActive(sheetBreakpoint);
|
|
270
236
|
const floatingContext = useFloatingContext({ open, setOpen, breakpointActive });
|
|
271
237
|
const popoverContext = {
|
|
272
|
-
|
|
273
|
-
scopeKey: id,
|
|
274
|
-
popperScope: popperScope.__scopePopper,
|
|
238
|
+
id,
|
|
275
239
|
sheetBreakpoint,
|
|
276
240
|
contentId: React.useId(),
|
|
277
241
|
triggerRef,
|
|
@@ -288,7 +252,7 @@ const Popover = withStaticProperties(
|
|
|
288
252
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
289
253
|
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
290
254
|
};
|
|
291
|
-
const contents = <Popper
|
|
255
|
+
const contents = <Popper stayInFrame {...restProps}><PopoverContext.Provider {...popoverContext}><PopoverSheetController onOpenChange={setOpen}>{children}</PopoverSheetController></PopoverContext.Provider></Popper>;
|
|
292
256
|
return <AdaptProvider>{isWeb ? <FloatingOverrideContext.Provider value={floatingContext}>{contents}</FloatingOverrideContext.Provider> : contents}</AdaptProvider>;
|
|
293
257
|
},
|
|
294
258
|
{
|
|
@@ -306,10 +270,7 @@ function getState(open) {
|
|
|
306
270
|
return open ? "open" : "closed";
|
|
307
271
|
}
|
|
308
272
|
const PopoverSheetController = (props) => {
|
|
309
|
-
const context =
|
|
310
|
-
"PopoverSheetController",
|
|
311
|
-
props.__scopePopover
|
|
312
|
-
);
|
|
273
|
+
const context = usePopoverContext();
|
|
313
274
|
const showSheet = useShowPopoverSheet(context);
|
|
314
275
|
const breakpointActive = context.breakpointActive;
|
|
315
276
|
const getShowSheet = useGet(showSheet);
|
|
@@ -340,9 +301,8 @@ export {
|
|
|
340
301
|
PopoverArrow,
|
|
341
302
|
PopoverClose,
|
|
342
303
|
PopoverContent,
|
|
304
|
+
PopoverContext,
|
|
343
305
|
PopoverTrigger,
|
|
344
|
-
|
|
345
|
-
createPopoverScope,
|
|
346
|
-
usePopoverScope
|
|
306
|
+
usePopoverContext
|
|
347
307
|
};
|
|
348
308
|
//# sourceMappingURL=Popover.js.map
|
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": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS
|
|
5
|
-
"names": ["PopoverContent", "Popover"]
|
|
4
|
+
"mappings": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,+BAA+B;AACxC,SAAS,kBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP,SAAS,QAAQ,YAAY,kBAAkB;AAC/C,SAAS,oBAAuC;AAChD,SAAS,OAAO,uBAAuB;AACvC,SAAS,cAA2B;AACpC,SAAS,4BAA4B;AACrC,YAAY,WAAW;AACvB,SAAS,UAAU,kBAAmC;AAEtD,SAAS,0BAA0B;AAuB5B,MAAM,iBAAiB,oBAAyC,CAAC,CAAQ;AAEzE,MAAM,oBAAoB,MAAM,MAAM,WAAW,cAAc;A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,YAAY,oBAAoB,OAAO;AAC7C,QAAM,mBAAmB,QAAQ;AACjC,QAAM,eAAe,OAAO,SAAS;AAErC,SACE,CAAC;AAAA,IACC,cAAc,CAAC,QAAQ;AACrB,UAAI,aAAa,GAAG;AAClB,cAAM,aAAa,GAAG;AAAA,MACxB;AAAA,IACF;AAAA,IACA,MAAM,QAAQ;AAAA,IACd,QAAQ,qBAAqB;AAAA,IAE5B,MAAM,SACT,EAVC;AAYL;AAEA,MAAM,2BAA2B,CAAC,eAAgD;AAChF,QAAM,QAAQ,SAAS;AACvB,MAAI,OAAO,eAAe,aAAa,CAAC,YAAY;AAClD,WAAO,CAAC,CAAC;AAAA,EACX;AACA,SAAO,MAAM,UAAU;AACzB;AAEA,MAAM,sBAAsB,CAAC,YAAiC;AAC5D,QAAM,mBAAmB,yBAAyB,QAAQ,eAAe;AACzE,SAAO,QAAQ,SAAS,QAAQ,QAAQ;AAC1C;",
|
|
5
|
+
"names": ["PopoverAnchor", "PopoverTrigger", "PopoverContent", "PopoverClose", "PopoverArrow", "Popover"]
|
|
6
6
|
}
|
package/dist/jsx/Popover.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Stack,
|
|
8
8
|
Theme,
|
|
9
9
|
composeEventHandlers,
|
|
10
|
+
createStyledContext,
|
|
10
11
|
isWeb,
|
|
11
12
|
useEvent,
|
|
12
13
|
useGet,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
useThemeName,
|
|
15
16
|
withStaticProperties
|
|
16
17
|
} from "@tamagui/core";
|
|
17
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
18
18
|
import { FloatingOverrideContext } from "@tamagui/floating";
|
|
19
19
|
import { FocusScope } from "@tamagui/focus-scope";
|
|
20
20
|
import {
|
|
@@ -23,8 +23,7 @@ import {
|
|
|
23
23
|
PopperArrow,
|
|
24
24
|
PopperContent,
|
|
25
25
|
PopperContentFrame,
|
|
26
|
-
|
|
27
|
-
createPopperScope,
|
|
26
|
+
PopperContext,
|
|
28
27
|
usePopperContext
|
|
29
28
|
} from "@tamagui/popper";
|
|
30
29
|
import { Portal, PortalHost, PortalItem } from "@tamagui/portal";
|
|
@@ -35,48 +34,34 @@ import { useControllableState } from "@tamagui/use-controllable-state";
|
|
|
35
34
|
import * as React from "react";
|
|
36
35
|
import { Platform, ScrollView } from "react-native";
|
|
37
36
|
import { useFloatingContext } from "./useFloatingContext";
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
POPOVER_NAME,
|
|
41
|
-
[createPopperScope]
|
|
42
|
-
);
|
|
43
|
-
const usePopoverScope = createPopperScope();
|
|
44
|
-
const createPopoverScope = createPopoverScopeInternal;
|
|
45
|
-
const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
|
|
46
|
-
const __PopoverProviderInternal = PopoverProviderInternal;
|
|
47
|
-
const ANCHOR_NAME = "PopoverAnchor";
|
|
37
|
+
const PopoverContext = createStyledContext({});
|
|
38
|
+
const usePopoverContext = () => React.useContext(PopoverContext);
|
|
48
39
|
const PopoverAnchor = React.forwardRef(
|
|
49
|
-
(props, forwardedRef)
|
|
50
|
-
const
|
|
51
|
-
const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
|
|
52
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
40
|
+
function PopoverAnchor2(props, forwardedRef) {
|
|
41
|
+
const context = usePopoverContext();
|
|
53
42
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
54
43
|
React.useEffect(() => {
|
|
55
44
|
onCustomAnchorAdd();
|
|
56
45
|
return () => onCustomAnchorRemove();
|
|
57
46
|
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
58
|
-
return <PopperAnchor {...
|
|
47
|
+
return <PopperAnchor {...props} ref={forwardedRef} />;
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
const PopoverTrigger = React.forwardRef(
|
|
51
|
+
function PopoverTrigger2(props, forwardedRef) {
|
|
52
|
+
const context = usePopoverContext();
|
|
53
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
54
|
+
const trigger = <YStack
|
|
55
|
+
aria-haspopup="dialog"
|
|
56
|
+
aria-expanded={context.open}
|
|
57
|
+
data-state={getState(context.open)}
|
|
58
|
+
{...props}
|
|
59
|
+
ref={composedTriggerRef}
|
|
60
|
+
onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}
|
|
61
|
+
/>;
|
|
62
|
+
return context.hasCustomAnchor ? trigger : <PopperAnchor asChild>{trigger}</PopperAnchor>;
|
|
59
63
|
}
|
|
60
64
|
);
|
|
61
|
-
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
62
|
-
const TRIGGER_NAME = "PopoverTrigger";
|
|
63
|
-
const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
|
|
64
|
-
const { __scopePopover, ...triggerProps } = props;
|
|
65
|
-
const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
|
|
66
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
67
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
68
|
-
const trigger = <YStack
|
|
69
|
-
aria-haspopup="dialog"
|
|
70
|
-
aria-expanded={context.open}
|
|
71
|
-
data-state={getState(context.open)}
|
|
72
|
-
{...triggerProps}
|
|
73
|
-
ref={composedTriggerRef}
|
|
74
|
-
onPress={composeEventHandlers(props.onPress, context.onOpenToggle)}
|
|
75
|
-
/>;
|
|
76
|
-
return context.hasCustomAnchor ? trigger : <PopperAnchor asChild {...popperScope}>{trigger}</PopperAnchor>;
|
|
77
|
-
});
|
|
78
|
-
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
79
|
-
const CONTENT_NAME = "PopoverContent";
|
|
80
65
|
const PopoverContent = PopperContentFrame.extractable(
|
|
81
66
|
React.forwardRef(
|
|
82
67
|
function PopoverContent2(props, forwardedRef) {
|
|
@@ -87,7 +72,7 @@ const PopoverContent = PopperContentFrame.extractable(
|
|
|
87
72
|
zIndex,
|
|
88
73
|
...contentImplProps
|
|
89
74
|
} = props;
|
|
90
|
-
const context =
|
|
75
|
+
const context = usePopoverContext();
|
|
91
76
|
const contentRef = React.useRef(null);
|
|
92
77
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
93
78
|
const isRightClickOutsideRef = React.useRef(false);
|
|
@@ -128,18 +113,17 @@ const PopoverContent = PopperContentFrame.extractable(
|
|
|
128
113
|
}
|
|
129
114
|
)
|
|
130
115
|
);
|
|
116
|
+
function PopoverRepropagateContext(props) {
|
|
117
|
+
const context = usePopoverContext();
|
|
118
|
+
const popperContext = usePopperContext();
|
|
119
|
+
return <PopperContext.Provider {...popperContext}><PopoverContext.Provider {...context}>{props.children}</PopoverContext.Provider></PopperContext.Provider>;
|
|
120
|
+
}
|
|
131
121
|
function PopoverContentPortal(props) {
|
|
132
122
|
const themeName = useThemeName();
|
|
133
|
-
const context =
|
|
123
|
+
const context = usePopoverContext();
|
|
134
124
|
let contents = props.children;
|
|
135
125
|
if (Platform.OS === "android") {
|
|
136
|
-
|
|
137
|
-
contents = <PopperProvider {...popperContext} scope={context.popperScope}><PopoverProviderInternal scope={props.__scopePopover} {...context}>
|
|
138
|
-
{
|
|
139
|
-
/* does this need to be props.__scopePopper? */
|
|
140
|
-
}
|
|
141
|
-
{props.children}
|
|
142
|
-
</PopoverProviderInternal></PopperProvider>;
|
|
126
|
+
contents = <PopoverRepropagateContext>{props.children}</PopoverRepropagateContext>;
|
|
143
127
|
}
|
|
144
128
|
const zIndex = props.zIndex ?? 15e4;
|
|
145
129
|
return <Portal zIndex={zIndex}><Theme forceClassName name={themeName}>
|
|
@@ -152,7 +136,6 @@ function PopoverContentPortal(props) {
|
|
|
152
136
|
}
|
|
153
137
|
const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
154
138
|
const {
|
|
155
|
-
__scopePopover,
|
|
156
139
|
trapFocus,
|
|
157
140
|
onOpenAutoFocus,
|
|
158
141
|
onCloseAutoFocus,
|
|
@@ -165,8 +148,7 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
165
148
|
disableRemoveScroll,
|
|
166
149
|
...contentProps
|
|
167
150
|
} = props;
|
|
168
|
-
const
|
|
169
|
-
const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover);
|
|
151
|
+
const context = usePopoverContext();
|
|
170
152
|
const [isFullyHidden, setIsFullyHidden] = React.useState(!context.open);
|
|
171
153
|
if (context.breakpointActive) {
|
|
172
154
|
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {
|
|
@@ -177,7 +159,7 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
177
159
|
}
|
|
178
160
|
return child;
|
|
179
161
|
});
|
|
180
|
-
return <PortalItem hostName={`${context.
|
|
162
|
+
return <PortalItem hostName={`${context.id}PopoverContents`}>{childrenWithoutScrollView}</PortalItem>;
|
|
181
163
|
}
|
|
182
164
|
if (context.open && isFullyHidden) {
|
|
183
165
|
setIsFullyHidden(false);
|
|
@@ -195,7 +177,6 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
195
177
|
id={context.contentId}
|
|
196
178
|
pointerEvents="auto"
|
|
197
179
|
ref={forwardedRef}
|
|
198
|
-
{...popperScope}
|
|
199
180
|
{...contentProps}
|
|
200
181
|
><RemoveScroll
|
|
201
182
|
enabled={disableRemoveScroll ? false : context.open}
|
|
@@ -211,14 +192,13 @@ const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
211
192
|
onUnmountAutoFocus={onCloseAutoFocus}
|
|
212
193
|
>{isWeb ? <div style={{ display: "contents" }}>{children}</div> : children}</FocusScope>}</RemoveScroll></PopperContent>}</AnimatePresence>;
|
|
213
194
|
});
|
|
214
|
-
const CLOSE_NAME = "PopoverClose";
|
|
215
195
|
const PopoverClose = React.forwardRef(
|
|
216
|
-
(props, forwardedRef)
|
|
217
|
-
const
|
|
218
|
-
const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
|
|
196
|
+
function PopoverClose2(props, forwardedRef) {
|
|
197
|
+
const context = usePopoverContext();
|
|
219
198
|
return <YStack
|
|
220
|
-
{...
|
|
199
|
+
{...props}
|
|
221
200
|
ref={forwardedRef}
|
|
201
|
+
componentName="PopoverClose"
|
|
222
202
|
onPress={composeEventHandlers(
|
|
223
203
|
props.onPress,
|
|
224
204
|
() => context.onOpenChange(false)
|
|
@@ -226,38 +206,24 @@ const PopoverClose = React.forwardRef(
|
|
|
226
206
|
/>;
|
|
227
207
|
}
|
|
228
208
|
);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
(props, forwardedRef) => {
|
|
233
|
-
const { __scopePopover, ...arrowProps } = props;
|
|
234
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
235
|
-
return <PopperArrow {...popperScope} {...arrowProps} ref={forwardedRef} />;
|
|
209
|
+
const PopoverArrow = React.forwardRef(
|
|
210
|
+
function PopoverArrow2(props, forwardedRef) {
|
|
211
|
+
return <PopperArrow componentName="PopoverArrow" {...props} ref={forwardedRef} />;
|
|
236
212
|
}
|
|
237
213
|
);
|
|
238
|
-
PopoverArrow.displayName = ARROW_NAME;
|
|
239
214
|
const PopoverScrollView = React.forwardRef((props, ref) => {
|
|
240
215
|
return <ScrollView ref={ref} {...props} />;
|
|
241
216
|
});
|
|
242
217
|
const Popover = withStaticProperties(
|
|
243
218
|
function Popover2(props) {
|
|
244
|
-
const {
|
|
245
|
-
|
|
246
|
-
children,
|
|
247
|
-
open: openProp,
|
|
248
|
-
defaultOpen,
|
|
249
|
-
onOpenChange,
|
|
250
|
-
...restProps
|
|
251
|
-
} = props;
|
|
252
|
-
const internalId = React.useId();
|
|
253
|
-
const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId;
|
|
219
|
+
const { children, open: openProp, defaultOpen, onOpenChange, ...restProps } = props;
|
|
220
|
+
const id = React.useId();
|
|
254
221
|
const { when, AdaptProvider } = useAdaptParent({
|
|
255
222
|
Contents: React.useCallback(() => {
|
|
256
223
|
return <PortalHost name={`${id}PopoverContents`} />;
|
|
257
224
|
}, [])
|
|
258
225
|
});
|
|
259
226
|
const sheetBreakpoint = when;
|
|
260
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
261
227
|
const triggerRef = React.useRef(null);
|
|
262
228
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
263
229
|
const [open, setOpen] = useControllableState({
|
|
@@ -269,9 +235,7 @@ const Popover = withStaticProperties(
|
|
|
269
235
|
const breakpointActive = useSheetBreakpointActive(sheetBreakpoint);
|
|
270
236
|
const floatingContext = useFloatingContext({ open, setOpen, breakpointActive });
|
|
271
237
|
const popoverContext = {
|
|
272
|
-
|
|
273
|
-
scopeKey: id,
|
|
274
|
-
popperScope: popperScope.__scopePopper,
|
|
238
|
+
id,
|
|
275
239
|
sheetBreakpoint,
|
|
276
240
|
contentId: React.useId(),
|
|
277
241
|
triggerRef,
|
|
@@ -288,7 +252,7 @@ const Popover = withStaticProperties(
|
|
|
288
252
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
289
253
|
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
290
254
|
};
|
|
291
|
-
const contents = <Popper
|
|
255
|
+
const contents = <Popper stayInFrame {...restProps}><PopoverContext.Provider {...popoverContext}><PopoverSheetController onOpenChange={setOpen}>{children}</PopoverSheetController></PopoverContext.Provider></Popper>;
|
|
292
256
|
return <AdaptProvider>{isWeb ? <FloatingOverrideContext.Provider value={floatingContext}>{contents}</FloatingOverrideContext.Provider> : contents}</AdaptProvider>;
|
|
293
257
|
},
|
|
294
258
|
{
|
|
@@ -306,10 +270,7 @@ function getState(open) {
|
|
|
306
270
|
return open ? "open" : "closed";
|
|
307
271
|
}
|
|
308
272
|
const PopoverSheetController = (props) => {
|
|
309
|
-
const context =
|
|
310
|
-
"PopoverSheetController",
|
|
311
|
-
props.__scopePopover
|
|
312
|
-
);
|
|
273
|
+
const context = usePopoverContext();
|
|
313
274
|
const showSheet = useShowPopoverSheet(context);
|
|
314
275
|
const breakpointActive = context.breakpointActive;
|
|
315
276
|
const getShowSheet = useGet(showSheet);
|
|
@@ -340,9 +301,8 @@ export {
|
|
|
340
301
|
PopoverArrow,
|
|
341
302
|
PopoverClose,
|
|
342
303
|
PopoverContent,
|
|
304
|
+
PopoverContext,
|
|
343
305
|
PopoverTrigger,
|
|
344
|
-
|
|
345
|
-
createPopoverScope,
|
|
346
|
-
usePopoverScope
|
|
306
|
+
usePopoverContext
|
|
347
307
|
};
|
|
348
308
|
//# sourceMappingURL=Popover.mjs.map
|
package/dist/jsx/Popover.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Popover.tsx"],
|
|
4
|
-
"mappings": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS
|
|
5
|
-
"names": ["PopoverContent", "Popover"]
|
|
4
|
+
"mappings": "AAEA,OAAO;AAEP,SAAS,OAAO,sBAAsB;AACtC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC;AAAA,EAGE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,+BAA+B;AACxC,SAAS,kBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AACP,SA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