@sqlrooms/dropzone 0.0.0 → 0.0.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.
- package/CHANGELOG.md +6 -0
- package/package.json +5 -5
- package/.turbo/turbo-build.log +0 -4
- package/.turbo/turbo-lint.log +0 -4
- package/eslint.config.js +0 -4
- package/src/file-dropzone.tsx +0 -85
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.0.1](https://github.com/ilyabo/sqlrooms/compare/v0.0.1-alpha.0...v0.0.1) (2025-01-30)
|
|
6
7
|
|
|
8
|
+
**Note:** Version bump only for package @sqlrooms/dropzone
|
|
9
|
+
|
|
10
|
+
## 0.0.1-alpha.0 (2025-01-30)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @sqlrooms/dropzone
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @sqlrooms/dropzone
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/dropzone",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
9
|
"main": "dist/index.js",
|
|
10
|
-
"types": "
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
11
|
"module": "dist/index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./src/*": "./src/components/*.tsx"
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"lint": "eslint ."
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@sqlrooms/ui": "0.0.
|
|
25
|
+
"@sqlrooms/ui": "0.0.1",
|
|
26
26
|
"lucide-react": "^0.473.0",
|
|
27
27
|
"react-dropzone": "^14.3.5"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "5d8893a604a91d109dc5b5f80b4a3e937b4cf520"
|
|
30
30
|
}
|
package/.turbo/turbo-build.log
DELETED
package/.turbo/turbo-lint.log
DELETED
package/eslint.config.js
DELETED
package/src/file-dropzone.tsx
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {FC, useState} from 'react';
|
|
2
|
-
import {useDropzone} from 'react-dropzone';
|
|
3
|
-
import {Plus} from 'lucide-react';
|
|
4
|
-
import {cn, Spinner} from '@sqlrooms/ui';
|
|
5
|
-
|
|
6
|
-
export type Props = {
|
|
7
|
-
className?: string;
|
|
8
|
-
isInvalid?: boolean;
|
|
9
|
-
onDrop: (files: File[]) => Promise<void>;
|
|
10
|
-
multiple?: boolean;
|
|
11
|
-
acceptedFormats?: Record<string, string[]>;
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const FileDropzone: FC<Props> = (props) => {
|
|
16
|
-
const {
|
|
17
|
-
isInvalid,
|
|
18
|
-
onDrop,
|
|
19
|
-
multiple = true,
|
|
20
|
-
className,
|
|
21
|
-
acceptedFormats,
|
|
22
|
-
children,
|
|
23
|
-
} = props;
|
|
24
|
-
|
|
25
|
-
const [isAddingDropped, setIsAddingDropped] = useState(false);
|
|
26
|
-
|
|
27
|
-
const {getRootProps, getInputProps, isDragActive, open} = useDropzone({
|
|
28
|
-
onDrop: async (files) => {
|
|
29
|
-
setIsAddingDropped(true);
|
|
30
|
-
try {
|
|
31
|
-
await onDrop(files);
|
|
32
|
-
} finally {
|
|
33
|
-
setIsAddingDropped(false);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
accept: acceptedFormats,
|
|
37
|
-
multiple,
|
|
38
|
-
noClick: true,
|
|
39
|
-
noKeyboard: true,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div
|
|
44
|
-
className={cn(
|
|
45
|
-
'relative flex h-full cursor-pointer flex-col overflow-hidden rounded-lg border-2 border-dashed p-2 transition-colors',
|
|
46
|
-
isDragActive ? 'border-muted bg-muted/50' : 'border-muted',
|
|
47
|
-
isInvalid && 'border-destructive',
|
|
48
|
-
!isAddingDropped && 'hover:border-muted',
|
|
49
|
-
className,
|
|
50
|
-
)}
|
|
51
|
-
{...getRootProps()}
|
|
52
|
-
onClick={isAddingDropped ? undefined : open}
|
|
53
|
-
>
|
|
54
|
-
{isAddingDropped ? (
|
|
55
|
-
<div className="flex h-full w-full items-center justify-center gap-4 text-xs text-muted-foreground">
|
|
56
|
-
<Spinner className="h-4 w-4" />
|
|
57
|
-
Adding files...
|
|
58
|
-
</div>
|
|
59
|
-
) : (
|
|
60
|
-
<>
|
|
61
|
-
<input {...getInputProps()} />
|
|
62
|
-
<div className="relative flex h-full flex-col">
|
|
63
|
-
<div className="flex h-full flex-col items-center justify-center gap-2">
|
|
64
|
-
<div className="flex items-center gap-2">
|
|
65
|
-
<Plus className="h-6 w-6" />
|
|
66
|
-
<p className="text-sm text-muted-foreground">
|
|
67
|
-
{isDragActive ? 'Drop here ...' : 'Add files'}
|
|
68
|
-
</p>
|
|
69
|
-
</div>
|
|
70
|
-
{acceptedFormats && (
|
|
71
|
-
<div className="flex flex-wrap justify-center gap-2">
|
|
72
|
-
<p className="text-xs font-bold">Supported formats:</p>
|
|
73
|
-
<p className="text-xs text-muted-foreground">
|
|
74
|
-
{Object.values(acceptedFormats).flat().join(', ')}
|
|
75
|
-
</p>
|
|
76
|
-
</div>
|
|
77
|
-
)}
|
|
78
|
-
{children}
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</>
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
);
|
|
85
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './file-dropzone';
|
package/tsconfig.json
DELETED