Skip to content

Commit

Permalink
fix(components): add custom filter function to Select to not require …
Browse files Browse the repository at this point in the history
…the labels
  • Loading branch information
MIGUELez11 committed Nov 27, 2024
1 parent 5ef17cd commit 9c9571d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/components/src/form/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import { MultiSelect } from '../MultiSelect';
import { Dropdown, Item } from '../../overlay/Dropdown';
import { SELECT_PROP_TYPES, SELECT_DEFAULT_PROPS } from './Select.constants';

function defaultFilter(value, item) {
if (!value) {
return true;
}
return item.label?.toLowerCase().trim().includes(value?.toLowerCase().trim());
}

const Select = forwardRef(
(
{
Expand Down Expand Up @@ -193,6 +200,7 @@ const Select = forwardRef(
error={!isEmpty(error)}
aria-label={ariaLabel}
withinPortal={withinPortal}
filter={props.filter || defaultFilter}
/>
)}
</InputWrapper>
Expand Down

0 comments on commit 9c9571d

Please sign in to comment.