/**
 * 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_util = require("../../utils/util.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let _carbon_react = require("@carbon/react");
//#region src/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.tsx
/**
* 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.
*/
const ConditionBuilderItemText = ({ conditionState, onChange, config, type }) => {
	const inputProps = {
		...config,
		hideLabel: true,
		value: require_util.checkIsValid(conditionState.value) ? conditionState.value : "",
		id: conditionState.property?.replace(/\s/g, ""),
		onChange: (evt) => {
			onChange(evt.target.value);
		},
		labelText: conditionState.property
	};
	return /* @__PURE__ */ react.default.createElement("div", { className: `${require_util.blockClass}__item-text` }, type == "textarea" ? /* @__PURE__ */ react.default.createElement(_carbon_react.TextArea, inputProps) : /* @__PURE__ */ react.default.createElement(_carbon_react.TextInput, inputProps));
};
ConditionBuilderItemText.propTypes = {
	/**
	* current condition object
	*/
	conditionState: prop_types.default.object,
	/**
	* config of the current property
	*/
	config: prop_types.default.object,
	/**
	* callback to update state oin date change
	*/
	onChange: prop_types.default.func,
	/**
	* current input type
	*/
	type: prop_types.default.string
};
//#endregion
exports.ConditionBuilderItemText = ConditionBuilderItemText;
