"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefinitionContent = exports.DefinitionItemValue = exports.DefinitionItemKey = void 0;
const react_1 = require("react");
const jsx_runtime_1 = require("react/jsx-runtime");
const box_1 = __importDefault(require("../box"));
const core_1 = require("../core");
const icon_1 = __importDefault(require("../icon"));
const p_1 = __importDefault(require("../p"));
const utils_1 = require("../utils");
exports.DefinitionItemKey = core_1.styled.dtBox ``;
exports.DefinitionItemValue = core_1.styled.ddBox ``;
exports.DefinitionContent = (0, core_1.vui)((props, ref) => {
    const { iconLeft, iconRight, isLabelBold, isValueBold, items, orientation } = props;
    const styles = (0, core_1.useStyleConfig)('Definition', props);
    return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, utils_1.isArray)(items)
            ? items.map((_a, index) => {
                var { key, value } = _a, props = __rest(_a, ["key", "value"]);
                return ((0, jsx_runtime_1.jsxs)(box_1.default, { className: "vui-definitionItemWrapper", ref: ref, children: [(0, jsx_runtime_1.jsxs)(exports.DefinitionItemKey, Object.assign({ fontWeight: isLabelBold ? 'demi' : 'default' }, styles.dt, { children: [props.keyHasIcon && iconLeft && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconLeft }, styles.icon))), key, props.keyHasIcon && iconRight && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconRight }, styles.icon)))] })), (0, utils_1.isArray)(value) ? ((0, react_1.createElement)(exports.DefinitionItemValue, Object.assign({ display: "block", fontWeight: isValueBold ? 'demi' : 'default' }, styles.dd, { key: index }), orientation === 'horizontal'
                            ? value.join(', ')
                            : value.map((value, index) => ((0, jsx_runtime_1.jsxs)(p_1.default, { display: "flex", children: [props.valueHasIcon && iconLeft && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconLeft }, styles.icon))), value, props.valueHasIcon && iconRight && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconRight }, styles.icon)))] }, index + value))))) : ((0, jsx_runtime_1.jsxs)(exports.DefinitionItemValue, Object.assign({ fontWeight: isValueBold ? 'demi' : 'default' }, styles.dd, { children: [props.valueHasIcon && iconLeft && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconLeft }, styles.icon))), value, props.valueHasIcon && iconRight && ((0, jsx_runtime_1.jsx)(icon_1.default, Object.assign({ className: (0, utils_1.cs)('vui-definitionIcon'), name: iconRight }, styles.icon)))] })))] }, index));
            })
            : items }));
});
exports.DefinitionContent.displayName = 'DefinitionContent';
exports.default = exports.DefinitionContent;
//# sourceMappingURL=definitionContent.js.map