Liferay.Loader.define("layout-seo-web@2.0.47/js/seo/display_page_templates/components/MappingPanel",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../constants","../hooks/useOnClickOutside"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=d(a("@frontend-taglib-clay$clayui/button")),n=d(a("@frontend-taglib-clay$clayui/form")),r=u(a("liferay!frontend-js-react-web$classnames")),o=(a("liferay!frontend-js-react-web$prop-types"),d(a("liferay!frontend-js-react-web$react"))),c=a("../constants"),i=u(a("../hooks/useOnClickOutside"));function u(e){return e&&e.__esModule?e:{default:e}}function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}const e=()=>{},s=({key:e,label:t})=>({label:t,value:e});var p=function({isActive:t=!1,name:a,fields:u,field:f,fieldType:d,source:p,onSelect:y=e,clearSelectionOnClose:m=!1}){const[g,b]=(0,o.useState)(!1),[v,k]=(0,o.useState)((null==f?void 0:f.key)||u[0].key),O=(0,o.useRef)(null);return(0,i.default)([O.current],(()=>{g&&(b(!1),m&&k(u[0].key))})),o.default.createElement("div",{className:"dpt-mapping-panel-wrapper",ref:O},o.default.createElement(l.ClayButtonWithIcon,{className:(0,r.default)("dpt-mapping-btn",{active:t}),displayType:"secondary",monospaced:!0,onClick:()=>{b((e=>!e))},symbol:"bolt",title:Liferay.Language.get("map")}),g&&o.default.createElement("div",{className:"dpt-mapping-panel popover popover-scrollable",onClick:e=>e.stopPropagation()},o.default.createElement("div",{className:"popover-body"},o.default.createElement(n.default.Group,{small:!0},o.default.createElement("label",{htmlFor:"".concat(a,"_mappingSelectorSource")},Liferay.Language.get("source")),o.default.createElement(n.ClayInput,{id:"".concat(a,"_mappingSelectorSource"),readOnly:!0,value:p.initialValue})),o.default.createElement(n.default.Group,{small:!0},o.default.createElement("label",{htmlFor:"".concat(a,"_mappingSelectorFieldSelect")},Liferay.Language.get("field")),o.default.createElement(n.ClaySelectWithOption,{id:"".concat(a,"_mappingSelectorFieldSelect"),onChange:e=>{const{value:t}=e.target,a=u.find((({key:e})=>e===t));k(a.key)},options:u.map(s),value:v})),o.default.createElement(l.default,{block:!0,disabled:(null==f?void 0:f.key)===v,displayType:"primary",onClick:()=>{const e=u.find((({key:e})=>e===v));y({field:e,source:p})}},d===c.FIELD_TYPES.TEXT?Liferay.Language.get("add-field"):Liferay.Language.get("map-content")))))};t.default=p}}));
//# sourceMappingURL=MappingPanel.js.map