@tecsinapse/cortex-react 1.15.0-beta.22 → 1.15.0-beta.23

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.
@@ -9,6 +9,7 @@ var clsx = require('clsx');
9
9
  var io5 = require('react-icons/io5');
10
10
  var cortexCore = require('@tecsinapse/cortex-core');
11
11
  var useManagerHelpers = require('../../hooks/useManagerHelpers.js');
12
+ var Loading = require('../Loading.js');
12
13
 
13
14
  const Manager = ({
14
15
  open,
@@ -17,7 +18,15 @@ const Manager = ({
17
18
  uploadProgressText = "Upload(s) in progress",
18
19
  onClose
19
20
  }) => {
20
- const { min, setMin, regularFiles, folderFiles, totalLength, setFolders } = useManagerHelpers.useManagerHelpers({
21
+ const {
22
+ min,
23
+ setMin,
24
+ regularFiles,
25
+ folderFiles,
26
+ totalLength,
27
+ setFolders,
28
+ isLoading
29
+ } = useManagerHelpers.useManagerHelpers({
21
30
  files
22
31
  });
23
32
  return reactDom.createPortal(
@@ -44,7 +53,8 @@ const Manager = ({
44
53
  {
45
54
  variants: { variant: "filled", size: "square" },
46
55
  onClick: onClose,
47
- children: /* @__PURE__ */ jsxRuntime.jsx(io.IoMdClose, {})
56
+ disabled: isLoading,
57
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Loading.Loading, {}) : /* @__PURE__ */ jsxRuntime.jsx(io.IoMdClose, {})
48
58
  }
49
59
  )
50
60
  ] }),
@@ -16,13 +16,18 @@ const useManagerHelpers = ({
16
16
  [files]
17
17
  );
18
18
  const totalLength = (regularFiles ?? []).length + (folders ?? []).length;
19
+ const isLoading = React.useMemo(
20
+ () => files?.some((file) => file.status === "uploading"),
21
+ [files]
22
+ );
19
23
  return {
20
24
  min,
21
25
  setMin,
22
26
  folderFiles,
23
27
  regularFiles,
24
28
  totalLength,
25
- setFolders
29
+ setFolders,
30
+ isLoading
26
31
  };
27
32
  };
28
33
 
@@ -7,6 +7,7 @@ import { clsx } from 'clsx';
7
7
  import { IoChevronUp, IoChevronDown } from 'react-icons/io5';
8
8
  import { manager } from '@tecsinapse/cortex-core';
9
9
  import { useManagerHelpers } from '../../hooks/useManagerHelpers.js';
10
+ import { Loading } from '../Loading.js';
10
11
 
11
12
  const Manager = ({
12
13
  open,
@@ -15,7 +16,15 @@ const Manager = ({
15
16
  uploadProgressText = "Upload(s) in progress",
16
17
  onClose
17
18
  }) => {
18
- const { min, setMin, regularFiles, folderFiles, totalLength, setFolders } = useManagerHelpers({
19
+ const {
20
+ min,
21
+ setMin,
22
+ regularFiles,
23
+ folderFiles,
24
+ totalLength,
25
+ setFolders,
26
+ isLoading
27
+ } = useManagerHelpers({
19
28
  files
20
29
  });
21
30
  return createPortal(
@@ -42,7 +51,8 @@ const Manager = ({
42
51
  {
43
52
  variants: { variant: "filled", size: "square" },
44
53
  onClick: onClose,
45
- children: /* @__PURE__ */ jsx(IoMdClose, {})
54
+ disabled: isLoading,
55
+ children: isLoading ? /* @__PURE__ */ jsx(Loading, {}) : /* @__PURE__ */ jsx(IoMdClose, {})
46
56
  }
47
57
  )
48
58
  ] }),
@@ -14,13 +14,18 @@ const useManagerHelpers = ({
14
14
  [files]
15
15
  );
16
16
  const totalLength = (regularFiles ?? []).length + (folders ?? []).length;
17
+ const isLoading = useMemo(
18
+ () => files?.some((file) => file.status === "uploading"),
19
+ [files]
20
+ );
17
21
  return {
18
22
  min,
19
23
  setMin,
20
24
  folderFiles,
21
25
  regularFiles,
22
26
  totalLength,
23
- setFolders
27
+ setFolders,
28
+ isLoading
24
29
  };
25
30
  };
26
31
 
@@ -11,4 +11,5 @@ export declare const useManagerHelpers: <T>({ files, }: {
11
11
  status: string;
12
12
  path: string;
13
13
  }[]][] | undefined>>;
14
+ isLoading: boolean | undefined;
14
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.15.0-beta.22",
3
+ "version": "1.15.0-beta.23",
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": "58b0314be0bad4ed1f27d33d00c97390665a3cf8"
51
+ "gitHead": "5b5bc581b96f7722478482421cf42e9fe1420a44"
52
52
  }