Liferay.Loader.define("@liferay/analytics-settings-web@5.0.51/js/components/properties/CreatePropertyModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../utils/api","../../utils/constants","../Loading"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),l=_interopRequireWildcard(a("@frontend-taglib-clay$clayui/form")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=_interopRequireDefault(a("@frontend-taglib-clay$clayui/modal")),i=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),o=_interopRequireWildcard(a("liferay!frontend-js-react-web$react")),c=a("../../utils/api"),d=a("../../utils/constants"),f=_interopRequireDefault(a("../Loading"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=({observer:e,onCancel:t,onSubmit:a})=>{const[s,p]=(0,o.useState)(""),[y,m]=(0,o.useState)(!1),g=s.length>=d.MIN_LENGTH;return o.default.createElement(u.default,{center:!0,observer:e},o.default.createElement(l.default,{onSubmit:e=>e.preventDefault()},o.default.createElement(u.default.Header,null,Liferay.Language.get("new-property")),o.default.createElement(u.default.Body,{className:"pb-0 pt-3"},o.default.createElement(l.default.Group,{className:(0,i.default)({"has-error":s&&!g},"mb-3")},o.default.createElement("label",{htmlFor:"basicInputText"},Liferay.Language.get("property-name")),o.default.createElement(l.ClayInput,{id:"inputPropertyName",maxLength:d.MAX_LENGTH,onChange:({target:{value:e}})=>p(e),type:"text",value:s}),s&&!g&&o.default.createElement(l.default.FeedbackGroup,null,o.default.createElement(l.default.FeedbackItem,null,o.default.createElement(n.default,{className:"mr-1",symbol:"warning-full"}),o.default.createElement("span",null,Liferay.Language.get("property-name-does-not-meet-minimum-length-required")))))),o.default.createElement(u.default.Footer,{last:o.default.createElement(r.default.Group,{spaced:!0},o.default.createElement(r.default,{displayType:"secondary",onClick:t},Liferay.Language.get("cancel")),o.default.createElement(r.default,{disabled:!s||y||!g,onClick:async()=>{m(!0);const{ok:e}=await(0,c.createProperty)(s);m(!1),e&&a()}},y&&o.default.createElement(f.default,{inline:!0}),Liferay.Language.get("create")))})))};t.default=_default}}));
//# sourceMappingURL=CreatePropertyModal.js.map