UNPKG

@kopexa/sight

Version:

Kopexa Sight Design System — React component library for GRC applications

55 lines (52 loc) 1.78 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { AvatarUploadVariants } from '@kopexa/theme'; import { ComponentProps } from 'react'; import { FileWithPreview } from '../../hooks/use-file-upload/index.mjs'; interface AvatarUploadBaseProps { /** * Maximum allowed file size in bytes. * @default 2MB. */ maxSize?: number; /** * Additional CSS class names applied to the root element. */ className?: string; /** * Callback fired when the selected file changes (after upload or removal). * Provides the FileWithPreview object or null if cleared. */ onFileChange?: (file: FileWithPreview | null) => void; /** * URL for a default/fallback avatar image shown when no file is uploaded. */ defaultAvatar?: string; /** * Accepted file types for the upload input (e.g. ".png,.jpg"). * @default ".png,.jpg" */ accept?: string; /** * Enables the image crop dialog if the selected file is an image. * @default true */ cropperEnabled?: boolean; /** * Aspect ratio for the ImageCrop component (e.g. 1 for square cropping). * @default 1 */ cropAspect?: number; /** * Maximum image size forwarded to the ImageCrop component (in bytes). * Defaults to the same as maxSize (2MB). */ cropMaxImageSize?: number; /** * Callback fired after cropping is completed. * Provides the newly created cropped File object. */ onCroppedFile?: (file: File) => void; } type AvatarUploadProps = ComponentProps<"div"> & AvatarUploadVariants & AvatarUploadBaseProps; declare const AvatarUpload: (props: AvatarUploadProps) => react_jsx_runtime.JSX.Element; export { AvatarUpload, type AvatarUploadProps };