@trackunit/react-components 0.1.65-alpha-0b53b6cf53.0 → 0.1.65

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/package.json CHANGED
@@ -1,27 +1,28 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.65-alpha-0b53b6cf53.0",
3
+ "version": "0.1.65",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
7
- "@trackunit/css-core": "0.0.75-alpha-0b53b6cf53.0",
7
+ "@trackunit/css-core": "0.0.74",
8
8
  "@trackunit/tailwind-styled-components": "0.0.54",
9
+ "@trackunit/ui-design-tokens": "0.0.60",
9
10
  "react": "18.2.0",
10
- "@trackunit/ui-design-tokens": "0.0.61-alpha-0b53b6cf53.0",
11
11
  "react-use": "17.4.0",
12
12
  "date-fns": "2.29.3",
13
13
  "react-day-picker": "8.3.7",
14
14
  "@floating-ui/react": "0.15.1",
15
- "@trackunit/ui-icons": "0.0.61-alpha-0b53b6cf53.0",
15
+ "@trackunit/ui-icons": "0.0.60",
16
16
  "react-browser-hooks": "2.2.4",
17
17
  "react-useportal": "1.0.17",
18
+ "libphonenumber-js": "1.10.24",
18
19
  "react-router-dom": "6.4.5",
19
20
  "react-helmet-async": "1.3.0",
20
21
  "react-select": "5.7.0",
21
22
  "react-dom": "18.2.0"
22
23
  },
23
24
  "module": "./index.js",
24
- "main": "./index.cjs",
25
+ "main": "./index.js",
25
26
  "type": "module",
26
27
  "types": "./src/index.d.ts",
27
28
  "peerDependencies": {}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ /// <reference types="react" />
2
2
  import { CommonProps } from "../../common";
3
3
  import { ButtonCommonProps } from "../buttons";
4
4
  type ActionType = "PHONE_NUMBER" | "WEB_ADDRESS" | "EMAIL";
@@ -12,10 +12,6 @@ interface ActionButtonProps extends ButtonCommonProps, CommonProps {
12
12
  * The value to be passed into the button.
13
13
  */
14
14
  value?: string | null;
15
- /**
16
- * The onClick event.
17
- */
18
- onClick?: (e: React.MouseEvent) => void;
19
15
  /**
20
16
  * The size of the icon.
21
17
  */
@@ -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;
@@ -1,20 +1,25 @@
1
- import * as React from "react";
2
- import { CommonProps } from "../../common";
1
+ /// <reference types="react" />
3
2
  import { BaseInputProps } from "../BaseInput";
4
- export interface PhoneInputProps extends BaseInputProps, CommonProps {
3
+ type BaseInputExposedProps = Omit<BaseInputProps, "actions">;
4
+ export interface PhoneInputProps extends BaseInputExposedProps {
5
5
  /**
6
- * A flag to disable the phone button.
6
+ * To disable the action button.
7
+ *
8
+ * @default false
9
+ * @memberof PhoneInputProps
10
+ * @example
11
+ * <PhoneInput disableAction />
7
12
  */
8
13
  disableAction?: boolean;
9
14
  }
10
15
  /**
11
- * A Phone Input component is used for input of the type tel.
16
+ * A component for inputting phone numbers with an optional action button for initiating a phone call.
12
17
  *
13
- * It has an ActionButton which sends an phone call to the specified number using "tel:" link.
14
- *
15
- * Extends props of BaseInput.
16
- *
17
- * A reference to the input element is provided as the `ref` prop.
18
- * For specific input types make sure to use the corresponding input component.
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.
19
23
  */
20
- export declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<HTMLInputElement>>;
24
+ export declare const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputProps & import("react").RefAttributes<HTMLInputElement>>;
25
+ export {};
@@ -26,6 +26,7 @@ export * from "./NumberField/NumberField";
26
26
  export * from "./NumberInput/NumberInput";
27
27
  export * from "./PageHeader";
28
28
  export * from "./Pagination/Pagination";
29
+ export * from "./PhoneField/PhoneField";
29
30
  export * from "./PhoneInput";
30
31
  export * from "./Popover";
31
32
  export * from "./Popover/Popover";