@luscii-healthtech/web-ui 0.7.2 → 0.8.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.2",
2
+ "version": "0.8.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,17 +1,36 @@
1
1
  import { IconProps } from "../Icons/types/IconProps.type";
2
2
  import { TextColor, TextHoverColor } from "../Text/Text";
3
3
 
4
+ /**
5
+ * Properties that are present in all variants of the button
6
+ *
7
+ */
4
8
  export interface BaseButtonProps
5
9
  extends React.HTMLAttributes<HTMLButtonElement> {
6
10
  onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
7
11
  text?: string;
8
- textColor?: TextColor;
9
- textHoverColor?: TextHoverColor;
10
12
  icon?: React.FunctionComponent<IconProps>;
11
13
  isDisabled?: boolean;
12
14
  className?: string;
13
15
  }
14
16
 
15
- export interface ButtonProps extends BaseButtonProps {
17
+ /**
18
+ * Extra properties that can be set when the variant of the button
19
+ * supports the pending state
20
+ *
21
+ */
22
+ export interface ButtonWithPendingStateProps extends BaseButtonProps {
16
23
  isPending?: boolean;
17
24
  }
25
+
26
+ /**
27
+ * All properties of BaseButtonProps and ButtonWithPendingStateProps,
28
+ * plus other properties that are assigned internally by the button variants.
29
+ *
30
+ */
31
+ export interface ButtonProps
32
+ extends BaseButtonProps,
33
+ ButtonWithPendingStateProps {
34
+ textColor?: TextColor;
35
+ textHoverColor?: TextHoverColor;
36
+ }
@@ -2,9 +2,11 @@ import classNames from "classnames";
2
2
  import React from "react";
3
3
 
4
4
  import { ButtonV2 } from "./ButtonV2";
5
- import { ButtonProps } from "./ButtonProps.type";
5
+ import { ButtonWithPendingStateProps } from "./ButtonProps.type";
6
6
 
7
- export const PrimaryButton = (props: ButtonProps): JSX.Element => {
7
+ export const PrimaryButton = (
8
+ props: ButtonWithPendingStateProps
9
+ ): JSX.Element => {
8
10
  return (
9
11
  <ButtonV2
10
12
  {...props}
@@ -12,20 +12,23 @@ import "./Section.scss";
12
12
  export interface SectionProps extends RestPropped {
13
13
  title?: string;
14
14
  buttons?: ButtonProps[];
15
+ footer?: React.ReactNode;
15
16
  className?: string;
16
17
  isLoading?: boolean;
17
18
  loadingIndicatorProps?: LoadingIndicatorProps;
19
+ children?: React.ReactNode;
18
20
  }
19
21
 
20
22
  export function Section({
21
23
  title,
22
24
  buttons,
25
+ footer,
23
26
  children,
24
27
  className,
25
28
  isLoading = false,
26
29
  loadingIndicatorProps,
27
30
  ...restProps
28
- }: React.PropsWithChildren<SectionProps>): JSX.Element {
31
+ }: SectionProps): JSX.Element {
29
32
  return (
30
33
  <div
31
34
  {...restProps}
@@ -56,6 +59,8 @@ export function Section({
56
59
  )}
57
60
 
58
61
  <div className="cweb-section-content w-full">{!isLoading && children}</div>
62
+
63
+ {footer && <div className="cweb-section-footer">{footer}</div>}
59
64
  </div>
60
65
  );
61
66
  }
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+
3
+ import { SecondaryButton } from "../ButtonV2/SecondaryButton";
4
+ import { BaseButtonProps } from "../ButtonV2/ButtonProps.type";
5
+
6
+ import { TimelineStep, TimelineStepProps } from "./TimelineStep";
7
+
8
+ export interface TimelineProps {
9
+ steps: TimelineStepProps[];
10
+ loadMoreButtonProps?: BaseButtonProps;
11
+ }
12
+
13
+ export const Timeline = (props: TimelineProps): JSX.Element => (
14
+ <>
15
+ {/* Needs a container around TimelineSteps as last one should be styled differently */}
16
+ <div>
17
+ {props.steps.map(step => <TimelineStep {...step} />)}
18
+ </div>
19
+ {props.loadMoreButtonProps && (
20
+ <SecondaryButton
21
+ className={"mt-6 mx-auto"}
22
+ {...props.loadMoreButtonProps}
23
+ />
24
+ )}
25
+ </>
26
+ );
27
+
28
+ export default Timeline;
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import { SmallCircleIcon } from "../Icons/SmallCircleIcon";
5
+
6
+ export interface TimelineStepProps {
7
+ key: string | number;
8
+ type?: "wide" | "base";
9
+ content: React.ReactNode;
10
+ }
11
+
12
+ export const TimelineStep = ({
13
+ content,
14
+ type,
15
+ }: TimelineStepProps): JSX.Element => {
16
+ const isWideStep = type === "wide";
17
+ const borderClassNames = "ml-4 pl-6 border-blue-800 border-l-2";
18
+ const containerClassNames = classNames("relative", {
19
+ [borderClassNames]: !isWideStep,
20
+ "pt-3": !isWideStep,
21
+ "bg-white rounded-lg overflow-hidden": isWideStep,
22
+ });
23
+
24
+ return (
25
+ <>
26
+ <div className={containerClassNames}>
27
+ {content}
28
+ {!isWideStep && (
29
+ <SmallCircleIcon
30
+ className={"text-blue-800 absolute top-3 -left-3 -ml-px"}
31
+ />
32
+ )}
33
+ </div>
34
+ <div className={classNames(borderClassNames, "h-6 last:h-0")} />
35
+ </>
36
+ );
37
+ };
38
+
39
+ TimelineStep.defaultProps = {
40
+ type: "base" as TimelineStepProps["type"],
41
+ };
package/src/index.tsx CHANGED
@@ -6,7 +6,7 @@ export { default as Avatar } from "./components/Avatar/Avatar";
6
6
  export { default as Badge } from "./components/Badge/Badge";
7
7
  export {
8
8
  BaseButtonProps as NonPrimaryButtonProps,
9
- ButtonProps as PrimaryButtonProps,
9
+ ButtonWithPendingStateProps as PrimaryButtonProps,
10
10
  } from "./components/ButtonV2/ButtonProps.type";
11
11
  export { PrimaryButton } from "./components/ButtonV2/PrimaryButton";
12
12
  export { SecondaryButton } from "./components/ButtonV2/SecondaryButton";
@@ -84,6 +84,7 @@ export { default as TextEditor } from "./components/TextEditor/TextEditor";
84
84
  export { default as TextEditorV2 } from "./components/TextEditorV2/TextEditorV2";
85
85
  export { TextLink, TextLinkProps } from "./components/TextLink/TextLink";
86
86
  export { Title, TitleStyle } from "./components/Title/Title";
87
+ export { Timeline } from "./components/Timeline/Timeline";
87
88
  export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
88
89
 
89
90
  export { default as Text } from "./components/Text/Text";