@tecsinapse/cortex-react 1.2.2-beta.0 → 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.
- package/dist/cjs/components/BaseSnackbar.js +13 -0
- package/dist/cjs/components/DefaultSnack.js +27 -0
- package/dist/cjs/components/SearchInput.js +4 -3
- package/dist/cjs/components/Select.js +4 -4
- package/dist/cjs/components/Skeleton.js +1 -0
- package/dist/cjs/components/Table.js +8 -14
- package/dist/cjs/index.js +8 -3
- package/dist/cjs/service/SnackbarSonner.js +48 -0
- package/dist/esm/components/BaseSnackbar.js +11 -0
- package/dist/esm/components/DefaultSnack.js +25 -0
- package/dist/esm/components/SearchInput.js +4 -3
- package/dist/esm/components/Select.js +4 -4
- package/dist/esm/components/Skeleton.js +1 -0
- package/dist/esm/components/Table.js +9 -14
- package/dist/esm/index.js +5 -2
- package/dist/esm/service/SnackbarSonner.js +46 -0
- package/dist/types/components/BaseSnackbar.d.ts +9 -0
- package/dist/types/components/DefaultSnack.d.ts +6 -0
- package/dist/types/components/Table.d.ts +0 -1
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/provider/SnackbarProvider.d.ts +10 -0
- package/dist/types/service/ISnackbar.d.ts +7 -0
- package/dist/types/service/SnackbarSonner.d.ts +7 -0
- package/dist/types/service/index.d.ts +2 -0
- package/dist/types/tests/DefaultSnack.test.d.ts +1 -0
- package/dist/types/tests/SearchInput.test.d.ts +1 -0
- package/dist/types/tests/Select.test.d.ts +1 -0
- package/dist/types/tests/Skeleton.test.d.ts +1 -0
- package/dist/types/tests/Snackbar.test.d.ts +1 -0
- package/dist/types/tests/Table.test.d.ts +1 -0
- package/dist/types/tests/useDebouncedState.test.d.ts +1 -0
- package/package.json +5 -4
- package/dist/cjs/components/Snackbar.js +0 -18
- package/dist/esm/components/Snackbar.js +0 -16
- package/dist/types/components/Snackbar.d.ts +0 -9
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var cortexCore = require('@tecsinapse/cortex-core');
|
|
5
|
+
|
|
6
|
+
const BaseSnackbar = React.forwardRef(
|
|
7
|
+
(props, ref) => {
|
|
8
|
+
const { children, show, variants } = props;
|
|
9
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement("div", { className: cortexCore.snackbar(variants), ref, "data-testid": "snackbar" }, children) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
exports.BaseSnackbar = BaseSnackbar;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var BaseSnackbar = require('./BaseSnackbar.js');
|
|
5
|
+
var io = require('react-icons/io');
|
|
6
|
+
|
|
7
|
+
const DefaultSnack = ({
|
|
8
|
+
text,
|
|
9
|
+
onDismiss,
|
|
10
|
+
variants
|
|
11
|
+
}) => /* @__PURE__ */ React.createElement(BaseSnackbar.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(
|
|
12
|
+
io.IoMdInformationCircleOutline,
|
|
13
|
+
{
|
|
14
|
+
className: "w-[20px] h-[20px] shrink-0",
|
|
15
|
+
"data-testid": "icon-info"
|
|
16
|
+
}
|
|
17
|
+
), /* @__PURE__ */ React.createElement("p", null, text), /* @__PURE__ */ React.createElement(
|
|
18
|
+
io.IoMdClose,
|
|
19
|
+
{
|
|
20
|
+
"data-testid": "icon-close",
|
|
21
|
+
onClick: onDismiss,
|
|
22
|
+
size: 24,
|
|
23
|
+
className: "cursor-pointer w-[20px] h-[20px] shrink-0"
|
|
24
|
+
}
|
|
25
|
+
)));
|
|
26
|
+
|
|
27
|
+
exports.DefaultSnack = DefaultSnack;
|
|
@@ -8,7 +8,7 @@ require('./Hint.js');
|
|
|
8
8
|
var Input = require('./Input.js');
|
|
9
9
|
require('./Modal.js');
|
|
10
10
|
require('./Select.js');
|
|
11
|
-
require('./
|
|
11
|
+
require('./BaseSnackbar.js');
|
|
12
12
|
require('./Tag.js');
|
|
13
13
|
require('./Toggle.js');
|
|
14
14
|
require('./TextArea.js');
|
|
@@ -18,6 +18,7 @@ require('clsx');
|
|
|
18
18
|
require('../styles/progressBar.js');
|
|
19
19
|
require('../styles/groupButton.js');
|
|
20
20
|
require('./GroupButton.js');
|
|
21
|
+
require('react-icons/io');
|
|
21
22
|
var ai = require('react-icons/ai');
|
|
22
23
|
var io5 = require('react-icons/io5');
|
|
23
24
|
var useDebouncedState = require('../hooks/useDebouncedState.js');
|
|
@@ -48,7 +49,7 @@ const SearchInput = ({
|
|
|
48
49
|
onClick(searchInput);
|
|
49
50
|
}
|
|
50
51
|
};
|
|
51
|
-
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-row w-full space-x-mili" }, /* @__PURE__ */ React.createElement(Input.Input.Face, { variants: { className: inputFace } }, !onClick && /* @__PURE__ */ React.createElement(Input.Input.Left, { className: inputLeft }, /* @__PURE__ */ React.createElement(io5.IoSearchOutline,
|
|
52
|
+
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-row w-full space-x-mili" }, /* @__PURE__ */ React.createElement(Input.Input.Face, { variants: { className: inputFace } }, !onClick && /* @__PURE__ */ React.createElement(Input.Input.Left, { className: inputLeft }, /* @__PURE__ */ React.createElement(io5.IoSearchOutline, { "data-testid": "icon-search-left" })), /* @__PURE__ */ React.createElement(
|
|
52
53
|
Input.Input.Box,
|
|
53
54
|
{
|
|
54
55
|
placeholder,
|
|
@@ -68,7 +69,7 @@ const SearchInput = ({
|
|
|
68
69
|
onClick: () => onClick(searchInput),
|
|
69
70
|
disabled: !searchInput || isSubmitting
|
|
70
71
|
},
|
|
71
|
-
isSubmitting ? /* @__PURE__ */ React.createElement("div", { className: "animate-spin" }, /* @__PURE__ */ React.createElement(ai.AiOutlineLoading,
|
|
72
|
+
isSubmitting ? /* @__PURE__ */ React.createElement("div", { className: "animate-spin" }, /* @__PURE__ */ React.createElement(ai.AiOutlineLoading, { "data-testid": "icon-loading" })) : /* @__PURE__ */ React.createElement(io5.IoSearchOutline, { "data-testid": "icon-search-button" })
|
|
72
73
|
));
|
|
73
74
|
};
|
|
74
75
|
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var cortexCore = require('@tecsinapse/cortex-core');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var Hint = require('./Hint.js');
|
|
8
|
-
var io5 = require('react-icons/io5');
|
|
9
7
|
var io = require('react-icons/io');
|
|
8
|
+
var io5 = require('react-icons/io5');
|
|
9
|
+
var Hint = require('./Hint.js');
|
|
10
10
|
var SearchInput = require('./SearchInput.js');
|
|
11
11
|
|
|
12
12
|
const { button, dropdown, groupedTitle, containerGrouped, hintBody } = cortexCore.selectVariants();
|
|
@@ -68,7 +68,7 @@ const Select = (props) => {
|
|
|
68
68
|
onClick: () => setOpen((prevState) => !prevState),
|
|
69
69
|
disabled
|
|
70
70
|
},
|
|
71
|
-
/* @__PURE__ */ React.createElement("span",
|
|
71
|
+
/* @__PURE__ */ React.createElement("span", { "data-testid": "select-placeholder" }, placeholder),
|
|
72
72
|
/* @__PURE__ */ React.createElement(io5.IoChevronDownOutline, null)
|
|
73
73
|
), /* @__PURE__ */ React.createElement(
|
|
74
74
|
"ul",
|
|
@@ -93,7 +93,7 @@ const Select = (props) => {
|
|
|
93
93
|
intent: variant
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
-
/* @__PURE__ */ React.createElement("div", { className: hintBody() }, variant === "error" ? /* @__PURE__ */ React.createElement(io.IoIosCloseCircleOutline,
|
|
96
|
+
/* @__PURE__ */ React.createElement("div", { className: hintBody() }, variant === "error" ? /* @__PURE__ */ React.createElement(io.IoIosCloseCircleOutline, { "data-testid": "select-hint-error-icon" }) : /* @__PURE__ */ React.createElement(React.Fragment, null), /* @__PURE__ */ React.createElement("span", null, hint))
|
|
97
97
|
));
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -7,46 +7,40 @@ const THead = ({
|
|
|
7
7
|
children,
|
|
8
8
|
className,
|
|
9
9
|
...rest
|
|
10
|
-
}) => /* @__PURE__ */ React.createElement("thead", { className: cortexCore.tHead({ className }), ...rest }, children);
|
|
10
|
+
}) => /* @__PURE__ */ React.createElement("thead", { className: cortexCore.tHead({ className }), "data-testid": "thead", ...rest }, children);
|
|
11
11
|
const TRow = ({
|
|
12
12
|
children,
|
|
13
13
|
className,
|
|
14
14
|
...rest
|
|
15
|
-
}) => /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow({ className }), ...rest }, children);
|
|
15
|
+
}) => /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow({ className }), "data-testid": "trow", ...rest }, children);
|
|
16
16
|
const THeadCell = ({
|
|
17
17
|
children,
|
|
18
18
|
className,
|
|
19
19
|
...rest
|
|
20
|
-
}) => /* @__PURE__ */ React.createElement("th", { className: cortexCore.tHeadCell({ className }), ...rest }, children);
|
|
20
|
+
}) => /* @__PURE__ */ React.createElement("th", { className: cortexCore.tHeadCell({ className }), "data-testid": "thead-cell", ...rest }, children);
|
|
21
21
|
const TRowHeader = ({
|
|
22
22
|
children
|
|
23
|
-
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow() }, children), /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow() }, /* @__PURE__ */ React.createElement("td", { colSpan: 99 }, /* @__PURE__ */ React.createElement("hr", { className: cortexCore.hr() }))));
|
|
23
|
+
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow(), "data-testid": "trow-header" }, children), /* @__PURE__ */ React.createElement("tr", { className: cortexCore.tRow() }, /* @__PURE__ */ React.createElement("td", { colSpan: 99 }, /* @__PURE__ */ React.createElement("hr", { className: cortexCore.hr() }))));
|
|
24
24
|
const TCell = ({
|
|
25
25
|
children,
|
|
26
26
|
className,
|
|
27
27
|
...rest
|
|
28
|
-
}) => /* @__PURE__ */ React.createElement("td", { className: cortexCore.tCell({ className }), ...rest }, children);
|
|
28
|
+
}) => /* @__PURE__ */ React.createElement("td", { className: cortexCore.tCell({ className }), "data-testid": "tcell", ...rest }, children);
|
|
29
29
|
const TFoot = ({
|
|
30
30
|
children,
|
|
31
31
|
className,
|
|
32
32
|
...rest
|
|
33
|
-
}) => /* @__PURE__ */ React.createElement("tfoot", { className: cortexCore.tFoot({ className }), ...rest }, children);
|
|
33
|
+
}) => /* @__PURE__ */ React.createElement("tfoot", { className: cortexCore.tFoot({ className }), "data-testid": "tfoot", ...rest }, children);
|
|
34
34
|
const Table = ({
|
|
35
35
|
children,
|
|
36
36
|
className,
|
|
37
37
|
...rest
|
|
38
|
-
}) => /* @__PURE__ */ React.createElement("table", { className: cortexCore.tRoot({ className }), ...rest }, children);
|
|
39
|
-
const Hr = ({
|
|
40
|
-
children,
|
|
41
|
-
className,
|
|
42
|
-
...rest
|
|
43
|
-
}) => /* @__PURE__ */ React.createElement("hr", { className: cortexCore.hr({ className }), ...rest }, children);
|
|
38
|
+
}) => /* @__PURE__ */ React.createElement("table", { className: cortexCore.tRoot({ className }), "data-testid": "table", ...rest }, children);
|
|
44
39
|
const Td = ({
|
|
45
40
|
children,
|
|
46
41
|
...rest
|
|
47
|
-
}) => /* @__PURE__ */ React.createElement("td", { ...rest }, children);
|
|
42
|
+
}) => /* @__PURE__ */ React.createElement("td", { ...rest, "data-testid": "td" }, children);
|
|
48
43
|
|
|
49
|
-
exports.Hr = Hr;
|
|
50
44
|
exports.TCell = TCell;
|
|
51
45
|
exports.TFoot = TFoot;
|
|
52
46
|
exports.THead = THead;
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var Hint = require('./components/Hint.js');
|
|
|
7
7
|
var Input = require('./components/Input.js');
|
|
8
8
|
var Modal = require('./components/Modal.js');
|
|
9
9
|
var Select = require('./components/Select.js');
|
|
10
|
-
var
|
|
10
|
+
var BaseSnackbar = require('./components/BaseSnackbar.js');
|
|
11
11
|
var Tag = require('./components/Tag.js');
|
|
12
12
|
var Toggle = require('./components/Toggle.js');
|
|
13
13
|
var TextArea = require('./components/TextArea.js');
|
|
@@ -18,6 +18,9 @@ var Avatar = require('./components/Avatar.js');
|
|
|
18
18
|
var Skeleton = require('./components/Skeleton.js');
|
|
19
19
|
var ProgressBar = require('./components/ProgressBar.js');
|
|
20
20
|
var GroupButton = require('./components/GroupButton.js');
|
|
21
|
+
var DefaultSnack = require('./components/DefaultSnack.js');
|
|
22
|
+
var SnackbarSonner = require('./service/SnackbarSonner.js');
|
|
23
|
+
var useDebouncedState = require('./hooks/useDebouncedState.js');
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
@@ -34,11 +37,10 @@ exports.Right = Input.Right;
|
|
|
34
37
|
exports.Root = Input.Root;
|
|
35
38
|
exports.Modal = Modal.Modal;
|
|
36
39
|
exports.Select = Select.Select;
|
|
37
|
-
exports.
|
|
40
|
+
exports.BaseSnackbar = BaseSnackbar.BaseSnackbar;
|
|
38
41
|
exports.Tag = Tag.Tag;
|
|
39
42
|
exports.Toggle = Toggle.Toggle;
|
|
40
43
|
exports.TextArea = TextArea.TextArea;
|
|
41
|
-
exports.Hr = Table.Hr;
|
|
42
44
|
exports.TCell = Table.TCell;
|
|
43
45
|
exports.TFoot = Table.TFoot;
|
|
44
46
|
exports.THead = Table.THead;
|
|
@@ -53,3 +55,6 @@ exports.Avatar = Avatar.Avatar;
|
|
|
53
55
|
exports.Skeleton = Skeleton.Skeleton;
|
|
54
56
|
exports.ProgressBar = ProgressBar.ProgressBar;
|
|
55
57
|
exports.GroupButton = GroupButton.GroupButton;
|
|
58
|
+
exports.DefaultSnack = DefaultSnack.DefaultSnack;
|
|
59
|
+
exports.SnackbarSonner = SnackbarSonner.SnackbarSonner;
|
|
60
|
+
exports.useDebouncedState = useDebouncedState.useDebouncedState;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var sonner = require('sonner');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
require('../components/Badge.js');
|
|
6
|
+
require('../components/Button.js');
|
|
7
|
+
require('../components/Card.js');
|
|
8
|
+
require('../components/Hint.js');
|
|
9
|
+
require('../components/Input.js');
|
|
10
|
+
require('../components/Modal.js');
|
|
11
|
+
require('../components/Select.js');
|
|
12
|
+
require('../components/BaseSnackbar.js');
|
|
13
|
+
require('../components/Tag.js');
|
|
14
|
+
require('../components/Toggle.js');
|
|
15
|
+
require('../components/TextArea.js');
|
|
16
|
+
require('@tecsinapse/cortex-core');
|
|
17
|
+
require('react-icons/md');
|
|
18
|
+
require('clsx');
|
|
19
|
+
require('../styles/progressBar.js');
|
|
20
|
+
require('../styles/groupButton.js');
|
|
21
|
+
require('../components/GroupButton.js');
|
|
22
|
+
var DefaultSnack = require('../components/DefaultSnack.js');
|
|
23
|
+
|
|
24
|
+
class SnackbarSonner {
|
|
25
|
+
custom(Component, options) {
|
|
26
|
+
return sonner.toast.custom(() => Component, {
|
|
27
|
+
...options,
|
|
28
|
+
duration: options?.duration ?? 5e3
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
show(type, message, options) {
|
|
32
|
+
return sonner.toast.custom(
|
|
33
|
+
(t) => {
|
|
34
|
+
return /* @__PURE__ */ React.createElement(
|
|
35
|
+
DefaultSnack.DefaultSnack,
|
|
36
|
+
{
|
|
37
|
+
text: message,
|
|
38
|
+
variants: { intent: type },
|
|
39
|
+
onDismiss: () => sonner.toast.dismiss(t)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
{ ...options, duration: options?.duration ?? 5e3 }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.SnackbarSonner = SnackbarSonner;
|
|
@@ -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 { 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 };
|
|
@@ -6,7 +6,7 @@ import './Hint.js';
|
|
|
6
6
|
import { Input } from './Input.js';
|
|
7
7
|
import './Modal.js';
|
|
8
8
|
import './Select.js';
|
|
9
|
-
import './
|
|
9
|
+
import './BaseSnackbar.js';
|
|
10
10
|
import './Tag.js';
|
|
11
11
|
import './Toggle.js';
|
|
12
12
|
import './TextArea.js';
|
|
@@ -16,6 +16,7 @@ import 'clsx';
|
|
|
16
16
|
import '../styles/progressBar.js';
|
|
17
17
|
import '../styles/groupButton.js';
|
|
18
18
|
import './GroupButton.js';
|
|
19
|
+
import 'react-icons/io';
|
|
19
20
|
import { AiOutlineLoading } from 'react-icons/ai';
|
|
20
21
|
import { IoSearchOutline } from 'react-icons/io5';
|
|
21
22
|
import { useDebouncedState } from '../hooks/useDebouncedState.js';
|
|
@@ -46,7 +47,7 @@ const SearchInput = ({
|
|
|
46
47
|
onClick(searchInput);
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
|
-
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,
|
|
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(
|
|
50
51
|
Input.Box,
|
|
51
52
|
{
|
|
52
53
|
placeholder,
|
|
@@ -66,7 +67,7 @@ const SearchInput = ({
|
|
|
66
67
|
onClick: () => onClick(searchInput),
|
|
67
68
|
disabled: !searchInput || isSubmitting
|
|
68
69
|
},
|
|
69
|
-
isSubmitting ? /* @__PURE__ */ React.createElement("div", { className: "animate-spin" }, /* @__PURE__ */ React.createElement(AiOutlineLoading,
|
|
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" })
|
|
70
71
|
));
|
|
71
72
|
};
|
|
72
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",
|
|
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,
|
|
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
|
|
|
@@ -5,43 +5,38 @@ 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
19
|
const TRowHeader = ({
|
|
20
20
|
children
|
|
21
|
-
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("tr", { className: tRow() }, children), /* @__PURE__ */ React.createElement("tr", { className: tRow() }, /* @__PURE__ */ React.createElement("td", { colSpan: 99 }, /* @__PURE__ */ React.createElement("hr", { className: hr() }))));
|
|
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() }))));
|
|
22
22
|
const TCell = ({
|
|
23
23
|
children,
|
|
24
24
|
className,
|
|
25
25
|
...rest
|
|
26
|
-
}) => /* @__PURE__ */ React.createElement("td", { className: tCell({ className }), ...rest }, children);
|
|
26
|
+
}) => /* @__PURE__ */ React.createElement("td", { className: tCell({ className }), "data-testid": "tcell", ...rest }, children);
|
|
27
27
|
const TFoot = ({
|
|
28
28
|
children,
|
|
29
29
|
className,
|
|
30
30
|
...rest
|
|
31
|
-
}) => /* @__PURE__ */ React.createElement("tfoot", { className: tFoot({ className }), ...rest }, children);
|
|
31
|
+
}) => /* @__PURE__ */ React.createElement("tfoot", { className: tFoot({ className }), "data-testid": "tfoot", ...rest }, children);
|
|
32
32
|
const Table = ({
|
|
33
33
|
children,
|
|
34
34
|
className,
|
|
35
35
|
...rest
|
|
36
|
-
}) => /* @__PURE__ */ React.createElement("table", { className: tRoot({ className }), ...rest }, children);
|
|
37
|
-
const Hr = ({
|
|
38
|
-
children,
|
|
39
|
-
className,
|
|
40
|
-
...rest
|
|
41
|
-
}) => /* @__PURE__ */ React.createElement("hr", { className: hr({ className }), ...rest }, children);
|
|
36
|
+
}) => /* @__PURE__ */ React.createElement("table", { className: tRoot({ className }), "data-testid": "table", ...rest }, children);
|
|
42
37
|
const Td = ({
|
|
43
38
|
children,
|
|
44
39
|
...rest
|
|
45
|
-
}) => /* @__PURE__ */ React.createElement("td", { ...rest }, children);
|
|
40
|
+
}) => /* @__PURE__ */ React.createElement("td", { ...rest, "data-testid": "td" }, children);
|
|
46
41
|
|
|
47
|
-
export {
|
|
42
|
+
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td };
|
package/dist/esm/index.js
CHANGED
|
@@ -5,14 +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 {
|
|
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 {
|
|
12
|
+
export { TCell, TFoot, THead, THeadCell, TRow, TRowHeader, Table, Td } from './components/Table.js';
|
|
13
13
|
export { Drawer } from './components/Drawer.js';
|
|
14
14
|
export { Breadcrumbs } from './components/Breadcrumbs.js';
|
|
15
15
|
export { Avatar } from './components/Avatar.js';
|
|
16
16
|
export { Skeleton } from './components/Skeleton.js';
|
|
17
17
|
export { ProgressBar } from './components/ProgressBar.js';
|
|
18
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,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { SnackbarVariants } from '@tecsinapse/cortex-core';
|
|
3
|
+
interface SnackbarProps {
|
|
4
|
+
variants?: SnackbarVariants;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
show: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const BaseSnackbar: React.ForwardRefExoticComponent<SnackbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export {};
|
|
@@ -9,6 +9,5 @@ export declare const TRowHeader: ({ children, }: TableCommon & ThHTMLAttributes<
|
|
|
9
9
|
export declare const TCell: ({ children, className, ...rest }: TableCommon & TdHTMLAttributes<HTMLTableCellElement>) => JSX.Element;
|
|
10
10
|
export declare const TFoot: ({ children, className, ...rest }: TableCommon & HTMLAttributes<HTMLTableSectionElement>) => JSX.Element;
|
|
11
11
|
export declare const Table: ({ children, className, ...rest }: TableCommon & TableHTMLAttributes<HTMLTableElement>) => JSX.Element;
|
|
12
|
-
export declare const Hr: ({ children, className, ...rest }: TableCommon & HTMLAttributes<HTMLHRElement>) => JSX.Element;
|
|
13
12
|
export declare const Td: ({ children, ...rest }: TableCommon & TdHTMLAttributes<HTMLTableCellElement>) => JSX.Element;
|
|
14
13
|
export {};
|
|
@@ -5,7 +5,7 @@ export * from './Hint';
|
|
|
5
5
|
export * from './Input';
|
|
6
6
|
export * from './Modal';
|
|
7
7
|
export { default as Select } from './Select';
|
|
8
|
-
export * from './
|
|
8
|
+
export * from './BaseSnackbar';
|
|
9
9
|
export * from './Tag';
|
|
10
10
|
export * from './Toggle';
|
|
11
11
|
export * from './TextArea';
|
|
@@ -16,3 +16,4 @@ export * from './Avatar';
|
|
|
16
16
|
export * from './Skeleton';
|
|
17
17
|
export * from './ProgressBar';
|
|
18
18
|
export * from './GroupButton';
|
|
19
|
+
export * from './DefaultSnack';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SnackbarSonner } from '../service';
|
|
3
|
+
interface SnackbarProviderProps {
|
|
4
|
+
snackbar: SnackbarSonner;
|
|
5
|
+
}
|
|
6
|
+
export declare const SnackbarProvider: ({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
export declare const useSnackbar: () => SnackbarProviderProps;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { SnackbarVariants } from '@tecsinapse/cortex-core';
|
|
3
|
+
export type TypeSnack = SnackbarVariants['intent'];
|
|
4
|
+
export interface ISnackbar<T> {
|
|
5
|
+
show(type: TypeSnack, message: string, options?: T): any;
|
|
6
|
+
custom(component: ReactElement, options?: T): any;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ExternalToast } from 'sonner';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ISnackbar, TypeSnack } from './ISnackbar';
|
|
4
|
+
export declare class SnackbarSonner implements ISnackbar<ExternalToast> {
|
|
5
|
+
custom(Component: React.ReactElement, options?: ExternalToast): string | number;
|
|
6
|
+
show(type: TypeSnack, message: string, options?: Omit<ExternalToast, 'className' | 'style'>): string | number;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.2.2-beta.
|
|
3
|
+
"version": "1.2.2-beta.1",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
"test:watch": "jest --watch"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tecsinapse/cortex-core": "0.2.2-beta.
|
|
21
|
+
"@tecsinapse/cortex-core": "0.2.2-beta.1",
|
|
22
22
|
"clsx": "*",
|
|
23
|
-
"react-icons": "^5.2.1"
|
|
23
|
+
"react-icons": "^5.2.1",
|
|
24
|
+
"sonner": "^1.5.0"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|
|
@@ -36,5 +37,5 @@
|
|
|
36
37
|
"react-dom": ">=18.0.0",
|
|
37
38
|
"tailwind": ">=3.3.0"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "81e9de94c71206e059fd761b95cbe35196099e70"
|
|
40
41
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var cortexCore = require('@tecsinapse/cortex-core');
|
|
5
|
-
|
|
6
|
-
const Snackbar = React.forwardRef((props, ref) => {
|
|
7
|
-
const { children, show, variants } = props;
|
|
8
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement(
|
|
9
|
-
"div",
|
|
10
|
-
{
|
|
11
|
-
className: cortexCore.snackbar(variants),
|
|
12
|
-
ref
|
|
13
|
-
},
|
|
14
|
-
children
|
|
15
|
-
) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
exports.Snackbar = Snackbar;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { snackbar } from '@tecsinapse/cortex-core';
|
|
3
|
-
|
|
4
|
-
const Snackbar = forwardRef((props, ref) => {
|
|
5
|
-
const { children, show, variants } = props;
|
|
6
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, show ? /* @__PURE__ */ React.createElement(
|
|
7
|
-
"div",
|
|
8
|
-
{
|
|
9
|
-
className: snackbar(variants),
|
|
10
|
-
ref
|
|
11
|
-
},
|
|
12
|
-
children
|
|
13
|
-
) : /* @__PURE__ */ React.createElement(React.Fragment, null));
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export { Snackbar };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SnackbarVariants } from '@tecsinapse/cortex-core';
|
|
3
|
-
interface SnackbarProps {
|
|
4
|
-
variants?: SnackbarVariants;
|
|
5
|
-
children: JSX.Element;
|
|
6
|
-
show: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const Snackbar: React.ForwardRefExoticComponent<SnackbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export {};
|