intl-tel-input 19.2.6 → 19.2.8

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.
@@ -5,9 +5,7 @@ import React from 'react';
5
5
  import { createRoot } from 'react-dom/client';
6
6
  import IntlTelInput from '../build/IntlTelInput.cjs';
7
7
 
8
- const container = document.getElementById("app");
9
- const root = createRoot(container);
10
- root.render(
8
+ const App = () => (
11
9
  <IntlTelInput
12
10
  initOptions={{
13
11
  initialCountry: "us",
@@ -15,4 +13,8 @@ root.render(
15
13
  utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@19.1.0/build/js/utils.js",
16
14
  }}
17
15
  />
18
- );
16
+ );
17
+
18
+ const container = document.getElementById("app");
19
+ const root = createRoot(container);
20
+ root.render(<App />);
@@ -13,7 +13,7 @@ const errorMap = [
13
13
  "Invalid number",
14
14
  ];
15
15
 
16
- const DemoApp = () => {
16
+ const App = () => {
17
17
  const [isValid, setIsValid] = useState(null);
18
18
  const [number, setNumber] = useState(null);
19
19
  const [errorCode, setErrorCode] = useState(null);
@@ -24,7 +24,7 @@ const DemoApp = () => {
24
24
  setNotice(`Valid number: ${number}`);
25
25
  } else {
26
26
  const errorMessage = errorMap[errorCode] || "Invalid number";
27
- setNotice(errorMessage);
27
+ setNotice(`Error: ${errorMessage}`);
28
28
  }
29
29
  };
30
30
 
@@ -38,7 +38,7 @@ const DemoApp = () => {
38
38
  initialCountry: "us",
39
39
  utilsScript: "../../build/js/utils.js",
40
40
  }}
41
- />
41
+ />
42
42
  <button type="button" onClick={handleSubmit}>Validate</button>
43
43
  {notice && <div className="notice">{notice}</div>}
44
44
  </form>
@@ -47,4 +47,4 @@ const DemoApp = () => {
47
47
 
48
48
  const container = document.getElementById("app");
49
49
  const root = createRoot(container);
50
- root.render(<DemoApp />);
50
+ root.render(<App />);