@crossed/primitive
Version:
A universal & performant styling library for React Native, Next.js & React
66 lines • 2.9 kB
TypeScript
/**
* Copyright (c) Paymium.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root of this projects source tree.
*/
import * as React from 'react';
import { Primitive } from './Primitive';
export type Orientation = React.AriaAttributes['aria-orientation'];
type Direction = 'ltr' | 'rtl';
interface RovingFocusGroupOptions {
/**
* The orientation of the group.
* Mainly so arrow navigation is done accordingly (left & right vs. up & down)
*/
orientation?: Orientation;
/**
* The direction of navigation between items.
*/
dir?: Direction;
/**
* Whether keyboard navigation should loop around
* @defaultValue false
*/
loop?: boolean;
}
type RovingContextValue = RovingFocusGroupOptions & {
currentTabStopId: string | null;
onItemFocus(_tabStopId: string): void;
onItemShiftTab(): void;
onFocusableItemAdd(): void;
onFocusableItemRemove(): void;
};
export declare const RovingFocusProvider: (props: RovingFocusGroupOptions & {
currentTabStopId: string | null;
onItemFocus(_tabStopId: string): void;
onItemShiftTab(): void;
onFocusableItemAdd(): void;
onFocusableItemRemove(): void;
} & {
children: React.ReactNode;
}) => import("react/jsx-runtime").JSX.Element, useRovingFocusContext: () => RovingContextValue;
type RovingFocusGroupProps = RovingFocusGroupImplProps;
declare const RovingFocusGroup: React.ForwardRefExoticComponent<RovingFocusGroupImplProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface RovingFocusGroupImplProps extends Omit<PrimitiveDivProps, 'dir'>, RovingFocusGroupOptions {
currentTabStopId?: string | null;
defaultCurrentTabStopId?: string;
onCurrentTabStopIdChange?: (_tabStopId: string | null) => void;
onEntryFocus?: (_event: Event) => void;
}
type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
interface RovingFocusItemProps extends PrimitiveSpanProps {
tabStopId?: string;
focusable?: boolean;
active?: boolean;
}
declare const RovingFocusGroupItem: React.ForwardRefExoticComponent<RovingFocusItemProps & React.RefAttributes<HTMLSpanElement>>;
declare const Root: React.ForwardRefExoticComponent<RovingFocusGroupImplProps & React.RefAttributes<HTMLDivElement>>;
declare const Item: React.ForwardRefExoticComponent<RovingFocusItemProps & React.RefAttributes<HTMLSpanElement>>;
export { RovingFocusGroup, RovingFocusGroupItem, Root, Item, };
export declare const RovingFocus: React.ForwardRefExoticComponent<RovingFocusGroupImplProps & React.RefAttributes<HTMLDivElement>> & {
Item: React.ForwardRefExoticComponent<RovingFocusItemProps & React.RefAttributes<HTMLSpanElement>>;
};
export type { RovingFocusGroupProps, RovingFocusItemProps };
//# sourceMappingURL=RovingFocus.d.ts.map