@s_mart/dropzone 12.0.2 → 16.0.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/dist/dropzone/dropzone.d.ts +2 -0
- package/dist/dropzone/dropzone.styles.d.ts +6 -0
- package/dist/dropzone/dropzone.types.d.ts +73 -0
- package/dist/dropzone/dropzoneFileHandlers/dropzoneFileHandlers.d.ts +1 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeader.d.ts +5 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeaderClear.d.ts +2 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeaderClear.types.d.ts +13 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeaderContainer.d.ts +1 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeaderTitle.d.ts +2 -0
- package/dist/dropzone/dropzoneList/components/dropzoneHeaderTitle.types.d.ts +18 -0
- package/dist/dropzone/dropzoneList/dropzoneList.d.ts +2 -0
- package/dist/dropzone/dropzoneList/dropzoneList.styles.d.ts +8 -0
- package/dist/dropzone/dropzoneList/dropzoneList.types.d.ts +19 -0
- package/dist/dropzone/dropzoneList/useDropzoneList.d.ts +14 -0
- package/dist/dropzone/dropzoneUploadInfo/dropzoneUploadInfo.d.ts +4 -0
- package/dist/dropzone/useDropzone.d.ts +19 -0
- package/dist/dropzone/utils/dragDropUtils.d.ts +2 -0
- package/dist/dropzone/utils/dropzoneUtils.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +442 -29
- package/dist/index.mjs.map +1 -0
- package/package.json +35 -43
- package/dist/index.d.mts +0 -155
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HtmlHTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { DropzoneComponent, DropzoneLabelContainerAttrs, DropzoneOverlayAttrs } from './dropzone.types';
|
|
4
|
+
export declare const DropzoneRoot: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
5
|
+
export declare const DropzoneOverlay: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>, DropzoneOverlayAttrs>;
|
|
6
|
+
export declare const DropzoneLabelContainer: DropzoneComponent<ButtonProps, DropzoneLabelContainerAttrs>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { StyledComponent } from '@emotion/styled';
|
|
3
|
+
import { Theme } from '@mui/material';
|
|
4
|
+
import { MUIStyledCommonProps } from '@mui/system';
|
|
5
|
+
import { DropzoneLabelContainer, DropzoneOverlay, DropzoneRoot } from './dropzone.styles';
|
|
6
|
+
import { DropzoneHeaderTitleBaseProps, DropzoneHeaderTitleSlotProps, DropzoneHeaderTitleSlots } from './dropzoneList/components/dropzoneHeaderTitle.types';
|
|
7
|
+
import { FileItemContent, FileListContent, FilesContainer, ScrollableFileList } from './dropzoneList/dropzoneList.styles';
|
|
8
|
+
export type DropzoneSlotProps = Partial<{
|
|
9
|
+
root: Parameters<typeof DropzoneRoot>[0];
|
|
10
|
+
overlay: Parameters<typeof DropzoneOverlay>[0];
|
|
11
|
+
header: DropzoneHeaderTitleSlotProps;
|
|
12
|
+
labelContainer: Parameters<typeof DropzoneLabelContainer>[0];
|
|
13
|
+
filesContainer: Parameters<typeof FilesContainer>[0];
|
|
14
|
+
scrollableFileList: Parameters<typeof ScrollableFileList>[0];
|
|
15
|
+
listContent: Parameters<typeof FileListContent>[0];
|
|
16
|
+
itemContent: Parameters<typeof FileItemContent>[0];
|
|
17
|
+
}>;
|
|
18
|
+
export type DropzoneComponent<Element extends HTMLAttributes<unknown>, Props extends Record<string, unknown> = Record<string, unknown>> = StyledComponent<MUIStyledCommonProps<Theme>, Element, Props>;
|
|
19
|
+
export type DropzoneSlots = DropzoneHeaderTitleSlots;
|
|
20
|
+
export type DropzoneProps = Pick<DropzoneHeaderTitleBaseProps, 'showFilesSize'> & {
|
|
21
|
+
files: File[];
|
|
22
|
+
onChange(files: File[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Permite filtrar os arquivos que são adicionados
|
|
25
|
+
*
|
|
26
|
+
* É chamado antes de `onChange`
|
|
27
|
+
* @param files Arquivos que serão filtrados
|
|
28
|
+
*/
|
|
29
|
+
filterOnDrop?(files: File[]): Promise<File[]> | File[];
|
|
30
|
+
maxSize?: number;
|
|
31
|
+
maxFiles?: number;
|
|
32
|
+
/**
|
|
33
|
+
* @default 'Pressione para carregar os arquivos'
|
|
34
|
+
*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @default undefined Aceita todos os arquivos
|
|
38
|
+
* @example '.png,.jpg,.jpeg'
|
|
39
|
+
*/
|
|
40
|
+
accept?: string;
|
|
41
|
+
/**
|
|
42
|
+
* @description Acessa as propriedades dos componentes internos
|
|
43
|
+
*/
|
|
44
|
+
slotProps?: DropzoneSlotProps;
|
|
45
|
+
/**
|
|
46
|
+
* @description Substitui os componentes internos
|
|
47
|
+
*/
|
|
48
|
+
slots?: DropzoneSlots;
|
|
49
|
+
/**
|
|
50
|
+
* @param message Mensagem tratado do erro
|
|
51
|
+
* @param errorFromCatch O erro capturado pelo `try catch`
|
|
52
|
+
*/
|
|
53
|
+
onError: (message: string, errorFromCatch: unknown) => void;
|
|
54
|
+
/**
|
|
55
|
+
* @param message Mensagem tratado do erro
|
|
56
|
+
*/
|
|
57
|
+
onWarning: (message: string) => void;
|
|
58
|
+
};
|
|
59
|
+
export type UsesDropzoneProps = Pick<DropzoneProps, 'files' | 'onChange' | 'filterOnDrop' | 'accept' | 'maxSize' | 'maxFiles' | 'onError' | 'onWarning'>;
|
|
60
|
+
export type DropzoneOverlayAttrs = {
|
|
61
|
+
/**
|
|
62
|
+
* Tipagem somente utilizada para linting para passar data attributes
|
|
63
|
+
*/
|
|
64
|
+
'data-is-dragging': boolean;
|
|
65
|
+
};
|
|
66
|
+
export type DropzoneLabelContainerAttrs = {
|
|
67
|
+
/**
|
|
68
|
+
* Tipagem somente utilizada para linting para passar data attributes
|
|
69
|
+
*/
|
|
70
|
+
'data-has-files': boolean;
|
|
71
|
+
'data-max-files': number | undefined;
|
|
72
|
+
'data-is-processing-zip': boolean;
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getFilesAsync: (dataTransfer: DataTransfer, accept?: string) => Promise<File[]>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DropzoneHeader: {
|
|
2
|
+
Container: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
+
Title: (props: import('./dropzoneHeaderTitle.types').DropzoneHeaderTitleProps) => import("react").JSX.Element;
|
|
4
|
+
ClearButton: ({ onClick, slotProps }: import('./dropzoneHeaderClear.types').DropzoneHeaderClearProps) => import("react").JSX.Element;
|
|
5
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TooltipProps } from '@mui/material';
|
|
2
|
+
import { IconButtonProps, LIconProps } from '@s_mart/core';
|
|
3
|
+
export type DropzoneHeaderClearBaseProps = {
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type DropzoneHeaderClearSlotProps = {
|
|
7
|
+
slotProps?: Partial<{
|
|
8
|
+
headerCleartooltip: Omit<TooltipProps, 'children'>;
|
|
9
|
+
headerClearIconButton: Omit<IconButtonProps, 'children'>;
|
|
10
|
+
headerClearLicon: LIconProps;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export type DropzoneHeaderClearProps = DropzoneHeaderClearBaseProps & DropzoneHeaderClearSlotProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DropzoneHeaderContainer: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
export type DropzoneHeaderTitleSlotProps = {
|
|
4
|
+
headerTitle?: DropzoneHeaderTitleBaseProps & TypographyProps;
|
|
5
|
+
};
|
|
6
|
+
export type DropzoneHeaderTitleSlots = {
|
|
7
|
+
headerTitleContent?: (props: DropzoneHeaderTitleBaseProps) => JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export type DropzoneHeaderTitleSlotAndProps = {
|
|
10
|
+
slotProps?: Partial<DropzoneHeaderTitleSlotProps>;
|
|
11
|
+
slots?: Partial<DropzoneHeaderTitleSlots>;
|
|
12
|
+
};
|
|
13
|
+
export type DropzoneHeaderTitleBaseProps = {
|
|
14
|
+
filesLengthLabel?: string;
|
|
15
|
+
filesTotalSize?: string;
|
|
16
|
+
showFilesSize?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type DropzoneHeaderTitleProps = DropzoneHeaderTitleSlotAndProps & DropzoneHeaderTitleBaseProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HtmlHTMLAttributes } from 'react';
|
|
2
|
+
import { DropzoneComponent } from '../dropzone.types';
|
|
3
|
+
export declare const FilesContainer: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const FileItemContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
5
|
+
export declare const ScrollableFileList: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const FileListContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const FileRow: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const FileName: import('@emotion/styled').StyledComponent<import('@mui/material').TypographyOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "className" | "style" | "classes" | "align" | "children" | "color" | "gutterBottom" | "noWrap" | "sx" | "variant" | "variantMapping"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme>, {}, {}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PathSourceProps } from '@s_mart/core';
|
|
2
|
+
import { DropzoneSlotProps } from '../dropzone.types';
|
|
3
|
+
import { DropzoneHeaderTitleBaseProps, DropzoneHeaderTitleSlots } from './components/dropzoneHeaderTitle.types';
|
|
4
|
+
export type FileInfo = {
|
|
5
|
+
size: number;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
export type FileItemInfo = {
|
|
10
|
+
icon: PathSourceProps;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
export type DropzoneListProps = Pick<DropzoneHeaderTitleBaseProps, 'showFilesSize'> & {
|
|
14
|
+
slotProps?: Pick<DropzoneSlotProps, 'itemContent' | 'scrollableFileList' | 'listContent' | 'filesContainer' | 'header'>;
|
|
15
|
+
slots?: DropzoneHeaderTitleSlots;
|
|
16
|
+
filesInfo: FileInfo[];
|
|
17
|
+
onRemoveFile(index: number): void;
|
|
18
|
+
onRemoveAllFiles(): void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FileInfo } from './dropzoneList.types';
|
|
2
|
+
export declare const useDropzoneList: ({ filesInfo }: {
|
|
3
|
+
filesInfo: FileInfo[];
|
|
4
|
+
}) => {
|
|
5
|
+
files: {
|
|
6
|
+
name: string;
|
|
7
|
+
fileSize: string;
|
|
8
|
+
icon: import('@s_mart/core').PathSourceProps;
|
|
9
|
+
}[];
|
|
10
|
+
headerInfo: {
|
|
11
|
+
totalSize: string;
|
|
12
|
+
totalFilesLabel: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import { UsesDropzoneProps } from './dropzone.types';
|
|
3
|
+
export declare const useDropzone: ({ onChange, filterOnDrop, maxSize, maxFiles, accept, onError, onWarning, files, }: UsesDropzoneProps) => {
|
|
4
|
+
inputRef: import('react').RefObject<HTMLInputElement | null>;
|
|
5
|
+
isDragging: boolean;
|
|
6
|
+
filesInfo: {
|
|
7
|
+
size: number;
|
|
8
|
+
type: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
11
|
+
treatedAccept: string | undefined;
|
|
12
|
+
isProcessingZip: boolean;
|
|
13
|
+
handleRemoveFile: (index: number) => void;
|
|
14
|
+
handleRemoveAllFiles: () => void;
|
|
15
|
+
handleChangeFiles: (e: ChangeEvent<HTMLInputElement>) => Promise<void>;
|
|
16
|
+
handleDragEnter: import('react').DragEventHandler<HTMLDivElement>;
|
|
17
|
+
handleDragLeave: import('react').DragEventHandler<HTMLDivElement>;
|
|
18
|
+
handleDrop: import('react').DragEventHandler<HTMLDivElement>;
|
|
19
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { colorPalette as e } from "@s_mart/tokens";
|
|
2
|
+
import { Button as t, CircularProgress as n, Stack as r, Tooltip as i, Typography as a, styled as o } from "@mui/material";
|
|
3
|
+
import { IconButton as s, LIcon as c } from "@s_mart/core";
|
|
4
|
+
import { lineFileCertificate as l, lineFileUpload as u, lineTimes as d } from "@s_mart/regular-icons";
|
|
5
|
+
import { useVirtualizer as f } from "@tanstack/react-virtual";
|
|
6
|
+
import { useCallback as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
7
|
+
import { deepMerge as _ } from "@s_mart/utils";
|
|
8
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
|
+
import { lineFile as x, linePicture as S, lineXMLFile as C } from "@s_mart/light-icons";
|
|
10
|
+
//#region src/dropzone/dropzone.styles.ts
|
|
11
|
+
var w = o("div")`
|
|
2
12
|
min-width: 300px;
|
|
3
13
|
align-items: center;
|
|
4
14
|
display: flex;
|
|
@@ -6,7 +16,7 @@ import{Button as He,styled as $}from"@mui/material";import{colorPalette as we}fr
|
|
|
6
16
|
justify-content: center;
|
|
7
17
|
gap: 8px;
|
|
8
18
|
padding: 16px;
|
|
9
|
-
`,
|
|
19
|
+
`, T = o("div")`
|
|
10
20
|
display: none;
|
|
11
21
|
position: absolute;
|
|
12
22
|
z-index: 20;
|
|
@@ -14,7 +24,7 @@ import{Button as He,styled as $}from"@mui/material";import{colorPalette as we}fr
|
|
|
14
24
|
left: 0;
|
|
15
25
|
height: 0;
|
|
16
26
|
width: 0;
|
|
17
|
-
border: 0px dashed ${
|
|
27
|
+
border: 0px dashed ${e.neutral[500]};
|
|
18
28
|
border-radius: 8px;
|
|
19
29
|
display: flex;
|
|
20
30
|
justify-content: center;
|
|
@@ -27,30 +37,433 @@ import{Button as He,styled as $}from"@mui/material";import{colorPalette as we}fr
|
|
|
27
37
|
width: 99.3%;
|
|
28
38
|
border-width: 2px;
|
|
29
39
|
}
|
|
30
|
-
`,Q=$(He)(({theme:e})=>({width:"100%",pointerEvents:"all",minHeight:"40px",backgroundColor:e.palette.primary.main,borderRadius:Number.parseFloat(e.shape.borderRadius.toString())*2,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"8px",padding:".5rem 1rem",cursor:"pointer",transition:"all 0.5s ease",'&[data-max-files="1"]':{minHeight:0},'&[data-has-files="true"]':{height:"40px"},'&[data-has-files="true"][data-max-files="1"]':{height:0},'&[data-has-files="true"] #dropzone-upload-info':{display:"none"},'&:not([data-has-files="true"]) #dropzone-upload-more-label, &[data-max-files="1"] #dropzone-upload-more-label':{display:"none"},"& #dropzone-upload-more-label":{pointerEvents:"all",color:"white"},'&[data-is-processing-zip="true"], &[data-is-processing-zip="true"] #dropzone-upload-more-label':{pointerEvents:"none"},"&:hover":{backgroundColor:({theme:t})=>t.palette.primary.dark}}));import{Tooltip as _e,Typography as je}from"@mui/material";import{IconButton as Ge,LIcon as pe}from"@s_mart/core";import{lineTimes as Ke}from"@s_mart/regular-icons";import{colorPalette as Qe}from"@s_mart/tokens";import{useVirtualizer as Ye}from"@tanstack/react-virtual";import{useRef as Je}from"react";import{Tooltip as Pe}from"@mui/material";import V from"@mui/utils/deepmerge";import{IconButton as Se,LIcon as Ee}from"@s_mart/core";import{lineTimes as Me}from"@s_mart/regular-icons";import{jsx as O}from"react/jsx-runtime";var q={headerCleartooltip:{title:"Remover todos"},headerClearIconButton:{variant:"text",color:"neutral",sx:{borderRadius:50}},headerClearLicon:{icon:Me,removeMargin:!0}},U={clone:!1},Y=({onClick:e,slotProps:t})=>{let r=V(q.headerCleartooltip,t?.headerCleartooltip,U),o=V(q.headerClearIconButton,t?.headerClearIconButton,U),n=V(q.headerClearLicon,t?.headerClearLicon,U);return O(Pe,{...r,children:O(Se,{...o,onClick:e,children:O(Ee,{...n})})})};import{styled as Re}from"@mui/material";var J=Re("div")({display:"flex",justifyContent:"space-between",alignItems:"center",paddingBlock:"0.5rem"});import{Typography as Ie}from"@mui/material";import Ae from"@mui/utils/deepmerge";import{useMemo as ke}from"react";import{Fragment as qe,jsx as M}from"react/jsx-runtime";var Be={headerTitle:{variant:"titleXXS"}},$e={headerTitleContent:e=>M(Ve,{...e})},Ve=e=>{let t=`${e.filesLengthLabel}`;return e.showFilesSize&&(t+=` - ${e.filesTotalSize}`),M(qe,{children:t})},W=e=>{let t=e.slots?.headerTitleContent??$e.headerTitleContent,r=ke(()=>Ae(Be.headerTitle,{...e,...e.slotProps?.headerTitle}),[e.filesLengthLabel,e.filesTotalSize,e]);return M(Ie,{...r,children:M(t,{...r})})};var R={Container:J,Title:W,ClearButton:Y};import{styled as L,Typography as Ue}from"@mui/material";import{colorPalette as X}from"@s_mart/tokens";var ee=L("div")(({theme:e})=>({width:"100%",maxHeight:"300px",backgroundColor:X.neutral[20],borderRadius:Number.parseFloat(e.shape.borderRadius.toString())*2,display:"flex",flexDirection:"column",border:`1px solid ${X.neutral[20]}`,padding:"8px",gap:"8px"})),oe=L("div")({backgroundColor:"white",borderRadius:"16px",padding:"8px",gap:"24px",display:"grid",gridTemplateColumns:"min-content min-content 1fr min-content",alignItems:"center",justifyContent:"space-between"}),te=L("div")({height:"auto",overflow:"auto"}),re=L("div")({position:"relative",width:"100%"}),ne=L("div")({top:0,left:0,width:"100%",position:"absolute",paddingBottom:"8px",boxSizing:"border-box"}),ie=L(Ue)({color:X.neutral[600],overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"start"});import{useMemo as le}from"react";import{lineFile as Oe,linePicture as Xe,lineXMLFile as Ze}from"@s_mart/light-icons";import{lineFileCertificate as Ne}from"@s_mart/regular-icons";var ae=e=>{switch(e){case"application/xml":case"text/xml":return Ze;case"image/gif":case"image/jpeg":case"image/png":case"image/svg":case"image/webp":return Xe;case"application/pkcs12":return Ne;default:return Oe}},H=e=>{let t="";return e<1024?t=`${e} Bytes`:e<1024*1024?t=`${(e/1024).toFixed(2)} KB`:e<1024*1024*1024&&(t=`${(e/1024/1024).toFixed(2)} MB`),t};var se=({filesInfo:e})=>{let t=le(()=>e.map(o=>({name:o.name,fileSize:H(o.size),icon:ae(o.type)})),[e]),r=le(()=>({totalSize:H(e.reduce((o,n)=>o+n.size,0)),totalFilesLabel:e.length===1?"1 arquivo":`${e.length} arquivos`}),[e]);return{files:t,headerInfo:r}};import{jsx as D,jsxs as Z}from"react/jsx-runtime";var de=({filesInfo:e,onRemoveFile:t,onRemoveAllFiles:r,slotProps:o,slots:n,showFilesSize:p})=>{let{files:l,headerInfo:i}=se({filesInfo:e}),u=Je(null),d=Ye({count:l.length,getScrollElement:()=>u.current,estimateSize:()=>60,overscan:5});return l.length===0?null:Z(ee,{...o?.filesContainer,children:[Z(R.Container,{children:[D(R.Title,{slots:n,slotProps:o?.header,filesLengthLabel:i.totalFilesLabel,filesTotalSize:i.totalSize,showFilesSize:p}),D(R.ClearButton,{onClick:r})]}),D(te,{ref:u,...o?.scrollableFileList,children:D(re,{...o?.listContent,sx:{height:`${d.getTotalSize()}px`,...o?.listContent},children:d.getVirtualItems().map(m=>{let g=l[m.index];return D(ne,{sx:{height:`${m.size}px`,transform:`translateY(${m.start}px)`},children:D(_e,{title:g.name,arrow:!0,placement:"top",children:Z(oe,{...o?.itemContent,children:[D(pe,{icon:g.icon,removeMargin:!0,size:"24px"}),D(je,{variant:"titleXXS",color:Qe.neutral[600],whiteSpace:"nowrap",children:p&&g.fileSize}),D(ie,{variant:"titleXXS",children:g.name}),D(Ge,{variant:"text",color:"neutral",sx:{borderRadius:50},onClick:()=>t(m.index),children:D(pe,{icon:Ke,removeMargin:!0})})]})})},m.key)})})})]})};import{CircularProgress as ce,Stack as N,Typography as I}from"@mui/material";import{LIcon as We}from"@s_mart/core";import{lineFileUpload as eo}from"@s_mart/regular-icons";import{jsx as C,jsxs as w}from"react/jsx-runtime";var me=({placeholder:e,isProcessingZip:t})=>t?w("div",{children:[w(N,{id:"dropzone-upload-info",sx:{gap:1,alignItems:"center",direction:"row"},children:[C(ce,{sx:{color:"white"},size:24}),C(I,{variant:"titleSM",color:"white",children:"Descompactando zip..."})]}),w(N,{id:"dropzone-upload-more-label",sx:{gap:1,alignItems:"center",direction:"row"},children:[C(ce,{sx:{color:"white"},size:12}),C(I,{variant:"bodySM",sx:{fontWeight:700},children:"Descompactando zip..."})]})]}):w("div",{children:[w(N,{id:"dropzone-upload-info",sx:{gap:1,alignItems:"center",direction:"row"},children:[C(We,{icon:eo,size:"48px",color:"white",removeMargin:!0}),C(I,{variant:"titleSM",color:"white",children:e})]}),C(I,{id:"dropzone-upload-more-label",variant:"bodySM",sx:{fontWeight:700},children:"Carregar mais arquivos"})]});import{useCallback as P,useMemo as io,useRef as fe,useState as ge}from"react";var ue=async(e,t)=>{let r=[];for(let o of e.items){if(o.kind!=="file")continue;if(typeof o.webkitGetAsEntry=="function"){let p=o.webkitGetAsEntry();if(p===null)continue;let l=await oo(p);r.push(...l);continue}let n=o.getAsFile();n&&r.push(n)}return t!==void 0&&(r=no(r,t)),r},oo=e=>new Promise((t,r)=>{let o=0,n=[];p(e);function p(i){ro(i)?(o++,i.file(u=>{o--,n.push(u),o===0&&t(n)})):to(i)&&l(i.createReader())}function l(i){o++,i.readEntries(function(u){o--;for(let d of u)p(d);o===0&&t(n)})}}),to=e=>e.isDirectory,ro=e=>e.isFile,no=(e,t)=>{let r=[],o=t.split(",");for(let n of e){let p=`.${n.name.split(".").pop()?.toLowerCase()}`;o.includes(p)&&r.push(n)}return r};var _=e=>{e.stopPropagation(),e.preventDefault()},j=e=>{e.dataTransfer.dropEffect="link",_(e)};var he=({onChange:e,filterOnDrop:t,maxSize:r,maxFiles:o,accept:n,onError:p,onWarning:l,files:i})=>{let[u,d]=ge(!1),[m,g]=ge(!1),y=fe(null),k=fe(!1),s=P(async a=>{g(!0);let f=[],{BlobReader:z,BlobWriter:T,ZipReader:S}=await import("@zip.js/zip.js").catch(()=>{throw new Error("Fa\xE7a a instala\xE7\xE3o da biblioteca @zip.js/zip.js para utilizar o Dropzone com exporta\xE7\xE3o de .zip")}),F=new z(a),v=new S(F);try{let B=await v.getEntries();for(let E of B){if(E.directory||E.getData===void 0)continue;let Te=await E.getData(new T),Le=new File([Te],E.filename);f.push(Le)}}catch(B){p?.("Ocorreu um erro ao processar o arquivo compactado.",B)}finally{g(!1),await v.close()}return f},[p]),h=P(async a=>{if(!n)return a;let f=[];for(let z of a){let T=`.${z.name.split(".").pop()?.toLocaleLowerCase()}`;if(!n.split(",").includes(T)){l?.(`O arquivo "${z.name}" n\xE3o \xE9 valido, extens\xF5es aceitas ${n}`);continue}if(T===".zip"){let F=await s(z);if(!F.length)continue;let v=await h(F);v.length&&f.push(...v);continue}f.push(z)}return f},[n,l,s]),c=P(async a=>{let f=await t?.(a)??a,z=await h(f);if(o!==void 0&&i.length+z.length>o)return l?.(`Quantidade m\xE1xima de arquivos ${o} alcan\xE7ada`),i;if(r!==void 0){let T=i.reduce((F,v)=>F+v.size,0),S=z.reduce((F,v)=>F+v.size,0);if(T+S>r)return l?.(`O arquivo \xE9 muito grande, O tamanho m\xE1ximo permitido \xE9 ${H(r)}`),i}return k.current=!0,[...i,...z]},[i,t,o,r,l,h]),b=async a=>{if(a.target.files){let f=[...a.target.files];e(await c(f))}},Fe=P(a=>{y.current?.value&&(y.current.value=""),e(i.filter((f,z)=>z!==a))},[e,i]),xe=P(()=>{y.current?.value&&(y.current.value=""),e([])},[e]),Ce=io(()=>i?.map(a=>({size:a.size,type:a.type,name:a.name}))??[],[i]),be=n?`${n.toUpperCase()},${n.toLowerCase()}`:void 0;return{inputRef:y,isDragging:u,filesInfo:Ce,treatedAccept:be,isProcessingZip:m,handleRemoveFile:Fe,handleRemoveAllFiles:xe,handleChangeFiles:b,handleDragEnter:a=>{j(a),d(!0)},handleDragLeave:a=>{j(a),d(!1)},handleDrop:async a=>{_(a),d(!1);let f=await ue(a.dataTransfer,n);c(f)}}};import{jsx as A,jsxs as ze}from"react/jsx-runtime";var ao=e=>{let{inputRef:t,filesInfo:r,treatedAccept:o,handleChangeFiles:n,handleRemoveFile:p,handleRemoveAllFiles:l,handleDragEnter:i,handleDragLeave:u,handleDrop:d,isDragging:m,isProcessingZip:g}=he(e),y=e.placeholder??"Pressione para carregar os arquivos";return ze(G,{onDragOver:i,...e.slotProps?.root,children:[A(K,{"data-is-dragging":m,onDrop:d,onDragLeave:u,...e.slotProps?.overlay}),A(de,{filesInfo:r,onRemoveFile:p,onRemoveAllFiles:l,showFilesSize:e.showFilesSize,slotProps:e.slotProps,slots:e.slots}),ze(Q,{onClick:()=>t.current?.click(),"data-max-files":e.maxFiles,"data-has-files":!!r.length,"data-is-processing-zip":g,...e.slotProps?.labelContainer,children:[A(me,{placeholder:y,isProcessingZip:g}),A("input",{ref:t,type:"file",accept:o,hidden:!0,onChange:n,multiple:e.maxFiles===void 0||e.maxFiles>1})]})]})};import{useEffect as so,useState as po}from"react";import{Dropzone as co,FileItem as mo}from"@dropzone-ui/react";import{LIcon as uo}from"@s_mart/core";import{Tooltip as fo,Typography as go}from"@mui/material";import{lineTimes as ho}from"@s_mart/regular-icons";import{styled as lo}from"@mui/material";import{colorPalette as De}from"@s_mart/tokens";var ye=lo("button")`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
`, E = o(t)(({ theme: e }) => ({
|
|
41
|
+
width: "100%",
|
|
42
|
+
pointerEvents: "all",
|
|
43
|
+
minHeight: "40px",
|
|
44
|
+
backgroundColor: e.palette.primary.main,
|
|
45
|
+
borderRadius: Number.parseFloat(e.shape.borderRadius.toString()) * 2,
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
gap: "8px",
|
|
51
|
+
padding: ".5rem 1rem",
|
|
52
|
+
cursor: "pointer",
|
|
53
|
+
transition: "all 0.5s ease",
|
|
54
|
+
"&[data-max-files=\"1\"]": { minHeight: 0 },
|
|
55
|
+
"&[data-has-files=\"true\"]": { height: "40px" },
|
|
56
|
+
"&[data-has-files=\"true\"][data-max-files=\"1\"]": { height: 0 },
|
|
57
|
+
"&[data-has-files=\"true\"] #dropzone-upload-info": { display: "none" },
|
|
58
|
+
"&:not([data-has-files=\"true\"]) #dropzone-upload-more-label, &[data-max-files=\"1\"] #dropzone-upload-more-label": { display: "none" },
|
|
59
|
+
"& #dropzone-upload-more-label": {
|
|
60
|
+
pointerEvents: "all",
|
|
61
|
+
color: "white"
|
|
62
|
+
},
|
|
63
|
+
"&[data-is-processing-zip=\"true\"], &[data-is-processing-zip=\"true\"] #dropzone-upload-more-label": { pointerEvents: "none" },
|
|
64
|
+
"&:hover": { backgroundColor: e.palette.primary.dark }
|
|
65
|
+
})), D = {
|
|
66
|
+
headerCleartooltip: { title: "Remover todos" },
|
|
67
|
+
headerClearIconButton: {
|
|
68
|
+
variant: "text",
|
|
69
|
+
color: "neutral",
|
|
70
|
+
sx: { borderRadius: 50 }
|
|
71
|
+
},
|
|
72
|
+
headerClearLicon: {
|
|
73
|
+
icon: d,
|
|
74
|
+
removeMargin: !0
|
|
75
|
+
}
|
|
76
|
+
}, O = ({ onClick: e, slotProps: t }) => {
|
|
77
|
+
let n = _(D.headerCleartooltip, t?.headerCleartooltip), r = _(D.headerClearIconButton, t?.headerClearIconButton), a = _(D.headerClearLicon, t?.headerClearLicon);
|
|
78
|
+
return /* @__PURE__ */ y(i, {
|
|
79
|
+
...n,
|
|
80
|
+
children: /* @__PURE__ */ y(s, {
|
|
81
|
+
...r,
|
|
82
|
+
onClick: e,
|
|
83
|
+
children: /* @__PURE__ */ y(c, { ...a })
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}, k = o("div")({
|
|
87
|
+
display: "flex",
|
|
88
|
+
justifyContent: "space-between",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
paddingBlock: "0.5rem"
|
|
91
|
+
}), A = { headerTitle: { variant: "titleXXS" } }, j = { headerTitleContent: (e) => /* @__PURE__ */ y(M, { ...e }) }, M = (e) => {
|
|
92
|
+
let t = `${e.filesLengthLabel}`;
|
|
93
|
+
return e.showFilesSize && (t += ` - ${e.filesTotalSize}`), /* @__PURE__ */ y(v, { children: t });
|
|
94
|
+
}, N = {
|
|
95
|
+
Container: k,
|
|
96
|
+
Title: (e) => {
|
|
97
|
+
let t = e.slots?.headerTitleContent ?? j.headerTitleContent, n = m(() => _(A.headerTitle, {
|
|
98
|
+
...e,
|
|
99
|
+
...e.slotProps?.headerTitle
|
|
100
|
+
}), [
|
|
101
|
+
e.filesLengthLabel,
|
|
102
|
+
e.filesTotalSize,
|
|
103
|
+
e
|
|
104
|
+
]);
|
|
105
|
+
return /* @__PURE__ */ y(a, {
|
|
106
|
+
...n,
|
|
107
|
+
children: /* @__PURE__ */ y(t, { ...n })
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
ClearButton: O
|
|
111
|
+
}, P = o("div")(({ theme: t }) => ({
|
|
112
|
+
width: "100%",
|
|
113
|
+
maxHeight: "300px",
|
|
114
|
+
backgroundColor: e.neutral[20],
|
|
115
|
+
borderRadius: Number.parseFloat(t.shape.borderRadius.toString()) * 2,
|
|
116
|
+
display: "flex",
|
|
117
|
+
flexDirection: "column",
|
|
118
|
+
border: `1px solid ${e.neutral[20]}`,
|
|
119
|
+
padding: "8px",
|
|
120
|
+
gap: "8px"
|
|
121
|
+
})), F = o("div")({
|
|
122
|
+
backgroundColor: "white",
|
|
123
|
+
borderRadius: "16px",
|
|
124
|
+
padding: "8px",
|
|
125
|
+
gap: "24px",
|
|
126
|
+
display: "grid",
|
|
127
|
+
gridTemplateColumns: "min-content min-content 1fr min-content",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
justifyContent: "space-between"
|
|
130
|
+
}), I = o("div")({
|
|
131
|
+
height: "auto",
|
|
132
|
+
overflow: "auto"
|
|
133
|
+
}), L = o("div")({
|
|
134
|
+
position: "relative",
|
|
135
|
+
width: "100%"
|
|
136
|
+
}), R = o("div")({
|
|
137
|
+
top: 0,
|
|
138
|
+
left: 0,
|
|
139
|
+
width: "100%",
|
|
140
|
+
position: "absolute",
|
|
141
|
+
paddingBottom: "8px",
|
|
142
|
+
boxSizing: "border-box"
|
|
143
|
+
}), z = o(a)({
|
|
144
|
+
color: e.neutral[600],
|
|
145
|
+
overflow: "hidden",
|
|
146
|
+
textOverflow: "ellipsis",
|
|
147
|
+
whiteSpace: "nowrap",
|
|
148
|
+
textAlign: "start"
|
|
149
|
+
}), B = (e) => {
|
|
150
|
+
switch (e) {
|
|
151
|
+
case "application/xml":
|
|
152
|
+
case "text/xml": return C;
|
|
153
|
+
case "image/gif":
|
|
154
|
+
case "image/jpeg":
|
|
155
|
+
case "image/png":
|
|
156
|
+
case "image/svg":
|
|
157
|
+
case "image/webp": return S;
|
|
158
|
+
case "application/pkcs12": return l;
|
|
159
|
+
default: return x;
|
|
160
|
+
}
|
|
161
|
+
}, V = (e) => {
|
|
162
|
+
let t = "";
|
|
163
|
+
return e < 1024 ? t = `${e} Bytes` : e < 1048576 ? t = `${(e / 1024).toFixed(2)} KB` : e < 1073741824 && (t = `${(e / 1024 / 1024).toFixed(2)} MB`), t;
|
|
164
|
+
}, H = ({ filesInfo: e }) => ({
|
|
165
|
+
files: m(() => e.map((e) => ({
|
|
166
|
+
name: e.name,
|
|
167
|
+
fileSize: V(e.size),
|
|
168
|
+
icon: B(e.type)
|
|
169
|
+
})), [e]),
|
|
170
|
+
headerInfo: m(() => ({
|
|
171
|
+
totalSize: V(e.reduce((e, t) => e + t.size, 0)),
|
|
172
|
+
totalFilesLabel: e.length === 1 ? "1 arquivo" : `${e.length} arquivos`
|
|
173
|
+
}), [e])
|
|
174
|
+
}), U = ({ filesInfo: t, onRemoveFile: n, onRemoveAllFiles: r, slotProps: o, slots: l, showFilesSize: u }) => {
|
|
175
|
+
let { files: p, headerInfo: m } = H({ filesInfo: t }), g = h(null), _ = f({
|
|
176
|
+
count: p.length,
|
|
177
|
+
getScrollElement: () => g.current,
|
|
178
|
+
estimateSize: () => 60,
|
|
179
|
+
overscan: 5
|
|
180
|
+
});
|
|
181
|
+
return p.length === 0 ? null : /* @__PURE__ */ b(P, {
|
|
182
|
+
...o?.filesContainer,
|
|
183
|
+
children: [/* @__PURE__ */ b(N.Container, { children: [/* @__PURE__ */ y(N.Title, {
|
|
184
|
+
slots: l,
|
|
185
|
+
slotProps: o?.header,
|
|
186
|
+
filesLengthLabel: m.totalFilesLabel,
|
|
187
|
+
filesTotalSize: m.totalSize,
|
|
188
|
+
showFilesSize: u
|
|
189
|
+
}), /* @__PURE__ */ y(N.ClearButton, { onClick: r })] }), /* @__PURE__ */ y(I, {
|
|
190
|
+
ref: g,
|
|
191
|
+
...o?.scrollableFileList,
|
|
192
|
+
children: /* @__PURE__ */ y(L, {
|
|
193
|
+
...o?.listContent,
|
|
194
|
+
sx: {
|
|
195
|
+
height: `${_.getTotalSize()}px`,
|
|
196
|
+
...o?.listContent
|
|
197
|
+
},
|
|
198
|
+
children: _.getVirtualItems().map((t) => {
|
|
199
|
+
let r = p[t.index];
|
|
200
|
+
return /* @__PURE__ */ y(R, {
|
|
201
|
+
sx: {
|
|
202
|
+
height: `${t.size}px`,
|
|
203
|
+
transform: `translateY(${t.start}px)`
|
|
204
|
+
},
|
|
205
|
+
children: /* @__PURE__ */ y(i, {
|
|
206
|
+
title: r.name,
|
|
207
|
+
arrow: !0,
|
|
208
|
+
placement: "top",
|
|
209
|
+
children: /* @__PURE__ */ b(F, {
|
|
210
|
+
...o?.itemContent,
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ y(c, {
|
|
213
|
+
icon: r.icon,
|
|
214
|
+
removeMargin: !0,
|
|
215
|
+
size: "24px"
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ y(a, {
|
|
218
|
+
variant: "titleXXS",
|
|
219
|
+
color: e.neutral[600],
|
|
220
|
+
sx: { whiteSpace: "nowrap" },
|
|
221
|
+
children: u && r.fileSize
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ y(z, {
|
|
224
|
+
variant: "titleXXS",
|
|
225
|
+
children: r.name
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ y(s, {
|
|
228
|
+
variant: "text",
|
|
229
|
+
color: "neutral",
|
|
230
|
+
sx: { borderRadius: 50 },
|
|
231
|
+
onClick: () => n(t.index),
|
|
232
|
+
children: /* @__PURE__ */ y(c, {
|
|
233
|
+
icon: d,
|
|
234
|
+
removeMargin: !0
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
}, t.key);
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
})]
|
|
244
|
+
});
|
|
245
|
+
}, W = ({ placeholder: e, isProcessingZip: t }) => t ? /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b(r, {
|
|
246
|
+
id: "dropzone-upload-info",
|
|
247
|
+
sx: {
|
|
248
|
+
gap: 1,
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
direction: "row"
|
|
251
|
+
},
|
|
252
|
+
children: [/* @__PURE__ */ y(n, {
|
|
253
|
+
sx: { color: "white" },
|
|
254
|
+
size: 24
|
|
255
|
+
}), /* @__PURE__ */ y(a, {
|
|
256
|
+
variant: "titleSM",
|
|
257
|
+
color: "white",
|
|
258
|
+
children: "Descompactando zip..."
|
|
259
|
+
})]
|
|
260
|
+
}), /* @__PURE__ */ b(r, {
|
|
261
|
+
id: "dropzone-upload-more-label",
|
|
262
|
+
sx: {
|
|
263
|
+
gap: 1,
|
|
264
|
+
alignItems: "center",
|
|
265
|
+
direction: "row"
|
|
266
|
+
},
|
|
267
|
+
children: [/* @__PURE__ */ y(n, {
|
|
268
|
+
sx: { color: "white" },
|
|
269
|
+
size: 12
|
|
270
|
+
}), /* @__PURE__ */ y(a, {
|
|
271
|
+
variant: "bodySM",
|
|
272
|
+
sx: { fontWeight: 700 },
|
|
273
|
+
children: "Descompactando zip..."
|
|
274
|
+
})]
|
|
275
|
+
})] }) : /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b(r, {
|
|
276
|
+
id: "dropzone-upload-info",
|
|
277
|
+
sx: {
|
|
278
|
+
gap: 1,
|
|
279
|
+
alignItems: "center",
|
|
280
|
+
direction: "row"
|
|
281
|
+
},
|
|
282
|
+
children: [/* @__PURE__ */ y(c, {
|
|
283
|
+
icon: u,
|
|
284
|
+
size: "48px",
|
|
285
|
+
color: "white",
|
|
286
|
+
removeMargin: !0
|
|
287
|
+
}), /* @__PURE__ */ y(a, {
|
|
288
|
+
variant: "titleSM",
|
|
289
|
+
color: "white",
|
|
290
|
+
children: e
|
|
291
|
+
})]
|
|
292
|
+
}), /* @__PURE__ */ y(a, {
|
|
293
|
+
id: "dropzone-upload-more-label",
|
|
294
|
+
variant: "bodySM",
|
|
295
|
+
sx: { fontWeight: 700 },
|
|
296
|
+
children: "Carregar mais arquivos"
|
|
297
|
+
})] }), G = async (e, t) => {
|
|
298
|
+
let n = [];
|
|
299
|
+
for (let t of e.items) {
|
|
300
|
+
if (t.kind !== "file") continue;
|
|
301
|
+
if (typeof t.webkitGetAsEntry == "function") {
|
|
302
|
+
let e = t.webkitGetAsEntry();
|
|
303
|
+
if (e === null) continue;
|
|
304
|
+
let r = await K(e);
|
|
305
|
+
n.push(...r);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
let e = t.getAsFile();
|
|
309
|
+
e && n.push(e);
|
|
310
|
+
}
|
|
311
|
+
return t !== void 0 && (n = Y(n, t)), n;
|
|
312
|
+
}, K = (e) => new Promise((t, n) => {
|
|
313
|
+
let r = 0, i = [];
|
|
314
|
+
a(e);
|
|
315
|
+
function a(e) {
|
|
316
|
+
J(e) ? (r++, e.file((e) => {
|
|
317
|
+
r--, i.push(e), r === 0 && t(i);
|
|
318
|
+
})) : q(e) && o(e.createReader());
|
|
319
|
+
}
|
|
320
|
+
function o(e) {
|
|
321
|
+
r++, e.readEntries(function(e) {
|
|
322
|
+
r--;
|
|
323
|
+
for (let t of e) a(t);
|
|
324
|
+
r === 0 && t(i);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}), q = (e) => e.isDirectory, J = (e) => e.isFile, Y = (e, t) => {
|
|
328
|
+
let n = [], r = t.split(",");
|
|
329
|
+
for (let t of e) {
|
|
330
|
+
let e = `.${t.name.split(".").pop()?.toLowerCase()}`;
|
|
331
|
+
r.includes(e) && n.push(t);
|
|
332
|
+
}
|
|
333
|
+
return n;
|
|
334
|
+
}, X = (e) => {
|
|
335
|
+
e.stopPropagation(), e.preventDefault();
|
|
336
|
+
}, Z = (e) => {
|
|
337
|
+
e.dataTransfer.dropEffect = "link", X(e);
|
|
338
|
+
}, Q = ({ onChange: e, filterOnDrop: t, maxSize: n, maxFiles: r, accept: i, onError: a, onWarning: o, files: s }) => {
|
|
339
|
+
let [c, l] = g(!1), [u, d] = g(!1), f = h(null), _ = h(!1), v = p(async (e) => {
|
|
340
|
+
d(!0);
|
|
341
|
+
let t = [], { BlobReader: n, BlobWriter: r, ZipReader: i } = await import("@zip.js/zip.js").catch(() => {
|
|
342
|
+
throw Error("Faça a instalação da biblioteca @zip.js/zip.js para utilizar o Dropzone com exportação de .zip");
|
|
343
|
+
}), o = new i(new n(e));
|
|
344
|
+
try {
|
|
345
|
+
let e = await o.getEntries();
|
|
346
|
+
for (let n of e) {
|
|
347
|
+
if (n.directory || n.getData === void 0) continue;
|
|
348
|
+
let e = await n.getData(new r()), i = new File([e], n.filename);
|
|
349
|
+
t.push(i);
|
|
350
|
+
}
|
|
351
|
+
} catch (e) {
|
|
352
|
+
a?.("Ocorreu um erro ao processar o arquivo compactado.", e);
|
|
353
|
+
} finally {
|
|
354
|
+
d(!1), await o.close();
|
|
355
|
+
}
|
|
356
|
+
return t;
|
|
357
|
+
}, [a]), y = p(async (e) => {
|
|
358
|
+
if (!i) return e;
|
|
359
|
+
let t = [];
|
|
360
|
+
for (let n of e) {
|
|
361
|
+
let e = `.${n.name.split(".").pop()?.toLocaleLowerCase()}`;
|
|
362
|
+
if (!i.split(",").includes(e)) {
|
|
363
|
+
o?.(`O arquivo "${n.name}" não é valido, extensões aceitas ${i}`);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
if (e === ".zip") {
|
|
367
|
+
let e = await v(n);
|
|
368
|
+
if (!e.length) continue;
|
|
369
|
+
let r = await y(e);
|
|
370
|
+
r.length && t.push(...r);
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
t.push(n);
|
|
374
|
+
}
|
|
375
|
+
return t;
|
|
376
|
+
}, [
|
|
377
|
+
i,
|
|
378
|
+
o,
|
|
379
|
+
v
|
|
380
|
+
]), b = p(async (e) => {
|
|
381
|
+
let i = await t?.(e) ?? e, a = await y(i);
|
|
382
|
+
return r !== void 0 && s.length + a.length > r ? (o?.(`Quantidade máxima de arquivos ${r} alcançada`), s) : n !== void 0 && s.reduce((e, t) => e + t.size, 0) + a.reduce((e, t) => e + t.size, 0) > n ? (o?.(`O arquivo é muito grande, O tamanho máximo permitido é ${V(n)}`), s) : (_.current = !0, [...s, ...a]);
|
|
383
|
+
}, [
|
|
384
|
+
s,
|
|
385
|
+
t,
|
|
386
|
+
r,
|
|
387
|
+
n,
|
|
388
|
+
o,
|
|
389
|
+
y
|
|
390
|
+
]), x = async (t) => {
|
|
391
|
+
if (t.target.files) {
|
|
392
|
+
let n = [...t.target.files];
|
|
393
|
+
e(await b(n));
|
|
394
|
+
}
|
|
395
|
+
}, S = p((t) => {
|
|
396
|
+
f.current?.value && (f.current.value = ""), e(s.filter((e, n) => n !== t));
|
|
397
|
+
}, [e, s]), C = p(() => {
|
|
398
|
+
f.current?.value && (f.current.value = ""), e([]);
|
|
399
|
+
}, [e]);
|
|
400
|
+
return {
|
|
401
|
+
inputRef: f,
|
|
402
|
+
isDragging: c,
|
|
403
|
+
filesInfo: m(() => s?.map((e) => ({
|
|
404
|
+
size: e.size,
|
|
405
|
+
type: e.type,
|
|
406
|
+
name: e.name
|
|
407
|
+
})) ?? [], [s]),
|
|
408
|
+
treatedAccept: i ? `${i.toUpperCase()},${i.toLowerCase()}` : void 0,
|
|
409
|
+
isProcessingZip: u,
|
|
410
|
+
handleRemoveFile: S,
|
|
411
|
+
handleRemoveAllFiles: C,
|
|
412
|
+
handleChangeFiles: x,
|
|
413
|
+
handleDragEnter: (e) => {
|
|
414
|
+
Z(e), l(!0);
|
|
415
|
+
},
|
|
416
|
+
handleDragLeave: (e) => {
|
|
417
|
+
Z(e), l(!1);
|
|
418
|
+
},
|
|
419
|
+
handleDrop: async (e) => {
|
|
420
|
+
X(e), l(!1);
|
|
421
|
+
let t = await G(e.dataTransfer, i);
|
|
422
|
+
b(t);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}, $ = (e) => {
|
|
426
|
+
let { inputRef: t, filesInfo: n, treatedAccept: r, handleChangeFiles: i, handleRemoveFile: a, handleRemoveAllFiles: o, handleDragEnter: s, handleDragLeave: c, handleDrop: l, isDragging: u, isProcessingZip: d } = Q(e), f = e.placeholder ?? "Pressione para carregar os arquivos";
|
|
427
|
+
return /* @__PURE__ */ b(w, {
|
|
428
|
+
onDragOver: s,
|
|
429
|
+
...e.slotProps?.root,
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ y(T, {
|
|
432
|
+
"data-is-dragging": u,
|
|
433
|
+
onDrop: l,
|
|
434
|
+
onDragLeave: c,
|
|
435
|
+
...e.slotProps?.overlay
|
|
436
|
+
}),
|
|
437
|
+
/* @__PURE__ */ y(U, {
|
|
438
|
+
filesInfo: n,
|
|
439
|
+
onRemoveFile: a,
|
|
440
|
+
onRemoveAllFiles: o,
|
|
441
|
+
showFilesSize: e.showFilesSize,
|
|
442
|
+
slotProps: e.slotProps,
|
|
443
|
+
slots: e.slots
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ b(E, {
|
|
446
|
+
onClick: () => t.current?.click(),
|
|
447
|
+
"data-max-files": e.maxFiles,
|
|
448
|
+
"data-has-files": !!n.length,
|
|
449
|
+
"data-is-processing-zip": d,
|
|
450
|
+
...e.slotProps?.labelContainer,
|
|
451
|
+
children: [/* @__PURE__ */ y(W, {
|
|
452
|
+
placeholder: f,
|
|
453
|
+
isProcessingZip: d
|
|
454
|
+
}), /* @__PURE__ */ y("input", {
|
|
455
|
+
ref: t,
|
|
456
|
+
type: "file",
|
|
457
|
+
accept: r,
|
|
458
|
+
hidden: !0,
|
|
459
|
+
onChange: i,
|
|
460
|
+
multiple: e.maxFiles === void 0 || e.maxFiles > 1
|
|
461
|
+
})]
|
|
462
|
+
})
|
|
463
|
+
]
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
//#endregion
|
|
467
|
+
export { $ as Dropzone };
|
|
38
468
|
|
|
39
|
-
|
|
40
|
-
height: 24px;
|
|
41
|
-
|
|
42
|
-
padding: 4px;
|
|
43
|
-
border: none;
|
|
44
|
-
border-radius: 50%;
|
|
45
|
-
background-color: transparent;
|
|
46
|
-
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
transition: all 0.3s ease;
|
|
49
|
-
|
|
50
|
-
color: ${De.neutral[500]};
|
|
51
|
-
|
|
52
|
-
&:hover {
|
|
53
|
-
background-color: ${De.neutral[40]};
|
|
54
|
-
transition: all 0.3s ease;
|
|
55
|
-
}
|
|
56
|
-
`;import{Fragment as zo,jsx as x,jsxs as Do}from"react/jsx-runtime";var ve=({showDeleteAllFilesButton:e=!0,placeholder:t,fileItemProps:r,initialValue:o=[],onClean:n,onReset:p,tratamentoFilesOnChange:l,onNotification:i,...u})=>{let[d,m]=po(o),g=s=>{let h=s.filter(c=>c.valid===!0);if(m(h),s.length>0){let c=s.filter(b=>b.valid===!1);c.length===1?i({variant:"warning",duration:5e3,title:`Arquivo ${c[0].file.name} inv\xE1lido`,message:c[0].errors?.[0]}):c.length>1&&c.forEach(b=>{i({variant:"warning",duration:5e3,title:`Arquivo ${b.file.name} inv\xE1lido`,message:b.errors?.[0]})})}},y=()=>{m([]),p?.()},k=s=>{let h=d.filter(c=>c.id!==s.id);m(h),n?.(h)};return so(()=>{o.length&&m(o)},[o]),x(co,{localization:"PT-pt",header:!1,footer:!1,headerClassName:"header",view:"grid",value:d,...u,onChange:async s=>{let h=s;if(l){let c=await l(s);c&&(h=c)}g(h),u.onChange?.(h)},children:d.length===0?x("div",{children:t||"Arraste os arquivos aqui ou clique para selecionar"}):Do(zo,{children:[e&&x(fo,{title:x(go,{variant:"bodyMD",children:"Remover"}),children:x(ye,{onClick:s=>{s.preventDefault(),s.stopPropagation(),y()},children:x(uo,{icon:ho,size:"24px"})})}),x("div",{style:{display:"flex"},children:d?.map(s=>x(mo,{info:!0,localization:"PT-pt",preview:!0,...s,...r,onDelete:()=>k(s)},s.id))})]})})};export{ve as Dropzone,ve as DropzoneV1,ao as DropzoneV2};
|
|
469
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/dropzone/dropzone.styles.ts","../src/dropzone/dropzoneList/components/dropzoneHeaderClear.tsx","../src/dropzone/dropzoneList/components/dropzoneHeaderContainer.tsx","../src/dropzone/dropzoneList/components/dropzoneHeaderTitle.tsx","../src/dropzone/dropzoneList/components/dropzoneHeader.tsx","../src/dropzone/dropzoneList/dropzoneList.styles.ts","../src/dropzone/utils/dropzoneUtils.ts","../src/dropzone/dropzoneList/useDropzoneList.ts","../src/dropzone/dropzoneList/dropzoneList.tsx","../src/dropzone/dropzoneUploadInfo/dropzoneUploadInfo.tsx","../src/dropzone/dropzoneFileHandlers/dropzoneFileHandlers.ts","../src/dropzone/utils/dragDropUtils.ts","../src/dropzone/useDropzone.ts","../src/dropzone/dropzone.tsx"],"sourcesContent":["import type { HtmlHTMLAttributes } from 'react';\n\nimport { colorPalette } from '@s_mart/tokens';\n\nimport { Button, type ButtonProps, styled } from '@mui/material';\n\nimport type {\n DropzoneComponent,\n DropzoneLabelContainerAttrs,\n DropzoneOverlayAttrs,\n} from './dropzone.types';\n\nexport const DropzoneRoot: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')`\n min-width: 300px;\n align-items: center;\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 8px;\n padding: 16px;\n`;\n\nexport const DropzoneOverlay: DropzoneComponent<\n HtmlHTMLAttributes<HTMLDivElement>,\n DropzoneOverlayAttrs\n> = styled('div')`\n display: none;\n position: absolute;\n z-index: 20;\n top: 0;\n left: 0;\n height: 0;\n width: 0;\n border: 0px dashed ${colorPalette.neutral[500]};\n border-radius: 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n\n &[data-is-dragging='true'] {\n display: flex;\n background-color: rgba(0, 0, 0, 0.3);\n height: 99%;\n width: 99.3%;\n border-width: 2px;\n }\n`;\nexport const DropzoneLabelContainer: DropzoneComponent<ButtonProps, DropzoneLabelContainerAttrs> =\n styled(Button)(({ theme }) => ({\n width: '100%',\n pointerEvents: 'all',\n minHeight: '40px',\n backgroundColor: theme.palette.primary.main,\n borderRadius: Number.parseFloat(theme.shape.borderRadius.toString()) * 2,\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n gap: '8px',\n padding: '.5rem 1rem',\n cursor: 'pointer',\n transition: 'all 0.5s ease',\n\n '&[data-max-files=\"1\"]': {\n minHeight: 0,\n },\n\n '&[data-has-files=\"true\"]': {\n height: '40px',\n },\n\n // Se tiver arquivos e o máximo de arquivos for 1\n '&[data-has-files=\"true\"][data-max-files=\"1\"]': {\n height: 0,\n },\n\n '&[data-has-files=\"true\"] #dropzone-upload-info': {\n display: 'none',\n },\n\n // Se não tiver arquivos || tiver maximo de arquivos == 1 aplica no #dropzone-upload-more-label\n '&:not([data-has-files=\"true\"]) #dropzone-upload-more-label, &[data-max-files=\"1\"] #dropzone-upload-more-label':\n {\n display: 'none',\n },\n\n '& #dropzone-upload-more-label': {\n pointerEvents: 'all',\n color: 'white',\n },\n\n // Se estiver processando zip, aplica no root e no #dropzone-upload-more-label\n '&[data-is-processing-zip=\"true\"], &[data-is-processing-zip=\"true\"] #dropzone-upload-more-label':\n {\n pointerEvents: 'none',\n },\n\n '&:hover': {\n backgroundColor: theme.palette.primary.dark,\n },\n }));\n","import { Tooltip } from '@mui/material';\nimport { IconButton, LIcon } from '@s_mart/core';\nimport { lineTimes } from '@s_mart/regular-icons';\nimport { deepMerge } from '@s_mart/utils';\nimport type { DropzoneHeaderClearProps, DropzoneHeaderClearSlotProps } from './dropzoneHeaderClear.types';\n\nconst defaultProps: Required<DropzoneHeaderClearSlotProps['slotProps']> = {\n headerCleartooltip: { title: 'Remover todos' },\n headerClearIconButton: { variant: 'text', color: 'neutral', sx: { borderRadius: 50 } },\n headerClearLicon: { icon: lineTimes, removeMargin: true },\n} as const;\n\nexport const DropzoneHeaderClear = ({ onClick, slotProps }: DropzoneHeaderClearProps) => {\n const slotPropsTooltip = deepMerge(defaultProps.headerCleartooltip, slotProps?.headerCleartooltip);\n const slotPropsIconButton = deepMerge(defaultProps.headerClearIconButton, slotProps?.headerClearIconButton);\n const slotPropsLIcon = deepMerge(defaultProps.headerClearLicon, slotProps?.headerClearLicon);\n\n return (\n <Tooltip {...slotPropsTooltip}>\n <IconButton {...slotPropsIconButton} onClick={onClick}>\n <LIcon {...slotPropsLIcon} />\n </IconButton>\n </Tooltip>\n );\n};\n","import { styled } from '@mui/material';\n\nexport const DropzoneHeaderContainer = styled('div')({\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n paddingBlock: '0.5rem',\n});\n","import { Typography } from '@mui/material';\nimport { useMemo } from 'react';\nimport { deepMerge } from '@s_mart/utils';\nimport type {\n DropzoneHeaderTitleBaseProps,\n DropzoneHeaderTitleProps,\n DropzoneHeaderTitleSlotProps,\n DropzoneHeaderTitleSlots,\n} from './dropzoneHeaderTitle.types';\n\nconst defaultProps: Required<DropzoneHeaderTitleSlotProps> = {\n headerTitle: { variant: 'titleXXS' },\n};\nconst defaultSlots: Required<DropzoneHeaderTitleSlots> = {\n headerTitleContent: (props) => <Content {...props} />,\n};\n\nconst Content = (props: DropzoneHeaderTitleBaseProps) => {\n let title = `${props.filesLengthLabel}`;\n if (props.showFilesSize) {\n title += ` - ${props.filesTotalSize}`;\n }\n return <>{title}</>;\n};\n\nexport const DropzoneHeaderTitle = (props: DropzoneHeaderTitleProps) => {\n const SlotContent = props.slots?.headerTitleContent ?? defaultSlots.headerTitleContent;\n\n const slotPropsTitle = useMemo(\n () =>\n deepMerge(defaultProps.headerTitle, {\n ...props,\n ...props.slotProps?.headerTitle,\n }),\n [props.filesLengthLabel, props.filesTotalSize, props],\n );\n\n return (\n <Typography {...slotPropsTitle}>\n <SlotContent {...slotPropsTitle} />\n </Typography>\n );\n};\n","import { DropzoneHeaderClear } from './dropzoneHeaderClear';\nimport { DropzoneHeaderContainer } from './dropzoneHeaderContainer';\nimport { DropzoneHeaderTitle } from './dropzoneHeaderTitle';\n\nexport const DropzoneHeader = {\n Container: DropzoneHeaderContainer,\n Title: DropzoneHeaderTitle,\n ClearButton: DropzoneHeaderClear,\n};\n","import { styled, Typography } from '@mui/material';\nimport { colorPalette } from '@s_mart/tokens';\nimport type { HtmlHTMLAttributes } from 'react';\nimport type { DropzoneComponent } from '../dropzone.types';\n\nexport const FilesContainer: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')(({ theme }) => ({\n width: '100%',\n maxHeight: '300px',\n backgroundColor: colorPalette.neutral[20],\n borderRadius: Number.parseFloat(theme.shape.borderRadius.toString()) * 2,\n display: 'flex',\n flexDirection: 'column',\n border: `1px solid ${colorPalette.neutral[20]}`,\n padding: '8px',\n gap: '8px',\n}));\n\nexport const FileItemContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')({\n backgroundColor: 'white',\n borderRadius: '16px',\n padding: '8px',\n gap: '24px',\n display: 'grid',\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n alignItems: 'center',\n justifyContent: 'space-between',\n});\n\nexport const ScrollableFileList: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')({\n height: 'auto',\n overflow: 'auto',\n});\n\nexport const FileListContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')({\n position: 'relative',\n width: '100%',\n});\n\nexport const FileRow: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>> = styled('div')({\n top: 0,\n left: 0,\n width: '100%',\n position: 'absolute',\n paddingBottom: '8px', // gap below\n boxSizing: 'border-box',\n});\n\nexport const FileName = styled(Typography)({\n color: colorPalette.neutral[600],\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n textAlign: 'start',\n});\n","import type { PathSourceProps } from '@s_mart/core';\nimport { lineFile, linePicture, lineXMLFile } from '@s_mart/light-icons';\nimport { lineFileCertificate } from '@s_mart/regular-icons';\n\nexport const getFileIcon = (fileType: string): PathSourceProps => {\n switch (fileType) {\n case 'application/xml':\n case 'text/xml':\n return lineXMLFile;\n case 'image/gif':\n case 'image/jpeg':\n case 'image/png':\n case 'image/svg':\n case 'image/webp':\n return linePicture;\n case 'application/pkcs12':\n return lineFileCertificate;\n default:\n return lineFile;\n }\n};\n\nexport const getFileSize = (fileSize: number): string => {\n let result = '';\n\n if (fileSize < 1024) {\n result = `${fileSize} Bytes`;\n } else if (fileSize < 1024 * 1024) {\n result = `${(fileSize / 1024).toFixed(2)} KB`;\n } else if (fileSize < 1024 * 1024 * 1024) {\n result = `${(fileSize / 1024 / 1024).toFixed(2)} MB`;\n }\n\n return result;\n};\n","import { useMemo } from 'react';\nimport { getFileIcon, getFileSize } from '../utils/dropzoneUtils';\nimport type { FileInfo } from './dropzoneList.types';\n\nexport const useDropzoneList = ({ filesInfo }: { filesInfo: FileInfo[] }) => {\n const files = useMemo(() => {\n return filesInfo.map((f) => ({\n name: f.name,\n fileSize: getFileSize(f.size),\n icon: getFileIcon(f.type),\n }));\n }, [filesInfo]);\n\n const headerInfo = useMemo(() => {\n return {\n totalSize: getFileSize(filesInfo.reduce((acc, curr) => acc + curr.size, 0)),\n totalFilesLabel: filesInfo.length === 1 ? '1 arquivo' : `${filesInfo.length} arquivos`,\n };\n }, [filesInfo]);\n\n return { files, headerInfo };\n};\n","import { Tooltip, Typography } from '@mui/material';\nimport { IconButton, LIcon } from '@s_mart/core';\nimport { lineTimes } from '@s_mart/regular-icons';\nimport { colorPalette } from '@s_mart/tokens';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useRef } from 'react';\nimport { DropzoneHeader } from './components/dropzoneHeader';\nimport {\n FileItemContent,\n FileListContent,\n FileName,\n FileRow,\n FilesContainer,\n ScrollableFileList,\n} from './dropzoneList.styles';\nimport type { DropzoneListProps } from './dropzoneList.types';\nimport { useDropzoneList } from './useDropzoneList';\n\nexport const DropzoneList = ({\n filesInfo,\n onRemoveFile,\n onRemoveAllFiles,\n slotProps,\n slots,\n showFilesSize,\n}: DropzoneListProps) => {\n const { files, headerInfo } = useDropzoneList({ filesInfo });\n const scrollAreaRef = useRef<HTMLDivElement | null>(null);\n\n // Necessário o uso de virtualizer pois em alguns casos, usuários importam milhares de documentos\n const rowVirtualizer = useVirtualizer({\n count: files.length,\n getScrollElement: () => scrollAreaRef.current,\n estimateSize: () => 44 + 16,\n overscan: 5,\n });\n\n if (files.length === 0) {\n return null;\n }\n\n return (\n <FilesContainer {...slotProps?.filesContainer}>\n {/* Header stays fixed at the top */}\n <DropzoneHeader.Container>\n <DropzoneHeader.Title\n slots={slots}\n slotProps={slotProps?.header}\n filesLengthLabel={headerInfo.totalFilesLabel}\n filesTotalSize={headerInfo.totalSize}\n showFilesSize={showFilesSize}\n />\n <DropzoneHeader.ClearButton onClick={onRemoveAllFiles} />\n </DropzoneHeader.Container>\n\n {/* Scrollable virtualized file list */}\n <ScrollableFileList ref={scrollAreaRef} {...slotProps?.scrollableFileList}>\n <FileListContent\n {...slotProps?.listContent}\n sx={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n ...slotProps?.listContent,\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => {\n const file = files[virtualRow.index];\n return (\n <FileRow\n key={virtualRow.key}\n sx={{\n height: `${virtualRow.size}px`,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n >\n <Tooltip title={file.name} arrow placement='top'>\n <FileItemContent {...slotProps?.itemContent}>\n <LIcon icon={file.icon} removeMargin size='24px' />\n <Typography variant='titleXXS' color={colorPalette.neutral[600]} sx={{\n whiteSpace: 'nowrap'\n }}>\n {showFilesSize && file.fileSize}\n </Typography>\n <FileName variant='titleXXS'>{file.name}</FileName>\n <IconButton\n variant='text'\n color='neutral'\n sx={{ borderRadius: 50 }}\n onClick={() => onRemoveFile(virtualRow.index)}\n >\n <LIcon icon={lineTimes} removeMargin />\n </IconButton>\n </FileItemContent>\n </Tooltip>\n </FileRow>\n );\n })}\n </FileListContent>\n </ScrollableFileList>\n </FilesContainer>\n );\n};\n","import { CircularProgress, Stack, Typography } from '@mui/material';\nimport { LIcon } from '@s_mart/core';\nimport { lineFileUpload } from '@s_mart/regular-icons';\n\nexport const DropzoneUploadInfo = ({\n placeholder,\n isProcessingZip,\n}: { placeholder: string; isProcessingZip: boolean }) => {\n if (isProcessingZip) {\n return (\n <div>\n <Stack\n id='dropzone-upload-info'\n\n sx={{\n gap: 1,\n alignItems: 'center',\n direction: 'row',\n }}\n >\n <CircularProgress sx={{ color: 'white' }} size={24} />\n <Typography variant='titleSM' color='white'>\n Descompactando zip...\n </Typography>\n </Stack>\n <Stack\n id='dropzone-upload-more-label'\n sx={{\n gap: 1,\n alignItems: 'center',\n direction: 'row',\n }}\n >\n <CircularProgress sx={{ color: 'white' }} size={12} />\n <Typography\n variant='bodySM'\n sx={{\n fontWeight: 700,\n }}\n >\n Descompactando zip...\n </Typography>\n </Stack>\n </div>\n );\n }\n\n return (\n <div>\n <Stack\n id='dropzone-upload-info'\n sx={{\n gap: 1,\n alignItems: 'center',\n direction: 'row',\n }}\n >\n <LIcon icon={lineFileUpload} size='48px' color='white' removeMargin />\n <Typography variant='titleSM' color='white'>\n {placeholder}\n </Typography>\n </Stack>\n <Typography\n id='dropzone-upload-more-label'\n variant='bodySM'\n sx={{\n fontWeight: 700,\n }}\n >\n Carregar mais arquivos\n </Typography>\n </div>\n );\n};\n","export const getFilesAsync = async (dataTransfer: DataTransfer, accept?: string) => {\n let files: File[] = [];\n\n for (const item of dataTransfer.items) {\n if (item.kind !== 'file') {\n continue;\n }\n if (typeof item.webkitGetAsEntry === 'function') {\n const entry = item.webkitGetAsEntry();\n\n if (entry === null) {\n continue;\n }\n\n const entryContent = await readEntryContentAsync(entry);\n files.push(...entryContent);\n continue;\n }\n\n const file = item.getAsFile();\n if (file) {\n files.push(file);\n }\n }\n if (accept !== undefined) {\n files = filterAcceptedFiles(files, accept);\n }\n return files;\n};\n\nconst readEntryContentAsync = (entry: FileSystemEntry) => {\n return new Promise<File[]>((resolve, reject) => {\n let reading = 0;\n const contents: File[] = [];\n\n readEntry(entry);\n\n function readEntry(entry: FileSystemEntry) {\n if (isFile(entry)) {\n reading++;\n entry.file((file) => {\n reading--;\n contents.push(file);\n\n if (reading === 0) {\n resolve(contents);\n }\n });\n } else if (isDirectory(entry)) {\n readReaderContent(entry.createReader());\n }\n }\n\n function readReaderContent(reader: FileSystemDirectoryReader) {\n reading++;\n\n reader.readEntries(function (entries) {\n reading--;\n for (const entry of entries) {\n readEntry(entry);\n }\n\n if (reading === 0) {\n resolve(contents);\n }\n });\n }\n });\n};\n\nconst isDirectory = (entry: FileSystemEntry): entry is FileSystemDirectoryEntry => {\n return entry.isDirectory;\n};\n\nconst isFile = (entry: FileSystemEntry): entry is FileSystemFileEntry => {\n return entry.isFile;\n};\n\nconst filterAcceptedFiles = (files: File[], accept: string) => {\n const filteredFiles: File[] = [];\n\n const acceptedFormats = accept.split(',');\n\n for (const file of files) {\n const fileFormat = `.${file.name.split('.').pop()?.toLowerCase()}`;\n if (acceptedFormats.includes(fileFormat)) {\n filteredFiles.push(file);\n }\n }\n return filteredFiles;\n};\n","export const handleDropUtil: React.DragEventHandler<HTMLDivElement> = (e: React.DragEvent<HTMLDivElement>) => {\n e.stopPropagation();\n e.preventDefault();\n};\n\nexport const handleDragUtil: React.DragEventHandler<HTMLDivElement> = (e: React.DragEvent<HTMLDivElement>) => {\n e.dataTransfer.dropEffect = 'link';\n handleDropUtil(e);\n};\n","import { type ChangeEvent, useCallback, useMemo, useRef, useState } from 'react';\nimport type { UsesDropzoneProps } from './dropzone.types';\nimport { getFilesAsync } from './dropzoneFileHandlers/dropzoneFileHandlers';\nimport { handleDragUtil, handleDropUtil } from './utils/dragDropUtils';\nimport { getFileSize } from './utils/dropzoneUtils';\n\nexport const useDropzone = ({\n onChange,\n filterOnDrop,\n maxSize,\n maxFiles,\n accept,\n onError,\n onWarning,\n files,\n}: UsesDropzoneProps) => {\n const [isDragging, setIsDragging] = useState(false);\n const [isProcessingZip, setIsProcessingZip] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const hasUploaded = useRef(false);\n\n const processZippedFile = useCallback(\n async (file: File): Promise<File[]> => {\n setIsProcessingZip(true);\n const files: File[] = [];\n\n const { BlobReader, BlobWriter, ZipReader } = await import('@zip.js/zip.js').catch(() => {\n throw new Error(\n 'Faça a instalação da biblioteca @zip.js/zip.js para utilizar o Dropzone com exportação de .zip',\n );\n });\n\n const blobReader = new BlobReader(file);\n const zipReader = new ZipReader(blobReader);\n try {\n const zipEntries = await zipReader.getEntries();\n\n for (const entry of zipEntries) {\n if (entry.directory || entry.getData === undefined) {\n continue;\n }\n\n const blobData = await entry.getData(new BlobWriter());\n\n const processedFile = new File([blobData], entry.filename);\n\n files.push(processedFile);\n }\n } catch (error) {\n onError?.('Ocorreu um erro ao processar o arquivo compactado.', error);\n } finally {\n setIsProcessingZip(false);\n await zipReader.close();\n }\n return files;\n },\n [onError],\n );\n\n const validateFormat = useCallback(\n async (files: File[]): Promise<File[]> => {\n if (!accept) return files;\n\n const validated: File[] = [];\n\n for (const file of files) {\n const fileFormat = `.${file.name.split('.').pop()?.toLocaleLowerCase()}`;\n const acceptedFormats = accept.split(',');\n if (!acceptedFormats.includes(fileFormat)) {\n onWarning?.(`O arquivo \"${file.name}\" não é valido, extensões aceitas ${accept}`);\n continue;\n }\n if (fileFormat === '.zip') {\n const unzippedFiles = await processZippedFile(file);\n\n if (!unzippedFiles.length) {\n continue;\n }\n\n const validatedUnzippedfiles = await validateFormat(unzippedFiles);\n\n if (validatedUnzippedfiles.length) {\n validated.push(...validatedUnzippedfiles);\n }\n\n continue;\n }\n validated.push(file);\n }\n return validated;\n },\n [accept, onWarning, processZippedFile],\n );\n\n const handleSetNewFiles = useCallback(\n async (newFiles: File[]) => {\n const filteredFiles = (await filterOnDrop?.(newFiles)) ?? newFiles;\n const validatedFiles = await validateFormat(filteredFiles);\n\n if (maxFiles !== undefined && files.length + validatedFiles.length > maxFiles) {\n onWarning?.(`Quantidade máxima de arquivos ${maxFiles} alcançada`);\n return files;\n }\n\n if (maxSize !== undefined) {\n const currSize = files.reduce((acc, curr) => acc + curr.size, 0);\n const newFilesSize = validatedFiles.reduce((acc, curr) => acc + curr.size, 0);\n\n if (currSize + newFilesSize > maxSize) {\n onWarning?.(`O arquivo é muito grande, O tamanho máximo permitido é ${getFileSize(maxSize)}`);\n return files;\n }\n }\n\n hasUploaded.current = true;\n return [...files, ...validatedFiles];\n },\n [files, filterOnDrop, maxFiles, maxSize, onWarning, validateFormat],\n );\n\n // CLICK AND SELECT FILE HANDLER\n const handleChangeFiles = async (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n const targetFiles = [...e.target.files];\n\n onChange(await handleSetNewFiles(targetFiles));\n }\n };\n\n const handleRemoveFile = useCallback(\n (index: number) => {\n if (inputRef.current?.value) {\n inputRef.current.value = '';\n }\n\n onChange(files.filter((_, fIndex) => fIndex !== index));\n },\n [onChange, files],\n );\n\n const handleRemoveAllFiles = useCallback(() => {\n if (inputRef.current?.value) {\n inputRef.current.value = '';\n }\n onChange([]);\n }, [onChange]);\n\n const filesInfo = useMemo(() => files?.map((f) => ({ size: f.size, type: f.type, name: f.name })) ?? [], [files]);\n\n const treatedAccept = accept ? `${accept.toUpperCase()},${accept.toLowerCase()}` : undefined;\n\n // DRAG-DROP HANDLERS\n const handleDragEnter: React.DragEventHandler<HTMLDivElement> = (evt) => {\n handleDragUtil(evt);\n setIsDragging(true);\n };\n\n const handleDragLeave: React.DragEventHandler<HTMLDivElement> = (evt) => {\n handleDragUtil(evt);\n setIsDragging(false);\n };\n\n const handleDrop: React.DragEventHandler<HTMLDivElement> = async (evt) => {\n handleDropUtil(evt);\n setIsDragging(false);\n\n const targetFiles = await getFilesAsync(evt.dataTransfer, accept);\n handleSetNewFiles(targetFiles);\n };\n\n return {\n inputRef,\n isDragging,\n filesInfo,\n treatedAccept,\n isProcessingZip,\n handleRemoveFile,\n handleRemoveAllFiles,\n handleChangeFiles,\n\n handleDragEnter,\n handleDragLeave,\n handleDrop,\n };\n};\n","import { DropzoneLabelContainer, DropzoneOverlay, DropzoneRoot } from './dropzone.styles';\nimport type { DropzoneProps } from './dropzone.types';\nimport { DropzoneList } from './dropzoneList/dropzoneList';\nimport { DropzoneUploadInfo } from './dropzoneUploadInfo/dropzoneUploadInfo';\nimport { useDropzone } from './useDropzone';\n\nexport const Dropzone = (props: DropzoneProps) => {\n const {\n inputRef,\n filesInfo,\n treatedAccept,\n handleChangeFiles,\n handleRemoveFile,\n handleRemoveAllFiles,\n handleDragEnter,\n handleDragLeave,\n handleDrop,\n isDragging,\n isProcessingZip,\n } = useDropzone(props);\n\n const placeholder = props.placeholder ?? 'Pressione para carregar os arquivos';\n\n return (\n <DropzoneRoot onDragOver={handleDragEnter} {...props.slotProps?.root}>\n <DropzoneOverlay\n data-is-dragging={isDragging}\n onDrop={handleDrop}\n onDragLeave={handleDragLeave}\n {...props.slotProps?.overlay}\n />\n <DropzoneList\n filesInfo={filesInfo}\n onRemoveFile={handleRemoveFile}\n onRemoveAllFiles={handleRemoveAllFiles}\n showFilesSize={props.showFilesSize}\n slotProps={props.slotProps}\n slots={props.slots}\n />\n <DropzoneLabelContainer\n onClick={() => inputRef.current?.click()}\n data-max-files={props.maxFiles}\n data-has-files={Boolean(filesInfo.length)}\n data-is-processing-zip={isProcessingZip}\n {...props.slotProps?.labelContainer}\n >\n <DropzoneUploadInfo placeholder={placeholder} isProcessingZip={isProcessingZip} />\n <input\n ref={inputRef}\n type='file'\n accept={treatedAccept}\n hidden\n onChange={handleChangeFiles}\n multiple={props.maxFiles === undefined || props.maxFiles > 1}\n />\n </DropzoneLabelContainer>\n </DropzoneRoot>\n );\n};\n"],"mappings":";;;;;;;;;;AAYA,IAAa,IAAsE,EAAO,KAAK,CAAC;;;;;;;;GAUnF,IAGT,EAAO,KAAK,CAAC;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package.json
CHANGED
|
@@ -1,60 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/dropzone",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
4
6
|
"main": "./dist/index.mjs",
|
|
5
7
|
"module": "./dist/index.mjs",
|
|
6
|
-
"types": "./dist/index.d.
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
7
9
|
"sideEffects": false,
|
|
8
|
-
"license": "MIT",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist/**"
|
|
11
12
|
],
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"@mui/utils": "^7.2.0",
|
|
15
|
-
"@tanstack/react-virtual": "^3.13.12",
|
|
16
|
-
"tsup": "8.5.0"
|
|
17
|
-
},
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"@emotion/react": "^11.11.4",
|
|
20
|
-
"@emotion/styled": "^11.13.0",
|
|
21
|
-
"@mui/material": "^7.2.0",
|
|
22
|
-
"@mui/system": "^7.2.0",
|
|
23
|
-
"@types/node": ">=22.15.17",
|
|
24
|
-
"@types/react": "^18.3.12 || ^19.0.0",
|
|
25
|
-
"@types/react-dom": "^18.3.1 || ^19.0.0",
|
|
26
|
-
"@zip.js/zip.js": "^2.7.54",
|
|
27
|
-
"axios": "^1.6.7",
|
|
28
|
-
"react": "^18.3.1 || ^19.0.0",
|
|
29
|
-
"react-dom": "^18.3.1 || ^19.0.0",
|
|
30
|
-
"typescript": ">=5.4.2",
|
|
31
|
-
"@s_mart/core": "11.0.3",
|
|
32
|
-
"@s_mart/light-icons": "6.0.26",
|
|
33
|
-
"@s_mart/regular-icons": "6.0.18",
|
|
34
|
-
"@s_mart/tokens": "6.0.0"
|
|
14
|
+
"@tanstack/react-virtual": "^3.14.10"
|
|
35
15
|
},
|
|
36
16
|
"devDependencies": {
|
|
37
|
-
"@emotion/
|
|
17
|
+
"@emotion/styled": "^11.14.1",
|
|
18
|
+
"@mui/material": "^9.3.1",
|
|
19
|
+
"@mui/system": "^9.3.0",
|
|
20
|
+
"@s_mart/core": "16.0.0",
|
|
21
|
+
"@s_mart/light-icons": "16.0.0",
|
|
22
|
+
"@s_mart/regular-icons": "16.0.0",
|
|
23
|
+
"@s_mart/tokens": "16.0.0",
|
|
24
|
+
"@s_mart/utils": "16.0.0",
|
|
25
|
+
"@types/react": "^19.2.18",
|
|
26
|
+
"@types/react-dom": "^19.2.5",
|
|
27
|
+
"@zip.js/zip.js": "^2.8.54",
|
|
28
|
+
"react": "^19.2.8",
|
|
29
|
+
"react-dom": "^19.2.8",
|
|
30
|
+
"typescript": "^7.0.2"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
38
33
|
"@emotion/styled": "^11.13.0",
|
|
39
|
-
"@mui/material": "^
|
|
40
|
-
"@mui/system": "^
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
34
|
+
"@mui/material": "^9.0.0",
|
|
35
|
+
"@mui/system": "^9.0.0",
|
|
36
|
+
"@s_mart/core": "16.0.0",
|
|
37
|
+
"@s_mart/light-icons": "16.0.0",
|
|
38
|
+
"@s_mart/regular-icons": "16.0.0",
|
|
39
|
+
"@s_mart/tokens": "16.0.0",
|
|
40
|
+
"@s_mart/utils": "16.0.0",
|
|
41
|
+
"@types/react": ">=18.3.12",
|
|
42
|
+
"@types/react-dom": ">=18.3.1",
|
|
44
43
|
"@zip.js/zip.js": "^2.7.54",
|
|
45
|
-
"react": "
|
|
46
|
-
"react-dom": "
|
|
47
|
-
"typescript": ">=
|
|
48
|
-
"@s_mart/core": "11.0.3",
|
|
49
|
-
"@s_mart/light-icons": "6.0.26",
|
|
50
|
-
"@s_mart/regular-icons": "6.0.18",
|
|
51
|
-
"@s_mart/tokens": "6.0.0"
|
|
52
|
-
},
|
|
53
|
-
"overrides": {
|
|
54
|
-
"react-is": "^18.3.1"
|
|
44
|
+
"react": ">=18.3.1",
|
|
45
|
+
"react-dom": ">=18.3.1",
|
|
46
|
+
"typescript": ">=7.0.2"
|
|
55
47
|
},
|
|
56
48
|
"scripts": {
|
|
57
|
-
"build": "
|
|
58
|
-
"
|
|
49
|
+
"build": "pnpm run typecheck && vite build",
|
|
50
|
+
"typecheck": "tsc --noEmit"
|
|
59
51
|
}
|
|
60
52
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { StyledComponent } from '@emotion/styled';
|
|
3
|
-
import { ButtonProps, TypographyProps, Theme } from '@mui/material';
|
|
4
|
-
import { MUIStyledCommonProps } from '@mui/system';
|
|
5
|
-
import { HtmlHTMLAttributes, HTMLAttributes } from 'react';
|
|
6
|
-
import { FileValidated } from '@dropzone-ui/react';
|
|
7
|
-
import { DropzoneProps } from '@dropzone-ui/react/build/components/dropzone/components/Dropzone/DropzoneProps';
|
|
8
|
-
import { FileItemProps } from '@dropzone-ui/react/build/components/file-item/components/FileItem/FileItemProps';
|
|
9
|
-
|
|
10
|
-
declare const DropzoneRoot: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
11
|
-
declare const DropzoneOverlay: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>, DropzoneOverlayAttrs>;
|
|
12
|
-
declare const DropzoneLabelContainer: DropzoneComponent<ButtonProps, DropzoneLabelContainerAttrs>;
|
|
13
|
-
|
|
14
|
-
type DropzoneHeaderTitleSlotProps = {
|
|
15
|
-
headerTitle?: DropzoneHeaderTitleBaseProps & TypographyProps;
|
|
16
|
-
};
|
|
17
|
-
type DropzoneHeaderTitleSlots = {
|
|
18
|
-
headerTitleContent?: (props: DropzoneHeaderTitleBaseProps) => JSX.Element;
|
|
19
|
-
};
|
|
20
|
-
type DropzoneHeaderTitleBaseProps = {
|
|
21
|
-
filesLengthLabel?: string;
|
|
22
|
-
filesTotalSize?: string;
|
|
23
|
-
showFilesSize?: boolean;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
declare const FilesContainer: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
27
|
-
declare const FileItemContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
28
|
-
declare const ScrollableFileList: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
29
|
-
declare const FileListContent: DropzoneComponent<HtmlHTMLAttributes<HTMLDivElement>>;
|
|
30
|
-
|
|
31
|
-
type DropzoneV2SlotProps = Partial<{
|
|
32
|
-
root: Parameters<typeof DropzoneRoot>[0];
|
|
33
|
-
overlay: Parameters<typeof DropzoneOverlay>[0];
|
|
34
|
-
header: DropzoneHeaderTitleSlotProps;
|
|
35
|
-
labelContainer: Parameters<typeof DropzoneLabelContainer>[0];
|
|
36
|
-
filesContainer: Parameters<typeof FilesContainer>[0];
|
|
37
|
-
scrollableFileList: Parameters<typeof ScrollableFileList>[0];
|
|
38
|
-
listContent: Parameters<typeof FileListContent>[0];
|
|
39
|
-
itemContent: Parameters<typeof FileItemContent>[0];
|
|
40
|
-
}>;
|
|
41
|
-
type DropzoneComponent<Element extends HTMLAttributes<unknown>, Props extends Record<string, unknown> = Record<string, unknown>> = StyledComponent<MUIStyledCommonProps<Theme>, Element, Props>;
|
|
42
|
-
type DropzoneV2Slots = DropzoneHeaderTitleSlots;
|
|
43
|
-
type DropzoneV2Props = Pick<DropzoneHeaderTitleBaseProps, 'showFilesSize'> & {
|
|
44
|
-
files: File[];
|
|
45
|
-
onChange(files: File[]): void;
|
|
46
|
-
/**
|
|
47
|
-
* Permite filtrar os arquivos que são adicionados
|
|
48
|
-
*
|
|
49
|
-
* É chamado antes de `onChange`
|
|
50
|
-
* @param files Arquivos que serão filtrados
|
|
51
|
-
*/
|
|
52
|
-
filterOnDrop?(files: File[]): Promise<File[]> | File[];
|
|
53
|
-
maxSize?: number;
|
|
54
|
-
maxFiles?: number;
|
|
55
|
-
/**
|
|
56
|
-
* @default 'Pressione para carregar os arquivos'
|
|
57
|
-
*/
|
|
58
|
-
placeholder?: string;
|
|
59
|
-
/**
|
|
60
|
-
* @default undefined Aceita todos os arquivos
|
|
61
|
-
* @example '.png,.jpg,.jpeg'
|
|
62
|
-
*/
|
|
63
|
-
accept?: string;
|
|
64
|
-
/**
|
|
65
|
-
* @description Acessa as propriedades dos componentes internos
|
|
66
|
-
*/
|
|
67
|
-
slotProps?: DropzoneV2SlotProps;
|
|
68
|
-
/**
|
|
69
|
-
* @description Substitui os componentes internos
|
|
70
|
-
*/
|
|
71
|
-
slots?: DropzoneV2Slots;
|
|
72
|
-
/**
|
|
73
|
-
* @param message Mensagem tratado do erro
|
|
74
|
-
* @param errorFromCatch O erro capturado pelo `try catch`
|
|
75
|
-
*/
|
|
76
|
-
onError: (message: string, errorFromCatch: unknown) => void;
|
|
77
|
-
/**
|
|
78
|
-
* @param message Mensagem tratado do erro
|
|
79
|
-
*/
|
|
80
|
-
onWarning: (message: string) => void;
|
|
81
|
-
};
|
|
82
|
-
type DropzoneOverlayAttrs = {
|
|
83
|
-
/**
|
|
84
|
-
* Tipagem somente utilizada para linting para passar data attributes
|
|
85
|
-
*/
|
|
86
|
-
'data-is-dragging': boolean;
|
|
87
|
-
};
|
|
88
|
-
type DropzoneLabelContainerAttrs = {
|
|
89
|
-
/**
|
|
90
|
-
* Tipagem somente utilizada para linting para passar data attributes
|
|
91
|
-
*/
|
|
92
|
-
'data-has-files': boolean;
|
|
93
|
-
'data-max-files': number | undefined;
|
|
94
|
-
'data-is-processing-zip': boolean;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
declare const DropzoneV2: (props: DropzoneV2Props) => react_jsx_runtime.JSX.Element;
|
|
98
|
-
|
|
99
|
-
interface DropzoneOnNotificationProps {
|
|
100
|
-
/**
|
|
101
|
-
* @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
|
|
102
|
-
*/
|
|
103
|
-
title: string;
|
|
104
|
-
/**
|
|
105
|
-
* @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
|
|
106
|
-
*/
|
|
107
|
-
message?: string;
|
|
108
|
-
duration: number;
|
|
109
|
-
variant: 'warning' | 'error' | 'success' | 'info';
|
|
110
|
-
}
|
|
111
|
-
interface DropzoneV1Props extends Omit<DropzoneProps, 'children' | 'onReset' | 'onClean'> {
|
|
112
|
-
children?: React.ReactNode;
|
|
113
|
-
/**
|
|
114
|
-
* @description Prop responsável por exibir o botão de deletar todos os arquivos no canto superior direito do dropzone
|
|
115
|
-
* @default true
|
|
116
|
-
* @type boolean
|
|
117
|
-
*/
|
|
118
|
-
showDeleteAllFilesButton?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* @description Texto que é renderizado no centro do dropzone quando não há arquivos selecionados
|
|
121
|
-
* @default "Arraste os arquivos aqui ou clique para selecionar"
|
|
122
|
-
*/
|
|
123
|
-
placeholder?: React.ReactNode | string;
|
|
124
|
-
/**
|
|
125
|
-
* @description Props que são passadas para o componente FileItem do dropzone
|
|
126
|
-
* @default {}
|
|
127
|
-
*/
|
|
128
|
-
fileItemProps?: FileItemProps;
|
|
129
|
-
/**
|
|
130
|
-
* @description Valor inicial do state que armazena os arquivos selecionados no dropzone
|
|
131
|
-
* @default []
|
|
132
|
-
* @type FileValidated[]
|
|
133
|
-
**/
|
|
134
|
-
initialValue?: DropzoneV1File[];
|
|
135
|
-
/**
|
|
136
|
-
* @description Função que é chamada quando o usuário clica no botão de deletar um arquivo
|
|
137
|
-
* @param files Lista de arquivos que restaram no dropzone
|
|
138
|
-
*/
|
|
139
|
-
onClean?: (files: DropzoneV1File[]) => void;
|
|
140
|
-
/**
|
|
141
|
-
* @description Função que é chamada quando o usuário clica no botão de deletar todos os arquivos
|
|
142
|
-
*/
|
|
143
|
-
onReset?: () => void;
|
|
144
|
-
/**
|
|
145
|
-
* @description Função que é chamada dentro do OnChange para caso necessário fazer um tratamento nos files
|
|
146
|
-
*/
|
|
147
|
-
tratamentoFilesOnChange?: (incomingFiles: FileValidated[]) => Promise<FileValidated[]> | FileValidated[];
|
|
148
|
-
onNotification(param: DropzoneOnNotificationProps): void;
|
|
149
|
-
}
|
|
150
|
-
interface DropzoneV1File extends FileValidated {
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
declare const DropzoneV1: ({ showDeleteAllFilesButton, placeholder, fileItemProps, initialValue, onClean, onReset, tratamentoFilesOnChange, onNotification, ...rest }: DropzoneV1Props) => react_jsx_runtime.JSX.Element;
|
|
154
|
-
|
|
155
|
-
export { DropzoneV1 as Dropzone, type DropzoneV1File as DropzoneFile, type DropzoneV1Props as DropzoneProps, DropzoneV1, type DropzoneV1File, type DropzoneV1Props, DropzoneV2, type DropzoneV2Props, type DropzoneV2SlotProps };
|