/**
 * 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_settings = require('../../settings.js');
let react = require("react");
react = require_runtime.__toESM(react);

//#region src/components/Datagrid/useColumnCenterAlign.tsx
/**
* Copyright IBM Corp. 2020, 2024
*
* 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 useColumnCenterAlign = (hooks) => {
	const centerAlignRenderer = (tableProps, column) => /* @__PURE__ */ react.default.createElement("div", { className: (0, import_classnames.default)(`${blockClass}__center-align-cell-renderer`, { sortDisabled: !tableProps.isTableSortable || tableProps.column && tableProps.column.disableSortBy === true }) }, column.Cell(tableProps));
	const centerAlignHeader = (headerProp, column) => /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__center-align-header` }, typeof column.Header === "function" ? column.Header(headerProp) : column.Header);
	const centerAlignedColumns = (columns) => {
		return [...columns.map((column) => ({
			...column,
			Cell: column.centerAlignedColumn ? (tableProp) => centerAlignRenderer(tableProp, column) : column.Cell,
			Header: column.centerAlignedColumn ? (headerProp) => centerAlignHeader(headerProp, column) : column.Header
		}))];
	};
	hooks.visibleColumns.push(centerAlignedColumns);
};

//#endregion
exports.default = useColumnCenterAlign;