Liferay.Loader.define("data-engine-js-components-web@1.0.55/js/custom/form/renderer/SuccessVariant.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/layout","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../../../core/actions/eventTypes.es","../../../core/hooks/useForm.es","../../../utils/i18n.es","../eventTypes.es"],(function(e,t,a){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.Container=y,t.Page=g;var r=a("@frontend-taglib-clay$clayui/button"),l=a("@frontend-taglib-clay$clayui/drop-down"),o=(n=a("@frontend-taglib-clay$clayui/layout"))&&n.__esModule?n:{default:n},i=a("@liferay/frontend-js-react-web"),s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var a={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),u=a("../../../core/actions/eventTypes.es"),c=a("../../../core/hooks/useForm.es"),d=a("../../../utils/i18n.es"),f=a("../eventTypes.es");function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function y({children:e,pages:t,strings:a={}}){var n;const{editingLanguageId:i}=(0,c.useFormState)(),d=(0,c.useForm)();return s.default.createElement("div",{className:"page"},s.default.createElement(o.default.Sheet,{className:"ddm-page-success-layout simple-page"},s.default.createElement("div",{className:"form-builder-layout"},s.default.createElement("h5",{className:"pagination"},null!==(n=a["success-page"])&&void 0!==n?n:Liferay.Language.get("success-page")),e)),s.default.createElement("div",{className:"ddm-paginated-builder-dropdown"},s.default.createElement(l.ClayDropDownWithItems,{className:"dropdown-action",items:[{label:Liferay.Language.get("remove-success-page"),onClick:()=>{d({payload:{body:{[i]:""},enabled:!1,title:{[i]:""}},type:f.EVENT_TYPES.SUCCESS_PAGE}),d({payload:{activePage:t.length-1},type:u.EVENT_TYPES.PAGE.CHANGE})}}],trigger:s.default.createElement(r.ClayButtonWithIcon,{displayType:"unstyled",symbol:"ellipsis-v",title:Liferay.Language.get("page-options")})})))}function g({page:{successPageSettings:e}}){const{defaultLanguageId:t,editingLanguageId:a}=(0,c.useFormState)(),n=(0,c.useForm)(),r=(0,i.usePrevious)(a),{initialBody:l,initialTitle:o}={initialBody:e.body&&(e.body[a]||e.body[t])||"",initialTitle:e.title&&(e.title[a]||e.title[t])||""},[u,p]=(0,s.useState)(l),[y,g]=(0,s.useState)(o);(0,s.useEffect)((()=>{r!==a&&(p(l),g(o))}),[a,l,o,r]);const m=(t,r)=>{n({payload:(0,d.setValue)(e,a,r,t.target.value),type:f.EVENT_TYPES.SUCCESS_PAGE})};return s.default.createElement("div",{className:"active ddm-form-page form-builder-success-page lfr-ddm-form-page"},s.default.createElement("input",{className:"form-builder-page-header-title form-control p-0",maxLength:"120",onChange:e=>{g(e.target.value),m(e,"title")},type:"text",value:y}),s.default.createElement("input",{className:"form-builder-page-header-description form-control p-0",maxLength:"120",onChange:e=>{p(e.target.value),m(e,"body")},type:"text",value:u}))}y.displayName="SuccessVariant.Container",g.displayName="SuccessVariant.Page"}}));
//# sourceMappingURL=SuccessVariant.es.js.map