'use strict';

var core = require('@linaria/core');
var react = require('@linaria/react');
var index = require('../../core/Loading/index.js');
var React = require('react');
var InfoRow = require('./InfoRow.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

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

exports.InfoRowList = InfoRowList;
