feat(GlListbox): add ability to reset selection
What does this MR do?
This adds the ability to show a reset button in a listbox's header. The reset button only shows up if all those conditions are fulfilled:
- The
resetButtonLabel
prop is provided. This is the only control the consumer has over the button. The button does not have a default label to enforce a properly translated a contextualized label to be provided, which in turns controls the button's rendering. - The
headerText
prop is provided. We do not allow a reset button to render without a header being set on the listbox. Each clearable listbox should therefore have a header that ideally describes its purpose. - Some items are selected. If the selection is empty, the reset button is hidden.
Screenshots
With items selected | Selection empty |
---|---|
GitLab integration
Those changes are currently being leveraged in a select2
migration here: gitlab!98597 (merged).
Closes #1968 (closed)
Edited by Paul Gascou-Vaillancourt