Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit f248e7c

Browse files
committed
feat: pass handleBlur to base inputs
1 parent c1bdfae commit f248e7c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

libs/shared/components/src/Inputs/BigIntInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { InputBase } from '@mui/material';
44
import { formatUnits, parseUnits } from 'viem';
55

66
import type { InputBaseProps } from '@mui/material';
7-
import type { ChangeEvent } from 'react';
7+
import type { ChangeEvent, FocusEvent } from 'react';
88

99
export type BigintInputProps = {
1010
value: bigint;
@@ -103,8 +103,9 @@ export const BigIntInput = forwardRef<HTMLInputElement, BigintInputProps>(
103103
}
104104
};
105105

106-
const handleBlur = () => {
106+
const handleBlur = (evt: FocusEvent<HTMLInputElement>) => {
107107
updateSourceRef.current = null;
108+
rest?.onBlur?.(evt);
108109
};
109110

110111
return (

libs/shared/components/src/Inputs/DnumInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { eq, format, from } from 'dnum';
55

66
import type { InputBaseProps } from '@mui/material';
77
import type { Dnum } from 'dnum';
8-
import type { ChangeEvent } from 'react';
8+
import type { ChangeEvent, FocusEvent } from 'react';
99

1010
export type DnumInputProps = {
1111
value: Dnum;
@@ -92,8 +92,9 @@ export const DnumInput = forwardRef<HTMLInputElement, DnumInputProps>(
9292
}
9393
};
9494

95-
const handleBlur = () => {
95+
const handleBlur = (evt: FocusEvent<HTMLInputElement>) => {
9696
updateSourceRef.current = null;
97+
rest?.onBlur?.(evt);
9798
};
9899

99100
return (

libs/shared/components/src/Inputs/PercentInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { forwardRef, useEffect, useRef, useState } from 'react';
33
import { InputBase } from '@mui/material';
44

55
import type { InputBaseProps } from '@mui/material';
6-
import type { ChangeEvent } from 'react';
6+
import type { ChangeEvent, FocusEvent } from 'react';
77

88
export type PercentInputProps = {
99
value: number;
@@ -80,8 +80,9 @@ export const PercentInput = forwardRef<HTMLInputElement, PercentInputProps>(
8080
}
8181
};
8282

83-
const handleBlur = () => {
83+
const handleBlur = (evt: FocusEvent<HTMLInputElement>) => {
8484
updateSourceRef.current = null;
85+
rest?.onBlur?.(evt);
8586
};
8687

8788
return (

0 commit comments

Comments
 (0)