@trackunit/react-components 0.0.98 → 0.0.101
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/components/BaseInput/BaseInput.d.ts +4 -4
- package/components/Card/Card.d.ts +19 -7
- package/components/Card/CardBody.d.ts +13 -3
- package/components/Card/CardFooter.d.ts +8 -3
- package/components/Card/CardHeader.d.ts +19 -6
- package/components/DateField/DateField.d.ts +14 -25
- package/components/DateInput/DateInput.d.ts +29 -0
- package/components/Menu/MenuItem.d.ts +1 -1
- package/components/TextArea/TextArea.d.ts +12 -64
- package/components/TextAreaField/TextAreaField.d.ts +18 -0
- package/components/TextAreaField/index.d.ts +1 -0
- package/components/TextField/TextField.d.ts +1 -1
- package/components/index.d.ts +3 -1
- package/index.js +331 -275
- package/package.json +1 -1
- package/components/DateField/index.d.ts +0 -1
|
@@ -16,19 +16,19 @@ export interface BaseInputProps extends FilteredInputProps, CommonProps {
|
|
|
16
16
|
*/
|
|
17
17
|
suffix?: React.ReactNode;
|
|
18
18
|
/**
|
|
19
|
-
* An React element to render in a
|
|
19
|
+
* An React element to render in a separate container before the text in the input.
|
|
20
20
|
* This is typically used to render text.
|
|
21
21
|
* For icons, please concider using the prefix prop.
|
|
22
22
|
*/
|
|
23
23
|
addonBefore?: React.ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
* An React element to render in a
|
|
25
|
+
* An React element to render in a separate container after the text in the input.
|
|
26
26
|
* This is typically used to render text.
|
|
27
27
|
* For icons, please concider using the suffix prop.
|
|
28
28
|
*/
|
|
29
29
|
addonAfter?: React.ReactNode;
|
|
30
30
|
/**
|
|
31
|
-
* An ReactNode to render at the end of the input field
|
|
31
|
+
* An ReactNode to render at the end of the input field before the addonAfter.
|
|
32
32
|
* Mainly meant for the icon button actions for special input types.
|
|
33
33
|
*/
|
|
34
34
|
actions?: React.ReactNode;
|
|
@@ -38,7 +38,7 @@ export interface BaseInputProps extends FilteredInputProps, CommonProps {
|
|
|
38
38
|
*/
|
|
39
39
|
fieldSize?: FieldSize;
|
|
40
40
|
/**
|
|
41
|
-
* If
|
|
41
|
+
* If true the field is rendered in its invalid state.
|
|
42
42
|
*/
|
|
43
43
|
isInvalid?: boolean;
|
|
44
44
|
/**
|
|
@@ -3,10 +3,6 @@ import { CommonProps } from "../../common/CommonProps";
|
|
|
3
3
|
export declare const ROLE_CARD = "region";
|
|
4
4
|
declare type Overflow = "visible" | "hidden" | "scroll" | "auto";
|
|
5
5
|
export interface CardProps extends CommonProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
8
|
-
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
9
|
-
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
10
6
|
/**
|
|
11
7
|
* Whether the card should have full height or not.
|
|
12
8
|
*/
|
|
@@ -16,15 +12,31 @@ export interface CardProps extends CommonProps {
|
|
|
16
12
|
*/
|
|
17
13
|
overflow?: Overflow;
|
|
18
14
|
/**
|
|
15
|
+
* The css grid area to place the card.
|
|
19
16
|
*
|
|
20
17
|
* @deprecated Use tailwind based grid layouts instead.
|
|
21
|
-
* @memberof CardProps
|
|
22
18
|
*/
|
|
23
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;
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
26
|
-
* The Card component is a container for ui elements.
|
|
27
|
-
*
|
|
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.
|
|
28
40
|
*
|
|
29
41
|
* @param {CardProps} props - The props for the Card component
|
|
30
42
|
* @returns {JSX.Element} Card component
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
3
|
declare type Overflow = "visible" | "hidden" | "scroll" | "auto" | "inherit";
|
|
4
|
-
interface
|
|
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
|
+
*/
|
|
5
9
|
overflow?: Overflow;
|
|
10
|
+
/**
|
|
11
|
+
* Sets gap, padding and margin.
|
|
12
|
+
*/
|
|
6
13
|
density?: Density;
|
|
7
14
|
/**
|
|
8
15
|
* Set gap to be 0px (not preferable)
|
|
9
16
|
*/
|
|
10
17
|
disableGap?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Child elements to render in the body
|
|
20
|
+
*/
|
|
11
21
|
children: React.ReactNode | null;
|
|
12
22
|
}
|
|
13
23
|
/**
|
|
@@ -15,8 +25,8 @@ interface CardContentProps extends CommonProps {
|
|
|
15
25
|
*
|
|
16
26
|
* @summary For applying padding and gap to a Card.
|
|
17
27
|
* @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
|
|
18
|
-
* @param {
|
|
28
|
+
* @param {CardBodyProps} props - The props for the CardBody component
|
|
19
29
|
* @returns {JSX.Element} CardBody component
|
|
20
30
|
*/
|
|
21
|
-
export declare const CardBody: ({ density, overflow, children, dataTestId, className, disableGap, }:
|
|
31
|
+
export declare const CardBody: ({ density, overflow, children, dataTestId, className, disableGap, }: CardBodyProps) => JSX.Element;
|
|
22
32
|
export {};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
|
-
interface CardFooterProps extends CommonProps {
|
|
4
|
-
|
|
3
|
+
export interface CardFooterProps extends CommonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Sets gap, padding and margin.
|
|
6
|
+
*/
|
|
5
7
|
density?: Density;
|
|
8
|
+
/**
|
|
9
|
+
* Element to render in the footer
|
|
10
|
+
*/
|
|
11
|
+
children?: React.ReactNode | null;
|
|
6
12
|
}
|
|
7
13
|
/**
|
|
8
14
|
* A simple footer intended to use with Cards and Modals.
|
|
@@ -13,4 +19,3 @@ interface CardFooterProps extends CommonProps {
|
|
|
13
19
|
* @returns {JSX.Element} CardFooter component
|
|
14
20
|
*/
|
|
15
21
|
export declare const CardFooter: ({ dataTestId, className, children, density }: CardFooterProps) => JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps, Density } from "../../common/CommonProps";
|
|
3
3
|
import { HeadingVariant } from "../Heading/Heading";
|
|
4
|
-
interface CardHeaderProps extends CommonProps {
|
|
5
|
-
/**
|
|
4
|
+
export interface CardHeaderProps extends CommonProps {
|
|
5
|
+
/**
|
|
6
|
+
* The text to show in the Cards main heading
|
|
7
|
+
*/
|
|
6
8
|
heading: string;
|
|
7
9
|
/**
|
|
8
10
|
* The variant/size of the heading.
|
|
@@ -13,12 +15,24 @@ interface CardHeaderProps extends CommonProps {
|
|
|
13
15
|
headingVariant?: HeadingVariant;
|
|
14
16
|
/** Adds an extra heading below the main heading. */
|
|
15
17
|
subHeading?: string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Items to render next to the heading
|
|
20
|
+
*/
|
|
19
21
|
accessories?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Sets gap, padding and margin.
|
|
24
|
+
*/
|
|
20
25
|
density?: Density;
|
|
26
|
+
/**
|
|
27
|
+
* Wether or not a seperator line should be rendered
|
|
28
|
+
*/
|
|
21
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;
|
|
22
36
|
}
|
|
23
37
|
/**
|
|
24
38
|
* Header for Cards and Modals.
|
|
@@ -27,4 +41,3 @@ interface CardHeaderProps extends CommonProps {
|
|
|
27
41
|
* @returns {JSX.Element} CardHeader component
|
|
28
42
|
*/
|
|
29
43
|
export declare const CardHeader: ({ heading, headingVariant, subHeading, onClose, dataTestId, className, children, accessories, density, }: CardHeaderProps) => JSX.Element;
|
|
30
|
-
export {};
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* If a value is set, the field is rendered in its invalid state.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A text to be displayed under the input with a short description of field purpose
|
|
11
|
-
*/
|
|
12
|
-
description?: string;
|
|
13
|
-
/**
|
|
14
|
-
* A default value to be displayed by a input field
|
|
15
|
-
*/
|
|
16
|
-
defaultValue?: string;
|
|
17
|
-
/**
|
|
18
|
-
* A flag that can be used to disable the input, default value is false
|
|
19
|
-
*/
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Specification of dates not allowed to be selected - i the form of react-day-picker matcher
|
|
23
|
-
*/
|
|
24
|
-
disabledDays?: Matcher | Matcher[] | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* A flag that can be set to true to disallow the user to deselect a date. (if false the user can click the selected date to deselect)
|
|
27
|
-
*/
|
|
28
|
-
preventDeselect?: boolean;
|
|
9
|
+
errorMessage?: string;
|
|
29
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
|
+
*/
|
|
30
18
|
export declare const DateField: import("react").ForwardRefExoticComponent<DateFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Matcher } from "react-day-picker";
|
|
3
|
+
import { BaseInputProps } from "../BaseInput";
|
|
4
|
+
declare type BaseInputExposedProps = Omit<BaseInputProps, "defaultValue" | "onChange">;
|
|
5
|
+
export interface DateInputProps extends BaseInputExposedProps {
|
|
6
|
+
/**
|
|
7
|
+
* A default value to be displayed by a input field
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: Date;
|
|
10
|
+
/**
|
|
11
|
+
* Specification of dates not allowed to be selected - i the form of react-day-picker matcher
|
|
12
|
+
*/
|
|
13
|
+
disabledDays?: Matcher | Matcher[] | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* A flag that can be set to true to disallow the user to deselect a date. (if false the user can click the selected date to deselect)
|
|
16
|
+
*/
|
|
17
|
+
preventDeselect?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* onChange function returning the date instead of input event
|
|
20
|
+
*/
|
|
21
|
+
onChange?: (date: Date) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A wrapper around BaseInput with a pop-up day picker.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DateInput: import("react").ForwardRefExoticComponent<DateInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
29
|
+
export {};
|
|
@@ -49,7 +49,7 @@ export interface MenuItemProps {
|
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* The MenuItem component
|
|
52
|
+
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
53
53
|
*
|
|
54
54
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
55
55
|
* @returns {JSX.Element} MenuItem component
|
|
@@ -1,73 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { CommonProps } from "../../common
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
3
|
export declare type TextAreaResize = "none" | "vertical" | "horizontal" | "both";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* ID of the text area.
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Name of the text area.
|
|
11
|
-
*/
|
|
12
|
-
name?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Label of the text area.
|
|
15
|
-
*/
|
|
16
|
-
label?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Description of the text area.
|
|
19
|
-
*/
|
|
20
|
-
description?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Information about the text area.
|
|
23
|
-
*/
|
|
24
|
-
info?: React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Error message of the text area.
|
|
27
|
-
*/
|
|
28
|
-
error?: React.ReactNode;
|
|
29
|
-
/**
|
|
30
|
-
* Value of the text area.
|
|
31
|
-
*/
|
|
32
|
-
value?: React.ReactText;
|
|
33
|
-
/**
|
|
34
|
-
* Tab index specifies the keyboard tab order of the textarea relative to the other controls on the page.
|
|
35
|
-
*/
|
|
36
|
-
tabIndex?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the text area is disabled or not.
|
|
39
|
-
*/
|
|
40
|
-
disabled?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Whether the text area is readonly or not.
|
|
43
|
-
*/
|
|
44
|
-
readOnly?: boolean;
|
|
4
|
+
declare type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLTextAreaElement>, "prefix" | "suffix">;
|
|
5
|
+
export interface TextAreaProps extends FilteredInputProps, CommonProps {
|
|
45
6
|
/**
|
|
46
7
|
* Number of rows in the text area.
|
|
47
8
|
*/
|
|
48
9
|
rows?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Placeholder text for the text area.
|
|
51
|
-
*/
|
|
52
|
-
placeholder?: string;
|
|
53
|
-
/**
|
|
54
|
-
* onChange handler of the text area.
|
|
55
|
-
*/
|
|
56
|
-
onChange?: (event: React.SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
57
|
-
/**
|
|
58
|
-
* onFocus handler of the text area.
|
|
59
|
-
*/
|
|
60
|
-
onFocus?: (event: React.SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
61
|
-
/**
|
|
62
|
-
* onBlur handler of the text area.
|
|
63
|
-
*/
|
|
64
|
-
onBlur?: (event: React.SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Maximum length of the text area.
|
|
67
|
-
*/
|
|
68
|
-
maxLength?: number;
|
|
69
10
|
/**
|
|
70
11
|
* Resize of the text area.
|
|
12
|
+
*
|
|
13
|
+
* @default "vertical"
|
|
71
14
|
*/
|
|
72
15
|
resize?: TextAreaResize;
|
|
73
16
|
/**
|
|
@@ -75,8 +18,13 @@ export interface TextAreaProps extends CommonProps {
|
|
|
75
18
|
*/
|
|
76
19
|
defaultValue?: React.ReactText;
|
|
77
20
|
/**
|
|
78
|
-
*
|
|
21
|
+
* If true the field is rendered in its invalid state.
|
|
79
22
|
*/
|
|
80
|
-
|
|
23
|
+
isInvalid?: boolean;
|
|
81
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The TextArea is a base component, and should not be used very often.
|
|
27
|
+
* For most cases the TextAreaField is the correct component.
|
|
28
|
+
*/
|
|
82
29
|
export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CommonProps } from "../../common";
|
|
3
|
+
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
|
+
import { TextAreaProps } from "../TextArea/TextArea";
|
|
5
|
+
declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
6
|
+
export interface TextAreaFieldProps extends TextAreaProps, FormGroupExposedProps, CommonProps {
|
|
7
|
+
/**
|
|
8
|
+
* Set the Maximal length of the value for the input.
|
|
9
|
+
* Adds a TextLengthIndicator to the right of the helpText.
|
|
10
|
+
*/
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
/**
|
|
13
|
+
* If a value is set, the field is rendered in its invalid state.
|
|
14
|
+
*/
|
|
15
|
+
errorMessage?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const TextAreaField: React.ForwardRefExoticComponent<TextAreaFieldProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TextAreaField";
|
|
@@ -5,7 +5,7 @@ declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "hel
|
|
|
5
5
|
export interface TextFieldProps extends TextInputProps, FormGroupExposedProps {
|
|
6
6
|
/**
|
|
7
7
|
* Set the Maximal length of the value for the input.
|
|
8
|
-
* Adds a
|
|
8
|
+
* Adds a TextLengthIndicator to the right of the helpText.
|
|
9
9
|
*/
|
|
10
10
|
maxLength?: number;
|
|
11
11
|
/**
|
package/components/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export * from "./Chart";
|
|
|
7
7
|
export * from "./Checkbox";
|
|
8
8
|
export * from "./Collapse";
|
|
9
9
|
export * from "./CopyableText";
|
|
10
|
-
export * from "./DateField";
|
|
10
|
+
export * from "./DateField/DateField";
|
|
11
|
+
export * from "./DateInput/DateInput";
|
|
11
12
|
export * from "./DayPicker";
|
|
12
13
|
export * from "./FormGroup/FormGroup";
|
|
13
14
|
export * from "./Heading";
|
|
@@ -30,6 +31,7 @@ export * from "./Spinner";
|
|
|
30
31
|
export * from "./Tag";
|
|
31
32
|
export * from "./Text";
|
|
32
33
|
export * from "./TextArea";
|
|
34
|
+
export * from "./TextAreaField";
|
|
33
35
|
export * from "./TextField";
|
|
34
36
|
export * from "./TextInput/TextInput";
|
|
35
37
|
export * from "./Timeline/Timeline";
|
package/index.js
CHANGED
|
@@ -947,8 +947,8 @@ const InputContainer = tw.div`
|
|
|
947
947
|
|
|
948
948
|
const ROLE_CARD = "region";
|
|
949
949
|
/**
|
|
950
|
-
* The Card component is a container for ui elements.
|
|
951
|
-
*
|
|
950
|
+
* The Card component is a container for ui elements, and is the main component of the modal.
|
|
951
|
+
* To get the most out of the Card use it in combination with the CardHeader, CardBody and CardFooter.
|
|
952
952
|
*
|
|
953
953
|
* @param {CardProps} props - The props for the Card component
|
|
954
954
|
* @returns {JSX.Element} Card component
|
|
@@ -1090,7 +1090,7 @@ ${DensityFinder}
|
|
|
1090
1090
|
*
|
|
1091
1091
|
* @summary For applying padding and gap to a Card.
|
|
1092
1092
|
* @description The padding must live here, and not on the Card itself, as to not inset the scrollbar in case of overflow
|
|
1093
|
-
* @param {
|
|
1093
|
+
* @param {CardBodyProps} props - The props for the CardBody component
|
|
1094
1094
|
* @returns {JSX.Element} CardBody component
|
|
1095
1095
|
*/
|
|
1096
1096
|
|
|
@@ -1154,20 +1154,16 @@ const CardFooter = ({
|
|
|
1154
1154
|
className: className,
|
|
1155
1155
|
"$density": density
|
|
1156
1156
|
}, {
|
|
1157
|
-
children: jsx(
|
|
1157
|
+
children: jsx(Body, {
|
|
1158
1158
|
children: children
|
|
1159
1159
|
})
|
|
1160
1160
|
}));
|
|
1161
1161
|
};
|
|
1162
1162
|
const TopBorderedDensityContainer = tw(DensityContainer)`
|
|
1163
|
-
|
|
1164
|
-
border-neutral-200
|
|
1163
|
+
tu-card__footer-density-container
|
|
1165
1164
|
`;
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
gap-2
|
|
1169
|
-
flex-wrap
|
|
1170
|
-
justify-end
|
|
1165
|
+
const Body = tw.div`
|
|
1166
|
+
tu-card__footer
|
|
1171
1167
|
`;
|
|
1172
1168
|
|
|
1173
1169
|
/**
|
|
@@ -1281,17 +1277,13 @@ const CardHeader = ({
|
|
|
1281
1277
|
}));
|
|
1282
1278
|
};
|
|
1283
1279
|
const BottomBorderedDensityContainer = tw(DensityContainer)`
|
|
1284
|
-
|
|
1285
|
-
|
|
1280
|
+
tu-card__header-density-container
|
|
1281
|
+
`;
|
|
1286
1282
|
const Container$6 = tw.div`
|
|
1287
|
-
|
|
1288
|
-
justify-between
|
|
1289
|
-
items-start
|
|
1283
|
+
tu-card__header
|
|
1290
1284
|
`;
|
|
1291
1285
|
const HeadingContainer = tw.div`
|
|
1292
|
-
|
|
1293
|
-
items-center
|
|
1294
|
-
gap-4
|
|
1286
|
+
tu-card__header-heading-container
|
|
1295
1287
|
`;
|
|
1296
1288
|
|
|
1297
1289
|
/**
|
|
@@ -2000,23 +1992,28 @@ const StyledCardBody = tw(CardBody)`
|
|
|
2000
1992
|
max-h-full
|
|
2001
1993
|
`;
|
|
2002
1994
|
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
1995
|
+
/**
|
|
1996
|
+
* A wrapper around BaseInput with a pop-up day picker.
|
|
1997
|
+
*
|
|
1998
|
+
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
1999
|
+
*/
|
|
2000
|
+
|
|
2001
|
+
const DateInput = forwardRef((_a, ref) => {
|
|
2002
|
+
var {
|
|
2003
|
+
defaultValue,
|
|
2004
|
+
disabledDays,
|
|
2005
|
+
disabled,
|
|
2006
|
+
preventDeselect,
|
|
2007
|
+
onChange
|
|
2008
|
+
} = _a,
|
|
2009
|
+
rest = __rest(_a, ["defaultValue", "disabledDays", "disabled", "preventDeselect", "onChange"]);
|
|
2010
|
+
|
|
2011
|
+
const [selectedDay, setSelectedDay] = useState(defaultValue);
|
|
2015
2012
|
const onChangeHandler = useCallback(value => {
|
|
2016
2013
|
const newValue = (value === null || value === void 0 ? void 0 : value.toLocaleDateString()) === (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) && !preventDeselect ? undefined : value;
|
|
2017
2014
|
setSelectedDay(newValue);
|
|
2018
2015
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
2019
|
-
}, [
|
|
2016
|
+
}, [selectedDay, preventDeselect, onChange]);
|
|
2020
2017
|
const target = useRef(null);
|
|
2021
2018
|
const popover = useRef(null);
|
|
2022
2019
|
const {
|
|
@@ -2031,15 +2028,11 @@ const DateField = forwardRef(({
|
|
|
2031
2028
|
placement: "bottom"
|
|
2032
2029
|
});
|
|
2033
2030
|
return jsxs(Fragment, {
|
|
2034
|
-
children: [jsx(BaseInput, {
|
|
2035
|
-
placeholder: placeholder,
|
|
2036
|
-
value: (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) || "",
|
|
2037
|
-
onChange: () => {},
|
|
2038
|
-
disabled: disabled,
|
|
2039
|
-
readOnly: readOnly,
|
|
2040
|
-
dataTestId: dataTestId,
|
|
2041
|
-
id: id,
|
|
2031
|
+
children: [jsx(BaseInput, Object.assign({
|
|
2042
2032
|
ref: ref,
|
|
2033
|
+
value: (selectedDay === null || selectedDay === void 0 ? void 0 : selectedDay.toLocaleDateString()) || "",
|
|
2034
|
+
onChange: () => {}
|
|
2035
|
+
}, rest, {
|
|
2043
2036
|
suffix: jsx(Icon$1, {
|
|
2044
2037
|
dataTestId: "calendar",
|
|
2045
2038
|
name: "CalendarIcon",
|
|
@@ -2058,8 +2051,9 @@ const DateField = forwardRef(({
|
|
|
2058
2051
|
size: "small"
|
|
2059
2052
|
})
|
|
2060
2053
|
}))
|
|
2061
|
-
})
|
|
2062
|
-
|
|
2054
|
+
}),
|
|
2055
|
+
onClick: e => e.preventDefault()
|
|
2056
|
+
})), jsx(AnimatedPopover, Object.assign({
|
|
2063
2057
|
ref: popoverRef,
|
|
2064
2058
|
onRequestClose: () => {
|
|
2065
2059
|
var _a;
|
|
@@ -2083,6 +2077,34 @@ const RemoveValueContainer = tw.div`
|
|
|
2083
2077
|
tu-date__remove
|
|
2084
2078
|
`;
|
|
2085
2079
|
|
|
2080
|
+
/**
|
|
2081
|
+
* The Label component is used for labels for input fields.
|
|
2082
|
+
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
2083
|
+
*
|
|
2084
|
+
* @param {LabelProps} props - The props for the Label component
|
|
2085
|
+
* @returns {JSX.Element} Label component
|
|
2086
|
+
*/
|
|
2087
|
+
|
|
2088
|
+
const Label$5 = ({
|
|
2089
|
+
id,
|
|
2090
|
+
htmlFor,
|
|
2091
|
+
children,
|
|
2092
|
+
className,
|
|
2093
|
+
dataTestId
|
|
2094
|
+
}) => {
|
|
2095
|
+
return jsx(Root$2, Object.assign({
|
|
2096
|
+
className: className,
|
|
2097
|
+
id: id,
|
|
2098
|
+
"data-testid": dataTestId,
|
|
2099
|
+
htmlFor: htmlFor
|
|
2100
|
+
}, {
|
|
2101
|
+
children: children
|
|
2102
|
+
}));
|
|
2103
|
+
};
|
|
2104
|
+
const Root$2 = tw.label`
|
|
2105
|
+
tu-label
|
|
2106
|
+
`;
|
|
2107
|
+
|
|
2086
2108
|
/**
|
|
2087
2109
|
* The PopoverListItem component.
|
|
2088
2110
|
*
|
|
@@ -2198,143 +2220,6 @@ const StyledText$1 = tw(Text)`
|
|
|
2198
2220
|
text-neutral-500
|
|
2199
2221
|
`;
|
|
2200
2222
|
|
|
2201
|
-
/**
|
|
2202
|
-
* The DayPickerPopover component returns a button which when clicked shows the daypicker.
|
|
2203
|
-
*
|
|
2204
|
-
* @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
|
|
2205
|
-
* @returns {JSX.Element} DayPickerPopover component
|
|
2206
|
-
*/
|
|
2207
|
-
|
|
2208
|
-
const DayPickerPopover = ({
|
|
2209
|
-
disabledDays,
|
|
2210
|
-
className,
|
|
2211
|
-
selectedDay,
|
|
2212
|
-
onDaySelect,
|
|
2213
|
-
intent = "secondary",
|
|
2214
|
-
placement = "bottom",
|
|
2215
|
-
size = "small",
|
|
2216
|
-
buttonContent,
|
|
2217
|
-
language
|
|
2218
|
-
}) => {
|
|
2219
|
-
const target = useRef(null);
|
|
2220
|
-
const popover = useRef(null);
|
|
2221
|
-
const {
|
|
2222
|
-
popoverRef,
|
|
2223
|
-
targetRef,
|
|
2224
|
-
onShow,
|
|
2225
|
-
onHide,
|
|
2226
|
-
popoverProps
|
|
2227
|
-
} = usePopover({
|
|
2228
|
-
targetRef: target,
|
|
2229
|
-
popoverRef: popover,
|
|
2230
|
-
placement: placement
|
|
2231
|
-
});
|
|
2232
|
-
return jsxs(Fragment$1, {
|
|
2233
|
-
children: [jsx(Button, Object.assign({
|
|
2234
|
-
intent: intent,
|
|
2235
|
-
size: size,
|
|
2236
|
-
className: className,
|
|
2237
|
-
prefix: jsx(Icon$1, {
|
|
2238
|
-
name: "CalendarIcon",
|
|
2239
|
-
size: "small"
|
|
2240
|
-
}),
|
|
2241
|
-
ref: targetRef,
|
|
2242
|
-
onClick: onShow
|
|
2243
|
-
}, {
|
|
2244
|
-
children: buttonContent
|
|
2245
|
-
})), jsx(AnimatedPopover, Object.assign({
|
|
2246
|
-
ref: popoverRef,
|
|
2247
|
-
onRequestClose: () => {
|
|
2248
|
-
var _a;
|
|
2249
|
-
|
|
2250
|
-
onHide();
|
|
2251
|
-
(_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
2252
|
-
}
|
|
2253
|
-
}, popoverProps, {
|
|
2254
|
-
children: jsx(PopoverList, {
|
|
2255
|
-
children: jsx(DayPicker, {
|
|
2256
|
-
disabledDays: disabledDays,
|
|
2257
|
-
onDaySelect: onDaySelect,
|
|
2258
|
-
selectedDays: selectedDay,
|
|
2259
|
-
language: language
|
|
2260
|
-
})
|
|
2261
|
-
})
|
|
2262
|
-
}))]
|
|
2263
|
-
});
|
|
2264
|
-
};
|
|
2265
|
-
|
|
2266
|
-
/**
|
|
2267
|
-
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
2268
|
-
*
|
|
2269
|
-
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
2270
|
-
* @returns {JSX.Element} DayRangePicker component
|
|
2271
|
-
*/
|
|
2272
|
-
|
|
2273
|
-
const DayRangePicker = ({
|
|
2274
|
-
onRangeSelect,
|
|
2275
|
-
selectedDays,
|
|
2276
|
-
disabledDays,
|
|
2277
|
-
dataTestId,
|
|
2278
|
-
language
|
|
2279
|
-
}) => {
|
|
2280
|
-
const locale = useLocale(language);
|
|
2281
|
-
const onSelect = useCallback(range => {
|
|
2282
|
-
if (onRangeSelect && range === undefined) {
|
|
2283
|
-
onRangeSelect(undefined);
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
if (onRangeSelect && range) {
|
|
2287
|
-
const from = range.from;
|
|
2288
|
-
const to = range.to ? range.to : range.from;
|
|
2289
|
-
onRangeSelect({
|
|
2290
|
-
from,
|
|
2291
|
-
to
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
}, [onRangeSelect]);
|
|
2295
|
-
return jsx("div", Object.assign({
|
|
2296
|
-
"data-testid": dataTestId
|
|
2297
|
-
}, {
|
|
2298
|
-
children: jsx(DayPicker$1, {
|
|
2299
|
-
mode: "range",
|
|
2300
|
-
onSelect: onSelect,
|
|
2301
|
-
selected: selectedDays,
|
|
2302
|
-
defaultMonth: selectedDays && selectedDays.from,
|
|
2303
|
-
locale: locale,
|
|
2304
|
-
disabled: disabledDays,
|
|
2305
|
-
className: "custom-day-picker range-picker"
|
|
2306
|
-
})
|
|
2307
|
-
}));
|
|
2308
|
-
};
|
|
2309
|
-
|
|
2310
|
-
/**
|
|
2311
|
-
* The Label component is used for labels for input fields.
|
|
2312
|
-
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
2313
|
-
*
|
|
2314
|
-
* @param {LabelProps} props - The props for the Label component
|
|
2315
|
-
* @returns {JSX.Element} Label component
|
|
2316
|
-
*/
|
|
2317
|
-
|
|
2318
|
-
const Label$5 = ({
|
|
2319
|
-
id,
|
|
2320
|
-
htmlFor,
|
|
2321
|
-
children,
|
|
2322
|
-
className,
|
|
2323
|
-
dataTestId
|
|
2324
|
-
}) => {
|
|
2325
|
-
return jsx(Root$2, Object.assign({
|
|
2326
|
-
className: className,
|
|
2327
|
-
id: id,
|
|
2328
|
-
"data-testid": dataTestId,
|
|
2329
|
-
htmlFor: htmlFor
|
|
2330
|
-
}, {
|
|
2331
|
-
children: children
|
|
2332
|
-
}));
|
|
2333
|
-
};
|
|
2334
|
-
const Root$2 = tw.label`
|
|
2335
|
-
tu-label
|
|
2336
|
-
`;
|
|
2337
|
-
|
|
2338
2223
|
/**
|
|
2339
2224
|
* The Tooltip component.
|
|
2340
2225
|
*
|
|
@@ -2510,6 +2395,157 @@ const HelpAddon = tw.span`
|
|
|
2510
2395
|
tu-form-group__help-addon
|
|
2511
2396
|
`;
|
|
2512
2397
|
|
|
2398
|
+
/**
|
|
2399
|
+
* The date field component is used for entering date values.
|
|
2400
|
+
*
|
|
2401
|
+
* _**Do use**_ the DateField for date input.
|
|
2402
|
+
*
|
|
2403
|
+
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
2404
|
+
*/
|
|
2405
|
+
|
|
2406
|
+
const DateField = forwardRef((_a, ref) => {
|
|
2407
|
+
var {
|
|
2408
|
+
label,
|
|
2409
|
+
tip,
|
|
2410
|
+
helpText,
|
|
2411
|
+
errorMessage,
|
|
2412
|
+
helpAddon,
|
|
2413
|
+
isInvalid,
|
|
2414
|
+
className,
|
|
2415
|
+
defaultValue,
|
|
2416
|
+
dataTestId
|
|
2417
|
+
} = _a,
|
|
2418
|
+
rest = __rest(_a, ["label", "tip", "helpText", "errorMessage", "helpAddon", "isInvalid", "className", "defaultValue", "dataTestId"]);
|
|
2419
|
+
|
|
2420
|
+
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
2421
|
+
return jsx(FormGroup, Object.assign({
|
|
2422
|
+
label: label,
|
|
2423
|
+
tip: tip,
|
|
2424
|
+
isInvalid: renderAsInvalid,
|
|
2425
|
+
helpText: errorMessage || helpText,
|
|
2426
|
+
helpAddon: helpAddon,
|
|
2427
|
+
dataTestId: `${dataTestId}-FormGroup`
|
|
2428
|
+
}, {
|
|
2429
|
+
children: jsx(DateInput, Object.assign({
|
|
2430
|
+
ref: ref,
|
|
2431
|
+
defaultValue: defaultValue,
|
|
2432
|
+
isInvalid: renderAsInvalid
|
|
2433
|
+
}, rest, {
|
|
2434
|
+
className: className,
|
|
2435
|
+
dataTestId: dataTestId
|
|
2436
|
+
}))
|
|
2437
|
+
}));
|
|
2438
|
+
});
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* The DayPickerPopover component returns a button which when clicked shows the daypicker.
|
|
2442
|
+
*
|
|
2443
|
+
* @param {DayPickerPopoverProps} props - The props for the DayPickerPopover component
|
|
2444
|
+
* @returns {JSX.Element} DayPickerPopover component
|
|
2445
|
+
*/
|
|
2446
|
+
|
|
2447
|
+
const DayPickerPopover = ({
|
|
2448
|
+
disabledDays,
|
|
2449
|
+
className,
|
|
2450
|
+
selectedDay,
|
|
2451
|
+
onDaySelect,
|
|
2452
|
+
intent = "secondary",
|
|
2453
|
+
placement = "bottom",
|
|
2454
|
+
size = "small",
|
|
2455
|
+
buttonContent,
|
|
2456
|
+
language
|
|
2457
|
+
}) => {
|
|
2458
|
+
const target = useRef(null);
|
|
2459
|
+
const popover = useRef(null);
|
|
2460
|
+
const {
|
|
2461
|
+
popoverRef,
|
|
2462
|
+
targetRef,
|
|
2463
|
+
onShow,
|
|
2464
|
+
onHide,
|
|
2465
|
+
popoverProps
|
|
2466
|
+
} = usePopover({
|
|
2467
|
+
targetRef: target,
|
|
2468
|
+
popoverRef: popover,
|
|
2469
|
+
placement: placement
|
|
2470
|
+
});
|
|
2471
|
+
return jsxs(Fragment$1, {
|
|
2472
|
+
children: [jsx(Button, Object.assign({
|
|
2473
|
+
intent: intent,
|
|
2474
|
+
size: size,
|
|
2475
|
+
className: className,
|
|
2476
|
+
prefix: jsx(Icon$1, {
|
|
2477
|
+
name: "CalendarIcon",
|
|
2478
|
+
size: "small"
|
|
2479
|
+
}),
|
|
2480
|
+
ref: targetRef,
|
|
2481
|
+
onClick: onShow
|
|
2482
|
+
}, {
|
|
2483
|
+
children: buttonContent
|
|
2484
|
+
})), jsx(AnimatedPopover, Object.assign({
|
|
2485
|
+
ref: popoverRef,
|
|
2486
|
+
onRequestClose: () => {
|
|
2487
|
+
var _a;
|
|
2488
|
+
|
|
2489
|
+
onHide();
|
|
2490
|
+
(_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
2491
|
+
}
|
|
2492
|
+
}, popoverProps, {
|
|
2493
|
+
children: jsx(PopoverList, {
|
|
2494
|
+
children: jsx(DayPicker, {
|
|
2495
|
+
disabledDays: disabledDays,
|
|
2496
|
+
onDaySelect: onDaySelect,
|
|
2497
|
+
selectedDays: selectedDay,
|
|
2498
|
+
language: language
|
|
2499
|
+
})
|
|
2500
|
+
})
|
|
2501
|
+
}))]
|
|
2502
|
+
});
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
/**
|
|
2506
|
+
* The DayRangePicker component should be used when the user needs to select a range of dates.
|
|
2507
|
+
*
|
|
2508
|
+
* @param {DayRangePickerProps} props - The props for the DayRangePicker component
|
|
2509
|
+
* @returns {JSX.Element} DayRangePicker component
|
|
2510
|
+
*/
|
|
2511
|
+
|
|
2512
|
+
const DayRangePicker = ({
|
|
2513
|
+
onRangeSelect,
|
|
2514
|
+
selectedDays,
|
|
2515
|
+
disabledDays,
|
|
2516
|
+
dataTestId,
|
|
2517
|
+
language
|
|
2518
|
+
}) => {
|
|
2519
|
+
const locale = useLocale(language);
|
|
2520
|
+
const onSelect = useCallback(range => {
|
|
2521
|
+
if (onRangeSelect && range === undefined) {
|
|
2522
|
+
onRangeSelect(undefined);
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
if (onRangeSelect && range) {
|
|
2526
|
+
const from = range.from;
|
|
2527
|
+
const to = range.to ? range.to : range.from;
|
|
2528
|
+
onRangeSelect({
|
|
2529
|
+
from,
|
|
2530
|
+
to
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
}, [onRangeSelect]);
|
|
2534
|
+
return jsx("div", Object.assign({
|
|
2535
|
+
"data-testid": dataTestId
|
|
2536
|
+
}, {
|
|
2537
|
+
children: jsx(DayPicker$1, {
|
|
2538
|
+
mode: "range",
|
|
2539
|
+
onSelect: onSelect,
|
|
2540
|
+
selected: selectedDays,
|
|
2541
|
+
defaultMonth: selectedDays && selectedDays.from,
|
|
2542
|
+
locale: locale,
|
|
2543
|
+
disabled: disabledDays,
|
|
2544
|
+
className: "custom-day-picker range-picker"
|
|
2545
|
+
})
|
|
2546
|
+
}));
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2513
2549
|
/**
|
|
2514
2550
|
* Indicators are non-interactive elements that communicate essential aspects of the state of an asset.
|
|
2515
2551
|
*
|
|
@@ -2705,7 +2741,7 @@ const MobileIconButton = tw(IconButton)`
|
|
|
2705
2741
|
`;
|
|
2706
2742
|
|
|
2707
2743
|
/**
|
|
2708
|
-
* The MenuItem component
|
|
2744
|
+
* The MenuItem component is used to display a menu, primarily meant to be used in a list form.
|
|
2709
2745
|
*
|
|
2710
2746
|
* @param {MenuItemProps} props - The props for the MenuItem component
|
|
2711
2747
|
* @returns {JSX.Element} MenuItem component
|
|
@@ -3468,7 +3504,7 @@ const SelectContainer = ({
|
|
|
3468
3504
|
htmlFor: id
|
|
3469
3505
|
}, {
|
|
3470
3506
|
children: label
|
|
3471
|
-
})), children, (hasError || info) && jsx(InformativeText
|
|
3507
|
+
})), children, (hasError || info) && jsx(InformativeText, Object.assign({
|
|
3472
3508
|
size: "small",
|
|
3473
3509
|
"$hasError": hasError !== null && hasError !== void 0 ? hasError : false
|
|
3474
3510
|
}, {
|
|
@@ -3479,7 +3515,7 @@ const SelectContainer = ({
|
|
|
3479
3515
|
const Container = tw.label`
|
|
3480
3516
|
tu-select__container
|
|
3481
3517
|
`;
|
|
3482
|
-
const InformativeText
|
|
3518
|
+
const InformativeText = tw(Text)`
|
|
3483
3519
|
tu-informative-text
|
|
3484
3520
|
${p => p.$hasError ? `tu-informative-text--error` : null}
|
|
3485
3521
|
`;
|
|
@@ -3758,87 +3794,63 @@ const SkeletonLine = tw.div`
|
|
|
3758
3794
|
tu-skeleton-line
|
|
3759
3795
|
`;
|
|
3760
3796
|
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
ref: ref,
|
|
3809
|
-
defaultValue: defaultValue,
|
|
3810
|
-
required: required
|
|
3811
|
-
}), (hasError || info) && jsx(InformativeText, Object.assign({
|
|
3812
|
-
size: "small",
|
|
3813
|
-
"$hasError": hasError
|
|
3814
|
-
}, {
|
|
3815
|
-
children: hasError ? error : info
|
|
3816
|
-
}))]
|
|
3797
|
+
/**
|
|
3798
|
+
* The TextArea is a base component, and should not be used very often.
|
|
3799
|
+
* For most cases the TextAreaField is the correct component.
|
|
3800
|
+
*/
|
|
3801
|
+
|
|
3802
|
+
const TextArea = React.forwardRef((_a, ref) => {
|
|
3803
|
+
var {
|
|
3804
|
+
id,
|
|
3805
|
+
name,
|
|
3806
|
+
value,
|
|
3807
|
+
rows,
|
|
3808
|
+
disabled,
|
|
3809
|
+
placeholder,
|
|
3810
|
+
readOnly,
|
|
3811
|
+
tabIndex,
|
|
3812
|
+
onChange,
|
|
3813
|
+
onFocus,
|
|
3814
|
+
onBlur,
|
|
3815
|
+
maxLength,
|
|
3816
|
+
resize = "vertical",
|
|
3817
|
+
defaultValue,
|
|
3818
|
+
className,
|
|
3819
|
+
required,
|
|
3820
|
+
dataTestId,
|
|
3821
|
+
isInvalid
|
|
3822
|
+
} = _a,
|
|
3823
|
+
rest = __rest(_a, ["id", "name", "value", "rows", "disabled", "placeholder", "readOnly", "tabIndex", "onChange", "onFocus", "onBlur", "maxLength", "resize", "defaultValue", "className", "required", "dataTestId", "isInvalid"]);
|
|
3824
|
+
|
|
3825
|
+
return jsx(StyledTextArea, Object.assign({
|
|
3826
|
+
name: name,
|
|
3827
|
+
value: value,
|
|
3828
|
+
rows: rows,
|
|
3829
|
+
disabled: disabled,
|
|
3830
|
+
placeholder: placeholder,
|
|
3831
|
+
readOnly: readOnly,
|
|
3832
|
+
tabIndex: tabIndex,
|
|
3833
|
+
onFocus: onFocus,
|
|
3834
|
+
onBlur: onBlur,
|
|
3835
|
+
maxLength: maxLength,
|
|
3836
|
+
"$resize": resize,
|
|
3837
|
+
"$invalid": isInvalid,
|
|
3838
|
+
ref: ref,
|
|
3839
|
+
defaultValue: defaultValue,
|
|
3840
|
+
required: required
|
|
3841
|
+
}, rest, {
|
|
3842
|
+
onChange: onChange,
|
|
3843
|
+
"data-testId": dataTestId
|
|
3817
3844
|
}));
|
|
3818
3845
|
});
|
|
3819
|
-
const TextAreaContainer = tw.div``;
|
|
3820
3846
|
const StyledTextArea = tw.textarea`
|
|
3821
|
-
|
|
3822
|
-
w-full
|
|
3823
|
-
block
|
|
3824
|
-
p-2
|
|
3825
|
-
overflow-auto
|
|
3826
|
-
appearance-none
|
|
3827
|
-
text-base
|
|
3828
|
-
text-slate-900
|
|
3829
|
-
placeholder-slate-400
|
|
3830
|
-
focus-visible:outline-none
|
|
3831
|
-
border-box
|
|
3832
|
-
h-20
|
|
3833
|
-
|
|
3834
|
-
transition
|
|
3835
|
-
|
|
3847
|
+
tu-textarea
|
|
3836
3848
|
${({
|
|
3837
|
-
$
|
|
3838
|
-
}) => $
|
|
3849
|
+
$invalid
|
|
3850
|
+
}) => $invalid ? tws`tu-textarea--invalid` : null}
|
|
3839
3851
|
${({
|
|
3840
3852
|
disabled
|
|
3841
|
-
}) => disabled ? tws`tu-
|
|
3853
|
+
}) => disabled ? tws`tu-textarea--disabled` : null}
|
|
3842
3854
|
${({
|
|
3843
3855
|
$resize
|
|
3844
3856
|
}) => {
|
|
@@ -3859,24 +3871,7 @@ const StyledTextArea = tw.textarea`
|
|
|
3859
3871
|
return null;
|
|
3860
3872
|
}
|
|
3861
3873
|
}};
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
3874
|
`;
|
|
3865
|
-
const InformativeText = tw(Text)`
|
|
3866
|
-
mt-1
|
|
3867
|
-
${p => p.$hasError ? tws`text-red-500` : tws`text-neutral-600`};
|
|
3868
|
-
`;
|
|
3869
|
-
|
|
3870
|
-
/**
|
|
3871
|
-
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
3872
|
-
*
|
|
3873
|
-
* NOTE: If shown with a label, please use the `TextField` component instead.
|
|
3874
|
-
*/
|
|
3875
|
-
|
|
3876
|
-
const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
3877
|
-
ref: ref,
|
|
3878
|
-
type: "text"
|
|
3879
|
-
}, props)));
|
|
3880
3875
|
|
|
3881
3876
|
/**
|
|
3882
3877
|
* The TextLengthIndicator component shows a `{length}/{maxLength}` label.
|
|
@@ -3898,6 +3893,67 @@ const Root = tw.span`
|
|
|
3898
3893
|
font-mono
|
|
3899
3894
|
`;
|
|
3900
3895
|
|
|
3896
|
+
const TextAreaField = React.forwardRef((_a, ref) => {
|
|
3897
|
+
var {
|
|
3898
|
+
label,
|
|
3899
|
+
tip,
|
|
3900
|
+
helpText,
|
|
3901
|
+
helpAddon,
|
|
3902
|
+
errorMessage,
|
|
3903
|
+
isInvalid,
|
|
3904
|
+
maxLength,
|
|
3905
|
+
onChange,
|
|
3906
|
+
className,
|
|
3907
|
+
value,
|
|
3908
|
+
dataTestId
|
|
3909
|
+
} = _a,
|
|
3910
|
+
rest = __rest(_a, ["label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
3911
|
+
|
|
3912
|
+
const [valueLength, setValueLength] = React.useState(value ? `${value}`.length : 0);
|
|
3913
|
+
const renderAsInvalid = isInvalid || Boolean(errorMessage);
|
|
3914
|
+
const handleChange = React.useCallback(event => {
|
|
3915
|
+
setValueLength(event.target.value.length);
|
|
3916
|
+
|
|
3917
|
+
if (onChange) {
|
|
3918
|
+
onChange(event);
|
|
3919
|
+
}
|
|
3920
|
+
}, [onChange]);
|
|
3921
|
+
return jsx(FormGroup, Object.assign({
|
|
3922
|
+
label: label,
|
|
3923
|
+
tip: tip,
|
|
3924
|
+
isInvalid: renderAsInvalid,
|
|
3925
|
+
helpText: errorMessage || helpText,
|
|
3926
|
+
helpAddon: helpAddon || maxLength !== null && maxLength !== undefined && jsx(TextLengthIndicator, {
|
|
3927
|
+
length: valueLength,
|
|
3928
|
+
maxLength: maxLength
|
|
3929
|
+
}),
|
|
3930
|
+
className: className,
|
|
3931
|
+
dataTestId: `${dataTestId}-FormGroup`
|
|
3932
|
+
}, {
|
|
3933
|
+
children: jsx(TextArea, Object.assign({
|
|
3934
|
+
ref: ref,
|
|
3935
|
+
maxLength: maxLength,
|
|
3936
|
+
value: value,
|
|
3937
|
+
isInvalid: renderAsInvalid
|
|
3938
|
+
}, rest, {
|
|
3939
|
+
className: className,
|
|
3940
|
+
onChange: handleChange,
|
|
3941
|
+
dataTestId: dataTestId
|
|
3942
|
+
}))
|
|
3943
|
+
}));
|
|
3944
|
+
});
|
|
3945
|
+
|
|
3946
|
+
/**
|
|
3947
|
+
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
3948
|
+
*
|
|
3949
|
+
* NOTE: If shown with a label, please use the `TextField` component instead.
|
|
3950
|
+
*/
|
|
3951
|
+
|
|
3952
|
+
const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
3953
|
+
ref: ref,
|
|
3954
|
+
type: "text"
|
|
3955
|
+
}, props)));
|
|
3956
|
+
|
|
3901
3957
|
/**
|
|
3902
3958
|
* Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
|
|
3903
3959
|
*
|
|
@@ -4506,4 +4562,4 @@ const Layout = tw.div`
|
|
|
4506
4562
|
tu-layout-TwoColumnLayout
|
|
4507
4563
|
`;
|
|
4508
4564
|
|
|
4509
|
-
export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$5 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
|
4565
|
+
export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$5 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./DateField";
|