/**
 * 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 { __toESM } from "../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../node_modules/classnames/index.js";
import { pkg } from "../../settings.js";
import React from "react";
//#region src/components/Datagrid/useColumnRightAlign.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__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--datagrid`;
const useColumnRightAlign = (hooks) => {
	const RightAlignRenderer = (tableProps, column) => /* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(`${blockClass}__right-align-cell-renderer`, { sortDisabled: !tableProps.isTableSortable || tableProps?.column?.disableSortBy === true }) }, (column?.Cell)?.(tableProps));
	const RightAlignHeader = (headerProp, column) => /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__right-align-header` }, typeof column.Header === "function" ? (column?.Header)(headerProp) : column.Header);
	const rightAlignedColumns = (columns) => {
		return [...columns.map((column) => ({
			...column,
			Cell: column.rightAlignedColumn ? (tableProp) => RightAlignRenderer(tableProp, column) : column.Cell,
			Header: column.rightAlignedColumn ? (headerProp) => RightAlignHeader(headerProp, column) : column.Header
		}))];
	};
	hooks.visibleColumns.push(rightAlignedColumns);
};
//#endregion
export { useColumnRightAlign as default };
