UNPKG

amotify

Version:

UI Component for React,NextJS,esbuild

116 lines (115 loc) 4.2 kB
import { KeyValueDict } from 'jmini'; import { ReactElement, StyleTags } from '../../@declares'; export declare namespace InputTypes { type BoxTone = 'border' | 'cloud' | 'bottomBorder' | 'plain'; type Type = 'hidden' | 'textfield' | 'textfield.multiline' | 'select' | 'list.radio' | 'list.checkbox' | 'autocomplete.single' | 'autocomplete.multi' | 'time' | 'switch' | 'slider' | 'file' | 'contenteditable' | 'color' | ''; type OnUpdateValue<T = any> = (value: T, eventType: Validation.EventType, componentID: string) => void; type UniInput<T = any> = { 'data-type'?: T; name?: string; form?: string; status_id?: string; componentID?: string; override?: 'force' | 'beforeModified' | 'never'; required?: boolean; enableFormSubmit?: boolean; checkValidationAtFirst?: boolean; onValidate?: Validation.OnValidate<T>; onUpdateValue?: OnUpdateValue<T>; onUpdateValidValue?: OnUpdateValue<T>; }; type CoreInput<T = any> = UniInput<T> & StyleTags.States & { className?: string; wrapStyles?: StyleTags.States; }; namespace Validation { type EventType = 'init' | 'update' | 'override' | 'refresh'; type Notice = { type: 'valid' | 'invalid' | 'warn'; label: ReactElement; }; type Result = { ok: boolean; notice: Notice[]; }; type System = (props: { value: any; states: any; }) => Result; type OnValidate<T = any> = (value: T, eventType: EventType, props: KeyValueDict) => Promise<Result>; } namespace Status { type Plain<T = any> = { componentID: string; dataValue: T; eventType: Validation.EventType; eventID: string; }; type Text = Plain & { formatValue: any; prevValue: any; caretFrom: number; caretTo: number; }; type DigitCharacters = Plain & { formatValue: any; }; type Time = Plain & { formatValue: any; ranges: _Time.Range[]; }; type Slider = Plain & { min: number; max: number; step: number; }; } } import * as _Parts from './Parts'; export * from './Parts'; import _Plain from './Plain'; import _Hidden from './Hidden'; import _TextField from './TextField'; import _Contenteditable from './Contenteditable'; import _DigitCharacters from './DigitCharacters'; import _Time from './Time'; import _Select from './Select'; import _Autocomplete from './Autocomplete'; import * as _List from './List'; import _Search from './Search'; import _Filer from './Filer'; import _Slider from './Slider'; import _Switch from './Switch'; import _Checker from './Checker'; import _Segmented from './Segmented'; import _Color from './Color'; import _CollectForm from './CollectForm'; declare namespace Input { export import Plain = _Plain; export import Hidden = _Hidden; export import TextField = _TextField; export import Contenteditable = _Contenteditable; export import DigitCharacters = _DigitCharacters; export import Time = _Time; export import Select = _Select; export import Autocomplete = _Autocomplete; export import List = _List.List; export import Radio = _List.Radio; export import Checkbox = _List.Checkbox; export import Checker = _Checker; export import Search = _Search; export import Filer = _Filer; export import Slider = _Slider; export import Switch = _Switch; export import Segmented = _Segmented; export import Color = _Color; export import LeftIcon = _Parts.LeftIcon; export import RightIcon = _Parts.RightIcon; export import LeftIndicator = _Parts.LeftIndicator; export import RightIndicator = _Parts.RightIndicator; export import RequiredSign = _Parts.RequiredSign; export import RequiredShortSign = _Parts.RequiredShortSign; export import OmitSign = _Parts.OmitSign; export import CollectForm = _CollectForm; } export { Input, Input as default };