@jackbernnie/hiyf 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -40,6 +40,8 @@ export interface TableColumn<T> {
|
|
|
40
40
|
filterValue?: string;
|
|
41
41
|
/** Called when a filter option is selected. */
|
|
42
42
|
onFilterChange?: (value: string) => void;
|
|
43
|
+
/** Optional explanatory text shown in a hover tooltip via an info icon next to the header. */
|
|
44
|
+
headerInfo?: string;
|
|
43
45
|
/**
|
|
44
46
|
* Optional custom renderer for this column's cell.
|
|
45
47
|
* Receives the full row object and returns a React node.
|
package/dist/components/Table.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { Table as Table$1, TableCaption, TableHeader, TableRow, TableHead, TableBody, TableCell } from './ui/table.js';
|
|
4
4
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './ui/dropdown-menu.js';
|
|
5
|
+
import { Tooltip } from './Tooltip.js';
|
|
6
|
+
import { HugeiconsIcon } from '@hugeicons/react';
|
|
7
|
+
import { InformationCircleIcon } from '@hugeicons/core-free-icons';
|
|
5
8
|
|
|
6
9
|
const ALIGN_CLASS = {
|
|
7
10
|
left: "text-left",
|
|
@@ -124,12 +127,13 @@ function HeaderContent({
|
|
|
124
127
|
onSortChange
|
|
125
128
|
}) {
|
|
126
129
|
const hasMenu = column.sortable || column.filterOptions && column.filterOptions.length > 0;
|
|
127
|
-
if (!hasMenu) {
|
|
130
|
+
if (!hasMenu && !column.headerInfo) {
|
|
128
131
|
return /* @__PURE__ */ jsx(Fragment, { children: column.header });
|
|
129
132
|
}
|
|
130
133
|
return /* @__PURE__ */ jsxs("div", { className: `flex items-center gap-1 ${HEADER_FLEX_CLASS[column.align ?? "left"]}`, children: [
|
|
131
134
|
/* @__PURE__ */ jsx("span", { children: column.header }),
|
|
132
|
-
/* @__PURE__ */ jsx(
|
|
135
|
+
column.headerInfo ? /* @__PURE__ */ jsx(Tooltip, { content: column.headerInfo, children: /* @__PURE__ */ jsx("span", { className: "inline-flex cursor-help text-muted-foreground/70 transition-colors hover:text-foreground", children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: InformationCircleIcon, size: 14 }) }) }) : null,
|
|
136
|
+
hasMenu ? /* @__PURE__ */ jsx(HeaderMenu, { column, sort, onSortChange }) : null
|
|
133
137
|
] });
|
|
134
138
|
}
|
|
135
139
|
function rowClickIsFromInteractiveElement(event) {
|
package/package.json
CHANGED