"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const color_1 = require("../../../../../client/color");
const field_1 = require("../../../../../client/field");
class Color extends field_1.Field {
    constructor($props, $system) {
        const DEFAULT_STYLE = $system.style['color'];
        super($props, $system, $system.api.document.createElement('input'), {
            valueKey: 'value',
            defaultStyle: DEFAULT_STYLE,
            defaultValue: $system.color,
            parseValue(value) {
                var _a;
                if (value) {
                    value = (_a = (0, color_1.nameToColor)(value)) !== null && _a !== void 0 ? _a : value;
                }
                return value;
            },
        });
        const { value = $system.color, tabIndex = -1 } = $props;
        this.$element.value = value;
        this.$element.type = 'color';
        this.$element.tabIndex = tabIndex;
    }
}
exports.default = Color;
//# sourceMappingURL=Component.js.map