@tecsinapse/cortex-react 1.15.0-beta.17 → 1.15.0-beta.19
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/cjs/components/Uploader/Dropzone.js +23 -7
- package/dist/cjs/hooks/useFileUpload.js +1 -0
- package/dist/esm/components/Uploader/Dropzone.js +23 -7
- package/dist/esm/hooks/useFileUpload.js +1 -0
- package/dist/types/components/Uploader/Dropzone.d.ts +1 -1
- package/dist/types/components/Uploader/index.d.ts +1 -1
- package/dist/types/components/Uploader/types.d.ts +2 -0
- package/package.json +2 -2
|
@@ -10,7 +10,8 @@ const Dropzone = ({
|
|
|
10
10
|
dropzoneProps,
|
|
11
11
|
selectFileText = "Select a file to start",
|
|
12
12
|
dropText = "By dragging and dropping it here or clicking the button below",
|
|
13
|
-
buttonText = "Select File"
|
|
13
|
+
buttonText = "Select File",
|
|
14
|
+
hasButton = true
|
|
14
15
|
}) => {
|
|
15
16
|
const { getRootProps, getInputProps, isDragActive, isFileLimitReached } = dropzoneProps;
|
|
16
17
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -25,13 +26,28 @@ const Dropzone = ({
|
|
|
25
26
|
),
|
|
26
27
|
children: [
|
|
27
28
|
/* @__PURE__ */ jsxRuntime.jsx("input", { ...getInputProps() }),
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center text-center items-center
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col justify-center text-center items-center", children: [
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
hi2.HiOutlineCloudArrowUp,
|
|
33
|
+
{
|
|
34
|
+
className: "text-primary-medium mb-nano",
|
|
35
|
+
size: 35
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold", "data-testid": "select-dropzone", children: selectFileText })
|
|
33
39
|
] }),
|
|
34
|
-
|
|
40
|
+
hasButton ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-centi", children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-secondary-medium", children: dropText }),
|
|
42
|
+
isFileLimitReached ? /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, { text: "Voc\xEA s\xF3 pode selecionar um \xFAnico arquivo.", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
disabled: true,
|
|
46
|
+
className: clsx(cortexCore.button(), "cursor-not-allowed"),
|
|
47
|
+
children: buttonText
|
|
48
|
+
}
|
|
49
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("button", { className: cortexCore.button(), children: buttonText })
|
|
50
|
+
] }) : null
|
|
35
51
|
] })
|
|
36
52
|
]
|
|
37
53
|
}
|
|
@@ -8,7 +8,8 @@ const Dropzone = ({
|
|
|
8
8
|
dropzoneProps,
|
|
9
9
|
selectFileText = "Select a file to start",
|
|
10
10
|
dropText = "By dragging and dropping it here or clicking the button below",
|
|
11
|
-
buttonText = "Select File"
|
|
11
|
+
buttonText = "Select File",
|
|
12
|
+
hasButton = true
|
|
12
13
|
}) => {
|
|
13
14
|
const { getRootProps, getInputProps, isDragActive, isFileLimitReached } = dropzoneProps;
|
|
14
15
|
return /* @__PURE__ */ jsxs(
|
|
@@ -23,13 +24,28 @@ const Dropzone = ({
|
|
|
23
24
|
),
|
|
24
25
|
children: [
|
|
25
26
|
/* @__PURE__ */ jsx("input", { ...getInputProps() }),
|
|
26
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center text-center items-center
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center text-center items-center", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
HiOutlineCloudArrowUp,
|
|
31
|
+
{
|
|
32
|
+
className: "text-primary-medium mb-nano",
|
|
33
|
+
size: 35
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", "data-testid": "select-dropzone", children: selectFileText })
|
|
31
37
|
] }),
|
|
32
|
-
|
|
38
|
+
hasButton ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-centi", children: [
|
|
39
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-secondary-medium", children: dropText }),
|
|
40
|
+
isFileLimitReached ? /* @__PURE__ */ jsx(Tooltip, { text: "Voc\xEA s\xF3 pode selecionar um \xFAnico arquivo.", children: /* @__PURE__ */ jsx(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
disabled: true,
|
|
44
|
+
className: clsx(button(), "cursor-not-allowed"),
|
|
45
|
+
children: buttonText
|
|
46
|
+
}
|
|
47
|
+
) }) : /* @__PURE__ */ jsx("button", { className: button(), children: buttonText })
|
|
48
|
+
] }) : null
|
|
33
49
|
] })
|
|
34
50
|
]
|
|
35
51
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DropzoneProps } from './types';
|
|
2
|
-
export declare const Dropzone: ({ dropzoneProps, selectFileText, dropText, buttonText, }: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Dropzone: ({ dropzoneProps, selectFileText, dropText, buttonText, hasButton, }: DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './Root';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export declare const Uploader: {
|
|
4
|
-
Dropzone: ({ dropzoneProps, selectFileText, dropText, buttonText, }: import("./types").DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Dropzone: ({ dropzoneProps, selectFileText, dropText, buttonText, hasButton, }: import("./types").DropzoneProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
Files: <T>({ files, onDelete, uploadProgressText, }: import("./types").FilesProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Modal: ({ open, onClose, children, title, }: import("./types").ModalProps) => any;
|
|
7
7
|
Root: <T>({ open, onClose, dropzoneProps, selectFileText, dropText, buttonText, titleModal, onDelete, uploadProgressText, files, }: import("./types").RootUploaderProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -42,6 +42,7 @@ export interface UseDropzoneProps {
|
|
|
42
42
|
getInputProps: <T extends DropzoneInputProps>(props?: T) => T;
|
|
43
43
|
isDragActive: boolean;
|
|
44
44
|
isFileLimitReached: boolean;
|
|
45
|
+
fileRejections: FileRejection[];
|
|
45
46
|
}
|
|
46
47
|
export interface DropzoneProps {
|
|
47
48
|
dropzoneProps: UseDropzoneProps;
|
|
@@ -49,6 +50,7 @@ export interface DropzoneProps {
|
|
|
49
50
|
dropText?: string;
|
|
50
51
|
buttonText?: string;
|
|
51
52
|
isFileLimitReached?: boolean;
|
|
53
|
+
hasButton?: boolean;
|
|
52
54
|
}
|
|
53
55
|
export interface ModalProps {
|
|
54
56
|
open: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.15.0-beta.
|
|
3
|
+
"version": "1.15.0-beta.19",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-icons": ">=5.2.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "44ba1e1be5a8107d47c379d08f0dbbc0643b1cb9"
|
|
52
52
|
}
|