import { jsx as _jsx } from "react/jsx-runtime";
import { unstable_ColorPicker as ColorPicker } from '@gravity-ui/uikit/unstable';
import { getValueByPath } from "../../utils/fields.js";
import Base from "../Base/Base.js";
import BaseInput from "../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 = getValueByPath(content, name) || resolvedDefault;
    return (_jsx(Base, { when: when, content: content, name: name, onUpdate: onUpdate, defaultValue: resolvedDefault, children: _jsx(BaseInput, { title: title, className: className, children: _jsx(ColorPicker, { onUpdate: (v) => onUpdate(name, v), value: value, size: 'xs' }) }) }));
};
export default ColorInput;
//# sourceMappingURL=ColorInput.js.map
