UNPKG

@ducor/hooks

Version:

A collection of useful React hooks for building modern web applications. Includes hooks for clipboard operations, window events, intervals, timeouts, and more.

28 lines (27 loc) 983 B
import { CSSProperties } from "react"; export type Side = "top" | "right" | "bottom" | "left"; export type Alignment = "start" | "center" | "end"; export type AlignedPlacement = `${Side}-${Alignment}`; export type Filter = "auto" | "static"; export type Strategy = "absolute" | "fixed"; interface UsePlacementProps { isOpen: boolean; defaultPlacement?: Side; defaultAlignment?: Alignment; filter?: Filter; strategy?: Strategy; allowedPlacements?: Side[]; allowedAlignments?: Alignment[]; } interface UsePlacementReturn { placement: Side; alignment: Alignment; strategy: Strategy; styles: CSSProperties; refs: { reference: React.RefObject<HTMLElement | null>; content: React.RefObject<HTMLElement | null>; }; } declare const usePlacement: ({ isOpen, defaultPlacement, defaultAlignment, filter, strategy, allowedPlacements, allowedAlignments, }: UsePlacementProps) => UsePlacementReturn; export default usePlacement;