quantumai-design-system
Version:
퀀텀에이아이의 디자인 시스템
35 lines (34 loc) • 1.55 kB
TypeScript
import { InputHTMLAttributes } from 'react';
import { materialCommon } from './styles';
import { materialInputSize } from './options';
import { IconType } from '../../Base/Icon/IconsPath';
export type Purpose = 'input' | 'inputChild' | 'dropdown' | 'chip';
export type Variant = keyof typeof materialCommon;
export type Size = keyof (typeof materialInputSize)[Variant];
export interface MaterialBaseProps {
label: string;
helperText?: string;
disabled?: boolean;
className?: string;
width?: string | number;
error?: boolean;
icon?: IconType | undefined;
children?: React.ReactNode;
variant?: Variant;
size?: Size;
}
export interface MaterialInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
id?: string;
value?: string | number;
type?: 'text' | 'email' | 'password' | 'number' | 'validation';
handleChangeValue?: (callbackFn: (newValue: string | number) => void) => void;
onValue?: (value: string | number) => void;
onIsValue?: (isValue: boolean) => void;
}
export interface MaterialDropdownProps extends React.HTMLAttributes<HTMLDivElement> {
dropArrow: string;
}
export interface MaterialChipProps extends React.HTMLAttributes<HTMLDivElement> {
chipArrow: string;
}
export type MaterialProps<T extends Purpose> = (T extends 'inputChild' ? {} : MaterialBaseProps) & (T extends 'input' ? MaterialInputProps : T extends 'inputChild' ? MaterialInputProps : T extends 'dropdown' ? MaterialDropdownProps : T extends 'chip' ? MaterialChipProps : unknown);