Skip to content

Commit 00c0430

Browse files
committed
chore: add additional suffix cls
1 parent 0b9d977 commit 00c0430

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/Mentions.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ const Mentions = forwardRef<MentionsRef, MentionsProps>(
571571
},
572572
ref,
573573
) => {
574+
const hasSuffix = !!(suffix || allowClear);
575+
574576
// =============================== Ref ================================
575577
const holderRef = useRef<HolderRef>(null);
576578
const mentionRef = useRef<MentionsRef>(null);
@@ -605,7 +607,10 @@ const Mentions = forwardRef<MentionsRef, MentionsProps>(
605607
value={mergedValue}
606608
allowClear={allowClear}
607609
handleReset={handleReset}
608-
className={clsx(prefixCls, className)}
610+
className={clsx(prefixCls, className, {
611+
// hasSuffix
612+
[`${prefixCls}-has-suffix`]: hasSuffix,
613+
})}
609614
classNames={mentionsClassNames}
610615
disabled={disabled}
611616
ref={holderRef}
@@ -620,7 +625,7 @@ const Mentions = forwardRef<MentionsRef, MentionsProps>(
620625
ref={mentionRef}
621626
onChange={triggerChange}
622627
disabled={disabled}
623-
hasWrapper={!!(allowClear || suffix)}
628+
hasWrapper={hasSuffix}
624629
{...rest}
625630
/>
626631
</BaseInput>

tests/__snapshots__/AllowClear.spec.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`should support allowClear should not show icon if defaultValue is undefined, null or empty string 1`] = `
44
<span
5-
class="rc-mentions-affix-wrapper rc-mentions"
5+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
66
>
77
<textarea
88
class="rc-textarea"
@@ -24,7 +24,7 @@ exports[`should support allowClear should not show icon if defaultValue is undef
2424

2525
exports[`should support allowClear should not show icon if defaultValue is undefined, null or empty string 2`] = `
2626
<span
27-
class="rc-mentions-affix-wrapper rc-mentions"
27+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
2828
>
2929
<textarea
3030
class="rc-textarea"
@@ -46,7 +46,7 @@ exports[`should support allowClear should not show icon if defaultValue is undef
4646

4747
exports[`should support allowClear should not show icon if defaultValue is undefined, null or empty string 3`] = `
4848
<span
49-
class="rc-mentions-affix-wrapper rc-mentions"
49+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
5050
>
5151
<textarea
5252
class="rc-textarea"
@@ -68,7 +68,7 @@ exports[`should support allowClear should not show icon if defaultValue is undef
6868

6969
exports[`should support allowClear should not show icon if value is undefined, null or empty string 1`] = `
7070
<span
71-
class="rc-mentions-affix-wrapper rc-mentions"
71+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
7272
>
7373
<textarea
7474
class="rc-textarea"
@@ -90,7 +90,7 @@ exports[`should support allowClear should not show icon if value is undefined, n
9090

9191
exports[`should support allowClear should not show icon if value is undefined, null or empty string 2`] = `
9292
<span
93-
class="rc-mentions-affix-wrapper rc-mentions"
93+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
9494
>
9595
<textarea
9696
class="rc-textarea"
@@ -112,7 +112,7 @@ exports[`should support allowClear should not show icon if value is undefined, n
112112

113113
exports[`should support allowClear should not show icon if value is undefined, null or empty string 3`] = `
114114
<span
115-
class="rc-mentions-affix-wrapper rc-mentions"
115+
class="rc-mentions-affix-wrapper rc-mentions rc-mentions-has-suffix"
116116
>
117117
<textarea
118118
class="rc-textarea"

0 commit comments

Comments
 (0)