@nivaro/react 0.2.50 → 0.2.52

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 (121) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +204 -6
  4. package/dist/index.js +442 -439
  5. package/dist/layout-editor.d.ts +80 -0
  6. package/dist/layout-editor.js +11 -0
  7. package/dist/shared/components/ItemEditForm.js +4117 -3882
  8. package/dist/shared/components/RecordDrilldownSheet.js +114 -97
  9. package/dist/shared/components/RecordReadView.js +662 -596
  10. package/dist/shared/components/ai/ExplainButton.js +1 -1
  11. package/dist/shared/components/chat/ChatPanel.js +1053 -993
  12. package/dist/shared/components/import/DocumentAutofillButton.js +141 -129
  13. package/dist/shared/components/item-edit/GroupSection.js +489 -466
  14. package/dist/shared/components/item-edit/HeaderBand.js +47 -44
  15. package/dist/shared/components/item-edit/M2MStagingContext.js +3 -3
  16. package/dist/shared/components/item-edit/O2MStagingContext.js +1 -1
  17. package/dist/shared/components/item-edit/RecordGrantTools.js +206 -0
  18. package/dist/shared/components/item-edit/StepsBar.js +49 -43
  19. package/dist/shared/components/item-edit/SummaryPanel.js +2 -1
  20. package/dist/shared/components/item-edit/config-update.js +6 -0
  21. package/dist/shared/components/item-edit/layout-editing-quiet.js +25 -0
  22. package/dist/shared/components/layout-editor/AddPanel.js +301 -0
  23. package/dist/shared/components/layout-editor/DesignNode.js +173 -0
  24. package/dist/shared/components/layout-editor/EditorCanvas.js +52 -0
  25. package/dist/shared/components/layout-editor/EditorTopBar.js +241 -0
  26. package/dist/shared/components/layout-editor/HistoryPanel.js +179 -0
  27. package/dist/shared/components/layout-editor/LayoutEditor.js +393 -0
  28. package/dist/shared/components/layout-editor/LayoutsRail.js +89 -0
  29. package/dist/shared/components/layout-editor/add-target.js +103 -0
  30. package/dist/shared/components/layout-editor/bundle-to-active.js +86 -0
  31. package/dist/shared/components/layout-editor/canvases/PdfCanvas.js +90 -0
  32. package/dist/shared/components/layout-editor/canvases/TableColumnsCanvas.js +246 -0
  33. package/dist/shared/components/layout-editor/collection-meta.js +22 -0
  34. package/dist/shared/components/layout-editor/design-canvas.js +81 -0
  35. package/dist/shared/components/layout-editor/design-context.js +21 -0
  36. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +225 -0
  37. package/dist/shared/components/layout-editor/dnd/collision.js +107 -0
  38. package/dist/shared/components/layout-editor/dnd/node.js +164 -0
  39. package/dist/shared/components/layout-editor/dnd/order.js +122 -0
  40. package/dist/shared/components/layout-editor/editors/DefaultValuesEditor.js +223 -0
  41. package/dist/shared/components/layout-editor/editors/QuickPickerStepsEditor.js +129 -0
  42. package/dist/shared/components/layout-editor/editors/ReadPresentationEditor.js +134 -0
  43. package/dist/shared/components/layout-editor/editors/RecordConditionsEditor.js +249 -0
  44. package/dist/shared/components/layout-editor/editors/RolesPicker.js +77 -0
  45. package/dist/shared/components/layout-editor/editors/cascade-filters.js +556 -0
  46. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +150 -0
  47. package/dist/shared/components/layout-editor/editors/controls.js +73 -0
  48. package/dist/shared/components/layout-editor/editors/editor-api.js +21 -0
  49. package/dist/shared/components/layout-editor/editors/editor-queries.js +25 -0
  50. package/dist/shared/components/layout-editor/editors/field-default-value.js +131 -0
  51. package/dist/shared/components/layout-editor/editors/grid-presets.js +310 -0
  52. package/dist/shared/components/layout-editor/editors/inline-display.js +157 -0
  53. package/dist/shared/components/layout-editor/editors/layout-picker.js +80 -0
  54. package/dist/shared/components/layout-editor/editors/layout-rows.js +55 -0
  55. package/dist/shared/components/layout-editor/editors/lock-conditions.js +109 -0
  56. package/dist/shared/components/layout-editor/editors/o2m-agg-field.js +25 -0
  57. package/dist/shared/components/layout-editor/editors/pdf-field-config.js +107 -0
  58. package/dist/shared/components/layout-editor/editors/report-widget-config.js +94 -0
  59. package/dist/shared/components/layout-editor/editors/row-rule-check.js +225 -0
  60. package/dist/shared/components/layout-editor/editors/row-rule-row.js +1353 -0
  61. package/dist/shared/components/layout-editor/editors/swap-config.js +245 -0
  62. package/dist/shared/components/layout-editor/focus-buffer.js +32 -0
  63. package/dist/shared/components/layout-editor/host.js +15 -0
  64. package/dist/shared/components/layout-editor/inspector/AdvancedTab.js +296 -0
  65. package/dist/shared/components/layout-editor/inspector/GridTab.js +767 -0
  66. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +456 -0
  67. package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +268 -0
  68. package/dist/shared/components/layout-editor/inspector/Inspector.js +332 -0
  69. package/dist/shared/components/layout-editor/inspector/LookTab.js +310 -0
  70. package/dist/shared/components/layout-editor/inspector/PickerTab.js +333 -0
  71. package/dist/shared/components/layout-editor/inspector/RulesTab.js +323 -0
  72. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +179 -0
  73. package/dist/shared/components/layout-editor/inspector/SubtitleInspector.js +154 -0
  74. package/dist/shared/components/layout-editor/inspector/WidgetInspector.js +262 -0
  75. package/dist/shared/components/layout-editor/inspector/applies.js +27 -0
  76. package/dist/shared/components/layout-editor/inspector/field-context.js +134 -0
  77. package/dist/shared/components/layout-editor/inspector/interfaces.js +126 -0
  78. package/dist/shared/components/layout-editor/inspector/kit.js +595 -0
  79. package/dist/shared/components/layout-editor/inspector/model.js +307 -0
  80. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -0
  81. package/dist/shared/components/layout-editor/overview/describe-conditions.js +121 -0
  82. package/dist/shared/components/layout-editor/overview/overview-api.js +141 -0
  83. package/dist/shared/components/layout-editor/overview/purpose.js +62 -0
  84. package/dist/shared/components/layout-editor/overview/record-count.js +65 -0
  85. package/dist/shared/components/layout-editor/panel-frame.js +99 -0
  86. package/dist/shared/components/layout-editor/panel-style.js +19 -0
  87. package/dist/shared/components/layout-editor/pickers/field-picker.js +230 -0
  88. package/dist/shared/components/layout-editor/pickers/icon-picker.js +233 -0
  89. package/dist/shared/components/layout-editor/pickers/relation-label.js +34 -0
  90. package/dist/shared/components/layout-editor/pickers/relation-picker.js +136 -0
  91. package/dist/shared/components/layout-editor/record-queries.js +15 -0
  92. package/dist/shared/components/layout-editor/settings/AddendumSection.js +52 -0
  93. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +45 -0
  94. package/dist/shared/components/layout-editor/settings/DefaultsSection.js +67 -0
  95. package/dist/shared/components/layout-editor/settings/FormSettings.js +146 -0
  96. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +37 -0
  97. package/dist/shared/components/layout-editor/settings/LayoutSection.js +70 -0
  98. package/dist/shared/components/layout-editor/settings/PdfSection.js +176 -0
  99. package/dist/shared/components/layout-editor/settings/ReadSection.js +79 -0
  100. package/dist/shared/components/layout-editor/settings/TextSetting.js +55 -0
  101. package/dist/shared/components/layout-editor/settings/ToggleSetting.js +33 -0
  102. package/dist/shared/components/layout-editor/settings/ToolsSection.js +179 -0
  103. package/dist/shared/components/layout-editor/settings/WhoSection.js +213 -0
  104. package/dist/shared/components/layout-editor/settings/controls.js +214 -0
  105. package/dist/shared/components/layout-editor/settings/section-props.js +17 -0
  106. package/dist/shared/components/layout-editor/settings/settings-api.js +151 -0
  107. package/dist/shared/components/layout-editor/settings/settings-registry.js +445 -0
  108. package/dist/shared/components/layout-editor/slot-names.js +20 -0
  109. package/dist/shared/components/layout-editor/summary-pref.js +21 -0
  110. package/dist/shared/components/layout-editor/useLayoutDraft.js +474 -0
  111. package/dist/shared/components/pipeline/relations.js +28 -23
  112. package/dist/shared/components/ui/dialog.js +11 -11
  113. package/dist/shared/components/ui/popover.js +17 -17
  114. package/dist/shared/components/ui/scroll-area.js +38 -0
  115. package/dist/shared/hooks/useRelationOptions.js +60 -0
  116. package/dist/shared/lib/layout-grants.js +9 -0
  117. package/dist/shared/lib/layout-ops.js +348 -0
  118. package/dist/shared/lib/layout-slots.js +11 -7
  119. package/dist/shared/lib/presence-state.js +43 -13
  120. package/dist/shared/lib/request-gate.js +1 -1
  121. package/package.json +5 -1
@@ -1,122 +1,139 @@
1
- import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
- import { useQueryClient as Q, useQuery as _ } from "@tanstack/react-query";
3
- import { ArrowLeft as V, ExternalLink as z } from "lucide-react";
4
- import { useState as A, useCallback as I, useMemo as B, Suspense as N, lazy as S } from "react";
5
- import { useNivaroClient as H, useItemNavigation as M, useDrilldownViews as T, DrilldownContext as p } from "../context.js";
6
- import { get as W } from "../lib/commands.js";
7
- import { titleCase as G } from "../lib/utils.js";
8
- import { Sheet as J, SheetContent as U, SheetHeader as X, SheetTitle as Y } from "./ui/sheet.js";
9
- const Z = S(() => import("./ItemEditForm.js").then((o) => ({ default: o.ItemEditForm }))), L = S(
10
- () => import("./RecordReadView.js").then((o) => ({ default: o.RecordReadView }))
11
- ), f = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((o) => /* @__PURE__ */ t(
1
+ import { jsxs as i, Fragment as H, jsx as t } from "react/jsx-runtime";
2
+ import { useQueryClient as M, useQuery as T } from "@tanstack/react-query";
3
+ import { ArrowLeft as G, ExternalLink as J } from "lucide-react";
4
+ import { useState as U, useCallback as D, useMemo as X, Suspense as R, lazy as q } from "react";
5
+ import { useNivaroClient as Y, useItemNavigation as Z, useDrilldownViews as L, DrilldownContext as x } from "../context.js";
6
+ import { get as P } from "../lib/commands.js";
7
+ import { titleCase as ee } from "../lib/utils.js";
8
+ import { DesignCanvas as te } from "./layout-editor/design-canvas.js";
9
+ import { Sheet as le, SheetContent as re, SheetHeader as oe, SheetTitle as ne } from "./ui/sheet.js";
10
+ const ae = q(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEditForm }))), $ = q(
11
+ () => import("./RecordReadView.js").then((n) => ({ default: n.RecordReadView }))
12
+ ), b = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(
12
13
  "div",
13
14
  {
14
15
  className: "h-8 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
15
16
  },
16
- o
17
+ n
17
18
  )) });
18
- function ce({
19
- collection: o,
20
- itemId: C,
21
- layoutId: D,
19
+ function xe({
20
+ collection: n,
21
+ itemId: W,
22
+ layoutId: j,
22
23
  rootLayoutSlug: v,
23
- width: x,
24
- title: R,
25
- stack: u,
26
- onPush: d,
27
- onPop: m,
28
- onClose: $
24
+ width: h,
25
+ title: E,
26
+ stack: f,
27
+ onPush: m,
28
+ onPop: u,
29
+ onClose: F,
30
+ design: l
29
31
  }) {
30
- var k;
31
- const q = Q(), E = H(), { open: j } = M(), [F, g] = A([
32
- { collection: o, itemId: C, layoutId: D, width: x, title: R }
33
- ]), r = u != null, i = r && u.length ? u : F, e = i[i.length - 1], y = I(
34
- (n) => {
35
- r ? d == null || d(n) : g((O) => [...O, n]);
32
+ var S;
33
+ const K = M(), O = Y(), { open: Q } = Z(), [_, y] = U([
34
+ { collection: n, itemId: W, layoutId: j, width: h, title: E }
35
+ ]), c = f != null, a = c && f.length ? f : _, e = l ? a[0] : a[a.length - 1], k = D(
36
+ (o) => {
37
+ c ? m == null || m(o) : y((B) => [...B, o]);
36
38
  },
37
- [r, d]
38
- ), w = I(() => {
39
- r ? m == null || m() : g((n) => n.slice(0, -1));
40
- }, [r, m]), h = B(() => ({ open: y }), [y]), a = T()[e.collection] ?? null, c = i.length === 1 && !!v, { data: l, isLoading: K } = _({
39
+ [c, m]
40
+ ), w = D(() => {
41
+ c ? u == null || u() : y((o) => o.slice(0, -1));
42
+ }, [c, u]), p = X(() => l ? null : { open: k }, [l, k]), V = L(), d = l ? null : V[e.collection] ?? null, s = !l && a.length === 1 && !!v, { data: z, isLoading: A } = T({
41
43
  queryKey: ["drilldown-layout", e.collection, e.layoutId ?? null],
42
- enabled: !c,
43
- queryFn: () => E.request(
44
- W(
44
+ enabled: !s && !l,
45
+ queryFn: () => O.request(
46
+ P(
45
47
  `/collection-layouts/detail/${e.collection}`,
46
48
  e.layoutId ? { layout_id: e.layoutId } : {}
47
49
  )
48
- ).then((n) => n.data ?? null)
49
- }), b = c ? v ?? void 0 : (l == null ? void 0 : l.layout.slug) ?? void 0;
50
- return /* @__PURE__ */ t(J, { open: !0, onOpenChange: (n) => !n && $(), children: /* @__PURE__ */ s(
51
- U,
50
+ ).then((o) => o.data ?? null)
51
+ }), r = l ? {
52
+ ...l.layout,
53
+ layout: l.layout.layout ?? { id: 0, name: "", slug: null }
54
+ } : z, g = s ? v ?? void 0 : (r == null ? void 0 : r.layout.slug) ?? void 0, I = (S = r == null ? void 0 : r.layout) == null ? void 0 : S.sheet_width, N = /* @__PURE__ */ i(H, { children: [
55
+ /* @__PURE__ */ i("span", { className: "flex min-w-0 items-center gap-1.5", children: [
56
+ a.length > 1 && /* @__PURE__ */ t(
57
+ "button",
58
+ {
59
+ type: "button",
60
+ "aria-label": "Back",
61
+ onClick: w,
62
+ className: "shrink-0 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
63
+ children: /* @__PURE__ */ t(G, { className: "h-4 w-4" })
64
+ }
65
+ ),
66
+ /* @__PURE__ */ i("span", { className: "truncate", children: [
67
+ ee(e.collection),
68
+ !s && r ? ` · ${r.layout.name}` : ""
69
+ ] })
70
+ ] }),
71
+ !l && /* @__PURE__ */ i(
72
+ "button",
73
+ {
74
+ type: "button",
75
+ onClick: () => Q({ collection: e.collection, itemId: e.itemId }),
76
+ className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
77
+ children: [
78
+ "Open record ",
79
+ /* @__PURE__ */ t(J, { className: "h-3 w-3" })
80
+ ]
81
+ }
82
+ )
83
+ ] }), C = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: d ? /* @__PURE__ */ t(x.Provider, { value: p, children: d.render({ itemId: String(e.itemId) }) }) : A && !s ? b : !s && (r == null ? void 0 : r.layout.display_mode) === "read" ? (
84
+ // Read-only presentation — definition grids + tabbed child lists,
85
+ // no form inputs. Editing lives on the full record page.
86
+ /* @__PURE__ */ t(x.Provider, { value: p, children: /* @__PURE__ */ t(R, { fallback: b, children: l ? /* @__PURE__ */ t($, { collection: e.collection, design: l }) : /* @__PURE__ */ t(
87
+ $,
88
+ {
89
+ collection: e.collection,
90
+ itemId: e.itemId,
91
+ layoutData: r
92
+ },
93
+ `${e.collection}:${e.itemId}:read`
94
+ ) }) })
95
+ ) : /* @__PURE__ */ t(x.Provider, { value: p, children: /* @__PURE__ */ t(R, { fallback: b, children: /* @__PURE__ */ t(
96
+ ae,
97
+ {
98
+ collection: e.collection,
99
+ itemId: e.itemId,
100
+ layoutSlug: g,
101
+ onSaved: () => {
102
+ K.invalidateQueries({ queryKey: ["queue-items"] });
103
+ },
104
+ design: l
105
+ },
106
+ `${e.collection}:${e.itemId}:${g ?? "default"}`
107
+ ) }) }) });
108
+ return l ? /* @__PURE__ */ t(te, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ i(
109
+ "div",
110
+ {
111
+ "data-design-sheet": !0,
112
+ className: "flex h-full min-h-0 flex-col gap-0 overflow-hidden rounded-lg border border-slate-200 bg-background shadow-sm dark:border-border",
113
+ style: { width: I ?? h ?? 640, maxWidth: "100%" },
114
+ children: [
115
+ /* @__PURE__ */ t("div", { className: "flex shrink-0 flex-col border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-2 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: N }) }),
116
+ C
117
+ ]
118
+ }
119
+ ) }) : /* @__PURE__ */ t(le, { open: !0, onOpenChange: (o) => !o && F(), children: /* @__PURE__ */ i(
120
+ re,
52
121
  {
53
122
  className: "flex flex-col gap-0 overflow-hidden p-0",
54
123
  style: {
55
- width: (a == null ? void 0 : a.width) ?? e.width ?? ((k = l == null ? void 0 : l.layout) == null ? void 0 : k.sheet_width) ?? x ?? 640,
124
+ width: (d == null ? void 0 : d.width) ?? e.width ?? I ?? h ?? 640,
56
125
  maxWidth: "96vw"
57
126
  },
58
- onEscapeKeyDown: i.length > 1 ? (n) => {
59
- n.preventDefault(), w();
127
+ onEscapeKeyDown: a.length > 1 ? (o) => {
128
+ o.preventDefault(), w();
60
129
  } : void 0,
61
130
  children: [
62
- /* @__PURE__ */ t(X, { className: "shrink-0 border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ s(Y, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: [
63
- /* @__PURE__ */ s("span", { className: "flex min-w-0 items-center gap-1.5", children: [
64
- i.length > 1 && /* @__PURE__ */ t(
65
- "button",
66
- {
67
- type: "button",
68
- "aria-label": "Back",
69
- onClick: w,
70
- className: "shrink-0 rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
71
- children: /* @__PURE__ */ t(V, { className: "h-4 w-4" })
72
- }
73
- ),
74
- /* @__PURE__ */ s("span", { className: "truncate", children: [
75
- G(e.collection),
76
- !c && l ? ` · ${l.layout.name}` : ""
77
- ] })
78
- ] }),
79
- /* @__PURE__ */ s(
80
- "button",
81
- {
82
- type: "button",
83
- onClick: () => j({ collection: e.collection, itemId: e.itemId }),
84
- className: "flex shrink-0 items-center gap-1 text-[11px] font-normal text-nvr-navy hover:underline dark:text-nvr-cyan",
85
- children: [
86
- "Open record ",
87
- /* @__PURE__ */ t(z, { className: "h-3 w-3" })
88
- ]
89
- }
90
- )
91
- ] }) }),
92
- /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: a ? /* @__PURE__ */ t(p.Provider, { value: h, children: a.render({ itemId: String(e.itemId) }) }) : K && !c ? f : !c && (l == null ? void 0 : l.layout.display_mode) === "read" ? (
93
- // Read-only presentation — definition grids + tabbed child lists,
94
- // no form inputs. Editing lives on the full record page.
95
- /* @__PURE__ */ t(p.Provider, { value: h, children: /* @__PURE__ */ t(N, { fallback: f, children: /* @__PURE__ */ t(
96
- L,
97
- {
98
- collection: e.collection,
99
- itemId: e.itemId,
100
- layoutData: l
101
- },
102
- `${e.collection}:${e.itemId}:read`
103
- ) }) })
104
- ) : /* @__PURE__ */ t(p.Provider, { value: h, children: /* @__PURE__ */ t(N, { fallback: f, children: /* @__PURE__ */ t(
105
- Z,
106
- {
107
- collection: e.collection,
108
- itemId: e.itemId,
109
- layoutSlug: b,
110
- onSaved: () => {
111
- q.invalidateQueries({ queryKey: ["queue-items"] });
112
- }
113
- },
114
- `${e.collection}:${e.itemId}:${b ?? "default"}`
115
- ) }) }) })
131
+ /* @__PURE__ */ t(oe, { className: "shrink-0 border-b border-slate-200 bg-slate-50 px-4 py-2 dark:border-border dark:bg-muted/30", children: /* @__PURE__ */ t(ne, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: N }) }),
132
+ C
116
133
  ]
117
134
  }
118
135
  ) });
119
136
  }
120
137
  export {
121
- ce as RecordDrilldownSheet
138
+ xe as RecordDrilldownSheet
122
139
  };