import { jsx as n } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { TableCells as b } from "./TableCells.js";
import { useCallback as v } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { useInteractiveDataGrid as f } from "../hooks/useInteractiveDataGrid.js";
import { Fragment as C } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
const _ = ({
  data: o,
  columns: d,
  onRowClick: a,
  customCells: u,
  onRowHover: t
}) => {
  const { currentIndex: i, listeners: l, ref: p } = f({ totalRows: o?.length ?? 0 }), m = v(
    (e) => () => a?.callback(a?.retrievedField ? e[a.retrievedField] : e),
    [a]
  );
  return /* @__PURE__ */ n(C, { children: o?.map((e, r) => {
    const s = t && t.bind(null, r), c = t && t.bind(null, void 0);
    return /* @__PURE__ */ n(
      "div",
      {
        role: "row",
        tabIndex: 0,
        onMouseEnter: s,
        onFocus: s,
        onMouseLeave: c,
        onBlur: c,
        ref: p,
        "aria-selected": r === i,
        "data-index": r,
        className: "adyen-pe-data-grid__row adyen-pe-data-grid__row--clickable",
        onClick: m(e),
        onFocusCapture: l.onFocusCapture(r),
        onKeyDownCapture: l.onKeyDownCapture,
        children: /* @__PURE__ */ n(b, { columns: d, customCells: u, item: e, rowIndex: r })
      },
      e
    );
  }) });
};
export {
  _ as InteractiveBody
};
