/*
 * Copyright (C) 2016-2020 Kano Computing Ltd.
 * License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import '@kano/styles/typography.js';
import { LitElement, css, html, property, customElement } from 'lit-element/lit-element.js';
import { templateContent } from '../../lib/directives/template-content.js';
import '../kc-validated-editable-label.js';
let KCPartListItem = class KCPartListItem extends LitElement {
    constructor() {
        super(...arguments);
        this.label = '';
        this.validator = () => true;
    }
    static get styles() {
        return css `
            :host {
                display: flex;
                flex-direction: row;
                align-items: center;
                color: #fff;
                font-size: 14px;
                white-space: nowrap;
                font-family: var(--font-body);
            }
            :host(:hover) .icon {
                fill: var(--kano-part-list-item-highlight-color);
            }
            .icon {
                fill: #8F9195;
                width: 24px;
                height: 24px;
                margin: 8px 12px 8px 0;
                flex-shrink: 0;
            }
            .label {
                min-width: 60px;
            }
            .controls {
                flex: 1 1 auto;
                margin-left: 8px;
            }
            .edit-icon {
                display: none;
            }
        `;
    }
    render() {
        return html `
            <div id="icon" class="icon">${this.icon ? templateContent(this.icon) : ''}</div>
            <kc-validated-editable-label class$="label" .label=${this.label} .validator=${this.validator} @change=${this._onLabelChange}></kc-validated-editable-label>
            <div class="controls" id="controls"><slot></slot></div>
        `;
    }
    _onLabelChange(e) {
        this.dispatchEvent(new CustomEvent('label-change', { detail: e.detail, bubbles: true, composed: true }));
    }
};
__decorate([
    property({ type: String })
], KCPartListItem.prototype, "label", void 0);
__decorate([
    property({ type: HTMLTemplateElement })
], KCPartListItem.prototype, "icon", void 0);
__decorate([
    property({ type: Function })
], KCPartListItem.prototype, "validator", void 0);
KCPartListItem = __decorate([
    customElement('kc-part-list-item')
], KCPartListItem);
export { KCPartListItem };
//# sourceMappingURL=kc-part-list-item.js.map