mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-26 04:00:13 +08:00
4097a6c7c6
* fix(input): fix circular dependencies * fix(input): fix circular dependencies * fix(modal): fix circular dependencies * fix(modal): fix test
26 lines
821 B
TypeScript
26 lines
821 B
TypeScript
import classNames from 'classnames';
|
|
import type { DirectionType } from '../config-provider';
|
|
import type { SizeType } from '../config-provider/SizeContext';
|
|
import type { ClearableInputProps } from './ClearableLabeledInput';
|
|
import type { InputProps } from './Input';
|
|
|
|
export function getInputClassName(
|
|
prefixCls: string,
|
|
bordered: boolean,
|
|
size?: SizeType,
|
|
disabled?: boolean,
|
|
direction?: DirectionType,
|
|
) {
|
|
return classNames(prefixCls, {
|
|
[`${prefixCls}-sm`]: size === 'small',
|
|
[`${prefixCls}-lg`]: size === 'large',
|
|
[`${prefixCls}-disabled`]: disabled,
|
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
[`${prefixCls}-borderless`]: !bordered,
|
|
});
|
|
}
|
|
|
|
export function hasPrefixSuffix(props: InputProps | ClearableInputProps) {
|
|
return !!(props.prefix || props.suffix || props.allowClear);
|
|
}
|