@gechiui/compose
Version:
GeChiUI higher-order components (HOCs).
54 lines • 1.67 kB
TypeScript
export default useDialog;
export type DialogOptions = {
/**
* Focus on mount arguments.
*/
focusOnMount: Parameters<typeof useFocusOnMount>[0];
/**
* Function to call when the dialog is closed.
*/
onClose: () => void;
};
/**
* @typedef DialogOptions
* @property {Parameters<useFocusOnMount>[0]} focusOnMount Focus on mount arguments.
* @property {() => void} onClose Function to call when the dialog is closed.
*/
/**
* Returns a ref and props to apply to a dialog wrapper to enable the following behaviors:
* - constrained tabbing.
* - focus on mount.
* - return focus on unmount.
* - focus outside.
*
* @param {DialogOptions} options Dialog Options.
*/
declare function useDialog(options: DialogOptions): (((instance: unknown) => void) | {
tabIndex: string;
/**
* An event handler for focus events.
*/
onFocus: import("../use-focus-outside").EventCallback;
/**
* An event handler for blur events.
*/
onBlur: import("../use-focus-outside").EventCallback;
/**
* An event handler for mouse down events.
*/
onMouseDown: import("../use-focus-outside").EventCallback;
/**
* An event handler for mouse up events.
*/
onMouseUp: import("../use-focus-outside").EventCallback;
/**
* An event handler for touch start events.
*/
onTouchStart: import("../use-focus-outside").EventCallback;
/**
* An event handler for touch end events.
*/
onTouchEnd: import("../use-focus-outside").EventCallback;
})[];
import useFocusOnMount from "../use-focus-on-mount";
//# sourceMappingURL=index.d.ts.map