Skip to content

Commit

Permalink
fix(select): shouln't hide label on searchable (#829)
Browse files Browse the repository at this point in the history
It was always displaying search placeholder.
Added new stories to the select component in the storybook with label
and fixed label options.

Fixes #828
  • Loading branch information
ogunb authored Apr 17, 2024
1 parent 7d59dbd commit d8137c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/select/bl-select.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,14 @@ Display a loading icon in place of the search icon with using `search-bar-loadin
<Story name="Searchable with Loading State" args={{ searchBar: true, searchBarPlaceholder: 'Search your options', multiple: true, searchBarLoadingState: true }}>
{SelectTemplate.bind({})}
</Story>

<Story name="Searchable with Label" args={{ searchBar: true, searchBarPlaceholder: 'Search your options', label: 'Label' }}>
{SelectTemplate.bind({})}
</Story>

<Story name="Searchable with Fixed Label" args={{ searchBar: true, searchBarPlaceholder: 'Search your options', label: 'Label', labelFixed: true }}>
{SelectTemplate.bind({})}
</Story>
</Canvas>

## Special Use Cases
Expand Down
4 changes: 3 additions & 1 deletion src/components/select/bl-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ export default class BlSelect<ValueType extends FormValue = string> extends Form
: html`
<input
class="search-bar-input"
placeholder=${searchbarPlaceholderText}
placeholder=${this.opened || this.labelFixed
? searchbarPlaceholderText
: this.label || searchbarPlaceholderText}
@input=${this._handleSearchOptions}
.value=${this._searchText}
/>
Expand Down

0 comments on commit d8137c9

Please sign in to comment.