Skip to content

Commit

Permalink
Revert "feat(InputNumber): support classNames props (#46842)" (#46849)
Browse files Browse the repository at this point in the history
This reverts commit 8a078c9.
  • Loading branch information
li-jia-nan committed Jan 8, 2024
1 parent 928eaf4 commit 1ff5805
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 46 deletions.
20 changes: 1 addition & 19 deletions components/input-number/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';

import React from 'react';
import InputNumber from '..';
import focusTest from '../../../tests/shared/focusTest';
import mountTest from '../../../tests/shared/mountTest';
Expand Down Expand Up @@ -72,23 +71,6 @@ describe('InputNumber', () => {
).toBe(true);
});

it('should support classNames', () => {
const { container } = render(
<InputNumber
prefix="$"
suffix="%"
classNames={{
input: 'my-class-name-input',
prefix: 'my-class-name-prefix',
suffix: 'my-class-name-suffix',
}}
/>,
);
expect(container.querySelector('.ant-input-number')).toHaveClass('my-class-name-input');
expect(container.querySelector('.ant-input-number-prefix')).toHaveClass('my-class-name-prefix');
expect(container.querySelector('.ant-input-number-suffix')).toHaveClass('my-class-name-suffix');
});

it('renders correctly when the controlled mode number is out of range', () => {
const App: React.FC = () => {
const [value, setValue] = React.useState<number | null>(1);
Expand Down
11 changes: 0 additions & 11 deletions components/input-number/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Common props ref:[Common props](/docs/react/common-props)
| addonAfter | The label text displayed after (on the right side of) the input field | ReactNode | - | |
| addonBefore | The label text displayed before (on the left side of) the input field | ReactNode | - | |
| autoFocus | If get focus when component mounted | boolean | false | - |
| classNames | Semantic DOM class | Record<[SemanticDOM](#inputnumber), string> | - | 5.13.0 |
| changeOnBlur | Trigger `onChange` when blur. e.g. reset value in range by blur | boolean | true | 5.11.0 |
| controls | Whether to show `+-` controls, or set custom arrows icon | boolean \| { upIcon?: React.ReactNode; downIcon?: React.ReactNode; } | - | 4.19.0 |
| decimalSeparator | Decimal separator | string | - | - |
Expand All @@ -67,16 +66,6 @@ Common props ref:[Common props](/docs/react/common-props)
| onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - | - |
| onStep | The callback function that is triggered when click up or down buttons | (value: number, info: { offset: number, type: 'up' \| 'down' }) => void | - | 4.7.0 |

### Semantic DOM

#### InputNumber

| Property | Description | Version |
| -------- | -------------------------- | ------- |
| input | Wrapper of `input` element | 5.13.0 |
| prefix | Wrapper of prefix | 5.13.0 |
| suffix | Wrapper of suffix | 5.13.0 |

## Methods

| Name | Description |
Expand Down
5 changes: 2 additions & 3 deletions components/input-number/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>((props,
const {
className,
rootClassName,
classNames: classes,
size: customizeSize,
disabled: customDisabled,
prefixCls: customizePrefixCls,
Expand Down Expand Up @@ -156,12 +155,12 @@ const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>((props,
)
}
classNames={{
...classes,
input: classNames(inputNumberClass, classes?.input),
input: inputNumberClass,
variant: classNames(
{
[`${prefixCls}-${variant}`]: enableVariantCls,
},

getStatusClassNames(prefixCls, mergedStatus, hasFeedback),
),
affixWrapper: classNames(
Expand Down
11 changes: 0 additions & 11 deletions components/input-number/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ demo:
| addonAfter | 带标签的 input,设置后置标签 | ReactNode | - | 4.17.0 |
| addonBefore | 带标签的 input,设置前置标签 | ReactNode | - | 4.17.0 |
| autoFocus | 自动获取焦点 | boolean | false | - |
| classNames | 语义化结构 class | Record<[SemanticDOM](#inputnumber), string> | - | 5.13.0 |
| changeOnBlur | 是否在失去焦点时,触发 `onChange` 事件(例如值超出范围时,重新限制回范围并触发事件) | boolean | true | 5.11.0 |
| controls | 是否显示增减按钮,也可设置自定义箭头图标 | boolean \| { upIcon?: React.ReactNode; downIcon?: React.ReactNode; } | - | 4.19.0 |
| decimalSeparator | 小数点 | string | - | - |
Expand All @@ -68,16 +67,6 @@ demo:
| onPressEnter | 按下回车的回调 | function(e) | - | - |
| onStep | 点击上下箭头的回调 | (value: number, info: { offset: number, type: 'up' \| 'down' }) => void | - | 4.7.0 |

### Semantic DOM

#### InputNumber

| 名称 | 说明 | 版本 |
| ------ | -------------------- | ------ |
| input | `input` 元素包裹元素 | 5.13.0 |
| prefix | 所有前缀的包裹元素 | 5.13.0 |
| suffix | 所有后缀的包裹元素 | 5.13.0 |

## 方法

| 名称 | 描述 |
Expand Down
4 changes: 2 additions & 2 deletions scripts/__snapshots__/check-site.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ exports[`site test Component components/input en Page 1`] = `8`;

exports[`site test Component components/input zh Page 1`] = `8`;

exports[`site test Component components/input-number en Page 1`] = `3`;
exports[`site test Component components/input-number en Page 1`] = `2`;

exports[`site test Component components/input-number zh Page 1`] = `3`;
exports[`site test Component components/input-number zh Page 1`] = `2`;

exports[`site test Component components/layout en Page 1`] = `2`;

Expand Down

0 comments on commit 1ff5805

Please sign in to comment.