@trackunit/react-form-components 0.0.1

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.
Files changed (96) hide show
  1. package/README.md +24 -0
  2. package/index.cjs +1274 -0
  3. package/index.css +259 -0
  4. package/index.js +1210 -0
  5. package/package.json +21 -0
  6. package/src/components/ActionButton/ActionButton.d.ts +26 -0
  7. package/src/components/ActionButton/index.d.ts +1 -0
  8. package/src/components/BaseInput/BaseInput.d.ts +62 -0
  9. package/src/components/BaseInput/index.d.ts +1 -0
  10. package/src/components/Checkbox/CheckIcon.d.ts +12 -0
  11. package/src/components/Checkbox/Checkbox.d.ts +48 -0
  12. package/src/components/Checkbox/IndeterminateIcon.d.ts +10 -0
  13. package/src/components/Checkbox/index.d.ts +1 -0
  14. package/src/components/DateField/DateField.d.ts +19 -0
  15. package/src/components/DateInput/DateInput.d.ts +28 -0
  16. package/src/components/DropZone/DropZone.d.ts +34 -0
  17. package/src/components/EmailField/EmailField.d.ts +17 -0
  18. package/src/components/EmailInput/EmailInput.d.ts +13 -0
  19. package/src/components/EmailInput/index.d.ts +1 -0
  20. package/src/components/FormGroup/FormGroup.d.ts +39 -0
  21. package/src/components/Label/Label.d.ts +34 -0
  22. package/src/components/Label/index.d.ts +1 -0
  23. package/src/components/NumberField/NumberField.d.ts +19 -0
  24. package/src/components/NumberInput/NumberInput.d.ts +12 -0
  25. package/src/components/PhoneField/PhoneField.d.ts +28 -0
  26. package/src/components/PhoneInput/CountryCodeSelect.d.ts +16 -0
  27. package/src/components/PhoneInput/CountryCodes.d.ts +5 -0
  28. package/src/components/PhoneInput/PhoneInput.d.ts +25 -0
  29. package/src/components/PhoneInput/index.d.ts +1 -0
  30. package/src/components/RadioGroup/RadioGroup.d.ts +57 -0
  31. package/src/components/RadioGroup/RadioGroupContext.d.ts +11 -0
  32. package/src/components/RadioGroup/RadioItem.d.ts +23 -0
  33. package/src/components/RadioGroup/index.d.ts +2 -0
  34. package/src/components/Search/Search.d.ts +62 -0
  35. package/src/components/Search/index.d.ts +1 -0
  36. package/src/components/Select/CreatableSelect.d.ts +38 -0
  37. package/src/components/Select/FieldContainer.d.ts +20 -0
  38. package/src/components/Select/Select.d.ts +18 -0
  39. package/src/components/Select/SelectMenuItem/SelectMenuItem.d.ts +49 -0
  40. package/src/components/Select/TagWithWidth.d.ts +17 -0
  41. package/src/components/Select/TagsContainer.d.ts +45 -0
  42. package/src/components/Select/index.d.ts +7 -0
  43. package/src/components/Select/shared.d.ts +15 -0
  44. package/src/components/Select/useCustomComponents.d.ts +19 -0
  45. package/src/components/Select/useCustomStyles.d.ts +14 -0
  46. package/src/components/Select/useSelect.d.ts +143 -0
  47. package/src/components/TextArea/TextArea.d.ts +30 -0
  48. package/src/components/TextArea/index.d.ts +1 -0
  49. package/src/components/TextAreaField/TextAreaField.d.ts +18 -0
  50. package/src/components/TextAreaField/index.d.ts +1 -0
  51. package/src/components/TextField/TextField.d.ts +24 -0
  52. package/src/components/TextField/TextLenghtIndicator.d.ts +19 -0
  53. package/src/components/TextField/index.d.ts +1 -0
  54. package/src/components/TextInput/TextInput.d.ts +12 -0
  55. package/src/components/Toggle/Toggle.d.ts +57 -0
  56. package/src/components/Toggle/index.d.ts +1 -0
  57. package/src/components/UploadField/UploadField.d.ts +15 -0
  58. package/src/components/UploadInput/UploadInput.d.ts +33 -0
  59. package/src/index.d.ts +24 -0
  60. package/src/test-utils/hooks.d.ts +4 -0
  61. package/src/test-utils/test-utils.d.ts +5 -0
  62. package/src/translation.d.ts +34 -0
  63. package/translation.cjs +7 -0
  64. package/translation.js +5 -0
  65. package/translation10.cjs +7 -0
  66. package/translation10.js +5 -0
  67. package/translation11.cjs +7 -0
  68. package/translation11.js +5 -0
  69. package/translation12.cjs +7 -0
  70. package/translation12.js +5 -0
  71. package/translation13.cjs +7 -0
  72. package/translation13.js +5 -0
  73. package/translation14.cjs +7 -0
  74. package/translation14.js +5 -0
  75. package/translation15.cjs +7 -0
  76. package/translation15.js +5 -0
  77. package/translation16.cjs +7 -0
  78. package/translation16.js +5 -0
  79. package/translation17.cjs +7 -0
  80. package/translation17.js +5 -0
  81. package/translation2.cjs +7 -0
  82. package/translation2.js +5 -0
  83. package/translation3.cjs +7 -0
  84. package/translation3.js +5 -0
  85. package/translation4.cjs +7 -0
  86. package/translation4.js +5 -0
  87. package/translation5.cjs +7 -0
  88. package/translation5.js +5 -0
  89. package/translation6.cjs +7 -0
  90. package/translation6.js +5 -0
  91. package/translation7.cjs +7 -0
  92. package/translation7.js +5 -0
  93. package/translation8.cjs +7 -0
  94. package/translation8.js +5 -0
  95. package/translation9.cjs +7 -0
  96. package/translation9.js +5 -0
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@trackunit/react-form-components",
3
+ "version": "0.0.1",
4
+ "repository": "https://github.com/Trackunit/manager",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "dependencies": {
7
+ "@trackunit/react-components": "0.1.77",
8
+ "@trackunit/tailwind-styled-components": "0.0.55",
9
+ "react": "18.2.0",
10
+ "uuid": "8.3.2",
11
+ "date-fns": "2.29.3",
12
+ "libphonenumber-js": "1.10.24",
13
+ "react-select": "5.7.0",
14
+ "@trackunit/i18n-library-translation": "0.0.37"
15
+ },
16
+ "module": "./index.js",
17
+ "main": "./index.cjs",
18
+ "type": "module",
19
+ "types": "./src/index.d.ts",
20
+ "peerDependencies": {}
21
+ }
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { ButtonCommonProps, CommonProps } from "@trackunit/react-components";
3
+ type ActionType = "PHONE_NUMBER" | "WEB_ADDRESS" | "EMAIL";
4
+ type FieldSize = "small" | "medium";
5
+ interface ActionButtonProps extends ButtonCommonProps, CommonProps {
6
+ /**
7
+ * The type of action performed when clicking the button.
8
+ */
9
+ type: ActionType;
10
+ /**
11
+ * The value to be passed into the button.
12
+ */
13
+ value?: string | null;
14
+ /**
15
+ * The size of the icon.
16
+ */
17
+ iconSize?: FieldSize;
18
+ }
19
+ /**
20
+ * The ActionButton component is a wrapper over IconButton to perform an action when the onClick event is triggered.
21
+ *
22
+ * @param {ActionButtonProps} props - The props for the ActionButton component
23
+ * @returns {JSX.Element} ActionButton component
24
+ */
25
+ export declare const ActionButton: ({ type, value, dataTestId, iconSize, disabled }: ActionButtonProps) => JSX.Element;
26
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./ActionButton";
@@ -0,0 +1,62 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
3
+ type FilteredInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "prefix" | "suffix">;
4
+ type FieldSize = "small" | "medium";
5
+ export interface BaseInputProps extends FilteredInputProps, CommonProps {
6
+ /**
7
+ * A React element to render before the text in the input.
8
+ * This is typically used to render an icon.
9
+ * For elements other than icons, please consider using the addonBefore prop.
10
+ */
11
+ prefix?: React.ReactNode;
12
+ /**
13
+ * A React element to render after the text in the input.
14
+ * This is typically used to render an icon.
15
+ * For other elements than icons, please consider using the addonAfter prop.
16
+ */
17
+ suffix?: React.ReactNode;
18
+ /**
19
+ * A React element to render in a separate container before the text in the input.
20
+ * This is typically used to render text.
21
+ * For icons, please consider using the prefix prop.
22
+ */
23
+ addonBefore?: React.ReactNode;
24
+ /**
25
+ * A React element to render in a separate container after the text in the input.
26
+ * This is typically used to render text.
27
+ * For icons, please consider using the suffix prop.
28
+ */
29
+ addonAfter?: React.ReactNode;
30
+ /**
31
+ * A ReactNode to render at the end of the input field before the addonAfter.
32
+ * Mainly meant for the icon button actions for special input types.
33
+ */
34
+ actions?: React.ReactNode;
35
+ /**
36
+ * The size of the input.
37
+ * Default == 40px, Small == 32px.
38
+ */
39
+ fieldSize?: FieldSize;
40
+ /**
41
+ * If true the field is rendered in its invalid state.
42
+ */
43
+ isInvalid?: boolean;
44
+ /**
45
+ * The Placeholder text for the input.
46
+ */
47
+ placeholder?: string;
48
+ /**
49
+ * A flag to disable interaction with input for example if you want to use input as a child of higher component
50
+ */
51
+ nonInteractive?: boolean;
52
+ }
53
+ /**
54
+ * A base input component that can be used for text inputs, password inputs, etc.
55
+ * A reference to the input element is provided as the `ref` prop.
56
+ * Extends props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
57
+ *
58
+ * For specific input types make sure to use the corresponding input component.
59
+ * This is a base used by our other input components such as TextInput, NumberInput, PasswordInput, etc.
60
+ */
61
+ export declare const BaseInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HTMLInputElement>>;
62
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./BaseInput";
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { CommonProps } from "@trackunit/react-components";
3
+ interface CheckIconProps extends CommonProps {
4
+ }
5
+ /**
6
+ * The CheckIcon component is used by the checkbox to display the checked state.
7
+ *
8
+ * @param {CheckIconProps} props - The props for the CheckIcon component
9
+ * @returns {JSX.Element} CheckIcon component
10
+ */
11
+ export declare const CheckIcon: ({ className, dataTestId }: CheckIconProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,48 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
3
+ export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
4
+ /**
5
+ * A string element to be displayed as a label
6
+ */
7
+ label?: React.ReactNode;
8
+ /**
9
+ * Children to be displayed
10
+ */
11
+ children?: React.ReactNode;
12
+ /**
13
+ * An boolean flag to set checkbox to checked state
14
+ */
15
+ checked?: boolean;
16
+ /**
17
+ * An boolean flag to set checkbox to disabled state
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * An boolean flag to set invalid mode
22
+ * can be used for indicating errors
23
+ */
24
+ isInvalid?: boolean;
25
+ /**
26
+ * An boolean flag to set checkbox to readonly mode
27
+ */
28
+ readOnly?: boolean;
29
+ /**
30
+ * An boolean flag to set checkbox to intermediate state
31
+ */
32
+ indeterminate?: boolean;
33
+ }
34
+ /**
35
+ * Checkboxes are used when there are multiple items to select in a list. Users can select zero, one, or any number of items.
36
+ *
37
+ * Checkboxes are used for multiple choices, not for mutually exclusive choices. Each checkbox works independently from other checkboxes in the list, therefore checking an additional box does not affect any other selections.
38
+ *
39
+ * _**Do use** checkboxes to allow selection in a form, for filtering, terms and conditions to indicate agreement, and bulk actions in lists or tables._
40
+ *
41
+ * _**Do not use** checkboxes if the user can only select one option from a list, radio buttons should be used instead of checkboxes._
42
+ *
43
+ * @description A reference to the input element is provided as the `ref` prop.
44
+ * @augments props from [React.InputHTMLAttributes](https://reactjs.org/docs/dom-elements.html#input)
45
+ * @param {CheckboxProps} props - The props for the Checkbox component
46
+ * @returns {JSX.Element} Checkbox component
47
+ */
48
+ export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * The IndeterminateIcon component is used by the checkbox to display the Indeterminate state.
4
+ *
5
+ * @param {IndeterminateIconProps} props - The props for the IndeterminateIcon component
6
+ * @returns {JSX.Element} IndeterminateIcon component
7
+ */
8
+ export declare const IndeterminateIcon: ({ className }: {
9
+ className?: string | undefined;
10
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Checkbox";
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { DateInputProps } from "../DateInput/DateInput";
3
+ import { FormGroupProps } from "../FormGroup/FormGroup";
4
+ 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
+ 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,34 @@
1
+ /// <reference types="react" />
2
+ import { CommonProps, Size } from "@trackunit/react-components";
3
+ import { BaseInputProps } from "../BaseInput";
4
+ type BaseInputExposedProps = Omit<BaseInputProps, "type" | "suffix" | "prefix" | "addonAfter" | "addonBefore" | "actions" | "placeholder" | "fieldSize" | "size" | "nonInteractive">;
5
+ export interface DropZoneProps extends BaseInputExposedProps, CommonProps {
6
+ /**
7
+ * A string to set the label in Drop Zone.
8
+ */
9
+ label: string;
10
+ /**
11
+ * A flag to disable the drop zone.
12
+ */
13
+ disabled?: boolean;
14
+ /**
15
+ * The size of the dropZone
16
+ * small - padding:8px, medium - padding:16px large - padding:32px
17
+ */
18
+ size?: Size;
19
+ /**
20
+ * The files dropped can be accessed within filesSelected
21
+ *
22
+ * @param file
23
+ * @returns
24
+ */
25
+ filesSelected: (file: FileList) => void;
26
+ }
27
+ /**
28
+ * The Drop Zone can be used to drag and drop files
29
+ *
30
+ * @param {DropZoneProps} props - The props for the DropZone component
31
+ * @returns {JSX.Element} DropZone component
32
+ */
33
+ export declare const DropZone: ({ className, dataTestId, filesSelected, label, size, isInvalid, disabled, ...rest }: DropZoneProps) => JSX.Element;
34
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputProps } from "../BaseInput";
3
+ import { FormGroupProps } from "../FormGroup/FormGroup";
4
+ type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
5
+ export interface EmailFieldProps extends FormGroupExposedProps, BaseInputProps {
6
+ /**
7
+ * If a value is set, the field is rendered in its invalid state.
8
+ */
9
+ errorMessage?: string;
10
+ }
11
+ /**
12
+ * The EmailField component is used to enter email.
13
+ * EmailField validates that user enters a valid email address.
14
+ *
15
+ */
16
+ export declare const EmailField: import("react").ForwardRefExoticComponent<EmailFieldProps & import("react").RefAttributes<HTMLInputElement>>;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { BaseInputProps } from "../BaseInput";
3
+ /**
4
+ * A Email Input component is used for input of the type Email.
5
+ *
6
+ * It has an ActionButton which sends an email to the specified address using "mailto:" link.
7
+ *
8
+ * Extends props of BaseInput.
9
+ *
10
+ * A reference to the input element is provided as the `ref` prop.
11
+ * For specific input types make sure to use the corresponding input component.
12
+ */
13
+ export declare const EmailInput: React.ForwardRefExoticComponent<BaseInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1 @@
1
+ export * from "./EmailInput";
@@ -0,0 +1,39 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
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
+ htmlFor?: string;
13
+ /**
14
+ * A string to display under the input element to help the user understand the input.
15
+ */
16
+ helpText?: string | null;
17
+ /**
18
+ * An addon element to render to the right under the input element.
19
+ * Used for displaying maxLength etc.
20
+ */
21
+ helpAddon?: string | React.ReactNode;
22
+ /**
23
+ * If true the input is rendered in its invalid state.
24
+ */
25
+ isInvalid?: boolean;
26
+ /**
27
+ * If true interactions are disabled
28
+ */
29
+ disabled?: boolean;
30
+ children?: React.ReactNode;
31
+ }
32
+ /**
33
+ * The FormGroup component should be used to wrap any Input element that needs a label.
34
+ * Besides a label the component supplies an optional Tip, HelpText and HelpAddon support.
35
+ *
36
+ * @param {FormGroupProps} props - The props for the FormGroup component
37
+ * @returns {JSX.Element} FormGroup component
38
+ */
39
+ export declare const FormGroup: ({ isInvalid, helpText, helpAddon, tip, className, dataTestId, label, htmlFor, children, disabled, }: FormGroupProps) => JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
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,19 @@
1
+ /// <reference types="react" />
2
+ import { FormGroupProps } from "../FormGroup/FormGroup";
3
+ import { NumberInputProps } from "../NumberInput/NumberInput";
4
+ 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
+ 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 {};
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { FormGroupProps } from "../FormGroup/FormGroup";
3
+ import { PhoneInputProps } from "../PhoneInput/PhoneInput";
4
+ type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
5
+ export interface PhoneFieldProps extends FormGroupExposedProps, PhoneInputProps {
6
+ /**
7
+ * If a value is set, the field is rendered in its invalid state.
8
+ */
9
+ errorMessage?: string;
10
+ }
11
+ /**
12
+ * The PhoneField component is used to enter phone number.
13
+ * It is a wrapper around the PhoneInput component and the FormGroup component.
14
+ * It is used to render a phone number field with a label, a tip, a help text, a help addon and an error message.
15
+ *
16
+ * @param {string} [label] - The label for the component.
17
+ * @param {string} [tip] - The tip for the component.
18
+ * @param {string} [helpText] - The help text for the component.
19
+ * @param {string} [helpAddon] - The help addon for the component.
20
+ * @param {string} [errorMessage] - The error message for the component.
21
+ * @param {string} [defaultValue] - The default value for the component.
22
+ * @param {boolean} [disabled=false] - Whether the component is disabled or not.
23
+ * @param {string} [fieldSize="medium"] - The size of the input field.
24
+ * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
25
+ * @returns {JSX.Element} - The PhoneField component.
26
+ */
27
+ export declare const PhoneField: import("react").ForwardRefExoticComponent<PhoneFieldProps & import("react").RefAttributes<HTMLInputElement>>;
28
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Dispatch, SetStateAction } from "react";
2
+ import { CountryCode } from "./CountryCodes";
3
+ interface CountryCodeSelectProps {
4
+ excludedCountries?: CountryCode;
5
+ countryCode?: string;
6
+ setCountryCode: Dispatch<SetStateAction<string | undefined>>;
7
+ isInvalid?: boolean;
8
+ }
9
+ /**
10
+ * The CountryCodeSelect component is used to select a country code for a phone number.
11
+ *
12
+ * @param {CountryCodeSelectProps} props - The props for the CountryCodeSelect component
13
+ * @returns {JSX.Element} CountryCodeSelect component
14
+ */
15
+ export declare const CountryCodeSelect: ({ excludedCountries, countryCode, isInvalid, setCountryCode, }: CountryCodeSelectProps) => JSX.Element;
16
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const countryCodes: {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export type CountryCode = typeof countryCodes;
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputProps } from "../BaseInput";
3
+ type BaseInputExposedProps = Omit<BaseInputProps, "actions">;
4
+ export interface PhoneInputProps extends BaseInputExposedProps {
5
+ /**
6
+ * To disable the action button.
7
+ *
8
+ * @default false
9
+ * @memberof PhoneInputProps
10
+ * @example
11
+ * <PhoneInput disableAction />
12
+ */
13
+ disableAction?: boolean;
14
+ }
15
+ /**
16
+ * A component for inputting phone numbers with an optional action button for initiating a phone call.
17
+ *
18
+ * @param {string} [dataTestId] - The data test ID for the component.
19
+ * @param {boolean} [disabled=false] - Whether the component is disabled or not.
20
+ * @param {string} [fieldSize="medium"] - The size of the input field.
21
+ * @param {boolean} [disableAction=false] - Whether the action button is disabled or not.
22
+ * @returns {JSX.Element} - The PhoneInput component.
23
+ */
24
+ export declare const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputProps & import("react").RefAttributes<HTMLInputElement>>;
25
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./PhoneInput";
@@ -0,0 +1,57 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
3
+ import "./RadioGroup.css";
4
+ export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
5
+ /**
6
+ */
7
+ children: React.ReactNode;
8
+ /**
9
+ * The id of the radio group.
10
+ */
11
+ id: string;
12
+ /**
13
+ * onChange handler for the radio group.
14
+ */
15
+ onChange: (e: React.FormEvent<HTMLInputElement>) => void;
16
+ /**
17
+ * The value of the radio group.
18
+ */
19
+ value: string | number;
20
+ /**
21
+ * The name of the radio group.
22
+ */
23
+ name?: string;
24
+ /**
25
+ * The label of the radio group.
26
+ */
27
+ label?: string;
28
+ /**
29
+ * Whether the radiogroup is inline or not.
30
+ */
31
+ inline?: boolean;
32
+ /**
33
+ * Whether the radio group is disabled or not.
34
+ */
35
+ disabled?: boolean;
36
+ /**
37
+ * A boolean flag to set invalid mode
38
+ * can be used for indicating errors
39
+ */
40
+ isInvalid?: boolean;
41
+ }
42
+ /**
43
+ * Use radio buttons when you have a group of mutually exclusive choices and only one selection from the group is allowed.
44
+ *
45
+ * Radio buttons are used for mutually exclusive choices, not for multiple choices. Only one radio button can be selected at a time. When a user chooses a new item, the previous choice is automatically deselected.
46
+ *
47
+ * _**Do use** Radio buttons in forms, settings, or selections in a list._
48
+ *
49
+ * _**Do not use** Radio buttons if a user can select many option from a list, use checkboxes instead of radio buttons._
50
+ *
51
+ * @param {RadioGroupProps} props - The props for the RadioGroup component
52
+ * @returns {JSX.Element} RadioGroup component
53
+ */
54
+ export declare const RadioGroup: {
55
+ ({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }: RadioGroupProps): JSX.Element;
56
+ displayName: string;
57
+ };
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ interface RadioGroupContextProps {
3
+ id: string;
4
+ name: string;
5
+ value: string | number;
6
+ disabled?: boolean;
7
+ isInvalid?: boolean;
8
+ onChange: (e: React.FormEvent<HTMLInputElement>) => void;
9
+ }
10
+ export declare const RadioGroupContext: React.Context<RadioGroupContextProps | null>;
11
+ export {};
@@ -0,0 +1,23 @@
1
+ import { CommonProps } from "@trackunit/react-components";
2
+ import * as React from "react";
3
+ export interface RadioItemProps extends CommonProps {
4
+ /**
5
+ * The label of the radio item.
6
+ */
7
+ label: React.ReactNode;
8
+ /**
9
+ * The value of the radio item.
10
+ */
11
+ value: string | number;
12
+ /**
13
+ * The description of the radio item.
14
+ */
15
+ description?: string;
16
+ }
17
+ /**
18
+ * The RadioItem component.
19
+ *
20
+ * @param {RadioItemProps} props - The props for the RadioItem component
21
+ * @returns {JSX.Element} RadioItem component
22
+ */
23
+ export declare const RadioItem: ({ label, value, dataTestId, className, description }: RadioItemProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from "./RadioGroup";
2
+ export * from "./RadioItem";