infinity-ui-elements 1.7.6 → 1.7.8
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.
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.stories.d.ts +1 -0
- package/dist/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/components/Table/TableBody.d.ts +1 -2
- package/dist/components/Table/TableBody.d.ts.map +1 -1
- package/dist/components/Table/TableHeader.d.ts +1 -2
- package/dist/components/Table/TableHeader.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +39 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +39 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2856,43 +2856,44 @@ const tableCellVariants = classVarianceAuthority.cva("text-body-medium-regular b
|
|
|
2856
2856
|
},
|
|
2857
2857
|
});
|
|
2858
2858
|
|
|
2859
|
-
function TableHeader({ headerGroups, enableRowSelection, enableSelectAll, showHeaderBackground, stickyHeader, size, headerClassName, isDetailPanelOpen, visibleHeadersCount, onToggleAllRows, isAllRowsSelected, isSomeRowsSelected,
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2859
|
+
function TableHeader({ headerGroups, enableRowSelection, enableSelectAll, showHeaderBackground, stickyHeader, size, headerClassName, isDetailPanelOpen, visibleHeadersCount, onToggleAllRows, isAllRowsSelected, isSomeRowsSelected, }) {
|
|
2860
|
+
const headerHeight = {
|
|
2861
|
+
small: 32,
|
|
2862
|
+
medium: 40,
|
|
2863
|
+
large: 48,
|
|
2864
|
+
}[size] ?? 40;
|
|
2865
|
+
return (jsxRuntime.jsx("thead", { className: cn(showHeaderBackground && "bg-surface-fill-neutral-moderate", stickyHeader && "sticky top-0 z-10"), children: headerGroups.map((headerGroup, groupIndex) => {
|
|
2866
|
+
const stickyTop = stickyHeader ? groupIndex * headerHeight : undefined;
|
|
2867
|
+
return (jsxRuntime.jsxs("tr", { children: [enableRowSelection && enableSelectAll && (jsxRuntime.jsx("th", { className: cn(tableHeaderVariants({ size }), showHeaderBackground && "bg-surface-fill-neutral-moderate", stickyHeader && "sticky z-20", "w-10 rounded-tl-xlarge rounded-bl-xlarge", headerClassName), style: { top: stickyTop }, children: jsxRuntime.jsx(Checkbox, { checked: isAllRowsSelected, isIndeterminate: isSomeRowsSelected, onChange: onToggleAllRows, "aria-label": "Select all rows" }) })), headerGroup.headers.map((header, index) => {
|
|
2868
|
+
const shouldHideColumn = isDetailPanelOpen && index >= visibleHeadersCount;
|
|
2869
|
+
const isLastVisibleColumn = isDetailPanelOpen
|
|
2870
|
+
? index === visibleHeadersCount - 1
|
|
2871
|
+
: index === headerGroup.headers.length - 1;
|
|
2872
|
+
return (jsxRuntime.jsx("th", { className: cn(tableHeaderVariants({ size }), showHeaderBackground &&
|
|
2873
|
+
"bg-surface-fill-neutral-moderate border-none", stickyHeader && "sticky z-20", !enableRowSelection && index === 0 && "rounded-tl-xlarge ", isLastVisibleColumn && "rounded-tr-xlarge", header.column.columnDef.meta?.headerClassName, headerClassName, "transition-all duration-300 ease-in-out", shouldHideColumn
|
|
2874
|
+
? "opacity-0 translate-x-8 pointer-events-none"
|
|
2875
|
+
: "opacity-100 translate-x-0"), style: {
|
|
2876
|
+
width: header.getSize(),
|
|
2877
|
+
minWidth: header.column.columnDef.minSize,
|
|
2878
|
+
maxWidth: header.column.columnDef.maxSize,
|
|
2879
|
+
top: stickyTop,
|
|
2880
|
+
}, children: header.isPlaceholder ? null : (jsxRuntime.jsxs("div", { className: cn("flex items-center gap-2", header.column.getCanSort() &&
|
|
2881
|
+
"cursor-pointer select-none"), onClick: header.column.getToggleSortingHandler(), children: [reactTable.flexRender(header.column.columnDef.header, header.getContext()), header.column.getCanSort() && (jsxRuntime.jsx("span", { className: "text-surface-ink-neutral-muted", children: {
|
|
2882
|
+
asc: "↑",
|
|
2883
|
+
desc: "↓",
|
|
2884
|
+
}[header.column.getIsSorted()] ?? "↕" }))] })) }, header.id));
|
|
2885
|
+
})] }, headerGroup.id));
|
|
2886
|
+
}) }));
|
|
2877
2887
|
}
|
|
2878
2888
|
|
|
2879
|
-
function TableBody({ rows, enableRowSelection, size, variant, showRowHover, cellClassName, isDetailPanelOpen, visibleHeadersCount, effectiveSelectedRowId, onRowClick, getRowClassName, handleRowClick,
|
|
2889
|
+
function TableBody({ rows, enableRowSelection, size, variant, showRowHover, cellClassName, isDetailPanelOpen, visibleHeadersCount, effectiveSelectedRowId, onRowClick, getRowClassName, handleRowClick, }) {
|
|
2880
2890
|
const [focusedCell, setFocusedCell] = React__namespace.useState(null);
|
|
2881
2891
|
const [hoveredRow, setHoveredRow] = React__namespace.useState(null);
|
|
2882
|
-
|
|
2883
|
-
if (!maxBodyHeight)
|
|
2884
|
-
return undefined;
|
|
2885
|
-
return {
|
|
2886
|
-
maxHeight: typeof maxBodyHeight === "number"
|
|
2887
|
-
? `${maxBodyHeight}px`
|
|
2888
|
-
: maxBodyHeight,
|
|
2889
|
-
};
|
|
2890
|
-
}, [maxBodyHeight]);
|
|
2891
|
-
return (jsxRuntime.jsx("tbody", { className: cn("bg-surface-fill-neutral-intense", maxBodyHeight && "block overflow-y-auto"), style: bodyStyle, children: rows.map((row) => {
|
|
2892
|
+
return (jsxRuntime.jsx("tbody", { className: cn("bg-surface-fill-neutral-intense"), children: rows.map((row) => {
|
|
2892
2893
|
const isRowSelected = row.id === effectiveSelectedRowId;
|
|
2893
2894
|
const isRowHovered = hoveredRow === row.id;
|
|
2894
2895
|
const handleClick = () => handleRowClick(row.original, row.id);
|
|
2895
|
-
return (jsxRuntime.jsxs("tr", { className: cn(
|
|
2896
|
+
return (jsxRuntime.jsxs("tr", { className: cn(variant === "striped" &&
|
|
2896
2897
|
row.index % 2 === 1 &&
|
|
2897
2898
|
"bg-surface-fill-neutral-moderate", onRowClick && "cursor-pointer", isRowSelected && "bg-action-fill-primary-faded", isRowHovered &&
|
|
2898
2899
|
showRowHover &&
|
|
@@ -2970,6 +2971,13 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
2970
2971
|
? headers.length - hideColumnsOnDetailOpen
|
|
2971
2972
|
: headers.length;
|
|
2972
2973
|
}, [isDetailPanelOpen, headers.length, hideColumnsOnDetailOpen]);
|
|
2974
|
+
const containerStyle = React__namespace.useMemo(() => {
|
|
2975
|
+
if (!maxHeight)
|
|
2976
|
+
return undefined;
|
|
2977
|
+
return {
|
|
2978
|
+
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight,
|
|
2979
|
+
};
|
|
2980
|
+
}, [maxHeight]);
|
|
2973
2981
|
// ==================== Callbacks ====================
|
|
2974
2982
|
const getRowClassName = React__namespace.useCallback((row) => {
|
|
2975
2983
|
if (typeof rowClassName === "function") {
|
|
@@ -3018,7 +3026,7 @@ function TableComponent({ className, wrapperClassName, containerClassName, varia
|
|
|
3018
3026
|
return renderDefaultEmptyState({ colSpan: table.getAllColumns().length });
|
|
3019
3027
|
};
|
|
3020
3028
|
// ==================== Render ====================
|
|
3021
|
-
return (jsxRuntime.jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsxRuntime.jsxs("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", containerClassName), children: [jsxRuntime.jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsxRuntime.jsx(TableHeader, { headerGroups: headerGroups, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, showHeaderBackground: showHeaderBackground, stickyHeader: stickyHeader, size: size || "medium", headerClassName: headerClassName, isDetailPanelOpen: isDetailPanelOpen, visibleHeadersCount: visibleHeadersCount, onToggleAllRows: (e) => table.getToggleAllRowsSelectedHandler()(e), isAllRowsSelected: table.getIsAllRowsSelected(), isSomeRowsSelected: table.getIsSomeRowsSelected()
|
|
3029
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: cn("w-full", wrapperClassName), ...props, children: jsxRuntime.jsxs("div", { className: cn("relative", enableHorizontalScroll ? "overflow-x-auto" : "overflow-x-hidden", maxHeight && "overflow-y-auto", containerClassName), style: containerStyle, children: [jsxRuntime.jsxs("table", { className: cn(tableVariants({ variant, size }), className), children: [jsxRuntime.jsx(TableHeader, { headerGroups: headerGroups, enableRowSelection: enableRowSelection, enableSelectAll: enableSelectAll, showHeaderBackground: showHeaderBackground, stickyHeader: stickyHeader, size: size || "medium", headerClassName: headerClassName, isDetailPanelOpen: isDetailPanelOpen, visibleHeadersCount: visibleHeadersCount, onToggleAllRows: (e) => table.getToggleAllRowsSelectedHandler()(e), isAllRowsSelected: table.getIsAllRowsSelected(), isSomeRowsSelected: table.getIsSomeRowsSelected() }), isLoading ? (jsxRuntime.jsx("tbody", { children: renderLoadingState() })) : !hasData ? (jsxRuntime.jsx("tbody", { children: renderEmptyState() })) : (jsxRuntime.jsx(TableBody, { rows: table.getRowModel().rows, enableRowSelection: enableRowSelection, size: size || "medium", variant: variant || "default", showRowHover: showRowHover, cellClassName: cellClassName, isDetailPanelOpen: isDetailPanelOpen, visibleHeadersCount: visibleHeadersCount, effectiveSelectedRowId: effectiveSelectedRowId, onRowClick: onRowClick, getRowClassName: getRowClassName, handleRowClick: handleRowClickInternal }))] }), detailPanel && (jsxRuntime.jsx(DetailPanel, { isOpen: isDetailPanelOpen, content: detailPanel, data: getSelectedRowData(), onClose: handleDetailPanelClose }))] }) }));
|
|
3022
3030
|
}
|
|
3023
3031
|
// ==================== Export ====================
|
|
3024
3032
|
const Table = React__namespace.forwardRef(TableComponent);
|