@nivaro/react 0.3.14 → 0.3.15

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.
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
9
9
  import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
10
10
  import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
11
11
  import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
12
- const Ue = "nivaro-react@0.3.14", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
+ const Ue = "nivaro-react@0.3.15", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
13
13
  function Be(n) {
14
14
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
15
15
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
@@ -289,7 +289,7 @@ function vd({
289
289
  queryFn: () => B.request(G(`/pipelines/instance/${n}/${i}`)).then((m) => m.data).catch(() => null),
290
290
  enabled: u && h,
291
291
  staleTime: 15e3
292
- }), O = we(
292
+ }), M = we(
293
293
  () => ((P == null ? void 0 : P.available_transitions) ?? []).filter((m) => m.in_row_menu !== !1),
294
294
  [P]
295
295
  ), { data: V } = bi(u ? [n] : []), xe = we(() => u ? hi(V, [n], A).filter((m) => m.kind === "builtin" || m.kind === "transition" ? !1 : N ? fi(m.guard, N) !== !1 : !0) : [], [u, V, n, A, N]), { pushActions: j, failedPartners: _e } = yi({
@@ -307,7 +307,7 @@ function vd({
307
307
  }, [P]), Le = we(() => {
308
308
  var re;
309
309
  const m = /* @__PURE__ */ new Map(), L = [];
310
- for (const pe of O) {
310
+ for (const pe of M) {
311
311
  const Pe = (((re = pe.group_label) == null ? void 0 : re.trim()) || pe.label).trim();
312
312
  if (m.has(Pe))
313
313
  m.get(Pe).push(pe);
@@ -321,7 +321,7 @@ function vd({
321
321
  (Pe, Be) => (Oe.get(Pe.to_state ?? "") ?? 999) - (Oe.get(Be.to_state ?? "") ?? 999)
322
322
  );
323
323
  return L;
324
- }, [O, Oe]), Ce = (m) => {
324
+ }, [M, Oe]), Ce = (m) => {
325
325
  const L = m.to_state ? ct.get(m.to_state) : null;
326
326
  return (L == null ? void 0 : L.label) ?? m.label;
327
327
  }, Ie = (m) => {
@@ -353,7 +353,7 @@ function vd({
353
353
  pe = $a >= 8 ? $a : Math.max(8, window.innerHeight - L.height - 8);
354
354
  }
355
355
  (re !== W.x || pe !== W.y) && E({ x: re, y: pe });
356
- }, [u, W, g, O.length]);
356
+ }, [u, W, g, M.length]);
357
357
  const Ct = dt({
358
358
  mutationFn: ({ transitionId: m, comment: L }) => B.request(
359
359
  be(`/pipelines/instance/${n}/${i}/transition`, {
@@ -845,12 +845,12 @@ function kd({
845
845
  }), u = wa(T), v = (T == null ? void 0 : T.display_template) ?? null, { data: W = [], isLoading: E } = ne({
846
846
  queryKey: ["cbv-filter-options", n, u, v ?? "", N, B],
847
847
  queryFn: () => {
848
- const P = tr(v, u), O = !!x && x.length > 0, V = {
849
- limit: N ? 60 : O ? 500 : 100,
850
- sort: N || O ? u : "-id",
848
+ const P = tr(v, u), M = !!x && x.length > 0, V = {
849
+ limit: N ? 60 : M ? 500 : 100,
850
+ sort: N || M ? u : "-id",
851
851
  ...P ? { fields: P } : {}
852
852
  };
853
- return N ? V.search = N : O && (V.filter = JSON.stringify({ id: { _in: x.slice(0, 500) } })), w.request(G(`/items/${n}`, V)).then(
853
+ return N ? V.search = N : M && (V.filter = JSON.stringify({ id: { _in: x.slice(0, 500) } })), w.request(G(`/items/${n}`, V)).then(
854
854
  (xe) => (xe.data ?? []).map((j) => ({
855
855
  value: j.id,
856
856
  label: (v ? Ga(v, j) : "") || String(j[u] ?? j.id ?? "")
@@ -860,7 +860,7 @@ function kd({
860
860
  staleTime: 10 * 6e4,
861
861
  enabled: S && !!T,
862
862
  retry: !1
863
- }), k = h.filter((P) => !W.some((O) => String(O.value) === String(P))), q = k.map(String).join(","), { data: R = [] } = ne({
863
+ }), k = h.filter((P) => !W.some((M) => String(M.value) === String(P))), q = k.map(String).join(","), { data: R = [] } = ne({
864
864
  queryKey: ["cbv-filter-selected-labels", n, u, v ?? "", q],
865
865
  queryFn: () => {
866
866
  const P = tr(v, u);
@@ -871,7 +871,7 @@ function kd({
871
871
  ...P ? { fields: P } : {}
872
872
  })
873
873
  ).then(
874
- (O) => (O.data ?? []).map((V) => ({
874
+ (M) => (M.data ?? []).map((V) => ({
875
875
  value: V.id,
876
876
  label: (v ? Ga(v, V) : "") || String(V[u] ?? V.id ?? "")
877
877
  }))
@@ -882,7 +882,7 @@ function kd({
882
882
  retry: !1
883
883
  }), H = R.length > 0 ? [
884
884
  ...W,
885
- ...R.filter((P) => !W.some((O) => String(O.value) === String(P.value)))
885
+ ...R.filter((P) => !W.some((M) => String(M.value) === String(P.value)))
886
886
  ] : W;
887
887
  return /* @__PURE__ */ t(
888
888
  Za,
@@ -1389,16 +1389,16 @@ function $d({
1389
1389
  const T = o.trim().toLowerCase(), u = (k) => !T || k.toLowerCase().includes(T) || k.toLowerCase().replace(/ /g, "_").includes(T), v = [];
1390
1390
  for (const k of S.fields) {
1391
1391
  if (k.hidden) continue;
1392
- const q = je(k.field), R = Ye(S.relations, n, k.field), H = Na(S.relations, n, k.field), P = [...i, k.field], O = [...h, q];
1392
+ const q = je(k.field), R = Ye(S.relations, n, k.field), H = Na(S.relations, n, k.field), P = [...i, k.field], M = [...h, q];
1393
1393
  if (R != null && R.one_collection && !bt(R.one_collection))
1394
1394
  u(q) && v.push({
1395
1395
  key: k.field,
1396
1396
  label: q,
1397
1397
  hint: "relation",
1398
- drillTo: x < 2 ? { collection: R.one_collection, path: P, pathLabels: O } : void 0,
1398
+ drillTo: x < 2 ? { collection: R.one_collection, path: P, pathLabels: M } : void 0,
1399
1399
  leaf: {
1400
1400
  path: P,
1401
- pathLabels: O,
1401
+ pathLabels: M,
1402
1402
  fieldType: "relation",
1403
1403
  relTarget: R.one_collection
1404
1404
  }
@@ -1409,14 +1409,14 @@ function $d({
1409
1409
  key: k.field,
1410
1410
  label: q,
1411
1411
  hint: H.kind === "m2m" ? "list" : "items",
1412
- drillTo: x < 2 ? { collection: V, path: P, pathLabels: O } : void 0,
1413
- leaf: H.kind === "m2m" ? { path: P, pathLabels: O, fieldType: "relation", relTarget: "" } : void 0
1412
+ drillTo: x < 2 ? { collection: V, path: P, pathLabels: M } : void 0,
1413
+ leaf: H.kind === "m2m" ? { path: P, pathLabels: M, fieldType: "relation", relTarget: "" } : void 0
1414
1414
  });
1415
1415
  } else u(q) && v.push({
1416
1416
  key: k.field,
1417
1417
  label: q,
1418
1418
  hint: Yl(k, void 0),
1419
- leaf: { path: P, pathLabels: O, fieldType: k.type ?? "string" }
1419
+ leaf: { path: P, pathLabels: M, fieldType: k.type ?? "string" }
1420
1420
  });
1421
1421
  }
1422
1422
  const W = [];
@@ -1430,17 +1430,17 @@ function $d({
1430
1430
  const H = je(k.field);
1431
1431
  for (const P of R.fields) {
1432
1432
  if (P.hidden) continue;
1433
- const O = je(P.field);
1434
- if (!u(O)) continue;
1433
+ const M = je(P.field);
1434
+ if (!u(M)) continue;
1435
1435
  const V = Ye(R.relations, q.one_collection, P.field);
1436
1436
  W.push({
1437
1437
  key: `${k.field}.${P.field}`,
1438
- label: O,
1438
+ label: M,
1439
1439
  breadcrumb: H,
1440
1440
  hint: Yl(P, V ?? void 0),
1441
1441
  leaf: {
1442
1442
  path: [...i, k.field, P.field],
1443
- pathLabels: [...h, H, O],
1443
+ pathLabels: [...h, H, M],
1444
1444
  fieldType: V != null && V.one_collection ? "relation" : P.type ?? "string",
1445
1445
  relTarget: (V == null ? void 0 : V.one_collection) ?? void 0
1446
1446
  }
@@ -1585,7 +1585,7 @@ function Ld({
1585
1585
  collection: n,
1586
1586
  path: [],
1587
1587
  pathLabels: []
1588
- }), [T, u] = y(null), [v, W] = y("_contains"), [E, k] = y(""), [q, R] = y(""), [H, P] = y([]), [O, V] = y({}), [xe, j] = y(null), _e = me(null);
1588
+ }), [T, u] = y(null), [v, W] = y("_contains"), [E, k] = y(""), [q, R] = y(""), [H, P] = y([]), [M, V] = y({}), [xe, j] = y(null), _e = me(null);
1589
1589
  ke(() => {
1590
1590
  if (!_) return;
1591
1591
  const b = (te) => {
@@ -1619,7 +1619,7 @@ function Ld({
1619
1619
  fieldType: "relation",
1620
1620
  op: "_in",
1621
1621
  value: H,
1622
- valueLabels: H.map((b) => O[String(b)] ?? String(b)),
1622
+ valueLabels: H.map((b) => M[String(b)] ?? String(b)),
1623
1623
  relTarget: T.relTarget
1624
1624
  });
1625
1625
  }, g = (b) => {
@@ -1824,7 +1824,7 @@ function Ld({
1824
1824
  {
1825
1825
  target: T.relTarget,
1826
1826
  selected: H,
1827
- labels: O,
1827
+ labels: M,
1828
1828
  onToggle: (b, z) => {
1829
1829
  P(
1830
1830
  (te) => te.map(String).includes(String(b)) ? te.filter((Ke) => String(Ke) !== String(b)) : [...te, b]
@@ -2141,7 +2141,7 @@ function Pd({
2141
2141
  })
2142
2142
  ),
2143
2143
  enabled: N || B
2144
- }), O = N || B ? (P == null ? void 0 : P.count) ?? null : 0, V = async () => {
2144
+ }), M = N || B ? (P == null ? void 0 : P.count) ?? null : 0, V = async () => {
2145
2145
  if (!(!w.trim() || !$.trim())) {
2146
2146
  q(!0), H(null);
2147
2147
  try {
@@ -2230,7 +2230,7 @@ function Pd({
2230
2230
  {
2231
2231
  className: "text-[11.5px] text-nvr-cyan",
2232
2232
  "data-tip": (xe = P == null ? void 0 : P.users) == null ? void 0 : xe.map((j) => j.name).join(", "),
2233
- children: O == null ? "…" : `${O} recipient${O === 1 ? "" : "s"}`
2233
+ children: M == null ? "…" : `${M} recipient${M === 1 ? "" : "s"}`
2234
2234
  }
2235
2235
  ),
2236
2236
  /* @__PURE__ */ t(
@@ -2257,7 +2257,7 @@ function Pd({
2257
2257
  "button",
2258
2258
  {
2259
2259
  type: "submit",
2260
- disabled: k || !w.trim() || !$.trim() || O === 0,
2260
+ disabled: k || !w.trim() || !$.trim() || M === 0,
2261
2261
  className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-[#0f1e2d] disabled:opacity-50",
2262
2262
  children: k ? "Sending…" : "Send"
2263
2263
  }
@@ -2335,7 +2335,7 @@ function Ed({
2335
2335
  return z.failed > 0 ? `${g.name}: ${z.succeeded} done, ${z.failed} failed` : `${g.name}: transitioned ${z.succeeded} items`;
2336
2336
  });
2337
2337
  }
2338
- }, [O, V] = y(!1), [xe, j] = y(""), [_e, ct] = y(!1), [Oe, Le] = y(null), Ce = async (g) => {
2338
+ }, [M, V] = y(!1), [xe, j] = y(""), [_e, ct] = y(!1), [Oe, Le] = y(null), Ce = async (g) => {
2339
2339
  ct(!0), Le(null);
2340
2340
  const Q = _o();
2341
2341
  No(Q, i);
@@ -2383,7 +2383,7 @@ function Ed({
2383
2383
  i.length === 1 ? "" : "s",
2384
2384
  " selected"
2385
2385
  ] }),
2386
- O && /* @__PURE__ */ t(
2386
+ M && /* @__PURE__ */ t(
2387
2387
  ld,
2388
2388
  {
2389
2389
  collection: n,
@@ -2693,7 +2693,7 @@ function Yc({
2693
2693
  className: T
2694
2694
  }) {
2695
2695
  var gl, xl, vl, kl, yl, wl, _l, Nl, Sl, Cl, $l;
2696
- const u = at(), v = ar(), { open: W, urlFor: E } = Gl(), [k, q] = y(1), R = me(Eo()), [H, P] = y(w), O = Pl(H.trim(), 350), [V, xe] = y(_ ?? []), [j, _e] = y(o ?? ""), [ct, Oe] = y(h ?? null), [Le, Ce] = y({}), [Ie, g] = y({}), [Q, de] = y(null), [ee, b] = y({}), [z, te] = y({}), [Ke, Nt] = y({}), [Qe, St] = y({}), [Sa, Ct] = y(null), [oa, $t] = y(!1), nt = me(null), [qt, kt] = y({}), [ut, ht] = y({}), [jt, ia] = y($ ?? []), { scopes: yt, ready: da } = si(), [Tt, ca] = y(!1), [ua, Ca] = y(/* @__PURE__ */ new Set()), [De, Lt] = y({}), rt = vo("drill.browser"), m = rt.value, [L, re] = y(null), [pe, Pe] = y(!1), [Be, $a] = y(() => {
2696
+ const u = at(), v = ar(), { open: W, urlFor: E } = Gl(), [k, q] = y(1), R = me(Eo()), [H, P] = y(w), M = Pl(H.trim(), 350), [V, xe] = y(_ ?? []), [j, _e] = y(o ?? ""), [ct, Oe] = y(h ?? null), [Le, Ce] = y({}), [Ie, g] = y({}), [Q, de] = y(null), [ee, b] = y({}), [z, te] = y({}), [Ke, Nt] = y({}), [Qe, St] = y({}), [Sa, Ct] = y(null), [oa, $t] = y(!1), nt = me(null), [qt, kt] = y({}), [ut, ht] = y({}), [jt, ia] = y($ ?? []), { scopes: yt, ready: da } = si(), [Tt, ca] = y(!1), [ua, Ca] = y(/* @__PURE__ */ new Set()), [De, Lt] = y({}), rt = vo("drill.browser"), m = rt.value, [L, re] = y(null), [pe, Pe] = y(!1), [Be, $a] = y(() => {
2697
2697
  try {
2698
2698
  return localStorage.getItem("nvr_table_density") === "comfortable" ? "comfortable" : "compact";
2699
2699
  } catch {
@@ -2839,8 +2839,8 @@ function Yc({
2839
2839
  const l = (s) => {
2840
2840
  var p;
2841
2841
  const d = { ...s };
2842
- for (const [F, M] of Object.entries(r))
2843
- (((p = d[F]) == null ? void 0 : p.length) ?? 0) > 0 || (d[F] = M);
2842
+ for (const [F, O] of Object.entries(r))
2843
+ (((p = d[F]) == null ? void 0 : p.length) ?? 0) > 0 || (d[F] = O);
2844
2844
  return d;
2845
2845
  };
2846
2846
  kt(l), ht(l), Ca(new Set(Object.keys(r)));
@@ -3023,7 +3023,7 @@ function Yc({
3023
3023
  const xa = Object.keys(z).filter((e) => !e.includes(".") && !e.startsWith("__")).sort().join(","), Ar = (e) => [
3024
3024
  "cbv-items",
3025
3025
  n,
3026
- O,
3026
+ M,
3027
3027
  j,
3028
3028
  he ? "grouped" : e,
3029
3029
  he ? 500 : Ge,
@@ -3032,7 +3032,7 @@ function Yc({
3032
3032
  ], jr = async (e) => {
3033
3033
  const a = {
3034
3034
  limit: he ? 500 : Ge,
3035
- ...O ? { search: O } : {},
3035
+ ...M ? { search: M } : {},
3036
3036
  ...fe ? { conditions: fe } : {},
3037
3037
  ...xa ? { agg: xa } : {},
3038
3038
  // #2443 — the total may be a few seconds old (shown as "about"); rows are always fresh.
@@ -3043,7 +3043,7 @@ function Yc({
3043
3043
  if (he) return r(1);
3044
3044
  const l = JSON.stringify([
3045
3045
  n,
3046
- O,
3046
+ M,
3047
3047
  j,
3048
3048
  Ge,
3049
3049
  fe,
@@ -3081,7 +3081,7 @@ function Yc({
3081
3081
  });
3082
3082
  Xo({
3083
3083
  qc: v,
3084
- enabled: !!n && Tt && !he && !zt && !!$e && k * Ge < ($e.total ?? 0),
3084
+ enabled: !!n && Tt && !he && !M && !zt && !!$e && k * Ge < ($e.total ?? 0),
3085
3085
  queryKey: Ar(k + 1),
3086
3086
  queryFn: () => jr(k + 1)
3087
3087
  });
@@ -3105,7 +3105,7 @@ function Yc({
3105
3105
  );
3106
3106
  return a.length > 0 ? JSON.stringify(a) : void 0;
3107
3107
  }, [Br, fe, ut]), { data: Da } = ne({
3108
- queryKey: ["cbv-default-hidden", n, O, yn],
3108
+ queryKey: ["cbv-default-hidden", n, M, yn],
3109
3109
  enabled: !!n && !Ee && !!$e && !zt && qe === 0 && va.length > 0,
3110
3110
  staleTime: 3e4,
3111
3111
  retry: !1,
@@ -3114,7 +3114,7 @@ function Yc({
3114
3114
  limit: 1,
3115
3115
  fields: "id",
3116
3116
  count: "approx",
3117
- ...O ? { search: O } : {},
3117
+ ...M ? { search: M } : {},
3118
3118
  ...yn ? { conditions: yn } : {}
3119
3119
  })
3120
3120
  ).then((e) => Number(e.total ?? 0))
@@ -3128,21 +3128,21 @@ function Yc({
3128
3128
  }, zr = me(Date.now()), Aa = me(null);
3129
3129
  ke(() => {
3130
3130
  zr.current = Date.now();
3131
- }, [n, O]), ke(() => {
3131
+ }, [n, M]), ke(() => {
3132
3132
  var a, r;
3133
- if (!n || O.length < 2 || !$e || zt || Ee) return;
3134
- const e = `${n}\0${O}`;
3133
+ if (!n || M.length < 2 || !$e || zt || Ee) return;
3134
+ const e = `${n}\0${M}`;
3135
3135
  ((a = Aa.current) == null ? void 0 : a.key) !== e && (Aa.current = {
3136
3136
  key: e,
3137
3137
  id: ri(u, {
3138
3138
  surface: "collection",
3139
3139
  collection: n,
3140
- query: O,
3140
+ query: M,
3141
3141
  result_count: $e.total ?? ((r = $e.data) == null ? void 0 : r.length) ?? 0,
3142
3142
  duration_ms: Date.now() - zr.current
3143
3143
  })
3144
3144
  });
3145
- }, [u, n, O, $e, zt, Ee]), pi(
3145
+ }, [u, n, M, $e, zt, Ee]), pi(
3146
3146
  n ? {
3147
3147
  list: {
3148
3148
  collection: n,
@@ -3154,7 +3154,7 @@ function Yc({
3154
3154
  value: e.value,
3155
3155
  ...e.not ? { not: !0 } : {}
3156
3156
  })),
3157
- search: O || null,
3157
+ search: M || null,
3158
3158
  total: qe
3159
3159
  }
3160
3160
  } : null
@@ -3168,7 +3168,7 @@ function Yc({
3168
3168
  Qr.current = [
3169
3169
  "cbv-items",
3170
3170
  n,
3171
- O,
3171
+ M,
3172
3172
  j,
3173
3173
  he ? "grouped" : k,
3174
3174
  he ? 500 : Ge,
@@ -3177,13 +3177,13 @@ function Yc({
3177
3177
  ];
3178
3178
  const Vr = me({
3179
3179
  conditions: fe,
3180
- search: O,
3180
+ search: M,
3181
3181
  page: k,
3182
3182
  grouped: !!he
3183
3183
  });
3184
3184
  Vr.current = {
3185
3185
  conditions: fe,
3186
- search: O,
3186
+ search: M,
3187
3187
  page: k,
3188
3188
  grouped: !!he
3189
3189
  };
@@ -3203,11 +3203,11 @@ function Yc({
3203
3203
  Qr.current,
3204
3204
  (I) => I && { ...I, ...ae(I) }
3205
3205
  );
3206
- let d = [], p = null, F = null, M = !1;
3206
+ let d = [], p = null, F = null, O = !1;
3207
3207
  const Se = async () => {
3208
3208
  p = null;
3209
3209
  const ae = d;
3210
- if (d = [], ae.length === 0 || M) return;
3210
+ if (d = [], ae.length === 0 || O) return;
3211
3211
  F || (F = setTimeout(() => {
3212
3212
  F = null, v.invalidateQueries({ queryKey: ["cbv-view-count", n] });
3213
3213
  }, 1500));
@@ -3267,7 +3267,7 @@ function Yc({
3267
3267
  }
3268
3268
  return;
3269
3269
  }
3270
- if (M) return;
3270
+ if (O) return;
3271
3271
  const U = Wo(it.conditions), J = it.page === 1 && !it.grouped, C = /* @__PURE__ */ new Map(), ie = [], ze = [];
3272
3272
  for (const [Y, se] of I) {
3273
3273
  const Z = Wt.get(Y);
@@ -3310,7 +3310,7 @@ function Yc({
3310
3310
  (ae) => Fo(Sn, [ae], X)
3311
3311
  );
3312
3312
  return () => {
3313
- M = !0, le(), Ro(Sn), r && clearTimeout(r), p && clearTimeout(p), F && clearTimeout(F);
3313
+ O = !0, le(), Ro(Sn), r && clearTimeout(r), p && clearTimeout(p), F && clearTimeout(F);
3314
3314
  };
3315
3315
  }, [wn, n, v, u, _n, gt, Sn]);
3316
3316
  const Cs = Ko(
@@ -3443,10 +3443,10 @@ function Yc({
3443
3443
  const a = e.includes(".") ? e : Ae[e];
3444
3444
  return a ? ((r = ge == null ? void 0 : ge.targets) == null ? void 0 : r[a]) ?? null : null;
3445
3445
  }, Fs = (e, a) => {
3446
- var d, p, F, M;
3446
+ var d, p, F, O;
3447
3447
  const r = a.includes(".") ? a : Ae[a];
3448
3448
  if (!r) return null;
3449
- const l = (d = ge == null ? void 0 : ge.targets) == null ? void 0 : d[r], s = ((M = (F = (p = ge == null ? void 0 : ge.rows) == null ? void 0 : p[String(e)]) == null ? void 0 : F[r]) == null ? void 0 : M.ids) ?? [];
3449
+ const l = (d = ge == null ? void 0 : ge.targets) == null ? void 0 : d[r], s = ((O = (F = (p = ge == null ? void 0 : ge.rows) == null ? void 0 : p[String(e)]) == null ? void 0 : F[r]) == null ? void 0 : O.ids) ?? [];
3450
3450
  return !l || bt(l) || s.length === 0 ? null : { target: l, id: String(s[0]) };
3451
3451
  }, Dt = (e) => e.includes(".") || e in Ae, Zt = (e) => {
3452
3452
  if (e.includes(".")) return { kind: "text", path: e.split(".") };
@@ -3465,7 +3465,7 @@ function Yc({
3465
3465
  const l = { ...r };
3466
3466
  return a ? l[e] = a : delete l[e], l;
3467
3467
  }), Rs = (e) => {
3468
- var p, F, M, Se;
3468
+ var p, F, O, Se;
3469
3469
  const { key: a, row: r, cellText: l } = e, s = r.id;
3470
3470
  if (a === "__state__") {
3471
3471
  const X = (p = Ne == null ? void 0 : Ne.instances) == null ? void 0 : p[String(s)];
@@ -3477,7 +3477,7 @@ function Yc({
3477
3477
  const d = Zt(a);
3478
3478
  if (d) {
3479
3479
  if (d.kind === "in") {
3480
- const le = Ye(Xe, n, a) ? r[a] != null ? [r[a]] : [] : ((Se = (M = (F = ge == null ? void 0 : ge.rows) == null ? void 0 : F[String(s)]) == null ? void 0 : M[Ae[a]]) == null ? void 0 : Se.ids) ?? [];
3480
+ const le = Ye(Xe, n, a) ? r[a] != null ? [r[a]] : [] : ((Se = (O = (F = ge == null ? void 0 : ge.rows) == null ? void 0 : F[String(s)]) == null ? void 0 : O[Ae[a]]) == null ? void 0 : Se.ids) ?? [];
3481
3481
  if (le.length === 0) return;
3482
3482
  const ae = De[a], I = (ae == null ? void 0 : ae.kind) === "in" ? ae.value : [];
3483
3483
  Re(a, { kind: "in", value: [.../* @__PURE__ */ new Set([...I, ...le])] });
@@ -3523,10 +3523,10 @@ function Yc({
3523
3523
  else if ((d.kind === "enum" || d.kind === "num") && r[a] != null && r[a] !== "")
3524
3524
  p = { id: F, path: [a], op: "_neq", value: r[a], label: l, field: a };
3525
3525
  else if (d.kind === "text") {
3526
- const M = a.includes(".") || a in Ae ? st(s, a) : String(r[a] ?? "");
3527
- M && M !== "—" && (p = { id: F, path: d.path, op: "_ncontains", value: M, label: M, field: a });
3526
+ const O = a.includes(".") || a in Ae ? st(s, a) : String(r[a] ?? "");
3527
+ O && O !== "—" && (p = { id: F, path: d.path, op: "_ncontains", value: O, label: O, field: a });
3528
3528
  }
3529
- p && pr((M) => [...M, p]);
3529
+ p && pr((O) => [...O, p]);
3530
3530
  }, Ms = (e) => {
3531
3531
  var l, s, d;
3532
3532
  const a = Zt(e);
@@ -3534,17 +3534,17 @@ function Yc({
3534
3534
  const r = De[e];
3535
3535
  if (a.kind === "in") {
3536
3536
  const p = /* @__PURE__ */ new Set(), F = Ae[e];
3537
- for (const M of ve)
3537
+ for (const O of ve)
3538
3538
  if (F)
3539
- for (const Se of ((d = (s = (l = ge == null ? void 0 : ge.rows) == null ? void 0 : l[String(M.id)]) == null ? void 0 : s[F]) == null ? void 0 : d.ids) ?? [])
3539
+ for (const Se of ((d = (s = (l = ge == null ? void 0 : ge.rows) == null ? void 0 : l[String(O.id)]) == null ? void 0 : s[F]) == null ? void 0 : d.ids) ?? [])
3540
3540
  p.add(Se);
3541
- else M[e] != null && M[e] !== "" && typeof M[e] != "object" && p.add(M[e]);
3541
+ else O[e] != null && O[e] !== "" && typeof O[e] != "object" && p.add(O[e]);
3542
3542
  return /* @__PURE__ */ t(
3543
3543
  kd,
3544
3544
  {
3545
3545
  target: a.target,
3546
3546
  selected: (r == null ? void 0 : r.kind) === "in" ? r.value : [],
3547
- onChange: (M) => Re(e, M.length ? { kind: "in", value: M } : null),
3547
+ onChange: (O) => Re(e, O.length ? { kind: "in", value: O } : null),
3548
3548
  preferIds: [...p]
3549
3549
  }
3550
3550
  );
@@ -3580,8 +3580,8 @@ function Yc({
3580
3580
  sa,
3581
3581
  {
3582
3582
  value: p,
3583
- onChange: (M) => Re(e, { kind: "num", op: M, value: F }),
3584
- options: es.map((M) => ({ value: M.value, label: M.label })),
3583
+ onChange: (O) => Re(e, { kind: "num", op: O, value: F }),
3584
+ options: es.map((O) => ({ value: O.value, label: O.label })),
3585
3585
  ariaLabel: `Filter operator ${e}`
3586
3586
  }
3587
3587
  ),
@@ -3590,7 +3590,7 @@ function Yc({
3590
3590
  {
3591
3591
  type: "number",
3592
3592
  value: F,
3593
- onChange: (M) => Re(e, M.target.value ? { kind: "num", op: p, value: M.target.value } : null),
3593
+ onChange: (O) => Re(e, O.target.value ? { kind: "num", op: p, value: O.target.value } : null),
3594
3594
  "aria-label": `Filter value ${e}`,
3595
3595
  className: "h-6 w-full min-w-[52px] rounded border border-slate-200 bg-white px-1.5 text-[11px] font-normal outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100"
3596
3596
  }
@@ -3627,7 +3627,7 @@ function Yc({
3627
3627
  var s, d, p;
3628
3628
  const l = ee[a];
3629
3629
  if ((l == null ? void 0 : l.type) === "count") {
3630
- const F = a.includes(".") ? a : Ae[a], M = r != null && F ? (p = (d = (s = ge == null ? void 0 : ge.rows) == null ? void 0 : s[String(r)]) == null ? void 0 : d[F]) == null ? void 0 : p.ids : void 0, Se = Po(e === "—" ? "" : e, M);
3630
+ const F = a.includes(".") ? a : Ae[a], O = r != null && F ? (p = (d = (s = ge == null ? void 0 : ge.rows) == null ? void 0 : s[String(r)]) == null ? void 0 : d[F]) == null ? void 0 : p.ids : void 0, Se = Po(e === "—" ? "" : e, O);
3631
3631
  return String(Se);
3632
3632
  }
3633
3633
  return l && e && e !== "—" ? Ml(e, l) : e;
@@ -3675,12 +3675,12 @@ function Yc({
3675
3675
  g(p);
3676
3676
  const F = d.filter((K) => K.includes(".") || ft.has(K) || !!p[K]);
3677
3677
  F.length > 0 && Oe(F);
3678
- const M = {}, Se = {}, X = {};
3678
+ const O = {}, Se = {}, X = {};
3679
3679
  let le = !1;
3680
3680
  const ae = {}, I = {}, f = {};
3681
3681
  for (const K of e.columns)
3682
- typeof K != "string" && K.label && (M[K.key] = K.label), typeof K != "string" && K.format && (Se[K.key] = K.format), typeof K != "string" && K.pin && (le = !0, K.pin !== "none" && (X[K.key] = K.pin)), typeof K != "string" && ((l = K.tint) != null && l.length) && (ae[K.key] = K.tint), typeof K != "string" && K.width && (I[K.key] = K.width), typeof K != "string" && K.agg && (f[K.key] = K.agg);
3683
- te(f), Ce(M), b(Se), St(ae), Nt(I), Ra(le ? X : null);
3682
+ typeof K != "string" && K.label && (O[K.key] = K.label), typeof K != "string" && K.format && (Se[K.key] = K.format), typeof K != "string" && K.pin && (le = !0, K.pin !== "none" && (X[K.key] = K.pin)), typeof K != "string" && ((l = K.tint) != null && l.length) && (ae[K.key] = K.tint), typeof K != "string" && K.width && (I[K.key] = K.width), typeof K != "string" && K.agg && (f[K.key] = K.agg);
3683
+ te(f), Ce(O), b(Se), St(ae), Nt(I), Ra(le ? X : null);
3684
3684
  } else
3685
3685
  Ra(null);
3686
3686
  q(1);
@@ -3697,10 +3697,10 @@ function Yc({
3697
3697
  sort: j,
3698
3698
  columns: [
3699
3699
  ...ce.map((e, a) => {
3700
- const r = Le[e], l = ee[e], s = ha[e] ?? (a === 0 && fn !== null ? "none" : void 0), d = Qe[e], p = Ke[e], F = z[e], M = Ie[e];
3701
- return !r && !l && !s && !(d != null && d.length) && !p && !F && !M && !al.has(e) ? e : {
3700
+ const r = Le[e], l = ee[e], s = ha[e] ?? (a === 0 && fn !== null ? "none" : void 0), d = Qe[e], p = Ke[e], F = z[e], O = Ie[e];
3701
+ return !r && !l && !s && !(d != null && d.length) && !p && !F && !O && !al.has(e) ? e : {
3702
3702
  key: e,
3703
- ...M ? { formula: M } : {},
3703
+ ...O ? { formula: O } : {},
3704
3704
  ...r ? { label: r } : {},
3705
3705
  ...l ? { format: l } : {},
3706
3706
  ...s ? { pin: s } : {},
@@ -3751,11 +3751,11 @@ function Yc({
3751
3751
  ), ll(""), v.invalidateQueries({ queryKey: ["cbv-export-presets", n] }));
3752
3752
  }, js = (e) => {
3753
3753
  const a = new URLSearchParams();
3754
- O && a.set("search", O), fe && a.set("conditions", fe), j && a.set("sort", j), window.open(`/api/export-presets/${e}/run?${a.toString()}`, "_blank");
3754
+ M && a.set("search", M), fe && a.set("conditions", fe), j && a.set("sort", j), window.open(`/api/export-presets/${e}/run?${a.toString()}`, "_blank");
3755
3755
  }, Is = (e, a) => {
3756
3756
  u.request(
3757
3757
  be(`/export-presets/${e}/run-async`, {
3758
- ...O ? { search: O } : {},
3758
+ ...M ? { search: M } : {},
3759
3759
  ...fe ? { conditions: fe } : {},
3760
3760
  ...j ? { sort: j } : {}
3761
3761
  })
@@ -3821,7 +3821,7 @@ function Yc({
3821
3821
  G(`/items/${n}`, {
3822
3822
  limit: J,
3823
3823
  offset: U,
3824
- ...O ? { search: O } : {},
3824
+ ...M ? { search: M } : {},
3825
3825
  sort: qi(j),
3826
3826
  ...fe ? { conditions: fe } : {}
3827
3827
  })
@@ -3848,7 +3848,7 @@ function Yc({
3848
3848
  labelField: wa(C)
3849
3849
  });
3850
3850
  }
3851
- const F = [.../* @__PURE__ */ new Set([...Ia, ...d.flatMap(Ti)])], M = await Li(
3851
+ const F = [.../* @__PURE__ */ new Set([...Ia, ...d.flatMap(Ti)])], O = await Li(
3852
3852
  r.map((U) => String(U.id)),
3853
3853
  F,
3854
3854
  (U, J) => u.request(
@@ -3879,17 +3879,17 @@ function Yc({
3879
3879
  if (J.startsWith("__f:")) {
3880
3880
  const Z = Ie[J], ye = Z ? El(Z, (We) => {
3881
3881
  var ql, Tl;
3882
- const vt = We.includes(".") ? (Tl = (ql = M[String(U.id)]) == null ? void 0 : ql[We]) == null ? void 0 : Tl.value : U[We];
3882
+ const vt = We.includes(".") ? (Tl = (ql = O[String(U.id)]) == null ? void 0 : ql[We]) == null ? void 0 : Tl.value : U[We];
3883
3883
  return typeof vt == "string" && /^-?\d+(\.\d+)?$/.test(vt.trim()) ? Number(vt) : vt;
3884
3884
  }) : null;
3885
3885
  return ye == null ? "" : C ? ra(String(ye), C) : Math.round(ye * 100) / 100;
3886
3886
  }
3887
3887
  if (J.includes(".") || J in Ae) {
3888
- const Z = J.includes(".") ? J : Ae[J], ye = ((se = (Y = M[String(U.id)]) == null ? void 0 : Y[Z]) == null ? void 0 : se.value) ?? "";
3888
+ const Z = J.includes(".") ? J : Ae[J], ye = ((se = (Y = O[String(U.id)]) == null ? void 0 : Y[Z]) == null ? void 0 : se.value) ?? "";
3889
3889
  return C && ye ? Ml(ye, C) : ye;
3890
3890
  }
3891
3891
  const ie = U[J], ze = le.get(J);
3892
- return ze && ie != null && ie !== "" ? Ri(ze, M[String(U.id)]) || ie : ae.has(J) && ie != null && ie !== "" ? X.get(String(ie).toUpperCase()) ?? ie : C && ie != null ? ra(String(ie), C) : ie;
3892
+ return ze && ie != null && ie !== "" ? Ri(ze, O[String(U.id)]) || ie : ae.has(J) && ie != null && ie !== "" ? X.get(String(ie).toUpperCase()) ?? ie : C && ie != null ? ra(String(ie), C) : ie;
3893
3893
  }, K = [
3894
3894
  ["id", ...s.map((U) => lt(U))].map(I).join(","),
3895
3895
  ...r.map((U) => [U.id, ...s.map((J) => f(U, J))].map(I).join(","))
@@ -3928,7 +3928,7 @@ function Yc({
3928
3928
  }, 250);
3929
3929
  }, aa = (e) => {
3930
3930
  var a;
3931
- ((a = Aa.current) == null ? void 0 : a.key) === `${n}\0${O}` && li(u, Aa.current.id, {
3931
+ ((a = Aa.current) == null ? void 0 : a.key) === `${n}\0${M}` && li(u, Aa.current.id, {
3932
3932
  type: "record",
3933
3933
  collection: n,
3934
3934
  item: e === "new" ? null : e
@@ -3945,10 +3945,10 @@ function Yc({
3945
3945
  staleTime: 6e4
3946
3946
  }).then((s) => {
3947
3947
  var Se;
3948
- const p = (Se = ((s == null ? void 0 : s.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : Se[1], F = ((s == null ? void 0 : s.fields) ?? []).map((X) => X.field), M = (p && F.includes(p) ? p : null) ?? F.find(
3948
+ const p = (Se = ((s == null ? void 0 : s.display_template) ?? "").match(/\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/)) == null ? void 0 : Se[1], F = ((s == null ? void 0 : s.fields) ?? []).map((X) => X.field), O = (p && F.includes(p) ? p : null) ?? F.find(
3949
3949
  (X) => ["name", "title", "label", "short_name", "subject"].includes(X.toLowerCase())
3950
3950
  ) ?? null;
3951
- r(M ? `${e}.${M}` : e);
3951
+ r(O ? `${e}.${O}` : e);
3952
3952
  }).catch(() => r(e));
3953
3953
  return;
3954
3954
  }
@@ -3962,7 +3962,7 @@ function Yc({
3962
3962
  G(`/items/${n}`, {
3963
3963
  limit: Ua,
3964
3964
  fields: "id",
3965
- ...O ? { search: O } : {},
3965
+ ...M ? { search: M } : {},
3966
3966
  ...fe ? { conditions: fe } : {}
3967
3967
  })
3968
3968
  );
@@ -4408,7 +4408,7 @@ function Yc({
4408
4408
  collection: n,
4409
4409
  list: {
4410
4410
  conditions: fe,
4411
- search: O || void 0,
4411
+ search: M || void 0,
4412
4412
  sort: j || void 0,
4413
4413
  limit: Ge,
4414
4414
  page: k
@@ -4753,7 +4753,7 @@ function Yc({
4753
4753
  onChange: (d) => St((p) => ({
4754
4754
  ...p,
4755
4755
  [e]: (p[e] ?? []).map(
4756
- (F, M) => M === s ? { ...F, op: d } : F
4756
+ (F, O) => O === s ? { ...F, op: d } : F
4757
4757
  )
4758
4758
  })),
4759
4759
  options: [
@@ -4774,7 +4774,7 @@ function Yc({
4774
4774
  onChange: (d) => St((p) => ({
4775
4775
  ...p,
4776
4776
  [e]: (p[e] ?? []).map(
4777
- (F, M) => M === s ? { ...F, value: d.target.value } : F
4777
+ (F, O) => O === s ? { ...F, value: d.target.value } : F
4778
4778
  )
4779
4779
  })),
4780
4780
  placeholder: "value",
@@ -4789,7 +4789,7 @@ function Yc({
4789
4789
  onClick: () => St((p) => ({
4790
4790
  ...p,
4791
4791
  [e]: (p[e] ?? []).map(
4792
- (F, M) => M === s ? { ...F, color: d } : F
4792
+ (F, O) => O === s ? { ...F, color: d } : F
4793
4793
  )
4794
4794
  })),
4795
4795
  className: At(
@@ -5496,7 +5496,7 @@ ${r}`).then(() => {
5496
5496
  lngField: Jt.lngField,
5497
5497
  labelField: Jt.labelField,
5498
5498
  conditions: fe ?? null,
5499
- search: O,
5499
+ search: M,
5500
5500
  onOpen: (e) => aa(e)
5501
5501
  }
5502
5502
  ) }) : null,
@@ -5586,7 +5586,7 @@ ${r}`).then(() => {
5586
5586
  a
5587
5587
  );
5588
5588
  }
5589
- const d = ft.get(a), p = !!(d != null && d.computed_formula && !d.computed_store && !d.sql_filterable), F = Dt(a) || p, M = !F && (j === a || j === `-${a}` || j.replace(/^-/, "").startsWith(`${a}.`)), Se = j.startsWith("-") && M, X = ft.get(a), le = lt(a);
5589
+ const d = ft.get(a), p = !!(d != null && d.computed_formula && !d.computed_store && !d.sql_filterable), F = Dt(a) || p, O = !F && (j === a || j === `-${a}` || j.replace(/^-/, "").startsWith(`${a}.`)), Se = j.startsWith("-") && O, X = ft.get(a), le = lt(a);
5590
5590
  return /* @__PURE__ */ c(
5591
5591
  "th",
5592
5592
  {
@@ -5610,8 +5610,8 @@ ${r}`).then(() => {
5610
5610
  !F && /* @__PURE__ */ t(
5611
5611
  "span",
5612
5612
  {
5613
- className: `ml-1 inline-block transition-[transform,color] duration-200 ${M ? "text-[#00a5cc]" : "text-slate-300"} ${M && Se ? "rotate-180" : ""}`,
5614
- children: M ? "▲" : "⇅"
5613
+ className: `ml-1 inline-block transition-[transform,color] duration-200 ${O ? "text-[#00a5cc]" : "text-slate-300"} ${O && Se ? "rotate-180" : ""}`,
5614
+ children: O ? "▲" : "⇅"
5615
5615
  }
5616
5616
  ),
5617
5617
  fl(a),
@@ -5781,7 +5781,7 @@ ${r}`).then(() => {
5781
5781
  colSpan: ce.length + In,
5782
5782
  className: "nvr-fade-in py-16",
5783
5783
  children: (() => {
5784
- const e = V.length === 0 && Object.keys(De).length === 0 && !Object.values(ut).some((r) => r.length > 0) && !O, a = D == null ? void 0 : D.empty_state;
5784
+ const e = V.length === 0 && Object.keys(De).length === 0 && !Object.values(ut).some((r) => r.length > 0) && !M, a = D == null ? void 0 : D.empty_state;
5785
5785
  if (e && a && (a.title || a.message)) {
5786
5786
  const r = a.cta_url ?? "", l = r.startsWith("/"), s = /^https?:\/\//.test(r);
5787
5787
  return /* @__PURE__ */ c("div", { className: "flex flex-col items-center gap-2 text-center", children: [
@@ -5835,7 +5835,7 @@ ${r}`).then(() => {
5835
5835
  ]
5836
5836
  }
5837
5837
  ) : /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "Try adjusting your search or filters." }),
5838
- (V.length > 0 || Object.keys(De).length > 0 || Object.values(ut).some((r) => r.length > 0) || O) && /* @__PURE__ */ t(
5838
+ (V.length > 0 || Object.keys(De).length > 0 || Object.values(ut).some((r) => r.length > 0) || M) && /* @__PURE__ */ t(
5839
5839
  "button",
5840
5840
  {
5841
5841
  type: "button",
@@ -5882,7 +5882,7 @@ ${r}`).then(() => {
5882
5882
  },
5883
5883
  `__group__${e.gkey}`
5884
5884
  );
5885
- const l = e.row, s = l.id, d = It.includes(s), p = (ae = Ne == null ? void 0 : Ne.instances) == null ? void 0 : ae[String(s)], F = qs[String(s)], M = Rn == null ? void 0 : Rn[String(s)], Se = Cs.get(String(s)) ?? null, X = !d && F ? ni(F.color) : void 0, le = d ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : X ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
5885
+ const l = e.row, s = l.id, d = It.includes(s), p = (ae = Ne == null ? void 0 : Ne.instances) == null ? void 0 : ae[String(s)], F = qs[String(s)], O = Rn == null ? void 0 : Rn[String(s)], Se = Cs.get(String(s)) ?? null, X = !d && F ? ni(F.color) : void 0, le = d ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : X ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
5886
5886
  return /* @__PURE__ */ c(
5887
5887
  "tr",
5888
5888
  {
@@ -5913,7 +5913,7 @@ ${r}`).then(() => {
5913
5913
  viewers: Ur[Dl(n, String(s))],
5914
5914
  dataAttr: "data-cbv-presence"
5915
5915
  }
5916
- ) : /* @__PURE__ */ t(Bl, { change: M, dataAttr: "data-cbv-unseen" }),
5916
+ ) : /* @__PURE__ */ t(Bl, { change: O, dataAttr: "data-cbv-unseen" }),
5917
5917
  /* @__PURE__ */ t(ki, { rowId: s }),
5918
5918
  /* @__PURE__ */ t(
5919
5919
  "input",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",