mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* feat: react hooks helper types * fix: react hooks helper test * fix: removed module declaration * fix: semicolons * fix: click function typo * fix: codeowners info * fix: export module to umd * feat: added types for useForm function * fix: linting errors * feat: react hooks helper types * fix: react hooks helper test * fix: removed module declaration * fix: semicolons * fix: click function typo * fix: codeowners info * fix: export module to umd * feat: added types for useForm function * fix: linting errors * fix: set form type
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
// Type definitions for react-hooks-helper 1.6
|
|
// Project: https://github.com/revelcw/react-hooks-helper#readme
|
|
// Definitions by: Joao Edmundo <https://github.com/jedmundo>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.8
|
|
|
|
/// <reference types="react"/>
|
|
|
|
export as namespace ReactHooksHelper;
|
|
|
|
export interface NavigationProps {
|
|
next: () => void;
|
|
previous?: () => void;
|
|
go?: (step: number | string) => void;
|
|
play?: () => void;
|
|
pause?: () => void;
|
|
}
|
|
|
|
export interface UseStepParams {
|
|
initialStep?: number;
|
|
autoAdvanceDuration?: number;
|
|
steps: string[] | number;
|
|
}
|
|
|
|
export interface UseStepResponse {
|
|
autoAdvanceDuration: number;
|
|
isPaused: boolean;
|
|
index: number;
|
|
step: number;
|
|
navigation: NavigationProps;
|
|
}
|
|
|
|
export function useStep(params: UseStepParams): UseStepResponse;
|
|
|
|
export interface FormTarget {
|
|
target: {
|
|
name: string, // object property name or Dot separated when hierarchical
|
|
value: any,
|
|
type?: string,
|
|
checked?: boolean,
|
|
};
|
|
}
|
|
|
|
export type SetForm = (event:
|
|
| React.SyntheticEvent<HTMLInputElement>
|
|
| React.ChangeEvent<HTMLInputElement>
|
|
| FormTarget
|
|
) => void;
|
|
|
|
export function useForm<T>(defaultFormConfig: T): [T, SetForm];
|