@carlonicora/nextjs-jsonapi 3.20.0 → 3.21.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.
@@ -62,7 +62,7 @@ import {
62
62
  useCurrentUserContext,
63
63
  useDataListRetriever,
64
64
  usePageUrlGenerator
65
- } from "../chunk-CJHBL5AN.mjs";
65
+ } from "../chunk-HSVAW3DQ.mjs";
66
66
  import {
67
67
  getRoleId,
68
68
  getStripePublishableKey,
@@ -531,6 +531,8 @@ var badgeVariants = cva3(
531
531
  softGray: "bg-gray-500/10 text-gray-700 dark:bg-gray-500/15 dark:text-gray-400",
532
532
  softOrange: "bg-orange-500/10 text-orange-700 dark:bg-orange-500/15 dark:text-orange-400",
533
533
  softAmber: "bg-amber-500/10 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400",
534
+ softEmerald: "bg-emerald-500/10 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400",
535
+ softPurple: "bg-purple-500/10 text-purple-700 dark:bg-purple-500/15 dark:text-purple-400",
534
536
  blue: "bg-sky-500 text-primary-foreground [a]:hover:bg-sky-500/80",
535
537
  green: "bg-emerald-500 text-primary-foreground [a]:hover:bg-emerald-500/80",
536
538
  red: "bg-red-500 text-primary-foreground [a]:hover:bg-red-500/80",
@@ -10393,7 +10395,7 @@ import { useRef as useRef17 } from "react";
10393
10395
  import dynamic from "next/dynamic";
10394
10396
  import React18 from "react";
10395
10397
  import { jsx as jsx90 } from "react/jsx-runtime";
10396
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-CTRQ6JWE.mjs"), {
10398
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-CSLA3M32.mjs"), {
10397
10399
  ssr: false
10398
10400
  });
10399
10401
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -17661,6 +17663,18 @@ function getGroupKeys(item, field) {
17661
17663
  return [String(value ?? "")];
17662
17664
  }
17663
17665
  __name(getGroupKeys, "getGroupKeys");
17666
+ var isClassComponent = /* @__PURE__ */ __name((component) => typeof component === "function" && !!component.prototype?.isReactComponent, "isClassComponent");
17667
+ function StableCell({ render, context }) {
17668
+ return /* @__PURE__ */ jsx191(Fragment28, { children: render(context) });
17669
+ }
17670
+ __name(StableCell, "StableCell");
17671
+ function renderCell(cellDef, context) {
17672
+ if (typeof cellDef === "function" && !isClassComponent(cellDef)) {
17673
+ return /* @__PURE__ */ jsx191(StableCell, { render: cellDef, context });
17674
+ }
17675
+ return flexRender(cellDef, context);
17676
+ }
17677
+ __name(renderCell, "renderCell");
17664
17678
  var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(props) {
17665
17679
  const { data, fields, checkedIds, toggleId, allowSearch, filters: _filters, fullWidth, onRowClick } = props;
17666
17680
  const t = useTranslations61();
@@ -17693,6 +17707,14 @@ var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(pr
17693
17707
  data: tableData,
17694
17708
  columns: tableColumns,
17695
17709
  getCoreRowModel: getCoreRowModel(),
17710
+ ...props.renderExpandedRow && {
17711
+ getExpandedRowModel: getExpandedRowModel(),
17712
+ // Key rows by record id so an expansion stays with its record when a search or filter reorders the rows.
17713
+ getRowId: /* @__PURE__ */ __name((row, index) => row.jsonApiData?.id ?? String(index), "getRowId"),
17714
+ getRowCanExpand: /* @__PURE__ */ __name(() => true, "getRowCanExpand"),
17715
+ onExpandedChange: setExpanded,
17716
+ state: { expanded }
17717
+ },
17696
17718
  ...props.expandable && {
17697
17719
  getExpandedRowModel: getExpandedRowModel(),
17698
17720
  getSubRows: props.getSubRows,
@@ -17779,30 +17801,34 @@ var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(pr
17779
17801
  ] }),
17780
17802
  /* @__PURE__ */ jsx191(TableBody, { children: rowModel && rowModel.rows?.length ? groupedRows ? groupedRows.map((group) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17781
17803
  /* @__PURE__ */ jsx191(TableRow, { children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "bg-muted px-4 py-2", children: /* @__PURE__ */ jsx191(MicroLabel, { children: props.groupLabel?.(group.groupKey) ?? group.groupKey }) }) }),
17782
- group.rows.map((row) => /* @__PURE__ */ jsx191(
17804
+ group.rows.map((row) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17805
+ /* @__PURE__ */ jsx191(
17806
+ TableRow,
17807
+ {
17808
+ onClick: () => onRowClick?.(row.original.jsonApiData),
17809
+ className: `group ${onRowClick ? "hover:bg-muted/50 cursor-pointer" : ""}`,
17810
+ children: row.getVisibleCells().map((cell) => {
17811
+ const meta = cell.column.columnDef.meta;
17812
+ return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: renderCell(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17813
+ })
17814
+ }
17815
+ ),
17816
+ props.renderExpandedRow && row.getIsExpanded() && /* @__PURE__ */ jsx191(TableRow, { "data-testid": "content-list-table-expanded-row", children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "bg-muted/30 px-4 py-3", children: props.renderExpandedRow(row.original.jsonApiData) }) })
17817
+ ] }, row.id))
17818
+ ] }, group.groupKey)) : rowModel.rows.map((row) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17819
+ /* @__PURE__ */ jsx191(
17783
17820
  TableRow,
17784
17821
  {
17785
17822
  onClick: () => onRowClick?.(row.original.jsonApiData),
17786
17823
  className: `group ${onRowClick ? "hover:bg-muted/50 cursor-pointer" : ""}`,
17787
17824
  children: row.getVisibleCells().map((cell) => {
17788
17825
  const meta = cell.column.columnDef.meta;
17789
- return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17826
+ return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: renderCell(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17790
17827
  })
17791
- },
17792
- row.id
17793
- ))
17794
- ] }, group.groupKey)) : rowModel.rows.map((row) => /* @__PURE__ */ jsx191(
17795
- TableRow,
17796
- {
17797
- onClick: () => onRowClick?.(row.original.jsonApiData),
17798
- className: `group ${onRowClick ? "hover:bg-muted/50 cursor-pointer" : ""}`,
17799
- children: row.getVisibleCells().map((cell) => {
17800
- const meta = cell.column.columnDef.meta;
17801
- return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17802
- })
17803
- },
17804
- row.id
17805
- )) : /* @__PURE__ */ jsx191(TableRow, { children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "h-24 text-center", children: props.emptyState ?? (t.has("ui.empty_states.no_results") ? t("ui.empty_states.no_results") : "No results.") }) }) }),
17828
+ }
17829
+ ),
17830
+ props.renderExpandedRow && row.getIsExpanded() && /* @__PURE__ */ jsx191(TableRow, { "data-testid": "content-list-table-expanded-row", children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "bg-muted/30 px-4 py-3", children: props.renderExpandedRow(row.original.jsonApiData) }) })
17831
+ ] }, row.id)) : /* @__PURE__ */ jsx191(TableRow, { children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "h-24 text-center", children: props.emptyState ?? (t.has("ui.empty_states.no_results") ? t("ui.empty_states.no_results") : "No results.") }) }) }),
17806
17832
  showFooter && /* @__PURE__ */ jsx191(TableFooter, { children: /* @__PURE__ */ jsx191(TableRow, { children: /* @__PURE__ */ jsx191(TableCell, { colSpan: tableColumns.length, className: "bg-card py-4 text-end", children: /* @__PURE__ */ jsxs103("div", { className: "flex items-center justify-end space-x-2", children: [
17807
17833
  /* @__PURE__ */ jsx191(
17808
17834
  Button,
@@ -27247,4 +27273,4 @@ export {
27247
27273
  useOAuthClients,
27248
27274
  useOAuthClient
27249
27275
  };
27250
- //# sourceMappingURL=chunk-CJHBL5AN.mjs.map
27276
+ //# sourceMappingURL=chunk-HSVAW3DQ.mjs.map