Skip to content

Commit 6ea03ea

Browse files
authored
feat: group wrapper should have disabled cls (#56)
1 parent 1aec10f commit 6ea03ea

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/BaseInput.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const BaseInput: FC<BaseInputProps> = (props) => {
130130
if (hasAddon(props)) {
131131
const wrapperCls = `${prefixCls}-group`;
132132
const addonCls = `${wrapperCls}-addon`;
133+
const groupWrapperCls = `${wrapperCls}-wrapper`;
133134

134135
const mergedWrapperClassName = clsx(
135136
`${prefixCls}-wrapper`,
@@ -139,7 +140,10 @@ const BaseInput: FC<BaseInputProps> = (props) => {
139140
);
140141

141142
const mergedGroupClassName = clsx(
142-
`${prefixCls}-group-wrapper`,
143+
groupWrapperCls,
144+
{
145+
[`${groupWrapperCls}-disabled`]: disabled,
146+
},
143147
classes?.group,
144148
classNames?.groupWrapper,
145149
);

tests/BaseInput.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,14 @@ describe('BaseInput', () => {
226226
?.style.color,
227227
).toBe('blue');
228228
});
229+
230+
it('with addon and disabled', () => {
231+
const { container } = render(
232+
<BaseInput prefixCls="rc-input" addonBefore="addon" disabled>
233+
<input />
234+
</BaseInput>,
235+
);
236+
237+
expect(container.firstChild).toHaveClass('rc-input-group-wrapper-disabled');
238+
});
229239
});

0 commit comments

Comments
 (0)