ant-design/components/_util/statusUtils.tsx
lijianan 12543277b7
type: remove tuple、tupleNum、ElementOf (#39478)
* type: remove tuple

* type: remove tuple

* type: remove tuple

* fix

* fix

* fix type

* fix type

* fix type

* fix type

* fix type

* Update ColorPicker.tsx

* Update components/badge/utils.tsx

Co-authored-by: MadCcc <1075746765@qq.com>

* fix type

* fix type

* fix type

* fix

* fix

* fix type

* fix type

* fix type

* update snap

* update snap

Co-authored-by: MadCcc <1075746765@qq.com>
2022-12-13 14:57:40 +08:00

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;