@renderlesskit/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
26 lines (25 loc) • 1.07 kB
TypeScript
import * as React from "react";
import { DisclosureActions, DisclosureInitialState, DisclosureState, DisclosureStateReturn } from "../disclosure";
export declare type DialogState = DisclosureState & {
/**
* Toggles Dialog's `modal` state.
* - Non-modal: `preventBodyScroll` doesn't work and focus is free.
* - Modal: `preventBodyScroll` is automatically enabled, focus is
* trapped within the dialog and the dialog is rendered within a `Portal`
* by default.
*/
modal: boolean;
/**
* @private
*/
disclosureRef: React.MutableRefObject<HTMLElement | null>;
};
export declare type DialogActions = DisclosureActions & {
/**
* Sets `modal`.
*/
setModal: React.Dispatch<React.SetStateAction<DialogState["modal"]>>;
};
export declare type DialogInitialState = DisclosureInitialState & Partial<Pick<DialogState, "modal">>;
export declare type DialogStateReturn = DisclosureStateReturn & DialogState & DialogActions;
export declare function useDialogState(props?: DialogInitialState): DialogStateReturn;