import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2026 GoodData Corporation
import { useIntl } from "react-intl";
import { olpLabelMessages } from "../../locales.js";
import { bem } from "../@utils/bem.js";
import { UiLabelRow } from "../UiLabelRow/UiLabelRow.js";
const { b, e } = bem("gd-ui-kit-labels-list");
/**
 * Read-only list of labels — uppercase heading + N `UiLabelRow`s.
 * Renders only the panel content; whoever needs a popover wraps it.
 *
 * @internal
 */
export function UiLabelsList({ items, showHeading = true, dataTestId }) {
    const intl = useIntl();
    const suffixFor = (kind) => {
        if (!kind)
            return undefined;
        return intl.formatMessage(kind === "primary" ? olpLabelMessages.suffixPrimary : olpLabelMessages.suffixDefault);
    };
    return (_jsxs("div", { className: b(), "data-testid": dataTestId, children: [showHeading ? (_jsx("div", { className: e("heading"), children: intl.formatMessage(olpLabelMessages.listHeading) })) : null, _jsx("div", { className: e("items"), role: "list", children: items.map((item) => (_jsx("div", { role: "listitem", children: _jsx(UiLabelRow, { label: item.label, kind: item.kind, suffix: suffixFor(item.kind) }) }, item.id))) })
        ] }));
}
