Liferay.Loader.define("frontend-taglib-clay@9.1.10/management_toolbar/FilterOrderControls",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/management-toolbar","liferay!frontend-js-react-web$classnames","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")),i=f(a("@frontend-taglib-clay$clayui/management-toolbar")),o=f(a("liferay!frontend-js-react-web$classnames")),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=s();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")),d=f(a("./FeatureFlagContext")),u=f(a("./LinkOrButton"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=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 y(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){p(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 p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var b=({disabled:e,filterDropdownItems:t,onFilterDropdownItemClick:a,onOrderDropdownItemClick:s,orderDropdownItems:f=[],sortingOrder:m,sortingURL:p})=>{const{showDesignImprovements:b}=(0,c.useContext)(d.default),g=!f||f.length<=1;return c.default.createElement(c.default.Fragment,null,t&&c.default.createElement(i.default.Item,null,c.default.createElement(r.ClayDropDownWithItems,{items:t.map((e=>e.items?y(y({},e),{},{items:e.items.map((e=>y(y({},e),{},{onClick(t){a(t,{item:e})}})))}):y(y({},e),{},{onClick:t=>a(t,{item:e})}))),trigger:c.default.createElement(n.default,{className:(0,o.default)("nav-link",{"ml-2 mr-2":b}),disabled:e,displayType:"unstyled"},c.default.createElement("span",{className:"navbar-breakpoint-down-d-none"},b&&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"},b?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:b&&Liferay.Language.get("show-filter-options")},c.default.createElement(l.default,{symbol:"filter"})))})),b&&!g&&c.default.createElement(i.default.Item,null,c.default.createElement(r.ClayDropDownWithItems,{items:[...f.map((e=>y(y({},e),{},{onClick:t=>{s(t,{item:e})}}))),{type:"divider"},{active:"asc"===m,href:"asc"===m?null:p,label:Liferay.Language.get("ascending"),type:"item"},{active:"asc"!==m,href:"asc"!==m?null:p,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"})))})),(!b&&p||b&&p&&g)&&c.default.createElement(i.default.Item,null,c.default.createElement(u.default,{className:"nav-link nav-link-monospaced",disabled:e,displayType:"unstyled",href:p,symbol:(0,o.default)({"order-list-down":"desc"===m,"order-list-up":"asc"===m||null===m}),title:b?Liferay.Language.get("reverse-order-direction"):Liferay.Language.get("reverse-sort-direction")})))};t.default=b}}));
//# sourceMappingURL=FilterOrderControls.js.map