@toptal/picasso-dropzone 5.0.24-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10 → 5.0.24-alpha-1757603192867.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,15 +1,16 @@
1
1
  {
2
2
  "name": "@toptal/picasso-dropzone",
3
- "version": "5.0.24-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
3
+ "version": "5.0.24-alpha-1757603192867.0",
4
4
  "description": "Toptal UI components library - Dropzone",
5
5
  "publishConfig": {
6
- "access": "public"
6
+ "access": "public",
7
+ "provenance": true
7
8
  },
8
9
  "main": "./dist-package/src/index.js",
9
10
  "module": "./dist-package/src/index.js",
10
11
  "scripts": {
11
12
  "build:package": "tsc -b tsconfig.json",
12
- "prepublishOnly": "yarn build:package"
13
+ "prepublishOnly": "echo 0"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -22,12 +23,12 @@
22
23
  },
23
24
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
25
  "dependencies": {
25
- "@toptal/picasso-container": "3.1.3-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
26
- "@toptal/picasso-file-input": "4.0.23-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
27
- "@toptal/picasso-form": "6.3.3-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
28
- "@toptal/picasso-icons": "1.12.2-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
29
- "@toptal/picasso-typography": "4.0.5-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
30
- "@toptal/picasso-utils": "3.1.1-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
26
+ "@toptal/picasso-container": "3.1.3-alpha-1757603192867.0",
27
+ "@toptal/picasso-file-input": "4.0.23-alpha-1757603192867.0",
28
+ "@toptal/picasso-form": "6.3.3-alpha-1757603192867.0",
29
+ "@toptal/picasso-icons": "1.12.2-alpha-1757603192867.0",
30
+ "@toptal/picasso-typography": "4.0.5-alpha-1757603192867.0",
31
+ "@toptal/picasso-utils": "3.1.1-alpha-1757603192867.0",
31
32
  "classnames": "^2.5.1",
32
33
  "react-dropzone": "^14.2.3"
33
34
  },
@@ -36,20 +37,19 @@
36
37
  "**/styles.js"
37
38
  ],
38
39
  "peerDependencies": {
39
- "@toptal/picasso-tailwind": ">=2.7",
40
- "@toptal/picasso-tailwind-merge": "^2.0.0",
40
+ "@toptal/picasso-tailwind-merge": "^2.0.4-alpha-1757603192867.0",
41
+ "@toptal/picasso-tailwind": "3.0.1-alpha-1757603192867.0",
41
42
  "react": ">=16.12.0 < 19.0.0"
42
43
  },
43
44
  "exports": {
44
45
  ".": "./dist-package/src/index.js"
45
46
  },
46
47
  "devDependencies": {
47
- "@toptal/picasso-test-utils": "1.1.2-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.377+7db07b500"
48
+ "@toptal/picasso-test-utils": "1.1.2-alpha-1757603192867.0"
48
49
  },
49
50
  "files": [
50
51
  "dist-package/**",
51
52
  "!dist-package/tsconfig.tsbuildinfo",
52
53
  "src"
53
- ],
54
- "gitHead": "7db07b500402a91f0c09da3be294305a194fd1e4"
54
+ ]
55
55
  }
@@ -91,13 +91,7 @@ const getBackgroundColorClasses: StateToClassMatcher = ({ isDisabled }) =>
91
91
  isDisabled ? 'bg-gray-200' : 'bg-white'
92
92
 
93
93
  export const Dropzone = forwardRef<HTMLInputElement, Props>(function Dropzone(
94
- {
95
- disabled = false,
96
- maxSize = Infinity,
97
- minSize = 0,
98
- multiple = true,
99
- ...props
100
- },
94
+ props,
101
95
  ref
102
96
  ) {
103
97
  const {
@@ -113,6 +107,10 @@ export const Dropzone = forwardRef<HTMLInputElement, Props>(function Dropzone(
113
107
 
114
108
  // dropzoneOptions
115
109
  accept,
110
+ minSize,
111
+ maxSize,
112
+ multiple,
113
+ disabled,
116
114
  onDrop,
117
115
  onDropAccepted,
118
116
  onDropRejected,
@@ -198,4 +196,11 @@ export const Dropzone = forwardRef<HTMLInputElement, Props>(function Dropzone(
198
196
 
199
197
  Dropzone.displayName = 'Dropzone'
200
198
 
199
+ Dropzone.defaultProps = {
200
+ disabled: false,
201
+ maxSize: Infinity,
202
+ minSize: 0,
203
+ multiple: true,
204
+ }
205
+
201
206
  export default Dropzone
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2022 Toptal, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import type { BaseProps } from '@toptal/picasso-shared';
3
- import type { FileUpload, DropzoneOptions } from './types';
4
- export interface Props extends BaseProps {
5
- /**
6
- * Set accepted file types. See https://github.com/okonet/attr-accept for more information.
7
- */
8
- accept?: DropzoneOptions['accept'];
9
- /** Enable/disable the dropzone */
10
- disabled?: boolean;
11
- /** Maximum file size (in bytes) */
12
- maxSize?: number;
13
- /** Minimum file size (in bytes) */
14
- minSize?: number;
15
- /** Allow drag 'n' drop (or selection from the file dialog) of multiple files */
16
- multiple?: boolean;
17
- /** The text of the hint */
18
- hint?: string;
19
- /** Hide/Show the content text */
20
- hideContentText?: boolean;
21
- /** Callback invoked when a file item is removed */
22
- onRemove?: (fileName: string, index: number) => void;
23
- /** Callback for when the drop event occurs */
24
- onDropAccepted?: DropzoneOptions['onDropAccepted'];
25
- /** callback for when the drop event occurs */
26
- onDropRejected?: DropzoneOptions['onDropRejected'];
27
- /** callback for when the drop event occurs */
28
- onDrop?: DropzoneOptions['onDrop'];
29
- /** Custom validation function */
30
- validator?: DropzoneOptions['validator'];
31
- /** Value uses the File interface. */
32
- value?: FileUpload[];
33
- focused?: boolean;
34
- hovered?: boolean;
35
- }
36
- export declare const Dropzone: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
37
- export default Dropzone;
38
- //# sourceMappingURL=Dropzone.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dropzone.d.ts","sourceRoot":"","sources":["../../../src/Dropzone/Dropzone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAGlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAQvD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE1D,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;IAClC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iCAAiC;IACjC,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,8CAA8C;IAC9C,cAAc,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAClD,8CAA8C;IAC9C,cAAc,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IAClD,8CAA8C;IAC9C,MAAM,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;IAClC,iCAAiC;IACjC,SAAS,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAA;IACxC,qCAAqC;IACrC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAgDD,eAAO,MAAM,QAAQ,gFAwGnB,CAAA;AAIF,eAAe,QAAQ,CAAA"}
@@ -1,74 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { forwardRef, useMemo } from 'react';
13
- import { useDropzone } from 'react-dropzone';
14
- import { twJoin } from '@toptal/picasso-tailwind-merge';
15
- import { Upload24 } from '@toptal/picasso-icons';
16
- import { FormHint } from '@toptal/picasso-form';
17
- import { Container } from '@toptal/picasso-container';
18
- import { FileList } from '@toptal/picasso-file-input';
19
- import { Typography } from '@toptal/picasso-typography';
20
- import { SPACING_6 } from '@toptal/picasso-utils';
21
- const getCursorClasses = ({ isDisabled, isHovered, isFocused, isDragActive, }) => {
22
- if (isDisabled) {
23
- return 'cursor-not-allowed';
24
- }
25
- if (isHovered || isFocused || isDragActive) {
26
- return 'cursor-pointer';
27
- }
28
- return 'hover:cursor-pointer focus:cursor-pointer';
29
- };
30
- const getBorderColorClasses = ({ isDisabled, isHovered, isFocused, isDragActive, }) => {
31
- if (isDisabled) {
32
- return 'border-gray-400 hover:border-gray-400';
33
- }
34
- if (isHovered || isFocused || isDragActive) {
35
- return 'border-blue-500';
36
- }
37
- return 'border-gray-400 hover:border-blue-500 focus:border-blue-500';
38
- };
39
- const getBackgroundColorClasses = ({ isDisabled }) => isDisabled ? 'bg-gray-200' : 'bg-white';
40
- export const Dropzone = forwardRef(function Dropzone(_a, ref) {
41
- var { disabled = false, maxSize = Infinity, minSize = 0, multiple = true } = _a, props = __rest(_a, ["disabled", "maxSize", "minSize", "multiple"]);
42
- const { hint, hideContentText, onRemove, value, className, style, 'data-testid': dataTestId, focused: isFocused, hovered: isHovered,
43
- // dropzoneOptions
44
- accept, onDrop, onDropAccepted, onDropRejected, validator, } = props;
45
- const isDisabled = Boolean(disabled || (!multiple && value && value.length > 0));
46
- const { getRootProps, isDragActive, getInputProps } = useDropzone({
47
- accept,
48
- minSize,
49
- maxSize,
50
- multiple,
51
- disabled: isDisabled,
52
- onDrop,
53
- onDropAccepted,
54
- onDropRejected,
55
- validator,
56
- });
57
- const componentState = useMemo(() => ({
58
- isDisabled,
59
- isHovered,
60
- isFocused,
61
- isDragActive,
62
- }), [isDisabled, isHovered, isFocused, isDragActive]);
63
- return (React.createElement(Container, { style: style, ref: ref, className: className },
64
- React.createElement(Container, Object.assign({ flex: true, direction: 'column', alignItems: 'center', rounded: true, "aria-disabled": isDisabled, padded: SPACING_6, "data-testid": dataTestId }, getRootProps({}), { className: twJoin('border border-dashed', 'box-border', 'gap-2', 'transition-all ease-out duration-350', getCursorClasses(componentState), getBorderColorClasses(componentState), getBackgroundColorClasses(componentState), isDisabled && 'hover:no-drop') }),
65
- React.createElement("input", Object.assign({}, getInputProps())),
66
- React.createElement(Upload24, { color: 'darkGrey' }),
67
- !hideContentText && (React.createElement(Typography, { size: 'medium', color: isDisabled ? 'grey-main-2' : 'black', weight: 'semibold' }, "Click or drag to upload")),
68
- hint && (React.createElement(FormHint, { className: twJoin('m-0', '[&>*]:leading-4'), disabled: isDisabled }, hint))),
69
- value && value.length > 0 && (React.createElement(Container, { top: 'xsmall' },
70
- React.createElement(FileList, { files: value, onItemRemove: onRemove })))));
71
- });
72
- Dropzone.displayName = 'Dropzone';
73
- export default Dropzone;
74
- //# sourceMappingURL=Dropzone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/Dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AA8CjD,MAAM,gBAAgB,GAAwB,CAAC,EAC7C,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,GACb,EAAE,EAAE;IACH,IAAI,UAAU,EAAE;QACd,OAAO,oBAAoB,CAAA;KAC5B;IAED,IAAI,SAAS,IAAI,SAAS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AC,QAAQ;YACrB,oBAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,GAAI,CACxC,CACb,CACS,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAA;AAEjC,eAAe,QAAQ,CAAA"}
@@ -1,6 +0,0 @@
1
- import type { OmitInternalProps } from '@toptal/picasso-shared';
2
- import type { Props } from './Dropzone';
3
- export { default as Dropzone } from './Dropzone';
4
- export * from './types';
5
- export declare type DropzoneProps = OmitInternalProps<Props>;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Dropzone/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,cAAc,SAAS,CAAA;AAEvB,oBAAY,aAAa,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- export { default as Dropzone } from './Dropzone';
2
- export * from './types';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Dropzone/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAChD,cAAc,SAAS,CAAA"}
@@ -1,47 +0,0 @@
1
- /// <reference types="react" />
2
- export interface FileUpload {
3
- uploading?: boolean;
4
- progress?: number;
5
- error?: string;
6
- file: File;
7
- }
8
- export declare type DropzoneOptions = {
9
- /**
10
- * Set accepted file types. See https://github.com/okonet/attr-accept for more information.
11
- */
12
- accept?: {
13
- [key: string]: string[];
14
- };
15
- /** Enable/disable the dropzone */
16
- disabled?: boolean;
17
- /** Maximum file size (in bytes) */
18
- maxSize?: number;
19
- /** Minimum file size (in bytes) */
20
- minSize?: number;
21
- /** Callback for when the drop event occurs */
22
- onDrop?: <T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void;
23
- /** Callback for when the drop event occurs */
24
- onDropAccepted?: <T extends File>(files: T[], event: DropEvent) => void;
25
- /** Callback for when the drop event occurs */
26
- onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;
27
- /** Custom validation function */
28
- validator?: <T extends File>(file: T) => FileError | FileError[] | null;
29
- };
30
- export declare type DropEvent = React.DragEvent<HTMLElement> | React.ChangeEvent<HTMLInputElement> | DragEvent | Event;
31
- export declare const ErrorCode: {
32
- readonly FileInvalidType: "file-invalid-type";
33
- readonly FileTooLarge: "file-too-large";
34
- readonly FileTooSmall: "file-too-small";
35
- readonly TooManyFiles: "too-many-files";
36
- };
37
- declare type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
38
- export interface FileError {
39
- message: string;
40
- code: ErrorCodeType | string;
41
- }
42
- export interface FileRejection {
43
- file: File;
44
- errors: FileError[];
45
- }
46
- export {};
47
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/Dropzone/types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX;AAED,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KACxB,CAAA;IACD,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,EACtB,aAAa,EAAE,CAAC,EAAE,EAClB,cAAc,EAAE,aAAa,EAAE,EAC/B,KAAK,EAAE,SAAS,KACb,IAAI,CAAA;IACT,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IACvE,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAA;IAC5E,iCAAiC;IACjC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,SAAS,EAAE,GAAG,IAAI,CAAA;CACxE,CAAA;AAED,oBAAY,SAAS,GACjB,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAC5B,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,GACnC,SAAS,GACT,KAAK,CAAA;AAET,eAAO,MAAM,SAAS;;;;;CAKZ,CAAA;AAEV,aAAK,aAAa,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAE/D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,aAAa,GAAG,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,SAAS,EAAE,CAAA;CACpB"}
@@ -1,7 +0,0 @@
1
- export const ErrorCode = {
2
- FileInvalidType: 'file-invalid-type',
3
- FileTooLarge: 'file-too-large',
4
- FileTooSmall: 'file-too-small',
5
- TooManyFiles: 'too-many-files',
6
- };
7
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/Dropzone/types.ts"],"names":[],"mappings":"AAwCA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,eAAe,EAAE,mBAAmB;IACpC,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,gBAAgB;CACtB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Dropzone';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Dropzone';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}