@tamagui/popover 2.0.0-rc.8 → 2.0.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.cjs +624 -408
- package/dist/cjs/Popover.native.js +637 -438
- package/dist/cjs/Popover.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useFloatingContext.cjs +226 -58
- package/dist/cjs/useFloatingContext.native.js +28 -26
- package/dist/cjs/useFloatingContext.native.js.map +1 -1
- package/dist/esm/Popover.mjs +576 -377
- package/dist/esm/Popover.mjs.map +1 -1
- package/dist/esm/Popover.native.js +591 -409
- package/dist/esm/Popover.native.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/useFloatingContext.mjs +200 -34
- package/dist/esm/useFloatingContext.mjs.map +1 -1
- package/dist/jsx/Popover.mjs +576 -377
- package/dist/jsx/Popover.mjs.map +1 -1
- package/dist/jsx/Popover.native.js +637 -438
- package/dist/jsx/Popover.native.js.map +1 -1
- package/dist/jsx/index.js +2 -2
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/useFloatingContext.mjs +200 -34
- package/dist/jsx/useFloatingContext.mjs.map +1 -1
- package/dist/jsx/useFloatingContext.native.js +28 -26
- package/dist/jsx/useFloatingContext.native.js.map +1 -1
- package/package.json +26 -31
- package/src/Popover.tsx +494 -175
- package/src/useFloatingContext.tsx +321 -43
- package/types/Popover.d.ts +126 -8
- package/types/Popover.d.ts.map +1 -1
- package/types/useFloatingContext.d.ts +14 -8
- package/types/useFloatingContext.d.ts.map +1 -1
- package/dist/cjs/Popover.js +0 -394
- package/dist/cjs/Popover.js.map +0 -6
- package/dist/cjs/index.js +0 -16
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/useFloatingContext.js +0 -74
- package/dist/cjs/useFloatingContext.js.map +0 -6
- package/dist/esm/Popover.js +0 -415
- package/dist/esm/Popover.js.map +0 -6
- package/dist/esm/useFloatingContext.js +0 -59
- package/dist/esm/useFloatingContext.js.map +0 -6
- package/dist/jsx/Popover.js +0 -415
- package/dist/jsx/Popover.js.map +0 -6
- package/dist/jsx/useFloatingContext.js +0 -59
- package/dist/jsx/useFloatingContext.js.map +0 -6
|
@@ -1,68 +1,346 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type { UseFloatingOptions } from '@floating
|
|
2
|
+
import type { Delay, UseFloatingOptions } from '@tamagui/floating'
|
|
3
3
|
import {
|
|
4
|
+
createFloatingEvents,
|
|
4
5
|
safePolygon,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
useDelayGroup,
|
|
7
|
+
useFloatingRaw,
|
|
7
8
|
useFocus,
|
|
8
9
|
useHover,
|
|
9
10
|
useInteractions,
|
|
10
11
|
useRole,
|
|
11
|
-
|
|
12
|
+
PopupTriggerMap,
|
|
13
|
+
type FloatingInteractionContext,
|
|
14
|
+
} from '@tamagui/floating'
|
|
15
|
+
|
|
16
|
+
// custom floating context for hoverable popovers and tooltips.
|
|
17
|
+
//
|
|
18
|
+
// why we can't just use useHover alone:
|
|
19
|
+
// useHover attaches mouseenter/mouseleave via useEffect on the current
|
|
20
|
+
// reference element. in multi-trigger mode, PopperAnchor switches the
|
|
21
|
+
// reference when the cursor enters a new trigger — but useEffect hasn't
|
|
22
|
+
// re-run yet, so the new trigger's mouseenter is missed by useHover.
|
|
23
|
+
// we handle opens ourselves via onHoverReference; useHover + safePolygon
|
|
24
|
+
// handle close detection.
|
|
25
|
+
//
|
|
26
|
+
// multi-trigger gap handling:
|
|
27
|
+
// when sweeping between triggers, the cursor exits safePolygon's triangle
|
|
28
|
+
// (which points toward content, not sideways). we use a short grace period
|
|
29
|
+
// to block safePolygon's close during the gap. if a new trigger is entered,
|
|
30
|
+
// we cancel the pending close. if not, the grace timer fires it.
|
|
31
|
+
|
|
32
|
+
export type UseFloatingContextOptions = {
|
|
33
|
+
open: boolean
|
|
34
|
+
setOpen: (val: boolean, type?: string) => void
|
|
35
|
+
disable?: boolean
|
|
36
|
+
disableFocus?: boolean
|
|
37
|
+
hoverable?: boolean | Record<string, any>
|
|
38
|
+
// defaults to 'dialog', tooltips pass 'tooltip'
|
|
39
|
+
role?: 'dialog' | 'tooltip'
|
|
40
|
+
// custom focus config (tooltip passes { enabled, visibleOnly })
|
|
41
|
+
focus?: Record<string, any>
|
|
42
|
+
// delay group coordination for tooltips
|
|
43
|
+
groupId?: string
|
|
44
|
+
// explicit delay override (tooltip computes this from delay group context)
|
|
45
|
+
delay?: Delay
|
|
46
|
+
// explicit restMs override
|
|
47
|
+
restMs?: number
|
|
48
|
+
}
|
|
12
49
|
|
|
13
|
-
// Custom floating context to override the Popper on web
|
|
14
50
|
export const useFloatingContext = ({
|
|
15
51
|
open,
|
|
16
52
|
setOpen,
|
|
17
53
|
disable,
|
|
18
54
|
disableFocus,
|
|
19
55
|
hoverable,
|
|
20
|
-
|
|
56
|
+
role: roleProp = 'dialog',
|
|
57
|
+
focus: focusProp,
|
|
58
|
+
groupId,
|
|
59
|
+
delay: delayProp,
|
|
60
|
+
restMs: restMsProp,
|
|
61
|
+
}: UseFloatingContextOptions) => {
|
|
62
|
+
'use no memo'
|
|
63
|
+
|
|
64
|
+
const openRef = React.useRef(open)
|
|
65
|
+
openRef.current = open
|
|
66
|
+
const hoverableRef = React.useRef(hoverable)
|
|
67
|
+
hoverableRef.current = hoverable
|
|
68
|
+
const disableRef = React.useRef(disable)
|
|
69
|
+
disableRef.current = disable
|
|
70
|
+
const disableFocusRef = React.useRef(disableFocus)
|
|
71
|
+
disableFocusRef.current = disableFocus
|
|
72
|
+
const roleRef = React.useRef(roleProp)
|
|
73
|
+
roleRef.current = roleProp
|
|
74
|
+
const focusRef = React.useRef(focusProp)
|
|
75
|
+
focusRef.current = focusProp
|
|
76
|
+
const groupIdRef = React.useRef(groupId)
|
|
77
|
+
groupIdRef.current = groupId
|
|
78
|
+
const delayRef = React.useRef(delayProp)
|
|
79
|
+
delayRef.current = delayProp
|
|
80
|
+
const restMsRef = React.useRef(restMsProp)
|
|
81
|
+
restMsRef.current = restMsProp
|
|
82
|
+
|
|
83
|
+
const events = React.useMemo(() => createFloatingEvents(), [])
|
|
84
|
+
const triggerElements = React.useMemo(() => new PopupTriggerMap(), [])
|
|
85
|
+
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
events.emit('openchange', { open })
|
|
88
|
+
}, [open, events])
|
|
89
|
+
|
|
21
90
|
return React.useCallback(
|
|
22
|
-
(props
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
91
|
+
(props?: UseFloatingOptions) => {
|
|
92
|
+
const onTriggerRef = React.useRef(false)
|
|
93
|
+
const restTimerRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
94
|
+
const graceRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)
|
|
95
|
+
const pendingCloseRef = React.useRef(false)
|
|
96
|
+
const isOverFloatingRef = React.useRef(false)
|
|
97
|
+
const handleCloseActiveRef = React.useRef(false)
|
|
98
|
+
|
|
99
|
+
React.useEffect(() => {
|
|
100
|
+
return () => {
|
|
101
|
+
clearTimeout(restTimerRef.current)
|
|
102
|
+
clearTimeout(graceRef.current)
|
|
103
|
+
}
|
|
104
|
+
}, [])
|
|
105
|
+
|
|
106
|
+
const onOpenChange = (val: boolean, event?: Event) => {
|
|
107
|
+
// block useHover's mouseenter opens — we handle open timing via onHoverReference
|
|
108
|
+
if (val && event?.type === 'mouseenter') {
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
// during trigger grace period, block safePolygon closes but remember them
|
|
112
|
+
if (
|
|
113
|
+
!val &&
|
|
114
|
+
onTriggerRef.current &&
|
|
115
|
+
(event?.type === 'mousemove' || event?.type === 'mouseleave')
|
|
116
|
+
) {
|
|
117
|
+
pendingCloseRef.current = true
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
const type =
|
|
121
|
+
event?.type === 'mousemove' ||
|
|
122
|
+
event?.type === 'mouseenter' ||
|
|
123
|
+
event?.type === 'mouseleave'
|
|
124
|
+
? 'hover'
|
|
125
|
+
: 'press'
|
|
126
|
+
setOpen(val, type)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// pass open so floating-ui resets isPositioned on close — without this,
|
|
130
|
+
// isPositioned stays true and the animation driver slides from old position
|
|
131
|
+
const floating = useFloatingRaw({ ...props, open: openRef.current }) as any
|
|
132
|
+
const currentHoverable = hoverableRef.current
|
|
133
|
+
|
|
134
|
+
const dataRef = React.useRef<{ openEvent?: Event; placement?: string }>({})
|
|
135
|
+
dataRef.current.placement = floating.placement
|
|
136
|
+
|
|
137
|
+
// use getters so useHover's event handlers read live ref values
|
|
138
|
+
// instead of stale snapshots. without this, elements.floating is null
|
|
139
|
+
// in onReferenceMouseLeave's closure (the floating portal hasn't
|
|
140
|
+
// mounted yet when the effect first runs), causing safePolygon to
|
|
141
|
+
// silently bail and never install its document mousemove listener.
|
|
142
|
+
const floatingRefs = floating.refs
|
|
143
|
+
const nullRef = { current: null }
|
|
144
|
+
|
|
145
|
+
const interactionContext: FloatingInteractionContext = {
|
|
146
|
+
open: openRef.current,
|
|
147
|
+
onOpenChange,
|
|
148
|
+
refs: {
|
|
149
|
+
reference: floatingRefs?.reference || nullRef,
|
|
150
|
+
floating: floatingRefs?.floating || nullRef,
|
|
151
|
+
domReference: floatingRefs?.reference || nullRef,
|
|
152
|
+
},
|
|
153
|
+
elements: {
|
|
154
|
+
get reference() {
|
|
155
|
+
return floatingRefs?.reference?.current || null
|
|
156
|
+
},
|
|
157
|
+
get floating() {
|
|
158
|
+
return floatingRefs?.floating?.current || null
|
|
159
|
+
},
|
|
160
|
+
get domReference() {
|
|
161
|
+
return floatingRefs?.reference?.current || null
|
|
162
|
+
},
|
|
34
163
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
164
|
+
dataRef,
|
|
165
|
+
events,
|
|
166
|
+
triggerElements,
|
|
167
|
+
handleCloseActiveRef,
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// delay group coordination — no-op when no FloatingDelayGroup provider exists
|
|
171
|
+
const { delay: groupDelay, currentId: groupCurrentId } = useDelayGroup(
|
|
172
|
+
interactionContext,
|
|
173
|
+
{ id: groupIdRef.current }
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
// compute effective delay:
|
|
177
|
+
// 1. if in an active delay group with another tooltip showing, use group's coordinated delay
|
|
178
|
+
// 2. else use explicit delay prop if provided
|
|
179
|
+
// 3. else parse from hoverable config
|
|
180
|
+
const isInActiveGroup =
|
|
181
|
+
groupIdRef.current && groupCurrentId != null && typeof groupDelay === 'object'
|
|
182
|
+
let delay: Delay
|
|
183
|
+
let restMs: number
|
|
184
|
+
if (isInActiveGroup) {
|
|
185
|
+
delay = groupDelay
|
|
186
|
+
restMs = 0
|
|
187
|
+
} else if (delayRef.current !== undefined) {
|
|
188
|
+
delay = delayRef.current
|
|
189
|
+
restMs = restMsRef.current ?? 0
|
|
190
|
+
} else {
|
|
191
|
+
delay =
|
|
192
|
+
currentHoverable && typeof currentHoverable === 'object'
|
|
193
|
+
? (currentHoverable.delay ?? 0)
|
|
194
|
+
: 0
|
|
195
|
+
restMs =
|
|
196
|
+
currentHoverable && typeof currentHoverable === 'object'
|
|
197
|
+
? (currentHoverable.restMs ?? 0)
|
|
198
|
+
: 0
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const currentRole = roleRef.current
|
|
202
|
+
const currentFocus = focusRef.current
|
|
203
|
+
|
|
204
|
+
const { getReferenceProps, getFloatingProps: getFloatingPropsInner } =
|
|
205
|
+
useInteractions([
|
|
206
|
+
currentHoverable
|
|
207
|
+
? useHover(interactionContext, {
|
|
208
|
+
enabled: !disableRef.current && !!currentHoverable,
|
|
209
|
+
delay,
|
|
210
|
+
restMs,
|
|
211
|
+
handleClose: safePolygon({
|
|
212
|
+
requireIntent: true,
|
|
213
|
+
buffer: 1,
|
|
214
|
+
__debug:
|
|
215
|
+
typeof window !== 'undefined' &&
|
|
216
|
+
new URLSearchParams(window.location.search).get('debug') ===
|
|
217
|
+
'safePolygon',
|
|
218
|
+
}),
|
|
219
|
+
...(typeof currentHoverable === 'object' && currentHoverable),
|
|
220
|
+
})
|
|
221
|
+
: useHover(interactionContext, {
|
|
222
|
+
enabled: false,
|
|
44
223
|
}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
224
|
+
useFocus(interactionContext, {
|
|
225
|
+
enabled: !disableRef.current && !disableFocusRef.current,
|
|
226
|
+
visibleOnly: true,
|
|
227
|
+
...currentFocus,
|
|
228
|
+
}),
|
|
229
|
+
useRole(interactionContext, { role: currentRole }),
|
|
230
|
+
])
|
|
231
|
+
|
|
232
|
+
// track whether cursor is over the floating content element.
|
|
233
|
+
//
|
|
234
|
+
// why: when flushSync switches the reference element, useHover's
|
|
235
|
+
// useEffect (which attaches DOM mouseleave listeners) hasn't run
|
|
236
|
+
// yet, so safePolygon may not be installed. our fallback close
|
|
237
|
+
// timer in onLeaveReference needs to know if the cursor reached
|
|
238
|
+
// the floating content — if it did, we shouldn't close.
|
|
239
|
+
//
|
|
240
|
+
// why React handlers work here: unlike useHover's DOM listeners
|
|
241
|
+
// (attached via useEffect, subject to timing gaps), these React
|
|
242
|
+
// synthetic event handlers are attached via JSX props and work
|
|
243
|
+
// immediately after render, regardless of useEffect scheduling.
|
|
244
|
+
//
|
|
245
|
+
// no memoization concern: this entire block runs inside the
|
|
246
|
+
// useCallback factory which already produces fresh closures each
|
|
247
|
+
// call ('use no memo'), and getFloatingPropsInner from
|
|
248
|
+
// useInteractions is already a new reference each render.
|
|
249
|
+
const getFloatingProps = currentHoverable
|
|
250
|
+
? (userProps?: Record<string, any>) => {
|
|
251
|
+
const merged = getFloatingPropsInner(userProps)
|
|
252
|
+
const origEnter = merged.onMouseEnter
|
|
253
|
+
const origLeave = merged.onMouseLeave
|
|
254
|
+
return {
|
|
255
|
+
...merged,
|
|
256
|
+
onMouseEnter: (e: any) => {
|
|
257
|
+
isOverFloatingRef.current = true
|
|
258
|
+
origEnter?.(e)
|
|
259
|
+
},
|
|
260
|
+
onMouseLeave: (e: any) => {
|
|
261
|
+
isOverFloatingRef.current = false
|
|
262
|
+
origLeave?.(e)
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
: getFloatingPropsInner
|
|
267
|
+
|
|
268
|
+
const openDelay = typeof delay === 'number' ? delay : ((delay as any)?.open ?? 0)
|
|
269
|
+
const closeDelay = typeof delay === 'number' ? delay : ((delay as any)?.close ?? 0)
|
|
270
|
+
|
|
271
|
+
const setOpenWithDelay = () => {
|
|
272
|
+
clearTimeout(restTimerRef.current)
|
|
273
|
+
if (restMs && !openDelay) {
|
|
274
|
+
restTimerRef.current = setTimeout(() => {
|
|
275
|
+
setOpen(true, 'hover')
|
|
276
|
+
}, restMs)
|
|
277
|
+
} else if (openDelay) {
|
|
278
|
+
restTimerRef.current = setTimeout(() => {
|
|
279
|
+
setOpen(true, 'hover')
|
|
280
|
+
}, openDelay)
|
|
281
|
+
} else {
|
|
282
|
+
setOpen(true, 'hover')
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
59
286
|
return {
|
|
60
287
|
...floating,
|
|
61
|
-
open,
|
|
288
|
+
open: openRef.current,
|
|
289
|
+
triggerElements,
|
|
62
290
|
getReferenceProps,
|
|
63
291
|
getFloatingProps,
|
|
292
|
+
|
|
293
|
+
onHoverReference: currentHoverable
|
|
294
|
+
? (_event: any) => {
|
|
295
|
+
clearTimeout(graceRef.current)
|
|
296
|
+
onTriggerRef.current = true
|
|
297
|
+
pendingCloseRef.current = false
|
|
298
|
+
clearTimeout(restTimerRef.current)
|
|
299
|
+
|
|
300
|
+
if (openRef.current) return
|
|
301
|
+
setOpenWithDelay()
|
|
302
|
+
}
|
|
303
|
+
: undefined,
|
|
304
|
+
|
|
305
|
+
onLeaveReference: currentHoverable
|
|
306
|
+
? () => {
|
|
307
|
+
clearTimeout(restTimerRef.current)
|
|
308
|
+
clearTimeout(graceRef.current)
|
|
309
|
+
graceRef.current = setTimeout(() => {
|
|
310
|
+
onTriggerRef.current = false
|
|
311
|
+
if (pendingCloseRef.current) {
|
|
312
|
+
pendingCloseRef.current = false
|
|
313
|
+
setOpen(false, 'hover')
|
|
314
|
+
return
|
|
315
|
+
}
|
|
316
|
+
// if still open but no pending close, safePolygon may not
|
|
317
|
+
// have installed its DOM listeners yet (flushSync/useEffect
|
|
318
|
+
// timing gap — exacerbated by heavy animation work on the
|
|
319
|
+
// main thread). schedule a delayed fallback that closes
|
|
320
|
+
// unless cursor reaches floating content.
|
|
321
|
+
if (openRef.current) {
|
|
322
|
+
graceRef.current = setTimeout(
|
|
323
|
+
() => {
|
|
324
|
+
// don't force-close if safePolygon is actively tracking
|
|
325
|
+
// the cursor — it will close when the cursor exits the
|
|
326
|
+
// polygon. this prevents the fallback from racing
|
|
327
|
+
// safePolygon during slow diagonal movement.
|
|
328
|
+
if (
|
|
329
|
+
openRef.current &&
|
|
330
|
+
!isOverFloatingRef.current &&
|
|
331
|
+
!handleCloseActiveRef.current
|
|
332
|
+
) {
|
|
333
|
+
setOpen(false, 'hover')
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
Math.max(250, closeDelay)
|
|
337
|
+
)
|
|
338
|
+
}
|
|
339
|
+
}, 40)
|
|
340
|
+
}
|
|
341
|
+
: undefined,
|
|
64
342
|
}
|
|
65
343
|
},
|
|
66
|
-
[
|
|
344
|
+
[setOpen]
|
|
67
345
|
)
|
|
68
346
|
}
|
package/types/Popover.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@tamagui/polyfill-dev';
|
|
2
|
-
import type { UseHoverProps } from '@floating
|
|
3
|
-
import type { SizeTokens,
|
|
4
|
-
import type
|
|
2
|
+
import type { UseHoverProps } from '@tamagui/floating';
|
|
3
|
+
import type { SizeTokens, TamaguiElement, ViewProps } from '@tamagui/core';
|
|
4
|
+
import { type DismissableProps } from '@tamagui/dismissable';
|
|
5
5
|
import type { FocusScopeProps } from '@tamagui/focus-scope';
|
|
6
6
|
import { type PopperArrowExtraProps, type PopperArrowProps, type PopperContentProps, type PopperProps } from '@tamagui/popper';
|
|
7
7
|
import { type ScrollViewProps } from '@tamagui/scroll-view';
|
|
@@ -10,6 +10,9 @@ import * as React from 'react';
|
|
|
10
10
|
type ScopedPopoverProps<P> = Omit<P, 'scope'> & {
|
|
11
11
|
scope?: PopoverScopes;
|
|
12
12
|
};
|
|
13
|
+
export declare const hasOpenPopovers: () => boolean;
|
|
14
|
+
export declare const closeOpenPopovers: () => boolean;
|
|
15
|
+
export declare const closeLastOpenedPopover: () => boolean;
|
|
13
16
|
type PopoverVia = 'hover' | 'press';
|
|
14
17
|
export type PopoverProps = ScopedPopoverProps<PopperProps> & {
|
|
15
18
|
open?: boolean;
|
|
@@ -30,6 +33,22 @@ export type PopoverProps = ScopedPopoverProps<PopperProps> & {
|
|
|
30
33
|
* Disable focusing behavior on open
|
|
31
34
|
*/
|
|
32
35
|
disableFocus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Disable the dismissable layer (escape key, outside click handling).
|
|
38
|
+
* Useful for popovers that stay mounted but are visually hidden.
|
|
39
|
+
*/
|
|
40
|
+
disableDismissable?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* z-index for the popover portal. Use this when popovers need to appear
|
|
43
|
+
* above other portaled content like dialogs or fixed headers.
|
|
44
|
+
*
|
|
45
|
+
* By default, Tamagui automatically stacks overlays - later-opened content
|
|
46
|
+
* appears above earlier content, and nested content appears above its parent.
|
|
47
|
+
* Only set this if you need to override the automatic stacking behavior.
|
|
48
|
+
*
|
|
49
|
+
* @see https://tamagui.dev/ui/z-index
|
|
50
|
+
*/
|
|
51
|
+
zIndex?: number;
|
|
33
52
|
};
|
|
34
53
|
export type PopoverScopes = string;
|
|
35
54
|
type PopoverContextValue = {
|
|
@@ -47,16 +66,84 @@ type PopoverContextValue = {
|
|
|
47
66
|
size?: SizeTokens;
|
|
48
67
|
breakpointActive?: boolean;
|
|
49
68
|
keepChildrenMounted?: boolean | 'lazy';
|
|
69
|
+
disableDismissable?: boolean;
|
|
70
|
+
hoverable?: boolean | object;
|
|
50
71
|
anchorTo?: Rect;
|
|
72
|
+
branches: Set<HTMLElement>;
|
|
73
|
+
};
|
|
74
|
+
type PopoverTriggerStateSetter = React.Dispatch<React.SetStateAction<boolean>>;
|
|
75
|
+
type PopoverTriggerContextValue = {
|
|
76
|
+
triggerRef: React.RefObject<any>;
|
|
77
|
+
hasCustomAnchor: boolean;
|
|
78
|
+
anchorTo?: Rect;
|
|
79
|
+
branches: Set<HTMLElement>;
|
|
80
|
+
onOpenToggle(): void;
|
|
81
|
+
setActiveTrigger(id: string | null): void;
|
|
82
|
+
registerTrigger(id: string, setOpen: PopoverTriggerStateSetter): void;
|
|
83
|
+
unregisterTrigger(id: string): void;
|
|
51
84
|
};
|
|
52
85
|
export declare const PopoverContext: import("@tamagui/core").StyledContext<PopoverContextValue>;
|
|
86
|
+
export declare const PopoverZIndexContext: React.Context<number | undefined>;
|
|
87
|
+
export declare const PopoverTriggerContext: import("@tamagui/core").StyledContext<PopoverTriggerContextValue>;
|
|
53
88
|
export declare const usePopoverContext: (scope?: string) => PopoverContextValue;
|
|
89
|
+
export declare const usePopoverTriggerContext: (scope?: string) => PopoverTriggerContextValue;
|
|
90
|
+
/**
|
|
91
|
+
* Read reactive popover open state from the popover context.
|
|
92
|
+
*/
|
|
93
|
+
export declare function usePopoverOpen(scope?: string): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Hook to set up trigger registration/isolation logic.
|
|
96
|
+
* Used internally by Popover and can be used by Tooltip.
|
|
97
|
+
*/
|
|
98
|
+
export declare function usePopoverTriggerSetup(open: boolean): {
|
|
99
|
+
setActiveTrigger: (id: string | null) => void;
|
|
100
|
+
registerTrigger: (id: string, setOpenState: PopoverTriggerStateSetter) => void;
|
|
101
|
+
unregisterTrigger: (id: string) => void;
|
|
102
|
+
};
|
|
103
|
+
export type PopoverContextProviderProps = {
|
|
104
|
+
scope: string;
|
|
105
|
+
children: React.ReactNode;
|
|
106
|
+
open: boolean;
|
|
107
|
+
onOpenChange(open: boolean, via?: 'hover' | 'press'): void;
|
|
108
|
+
onOpenToggle(): void;
|
|
109
|
+
triggerRef: React.RefObject<any>;
|
|
110
|
+
id?: string;
|
|
111
|
+
contentId?: string;
|
|
112
|
+
hasCustomAnchor?: boolean;
|
|
113
|
+
onCustomAnchorAdd?: () => void;
|
|
114
|
+
onCustomAnchorRemove?: () => void;
|
|
115
|
+
anchorTo?: Rect;
|
|
116
|
+
adaptScope?: string;
|
|
117
|
+
breakpointActive?: boolean;
|
|
118
|
+
keepChildrenMounted?: boolean | 'lazy';
|
|
119
|
+
disableDismissable?: boolean;
|
|
120
|
+
hoverable?: boolean | object;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Provider that sets up both PopoverContext and PopoverTriggerContext.
|
|
124
|
+
* Use this in Tooltip or other components that need popover trigger behavior.
|
|
125
|
+
*/
|
|
126
|
+
export declare const PopoverContextProvider: React.MemoExoticComponent<({ scope, children, open, onOpenChange, onOpenToggle, triggerRef, id, contentId, hasCustomAnchor, onCustomAnchorAdd, onCustomAnchorRemove, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable, }: PopoverContextProviderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
54
127
|
export type PopoverAnchorProps = ScopedPopoverProps<YStackProps>;
|
|
55
|
-
export declare const PopoverAnchor: React.
|
|
128
|
+
export declare const PopoverAnchor: React.NamedExoticComponent<Omit<YStackProps, "scope"> & {
|
|
56
129
|
scope?: PopoverScopes;
|
|
57
130
|
} & React.RefAttributes<TamaguiElement>>;
|
|
58
|
-
export type PopoverTriggerProps = ScopedPopoverProps<ViewProps
|
|
59
|
-
|
|
131
|
+
export type PopoverTriggerProps = ScopedPopoverProps<ViewProps & {
|
|
132
|
+
/**
|
|
133
|
+
* When true, disables the built-in click-to-toggle behavior on the trigger.
|
|
134
|
+
* Useful for hoverable popovers where you want to control open/close
|
|
135
|
+
* entirely through hover or your own handlers.
|
|
136
|
+
*/
|
|
137
|
+
disablePressTrigger?: boolean;
|
|
138
|
+
}>;
|
|
139
|
+
export declare const PopoverTrigger: React.NamedExoticComponent<Omit<import("@tamagui/core").StackNonStyleProps & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & import("@tamagui/core").WithPseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>> & import("@tamagui/core").WithMediaProps<import("@tamagui/core").WithThemeShorthandsAndPseudos<import("@tamagui/core").StackStyleBase, {}>> & {
|
|
140
|
+
/**
|
|
141
|
+
* When true, disables the built-in click-to-toggle behavior on the trigger.
|
|
142
|
+
* Useful for hoverable popovers where you want to control open/close
|
|
143
|
+
* entirely through hover or your own handlers.
|
|
144
|
+
*/
|
|
145
|
+
disablePressTrigger?: boolean;
|
|
146
|
+
}, "scope"> & {
|
|
60
147
|
scope?: PopoverScopes;
|
|
61
148
|
} & React.RefAttributes<TamaguiElement>>;
|
|
62
149
|
export interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'disableOutsidePointerEvents'> {
|
|
@@ -105,6 +192,14 @@ export type PopoverContentImplProps = PopperContentProps & Omit<DismissableProps
|
|
|
105
192
|
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | false;
|
|
106
193
|
enableRemoveScroll?: boolean;
|
|
107
194
|
freezeContentsWhenHidden?: boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Performance - if never going to use feature can permanently disable
|
|
197
|
+
*/
|
|
198
|
+
alwaysDisable?: {
|
|
199
|
+
focus?: boolean;
|
|
200
|
+
'remove-scroll'?: boolean;
|
|
201
|
+
dismiss?: boolean;
|
|
202
|
+
};
|
|
108
203
|
};
|
|
109
204
|
export type PopoverCloseProps = ScopedPopoverProps<YStackProps>;
|
|
110
205
|
export declare const PopoverClose: React.ForwardRefExoticComponent<Omit<YStackProps, "scope"> & {
|
|
@@ -157,8 +252,24 @@ export declare const Popover: React.ForwardRefExoticComponent<Omit<PopperProps,
|
|
|
157
252
|
* Disable focusing behavior on open
|
|
158
253
|
*/
|
|
159
254
|
disableFocus?: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Disable the dismissable layer (escape key, outside click handling).
|
|
257
|
+
* Useful for popovers that stay mounted but are visually hidden.
|
|
258
|
+
*/
|
|
259
|
+
disableDismissable?: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* z-index for the popover portal. Use this when popovers need to appear
|
|
262
|
+
* above other portaled content like dialogs or fixed headers.
|
|
263
|
+
*
|
|
264
|
+
* By default, Tamagui automatically stacks overlays - later-opened content
|
|
265
|
+
* appears above earlier content, and nested content appears above its parent.
|
|
266
|
+
* Only set this if you need to override the automatic stacking behavior.
|
|
267
|
+
*
|
|
268
|
+
* @see https://tamagui.dev/ui/z-index
|
|
269
|
+
*/
|
|
270
|
+
zIndex?: number;
|
|
160
271
|
} & React.RefAttributes<Popover>> & {
|
|
161
|
-
Anchor: React.
|
|
272
|
+
Anchor: React.NamedExoticComponent<Omit<YStackProps, "scope"> & {
|
|
162
273
|
scope?: PopoverScopes;
|
|
163
274
|
} & React.RefAttributes<TamaguiElement>>;
|
|
164
275
|
Arrow: import("@tamagui/core").TamaguiComponent<Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
@@ -170,7 +281,14 @@ export declare const Popover: React.ForwardRefExoticComponent<Omit<PopperProps,
|
|
|
170
281
|
elevation?: number | SizeTokens | undefined;
|
|
171
282
|
fullscreen?: boolean | undefined;
|
|
172
283
|
}, import("@tamagui/core").StaticConfigPublic>;
|
|
173
|
-
Trigger: React.
|
|
284
|
+
Trigger: React.NamedExoticComponent<Omit<import("@tamagui/core").StackNonStyleProps & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & import("@tamagui/core").WithPseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>> & import("@tamagui/core").WithMediaProps<import("@tamagui/core").WithThemeShorthandsAndPseudos<import("@tamagui/core").StackStyleBase, {}>> & {
|
|
285
|
+
/**
|
|
286
|
+
* When true, disables the built-in click-to-toggle behavior on the trigger.
|
|
287
|
+
* Useful for hoverable popovers where you want to control open/close
|
|
288
|
+
* entirely through hover or your own handlers.
|
|
289
|
+
*/
|
|
290
|
+
disablePressTrigger?: boolean;
|
|
291
|
+
}, "scope"> & {
|
|
174
292
|
scope?: PopoverScopes;
|
|
175
293
|
} & React.RefAttributes<TamaguiElement>>;
|
|
176
294
|
Content: import("@tamagui/core").TamaguiComponent<Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
package/types/Popover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../src/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../src/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAatD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAQ1E,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,EAIL,KAAK,qBAAqB,EAE1B,KAAK,gBAAgB,EAGrB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAGjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,KAAK,kBAAkB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAC9C,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAMD,eAAO,MAAM,eAAe,eAE3B,CAAA;AAED,eAAO,MAAM,iBAAiB,eAI7B,CAAA;AAED,eAAO,MAAM,sBAAsB,eAQlC,CAAA;AAED,KAAK,UAAU,GAAG,OAAO,GAAG,OAAO,CAAA;AAEnC,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC,WAAW,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,C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,OAAO,KAAK,IAAI,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAsBD,eAAO,MAAM,OAAO;YAp3BV,aAAa;;WA8Bd,OAAO;kBACA,OAAO;mBACN,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,UAAU,KAAK,IAAI;IAExD;;;;;OAKG;0BACmB,OAAO,GAAG,MAAM;IAEtC;;OAEG;gBACS,OAAO,GAAG,aAAa;IAEnC;;OAEG;mBACY,OAAO;IAEtB;;;OAGG;yBACkB,OAAO;IAE5B;;;;;;;;;OASG;aACM,MAAM;;;gBApEP,aAAa;;;;;;;;;;;;QA+SnB;;;;WAIG;8BACmB,OAAO;;gBApTvB,aAAa;;;;;;;;;;;;;;gBAAb,aAAa;;;;sBAHP,GAAG;qBAEP,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA81BH,MAAM;;;CAqDf,CAAA"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import type { UseFloatingOptions } from '@floating
|
|
2
|
-
export
|
|
3
|
-
open:
|
|
4
|
-
setOpen:
|
|
5
|
-
disable
|
|
6
|
-
disableFocus
|
|
7
|
-
hoverable
|
|
8
|
-
|
|
1
|
+
import type { Delay, UseFloatingOptions } from '@tamagui/floating';
|
|
2
|
+
export type UseFloatingContextOptions = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
setOpen: (val: boolean, type?: string) => void;
|
|
5
|
+
disable?: boolean;
|
|
6
|
+
disableFocus?: boolean;
|
|
7
|
+
hoverable?: boolean | Record<string, any>;
|
|
8
|
+
role?: 'dialog' | 'tooltip';
|
|
9
|
+
focus?: Record<string, any>;
|
|
10
|
+
groupId?: string;
|
|
11
|
+
delay?: Delay;
|
|
12
|
+
restMs?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const useFloatingContext: ({ open, setOpen, disable, disableFocus, hoverable, role: roleProp, focus: focusProp, groupId, delay: delayProp, restMs: restMsProp, }: UseFloatingContextOptions) => (props?: UseFloatingOptions) => any;
|
|
9
15
|
//# sourceMappingURL=useFloatingContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingContext.d.ts","sourceRoot":"","sources":["../src/useFloatingContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useFloatingContext.d.ts","sourceRoot":"","sources":["../src/useFloatingContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AA8BlE,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAEzC,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAE3B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE3B,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,uIAWhC,yBAAyB,cA8Bf,kBAAkB,QA+P9B,CAAA"}
|