@tamagui/popper 1.0.0-beta.9 → 1.0.1-beta.102

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 (42) hide show
  1. package/dist/cjs/Popper.js +38 -16
  2. package/dist/cjs/Popper.js.map +2 -2
  3. package/dist/cjs/index.js +2 -4
  4. package/dist/cjs/index.js.map +2 -2
  5. package/dist/cjs/useFloating.js +2 -3
  6. package/dist/cjs/useFloating.js.map +2 -2
  7. package/dist/esm/Popper.js +101 -62
  8. package/dist/esm/Popper.js.map +2 -2
  9. package/dist/esm/index.js +2 -3
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/useFloating.js +2 -4
  12. package/dist/esm/useFloating.js.map +2 -2
  13. package/dist/jsx/Popper.js +41 -21
  14. package/dist/jsx/Popper.js.map +7 -0
  15. package/dist/jsx/floating.js +1 -0
  16. package/dist/jsx/floating.js.map +7 -0
  17. package/dist/jsx/floating.native.js +1 -0
  18. package/dist/jsx/floating.native.js.map +7 -0
  19. package/dist/jsx/index.js +3 -3
  20. package/dist/jsx/index.js.map +7 -0
  21. package/dist/jsx/useFloating.js +3 -4
  22. package/dist/jsx/useFloating.js.map +7 -0
  23. package/package.json +15 -12
  24. package/src/Popper.tsx +331 -0
  25. package/src/floating.native.tsx +1 -0
  26. package/src/floating.tsx +1 -0
  27. package/src/index.tsx +2 -0
  28. package/src/useFloating.tsx +20 -0
  29. package/types/Popper.d.ts +65 -53
  30. package/types/Popper.d.ts.map +1 -1
  31. package/types/floating.d.ts +0 -0
  32. package/types/floating.d.ts.map +0 -0
  33. package/types/floating.native.d.ts +0 -0
  34. package/types/floating.native.d.ts.map +0 -0
  35. package/types/index.d.ts +1 -1
  36. package/types/index.d.ts.map +1 -1
  37. package/types/useFloating.d.ts +3 -2
  38. package/types/useFloating.d.ts.map +1 -1
  39. package/types/useFloating.native.d.ts +0 -2
  40. package/types/useFloating.native.d.ts.map +0 -1
  41. package/types/useFloating.web.d.ts +0 -2
  42. package/types/useFloating.web.d.ts.map +0 -1
package/src/Popper.tsx ADDED
@@ -0,0 +1,331 @@
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
53
+ allowFlip?: FlipProps
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(stayInFrame) : (null as any),
83
+ allowFlip ? flip(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
+ }, [refs.floating.current, refs.reference.current])
104
+
105
+ const arrowStyle = React.useMemo(() => {
106
+ return middlewareData.arrow
107
+ }, [JSON.stringify(middlewareData.arrow || {})])
108
+
109
+ return (
110
+ <PopperProvider
111
+ scope={__scopePopper}
112
+ anchorRef={anchorRef}
113
+ size={size}
114
+ arrowRef={composedArrowRefs}
115
+ arrowStyle={arrowStyle}
116
+ onArrowSize={setArrowSize}
117
+ isMounted={isMounted}
118
+ {...floating}
119
+ >
120
+ {children}
121
+ </PopperProvider>
122
+ )
123
+ }
124
+
125
+ Popper.displayName = POPPER_NAME
126
+
127
+ /* -------------------------------------------------------------------------------------------------
128
+ * PopperAnchor
129
+ * -----------------------------------------------------------------------------------------------*/
130
+
131
+ const ANCHOR_NAME = 'PopperAnchor'
132
+
133
+ type PopperAnchorRef = HTMLElement | View
134
+
135
+ export type PopperAnchorProps = YStackProps & {
136
+ virtualRef?: React.RefObject<any>
137
+ }
138
+
139
+ export const PopperAnchor = React.forwardRef<PopperAnchorRef, PopperAnchorProps>(
140
+ (props: ScopedProps<PopperAnchorProps>, forwardedRef) => {
141
+ const { __scopePopper, virtualRef, ...anchorProps } = props
142
+ const { anchorRef, getReferenceProps } = usePopperContext(ANCHOR_NAME, __scopePopper)
143
+ const ref = React.useRef<PopperAnchorRef>(null)
144
+ const composedRefs = useComposedRefs(forwardedRef, ref, anchorRef)
145
+ if (virtualRef) {
146
+ return null
147
+ }
148
+ const stackProps = {
149
+ ref: composedRefs,
150
+ ...anchorProps,
151
+ }
152
+ return <YStack {...(getReferenceProps ? getReferenceProps(stackProps) : stackProps)} />
153
+ }
154
+ )
155
+
156
+ PopperAnchor.displayName = ANCHOR_NAME
157
+
158
+ /* -------------------------------------------------------------------------------------------------
159
+ * PopperContent
160
+ * -----------------------------------------------------------------------------------------------*/
161
+
162
+ const CONTENT_NAME = 'PopperContent'
163
+
164
+ type PopperContentElement = HTMLElement | View
165
+
166
+ export type PopperContentProps = SizableStackProps
167
+
168
+ const PopperContentFrame = styled(ThemeableStack, {
169
+ name: 'PopperContent',
170
+ backgroundColor: '$background',
171
+ alignItems: 'center',
172
+ radiused: true,
173
+
174
+ variants: {
175
+ size: {
176
+ '...size': (val, { tokens }) => {
177
+ return {
178
+ padding: tokens.space[val],
179
+ borderRadius: tokens.radius[val],
180
+ }
181
+ },
182
+ },
183
+ },
184
+
185
+ defaultVariants: {
186
+ size: '$4',
187
+ },
188
+ })
189
+
190
+ export const PopperContent = PopperContentFrame.extractable(
191
+ React.forwardRef<PopperContentElement, PopperContentProps>(
192
+ (props: ScopedProps<PopperContentProps>, forwardedRef) => {
193
+ const { __scopePopper, ...contentProps } = props
194
+ const { strategy, placement, floating, x, y, getFloatingProps, size, isMounted } =
195
+ usePopperContext(CONTENT_NAME, __scopePopper)
196
+ const contentRefs = useComposedRefs<any>(floating, forwardedRef)
197
+
198
+ const contents = React.useMemo(() => {
199
+ return (
200
+ <PopperContentFrame
201
+ key="popper-content-frame"
202
+ data-placement={placement}
203
+ data-strategy={strategy}
204
+ {...contentProps}
205
+ // @ts-ignore
206
+ size={contentProps.size || size}
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: 'absolute',
253
+ zIndex: -1,
254
+ pointerEvents: 'none',
255
+ })
256
+
257
+ const opposites = {
258
+ top: 'bottom',
259
+ right: 'left',
260
+ bottom: 'top',
261
+ left: 'right',
262
+ }
263
+
264
+ export const PopperArrow = PopperArrowFrame.extractable(
265
+ React.forwardRef<PopperArrowElement, PopperArrowProps>(function PopperArrow(
266
+ props: ScopedProps<PopperArrowProps>,
267
+ forwardedRef
268
+ ) {
269
+ const { __scopePopper, offset, size: sizeProp, borderWidth = 0, ...arrowProps } = props
270
+ const context = usePopperContext(ARROW_NAME, __scopePopper)
271
+ const tokens = getTokens()
272
+ const sizeVal = sizeProp ?? context.size
273
+ const sizeValResolved = getVariableValue(stepTokenUpOrDown(tokens.space, sizeVal, -2, [2]))
274
+ const size = +sizeValResolved
275
+ const { placement } = context
276
+ const { x, y } = context.arrowStyle || { x: 0, y: 0 }
277
+ const refs = useComposedRefs(context.arrowRef, forwardedRef)
278
+
279
+ const primaryPlacement = placement ? placement.split('-')[0] : 'top'
280
+
281
+ const arrowStyle: StackProps = { x, y, width: size, height: size }
282
+ if (primaryPlacement) {
283
+ const oppSide = opposites[primaryPlacement]
284
+ if (oppSide) {
285
+ arrowStyle[oppSide] = -size / 2
286
+ }
287
+ if (oppSide === 'top' || oppSide === 'bottom') {
288
+ arrowStyle.left = 0
289
+ }
290
+ if (oppSide === 'left' || oppSide === 'right') {
291
+ arrowStyle.top = 0
292
+ }
293
+ }
294
+
295
+ // send the Arrow's offset up to Popper
296
+ useIsomorphicLayoutEffect(() => {
297
+ context.onArrowSize?.(size)
298
+ }, [size, context.onArrowSize])
299
+
300
+ return (
301
+ <PopperArrowFrame
302
+ {...arrowProps}
303
+ ref={refs}
304
+ {...arrowStyle}
305
+ rotate="45deg"
306
+ {...(primaryPlacement === 'top' && {
307
+ borderBottomWidth: borderWidth,
308
+ borderRightWidth: borderWidth,
309
+ })}
310
+ {...(primaryPlacement === 'bottom' && {
311
+ borderTopWidth: borderWidth,
312
+ borderLeftWidth: borderWidth,
313
+ })}
314
+ {...(primaryPlacement === 'left' && {
315
+ borderTopWidth: borderWidth,
316
+ borderRightWidth: borderWidth,
317
+ })}
318
+ {...(primaryPlacement === 'right' && {
319
+ borderBottomWidth: borderWidth,
320
+ borderLeftWidth: borderWidth,
321
+ })}
322
+ />
323
+ )
324
+ })
325
+ )
326
+
327
+ PopperArrow.displayName = ARROW_NAME
328
+
329
+ /* -----------------------------------------------------------------------------------------------*/
330
+
331
+ 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
27
  stayInFrame?: ShiftProps;
14
28
  allowFlip?: FlipProps;
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("react-native").ViewProps, "display" | "children"> & 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("react-native").ViewProps, "display" | "children"> & 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("react-native").ViewProps, "display" | "children"> & 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"> & {
50
+ export declare const PopperContent: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & 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"> & {
39
54
  fontFamily?: unknown;
40
- hoverable?: boolean | undefined;
41
- pressable?: boolean | undefined;
42
- focusable?: boolean | undefined;
43
- bordered?: boolean | undefined;
55
+ hoverTheme?: boolean | undefined;
56
+ pressTheme?: boolean | undefined;
57
+ focusTheme?: boolean | undefined;
58
+ circular?: boolean | undefined;
59
+ elevate?: boolean | undefined;
60
+ bordered?: number | boolean | undefined;
44
61
  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"> & {
62
+ } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & 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"> & {
52
66
  fontFamily?: unknown;
53
- hoverable?: boolean | undefined;
54
- pressable?: boolean | undefined;
55
- focusable?: boolean | undefined;
56
- bordered?: boolean | undefined;
67
+ hoverTheme?: boolean | undefined;
68
+ pressTheme?: boolean | undefined;
69
+ focusTheme?: boolean | undefined;
70
+ circular?: boolean | undefined;
71
+ elevate?: boolean | undefined;
72
+ bordered?: number | boolean | undefined;
57
73
  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"> & {
74
+ }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & 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"> & {
65
78
  fontFamily?: unknown;
66
- hoverable?: boolean | undefined;
67
- pressable?: boolean | undefined;
68
- focusable?: boolean | undefined;
69
- bordered?: boolean | undefined;
79
+ hoverTheme?: boolean | undefined;
80
+ pressTheme?: boolean | undefined;
81
+ focusTheme?: boolean | undefined;
82
+ circular?: boolean | undefined;
83
+ elevate?: boolean | undefined;
84
+ bordered?: number | boolean | undefined;
70
85
  size?: SizeTokens | undefined;
71
- disabled?: boolean | undefined;
72
- transparent?: boolean | undefined;
73
- chromeless?: boolean | 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("react-native").ViewProps, "display" | "children"> & 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("react-native").ViewProps, "display" | "children"> & 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("react-native").ViewProps, "display" | "children"> & 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
@@ -1 +1 @@
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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A;AAE9C,oBAAY,kBAAkB,GAAG,iBAAiB,CAAA;AAwBlD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDAyCzB,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;AAkBD,eAAO,MAAM,WAAW;;;;;;;;;;;;4CA6DvB,CAAA;AAMD,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
File without changes
File without changes
File without changes
File without changes
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
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAA;AAC3E,cAAc,UAAU,CAAA"}
@@ -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 +1 @@
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
+ {"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,QAAQ,CAAC,iBAAiB,GAAG;IAC3D,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,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"}