Liferay.Loader.define("@liferay/frontend-data-set-web@1.0.31/management_bar/components/FiltersDropdown",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$react","../../FrontendDataSetContext","./filters/Filter"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=a("@frontend-taglib-clay$clayui/button"),n=d(a("@frontend-taglib-clay$clayui/drop-down")),r=d(a("@frontend-taglib-clay$clayui/icon")),u=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();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")),o=d(a("../../FrontendDataSetContext")),f=d(a("./filters/Filter"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function d(e){return e&&e.__esModule?e:{default:e}}var c=function(){const{filters:e}=(0,u.useContext)(o.default),[t,a]=(0,u.useState)(!1),[i,d]=(0,u.useState)(""),c=(0,u.useMemo)((()=>e.filter((e=>!e.invisible))),[e]),[s,y]=(0,u.useState)(null),m=(0,u.useMemo)((()=>c.length&&s?s&&c.find((e=>e.id===s)):null),[c,s]);return e.length?u.default.createElement(n.default,{active:t,className:"filters-dropdown",onActiveChange:a,trigger:u.default.createElement("button",{className:"btn btn-unstyled dropdown-toggle filters-dropdown-button",type:"button"},u.default.createElement("span",{className:"navbar-text-truncate"},Liferay.Language.get("filter")),u.default.createElement(r.default,{className:"ml-2",symbol:t?"caret-top":"caret-bottom"}))},s?u.default.createElement(u.default.Fragment,null,u.default.createElement("li",{className:"dropdown-subheader"},u.default.createElement(l.ClayButtonWithIcon,{className:"btn-filter-navigation",displayType:"unstyled",onClick:()=>y(null),small:!0,symbol:"angle-left"}),m.label),u.default.createElement(f.default,m)):u.default.createElement(n.default.Group,{header:Liferay.Language.get("filters")},u.default.createElement(n.default.Search,{onChange:e=>d(e.target.value),value:i}),u.default.createElement(n.default.Divider,{className:"m-0"}),c.length?u.default.createElement(n.default.ItemList,null,c.map((e=>u.default.createElement(n.default.Item,{active:void 0!==e.value,key:e.id,onClick:()=>{y(e.id)}},e.label)))):u.default.createElement(n.default.Caption,null,Liferay.Language.get("no-filters-were-found")))):null};t.default=c}}));
//# sourceMappingURL=FiltersDropdown.js.map