Liferay.Loader.define("frontend-taglib-clay@12.0.6/management_toolbar/FilterOrderControls",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","frontend-js-components-web","liferay!frontend-js-react-web$react","./FeatureFlagContext","./LinkOrButton"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=f(a("@frontend-taglib-clay$clayui/button")),r=a("@frontend-taglib-clay$clayui/drop-down"),l=f(a("@frontend-taglib-clay$clayui/icon")),o=f(a("liferay!frontend-js-react-web$classnames")),i=a("frontend-js-components-web"),c=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={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var l=n?Object.getOwnPropertyDescriptor(e,r):null;l&&(l.get||l.set)?Object.defineProperty(a,r,l):a[r]=e[r]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),s=f(a("./FeatureFlagContext")),d=f(a("./LinkOrButton"));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}}function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function p(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){b(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var y=({disabled:e,filterDropdownItems:t,onFilterDropdownItemClick:a,onOrderDropdownItemClick:u,orderDropdownItems:f=[],sortingOrder:m,sortingURL:b})=>{const{showDesignImprovements:y}=(0,c.useContext)(s.default),g=!f||f.length<=1;return c.default.createElement(c.default.Fragment,null,t&&c.default.createElement(i.ManagementToolbar.Item,null,c.default.createElement(r.ClayDropDownWithItems,{items:t.map((e=>e.items?p(p({},e),{},{items:e.items.map((e=>p(p({},e),{},{onClick(t){a(t,{item:e})}})))}):p(p({},e),{},{onClick:t=>a(t,{item:e})}))),trigger:c.default.createElement(n.default,{className:(0,o.default)("nav-link",{"ml-2 mr-2":y}),disabled:e,displayType:"unstyled"},c.default.createElement("span",{className:"navbar-breakpoint-down-d-none"},y&&c.default.createElement("span",{className:"inline-item inline-item-before"},c.default.createElement(l.default,{symbol:"filter"})),c.default.createElement("span",{className:"navbar-text-truncate"},y?Liferay.Language.get("filter"):Liferay.Language.get("filter-and-order")),c.default.createElement(l.default,{className:"inline-item inline-item-after",symbol:"caret-bottom"})),c.default.createElement("span",{className:"navbar-breakpoint-d-none",title:y?Liferay.Language.get("show-filter-options"):void 0},c.default.createElement(l.default,{symbol:"filter"})))})),y&&!g&&c.default.createElement(i.ManagementToolbar.Item,null,c.default.createElement(r.ClayDropDownWithItems,{items:[...f.map((e=>p(p({},e),{},{onClick:t=>{u(t,{item:e})}}))),{type:"divider"},{active:"asc"===m,href:"asc"===m?null:b,label:Liferay.Language.get("ascending"),type:"item"},{active:"asc"!==m,href:"asc"!==m?null:b,label:Liferay.Language.get("descending"),type:"item"}],trigger:c.default.createElement(n.default,{className:"ml-2 mr-2 nav-link",disabled:e,displayType:"unstyled"},c.default.createElement("span",{className:"navbar-breakpoint-down-d-none"},c.default.createElement("span",{className:"inline-item inline-item-before"},c.default.createElement(l.default,{symbol:"desc"===m?"order-list-down":"order-list-up"})),c.default.createElement("span",{className:"navbar-text-truncate"},Liferay.Language.get("order")),c.default.createElement(l.default,{className:"inline-item inline-item-after",symbol:"caret-bottom"})),c.default.createElement("span",{className:"navbar-breakpoint-d-none",title:Liferay.Language.get("show-order-options")},c.default.createElement(l.default,{symbol:"desc"===m?"order-list-down":"order-list-up"})))})),(!y&&b||y&&b&&g)&&c.default.createElement(i.ManagementToolbar.Item,null,c.default.createElement(d.default,{className:"nav-link nav-link-monospaced",disabled:e,displayType:"unstyled",href:b,symbol:(0,o.default)({"order-list-down":"desc"===m,"order-list-up":"asc"===m||null===m}),title:y?Liferay.Language.get("reverse-order-direction"):Liferay.Language.get("reverse-sort-direction")})))};t.default=y}}));
//# sourceMappingURL=FilterOrderControls.js.map