import { cx } from '@linaria/core';
import { styled } from '@linaria/react';
import Loading from '../../core/Loading/index.js';
import React__default from 'react';
import { InfoRow } from './InfoRow.js';

const InfoListRowStyle = "E_i5w779o";
const LooseStyle = "E_l18dja44";
const ContentWrapper = /*#__PURE__*/styled('div')({
  name: "ContentWrapper",
  class: "E_c8c2hys",
  propsAsIs: false
});
const NullText = /*#__PURE__*/styled('div')({
  name: "NullText",
  class: "E_n4m6c4d",
  propsAsIs: false
});
const InfoRowList = React__default.forwardRef(function InfoList(props, ref) {
  const {
    loading,
    data,
    className,
    rowClassName,
    compact
  } = props;
  if (loading) {
    return /* @__PURE__ */React__default.createElement("div", {
      ref,
      className
    }, /* @__PURE__ */React__default.createElement(Loading, null));
  }
  return /* @__PURE__ */React__default.createElement("div", {
    ref,
    className
  }, data.map(item => {
    const {
      key,
      value,
      name,
      action,
      hidden
    } = item;
    if (hidden) return null;
    return /* @__PURE__ */React__default.createElement(InfoRow, {
      key,
      className: cx(compact ? "" : LooseStyle, InfoListRowStyle, rowClassName),
      label: /* @__PURE__ */React__default.createElement("div", null, name || key),
      content: /* @__PURE__ */React__default.createElement(ContentWrapper, null, value || /* @__PURE__ */React__default.createElement(NullText, null, "-"), action)
    });
  }));
});

export { InfoRowList };
