/**
 * 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.
 */

const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../node_modules/classnames/index.js");
const require_pconsole = require("../../../global/js/utils/pconsole.js");
const require_settings = require("../../../settings.js");
const require_devtools = require("../../../global/js/utils/devtools.js");
const require_InlineEditContext = require("./addons/InlineEdit/InlineEditContext/InlineEditContext.js");
const require_FilterProvider = require("./addons/Filtering/FilterProvider.js");
const require_DatagridContent = require("./DatagridContent.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
//#region src/components/Datagrid/Datagrid/Datagrid.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.
*/
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.pkg.prefix}--datagrid`;
const componentName = "Datagrid";
/**
* The `Datagrid` component is an extension of Carbon's DataTable component. At the most basic level, the `Datagrid` component takes in columns and rows and renders a data table. There is a set of data table extensions which this component provides support for, these can be found [here](https://pages.github.ibm.com/carbon/ibm-products/components/datagrid/overview/). This component is data driven and allows you to choose what pieces will be included based on the hooks/plugins that are provided.
* @deprecated
*/
const Datagrid = react.default.forwardRef(({ datagridState, ariaToolbarLabel, ...rest }, ref) => {
	if (!datagridState) {
		require_pconsole.default.warn("Datagrid was not passed datagridState which is required to render this component.");
		return;
	}
	const { withVirtualScroll, DatagridPagination, isFetching, tableId, filterProps, className, state } = datagridState;
	const rows = DatagridPagination && datagridState.page || datagridState.rows;
	const props = {
		datagridState,
		ariaToolbarLabel
	};
	return /* @__PURE__ */ react.default.createElement(require_FilterProvider.FilterProvider, {
		filters: state?.filters,
		filterProps,
		tableId
	}, /* @__PURE__ */ react.default.createElement(require_InlineEditContext.InlineEditProvider, null, /* @__PURE__ */ react.default.createElement("div", {
		...rest,
		id: tableId,
		ref,
		className: (0, import_classnames.default)(className, blockClass, withVirtualScroll ? `${blockClass}__datagridWrap` : `${blockClass}__datagridWrap-simple`, !isFetching && rows.length === 0 ? `${blockClass}__empty-state` : ""),
		...require_devtools.getDevtoolsProps(componentName)
	}, filterProps?.variation === "panel" ? /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__datagridWithPanel ${blockClass}__displayFlex` }, /* @__PURE__ */ react.default.createElement(require_DatagridContent.DatagridContent, props)) : /* @__PURE__ */ react.default.createElement(require_DatagridContent.DatagridContent, props))));
});
/**@ts-ignore*/
Datagrid.deprecated = {
	level: "warn",
	details: `For more information, please refer to the migration docs https://github.com/carbon-design-system/tanstack-carbon`
};
Datagrid.displayName = componentName;
Datagrid.propTypes = {
	/**
	* Specify a label to be read by screen readers on the container node
	* 'aria-label' of the TableToolbar component.
	*/
	ariaToolbarLabel: prop_types.default.string,
	/**
	* The data grid state, much of it being supplied by the useDatagrid hook
	*/
	/**@ts-ignore */
	datagridState: prop_types.default.object.isRequired
};
//#endregion
exports.Datagrid = Datagrid;
