"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const unstable_1 = require("@gravity-ui/uikit/unstable");
const fields_1 = require("../../utils/fields.js");
const Base_1 = tslib_1.__importDefault(require("../Base/Base.js"));
const BaseInput_1 = tslib_1.__importDefault(require("../BaseInput/BaseInput.js"));
const COLOR_PICKER_DEFAULT = '#000000';
const ColorInput = ({ title, name, when, content, onUpdate, className, defaultValue, }) => {
    const resolvedDefault = defaultValue ?? COLOR_PICKER_DEFAULT;
    const value = (0, fields_1.getValueByPath)(content, name) || resolvedDefault;
    return ((0, jsx_runtime_1.jsx)(Base_1.default, { when: when, content: content, name: name, onUpdate: onUpdate, defaultValue: resolvedDefault, children: (0, jsx_runtime_1.jsx)(BaseInput_1.default, { title: title, className: className, children: (0, jsx_runtime_1.jsx)(unstable_1.unstable_ColorPicker, { onUpdate: (v) => onUpdate(name, v), value: value, size: 'xs' }) }) }));
};
exports.default = ColorInput;
//# sourceMappingURL=ColorInput.js.map
