@carlonicora/nextjs-jsonapi 3.20.1 → 3.22.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.
Files changed (34) hide show
  1. package/dist/{BlockNoteEditor-FKYWM4NJ.mjs → BlockNoteEditor-5QBGVWE7.mjs} +2 -2
  2. package/dist/{BlockNoteEditor-2M2M7MT4.js → BlockNoteEditor-VEEMWB2J.js} +9 -9
  3. package/dist/{BlockNoteEditor-2M2M7MT4.js.map → BlockNoteEditor-VEEMWB2J.js.map} +1 -1
  4. package/dist/billing/index.js +335 -335
  5. package/dist/billing/index.mjs +1 -1
  6. package/dist/{chunk-HP3SPOPP.mjs → chunk-5G7I3OUB.mjs} +42 -21
  7. package/dist/chunk-5G7I3OUB.mjs.map +1 -0
  8. package/dist/{chunk-XMYHR2EF.js → chunk-XYSWOW5G.js} +142 -121
  9. package/dist/chunk-XYSWOW5G.js.map +1 -0
  10. package/dist/client/index.js +2 -2
  11. package/dist/client/index.mjs +1 -1
  12. package/dist/components/index.d.mts +10 -2
  13. package/dist/components/index.d.ts +10 -2
  14. package/dist/components/index.js +4 -2
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/components/index.mjs +3 -1
  17. package/dist/contexts/index.js +2 -2
  18. package/dist/contexts/index.mjs +1 -1
  19. package/dist/features/help/index.js +31 -31
  20. package/dist/features/help/index.mjs +1 -1
  21. package/dist/features/tokenusage/index.js +75 -75
  22. package/dist/features/tokenusage/index.mjs +1 -1
  23. package/package.json +1 -1
  24. package/src/components/containers/RoundPageContainer.tsx +6 -2
  25. package/src/components/containers/__tests__/RoundPageContainer.padding.spec.tsx +64 -0
  26. package/src/components/navigations/Header.tsx +3 -2
  27. package/src/components/navigations/__tests__/Header.spec.tsx +60 -0
  28. package/src/components/tables/ContentListTable.tsx +56 -26
  29. package/src/components/tables/__tests__/ContentListTable.spec.tsx +133 -10
  30. package/src/shadcnui/ui/badge.tsx +2 -0
  31. package/src/shadcnui/ui/sidebar.tsx +6 -0
  32. package/dist/chunk-HP3SPOPP.mjs.map +0 -1
  33. package/dist/chunk-XMYHR2EF.js.map +0 -1
  34. /package/dist/{BlockNoteEditor-FKYWM4NJ.mjs.map → BlockNoteEditor-5QBGVWE7.mjs.map} +0 -0
@@ -62,7 +62,7 @@ import {
62
62
  useCurrentUserContext,
63
63
  useDataListRetriever,
64
64
  usePageUrlGenerator
65
- } from "../chunk-HP3SPOPP.mjs";
65
+ } from "../chunk-5G7I3OUB.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",
@@ -3698,6 +3700,10 @@ function useSidebar() {
3698
3700
  return context;
3699
3701
  }
3700
3702
  __name(useSidebar, "useSidebar");
3703
+ function useOptionalSidebar() {
3704
+ return React8.useContext(SidebarContext);
3705
+ }
3706
+ __name(useOptionalSidebar, "useOptionalSidebar");
3701
3707
  function SidebarProvider({
3702
3708
  defaultOpen = true,
3703
3709
  open: openProp,
@@ -10393,7 +10399,7 @@ import { useRef as useRef17 } from "react";
10393
10399
  import dynamic from "next/dynamic";
10394
10400
  import React18 from "react";
10395
10401
  import { jsx as jsx90 } from "react/jsx-runtime";
10396
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-FKYWM4NJ.mjs"), {
10402
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-5QBGVWE7.mjs"), {
10397
10403
  ssr: false
10398
10404
  });
10399
10405
  var BlockNoteEditorContainer = React18.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -15046,6 +15052,7 @@ function Header({ children, mobileChildren, leftContent, logo, className }) {
15046
15052
  const rootLabel = useHeaderRootLabel();
15047
15053
  const isRootHidden = useIsBreadcrumbRootHidden();
15048
15054
  const isMobile = useIsMobile();
15055
+ const sidebar = useOptionalSidebar();
15049
15056
  return (
15050
15057
  // Outer element owns the safe-area inset; the inner row keeps h-12 so the
15051
15058
  // content height is unchanged and only the notch padding is added above.
@@ -15065,7 +15072,7 @@ function Header({ children, mobileChildren, leftContent, logo, className }) {
15065
15072
  className: `bg-sidebar sticky top-0 z-10 flex h-[var(--app-header-h,calc(3rem_+_env(safe-area-inset-top)))] flex-col items-center justify-start gap-x-4 pt-[env(safe-area-inset-top)] ${className ?? ""}`,
15066
15073
  children: /* @__PURE__ */ jsxs87("div", { className: "bg-sidebar flex h-12 w-full flex-row items-center justify-between ps-2 pe-4", children: [
15067
15074
  isMobile && logo && /* @__PURE__ */ jsx161("div", { className: "flex shrink-0 flex-row items-center pe-1", children: logo }),
15068
- /* @__PURE__ */ jsx161(SidebarTrigger, { "aria-label": "Toggle sidebar", id: "sidebar-trigger" }),
15075
+ sidebar && /* @__PURE__ */ jsx161(SidebarTrigger, { "aria-label": "Toggle sidebar", id: "sidebar-trigger" }),
15069
15076
  leftContent,
15070
15077
  /* @__PURE__ */ jsx161("div", { className: "flex w-full flex-row items-center justify-start", children: /* @__PURE__ */ jsx161(BreadcrumbNavigation, { items: breadcrumbs, rootLabel: rootLabel ?? void 0, showRoot: !isRootHidden }) }),
15071
15078
  isMobile ? mobileChildren && /* @__PURE__ */ jsx161("div", { className: "flex shrink-0 flex-row items-center justify-end gap-x-2 whitespace-nowrap", children: mobileChildren }) : children && // No fixed width: the widget slot sizes to its content and the
@@ -15626,6 +15633,7 @@ function RoundPageContainer({
15626
15633
  const headerMobileChildren = useHeaderMobileChildren();
15627
15634
  const [showDetails, setShowDetailsState] = useState52(defaultDetailsOpen);
15628
15635
  const isMobile = useIsMobile();
15636
+ const hasSidebar = useOptionalSidebar() !== null;
15629
15637
  const [mounted, setMounted] = useState52(false);
15630
15638
  useEffect42(() => {
15631
15639
  const match = document.cookie.split("; ").find((row) => row.startsWith(`${detailsCookieName}=`));
@@ -15713,7 +15721,7 @@ function RoundPageContainer({
15713
15721
  // render 78px tall; below the bar it became a visible gap. The
15714
15722
  // swipe-up gesture region is unaffected either way — it is a gesture
15715
15723
  // area, not painted chrome.
15716
- isMobile ? "gap-1 p-1 pt-0" : "p-2 pt-0 ps-0"
15724
+ isMobile ? "gap-1 p-1 pt-0" : cn("p-2 pt-0", hasSidebar && "ps-0")
15717
15725
  ),
15718
15726
  children: [
15719
15727
  /* @__PURE__ */ jsx170("div", { className: cn("bg-background flex min-h-0 w-full flex-1", isMobile ? "" : "rounded-lg border p-0"), children: /* @__PURE__ */ jsx170("div", { className: "flex w-full flex-col" }) }),
@@ -15749,7 +15757,7 @@ function RoundPageContainer({
15749
15757
  // render 78px tall; below the bar it became a visible gap. The
15750
15758
  // swipe-up gesture region is unaffected either way — it is a gesture
15751
15759
  // area, not painted chrome.
15752
- isMobile ? "gap-1 p-1 pt-0" : "p-2 pt-0 ps-0"
15760
+ isMobile ? "gap-1 p-1 pt-0" : cn("p-2 pt-0", hasSidebar && "ps-0")
15753
15761
  ),
15754
15762
  children: [
15755
15763
  /* @__PURE__ */ jsxs94("div", { className: "bg-background flex min-h-0 w-full flex-1 rounded-lg border p-0", children: [
@@ -17705,6 +17713,14 @@ var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(pr
17705
17713
  data: tableData,
17706
17714
  columns: tableColumns,
17707
17715
  getCoreRowModel: getCoreRowModel(),
17716
+ ...props.renderExpandedRow && {
17717
+ getExpandedRowModel: getExpandedRowModel(),
17718
+ // Key rows by record id so an expansion stays with its record when a search or filter reorders the rows.
17719
+ getRowId: /* @__PURE__ */ __name((row, index) => row.jsonApiData?.id ?? String(index), "getRowId"),
17720
+ getRowCanExpand: /* @__PURE__ */ __name(() => true, "getRowCanExpand"),
17721
+ onExpandedChange: setExpanded,
17722
+ state: { expanded }
17723
+ },
17708
17724
  ...props.expandable && {
17709
17725
  getExpandedRowModel: getExpandedRowModel(),
17710
17726
  getSubRows: props.getSubRows,
@@ -17791,7 +17807,22 @@ var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(pr
17791
17807
  ] }),
17792
17808
  /* @__PURE__ */ jsx191(TableBody, { children: rowModel && rowModel.rows?.length ? groupedRows ? groupedRows.map((group) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17793
17809
  /* @__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 }) }) }),
17794
- group.rows.map((row) => /* @__PURE__ */ jsx191(
17810
+ group.rows.map((row) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17811
+ /* @__PURE__ */ jsx191(
17812
+ TableRow,
17813
+ {
17814
+ onClick: () => onRowClick?.(row.original.jsonApiData),
17815
+ className: `group ${onRowClick ? "hover:bg-muted/50 cursor-pointer" : ""}`,
17816
+ children: row.getVisibleCells().map((cell) => {
17817
+ const meta = cell.column.columnDef.meta;
17818
+ return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: renderCell(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17819
+ })
17820
+ }
17821
+ ),
17822
+ 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) }) })
17823
+ ] }, row.id))
17824
+ ] }, group.groupKey)) : rowModel.rows.map((row) => /* @__PURE__ */ jsxs103(React31.Fragment, { children: [
17825
+ /* @__PURE__ */ jsx191(
17795
17826
  TableRow,
17796
17827
  {
17797
17828
  onClick: () => onRowClick?.(row.original.jsonApiData),
@@ -17800,21 +17831,10 @@ var ContentListTable = memo(/* @__PURE__ */ __name(function ContentListTable2(pr
17800
17831
  const meta = cell.column.columnDef.meta;
17801
17832
  return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: renderCell(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17802
17833
  })
17803
- },
17804
- row.id
17805
- ))
17806
- ] }, group.groupKey)) : rowModel.rows.map((row) => /* @__PURE__ */ jsx191(
17807
- TableRow,
17808
- {
17809
- onClick: () => onRowClick?.(row.original.jsonApiData),
17810
- className: `group ${onRowClick ? "hover:bg-muted/50 cursor-pointer" : ""}`,
17811
- children: row.getVisibleCells().map((cell) => {
17812
- const meta = cell.column.columnDef.meta;
17813
- return /* @__PURE__ */ jsx191(TableCell, { className: meta?.className, children: renderCell(cell.column.columnDef.cell, cell.getContext()) }, cell.id);
17814
- })
17815
- },
17816
- row.id
17817
- )) : /* @__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.") }) }) }),
17834
+ }
17835
+ ),
17836
+ 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) }) })
17837
+ ] }, 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.") }) }) }),
17818
17838
  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: [
17819
17839
  /* @__PURE__ */ jsx191(
17820
17840
  Button,
@@ -26908,6 +26928,7 @@ export {
26908
26928
  TooltipTrigger,
26909
26929
  TooltipContent,
26910
26930
  useSidebar,
26931
+ useOptionalSidebar,
26911
26932
  SidebarProvider,
26912
26933
  Sidebar,
26913
26934
  SidebarTrigger,
@@ -27259,4 +27280,4 @@ export {
27259
27280
  useOAuthClients,
27260
27281
  useOAuthClient
27261
27282
  };
27262
- //# sourceMappingURL=chunk-HP3SPOPP.mjs.map
27283
+ //# sourceMappingURL=chunk-5G7I3OUB.mjs.map