@clayui/shared
Version:
ClayShared component
32 lines (31 loc) • 1.23 kB
TypeScript
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
import React, { Children } from 'react';
import { useFocusManagement } from './useFocusManagement';
declare type Children = React.ReactElement & {
ref?: React.MutableRefObject<HTMLElement> | ((ref: HTMLElement | null) => void);
};
declare type ChildrenFunction = Children | ((focusManager: ReturnType<typeof useFocusManagement>) => Children);
declare type Props = {
/**
* Flag indicates whether the focus will also be controlled with the right
* and left arrow keys.
*/
arrowKeysLeftRight?: boolean;
/**
* Flag that indicates if the focus will be controlled by the arrow keys.
* Disabling means that it will still be controlled by tab and shift + tab.
*/
arrowKeysUpDown?: boolean;
children: ChildrenFunction;
onFocus?: (element: HTMLElement) => void;
};
/**
* FocusScope is a component only for controlling focus and listening
* for children's key down events, since the component handles the `onKeyDown`
* event.
*/
export declare const FocusScope: ({ arrowKeysLeftRight, arrowKeysUpDown, children, onFocus, }: Props) => JSX.Element;
export {};