@nivaro/react 0.3.66 → 0.3.67

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 (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +8 -1
  4. package/dist/shared/components/ActivityEntry.js +28 -28
  5. package/dist/shared/components/CollectionBrowserView.js +584 -585
  6. package/dist/shared/components/ItemEditForm.js +1758 -1758
  7. package/dist/shared/components/RecordCompare.js +149 -129
  8. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  9. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  10. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  11. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  12. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  13. package/dist/shared/components/integrations/console/tone.js +22 -21
  14. package/dist/shared/components/item-edit/FieldRow.js +193 -193
  15. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  16. package/dist/shared/components/item-edit/RecordInsights.js +46 -45
  17. package/dist/shared/components/panels/BranchLanes.js +7 -7
  18. package/dist/shared/components/panels/CommentPanel.js +72 -72
  19. package/dist/shared/components/panels/PipelinePanel.js +261 -261
  20. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  21. package/dist/shared/components/panels/RevisionsPanel.js +220 -220
  22. package/dist/shared/components/panels/TaskPanel.js +75 -75
  23. package/dist/shared/components/queue/QueueWorklist.js +499 -498
  24. package/dist/shared/lib/compare-value.js +73 -0
  25. package/dist/shared/lib/format-value.js +19 -18
  26. package/dist/shared/lib/utils.js +59 -57
  27. package/package.json +1 -1
@@ -1,236 +1,255 @@
1
- import { jsx as l, jsxs as i } from "react/jsx-runtime";
2
- import { useQueries as E, useQuery as K } from "@tanstack/react-query";
3
- import { X as j } from "lucide-react";
4
- import { useRef as z, useEffect as F, useState as D } from "react";
5
- import { createPortal as R } from "react-dom";
6
- import { useNivaroClient as A } from "../context.js";
1
+ import { jsx as i, jsxs as c } from "react/jsx-runtime";
2
+ import { useQueries as M, useQuery as L } from "@tanstack/react-query";
3
+ import { X as D } from "lucide-react";
4
+ import { useRef as O, useEffect as K, useState as A } from "react";
5
+ import { createPortal as B } from "react-dom";
6
+ import { useNivaroClient as I } from "../context.js";
7
7
  import { get as $ } from "../lib/commands.js";
8
- import { formSections as O } from "../lib/form-sections.js";
9
- import { cn as L, titleCase as Q } from "../lib/utils.js";
10
- import { Skeleton as M } from "./ui/skeleton.js";
11
- function X(n) {
12
- if (n == null || n === "") return "";
13
- if (typeof n == "boolean") return n ? "true" : "false";
14
- if (typeof n == "object")
8
+ import { formSections as Q } from "../lib/form-sections.js";
9
+ import { friendlyIdOf as X, recordRefLabel as J } from "../lib/record-ref.js";
10
+ import { cn as R, titleCase as P } from "../lib/utils.js";
11
+ import { Skeleton as _ } from "./ui/skeleton.js";
12
+ function G(r) {
13
+ if (r == null || r === "") return "";
14
+ if (typeof r == "boolean") return r ? "true" : "false";
15
+ if (typeof r == "object")
15
16
  try {
16
- return JSON.stringify(n);
17
+ return JSON.stringify(r);
17
18
  } catch {
18
- return String(n);
19
+ return String(r);
19
20
  }
20
- const d = String(n).trim(), u = Number(d);
21
- return d !== "" && Number.isFinite(u) ? String(Math.round(u * 100) / 100) : d;
21
+ const a = String(r).trim(), u = Number(a);
22
+ return a !== "" && Number.isFinite(u) ? String(Math.round(u * 100) / 100) : a;
22
23
  }
23
- function B(n) {
24
- const { records: d, forms: u, labels: q } = n, p = {
24
+ function H(r) {
25
+ const { records: a, forms: u, labels: y } = r, g = {
25
26
  key: "__fields__",
26
27
  label: "Fields",
27
- fields: n.fallback.map((a) => ({ field: a, label: null }))
28
- }, b = u.map((a) => a ?? [p]), y = [], N = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Map();
29
- for (const a of b)
30
- for (const r of a) {
31
- for (const o of r.fields)
32
- o.label && !g.has(o.field) && g.set(o.field, o.label);
33
- const c = r.fields.map((o) => o.field).filter((o) => !k.has(o));
34
- if (!c.length) continue;
35
- for (const o of c) k.add(o);
36
- const m = N.get(r.label);
37
- if (m) m.fields.push(...c);
28
+ fields: r.fallback.map((l) => ({ field: l, label: null }))
29
+ }, m = u.map((l) => l ?? [g]), p = [], N = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
30
+ for (const l of m)
31
+ for (const n of l) {
32
+ for (const o of n.fields)
33
+ o.label && !w.has(o.field) && w.set(o.field, o.label);
34
+ const d = n.fields.map((o) => o.field).filter((o) => !k.has(o));
35
+ if (!d.length) continue;
36
+ for (const o of d) k.add(o);
37
+ const b = N.get(n.label);
38
+ if (b) b.fields.push(...d);
38
39
  else {
39
- const o = { key: r.key, label: r.label, fields: c };
40
- N.set(r.label, o), y.push(o);
40
+ const o = { key: n.key, label: n.label, fields: d };
41
+ N.set(n.label, o), p.push(o);
41
42
  }
42
43
  }
43
- const w = b.map((a) => new Set(a.flatMap((r) => r.fields.map((c) => c.field))));
44
- return y.map((a) => ({
45
- key: a.key,
46
- label: a.label,
47
- rows: a.fields.flatMap((r) => {
48
- const c = d.map((f, h) => {
49
- const v = f ? w[h].has(r) ? r in f ? null : "hidden" : "form" : "record";
50
- return { absent: v, value: v || !f ? null : f[r] };
51
- }), m = c.filter((f) => !f.absent);
52
- if (m.length === 0) return [];
53
- const o = m.length > 1 && new Set(m.map((f) => X(f.value))).size > 1;
44
+ const S = m.map((l) => new Set(l.flatMap((n) => n.fields.map((d) => d.field))));
45
+ return p.map((l) => ({
46
+ key: l.key,
47
+ label: l.label,
48
+ rows: l.fields.flatMap((n) => {
49
+ const d = a.map((f, v) => {
50
+ const h = f ? S[v].has(n) ? n in f ? null : "hidden" : "form" : "record";
51
+ return { absent: h, value: h || !f ? null : f[n] };
52
+ }), b = d.filter((f) => !f.absent);
53
+ if (b.length === 0) return [];
54
+ const o = b.length > 1 && new Set(b.map((f) => G(f.value))).size > 1;
54
55
  return [
55
56
  {
56
- field: r,
57
- label: g.get(r) || q[r] || Q(r),
58
- cells: c,
57
+ field: n,
58
+ label: w.get(n) || y[n] || P(n),
59
+ cells: d,
59
60
  differs: o
60
61
  }
61
62
  ];
62
63
  })
63
- })).filter((a) => a.rows.length > 0);
64
+ })).filter((l) => l.rows.length > 0);
64
65
  }
65
- const I = {
66
+ function U(r, a, u, y, g) {
67
+ const m = X(r, a);
68
+ if (m) return m;
69
+ if (r && a) {
70
+ const p = J(r, a, u, y);
71
+ if (p && p !== String(u)) return p;
72
+ }
73
+ return `Record ${g + 1}`;
74
+ }
75
+ const V = {
66
76
  record: "Not available",
67
77
  form: "Not on this form",
68
78
  hidden: "Not visible to you"
69
79
  };
70
- function te({
71
- collection: n,
72
- ids: d,
80
+ function ie({
81
+ collection: r,
82
+ ids: a,
73
83
  fields: u,
74
- renderValue: q,
75
- onClose: p
84
+ renderValue: y,
85
+ onClose: g
76
86
  }) {
77
- const b = A(), y = E({
78
- queries: d.map((e) => ({
79
- queryKey: ["cbv-compare", n, String(e)],
80
- queryFn: () => b.request($(`/items/${n}/${e}`)).then((t) => t.data ?? null).catch(() => null),
87
+ const m = I(), p = M({
88
+ queries: a.map((e) => ({
89
+ queryKey: ["cbv-compare", r, String(e)],
90
+ queryFn: () => m.request($(`/items/${r}/${e}`)).then((t) => t.data ?? null).catch(() => null),
81
91
  staleTime: 3e4
82
92
  }))
83
- }), N = E({
84
- queries: d.map((e) => ({
85
- queryKey: ["compare-form", n, String(e)],
86
- queryFn: () => b.request(
87
- $("/collection-layouts/active", { collection: n, item: String(e) })
93
+ }), N = M({
94
+ queries: a.map((e) => ({
95
+ queryKey: ["compare-form", r, String(e)],
96
+ queryFn: () => m.request(
97
+ $("/collection-layouts/active", { collection: r, item: String(e) })
88
98
  ).then((t) => t.data ?? null).catch(() => null),
89
99
  staleTime: 3e4
90
100
  }))
91
- }), k = K({
92
- queryKey: ["bulk-fields-config", n],
93
- queryFn: () => b.request(
94
- $(`/field-config/${n}`)
101
+ }), k = L({
102
+ queryKey: ["bulk-fields-config", r],
103
+ queryFn: () => m.request(
104
+ $(`/field-config/${r}`)
95
105
  ).then((e) => Array.isArray(e.data) ? e.data : []),
96
106
  staleTime: 6e4
97
- }), g = z(null);
98
- F(() => {
107
+ }), w = L({
108
+ queryKey: ["cbv-collection-meta", r],
109
+ queryFn: () => m.request($(`/collections/${r}`)).then((e) => e.data ?? null).catch(() => null),
110
+ staleTime: 10 * 6e4
111
+ }), S = O(null);
112
+ K(() => {
99
113
  var t;
100
114
  const e = document.activeElement;
101
- return (t = g.current) == null || t.focus(), () => {
115
+ return (t = S.current) == null || t.focus(), () => {
102
116
  var s;
103
117
  return (s = e == null ? void 0 : e.focus) == null ? void 0 : s.call(e);
104
118
  };
105
- }, []), F(() => {
119
+ }, []), K(() => {
106
120
  const e = (t) => {
107
- t.key === "Escape" && p();
121
+ t.key === "Escape" && g();
108
122
  };
109
123
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
110
- }, [p]);
111
- const w = y.some((e) => e.isLoading) || N.some((e) => e.isLoading), a = y.map((e) => e.data ?? null), r = N.map((e) => e.data ?? null), c = {};
112
- for (const e of k.data ?? []) c[e.field] = e.label;
113
- const m = w ? [] : B({
114
- records: a,
115
- forms: r.map(
116
- (e) => e ? O(e.groups ?? [], e.assignments ?? [], {
124
+ }, [g]);
125
+ const l = p.some((e) => e.isLoading) || N.some((e) => e.isLoading), n = p.map((e) => e.data ?? null), d = N.map((e) => e.data ?? null), b = {}, o = /* @__PURE__ */ new Map();
126
+ for (const e of k.data ?? [])
127
+ b[e.field] = e.label, o.set(e.field, e);
128
+ const f = (e) => U(w.data ?? null, n[e], a[e], r, e), v = l ? [] : H({
129
+ records: n,
130
+ forms: d.map(
131
+ (e) => e ? Q(e.groups ?? [], e.assignments ?? [], {
117
132
  ungroupedSort: e.ungrouped_sort
118
133
  }) : null
119
134
  ),
120
- labels: c,
135
+ labels: b,
121
136
  fallback: u.filter((e) => !e.hidden && e.field !== "id").map((e) => e.field)
122
- }), [o, f] = D(!1), h = m.reduce((e, t) => e + t.rows.filter((s) => s.differs).length, 0), v = o ? m.map((e) => ({ ...e, rows: e.rows.filter((t) => t.differs) })).filter((e) => e.rows.length > 0) : m, S = r.map((e) => {
137
+ }), [h, j] = A(!1), q = v.reduce((e, t) => e + t.rows.filter((s) => s.differs).length, 0), C = h ? v.map((e) => ({ ...e, rows: e.rows.filter((t) => t.differs) })).filter((e) => e.rows.length > 0) : v, T = d.map((e) => {
123
138
  var t;
124
139
  return ((t = e == null ? void 0 : e.layout) == null ? void 0 : t.name) ?? null;
125
- }), C = new Set(r.map((e) => {
140
+ }), E = new Set(d.map((e) => {
126
141
  var t;
127
142
  return ((t = e == null ? void 0 : e.layout) == null ? void 0 : t.id) ?? null;
128
- })).size === 1, T = { gridTemplateColumns: `minmax(160px, 220px) repeat(${d.length}, minmax(0, 1fr))` };
129
- return R(
143
+ })).size === 1, F = { gridTemplateColumns: `minmax(160px, 220px) repeat(${a.length}, minmax(0, 1fr))` };
144
+ return B(
130
145
  // biome-ignore lint/a11y/noStaticElementInteractions: backdrop click closes; Escape is the keyboard path
131
- /* @__PURE__ */ l(
146
+ /* @__PURE__ */ i(
132
147
  "div",
133
148
  {
134
149
  className: "fixed inset-0 z-[130] flex items-center justify-center bg-black/40 p-4 sm:p-6",
135
- onMouseDown: (e) => e.target === e.currentTarget && p(),
150
+ onMouseDown: (e) => e.target === e.currentTarget && g(),
136
151
  "data-record-compare": !0,
137
- children: /* @__PURE__ */ i(
152
+ children: /* @__PURE__ */ c(
138
153
  "div",
139
154
  {
140
- ref: g,
155
+ ref: S,
141
156
  role: "dialog",
142
157
  "aria-modal": "true",
143
- "aria-label": `Compare ${d.length} records`,
158
+ "aria-label": `Compare ${a.length} records`,
144
159
  tabIndex: -1,
145
160
  className: "nvr-pop-in flex outline-none max-h-[88vh] w-full max-w-[1100px] flex-col overflow-hidden rounded-lg border border-border bg-card shadow-xl",
146
161
  children: [
147
- /* @__PURE__ */ i("div", { className: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border px-4 py-2.5", children: [
148
- /* @__PURE__ */ i("span", { className: "text-[14px] font-semibold text-foreground", children: [
162
+ /* @__PURE__ */ c("div", { className: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border px-4 py-2.5", children: [
163
+ /* @__PURE__ */ c("span", { className: "text-[14px] font-semibold text-foreground", children: [
149
164
  "Compare ",
150
- d.length,
165
+ a.length,
151
166
  " records"
152
167
  ] }),
153
- !w && /* @__PURE__ */ i("span", { className: "text-[12px] text-muted-foreground", "data-compare-diff-count": h, children: [
154
- h === 0 ? "No differences" : `${h} field${h === 1 ? "" : "s"} differ`,
155
- C && S[0] ? ` · ${S[0]} form` : ""
168
+ !l && /* @__PURE__ */ c("span", { className: "text-[12px] text-muted-foreground", "data-compare-diff-count": q, children: [
169
+ q === 0 ? "No differences" : `${q} field${q === 1 ? "" : "s"} differ`,
170
+ E && T[0] ? ` · ${T[0]} form` : ""
156
171
  ] }),
157
- /* @__PURE__ */ i("label", { className: "ml-auto flex cursor-pointer items-center gap-1.5 text-[12px] text-muted-foreground", children: [
158
- /* @__PURE__ */ l(
172
+ /* @__PURE__ */ c("label", { className: "ml-auto flex cursor-pointer items-center gap-1.5 text-[12px] text-muted-foreground", children: [
173
+ /* @__PURE__ */ i(
159
174
  "input",
160
175
  {
161
176
  type: "checkbox",
162
- checked: o,
163
- onChange: (e) => f(e.target.checked),
177
+ checked: h,
178
+ onChange: (e) => j(e.target.checked),
164
179
  className: "h-3.5 w-3.5 accent-[hsl(var(--primary))]"
165
180
  }
166
181
  ),
167
182
  "Differences only"
168
183
  ] }),
169
- /* @__PURE__ */ l(
184
+ /* @__PURE__ */ i(
170
185
  "button",
171
186
  {
172
187
  type: "button",
173
- onClick: p,
188
+ onClick: g,
174
189
  "aria-label": "Close",
175
190
  className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
176
- children: /* @__PURE__ */ l(j, { className: "h-4 w-4" })
191
+ children: /* @__PURE__ */ i(D, { className: "h-4 w-4" })
177
192
  }
178
193
  )
179
194
  ] }),
180
- /* @__PURE__ */ i("div", { className: "min-h-0 flex-1 overflow-auto", children: [
181
- /* @__PURE__ */ i(
195
+ /* @__PURE__ */ c("div", { className: "min-h-0 flex-1 overflow-auto", children: [
196
+ /* @__PURE__ */ c(
182
197
  "div",
183
198
  {
184
199
  className: "sticky top-0 z-[1] grid border-b border-border bg-slate-50 dark:bg-background",
185
- style: T,
200
+ style: F,
186
201
  children: [
187
- /* @__PURE__ */ l("span", { className: "px-3 py-2 text-[11.5px] font-medium text-muted-foreground", children: "Field" }),
188
- d.map((e, t) => /* @__PURE__ */ i("span", { className: "min-w-0 px-3 py-2", children: [
189
- /* @__PURE__ */ i("span", { className: "block truncate font-mono text-[12px] font-medium text-foreground", children: [
190
- "#",
191
- String(e)
192
- ] }),
193
- !C && /* @__PURE__ */ l("span", { className: "block truncate text-[11px] text-muted-foreground", children: S[t] ? `${S[t]} form` : "No form" })
202
+ /* @__PURE__ */ i("span", { className: "px-3 py-2 text-[11.5px] font-medium text-muted-foreground", children: "Field" }),
203
+ a.map((e, t) => /* @__PURE__ */ c("span", { className: "min-w-0 px-3 py-2", children: [
204
+ /* @__PURE__ */ i(
205
+ "span",
206
+ {
207
+ className: "block truncate text-[12px] font-semibold text-foreground",
208
+ "data-compare-side": !0,
209
+ children: f(t)
210
+ }
211
+ ),
212
+ !E && /* @__PURE__ */ i("span", { className: "block truncate text-[11px] text-muted-foreground", children: T[t] ? `${T[t]} form` : "No form" })
194
213
  ] }, String(e)))
195
214
  ]
196
215
  }
197
216
  ),
198
- w ? /* @__PURE__ */ l("div", { className: "space-y-2 p-4", "aria-busy": "true", children: [0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ i("div", { className: "grid gap-3", style: T, children: [
199
- /* @__PURE__ */ l(M, { className: "h-4 w-28" }),
200
- d.map((t) => /* @__PURE__ */ l(M, { className: "h-4 w-full" }, String(t)))
201
- ] }, e)) }) : a.every((e) => e == null) ? /* @__PURE__ */ l("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: "These records could not be opened. They may have been deleted, or you may no longer have access." }) : v.length === 0 ? /* @__PURE__ */ l("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: o ? "Every field you can see holds the same value." : "Nothing to compare." }) : v.map((e) => {
217
+ l ? /* @__PURE__ */ i("div", { className: "space-y-2 p-4", "aria-busy": "true", children: [0, 1, 2, 3, 4].map((e) => /* @__PURE__ */ c("div", { className: "grid gap-3", style: F, children: [
218
+ /* @__PURE__ */ i(_, { className: "h-4 w-28" }),
219
+ a.map((t) => /* @__PURE__ */ i(_, { className: "h-4 w-full" }, String(t)))
220
+ ] }, e)) }) : n.every((e) => e == null) ? /* @__PURE__ */ i("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: "These records could not be opened. They may have been deleted, or you may no longer have access." }) : C.length === 0 ? /* @__PURE__ */ i("p", { className: "px-4 py-8 text-center text-[12.5px] text-muted-foreground", children: h ? "Every field you can see holds the same value." : "Nothing to compare." }) : C.map((e) => {
202
221
  const t = e.rows.filter((s) => s.differs).length;
203
- return /* @__PURE__ */ i("section", { "data-compare-section": e.key, children: [
204
- /* @__PURE__ */ i("h3", { className: "flex items-baseline gap-2 border-b border-border bg-card px-3 pb-1.5 pt-4 text-[12.5px] font-semibold text-foreground", children: [
222
+ return /* @__PURE__ */ c("section", { "data-compare-section": e.key, children: [
223
+ /* @__PURE__ */ c("h3", { className: "flex items-baseline gap-2 border-b border-border bg-card px-3 pb-1.5 pt-4 text-[12.5px] font-semibold text-foreground", children: [
205
224
  e.label,
206
- t > 0 && /* @__PURE__ */ i("span", { className: "text-[11.5px] font-normal text-muted-foreground", children: [
225
+ t > 0 && /* @__PURE__ */ c("span", { className: "text-[11.5px] font-normal text-muted-foreground", children: [
207
226
  t,
208
227
  " differ",
209
228
  t === 1 ? "s" : ""
210
229
  ] })
211
230
  ] }),
212
- e.rows.map((s) => /* @__PURE__ */ i(
231
+ e.rows.map((s) => /* @__PURE__ */ c(
213
232
  "div",
214
233
  {
215
234
  "data-compare-row": s.field,
216
235
  "data-differs": s.differs ? "" : void 0,
217
- className: L(
236
+ className: R(
218
237
  "grid border-b border-slate-100 text-[12.5px] dark:border-border/60",
219
238
  s.differs && "bg-amber-50 dark:bg-amber-400/10"
220
239
  ),
221
- style: T,
240
+ style: F,
222
241
  children: [
223
- /* @__PURE__ */ l("span", { className: "min-w-0 px-3 py-1.5 text-muted-foreground", children: s.label }),
224
- s.cells.map((x, _) => /* @__PURE__ */ l(
242
+ /* @__PURE__ */ i("span", { className: "min-w-0 px-3 py-1.5 text-muted-foreground", children: s.label }),
243
+ s.cells.map((x, z) => /* @__PURE__ */ i(
225
244
  "span",
226
245
  {
227
- className: L(
246
+ className: R(
228
247
  "min-w-0 break-words px-3 py-1.5 tabular-nums",
229
248
  x.absent ? "text-[11.5px] italic text-muted-foreground" : s.differs ? "font-medium text-foreground" : "text-slate-600 dark:text-slate-300"
230
249
  ),
231
- children: x.absent ? I[x.absent] : x.value == null || x.value === "" ? /* @__PURE__ */ l("span", { className: "text-muted-foreground", children: "—" }) : q(s.field, x.value)
250
+ children: x.absent ? V[x.absent] : x.value == null || x.value === "" ? /* @__PURE__ */ i("span", { className: "text-muted-foreground", children: "—" }) : y(s.field, x.value, o.get(s.field))
232
251
  },
233
- _
252
+ z
234
253
  ))
235
254
  ]
236
255
  },
@@ -248,7 +267,8 @@ function te({
248
267
  );
249
268
  }
250
269
  export {
251
- te as RecordCompareDialog,
252
- B as buildCompare,
253
- X as compareKey
270
+ ie as RecordCompareDialog,
271
+ H as buildCompare,
272
+ G as compareKey,
273
+ U as compareSideName
254
274
  };
@@ -1,15 +1,15 @@
1
- import { jsxs as A, Fragment as g, jsx as u } from "react/jsx-runtime";
1
+ import { jsxs as g, Fragment as q, jsx as u } from "react/jsx-runtime";
2
2
  import { useQuery as d } from "@tanstack/react-query";
3
- import { useState as q } from "react";
4
- import { useNivaroClient as k } from "../../context.js";
3
+ import { useState as k } from "react";
4
+ import { useNivaroClient as M } from "../../context.js";
5
5
  import { get as m } from "../../lib/commands.js";
6
- import { RecordCompareDialog as M } from "../RecordCompare.js";
7
- const x = 2, F = 3;
8
- function O(o) {
6
+ import { RecordCompareDialog as x } from "../RecordCompare.js";
7
+ const F = 2, O = 3;
8
+ function Q(o) {
9
9
  const r = [...new Set(o.map((n) => n.collection))];
10
- return r.length !== 1 || o.length < x || o.length > F ? null : { collection: r[0], ids: o.map((n) => n.id) };
10
+ return r.length !== 1 || o.length < F || o.length > O ? null : { collection: r[0], ids: o.map((n) => n.id) };
11
11
  }
12
- function K({
12
+ function N({
13
13
  targets: o,
14
14
  renderValue: r,
15
15
  fields: n,
@@ -17,7 +17,7 @@ function K({
17
17
  disabled: f,
18
18
  className: p
19
19
  }) {
20
- const c = k(), [i, s] = q(!1), e = O(o), l = (e == null ? void 0 : e.collection) ?? "", y = d({
20
+ const c = M(), [i, s] = k(!1), e = Q(o), l = (e == null ? void 0 : e.collection) ?? "", y = d({
21
21
  queryKey: ["bulk-fields-config", l],
22
22
  queryFn: () => c.request(m(`/field-config/${l}`)).then((t) => Array.isArray(t.data) ? t.data : []),
23
23
  enabled: i && !!e && !n,
@@ -30,7 +30,7 @@ function K({
30
30
  });
31
31
  if (!e) return null;
32
32
  const b = a ?? C.data ?? [];
33
- return /* @__PURE__ */ A(g, { children: [
33
+ return /* @__PURE__ */ g(q, { children: [
34
34
  /* @__PURE__ */ u(
35
35
  "button",
36
36
  {
@@ -43,20 +43,20 @@ function K({
43
43
  }
44
44
  ),
45
45
  i && /* @__PURE__ */ u(
46
- M,
46
+ x,
47
47
  {
48
48
  collection: e.collection,
49
49
  ids: e.ids,
50
50
  fields: n ?? y.data ?? [],
51
- renderValue: (t, h) => r(b, t, h),
51
+ renderValue: (t, h, A) => r(b, t, h, A),
52
52
  onClose: () => s(!1)
53
53
  }
54
54
  )
55
55
  ] });
56
56
  }
57
57
  export {
58
- K as BulkCompareButton,
59
- F as COMPARE_MAX,
60
- x as COMPARE_MIN,
61
- O as compareTargets
58
+ N as BulkCompareButton,
59
+ O as COMPARE_MAX,
60
+ F as COMPARE_MIN,
61
+ Q as compareTargets
62
62
  };