@luscii-healthtech/web-ui 0.2.2 → 0.4.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/components/Section/SectionItem.d.ts +9 -0
- package/dist/components/{TextListItem/TextListItem.d.ts → Section/SectionItemWithContent.d.ts} +3 -3
- package/dist/components/Steps/Step.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +2 -2
- package/dist/components/Tag/Tag.utils.d.ts +4 -0
- package/dist/components/Tag/TagGroup.d.ts +2 -5
- package/dist/components/Text/Text.d.ts +5 -3
- package/dist/index.d.ts +2 -2
- package/dist/web-ui-tailwind.css +2111 -0
- package/dist/web-ui.cjs.development.css +58 -58
- package/dist/web-ui.cjs.development.js +99 -75
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.css +58 -58
- 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.css +58 -58
- package/dist/web-ui.esm.js +98 -74
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +13 -5
- package/src/components/Checkbox/Checkbox.tsx +27 -13
- package/src/components/Dropdown/Dropdown.js +89 -37
- package/src/components/InfoField/InfoField.tsx +12 -4
- package/src/components/ListTable/ListTable.tsx +2 -1
- package/src/components/ListTable/ListTableCell.tsx +15 -4
- package/src/components/NavMenu/NavMenuItem.tsx +12 -6
- package/src/components/NotificationBanner/NotificationBanner.tsx +29 -9
- package/src/components/PaginationMenu/PaginationMenuLarge.tsx +1 -1
- package/src/components/PaginationMenu/PaginationMenuSmall.tsx +1 -1
- package/src/components/{ListItem/ListItem.scss → Section/SectionItem.scss} +0 -0
- package/src/components/{ListItem/ListItem.tsx → Section/SectionItem.tsx} +7 -7
- package/src/components/{TextListItem/TextListItem.js → Section/SectionItemWithContent.js} +10 -9
- package/src/components/{TextListItem/TextListItem.scss → Section/SectionItemWithContent.scss} +2 -2
- package/src/components/Steps/Step.tsx +12 -3
- package/src/components/Tag/Tag.tsx +31 -12
- package/src/components/Tag/Tag.utils.ts +4 -0
- package/src/components/Tag/TagGroup.tsx +12 -8
- package/src/components/Text/Text.tsx +87 -37
- package/src/components/ViewItem/ViewItem.tsx +21 -9
- package/src/index.tsx +4 -4
- package/dist/components/ListItem/ListItem.d.ts +0 -9
|
@@ -3,24 +3,25 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
|
|
5
5
|
import LegacyText from "../Text/LegacyText";
|
|
6
|
-
import "./TextListItem.scss";
|
|
7
|
-
import ListItem from "../ListItem/ListItem";
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
import "./SectionItemWithContent.scss";
|
|
8
|
+
import SectionItem from "./SectionItem";
|
|
9
|
+
|
|
10
|
+
function SectionItemWithContent(props) {
|
|
10
11
|
const { text, icon, className, iconClass, onClick, ...rest } = props;
|
|
11
12
|
|
|
12
|
-
const mergedClasses = classNames("cweb-text-
|
|
13
|
-
const iconClasses = classNames("cweb-text-
|
|
13
|
+
const mergedClasses = classNames("cweb-section-text-item", className);
|
|
14
|
+
const iconClasses = classNames("cweb-section-text-item-icon", iconClass);
|
|
14
15
|
|
|
15
16
|
return (
|
|
16
|
-
<
|
|
17
|
+
<SectionItem className={mergedClasses} onClick={onClick} {...rest}>
|
|
17
18
|
{icon && <img className={iconClasses} src={icon} alt="" />}
|
|
18
19
|
<LegacyText text={text} />
|
|
19
|
-
</
|
|
20
|
+
</SectionItem>
|
|
20
21
|
);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
SectionItemWithContent.propTypes = {
|
|
24
25
|
text: PropTypes.string.isRequired,
|
|
25
26
|
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
26
27
|
className: PropTypes.string,
|
|
@@ -28,4 +29,4 @@ TextListItem.propTypes = {
|
|
|
28
29
|
onClick: PropTypes.func,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
|
-
export default
|
|
32
|
+
export default SectionItemWithContent;
|
|
@@ -6,16 +6,25 @@ export interface StepProps {
|
|
|
6
6
|
title: string;
|
|
7
7
|
stepNumber: number;
|
|
8
8
|
active: boolean;
|
|
9
|
-
localization: {step: string};
|
|
9
|
+
localization: { step: string };
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const Step = ({
|
|
12
|
+
export const Step = ({
|
|
13
|
+
title,
|
|
14
|
+
stepNumber,
|
|
15
|
+
active,
|
|
16
|
+
localization,
|
|
17
|
+
}: StepProps): JSX.Element => {
|
|
13
18
|
const barColor = active ? "bg-blue-800" : "bg-slate-200";
|
|
14
19
|
|
|
15
20
|
return (
|
|
16
21
|
<div className={"w-full"}>
|
|
17
22
|
<div className={`w-full h-1 mb-2 rounded ${barColor}`}></div>
|
|
18
|
-
<Text
|
|
23
|
+
<Text
|
|
24
|
+
text={`${localization.step} ${stepNumber}`}
|
|
25
|
+
type={"strong"}
|
|
26
|
+
color={active ? "blue-800" : "slate-500"}
|
|
27
|
+
/>
|
|
19
28
|
<Text text={title} type={"strong"} />
|
|
20
29
|
</div>
|
|
21
30
|
);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
|
-
import { Text } from "../Text/Text";
|
|
4
|
+
import { Text, TextColor } from "../Text/Text";
|
|
5
5
|
|
|
6
|
-
import { TagSize } from "./
|
|
6
|
+
import { TagSize } from "./Tag.utils";
|
|
7
7
|
|
|
8
8
|
export enum TagColorTheme {
|
|
9
9
|
Red = "red",
|
|
@@ -20,18 +20,37 @@ export interface TagProps {
|
|
|
20
20
|
className?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const Tag = ({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const Tag = ({
|
|
24
|
+
text,
|
|
25
|
+
colorTheme = TagColorTheme.Gray,
|
|
26
|
+
className,
|
|
27
|
+
size = TagSize.base,
|
|
28
|
+
}: TagProps): JSX.Element => {
|
|
29
|
+
const textColor: Record<TagColorTheme, TextColor> = {
|
|
30
|
+
[TagColorTheme.Red]: "red",
|
|
31
|
+
[TagColorTheme.Amber]: "amber",
|
|
32
|
+
[TagColorTheme.Green]: "green",
|
|
33
|
+
[TagColorTheme.Gray]: "base",
|
|
34
|
+
// Blue must be 800 here to pass the contrast test
|
|
35
|
+
[TagColorTheme.Blue]: "blue-800",
|
|
36
|
+
};
|
|
31
37
|
|
|
32
38
|
return (
|
|
33
|
-
<div
|
|
34
|
-
|
|
39
|
+
<div
|
|
40
|
+
className={classNames("inline py-1 px-2 rounded-lg", className, {
|
|
41
|
+
"bg-red-50": colorTheme === TagColorTheme.Red,
|
|
42
|
+
"bg-orange-50": colorTheme === TagColorTheme.Amber,
|
|
43
|
+
"bg-green-50": colorTheme === TagColorTheme.Green,
|
|
44
|
+
"bg-slate-50": colorTheme === TagColorTheme.Gray,
|
|
45
|
+
"bg-blue-50": colorTheme === TagColorTheme.Blue,
|
|
46
|
+
})}
|
|
47
|
+
>
|
|
48
|
+
<Text
|
|
49
|
+
inline
|
|
50
|
+
color={textColor[colorTheme]}
|
|
51
|
+
text={text}
|
|
52
|
+
type={size === TagSize.small ? "sm" : "base"}
|
|
53
|
+
/>
|
|
35
54
|
</div>
|
|
36
55
|
);
|
|
37
56
|
};
|
|
@@ -2,11 +2,7 @@ import React from "react";
|
|
|
2
2
|
import classNames from "classnames";
|
|
3
3
|
|
|
4
4
|
import Tag, { TagProps } from "./Tag";
|
|
5
|
-
|
|
6
|
-
export enum TagSize {
|
|
7
|
-
"small" = "small",
|
|
8
|
-
"base" = "base",
|
|
9
|
-
}
|
|
5
|
+
import { TagSize } from "./Tag.utils";
|
|
10
6
|
|
|
11
7
|
interface TagGroupProps {
|
|
12
8
|
tags: TagProps[];
|
|
@@ -14,10 +10,18 @@ interface TagGroupProps {
|
|
|
14
10
|
className?: string;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
|
-
const TagGroup = ({
|
|
13
|
+
const TagGroup = ({
|
|
14
|
+
tags,
|
|
15
|
+
tagSize = TagSize.base,
|
|
16
|
+
className,
|
|
17
|
+
}: TagGroupProps): JSX.Element => (
|
|
18
18
|
<div className={classNames("flex flex-row flex-wrap", className)}>
|
|
19
|
-
{tags.map(
|
|
20
|
-
<Tag
|
|
19
|
+
{tags.map(tag => (
|
|
20
|
+
<Tag
|
|
21
|
+
size={tagSize}
|
|
22
|
+
{...tag}
|
|
23
|
+
className={classNames("mr-2 last:mr-0 mb-2")}
|
|
24
|
+
/>
|
|
21
25
|
))}
|
|
22
26
|
</div>
|
|
23
27
|
);
|
|
@@ -5,17 +5,36 @@ import { RestPropped } from "../../types/general.types";
|
|
|
5
5
|
|
|
6
6
|
import "./Text.scss";
|
|
7
7
|
|
|
8
|
-
export type TextStyle =
|
|
8
|
+
export type TextStyle =
|
|
9
|
+
| "sm"
|
|
10
|
+
| "sm-strong"
|
|
11
|
+
| "base"
|
|
12
|
+
| "strong"
|
|
13
|
+
| "lg"
|
|
14
|
+
| "lg-strong"
|
|
15
|
+
| "xl"
|
|
16
|
+
| "xl-strong";
|
|
9
17
|
|
|
10
18
|
//Extend with other colors that we want to enable for text
|
|
11
|
-
export type TextColor =
|
|
19
|
+
export type TextColor =
|
|
20
|
+
| "base"
|
|
21
|
+
| "slate-500"
|
|
22
|
+
| "slate-200"
|
|
23
|
+
| "white"
|
|
24
|
+
| "blue-800"
|
|
25
|
+
| "red"
|
|
26
|
+
| "green"
|
|
27
|
+
| "amber";
|
|
28
|
+
|
|
29
|
+
export type TextHoverColor = "blue-900" | "white";
|
|
12
30
|
|
|
13
31
|
export interface TextProps extends RestPropped {
|
|
14
32
|
text: string;
|
|
15
33
|
type?: TextStyle; //defaults to "base"
|
|
16
34
|
inline?: boolean; //defaults to false
|
|
17
35
|
color?: TextColor; //defaults to "base"
|
|
18
|
-
hoverColor?:
|
|
36
|
+
hoverColor?: TextHoverColor; //defaults to "base"
|
|
37
|
+
hoverInGroup?: boolean;
|
|
19
38
|
className?: string;
|
|
20
39
|
containsDangerousHtml?: boolean; //defaults to false
|
|
21
40
|
truncate?: boolean; //defaults to false
|
|
@@ -23,43 +42,74 @@ export interface TextProps extends RestPropped {
|
|
|
23
42
|
}
|
|
24
43
|
|
|
25
44
|
export const Text = (props: TextProps): JSX.Element => {
|
|
45
|
+
/**
|
|
46
|
+
* One might argue that we're duplicating strings in this file.
|
|
47
|
+
* That's how tailwind expects to detect used classes, so please do not make
|
|
48
|
+
* anything dynamic or try to string concat class names.
|
|
49
|
+
* https://v1.tailwindcss.com/docs/controlling-file-size
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
const allowedColors: Record<TextColor, string> = {
|
|
53
|
+
base: "text-slate-700",
|
|
54
|
+
"slate-500": "text-slate-500",
|
|
55
|
+
"slate-200": "text-slate-200",
|
|
56
|
+
red: "text-red-700",
|
|
57
|
+
green: "text-green-700",
|
|
58
|
+
amber: "text-yellow-700",
|
|
59
|
+
white: "text-white",
|
|
60
|
+
"blue-800": "text-blue-800",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const allowedHoverColors: Record<TextHoverColor, string> = {
|
|
64
|
+
"blue-900": "hover:text-blue-900",
|
|
65
|
+
white: "hover:text-white",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// What is a group hover? https://v1.tailwindcss.com/docs/pseudo-class-variants#group-hover
|
|
69
|
+
const allowedGroupHoverColors: Record<TextHoverColor, string> = {
|
|
70
|
+
"blue-900": "group-hover:text-blue-900",
|
|
71
|
+
white: "group-hover:text-white",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const selectedHoverColor =
|
|
75
|
+
props.hoverColor &&
|
|
76
|
+
!props.hoverInGroup &&
|
|
77
|
+
allowedHoverColors[props.hoverColor];
|
|
78
|
+
|
|
79
|
+
const selectedGroupHoverColor =
|
|
80
|
+
props.hoverColor &&
|
|
81
|
+
props.hoverInGroup &&
|
|
82
|
+
allowedGroupHoverColors[props.hoverColor];
|
|
83
|
+
|
|
26
84
|
const containerProps = {
|
|
27
85
|
"data-test-id": props["data-test-id"],
|
|
28
86
|
className: classNames(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"text-white": props.color === "white",
|
|
56
|
-
"text-primary-dark": props.color === "blue",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"in-html-link": props.containsDangerousHtml,
|
|
60
|
-
},
|
|
61
|
-
//can be used to overwrite other classes like the color
|
|
62
|
-
props.className
|
|
87
|
+
// apply different style classes
|
|
88
|
+
// for now we stick with font-size 16px on the body
|
|
89
|
+
// so I am adjusting our styles accordingly (one step down)
|
|
90
|
+
{
|
|
91
|
+
"text-xs font-medium": props.type === "sm",
|
|
92
|
+
"text-xs font-semibold": props.type === "sm-strong",
|
|
93
|
+
"text-sm": props.type === "base",
|
|
94
|
+
"text-sm font-semibold": props.type === "strong",
|
|
95
|
+
"": props.type === "lg",
|
|
96
|
+
"font-semibold": props.type === "lg-strong",
|
|
97
|
+
"text-lg": props.type === "xl",
|
|
98
|
+
"font-semibold text-lg": props.type === "xl-strong",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
inline: props.inline,
|
|
102
|
+
// FIXME: this class doesn't do anything without a max-width
|
|
103
|
+
truncate: props.truncate,
|
|
104
|
+
},
|
|
105
|
+
allowedColors[props.color || "base"],
|
|
106
|
+
selectedHoverColor,
|
|
107
|
+
selectedGroupHoverColor,
|
|
108
|
+
{
|
|
109
|
+
"in-html-link": props.containsDangerousHtml,
|
|
110
|
+
},
|
|
111
|
+
//can be used to overwrite other classes like the color
|
|
112
|
+
props.className
|
|
63
113
|
),
|
|
64
114
|
};
|
|
65
115
|
|
|
@@ -6,7 +6,8 @@ import Button from "../Button/Button";
|
|
|
6
6
|
import { RestPropped } from "../../types/general.types";
|
|
7
7
|
import { ButtonProps } from "../Button/Button.types";
|
|
8
8
|
|
|
9
|
-
export interface ViewItemProps<AccessoryType extends JSX.Element>
|
|
9
|
+
export interface ViewItemProps<AccessoryType extends JSX.Element>
|
|
10
|
+
extends RestPropped {
|
|
10
11
|
titleProps?: TextProps;
|
|
11
12
|
// deprecated: use titleProps instead
|
|
12
13
|
title?: string;
|
|
@@ -22,7 +23,7 @@ export interface ViewItemProps<AccessoryType extends JSX.Element> extends RestPr
|
|
|
22
23
|
buttons?: ButtonProps[];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
export function ViewItem<AccessoryType extends JSX.Element>
|
|
26
|
+
export function ViewItem<AccessoryType extends JSX.Element>({
|
|
26
27
|
titleProps,
|
|
27
28
|
title,
|
|
28
29
|
titleAccessory,
|
|
@@ -36,29 +37,40 @@ export function ViewItem<AccessoryType extends JSX.Element> ({
|
|
|
36
37
|
const titlePropsMerged = titleProps ?? { text: title ?? defaultContent };
|
|
37
38
|
const contentPropsMerged =
|
|
38
39
|
contentProps ??
|
|
39
|
-
content?.map(
|
|
40
|
+
content?.map(line => {
|
|
40
41
|
return { text: line, className: "cweb-view-content-text" } as TextProps;
|
|
41
42
|
});
|
|
42
43
|
|
|
43
44
|
return (
|
|
44
45
|
<div className={classNames("vitals-view-item", className)} {...restProps}>
|
|
45
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
className={
|
|
48
|
+
"vitals-view-item-title-line flex justify-start flex-row items-start"
|
|
49
|
+
}
|
|
50
|
+
>
|
|
46
51
|
{titlePropsMerged && (
|
|
47
52
|
<Text
|
|
48
|
-
className={classNames(
|
|
49
|
-
|
|
53
|
+
className={classNames(
|
|
54
|
+
titlePropsMerged.className,
|
|
55
|
+
"vitals-view-item-title mb-1 mr-2"
|
|
56
|
+
)}
|
|
57
|
+
color="slate-500"
|
|
50
58
|
{...titlePropsMerged}
|
|
51
59
|
/>
|
|
52
60
|
)}
|
|
53
61
|
{titleAccessory}
|
|
54
62
|
</div>
|
|
55
63
|
{contentPropsMerged &&
|
|
56
|
-
contentPropsMerged?.map(
|
|
57
|
-
|
|
64
|
+
contentPropsMerged?.map(textProps => (
|
|
65
|
+
<Text {...textProps} key={textProps.key || textProps.text} />
|
|
66
|
+
))}
|
|
67
|
+
{(!contentPropsMerged || contentPropsMerged?.length === 0) && (
|
|
68
|
+
<Text text={defaultContent} key="empty-text" />
|
|
69
|
+
)}
|
|
58
70
|
|
|
59
71
|
<div className="flex flex-row cweb-view-buttons" key="cweb-view-buttons">
|
|
60
72
|
{buttons &&
|
|
61
|
-
buttons.map(
|
|
73
|
+
buttons.map(button => (
|
|
62
74
|
<Button
|
|
63
75
|
{...button}
|
|
64
76
|
className={classNames("cweb-view-button ml-3", button.className)}
|
package/src/index.tsx
CHANGED
|
@@ -24,9 +24,9 @@ export { InfoField } from "./components/InfoField/InfoField";
|
|
|
24
24
|
export { INPUT_TYPES, default as Input } from "./components/Input/Input";
|
|
25
25
|
export { default as Line } from "./components/Line/Line";
|
|
26
26
|
export {
|
|
27
|
-
default as
|
|
28
|
-
|
|
29
|
-
} from "./components/
|
|
27
|
+
default as SectionItem,
|
|
28
|
+
SectionItemProps,
|
|
29
|
+
} from "./components/Section/SectionItem";
|
|
30
30
|
export {
|
|
31
31
|
ListTable,
|
|
32
32
|
ListTableProps,
|
|
@@ -75,7 +75,7 @@ export { default as TextArea } from "./components/Textarea/Textarea";
|
|
|
75
75
|
export { default as TextEditor } from "./components/TextEditor/TextEditor";
|
|
76
76
|
export { default as TextEditorV2 } from "./components/TextEditorV2/TextEditorV2";
|
|
77
77
|
export { TextLink, TextLinkProps } from "./components/TextLink/TextLink";
|
|
78
|
-
export { default as
|
|
78
|
+
export { default as SectionItemWithContent } from "./components/Section/SectionItemWithContent";
|
|
79
79
|
export { Title, TitleStyle } from "./components/Title/Title";
|
|
80
80
|
export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
|
|
81
81
|
|