@nivaro/react 0.3.36 → 0.3.38

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.
Files changed (102) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +9 -1
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -575
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +34 -32
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +126 -112
  25. package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
  26. package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
  27. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  28. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  29. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  30. package/dist/shared/components/layout-editor/add-target.js +54 -43
  31. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  32. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  33. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
  35. package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
  36. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  37. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  38. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  39. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  40. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  41. package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
  42. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  43. package/dist/shared/components/layout-editor/even-row.js +86 -0
  44. package/dist/shared/components/layout-editor/field-list.js +99 -0
  45. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  46. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  47. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  48. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  49. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  50. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  51. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  52. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  53. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  54. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  55. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  56. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  57. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  58. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  59. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  60. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  61. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  62. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  63. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  64. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  65. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  66. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  67. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  68. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  69. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  70. package/dist/shared/components/layout-editor/pin.js +37 -19
  71. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  72. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  73. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
  74. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  75. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  76. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  77. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  78. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  79. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  80. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  81. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  82. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  83. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  84. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  85. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  86. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  87. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  88. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  89. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  90. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  91. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  92. package/dist/shared/components/panels/CommentPanel.js +47 -45
  93. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  94. package/dist/shared/components/panels/TaskPanel.js +395 -332
  95. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  96. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  97. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  98. package/dist/shared/lib/entry-config.js +22 -22
  99. package/dist/shared/lib/form-usage-beacon.js +91 -55
  100. package/dist/shared/lib/layout-lint.js +530 -284
  101. package/dist/shared/lib/layout-resolve.js +58 -44
  102. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
+ import { ArrowLeft as x, AlertTriangle as y } from "lucide-react";
3
+ import { useMemo as h } from "react";
4
+ import { formatRelative as b, cn as c } from "../../../lib/utils.js";
5
+ import { canvasDiff as w, diffSummary as k } from "../canvas-diff.js";
6
+ import { effectText as d } from "../panel-style.js";
7
+ import { planFileOps as N } from "./layout-file-plan.js";
8
+ import { LayoutFileProblems as v, parseLayoutFile as $ } from "./output-api.js";
9
+ async function S(t, s, o) {
10
+ const i = await o.text(), l = await $(t, Number(s.layout.id), i);
11
+ return { name: o.name, result: l };
12
+ }
13
+ function T(t) {
14
+ return t instanceof v ? t.problems : [];
15
+ }
16
+ function U({
17
+ bundle: t,
18
+ state: s,
19
+ onBack: o,
20
+ apply: i,
21
+ onDone: l
22
+ }) {
23
+ const { result: r, name: f } = s, e = h(() => N(t, r.target), [t, r.target]), m = h(() => w(t, e.after), [t, e.after]), g = k(m), p = [
24
+ r.source.name ? `from “${r.source.name}”` : null,
25
+ r.source.at ? `exported ${b(r.source.at)}` : null
26
+ ].filter(Boolean).join(", ");
27
+ return /* @__PURE__ */ n("div", { "data-layout-file-preview": "", children: [
28
+ /* @__PURE__ */ n(
29
+ "button",
30
+ {
31
+ type: "button",
32
+ onClick: o,
33
+ className: "mb-1 inline-flex items-center gap-1 text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
34
+ children: [
35
+ /* @__PURE__ */ a(x, { className: "h-3 w-3" }),
36
+ " Back"
37
+ ]
38
+ }
39
+ ),
40
+ /* @__PURE__ */ a("p", { className: "break-words text-[13px] font-semibold text-slate-900 dark:text-foreground", children: e.ops.length === 0 ? "Nothing differs from the form" : `${f}: ${g ?? "changes"}` }),
41
+ /* @__PURE__ */ n("p", { className: c(d, "mt-0.5"), children: [
42
+ p ? `${p.charAt(0).toUpperCase()}${p.slice(1)}. ` : "",
43
+ e.ops.length > 0 && "Applying changes the draft as one step (Undo puts it back); Save writes it."
44
+ ] }),
45
+ m.settings.length > 0 && /* @__PURE__ */ n("p", { className: c(d, "mt-1.5"), "data-layout-file-settings": "", children: [
46
+ "Form settings: ",
47
+ m.settings.join(", ")
48
+ ] }),
49
+ (r.warnings.length > 0 || e.remaining.length > 0) && /* @__PURE__ */ a(
50
+ "ul",
51
+ {
52
+ "data-layout-file-warnings": "",
53
+ className: "mt-2 max-h-[200px] space-y-1 overflow-y-auto border-t border-slate-100 pt-2 dark:border-border",
54
+ children: [...r.warnings, ...e.remaining].map((u) => /* @__PURE__ */ n(
55
+ "li",
56
+ {
57
+ className: "flex items-start gap-1.5 text-[12px] leading-snug text-slate-700 dark:text-foreground",
58
+ children: [
59
+ /* @__PURE__ */ a(y, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400" }),
60
+ /* @__PURE__ */ a("span", { className: "min-w-0 break-words", children: u })
61
+ ]
62
+ },
63
+ u
64
+ ))
65
+ }
66
+ ),
67
+ /* @__PURE__ */ n("div", { className: "mt-2 flex items-center justify-end gap-2 border-t border-slate-100 pt-2.5 dark:border-border", children: [
68
+ /* @__PURE__ */ a("span", { className: c(d, "mr-auto"), children: e.ops.length > 0 && `${e.ops.length} ${e.ops.length === 1 ? "step" : "steps"}, one undo` }),
69
+ /* @__PURE__ */ a(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ "data-layout-file-apply": "",
74
+ disabled: e.ops.length === 0,
75
+ onClick: () => {
76
+ i(e.ops, { label: `Import ${f}` }), l();
77
+ },
78
+ className: "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:pointer-events-none disabled:opacity-40",
79
+ children: "Apply to the draft"
80
+ }
81
+ )
82
+ ] })
83
+ ] });
84
+ }
85
+ export {
86
+ U as LayoutFilePreview,
87
+ T as problemsOf,
88
+ S as readLayoutFile
89
+ };
@@ -1,254 +1,331 @@
1
- import { jsxs as o, jsx as e, Fragment as R } from "react/jsx-runtime";
2
- import { FileOutput as T, ArrowLeft as H, FileSpreadsheet as M, Download as U, Printer as _, Upload as q, Loader2 as I } from "lucide-react";
3
- import { useState as u, useRef as W, useMemo as j } from "react";
4
- import { useApiFetchConfig as Y } from "../../../context.js";
5
- import { cn as x } from "../../../lib/utils.js";
6
- import { Checkbox as z } from "../../ui/checkbox.js";
7
- import { Popover as G, PopoverContent as J } from "../../ui/popover.js";
8
- import { useCollectionMeta as K } from "../inspector/field-context.js";
1
+ import { jsxs as n, jsx as e, Fragment as U } from "react/jsx-runtime";
2
+ import { FileOutput as z, ArrowLeft as G, FileSpreadsheet as J, Download as H, Printer as K, Upload as M, FileCode2 as Q, Loader2 as V } from "lucide-react";
3
+ import { useState as c, useRef as Y, useMemo as I } from "react";
4
+ import { useApiFetchConfig as X } from "../../../context.js";
5
+ import { cn as y } from "../../../lib/utils.js";
6
+ import { Checkbox as Z } from "../../ui/checkbox.js";
7
+ import { Popover as ee, PopoverContent as te } from "../../ui/popover.js";
8
+ import { useCollectionMeta as ae } from "../inspector/field-context.js";
9
9
  import { effectText as g } from "../panel-style.js";
10
- import { ToolButton as Q } from "../toolbar-kit.js";
11
- import { helpSheetPlan as V, propWord as X, diffHelpSheet as Z, helpSheetRows as ee } from "./help-sheet.js";
12
- import { parseHelpSheetFile as te, saveFile as k, downloadTemplate as ae, downloadRecords as ne, downloadBlankForm as oe, downloadHelpSheet as se } from "./output-api.js";
13
- const re = "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300 data-[state=checked]:border-nvr-cyan data-[state=checked]:bg-nvr-cyan data-[state=checked]:text-white dark:border-slate-600 [&_svg]:h-3 [&_svg]:w-3", le = "group flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:pointer-events-none disabled:opacity-60";
14
- function f({
15
- icon: s,
16
- title: d,
17
- effect: i,
18
- busy: n,
19
- onClick: c,
20
- data: w
10
+ import { ToolButton as oe } from "../toolbar-kit.js";
11
+ import { helpSheetPlan as ne, propWord as le, diffHelpSheet as se, helpSheetRows as re } from "./help-sheet.js";
12
+ import { LayoutFilePreview as ie, problemsOf as de, readLayoutFile as ce } from "./LayoutFile.js";
13
+ import { parseHelpSheetFile as pe, saveFile as x, downloadTemplate as me, downloadRecords as he, downloadBlankForm as ue, downloadHelpSheet as fe, downloadLayoutFile as xe } from "./output-api.js";
14
+ const ye = "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300 data-[state=checked]:border-nvr-cyan data-[state=checked]:bg-nvr-cyan data-[state=checked]:text-white dark:border-slate-600 [&_svg]:h-3 [&_svg]:w-3", ge = "group flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:outline-none disabled:pointer-events-none disabled:opacity-60";
15
+ function p({
16
+ icon: l,
17
+ title: m,
18
+ effect: u,
19
+ busy: a,
20
+ onClick: h,
21
+ data: b
21
22
  }) {
22
- return /* @__PURE__ */ o("button", { type: "button", className: le, disabled: n, onClick: c, "data-output": w, children: [
23
- /* @__PURE__ */ e("span", { className: "mt-0.5 text-slate-500 dark:text-muted-foreground", children: n ? /* @__PURE__ */ e(I, { className: "h-4 w-4 animate-spin" }) : s }),
24
- /* @__PURE__ */ o("span", { className: "min-w-0 flex-1", children: [
25
- /* @__PURE__ */ e("span", { className: "block text-[13px] font-medium text-slate-900 dark:text-foreground", children: d }),
26
- /* @__PURE__ */ e("span", { className: x(g, "block"), children: i })
23
+ return /* @__PURE__ */ n("button", { type: "button", className: ge, disabled: a, onClick: h, "data-output": b, children: [
24
+ /* @__PURE__ */ e("span", { className: "mt-0.5 text-slate-500 dark:text-muted-foreground", children: a ? /* @__PURE__ */ e(V, { className: "h-4 w-4 animate-spin" }) : l }),
25
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
26
+ /* @__PURE__ */ e("span", { className: "block text-[13px] font-medium text-slate-900 dark:text-foreground", children: m }),
27
+ /* @__PURE__ */ e("span", { className: y(g, "block"), children: u })
27
28
  ] })
28
29
  ] });
29
30
  }
30
- function de({
31
- diff: s,
32
- skip: d,
33
- toggle: i
31
+ function we({
32
+ diff: l,
33
+ skip: m,
34
+ toggle: u
34
35
  }) {
35
36
  return /* @__PURE__ */ e(
36
37
  "div",
37
38
  {
38
39
  "data-help-changes": "",
39
40
  className: "mt-2 max-h-[320px] overflow-y-auto border-t border-slate-100 pt-1 dark:border-border",
40
- children: s.changes.map((n) => (
41
+ children: l.changes.map((a) => (
41
42
  // biome-ignore lint/a11y/noLabelWithoutControl: the Radix checkbox is the control
42
- /* @__PURE__ */ o(
43
+ /* @__PURE__ */ n(
43
44
  "label",
44
45
  {
45
- "data-help-change": n.prop,
46
+ "data-help-change": a.prop,
46
47
  className: "flex cursor-pointer items-start gap-2 rounded px-1 py-1.5 hover:bg-muted",
47
48
  children: [
48
49
  /* @__PURE__ */ e(
49
- z,
50
+ Z,
50
51
  {
51
- checked: !d.has(n.id),
52
- onCheckedChange: () => i(n.id),
53
- className: re
52
+ checked: !m.has(a.id),
53
+ onCheckedChange: () => u(a.id),
54
+ className: ye
54
55
  }
55
56
  ),
56
- /* @__PURE__ */ o("span", { className: "min-w-0 flex-1 text-[12.5px] leading-snug", children: [
57
- /* @__PURE__ */ o("span", { className: "block truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
58
- X(n.prop),
57
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 text-[12.5px] leading-snug", children: [
58
+ /* @__PURE__ */ n("span", { className: "block truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
59
+ le(a.prop),
59
60
  " · ",
60
- n.where
61
+ a.where
61
62
  ] }),
62
- /* @__PURE__ */ e("span", { className: "block whitespace-pre-wrap break-words text-slate-500 line-through decoration-slate-300 dark:text-muted-foreground", children: n.before || "Empty" }),
63
- /* @__PURE__ */ e("span", { className: "block whitespace-pre-wrap break-words text-slate-900 dark:text-foreground", children: n.after || "Removed (the field’s own text shows)" })
63
+ /* @__PURE__ */ e("span", { className: "block whitespace-pre-wrap break-words text-slate-500 line-through decoration-slate-300 dark:text-muted-foreground", children: a.before || "Empty" }),
64
+ /* @__PURE__ */ e("span", { className: "block whitespace-pre-wrap break-words text-slate-900 dark:text-foreground", children: a.after || "Removed (the field’s own text shows)" })
64
65
  ] })
65
66
  ]
66
67
  },
67
- n.id
68
+ a.id
68
69
  )
69
70
  ))
70
71
  }
71
72
  );
72
73
  }
73
- function ye({
74
- bundle: s,
75
- apply: d,
76
- collection: i
74
+ function $e({
75
+ bundle: l,
76
+ apply: m,
77
+ collection: u
77
78
  }) {
78
- const n = Y(), c = Number(s.layout.id), w = String(s.layout.name ?? "form"), [S, F] = u(!1), [p, B] = u(null), [E, y] = u(null), [a, N] = u(null), [v, O] = u(/* @__PURE__ */ new Set()), $ = W(null), { data: C } = K(S ? i : null), A = C == null ? void 0 : C.fields, h = j(() => ((a == null ? void 0 : a.changes) ?? []).filter((t) => !v.has(t.id)), [a, v]), b = j(() => V(s, h), [s, h]), m = async (t, r) => {
79
- B(t), y(null);
79
+ const a = X(), h = Number(l.layout.id), b = String(l.layout.name ?? "form"), [B, O] = c(!1), [i, A] = c(null), [E, k] = c(null), [o, N] = c(null), [v, P] = c(/* @__PURE__ */ new Set()), $ = Y(null), [D, C] = c(null), [R, F] = c([]), j = Y(null), { data: S } = ae(B ? u : null), T = S == null ? void 0 : S.fields, f = I(() => ((o == null ? void 0 : o.changes) ?? []).filter((t) => !v.has(t.id)), [o, v]), w = I(() => ne(l, f), [l, f]), d = async (t, s) => {
80
+ A(t), k(null), F([]);
80
81
  try {
81
- await r();
82
- } catch (l) {
83
- y(l.message || "Something went wrong");
82
+ await s();
83
+ } catch (r) {
84
+ k(r.message || "Something went wrong"), F(de(r));
84
85
  } finally {
85
- B(null);
86
+ A(null);
86
87
  }
87
- }, D = (t) => {
88
- t && m("upload", async () => {
89
- const r = await te(n, t), l = Z(s, A ?? [], r);
90
- O(/* @__PURE__ */ new Set()), N(l);
88
+ }, _ = (t) => {
89
+ t && d("upload", async () => {
90
+ const s = await pe(a, t), r = se(l, T ?? [], s);
91
+ P(/* @__PURE__ */ new Set()), N(r);
91
92
  });
92
- }, L = (t) => O((r) => {
93
- const l = new Set(r);
94
- return l.has(t) ? l.delete(t) : l.add(t), l;
95
- }), P = (t) => {
96
- F(t), t || (N(null), y(null));
93
+ }, q = (t) => P((s) => {
94
+ const r = new Set(s);
95
+ return r.has(t) ? r.delete(t) : r.add(t), r;
96
+ }), L = (t) => {
97
+ O(t), t || (N(null), C(null), k(null), F([]));
98
+ }, W = (t) => {
99
+ t && d("layout-import", async () => C(await ce(a, l, t)));
97
100
  };
98
- return /* @__PURE__ */ o(G, { open: S, onOpenChange: P, children: [
101
+ return /* @__PURE__ */ n(ee, { open: B, onOpenChange: L, children: [
99
102
  /* @__PURE__ */ e(
100
- Q,
103
+ oe,
101
104
  {
102
105
  popover: !0,
103
- onOpen: () => F(!0),
106
+ onOpen: () => O(!0),
104
107
  label: "Outputs",
105
- icon: /* @__PURE__ */ e(T, { className: "h-3.5 w-3.5 shrink-0" }),
108
+ icon: /* @__PURE__ */ e(z, { className: "h-3.5 w-3.5 shrink-0" }),
106
109
  tip: "Excel template and export, blank printable form, help text sheet",
107
110
  hint: "Spreadsheet, print and help text",
108
111
  data: { "data-outputs-open": "" }
109
112
  }
110
113
  ),
111
- /* @__PURE__ */ e(J, { align: "end", className: "w-[420px] p-3", "data-outputs": "", children: a ? /* @__PURE__ */ o(R, { children: [
112
- /* @__PURE__ */ o(
113
- "button",
114
- {
115
- type: "button",
116
- onClick: () => N(null),
117
- className: "mb-1 inline-flex items-center gap-1 text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
118
- children: [
119
- /* @__PURE__ */ e(H, { className: "h-3 w-3" }),
120
- " Back"
121
- ]
122
- }
123
- ),
124
- /* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-foreground", children: a.changes.length === 0 ? "Nothing differs from the form" : `${a.changes.length} ${a.changes.length === 1 ? "change" : "changes"} in the sheet` }),
125
- /* @__PURE__ */ e("p", { className: x(g, "mt-0.5"), children: "Untick any you do not want. Applying is one step; Undo puts every one back." }),
126
- /* @__PURE__ */ e(de, { diff: a, skip: v, toggle: L }),
127
- (a.unknown > 0 || a.skipped.length > 0) && /* @__PURE__ */ o("p", { className: x(g, "mt-2"), children: [
128
- a.unknown > 0 && `${a.unknown} ${a.unknown === 1 ? "row" : "rows"} match nothing on this form and ${a.unknown === 1 ? "is" : "are"} left out. `,
129
- a.skipped.join(". ")
130
- ] }),
131
- /* @__PURE__ */ o("div", { className: "mt-2 flex items-center justify-end gap-2 border-t border-slate-100 pt-2.5 dark:border-border", children: [
132
- /* @__PURE__ */ e("span", { className: x(g, "mr-auto"), children: a.changes.length > 0 && `${h.length} of ${a.changes.length} ticked` }),
133
- /* @__PURE__ */ o(
134
- "button",
135
- {
136
- type: "button",
137
- "data-help-apply": "",
138
- disabled: !b.ok,
139
- onClick: () => {
140
- b.ok && (d(b.ops, { label: b.label }), P(!1));
141
- },
142
- className: "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:pointer-events-none disabled:opacity-40",
143
- children: [
144
- "Apply ",
145
- h.length > 0 ? h.length : ""
146
- ]
147
- }
148
- )
149
- ] })
150
- ] }) : /* @__PURE__ */ o(R, { children: [
151
- /* @__PURE__ */ e("p", { className: "px-2 text-[13px] font-semibold text-slate-900 dark:text-foreground", children: "Outputs" }),
152
- /* @__PURE__ */ e("p", { className: x(g, "mt-0.5 px-2"), children: "The form as a file. Spreadsheets and print follow the saved form." }),
153
- /* @__PURE__ */ o("div", { className: "mt-2 space-y-0.5", children: [
154
- /* @__PURE__ */ e(
155
- f,
156
- {
157
- data: "template",
158
- icon: /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
159
- title: "Excel import template",
160
- effect: "Columns in this form’s order; choices are dropdowns and required columns are amber.",
161
- busy: p === "template",
162
- onClick: () => m("template", async () => k(await ae(n, c)))
163
- }
164
- ),
165
- /* @__PURE__ */ e(
166
- f,
167
- {
168
- data: "records",
169
- icon: /* @__PURE__ */ e(U, { className: "h-4 w-4" }),
170
- title: "Export records to Excel",
171
- effect: "Up to 5,000 records in the same columns, limited to what you may read.",
172
- busy: p === "records",
173
- onClick: () => m("records", async () => k(await ne(n, c)))
174
- }
175
- ),
176
- /* @__PURE__ */ e(
177
- f,
114
+ /* @__PURE__ */ e(
115
+ te,
116
+ {
117
+ align: "end",
118
+ className: "w-[420px] max-w-[calc(100vw-16px)] p-3",
119
+ "data-outputs": "",
120
+ children: D ? /* @__PURE__ */ e(
121
+ ie,
178
122
  {
179
- data: "blank",
180
- icon: /* @__PURE__ */ e(_, { className: "h-4 w-4" }),
181
- title: "Blank printable form",
182
- effect: "A PDF with lines and checkboxes for filling in on paper.",
183
- busy: p === "blank",
184
- onClick: () => m("blank", async () => k(await oe(n, c)))
123
+ bundle: l,
124
+ state: D,
125
+ onBack: () => C(null),
126
+ apply: m,
127
+ onDone: () => L(!1)
185
128
  }
186
- )
187
- ] }),
188
- /* @__PURE__ */ o("div", { className: "mt-2 border-t border-slate-100 pt-2 dark:border-border", children: [
189
- /* @__PURE__ */ e("p", { className: "px-2 text-[12.5px] font-semibold text-slate-900 dark:text-foreground", children: "Labels and help text" }),
190
- /* @__PURE__ */ o("div", { className: "mt-1 space-y-0.5", children: [
191
- /* @__PURE__ */ e(
192
- f,
129
+ ) : o ? /* @__PURE__ */ n(U, { children: [
130
+ /* @__PURE__ */ n(
131
+ "button",
193
132
  {
194
- data: "help-download",
195
- icon: /* @__PURE__ */ e(U, { className: "h-4 w-4" }),
196
- title: "Download as a sheet",
197
- effect: "Every label, help text and placeholder on this form, including unsaved edits.",
198
- busy: p === "help",
199
- onClick: () => m(
200
- "help",
201
- async () => k(
202
- await se(
203
- n,
204
- ee(s, A ?? []),
205
- w
206
- )
207
- )
208
- )
133
+ type: "button",
134
+ onClick: () => N(null),
135
+ className: "mb-1 inline-flex items-center gap-1 text-[12px] font-medium text-sky-700 hover:underline dark:text-nvr-cyan",
136
+ children: [
137
+ /* @__PURE__ */ e(G, { className: "h-3 w-3" }),
138
+ " Back"
139
+ ]
209
140
  }
210
141
  ),
211
- /* @__PURE__ */ e(
212
- f,
213
- {
214
- data: "help-upload",
215
- icon: /* @__PURE__ */ e(q, { className: "h-4 w-4" }),
216
- title: "Upload the edited sheet",
217
- effect: "You see every difference before anything changes.",
218
- busy: p === "upload",
219
- onClick: () => {
220
- var t;
221
- return (t = $.current) == null ? void 0 : t.click();
142
+ /* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-foreground", children: o.changes.length === 0 ? "Nothing differs from the form" : `${o.changes.length} ${o.changes.length === 1 ? "change" : "changes"} in the sheet` }),
143
+ /* @__PURE__ */ e("p", { className: y(g, "mt-0.5"), children: "Untick any you do not want. Applying is one step; Undo puts every one back." }),
144
+ /* @__PURE__ */ e(we, { diff: o, skip: v, toggle: q }),
145
+ (o.unknown > 0 || o.skipped.length > 0) && /* @__PURE__ */ n("p", { className: y(g, "mt-2"), children: [
146
+ o.unknown > 0 && `${o.unknown} ${o.unknown === 1 ? "row" : "rows"} match nothing on this form and ${o.unknown === 1 ? "is" : "are"} left out. `,
147
+ o.skipped.join(". ")
148
+ ] }),
149
+ /* @__PURE__ */ n("div", { className: "mt-2 flex items-center justify-end gap-2 border-t border-slate-100 pt-2.5 dark:border-border", children: [
150
+ /* @__PURE__ */ e("span", { className: y(g, "mr-auto"), children: o.changes.length > 0 && `${f.length} of ${o.changes.length} ticked` }),
151
+ /* @__PURE__ */ n(
152
+ "button",
153
+ {
154
+ type: "button",
155
+ "data-help-apply": "",
156
+ disabled: !w.ok,
157
+ onClick: () => {
158
+ w.ok && (m(w.ops, { label: w.label }), L(!1));
159
+ },
160
+ className: "inline-flex h-7 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:pointer-events-none disabled:opacity-40",
161
+ children: [
162
+ "Apply ",
163
+ f.length > 0 ? f.length : ""
164
+ ]
222
165
  }
223
- }
224
- ),
225
- /* @__PURE__ */ e(
226
- "input",
227
- {
228
- ref: $,
229
- type: "file",
230
- accept: ".xlsx",
231
- className: "hidden",
232
- "data-help-file": "",
233
- onChange: (t) => {
234
- var r;
235
- D((r = t.target.files) == null ? void 0 : r[0]), t.target.value = "";
166
+ )
167
+ ] })
168
+ ] }) : /* @__PURE__ */ n(U, { children: [
169
+ /* @__PURE__ */ e("p", { className: "px-2 text-[13px] font-semibold text-slate-900 dark:text-foreground", children: "Outputs" }),
170
+ /* @__PURE__ */ e("p", { className: y(g, "mt-0.5 px-2"), children: "The form as a file. Spreadsheets and print follow the saved form." }),
171
+ /* @__PURE__ */ n("div", { className: "mt-2 space-y-0.5", children: [
172
+ /* @__PURE__ */ e(
173
+ p,
174
+ {
175
+ data: "template",
176
+ icon: /* @__PURE__ */ e(J, { className: "h-4 w-4" }),
177
+ title: "Excel import template",
178
+ effect: "Columns in this form’s order; choices are dropdowns and required columns are amber.",
179
+ busy: i === "template",
180
+ onClick: () => d("template", async () => x(await me(a, h)))
236
181
  }
182
+ ),
183
+ /* @__PURE__ */ e(
184
+ p,
185
+ {
186
+ data: "records",
187
+ icon: /* @__PURE__ */ e(H, { className: "h-4 w-4" }),
188
+ title: "Export records to Excel",
189
+ effect: "Up to 5,000 records in the same columns, limited to what you may read.",
190
+ busy: i === "records",
191
+ onClick: () => d("records", async () => x(await he(a, h)))
192
+ }
193
+ ),
194
+ /* @__PURE__ */ e(
195
+ p,
196
+ {
197
+ data: "blank",
198
+ icon: /* @__PURE__ */ e(K, { className: "h-4 w-4" }),
199
+ title: "Blank printable form",
200
+ effect: "A PDF with lines and checkboxes for filling in on paper.",
201
+ busy: i === "blank",
202
+ onClick: () => d("blank", async () => x(await ue(a, h)))
203
+ }
204
+ )
205
+ ] }),
206
+ /* @__PURE__ */ n("div", { className: "mt-2 border-t border-slate-100 pt-2 dark:border-border", children: [
207
+ /* @__PURE__ */ e("p", { className: "px-2 text-[12.5px] font-semibold text-slate-900 dark:text-foreground", children: "Labels and help text" }),
208
+ /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
209
+ /* @__PURE__ */ e(
210
+ p,
211
+ {
212
+ data: "help-download",
213
+ icon: /* @__PURE__ */ e(H, { className: "h-4 w-4" }),
214
+ title: "Download as a sheet",
215
+ effect: "Every label, help text and placeholder on this form, including unsaved edits.",
216
+ busy: i === "help",
217
+ onClick: () => d(
218
+ "help",
219
+ async () => x(
220
+ await fe(
221
+ a,
222
+ re(l, T ?? []),
223
+ b
224
+ )
225
+ )
226
+ )
227
+ }
228
+ ),
229
+ /* @__PURE__ */ e(
230
+ p,
231
+ {
232
+ data: "help-upload",
233
+ icon: /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
234
+ title: "Upload the edited sheet",
235
+ effect: "You see every difference before anything changes.",
236
+ busy: i === "upload",
237
+ onClick: () => {
238
+ var t;
239
+ return (t = $.current) == null ? void 0 : t.click();
240
+ }
241
+ }
242
+ ),
243
+ /* @__PURE__ */ e(
244
+ "input",
245
+ {
246
+ ref: $,
247
+ type: "file",
248
+ accept: ".xlsx",
249
+ className: "hidden",
250
+ "data-help-file": "",
251
+ onChange: (t) => {
252
+ var s;
253
+ _((s = t.target.files) == null ? void 0 : s[0]), t.target.value = "";
254
+ }
255
+ }
256
+ )
257
+ ] })
258
+ ] }),
259
+ /* @__PURE__ */ n("div", { className: "mt-2 border-t border-slate-100 pt-2 dark:border-border", children: [
260
+ /* @__PURE__ */ e("p", { className: "px-2 text-[12.5px] font-semibold text-slate-900 dark:text-foreground", children: "Layout file" }),
261
+ /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
262
+ /* @__PURE__ */ e(
263
+ p,
264
+ {
265
+ data: "layout-download",
266
+ icon: /* @__PURE__ */ e(Q, { className: "h-4 w-4" }),
267
+ title: "Download as YAML",
268
+ effect: "The saved form, its settings, sections and every field, to keep and review as code.",
269
+ busy: i === "layout-download",
270
+ onClick: () => d(
271
+ "layout-download",
272
+ async () => x(await xe(a, h))
273
+ )
274
+ }
275
+ ),
276
+ /* @__PURE__ */ e(
277
+ p,
278
+ {
279
+ data: "layout-import",
280
+ icon: /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
281
+ title: "Import a layout file",
282
+ effect: "You see what would change first; applying is one undo step.",
283
+ busy: i === "layout-import",
284
+ onClick: () => {
285
+ var t;
286
+ return (t = j.current) == null ? void 0 : t.click();
287
+ }
288
+ }
289
+ ),
290
+ /* @__PURE__ */ e(
291
+ "input",
292
+ {
293
+ ref: j,
294
+ type: "file",
295
+ accept: ".yaml,.yml,.json,application/yaml,text/yaml",
296
+ className: "hidden",
297
+ "data-layout-file": "",
298
+ onChange: (t) => {
299
+ var s;
300
+ W((s = t.target.files) == null ? void 0 : s[0]), t.target.value = "";
301
+ }
302
+ }
303
+ )
304
+ ] })
305
+ ] }),
306
+ E && /* @__PURE__ */ n(
307
+ "div",
308
+ {
309
+ role: "alert",
310
+ className: "mt-2 text-[12px] leading-snug text-red-600 dark:text-red-400",
311
+ children: [
312
+ /* @__PURE__ */ e("p", { children: E }),
313
+ R.length > 1 && /* @__PURE__ */ e(
314
+ "ul",
315
+ {
316
+ "data-layout-file-problems": "",
317
+ className: "mt-1 max-h-[160px] list-disc space-y-0.5 overflow-y-auto pl-4",
318
+ children: R.map((t) => /* @__PURE__ */ e("li", { children: t }, t))
319
+ }
320
+ )
321
+ ]
237
322
  }
238
323
  )
239
324
  ] })
240
- ] }),
241
- E && /* @__PURE__ */ e(
242
- "p",
243
- {
244
- role: "alert",
245
- className: "mt-2 text-[12px] leading-snug text-red-600 dark:text-red-400",
246
- children: E
247
- }
248
- )
249
- ] }) })
325
+ }
326
+ )
250
327
  ] });
251
328
  }
252
329
  export {
253
- ye as OutputsButton
330
+ $e as OutputsButton
254
331
  };