UNPKG

material-ui-autonumeric

Version:

AutoNumeric-Powered Material UI Components. AutoNumeric is a powerful library that automatically formats numbers and currencies. Material UI-AutoNumeric brings that power to Material UI.

24 lines (23 loc) 1 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { AutoNumericComponent } from "react-autonumeric"; export function AutoNumericMUIInputBase({ comp, props, autoNumericOptions, valueState, }) { const stateProps = valueState !== undefined ? { value: valueState.state, onChange: (e) => { // For input, it is required set value in onChange. valueState.stateSetter(e.currentTarget.value); if (props?.onChange !== undefined) { props.onChange(e); } }, onBlur: (e) => { valueState.stateSetter(e.currentTarget.value); if (props?.onBlur !== undefined) { props.onBlur(e); } }, } : {}; return (_jsx(AutoNumericComponent, { element: comp, refKey: "inputRef", props: { ...props, ...stateProps }, autoNumericOptions: autoNumericOptions, state: valueState?.state })); }