Skip to content

Commit

Permalink
use 'filter' instead of 'pattern'
Browse files Browse the repository at this point in the history
  • Loading branch information
kimprice committed Sep 11, 2024
1 parent 1d5c81f commit 8d5b303
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions react-common/components/controls/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ export const Input = (props: InputProps) => {
onOptionSelected,
handleInputRef,
preserveValueOnBlur,
options,
filter
options
} = props;

const [value, setValue] = React.useState(initialValue || "");
const [expanded, setExpanded] = React.useState(false);
const [pattern, setPattern] = React.useState(filter ? new RegExp(filter) : undefined);
const [filter] = React.useState(props.filter ? new RegExp(props.filter) : undefined);

let container: HTMLDivElement;

Expand All @@ -87,8 +86,8 @@ export const Input = (props: InputProps) => {

const changeHandler = (e: React.ChangeEvent<any>) => {
let newValue = (e.target as any).value;
if (newValue && pattern) {
newValue = newValue.match(pattern)?.join("") || "";
if (newValue && filter) {
newValue = newValue.match(filter)?.join("") || "";
}
if (!readOnly && (value !== newValue)) {
setValue(newValue);
Expand Down

0 comments on commit 8d5b303

Please sign in to comment.