@s_mart/dropzone 7.0.3 → 8.0.0-next.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/dist/index.d.mts +14 -1
- package/dist/index.mjs +4 -4
- package/package.json +18 -21
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,18 @@ import { FileValidated } from '@dropzone-ui/react';
|
|
|
3
3
|
import { DropzoneProps as DropzoneProps$1 } from '@dropzone-ui/react/build/components/dropzone/components/Dropzone/DropzoneProps';
|
|
4
4
|
import { FileItemProps } from '@dropzone-ui/react/build/components/file-item/components/FileItem/FileItemProps';
|
|
5
5
|
|
|
6
|
+
interface DropzoneOnNotificationProps {
|
|
7
|
+
/**
|
|
8
|
+
* @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
|
|
9
|
+
*/
|
|
10
|
+
title: string;
|
|
11
|
+
/**
|
|
12
|
+
* @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
|
|
13
|
+
*/
|
|
14
|
+
message?: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
variant: 'warning' | 'error' | 'success' | 'info';
|
|
17
|
+
}
|
|
6
18
|
interface DropzoneProps extends Omit<DropzoneProps$1, 'children' | 'onReset' | 'onClean'> {
|
|
7
19
|
children?: React.ReactNode;
|
|
8
20
|
/**
|
|
@@ -40,10 +52,11 @@ interface DropzoneProps extends Omit<DropzoneProps$1, 'children' | 'onReset' | '
|
|
|
40
52
|
* @description Função que é chamada dentro do OnChange para caso necessário fazer um tratamento nos files
|
|
41
53
|
*/
|
|
42
54
|
tratamentoFilesOnChange?: (incomingFiles: FileValidated[]) => Promise<FileValidated[]> | FileValidated[];
|
|
55
|
+
onNotification(param: DropzoneOnNotificationProps): void;
|
|
43
56
|
}
|
|
44
57
|
interface DropzoneFile extends FileValidated {
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
declare const Dropzone: ({ showDeleteAllFilesButton, placeholder, fileItemProps, initialValue, onClean, onReset, tratamentoFilesOnChange, ...rest }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
60
|
+
declare const Dropzone: ({ showDeleteAllFilesButton, placeholder, fileItemProps, initialValue, onClean, onReset, tratamentoFilesOnChange, onNotification, ...rest }: DropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
48
61
|
|
|
49
62
|
export { Dropzone, type DropzoneFile, type DropzoneProps };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{useEffect as x,useState as T}from"react";import{Dropzone as b,FileItem as A}from"@dropzone-ui/react";import{LIcon as P}from"@s_mart/core";import{Tooltip as w,Typography as q}from"@mui/material";import{lineTimes as k}from"@s_mart/regular-icons";import F from"@emotion/styled";import{colorPalette as f}from"@s_mart/tokens";var c=F.button`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -18,10 +18,10 @@ import P,{useEffect as T}from"react";import{Dropzone as b,FileItem as A}from"@dr
|
|
|
18
18
|
cursor: pointer;
|
|
19
19
|
transition: all 0.3s ease;
|
|
20
20
|
|
|
21
|
-
color: ${
|
|
21
|
+
color: ${f.neutral[500]};
|
|
22
22
|
|
|
23
23
|
&:hover {
|
|
24
|
-
background-color: ${
|
|
24
|
+
background-color: ${f.neutral[40]};
|
|
25
25
|
transition: all 0.3s ease;
|
|
26
26
|
}
|
|
27
|
-
`;import{
|
|
27
|
+
`;import{Fragment as U,jsx as t,jsxs as _}from"react/jsx-runtime";var I=({showDeleteAllFilesButton:m=!0,placeholder:u,fileItemProps:h,initialValue:i=[],onClean:v,onReset:D,tratamentoFilesOnChange:s,onNotification:p,...d})=>{let[l,n]=T(i),g=e=>{let r=e.filter(o=>o.valid===!0);if(n(r),e.length>0){let o=e.filter(a=>a.valid===!1);o.length===1?p({variant:"warning",duration:5e3,title:`Arquivo ${o[0].file.name} inv\xE1lido`,message:o[0].errors?.[0]}):o.length>1&&o.forEach(a=>{p({variant:"warning",duration:5e3,title:`Arquivo ${a.file.name} inv\xE1lido`,message:a.errors?.[0]})})}},z=()=>{n([]),D?.()},y=e=>{let r=l.filter(o=>o.id!==e.id);n(r),v?.(r)};return x(()=>{i.length&&n(i)},[i]),t(b,{localization:"PT-pt",header:!1,footer:!1,headerClassName:"header",view:"grid",value:l,...d,onChange:async e=>{let r=e;if(s){let o=await s(e);o&&(r=o)}g(r),d.onChange?.(r)},children:l.length===0?t("div",{children:u||"Arraste os arquivos aqui ou clique para selecionar"}):_(U,{children:[m&&t(w,{title:t(q,{variant:"bodyMD",children:"Remover"}),children:t(c,{onClick:e=>{e.preventDefault(),e.stopPropagation(),z()},children:t(P,{icon:k,size:"24px"})})}),t("div",{style:{display:"flex"},children:l?.map(e=>t(A,{info:!0,localization:"PT-pt",preview:!0,...e,...h,onDelete:()=>y(e)},e.id))})]})})};export{I as Dropzone};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/dropzone",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-next.1",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -11,39 +11,36 @@
|
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@dropzone-ui/react": "^6.7.20",
|
|
14
|
-
"
|
|
15
|
-
"tsup": "8.0.2",
|
|
16
|
-
"@types/react": ">=18.3.1",
|
|
17
|
-
"@types/react-dom": ">=18.3.0",
|
|
18
|
-
"typescript": ">=5.4.2",
|
|
19
|
-
"@s_mart/core": "7.0.3",
|
|
20
|
-
"@s_mart/hooks": "7.0.2",
|
|
21
|
-
"@s_mart/regular-icons": "5.3.0",
|
|
22
|
-
"eslint-config-smarten": "4.1.0",
|
|
23
|
-
"@s_mart/tokens": "5.1.0",
|
|
24
|
-
"@s_mart/typed": "6.0.0"
|
|
14
|
+
"tsup": "8.0.2"
|
|
25
15
|
},
|
|
26
16
|
"peerDependencies": {
|
|
27
17
|
"@emotion/react": "^11.11.4",
|
|
28
|
-
"@emotion/styled": "
|
|
18
|
+
"@emotion/styled": "^11.13.0",
|
|
19
|
+
"@mui/material": "^6.1.3",
|
|
20
|
+
"@types/node": ">=20.0.0",
|
|
29
21
|
"@types/react": ">=18.3.1",
|
|
30
22
|
"@types/react-dom": ">=18.3.0",
|
|
31
23
|
"axios": ">=1.6.0",
|
|
32
24
|
"react": ">=18.3.1",
|
|
33
25
|
"react-dom": ">=18.3.1",
|
|
34
26
|
"typescript": ">=5.4.2",
|
|
35
|
-
"@s_mart/core": "
|
|
36
|
-
"@s_mart/
|
|
37
|
-
"@s_mart/
|
|
38
|
-
"@s_mart/tokens": "5.1.0",
|
|
39
|
-
"@s_mart/typed": "6.0.0"
|
|
27
|
+
"@s_mart/core": "8.0.0-next.1",
|
|
28
|
+
"@s_mart/regular-icons": "5.3.2-next.0",
|
|
29
|
+
"@s_mart/tokens": "5.1.0"
|
|
40
30
|
},
|
|
41
31
|
"devDependencies": {
|
|
42
|
-
"
|
|
32
|
+
"@emotion/styled": "^11.13.0",
|
|
33
|
+
"@mui/material": "^6.1.3",
|
|
34
|
+
"@types/node": ">=20.0.0",
|
|
35
|
+
"@types/react": ">=18.3.1",
|
|
36
|
+
"@types/react-dom": ">=18.3.0",
|
|
37
|
+
"typescript": ">=5.4.2",
|
|
38
|
+
"@s_mart/core": "8.0.0-next.1",
|
|
39
|
+
"@s_mart/regular-icons": "5.3.2-next.0",
|
|
40
|
+
"@s_mart/tokens": "5.1.0"
|
|
43
41
|
},
|
|
44
42
|
"scripts": {
|
|
45
43
|
"build": "tsup src/index.tsx --minify --format esm --dts --external react",
|
|
46
|
-
"dev": "tsup src/index.tsx --format esm --watch --dts --external react"
|
|
47
|
-
"lint": "eslint src/**/*.ts* --fix"
|
|
44
|
+
"dev": "tsup src/index.tsx --format esm --watch --dts --external react"
|
|
48
45
|
}
|
|
49
46
|
}
|