Skip to content

Commit 1428565

Browse files
committed
chore: rm useless file
1 parent 2facc4e commit 1428565

File tree

3 files changed

+12
-101
lines changed

3 files changed

+12
-101
lines changed

examples/InputExample.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

examples/SelectContentExample.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/BaseSelect/index.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ export interface BaseSelectProps extends BaseSelectPrivateProps, React.AriaAttri
174174
// >>> Icons
175175
allowClear?: boolean | { clearIcon?: React.ReactNode };
176176
prefix?: React.ReactNode;
177+
/** @deprecated Please use `suffix` instead. */
178+
suffixIcon?: RenderNode;
177179
suffix?: RenderNode;
178180
/**
179181
* Clear all icon
@@ -272,6 +274,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
272274
allowClear,
273275
prefix,
274276
suffix,
277+
suffixIcon,
275278
clearIcon,
276279

277280
// Dropdown
@@ -306,8 +309,6 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
306309

307310
// ============================== MISC ==============================
308311
const multiple = isMultiple(mode);
309-
// const mergedShowSearch =
310-
// (showSearch !== undefined ? showSearch : multiple) || mode === 'combobox';
311312

312313
// ============================== Refs ==============================
313314
const containerRef = React.useRef<SelectInputRef>(null);
@@ -645,18 +646,20 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
645646
// ==================================================================
646647

647648
// ============================= Suffix =============================
648-
const suffixIcon: React.ReactNode = React.useMemo(() => {
649-
if (typeof suffix === 'function') {
650-
return suffix({
649+
const mergedSuffixIcon: React.ReactNode = React.useMemo(() => {
650+
const nextSuffix = suffix ?? suffixIcon;
651+
652+
if (typeof nextSuffix === 'function') {
653+
return nextSuffix({
651654
searchValue: mergedSearchValue,
652655
open: mergedOpen,
653656
focused,
654657
showSearch,
655658
loading,
656659
});
657660
}
658-
return suffix;
659-
}, [suffix, mergedSearchValue, mergedOpen, focused, showSearch, loading]);
661+
return nextSuffix;
662+
}, [suffix, suffixIcon, mergedSearchValue, mergedOpen, focused, showSearch, loading]);
660663

661664
// ============================= Clear ==============================
662665
const onClearMouseDown: React.MouseEventHandler<HTMLSpanElement> = () => {
@@ -690,7 +693,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
690693
[`${prefixCls}-multiple`]: multiple,
691694
[`${prefixCls}-single`]: !multiple,
692695
[`${prefixCls}-allow-clear`]: mergedAllowClear,
693-
[`${prefixCls}-show-arrow`]: suffixIcon !== undefined && suffixIcon !== null,
696+
[`${prefixCls}-show-arrow`]: mergedSuffixIcon !== undefined && mergedSuffixIcon !== null,
694697
[`${prefixCls}-disabled`]: disabled,
695698
[`${prefixCls}-loading`]: loading,
696699
[`${prefixCls}-open`]: mergedOpen,
@@ -711,7 +714,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
711714
focused={focused}
712715
// UI
713716
prefix={prefix}
714-
suffix={suffixIcon}
717+
suffix={mergedSuffixIcon}
715718
clearIcon={clearNode}
716719
// Type or mode
717720
multiple={multiple}

0 commit comments

Comments
 (0)