import{f as m,r as n,j as s,i as d}from"./index-B-YXshIJ.js";import{d as u,D as g}from"./Icons-C9UDsqhh.js";import{I as b}from"./InlineSelect-DaSksT58.js";const j=({sortByList:a,defaultSortBy:o=a[0],defaultSortDirection:t="desc"})=>{const[c,i]=m("sort",d),[x,l]=m("sortBy",d),r=n.useMemo(()=>c||t,[t,c]),p=n.useCallback(e=>l(e===o?void 0:e,!0),[o,l]),h=n.useCallback(()=>{const e=r==="asc"?"desc":"asc";return i(e===t?void 0:e,!0)},[r,t,i]);return s.jsxs("div",{className:"my-6 ml-1 flex flex-row gap-2 items-center",children:[s.jsx("h4",{className:"text-theme-helptext",children:"Sort by"}),s.jsxs("div",{className:"flex items-center",children:[s.jsx(b,{className:"text-base",onChange:p,options:a.map(e=>({label:e,value:e})),value:x||o}),s.jsx("button",{className:"text-base font-medium text-gray-500 flex items-center justify-end\n         cursor-pointer ml-1 hover:bg-white hover:shadow p-1 rounded border border-transparent hover:border-gray-400",onClick:h,"data-tooltip-id":"react-tooltip","data-tooltip-content":"Sort ".concat(r==="asc"?"descending":"ascending"),children:r==="asc"?s.jsx(u,{}):s.jsx(g,{})})]})]})},y=j;export{y as S};
