@payfit/unity-components
Version:
32 lines (31 loc) • 1.1 kB
JavaScript
import { Actionable as e } from "../../actionable/Actionable.js";
import { Icon as t } from "../../icon/Icon.js";
import "react";
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
//#region src/components/data-table/parts/ColumnSortHeader.tsx
function a(e) {
return "getCanSort" in e.column && typeof e.column.getCanSort == "function" && e.column.getCanSort();
}
function o({ children: a, header: o, ...s }) {
return /* @__PURE__ */ r(e, {
...s,
className: "uy:flex uy:items-center uy:gap-50",
onPress: (e) => {
o.column.getToggleSortingHandler()?.(e);
},
children: ({ isHovered: e }) => {
let s = o.column.getIsSorted();
return /* @__PURE__ */ i(n, { children: [a, o.column.getCanSort() && (s || e) ? /* @__PURE__ */ r(t, {
src: s === "asc" ? "ArrowUpOutlined" : "ArrowDownOutlined",
role: "presentation",
size: 20
}) : /* @__PURE__ */ r("span", {
"aria-hidden": "true",
className: "uy:size-250 uy:block"
})] });
}
});
}
o.displayName = "ColumnSortHeader";
//#endregion
export { o as ColumnSortHeader, a as isSortableHeader };