import * as React from 'react'; import classNames from 'classnames'; import RcInputNumber, { InputNumberProps as RcInputNumberProps } from 'rc-input-number'; import UpOutlined from '@ant-design/icons/UpOutlined'; import DownOutlined from '@ant-design/icons/DownOutlined'; import { ConfigContext } from '../config-provider'; import { Omit } from '../_util/type'; import SizeContext, { SizeType } from '../config-provider/SizeContext'; type ValueType = string | number; export interface InputNumberProps extends Omit, 'size'> { prefixCls?: string; size?: SizeType; bordered?: boolean; } const InputNumber = React.forwardRef((props, ref) => { const { getPrefixCls, direction } = React.useContext(ConfigContext); const size = React.useContext(SizeContext); const { className, size: customizeSize, prefixCls: customizePrefixCls, bordered = true, readOnly, ...others } = props; const prefixCls = getPrefixCls('input-number', customizePrefixCls); const upIcon = ; const downIcon = ; const mergeSize = customizeSize || size; const inputNumberClass = classNames( { [`${prefixCls}-lg`]: mergeSize === 'large', [`${prefixCls}-sm`]: mergeSize === 'small', [`${prefixCls}-rtl`]: direction === 'rtl', [`${prefixCls}-readonly`]: readOnly, [`${prefixCls}-borderless`]: !bordered, }, className, ); return ( ); }); export default InputNumber as (( props: React.PropsWithChildren> & { ref?: React.Ref; }, ) => React.ReactElement) & { displayName?: string };