/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { pkg } from "../../../settings.js";
import { EmptyState } from "../../EmptyStates/EmptyState.js";
import { ErrorEmptyState } from "../../EmptyStates/ErrorEmptyState/ErrorEmptyState.js";
import { NoDataEmptyState } from "../../EmptyStates/NoDataEmptyState/NoDataEmptyState.js";
import { NotFoundEmptyState } from "../../EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js";
import React from "react";
import { TableBody, TableCell, TableRow } from "@carbon/react";

//#region src/components/Datagrid/Datagrid/DatagridEmptyBody.tsx
/**
* Copyright IBM Corp. 2020, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const blockClass = `${pkg.prefix}--datagrid`;
const DatagridEmptyBody = (datagridState) => {
	const { getTableBodyProps, headers, emptyStateTitle, emptyStateDescription, emptyStateSize, emptyStateType = "noData", illustrationTheme, emptyStateAction, emptyStateLink } = datagridState;
	const emptyStateProps = {
		illustrationTheme,
		size: emptyStateSize,
		title: emptyStateTitle,
		subtitle: emptyStateDescription,
		action: emptyStateAction,
		link: emptyStateLink
	};
	const validEmptyStates = [
		"error",
		"noData",
		"notFound"
	];
	return /* @__PURE__ */ React.createElement(TableBody, {
		...getTableBodyProps({ role: void 0 }),
		"aria-live": "off",
		className: `${blockClass}__empty-state-body`
	}, /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, {
		colSpan: headers?.length,
		className: `${blockClass}__empty-state-cell`
	}, validEmptyStates.includes(emptyStateType) ? /* @__PURE__ */ React.createElement(React.Fragment, null, emptyStateType === "error" && /* @__PURE__ */ React.createElement(ErrorEmptyState, emptyStateProps), emptyStateType === "noData" && /* @__PURE__ */ React.createElement(NoDataEmptyState, emptyStateProps), emptyStateType === "notFound" && /* @__PURE__ */ React.createElement(NotFoundEmptyState, emptyStateProps)) : /* @__PURE__ */ React.createElement(EmptyState, emptyStateProps))));
};

//#endregion
export { DatagridEmptyBody as default };