Liferay.Loader.define("segments-web@3.0.77/js/components/inputs/DateInput.es",["module","exports","require","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../utils/constants.es","../../utils/utils.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;_interopRequireDefault(a("liferay!frontend-js-react-web$prop-types"));var n=_interopRequireDefault(a("liferay!frontend-js-react-web$react")),r=a("../../utils/constants.es"),s=a("../../utils/utils.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 DateInput extends n.default.Component{constructor(...e){super(...e),_defineProperty(this,"state",{}),_defineProperty(this,"_handleDateChange",(e=>{const t=e.target.value;this.setState({value:t})})),_defineProperty(this,"_handleDateBlur",(e=>{const t=(0,s.jsDatetoYYYYMMDD)(e.target.value);"Invalid Date"!==t?this.setState({value:t},(()=>{this.props.onChange({type:r.PROPERTY_TYPES.DATE,value:t})})):this.setState({value:(0,s.jsDatetoYYYYMMDD)(new Date)},(()=>{this.props.onChange({type:r.PROPERTY_TYPES.DATE,value:(0,s.jsDatetoYYYYMMDD)(new Date)})}))}))}static getDerivedStateFromProps(e,t){let a=null;return e.value!==t.initialValue&&(a={initialValue:e.value,value:e.value}),a}render(){const{disabled:e,propertyLabel:t}=this.props,{value:a}=this.state;return n.default.createElement("div",{className:"criterion-input date-input"},n.default.createElement("input",{"aria-label":"".concat(t,": ").concat(Liferay.Language.get("select-date")),className:"form-control","data-testid":"date-input",disabled:e,onBlur:this._handleDateBlur,onChange:this._handleDateChange,type:"date",value:a}))}}var i=DateInput;t.default=i}}));
//# sourceMappingURL=DateInput.es.js.map