@trackunit/react-form-components 1.3.28 → 1.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +112 -109
- package/index.esm.js +125 -122
- package/package.json +11 -11
- package/src/components/ActionButton/ActionButton.d.ts +5 -4
- package/src/components/BaseInput/BaseInput.d.ts +9 -2
- package/src/components/BaseInput/components/GenericActionsRenderer.d.ts +1 -1
- package/src/components/Checkbox/CheckIcon.d.ts +1 -1
- package/src/components/Checkbox/Checkbox.d.ts +9 -3
- package/src/components/Checkbox/IndeterminateIcon.d.ts +1 -1
- package/src/components/CheckboxField/CheckboxField.d.ts +9 -2
- package/src/components/ColorField/ColorField.d.ts +1 -2
- package/src/components/DateField/DateField.d.ts +9 -1
- package/src/components/DateInput/DateInput.d.ts +7 -1
- package/src/components/DropZone/DropZone.d.ts +4 -3
- package/src/components/EmailField/EmailField.d.ts +4 -2
- package/src/components/EmailInput/EmailInput.d.ts +4 -1
- package/src/components/FormGroup/FormGroup.d.ts +6 -6
- package/src/components/Label/Label.d.ts +4 -4
- package/src/components/NumberField/NumberField.d.ts +9 -1
- package/src/components/NumberInput/NumberInput.d.ts +4 -1
- package/src/components/OptionCard/OptionCard.d.ts +11 -4
- package/src/components/PasswordField/PasswordField.d.ts +9 -1
- package/src/components/PasswordInput/PasswordInput.d.ts +4 -1
- package/src/components/PhoneField/PhoneField.d.ts +9 -2
- package/src/components/PhoneFieldWithController/PhoneFieldWithController.d.ts +9 -2
- package/src/components/PhoneInput/CountryCodeSelect.d.ts +1 -1
- package/src/components/PhoneInput/PhoneInput.d.ts +4 -2
- package/src/components/RadioGroup/RadioGroup.d.ts +6 -6
- package/src/components/RadioGroup/RadioItem.d.ts +3 -3
- package/src/components/Schedule/Schedule.d.ts +1 -1
- package/src/components/Search/Search.d.ts +11 -5
- package/src/components/Select/CreatableSelect.d.ts +1 -1
- package/src/components/Select/Select.d.ts +1 -1
- package/src/components/Select/SelectMenuItem/SelectMenuItem.d.ts +5 -5
- package/src/components/Select/TagWithWidth.d.ts +1 -1
- package/src/components/Select/TagsContainer.d.ts +3 -2
- package/src/components/Select/useCustomComponents.d.ts +7 -7
- package/src/components/Select/useCustomStyles.d.ts +3 -3
- package/src/components/Select/useSelect.d.ts +3 -3
- package/src/components/SelectField/CreatableSelectField.d.ts +8 -20
- package/src/components/SelectField/FormFieldSelectAdapter.d.ts +14 -3
- package/src/components/SelectField/SelectField.d.ts +5 -20
- package/src/components/TextArea/TextArea.d.ts +9 -2
- package/src/components/TextAreaField/TextAreaField.d.ts +12 -2
- package/src/components/TextField/TextField.d.ts +4 -2
- package/src/components/TextField/TextLenghtIndicator.d.ts +1 -1
- package/src/components/TextInput/TextInput.d.ts +4 -1
- package/src/components/TimeRange/TimeRange.d.ts +3 -3
- package/src/components/TimeRangeField/TimeRangeField.d.ts +1 -1
- package/src/components/UploadField/UploadField.d.ts +4 -1
- package/src/components/UploadInput/UploadInput.d.ts +4 -1
- package/src/components/UrlField/UrlField.d.ts +4 -1
- package/src/components/UrlInput/UrlInput.d.ts +4 -1
- package/src/test-utils/test-utils.d.ts +0 -1
- package/src/utilities/compareReactNodes.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.33",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"react": "
|
|
10
|
+
"react": "19.0.0",
|
|
11
11
|
"usehooks-ts": "^3.1.0",
|
|
12
|
+
"react-select": "^5.10.0",
|
|
12
13
|
"@js-temporal/polyfill": "^0.4.4",
|
|
13
14
|
"libphonenumber-js": "1.10.36",
|
|
15
|
+
"@testing-library/react": "16.2.0",
|
|
14
16
|
"jest-fetch-mock": "^3.0.3",
|
|
15
17
|
"zod": "3.22.4",
|
|
16
18
|
"react-hook-form": "7.53.1",
|
|
17
19
|
"tailwind-merge": "^2.0.0",
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "1.3.
|
|
19
|
-
"@trackunit/react-components": "1.4.
|
|
20
|
-
"@trackunit/ui-icons": "1.3.
|
|
21
|
-
"@trackunit/shared-utils": "1.5.
|
|
22
|
-
"@trackunit/ui-design-tokens": "1.3.
|
|
23
|
-
"@trackunit/i18n-library-translation": "1.3.
|
|
24
|
-
"string-ts": "^2.0.0"
|
|
25
|
-
"react-select": "^5.8.0",
|
|
26
|
-
"@testing-library/react": "15.0.6"
|
|
20
|
+
"@trackunit/css-class-variance-utilities": "1.3.28",
|
|
21
|
+
"@trackunit/react-components": "1.4.28",
|
|
22
|
+
"@trackunit/ui-icons": "1.3.28",
|
|
23
|
+
"@trackunit/shared-utils": "1.5.28",
|
|
24
|
+
"@trackunit/ui-design-tokens": "1.3.28",
|
|
25
|
+
"@trackunit/i18n-library-translation": "1.3.29",
|
|
26
|
+
"string-ts": "^2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"module": "./index.esm.js",
|
|
29
29
|
"main": "./index.cjs.js",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ButtonCommonProps, CommonProps } from "@trackunit/react-components";
|
|
2
|
+
import { RefObject } from "react";
|
|
2
3
|
export type ActionType = "PHONE_NUMBER" | "WEB_ADDRESS" | "EMAIL" | "COPY" | "EDIT";
|
|
3
4
|
interface AbstractActionButtonProps extends ButtonCommonProps, CommonProps {
|
|
4
5
|
/**
|
|
@@ -8,7 +9,7 @@ interface AbstractActionButtonProps extends ButtonCommonProps, CommonProps {
|
|
|
8
9
|
/**
|
|
9
10
|
* The value to be passed into the button.
|
|
10
11
|
*/
|
|
11
|
-
value?: string |
|
|
12
|
+
value?: string | RefObject<HTMLInputElement | null> | null;
|
|
12
13
|
}
|
|
13
14
|
interface GenericActionButtonProps extends AbstractActionButtonProps {
|
|
14
15
|
/**
|
|
@@ -28,7 +29,7 @@ interface CopyActionButtonProps extends AbstractActionButtonProps {
|
|
|
28
29
|
/**
|
|
29
30
|
* The value to be passed into the button.
|
|
30
31
|
*/
|
|
31
|
-
value?:
|
|
32
|
+
value?: RefObject<HTMLInputElement | null>;
|
|
32
33
|
}
|
|
33
34
|
interface EditActionButtonProps extends AbstractActionButtonProps {
|
|
34
35
|
/**
|
|
@@ -38,14 +39,14 @@ interface EditActionButtonProps extends AbstractActionButtonProps {
|
|
|
38
39
|
/**
|
|
39
40
|
* The value to be passed into the button.
|
|
40
41
|
*/
|
|
41
|
-
value?: React.RefObject<HTMLInputElement>;
|
|
42
|
+
value?: React.RefObject<HTMLInputElement | null>;
|
|
42
43
|
}
|
|
43
44
|
type ActionButtonProps = CopyActionButtonProps | GenericActionButtonProps | EditActionButtonProps;
|
|
44
45
|
/**
|
|
45
46
|
* The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
|
|
46
47
|
*
|
|
47
48
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
48
|
-
* @returns {
|
|
49
|
+
* @returns {ReactElement} ActionButton component
|
|
49
50
|
*/
|
|
50
51
|
export declare const ActionButton: ({ type, value, dataTestId, size, disabled, className, onClick }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
52
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
2
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
|
-
import { InputHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
4
4
|
import { FormComponentSizes } from "../../types";
|
|
5
5
|
import { LockedForReasons } from "./InputLockReasonTooltip";
|
|
6
6
|
import { BaseInputActionTypes } from "./components";
|
|
@@ -62,6 +62,10 @@ export interface BaseInputProps extends FilteredInputProps, CommonProps {
|
|
|
62
62
|
* Flag or object to set the input as readOnly. If an object, shows a tooltip with the reason.
|
|
63
63
|
*/
|
|
64
64
|
readOnly?: boolean | LockedForReasons;
|
|
65
|
+
/**
|
|
66
|
+
* A ref for the component
|
|
67
|
+
*/
|
|
68
|
+
ref?: Ref<HTMLInputElement>;
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
67
71
|
* A base input component that can be used for text inputs, password inputs, etc.
|
|
@@ -71,5 +75,8 @@ export interface BaseInputProps extends FilteredInputProps, CommonProps {
|
|
|
71
75
|
* For specific input types make sure to use the corresponding input component.
|
|
72
76
|
* This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
|
|
73
77
|
*/
|
|
74
|
-
export declare const BaseInput:
|
|
78
|
+
export declare const BaseInput: {
|
|
79
|
+
({ className, isInvalid, dataTestId, prefix, suffix, addonBefore, addonAfter, actions, fieldSize, nonInteractive, inputClassName, placeholder, isWarning, type, genericAction, style, ref, ...rest }: BaseInputProps): import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
75
82
|
export {};
|
|
@@ -5,7 +5,7 @@ type GenericActionsRendererProps = {
|
|
|
5
5
|
genericAction?: BaseInputActionTypes;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
fieldSize?: FormComponentSizes;
|
|
8
|
-
innerRef: RefObject<HTMLInputElement>;
|
|
8
|
+
innerRef: RefObject<HTMLInputElement | null>;
|
|
9
9
|
tooltipLabel?: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const GenericActionsRenderer: ({ genericAction, disabled, fieldSize, innerRef, tooltipLabel, }: GenericActionsRendererProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -5,7 +5,7 @@ interface CheckIconProps extends CommonProps {
|
|
|
5
5
|
* The CheckIcon component is used by the checkbox to display the checked state.
|
|
6
6
|
*
|
|
7
7
|
* @param {CheckIconProps} props - The props for the CheckIcon component
|
|
8
|
-
* @returns {
|
|
8
|
+
* @returns {ReactElement} CheckIcon component
|
|
9
9
|
*/
|
|
10
10
|
export declare const CheckIcon: ({ className, dataTestId }: CheckIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
2
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
|
-
import { InputHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
4
4
|
export interface CheckboxProps extends CommonProps, MappedOmit<InputHTMLAttributes<HTMLInputElement>, "prefix"> {
|
|
5
5
|
/**
|
|
6
6
|
* A string element to be displayed as a label
|
|
@@ -35,6 +35,10 @@ export interface CheckboxProps extends CommonProps, MappedOmit<InputHTMLAttribut
|
|
|
35
35
|
* An boolean flag to stop propagation of the click event
|
|
36
36
|
*/
|
|
37
37
|
stopPropagation?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A ref for the component
|
|
40
|
+
*/
|
|
41
|
+
ref?: Ref<HTMLInputElement>;
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
|
|
@@ -48,6 +52,8 @@ export interface CheckboxProps extends CommonProps, MappedOmit<InputHTMLAttribut
|
|
|
48
52
|
* @description A reference to the input element is provided as the `ref` prop.
|
|
49
53
|
* @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
|
|
50
54
|
* @param {CheckboxProps} props - The props for the Checkbox component
|
|
51
|
-
* @returns {JSX.Element} Checkbox component
|
|
52
55
|
*/
|
|
53
|
-
export declare const Checkbox:
|
|
56
|
+
export declare const Checkbox: {
|
|
57
|
+
({ className, dataTestId, onChange, checked, disabled, isInvalid, readOnly, indeterminate, suffix, label, tabIndex, stopPropagation, ref, ...rest }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
displayName: string;
|
|
59
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
|
|
3
3
|
*
|
|
4
4
|
* @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
|
|
5
|
-
* @returns {
|
|
5
|
+
* @returns {ReactElement} IndeterminateIcon component
|
|
6
6
|
*/
|
|
7
7
|
export declare const IndeterminateIcon: ({ className }: {
|
|
8
8
|
className?: string;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { CheckboxProps } from "../Checkbox/Checkbox";
|
|
3
3
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
4
|
type FormGroupExposedProps = Pick<FormGroupProps, "tip" | "helpText" | "helpAddon">;
|
|
5
5
|
export interface CheckboxFieldProps extends CheckboxProps, FormGroupExposedProps {
|
|
6
6
|
checkboxLabel?: string | ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* A ref for the component
|
|
9
|
+
*/
|
|
10
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
11
|
}
|
|
8
12
|
/**
|
|
9
13
|
* The checkbox field component is used for entering boolean values.
|
|
10
14
|
*
|
|
11
15
|
* _**Do use**_ the CheckboxField for boolean input.
|
|
12
16
|
*/
|
|
13
|
-
export declare const CheckboxField:
|
|
17
|
+
export declare const CheckboxField: {
|
|
18
|
+
({ label, id, tip, helpText, helpAddon, isInvalid, className, checked, dataTestId, checkboxLabel, onChange, ref, ...rest }: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
14
21
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { BaseInputProps } from "../BaseInput";
|
|
3
2
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
3
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
@@ -20,5 +19,5 @@ export interface ColorFieldProps extends FormGroupExposedProps, BaseInputProps {
|
|
|
20
19
|
* ColorField validates that user enters a valid color address.
|
|
21
20
|
*
|
|
22
21
|
*/
|
|
23
|
-
export declare const ColorField:
|
|
22
|
+
export declare const ColorField: import("react").ForwardRefExoticComponent<Omit<ColorFieldProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
24
23
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { DateInputProps } from "../DateInput/DateInput";
|
|
2
3
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
3
4
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
@@ -6,6 +7,10 @@ export interface DateFieldProps extends DateInputProps, FormGroupExposedProps {
|
|
|
6
7
|
* If a value is set, the field is rendered in its invalid state.
|
|
7
8
|
*/
|
|
8
9
|
errorMessage?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A ref for the component
|
|
12
|
+
*/
|
|
13
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* The date field component is used for entering date values.
|
|
@@ -14,5 +19,8 @@ export interface DateFieldProps extends DateInputProps, FormGroupExposedProps {
|
|
|
14
19
|
*
|
|
15
20
|
* _**Do not use**_ this fields for non-serialized dates. Use TextField instead.
|
|
16
21
|
*/
|
|
17
|
-
export declare const DateField:
|
|
22
|
+
export declare const DateField: {
|
|
23
|
+
({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, className, defaultValue, dataTestId, ref, ...rest }: DateFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
18
26
|
export {};
|
|
@@ -23,5 +23,11 @@ export interface DateInputProps extends BaseInputExposedProps {
|
|
|
23
23
|
*
|
|
24
24
|
* NOTE: If shown with a label, please use the `DateField` component instead.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
export declare const DateInput: {
|
|
30
|
+
({ min, max, defaultValue, value, ref, ...rest }: DateInputProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
27
33
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CommonProps, Size } from "@trackunit/react-components";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
3
|
import { BaseInputProps } from "../BaseInput";
|
|
3
4
|
type BaseInputExposedProps = Omit<BaseInputProps, "type" | "suffix" | "prefix" | "addonAfter" | "addonBefore" | "actions" | "placeholder" | "fieldSize" | "size" | "nonInteractive">;
|
|
4
5
|
export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
|
|
5
6
|
/**
|
|
6
7
|
* A JSX element or a string to set a focusable label in Drop Zone. If not provided, the default label will be used.
|
|
7
8
|
*/
|
|
8
|
-
label?:
|
|
9
|
+
label?: ReactNode | string;
|
|
9
10
|
/**
|
|
10
11
|
* A flag to disable the drop zone.
|
|
11
12
|
*/
|
|
@@ -27,7 +28,7 @@ export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
|
|
|
27
28
|
* The Drop Zone can be used to drag and drop files or to browse and select files from the file system.
|
|
28
29
|
*
|
|
29
30
|
* @param {DropZoneProps} props - The props for the DropZone component
|
|
30
|
-
* @returns {
|
|
31
|
+
* @returns {ReactElement} DropZone component
|
|
31
32
|
*/
|
|
32
|
-
export declare const DropZone: ({ className, dataTestId, filesSelected, label, size, isInvalid, disabled, accept, multiple, ...rest }: DropZoneProps) =>
|
|
33
|
+
export declare const DropZone: ({ className, dataTestId, filesSelected, label, size, isInvalid, disabled, accept, multiple, ...rest }: DropZoneProps) => ReactElement;
|
|
33
34
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { BaseInputProps } from "../BaseInput";
|
|
3
2
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
4
3
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
@@ -13,5 +12,8 @@ export interface EmailFieldProps extends FormGroupExposedProps, BaseInputProps {
|
|
|
13
12
|
* EmailField validates that user enters a valid email address.
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
16
|
-
export declare const EmailField:
|
|
15
|
+
export declare const EmailField: {
|
|
16
|
+
({ label, id, tip, helpText, errorMessage, helpAddon, className, defaultValue, dataTestId, value, onChange, onBlur, isInvalid, ref, ...rest }: EmailFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
17
19
|
export {};
|
|
@@ -21,5 +21,8 @@ export interface EmailInputProps extends BaseInputExposedProps {
|
|
|
21
21
|
* A reference to the input element is provided as the `ref` prop.
|
|
22
22
|
* For specific input types make sure to use the corresponding input component.
|
|
23
23
|
*/
|
|
24
|
-
export declare const EmailInput:
|
|
24
|
+
export declare const EmailInput: {
|
|
25
|
+
({ fieldSize, disabled, dataTestId, isInvalid, onChange, disableAction, ref, ...rest }: EmailInputProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
25
28
|
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
-
import
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
3
|
export interface FormGroupProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The label for the form group.
|
|
6
6
|
*/
|
|
7
|
-
label: string |
|
|
7
|
+
label: string | ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* Content to display in the tooltip when hovering the ? icon next to the label.
|
|
10
10
|
*/
|
|
11
|
-
tip?: string |
|
|
11
|
+
tip?: string | ReactNode;
|
|
12
12
|
htmlFor?: string;
|
|
13
13
|
/**
|
|
14
14
|
* A string to display under the input element to help the user understand the input.
|
|
@@ -18,12 +18,12 @@ export interface FormGroupProps extends CommonProps {
|
|
|
18
18
|
* An addon element to render to the right under the input element.
|
|
19
19
|
* Used for displaying maxLength etc.
|
|
20
20
|
*/
|
|
21
|
-
helpAddon?: string |
|
|
21
|
+
helpAddon?: string | ReactNode;
|
|
22
22
|
/**
|
|
23
23
|
* If true the input is rendered in its invalid state.
|
|
24
24
|
*/
|
|
25
25
|
isInvalid?: boolean;
|
|
26
|
-
children?:
|
|
26
|
+
children?: ReactNode;
|
|
27
27
|
name?: string;
|
|
28
28
|
/**
|
|
29
29
|
* If true the input is required with an asterisk prepended to the label.
|
|
@@ -40,6 +40,6 @@ export interface FormGroupProps extends CommonProps {
|
|
|
40
40
|
* Besides a label the component supplies an optional Tooltip, HelpText and HelpAddon support.
|
|
41
41
|
*
|
|
42
42
|
* @param {FormGroupProps} props - The props for the FormGroup component
|
|
43
|
-
* @returns {
|
|
43
|
+
* @returns {ReactElement} FormGroup component
|
|
44
44
|
*/
|
|
45
45
|
export declare const FormGroup: ({ isInvalid, isWarning, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, required, }: FormGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
-
import
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
3
|
export interface LabelProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* ID of the label.
|
|
@@ -12,7 +12,7 @@ export interface LabelProps extends CommonProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* The label value.
|
|
14
14
|
*/
|
|
15
|
-
children?:
|
|
15
|
+
children?: ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Whether the label is disabled or not.
|
|
18
18
|
*/
|
|
@@ -28,6 +28,6 @@ export interface LabelProps extends CommonProps {
|
|
|
28
28
|
* This component is **not used directly**, but is part of the FormGroup and Field components.
|
|
29
29
|
*
|
|
30
30
|
* @param {LabelProps} props - The props for the Label component
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {ReactElement} Label component
|
|
32
32
|
*/
|
|
33
|
-
export declare const Label: ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }: LabelProps) =>
|
|
33
|
+
export declare const Label: ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }: LabelProps) => ReactElement;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
2
3
|
import { NumberInputProps } from "../NumberInput/NumberInput";
|
|
3
4
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
@@ -6,6 +7,10 @@ export interface NumberFieldProps extends NumberInputProps, FormGroupExposedProp
|
|
|
6
7
|
* If a value is set, the field is rendered in its invalid state.
|
|
7
8
|
*/
|
|
8
9
|
errorMessage?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A ref for the component
|
|
12
|
+
*/
|
|
13
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* The number field component is used for entering numeric values and includes controls for incrementally increasing or decreasing the value.
|
|
@@ -14,5 +19,8 @@ export interface NumberFieldProps extends NumberInputProps, FormGroupExposedProp
|
|
|
14
19
|
*
|
|
15
20
|
* _**Do not use**_ this fields for non-serialized numbers. Use TextField instead.
|
|
16
21
|
*/
|
|
17
|
-
export declare const NumberField:
|
|
22
|
+
export declare const NumberField: {
|
|
23
|
+
({ label, id, tip, helpText, errorMessage, helpAddon, isInvalid, maxLength, className, value, dataTestId, defaultValue, onBlur, onChange, ref, ...rest }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
18
26
|
export {};
|
|
@@ -7,5 +7,8 @@ export interface NumberInputProps extends BaseInputExposedProps {
|
|
|
7
7
|
*
|
|
8
8
|
* NOTE: If shown with a label, please use the `NumberField` component instead.
|
|
9
9
|
*/
|
|
10
|
-
export declare const NumberInput:
|
|
10
|
+
export declare const NumberInput: {
|
|
11
|
+
({ ref, ...rest }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
11
14
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommonProps, IconProps } from "@trackunit/react-components";
|
|
2
|
-
import { InputHTMLAttributes, ReactElement } from "react";
|
|
2
|
+
import { InputHTMLAttributes, ReactElement, ReactNode, Ref } from "react";
|
|
3
3
|
export interface OptionCardProps extends InputHTMLAttributes<HTMLInputElement>, CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* Icon displayed at the top inside the OptionCard.
|
|
@@ -12,11 +12,11 @@ export interface OptionCardProps extends InputHTMLAttributes<HTMLInputElement>,
|
|
|
12
12
|
/**
|
|
13
13
|
* Subheading displayed above the description.
|
|
14
14
|
*/
|
|
15
|
-
subheading?: string |
|
|
15
|
+
subheading?: string | ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Descriptive text displayed inside the OptionCard.
|
|
18
18
|
*/
|
|
19
|
-
description?: string |
|
|
19
|
+
description?: string | ReactNode;
|
|
20
20
|
/**
|
|
21
21
|
* A custom image to be displayed instead of icon (ex logo)
|
|
22
22
|
*/
|
|
@@ -25,6 +25,10 @@ export interface OptionCardProps extends InputHTMLAttributes<HTMLInputElement>,
|
|
|
25
25
|
* Styles for the OptionCard content.
|
|
26
26
|
*/
|
|
27
27
|
contentClassName?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A ref for the component
|
|
30
|
+
*/
|
|
31
|
+
ref?: Ref<HTMLInputElement>;
|
|
28
32
|
}
|
|
29
33
|
interface CustomImage {
|
|
30
34
|
src: string;
|
|
@@ -33,5 +37,8 @@ interface CustomImage {
|
|
|
33
37
|
/**
|
|
34
38
|
* A card version of a radio button that includes an icon, headings and a description.
|
|
35
39
|
*/
|
|
36
|
-
export declare const OptionCard:
|
|
40
|
+
export declare const OptionCard: {
|
|
41
|
+
({ icon, heading, subheading, description, disabled, id, value, className, contentClassName, dataTestId, customImage, ref, ...rest }: OptionCardProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
displayName: string;
|
|
43
|
+
};
|
|
37
44
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
2
3
|
import { PasswordInputProps } from "../PasswordInput/PasswordInput";
|
|
3
4
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
|
|
@@ -6,6 +7,10 @@ export interface PasswordFieldProps extends Omit<PasswordInputProps, "obfuscate"
|
|
|
6
7
|
* If a value is set, the field is rendered in its invalid state.
|
|
7
8
|
*/
|
|
8
9
|
errorMessage?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A ref for the component
|
|
12
|
+
*/
|
|
13
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* Password fields enter a password or other confidential information. Characters are masked as they are typed.
|
|
@@ -14,5 +19,8 @@ export interface PasswordFieldProps extends Omit<PasswordInputProps, "obfuscate"
|
|
|
14
19
|
*
|
|
15
20
|
* _**Do not use** to confirm user actions, such as deleting. Use a checkbox for such flows._
|
|
16
21
|
*/
|
|
17
|
-
export declare const PasswordField:
|
|
22
|
+
export declare const PasswordField: {
|
|
23
|
+
({ id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId, ref, ...rest }: PasswordFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
18
26
|
export {};
|
|
@@ -8,5 +8,8 @@ export interface PasswordInputProps extends BaseInputExposedProps {
|
|
|
8
8
|
*
|
|
9
9
|
* NOTE: If shown with a label, please use the `PasswordField` component instead.
|
|
10
10
|
*/
|
|
11
|
-
export declare const PasswordInput:
|
|
11
|
+
export declare const PasswordInput: {
|
|
12
|
+
({ ref, fieldSize, ...rest }: PasswordInputProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
12
15
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { FormGroupProps } from "../FormGroup/FormGroup";
|
|
2
3
|
import { PhoneInputProps } from "../PhoneInput/PhoneInput";
|
|
3
4
|
type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon" | "name">;
|
|
@@ -6,6 +7,10 @@ export interface PhoneFieldProps extends FormGroupExposedProps, PhoneInputProps
|
|
|
6
7
|
* If a value is set, the field is rendered in its invalid state.
|
|
7
8
|
*/
|
|
8
9
|
errorMessage?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A ref for the component
|
|
12
|
+
*/
|
|
13
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* The PhoneField component is used to enter phone number.
|
|
@@ -21,7 +26,9 @@ export interface PhoneFieldProps extends FormGroupExposedProps, PhoneInputProps
|
|
|
21
26
|
* @param {boolean} [disabled=false] - Whether the component is disabled or not.
|
|
22
27
|
* @param {string} [fieldSize="medium"] - The size of the input field.
|
|
23
28
|
* @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
|
|
24
|
-
* @returns {JSX.Element} - The PhoneField component.
|
|
25
29
|
*/
|
|
26
|
-
export declare const PhoneField:
|
|
30
|
+
export declare const PhoneField: {
|
|
31
|
+
({ label, id, tip, helpText, isInvalid, errorMessage, value, helpAddon, className, defaultValue, dataTestId, name, onBlur, ref, ...rest }: PhoneFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
27
34
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
import { Control, ControllerProps } from "react-hook-form";
|
|
2
3
|
import { PhoneFieldProps } from "../PhoneField/PhoneField";
|
|
3
4
|
export interface PhoneFieldWithControllerProps extends PhoneFieldProps {
|
|
@@ -13,10 +14,16 @@ export interface PhoneFieldWithControllerProps extends PhoneFieldProps {
|
|
|
13
14
|
* Used to overwrite controller props.
|
|
14
15
|
*/
|
|
15
16
|
controllerProps?: Partial<Omit<ControllerProps<any>, "render">>;
|
|
17
|
+
/**
|
|
18
|
+
* A ref for the component
|
|
19
|
+
*/
|
|
20
|
+
ref?: Ref<HTMLInputElement>;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* The PhoneFieldWithController component is a wrapper for the PhoneField component to connect it to react-hook-form.
|
|
19
24
|
*
|
|
20
|
-
* @returns {JSX.Element} - The PhoneFieldWithController component.
|
|
21
25
|
*/
|
|
22
|
-
export declare const PhoneFieldWithController:
|
|
26
|
+
export declare const PhoneFieldWithController: {
|
|
27
|
+
({ control, controllerProps, name, value, ref, ...rest }: PhoneFieldWithControllerProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
@@ -20,7 +20,7 @@ interface CountryCodeSelectProps extends CommonProps {
|
|
|
20
20
|
* The CountryCodeSelect component is used to select a country code for a phone number.
|
|
21
21
|
*
|
|
22
22
|
* @param {CountryCodeSelectProps} props - The props for the CountryCodeSelect component
|
|
23
|
-
* @returns {
|
|
23
|
+
* @returns {ReactElement} CountryCodeSelect component
|
|
24
24
|
*/
|
|
25
25
|
export declare const CountryCodeSelect: ({ excludedCountries, countryCode, isInvalid, onChange, disabled, readOnly, dataTestId, placeholder, onBlur, isClearable, }: CountryCodeSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export {};
|
|
@@ -25,7 +25,9 @@ export interface PhoneInputProps extends BaseInputExposedProps {
|
|
|
25
25
|
* @param {boolean} [disabled=false] - Whether the component is disabled or not.
|
|
26
26
|
* @param {string} [fieldSize="medium"] - The size of the input field.
|
|
27
27
|
* @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
|
|
28
|
-
* @returns {JSX.Element} - The PhoneInput component.
|
|
29
28
|
*/
|
|
30
|
-
export declare const PhoneInput:
|
|
29
|
+
export declare const PhoneInput: {
|
|
30
|
+
({ dataTestId, isInvalid, disabled, value, defaultValue, fieldSize, disableAction, onChange, readOnly, onFocus, onBlur, name, ref, ...rest }: PhoneInputProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
31
33
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
|
-
import
|
|
3
|
-
export interface RadioGroupProps<V extends string | number> extends CommonProps,
|
|
2
|
+
import { ChangeEvent, InputHTMLAttributes, ReactElement, ReactNode } from "react";
|
|
3
|
+
export interface RadioGroupProps<V extends string | number> extends CommonProps, InputHTMLAttributes<HTMLInputElement> {
|
|
4
4
|
/**
|
|
5
5
|
*/
|
|
6
|
-
children:
|
|
6
|
+
children: ReactNode;
|
|
7
7
|
/**
|
|
8
8
|
* The id of the radio group.
|
|
9
9
|
*/
|
|
@@ -11,7 +11,7 @@ export interface RadioGroupProps<V extends string | number> extends CommonProps,
|
|
|
11
11
|
/**
|
|
12
12
|
* onChange handler for the radio group.
|
|
13
13
|
*/
|
|
14
|
-
onChange: (e:
|
|
14
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
15
|
/**
|
|
16
16
|
* The value of the radio group.
|
|
17
17
|
*/
|
|
@@ -48,9 +48,9 @@ export interface RadioGroupProps<V extends string | number> extends CommonProps,
|
|
|
48
48
|
* _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
|
|
49
49
|
*
|
|
50
50
|
* @param {RadioGroupProps} props - The props for the RadioGroup component
|
|
51
|
-
* @returns {
|
|
51
|
+
* @returns {ReactElement} RadioGroup component
|
|
52
52
|
*/
|
|
53
53
|
export declare const RadioGroup: {
|
|
54
|
-
<V extends string | number = string>({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }: RadioGroupProps<V>):
|
|
54
|
+
<V extends string | number = string>({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }: RadioGroupProps<V>): ReactElement;
|
|
55
55
|
displayName: string;
|
|
56
56
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
2
|
import { MappedOmit } from "@trackunit/shared-utils";
|
|
3
|
-
import { InputHTMLAttributes, ReactNode } from "react";
|
|
3
|
+
import { InputHTMLAttributes, ReactElement, ReactNode } from "react";
|
|
4
4
|
export interface RadioItemProps<V extends string | number = string> extends CommonProps, MappedOmit<InputHTMLAttributes<HTMLInputElement>, "prefix"> {
|
|
5
5
|
/**
|
|
6
6
|
* The label of the radio item.
|
|
@@ -23,6 +23,6 @@ export interface RadioItemProps<V extends string | number = string> extends Comm
|
|
|
23
23
|
* The RadioItem component.
|
|
24
24
|
*
|
|
25
25
|
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
26
|
-
* @returns {
|
|
26
|
+
* @returns {ReactElement} RadioItem component
|
|
27
27
|
*/
|
|
28
|
-
export declare const RadioItem: <V extends string | number>({ label, value, dataTestId, className, description, suffix, ...rest }: RadioItemProps<V>) =>
|
|
28
|
+
export declare const RadioItem: <V extends string | number>({ label, value, dataTestId, className, description, suffix, ...rest }: RadioItemProps<V>) => ReactElement;
|
|
@@ -47,6 +47,6 @@ export interface ScheduleProps extends CommonProps {
|
|
|
47
47
|
* Schedule is used to create a time range entries.
|
|
48
48
|
*
|
|
49
49
|
* @param {ScheduleProps} props - The props for the Schedule component
|
|
50
|
-
* @returns {
|
|
50
|
+
* @returns {ReactElement} Schedule component
|
|
51
51
|
*/
|
|
52
52
|
export declare const Schedule: ({ className, dataTestId, schedule, onChange, invalidKeys }: ScheduleProps) => import("react/jsx-runtime").JSX.Element;
|