@nivaro/react 0.3.36 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/slots/CommentsSlot.js +44 -36
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/shared/components/AgentBadge.js +26 -0
- package/dist/shared/components/AgentQuestionsCard.js +198 -0
- package/dist/shared/components/ItemEditForm.js +3329 -3263
- package/dist/shared/components/McpConnectionScope.js +480 -0
- package/dist/shared/components/MyWorkView.js +223 -208
- package/dist/shared/components/RecordReadView.js +620 -575
- package/dist/shared/components/chat/ChatPanel.js +683 -671
- package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
- package/dist/shared/components/imports/ImportConsole.js +106 -104
- package/dist/shared/components/imports/RunDetailSheet.js +11 -10
- package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
- package/dist/shared/components/item-edit/FormTour.js +279 -0
- package/dist/shared/components/item-edit/GroupSection.js +377 -360
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
- package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
- package/dist/shared/components/item-edit/form-density.js +36 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
- package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
- package/dist/shared/components/layout-editor/AddPanel.js +349 -192
- package/dist/shared/components/layout-editor/DesignNode.js +126 -112
- package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
- package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
- package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
- package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
- package/dist/shared/components/layout-editor/add-target.js +54 -43
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
- package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
- package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
- package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
- package/dist/shared/components/layout-editor/dnd/node.js +115 -105
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
- package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
- package/dist/shared/components/layout-editor/even-row.js +86 -0
- package/dist/shared/components/layout-editor/field-list.js +99 -0
- package/dist/shared/components/layout-editor/format-painter.js +102 -0
- package/dist/shared/components/layout-editor/grid-guides.js +15 -13
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
- package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
- package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
- package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
- package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
- package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
- package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
- package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
- package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
- package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
- package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
- package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
- package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
- package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/pin.js +37 -19
- package/dist/shared/components/layout-editor/place-clip.js +257 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
- package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
- package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
- package/dist/shared/components/layout-editor/removed-log.js +151 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
- package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
- package/dist/shared/components/layout-editor/revert-element.js +140 -0
- package/dist/shared/components/layout-editor/section-structure.js +193 -170
- package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
- package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
- package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
- package/dist/shared/components/layout-editor/shortcuts.js +21 -16
- package/dist/shared/components/layout-editor/structure-ops.js +221 -195
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
- package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
- package/dist/shared/components/panels/CommentPanel.js +47 -45
- package/dist/shared/components/panels/RevisionsPanel.js +66 -64
- package/dist/shared/components/panels/TaskPanel.js +395 -332
- package/dist/shared/components/profile/AgentsPanel.js +196 -147
- package/dist/shared/components/profile/ConnectionRollback.js +329 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
- package/dist/shared/lib/entry-config.js +22 -22
- package/dist/shared/lib/form-usage-beacon.js +91 -55
- package/dist/shared/lib/layout-lint.js +530 -284
- package/dist/shared/lib/layout-resolve.js +58 -44
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import { UserRound as v,
|
|
2
|
+
import { UserRound as v, Undo2 as S, UserRoundPlus as C, UserRoundPen as U, UserRoundX as Y, Check as E } from "lucide-react";
|
|
3
3
|
import { useState as F, Fragment as P, useInsertionEffect as I } from "react";
|
|
4
4
|
import { toast as c } from "sonner";
|
|
5
5
|
import { usePersonalDefaultsApi as D } from "./usePersonalDefaults.js";
|
|
@@ -7,7 +7,7 @@ function T(e) {
|
|
|
7
7
|
return e.applied && e.hasDefault ? "applied" : e.editable ? e.loaded ? e.failed && !e.hasDefault ? e.hasValue ? "offer" : null : e.hasDefault ? e.hasValue ? e.isDefault ? "saved" : "update" : "saved-empty" : e.hasValue ? "offer" : "reserve" : "reserve" : null;
|
|
8
8
|
}
|
|
9
9
|
function K(e, t, a) {
|
|
10
|
-
return e != null && e.allowed(t) ? T({
|
|
10
|
+
return e != null && e.allowed(t) ? e.manageable(t) ? T({
|
|
11
11
|
editable: a,
|
|
12
12
|
loaded: e.loaded,
|
|
13
13
|
hasValue: e.hasValue(t),
|
|
@@ -15,12 +15,12 @@ function K(e, t, a) {
|
|
|
15
15
|
isDefault: e.isDefault(t),
|
|
16
16
|
applied: e.applied(t),
|
|
17
17
|
failed: e.failed
|
|
18
|
-
}) : null;
|
|
18
|
+
}) : e.applied(t) && e.defaultFor(t) !== null ? "applied" : null : null;
|
|
19
19
|
}
|
|
20
20
|
function g(e, t) {
|
|
21
|
-
var d,
|
|
21
|
+
var d, s, f;
|
|
22
22
|
const a = e;
|
|
23
|
-
return ((
|
|
23
|
+
return ((s = (d = a == null ? void 0 : a.response) == null ? void 0 : d.data) == null ? void 0 : s.error) ?? ((f = a == null ? void 0 : a.data) == null ? void 0 : f.error) ?? (a == null ? void 0 : a.error) ?? (a == null ? void 0 : a.message) ?? t;
|
|
24
24
|
}
|
|
25
25
|
function R(e, t) {
|
|
26
26
|
return e.clear(t).then(
|
|
@@ -87,30 +87,30 @@ function W({
|
|
|
87
87
|
label: t,
|
|
88
88
|
state: a,
|
|
89
89
|
confirmOpen: d,
|
|
90
|
-
onConfirm:
|
|
90
|
+
onConfirm: s,
|
|
91
91
|
onUndo: f,
|
|
92
92
|
onCleared: h
|
|
93
93
|
}) {
|
|
94
94
|
L();
|
|
95
|
-
const
|
|
95
|
+
const l = D(), [x, b] = F(!1), u = t || e, k = a !== "saved-empty", m = /* @__PURE__ */ o(
|
|
96
96
|
"button",
|
|
97
97
|
{
|
|
98
98
|
type: "button",
|
|
99
99
|
"data-personal-default-clear": e,
|
|
100
|
-
"aria-label":
|
|
101
|
-
"data-tip":
|
|
100
|
+
"aria-label": k ? `Clear your saved default for ${u} (the field keeps its value)` : `Clear your saved default for ${u}`,
|
|
101
|
+
"data-tip": k ? "Forget your saved default — this field keeps its value" : "Forget your saved default",
|
|
102
102
|
"data-pd-action": !0,
|
|
103
103
|
tabIndex: -1,
|
|
104
|
-
disabled: x || !
|
|
104
|
+
disabled: x || !l,
|
|
105
105
|
"aria-busy": x || void 0,
|
|
106
106
|
onClick: () => {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
l && (b(!0), R(l, e).then((n) => {
|
|
108
|
+
b(!1), n && (h == null || h());
|
|
109
109
|
}));
|
|
110
110
|
},
|
|
111
111
|
className: y,
|
|
112
112
|
children: [
|
|
113
|
-
/* @__PURE__ */ r(
|
|
113
|
+
/* @__PURE__ */ r(Y, { "data-pd-icon": !0, className: "h-3 w-3", "aria-hidden": !0 }),
|
|
114
114
|
/* @__PURE__ */ r("span", { "data-pd-label": !0, children: "Clear default" })
|
|
115
115
|
]
|
|
116
116
|
},
|
|
@@ -120,23 +120,23 @@ function W({
|
|
|
120
120
|
{
|
|
121
121
|
type: "button",
|
|
122
122
|
...n === "make" ? { "data-personal-default-make": e } : { "data-personal-default-update": e },
|
|
123
|
-
"aria-label": n === "make" ? `Make this your default for ${
|
|
123
|
+
"aria-label": n === "make" ? `Make this your default for ${u}` : `Update your saved default for ${u} to this value`,
|
|
124
124
|
"aria-haspopup": "dialog",
|
|
125
125
|
"aria-expanded": d === n,
|
|
126
126
|
"data-tip": n === "make" ? "Start your new records with this value" : "Start your new records with this value instead",
|
|
127
127
|
"data-pd-action": !0,
|
|
128
128
|
tabIndex: -1,
|
|
129
|
-
onClick: (p) =>
|
|
129
|
+
onClick: (p) => s(p.currentTarget, n),
|
|
130
130
|
className: y,
|
|
131
131
|
children: [
|
|
132
|
-
n === "make" ? /* @__PURE__ */ r(
|
|
132
|
+
n === "make" ? /* @__PURE__ */ r(C, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ r(U, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
133
133
|
/* @__PURE__ */ r("span", { "data-pd-primary": !0, children: n === "make" ? "Make default" : "Update default" })
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
136
|
n
|
|
137
137
|
);
|
|
138
|
-
let
|
|
139
|
-
return a === "offer" ?
|
|
138
|
+
let i = [];
|
|
139
|
+
return a === "offer" ? i = [w("make")] : a === "update" ? i = [w("update"), m] : a === "saved" || a === "saved-empty" ? i = [
|
|
140
140
|
/* @__PURE__ */ o(
|
|
141
141
|
"span",
|
|
142
142
|
{
|
|
@@ -144,7 +144,7 @@ function W({
|
|
|
144
144
|
"data-tip": a === "saved" ? "Your new records start with this value" : "You have a saved default for this field — new records start with it",
|
|
145
145
|
className: V,
|
|
146
146
|
children: [
|
|
147
|
-
a === "saved" ? /* @__PURE__ */ r(
|
|
147
|
+
a === "saved" ? /* @__PURE__ */ r(E, { className: "h-3 w-3 text-sky-700 dark:text-sky-300", "aria-hidden": !0 }) : /* @__PURE__ */ r(v, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
148
148
|
/* @__PURE__ */ r("span", { className: "sr-only", children: "Your default" }),
|
|
149
149
|
/* @__PURE__ */ r("span", { "data-pd-label": !0, "aria-hidden": !0, children: "Your default" })
|
|
150
150
|
]
|
|
@@ -152,7 +152,7 @@ function W({
|
|
|
152
152
|
"status"
|
|
153
153
|
),
|
|
154
154
|
m
|
|
155
|
-
] : a === "applied" && (
|
|
155
|
+
] : a === "applied" && (i = [
|
|
156
156
|
/* @__PURE__ */ o(
|
|
157
157
|
"span",
|
|
158
158
|
{
|
|
@@ -172,28 +172,28 @@ function W({
|
|
|
172
172
|
{
|
|
173
173
|
type: "button",
|
|
174
174
|
"data-personal-default-undo": e,
|
|
175
|
-
"aria-label": `Undo: empty ${
|
|
175
|
+
"aria-label": `Undo: empty ${u} (your saved default stays)`,
|
|
176
176
|
"data-tip": "Empty this field — your saved default stays",
|
|
177
177
|
"data-pd-action": !0,
|
|
178
178
|
onClick: f,
|
|
179
179
|
className: y,
|
|
180
180
|
children: [
|
|
181
|
-
/* @__PURE__ */ r(
|
|
181
|
+
/* @__PURE__ */ r(S, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
182
182
|
/* @__PURE__ */ r("span", { "data-pd-label": !0, children: "Undo" })
|
|
183
183
|
]
|
|
184
184
|
},
|
|
185
185
|
"undo"
|
|
186
186
|
),
|
|
187
|
-
m
|
|
187
|
+
...(l == null ? void 0 : l.manageable(e)) === !1 ? [] : [m]
|
|
188
188
|
]), /* @__PURE__ */ r(
|
|
189
189
|
"span",
|
|
190
190
|
{
|
|
191
191
|
"data-personal-default-slot": e,
|
|
192
192
|
"data-state": a,
|
|
193
|
-
"data-pd-new":
|
|
193
|
+
"data-pd-new": l != null && l.isNew ? "" : void 0,
|
|
194
194
|
"aria-hidden": a === "reserve" ? !0 : void 0,
|
|
195
195
|
className: "inline-flex shrink-0 items-center justify-end",
|
|
196
|
-
children:
|
|
196
|
+
children: i.map((n, p) => /* @__PURE__ */ o(P, { children: [
|
|
197
197
|
p > 0 && /* @__PURE__ */ r(j, {}),
|
|
198
198
|
n
|
|
199
199
|
] }, String(n.key ?? p)))
|
|
@@ -203,14 +203,14 @@ function W({
|
|
|
203
203
|
function X({ field: e }) {
|
|
204
204
|
const t = D();
|
|
205
205
|
if (!(t != null && t.allowed(e))) return null;
|
|
206
|
-
const a = t.loaded && t.isDefault(e), d = t.loaded && t.defaultFor(e) !== null,
|
|
206
|
+
const a = t.loaded && t.isDefault(e), d = t.loaded && t.defaultFor(e) !== null, s = a ? "Your default: new records you start get this value." : d ? "You have your own default for this field, different from this value." : "You can save your own default for this field (Edit mode).";
|
|
207
207
|
return /* @__PURE__ */ r(
|
|
208
208
|
"span",
|
|
209
209
|
{
|
|
210
210
|
"data-personal-default-mark": a ? "mine" : d ? "saved" : "allowed",
|
|
211
|
-
"data-tip":
|
|
211
|
+
"data-tip": s,
|
|
212
212
|
role: "img",
|
|
213
|
-
"aria-label":
|
|
213
|
+
"aria-label": s,
|
|
214
214
|
className: a ? "ml-1.5 inline-flex align-middle text-cyan-700 dark:text-nvr-cyan" : "ml-1.5 inline-flex align-middle text-slate-500 dark:text-slate-400",
|
|
215
215
|
children: /* @__PURE__ */ r(v, { "aria-hidden": !0, className: "h-3 w-3", strokeWidth: 2.25 })
|
|
216
216
|
}
|
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { badgeClasses as
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { badgeClasses as c } from "../../../lib/entry-badge-style.js";
|
|
3
3
|
import { cn as o } from "../../../lib/utils.js";
|
|
4
|
-
function
|
|
4
|
+
function h({
|
|
5
5
|
badge: t,
|
|
6
6
|
mode: r,
|
|
7
|
-
auto:
|
|
8
|
-
onMode:
|
|
7
|
+
auto: d,
|
|
8
|
+
onMode: l,
|
|
9
|
+
tour: s
|
|
9
10
|
}) {
|
|
10
|
-
if (!t && !r) return null;
|
|
11
|
-
const
|
|
11
|
+
if (!t && !r && !s) return null;
|
|
12
|
+
const i = (e, p, m) => /* @__PURE__ */ n(
|
|
12
13
|
"button",
|
|
13
14
|
{
|
|
14
15
|
type: "button",
|
|
15
16
|
"aria-pressed": r === e,
|
|
16
|
-
"data-tip":
|
|
17
|
+
"data-tip": m,
|
|
17
18
|
"data-entry-mode": e,
|
|
18
|
-
onClick: () =>
|
|
19
|
+
onClick: () => l(e === d ? null : e),
|
|
19
20
|
className: o(
|
|
20
21
|
"h-6 rounded px-2 text-[11.5px] font-medium transition-colors",
|
|
21
22
|
r === e ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
|
|
22
23
|
),
|
|
23
|
-
children:
|
|
24
|
+
children: p
|
|
24
25
|
}
|
|
25
26
|
);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
t ? /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ a("div", { "data-entry-strip": "", className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
28
|
+
t ? /* @__PURE__ */ n(
|
|
28
29
|
"span",
|
|
29
30
|
{
|
|
30
31
|
"data-form-badge": "",
|
|
31
32
|
"data-tip": "The form this record is open in",
|
|
32
33
|
className: o(
|
|
33
34
|
"inline-flex h-5 items-center rounded-full px-2 text-[11px] font-medium",
|
|
34
|
-
|
|
35
|
+
c(t.color)
|
|
35
36
|
),
|
|
36
37
|
children: t.tag
|
|
37
38
|
}
|
|
38
|
-
) : /* @__PURE__ */
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
) : /* @__PURE__ */ n("span", {}),
|
|
40
|
+
/* @__PURE__ */ a("span", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
|
|
41
|
+
s,
|
|
42
|
+
r && /* @__PURE__ */ a(
|
|
43
|
+
"fieldset",
|
|
44
|
+
{
|
|
45
|
+
"aria-label": "How to show this form",
|
|
46
|
+
className: "m-0 inline-flex min-w-0 items-center gap-0.5 rounded-md border-0 bg-slate-100 p-0.5 dark:bg-muted",
|
|
47
|
+
children: [
|
|
48
|
+
i("beginner", "Guided steps", "One step at a time, with Next and Back"),
|
|
49
|
+
i("expert", "Tabs", "Every tab open, in any order")
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
50
54
|
] });
|
|
51
55
|
}
|
|
52
56
|
export {
|
|
53
|
-
|
|
57
|
+
h as EntryStrip
|
|
54
58
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useInsertionEffect as n } from "react";
|
|
2
|
+
function m(t) {
|
|
3
|
+
return (t == null ? void 0 : t.density) === "compact" ? "compact" : "comfortable";
|
|
4
|
+
}
|
|
5
|
+
const e = "[data-form-density=compact]", o = `
|
|
6
|
+
${e} [data-form-body]{padding:1rem 1.25rem}
|
|
7
|
+
${e} [data-form-body]>:not([hidden])~:not([hidden]),${e} [data-section-stack]>:not([hidden])~:not([hidden]){margin-top:.625rem}
|
|
8
|
+
${e} [data-usage-header]{padding-top:.5rem;padding-bottom:.5rem}
|
|
9
|
+
${e} [data-section-body]{padding:.625rem 1rem .75rem}
|
|
10
|
+
${e} [data-section-grid]{row-gap:.625rem;column-gap:.875rem}
|
|
11
|
+
${e} [data-summary-strip]{padding-top:.375rem;padding-bottom:.375rem}
|
|
12
|
+
${e} [data-field]>:not([hidden])~:not([hidden]){margin-top:.25rem}
|
|
13
|
+
${e} [data-read-head]{padding-top:.375rem;padding-bottom:.375rem}
|
|
14
|
+
${e} [data-read-body]{padding:.75rem 1rem 1rem}
|
|
15
|
+
${e} [data-read-dl]{row-gap:.75rem;column-gap:1rem}
|
|
16
|
+
@media (hover: hover) and (pointer: fine){
|
|
17
|
+
${e} [data-section-key] .h-9{height:2rem}
|
|
18
|
+
${e} [data-section-key] .h-10{height:2.25rem}
|
|
19
|
+
${e} [data-section-key] textarea{min-height:3.5rem}
|
|
20
|
+
}
|
|
21
|
+
@media (max-width: 639px){
|
|
22
|
+
${e} [data-form-body]{padding:.75rem}
|
|
23
|
+
}
|
|
24
|
+
`, a = "nvr-form-density-css";
|
|
25
|
+
function i(t) {
|
|
26
|
+
n(() => {
|
|
27
|
+
if (!t || typeof document > "u" || document.getElementById(a)) return;
|
|
28
|
+
const d = document.createElement("style");
|
|
29
|
+
d.id = a, d.textContent = o, document.head.appendChild(d);
|
|
30
|
+
}, [t]);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
o as FORM_DENSITY_CSS,
|
|
34
|
+
m as formDensityOf,
|
|
35
|
+
i as useFormDensityCss
|
|
36
|
+
};
|
|
@@ -1,65 +1,78 @@
|
|
|
1
|
-
import { useRef as u, useEffect as
|
|
2
|
-
import { useApiFetchConfig as
|
|
3
|
-
import { StepClock as
|
|
4
|
-
function
|
|
5
|
-
enabled:
|
|
6
|
-
layoutId:
|
|
1
|
+
import { useRef as u, useEffect as D, useCallback as E, useMemo as B } from "react";
|
|
2
|
+
import { useApiFetchConfig as H } from "../../context.js";
|
|
3
|
+
import { StepClock as T, RefusalTally as q, onSectionUse as x, SectionTally as A, sessionEvent as P, queueFormUsage as V } from "../../lib/form-usage-beacon.js";
|
|
4
|
+
function J({
|
|
5
|
+
enabled: M,
|
|
6
|
+
layoutId: r,
|
|
7
7
|
collection: c,
|
|
8
|
-
itemId:
|
|
9
|
-
step:
|
|
8
|
+
itemId: l,
|
|
9
|
+
step: a
|
|
10
10
|
}) {
|
|
11
|
-
const
|
|
12
|
-
f.current =
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
if (!
|
|
11
|
+
const d = H(), f = u(d);
|
|
12
|
+
f.current = d;
|
|
13
|
+
const p = u(a);
|
|
14
|
+
p.current = a;
|
|
15
|
+
const s = u(null), v = M && r != null && !!c;
|
|
16
|
+
D(() => {
|
|
17
|
+
if (!v || r == null) return;
|
|
18
18
|
const n = () => typeof document > "u" || document.visibilityState !== "hidden", e = {
|
|
19
|
-
clock: new
|
|
19
|
+
clock: new T(p.current, Date.now(), n()),
|
|
20
20
|
openSent: !1,
|
|
21
21
|
saved: !1,
|
|
22
22
|
elapsed: 0,
|
|
23
|
-
saveMs: null
|
|
23
|
+
saveMs: null,
|
|
24
|
+
refusals: new q()
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
}),
|
|
29
|
-
const { steps:
|
|
30
|
-
e.elapsed +=
|
|
31
|
-
const
|
|
32
|
-
layoutId:
|
|
26
|
+
s.current = e;
|
|
27
|
+
const t = new A(), R = x((o) => {
|
|
28
|
+
o.layoutId === r && o.collection === c && t.note(o.kind, o.key);
|
|
29
|
+
}), i = (o) => {
|
|
30
|
+
const { steps: C, total: g } = e.clock.take(Date.now());
|
|
31
|
+
e.elapsed += g;
|
|
32
|
+
const h = t.pending(), b = e.refusals.take(), y = P({
|
|
33
|
+
layoutId: r,
|
|
33
34
|
collection: c,
|
|
34
|
-
item:
|
|
35
|
+
item: l,
|
|
35
36
|
openSent: e.openSent,
|
|
36
37
|
saved: e.saved,
|
|
37
38
|
step: e.clock.currentStep,
|
|
38
|
-
steps:
|
|
39
|
-
total:
|
|
39
|
+
steps: C,
|
|
40
|
+
total: g,
|
|
40
41
|
elapsed: e.elapsed,
|
|
41
|
-
final:
|
|
42
|
-
sections:
|
|
43
|
-
saveMs: e.saveMs
|
|
42
|
+
final: o,
|
|
43
|
+
sections: h,
|
|
44
|
+
saveMs: e.saveMs,
|
|
45
|
+
refused: b
|
|
44
46
|
});
|
|
45
|
-
if (!
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
document.
|
|
47
|
+
if (!y) {
|
|
48
|
+
e.refusals.restore(b);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
t.markSent(h), e.openSent = !0, e.saved = !1, e.saveMs = null;
|
|
52
|
+
const { apiBase: L, authHeaders: F, credentials: U } = f.current;
|
|
53
|
+
V(y, { apiBase: L, authHeaders: F, credentials: U });
|
|
54
|
+
}, w = () => {
|
|
55
|
+
document.visibilityState === "hidden" ? (i(!1), e.clock.pause(Date.now())) : e.clock.resume(Date.now());
|
|
56
|
+
}, S = () => i(!0);
|
|
57
|
+
return document.addEventListener("visibilitychange", w), window.addEventListener("pagehide", S), () => {
|
|
58
|
+
document.removeEventListener("visibilitychange", w), window.removeEventListener("pagehide", S), i(!0), R(), s.current === e && (s.current = null);
|
|
54
59
|
};
|
|
55
|
-
}, [
|
|
60
|
+
}, [v, r, c, l]), D(() => {
|
|
56
61
|
var n;
|
|
57
|
-
(n =
|
|
58
|
-
}, [
|
|
59
|
-
|
|
62
|
+
(n = s.current) == null || n.clock.step(a, Date.now());
|
|
63
|
+
}, [a]);
|
|
64
|
+
const m = E(() => {
|
|
65
|
+
const n = s.current;
|
|
60
66
|
n && (n.saved || (n.saveMs = n.elapsed + n.clock.peek(Date.now())), n.saved = !0);
|
|
61
|
-
}, [])
|
|
67
|
+
}, []), k = E(
|
|
68
|
+
(n, e) => {
|
|
69
|
+
var t;
|
|
70
|
+
return (t = s.current) == null ? void 0 : t.refusals.note(n, e);
|
|
71
|
+
},
|
|
72
|
+
[]
|
|
73
|
+
);
|
|
74
|
+
return B(() => ({ markSaved: m, markRefused: k }), [m, k]);
|
|
62
75
|
}
|
|
63
76
|
export {
|
|
64
|
-
|
|
77
|
+
J as useFormUsageBeacon
|
|
65
78
|
};
|