@tamagui/popper 1.0.1-beta.21 → 1.0.1-beta.210

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.
Files changed (48) hide show
  1. package/dist/cjs/Popper.js +159 -125
  2. package/dist/cjs/Popper.js.map +3 -3
  3. package/dist/cjs/floating.js +1 -0
  4. package/dist/cjs/floating.js.map +1 -1
  5. package/dist/cjs/floating.native.js +1 -0
  6. package/dist/cjs/floating.native.js.map +1 -1
  7. package/dist/cjs/index.js +1 -0
  8. package/dist/cjs/index.js.map +1 -1
  9. package/dist/cjs/useFloating.js +7 -4
  10. package/dist/cjs/useFloating.js.map +2 -2
  11. package/dist/esm/Popper.js +153 -108
  12. package/dist/esm/Popper.js.map +3 -3
  13. package/dist/esm/floating.js +0 -0
  14. package/dist/esm/floating.js.map +1 -1
  15. package/dist/esm/floating.native.js +0 -0
  16. package/dist/esm/floating.native.js.map +1 -1
  17. package/dist/esm/index.js +0 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/useFloating.js +2 -4
  20. package/dist/esm/useFloating.js.map +2 -2
  21. package/dist/jsx/Popper.js +124 -86
  22. package/dist/jsx/Popper.js.map +7 -0
  23. package/dist/jsx/floating.js +1 -0
  24. package/dist/jsx/floating.js.map +7 -0
  25. package/dist/jsx/floating.native.js +1 -0
  26. package/dist/jsx/floating.native.js.map +7 -0
  27. package/dist/jsx/index.js +1 -0
  28. package/dist/jsx/index.js.map +7 -0
  29. package/dist/jsx/useFloating.js +4 -6
  30. package/dist/jsx/useFloating.js.map +7 -0
  31. package/package.json +17 -12
  32. package/src/Popper.tsx +351 -0
  33. package/src/floating.native.tsx +1 -0
  34. package/src/floating.tsx +1 -0
  35. package/src/index.tsx +2 -0
  36. package/src/useFloating.tsx +20 -0
  37. package/types/Popper.d.ts +73 -61
  38. package/types/index.d.ts +1 -1
  39. package/types/useFloating.d.ts +3 -2
  40. package/types/Popper.d.ts.map +0 -1
  41. package/types/floating.d.ts.map +0 -1
  42. package/types/floating.native.d.ts.map +0 -1
  43. package/types/index.d.ts.map +0 -1
  44. package/types/useFloating.d.ts.map +0 -1
  45. package/types/useFloating.native.d.ts +0 -2
  46. package/types/useFloating.native.d.ts.map +0 -1
  47. package/types/useFloating.web.d.ts +0 -2
  48. package/types/useFloating.web.d.ts.map +0 -1
package/src/Popper.tsx ADDED
@@ -0,0 +1,351 @@
1
+ // adapted from radix-ui popper
2
+
3
+ import { useComposedRefs } from '@tamagui/compose-refs'
4
+ import {
5
+ SizeTokens,
6
+ StackProps,
7
+ getTokens,
8
+ getVariableValue,
9
+ stepTokenUpOrDown,
10
+ styled,
11
+ useIsomorphicLayoutEffect,
12
+ } from '@tamagui/core'
13
+ import { Scope, createContextScope } from '@tamagui/create-context'
14
+ import { SizableStackProps, ThemeableStack, YStack, YStackProps } from '@tamagui/stacks'
15
+ import * as React from 'react'
16
+ import { View } from 'react-native'
17
+
18
+ import { Coords, Placement, Strategy, arrow, autoUpdate, flip, offset, shift } from './floating'
19
+ import { UseFloatingReturn, useFloating } from './useFloating'
20
+
21
+ type ShiftProps = typeof shift extends (options: infer Opts) => void ? Opts : never
22
+ type FlipProps = typeof flip extends (options: infer Opts) => void ? Opts : never
23
+
24
+ /* -------------------------------------------------------------------------------------------------
25
+ * Popper
26
+ * -----------------------------------------------------------------------------------------------*/
27
+
28
+ const POPPER_NAME = 'Popper'
29
+
30
+ type ScopedProps<P> = P & { __scopePopper?: Scope }
31
+ const [createPopperContext, createScope] = createContextScope(POPPER_NAME)
32
+
33
+ export const createPopperScope = createScope
34
+
35
+ type PopperContextValue = UseFloatingReturn & {
36
+ isMounted: boolean
37
+ anchorRef: any
38
+ size?: SizeTokens
39
+ placement?: Placement
40
+ arrowRef: any
41
+ onArrowSize?: (val: number) => void
42
+ arrowStyle?: Partial<Coords> & {
43
+ centerOffset: number
44
+ }
45
+ }
46
+ const [PopperProvider, usePopperContext] = createPopperContext<PopperContextValue>(POPPER_NAME)
47
+
48
+ export type PopperProps = {
49
+ size?: SizeTokens
50
+ children?: React.ReactNode
51
+ placement?: Placement
52
+ stayInFrame?: ShiftProps | boolean
53
+ allowFlip?: FlipProps | boolean
54
+ strategy?: Strategy
55
+ }
56
+
57
+ export const Popper: React.FC<PopperProps> = (props: ScopedProps<PopperProps>) => {
58
+ const {
59
+ __scopePopper,
60
+ children,
61
+ size,
62
+ strategy = 'absolute',
63
+ placement = 'bottom',
64
+ stayInFrame,
65
+ allowFlip,
66
+ } = props
67
+
68
+ const [isMounted, setIsMounted] = React.useState(false)
69
+ useIsomorphicLayoutEffect(() => {
70
+ setIsMounted(true)
71
+ }, [])
72
+
73
+ const anchorRef = React.useRef<any>()
74
+ const [arrowEl, setArrow] = React.useState<HTMLSpanElement | null>(null)
75
+ const [arrowSize, setArrowSize] = React.useState(0)
76
+ const arrowRef = React.useRef()
77
+
78
+ const floating = useFloating({
79
+ strategy,
80
+ placement,
81
+ middleware: [
82
+ stayInFrame ? shift(typeof stayInFrame === 'boolean' ? {} : stayInFrame) : (null as any),
83
+ allowFlip ? flip(typeof allowFlip === 'boolean' ? {} : allowFlip) : (null as any),
84
+ arrowEl ? arrow({ element: arrowEl }) : (null as any),
85
+ arrowSize ? offset(arrowSize) : (null as any),
86
+ ].filter(Boolean),
87
+ })
88
+
89
+ const { refs, middlewareData } = floating
90
+
91
+ const composedArrowRefs = useComposedRefs<any>(arrowRef, setArrow)
92
+
93
+ useIsomorphicLayoutEffect(() => {
94
+ floating.reference(anchorRef.current)
95
+ }, [anchorRef])
96
+
97
+ React.useEffect(() => {
98
+ if (!refs.reference.current || !refs.floating.current) {
99
+ return
100
+ }
101
+ // Only call this when the floating element is rendered
102
+ return autoUpdate(refs.reference.current, refs.floating.current, floating.update)
103
+ }, [floating.update, refs.floating, refs.reference])
104
+
105
+ const arrowStyle = React.useMemo(() => {
106
+ return middlewareData.arrow
107
+ // eslint-disable-next-line react-hooks/exhaustive-deps
108
+ }, [JSON.stringify(middlewareData.arrow || {})])
109
+
110
+ return (
111
+ <PopperProvider
112
+ scope={__scopePopper}
113
+ anchorRef={anchorRef}
114
+ size={size}
115
+ arrowRef={composedArrowRefs}
116
+ arrowStyle={arrowStyle}
117
+ onArrowSize={setArrowSize}
118
+ isMounted={isMounted}
119
+ {...floating}
120
+ >
121
+ {children}
122
+ </PopperProvider>
123
+ )
124
+ }
125
+
126
+ Popper.displayName = POPPER_NAME
127
+
128
+ /* -------------------------------------------------------------------------------------------------
129
+ * PopperAnchor
130
+ * -----------------------------------------------------------------------------------------------*/
131
+
132
+ const ANCHOR_NAME = 'PopperAnchor'
133
+
134
+ type PopperAnchorRef = HTMLElement | View
135
+
136
+ export type PopperAnchorProps = YStackProps & {
137
+ virtualRef?: React.RefObject<any>
138
+ }
139
+
140
+ export const PopperAnchor = React.forwardRef<PopperAnchorRef, PopperAnchorProps>(
141
+ (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {
142
+ const { __scopePopper, virtualRef, ...anchorProps } = props
143
+ const { anchorRef, getReferenceProps } = usePopperContext(ANCHOR_NAME, __scopePopper)
144
+ const ref = React.useRef<PopperAnchorRef>(null)
145
+ const composedRefs = useComposedRefs(forwardedRef, ref, anchorRef)
146
+ if (virtualRef) {
147
+ return null
148
+ }
149
+ const stackProps = {
150
+ ref: composedRefs,
151
+ ...anchorProps,
152
+ }
153
+ return <YStack {...(getReferenceProps ? getReferenceProps(stackProps) : stackProps)} />
154
+ }
155
+ )
156
+
157
+ PopperAnchor.displayName = ANCHOR_NAME
158
+
159
+ /* -------------------------------------------------------------------------------------------------
160
+ * PopperContent
161
+ * -----------------------------------------------------------------------------------------------*/
162
+
163
+ const CONTENT_NAME = 'PopperContent'
164
+
165
+ type PopperContentElement = HTMLElement | View
166
+
167
+ export type PopperContentProps = SizableStackProps
168
+
169
+ const PopperContentFrame = styled(ThemeableStack, {
170
+ name: 'PopperContent',
171
+ backgroundColor: '$background',
172
+ alignItems: 'center',
173
+ radiused: true,
174
+
175
+ variants: {
176
+ size: {
177
+ '...size': (val, { tokens }) => {
178
+ return {
179
+ padding: tokens.space[val],
180
+ borderRadius: tokens.radius[val],
181
+ }
182
+ },
183
+ },
184
+ } as const,
185
+
186
+ defaultVariants: {
187
+ size: '$4',
188
+ },
189
+ })
190
+
191
+ export const PopperContent = PopperContentFrame.extractable(
192
+ React.forwardRef<PopperContentElement, PopperContentProps>(
193
+ (props: ScopedProps<PopperContentProps>, forwardedRef) => {
194
+ const { __scopePopper, ...contentProps } = props
195
+ const { strategy, placement, floating, x, y, getFloatingProps, size, isMounted } =
196
+ usePopperContext(CONTENT_NAME, __scopePopper)
197
+ const contentRefs = useComposedRefs<any>(floating, forwardedRef)
198
+
199
+ const contents = React.useMemo(() => {
200
+ return (
201
+ <PopperContentFrame
202
+ key="popper-content-frame"
203
+ data-placement={placement}
204
+ data-strategy={strategy}
205
+ size={contentProps.size || size}
206
+ {...contentProps}
207
+ />
208
+ )
209
+ }, [placement, strategy, props])
210
+
211
+ // all poppers hidden on ssr by default
212
+ if (!isMounted) {
213
+ return null
214
+ }
215
+
216
+ const frameProps = {
217
+ ref: contentRefs,
218
+ x: x || 0,
219
+ y: y || 0,
220
+ position: strategy,
221
+ }
222
+
223
+ // outer frame because we explicitly dont want animation to apply to this
224
+ return (
225
+ <YStack {...(getFloatingProps ? getFloatingProps(frameProps) : frameProps)}>
226
+ {contents}
227
+ </YStack>
228
+ )
229
+ }
230
+ )
231
+ )
232
+
233
+ PopperContent.displayName = CONTENT_NAME
234
+
235
+ /* -------------------------------------------------------------------------------------------------
236
+ * PopperArrow
237
+ * -----------------------------------------------------------------------------------------------*/
238
+
239
+ const ARROW_NAME = 'PopperArrow'
240
+
241
+ type PopperArrowElement = HTMLElement | View
242
+
243
+ export type PopperArrowProps = YStackProps & {
244
+ offset?: number
245
+ size?: SizeTokens
246
+ }
247
+
248
+ const PopperArrowFrame = styled(YStack, {
249
+ name: 'PopperArrow',
250
+ borderColor: '$borderColor',
251
+ backgroundColor: '$background',
252
+ position: 'relative',
253
+ })
254
+
255
+ const PopperArrowOuterFrame = styled(YStack, {
256
+ name: 'PopperArrowOuter',
257
+ position: 'absolute',
258
+ zIndex: -1,
259
+ pointerEvents: 'none',
260
+ overflow: 'hidden',
261
+ alignItems: 'center',
262
+ justifyContent: 'center',
263
+ })
264
+
265
+ const opposites = {
266
+ top: 'bottom',
267
+ right: 'left',
268
+ bottom: 'top',
269
+ left: 'right',
270
+ } as const
271
+
272
+ type Sides = keyof typeof opposites
273
+
274
+ export const PopperArrow = PopperArrowFrame.extractable(
275
+ React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(
276
+ props: ScopedProps<PopperArrowProps>,
277
+ forwardedRef
278
+ ) {
279
+ const { __scopePopper, offset, size: sizeProp, borderWidth = 0, ...arrowProps } = props
280
+ const context = usePopperContext(ARROW_NAME, __scopePopper)
281
+ const tokens = getTokens()
282
+ const sizeVal = sizeProp ?? context.size
283
+ const sizeValResolved = getVariableValue(stepTokenUpOrDown(tokens.space, sizeVal, -2, [2]))
284
+ const size = +sizeValResolved
285
+ const { placement } = context
286
+ const { x, y } = context.arrowStyle || { x: 0, y: 0 }
287
+ const refs = useComposedRefs(context.arrowRef, forwardedRef)
288
+
289
+ const primaryPlacement = (placement ? placement.split('-')[0] : 'top') as Sides
290
+
291
+ const arrowStyle: StackProps = { x, y, width: size, height: size }
292
+ const innerArrowStyle: StackProps = {}
293
+ const isVertical = primaryPlacement === 'bottom' || primaryPlacement === 'top'
294
+
295
+ if (primaryPlacement) {
296
+ // allows for extra diagonal size
297
+ arrowStyle[isVertical ? 'width' : 'height'] = size * 2
298
+ const oppSide = opposites[primaryPlacement]
299
+ if (oppSide) {
300
+ arrowStyle[oppSide] = -size
301
+ innerArrowStyle[oppSide] = size / 2
302
+ }
303
+ if (oppSide === 'top' || oppSide === 'bottom') {
304
+ arrowStyle.left = 0
305
+ }
306
+ if (oppSide === 'left' || oppSide === 'right') {
307
+ arrowStyle.top = 0
308
+ }
309
+ }
310
+
311
+ // send the Arrow's offset up to Popper
312
+ useIsomorphicLayoutEffect(() => {
313
+ context.onArrowSize?.(size)
314
+ }, [size, context.onArrowSize])
315
+
316
+ // outer frame to cut off for ability to have nicer shadows/borders
317
+ return (
318
+ <PopperArrowOuterFrame ref={refs} {...arrowStyle}>
319
+ <PopperArrowFrame
320
+ width={size}
321
+ height={size}
322
+ {...arrowProps}
323
+ {...innerArrowStyle}
324
+ rotate="45deg"
325
+ {...(primaryPlacement === 'bottom' && {
326
+ borderBottomWidth: borderWidth,
327
+ borderRightWidth: borderWidth,
328
+ })}
329
+ {...(primaryPlacement === 'top' && {
330
+ borderTopWidth: borderWidth,
331
+ borderLeftWidth: borderWidth,
332
+ })}
333
+ {...(primaryPlacement === 'right' && {
334
+ borderTopWidth: borderWidth,
335
+ borderRightWidth: borderWidth,
336
+ })}
337
+ {...(primaryPlacement === 'left' && {
338
+ borderBottomWidth: borderWidth,
339
+ borderLeftWidth: borderWidth,
340
+ })}
341
+ />
342
+ </PopperArrowOuterFrame>
343
+ )
344
+ })
345
+ )
346
+
347
+ PopperArrow.displayName = ARROW_NAME
348
+
349
+ /* -----------------------------------------------------------------------------------------------*/
350
+
351
+ export { usePopperContext }
@@ -0,0 +1 @@
1
+ export * from '@floating-ui/react-native'
@@ -0,0 +1 @@
1
+ export * from '@floating-ui/react-dom'
package/src/index.tsx ADDED
@@ -0,0 +1,2 @@
1
+ export { FloatingOverrideContext, type UseFloatingFn } from './useFloating'
2
+ export * from './Popper'
@@ -0,0 +1,20 @@
1
+ import { createContext, useContext } from 'react'
2
+
3
+ import * as Floating from './floating'
4
+
5
+ export type UseFloatingFn = typeof Floating.useFloating
6
+
7
+ type UseFloatingProps = UseFloatingFn extends (props: infer Props) => any ? Props : never
8
+
9
+ export type UseFloatingReturn = Floating.UseFloatingReturn & {
10
+ context?: any
11
+ getFloatingProps?: (props: { ref: any; [key: string]: any }) => any
12
+ getReferenceProps?: (props: { ref: any; [key: string]: any }) => any
13
+ }
14
+
15
+ export const FloatingOverrideContext = createContext<UseFloatingFn | null>(null)
16
+
17
+ export const useFloating = (props: UseFloatingProps): UseFloatingReturn => {
18
+ const context = useContext(FloatingOverrideContext)
19
+ return (context || Floating.useFloating)?.(props)
20
+ }
package/types/Popper.d.ts CHANGED
@@ -1,94 +1,106 @@
1
1
  import { SizeTokens } from '@tamagui/core';
2
+ import { Scope } from '@tamagui/create-context';
2
3
  import { SizableStackProps, YStackProps } from '@tamagui/stacks';
3
4
  import * as React from 'react';
4
5
  import { View } from 'react-native';
5
- import { Placement, flip, shift } from './floating';
6
+ import { Coords, Placement, Strategy, flip, shift } from './floating';
7
+ import { UseFloatingReturn } from './useFloating';
6
8
  declare type ShiftProps = typeof shift extends (options: infer Opts) => void ? Opts : never;
7
9
  declare type FlipProps = typeof flip extends (options: infer Opts) => void ? Opts : never;
8
10
  export declare const createPopperScope: import("@tamagui/create-context").CreateScope;
11
+ declare type PopperContextValue = UseFloatingReturn & {
12
+ isMounted: boolean;
13
+ anchorRef: any;
14
+ size?: SizeTokens;
15
+ placement?: Placement;
16
+ arrowRef: any;
17
+ onArrowSize?: (val: number) => void;
18
+ arrowStyle?: Partial<Coords> & {
19
+ centerOffset: number;
20
+ };
21
+ };
22
+ declare const usePopperContext: (consumerName: string, scope: Scope<PopperContextValue | undefined>) => PopperContextValue;
9
23
  export declare type PopperProps = {
10
24
  size?: SizeTokens;
11
25
  children?: React.ReactNode;
12
26
  placement?: Placement;
13
- stayInFrame?: ShiftProps;
14
- allowFlip?: FlipProps;
27
+ stayInFrame?: ShiftProps | boolean;
28
+ allowFlip?: FlipProps | boolean;
29
+ strategy?: Strategy;
15
30
  };
16
31
  export declare const Popper: React.FC<PopperProps>;
17
32
  declare type PopperAnchorRef = HTMLElement | View;
18
33
  export declare type PopperAnchorProps = YStackProps & {
19
34
  virtualRef?: React.RefObject<any>;
20
35
  };
21
- export declare const PopperAnchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
22
- fullscreen?: boolean | undefined;
23
- elevation?: SizeTokens | undefined;
24
- } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
25
- fullscreen?: boolean | undefined;
26
- elevation?: SizeTokens | undefined;
27
- }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
28
- fullscreen?: boolean | undefined;
29
- elevation?: SizeTokens | undefined;
36
+ export declare const PopperAnchor: React.ForwardRefExoticComponent<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
37
+ readonly fullscreen?: boolean | undefined;
38
+ readonly elevation?: SizeTokens | undefined;
39
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
40
+ readonly fullscreen?: boolean | undefined;
41
+ readonly elevation?: SizeTokens | undefined;
42
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
43
+ readonly fullscreen?: boolean | undefined;
44
+ readonly elevation?: SizeTokens | undefined;
30
45
  }>> & {
31
46
  virtualRef?: React.RefObject<any> | undefined;
32
47
  } & React.RefAttributes<PopperAnchorRef>>;
33
48
  declare type PopperContentElement = HTMLElement | View;
34
49
  export declare type PopperContentProps = SizableStackProps;
35
- export declare const PopperContent: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
36
- fullscreen?: boolean | undefined;
37
- elevation?: SizeTokens | undefined;
38
- }, "size" | "focusable" | "fontFamily" | "disabled" | "transparent" | "hoverable" | "pressable" | "bordered" | "chromeless"> & {
39
- fontFamily?: unknown;
40
- hoverable?: boolean | undefined;
41
- pressable?: boolean | undefined;
42
- focusable?: boolean | undefined;
43
- bordered?: boolean | undefined;
44
- size?: SizeTokens | undefined;
45
- disabled?: boolean | undefined;
46
- transparent?: boolean | undefined;
47
- chromeless?: boolean | undefined;
48
- } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
49
- fullscreen?: boolean | undefined;
50
- elevation?: SizeTokens | undefined;
51
- }, "size" | "focusable" | "fontFamily" | "disabled" | "transparent" | "hoverable" | "pressable" | "bordered" | "chromeless"> & {
52
- fontFamily?: unknown;
53
- hoverable?: boolean | undefined;
54
- pressable?: boolean | undefined;
55
- focusable?: boolean | undefined;
56
- bordered?: boolean | undefined;
57
- size?: SizeTokens | undefined;
58
- disabled?: boolean | undefined;
59
- transparent?: boolean | undefined;
60
- chromeless?: boolean | undefined;
61
- }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
62
- fullscreen?: boolean | undefined;
63
- elevation?: SizeTokens | undefined;
64
- }, "size" | "focusable" | "fontFamily" | "disabled" | "transparent" | "hoverable" | "pressable" | "bordered" | "chromeless"> & {
65
- fontFamily?: unknown;
66
- hoverable?: boolean | undefined;
67
- pressable?: boolean | undefined;
68
- focusable?: boolean | undefined;
69
- bordered?: boolean | undefined;
70
- size?: SizeTokens | undefined;
71
- disabled?: boolean | undefined;
72
- transparent?: boolean | undefined;
73
- chromeless?: boolean | undefined;
50
+ export declare const PopperContent: React.ForwardRefExoticComponent<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
51
+ readonly fullscreen?: boolean | undefined;
52
+ readonly elevation?: SizeTokens | undefined;
53
+ }, "size" | "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
54
+ readonly fontFamily?: unknown;
55
+ readonly hoverTheme?: boolean | undefined;
56
+ readonly pressTheme?: boolean | undefined;
57
+ readonly focusTheme?: boolean | undefined;
58
+ readonly circular?: boolean | undefined;
59
+ readonly elevate?: boolean | undefined;
60
+ readonly bordered?: number | boolean | undefined;
61
+ readonly size?: SizeTokens | undefined;
62
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
63
+ readonly fullscreen?: boolean | undefined;
64
+ readonly elevation?: SizeTokens | undefined;
65
+ }, "size" | "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
66
+ readonly fontFamily?: unknown;
67
+ readonly hoverTheme?: boolean | undefined;
68
+ readonly pressTheme?: boolean | undefined;
69
+ readonly focusTheme?: boolean | undefined;
70
+ readonly circular?: boolean | undefined;
71
+ readonly elevate?: boolean | undefined;
72
+ readonly bordered?: number | boolean | undefined;
73
+ readonly size?: SizeTokens | undefined;
74
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
75
+ readonly fullscreen?: boolean | undefined;
76
+ readonly elevation?: SizeTokens | undefined;
77
+ }, "size" | "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
78
+ readonly fontFamily?: unknown;
79
+ readonly hoverTheme?: boolean | undefined;
80
+ readonly pressTheme?: boolean | undefined;
81
+ readonly focusTheme?: boolean | undefined;
82
+ readonly circular?: boolean | undefined;
83
+ readonly elevate?: boolean | undefined;
84
+ readonly bordered?: number | boolean | undefined;
85
+ readonly size?: SizeTokens | undefined;
74
86
  }>> & React.RefAttributes<PopperContentElement>>;
75
87
  declare type PopperArrowElement = HTMLElement | View;
76
88
  export declare type PopperArrowProps = YStackProps & {
77
89
  offset?: number;
78
90
  size?: SizeTokens;
79
91
  };
80
- export declare const PopperArrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
81
- fullscreen?: boolean | undefined;
82
- elevation?: SizeTokens | undefined;
83
- } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
84
- fullscreen?: boolean | undefined;
85
- elevation?: SizeTokens | undefined;
86
- }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
87
- fullscreen?: boolean | undefined;
88
- elevation?: SizeTokens | undefined;
92
+ export declare const PopperArrow: React.ForwardRefExoticComponent<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
93
+ readonly fullscreen?: boolean | undefined;
94
+ readonly elevation?: SizeTokens | undefined;
95
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
96
+ readonly fullscreen?: boolean | undefined;
97
+ readonly elevation?: SizeTokens | undefined;
98
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("@tamagui/types-react-native").ViewProps, "children" | "display"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
99
+ readonly fullscreen?: boolean | undefined;
100
+ readonly elevation?: SizeTokens | undefined;
89
101
  }>> & {
90
102
  offset?: number | undefined;
91
103
  size?: SizeTokens | undefined;
92
104
  } & React.RefAttributes<PopperArrowElement>>;
93
- export {};
105
+ export { usePopperContext };
94
106
  //# sourceMappingURL=Popper.d.ts.map
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { FloatingOverrideContext, UseFloatingFn } from './useFloating';
1
+ export { FloatingOverrideContext, type UseFloatingFn } from './useFloating';
2
2
  export * from './Popper';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -2,7 +2,8 @@
2
2
  import * as Floating from './floating';
3
3
  export declare type UseFloatingFn = typeof Floating.useFloating;
4
4
  declare type UseFloatingProps = UseFloatingFn extends (props: infer Props) => any ? Props : never;
5
- export declare type UseFloatingResult = ReturnType<UseFloatingFn> & {
5
+ export declare type UseFloatingReturn = Floating.UseFloatingReturn & {
6
+ context?: any;
6
7
  getFloatingProps?: (props: {
7
8
  ref: any;
8
9
  [key: string]: any;
@@ -13,6 +14,6 @@ export declare type UseFloatingResult = ReturnType<UseFloatingFn> & {
13
14
  }) => any;
14
15
  };
15
16
  export declare const FloatingOverrideContext: import("react").Context<typeof Floating.useFloating | null>;
16
- export declare const useFloating: (props: UseFloatingProps) => UseFloatingResult;
17
+ export declare const useFloating: (props: UseFloatingProps) => UseFloatingReturn;
17
18
  export {};
18
19
  //# sourceMappingURL=useFloating.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../src/Popper.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAMX,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAgB,iBAAiB,EAAU,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACtF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAU,SAAS,EAAqB,IAAI,EAAU,KAAK,EAAE,MAAM,YAAY,CAAA;AAGtF,aAAK,UAAU,GAAG,OAAO,KAAK,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,CAAA;AACnF,aAAK,SAAS,GAAG,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,CAAA;AAWjF,eAAO,MAAM,iBAAiB,+CAAc,CAAA;AAe5C,oBAAY,WAAW,GAAG;IACxB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyDxC,CAAA;AAUD,aAAK,eAAe,GAAG,WAAW,GAAG,IAAI,CAAA;AAEzC,oBAAY,iBAAiB,GAAG,WAAW,GAAG;IAC5C,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;yCAexB,CAAA;AAUD,aAAK,oBAAoB,GAAG,WAAW,GAAG,IAAI,CAAA;AAE9C,oBAAY,kBAAkB,GAAG,iBAAiB,CAAA;AAYlD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAsCzB,CAAA;AAUD,aAAK,kBAAkB,GAAG,WAAW,GAAG,IAAI,CAAA;AAE5C,oBAAY,gBAAgB,GAAG,WAAW,GAAG;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,UAAU,CAAA;CAClB,CAAA;AAmBD,eAAO,MAAM,WAAW;;;;;;;;;;;;4CA4DvB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../src/floating.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"floating.native.d.ts","sourceRoot":"","sources":["../src/floating.native.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACtE,cAAc,UAAU,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFloating.d.ts","sourceRoot":"","sources":["../src/useFloating.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA;AAEtC,oBAAY,aAAa,GAAG,OAAO,QAAQ,CAAC,WAAW,CAAA;AAEvD,aAAK,gBAAgB,GAAG,aAAa,SAAS,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,GAAG,GAAG,KAAK,GAAG,KAAK,CAAA;AAEzF,oBAAY,iBAAiB,GAAG,UAAU,CAAC,aAAa,CAAC,GAAG;IAC1D,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,GAAG,CAAA;IACnE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,KAAK,GAAG,CAAA;CACrE,CAAA;AAED,eAAO,MAAM,uBAAuB,6DAA4C,CAAA;AAEhF,eAAO,MAAM,WAAW,UAAW,gBAAgB,KAAG,iBAGrD,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from '@floating-ui/react-native';
2
- //# sourceMappingURL=useFloating.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFloating.native.d.ts","sourceRoot":"","sources":["../src/useFloating.native.tsx"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from '@floating-ui/react-dom';
2
- //# sourceMappingURL=useFloating.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFloating.web.d.ts","sourceRoot":"","sources":["../src/useFloating.web.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}