@neasg/design-system 0.4.15 → 0.4.17

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/index.d.ts CHANGED
@@ -132,7 +132,7 @@ export type { TableColumnVisibilityMenuProps } from "./table-column-visibility";
132
132
  export { useTableSort } from "./use-table-sort";
133
133
  export type { UseTableSortOptions, UseTableSortReturn, } from "./use-table-sort";
134
134
  export { Table, TableRoot, TableContainer, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableRowSkeleton, TABLE_SKELETON_PRESETS, } from "./table";
135
- export type { TableColumn, TableColumnWidths, TableProps, TableResizeMode, TableRowTone, TableSortDirection, TableSortingProps, TableSkeletonConfig, TableRowSkeletonProps, } from "./table";
135
+ export type { TableColumn, TableColumnWidths, TableProps, TableResizeMode, TableRowExpansionProps, TableRowTone, TableSortDirection, TableSortingProps, TableSkeletonConfig, TableRowSkeletonProps, } from "./table";
136
136
  export { Tabs, TabsRoot, TabWithDropdown, type TabsItem, type TabsItemLabel, type TabsItemLabelProps, type TabsProps, TabsList, TabsTrigger, TabsContent, type TabWithDropdownProps, useTabsContext, type TabDropdownSection, } from "./tabs";
137
137
  export { Tooltip, TooltipRoot, TooltipTrigger, TooltipContent, TooltipProvider, type TooltipProps, } from "./tooltip";
138
138
  export { Toaster, toast } from "./toaster";
package/dist/table.d.ts CHANGED
@@ -94,6 +94,20 @@ export interface TableSortingProps {
94
94
  direction: TableSortDirection;
95
95
  onSort: (field: string) => void;
96
96
  }
97
+ export interface TableRowExpansionProps<Row> {
98
+ /** Renders the full-width content below an expanded parent row. */
99
+ renderExpandedContent: (row: Row, rowIndex: number) => React.ReactNode;
100
+ /** Controls which rows can be expanded. Every row is expandable by default. */
101
+ isRowExpandable?: (row: Row, rowIndex: number) => boolean;
102
+ /** Controlled list of expanded row keys. */
103
+ expandedRowKeys?: readonly string[];
104
+ /** Initially expanded row keys for uncontrolled usage. */
105
+ defaultExpandedRowKeys?: readonly string[];
106
+ /** Called when a row expansion toggle changes the expanded key list. */
107
+ onExpandedRowKeysChange?: (expandedRowKeys: string[]) => void;
108
+ /** Accessible label for a row's expansion toggle. */
109
+ getToggleLabel?: (row: Row, rowIndex: number, expanded: boolean) => string;
110
+ }
97
111
  interface SortableTableHeadProps<T extends string> {
98
112
  field: T;
99
113
  children: React.ReactNode;
@@ -159,8 +173,10 @@ export interface TableProps<Row> extends Omit<React.HTMLAttributes<HTMLDivElemen
159
173
  emptyStateMinHeight?: React.CSSProperties["minHeight"];
160
174
  /** When true, applies alternating row backgrounds for easier scanning. */
161
175
  striped?: boolean;
176
+ /** Adds a disclosure column and full-width expandable content for nested tables or row details. */
177
+ rowExpansion?: TableRowExpansionProps<Row>;
162
178
  /** When set, rows become interactive: cursor-pointer, hover highlight, and click handling. */
163
179
  onRowClick?: (row: Row, index: number) => void;
164
180
  }
165
- declare function Table<Row>({ columns, rows, getRowKey, emptyState, toolbar, caption, className, containerClassName, tableClassName, rowClassName, rowTone, maxHeight, minHeight, sorting, pagination, loading, loadingRows, visibleColumnKeys, resizableColumns, columnResizeMode, columnWidths, defaultColumnWidths, onColumnWidthsChange, renderColumnResizeHandle, tableLayout, centerEmptyState, emptyStateMinHeight, striped, onRowClick, onScroll, style, ...props }: TableProps<Row>): import("react/jsx-runtime").JSX.Element;
181
+ declare function Table<Row>({ columns, rows, getRowKey, emptyState, toolbar, caption, className, containerClassName, tableClassName, rowClassName, rowTone, maxHeight, minHeight, sorting, pagination, loading, loadingRows, visibleColumnKeys, resizableColumns, columnResizeMode, columnWidths, defaultColumnWidths, onColumnWidthsChange, renderColumnResizeHandle, tableLayout, centerEmptyState, emptyStateMinHeight, striped, rowExpansion, onRowClick, onScroll, style, ...props }: TableProps<Row>): import("react/jsx-runtime").JSX.Element;
166
182
  export { Table, TableRoot, TableContainer, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, SortableTableHead, TableRowSkeleton, };
package/dist/table.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { ArrowUpDown } from "lucide-react";
3
+ import { ArrowUpDown, ChevronRight } from "lucide-react";
4
4
  import { ArrowDownIcon } from "./animated-icons/arrow-down";
5
5
  import { ArrowUpIcon } from "./animated-icons/arrow-up";
6
6
  import { EmptyState } from "./empty-state";
@@ -14,6 +14,7 @@ TableContainer.displayName = "TableContainer";
14
14
  const DEFAULT_COLUMN_RESIZE_MIN_WIDTH = 64;
15
15
  const DEFAULT_COLUMN_RESIZE_START_WIDTH = 160;
16
16
  const COLUMN_RESIZE_KEYBOARD_STEP = 16;
17
+ const TABLE_EXPANSION_COLUMN_WIDTH = 48;
17
18
  const TABLE_MIN_WIDTH_CSS_VAR = "--table-min-width";
18
19
  const DEFAULT_TABLE_MIN_HEIGHT = "var(--table-min-height, var(--app-table-min-height, 24rem))";
19
20
  const DEFAULT_CENTERED_EMPTY_STATE_MIN_HEIGHT = "calc(var(--table-min-height, var(--app-table-min-height, 24rem)) - var(--table-empty-state-offset, var(--app-table-empty-state-offset, 5.75rem)))";
@@ -109,7 +110,7 @@ function hasColumnWidthOverrides(columnWidths) {
109
110
  }
110
111
  function getMeasuredColumnWidths(resizeHandle, columns, fallbackColumnWidths) {
111
112
  const table = resizeHandle.closest("table");
112
- const headerCells = table === null || table === void 0 ? void 0 : table.querySelectorAll("thead th");
113
+ const headerCells = table === null || table === void 0 ? void 0 : table.querySelectorAll('thead th:not([data-slot="table-expansion-head"])');
113
114
  if (!(headerCells === null || headerCells === void 0 ? void 0 : headerCells.length)) {
114
115
  return fallbackColumnWidths;
115
116
  }
@@ -327,8 +328,9 @@ function getVisibleColumns(columns, visibleColumnKeys) {
327
328
  function isStickyResizeBoundary(column, nextColumn) {
328
329
  return Boolean(column.sticky === "right" || nextColumn.sticky);
329
330
  }
330
- function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { message: "No data available", description: "There are no rows to display in this table yet.", className: "border-0 bg-transparent px-0 py-6" })), toolbar, caption, className, containerClassName, tableClassName, rowClassName, rowTone, maxHeight, minHeight, sorting, pagination, loading = false, loadingRows = 5, visibleColumnKeys, resizableColumns = false, columnResizeMode = "pair", columnWidths, defaultColumnWidths, onColumnWidthsChange, renderColumnResizeHandle, tableLayout, centerEmptyState = false, emptyStateMinHeight = DEFAULT_CENTERED_EMPTY_STATE_MIN_HEIGHT, striped = false, onRowClick, onScroll, style, ...props }) {
331
+ function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { message: "No data available", description: "There are no rows to display in this table yet.", className: "border-0 bg-transparent px-0 py-6" })), toolbar, caption, className, containerClassName, tableClassName, rowClassName, rowTone, maxHeight, minHeight, sorting, pagination, loading = false, loadingRows = 5, visibleColumnKeys, resizableColumns = false, columnResizeMode = "pair", columnWidths, defaultColumnWidths, onColumnWidthsChange, renderColumnResizeHandle, tableLayout, centerEmptyState = false, emptyStateMinHeight = DEFAULT_CENTERED_EMPTY_STATE_MIN_HEIGHT, striped = false, rowExpansion, onRowClick, onScroll, style, ...props }) {
331
332
  const visibleColumns = getVisibleColumns(columns, visibleColumnKeys);
333
+ const hasExpansionColumn = Boolean(rowExpansion);
332
334
  const isGrowResizeMode = columnResizeMode === "grow";
333
335
  const isColumnResizingEnabled = resizableColumns || visibleColumns.some((column) => column.resizable);
334
336
  // Use auto layout by default so the browser can grow a column to contain its
@@ -339,7 +341,8 @@ function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { mess
339
341
  const resolvedColumnWidths = columnWidths !== null && columnWidths !== void 0 ? columnWidths : uncontrolledColumnWidths;
340
342
  const hasResolvedColumnWidths = hasColumnWidthOverrides(resolvedColumnWidths);
341
343
  const growTableMinWidth = isGrowResizeMode
342
- ? getTableMinWidth(visibleColumns, resolvedColumnWidths)
344
+ ? getTableMinWidth(visibleColumns, resolvedColumnWidths) +
345
+ (hasExpansionColumn ? TABLE_EXPANSION_COLUMN_WIDTH : 0)
343
346
  : undefined;
344
347
  const resolvedMinHeight = minHeight !== null && minHeight !== void 0 ? minHeight : (centerEmptyState ? DEFAULT_TABLE_MIN_HEIGHT : undefined);
345
348
  const columnWidthsRef = React.useRef(resolvedColumnWidths);
@@ -349,6 +352,10 @@ function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { mess
349
352
  left: false,
350
353
  right: false,
351
354
  });
355
+ const [uncontrolledExpandedRowKeys, setUncontrolledExpandedRowKeys] = React.useState(() => { var _a; return new Set((_a = rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.defaultExpandedRowKeys) !== null && _a !== void 0 ? _a : []); });
356
+ const controlledExpandedRowKeys = rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.expandedRowKeys;
357
+ const resolvedExpandedRowKeys = new Set(controlledExpandedRowKeys !== null && controlledExpandedRowKeys !== void 0 ? controlledExpandedRowKeys : uncontrolledExpandedRowKeys);
358
+ const expansionIdPrefix = React.useId().replace(/:/g, "");
352
359
  const updateStickyScrollState = React.useCallback((element = tableContainerRef.current) => {
353
360
  if (!element) {
354
361
  return;
@@ -516,6 +523,20 @@ function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { mess
516
523
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(event);
517
524
  updateStickyScrollState(event.currentTarget);
518
525
  }, [onScroll, updateStickyScrollState]);
526
+ const toggleExpandedRow = React.useCallback((rowKey) => {
527
+ var _a;
528
+ const nextExpandedRowKeys = new Set(controlledExpandedRowKeys !== null && controlledExpandedRowKeys !== void 0 ? controlledExpandedRowKeys : uncontrolledExpandedRowKeys);
529
+ if (nextExpandedRowKeys.has(rowKey)) {
530
+ nextExpandedRowKeys.delete(rowKey);
531
+ }
532
+ else {
533
+ nextExpandedRowKeys.add(rowKey);
534
+ }
535
+ if (controlledExpandedRowKeys === undefined) {
536
+ setUncontrolledExpandedRowKeys(nextExpandedRowKeys);
537
+ }
538
+ (_a = rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.onExpandedRowKeysChange) === null || _a === void 0 ? void 0 : _a.call(rowExpansion, Array.from(nextExpandedRowKeys));
539
+ }, [controlledExpandedRowKeys, rowExpansion, uncontrolledExpandedRowKeys]);
519
540
  const resolvedEmptyState = centerEmptyState ? (_jsx("div", { "data-slot": "table-empty-state", className: "flex w-full min-w-0 items-center justify-center whitespace-normal text-center [&>*]:mx-auto", style: { minHeight: emptyStateMinHeight }, children: emptyState })) : (emptyState);
520
541
  const container = (_jsx(TableContainer, { ref: tableContainerRef, onScroll: handleTableContainerScroll, className: cn("w-full", loading && "pointer-events-none select-none", className, containerClassName), style: {
521
542
  ...style,
@@ -527,49 +548,69 @@ function Table({ columns, rows, getRowKey, emptyState = (_jsx(EmptyState, { mess
527
548
  }, ...props, children: _jsxs(TableRoot, { className: cn(shouldUseFixedLayout && "table-fixed", isGrowResizeMode &&
528
549
  (hasResolvedColumnWidths
529
550
  ? "w-[var(--table-min-width)]"
530
- : "min-w-[var(--table-min-width)]"), tableClassName), children: [caption ? _jsx(TableCaption, { children: caption }) : null, _jsx("colgroup", { children: visibleColumns.map((column) => (_jsx("col", { style: getTableColumnSizingStyle({
531
- width: getRenderedColumnWidth({
532
- column,
533
- columnWidths: resolvedColumnWidths,
534
- resizing: isColumnResizingEnabled,
535
- }),
536
- minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled),
537
- maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled),
538
- treatWidthAsMinWidth: !isColumnResizingEnabled,
539
- }) }, column.key))) }), _jsx(TableHeader, { children: _jsx(TableRow, { children: visibleColumns.map((column, columnIndex) => {
540
- var _a;
541
- const sortField = (_a = column.sortKey) !== null && _a !== void 0 ? _a : column.key;
542
- const isSortable = column.sortable && sorting;
543
- const columnWidth = getRenderedColumnWidth({
544
- column,
545
- columnWidths: resolvedColumnWidths,
546
- resizing: isColumnResizingEnabled,
547
- });
548
- const resizeHandle = renderResizeHandle(column, columnIndex);
549
- return (isSortable ? (_jsx(SortableTableHead, { field: sortField, currentSortField: sorting.field, currentSortDirection: sorting.direction, onSort: sorting.onSort, className: cn(stickyClassName(column.sticky, "head", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.headerClassName), allowWrap: column.wrap, width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), align: column.align, sortLabel: column.sortLabel, resizeHandle: resizeHandle, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, children: column.header }, column.key)) : (_jsxs(TableHead, { width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), wrap: column.wrap, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, className: cn(resizeHandle && "relative", alignClassName(column.align), stickyClassName(column.sticky, "head", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.headerClassName), children: [column.header, resizeHandle] }, column.key)));
550
- }) }) }), _jsx(TableBody, { children: loading ? (_jsx(TableRowSkeleton, { rows: loadingRows, columns: visibleColumns.map((column) => { var _a; return (_a = column.skeleton) !== null && _a !== void 0 ? _a : getDefaultSkeleton(column); }) })) : rows.length ? (rows.map((row, rowIndex) => {
551
- const resolvedTone = typeof rowTone === "function"
552
- ? rowTone(row, rowIndex)
553
- : rowTone;
554
- return (_jsx(TableRow, { onClick: onRowClick ? () => onRowClick(row, rowIndex) : undefined, className: cn(onRowClick &&
555
- "cursor-pointer hover:bg-muted", striped &&
556
- rowIndex % 2 === 1 &&
557
- !resolvedTone &&
558
- "bg-[hsl(var(--table-row-striped-background))]", tableRowToneClassName(resolvedTone), typeof rowClassName === "function"
559
- ? rowClassName(row, rowIndex)
560
- : rowClassName), children: visibleColumns.map((column) => {
561
- var _a, _b;
551
+ : "min-w-[var(--table-min-width)]"), tableClassName), children: [caption ? _jsx(TableCaption, { children: caption }) : null, _jsxs("colgroup", { children: [hasExpansionColumn ? (_jsx("col", { style: {
552
+ width: `${TABLE_EXPANSION_COLUMN_WIDTH}px`,
553
+ minWidth: `${TABLE_EXPANSION_COLUMN_WIDTH}px`,
554
+ maxWidth: `${TABLE_EXPANSION_COLUMN_WIDTH}px`,
555
+ } })) : null, visibleColumns.map((column) => (_jsx("col", { style: getTableColumnSizingStyle({
556
+ width: getRenderedColumnWidth({
557
+ column,
558
+ columnWidths: resolvedColumnWidths,
559
+ resizing: isColumnResizingEnabled,
560
+ }),
561
+ minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled),
562
+ maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled),
563
+ treatWidthAsMinWidth: !isColumnResizingEnabled,
564
+ }) }, column.key)))] }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [hasExpansionColumn ? (_jsx(TableHead, { "data-slot": "table-expansion-head", "aria-label": "Expand rows", className: "w-12 px-2" })) : null, visibleColumns.map((column, columnIndex) => {
565
+ var _a;
566
+ const sortField = (_a = column.sortKey) !== null && _a !== void 0 ? _a : column.key;
567
+ const isSortable = column.sortable && sorting;
562
568
  const columnWidth = getRenderedColumnWidth({
563
569
  column,
564
570
  columnWidths: resolvedColumnWidths,
565
571
  resizing: isColumnResizingEnabled,
566
572
  });
567
- const value = (_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.call(column, row, rowIndex)) !== null && _b !== void 0 ? _b : (column.accessorKey !== undefined
568
- ? row[column.accessorKey]
569
- : null);
570
- return (_jsx(TableCell, { width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), wrap: column.wrap, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, className: cn(alignClassName(column.align), stickyClassName(column.sticky, "cell", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.cellClassName), children: value }, column.key));
571
- }) }, getRowKey(row, rowIndex)));
572
- })) : (_jsx(TableRow, { className: "cursor-default hover:bg-card", children: _jsx(TableCell, { colSpan: Math.max(visibleColumns.length, 1), className: "p-6", children: resolvedEmptyState }) })) })] }) }));
573
+ const resizeHandle = renderResizeHandle(column, columnIndex);
574
+ return (isSortable ? (_jsx(SortableTableHead, { field: sortField, currentSortField: sorting.field, currentSortDirection: sorting.direction, onSort: sorting.onSort, className: cn(stickyClassName(column.sticky, "head", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.headerClassName), allowWrap: column.wrap, width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), align: column.align, sortLabel: column.sortLabel, resizeHandle: resizeHandle, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, children: column.header }, column.key)) : (_jsxs(TableHead, { width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), wrap: column.wrap, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, className: cn(resizeHandle && "relative", alignClassName(column.align), stickyClassName(column.sticky, "head", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.headerClassName), children: [column.header, resizeHandle] }, column.key)));
575
+ })] }) }), _jsx(TableBody, { children: loading ? (_jsx(TableRowSkeleton, { rows: loadingRows, columns: [
576
+ ...(hasExpansionColumn
577
+ ? [{ width: "1rem", height: "1rem" }]
578
+ : []),
579
+ ...visibleColumns.map((column) => {
580
+ var _a;
581
+ return (_a = column.skeleton) !== null && _a !== void 0 ? _a : getDefaultSkeleton(column);
582
+ }),
583
+ ] })) : rows.length ? (rows.map((row, rowIndex) => {
584
+ var _a, _b, _c, _d;
585
+ const rowKey = getRowKey(row, rowIndex);
586
+ const resolvedTone = typeof rowTone === "function"
587
+ ? rowTone(row, rowIndex)
588
+ : rowTone;
589
+ const isRowExpandable = (_b = (_a = rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.isRowExpandable) === null || _a === void 0 ? void 0 : _a.call(rowExpansion, row, rowIndex)) !== null && _b !== void 0 ? _b : hasExpansionColumn;
590
+ const isExpanded = isRowExpandable && resolvedExpandedRowKeys.has(rowKey);
591
+ const expandedContentId = `${expansionIdPrefix}-expanded-row-${rowIndex}`;
592
+ return (_jsxs(React.Fragment, { children: [_jsxs(TableRow, { "data-expanded": isExpanded ? "true" : undefined, onClick: onRowClick ? () => onRowClick(row, rowIndex) : undefined, className: cn(onRowClick && "cursor-pointer hover:bg-muted", striped &&
593
+ rowIndex % 2 === 1 &&
594
+ !resolvedTone &&
595
+ "bg-[hsl(var(--table-row-striped-background))]", tableRowToneClassName(resolvedTone), typeof rowClassName === "function"
596
+ ? rowClassName(row, rowIndex)
597
+ : rowClassName), children: [hasExpansionColumn ? (_jsx(TableCell, { className: "w-12 px-2 text-center", children: isRowExpandable ? (_jsx("button", { type: "button", "aria-expanded": isExpanded, "aria-controls": expandedContentId, "aria-label": (_d = (_c = rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.getToggleLabel) === null || _c === void 0 ? void 0 : _c.call(rowExpansion, row, rowIndex, isExpanded)) !== null && _d !== void 0 ? _d : `${isExpanded ? "Collapse" : "Expand"} row ${rowIndex + 1}`, onClick: (event) => {
598
+ event.stopPropagation();
599
+ toggleExpandedRow(rowKey);
600
+ }, className: "inline-flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: _jsx(ChevronRight, { "aria-hidden": "true", className: cn("h-4 w-4 transition-transform duration-150", isExpanded && "rotate-90") }) })) : null })) : null, visibleColumns.map((column) => {
601
+ var _a, _b;
602
+ const columnWidth = getRenderedColumnWidth({
603
+ column,
604
+ columnWidths: resolvedColumnWidths,
605
+ resizing: isColumnResizingEnabled,
606
+ });
607
+ const value = (_b = (_a = column.cell) === null || _a === void 0 ? void 0 : _a.call(column, row, rowIndex)) !== null && _b !== void 0 ? _b : (column.accessorKey !== undefined
608
+ ? row[column.accessorKey]
609
+ : null);
610
+ return (_jsx(TableCell, { width: columnWidth, minWidth: getRenderedColumnMinWidth(column, isColumnResizingEnabled), maxWidth: getRenderedColumnMaxWidth(column, isColumnResizingEnabled), wrap: column.wrap, treatWidthAsMinWidth: !isColumnResizingEnabled, containOverflow: isColumnResizingEnabled, className: cn(alignClassName(column.align), stickyClassName(column.sticky, "cell", getStickyShadowVisibility(column.sticky, stickyScrollState)), column.cellClassName), children: value }, column.key));
611
+ })] }), isExpanded ? (_jsx(TableRow, { id: expandedContentId, "data-slot": "table-expanded-row", className: "bg-[hsl(var(--table-row-striped-background))] hover:bg-[hsl(var(--table-row-striped-background))]", children: _jsx(TableCell, { colSpan: Math.max(visibleColumns.length +
612
+ (hasExpansionColumn ? 1 : 0), 1), className: "h-auto whitespace-normal p-4", children: rowExpansion === null || rowExpansion === void 0 ? void 0 : rowExpansion.renderExpandedContent(row, rowIndex) }) })) : null] }, rowKey));
613
+ })) : (_jsx(TableRow, { className: "cursor-default hover:bg-card", children: _jsx(TableCell, { colSpan: Math.max(visibleColumns.length + (hasExpansionColumn ? 1 : 0), 1), className: "p-6", children: resolvedEmptyState }) })) })] }) }));
573
614
  if (!pagination) {
574
615
  return (_jsxs("div", { className: "space-y-4", children: [toolbar, container] }));
575
616
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neasg/design-system",
3
- "version": "0.4.15",
3
+ "version": "0.4.17",
4
4
  "description": "NEA shared design system primitives, theme tokens, and Storybook docs.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",