// #region Imports
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Listen } from '../../../../Events/Decorators/ListenDecorator';
import { Valueable } from '../../../Behaviors/Valueable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { colorPickerElementTemplate } from './ColorPickerElementTemplate';
import { colorPickerElementJoyStyle } from './Themes/ColorPickerElement.Joy';
import { colorPickerElementMemphisStyle } from './Themes/ColorPickerElement.Memphis';
import { colorPickerElementCosmopolitanStyle } from './Themes/ColorPickerElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Color Picker - A user interface component for selecting colors.
 *
 * @element mosaik-color-picker
 *
 * @description
 * The Color Picker component is designed to allow users to select a color from a predefined set of options or a custom color.
 *
 * @category Media
 *
 * @public
 */
let ColorPickerElement = class ColorPickerElement extends Themeable(Valueable(CustomElement)) {
    // #region Fields
    _inputElement;
    _value;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._value = null;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-color-picker';
    }
    /**
     * Gets or sets the `value` property.
     *
     * @public
     * @override
     */
    get value() {
        return this._value;
    }
    set value(value) {
        if (this._value !== value) {
            this._value = value;
            this.requestUpdate('value');
        }
    }
    // #endregion
    // #region Methods
    onApplyTemplate() {
        super.onApplyTemplate();
        this._inputElement = this.getTemplatePart('input');
    }
    onInput(event) {
        event.stopPropagation();
        this.value = this._inputElement.value;
        this.emit('input', { detail: this.value });
    }
    onChange(event) {
        event.stopPropagation();
        this.value = this._inputElement.value;
        this.emit('change', { detail: this.value });
    }
    onClick(event) {
        event.stopPropagation();
        this._inputElement.click();
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], ColorPickerElement.prototype, "value", null);
__decorate([
    Listen('input', { target: 'input' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [InputEvent]),
    __metadata("design:returntype", void 0)
], ColorPickerElement.prototype, "onInput", null);
__decorate([
    Listen('change', { target: 'input' }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Event]),
    __metadata("design:returntype", void 0)
], ColorPickerElement.prototype, "onChange", null);
__decorate([
    Listen('click'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [MouseEvent]),
    __metadata("design:returntype", void 0)
], ColorPickerElement.prototype, "onClick", null);
ColorPickerElement = __decorate([
    Component({
        selector: 'mosaik-color-picker',
        template: colorPickerElementTemplate,
        themes: {
            joy: colorPickerElementJoyStyle,
            memphis: colorPickerElementMemphisStyle,
            cosmopolitan: colorPickerElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], ColorPickerElement);
export { ColorPickerElement };
//# sourceMappingURL=ColorPickerElement.js.map