mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-30 06:09:34 +08:00
7c4e12f99e
* refactor: feedbackIcon migration * test: update snapshot
24 lines
790 B
TypeScript
24 lines
790 B
TypeScript
import classNames from 'classnames';
|
|
import { ValidateStatus } from '../form/FormItem';
|
|
import { tuple } from './type';
|
|
|
|
const InputStatuses = tuple('warning', 'error', '');
|
|
export type InputStatus = typeof InputStatuses[number];
|
|
|
|
export function getStatusClassNames(
|
|
prefixCls: string,
|
|
status?: ValidateStatus,
|
|
hasFeedback?: boolean,
|
|
) {
|
|
return classNames({
|
|
[`${prefixCls}-status-success`]: status === 'success',
|
|
[`${prefixCls}-status-warning`]: status === 'warning',
|
|
[`${prefixCls}-status-error`]: status === 'error',
|
|
[`${prefixCls}-status-validating`]: status === 'validating',
|
|
[`${prefixCls}-has-feedback`]: hasFeedback,
|
|
});
|
|
}
|
|
|
|
export const getMergedStatus = (contextStatus?: ValidateStatus, customStatus?: InputStatus) =>
|
|
customStatus || contextStatus;
|