@douyinfe/semi-ui
Version:
A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.
125 lines (124 loc) • 5.92 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
import { InputProps } from '../input';
import InputNumberFoundation, { BaseInputNumberState, InputNumberAdapter } from '@douyinfe/semi-foundation/lib/cjs/inputNumber/foundation';
import BaseComponent from '../_base/baseComponent';
import { strings } from '@douyinfe/semi-foundation/lib/cjs/inputNumber/constants';
import '@douyinfe/semi-foundation/lib/cjs/inputNumber/inputNumber.css';
import { ArrayElement } from '../_base/base';
export interface InputNumberProps extends InputProps {
autofocus?: boolean;
className?: string;
clearIcon?: React.ReactNode;
currency?: string | boolean;
currencyDisplay?: 'code' | 'symbol' | 'name';
defaultValue?: number | string;
defaultCurrency?: string;
disabled?: boolean;
formatter?: (value: number | string) => string;
forwardedRef?: React.MutableRefObject<HTMLInputElement> | ((instance: HTMLInputElement) => void);
hideButtons?: boolean;
innerButtons?: boolean;
insetLabel?: React.ReactNode;
insetLabelId?: string;
keepFocus?: boolean;
localeCode?: string;
max?: number;
min?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
parser?: (value: string) => string;
precision?: number;
prefixCls?: string;
pressInterval?: number;
pressTimeout?: number;
shiftStep?: number;
showClear?: boolean;
showCurrencySymbol?: boolean;
size?: ArrayElement<typeof strings.SIZE>;
step?: number;
style?: React.CSSProperties;
suffix?: React.ReactNode;
value?: number | string;
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
onChange?: (value: number | string, e?: React.ChangeEvent) => void;
onDownClick?: (value: string, e: React.MouseEvent<HTMLButtonElement>) => void;
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
onKeyDown?: React.KeyboardEventHandler;
onNumberChange?: (value: number, e?: React.ChangeEvent) => void;
onUpClick?: (value: string, e: React.MouseEvent<HTMLButtonElement>) => void;
}
export interface InputNumberState extends BaseInputNumberState {
}
declare class InputNumber extends BaseComponent<InputNumberProps, InputNumberState> {
static propTypes: {
'aria-label': PropTypes.Requireable<string>;
'aria-labelledby': PropTypes.Requireable<string>;
'aria-invalid': PropTypes.Requireable<boolean>;
'aria-errormessage': PropTypes.Requireable<string>;
'aria-describedby': PropTypes.Requireable<string>;
'aria-required': PropTypes.Requireable<boolean>;
autofocus: PropTypes.Requireable<boolean>;
clearIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
className: PropTypes.Requireable<string>;
defaultValue: PropTypes.Requireable<NonNullable<string | number>>;
disabled: PropTypes.Requireable<boolean>;
formatter: PropTypes.Requireable<(...args: any[]) => any>;
forwardedRef: PropTypes.Requireable<any>;
hideButtons: PropTypes.Requireable<boolean>;
innerButtons: PropTypes.Requireable<boolean>;
insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
insetLabelId: PropTypes.Requireable<string>;
keepFocus: PropTypes.Requireable<boolean>;
max: PropTypes.Requireable<number>;
min: PropTypes.Requireable<number>;
parser: PropTypes.Requireable<(...args: any[]) => any>;
precision: PropTypes.Requireable<number>;
prefixCls: PropTypes.Requireable<string>;
pressInterval: PropTypes.Requireable<number>;
pressTimeout: PropTypes.Requireable<number>;
preventScroll: PropTypes.Requireable<boolean>;
shiftStep: PropTypes.Requireable<number>;
showCurrencySymbol: PropTypes.Requireable<boolean>;
step: PropTypes.Requireable<number>;
style: PropTypes.Requireable<object>;
suffix: PropTypes.Requireable<any>;
value: PropTypes.Requireable<NonNullable<string | number>>;
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
onChange: PropTypes.Requireable<(...args: any[]) => any>;
onDownClick: PropTypes.Requireable<(...args: any[]) => any>;
onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
onNumberChange: PropTypes.Requireable<(...args: any[]) => any>;
onUpClick: PropTypes.Requireable<(...args: any[]) => any>;
};
static defaultProps: InputNumberProps;
get adapter(): InputNumberAdapter;
inputNode: HTMLInputElement;
clickUpOrDown: boolean;
cursorStart: number;
cursorEnd: number;
currentValue: number | string;
cursorBefore: string;
cursorAfter: string;
foundation: InputNumberFoundation;
constructor(props: InputNumberProps);
componentDidUpdate(prevProps: InputNumberProps): void;
setInputRef: (node: HTMLInputElement) => void;
handleInputFocus: (e: React.FocusEvent<HTMLInputElement>) => void;
handleInputChange: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
handleInputBlur: (e: React.FocusEvent<HTMLInputElement>) => void;
handleInputKeyDown: (e: React.KeyboardEvent) => void;
handleInputMouseEnter: (e: React.MouseEvent) => void;
handleInputMouseLeave: (e: React.MouseEvent) => void;
handleInputMouseMove: (e: React.MouseEvent) => void;
handleUpClick: (e: React.KeyboardEvent) => void;
handleDownClick: (e: React.KeyboardEvent) => void;
handleMouseUp: (e: React.MouseEvent) => void;
handleMouseLeave: (e: React.MouseEvent) => void;
renderButtons: () => React.JSX.Element;
renderSuffix: () => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
render(): React.JSX.Element;
}
declare const _default: React.ForwardRefExoticComponent<InputNumberProps & React.RefAttributes<HTMLInputElement>>;
export default _default;
export { InputNumber };