@nivaro/react 0.3.10 → 0.3.12

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 (50) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useNivaroForm.js +1 -1
  3. package/dist/hooks/useSessionRecorder.js +109 -102
  4. package/dist/index.d.ts +34 -3
  5. package/dist/shared/components/CollectionBrowserView.js +1546 -1477
  6. package/dist/shared/components/ItemEditForm.js +4332 -4195
  7. package/dist/shared/components/PageRenderer.js +512 -465
  8. package/dist/shared/components/ProfileView.js +115 -109
  9. package/dist/shared/components/QueryStatStrip.js +74 -70
  10. package/dist/shared/components/ReportView.js +818 -827
  11. package/dist/shared/components/SheetHeaderBody.js +16 -14
  12. package/dist/shared/components/chat/ChatPanel.js +492 -472
  13. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  14. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  15. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  16. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  17. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  18. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  19. package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
  20. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  21. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  22. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  23. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  24. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  25. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  26. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  27. package/dist/shared/components/item-edit/UserChip.js +301 -233
  28. package/dist/shared/components/item-edit/helpers.js +133 -134
  29. package/dist/shared/components/item-edit/line-qty.js +57 -0
  30. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  31. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  32. package/dist/shared/components/panels/CommentPanel.js +350 -315
  33. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  34. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  35. package/dist/shared/components/profile/PersonAdminTools.js +168 -144
  36. package/dist/shared/components/profile/PersonProfile.js +42 -41
  37. package/dist/shared/components/profile/session-actions.js +52 -0
  38. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  39. package/dist/shared/components/queue/QueueWorklist.js +1005 -935
  40. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  41. package/dist/shared/lib/obligation-banner.js +14 -13
  42. package/dist/shared/lib/obligation-reason-text.js +13 -0
  43. package/dist/shared/lib/query-filter-seed.js +34 -11
  44. package/dist/shared/lib/replay-checkout.js +20 -0
  45. package/dist/shared/lib/sanitize-html.js +24 -15
  46. package/dist/shared/lib/sheet-def.js +38 -22
  47. package/dist/shared/lib/unique-options.js +10 -0
  48. package/dist/shared/lib/utils.js +57 -43
  49. package/dist/shared/lib/validation-rules.js +58 -34
  50. package/package.json +1 -1
@@ -5,25 +5,25 @@ import { cn as l } from "../../lib/utils.js";
5
5
  import { Tabs as A, TabsList as I, TabsTrigger as S, TabsContent as o } from "../ui/tabs.js";
6
6
  import { DayTimelineCard as T } from "./DayTimeline.js";
7
7
  import { DelegationCard as P } from "./DelegationCard.js";
8
- import { SuspensionBanner as U, AccessCard as D, UserScopesCard as F, UserDirectoryCard as j, SessionsCard as L, ApiTokenCard as M } from "./PersonAccess.js";
9
- import { AccessSummaryCard as O } from "./PersonAccessSummary.js";
10
- import { StatsCard as R, ActivityFeedCard as V, SignInsCard as W, JourneyCard as E } from "./PersonActivity.js";
11
- import { ForceReloadCard as B, MergeCard as H, OffboardingCard as J } from "./PersonAdminTools.js";
12
- import { PersonAiMemoryCard as q } from "./PersonAiMemory.js";
13
- import { CompareAccessCard as z } from "./PersonCompare.js";
14
- import { WorkingOnCard as G, TeamLoadCard as K, WhyCard as Q } from "./PersonExtras.js";
15
- import { PersonHeader as X } from "./PersonHeader.js";
16
- import { AboutCard as Y, PeopleCard as Z, AvailabilityCard as $, ResponsibilitiesCard as ee } from "./PersonOverview.js";
17
- import { PersonWeekCard as re } from "./PersonWeek.js";
18
- import { usePersonProfile as ae, useInvalidatePerson as de } from "./types.js";
19
- function ke({
8
+ import { SuspensionBanner as U, AccessCard as D, UserScopesCard as F, UserDirectoryCard as O, SessionsCard as j, ApiTokenCard as E } from "./PersonAccess.js";
9
+ import { AccessSummaryCard as L } from "./PersonAccessSummary.js";
10
+ import { StatsCard as M, ActivityFeedCard as R, SignInsCard as V, JourneyCard as W } from "./PersonActivity.js";
11
+ import { ForceReloadCard as B, SignOutEverywhereCard as H, MergeCard as J, OffboardingCard as q } from "./PersonAdminTools.js";
12
+ import { PersonAiMemoryCard as z } from "./PersonAiMemory.js";
13
+ import { CompareAccessCard as G } from "./PersonCompare.js";
14
+ import { WorkingOnCard as K, TeamLoadCard as Q, WhyCard as X } from "./PersonExtras.js";
15
+ import { PersonHeader as Y } from "./PersonHeader.js";
16
+ import { AboutCard as Z, PeopleCard as $, AvailabilityCard as ee, ResponsibilitiesCard as re } from "./PersonOverview.js";
17
+ import { PersonWeekCard as ae } from "./PersonWeek.js";
18
+ import { usePersonProfile as de, useInvalidatePerson as se } from "./types.js";
19
+ function we({
20
20
  userId: i,
21
21
  className: n,
22
22
  initialTab: f = "overview"
23
23
  }) {
24
- var v, u, g;
25
- const t = _(), s = !!(t != null && t.isAdmin), { data: e, isLoading: h, isError: x } = ae(i), y = de(i), [N, C] = b(f), [c, k] = b("feed");
26
- if (h || !e && !x) return /* @__PURE__ */ r(se, { className: n });
24
+ var p, u, g;
25
+ const t = _(), s = !!(t != null && t.isAdmin), { data: e, isLoading: h, isError: x } = de(i), y = se(i), [N, C] = b(f), [c, k] = b("feed");
26
+ if (h || !e && !x) return /* @__PURE__ */ r(te, { className: n });
27
27
  if (!e)
28
28
  return /* @__PURE__ */ a(
29
29
  "div",
@@ -39,19 +39,19 @@ function ke({
39
39
  ]
40
40
  }
41
41
  );
42
- const w = !!(t != null && t.userId) && !!((v = e.manager) != null && v.id) && String(e.manager.id).toUpperCase() === String(t.userId).toUpperCase(), p = /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
42
+ const w = !!(t != null && t.userId) && !!((p = e.manager) != null && p.id) && String(e.manager.id).toUpperCase() === String(t.userId).toUpperCase(), v = /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
43
43
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
44
- /* @__PURE__ */ r(Y, { profile: e, isAdmin: s }),
45
- /* @__PURE__ */ r(G, { profile: e }),
44
+ /* @__PURE__ */ r(Z, { profile: e, isAdmin: s }),
45
+ /* @__PURE__ */ r(K, { profile: e }),
46
46
  e.direct_reports.length > 0 && /* @__PURE__ */ r(
47
- K,
47
+ Q,
48
48
  {
49
49
  userId: e.id,
50
50
  firstName: e.first_name ?? e.name,
51
51
  expectedRows: e.direct_reports.length
52
52
  }
53
53
  ),
54
- /* @__PURE__ */ r(Z, { profile: e })
54
+ /* @__PURE__ */ r($, { profile: e })
55
55
  ] }),
56
56
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
57
57
  s ? /* @__PURE__ */ r(
@@ -74,13 +74,13 @@ function ke({
74
74
  coversFor: e.covers_for,
75
75
  onSaved: y
76
76
  }
77
- ) : /* @__PURE__ */ r($, { profile: e }),
78
- /* @__PURE__ */ r(ee, { profile: e, isAdmin: s }),
79
- (s || w) && /* @__PURE__ */ r(re, { profile: e })
77
+ ) : /* @__PURE__ */ r(ee, { profile: e }),
78
+ /* @__PURE__ */ r(re, { profile: e, isAdmin: s }),
79
+ (s || w) && /* @__PURE__ */ r(ae, { profile: e })
80
80
  ] })
81
81
  ] });
82
82
  return /* @__PURE__ */ a("div", { className: l("flex flex-col gap-4", n), "data-nvr-person": e.id, children: [
83
- /* @__PURE__ */ r(X, { profile: e, isAdmin: s }),
83
+ /* @__PURE__ */ r(Y, { profile: e, isAdmin: s }),
84
84
  s && /* @__PURE__ */ r(U, { profile: e }),
85
85
  s ? /* @__PURE__ */ a(A, { value: N, onValueChange: (d) => C(d), children: [
86
86
  /* @__PURE__ */ r(
@@ -105,19 +105,19 @@ function ke({
105
105
  ))
106
106
  }
107
107
  ),
108
- /* @__PURE__ */ r(o, { value: "overview", className: "mt-4 focus-visible:outline-none", children: p }),
108
+ /* @__PURE__ */ r(o, { value: "overview", className: "mt-4 focus-visible:outline-none", children: v }),
109
109
  /* @__PURE__ */ r(o, { value: "access", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
110
110
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
111
111
  /* @__PURE__ */ r(D, { profile: e }),
112
- /* @__PURE__ */ r(O, { userId: e.id }),
112
+ /* @__PURE__ */ r(L, { userId: e.id }),
113
113
  /* @__PURE__ */ r(F, { userId: e.id }),
114
- /* @__PURE__ */ r(Q, { profile: e }),
115
- /* @__PURE__ */ r(z, { profile: e })
114
+ /* @__PURE__ */ r(X, { profile: e }),
115
+ /* @__PURE__ */ r(G, { profile: e })
116
116
  ] }),
117
117
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
118
- /* @__PURE__ */ r(j, { profile: e }),
119
- /* @__PURE__ */ r(L, { userId: e.id }),
120
- /* @__PURE__ */ r(M, { profile: e })
118
+ /* @__PURE__ */ r(O, { profile: e }),
119
+ /* @__PURE__ */ r(j, { userId: e.id }),
120
+ /* @__PURE__ */ r(E, { profile: e })
121
121
  ] })
122
122
  ] }) }),
123
123
  /* @__PURE__ */ a(o, { value: "activity", className: "mt-4 focus-visible:outline-none", children: [
@@ -151,29 +151,30 @@ function ke({
151
151
  ),
152
152
  c === "day" && s ? /* @__PURE__ */ r(T, { userId: e.id }) : /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
153
153
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
154
- /* @__PURE__ */ r(R, { userId: e.id }),
155
- /* @__PURE__ */ r(V, { userId: e.id })
154
+ /* @__PURE__ */ r(M, { userId: e.id }),
155
+ /* @__PURE__ */ r(R, { userId: e.id })
156
156
  ] }),
157
157
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
158
- /* @__PURE__ */ r(W, { profile: e }),
159
- /* @__PURE__ */ r(E, { userId: e.id })
158
+ /* @__PURE__ */ r(V, { profile: e }),
159
+ /* @__PURE__ */ r(W, { userId: e.id })
160
160
  ] })
161
161
  ] })
162
162
  ] }),
163
163
  /* @__PURE__ */ r(o, { value: "tools", className: "mt-4 focus-visible:outline-none", children: /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
164
164
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
165
165
  /* @__PURE__ */ r(B, { profile: e }),
166
- /* @__PURE__ */ r(H, { profile: e })
166
+ /* @__PURE__ */ r(H, { profile: e }),
167
+ /* @__PURE__ */ r(J, { profile: e })
167
168
  ] }),
168
169
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
169
- /* @__PURE__ */ r(J, { profile: e }),
170
- /* @__PURE__ */ r(q, { profile: e })
170
+ /* @__PURE__ */ r(q, { profile: e }),
171
+ /* @__PURE__ */ r(z, { profile: e })
171
172
  ] })
172
173
  ] }) })
173
- ] }) : p
174
+ ] }) : v
174
175
  ] });
175
176
  }
176
- function se({ className: i }) {
177
+ function te({ className: i }) {
177
178
  return /* @__PURE__ */ a("div", { className: l("flex animate-pulse flex-col gap-4", i), "aria-busy": "true", children: [
178
179
  /* @__PURE__ */ a("div", { className: "flex items-center gap-5 rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
179
180
  /* @__PURE__ */ r("div", { className: "h-[76px] w-[76px] rounded-full bg-slate-100 dark:bg-muted" }),
@@ -190,5 +191,5 @@ function se({ className: i }) {
190
191
  ] });
191
192
  }
192
193
  export {
193
- ke as PersonProfile
194
+ we as PersonProfile
194
195
  };
@@ -0,0 +1,52 @@
1
+ import { useMutation as i } from "@tanstack/react-query";
2
+ import { toast as s } from "sonner";
3
+ import { useOptionalNivaroClient as u } from "../../context.js";
4
+ import { post as c } from "../../lib/commands.js";
5
+ import { errorText as d } from "./types.js";
6
+ function h(e) {
7
+ const o = e.remembered ? ` Tabs that connect in the next ${e.remember_hours ?? 24} h reload too.` : "";
8
+ return (e.sockets > 0 ? `Reload pushed to ${e.sockets} open tab${e.sockets === 1 ? "" : "s"}${e.partial ? " (another server did not answer — there may be more)" : ""}.` : e.partial ? "Reload sent — another server did not answer, so their open tabs could not be counted." : e.nodes != null ? "Reload sent — they have no tab open right now." : "Reload sent to every tab they have open (tabs on other servers are not counted).") + o;
9
+ }
10
+ function l(e, o) {
11
+ return o > 0 ? `${e} is signed out of ${o} session${o === 1 ? "" : "s"} — every open tab goes back to sign-in.` : `${e} had no session open.`;
12
+ }
13
+ function $(e, o = {}) {
14
+ const r = u();
15
+ return i({
16
+ mutationFn: (n = {}) => {
17
+ if (!r) throw new Error("Not connected");
18
+ return r.request(
19
+ c("/realtime/force-refresh", {
20
+ user_ids: [e],
21
+ seconds: n.seconds ?? 15,
22
+ message: n.message ?? ""
23
+ })
24
+ ).then((t) => t.data);
25
+ },
26
+ onSuccess: (n) => {
27
+ var t;
28
+ s.success(h(n)), (t = o.onDone) == null || t.call(o);
29
+ },
30
+ onError: (n) => s.error(d(n, "Failed to push the reload"))
31
+ });
32
+ }
33
+ function w(e, o, r = {}) {
34
+ const n = u();
35
+ return i({
36
+ mutationFn: () => {
37
+ if (!n) throw new Error("Not connected");
38
+ return n.request(c(`/security/users/${e}/sign-out`)).then((t) => t.data);
39
+ },
40
+ onSuccess: (t) => {
41
+ var a;
42
+ s.success(l(o, t.revoked)), (a = r.onDone) == null || a.call(r);
43
+ },
44
+ onError: (t) => s.error(d(t, "Could not sign them out"))
45
+ });
46
+ }
47
+ export {
48
+ h as reloadPushedText,
49
+ l as signedOutText,
50
+ $ as useReloadTheirTabs,
51
+ w as useSignOutEverywhere
52
+ };
@@ -1,55 +1,55 @@
1
- import { jsxs as g, jsx as s, Fragment as q } from "react/jsx-runtime";
1
+ import { jsxs as g, jsx as s, Fragment as f } from "react/jsx-runtime";
2
2
  import { useQuery as S } from "@tanstack/react-query";
3
- import { useState as h, useEffect as v, useMemo as C } from "react";
3
+ import { useState as d, useEffect as C, useMemo as N } from "react";
4
4
  import { MultiPick as x } from "../CollectionBrowserView.js";
5
- const k = (t) => Array.isArray(t) ? t : t ? [t] : [];
6
- function N({
5
+ const b = (t) => Array.isArray(t) ? t : t ? [t] : [];
6
+ function O({
7
7
  def: t,
8
- selected: o,
9
- onChange: y,
10
- badge: m
8
+ selected: a,
9
+ onChange: k,
10
+ badge: p
11
11
  }) {
12
- const [d, i] = h(!1), [p, c] = h(""), l = t.loadOptions, { data: u = [], isLoading: e } = S({
13
- queryKey: ["queue-quick-facet", t.key, p],
14
- queryFn: () => l ? l(p) : Promise.resolve([]),
15
- enabled: !!l && (d || o.length > 0),
12
+ const [h, i] = d(!1), [y, c] = d(""), l = t.loadOptions, { data: u = [], isLoading: e } = S({
13
+ queryKey: ["queue-quick-facet", t.key, y],
14
+ queryFn: () => l ? l(y) : Promise.resolve([]),
15
+ enabled: !!l && (h || a.length > 0),
16
16
  staleTime: 6e4
17
- }), r = C(() => {
18
- const a = new Set(u.map((n) => n.value));
19
- return [...u, ...o.filter((n) => !a.has(n)).map((n) => ({ label: n, value: n }))];
20
- }, [u, o]);
17
+ }), r = N(() => {
18
+ const o = new Set(u.map((n) => n.value));
19
+ return [...u, ...a.filter((n) => !o.has(n)).map((n) => ({ label: n, value: n }))];
20
+ }, [u, a]);
21
21
  return /* @__PURE__ */ s(
22
22
  x,
23
23
  {
24
24
  label: t.placeholder,
25
25
  options: r,
26
- selected: o,
27
- onChange: (a) => y(a.map(String)),
26
+ selected: a,
27
+ onChange: (o) => k(o.map(String)),
28
28
  loading: e,
29
- badge: m,
29
+ badge: p,
30
30
  onSearch: c,
31
- onOpenChange: (a) => {
32
- a && i(!0);
31
+ onOpenChange: (o) => {
32
+ o && i(!0);
33
33
  }
34
34
  }
35
35
  );
36
36
  }
37
37
  function Q({
38
38
  defs: t,
39
- values: o,
40
- seededKeys: y,
41
- onApply: m,
42
- onClear: d,
39
+ values: a,
40
+ seededKeys: k,
41
+ onApply: p,
42
+ onClear: h,
43
43
  right: i
44
44
  }) {
45
- const p = JSON.stringify(t.map((e) => [e.key, k(o[e.key])])), [c, l] = h({});
46
- v(() => {
45
+ const y = JSON.stringify(t.map((e) => [e.key, b(a[e.key])])), [c, l] = d({});
46
+ C(() => {
47
47
  const e = {};
48
- for (const r of t) e[r.key] = k(o[r.key]);
48
+ for (const r of t) e[r.key] = b(a[r.key]);
49
49
  l(e);
50
- }, [p]);
50
+ }, [y]);
51
51
  const u = t.some(
52
- (e) => JSON.stringify(c[e.key] ?? []) !== JSON.stringify(k(o[e.key]))
52
+ (e) => JSON.stringify(c[e.key] ?? []) !== JSON.stringify(b(a[e.key]))
53
53
  );
54
54
  return t.length === 0 && !i ? null : /* @__PURE__ */ g(
55
55
  "div",
@@ -58,28 +58,30 @@ function Q({
58
58
  "data-queue-quick-filters": !0,
59
59
  children: [
60
60
  t.map((e) => {
61
- const r = c[e.key] ?? [], a = e.restricted ? {
61
+ const r = c[e.key] ?? [], o = e.restricted ? {
62
62
  label: "restricted",
63
63
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
64
64
  title: `Options limited to your restricted ${e.placeholder} scope`
65
- } : y.has(e.key) && r.length > 0 ? {
66
- label: "default",
65
+ } : k.has(e.key) && r.length > 0 ? {
66
+ label: "your default",
67
67
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
68
68
  title: `Pre-selected from your default ${e.placeholder} scope — adjust freely`
69
- } : null, n = (b) => l((f) => ({ ...f, [e.key]: b }));
70
- return e.loadOptions ? /* @__PURE__ */ s(N, { def: e, selected: r, onChange: n, badge: a }, e.key) : /* @__PURE__ */ s(
69
+ } : null, n = (m) => {
70
+ l((q) => ({ ...q, [e.key]: m })), m.length === 0 && b(a[e.key]).length > 0 && p({ [e.key]: e.multi || e.type === "combobox" ? [] : "" });
71
+ };
72
+ return e.loadOptions ? /* @__PURE__ */ s(O, { def: e, selected: r, onChange: n, badge: o }, e.key) : /* @__PURE__ */ s(
71
73
  x,
72
74
  {
73
75
  label: e.placeholder,
74
76
  options: e.options ?? [],
75
77
  selected: r,
76
- onChange: (b) => n(b.map(String)),
77
- badge: a
78
+ onChange: (m) => n(m.map(String)),
79
+ badge: o
78
80
  },
79
81
  e.key
80
82
  );
81
83
  }),
82
- t.length > 0 && /* @__PURE__ */ g(q, { children: [
84
+ t.length > 0 && /* @__PURE__ */ g(f, { children: [
83
85
  /* @__PURE__ */ s(
84
86
  "button",
85
87
  {
@@ -87,10 +89,10 @@ function Q({
87
89
  onClick: () => {
88
90
  const e = {};
89
91
  for (const r of t) {
90
- const a = c[r.key] ?? [];
91
- e[r.key] = r.multi || r.type === "combobox" ? a : a[0] ?? "";
92
+ const o = c[r.key] ?? [];
93
+ e[r.key] = r.multi || r.type === "combobox" ? o : o[0] ?? "";
92
94
  }
93
- m(e);
95
+ p(e);
94
96
  },
95
97
  className: `h-6 rounded px-2.5 text-[11px] font-semibold text-white transition-[filter] hover:brightness-110 ${u ? "bg-nvr-cyan" : "bg-nvr-cyan opacity-60"}`,
96
98
  "data-queue-quick-apply": !0,
@@ -101,7 +103,7 @@ function Q({
101
103
  "button",
102
104
  {
103
105
  type: "button",
104
- onClick: d,
106
+ onClick: h,
105
107
  className: "h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
106
108
  "data-queue-quick-clear": !0,
107
109
  children: "Clear"