@nivaro/react 0.3.51 → 0.3.53
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as s, jsxs as h, Fragment as me } from "react/jsx-runtime";
|
|
2
|
-
import { Copy as
|
|
3
|
-
import { useContext as we, createContext as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { htmlToText as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { useOverflowTip as
|
|
9
|
-
import { clearPersonalDefault as
|
|
10
|
-
import { PERSONAL_DEFAULT_GHOST_BUTTON as
|
|
2
|
+
import { Copy as Z, History as be, Eye as pe, Sigma as xe, ExternalLink as ye, UserRound as he, UserRoundPen as ge, UserRoundX as ke, Lock as ve, X as re } from "lucide-react";
|
|
3
|
+
import { useContext as we, createContext as Ne, useState as C, useCallback as N, useRef as F, useEffect as B, useLayoutEffect as Ce } from "react";
|
|
4
|
+
import { createPortal as Se } from "react-dom";
|
|
5
|
+
import { toast as w } from "sonner";
|
|
6
|
+
import { htmlToText as Ee } from "../../lib/sanitize-html.js";
|
|
7
|
+
import { cn as ae, formatRelative as ee } from "../../lib/utils.js";
|
|
8
|
+
import { useOverflowTip as Te } from "../TipLayer.js";
|
|
9
|
+
import { clearPersonalDefault as Ue, usePersonalDefaultCss as Le, refusalText as te } from "./PersonalDefaultControl.js";
|
|
10
|
+
import { PERSONAL_DEFAULT_GHOST_BUTTON as Oe } from "./PersonalDefaultPill.js";
|
|
11
11
|
import { usePersonalDefaultsApi as Fe } from "./usePersonalDefaults.js";
|
|
12
|
-
const Me =
|
|
12
|
+
const Me = Ne(null), Ye = () => we(Me), ne = (n) => {
|
|
13
13
|
if (n == null || n === "") return "empty";
|
|
14
14
|
if (typeof n == "boolean") return n ? "Yes" : "No";
|
|
15
15
|
if (typeof n == "object")
|
|
@@ -19,10 +19,10 @@ const Me = ve(null), Ve = () => we(Me), te = (n) => {
|
|
|
19
19
|
} catch {
|
|
20
20
|
return String(n);
|
|
21
21
|
}
|
|
22
|
-
const t = String(n), o = /[<&]/.test(t) ?
|
|
22
|
+
const t = String(n), o = /[<&]/.test(t) ? Ee(t).trim() : t;
|
|
23
23
|
return o.length > 80 ? `${o.slice(0, 80)}…` : o;
|
|
24
24
|
};
|
|
25
|
-
function
|
|
25
|
+
function qe({
|
|
26
26
|
change: n,
|
|
27
27
|
onDismiss: t,
|
|
28
28
|
onTakeTheirs: o
|
|
@@ -39,12 +39,12 @@ function Xe({
|
|
|
39
39
|
n.by ?? "Someone",
|
|
40
40
|
" changed this to",
|
|
41
41
|
" ",
|
|
42
|
-
/* @__PURE__ */ s("span", { className: "font-medium", children:
|
|
42
|
+
/* @__PURE__ */ s("span", { className: "font-medium", children: ne(n.theirs) }),
|
|
43
43
|
" while you were editing",
|
|
44
44
|
/* @__PURE__ */ h("span", { className: "text-amber-700/80 dark:text-amber-200/70", children: [
|
|
45
45
|
" ",
|
|
46
46
|
"· ",
|
|
47
|
-
|
|
47
|
+
ee(n.at)
|
|
48
48
|
] })
|
|
49
49
|
] }),
|
|
50
50
|
/* @__PURE__ */ s(
|
|
@@ -79,13 +79,13 @@ function Xe({
|
|
|
79
79
|
/* @__PURE__ */ h("span", { className: "min-w-0 flex-1", children: [
|
|
80
80
|
"was",
|
|
81
81
|
" ",
|
|
82
|
-
/* @__PURE__ */ s("span", { className: "font-medium line-through decoration-sky-400/70", children:
|
|
82
|
+
/* @__PURE__ */ s("span", { className: "font-medium line-through decoration-sky-400/70", children: ne(n.was) }),
|
|
83
83
|
/* @__PURE__ */ h("span", { className: "text-sky-700/80 dark:text-sky-300/80", children: [
|
|
84
84
|
" ",
|
|
85
85
|
"· ",
|
|
86
86
|
n.by ?? "someone",
|
|
87
87
|
", ",
|
|
88
|
-
|
|
88
|
+
ee(n.at)
|
|
89
89
|
] })
|
|
90
90
|
] }),
|
|
91
91
|
/* @__PURE__ */ s(
|
|
@@ -95,14 +95,14 @@ function Xe({
|
|
|
95
95
|
onClick: t,
|
|
96
96
|
"aria-label": "Dismiss",
|
|
97
97
|
className: "shrink-0 rounded p-0.5 text-sky-500 hover:bg-sky-100 hover:text-sky-800 dark:hover:bg-sky-500/20",
|
|
98
|
-
children: /* @__PURE__ */ s(
|
|
98
|
+
children: /* @__PURE__ */ s(re, { className: "h-3 w-3" })
|
|
99
99
|
}
|
|
100
100
|
)
|
|
101
101
|
]
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function ze({ reason: n, onHover: t }) {
|
|
106
106
|
return /* @__PURE__ */ s(
|
|
107
107
|
"span",
|
|
108
108
|
{
|
|
@@ -112,7 +112,7 @@ function Ye({ reason: n, onHover: t }) {
|
|
|
112
112
|
"data-lock-reason": !0,
|
|
113
113
|
"aria-label": n,
|
|
114
114
|
role: "img",
|
|
115
|
-
children: /* @__PURE__ */ s(
|
|
115
|
+
children: /* @__PURE__ */ s(ve, { className: "h-3 w-3" })
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
118
|
}
|
|
@@ -126,21 +126,21 @@ function Re(n, t) {
|
|
|
126
126
|
const l = n.closest("td, th");
|
|
127
127
|
return l && t.contains(l) ? l.innerText.replace(/\s+/g, " ").trim() : null;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Je({
|
|
130
130
|
wrapperRef: n,
|
|
131
131
|
field: t,
|
|
132
132
|
value: o,
|
|
133
133
|
relations: l,
|
|
134
|
-
collection:
|
|
134
|
+
collection: m,
|
|
135
135
|
itemId: x,
|
|
136
|
-
openRelated:
|
|
137
|
-
editable:
|
|
136
|
+
openRelated: v,
|
|
137
|
+
editable: M = !1
|
|
138
138
|
}) {
|
|
139
|
-
var J,
|
|
140
|
-
const [g, T] = C(null), r = Fe(), [k, S] = C(!1), [y,
|
|
141
|
-
T(null), a(null), S(!1),
|
|
142
|
-
const e =
|
|
143
|
-
|
|
139
|
+
var J, Q;
|
|
140
|
+
const [g, T] = C(null), r = Fe(), [k, S] = C(!1), [y, $] = C(null), [U, A] = C(null), [R, j] = C(!1), b = N((e, c) => T({ x: e, y: c }), []), [D, a] = C(null), f = F(null), L = F(null), i = N(() => {
|
|
141
|
+
T(null), a(null), S(!1), $(null), A(null), j(!1);
|
|
142
|
+
const e = f.current, c = L.current;
|
|
143
|
+
f.current = null, L.current = null, (e || c) && window.setTimeout(() => {
|
|
144
144
|
var u;
|
|
145
145
|
document.activeElement && document.activeElement !== document.body || (e != null && e.isConnected ? e.focus() : (u = c == null ? void 0 : c()) == null || u.focus());
|
|
146
146
|
}, 0);
|
|
@@ -151,13 +151,13 @@ function qe({
|
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
const c = e.getBoundingClientRect();
|
|
154
|
-
_.current = null,
|
|
154
|
+
_.current = null, f.current = e, a("menu"), b(c.left, c.bottom + 4);
|
|
155
155
|
},
|
|
156
156
|
[p, i, b]
|
|
157
157
|
), E = N(() => {
|
|
158
|
-
r && (
|
|
159
|
-
(e) =>
|
|
160
|
-
() =>
|
|
158
|
+
r && ($(null), S("save"), r.describeSave(t.field).then(
|
|
159
|
+
(e) => $(e),
|
|
160
|
+
() => $([])
|
|
161
161
|
));
|
|
162
162
|
}, [r, t.field]), P = N(() => {
|
|
163
163
|
r && (A(null), S("update"), r.describeUpdate(t.field).then(
|
|
@@ -170,18 +170,18 @@ function qe({
|
|
|
170
170
|
i();
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
174
|
-
_.current = null,
|
|
173
|
+
const O = e.getBoundingClientRect();
|
|
174
|
+
_.current = null, f.current = e, L.current = c ?? null, a(u), u === "update" ? P() : E(), b(O.right - oe, O.bottom + 4);
|
|
175
175
|
},
|
|
176
176
|
[p, D, i, b, E, P]
|
|
177
|
-
), _ =
|
|
177
|
+
), _ = F(null), le = N(
|
|
178
178
|
(e) => {
|
|
179
|
-
var
|
|
179
|
+
var O;
|
|
180
180
|
const c = e.target;
|
|
181
|
-
(
|
|
181
|
+
(O = window.getSelection()) != null && O.toString() && c.closest("input, textarea, [contenteditable]") || (e.preventDefault(), _.current = c, a("menu"), b(e.clientX, e.clientY));
|
|
182
182
|
},
|
|
183
183
|
[b]
|
|
184
|
-
),
|
|
184
|
+
), se = N(
|
|
185
185
|
(e) => {
|
|
186
186
|
var c;
|
|
187
187
|
if (e.key === "ContextMenu" || e.shiftKey && e.key === "F10") {
|
|
@@ -192,95 +192,95 @@ function qe({
|
|
|
192
192
|
},
|
|
193
193
|
[b, n]
|
|
194
194
|
), I = l.find(
|
|
195
|
-
(e) => e.many_collection ===
|
|
195
|
+
(e) => e.many_collection === m && e.many_field === t.field && e.one_collection
|
|
196
196
|
), K = x && x !== "new", W = (e) => {
|
|
197
197
|
var u;
|
|
198
198
|
const c = (u = n.current) == null ? void 0 : u.querySelector(e);
|
|
199
199
|
return c ? (c.click(), !0) : !1;
|
|
200
|
-
},
|
|
200
|
+
}, X = !!(r != null && r.allowed(t.field)) && r.manageable(t.field), Y = X && M && !!(r != null && r.hasValue(t.field)), G = X ? (r == null ? void 0 : r.defaultFor(t.field)) ?? null : null, ie = Y && !G, ce = Y && !!G && !(r != null && r.isDefault(t.field)), q = [
|
|
201
201
|
{
|
|
202
202
|
key: "copy",
|
|
203
203
|
label: "Copy value",
|
|
204
|
-
icon: /* @__PURE__ */ s(
|
|
204
|
+
icon: /* @__PURE__ */ s(Z, { className: "h-3.5 w-3.5" }),
|
|
205
205
|
run: () => {
|
|
206
206
|
const c = Re(_.current, n.current) ?? (o == null ? "" : typeof o == "object" ? JSON.stringify(o) : String(o));
|
|
207
207
|
if (!c) {
|
|
208
|
-
|
|
208
|
+
w.info("Nothing to copy");
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
navigator.clipboard.writeText(c).then(
|
|
212
|
-
() =>
|
|
213
|
-
() =>
|
|
212
|
+
() => w.success("Value copied"),
|
|
213
|
+
() => w.error("Could not copy")
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
key: "copy-key",
|
|
219
219
|
label: "Copy field key",
|
|
220
|
-
icon: /* @__PURE__ */ s(
|
|
220
|
+
icon: /* @__PURE__ */ s(Z, { className: "h-3.5 w-3.5" }),
|
|
221
221
|
hint: t.field,
|
|
222
222
|
run: () => {
|
|
223
223
|
navigator.clipboard.writeText(t.field).then(
|
|
224
|
-
() =>
|
|
225
|
-
() =>
|
|
224
|
+
() => w.success(`Copied “${t.field}”`),
|
|
225
|
+
() => w.error("Could not copy")
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
230
|
key: "history",
|
|
231
231
|
label: "Value history",
|
|
232
|
-
icon: /* @__PURE__ */ s(
|
|
232
|
+
icon: /* @__PURE__ */ s(be, { className: "h-3.5 w-3.5" }),
|
|
233
233
|
disabled: !K,
|
|
234
234
|
run: () => {
|
|
235
|
-
W("[data-field-history]") ||
|
|
235
|
+
W("[data-field-history]") || w.info("No history for this field yet");
|
|
236
236
|
}
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
key: "watch",
|
|
240
240
|
label: "Watch this field",
|
|
241
|
-
icon: /* @__PURE__ */ s(
|
|
241
|
+
icon: /* @__PURE__ */ s(pe, { className: "h-3.5 w-3.5" }),
|
|
242
242
|
disabled: !K,
|
|
243
243
|
run: () => {
|
|
244
|
-
W("[data-field-watch]") ||
|
|
244
|
+
W("[data-field-watch]") || w.info("Field watching is off — an admin can enable it in Settings → Content");
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
{
|
|
248
248
|
key: "explain",
|
|
249
249
|
label: "Explain value",
|
|
250
|
-
icon: /* @__PURE__ */ s(
|
|
250
|
+
icon: /* @__PURE__ */ s(xe, { className: "h-3.5 w-3.5" }),
|
|
251
251
|
disabled: !K || !((J = n.current) != null && J.querySelector("[data-field-lineage]")),
|
|
252
252
|
run: () => {
|
|
253
253
|
W("[data-field-lineage]");
|
|
254
254
|
}
|
|
255
255
|
},
|
|
256
|
-
...I &&
|
|
256
|
+
...I && v ? [
|
|
257
257
|
{
|
|
258
258
|
key: "open",
|
|
259
|
-
label: `Open related ${(
|
|
260
|
-
icon: /* @__PURE__ */ s(
|
|
259
|
+
label: `Open related ${(Q = I.one_collection) == null ? void 0 : Q.replace(/_/g, " ")}`,
|
|
260
|
+
icon: /* @__PURE__ */ s(ye, { className: "h-3.5 w-3.5" }),
|
|
261
261
|
disabled: o == null || o === "",
|
|
262
262
|
run: () => {
|
|
263
263
|
const e = typeof o == "object" && o && "id" in o ? String(o.id) : String(o);
|
|
264
|
-
|
|
264
|
+
v(String(I.one_collection), e);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
] : [],
|
|
268
268
|
// Same states as the visible control: no default here → Save; a default holding another
|
|
269
269
|
// value → Update (that default, in place); the value IS the default → only Clear.
|
|
270
|
-
...
|
|
270
|
+
...ie ? [
|
|
271
271
|
{
|
|
272
272
|
key: "save-default",
|
|
273
273
|
label: "Save as my default",
|
|
274
|
-
icon: /* @__PURE__ */ s(
|
|
274
|
+
icon: /* @__PURE__ */ s(he, { className: "h-3.5 w-3.5" }),
|
|
275
275
|
stay: !0,
|
|
276
276
|
run: E
|
|
277
277
|
}
|
|
278
278
|
] : [],
|
|
279
|
-
...
|
|
279
|
+
...ce ? [
|
|
280
280
|
{
|
|
281
281
|
key: "update-default",
|
|
282
282
|
label: "Update my default",
|
|
283
|
-
icon: /* @__PURE__ */ s(
|
|
283
|
+
icon: /* @__PURE__ */ s(ge, { className: "h-3.5 w-3.5" }),
|
|
284
284
|
stay: !0,
|
|
285
285
|
run: P
|
|
286
286
|
}
|
|
@@ -289,30 +289,30 @@ function qe({
|
|
|
289
289
|
{
|
|
290
290
|
key: "clear-default",
|
|
291
291
|
label: "Clear my default",
|
|
292
|
-
icon: /* @__PURE__ */ s(
|
|
292
|
+
icon: /* @__PURE__ */ s(ke, { className: "h-3.5 w-3.5" }),
|
|
293
293
|
// Runs at once (a menu pick is deliberate); the toast's Undo saves it back.
|
|
294
294
|
run: () => {
|
|
295
|
-
|
|
295
|
+
Ue(r, t.field);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
] : []
|
|
299
|
-
],
|
|
300
|
-
const u = e.value ? ` to ${e.value}` : "",
|
|
301
|
-
return c ? `Updated your default${
|
|
302
|
-
},
|
|
299
|
+
], z = (e, c) => {
|
|
300
|
+
const u = e.value ? ` to ${e.value}` : "", O = e.context.length ? ` for ${e.context.join(" · ")}` : "";
|
|
301
|
+
return c ? `Updated your default${O}${u}` : `Update your default${O}${u}?`;
|
|
302
|
+
}, de = k === "update" && r ? {
|
|
303
303
|
label: "Update my default",
|
|
304
304
|
action: "Update",
|
|
305
|
-
text: U ?
|
|
306
|
-
ready: U !== null &&
|
|
307
|
-
saving:
|
|
305
|
+
text: U ? z(U, !1) : "Update your default?",
|
|
306
|
+
ready: U !== null && !R,
|
|
307
|
+
saving: R,
|
|
308
308
|
onCancel: i,
|
|
309
309
|
onSave: () => {
|
|
310
310
|
j(!0), r.update(t.field).then(
|
|
311
311
|
() => {
|
|
312
|
-
|
|
312
|
+
w.success(U ? z(U, !0) : "Updated your default"), i();
|
|
313
313
|
},
|
|
314
314
|
(e) => {
|
|
315
|
-
|
|
315
|
+
w.error(te(e, "Could not update your default")), i();
|
|
316
316
|
}
|
|
317
317
|
);
|
|
318
318
|
}
|
|
@@ -320,61 +320,61 @@ function qe({
|
|
|
320
320
|
label: "Save as my default",
|
|
321
321
|
action: "Save",
|
|
322
322
|
text: y != null && y.length ? `Save ${y.join(" · ")} as your ${y.length > 1 ? "defaults" : "default"}?` : "Save as your default?",
|
|
323
|
-
ready: y !== null &&
|
|
324
|
-
saving:
|
|
323
|
+
ready: y !== null && !R,
|
|
324
|
+
saving: R,
|
|
325
325
|
onCancel: i,
|
|
326
326
|
onSave: () => {
|
|
327
327
|
j(!0), r.save(t.field).then(
|
|
328
328
|
() => {
|
|
329
|
-
|
|
329
|
+
w.success(
|
|
330
330
|
y != null && y.length ? `Saved ${y.join(" · ")} as your default${y.length > 1 ? "s" : ""}` : "Your default was saved"
|
|
331
331
|
), i();
|
|
332
332
|
},
|
|
333
333
|
(e) => {
|
|
334
|
-
|
|
334
|
+
w.error(te(e, "Could not save your default")), i();
|
|
335
335
|
}
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
|
-
} : null,
|
|
339
|
-
|
|
338
|
+
} : null, ue = g ? /* @__PURE__ */ s(
|
|
339
|
+
Ae,
|
|
340
340
|
{
|
|
341
341
|
at: g,
|
|
342
|
-
items:
|
|
342
|
+
items: q,
|
|
343
343
|
onClose: i,
|
|
344
|
-
confirm:
|
|
344
|
+
confirm: de,
|
|
345
345
|
anchor: n.current
|
|
346
346
|
}
|
|
347
|
-
) : null,
|
|
347
|
+
) : null, fe = q.some(
|
|
348
348
|
(e) => e.key === "save-default" || e.key === "update-default" || e.key === "clear-default"
|
|
349
349
|
);
|
|
350
350
|
return {
|
|
351
|
-
onContextMenu:
|
|
352
|
-
onKeyDown:
|
|
353
|
-
menu:
|
|
351
|
+
onContextMenu: le,
|
|
352
|
+
onKeyDown: se,
|
|
353
|
+
menu: ue,
|
|
354
354
|
openFrom: d,
|
|
355
355
|
isOpen: p,
|
|
356
|
-
hasFieldItems:
|
|
356
|
+
hasFieldItems: fe,
|
|
357
357
|
confirmSaveFrom: H,
|
|
358
358
|
openedBy: D
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
|
-
const
|
|
362
|
-
function
|
|
361
|
+
const oe = 240, $e = "[data-field-menu-trigger], [data-personal-default-make], [data-personal-default-update]";
|
|
362
|
+
function Ae({
|
|
363
363
|
at: n,
|
|
364
364
|
items: t,
|
|
365
365
|
onClose: o,
|
|
366
366
|
confirm: l,
|
|
367
|
-
anchor:
|
|
367
|
+
anchor: m
|
|
368
368
|
}) {
|
|
369
|
-
|
|
370
|
-
const x =
|
|
369
|
+
Le();
|
|
370
|
+
const x = F(null), [v, M] = C(0), g = t.filter((a) => !a.disabled);
|
|
371
371
|
B(() => {
|
|
372
372
|
var L;
|
|
373
373
|
const a = (i) => {
|
|
374
374
|
var d, E;
|
|
375
375
|
const p = i.target;
|
|
376
|
-
(d = x.current) != null && d.contains(p) || (E = p == null ? void 0 : p.closest) != null && E.call(p, $e) && (
|
|
377
|
-
},
|
|
376
|
+
(d = x.current) != null && d.contains(p) || (E = p == null ? void 0 : p.closest) != null && E.call(p, $e) && (m != null && m.contains(p)) || o();
|
|
377
|
+
}, f = (i) => {
|
|
378
378
|
var p;
|
|
379
379
|
if (i.key === "Escape")
|
|
380
380
|
i.preventDefault(), o();
|
|
@@ -390,44 +390,44 @@ function Oe({
|
|
|
390
390
|
}
|
|
391
391
|
return;
|
|
392
392
|
} else if (i.key === "ArrowDown")
|
|
393
|
-
i.preventDefault(),
|
|
393
|
+
i.preventDefault(), M((d) => (d + 1) % Math.max(1, g.length));
|
|
394
394
|
else if (i.key === "ArrowUp")
|
|
395
|
-
i.preventDefault(),
|
|
395
|
+
i.preventDefault(), M((d) => (d - 1 + Math.max(1, g.length)) % Math.max(1, g.length));
|
|
396
396
|
else if (i.key === "Enter" || i.key === " ") {
|
|
397
397
|
i.preventDefault();
|
|
398
|
-
const d = g[
|
|
398
|
+
const d = g[v];
|
|
399
399
|
d && (d.run(), d.stay || o());
|
|
400
400
|
}
|
|
401
401
|
};
|
|
402
|
-
return window.addEventListener("mousedown", a, !0), window.addEventListener("keydown",
|
|
403
|
-
window.removeEventListener("mousedown", a, !0), window.removeEventListener("keydown",
|
|
402
|
+
return window.addEventListener("mousedown", a, !0), window.addEventListener("keydown", f, !0), (L = x.current) == null || L.focus(), () => {
|
|
403
|
+
window.removeEventListener("mousedown", a, !0), window.removeEventListener("keydown", f, !0);
|
|
404
404
|
};
|
|
405
|
-
}, [o, g,
|
|
406
|
-
const T =
|
|
405
|
+
}, [o, g, v, l, m]);
|
|
406
|
+
const T = F(null), r = F(null), k = !!l, S = !!(l != null && l.ready);
|
|
407
407
|
B(() => {
|
|
408
408
|
var a;
|
|
409
409
|
k && ((a = r.current) == null || a.focus());
|
|
410
410
|
}, [k]), B(() => {
|
|
411
|
-
var
|
|
411
|
+
var f;
|
|
412
412
|
if (!S) return;
|
|
413
413
|
const a = document.activeElement;
|
|
414
|
-
(a === r.current || a === x.current || a === document.body) && ((
|
|
414
|
+
(a === r.current || a === x.current || a === document.body) && ((f = T.current) == null || f.focus());
|
|
415
415
|
}, [S]);
|
|
416
|
-
const y = Math.min(
|
|
417
|
-
|
|
418
|
-
var
|
|
419
|
-
const a = (
|
|
416
|
+
const y = Math.min(oe, window.innerWidth - 16), $ = Te(l == null ? void 0 : l.text), [U, A] = C(() => l ? 96 : t.length * 30 + 12);
|
|
417
|
+
Ce(() => {
|
|
418
|
+
var f;
|
|
419
|
+
const a = (f = x.current) == null ? void 0 : f.offsetHeight;
|
|
420
420
|
a && a !== U && A(a);
|
|
421
421
|
});
|
|
422
|
-
const
|
|
422
|
+
const R = Math.max(8, Math.min(n.x, window.innerWidth - y - 8)), j = Math.max(8, Math.min(n.y, window.innerHeight - U - 8)), b = (m == null ? void 0 : m.closest('[role="dialog"]')) ?? document.body, D = b === document.body ? { position: "fixed", left: R, top: j } : (() => {
|
|
423
423
|
const a = b.getBoundingClientRect();
|
|
424
424
|
return {
|
|
425
425
|
position: "absolute",
|
|
426
|
-
left:
|
|
426
|
+
left: R - a.left + b.scrollLeft - b.clientLeft,
|
|
427
427
|
top: j - a.top + b.scrollTop - b.clientTop
|
|
428
428
|
};
|
|
429
429
|
})();
|
|
430
|
-
return
|
|
430
|
+
return Se(
|
|
431
431
|
/* @__PURE__ */ h(
|
|
432
432
|
"div",
|
|
433
433
|
{
|
|
@@ -442,7 +442,7 @@ function Oe({
|
|
|
442
442
|
/* @__PURE__ */ s(
|
|
443
443
|
"p",
|
|
444
444
|
{
|
|
445
|
-
ref:
|
|
445
|
+
ref: $,
|
|
446
446
|
"aria-live": "polite",
|
|
447
447
|
className: "line-clamp-4 text-[12.5px] leading-snug text-slate-700 [overflow-wrap:anywhere] dark:text-slate-200",
|
|
448
448
|
children: l.text
|
|
@@ -455,9 +455,9 @@ function Oe({
|
|
|
455
455
|
ref: r,
|
|
456
456
|
type: "button",
|
|
457
457
|
onClick: l.onCancel,
|
|
458
|
-
className:
|
|
458
|
+
className: Oe,
|
|
459
459
|
children: [
|
|
460
|
-
/* @__PURE__ */ s(
|
|
460
|
+
/* @__PURE__ */ s(re, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
461
461
|
" Cancel"
|
|
462
462
|
]
|
|
463
463
|
}
|
|
@@ -476,18 +476,18 @@ function Oe({
|
|
|
476
476
|
] })
|
|
477
477
|
] }) : null,
|
|
478
478
|
l ? null : t.map((a) => {
|
|
479
|
-
const
|
|
479
|
+
const f = g.indexOf(a), L = f === v && !a.disabled;
|
|
480
480
|
return /* @__PURE__ */ h(
|
|
481
481
|
"button",
|
|
482
482
|
{
|
|
483
483
|
type: "button",
|
|
484
484
|
role: "menuitem",
|
|
485
485
|
disabled: a.disabled,
|
|
486
|
-
onMouseEnter: () =>
|
|
486
|
+
onMouseEnter: () => f >= 0 && M(f),
|
|
487
487
|
onClick: () => {
|
|
488
488
|
a.run(), a.stay || o();
|
|
489
489
|
},
|
|
490
|
-
className:
|
|
490
|
+
className: ae(
|
|
491
491
|
"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",
|
|
492
492
|
L && "bg-accent text-accent-foreground",
|
|
493
493
|
a.disabled && "cursor-not-allowed opacity-40"
|
|
@@ -507,8 +507,15 @@ function Oe({
|
|
|
507
507
|
b
|
|
508
508
|
);
|
|
509
509
|
}
|
|
510
|
-
|
|
511
|
-
|
|
510
|
+
const V = /* @__PURE__ */ new Set();
|
|
511
|
+
function Qe(n, t) {
|
|
512
|
+
t ? V.add(n) : V.delete(n);
|
|
513
|
+
}
|
|
514
|
+
function je() {
|
|
515
|
+
return V.size > 0;
|
|
516
|
+
}
|
|
517
|
+
function Ze(n) {
|
|
518
|
+
const [t, o] = C(null), [l, m] = C(!1), x = F(!1), v = F(null);
|
|
512
519
|
B(() => {
|
|
513
520
|
const r = n.current;
|
|
514
521
|
if (!r) return;
|
|
@@ -517,43 +524,43 @@ function Je(n) {
|
|
|
517
524
|
const S = new MutationObserver(k);
|
|
518
525
|
return S.observe(r, { attributes: !0, attributeFilter: ["data-remote-editor"] }), () => S.disconnect();
|
|
519
526
|
}, [n]), B(() => {
|
|
520
|
-
t || (
|
|
527
|
+
t || (m(!1), x.current = !1);
|
|
521
528
|
}, [t]);
|
|
522
|
-
const
|
|
529
|
+
const M = N(
|
|
523
530
|
(r) => {
|
|
524
|
-
if (!t || x.current) return;
|
|
531
|
+
if (!t || x.current || je()) return;
|
|
525
532
|
const k = r.target;
|
|
526
|
-
k.matches('input, textarea, select, [contenteditable="true"], [role="combobox"]') && (
|
|
533
|
+
k.matches('input, textarea, select, [contenteditable="true"], [role="combobox"]') && (v.current = k, setTimeout(() => {
|
|
527
534
|
x.current || k.blur();
|
|
528
|
-
}, 0),
|
|
535
|
+
}, 0), m(!0));
|
|
529
536
|
},
|
|
530
537
|
[t]
|
|
531
538
|
), g = N(() => {
|
|
532
|
-
x.current = !0,
|
|
533
|
-
const r =
|
|
534
|
-
|
|
539
|
+
x.current = !0, m(!1);
|
|
540
|
+
const r = v.current;
|
|
541
|
+
v.current = null, r && setTimeout(() => r.focus(), 0);
|
|
535
542
|
}, []), T = N(() => {
|
|
536
|
-
|
|
543
|
+
m(!1), v.current = null;
|
|
537
544
|
}, []);
|
|
538
|
-
return { editor: t, confirming: l, onFocusCapture:
|
|
545
|
+
return { editor: t, confirming: l, onFocusCapture: M, confirm: g, cancel: T };
|
|
539
546
|
}
|
|
540
|
-
function
|
|
547
|
+
function et({
|
|
541
548
|
editor: n,
|
|
542
549
|
confirming: t,
|
|
543
550
|
onConfirm: o,
|
|
544
551
|
onCancel: l
|
|
545
552
|
}) {
|
|
546
|
-
const
|
|
553
|
+
const m = n.split(/\s+/).map((x) => x[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
547
554
|
return /* @__PURE__ */ h(
|
|
548
555
|
"div",
|
|
549
556
|
{
|
|
550
557
|
"data-presence-soft-lock": !0,
|
|
551
|
-
className:
|
|
558
|
+
className: ae(
|
|
552
559
|
"flex flex-wrap items-center gap-2 rounded-md px-2 py-1 text-[11.5px]",
|
|
553
560
|
t ? "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"
|
|
554
561
|
),
|
|
555
562
|
children: [
|
|
556
|
-
/* @__PURE__ */ s("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-amber-200 text-[9px] font-semibold text-amber-900 dark:bg-amber-500/40 dark:text-amber-50", children:
|
|
563
|
+
/* @__PURE__ */ s("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-amber-200 text-[9px] font-semibold text-amber-900 dark:bg-amber-500/40 dark:text-amber-50", children: m || "?" }),
|
|
557
564
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: t ? `${n} is typing here — edit anyway?` : `${n} is editing this field` }),
|
|
558
565
|
t && /* @__PURE__ */ h(me, { children: [
|
|
559
566
|
/* @__PURE__ */ s(
|
|
@@ -581,11 +588,13 @@ function ze({
|
|
|
581
588
|
}
|
|
582
589
|
export {
|
|
583
590
|
Me as FieldAffordancesContext,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
+
ze as LockReasonBadge,
|
|
592
|
+
et as PresenceSoftLockStrip,
|
|
593
|
+
qe as RemoteChangeGhost,
|
|
594
|
+
ne as ghostText,
|
|
595
|
+
je as holdsLockByTakeOver,
|
|
596
|
+
Qe as noteTakeOverHold,
|
|
597
|
+
Ye as useFieldAffordances,
|
|
598
|
+
Je as useFieldContextMenu,
|
|
599
|
+
Ze as usePresenceSoftLock
|
|
591
600
|
};
|