@tecsinapse/cortex-react 1.2.1 → 1.2.2-beta.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.
Files changed (92) hide show
  1. package/dist/cjs/components/Avatar.js +34 -0
  2. package/dist/cjs/components/BaseSnackbar.js +13 -0
  3. package/dist/cjs/components/BreadcrumbItem.js +27 -0
  4. package/dist/cjs/components/Breadcrumbs.js +22 -0
  5. package/dist/cjs/components/Card.js +2 -10
  6. package/dist/cjs/components/DefaultSnack.js +27 -0
  7. package/dist/cjs/components/Drawer.js +32 -0
  8. package/dist/cjs/components/GroupButton.js +42 -0
  9. package/dist/cjs/components/Input.js +5 -3
  10. package/dist/cjs/components/Modal.js +6 -13
  11. package/dist/cjs/components/ProgressBar.js +70 -0
  12. package/dist/cjs/components/SearchInput.js +9 -3
  13. package/dist/cjs/components/Select.js +4 -4
  14. package/dist/cjs/components/Skeleton.js +22 -0
  15. package/dist/cjs/components/Table.js +11 -13
  16. package/dist/cjs/components/Toggle.js +17 -9
  17. package/dist/cjs/components/utils.js +12 -0
  18. package/dist/cjs/index.js +21 -3
  19. package/dist/cjs/service/SnackbarSonner.js +48 -0
  20. package/dist/cjs/styles/groupButton.js +16 -0
  21. package/dist/cjs/styles/progressBar.js +21 -0
  22. package/dist/esm/components/Avatar.js +32 -0
  23. package/dist/esm/components/BaseSnackbar.js +11 -0
  24. package/dist/esm/components/BreadcrumbItem.js +25 -0
  25. package/dist/esm/components/Breadcrumbs.js +20 -0
  26. package/dist/esm/components/Card.js +2 -10
  27. package/dist/esm/components/DefaultSnack.js +25 -0
  28. package/dist/esm/components/Drawer.js +30 -0
  29. package/dist/esm/components/GroupButton.js +40 -0
  30. package/dist/esm/components/Input.js +5 -3
  31. package/dist/esm/components/Modal.js +6 -13
  32. package/dist/esm/components/ProgressBar.js +68 -0
  33. package/dist/esm/components/SearchInput.js +9 -3
  34. package/dist/esm/components/Select.js +4 -4
  35. package/dist/esm/components/Skeleton.js +20 -0
  36. package/dist/esm/components/Table.js +12 -14
  37. package/dist/esm/components/Toggle.js +17 -9
  38. package/dist/esm/components/utils.js +10 -0
  39. package/dist/esm/index.js +11 -2
  40. package/dist/esm/service/SnackbarSonner.js +46 -0
  41. package/dist/esm/styles/groupButton.js +14 -0
  42. package/dist/esm/styles/progressBar.js +19 -0
  43. package/dist/types/components/Avatar.d.ts +7 -0
  44. package/dist/types/components/BaseSnackbar.d.ts +9 -0
  45. package/dist/types/components/BreadcrumbItem.d.ts +5 -0
  46. package/dist/types/components/Breadcrumbs.d.ts +10 -0
  47. package/dist/types/components/Card.d.ts +1 -1
  48. package/dist/types/components/DefaultSnack.d.ts +6 -0
  49. package/dist/types/components/Drawer.d.ts +9 -0
  50. package/dist/types/components/GroupButton.d.ts +19 -0
  51. package/dist/types/components/Input.d.ts +1 -1
  52. package/dist/types/components/Modal.d.ts +2 -2
  53. package/dist/types/components/ProgressBar.d.ts +9 -0
  54. package/dist/types/components/SearchInput.d.ts +0 -1
  55. package/dist/types/components/Select.d.ts +0 -1
  56. package/dist/types/components/Skeleton.d.ts +4 -0
  57. package/dist/types/components/Table.d.ts +1 -1
  58. package/dist/types/components/index.d.ts +8 -1
  59. package/dist/types/components/utils.d.ts +1 -0
  60. package/dist/types/index.d.ts +2 -0
  61. package/dist/types/provider/SnackbarProvider.d.ts +10 -0
  62. package/dist/types/service/ISnackbar.d.ts +7 -0
  63. package/dist/types/service/SnackbarSonner.d.ts +7 -0
  64. package/dist/types/service/index.d.ts +2 -0
  65. package/dist/types/styles/groupButton.d.ts +77 -0
  66. package/dist/types/styles/index.d.ts +2 -0
  67. package/dist/types/styles/progressBar.d.ts +78 -0
  68. package/dist/types/tests/Avatar.test.d.ts +1 -0
  69. package/dist/types/tests/Badge.test.d.ts +1 -0
  70. package/dist/types/tests/BreadcrumbItem.test.d.ts +1 -0
  71. package/dist/types/tests/Breadcrumbs.test.d.ts +1 -0
  72. package/dist/types/tests/Card.test.d.ts +1 -0
  73. package/dist/types/tests/DefaultSnack.test.d.ts +1 -0
  74. package/dist/types/tests/Drawer.test.d.ts +1 -0
  75. package/dist/types/tests/GroupButton.test.d.ts +1 -0
  76. package/dist/types/tests/Hint.test.d.ts +1 -0
  77. package/dist/types/tests/Input.test.d.ts +1 -0
  78. package/dist/types/tests/Modal.test.d.ts +1 -0
  79. package/dist/types/tests/ProgressBar.test.d.ts +1 -0
  80. package/dist/types/tests/SearchInput.test.d.ts +1 -0
  81. package/dist/types/tests/Select.test.d.ts +1 -0
  82. package/dist/types/tests/Skeleton.test.d.ts +1 -0
  83. package/dist/types/tests/Snackbar.test.d.ts +1 -0
  84. package/dist/types/tests/Table.test.d.ts +1 -0
  85. package/dist/types/tests/Tag.test.d.ts +1 -0
  86. package/dist/types/tests/Toggle.test.d.ts +1 -0
  87. package/dist/types/tests/useDebouncedState.test.d.ts +1 -0
  88. package/dist/types/tests/utils.test.d.ts +1 -0
  89. package/package.json +8 -5
  90. package/dist/cjs/components/Snackbar.js +0 -18
  91. package/dist/esm/components/Snackbar.js +0 -16
  92. package/dist/types/components/Snackbar.d.ts +0 -9
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var tailwindVariants = require('tailwind-variants');
4
+
5
+ const groupButton = tailwindVariants.tv({
6
+ slots: {
7
+ button: "border-[1px] border-secondary-medium px-centi py-mili items-center flex text-sub font-bold",
8
+ inactive: "bg-white text-secondary-medium disabled:bg-secondary-light",
9
+ firstButton: "first:rounded-l-mili first:border-r-0",
10
+ lastButton: "last:rounded-r-mili last:border-l-0",
11
+ container: "flex flex-row flex-1 h-[2rem] w-[500px]",
12
+ active: "text-white bg-secondary-medium"
13
+ }
14
+ });
15
+
16
+ exports.groupButton = groupButton;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var tailwindVariants = require('tailwind-variants');
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
+ },
15
+ showAnimation: {
16
+ true: "transition-[width] duration-1000 ease-linear"
17
+ }
18
+ }
19
+ });
20
+
21
+ exports.progressBarFilled = progressBarFilled;
@@ -0,0 +1,32 @@
1
+ import clsx from 'clsx';
2
+ import React from 'react';
3
+ import { getNameInitials } from './utils.js';
4
+
5
+ const Avatar = ({ src, name, className, ...rest }) => {
6
+ const [hasError, setHasError] = React.useState(false);
7
+ React.useEffect(() => {
8
+ setHasError(false);
9
+ }, [src]);
10
+ return /* @__PURE__ */ React.createElement(
11
+ "div",
12
+ {
13
+ ...rest,
14
+ className: clsx(
15
+ "rounded-pill bg-secondary-dark w-mega h-mega flex items-center justify-center cursor-pointer",
16
+ className
17
+ )
18
+ },
19
+ src && !hasError ? /* @__PURE__ */ React.createElement(
20
+ "img",
21
+ {
22
+ src,
23
+ alt: name,
24
+ className: "rounded-pill",
25
+ onError: () => setHasError(true),
26
+ "data-testid": "avatar-img"
27
+ }
28
+ ) : /* @__PURE__ */ React.createElement("p", { className: "font-bold text-white text-base", "data-testid": "avatar-p" }, getNameInitials(name))
29
+ );
30
+ };
31
+
32
+ export { Avatar };
@@ -0,0 +1,11 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { snackbar } from '@tecsinapse/cortex-core';
3
+
4
+ const BaseSnackbar = forwardRef(
5
+ (props, ref) => {
6
+ const { children, show, variants } = props;
7
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement("div", { className: snackbar(variants), ref, "data-testid": "snackbar" }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null));
8
+ }
9
+ );
10
+
11
+ export { BaseSnackbar };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { MdOutlineKeyboardDoubleArrowRight } from 'react-icons/md';
3
+
4
+ const BreadcrumbItem = ({
5
+ isLast,
6
+ Component,
7
+ componentProps,
8
+ title
9
+ }) => {
10
+ return /* @__PURE__ */ React.createElement(Component, { ...componentProps, key: title }, /* @__PURE__ */ React.createElement("div", { className: "flex gap-x-mili items-center" }, /* @__PURE__ */ React.createElement(
11
+ "p",
12
+ {
13
+ className: isLast ? "text-secondary-medium" : "text-secondary-xdark"
14
+ },
15
+ title
16
+ ), !isLast ? /* @__PURE__ */ React.createElement(
17
+ MdOutlineKeyboardDoubleArrowRight,
18
+ {
19
+ className: "mt-[0.125rem] text-primary-medium",
20
+ "data-testid": "breadcrumb-item-icon"
21
+ }
22
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null)));
23
+ };
24
+
25
+ export { BreadcrumbItem };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { BreadcrumbItem } from './BreadcrumbItem.js';
3
+ import { Card } from './Card.js';
4
+
5
+ const Breadcrumbs = (props) => {
6
+ const { breadcrumbs, ...rest } = props;
7
+ return /* @__PURE__ */ React.createElement(Card, { className: "flex gap-x-mili w-full items-center py-mili", ...rest }, breadcrumbs.map((item, index) => {
8
+ const isLast = index === breadcrumbs.length - 1;
9
+ return /* @__PURE__ */ React.createElement(
10
+ BreadcrumbItem,
11
+ {
12
+ key: `${item.title}-${index}`,
13
+ ...item,
14
+ isLast
15
+ }
16
+ );
17
+ }));
18
+ };
19
+
20
+ export { Breadcrumbs };
@@ -1,17 +1,9 @@
1
- import React, { forwardRef } from 'react';
2
1
  import { card } from '@tecsinapse/cortex-core';
2
+ import React, { forwardRef } from 'react';
3
3
 
4
4
  const Card = forwardRef((props, ref) => {
5
5
  const { children, className, ...rest } = props;
6
- return /* @__PURE__ */ React.createElement(
7
- "div",
8
- {
9
- className: card({ className }),
10
- ref,
11
- ...rest
12
- },
13
- children
14
- );
6
+ return /* @__PURE__ */ React.createElement("div", { className: card({ className }), ref, ...rest }, children);
15
7
  });
16
8
 
17
9
  export { Card };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { BaseSnackbar } from './BaseSnackbar.js';
3
+ import { IoMdInformationCircleOutline, IoMdClose } from 'react-icons/io';
4
+
5
+ const DefaultSnack = ({
6
+ text,
7
+ onDismiss,
8
+ variants
9
+ }) => /* @__PURE__ */ React.createElement(BaseSnackbar, { show: true, variants: { intent: variants?.intent } }, /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center flex-row gap-x-mili" }, /* @__PURE__ */ React.createElement(
10
+ IoMdInformationCircleOutline,
11
+ {
12
+ className: "w-[20px] h-[20px] shrink-0",
13
+ "data-testid": "icon-info"
14
+ }
15
+ ), /* @__PURE__ */ React.createElement("p", null, text), /* @__PURE__ */ React.createElement(
16
+ IoMdClose,
17
+ {
18
+ "data-testid": "icon-close",
19
+ onClick: onDismiss,
20
+ size: 24,
21
+ className: "cursor-pointer w-[20px] h-[20px] shrink-0"
22
+ }
23
+ )));
24
+
25
+ export { DefaultSnack };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { overlay, drawer } from '@tecsinapse/cortex-core';
3
+
4
+ const Drawer = ({
5
+ children,
6
+ onClose,
7
+ open,
8
+ position = "right"
9
+ }) => {
10
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
11
+ "div",
12
+ {
13
+ "data-testid": "overlay",
14
+ className: overlay({ show: open }),
15
+ onClick: onClose
16
+ }
17
+ ), /* @__PURE__ */ React.createElement(
18
+ "div",
19
+ {
20
+ "data-testid": "drawer",
21
+ className: drawer({
22
+ position,
23
+ open
24
+ })
25
+ },
26
+ children
27
+ ));
28
+ };
29
+
30
+ export { Drawer };
@@ -0,0 +1,40 @@
1
+ import clsx from 'clsx';
2
+ import React from 'react';
3
+ import '../styles/progressBar.js';
4
+ import { groupButton } from '../styles/groupButton.js';
5
+
6
+ const { button, container, active, inactive, firstButton, lastButton } = groupButton();
7
+ const GroupButton = (props) => {
8
+ const {
9
+ options,
10
+ value,
11
+ renderKey,
12
+ renderOption,
13
+ onChange,
14
+ customStyles,
15
+ disableAllOptions
16
+ } = props;
17
+ return /* @__PURE__ */ React.createElement("div", { className: container(), "data-testid": "group-button-container" }, options.map((option) => {
18
+ const key = renderKey?.(option.value);
19
+ const isActive = key === renderKey?.(value);
20
+ return /* @__PURE__ */ React.createElement(
21
+ "button",
22
+ {
23
+ disabled: disableAllOptions,
24
+ value: String(value),
25
+ onClick: () => onChange(option.value),
26
+ className: clsx(
27
+ button(),
28
+ firstButton({ className: customStyles?.firstButton }),
29
+ lastButton({ className: customStyles?.lastButton }),
30
+ !isActive && inactive({ className: customStyles?.inactive }),
31
+ isActive && active({ className: customStyles?.active })
32
+ ),
33
+ key
34
+ },
35
+ renderOption(option.value)
36
+ );
37
+ }));
38
+ };
39
+
40
+ export { GroupButton };
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import { inputBox, labelStyle, input } from '@tecsinapse/cortex-core';
3
2
  import { clsx } from 'clsx';
3
+ import React from 'react';
4
4
 
5
5
  const getValidChildren = (children) => {
6
6
  return React.Children.toArray(children).filter(
@@ -17,13 +17,15 @@ const Box = React.forwardRef(
17
17
  placeholder: placeholder ?? " ",
18
18
  className: clsx(inputBox(placeholder, label, className)),
19
19
  ...rest,
20
- ref
20
+ ref,
21
+ "data-testid": "input-input"
21
22
  }
22
23
  ), /* @__PURE__ */ React.createElement(
23
24
  "label",
24
25
  {
25
26
  htmlFor: id ?? name,
26
- className: labelStyle({ intent: variants?.intent, placeholder })
27
+ className: labelStyle({ intent: variants?.intent, placeholder }),
28
+ "data-testid": "input-label"
27
29
  },
28
30
  label
29
31
  ));
@@ -3,21 +3,14 @@ import { overlay, modal } from '@tecsinapse/cortex-core';
3
3
 
4
4
  const Modal = forwardRef((props, ref) => {
5
5
  const { open, onClose, children, className } = props;
6
- return /* @__PURE__ */ React.createElement(
6
+ return /* @__PURE__ */ React.createElement("div", { ref, ...props }, /* @__PURE__ */ React.createElement(
7
7
  "div",
8
8
  {
9
- ref,
10
- ...props
11
- },
12
- /* @__PURE__ */ React.createElement(
13
- "div",
14
- {
15
- className: overlay({ show: open }),
16
- onClick: onClose
17
- }
18
- ),
19
- /* @__PURE__ */ React.createElement("dialog", { className: modal({ open, className }) }, children)
20
- );
9
+ "data-testid": "overlay",
10
+ className: overlay({ show: open }),
11
+ onClick: onClose
12
+ }
13
+ ), /* @__PURE__ */ React.createElement("dialog", { "data-testid": "modal", className: modal({ open, className }) }, children));
21
14
  });
22
15
 
23
16
  export { Modal };
@@ -0,0 +1,68 @@
1
+ import clsx from 'clsx';
2
+ import React, { useState, useEffect, useCallback } from 'react';
3
+ import { progressBarFilled } from '../styles/progressBar.js';
4
+ import '../styles/groupButton.js';
5
+
6
+ const ProgressBar = ({
7
+ segments: _segments = 1,
8
+ valueMin = 0,
9
+ valueMax = 100,
10
+ valueCurrent = 50,
11
+ intentProgress = "default",
12
+ animated = true
13
+ }) => {
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 progressStyle = useCallback(
27
+ (width, index) => {
28
+ return {
29
+ width: `${width}%`,
30
+ transitionDelay: `${showAnimation ? `${index * 1e3}ms` : `0ms`}`
31
+ };
32
+ },
33
+ [showAnimation]
34
+ );
35
+ const totalProgress = (displayedValue - valueMin) / (valueMax - valueMin) * 100;
36
+ const segments = Math.max(1, _segments);
37
+ const lengthSeg = 100 / Math.max(segments);
38
+ const items = [...Array(segments).keys()];
39
+ return /* @__PURE__ */ React.createElement("div", { className: "flex gap-x-nano flex-row" }, items.map((_, index) => {
40
+ const max = lengthSeg * (index + 1);
41
+ const min = lengthSeg * index;
42
+ const minmax = (totalProgress - min) / (max - min);
43
+ const width = (minmax > 1 ? 1 : minmax < 0 ? 0 : minmax) * 100;
44
+ return /* @__PURE__ */ React.createElement(
45
+ "div",
46
+ {
47
+ "data-testid": "progress-bar",
48
+ key: index,
49
+ className: clsx(
50
+ "h-[0.5rem] bg-secondary-light flex flex-1 first:rounded-l-pill last:rounded-r-pill"
51
+ )
52
+ },
53
+ /* @__PURE__ */ React.createElement(
54
+ "div",
55
+ {
56
+ "data-testid": "div-segment-filled",
57
+ style: progressStyle(width, index),
58
+ className: progressBarFilled({
59
+ intentProgress,
60
+ showAnimation
61
+ })
62
+ }
63
+ )
64
+ );
65
+ }));
66
+ };
67
+
68
+ export { ProgressBar };
@@ -6,11 +6,17 @@ import './Hint.js';
6
6
  import { Input } from './Input.js';
7
7
  import './Modal.js';
8
8
  import './Select.js';
9
- import './Snackbar.js';
9
+ import './BaseSnackbar.js';
10
10
  import './Tag.js';
11
11
  import './Toggle.js';
12
12
  import './TextArea.js';
13
13
  import '@tecsinapse/cortex-core';
14
+ import 'react-icons/md';
15
+ import 'clsx';
16
+ import '../styles/progressBar.js';
17
+ import '../styles/groupButton.js';
18
+ import './GroupButton.js';
19
+ import 'react-icons/io';
14
20
  import { AiOutlineLoading } from 'react-icons/ai';
15
21
  import { IoSearchOutline } from 'react-icons/io5';
16
22
  import { useDebouncedState } from '../hooks/useDebouncedState.js';
@@ -41,7 +47,7 @@ const SearchInput = ({
41
47
  onClick(searchInput);
42
48
  }
43
49
  };
44
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-row w-full space-x-mili" }, /* @__PURE__ */ React.createElement(Input.Face, { variants: { className: inputFace } }, !onClick && /* @__PURE__ */ React.createElement(Input.Left, { className: inputLeft }, /* @__PURE__ */ React.createElement(IoSearchOutline, null)), /* @__PURE__ */ React.createElement(
50
+ return /* @__PURE__ */ React.createElement("div", { className: "flex flex-row w-full space-x-mili" }, /* @__PURE__ */ React.createElement(Input.Face, { variants: { className: inputFace } }, !onClick && /* @__PURE__ */ React.createElement(Input.Left, { className: inputLeft }, /* @__PURE__ */ React.createElement(IoSearchOutline, { "data-testid": "icon-search-left" })), /* @__PURE__ */ React.createElement(
45
51
  Input.Box,
46
52
  {
47
53
  placeholder,
@@ -61,7 +67,7 @@ const SearchInput = ({
61
67
  onClick: () => onClick(searchInput),
62
68
  disabled: !searchInput || isSubmitting
63
69
  },
64
- isSubmitting ? /* @__PURE__ */ React.createElement("div", { className: "animate-spin" }, /* @__PURE__ */ React.createElement(AiOutlineLoading, null)) : /* @__PURE__ */ React.createElement(IoSearchOutline, null)
70
+ isSubmitting ? /* @__PURE__ */ React.createElement("div", { className: "animate-spin" }, /* @__PURE__ */ React.createElement(AiOutlineLoading, { "data-testid": "icon-loading" })) : /* @__PURE__ */ React.createElement(IoSearchOutline, { "data-testid": "icon-search-button" })
65
71
  ));
66
72
  };
67
73
 
@@ -1,8 +1,8 @@
1
1
  import { selectVariants, option } from '@tecsinapse/cortex-core';
2
2
  import React, { useState, useMemo, useRef, useCallback, useEffect } from 'react';
3
- import { Hint } from './Hint.js';
4
- import { IoChevronDownOutline } from 'react-icons/io5';
5
3
  import { IoIosCloseCircleOutline } from 'react-icons/io';
4
+ import { IoChevronDownOutline } from 'react-icons/io5';
5
+ import { Hint } from './Hint.js';
6
6
  import SearchInput from './SearchInput.js';
7
7
 
8
8
  const { button, dropdown, groupedTitle, containerGrouped, hintBody } = selectVariants();
@@ -64,7 +64,7 @@ const Select = (props) => {
64
64
  onClick: () => setOpen((prevState) => !prevState),
65
65
  disabled
66
66
  },
67
- /* @__PURE__ */ React.createElement("span", null, placeholder),
67
+ /* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" }, placeholder),
68
68
  /* @__PURE__ */ React.createElement(IoChevronDownOutline, null)
69
69
  ), /* @__PURE__ */ React.createElement(
70
70
  "ul",
@@ -89,7 +89,7 @@ const Select = (props) => {
89
89
  intent: variant
90
90
  }
91
91
  },
92
- /* @__PURE__ */ React.createElement("div", { className: hintBody() }, variant === "error" ? /* @__PURE__ */ React.createElement(IoIosCloseCircleOutline, null) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement("span", null, hint))
92
+ /* @__PURE__ */ React.createElement("div", { className: hintBody() }, variant === "error" ? /* @__PURE__ */ React.createElement(IoIosCloseCircleOutline, { "data-testid": "select-hint-error-icon" }) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement("span", null, hint))
93
93
  ));
94
94
  };
95
95
 
@@ -0,0 +1,20 @@
1
+ import clsx from 'clsx';
2
+ import React from 'react';
3
+
4
+ const Skeleton = ({
5
+ className,
6
+ children,
7
+ ...rest
8
+ }) => {
9
+ return /* @__PURE__ */ React.createElement(
10
+ "div",
11
+ {
12
+ ...rest,
13
+ "data-testid": "skeleton",
14
+ className: clsx("animate-pulse bg-secondary-light", className)
15
+ },
16
+ children
17
+ );
18
+ };
19
+
20
+ export { Skeleton };
@@ -1,44 +1,42 @@
1
1
  import React from 'react';
2
- import { tHead, tRow, tHeadCell, tCell, tFoot, tRoot, hr } from '@tecsinapse/cortex-core';
2
+ import { tHead, tRow, tHeadCell, hr, tCell, tFoot, tRoot } from '@tecsinapse/cortex-core';
3
3
 
4
4
  const THead = ({
5
5
  children,
6
6
  className,
7
7
  ...rest
8
- }) => /* @__PURE__ */ React.createElement("thead", { className: tHead({ className }), ...rest }, children);
8
+ }) => /* @__PURE__ */ React.createElement("thead", { className: tHead({ className }), "data-testid": "thead", ...rest }, children);
9
9
  const TRow = ({
10
10
  children,
11
11
  className,
12
12
  ...rest
13
- }) => /* @__PURE__ */ React.createElement("tr", { className: tRow({ className }), ...rest }, children);
13
+ }) => /* @__PURE__ */ React.createElement("tr", { className: tRow({ className }), "data-testid": "trow", ...rest }, children);
14
14
  const THeadCell = ({
15
15
  children,
16
16
  className,
17
17
  ...rest
18
- }) => /* @__PURE__ */ React.createElement("th", { className: tHeadCell({ className }), ...rest }, children);
18
+ }) => /* @__PURE__ */ React.createElement("th", { className: tHeadCell({ className }), "data-testid": "thead-cell", ...rest }, children);
19
+ const TRowHeader = ({
20
+ children
21
+ }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("tr", { className: tRow(), "data-testid": "trow-header" }, children), /* @__PURE__ */ React.createElement("tr", { className: tRow() }, /* @__PURE__ */ React.createElement("td", { colSpan: 99 }, /* @__PURE__ */ React.createElement("hr", { className: hr() }))));
19
22
  const TCell = ({
20
23
  children,
21
24
  className,
22
25
  ...rest
23
- }) => /* @__PURE__ */ React.createElement("td", { className: tCell({ className }), ...rest }, children);
26
+ }) => /* @__PURE__ */ React.createElement("td", { className: tCell({ className }), "data-testid": "tcell", ...rest }, children);
24
27
  const TFoot = ({
25
28
  children,
26
29
  className,
27
30
  ...rest
28
- }) => /* @__PURE__ */ React.createElement("tfoot", { className: tFoot({ className }), ...rest }, children);
31
+ }) => /* @__PURE__ */ React.createElement("tfoot", { className: tFoot({ className }), "data-testid": "tfoot", ...rest }, children);
29
32
  const Table = ({
30
33
  children,
31
34
  className,
32
35
  ...rest
33
- }) => /* @__PURE__ */ React.createElement("table", { className: tRoot({ className }), ...rest }, children);
34
- const Hr = ({
35
- children,
36
- className,
37
- ...rest
38
- }) => /* @__PURE__ */ React.createElement("hr", { className: hr({ className }), ...rest }, children);
36
+ }) => /* @__PURE__ */ React.createElement("table", { className: tRoot({ className }), "data-testid": "table", ...rest }, children);
39
37
  const Td = ({
40
38
  children,
41
39
  ...rest
42
- }) => /* @__PURE__ */ React.createElement("td", { colSpan: 99, ...rest }, children);
40
+ }) => /* @__PURE__ */ React.createElement("td", { ...rest, "data-testid": "td" }, children);
43
41
 
44
- export { Hr, TCell, TFoot, THead, THeadCell, TRow, Table, Td };
42
+ export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td };
@@ -1,16 +1,24 @@
1
- import React, { forwardRef } from 'react';
2
1
  import { styleLabelElement, styleInputElement, toggle } from '@tecsinapse/cortex-core';
2
+ import React, { forwardRef } from 'react';
3
3
 
4
4
  const Toggle = forwardRef((props, ref) => {
5
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-row items-center gap-x-centi" }, /* @__PURE__ */ React.createElement("label", { className: styleLabelElement() }, /* @__PURE__ */ React.createElement(
6
- "input",
5
+ return /* @__PURE__ */ React.createElement(
6
+ "div",
7
7
  {
8
- type: "checkbox",
9
- className: styleInputElement(),
10
- ref,
11
- ...props
12
- }
13
- ), /* @__PURE__ */ React.createElement("div", { className: toggle() })));
8
+ className: "flex flex-row items-center gap-x-centi",
9
+ "data-testid": "toggle-div"
10
+ },
11
+ /* @__PURE__ */ React.createElement("label", { className: styleLabelElement() }, /* @__PURE__ */ React.createElement(
12
+ "input",
13
+ {
14
+ type: "checkbox",
15
+ className: styleInputElement(),
16
+ ref,
17
+ "data-testid": "toggle-input",
18
+ ...props
19
+ }
20
+ ), /* @__PURE__ */ React.createElement("div", { className: toggle() }))
21
+ );
14
22
  });
15
23
 
16
24
  export { Toggle };
@@ -0,0 +1,10 @@
1
+ const getNameInitials = (name) => {
2
+ const nameSplit = name.split(" ");
3
+ const length = nameSplit.length;
4
+ if (length > 1) {
5
+ return `${nameSplit[0][0]}${nameSplit[length - 1][0]}`;
6
+ }
7
+ return name[0];
8
+ };
9
+
10
+ export { getNameInitials };
package/dist/esm/index.js CHANGED
@@ -5,8 +5,17 @@ export { Hint } from './components/Hint.js';
5
5
  export { Box, Face, Input, Left, Right, Root } from './components/Input.js';
6
6
  export { Modal } from './components/Modal.js';
7
7
  export { Select } from './components/Select.js';
8
- export { Snackbar } from './components/Snackbar.js';
8
+ export { BaseSnackbar } from './components/BaseSnackbar.js';
9
9
  export { Tag } from './components/Tag.js';
10
10
  export { Toggle } from './components/Toggle.js';
11
11
  export { TextArea } from './components/TextArea.js';
12
- export { Hr, TCell, TFoot, THead, THeadCell, TRow, Table, Td } from './components/Table.js';
12
+ export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td } from './components/Table.js';
13
+ export { Drawer } from './components/Drawer.js';
14
+ export { Breadcrumbs } from './components/Breadcrumbs.js';
15
+ export { Avatar } from './components/Avatar.js';
16
+ export { Skeleton } from './components/Skeleton.js';
17
+ export { ProgressBar } from './components/ProgressBar.js';
18
+ export { GroupButton } from './components/GroupButton.js';
19
+ export { DefaultSnack } from './components/DefaultSnack.js';
20
+ export { SnackbarSonner } from './service/SnackbarSonner.js';
21
+ export { useDebouncedState } from './hooks/useDebouncedState.js';
@@ -0,0 +1,46 @@
1
+ import { toast } from 'sonner';
2
+ import React from 'react';
3
+ import '../components/Badge.js';
4
+ import '../components/Button.js';
5
+ import '../components/Card.js';
6
+ import '../components/Hint.js';
7
+ import '../components/Input.js';
8
+ import '../components/Modal.js';
9
+ import '../components/Select.js';
10
+ import '../components/BaseSnackbar.js';
11
+ import '../components/Tag.js';
12
+ import '../components/Toggle.js';
13
+ import '../components/TextArea.js';
14
+ import '@tecsinapse/cortex-core';
15
+ import 'react-icons/md';
16
+ import 'clsx';
17
+ import '../styles/progressBar.js';
18
+ import '../styles/groupButton.js';
19
+ import '../components/GroupButton.js';
20
+ import { DefaultSnack } from '../components/DefaultSnack.js';
21
+
22
+ class SnackbarSonner {
23
+ custom(Component, options) {
24
+ return toast.custom(() => Component, {
25
+ ...options,
26
+ duration: options?.duration ?? 5e3
27
+ });
28
+ }
29
+ show(type, message, options) {
30
+ return toast.custom(
31
+ (t) => {
32
+ return /* @__PURE__ */ React.createElement(
33
+ DefaultSnack,
34
+ {
35
+ text: message,
36
+ variants: { intent: type },
37
+ onDismiss: () => toast.dismiss(t)
38
+ }
39
+ );
40
+ },
41
+ { ...options, duration: options?.duration ?? 5e3 }
42
+ );
43
+ }
44
+ }
45
+
46
+ export { SnackbarSonner };
@@ -0,0 +1,14 @@
1
+ import { tv } from 'tailwind-variants';
2
+
3
+ const groupButton = tv({
4
+ slots: {
5
+ button: "border-[1px] border-secondary-medium px-centi py-mili items-center flex text-sub font-bold",
6
+ inactive: "bg-white text-secondary-medium disabled:bg-secondary-light",
7
+ firstButton: "first:rounded-l-mili first:border-r-0",
8
+ lastButton: "last:rounded-r-mili last:border-l-0",
9
+ container: "flex flex-row flex-1 h-[2rem] w-[500px]",
10
+ active: "text-white bg-secondary-medium"
11
+ }
12
+ });
13
+
14
+ export { groupButton };