@veracity/vui 2.5.0 → 2.5.1

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 +1 @@
1
- {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/dragAndDrop/dragAndDrop.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAatD,yDAAyD;AACzD,eAAO,MAAM,WAAW,2DA8DtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/dragAndDrop/dragAndDrop.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAetD,yDAAyD;AACzD,eAAO,MAAM,WAAW,2DAmEtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
@@ -45,6 +45,7 @@ const t_1 = __importDefault(require("../t"));
45
45
  const utils_1 = require("../utils");
46
46
  const defaultIcon = 'falCloudUpload';
47
47
  const defaultText = 'Click or drag files to this area';
48
+ const inputType = 'file';
48
49
  const DragAndDropBase = core_1.styled.labelBox `
49
50
  display: flex;
50
51
  min-width: 0;
@@ -63,8 +64,12 @@ exports.DragAndDrop = (0, core_1.vui)((props, ref) => {
63
64
  if (disabled)
64
65
  return undefined;
65
66
  const files = processFiles((_a = e === null || e === void 0 ? void 0 : e.currentTarget) === null || _a === void 0 ? void 0 : _a.files);
66
- if (files === null || files === void 0 ? void 0 : files.length)
67
+ if (files === null || files === void 0 ? void 0 : files.length) {
67
68
  onFilesAdded === null || onFilesAdded === void 0 ? void 0 : onFilesAdded(files);
69
+ // Reseting the input type to allow selecting the same file(s)
70
+ e.currentTarget.type = '';
71
+ e.currentTarget.type = inputType;
72
+ }
68
73
  };
69
74
  const handleDrop = (e) => {
70
75
  var _a;
@@ -79,6 +84,6 @@ exports.DragAndDrop = (0, core_1.vui)((props, ref) => {
79
84
  children || (react_1.default.createElement(t_1.default, { display: "flex" },
80
85
  react_1.default.createElement(icon_1.default, { mr: 1, name: icon }),
81
86
  text)),
82
- react_1.default.createElement(core_1.v.input, { accept: accept, className: "vui-drag-and-drop-hidden-input", display: "none", multiple: multiple, onChange: handleFileInput, ref: fileInput, type: "file" })));
87
+ react_1.default.createElement(core_1.v.input, { accept: accept, className: "vui-drag-and-drop-hidden-input", display: "none", multiple: multiple, onChange: handleFileInput, ref: fileInput, type: inputType })));
83
88
  });
84
89
  exports.default = exports.DragAndDrop;
@@ -1 +1 @@
1
- {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/dragAndDrop/dragAndDrop.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAatD,yDAAyD;AACzD,eAAO,MAAM,WAAW,2DA8DtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"dragAndDrop.d.ts","sourceRoot":"","sources":["../../../src/dragAndDrop/dragAndDrop.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAetD,yDAAyD;AACzD,eAAO,MAAM,WAAW,2DAmEtB,CAAA;AAEF,eAAe,WAAW,CAAA"}
@@ -5,6 +5,7 @@ import T from '../t';
5
5
  import { cs } from '../utils';
6
6
  const defaultIcon = 'falCloudUpload';
7
7
  const defaultText = 'Click or drag files to this area';
8
+ const inputType = 'file';
8
9
  const DragAndDropBase = styled.labelBox `
9
10
  display: flex;
10
11
  min-width: 0;
@@ -22,8 +23,12 @@ export const DragAndDrop = vui((props, ref) => {
22
23
  if (disabled)
23
24
  return undefined;
24
25
  const files = processFiles(e?.currentTarget?.files);
25
- if (files?.length)
26
+ if (files?.length) {
26
27
  onFilesAdded?.(files);
28
+ // Reseting the input type to allow selecting the same file(s)
29
+ e.currentTarget.type = '';
30
+ e.currentTarget.type = inputType;
31
+ }
27
32
  };
28
33
  const handleDrop = (e) => {
29
34
  e.preventDefault();
@@ -37,6 +42,6 @@ export const DragAndDrop = vui((props, ref) => {
37
42
  children || (React.createElement(T, { display: "flex" },
38
43
  React.createElement(Icon, { mr: 1, name: icon }),
39
44
  text)),
40
- React.createElement(v.input, { accept: accept, className: "vui-drag-and-drop-hidden-input", display: "none", multiple: multiple, onChange: handleFileInput, ref: fileInput, type: "file" })));
45
+ React.createElement(v.input, { accept: accept, className: "vui-drag-and-drop-hidden-input", display: "none", multiple: multiple, onChange: handleFileInput, ref: fileInput, type: inputType })));
41
46
  });
42
47
  export default DragAndDrop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
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",
@@ -10,6 +10,8 @@ const defaultIcon: IconProp = 'falCloudUpload'
10
10
 
11
11
  const defaultText = 'Click or drag files to this area'
12
12
 
13
+ const inputType = 'file'
14
+
13
15
  const DragAndDropBase = styled.labelBox`
14
16
  display: flex;
15
17
  min-width: 0;
@@ -39,7 +41,12 @@ export const DragAndDrop = vui<'label', DragAndDropProps>((props, ref) => {
39
41
  e.preventDefault()
40
42
  if (disabled) return undefined
41
43
  const files = processFiles(e?.currentTarget?.files as FileList)
42
- if (files?.length) onFilesAdded?.(files)
44
+ if (files?.length) {
45
+ onFilesAdded?.(files)
46
+ // Reseting the input type to allow selecting the same file(s)
47
+ e.currentTarget.type = ''
48
+ e.currentTarget.type = inputType
49
+ }
43
50
  }
44
51
 
45
52
  const handleDrop = (e: DragEvent<HTMLElement>) => {
@@ -76,7 +83,7 @@ export const DragAndDrop = vui<'label', DragAndDropProps>((props, ref) => {
76
83
  multiple={multiple}
77
84
  onChange={handleFileInput}
78
85
  ref={fileInput}
79
- type="file"
86
+ type={inputType}
80
87
  />
81
88
  </DragAndDropBase>
82
89
  )