Liferay.Loader.define("product-navigation-control-menu@6.0.52/js/TabItem",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./AddPanel","./addPortlet","./constants/layoutDataItemTypes","./useDragAndDrop"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=f(a("@frontend-taglib-clay$clayui/button")),n=f(a("@frontend-taglib-clay$clayui/icon")),d=f(a("liferay!frontend-js-react-web$classnames")),r=(f(a("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();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 d=l?Object.getOwnPropertyDescriptor(e,n):null;d&&(d.get||d.set)?Object.defineProperty(a,n,d):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),o=a("./AddPanel"),i=f(a("./addPortlet")),s=a("./constants/layoutDataItemTypes"),c=a("./useDragAndDrop");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function f(e){return e&&e.__esModule?e:{default:e}}const e=({item:e,plid:t,setWidgets:a,widgets:l})=>{const n=document.querySelector(".portlet-dropzone");if((0,i.default)({item:e,plid:t,targetItem:n}),!e.data.instanceable){a((0,o.updateUsedWidget)({item:e,widgets:l}))}};var p=({item:t})=>{const{plid:a,setWidgets:i,widgets:u}=(0,r.useContext)(o.AddPanelContext),f=t.type===s.LAYOUT_DATA_ITEM_TYPES.content,p="".concat(Liferay.Language.get("add")," ").concat(t.label),{sourceRef:y}=(0,c.useDragSymbol)({data:t.data,icon:t.icon,label:t.label,portletId:t.itemId,type:t.type});return r.default.createElement("li",{className:(0,d.default)("sidebar-body__add-panel__tab-item",{disabled:t.disabled,multiline:f,"sidebar-body__add-panel__tab-portlet-item":t.data.portletItemId}),ref:t.disabled?null:y},r.default.createElement("div",{className:"sidebar-body__add-panel__tab-item-body"},r.default.createElement("div",{className:"icon"},r.default.createElement(n.default,{symbol:t.icon})),r.default.createElement("div",{className:"text"},r.default.createElement("div",{className:"text-truncate title"},t.label),f&&r.default.createElement("div",{className:"subtitle text-truncate"},t.category))),!t.disabled&&r.default.createElement(l.default,{className:"btn-monospaced sidebar-body__add-panel__tab-item-add",displayType:"unstyled",onClick:()=>e({item:t,plid:a,setWidgets:i,widgets:u}),small:!0,title:p},r.default.createElement(n.default,{symbol:"plus"}),r.default.createElement("span",{className:"sr-only"},p)))};t.default=p}}));
//# sourceMappingURL=TabItem.js.map