import { __decorate } from "tslib";
import { attr, nullableNumberConverter, observable } from '@ni/fast-element';
import { applyMixins, DesignSystem, FoundationElement, StartEnd } from '@ni/fast-foundation';
import { styles } from './styles';
import { template } from './template';
import { ChipAppearance } from './types';
import { slotTextContent } from '../utilities/models/slot-text-content';
import { itemRemoveLabel } from '../label-provider/core/label-tokens';
/**
 * A Nimble chip component
 */
export class Chip extends FoundationElement {
    constructor() {
        super(...arguments);
        this.removable = false;
        this.disabled = false;
        this.appearance = ChipAppearance.outline;
        /** @internal */
        this.hasOverflow = false;
    }
    /** @internal */
    get elementTextContent() {
        return slotTextContent(this.contentSlot);
    }
    /** @internal */
    get removeButtonContent() {
        return itemRemoveLabel.getValueFor(this);
    }
    /** @internal */
    handleRemoveClick() {
        if (this.removable) {
            this.$emit('remove');
        }
    }
}
__decorate([
    attr({ mode: 'boolean' })
], Chip.prototype, "removable", void 0);
__decorate([
    attr({ mode: 'boolean' })
], Chip.prototype, "disabled", void 0);
__decorate([
    attr()
], Chip.prototype, "appearance", void 0);
__decorate([
    attr({ attribute: 'tabindex', converter: nullableNumberConverter })
], Chip.prototype, "tabIndex", void 0);
__decorate([
    observable
], Chip.prototype, "hasOverflow", void 0);
applyMixins(Chip, StartEnd);
const nimbleChip = Chip.compose({
    baseName: 'chip',
    template,
    styles,
    shadowOptions: {
        delegatesFocus: true
    }
});
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleChip());
export const chipTag = 'nimble-chip';
//# sourceMappingURL=index.js.map