Skip to content

Commit 2abd183

Browse files
author
Hector Arce De Las Heras
committed
Add regex prop to InputCounter and InputSearch components
This commit introduces a new regex prop to both the InputCounter and InputSearch components. This addition allows for more flexible and powerful pattern matching within these input fields, enhancing their functionality and usability in various use cases
1 parent d1ffcd3 commit 2abd183

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/components/inputCounter/inputCounter.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const InputCounterComponent = React.forwardRef(
2626
value: currentValue,
2727
informationAssociatedValue,
2828
ignoreKeys,
29+
regex,
2930
onBlur,
3031
onChange,
3132
onFocus,
@@ -70,6 +71,7 @@ const InputCounterComponent = React.forwardRef(
7071
truncate,
7172
informationAssociated: informationAssociatedValue?.content,
7273
ignoreKeys,
74+
regex,
7375
onBlur,
7476
onChange,
7577
onFocus,

src/components/inputCounter/types/inputCounter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export interface IInputCounter<V = undefined extends string ? unknown : string>
3737
disabled?: boolean;
3838
errorExecution?: ERROR_EXECUTION;
3939
keyValidation?: string;
40+
regex?: string | RegExp;
4041
onInternalErrors?: (errors: string[]) => void;
4142
onError?: (error: boolean) => void;
4243
}

src/components/inputSearch/hooks/useInputSearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type ParamsType = {
4444
options: IOptionGroup[];
4545
type: InputTypeType;
4646
value?: string;
47-
regex?: string;
47+
regex?: string | RegExp;
4848
disabled?: boolean;
4949
error?: boolean;
5050
hasResultTextWrittenByUser?: boolean;

0 commit comments

Comments
 (0)