@veracity/vui 2.23.0 → 2.24.0-beta.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "2.23.0",
3
+ "version": "2.24.0-beta.0",
4
4
  "description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
5
5
  "module": "./dist/esm/index.js",
6
6
  "main": "./dist/cjs/index.js",
@@ -23,8 +23,9 @@ const DragAndDropBase = styled.labelBox`
23
23
  export const DragAndDrop = vui<'label', DragAndDropProps>((props, ref) => {
24
24
  const {
25
25
  accept,
26
- icon = defaultIcon,
27
26
  className,
27
+ icon = defaultIcon,
28
+ isFolderUpload,
28
29
  onFilesAdded,
29
30
  multiple = true,
30
31
  text = defaultText,
@@ -35,7 +36,10 @@ export const DragAndDrop = vui<'label', DragAndDropProps>((props, ref) => {
35
36
  const fileInput = useRef<HTMLInputElement>(null)
36
37
  const styles = useStyleConfig('DragAndDrop', props)
37
38
 
38
- const processFiles = (files: FileList): File[] => Array.from(files).map(file => file)
39
+ const processFiles = (files: FileList): File[] => {
40
+ console.log('files', files)
41
+ return Array.from(files).map(file => file)
42
+ }
39
43
 
40
44
  const handleFileInput = (e: ChangeEvent<HTMLInputElement>) => {
41
45
  e.preventDefault()
@@ -76,14 +80,15 @@ export const DragAndDrop = vui<'label', DragAndDropProps>((props, ref) => {
76
80
  {text}
77
81
  </T>
78
82
  )}
79
- <v.input
83
+ <input
80
84
  accept={accept}
81
85
  className="vui-drag-and-drop-hidden-input"
82
- display="none"
83
86
  multiple={multiple}
84
87
  onChange={handleFileInput}
85
88
  ref={fileInput}
89
+ style={{ display: 'none' }}
86
90
  type={inputType}
91
+ {...(isFolderUpload && { webkitdirectory: 'true', directory: 'true' })}
87
92
  />
88
93
  </DragAndDropBase>
89
94
  )
@@ -10,6 +10,8 @@ export type DragAndDropProps = Omit<BoxProps, 'variant'> &
10
10
  disabled?: boolean
11
11
  /** The message icon. @default `falCloudUpload` */
12
12
  icon?: IconProp
13
+ /** Allow folder upload @default `false` */
14
+ isFolderUpload?: boolean
13
15
  /** Allows to select multiple files when the drop zone is clicked.. @default `true` */
14
16
  multiple?: boolean
15
17
  /** The message text. @default `Click or drag files to this area` */