@nivaro/react 0.3.13 → 0.3.14
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/components/slots/pipeline/OwnersSection.js +79 -75
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +33 -2
- package/dist/index.js +520 -516
- package/dist/shared/components/CollectionBrowserView.js +2373 -2298
- package/dist/shared/components/DataTable.js +347 -335
- package/dist/shared/components/ItemEditForm.js +5278 -5149
- package/dist/shared/components/ListLoadError.js +33 -0
- package/dist/shared/components/PageRenderer.js +562 -529
- package/dist/shared/components/ProfileView.js +53 -51
- package/dist/shared/components/RecordReadView.js +119 -117
- package/dist/shared/components/ReportView.js +1268 -1241
- package/dist/shared/components/cbv/export-rows.js +69 -0
- package/dist/shared/components/cbv/saved-view-risk.js +35 -0
- package/dist/shared/components/cbv/unknown-fields.js +18 -0
- package/dist/shared/components/integrations/console/AlertsView.js +27 -25
- package/dist/shared/components/integrations/console/EventsView.js +244 -209
- package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
- package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
- package/dist/shared/components/item-edit/FieldRow.js +195 -179
- package/dist/shared/components/item-edit/FilePickerField.js +257 -254
- package/dist/shared/components/item-edit/HeaderTools.js +139 -95
- package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
- package/dist/shared/components/item-edit/RowComments.js +1 -3
- package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
- package/dist/shared/components/item-edit/UserChip.js +113 -113
- package/dist/shared/components/item-edit/file-download.js +18 -0
- package/dist/shared/components/item-edit/line-qty.js +67 -32
- package/dist/shared/components/item-edit/save-refusal.js +23 -0
- package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
- package/dist/shared/components/panels/CommentPanel.js +30 -30
- package/dist/shared/components/panels/ItemLockBanner.js +207 -185
- package/dist/shared/components/panels/PipelinePanel.js +915 -786
- package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
- package/dist/shared/components/profile/DelegationCard.js +1 -1
- package/dist/shared/components/profile/session-actions.js +24 -24
- package/dist/shared/components/queue/QueueItemSheet.js +18 -18
- package/dist/shared/components/queue/QueueWorklist.js +517 -504
- package/dist/shared/components/ui/dropdown-menu.js +8 -7
- package/dist/shared/lib/draft-store.js +60 -33
- package/dist/shared/lib/leave-guard.js +38 -0
- package/dist/shared/lib/load-error.js +38 -17
- package/dist/shared/lib/summary-mode.js +25 -25
- package/dist/shared/lib/table-pins.js +23 -0
- package/dist/shared/lib/validation-rules.js +55 -51
- package/package.json +1 -1
|
@@ -1,115 +1,142 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { History as
|
|
3
|
-
import { useState as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
|
|
1
|
+
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { History as _, ExternalLink as C, RotateCcw as R, Trash2 as S } from "lucide-react";
|
|
3
|
+
import { useState as D } from "react";
|
|
4
|
+
import { useItemNavigation as H } from "../../context.js";
|
|
5
|
+
import { formatRelative as v, titleCase as k } from "../../lib/utils.js";
|
|
6
|
+
const w = (r) => {
|
|
7
|
+
if (r == null || r === "") return "empty";
|
|
8
|
+
if (typeof r == "boolean") return r ? "Yes" : "No";
|
|
9
|
+
const c = typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
9
10
|
return c.length > 60 ? `${c.slice(0, 60)}…` : c;
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
-
draft:
|
|
12
|
+
function L({
|
|
13
|
+
draft: r,
|
|
13
14
|
labelFor: c,
|
|
14
|
-
current:
|
|
15
|
-
recordChanged:
|
|
16
|
-
onRestore:
|
|
17
|
-
onDiscard:
|
|
15
|
+
current: g,
|
|
16
|
+
recordChanged: y,
|
|
17
|
+
onRestore: $,
|
|
18
|
+
onDiscard: j,
|
|
19
|
+
createdId: s = null,
|
|
20
|
+
collection: x,
|
|
21
|
+
renderValue: p
|
|
18
22
|
}) {
|
|
19
|
-
const [
|
|
20
|
-
(e,
|
|
23
|
+
const [f, O] = D(!1), N = H(), b = Object.entries(r.fields ?? {}), h = s !== null, u = Object.values(r.pending_rows ?? {}).reduce((e, a) => e + a.length, 0), l = Object.values(r.pending_edits ?? {}).reduce(
|
|
24
|
+
(e, a) => e + Object.keys(a).length,
|
|
21
25
|
0
|
|
22
|
-
),
|
|
23
|
-
return
|
|
26
|
+
), o = Object.values(r.pending_deletes ?? {}).reduce((e, a) => e + a.length, 0), m = Object.values(r.m2m_links ?? {}).reduce((e, a) => e + a.length, 0), d = Object.values(r.m2m_unlinks ?? {}).reduce((e, a) => e + a.length, 0), i = [];
|
|
27
|
+
return b.length && i.push(`${b.length} field${b.length === 1 ? "" : "s"}`), u && i.push(`${u} new line${u === 1 ? "" : "s"}`), l && i.push(`${l} line edit${l === 1 ? "" : "s"}`), o && i.push(`${o} line removal${o === 1 ? "" : "s"}`), m && i.push(`${m} link${m === 1 ? "" : "s"}`), d && i.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */ t(
|
|
24
28
|
"div",
|
|
25
29
|
{
|
|
26
30
|
className: "mb-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-[12.5px] text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
|
|
27
31
|
"data-nvr-draft-recovery": !0,
|
|
28
32
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
34
|
+
/* @__PURE__ */ n(_, { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
35
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
|
|
36
|
+
h ? /* @__PURE__ */ t("span", { className: "font-semibold", "data-nvr-draft-created": !0, children: [
|
|
37
|
+
"These changes from ",
|
|
38
|
+
v(r.saved_at),
|
|
39
|
+
" were already saved",
|
|
40
|
+
s ? ` as record ${s}` : " as a new record",
|
|
41
|
+
" — restoring them makes a second one."
|
|
42
|
+
] }) : /* @__PURE__ */ t("span", { className: "font-semibold", children: [
|
|
33
43
|
"Restore your unsaved changes from ",
|
|
34
|
-
|
|
44
|
+
v(r.saved_at),
|
|
35
45
|
"?"
|
|
36
46
|
] }),
|
|
37
47
|
" ",
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
48
|
+
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children: i.join(" · ") }),
|
|
49
|
+
y && /* @__PURE__ */ n("span", { className: "ml-1 rounded bg-amber-200/70 px-1 py-px text-[10.5px] font-semibold uppercase tracking-wide text-amber-900 dark:bg-amber-500/30 dark:text-amber-100", children: "record changed since — review before restoring" })
|
|
40
50
|
] }),
|
|
41
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ n(
|
|
42
52
|
"button",
|
|
43
53
|
{
|
|
44
54
|
type: "button",
|
|
45
|
-
onClick: () =>
|
|
55
|
+
onClick: () => O((e) => !e),
|
|
46
56
|
className: "text-[11.5px] underline decoration-dotted underline-offset-2",
|
|
47
|
-
children:
|
|
57
|
+
children: f ? "Hide changes" : "Show changes"
|
|
48
58
|
}
|
|
49
59
|
),
|
|
50
|
-
/* @__PURE__ */
|
|
60
|
+
h && s && x && /* @__PURE__ */ t(
|
|
61
|
+
"a",
|
|
62
|
+
{
|
|
63
|
+
href: N.urlFor({ collection: x, itemId: s }),
|
|
64
|
+
onClick: (e) => {
|
|
65
|
+
e.preventDefault(), N.open({ collection: x, itemId: s });
|
|
66
|
+
},
|
|
67
|
+
className: "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
68
|
+
"data-nvr-draft-open-created": !0,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ n(C, { className: "h-3 w-3" }),
|
|
71
|
+
" Open record ",
|
|
72
|
+
s
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ t(
|
|
51
77
|
"button",
|
|
52
78
|
{
|
|
53
79
|
type: "button",
|
|
54
|
-
onClick:
|
|
55
|
-
className: "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
80
|
+
onClick: $,
|
|
81
|
+
className: h ? "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15" : "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
56
82
|
"data-nvr-draft-restore": !0,
|
|
57
83
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
"
|
|
84
|
+
/* @__PURE__ */ n(R, { className: "h-3 w-3" }),
|
|
85
|
+
" ",
|
|
86
|
+
h ? "Restore anyway" : "Restore"
|
|
60
87
|
]
|
|
61
88
|
}
|
|
62
89
|
),
|
|
63
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ t(
|
|
64
91
|
"button",
|
|
65
92
|
{
|
|
66
93
|
type: "button",
|
|
67
|
-
onClick:
|
|
94
|
+
onClick: j,
|
|
68
95
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
|
|
69
96
|
"data-nvr-draft-discard": !0,
|
|
70
97
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ n(S, { className: "h-3 w-3" }),
|
|
72
99
|
" Discard"
|
|
73
100
|
]
|
|
74
101
|
}
|
|
75
102
|
)
|
|
76
103
|
] }),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
104
|
+
f && /* @__PURE__ */ t("div", { className: "mt-2 max-h-[240px] space-y-1 overflow-y-auto border-t border-amber-200/70 pt-2 dark:border-amber-500/30", children: [
|
|
105
|
+
b.map(([e, a]) => /* @__PURE__ */ t("div", { className: "text-[11.5px]", children: [
|
|
106
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: c(e) || k(e.replace(/_/g, " ")) }),
|
|
107
|
+
/* @__PURE__ */ t("p", { className: "break-words text-amber-800/80 dark:text-amber-200/80", children: [
|
|
108
|
+
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e, g[e]) : w(g[e]) }),
|
|
82
109
|
" ",
|
|
83
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, a) : w(a) })
|
|
84
111
|
] })
|
|
85
112
|
] }, e)),
|
|
86
|
-
Object.entries(
|
|
87
|
-
|
|
113
|
+
Object.entries(r.pending_rows ?? {}).filter(([, e]) => e.length > 0).map(([e, a]) => /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: [
|
|
114
|
+
a.length,
|
|
88
115
|
" new line",
|
|
89
|
-
|
|
116
|
+
a.length === 1 ? "" : "s",
|
|
90
117
|
" in",
|
|
91
118
|
" ",
|
|
92
|
-
|
|
119
|
+
k(e.split(".")[0].replace(/_/g, " "))
|
|
93
120
|
] }, e)),
|
|
94
|
-
l > 0 && /* @__PURE__ */
|
|
121
|
+
l > 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: [
|
|
95
122
|
l,
|
|
96
123
|
" edited line",
|
|
97
124
|
l === 1 ? "" : "s"
|
|
98
125
|
] }),
|
|
99
|
-
|
|
100
|
-
|
|
126
|
+
o > 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: [
|
|
127
|
+
o,
|
|
101
128
|
" line removal",
|
|
102
|
-
|
|
129
|
+
o === 1 ? "" : "s"
|
|
103
130
|
] }),
|
|
104
|
-
|
|
105
|
-
|
|
131
|
+
m > 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: [
|
|
132
|
+
m,
|
|
106
133
|
" relation link",
|
|
107
|
-
|
|
134
|
+
m === 1 ? "" : "s"
|
|
108
135
|
] }),
|
|
109
|
-
|
|
110
|
-
|
|
136
|
+
d > 0 && /* @__PURE__ */ t("p", { className: "text-[11.5px]", children: [
|
|
137
|
+
d,
|
|
111
138
|
" relation removal",
|
|
112
|
-
|
|
139
|
+
d === 1 ? "" : "s"
|
|
113
140
|
] })
|
|
114
141
|
] })
|
|
115
142
|
]
|
|
@@ -117,5 +144,5 @@ function S({
|
|
|
117
144
|
);
|
|
118
145
|
}
|
|
119
146
|
export {
|
|
120
|
-
|
|
147
|
+
L as DraftRecoveryBanner
|
|
121
148
|
};
|
|
@@ -3,21 +3,22 @@ import { Copy as F, History as O, Eye as K, Sigma as P, ExternalLink as B, Lock
|
|
|
3
3
|
import { useContext as U, createContext as q, useState as C, useCallback as g, useRef as v, useEffect as E } from "react";
|
|
4
4
|
import { createPortal as J } from "react-dom";
|
|
5
5
|
import { toast as k } from "sonner";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { htmlToText as R } from "../../lib/sanitize-html.js";
|
|
7
|
+
import { cn as A, formatRelative as T } from "../../lib/utils.js";
|
|
8
|
+
const V = q(null), re = () => U(V), j = (e) => {
|
|
8
9
|
if (e == null || e === "") return "empty";
|
|
9
10
|
if (typeof e == "boolean") return e ? "Yes" : "No";
|
|
10
11
|
if (typeof e == "object")
|
|
11
12
|
try {
|
|
12
|
-
const
|
|
13
|
-
return
|
|
13
|
+
const s = JSON.stringify(e);
|
|
14
|
+
return s.length > 80 ? `${s.slice(0, 80)}…` : s;
|
|
14
15
|
} catch {
|
|
15
16
|
return String(e);
|
|
16
17
|
}
|
|
17
|
-
const n = String(e)
|
|
18
|
-
return
|
|
18
|
+
const n = String(e), t = /[<&]/.test(n) ? R(n).trim() : n;
|
|
19
|
+
return t.length > 80 ? `${t.slice(0, 80)}…` : t;
|
|
19
20
|
};
|
|
20
|
-
function
|
|
21
|
+
function oe({
|
|
21
22
|
change: e,
|
|
22
23
|
onDismiss: n,
|
|
23
24
|
onTakeTheirs: t
|
|
@@ -34,12 +35,12 @@ function ne({
|
|
|
34
35
|
e.by ?? "Someone",
|
|
35
36
|
" changed this to",
|
|
36
37
|
" ",
|
|
37
|
-
/* @__PURE__ */ o("span", { className: "font-medium", children:
|
|
38
|
+
/* @__PURE__ */ o("span", { className: "font-medium", children: j(e.theirs) }),
|
|
38
39
|
" while you were editing",
|
|
39
40
|
/* @__PURE__ */ x("span", { className: "text-amber-700/80 dark:text-amber-200/70", children: [
|
|
40
41
|
" ",
|
|
41
42
|
"· ",
|
|
42
|
-
|
|
43
|
+
T(e.at)
|
|
43
44
|
] })
|
|
44
45
|
] }),
|
|
45
46
|
/* @__PURE__ */ o(
|
|
@@ -74,13 +75,13 @@ function ne({
|
|
|
74
75
|
/* @__PURE__ */ x("span", { className: "min-w-0 flex-1", children: [
|
|
75
76
|
"was",
|
|
76
77
|
" ",
|
|
77
|
-
/* @__PURE__ */ o("span", { className: "font-medium line-through decoration-sky-400/70", children:
|
|
78
|
+
/* @__PURE__ */ o("span", { className: "font-medium line-through decoration-sky-400/70", children: j(e.was) }),
|
|
78
79
|
/* @__PURE__ */ x("span", { className: "text-sky-700/80 dark:text-sky-300/80", children: [
|
|
79
80
|
" ",
|
|
80
81
|
"· ",
|
|
81
82
|
e.by ?? "someone",
|
|
82
83
|
", ",
|
|
83
|
-
|
|
84
|
+
T(e.at)
|
|
84
85
|
] })
|
|
85
86
|
] }),
|
|
86
87
|
/* @__PURE__ */ o(
|
|
@@ -97,7 +98,7 @@ function ne({
|
|
|
97
98
|
}
|
|
98
99
|
);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function ae({ reason: e, onHover: n }) {
|
|
101
102
|
return /* @__PURE__ */ o(
|
|
102
103
|
"span",
|
|
103
104
|
{
|
|
@@ -111,24 +112,24 @@ function re({ reason: e, onHover: n }) {
|
|
|
111
112
|
}
|
|
112
113
|
);
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function W(e, n) {
|
|
115
116
|
if (!e || !(n != null && n.contains(e))) return null;
|
|
116
117
|
const t = e.closest(
|
|
117
118
|
"input, textarea, select"
|
|
118
119
|
);
|
|
119
120
|
if (t && n.contains(t) && !(t instanceof HTMLInputElement && t.type === "checkbox"))
|
|
120
121
|
return t.value;
|
|
121
|
-
const
|
|
122
|
-
return
|
|
122
|
+
const s = e.closest("td, th");
|
|
123
|
+
return s && n.contains(s) ? s.innerText.replace(/\s+/g, " ").trim() : null;
|
|
123
124
|
}
|
|
124
|
-
function
|
|
125
|
+
function se({
|
|
125
126
|
wrapperRef: e,
|
|
126
127
|
field: n,
|
|
127
128
|
value: t,
|
|
128
|
-
relations:
|
|
129
|
+
relations: s,
|
|
129
130
|
collection: m,
|
|
130
131
|
itemId: c,
|
|
131
|
-
openRelated:
|
|
132
|
+
openRelated: l
|
|
132
133
|
}) {
|
|
133
134
|
var M, D;
|
|
134
135
|
const [y, w] = C(null), h = g((a, u) => w({ x: a, y: u }), []), b = g(() => w(null), []), r = v(null), f = g(
|
|
@@ -148,7 +149,7 @@ function oe({
|
|
|
148
149
|
}
|
|
149
150
|
},
|
|
150
151
|
[h, e]
|
|
151
|
-
),
|
|
152
|
+
), i = s.find(
|
|
152
153
|
(a) => a.many_collection === m && a.many_field === n.field && a.one_collection
|
|
153
154
|
), d = c && c !== "new", S = (a) => {
|
|
154
155
|
var p;
|
|
@@ -160,7 +161,7 @@ function oe({
|
|
|
160
161
|
label: "Copy value",
|
|
161
162
|
icon: /* @__PURE__ */ o(F, { className: "h-3.5 w-3.5" }),
|
|
162
163
|
run: () => {
|
|
163
|
-
const u =
|
|
164
|
+
const u = W(r.current, e.current) ?? (t == null ? "" : typeof t == "object" ? JSON.stringify(t) : String(t));
|
|
164
165
|
if (!u) {
|
|
165
166
|
k.info("Nothing to copy");
|
|
166
167
|
return;
|
|
@@ -210,62 +211,62 @@ function oe({
|
|
|
210
211
|
S("[data-field-lineage]");
|
|
211
212
|
}
|
|
212
213
|
},
|
|
213
|
-
...
|
|
214
|
+
...i && l ? [
|
|
214
215
|
{
|
|
215
216
|
key: "open",
|
|
216
|
-
label: `Open related ${(D =
|
|
217
|
+
label: `Open related ${(D = i.one_collection) == null ? void 0 : D.replace(/_/g, " ")}`,
|
|
217
218
|
icon: /* @__PURE__ */ o(B, { className: "h-3.5 w-3.5" }),
|
|
218
219
|
disabled: t == null || t === "",
|
|
219
220
|
run: () => {
|
|
220
221
|
const a = typeof t == "object" && t && "id" in t ? String(t.id) : String(t);
|
|
221
|
-
|
|
222
|
+
l(String(i.one_collection), a);
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
] : []
|
|
225
226
|
];
|
|
226
|
-
return { onContextMenu: f, onKeyDown: N, menu: y ? /* @__PURE__ */ o(
|
|
227
|
+
return { onContextMenu: f, onKeyDown: N, menu: y ? /* @__PURE__ */ o(X, { at: y, items: _, onClose: b }) : null };
|
|
227
228
|
}
|
|
228
|
-
function
|
|
229
|
+
function X({
|
|
229
230
|
at: e,
|
|
230
231
|
items: n,
|
|
231
232
|
onClose: t
|
|
232
233
|
}) {
|
|
233
|
-
const
|
|
234
|
+
const s = v(null), [m, c] = C(0), l = n.filter((r) => !r.disabled);
|
|
234
235
|
E(() => {
|
|
235
236
|
var N;
|
|
236
|
-
const r = (
|
|
237
|
+
const r = (i) => {
|
|
237
238
|
var d;
|
|
238
|
-
(d =
|
|
239
|
-
}, f = (
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
else if (
|
|
243
|
-
|
|
244
|
-
else if (
|
|
245
|
-
|
|
246
|
-
else if (
|
|
247
|
-
|
|
248
|
-
const d =
|
|
239
|
+
(d = s.current) != null && d.contains(i.target) || t();
|
|
240
|
+
}, f = (i) => {
|
|
241
|
+
if (i.key === "Escape")
|
|
242
|
+
i.preventDefault(), t();
|
|
243
|
+
else if (i.key === "ArrowDown")
|
|
244
|
+
i.preventDefault(), c((d) => (d + 1) % Math.max(1, l.length));
|
|
245
|
+
else if (i.key === "ArrowUp")
|
|
246
|
+
i.preventDefault(), c((d) => (d - 1 + Math.max(1, l.length)) % Math.max(1, l.length));
|
|
247
|
+
else if (i.key === "Enter" || i.key === " ") {
|
|
248
|
+
i.preventDefault();
|
|
249
|
+
const d = l[m];
|
|
249
250
|
d && (d.run(), t());
|
|
250
251
|
}
|
|
251
252
|
};
|
|
252
|
-
return window.addEventListener("mousedown", r, !0), window.addEventListener("keydown", f, !0), (N =
|
|
253
|
+
return window.addEventListener("mousedown", r, !0), window.addEventListener("keydown", f, !0), (N = s.current) == null || N.focus(), () => {
|
|
253
254
|
window.removeEventListener("mousedown", r, !0), window.removeEventListener("keydown", f, !0);
|
|
254
255
|
};
|
|
255
|
-
}, [t,
|
|
256
|
+
}, [t, l, m]);
|
|
256
257
|
const y = 240, w = n.length * 30 + 12, h = Math.min(e.x, window.innerWidth - y - 8), b = Math.min(e.y, window.innerHeight - w - 8);
|
|
257
258
|
return J(
|
|
258
259
|
/* @__PURE__ */ o(
|
|
259
260
|
"div",
|
|
260
261
|
{
|
|
261
|
-
ref:
|
|
262
|
+
ref: s,
|
|
262
263
|
role: "menu",
|
|
263
264
|
tabIndex: -1,
|
|
264
265
|
"data-field-context-menu": !0,
|
|
265
266
|
style: { position: "fixed", left: h, top: b, width: y, zIndex: 110 },
|
|
266
267
|
className: "rounded-lg border border-slate-200 bg-white p-1 shadow-xl outline-none dark:border-border dark:bg-card",
|
|
267
268
|
children: n.map((r) => {
|
|
268
|
-
const f =
|
|
269
|
+
const f = l.indexOf(r), N = f === m && !r.disabled;
|
|
269
270
|
return /* @__PURE__ */ x(
|
|
270
271
|
"button",
|
|
271
272
|
{
|
|
@@ -276,7 +277,7 @@ function W({
|
|
|
276
277
|
onClick: () => {
|
|
277
278
|
r.run(), t();
|
|
278
279
|
},
|
|
279
|
-
className:
|
|
280
|
+
className: A(
|
|
280
281
|
"flex h-[30px] w-full items-center gap-2 rounded-sm px-2 text-left text-[12.5px] font-medium text-slate-700 dark:text-slate-200",
|
|
281
282
|
N && "bg-accent text-accent-foreground",
|
|
282
283
|
r.disabled && "cursor-not-allowed opacity-40"
|
|
@@ -295,8 +296,8 @@ function W({
|
|
|
295
296
|
document.body
|
|
296
297
|
);
|
|
297
298
|
}
|
|
298
|
-
function
|
|
299
|
-
const [n, t] = C(null), [
|
|
299
|
+
function ie(e) {
|
|
300
|
+
const [n, t] = C(null), [s, m] = C(!1), c = v(!1), l = v(null);
|
|
300
301
|
E(() => {
|
|
301
302
|
const b = e.current;
|
|
302
303
|
if (!b) return;
|
|
@@ -311,32 +312,32 @@ function ae(e) {
|
|
|
311
312
|
(b) => {
|
|
312
313
|
if (!n || c.current) return;
|
|
313
314
|
const r = b.target;
|
|
314
|
-
r.matches('input, textarea, select, [contenteditable="true"], [role="combobox"]') && (
|
|
315
|
+
r.matches('input, textarea, select, [contenteditable="true"], [role="combobox"]') && (l.current = r, setTimeout(() => {
|
|
315
316
|
c.current || r.blur();
|
|
316
317
|
}, 0), m(!0));
|
|
317
318
|
},
|
|
318
319
|
[n]
|
|
319
320
|
), w = g(() => {
|
|
320
321
|
c.current = !0, m(!1);
|
|
321
|
-
const b =
|
|
322
|
-
|
|
322
|
+
const b = l.current;
|
|
323
|
+
l.current = null, b && setTimeout(() => b.focus(), 0);
|
|
323
324
|
}, []), h = g(() => {
|
|
324
|
-
m(!1),
|
|
325
|
+
m(!1), l.current = null;
|
|
325
326
|
}, []);
|
|
326
|
-
return { editor: n, confirming:
|
|
327
|
+
return { editor: n, confirming: s, onFocusCapture: y, confirm: w, cancel: h };
|
|
327
328
|
}
|
|
328
|
-
function
|
|
329
|
+
function le({
|
|
329
330
|
editor: e,
|
|
330
331
|
confirming: n,
|
|
331
332
|
onConfirm: t,
|
|
332
|
-
onCancel:
|
|
333
|
+
onCancel: s
|
|
333
334
|
}) {
|
|
334
335
|
const m = e.split(/\s+/).map((c) => c[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
335
336
|
return /* @__PURE__ */ x(
|
|
336
337
|
"div",
|
|
337
338
|
{
|
|
338
339
|
"data-presence-soft-lock": !0,
|
|
339
|
-
className:
|
|
340
|
+
className: A(
|
|
340
341
|
"flex flex-wrap items-center gap-2 rounded-md px-2 py-1 text-[11.5px]",
|
|
341
342
|
n ? "border border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100" : "text-amber-700 dark:text-amber-300"
|
|
342
343
|
),
|
|
@@ -357,7 +358,7 @@ function se({
|
|
|
357
358
|
"button",
|
|
358
359
|
{
|
|
359
360
|
type: "button",
|
|
360
|
-
onClick:
|
|
361
|
+
onClick: s,
|
|
361
362
|
className: "rounded-md border border-amber-300 px-2 py-0.5 text-[11px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
|
|
362
363
|
children: "Leave it"
|
|
363
364
|
}
|
|
@@ -368,11 +369,12 @@ function se({
|
|
|
368
369
|
);
|
|
369
370
|
}
|
|
370
371
|
export {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
V as FieldAffordancesContext,
|
|
373
|
+
ae as LockReasonBadge,
|
|
374
|
+
le as PresenceSoftLockStrip,
|
|
375
|
+
oe as RemoteChangeGhost,
|
|
376
|
+
j as ghostText,
|
|
377
|
+
re as useFieldAffordances,
|
|
378
|
+
se as useFieldContextMenu,
|
|
379
|
+
ie as usePresenceSoftLock
|
|
378
380
|
};
|