UNPKG

fictoan-react

Version:

A full-featured, designer-friendly, yet performant framework with plain-English props and focus on rapid iteration.

51 lines (50 loc) 1.81 kB
import { default as React, ChangeEvent } from 'react'; import { ElementProps } from '../../Element/constants'; import { InputLabelCustomProps } from '../InputLabel/InputLabel'; export interface InputCommonProps { helpText?: string; errorText?: string; validateThis?: boolean; valid?: boolean; invalid?: boolean; } type LeftSideProps = { innerIconLeft: React.ReactNode; innerTextLeft?: never; } | { innerTextLeft: string; innerIconLeft?: never; } | { innerIconLeft?: never; innerTextLeft?: never; }; type RightSideProps = { innerIconRight: React.ReactNode; innerTextRight?: never; } | { innerTextRight: string; innerIconRight?: never; } | { innerIconRight?: never; innerTextRight?: never; }; export type NoSideElements = { innerIconLeft?: never; innerIconRight?: never; innerTextLeft?: never; innerTextRight?: never; }; export type InputSideElementProps = LeftSideProps & RightSideProps; export type InputFocusHandler = ((e: React.FocusEvent<HTMLInputElement>) => void) | (() => void); export type InputChangeHandler<T = string> = ((value: T) => void) | ((event: ChangeEvent<HTMLInputElement>) => void); export type InputChangeEvent = React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>; export type BaseInputComponentProps<K extends {}> = Omit<ElementProps<K>, "onChange"> & InputLabelCustomProps & InputCommonProps & { customLabel?: React.ReactNode; onChange?: InputChangeHandler; onValueChange?: InputChangeHandler; value?: string | number | readonly string[]; helpText?: string | JSX.Element | React.ReactNode; }; export type BaseInputComponentWithIconProps<K extends {}> = BaseInputComponentProps<K> & InputSideElementProps; export {}; //# sourceMappingURL=constants.d.ts.map