Select tag fix (#651)

* add tag-counter part to wa-select

* on second thought
This commit is contained in:
Cory LaViska
2025-02-03 11:48:46 -05:00
committed by GitHub
parent fd73542d2c
commit 8e13683a30
2 changed files with 13 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ During the alpha period, things might break! We take breaking changes very serio
## Next
- Added an orientation example to the native radio docs
- Added the `tag` part (and associated exported parts) to `<wa-select>` to allow targeting the tag that shows when more than the max number of visible items have been selected
- Fixed a number of broken event listeners throughout the docs
- Fixed a bug in `<wa-card>` that prevented slots from showing automatically without `with-` attributes

View File

@@ -68,7 +68,6 @@ import styles from './select.css';
* @csspart listbox - The listbox container where options are slotted.
* @csspart tags - The container that houses option tags when `multiselect` is used.
* @csspart tag - The individual tags that represent each multiselect option.
* @csspart tag__base - The tag's base part.
* @csspart tag__content - The tag's content part.
* @csspart tag__remove-button - The tag's remove button.
* @csspart tag__remove-button__base - The tag's remove button base part.
@@ -661,7 +660,18 @@ export default class WaSelect extends WebAwesomeFormAssociatedElement {
</div>`;
} else if (index === this.maxOptionsVisible) {
// Hit tag limit
return html`<wa-tag>+${this.selectedOptions.length - index}</wa-tag>`;
return html`
<wa-tag
part="tag"
exportparts="
base:tag__base,
content:tag__content,
remove-button:tag__remove-button,
remove-button__base:tag__remove-button__base
"
>+${this.selectedOptions.length - index}</wa-tag
>
`;
}
return html``;
});