@delightui/components 0.1.150 → 0.1.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  import { DropzoneContextType, DropzoneProps } from './Dropzone.types';
2
- declare const Dropzone: (props: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
3
- export declare const useDropzoneContext: () => DropzoneContextType;
2
+ declare const Dropzone: <T extends File | string = File>(props: DropzoneProps<T>) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const useDropzoneContext: <T extends File | string = File>() => DropzoneContextType<T>;
4
4
  export default Dropzone;
@@ -1,11 +1,12 @@
1
1
  import { DropzoneProps, DropzoneStatus } from './Dropzone.types';
2
- declare const usePresenter: (props: DropzoneProps) => {
2
+ declare const usePresenter: <T extends File | string = File>(props: DropzoneProps<T>) => {
3
3
  variantProps: {
4
4
  'component-variant': string;
5
5
  };
6
- files: File[] | undefined;
7
- getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T) => T;
8
- getInputProps: <T extends import("react-dropzone").DropzoneInputProps>(props?: T) => T;
6
+ files: T[] | undefined;
7
+ userSelectedFiles: File[] | undefined;
8
+ getRootProps: <T_1 extends import("react-dropzone").DropzoneRootProps>(props?: T_1) => T_1;
9
+ getInputProps: <T_1 extends import("react-dropzone").DropzoneInputProps>(props?: T_1) => T_1;
9
10
  open: () => void;
10
11
  empty: import("react").ReactNode;
11
12
  loading: import("react").ReactNode;
@@ -2,6 +2,7 @@ import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { ButtonProps, IconButtonProps, TextProps } from '../../atoms';
3
3
  import { ControlledFormComponentProps } from '../../molecules/FormField/FormField.types';
4
4
  export type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
5
+ export type DropzoneAcceptTypeEnum = 'File' | 'URL';
5
6
  /**
6
7
  * Dropzone component props
7
8
  * @param empty React.ReactNode - The empty state of the dropzone.
@@ -13,7 +14,7 @@ export type DropzoneStatus = 'Empty' | 'Loading' | 'Uploaded';
13
14
  * @param onFilesUpload (file: File) => void - callback when files are selected
14
15
  * @param onFilesReset () => void - callback when files are reset
15
16
  */
16
- export type DropzoneProps = ControlledFormComponentProps<File[]> & {
17
+ export type DropzoneProps<T extends File | string = File> = ControlledFormComponentProps<T[]> & {
17
18
  className?: string;
18
19
  /**
19
20
  * the view when no file is selected.
@@ -54,6 +55,18 @@ export type DropzoneProps = ControlledFormComponentProps<File[]> & {
54
55
  * callback when files are reset
55
56
  */
56
57
  onFilesReset?: () => void;
58
+ /**
59
+ * Callback when files are changed for dropzone
60
+ * @param Files updated selected files by user
61
+ * @returns {void}
62
+ */
63
+ handleFilesChange?: (Files: File[]) => void;
64
+ /**
65
+ * specifies what the component needs to accept as value
66
+ * sync this with Dropzone generics
67
+ * @default 'File'
68
+ */
69
+ type?: 'File' | 'URL';
57
70
  };
58
71
  /**
59
72
  * Dropzone context type
@@ -62,7 +75,7 @@ export type DropzoneProps = ControlledFormComponentProps<File[]> & {
62
75
  * @param selectFile () => void - The function to call when the file is selected.
63
76
  * @param resetUpload () => void - The function to call when the file is reset.
64
77
  */
65
- export type DropzoneContextType = {
78
+ export type DropzoneContextType<T extends File | string = File> = {
66
79
  /**
67
80
  * The status of the dropzone.
68
81
  */
@@ -81,6 +94,7 @@ export type DropzoneContextType = {
81
94
  accept: {
82
95
  [key: string]: readonly string[];
83
96
  };
97
+ value?: T[];
84
98
  /**
85
99
  * The function to call to open the file dialog.
86
100
  */
@@ -0,0 +1,2 @@
1
+ declare const DropzoneFormExample: () => import("react/jsx-runtime").JSX.Element;
2
+ export default DropzoneFormExample;