Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.145/KeyValue/KeyValue.es",["module","exports","require","@frontend-taglib-clay$clayui/icon","data-engine-js-components-web","frontend-js-web","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","../Text/Text.es","../hooks/useSyncValue.es"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var r=_interopRequireDefault(t("@frontend-taglib-clay$clayui/icon")),n=t("data-engine-js-components-web"),l=t("frontend-js-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache();if(a&&a.has(e))return a.get(e);var t={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(t,n,l):t[n]=e[n]}t.default=e,a&&a.set(e,t);return t}(t("liferay!frontend-js-react-web$react")),i=t("../FieldBase/ReactFieldBase.es"),u=_interopRequireDefault(t("../Text/Text.es")),c=t("../hooks/useSyncValue.es");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _extends(){return(_extends=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function _objectWithoutProperties(e,a){if(null==e)return{};var t,r,n=function _objectWithoutPropertiesLoose(e,a){if(null==e)return{};var t,r,n={},l=Object.keys(e);for(r=0;r<l.length;r++)t=l[r],a.indexOf(t)>=0||(n[t]=e[t]);return n}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)t=l[r],a.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}const KeyValue=e=>{let{allowSpecialCharacters:a,className:t,disabled:r,onChange:l,value:i}=e,u=_objectWithoutProperties(e,["allowSpecialCharacters","className","disabled","onChange","value"]);return o.default.createElement("div",{className:"active form-text key-value-editor"},o.default.createElement("label",{className:"control-label key-value-label"},"key-value-reference-input"===t?Liferay.Language.get("field-reference"):Liferay.Language.get("field-name"),":"),o.default.createElement("input",_extends({},u,{className:"".concat(r?"disabled ":"").concat(t),onChange:({target:{value:e}})=>l(a?e:(0,n.normalizeFieldName)(e)),readOnly:r,tabIndex:r?"-1":"0",type:"text",value:i})))},Main=e=>{let{allowSpecialCharacters:a,editingLanguageId:t,generateKeyword:s,keyword:d,keywordReadOnly:f,name:y,onBlur:p,onChange:g,onClick:b,onFocus:h,onKeyDown:m,onKeywordBlur:w,onKeywordChange:v,onReferenceBlur:C,onReferenceChange:O,placeholder:j,readOnly:_,reference:k,required:L,showCloseButton:R,showKeyword:B=!1,showLabel:x,spritemap:K,value:q,visible:P}=e,N=_objectWithoutProperties(e,["allowSpecialCharacters","editingLanguageId","generateKeyword","keyword","keywordReadOnly","name","onBlur","onChange","onClick","onFocus","onKeyDown","onKeywordBlur","onKeywordChange","onReferenceBlur","onReferenceChange","placeholder","readOnly","reference","required","showCloseButton","showKeyword","showLabel","spritemap","value","visible"]);const[S,W]=(0,c.useSyncValue)(d),E=(0,o.useRef)(s);return o.default.createElement(i.FieldBase,_extends({},N,{name:y,readOnly:_,required:L,showLabel:x,spritemap:K,visible:P}),o.default.createElement(u.default,{editingLanguageId:t,name:"keyValueLabel".concat(y),onBlur:p,onChange:({target:{value:e}})=>{g(e),E.current&&v(a?e:(0,n.normalizeFieldName)(e),!0)},onFocus:h,onKeyDown:m,placeholder:j,readOnly:_,required:L,showLabel:x,spritemap:K,syncDelay:!1,value:q,visible:P}),R&&o.default.createElement("button",{"aria-label":(0,l.sub)(Liferay.Language.get("remove-x-option"),S),className:"close close-modal",onClick:b,type:"button"},o.default.createElement(r.default,{symbol:"times"})),B&&o.default.createElement(KeyValue,{allowSpecialCharacters:a,className:"key-value-input",disabled:f,onBlur:w,onChange:e=>{E.current=!1,v(e,!1),W(e)},value:S}),o.default.createElement(KeyValue,{allowSpecialCharacters:a,className:"key-value-reference-input",onBlur:C,onChange:O,value:k}))};Main.displayName="KeyValue";var s=Main;a.default=s}}));
//# sourceMappingURL=KeyValue.es.js.map