@hanzogui/popper 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/Popper.cjs +593 -0
- package/dist/cjs/Popper.native.js +632 -0
- package/dist/cjs/Popper.native.js.map +1 -0
- package/dist/cjs/index.cjs +18 -0
- package/dist/cjs/index.native.js +21 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/esm/Popper.mjs +544 -0
- package/dist/esm/Popper.mjs.map +1 -0
- package/dist/esm/Popper.native.js +581 -0
- package/dist/esm/Popper.native.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/jsx/Popper.mjs +544 -0
- package/dist/jsx/Popper.mjs.map +1 -0
- package/dist/jsx/Popper.native.js +632 -0
- package/dist/jsx/Popper.native.js.map +1 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +21 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/package.json +58 -0
- package/src/Popper.tsx +1022 -0
- package/src/index.ts +1 -0
- package/types/Popper.d.ts +183 -0
- package/types/index.d.ts +2 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Popper'
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { SizeTokens, GuiElement } from '@gui/core';
|
|
2
|
+
import type { PopupTriggerMap } from '@gui/floating';
|
|
3
|
+
import type { Coords, OffsetOptions, Placement, SizeOptions, Strategy, UseFloatingReturn } from '@gui/floating';
|
|
4
|
+
import { flip, shift } from '@gui/floating';
|
|
5
|
+
import type { SizableStackProps, YStackProps } from '@gui/stacks';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
type ShiftProps = typeof shift extends (options: infer Opts) => void ? Opts : never;
|
|
8
|
+
type FlipProps = typeof flip extends (options: infer Opts) => void ? Opts : never;
|
|
9
|
+
export type PopperContextShared = {
|
|
10
|
+
open: boolean;
|
|
11
|
+
size?: SizeTokens;
|
|
12
|
+
hasFloating: boolean;
|
|
13
|
+
arrowStyle?: Partial<Coords> & {
|
|
14
|
+
centerOffset: number;
|
|
15
|
+
};
|
|
16
|
+
placement?: Placement;
|
|
17
|
+
arrowRef: any;
|
|
18
|
+
onArrowSize?: (val: number) => void;
|
|
19
|
+
transformOrigin?: {
|
|
20
|
+
x: string;
|
|
21
|
+
y: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type PopperContextValue = UseFloatingReturn & PopperContextShared;
|
|
25
|
+
export declare const PopperContextFast: import("@gui/core").StyledContext<PopperContextValue>;
|
|
26
|
+
export declare const PopperPositionContext: <VariantProps extends Record<string, any>>(defaultValues?: VariantProps, namespace?: string) => import("@gui/core").StyledContext<VariantProps>;
|
|
27
|
+
export declare const usePopperContext: (scope?: string) => PopperContextValue, PopperProviderFast: React.Provider<PopperContextValue> & React.ProviderExoticComponent<Partial<PopperContextValue> & {
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
scope?: string;
|
|
30
|
+
}>;
|
|
31
|
+
export type PopperContextSlowValue = Pick<UseFloatingReturn, 'getReferenceProps' | 'update' | 'refs'> & {
|
|
32
|
+
onHoverReference?: (event: any) => void;
|
|
33
|
+
onLeaveReference?: () => void;
|
|
34
|
+
triggerElements?: PopupTriggerMap;
|
|
35
|
+
};
|
|
36
|
+
export declare const PopperContextSlow: import("@gui/core").StyledContext<PopperContextSlowValue>;
|
|
37
|
+
export declare const usePopperContextSlow: (scope?: string) => PopperContextSlowValue, PopperProviderSlow: React.Provider<PopperContextSlowValue> & React.ProviderExoticComponent<Partial<PopperContextSlowValue> & {
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
scope?: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const PopperProvider: ({ scope, children, ...context }: PopperContextValue & {
|
|
42
|
+
scope?: string;
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export type PopperProps = {
|
|
46
|
+
/**
|
|
47
|
+
* Popper is a component used by other components to create interfaces, so scope is required
|
|
48
|
+
* For example Popover uses it internally and sets a default "POPOVER_SCOPE".
|
|
49
|
+
*/
|
|
50
|
+
scope?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Optional, will disable measuring updates when open is false for better performance
|
|
53
|
+
* */
|
|
54
|
+
open?: boolean;
|
|
55
|
+
size?: SizeTokens;
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Determine the preferred placement of the content in relation to the trigger
|
|
59
|
+
*/
|
|
60
|
+
placement?: Placement;
|
|
61
|
+
/**
|
|
62
|
+
* Shifts content horizontally to stay within viewport.
|
|
63
|
+
* Pass an object to override shift options (mainAxis, crossAxis, padding, etc).
|
|
64
|
+
* Defaults: { mainAxis: true, crossAxis: false, padding: 10 }
|
|
65
|
+
* @see https://floating-ui.com/docs/shift
|
|
66
|
+
*/
|
|
67
|
+
stayInFrame?: ShiftProps | boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Allows content to switch sides when space is limited.
|
|
70
|
+
* @see https://floating-ui.com/docs/flip
|
|
71
|
+
*/
|
|
72
|
+
allowFlip?: FlipProps | boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Resizes the content to fix inside the screen when space is limited
|
|
75
|
+
* @see https://floating-ui.com/docs/size
|
|
76
|
+
*/
|
|
77
|
+
resize?: boolean | Omit<SizeOptions, 'apply'>;
|
|
78
|
+
/**
|
|
79
|
+
* Choose between absolute or fixed positioning
|
|
80
|
+
*/
|
|
81
|
+
strategy?: Strategy;
|
|
82
|
+
/**
|
|
83
|
+
* Move the content away from the trigger
|
|
84
|
+
* @see https://floating-ui.com/docs/offset
|
|
85
|
+
*/
|
|
86
|
+
offset?: OffsetOptions;
|
|
87
|
+
disableRTL?: boolean;
|
|
88
|
+
passThrough?: boolean;
|
|
89
|
+
};
|
|
90
|
+
export type PopperSetupOptions = {
|
|
91
|
+
disableRTL?: boolean;
|
|
92
|
+
};
|
|
93
|
+
export declare function setupPopper(options?: PopperSetupOptions): void;
|
|
94
|
+
export declare function Popper(props: PopperProps): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export type PopperAnchorExtraProps = {
|
|
96
|
+
virtualRef?: React.RefObject<any>;
|
|
97
|
+
scope?: string;
|
|
98
|
+
};
|
|
99
|
+
export type PopperAnchorProps = YStackProps;
|
|
100
|
+
export declare const PopperAnchor: import("@gui/core").GuiComponent<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
101
|
+
elevation?: number | SizeTokens | undefined;
|
|
102
|
+
fullscreen?: boolean | undefined;
|
|
103
|
+
}>, keyof PopperAnchorExtraProps> & PopperAnchorExtraProps, GuiElement, import("@gui/core").RNGuiViewNonStyleProps & PopperAnchorExtraProps, import("@gui/core").StackStyleBase, {
|
|
104
|
+
elevation?: number | SizeTokens | undefined;
|
|
105
|
+
fullscreen?: boolean | undefined;
|
|
106
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
107
|
+
export type PopperContentProps = SizableStackProps & {
|
|
108
|
+
scope?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Enable smooth animation when the content position changes (e.g., when flipping sides)
|
|
111
|
+
*/
|
|
112
|
+
animatePosition?: boolean | 'even-when-repositioning';
|
|
113
|
+
/** @deprecated Use `animatePosition` instead */
|
|
114
|
+
enableAnimationForPositionChange?: boolean | 'even-when-repositioning';
|
|
115
|
+
passThrough?: boolean;
|
|
116
|
+
};
|
|
117
|
+
export declare const PopperContentFrame: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
118
|
+
size?: SizeTokens | undefined;
|
|
119
|
+
unstyled?: boolean | undefined;
|
|
120
|
+
elevation?: number | SizeTokens | undefined;
|
|
121
|
+
fullscreen?: boolean | undefined;
|
|
122
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
123
|
+
export declare const PopperContent: React.ForwardRefExoticComponent<Omit<import("@gui/core").RNGuiViewNonStyleProps, "size" | "unstyled" | "elevation" | keyof import("@gui/core").StackStyleBase | "fullscreen" | "transparent" | "circular" | "elevate" | "bordered" | "chromeless"> & import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & {
|
|
124
|
+
size?: import("@gui/core").SizeTokens | undefined;
|
|
125
|
+
unstyled?: boolean | undefined;
|
|
126
|
+
elevation?: number | import("@gui/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("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>> & import("@gui/core").WithPseudoProps<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase> & {
|
|
134
|
+
size?: import("@gui/core").SizeTokens | undefined;
|
|
135
|
+
unstyled?: boolean | undefined;
|
|
136
|
+
elevation?: number | import("@gui/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("@gui/core").WithShorthands<import("@gui/core").WithThemeValues<import("@gui/core").StackStyleBase>>> & import("@gui/core").WithMediaProps<import("@gui/core").WithThemeShorthandsAndPseudos<import("@gui/core").StackStyleBase, {
|
|
144
|
+
size?: import("@gui/core").SizeTokens | undefined;
|
|
145
|
+
unstyled?: boolean | undefined;
|
|
146
|
+
elevation?: number | import("@gui/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<GuiElement>>;
|
|
163
|
+
export type PopperArrowExtraProps = {
|
|
164
|
+
offset?: number;
|
|
165
|
+
size?: SizeTokens;
|
|
166
|
+
scope?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Enable smooth animation when the arrow position changes
|
|
169
|
+
*/
|
|
170
|
+
animatePosition?: boolean;
|
|
171
|
+
};
|
|
172
|
+
export type PopperArrowProps = YStackProps & PopperArrowExtraProps;
|
|
173
|
+
export declare const PopperArrowFrame: import("@gui/core").GuiComponent<import("@gui/core").TamaDefer, GuiElement, import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
174
|
+
unstyled?: boolean | undefined;
|
|
175
|
+
elevation?: number | SizeTokens | undefined;
|
|
176
|
+
fullscreen?: boolean | undefined;
|
|
177
|
+
}, import("@gui/core").StaticConfigPublic>;
|
|
178
|
+
export declare const PopperArrow: React.ForwardRefExoticComponent<Omit<import("@gui/core").GetFinalProps<import("@gui/core").RNGuiViewNonStyleProps, import("@gui/core").StackStyleBase, {
|
|
179
|
+
elevation?: number | SizeTokens | undefined;
|
|
180
|
+
fullscreen?: boolean | undefined;
|
|
181
|
+
}>, keyof import("@gui/stacks").StackVariants> & import("@gui/stacks").StackVariants & PopperArrowExtraProps & React.RefAttributes<GuiElement>>;
|
|
182
|
+
export {};
|
|
183
|
+
//# sourceMappingURL=Popper.d.ts.map
|
package/types/index.d.ts
ADDED