@tecsinapse/cortex-react 1.7.0 → 1.7.3

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.
Files changed (29) hide show
  1. package/dist/cjs/components/Menubar/Category.js +1 -1
  2. package/dist/cjs/components/Menubar/Item.js +32 -2
  3. package/dist/cjs/components/Menubar/ItemLink.js +8 -27
  4. package/dist/cjs/components/Menubar/SubItem.js +15 -1
  5. package/dist/cjs/components/ProgressBar/Progress.js +27 -0
  6. package/dist/cjs/components/ProgressBar/ProgressBar.js +5 -32
  7. package/dist/cjs/components/Uploader/Upload.js +1 -1
  8. package/dist/cjs/styles/menubar.js +3 -3
  9. package/dist/cjs/styles/progressBar.js +15 -30
  10. package/dist/esm/components/Menubar/Category.js +1 -1
  11. package/dist/esm/components/Menubar/Item.js +32 -2
  12. package/dist/esm/components/Menubar/ItemLink.js +8 -27
  13. package/dist/esm/components/Menubar/SubItem.js +15 -1
  14. package/dist/esm/components/ProgressBar/Progress.js +25 -0
  15. package/dist/esm/components/ProgressBar/ProgressBar.js +6 -33
  16. package/dist/esm/components/Uploader/Upload.js +1 -1
  17. package/dist/esm/styles/menubar.js +3 -3
  18. package/dist/esm/styles/progressBar.js +15 -29
  19. package/dist/types/components/ProgressBar/Progress.d.ts +8 -0
  20. package/dist/types/components/ProgressBar/ProgressBar.d.ts +4 -8
  21. package/dist/types/styles/menubar.d.ts +8 -8
  22. package/dist/types/styles/progressBar.d.ts +64 -135
  23. package/package.json +3 -3
  24. package/dist/cjs/components/ProgressBar/ProgressBarInfinite.js +0 -15
  25. package/dist/cjs/components/ProgressBar/ProgressBarSegments.js +0 -48
  26. package/dist/esm/components/ProgressBar/ProgressBarInfinite.js +0 -13
  27. package/dist/esm/components/ProgressBar/ProgressBarSegments.js +0 -46
  28. package/dist/types/components/ProgressBar/ProgressBarInfinite.d.ts +0 -6
  29. package/dist/types/components/ProgressBar/ProgressBarSegments.d.ts +0 -9
@@ -5,7 +5,7 @@ var menubar = require('../../styles/menubar.js');
5
5
 
6
6
  const Category = ({ title, options, render }) => {
7
7
  const { text, hr, container } = menubar.category();
8
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: text() }, title), /* @__PURE__ */ React.createElement("a", null), /* @__PURE__ */ React.createElement("hr", { className: hr() }), /* @__PURE__ */ React.createElement("div", { className: container() }, options.map((i) => render(i))));
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", { className: text() }, title), /* @__PURE__ */ React.createElement("hr", { className: hr() }), /* @__PURE__ */ React.createElement("div", { className: container() }, options.map((i) => render(i))));
9
9
  };
10
10
 
11
11
  module.exports = Category;
@@ -4,8 +4,19 @@ var React = require('react');
4
4
  var menubar = require('../../styles/menubar.js');
5
5
  var IconControlSubItem = require('./IconControlSubItem.js');
6
6
  var ItemLink = require('./ItemLink.js');
7
+ var clsx = require('clsx');
8
+ require('@internationalized/date');
9
+ require('react-aria');
10
+ require('react-stately');
11
+ require('@floating-ui/react');
12
+ require('currency.js');
13
+ require('react-dropzone');
14
+ require('uuid');
15
+ require('../../provider/MenubarContext.js');
16
+ require('../../provider/SnackbarProvider.js');
17
+ var useMenubar = require('../../provider/useMenubar.js');
7
18
 
8
- const { container, text } = menubar.item();
19
+ const { container, textBehavior } = menubar.item();
9
20
  const Item = ({
10
21
  children,
11
22
  subItems,
@@ -16,7 +27,26 @@ const Item = ({
16
27
  }) => {
17
28
  const [showSubItem, setShowSubItem] = React.useState(false);
18
29
  const hasSubItems = (subItems ?? []).length > 0;
19
- return /* @__PURE__ */ React.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React.createElement("div", { "data-testid": "item-menubar", ...rest, className: container() }, /* @__PURE__ */ React.createElement("div", { className: text({ className }) }, children), hasSubItems ? /* @__PURE__ */ React.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React.createElement(React.Fragment, null)), showSubItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React.createElement(React.Fragment, null));
30
+ const [, setShow] = useMenubar.useMenubar();
31
+ return /* @__PURE__ */ React.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React.createElement(
32
+ "div",
33
+ {
34
+ "data-testid": "item-menubar",
35
+ ...rest,
36
+ onClick: (e) => {
37
+ if (hasSubItems) e.stopPropagation();
38
+ else {
39
+ setShow(false);
40
+ }
41
+ },
42
+ className: clsx(
43
+ container({ className }),
44
+ !hasSubItems && textBehavior()
45
+ )
46
+ },
47
+ children,
48
+ hasSubItems ? /* @__PURE__ */ React.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React.createElement(React.Fragment, null)
49
+ ), showSubItem ? /* @__PURE__ */ React.createElement(React.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React.createElement(React.Fragment, null));
20
50
  };
21
51
 
22
52
  module.exports = Item;
@@ -2,37 +2,18 @@
2
2
 
3
3
  var React = require('react');
4
4
  var clsx = require('clsx');
5
- require('@internationalized/date');
6
- require('react-aria');
7
- require('react-stately');
8
- require('@floating-ui/react');
9
- require('currency.js');
10
- require('react-dropzone');
11
- require('uuid');
12
- require('../../provider/MenubarContext.js');
13
- require('../../provider/SnackbarProvider.js');
14
- var useMenubar = require('../../provider/useMenubar.js');
15
5
 
16
6
  const ItemLink = ({ anchorProps, children }) => {
17
- const [, setShow] = useMenubar.useMenubar();
18
- return /* @__PURE__ */ React.createElement(
19
- "div",
7
+ return /* @__PURE__ */ React.createElement("div", null, anchorProps ? /* @__PURE__ */ React.createElement(
8
+ "a",
20
9
  {
21
- onClick: () => {
22
- setShow(false);
23
- }
10
+ target: "_blank",
11
+ rel: "noopener noreferrer",
12
+ ...anchorProps,
13
+ className: clsx("w-full", anchorProps?.className)
24
14
  },
25
- anchorProps ? /* @__PURE__ */ React.createElement(
26
- "a",
27
- {
28
- ...anchorProps,
29
- target: "_blank",
30
- rel: "noopener noreferrer",
31
- className: clsx("w-full", anchorProps?.className)
32
- },
33
- children
34
- ) : children
35
- );
15
+ children
16
+ ) : children);
36
17
  };
37
18
 
38
19
  module.exports = ItemLink;
@@ -3,6 +3,16 @@
3
3
  var React = require('react');
4
4
  var menubar = require('../../styles/menubar.js');
5
5
  var ItemLink = require('./ItemLink.js');
6
+ require('@internationalized/date');
7
+ require('react-aria');
8
+ require('react-stately');
9
+ require('@floating-ui/react');
10
+ require('currency.js');
11
+ require('react-dropzone');
12
+ require('uuid');
13
+ require('../../provider/MenubarContext.js');
14
+ require('../../provider/SnackbarProvider.js');
15
+ var useMenubar = require('../../provider/useMenubar.js');
6
16
 
7
17
  const { container } = menubar.subItem();
8
18
  const SubItem = ({
@@ -11,12 +21,16 @@ const SubItem = ({
11
21
  className,
12
22
  ...rest
13
23
  }) => {
24
+ const [, setShow] = useMenubar.useMenubar();
14
25
  return /* @__PURE__ */ React.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React.createElement(
15
26
  "div",
16
27
  {
17
28
  ...rest,
18
29
  "data-testid": "sub-item-menubar",
19
- className: container({ className })
30
+ className: container({ className }),
31
+ onClick: () => {
32
+ setShow(false);
33
+ }
20
34
  },
21
35
  children
22
36
  ));
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ require('../../styles/calendar-cell.js');
5
+ require('../../styles/groupButton.js');
6
+ var progressBar = require('../../styles/progressBar.js');
7
+
8
+ const { container, bar, progress } = progressBar.ProgressVariants();
9
+ const Progress = ({
10
+ value,
11
+ intent = "default",
12
+ infinite
13
+ }) => {
14
+ return /* @__PURE__ */ React.createElement("div", { className: container(), "data-testid": "linear-progress" }, /* @__PURE__ */ React.createElement("div", { className: bar() }, /* @__PURE__ */ React.createElement(
15
+ "div",
16
+ {
17
+ style: {
18
+ width: !infinite ? `${value}%` : void 0,
19
+ transition: !infinite ? "width 0.5s ease" : void 0
20
+ },
21
+ "data-testid": "progress-filled",
22
+ className: progress({ intent, infinite })
23
+ }
24
+ )));
25
+ };
26
+
27
+ exports.Progress = Progress;
@@ -1,41 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var ProgressBarInfinite = require('./ProgressBarInfinite.js');
5
- var ProgressBarSegments = require('./ProgressBarSegments.js');
4
+ var Progress = require('./Progress.js');
6
5
 
7
6
  const ProgressBar = ({
8
- segments: _segments = 1,
9
- valueMin = 0,
10
- valueMax = 100,
11
- valueCurrent = 50,
12
- intentProgress = "default",
13
- type = "default",
14
- animated = true
7
+ value = 50,
8
+ intent = "default",
9
+ infinite = false
15
10
  }) => {
16
- const [displayedValue, setDisplayedValue] = React.useState(0);
17
- const [showAnimation, setShowAnimation] = React.useState(true);
18
- React.useEffect(() => {
19
- const timeout = setTimeout(() => {
20
- if (valueCurrent < displayedValue) {
21
- setShowAnimation(false);
22
- }
23
- if (animated && valueCurrent > displayedValue) setShowAnimation(true);
24
- setDisplayedValue(valueCurrent);
25
- }, 0);
26
- return () => clearTimeout(timeout);
27
- }, [valueCurrent]);
28
- const totalProgress = (displayedValue - valueMin) / (valueMax - valueMin) * 100;
29
- const segments = Math.max(1, _segments);
30
- return type === "infinite" ? /* @__PURE__ */ React.createElement(ProgressBarInfinite.ProgressBarInfinite, { intentProgress }) : /* @__PURE__ */ React.createElement(
31
- ProgressBarSegments.ProgressBarSegments,
32
- {
33
- segments,
34
- totalProgress,
35
- intentProgress,
36
- showAnimation
37
- }
38
- );
11
+ return /* @__PURE__ */ React.createElement(Progress.Progress, { value, intent, infinite });
39
12
  };
40
13
 
41
14
  exports.ProgressBar = ProgressBar;
@@ -25,7 +25,7 @@ const File = ({ file, index, onDelete }) => {
25
25
  })
26
26
  },
27
27
  /* @__PURE__ */ React.createElement(md.MdClose, { size: 20 })
28
- )), /* @__PURE__ */ React.createElement(ProgressBar.ProgressBar, { intentProgress: file.status, type: "infinite" }));
28
+ )), /* @__PURE__ */ React.createElement(ProgressBar.ProgressBar, { intent: "info", infinite: file.status !== "success" }));
29
29
  };
30
30
 
31
31
  exports.File = File;
@@ -34,15 +34,15 @@ const mostUsedItem = tailwindVariants.tv({
34
34
  });
35
35
  const item = tailwindVariants.tv({
36
36
  slots: {
37
- container: "flex flex-row gap-x-deca items-center",
38
- text: "text-secondary-dark hover:text-primary-medium hover:cursor-pointer text-base",
37
+ container: "flex flex-row gap-x-deca items-center text-secondary-dark text-base",
38
+ textBehavior: "hover:text-primary-medium hover:cursor-pointer text-base",
39
39
  icon: "text-primary-medium hover:cursor-pointer"
40
40
  }
41
41
  });
42
42
  const category = tailwindVariants.tv({
43
43
  slots: {
44
44
  text: "mb-mili font-bold",
45
- hr: "mb-mili",
45
+ hr: "mb-mili border-0 h-px bg-secondary-light",
46
46
  container: "flex flex-col gap-y-mili"
47
47
  }
48
48
  });
@@ -2,51 +2,36 @@
2
2
 
3
3
  var tailwindVariants = require('tailwind-variants');
4
4
 
5
- const progressBarFilled = tailwindVariants.tv({
6
- base: "h-full first:rounded-l-pill last:rounded-r-pill",
7
- variants: {
8
- intentProgress: {
9
- default: "bg-primary-medium",
10
- error: "bg-error-medium",
11
- info: "bg-info-medium",
12
- warning: "bg-warning-medium",
13
- success: "bg-success-medium",
14
- uploading: ""
15
- },
16
- showAnimation: {
17
- true: "transition-[width] duration-1000 ease-linear"
18
- }
19
- }
20
- });
21
- const progressBarInfiniteVariants = tailwindVariants.tv({
5
+ const ProgressVariants = tailwindVariants.tv({
22
6
  slots: {
23
7
  container: "relative mb-mili",
24
- bar: "h-1.5 w-full overflow-hidden",
25
- progress: "w-full h-full origin-left-right rounded-b-mili"
8
+ bar: "h-1.5 w-full overflow-hidden bg-secondary-xlight",
9
+ progress: "w-full h-full rounded-mili"
26
10
  },
27
11
  variants: {
28
- status: {
29
- uploading: {
30
- progress: "bg-info-medium animate-progress"
31
- },
32
- success: {
33
- progress: "bg-success-medium"
12
+ intent: {
13
+ default: {
14
+ progress: "bg-primary-medium"
34
15
  },
35
16
  error: {
36
17
  progress: "bg-error-medium"
37
18
  },
38
- default: {
39
- progress: "bg-primary-medium"
40
- },
41
19
  info: {
42
20
  progress: "bg-info-medium"
43
21
  },
44
22
  warning: {
45
23
  progress: "bg-warning-medium"
24
+ },
25
+ success: {
26
+ progress: "bg-success-medium"
27
+ }
28
+ },
29
+ infinite: {
30
+ true: {
31
+ progress: "animate-progress origin-left-right"
46
32
  }
47
33
  }
48
34
  }
49
35
  });
50
36
 
51
- exports.progressBarFilled = progressBarFilled;
52
- exports.progressBarInfiniteVariants = progressBarInfiniteVariants;
37
+ exports.ProgressVariants = ProgressVariants;
@@ -3,7 +3,7 @@ import { category } from '../../styles/menubar.js';
3
3
 
4
4
  const Category = ({ title, options, render }) => {
5
5
  const { text, hr, container } = category();
6
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("p", { className: text() }, title), /* @__PURE__ */ React__default.createElement("a", null), /* @__PURE__ */ React__default.createElement("hr", { className: hr() }), /* @__PURE__ */ React__default.createElement("div", { className: container() }, options.map((i) => render(i))));
6
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("p", { className: text() }, title), /* @__PURE__ */ React__default.createElement("hr", { className: hr() }), /* @__PURE__ */ React__default.createElement("div", { className: container() }, options.map((i) => render(i))));
7
7
  };
8
8
 
9
9
  export { Category as default };
@@ -2,8 +2,19 @@ import React__default, { useState } from 'react';
2
2
  import { item } from '../../styles/menubar.js';
3
3
  import IconControlSubItem from './IconControlSubItem.js';
4
4
  import ItemLink from './ItemLink.js';
5
+ import clsx from 'clsx';
6
+ import '@internationalized/date';
7
+ import 'react-aria';
8
+ import 'react-stately';
9
+ import '@floating-ui/react';
10
+ import 'currency.js';
11
+ import 'react-dropzone';
12
+ import 'uuid';
13
+ import '../../provider/MenubarContext.js';
14
+ import '../../provider/SnackbarProvider.js';
15
+ import { useMenubar } from '../../provider/useMenubar.js';
5
16
 
6
- const { container, text } = item();
17
+ const { container, textBehavior } = item();
7
18
  const Item = ({
8
19
  children,
9
20
  subItems,
@@ -14,7 +25,26 @@ const Item = ({
14
25
  }) => {
15
26
  const [showSubItem, setShowSubItem] = useState(false);
16
27
  const hasSubItems = (subItems ?? []).length > 0;
17
- return /* @__PURE__ */ React__default.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React__default.createElement("div", { "data-testid": "item-menubar", ...rest, className: container() }, /* @__PURE__ */ React__default.createElement("div", { className: text({ className }) }, children), hasSubItems ? /* @__PURE__ */ React__default.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null)), showSubItem ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
28
+ const [, setShow] = useMenubar();
29
+ return /* @__PURE__ */ React__default.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React__default.createElement(
30
+ "div",
31
+ {
32
+ "data-testid": "item-menubar",
33
+ ...rest,
34
+ onClick: (e) => {
35
+ if (hasSubItems) e.stopPropagation();
36
+ else {
37
+ setShow(false);
38
+ }
39
+ },
40
+ className: clsx(
41
+ container({ className }),
42
+ !hasSubItems && textBehavior()
43
+ )
44
+ },
45
+ children,
46
+ hasSubItems ? /* @__PURE__ */ React__default.createElement(IconControlSubItem, { show: showSubItem, setShow: setShowSubItem }) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null)
47
+ ), showSubItem ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, subItems?.map((subItem) => renderSubItems?.(subItem))) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null));
18
48
  };
19
49
 
20
50
  export { Item as default };
@@ -1,36 +1,17 @@
1
1
  import React__default from 'react';
2
2
  import clsx from 'clsx';
3
- import '@internationalized/date';
4
- import 'react-aria';
5
- import 'react-stately';
6
- import '@floating-ui/react';
7
- import 'currency.js';
8
- import 'react-dropzone';
9
- import 'uuid';
10
- import '../../provider/MenubarContext.js';
11
- import '../../provider/SnackbarProvider.js';
12
- import { useMenubar } from '../../provider/useMenubar.js';
13
3
 
14
4
  const ItemLink = ({ anchorProps, children }) => {
15
- const [, setShow] = useMenubar();
16
- return /* @__PURE__ */ React__default.createElement(
17
- "div",
5
+ return /* @__PURE__ */ React__default.createElement("div", null, anchorProps ? /* @__PURE__ */ React__default.createElement(
6
+ "a",
18
7
  {
19
- onClick: () => {
20
- setShow(false);
21
- }
8
+ target: "_blank",
9
+ rel: "noopener noreferrer",
10
+ ...anchorProps,
11
+ className: clsx("w-full", anchorProps?.className)
22
12
  },
23
- anchorProps ? /* @__PURE__ */ React__default.createElement(
24
- "a",
25
- {
26
- ...anchorProps,
27
- target: "_blank",
28
- rel: "noopener noreferrer",
29
- className: clsx("w-full", anchorProps?.className)
30
- },
31
- children
32
- ) : children
33
- );
13
+ children
14
+ ) : children);
34
15
  };
35
16
 
36
17
  export { ItemLink as default };
@@ -1,6 +1,16 @@
1
1
  import React__default from 'react';
2
2
  import { subItem } from '../../styles/menubar.js';
3
3
  import ItemLink from './ItemLink.js';
4
+ import '@internationalized/date';
5
+ import 'react-aria';
6
+ import 'react-stately';
7
+ import '@floating-ui/react';
8
+ import 'currency.js';
9
+ import 'react-dropzone';
10
+ import 'uuid';
11
+ import '../../provider/MenubarContext.js';
12
+ import '../../provider/SnackbarProvider.js';
13
+ import { useMenubar } from '../../provider/useMenubar.js';
4
14
 
5
15
  const { container } = subItem();
6
16
  const SubItem = ({
@@ -9,12 +19,16 @@ const SubItem = ({
9
19
  className,
10
20
  ...rest
11
21
  }) => {
22
+ const [, setShow] = useMenubar();
12
23
  return /* @__PURE__ */ React__default.createElement(ItemLink, { anchorProps }, /* @__PURE__ */ React__default.createElement(
13
24
  "div",
14
25
  {
15
26
  ...rest,
16
27
  "data-testid": "sub-item-menubar",
17
- className: container({ className })
28
+ className: container({ className }),
29
+ onClick: () => {
30
+ setShow(false);
31
+ }
18
32
  },
19
33
  children
20
34
  ));
@@ -0,0 +1,25 @@
1
+ import React__default from 'react';
2
+ import '../../styles/calendar-cell.js';
3
+ import '../../styles/groupButton.js';
4
+ import { ProgressVariants } from '../../styles/progressBar.js';
5
+
6
+ const { container, bar, progress } = ProgressVariants();
7
+ const Progress = ({
8
+ value,
9
+ intent = "default",
10
+ infinite
11
+ }) => {
12
+ return /* @__PURE__ */ React__default.createElement("div", { className: container(), "data-testid": "linear-progress" }, /* @__PURE__ */ React__default.createElement("div", { className: bar() }, /* @__PURE__ */ React__default.createElement(
13
+ "div",
14
+ {
15
+ style: {
16
+ width: !infinite ? `${value}%` : void 0,
17
+ transition: !infinite ? "width 0.5s ease" : void 0
18
+ },
19
+ "data-testid": "progress-filled",
20
+ className: progress({ intent, infinite })
21
+ }
22
+ )));
23
+ };
24
+
25
+ export { Progress };
@@ -1,39 +1,12 @@
1
- import React__default, { useState, useEffect } from 'react';
2
- import { ProgressBarInfinite } from './ProgressBarInfinite.js';
3
- import { ProgressBarSegments } from './ProgressBarSegments.js';
1
+ import React__default from 'react';
2
+ import { Progress } from './Progress.js';
4
3
 
5
4
  const ProgressBar = ({
6
- segments: _segments = 1,
7
- valueMin = 0,
8
- valueMax = 100,
9
- valueCurrent = 50,
10
- intentProgress = "default",
11
- type = "default",
12
- animated = true
5
+ value = 50,
6
+ intent = "default",
7
+ infinite = false
13
8
  }) => {
14
- const [displayedValue, setDisplayedValue] = useState(0);
15
- const [showAnimation, setShowAnimation] = useState(true);
16
- useEffect(() => {
17
- const timeout = setTimeout(() => {
18
- if (valueCurrent < displayedValue) {
19
- setShowAnimation(false);
20
- }
21
- if (animated && valueCurrent > displayedValue) setShowAnimation(true);
22
- setDisplayedValue(valueCurrent);
23
- }, 0);
24
- return () => clearTimeout(timeout);
25
- }, [valueCurrent]);
26
- const totalProgress = (displayedValue - valueMin) / (valueMax - valueMin) * 100;
27
- const segments = Math.max(1, _segments);
28
- return type === "infinite" ? /* @__PURE__ */ React__default.createElement(ProgressBarInfinite, { intentProgress }) : /* @__PURE__ */ React__default.createElement(
29
- ProgressBarSegments,
30
- {
31
- segments,
32
- totalProgress,
33
- intentProgress,
34
- showAnimation
35
- }
36
- );
9
+ return /* @__PURE__ */ React__default.createElement(Progress, { value, intent, infinite });
37
10
  };
38
11
 
39
12
  export { ProgressBar };
@@ -23,7 +23,7 @@ const File = ({ file, index, onDelete }) => {
23
23
  })
24
24
  },
25
25
  /* @__PURE__ */ React__default.createElement(MdClose, { size: 20 })
26
- )), /* @__PURE__ */ React__default.createElement(ProgressBar, { intentProgress: file.status, type: "infinite" }));
26
+ )), /* @__PURE__ */ React__default.createElement(ProgressBar, { intent: "info", infinite: file.status !== "success" }));
27
27
  };
28
28
 
29
29
  export { File };
@@ -32,15 +32,15 @@ const mostUsedItem = tv({
32
32
  });
33
33
  const item = tv({
34
34
  slots: {
35
- container: "flex flex-row gap-x-deca items-center",
36
- text: "text-secondary-dark hover:text-primary-medium hover:cursor-pointer text-base",
35
+ container: "flex flex-row gap-x-deca items-center text-secondary-dark text-base",
36
+ textBehavior: "hover:text-primary-medium hover:cursor-pointer text-base",
37
37
  icon: "text-primary-medium hover:cursor-pointer"
38
38
  }
39
39
  });
40
40
  const category = tv({
41
41
  slots: {
42
42
  text: "mb-mili font-bold",
43
- hr: "mb-mili",
43
+ hr: "mb-mili border-0 h-px bg-secondary-light",
44
44
  container: "flex flex-col gap-y-mili"
45
45
  }
46
46
  });
@@ -1,49 +1,35 @@
1
1
  import { tv } from 'tailwind-variants';
2
2
 
3
- const progressBarFilled = tv({
4
- base: "h-full first:rounded-l-pill last:rounded-r-pill",
5
- variants: {
6
- intentProgress: {
7
- default: "bg-primary-medium",
8
- error: "bg-error-medium",
9
- info: "bg-info-medium",
10
- warning: "bg-warning-medium",
11
- success: "bg-success-medium",
12
- uploading: ""
13
- },
14
- showAnimation: {
15
- true: "transition-[width] duration-1000 ease-linear"
16
- }
17
- }
18
- });
19
- const progressBarInfiniteVariants = tv({
3
+ const ProgressVariants = tv({
20
4
  slots: {
21
5
  container: "relative mb-mili",
22
- bar: "h-1.5 w-full overflow-hidden",
23
- progress: "w-full h-full origin-left-right rounded-b-mili"
6
+ bar: "h-1.5 w-full overflow-hidden bg-secondary-xlight",
7
+ progress: "w-full h-full rounded-mili"
24
8
  },
25
9
  variants: {
26
- status: {
27
- uploading: {
28
- progress: "bg-info-medium animate-progress"
29
- },
30
- success: {
31
- progress: "bg-success-medium"
10
+ intent: {
11
+ default: {
12
+ progress: "bg-primary-medium"
32
13
  },
33
14
  error: {
34
15
  progress: "bg-error-medium"
35
16
  },
36
- default: {
37
- progress: "bg-primary-medium"
38
- },
39
17
  info: {
40
18
  progress: "bg-info-medium"
41
19
  },
42
20
  warning: {
43
21
  progress: "bg-warning-medium"
22
+ },
23
+ success: {
24
+ progress: "bg-success-medium"
25
+ }
26
+ },
27
+ infinite: {
28
+ true: {
29
+ progress: "animate-progress origin-left-right"
44
30
  }
45
31
  }
46
32
  }
47
33
  });
48
34
 
49
- export { progressBarFilled, progressBarInfiniteVariants };
35
+ export { ProgressVariants };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface ProgressProps {
3
+ value: number;
4
+ intent?: 'default' | 'success' | 'warning' | 'info' | 'error';
5
+ infinite: boolean;
6
+ }
7
+ export declare const Progress: ({ value, intent, infinite, }: ProgressProps) => JSX.Element;
8
+ export {};
@@ -1,11 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface ProgressBarProps {
3
- segments?: number;
4
- valueMin?: number;
5
- valueMax?: number;
6
- valueCurrent?: number;
7
- intentProgress?: 'default' | 'success' | 'warning' | 'info' | 'error' | 'uploading';
8
- type?: 'infinite' | 'default';
9
- animated?: boolean;
3
+ value?: number;
4
+ intent?: 'default' | 'success' | 'warning' | 'info' | 'error';
5
+ infinite?: boolean;
10
6
  }
11
- export declare const ProgressBar: ({ segments: _segments, valueMin, valueMax, valueCurrent, intentProgress, type, animated, }: ProgressBarProps) => JSX.Element;
7
+ export declare const ProgressBar: ({ value, intent, infinite, }: ProgressBarProps) => JSX.Element;
@@ -172,53 +172,53 @@ export declare const mostUsedItem: import("tailwind-variants").TVReturnType<{
172
172
  export declare const item: import("tailwind-variants").TVReturnType<{
173
173
  [key: string]: {
174
174
  [key: string]: import("tailwind-merge").ClassNameValue | {
175
- text?: import("tailwind-merge").ClassNameValue;
176
175
  container?: import("tailwind-merge").ClassNameValue;
177
176
  icon?: import("tailwind-merge").ClassNameValue;
177
+ textBehavior?: import("tailwind-merge").ClassNameValue;
178
178
  };
179
179
  };
180
180
  } | {
181
181
  [x: string]: {
182
182
  [x: string]: import("tailwind-merge").ClassNameValue | {
183
- text?: import("tailwind-merge").ClassNameValue;
184
183
  container?: import("tailwind-merge").ClassNameValue;
185
184
  icon?: import("tailwind-merge").ClassNameValue;
185
+ textBehavior?: import("tailwind-merge").ClassNameValue;
186
186
  };
187
187
  };
188
188
  } | {}, {
189
189
  container: string;
190
- text: string;
190
+ textBehavior: string;
191
191
  icon: string;
192
192
  }, undefined, import("tailwind-variants/dist/config").TVConfig<unknown, {
193
193
  [key: string]: {
194
194
  [key: string]: import("tailwind-merge").ClassNameValue | {
195
- text?: import("tailwind-merge").ClassNameValue;
196
195
  container?: import("tailwind-merge").ClassNameValue;
197
196
  icon?: import("tailwind-merge").ClassNameValue;
197
+ textBehavior?: import("tailwind-merge").ClassNameValue;
198
198
  };
199
199
  };
200
200
  } | {}>, {
201
201
  [key: string]: {
202
202
  [key: string]: import("tailwind-merge").ClassNameValue | {
203
- text?: import("tailwind-merge").ClassNameValue;
204
203
  container?: import("tailwind-merge").ClassNameValue;
205
204
  icon?: import("tailwind-merge").ClassNameValue;
205
+ textBehavior?: import("tailwind-merge").ClassNameValue;
206
206
  };
207
207
  };
208
208
  } | {}, {
209
209
  container: string;
210
- text: string;
210
+ textBehavior: string;
211
211
  icon: string;
212
212
  }, import("tailwind-variants").TVReturnType<unknown, {
213
213
  container: string;
214
- text: string;
214
+ textBehavior: string;
215
215
  icon: string;
216
216
  }, undefined, import("tailwind-variants/dist/config").TVConfig<unknown, {
217
217
  [key: string]: {
218
218
  [key: string]: import("tailwind-merge").ClassNameValue | {
219
- text?: import("tailwind-merge").ClassNameValue;
220
219
  container?: import("tailwind-merge").ClassNameValue;
221
220
  icon?: import("tailwind-merge").ClassNameValue;
221
+ textBehavior?: import("tailwind-merge").ClassNameValue;
222
222
  };
223
223
  };
224
224
  } | {}>, unknown, unknown, undefined>>;
@@ -1,106 +1,23 @@
1
- export declare const progressBarFilled: import("tailwind-variants").TVReturnType<{
2
- intentProgress: {
3
- default: string;
4
- error: string;
5
- info: string;
6
- warning: string;
7
- success: string;
8
- uploading: string;
9
- };
10
- showAnimation: {
11
- true: string;
12
- };
13
- }, undefined, "h-full first:rounded-l-pill last:rounded-r-pill", import("tailwind-variants/dist/config").TVConfig<{
14
- intentProgress: {
15
- default: string;
16
- error: string;
17
- info: string;
18
- warning: string;
19
- success: string;
20
- uploading: string;
21
- };
22
- showAnimation: {
23
- true: string;
24
- };
25
- }, {
26
- intentProgress: {
27
- default: string;
28
- error: string;
29
- info: string;
30
- warning: string;
31
- success: string;
32
- uploading: string;
33
- };
34
- showAnimation: {
35
- true: string;
36
- };
37
- }>, {
38
- intentProgress: {
39
- default: string;
40
- error: string;
41
- info: string;
42
- warning: string;
43
- success: string;
44
- uploading: string;
45
- };
46
- showAnimation: {
47
- true: string;
48
- };
49
- }, undefined, import("tailwind-variants").TVReturnType<{
50
- intentProgress: {
51
- default: string;
52
- error: string;
53
- info: string;
54
- warning: string;
55
- success: string;
56
- uploading: string;
57
- };
58
- showAnimation: {
59
- true: string;
60
- };
61
- }, undefined, "h-full first:rounded-l-pill last:rounded-r-pill", import("tailwind-variants/dist/config").TVConfig<{
62
- intentProgress: {
63
- default: string;
64
- error: string;
65
- info: string;
66
- warning: string;
67
- success: string;
68
- uploading: string;
69
- };
70
- showAnimation: {
71
- true: string;
72
- };
73
- }, {
74
- intentProgress: {
75
- default: string;
76
- error: string;
77
- info: string;
78
- warning: string;
79
- success: string;
80
- uploading: string;
81
- };
82
- showAnimation: {
83
- true: string;
84
- };
85
- }>, unknown, unknown, undefined>>;
86
- export declare const progressBarInfiniteVariants: import("tailwind-variants").TVReturnType<{
87
- status: {
88
- uploading: {
1
+ export declare const ProgressVariants: import("tailwind-variants").TVReturnType<{
2
+ intent: {
3
+ default: {
89
4
  progress: string;
90
5
  };
91
- success: {
6
+ error: {
92
7
  progress: string;
93
8
  };
94
- error: {
9
+ info: {
95
10
  progress: string;
96
11
  };
97
- default: {
12
+ warning: {
98
13
  progress: string;
99
14
  };
100
- info: {
15
+ success: {
101
16
  progress: string;
102
17
  };
103
- warning: {
18
+ };
19
+ infinite: {
20
+ true: {
104
21
  progress: string;
105
22
  };
106
23
  };
@@ -109,65 +26,71 @@ export declare const progressBarInfiniteVariants: import("tailwind-variants").TV
109
26
  bar: string;
110
27
  progress: string;
111
28
  }, undefined, import("tailwind-variants/dist/config").TVConfig<{
112
- status: {
113
- uploading: {
29
+ intent: {
30
+ default: {
114
31
  progress: string;
115
32
  };
116
- success: {
33
+ error: {
117
34
  progress: string;
118
35
  };
119
- error: {
36
+ info: {
120
37
  progress: string;
121
38
  };
122
- default: {
39
+ warning: {
123
40
  progress: string;
124
41
  };
125
- info: {
42
+ success: {
126
43
  progress: string;
127
44
  };
128
- warning: {
45
+ };
46
+ infinite: {
47
+ true: {
129
48
  progress: string;
130
49
  };
131
50
  };
132
51
  }, {
133
- status: {
134
- uploading: {
52
+ intent: {
53
+ default: {
135
54
  progress: string;
136
55
  };
137
- success: {
56
+ error: {
138
57
  progress: string;
139
58
  };
140
- error: {
59
+ info: {
141
60
  progress: string;
142
61
  };
143
- default: {
62
+ warning: {
144
63
  progress: string;
145
64
  };
146
- info: {
65
+ success: {
147
66
  progress: string;
148
67
  };
149
- warning: {
68
+ };
69
+ infinite: {
70
+ true: {
150
71
  progress: string;
151
72
  };
152
73
  };
153
74
  }>, {
154
- status: {
155
- uploading: {
75
+ intent: {
76
+ default: {
156
77
  progress: string;
157
78
  };
158
- success: {
79
+ error: {
159
80
  progress: string;
160
81
  };
161
- error: {
82
+ info: {
162
83
  progress: string;
163
84
  };
164
- default: {
85
+ warning: {
165
86
  progress: string;
166
87
  };
167
- info: {
88
+ success: {
168
89
  progress: string;
169
90
  };
170
- warning: {
91
+ };
92
+ infinite: {
93
+ true: {
171
94
  progress: string;
172
95
  };
173
96
  };
@@ -176,23 +99,25 @@ export declare const progressBarInfiniteVariants: import("tailwind-variants").TV
176
99
  bar: string;
177
100
  progress: string;
178
101
  }, import("tailwind-variants").TVReturnType<{
179
- status: {
180
- uploading: {
102
+ intent: {
103
+ default: {
181
104
  progress: string;
182
105
  };
183
- success: {
106
+ error: {
184
107
  progress: string;
185
108
  };
186
- error: {
109
+ info: {
187
110
  progress: string;
188
111
  };
189
- default: {
112
+ warning: {
190
113
  progress: string;
191
114
  };
192
- info: {
115
+ success: {
193
116
  progress: string;
194
117
  };
195
- warning: {
118
+ };
119
+ infinite: {
120
+ true: {
196
121
  progress: string;
197
122
  };
198
123
  };
@@ -201,44 +126,48 @@ export declare const progressBarInfiniteVariants: import("tailwind-variants").TV
201
126
  bar: string;
202
127
  progress: string;
203
128
  }, undefined, import("tailwind-variants/dist/config").TVConfig<{
204
- status: {
205
- uploading: {
129
+ intent: {
130
+ default: {
206
131
  progress: string;
207
132
  };
208
- success: {
133
+ error: {
209
134
  progress: string;
210
135
  };
211
- error: {
136
+ info: {
212
137
  progress: string;
213
138
  };
214
- default: {
139
+ warning: {
215
140
  progress: string;
216
141
  };
217
- info: {
142
+ success: {
218
143
  progress: string;
219
144
  };
220
- warning: {
145
+ };
146
+ infinite: {
147
+ true: {
221
148
  progress: string;
222
149
  };
223
150
  };
224
151
  }, {
225
- status: {
226
- uploading: {
152
+ intent: {
153
+ default: {
227
154
  progress: string;
228
155
  };
229
- success: {
156
+ error: {
230
157
  progress: string;
231
158
  };
232
- error: {
159
+ info: {
233
160
  progress: string;
234
161
  };
235
- default: {
162
+ warning: {
236
163
  progress: string;
237
164
  };
238
- info: {
165
+ success: {
239
166
  progress: string;
240
167
  };
241
- warning: {
168
+ };
169
+ infinite: {
170
+ true: {
242
171
  progress: string;
243
172
  };
244
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.7.0",
3
+ "version": "1.7.3",
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": "*",
23
- "@tecsinapse/cortex-core": "0.4.0",
23
+ "@tecsinapse/cortex-core": "0.4.2",
24
24
  "clsx": "*",
25
25
  "currency.js": "~2.0.4",
26
26
  "react-aria": "^3.33.1",
@@ -48,5 +48,5 @@
48
48
  "react-dom": ">=18.0.0",
49
49
  "tailwind": ">=3.3.0"
50
50
  },
51
- "gitHead": "0d09b9c3a9193d5cf9a46a77d90a18c836561156"
51
+ "gitHead": "98934da7976983634d9cc44e91c67a5850eeb5ba"
52
52
  }
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- require('../../styles/calendar-cell.js');
5
- require('../../styles/groupButton.js');
6
- var progressBar = require('../../styles/progressBar.js');
7
-
8
- const { container, bar, progress } = progressBar.progressBarInfiniteVariants();
9
- const ProgressBarInfinite = ({
10
- intentProgress
11
- }) => {
12
- return /* @__PURE__ */ React.createElement("div", { className: container() }, /* @__PURE__ */ React.createElement("div", { className: bar(), "data-testid": "infinite-progress-bar" }, /* @__PURE__ */ React.createElement("div", { className: progress({ status: intentProgress }) })));
13
- };
14
-
15
- exports.ProgressBarInfinite = ProgressBarInfinite;
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- require('../../styles/calendar-cell.js');
5
- require('../../styles/groupButton.js');
6
- var progressBar = require('../../styles/progressBar.js');
7
-
8
- const ProgressBarSegments = ({
9
- segments,
10
- totalProgress,
11
- intentProgress,
12
- showAnimation
13
- }) => {
14
- const lengthSeg = 100 / segments;
15
- const items = [...Array(segments).keys()];
16
- const progressStyle = React.useCallback(
17
- (width, index) => {
18
- return {
19
- width: `${width}%`,
20
- transitionDelay: `${showAnimation ? `${index * 1e3}ms` : `0ms`}`
21
- };
22
- },
23
- [showAnimation]
24
- );
25
- return /* @__PURE__ */ React.createElement("div", { className: "flex gap-x-nano flex-row", "data-testid": "progress-bar" }, items.map((_, index) => {
26
- const max = lengthSeg * (index + 1);
27
- const min = lengthSeg * index;
28
- const minmax = (totalProgress - min) / (max - min);
29
- const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;
30
- return /* @__PURE__ */ React.createElement(
31
- "div",
32
- {
33
- key: index,
34
- className: "h-[0.5rem] bg-secondary-light flex flex-1 first:rounded-l-pill last:rounded-r-pill"
35
- },
36
- /* @__PURE__ */ React.createElement(
37
- "div",
38
- {
39
- style: progressStyle(width, index),
40
- "data-testid": "div-segment-filled",
41
- className: progressBar.progressBarFilled({ intentProgress, showAnimation })
42
- }
43
- )
44
- );
45
- }));
46
- };
47
-
48
- exports.ProgressBarSegments = ProgressBarSegments;
@@ -1,13 +0,0 @@
1
- import React__default from 'react';
2
- import '../../styles/calendar-cell.js';
3
- import '../../styles/groupButton.js';
4
- import { progressBarInfiniteVariants } from '../../styles/progressBar.js';
5
-
6
- const { container, bar, progress } = progressBarInfiniteVariants();
7
- const ProgressBarInfinite = ({
8
- intentProgress
9
- }) => {
10
- return /* @__PURE__ */ React__default.createElement("div", { className: container() }, /* @__PURE__ */ React__default.createElement("div", { className: bar(), "data-testid": "infinite-progress-bar" }, /* @__PURE__ */ React__default.createElement("div", { className: progress({ status: intentProgress }) })));
11
- };
12
-
13
- export { ProgressBarInfinite };
@@ -1,46 +0,0 @@
1
- import React__default, { useCallback } from 'react';
2
- import '../../styles/calendar-cell.js';
3
- import '../../styles/groupButton.js';
4
- import { progressBarFilled } from '../../styles/progressBar.js';
5
-
6
- const ProgressBarSegments = ({
7
- segments,
8
- totalProgress,
9
- intentProgress,
10
- showAnimation
11
- }) => {
12
- const lengthSeg = 100 / segments;
13
- const items = [...Array(segments).keys()];
14
- const progressStyle = useCallback(
15
- (width, index) => {
16
- return {
17
- width: `${width}%`,
18
- transitionDelay: `${showAnimation ? `${index * 1e3}ms` : `0ms`}`
19
- };
20
- },
21
- [showAnimation]
22
- );
23
- return /* @__PURE__ */ React__default.createElement("div", { className: "flex gap-x-nano flex-row", "data-testid": "progress-bar" }, items.map((_, index) => {
24
- const max = lengthSeg * (index + 1);
25
- const min = lengthSeg * index;
26
- const minmax = (totalProgress - min) / (max - min);
27
- const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;
28
- return /* @__PURE__ */ React__default.createElement(
29
- "div",
30
- {
31
- key: index,
32
- className: "h-[0.5rem] bg-secondary-light flex flex-1 first:rounded-l-pill last:rounded-r-pill"
33
- },
34
- /* @__PURE__ */ React__default.createElement(
35
- "div",
36
- {
37
- style: progressStyle(width, index),
38
- "data-testid": "div-segment-filled",
39
- className: progressBarFilled({ intentProgress, showAnimation })
40
- }
41
- )
42
- );
43
- }));
44
- };
45
-
46
- export { ProgressBarSegments };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- interface ProgressBarInfiniteProps {
3
- intentProgress?: 'default' | 'success' | 'warning' | 'info' | 'error' | 'uploading';
4
- }
5
- export declare const ProgressBarInfinite: ({ intentProgress, }: ProgressBarInfiniteProps) => JSX.Element;
6
- export {};
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- interface ProgressBarSegmentsProps {
3
- segments: number;
4
- totalProgress: number;
5
- intentProgress?: 'default' | 'success' | 'warning' | 'info' | 'error' | 'uploading';
6
- showAnimation: boolean;
7
- }
8
- export declare const ProgressBarSegments: ({ segments, totalProgress, intentProgress, showAnimation, }: ProgressBarSegmentsProps) => JSX.Element;
9
- export {};