@carlonicora/nextjs-jsonapi 1.117.1 → 1.118.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 (30) hide show
  1. package/dist/{BlockNoteEditor-CEWZCORH.js → BlockNoteEditor-5FFVS7KW.js} +9 -9
  2. package/dist/{BlockNoteEditor-CEWZCORH.js.map → BlockNoteEditor-5FFVS7KW.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-K4T6QOJO.mjs → BlockNoteEditor-6GRZW6BL.mjs} +2 -2
  4. package/dist/billing/index.js +299 -299
  5. package/dist/billing/index.mjs +1 -1
  6. package/dist/{chunk-6D4GJHLK.mjs → chunk-KXHEOLPZ.mjs} +273 -150
  7. package/dist/chunk-KXHEOLPZ.mjs.map +1 -0
  8. package/dist/{chunk-56QAXZKI.js → chunk-M2ODDWY3.js} +238 -115
  9. package/dist/chunk-M2ODDWY3.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 +72 -30
  13. package/dist/components/index.d.ts +72 -30
  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 +30 -30
  20. package/dist/features/help/index.mjs +1 -1
  21. package/package.json +1 -1
  22. package/src/components/containers/RoundPageContainer.tsx +197 -76
  23. package/src/components/containers/TabsContainer.tsx +14 -0
  24. package/src/components/containers/__tests__/partitionTabs.spec.ts +51 -0
  25. package/src/components/containers/index.ts +1 -0
  26. package/src/components/containers/partitionTabs.ts +43 -0
  27. package/src/components/forms/EditorSheet.tsx +7 -2
  28. package/dist/chunk-56QAXZKI.js.map +0 -1
  29. package/dist/chunk-6D4GJHLK.mjs.map +0 -1
  30. /package/dist/{BlockNoteEditor-K4T6QOJO.mjs.map → BlockNoteEditor-6GRZW6BL.mjs.map} +0 -0
@@ -0,0 +1,43 @@
1
+ import { Tab } from "./TabsContainer";
2
+
3
+ export type PartitionedTabs = {
4
+ ungrouped: Tab[];
5
+ groups: Array<{ label: string; items: Tab[] }>;
6
+ };
7
+
8
+ /**
9
+ * Split a `Tab[]` into ungrouped + grouped strata for the
10
+ * `RoundPageContainer` `layout="rail"` navigation.
11
+ *
12
+ * Tabs without a `group` land in `ungrouped` (the pinned stratum) in declared
13
+ * order. Grouped tabs cluster under their `group` label; groups appear in the
14
+ * order they first occur in the input array.
15
+ *
16
+ * Pure function — safe to call on every render. Complexity O(n).
17
+ */
18
+ export function partitionTabs(tabs: Tab[]): PartitionedTabs {
19
+ const ungrouped: Tab[] = [];
20
+ const groupMap = new Map<string, Tab[]>();
21
+ const groupOrder: string[] = [];
22
+
23
+ for (const tab of tabs) {
24
+ if (!tab.group) {
25
+ ungrouped.push(tab);
26
+ continue;
27
+ }
28
+ if (!groupMap.has(tab.group)) {
29
+ groupMap.set(tab.group, []);
30
+ groupOrder.push(tab.group);
31
+ }
32
+ // The map entry is guaranteed to exist because we just initialized it.
33
+ groupMap.get(tab.group)!.push(tab);
34
+ }
35
+
36
+ return {
37
+ ungrouped,
38
+ groups: groupOrder.map((label) => ({
39
+ label,
40
+ items: groupMap.get(label)!,
41
+ })),
42
+ };
43
+ }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { useTranslations } from "next-intl";
4
- import { ReactNode, useCallback, useEffect, useRef } from "react";
4
+ import { ReactElement, ReactNode, useCallback, useEffect, useRef } from "react";
5
5
  import { FieldValues, UseFormReturn } from "react-hook-form";
6
6
  import { PencilIcon } from "lucide-react";
7
7
  import { ModuleWithPermissions } from "../../permissions/types";
@@ -161,7 +161,12 @@ export function EditorSheet<T extends FieldValues>({
161
161
  {dialogOpen === undefined &&
162
162
  forceShow === undefined &&
163
163
  (trigger ? (
164
- <SheetTrigger>{trigger}</SheetTrigger>
164
+ // Base UI: the trigger renders its own <button>. Pass the caller's
165
+ // element via `render` (NOT as children) so it BECOMES the trigger
166
+ // button — otherwise an interactive trigger (e.g. <Button>) nests a
167
+ // <button> inside SheetTrigger's <button> (invalid HTML / hydration
168
+ // error). `render` also preserves the element's native `disabled`.
169
+ <SheetTrigger render={trigger as ReactElement} />
165
170
  ) : (
166
171
  <SheetTrigger>
167
172
  {isEdit ? (