feat(FE-114): add inputPrefix and inputSuffix props for enhanced input customization

This commit is contained in:
rstubryan
2025-10-25 14:24:23 +07:00
parent a0556ea1f4
commit 189c152745
2 changed files with 114 additions and 30 deletions
+7 -1
View File
@@ -1,6 +1,6 @@
'use client';
import { ChangeEvent } from 'react';
import { ChangeEvent, ReactNode } from 'react';
import { NumericFormat, OnValueChange } from 'react-number-format';
import TextInput, { TextInputProps } from '@/components/input/TextInput';
@@ -12,6 +12,8 @@ interface NumberInputProps extends Omit<TextInputProps, 'type'> {
prefix?: string;
suffix?: string;
fixedDecimalScale?: boolean;
inputPrefix?: ReactNode;
inputSuffix?: ReactNode;
}
const NumberInput = ({
@@ -20,6 +22,8 @@ const NumberInput = ({
decimalScale = 5,
allowNegative = true,
onChange,
inputPrefix,
inputSuffix,
...restProps
}: NumberInputProps) => {
const valueChangeHandler: OnValueChange = (
@@ -45,6 +49,8 @@ const NumberInput = ({
onValueChange={valueChangeHandler}
decimalScale={decimalScale}
allowNegative={allowNegative}
inputPrefix={inputPrefix}
inputSuffix={inputSuffix}
{...restProps}
/>
);