/**
 * 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";
import PropTypes from "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__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--datagrid`;
const InlineEditButton = ({ label, renderIcon: Icon, labelIcon: LabelIcon, placeholder, disabledCell, nonEditCell, isActiveCell, columnConfig, type }) => {
	return /* @__PURE__ */ React.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.createElement("div", { className: `${blockClass}__label-icon` }, /* @__PURE__ */ React.createElement(LabelIcon, null)), label !== "" ? /* @__PURE__ */ React.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.createElement("span", { className: `${blockClass}__placeholder` }, placeholder), !nonEditCell && Icon && /* @__PURE__ */ React.createElement("div", { className: `${blockClass}__inline-edit-button-icon` }, /* @__PURE__ */ React.createElement(Icon, null)));
};
InlineEditButton.propTypes = {
	columnConfig: PropTypes.object,
	disabledCell: PropTypes.bool,
	isActiveCell: PropTypes.bool,
	label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
	labelIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
	nonEditCell: PropTypes.bool,
	placeholder: PropTypes.string,
	renderIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
	type: PropTypes.oneOf([
		"text",
		"number",
		"selection",
		"date",
		"checkbox"
	]),
	value: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
};

//#endregion
export { InlineEditButton };