mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 20:38:45 +08:00
9aec72c395
* chore: remove useless tsx support * add * add * style * fix lint * fix lint * fix lint * update locale entry * update locale entry * update locale entry * delete useless style
24 lines
768 B
TypeScript
24 lines
768 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;
|