Skip to content

Commit

Permalink
fix(MultiSelect): add filter tag class to <ListBoxSelection /> (#2936)
Browse files Browse the repository at this point in the history
* fix(MultiSelect): add filter tag class to <ListBoxSelection />

* chore: update snapshots

* feat(tag): add distinct focus state

* chore: update snapshots

* fix(tag): change hover bgc token
  • Loading branch information
emyarod authored and joshblack committed Jun 11, 2019
1 parent 41b6669 commit 92e7221
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
class="{{@root.prefix}}--multi-select {{@root.prefix}}--list-box {{@root.prefix}}--list-box--expanded {{@root.prefix}}--multi-select--selected{{#if inline}} {{@root.prefix}}--list-box--inline{{/if}}{{#if light}} {{@root.prefix}}--list-box--light{{/if}}{{#if filterable}} {{@root.prefix}}--combo-box {{@root.prefix}}--multi-select--filterable{{/if}}">
<div role="button" class="{{@root.prefix}}--list-box__field" tabindex="0" aria-label="close menu"
aria-expanded="true" aria-haspopup="true">
<div role="button" class="{{@root.prefix}}--list-box__selection {{@root.prefix}}--list-box__selection--multi"
<div role="button"
class="{{@root.prefix}}--list-box__selection {{@root.prefix}}--list-box__selection--multi {{@root.prefix}}--tag--filter"
tabindex="0" title="Clear all selected items">
1
{{ carbon-icon 'Close16' aria-label='Clear selection' }}
Expand Down
8 changes: 6 additions & 2 deletions packages/components/src/components/tag/_tag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,21 @@
height: rem(20px);
}

.#{$prefix}--tag--filter:focus > svg,
.#{$prefix}--tag--filter > svg:hover {
border-radius: 50%;
background-color: $icon-02;
background-color: $hover-secondary;
}

.#{$prefix}--tag--filter:focus,
.#{$prefix}--tag--filter:hover {
outline: none;
}

.#{$prefix}--tag--filter:focus > svg {
border: 2px solid $inverse-01;
border-radius: 50%;
}

// Skeleton state
.#{$prefix}--tag.#{$prefix}--skeleton {
width: rem(60px);
Expand Down
11 changes: 7 additions & 4 deletions packages/react/src/components/ListBox/ListBoxSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ const ListBoxSelection = ({
selectionCount,
translateWithId: t,
}) => {
const className = cx({
[`${prefix}--list-box__selection`]: true,
[`${prefix}--list-box__selection--multi`]: selectionCount,
});
const className = cx(
`${prefix}--tag--filter`,
`${prefix}--list-box__selection`,
{
[`${prefix}--list-box__selection--multi`]: selectionCount,
}
);
const handleOnClick = event => {
event.stopPropagation();
clearSelection(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`ListBoxField should render 1`] = `
translateWithId={[Function]}
>
<div
className="bx--list-box__selection"
className="bx--tag--filter bx--list-box__selection"
onClick={[Function]}
onKeyDown={[Function]}
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports[`ListBoxSelection should render 1`] = `
}
>
<div
className="bx--list-box__selection"
className="bx--tag--filter bx--list-box__selection"
onClick={[Function]}
onKeyDown={[Function]}
role="button"
Expand Down Expand Up @@ -94,7 +94,7 @@ exports[`ListBoxSelection should render 2`] = `
}
>
<div
className="bx--list-box__selection bx--list-box__selection--multi"
className="bx--tag--filter bx--list-box__selection bx--list-box__selection--multi"
onClick={[Function]}
onKeyDown={[Function]}
role="button"
Expand Down

0 comments on commit 92e7221

Please sign in to comment.