mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
* refactor: uninstall classnames & install clsx * refactor: uninstall classnames & install clsx * test: rename test fn * test: update snap * update * update * update * update * update snap * update * update --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: thinkasany <480968828@qq.com>
25 lines
788 B
TypeScript
25 lines
788 B
TypeScript
import { clsx } from 'clsx';
|
|
|
|
import type { ValidateStatus } from '../form/FormItem';
|
|
|
|
const _InputStatuses = ['warning', 'error', '', 'success', 'validating'] as const;
|
|
|
|
export type InputStatus = (typeof _InputStatuses)[number];
|
|
|
|
export const getStatusClassNames = (
|
|
prefixCls: string,
|
|
status?: ValidateStatus,
|
|
hasFeedback?: boolean,
|
|
) => {
|
|
return clsx({
|
|
[`${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;
|