import { cx } from '@linaria/core';
import React__default, { useMemo } from 'react';
import { Typo } from '../../Typo/index.js';
import { SubtitleStyle, BodyCellTextStyle, BodyCellTextWrapper } from '../style.js';

const TextColumnHeaderCell = ({
  column
}) => {
  return /* @__PURE__ */ React__default.createElement(
    "p",
    {
      className: cx(Typo.Label.l4_regular, SubtitleStyle, column.subTitleColor)
    },
    column.subTitle
  );
};
const TextColumnBodyCell = ({ data, column, index }) => {
  const text = column.displayText || data[index][column.key];
  const CellDescription = useMemo(() => {
    var _a, _b;
    const Result = (_b = (_a = column.renderDescription) == null ? void 0 : _a.call(column, {
      rowIndex: index,
      rowData: data[index]
    })) != null ? _b : null;
    return typeof Result === "string" ? /* @__PURE__ */ React__default.createElement("p", { className: cx(Typo.Label.l4_regular, "cell-description") }, Result) : Result;
  }, [index, data, column]);
  const Text = useMemo(
    () => /* @__PURE__ */ React__default.createElement("p", { className: cx(Typo.Label.l3_regular, BodyCellTextStyle) }, text),
    [text]
  );
  return /* @__PURE__ */ React__default.createElement(
    BodyCellTextWrapper,
    {
      className: !!CellDescription ? "with-description" : void 0
    },
    Text,
    CellDescription
  );
};

export { TextColumnBodyCell, TextColumnHeaderCell };
