@tamagui/popper 2.7.7 → 3.0.0-beta.1091.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Popper.cjs +473 -607
- package/dist/cjs/Popper.native.cjs +498 -0
- package/dist/cjs/Popper.native.js +454 -611
- package/dist/cjs/Popper.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +20 -0
- package/dist/cjs/index.native.js +9 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/useRepositionOnNative.cjs +24 -0
- package/dist/cjs/useRepositionOnNative.native.cjs +63 -0
- package/dist/cjs/useRepositionOnNative.native.js +65 -0
- package/dist/cjs/useRepositionOnNative.native.js.map +1 -0
- package/dist/esm/Popper.mjs +443 -559
- package/dist/esm/Popper.mjs.map +1 -1
- package/dist/esm/Popper.native.js +423 -559
- package/dist/esm/Popper.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/useRepositionOnNative.mjs +4 -0
- package/dist/esm/useRepositionOnNative.mjs.map +1 -0
- package/dist/esm/useRepositionOnNative.native.js +36 -0
- package/dist/esm/useRepositionOnNative.native.js.map +1 -0
- package/dist/jsx/Popper.mjs +443 -559
- package/dist/jsx/Popper.mjs.map +1 -1
- package/dist/jsx/Popper.native.cjs +498 -0
- package/dist/jsx/Popper.native.js +454 -611
- package/dist/jsx/Popper.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +20 -0
- package/dist/jsx/index.native.js +9 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/useRepositionOnNative.mjs +4 -0
- package/dist/jsx/useRepositionOnNative.mjs.map +1 -0
- package/dist/jsx/useRepositionOnNative.native.cjs +63 -0
- package/dist/jsx/useRepositionOnNative.native.js +65 -0
- package/dist/jsx/useRepositionOnNative.native.js.map +1 -0
- package/package.json +15 -13
- package/src/Popper.tsx +44 -129
- package/src/useRepositionOnNative.native.ts +40 -0
- package/src/useRepositionOnNative.ts +8 -0
- package/types/Popper.d.ts +42 -74
- package/types/Popper.d.ts.map +1 -1
- package/types/useRepositionOnNative.d.ts +6 -0
- package/types/useRepositionOnNative.d.ts.map +1 -0
- package/types/useRepositionOnNative.native.d.ts +7 -0
- package/types/useRepositionOnNative.native.d.ts.map +1 -0
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
package/src/Popper.tsx
CHANGED
|
@@ -4,8 +4,10 @@ import { useComposedRefs } from '@tamagui/compose-refs'
|
|
|
4
4
|
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
5
5
|
import type { SizeTokens, TamaguiElement, ViewProps } from '@tamagui/core'
|
|
6
6
|
import {
|
|
7
|
+
createStyledHOC,
|
|
7
8
|
LayoutMeasurementController,
|
|
8
9
|
View as TamaguiView,
|
|
10
|
+
createRefComponent,
|
|
9
11
|
createStyledContext,
|
|
10
12
|
getVariableValue,
|
|
11
13
|
registerLayoutNode,
|
|
@@ -34,12 +36,11 @@ import {
|
|
|
34
36
|
size as sizeMiddleware,
|
|
35
37
|
useFloating,
|
|
36
38
|
} from '@tamagui/floating'
|
|
37
|
-
import {
|
|
38
|
-
import type { SizableStackProps, YStackProps } from '@tamagui/stacks'
|
|
39
|
-
import { YStack } from '@tamagui/stacks'
|
|
39
|
+
import { getSize } from '@tamagui/get-token'
|
|
40
40
|
import { startTransition } from '@tamagui/start-transition'
|
|
41
41
|
import * as React from 'react'
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
import { useRepositionOnNative } from './useRepositionOnNative'
|
|
43
44
|
|
|
44
45
|
type ShiftProps = typeof shift extends (options: infer Opts) => void ? Opts : never
|
|
45
46
|
type FlipProps = typeof flip extends (options: infer Opts) => void ? Opts : never
|
|
@@ -65,7 +66,7 @@ export type PopperContextValue = UseFloatingReturn & PopperContextShared
|
|
|
65
66
|
|
|
66
67
|
export const PopperContextFast = createStyledContext<PopperContextValue>(
|
|
67
68
|
// since we always provide this we can avoid setting here
|
|
68
|
-
{}
|
|
69
|
+
{},
|
|
69
70
|
'Popper__'
|
|
70
71
|
)
|
|
71
72
|
|
|
@@ -85,7 +86,7 @@ export type PopperContextSlowValue = Pick<
|
|
|
85
86
|
|
|
86
87
|
export const PopperContextSlow = createStyledContext<PopperContextSlowValue>(
|
|
87
88
|
// since we always provide this we can avoid setting here
|
|
88
|
-
{}
|
|
89
|
+
{},
|
|
89
90
|
'PopperSlow__'
|
|
90
91
|
)
|
|
91
92
|
|
|
@@ -484,37 +485,7 @@ export function Popper(props: PopperProps) {
|
|
|
484
485
|
|
|
485
486
|
const { middlewareData } = floating
|
|
486
487
|
|
|
487
|
-
|
|
488
|
-
// On Native there's no autoupdate so we call update() when necessary
|
|
489
|
-
|
|
490
|
-
// Subscribe to window dimensions (orientation, scale, etc...)
|
|
491
|
-
const dimensions = useWindowDimensions()
|
|
492
|
-
|
|
493
|
-
// Subscribe to keyboard state
|
|
494
|
-
const [keyboardOpen, setKeyboardOpen] = React.useState(false)
|
|
495
|
-
React.useEffect(() => {
|
|
496
|
-
const showSubscription = Keyboard.addListener('keyboardDidShow', () => {
|
|
497
|
-
startTransition(() => {
|
|
498
|
-
setKeyboardOpen(true)
|
|
499
|
-
})
|
|
500
|
-
})
|
|
501
|
-
const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
|
|
502
|
-
startTransition(() => {
|
|
503
|
-
setKeyboardOpen(false)
|
|
504
|
-
})
|
|
505
|
-
})
|
|
506
|
-
|
|
507
|
-
return () => {
|
|
508
|
-
showSubscription.remove()
|
|
509
|
-
hideSubscription.remove()
|
|
510
|
-
}
|
|
511
|
-
}, [])
|
|
512
|
-
|
|
513
|
-
useIsomorphicLayoutEffect(() => {
|
|
514
|
-
if (passThrough) return
|
|
515
|
-
floating.update()
|
|
516
|
-
}, [passThrough, dimensions, keyboardOpen])
|
|
517
|
-
}
|
|
488
|
+
useRepositionOnNative(floating.update, passThrough)
|
|
518
489
|
|
|
519
490
|
const popperContext = React.useMemo(() => {
|
|
520
491
|
return {
|
|
@@ -559,10 +530,11 @@ export type PopperAnchorExtraProps = {
|
|
|
559
530
|
virtualRef?: React.RefObject<any>
|
|
560
531
|
scope?: string
|
|
561
532
|
}
|
|
562
|
-
export type PopperAnchorProps =
|
|
533
|
+
export type PopperAnchorProps = ViewProps
|
|
563
534
|
|
|
564
|
-
export const PopperAnchor =
|
|
565
|
-
|
|
535
|
+
export const PopperAnchor = createStyledHOC(
|
|
536
|
+
TamaguiView,
|
|
537
|
+
function PopperAnchor(props: PopperAnchorExtraProps, forwardedRef) {
|
|
566
538
|
const { virtualRef, scope, ...rest } = props
|
|
567
539
|
const context = usePopperContextSlow(scope)
|
|
568
540
|
const { getReferenceProps, refs, update } = context
|
|
@@ -658,56 +630,30 @@ export const PopperAnchor = YStack.styleable<PopperAnchorExtraProps>(
|
|
|
658
630
|
|
|
659
631
|
type PopperContentElement = TamaguiElement
|
|
660
632
|
|
|
661
|
-
export type PopperContentProps =
|
|
633
|
+
export type PopperContentProps = ViewProps & {
|
|
662
634
|
scope?: string
|
|
663
635
|
/**
|
|
664
636
|
* Enable smooth animation when the content position changes (e.g., when flipping sides)
|
|
665
637
|
*/
|
|
666
638
|
animatePosition?: boolean | 'even-when-repositioning'
|
|
667
|
-
/** @deprecated Use `animatePosition` instead */
|
|
668
|
-
enableAnimationForPositionChange?: boolean | 'even-when-repositioning'
|
|
669
639
|
passThrough?: boolean
|
|
670
640
|
}
|
|
671
641
|
|
|
672
|
-
export const PopperContentFrame = styled(
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
variants: {
|
|
676
|
-
unstyled: {
|
|
677
|
-
true: {},
|
|
678
|
-
},
|
|
679
|
-
|
|
680
|
-
size: {
|
|
681
|
-
'...size': (val, { tokens }) => {
|
|
682
|
-
return {
|
|
683
|
-
padding: tokens.space[val],
|
|
684
|
-
borderRadius: tokens.radius[val],
|
|
685
|
-
}
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
} as const,
|
|
642
|
+
export const PopperContentFrame = styled(TamaguiView, {
|
|
643
|
+
displayName: 'PopperContent',
|
|
689
644
|
})
|
|
690
645
|
|
|
691
|
-
export const PopperContent =
|
|
646
|
+
export const PopperContent = createRefComponent<PopperContentElement, PopperContentProps>(
|
|
692
647
|
function PopperContent(props, forwardedRef) {
|
|
693
648
|
// detect controlled animatePosition before destructuring. when the user passes
|
|
694
649
|
// animatePosition (even with a currently-falsy value like undefined or false),
|
|
695
650
|
// toggling it later must not flip 'transition' presence on the inner View - that
|
|
696
651
|
// would change useComponentState's hasAnimationProp mid-life, conditionally calling
|
|
697
652
|
// useAnimations/usePresence and tripping React's "Should have a queue" invariant.
|
|
698
|
-
const isAnimatePosControlled =
|
|
699
|
-
'animatePosition' in props || 'enableAnimationForPositionChange' in props
|
|
653
|
+
const isAnimatePosControlled = 'animatePosition' in props
|
|
700
654
|
|
|
701
|
-
const {
|
|
702
|
-
|
|
703
|
-
animatePosition,
|
|
704
|
-
enableAnimationForPositionChange,
|
|
705
|
-
children,
|
|
706
|
-
passThrough,
|
|
707
|
-
unstyled,
|
|
708
|
-
...rest
|
|
709
|
-
} = props
|
|
710
|
-
const animatePos = animatePosition ?? enableAnimationForPositionChange
|
|
655
|
+
const { scope, animatePosition, children, passThrough, ...rest } = props
|
|
656
|
+
const animatePos = animatePosition
|
|
711
657
|
const context = usePopperContext(scope)
|
|
712
658
|
|
|
713
659
|
const {
|
|
@@ -717,7 +663,6 @@ export const PopperContent = React.forwardRef<PopperContentElement, PopperConten
|
|
|
717
663
|
x,
|
|
718
664
|
y,
|
|
719
665
|
getFloatingProps,
|
|
720
|
-
size,
|
|
721
666
|
isPositioned,
|
|
722
667
|
transformOrigin,
|
|
723
668
|
update,
|
|
@@ -735,7 +680,7 @@ export const PopperContent = React.forwardRef<PopperContentElement, PopperConten
|
|
|
735
680
|
// when animatePosition=true, disableAnimation state changes cycle the DOM node
|
|
736
681
|
// (null then re-mount). we block all null calls here to prevent floating-ui from
|
|
737
682
|
// losing its reference mid-cycle; genuine unmount is handled by the useEffect below.
|
|
738
|
-
// for same-node cycling (
|
|
683
|
+
// for same-node cycling (transition prop change without remount), refs.setFloating
|
|
739
684
|
// is a no-op in floating-ui (same-node guard), so we call update() to force recompute.
|
|
740
685
|
const lastNodeRef = React.useRef<any>(null)
|
|
741
686
|
const safeSetFloating = React.useCallback(
|
|
@@ -839,14 +784,13 @@ export const PopperContent = React.forwardRef<PopperContentElement, PopperConten
|
|
|
839
784
|
position: strategy,
|
|
840
785
|
opacity: hide ? 0 : 1,
|
|
841
786
|
// when animatePosition is controlled by the user, always emit these keys with
|
|
842
|
-
// safe no-op values (transition:
|
|
843
|
-
//
|
|
844
|
-
//
|
|
787
|
+
// safe no-op values (transition: 'none') so the inner View's hook count
|
|
788
|
+
// stays stable across animatePos toggles. animatePresence must always be
|
|
789
|
+
// false here too, to short-circuit usePresence consistently.
|
|
845
790
|
...(isAnimatePosControlled && {
|
|
846
|
-
|
|
847
|
-
//
|
|
848
|
-
|
|
849
|
-
animateOnly: animatePos && !disableAnimation ? rest.animateOnly : [],
|
|
791
|
+
// `none` keeps the styles applied while turning transitions off, letting
|
|
792
|
+
// the element move to its position silently before animations start
|
|
793
|
+
transition: animatePos && !disableAnimation ? rest.transition : 'none',
|
|
850
794
|
animatePresence: false,
|
|
851
795
|
}),
|
|
852
796
|
}
|
|
@@ -878,11 +822,9 @@ export const PopperContent = React.forwardRef<PopperContentElement, PopperConten
|
|
|
878
822
|
<PopperContentFrame
|
|
879
823
|
key="popper-content-frame"
|
|
880
824
|
passThrough={passThrough}
|
|
881
|
-
unstyled={unstyled}
|
|
882
825
|
{...(!passThrough && {
|
|
883
826
|
'data-placement': placement,
|
|
884
827
|
'data-strategy': strategy,
|
|
885
|
-
size,
|
|
886
828
|
...style,
|
|
887
829
|
...transformOriginStyle,
|
|
888
830
|
...rest,
|
|
@@ -910,45 +852,21 @@ export type PopperArrowExtraProps = {
|
|
|
910
852
|
animatePosition?: boolean
|
|
911
853
|
}
|
|
912
854
|
|
|
913
|
-
export type PopperArrowProps =
|
|
914
|
-
|
|
915
|
-
export const PopperArrowFrame = styled(YStack, {
|
|
916
|
-
name: 'PopperArrow',
|
|
855
|
+
export type PopperArrowProps = ViewProps & PopperArrowExtraProps
|
|
917
856
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
borderColor: '$borderColor',
|
|
922
|
-
backgroundColor: '$background',
|
|
923
|
-
position: 'relative',
|
|
924
|
-
},
|
|
925
|
-
},
|
|
926
|
-
} as const,
|
|
927
|
-
|
|
928
|
-
defaultVariants: {
|
|
929
|
-
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
930
|
-
},
|
|
857
|
+
export const PopperArrowFrame = styled(TamaguiView, {
|
|
858
|
+
displayName: 'PopperArrow',
|
|
859
|
+
position: 'relative',
|
|
931
860
|
})
|
|
932
861
|
|
|
933
|
-
const PopperArrowOuterFrame = styled(
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
pointerEvents: 'none',
|
|
942
|
-
overflow: 'hidden',
|
|
943
|
-
alignItems: 'center',
|
|
944
|
-
justifyContent: 'center',
|
|
945
|
-
},
|
|
946
|
-
},
|
|
947
|
-
} as const,
|
|
948
|
-
|
|
949
|
-
defaultVariants: {
|
|
950
|
-
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
951
|
-
},
|
|
862
|
+
const PopperArrowOuterFrame = styled(TamaguiView, {
|
|
863
|
+
displayName: 'PopperArrowOuter',
|
|
864
|
+
position: 'absolute',
|
|
865
|
+
zIndex: 1_000_000,
|
|
866
|
+
pointerEvents: 'none',
|
|
867
|
+
overflow: 'hidden',
|
|
868
|
+
alignItems: 'center',
|
|
869
|
+
justifyContent: 'center',
|
|
952
870
|
})
|
|
953
871
|
|
|
954
872
|
const opposites = {
|
|
@@ -960,7 +878,7 @@ const opposites = {
|
|
|
960
878
|
|
|
961
879
|
type Sides = keyof typeof opposites
|
|
962
880
|
|
|
963
|
-
export const PopperArrow =
|
|
881
|
+
export const PopperArrow = createRefComponent<TamaguiElement, PopperArrowProps>(
|
|
964
882
|
function PopperArrow(propsIn, forwardedRef) {
|
|
965
883
|
// see PopperContent for why we detect controlled animatePosition before destructuring
|
|
966
884
|
const isAnimatePosControlled = 'animatePosition' in propsIn
|
|
@@ -973,12 +891,8 @@ export const PopperArrow = React.forwardRef<TamaguiElement, PopperArrowProps>(
|
|
|
973
891
|
const sizeVal =
|
|
974
892
|
typeof sizeProp === 'number'
|
|
975
893
|
? sizeProp
|
|
976
|
-
: getVariableValue(
|
|
977
|
-
|
|
978
|
-
shift: -2,
|
|
979
|
-
bounds: [2],
|
|
980
|
-
})
|
|
981
|
-
)
|
|
894
|
+
: (getVariableValue(getSize(sizeProp ?? context.size ?? true)) as number) * 0.52 -
|
|
895
|
+
11.5
|
|
982
896
|
|
|
983
897
|
const size = Math.max(0, +sizeVal)
|
|
984
898
|
|
|
@@ -1029,8 +943,9 @@ export const PopperArrow = React.forwardRef<TamaguiElement, PopperArrowProps>(
|
|
|
1029
943
|
{...arrowStyle}
|
|
1030
944
|
{...(!arrowPositioned && { opacity: 0 })}
|
|
1031
945
|
{...(isAnimatePosControlled && {
|
|
1032
|
-
|
|
1033
|
-
|
|
946
|
+
// the arrow only ever moves, so its transition names `transform` and
|
|
947
|
+
// nothing else: `left`/`top` have to jump with the popper, not trail it
|
|
948
|
+
transition: animatePosition ? { transform: transition } : 'none',
|
|
1034
949
|
animatePresence: false,
|
|
1035
950
|
})}
|
|
1036
951
|
>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
|
+
import { startTransition } from '@tamagui/start-transition'
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Keyboard, useWindowDimensions } from 'react-native'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Native has no autoupdate, so the floating position is recomputed by hand
|
|
8
|
+
* whenever the two things that invalidate it change: the window (orientation,
|
|
9
|
+
* scale) and the soft keyboard.
|
|
10
|
+
*/
|
|
11
|
+
export const useRepositionOnNative = (
|
|
12
|
+
update: () => void,
|
|
13
|
+
passThrough: boolean | undefined
|
|
14
|
+
) => {
|
|
15
|
+
const dimensions = useWindowDimensions()
|
|
16
|
+
|
|
17
|
+
const [keyboardOpen, setKeyboardOpen] = React.useState(false)
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
const showSubscription = Keyboard.addListener('keyboardDidShow', () => {
|
|
20
|
+
startTransition(() => {
|
|
21
|
+
setKeyboardOpen(true)
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
|
|
25
|
+
startTransition(() => {
|
|
26
|
+
setKeyboardOpen(false)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
showSubscription.remove()
|
|
32
|
+
hideSubscription.remove()
|
|
33
|
+
}
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
useIsomorphicLayoutEffect(() => {
|
|
37
|
+
if (passThrough) return
|
|
38
|
+
update()
|
|
39
|
+
}, [passThrough, dimensions, keyboardOpen])
|
|
40
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web gets this for free: floating-ui's autoupdate already watches resize and
|
|
3
|
+
* scroll, so there is nothing to do here. The native sibling is the real one.
|
|
4
|
+
*/
|
|
5
|
+
export const useRepositionOnNative = (
|
|
6
|
+
_update: () => void,
|
|
7
|
+
_passThrough: boolean | undefined
|
|
8
|
+
) => {}
|
package/types/Popper.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { SizeTokens, TamaguiElement } from '@tamagui/core';
|
|
1
|
+
import type { SizeTokens, TamaguiElement, ViewProps } from '@tamagui/core';
|
|
2
2
|
import type { PopupTriggerMap } from '@tamagui/floating';
|
|
3
3
|
import type { Coords, OffsetOptions, Placement, SizeOptions, Strategy, UseFloatingReturn } from '@tamagui/floating';
|
|
4
4
|
import { flip, shift } from '@tamagui/floating';
|
|
5
|
-
import type { SizableStackProps, YStackProps } from '@tamagui/stacks';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
type ShiftProps = typeof shift extends (options: infer Opts) => void ? Opts : never;
|
|
8
7
|
type FlipProps = typeof flip extends (options: infer Opts) => void ? Opts : never;
|
|
@@ -22,8 +21,28 @@ export type PopperContextShared = {
|
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
23
|
export type PopperContextValue = UseFloatingReturn & PopperContextShared;
|
|
25
|
-
export declare const PopperContextFast: import("@tamagui/core").StyledContext<PopperContextValue>;
|
|
26
|
-
export declare const PopperPositionContext:
|
|
24
|
+
export declare const PopperContextFast: import("@tamagui/core").StyledContext<PopperContextValue, never>;
|
|
25
|
+
export declare const PopperPositionContext: {
|
|
26
|
+
<VariantProps extends Record<string, any>, ConsumedKeys extends Extract<keyof VariantProps, string>>(defaultValues: VariantProps, namespaceOrOptions: import("@tamagui/core").StyledContextOptions<VariantProps, ConsumedKeys> & {
|
|
27
|
+
keys: readonly ConsumedKeys[];
|
|
28
|
+
}): import("@tamagui/core").StyledContext<VariantProps, ConsumedKeys>;
|
|
29
|
+
<VariantProps extends Record<string, any>>(defaultValues: {
|
|
30
|
+
[x: string]: never;
|
|
31
|
+
[x: number]: never;
|
|
32
|
+
[x: symbol]: never;
|
|
33
|
+
}, namespaceOrOptions?: string | {
|
|
34
|
+
namespace?: string;
|
|
35
|
+
keys?: never;
|
|
36
|
+
}): import("@tamagui/core").StyledContext<VariantProps, never>;
|
|
37
|
+
<VariantProps extends Record<string, any>>(defaultValues: VariantProps & ({ [Key in Exclude<keyof VariantProps, { [Key in keyof VariantProps]-?: {} extends Pick<VariantProps, Key> ? Key : never; }[keyof VariantProps]>]: VariantProps[Key]; } & { [Key in { [Key in keyof VariantProps]-?: {} extends Pick<VariantProps, Key> ? Key : never; }[keyof VariantProps]]: VariantProps[Key] | undefined; }), namespaceOrOptions?: string | {
|
|
38
|
+
namespace?: string;
|
|
39
|
+
keys?: never;
|
|
40
|
+
}): import("@tamagui/core").StyledContext<VariantProps, Extract<keyof VariantProps, string>>;
|
|
41
|
+
<VariantProps extends Record<string, any>, ConsumedKeys extends Extract<keyof VariantProps, string>>(defaultValues: undefined, namespaceOrOptions: import("@tamagui/core").StyledContextOptions<VariantProps, ConsumedKeys> & {
|
|
42
|
+
keys: readonly ConsumedKeys[];
|
|
43
|
+
}): import("@tamagui/core").StyledContext<VariantProps, ConsumedKeys>;
|
|
44
|
+
<VariantProps extends Record<string, any> = Record<string, any>>(defaultValues?: undefined, namespaceOrOptions?: string): import("@tamagui/core").StyledContext<VariantProps, never>;
|
|
45
|
+
};
|
|
27
46
|
export declare const usePopperContext: (scope?: string) => PopperContextValue, PopperProviderFast: React.Provider<PopperContextValue> & React.ProviderExoticComponent<Partial<PopperContextValue> & {
|
|
28
47
|
children?: React.ReactNode;
|
|
29
48
|
scope?: string;
|
|
@@ -33,7 +52,7 @@ export type PopperContextSlowValue = Pick<UseFloatingReturn, 'getReferenceProps'
|
|
|
33
52
|
onLeaveReference?: () => void;
|
|
34
53
|
triggerElements?: PopupTriggerMap;
|
|
35
54
|
};
|
|
36
|
-
export declare const PopperContextSlow: import("@tamagui/core").StyledContext<PopperContextSlowValue>;
|
|
55
|
+
export declare const PopperContextSlow: import("@tamagui/core").StyledContext<PopperContextSlowValue, never>;
|
|
37
56
|
export declare const usePopperContextSlow: (scope?: string) => PopperContextSlowValue, PopperProviderSlow: React.Provider<PopperContextSlowValue> & React.ProviderExoticComponent<Partial<PopperContextSlowValue> & {
|
|
38
57
|
children?: React.ReactNode;
|
|
39
58
|
scope?: string;
|
|
@@ -41,7 +60,7 @@ export declare const usePopperContextSlow: (scope?: string) => PopperContextSlow
|
|
|
41
60
|
export declare const PopperProvider: ({ scope, children, ...context }: PopperContextValue & {
|
|
42
61
|
scope?: string;
|
|
43
62
|
children?: React.ReactNode;
|
|
44
|
-
}) =>
|
|
63
|
+
}) => React.JSX.Element;
|
|
45
64
|
export type PopperProps = {
|
|
46
65
|
/**
|
|
47
66
|
* Popper is a component used by other components to create interfaces, so scope is required
|
|
@@ -91,75 +110,27 @@ export type PopperSetupOptions = {
|
|
|
91
110
|
disableRTL?: boolean;
|
|
92
111
|
};
|
|
93
112
|
export declare function setupPopper(options?: PopperSetupOptions): void;
|
|
94
|
-
export declare function Popper(props: PopperProps):
|
|
113
|
+
export declare function Popper(props: PopperProps): React.JSX.Element;
|
|
95
114
|
export type PopperAnchorExtraProps = {
|
|
96
115
|
virtualRef?: React.RefObject<any>;
|
|
97
116
|
scope?: string;
|
|
98
117
|
};
|
|
99
|
-
export type PopperAnchorProps =
|
|
100
|
-
export declare const PopperAnchor: import("@tamagui/core").TamaguiComponent<Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {
|
|
101
|
-
|
|
102
|
-
fullscreen?: boolean | undefined;
|
|
103
|
-
}>, keyof PopperAnchorExtraProps> & PopperAnchorExtraProps, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps & PopperAnchorExtraProps, import("@tamagui/core").StackStyleBase, {
|
|
104
|
-
elevation?: number | SizeTokens | undefined;
|
|
105
|
-
fullscreen?: boolean | undefined;
|
|
106
|
-
}, import("@tamagui/core").StaticConfigPublic>;
|
|
107
|
-
export type PopperContentProps = SizableStackProps & {
|
|
118
|
+
export type PopperAnchorProps = ViewProps;
|
|
119
|
+
export declare const PopperAnchor: import("@tamagui/core").TamaguiComponent<Omit<import("@tamagui/core").GetFinalProps<import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}>, keyof PopperAnchorExtraProps> & PopperAnchorExtraProps, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps & PopperAnchorExtraProps, import("@tamagui/core").StackStyleBase, {}, {}>;
|
|
120
|
+
export type PopperContentProps = ViewProps & {
|
|
108
121
|
scope?: string;
|
|
109
122
|
/**
|
|
110
123
|
* Enable smooth animation when the content position changes (e.g., when flipping sides)
|
|
111
124
|
*/
|
|
112
125
|
animatePosition?: boolean | 'even-when-repositioning';
|
|
113
|
-
/** @deprecated Use `animatePosition` instead */
|
|
114
|
-
enableAnimationForPositionChange?: boolean | 'even-when-repositioning';
|
|
115
126
|
passThrough?: boolean;
|
|
116
127
|
};
|
|
117
|
-
export declare const PopperContentFrame: import("@tamagui/core").
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
export declare const PopperContent: React.ForwardRefExoticComponent<Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, "size" | "unstyled" | "elevation" | keyof import("@tamagui/core").StackStyleBase | "fullscreen" | "transparent" | "circular" | "elevate" | "bordered" | "chromeless"> & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & {
|
|
124
|
-
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
125
|
-
unstyled?: boolean | undefined;
|
|
126
|
-
elevation?: number | import("@tamagui/core").SizeTokens | undefined;
|
|
127
|
-
transparent?: boolean | undefined;
|
|
128
|
-
fullscreen?: boolean | undefined;
|
|
129
|
-
circular?: boolean | undefined;
|
|
130
|
-
elevate?: boolean | undefined;
|
|
131
|
-
bordered?: boolean | undefined;
|
|
132
|
-
chromeless?: boolean | "all" | undefined;
|
|
133
|
-
} & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & import("@tamagui/core").WithPseudoProps<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & {
|
|
134
|
-
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
135
|
-
unstyled?: boolean | undefined;
|
|
136
|
-
elevation?: number | import("@tamagui/core").SizeTokens | undefined;
|
|
137
|
-
transparent?: boolean | undefined;
|
|
138
|
-
fullscreen?: boolean | undefined;
|
|
139
|
-
circular?: boolean | undefined;
|
|
140
|
-
elevate?: boolean | undefined;
|
|
141
|
-
bordered?: boolean | undefined;
|
|
142
|
-
chromeless?: boolean | "all" | undefined;
|
|
143
|
-
} & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>>> & import("@tamagui/core").WithMediaProps<import("@tamagui/core").WithThemeShorthandsAndPseudos<import("@tamagui/core").StackStyleBase, {
|
|
144
|
-
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
145
|
-
unstyled?: boolean | undefined;
|
|
146
|
-
elevation?: number | import("@tamagui/core").SizeTokens | undefined;
|
|
147
|
-
transparent?: boolean | undefined;
|
|
148
|
-
fullscreen?: boolean | undefined;
|
|
149
|
-
circular?: boolean | undefined;
|
|
150
|
-
elevate?: boolean | undefined;
|
|
151
|
-
bordered?: boolean | undefined;
|
|
152
|
-
chromeless?: boolean | "all" | undefined;
|
|
153
|
-
}>> & {
|
|
154
|
-
scope?: string;
|
|
155
|
-
/**
|
|
156
|
-
* Enable smooth animation when the content position changes (e.g., when flipping sides)
|
|
157
|
-
*/
|
|
158
|
-
animatePosition?: boolean | "even-when-repositioning";
|
|
159
|
-
/** @deprecated Use `animatePosition` instead */
|
|
160
|
-
enableAnimationForPositionChange?: boolean | "even-when-repositioning";
|
|
161
|
-
passThrough?: boolean;
|
|
162
|
-
} & React.RefAttributes<TamaguiElement>>;
|
|
128
|
+
export declare const PopperContentFrame: React.FunctionComponent<Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, keyof import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithFlatVariantValues<{}> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & {
|
|
129
|
+
ref?: React.Ref<TamaguiElement> | undefined;
|
|
130
|
+
}> & import("@tamagui/core").StaticComponentObject<import("@tamagui/core").TamaDefer, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic> & Omit<import("@tamagui/core").StaticConfigPublic, "staticConfig"> & {
|
|
131
|
+
__tama: [import("@tamagui/core").TamaDefer, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic];
|
|
132
|
+
};
|
|
133
|
+
export declare const PopperContent: import("@tamagui/compose-refs").RefComponent<TamaguiElement, PopperContentProps>;
|
|
163
134
|
export type PopperArrowExtraProps = {
|
|
164
135
|
offset?: number;
|
|
165
136
|
size?: SizeTokens;
|
|
@@ -169,15 +140,12 @@ export type PopperArrowExtraProps = {
|
|
|
169
140
|
*/
|
|
170
141
|
animatePosition?: boolean;
|
|
171
142
|
};
|
|
172
|
-
export type PopperArrowProps =
|
|
173
|
-
export declare const PopperArrowFrame: import("@tamagui/core").
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
export declare const PopperArrow:
|
|
179
|
-
elevation?: number | SizeTokens | undefined;
|
|
180
|
-
fullscreen?: boolean | undefined;
|
|
181
|
-
}>, keyof import("@tamagui/stacks").StackVariants> & import("@tamagui/stacks").StackVariants & PopperArrowExtraProps & React.RefAttributes<TamaguiElement>>;
|
|
143
|
+
export type PopperArrowProps = ViewProps & PopperArrowExtraProps;
|
|
144
|
+
export declare const PopperArrowFrame: React.FunctionComponent<Omit<import("@tamagui/core").RNTamaguiViewNonStyleProps, keyof import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase> & import("@tamagui/core").WithFlatVariantValues<{}> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStyleBase>> & {
|
|
145
|
+
ref?: React.Ref<TamaguiElement> | undefined;
|
|
146
|
+
}> & import("@tamagui/core").StaticComponentObject<import("@tamagui/core").TamaDefer, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic> & Omit<import("@tamagui/core").StaticConfigPublic, "staticConfig"> & {
|
|
147
|
+
__tama: [import("@tamagui/core").TamaDefer, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/core").StackStyleBase, {}, import("@tamagui/core").StaticConfigPublic];
|
|
148
|
+
};
|
|
149
|
+
export declare const PopperArrow: import("@tamagui/compose-refs").RefComponent<TamaguiElement, PopperArrowProps>;
|
|
182
150
|
export {};
|
|
183
151
|
//# sourceMappingURL=Popper.d.ts.map
|
package/types/Popper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../src/Popper.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../src/Popper.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAW1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,EACV,MAAM,EAEN,aAAa,EACb,SAAS,EAGT,WAAW,EACX,QAAQ,EACR,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,IAAI,EAIJ,KAAK,EAGN,MAAM,mBAAmB,CAAA;AAG1B,OAAO,KAAK,K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AAA;AACD,MAAM,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAEzC,eAAO,MAAM,YAAY,2XA0FxB,CAAA;AAQD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAA;IACrD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;CAE7B,CAAA;AAEF,eAAO,MAAM,aAAa,kFAiMzB,CAAA;AAMD,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,qBAAqB,CAAA;AAEhE,eAAO,MAAM,gBAAgB;;;;CAG3B,CAAA;AAqBF,eAAO,MAAM,WAAW,gFAiGvB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web gets this for free: floating-ui's autoupdate already watches resize and
|
|
3
|
+
* scroll, so there is nothing to do here. The native sibling is the real one.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useRepositionOnNative: (_update: () => void, _passThrough: boolean | undefined) => void;
|
|
6
|
+
//# sourceMappingURL=useRepositionOnNative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRepositionOnNative.d.ts","sourceRoot":"","sources":["../src/useRepositionOnNative.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,YACvB,MAAM,IAAI,gBACL,OAAO,GAAG,SAAS,SAC5B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native has no autoupdate, so the floating position is recomputed by hand
|
|
3
|
+
* whenever the two things that invalidate it change: the window (orientation,
|
|
4
|
+
* scale) and the soft keyboard.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useRepositionOnNative: (update: () => void, passThrough: boolean | undefined) => void;
|
|
7
|
+
//# sourceMappingURL=useRepositionOnNative.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRepositionOnNative.native.d.ts","sourceRoot":"","sources":["../src/useRepositionOnNative.native.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WACxB,MAAM,IAAI,eACL,OAAO,GAAG,SAAS,SA2BjC,CAAA"}
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/jsx/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/dist/jsx/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|