Skip to content

Commit

Permalink
refactor: better classNames logic (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc authored Dec 15, 2023
1 parent 81858fb commit 2e245c4
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/InputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { getDecupleSteps } from './utils/numberUtil';

import { InputFocusOptions, triggerFocus } from 'rc-input/lib/utils/commonUtils';
import useFrame from './hooks/useFrame';
import { BaseInputProps } from 'rc-input/lib/interface';

export type { ValueType };

Expand Down Expand Up @@ -67,15 +68,7 @@ export interface InputNumberProps<T extends ValueType = ValueType>
suffix?: React.ReactNode;
addonBefore?: React.ReactNode;
addonAfter?: React.ReactNode;
classes?: {
affixWrapper?: string;
group?: string;
wrapper?: string;
};
classNames?: {
affixWrapper?: string;
group?: string;
wrapper?: string;
classNames?: BaseInputProps['classNames'] & {
input?: string;
};

Expand Down Expand Up @@ -583,7 +576,7 @@ const InternalInputNumber = React.forwardRef(
// ============================ Render ============================
return (
<div
className={clsx(prefixCls, classNames?.input, className, {
className={clsx(prefixCls, className, {
[`${prefixCls}-focused`]: focus,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-readonly`]: readOnly,
Expand Down Expand Up @@ -644,7 +637,6 @@ const InputNumber = React.forwardRef(
suffix,
addonBefore,
addonAfter,
classes,
className,
classNames,
...rest
Expand All @@ -670,7 +662,6 @@ const InputNumber = React.forwardRef(
suffix={suffix}
addonAfter={addonAfter}
addonBefore={addonBefore}
classes={classes}
classNames={classNames}
components={{
affixWrapper: 'div',
Expand All @@ -682,8 +673,8 @@ const InputNumber = React.forwardRef(
<InternalInputNumber
prefixCls={prefixCls}
disabled={disabled}
classNames={classNames}
ref={composeRef(inputFocusRef, ref)}
className={classNames?.input}
{...rest}
/>
</BaseInput>
Expand Down

0 comments on commit 2e245c4

Please sign in to comment.