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