@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,83 +1,110 @@
1
- import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import { SlidersHorizontal as y } from "lucide-react";
3
- import { useMemo as N } from "react";
4
- import { cn as d } from "../../lib/utils.js";
5
- import { Skeleton as k } from "../ui/skeleton.js";
6
- import { useLayoutOverview as v, useOverviewFields as _, useRuleChoiceLabels as L } from "./overview/overview-api.js";
7
- import { rowPill as S, Pill as C, Sentence as F, purposeSegments as R } from "./overview/purpose.js";
8
- const j = [
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
+ import { SlidersHorizontal as b } from "lucide-react";
3
+ import { useMemo as v } from "react";
4
+ import { cn as x } from "../../lib/utils.js";
5
+ import { Skeleton as y } from "../ui/skeleton.js";
6
+ import { useRailDrop as k } from "./dnd/rail-drop.js";
7
+ import { useLayoutOverview as N, useOverviewFields as _, useRuleChoiceLabels as S } from "./overview/overview-api.js";
8
+ import { Sentence as L, purposeSegments as R, rowPill as C, Pill as w } from "./overview/purpose.js";
9
+ const F = [
9
10
  { id: "forms", title: "Forms" },
10
11
  { id: "link_only", title: "Link only" },
11
12
  { id: "other_views", title: "Other views" },
12
13
  { id: "unused", title: "Unused" }
13
- ], x = "px-2 pb-1 pt-3 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground";
14
- function O({
15
- collection: n,
16
- currentId: i,
14
+ ], h = "px-2 pb-1 pt-3 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground";
15
+ function j({
16
+ row: t,
17
+ current: o,
18
+ settingsOpen: m,
19
+ unused: d,
20
+ dropTarget: c,
17
21
  onOpen: p,
18
- settingsOpen: s,
19
- onSettings: f
22
+ children: r
20
23
  }) {
21
- const { data: o, isLoading: h } = v(n), { data: m = [] } = _(n), u = N(() => (o == null ? void 0 : o.rows) ?? [], [o]), g = L(n, m, u);
22
- return /* @__PURE__ */ l("nav", { "data-editor-rail": "", "aria-label": "Layouts", className: "flex flex-col gap-0.5 px-2 pb-4", children: [
23
- h && [0, 1, 2].map((a) => /* @__PURE__ */ t(k, { className: "mx-2 mt-3 h-9 rounded-md" }, a)),
24
- j.map((a) => {
25
- const c = u.filter((e) => e.section === a.id);
26
- return c.length ? /* @__PURE__ */ l("div", { className: "flex flex-col gap-0.5", children: [
27
- /* @__PURE__ */ t("p", { className: x, children: a.title }),
28
- c.map((e) => {
29
- const b = e.layout_id === i && !s, r = S(e);
30
- return /* @__PURE__ */ l(
31
- "button",
32
- {
33
- type: "button",
34
- "data-rail-layout": e.layout_id,
35
- "aria-current": e.layout_id === i ? "page" : void 0,
36
- onClick: () => p(e.layout_id),
37
- className: d(
38
- "flex flex-col gap-px rounded-md px-2 py-1.5 text-left transition-colors",
39
- b ? "bg-accent" : "hover:bg-muted",
40
- e.layout_id === i && s && "bg-muted"
41
- ),
42
- children: [
43
- /* @__PURE__ */ l(
44
- "span",
45
- {
46
- className: d(
47
- "flex min-w-0 items-center gap-1.5 text-[12.5px] font-semibold text-slate-900 dark:text-foreground",
48
- a.id === "unused" && "font-medium text-slate-500 dark:text-muted-foreground"
49
- ),
50
- children: [
51
- /* @__PURE__ */ t("span", { className: "truncate", children: e.name }),
52
- r && /* @__PURE__ */ t(C, { tone: r.tone, children: r.text })
53
- ]
54
- }
55
- ),
56
- /* @__PURE__ */ t("span", { className: "line-clamp-2 text-[12px] leading-snug text-slate-500 dark:text-muted-foreground [&_b]:font-medium [&_b]:text-slate-600 dark:[&_b]:text-muted-foreground", children: /* @__PURE__ */ t(F, { segs: R(e, m, g) }) })
57
- ]
58
- },
59
- e.layout_id
60
- );
61
- })
62
- ] }, a.id) : null;
24
+ const a = k(t.layout_id, o || !c), u = o && !m, l = C(t);
25
+ return /* @__PURE__ */ i(
26
+ "button",
27
+ {
28
+ ref: a.ref,
29
+ type: "button",
30
+ "data-rail-layout": t.layout_id,
31
+ "data-rail-drop": a.over ? "over" : a.armed ? "armed" : void 0,
32
+ "aria-current": o ? "page" : void 0,
33
+ onClick: () => p(t.layout_id),
34
+ className: x(
35
+ "flex flex-col gap-px rounded-md px-2 py-1.5 text-left transition-colors",
36
+ u ? "bg-accent" : "hover:bg-muted",
37
+ o && m && "bg-muted",
38
+ a.armed && "outline-dashed outline-1 -outline-offset-1 outline-slate-300 dark:outline-border",
39
+ a.over && "bg-nvr-cyan/10 outline-nvr-cyan dark:outline-nvr-cyan"
40
+ ),
41
+ children: [
42
+ /* @__PURE__ */ i(
43
+ "span",
44
+ {
45
+ className: x(
46
+ "flex min-w-0 items-center gap-1.5 text-[12.5px] font-semibold text-slate-900 dark:text-foreground",
47
+ d && "font-medium text-slate-500 dark:text-muted-foreground"
48
+ ),
49
+ children: [
50
+ /* @__PURE__ */ e("span", { className: "truncate", children: t.name }),
51
+ l && /* @__PURE__ */ e(w, { tone: l.tone, children: l.text }),
52
+ a.over && /* @__PURE__ */ e("span", { className: "ml-auto shrink-0 text-[11px] font-medium text-[#0089ad] dark:text-nvr-cyan", children: "Copy here" })
53
+ ]
54
+ }
55
+ ),
56
+ r
57
+ ]
58
+ }
59
+ );
60
+ }
61
+ function M({
62
+ collection: t,
63
+ currentId: o,
64
+ onOpen: m,
65
+ settingsOpen: d,
66
+ onSettings: c,
67
+ dropTargets: p = !1
68
+ }) {
69
+ const { data: r, isLoading: a } = N(t), { data: u = [] } = _(t), l = v(() => (r == null ? void 0 : r.rows) ?? [], [r]), g = S(t, u, l);
70
+ return /* @__PURE__ */ i("nav", { "data-editor-rail": "", "aria-label": "Forms", className: "flex flex-col gap-0.5 px-2 pb-4", children: [
71
+ a && [0, 1, 2].map((n) => /* @__PURE__ */ e(y, { className: "mx-2 mt-3 h-9 rounded-md" }, n)),
72
+ F.map((n) => {
73
+ const f = l.filter((s) => s.section === n.id);
74
+ return f.length ? /* @__PURE__ */ i("div", { className: "flex flex-col gap-0.5", children: [
75
+ /* @__PURE__ */ e("p", { className: h, children: n.title }),
76
+ f.map((s) => /* @__PURE__ */ e(
77
+ j,
78
+ {
79
+ row: s,
80
+ current: s.layout_id === o,
81
+ settingsOpen: d,
82
+ unused: n.id === "unused",
83
+ dropTarget: p,
84
+ onOpen: m,
85
+ children: /* @__PURE__ */ e("span", { className: "line-clamp-2 text-[12px] leading-snug text-slate-500 dark:text-muted-foreground [&_b]:font-medium [&_b]:text-slate-600 dark:[&_b]:text-muted-foreground", children: /* @__PURE__ */ e(L, { segs: R(s, u, g) }) })
86
+ },
87
+ s.layout_id
88
+ ))
89
+ ] }, n.id) : null;
63
90
  }),
64
- /* @__PURE__ */ t("p", { className: x, children: "Form settings" }),
65
- /* @__PURE__ */ l(
91
+ /* @__PURE__ */ e("p", { className: h, children: "Form settings" }),
92
+ /* @__PURE__ */ i(
66
93
  "button",
67
94
  {
68
95
  type: "button",
69
96
  "data-rail-settings": "",
70
- "aria-pressed": s,
71
- onClick: f,
72
- className: d(
97
+ "aria-pressed": d,
98
+ onClick: c,
99
+ className: x(
73
100
  "flex items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",
74
- s ? "bg-accent" : "hover:bg-muted"
101
+ d ? "bg-accent" : "hover:bg-muted"
75
102
  ),
76
103
  children: [
77
- /* @__PURE__ */ t(y, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-500 dark:text-muted-foreground" }),
78
- /* @__PURE__ */ l("span", { className: "flex flex-col gap-px", children: [
79
- /* @__PURE__ */ t("span", { className: "text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: "Steps, buttons, panels…" }),
80
- /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Who gets this form and how it behaves" })
104
+ /* @__PURE__ */ e(b, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-slate-500 dark:text-muted-foreground" }),
105
+ /* @__PURE__ */ i("span", { className: "flex flex-col gap-px", children: [
106
+ /* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: "Steps, buttons, panels…" }),
107
+ /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Who gets this form and how it behaves" })
81
108
  ] })
82
109
  ]
83
110
  }
@@ -85,5 +112,5 @@ function O({
85
112
  ] });
86
113
  }
87
114
  export {
88
- O as LayoutsRail
115
+ M as LayoutsRail
89
116
  };
@@ -0,0 +1,38 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { StickyNote as s } from "lucide-react";
3
+ import { useState as o } from "react";
4
+ import { Popover as n, PopoverTrigger as l, PopoverContent as m } from "../ui/popover.js";
5
+ import { noteByline as d } from "./editor-notes.js";
6
+ function h({ note: t }) {
7
+ const [a, i] = o(!1);
8
+ return /* @__PURE__ */ r(n, { open: a, onOpenChange: i, children: [
9
+ /* @__PURE__ */ e(l, { asChild: !0, children: /* @__PURE__ */ e(
10
+ "button",
11
+ {
12
+ type: "button",
13
+ "data-design-pass": "",
14
+ "data-editor-note-marker": "",
15
+ "aria-label": "Note for editors",
16
+ "data-tip": t.text.length > 80 ? `${t.text.slice(0, 80)}…` : t.text,
17
+ className: "absolute -top-2 left-1 z-20 inline-flex h-5 w-5 items-center justify-center rounded bg-amber-100 text-amber-700 shadow-sm ring-1 ring-amber-300 transition-colors hover:bg-amber-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:bg-amber-500/20 dark:text-amber-200 dark:ring-amber-500/40 dark:hover:bg-amber-500/30",
18
+ children: /* @__PURE__ */ e(s, { "aria-hidden": !0, className: "h-3 w-3" })
19
+ }
20
+ ) }),
21
+ /* @__PURE__ */ r(
22
+ m,
23
+ {
24
+ align: "start",
25
+ side: "top",
26
+ className: "w-[280px] space-y-2 border-amber-200 bg-amber-50 p-3 dark:border-amber-500/30 dark:bg-[#2a2414]",
27
+ children: [
28
+ /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap text-[12.5px] leading-snug text-slate-800 dark:text-amber-50", children: t.text }),
29
+ /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-500 dark:text-amber-200/70", children: d(t) }),
30
+ /* @__PURE__ */ e("p", { className: "text-[11.5px] text-slate-500 dark:text-amber-200/70", children: "Only people editing this form see this note." })
31
+ ]
32
+ }
33
+ )
34
+ ] });
35
+ }
36
+ export {
37
+ h as NoteMarker
38
+ };
@@ -0,0 +1,187 @@
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as K } from "react";
3
+ import { UNGROUPED_KEY as W } from "../../lib/layout-ops.js";
4
+ import { cn as N } from "../../lib/utils.js";
5
+ import { Checkbox as M } from "../ui/checkbox.js";
6
+ import { SimpleSelect as F } from "../ui/SimpleSelect.js";
7
+ import { targetKey as b } from "./design-context.js";
8
+ import { fieldZones as P, zoneItems as R, targetOfKey as D, keyOf as q, isFieldRow as U, moveToZoneOps as Z, widthOps as Y, WIDTH_LABELS as I, widthOf as J, flagOps as Q, flagOn as V, GRID_WIDTHS as X } from "./field-zones.js";
9
+ import { useFocusBuffer as ee } from "./focus-buffer.js";
10
+ import { useCollectionMeta as te } from "./inspector/field-context.js";
11
+ import { describeField as E, readOverrides as re, withOverride as ae } from "./inspector/model.js";
12
+ import { slotName as le } from "./slot-names.js";
13
+ const oe = "h-7 w-full min-w-[120px] rounded-md border border-transparent bg-transparent px-2 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 hover:border-slate-200 focus:border-nvr-cyan focus:bg-white dark:text-foreground dark:placeholder:text-muted-foreground dark:hover:border-border dark:focus:bg-background", H = "h-7 w-full gap-1 rounded-md border-transparent bg-transparent px-2 text-[12.5px] shadow-none hover:border-slate-200 focus:ring-0 focus:ring-offset-0 dark:hover:border-border", T = "h-4 w-4 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", f = "sticky top-0 z-10 border-b border-slate-200 bg-slate-50 px-2 py-2 text-left text-[11.5px] font-semibold text-slate-600 dark:border-border dark:bg-card dark:text-muted-foreground", y = (o) => o ?? W, _ = [
14
+ { k: "required", label: "Required", on: "Make {n} required", off: "Make {n} optional" },
15
+ { k: "readonly", label: "Read-only", on: "Make {n} read-only", off: "Make {n} editable" },
16
+ { k: "hidden", label: "Hidden", on: "Hide {n}", off: "Show {n}" }
17
+ ];
18
+ function ne({
19
+ row: o,
20
+ placeholder: v,
21
+ name: i,
22
+ apply: S,
23
+ flush: m
24
+ }) {
25
+ const h = re(o), O = typeof h.label == "string" ? h.label : "", r = ee(O, m);
26
+ return /* @__PURE__ */ e(
27
+ "input",
28
+ {
29
+ "aria-label": `Label of ${i}`,
30
+ value: r.value,
31
+ placeholder: v,
32
+ onChange: (d) => {
33
+ const u = d.target.value;
34
+ r.set(u), S(
35
+ [
36
+ {
37
+ op: "update_placement",
38
+ at: q(o),
39
+ patch: { overrides: ae(o, "label", u === "" ? void 0 : u) }
40
+ }
41
+ ],
42
+ { label: `Rename ${i}`, text: !0 }
43
+ );
44
+ },
45
+ onKeyDown: (d) => {
46
+ d.key === "Enter" && m();
47
+ },
48
+ ...r.props,
49
+ className: oe
50
+ }
51
+ );
52
+ }
53
+ function ge({
54
+ bundle: o,
55
+ collection: v,
56
+ apply: i,
57
+ flush: S,
58
+ selection: m,
59
+ onSelect: h,
60
+ onSelection: O
61
+ }) {
62
+ const { data: r } = te(v), d = K(() => P(o), [o]), u = K(() => new Set(m.map(b)), [m]), G = (t) => E(t.field, (r == null ? void 0 : r.fields) ?? [], (r == null ? void 0 : r.relations) ?? [], null), j = d.map((t) => ({ value: y(t.key), label: t.label })), z = X.map((t) => ({ value: String(t), label: I[t] })), $ = d.reduce((t, s) => t + R(o, s.key).length, 0), A = (t, s) => {
63
+ t.target.closest('input, button, [role="combobox"], [role="checkbox"]') || (t.shiftKey || t.metaKey || t.ctrlKey ? h(s, { additive: !0 }) : h(s));
64
+ };
65
+ return /* @__PURE__ */ c("div", { "data-placements-table": "", className: "flex min-h-full flex-col p-4", children: [
66
+ /* @__PURE__ */ c("p", { className: "mb-2 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
67
+ $,
68
+ " ",
69
+ $ === 1 ? "item" : "items",
70
+ " on this form. Shift- or ⌘-click rows to select several; the panel on the right changes them together.",
71
+ o.layout.parent_layout_id != null && " Fields that come from the parent form are not listed."
72
+ ] }),
73
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse text-[12.5px]", children: [
74
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ c("tr", { children: [
75
+ /* @__PURE__ */ e("th", { className: N(f, "w-8"), children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Selected" }) }),
76
+ /* @__PURE__ */ e("th", { className: f, children: "Field" }),
77
+ /* @__PURE__ */ e("th", { className: f, children: "Label on this form" }),
78
+ /* @__PURE__ */ e("th", { className: f, children: "Section" }),
79
+ /* @__PURE__ */ e("th", { className: N(f, "w-[92px]"), children: "Width" }),
80
+ _.map((t) => /* @__PURE__ */ e("th", { className: N(f, "w-[76px] text-center"), children: t.label }, t.k))
81
+ ] }) }),
82
+ d.map((t) => {
83
+ const s = R(o, t.key);
84
+ return s.length === 0 ? null : /* @__PURE__ */ c("tbody", { "data-table-zone": y(t.key), children: [
85
+ /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ c(
86
+ "td",
87
+ {
88
+ colSpan: 5 + _.length,
89
+ className: "border-b border-slate-100 bg-slate-50/60 px-3 py-1.5 text-[12px] font-semibold text-slate-700 dark:border-border/60 dark:bg-muted/40 dark:text-foreground",
90
+ children: [
91
+ t.label,
92
+ /* @__PURE__ */ e("span", { className: "ml-1.5 font-normal text-slate-400 dark:text-muted-foreground", children: s.length })
93
+ ]
94
+ }
95
+ ) }),
96
+ s.map((a) => {
97
+ const p = D(q(a)), k = u.has(b(p)), B = G(a), C = U(a), n = C ? E(a.field, (r == null ? void 0 : r.fields) ?? [], (r == null ? void 0 : r.relations) ?? [], a).label : a.label_override ?? le(a.field);
98
+ return /* @__PURE__ */ c(
99
+ "tr",
100
+ {
101
+ "data-table-row": b(p),
102
+ "aria-selected": k,
103
+ onClick: (l) => A(l, p),
104
+ className: N(
105
+ "cursor-pointer border-b border-slate-100 last:border-0 dark:border-border/60",
106
+ k ? "bg-accent" : "hover:bg-muted"
107
+ ),
108
+ children: [
109
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: /* @__PURE__ */ e(
110
+ M,
111
+ {
112
+ checked: k,
113
+ "aria-label": `Select ${n}`,
114
+ onCheckedChange: () => h(p, { additive: !0 }),
115
+ className: T
116
+ }
117
+ ) }),
118
+ /* @__PURE__ */ c("td", { className: "max-w-[220px] px-2 py-1", children: [
119
+ /* @__PURE__ */ e("span", { className: "block truncate font-medium text-slate-800 dark:text-foreground", children: n }),
120
+ /* @__PURE__ */ e("span", { className: "block truncate font-mono text-[11px] text-slate-400 dark:text-muted-foreground", children: a.field })
121
+ ] }),
122
+ /* @__PURE__ */ e("td", { className: "px-1 py-1", children: C ? /* @__PURE__ */ e(
123
+ ne,
124
+ {
125
+ row: a,
126
+ name: n,
127
+ placeholder: B.label,
128
+ apply: i,
129
+ flush: S
130
+ }
131
+ ) : /* @__PURE__ */ e("span", { className: "px-2 text-slate-400", children: "—" }) }),
132
+ /* @__PURE__ */ e("td", { className: "min-w-[150px] px-1 py-1", children: /* @__PURE__ */ e(
133
+ F,
134
+ {
135
+ ariaLabel: `Section of ${n}`,
136
+ value: y(a.group_key),
137
+ options: j,
138
+ className: H,
139
+ onChange: (l) => {
140
+ var L;
141
+ const x = l === W ? null : l, w = Z(o, [a], x);
142
+ w.ops.length && (i(w.ops, {
143
+ label: `Move ${n} to ${(L = d.find((g) => g.key === x)) == null ? void 0 : L.label}`
144
+ }), k && O(
145
+ m.map(
146
+ (g) => b(g) === b(p) ? D(w.moved[0]) : g
147
+ )
148
+ ));
149
+ }
150
+ }
151
+ ) }),
152
+ /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
153
+ F,
154
+ {
155
+ ariaLabel: `Width of ${n}`,
156
+ value: String(J(a)),
157
+ options: z,
158
+ className: H,
159
+ onChange: (l) => i(Y([a], Number(l)), {
160
+ label: `Set the width of ${n} to ${I[Number(l)]}`
161
+ })
162
+ }
163
+ ) }),
164
+ _.map((l) => /* @__PURE__ */ e("td", { className: "px-2 py-1 text-center", children: C || l.k === "hidden" ? /* @__PURE__ */ e(
165
+ M,
166
+ {
167
+ checked: V(a, l.k),
168
+ "aria-label": `${l.label}: ${n}`,
169
+ onCheckedChange: (x) => i(Q([a], l.k, x === !0), {
170
+ label: (x === !0 ? l.on : l.off).replace("{n}", n)
171
+ }),
172
+ className: T
173
+ }
174
+ ) : /* @__PURE__ */ e("span", { className: "text-slate-400", children: "—" }) }, l.k))
175
+ ]
176
+ },
177
+ b(p)
178
+ );
179
+ })
180
+ ] }, y(t.key));
181
+ })
182
+ ] }) })
183
+ ] });
184
+ }
185
+ export {
186
+ ge as PlacementsTable
187
+ };
@@ -0,0 +1,143 @@
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { useQuery as I } from "@tanstack/react-query";
3
+ import { Puzzle as O } from "lucide-react";
4
+ import { useState as v, useMemo as S } from "react";
5
+ import { toast as j } from "sonner";
6
+ import { useNivaroClient as B } from "../../context.js";
7
+ import { cn as $ } from "../../lib/utils.js";
8
+ import { Popover as L, PopoverTrigger as q, PopoverContent as z } from "../ui/popover.js";
9
+ import { Skeleton as h } from "../ui/skeleton.js";
10
+ import { fetchVersionBundle as V } from "./history-api.js";
11
+ import { restorablePieces as _ } from "./restore-piece.js";
12
+ function W({
13
+ layoutId: i,
14
+ version: o,
15
+ bundle: d,
16
+ onApply: t,
17
+ fieldLabel: s,
18
+ onDone: m,
19
+ className: P
20
+ }) {
21
+ const C = B(), [f, x] = v(!1), [p, g] = v(""), c = o.name ? `“${o.name}” (v${o.version})` : `v${o.version}`, {
22
+ data: l,
23
+ isLoading: F,
24
+ error: R
25
+ } = I({
26
+ queryKey: ["layout-editor", "version-bundle", i, o.id],
27
+ queryFn: () => V(C, i, o.id),
28
+ enabled: f,
29
+ staleTime: Number.POSITIVE_INFINITY,
30
+ retry: !1
31
+ }), n = S(
32
+ () => l ? _(d, l, s) : [],
33
+ [d, l, s]
34
+ ), b = p.trim().toLowerCase(), u = b ? n.filter((r) => `${r.label} ${r.where ?? ""}`.toLowerCase().includes(b)) : n, k = u.filter((r) => r.piece.kind === "group"), N = u.filter((r) => r.piece.kind === "field"), y = (r) => {
35
+ const T = r.piece.kind === "group" ? `section ${r.label}` : r.label;
36
+ t(r.ops, `Restore ${T} from ${c}`), j.success(`${r.label} restored from ${c} as one change (undo with ⌘Z)`), x(!1), g(""), m == null || m();
37
+ };
38
+ return /* @__PURE__ */ a(L, { open: f, onOpenChange: x, children: [
39
+ /* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(
40
+ "button",
41
+ {
42
+ type: "button",
43
+ "data-restore-piece": o.id,
44
+ "data-tip": "Bring back one section or field from this version, as one undoable change",
45
+ className: $(P, f && "border-nvr-cyan text-nvr-navy dark:text-nvr-cyan"),
46
+ children: "Piece"
47
+ }
48
+ ) }),
49
+ /* @__PURE__ */ a(
50
+ z,
51
+ {
52
+ align: "end",
53
+ className: "flex max-h-[min(60vh,520px)] w-[380px] flex-col gap-2 overflow-hidden p-3",
54
+ "data-restore-piece-popover": "",
55
+ children: [
56
+ /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-2", children: [
57
+ /* @__PURE__ */ a("p", { className: "m-0 text-[12px] font-semibold text-slate-700 dark:text-foreground", children: [
58
+ "Restore a piece of ",
59
+ c
60
+ ] }),
61
+ /* @__PURE__ */ e(O, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-muted-foreground" })
62
+ ] }),
63
+ /* @__PURE__ */ e("p", { className: "m-0 text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Only what differs from the form now. The rest of the form stays as it is." }),
64
+ n.length > 8 && /* @__PURE__ */ e(
65
+ "input",
66
+ {
67
+ "aria-label": "Find a section or field",
68
+ value: p,
69
+ placeholder: "Find a section or field…",
70
+ onChange: (r) => g(r.target.value),
71
+ className: "h-8 w-full rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-500 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: [
75
+ F && /* @__PURE__ */ a("div", { className: "space-y-1.5 py-1", "data-restore-piece-loading": "", children: [
76
+ /* @__PURE__ */ e(h, { className: "h-9 w-full" }),
77
+ /* @__PURE__ */ e(h, { className: "h-9 w-full" }),
78
+ /* @__PURE__ */ e(h, { className: "h-9 w-5/6" })
79
+ ] }),
80
+ R != null && /* @__PURE__ */ e("p", { className: "m-0 py-1 text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "That version could not be read." }),
81
+ l && n.length === 0 && /* @__PURE__ */ a("p", { className: "m-0 py-1 text-[12px] text-slate-500 dark:text-slate-400", children: [
82
+ "Nothing in ",
83
+ c,
84
+ " differs from the form now."
85
+ ] }),
86
+ l && n.length > 0 && u.length === 0 && /* @__PURE__ */ a("p", { className: "m-0 py-1 text-[12px] text-slate-500 dark:text-slate-400", children: [
87
+ "Nothing matches “",
88
+ p.trim(),
89
+ "”."
90
+ ] }),
91
+ k.length > 0 && /* @__PURE__ */ e(w, { title: "Sections", rows: k, onRestore: y }),
92
+ N.length > 0 && /* @__PURE__ */ e(w, { title: "Fields", rows: N, onRestore: y })
93
+ ] })
94
+ ]
95
+ }
96
+ )
97
+ ] });
98
+ }
99
+ function w({
100
+ title: i,
101
+ rows: o,
102
+ onRestore: d
103
+ }) {
104
+ return /* @__PURE__ */ a("div", { className: "mb-2 last:mb-0", children: [
105
+ /* @__PURE__ */ e("p", { className: "m-0 mb-0.5 text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: i }),
106
+ /* @__PURE__ */ e("ul", { className: "m-0 list-none divide-y divide-slate-100 p-0 dark:divide-border/60", children: o.map((t) => {
107
+ const s = t.piece.kind === "group" ? `g:${t.piece.key}` : `f:${t.piece.field}:${t.piece.group_key ?? ""}`;
108
+ return /* @__PURE__ */ a("li", { className: "flex items-center gap-2 py-1.5", "data-restore-piece-row": s, children: [
109
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
110
+ /* @__PURE__ */ a("span", { className: "flex items-baseline gap-1.5 text-[12.5px] text-slate-800 dark:text-foreground", children: [
111
+ /* @__PURE__ */ e("span", { className: "truncate font-medium", children: t.label }),
112
+ t.where && /* @__PURE__ */ e("span", { className: "shrink-0 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: t.where })
113
+ ] }),
114
+ /* @__PURE__ */ e(
115
+ "span",
116
+ {
117
+ className: $(
118
+ "block truncate text-[11.5px]",
119
+ t.error ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-muted-foreground"
120
+ ),
121
+ "data-tip": t.error ?? t.summary,
122
+ children: t.error ?? t.summary
123
+ }
124
+ )
125
+ ] }),
126
+ /* @__PURE__ */ e(
127
+ "button",
128
+ {
129
+ type: "button",
130
+ disabled: !!t.error,
131
+ onClick: () => d(t),
132
+ "data-restore-piece-apply": s,
133
+ className: "inline-flex h-7 shrink-0 items-center rounded-md border border-slate-200 px-2 text-[11.5px] font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-40 dark:border-border dark:text-foreground dark:hover:bg-muted",
134
+ children: "Restore"
135
+ }
136
+ )
137
+ ] }, s);
138
+ }) })
139
+ ] });
140
+ }
141
+ export {
142
+ W as RestorePieceButton
143
+ };