@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
|
@@ -1,146 +1,166 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Search as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Search as T, X as B, MessageCircleQuestion as F } from "lucide-react";
|
|
3
|
+
import { useState as M, useMemo as c, useCallback as q } from "react";
|
|
4
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
5
|
+
import { isWhereQuestion as I } from "../assist/settings-index.js";
|
|
6
|
+
import { PanelHeader as O } from "../panel-frame.js";
|
|
7
|
+
import { groupTitle as P } from "../panel-style.js";
|
|
8
|
+
import { AddendumSection as Q } from "./AddendumSection.js";
|
|
9
|
+
import { ButtonsSection as R } from "./ButtonsSection.js";
|
|
10
|
+
import { inputCls as _, quietText as j, VisibleSettingsContext as A } from "./controls.js";
|
|
11
|
+
import { DefaultsSection as D } from "./DefaultsSection.js";
|
|
12
|
+
import { InheritanceSection as E } from "./InheritanceSection.js";
|
|
13
|
+
import { LayoutSection as L } from "./LayoutSection.js";
|
|
14
|
+
import { PdfSection as W } from "./PdfSection.js";
|
|
15
|
+
import { ReadSection as $ } from "./ReadSection.js";
|
|
16
|
+
import { layoutKindOf as z, visibleSections as H } from "./settings-registry.js";
|
|
17
|
+
import { ToolsSection as K } from "./ToolsSection.js";
|
|
18
|
+
import { WhoSection as V } from "./WhoSection.js";
|
|
19
|
+
const X = {
|
|
20
|
+
who: V,
|
|
21
|
+
layout: L,
|
|
22
|
+
buttons: R,
|
|
23
|
+
read: $,
|
|
24
|
+
pdf: W,
|
|
25
|
+
addendum: Q,
|
|
26
|
+
defaults: D,
|
|
27
|
+
inheritance: E,
|
|
28
|
+
tools: K
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
-
bundle:
|
|
31
|
-
apply:
|
|
32
|
-
flush:
|
|
33
|
-
collection:
|
|
34
|
-
onPreviewRole:
|
|
35
|
-
previewRoleId:
|
|
36
|
-
onPreviewRoleChange:
|
|
30
|
+
function pt({
|
|
31
|
+
bundle: a,
|
|
32
|
+
apply: d,
|
|
33
|
+
flush: m,
|
|
34
|
+
collection: p,
|
|
35
|
+
onPreviewRole: y,
|
|
36
|
+
previewRoleId: x,
|
|
37
|
+
onPreviewRoleChange: v,
|
|
38
|
+
onAskWhere: f
|
|
37
39
|
}) {
|
|
38
|
-
const [
|
|
39
|
-
() => new Set(
|
|
40
|
-
[
|
|
41
|
-
),
|
|
40
|
+
const [r, h] = M(""), s = z(a.layout), n = c(() => H(s, r), [s, r]), S = c(
|
|
41
|
+
() => new Set(n.flatMap((t) => t.settings.map((e) => e.key))),
|
|
42
|
+
[n]
|
|
43
|
+
), b = q(() => m == null ? void 0 : m(), [m]), k = c(
|
|
42
44
|
() => ({
|
|
43
|
-
bundle:
|
|
44
|
-
layout:
|
|
45
|
-
kind:
|
|
46
|
-
collection:
|
|
47
|
-
set: (t, e,
|
|
45
|
+
bundle: a,
|
|
46
|
+
layout: a.layout,
|
|
47
|
+
kind: s,
|
|
48
|
+
collection: p,
|
|
49
|
+
set: (t, e, l) => d(
|
|
48
50
|
[{ op: "layout_update", patch: t }],
|
|
49
|
-
(
|
|
51
|
+
(l == null ? void 0 : l.undoable) === !1 ? { label: e, undoable: !1 } : { label: e }
|
|
50
52
|
),
|
|
51
|
-
setText: (t, e) =>
|
|
52
|
-
flush:
|
|
53
|
+
setText: (t, e) => d([{ op: "layout_update", patch: t }], { label: e, text: !0 }),
|
|
54
|
+
flush: b,
|
|
55
|
+
apply: (t, e) => d(t, e)
|
|
53
56
|
}),
|
|
54
|
-
[
|
|
55
|
-
),
|
|
56
|
-
const e = t.currentTarget,
|
|
57
|
-
for (const
|
|
58
|
-
const
|
|
59
|
-
|
|
57
|
+
[a, s, p, d, b]
|
|
58
|
+
), N = typeof a.layout.name == "string" ? a.layout.name : "", C = (t) => {
|
|
59
|
+
const e = t.currentTarget, l = e.getBoundingClientRect().top;
|
|
60
|
+
for (const g of e.querySelectorAll("[data-section-title]")) {
|
|
61
|
+
const w = e.scrollTop > 0 && Math.abs(g.getBoundingClientRect().top - l) < 1;
|
|
62
|
+
g.toggleAttribute("data-stuck", w);
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ i("div", { className: "flex h-full min-h-0 flex-col", "data-form-settings": s, children: [
|
|
63
66
|
/* @__PURE__ */ o(
|
|
64
|
-
|
|
67
|
+
O,
|
|
65
68
|
{
|
|
66
69
|
eyebrow: "Form settings",
|
|
67
|
-
title:
|
|
70
|
+
title: N || "This form",
|
|
68
71
|
sub: "Who gets this form and how it behaves",
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */ o(
|
|
72
|
+
children: /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
73
|
+
/* @__PURE__ */ o(T, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
|
|
71
74
|
/* @__PURE__ */ o(
|
|
72
75
|
"input",
|
|
73
76
|
{
|
|
74
|
-
value:
|
|
75
|
-
onChange: (t) =>
|
|
77
|
+
value: r,
|
|
78
|
+
onChange: (t) => h(t.target.value),
|
|
76
79
|
placeholder: "Find a setting…",
|
|
77
80
|
"aria-label": "Find a setting",
|
|
78
81
|
"data-settings-search": !0,
|
|
79
|
-
className:
|
|
82
|
+
className: u(_, "pl-8 pr-8")
|
|
80
83
|
}
|
|
81
84
|
),
|
|
82
|
-
|
|
85
|
+
r && /* @__PURE__ */ o(
|
|
83
86
|
"button",
|
|
84
87
|
{
|
|
85
88
|
type: "button",
|
|
86
89
|
"aria-label": "Clear search",
|
|
87
|
-
onClick: () =>
|
|
90
|
+
onClick: () => h(""),
|
|
88
91
|
className: "absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 text-slate-400 hover:text-slate-700 dark:hover:text-foreground",
|
|
89
|
-
children: /* @__PURE__ */ o(
|
|
92
|
+
children: /* @__PURE__ */ o(B, { className: "h-3.5 w-3.5" })
|
|
90
93
|
}
|
|
91
94
|
)
|
|
92
95
|
] })
|
|
93
96
|
}
|
|
94
97
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ i(
|
|
96
99
|
"div",
|
|
97
100
|
{
|
|
98
101
|
"data-panel-body": "",
|
|
99
|
-
onScroll:
|
|
102
|
+
onScroll: C,
|
|
100
103
|
className: "min-h-0 flex-1 overflow-y-auto px-4 pb-8",
|
|
101
|
-
children:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"”."
|
|
105
|
-
] }) : /* @__PURE__ */ o(R.Provider, { value: x, children: l.map(({ section: t }) => {
|
|
106
|
-
const e = L[t.id];
|
|
107
|
-
return /* @__PURE__ */ d(
|
|
108
|
-
"section",
|
|
104
|
+
children: [
|
|
105
|
+
f && r.trim() && (n.length === 0 || I(r)) && /* @__PURE__ */ i(
|
|
106
|
+
"button",
|
|
109
107
|
{
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
|
|
108
|
+
type: "button",
|
|
109
|
+
"data-settings-ask": "",
|
|
110
|
+
onClick: () => f(r.trim()),
|
|
111
|
+
className: "mt-3 inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 dark:text-muted-foreground dark:hover:text-foreground",
|
|
113
112
|
children: [
|
|
114
|
-
/* @__PURE__ */ o(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"data-section-title": "",
|
|
119
|
-
className: p(
|
|
120
|
-
A,
|
|
121
|
-
"sticky top-0 z-10 -mx-4 border-b border-transparent bg-white px-4 pb-3 pt-4 data-[stuck]:border-slate-200 dark:bg-card dark:data-[stuck]:border-border"
|
|
122
|
-
),
|
|
123
|
-
children: t.title
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ o("div", { className: "space-y-5", children: /* @__PURE__ */ o(
|
|
127
|
-
e,
|
|
128
|
-
{
|
|
129
|
-
...v,
|
|
130
|
-
onPreviewRole: g,
|
|
131
|
-
previewRoleId: y,
|
|
132
|
-
onPreviewRoleChange: S
|
|
133
|
-
}
|
|
134
|
-
) })
|
|
113
|
+
/* @__PURE__ */ o(F, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
|
|
114
|
+
"Look everywhere for “",
|
|
115
|
+
r.trim(),
|
|
116
|
+
"”"
|
|
135
117
|
]
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
)
|
|
139
|
-
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
n.length === 0 ? /* @__PURE__ */ i("p", { className: u("py-8 text-center", j), children: [
|
|
121
|
+
"No setting matches “",
|
|
122
|
+
r.trim(),
|
|
123
|
+
"”."
|
|
124
|
+
] }) : /* @__PURE__ */ o(A.Provider, { value: S, children: n.map(({ section: t }) => {
|
|
125
|
+
const e = X[t.id];
|
|
126
|
+
return /* @__PURE__ */ i(
|
|
127
|
+
"section",
|
|
128
|
+
{
|
|
129
|
+
"data-section": t.id,
|
|
130
|
+
"aria-labelledby": `form-settings-${t.id}`,
|
|
131
|
+
className: "border-t border-slate-100 pb-6 first:border-t-0 dark:border-border/60",
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ o(
|
|
134
|
+
"h3",
|
|
135
|
+
{
|
|
136
|
+
id: `form-settings-${t.id}`,
|
|
137
|
+
"data-section-title": "",
|
|
138
|
+
className: u(
|
|
139
|
+
P,
|
|
140
|
+
"sticky top-0 z-10 -mx-4 border-b border-transparent bg-white px-4 pb-3 pt-4 data-[stuck]:border-slate-200 dark:bg-card dark:data-[stuck]:border-border"
|
|
141
|
+
),
|
|
142
|
+
children: t.title
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ o("div", { className: "space-y-5", children: /* @__PURE__ */ o(
|
|
146
|
+
e,
|
|
147
|
+
{
|
|
148
|
+
...k,
|
|
149
|
+
onPreviewRole: y,
|
|
150
|
+
previewRoleId: x,
|
|
151
|
+
onPreviewRoleChange: v
|
|
152
|
+
}
|
|
153
|
+
) })
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
t.id
|
|
157
|
+
);
|
|
158
|
+
}) })
|
|
159
|
+
]
|
|
140
160
|
}
|
|
141
161
|
)
|
|
142
162
|
] });
|
|
143
163
|
}
|
|
144
164
|
export {
|
|
145
|
-
|
|
165
|
+
pt as FormSettings
|
|
146
166
|
};
|
|
@@ -1,47 +1,91 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as h, Fragment as S, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as C } from "@tanstack/react-query";
|
|
3
|
-
import { ExternalLink as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { ExternalLink as $ } from "lucide-react";
|
|
4
|
+
import { useState as N, useRef as I, useEffect as x, useMemo as L } from "react";
|
|
5
|
+
import { useNivaroClient as R } from "../../../context.js";
|
|
6
|
+
import { get as T } from "../../../lib/commands.js";
|
|
7
|
+
import { applyLayoutOps as E } from "../../../lib/layout-ops.js";
|
|
8
|
+
import { cn as g } from "../../../lib/utils.js";
|
|
9
|
+
import { AiTextTools as O } from "../ai-text/AiTextTools.js";
|
|
10
|
+
import { HistoryPanel as P } from "../HistoryPanel.js";
|
|
9
11
|
import { useLayoutEditorHost as _ } from "../host.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
12
|
+
import { LayoutOpsBlocks as q } from "../ops/LayoutOpsBlocks.js";
|
|
13
|
+
import { useRoleNames as F } from "../overview/overview-api.js";
|
|
14
|
+
import { tintCard as H, labelText as j } from "../panel-style.js";
|
|
15
|
+
import { RelationPicker as B } from "../pickers/relation-picker.js";
|
|
16
|
+
import { CostLimitSetting as D } from "../testing/CostLimitSetting.js";
|
|
17
|
+
import { humanizeOpError as z } from "../useLayoutDraft.js";
|
|
18
|
+
import { Setting as y, smallBtn as A, quietText as m, PickList as G, useSettingVisible as v, Segmented as K } from "./controls.js";
|
|
19
|
+
import { useRolePreview as M } from "./settings-api.js";
|
|
20
|
+
import { settingDef as k } from "./settings-registry.js";
|
|
21
|
+
function Ne(e) {
|
|
22
|
+
const r = Number(e.layout.id);
|
|
23
|
+
return /* @__PURE__ */ h(S, { children: [
|
|
24
|
+
/* @__PURE__ */ t(V, { ...e }),
|
|
25
|
+
/* @__PURE__ */ t(J, { ...e }),
|
|
26
|
+
/* @__PURE__ */ t(b, { k: "tool.describe", layoutId: r }),
|
|
27
|
+
/* @__PURE__ */ t(b, { k: "tool.ai_review", layoutId: r, bundle: e.bundle, apply: e.apply }),
|
|
28
|
+
/* @__PURE__ */ t(X, { ...e }),
|
|
29
|
+
/* @__PURE__ */ t(D, { ...e }),
|
|
30
|
+
/* @__PURE__ */ t(Y, { layoutId: r }),
|
|
31
|
+
/* @__PURE__ */ t(U, { ...e }),
|
|
32
|
+
/* @__PURE__ */ t(Z, { layoutId: r }),
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
q,
|
|
35
|
+
{
|
|
36
|
+
collection: e.collection,
|
|
37
|
+
layoutId: r,
|
|
38
|
+
name: String(e.layout.name ?? "")
|
|
39
|
+
}
|
|
40
|
+
)
|
|
25
41
|
] });
|
|
26
42
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const Q = {
|
|
44
|
+
off: "Turn off Ask why on every save",
|
|
45
|
+
note: "Ask for a reason on every save",
|
|
46
|
+
note_ticket: "Ask for a reason and a ticket on every save"
|
|
47
|
+
};
|
|
48
|
+
function U({ layout: e, set: r }) {
|
|
49
|
+
const n = e.change_note, a = n === "note" || n === "note_ticket" ? n : "off";
|
|
50
|
+
return /* @__PURE__ */ t(
|
|
51
|
+
y,
|
|
52
|
+
{
|
|
53
|
+
k: "layout.change_note",
|
|
54
|
+
control: /* @__PURE__ */ t(
|
|
55
|
+
K,
|
|
56
|
+
{
|
|
57
|
+
ariaLabel: "Ask why on every save",
|
|
58
|
+
value: a,
|
|
59
|
+
options: [
|
|
60
|
+
{ value: "off", label: "Off" },
|
|
61
|
+
{ value: "note", label: "Reason" },
|
|
62
|
+
{ value: "note_ticket", label: "Reason + ticket" }
|
|
63
|
+
],
|
|
64
|
+
onChange: (o) => r({ change_note: o === "off" ? null : o }, Q[o])
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
note: a === "off" ? null : "Autosave stays off for this form: every save waits for its reason."
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function V({ collection: e, layout: r }) {
|
|
72
|
+
const n = _(), [a, o] = N(null), l = r.slug ? String(r.slug) : null, c = a ? `${n.recordLink(e, a)}${l ? `?layout=${encodeURIComponent(l)}` : ""}` : null;
|
|
73
|
+
return /* @__PURE__ */ t(
|
|
30
74
|
y,
|
|
31
75
|
{
|
|
32
76
|
k: "tool.preview_record",
|
|
33
|
-
note:
|
|
34
|
-
children: /* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
77
|
+
note: l ? `The record opens pinned to this form (?layout=${l}).` : "Without a link name the record opens on whichever layout it resolves to.",
|
|
78
|
+
children: /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
79
|
+
/* @__PURE__ */ t("div", { className: "min-w-[180px] flex-1", children: /* @__PURE__ */ t(
|
|
80
|
+
B,
|
|
37
81
|
{
|
|
38
|
-
relatedCollection:
|
|
39
|
-
value:
|
|
40
|
-
onChange: (s) =>
|
|
82
|
+
relatedCollection: e,
|
|
83
|
+
value: a,
|
|
84
|
+
onChange: (s) => o(s == null || s === "" ? null : String(s)),
|
|
41
85
|
placeholder: "Pick a record…"
|
|
42
86
|
}
|
|
43
87
|
) }),
|
|
44
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ h(
|
|
45
89
|
"a",
|
|
46
90
|
{
|
|
47
91
|
href: c ?? void 0,
|
|
@@ -49,9 +93,9 @@ function H({ collection: t, layout: l }) {
|
|
|
49
93
|
rel: "noreferrer",
|
|
50
94
|
"aria-disabled": !c,
|
|
51
95
|
"data-layout-record-preview-open": !0,
|
|
52
|
-
className:
|
|
96
|
+
className: g(A, !c && "pointer-events-none opacity-40"),
|
|
53
97
|
children: [
|
|
54
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ t($, { className: "h-3.5 w-3.5" }),
|
|
55
99
|
"Open in a new tab"
|
|
56
100
|
]
|
|
57
101
|
}
|
|
@@ -60,120 +104,150 @@ function H({ collection: t, layout: l }) {
|
|
|
60
104
|
}
|
|
61
105
|
);
|
|
62
106
|
}
|
|
63
|
-
function
|
|
64
|
-
var
|
|
65
|
-
if (
|
|
66
|
-
return `As ${
|
|
67
|
-
if (!
|
|
68
|
-
const
|
|
69
|
-
return
|
|
107
|
+
function W(e, r) {
|
|
108
|
+
var l;
|
|
109
|
+
if (e.role.admin_access)
|
|
110
|
+
return `As ${e.role.name}: admin — default layout, every field.`;
|
|
111
|
+
if (!e.can_read) return `As ${e.role.name}: cannot read ${r} at all.`;
|
|
112
|
+
const n = [`gets “${((l = e.layout) == null ? void 0 : l.name) ?? "no layout"}”`], a = e.hidden_fields.length, o = e.readonly_fields.length;
|
|
113
|
+
return a && n.push(`${a} field${a === 1 ? "" : "s"} hidden`), o && n.push(`${o} read-only`), e.can_update || n.push("cannot edit"), `As ${e.role.name}: ${n.join(" · ")}`;
|
|
70
114
|
}
|
|
71
|
-
function
|
|
72
|
-
collection:
|
|
73
|
-
onPreviewRole:
|
|
74
|
-
previewRoleId:
|
|
75
|
-
onPreviewRoleChange:
|
|
115
|
+
function J({
|
|
116
|
+
collection: e,
|
|
117
|
+
onPreviewRole: r,
|
|
118
|
+
previewRoleId: n,
|
|
119
|
+
onPreviewRoleChange: a
|
|
76
120
|
}) {
|
|
77
|
-
const { data:
|
|
78
|
-
return
|
|
121
|
+
const { data: o = [] } = F(!0), [l, c] = N(null), s = a ? n ?? null : l, u = a ?? c, { data: i = null, isFetching: p } = M(e, s), f = I(r);
|
|
122
|
+
return f.current = r, x(() => {
|
|
79
123
|
var d;
|
|
80
|
-
(d =
|
|
81
|
-
}, [s,
|
|
124
|
+
(d = f.current) == null || d.call(f, s ? i : null);
|
|
125
|
+
}, [s, i]), x(() => () => {
|
|
82
126
|
var d;
|
|
83
|
-
return (d =
|
|
84
|
-
}, []), /* @__PURE__ */
|
|
127
|
+
return (d = f.current) == null ? void 0 : d.call(f, null);
|
|
128
|
+
}, []), /* @__PURE__ */ t(
|
|
85
129
|
y,
|
|
86
130
|
{
|
|
87
131
|
k: "tool.preview_as_role",
|
|
88
|
-
control: /* @__PURE__ */
|
|
89
|
-
|
|
132
|
+
control: /* @__PURE__ */ t(
|
|
133
|
+
G,
|
|
90
134
|
{
|
|
91
135
|
ariaLabel: "Preview as role",
|
|
92
136
|
value: s,
|
|
93
|
-
options: [...
|
|
137
|
+
options: [...o].sort((d, w) => d.name.localeCompare(w.name)).map((d) => ({ value: d.id, label: d.name })),
|
|
94
138
|
clearLabel: "Nobody (off)",
|
|
95
|
-
onChange:
|
|
139
|
+
onChange: u
|
|
96
140
|
}
|
|
97
141
|
),
|
|
98
|
-
children: s && /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
142
|
+
children: s && /* @__PURE__ */ t("div", { "data-role-preview": !0, className: g(H, "p-3 text-[12px]"), children: p && !i ? /* @__PURE__ */ t("p", { className: m, children: "Checking…" }) : i ? /* @__PURE__ */ h(S, { children: [
|
|
143
|
+
/* @__PURE__ */ t(
|
|
100
144
|
"p",
|
|
101
145
|
{
|
|
102
|
-
className:
|
|
146
|
+
className: g(
|
|
103
147
|
"text-slate-700 dark:text-foreground",
|
|
104
|
-
!
|
|
148
|
+
!i.can_read && "text-[#9c2f47] dark:text-[#f08aa1]"
|
|
105
149
|
),
|
|
106
|
-
children:
|
|
150
|
+
children: W(i, e)
|
|
107
151
|
}
|
|
108
152
|
),
|
|
109
|
-
|
|
110
|
-
] }) : /* @__PURE__ */
|
|
153
|
+
i.note && /* @__PURE__ */ t("p", { className: g("mt-1", m), children: i.note })
|
|
154
|
+
] }) : /* @__PURE__ */ t("p", { className: m, children: "Could not preview this role." }) })
|
|
111
155
|
}
|
|
112
156
|
);
|
|
113
157
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
|
|
158
|
+
function b({
|
|
159
|
+
k: e,
|
|
160
|
+
layoutId: r,
|
|
161
|
+
bundle: n,
|
|
162
|
+
apply: a
|
|
163
|
+
}) {
|
|
164
|
+
var s, u;
|
|
165
|
+
const o = _(), l = L(
|
|
166
|
+
() => n && a ? {
|
|
167
|
+
bundle: n,
|
|
168
|
+
apply: a,
|
|
169
|
+
check: (i) => {
|
|
170
|
+
try {
|
|
171
|
+
return E(n, i), null;
|
|
172
|
+
} catch (p) {
|
|
173
|
+
return z(p instanceof Error ? p.message : String(p));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} : void 0,
|
|
177
|
+
[n, a]
|
|
178
|
+
), c = e === "tool.ai_review" ? (s = o.aiReviewSlot) == null ? void 0 : s.call(o, r, l) : (u = o.explainSlot) == null ? void 0 : u.call(o, {
|
|
117
179
|
kind: "config",
|
|
118
180
|
type: "layout",
|
|
119
|
-
id:
|
|
120
|
-
label: "Describe this
|
|
181
|
+
id: r,
|
|
182
|
+
label: "Describe this form"
|
|
121
183
|
});
|
|
122
|
-
return /* @__PURE__ */
|
|
184
|
+
return /* @__PURE__ */ t(y, { k: e, children: c ?? /* @__PURE__ */ t("p", { className: m, children: "Not offered in this app." }) });
|
|
185
|
+
}
|
|
186
|
+
function X({ layout: e, bundle: r, collection: n, apply: a }) {
|
|
187
|
+
const o = _();
|
|
188
|
+
return /* @__PURE__ */ t(y, { k: "tool.ai_text", children: o.isAdmin && a ? /* @__PURE__ */ t(
|
|
189
|
+
O,
|
|
190
|
+
{
|
|
191
|
+
layoutId: Number(e.id),
|
|
192
|
+
bundle: r,
|
|
193
|
+
collection: n,
|
|
194
|
+
apply: a
|
|
195
|
+
}
|
|
196
|
+
) : /* @__PURE__ */ t("p", { className: m, children: "Not offered here: administrators only." }) });
|
|
123
197
|
}
|
|
124
|
-
function
|
|
125
|
-
var
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
128
|
-
const
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
|
|
198
|
+
function Y({ layoutId: e }) {
|
|
199
|
+
var l, c;
|
|
200
|
+
const r = v("tool.version_history"), n = v("tool.version_diff"), a = v("tool.version_restore");
|
|
201
|
+
if (!r && !n && !a) return null;
|
|
202
|
+
const o = k("tool.version_history");
|
|
203
|
+
return /* @__PURE__ */ h("div", { "data-setting": "tool.version_history", className: "space-y-1.5", children: [
|
|
204
|
+
/* @__PURE__ */ t("p", { className: j, children: o == null ? void 0 : o.label }),
|
|
205
|
+
/* @__PURE__ */ t(P, { layoutId: e }),
|
|
206
|
+
/* @__PURE__ */ h("p", { className: m, children: [
|
|
207
|
+
o == null ? void 0 : o.effect,
|
|
134
208
|
" ",
|
|
135
|
-
(
|
|
209
|
+
(l = k("tool.version_diff")) == null ? void 0 : l.effect,
|
|
136
210
|
" ",
|
|
137
|
-
(c =
|
|
211
|
+
(c = k("tool.version_restore")) == null ? void 0 : c.effect
|
|
138
212
|
] })
|
|
139
213
|
] });
|
|
140
214
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
215
|
+
function Z({ layoutId: e }) {
|
|
216
|
+
const r = R(), [n, a] = N(!1), { data: o, isFetching: l, isError: c, refetch: s } = C({
|
|
143
217
|
queryKey: ["layout-editor", "drift"],
|
|
144
|
-
queryFn: () =>
|
|
145
|
-
enabled:
|
|
218
|
+
queryFn: () => r.request(T("/collection-layouts/drift")).then((i) => Array.isArray(i == null ? void 0 : i.data) ? i.data : []),
|
|
219
|
+
enabled: n,
|
|
146
220
|
staleTime: 0
|
|
147
|
-
}),
|
|
148
|
-
return /* @__PURE__ */
|
|
221
|
+
}), u = o == null ? void 0 : o.find((i) => Number(i.layout_id) === e);
|
|
222
|
+
return /* @__PURE__ */ h(
|
|
149
223
|
y,
|
|
150
224
|
{
|
|
151
225
|
k: "tool.layout_drift",
|
|
152
|
-
control: /* @__PURE__ */
|
|
226
|
+
control: /* @__PURE__ */ t(
|
|
153
227
|
"button",
|
|
154
228
|
{
|
|
155
229
|
type: "button",
|
|
156
|
-
className:
|
|
157
|
-
disabled:
|
|
158
|
-
onClick: () =>
|
|
159
|
-
children:
|
|
230
|
+
className: A,
|
|
231
|
+
disabled: l,
|
|
232
|
+
onClick: () => n ? void s() : a(!0),
|
|
233
|
+
children: l ? "Checking…" : "Check now"
|
|
160
234
|
}
|
|
161
235
|
),
|
|
162
236
|
children: [
|
|
163
|
-
|
|
164
|
-
|
|
237
|
+
n && !l && c && /* @__PURE__ */ t("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "The check failed." }),
|
|
238
|
+
n && o && !l && /* @__PURE__ */ t("div", { "data-layout-drift": !0, className: "text-[12px]", children: u ? /* @__PURE__ */ t("ul", { className: "space-y-1", children: u.warnings.map((i) => /* @__PURE__ */ t(
|
|
165
239
|
"li",
|
|
166
240
|
{
|
|
167
241
|
className: "rounded bg-[#fae6eb] px-1.5 py-1 text-[#9c2f47] dark:bg-[#3d1621] dark:text-[#f08aa1]",
|
|
168
|
-
children:
|
|
242
|
+
children: i
|
|
169
243
|
},
|
|
170
|
-
|
|
171
|
-
)) }) : /* @__PURE__ */
|
|
244
|
+
i
|
|
245
|
+
)) }) : /* @__PURE__ */ t("p", { className: m, children: "No drift: the form matches its last saved version." }) })
|
|
172
246
|
]
|
|
173
247
|
}
|
|
174
248
|
);
|
|
175
249
|
}
|
|
176
250
|
export {
|
|
177
|
-
|
|
178
|
-
|
|
251
|
+
Ne as ToolsSection,
|
|
252
|
+
W as rolePreviewSummary
|
|
179
253
|
};
|