@raketa-builder/file-input 0.4.0 → 0.5.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.
@@ -0,0 +1,11 @@
1
+
2
+ > @raketa-builder/file-input@0.5.0 build
3
+ > tsup src/index.js --format cjs --loader ".js=jsx"
4
+
5
+ CLI Building entry: src/index.js
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v6.5.0
8
+ CLI Target: es6
9
+ CJS Build start
10
+ CJS dist/index.js 67.83 KB
11
+ CJS ⚡️ Build success in 150ms
@@ -0,0 +1,21 @@
1
+
2
+ > @raketa-builder/file-input@0.4.0 format
3
+ > prettier --write .
4
+
5
+ biome.json 573ms (unchanged)
6
+ dist/index.js 5084ms (unchanged)
7
+ package.json 43ms (unchanged)
8
+ src/FileManager.js 258ms (unchanged)
9
+ src/FilePicker/Dialog.js 147ms (unchanged)
10
+ src/FilePicker/FileCategory.js 85ms (unchanged)
11
+ src/FilePicker/FileInput.js 20ms (unchanged)
12
+ src/FilePicker/FileList.js 60ms (unchanged)
13
+ src/FilePicker/FileSearch.js 141ms (unchanged)
14
+ src/FilePicker/index.js 154ms (unchanged)
15
+ src/FilePicker/stateManagement.js 126ms (unchanged)
16
+ src/FilePicker/UploadFilesButton.js 30ms (unchanged)
17
+ src/FilePicker/UploadProgress.js 69ms (unchanged)
18
+ src/FilePicker/utils.js 20ms (unchanged)
19
+ src/index.js 2ms (unchanged)
20
+ src/styles.css 300ms (unchanged)
21
+ tsconfig.json 3ms (unchanged)
@@ -0,0 +1,4 @@
1
+
2
+ > @raketa-builder/file-input@0.4.0 lint
3
+ > biome lint --max-diagnostics=5000 .
4
+
package/biome.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": ["../../biome.json"]
3
+ }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@raketa-builder/file-input",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
- "lint": "TIMING=1 eslint \"**/*.js\"",
9
8
  "build": "tsup src/index.js --format cjs --loader \".js=jsx\"",
10
- "dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch"
9
+ "dev": "tsup src/index.js --format cjs --loader \".js=jsx\" --watch",
10
+ "format": "prettier --write .",
11
+ "lint": "biome lint --max-diagnostics=5000 ."
11
12
  },
12
13
  "peerDependencies": {
13
14
  "react": "18.2.0",
@@ -18,10 +19,10 @@
18
19
  "ui": "*"
19
20
  },
20
21
  "devDependencies": {
22
+ "@biomejs/biome": "1.5.2",
21
23
  "@types/react": "17.0.37",
22
24
  "@types/react-dom": "17.0.11",
23
- "eslint": "7.32.0",
24
- "eslint-config-custom": "*",
25
+ "prettier": "3.2.4",
25
26
  "react": "18.2.0",
26
27
  "tsconfig": "*",
27
28
  "tsup": "6.5.0",
@@ -150,7 +150,7 @@ export default class FileManager {
150
150
  method: "POST",
151
151
  headers: Object.assign(
152
152
  { "Content-Type": "application/json" },
153
- this.headers
153
+ this.headers,
154
154
  ),
155
155
  body: JSON.stringify({
156
156
  query: query,
@@ -196,7 +196,7 @@ export default class FileManager {
196
196
  async all(params = {}) {
197
197
  return this.graphQLRequest(
198
198
  DOCUMENTS_QUERY,
199
- this.buildVariables(params)
199
+ this.buildVariables(params),
200
200
  ).then((d) => {
201
201
  return d?.data.documents || {};
202
202
  });
@@ -222,7 +222,7 @@ export default class FileManager {
222
222
  }
223
223
 
224
224
  const result = await uploadFile(file, document, (state) =>
225
- progressCallback(id, state)
225
+ progressCallback(id, state),
226
226
  );
227
227
 
228
228
  if (result) {
@@ -7,7 +7,7 @@ const DropZone = ({ children, onDrop }) => {
7
7
  (acceptedFiles) => {
8
8
  onDrop(acceptedFiles);
9
9
  },
10
- [onDrop]
10
+ [onDrop],
11
11
  );
12
12
 
13
13
  const { getRootProps, getInputProps, isDragActive } = useDropzone({
@@ -20,7 +20,7 @@ const DropZone = ({ children, onDrop }) => {
20
20
  className={cn(
21
21
  "r-reset",
22
22
  "r-dropzone-modal",
23
- isDragActive ? "r-dropzone-modal-active" : ""
23
+ isDragActive ? "r-dropzone-modal-active" : "",
24
24
  )}
25
25
  {...getRootProps()}
26
26
  >
@@ -85,7 +85,7 @@ const FileList = ({
85
85
  key={file.id}
86
86
  className={cn(
87
87
  "r-file-input-file-row",
88
- selected?.id === file.id ? "r-file-input-file-row-active" : ""
88
+ selected?.id === file.id ? "r-file-input-file-row-active" : "",
89
89
  )}
90
90
  onClick={() => onSelect(file.id)}
91
91
  >
@@ -17,7 +17,7 @@ const UploadState = ({ upload }) => {
17
17
  "r-reset",
18
18
  "r-stack",
19
19
  "r-stack-justify-beteen",
20
- "r-stack-align-center"
20
+ "r-stack-align-center",
21
21
  )}
22
22
  >
23
23
  {fileSizeFormatter(upload.state?.payload?.loaded || 0)} /{" "}
@@ -70,7 +70,7 @@ const UploadProgress = ({ uploads }) => {
70
70
  "r-reset",
71
71
  "r-stack-justify-beteen",
72
72
  "r-stack-align-center",
73
- "r-file-progress"
73
+ "r-file-progress",
74
74
  )}
75
75
  >
76
76
  <UploadName upload={upload} />
@@ -28,11 +28,11 @@ const FilePicker = ({
28
28
  }) => {
29
29
  const allowedFileCategory = React.useMemo(
30
30
  () => sanitizeFileCategory(fileCategory),
31
- [fileCategory]
31
+ [fileCategory],
32
32
  );
33
33
 
34
34
  const [state, setState] = React.useState(
35
- initialState(initialValue, allowedFileCategory)
35
+ initialState(initialValue, allowedFileCategory),
36
36
  );
37
37
 
38
38
  const onFilesUpload = (files) => {
@@ -67,7 +67,7 @@ export function uploadFiles(fileManager, files, allowedFileCategory, setState) {
67
67
  if (newState.type === "completed") {
68
68
  if (
69
69
  currentState.files.list.find(
70
- (file) => file.id === newState.payload.document.id
70
+ (file) => file.id === newState.payload.document.id,
71
71
  )
72
72
  ) {
73
73
  return currentState;
@@ -76,7 +76,7 @@ export function uploadFiles(fileManager, files, allowedFileCategory, setState) {
76
76
  return {
77
77
  ...currentState,
78
78
  uploads: currentState.uploads.filter(
79
- (upload) => upload.id !== tmpId
79
+ (upload) => upload.id !== tmpId,
80
80
  ),
81
81
  files: {
82
82
  ...currentState.files,
@@ -97,8 +97,8 @@ export function uploadFiles(fileManager, files, allowedFileCategory, setState) {
97
97
 
98
98
  return { ...currentState, uploads: newUploads };
99
99
  }
100
- })
101
- )
100
+ }),
101
+ ),
102
102
  );
103
103
  }
104
104
 
@@ -186,7 +186,7 @@ export async function deleteFile(
186
186
  fileId,
187
187
  state,
188
188
  setState,
189
- onChange
189
+ onChange,
190
190
  ) {
191
191
  setState((currentState) => ({
192
192
  ...currentState,
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "extends": "tsconfig/react-library.json",
3
3
  "include": ["src"],
4
- "exclude": ["dist", "build", "node_modules"]
4
+ "exclude": ["dist", "build", "node_modules"],
5
5
  }