@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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
export interface CopyableTextProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* The text shown in the ui.
|
|
6
|
+
* By default this is also the text that gets copied when component is clicked.
|
|
7
|
+
*/
|
|
8
|
+
text?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Alternative text to get copied to on click.
|
|
11
|
+
* This text is not visible in the ui.
|
|
12
|
+
*/
|
|
13
|
+
alternativeText?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The CopyableText component is used where the user should have easy access to copy information.
|
|
17
|
+
*
|
|
18
|
+
* @param {CopyableTextProps} props - The props for the CopyableText component
|
|
19
|
+
* @returns {JSX.Element} CopyableText component
|
|
20
|
+
*/
|
|
21
|
+
export declare const CopyableText: ({ text, alternativeText, dataTestId, className }: CopyableTextProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CopyableText";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateInputProps } from "../DateInput/DateInput";
|
|
3
|
+
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
|
+
declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
5
|
+
export interface DateFieldProps extends DateInputProps, FormGroupExposedProps {
|
|
6
|
+
/**
|
|
7
|
+
* If a value is set, the field is rendered in its invalid state.
|
|
8
|
+
*/
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The date field component is used for entering date values.
|
|
13
|
+
*
|
|
14
|
+
* _**Do use**_ the DateField for date input.
|
|
15
|
+
*
|
|
16
|
+
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DateField: import("react").ForwardRefExoticComponent<DateFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseInputProps } from "../BaseInput";
|
|
3
|
+
declare type BaseInputExposedProps = Omit<BaseInputProps, "defaultValue" | "min" | "max" | "value">;
|
|
4
|
+
export interface DateInputProps extends BaseInputExposedProps {
|
|
5
|
+
/**
|
|
6
|
+
* A min value with type Date added
|
|
7
|
+
*/
|
|
8
|
+
min?: Date | string | number;
|
|
9
|
+
/**
|
|
10
|
+
* A max value with type Date added
|
|
11
|
+
*/
|
|
12
|
+
max?: Date | string | number;
|
|
13
|
+
/**
|
|
14
|
+
* A default value with type Date added
|
|
15
|
+
*/
|
|
16
|
+
defaultValue?: Date | string | number;
|
|
17
|
+
/**
|
|
18
|
+
* A value with type Date added
|
|
19
|
+
*/
|
|
20
|
+
value?: Date | string | number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A wrapper around BaseInput with a pop-up day picker.
|
|
24
|
+
*
|
|
25
|
+
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Matcher } from "react-day-picker";
|
|
3
|
+
export interface DayPickerProps {
|
|
4
|
+
/**
|
|
5
|
+
* A callback function for when a date is selected
|
|
6
|
+
*/
|
|
7
|
+
onDaySelect?: (day: Date) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Define any days which may not be selected
|
|
10
|
+
*/
|
|
11
|
+
disabledDays: Matcher | Matcher[] | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Set any days which are selected
|
|
14
|
+
*/
|
|
15
|
+
selectedDays: Matcher | Matcher[] | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Set the language
|
|
18
|
+
*/
|
|
19
|
+
language: string;
|
|
20
|
+
max?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The DayPicker component is used when the user needs to select a date.
|
|
24
|
+
*
|
|
25
|
+
* @param {DayPickerProps} props - The props for the DayPicker component
|
|
26
|
+
* @returns {JSX.Element} DayPicker component
|
|
27
|
+
*/
|
|
28
|
+
export declare const DayPicker: ({ onDaySelect, disabledDays, selectedDays, language, ...rest }: DayPickerProps) => JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Matcher } from "react-day-picker";
|
|
3
|
+
import { Size } from "../../common";
|
|
4
|
+
import { ButtonColor } from "../buttons";
|
|
5
|
+
import { PopoverPlacement } from "../Popover";
|
|
6
|
+
export interface DayPickerPopoverProps {
|
|
7
|
+
disabledDays?: Matcher | Matcher[] | undefined;
|
|
8
|
+
className?: string;
|
|
9
|
+
onDaySelect: (day: Date) => void;
|
|
10
|
+
selectedDay?: Date;
|
|
11
|
+
color?: ButtonColor;
|
|
12
|
+
size?: Size;
|
|
13
|
+
placement?: PopoverPlacement;
|
|
14
|
+
buttonContent: JSX.Element;
|
|
15
|
+
language: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The DayPickerPopover component returns a button which when clicked shows the daypicker.
|
|
19
|
+
*
|
|
20
|
+
* @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
|
|
21
|
+
* @returns {JSX.Element} DayPickerPopover component
|
|
22
|
+
*/
|
|
23
|
+
export declare const DayPickerPopover: ({ disabledDays, className, selectedDay, onDaySelect, color, placement, size, buttonContent, language, }: DayPickerPopoverProps) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateRange, Matcher } from "react-day-picker";
|
|
3
|
+
export declare type IDateRange = DateRange;
|
|
4
|
+
export interface DayRangePickerProps {
|
|
5
|
+
onRangeSelect?: (range: IDateRange | undefined) => void;
|
|
6
|
+
selectedDays: IDateRange;
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
disabledDays?: Matcher | Matcher[];
|
|
9
|
+
language: string;
|
|
10
|
+
max?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
14
|
+
*
|
|
15
|
+
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
16
|
+
* @returns {JSX.Element} DayRangePicker component
|
|
17
|
+
*/
|
|
18
|
+
export declare const DayRangePicker: ({ onRangeSelect, selectedDays, disabledDays, dataTestId, language, max, }: DayRangePickerProps) => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TimeZone {
|
|
2
|
+
/**
|
|
3
|
+
* The unique id of the timezone
|
|
4
|
+
*
|
|
5
|
+
* @example "America/Denver"
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* The human-readable name of the timezone. Combines id and offset.
|
|
10
|
+
*
|
|
11
|
+
* @example "America/Denver (-06:00 MDT)"
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* @example "-06:00 MDT"
|
|
16
|
+
*/
|
|
17
|
+
offset: string;
|
|
18
|
+
}
|
|
19
|
+
export * from "./DayPicker";
|
|
20
|
+
export * from "./DayPickerPopover";
|
|
21
|
+
export * from "./DayRangePicker";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Locale } from "date-fns";
|
|
2
|
+
/**
|
|
3
|
+
* A helper function to get the matching Locale object for a given language.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} language The language to match
|
|
6
|
+
* @returns {Locale} The corresponding Locale object
|
|
7
|
+
*/
|
|
8
|
+
export declare const useLocale: (language: string) => Locale;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
import { BaseInputProps } from "../BaseInput";
|
|
4
|
+
export interface EmailInputProps extends BaseInputProps, CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* A flag to disable the email button.
|
|
7
|
+
*/
|
|
8
|
+
disableAction?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A Email Input component is used for input of the type Email.
|
|
12
|
+
*
|
|
13
|
+
* It has an ActionButton which sends an email to the specified address using "mailto:" link.
|
|
14
|
+
*
|
|
15
|
+
* Extends props of BaseInput.
|
|
16
|
+
*
|
|
17
|
+
* A reference to the input element is provided as the `ref` prop.
|
|
18
|
+
* For specific input types make sure to use the corresponding input component.
|
|
19
|
+
*/
|
|
20
|
+
export declare const EmailInput: React.ForwardRefExoticComponent<EmailInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
export interface FormGroupProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* The label for the form group.
|
|
6
|
+
*/
|
|
7
|
+
label: string | React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Content to display in the tooltip when hovering the ? icon next to the label.
|
|
10
|
+
*/
|
|
11
|
+
tip?: string | React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* A string to display under the input element to help the user understand the input.
|
|
14
|
+
*/
|
|
15
|
+
helpText?: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* An addon element to render to the right under the input element.
|
|
18
|
+
* Used for displaying maxLength etc.
|
|
19
|
+
*/
|
|
20
|
+
helpAddon?: string | React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* If true the input is rendered in its invalid state.
|
|
23
|
+
*/
|
|
24
|
+
isInvalid?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If true interactions are disabled
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The FormGroup component should be used to wrap any Input element that needs a label.
|
|
33
|
+
* Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
|
|
34
|
+
*
|
|
35
|
+
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
36
|
+
* @returns {JSX.Element} FormGroup component
|
|
37
|
+
*/
|
|
38
|
+
export declare const FormGroup: ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, children, disabled, }: FormGroupProps) => JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export declare type HeadingVariant = "primary" | "secondary" | "tertiary" | "subtitle";
|
|
4
|
+
export interface HeadingProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Child Nodes.
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Size of heading.
|
|
11
|
+
*/
|
|
12
|
+
variant: HeadingVariant;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the heading uses inverted styles or not.
|
|
15
|
+
*/
|
|
16
|
+
inverted?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the heading is a subtitle or not.
|
|
19
|
+
*/
|
|
20
|
+
subtle?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The Heading is used for a heading of a section (h1,h2,h3,h4).
|
|
24
|
+
*
|
|
25
|
+
* @param {HeadingProps} props - The props for the Heading component
|
|
26
|
+
* @returns {JSX.Element} Heading component
|
|
27
|
+
*/
|
|
28
|
+
export declare const Heading: ({ children, variant, inverted, subtle, className, dataTestId, }: HeadingProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Heading";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
2
|
+
import { HeroIconName, TrackunitIconName } from "@trackunit/ui-icons";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CommonProps, Size } from "../../common/CommonProps";
|
|
5
|
+
export interface IconProps extends CommonProps {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the icon to be rendered.
|
|
8
|
+
* HeroIconName and TrackunitIconName are supported.
|
|
9
|
+
*/
|
|
10
|
+
name: TrackunitIconName | HeroIconName;
|
|
11
|
+
/**
|
|
12
|
+
* The color of the icon.
|
|
13
|
+
* Supports any colors from the theme.
|
|
14
|
+
* Custom colors can be used by setting a text color in the className.
|
|
15
|
+
*/
|
|
16
|
+
color?: ThemeColors;
|
|
17
|
+
/**
|
|
18
|
+
* The size of the icon.
|
|
19
|
+
* Small = 16x16px, medium = 20x20px, Large = 24x24px.
|
|
20
|
+
* Default value is Large.
|
|
21
|
+
* If a custom size is needed, set it in the className.
|
|
22
|
+
*/
|
|
23
|
+
size?: Size;
|
|
24
|
+
/**
|
|
25
|
+
* Select if the icon should be rendered as solid or outline.
|
|
26
|
+
* Default value depends on the Size prop, small == solid, medium == solid, large == outline.
|
|
27
|
+
* Trackunit icons might not support both outline and Solid.
|
|
28
|
+
*/
|
|
29
|
+
type?: "solid" | "outline";
|
|
30
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
*/
|
|
34
|
+
fillColor?: string;
|
|
35
|
+
forwardedRef?: React.RefObject<HTMLSpanElement>;
|
|
36
|
+
/**
|
|
37
|
+
* Custom styles object used to override existing styles or add some extra styling
|
|
38
|
+
*
|
|
39
|
+
* @memberof IconProps
|
|
40
|
+
*/
|
|
41
|
+
style?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* - The Icon component is used to display an Icon.
|
|
45
|
+
* - Icons are semantic vector graphics that adds character and improves the visual appeal of elements when combined with.
|
|
46
|
+
* - All the [HeroIcons](https://heroicons.dev/) as well as custom TrackUnit icons are available.
|
|
47
|
+
*
|
|
48
|
+
* @param {IconProps} props - The props for the Icon component
|
|
49
|
+
* @returns {JSX.Element} Icon component
|
|
50
|
+
*/
|
|
51
|
+
export declare const Icon: ({ name, size, className, dataTestId, color, onClick, fillColor, type, style, forwardedRef, }: IconProps) => JSX.Element | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThemeColors } from "@trackunit/ui-design-tokens";
|
|
3
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
4
|
+
export interface IndicatorProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The icon to be rendered inside the indicator component
|
|
7
|
+
*/
|
|
8
|
+
icon: JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* A color token used to style the icon and the icon background
|
|
11
|
+
*/
|
|
12
|
+
color?: ThemeColors;
|
|
13
|
+
/**
|
|
14
|
+
* A text label to be displayed next to the indicator
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* A boolean parameter to display or hide icon background, default value is true
|
|
19
|
+
*/
|
|
20
|
+
withBackground?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean parameter to display or hide label and instead show as html title on hover, default value is true
|
|
23
|
+
*/
|
|
24
|
+
withLabel?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A boolean parameter to make the indicator ping thus drawing more attention, default value is false
|
|
27
|
+
*/
|
|
28
|
+
ping?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
|
|
32
|
+
*
|
|
33
|
+
* Whenever an asset is presented, indicators provide the necessary information for a user to comprehend the state of the asset.
|
|
34
|
+
*
|
|
35
|
+
* _**Do use** indicators to communicate essential aspects of the state of an asset._
|
|
36
|
+
*
|
|
37
|
+
* _**Do not use** indicators for non-essential information, or to communicate information unrelated to the state of an asset._
|
|
38
|
+
*
|
|
39
|
+
* @param {IndicatorProps} props - The props for the Indicator component
|
|
40
|
+
* @returns {JSX.Element} Indicator component
|
|
41
|
+
*/
|
|
42
|
+
export declare const Indicator: ({ dataTestId, icon, label, color, withBackground, withLabel, ping, ...rest }: IndicatorProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Indicator";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
import "./Label.css";
|
|
4
|
+
export interface LabelProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* ID of the label.
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Specifies the element to which the label belongs to.
|
|
11
|
+
*/
|
|
12
|
+
htmlFor?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The label value.
|
|
15
|
+
*/
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the label is disabled or not.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A boolean flag to set invalid mode
|
|
23
|
+
* can be used for indicating errors
|
|
24
|
+
*/
|
|
25
|
+
isInvalid?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The Label component is used for labels for input fields.
|
|
29
|
+
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
30
|
+
*
|
|
31
|
+
* @param {LabelProps} props - The props for the Label component
|
|
32
|
+
* @returns {JSX.Element} Label component
|
|
33
|
+
*/
|
|
34
|
+
export declare const Label: ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }: LabelProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Label";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ILegendItem {
|
|
3
|
+
label?: string;
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
color: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The LegendItem component is used to show form legends.
|
|
13
|
+
*
|
|
14
|
+
* @param {ILegendItem} props - The props for the LegendItem component
|
|
15
|
+
* @returns {JSX.Element} LegendItem component
|
|
16
|
+
*/
|
|
17
|
+
export declare const LegendItem: ({ className, label, disabled, selected, onClick, color, dataTestId }: ILegendItem) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./LegendItem";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export interface MenuItemProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* The icon to be rendered in the menu item.
|
|
6
|
+
*/
|
|
7
|
+
icon?: JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* Label of the menu item
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Additional tailwind classes to be applied to the component.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Test id to be used for the component.
|
|
18
|
+
*/
|
|
19
|
+
dataTestId?: string;
|
|
20
|
+
/**
|
|
21
|
+
* An React element to render before the label.
|
|
22
|
+
* This is typically used to render an icon.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
prefix?: JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* An boolean flag to turn on/off selected state
|
|
28
|
+
* This is typically used highlight that item is selected
|
|
29
|
+
*
|
|
30
|
+
* @memberof IMenuItemProps
|
|
31
|
+
*/
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* OnClick event handler it is thrown on root element of the component tree
|
|
35
|
+
*
|
|
36
|
+
* @memberof IMenuItemProps
|
|
37
|
+
*/
|
|
38
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
39
|
+
/**
|
|
40
|
+
* An boolean flag to turn on/off focused state
|
|
41
|
+
* This is typically used for keyboard navigation
|
|
42
|
+
*
|
|
43
|
+
* @memberof IMenuItemProps
|
|
44
|
+
*/
|
|
45
|
+
focused?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* A boolean prop to set menu item to disabled state
|
|
48
|
+
* used in disabled select options
|
|
49
|
+
*/
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
54
|
+
*
|
|
55
|
+
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
56
|
+
* @returns {JSX.Element} MenuItem component
|
|
57
|
+
*/
|
|
58
|
+
export declare const MenuItem: ({ className, dataTestId, label, selected, focused, prefix, icon, disabled, onClick, }: MenuItemProps) => JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuItemProps } from "./MenuItem";
|
|
3
|
+
export interface MenuListItemProps extends MenuItemProps {
|
|
4
|
+
showDivider?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface MenuListProps {
|
|
7
|
+
/**
|
|
8
|
+
* Additional tailwind classes to be applied to the component.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Test id to be used for the component.
|
|
13
|
+
*/
|
|
14
|
+
dataTestId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* List of menu items to be rendered.
|
|
17
|
+
*/
|
|
18
|
+
menuItems: MenuListItemProps[];
|
|
19
|
+
/**
|
|
20
|
+
* A component width
|
|
21
|
+
*/
|
|
22
|
+
width?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Custom renderer for menu items
|
|
25
|
+
*/
|
|
26
|
+
itemRenderer?: (item: MenuListItemProps, key: string, index: number) => JSX.Element;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The MenuList component is used for menus and selects.
|
|
30
|
+
*
|
|
31
|
+
* @param {MenuListProps} props - The props for the MenuList component
|
|
32
|
+
* @returns {JSX.Element} MenuList component
|
|
33
|
+
*/
|
|
34
|
+
export declare const MenuList: ({ dataTestId, className, menuItems, width, itemRenderer, ...args }: MenuListProps) => JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
declare type ModalWidth = "slim" | "narrow" | "normal" | "wide" | "full";
|
|
4
|
+
export interface ModalProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Whether modal is open or not.
|
|
7
|
+
*/
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether modal should be closed when clicked outside of it.
|
|
11
|
+
*/
|
|
12
|
+
onDismissClick?: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Child elements to be rendered inside the modal.
|
|
15
|
+
*/
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Test id to be applied to the modal.
|
|
19
|
+
*/
|
|
20
|
+
dataTestId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum width of the modal.
|
|
23
|
+
*/
|
|
24
|
+
maxWidth?: ModalWidth;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* - Modals are used to present critical information or request user input needed to complete a user's workflow.
|
|
28
|
+
* - Modals interrupt a user's workflow by design.
|
|
29
|
+
* - The modal component provides a foundation for creating dialogs, lightboxes, etc.
|
|
30
|
+
*/
|
|
31
|
+
export declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ModalBackdropProps {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
isVisible?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The Backdrop for the modal.
|
|
9
|
+
*
|
|
10
|
+
* @param {ModalBackdropProps} props - The props for the ModalBackdrop component
|
|
11
|
+
* @returns {JSX.Element} ModalBackdrop component
|
|
12
|
+
*/
|
|
13
|
+
export declare const ModalBackdrop: ({ children, isVisible, onClick }: ModalBackdropProps) => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ModalProps } from "./Modal";
|
|
3
|
+
export interface UseModalProps {
|
|
4
|
+
closeOnOutsideClick?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The useModal component should be used to inform the user of important information.
|
|
8
|
+
*
|
|
9
|
+
* @param {UseModalProps} props - The props for the useModal hook
|
|
10
|
+
* @returns {*} useModal return
|
|
11
|
+
*/
|
|
12
|
+
export declare const useModal: ({ closeOnOutsideClick }?: UseModalProps) => {
|
|
13
|
+
Modal: {
|
|
14
|
+
(props: ModalProps): JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
toggleModal: any;
|
|
18
|
+
openModal: any;
|
|
19
|
+
closeModal: any;
|
|
20
|
+
isOpen: any;
|
|
21
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
3
|
+
import { NumberInputProps } from "../NumberInput/NumberInput";
|
|
4
|
+
declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
5
|
+
export interface NumberFieldProps extends NumberInputProps, FormGroupExposedProps {
|
|
6
|
+
/**
|
|
7
|
+
* If a value is set, the field is rendered in its invalid state.
|
|
8
|
+
*/
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
|
|
13
|
+
*
|
|
14
|
+
* _**Do use**_ the NumberField when the controls to incrementally increase or decrease makes the task easier for the user.
|
|
15
|
+
*
|
|
16
|
+
* _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare const NumberField: import("react").ForwardRefExoticComponent<NumberFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseInputProps } from "../BaseInput";
|
|
3
|
+
declare type BaseInputExposedProps = Omit<BaseInputProps, "type">;
|
|
4
|
+
export interface NumberInputProps extends BaseInputExposedProps {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A thin wrapper around the `BaseInput` component for number input fields.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: If shown with a label, please use the `NumberField` component instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
export {};
|