@tecsinapse/cortex-react 2.1.0-beta.0 → 2.1.0-beta.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.
@@ -1,6 +1,6 @@
1
- import { Country } from './context';
1
+ import { ParsedCountry } from 'react-international-phone';
2
2
  export declare const PhoneInputOption: ({ country, handleSelectCountry, disableClick, }: {
3
- country: Country | null;
4
- handleSelectCountry: (country: Country | null) => void;
3
+ country: ParsedCountry;
4
+ handleSelectCountry: (country: ParsedCountry) => void;
5
5
  disableClick?: boolean;
6
6
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
- export declare const PhoneInputRoot: ({ children, className, defaultDDI, }: {
2
+ import { ParsedCountry, CountryIso2 } from 'react-international-phone';
3
+ export declare const PhoneInputRoot: ({ children, className, defaultCountry, value, onChange, }: {
3
4
  children: ReactNode;
5
+ value?: string;
6
+ onChange?: (data: {
7
+ phone: string;
8
+ inputValue: string;
9
+ country: ParsedCountry;
10
+ }) => void;
4
11
  className?: string;
5
- defaultDDI?: string;
12
+ defaultCountry?: CountryIso2;
6
13
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,4 @@
1
- export declare const PhoneInputTrigger: ({ onChange, disabled, label, value, }: {
2
- onChange?: (value: any) => void;
1
+ export declare const PhoneInputTrigger: ({ disabled, label, }: {
3
2
  disabled?: boolean;
4
3
  label?: string;
5
- value?: string;
6
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,16 +1,15 @@
1
+ import { usePhoneInput } from 'react-international-phone';
1
2
  export interface Country {
2
3
  country: string;
3
4
  iso: string;
4
5
  code: string;
5
6
  }
6
- interface PhoneInputContextProps {
7
+ interface PhoneInputContextProps extends ReturnType<typeof usePhoneInput> {
8
+ isOpen: boolean;
9
+ setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
7
10
  triggerWidth?: number;
8
- setTriggerWidth?: (width: number) => void;
9
- isOpen?: boolean;
10
- setIsOpen?: (isOpen: boolean) => void;
11
- country?: Country | null;
12
- setCountry?: (country: Country | null) => void;
11
+ setTriggerWidth?: React.Dispatch<React.SetStateAction<number | undefined>>;
13
12
  }
14
- export declare const PhoneInputContext: import("react").Context<PhoneInputContextProps>;
15
- export declare const usePhoneInput: () => PhoneInputContextProps;
13
+ export declare const PhoneInputContext: import("react").Context<PhoneInputContextProps | null>;
14
+ export declare const usePhoneContext: () => PhoneInputContextProps;
16
15
  export {};
@@ -1,21 +1,25 @@
1
1
  export declare const PhoneInput: {
2
- Root: ({ children, className, defaultDDI, }: {
2
+ Root: ({ children, className, defaultCountry, value, onChange, }: {
3
3
  children: import("react").ReactNode;
4
+ value?: string;
5
+ onChange?: (data: {
6
+ phone: string;
7
+ inputValue: string;
8
+ country: import("react-international-phone").ParsedCountry;
9
+ }) => void;
4
10
  className?: string;
5
- defaultDDI?: string;
11
+ defaultCountry?: import("react-international-phone").CountryIso2;
6
12
  }) => import("react/jsx-runtime").JSX.Element;
7
13
  Popover: ({ children }: {
8
14
  children: import("react").ReactNode;
9
15
  }) => import("react/jsx-runtime").JSX.Element;
10
- Trigger: ({ onChange, disabled, label, value, }: {
11
- onChange?: (value: any) => void;
16
+ Trigger: ({ disabled, label, }: {
12
17
  disabled?: boolean;
13
18
  label?: string;
14
- value?: string;
15
19
  }) => import("react/jsx-runtime").JSX.Element;
16
20
  Option: ({ country, handleSelectCountry, disableClick, }: {
17
- country: import("./context").Country | null;
18
- handleSelectCountry: (country: import("./context").Country | null) => void;
21
+ country: import("react-international-phone").ParsedCountry;
22
+ handleSelectCountry: (country: import("react-international-phone").ParsedCountry) => void;
19
23
  disableClick?: boolean;
20
24
  }) => import("react/jsx-runtime").JSX.Element;
21
25
  Options: () => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0-beta.1",
4
4
  "description": "React components based in @tecsinapse/cortex-core",
5
5
  "license": "MIT",
6
6
  "main": "dist/esm/index.js",
@@ -25,10 +25,10 @@
25
25
  "currency.js": "2.0.4",
26
26
  "embla-carousel-autoplay": "^8.0.0",
27
27
  "embla-carousel-react": "^8.6.0",
28
- "libphonenumber-js": "^1.12.31",
29
28
  "react-aria": "3.38.1",
30
29
  "react-dropzone": "14.3.8",
31
30
  "react-imask": "7.6.1",
31
+ "react-international-phone": "^4.6.1",
32
32
  "react-spring": "9.7.5",
33
33
  "react-stately": "3.36.1",
34
34
  "sonner": "1.7.3",
@@ -49,5 +49,5 @@
49
49
  "react-icons": ">=5.2.0",
50
50
  "tailwindcss": "^4.1.16"
51
51
  },
52
- "gitHead": "574735ac6e5adc45d41ba293ae2ae4f4b929e0c5"
52
+ "gitHead": "13492afebcc2d6530a30969977f7a4bc301521cf"
53
53
  }
@@ -1 +0,0 @@
1
- export declare const PhoneInput: () => import("react/jsx-runtime").JSX.Element;