@tamagui/popover 1.26.0 → 1.26.1
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/package.json +19 -19
- package/dist/esm/Popover.mjs +0 -362
- package/dist/esm/Popover.mjs.map +0 -6
- package/dist/esm/index.mjs +0 -3
- package/dist/esm/index.mjs.map +0 -6
- package/dist/esm/useFloatingContext.mjs +0 -31
- package/dist/esm/useFloatingContext.mjs.map +0 -6
- package/dist/esm/useFloatingContext.native.mjs +0 -7
- package/dist/esm/useFloatingContext.native.mjs.map +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/popover",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.1",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -32,30 +32,30 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@floating-ui/react": "^0.19.1",
|
|
35
|
-
"@tamagui/adapt": "1.26.
|
|
36
|
-
"@tamagui/animate-presence": "1.26.
|
|
37
|
-
"@tamagui/aria-hidden": "1.26.
|
|
38
|
-
"@tamagui/compose-refs": "1.26.
|
|
39
|
-
"@tamagui/core": "1.26.
|
|
40
|
-
"@tamagui/create-context": "1.26.
|
|
41
|
-
"@tamagui/dismissable": "1.26.
|
|
42
|
-
"@tamagui/floating": "1.26.
|
|
43
|
-
"@tamagui/focus-scope": "1.26.
|
|
44
|
-
"@tamagui/polyfill-dev": "1.26.
|
|
45
|
-
"@tamagui/popper": "1.26.
|
|
46
|
-
"@tamagui/portal": "1.26.
|
|
47
|
-
"@tamagui/remove-scroll": "1.26.
|
|
48
|
-
"@tamagui/scroll-view": "1.26.
|
|
49
|
-
"@tamagui/sheet": "1.26.
|
|
50
|
-
"@tamagui/stacks": "1.26.
|
|
51
|
-
"@tamagui/use-controllable-state": "1.26.
|
|
35
|
+
"@tamagui/adapt": "1.26.1",
|
|
36
|
+
"@tamagui/animate-presence": "1.26.1",
|
|
37
|
+
"@tamagui/aria-hidden": "1.26.1",
|
|
38
|
+
"@tamagui/compose-refs": "1.26.1",
|
|
39
|
+
"@tamagui/core": "1.26.1",
|
|
40
|
+
"@tamagui/create-context": "1.26.1",
|
|
41
|
+
"@tamagui/dismissable": "1.26.1",
|
|
42
|
+
"@tamagui/floating": "1.26.1",
|
|
43
|
+
"@tamagui/focus-scope": "1.26.1",
|
|
44
|
+
"@tamagui/polyfill-dev": "1.26.1",
|
|
45
|
+
"@tamagui/popper": "1.26.1",
|
|
46
|
+
"@tamagui/portal": "1.26.1",
|
|
47
|
+
"@tamagui/remove-scroll": "1.26.1",
|
|
48
|
+
"@tamagui/scroll-view": "1.26.1",
|
|
49
|
+
"@tamagui/sheet": "1.26.1",
|
|
50
|
+
"@tamagui/stacks": "1.26.1",
|
|
51
|
+
"@tamagui/use-controllable-state": "1.26.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": "*",
|
|
55
55
|
"react-native": "*"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@tamagui/build": "1.26.
|
|
58
|
+
"@tamagui/build": "1.26.1",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-native": "^0.71.7"
|
|
61
61
|
},
|
package/dist/esm/Popover.mjs
DELETED
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import "@tamagui/polyfill-dev";
|
|
3
|
-
import { Adapt, useAdaptParent } from "@tamagui/adapt";
|
|
4
|
-
import { AnimatePresence } from "@tamagui/animate-presence";
|
|
5
|
-
import { hideOthers } from "@tamagui/aria-hidden";
|
|
6
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
7
|
-
import {
|
|
8
|
-
Stack,
|
|
9
|
-
Theme,
|
|
10
|
-
composeEventHandlers,
|
|
11
|
-
isWeb,
|
|
12
|
-
useEvent,
|
|
13
|
-
useGet,
|
|
14
|
-
useMedia,
|
|
15
|
-
useThemeName,
|
|
16
|
-
withStaticProperties
|
|
17
|
-
} from "@tamagui/core";
|
|
18
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
19
|
-
import { FloatingOverrideContext } from "@tamagui/floating";
|
|
20
|
-
import { FocusScope } from "@tamagui/focus-scope";
|
|
21
|
-
import {
|
|
22
|
-
Popper,
|
|
23
|
-
PopperAnchor,
|
|
24
|
-
PopperArrow,
|
|
25
|
-
PopperContent,
|
|
26
|
-
PopperContentFrame,
|
|
27
|
-
PopperProvider,
|
|
28
|
-
createPopperScope,
|
|
29
|
-
usePopperContext
|
|
30
|
-
} from "@tamagui/popper";
|
|
31
|
-
import { Portal, PortalHost, PortalItem } from "@tamagui/portal";
|
|
32
|
-
import { RemoveScroll } from "@tamagui/remove-scroll";
|
|
33
|
-
import { ControlledSheet, SheetController } from "@tamagui/sheet";
|
|
34
|
-
import { YStack } from "@tamagui/stacks";
|
|
35
|
-
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
36
|
-
import * as React from "react";
|
|
37
|
-
import { Platform, ScrollView } from "react-native";
|
|
38
|
-
import { useFloatingContext } from "./useFloatingContext";
|
|
39
|
-
const POPOVER_NAME = "Popover";
|
|
40
|
-
const [createPopoverContext, createPopoverScopeInternal] = createContextScope(
|
|
41
|
-
POPOVER_NAME,
|
|
42
|
-
[createPopperScope]
|
|
43
|
-
);
|
|
44
|
-
const usePopoverScope = createPopperScope();
|
|
45
|
-
const createPopoverScope = createPopoverScopeInternal;
|
|
46
|
-
const [PopoverProviderInternal, usePopoverInternalContext] = createPopoverContext(POPOVER_NAME);
|
|
47
|
-
const __PopoverProviderInternal = PopoverProviderInternal;
|
|
48
|
-
const ANCHOR_NAME = "PopoverAnchor";
|
|
49
|
-
const PopoverAnchor = React.forwardRef(
|
|
50
|
-
(props, forwardedRef) => {
|
|
51
|
-
const { __scopePopover, ...anchorProps } = props;
|
|
52
|
-
const context = usePopoverInternalContext(ANCHOR_NAME, __scopePopover);
|
|
53
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
54
|
-
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
55
|
-
React.useEffect(() => {
|
|
56
|
-
onCustomAnchorAdd();
|
|
57
|
-
return () => onCustomAnchorRemove();
|
|
58
|
-
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
|
|
59
|
-
return /* @__PURE__ */ jsx(PopperAnchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
PopoverAnchor.displayName = ANCHOR_NAME;
|
|
63
|
-
const TRIGGER_NAME = "PopoverTrigger";
|
|
64
|
-
const PopoverTrigger = React.forwardRef((props, forwardedRef) => {
|
|
65
|
-
const { __scopePopover, ...triggerProps } = props;
|
|
66
|
-
const context = usePopoverInternalContext(TRIGGER_NAME, __scopePopover);
|
|
67
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
68
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
69
|
-
const trigger = /* @__PURE__ */ jsx(
|
|
70
|
-
YStack,
|
|
71
|
-
{
|
|
72
|
-
"aria-haspopup": "dialog",
|
|
73
|
-
"aria-expanded": context.open,
|
|
74
|
-
"data-state": getState(context.open),
|
|
75
|
-
...triggerProps,
|
|
76
|
-
ref: composedTriggerRef,
|
|
77
|
-
onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperAnchor, { asChild: true, ...popperScope, children: trigger });
|
|
81
|
-
});
|
|
82
|
-
PopoverTrigger.displayName = TRIGGER_NAME;
|
|
83
|
-
const CONTENT_NAME = "PopoverContent";
|
|
84
|
-
const PopoverContent = PopperContentFrame.extractable(
|
|
85
|
-
React.forwardRef(
|
|
86
|
-
function PopoverContent2(props, forwardedRef) {
|
|
87
|
-
const {
|
|
88
|
-
allowPinchZoom,
|
|
89
|
-
trapFocus,
|
|
90
|
-
disableRemoveScroll = true,
|
|
91
|
-
zIndex,
|
|
92
|
-
...contentImplProps
|
|
93
|
-
} = props;
|
|
94
|
-
const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
|
|
95
|
-
const contentRef = React.useRef(null);
|
|
96
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
97
|
-
const isRightClickOutsideRef = React.useRef(false);
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
if (!context.open)
|
|
100
|
-
return;
|
|
101
|
-
const content = contentRef.current;
|
|
102
|
-
if (content)
|
|
103
|
-
return hideOthers(content);
|
|
104
|
-
}, [context.open]);
|
|
105
|
-
return /* @__PURE__ */ jsx(PopoverContentPortal, { zIndex, children: /* @__PURE__ */ jsx(
|
|
106
|
-
PopoverContentImpl,
|
|
107
|
-
{
|
|
108
|
-
...contentImplProps,
|
|
109
|
-
disableRemoveScroll,
|
|
110
|
-
ref: composedRefs,
|
|
111
|
-
trapFocus: trapFocus ?? context.open,
|
|
112
|
-
disableOutsidePointerEvents: true,
|
|
113
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
114
|
-
var _a;
|
|
115
|
-
event.preventDefault();
|
|
116
|
-
if (!isRightClickOutsideRef.current)
|
|
117
|
-
(_a = context.triggerRef.current) == null ? void 0 : _a.focus();
|
|
118
|
-
}),
|
|
119
|
-
onPointerDownOutside: composeEventHandlers(
|
|
120
|
-
props.onPointerDownOutside,
|
|
121
|
-
(event) => {
|
|
122
|
-
const originalEvent = event.detail.originalEvent;
|
|
123
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
124
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
125
|
-
isRightClickOutsideRef.current = isRightClick;
|
|
126
|
-
},
|
|
127
|
-
{ checkDefaultPrevented: false }
|
|
128
|
-
),
|
|
129
|
-
onFocusOutside: composeEventHandlers(
|
|
130
|
-
props.onFocusOutside,
|
|
131
|
-
(event) => event.preventDefault(),
|
|
132
|
-
{ checkDefaultPrevented: false }
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
|
-
) });
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
);
|
|
139
|
-
function PopoverContentPortal(props) {
|
|
140
|
-
const themeName = useThemeName();
|
|
141
|
-
const context = usePopoverInternalContext(CONTENT_NAME, props.__scopePopover);
|
|
142
|
-
let contents = props.children;
|
|
143
|
-
if (Platform.OS === "android") {
|
|
144
|
-
const popperContext = usePopperContext(CONTENT_NAME, context.popperScope);
|
|
145
|
-
contents = /* @__PURE__ */ jsx(PopperProvider, { ...popperContext, scope: context.popperScope, children: /* @__PURE__ */ jsx(PopoverProviderInternal, { scope: props.__scopePopover, ...context, children: props.children }) });
|
|
146
|
-
}
|
|
147
|
-
const zIndex = props.zIndex ?? 15e4;
|
|
148
|
-
return /* @__PURE__ */ jsx(Portal, { zIndex, children: /* @__PURE__ */ jsxs(Theme, { forceClassName: true, name: themeName, children: [
|
|
149
|
-
!!context.open && !context.breakpointActive && /* @__PURE__ */ jsx(
|
|
150
|
-
YStack,
|
|
151
|
-
{
|
|
152
|
-
fullscreen: true,
|
|
153
|
-
onPress: composeEventHandlers(props.onPress, context.onOpenToggle)
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
/* @__PURE__ */ jsx(Stack, { zIndex: zIndex + 1, children: contents })
|
|
157
|
-
] }) });
|
|
158
|
-
}
|
|
159
|
-
const PopoverContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
160
|
-
const {
|
|
161
|
-
__scopePopover,
|
|
162
|
-
trapFocus,
|
|
163
|
-
onOpenAutoFocus,
|
|
164
|
-
onCloseAutoFocus,
|
|
165
|
-
disableOutsidePointerEvents,
|
|
166
|
-
onEscapeKeyDown,
|
|
167
|
-
onPointerDownOutside,
|
|
168
|
-
onFocusOutside,
|
|
169
|
-
onInteractOutside,
|
|
170
|
-
children,
|
|
171
|
-
disableRemoveScroll,
|
|
172
|
-
...contentProps
|
|
173
|
-
} = props;
|
|
174
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
175
|
-
const context = usePopoverInternalContext(CONTENT_NAME, popperScope.__scopePopover);
|
|
176
|
-
if (context.breakpointActive) {
|
|
177
|
-
const childrenWithoutScrollView = React.Children.toArray(children).map((child) => {
|
|
178
|
-
if (React.isValidElement(child)) {
|
|
179
|
-
if (child.type === PopoverScrollView) {
|
|
180
|
-
return child.props.children;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return child;
|
|
184
|
-
});
|
|
185
|
-
return /* @__PURE__ */ jsx(PortalItem, { hostName: `${context.scopeKey}PopoverContents`, children: childrenWithoutScrollView });
|
|
186
|
-
}
|
|
187
|
-
return /* @__PURE__ */ jsx(AnimatePresence, { children: !!context.open && /* @__PURE__ */ jsx(
|
|
188
|
-
PopperContent,
|
|
189
|
-
{
|
|
190
|
-
"data-state": getState(context.open),
|
|
191
|
-
id: context.contentId,
|
|
192
|
-
pointerEvents: "auto",
|
|
193
|
-
ref: forwardedRef,
|
|
194
|
-
...popperScope,
|
|
195
|
-
...contentProps,
|
|
196
|
-
children: /* @__PURE__ */ jsx(
|
|
197
|
-
RemoveScroll,
|
|
198
|
-
{
|
|
199
|
-
enabled: disableRemoveScroll ? false : context.open,
|
|
200
|
-
allowPinchZoom: true,
|
|
201
|
-
removeScrollBar: false,
|
|
202
|
-
style: {
|
|
203
|
-
display: "contents"
|
|
204
|
-
},
|
|
205
|
-
children: trapFocus === false ? children : /* @__PURE__ */ jsx(
|
|
206
|
-
FocusScope,
|
|
207
|
-
{
|
|
208
|
-
loop: true,
|
|
209
|
-
trapped: trapFocus ?? context.open,
|
|
210
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
211
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
212
|
-
children: isWeb ? /* @__PURE__ */ jsx("div", { style: { display: "contents" }, children }) : children
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
},
|
|
218
|
-
context.contentId
|
|
219
|
-
) });
|
|
220
|
-
});
|
|
221
|
-
const CLOSE_NAME = "PopoverClose";
|
|
222
|
-
const PopoverClose = React.forwardRef(
|
|
223
|
-
(props, forwardedRef) => {
|
|
224
|
-
const { __scopePopover, ...closeProps } = props;
|
|
225
|
-
const context = usePopoverInternalContext(CLOSE_NAME, __scopePopover);
|
|
226
|
-
return /* @__PURE__ */ jsx(
|
|
227
|
-
YStack,
|
|
228
|
-
{
|
|
229
|
-
...closeProps,
|
|
230
|
-
ref: forwardedRef,
|
|
231
|
-
onPress: composeEventHandlers(
|
|
232
|
-
props.onPress,
|
|
233
|
-
() => context.onOpenChange(false)
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
PopoverClose.displayName = CLOSE_NAME;
|
|
240
|
-
const ARROW_NAME = "PopoverArrow";
|
|
241
|
-
const PopoverArrow = PopperArrow.styleable(
|
|
242
|
-
(props, forwardedRef) => {
|
|
243
|
-
const { __scopePopover, ...arrowProps } = props;
|
|
244
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
245
|
-
return /* @__PURE__ */ jsx(PopperArrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
246
|
-
}
|
|
247
|
-
);
|
|
248
|
-
PopoverArrow.displayName = ARROW_NAME;
|
|
249
|
-
const PopoverScrollView = React.forwardRef((props, ref) => {
|
|
250
|
-
return /* @__PURE__ */ jsx(ScrollView, { ref, ...props });
|
|
251
|
-
});
|
|
252
|
-
const Popover = withStaticProperties(
|
|
253
|
-
function Popover2(props) {
|
|
254
|
-
const {
|
|
255
|
-
__scopePopover,
|
|
256
|
-
children,
|
|
257
|
-
open: openProp,
|
|
258
|
-
defaultOpen,
|
|
259
|
-
onOpenChange,
|
|
260
|
-
...restProps
|
|
261
|
-
} = props;
|
|
262
|
-
const internalId = React.useId();
|
|
263
|
-
const id = __scopePopover ? Object.keys(__scopePopover)[0] : internalId;
|
|
264
|
-
const { when, AdaptProvider } = useAdaptParent({
|
|
265
|
-
Contents: React.useCallback(() => {
|
|
266
|
-
return /* @__PURE__ */ jsx(PortalHost, { name: `${id}PopoverContents` });
|
|
267
|
-
}, [])
|
|
268
|
-
});
|
|
269
|
-
const sheetBreakpoint = when;
|
|
270
|
-
const popperScope = usePopoverScope(__scopePopover);
|
|
271
|
-
const triggerRef = React.useRef(null);
|
|
272
|
-
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
273
|
-
const [open, setOpen] = useControllableState({
|
|
274
|
-
prop: openProp,
|
|
275
|
-
defaultProp: defaultOpen || false,
|
|
276
|
-
onChange: onOpenChange,
|
|
277
|
-
transition: true
|
|
278
|
-
});
|
|
279
|
-
const breakpointActive = useSheetBreakpointActive(sheetBreakpoint);
|
|
280
|
-
const floatingContext = useFloatingContext({ open, setOpen, breakpointActive });
|
|
281
|
-
const popoverContext = {
|
|
282
|
-
scope: __scopePopover,
|
|
283
|
-
scopeKey: id,
|
|
284
|
-
popperScope: popperScope.__scopePopper,
|
|
285
|
-
sheetBreakpoint,
|
|
286
|
-
contentId: React.useId(),
|
|
287
|
-
triggerRef,
|
|
288
|
-
open,
|
|
289
|
-
breakpointActive,
|
|
290
|
-
onOpenChange: setOpen,
|
|
291
|
-
onOpenToggle: useEvent(() => {
|
|
292
|
-
if (open && breakpointActive) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
setOpen(!open);
|
|
296
|
-
}),
|
|
297
|
-
hasCustomAnchor,
|
|
298
|
-
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
299
|
-
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
300
|
-
};
|
|
301
|
-
const contents = /* @__PURE__ */ jsx(Popper, { ...popperScope, stayInFrame: true, ...restProps, children: /* @__PURE__ */ jsx(PopoverProviderInternal, { ...popoverContext, children: /* @__PURE__ */ jsx(PopoverSheetController, { onOpenChange: setOpen, __scopePopover, children }) }) });
|
|
302
|
-
return /* @__PURE__ */ jsx(AdaptProvider, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: floatingContext, children: contents }) : contents });
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
Anchor: PopoverAnchor,
|
|
306
|
-
Arrow: PopoverArrow,
|
|
307
|
-
Trigger: PopoverTrigger,
|
|
308
|
-
Content: PopoverContent,
|
|
309
|
-
Close: PopoverClose,
|
|
310
|
-
Adapt,
|
|
311
|
-
ScrollView: PopoverScrollView,
|
|
312
|
-
Sheet: ControlledSheet
|
|
313
|
-
}
|
|
314
|
-
);
|
|
315
|
-
function getState(open) {
|
|
316
|
-
return open ? "open" : "closed";
|
|
317
|
-
}
|
|
318
|
-
const PopoverSheetController = (props) => {
|
|
319
|
-
const context = usePopoverInternalContext(
|
|
320
|
-
"PopoverSheetController",
|
|
321
|
-
props.__scopePopover
|
|
322
|
-
);
|
|
323
|
-
const showSheet = useShowPopoverSheet(context);
|
|
324
|
-
const breakpointActive = context.breakpointActive;
|
|
325
|
-
const getShowSheet = useGet(showSheet);
|
|
326
|
-
return /* @__PURE__ */ jsx(
|
|
327
|
-
SheetController,
|
|
328
|
-
{
|
|
329
|
-
onOpenChange: (val) => {
|
|
330
|
-
if (getShowSheet()) {
|
|
331
|
-
props.onOpenChange(val);
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
open: context.open,
|
|
335
|
-
hidden: breakpointActive === false,
|
|
336
|
-
children: props.children
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
};
|
|
340
|
-
const useSheetBreakpointActive = (breakpoint) => {
|
|
341
|
-
const media = useMedia();
|
|
342
|
-
if (typeof breakpoint === "boolean" || !breakpoint) {
|
|
343
|
-
return !!breakpoint;
|
|
344
|
-
}
|
|
345
|
-
return media[breakpoint];
|
|
346
|
-
};
|
|
347
|
-
const useShowPopoverSheet = (context) => {
|
|
348
|
-
const breakpointActive = useSheetBreakpointActive(context.sheetBreakpoint);
|
|
349
|
-
return context.open === false ? false : breakpointActive;
|
|
350
|
-
};
|
|
351
|
-
export {
|
|
352
|
-
Popover,
|
|
353
|
-
PopoverAnchor,
|
|
354
|
-
PopoverArrow,
|
|
355
|
-
PopoverClose,
|
|
356
|
-
PopoverContent,
|
|
357
|
-
PopoverTrigger,
|
|
358
|
-
__PopoverProviderInternal,
|
|
359
|
-
createPopoverScope,
|
|
360
|
-
usePopoverScope
|
|
361
|
-
};
|
|
362
|
-
//# sourceMappingURL=Popover.mjs.map
|
package/dist/esm/Popover.mjs.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Popover.tsx"],
|
|
4
|
-
"mappings": "AA6GW,cAyJL,YAzJK;AA3GX,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,0BAA0B;AAEnC,SAAS,+BAA+B;AACxC,SAAS,kBAAmC;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QAAQ,YAAY,kBAAkB;AAC/C,SAAS,oBAAuC;AAChD,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,cAA2B;AACpC,SAAS,4BAA4B;AACrC,YAAY,WAAW;AACvB,SAAS,UAAU,kBAAyC;AAE5D,SAAS,0BAA0B;AAEnC,MAAM,eAAe;AA0B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AAI,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": ["PopoverContent", "Popover"]
|
|
6
|
-
}
|
package/dist/esm/index.mjs
DELETED
package/dist/esm/index.mjs.map
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
const useFloatingContext = ({ open, setOpen, breakpointActive }) => useCallback(
|
|
4
|
-
(props) => {
|
|
5
|
-
const floating = useFloating({
|
|
6
|
-
...props,
|
|
7
|
-
open,
|
|
8
|
-
onOpenChange: setOpen
|
|
9
|
-
});
|
|
10
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
11
|
-
// useFocus(floating.context, {
|
|
12
|
-
// enabled: !breakpointActive,
|
|
13
|
-
// keyboardOnly: true,
|
|
14
|
-
// }),
|
|
15
|
-
useRole(floating.context, { role: "dialog" }),
|
|
16
|
-
useDismiss(floating.context, {
|
|
17
|
-
enabled: !breakpointActive
|
|
18
|
-
})
|
|
19
|
-
]);
|
|
20
|
-
return {
|
|
21
|
-
...floating,
|
|
22
|
-
getReferenceProps,
|
|
23
|
-
getFloatingProps
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
[open, setOpen, breakpointActive]
|
|
27
|
-
);
|
|
28
|
-
export {
|
|
29
|
-
useFloatingContext
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=useFloatingContext.mjs.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/useFloatingContext.tsx"],
|
|
4
|
-
"mappings": "AACA,SAAS,YAAY,aAAa,iBAAiB,eAAe;AAClE,SAAgB,mBAAmB;AAG5B,MAAM,qBAAqB,CAAC,EAAE,MAAM,SAAS,iBAAiB,MACnE;AAAA,EACE,CAAC,UAA4B;AAC3B,UAAM,WAAW,YAAY;AAAA,MAC3B,GAAG;AAAA,MACH;AAAA,MACA,cAAc;AAAA,IAChB,CAAC;AACD,UAAM,EAAE,mBAAmB,iBAAiB,IAAI,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,MAK9D,QAAQ,SAAS,SAAS,EAAE,MAAM,SAAS,CAAC;AAAA,MAC5C,WAAW,SAAS,SAAS;AAAA,QAC3B,SAAS,CAAC;AAAA,MACZ,CAAC;AAAA,IACH,CAAC;AACD,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,CAAC,MAAM,SAAS,gBAAgB;AAClC;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|