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

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 +160 -129
  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 +154 -112
  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 +125 -90
  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 +346 -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,346 @@
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
+ return (
106
+ <PopperProvider
107
+ scope={__scopePopper}
108
+ anchorRef={anchorRef}
109
+ size={size}
110
+ arrowRef={composedArrowRefs}
111
+ arrowStyle={middlewareData.arrow}
112
+ onArrowSize={setArrowSize}
113
+ isMounted={isMounted}
114
+ {...floating}
115
+ >
116
+ {children}
117
+ </PopperProvider>
118
+ )
119
+ }
120
+
121
+ Popper.displayName = POPPER_NAME
122
+
123
+ /* -------------------------------------------------------------------------------------------------
124
+ * PopperAnchor
125
+ * -----------------------------------------------------------------------------------------------*/
126
+
127
+ const ANCHOR_NAME = 'PopperAnchor'
128
+
129
+ type PopperAnchorRef = HTMLElement | View
130
+
131
+ export type PopperAnchorProps = YStackProps & {
132
+ virtualRef?: React.RefObject<any>
133
+ }
134
+
135
+ export const PopperAnchor = React.forwardRef<PopperAnchorRef, PopperAnchorProps>(
136
+ (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {
137
+ const { __scopePopper, virtualRef, ...anchorProps } = props
138
+ const { anchorRef, getReferenceProps } = usePopperContext(ANCHOR_NAME, __scopePopper)
139
+ const ref = React.useRef<PopperAnchorRef>(null)
140
+ const composedRefs = useComposedRefs(forwardedRef, ref, anchorRef)
141
+ if (virtualRef) {
142
+ return null
143
+ }
144
+ const stackProps = {
145
+ ref: composedRefs,
146
+ ...anchorProps,
147
+ }
148
+ return <YStack {...(getReferenceProps ? getReferenceProps(stackProps) : stackProps)} />
149
+ }
150
+ )
151
+
152
+ PopperAnchor.displayName = ANCHOR_NAME
153
+
154
+ /* -------------------------------------------------------------------------------------------------
155
+ * PopperContent
156
+ * -----------------------------------------------------------------------------------------------*/
157
+
158
+ const CONTENT_NAME = 'PopperContent'
159
+
160
+ type PopperContentElement = HTMLElement | View
161
+
162
+ export type PopperContentProps = SizableStackProps
163
+
164
+ const PopperContentFrame = styled(ThemeableStack, {
165
+ name: 'PopperContent',
166
+ backgroundColor: '$background',
167
+ alignItems: 'center',
168
+ radiused: true,
169
+
170
+ variants: {
171
+ size: {
172
+ '...size': (val, { tokens }) => {
173
+ return {
174
+ padding: tokens.space[val],
175
+ borderRadius: tokens.radius[val],
176
+ }
177
+ },
178
+ },
179
+ } as const,
180
+
181
+ defaultVariants: {
182
+ size: '$4',
183
+ },
184
+ })
185
+
186
+ export const PopperContent = PopperContentFrame.extractable(
187
+ React.forwardRef<PopperContentElement, PopperContentProps>(
188
+ (props: ScopedProps<PopperContentProps>, forwardedRef) => {
189
+ const { __scopePopper, ...contentProps } = props
190
+ const { strategy, placement, floating, x, y, getFloatingProps, size, isMounted } =
191
+ usePopperContext(CONTENT_NAME, __scopePopper)
192
+ const contentRefs = useComposedRefs<any>(floating, forwardedRef)
193
+
194
+ const contents = React.useMemo(() => {
195
+ return (
196
+ <PopperContentFrame
197
+ key="popper-content-frame"
198
+ data-placement={placement}
199
+ data-strategy={strategy}
200
+ size={contentProps.size || size}
201
+ {...contentProps}
202
+ />
203
+ )
204
+ }, [placement, strategy, props])
205
+
206
+ // all poppers hidden on ssr by default
207
+ if (!isMounted) {
208
+ return null
209
+ }
210
+
211
+ const frameProps = {
212
+ ref: contentRefs,
213
+ x: x || 0,
214
+ y: y || 0,
215
+ position: strategy,
216
+ }
217
+
218
+ // outer frame because we explicitly dont want animation to apply to this
219
+ return (
220
+ <YStack {...(getFloatingProps ? getFloatingProps(frameProps) : frameProps)}>
221
+ {contents}
222
+ </YStack>
223
+ )
224
+ }
225
+ )
226
+ )
227
+
228
+ PopperContent.displayName = CONTENT_NAME
229
+
230
+ /* -------------------------------------------------------------------------------------------------
231
+ * PopperArrow
232
+ * -----------------------------------------------------------------------------------------------*/
233
+
234
+ const ARROW_NAME = 'PopperArrow'
235
+
236
+ type PopperArrowElement = HTMLElement | View
237
+
238
+ export type PopperArrowProps = YStackProps & {
239
+ offset?: number
240
+ size?: SizeTokens
241
+ }
242
+
243
+ const PopperArrowFrame = styled(YStack, {
244
+ name: 'PopperArrow',
245
+ borderColor: '$borderColor',
246
+ backgroundColor: '$background',
247
+ position: 'relative',
248
+ })
249
+
250
+ const PopperArrowOuterFrame = styled(YStack, {
251
+ name: 'PopperArrowOuter',
252
+ position: 'absolute',
253
+ zIndex: -1,
254
+ pointerEvents: 'none',
255
+ overflow: 'hidden',
256
+ alignItems: 'center',
257
+ justifyContent: 'center',
258
+ })
259
+
260
+ const opposites = {
261
+ top: 'bottom',
262
+ right: 'left',
263
+ bottom: 'top',
264
+ left: 'right',
265
+ } as const
266
+
267
+ type Sides = keyof typeof opposites
268
+
269
+ export const PopperArrow = PopperArrowFrame.extractable(
270
+ React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(
271
+ props: ScopedProps<PopperArrowProps>,
272
+ forwardedRef
273
+ ) {
274
+ const { __scopePopper, offset, size: sizeProp, borderWidth = 0, ...arrowProps } = props
275
+ const context = usePopperContext(ARROW_NAME, __scopePopper)
276
+ const tokens = getTokens()
277
+ const sizeVal = sizeProp ?? context.size
278
+ const sizeValResolved = getVariableValue(stepTokenUpOrDown(tokens.space, sizeVal, -2, [2]))
279
+ const size = +sizeValResolved
280
+ const { placement } = context
281
+ const { x, y } = context.arrowStyle || { x: 0, y: 0 }
282
+ const refs = useComposedRefs(context.arrowRef, forwardedRef)
283
+
284
+ const primaryPlacement = (placement ? placement.split('-')[0] : 'top') as Sides
285
+
286
+ const arrowStyle: StackProps = { x, y, width: size, height: size }
287
+ const innerArrowStyle: StackProps = {}
288
+ const isVertical = primaryPlacement === 'bottom' || primaryPlacement === 'top'
289
+
290
+ if (primaryPlacement) {
291
+ // allows for extra diagonal size
292
+ arrowStyle[isVertical ? 'width' : 'height'] = size * 2
293
+ const oppSide = opposites[primaryPlacement]
294
+ if (oppSide) {
295
+ arrowStyle[oppSide] = -size
296
+ innerArrowStyle[oppSide] = size / 2
297
+ }
298
+ if (oppSide === 'top' || oppSide === 'bottom') {
299
+ arrowStyle.left = 0
300
+ }
301
+ if (oppSide === 'left' || oppSide === 'right') {
302
+ arrowStyle.top = 0
303
+ }
304
+ }
305
+
306
+ // send the Arrow's offset up to Popper
307
+ useIsomorphicLayoutEffect(() => {
308
+ context.onArrowSize?.(size)
309
+ }, [size, context.onArrowSize])
310
+
311
+ // outer frame to cut off for ability to have nicer shadows/borders
312
+ return (
313
+ <PopperArrowOuterFrame ref={refs} {...arrowStyle}>
314
+ <PopperArrowFrame
315
+ width={size}
316
+ height={size}
317
+ {...arrowProps}
318
+ {...innerArrowStyle}
319
+ rotate="45deg"
320
+ {...(primaryPlacement === 'bottom' && {
321
+ borderBottomWidth: borderWidth,
322
+ borderRightWidth: borderWidth,
323
+ })}
324
+ {...(primaryPlacement === 'top' && {
325
+ borderTopWidth: borderWidth,
326
+ borderLeftWidth: borderWidth,
327
+ })}
328
+ {...(primaryPlacement === 'right' && {
329
+ borderTopWidth: borderWidth,
330
+ borderRightWidth: borderWidth,
331
+ })}
332
+ {...(primaryPlacement === 'left' && {
333
+ borderBottomWidth: borderWidth,
334
+ borderLeftWidth: borderWidth,
335
+ })}
336
+ />
337
+ </PopperArrowOuterFrame>
338
+ )
339
+ })
340
+ )
341
+
342
+ PopperArrow.displayName = ARROW_NAME
343
+
344
+ /* -----------------------------------------------------------------------------------------------*/
345
+
346
+ 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"}