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 { html, customElement, css, property, nothing, when } from '../../../../external/lit/index.js';
import { UmbLitElement } from '../../lit-element/index.js';
import { UmbDeleteEvent } from '../../event/index.js';
import { getTimeZoneName } from '../../utils/index.js';
import { UmbFormControlMixin } from '../../validation/index.js';
/**
 * @element umb-input-time-zone-item
 */
let UmbInputTimeZoneItemElement = class UmbInputTimeZoneItemElement extends UmbFormControlMixin(UmbLitElement) {
    constructor() {
        super(...arguments);
        /**
         * Disables the input
         * @type {boolean}
         * @attr
         * @default false
         */
        this.disabled = false;
        /**
         * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
         * @type {boolean}
         * @attr
         * @default false
         */
        this.readonly = false;
    }
    render() {
        const label = (this.value && getTimeZoneName(this.value)) || '';
        return html `
			<div class="time-zone-item">
				${this.disabled || this.readonly ? nothing : html `<uui-icon name="icon-grip" class="handle"></uui-icon>`}

				<span>${label}</span>

				${when(!this.readonly, () => html `
						<uui-button
							class="time-zone-remove-button"
							compact
							label="${this.localize.term('general_remove')} ${label}"
							look="outline"
							?disabled=${this.disabled}
							@click=${() => this.dispatchEvent(new UmbDeleteEvent())}>
							<uui-icon name="icon-trash"></uui-icon>
						</uui-button>
					`)}
			</div>
		`;
    }
    static { this.styles = [
        css `
			:host {
				display: flex;
				align-items: center;
				margin-bottom: var(--uui-size-space-2);
				gap: var(--uui-size-space-3);
			}

			.time-zone-item {
				background-color: var(--uui-color-surface-alt);
				display: flex;
				align-items: center;
				gap: var(--uui-size-6);
				padding: var(--uui-size-2) var(--uui-size-6);
				width: 100%;
			}

			.time-zone-remove-button {
				margin-left: auto;
			}

			.handle {
				cursor: grab;
			}

			.handle:active {
				cursor: grabbing;
			}
		`,
    ]; }
};
__decorate([
    property({ type: Boolean, reflect: true })
], UmbInputTimeZoneItemElement.prototype, "disabled", void 0);
__decorate([
    property({ type: Boolean, reflect: true })
], UmbInputTimeZoneItemElement.prototype, "readonly", void 0);
UmbInputTimeZoneItemElement = __decorate([
    customElement('umb-input-time-zone-item')
], UmbInputTimeZoneItemElement);
export { UmbInputTimeZoneItemElement };
export default UmbInputTimeZoneItemElement;
