@s_mart/dropzone 16.1.0 → 16.1.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.mjs +55 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { colorPalette as e } from "@s_mart/tokens";
|
|
2
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useCallback as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
4
|
+
import { IconButton as d, LIcon as f } from "@s_mart/core";
|
|
5
|
+
import { lineFileCertificate as p, lineFileUpload as m, lineTimes as h } from "@s_mart/regular-icons";
|
|
6
|
+
import { useVirtualizer as g } from "@tanstack/react-virtual";
|
|
7
7
|
import { deepMerge as _ } from "@s_mart/utils";
|
|
8
8
|
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
9
9
|
import { lineFile as x, linePicture as S, lineXMLFile as C } from "@s_mart/light-icons";
|
|
@@ -70,17 +70,17 @@ var w = o("div")`
|
|
|
70
70
|
sx: { borderRadius: 50 }
|
|
71
71
|
},
|
|
72
72
|
headerClearLicon: {
|
|
73
|
-
icon:
|
|
73
|
+
icon: h,
|
|
74
74
|
removeMargin: !0
|
|
75
75
|
}
|
|
76
76
|
}, O = ({ onClick: e, slotProps: t }) => {
|
|
77
77
|
let n = _(D.headerCleartooltip, t?.headerCleartooltip), r = _(D.headerClearIconButton, t?.headerClearIconButton), a = _(D.headerClearLicon, t?.headerClearLicon);
|
|
78
78
|
return /* @__PURE__ */ y(i, {
|
|
79
79
|
...n,
|
|
80
|
-
children: /* @__PURE__ */ y(
|
|
80
|
+
children: /* @__PURE__ */ y(d, {
|
|
81
81
|
...r,
|
|
82
82
|
onClick: e,
|
|
83
|
-
children: /* @__PURE__ */ y(
|
|
83
|
+
children: /* @__PURE__ */ y(f, { ...a })
|
|
84
84
|
})
|
|
85
85
|
});
|
|
86
86
|
}, k = o("div")({
|
|
@@ -94,7 +94,7 @@ var w = o("div")`
|
|
|
94
94
|
}, N = {
|
|
95
95
|
Container: k,
|
|
96
96
|
Title: (e) => {
|
|
97
|
-
let t = e.slots?.headerTitleContent ?? j.headerTitleContent, n =
|
|
97
|
+
let t = e.slots?.headerTitleContent ?? j.headerTitleContent, n = c(() => _(A.headerTitle, {
|
|
98
98
|
...e,
|
|
99
99
|
...e.slotProps?.headerTitle
|
|
100
100
|
}), [
|
|
@@ -155,39 +155,39 @@ var w = o("div")`
|
|
|
155
155
|
case "image/png":
|
|
156
156
|
case "image/svg":
|
|
157
157
|
case "image/webp": return S;
|
|
158
|
-
case "application/pkcs12": return
|
|
158
|
+
case "application/pkcs12": return p;
|
|
159
159
|
default: return x;
|
|
160
160
|
}
|
|
161
161
|
}, V = (e) => {
|
|
162
162
|
let t = "";
|
|
163
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
164
|
}, H = ({ filesInfo: e }) => ({
|
|
165
|
-
files:
|
|
165
|
+
files: c(() => e.map((e) => ({
|
|
166
166
|
name: e.name,
|
|
167
167
|
fileSize: V(e.size),
|
|
168
168
|
icon: B(e.type)
|
|
169
169
|
})), [e]),
|
|
170
|
-
headerInfo:
|
|
170
|
+
headerInfo: c(() => ({
|
|
171
171
|
totalSize: V(e.reduce((e, t) => e + t.size, 0)),
|
|
172
172
|
totalFilesLabel: e.length === 1 ? "1 arquivo" : `${e.length} arquivos`
|
|
173
173
|
}), [e])
|
|
174
|
-
}), U = ({ filesInfo: t, onRemoveFile: n, onRemoveAllFiles: r, slotProps: o, slots:
|
|
175
|
-
let { files:
|
|
176
|
-
count:
|
|
177
|
-
getScrollElement: () =>
|
|
174
|
+
}), U = ({ filesInfo: t, onRemoveFile: n, onRemoveAllFiles: r, slotProps: o, slots: s, showFilesSize: c }) => {
|
|
175
|
+
let { files: u, headerInfo: p } = H({ filesInfo: t }), m = l(null), _ = g({
|
|
176
|
+
count: u.length,
|
|
177
|
+
getScrollElement: () => m.current,
|
|
178
178
|
estimateSize: () => 60,
|
|
179
179
|
overscan: 5
|
|
180
180
|
});
|
|
181
|
-
return
|
|
181
|
+
return u.length === 0 ? null : /* @__PURE__ */ b(P, {
|
|
182
182
|
...o?.filesContainer,
|
|
183
183
|
children: [/* @__PURE__ */ b(N.Container, { children: [/* @__PURE__ */ y(N.Title, {
|
|
184
|
-
slots:
|
|
184
|
+
slots: s,
|
|
185
185
|
slotProps: o?.header,
|
|
186
|
-
filesLengthLabel:
|
|
187
|
-
filesTotalSize:
|
|
188
|
-
showFilesSize:
|
|
186
|
+
filesLengthLabel: p.totalFilesLabel,
|
|
187
|
+
filesTotalSize: p.totalSize,
|
|
188
|
+
showFilesSize: c
|
|
189
189
|
}), /* @__PURE__ */ y(N.ClearButton, { onClick: r })] }), /* @__PURE__ */ y(I, {
|
|
190
|
-
ref:
|
|
190
|
+
ref: m,
|
|
191
191
|
...o?.scrollableFileList,
|
|
192
192
|
children: /* @__PURE__ */ y(L, {
|
|
193
193
|
...o?.listContent,
|
|
@@ -196,7 +196,7 @@ var w = o("div")`
|
|
|
196
196
|
...o?.listContent
|
|
197
197
|
},
|
|
198
198
|
children: _.getVirtualItems().map((t) => {
|
|
199
|
-
let r =
|
|
199
|
+
let r = u[t.index];
|
|
200
200
|
return /* @__PURE__ */ y(R, {
|
|
201
201
|
sx: {
|
|
202
202
|
height: `${t.size}px`,
|
|
@@ -209,28 +209,30 @@ var w = o("div")`
|
|
|
209
209
|
children: /* @__PURE__ */ b(F, {
|
|
210
210
|
...o?.itemContent,
|
|
211
211
|
children: [
|
|
212
|
-
/* @__PURE__ */ y(
|
|
212
|
+
/* @__PURE__ */ y(f, {
|
|
213
213
|
icon: r.icon,
|
|
214
214
|
removeMargin: !0,
|
|
215
215
|
size: "24px"
|
|
216
216
|
}),
|
|
217
217
|
/* @__PURE__ */ y(a, {
|
|
218
218
|
variant: "titleXXS",
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
sx: {
|
|
220
|
+
color: e.neutral[600],
|
|
221
|
+
whiteSpace: "nowrap"
|
|
222
|
+
},
|
|
223
|
+
children: c && r.fileSize
|
|
222
224
|
}),
|
|
223
225
|
/* @__PURE__ */ y(z, {
|
|
224
226
|
variant: "titleXXS",
|
|
225
227
|
children: r.name
|
|
226
228
|
}),
|
|
227
|
-
/* @__PURE__ */ y(
|
|
229
|
+
/* @__PURE__ */ y(d, {
|
|
228
230
|
variant: "text",
|
|
229
231
|
color: "neutral",
|
|
230
232
|
sx: { borderRadius: 50 },
|
|
231
233
|
onClick: () => n(t.index),
|
|
232
|
-
children: /* @__PURE__ */ y(
|
|
233
|
-
icon:
|
|
234
|
+
children: /* @__PURE__ */ y(f, {
|
|
235
|
+
icon: h,
|
|
234
236
|
removeMargin: !0
|
|
235
237
|
})
|
|
236
238
|
})
|
|
@@ -254,7 +256,7 @@ var w = o("div")`
|
|
|
254
256
|
size: 24
|
|
255
257
|
}), /* @__PURE__ */ y(a, {
|
|
256
258
|
variant: "titleSM",
|
|
257
|
-
color: "white",
|
|
259
|
+
sx: { color: "white" },
|
|
258
260
|
children: "Descompactando zip..."
|
|
259
261
|
})]
|
|
260
262
|
}), /* @__PURE__ */ b(r, {
|
|
@@ -279,14 +281,14 @@ var w = o("div")`
|
|
|
279
281
|
alignItems: "center",
|
|
280
282
|
direction: "row"
|
|
281
283
|
},
|
|
282
|
-
children: [/* @__PURE__ */ y(
|
|
283
|
-
icon:
|
|
284
|
+
children: [/* @__PURE__ */ y(f, {
|
|
285
|
+
icon: m,
|
|
284
286
|
size: "48px",
|
|
285
287
|
color: "white",
|
|
286
288
|
removeMargin: !0
|
|
287
289
|
}), /* @__PURE__ */ y(a, {
|
|
288
290
|
variant: "titleSM",
|
|
289
|
-
color: "white",
|
|
291
|
+
sx: { color: "white" },
|
|
290
292
|
children: e
|
|
291
293
|
})]
|
|
292
294
|
}), /* @__PURE__ */ y(a, {
|
|
@@ -335,9 +337,9 @@ var w = o("div")`
|
|
|
335
337
|
e.stopPropagation(), e.preventDefault();
|
|
336
338
|
}, Z = (e) => {
|
|
337
339
|
e.dataTransfer.dropEffect = "link", X(e);
|
|
338
|
-
}, Q = ({ onChange: e, filterOnDrop: t, maxSize: n, maxFiles: r, accept: i, onError: a, onWarning: o, files:
|
|
339
|
-
let [
|
|
340
|
-
|
|
340
|
+
}, Q = ({ onChange: e, filterOnDrop: t, maxSize: n, maxFiles: r, accept: i, onError: a, onWarning: o, files: d }) => {
|
|
341
|
+
let [f, p] = u(!1), [m, h] = u(!1), g = l(null), _ = l(!1), v = s(async (e) => {
|
|
342
|
+
h(!0);
|
|
341
343
|
let t = [], { BlobReader: n, BlobWriter: r, ZipReader: i } = await import("@zip.js/zip.js").catch(() => {
|
|
342
344
|
throw Error("Faça a instalação da biblioteca @zip.js/zip.js para utilizar o Dropzone com exportação de .zip");
|
|
343
345
|
}), o = new i(new n(e));
|
|
@@ -351,10 +353,10 @@ var w = o("div")`
|
|
|
351
353
|
} catch (e) {
|
|
352
354
|
a?.("Ocorreu um erro ao processar o arquivo compactado.", e);
|
|
353
355
|
} finally {
|
|
354
|
-
|
|
356
|
+
h(!1), await o.close();
|
|
355
357
|
}
|
|
356
358
|
return t;
|
|
357
|
-
}, [a]), y =
|
|
359
|
+
}, [a]), y = s(async (e) => {
|
|
358
360
|
if (!i) return e;
|
|
359
361
|
let t = [];
|
|
360
362
|
for (let n of e) {
|
|
@@ -377,11 +379,11 @@ var w = o("div")`
|
|
|
377
379
|
i,
|
|
378
380
|
o,
|
|
379
381
|
v
|
|
380
|
-
]), b =
|
|
382
|
+
]), b = s(async (e) => {
|
|
381
383
|
let i = await t?.(e) ?? e, a = await y(i);
|
|
382
|
-
return r !== void 0 &&
|
|
384
|
+
return r !== void 0 && d.length + a.length > r ? (o?.(`Quantidade máxima de arquivos ${r} alcançada`), d) : n !== void 0 && d.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)}`), d) : (_.current = !0, [...d, ...a]);
|
|
383
385
|
}, [
|
|
384
|
-
|
|
386
|
+
d,
|
|
385
387
|
t,
|
|
386
388
|
r,
|
|
387
389
|
n,
|
|
@@ -392,32 +394,32 @@ var w = o("div")`
|
|
|
392
394
|
let n = [...t.target.files];
|
|
393
395
|
e(await b(n));
|
|
394
396
|
}
|
|
395
|
-
}, S =
|
|
396
|
-
|
|
397
|
-
}, [e,
|
|
398
|
-
|
|
397
|
+
}, S = s((t) => {
|
|
398
|
+
g.current?.value && (g.current.value = ""), e(d.filter((e, n) => n !== t));
|
|
399
|
+
}, [e, d]), C = s(() => {
|
|
400
|
+
g.current?.value && (g.current.value = ""), e([]);
|
|
399
401
|
}, [e]);
|
|
400
402
|
return {
|
|
401
|
-
inputRef:
|
|
402
|
-
isDragging:
|
|
403
|
-
filesInfo:
|
|
403
|
+
inputRef: g,
|
|
404
|
+
isDragging: f,
|
|
405
|
+
filesInfo: c(() => d?.map((e) => ({
|
|
404
406
|
size: e.size,
|
|
405
407
|
type: e.type,
|
|
406
408
|
name: e.name
|
|
407
|
-
})) ?? [], [
|
|
409
|
+
})) ?? [], [d]),
|
|
408
410
|
treatedAccept: i ? `${i.toUpperCase()},${i.toLowerCase()}` : void 0,
|
|
409
|
-
isProcessingZip:
|
|
411
|
+
isProcessingZip: m,
|
|
410
412
|
handleRemoveFile: S,
|
|
411
413
|
handleRemoveAllFiles: C,
|
|
412
414
|
handleChangeFiles: x,
|
|
413
415
|
handleDragEnter: (e) => {
|
|
414
|
-
Z(e),
|
|
416
|
+
Z(e), p(!0);
|
|
415
417
|
},
|
|
416
418
|
handleDragLeave: (e) => {
|
|
417
|
-
Z(e),
|
|
419
|
+
Z(e), p(!1);
|
|
418
420
|
},
|
|
419
421
|
handleDrop: async (e) => {
|
|
420
|
-
X(e),
|
|
422
|
+
X(e), p(!1);
|
|
421
423
|
let t = await G(e.dataTransfer, i);
|
|
422
424
|
b(t);
|
|
423
425
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +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.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CAAA,GACjF,kBAAC,SAAD;KACE,KAAK;KACL,MAAK;KACL,QAAQ;KACR,QAAA;KACA,UAAU;KACV,UAAU,EAAM,aAAa,KAAA,KAAa,EAAM,WAAW;IAC5D,CAAA,CACqB;;EACZ;;AAElB"}
|
|
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 { useRef } from 'react';\n\nimport { IconButton, LIcon } from '@s_mart/core';\nimport { lineTimes } from '@s_mart/regular-icons';\nimport { colorPalette } from '@s_mart/tokens';\n\nimport { Tooltip, Typography } from '@mui/material';\nimport { useVirtualizer } from '@tanstack/react-virtual';\n\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\n variant='titleXXS'\n sx={{\n color: colorPalette.neutral[600],\n whiteSpace: 'nowrap',\n }}\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 { LIcon } from '@s_mart/core';\nimport { lineFileUpload } from '@s_mart/regular-icons';\n\nimport { CircularProgress, Stack, Typography } from '@mui/material';\n\nexport const DropzoneUploadInfo = ({\n placeholder,\n isProcessingZip,\n}: {\n placeholder: string;\n isProcessingZip: boolean;\n}) => {\n if (isProcessingZip) {\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 <CircularProgress sx={{ color: 'white' }} size={24} />\n <Typography variant='titleSM' sx={{ 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' sx={{ 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 </DropzoneL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,GACjF,kBAAC,SAAD;KACE,KAAK;KACL,MAAK;KACL,QAAQ;KACR,QAAA;KACA,UAAU;KACV,UAAU,EAAM,aAAa,KAAA,KAAa,EAAM,WAAW;IAC5D,CAAA,CACqB;;EACZ;;AAElB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/dropzone",
|
|
3
|
-
"version": "16.1.
|
|
3
|
+
"version": "16.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"@emotion/styled": "^11.14.1",
|
|
18
18
|
"@mui/material": "^9.3.1",
|
|
19
19
|
"@mui/system": "^9.3.0",
|
|
20
|
-
"@s_mart/core": "16.1.
|
|
21
|
-
"@s_mart/light-icons": "16.1.
|
|
22
|
-
"@s_mart/regular-icons": "16.1.
|
|
23
|
-
"@s_mart/tokens": "16.1.
|
|
24
|
-
"@s_mart/utils": "16.1.
|
|
20
|
+
"@s_mart/core": "16.1.1",
|
|
21
|
+
"@s_mart/light-icons": "16.1.1",
|
|
22
|
+
"@s_mart/regular-icons": "16.1.1",
|
|
23
|
+
"@s_mart/tokens": "16.1.1",
|
|
24
|
+
"@s_mart/utils": "16.1.1",
|
|
25
25
|
"@types/react": "^19.2.18",
|
|
26
26
|
"@types/react-dom": "^19.2.5",
|
|
27
27
|
"@zip.js/zip.js": "^2.8.54",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@emotion/styled": "^11.13.0",
|
|
34
34
|
"@mui/material": "^9.0.0",
|
|
35
35
|
"@mui/system": "^9.0.0",
|
|
36
|
-
"@s_mart/core": "16.1.
|
|
37
|
-
"@s_mart/light-icons": "16.1.
|
|
38
|
-
"@s_mart/regular-icons": "16.1.
|
|
39
|
-
"@s_mart/tokens": "16.1.
|
|
40
|
-
"@s_mart/utils": "16.1.
|
|
36
|
+
"@s_mart/core": "16.1.1",
|
|
37
|
+
"@s_mart/light-icons": "16.1.1",
|
|
38
|
+
"@s_mart/regular-icons": "16.1.1",
|
|
39
|
+
"@s_mart/tokens": "16.1.1",
|
|
40
|
+
"@s_mart/utils": "16.1.1",
|
|
41
41
|
"@types/react": ">=18.3.12",
|
|
42
42
|
"@types/react-dom": ">=18.3.1",
|
|
43
43
|
"@zip.js/zip.js": "^2.7.54",
|