@nivaro/react 0.2.52 → 0.2.54
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 +116 -2
- package/dist/layout-editor.d.ts +248 -2
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3994 -3876
- package/dist/shared/components/RecordReadView.js +219 -211
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/help-videos/api.js +51 -41
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/FieldAffordances.js +7 -6
- package/dist/shared/components/item-edit/FieldRow.js +353 -304
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +419 -396
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/lock-why.js +87 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -0
- package/dist/shared/components/layout-editor/AddPanel.js +204 -146
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +146 -0
- package/dist/shared/components/layout-editor/CollabParts.js +170 -0
- package/dist/shared/components/layout-editor/DesignNode.js +304 -115
- package/dist/shared/components/layout-editor/EditorCanvas.js +21 -20
- package/dist/shared/components/layout-editor/EditorTopBar.js +452 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +234 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1101 -307
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +413 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +342 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +77 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +179 -163
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +61 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +175 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +146 -92
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +256 -175
- package/dist/shared/components/layout-editor/inspector/LookTab.js +46 -40
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +167 -141
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +175 -128
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +3 -3
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +18 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +123 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +174 -100
- package/dist/shared/components/layout-editor/settings/WhoSection.js +136 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +35 -11
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/structure-ops.js +399 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +551 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +393 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +158 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -307
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/form-usage-beacon.js +84 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +110 -106
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/visible-when.js +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Replace as j } from "lucide-react";
|
|
3
|
+
import { useState as h, useMemo as y } from "react";
|
|
4
|
+
import { cn as b } from "../../lib/utils.js";
|
|
5
|
+
import { Checkbox as S } from "../ui/checkbox.js";
|
|
6
|
+
import { Popover as H, PopoverContent as I } from "../ui/popover.js";
|
|
7
|
+
import { useCollectionMeta as O } from "./inspector/field-context.js";
|
|
8
|
+
import { effectText as g, inputBase as T } from "./panel-style.js";
|
|
9
|
+
import { findHits as P, replacePlan as A, HIT_KIND_LABELS as E } from "./structure-ops.js";
|
|
10
|
+
import { ToolButton as L } from "./toolbar-kit.js";
|
|
11
|
+
const $ = "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300 data-[state=checked]:border-nvr-cyan data-[state=checked]:bg-nvr-cyan data-[state=checked]:text-white dark:border-slate-600 [&_svg]:h-3 [&_svg]:w-3", U = (n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12
|
+
function D(n, d, p) {
|
|
13
|
+
const s = [], o = new RegExp(U(d), p ? "g" : "gi");
|
|
14
|
+
let a = 0;
|
|
15
|
+
for (const l of n.matchAll(o)) {
|
|
16
|
+
const i = l.index ?? 0;
|
|
17
|
+
i > a && s.push({ text: n.slice(a, i), hit: !1 }), s.push({ text: l[0], hit: !0 }), a = i + l[0].length;
|
|
18
|
+
}
|
|
19
|
+
return a < n.length && s.push({ text: n.slice(a), hit: !1 }), s;
|
|
20
|
+
}
|
|
21
|
+
function K({
|
|
22
|
+
hit: n,
|
|
23
|
+
find: d,
|
|
24
|
+
replace: p,
|
|
25
|
+
matchCase: s
|
|
26
|
+
}) {
|
|
27
|
+
const o = D(n.before, d, s);
|
|
28
|
+
return /* @__PURE__ */ r("span", { className: "block min-w-0 text-[12.5px] leading-snug", children: [
|
|
29
|
+
/* @__PURE__ */ t("span", { className: "block truncate text-slate-500 dark:text-muted-foreground", children: o.map(
|
|
30
|
+
(a, l) => a.hit ? /* @__PURE__ */ t(
|
|
31
|
+
"s",
|
|
32
|
+
{
|
|
33
|
+
className: "rounded-sm bg-amber-100 text-amber-900 dark:bg-amber-500/20 dark:text-amber-200",
|
|
34
|
+
children: a.text
|
|
35
|
+
},
|
|
36
|
+
l
|
|
37
|
+
) : (
|
|
38
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: runs of one string never reorder
|
|
39
|
+
/* @__PURE__ */ t("span", { children: a.text }, l)
|
|
40
|
+
)
|
|
41
|
+
) }),
|
|
42
|
+
/* @__PURE__ */ t("span", { className: "block truncate text-slate-900 dark:text-foreground", children: o.map(
|
|
43
|
+
(a, l) => a.hit ? /* @__PURE__ */ t(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: "rounded-sm bg-nvr-cyan/15 font-medium",
|
|
47
|
+
children: p
|
|
48
|
+
},
|
|
49
|
+
l
|
|
50
|
+
) : (
|
|
51
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: runs of one string never reorder
|
|
52
|
+
/* @__PURE__ */ t("span", { children: a.text }, l)
|
|
53
|
+
)
|
|
54
|
+
) })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
function ee({
|
|
58
|
+
bundle: n,
|
|
59
|
+
apply: d,
|
|
60
|
+
collection: p
|
|
61
|
+
}) {
|
|
62
|
+
const [s, o] = h(!1), [a, l] = h(""), [i, B] = h(""), [u, M] = h(!1), [k, N] = h(/* @__PURE__ */ new Set()), { data: v } = O(s ? p : null), C = v == null ? void 0 : v.fields, c = y(
|
|
63
|
+
() => s ? P(n, a, i, { matchCase: u, globals: C }) : [],
|
|
64
|
+
[s, n, a, i, u, C]
|
|
65
|
+
), m = y(() => c.filter((e) => !k.has(e.id)), [c, k]), f = y(() => A(n, m), [n, m]), R = m.reduce((e, w) => e + w.count, 0), _ = (e) => N((w) => {
|
|
66
|
+
const x = new Set(w);
|
|
67
|
+
return x.has(e) ? x.delete(e) : x.add(e), x;
|
|
68
|
+
}), F = m.length === c.length;
|
|
69
|
+
return /* @__PURE__ */ r(H, { open: s, onOpenChange: o, children: [
|
|
70
|
+
/* @__PURE__ */ t(
|
|
71
|
+
L,
|
|
72
|
+
{
|
|
73
|
+
popover: !0,
|
|
74
|
+
onOpen: () => o(!0),
|
|
75
|
+
label: "Find and replace",
|
|
76
|
+
icon: /* @__PURE__ */ t(j, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
77
|
+
tip: "Find and replace in labels, section names and help text",
|
|
78
|
+
hint: "In labels, section names and help text",
|
|
79
|
+
data: { "data-find-replace-open": "" }
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ r(I, { align: "end", className: "w-[440px] p-3", "data-find-replace": "", children: [
|
|
83
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-foreground", children: "Find and replace in labels" }),
|
|
84
|
+
/* @__PURE__ */ t("p", { className: b(g, "mt-0.5"), children: "Field labels, section names, text blocks and help text on this form. Undo puts every one back." }),
|
|
85
|
+
/* @__PURE__ */ r("div", { className: "mt-3 grid grid-cols-2 gap-2", children: [
|
|
86
|
+
/* @__PURE__ */ t(
|
|
87
|
+
"input",
|
|
88
|
+
{
|
|
89
|
+
"aria-label": "Find",
|
|
90
|
+
placeholder: "Find",
|
|
91
|
+
value: a,
|
|
92
|
+
onChange: (e) => {
|
|
93
|
+
l(e.target.value), N(/* @__PURE__ */ new Set());
|
|
94
|
+
},
|
|
95
|
+
className: T
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ t(
|
|
99
|
+
"input",
|
|
100
|
+
{
|
|
101
|
+
"aria-label": "Replace with",
|
|
102
|
+
placeholder: "Replace with",
|
|
103
|
+
value: i,
|
|
104
|
+
onChange: (e) => B(e.target.value),
|
|
105
|
+
className: T
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ r("div", { className: "mt-2 flex items-center gap-3 text-[12.5px] text-slate-700 dark:text-foreground", children: [
|
|
110
|
+
/* @__PURE__ */ r("label", { className: "flex items-center gap-1.5", children: [
|
|
111
|
+
/* @__PURE__ */ t(
|
|
112
|
+
S,
|
|
113
|
+
{
|
|
114
|
+
checked: u,
|
|
115
|
+
onCheckedChange: (e) => M(e === !0),
|
|
116
|
+
className: $.replace("mt-0.5 ", "")
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
"Match case"
|
|
120
|
+
] }),
|
|
121
|
+
c.length > 0 && /* @__PURE__ */ t(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
type: "button",
|
|
125
|
+
onClick: () => N(F ? new Set(c.map((e) => e.id)) : /* @__PURE__ */ new Set()),
|
|
126
|
+
className: "ml-auto text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
|
|
127
|
+
children: F ? "Untick all" : "Tick all"
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] }),
|
|
131
|
+
/* @__PURE__ */ t(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
"data-find-replace-hits": "",
|
|
135
|
+
className: "mt-2 max-h-[320px] overflow-y-auto border-t border-slate-100 pt-1 dark:border-border",
|
|
136
|
+
children: a ? c.length === 0 ? /* @__PURE__ */ t("p", { className: b(g, "py-2"), children: "No matches on this form." }) : c.map((e) => (
|
|
137
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: the Radix checkbox is the control
|
|
138
|
+
/* @__PURE__ */ r(
|
|
139
|
+
"label",
|
|
140
|
+
{
|
|
141
|
+
"data-find-hit": e.kind,
|
|
142
|
+
className: "flex cursor-pointer items-start gap-2 rounded px-1 py-1.5 hover:bg-muted",
|
|
143
|
+
children: [
|
|
144
|
+
/* @__PURE__ */ t(
|
|
145
|
+
S,
|
|
146
|
+
{
|
|
147
|
+
checked: !k.has(e.id),
|
|
148
|
+
onCheckedChange: () => _(e.id),
|
|
149
|
+
className: $
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: [
|
|
153
|
+
/* @__PURE__ */ r("span", { className: "block truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
154
|
+
E[e.kind],
|
|
155
|
+
" · ",
|
|
156
|
+
e.where
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ t(K, { hit: e, find: a, replace: i, matchCase: u })
|
|
159
|
+
] })
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
e.id
|
|
163
|
+
)
|
|
164
|
+
)) : /* @__PURE__ */ t("p", { className: b(g, "py-2"), children: "Type the words to find." })
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ r("div", { className: "mt-2 flex items-center justify-end gap-2 border-t border-slate-100 pt-2.5 dark:border-border", children: [
|
|
168
|
+
/* @__PURE__ */ t("span", { className: b(g, "mr-auto"), children: c.length > 0 && `${m.length} of ${c.length} places` }),
|
|
169
|
+
/* @__PURE__ */ t(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "button",
|
|
173
|
+
"data-find-replace-apply": "",
|
|
174
|
+
disabled: !f.ok,
|
|
175
|
+
onClick: () => {
|
|
176
|
+
f.ok && (d(f.ops, { label: f.label }), o(!1));
|
|
177
|
+
},
|
|
178
|
+
className: "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:pointer-events-none disabled:opacity-40",
|
|
179
|
+
children: R > 0 ? `Replace ${R}` : "Replace"
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] })
|
|
183
|
+
] })
|
|
184
|
+
] });
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
ee as FindReplaceButton
|
|
188
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Map as g, Printer as N, X as y } from "lucide-react";
|
|
3
|
+
import { useState as x, useRef as f, useMemo as F, useEffect as E } from "react";
|
|
4
|
+
import { createPortal as M } from "react-dom";
|
|
5
|
+
import { modalHostOf as P } from "../ui/popover.js";
|
|
6
|
+
import { buildFormMap as D, formMapHtml as C } from "./form-map.js";
|
|
7
|
+
import { useCollectionMeta as L } from "./inspector/field-context.js";
|
|
8
|
+
import { LoadError as R } from "./load-error.js";
|
|
9
|
+
import { choiceLabelsFrom as S } from "./overview/describe-conditions.js";
|
|
10
|
+
import { useOverviewFields as j, useRoleNames as B } from "./overview/overview-api.js";
|
|
11
|
+
import { useBarMenu as O, ToolButton as Q } from "./toolbar-kit.js";
|
|
12
|
+
function Y({
|
|
13
|
+
bundle: o,
|
|
14
|
+
collection: i
|
|
15
|
+
}) {
|
|
16
|
+
const [c, a] = x(!1), [l, d] = x(null), t = f(null), n = O();
|
|
17
|
+
return /* @__PURE__ */ m(v, { children: [
|
|
18
|
+
/* @__PURE__ */ e("span", { ref: d, hidden: !0, "data-form-map-marker": "" }),
|
|
19
|
+
/* @__PURE__ */ e(
|
|
20
|
+
Q,
|
|
21
|
+
{
|
|
22
|
+
buttonRef: (s) => {
|
|
23
|
+
t.current = s;
|
|
24
|
+
},
|
|
25
|
+
label: "Form map",
|
|
26
|
+
icon: /* @__PURE__ */ e(g, { className: "h-3.5 w-3.5" }),
|
|
27
|
+
hint: "Print the steps, sections and fields",
|
|
28
|
+
tip: "A printable map of the steps, sections and fields",
|
|
29
|
+
disabled: !o,
|
|
30
|
+
opensDialog: !0,
|
|
31
|
+
onClick: () => a(!0),
|
|
32
|
+
data: { "data-form-map-open": "", "aria-haspopup": "dialog" }
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
c && o && M(
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
H,
|
|
38
|
+
{
|
|
39
|
+
bundle: o,
|
|
40
|
+
collection: i,
|
|
41
|
+
onClose: () => {
|
|
42
|
+
var s;
|
|
43
|
+
a(!1), (s = t.current ?? (n == null ? void 0 : n.anchor.current)) == null || s.focus();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
// Inside the editor's overlay dialog when there is one (its focus and
|
|
48
|
+
// scroll lock), else body — fixed under the page outlet would be offset.
|
|
49
|
+
P(l) ?? document.body
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function H({
|
|
54
|
+
bundle: o,
|
|
55
|
+
collection: i,
|
|
56
|
+
onClose: c
|
|
57
|
+
}) {
|
|
58
|
+
const a = L(i), l = j(i), d = B(!0), t = a.data, n = l.data ?? [], s = d.data ?? [], p = a.isError || l.isError || d.isError, k = () => {
|
|
59
|
+
a.isError && a.refetch(), l.isError && l.refetch(), d.isError && d.refetch();
|
|
60
|
+
}, u = f(null), h = f(null), w = F(() => {
|
|
61
|
+
const r = D({
|
|
62
|
+
bundle: o,
|
|
63
|
+
collectionLabel: (t == null ? void 0 : t.label) || i,
|
|
64
|
+
fields: n,
|
|
65
|
+
roles: s,
|
|
66
|
+
choiceLabels: S(n)
|
|
67
|
+
});
|
|
68
|
+
return C(r);
|
|
69
|
+
}, [o, t == null ? void 0 : t.label, i, n, s]);
|
|
70
|
+
return E(() => {
|
|
71
|
+
var r;
|
|
72
|
+
return (r = h.current) == null ? void 0 : r.focus();
|
|
73
|
+
}, []), /* @__PURE__ */ m(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
ref: h,
|
|
77
|
+
role: "dialog",
|
|
78
|
+
"aria-modal": "true",
|
|
79
|
+
"aria-label": "Form map",
|
|
80
|
+
tabIndex: -1,
|
|
81
|
+
"data-form-map": "",
|
|
82
|
+
onKeyDown: (r) => {
|
|
83
|
+
r.key === "Escape" && (r.preventDefault(), r.stopPropagation(), c());
|
|
84
|
+
},
|
|
85
|
+
className: "fixed inset-0 z-[120] flex flex-col bg-[#0f172a]/40 outline-none dark:bg-black/60",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ m("div", { className: "flex shrink-0 items-center gap-2 border-b border-slate-200 bg-white px-4 py-2 dark:border-border dark:bg-card", children: [
|
|
88
|
+
/* @__PURE__ */ e(g, { className: "h-4 w-4 text-slate-500 dark:text-muted-foreground" }),
|
|
89
|
+
/* @__PURE__ */ m("h2", { className: "m-0 min-w-0 flex-1 truncate text-[14px] font-semibold text-slate-900 dark:text-foreground", children: [
|
|
90
|
+
"Form map · ",
|
|
91
|
+
String(o.layout.name ?? "")
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ e("span", { className: "hidden text-[12px] text-slate-500 sm:inline dark:text-muted-foreground", children: "Choose “Save as PDF” in the print dialog for a file." }),
|
|
94
|
+
/* @__PURE__ */ m(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
type: "button",
|
|
98
|
+
"data-form-map-print": "",
|
|
99
|
+
disabled: p,
|
|
100
|
+
onClick: () => {
|
|
101
|
+
var r, b;
|
|
102
|
+
return (b = (r = u.current) == null ? void 0 : r.contentWindow) == null ? void 0 : b.print();
|
|
103
|
+
},
|
|
104
|
+
className: "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40",
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ e(N, { className: "h-3.5 w-3.5" }),
|
|
107
|
+
"Print / Save as PDF"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ e(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
"aria-label": "Close the form map",
|
|
116
|
+
onClick: c,
|
|
117
|
+
className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground",
|
|
118
|
+
children: /* @__PURE__ */ e(y, { className: "h-4 w-4" })
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-hidden p-4 sm:p-6", children: p ? /* @__PURE__ */ e("div", { className: "mx-auto max-w-[900px] rounded-md border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: /* @__PURE__ */ e(R, { what: "the field labels and roles for the map", onRetry: k }) }) : (
|
|
123
|
+
// The page itself is always light: it is paper.
|
|
124
|
+
/* @__PURE__ */ e(
|
|
125
|
+
"iframe",
|
|
126
|
+
{
|
|
127
|
+
ref: u,
|
|
128
|
+
title: "Form map preview",
|
|
129
|
+
srcDoc: w,
|
|
130
|
+
"data-form-map-frame": "",
|
|
131
|
+
className: "mx-auto block h-full w-full max-w-[900px] rounded-md border border-slate-300 bg-white shadow-lg dark:border-border"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
) })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
Y as FormMapButton
|
|
141
|
+
};
|