@nivaro/react 0.3.35 → 0.3.37
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 +13 -4
- 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 -572
- 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 +11 -10
- 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 +80 -63
- 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 +146 -131
- package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
- package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
- package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
- 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 +379 -185
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
- 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/rail-drop.js +4 -4
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
- 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/panel-frame.js +1 -1
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
- 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 +149 -118
- 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,48 +1,49 @@
|
|
|
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 {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
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 E, 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 { 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
|
-
pendingTip:
|
|
31
|
+
pendingTip: d
|
|
31
32
|
}) {
|
|
32
|
-
const { status:
|
|
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
|
-
"data-save-status":
|
|
37
|
+
"data-save-status": r,
|
|
37
38
|
"data-unsaved": l,
|
|
38
|
-
"data-tip": (
|
|
39
|
-
className:
|
|
39
|
+
"data-tip": (r === "error" || r === "conflict") && o ? o : t ? d ?? "Only you see these changes until you save (⌘S)" : void 0,
|
|
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",
|
|
41
|
-
|
|
42
|
-
(
|
|
42
|
+
r === "saving" && "bg-slate-100 text-slate-600 dark:bg-muted dark:text-muted-foreground",
|
|
43
|
+
(r === "saved" || r === "idle") && !t && "bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
|
|
43
44
|
t && "bg-nvr-cyan/10 text-slate-700 dark:text-foreground",
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
r === "error" && "bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",
|
|
46
|
+
r === "conflict" && "bg-amber-50 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300"
|
|
46
47
|
),
|
|
47
48
|
children: [
|
|
48
49
|
t && /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan" }),
|
|
@@ -50,51 +51,51 @@ function Fe({
|
|
|
50
51
|
]
|
|
51
52
|
}
|
|
52
53
|
);
|
|
53
|
-
return !t || !a ?
|
|
54
|
+
return !t || !a ? p : /* @__PURE__ */ e(
|
|
54
55
|
"button",
|
|
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
|
-
children:
|
|
62
|
+
children: p
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function Xe({
|
|
66
67
|
icon: i,
|
|
67
68
|
label: a,
|
|
68
|
-
hint:
|
|
69
|
-
on:
|
|
70
|
-
onChange:
|
|
69
|
+
hint: d,
|
|
70
|
+
on: r,
|
|
71
|
+
onChange: o,
|
|
71
72
|
data: l
|
|
72
73
|
}) {
|
|
73
|
-
return /* @__PURE__ */
|
|
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 }),
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ n("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
76
77
|
/* @__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:
|
|
78
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: d })
|
|
78
79
|
] }),
|
|
79
80
|
/* @__PURE__ */ e(
|
|
80
81
|
"button",
|
|
81
82
|
{
|
|
82
83
|
type: "button",
|
|
83
84
|
role: "switch",
|
|
84
|
-
"aria-checked":
|
|
85
|
+
"aria-checked": r,
|
|
85
86
|
"aria-label": a,
|
|
86
|
-
onClick: () =>
|
|
87
|
+
onClick: () => o(!r),
|
|
87
88
|
...l,
|
|
88
|
-
className:
|
|
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"
|
|
91
92
|
),
|
|
92
93
|
children: /* @__PURE__ */ e(
|
|
93
94
|
"span",
|
|
94
95
|
{
|
|
95
|
-
className:
|
|
96
|
+
className: u(
|
|
96
97
|
"absolute left-0 top-0.5 h-3 w-3 rounded-full bg-white shadow-sm transition-transform",
|
|
97
|
-
|
|
98
|
+
r ? "translate-x-3.5" : "translate-x-0.5"
|
|
98
99
|
)
|
|
99
100
|
}
|
|
100
101
|
)
|
|
@@ -102,50 +103,50 @@ function ze({
|
|
|
102
103
|
)
|
|
103
104
|
] });
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function qe({
|
|
106
107
|
collection: i,
|
|
107
108
|
value: a,
|
|
108
|
-
onChange:
|
|
109
|
-
showHidden:
|
|
110
|
-
onShowHidden:
|
|
109
|
+
onChange: d,
|
|
110
|
+
showHidden: r,
|
|
111
|
+
onShowHidden: o,
|
|
111
112
|
extra: l
|
|
112
113
|
}) {
|
|
113
|
-
var
|
|
114
|
-
const t =
|
|
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
|
-
return /* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */ e(
|
|
130
|
+
return /* @__PURE__ */ n(Q, { open: m, onOpenChange: p, children: [
|
|
131
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ n(
|
|
131
132
|
"button",
|
|
132
133
|
{
|
|
133
134
|
type: "button",
|
|
134
|
-
className:
|
|
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",
|
|
138
139
|
children: [
|
|
139
140
|
/* @__PURE__ */ e(Y, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 truncate", children: [
|
|
141
142
|
"Preview",
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ n("span", { "data-tb-wide": "", children: [
|
|
143
144
|
":",
|
|
144
145
|
" ",
|
|
145
|
-
/* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children:
|
|
146
|
+
/* @__PURE__ */ e("span", { "data-preview-summary": "", className: "text-slate-500 dark:text-muted-foreground", children: $ })
|
|
146
147
|
] })
|
|
147
148
|
] }),
|
|
148
|
-
|
|
149
|
+
r && /* @__PURE__ */ e(
|
|
149
150
|
"span",
|
|
150
151
|
{
|
|
151
152
|
"data-preview-hidden-on": "",
|
|
@@ -153,77 +154,96 @@ function Ye({
|
|
|
153
154
|
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-nvr-cyan"
|
|
154
155
|
}
|
|
155
156
|
),
|
|
156
|
-
/* @__PURE__ */ e(
|
|
157
|
+
/* @__PURE__ */ e(X, { className: "h-3 w-3 shrink-0 text-slate-500 dark:text-muted-foreground" })
|
|
157
158
|
]
|
|
158
159
|
}
|
|
159
160
|
) }),
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
161
|
+
/* @__PURE__ */ n(
|
|
162
|
+
ee,
|
|
162
163
|
{
|
|
163
164
|
align: "end",
|
|
164
165
|
className: "max-h-[min(80vh,640px)] w-[320px] overflow-y-auto overscroll-contain p-3",
|
|
165
166
|
children: [
|
|
166
|
-
/* @__PURE__ */ e("p", { className:
|
|
167
|
-
a.
|
|
167
|
+
/* @__PURE__ */ e("p", { className: K, children: "Record" }),
|
|
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",
|
|
171
179
|
{
|
|
172
180
|
type: "button",
|
|
173
181
|
"aria-label": "Preview without a record",
|
|
174
|
-
onClick: () =>
|
|
182
|
+
onClick: () => d({ ...a, record: null }),
|
|
175
183
|
className: "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
|
|
176
|
-
children: /* @__PURE__ */ e(
|
|
184
|
+
children: /* @__PURE__ */ e(ge, { className: "h-3 w-3" })
|
|
177
185
|
}
|
|
178
186
|
)
|
|
179
|
-
] }) : /* @__PURE__ */
|
|
187
|
+
] }) : /* @__PURE__ */ n(Z, { children: [
|
|
180
188
|
/* @__PURE__ */ e(
|
|
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
|
-
/* @__PURE__ */
|
|
191
|
-
|
|
198
|
+
/* @__PURE__ */ n("div", { className: "mt-1 max-h-[220px] overflow-y-auto overscroll-contain", children: [
|
|
199
|
+
f.map((s) => /* @__PURE__ */ e(
|
|
192
200
|
"button",
|
|
193
201
|
{
|
|
194
202
|
type: "button",
|
|
195
|
-
onClick: () =>
|
|
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
|
-
/* @__PURE__ */ e("p", { className:
|
|
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",
|
|
224
244
|
hint: "Fields and sections the preview would hide, faintly, so you can select them",
|
|
225
|
-
on:
|
|
226
|
-
onChange:
|
|
245
|
+
on: r,
|
|
246
|
+
onChange: o,
|
|
227
247
|
data: { "data-show-hidden-switch": "" }
|
|
228
248
|
}
|
|
229
249
|
) }),
|
|
@@ -233,102 +253,102 @@ function Ye({
|
|
|
233
253
|
)
|
|
234
254
|
] });
|
|
235
255
|
}
|
|
236
|
-
function
|
|
256
|
+
function wt({
|
|
237
257
|
collection: i,
|
|
238
258
|
layoutId: a,
|
|
239
|
-
layoutName:
|
|
240
|
-
layoutType:
|
|
241
|
-
row:
|
|
259
|
+
layoutName: d,
|
|
260
|
+
layoutType: r,
|
|
261
|
+
row: o,
|
|
242
262
|
fields: l,
|
|
243
263
|
draft: t,
|
|
244
264
|
preview: m,
|
|
245
|
-
onPreview:
|
|
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:
|
|
256
|
-
presence:
|
|
257
|
-
onOpenUnsaved:
|
|
258
|
-
pendingTip:
|
|
259
|
-
onSelectField:
|
|
260
|
-
onShowOnCanvas:
|
|
261
|
-
onReviewChanges:
|
|
262
|
-
reviewing:
|
|
263
|
-
testing:
|
|
264
|
-
beforeSave:
|
|
271
|
+
tools: f,
|
|
272
|
+
ai: C,
|
|
273
|
+
previewExtra: S,
|
|
274
|
+
problems: k,
|
|
275
|
+
more: R,
|
|
276
|
+
presence: $,
|
|
277
|
+
onOpenUnsaved: O,
|
|
278
|
+
pendingTip: T,
|
|
279
|
+
onSelectField: P,
|
|
280
|
+
onShowOnCanvas: N,
|
|
281
|
+
onReviewChanges: s,
|
|
282
|
+
reviewing: te = !1,
|
|
283
|
+
testing: ae,
|
|
284
|
+
beforeSave: re
|
|
265
285
|
}) {
|
|
266
|
-
const [
|
|
286
|
+
const [M, j] = E(
|
|
267
287
|
() => typeof window < "u" && new URLSearchParams(window.location.search).get("history") === "1"
|
|
268
|
-
),
|
|
269
|
-
(
|
|
270
|
-
var
|
|
271
|
-
return ((F = (
|
|
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(
|
|
289
|
+
(c) => {
|
|
290
|
+
var g, F;
|
|
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
|
-
),
|
|
275
|
-
return /* @__PURE__ */
|
|
294
|
+
), de = Te(d);
|
|
295
|
+
return /* @__PURE__ */ n(
|
|
276
296
|
"header",
|
|
277
297
|
{
|
|
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:
|
|
282
|
-
/* @__PURE__ */
|
|
301
|
+
/* @__PURE__ */ e("style", { children: Je }),
|
|
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: (
|
|
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
|
-
/* @__PURE__ */ e(
|
|
292
|
-
/* @__PURE__ */ e("span", { "data-tb-wide": "", children:
|
|
311
|
+
/* @__PURE__ */ e(ie, { className: "h-4 w-4" }),
|
|
312
|
+
/* @__PURE__ */ e("span", { "data-tb-wide": "", children: w })
|
|
293
313
|
]
|
|
294
314
|
}
|
|
295
315
|
),
|
|
296
|
-
/* @__PURE__ */ e(
|
|
297
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ e(y, {}),
|
|
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",
|
|
300
320
|
{
|
|
301
|
-
ref:
|
|
321
|
+
ref: de,
|
|
302
322
|
className: "min-w-0 truncate text-[14px] font-semibold text-slate-900 dark:text-foreground",
|
|
303
|
-
children:
|
|
323
|
+
children: d
|
|
304
324
|
}
|
|
305
325
|
),
|
|
306
|
-
|
|
307
|
-
_.length > 0 && /* @__PURE__ */
|
|
326
|
+
H && /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(He, { tone: H.tone, children: H.text }) }),
|
|
327
|
+
_.length > 0 && /* @__PURE__ */ n(
|
|
308
328
|
"span",
|
|
309
329
|
{
|
|
310
330
|
"data-tb-sentence": "",
|
|
311
331
|
className: "min-w-0 truncate text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
312
332
|
children: [
|
|
313
333
|
"· ",
|
|
314
|
-
/* @__PURE__ */ e(
|
|
334
|
+
/* @__PURE__ */ e(Ie, { segs: _, muted: !0 })
|
|
315
335
|
]
|
|
316
336
|
}
|
|
317
337
|
),
|
|
318
|
-
|
|
338
|
+
$
|
|
319
339
|
] }),
|
|
320
|
-
/* @__PURE__ */ e(
|
|
321
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ e(y, {}),
|
|
341
|
+
/* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
322
342
|
/* @__PURE__ */ e(
|
|
323
343
|
"button",
|
|
324
344
|
{
|
|
325
345
|
type: "button",
|
|
326
346
|
"aria-label": "Undo",
|
|
327
|
-
className:
|
|
347
|
+
className: I,
|
|
328
348
|
disabled: !t.canUndo,
|
|
329
349
|
onClick: t.undo,
|
|
330
350
|
"data-tip": t.undoLabel ? `Undo ${t.undoLabel} (⌘Z)` : "Undo (⌘Z)",
|
|
331
|
-
children: /* @__PURE__ */ e(
|
|
351
|
+
children: /* @__PURE__ */ e(ce, { className: "h-4 w-4" })
|
|
332
352
|
}
|
|
333
353
|
),
|
|
334
354
|
/* @__PURE__ */ e(
|
|
@@ -336,56 +356,56 @@ function ht({
|
|
|
336
356
|
{
|
|
337
357
|
type: "button",
|
|
338
358
|
"aria-label": "Redo",
|
|
339
|
-
className:
|
|
359
|
+
className: I,
|
|
340
360
|
disabled: !t.canRedo,
|
|
341
361
|
onClick: t.redo,
|
|
342
362
|
"data-tip": t.redoLabel ? `Redo ${t.redoLabel} (⇧⌘Z)` : "Redo (⇧⌘Z)",
|
|
343
|
-
children: /* @__PURE__ */ e(
|
|
363
|
+
children: /* @__PURE__ */ e(me, { className: "h-4 w-4" })
|
|
344
364
|
}
|
|
345
365
|
)
|
|
346
366
|
] }),
|
|
347
|
-
x && /* @__PURE__ */
|
|
348
|
-
/* @__PURE__ */ e(
|
|
367
|
+
x && /* @__PURE__ */ n(Z, { children: [
|
|
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
|
-
onChange:
|
|
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
|
-
icon: /* @__PURE__ */ e(
|
|
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
|
-
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */ e(
|
|
402
|
+
k,
|
|
403
|
+
/* @__PURE__ */ n(Q, { open: M, onOpenChange: j, children: [
|
|
404
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
385
405
|
"button",
|
|
386
406
|
{
|
|
387
407
|
type: "button",
|
|
388
|
-
className:
|
|
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": "",
|
|
@@ -393,66 +413,67 @@ function ht({
|
|
|
393
413
|
}
|
|
394
414
|
) }),
|
|
395
415
|
/* @__PURE__ */ e(
|
|
396
|
-
|
|
416
|
+
ee,
|
|
397
417
|
{
|
|
398
418
|
align: "end",
|
|
399
419
|
className: "max-h-[min(75vh,640px)] w-[460px] overflow-y-auto overscroll-contain p-3",
|
|
400
|
-
children:
|
|
401
|
-
|
|
420
|
+
children: M && /* @__PURE__ */ e(
|
|
421
|
+
Ee,
|
|
402
422
|
{
|
|
403
423
|
layoutId: a,
|
|
404
|
-
onRestored: () =>
|
|
405
|
-
unsavedCount:
|
|
424
|
+
onRestored: () => j(!1),
|
|
425
|
+
unsavedCount: h,
|
|
406
426
|
onDiscardUnsaved: t.discard,
|
|
407
427
|
session: t.session,
|
|
408
428
|
onJump: t.jump,
|
|
409
429
|
bundle: t.bundle,
|
|
410
|
-
onApply: (
|
|
411
|
-
fieldLabel:
|
|
412
|
-
onShowOnCanvas:
|
|
413
|
-
|
|
430
|
+
onApply: (c, g) => t.apply(c, { label: g }),
|
|
431
|
+
fieldLabel: se,
|
|
432
|
+
onShowOnCanvas: N ? (c, g) => {
|
|
433
|
+
j(!1), N(c, g);
|
|
414
434
|
} : void 0
|
|
415
435
|
}
|
|
416
436
|
)
|
|
417
437
|
}
|
|
418
438
|
)
|
|
419
439
|
] }),
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
|
|
440
|
+
/* @__PURE__ */ n(
|
|
441
|
+
D,
|
|
422
442
|
{
|
|
423
443
|
label: "More",
|
|
424
|
-
icon: /* @__PURE__ */ e(
|
|
444
|
+
icon: /* @__PURE__ */ e(be, { className: "h-4 w-4" }),
|
|
425
445
|
iconOnly: !0,
|
|
426
446
|
align: "end",
|
|
427
447
|
tip: "Test, share and watch this form, templates and download",
|
|
428
448
|
data: { "data-editor-more": "" },
|
|
429
449
|
children: [
|
|
430
|
-
|
|
431
|
-
/* @__PURE__ */ e(
|
|
432
|
-
/* @__PURE__ */ e(
|
|
433
|
-
/* @__PURE__ */ e(
|
|
434
|
-
/* @__PURE__ */ e(
|
|
435
|
-
|
|
450
|
+
ae,
|
|
451
|
+
/* @__PURE__ */ e(W, {}),
|
|
452
|
+
/* @__PURE__ */ e(Be, { layoutId: a, fields: l, onSelectField: P }),
|
|
453
|
+
/* @__PURE__ */ e(De, { layoutId: a }),
|
|
454
|
+
/* @__PURE__ */ e(W, {}),
|
|
455
|
+
R
|
|
436
456
|
]
|
|
437
457
|
}
|
|
438
458
|
),
|
|
439
|
-
/* @__PURE__ */ e(
|
|
440
|
-
/* @__PURE__ */ e(
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
|
|
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 }),
|
|
462
|
+
/* @__PURE__ */ n("div", { "data-save-split": "", className: "flex shrink-0 items-center", children: [
|
|
463
|
+
A && /* @__PURE__ */ n(
|
|
443
464
|
"button",
|
|
444
465
|
{
|
|
445
466
|
type: "button",
|
|
446
467
|
"data-editor-save": "",
|
|
447
|
-
disabled:
|
|
468
|
+
disabled: h === 0,
|
|
448
469
|
onClick: () => {
|
|
449
|
-
var
|
|
450
|
-
return void ((
|
|
470
|
+
var c;
|
|
471
|
+
return void ((c = t.save) == null ? void 0 : c.call(t));
|
|
451
472
|
},
|
|
452
|
-
"data-tip":
|
|
453
|
-
className:
|
|
473
|
+
"data-tip": h > 0 ? `Save ${L(h)} (⌘S)` : "Nothing to save",
|
|
474
|
+
className: u(
|
|
454
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",
|
|
455
|
-
|
|
476
|
+
h > 0 ? "bg-nvr-cyan text-white hover:opacity-90" : "border border-slate-200 text-slate-700 dark:border-border dark:text-foreground"
|
|
456
477
|
),
|
|
457
478
|
children: [
|
|
458
479
|
/* @__PURE__ */ e(z, { className: "h-3.5 w-3.5" }),
|
|
@@ -460,47 +481,47 @@ function ht({
|
|
|
460
481
|
]
|
|
461
482
|
}
|
|
462
483
|
),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
|
|
484
|
+
/* @__PURE__ */ n(
|
|
485
|
+
D,
|
|
465
486
|
{
|
|
466
487
|
label: "Save options",
|
|
467
|
-
icon: /* @__PURE__ */ e(
|
|
488
|
+
icon: /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5" }),
|
|
468
489
|
iconOnly: !0,
|
|
469
490
|
align: "end",
|
|
470
491
|
width: "w-[300px]",
|
|
471
|
-
tip:
|
|
472
|
-
className:
|
|
473
|
-
|
|
492
|
+
tip: A ? "Review, check or schedule the changes; Autosave" : "Autosave",
|
|
493
|
+
className: u(
|
|
494
|
+
A ? "rounded-l-none border border-l-0 border-slate-200 dark:border-border" : "border border-slate-200 dark:border-border"
|
|
474
495
|
),
|
|
475
496
|
data: { "data-save-menu": "" },
|
|
476
497
|
children: [
|
|
477
|
-
|
|
498
|
+
s && B && /* @__PURE__ */ e(
|
|
478
499
|
J,
|
|
479
500
|
{
|
|
480
501
|
label: "Review changes on canvas",
|
|
481
|
-
icon: /* @__PURE__ */ e(
|
|
502
|
+
icon: /* @__PURE__ */ e(xe, { className: "h-3.5 w-3.5" }),
|
|
482
503
|
hint: "Mark the unsaved changes on the form",
|
|
483
|
-
checked:
|
|
484
|
-
onClick:
|
|
504
|
+
checked: te,
|
|
505
|
+
onClick: s,
|
|
485
506
|
data: { "data-editor-review": "" }
|
|
486
507
|
}
|
|
487
508
|
),
|
|
488
|
-
|
|
489
|
-
/* @__PURE__ */ e(
|
|
490
|
-
t.unsavedOps && t.discard &&
|
|
491
|
-
|
|
509
|
+
B && re,
|
|
510
|
+
/* @__PURE__ */ e(Ae, { layoutId: a, draft: t }),
|
|
511
|
+
t.unsavedOps && t.discard && B && /* @__PURE__ */ e(
|
|
512
|
+
_e,
|
|
492
513
|
{
|
|
493
514
|
collection: i,
|
|
494
515
|
layoutId: a,
|
|
495
516
|
draft: {
|
|
496
517
|
unsavedOps: t.unsavedOps,
|
|
497
518
|
discard: t.discard,
|
|
498
|
-
unsavedCount:
|
|
519
|
+
unsavedCount: h
|
|
499
520
|
}
|
|
500
521
|
}
|
|
501
522
|
),
|
|
502
|
-
t.setAutosave && /* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */ e(
|
|
523
|
+
t.setAutosave && /* @__PURE__ */ n(Z, { children: [
|
|
524
|
+
/* @__PURE__ */ e(W, {}),
|
|
504
525
|
/* @__PURE__ */ e(
|
|
505
526
|
J,
|
|
506
527
|
{
|
|
@@ -509,8 +530,8 @@ function ht({
|
|
|
509
530
|
hint: t.autosave ? "Every change saves as you make it, until you close the editor" : "Off: changes wait for Save",
|
|
510
531
|
checked: !!t.autosave,
|
|
511
532
|
onClick: () => {
|
|
512
|
-
var
|
|
513
|
-
return (
|
|
533
|
+
var c;
|
|
534
|
+
return (c = t.setAutosave) == null ? void 0 : c.call(t, !t.autosave);
|
|
514
535
|
},
|
|
515
536
|
data: { "data-autosave-switch": "" }
|
|
516
537
|
}
|
|
@@ -524,9 +545,50 @@ function ht({
|
|
|
524
545
|
}
|
|
525
546
|
);
|
|
526
547
|
}
|
|
527
|
-
function
|
|
548
|
+
function Qe({ count: i, onDiscard: a }) {
|
|
549
|
+
const [d, r] = E(!1), o = fe(null), l = q(() => {
|
|
550
|
+
o.current && clearTimeout(o.current), o.current = null, r(!1);
|
|
551
|
+
}, []);
|
|
552
|
+
ke(() => l, [l]);
|
|
553
|
+
const t = `Discard ${L(i)}`;
|
|
554
|
+
return /* @__PURE__ */ n(
|
|
555
|
+
"button",
|
|
556
|
+
{
|
|
557
|
+
type: "button",
|
|
558
|
+
"data-editor-discard": "",
|
|
559
|
+
"data-armed": d ? "" : void 0,
|
|
560
|
+
"aria-label": d ? `${t}? Click again to discard` : t,
|
|
561
|
+
"data-tip": d ? "Click again to discard. This cannot be undone." : t,
|
|
562
|
+
onClick: () => {
|
|
563
|
+
if (!d) {
|
|
564
|
+
r(!0), o.current && clearTimeout(o.current), o.current = setTimeout(() => r(!1), 4e3);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
l(), a();
|
|
568
|
+
},
|
|
569
|
+
onBlur: l,
|
|
570
|
+
onKeyDown: (m) => {
|
|
571
|
+
m.key === "Escape" && d && (m.stopPropagation(), l());
|
|
572
|
+
},
|
|
573
|
+
className: u(
|
|
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",
|
|
575
|
+
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"
|
|
576
|
+
),
|
|
577
|
+
children: [
|
|
578
|
+
/* @__PURE__ */ e(ve, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
579
|
+
d ? /* @__PURE__ */ n("span", { children: [
|
|
580
|
+
"Discard ",
|
|
581
|
+
i === 1 ? "it" : "them",
|
|
582
|
+
"?"
|
|
583
|
+
] }) : /* @__PURE__ */ e("span", { "data-tb-wide": "", children: "Discard" })
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
function y() {
|
|
528
589
|
return /* @__PURE__ */ e("span", { "aria-hidden": !0, "data-tb-wide": "", className: "h-5 w-px shrink-0 bg-slate-200 dark:bg-border" });
|
|
529
590
|
}
|
|
530
591
|
export {
|
|
531
|
-
|
|
592
|
+
Qe as DiscardButton,
|
|
593
|
+
wt as EditorTopBar
|
|
532
594
|
};
|