@nivaro/react 0.2.53 → 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.
Files changed (294) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +452 -4
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +252 -2
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/FormWhatsNew.js +60 -0
  10. package/dist/shared/components/ItemEditForm.js +3968 -3618
  11. package/dist/shared/components/JobsTray.js +100 -55
  12. package/dist/shared/components/MyWorkView.js +91 -89
  13. package/dist/shared/components/NotificationBell.js +80 -79
  14. package/dist/shared/components/ProfileView.js +568 -520
  15. package/dist/shared/components/RecordCompare.js +254 -0
  16. package/dist/shared/components/RecordReadView.js +598 -543
  17. package/dist/shared/components/ReportView.js +578 -543
  18. package/dist/shared/components/RowPresence.js +91 -0
  19. package/dist/shared/components/TipLayer.js +27 -27
  20. package/dist/shared/components/WidgetSlot.js +474 -458
  21. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  22. package/dist/shared/components/ai/AskPanel.js +139 -119
  23. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  24. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  25. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  26. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  27. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  28. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  29. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  30. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  31. package/dist/shared/components/chat/Composer.js +357 -303
  32. package/dist/shared/components/chat/MessageActions.js +92 -0
  33. package/dist/shared/components/chat/MessageFormat.js +290 -264
  34. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  35. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  36. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  37. package/dist/shared/components/chat/RoomParts.js +213 -274
  38. package/dist/shared/components/chat/ScreenClip.js +184 -0
  39. package/dist/shared/components/chat/chat-core.js +402 -483
  40. package/dist/shared/components/chat/chat-drafts.js +59 -0
  41. package/dist/shared/components/chat/chat-emoji.js +348 -0
  42. package/dist/shared/components/chat/chat-local-time.js +41 -0
  43. package/dist/shared/components/chat/chat-outbox.js +303 -0
  44. package/dist/shared/components/chat/chat-window.js +163 -0
  45. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  46. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  47. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  48. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  49. package/dist/shared/components/help-videos/api.js +80 -67
  50. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  51. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  52. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  53. package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
  54. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  55. package/dist/shared/components/item-edit/FieldRow.js +382 -320
  56. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  57. package/dist/shared/components/item-edit/GroupSection.js +786 -639
  58. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  59. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  60. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  61. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  62. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  63. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  64. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  65. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  66. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  67. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  68. package/dist/shared/components/item-edit/lock-why.js +94 -0
  69. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  70. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  71. package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
  72. package/dist/shared/components/layout-editor/AddPanel.js +226 -151
  73. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  74. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  75. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  76. package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
  77. package/dist/shared/components/layout-editor/CollabParts.js +175 -0
  78. package/dist/shared/components/layout-editor/DesignNode.js +311 -116
  79. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
  80. package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
  81. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  82. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  83. package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
  84. package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
  85. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  86. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  87. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  88. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  89. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  90. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  91. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  92. package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
  93. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  94. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  95. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  96. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  97. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  98. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  99. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  100. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  101. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  102. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  103. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  104. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  105. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  106. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  107. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  108. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  109. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  110. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  111. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  112. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  113. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  114. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  115. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  116. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  117. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  118. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  119. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  120. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  121. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  122. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  123. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  124. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  125. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  126. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  127. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  128. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  129. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  130. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  131. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
  132. package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
  133. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  134. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  135. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  136. package/dist/shared/components/layout-editor/design-context.js +26 -6
  137. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
  138. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  139. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  140. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  141. package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
  142. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  143. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  144. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  145. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  146. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  147. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  148. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  149. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  150. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  151. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  152. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  153. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  154. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  155. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  156. package/dist/shared/components/layout-editor/form-map.js +138 -0
  157. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  158. package/dist/shared/components/layout-editor/history-api.js +87 -0
  159. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  160. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  161. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  162. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  163. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  164. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  165. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  166. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
  167. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  168. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
  169. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  170. package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
  171. package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
  172. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  173. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  174. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  175. package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
  176. package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
  177. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  178. package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
  179. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  180. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  181. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  182. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  183. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  184. package/dist/shared/components/layout-editor/load-error.js +37 -0
  185. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  186. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  187. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  188. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  189. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  190. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  191. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  192. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  193. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  194. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  195. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  196. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  197. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  198. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  199. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  200. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  201. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  202. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  203. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  204. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  205. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  206. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  207. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  208. package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
  209. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  210. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  211. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  212. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  213. package/dist/shared/components/layout-editor/pin.js +25 -0
  214. package/dist/shared/components/layout-editor/presence.js +111 -0
  215. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  216. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  217. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  218. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  219. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  220. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  221. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  222. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  223. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  224. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  225. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  226. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  227. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  228. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  229. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  230. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  231. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  232. package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
  233. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  234. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  235. package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
  236. package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
  237. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  238. package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
  239. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  240. package/dist/shared/components/layout-editor/show-when.js +35 -0
  241. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  242. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  243. package/dist/shared/components/layout-editor/structure-ops.js +403 -0
  244. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  245. package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
  246. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  247. package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
  248. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  249. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  250. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  251. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  252. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  253. package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
  254. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  255. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  256. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  257. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  258. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
  259. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  260. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  261. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  262. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  263. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  264. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  265. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  266. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  267. package/dist/shared/components/support/SupportView.js +75 -73
  268. package/dist/shared/lib/ai-fill.js +37 -0
  269. package/dist/shared/lib/background-runs.js +150 -0
  270. package/dist/shared/lib/delivery-ack.js +9 -0
  271. package/dist/shared/lib/entry-badge-style.js +13 -0
  272. package/dist/shared/lib/entry-config.js +71 -0
  273. package/dist/shared/lib/form-sections.js +64 -0
  274. package/dist/shared/lib/form-structure.js +99 -0
  275. package/dist/shared/lib/form-usage-beacon.js +133 -0
  276. package/dist/shared/lib/jobs-tray.js +25 -23
  277. package/dist/shared/lib/keyset-pager.js +37 -0
  278. package/dist/shared/lib/layout-i18n.js +66 -0
  279. package/dist/shared/lib/layout-lint.js +490 -0
  280. package/dist/shared/lib/layout-ops.js +116 -110
  281. package/dist/shared/lib/layout-resolve.js +113 -0
  282. package/dist/shared/lib/placement-behaviour.js +144 -0
  283. package/dist/shared/lib/prefetch.js +149 -0
  284. package/dist/shared/lib/presence-hooks.js +199 -0
  285. package/dist/shared/lib/record-outbox.js +82 -81
  286. package/dist/shared/lib/replay-socket.js +93 -0
  287. package/dist/shared/lib/request-gate.js +51 -50
  288. package/dist/shared/lib/room-gaps.js +96 -0
  289. package/dist/shared/lib/screenshot.js +54 -28
  290. package/dist/shared/lib/search-log.js +27 -0
  291. package/dist/shared/lib/socket-realtime.js +101 -80
  292. package/dist/shared/lib/visible-when.js +34 -0
  293. package/dist/shared/lib/worker-socket.js +200 -0
  294. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ import { useRef as _, useCallback as $ } from "react";
2
+ import { toast as d } from "sonner";
3
+ import { useNivaroClient as k } from "../../../context.js";
4
+ import { useInvalidateLayouts as v, apiFailure as h } from "../overview/overview-api.js";
5
+ import { copySection as x, leftOutWords as N } from "./reuse-api.js";
6
+ function F(y, a, s, i) {
7
+ const c = k(), l = v(y), e = _({ bundle: a, rows: s, openLayout: i });
8
+ return e.current = { bundle: a, rows: s, openLayout: i }, $(
9
+ async (r, n) => {
10
+ var m, p;
11
+ const { bundle: o, rows: b } = e.current;
12
+ if (!o) return;
13
+ const u = ((m = o.groups.find((t) => t.key === r)) == null ? void 0 : m.label) || r, C = ((p = b.find((t) => t.layout_id === n)) == null ? void 0 : p.name) ?? "that layout";
14
+ try {
15
+ const t = await x(c, n, {
16
+ source_layout_id: Number(o.layout.id),
17
+ group_key: r,
18
+ source_bundle: o
19
+ });
20
+ l({ lazy: !0 });
21
+ const f = N(t);
22
+ d.success(`Copied ${u} to ${C}${f ? ` (${f})` : ""}`, {
23
+ action: { label: "Open", onClick: () => e.current.openLayout(n) }
24
+ });
25
+ } catch (t) {
26
+ d.error(h(t, `Could not copy ${u}`).message);
27
+ }
28
+ },
29
+ [c, l]
30
+ );
31
+ }
32
+ export {
33
+ F as useRailCopy
34
+ };
@@ -0,0 +1,241 @@
1
+ import { readGroupStructure as m, withGroupStructure as _, isFolded as E, FOLD_KEY as G, rowOf as L } from "../../lib/form-structure.js";
2
+ import { GROUP_PATCH_KEYS as A, applyLayoutOps as M } from "../../lib/layout-ops.js";
3
+ import { titleCase as N } from "../../lib/utils.js";
4
+ import { newGroupKey as W } from "./add-target.js";
5
+ import { normalizedBundle as x, zoneItems as P, keyOf as v, plural as b, inPageOrder as Y, selectedPlacements as z } from "./field-zones.js";
6
+ import { withKey as C, readOverrides as J } from "./inspector/model.js";
7
+ import { isPinned as U } from "./pin.js";
8
+ import { humanizeOpError as D } from "./useLayoutDraft.js";
9
+ const y = (t) => ({ ok: !1, reason: t });
10
+ function O(t, r) {
11
+ if (r.ops.length === 0) return y("Nothing would change");
12
+ try {
13
+ return M(t, r.ops), r;
14
+ } catch (e) {
15
+ return y(D(e.message));
16
+ }
17
+ }
18
+ const a = (t, r) => r ? t.groups.find((e) => e.key === r) ?? null : null, g = (t) => t.label || N(t.key), I = /* @__PURE__ */ new Set(["section", "tab"]), B = (t) => !t.field.startsWith("__");
19
+ function K(t, r) {
20
+ const e = new Map(t.map((s, n) => [s.field, n]));
21
+ return t.map((s, n) => {
22
+ const o = L(r, s.field);
23
+ if (!o) return n;
24
+ const i = o.fields.map((l) => e.get(l)).filter((l) => l != null);
25
+ return i.length >= 2 ? Math.min(...i) : n;
26
+ });
27
+ }
28
+ const F = (t, r) => t.map((e) => ({ ...e, fields: e.fields.filter((s) => r.has(s)) })).filter((e) => e.fields.length > 0);
29
+ function H(t, r) {
30
+ const e = {}, s = /* @__PURE__ */ new Set(["label", "content", "content_tone", "summary_fields", "editor_note", "i18n"]);
31
+ for (const n of A) !s.has(n) && n !== "swap_config" && (e[n] = t[n]);
32
+ return e.swap_config = _(null, { rows: r }), e;
33
+ }
34
+ function q(t, r) {
35
+ if (!r || r.kind !== "field" && r.kind !== "slot") return "Select the field to split at";
36
+ if (r.group_key === null) return "Ungrouped fields are not in a section";
37
+ const e = a(t, r.group_key);
38
+ if (!e) return "This comes from the parent form: override it here first";
39
+ if (!I.has(e.type)) return "Only sections, tabs and steps split";
40
+ if (U(e) || U(a(t, e.parent_key))) return "Unpin it first";
41
+ const s = x(t), n = P(s, e.key), o = n.findIndex((l) => l.field === r.field);
42
+ return o < 0 ? "That field is no longer where it was" : K(n, m(e.swap_config).rows)[o] !== o ? "Split before or after the row it sits in" : o === 0 ? "It is already the first field: nothing above it would stay" : null;
43
+ }
44
+ function ie(t, r) {
45
+ const e = q(t, r);
46
+ if (e) return y(e);
47
+ const s = r, n = x(t), o = a(n, s.group_key), i = m(o.swap_config), l = P(n, o.key), p = K(l, i.rows), k = l.findIndex((h) => h.field === s.field), w = l.filter((h, j) => p[j] >= k), u = new Set(w.map((h) => h.field)), S = new Set(l.filter((h) => !u.has(h.field)).map((h) => h.field)), d = W(n, `${o.key}_2`), $ = `${g(o)} (continued)`, f = [
48
+ {
49
+ op: "group_create",
50
+ key: d,
51
+ label: $,
52
+ group_type: o.type,
53
+ parent_key: o.parent_key,
54
+ index: o.sort + 1,
55
+ patch: H(o, F(i.rows, u))
56
+ },
57
+ ...w.map((h, j) => ({ op: "move", from: v(h), to_group_key: d, index: j }))
58
+ ], c = F(i.rows, S);
59
+ JSON.stringify(c) !== JSON.stringify(i.rows) && f.push({
60
+ op: "group_update",
61
+ key: o.key,
62
+ patch: { swap_config: _(o.swap_config, { rows: c }) }
63
+ });
64
+ const T = [`${b(w.length, "field")} move to ${$}`];
65
+ return i.sticky && T.push("Only the first part stays pinned to the top"), O(t, {
66
+ ok: !0,
67
+ ops: f,
68
+ label: `Split ${g(o)}`,
69
+ notes: T,
70
+ select: { kind: "group", key: d }
71
+ });
72
+ }
73
+ function R(t, r) {
74
+ const e = x(t), s = a(e, r);
75
+ if (!s) return null;
76
+ const o = e.groups.filter((i) => i.parent_key === s.parent_key).sort((i, l) => i.sort - l.sort).find((i) => i.sort > s.sort);
77
+ return o && o.sort === s.sort + 1 && o.type === s.type ? o : null;
78
+ }
79
+ function Q(t, r) {
80
+ const e = a(t, r);
81
+ if (!e) return "This comes from the parent form: override it here first";
82
+ if (!I.has(e.type)) return "Only sections, tabs and steps join";
83
+ const s = R(t, r);
84
+ return s ? [e, s].some((n) => U(n)) || U(a(t, e.parent_key)) ? "Unpin it first" : null : e.type === "tab" ? "No tab or step right after it" : "No section right below it";
85
+ }
86
+ function fe(t, r) {
87
+ const e = Q(t, r);
88
+ if (e) return y(e);
89
+ const s = x(t), n = a(s, r), o = R(s, r), i = P(s, n.key), l = new Set(i.map((c) => c.field)), p = P(s, o.key), k = [];
90
+ let w = i.length, u = 0;
91
+ for (const c of p) {
92
+ if (l.has(c.field)) {
93
+ u++, k.push({ op: "remove", at: v(c) });
94
+ continue;
95
+ }
96
+ k.push({ op: "move", from: v(c), to_group_key: n.key, index: w++ });
97
+ }
98
+ const S = m(n.swap_config), d = new Set(p.filter((c) => !l.has(c.field)).map((c) => c.field)), $ = F(m(o.swap_config).rows, d).map((c) => ({
99
+ ...c,
100
+ key: S.rows.some((T) => T.key === c.key) ? `${c.key}_${o.key}` : c.key
101
+ }));
102
+ $.length && k.push({
103
+ op: "group_update",
104
+ key: n.key,
105
+ patch: { swap_config: _(n.swap_config, { rows: [...S.rows, ...$] }) }
106
+ }), k.push({ op: "group_remove", key: o.key, placements: "delete" });
107
+ const f = [`${b(p.length, "field")} from ${g(o)} join ${g(n)}`];
108
+ return f.push(`${g(n)} keeps its settings`), u && f.push(`${b(u, "field")} in both ${u === 1 ? "shows" : "show"} once`), O(t, {
109
+ ok: !0,
110
+ ops: k,
111
+ label: `Join ${g(n)} and ${g(o)}`,
112
+ notes: f,
113
+ select: { kind: "group", key: n.key }
114
+ });
115
+ }
116
+ function V(t, r) {
117
+ const e = z(t, r).filter(B);
118
+ if (e.length < 2) return "Select two or more fields in one section";
119
+ const s = e[0].group_key;
120
+ if (e.some((o) => o.group_key !== s)) return "Pick fields from one section";
121
+ if (s === null) return "Ungrouped fields are not in a section: wrap them first";
122
+ const n = a(t, s);
123
+ return n ? I.has(n.type) ? e.length > 6 ? "Six fields at most share one row" : null : "Only fields in sections, tabs and steps share a row" : "This comes from the parent form: override it here first";
124
+ }
125
+ function pe(t, r, e = N) {
126
+ const s = V(t, r);
127
+ if (s) return y(s);
128
+ const n = x(t), o = Y(n, z(n, r).filter(B)), i = a(n, o[0].group_key), l = m(i.swap_config), p = o.map((f) => f.field), k = new Set(l.rows.map((f) => f.key));
129
+ let w = "row";
130
+ for (let f = 2; k.has(w); f++) w = `row_${f}`;
131
+ const u = { key: w, label: p.map(e).join(" / "), fields: p }, S = [
132
+ ...l.rows.map((f) => ({ ...f, fields: f.fields.filter((c) => !p.includes(c)) })).filter((f) => f.fields.length >= 2),
133
+ u
134
+ ], d = [], $ = P(n, i.key).findIndex((f) => f.field === p[0]);
135
+ o.slice(1).forEach((f, c) => {
136
+ d.push({ op: "move", from: v(f), to_group_key: i.key, index: $ + 1 + c });
137
+ });
138
+ for (const f of o)
139
+ E(f.overrides) && d.push({
140
+ op: "update_placement",
141
+ at: v(f),
142
+ patch: { overrides: C(J(f), G, void 0) }
143
+ });
144
+ return d.push({
145
+ op: "group_update",
146
+ key: i.key,
147
+ patch: { swap_config: _(i.swap_config, { rows: S }) }
148
+ }), O(t, {
149
+ ok: !0,
150
+ ops: d,
151
+ label: `Put ${b(p.length, "field")} side by side`,
152
+ notes: [`Under one label: “${u.label}”`],
153
+ select: { kind: "field", field: p[0], group_key: i.key }
154
+ });
155
+ }
156
+ function ce(t, r, e, s) {
157
+ const n = a(t, r);
158
+ if (!n) return y("That section is no longer on this form");
159
+ const o = m(n.swap_config), i = o.rows.find((p) => p.key === e);
160
+ if (!i) return y("That row is no longer on this form");
161
+ const l = s === null ? o.rows.filter((p) => p.key !== e) : o.rows.map((p) => p.key === e ? { ...p, ...s } : p).filter((p) => p.key !== e || p.fields.length >= 2);
162
+ return O(t, {
163
+ ok: !0,
164
+ ops: [
165
+ {
166
+ op: "group_update",
167
+ key: n.key,
168
+ patch: { swap_config: _(n.swap_config, { rows: l }) }
169
+ }
170
+ ],
171
+ label: s === null ? `Take the row “${i.label}” apart` : `Change the row “${i.label}”`,
172
+ notes: []
173
+ });
174
+ }
175
+ function le(t, r, e) {
176
+ const s = [];
177
+ let n = 0;
178
+ for (const o of r) {
179
+ if (!B(o) || o.group_key === null) continue;
180
+ const i = a(t, o.group_key);
181
+ if (e && i && L(m(i.swap_config).rows, o.field)) {
182
+ n++;
183
+ continue;
184
+ }
185
+ E(o.overrides) !== e && s.push({
186
+ op: "update_placement",
187
+ at: v(o),
188
+ patch: { overrides: C(J(o), G, e ? !0 : void 0) }
189
+ });
190
+ }
191
+ return s.length === 0 && n ? y("Fields in a row stay out of the fold") : O(t, {
192
+ ok: !0,
193
+ ops: s,
194
+ label: e ? `Put ${b(s.length, "field")} behind “Show more”` : `Show ${b(s.length, "field")} always`,
195
+ notes: n ? [`${b(n, "field")} in a row ${n === 1 ? "stays" : "stay"} out`] : []
196
+ });
197
+ }
198
+ function ae(t, r, e) {
199
+ const s = a(t, r);
200
+ if (!s) return y("That section is no longer on this form");
201
+ if (s.type !== "section" || s.parent_key !== null)
202
+ return y("Only a section at the top level of the form sticks");
203
+ const n = [], o = [];
204
+ if (e)
205
+ for (const i of t.groups)
206
+ i.key !== r && m(i.swap_config).sticky && (n.push({
207
+ op: "group_update",
208
+ key: i.key,
209
+ patch: { swap_config: _(i.swap_config, { sticky: !1 }) }
210
+ }), o.push(`${g(i)} stops sticking: one sticky section per form`));
211
+ return m(s.swap_config).sticky !== e && n.push({
212
+ op: "group_update",
213
+ key: r,
214
+ patch: { swap_config: _(s.swap_config, { sticky: e }) }
215
+ }), O(t, {
216
+ ok: !0,
217
+ ops: n,
218
+ label: e ? `Pin ${g(s)} to the top` : `Let ${g(s)} scroll`,
219
+ notes: o
220
+ });
221
+ }
222
+ function ue(t, r) {
223
+ return {
224
+ op: "group_update",
225
+ key: t.key,
226
+ patch: { swap_config: _(t.swap_config, { emptyText: r }) }
227
+ };
228
+ }
229
+ export {
230
+ ue as emptyTextOp,
231
+ le as foldPlan,
232
+ Q as joinBlocked,
233
+ fe as joinPlan,
234
+ R as joinTarget,
235
+ V as rowBlocked,
236
+ pe as rowPlan,
237
+ ce as rowUpdatePlan,
238
+ q as splitBlocked,
239
+ ie as splitPlan,
240
+ ae as stickyPlan
241
+ };
@@ -0,0 +1,296 @@
1
+ import { jsxs as f, Fragment as _, jsx as r } from "react/jsx-runtime";
2
+ import { useState as x, useRef as v, useEffect as N } from "react";
3
+ import { badgeClasses as b } from "../../../lib/entry-badge-style.js";
4
+ import { entryConfigOf as w, ENTRY_THRESHOLD_DEFAULT as S, sanitizeEntryConfig as E, ENTRY_THRESHOLD_MAX as T, ENTRY_BADGE_TAG_MAX as B, BADGE_COLORS as D } from "../../../lib/entry-config.js";
5
+ import { cn as p } from "../../../lib/utils.js";
6
+ import { useEntryEditor as A } from "../entry/entry-editor-context.js";
7
+ import { presetSummary as R, withPresets as O } from "../entry/presets.js";
8
+ import { Setting as d, Toggle as m, quietText as g, smallBtn as h, inputCls as k } from "./controls.js";
9
+ function U(o) {
10
+ var l;
11
+ const n = w(o.layout), u = A(), t = (e, a, c = !1) => {
12
+ const C = E({ ...n, ...e });
13
+ (c ? o.setText : o.set)({ entry_config: C }, a);
14
+ }, s = ((l = n.tab_order) == null ? void 0 : l.length) ?? 0, i = n.presets ?? [];
15
+ return /* @__PURE__ */ f(_, { children: [
16
+ /* @__PURE__ */ r(
17
+ d,
18
+ {
19
+ k: "layout.focus_first",
20
+ control: /* @__PURE__ */ r(
21
+ m,
22
+ {
23
+ label: "Start on the first empty required field",
24
+ checked: n.focus_first === !0,
25
+ onChange: (e) => t(
26
+ { focus_first: e || void 0 },
27
+ e ? "Start on the first empty required field" : "Stop starting on a required field"
28
+ )
29
+ }
30
+ )
31
+ }
32
+ ),
33
+ /* @__PURE__ */ r(
34
+ d,
35
+ {
36
+ k: "layout.enter_next",
37
+ control: /* @__PURE__ */ r(
38
+ m,
39
+ {
40
+ label: "Enter moves to the next field",
41
+ checked: n.enter_next === !0,
42
+ onChange: (e) => t(
43
+ { enter_next: e || void 0 },
44
+ e ? "Make Enter move to the next field" : "Make Enter save again"
45
+ )
46
+ }
47
+ )
48
+ }
49
+ ),
50
+ /* @__PURE__ */ r(
51
+ d,
52
+ {
53
+ k: "layout.tab_order",
54
+ control: /* @__PURE__ */ f("div", { className: "flex flex-wrap items-center gap-2", children: [
55
+ /* @__PURE__ */ r(
56
+ "button",
57
+ {
58
+ type: "button",
59
+ "data-tab-order-start": "",
60
+ className: h,
61
+ disabled: u.tabOrderActive,
62
+ onClick: u.startTabOrder,
63
+ children: s ? "Change order on the canvas" : "Set order on the canvas"
64
+ }
65
+ ),
66
+ s > 0 && /* @__PURE__ */ r(
67
+ "button",
68
+ {
69
+ type: "button",
70
+ className: h,
71
+ onClick: () => t({ tab_order: void 0 }, "Clear the tab order"),
72
+ children: "Clear"
73
+ }
74
+ )
75
+ ] }),
76
+ note: /* @__PURE__ */ r("span", { className: g, children: s ? `${s} ${s === 1 ? "field" : "fields"} in order; the rest follow in page order.` : "Not set: Tab follows the page order." })
77
+ }
78
+ ),
79
+ /* @__PURE__ */ r(
80
+ d,
81
+ {
82
+ k: "layout.adaptive_mode",
83
+ control: /* @__PURE__ */ r(
84
+ m,
85
+ {
86
+ label: "Guided steps for new people",
87
+ checked: n.adaptive === !0,
88
+ onChange: (e) => t(
89
+ { adaptive: e || void 0 },
90
+ e ? "Show steps to new people" : "Stop switching between steps and tabs"
91
+ )
92
+ }
93
+ )
94
+ }
95
+ ),
96
+ /* @__PURE__ */ r(
97
+ d,
98
+ {
99
+ k: "layout.adaptive_threshold",
100
+ control: /* @__PURE__ */ r(
101
+ F,
102
+ {
103
+ value: n.adaptive_threshold ?? S,
104
+ label: "Records before tabs",
105
+ disabled: n.adaptive !== !0,
106
+ onChange: (e) => t({ adaptive_threshold: e }, "Change records before tabs", !0),
107
+ onBlur: o.flush
108
+ }
109
+ )
110
+ }
111
+ ),
112
+ /* @__PURE__ */ r(d, { k: "layout.badge", children: /* @__PURE__ */ r(
113
+ G,
114
+ {
115
+ config: n,
116
+ onChange: (e, a) => t({ badge: e }, "Change the form badge", a),
117
+ onBlur: o.flush
118
+ }
119
+ ) }),
120
+ /* @__PURE__ */ r(
121
+ d,
122
+ {
123
+ k: "layout.glossary",
124
+ control: /* @__PURE__ */ r(
125
+ m,
126
+ {
127
+ label: "Glossary tooltips in help text",
128
+ checked: n.glossary !== !1,
129
+ onChange: (e) => t(
130
+ { glossary: e ? void 0 : !1 },
131
+ e ? "Turn on glossary tooltips" : "Turn off glossary tooltips"
132
+ )
133
+ }
134
+ )
135
+ }
136
+ ),
137
+ /* @__PURE__ */ r(
138
+ d,
139
+ {
140
+ k: "layout.presets",
141
+ control: /* @__PURE__ */ r(
142
+ "button",
143
+ {
144
+ type: "button",
145
+ className: h,
146
+ disabled: i.length === 0,
147
+ onClick: () => t({ presets: void 0 }, "Delete all presets"),
148
+ children: "Delete all"
149
+ }
150
+ ),
151
+ children: i.length === 0 ? /* @__PURE__ */ r("p", { className: g, children: "None yet. Select a field and use Presets in its inspector." }) : /* @__PURE__ */ r("ul", { className: "m-0 list-none space-y-1 p-0", "data-preset-list": "", children: i.map((e) => /* @__PURE__ */ f(
152
+ "li",
153
+ {
154
+ className: "flex items-center justify-between gap-2 rounded-md border border-slate-200 px-2 py-1 dark:border-border",
155
+ children: [
156
+ /* @__PURE__ */ f("span", { className: "min-w-0", children: [
157
+ /* @__PURE__ */ r("span", { className: "block truncate text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.name }),
158
+ /* @__PURE__ */ r("span", { className: p(g, "block truncate"), children: R(e) })
159
+ ] }),
160
+ /* @__PURE__ */ r(
161
+ "button",
162
+ {
163
+ type: "button",
164
+ className: h,
165
+ "aria-label": `Delete preset ${e.name}`,
166
+ onClick: () => {
167
+ var a;
168
+ return t(
169
+ {
170
+ presets: (a = O(
171
+ n,
172
+ i.filter((c) => c.id !== e.id)
173
+ )) == null ? void 0 : a.presets
174
+ },
175
+ `Delete preset ${e.name}`
176
+ );
177
+ },
178
+ children: "Delete"
179
+ }
180
+ )
181
+ ]
182
+ },
183
+ e.id
184
+ )) })
185
+ }
186
+ )
187
+ ] });
188
+ }
189
+ function F({
190
+ value: o,
191
+ onChange: n,
192
+ onBlur: u,
193
+ label: t,
194
+ disabled: s
195
+ }) {
196
+ const [i, l] = x(String(o)), e = v(!1);
197
+ return N(() => {
198
+ e.current || l(String(o));
199
+ }, [o]), /* @__PURE__ */ r(
200
+ "input",
201
+ {
202
+ type: "number",
203
+ min: 1,
204
+ max: T,
205
+ "aria-label": t,
206
+ disabled: s,
207
+ value: i,
208
+ className: p(k, "w-20"),
209
+ onFocus: () => {
210
+ e.current = !0;
211
+ },
212
+ onChange: (a) => {
213
+ l(a.target.value);
214
+ const c = Number(a.target.value);
215
+ Number.isFinite(c) && c >= 1 && n(c);
216
+ },
217
+ onBlur: () => {
218
+ e.current = !1, l(String(o)), u();
219
+ }
220
+ }
221
+ );
222
+ }
223
+ function G({
224
+ config: o,
225
+ onChange: n,
226
+ onBlur: u
227
+ }) {
228
+ const t = o.badge, [s, i] = x((t == null ? void 0 : t.tag) ?? ""), l = v(!1);
229
+ N(() => {
230
+ l.current || i((t == null ? void 0 : t.tag) ?? "");
231
+ }, [t == null ? void 0 : t.tag]);
232
+ const e = (t == null ? void 0 : t.color) ?? "orange";
233
+ return /* @__PURE__ */ f("div", { className: "space-y-2", "data-badge-editor": "", children: [
234
+ /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
235
+ /* @__PURE__ */ r(
236
+ "input",
237
+ {
238
+ type: "text",
239
+ "aria-label": "Badge text",
240
+ placeholder: "Short tag, e.g. Sparing",
241
+ maxLength: B,
242
+ value: s,
243
+ className: p(k, "min-w-0 flex-1"),
244
+ onFocus: () => {
245
+ l.current = !0;
246
+ },
247
+ onChange: (a) => {
248
+ i(a.target.value), n(a.target.value.trim() ? { tag: a.target.value, color: e } : void 0, !0);
249
+ },
250
+ onBlur: () => {
251
+ l.current = !1, u();
252
+ }
253
+ }
254
+ ),
255
+ t && /* @__PURE__ */ r(
256
+ "span",
257
+ {
258
+ "data-badge-preview": "",
259
+ className: p(
260
+ "inline-flex h-5 shrink-0 items-center rounded-full px-2 text-[11px] font-medium",
261
+ b(t.color)
262
+ ),
263
+ children: t.tag
264
+ }
265
+ )
266
+ ] }),
267
+ /* @__PURE__ */ r(
268
+ "fieldset",
269
+ {
270
+ "aria-label": "Badge colour",
271
+ className: "m-0 flex min-w-0 flex-wrap gap-1.5 border-0 p-0",
272
+ children: D.map((a) => /* @__PURE__ */ r(
273
+ "button",
274
+ {
275
+ type: "button",
276
+ "aria-pressed": e === a && !!t,
277
+ "aria-label": y(a),
278
+ "data-tip": s.trim() ? y(a) : "Type the badge text first",
279
+ disabled: !s.trim(),
280
+ onClick: () => n({ tag: s, color: a }, !1),
281
+ className: p(
282
+ "h-5 w-5 rounded-full border transition-shadow disabled:cursor-not-allowed disabled:opacity-50",
283
+ b(a),
284
+ e === a && !!t && "ring-2 ring-nvr-cyan/60 ring-offset-1 ring-offset-white dark:ring-offset-card"
285
+ )
286
+ },
287
+ a
288
+ ))
289
+ }
290
+ )
291
+ ] });
292
+ }
293
+ const y = (o) => o.charAt(0).toUpperCase() + o.slice(1);
294
+ export {
295
+ U as EntrySection
296
+ };