@nivaro/react 0.3.72 → 0.3.74

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,26 +1,27 @@
1
- import { jsxs as a, Fragment as U, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as n, Fragment as K, jsx as t } from "react/jsx-runtime";
2
2
  import { useQueryClient as G, useQuery as J } from "@tanstack/react-query";
3
3
  import { ArrowLeft as X, Eye as Y, ExternalLink as Z } from "lucide-react";
4
- import { useState as L, useCallback as K, useMemo as P, Suspense as q, lazy as j } from "react";
5
- import { useNivaroClient as ee, useItemNavigation as te, useDrilldownViews as le, DrilldownContext as y } from "../context.js";
4
+ import { useState as L, useCallback as j, useMemo as P, Suspense as q, lazy as E } from "react";
5
+ import { useNivaroClient as ee, useItemNavigation as te, useDrilldownViews as le, DrilldownContext as b } from "../context.js";
6
6
  import { get as re } from "../lib/commands.js";
7
7
  import { usePresence as oe } from "../lib/presence-hooks.js";
8
8
  import { titleCase as ne } from "../lib/utils.js";
9
9
  import { DesignCanvas as ae } from "./layout-editor/design-canvas.js";
10
- import { Sheet as ie, SheetContent as ce, SheetHeader as se, SheetTitle as de } from "./ui/sheet.js";
11
- const me = j(() => import("./ItemEditForm.js").then((n) => ({ default: n.ItemEditForm }))), F = j(
12
- () => import("./RecordReadView.js").then((n) => ({ default: n.RecordReadView }))
13
- ), b = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ t(
10
+ import { ItemActionButtons as ie } from "./panels/ItemActionButtons.js";
11
+ import { Sheet as ce, SheetContent as de, SheetHeader as se, SheetTitle as me } from "./ui/sheet.js";
12
+ const ue = E(() => import("./ItemEditForm.js").then((a) => ({ default: a.ItemEditForm }))), F = E(
13
+ () => import("./RecordReadView.js").then((a) => ({ default: a.RecordReadView }))
14
+ ), y = /* @__PURE__ */ t("div", { className: "space-y-2 px-4 py-3", children: [0, 1, 2, 3, 4, 5].map((a) => /* @__PURE__ */ t(
14
15
  "div",
15
16
  {
16
17
  className: "h-8 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]"
17
18
  },
18
- n
19
+ a
19
20
  )) });
20
- function ke({
21
- collection: n,
22
- itemId: E,
23
- layoutId: W,
21
+ function Ne({
22
+ collection: a,
23
+ itemId: W,
24
+ layoutId: A,
24
25
  rootLayoutSlug: w,
25
26
  width: p,
26
27
  title: Q,
@@ -32,19 +33,19 @@ function ke({
32
33
  onOpenRecord: g
33
34
  }) {
34
35
  var R;
35
- const A = G(), O = ee(), { open: V, urlFor: z } = te(), [B, k] = L([
36
- { collection: n, itemId: E, layoutId: W, width: p, title: Q }
37
- ]), s = x != null, i = s && x.length ? x : B, e = l ? i[0] : i[i.length - 1], I = K(
36
+ const B = G(), O = ee(), { open: V, urlFor: z } = te(), [H, k] = L([
37
+ { collection: a, itemId: W, layoutId: A, width: p, title: Q }
38
+ ]), d = x != null, i = d && x.length ? x : H, e = l ? i[0] : i[i.length - 1], I = j(
38
39
  (r) => {
39
- s ? u == null || u(r) : k((f) => [...f, r]);
40
+ d ? u == null || u(r) : k((f) => [...f, r]);
40
41
  },
41
- [s, u]
42
- ), N = K(() => {
43
- s ? h == null || h() : k((r) => r.slice(0, -1));
44
- }, [s, h]), { viewers: c } = oe(
42
+ [d, u]
43
+ ), N = j(() => {
44
+ d ? h == null || h() : k((r) => r.slice(0, -1));
45
+ }, [d, h]), { viewers: c } = oe(
45
46
  l ? null : e.collection,
46
47
  l ? null : e.itemId
47
- ), v = P(() => l ? null : { open: I }, [l, I]), H = le(), d = l ? null : H[e.collection] ?? null, m = !l && i.length === 1 && !!w, { data: M, isLoading: T } = J({
48
+ ), v = P(() => l ? null : { open: I }, [l, I]), M = le(), s = l ? null : M[e.collection] ?? null, m = !l && i.length === 1 && !!w, { data: T, isLoading: U } = J({
48
49
  queryKey: ["drilldown-layout", e.collection, e.layoutId ?? null],
49
50
  enabled: !m && !l,
50
51
  queryFn: () => O.request(
@@ -56,8 +57,8 @@ function ke({
56
57
  }), o = l ? {
57
58
  ...l.layout,
58
59
  layout: l.layout.layout ?? { id: 0, name: "", slug: null }
59
- } : M, S = m ? w ?? void 0 : (o == null ? void 0 : o.layout.slug) ?? void 0, C = (R = o == null ? void 0 : o.layout) == null ? void 0 : R.sheet_width, D = /* @__PURE__ */ a(U, { children: [
60
- /* @__PURE__ */ a("span", { className: "flex min-w-0 items-center gap-1.5", children: [
60
+ } : T, S = m ? w ?? void 0 : (o == null ? void 0 : o.layout.slug) ?? void 0, C = (R = o == null ? void 0 : o.layout) == null ? void 0 : R.sheet_width, D = /* @__PURE__ */ n(K, { children: [
61
+ /* @__PURE__ */ n("span", { className: "flex min-w-0 items-center gap-1.5", children: [
61
62
  i.length > 1 && /* @__PURE__ */ t(
62
63
  "button",
63
64
  {
@@ -68,12 +69,12 @@ function ke({
68
69
  children: /* @__PURE__ */ t(X, { className: "h-4 w-4" })
69
70
  }
70
71
  ),
71
- /* @__PURE__ */ a("span", { className: "truncate", children: [
72
+ /* @__PURE__ */ n("span", { className: "truncate", children: [
72
73
  ne(e.collection),
73
74
  !m && o ? ` · ${o.layout.name}` : ""
74
75
  ] })
75
76
  ] }),
76
- !l && c.length > 0 && /* @__PURE__ */ a(
77
+ !l && c.length > 0 && /* @__PURE__ */ n(
77
78
  "span",
78
79
  {
79
80
  className: "ml-auto flex min-w-0 items-center gap-1 text-[11px] font-normal text-slate-500 dark:text-slate-400",
@@ -87,7 +88,7 @@ function ke({
87
88
  ),
88
89
  !l && // A real link (army 11 Q1-4): Cmd/Ctrl/middle-click opens the record in a new
89
90
  // tab and keeps this list where it is; a plain click goes through the host.
90
- /* @__PURE__ */ a(
91
+ /* @__PURE__ */ n(
91
92
  "a",
92
93
  {
93
94
  href: z({ collection: e.collection, itemId: e.itemId }),
@@ -104,32 +105,42 @@ function ke({
104
105
  ]
105
106
  }
106
107
  )
107
- ] }), $ = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: d ? /* @__PURE__ */ t(y.Provider, { value: v, children: d.render({ itemId: String(e.itemId) }) }) : T && !m ? b : !m && (o == null ? void 0 : o.layout.display_mode) === "read" ? (
108
+ ] }), $ = /* @__PURE__ */ t("div", { className: "nvr-tab-enter flex min-h-0 flex-1 flex-col overflow-hidden", children: s ? /* @__PURE__ */ t(b.Provider, { value: v, children: s.render({ itemId: String(e.itemId) }) }) : U && !m ? y : !m && (o == null ? void 0 : o.layout.display_mode) === "read" ? (
108
109
  // Read-only presentation — definition grids + tabbed child lists,
109
110
  // no form inputs. Editing lives on the full record page.
110
- /* @__PURE__ */ t(y.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: b, children: l ? /* @__PURE__ */ t(F, { collection: e.collection, design: l }) : /* @__PURE__ */ t(
111
- F,
112
- {
113
- collection: e.collection,
114
- itemId: e.itemId,
115
- layoutData: o
116
- },
117
- `${e.collection}:${e.itemId}:read`
118
- ) }) })
119
- ) : /* @__PURE__ */ t(y.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: b, children: /* @__PURE__ */ t(
120
- me,
111
+ /* @__PURE__ */ t(b.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: y, children: l ? /* @__PURE__ */ t(F, { collection: e.collection, design: l }) : /* @__PURE__ */ n(K, { children: [
112
+ /* @__PURE__ */ t("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2 border-b border-slate-200 px-4 py-2 empty:hidden dark:border-border", children: /* @__PURE__ */ t(
113
+ ie,
114
+ {
115
+ collection: e.collection,
116
+ itemId: String(e.itemId)
117
+ }
118
+ ) }),
119
+ /* @__PURE__ */ t(
120
+ F,
121
+ {
122
+ collection: e.collection,
123
+ itemId: e.itemId,
124
+ layoutData: o
125
+ },
126
+ `${e.collection}:${e.itemId}:read`
127
+ )
128
+ ] }) }) })
129
+ ) : /* @__PURE__ */ t(b.Provider, { value: v, children: /* @__PURE__ */ t(q, { fallback: y, children: /* @__PURE__ */ t(
130
+ ue,
121
131
  {
122
132
  collection: e.collection,
123
133
  itemId: e.itemId,
124
134
  layoutSlug: S,
125
135
  onSaved: () => {
126
- A.invalidateQueries({ queryKey: ["queue-items"] });
136
+ B.invalidateQueries({ queryKey: ["queue-items"] });
127
137
  },
128
- design: l
138
+ design: l,
139
+ showItemActions: !l
129
140
  },
130
141
  `${e.collection}:${e.itemId}:${S ?? "default"}`
131
142
  ) }) }) });
132
- return l ? /* @__PURE__ */ t(ae, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ a(
143
+ return l ? /* @__PURE__ */ t(ae, { design: l.context, onRefusedWrite: l.onRefusedWrite, children: /* @__PURE__ */ n(
133
144
  "div",
134
145
  {
135
146
  "data-design-sheet": !0,
@@ -140,24 +151,24 @@ function ke({
140
151
  $
141
152
  ]
142
153
  }
143
- ) }) : /* @__PURE__ */ t(ie, { open: !0, onOpenChange: (r) => !r && _(), children: /* @__PURE__ */ a(
144
- ce,
154
+ ) }) : /* @__PURE__ */ t(ce, { open: !0, onOpenChange: (r) => !r && _(), children: /* @__PURE__ */ n(
155
+ de,
145
156
  {
146
157
  className: "flex flex-col gap-0 overflow-hidden p-0",
147
158
  style: {
148
- width: (d == null ? void 0 : d.width) ?? e.width ?? C ?? p ?? 640,
159
+ width: (s == null ? void 0 : s.width) ?? e.width ?? C ?? p ?? 640,
149
160
  maxWidth: "96vw"
150
161
  },
151
162
  onEscapeKeyDown: i.length > 1 ? (r) => {
152
163
  r.preventDefault(), N();
153
164
  } : void 0,
154
165
  children: [
155
- /* @__PURE__ */ t(se, { 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(de, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: D }) }),
166
+ /* @__PURE__ */ t(se, { 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(me, { className: "flex items-center justify-between gap-2 pr-6 text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: D }) }),
156
167
  $
157
168
  ]
158
169
  }
159
170
  ) });
160
171
  }
161
172
  export {
162
- ke as RecordDrilldownSheet
173
+ Ne as RecordDrilldownSheet
163
174
  };