UNPKG

@clubmed/trident-ui

Version:

Shared ClubMed React UI components

51 lines (50 loc) 1.41 kB
import { type Dispatch, type FunctionComponent, type PropsWithChildren, type RefObject } from 'react'; type TabsAction = { type: 'update'; payload: number; } | { type: 'next'; } | { type: 'previous'; } | { type: 'start'; } | { type: 'end'; }; type ControlAction<T extends HTMLElement = HTMLElement> = { type: 'register'; payload: { value: number; ref: RefObject<T>; }; } | { type: 'unregister'; payload: { value: number; }; }; interface ActiveTab { value: number; } export declare const ActiveTabContext: import("react").Context<ActiveTab>; interface TabRefs<T extends HTMLElement = HTMLElement> { refs: Map<number, RefObject<T>>; } export declare const TabRefsContext: import("react").Context<TabRefs<HTMLElement>>; interface TabControl<T extends HTMLElement = HTMLElement> { dispatch: Dispatch<TabsAction>; register: (value: Extract<ControlAction<T>, { type: 'register'; }>['payload']['value'], ref: Extract<ControlAction<T>, { type: 'register'; }>['payload']['ref']) => void; unregister: (value: number) => void; } export declare const TabControlContext: import("react").Context<TabControl<HTMLElement>>; interface ProviderProps { selected?: number; min?: number; max: number; } export declare const TabsProvider: FunctionComponent<PropsWithChildren<ProviderProps>>; export {};