/**
 * 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/useDefaultStringRenderer.jsx
/**
* Copyright IBM Corp. 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__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--datagrid`;
const useDefaultStringRenderer = (hooks) => {
	const StringRenderer = (tableProps) => /* @__PURE__ */ React.createElement("div", { className: (0, import_classnames.default)(`${blockClass}__defaultStringRenderer`, { [`${blockClass}__defaultStringRenderer--multiline`]: tableProps.column?.multiLineWrap || tableProps?.multiLineWrapAll }) }, tableProps.value);
	const HeaderRenderer = (header, slug, aiLabel) => {
		return /* @__PURE__ */ React.createElement("div", {
			className: (0, import_classnames.default)(`${blockClass}__defaultStringRenderer`, {
				[`${blockClass}__defaultStringRenderer--slug`]: slug && React.isValidElement(slug),
				[`${blockClass}__defaultStringRenderer--ai-label`]: aiLabel && React.isValidElement(aiLabel)
			}),
			key: typeof header === "string" ? header : ""
		}, header);
	};
	const visibleColumns = (columns) => {
		return [...columns.map((column) => ({
			Cell: StringRenderer,
			...column,
			Header: column.HeaderRenderer || HeaderRenderer(column.Header, column.slug, column.aiLabel)
		}))];
	};
	hooks.visibleColumns.push(visibleColumns);
};
//#endregion
export { useDefaultStringRenderer as default };
