Installation
npm install --save @types/react-onclickoutside
Summary
This package contains type definitions for react-onclickoutside (https://github.com/Pomax/react-onclickoutside).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-onclickoutside.
import * as React from "react";
export {};
export interface HandleClickOutside<T> {
handleClickOutside: React.MouseEventHandler<T>;
}
export interface ConfigObject {
handleClickOutside?: HandleClickOutside<any>["handleClickOutside"] | undefined;
excludeScrollbar?: boolean | undefined;
}
export interface InjectedOnClickOutProps {
disableOnClickOutside(): void;
enableOnClickOutside(): void;
}
export type WithoutInjectedClickOutProps<P> = Pick<P, Exclude<keyof P, keyof InjectedOnClickOutProps>>;
export interface AdditionalProps extends ConfigObject {
disableOnClickOutside?: boolean | undefined;
eventTypes?: string | string[] | undefined;
outsideClickIgnoreClass?: string | undefined;
preventDefault?: boolean | undefined;
stopPropagation?: boolean | undefined;
}
export type ComponentConstructor<P> = React.ComponentType<P>;
export interface ClickOutComponentClass<P> extends React.ComponentClass<P> {
new(props: P, context?: any): React.Component<P, React.ComponentState> & HandleClickOutside<any>;
}
export type OnClickOutProps<P> = WithoutInjectedClickOutProps<P> & AdditionalProps;
export interface WrapperClass<P, C> {
new(): WrapperInstance<P, C>;
}
export interface WrapperInstance<P, C>
extends React.Component<OnClickOutProps<React.JSX.LibraryManagedAttributes<C, P>>>
{
getInstance(): C extends React.ComponentClass<any> ? InstanceType<C> : never;
}
type PropsOf<T> = T extends (
props: infer P,
context?: any,
) => React.ReactElement | null
? P
: T extends new(props: infer P, context?: any) => React.Component
? P
: never;
export default function OnClickOut<
C extends ComponentConstructor<P> | ClickOutComponentClass<P>,
P = PropsOf<C>,
>(component: C, config?: ConfigObject): WrapperClass<P, C>;
Additional Details
- Last updated: Mon, 26 Feb 2024 21:10:43 GMT
- Dependencies: @types/react
Credits
These definitions were written by Karol Janyst, Boris Sergeyev, and Thomas Levy.