@helpwave/hightide 0.1.12 → 0.1.13
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.mts +2 -2
- package/dist/components/table/Table.d.ts +2 -2
- package/dist/components/table/Table.js +38 -25
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.mjs +36 -23
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/TableCell.d.mts +9 -0
- package/dist/components/table/TableCell.d.ts +9 -0
- package/dist/components/table/TableCell.js +37 -0
- package/dist/components/table/TableCell.js.map +1 -0
- package/dist/components/table/TableCell.mjs +13 -0
- package/dist/components/table/TableCell.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +70 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -48
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -675,7 +675,7 @@ var Pagination = ({
|
|
|
675
675
|
};
|
|
676
676
|
|
|
677
677
|
// src/components/table/Table.tsx
|
|
678
|
-
import
|
|
678
|
+
import clsx10 from "clsx";
|
|
679
679
|
import {
|
|
680
680
|
flexRender,
|
|
681
681
|
getCoreRowModel,
|
|
@@ -1115,8 +1115,18 @@ var useResizeCallbackWrapper = (callback) => {
|
|
|
1115
1115
|
}, [callback]);
|
|
1116
1116
|
};
|
|
1117
1117
|
|
|
1118
|
+
// src/components/table/TableCell.tsx
|
|
1119
|
+
import { clsx as clsx9 } from "clsx";
|
|
1120
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1121
|
+
var TableCell = ({
|
|
1122
|
+
children,
|
|
1123
|
+
className
|
|
1124
|
+
}) => {
|
|
1125
|
+
return /* @__PURE__ */ jsx11("span", { className: clsx9("block max-w-full overflow-ellipsis truncate", className), children });
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1118
1128
|
// src/components/table/Table.tsx
|
|
1119
|
-
import { jsx as
|
|
1129
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1120
1130
|
var Table = ({
|
|
1121
1131
|
data,
|
|
1122
1132
|
fillerRow,
|
|
@@ -1234,6 +1244,9 @@ var Table = ({
|
|
|
1234
1244
|
defaultColumn: {
|
|
1235
1245
|
minSize: 60,
|
|
1236
1246
|
maxSize: 700,
|
|
1247
|
+
cell: ({ cell }) => {
|
|
1248
|
+
return /* @__PURE__ */ jsx12(TableCell, { children: cell.getValue() });
|
|
1249
|
+
},
|
|
1237
1250
|
...defaultColumn
|
|
1238
1251
|
},
|
|
1239
1252
|
columns,
|
|
@@ -1317,18 +1330,18 @@ var Table = ({
|
|
|
1317
1330
|
}
|
|
1318
1331
|
return colSizes;
|
|
1319
1332
|
}, [table.getState().columnSizingInfo, table.getState().columnSizing]);
|
|
1320
|
-
return /* @__PURE__ */ jsxs7("div", { ref, className:
|
|
1321
|
-
/* @__PURE__ */
|
|
1333
|
+
return /* @__PURE__ */ jsxs7("div", { ref, className: clsx10("col gap-y-4", className), children: [
|
|
1334
|
+
/* @__PURE__ */ jsx12(Scrollbars, { autoHeight: true, autoHeightMax: tableRef.current?.offsetHeight, autoHide: true, children: /* @__PURE__ */ jsxs7(
|
|
1322
1335
|
"table",
|
|
1323
1336
|
{
|
|
1324
1337
|
ref: tableRef,
|
|
1325
|
-
className:
|
|
1338
|
+
className: clsx10(tableClassName),
|
|
1326
1339
|
style: {
|
|
1327
1340
|
...columnSizeVars,
|
|
1328
1341
|
width: Math.max(table.getTotalSize(), ref.current?.offsetWidth ?? table.getTotalSize())
|
|
1329
1342
|
},
|
|
1330
1343
|
children: [
|
|
1331
|
-
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */
|
|
1344
|
+
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12("colgroup", { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx12(
|
|
1332
1345
|
"col",
|
|
1333
1346
|
{
|
|
1334
1347
|
style: {
|
|
@@ -1339,22 +1352,22 @@ var Table = ({
|
|
|
1339
1352
|
},
|
|
1340
1353
|
header.id
|
|
1341
1354
|
)) }, headerGroup.id)),
|
|
1342
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ jsx12("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12("tr", { className: table.options.meta?.headerRowClassName, children: headerGroup.headers.map((header) => {
|
|
1343
1356
|
return /* @__PURE__ */ jsxs7(
|
|
1344
1357
|
"th",
|
|
1345
1358
|
{
|
|
1346
1359
|
colSpan: header.colSpan,
|
|
1347
|
-
className:
|
|
1360
|
+
className: clsx10("relative group", header.column.columnDef.meta?.className),
|
|
1348
1361
|
children: [
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
header.column.getCanSort() && /* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ jsx12("div", { className: "row w-full", children: header.isPlaceholder ? null : /* @__PURE__ */ jsxs7("div", { className: "row gap-x-1 items-center", children: [
|
|
1363
|
+
header.column.getCanSort() && /* @__PURE__ */ jsx12(
|
|
1351
1364
|
TableSortButton,
|
|
1352
1365
|
{
|
|
1353
1366
|
sortDirection: header.column.getIsSorted(),
|
|
1354
1367
|
onClick: () => header.column.toggleSorting()
|
|
1355
1368
|
}
|
|
1356
1369
|
),
|
|
1357
|
-
header.column.getCanFilter() && header.column.columnDef.meta?.filterType ? /* @__PURE__ */
|
|
1370
|
+
header.column.getCanFilter() && header.column.columnDef.meta?.filterType ? /* @__PURE__ */ jsx12(
|
|
1358
1371
|
TableFilterButton,
|
|
1359
1372
|
{
|
|
1360
1373
|
column: header.column,
|
|
@@ -1366,7 +1379,7 @@ var Table = ({
|
|
|
1366
1379
|
header.getContext()
|
|
1367
1380
|
)
|
|
1368
1381
|
] }) }),
|
|
1369
|
-
header.column.getCanResize() && /* @__PURE__ */
|
|
1382
|
+
header.column.getCanResize() && /* @__PURE__ */ jsx12(
|
|
1370
1383
|
"div",
|
|
1371
1384
|
{
|
|
1372
1385
|
onMouseDown: header.getResizeHandler(),
|
|
@@ -1387,23 +1400,23 @@ var Table = ({
|
|
|
1387
1400
|
}) }, headerGroup.id)) }),
|
|
1388
1401
|
/* @__PURE__ */ jsxs7("tbody", { children: [
|
|
1389
1402
|
table.getRowModel().rows.map((row) => {
|
|
1390
|
-
return /* @__PURE__ */
|
|
1391
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsx12("tr", { onClick: () => onRowClick(row, table), className: table.options.meta?.bodyRowClassName, children: row.getVisibleCells().map((cell) => {
|
|
1404
|
+
return /* @__PURE__ */ jsx12("td", { children: flexRender(
|
|
1392
1405
|
cell.column.columnDef.cell,
|
|
1393
1406
|
cell.getContext()
|
|
1394
1407
|
) }, cell.id);
|
|
1395
1408
|
}) }, row.id);
|
|
1396
1409
|
}),
|
|
1397
1410
|
range(table.getState().pagination.pageSize - table.getRowModel().rows.length, { allowEmptyRange: true }).map((row, index) => {
|
|
1398
|
-
return /* @__PURE__ */
|
|
1399
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx12("tr", { children: columns.map((column) => {
|
|
1412
|
+
return /* @__PURE__ */ jsx12("td", { children: fillerRow ? fillerRow(column.id, table) : /* @__PURE__ */ jsx12(FillerRowElement, {}) }, column.id);
|
|
1400
1413
|
}) }, "filler-row-" + index);
|
|
1401
1414
|
})
|
|
1402
1415
|
] })
|
|
1403
1416
|
]
|
|
1404
1417
|
}
|
|
1405
1418
|
) }),
|
|
1406
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsx12("div", { className: "row justify-center", children: /* @__PURE__ */ jsx12(
|
|
1407
1420
|
Pagination,
|
|
1408
1421
|
{
|
|
1409
1422
|
pageIndex: table.getState().pagination.pageIndex,
|
|
@@ -1418,7 +1431,7 @@ var TableUncontrolled = ({ data, ...props }) => {
|
|
|
1418
1431
|
useEffect11(() => {
|
|
1419
1432
|
setUsedData(data);
|
|
1420
1433
|
}, [data]);
|
|
1421
|
-
return /* @__PURE__ */
|
|
1434
|
+
return /* @__PURE__ */ jsx12(
|
|
1422
1435
|
Table,
|
|
1423
1436
|
{
|
|
1424
1437
|
...props,
|
|
@@ -1441,7 +1454,7 @@ var TableWithSelection = ({
|
|
|
1441
1454
|
{
|
|
1442
1455
|
id: selectionRowId,
|
|
1443
1456
|
header: ({ table }) => {
|
|
1444
|
-
return /* @__PURE__ */
|
|
1457
|
+
return /* @__PURE__ */ jsx12(
|
|
1445
1458
|
Checkbox,
|
|
1446
1459
|
{
|
|
1447
1460
|
checked: table.getIsSomeRowsSelected() ? "indeterminate" : table.getIsAllRowsSelected(),
|
|
@@ -1454,7 +1467,7 @@ var TableWithSelection = ({
|
|
|
1454
1467
|
);
|
|
1455
1468
|
},
|
|
1456
1469
|
cell: ({ row }) => {
|
|
1457
|
-
return /* @__PURE__ */
|
|
1470
|
+
return /* @__PURE__ */ jsx12(
|
|
1458
1471
|
Checkbox,
|
|
1459
1472
|
{
|
|
1460
1473
|
disabled: !row.getCanSelect(),
|
|
@@ -1473,15 +1486,15 @@ var TableWithSelection = ({
|
|
|
1473
1486
|
...columns
|
|
1474
1487
|
];
|
|
1475
1488
|
}, [columns, selectionRowId]);
|
|
1476
|
-
return /* @__PURE__ */
|
|
1489
|
+
return /* @__PURE__ */ jsx12(
|
|
1477
1490
|
Table,
|
|
1478
1491
|
{
|
|
1479
1492
|
columns: columnsWithSelection,
|
|
1480
1493
|
fillerRow: (columnId, table) => {
|
|
1481
1494
|
if (columnId === selectionRowId) {
|
|
1482
|
-
return /* @__PURE__ */
|
|
1495
|
+
return /* @__PURE__ */ jsx12(Checkbox, { checked: false, disabled: true, containerClassName: "max-w-6" });
|
|
1483
1496
|
}
|
|
1484
|
-
return fillerRow ? fillerRow(columnId, table) : /* @__PURE__ */
|
|
1497
|
+
return fillerRow ? fillerRow(columnId, table) : /* @__PURE__ */ jsx12(FillerRowElement, {});
|
|
1485
1498
|
},
|
|
1486
1499
|
state: {
|
|
1487
1500
|
rowSelection,
|