@nivaro/react 0.3.36 → 0.3.38
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/CommentsSlot.js +44 -36
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/shared/components/AgentBadge.js +26 -0
- package/dist/shared/components/AgentQuestionsCard.js +198 -0
- package/dist/shared/components/ItemEditForm.js +3329 -3263
- package/dist/shared/components/McpConnectionScope.js +480 -0
- package/dist/shared/components/MyWorkView.js +223 -208
- package/dist/shared/components/RecordReadView.js +620 -575
- package/dist/shared/components/chat/ChatPanel.js +683 -671
- package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
- package/dist/shared/components/imports/ImportConsole.js +106 -104
- package/dist/shared/components/imports/RunDetailSheet.js +34 -32
- package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
- package/dist/shared/components/item-edit/FormTour.js +279 -0
- package/dist/shared/components/item-edit/GroupSection.js +377 -360
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
- package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
- package/dist/shared/components/item-edit/form-density.js +36 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
- package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
- package/dist/shared/components/layout-editor/AddPanel.js +349 -192
- package/dist/shared/components/layout-editor/DesignNode.js +126 -112
- package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
- package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
- package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
- package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
- package/dist/shared/components/layout-editor/add-target.js +54 -43
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
- package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
- package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
- package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
- package/dist/shared/components/layout-editor/dnd/node.js +115 -105
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
- package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
- package/dist/shared/components/layout-editor/even-row.js +86 -0
- package/dist/shared/components/layout-editor/field-list.js +99 -0
- package/dist/shared/components/layout-editor/format-painter.js +102 -0
- package/dist/shared/components/layout-editor/grid-guides.js +15 -13
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
- package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
- package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
- package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
- package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
- package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
- package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
- package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
- package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
- package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
- package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
- package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
- package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
- package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/pin.js +37 -19
- package/dist/shared/components/layout-editor/place-clip.js +257 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
- package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
- package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
- package/dist/shared/components/layout-editor/removed-log.js +151 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
- package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
- package/dist/shared/components/layout-editor/revert-element.js +140 -0
- package/dist/shared/components/layout-editor/section-structure.js +193 -170
- package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
- package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
- package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
- package/dist/shared/components/layout-editor/shortcuts.js +21 -16
- package/dist/shared/components/layout-editor/structure-ops.js +221 -195
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
- package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
- package/dist/shared/components/panels/CommentPanel.js +47 -45
- package/dist/shared/components/panels/RevisionsPanel.js +66 -64
- package/dist/shared/components/panels/TaskPanel.js +395 -332
- package/dist/shared/components/profile/AgentsPanel.js +196 -147
- package/dist/shared/components/profile/ConnectionRollback.js +329 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
- package/dist/shared/lib/entry-config.js +22 -22
- package/dist/shared/lib/form-usage-beacon.js +91 -55
- package/dist/shared/lib/layout-lint.js +530 -284
- package/dist/shared/lib/layout-resolve.js +58 -44
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronLeft as ie, Undo2 as ce, Redo2 as me, Wrench as ue, Sparkles as he, History as pe, MoreHorizontal as be, Save as z, GitCompare as xe, ChevronDown as X, Eye as Y, X as ge, RotateCcw as ve } from "lucide-react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as E, useMemo as we, useCallback as q, useRef as fe, useEffect as ke } from "react";
|
|
4
4
|
import { useNivaroClient as Ne } from "../../context.js";
|
|
5
5
|
import { useDebounced as ye } from "../../hooks/useDebounced.js";
|
|
6
6
|
import { useRelationOptions as Ce } from "../../hooks/useRelationOptions.js";
|
|
@@ -14,27 +14,28 @@ import { ShareButton as Be, WatchButton as De } from "./collab/FormFollowShare.j
|
|
|
14
14
|
import { HistoryPanel as Ee } from "./HistoryPanel.js";
|
|
15
15
|
import { useRuleChoiceLabels as Le, useDisplayTemplate as Ue, useRoleNames as $e } from "./overview/overview-api.js";
|
|
16
16
|
import { rowPill as Me, purposeSegments as je, TYPE_USE as G, Pill as He, Sentence as Ie } from "./overview/purpose.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
17
|
+
import { SampleRecordChip as We, SampleRecordOffer as Ze } from "./preview/SampleRecord.js";
|
|
18
|
+
import { ScheduleChange as _e } from "./ScheduleChange.js";
|
|
19
|
+
import { barIconBtn as I, BarMenu as D, barIconOn as Fe, MenuSeparator as W, ToolButton as J, barBtnOn as ze, barBtn as Ye } from "./toolbar-kit.js";
|
|
20
|
+
import { unsavedText as L } from "./UnsavedConfirm.js";
|
|
21
|
+
const Ge = "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", K = "mb-1 block text-[11.5px] font-semibold text-slate-600 dark:text-muted-foreground", Je = `
|
|
21
22
|
[data-editor-topbar]{container-type:inline-size;container-name:letb}
|
|
22
23
|
@container letb (max-width: 1499px){[data-editor-topbar] [data-tb-sentence]{display:none}}
|
|
23
24
|
@container letb (max-width: 1399px){[data-editor-topbar] [data-tb-xwide]{display:none}}
|
|
24
25
|
@container letb (max-width: 1099px){[data-editor-topbar] [data-tb-wide],[data-editor-topbar] [data-tb-menu-label]{display:none}}
|
|
25
26
|
@container letb (min-width: 1100px){[data-editor-topbar] [data-tb-name]{min-width:140px}}
|
|
26
27
|
`;
|
|
27
|
-
function
|
|
28
|
+
function Ke({
|
|
28
29
|
draft: i,
|
|
29
30
|
onOpen: a,
|
|
30
31
|
pendingTip: d
|
|
31
32
|
}) {
|
|
32
|
-
const { status: r, error: o } = i,
|
|
33
|
+
const { status: r, error: o } = i, l = i.unsavedCount ?? 0, t = l > 0 && (r === "idle" || r === "saved"), m = r === "saving" ? "Saving…" : r === "error" ? o ?? "Not saved" : r === "conflict" ? l > 0 ? "Not saved — someone else saved" : "Reloaded — someone else saved" : t ? L(l) : "Saved", p = /* @__PURE__ */ n(
|
|
33
34
|
"span",
|
|
34
35
|
{
|
|
35
36
|
role: "status",
|
|
36
37
|
"data-save-status": r,
|
|
37
|
-
"data-unsaved":
|
|
38
|
+
"data-unsaved": l,
|
|
38
39
|
"data-tip": (r === "error" || r === "conflict") && o ? o : t ? d ?? "Only you see these changes until you save (⌘S)" : void 0,
|
|
39
40
|
className: u(
|
|
40
41
|
"inline-flex max-w-[180px] shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2 py-px text-[11px] font-semibold",
|
|
@@ -55,20 +56,20 @@ function Ge({
|
|
|
55
56
|
{
|
|
56
57
|
type: "button",
|
|
57
58
|
"data-unsaved-list-open": "",
|
|
58
|
-
"aria-label": `${
|
|
59
|
+
"aria-label": `${L(l)} — list them`,
|
|
59
60
|
onClick: (b) => a(b.currentTarget),
|
|
60
61
|
className: "inline-flex rounded-full transition-opacity hover:opacity-80",
|
|
61
62
|
children: p
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function Xe({
|
|
66
67
|
icon: i,
|
|
67
68
|
label: a,
|
|
68
69
|
hint: d,
|
|
69
70
|
on: r,
|
|
70
71
|
onChange: o,
|
|
71
|
-
data:
|
|
72
|
+
data: l
|
|
72
73
|
}) {
|
|
73
74
|
return /* @__PURE__ */ n("div", { className: "flex items-start gap-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
|
|
74
75
|
/* @__PURE__ */ e("span", { className: "mt-0.5 text-slate-500 dark:text-muted-foreground", children: i }),
|
|
@@ -84,7 +85,7 @@ function Je({
|
|
|
84
85
|
"aria-checked": r,
|
|
85
86
|
"aria-label": a,
|
|
86
87
|
onClick: () => o(!r),
|
|
87
|
-
...
|
|
88
|
+
...l,
|
|
88
89
|
className: u(
|
|
89
90
|
"relative mt-0.5 h-4 w-7 shrink-0 rounded-full transition-colors",
|
|
90
91
|
r ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-white/35"
|
|
@@ -102,36 +103,36 @@ function Je({
|
|
|
102
103
|
)
|
|
103
104
|
] });
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function qe({
|
|
106
107
|
collection: i,
|
|
107
108
|
value: a,
|
|
108
109
|
onChange: d,
|
|
109
110
|
showHidden: r,
|
|
110
111
|
onShowHidden: o,
|
|
111
|
-
extra:
|
|
112
|
+
extra: l
|
|
112
113
|
}) {
|
|
113
|
-
var
|
|
114
|
-
const t = Ne(), [m, p] =
|
|
115
|
-
search:
|
|
114
|
+
var O, T, P, N;
|
|
115
|
+
const t = Ne(), [m, p] = E(!1), [b, U] = E(""), v = ye(b, 250), { data: w } = Ue(i, m), { data: x = [] } = $e(!0), { options: f, loading: C } = Ce(m ? t : null, i, {
|
|
116
|
+
search: v,
|
|
116
117
|
limit: 8,
|
|
117
|
-
displayTemplate:
|
|
118
|
-
enabled: m &&
|
|
119
|
-
}),
|
|
120
|
-
(
|
|
121
|
-
|
|
122
|
-
(
|
|
118
|
+
displayTemplate: w ?? null,
|
|
119
|
+
enabled: m && w !== void 0
|
|
120
|
+
}), S = Re(Oe).length, k = ((O = x.find((s) => s.id === a.roleId)) == null ? void 0 : O.name) ?? null, R = ((T = x.find((s) => s.id === a.compareRoleId)) == null ? void 0 : T.name) ?? null, $ = [
|
|
121
|
+
a.sample ? "Sample record" : (P = a.record) == null ? void 0 : P.label,
|
|
122
|
+
R && k ? `${k} | ${R}` : k,
|
|
123
|
+
(N = a.state) == null ? void 0 : N.label,
|
|
123
124
|
a.values && Object.keys(a.values).length > 0 ? "What if" : null,
|
|
124
|
-
a.device && a.device !== "desktop" ? a.device === "phone" ? "Phone" : "Tablet" : null,
|
|
125
|
+
a.device && a.device !== "desktop" ? a.device === "phone" ? "Phone" : a.device === "all" ? "All devices" : "Tablet" : null,
|
|
125
126
|
a.who ? "Who sees" : null,
|
|
126
127
|
// #2858 — pretending something is down is a preview mode too: never forgotten on screen.
|
|
127
|
-
|
|
128
|
+
S > 0 ? `${S} down` : null
|
|
128
129
|
].filter(Boolean).join(" · ") || "No record";
|
|
129
130
|
return /* @__PURE__ */ n(Q, { open: m, onOpenChange: p, children: [
|
|
130
131
|
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ n(
|
|
131
132
|
"button",
|
|
132
133
|
{
|
|
133
134
|
type: "button",
|
|
134
|
-
className: u(
|
|
135
|
+
className: u(Ye, "min-w-[110px] max-w-[260px] shrink", m && ze),
|
|
135
136
|
"aria-label": "Preview as",
|
|
136
137
|
"data-preview-as": "",
|
|
137
138
|
"data-tip": "Show the form with a real record’s values, as a role sees it",
|
|
@@ -164,7 +165,14 @@ function Ke({
|
|
|
164
165
|
className: "max-h-[min(80vh,640px)] w-[320px] overflow-y-auto overscroll-contain p-3",
|
|
165
166
|
children: [
|
|
166
167
|
/* @__PURE__ */ e("p", { className: K, children: "Record" }),
|
|
167
|
-
a.
|
|
168
|
+
a.sample ? /* @__PURE__ */ e(
|
|
169
|
+
We,
|
|
170
|
+
{
|
|
171
|
+
collection: i,
|
|
172
|
+
onSample: (s) => d({ ...a, record: null, sample: s }),
|
|
173
|
+
onClear: () => d({ ...a, sample: null })
|
|
174
|
+
}
|
|
175
|
+
) : a.record ? /* @__PURE__ */ n("span", { className: "inline-flex max-w-full items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-slate-800 dark:text-foreground", children: [
|
|
168
176
|
/* @__PURE__ */ e("span", { className: "truncate", children: a.record.label }),
|
|
169
177
|
/* @__PURE__ */ e(
|
|
170
178
|
"button",
|
|
@@ -181,43 +189,55 @@ function Ke({
|
|
|
181
189
|
"input",
|
|
182
190
|
{
|
|
183
191
|
value: b,
|
|
184
|
-
onChange: (
|
|
192
|
+
onChange: (s) => U(s.target.value),
|
|
185
193
|
placeholder: "Search records…",
|
|
186
194
|
"aria-label": "Search records",
|
|
187
|
-
className:
|
|
195
|
+
className: Ge
|
|
188
196
|
}
|
|
189
197
|
),
|
|
190
198
|
/* @__PURE__ */ n("div", { className: "mt-1 max-h-[220px] overflow-y-auto overscroll-contain", children: [
|
|
191
|
-
|
|
199
|
+
f.map((s) => /* @__PURE__ */ e(
|
|
192
200
|
"button",
|
|
193
201
|
{
|
|
194
202
|
type: "button",
|
|
195
|
-
onClick: () => d({
|
|
203
|
+
onClick: () => d({
|
|
204
|
+
...a,
|
|
205
|
+
record: { id: String(s.id), label: s.label },
|
|
206
|
+
sample: null
|
|
207
|
+
}),
|
|
196
208
|
className: "block w-full truncate rounded px-2 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-foreground",
|
|
197
|
-
children:
|
|
209
|
+
children: s.label
|
|
198
210
|
},
|
|
199
|
-
String(
|
|
211
|
+
String(s.id)
|
|
200
212
|
)),
|
|
201
|
-
!
|
|
202
|
-
] })
|
|
213
|
+
!C && f.length === 0 && v.trim() !== "" && /* @__PURE__ */ e("p", { className: "px-2 py-1.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No records match." })
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ e(
|
|
216
|
+
Ze,
|
|
217
|
+
{
|
|
218
|
+
collection: i,
|
|
219
|
+
empty: !C && f.length === 0 && v.trim() === "",
|
|
220
|
+
onSample: (s) => d({ ...a, record: null, sample: s })
|
|
221
|
+
}
|
|
222
|
+
)
|
|
203
223
|
] }),
|
|
204
224
|
/* @__PURE__ */ e("p", { className: u(K, "mt-3"), children: "As a role" }),
|
|
205
225
|
/* @__PURE__ */ e(
|
|
206
226
|
Pe,
|
|
207
227
|
{
|
|
208
228
|
value: a.roleId ?? "",
|
|
209
|
-
onChange: (
|
|
229
|
+
onChange: (s) => d({ ...a, roleId: s || null }),
|
|
210
230
|
ariaLabel: "Preview as role",
|
|
211
231
|
className: "h-8 text-[12.5px]",
|
|
212
232
|
options: [
|
|
213
233
|
{ value: "", label: "Any role" },
|
|
214
|
-
...x.map((
|
|
234
|
+
...x.map((s) => ({ value: s.id, label: s.name }))
|
|
215
235
|
]
|
|
216
236
|
}
|
|
217
237
|
),
|
|
218
238
|
/* @__PURE__ */ e("p", { className: "mt-2 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "The form shows this record’s values, steps and rules. Nothing you do here changes the record." }),
|
|
219
239
|
/* @__PURE__ */ e("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: /* @__PURE__ */ e(
|
|
220
|
-
|
|
240
|
+
Xe,
|
|
221
241
|
{
|
|
222
242
|
icon: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" }),
|
|
223
243
|
label: "Show hidden",
|
|
@@ -227,50 +247,50 @@ function Ke({
|
|
|
227
247
|
data: { "data-show-hidden-switch": "" }
|
|
228
248
|
}
|
|
229
249
|
) }),
|
|
230
|
-
|
|
250
|
+
l
|
|
231
251
|
]
|
|
232
252
|
}
|
|
233
253
|
)
|
|
234
254
|
] });
|
|
235
255
|
}
|
|
236
|
-
function
|
|
256
|
+
function wt({
|
|
237
257
|
collection: i,
|
|
238
258
|
layoutId: a,
|
|
239
259
|
layoutName: d,
|
|
240
260
|
layoutType: r,
|
|
241
261
|
row: o,
|
|
242
|
-
fields:
|
|
262
|
+
fields: l,
|
|
243
263
|
draft: t,
|
|
244
264
|
preview: m,
|
|
245
265
|
onPreview: p,
|
|
246
266
|
showHidden: b,
|
|
247
|
-
onShowHidden:
|
|
248
|
-
onBack:
|
|
249
|
-
backLabel:
|
|
267
|
+
onShowHidden: U,
|
|
268
|
+
onBack: v,
|
|
269
|
+
backLabel: w = "Forms",
|
|
250
270
|
view: x,
|
|
251
|
-
tools:
|
|
252
|
-
ai:
|
|
253
|
-
previewExtra:
|
|
254
|
-
problems:
|
|
255
|
-
more:
|
|
271
|
+
tools: f,
|
|
272
|
+
ai: C,
|
|
273
|
+
previewExtra: S,
|
|
274
|
+
problems: k,
|
|
275
|
+
more: R,
|
|
256
276
|
presence: $,
|
|
257
|
-
onOpenUnsaved:
|
|
258
|
-
pendingTip:
|
|
259
|
-
onSelectField:
|
|
260
|
-
onShowOnCanvas:
|
|
261
|
-
onReviewChanges:
|
|
277
|
+
onOpenUnsaved: O,
|
|
278
|
+
pendingTip: T,
|
|
279
|
+
onSelectField: P,
|
|
280
|
+
onShowOnCanvas: N,
|
|
281
|
+
onReviewChanges: s,
|
|
262
282
|
reviewing: te = !1,
|
|
263
283
|
testing: ae,
|
|
264
284
|
beforeSave: re
|
|
265
285
|
}) {
|
|
266
|
-
const [M, j] =
|
|
286
|
+
const [M, j] = E(
|
|
267
287
|
() => typeof window < "u" && new URLSearchParams(window.location.search).get("history") === "1"
|
|
268
|
-
), h = t.unsavedCount ?? 0, H = o ? Me(o) : null, ne = we(() => o ? [o] : [], [o]), oe = Le(i,
|
|
288
|
+
), h = t.unsavedCount ?? 0, H = o ? Me(o) : null, ne = we(() => o ? [o] : [], [o]), oe = Le(i, l, ne), _ = o ? je(o, l, oe) : G[r] ? [{ text: G[r] }] : [], A = !!t.save && !t.autosave, B = A && h > 0, se = q(
|
|
269
289
|
(c) => {
|
|
270
290
|
var g, F;
|
|
271
|
-
return ((F = (g =
|
|
291
|
+
return ((F = (g = l.find((le) => le.field === c)) == null ? void 0 : g.label) == null ? void 0 : F.trim()) || Se(c);
|
|
272
292
|
},
|
|
273
|
-
[
|
|
293
|
+
[l]
|
|
274
294
|
), de = Te(d);
|
|
275
295
|
return /* @__PURE__ */ n(
|
|
276
296
|
"header",
|
|
@@ -278,22 +298,22 @@ function xt({
|
|
|
278
298
|
"data-editor-topbar": "",
|
|
279
299
|
className: "flex shrink-0 flex-nowrap items-center gap-1.5 overflow-hidden border-b border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card",
|
|
280
300
|
children: [
|
|
281
|
-
/* @__PURE__ */ e("style", { children:
|
|
301
|
+
/* @__PURE__ */ e("style", { children: Je }),
|
|
282
302
|
/* @__PURE__ */ n(
|
|
283
303
|
"button",
|
|
284
304
|
{
|
|
285
305
|
type: "button",
|
|
286
|
-
"aria-label":
|
|
306
|
+
"aria-label": w,
|
|
287
307
|
"data-editor-back": "",
|
|
288
|
-
onClick: (c) =>
|
|
308
|
+
onClick: (c) => v(c.currentTarget),
|
|
289
309
|
className: "inline-flex h-8 shrink-0 items-center gap-0.5 rounded-md pl-1 pr-2 text-[12px] text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
|
|
290
310
|
children: [
|
|
291
311
|
/* @__PURE__ */ e(ie, { className: "h-4 w-4" }),
|
|
292
|
-
/* @__PURE__ */ e("span", { "data-tb-wide": "", children:
|
|
312
|
+
/* @__PURE__ */ e("span", { "data-tb-wide": "", children: w })
|
|
293
313
|
]
|
|
294
314
|
}
|
|
295
315
|
),
|
|
296
|
-
/* @__PURE__ */ e(
|
|
316
|
+
/* @__PURE__ */ e(y, {}),
|
|
297
317
|
/* @__PURE__ */ n("div", { "data-tb-name": "", className: "flex min-w-[64px] flex-1 items-center gap-2", children: [
|
|
298
318
|
/* @__PURE__ */ e(
|
|
299
319
|
"h2",
|
|
@@ -317,7 +337,7 @@ function xt({
|
|
|
317
337
|
),
|
|
318
338
|
$
|
|
319
339
|
] }),
|
|
320
|
-
/* @__PURE__ */ e(
|
|
340
|
+
/* @__PURE__ */ e(y, {}),
|
|
321
341
|
/* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
322
342
|
/* @__PURE__ */ e(
|
|
323
343
|
"button",
|
|
@@ -345,47 +365,47 @@ function xt({
|
|
|
345
365
|
)
|
|
346
366
|
] }),
|
|
347
367
|
x && /* @__PURE__ */ n(Z, { children: [
|
|
348
|
-
/* @__PURE__ */ e(
|
|
368
|
+
/* @__PURE__ */ e(y, {}),
|
|
349
369
|
/* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1", children: x })
|
|
350
370
|
] }),
|
|
351
|
-
/* @__PURE__ */ e(
|
|
371
|
+
/* @__PURE__ */ e(y, {}),
|
|
352
372
|
/* @__PURE__ */ e(
|
|
353
|
-
|
|
373
|
+
qe,
|
|
354
374
|
{
|
|
355
375
|
collection: i,
|
|
356
376
|
value: m,
|
|
357
377
|
onChange: p,
|
|
358
378
|
showHidden: b,
|
|
359
|
-
onShowHidden:
|
|
360
|
-
extra:
|
|
379
|
+
onShowHidden: U,
|
|
380
|
+
extra: S
|
|
361
381
|
}
|
|
362
382
|
),
|
|
363
383
|
/* @__PURE__ */ e(
|
|
364
|
-
|
|
384
|
+
D,
|
|
365
385
|
{
|
|
366
386
|
label: "Tools",
|
|
367
387
|
icon: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" }),
|
|
368
388
|
tip: "Arrange, find, outline, every form, form map and shortcuts",
|
|
369
|
-
children:
|
|
389
|
+
children: f
|
|
370
390
|
}
|
|
371
391
|
),
|
|
372
392
|
/* @__PURE__ */ e(
|
|
373
|
-
|
|
393
|
+
D,
|
|
374
394
|
{
|
|
375
395
|
label: "AI",
|
|
376
396
|
icon: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
377
397
|
tip: "Rebuild, review and ask about this form with AI; type a change",
|
|
378
398
|
width: "w-[320px]",
|
|
379
|
-
children:
|
|
399
|
+
children: C
|
|
380
400
|
}
|
|
381
401
|
),
|
|
382
|
-
|
|
402
|
+
k,
|
|
383
403
|
/* @__PURE__ */ n(Q, { open: M, onOpenChange: j, children: [
|
|
384
404
|
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
385
405
|
"button",
|
|
386
406
|
{
|
|
387
407
|
type: "button",
|
|
388
|
-
className: u(I, M &&
|
|
408
|
+
className: u(I, M && Fe),
|
|
389
409
|
"aria-label": "History",
|
|
390
410
|
"data-tip": "History: saved versions, this session’s steps, restore",
|
|
391
411
|
"data-editor-history": "",
|
|
@@ -409,8 +429,8 @@ function xt({
|
|
|
409
429
|
bundle: t.bundle,
|
|
410
430
|
onApply: (c, g) => t.apply(c, { label: g }),
|
|
411
431
|
fieldLabel: se,
|
|
412
|
-
onShowOnCanvas:
|
|
413
|
-
j(!1),
|
|
432
|
+
onShowOnCanvas: N ? (c, g) => {
|
|
433
|
+
j(!1), N(c, g);
|
|
414
434
|
} : void 0
|
|
415
435
|
}
|
|
416
436
|
)
|
|
@@ -418,7 +438,7 @@ function xt({
|
|
|
418
438
|
)
|
|
419
439
|
] }),
|
|
420
440
|
/* @__PURE__ */ n(
|
|
421
|
-
|
|
441
|
+
D,
|
|
422
442
|
{
|
|
423
443
|
label: "More",
|
|
424
444
|
icon: /* @__PURE__ */ e(be, { className: "h-4 w-4" }),
|
|
@@ -429,18 +449,18 @@ function xt({
|
|
|
429
449
|
children: [
|
|
430
450
|
ae,
|
|
431
451
|
/* @__PURE__ */ e(W, {}),
|
|
432
|
-
/* @__PURE__ */ e(Be, { layoutId: a, fields:
|
|
452
|
+
/* @__PURE__ */ e(Be, { layoutId: a, fields: l, onSelectField: P }),
|
|
433
453
|
/* @__PURE__ */ e(De, { layoutId: a }),
|
|
434
454
|
/* @__PURE__ */ e(W, {}),
|
|
435
|
-
|
|
455
|
+
R
|
|
436
456
|
]
|
|
437
457
|
}
|
|
438
458
|
),
|
|
439
|
-
/* @__PURE__ */ e(
|
|
440
|
-
/* @__PURE__ */ e(
|
|
441
|
-
|
|
459
|
+
/* @__PURE__ */ e(y, {}),
|
|
460
|
+
/* @__PURE__ */ e(Ke, { draft: t, onOpen: O, pendingTip: T }),
|
|
461
|
+
B && t.discard && /* @__PURE__ */ e(Qe, { count: h, onDiscard: t.discard }),
|
|
442
462
|
/* @__PURE__ */ n("div", { "data-save-split": "", className: "flex shrink-0 items-center", children: [
|
|
443
|
-
|
|
463
|
+
A && /* @__PURE__ */ n(
|
|
444
464
|
"button",
|
|
445
465
|
{
|
|
446
466
|
type: "button",
|
|
@@ -450,7 +470,7 @@ function xt({
|
|
|
450
470
|
var c;
|
|
451
471
|
return void ((c = t.save) == null ? void 0 : c.call(t));
|
|
452
472
|
},
|
|
453
|
-
"data-tip": h > 0 ? `Save ${
|
|
473
|
+
"data-tip": h > 0 ? `Save ${L(h)} (⌘S)` : "Nothing to save",
|
|
454
474
|
className: u(
|
|
455
475
|
"inline-flex h-8 items-center gap-1.5 rounded-l-md px-3 text-[12.5px] font-medium transition-opacity disabled:pointer-events-none disabled:opacity-40",
|
|
456
476
|
h > 0 ? "bg-nvr-cyan text-white hover:opacity-90" : "border border-slate-200 text-slate-700 dark:border-border dark:text-foreground"
|
|
@@ -462,34 +482,34 @@ function xt({
|
|
|
462
482
|
}
|
|
463
483
|
),
|
|
464
484
|
/* @__PURE__ */ n(
|
|
465
|
-
|
|
485
|
+
D,
|
|
466
486
|
{
|
|
467
487
|
label: "Save options",
|
|
468
488
|
icon: /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5" }),
|
|
469
489
|
iconOnly: !0,
|
|
470
490
|
align: "end",
|
|
471
491
|
width: "w-[300px]",
|
|
472
|
-
tip:
|
|
492
|
+
tip: A ? "Review, check or schedule the changes; Autosave" : "Autosave",
|
|
473
493
|
className: u(
|
|
474
|
-
|
|
494
|
+
A ? "rounded-l-none border border-l-0 border-slate-200 dark:border-border" : "border border-slate-200 dark:border-border"
|
|
475
495
|
),
|
|
476
496
|
data: { "data-save-menu": "" },
|
|
477
497
|
children: [
|
|
478
|
-
|
|
498
|
+
s && B && /* @__PURE__ */ e(
|
|
479
499
|
J,
|
|
480
500
|
{
|
|
481
501
|
label: "Review changes on canvas",
|
|
482
502
|
icon: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
|
|
483
503
|
hint: "Mark the unsaved changes on the form",
|
|
484
504
|
checked: te,
|
|
485
|
-
onClick:
|
|
505
|
+
onClick: s,
|
|
486
506
|
data: { "data-editor-review": "" }
|
|
487
507
|
}
|
|
488
508
|
),
|
|
489
|
-
|
|
509
|
+
B && re,
|
|
490
510
|
/* @__PURE__ */ e(Ae, { layoutId: a, draft: t }),
|
|
491
|
-
t.unsavedOps && t.discard &&
|
|
492
|
-
|
|
511
|
+
t.unsavedOps && t.discard && B && /* @__PURE__ */ e(
|
|
512
|
+
_e,
|
|
493
513
|
{
|
|
494
514
|
collection: i,
|
|
495
515
|
layoutId: a,
|
|
@@ -525,12 +545,12 @@ function xt({
|
|
|
525
545
|
}
|
|
526
546
|
);
|
|
527
547
|
}
|
|
528
|
-
function
|
|
529
|
-
const [d, r] =
|
|
548
|
+
function Qe({ count: i, onDiscard: a }) {
|
|
549
|
+
const [d, r] = E(!1), o = fe(null), l = q(() => {
|
|
530
550
|
o.current && clearTimeout(o.current), o.current = null, r(!1);
|
|
531
551
|
}, []);
|
|
532
|
-
ke(() =>
|
|
533
|
-
const t = `Discard ${
|
|
552
|
+
ke(() => l, [l]);
|
|
553
|
+
const t = `Discard ${L(i)}`;
|
|
534
554
|
return /* @__PURE__ */ n(
|
|
535
555
|
"button",
|
|
536
556
|
{
|
|
@@ -544,11 +564,11 @@ function Xe({ count: i, onDiscard: a }) {
|
|
|
544
564
|
r(!0), o.current && clearTimeout(o.current), o.current = setTimeout(() => r(!1), 4e3);
|
|
545
565
|
return;
|
|
546
566
|
}
|
|
547
|
-
|
|
567
|
+
l(), a();
|
|
548
568
|
},
|
|
549
|
-
onBlur:
|
|
569
|
+
onBlur: l,
|
|
550
570
|
onKeyDown: (m) => {
|
|
551
|
-
m.key === "Escape" && d && (m.stopPropagation(),
|
|
571
|
+
m.key === "Escape" && d && (m.stopPropagation(), l());
|
|
552
572
|
},
|
|
553
573
|
className: u(
|
|
554
574
|
"inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-[12.5px] font-medium transition-colors",
|
|
@@ -565,10 +585,10 @@ function Xe({ count: i, onDiscard: a }) {
|
|
|
565
585
|
}
|
|
566
586
|
);
|
|
567
587
|
}
|
|
568
|
-
function
|
|
588
|
+
function y() {
|
|
569
589
|
return /* @__PURE__ */ e("span", { "aria-hidden": !0, "data-tb-wide": "", className: "h-5 w-px shrink-0 bg-slate-200 dark:bg-border" });
|
|
570
590
|
}
|
|
571
591
|
export {
|
|
572
|
-
|
|
573
|
-
|
|
592
|
+
Qe as DiscardButton,
|
|
593
|
+
wt as EditorTopBar
|
|
574
594
|
};
|