@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
@@ -1,47 +1,127 @@
1
- import { jsxs as m, Fragment as b, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as C } from "@tanstack/react-query";
3
- import { ExternalLink as I } from "lucide-react";
4
- import { useState as x, useRef as R, useEffect as N } from "react";
5
- import { useNivaroClient as P } from "../../../context.js";
6
- import { get as A } from "../../../lib/commands.js";
7
- import { cn as p } from "../../../lib/utils.js";
8
- import { HistoryPanel as L } from "../HistoryPanel.js";
9
- import { useLayoutEditorHost as _ } from "../host.js";
10
- import { useRoleNames as T } from "../overview/overview-api.js";
11
- import { tintCard as q, labelText as E } from "../panel-style.js";
12
- import { RelationPicker as F } from "../pickers/relation-picker.js";
13
- import { Setting as y, smallBtn as S, quietText as f, PickList as j, useSettingVisible as g } from "./controls.js";
14
- import { useRolePreview as D } from "./settings-api.js";
15
- import { settingDef as v } from "./settings-registry.js";
16
- function le(t) {
17
- const l = Number(t.layout.id);
18
- return /* @__PURE__ */ m(b, { children: [
19
- /* @__PURE__ */ e(H, { ...t }),
20
- /* @__PURE__ */ e(B, { ...t }),
21
- /* @__PURE__ */ e(k, { k: "tool.describe", layoutId: l }),
22
- /* @__PURE__ */ e(k, { k: "tool.ai_review", layoutId: l }),
23
- /* @__PURE__ */ e(K, { layoutId: l }),
24
- /* @__PURE__ */ e(Q, { layoutId: l })
1
+ import { jsxs as h, Fragment as S, jsx as t } from "react/jsx-runtime";
2
+ import { useQuery as L } from "@tanstack/react-query";
3
+ import { ExternalLink as T } from "lucide-react";
4
+ import { useState as _, useRef as I, useEffect as b, useMemo as A } from "react";
5
+ import { useNivaroClient as R } from "../../../context.js";
6
+ import { get as E } from "../../../lib/commands.js";
7
+ import { applyLayoutOps as O } from "../../../lib/layout-ops.js";
8
+ import { cn as g } from "../../../lib/utils.js";
9
+ import { AiTextTools as P } from "../ai-text/AiTextTools.js";
10
+ import { HistoryPanel as F } from "../HistoryPanel.js";
11
+ import { useLayoutEditorHost as N } from "../host.js";
12
+ import { LayoutOpsBlocks as q } from "../ops/LayoutOpsBlocks.js";
13
+ import { useRoleNames as H } from "../overview/overview-api.js";
14
+ import { tintCard as j, labelText as B } from "../panel-style.js";
15
+ import { RelationPicker as D } from "../pickers/relation-picker.js";
16
+ import { CostLimitSetting as U } from "../testing/CostLimitSetting.js";
17
+ import { humanizeOpError as z } from "../useLayoutDraft.js";
18
+ import { Setting as y, smallBtn as C, quietText as f, PickList as w, useSettingVisible as v, Segmented as M } from "./controls.js";
19
+ import { FreezeSetting as W } from "./ResolveSettings.js";
20
+ import { useRolePreview as G } from "./settings-api.js";
21
+ import { settingDef as k } from "./settings-registry.js";
22
+ function xe(e) {
23
+ const i = Number(e.layout.id);
24
+ return /* @__PURE__ */ h(S, { children: [
25
+ /* @__PURE__ */ t(J, { ...e }),
26
+ /* @__PURE__ */ t(Y, { ...e }),
27
+ /* @__PURE__ */ t(x, { k: "tool.describe", layoutId: i }),
28
+ /* @__PURE__ */ t(x, { k: "tool.ai_review", layoutId: i, bundle: e.bundle, apply: e.apply }),
29
+ /* @__PURE__ */ t(Z, { ...e }),
30
+ /* @__PURE__ */ t(U, { ...e }),
31
+ /* @__PURE__ */ t(ee, { layoutId: i }),
32
+ /* @__PURE__ */ t(Q, { ...e }),
33
+ /* @__PURE__ */ t(V, { ...e }),
34
+ /* @__PURE__ */ t(W, { ...e }),
35
+ /* @__PURE__ */ t(te, { layoutId: i }),
36
+ /* @__PURE__ */ t(
37
+ q,
38
+ {
39
+ collection: e.collection,
40
+ layoutId: i,
41
+ name: String(e.layout.name ?? "")
42
+ }
43
+ )
25
44
  ] });
26
45
  }
27
- function H({ collection: t, layout: l }) {
28
- const o = _(), [i, n] = x(null), r = l.slug ? String(l.slug) : null, c = i ? `${o.recordLink(t, i)}${r ? `?layout=${encodeURIComponent(r)}` : ""}` : null;
29
- return /* @__PURE__ */ e(
46
+ const K = {
47
+ off: "Turn off Ask why on every save",
48
+ note: "Ask for a reason on every save",
49
+ note_ticket: "Ask for a reason and a ticket on every save"
50
+ };
51
+ function Q({ layout: e, set: i }) {
52
+ const a = e.change_note, r = a === "note" || a === "note_ticket" ? a : "off";
53
+ return /* @__PURE__ */ t(
54
+ y,
55
+ {
56
+ k: "layout.change_note",
57
+ control: /* @__PURE__ */ t(
58
+ M,
59
+ {
60
+ ariaLabel: "Ask why on every save",
61
+ value: r,
62
+ options: [
63
+ { value: "off", label: "Off" },
64
+ { value: "note", label: "Reason" },
65
+ { value: "note_ticket", label: "Reason + ticket" }
66
+ ],
67
+ onChange: (o) => i({ change_note: o === "off" ? null : o }, K[o])
68
+ }
69
+ ),
70
+ note: r === "off" ? null : "Autosave stays off for this form: every save waits for its reason."
71
+ }
72
+ );
73
+ }
74
+ function V({ bundle: e, layout: i, set: a }) {
75
+ var c;
76
+ const r = A(
77
+ () => e.groups.filter(
78
+ (n) => n.parent_key === null && !n.key.startsWith("__") && (n.type === "section" || n.type === "container")
79
+ ).sort((n, d) => n.sort - d.sort).map((n) => ({ value: n.key, label: n.label || n.key })),
80
+ [e.groups]
81
+ ), o = typeof i.email_summary_group == "string" ? i.email_summary_group : null, s = (c = r.find((n) => n.value === o)) == null ? void 0 : c.label;
82
+ return /* @__PURE__ */ t(
83
+ y,
84
+ {
85
+ k: "layout.email_summary_group",
86
+ control: /* @__PURE__ */ t(
87
+ w,
88
+ {
89
+ ariaLabel: "Section for notification emails",
90
+ value: o,
91
+ options: o && !s ? [...r, { value: o, label: `Missing section (${o})` }] : r,
92
+ clearLabel: "None (header strip)",
93
+ placeholder: "None (header strip)",
94
+ emptyText: "This form has no sections yet",
95
+ onChange: (n) => {
96
+ var d;
97
+ return a(
98
+ { email_summary_group: n },
99
+ n ? `Use ${((d = r.find((l) => l.value === n)) == null ? void 0 : d.label) ?? n} in emails` : "Use the header strip in emails"
100
+ );
101
+ }
102
+ }
103
+ )
104
+ }
105
+ );
106
+ }
107
+ function J({ collection: e, layout: i }) {
108
+ const a = N(), [r, o] = _(null), s = i.slug ? String(i.slug) : null, c = r ? `${a.recordLink(e, r)}${s ? `?layout=${encodeURIComponent(s)}` : ""}` : null;
109
+ return /* @__PURE__ */ t(
30
110
  y,
31
111
  {
32
112
  k: "tool.preview_record",
33
- note: r ? `The record opens pinned to this layout (?layout=${r}).` : "Without a link name the record opens on whichever layout it resolves to.",
34
- children: /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center gap-1.5", children: [
35
- /* @__PURE__ */ e("div", { className: "min-w-[180px] flex-1", children: /* @__PURE__ */ e(
36
- F,
113
+ note: s ? `The record opens pinned to this form (?layout=${s}).` : "Without a link name the record opens on whichever layout it resolves to.",
114
+ children: /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-1.5", children: [
115
+ /* @__PURE__ */ t("div", { className: "min-w-[180px] flex-1", children: /* @__PURE__ */ t(
116
+ D,
37
117
  {
38
- relatedCollection: t,
39
- value: i,
40
- onChange: (s) => n(s == null || s === "" ? null : String(s)),
118
+ relatedCollection: e,
119
+ value: r,
120
+ onChange: (n) => o(n == null || n === "" ? null : String(n)),
41
121
  placeholder: "Pick a record…"
42
122
  }
43
123
  ) }),
44
- /* @__PURE__ */ m(
124
+ /* @__PURE__ */ h(
45
125
  "a",
46
126
  {
47
127
  href: c ?? void 0,
@@ -49,9 +129,9 @@ function H({ collection: t, layout: l }) {
49
129
  rel: "noreferrer",
50
130
  "aria-disabled": !c,
51
131
  "data-layout-record-preview-open": !0,
52
- className: p(S, !c && "pointer-events-none opacity-40"),
132
+ className: g(C, !c && "pointer-events-none opacity-40"),
53
133
  children: [
54
- /* @__PURE__ */ e(I, { className: "h-3.5 w-3.5" }),
134
+ /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" }),
55
135
  "Open in a new tab"
56
136
  ]
57
137
  }
@@ -60,120 +140,150 @@ function H({ collection: t, layout: l }) {
60
140
  }
61
141
  );
62
142
  }
63
- function O(t, l) {
64
- var r;
65
- if (t.role.admin_access)
66
- return `As ${t.role.name}: admin — default layout, every field.`;
67
- if (!t.can_read) return `As ${t.role.name}: cannot read ${l} at all.`;
68
- const o = [`gets “${((r = t.layout) == null ? void 0 : r.name) ?? "no layout"}”`], i = t.hidden_fields.length, n = t.readonly_fields.length;
69
- return i && o.push(`${i} field${i === 1 ? "" : "s"} hidden`), n && o.push(`${n} read-only`), t.can_update || o.push("cannot edit"), `As ${t.role.name}: ${o.join(" · ")}`;
143
+ function X(e, i) {
144
+ var s;
145
+ if (e.role.admin_access)
146
+ return `As ${e.role.name}: admin — default layout, every field.`;
147
+ if (!e.can_read) return `As ${e.role.name}: cannot read ${i} at all.`;
148
+ const a = [`gets “${((s = e.layout) == null ? void 0 : s.name) ?? "no layout"}”`], r = e.hidden_fields.length, o = e.readonly_fields.length;
149
+ return r && a.push(`${r} field${r === 1 ? "" : "s"} hidden`), o && a.push(`${o} read-only`), e.can_update || a.push("cannot edit"), `As ${e.role.name}: ${a.join(" · ")}`;
70
150
  }
71
- function B({
72
- collection: t,
73
- onPreviewRole: l,
74
- previewRoleId: o,
75
- onPreviewRoleChange: i
151
+ function Y({
152
+ collection: e,
153
+ onPreviewRole: i,
154
+ previewRoleId: a,
155
+ onPreviewRoleChange: r
76
156
  }) {
77
- const { data: n = [] } = T(!0), [r, c] = x(null), s = i ? o ?? null : r, h = i ?? c, { data: a = null, isFetching: $ } = D(t, s), u = R(l);
78
- return u.current = l, N(() => {
79
- var d;
80
- (d = u.current) == null || d.call(u, s ? a : null);
81
- }, [s, a]), N(() => () => {
82
- var d;
83
- return (d = u.current) == null ? void 0 : d.call(u, null);
84
- }, []), /* @__PURE__ */ e(
157
+ const { data: o = [] } = H(!0), [s, c] = _(null), n = r ? a ?? null : s, d = r ?? c, { data: l = null, isFetching: p } = G(e, n), m = I(i);
158
+ return m.current = i, b(() => {
159
+ var u;
160
+ (u = m.current) == null || u.call(m, n ? l : null);
161
+ }, [n, l]), b(() => () => {
162
+ var u;
163
+ return (u = m.current) == null ? void 0 : u.call(m, null);
164
+ }, []), /* @__PURE__ */ t(
85
165
  y,
86
166
  {
87
167
  k: "tool.preview_as_role",
88
- control: /* @__PURE__ */ e(
89
- j,
168
+ control: /* @__PURE__ */ t(
169
+ w,
90
170
  {
91
171
  ariaLabel: "Preview as role",
92
- value: s,
93
- options: [...n].sort((d, w) => d.name.localeCompare(w.name)).map((d) => ({ value: d.id, label: d.name })),
172
+ value: n,
173
+ options: [...o].sort((u, $) => u.name.localeCompare($.name)).map((u) => ({ value: u.id, label: u.name })),
94
174
  clearLabel: "Nobody (off)",
95
- onChange: h
175
+ onChange: d
96
176
  }
97
177
  ),
98
- children: s && /* @__PURE__ */ e("div", { "data-role-preview": !0, className: p(q, "p-3 text-[12px]"), children: $ && !a ? /* @__PURE__ */ e("p", { className: f, children: "Checking…" }) : a ? /* @__PURE__ */ m(b, { children: [
99
- /* @__PURE__ */ e(
178
+ children: n && /* @__PURE__ */ t("div", { "data-role-preview": !0, className: g(j, "p-3 text-[12px]"), children: p && !l ? /* @__PURE__ */ t("p", { className: f, children: "Checking…" }) : l ? /* @__PURE__ */ h(S, { children: [
179
+ /* @__PURE__ */ t(
100
180
  "p",
101
181
  {
102
- className: p(
182
+ className: g(
103
183
  "text-slate-700 dark:text-foreground",
104
- !a.can_read && "text-[#9c2f47] dark:text-[#f08aa1]"
184
+ !l.can_read && "text-[#9c2f47] dark:text-[#f08aa1]"
105
185
  ),
106
- children: O(a, t)
186
+ children: X(l, e)
107
187
  }
108
188
  ),
109
- a.note && /* @__PURE__ */ e("p", { className: p("mt-1", f), children: a.note })
110
- ] }) : /* @__PURE__ */ e("p", { className: f, children: "Could not preview this role." }) })
189
+ l.note && /* @__PURE__ */ t("p", { className: g("mt-1", f), children: l.note })
190
+ ] }) : /* @__PURE__ */ t("p", { className: f, children: "Could not preview this role." }) })
111
191
  }
112
192
  );
113
193
  }
114
- function k({ k: t, layoutId: l }) {
115
- var n, r;
116
- const o = _(), i = t === "tool.ai_review" ? (n = o.aiReviewSlot) == null ? void 0 : n.call(o, l) : (r = o.explainSlot) == null ? void 0 : r.call(o, {
194
+ function x({
195
+ k: e,
196
+ layoutId: i,
197
+ bundle: a,
198
+ apply: r
199
+ }) {
200
+ var n, d;
201
+ const o = N(), s = A(
202
+ () => a && r ? {
203
+ bundle: a,
204
+ apply: r,
205
+ check: (l) => {
206
+ try {
207
+ return O(a, l), null;
208
+ } catch (p) {
209
+ return z(p instanceof Error ? p.message : String(p));
210
+ }
211
+ }
212
+ } : void 0,
213
+ [a, r]
214
+ ), c = e === "tool.ai_review" ? (n = o.aiReviewSlot) == null ? void 0 : n.call(o, i, s) : (d = o.explainSlot) == null ? void 0 : d.call(o, {
117
215
  kind: "config",
118
216
  type: "layout",
119
- id: l,
120
- label: "Describe this layout"
217
+ id: i,
218
+ label: "Describe this form"
121
219
  });
122
- return /* @__PURE__ */ e(y, { k: t, children: i ?? /* @__PURE__ */ e("p", { className: f, children: "Not offered in this app." }) });
220
+ return /* @__PURE__ */ t(y, { k: e, children: c ?? /* @__PURE__ */ t("p", { className: f, children: "Not offered in this app." }) });
221
+ }
222
+ function Z({ layout: e, bundle: i, collection: a, apply: r }) {
223
+ const o = N();
224
+ return /* @__PURE__ */ t(y, { k: "tool.ai_text", children: o.isAdmin && r ? /* @__PURE__ */ t(
225
+ P,
226
+ {
227
+ layoutId: Number(e.id),
228
+ bundle: i,
229
+ collection: a,
230
+ apply: r
231
+ }
232
+ ) : /* @__PURE__ */ t("p", { className: f, children: "Not offered here: administrators only." }) });
123
233
  }
124
- function K({ layoutId: t }) {
125
- var r, c;
126
- const l = g("tool.version_history"), o = g("tool.version_diff"), i = g("tool.version_restore");
127
- if (!l && !o && !i) return null;
128
- const n = v("tool.version_history");
129
- return /* @__PURE__ */ m("div", { "data-setting": "tool.version_history", className: "space-y-1.5", children: [
130
- /* @__PURE__ */ e("p", { className: E, children: n == null ? void 0 : n.label }),
131
- /* @__PURE__ */ e(L, { layoutId: t }),
132
- /* @__PURE__ */ m("p", { className: f, children: [
133
- n == null ? void 0 : n.effect,
234
+ function ee({ layoutId: e }) {
235
+ var s, c;
236
+ const i = v("tool.version_history"), a = v("tool.version_diff"), r = v("tool.version_restore");
237
+ if (!i && !a && !r) return null;
238
+ const o = k("tool.version_history");
239
+ return /* @__PURE__ */ h("div", { "data-setting": "tool.version_history", className: "space-y-1.5", children: [
240
+ /* @__PURE__ */ t("p", { className: B, children: o == null ? void 0 : o.label }),
241
+ /* @__PURE__ */ t(F, { layoutId: e }),
242
+ /* @__PURE__ */ h("p", { className: f, children: [
243
+ o == null ? void 0 : o.effect,
134
244
  " ",
135
- (r = v("tool.version_diff")) == null ? void 0 : r.effect,
245
+ (s = k("tool.version_diff")) == null ? void 0 : s.effect,
136
246
  " ",
137
- (c = v("tool.version_restore")) == null ? void 0 : c.effect
247
+ (c = k("tool.version_restore")) == null ? void 0 : c.effect
138
248
  ] })
139
249
  ] });
140
250
  }
141
- function Q({ layoutId: t }) {
142
- const l = P(), [o, i] = x(!1), { data: n, isFetching: r, isError: c, refetch: s } = C({
251
+ function te({ layoutId: e }) {
252
+ const i = R(), [a, r] = _(!1), { data: o, isFetching: s, isError: c, refetch: n } = L({
143
253
  queryKey: ["layout-editor", "drift"],
144
- queryFn: () => l.request(A("/collection-layouts/drift")).then((a) => Array.isArray(a == null ? void 0 : a.data) ? a.data : []),
145
- enabled: o,
254
+ queryFn: () => i.request(E("/collection-layouts/drift")).then((l) => Array.isArray(l == null ? void 0 : l.data) ? l.data : []),
255
+ enabled: a,
146
256
  staleTime: 0
147
- }), h = n == null ? void 0 : n.find((a) => Number(a.layout_id) === t);
148
- return /* @__PURE__ */ m(
257
+ }), d = o == null ? void 0 : o.find((l) => Number(l.layout_id) === e);
258
+ return /* @__PURE__ */ h(
149
259
  y,
150
260
  {
151
261
  k: "tool.layout_drift",
152
- control: /* @__PURE__ */ e(
262
+ control: /* @__PURE__ */ t(
153
263
  "button",
154
264
  {
155
265
  type: "button",
156
- className: S,
157
- disabled: r,
158
- onClick: () => o ? void s() : i(!0),
159
- children: r ? "Checking…" : "Check now"
266
+ className: C,
267
+ disabled: s,
268
+ onClick: () => a ? void n() : r(!0),
269
+ children: s ? "Checking…" : "Check now"
160
270
  }
161
271
  ),
162
272
  children: [
163
- o && !r && c && /* @__PURE__ */ e("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "The check failed." }),
164
- o && n && !r && /* @__PURE__ */ e("div", { "data-layout-drift": !0, className: "text-[12px]", children: h ? /* @__PURE__ */ e("ul", { className: "space-y-1", children: h.warnings.map((a) => /* @__PURE__ */ e(
273
+ a && !s && c && /* @__PURE__ */ t("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "The check failed." }),
274
+ a && o && !s && /* @__PURE__ */ t("div", { "data-layout-drift": !0, className: "text-[12px]", children: d ? /* @__PURE__ */ t("ul", { className: "space-y-1", children: d.warnings.map((l) => /* @__PURE__ */ t(
165
275
  "li",
166
276
  {
167
277
  className: "rounded bg-[#fae6eb] px-1.5 py-1 text-[#9c2f47] dark:bg-[#3d1621] dark:text-[#f08aa1]",
168
- children: a
278
+ children: l
169
279
  },
170
- a
171
- )) }) : /* @__PURE__ */ e("p", { className: f, children: "No drift: the layout matches its last saved version." }) })
280
+ l
281
+ )) }) : /* @__PURE__ */ t("p", { className: f, children: "No drift: the form matches its last saved version." }) })
172
282
  ]
173
283
  }
174
284
  );
175
285
  }
176
286
  export {
177
- le as ToolsSection,
178
- O as rolePreviewSummary
287
+ xe as ToolsSection,
288
+ X as rolePreviewSummary
179
289
  };