@wallarm-org/design-system 1.20.3 → 1.20.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.
- package/dist/components/Table/TableBody/TableBodyCell.d.ts +3 -1
- package/dist/components/Table/TableBody/TableBodyCell.js +3 -2
- package/dist/components/Table/TableLoadingState.js +3 -1
- package/dist/components/Table/TableRow.js +17 -7
- package/dist/components/Table/TableRowExpanded.d.ts +3 -1
- package/dist/components/Table/TableRowExpanded.js +3 -2
- package/dist/components/Table/classes.d.ts +1 -0
- package/dist/components/Table/classes.js +6 -1
- package/dist/components/Table/lib/constants.d.ts +2 -2
- package/dist/components/Table/lib/constants.js +1 -1
- package/dist/components/Table/primitives/Td.js +4 -3
- package/dist/metadata/components.json +10 -2
- package/package.json +1 -1
|
@@ -6,10 +6,12 @@ interface TableBodyCellProps<T extends RowData> {
|
|
|
6
6
|
colSpan?: number;
|
|
7
7
|
className?: string;
|
|
8
8
|
disablePinnedShadow?: boolean;
|
|
9
|
+
/** Cell belongs to the table's last row — drop the bottom border, the frame draws it */
|
|
10
|
+
lastRow?: boolean;
|
|
9
11
|
dragListeners?: ReturnType<typeof useSortable>['listeners'];
|
|
10
12
|
dragAttributes?: ReturnType<typeof useSortable>['attributes'];
|
|
11
13
|
}
|
|
12
|
-
export declare function TableBodyCell<T extends RowData>({ cell, colSpan, className, disablePinnedShadow, dragListeners, dragAttributes, }: TableBodyCellProps<T>): import("react").JSX.Element;
|
|
14
|
+
export declare function TableBodyCell<T extends RowData>({ cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, }: TableBodyCellProps<T>): import("react").JSX.Element;
|
|
13
15
|
export declare namespace TableBodyCell {
|
|
14
16
|
var displayName: string;
|
|
15
17
|
}
|
|
@@ -8,7 +8,7 @@ import { TABLE_EXPAND_COLUMN_ID, getAlignClass, getExpandBorderClass, getPinning
|
|
|
8
8
|
import { Td } from "../primitives/index.js";
|
|
9
9
|
import { useTableContext } from "../TableContext/index.js";
|
|
10
10
|
import { TableMasterCellActions } from "../TableMasterCellActions.js";
|
|
11
|
-
const TableBodyCell = ({ cell, colSpan, className, disablePinnedShadow, dragListeners, dragAttributes })=>{
|
|
11
|
+
const TableBodyCell = ({ cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes })=>{
|
|
12
12
|
const { allLeafColumns, masterColumnId } = useTableContext();
|
|
13
13
|
const testId = useTestId('body-cell');
|
|
14
14
|
const column = cell.column;
|
|
@@ -61,10 +61,11 @@ const TableBodyCell = ({ cell, colSpan, className, disablePinnedShadow, dragList
|
|
|
61
61
|
};
|
|
62
62
|
return /*#__PURE__*/ jsx(Td, {
|
|
63
63
|
"data-testid": testId,
|
|
64
|
-
className: cn(getAlignClass(meta), getExpandBorderClass(isExpandColumn, cell.row.depth), isCut && 'pr-0', (isMasterTrigger || tooltipText) && 'cursor-pointer', dragListeners && 'cursor-grab active:cursor-grabbing', meta?.cellClassName, className),
|
|
64
|
+
className: cn(getAlignClass(meta), getExpandBorderClass(isExpandColumn, cell.row.depth, lastRow), isCut && 'pr-0', (isMasterTrigger || tooltipText) && 'cursor-pointer', dragListeners && 'cursor-grab active:cursor-grabbing', meta?.cellClassName, className),
|
|
65
65
|
pinned: 'start' === isPinned,
|
|
66
66
|
lastPinnedLeft: disablePinnedShadow ? false : lastLeft,
|
|
67
67
|
expanded: isExpandedToggle,
|
|
68
|
+
lastRow: lastRow,
|
|
68
69
|
ref: canDnd ? setNodeRef : void 0,
|
|
69
70
|
onClick: isMasterTrigger ? handleClick : void 0,
|
|
70
71
|
style: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { useTestId } from "../../utils/testId.js";
|
|
3
4
|
import { Skeleton } from "../Skeleton/index.js";
|
|
4
5
|
import { Td, Tr } from "./primitives/index.js";
|
|
@@ -7,6 +8,7 @@ const TableLoadingState = ({ position = 'end', count })=>{
|
|
|
7
8
|
const { table, skeletonCount } = useTableContext();
|
|
8
9
|
const testId = useTestId('start' === position ? 'loading-start' : 'loading');
|
|
9
10
|
const columns = table.getVisibleLeafColumns();
|
|
11
|
+
const lastRowIdx = (count ?? skeletonCount) - 1;
|
|
10
12
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
11
13
|
children: Array.from({
|
|
12
14
|
length: count ?? skeletonCount
|
|
@@ -16,7 +18,7 @@ const TableLoadingState = ({ position = 'end', count })=>{
|
|
|
16
18
|
"data-testid": 0 === rowIdx ? testId : void 0,
|
|
17
19
|
"data-loading-position": position,
|
|
18
20
|
children: columns.map((column)=>/*#__PURE__*/ jsx(Td, {
|
|
19
|
-
className:
|
|
21
|
+
className: cn('px-16 py-8 border-b border-r border-border-primary-light', 'end' === position && rowIdx === lastRowIdx && 'border-b-0'),
|
|
20
22
|
style: {
|
|
21
23
|
width: column.getSize()
|
|
22
24
|
},
|
|
@@ -13,12 +13,17 @@ const SYSTEM_COLUMN_IDS = new Set([
|
|
|
13
13
|
TABLE_DRAG_HANDLE_COLUMN_ID
|
|
14
14
|
]);
|
|
15
15
|
const TableRowInner = ({ row, ref, 'data-index': dataIndex })=>{
|
|
16
|
-
const { expandingEnabled, activeRowId } = useTableContext();
|
|
16
|
+
const { table, expandingEnabled, activeRowId, isLoading, renderExpandedRow } = useTableContext();
|
|
17
17
|
const testId = useTestId('row');
|
|
18
18
|
const { canDnd, isDragging, setNodeRef, style: dndStyle, attributes, listeners } = useRowDnd(row);
|
|
19
19
|
const isGroupParent = row.subRows.length > 0;
|
|
20
20
|
const isSelected = isGroupParent ? row.getIsAllSubRowsSelected() : row.getIsSelected();
|
|
21
21
|
const isPreviewActive = activeRowId === row.id;
|
|
22
|
+
const flatRows = table.getRowModel().rows;
|
|
23
|
+
const isLastTableRow = !isLoading && flatRows[flatRows.length - 1]?.id === row.id;
|
|
24
|
+
const hasExpandedContent = expandingEnabled && !!renderExpandedRow && row.getIsExpanded();
|
|
25
|
+
const isLastRow = isLastTableRow && !hasExpandedContent;
|
|
26
|
+
const isLastRowExpanded = isLastTableRow && hasExpandedContent;
|
|
22
27
|
const composedRef = useCallback((node)=>{
|
|
23
28
|
if (canDnd) setNodeRef(node);
|
|
24
29
|
if ('function' == typeof ref) ref(node);
|
|
@@ -47,15 +52,17 @@ const TableRowInner = ({ row, ref, 'data-index': dataIndex })=>{
|
|
|
47
52
|
children: [
|
|
48
53
|
systemCells.map((cell)=>/*#__PURE__*/ jsx(TableBodyCell, {
|
|
49
54
|
cell: cell,
|
|
50
|
-
disablePinnedShadow: true
|
|
55
|
+
disablePinnedShadow: true,
|
|
56
|
+
lastRow: isLastRow
|
|
51
57
|
}, cell.id)),
|
|
52
58
|
firstDataCell && /*#__PURE__*/ jsx(TableBodyCell, {
|
|
53
59
|
cell: firstDataCell,
|
|
54
60
|
className: "border-r-0",
|
|
55
|
-
disablePinnedShadow: true
|
|
61
|
+
disablePinnedShadow: true,
|
|
62
|
+
lastRow: isLastRow
|
|
56
63
|
}),
|
|
57
64
|
dataCells.slice(1).map((cell)=>/*#__PURE__*/ jsx(Td, {
|
|
58
|
-
className: cn('border-b border-border-primary-light bg-bg-surface-2 overlay', 'group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active'),
|
|
65
|
+
className: cn('border-b border-border-primary-light bg-bg-surface-2 overlay', 'group-hover/row:overlay-states-primary-hover group-data-[selected]/row:overlay-states-primary-active', isLastRow && 'border-b-0'),
|
|
59
66
|
style: {
|
|
60
67
|
width: cell.column.getSize()
|
|
61
68
|
},
|
|
@@ -64,7 +71,8 @@ const TableRowInner = ({ row, ref, 'data-index': dataIndex })=>{
|
|
|
64
71
|
]
|
|
65
72
|
}),
|
|
66
73
|
expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
67
|
-
row: row
|
|
74
|
+
row: row,
|
|
75
|
+
lastRow: isLastRowExpanded
|
|
68
76
|
})
|
|
69
77
|
]
|
|
70
78
|
});
|
|
@@ -88,13 +96,15 @@ const TableRowInner = ({ row, ref, 'data-index': dataIndex })=>{
|
|
|
88
96
|
return /*#__PURE__*/ jsx(TableBodyCell, {
|
|
89
97
|
cell: cell,
|
|
90
98
|
dragListeners: isDragHandle ? listeners : void 0,
|
|
91
|
-
dragAttributes: isDragHandle ? attributes : void 0
|
|
99
|
+
dragAttributes: isDragHandle ? attributes : void 0,
|
|
100
|
+
lastRow: isLastRow
|
|
92
101
|
}, cell.id);
|
|
93
102
|
})
|
|
94
103
|
}),
|
|
95
104
|
expandingEnabled && /*#__PURE__*/ jsx(TableRowExpanded, {
|
|
96
105
|
row: row,
|
|
97
|
-
dndStyle: dndStyle
|
|
106
|
+
dndStyle: dndStyle,
|
|
107
|
+
lastRow: isLastRowExpanded
|
|
98
108
|
})
|
|
99
109
|
]
|
|
100
110
|
});
|
|
@@ -5,8 +5,10 @@ interface TableRowExpandedProps<T extends RowData> {
|
|
|
5
5
|
row: Row<DSTableFeatures, T>;
|
|
6
6
|
/** When row DnD is active, pass the same transform style so expanded content moves with its parent row. */
|
|
7
7
|
dndStyle?: CSSProperties;
|
|
8
|
+
/** Expanded content is the table's bottom edge — drop its bottom border, the frame draws it */
|
|
9
|
+
lastRow?: boolean;
|
|
8
10
|
}
|
|
9
|
-
export declare function TableRowExpanded<T extends RowData>({ row, dndStyle, }: TableRowExpandedProps<T>): import("react").JSX.Element | null;
|
|
11
|
+
export declare function TableRowExpanded<T extends RowData>({ row, dndStyle, lastRow, }: TableRowExpandedProps<T>): import("react").JSX.Element | null;
|
|
10
12
|
export declare namespace TableRowExpanded {
|
|
11
13
|
var displayName: string;
|
|
12
14
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { useTestId } from "../../utils/testId.js";
|
|
3
4
|
import { TABLE_EXPAND_COLUMN_ID } from "./lib/index.js";
|
|
4
5
|
import { Td, Tr } from "./primitives/index.js";
|
|
5
6
|
import { useTableContext } from "./TableContext/index.js";
|
|
6
|
-
const TableRowExpanded = ({ row, dndStyle })=>{
|
|
7
|
+
const TableRowExpanded = ({ row, dndStyle, lastRow })=>{
|
|
7
8
|
const { table, renderExpandedRow } = useTableContext();
|
|
8
9
|
const testId = useTestId('row-expanded');
|
|
9
10
|
if (!row.getIsExpanded() || !renderExpandedRow) return null;
|
|
@@ -19,7 +20,7 @@ const TableRowExpanded = ({ row, dndStyle })=>{
|
|
|
19
20
|
}),
|
|
20
21
|
/*#__PURE__*/ jsx(Td, {
|
|
21
22
|
colSpan: contentColSpan,
|
|
22
|
-
className:
|
|
23
|
+
className: cn('border-b border-border-primary-light bg-bg-primary p-0', lastRow && 'border-b-0'),
|
|
23
24
|
children: /*#__PURE__*/ jsx("div", {
|
|
24
25
|
className: "px-16 py-12",
|
|
25
26
|
children: renderExpandedRow(row)
|
|
@@ -10,6 +10,7 @@ export declare const tableBodyCellVariants: (props?: ({
|
|
|
10
10
|
pinned?: boolean | null | undefined;
|
|
11
11
|
lastPinnedLeft?: boolean | null | undefined;
|
|
12
12
|
expanded?: boolean | null | undefined;
|
|
13
|
+
lastRow?: boolean | null | undefined;
|
|
13
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
14
15
|
export declare const tableContainerVariants: (props?: ({
|
|
15
16
|
virtualized?: "container" | "window" | null | undefined;
|
|
@@ -51,12 +51,17 @@ const tableBodyCellVariants = cva(cn(tableCellBase, 'px-16 py-8 text-sm text-tex
|
|
|
51
51
|
expanded: {
|
|
52
52
|
true: 'border-b-0 before:hidden',
|
|
53
53
|
false: ''
|
|
54
|
+
},
|
|
55
|
+
lastRow: {
|
|
56
|
+
true: 'border-b-0',
|
|
57
|
+
false: ''
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
defaultVariants: {
|
|
57
61
|
pinned: false,
|
|
58
62
|
lastPinnedLeft: false,
|
|
59
|
-
expanded: false
|
|
63
|
+
expanded: false,
|
|
64
|
+
lastRow: false
|
|
60
65
|
}
|
|
61
66
|
});
|
|
62
67
|
const tableContainerVariants = cva('rounded-12 border border-border-primary-light outline-none overflow-clip', {
|
|
@@ -18,7 +18,7 @@ export declare const getAlignClass: (meta?: {
|
|
|
18
18
|
align?: string;
|
|
19
19
|
sortType?: string;
|
|
20
20
|
}) => string;
|
|
21
|
-
/** Border-bottom override for the last expanded row in a depth group */
|
|
22
|
-
export declare const getExpandBorderClass: (isExpandColumn: boolean, depth: number) => string | false;
|
|
21
|
+
/** Border-bottom override for the last expanded row in a depth group (never on the table's last row) */
|
|
22
|
+
export declare const getExpandBorderClass: (isExpandColumn: boolean, depth: number, isLastRow?: boolean) => string | false;
|
|
23
23
|
/** Sort labels by sortType: [ascLabel, descLabel] */
|
|
24
24
|
export declare const SORT_LABELS: Record<string, [string, string]>;
|
|
@@ -22,7 +22,7 @@ const getAlignClass = (meta)=>{
|
|
|
22
22
|
if ('center' === align) return 'text-center';
|
|
23
23
|
return 'text-left';
|
|
24
24
|
};
|
|
25
|
-
const getExpandBorderClass = (isExpandColumn, depth)=>isExpandColumn && depth > 0 && '[tr[data-depth]:has(+_tr:not([data-depth]))_&]:!border-b [tr[data-depth]:last-child_&]:!border-b';
|
|
25
|
+
const getExpandBorderClass = (isExpandColumn, depth, isLastRow = false)=>isExpandColumn && depth > 0 && !isLastRow && '[tr[data-depth]:has(+_tr:not([data-depth]))_&]:!border-b [tr[data-depth]:last-child_&]:!border-b';
|
|
26
26
|
const SORT_LABELS = {
|
|
27
27
|
text: [
|
|
28
28
|
'A \u2192 Z',
|
|
@@ -2,14 +2,15 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../../utils/cn.js";
|
|
4
4
|
import { tableBodyCellVariants } from "../classes.js";
|
|
5
|
-
const Td = /*#__PURE__*/ forwardRef(({ className, pinned, lastPinnedLeft, expanded, ...props }, ref)=>{
|
|
6
|
-
const hasVariants = void 0 !== pinned || void 0 !== lastPinnedLeft || void 0 !== expanded;
|
|
5
|
+
const Td = /*#__PURE__*/ forwardRef(({ className, pinned, lastPinnedLeft, expanded, lastRow, ...props }, ref)=>{
|
|
6
|
+
const hasVariants = void 0 !== pinned || void 0 !== lastPinnedLeft || void 0 !== expanded || void 0 !== lastRow;
|
|
7
7
|
return /*#__PURE__*/ jsx("td", {
|
|
8
8
|
ref: ref,
|
|
9
9
|
className: cn(hasVariants ? tableBodyCellVariants({
|
|
10
10
|
pinned,
|
|
11
11
|
lastPinnedLeft,
|
|
12
|
-
expanded
|
|
12
|
+
expanded,
|
|
13
|
+
lastRow
|
|
13
14
|
}) : void 0, className),
|
|
14
15
|
...props
|
|
15
16
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.20.
|
|
3
|
-
"generatedAt": "2026-09-
|
|
2
|
+
"version": "1.20.3",
|
|
3
|
+
"generatedAt": "2026-09-16T12:28:29.151Z",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Accordion",
|
|
@@ -79440,6 +79440,14 @@
|
|
|
79440
79440
|
],
|
|
79441
79441
|
"defaultValue": "false"
|
|
79442
79442
|
},
|
|
79443
|
+
{
|
|
79444
|
+
"name": "lastRow",
|
|
79445
|
+
"options": [
|
|
79446
|
+
"true",
|
|
79447
|
+
"false"
|
|
79448
|
+
],
|
|
79449
|
+
"defaultValue": "false"
|
|
79450
|
+
},
|
|
79443
79451
|
{
|
|
79444
79452
|
"name": "virtualized",
|
|
79445
79453
|
"options": [
|