/**
 * 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/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__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.pkg.prefix}--datagrid`;
const useDefaultStringRenderer = (hooks) => {
	const StringRenderer = (tableProps) => /* @__PURE__ */ react.default.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.default.createElement("div", {
			className: (0, import_classnames.default)(`${blockClass}__defaultStringRenderer`, {
				[`${blockClass}__defaultStringRenderer--slug`]: slug && react.default.isValidElement(slug),
				[`${blockClass}__defaultStringRenderer--ai-label`]: aiLabel && react.default.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
exports.default = useDefaultStringRenderer;