@trackunit/react-components 1.0.13 → 1.1.0
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/index.cjs.js +56 -68
- package/index.esm.js +65 -77
- package/package.json +1 -1
- package/src/components/Alert/Alert.d.ts +2 -2
- package/src/components/Card/Card.d.ts +6 -6
- package/src/components/Card/CardBody.d.ts +2 -2
- package/src/components/Card/CardFooter.d.ts +2 -2
- package/src/components/Card/CardHeader.d.ts +5 -5
- package/src/components/Collapse/Collapse.d.ts +5 -5
- package/src/components/Heading/Heading.d.ts +2 -2
- package/src/components/Page/Page.d.ts +2 -2
- package/src/components/Page/PageContent.d.ts +3 -3
- package/src/components/PageHeader/PageHeader.d.ts +5 -5
- package/src/components/Popover/PopoverContent.d.ts +4 -4
- package/src/components/Popover/PopoverTitle.d.ts +3 -3
- package/src/components/Sidebar/Sidebar.d.ts +4 -4
- package/src/components/Tag/Tag.d.ts +4 -4
- package/src/components/Text/Text.d.ts +7 -3
- package/src/components/Tooltip/Tooltip.d.ts +3 -3
- package/src/components/Widget/WidgetBody.d.ts +2 -2
- package/src/components/buttons/Button/Button.d.ts +6 -6
- package/src/components/buttons/IconButton/IconButton.d.ts +4 -4
- package/src/components/buttons/StarButton/StarButton.d.ts +2 -2
- package/src/test-utils/test-utils.d.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common";
|
|
3
3
|
export interface CardFooterProps extends CommonProps {
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ export interface CardFooterProps extends CommonProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Element to render in the footer
|
|
10
10
|
*/
|
|
11
|
-
children?:
|
|
11
|
+
children?: ReactNode | null;
|
|
12
12
|
/**
|
|
13
13
|
* Wether or not a seperator line should be rendered
|
|
14
14
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common";
|
|
3
3
|
import { HeadingVariant } from "../Heading/Heading";
|
|
4
4
|
export interface CardHeaderProps extends CommonProps {
|
|
@@ -14,11 +14,11 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
14
14
|
*/
|
|
15
15
|
headingVariant?: HeadingVariant;
|
|
16
16
|
/** Adds an extra heading below the main heading. */
|
|
17
|
-
subHeading?: string |
|
|
17
|
+
subHeading?: string | ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Items to render next to the heading
|
|
20
20
|
*/
|
|
21
|
-
accessories?:
|
|
21
|
+
accessories?: ReactNode;
|
|
22
22
|
/**
|
|
23
23
|
* Sets gap, padding and margin.
|
|
24
24
|
*/
|
|
@@ -32,11 +32,11 @@ export interface CardHeaderProps extends CommonProps {
|
|
|
32
32
|
/**
|
|
33
33
|
* Children to render in the header
|
|
34
34
|
*/
|
|
35
|
-
children?:
|
|
35
|
+
children?: ReactNode | null;
|
|
36
36
|
/**
|
|
37
37
|
* For buttons or other actions to render in the header
|
|
38
38
|
*/
|
|
39
|
-
actions?:
|
|
39
|
+
actions?: ReactNode | null;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Header for Cards and Modals.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEvent, ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
export interface CollapseProps extends CommonProps {
|
|
4
4
|
id: string;
|
|
@@ -13,19 +13,19 @@ export interface CollapseProps extends CommonProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* onToggle event.
|
|
15
15
|
*/
|
|
16
|
-
onToggle?: (event:
|
|
16
|
+
onToggle?: (event: MouseEvent<HTMLDivElement>, expanded: boolean) => void;
|
|
17
17
|
/**
|
|
18
18
|
* Child nodes.
|
|
19
19
|
*/
|
|
20
|
-
children:
|
|
20
|
+
children: ReactNode;
|
|
21
21
|
/**
|
|
22
22
|
* Label to be displayed.
|
|
23
23
|
*/
|
|
24
|
-
label:
|
|
24
|
+
label: ReactNode;
|
|
25
25
|
/**
|
|
26
26
|
* An addon to add to the header. This can be used for a status indicator or similar.
|
|
27
27
|
*/
|
|
28
|
-
headerAddon?:
|
|
28
|
+
headerAddon?: ReactNode;
|
|
29
29
|
/**
|
|
30
30
|
* Without animation children wont be rendered until expanded, which improves performance
|
|
31
31
|
* for high volume data
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
export type HeadingVariant = "primary" | "secondary" | "tertiary" | "subtitle";
|
|
4
4
|
export interface HeadingProps extends CommonProps {
|
|
5
5
|
/**
|
|
6
6
|
* Child Nodes.
|
|
7
7
|
*/
|
|
8
|
-
children:
|
|
8
|
+
children: ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* Size of heading.
|
|
11
11
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from "@trackunit/css-class-variance-utilities";
|
|
2
|
-
import
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
import { CommonProps } from "../../common";
|
|
4
4
|
import { cvaPage } from "./Page.variants";
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ export type Layout = VariantProps<typeof cvaPage>["layout"];
|
|
|
11
11
|
*/
|
|
12
12
|
export interface PageProps extends CommonProps {
|
|
13
13
|
layout: Layout;
|
|
14
|
-
children?:
|
|
14
|
+
children?: ReactNode;
|
|
15
15
|
dataTestId?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common";
|
|
3
3
|
/**
|
|
4
4
|
* The props for the page content component.
|
|
5
5
|
*/
|
|
6
6
|
interface PageContentProps extends CommonProps {
|
|
7
7
|
layout: "content" | "h-min-fr" | "v-min-fr";
|
|
8
|
-
children?:
|
|
8
|
+
children?: ReactNode;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Renders the content of a page.
|
|
12
12
|
* Applies padding to content. To be used within a <Page/>
|
|
13
13
|
*
|
|
14
14
|
* @param {PageContentProps} props - The component props.
|
|
15
|
-
* @returns {
|
|
15
|
+
* @returns {ReactNode} - The rendered component.
|
|
16
16
|
*/
|
|
17
17
|
export declare const PageContent: ({ className, children, dataTestId, layout }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconName } from "@trackunit/ui-icons";
|
|
2
|
-
import
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
3
|
import { CommonProps } from "../../common/CommonProps";
|
|
4
4
|
import { TabListProps } from "../Tabs/TabList";
|
|
5
5
|
import { TagColors } from "../Tag";
|
|
@@ -8,11 +8,11 @@ export interface PageHeaderProps extends CommonProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Text to be displayed in the header.
|
|
10
10
|
*/
|
|
11
|
-
title: string |
|
|
11
|
+
title: string | ReactNode;
|
|
12
12
|
/**
|
|
13
13
|
* The description to be displayed inside the tip.
|
|
14
14
|
*/
|
|
15
|
-
description?: string |
|
|
15
|
+
description?: string | ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* The link to which user is redirected to if user clicks on the tip.
|
|
18
18
|
*/
|
|
@@ -24,7 +24,7 @@ export interface PageHeaderProps extends CommonProps {
|
|
|
24
24
|
/**
|
|
25
25
|
* Additional actions to be rendered along with the header.
|
|
26
26
|
*/
|
|
27
|
-
action?:
|
|
27
|
+
action?: ReactNode;
|
|
28
28
|
/**
|
|
29
29
|
* Enables the actions to be pushed to the right in the available space - the default is left side.
|
|
30
30
|
*/
|
|
@@ -46,7 +46,7 @@ export interface PageHeaderProps extends CommonProps {
|
|
|
46
46
|
/**
|
|
47
47
|
* Child nodes to be displayed inside the page header.
|
|
48
48
|
*/
|
|
49
|
-
children?:
|
|
49
|
+
children?: ReactNode;
|
|
50
50
|
/**
|
|
51
51
|
* The link to the previous page which will be rendered inside an IconButton component to the left of the heading.
|
|
52
52
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLProps, ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common";
|
|
3
|
-
export type PopoverContentChildren = ((close: () => void) =>
|
|
4
|
-
export interface PopoverContentProps extends Omit<
|
|
3
|
+
export type PopoverContentChildren = ((close: () => void) => ReactNode) | ReactNode;
|
|
4
|
+
export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "children">, CommonProps {
|
|
5
5
|
children: PopoverContentChildren;
|
|
6
6
|
/**
|
|
7
7
|
* Custom dom id to use for portalling the popover content
|
|
8
8
|
*/
|
|
9
9
|
portalId?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const PopoverContent:
|
|
11
|
+
export declare const PopoverContent: import("react").ForwardRefExoticComponent<Omit<PopoverContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
export interface PopoverTitleProps extends CommonProps {
|
|
4
|
-
action?:
|
|
4
|
+
action?: ReactNode;
|
|
5
5
|
/**
|
|
6
6
|
* Whether there should be a divider between the title and the content.
|
|
7
7
|
*/
|
|
@@ -9,7 +9,7 @@ export interface PopoverTitleProps extends CommonProps {
|
|
|
9
9
|
/**
|
|
10
10
|
* The child nodes.
|
|
11
11
|
*/
|
|
12
|
-
children?:
|
|
12
|
+
children?: ReactNode;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The PopoverTitle component.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps, ReactElement } from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { MenuList, MoreMenu } from "../Menu";
|
|
4
4
|
export interface SidebarItemProps extends CommonProps {
|
|
@@ -28,7 +28,7 @@ export interface SidebarProps extends CommonProps {
|
|
|
28
28
|
*
|
|
29
29
|
* **For the overflow functionality to take effect use _"min-w-[*]"_ or _"flex-shrink-0"_ on the elements.**
|
|
30
30
|
*/
|
|
31
|
-
children:
|
|
31
|
+
children: ReactElement<SidebarItemProps>[] | ReactElement<SidebarItemProps>;
|
|
32
32
|
/**
|
|
33
33
|
* The childContainerClassName is applied to the element that contains the children.
|
|
34
34
|
* This can be used to change gap or similar styling.
|
|
@@ -37,11 +37,11 @@ export interface SidebarProps extends CommonProps {
|
|
|
37
37
|
/**
|
|
38
38
|
* Pass custom props to the MoreMenu component used to render overflow items
|
|
39
39
|
*/
|
|
40
|
-
moreMenuProps?: Omit<
|
|
40
|
+
moreMenuProps?: Omit<ComponentProps<typeof MoreMenu>, "children">;
|
|
41
41
|
/**
|
|
42
42
|
* Pass custom props to the MenuList component used to render overflow items
|
|
43
43
|
*/
|
|
44
|
-
menuListProps?: Omit<
|
|
44
|
+
menuListProps?: Omit<ComponentProps<typeof MenuList>, "children">;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* The sidebar components is used to render a responsive sidebar.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
|
-
import
|
|
2
|
+
import { MouseEventHandler, ReactNode } from "react";
|
|
3
3
|
import { CommonProps, Size } from "../../common";
|
|
4
4
|
export type TagSize = Extract<Size, "small" | "medium">;
|
|
5
5
|
export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
|
|
@@ -14,12 +14,12 @@ export interface TagProps extends CommonProps {
|
|
|
14
14
|
* If not passed then x icon won't be visible.
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
|
-
onClose?:
|
|
17
|
+
onClose?: MouseEventHandler<HTMLDivElement>;
|
|
18
18
|
/**
|
|
19
19
|
* Child nodes of the tag.
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
children?:
|
|
22
|
+
children?: ReactNode;
|
|
23
23
|
/**
|
|
24
24
|
* Size of the tag.
|
|
25
25
|
*/
|
|
@@ -41,4 +41,4 @@ export interface TagProps extends CommonProps {
|
|
|
41
41
|
* @param {TagProps} props - The props for the tag component
|
|
42
42
|
* @returns {JSX.Element} tag component
|
|
43
43
|
*/
|
|
44
|
-
export declare const Tag:
|
|
44
|
+
export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps, Size } from "../../common";
|
|
3
3
|
export type TextType = "p" | "span" | "div";
|
|
4
4
|
export type TextAlign = "left" | "center" | "right";
|
|
@@ -7,7 +7,7 @@ export interface TextProps extends CommonProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* Child nodes.
|
|
9
9
|
*/
|
|
10
|
-
children:
|
|
10
|
+
children: ReactNode;
|
|
11
11
|
/**
|
|
12
12
|
* Type of element. Element can be of types "p", "span", or "div".
|
|
13
13
|
*/
|
|
@@ -52,6 +52,10 @@ export interface TextProps extends CommonProps {
|
|
|
52
52
|
* Ihe id of the html element
|
|
53
53
|
*/
|
|
54
54
|
id?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The title of the html element
|
|
57
|
+
*/
|
|
58
|
+
title?: string;
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
61
|
* The Text component is used to apply Trackunit default typography styles to text.
|
|
@@ -63,4 +67,4 @@ export interface TextProps extends CommonProps {
|
|
|
63
67
|
* @param {TextProps} props - The props for the Text component
|
|
64
68
|
* @returns {JSX.Element} Text component
|
|
65
69
|
*/
|
|
66
|
-
export declare const Text:
|
|
70
|
+
export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Placement } from "@floating-ui/react";
|
|
2
|
-
import
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
import { CommonProps } from "../../common";
|
|
4
4
|
import { IconProps } from "../Icon/Icon";
|
|
5
5
|
export type TooltipPlacement = Placement | "auto";
|
|
@@ -7,7 +7,7 @@ export interface TooltipProps extends CommonProps {
|
|
|
7
7
|
/**
|
|
8
8
|
* The text to be displayed in the tooltip.
|
|
9
9
|
*/
|
|
10
|
-
label: string |
|
|
10
|
+
label: string | ReactNode;
|
|
11
11
|
/**
|
|
12
12
|
* Where the tooltip should preferentially be placed.
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@ export interface TooltipProps extends CommonProps {
|
|
|
15
15
|
/**
|
|
16
16
|
* Child nodes
|
|
17
17
|
*/
|
|
18
|
-
children?:
|
|
18
|
+
children?: ReactNode;
|
|
19
19
|
/**
|
|
20
20
|
* Whether the tooltip is disabled or not.
|
|
21
21
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common";
|
|
3
3
|
export interface WidgetBodyProps extends CommonProps {
|
|
4
4
|
/**
|
|
@@ -12,7 +12,7 @@ export interface WidgetBodyProps extends CommonProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Child elements to render in the body
|
|
14
14
|
*/
|
|
15
|
-
children:
|
|
15
|
+
children: ReactNode | null;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* The WidgetBody component should be used to inform the user of important information.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEvent, ReactNode } from "react";
|
|
2
2
|
import { ButtonCommonProps, ButtonType } from "../shared/ButtonProps";
|
|
3
3
|
export interface ButtonProps extends ButtonCommonProps {
|
|
4
|
-
onClick?: (event:
|
|
4
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Child nodes. Can be used to pass in text to be displayed on the button.
|
|
7
7
|
*/
|
|
8
|
-
children?:
|
|
8
|
+
children?: ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* Whether button is fullWidth or not.
|
|
11
11
|
*/
|
|
@@ -13,11 +13,11 @@ export interface ButtonProps extends ButtonCommonProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* The button prefix.
|
|
15
15
|
*/
|
|
16
|
-
prefix?:
|
|
16
|
+
prefix?: ReactNode;
|
|
17
17
|
/**
|
|
18
18
|
* The button suffix.
|
|
19
19
|
*/
|
|
20
|
-
suffix?:
|
|
20
|
+
suffix?: ReactNode;
|
|
21
21
|
/**
|
|
22
22
|
* The type of the button. Values can be "submit" or "button".
|
|
23
23
|
*/
|
|
@@ -47,4 +47,4 @@ export interface ButtonProps extends ButtonCommonProps {
|
|
|
47
47
|
* @param {ButtonProps} props - The props for the Button component
|
|
48
48
|
* @returns {JSX.Element} Button component
|
|
49
49
|
*/
|
|
50
|
-
export declare const Button:
|
|
50
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
2
|
import { Size } from "../../../common";
|
|
3
3
|
import { ButtonCommonProps } from "../shared/ButtonProps";
|
|
4
4
|
export interface IconButtonProps extends ButtonCommonProps {
|
|
5
5
|
/**
|
|
6
6
|
* The icon to display.
|
|
7
7
|
*/
|
|
8
|
-
icon:
|
|
8
|
+
icon: ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* The element type the button will be rendered as.
|
|
11
11
|
*
|
|
12
12
|
* @memberof IconButtonProps
|
|
13
13
|
*/
|
|
14
|
-
renderAs?: keyof JSX.IntrinsicElements |
|
|
14
|
+
renderAs?: keyof JSX.IntrinsicElements | ComponentType<any>;
|
|
15
15
|
/**
|
|
16
16
|
* The size of the button. Defaults to "medium".
|
|
17
17
|
*/
|
|
@@ -20,4 +20,4 @@ export interface IconButtonProps extends ButtonCommonProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. The Icon Button is a version of the standard Button component without the text label.
|
|
22
22
|
*/
|
|
23
|
-
export declare const IconButton:
|
|
23
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEvent } from "react";
|
|
2
2
|
interface StarButtonProps {
|
|
3
3
|
starred: boolean;
|
|
4
|
-
onClick: (e:
|
|
4
|
+
onClick: (e: MouseEvent) => void;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* The StarButton component is used for favorite actions or similar.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderOptions, RenderResult } from "@testing-library/react";
|
|
2
|
-
import
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Enhanced render with providers
|
|
5
5
|
*
|
|
@@ -7,6 +7,6 @@ import * as React from "react";
|
|
|
7
7
|
* @param options - The options for the render
|
|
8
8
|
* @returns {RenderResult} The rendered UI
|
|
9
9
|
*/
|
|
10
|
-
declare const customRender: (ui:
|
|
10
|
+
declare const customRender: (ui: ReactElement, options?: Omit<RenderOptions, "wrapper">) => RenderResult;
|
|
11
11
|
export * from "@testing-library/react";
|
|
12
12
|
export { customRender as render };
|