@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
56 lines (55 loc) • 2.71 kB
TypeScript
import { Placement, Strategy } from "../node_modules/@floating-ui/utils/dist/floating-ui.utils.js";
import { MiddlewareData } from "../node_modules/@floating-ui/core/dist/floating-ui.core.js";
import { ReferenceType } from "../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
import { UsePopoverProps } from "./usePopover.types.js";
//#region src/popover/usePopover.d.ts
type UsePopoverInternalProps = UsePopoverProps & {
nodeId?: string;
};
/**
* Controls the logic of positioning and managing a floating popover.
* Takes multiple configuration props that control closing, placement or behavior.
* Exposes functions used for ref callbacks on consuming components, programmatic open/close methods and properties.
*/
declare function usePopover(props?: UsePopoverInternalProps): {
close: () => void;
context: {
placement: Placement;
strategy: Strategy;
middlewareData: MiddlewareData;
isPositioned: boolean;
update: () => void;
floatingStyles: React.CSSProperties;
open: boolean;
onOpenChange: (open: boolean, event?: Event, reason?: import("@floating-ui/react").OpenChangeReason) => void;
events: import("@floating-ui/react").FloatingEvents;
dataRef: React.MutableRefObject<import("@floating-ui/react").ContextData>;
nodeId: string | undefined;
floatingId: string | undefined;
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
x: number;
y: number;
};
floatingStyles: import("react").CSSProperties;
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement>) => Record<string, unknown>;
getReferenceProps: (userProps?: React.HTMLProps<Element>) => Record<string, unknown>;
isMounted: boolean;
isOpen: boolean;
open: () => void;
popper: HTMLElement | null;
reference: HTMLElement | null;
refs: {
reference: import("react").MutableRefObject<ReferenceType | null>;
floating: React.MutableRefObject<HTMLElement | null>;
setReference: (node: ReferenceType | null) => void;
setFloating: (node: HTMLElement | null) => void;
} & import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
setPopper: ((node: HTMLElement | null) => void) & ((node: HTMLElement | null) => void);
setReference: ((node: ReferenceType | null) => void) & ((node: import("@floating-ui/react").ReferenceType | null) => void);
transitionStyles: import("react").CSSProperties;
};
type UsePopoverType = ReturnType<typeof usePopover>;
//#endregion
export { UsePopoverType, usePopover as default };
//# sourceMappingURL=usePopover.d.ts.map