import { CSSProperties, HTMLAttributes, ReactNode, ReactPortal, RefObject } from "react";
import { ComputePositionOptions, ComputePositionResult, Side } from "@necto/popper";
//#region src/hooks/types.d.ts
type ElementProps = Record;
//#endregion
//#region src/hooks/useRole/useRole.types.d.ts
type PopperRole = 'tooltip' | 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid' | 'alertdialog';
interface UseRoleOptions {
/**
* Whether the floating element is open.
*/
open: boolean;
/**
* Whether the hook is enabled.
* @default true
*/
enabled?: boolean;
/**
* The ARIA role of the floating element.
* @default 'dialog'
*/
role?: PopperRole;
}
interface UseRoleReturn {
reference: ElementProps;
floating: ElementProps;
}
//#endregion
//#region src/hooks/useRole/useRole.d.ts
/**
* Provides ARIA role props for floating elements.
* @param options - Configuration options.
* @returns Props to spread on reference and floating elements.
*/
declare function useRole(options: UseRoleOptions): UseRoleReturn;
//#endregion
//#region src/hooks/usePopper/usePopper.types.d.ts
/**
* Options for usePopper hook
*/
interface UsePopperOptions extends ComputePositionOptions {
/**
* External reference element (instead of using refs)
*/
reference?: Element | null;
/**
* External floating element (instead of using refs)
*/
floating?: HTMLElement | null;
/**
* Whether the floating element is open/visible
* When false, isPositioned will be set to false
*/
open?: boolean;
/**
* Whether to use CSS transform instead of left/top
* Transform is more performant but can affect stacking context
* @default true
*/
transform?: boolean;
/**
* Callback that runs while elements are mounted
* Can return cleanup function
* Useful for setting up observers (ResizeObserver, scroll listeners, etc.)
*/
whileElementsMounted?: (reference: Element, floating: HTMLElement, update: () => void) => undefined | (() => void);
}
/**
* Return type for usePopper hook
*/
interface UsePopperReturn extends ComputePositionResult {
/**
* Whether the position has been computed at least once
*/
isPositioned: boolean;
/**
* Update the position manually
*/
update: () => void;
/**
* Refs object
*/
refs: {
reference: React.RefObject;
floating: React.RefObject;
setReference: (node: Element | null) => void;
setFloating: (node: HTMLElement | null) => void;
};
/**
* The current elements
*/
elements: {
reference: Element | null;
floating: HTMLElement | null;
};
/**
* Ready-to-use CSS styles for the floating element
*/
floatingStyles: React.CSSProperties;
}
//#endregion
//#region src/hooks/usePopper/usePopper.d.ts
declare function usePopper(options?: UsePopperOptions): UsePopperReturn;
//#endregion
//#region src/hooks/useDismiss/useDismiss.types.d.ts
interface UseDismissOptions {
/**
* Whether the floating element is open.
*/
open: boolean;
/**
* Callback to set the open state.
*/
onOpenChange: (open: boolean) => void;
/**
* Whether the hook is enabled.
* @default true
*/
enabled?: boolean;
/**
* Whether to close on escape key.
* @default true
*/
escapeKey?: boolean;
/**
* Whether to close on outside press.
* @default true
*/
outsidePress?: boolean | ((event: MouseEvent) => boolean);
/**
* Whether to close on reference press.
* @default false
*/
referencePress?: boolean;
/**
* Whether to close when the reference element is hidden.
* @default false
*/
ancestorScroll?: boolean;
/**
* Whether to bubble the escape key event.
* @default false
*/
bubbles?: boolean | {
escapeKey?: boolean;
outsidePress?: boolean;
};
}
interface UseDismissReturn {
reference: ElementProps;
floating: ElementProps;
}
//#endregion
//#region src/hooks/useDismiss/useDismiss.d.ts
/**
* Provides dismiss interaction (outside click, escape key) for floating elements.
* @param options - Configuration options.
* @returns Props to spread on reference and floating elements.
*/
declare function useDismiss(options: UseDismissOptions): UseDismissReturn;
//#endregion
//#region src/hooks/usePopperPortal/usePopperPortal.types.d.ts
/**
* Copyright (c) Corinvo, LLC. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
interface UsePopperPortalOptions {
/**
* Custom portal ID to use.
*/
id?: string;
/**
* Whether the portal is enabled.
* @default true
*/
enabled?: boolean;
/**
* Custom root element to render the portal into.
*/
root?: HTMLElement | null;
/**
* Whether to preserve tab order for accessibility.
* @default true
*/
preserveTabOrder?: boolean;
}
interface UsePopperPortalReturn {
/**
* The portal container element.
*/
portalNode: HTMLElement | null;
/**
* Unique portal ID.
*/
portalId: string;
}
//#endregion
//#region src/hooks/usePopperPortal/usePopperPortal.d.ts
/**
* Provides portal functionality for popper elements.
* Creates a portal container DOM node and manages its lifecycle.
*
* @param options - Configuration options.
* @returns Portal node and ID.
*/
declare function usePopperPortal(options?: UsePopperPortalOptions): UsePopperPortalReturn;
//#endregion
//#region src/hooks/useInteractions/useInteractions.types.d.ts
interface InteractionReturn {
reference: ElementProps;
floating: ElementProps;
item?: ElementProps;
}
interface UseInteractionsReturn {
getReferenceProps: (userProps?: ElementProps) => ElementProps;
getFloatingProps: (userProps?: ElementProps) => ElementProps;
getItemProps: (userProps?: ElementProps) => ElementProps;
}
//#endregion
//#region src/hooks/useInteractions/useInteractions.d.ts
/**
* Merges multiple interaction hooks into unified prop getters.
* @param interactions - Array of interaction hook results.
* @returns Prop getter functions for reference, floating, and item elements.
*/
declare function useInteractions(interactions?: Array): UseInteractionsReturn;
//#endregion
//#region src/hooks/useTransitionStatus/useTransitionStatus.types.d.ts
/**
* Copyright (c) Corinvo, LLC. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
type TransitionStatus = 'unmounted' | 'initial' | 'open' | 'close';
interface UseTransitionStatusOptions {
/**
* Whether the floating element is open.
*/
open: boolean;
/**
* Duration of the transition in ms.
* @default 250
*/
duration?: number | {
open?: number;
close?: number;
};
}
interface UseTransitionStatusReturn {
/**
* Whether the element should be mounted.
*/
isMounted: boolean;
/**
* The current transition status.
*/
status: TransitionStatus;
}
//#endregion
//#region src/hooks/useTransitionStatus/useTransitionStatus.d.ts
/**
* Provides transition status for animating floating elements.
* @param options - Configuration options.
* @returns Mounted state and current transition status.
*/
declare function useTransitionStatus(options: UseTransitionStatusOptions): UseTransitionStatusReturn;
//#endregion
//#region src/hooks/useTransitionStyles/useTransitionStyles.types.d.ts
interface UseTransitionStylesOptions extends UseTransitionStatusOptions {
/**
* Initial styles when opening.
*/
initial?: CSSProperties;
/**
* Styles when open.
*/
openStyles?: CSSProperties;
/**
* Styles when closing.
*/
closeStyles?: CSSProperties;
/**
* Common styles applied to all states.
*/
common?: CSSProperties;
}
interface UseTransitionStylesReturn extends UseTransitionStatusReturn {
/**
* Styles to apply based on current status.
*/
styles: CSSProperties;
}
//#endregion
//#region src/hooks/useTransitionStyles/useTransitionStyles.d.ts
/**
* Provides transition styles for animating floating elements.
* @param options - Configuration options including style definitions.
* @returns Mounted state, status, and computed styles.
*/
declare function useTransitionStyles(options: UseTransitionStylesOptions): UseTransitionStylesReturn;
//#endregion
//#region src/components/Arrow/Arrow.types.d.ts
interface ArrowRenderProps {
placement: Side | null;
}
interface ArrowProps extends Omit, 'className' | 'style' | 'children'> {
ref?: RefObject;
children?: ReactNode | ((renderProps: ArrowRenderProps) => ReactNode);
style?: CSSProperties;
className?: string;
placement: Side | null;
/** Arrow x coordinate from arrow middleware. */
arrowX?: number;
/** Arrow y coordinate from arrow middleware. */
arrowY?: number;
/** Width of the default SVG arrow in pixels. @default 10 */
width?: number;
/** Height of the default SVG arrow in pixels. @default 5 */
height?: number;
}
//#endregion
//#region src/components/Arrow/Arrow.d.ts
/**
* The public PopperArrow component for Necto.
* Renders a positioned arrow element using coordinates from the arrow middleware.
*/
declare const Arrow: import("react").ForwardRefExoticComponent & import("react").RefAttributes>;
//#endregion
//#region src/components/Portal/Portal.types.d.ts
interface PortalProps {
/**
* Custom portal ID.
*/
id?: string;
/**
* Custom root element.
*/
root?: HTMLElement | null;
/**
* Whether to preserve tab order.
* @default true
*/
preserveTabOrder?: boolean;
/**
* Children to render in the portal.
*/
children: ReactNode;
}
//#endregion
//#region src/components/Portal/Portal.d.ts
/**
* Renders children into a portal at the end of the document body.
* Uses usePopperPortal internally to manage the portal container lifecycle.
*
* @param props - Configuration options.
* @returns Portal component or null.
*/
declare function Portal(props: PortalProps): ReactPortal | null;
declare namespace Portal {
var displayName: string;
}
//#endregion
export { Arrow, Arrow as PopperArrow, type ArrowProps, type ArrowRenderProps, type InteractionReturn, Portal as PopperPortal, Portal, type PortalProps as PopperPortalProps, type PortalProps, type PopperRole, type TransitionStatus, type UseDismissOptions, type UseDismissReturn, type UseInteractionsReturn, type UsePopperOptions, type UsePopperPortalOptions, type UsePopperPortalReturn, type UsePopperReturn, type UseRoleOptions, type UseRoleReturn, type UseTransitionStatusOptions, type UseTransitionStatusReturn, type UseTransitionStylesOptions, type UseTransitionStylesReturn, useDismiss, useInteractions, usePopper, usePopperPortal, useRole, useTransitionStatus, useTransitionStyles };
//# sourceMappingURL=index.d.cts.map