@smart-react-components/ui
Version:
SRC UI includes React and Styled components.
19 lines (18 loc) • 825 B
TypeScript
import { SetState } from '@smart-react-components/core/types';
import { ChangeEvent, FocusEvent } from 'react';
interface Props<DOMElement> {
isDisabled: boolean;
isReadOnly: boolean;
onBlur?: (e: FocusEvent<DOMElement>) => void;
onChange?: (e: ChangeEvent<DOMElement>) => void;
onFocus?: (e: FocusEvent<DOMElement>) => void;
setValue?: SetState<string>;
}
interface Return<DOMElement> {
handleOnBlur?: (e: FocusEvent<DOMElement>) => void;
handleOnChange?: (e: ChangeEvent<DOMElement>) => void;
handleOnFocus?: (e: FocusEvent<DOMElement>) => void;
isFocused: boolean;
}
export default function useInputMethods<DOMElement extends HTMLInputElement | HTMLTextAreaElement>({ isDisabled, isReadOnly, onBlur, onChange, onFocus, setValue }: Props<DOMElement>): Return<DOMElement>;
export {};