@pk-design/react-tailwind 1.3.0 → 1.4.0
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/react-tailwind.cjs.js +90 -46
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.es.js +90 -46
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +4 -1
- package/dist/types/components/DataTable/DataTable.types.d.ts +68 -16
- package/dist/types/components/Table/Table.types.d.ts +6 -4
- package/dist/types/components/VirtualizedDataTable/VirtualizedDataTable.d.ts +2 -3
- package/dist/types/components/VirtualizedDataTable/VirtualizedDataTable.types.d.ts +31 -7
- package/dist/types/components/VirtualizedDataTable/VirtualizedRow.d.ts +2 -6
- package/package.json +1 -1
|
@@ -450,9 +450,7 @@ const TableRowLoader = ({ colSize, rowSize }) => (jsxRuntime.jsx(jsxRuntime.Frag
|
|
|
450
450
|
/* ----------------------------------------------
|
|
451
451
|
* Table
|
|
452
452
|
* ---------------------------------------------- */
|
|
453
|
-
const Table = ({ children, layout = 'auto', className = '' }) => {
|
|
454
|
-
return (jsxRuntime.jsx("table", { className: buildClassName('border-collapse w-full divide-y divide-gray-200 dark:divide-gray-700', TABLE_LAYOUT[layout], className), children: children }));
|
|
455
|
-
};
|
|
453
|
+
const Table = ({ children, layout = 'auto', className = '', caption, }) => (jsxRuntime.jsxs("table", { className: buildClassName('border-collapse w-full divide-y divide-gray-200 dark:divide-gray-700', TABLE_LAYOUT[layout], className), children: [caption && (jsxRuntime.jsx("caption", { className: "mb-2 text-sm text-left text-gray-500 dark:text-gray-400", children: caption })), children] }));
|
|
456
454
|
/* ----------------------------------------------
|
|
457
455
|
* Head
|
|
458
456
|
* ---------------------------------------------- */
|
|
@@ -460,7 +458,7 @@ const TableHead = ({ children, className = '' }) => (jsxRuntime.jsx("thead", { c
|
|
|
460
458
|
/* ----------------------------------------------
|
|
461
459
|
* Body
|
|
462
460
|
* ---------------------------------------------- */
|
|
463
|
-
const TableBody = ({ children, loading, colSize, rowSize = 5, className, }) => (jsxRuntime.jsx("tbody", { className: buildClassName('text-sm text-gray-700 dark:text-white divide-y divide-gray-200 dark:divide-gray-700', className), children: loading ? jsxRuntime.jsx(TableRowLoader, { colSize: colSize, rowSize: rowSize }) : children }));
|
|
461
|
+
const TableBody = ({ children, loading, colSize = 1, rowSize = 5, className, }) => (jsxRuntime.jsx("tbody", { className: buildClassName('text-sm text-gray-700 dark:text-white divide-y divide-gray-200 dark:divide-gray-700', className), children: loading ? jsxRuntime.jsx(TableRowLoader, { colSize: colSize, rowSize: rowSize }) : children }));
|
|
464
462
|
/* ----------------------------------------------
|
|
465
463
|
* Foot
|
|
466
464
|
* ---------------------------------------------- */
|
|
@@ -473,7 +471,7 @@ const TableRow = ({ children, hoverable = false, className, ...props }) => (jsxR
|
|
|
473
471
|
* Cells
|
|
474
472
|
* ---------------------------------------------- */
|
|
475
473
|
const TableCell = ({ children, align = 'left', className, ...props }) => (jsxRuntime.jsx("td", { ...props, className: buildClassName('px-3 py-3 first:pl-4 last:pr-4 bg-white dark:bg-gray-900 group-hover:bg-gray-50 group-hover:dark:bg-gray-800', TEXT_ALIGN[align], className), children: jsxRuntime.jsx("div", { className: "leading-normal", children: children }) }));
|
|
476
|
-
const TableHeaderCell = ({ children, align = 'left', className, ...props }) => (jsxRuntime.jsx("th", { ...props, className: buildClassName('px-3 py-3 first:pl-4 last:pr-4 tracking-wider whitespace-nowrap text-gray-800 dark:text-gray-300', TEXT_ALIGN[align], className), children:
|
|
474
|
+
const TableHeaderCell = ({ children, align = 'left', className, ...props }) => (jsxRuntime.jsx("th", { ...props, className: buildClassName('px-3 py-3 first:pl-4 last:pr-4 tracking-wider whitespace-nowrap text-gray-800 dark:text-gray-300', TEXT_ALIGN[align], className), children: children }));
|
|
477
475
|
/* ----------------------------------------------
|
|
478
476
|
* Empty Row
|
|
479
477
|
* ---------------------------------------------- */
|
|
@@ -723,9 +721,11 @@ const SortIconMap = {
|
|
|
723
721
|
};
|
|
724
722
|
const getSortIcon = (sort) => sort ? (SortIconMap[sort]) : (jsxRuntime.jsx(SvgArrowUpDown, { className: "size-4 text-gray-400 shrink-0 group-hover:text-gray-800 dark:group-hover:text-white" }));
|
|
725
723
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
724
|
+
const DENSITY_CELL_CLASS$2 = {
|
|
725
|
+
compact: 'px-2 py-1.5',
|
|
726
|
+
default: '',
|
|
727
|
+
spacious: 'px-4 py-4',
|
|
728
|
+
};
|
|
729
729
|
const autoSortItems = (items, column, sort) => {
|
|
730
730
|
const path = column.name;
|
|
731
731
|
return [...items].sort((a, b) => {
|
|
@@ -741,7 +741,6 @@ const autoSortItems = (items, column, sort) => {
|
|
|
741
741
|
const dB = new Date(valueB).getTime();
|
|
742
742
|
return sort === 'asc' || sort === '1' ? dA - dB : dB - dA;
|
|
743
743
|
}
|
|
744
|
-
// String fallback
|
|
745
744
|
const sA = String(valueA).toLowerCase();
|
|
746
745
|
const sB = String(valueB).toLowerCase();
|
|
747
746
|
if (sA < sB)
|
|
@@ -751,7 +750,7 @@ const autoSortItems = (items, column, sort) => {
|
|
|
751
750
|
return 0;
|
|
752
751
|
});
|
|
753
752
|
};
|
|
754
|
-
|
|
753
|
+
function DataTable({ items, columns, sorting = {}, onSort, loading, pagination, setPagination = () => { }, emptyMessage = 'No data found', containerClass = '', wrapperClass = '', tableClass = '', headClass = '', footerRow, rowKey = 'id', onRowClick, rowClass, density = 'default', striped = false, layout = 'auto', }) {
|
|
755
754
|
const internalSorting = React.useRef({});
|
|
756
755
|
const [sortedItems, setSortedItems] = React.useState(items);
|
|
757
756
|
React.useEffect(() => {
|
|
@@ -766,17 +765,38 @@ const DataTable = ({ items, columns, sorting = {}, onSort, loading, pagination =
|
|
|
766
765
|
return;
|
|
767
766
|
onSort ? onSort(column) : doAutoSort(column);
|
|
768
767
|
};
|
|
769
|
-
|
|
768
|
+
const getKey = (item, idx) => {
|
|
769
|
+
var _a;
|
|
770
|
+
if (typeof rowKey === 'function')
|
|
771
|
+
return rowKey(item);
|
|
772
|
+
return (_a = item[rowKey]) !== null && _a !== void 0 ? _a : idx;
|
|
773
|
+
};
|
|
774
|
+
const getRowClass = (item, idx) => {
|
|
775
|
+
if (!rowClass)
|
|
776
|
+
return '';
|
|
777
|
+
if (typeof rowClass === 'function')
|
|
778
|
+
return rowClass(item, idx);
|
|
779
|
+
return rowClass;
|
|
780
|
+
};
|
|
781
|
+
const getCellClass = (column, item) => {
|
|
782
|
+
if (!column.cellClass)
|
|
783
|
+
return '';
|
|
784
|
+
if (typeof column.cellClass === 'function')
|
|
785
|
+
return column.cellClass(item);
|
|
786
|
+
return column.cellClass;
|
|
787
|
+
};
|
|
788
|
+
const densityCellClass = DENSITY_CELL_CLASS$2[density];
|
|
789
|
+
return (jsxRuntime.jsxs("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: [jsxRuntime.jsx("div", { className: buildClassName('overflow-x-auto overflow-y-hidden rounded-lg border border-gray-200 dark:border-gray-800', wrapperClass, pagination && 'rounded-b-none border-b-0'), children: jsxRuntime.jsxs(Table, { className: buildClassName('relative w-full max-w-full h-fit', tableClass), layout: layout, children: [jsxRuntime.jsx(TableHead, { className: headClass, children: columns.map((column) => (jsxRuntime.jsx(TableHeaderCell, { align: column.headerAlign, style: { width: column.width || 'auto' }, className: buildClassName('bg-gray-50 dark:bg-gray-800', densityCellClass, column.sticky === 'left' &&
|
|
770
790
|
'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
|
|
771
|
-
'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]'), children: jsxRuntime.jsxs(TextContent, { role: column.sortable ? 'button' : undefined, className: buildClassName('group', column.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(column), children: [jsxRuntime.jsx(TextContent, { className: "shrink-0", children: column.label }), column.sortable ? getSortIcon(sorting[column.name]) : null] }) }, column.name))) }), jsxRuntime.jsx(TableBody, { loading: loading, colSize: columns.length, rowSize: (pagination === null || pagination === void 0 ? void 0 : pagination.limit) || 5, children: !loading && sortedItems.length === 0 ? (jsxRuntime.jsx(EmptyTableRow, { colSpan: columns.length, children: emptyMessage })) : (sortedItems.map((item) => (jsxRuntime.jsx(TableRow, { className:
|
|
791
|
+
'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', column.headerClass), children: jsxRuntime.jsxs(TextContent, { role: column.sortable ? 'button' : undefined, className: buildClassName('group', column.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(column), children: [jsxRuntime.jsx(TextContent, { className: "shrink-0", children: column.label }), column.sortable ? getSortIcon(sorting[column.name]) : null] }) }, column.name))) }), jsxRuntime.jsx(TableBody, { loading: loading, colSize: columns.length, rowSize: (pagination === null || pagination === void 0 ? void 0 : pagination.limit) || 5, children: !loading && sortedItems.length === 0 ? (jsxRuntime.jsx(EmptyTableRow, { colSpan: columns.length, children: emptyMessage })) : (sortedItems.map((item, idx) => (jsxRuntime.jsx(TableRow, { className: buildClassName('group', onRowClick && 'cursor-pointer', striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', getRowClass(item, idx)), onClick: onRowClick ? () => onRowClick(item, idx) : undefined, children: columns.map((column) => {
|
|
772
792
|
var _a;
|
|
773
|
-
return (jsxRuntime.jsx(TableCell, { align: column.align, className: buildClassName(column.sticky === 'left' &&
|
|
793
|
+
return (jsxRuntime.jsx(TableCell, { align: column.align, className: buildClassName(densityCellClass, striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', column.sticky === 'left' &&
|
|
774
794
|
'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
|
|
775
|
-
'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]'), children: column.render
|
|
795
|
+
'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', getCellClass(column, item)), children: column.render
|
|
776
796
|
? column.render(item)
|
|
777
797
|
: ((_a = get(item, column.name)) !== null && _a !== void 0 ? _a : 'Not set') }, column.name));
|
|
778
|
-
}) }, item
|
|
779
|
-
}
|
|
798
|
+
}) }, getKey(item, idx))))) }), footerRow && jsxRuntime.jsx(TableFoot, { children: footerRow })] }) }), pagination && (jsxRuntime.jsx(Pagination, { ...pagination, className: "rounded-b-lg border border-t-0 border-gray-200 dark:border-gray-800", onChange: setPagination }))] }));
|
|
799
|
+
}
|
|
780
800
|
DataTable.displayName = 'DataTable';
|
|
781
801
|
|
|
782
802
|
const Title = ({ children, className }) => (jsxRuntime.jsx("h1", { className: buildClassName('text-3xl font-bold', className), children: children }));
|
|
@@ -1448,33 +1468,61 @@ const ToastProvider = ({ children, placement = 'top-center' }) => {
|
|
|
1448
1468
|
return (jsxRuntime.jsxs(ToastContext.Provider, { value: { showToast, closeToast }, children: [children, jsxRuntime.jsx("div", { className: buildClassName('fixed z-50 flex flex-col gap-3 pointer-events-none', placementClass[placement]), children: toasts.map((toast, index) => (jsxRuntime.jsx("div", { className: "pointer-events-auto", onMouseEnter: () => toast.pauseOnHover && clearTimer(toast.id), onMouseLeave: () => toast.pauseOnHover && scheduleClose(toast), children: jsxRuntime.jsx(Toast, { ...toast, isTop: placement.startsWith('top'), onClose: () => closeToast(toast.id) }) }, toast.id))) })] }));
|
|
1449
1469
|
};
|
|
1450
1470
|
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1471
|
+
const DENSITY_CELL_CLASS$1 = {
|
|
1472
|
+
compact: 'px-2 py-1.5',
|
|
1473
|
+
default: 'px-3 py-3',
|
|
1474
|
+
spacious: 'px-4 py-4',
|
|
1475
|
+
};
|
|
1476
|
+
const VirtualizedRow = ({ index, style, data, }) => {
|
|
1477
|
+
const { items, columns, gridTemplate, onRowClick, rowClass, density = 'default', striped } = data;
|
|
1453
1478
|
const item = items[index];
|
|
1454
|
-
|
|
1479
|
+
const isStriped = striped && index % 2 === 1;
|
|
1480
|
+
const resolvedRowClass = !rowClass
|
|
1481
|
+
? ''
|
|
1482
|
+
: typeof rowClass === 'function'
|
|
1483
|
+
? rowClass(item, index)
|
|
1484
|
+
: rowClass;
|
|
1485
|
+
const getCellClass = (col) => {
|
|
1486
|
+
if (!col.cellClass)
|
|
1487
|
+
return '';
|
|
1488
|
+
if (typeof col.cellClass === 'function')
|
|
1489
|
+
return col.cellClass(item);
|
|
1490
|
+
return col.cellClass;
|
|
1491
|
+
};
|
|
1492
|
+
const densityCellClass = DENSITY_CELL_CLASS$1[density];
|
|
1493
|
+
return (jsxRuntime.jsx("div", { role: "row", className: buildClassName('grid border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 group', onRowClick && 'cursor-pointer', isStriped && 'bg-gray-50 dark:bg-gray-800/40', resolvedRowClass), style: {
|
|
1455
1494
|
...style,
|
|
1456
1495
|
display: 'grid',
|
|
1457
1496
|
gridTemplateColumns: gridTemplate,
|
|
1458
1497
|
minWidth: 'fit-content',
|
|
1459
|
-
}, children: columns.map((col) => {
|
|
1498
|
+
}, onClick: onRowClick ? () => onRowClick(item, index) : undefined, children: columns.map((col) => {
|
|
1460
1499
|
var _a;
|
|
1461
1500
|
const content = col.render ? col.render(item) : ((_a = get(item, col.name)) !== null && _a !== void 0 ? _a : 'Not set');
|
|
1462
|
-
return (jsxRuntime.jsx("div", { role: "cell", className: buildClassName('
|
|
1501
|
+
return (jsxRuntime.jsx("div", { role: "cell", className: buildClassName('whitespace-nowrap border-r last:border-r-0 border-gray-200 dark:border-gray-700', densityCellClass, col.align === 'center' && 'text-center', col.align === 'right' && 'text-right', col.sticky === 'left' &&
|
|
1463
1502
|
'sticky left-0 z-10 bg-white dark:bg-gray-900 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
|
|
1464
|
-
'sticky right-0 z-10 bg-white dark:bg-gray-900 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]'), children: content }, col.name));
|
|
1503
|
+
'sticky right-0 z-10 bg-white dark:bg-gray-900 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', isStriped && 'bg-gray-50 dark:bg-gray-800/40', getCellClass(col)), children: content }, col.name));
|
|
1465
1504
|
}) }));
|
|
1466
1505
|
};
|
|
1467
1506
|
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1507
|
+
const DENSITY_CELL_CLASS = {
|
|
1508
|
+
compact: 'px-2 py-1.5',
|
|
1509
|
+
default: 'px-3 py-3',
|
|
1510
|
+
spacious: 'px-4 py-4',
|
|
1511
|
+
};
|
|
1512
|
+
const columnWidth = (col) => {
|
|
1513
|
+
if (!col.width)
|
|
1514
|
+
return '1fr';
|
|
1515
|
+
if (typeof col.width === 'number')
|
|
1516
|
+
return `${col.width}px`;
|
|
1517
|
+
return col.width;
|
|
1518
|
+
};
|
|
1519
|
+
function VirtualizedDataTable({ items, columns, sorting = {}, onSort, loading = false, emptyMessage = 'No data available', containerClass = '', wrapperClass = '', onRowClick, rowClass, density = 'default', striped = false, rowHeight = 48, maxHeight = 400, overscanCount = 3, }) {
|
|
1473
1520
|
const scrollRef = React.useRef(null);
|
|
1474
1521
|
const outerRef = React.useRef(null);
|
|
1475
1522
|
const headerRef = React.useRef(null);
|
|
1476
|
-
const gridTemplate =
|
|
1477
|
-
|
|
1523
|
+
const gridTemplate = React.useMemo(() => columns.map((col) => columnWidth(col)).join(' '), [columns]);
|
|
1524
|
+
const densityCellClass = DENSITY_CELL_CLASS[density];
|
|
1525
|
+
const skeletonRows = Math.max(1, Math.floor(maxHeight / rowHeight));
|
|
1478
1526
|
React.useEffect(() => {
|
|
1479
1527
|
const el = outerRef.current;
|
|
1480
1528
|
if (!el)
|
|
@@ -1490,35 +1538,31 @@ const VirtualizedDataTable = ({ items, columns, sorting = {}, onSort, loading =
|
|
|
1490
1538
|
if (column.sortable)
|
|
1491
1539
|
onSort === null || onSort === void 0 ? void 0 : onSort(column);
|
|
1492
1540
|
}, [onSort]);
|
|
1541
|
+
const itemData = React.useMemo(() => ({ items, columns, gridTemplate, onRowClick, rowClass, density, striped }), [items, columns, gridTemplate, onRowClick, rowClass, density, striped]);
|
|
1493
1542
|
/* -------------------------------------------------------
|
|
1494
|
-
*
|
|
1543
|
+
* Header
|
|
1495
1544
|
* ------------------------------------------------------- */
|
|
1496
|
-
const Header = (jsxRuntime.jsx("div", { ref: headerRef, className: "overflow-hidden w-full", children: jsxRuntime.jsx("div", { className: "grid bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", style: {
|
|
1497
|
-
gridTemplateColumns: gridTemplate,
|
|
1498
|
-
minWidth: 'fit-content',
|
|
1499
|
-
}, children: columns.map((col) => (jsxRuntime.jsx("div", { role: "columnheader", className: buildClassName('px-3 py-3 font-semibold text-sm whitespace-nowrap flex items-center', 'border-r last:border-r-0 border-gray-200 dark:border-gray-700', col.sticky === 'left' &&
|
|
1545
|
+
const Header = (jsxRuntime.jsx("div", { ref: headerRef, className: "overflow-hidden w-full", children: jsxRuntime.jsx("div", { className: "grid bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", style: { gridTemplateColumns: gridTemplate, minWidth: 'fit-content' }, children: columns.map((col) => (jsxRuntime.jsx("div", { role: "columnheader", className: buildClassName('font-semibold text-sm whitespace-nowrap flex items-center', densityCellClass, 'border-r last:border-r-0 border-gray-200 dark:border-gray-700', col.sticky === 'left' &&
|
|
1500
1546
|
'sticky left-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
|
|
1501
|
-
'sticky right-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]'), children: jsxRuntime.jsxs(TextContent, { role: col.sortable ? 'button' : undefined, className: buildClassName(col.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(col), children: [col.label, col.sortable ? getSortIcon(sorting[col.name]) : null] }) }, col.name))) }) }));
|
|
1547
|
+
'sticky right-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', col.headerClass), children: jsxRuntime.jsxs(TextContent, { role: col.sortable ? 'button' : undefined, className: buildClassName(col.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(col), children: [col.label, col.sortable ? getSortIcon(sorting[col.name]) : null] }) }, col.name))) }) }));
|
|
1548
|
+
const wrapperCls = buildClassName('rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden', wrapperClass);
|
|
1502
1549
|
/* -------------------------------------------------------
|
|
1503
|
-
*
|
|
1550
|
+
* Loading state
|
|
1504
1551
|
* ------------------------------------------------------- */
|
|
1505
1552
|
if (loading) {
|
|
1506
|
-
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className:
|
|
1507
|
-
gridTemplateColumns: gridTemplate,
|
|
1508
|
-
height: rowHeight,
|
|
1509
|
-
}, children: columns.map((col) => (jsxRuntime.jsx("div", { className: "px-3 py-3", children: jsxRuntime.jsx("div", { className: "h-4 w-3/4 bg-gray-300 dark:bg-gray-700 rounded" }) }, col.name))) }, idx))) })] }) }));
|
|
1553
|
+
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className: wrapperCls, children: [Header, jsxRuntime.jsx("div", { style: { height: maxHeight }, className: "flex flex-col", children: Array.from({ length: skeletonRows }).map((_, idx) => (jsxRuntime.jsx("div", { "data-testid": "skeleton-row", className: "grid animate-pulse bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-800", style: { gridTemplateColumns: gridTemplate, height: rowHeight }, children: columns.map((col) => (jsxRuntime.jsx("div", { className: densityCellClass, children: jsxRuntime.jsx("div", { className: "h-4 w-3/4 bg-gray-300 dark:bg-gray-700 rounded" }) }, col.name))) }, idx))) })] }) }));
|
|
1510
1554
|
}
|
|
1511
1555
|
/* -------------------------------------------------------
|
|
1512
|
-
*
|
|
1556
|
+
* Empty state
|
|
1513
1557
|
* ------------------------------------------------------- */
|
|
1514
|
-
if (
|
|
1515
|
-
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className:
|
|
1558
|
+
if (items.length === 0) {
|
|
1559
|
+
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className: wrapperCls, children: [Header, jsxRuntime.jsx("div", { className: "flex items-center justify-center text-gray-500 dark:text-gray-300", style: { height: maxHeight }, children: emptyMessage })] }) }));
|
|
1516
1560
|
}
|
|
1517
1561
|
/* -------------------------------------------------------
|
|
1518
|
-
*
|
|
1562
|
+
* Virtualized body
|
|
1519
1563
|
* ------------------------------------------------------- */
|
|
1520
|
-
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className:
|
|
1521
|
-
}
|
|
1564
|
+
return (jsxRuntime.jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxRuntime.jsxs("div", { className: wrapperCls, children: [Header, jsxRuntime.jsx(reactWindow.FixedSizeList, { ref: scrollRef, outerRef: outerRef, height: maxHeight, width: "100%", itemCount: items.length, itemSize: rowHeight, itemData: itemData, overscanCount: overscanCount, children: VirtualizedRow })] }) }));
|
|
1565
|
+
}
|
|
1522
1566
|
|
|
1523
1567
|
const useIsMobile = () => {
|
|
1524
1568
|
const [isMobile, setIsMobile] = React.useState(false);
|