@nivaro/react 0.3.59 → 0.3.61

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.
@@ -3777,6 +3777,7 @@ function Sc({
3777
3777
  }
3778
3778
  return /* @__PURE__ */ a("span", { className: "block truncate", children: String(n) });
3779
3779
  }
3780
+ const Ki = de(/* @__PURE__ */ new Map());
3780
3781
  if (ws || !L && mn)
3781
3782
  return /* @__PURE__ */ a("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ a(Tn, { className: "h-4 w-4 animate-spin inline" }) });
3782
3783
  const Jr = (f == null ? void 0 : f.rowId) === "new", st = cn && Ae === "original" && !q, At = (st ? 1 : 0) + (ie && (X || L || P) ? 1 : 0) + (T ? 1 : 0) + (L || P ? 1 : 0) + Me.length + 1, er = st ? "select" : ie && (X || P) ? "reorder" : T ? "num" : P ? "status" : "data", tr = (e) => {
@@ -3808,7 +3809,7 @@ function Sc({
3808
3809
  }), D.forEach((n, t) => {
3809
3810
  e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
3810
3811
  })), e;
3811
- }, Ki = st ? nr().map((e) => e.key) : [], cl = Ki.length > 0 && Ki.every((e) => Rt.has(e)), ul = st ? nr().filter((e) => Rt.has(e.key)) : [], fl = () => {
3812
+ }, Pi = st ? nr().map((e) => e.key) : [], cl = Pi.length > 0 && Pi.every((e) => Rt.has(e)), ul = st ? nr().filter((e) => Rt.has(e.key)) : [], fl = () => {
3812
3813
  var t;
3813
3814
  const e = Ge.current;
3814
3815
  if (!e) return !1;
@@ -3845,16 +3846,15 @@ function Sc({
3845
3846
  };
3846
3847
  rs.current = ml;
3847
3848
  async function pl(e) {
3848
- const n = Pi.current;
3849
+ const n = Ki.current;
3849
3850
  await Ao(
3850
3851
  e,
3851
3852
  nr().filter((t) => Rt.has(t.key)),
3852
3853
  { clearSelection: !0, noun: "row", baseOf: (t) => n.get(t) }
3853
- ), Pi.current = /* @__PURE__ */ new Map();
3854
+ ), Ki.current = /* @__PURE__ */ new Map();
3854
3855
  }
3855
- const Pi = de(/* @__PURE__ */ new Map());
3856
3856
  function hl() {
3857
- Pi.current = L || q ? /* @__PURE__ */ new Map() : od(
3857
+ Ki.current = L || q ? /* @__PURE__ */ new Map() : od(
3858
3858
  wt,
3859
3859
  [...Rt].filter((e) => !e.startsWith("pending:"))
3860
3860
  ), ss(!0);
@@ -5007,7 +5007,7 @@ function Sc({
5007
5007
  "aria-label": "Select all rows",
5008
5008
  className: "accent-nvr-cyan",
5009
5009
  checked: cl,
5010
- onChange: (e) => fr(e.target.checked ? new Set(Ki) : /* @__PURE__ */ new Set())
5010
+ onChange: (e) => fr(e.target.checked ? new Set(Pi) : /* @__PURE__ */ new Set())
5011
5011
  }
5012
5012
  ) }),
5013
5013
  ie && (X || L || P) && /* @__PURE__ */ a("th", { className: "w-6" }),
@@ -5,16 +5,16 @@ import { useMemo as y, useState as j } from "react";
5
5
  import { toast as p } from "sonner";
6
6
  import { useNivaroClient as x } from "../../context.js";
7
7
  import { get as A, post as v } from "../../lib/commands.js";
8
- import { errorToastOptions as S } from "../../lib/error-toast.js";
9
- import { userErrorMessage as T } from "../../lib/safe-error.js";
10
- import { cn as B } from "../../lib/utils.js";
11
- import { useAvailableBulkActions as P, guardMatches as D } from "../bulk/BulkActionButtons.js";
8
+ import { errorToastOptions as P } from "../../lib/error-toast.js";
9
+ import { userErrorMessage as S } from "../../lib/safe-error.js";
10
+ import { cn as T } from "../../lib/utils.js";
11
+ import { useAvailableBulkActions as B, guardMatches as D } from "../bulk/BulkActionButtons.js";
12
12
  import { Button as k } from "../ui/button.js";
13
13
  import { Dialog as H, DialogContent as M, DialogHeader as Q, DialogTitle as _, DialogDescription as E, DialogBody as J, DialogFooter as K } from "../ui/dialog.js";
14
14
  import { Textarea as L } from "../ui/textarea.js";
15
15
  import { invalidateRecordQueries as O } from "./RecordLiveSync.js";
16
16
  function de(e, n, t, m = {}) {
17
- const f = x(), h = !!n && n !== "new", { data: u } = P(h ? [e] : []), a = y(
17
+ const f = x(), h = !!n && n !== "new", { data: u } = B(h ? [e] : []), a = y(
18
18
  () => ((u == null ? void 0 : u[e]) ?? []).filter(
19
19
  (r) => r.header === !0 && (r.kind === "update_fields" || r.kind === "transition")
20
20
  ),
@@ -32,7 +32,7 @@ function de(e, n, t, m = {}) {
32
32
  fields: d.join(",")
33
33
  })
34
34
  ).then((r) => r.data ?? {}).catch(() => ({})),
35
- enabled: h && d.length > 0,
35
+ enabled: h && d.length > 0 && m.valuesPending !== !0,
36
36
  staleTime: 0
37
37
  }), c = m.fieldsLocked === !0;
38
38
  return y(() => {
@@ -67,7 +67,7 @@ function ue({
67
67
  "data-record-header-action": t.key,
68
68
  "data-tip": W(t),
69
69
  onClick: () => n(t),
70
- className: B(
70
+ className: T(
71
71
  "shrink-0 gap-1.5 text-[12px]",
72
72
  t.variant === "danger" && "border-red-300 text-red-600 hover:bg-red-50 hover:text-red-700 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10"
73
73
  ),
@@ -96,7 +96,7 @@ function le({
96
96
  var o;
97
97
  (o = i.errors) != null && o.length ? p.error(i.errors[0].error) : !i.succeeded && i.skipped ? p.info(`${r.label}: nothing to change on this record`) : p.success(`${r.label} — done`), O(u, n, [t]), u.invalidateQueries({ queryKey: ["record-header-action-guard", n] }), d(""), f == null || f(), m();
98
98
  },
99
- onError: (r) => p.error(T(r, "The action did not run"), S(r))
99
+ onError: (r) => p.error(S(r, "The action did not run"), P(r))
100
100
  });
101
101
  return /* @__PURE__ */ s(
102
102
  H,