Liferay.Loader.define("segments-web@3.0.77/js/components/inputs/StringInput.es",["module","exports","require","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utils/odata.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a("@frontend-taglib-clay$clayui/form"),n=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),i=(_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(a("liferay!frontend-js-react-web$react"))),l=a("../../utils/odata.es");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class StringInput extends i.default.Component{constructor(e){super(e),_defineProperty(this,"_handleChange",(e=>{this.setState({value:e.target.value}),this.props.onChange({value:e.target.value})})),this.state={value:e.value}}componentDidMount(){this.setState({value:(0,l.unescapeSingleQuotes)(this.props.value)})}render(){const{disabled:e,options:t,propertyLabel:a,renderEmptyValueErrors:l,value:o}=this.props;return t.length?i.default.createElement(r.ClaySelectWithOption,{"aria-label":"".concat(a,": ").concat(Liferay.Language.get("select-option")),className:(0,n.default)("criterion-input form-control",{"criterion-input--error":!o}),"data-testid":"options-string",disabled:e,onChange:this._handleChange,options:t.map((e=>({disabled:e.disabled,label:e.label,value:e.value}))),value:o}):i.default.createElement("input",{"aria-label":"".concat(a,": ").concat(Liferay.Language.get("input-a-value")),className:(0,n.default)("criterion-input form-control",{"criterion-input--error":!o&&l}),"data-testid":"simple-string",disabled:e,onChange:this._handleChange,type:"text",value:this.state.value})}}_defineProperty(StringInput,"defaultProps",{options:[]});var o=StringInput;t.default=o}}));
//# sourceMappingURL=StringInput.es.js.map