import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2022-2025 GoodData Corporation
import { isEmpty } from "lodash-es";
import { Bubble } from "../Bubble/Bubble.js";
import { BubbleHoverTrigger } from "../Bubble/BubbleHoverTrigger.js";
const ARROW_OFFSETS = {
    "cr cl": [13, 0],
    "cl cr": [-13, 0],
    "tc bc": [0, -13],
    "bc tc": [0, 13],
};
const ALIGN_POINTS = [{ align: "cr cl" }, { align: "tc bc" }, { align: "bc tc" }, { align: "cl cr" }];
/**
 * @internal
 */
export function MetadataList({ title, list }) {
    return (_jsxs("div", { className: "gd-metadata-list", children: [title ? _jsx("div", { className: "gd-metadata-list-title", children: title }) : null, list?.map((element, index) => (_jsxs("div", { className: "gd-metadata-list-element", children: [
                    _jsx("span", { title: element.title, children: element.title }), !isEmpty(element.description) && (_jsxs(BubbleHoverTrigger, { className: "gd-metadata-list-icon", showDelay: 0, hideDelay: 0, children: [
                            _jsx("div", { className: "gd-icon-circle-question" }), _jsx(Bubble, { className: "bubble-primary", arrowOffsets: ARROW_OFFSETS, alignPoints: ALIGN_POINTS, children: element.description })
                        ] }))] }, index)))] }));
}
