@nivaro/react 0.3.117 → 0.3.119
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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +136 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3757 -3695
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4451 -4385
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +135 -94
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +88 -85
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +245 -141
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +15 -16
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/addendum-view.js +6 -0
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +151 -130
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,75 +1,77 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { QueryClientContext as
|
|
3
|
-
import { Check as g, RotateCw as
|
|
4
|
-
import { useContext as
|
|
5
|
-
import { useLivePreference as
|
|
6
|
-
import { registerPageRefreshButton as
|
|
7
|
-
import { cn as
|
|
1
|
+
import { jsxs as h, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClientContext as b } from "@tanstack/react-query";
|
|
3
|
+
import { Check as g, RotateCw as x } from "lucide-react";
|
|
4
|
+
import { useContext as v, useEffect as c } from "react";
|
|
5
|
+
import { useLivePreference as w } from "../lib/live-preference.js";
|
|
6
|
+
import { registerPageRefreshButton as k, usePageRefreshButtonShown as R, useScreenRefreshState as y, refreshScreenData as C, screenRefreshClient as N, setScreenRefreshClient as S } from "../lib/screen-refresh.js";
|
|
7
|
+
import { cn as s } from "../lib/utils.js";
|
|
8
8
|
import { LiveOffNote as u } from "./LiveOffNote.js";
|
|
9
9
|
function E({
|
|
10
10
|
variant: e = "header",
|
|
11
|
-
className:
|
|
11
|
+
className: m
|
|
12
12
|
}) {
|
|
13
|
-
const a =
|
|
14
|
-
|
|
15
|
-
a && !
|
|
13
|
+
const a = v(b);
|
|
14
|
+
c(() => {
|
|
15
|
+
a && !N() && S(a);
|
|
16
16
|
}, [a]);
|
|
17
17
|
const n = e === "header";
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
if (!n &&
|
|
21
|
-
const
|
|
18
|
+
c(() => n ? k() : void 0, [n]);
|
|
19
|
+
const p = R(), { phase: r, failed: i = 0 } = y(), o = r === "running", { off: d } = w(), f = d && r !== "running" && r !== "partial" ? "Live updates are off. Refresh this page’s data (keeps your edits and place)" : r === "running" ? "Refreshing this page’s data…" : r === "partial" ? `${i > 1 ? `${i} parts` : "One part"} of this page did not refresh — ${i > 1 ? "each shows" : "it shows"} its own error. Refresh again` : "Refresh this page’s data (keeps your edits and place)";
|
|
20
|
+
if (!n && p) return null;
|
|
21
|
+
const l = /* @__PURE__ */ h(
|
|
22
22
|
"button",
|
|
23
23
|
{
|
|
24
24
|
type: "button",
|
|
25
25
|
"aria-label": f,
|
|
26
26
|
"data-tip": f,
|
|
27
|
-
"data-screen-refresh":
|
|
28
|
-
"aria-busy":
|
|
27
|
+
"data-screen-refresh": r,
|
|
28
|
+
"aria-busy": o || void 0,
|
|
29
29
|
onClick: () => {
|
|
30
|
-
|
|
30
|
+
o || C({ reason: "button", qc: a ?? void 0 });
|
|
31
31
|
},
|
|
32
|
-
className:
|
|
32
|
+
className: s(
|
|
33
33
|
"relative inline-flex shrink-0 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
34
34
|
e === "rail" && "h-8 w-8 text-slate-400 hover:bg-white/[0.05] hover:text-white focus-visible:ring-offset-0",
|
|
35
|
-
|
|
35
|
+
// A toolbar control like its bordered neighbours (a bare glyph read as stray), with an
|
|
36
|
+
// invisible 44 px hit area for touch.
|
|
37
|
+
e === "header" && "h-9 w-9 border border-slate-200 bg-white text-slate-500 shadow-sm hover:bg-slate-50 hover:text-slate-800 after:absolute after:-inset-1 after:content-[''] dark:border-border dark:bg-card dark:text-slate-300 dark:hover:bg-muted dark:hover:text-foreground",
|
|
36
38
|
e === "bar" && "h-8 w-8 opacity-80 hover:opacity-100",
|
|
37
|
-
|
|
39
|
+
m
|
|
38
40
|
),
|
|
39
41
|
children: [
|
|
40
|
-
|
|
42
|
+
r === "done" ? /* @__PURE__ */ t(
|
|
41
43
|
g,
|
|
42
44
|
{
|
|
43
45
|
"aria-hidden": !0,
|
|
44
|
-
className:
|
|
46
|
+
className: s(
|
|
45
47
|
"h-[15px] w-[15px] motion-safe:animate-in motion-safe:fade-in",
|
|
46
48
|
e === "rail" ? "text-emerald-400" : "text-emerald-600 dark:text-emerald-400"
|
|
47
49
|
)
|
|
48
50
|
}
|
|
49
|
-
) : /* @__PURE__ */
|
|
50
|
-
|
|
51
|
+
) : /* @__PURE__ */ t(
|
|
52
|
+
x,
|
|
51
53
|
{
|
|
52
54
|
"aria-hidden": !0,
|
|
53
|
-
className:
|
|
55
|
+
className: s(
|
|
54
56
|
"h-[15px] w-[15px]",
|
|
55
|
-
|
|
57
|
+
o && "animate-spin [animation-duration:900ms] motion-reduce:animate-none"
|
|
56
58
|
)
|
|
57
59
|
}
|
|
58
60
|
),
|
|
59
|
-
|
|
61
|
+
r === "partial" && /* @__PURE__ */ t(
|
|
60
62
|
"span",
|
|
61
63
|
{
|
|
62
64
|
"aria-hidden": !0,
|
|
63
65
|
className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 dark:bg-amber-400"
|
|
64
66
|
}
|
|
65
67
|
),
|
|
66
|
-
e === "rail" && /* @__PURE__ */
|
|
68
|
+
e === "rail" && /* @__PURE__ */ t(u, { variant: "dot" })
|
|
67
69
|
]
|
|
68
70
|
}
|
|
69
71
|
);
|
|
70
|
-
return !
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
72
|
+
return !d || e === "rail" ? l : /* @__PURE__ */ h("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
73
|
+
/* @__PURE__ */ t(u, { variant: e === "bar" ? "bar" : "header" }),
|
|
74
|
+
l
|
|
73
75
|
] });
|
|
74
76
|
}
|
|
75
77
|
export {
|
|
@@ -1,74 +1,81 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const [t,
|
|
7
|
-
return
|
|
1
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as y, useEffect as x, useLayoutEffect as E } from "react";
|
|
3
|
+
import { createPortal as L } from "react-dom";
|
|
4
|
+
const w = [], O = '[data-nvr-header-menu-panel], [role="menu"], [data-rail-menu]', p = 6;
|
|
5
|
+
function R() {
|
|
6
|
+
const [t, a] = b(null), [u, f] = b(!1), g = y(null);
|
|
7
|
+
return x(() => (w.push(f), w[0] === f && f(!0), () => {
|
|
8
8
|
var e;
|
|
9
|
-
const c =
|
|
10
|
-
c < 0 || (
|
|
11
|
-
}), []),
|
|
12
|
-
if (!
|
|
13
|
-
const c = (
|
|
9
|
+
const c = w.indexOf(f);
|
|
10
|
+
c < 0 || (w.splice(c, 1), c === 0 && ((e = w[0]) == null || e.call(w, !0)));
|
|
11
|
+
}), []), x(() => {
|
|
12
|
+
if (!u) return;
|
|
13
|
+
const c = (o) => {
|
|
14
14
|
var v;
|
|
15
|
-
const i = (v =
|
|
16
|
-
if (!i || !
|
|
17
|
-
|
|
15
|
+
const i = (v = o == null ? void 0 : o.closest) == null ? void 0 : v.call(o, "[data-tip]"), d = i == null ? void 0 : i.getAttribute("data-tip");
|
|
16
|
+
if (!i || !d || i.getAttribute("aria-expanded") === "true") {
|
|
17
|
+
a((l) => l && null);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const n = i.getBoundingClientRect(), m = i.closest(O);
|
|
21
21
|
if (m && m !== i) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
x:
|
|
25
|
-
y:
|
|
26
|
-
text:
|
|
27
|
-
beside: { left:
|
|
22
|
+
const l = m.getBoundingClientRect();
|
|
23
|
+
a({
|
|
24
|
+
x: l.left,
|
|
25
|
+
y: n.top,
|
|
26
|
+
text: d,
|
|
27
|
+
beside: { left: l.left, right: l.right, rowTop: n.top, rowHeight: n.height }
|
|
28
28
|
});
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
if (i.getAttribute("data-tip-side") === "right") {
|
|
32
|
-
|
|
33
|
-
x:
|
|
34
|
-
y:
|
|
35
|
-
text:
|
|
36
|
-
rightOf: { left:
|
|
32
|
+
a({
|
|
33
|
+
x: n.right + p,
|
|
34
|
+
y: n.top,
|
|
35
|
+
text: d,
|
|
36
|
+
rightOf: { left: n.left, right: n.right, top: n.top, height: n.height }
|
|
37
37
|
});
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (i.getAttribute("data-tip-side") === "top") {
|
|
41
|
+
a({ x: n.left, y: n.top, text: d, above: { top: n.top, bottom: n.bottom } });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
a({ x: n.left, y: n.bottom + 4, text: d });
|
|
45
|
+
}, e = (o) => c(o.target), h = () => a(null), s = (o) => {
|
|
46
|
+
var d, n;
|
|
47
|
+
const i = (n = (d = o.target) == null ? void 0 : d.closest) == null ? void 0 : n.call(d, "[data-tip-focus]");
|
|
44
48
|
i && c(i);
|
|
45
|
-
},
|
|
46
|
-
var i,
|
|
47
|
-
(
|
|
49
|
+
}, r = (o) => {
|
|
50
|
+
var i, d;
|
|
51
|
+
(d = (i = o.target) == null ? void 0 : i.closest) != null && d.call(i, "[data-tip-focus]") && a(null);
|
|
48
52
|
};
|
|
49
|
-
return window.addEventListener("mouseover", e), window.addEventListener("focusin", s), window.addEventListener("focusout",
|
|
50
|
-
window.removeEventListener("mouseover", e), window.removeEventListener("focusin", s), window.removeEventListener("focusout",
|
|
53
|
+
return window.addEventListener("mouseover", e), window.addEventListener("focusin", s), window.addEventListener("focusout", r), window.addEventListener("pointerdown", h, !0), window.addEventListener("scroll", h, !0), () => {
|
|
54
|
+
window.removeEventListener("mouseover", e), window.removeEventListener("focusin", s), window.removeEventListener("focusout", r), window.removeEventListener("pointerdown", h, !0), window.removeEventListener("scroll", h, !0);
|
|
51
55
|
};
|
|
52
|
-
}, [
|
|
56
|
+
}, [u]), E(() => {
|
|
53
57
|
if (!t) return;
|
|
54
|
-
const c =
|
|
58
|
+
const c = g.current;
|
|
55
59
|
if (!c) return;
|
|
56
60
|
const e = c.getBoundingClientRect();
|
|
57
|
-
let { x:
|
|
61
|
+
let { x: h, y: s } = t;
|
|
58
62
|
if (t.rightOf) {
|
|
59
|
-
const
|
|
60
|
-
|
|
63
|
+
const r = t.rightOf, o = r.right + p;
|
|
64
|
+
h = o + e.width <= window.innerWidth - 8 ? o : Math.max(8, r.left - p - e.width), s = Math.round(r.top + (r.height - e.height) / 2), s = Math.max(8, Math.min(s, window.innerHeight - e.height - 8));
|
|
61
65
|
} else if (t.beside) {
|
|
62
|
-
const
|
|
63
|
-
|
|
66
|
+
const r = t.beside, o = r.left - p - e.width;
|
|
67
|
+
h = o >= 8 ? o : Math.min(r.right + p, Math.max(8, window.innerWidth - e.width - 8)), s = Math.round(r.rowTop + (r.rowHeight - e.height) / 2), s = Math.max(8, Math.min(s, window.innerHeight - e.height - 8));
|
|
68
|
+
} else if (t.above) {
|
|
69
|
+
const r = t.above.top - p - e.height;
|
|
70
|
+
s = r >= 8 ? r : t.above.bottom + 4, h + e.width > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - e.width - 8));
|
|
64
71
|
} else
|
|
65
|
-
e.right > window.innerWidth - 8 && (
|
|
66
|
-
(
|
|
67
|
-
}, [t]), !
|
|
68
|
-
/* @__PURE__ */
|
|
72
|
+
e.right > window.innerWidth - 8 && (h = Math.max(8, window.innerWidth - e.width - 8)), e.bottom > window.innerHeight - 8 && (s = Math.max(8, t.y - e.height - 30));
|
|
73
|
+
(h !== t.x || s !== t.y) && a({ ...t, x: h, y: s });
|
|
74
|
+
}, [t]), !u || !t ? null : L(
|
|
75
|
+
/* @__PURE__ */ M(
|
|
69
76
|
"div",
|
|
70
77
|
{
|
|
71
|
-
ref:
|
|
78
|
+
ref: g,
|
|
72
79
|
style: { position: "fixed", left: t.x, top: t.y, zIndex: 120 },
|
|
73
80
|
className: "pointer-events-none max-w-[340px] whitespace-pre-wrap break-words rounded-md bg-[#0f172a] px-2 py-1 text-[11px] font-medium leading-snug text-white shadow-lg dark:bg-[#334155] dark:ring-1 dark:ring-white/10",
|
|
74
81
|
children: t.text
|
|
@@ -78,19 +85,19 @@ function W() {
|
|
|
78
85
|
);
|
|
79
86
|
}
|
|
80
87
|
function T(t) {
|
|
81
|
-
const
|
|
88
|
+
const a = y(null);
|
|
82
89
|
return E(() => {
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
(
|
|
90
|
+
const u = a.current;
|
|
91
|
+
if (!u) return;
|
|
92
|
+
const f = () => {
|
|
93
|
+
(u.scrollWidth > u.clientWidth + 1 || u.scrollHeight > u.clientHeight + 1) && t ? u.setAttribute("data-tip", t) : u.removeAttribute("data-tip");
|
|
87
94
|
};
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
}, [t]),
|
|
95
|
+
if (f(), typeof ResizeObserver > "u") return;
|
|
96
|
+
const g = new ResizeObserver(f);
|
|
97
|
+
return g.observe(u), () => g.disconnect();
|
|
98
|
+
}, [t]), a;
|
|
92
99
|
}
|
|
93
100
|
export {
|
|
94
|
-
|
|
101
|
+
R as TipLayer,
|
|
95
102
|
T as useOverflowTip
|
|
96
103
|
};
|
|
@@ -1,59 +1,99 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Loader2 as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { toastError as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { widgetImageFileName as
|
|
8
|
-
import { WIDGET_IMAGE_IGNORE_ATTR as
|
|
9
|
-
import { DropdownMenu as
|
|
10
|
-
function
|
|
11
|
-
getTarget:
|
|
12
|
-
label:
|
|
13
|
-
className:
|
|
14
|
-
align:
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2 as b, MoreHorizontal as S, ImageIcon as W, Download as R } from "lucide-react";
|
|
3
|
+
import { useState as x, useRef as A } from "react";
|
|
4
|
+
import { toast as c } from "sonner";
|
|
5
|
+
import { toastError as y } from "../lib/error-toast.js";
|
|
6
|
+
import { cn as E } from "../lib/utils.js";
|
|
7
|
+
import { widgetImageFileName as G, buildWidgetImageLabel as L } from "../lib/widget-image.js";
|
|
8
|
+
import { WIDGET_IMAGE_IGNORE_ATTR as v, renderWidgetImage as T, copyPngOrSave as j, downloadBlob as O } from "../lib/widget-image-render.js";
|
|
9
|
+
import { DropdownMenu as P, DropdownMenuTrigger as _, DropdownMenuContent as B, DropdownMenuItem as N } from "./ui/dropdown-menu.js";
|
|
10
|
+
function V({
|
|
11
|
+
getTarget: a,
|
|
12
|
+
label: o,
|
|
13
|
+
className: n,
|
|
14
|
+
align: I = "end",
|
|
15
|
+
loading: k
|
|
15
16
|
}) {
|
|
16
|
-
const [
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
17
|
+
const [u, p] = x(!1), [C, D] = x(!1), s = A(!1), i = k || C, M = () => L(typeof o == "function" ? o() : o), m = (d) => {
|
|
18
|
+
const f = a();
|
|
19
|
+
if (!f || s.current) return;
|
|
20
|
+
s.current = !0, p(!0);
|
|
21
|
+
const h = M(), l = G(h.title), g = T(f, h), w = () => {
|
|
22
|
+
s.current = !1, p(!1);
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
-
e === "copied" ?
|
|
25
|
-
}).catch((e) =>
|
|
26
|
-
|
|
27
|
-
}).catch((e) =>
|
|
24
|
+
d === "copy" ? j(g, l).then((e) => {
|
|
25
|
+
e === "copied" ? c.success("Copied the picture. Paste it into an email or Teams.") : c.info(`Your browser would not copy a picture, so it was saved as ${l}.`);
|
|
26
|
+
}).catch((e) => y(e, "Could not make the picture.")).finally(w) : g.then((e) => {
|
|
27
|
+
O(e, l), c.success("Saved the picture.");
|
|
28
|
+
}).catch((e) => y(e, "Could not make the picture.")).finally(w);
|
|
28
29
|
};
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */ t(
|
|
30
|
+
return /* @__PURE__ */ r(P, { onOpenChange: (d) => d && D($(a())), children: [
|
|
31
|
+
/* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ t(
|
|
31
32
|
"button",
|
|
32
33
|
{
|
|
33
34
|
type: "button",
|
|
34
|
-
[
|
|
35
|
+
[v]: "",
|
|
35
36
|
"aria-label": "Widget options",
|
|
36
37
|
"data-tip": "Copy or save as a picture",
|
|
37
|
-
disabled:
|
|
38
|
-
className:
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
disabled: u,
|
|
39
|
+
className: E(
|
|
40
|
+
// The hit area reaches past the 24 px glyph box (finger-sized on a phone) without
|
|
41
|
+
// changing its look.
|
|
42
|
+
"relative inline-flex h-6 w-6 items-center before:absolute before:-inset-1 justify-center rounded text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-60 data-[state=open]:bg-slate-100 data-[state=open]:text-slate-700 dark:text-slate-500 dark:hover:bg-white/[0.06] dark:hover:text-slate-200 dark:data-[state=open]:bg-white/[0.08] dark:data-[state=open]:text-slate-200",
|
|
43
|
+
n
|
|
41
44
|
),
|
|
42
|
-
children:
|
|
45
|
+
children: u ? /* @__PURE__ */ t(b, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": !0 }) : /* @__PURE__ */ t(S, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
43
46
|
}
|
|
44
47
|
) }),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/* @__PURE__ */ r(B, { align: I, className: "min-w-[170px]", children: [
|
|
49
|
+
/* @__PURE__ */ r(
|
|
50
|
+
N,
|
|
51
|
+
{
|
|
52
|
+
disabled: i,
|
|
53
|
+
onSelect: () => m("copy"),
|
|
54
|
+
className: "gap-2 text-[12.5px]",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ t(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
57
|
+
"Copy as image"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ r(
|
|
62
|
+
N,
|
|
63
|
+
{
|
|
64
|
+
disabled: i,
|
|
65
|
+
onSelect: () => m("download"),
|
|
66
|
+
className: "gap-2 text-[12.5px]",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ t(R, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
69
|
+
"Download PNG"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
i && /* @__PURE__ */ r(
|
|
74
|
+
"p",
|
|
75
|
+
{
|
|
76
|
+
className: "flex items-center gap-1.5 px-2 pb-1 pt-1.5 text-[11.5px] text-muted-foreground",
|
|
77
|
+
"data-widget-image-wait": !0,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ t(b, { className: "h-3 w-3 animate-spin", "aria-hidden": !0 }),
|
|
80
|
+
"Wait for the widget to load"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
)
|
|
54
84
|
] })
|
|
55
85
|
] });
|
|
56
86
|
}
|
|
87
|
+
function $(a) {
|
|
88
|
+
if (!a) return !1;
|
|
89
|
+
const o = a.querySelectorAll(
|
|
90
|
+
'[aria-busy="true"], .animate-spin, .animate-pulse'
|
|
91
|
+
);
|
|
92
|
+
for (const n of Array.from(o))
|
|
93
|
+
if (!n.closest(`[${v}]`)) return !0;
|
|
94
|
+
return !1;
|
|
95
|
+
}
|
|
57
96
|
export {
|
|
58
|
-
|
|
97
|
+
V as WidgetImageMenu,
|
|
98
|
+
$ as widgetIsLoading
|
|
59
99
|
};
|