mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 15:19:58 +08:00
863f61d908
Co-authored-by: afc163 <afc163@gmail.com>
24 lines
772 B
TypeScript
24 lines
772 B
TypeScript
import classNames from 'classnames';
|
|
|
|
import type { ValidateStatus } from '../form/FormItem';
|
|
|
|
const _InputStatuses = ['warning', 'error', ''] as const;
|
|
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;
|