mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 12:28:33 +08:00
7fdfb299eb
* chore(deps): update dependency @typescript-eslint/parser to v8 * Update package.json Signed-off-by: afc163 <afc163@gmail.com> * fix eslint errors --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: afc163 <afc163@gmail.com>
26 lines
833 B
TypeScript
26 lines
833 B
TypeScript
import classNames from 'classnames';
|
|
|
|
import type { ValidateStatus } from '../form/FormItem';
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
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;
|