@luscii-healthtech/web-ui 0.5.2 → 0.6.2
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/components/ButtonV2/ButtonProps.type.d.ts +3 -0
- package/dist/components/ButtonV2/ButtonV2.d.ts +1 -1
- package/dist/components/List/List.d.ts +7 -0
- package/dist/components/List/ListItem.d.ts +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/web-ui-tailwind.css +14 -0
- package/dist/web-ui.cjs.development.js +83 -28
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +83 -29
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +4 -2
- package/src/components/ButtonV2/ButtonProps.type.ts +5 -1
- package/src/components/ButtonV2/ButtonV2.tsx +11 -5
- package/src/components/ButtonV2/PrimaryButton.tsx +1 -0
- package/src/components/ButtonV2/SecondaryButton.tsx +2 -0
- package/src/components/ButtonV2/TertiaryButton.tsx +2 -0
- package/src/components/List/List.tsx +20 -0
- package/src/components/List/ListItem.tsx +45 -0
- package/src/components/Table/Table.tsx +12 -10
- package/src/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.6.2",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"build-tailwind": "NODE_ENV=production yarn run tailwindcss build tailwind.css -o ./dist/web-ui-tailwind.css"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"react": ">=16"
|
|
27
|
+
"react": ">=16",
|
|
28
|
+
"react-tooltip": "^4.2.21"
|
|
28
29
|
},
|
|
29
30
|
"husky": {
|
|
30
31
|
"hooks": {
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
"react": "^18.2.0",
|
|
83
84
|
"react-dom": "^18.2.0",
|
|
84
85
|
"react-is": "^18.2.0",
|
|
86
|
+
"react-tooltip": "^4.2.21",
|
|
85
87
|
"rollup-plugin-postcss": "^4.0.2",
|
|
86
88
|
"rollup-plugin-scss": "^3.0.0",
|
|
87
89
|
"rollup-plugin-svg": "^2.0.0",
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { IconProps } from "../Icons/types/IconProps.type";
|
|
2
|
+
import { TextColor, TextHoverColor } from "../Text/Text";
|
|
2
3
|
|
|
3
|
-
export interface BaseButtonProps
|
|
4
|
+
export interface BaseButtonProps
|
|
5
|
+
extends React.HTMLAttributes<HTMLButtonElement> {
|
|
4
6
|
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
5
7
|
text?: string;
|
|
8
|
+
textColor?: TextColor;
|
|
9
|
+
textHoverColor?: TextHoverColor;
|
|
6
10
|
icon?: React.FunctionComponent<IconProps>;
|
|
7
11
|
isDisabled?: boolean;
|
|
8
12
|
className?: string;
|
|
@@ -2,12 +2,15 @@ import classNames from "classnames";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
import { Spinner } from "../Spinner/Spinner";
|
|
5
|
+
import Text from "../Text/Text";
|
|
5
6
|
|
|
6
7
|
import { ButtonProps } from "./ButtonProps.type";
|
|
7
8
|
|
|
8
9
|
export const ButtonV2 = ({
|
|
9
10
|
onClick,
|
|
10
11
|
text,
|
|
12
|
+
textColor,
|
|
13
|
+
textHoverColor,
|
|
11
14
|
icon,
|
|
12
15
|
isDisabled,
|
|
13
16
|
isPending,
|
|
@@ -32,6 +35,7 @@ export const ButtonV2 = ({
|
|
|
32
35
|
"shadow-sm",
|
|
33
36
|
"cursor-pointer",
|
|
34
37
|
"focus:outline-primary",
|
|
38
|
+
"group",
|
|
35
39
|
],
|
|
36
40
|
{
|
|
37
41
|
"w-11": !text && icon,
|
|
@@ -72,14 +76,16 @@ export const ButtonV2 = ({
|
|
|
72
76
|
)}
|
|
73
77
|
|
|
74
78
|
{text && (
|
|
75
|
-
<
|
|
76
|
-
className={classNames(
|
|
79
|
+
<Text
|
|
80
|
+
className={classNames({
|
|
77
81
|
invisible: isPending,
|
|
78
82
|
"ml-1": icon,
|
|
79
83
|
})}
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
|
|
84
|
+
text={text}
|
|
85
|
+
color={textColor}
|
|
86
|
+
hoverColor={textHoverColor}
|
|
87
|
+
hoverInGroup
|
|
88
|
+
/>
|
|
83
89
|
)}
|
|
84
90
|
</button>
|
|
85
91
|
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
|
|
4
|
+
import { ListItem, ListItemProps } from "./ListItem";
|
|
5
|
+
|
|
6
|
+
export interface ListProps {
|
|
7
|
+
items: ListItemProps[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const List = ({ items }: ListProps): JSX.Element => {
|
|
11
|
+
return (
|
|
12
|
+
<ul className={classNames("list-none")}>
|
|
13
|
+
{items.map(item => (
|
|
14
|
+
<ListItem {...item} key={item.itemId} />
|
|
15
|
+
))}
|
|
16
|
+
</ul>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default List;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
|
|
4
|
+
import { IconProps } from "../Icons/types/IconProps.type";
|
|
5
|
+
import Text from "../Text/Text";
|
|
6
|
+
|
|
7
|
+
export interface ListItemProps {
|
|
8
|
+
itemId: string | number;
|
|
9
|
+
title: string;
|
|
10
|
+
subTitle?: string;
|
|
11
|
+
icon?: React.FunctionComponent<IconProps> | null;
|
|
12
|
+
accessories?: JSX.Element[];
|
|
13
|
+
handleItemClick?: () => void;
|
|
14
|
+
tooltipId?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const ListItem = ({
|
|
18
|
+
icon,
|
|
19
|
+
subTitle,
|
|
20
|
+
title,
|
|
21
|
+
accessories,
|
|
22
|
+
tooltipId,
|
|
23
|
+
...restProps
|
|
24
|
+
}: ListItemProps): JSX.Element => (
|
|
25
|
+
<li
|
|
26
|
+
className={classNames(
|
|
27
|
+
"flex flex-row items-center space-x-4",
|
|
28
|
+
"p-4 border-b last:border-b-0 border-slate-200",
|
|
29
|
+
{ "cursor-pointer": restProps.handleItemClick }
|
|
30
|
+
)}
|
|
31
|
+
onClick={restProps.handleItemClick}
|
|
32
|
+
data-tip={restProps.itemId}
|
|
33
|
+
data-for={tooltipId}
|
|
34
|
+
>
|
|
35
|
+
{icon && React.createElement(icon, { className: "w-6 h-6" })}
|
|
36
|
+
<div className={classNames({ "pl-10": icon === null })}>
|
|
37
|
+
<Text text={title} />
|
|
38
|
+
{subTitle && <Text text={subTitle} type={"sm"} />}
|
|
39
|
+
</div>
|
|
40
|
+
<div className={"flex-grow"} />
|
|
41
|
+
{accessories}
|
|
42
|
+
</li>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export default ListItem;
|
|
@@ -51,19 +51,20 @@ export function Table<Item>({
|
|
|
51
51
|
)}
|
|
52
52
|
{...otherAttributes}
|
|
53
53
|
>
|
|
54
|
-
{showHeader
|
|
54
|
+
{showHeader ? (
|
|
55
55
|
<TableHeader
|
|
56
56
|
className="border-b border-slate-100"
|
|
57
57
|
fieldConfigurations={fieldConfigurations}
|
|
58
58
|
/>
|
|
59
|
-
)}
|
|
59
|
+
) : null}
|
|
60
60
|
|
|
61
61
|
<TableBody
|
|
62
62
|
className={classNames({
|
|
63
63
|
"border-b border-slate-100":
|
|
64
64
|
!showEmptyView &&
|
|
65
65
|
paginationMenuProps &&
|
|
66
|
-
paginationMenuProps.
|
|
66
|
+
paginationMenuProps.currentPageNumber > 0 &&
|
|
67
|
+
paginationMenuProps.pageCount > 0,
|
|
67
68
|
})}
|
|
68
69
|
items={items}
|
|
69
70
|
fieldConfigurations={fieldConfigurations}
|
|
@@ -75,13 +76,14 @@ export function Table<Item>({
|
|
|
75
76
|
/>
|
|
76
77
|
|
|
77
78
|
{!showEmptyView &&
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
paginationMenuProps &&
|
|
80
|
+
paginationMenuProps.currentPageNumber > 0 &&
|
|
81
|
+
paginationMenuProps.pageCount > 0 ? (
|
|
82
|
+
<TableFooter
|
|
83
|
+
colSpan={fieldConfigurations.length}
|
|
84
|
+
paginationMenuProps={paginationMenuProps}
|
|
85
|
+
/>
|
|
86
|
+
) : null}
|
|
85
87
|
</table>
|
|
86
88
|
);
|
|
87
89
|
}
|
package/src/index.tsx
CHANGED
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
LoadingIndicatorProps,
|
|
36
36
|
} from "./components/LoadingIndicator/LoadingIndicator";
|
|
37
37
|
export { default as Menu } from "./components/Menu/Menu";
|
|
38
|
+
export { List } from "./components/List/List";
|
|
38
39
|
export { MultiSelect } from "./components/MultiSelect/MultiSelect";
|
|
39
40
|
export { NavLayout, NavMenuLayoutProps } from "./components/NavMenu/NavLayout";
|
|
40
41
|
export { NavMenu, NavMenuElement } from "./components/NavMenu/NavMenu";
|