fix(input-number): without controls suffix style (#50450)

Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
ice 2024-08-16 20:07:26 +08:00 committed by GitHub
parent 4235d117f2
commit bda8cb0a76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View File

@ -16,4 +16,12 @@ describe('suffix', () => {
fireEvent.click(container.querySelector('i')!);
expect(mockFocus).toHaveBeenCalled();
});
it('should has classname when without controls', () => {
const { container } = render(<InputNumber suffix={<i>antd</i>} controls={false} />);
expect(
container.querySelector('.ant-input-number-affix-wrapper-without-controls'),
).toBeTruthy();
});
});

View File

@ -171,6 +171,7 @@ const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>((props,
[`${prefixCls}-affix-wrapper-sm`]: mergedSize === 'small',
[`${prefixCls}-affix-wrapper-lg`]: mergedSize === 'large',
[`${prefixCls}-affix-wrapper-rtl`]: direction === 'rtl',
[`${prefixCls}-affix-wrapper-without-controls`]: controls === false,
},
hashId,
),

View File

@ -469,7 +469,7 @@ const genAffixWrapperStyles: GenerateStyle<InputNumberToken> = (token: InputNumb
width: token.handleWidth,
opacity: 1,
},
[`&:hover ${componentCls}-suffix`]: {
[`&:not(${componentCls}-affix-wrapper-without-controls):hover ${componentCls}-suffix`]: {
marginInlineEnd: token.calc(token.handleWidth).add(paddingInline).equal(),
},
},