@xyo-network/react-payload-table 7.5.8 → 7.5.12

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.
Files changed (31) hide show
  1. package/dist/browser/components/Table/TableRowNoData.d.ts.map +1 -1
  2. package/dist/browser/index.mjs +438 -460
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/package.json +182 -44
  5. package/src/components/DynamicTable/DynamicTable.stories.tsx +0 -72
  6. package/src/components/DynamicTable/DynamicTableRow.tsx +0 -134
  7. package/src/components/DynamicTable/PayloadDynamicTableColumnConfig.ts +0 -98
  8. package/src/components/DynamicTable/Table.tsx +0 -194
  9. package/src/components/DynamicTable/index.ts +0 -3
  10. package/src/components/Table/FetchMoreTable.stories.tsx +0 -100
  11. package/src/components/Table/PayloadTableColumnConfig.ts +0 -22
  12. package/src/components/Table/Table.stories.tsx +0 -98
  13. package/src/components/Table/Table.tsx +0 -139
  14. package/src/components/Table/TableBody.tsx +0 -64
  15. package/src/components/Table/TableFooter.tsx +0 -44
  16. package/src/components/Table/TableHead.tsx +0 -31
  17. package/src/components/Table/TablePagination.tsx +0 -88
  18. package/src/components/Table/TableRow.tsx +0 -135
  19. package/src/components/Table/TableRowNoData.tsx +0 -39
  20. package/src/components/Table/index.ts +0 -7
  21. package/src/components/Table/lib/TableColumns.ts +0 -12
  22. package/src/components/Table/lib/index.ts +0 -1
  23. package/src/components/Table/types/PaginationEventNouns.ts +0 -1
  24. package/src/components/Table/types/PayloadTableBodyProps.ts +0 -21
  25. package/src/components/Table/types/PayloadTableFooterProps.ts +0 -13
  26. package/src/components/Table/types/PayloadTableHeadProps.ts +0 -7
  27. package/src/components/Table/types/index.ts +0 -4
  28. package/src/components/index.ts +0 -2
  29. package/src/components/lib/index.ts +0 -3
  30. package/src/global.d.ts +0 -1
  31. package/src/index.ts +0 -1
@@ -1,9 +1,14 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/components/DynamicTable/DynamicTableRow.tsx
5
- import { CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon, ErrorOutlineRounded as ErrorOutlineRoundedIcon, WarningAmberRounded as WarningAmberRoundedIcon } from "@mui/icons-material";
6
- import { TableCell, TableRow, Typography } from "@mui/material";
2
+ import {
3
+ CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon,
4
+ ErrorOutlineRounded as ErrorOutlineRoundedIcon,
5
+ WarningAmberRounded as WarningAmberRoundedIcon
6
+ } from "@mui/icons-material";
7
+ import {
8
+ TableCell,
9
+ TableRow,
10
+ Typography
11
+ } from "@mui/material";
7
12
  import { usePromise } from "@xylabs/react-promise";
8
13
  import { useBreakpoint } from "@xylabs/react-shared";
9
14
  import { PayloadBuilder } from "@xyo-network/payload-builder";
@@ -11,10 +16,10 @@ import { PayloadValidator } from "@xyo-network/payload-validator";
11
16
  import { useNetwork } from "@xyo-network/react-network";
12
17
  import { usePayloadRenderPluginResolver } from "@xyo-network/react-payload-plugin-resolver";
13
18
  import { HashTableCell, usePayloadHash } from "@xyo-network/react-shared";
14
- import React, { useMemo } from "react";
19
+ import { useMemo } from "react";
15
20
 
16
21
  // src/components/DynamicTable/PayloadDynamicTableColumnConfig.ts
17
- var payloadDynamicTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
22
+ var payloadDynamicTableColumnConfigDefaults = () => {
18
23
  const xs = [
19
24
  {
20
25
  alignment: "left",
@@ -158,80 +163,45 @@ var payloadDynamicTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
158
163
  xl,
159
164
  xs
160
165
  };
161
- }, "payloadDynamicTableColumnConfigDefaults");
166
+ };
162
167
 
163
168
  // src/components/DynamicTable/DynamicTableRow.tsx
164
- var PayloadDynamicTableRow = /* @__PURE__ */ __name(({ columns, network: networkProp, payload, ...props }) => {
169
+ import { jsx } from "react/jsx-runtime";
170
+ var PayloadDynamicTableRow = ({
171
+ columns,
172
+ network: networkProp,
173
+ payload,
174
+ ...props
175
+ }) => {
165
176
  const breakPoint = useBreakpoint();
166
177
  const payloadHash = usePayloadHash(payload);
167
178
  const { network } = useNetwork();
168
179
  const { resolver } = usePayloadRenderPluginResolver();
169
- const [validationErrors = []] = usePromise(async () => payload ? await new PayloadValidator(payload).validate() : void 0, [
170
- payload
171
- ]);
180
+ const [validationErrors = []] = usePromise(async () => payload ? await new PayloadValidator(payload).validate() : void 0, [payload]);
172
181
  const isValid = validationErrors.length === 0;
173
182
  const payloadFieldCount = payload ? Object.keys(PayloadBuilder.hashableFields(payload)).length : 0;
174
- const hash = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(HashTableCell, {
175
- key: "hash",
176
- align: "left",
177
- value: payloadHash,
178
- dataType: "payload",
179
- network: networkProp ?? network?.slug,
180
- ...props2
181
- }), "hash");
182
- const schema = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
183
- key: "payloads",
184
- align: "left",
185
- ...props2
186
- }, /* @__PURE__ */ React.createElement(Typography, {
187
- fontFamily: "monospace",
188
- variant: "body2",
189
- noWrap: true
190
- }, payload?.schema)), "schema");
191
- const details = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
192
- key: "payloads",
193
- align: "left",
194
- ...props2
195
- }, /* @__PURE__ */ React.createElement(Typography, {
196
- fontFamily: "monospace",
197
- variant: "body2",
198
- noWrap: true
199
- }, payloadFieldCount)), "details");
200
- const render = /* @__PURE__ */ __name((props2) => {
201
- const Render = payload ? resolver?.resolve(payload)?.components.table.cell : void 0;
202
- return Render ? /* @__PURE__ */ React.createElement(Render, {
203
- payload,
204
- ...props2
205
- }) : /* @__PURE__ */ React.createElement(TableCell, {
206
- key: "payloads",
183
+ const hash = (props2) => /* @__PURE__ */ jsx(
184
+ HashTableCell,
185
+ {
207
186
  align: "left",
187
+ value: payloadHash,
188
+ dataType: "payload",
189
+ network: networkProp ?? network?.slug,
208
190
  ...props2
209
- });
210
- }, "render");
211
- const icon = /* @__PURE__ */ __name((props2) => {
191
+ },
192
+ "hash"
193
+ );
194
+ const schema = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: /* @__PURE__ */ jsx(Typography, { fontFamily: "monospace", variant: "body2", noWrap: true, children: payload?.schema }) }, "payloads");
195
+ const details = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: /* @__PURE__ */ jsx(Typography, { fontFamily: "monospace", variant: "body2", noWrap: true, children: payloadFieldCount }) }, "payloads");
196
+ const render = (props2) => {
197
+ const Render = payload ? resolver?.resolve(payload)?.components.table.cell : void 0;
198
+ return Render ? /* @__PURE__ */ jsx(Render, { payload, ...props2 }) : /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2 }, "payloads");
199
+ };
200
+ const icon = (props2) => {
212
201
  const Avatar = payload ? resolver?.resolve(payload)?.components.avatar.image : void 0;
213
- return /* @__PURE__ */ React.createElement(TableCell, {
214
- key: "payloads",
215
- align: "left",
216
- ...props2
217
- }, Avatar ? /* @__PURE__ */ React.createElement(Avatar, {
218
- payload
219
- }) : null);
220
- }, "icon");
221
- const valid = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React.createElement(TableCell, {
222
- key: "valid",
223
- align: "center",
224
- ...props2
225
- }, isValid === void 0 && payload != void 0 ? /* @__PURE__ */ React.createElement(WarningAmberRoundedIcon, {
226
- fontSize: "small",
227
- color: "warning"
228
- }) : isValid === true ? /* @__PURE__ */ React.createElement(CheckCircleOutlineRoundedIcon, {
229
- fontSize: "small",
230
- color: "success"
231
- }) : isValid === false ? /* @__PURE__ */ React.createElement(ErrorOutlineRoundedIcon, {
232
- color: "error",
233
- fontSize: "small"
234
- }) : /* @__PURE__ */ React.createElement(Typography, null, "\xA0")), "valid");
202
+ return /* @__PURE__ */ jsx(TableCell, { align: "left", ...props2, children: Avatar ? /* @__PURE__ */ jsx(Avatar, { payload }) : null }, "payloads");
203
+ };
204
+ const valid = (props2) => /* @__PURE__ */ jsx(TableCell, { align: "center", ...props2, children: isValid === void 0 && payload != void 0 ? /* @__PURE__ */ jsx(WarningAmberRoundedIcon, { fontSize: "small", color: "warning" }) : isValid === true ? /* @__PURE__ */ jsx(CheckCircleOutlineRoundedIcon, { fontSize: "small", color: "success" }) : isValid === false ? /* @__PURE__ */ jsx(ErrorOutlineRoundedIcon, { color: "error", fontSize: "small" }) : /* @__PURE__ */ jsx(Typography, { children: " \xA0" }) }, "valid");
235
205
  const tableCells = {
236
206
  details,
237
207
  hash,
@@ -240,144 +210,142 @@ var PayloadDynamicTableRow = /* @__PURE__ */ __name(({ columns, network: network
240
210
  schema,
241
211
  valid
242
212
  };
243
- const columnsMemo = useMemo(() => columns ?? payloadDynamicTableColumnConfigDefaults(), [
244
- columns
245
- ]);
246
- return breakPoint ? /* @__PURE__ */ React.createElement(TableRow, {
247
- style: {
248
- maxWidth: "100vw"
249
- },
250
- ...props
251
- }, columnsMemo[breakPoint]?.map((column) => {
213
+ const columnsMemo = useMemo(() => columns ?? payloadDynamicTableColumnConfigDefaults(), [columns]);
214
+ return breakPoint ? /* @__PURE__ */ jsx(TableRow, { style: { maxWidth: "100vw" }, ...props, children: columnsMemo[breakPoint]?.map((column) => {
252
215
  return column.slug ? tableCells[column.slug]({}) : null;
253
- })) : null;
254
- }, "PayloadDynamicTableRow");
216
+ }) }) : null;
217
+ };
255
218
 
256
219
  // src/components/DynamicTable/Table.tsx
257
- import { FirstPage as FirstPageIcon, KeyboardArrowLeft, KeyboardArrowRight, LastPage as LastPageIcon } from "@mui/icons-material";
258
- import { Alert, Box, IconButton, Table, TableBody, TableCell as TableCell2, TableFooter, TableHead, TablePagination, TableRow as TableRow2, Typography as Typography2, useTheme } from "@mui/material";
220
+ import {
221
+ FirstPage as FirstPageIcon,
222
+ KeyboardArrowLeft,
223
+ KeyboardArrowRight,
224
+ LastPage as LastPageIcon
225
+ } from "@mui/icons-material";
226
+ import {
227
+ Alert,
228
+ Box,
229
+ IconButton,
230
+ Table,
231
+ TableBody,
232
+ TableCell as TableCell2,
233
+ TableFooter,
234
+ TableHead,
235
+ TablePagination,
236
+ TableRow as TableRow2,
237
+ Typography as Typography2,
238
+ useTheme
239
+ } from "@mui/material";
259
240
  import { ThrownErrorBoundary } from "@xylabs/react-error";
260
241
  import { useResetState } from "@xylabs/react-hooks";
261
242
  import { useBreakpoint as useBreakpoint2 } from "@xylabs/react-shared";
262
243
  import { usePayloadHashes } from "@xyo-network/react-shared";
263
- import React2, { useMemo as useMemo2, useState } from "react";
264
- var TablePaginationActions = /* @__PURE__ */ __name((props) => {
244
+ import { useMemo as useMemo2, useState } from "react";
245
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
246
+ var TablePaginationActions = (props) => {
265
247
  const theme = useTheme();
266
- const { count, page, rowsPerPage, onPageChange } = props;
267
- const handleFirstPageButtonClick = /* @__PURE__ */ __name((event) => {
248
+ const {
249
+ count,
250
+ page,
251
+ rowsPerPage,
252
+ onPageChange
253
+ } = props;
254
+ const handleFirstPageButtonClick = (event) => {
268
255
  onPageChange(event, 0);
269
- }, "handleFirstPageButtonClick");
270
- const handleBackButtonClick = /* @__PURE__ */ __name((event) => {
256
+ };
257
+ const handleBackButtonClick = (event) => {
271
258
  onPageChange(event, page - 1);
272
- }, "handleBackButtonClick");
273
- const handleNextButtonClick = /* @__PURE__ */ __name((event) => {
259
+ };
260
+ const handleNextButtonClick = (event) => {
274
261
  onPageChange(event, page + 1);
275
- }, "handleNextButtonClick");
276
- const handleLastPageButtonClick = /* @__PURE__ */ __name((event) => {
262
+ };
263
+ const handleLastPageButtonClick = (event) => {
277
264
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
278
- }, "handleLastPageButtonClick");
279
- return /* @__PURE__ */ React2.createElement(Box, {
280
- sx: {
281
- flexShrink: 0,
282
- ml: 2.5
283
- }
284
- }, /* @__PURE__ */ React2.createElement(IconButton, {
285
- onClick: handleFirstPageButtonClick,
286
- disabled: page === 0,
287
- "aria-label": "first page"
288
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(LastPageIcon, null) : /* @__PURE__ */ React2.createElement(FirstPageIcon, null)), /* @__PURE__ */ React2.createElement(IconButton, {
289
- onClick: handleBackButtonClick,
290
- disabled: page === 0,
291
- "aria-label": "previous page"
292
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(KeyboardArrowRight, null) : /* @__PURE__ */ React2.createElement(KeyboardArrowLeft, null)), /* @__PURE__ */ React2.createElement(IconButton, {
293
- onClick: handleNextButtonClick,
294
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
295
- "aria-label": "next page"
296
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(KeyboardArrowLeft, null) : /* @__PURE__ */ React2.createElement(KeyboardArrowRight, null)), /* @__PURE__ */ React2.createElement(IconButton, {
297
- onClick: handleLastPageButtonClick,
298
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
299
- "aria-label": "last page"
300
- }, theme.direction === "rtl" ? /* @__PURE__ */ React2.createElement(FirstPageIcon, null) : /* @__PURE__ */ React2.createElement(LastPageIcon, null)));
301
- }, "TablePaginationActions");
302
- var PayloadDynamicTable = /* @__PURE__ */ __name(({ archive, children, columns, exploreDomain, onRowClick, rowsPerPage: rowsPerPageProp = 10, payloads, ...props }) => {
265
+ };
266
+ return /* @__PURE__ */ jsxs(Box, { sx: { flexShrink: 0, ml: 2.5 }, children: [
267
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleFirstPageButtonClick, disabled: page === 0, "aria-label": "first page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(LastPageIcon, {}) : /* @__PURE__ */ jsx2(FirstPageIcon, {}) }),
268
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleBackButtonClick, disabled: page === 0, "aria-label": "previous page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(KeyboardArrowRight, {}) : /* @__PURE__ */ jsx2(KeyboardArrowLeft, {}) }),
269
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleNextButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "next page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(KeyboardArrowLeft, {}) : /* @__PURE__ */ jsx2(KeyboardArrowRight, {}) }),
270
+ /* @__PURE__ */ jsx2(IconButton, { onClick: handleLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx2(FirstPageIcon, {}) : /* @__PURE__ */ jsx2(LastPageIcon, {}) })
271
+ ] });
272
+ };
273
+ var PayloadDynamicTable = ({
274
+ archive,
275
+ children,
276
+ columns,
277
+ exploreDomain,
278
+ onRowClick,
279
+ rowsPerPage: rowsPerPageProp = 10,
280
+ payloads,
281
+ ...props
282
+ }) => {
303
283
  const breakPoint = useBreakpoint2();
304
284
  const [page, setPage] = useState(0);
305
285
  const [rowsPerPage, setRowsPerPage] = useResetState(rowsPerPageProp);
306
286
  const payloadCount = payloads ? payloads.length : 0;
307
287
  const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - payloadCount) : 0;
308
- const pagedPayloads = useMemo2(() => payloads?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [
309
- payloads,
310
- page,
311
- rowsPerPage
312
- ]);
288
+ const pagedPayloads = useMemo2(() => payloads?.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage), [payloads, page, rowsPerPage]);
313
289
  const payloadPairs = usePayloadHashes(pagedPayloads);
314
- const handleChangePage = /* @__PURE__ */ __name((event, newPage) => {
290
+ const handleChangePage = (event, newPage) => {
315
291
  setPage(newPage);
316
- }, "handleChangePage");
317
- const handleChangeRowsPerPage = /* @__PURE__ */ __name((event) => {
292
+ };
293
+ const handleChangeRowsPerPage = (event) => {
318
294
  setRowsPerPage(Number.parseInt(event.target.value, 10));
319
295
  setPage(0);
320
- }, "handleChangeRowsPerPage");
321
- return breakPoint ? /* @__PURE__ */ React2.createElement(Table, {
322
- stickyHeader: true,
323
- ...props
324
- }, /* @__PURE__ */ React2.createElement(TableHead, null, /* @__PURE__ */ React2.createElement(TableRow2, null, (columns ?? payloadDynamicTableColumnConfigDefaults())[breakPoint]?.map((column, index) => {
325
- return /* @__PURE__ */ React2.createElement(TableCell2, {
326
- key: index,
327
- align: column.alignment ?? "left",
328
- width: column.width
329
- }, /* @__PURE__ */ React2.createElement(Typography2, {
330
- variant: "body2",
331
- noWrap: true
332
- }, column.name));
333
- }))), /* @__PURE__ */ React2.createElement(TableBody, {
334
- sx: {
335
- overflowY: "scroll "
336
- }
337
- }, payloadPairs?.map(([payload, hash], index) => {
338
- return /* @__PURE__ */ React2.createElement(ThrownErrorBoundary, {
339
- boundaryName: "PayloadTableBody",
340
- key: `${hash}-${index}`,
341
- errorComponent: /* @__PURE__ */ __name((e) => /* @__PURE__ */ React2.createElement(Alert, {
342
- severity: "error"
343
- }, "Error Loading Payload:", " ", /* @__PURE__ */ React2.createElement(Typography2, {
344
- fontWeight: "bold"
345
- }, e.message)), "errorComponent")
346
- }, /* @__PURE__ */ React2.createElement(PayloadDynamicTableRow, {
347
- archive,
348
- onClick: onRowClick ? () => {
349
- onRowClick(payload);
350
- } : void 0,
351
- exploreDomain,
352
- payload
353
- }));
354
- }), children, emptyRows ? Array.from({
355
- length: emptyRows
356
- }).fill(/* @__PURE__ */ React2.createElement(PayloadDynamicTableRow, null)) : null), /* @__PURE__ */ React2.createElement(TableFooter, null, /* @__PURE__ */ React2.createElement(TableRow2, null, /* @__PURE__ */ React2.createElement(TablePagination, {
357
- rowsPerPageOptions: [
358
- 5,
359
- 10,
360
- 25,
296
+ };
297
+ return breakPoint ? /* @__PURE__ */ jsxs(Table, { stickyHeader: true, ...props, children: [
298
+ /* @__PURE__ */ jsx2(TableHead, { children: /* @__PURE__ */ jsx2(TableRow2, { children: (columns ?? payloadDynamicTableColumnConfigDefaults())[breakPoint]?.map((column) => {
299
+ return /* @__PURE__ */ jsx2(TableCell2, { align: column.alignment ?? "left", width: column.width, children: /* @__PURE__ */ jsx2(Typography2, { variant: "body2", noWrap: true, children: column.name }) }, column.name);
300
+ }) }) }),
301
+ /* @__PURE__ */ jsxs(TableBody, { sx: { overflowY: "scroll " }, children: [
302
+ payloadPairs?.map(([payload, hash]) => {
303
+ return /* @__PURE__ */ jsx2(
304
+ ThrownErrorBoundary,
305
+ {
306
+ boundaryName: "PayloadTableBody",
307
+ errorComponent: (e) => /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
308
+ "Error Loading Payload:",
309
+ " ",
310
+ /* @__PURE__ */ jsx2(Typography2, { fontWeight: "bold", children: e.message })
311
+ ] }),
312
+ children: /* @__PURE__ */ jsx2(
313
+ PayloadDynamicTableRow,
314
+ {
315
+ archive,
316
+ onClick: onRowClick ? () => {
317
+ onRowClick(payload);
318
+ } : void 0,
319
+ exploreDomain,
320
+ payload
321
+ }
322
+ )
323
+ },
324
+ hash
325
+ );
326
+ }),
327
+ children,
328
+ emptyRows ? Array.from({ length: emptyRows }).fill(/* @__PURE__ */ jsx2(PayloadDynamicTableRow, {})) : null
329
+ ] }),
330
+ /* @__PURE__ */ jsx2(TableFooter, { children: /* @__PURE__ */ jsx2(TableRow2, { children: /* @__PURE__ */ jsx2(
331
+ TablePagination,
361
332
  {
362
- label: "All",
363
- value: -1
333
+ rowsPerPageOptions: [5, 10, 25, { label: "All", value: -1 }],
334
+ colSpan: 5,
335
+ count: payloadCount,
336
+ rowsPerPage,
337
+ page,
338
+ SelectProps: {
339
+ inputProps: { "aria-label": "rows per page" },
340
+ native: true
341
+ },
342
+ onPageChange: handleChangePage,
343
+ onRowsPerPageChange: handleChangeRowsPerPage,
344
+ ActionsComponent: TablePaginationActions
364
345
  }
365
- ],
366
- colSpan: 5,
367
- count: payloadCount,
368
- rowsPerPage,
369
- page,
370
- SelectProps: {
371
- inputProps: {
372
- "aria-label": "rows per page"
373
- },
374
- native: true
375
- },
376
- onPageChange: handleChangePage,
377
- onRowsPerPageChange: handleChangeRowsPerPage,
378
- ActionsComponent: TablePaginationActions
379
- })))) : null;
380
- }, "PayloadDynamicTable");
346
+ ) }) })
347
+ ] }) : null;
348
+ };
381
349
 
382
350
  // src/components/Table/PayloadTableColumnConfig.ts
383
351
  var payloadColumnNames = {
@@ -385,32 +353,12 @@ var payloadColumnNames = {
385
353
  schema: "Schema",
386
354
  valid: "Valid"
387
355
  };
388
- var payloadTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
389
- const xs = [
390
- "hash",
391
- "schema",
392
- "valid"
393
- ];
394
- const sm = [
395
- "hash",
396
- "schema",
397
- "valid"
398
- ];
399
- const md = [
400
- "hash",
401
- "schema",
402
- "valid"
403
- ];
404
- const lg = [
405
- "hash",
406
- "schema",
407
- "valid"
408
- ];
409
- const xl = [
410
- "hash",
411
- "schema",
412
- "valid"
413
- ];
356
+ var payloadTableColumnConfigDefaults = () => {
357
+ const xs = ["hash", "schema", "valid"];
358
+ const sm = ["hash", "schema", "valid"];
359
+ const md = ["hash", "schema", "valid"];
360
+ const lg = ["hash", "schema", "valid"];
361
+ const xl = ["hash", "schema", "valid"];
414
362
  return {
415
363
  lg,
416
364
  md,
@@ -418,290 +366,318 @@ var payloadTableColumnConfigDefaults = /* @__PURE__ */ __name(() => {
418
366
  xl,
419
367
  xs
420
368
  };
421
- }, "payloadTableColumnConfigDefaults");
369
+ };
422
370
 
423
371
  // src/components/Table/Table.tsx
424
372
  import { isDefinedNotNull } from "@xylabs/sdk-js";
425
373
  import { TableEx } from "@xyo-network/react-table";
426
- import React9, { useMemo as useMemo5, useState as useState2 } from "react";
374
+ import { useMemo as useMemo5, useState as useState2 } from "react";
427
375
 
428
376
  // src/components/Table/TableBody.tsx
429
- import { Alert as Alert2, TableBody as TableBody2, Typography as Typography4 } from "@mui/material";
377
+ import {
378
+ Alert as Alert2,
379
+ TableBody as TableBody2,
380
+ Typography as Typography4
381
+ } from "@mui/material";
430
382
  import { ThrownErrorBoundary as ThrownErrorBoundary2 } from "@xylabs/react-error";
431
383
  import { usePayloadHashes as usePayloadHashes2 } from "@xyo-network/react-shared";
432
- import React4 from "react";
433
384
 
434
385
  // src/components/Table/TableRow.tsx
435
- import { CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon2, ErrorOutlineRounded as ErrorOutlineRoundedIcon2, WarningAmberRounded as WarningAmberRoundedIcon2 } from "@mui/icons-material";
436
- import { alpha, Link, TableCell as TableCell3, TableRow as TableRow3, Typography as Typography3 } from "@mui/material";
386
+ import {
387
+ CheckCircleOutlineRounded as CheckCircleOutlineRoundedIcon2,
388
+ ErrorOutlineRounded as ErrorOutlineRoundedIcon2,
389
+ WarningAmberRounded as WarningAmberRoundedIcon2
390
+ } from "@mui/icons-material";
391
+ import {
392
+ alpha,
393
+ Link,
394
+ TableCell as TableCell3,
395
+ TableRow as TableRow3,
396
+ Typography as Typography3
397
+ } from "@mui/material";
437
398
  import { usePromise as usePromise2 } from "@xylabs/react-promise";
438
399
  import { useBreakpoint as useBreakpoint3 } from "@xylabs/react-shared";
439
400
  import { isDefined } from "@xylabs/sdk-js";
440
401
  import { PayloadValidator as PayloadValidator2 } from "@xyo-network/payload-validator";
441
402
  import { useEvent } from "@xyo-network/react-event";
442
403
  import { HashTableCell as HashTableCell2, usePayloadHash as usePayloadHash2 } from "@xyo-network/react-shared";
443
- import React3, { useMemo as useMemo3 } from "react";
444
- var PayloadTableRow = /* @__PURE__ */ __name(({ clickableFields, columns, maxSchemaDepth, network: networkProp, onHashClick, payload, ...props }) => {
404
+ import { useMemo as useMemo3 } from "react";
405
+ import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
406
+ var PayloadTableRow = ({
407
+ clickableFields,
408
+ columns,
409
+ maxSchemaDepth,
410
+ network: networkProp,
411
+ onHashClick,
412
+ payload,
413
+ ...props
414
+ }) => {
445
415
  const breakPoint = useBreakpoint3();
446
416
  const payloadHash = usePayloadHash2(payload);
447
417
  const [anchorRef, dispatch] = useEvent();
448
- const [errors = []] = usePromise2(async () => payload ? await new PayloadValidator2(payload).validate() : void 0, [
449
- payload
450
- ]);
418
+ const [errors = []] = usePromise2(async () => payload ? await new PayloadValidator2(payload).validate() : void 0, [payload]);
451
419
  const isValid = errors.length === 0;
452
- const hash = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(HashTableCell2, {
453
- dataType: "payload",
454
- key: "hash",
455
- onHashClick,
456
- value: payloadHash,
457
- width: "100%",
458
- ...props2
459
- }, isDefined(payloadHash) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, clickableFields?.includes("hash") ? /* @__PURE__ */ React3.createElement(Link, {
460
- onClick: /* @__PURE__ */ __name(() => dispatch("hash", "click", payloadHash), "onClick"),
461
- ref: anchorRef,
462
- sx: {
463
- cursor: "pointer"
464
- }
465
- }, payloadHash) : payloadHash)), "hash");
466
- const reduceSchemaDepth = /* @__PURE__ */ __name((schema2, maxSchemaDepth2) => {
420
+ const hash = (props2) => /* @__PURE__ */ jsx3(
421
+ HashTableCell2,
422
+ {
423
+ dataType: "payload",
424
+ onHashClick,
425
+ value: payloadHash,
426
+ width: "100%",
427
+ ...props2,
428
+ children: isDefined(payloadHash) && /* @__PURE__ */ jsx3(Fragment, { children: clickableFields?.includes("hash") ? /* @__PURE__ */ jsx3(Link, { onClick: () => dispatch("hash", "click", payloadHash), ref: anchorRef, sx: { cursor: "pointer" }, children: payloadHash }) : payloadHash })
429
+ },
430
+ "hash"
431
+ );
432
+ const reduceSchemaDepth = (schema2, maxSchemaDepth2) => {
467
433
  if (isDefined(maxSchemaDepth2)) {
468
434
  const parts = schema2?.split(".") ?? [];
469
435
  const partsToRemove = Math.max(parts.length - maxSchemaDepth2, 0);
470
436
  if (partsToRemove > 0) {
471
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(React3.Fragment, null, "\u2026"), `${parts.slice(partsToRemove).reduce((previousValue, part) => previousValue + "." + part, "")}`);
437
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
438
+ /* @__PURE__ */ jsx3(Fragment, { children: "\u2026" }),
439
+ `${parts.slice(partsToRemove).reduce((previousValue, part) => previousValue + "." + part, "")}`
440
+ ] });
472
441
  }
473
442
  }
474
443
  return schema2;
475
- }, "reduceSchemaDepth");
476
- const schema = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(TableCell3, {
477
- title: payload?.schema,
478
- key: "payloads",
479
- align: "center",
480
- ...props2
481
- }, /* @__PURE__ */ React3.createElement(Typography3, {
482
- fontFamily: "monospace",
483
- variant: "body2",
484
- noWrap: true
485
- }, clickableFields?.includes("schema") ? /* @__PURE__ */ React3.createElement(Link, {
486
- sx: {
487
- cursor: "pointer"
488
- }
489
- }, reduceSchemaDepth(payload?.schema, maxSchemaDepth)) : reduceSchemaDepth(payload?.schema, maxSchemaDepth))), "schema");
490
- const valid = /* @__PURE__ */ __name((props2) => /* @__PURE__ */ React3.createElement(TableCell3, {
491
- key: "valid",
492
- align: "center",
493
- ...props2
494
- }, isValid === void 0 && payload != void 0 ? /* @__PURE__ */ React3.createElement(WarningAmberRoundedIcon2, {
495
- fontSize: "small",
496
- color: "warning"
497
- }) : isValid === true ? /* @__PURE__ */ React3.createElement(CheckCircleOutlineRoundedIcon2, {
498
- fontSize: "small",
499
- color: "success"
500
- }) : isValid === false ? /* @__PURE__ */ React3.createElement(ErrorOutlineRoundedIcon2, {
501
- color: "error",
502
- fontSize: "small"
503
- }) : /* @__PURE__ */ React3.createElement(ErrorOutlineRoundedIcon2, {
504
- sx: {
505
- color: alpha("#fff", 0)
506
- },
507
- fontSize: "small"
508
- })), "valid");
444
+ };
445
+ const schema = (props2) => /* @__PURE__ */ jsx3(TableCell3, { title: payload?.schema, align: "center", ...props2, children: /* @__PURE__ */ jsx3(Typography3, { fontFamily: "monospace", variant: "body2", noWrap: true, children: clickableFields?.includes("schema") ? /* @__PURE__ */ jsx3(Link, { sx: { cursor: "pointer" }, children: reduceSchemaDepth(payload?.schema, maxSchemaDepth) }) : reduceSchemaDepth(payload?.schema, maxSchemaDepth) }) }, "payloads");
446
+ const valid = (props2) => /* @__PURE__ */ jsx3(TableCell3, { align: "center", ...props2, children: isValid === void 0 && payload != void 0 ? /* @__PURE__ */ jsx3(WarningAmberRoundedIcon2, { fontSize: "small", color: "warning" }) : isValid === true ? /* @__PURE__ */ jsx3(CheckCircleOutlineRoundedIcon2, { fontSize: "small", color: "success" }) : isValid === false ? /* @__PURE__ */ jsx3(ErrorOutlineRoundedIcon2, { color: "error", fontSize: "small" }) : /* @__PURE__ */ jsx3(ErrorOutlineRoundedIcon2, { sx: { color: alpha("#fff", 0) }, fontSize: "small" }) }, "valid");
509
447
  const tableCells = {
510
448
  hash,
511
449
  schema,
512
450
  valid
513
451
  };
514
- const columnsMemo = useMemo3(() => columns ?? payloadTableColumnConfigDefaults(), [
515
- columns
516
- ]);
517
- return isDefined(breakPoint) ? /* @__PURE__ */ React3.createElement(TableRow3, {
518
- style: {
519
- maxWidth: "100vw"
520
- },
521
- ...props
522
- }, columnsMemo[breakPoint]?.map((column) => {
452
+ const columnsMemo = useMemo3(() => columns ?? payloadTableColumnConfigDefaults(), [columns]);
453
+ return isDefined(breakPoint) ? /* @__PURE__ */ jsx3(TableRow3, { style: { maxWidth: "100vw" }, ...props, children: columnsMemo[breakPoint]?.map((column) => {
523
454
  return tableCells[column]({});
524
- })) : null;
525
- }, "PayloadTableRow");
455
+ }) }) : null;
456
+ };
526
457
 
527
458
  // src/components/Table/TableBody.tsx
528
- var PayloadTableBody = /* @__PURE__ */ __name(({ children, clickableFields, payloads, maxSchemaDepth, onHashClick, onRowClick, emptyRows, noResults, NoResultRowComponent, ...props }) => {
459
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
460
+ var PayloadTableBody = ({
461
+ children,
462
+ clickableFields,
463
+ payloads,
464
+ maxSchemaDepth,
465
+ onHashClick,
466
+ onRowClick,
467
+ emptyRows,
468
+ noResults,
469
+ NoResultRowComponent,
470
+ ...props
471
+ }) => {
529
472
  const payloadPairs = usePayloadHashes2(payloads);
530
- return /* @__PURE__ */ React4.createElement(TableBody2, props, noResults && NoResultRowComponent ? /* @__PURE__ */ React4.createElement(NoResultRowComponent, null) : null, payloadPairs?.map(([payload, hash], index) => {
531
- return /* @__PURE__ */ React4.createElement(ThrownErrorBoundary2, {
532
- boundaryName: "PayloadTableBody",
533
- key: `${hash}-${index}`,
534
- errorComponent: /* @__PURE__ */ __name((e) => /* @__PURE__ */ React4.createElement(Alert2, {
535
- severity: "error"
536
- }, "Error Loading Payload:", " ", /* @__PURE__ */ React4.createElement(Typography4, {
537
- fontWeight: "bold"
538
- }, e.message)), "errorComponent")
539
- }, /* @__PURE__ */ React4.createElement(PayloadTableRow, {
540
- clickableFields,
541
- maxSchemaDepth,
542
- onClick: onRowClick ? () => {
543
- onRowClick(payload);
544
- } : void 0,
545
- onHashClick,
546
- payload
547
- }));
548
- }), children, emptyRows ? Array.from({
549
- length: emptyRows
550
- }).fill(/* @__PURE__ */ React4.createElement(PayloadTableRow, null)) : null);
551
- }, "PayloadTableBody");
473
+ return /* @__PURE__ */ jsxs3(TableBody2, { ...props, children: [
474
+ noResults && NoResultRowComponent ? /* @__PURE__ */ jsx4(NoResultRowComponent, {}) : null,
475
+ payloadPairs?.map(([payload, hash]) => {
476
+ return /* @__PURE__ */ jsx4(
477
+ ThrownErrorBoundary2,
478
+ {
479
+ boundaryName: "PayloadTableBody",
480
+ errorComponent: (e) => /* @__PURE__ */ jsxs3(Alert2, { severity: "error", children: [
481
+ "Error Loading Payload:",
482
+ " ",
483
+ /* @__PURE__ */ jsx4(Typography4, { fontWeight: "bold", children: e.message })
484
+ ] }),
485
+ children: /* @__PURE__ */ jsx4(
486
+ PayloadTableRow,
487
+ {
488
+ clickableFields,
489
+ maxSchemaDepth,
490
+ onClick: onRowClick ? () => {
491
+ onRowClick(payload);
492
+ } : void 0,
493
+ onHashClick,
494
+ payload
495
+ }
496
+ )
497
+ },
498
+ hash
499
+ );
500
+ }),
501
+ children,
502
+ emptyRows ? Array.from({ length: emptyRows }).fill(/* @__PURE__ */ jsx4(PayloadTableRow, {})) : null
503
+ ] });
504
+ };
552
505
 
553
506
  // src/components/Table/TableFooter.tsx
554
- import { styled, TablePagination as TablePagination2, TableRow as TableRow4 } from "@mui/material";
507
+ import {
508
+ styled,
509
+ TablePagination as TablePagination2,
510
+ TableRow as TableRow4
511
+ } from "@mui/material";
555
512
  import { TableFooterEx } from "@xyo-network/react-table";
556
- import React6 from "react";
557
513
 
558
514
  // src/components/Table/TablePagination.tsx
559
- import { FirstPage as FirstPageIcon2, KeyboardArrowLeft as KeyboardArrowLeft2, KeyboardArrowRight as KeyboardArrowRight2, LastPage as LastPageIcon2 } from "@mui/icons-material";
560
- import { Box as Box2, CircularProgress, IconButton as IconButton2, useTheme as useTheme2 } from "@mui/material";
515
+ import {
516
+ FirstPage as FirstPageIcon2,
517
+ KeyboardArrowLeft as KeyboardArrowLeft2,
518
+ KeyboardArrowRight as KeyboardArrowRight2,
519
+ LastPage as LastPageIcon2
520
+ } from "@mui/icons-material";
521
+ import {
522
+ Box as Box2,
523
+ CircularProgress,
524
+ IconButton as IconButton2,
525
+ useTheme as useTheme2
526
+ } from "@mui/material";
561
527
  import { useEvent as useEvent2 } from "@xyo-network/react-event";
562
- import React5 from "react";
563
- function TablePaginationActions2({ count, enableNextPage, loading, onPageChange, page, rowsPerPage }) {
528
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
529
+ function TablePaginationActions2({
530
+ count,
531
+ enableNextPage,
532
+ loading,
533
+ onPageChange,
534
+ page,
535
+ rowsPerPage
536
+ }) {
564
537
  const theme = useTheme2();
565
538
  const [paginationRef, paginationDispatch] = useEvent2();
566
- const handleFirstPageButtonClick = /* @__PURE__ */ __name((event) => {
539
+ const handleFirstPageButtonClick = (event) => {
567
540
  paginationDispatch("firstPage", "click", "true");
568
541
  onPageChange(event, 0);
569
- }, "handleFirstPageButtonClick");
570
- const handleBackButtonClick = /* @__PURE__ */ __name((event) => {
542
+ };
543
+ const handleBackButtonClick = (event) => {
571
544
  paginationDispatch("previousPage", "click", (page - 1)?.toString());
572
545
  onPageChange(event, page - 1);
573
- }, "handleBackButtonClick");
574
- const handleNextButtonClick = /* @__PURE__ */ __name((event) => {
546
+ };
547
+ const handleNextButtonClick = (event) => {
575
548
  paginationDispatch("nextPage", "click", (page + 1)?.toString());
576
549
  onPageChange(event, page + 1);
577
- }, "handleNextButtonClick");
578
- const handleLastPageButtonClick = /* @__PURE__ */ __name((event) => {
550
+ };
551
+ const handleLastPageButtonClick = (event) => {
579
552
  paginationDispatch("lastPage", "click", "true");
580
553
  onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
581
- }, "handleLastPageButtonClick");
582
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, loading ? /* @__PURE__ */ React5.createElement(CircularProgress, {
583
- size: "small",
584
- sx: {
585
- height: theme.spacing(2),
586
- position: "absolute",
587
- width: theme.spacing(2)
588
- }
589
- }) : null, /* @__PURE__ */ React5.createElement(Box2, {
590
- sx: {
591
- flexShrink: 0,
592
- ml: 2.5
593
- }
594
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
595
- onClick: handleFirstPageButtonClick,
596
- disabled: page === 0,
597
- "aria-label": "first page"
598
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(LastPageIcon2, null) : /* @__PURE__ */ React5.createElement(FirstPageIcon2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
599
- ref: paginationRef,
600
- onClick: handleBackButtonClick,
601
- disabled: page === 0,
602
- "aria-label": "previous page"
603
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(KeyboardArrowRight2, null) : /* @__PURE__ */ React5.createElement(KeyboardArrowLeft2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
604
- ref: paginationRef,
605
- onClick: handleNextButtonClick,
606
- disabled: !enableNextPage && page >= Math.ceil(count / rowsPerPage) - 1,
607
- "aria-label": "next page"
608
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(KeyboardArrowLeft2, null) : /* @__PURE__ */ React5.createElement(KeyboardArrowRight2, null)), /* @__PURE__ */ React5.createElement(IconButton2, {
609
- onClick: handleLastPageButtonClick,
610
- disabled: page >= Math.ceil(count / rowsPerPage) - 1,
611
- "aria-label": "last page"
612
- }, theme.direction === "rtl" ? /* @__PURE__ */ React5.createElement(FirstPageIcon2, null) : /* @__PURE__ */ React5.createElement(LastPageIcon2, null))));
554
+ };
555
+ return /* @__PURE__ */ jsxs4(Fragment2, { children: [
556
+ loading ? /* @__PURE__ */ jsx5(
557
+ CircularProgress,
558
+ {
559
+ size: "small",
560
+ sx: {
561
+ height: theme.spacing(2),
562
+ position: "absolute",
563
+ width: theme.spacing(2)
564
+ }
565
+ }
566
+ ) : null,
567
+ /* @__PURE__ */ jsxs4(Box2, { sx: { flexShrink: 0, ml: 2.5 }, children: [
568
+ /* @__PURE__ */ jsx5(IconButton2, { onClick: handleFirstPageButtonClick, disabled: page === 0, "aria-label": "first page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(LastPageIcon2, {}) : /* @__PURE__ */ jsx5(FirstPageIcon2, {}) }),
569
+ /* @__PURE__ */ jsx5(IconButton2, { ref: paginationRef, onClick: handleBackButtonClick, disabled: page === 0, "aria-label": "previous page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(KeyboardArrowRight2, {}) : /* @__PURE__ */ jsx5(KeyboardArrowLeft2, {}) }),
570
+ /* @__PURE__ */ jsx5(
571
+ IconButton2,
572
+ {
573
+ ref: paginationRef,
574
+ onClick: handleNextButtonClick,
575
+ disabled: !enableNextPage && page >= Math.ceil(count / rowsPerPage) - 1,
576
+ "aria-label": "next page",
577
+ children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(KeyboardArrowLeft2, {}) : /* @__PURE__ */ jsx5(KeyboardArrowRight2, {})
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsx5(IconButton2, { onClick: handleLastPageButtonClick, disabled: page >= Math.ceil(count / rowsPerPage) - 1, "aria-label": "last page", children: theme.direction === "rtl" ? /* @__PURE__ */ jsx5(FirstPageIcon2, {}) : /* @__PURE__ */ jsx5(LastPageIcon2, {}) })
581
+ ] })
582
+ ] });
613
583
  }
614
- __name(TablePaginationActions2, "TablePaginationActions");
615
584
 
616
585
  // src/components/Table/TableFooter.tsx
617
- var PayloadTableFooter = /* @__PURE__ */ __name(({ count, variant, page, rowsPerPage, handleChangePage, handleChangeRowsPerPage, fetchMorePayloads, loading }) => /* @__PURE__ */ React6.createElement(TableFooterEx, {
618
- variant
619
- }, /* @__PURE__ */ React6.createElement(TableRow4, null, /* @__PURE__ */ React6.createElement(StyledTablePagination, {
620
- rowsPerPageOptions: [
621
- 5,
622
- 10,
623
- 25,
624
- {
625
- label: "All",
626
- value: -1
627
- }
628
- ],
629
- count: count ?? 0,
630
- rowsPerPage: rowsPerPage ?? 10,
631
- page: page ?? 0,
632
- SelectProps: {
633
- inputProps: {
634
- "aria-label": "rows per page"
586
+ import { jsx as jsx6 } from "react/jsx-runtime";
587
+ var PayloadTableFooter = ({
588
+ count,
589
+ variant,
590
+ page,
591
+ rowsPerPage,
592
+ handleChangePage,
593
+ handleChangeRowsPerPage,
594
+ fetchMorePayloads,
595
+ loading
596
+ }) => /* @__PURE__ */ jsx6(TableFooterEx, { variant, children: /* @__PURE__ */ jsx6(TableRow4, { children: /* @__PURE__ */ jsx6(
597
+ StyledTablePagination,
598
+ {
599
+ rowsPerPageOptions: [5, 10, 25, { label: "All", value: -1 }],
600
+ count: count ?? 0,
601
+ rowsPerPage: rowsPerPage ?? 10,
602
+ page: page ?? 0,
603
+ SelectProps: {
604
+ inputProps: { "aria-label": "rows per page" },
605
+ native: true
635
606
  },
636
- native: true
637
- },
638
- onPageChange: handleChangePage ?? (() => {
639
- }),
640
- onRowsPerPageChange: handleChangeRowsPerPage ?? (() => {
641
- }),
642
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
643
- ActionsComponent: /* @__PURE__ */ __name((props) => /* @__PURE__ */ React6.createElement(TablePaginationActions2, {
644
- enableNextPage: !!fetchMorePayloads,
645
- loading,
646
- ...props
647
- }), "ActionsComponent")
648
- }))), "PayloadTableFooter");
607
+ onPageChange: handleChangePage ?? (() => {
608
+ }),
609
+ onRowsPerPageChange: handleChangeRowsPerPage ?? (() => {
610
+ }),
611
+ ActionsComponent: (props) => /* @__PURE__ */ jsx6(TablePaginationActions2, { enableNextPage: !!fetchMorePayloads, loading, ...props })
612
+ }
613
+ ) }) });
649
614
  var StyledTablePagination = styled(TablePagination2)(({ theme }) => ({
650
- "& > .MuiToolbar-root": {
651
- paddingLeft: theme.spacing(1)
652
- },
615
+ "& > .MuiToolbar-root": { paddingLeft: theme.spacing(1) },
653
616
  "borderTop": "1px solid",
654
617
  "borderTopColor": theme.vars.palette.divider
655
618
  }));
656
619
 
657
620
  // src/components/Table/TableHead.tsx
658
- import { TableCell as TableCell4, TableHead as TableHead2, TableRow as TableRow5, Typography as Typography5 } from "@mui/material";
621
+ import {
622
+ TableCell as TableCell4,
623
+ TableHead as TableHead2,
624
+ TableRow as TableRow5,
625
+ Typography as Typography5
626
+ } from "@mui/material";
659
627
  import { useBreakpoint as useBreakpoint4 } from "@xylabs/react-shared";
660
- import React7, { useMemo as useMemo4 } from "react";
661
- var PayloadTableHead = /* @__PURE__ */ __name(({ columns, ...props }) => {
628
+ import { useMemo as useMemo4 } from "react";
629
+ import { jsx as jsx7 } from "react/jsx-runtime";
630
+ var PayloadTableHead = ({ columns, ...props }) => {
662
631
  const breakPoint = useBreakpoint4();
663
- const columnsMemo = useMemo4(() => columns ?? payloadTableColumnConfigDefaults(), [
664
- columns
665
- ]);
666
- return /* @__PURE__ */ React7.createElement(TableHead2, props, /* @__PURE__ */ React7.createElement(TableRow5, null, breakPoint ? columnsMemo[breakPoint]?.map((column, index) => {
667
- return /* @__PURE__ */ React7.createElement(TableCell4, {
668
- key: index,
669
- width: index === 0 ? "100%" : void 0,
670
- align: index === 0 ? "left" : "center"
671
- }, /* @__PURE__ */ React7.createElement(Typography5, {
672
- variant: "body2",
673
- noWrap: true
674
- }, payloadColumnNames[column]));
675
- }) : null));
676
- }, "PayloadTableHead");
632
+ const columnsMemo = useMemo4(() => columns ?? payloadTableColumnConfigDefaults(), [columns]);
633
+ return /* @__PURE__ */ jsx7(TableHead2, { ...props, children: /* @__PURE__ */ jsx7(TableRow5, { children: breakPoint ? columnsMemo[breakPoint]?.map((column, index) => {
634
+ return /* @__PURE__ */ jsx7(TableCell4, { width: index === 0 ? "100%" : void 0, align: index === 0 ? "left" : "center", children: /* @__PURE__ */ jsx7(Typography5, { variant: "body2", noWrap: true, children: payloadColumnNames[column] }) }, column);
635
+ }) : null }) });
636
+ };
677
637
 
678
638
  // src/components/Table/TableRowNoData.tsx
679
- import { styled as styled2, TableCell as TableCell5, TableRow as TableRow6, Typography as Typography6 } from "@mui/material";
680
- import React8 from "react";
681
- var TableRowNoData = /* @__PURE__ */ __name(({ additionalCells, hideBorder = false, typographyProps, ...props }) => {
682
- return /* @__PURE__ */ React8.createElement(TableRow6, props, /* @__PURE__ */ React8.createElement(StyledTableCell, {
683
- hideBorder
684
- }, /* @__PURE__ */ React8.createElement(Typography6, {
685
- variant: "body2",
686
- ...typographyProps
687
- }, "No Data To Display...")), additionalCells ? Array.from({
688
- length: additionalCells
689
- }).fill(null).map((_fill, index) => /* @__PURE__ */ React8.createElement(StyledTableCell, {
690
- key: index,
691
- hideBorder
692
- })) : null);
693
- }, "TableRowNoData");
639
+ import {
640
+ styled as styled2,
641
+ TableCell as TableCell5,
642
+ TableRow as TableRow6,
643
+ Typography as Typography6
644
+ } from "@mui/material";
645
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
646
+ var TableRowNoData = ({
647
+ additionalCells,
648
+ hideBorder = false,
649
+ typographyProps,
650
+ ...props
651
+ }) => {
652
+ return /* @__PURE__ */ jsxs5(TableRow6, { ...props, children: [
653
+ /* @__PURE__ */ jsx8(StyledTableCell, { hideBorder, children: /* @__PURE__ */ jsx8(Typography6, { variant: "body2", ...typographyProps, children: "No Data To Display..." }) }),
654
+ additionalCells ? Array.from({ length: additionalCells }).fill(null).map((_fill, index) => /* @__PURE__ */ jsx8(StyledTableCell, { hideBorder }, `empty-row-${index}`)) : null
655
+ ] });
656
+ };
694
657
  var StyledTableCell = styled2(TableCell5, {
695
658
  name: "StyledTableCell",
696
- shouldForwardProp: /* @__PURE__ */ __name((prop) => prop !== "hideBorder", "shouldForwardProp")
697
- })(({ hideBorder }) => ({
698
- ...hideBorder && {
699
- border: "none"
700
- }
701
- }));
659
+ shouldForwardProp: (prop) => prop !== "hideBorder"
660
+ })(({ hideBorder }) => ({ ...hideBorder && { border: "none" } }));
702
661
 
703
662
  // src/components/Table/Table.tsx
704
- var PayloadTableWithRef = /* @__PURE__ */ __name(({ clickableFields, onHashClick, onRowClick, fetchMorePayloads, rowsPerPage: rowsPerPageProp = 25, payloads, columns, PayloadTableHeadComponent = PayloadTableHead, PayloadTableBodyComponent = PayloadTableBody, PayloadTableFooterComponent = PayloadTableFooter, maxSchemaDepth, count = 0, loading = false, variant = "scrollable", ...props }) => {
663
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
664
+ var PayloadTableWithRef = ({
665
+ clickableFields,
666
+ onHashClick,
667
+ onRowClick,
668
+ fetchMorePayloads,
669
+ rowsPerPage: rowsPerPageProp = 25,
670
+ payloads,
671
+ columns,
672
+ PayloadTableHeadComponent = PayloadTableHead,
673
+ PayloadTableBodyComponent = PayloadTableBody,
674
+ PayloadTableFooterComponent = PayloadTableFooter,
675
+ maxSchemaDepth,
676
+ count = 0,
677
+ loading = false,
678
+ variant = "scrollable",
679
+ ...props
680
+ }) => {
705
681
  const [page, setPage] = useState2(0);
706
682
  const [rowsPerPage, setRowsPerPage] = useState2(rowsPerPageProp);
707
683
  const [previousRowsPerPage, setPreviousRowsPerPage] = useState2(rowsPerPageProp);
@@ -719,7 +695,7 @@ var PayloadTableWithRef = /* @__PURE__ */ __name(({ clickableFields, onHashClick
719
695
  setVisiblePayloads(payloads.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage));
720
696
  }
721
697
  }
722
- const handleAdditionalPayloads = /* @__PURE__ */ __name(() => {
698
+ const handleAdditionalPayloads = () => {
723
699
  if (fetchMorePayloads && payloads) {
724
700
  const buffer = rowsPerPage * 2;
725
701
  const lastVisiblePayload = visiblePayloads?.at(-1);
@@ -730,46 +706,48 @@ var PayloadTableWithRef = /* @__PURE__ */ __name(({ clickableFields, onHashClick
730
706
  }
731
707
  }
732
708
  }
733
- }, "handleAdditionalPayloads");
734
- const handleChangePage = /* @__PURE__ */ __name((_event, newPage) => {
709
+ };
710
+ const handleChangePage = (_event, newPage) => {
735
711
  handleAdditionalPayloads();
736
712
  setPage(newPage);
737
- }, "handleChangePage");
738
- const handleChangeRowsPerPage = /* @__PURE__ */ __name((event) => {
713
+ };
714
+ const handleChangeRowsPerPage = (event) => {
739
715
  setRowsPerPage(Number.parseInt(event.target.value, 10));
740
716
  setPage(0);
741
- }, "handleChangeRowsPerPage");
717
+ };
742
718
  const noResults = useMemo5(() => {
743
719
  return !loading && visiblePayloads.length === 0;
744
- }, [
745
- loading,
746
- visiblePayloads
747
- ]);
748
- return /* @__PURE__ */ React9.createElement(TableEx, {
749
- variant,
750
- ...props
751
- }, /* @__PURE__ */ React9.createElement(PayloadTableHeadComponent, {
752
- columns
753
- }), /* @__PURE__ */ React9.createElement(PayloadTableBodyComponent, {
754
- clickableFields,
755
- payloads: visiblePayloads,
756
- maxSchemaDepth,
757
- onRowClick,
758
- onHashClick,
759
- emptyRows,
760
- noResults,
761
- NoResultRowComponent: TableRowNoData
762
- }), /* @__PURE__ */ React9.createElement(PayloadTableFooterComponent, {
763
- count,
764
- variant,
765
- rowsPerPage,
766
- handleChangePage,
767
- handleChangeRowsPerPage,
768
- fetchMorePayloads,
769
- loading,
770
- page
771
- }));
772
- }, "PayloadTableWithRef");
720
+ }, [loading, visiblePayloads]);
721
+ return /* @__PURE__ */ jsxs6(TableEx, { variant, ...props, children: [
722
+ /* @__PURE__ */ jsx9(PayloadTableHeadComponent, { columns }),
723
+ /* @__PURE__ */ jsx9(
724
+ PayloadTableBodyComponent,
725
+ {
726
+ clickableFields,
727
+ payloads: visiblePayloads,
728
+ maxSchemaDepth,
729
+ onRowClick,
730
+ onHashClick,
731
+ emptyRows,
732
+ noResults,
733
+ NoResultRowComponent: TableRowNoData
734
+ }
735
+ ),
736
+ /* @__PURE__ */ jsx9(
737
+ PayloadTableFooterComponent,
738
+ {
739
+ count,
740
+ variant,
741
+ rowsPerPage,
742
+ handleChangePage,
743
+ handleChangeRowsPerPage,
744
+ fetchMorePayloads,
745
+ loading,
746
+ page
747
+ }
748
+ )
749
+ ] });
750
+ };
773
751
  PayloadTableWithRef.displayName = "PayloadTable";
774
752
  var PayloadTable = PayloadTableWithRef;
775
753
  export {