/** * @license * Copyright 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import '../../focus/md-focus-ring.js'; import '../../ripple/ripple.js'; import {html, nothing} from 'lit'; import {Chip} from './chip.js'; interface RemoveButtonProperties { ariaLabel: string | null; disabled: boolean; focusListener: EventListener; tabbable?: boolean; } /** @protected */ export function renderRemoveButton({ ariaLabel, disabled, focusListener, tabbable = false, }: RemoveButtonProperties) { // When an aria-label is not provided, we use two spans with aria-labelledby // to create the "Remove " label for the remove button. The first // is this #remove-label span, the second is the chip's #label slot span. return html` `; } function handleRemoveClick(this: Chip, event: Event) { if (this.disabled || this.softDisabled) { return; } event.stopPropagation(); const preventDefault = !this.dispatchEvent( new Event('remove', {cancelable: true}), ); if (preventDefault) { return; } this.remove(); }