@minimaltech/ra-infra
Version:
Minimal Technology ReactJS Infrastructure
23 lines • 872 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import React from 'react';
import { TextField } from '@mui/material';
import { NumericFormat } from 'react-number-format';
const Ref = (props, ref) => {
const { onChange, ...other } = props;
return (_jsx(NumericFormat, { ...other, getInputRef: ref, onKeyUp: (e) => {
onChange?.({
target: {
name: props.name,
value: e.target.value?.replace(/,/g, ''),
},
});
}, thousandSeparator: true, valueIsNumericString: true }));
};
const NumericFormatCustom = React.forwardRef(Ref);
export const NumberField = props => {
return (_jsx(TextField, { ...props, InputProps: {
...(props?.InputProps ?? {}),
inputComponent: NumericFormatCustom,
} }));
};
//# sourceMappingURL=NumberField.js.map