@nivaro/react 0.3.34 → 0.3.36
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 +5 -4
- package/dist/shared/components/ItemEditForm.js +2009 -1996
- package/dist/shared/components/RecordReadView.js +88 -85
- package/dist/shared/components/item-edit/FieldAffordances.js +351 -307
- package/dist/shared/components/item-edit/FieldRow.js +453 -447
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +228 -0
- package/dist/shared/components/item-edit/PersonalDefaultPill.js +9 -39
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -110
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +27 -27
- package/dist/shared/components/item-edit/live-record-marks.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +314 -230
- package/dist/shared/components/layout-editor/DesignNode.js +79 -78
- package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
- package/dist/shared/components/layout-editor/EditorTopBar.js +230 -188
- package/dist/shared/components/layout-editor/LayoutEditor.js +370 -369
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +218 -182
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +68 -0
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +4 -4
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +52 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +1 -1
- package/dist/shared/components/layout-editor/panel-frame.js +1 -1
- package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +2 -2
- package/package.json +1 -1
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ChevronLeft as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useNivaroClient as
|
|
5
|
-
import { useDebounced as
|
|
6
|
-
import { useRelationOptions as
|
|
7
|
-
import { titleCase as
|
|
8
|
-
import { usePretendDownIds as
|
|
9
|
-
import { useOverflowTip as
|
|
10
|
-
import { Popover as
|
|
11
|
-
import { SimpleSelect as
|
|
12
|
-
import { AiChangeCheck as
|
|
13
|
-
import { ShareButton as
|
|
14
|
-
import { HistoryPanel as
|
|
15
|
-
import { useRuleChoiceLabels as
|
|
16
|
-
import { rowPill as
|
|
17
|
-
import { ScheduleChange as
|
|
18
|
-
import { barIconBtn as
|
|
19
|
-
import { unsavedText as
|
|
20
|
-
const
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as Z } from "react/jsx-runtime";
|
|
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 B, useMemo as we, useCallback as q, useRef as fe, useEffect as ke } from "react";
|
|
4
|
+
import { useNivaroClient as Ne } from "../../context.js";
|
|
5
|
+
import { useDebounced as ye } from "../../hooks/useDebounced.js";
|
|
6
|
+
import { useRelationOptions as Ce } from "../../hooks/useRelationOptions.js";
|
|
7
|
+
import { titleCase as Se, cn as u } from "../../lib/utils.js";
|
|
8
|
+
import { usePretendDownIds as Re, LAYOUT_PRETEND_SCOPE as Oe } from "../PretendDown.js";
|
|
9
|
+
import { useOverflowTip as Te } from "../TipLayer.js";
|
|
10
|
+
import { Popover as Q, PopoverTrigger as V, PopoverContent as ee } from "../ui/popover.js";
|
|
11
|
+
import { SimpleSelect as Pe } from "../ui/SimpleSelect.js";
|
|
12
|
+
import { AiChangeCheck as Ae } from "./ai/ChangeCheck.js";
|
|
13
|
+
import { ShareButton as Be, WatchButton as De } from "./collab/FormFollowShare.js";
|
|
14
|
+
import { HistoryPanel as Ee } from "./HistoryPanel.js";
|
|
15
|
+
import { useRuleChoiceLabels as Le, useDisplayTemplate as Ue, useRoleNames as $e } from "./overview/overview-api.js";
|
|
16
|
+
import { rowPill as Me, purposeSegments as je, TYPE_USE as G, Pill as He, Sentence as Ie } from "./overview/purpose.js";
|
|
17
|
+
import { ScheduleChange as We } from "./ScheduleChange.js";
|
|
18
|
+
import { barIconBtn as I, BarMenu as A, barIconOn as Ze, MenuSeparator as W, ToolButton as J, barBtnOn as _e, barBtn as Fe } from "./toolbar-kit.js";
|
|
19
|
+
import { unsavedText as D } from "./UnsavedConfirm.js";
|
|
20
|
+
const ze = "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", Ye = `
|
|
21
21
|
[data-editor-topbar]{container-type:inline-size;container-name:letb}
|
|
22
22
|
@container letb (max-width: 1499px){[data-editor-topbar] [data-tb-sentence]{display:none}}
|
|
23
23
|
@container letb (max-width: 1399px){[data-editor-topbar] [data-tb-xwide]{display:none}}
|
|
24
24
|
@container letb (max-width: 1099px){[data-editor-topbar] [data-tb-wide],[data-editor-topbar] [data-tb-menu-label]{display:none}}
|
|
25
25
|
@container letb (min-width: 1100px){[data-editor-topbar] [data-tb-name]{min-width:140px}}
|
|
26
26
|
`;
|
|
27
|
-
function
|
|
27
|
+
function Ge({
|
|
28
28
|
draft: i,
|
|
29
29
|
onOpen: a,
|
|
30
|
-
pendingTip:
|
|
30
|
+
pendingTip: d
|
|
31
31
|
}) {
|
|
32
|
-
const { status:
|
|
32
|
+
const { status: r, error: o } = i, s = i.unsavedCount ?? 0, t = s > 0 && (r === "idle" || r === "saved"), m = r === "saving" ? "Saving…" : r === "error" ? o ?? "Not saved" : r === "conflict" ? s > 0 ? "Not saved — someone else saved" : "Reloaded — someone else saved" : t ? D(s) : "Saved", p = /* @__PURE__ */ n(
|
|
33
33
|
"span",
|
|
34
34
|
{
|
|
35
35
|
role: "status",
|
|
36
|
-
"data-save-status":
|
|
37
|
-
"data-unsaved":
|
|
38
|
-
"data-tip": (
|
|
39
|
-
className:
|
|
36
|
+
"data-save-status": r,
|
|
37
|
+
"data-unsaved": s,
|
|
38
|
+
"data-tip": (r === "error" || r === "conflict") && o ? o : t ? d ?? "Only you see these changes until you save (⌘S)" : void 0,
|
|
39
|
+
className: u(
|
|
40
40
|
"inline-flex max-w-[180px] shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2 py-px text-[11px] font-semibold",
|
|
41
|
-
|
|
42
|
-
(
|
|
41
|
+
r === "saving" && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
|
|
42
|
+
(r === "saved" || r === "idle") && !t && "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
|
|
43
43
|
t && "bg-nvr-cyan/10 text-slate-700 dark:text-foreground",
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
r === "error" && "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
|
|
45
|
+
r === "conflict" && "bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300"
|
|
46
46
|
),
|
|
47
47
|
children: [
|
|
48
48
|
t && /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan" }),
|
|
@@ -50,51 +50,51 @@ function Fe({
|
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
return !t || !a ?
|
|
53
|
+
return !t || !a ? p : /* @__PURE__ */ e(
|
|
54
54
|
"button",
|
|
55
55
|
{
|
|
56
56
|
type: "button",
|
|
57
57
|
"data-unsaved-list-open": "",
|
|
58
|
-
"aria-label": `${
|
|
58
|
+
"aria-label": `${D(s)} — list them`,
|
|
59
59
|
onClick: (b) => a(b.currentTarget),
|
|
60
60
|
className: "inline-flex rounded-full transition-opacity hover:opacity-80",
|
|
61
|
-
children:
|
|
61
|
+
children: p
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Je({
|
|
66
66
|
icon: i,
|
|
67
67
|
label: a,
|
|
68
|
-
hint:
|
|
69
|
-
on:
|
|
70
|
-
onChange:
|
|
71
|
-
data:
|
|
68
|
+
hint: d,
|
|
69
|
+
on: r,
|
|
70
|
+
onChange: o,
|
|
71
|
+
data: s
|
|
72
72
|
}) {
|
|
73
|
-
return /* @__PURE__ */
|
|
73
|
+
return /* @__PURE__ */ n("div", { className: "flex items-start gap-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
|
|
74
74
|
/* @__PURE__ */ e("span", { className: "mt-0.5 text-slate-500 dark:text-muted-foreground", children: i }),
|
|
75
|
-
/* @__PURE__ */
|
|
75
|
+
/* @__PURE__ */ n("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
76
76
|
/* @__PURE__ */ e("span", { className: "font-medium", children: a }),
|
|
77
|
-
/* @__PURE__ */ e("span", { className: "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children:
|
|
77
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: d })
|
|
78
78
|
] }),
|
|
79
79
|
/* @__PURE__ */ e(
|
|
80
80
|
"button",
|
|
81
81
|
{
|
|
82
82
|
type: "button",
|
|
83
83
|
role: "switch",
|
|
84
|
-
"aria-checked":
|
|
84
|
+
"aria-checked": r,
|
|
85
85
|
"aria-label": a,
|
|
86
|
-
onClick: () =>
|
|
87
|
-
...
|
|
88
|
-
className:
|
|
86
|
+
onClick: () => o(!r),
|
|
87
|
+
...s,
|
|
88
|
+
className: u(
|
|
89
89
|
"relative mt-0.5 h-4 w-7 shrink-0 rounded-full transition-colors",
|
|
90
|
-
|
|
90
|
+
r ? "bg-nvr-cyan" : "bg-slate-300 dark:bg-white/35"
|
|
91
91
|
),
|
|
92
92
|
children: /* @__PURE__ */ e(
|
|
93
93
|
"span",
|
|
94
94
|
{
|
|
95
|
-
className:
|
|
95
|
+
className: u(
|
|
96
96
|
"absolute left-0 top-0.5 h-3 w-3 rounded-full bg-white shadow-sm transition-transform",
|
|
97
|
-
|
|
97
|
+
r ? "translate-x-3.5" : "translate-x-0.5"
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
)
|
|
@@ -102,22 +102,22 @@ function ze({
|
|
|
102
102
|
)
|
|
103
103
|
] });
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Ke({
|
|
106
106
|
collection: i,
|
|
107
107
|
value: a,
|
|
108
|
-
onChange:
|
|
109
|
-
showHidden:
|
|
110
|
-
onShowHidden:
|
|
111
|
-
extra:
|
|
108
|
+
onChange: d,
|
|
109
|
+
showHidden: r,
|
|
110
|
+
onShowHidden: o,
|
|
111
|
+
extra: s
|
|
112
112
|
}) {
|
|
113
|
-
var S,
|
|
114
|
-
const t =
|
|
115
|
-
search:
|
|
113
|
+
var S, R, O, f;
|
|
114
|
+
const t = Ne(), [m, p] = B(!1), [b, E] = B(""), L = ye(b, 250), { data: v } = Ue(i, m), { data: x = [] } = $e(!0), { options: N, loading: U } = Ce(m ? t : null, i, {
|
|
115
|
+
search: L,
|
|
116
116
|
limit: 8,
|
|
117
|
-
displayTemplate:
|
|
118
|
-
enabled: m &&
|
|
119
|
-
}), y =
|
|
120
|
-
(
|
|
117
|
+
displayTemplate: v ?? null,
|
|
118
|
+
enabled: m && v !== void 0
|
|
119
|
+
}), y = Re(Oe).length, w = ((S = x.find((l) => l.id === a.roleId)) == null ? void 0 : S.name) ?? null, C = ((R = x.find((l) => l.id === a.compareRoleId)) == null ? void 0 : R.name) ?? null, $ = [
|
|
120
|
+
(O = a.record) == null ? void 0 : O.label,
|
|
121
121
|
C && w ? `${w} | ${C}` : w,
|
|
122
122
|
(f = a.state) == null ? void 0 : f.label,
|
|
123
123
|
a.values && Object.keys(a.values).length > 0 ? "What if" : null,
|
|
@@ -126,26 +126,26 @@ function Ye({
|
|
|
126
126
|
// #2858 — pretending something is down is a preview mode too: never forgotten on screen.
|
|
127
127
|
y > 0 ? `${y} down` : null
|
|
128
128
|
].filter(Boolean).join(" · ") || "No record";
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */ e(
|
|
129
|
+
return /* @__PURE__ */ n(Q, { open: m, onOpenChange: p, children: [
|
|
130
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ n(
|
|
131
131
|
"button",
|
|
132
132
|
{
|
|
133
133
|
type: "button",
|
|
134
|
-
className:
|
|
134
|
+
className: u(Fe, "min-w-[110px] max-w-[260px] shrink", m && _e),
|
|
135
135
|
"aria-label": "Preview as",
|
|
136
136
|
"data-preview-as": "",
|
|
137
137
|
"data-tip": "Show the form with a real record’s values, as a role sees it",
|
|
138
138
|
children: [
|
|
139
139
|
/* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
140
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 truncate", children: [
|
|
141
141
|
"Preview",
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ n("span", { "data-tb-wide": "", children: [
|
|
143
143
|
":",
|
|
144
144
|
" ",
|
|
145
|
-
/* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children:
|
|
145
|
+
/* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children: $ })
|
|
146
146
|
] })
|
|
147
147
|
] }),
|
|
148
|
-
|
|
148
|
+
r && /* @__PURE__ */ e(
|
|
149
149
|
"span",
|
|
150
150
|
{
|
|
151
151
|
"data-preview-hidden-on": "",
|
|
@@ -153,182 +153,182 @@ function Ye({
|
|
|
153
153
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan"
|
|
154
154
|
}
|
|
155
155
|
),
|
|
156
|
-
/* @__PURE__ */ e(
|
|
156
|
+
/* @__PURE__ */ e(X, { className: "h-3 w-3 shrink-0 text-slate-500 dark:text-muted-foreground" })
|
|
157
157
|
]
|
|
158
158
|
}
|
|
159
159
|
) }),
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
ee,
|
|
162
162
|
{
|
|
163
163
|
align: "end",
|
|
164
164
|
className: "max-h-[min(80vh,640px)] w-[320px] overflow-y-auto overscroll-contain p-3",
|
|
165
165
|
children: [
|
|
166
|
-
/* @__PURE__ */ e("p", { className:
|
|
167
|
-
a.record ? /* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ e("p", { className: K, children: "Record" }),
|
|
167
|
+
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
168
|
/* @__PURE__ */ e("span", { className: "truncate", children: a.record.label }),
|
|
169
169
|
/* @__PURE__ */ e(
|
|
170
170
|
"button",
|
|
171
171
|
{
|
|
172
172
|
type: "button",
|
|
173
173
|
"aria-label": "Preview without a record",
|
|
174
|
-
onClick: () =>
|
|
174
|
+
onClick: () => d({ ...a, record: null }),
|
|
175
175
|
className: "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
|
|
176
|
-
children: /* @__PURE__ */ e(
|
|
176
|
+
children: /* @__PURE__ */ e(ge, { className: "h-3 w-3" })
|
|
177
177
|
}
|
|
178
178
|
)
|
|
179
|
-
] }) : /* @__PURE__ */
|
|
179
|
+
] }) : /* @__PURE__ */ n(Z, { children: [
|
|
180
180
|
/* @__PURE__ */ e(
|
|
181
181
|
"input",
|
|
182
182
|
{
|
|
183
183
|
value: b,
|
|
184
|
-
onChange: (
|
|
184
|
+
onChange: (l) => E(l.target.value),
|
|
185
185
|
placeholder: "Search records…",
|
|
186
186
|
"aria-label": "Search records",
|
|
187
|
-
className:
|
|
187
|
+
className: ze
|
|
188
188
|
}
|
|
189
189
|
),
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
N.map((
|
|
190
|
+
/* @__PURE__ */ n("div", { className: "mt-1 max-h-[220px] overflow-y-auto overscroll-contain", children: [
|
|
191
|
+
N.map((l) => /* @__PURE__ */ e(
|
|
192
192
|
"button",
|
|
193
193
|
{
|
|
194
194
|
type: "button",
|
|
195
|
-
onClick: () =>
|
|
195
|
+
onClick: () => d({ ...a, record: { id: String(l.id), label: l.label } }),
|
|
196
196
|
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:
|
|
197
|
+
children: l.label
|
|
198
198
|
},
|
|
199
|
-
String(
|
|
199
|
+
String(l.id)
|
|
200
200
|
)),
|
|
201
|
-
!
|
|
201
|
+
!U && N.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-1.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No records match." })
|
|
202
202
|
] })
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */ e("p", { className:
|
|
204
|
+
/* @__PURE__ */ e("p", { className: u(K, "mt-3"), children: "As a role" }),
|
|
205
205
|
/* @__PURE__ */ e(
|
|
206
|
-
|
|
206
|
+
Pe,
|
|
207
207
|
{
|
|
208
208
|
value: a.roleId ?? "",
|
|
209
|
-
onChange: (
|
|
209
|
+
onChange: (l) => d({ ...a, roleId: l || null }),
|
|
210
210
|
ariaLabel: "Preview as role",
|
|
211
211
|
className: "h-8 text-[12.5px]",
|
|
212
212
|
options: [
|
|
213
213
|
{ value: "", label: "Any role" },
|
|
214
|
-
...x.map((
|
|
214
|
+
...x.map((l) => ({ value: l.id, label: l.name }))
|
|
215
215
|
]
|
|
216
216
|
}
|
|
217
217
|
),
|
|
218
218
|
/* @__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
219
|
/* @__PURE__ */ e("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: /* @__PURE__ */ e(
|
|
220
|
-
|
|
220
|
+
Je,
|
|
221
221
|
{
|
|
222
222
|
icon: /* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5" }),
|
|
223
223
|
label: "Show hidden",
|
|
224
224
|
hint: "Fields and sections the preview would hide, faintly, so you can select them",
|
|
225
|
-
on:
|
|
226
|
-
onChange:
|
|
225
|
+
on: r,
|
|
226
|
+
onChange: o,
|
|
227
227
|
data: { "data-show-hidden-switch": "" }
|
|
228
228
|
}
|
|
229
229
|
) }),
|
|
230
|
-
|
|
230
|
+
s
|
|
231
231
|
]
|
|
232
232
|
}
|
|
233
233
|
)
|
|
234
234
|
] });
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function xt({
|
|
237
237
|
collection: i,
|
|
238
238
|
layoutId: a,
|
|
239
|
-
layoutName:
|
|
240
|
-
layoutType:
|
|
241
|
-
row:
|
|
242
|
-
fields:
|
|
239
|
+
layoutName: d,
|
|
240
|
+
layoutType: r,
|
|
241
|
+
row: o,
|
|
242
|
+
fields: s,
|
|
243
243
|
draft: t,
|
|
244
244
|
preview: m,
|
|
245
|
-
onPreview:
|
|
245
|
+
onPreview: p,
|
|
246
246
|
showHidden: b,
|
|
247
|
-
onShowHidden:
|
|
248
|
-
onBack:
|
|
249
|
-
backLabel:
|
|
247
|
+
onShowHidden: E,
|
|
248
|
+
onBack: L,
|
|
249
|
+
backLabel: v = "Forms",
|
|
250
250
|
view: x,
|
|
251
251
|
tools: N,
|
|
252
|
-
ai:
|
|
252
|
+
ai: U,
|
|
253
253
|
previewExtra: y,
|
|
254
254
|
problems: w,
|
|
255
255
|
more: C,
|
|
256
|
-
presence:
|
|
256
|
+
presence: $,
|
|
257
257
|
onOpenUnsaved: S,
|
|
258
|
-
pendingTip:
|
|
259
|
-
onSelectField:
|
|
258
|
+
pendingTip: R,
|
|
259
|
+
onSelectField: O,
|
|
260
260
|
onShowOnCanvas: f,
|
|
261
|
-
onReviewChanges:
|
|
262
|
-
reviewing:
|
|
263
|
-
testing:
|
|
264
|
-
beforeSave:
|
|
261
|
+
onReviewChanges: l,
|
|
262
|
+
reviewing: te = !1,
|
|
263
|
+
testing: ae,
|
|
264
|
+
beforeSave: re
|
|
265
265
|
}) {
|
|
266
|
-
const [
|
|
266
|
+
const [M, j] = B(
|
|
267
267
|
() => typeof window < "u" && new URLSearchParams(window.location.search).get("history") === "1"
|
|
268
|
-
),
|
|
269
|
-
(
|
|
270
|
-
var
|
|
271
|
-
return ((F = (
|
|
268
|
+
), h = t.unsavedCount ?? 0, H = o ? Me(o) : null, ne = we(() => o ? [o] : [], [o]), oe = Le(i, s, ne), _ = o ? je(o, s, oe) : G[r] ? [{ text: G[r] }] : [], T = !!t.save && !t.autosave, P = T && h > 0, se = q(
|
|
269
|
+
(c) => {
|
|
270
|
+
var g, F;
|
|
271
|
+
return ((F = (g = s.find((le) => le.field === c)) == null ? void 0 : g.label) == null ? void 0 : F.trim()) || Se(c);
|
|
272
272
|
},
|
|
273
|
-
[
|
|
274
|
-
),
|
|
275
|
-
return /* @__PURE__ */
|
|
273
|
+
[s]
|
|
274
|
+
), de = Te(d);
|
|
275
|
+
return /* @__PURE__ */ n(
|
|
276
276
|
"header",
|
|
277
277
|
{
|
|
278
278
|
"data-editor-topbar": "",
|
|
279
279
|
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
280
|
children: [
|
|
281
|
-
/* @__PURE__ */ e("style", { children:
|
|
282
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ e("style", { children: Ye }),
|
|
282
|
+
/* @__PURE__ */ n(
|
|
283
283
|
"button",
|
|
284
284
|
{
|
|
285
285
|
type: "button",
|
|
286
|
-
"aria-label":
|
|
286
|
+
"aria-label": v,
|
|
287
287
|
"data-editor-back": "",
|
|
288
|
-
onClick: (
|
|
288
|
+
onClick: (c) => L(c.currentTarget),
|
|
289
289
|
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
290
|
children: [
|
|
291
|
-
/* @__PURE__ */ e(
|
|
292
|
-
/* @__PURE__ */ e("span", { "data-tb-wide": "", children:
|
|
291
|
+
/* @__PURE__ */ e(ie, { className: "h-4 w-4" }),
|
|
292
|
+
/* @__PURE__ */ e("span", { "data-tb-wide": "", children: v })
|
|
293
293
|
]
|
|
294
294
|
}
|
|
295
295
|
),
|
|
296
296
|
/* @__PURE__ */ e(k, {}),
|
|
297
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ n("div", { "data-tb-name": "", className: "flex min-w-[64px] flex-1 items-center gap-2", children: [
|
|
298
298
|
/* @__PURE__ */ e(
|
|
299
299
|
"h2",
|
|
300
300
|
{
|
|
301
|
-
ref:
|
|
301
|
+
ref: de,
|
|
302
302
|
className: "min-w-0 truncate text-[14px] font-semibold text-slate-900 dark:text-foreground",
|
|
303
|
-
children:
|
|
303
|
+
children: d
|
|
304
304
|
}
|
|
305
305
|
),
|
|
306
|
-
|
|
307
|
-
_.length > 0 && /* @__PURE__ */
|
|
306
|
+
H && /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(He, { tone: H.tone, children: H.text }) }),
|
|
307
|
+
_.length > 0 && /* @__PURE__ */ n(
|
|
308
308
|
"span",
|
|
309
309
|
{
|
|
310
310
|
"data-tb-sentence": "",
|
|
311
311
|
className: "min-w-0 truncate text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
312
312
|
children: [
|
|
313
313
|
"· ",
|
|
314
|
-
/* @__PURE__ */ e(
|
|
314
|
+
/* @__PURE__ */ e(Ie, { segs: _, muted: !0 })
|
|
315
315
|
]
|
|
316
316
|
}
|
|
317
317
|
),
|
|
318
|
-
|
|
318
|
+
$
|
|
319
319
|
] }),
|
|
320
320
|
/* @__PURE__ */ e(k, {}),
|
|
321
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
322
322
|
/* @__PURE__ */ e(
|
|
323
323
|
"button",
|
|
324
324
|
{
|
|
325
325
|
type: "button",
|
|
326
326
|
"aria-label": "Undo",
|
|
327
|
-
className:
|
|
327
|
+
className: I,
|
|
328
328
|
disabled: !t.canUndo,
|
|
329
329
|
onClick: t.undo,
|
|
330
330
|
"data-tip": t.undoLabel ? `Undo ${t.undoLabel} (⌘Z)` : "Undo (⌘Z)",
|
|
331
|
-
children: /* @__PURE__ */ e(
|
|
331
|
+
children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
|
|
332
332
|
}
|
|
333
333
|
),
|
|
334
334
|
/* @__PURE__ */ e(
|
|
@@ -336,27 +336,27 @@ function ht({
|
|
|
336
336
|
{
|
|
337
337
|
type: "button",
|
|
338
338
|
"aria-label": "Redo",
|
|
339
|
-
className:
|
|
339
|
+
className: I,
|
|
340
340
|
disabled: !t.canRedo,
|
|
341
341
|
onClick: t.redo,
|
|
342
342
|
"data-tip": t.redoLabel ? `Redo ${t.redoLabel} (⇧⌘Z)` : "Redo (⇧⌘Z)",
|
|
343
|
-
children: /* @__PURE__ */ e(
|
|
343
|
+
children: /* @__PURE__ */ e(me, { className: "h-4 w-4" })
|
|
344
344
|
}
|
|
345
345
|
)
|
|
346
346
|
] }),
|
|
347
|
-
x && /* @__PURE__ */
|
|
347
|
+
x && /* @__PURE__ */ n(Z, { children: [
|
|
348
348
|
/* @__PURE__ */ e(k, {}),
|
|
349
349
|
/* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1", children: x })
|
|
350
350
|
] }),
|
|
351
351
|
/* @__PURE__ */ e(k, {}),
|
|
352
352
|
/* @__PURE__ */ e(
|
|
353
|
-
|
|
353
|
+
Ke,
|
|
354
354
|
{
|
|
355
355
|
collection: i,
|
|
356
356
|
value: m,
|
|
357
|
-
onChange:
|
|
357
|
+
onChange: p,
|
|
358
358
|
showHidden: b,
|
|
359
|
-
onShowHidden:
|
|
359
|
+
onShowHidden: E,
|
|
360
360
|
extra: y
|
|
361
361
|
}
|
|
362
362
|
),
|
|
@@ -364,7 +364,7 @@ function ht({
|
|
|
364
364
|
A,
|
|
365
365
|
{
|
|
366
366
|
label: "Tools",
|
|
367
|
-
icon: /* @__PURE__ */ e(
|
|
367
|
+
icon: /* @__PURE__ */ e(ue, { className: "h-3.5 w-3.5" }),
|
|
368
368
|
tip: "Arrange, find, outline, every form, form map and shortcuts",
|
|
369
369
|
children: N
|
|
370
370
|
}
|
|
@@ -376,16 +376,16 @@ function ht({
|
|
|
376
376
|
icon: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
377
377
|
tip: "Rebuild, review and ask about this form with AI; type a change",
|
|
378
378
|
width: "w-[320px]",
|
|
379
|
-
children:
|
|
379
|
+
children: U
|
|
380
380
|
}
|
|
381
381
|
),
|
|
382
382
|
w,
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */ e(
|
|
383
|
+
/* @__PURE__ */ n(Q, { open: M, onOpenChange: j, children: [
|
|
384
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
385
385
|
"button",
|
|
386
386
|
{
|
|
387
387
|
type: "button",
|
|
388
|
-
className:
|
|
388
|
+
className: u(I, M && Ze),
|
|
389
389
|
"aria-label": "History",
|
|
390
390
|
"data-tip": "History: saved versions, this session’s steps, restore",
|
|
391
391
|
"data-editor-history": "",
|
|
@@ -393,66 +393,67 @@ function ht({
|
|
|
393
393
|
}
|
|
394
394
|
) }),
|
|
395
395
|
/* @__PURE__ */ e(
|
|
396
|
-
|
|
396
|
+
ee,
|
|
397
397
|
{
|
|
398
398
|
align: "end",
|
|
399
399
|
className: "max-h-[min(75vh,640px)] w-[460px] overflow-y-auto overscroll-contain p-3",
|
|
400
|
-
children:
|
|
401
|
-
|
|
400
|
+
children: M && /* @__PURE__ */ e(
|
|
401
|
+
Ee,
|
|
402
402
|
{
|
|
403
403
|
layoutId: a,
|
|
404
|
-
onRestored: () =>
|
|
405
|
-
unsavedCount:
|
|
404
|
+
onRestored: () => j(!1),
|
|
405
|
+
unsavedCount: h,
|
|
406
406
|
onDiscardUnsaved: t.discard,
|
|
407
407
|
session: t.session,
|
|
408
408
|
onJump: t.jump,
|
|
409
409
|
bundle: t.bundle,
|
|
410
|
-
onApply: (
|
|
411
|
-
fieldLabel:
|
|
412
|
-
onShowOnCanvas: f ? (
|
|
413
|
-
|
|
410
|
+
onApply: (c, g) => t.apply(c, { label: g }),
|
|
411
|
+
fieldLabel: se,
|
|
412
|
+
onShowOnCanvas: f ? (c, g) => {
|
|
413
|
+
j(!1), f(c, g);
|
|
414
414
|
} : void 0
|
|
415
415
|
}
|
|
416
416
|
)
|
|
417
417
|
}
|
|
418
418
|
)
|
|
419
419
|
] }),
|
|
420
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ n(
|
|
421
421
|
A,
|
|
422
422
|
{
|
|
423
423
|
label: "More",
|
|
424
|
-
icon: /* @__PURE__ */ e(
|
|
424
|
+
icon: /* @__PURE__ */ e(be, { className: "h-4 w-4" }),
|
|
425
425
|
iconOnly: !0,
|
|
426
426
|
align: "end",
|
|
427
427
|
tip: "Test, share and watch this form, templates and download",
|
|
428
428
|
data: { "data-editor-more": "" },
|
|
429
429
|
children: [
|
|
430
|
-
|
|
431
|
-
/* @__PURE__ */ e(
|
|
432
|
-
/* @__PURE__ */ e(
|
|
433
|
-
/* @__PURE__ */ e(
|
|
434
|
-
/* @__PURE__ */ e(
|
|
430
|
+
ae,
|
|
431
|
+
/* @__PURE__ */ e(W, {}),
|
|
432
|
+
/* @__PURE__ */ e(Be, { layoutId: a, fields: s, onSelectField: O }),
|
|
433
|
+
/* @__PURE__ */ e(De, { layoutId: a }),
|
|
434
|
+
/* @__PURE__ */ e(W, {}),
|
|
435
435
|
C
|
|
436
436
|
]
|
|
437
437
|
}
|
|
438
438
|
),
|
|
439
439
|
/* @__PURE__ */ e(k, {}),
|
|
440
|
-
/* @__PURE__ */ e(
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
|
|
440
|
+
/* @__PURE__ */ e(Ge, { draft: t, onOpen: S, pendingTip: R }),
|
|
441
|
+
P && t.discard && /* @__PURE__ */ e(Xe, { count: h, onDiscard: t.discard }),
|
|
442
|
+
/* @__PURE__ */ n("div", { "data-save-split": "", className: "flex shrink-0 items-center", children: [
|
|
443
|
+
T && /* @__PURE__ */ n(
|
|
443
444
|
"button",
|
|
444
445
|
{
|
|
445
446
|
type: "button",
|
|
446
447
|
"data-editor-save": "",
|
|
447
|
-
disabled:
|
|
448
|
+
disabled: h === 0,
|
|
448
449
|
onClick: () => {
|
|
449
|
-
var
|
|
450
|
-
return void ((
|
|
450
|
+
var c;
|
|
451
|
+
return void ((c = t.save) == null ? void 0 : c.call(t));
|
|
451
452
|
},
|
|
452
|
-
"data-tip":
|
|
453
|
-
className:
|
|
453
|
+
"data-tip": h > 0 ? `Save ${D(h)} (⌘S)` : "Nothing to save",
|
|
454
|
+
className: u(
|
|
454
455
|
"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",
|
|
455
|
-
|
|
456
|
+
h > 0 ? "bg-nvr-cyan text-white hover:opacity-90" : "border border-slate-200 text-slate-700 dark:border-border dark:text-foreground"
|
|
456
457
|
),
|
|
457
458
|
children: [
|
|
458
459
|
/* @__PURE__ */ e(z, { className: "h-3.5 w-3.5" }),
|
|
@@ -460,47 +461,47 @@ function ht({
|
|
|
460
461
|
]
|
|
461
462
|
}
|
|
462
463
|
),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ n(
|
|
464
465
|
A,
|
|
465
466
|
{
|
|
466
467
|
label: "Save options",
|
|
467
|
-
icon: /* @__PURE__ */ e(
|
|
468
|
+
icon: /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5" }),
|
|
468
469
|
iconOnly: !0,
|
|
469
470
|
align: "end",
|
|
470
471
|
width: "w-[300px]",
|
|
471
|
-
tip:
|
|
472
|
-
className:
|
|
473
|
-
|
|
472
|
+
tip: T ? "Review, check or schedule the changes; Autosave" : "Autosave",
|
|
473
|
+
className: u(
|
|
474
|
+
T ? "rounded-l-none border border-l-0 border-slate-200 dark:border-border" : "border border-slate-200 dark:border-border"
|
|
474
475
|
),
|
|
475
476
|
data: { "data-save-menu": "" },
|
|
476
477
|
children: [
|
|
477
|
-
|
|
478
|
+
l && P && /* @__PURE__ */ e(
|
|
478
479
|
J,
|
|
479
480
|
{
|
|
480
481
|
label: "Review changes on canvas",
|
|
481
|
-
icon: /* @__PURE__ */ e(
|
|
482
|
+
icon: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
|
|
482
483
|
hint: "Mark the unsaved changes on the form",
|
|
483
|
-
checked:
|
|
484
|
-
onClick:
|
|
484
|
+
checked: te,
|
|
485
|
+
onClick: l,
|
|
485
486
|
data: { "data-editor-review": "" }
|
|
486
487
|
}
|
|
487
488
|
),
|
|
488
|
-
|
|
489
|
-
/* @__PURE__ */ e(
|
|
490
|
-
t.unsavedOps && t.discard &&
|
|
491
|
-
|
|
489
|
+
P && re,
|
|
490
|
+
/* @__PURE__ */ e(Ae, { layoutId: a, draft: t }),
|
|
491
|
+
t.unsavedOps && t.discard && P && /* @__PURE__ */ e(
|
|
492
|
+
We,
|
|
492
493
|
{
|
|
493
494
|
collection: i,
|
|
494
495
|
layoutId: a,
|
|
495
496
|
draft: {
|
|
496
497
|
unsavedOps: t.unsavedOps,
|
|
497
498
|
discard: t.discard,
|
|
498
|
-
unsavedCount:
|
|
499
|
+
unsavedCount: h
|
|
499
500
|
}
|
|
500
501
|
}
|
|
501
502
|
),
|
|
502
|
-
t.setAutosave && /* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */ e(
|
|
503
|
+
t.setAutosave && /* @__PURE__ */ n(Z, { children: [
|
|
504
|
+
/* @__PURE__ */ e(W, {}),
|
|
504
505
|
/* @__PURE__ */ e(
|
|
505
506
|
J,
|
|
506
507
|
{
|
|
@@ -509,8 +510,8 @@ function ht({
|
|
|
509
510
|
hint: t.autosave ? "Every change saves as you make it, until you close the editor" : "Off: changes wait for Save",
|
|
510
511
|
checked: !!t.autosave,
|
|
511
512
|
onClick: () => {
|
|
512
|
-
var
|
|
513
|
-
return (
|
|
513
|
+
var c;
|
|
514
|
+
return (c = t.setAutosave) == null ? void 0 : c.call(t, !t.autosave);
|
|
514
515
|
},
|
|
515
516
|
data: { "data-autosave-switch": "" }
|
|
516
517
|
}
|
|
@@ -524,9 +525,50 @@ function ht({
|
|
|
524
525
|
}
|
|
525
526
|
);
|
|
526
527
|
}
|
|
528
|
+
function Xe({ count: i, onDiscard: a }) {
|
|
529
|
+
const [d, r] = B(!1), o = fe(null), s = q(() => {
|
|
530
|
+
o.current && clearTimeout(o.current), o.current = null, r(!1);
|
|
531
|
+
}, []);
|
|
532
|
+
ke(() => s, [s]);
|
|
533
|
+
const t = `Discard ${D(i)}`;
|
|
534
|
+
return /* @__PURE__ */ n(
|
|
535
|
+
"button",
|
|
536
|
+
{
|
|
537
|
+
type: "button",
|
|
538
|
+
"data-editor-discard": "",
|
|
539
|
+
"data-armed": d ? "" : void 0,
|
|
540
|
+
"aria-label": d ? `${t}? Click again to discard` : t,
|
|
541
|
+
"data-tip": d ? "Click again to discard. This cannot be undone." : t,
|
|
542
|
+
onClick: () => {
|
|
543
|
+
if (!d) {
|
|
544
|
+
r(!0), o.current && clearTimeout(o.current), o.current = setTimeout(() => r(!1), 4e3);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
s(), a();
|
|
548
|
+
},
|
|
549
|
+
onBlur: s,
|
|
550
|
+
onKeyDown: (m) => {
|
|
551
|
+
m.key === "Escape" && d && (m.stopPropagation(), s());
|
|
552
|
+
},
|
|
553
|
+
className: u(
|
|
554
|
+
"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",
|
|
555
|
+
d ? "bg-red-50 text-red-700 ring-1 ring-red-200 hover:bg-red-100 dark:bg-red-500/15 dark:text-red-300 dark:ring-red-500/30 dark:hover:bg-red-500/25" : "text-slate-600 hover:bg-muted hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground"
|
|
556
|
+
),
|
|
557
|
+
children: [
|
|
558
|
+
/* @__PURE__ */ e(ve, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
559
|
+
d ? /* @__PURE__ */ n("span", { children: [
|
|
560
|
+
"Discard ",
|
|
561
|
+
i === 1 ? "it" : "them",
|
|
562
|
+
"?"
|
|
563
|
+
] }) : /* @__PURE__ */ e("span", { "data-tb-wide": "", children: "Discard" })
|
|
564
|
+
]
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
527
568
|
function k() {
|
|
528
569
|
return /* @__PURE__ */ e("span", { "aria-hidden": !0, "data-tb-wide": "", className: "h-5 w-px shrink-0 bg-slate-200 dark:bg-border" });
|
|
529
570
|
}
|
|
530
571
|
export {
|
|
531
|
-
|
|
572
|
+
Xe as DiscardButton,
|
|
573
|
+
xt as EditorTopBar
|
|
532
574
|
};
|