@trackunit/react-components 0.0.1-alpha-59a0a75488.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/README.md +22 -0
- package/common/CommonProps.d.ts +12 -0
- package/common/LegacyComponentStory.d.ts +7 -0
- package/common/StorybookProps.d.ts +6 -0
- package/common/index.d.ts +3 -0
- package/common/useContainerProps.d.ts +16 -0
- package/components/ActionButton/ActionButton.d.ts +30 -0
- package/components/ActionButton/index.d.ts +1 -0
- package/components/Alert/Alert.d.ts +53 -0
- package/components/Alert/index.d.ts +1 -0
- package/components/Badge/Badge.d.ts +47 -0
- package/components/Badge/index.d.ts +1 -0
- package/components/BaseInput/BaseInput.d.ts +62 -0
- package/components/BaseInput/index.d.ts +1 -0
- package/components/Card/Card.d.ts +45 -0
- package/components/Card/CardBody.d.ts +32 -0
- package/components/Card/CardFooter.d.ts +21 -0
- package/components/Card/CardHeader.d.ts +43 -0
- package/components/Card/DensityContainer.d.ts +30 -0
- package/components/Card/index.d.ts +5 -0
- package/components/Chart/Chart.d.ts +81 -0
- package/components/Chart/index.d.ts +1 -0
- package/components/Checkbox/CheckIcon.d.ts +12 -0
- package/components/Checkbox/Checkbox.d.ts +40 -0
- package/components/Checkbox/IndeterminateIcon.d.ts +10 -0
- package/components/Checkbox/index.d.ts +1 -0
- package/components/Collapse/Collapse.d.ts +28 -0
- package/components/Collapse/index.d.ts +1 -0
- package/components/CopyableText/CopyableText.d.ts +21 -0
- package/components/CopyableText/index.d.ts +1 -0
- package/components/DateField/DateField.d.ts +19 -0
- package/components/DateInput/DateInput.d.ts +28 -0
- package/components/DayPicker/DayPicker.d.ts +28 -0
- package/components/DayPicker/DayPickerPopover.d.ts +23 -0
- package/components/DayPicker/DayRangePicker.d.ts +18 -0
- package/components/DayPicker/index.d.ts +21 -0
- package/components/DayPicker/useLocale.d.ts +8 -0
- package/components/EmailInput/EmailInput.d.ts +20 -0
- package/components/FormGroup/FormGroup.d.ts +38 -0
- package/components/Heading/Heading.d.ts +28 -0
- package/components/Heading/index.d.ts +1 -0
- package/components/Icon/Icon.d.ts +51 -0
- package/components/Indicator/Indicator.d.ts +42 -0
- package/components/Indicator/index.d.ts +1 -0
- package/components/Label/Label.d.ts +34 -0
- package/components/Label/index.d.ts +1 -0
- package/components/LegendItem/LegendItem.d.ts +17 -0
- package/components/LegendItem/index.d.ts +1 -0
- package/components/Menu/MenuItem.d.ts +58 -0
- package/components/Menu/MenuList.d.ts +34 -0
- package/components/Menu/index.d.ts +2 -0
- package/components/Modal/Modal.d.ts +32 -0
- package/components/Modal/ModalBackdrop.d.ts +13 -0
- package/components/Modal/index.d.ts +3 -0
- package/components/Modal/useModal.d.ts +21 -0
- package/components/NumberField/NumberField.d.ts +19 -0
- package/components/NumberInput/NumberInput.d.ts +12 -0
- package/components/PageHeader/PageHeader.d.ts +47 -0
- package/components/PageHeader/index.d.ts +1 -0
- package/components/Pagination/Pagination.d.ts +71 -0
- package/components/PhoneInput/PhoneInput.d.ts +20 -0
- package/components/Popover/AnimatedPopover.d.ts +43 -0
- package/components/Popover/PopoverList.d.ts +12 -0
- package/components/Popover/PopoverListItem.d.ts +30 -0
- package/components/Popover/PopoverTitle.d.ts +20 -0
- package/components/Popover/index.d.ts +5 -0
- package/components/Popover/usePopover.d.ts +42 -0
- package/components/Prompt/Prompt.d.ts +20 -0
- package/components/Prompt/index.d.ts +1 -0
- package/components/RadioGroup/RadioGroup.d.ts +57 -0
- package/components/RadioGroup/RadioGroupContext.d.ts +11 -0
- package/components/RadioGroup/RadioItem.d.ts +24 -0
- package/components/RadioGroup/index.d.ts +2 -0
- package/components/SectionHeader/SectionHeader.d.ts +24 -0
- package/components/SectionHeader/index.d.ts +1 -0
- package/components/Select/CreatableSelect.d.ts +38 -0
- package/components/Select/FieldContainer.d.ts +20 -0
- package/components/Select/Select.d.ts +18 -0
- package/components/Select/SelectMenuItem/SelectMenuItem.d.ts +49 -0
- package/components/Select/TagWithWidth.d.ts +17 -0
- package/components/Select/TagsContainer.d.ts +45 -0
- package/components/Select/index.d.ts +7 -0
- package/components/Select/shared.d.ts +15 -0
- package/components/Select/useCustomComponents.d.ts +19 -0
- package/components/Select/useCustomStyles.d.ts +14 -0
- package/components/Select/useSelect.d.ts +143 -0
- package/components/SkeletonLines/SkeletonLines.d.ts +25 -0
- package/components/SkeletonLines/index.d.ts +1 -0
- package/components/Spacer/Spacer.d.ts +20 -0
- package/components/Spacer/index.d.ts +1 -0
- package/components/Spinner/Spinner.d.ts +37 -0
- package/components/Spinner/index.d.ts +1 -0
- package/components/Tag/Tag.d.ts +39 -0
- package/components/Tag/index.d.ts +1 -0
- package/components/Text/Text.d.ts +58 -0
- package/components/Text/index.d.ts +1 -0
- package/components/TextArea/TextArea.d.ts +30 -0
- package/components/TextArea/index.d.ts +1 -0
- package/components/TextAreaField/TextAreaField.d.ts +19 -0
- package/components/TextAreaField/index.d.ts +1 -0
- package/components/TextField/TextField.d.ts +24 -0
- package/components/TextField/TextLenghtIndicator.d.ts +19 -0
- package/components/TextField/index.d.ts +1 -0
- package/components/TextInput/TextInput.d.ts +12 -0
- package/components/Timeline/Timeline.d.ts +30 -0
- package/components/Tip/Tip.d.ts +34 -0
- package/components/Tip/index.d.ts +1 -0
- package/components/Toggle/Toggle.d.ts +57 -0
- package/components/Toggle/index.d.ts +1 -0
- package/components/Tooltip/Tooltip.d.ts +48 -0
- package/components/Tooltip/index.d.ts +1 -0
- package/components/ValueBar/ValueBar.d.ts +44 -0
- package/components/ValueBar/ValueBarHelper.d.ts +35 -0
- package/components/ValueBar/ValueBarTypes.d.ts +9 -0
- package/components/ValueBar/index.d.ts +3 -0
- package/components/buttons/Button/Button.d.ts +48 -0
- package/components/buttons/IconButton/IconButton.d.ts +25 -0
- package/components/buttons/StarButton/StarButton.d.ts +13 -0
- package/components/buttons/index.d.ts +4 -0
- package/components/buttons/shared/ButtonProps.d.ts +40 -0
- package/components/buttons/shared/helpers.d.ts +20 -0
- package/components/index.d.ts +44 -0
- package/components/theme/DefaultTheme.d.ts +2 -0
- package/components/theme/index.d.ts +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/useDebounce.d.ts +8 -0
- package/hooks/useLocalStorage.d.ts +9 -0
- package/hooks/useTimeout.d.ts +15 -0
- package/index.css +488 -0
- package/index.d.ts +4 -0
- package/index.js +5553 -0
- package/layout/helper/MinTopFullContentLayout.d.ts +18 -0
- package/layout/index.d.ts +7 -0
- package/layout/responsive/FilterListMapLayout.d.ts +22 -0
- package/layout/responsive/FullWidthRepeatingLayout.d.ts +19 -0
- package/layout/responsive/GridArea.d.ts +13 -0
- package/layout/responsive/IntrinsicallyResponsiveGrid.d.ts +30 -0
- package/layout/responsive/TitleNavContentLayout.d.ts +12 -0
- package/layout/responsive/TwoColumnLayout.d.ts +12 -0
- package/package.json +31 -0
- package/test-config/jest.setup.d.ts +1 -0
- package/test-utils/hooks.d.ts +4 -0
- package/test-utils/test-utils.d.ts +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
> **⚠️ Beta**
|
|
2
|
+
>
|
|
3
|
+
> This is a beta version and subject to change without notice.
|
|
4
|
+
|
|
5
|
+
# Trackunit React Components
|
|
6
|
+
The `@trackunit/react-components` package is the home of Trackunits public UI library.
|
|
7
|
+
|
|
8
|
+
This library is exposed publicly for use in the the Trackunit [Iris App SDK](https://www.npmjs.com/package/@trackunit/iris-app).
|
|
9
|
+
|
|
10
|
+
To browse all avaliable components visit our [Public Storybook](https://developers.trackunit.com/page/ui-components).
|
|
11
|
+
|
|
12
|
+
For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
|
|
13
|
+
|
|
14
|
+
## Development
|
|
15
|
+
At this point this library is only developed by Trackunit Employees.
|
|
16
|
+
For development related information see the [development readme](https://github.com/Trackunit/manager/blob/master/libs/react/components/DEVELOPMENT.md).
|
|
17
|
+
|
|
18
|
+
## Trackunit
|
|
19
|
+
This package was developed by Trackunit ApS.
|
|
20
|
+
Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
|
|
21
|
+
|
|
22
|
+

|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CommonProps {
|
|
2
|
+
/**
|
|
3
|
+
* A custom class name to be attached to root element
|
|
4
|
+
*/
|
|
5
|
+
className?: string;
|
|
6
|
+
/**
|
|
7
|
+
* A id that can be used in tests to get the component
|
|
8
|
+
*/
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare type Density = "none" | "compact" | "comfortable" | "spacious" | "auto";
|
|
12
|
+
export declare type Size = "small" | "medium" | "large";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UseContainerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
dataTestId?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Utility for common props on containers.
|
|
7
|
+
*
|
|
8
|
+
* @param {UseContainerProps} ContainerProps - Props for the utility
|
|
9
|
+
* @param {string} ContainerProps.className - Optional custom className
|
|
10
|
+
* @param {string} ContainerProps.dataTestId - Optional custom data-TestId
|
|
11
|
+
* @returns {UseContainerProps} - Object with undefined values removed
|
|
12
|
+
*/
|
|
13
|
+
export declare const useContainerProps: ({ className, dataTestId }: UseContainerProps) => {
|
|
14
|
+
className: string | undefined;
|
|
15
|
+
"data-testid": string | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
declare type ActionType = "PHONE_NUMBER" | "WEB_ADDRESS" | "EMAIL";
|
|
4
|
+
declare type FieldSize = "small" | "medium";
|
|
5
|
+
interface ActionButtonProps extends CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* The type of action performed when clicking the button.
|
|
8
|
+
*/
|
|
9
|
+
type: ActionType;
|
|
10
|
+
/**
|
|
11
|
+
* The value to be passed into the button.
|
|
12
|
+
*/
|
|
13
|
+
value?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* The onClick event.
|
|
16
|
+
*/
|
|
17
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
18
|
+
/**
|
|
19
|
+
* The size of the icon.
|
|
20
|
+
*/
|
|
21
|
+
iconSize?: FieldSize;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
|
|
25
|
+
*
|
|
26
|
+
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
27
|
+
* @returns {JSX.Element} ActionButton component
|
|
28
|
+
*/
|
|
29
|
+
export declare const ActionButton: ({ type, value, dataTestId, iconSize }: ActionButtonProps) => JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ActionButton";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { IntentColors } from "@trackunit/ui-design-tokens";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
+
export declare type AlertActionType = "primary" | "secondary";
|
|
5
|
+
export declare type AlertAction = {
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface AlertProps extends CommonProps {
|
|
11
|
+
/**
|
|
12
|
+
* Child nodes.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Color of the alert component.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
color?: IntentColors;
|
|
20
|
+
/**
|
|
21
|
+
* Title of the alert component.
|
|
22
|
+
*/
|
|
23
|
+
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Action to be performed on clicking the primary button.
|
|
26
|
+
*/
|
|
27
|
+
primaryAction?: AlertAction;
|
|
28
|
+
/**
|
|
29
|
+
* Action to be performed on clicking the secondary button.
|
|
30
|
+
*/
|
|
31
|
+
secondaryAction?: AlertAction;
|
|
32
|
+
/**
|
|
33
|
+
* OnClose Event.
|
|
34
|
+
*/
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the contents should be displayed inline or not.
|
|
38
|
+
*/
|
|
39
|
+
inline?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* A prop to enable autoscroll to alert element
|
|
42
|
+
*
|
|
43
|
+
* could be used for displaying errors on long scrollable forms
|
|
44
|
+
*/
|
|
45
|
+
autoScroll?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The Alert component should be used to inform the user of important information.
|
|
49
|
+
*
|
|
50
|
+
* @param {AlertProps} props - The props for the Alert component
|
|
51
|
+
* @returns {JSX.Element} Alert component
|
|
52
|
+
*/
|
|
53
|
+
export declare const Alert: ({ color, title, className, children, primaryAction, secondaryAction, onClose, dataTestId, autoScroll, inline, }: AlertProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Alert";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
3
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
+
export declare type BadgeSize = "medium" | "large";
|
|
5
|
+
interface BaseBadgeProps extends CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* The color of the badge.
|
|
8
|
+
*/
|
|
9
|
+
color?: ThemeColors;
|
|
10
|
+
/**
|
|
11
|
+
* Specifies whether the badge is subtle or not.
|
|
12
|
+
* Subtle badges have a light background color wither a darker text color.
|
|
13
|
+
*/
|
|
14
|
+
subtle?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Custom classNames can be added to make adjustments where needed.
|
|
17
|
+
* Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
|
|
18
|
+
* This will make the badge truncate the text if it is too long.
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The count to be displayed on the badge.
|
|
23
|
+
*/
|
|
24
|
+
count?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The max value to be displayed in the badge.
|
|
27
|
+
* Any value above this will be appended with a +.
|
|
28
|
+
*/
|
|
29
|
+
max?: number;
|
|
30
|
+
/**
|
|
31
|
+
* If enabled the badge is shown even if the count is 0.
|
|
32
|
+
*/
|
|
33
|
+
hideZero?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Size of the badge.
|
|
36
|
+
*/
|
|
37
|
+
size?: BadgeSize;
|
|
38
|
+
}
|
|
39
|
+
export declare type BadgeProps = BaseBadgeProps;
|
|
40
|
+
/**
|
|
41
|
+
* The Badge component is used to display a notification badge with an optional number value.
|
|
42
|
+
*
|
|
43
|
+
* @param {BadgeProps} props - The props for the Badge component
|
|
44
|
+
* @returns {JSX.Element} Badge component
|
|
45
|
+
*/
|
|
46
|
+
export declare const Badge: ({ color, subtle, className, count, max, hideZero, dataTestId, size, ...rest }: BadgeProps) => JSX.Element | null;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Badge";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix">;
|
|
4
|
+
declare type FieldSize = "small" | "medium";
|
|
5
|
+
export interface BaseInputProps extends FilteredInputProps, CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* A React element to render before the text in the input.
|
|
8
|
+
* This is typically used to render an icon.
|
|
9
|
+
* For elements other than icons, please consider using the addonBefore prop.
|
|
10
|
+
*/
|
|
11
|
+
prefix?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* A React element to render after the text in the input.
|
|
14
|
+
* This is typically used to render an icon.
|
|
15
|
+
* For other elements than icons, please consider using the addonAfter prop.
|
|
16
|
+
*/
|
|
17
|
+
suffix?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* A React element to render in a separate container before the text in the input.
|
|
20
|
+
* This is typically used to render text.
|
|
21
|
+
* For icons, please consider using the prefix prop.
|
|
22
|
+
*/
|
|
23
|
+
addonBefore?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* A React element to render in a separate container after the text in the input.
|
|
26
|
+
* This is typically used to render text.
|
|
27
|
+
* For icons, please consider using the suffix prop.
|
|
28
|
+
*/
|
|
29
|
+
addonAfter?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* A ReactNode to render at the end of the input field before the addonAfter.
|
|
32
|
+
* Mainly meant for the icon button actions for special input types.
|
|
33
|
+
*/
|
|
34
|
+
actions?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* The size of the input.
|
|
37
|
+
* Default == 40px, Small == 32px.
|
|
38
|
+
*/
|
|
39
|
+
fieldSize?: FieldSize;
|
|
40
|
+
/**
|
|
41
|
+
* If true the field is rendered in its invalid state.
|
|
42
|
+
*/
|
|
43
|
+
isInvalid?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The Placeholder text for the input.
|
|
46
|
+
*/
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/**
|
|
49
|
+
* A flag to disable interaction with input for example if you want to use input as a child of higher component
|
|
50
|
+
*/
|
|
51
|
+
nonInteractive?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A base input component that can be used for text inputs, password inputs, etc.
|
|
55
|
+
* A reference to the input element is provided as the `ref` prop.
|
|
56
|
+
* Extends props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
|
|
57
|
+
*
|
|
58
|
+
* For specific input types make sure to use the corresponding input component.
|
|
59
|
+
* This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
|
|
60
|
+
*/
|
|
61
|
+
export declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BaseInput";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export declare const ROLE_CARD = "region";
|
|
4
|
+
declare type Overflow = "visible" | "hidden" | "scroll" | "auto";
|
|
5
|
+
export interface CardProps extends CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the card should have full height or not.
|
|
8
|
+
*/
|
|
9
|
+
fullHeight?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the card should overflow contents.
|
|
12
|
+
*/
|
|
13
|
+
overflow?: Overflow;
|
|
14
|
+
/**
|
|
15
|
+
* The css grid area to place the card.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Use tailwind based grid layouts instead.
|
|
18
|
+
*/
|
|
19
|
+
gridArea?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Children to show in the card
|
|
22
|
+
*/
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* A Click handler function
|
|
26
|
+
*/
|
|
27
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* A MouseEnter handler function
|
|
30
|
+
*/
|
|
31
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* A MouseLEave handler function
|
|
34
|
+
*/
|
|
35
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The Card component is a container for UI elements, and is the main component of the modal.
|
|
39
|
+
* To get the most out of the Card, use it in combination with the CardHeader, CardBody and CardFooter.
|
|
40
|
+
*
|
|
41
|
+
* @param {CardProps} props - The props for the Card component
|
|
42
|
+
* @returns {JSX.Element} Card component
|
|
43
|
+
*/
|
|
44
|
+
export declare const Card: ({ children, onClick, fullHeight, onMouseEnter, onMouseLeave, className, dataTestId, overflow, gridArea, }: CardProps) => JSX.Element;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
|
+
declare type Overflow = "visible" | "hidden" | "scroll" | "auto" | "inherit";
|
|
4
|
+
export interface CardBodyProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Tells the body how to handle overflowing elements.
|
|
7
|
+
* Directly mapped to the overflow css property.
|
|
8
|
+
*/
|
|
9
|
+
overflow?: Overflow;
|
|
10
|
+
/**
|
|
11
|
+
* Sets gap, padding and margin.
|
|
12
|
+
*/
|
|
13
|
+
density?: Density;
|
|
14
|
+
/**
|
|
15
|
+
* Set gap to be 0px (not preferable)
|
|
16
|
+
*/
|
|
17
|
+
disableGap?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Child elements to render in the body
|
|
20
|
+
*/
|
|
21
|
+
children: React.ReactNode | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The CardBody component should be used to inform the user of important information.
|
|
25
|
+
*
|
|
26
|
+
* @summary For applying padding and gap to a Card.
|
|
27
|
+
* @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
|
|
28
|
+
* @param {CardBodyProps} props - The props for the CardBody component
|
|
29
|
+
* @returns {JSX.Element} CardBody component
|
|
30
|
+
*/
|
|
31
|
+
export declare const CardBody: ({ density, overflow, children, dataTestId, className, disableGap, }: CardBodyProps) => JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
|
+
export interface CardFooterProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Sets gap, padding and margin.
|
|
6
|
+
*/
|
|
7
|
+
density?: Density;
|
|
8
|
+
/**
|
|
9
|
+
* Element to render in the footer
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A simple footer intended to use with Cards and Modals.
|
|
15
|
+
* Currently only intended to contain Buttons.
|
|
16
|
+
* The buttons justifies to the right, but if you style a button with "margin-right: auto" it will move to the left
|
|
17
|
+
*
|
|
18
|
+
* @param {CardFooterProps} props - The props for the CardFooter component
|
|
19
|
+
* @returns {JSX.Element} CardFooter component
|
|
20
|
+
*/
|
|
21
|
+
export declare const CardFooter: ({ dataTestId, className, children, density }: CardFooterProps) => JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
|
+
import { HeadingVariant } from "../Heading/Heading";
|
|
4
|
+
export interface CardHeaderProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The text to show in the Cards main heading
|
|
7
|
+
*/
|
|
8
|
+
heading: string;
|
|
9
|
+
/**
|
|
10
|
+
* The variant/size of the heading.
|
|
11
|
+
* Same as the `Heading` component.
|
|
12
|
+
*
|
|
13
|
+
* @default "primary"
|
|
14
|
+
*/
|
|
15
|
+
headingVariant?: HeadingVariant;
|
|
16
|
+
/** Adds an extra heading below the main heading. */
|
|
17
|
+
subHeading?: string | React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Items to render next to the heading
|
|
20
|
+
*/
|
|
21
|
+
accessories?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Sets gap, padding and margin.
|
|
24
|
+
*/
|
|
25
|
+
density?: Density;
|
|
26
|
+
/**
|
|
27
|
+
* Wether or not a seperator line should be rendered
|
|
28
|
+
*/
|
|
29
|
+
showSeparator?: boolean;
|
|
30
|
+
/** Function to call when the close button is clicked */
|
|
31
|
+
onClose?: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Children to render in the header
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Header for Cards and Modals.
|
|
39
|
+
*
|
|
40
|
+
* @param {CardHeaderProps} props - The props for the CardHeader component
|
|
41
|
+
* @returns {JSX.Element} CardHeader component
|
|
42
|
+
*/
|
|
43
|
+
export declare const CardHeader: ({ heading, headingVariant, subHeading, onClose, dataTestId, className, children, accessories, density, }: CardHeaderProps) => JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
|
+
interface ContainerProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* The density of the card components.
|
|
6
|
+
* "compact" = 12px gap and padding.
|
|
7
|
+
* "comfortable" = 16px gap and padding.
|
|
8
|
+
* "spacious" = 16px gap, 26px padding.
|
|
9
|
+
*/
|
|
10
|
+
$density?: Density;
|
|
11
|
+
/**
|
|
12
|
+
* Set gap to be 0px (not preferable)
|
|
13
|
+
*/
|
|
14
|
+
$disableGap?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The flex direction of the Card. Defaults to "column".
|
|
17
|
+
*/
|
|
18
|
+
$direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The DensityContainer component applies gap and padding.
|
|
23
|
+
* The padding should live here, and not on the Card itself, as to not inset the scrollbar in case of overflow.
|
|
24
|
+
*
|
|
25
|
+
* @summary For applying auto padding and gap to a Card or Modal or whatever.
|
|
26
|
+
* @param {ContainerProps} props - The props for the DensityContainer component
|
|
27
|
+
* @returns {JSX.Element} DensityContainer component
|
|
28
|
+
*/
|
|
29
|
+
export declare const DensityContainer: ({ children, className, dataTestId, $density, $disableGap, $direction, }: ContainerProps) => JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
import { EChartsType } from "echarts";
|
|
4
|
+
export interface IOptionsType {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ChartProps extends CommonProps {
|
|
8
|
+
/**
|
|
9
|
+
* Option values for EChart.
|
|
10
|
+
*/
|
|
11
|
+
options: IOptionsType;
|
|
12
|
+
/**
|
|
13
|
+
* Whether or not to low the preloader.
|
|
14
|
+
*/
|
|
15
|
+
showLoading?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* onClick event.
|
|
18
|
+
*/
|
|
19
|
+
onClick?: (event: any) => void;
|
|
20
|
+
/**
|
|
21
|
+
* onDataZoom event.
|
|
22
|
+
*/
|
|
23
|
+
onDataZoom?: (event: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* onBrush event.
|
|
26
|
+
*/
|
|
27
|
+
onBrush?: (event: any) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Event fired when brush is selected.
|
|
30
|
+
*/
|
|
31
|
+
onBrushSelected?: (event: any) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Event fired when mouse leaves the chart.
|
|
34
|
+
*/
|
|
35
|
+
mouseLeaveChart?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Event fired when mouse is moving over the chart.
|
|
38
|
+
*/
|
|
39
|
+
mouseMoveChart?: (event: any, chart: EChartsType | undefined) => void;
|
|
40
|
+
/**
|
|
41
|
+
* CSS styles for the chart.
|
|
42
|
+
*/
|
|
43
|
+
style?: Record<string, string | number>;
|
|
44
|
+
/**
|
|
45
|
+
* To denote of chart is ready or not.
|
|
46
|
+
*/
|
|
47
|
+
onChartReady?: (chart: any) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to merge with previous option.
|
|
50
|
+
*/
|
|
51
|
+
merge?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Values for the loading component.
|
|
54
|
+
*/
|
|
55
|
+
loadingOption?: {
|
|
56
|
+
text: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Time-zone label.
|
|
60
|
+
*/
|
|
61
|
+
timezoneLabel?: React.ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Type of rendered used. Either "svg" or "canvas".
|
|
64
|
+
*/
|
|
65
|
+
renderer?: "svg" | "canvas";
|
|
66
|
+
/**
|
|
67
|
+
* Value used to find element by `data-testid` attribute.
|
|
68
|
+
*/
|
|
69
|
+
dataTestId?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The Chart component is a wrapper component for ECharts.
|
|
73
|
+
*
|
|
74
|
+
* Handles events and click functionality.
|
|
75
|
+
*
|
|
76
|
+
* For more information see the [eCharts documentation](https://github.com/hustcc/echarts-for-react).
|
|
77
|
+
*
|
|
78
|
+
* @param {ChartProps} props - The props for the Chart component
|
|
79
|
+
* @returns {JSX.Element} Chart component
|
|
80
|
+
*/
|
|
81
|
+
export declare const Chart: ({ options, showLoading, className, style, onChartReady, onClick, onDataZoom, onBrush, onBrushSelected, mouseLeaveChart, mouseMoveChart, merge, loadingOption, timezoneLabel, renderer, dataTestId, }: ChartProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Chart";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
interface CheckIconProps extends CommonProps {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The CheckIcon component is used by the checkbox to display the checked state.
|
|
7
|
+
*
|
|
8
|
+
* @param {CheckIconProps} props - The props for the CheckIcon component
|
|
9
|
+
* @returns {JSX.Element} CheckIcon component
|
|
10
|
+
*/
|
|
11
|
+
export declare const CheckIcon: ({ className, dataTestId }: CheckIconProps) => JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
/**
|
|
5
|
+
* A string element to be displayed as a label
|
|
6
|
+
*/
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* An boolean flag to set checkbox to disabled state
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* An boolean flag to set invalid mode
|
|
14
|
+
* can be used for indicating errors
|
|
15
|
+
*/
|
|
16
|
+
isInvalid?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* An boolean flag to set checkbox to readonly mode
|
|
19
|
+
*/
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* An boolean flag to set checkbox to intermediate state
|
|
23
|
+
*/
|
|
24
|
+
indeterminate?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
|
|
28
|
+
*
|
|
29
|
+
* Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
|
|
30
|
+
*
|
|
31
|
+
* _**Do use** checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables._
|
|
32
|
+
*
|
|
33
|
+
* _**Do not use** checkboxes if the user can only select one option from a list, radio buttons should be used instead of checkboxes._
|
|
34
|
+
*
|
|
35
|
+
* @description A reference to the input element is provided as the `ref` prop.
|
|
36
|
+
* @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
|
|
37
|
+
* @param {CheckboxProps} props - The props for the Checkbox component
|
|
38
|
+
* @returns {JSX.Element} Checkbox component
|
|
39
|
+
*/
|
|
40
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
|
|
4
|
+
*
|
|
5
|
+
* @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
|
|
6
|
+
* @returns {JSX.Element} IndeterminateIcon component
|
|
7
|
+
*/
|
|
8
|
+
export declare const IndeterminateIcon: ({ className }: {
|
|
9
|
+
className?: string | undefined;
|
|
10
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Checkbox";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export interface CollapseProps extends CommonProps {
|
|
4
|
+
id: string;
|
|
5
|
+
/**
|
|
6
|
+
* Expands the collapse component during initialization.
|
|
7
|
+
*/
|
|
8
|
+
initialExpanded?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* onToggle event.
|
|
11
|
+
*/
|
|
12
|
+
onToggle?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Child nodes.
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Label to be displayed.
|
|
19
|
+
*/
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The Collapse component is used to condense non-important information.
|
|
24
|
+
*
|
|
25
|
+
* @param {CollapseProps} props - The props for the Collapse component
|
|
26
|
+
* @returns {JSX.Element} Collapse component
|
|
27
|
+
*/
|
|
28
|
+
export declare const Collapse: ({ id, initialExpanded, onToggle, label, children, className, dataTestId, }: CollapseProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Collapse";
|