@wulperstudio/cms
Version:
Wulper Studio Library Components CMS
55 lines (54 loc) • 2.02 kB
TypeScript
import { ComponentPropsWithRef, ComponentPropsWithoutRef, DetailedHTMLProps, InputHTMLAttributes, MouseEvent, ReactNode } from 'react';
import { Accept } from 'react-dropzone';
import { Wrapper, WrapperElement } from './styled';
import { Omit, InputVariantType, InputErrorProps } from '../../types';
export type VariantShape = 'rounded' | 'circular' | 'float';
export type VariantSize = 'small' | 'medium' | 'large';
export interface WithoutImageLoadModel {
variant?: VariantShape;
border?: boolean;
size?: VariantSize;
}
export interface WrapperBodyModel {
size?: VariantSize;
}
export type ShapeProps = Omit<ComponentPropsWithoutRef<typeof WrapperElement>, 'border' | 'variant'>;
export interface AttachFileDropModel extends Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'accept'>, Omit<ResultProps, 'files'>, InputErrorProps {
onDropElement?: (files: File[]) => void;
onDelete?: (id: string) => void;
getActualFiles?: (files: UploadableFileModel[]) => void;
onClickShape?: (e: MouseEvent<HTMLDivElement>) => void;
name: string;
label?: string;
accept?: Accept;
variantShape: VariantShape;
shapeProps?: ShapeProps;
multiple?: boolean;
variant?: InputVariantType;
backgroundColor?: string;
helperNode?: ReactNode;
addIcon?: ReactNode;
wrapperShapeProps?: ComponentPropsWithRef<typeof Wrapper>;
}
export interface UploadableFileModel {
id: string;
file: File;
}
export interface FileModel {
id: string;
url: string;
}
export type ListIconsType = 'file' | 'document' | 'audio' | 'video';
export type ResultProps = {
multiple?: boolean;
files?: Array<UploadableFileModel>;
filesDB?: Array<FileModel>;
deleteFile?: (id: string) => void;
deleteFilesDb?: (id: string) => void;
disabled?: boolean;
variantShape?: VariantShape;
variantSize?: VariantSize;
iconSet?: ListIconsType;
customIcons?: Record<ListIconsType, string>;
shapeProps?: ShapeProps;
};