intl-tel-input 23.0.5 → 23.0.6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-tel-input",
3
- "version": "23.0.5",
3
+ "version": "23.0.6",
4
4
  "description": "A JavaScript plugin for entering and validating international telephone numbers",
5
5
  "keywords": [
6
6
  "international",
@@ -56,8 +56,8 @@
56
56
  "jquery": "^3.1.1",
57
57
  "load-grunt-config": "^4.0.1",
58
58
  "prettier": "^3.2.5",
59
- "react": "^18.2.0",
60
- "react-dom": "^18.2.0",
59
+ "react": "^18.3.1",
60
+ "react-dom": "^18.3.1",
61
61
  "region-flags": "https://github.com/fonttools/region-flags/archive/refs/tags/1.2.1.tar.gz",
62
62
  "sass": "^1.74.1",
63
63
  "time-grunt": "^2.0.0",
@@ -2773,14 +2773,14 @@ var intlTelInput = Object.assign(
2773
2773
  //* A map from instance ID to instance object.
2774
2774
  instances: {},
2775
2775
  loadUtils,
2776
- version: "23.0.5"
2776
+ version: "23.0.6"
2777
2777
  }
2778
2778
  );
2779
2779
  var intl_tel_input_default = intlTelInput;
2780
2780
 
2781
2781
  // react/src/intl-tel-input/react.tsx
2782
2782
  var import_react = __toESM(require("react"));
2783
- var IntlTelInput = ({
2783
+ var IntlTelInput = (0, import_react.forwardRef)(function IntlTelInput2({
2784
2784
  initialValue = "",
2785
2785
  onChangeNumber = () => {
2786
2786
  },
@@ -2793,9 +2793,13 @@ var IntlTelInput = ({
2793
2793
  usePreciseValidation = false,
2794
2794
  initOptions = {},
2795
2795
  inputProps = {}
2796
- }) => {
2796
+ }, ref) {
2797
2797
  const inputRef = (0, import_react.useRef)(null);
2798
2798
  const itiRef = (0, import_react.useRef)(null);
2799
+ (0, import_react.useImperativeHandle)(ref, () => ({
2800
+ getInstance: () => itiRef.current,
2801
+ getInput: () => inputRef.current
2802
+ }));
2799
2803
  const update = () => {
2800
2804
  const num = itiRef.current?.getNumber() || "";
2801
2805
  const countryIso = itiRef.current?.getSelectedCountryData().iso2 || "";
@@ -2837,5 +2841,5 @@ var IntlTelInput = ({
2837
2841
  ...inputProps
2838
2842
  }
2839
2843
  );
2840
- };
2844
+ });
2841
2845
  var react_default = IntlTelInput;
@@ -976,7 +976,7 @@ declare module "intl-tel-input" {
976
976
  declare module "intl-tel-input/react" {
977
977
  import { SomeOptions } from "intl-tel-input";
978
978
  import React from "react";
979
- const IntlTelInput: ({ initialValue, onChangeNumber, onChangeCountry, onChangeValidity, onChangeErrorCode, usePreciseValidation, initOptions, inputProps, }: {
979
+ type ItiProps = {
980
980
  initialValue?: string;
981
981
  onChangeNumber?: (number: string) => void;
982
982
  onChangeCountry?: (country: string) => void;
@@ -985,7 +985,8 @@ declare module "intl-tel-input/react" {
985
985
  usePreciseValidation?: boolean;
986
986
  initOptions?: SomeOptions;
987
987
  inputProps?: object;
988
- }) => React.JSX.Element;
988
+ };
989
+ const IntlTelInput: React.ForwardRefExoticComponent<ItiProps & React.RefAttributes<unknown>>;
989
990
  export default IntlTelInput;
990
991
  }
991
992
  declare module "intl-tel-input/utils-compiled" {
@@ -999,7 +1000,7 @@ declare module "intl-tel-input/intlTelInputWithUtils" {
999
1000
  declare module "intl-tel-input/reactWithUtils" {
1000
1001
  import { SomeOptions } from "intl-tel-input";
1001
1002
  import React from "react";
1002
- const IntlTelInput: ({ initialValue, onChangeNumber, onChangeCountry, onChangeValidity, onChangeErrorCode, usePreciseValidation, initOptions, inputProps, }: {
1003
+ type ItiProps = {
1003
1004
  initialValue?: string;
1004
1005
  onChangeNumber?: (number: string) => void;
1005
1006
  onChangeCountry?: (country: string) => void;
@@ -1008,6 +1009,7 @@ declare module "intl-tel-input/reactWithUtils" {
1008
1009
  usePreciseValidation?: boolean;
1009
1010
  initOptions?: SomeOptions;
1010
1011
  inputProps?: object;
1011
- }) => React.JSX.Element;
1012
+ };
1013
+ const IntlTelInput: React.ForwardRefExoticComponent<ItiProps & React.RefAttributes<unknown>>;
1012
1014
  export default IntlTelInput;
1013
1015
  }
@@ -2738,14 +2738,14 @@ var intlTelInput = Object.assign(
2738
2738
  //* A map from instance ID to instance object.
2739
2739
  instances: {},
2740
2740
  loadUtils,
2741
- version: "23.0.5"
2741
+ version: "23.0.6"
2742
2742
  }
2743
2743
  );
2744
2744
  var intl_tel_input_default = intlTelInput;
2745
2745
 
2746
2746
  // react/src/intl-tel-input/react.tsx
2747
- import React, { useRef, useEffect } from "react";
2748
- var IntlTelInput = ({
2747
+ import React, { useRef, useEffect, forwardRef, useImperativeHandle } from "react";
2748
+ var IntlTelInput = forwardRef(function IntlTelInput2({
2749
2749
  initialValue = "",
2750
2750
  onChangeNumber = () => {
2751
2751
  },
@@ -2758,9 +2758,13 @@ var IntlTelInput = ({
2758
2758
  usePreciseValidation = false,
2759
2759
  initOptions = {},
2760
2760
  inputProps = {}
2761
- }) => {
2761
+ }, ref) {
2762
2762
  const inputRef = useRef(null);
2763
2763
  const itiRef = useRef(null);
2764
+ useImperativeHandle(ref, () => ({
2765
+ getInstance: () => itiRef.current,
2766
+ getInput: () => inputRef.current
2767
+ }));
2764
2768
  const update = () => {
2765
2769
  const num = itiRef.current?.getNumber() || "";
2766
2770
  const countryIso = itiRef.current?.getSelectedCountryData().iso2 || "";
@@ -2802,7 +2806,7 @@ var IntlTelInput = ({
2802
2806
  ...inputProps
2803
2807
  }
2804
2808
  );
2805
- };
2809
+ });
2806
2810
  var react_default = IntlTelInput;
2807
2811
  export {
2808
2812
  react_default as default