Skip to content

Commit

Permalink
feat(chip): trailing remove icon can now be customized
Browse files Browse the repository at this point in the history
  • Loading branch information
vdegenne committed Dec 12, 2023
1 parent 76883cd commit 49a6be1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 0 additions & 5 deletions chips/internal/_trailing-icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
width: var(--_icon-size);
}

[name="remove-trailing-icon"]::slotted(md-icon) {
--md-icon-size: var(--_icon-size);
color: inherit;
}

:where(:hover) .trailing.icon {
color: var(--_hover-trailing-icon-color);
}
Expand Down
1 change: 1 addition & 0 deletions chips/internal/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export abstract class Chip extends LitElement {
<div class="container ${classMap(this.getContainerClasses())}">
${this.renderContainerContent()}
</div>
<slot></slot>
`;
}

Expand Down
18 changes: 10 additions & 8 deletions chips/internal/trailing-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../../ripple/ripple.js';

import {html, nothing} from 'lit';

import {MultiActionChip} from './multi-action-chip.js';
import {Chip} from './chip.js';

interface RemoveButtonProperties {
ariaLabel: string;
Expand All @@ -34,18 +34,20 @@ export function renderRemoveButton({
@focus=${focusListener}>
<md-focus-ring part="trailing-focus-ring"></md-focus-ring>
<md-ripple ?disabled=${disabled}></md-ripple>
<slot name="remove-trailing-icon" class="trailing icon">
<svg viewBox="0 96 960 960" aria-hidden="true">
<path
d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
</svg>
</slot>
<span class="trailing icon">
<slot name="remove-trailing-icon">
<svg viewBox="0 96 960 960" aria-hidden="true">
<path
d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
</svg>
</slot>
</span>
<span class="touch"></span>
</button>
`;
}

function handleRemoveClick(this: MultiActionChip, event: Event) {
function handleRemoveClick(this: Chip, event: Event) {
if (this.disabled) {
return;
}
Expand Down

0 comments on commit 49a6be1

Please sign in to comment.