"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyTypeColors = exports.JsonRow = void 0;
const tslib_1 = require("tslib");
const tree_list_1 = require("@stoplight/tree-list");
const ui_kit_1 = require("@stoplight/ui-kit");
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const React = tslib_1.__importStar(require("react"));
const ICON_SIZE = 12;
const ICON_DIMENSION = 20;
const ROW_OFFSET = 7;
exports.JsonRow = ({ node, isExpanded }) => {
    const { type, name } = node;
    const { value } = node.metadata;
    return (React.createElement("div", { className: "RequestMaker__JsonRow px-2 flex-1 w-full" },
        React.createElement("div", { className: "flex items-center text-sm relative", style: {
                marginLeft: ICON_DIMENSION * (tree_list_1.Tree.getLevel(node) + 1),
            } },
            tree_list_1.isParentNode(node) && (React.createElement("div", { className: "absolute flex justify-center cursor-pointer p-1 rounded hover:bg-darken-3", style: {
                    left: ICON_DIMENSION * -1 + ROW_OFFSET / -2,
                    width: ICON_DIMENSION,
                    height: ICON_DIMENSION,
                } },
                React.createElement(ui_kit_1.Icon, { iconSize: ICON_SIZE, icon: isExpanded ? 'caret-down' : 'caret-right', className: "text-darken-9 dark:text-lighten-9" }))),
            React.createElement("div", { className: "flex-1 flex truncate" },
                name && React.createElement("div", { className: "mr-2" }, name + (tree_list_1.isParentNode(node) ? '' : ':')),
                tree_list_1.isParentNode(node) ? (React.createElement(React.Fragment, null,
                    React.createElement("span", { className: classnames_1.default(exports.PropertyTypeColors[type], 'truncate') }, type),
                    React.createElement("div", { className: "ml-2 text-darken-7 dark:text-lighten-7" }, `{${value}}`))) : (React.createElement("span", { className: classnames_1.default(exports.PropertyTypeColors[type], 'truncate') }, `${value}`))))));
};
exports.PropertyTypeColors = {
    object: 'text-blue-6 dark:text-blue-4',
    array: 'text-green-6 dark:text-green-4',
    null: 'text-orange-5',
    number: 'text-red-7 dark:text-red-6',
    boolean: 'text-red-4',
    string: 'text-green-7 dark:text-green-5',
};
//# sourceMappingURL=JsonRow.js.map