@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
29 lines (28 loc) • 1.13 kB
TypeScript
import { Dispatch } from "react";
import { ComponentType } from "../../../state/context/context";
import { Action } from "./reducer";
import { InitialTextInputState, TextInputState } from "./state";
export type InputHookOptions = {
initialState?: InitialTextInputState;
focus?: () => void;
};
/**
* getUseInputState returns a hook that creates and manages state for TextInput,
* Textarea, or CodeInput on the Airplane context
*/
export declare const getUseTextInputState: (componentType: ComponentType.TextInput | ComponentType.Textarea | ComponentType.CodeInput) => (id: string, options?: InputHookOptions) => {
state: TextInputState;
dispatch: Dispatch<Action>;
};
export declare const useTextInputState: (id: string, options?: InputHookOptions) => {
state: TextInputState;
dispatch: Dispatch<Action>;
};
export declare const useTextareaState: (id: string, options?: InputHookOptions) => {
state: TextInputState;
dispatch: Dispatch<Action>;
};
export declare const useCodeInputState: (id: string, options?: InputHookOptions) => {
state: TextInputState;
dispatch: Dispatch<Action>;
};