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