UNPKG

amotify

Version:

UI Component for React,NextJS,esbuild

94 lines (93 loc) 3.6 kB
/// <reference types="react" /> import { StyleTags, ReactElement } from '../../@declares'; import { KeyValueDict } from 'jmini'; import { InputTypes } from '.'; declare namespace List { type Type = 'radio' | 'checkbox'; type IconType = Type; type Tone = 'normal' | 'border' | 'cloud' | 'plain'; type Size = 'small' | 'regular' | 'large'; type Input<T = Value, O = T> = InputTypes.CoreInput<O> & { type?: Type; tone?: Tone; icon?: boolean; iconType?: IconType; iconSize?: Size; iconPosition?: 'left' | 'right'; iconColor?: StyleTags.BackgroundColor; isChecker?: boolean; CustomIcon?: React.FC<CustomIconInput>; tabIndex?: number; id?: string; min?: number; max?: number; disabled?: boolean; value?: T | T[]; options: Option<T>[]; hideInput?: boolean; cellStyles?: StyleTags.PropsNFreeCSS; cellClassName?: string; cellCheckedStyles?: StyleTags.PropsNFreeCSS; cellCheckedClassName?: string; }; type CoreInput = Input & { type: Type; tone: Tone; }; type Value<T = any> = T extends infer V ? V : string | number | boolean | KeyValueDict | void | null; type Option<T = Value> = { value: T; label?: ReactElement; disabled?: boolean; className?: string; checkedStyles?: StyleTags.PropsNFreeCSS; checkedClassName?: string; } & StyleTags.States; type CustomIconInput = { isChecked: boolean; iconSize: Size; iconColor: StyleTags.BackgroundColor; toggle: () => void; }; type CoreStates = { rootStates: CoreInput; val_status: InputTypes.Status.Plain; set_status: React.Dispatch<React.SetStateAction<InputTypes.Status.Plain>>; }; } declare namespace Radio { type Input<T = List.Value> = List.Input<T>; namespace Methods { type Component = { <T = List.Value>(p: List.Input<List.Value<T>>): JSX.Element; }; type FNs = { Normal: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element; Border: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element; Cloud: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element; Simple: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element; Vivid: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element; }; } type Methods = Methods.Component & Methods.FNs; } declare namespace Checkbox { type Input<T = List.Value, O = T[]> = List.Input<T, O>; namespace Methods { type Component = { <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>): JSX.Element; }; type FNs = { Normal: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element; Border: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element; Cloud: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element; Simple: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element; Vivid: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element; }; } type Methods = Methods.Component & Methods.FNs; } declare const Radio: Radio.Methods; declare const Checkbox: Checkbox.Methods; declare const List: Radio.Methods; export { List, Checkbox, Radio };