@carbon/ibm-products
Version:
Carbon for IBM Products
56 lines (51 loc) • 1.45 kB
JavaScript
/**
* Copyright IBM Corp. 2020, 2025
*
* 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 React = require('react');
var react = require('@carbon/react');
var index = require('../../../../_virtual/index.js');
var util = require('../../utils/util.js');
const ConditionBuilderItemText = _ref => {
let {
conditionState,
onChange,
config,
type
} = _ref;
const inputProps = {
...config,
hideLabel: true,
value: util.checkIsValid(conditionState.value) ? conditionState.value : '',
id: conditionState.property?.replace(/\s/g, ''),
onChange: evt => {
onChange(evt.target.value);
},
labelText: conditionState.property
};
return /*#__PURE__*/React.createElement("div", {
className: `${util.blockClass}__item-text`
}, type == 'textarea' ? /*#__PURE__*/React.createElement(react.TextArea, inputProps) : /*#__PURE__*/React.createElement(react.TextInput, inputProps));
};
ConditionBuilderItemText.propTypes = {
/**
* current condition object
*/
conditionState: index.default.object,
/**
* config of the current property
*/
config: index.default.object,
/**
* callback to update state oin date change
*/
onChange: index.default.func,
/**
* current input type
*/
type: index.default.string
};
exports.ConditionBuilderItemText = ConditionBuilderItemText;