@jigoooo/shared-ui
Version:
A reusable React component library and design system with TypeScript support, built on Vite for seamless integration and optimized performance.
51 lines (50 loc) • 1.44 kB
TypeScript
import { RefObject } from 'react';
interface UseFocusTrapOptions {
/**
* 포커스 트랩이 활성화될지 여부
*/
enabled: boolean;
/**
* 포커스 트랩 컨테이너 요소의 ref
*/
containerRef: RefObject<HTMLElement | null>;
/**
* 포커스 트랩이 비활성화될 때 포커스를 복원할 요소
*/
restoreFocus?: boolean;
/**
* 초기 포커스를 설정할 요소의 인덱스 또는 ref
*/
initialFocus?: number | RefObject<HTMLElement>;
/**
* 포커스 트랩 활성화 지연 시간 (ms)
*/
activationDelay?: number;
/**
* 포커스 복원 지연 시간 (ms)
*/
restorationDelay?: number;
/**
* 모달 관련 요소를 식별하는 추가 셀렉터
*/
modalSelectors?: string[];
}
export declare function useFocusTrap({ enabled, containerRef, restoreFocus, initialFocus, activationDelay, restorationDelay, modalSelectors, }: UseFocusTrapOptions): {
/**
* 특정 요소에 포커스 설정
*/
focusElement: (target?: number | RefObject<HTMLElement>) => void;
/**
* 포커스 트랩이 현재 활성화되어 있는지 여부
*/
isActive: boolean;
/**
* 수동으로 외부 요소 비활성화
*/
disableOutsideElements: () => void;
/**
* 수동으로 외부 요소 활성화
*/
enableOutsideElements: () => void;
};
export {};