qpp-style 9.43.0 → 9.43.2
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/components/HeaderSearchBar/index.jsx +19 -1
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +19 -19
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
|
|
3
3
|
const HeaderSearchBar = () => {
|
|
4
|
+
const [inputValue, setInputValue] = useState("");
|
|
5
|
+
|
|
6
|
+
const onChangeHandler = (event) => {
|
|
7
|
+
setInputValue(event.target.value);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function validateNpi(val) {
|
|
11
|
+
const pattern = /^\d{10}$/;
|
|
12
|
+
return val && val.length === 10 && pattern.test(val);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// If inputValue is a valid NPI, then navigate to NPI Lookup page
|
|
16
|
+
if (validateNpi(inputValue)) {
|
|
17
|
+
window.location.replace(`/participation-lookup?npi=${inputValue}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
return (
|
|
5
21
|
<div className="qpp-c-search--header-container">
|
|
6
22
|
<div className="qpp-c-search--header-container__block">
|
|
@@ -47,6 +63,8 @@ const HeaderSearchBar = () => {
|
|
|
47
63
|
name="query"
|
|
48
64
|
type="text"
|
|
49
65
|
maxLength="50"
|
|
66
|
+
onChange={onChangeHandler}
|
|
67
|
+
value={inputValue}
|
|
50
68
|
/>
|
|
51
69
|
</div>
|
|
52
70
|
<button
|