Liferay.Loader.define("@liferay/search-experiences-web@3.0.30/sxp_blueprint_admin/js/shared/JSONSXPElement",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/list","@frontend-taglib-clay$clayui/sticker","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../schemas/sxp-query-element.schema.json","../utils/data","../utils/sxp_element/get_sxp_element_title_and_description","./ThemeContext","./sxp_element/JSONInput"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/button")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/drop-down")),r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/form")),i=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),u=_interopRequireDefault(a("@frontend-taglib-clay$clayui/list")),d=_interopRequireDefault(a("@frontend-taglib-clay$clayui/sticker")),o=_interopRequireDefault(a("liferay!frontend-js-react-web$classnames")),f=(a("liferay!frontend-js-react-web$prop-types"),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={},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]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),c=_interopRequireDefault(a("../../schemas/sxp-query-element.schema.json")),s=a("../utils/data"),m=_interopRequireDefault(a("../utils/sxp_element/get_sxp_element_title_and_description")),p=_interopRequireDefault(a("./ThemeContext")),y=_interopRequireDefault(a("./sxp_element/JSONInput"));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 JSONSXPElement({collapseAll:e,sxpElement:t,error:a={},id:g,index:_,isSubmitting:b,onDeleteSXPElement:E,prefixedId:x,readOnly:h,setFieldTouched:q=(()=>{}),setFieldValue:v=(()=>{}),touched:C={},uiConfigurationValues:O={}}){var $;const{locale:j}=(0,f.useContext)(p.default),[w,D]=(0,f.useState)(!1),[R,I]=(0,f.useState)(e),[S,L]=(0,m.default)(t,j);(0,f.useEffect)((()=>{I(e)}),[e]);const _hasError=()=>C.uiConfigurationValues&&C.uiConfigurationValues.sxpElement&&a.uiConfigurationValues&&!!a.uiConfigurationValues.sxpElement;return f.default.createElement("div",{className:"sheet sxp-element",id:x},f.default.createElement(u.default,{className:"configuration-header-list"},f.default.createElement(u.default.Item,{flex:!0},f.default.createElement(u.default.ItemField,null,f.default.createElement(d.default,{size:"md"},f.default.createElement(i.default,{symbol:(null===($=t.elementDefinition)||void 0===$?void 0:$.icon)||s.DEFAULT_SXP_ELEMENT_ICON}))),f.default.createElement(u.default.ItemField,{expand:!0},S&&f.default.createElement(u.default.ItemTitle,null,S),L&&f.default.createElement(u.default.ItemText,{subtext:!0},L)),E&&f.default.createElement(n.default,{active:w,alignmentPosition:3,onActiveChange:D,trigger:f.default.createElement(u.default.ItemField,null,f.default.createElement(l.default,{"aria-label":Liferay.Language.get("dropdown"),className:"component-action",displayType:"unstyled"},f.default.createElement(i.default,{symbol:"ellipsis-v"})))},f.default.createElement(n.default.ItemList,null,f.default.createElement(n.default.Item,{onClick:()=>E(g)},Liferay.Language.get("remove")))),f.default.createElement(u.default.ItemField,null,f.default.createElement(l.default,{"aria-label":R?Liferay.Language.get("expand"):Liferay.Language.get("collapse"),className:"component-action",displayType:"unstyled",onClick:()=>{I(!R)}},f.default.createElement(i.default,{symbol:R?"angle-right":"angle-down"}))))),!R&&f.default.createElement("div",{className:(0,o.default)("json-configuration-editor",{"has-error":_hasError()})},f.default.createElement(y.default,{autocompleteSchema:c.default,disabled:b,name:"elementInstances[".concat(_,"].uiConfigurationValues.sxpElement"),readOnly:h,setFieldTouched:q,setFieldValue:v,value:O.sxpElement||JSON.stringify(t,null,"\t")}),_hasError()&&f.default.createElement(r.default.FeedbackGroup,null,f.default.createElement(r.default.FeedbackItem,null,f.default.createElement(r.default.FeedbackIndicator,{symbol:"exclamation-full"}),a.uiConfigurationValues.sxpElement))))}var g=f.default.memo(JSONSXPElement);t.default=g}}));
//# sourceMappingURL=JSONSXPElement.js.map