@tecsinapse/cortex-react 1.15.0-beta.3 → 1.15.0-beta.5
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/Manager.js +8 -7
- package/dist/cjs/components/Uploader/Upload.js +1 -1
- package/dist/cjs/hooks/useFileUpload.js +6 -3
- package/dist/cjs/styles/progressBar.js +1 -1
- package/dist/esm/components/Uploader/Manager.js +9 -8
- package/dist/esm/components/Uploader/Upload.js +1 -1
- package/dist/esm/hooks/useFileUpload.js +6 -3
- package/dist/esm/styles/progressBar.js +1 -1
- package/dist/types/hooks/useFileUpload.d.ts +2 -1
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ const Manager = ({
|
|
|
23
23
|
"div",
|
|
24
24
|
{
|
|
25
25
|
className: cortexCore.manager({
|
|
26
|
-
className: "h-auto max-h-[350px] w-[450px] overflow-hidden
|
|
26
|
+
className: "h-auto max-h-[350px] w-[450px] overflow-hidden",
|
|
27
27
|
open
|
|
28
28
|
}),
|
|
29
29
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col w-full h-full gap-mili items-center", children: [
|
|
@@ -31,9 +31,9 @@ const Manager = ({
|
|
|
31
31
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
32
|
Button.Button,
|
|
33
33
|
{
|
|
34
|
-
variants: { variant: "
|
|
34
|
+
variants: { variant: "text", size: "square" },
|
|
35
35
|
onClick: () => setMin((min2) => !min2),
|
|
36
|
-
children: min ? /* @__PURE__ */ jsxRuntime.jsx(io5.
|
|
36
|
+
children: min ? /* @__PURE__ */ jsxRuntime.jsx(io5.IoChevronUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(io5.IoChevronDown, {})
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { "data-testid": "upload-progress", children: uploadProgressText }),
|
|
@@ -49,10 +49,11 @@ const Manager = ({
|
|
|
49
49
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
|
-
className: clsx.clsx(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
className: clsx.clsx("w-full h-auto max-h-[300px] gap-mili", {
|
|
53
|
+
hidden: min,
|
|
54
|
+
"flex flex-col": !min,
|
|
55
|
+
"pb-kilo overflow-scroll pr-deca": files.length > 3
|
|
56
|
+
}),
|
|
56
57
|
children: files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
58
|
Upload.File,
|
|
58
59
|
{
|
|
@@ -22,7 +22,7 @@ const File = ({
|
|
|
22
22
|
return "info";
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col w-full", children: [
|
|
26
26
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border rounded-t-mili shadow p-mili", children: [
|
|
27
27
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-centi", children: [
|
|
28
28
|
file.file && file.file.type.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12,7 +12,8 @@ const useFileUpload = ({
|
|
|
12
12
|
maxSize,
|
|
13
13
|
allowMultiple = true,
|
|
14
14
|
preventDuplicates = false,
|
|
15
|
-
onDuplicate
|
|
15
|
+
onDuplicate,
|
|
16
|
+
hasManager = true
|
|
16
17
|
}) => {
|
|
17
18
|
const [files, setFiles] = React.useState([]);
|
|
18
19
|
const [duplicates, setDuplicates] = React.useState([]);
|
|
@@ -40,8 +41,10 @@ const useFileUpload = ({
|
|
|
40
41
|
[]
|
|
41
42
|
);
|
|
42
43
|
const onDrop = async (acceptedFiles) => {
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (hasManager) {
|
|
45
|
+
openManager();
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
45
48
|
let toProcess = acceptedFiles;
|
|
46
49
|
if (preventDuplicates) {
|
|
47
50
|
const found = (acceptedFiles ?? []).filter(
|
|
@@ -4,7 +4,7 @@ var tailwindVariants = require('tailwind-variants');
|
|
|
4
4
|
|
|
5
5
|
const ProgressVariants = tailwindVariants.tv({
|
|
6
6
|
slots: {
|
|
7
|
-
container: "relative
|
|
7
|
+
container: "relative",
|
|
8
8
|
bar: "h-1.5 w-full overflow-hidden bg-secondary-xlight",
|
|
9
9
|
progress: "w-full h-full rounded-mili"
|
|
10
10
|
},
|
|
@@ -5,7 +5,7 @@ import { Button } from '../Button.js';
|
|
|
5
5
|
import { IoMdClose } from 'react-icons/io';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import { clsx } from 'clsx';
|
|
8
|
-
import {
|
|
8
|
+
import { IoChevronUp, IoChevronDown } from 'react-icons/io5';
|
|
9
9
|
import { manager } from '@tecsinapse/cortex-core';
|
|
10
10
|
|
|
11
11
|
const Manager = ({
|
|
@@ -21,7 +21,7 @@ const Manager = ({
|
|
|
21
21
|
"div",
|
|
22
22
|
{
|
|
23
23
|
className: manager({
|
|
24
|
-
className: "h-auto max-h-[350px] w-[450px] overflow-hidden
|
|
24
|
+
className: "h-auto max-h-[350px] w-[450px] overflow-hidden",
|
|
25
25
|
open
|
|
26
26
|
}),
|
|
27
27
|
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col w-full h-full gap-mili items-center", children: [
|
|
@@ -29,9 +29,9 @@ const Manager = ({
|
|
|
29
29
|
/* @__PURE__ */ jsx(
|
|
30
30
|
Button,
|
|
31
31
|
{
|
|
32
|
-
variants: { variant: "
|
|
32
|
+
variants: { variant: "text", size: "square" },
|
|
33
33
|
onClick: () => setMin((min2) => !min2),
|
|
34
|
-
children: min ? /* @__PURE__ */ jsx(
|
|
34
|
+
children: min ? /* @__PURE__ */ jsx(IoChevronUp, {}) : /* @__PURE__ */ jsx(IoChevronDown, {})
|
|
35
35
|
}
|
|
36
36
|
),
|
|
37
37
|
/* @__PURE__ */ jsx("h3", { "data-testid": "upload-progress", children: uploadProgressText }),
|
|
@@ -47,10 +47,11 @@ const Manager = ({
|
|
|
47
47
|
/* @__PURE__ */ jsx(
|
|
48
48
|
"div",
|
|
49
49
|
{
|
|
50
|
-
className: clsx(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
className: clsx("w-full h-auto max-h-[300px] gap-mili", {
|
|
51
|
+
hidden: min,
|
|
52
|
+
"flex flex-col": !min,
|
|
53
|
+
"pb-kilo overflow-scroll pr-deca": files.length > 3
|
|
54
|
+
}),
|
|
54
55
|
children: files.map((file, index) => /* @__PURE__ */ jsx(
|
|
55
56
|
File,
|
|
56
57
|
{
|
|
@@ -20,7 +20,7 @@ const File = ({
|
|
|
20
20
|
return "info";
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col w-full", children: [
|
|
24
24
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border rounded-t-mili shadow p-mili", children: [
|
|
25
25
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-centi", children: [
|
|
26
26
|
file.file && file.file.type.startsWith("image/") ? /* @__PURE__ */ jsx(
|
|
@@ -10,7 +10,8 @@ const useFileUpload = ({
|
|
|
10
10
|
maxSize,
|
|
11
11
|
allowMultiple = true,
|
|
12
12
|
preventDuplicates = false,
|
|
13
|
-
onDuplicate
|
|
13
|
+
onDuplicate,
|
|
14
|
+
hasManager = true
|
|
14
15
|
}) => {
|
|
15
16
|
const [files, setFiles] = useState([]);
|
|
16
17
|
const [duplicates, setDuplicates] = useState([]);
|
|
@@ -38,8 +39,10 @@ const useFileUpload = ({
|
|
|
38
39
|
[]
|
|
39
40
|
);
|
|
40
41
|
const onDrop = async (acceptedFiles) => {
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (hasManager) {
|
|
43
|
+
openManager();
|
|
44
|
+
onClose();
|
|
45
|
+
}
|
|
43
46
|
let toProcess = acceptedFiles;
|
|
44
47
|
if (preventDuplicates) {
|
|
45
48
|
const found = (acceptedFiles ?? []).filter(
|
|
@@ -14,8 +14,9 @@ interface UseFileUploadOptions<T> {
|
|
|
14
14
|
allowMultiple?: boolean;
|
|
15
15
|
preventDuplicates?: boolean;
|
|
16
16
|
onDuplicate?: (duplicates: File[]) => void;
|
|
17
|
+
hasManager?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare const useFileUpload: <T>({ accept, onAccept, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, }: UseFileUploadOptions<T>) => {
|
|
19
|
+
export declare const useFileUpload: <T>({ accept, onAccept, onFileRejected, maxSize, allowMultiple, preventDuplicates, onDuplicate, hasManager, }: UseFileUploadOptions<T>) => {
|
|
19
20
|
onOpen: () => void;
|
|
20
21
|
onClose: () => void;
|
|
21
22
|
onDelete: (index: number) => void;
|
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.5",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@floating-ui/react": "^0.26.18",
|
|
22
22
|
"@internationalized/date": "3.7.0",
|
|
23
|
-
"@tecsinapse/cortex-core": "1.2.0-beta.
|
|
23
|
+
"@tecsinapse/cortex-core": "1.2.0-beta.3",
|
|
24
24
|
"clsx": "2.1.1",
|
|
25
25
|
"currency.js": "2.0.4",
|
|
26
26
|
"embla-carousel-autoplay": "^8.0.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-icons": ">=5.2.0",
|
|
49
49
|
"tailwind": ">=3.3.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9deba6eb8762c778037c64409cabd2ca7878fa95"
|
|
52
52
|
}
|