@nivaro/react 0.2.54 → 0.2.55
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 +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,61 +1,131 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
return !!
|
|
1
|
+
import { useState as C, useRef as h, useCallback as y, useEffect as D } from "react";
|
|
2
|
+
const F = "nvr:layout-draft:", k = (e, t) => `${F}${t.toLowerCase()}:${e}`, J = 1200;
|
|
3
|
+
function q(e) {
|
|
4
|
+
const t = e;
|
|
5
|
+
return !!t && typeof t.label == "string" && Array.isArray(t.ops);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function G(e, t) {
|
|
8
8
|
try {
|
|
9
|
-
const r = window.localStorage.getItem(
|
|
9
|
+
const r = window.localStorage.getItem(k(e, t));
|
|
10
10
|
if (!r) return null;
|
|
11
|
-
const
|
|
12
|
-
return (
|
|
11
|
+
const n = JSON.parse(r);
|
|
12
|
+
return (n == null ? void 0 : n.v) !== 1 || n.layoutId !== e || typeof n.baseRev != "string" || !Array.isArray(n.steps) || n.steps.length === 0 || !n.steps.every(q) ? null : n;
|
|
13
13
|
} catch {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function L(e) {
|
|
18
18
|
try {
|
|
19
|
-
window.localStorage.setItem(
|
|
19
|
+
window.localStorage.setItem(k(e.layoutId, e.userId), JSON.stringify(e));
|
|
20
20
|
} catch {
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function E(e, t) {
|
|
24
24
|
try {
|
|
25
|
-
window.localStorage.removeItem(
|
|
25
|
+
window.localStorage.removeItem(k(e, t));
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
|
|
29
|
+
function M(e, t, r) {
|
|
30
|
+
if (!e || e.steps.length === 0) return null;
|
|
31
|
+
const n = Date.parse(e.saved_at);
|
|
32
|
+
return {
|
|
33
|
+
v: 1,
|
|
34
|
+
layoutId: t,
|
|
35
|
+
userId: r,
|
|
36
|
+
baseRev: e.base_rev,
|
|
37
|
+
steps: e.steps,
|
|
38
|
+
at: Number.isFinite(n) ? n : 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function P(e, t) {
|
|
42
|
+
return e ? t ? e.at > t.at ? e : t : e : t;
|
|
43
|
+
}
|
|
44
|
+
function Y(e, t, r, n) {
|
|
45
|
+
var _;
|
|
46
|
+
const [c, w] = C(null), [K, v] = C("idle"), m = h(null), b = h(!1), p = h(!1), a = h(null), u = r ? `${r}:${t}` : null, $ = ((_ = e.bundle) == null ? void 0 : _.rev) ?? null, T = !n || n.settled, R = (n == null ? void 0 : n.draft) ?? null, i = !!n && n.available, o = n == null ? void 0 : n.writer, A = h(o);
|
|
47
|
+
A.current = o;
|
|
48
|
+
const S = y(() => {
|
|
49
|
+
var l;
|
|
50
|
+
const s = a.current;
|
|
51
|
+
s && (clearTimeout(s.timer), a.current = null, (l = A.current) == null || l.write(s.layoutId, { steps: s.steps, baseRev: s.baseRev }).catch(() => {
|
|
52
|
+
}));
|
|
53
|
+
}, []);
|
|
54
|
+
D(() => S, [S]), D(() => {
|
|
55
|
+
if (!u || !r || !$ || !T || m.current === u || (S(), m.current = u, b.current = !1, p.current = !!R, w(null), v(i ? "idle" : "off"), e.unsavedSteps.length > 0)) return;
|
|
56
|
+
const s = G(t, r), l = M(R, t, r), f = P(s, l);
|
|
57
|
+
f && (b.current = !0, w({
|
|
58
|
+
kind: "offer",
|
|
59
|
+
draft: f,
|
|
60
|
+
stale: f.baseRev !== e.baseRev,
|
|
61
|
+
source: f === l ? "server" : "browser"
|
|
62
|
+
}));
|
|
63
|
+
}, [
|
|
64
|
+
u,
|
|
65
|
+
r,
|
|
66
|
+
$,
|
|
67
|
+
t,
|
|
68
|
+
e.unsavedSteps.length,
|
|
69
|
+
e.baseRev,
|
|
70
|
+
T,
|
|
71
|
+
R,
|
|
72
|
+
i,
|
|
73
|
+
S
|
|
74
|
+
]);
|
|
75
|
+
const g = e.unsavedSteps, N = e.status === "saving";
|
|
76
|
+
D(() => {
|
|
77
|
+
if (!(!u || !r || m.current !== u || b.current || N))
|
|
78
|
+
if (a.current && (clearTimeout(a.current.timer), a.current = null), g.length > 0 && e.baseRev) {
|
|
79
|
+
const s = {
|
|
80
|
+
v: 1,
|
|
81
|
+
layoutId: t,
|
|
82
|
+
userId: r,
|
|
83
|
+
baseRev: e.baseRev,
|
|
84
|
+
steps: g.map((f) => ({ label: f.label, ops: f.ops })),
|
|
85
|
+
at: Date.now()
|
|
86
|
+
};
|
|
87
|
+
if (L(s), !o || !i) return;
|
|
88
|
+
v("pending");
|
|
89
|
+
const l = setTimeout(() => {
|
|
90
|
+
a.current = null, o.write(t, { steps: s.steps, baseRev: s.baseRev }).then(() => {
|
|
91
|
+
p.current = !0, v("kept");
|
|
92
|
+
}).catch(() => v("failed"));
|
|
93
|
+
}, J);
|
|
94
|
+
a.current = { timer: l, layoutId: t, steps: s.steps, baseRev: s.baseRev };
|
|
95
|
+
} else g.length === 0 && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
|
|
96
|
+
})), i && v("idle"));
|
|
97
|
+
}, [u, r, t, g, N, e.baseRev, c, o, i]);
|
|
98
|
+
const O = e.restore, d = y(() => {
|
|
99
|
+
(c == null ? void 0 : c.kind) === "offer" && (b.current = !1, w(null), O(c.draft.steps));
|
|
100
|
+
}, [c, O]), x = y(() => {
|
|
101
|
+
(c == null ? void 0 : c.kind) === "offer" && r && (E(t, r), o && i && p.current && (p.current = !1, o.clear(t).catch(() => {
|
|
102
|
+
}))), b.current = !1, w(null);
|
|
103
|
+
}, [c, r, t, o, i]);
|
|
104
|
+
return { state: c, recover: d, dismiss: x, sync: K };
|
|
105
|
+
}
|
|
106
|
+
function j(e) {
|
|
107
|
+
const t = "Only you see these changes until you save (⌘S).";
|
|
108
|
+
switch (e) {
|
|
109
|
+
case "kept":
|
|
110
|
+
return `${t} Kept for you on the server: carry on from any browser.`;
|
|
111
|
+
case "pending":
|
|
112
|
+
return `${t} Keeping them for you on the server…`;
|
|
113
|
+
case "failed":
|
|
114
|
+
return `${t} They are kept in this browser; the server copy could not be written.`;
|
|
115
|
+
case "off":
|
|
116
|
+
return `${t} They are kept in this browser.`;
|
|
117
|
+
default:
|
|
118
|
+
return t;
|
|
119
|
+
}
|
|
54
120
|
}
|
|
55
121
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
122
|
+
J as STAGED_SYNC_MS,
|
|
123
|
+
E as clearStoredDraft,
|
|
124
|
+
M as fromServerDraft,
|
|
125
|
+
P as pickDraft,
|
|
126
|
+
G as readStoredDraft,
|
|
127
|
+
j as stagedTip,
|
|
128
|
+
k as storedDraftKey,
|
|
129
|
+
Y as useDraftRecovery,
|
|
130
|
+
L as writeStoredDraft
|
|
61
131
|
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Bookmark as R } from "lucide-react";
|
|
3
|
+
import { useState as f } from "react";
|
|
4
|
+
import { toast as N } from "sonner";
|
|
5
|
+
import { entryConfigOf as O, ENTRY_PRESETS_MAX as k, PRESET_PARTS as B, sanitizeEntryConfig as L } from "../../../lib/entry-config.js";
|
|
6
|
+
import { cn as S } from "../../../lib/utils.js";
|
|
7
|
+
import { Popover as j, PopoverTrigger as q, PopoverContent as D } from "../../ui/popover.js";
|
|
8
|
+
import { effectText as m } from "../panel-style.js";
|
|
9
|
+
import { barBtn as F } from "../toolbar-kit.js";
|
|
10
|
+
import { partsSet as P, presetSummary as z, PART_LABEL as K, presetOps as M, capturePreset as W } from "./presets.js";
|
|
11
|
+
function ee({
|
|
12
|
+
bundle: C,
|
|
13
|
+
rows: l,
|
|
14
|
+
apply: h,
|
|
15
|
+
className: E
|
|
16
|
+
}) {
|
|
17
|
+
const [T, i] = f(!1), u = O(C.layout), n = u.presets ?? [], r = l.length === 1 ? l[0] : null, [d, g] = f(""), [c, x] = f([]), b = r ? P(r) : [], w = (e) => {
|
|
18
|
+
i(e), e && (g(""), x(r ? P(r) : []));
|
|
19
|
+
}, y = () => {
|
|
20
|
+
if (!r || !d.trim() || c.length === 0) return;
|
|
21
|
+
const e = W(d, r, c), a = L({ ...u, presets: [...n, e] });
|
|
22
|
+
h([{ op: "layout_update", patch: { entry_config: a } }], {
|
|
23
|
+
label: `Save preset “${e.name}”`
|
|
24
|
+
}), i(!1), N.success(`Saved the preset “${e.name}”`);
|
|
25
|
+
}, A = (e) => {
|
|
26
|
+
const a = n.find(($) => $.id === e);
|
|
27
|
+
if (!a) return;
|
|
28
|
+
const { ops: p, changed: o } = M(a, l);
|
|
29
|
+
if (!o) {
|
|
30
|
+
N.info(`Already set like “${a.name}”`), i(!1);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
h(p, {
|
|
34
|
+
label: `Apply preset “${a.name}” to ${o} ${o === 1 ? "field" : "fields"}`
|
|
35
|
+
}), i(!1);
|
|
36
|
+
}, v = n.length >= k;
|
|
37
|
+
return /* @__PURE__ */ s(j, { open: T, onOpenChange: w, children: [
|
|
38
|
+
/* @__PURE__ */ t(q, { asChild: !0, children: /* @__PURE__ */ s(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
type: "button",
|
|
42
|
+
"data-placement-presets": "",
|
|
43
|
+
"data-tip": "Save these settings under a name, or apply a saved bundle",
|
|
44
|
+
className: S(F, E),
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ t(R, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
47
|
+
"Presets",
|
|
48
|
+
n.length > 0 && /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-500 dark:text-muted-foreground", children: n.length })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
) }),
|
|
52
|
+
/* @__PURE__ */ s(
|
|
53
|
+
D,
|
|
54
|
+
{
|
|
55
|
+
side: "left",
|
|
56
|
+
align: "start",
|
|
57
|
+
className: "w-[300px] space-y-3 p-3 text-[12px]",
|
|
58
|
+
"data-presets-popover": "",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
61
|
+
/* @__PURE__ */ s("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: [
|
|
62
|
+
"Apply to ",
|
|
63
|
+
l.length === 1 ? "this field" : `${l.length} fields`
|
|
64
|
+
] }),
|
|
65
|
+
n.length === 0 ? /* @__PURE__ */ s("p", { className: m, children: [
|
|
66
|
+
"No presets yet.",
|
|
67
|
+
" ",
|
|
68
|
+
r ? "Save this field’s settings below." : "Select one field to save its settings as a preset."
|
|
69
|
+
] }) : /* @__PURE__ */ t("ul", { className: "m-0 max-h-48 list-none space-y-0.5 overflow-y-auto p-0", children: n.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
"data-preset-apply": e.id,
|
|
74
|
+
onClick: () => A(e.id),
|
|
75
|
+
className: "flex w-full flex-col rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.name }),
|
|
78
|
+
/* @__PURE__ */ t("span", { className: S(m, "truncate"), children: z(e) })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
) }, e.id)) })
|
|
82
|
+
] }),
|
|
83
|
+
r && /* @__PURE__ */ s("div", { className: "space-y-2 border-t border-slate-200 pt-3 dark:border-border", children: [
|
|
84
|
+
/* @__PURE__ */ t("p", { className: "m-0 text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: "Save this field’s settings" }),
|
|
85
|
+
b.length === 0 ? /* @__PURE__ */ t("p", { className: m, children: "Nothing is set on this field yet: change its width, make it required or add help text first." }) : /* @__PURE__ */ s(_, { children: [
|
|
86
|
+
/* @__PURE__ */ s("fieldset", { className: "m-0 grid grid-cols-2 gap-x-3 gap-y-1 border-0 p-0", children: [
|
|
87
|
+
/* @__PURE__ */ t("legend", { className: "sr-only", children: "What the preset sets" }),
|
|
88
|
+
B.filter((e) => b.includes(e)).map((e) => /* @__PURE__ */ s(
|
|
89
|
+
"label",
|
|
90
|
+
{
|
|
91
|
+
className: "flex items-center gap-1.5 text-slate-700 dark:text-foreground",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ t(
|
|
94
|
+
"input",
|
|
95
|
+
{
|
|
96
|
+
type: "checkbox",
|
|
97
|
+
checked: c.includes(e),
|
|
98
|
+
onChange: (a) => x(
|
|
99
|
+
(p) => a.target.checked ? [...p, e] : p.filter((o) => o !== e)
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
K[e]
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
e
|
|
107
|
+
))
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"input",
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
"aria-label": "Preset name",
|
|
114
|
+
placeholder: "Name, e.g. Narrow and required",
|
|
115
|
+
maxLength: 60,
|
|
116
|
+
value: d,
|
|
117
|
+
onChange: (e) => g(e.target.value),
|
|
118
|
+
onKeyDown: (e) => {
|
|
119
|
+
e.key === "Enter" && (e.preventDefault(), y());
|
|
120
|
+
},
|
|
121
|
+
className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:border-border dark:bg-background"
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ t(
|
|
125
|
+
"button",
|
|
126
|
+
{
|
|
127
|
+
type: "button",
|
|
128
|
+
"data-preset-save": "",
|
|
129
|
+
disabled: !d.trim() || c.length === 0 || v,
|
|
130
|
+
onClick: y,
|
|
131
|
+
className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white transition-colors hover:bg-[#00b8e0] disabled:opacity-40",
|
|
132
|
+
children: "Save preset"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
v && /* @__PURE__ */ s("p", { className: m, children: [
|
|
136
|
+
"This form holds ",
|
|
137
|
+
k,
|
|
138
|
+
" presets: delete one in Form settings first."
|
|
139
|
+
] })
|
|
140
|
+
] })
|
|
141
|
+
] })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
ee as PlacementPresets
|
|
149
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { sanitizeEntryConfig as a, ENTRY_PRESETS_MAX as p, PRESET_PARTS as h } from "../../../lib/entry-config.js";
|
|
2
|
+
import { readOverrides as l, withKey as _ } from "../inspector/model.js";
|
|
3
|
+
const k = {
|
|
4
|
+
width: "Width",
|
|
5
|
+
required: "Required",
|
|
6
|
+
help: "Help text",
|
|
7
|
+
placeholder: "Placeholder",
|
|
8
|
+
input: "Input and format",
|
|
9
|
+
lock: "Lock rule"
|
|
10
|
+
}, d = {
|
|
11
|
+
width: [],
|
|
12
|
+
required: ["required"],
|
|
13
|
+
help: ["note"],
|
|
14
|
+
placeholder: ["placeholder"],
|
|
15
|
+
input: ["interface", "options"],
|
|
16
|
+
lock: []
|
|
17
|
+
};
|
|
18
|
+
function y(n) {
|
|
19
|
+
const e = l(n);
|
|
20
|
+
return h.filter((t) => t === "width" ? n.col_span != null : t === "lock" ? !!n.lock_conditions : d[t].some((o) => e[o] !== void 0));
|
|
21
|
+
}
|
|
22
|
+
const g = () => `p${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
23
|
+
function P(n, e, t) {
|
|
24
|
+
const o = l(e), c = {};
|
|
25
|
+
for (const s of t) for (const i of d[s]) o[i] !== void 0 && (c[i] = o[i]);
|
|
26
|
+
const r = { id: g(), name: n.trim(), parts: [...t] };
|
|
27
|
+
return t.includes("width") && (r.col_span = e.col_span ?? null), Object.keys(c).length && (r.overrides = c), t.includes("lock") && (r.lock_conditions = e.lock_conditions ?? null), r;
|
|
28
|
+
}
|
|
29
|
+
function m(n, e) {
|
|
30
|
+
var r;
|
|
31
|
+
const t = {};
|
|
32
|
+
let o = l(e), c = !1;
|
|
33
|
+
for (const s of n.parts)
|
|
34
|
+
if (s === "width") {
|
|
35
|
+
const i = n.col_span ?? null;
|
|
36
|
+
(e.col_span ?? null) !== i && (t.col_span = i);
|
|
37
|
+
} else if (s === "lock") {
|
|
38
|
+
const i = n.lock_conditions ?? null;
|
|
39
|
+
(e.lock_conditions ?? null) !== i && (t.lock_conditions = i);
|
|
40
|
+
} else
|
|
41
|
+
for (const i of d[s]) {
|
|
42
|
+
const u = (r = n.overrides) == null ? void 0 : r[i], f = o == null ? void 0 : o[i];
|
|
43
|
+
JSON.stringify(u) !== JSON.stringify(f) && (o = _(o ?? {}, i, u), c = !0);
|
|
44
|
+
}
|
|
45
|
+
return c && (t.overrides = o), Object.keys(t).length ? t : null;
|
|
46
|
+
}
|
|
47
|
+
function E(n, e) {
|
|
48
|
+
const t = [];
|
|
49
|
+
for (const o of e) {
|
|
50
|
+
const c = m(n, o);
|
|
51
|
+
c && t.push({
|
|
52
|
+
op: "update_placement",
|
|
53
|
+
at: { field: o.field, group_key: o.group_key },
|
|
54
|
+
patch: c
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return { ops: t, changed: t.length };
|
|
58
|
+
}
|
|
59
|
+
function R(n, e) {
|
|
60
|
+
return a({ ...n, presets: e.slice(0, p) });
|
|
61
|
+
}
|
|
62
|
+
const O = (n) => n.parts.length ? n.parts.map((e) => k[e]).join(", ") : "Nothing set";
|
|
63
|
+
export {
|
|
64
|
+
k as PART_LABEL,
|
|
65
|
+
P as capturePreset,
|
|
66
|
+
y as partsSet,
|
|
67
|
+
E as presetOps,
|
|
68
|
+
m as presetPatch,
|
|
69
|
+
O as presetSummary,
|
|
70
|
+
R as withPresets
|
|
71
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as l, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { Undo2 as N, X as C, Check as O } from "lucide-react";
|
|
3
|
+
import { useState as m, useCallback as d, useMemo as T } from "react";
|
|
4
|
+
import { entryConfigOf as j, sanitizeEntryConfig as _ } from "../../../lib/entry-config.js";
|
|
5
|
+
import { cn as f } from "../../../lib/utils.js";
|
|
6
|
+
function z(e, t) {
|
|
7
|
+
return e.includes(t) ? e.filter((r) => r !== t) : [...e, t];
|
|
8
|
+
}
|
|
9
|
+
function E(e, t) {
|
|
10
|
+
const r = j(e.layout);
|
|
11
|
+
return [{ op: "layout_update", patch: { entry_config: _({ ...r, tab_order: t.length ? t : void 0 }) } }];
|
|
12
|
+
}
|
|
13
|
+
function A(e, t) {
|
|
14
|
+
const [r, c] = m(!1), [i, u] = m([]), p = d(() => {
|
|
15
|
+
u([]), c(!0);
|
|
16
|
+
}, []), h = d(() => c(!1), []), x = d(() => {
|
|
17
|
+
c(!1), e && i.length > 0 && t(E(e, i), { label: "Set the tab order" });
|
|
18
|
+
}, [e, i, t]), g = d(() => u((a) => a.slice(0, -1)), []), k = d(
|
|
19
|
+
(a) => (n, o) => {
|
|
20
|
+
if (r && (n.kind === "field" || n.kind === "header")) {
|
|
21
|
+
const v = n.field;
|
|
22
|
+
u((w) => z(w, v));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
a(n, o);
|
|
26
|
+
},
|
|
27
|
+
[r]
|
|
28
|
+
), b = T(() => new Map(i.map((a, n) => [a, n + 1])), [i]), y = d(
|
|
29
|
+
(a) => r ? (n) => {
|
|
30
|
+
if (n.kind !== "field" && n.kind !== "header") return (a == null ? void 0 : a(n)) ?? null;
|
|
31
|
+
const o = b.get(n.field);
|
|
32
|
+
return {
|
|
33
|
+
// Outlines, like the design shell's own: they sit outside the field (offset)
|
|
34
|
+
// instead of hugging its label, and a dashed one reads as "not yet".
|
|
35
|
+
className: f(
|
|
36
|
+
"cursor-pointer",
|
|
37
|
+
o ? "bg-nvr-cyan/[0.06] outline outline-2 outline-nvr-cyan" : "outline-dashed outline-1 outline-slate-300 dark:outline-slate-600"
|
|
38
|
+
),
|
|
39
|
+
chip: (
|
|
40
|
+
// An empty dashed ring on a field not numbered yet: a "Click" word on every
|
|
41
|
+
// field shouted over the form and collided with its other tags.
|
|
42
|
+
/* @__PURE__ */ l(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
"data-tab-order-chip": o ?? "",
|
|
46
|
+
role: "img",
|
|
47
|
+
"data-tip": o ? "Click to take it out" : "Click to number it",
|
|
48
|
+
"aria-label": o ? `Tab stop ${o}` : "Not in the tab order yet",
|
|
49
|
+
className: f(
|
|
50
|
+
"inline-flex h-5 min-w-5 items-center justify-center rounded-full text-[11px] font-semibold tabular-nums",
|
|
51
|
+
o ? "bg-nvr-cyan px-1.5 text-white" : "border border-dashed border-slate-400 bg-white dark:border-slate-500 dark:bg-card"
|
|
52
|
+
),
|
|
53
|
+
children: o ?? null
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
};
|
|
58
|
+
} : a,
|
|
59
|
+
[r, b]
|
|
60
|
+
);
|
|
61
|
+
return { active: r, order: i, start: p, cancel: h, done: x, undoLast: g, intercept: k, overlay: y };
|
|
62
|
+
}
|
|
63
|
+
function B({ editor: e }) {
|
|
64
|
+
if (!e.active) return null;
|
|
65
|
+
const t = e.order.length, r = "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted";
|
|
66
|
+
return /* @__PURE__ */ s(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
role: "status",
|
|
70
|
+
"data-tab-order-bar": "",
|
|
71
|
+
className: "sticky top-0 z-30 flex flex-wrap items-center gap-2 border-b border-nvr-cyan/40 bg-white px-4 py-2 text-[12.5px] text-slate-700 dark:bg-card dark:text-foreground",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ s("p", { className: "m-0 min-w-0 flex-1", children: [
|
|
74
|
+
/* @__PURE__ */ l("span", { className: "font-medium", children: "Tab order." }),
|
|
75
|
+
" Click fields in the order Tab should visit them.",
|
|
76
|
+
" ",
|
|
77
|
+
/* @__PURE__ */ l("span", { className: "text-slate-500 dark:text-muted-foreground", children: t === 0 ? "Fields you skip follow in page order." : `${t} numbered; click a number again to take it out.` })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ s("button", { type: "button", className: r, disabled: t === 0, onClick: e.undoLast, children: [
|
|
80
|
+
/* @__PURE__ */ l(N, { className: "h-3.5 w-3.5" }),
|
|
81
|
+
"Undo last"
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ s("button", { type: "button", className: r, onClick: e.cancel, children: [
|
|
84
|
+
/* @__PURE__ */ l(C, { className: "h-3.5 w-3.5" }),
|
|
85
|
+
"Cancel"
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ s(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
"data-tab-order-done": "",
|
|
92
|
+
disabled: t === 0,
|
|
93
|
+
onClick: e.done,
|
|
94
|
+
className: "inline-flex h-7 items-center gap-1 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white hover:bg-nvr-cyan/90 disabled:opacity-40",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ l(O, { className: "h-3.5 w-3.5" }),
|
|
97
|
+
"Done"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
B as TabOrderBar,
|
|
107
|
+
E as tabOrderOps,
|
|
108
|
+
z as toggleInOrder,
|
|
109
|
+
A as useTabOrderEditor
|
|
110
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Sun as s, Moon as i } from "lucide-react";
|
|
3
|
+
import { useState as c, useEffect as d } from "react";
|
|
4
|
+
import { ToolButton as m } from "../toolbar-kit.js";
|
|
5
|
+
const a = () => typeof document < "u" && document.documentElement.classList.contains("dark");
|
|
6
|
+
function f() {
|
|
7
|
+
const [e, r] = c(a);
|
|
8
|
+
return d(() => {
|
|
9
|
+
const t = new MutationObserver(() => r(a()));
|
|
10
|
+
return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
|
|
11
|
+
}, []), e;
|
|
12
|
+
}
|
|
13
|
+
const k = (e, r) => e && !r ? "dark" : "";
|
|
14
|
+
function w({
|
|
15
|
+
on: e,
|
|
16
|
+
onChange: r,
|
|
17
|
+
appDark: t,
|
|
18
|
+
disabled: n
|
|
19
|
+
}) {
|
|
20
|
+
return /* @__PURE__ */ o(
|
|
21
|
+
m,
|
|
22
|
+
{
|
|
23
|
+
label: "Preview in dark",
|
|
24
|
+
icon: e ? /* @__PURE__ */ o(s, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ o(i, { className: "h-3.5 w-3.5" }),
|
|
25
|
+
hint: t ? "The app is already dark. Switch the app to light to preview the form in dark." : "Show the canvas in the dark theme; the app stays as it is",
|
|
26
|
+
checked: e && !t,
|
|
27
|
+
disabled: n || t,
|
|
28
|
+
onClick: () => r(!e),
|
|
29
|
+
data: { "data-editor-theme-preview": "" }
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
w as ThemePreviewTool,
|
|
35
|
+
k as previewThemeClass,
|
|
36
|
+
f as useAppIsDark
|
|
37
|
+
};
|