@nivaro/react 0.2.53 → 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 +113 -2
- package/dist/layout-editor.d.ts +248 -2
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +4058 -3942
- 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
|
@@ -3,88 +3,90 @@ import { MoreHorizontal as R } from "lucide-react";
|
|
|
3
3
|
import { useRef as v, useState as k, useEffect as _ } from "react";
|
|
4
4
|
import { createPortal as C } from "react-dom";
|
|
5
5
|
import { cn as w } from "../../lib/utils.js";
|
|
6
|
-
function B({ children:
|
|
6
|
+
function B({ children: m }) {
|
|
7
7
|
var f, p;
|
|
8
|
-
const
|
|
8
|
+
const r = v(null), h = v(null), [l, o] = k(!1), u = v(!1);
|
|
9
9
|
u.current = l;
|
|
10
|
-
const
|
|
10
|
+
const a = v(0), [t, b] = k(!1);
|
|
11
11
|
if (_(() => {
|
|
12
|
-
var
|
|
13
|
-
const e = (
|
|
12
|
+
var d;
|
|
13
|
+
const e = (d = r.current) == null ? void 0 : d.closest("[data-nvr-header-row]");
|
|
14
14
|
if (!e) return;
|
|
15
15
|
const i = () => {
|
|
16
|
-
u.current ?
|
|
16
|
+
u.current ? a.current > 0 && e.clientWidth > a.current + 32 && o(!1) : e.scrollWidth > e.clientWidth + 2 && (a.current = e.scrollWidth, o(!0), b(!1));
|
|
17
17
|
};
|
|
18
18
|
i();
|
|
19
19
|
const g = new ResizeObserver(i);
|
|
20
20
|
return g.observe(e), () => g.disconnect();
|
|
21
21
|
}), _(() => {
|
|
22
|
-
if (!
|
|
22
|
+
if (!t) return;
|
|
23
23
|
const e = (g) => {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
24
|
+
const d = g.target;
|
|
25
|
+
if (d.closest("[data-nvr-header-tools-panel]") || d.closest("[data-nvr-header-tools-btn]") || d.closest("[data-nvr-header-menu-panel]") || d.closest("[data-radix-popper-content-wrapper]"))
|
|
26
26
|
return;
|
|
27
|
-
const y =
|
|
28
|
-
y && !y.contains(
|
|
27
|
+
const y = d.closest('[role="dialog"]');
|
|
28
|
+
y && !y.contains(r.current) || b(!1);
|
|
29
29
|
}, i = (g) => {
|
|
30
|
-
g.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") &&
|
|
30
|
+
g.target.closest("[data-nvr-header-menu-panel] [data-nvr-menu-close]") && b(!1);
|
|
31
31
|
};
|
|
32
32
|
return window.addEventListener("mousedown", e, !0), window.addEventListener("click", i), () => {
|
|
33
33
|
window.removeEventListener("mousedown", e, !0), window.removeEventListener("click", i);
|
|
34
34
|
};
|
|
35
|
-
}, [
|
|
36
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
37
|
-
const s =
|
|
38
|
-
return /* @__PURE__ */ x("div", { ref:
|
|
35
|
+
}, [t]), !l)
|
|
36
|
+
return /* @__PURE__ */ c("div", { ref: r, className: "contents", children: m });
|
|
37
|
+
const s = t ? (f = h.current) == null ? void 0 : f.getBoundingClientRect() : void 0, n = ((p = h.current) == null ? void 0 : p.closest('[role="dialog"]')) ?? document.body;
|
|
38
|
+
return /* @__PURE__ */ x("div", { ref: r, className: "flex shrink-0 items-center", children: [
|
|
39
39
|
/* @__PURE__ */ c(
|
|
40
40
|
"button",
|
|
41
41
|
{
|
|
42
42
|
ref: h,
|
|
43
43
|
type: "button",
|
|
44
44
|
"data-nvr-header-tools-btn": !0,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
"aria-expanded": t,
|
|
46
|
+
"aria-label": "More tools",
|
|
47
|
+
"data-tip": "More tools",
|
|
48
|
+
onClick: () => b((e) => !e),
|
|
47
49
|
className: w(
|
|
48
|
-
"inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
49
|
-
|
|
50
|
+
"inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
|
|
51
|
+
t && "bg-accent text-accent-foreground dark:bg-accent"
|
|
50
52
|
),
|
|
51
53
|
children: /* @__PURE__ */ c(R, { className: "h-4 w-4" })
|
|
52
54
|
}
|
|
53
55
|
),
|
|
54
|
-
|
|
56
|
+
t && s && C(
|
|
55
57
|
/* @__PURE__ */ c(
|
|
56
58
|
"div",
|
|
57
59
|
{
|
|
58
60
|
"data-nvr-header-tools-panel": !0,
|
|
59
|
-
style:
|
|
61
|
+
style: n === document.body ? {
|
|
60
62
|
position: "fixed",
|
|
61
63
|
top: s.bottom + 6,
|
|
62
64
|
right: Math.max(8, window.innerWidth - s.right),
|
|
63
65
|
zIndex: 110
|
|
64
66
|
} : {
|
|
65
67
|
position: "absolute",
|
|
66
|
-
top: s.bottom -
|
|
67
|
-
right: Math.max(8,
|
|
68
|
+
top: s.bottom - n.getBoundingClientRect().top + 6,
|
|
69
|
+
right: Math.max(8, n.getBoundingClientRect().right - s.right),
|
|
68
70
|
zIndex: 110
|
|
69
71
|
},
|
|
70
72
|
className: "flex max-w-[440px] flex-wrap items-center justify-end gap-1.5 rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card",
|
|
71
|
-
children:
|
|
73
|
+
children: m
|
|
72
74
|
}
|
|
73
75
|
),
|
|
74
|
-
|
|
76
|
+
n
|
|
75
77
|
)
|
|
76
78
|
] });
|
|
77
79
|
}
|
|
78
80
|
function W({
|
|
79
|
-
children:
|
|
80
|
-
label:
|
|
81
|
+
children: m,
|
|
82
|
+
label: r = "More",
|
|
81
83
|
className: h
|
|
82
84
|
}) {
|
|
83
|
-
var
|
|
84
|
-
const l = v(null), [
|
|
85
|
+
var b, s;
|
|
86
|
+
const l = v(null), [o, u] = k(!1);
|
|
85
87
|
_(() => {
|
|
86
|
-
if (!
|
|
87
|
-
const
|
|
88
|
+
if (!o) return;
|
|
89
|
+
const n = (p) => {
|
|
88
90
|
var i;
|
|
89
91
|
const e = p.target;
|
|
90
92
|
e.closest("[data-nvr-header-menu-panel]") || e.closest("[data-nvr-header-menu-btn]") || e.closest("[data-radix-popper-content-wrapper]") || // A dialog opened from a menu row, not one hosting the form.
|
|
@@ -92,11 +94,11 @@ function W({
|
|
|
92
94
|
}, f = (p) => {
|
|
93
95
|
p.key === "Escape" && u(!1);
|
|
94
96
|
};
|
|
95
|
-
return window.addEventListener("mousedown",
|
|
96
|
-
window.removeEventListener("mousedown",
|
|
97
|
+
return window.addEventListener("mousedown", n, !0), window.addEventListener("keydown", f), () => {
|
|
98
|
+
window.removeEventListener("mousedown", n, !0), window.removeEventListener("keydown", f);
|
|
97
99
|
};
|
|
98
|
-
}, [
|
|
99
|
-
const
|
|
100
|
+
}, [o]);
|
|
101
|
+
const a = o ? (b = l.current) == null ? void 0 : b.getBoundingClientRect() : void 0, t = ((s = l.current) == null ? void 0 : s.closest('[role="dialog"]')) ?? document.body;
|
|
100
102
|
return /* @__PURE__ */ x("div", { className: w("relative shrink-0", h), children: [
|
|
101
103
|
/* @__PURE__ */ x(
|
|
102
104
|
"button",
|
|
@@ -105,37 +107,38 @@ function W({
|
|
|
105
107
|
type: "button",
|
|
106
108
|
"data-nvr-header-menu-btn": !0,
|
|
107
109
|
"aria-haspopup": "menu",
|
|
108
|
-
"aria-expanded":
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
"aria-expanded": o,
|
|
111
|
+
"aria-label": r,
|
|
112
|
+
"data-tip": "More actions",
|
|
113
|
+
onClick: () => u((n) => !n),
|
|
111
114
|
className: w(
|
|
112
|
-
"inline-flex h-9 items-center gap-1 rounded-md border border-input bg-background px-2.5 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
113
|
-
|
|
115
|
+
"inline-flex h-9 items-center gap-1 rounded-md border border-input bg-background px-2.5 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground dark:bg-transparent dark:hover:bg-accent",
|
|
116
|
+
o && "bg-accent text-accent-foreground dark:bg-accent"
|
|
114
117
|
),
|
|
115
118
|
children: [
|
|
116
119
|
/* @__PURE__ */ c(R, { className: "h-4 w-4" }),
|
|
117
|
-
/* @__PURE__ */ c("span", { className: "hidden lg:inline", children:
|
|
120
|
+
/* @__PURE__ */ c("span", { className: "hidden lg:inline", children: r })
|
|
118
121
|
]
|
|
119
122
|
}
|
|
120
123
|
),
|
|
121
|
-
|
|
124
|
+
o && a && C(
|
|
122
125
|
/* @__PURE__ */ c(
|
|
123
126
|
"div",
|
|
124
127
|
{
|
|
125
128
|
"data-nvr-header-menu-panel": !0,
|
|
126
129
|
role: "menu",
|
|
127
|
-
onClick: (
|
|
128
|
-
|
|
130
|
+
onClick: (n) => {
|
|
131
|
+
n.target.closest("[data-nvr-menu-close]") && u(!1);
|
|
129
132
|
},
|
|
130
|
-
style:
|
|
133
|
+
style: t === document.body ? {
|
|
131
134
|
position: "fixed",
|
|
132
|
-
top:
|
|
133
|
-
right: Math.max(8, window.innerWidth -
|
|
135
|
+
top: a.bottom + 6,
|
|
136
|
+
right: Math.max(8, window.innerWidth - a.right),
|
|
134
137
|
zIndex: 110
|
|
135
138
|
} : {
|
|
136
139
|
position: "absolute",
|
|
137
|
-
top:
|
|
138
|
-
right: Math.max(8,
|
|
140
|
+
top: a.bottom - t.getBoundingClientRect().top + 6,
|
|
141
|
+
right: Math.max(8, t.getBoundingClientRect().right - a.right),
|
|
139
142
|
zIndex: 110
|
|
140
143
|
},
|
|
141
144
|
className: w(
|
|
@@ -144,16 +147,16 @@ function W({
|
|
|
144
147
|
"[&_button:hover]:bg-accent [&_button:hover]:text-accent-foreground [&_button_svg]:h-3.5 [&_button_svg]:w-3.5 [&_button_svg]:shrink-0 [&_button_svg]:text-slate-500",
|
|
145
148
|
"[&>[data-nvr-menu-divider]]:my-1 [&>[data-nvr-menu-divider]]:h-px [&>[data-nvr-menu-divider]]:bg-slate-100 dark:[&>[data-nvr-menu-divider]]:bg-border"
|
|
146
149
|
),
|
|
147
|
-
children:
|
|
150
|
+
children: m
|
|
148
151
|
}
|
|
149
152
|
),
|
|
150
|
-
|
|
153
|
+
t
|
|
151
154
|
)
|
|
152
155
|
] });
|
|
153
156
|
}
|
|
154
157
|
function j({
|
|
155
|
-
children:
|
|
156
|
-
className:
|
|
158
|
+
children: m,
|
|
159
|
+
className: r
|
|
157
160
|
}) {
|
|
158
161
|
return /* @__PURE__ */ c(
|
|
159
162
|
"div",
|
|
@@ -161,9 +164,9 @@ function j({
|
|
|
161
164
|
"data-nvr-header-tool-group": !0,
|
|
162
165
|
className: w(
|
|
163
166
|
"inline-flex h-9 shrink-0 items-center rounded-md border border-input bg-background px-0.5 shadow-sm [&>*+*]:border-l [&>*+*]:border-input/70",
|
|
164
|
-
|
|
167
|
+
r
|
|
165
168
|
),
|
|
166
|
-
children:
|
|
169
|
+
children: m
|
|
167
170
|
}
|
|
168
171
|
);
|
|
169
172
|
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { AlertTriangle as i, Info as o } from "lucide-react";
|
|
3
3
|
function m(e) {
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
for (const
|
|
7
|
-
const d =
|
|
8
|
-
d >
|
|
9
|
-
/* @__PURE__ */ t("strong", { className: "font-semibold", children:
|
|
10
|
-
) :
|
|
4
|
+
const a = [], n = /\*\*([^*]+)\*\*|\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g;
|
|
5
|
+
let r = 0, l = 0;
|
|
6
|
+
for (const s of e.matchAll(n)) {
|
|
7
|
+
const d = s.index ?? 0;
|
|
8
|
+
d > r && a.push(/* @__PURE__ */ t("span", { children: e.slice(r, d) }, l++)), s[1] !== void 0 ? a.push(
|
|
9
|
+
/* @__PURE__ */ t("strong", { className: "font-semibold", children: s[1] }, l++)
|
|
10
|
+
) : a.push(
|
|
11
11
|
/* @__PURE__ */ t(
|
|
12
12
|
"a",
|
|
13
13
|
{
|
|
14
|
-
href:
|
|
14
|
+
href: s[3],
|
|
15
15
|
target: "_blank",
|
|
16
16
|
rel: "noreferrer",
|
|
17
17
|
className: "text-nvr-navy underline underline-offset-2 dark:text-nvr-cyan",
|
|
18
|
-
children:
|
|
18
|
+
children: s[2]
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
l++
|
|
21
21
|
)
|
|
22
|
-
),
|
|
22
|
+
), r = d + s[0].length;
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return r < e.length && a.push(/* @__PURE__ */ t("span", { children: e.slice(r) }, l++)), a;
|
|
25
25
|
}
|
|
26
26
|
function h({ group: e }) {
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
27
|
+
const a = e.content_tone ?? "info", n = (e.content ?? "").trim();
|
|
28
|
+
if (a === "divider")
|
|
29
29
|
return /* @__PURE__ */ c("div", { className: "flex items-center gap-3 py-1", "data-content-block": e.key, children: [
|
|
30
30
|
/* @__PURE__ */ t("span", { className: "h-px flex-1 bg-slate-200 dark:bg-border" }),
|
|
31
|
-
(
|
|
31
|
+
(n || e.label) && /* @__PURE__ */ t("span", { className: "text-[11px] font-medium uppercase tracking-wide text-slate-400", children: n || e.label }),
|
|
32
32
|
/* @__PURE__ */ t("span", { className: "h-px flex-1 bg-slate-200 dark:bg-border" })
|
|
33
33
|
] });
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
34
|
+
if (!n) return null;
|
|
35
|
+
const r = n.split(/\n{2,}/), l = a === "warn";
|
|
36
36
|
return /* @__PURE__ */ c(
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
"data-content-block": e.key,
|
|
40
|
-
className: `flex gap-2.5 rounded-lg border px-3.5 py-2.5 ${
|
|
40
|
+
className: `flex gap-2.5 rounded-lg border px-3.5 py-2.5 ${l ? "border-amber-200 bg-amber-50/70 dark:border-amber-500/30 dark:bg-amber-500/10" : "border-slate-200 bg-slate-50/70 dark:border-border dark:bg-muted/40"}`,
|
|
41
41
|
children: [
|
|
42
|
-
|
|
42
|
+
l ? /* @__PURE__ */ t(i, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500" }) : /* @__PURE__ */ t(o, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
43
43
|
/* @__PURE__ */ c("div", { className: "min-w-0 space-y-1.5", children: [
|
|
44
44
|
e.label && e.label !== e.key && /* @__PURE__ */ t(
|
|
45
45
|
"p",
|
|
46
46
|
{
|
|
47
|
-
className: `text-[12.5px] font-semibold ${
|
|
47
|
+
className: `text-[12.5px] font-semibold ${l ? "text-amber-800 dark:text-amber-300" : "text-slate-800 dark:text-foreground"}`,
|
|
48
48
|
children: e.label
|
|
49
49
|
}
|
|
50
50
|
),
|
|
51
|
-
|
|
51
|
+
r.map((s, d) => /* @__PURE__ */ t(
|
|
52
52
|
"p",
|
|
53
53
|
{
|
|
54
|
-
className: `whitespace-pre-wrap text-[12.5px] leading-relaxed ${
|
|
55
|
-
children: m(
|
|
54
|
+
className: `whitespace-pre-wrap text-[12.5px] leading-relaxed ${l ? "text-amber-700 dark:text-amber-300/90" : "text-slate-600 dark:text-muted-foreground"}`,
|
|
55
|
+
children: m(s)
|
|
56
56
|
},
|
|
57
57
|
d
|
|
58
58
|
))
|
|
@@ -61,6 +61,29 @@ function h({ group: e }) {
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
+
function k({ group: e, className: a }) {
|
|
65
|
+
const n = (e.content ?? "").trim();
|
|
66
|
+
if (!n || e.type === "content" || e.content_tone === "divider") return null;
|
|
67
|
+
const r = e.content_tone === "warn";
|
|
68
|
+
return /* @__PURE__ */ c(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
"data-section-intro": e.key,
|
|
72
|
+
className: `flex gap-2 rounded-lg border px-3 py-2 ${r ? "border-amber-200 bg-amber-50/70 dark:border-amber-500/30 dark:bg-amber-500/10" : "border-slate-200 bg-slate-50/70 dark:border-border dark:bg-muted/40"} ${a ?? ""}`,
|
|
73
|
+
children: [
|
|
74
|
+
r ? /* @__PURE__ */ t(i, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500" }) : /* @__PURE__ */ t(o, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
75
|
+
/* @__PURE__ */ t(
|
|
76
|
+
"p",
|
|
77
|
+
{
|
|
78
|
+
className: `min-w-0 whitespace-pre-wrap text-[12.5px] leading-relaxed ${r ? "text-amber-700 dark:text-amber-300/90" : "text-slate-600 dark:text-muted-foreground"}`,
|
|
79
|
+
children: m(n)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
64
86
|
export {
|
|
65
|
-
h as LayoutContentBlock
|
|
87
|
+
h as LayoutContentBlock,
|
|
88
|
+
k as SectionIntro
|
|
66
89
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as p } from "@tanstack/react-query";
|
|
3
|
+
import { EyeOff as h } from "lucide-react";
|
|
4
|
+
import { useState as m, useCallback as x, useMemo as c } from "react";
|
|
5
|
+
import { useNivaroClient as b } from "../../context.js";
|
|
6
|
+
import { get as y } from "../../lib/commands.js";
|
|
7
|
+
import { describeShowWhen as g } from "../layout-editor/show-when.js";
|
|
8
|
+
import { Popover as k, PopoverTrigger as w, PopoverContent as N } from "../ui/popover.js";
|
|
9
|
+
function T(t, r, l) {
|
|
10
|
+
const d = b(), [s, a] = m(!1), o = r == null || r === "" ? null : String(r), e = p({
|
|
11
|
+
queryKey: ["layout-why", t, o],
|
|
12
|
+
enabled: l.enabled && !!o && (l.eager || s),
|
|
13
|
+
staleTime: 6e4,
|
|
14
|
+
retry: !1,
|
|
15
|
+
queryFn: () => d.request(y("/collection-layouts/why", { collection: t, item: o })).then((f) => f.data ?? null)
|
|
16
|
+
}), n = x(() => a(!0), []);
|
|
17
|
+
return { data: e.data ?? null, want: n };
|
|
18
|
+
}
|
|
19
|
+
const v = /^(Locked for your role|Locked while the record is in |Locked by the record’s current state|The ".*" section is locked for your role|Read-only field)/;
|
|
20
|
+
function j(t, r) {
|
|
21
|
+
var d;
|
|
22
|
+
if (!r) return t;
|
|
23
|
+
const l = { ...t };
|
|
24
|
+
for (const [s, a] of Object.entries(t)) {
|
|
25
|
+
if (!v.test(a)) continue;
|
|
26
|
+
const o = ((d = r.locks[s]) == null ? void 0 : d.text) ?? (a === "Read-only field" ? r.record_lock : null);
|
|
27
|
+
o && (l[s] = o);
|
|
28
|
+
}
|
|
29
|
+
return l;
|
|
30
|
+
}
|
|
31
|
+
function E({
|
|
32
|
+
why: t,
|
|
33
|
+
fields: r,
|
|
34
|
+
stepVisible: l
|
|
35
|
+
}) {
|
|
36
|
+
const [d, s] = m(!1), a = c(() => {
|
|
37
|
+
const e = new Map(r.map((n) => [n.field, n.label || n.field]));
|
|
38
|
+
return (n) => e.get(n) ?? n;
|
|
39
|
+
}, [r]), o = c(
|
|
40
|
+
() => (t.hidden ?? []).filter(
|
|
41
|
+
(e) => e.kind !== "step_rule" || !l({ visible_when: JSON.stringify(e.rules ?? []) })
|
|
42
|
+
).map((e) => {
|
|
43
|
+
const n = e.kind === "step_rule" ? g(e.rules, r) : null;
|
|
44
|
+
return {
|
|
45
|
+
...e,
|
|
46
|
+
words: e.kind === "step_rule" ? `“${e.section_label ?? e.section}” shows only when ${n ?? "its rule matches"}` : e.text
|
|
47
|
+
};
|
|
48
|
+
}),
|
|
49
|
+
[t.hidden, l, r]
|
|
50
|
+
);
|
|
51
|
+
return o.length ? /* @__PURE__ */ u(k, { open: d, onOpenChange: s, children: [
|
|
52
|
+
/* @__PURE__ */ i(w, { asChild: !0, children: /* @__PURE__ */ u(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
"data-hidden-by-rules": o.length,
|
|
57
|
+
className: "inline-flex items-center gap-1.5 self-start rounded-md border border-slate-200 bg-white px-2 py-1 text-[12px] text-slate-600 transition-colors hover:bg-muted dark:border-border dark:bg-card dark:text-muted-foreground",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ i(h, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
60
|
+
o.length,
|
|
61
|
+
" ",
|
|
62
|
+
o.length === 1 ? "field" : "fields",
|
|
63
|
+
" hidden by rules"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
) }),
|
|
67
|
+
/* @__PURE__ */ u(N, { align: "start", className: "w-[360px] p-0", children: [
|
|
68
|
+
/* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 text-[12px] text-slate-500 dark:border-border dark:text-muted-foreground", children: [
|
|
69
|
+
"This record opens with the",
|
|
70
|
+
" ",
|
|
71
|
+
/* @__PURE__ */ i("b", { className: "font-medium text-slate-800 dark:text-foreground", children: t.layout.name }),
|
|
72
|
+
" form",
|
|
73
|
+
t.layout.why ? ` because ${t.layout.why}` : "",
|
|
74
|
+
". Only admins see this list."
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ i("ul", { className: "max-h-[320px] divide-y divide-slate-100 overflow-y-auto overscroll-contain dark:divide-border", children: o.map((e) => /* @__PURE__ */ u("li", { className: "px-3 py-2 text-[12.5px]", children: [
|
|
77
|
+
/* @__PURE__ */ i("span", { className: "font-medium text-slate-800 dark:text-foreground", children: a(e.field) }),
|
|
78
|
+
/* @__PURE__ */ i("p", { className: "m-0 text-[12px] text-slate-500 dark:text-muted-foreground", children: e.words })
|
|
79
|
+
] }, `${e.kind}:${e.field}`)) })
|
|
80
|
+
] })
|
|
81
|
+
] }) : null;
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
E as HiddenByRulesNote,
|
|
85
|
+
j as refineLockReasons,
|
|
86
|
+
T as useLockWhy
|
|
87
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useRef as i, useEffect as g, useCallback as C } from "react";
|
|
2
|
+
import { useApiFetchConfig as L } from "../../context.js";
|
|
3
|
+
import { StepClock as y, sessionEvent as F, queueFormUsage as R } from "../../lib/form-usage-beacon.js";
|
|
4
|
+
function x({
|
|
5
|
+
enabled: w,
|
|
6
|
+
layoutId: t,
|
|
7
|
+
collection: o,
|
|
8
|
+
itemId: a,
|
|
9
|
+
step: s
|
|
10
|
+
}) {
|
|
11
|
+
const u = L(), d = i(u);
|
|
12
|
+
d.current = u;
|
|
13
|
+
const l = i(s);
|
|
14
|
+
l.current = s;
|
|
15
|
+
const n = i(null), f = w && t != null && !!o;
|
|
16
|
+
return g(() => {
|
|
17
|
+
if (!f || t == null) return;
|
|
18
|
+
const r = () => typeof document > "u" || document.visibilityState !== "hidden", e = {
|
|
19
|
+
clock: new y(l.current, Date.now(), r()),
|
|
20
|
+
openSent: !1,
|
|
21
|
+
saved: !1,
|
|
22
|
+
elapsed: 0
|
|
23
|
+
};
|
|
24
|
+
n.current = e;
|
|
25
|
+
const c = (S) => {
|
|
26
|
+
const { steps: h, total: m } = e.clock.take(Date.now());
|
|
27
|
+
e.elapsed += m;
|
|
28
|
+
const k = F({
|
|
29
|
+
layoutId: t,
|
|
30
|
+
collection: o,
|
|
31
|
+
item: a,
|
|
32
|
+
openSent: e.openSent,
|
|
33
|
+
saved: e.saved,
|
|
34
|
+
step: e.clock.currentStep,
|
|
35
|
+
steps: h,
|
|
36
|
+
total: m,
|
|
37
|
+
elapsed: e.elapsed,
|
|
38
|
+
final: S
|
|
39
|
+
});
|
|
40
|
+
if (!k) return;
|
|
41
|
+
e.openSent = !0, e.saved = !1;
|
|
42
|
+
const { apiBase: b, authHeaders: E, credentials: D } = d.current;
|
|
43
|
+
R(k, { apiBase: b, authHeaders: E, credentials: D });
|
|
44
|
+
}, p = () => {
|
|
45
|
+
document.visibilityState === "hidden" ? (c(!1), e.clock.pause(Date.now())) : e.clock.resume(Date.now());
|
|
46
|
+
}, v = () => c(!0);
|
|
47
|
+
return document.addEventListener("visibilitychange", p), window.addEventListener("pagehide", v), () => {
|
|
48
|
+
document.removeEventListener("visibilitychange", p), window.removeEventListener("pagehide", v), c(!0), n.current === e && (n.current = null);
|
|
49
|
+
};
|
|
50
|
+
}, [f, t, o, a]), g(() => {
|
|
51
|
+
var r;
|
|
52
|
+
(r = n.current) == null || r.clock.step(s, Date.now());
|
|
53
|
+
}, [s]), { markSaved: C(() => {
|
|
54
|
+
n.current && (n.current.saved = !0);
|
|
55
|
+
}, []) };
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
x as useFormUsageBeacon
|
|
59
|
+
};
|