@nivaro/react 0.3.48 → 0.3.49

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/shared/components/CellCopyLayer.js +81 -44
  4. package/dist/shared/components/CollectionBrowserView.js +306 -297
  5. package/dist/shared/components/DataTable.js +3 -3
  6. package/dist/shared/components/FulfilmentPill.js +98 -78
  7. package/dist/shared/components/ItemEditForm.js +2830 -2815
  8. package/dist/shared/components/NotificationSourcesCard.js +151 -147
  9. package/dist/shared/components/ProfileView.js +72 -70
  10. package/dist/shared/components/QueryTable.js +3 -3
  11. package/dist/shared/components/imports/ImportConsole.js +4 -4
  12. package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
  13. package/dist/shared/components/item-edit/HeaderTools.js +118 -113
  14. package/dist/shared/components/item-edit/InlineTableField.js +874 -868
  15. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
  16. package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
  17. package/dist/shared/components/notifications/DeliveryChips.js +9 -9
  18. package/dist/shared/components/panels/PipelinePanel.js +73 -71
  19. package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
  20. package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
  21. package/dist/shared/components/profile/PersonProfile.js +23 -21
  22. package/dist/shared/components/profile/SignedInDevices.js +126 -0
  23. package/dist/shared/components/queue/QueueItemSheet.js +38 -37
  24. package/dist/shared/components/support/SupportView.js +1 -1
  25. package/dist/shared/lib/edit-lock-fields.js +7 -0
  26. package/dist/shared/lib/reimport-visibility.js +10 -0
  27. package/package.json +1 -1
@@ -722,13 +722,13 @@ function er({
722
722
  re && "flex h-full min-h-0 flex-col"
723
723
  ),
724
724
  children: [
725
- Xe && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-slate-100 px-3 py-2.5", children: [
726
- X !== void 0 && /* @__PURE__ */ s("div", { className: "relative", children: [
725
+ Xe && /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-2 border-b border-slate-100 px-3 py-2.5", children: [
726
+ X !== void 0 && /* @__PURE__ */ s("div", { className: "relative min-w-0 max-w-full", children: [
727
727
  /* @__PURE__ */ e(Ge, { className: "absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
728
728
  /* @__PURE__ */ e(
729
729
  j,
730
730
  {
731
- className: "h-8 w-56 border-slate-200 bg-slate-50 pl-8 text-[13px]",
731
+ className: "h-8 w-56 max-w-full border-slate-200 bg-slate-50 pl-8 text-[13px]",
732
732
  placeholder: Z,
733
733
  value: v ?? "",
734
734
  onChange: (t) => X(t.target.value)
@@ -1,70 +1,87 @@
1
- import { jsx as l, jsxs as s } from "react/jsx-runtime";
2
- import { useQuery as q } from "@tanstack/react-query";
3
- import { useState as v, useRef as _, useLayoutEffect as I } from "react";
4
- import { createPortal as z } from "react-dom";
5
- import { useNivaroClient as B } from "../context.js";
6
- import { get as D } from "../lib/commands.js";
7
- import { cn as N, formatRelative as H } from "../lib/utils.js";
8
- function A(r, m) {
9
- const t = Number(r ?? 0) || 0, i = Number(m ?? 0) || 0;
1
+ import { jsx as d, jsxs as c } from "react/jsx-runtime";
2
+ import { useQueryClient as z, useQuery as B } from "@tanstack/react-query";
3
+ import { useState as k, useRef as D, useLayoutEffect as H, useEffect as O } from "react";
4
+ import { createPortal as U } from "react-dom";
5
+ import { useNivaroClient as K } from "../context.js";
6
+ import { get as W } from "../lib/commands.js";
7
+ import { cn as L, formatRelative as Y, formatDateTime as A } from "../lib/utils.js";
8
+ import { provideCopyText as G } from "./CellCopyLayer.js";
9
+ function ae(n, s) {
10
+ const t = Number(n ?? 0) || 0, r = Number(s ?? 0) || 0;
10
11
  return {
11
12
  shipped: t,
12
- requested: i,
13
- status: t > 0 ? i > 0 && t >= i ? "complete" : "partial" : "none"
13
+ requested: r,
14
+ status: t > 0 ? r > 0 && t >= r ? "complete" : "partial" : "none"
14
15
  };
15
16
  }
16
- const G = [
17
+ const se = [
17
18
  { value: "none", label: "Not shipped" },
18
19
  { value: "partial", label: "Partially shipped" },
19
20
  { value: "complete", label: "Shipped" }
20
21
  ];
21
- function J({
22
- collection: r,
23
- itemId: m,
22
+ function J(n, s, t) {
23
+ const r = [n, "", `${s ? `${s} · ` : ""}Latest events`];
24
+ t.length === 0 && r.push("No events recorded yet.");
25
+ for (const l of t)
26
+ r.push("", `${l.context ?? l.label} · ${A(l.created_at)}`), l.text && r.push(l.text);
27
+ return r.join(`
28
+ `);
29
+ }
30
+ function le({
31
+ collection: n,
32
+ itemId: s,
24
33
  figures: t,
25
- label: i,
26
- className: C
34
+ label: r,
35
+ className: l
27
36
  }) {
28
- const R = B(), [p, n] = v(!1), k = _(null), [y, b] = v(null), [L, T] = v(null), f = p && !!t && t.status !== "none";
29
- I(() => {
37
+ const I = K(), [$, i] = k(!1), h = D(null), [E, v] = k(null), [C, j] = k(null), f = $ && !!t && t.status !== "none";
38
+ H(() => {
30
39
  if (!f) {
31
- b(null);
40
+ v(null);
32
41
  return;
33
42
  }
34
43
  const e = () => {
35
- const a = k.current;
36
- if (!a) return;
37
- const o = a.getBoundingClientRect(), w = a.closest('[role="dialog"]') ?? document.body;
38
- T(w);
39
- const F = window.innerHeight - o.bottom < 220 && o.top > window.innerHeight - o.bottom, S = Math.max(8, Math.min(o.left, window.innerWidth - 328)), M = F ? o.top - 4 : o.bottom + 4, P = {
44
+ const o = h.current;
45
+ if (!o) return;
46
+ const a = o.getBoundingClientRect(), N = o.closest('[role="dialog"]') ?? document.body;
47
+ j(N);
48
+ const M = window.innerHeight - a.bottom < 220 && a.top > window.innerHeight - a.bottom, P = Math.max(8, Math.min(a.left, window.innerWidth - 328)), R = M ? a.top - 4 : a.bottom + 4, _ = {
40
49
  zIndex: 120,
41
- ...F ? { transform: "translateY(-100%)" } : {}
50
+ ...M ? { transform: "translateY(-100%)" } : {}
42
51
  };
43
- if (w === document.body)
44
- b({ position: "fixed", left: S, top: M, ...P });
52
+ if (N === document.body)
53
+ v({ position: "fixed", left: P, top: R, ..._ });
45
54
  else {
46
- const $ = w.getBoundingClientRect();
47
- b({ position: "absolute", left: S - $.left, top: M - $.top, ...P });
55
+ const Q = N.getBoundingClientRect();
56
+ v({ position: "absolute", left: P - Q.left, top: R - Q.top, ..._ });
48
57
  }
49
58
  };
50
59
  return e(), window.addEventListener("scroll", e, !0), window.addEventListener("resize", e), () => {
51
60
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", e);
52
61
  };
53
62
  }, [f]);
54
- const { data: x } = q({
55
- queryKey: ["fulfilment-events", r, m],
56
- queryFn: () => R.request(D("/comments/related", { collection: r, item: m })).then((e) => (e.data ?? []).filter((a) => a.source === "external")).then(
57
- (e) => e.sort((a, o) => new Date(o.created_at).getTime() - new Date(a.created_at).getTime()).slice(0, 3)
63
+ const T = z(), y = {
64
+ queryKey: ["fulfilment-events", n, s],
65
+ queryFn: () => I.request(W("/comments/related", { collection: n, item: s })).then((e) => (e.data ?? []).filter((o) => o.source === "external")).then(
66
+ (e) => e.sort((o, a) => new Date(a.created_at).getTime() - new Date(o.created_at).getTime()).slice(0, 3)
58
67
  ).catch(() => []),
59
- enabled: p && !!t && t.status !== "none",
60
68
  staleTime: 6e4
61
- });
62
- if (!t) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
63
- const { shipped: E, requested: d, status: c } = t, h = c === "complete" ? {
69
+ }, { data: w } = B({ ...y, enabled: f }), m = (t == null ? void 0 : t.status) ?? "none", p = m === "complete" ? "Shipped" : m === "partial" ? "Partial" : "Not shipped", q = t ? t.requested > 0 ? `${u(t.shipped)} / ${u(t.requested)} · ${p}` : p : "", F = D({ queryClient: T, eventsQuery: y, pillText: q, label: r });
70
+ F.current = { queryClient: T, eventsQuery: y, pillText: q, label: r };
71
+ const x = m !== "none";
72
+ if (O(() => {
73
+ const e = h.current;
74
+ if (!(!e || !x))
75
+ return G(e, async () => {
76
+ const o = F.current, a = await o.queryClient.fetchQuery(o.eventsQuery);
77
+ return J(o.pillText, o.label, a);
78
+ });
79
+ }, [x]), !t) return /* @__PURE__ */ d("span", { className: "text-slate-300", children: "—" });
80
+ const { shipped: S, requested: b } = t, g = m === "complete" ? {
64
81
  dot: "bg-emerald-500",
65
82
  text: "text-emerald-700 dark:text-emerald-300",
66
83
  box: "border-emerald-200 bg-emerald-50/70 dark:border-emerald-900/40 dark:bg-emerald-900/10"
67
- } : c === "partial" ? {
84
+ } : m === "partial" ? {
68
85
  dot: "bg-amber-500",
69
86
  text: "text-amber-700 dark:text-amber-300",
70
87
  box: "border-amber-200 bg-amber-50/70 dark:border-amber-900/40 dark:bg-amber-900/10"
@@ -72,80 +89,83 @@ function J({
72
89
  dot: "bg-slate-300 dark:bg-slate-600",
73
90
  text: "text-slate-500 dark:text-slate-400",
74
91
  box: "border-slate-200 bg-slate-50 dark:border-border dark:bg-muted"
75
- }, g = c === "complete" ? "Shipped" : c === "partial" ? "Partial" : "Not shipped";
76
- return /* @__PURE__ */ s(
92
+ };
93
+ return /* @__PURE__ */ c(
77
94
  "button",
78
95
  {
79
- ref: k,
96
+ ref: h,
80
97
  type: "button",
81
- className: N("relative inline-flex cursor-default", C),
82
- onMouseEnter: () => n(!0),
83
- onMouseLeave: () => n(!1),
84
- onFocus: () => n(!0),
85
- onBlur: () => n(!1),
98
+ className: L("relative inline-flex cursor-default", l),
99
+ onMouseEnter: () => i(!0),
100
+ onMouseLeave: () => i(!1),
101
+ onFocus: () => i(!0),
102
+ onBlur: () => i(!1),
86
103
  onClick: (e) => {
87
- e.stopPropagation(), n((a) => !a);
104
+ e.stopPropagation(), i((o) => !o);
88
105
  },
89
- "aria-label": `${g}${d > 0 ? ` — ${u(E)} of ${u(d)}` : ""}`,
90
- "data-fulfilment": c,
91
- "data-fulfilment-open": p ? "true" : void 0,
106
+ "aria-label": `${p}${b > 0 ? ` — ${u(S)} of ${u(b)}` : ""}`,
107
+ "data-fulfilment": m,
108
+ "data-fulfilment-open": $ ? "true" : void 0,
109
+ "data-copy-source": x ? "" : void 0,
110
+ "data-copy-label": x ? "Copy with latest events" : void 0,
92
111
  children: [
93
- /* @__PURE__ */ s(
112
+ /* @__PURE__ */ c(
94
113
  "span",
95
114
  {
96
- className: N(
115
+ className: L(
97
116
  "inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-medium tabular-nums",
98
- h.box,
99
- h.text
117
+ g.box,
118
+ g.text
100
119
  ),
101
120
  children: [
102
- /* @__PURE__ */ l("span", { "aria-hidden": !0, className: N("h-1.5 w-1.5 shrink-0 rounded-full", h.dot) }),
103
- d > 0 ? `${u(E)} / ${u(d)}` : g,
104
- d > 0 && /* @__PURE__ */ s("span", { className: "opacity-70", children: [
121
+ /* @__PURE__ */ d("span", { "aria-hidden": !0, className: L("h-1.5 w-1.5 shrink-0 rounded-full", g.dot) }),
122
+ b > 0 ? `${u(S)} / ${u(b)}` : p,
123
+ b > 0 && /* @__PURE__ */ c("span", { className: "opacity-70", children: [
105
124
  "· ",
106
- g
125
+ p
107
126
  ] })
108
127
  ]
109
128
  }
110
129
  ),
111
- f && y && L && z(
112
- /* @__PURE__ */ s(
130
+ f && E && C && U(
131
+ /* @__PURE__ */ c(
113
132
  "span",
114
133
  {
115
134
  role: "tooltip",
116
- style: y,
135
+ style: E,
117
136
  className: "block w-[320px] rounded-md border border-slate-200 bg-white p-2 text-left text-[11px] shadow-lg dark:border-border dark:bg-popover",
118
137
  "data-fulfilment-events": !0,
119
138
  "data-no-copy": !0,
120
- onMouseEnter: () => n(!0),
121
- onMouseLeave: () => n(!1),
139
+ onMouseEnter: () => i(!0),
140
+ onMouseLeave: () => i(!1),
122
141
  children: [
123
- /* @__PURE__ */ s("span", { className: "block text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: [
124
- i ? `${i} · ` : "",
142
+ /* @__PURE__ */ c("span", { className: "block text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: [
143
+ r ? `${r} · ` : "",
125
144
  "latest events"
126
145
  ] }),
127
- x ? x.length === 0 ? /* @__PURE__ */ l("span", { className: "mt-1 block text-slate-400", children: "No events recorded yet." }) : /* @__PURE__ */ l("ul", { className: "mt-1 space-y-1", children: x.map((e) => /* @__PURE__ */ s("li", { className: "leading-snug", children: [
128
- /* @__PURE__ */ l("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: e.context ?? e.label }),
129
- /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
146
+ w ? w.length === 0 ? /* @__PURE__ */ d("span", { className: "mt-1 block text-slate-400", children: "No events recorded yet." }) : /* @__PURE__ */ d("ul", { className: "mt-1 space-y-1", children: w.map((e) => /* @__PURE__ */ c("li", { className: "leading-snug", children: [
147
+ /* @__PURE__ */ d("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: e.context ?? e.label }),
148
+ /* @__PURE__ */ c("span", { className: "text-slate-400", children: [
130
149
  " · ",
131
- H(e.created_at)
150
+ Y(e.created_at)
132
151
  ] }),
133
- /* @__PURE__ */ l("span", { className: "line-clamp-2 block whitespace-normal text-slate-500 dark:text-slate-400", children: e.text })
134
- ] }, e.id)) }) : /* @__PURE__ */ l("span", { className: "mt-1 block text-slate-400", children: "Loading…" })
152
+ /* @__PURE__ */ d("span", { className: "line-clamp-2 block whitespace-normal text-slate-500 dark:text-slate-400", children: e.text })
153
+ ] }, e.id)) }) : /* @__PURE__ */ d("span", { className: "mt-1 block text-slate-400", children: "Loading…" })
135
154
  ]
136
155
  }
137
156
  ),
138
- L
157
+ C
139
158
  )
140
159
  ]
141
160
  }
142
161
  );
143
162
  }
144
- function u(r) {
145
- return Number.isInteger(r) ? r.toLocaleString() : r.toLocaleString(void 0, { maximumFractionDigits: 2 });
163
+ function u(n) {
164
+ return Number.isInteger(n) ? n.toLocaleString() : n.toLocaleString(void 0, { maximumFractionDigits: 2 });
146
165
  }
147
166
  export {
148
- G as FULFILMENT_FILTER_OPTIONS,
149
- J as FulfilmentPill,
150
- A as fulfilmentFigures
167
+ se as FULFILMENT_FILTER_OPTIONS,
168
+ le as FulfilmentPill,
169
+ J as fulfilmentCopyText,
170
+ ae as fulfilmentFigures
151
171
  };