/**
 * 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);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
//#region src/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.jsx
/**
* Copyright IBM Corp. 2022, 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 InlineEditButton = ({ label, renderIcon: Icon, labelIcon: LabelIcon, placeholder, disabledCell, nonEditCell, isActiveCell, columnConfig, type }) => {
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, import_classnames.default)(`${blockClass}__inline-edit-button`, {
			[`${blockClass}__inline-edit-button--disabled`]: disabledCell,
			[`${blockClass}__inline-edit-button--with-label-icon`]: LabelIcon,
			[`${blockClass}__inline-edit-button--non-edit`]: nonEditCell,
			[`${blockClass}__inline-edit-button--active`]: isActiveCell,
			[`${blockClass}__inline-edit-button--${type}`]: type === "date" || type === "selection"
		}),
		tabIndex: isActiveCell ? 0 : -1,
		"data-disabled": disabledCell,
		"aria-disabled": disabledCell,
		role: "button"
	}, LabelIcon && /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__label-icon` }, /* @__PURE__ */ react.default.createElement(LabelIcon, null)), label !== "" ? /* @__PURE__ */ react.default.createElement("span", { className: (0, import_classnames.default)(`${blockClass}__inline-edit-button-label`, {
		[`${blockClass}__inline-edit-button-label-with-icon`]: !nonEditCell,
		[`${blockClass}__defaultStringRenderer--multiline`]: columnConfig?.multiLineWrap
	}) }, label) : /* @__PURE__ */ react.default.createElement("span", { className: `${blockClass}__placeholder` }, placeholder), !nonEditCell && Icon && /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__inline-edit-button-icon` }, /* @__PURE__ */ react.default.createElement(Icon, null)));
};
InlineEditButton.propTypes = {
	columnConfig: prop_types.default.object,
	disabledCell: prop_types.default.bool,
	isActiveCell: prop_types.default.bool,
	label: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.number]),
	labelIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
	nonEditCell: prop_types.default.bool,
	placeholder: prop_types.default.string,
	renderIcon: prop_types.default.oneOfType([prop_types.default.func, prop_types.default.object]),
	type: prop_types.default.oneOf([
		"text",
		"number",
		"selection",
		"date",
		"checkbox"
	]),
	value: prop_types.default.oneOfType([prop_types.default.string, prop_types.default.node])
};
//#endregion
exports.InlineEditButton = InlineEditButton;
