@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,289 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { useQuery as k } from "@tanstack/react-query";
3
+ import { ArrowLeft as K, Lock as j } from "lucide-react";
4
+ import { useState as w, useMemo as C } from "react";
5
+ import { useNivaroClient as B } from "../../context.js";
6
+ import { post as E, get as O } from "../../lib/commands.js";
7
+ import { cn as P } from "../../lib/utils.js";
8
+ import { FieldRenderer as D } from "../item-edit/FieldRenderer.js";
9
+ import { Command as G, CommandInput as M, CommandList as Q, CommandEmpty as R, CommandGroup as V, CommandItem as Y } from "../ui/command.js";
10
+ import { Popover as z, PopoverTrigger as H, PopoverContent as I } from "../ui/popover.js";
11
+ import { Skeleton as p } from "../ui/skeleton.js";
12
+ import { bulkFieldSections as J, bulkFieldNote as U } from "./bulk-field-options.js";
13
+ function se({
14
+ collection: d,
15
+ selectedIds: u,
16
+ disabled: h,
17
+ className: v,
18
+ onApply: x,
19
+ onSaveRecipe: m
20
+ }) {
21
+ const [g, a] = w(!1);
22
+ return /* @__PURE__ */ t(
23
+ z,
24
+ {
25
+ open: g,
26
+ onOpenChange: (l) => {
27
+ (!h || !l) && a(l);
28
+ },
29
+ children: [
30
+ /* @__PURE__ */ e(H, { asChild: !0, children: /* @__PURE__ */ e(
31
+ "button",
32
+ {
33
+ type: "button",
34
+ disabled: h,
35
+ "data-bulk-update-field": !0,
36
+ className: v,
37
+ "aria-haspopup": "dialog",
38
+ children: "Update Field"
39
+ }
40
+ ) }),
41
+ /* @__PURE__ */ e(
42
+ I,
43
+ {
44
+ side: "top",
45
+ align: "end",
46
+ sideOffset: 8,
47
+ className: "w-[380px] max-w-[calc(100vw-24px)] p-0",
48
+ onOpenAutoFocus: (l) => l.preventDefault(),
49
+ children: g && /* @__PURE__ */ e(
50
+ W,
51
+ {
52
+ collection: d,
53
+ selectedIds: u,
54
+ onCancel: () => a(!1),
55
+ onApply: (l, f) => {
56
+ a(!1), x(l, f);
57
+ },
58
+ onSaveRecipe: m ? (l, f) => {
59
+ a(!1), m(l, f);
60
+ } : void 0
61
+ }
62
+ )
63
+ }
64
+ )
65
+ ]
66
+ }
67
+ );
68
+ }
69
+ function W({
70
+ collection: d,
71
+ selectedIds: u,
72
+ onCancel: h,
73
+ onApply: v,
74
+ onSaveRecipe: x
75
+ }) {
76
+ var S, T, L;
77
+ const m = B(), g = C(() => u.map(String).join(","), [u]), a = k({
78
+ queryKey: ["bulk-fields", d, g],
79
+ queryFn: () => m.request(
80
+ E(`/items/${d}/bulk-fields`, { ids: u })
81
+ ).then((r) => r.data),
82
+ staleTime: 15e3,
83
+ retry: !1
84
+ }), l = k({
85
+ queryKey: ["bulk-fields-config", d],
86
+ queryFn: () => m.request(O(`/field-config/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
87
+ staleTime: 6e4
88
+ }), f = k({
89
+ queryKey: ["bulk-fields-relations", d],
90
+ queryFn: () => m.request(O(`/data-model/relations/for/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
91
+ staleTime: 6e4
92
+ }), F = C(() => {
93
+ const r = {};
94
+ for (const o of l.data ?? []) r[o.field] = o.label;
95
+ return r;
96
+ }, [l.data]), $ = C(
97
+ () => a.data ? J(a.data, F) : [],
98
+ [a.data, F]
99
+ ), [n, A] = w(null), [s, y] = w(null), c = ((S = a.data) == null ? void 0 : S.readable) ?? u.length, b = ((T = a.data) == null ? void 0 : T.forms) ?? [], q = a.data ? b.length === 0 ? "These records have no form, so every field you may change is listed." : b.length === 1 ? `Fields on their form, ${b[0].name}.` : `Fields on their ${b.length} forms, ${b[0].name} first.` : null;
100
+ if (n) {
101
+ const r = (l.data ?? []).find((i) => i.field === n.field), o = U(n, c);
102
+ return /* @__PURE__ */ t("div", { className: "flex flex-col", "data-bulk-field-value": !0, children: [
103
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2.5", children: [
104
+ /* @__PURE__ */ e(
105
+ "button",
106
+ {
107
+ type: "button",
108
+ onClick: () => {
109
+ A(null), y(null);
110
+ },
111
+ "aria-label": "Choose another field",
112
+ "data-tip": "Choose another field",
113
+ className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
114
+ children: /* @__PURE__ */ e(K, { className: "h-3.5 w-3.5" })
115
+ }
116
+ ),
117
+ /* @__PURE__ */ t("div", { className: "min-w-0", children: [
118
+ /* @__PURE__ */ t("p", { className: "truncate text-[13px] font-semibold text-foreground", children: [
119
+ "Set ",
120
+ n.label
121
+ ] }),
122
+ /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", children: [
123
+ "On ",
124
+ n.writable,
125
+ " of ",
126
+ c,
127
+ " record",
128
+ c === 1 ? "" : "s"
129
+ ] })
130
+ ] })
131
+ ] }),
132
+ /* @__PURE__ */ t("div", { className: "space-y-2 px-3 py-3", children: [
133
+ r ? /* @__PURE__ */ e(
134
+ D,
135
+ {
136
+ field: { ...r, readonly: !1 },
137
+ value: s,
138
+ onChange: y,
139
+ relations: f.data ?? [],
140
+ collection: d,
141
+ itemId: "new"
142
+ }
143
+ ) : /* @__PURE__ */ e(
144
+ "input",
145
+ {
146
+ autoFocus: !0,
147
+ value: s == null ? "" : String(s),
148
+ onChange: (i) => y(i.target.value),
149
+ "aria-label": `New ${n.label}`,
150
+ className: "h-9 w-full rounded-md border border-input bg-background px-3 text-[13px] text-foreground focus-visible:border-nvr-cyan focus-visible:outline-none"
151
+ }
152
+ ),
153
+ /* @__PURE__ */ e("p", { className: "text-[11.5px] leading-4 text-muted-foreground", children: s == null || s === "" ? `Leave it empty to clear ${n.label} on every record.` : "Records that already hold this value are left as they are." }),
154
+ o && /* @__PURE__ */ t(
155
+ "p",
156
+ {
157
+ className: "text-[11.5px] leading-4 text-amber-700 dark:text-amber-300",
158
+ "data-bulk-field-note": !0,
159
+ children: [
160
+ o.charAt(0).toUpperCase() + o.slice(1),
161
+ ". Those records are skipped."
162
+ ]
163
+ }
164
+ )
165
+ ] }),
166
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 border-t border-border px-3 py-2", children: [
167
+ x && /* @__PURE__ */ e(
168
+ "button",
169
+ {
170
+ type: "button",
171
+ onClick: () => x(n.field, s),
172
+ "data-tip": "Save this update as a reusable recipe",
173
+ className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
174
+ children: "Save recipe"
175
+ }
176
+ ),
177
+ /* @__PURE__ */ e("span", { className: "flex-1" }),
178
+ /* @__PURE__ */ e(
179
+ "button",
180
+ {
181
+ type: "button",
182
+ onClick: h,
183
+ className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
184
+ children: "Cancel"
185
+ }
186
+ ),
187
+ /* @__PURE__ */ t(
188
+ "button",
189
+ {
190
+ type: "button",
191
+ disabled: n.writable === 0,
192
+ onClick: () => v(n.field, s),
193
+ "data-bulk-field-apply": !0,
194
+ className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white transition-colors hover:bg-nvr-cyan/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan focus-visible:ring-offset-2 disabled:opacity-40",
195
+ children: [
196
+ "Apply to ",
197
+ n.writable
198
+ ]
199
+ }
200
+ )
201
+ ] })
202
+ ] });
203
+ }
204
+ return /* @__PURE__ */ t("div", { className: "flex flex-col", "data-bulk-field-picker": !0, children: [
205
+ /* @__PURE__ */ t("div", { className: "border-b border-border px-3 py-2.5", children: [
206
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-foreground", children: [
207
+ "Update a field on ",
208
+ c,
209
+ " record",
210
+ c === 1 ? "" : "s"
211
+ ] }),
212
+ q ? /* @__PURE__ */ e("p", { className: "text-[11.5px] text-muted-foreground", children: q }) : /* @__PURE__ */ e(p, { className: "mt-1 h-3 w-48" })
213
+ ] }),
214
+ a.isLoading ? /* @__PURE__ */ t("div", { className: "space-y-2 p-3", "aria-busy": "true", children: [
215
+ /* @__PURE__ */ e(p, { className: "h-3 w-20" }),
216
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" }),
217
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" }),
218
+ /* @__PURE__ */ e(p, { className: "h-3 w-24" }),
219
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" })
220
+ ] }) : a.isError ? /* @__PURE__ */ t("div", { className: "space-y-2 px-3 py-4 text-[12.5px] text-muted-foreground", children: [
221
+ /* @__PURE__ */ e("p", { children: "Could not read these records’ forms." }),
222
+ /* @__PURE__ */ e(
223
+ "button",
224
+ {
225
+ type: "button",
226
+ onClick: () => void a.refetch(),
227
+ className: "h-7 rounded-md border border-border px-2.5 text-[12px] font-medium text-foreground hover:bg-muted",
228
+ children: "Try again"
229
+ }
230
+ )
231
+ ] }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children: c === 0 ? "You cannot open any of the selected records." : "Their form has no field you can change in bulk. Open a record to edit it there." }) : /* @__PURE__ */ t(G, { className: "rounded-none bg-transparent", children: [
232
+ /* @__PURE__ */ e(M, { placeholder: "Find a field…", className: "h-9 text-[13px]" }),
233
+ /* @__PURE__ */ t(Q, { className: "max-h-[320px]", children: [
234
+ /* @__PURE__ */ e(R, { className: "py-5 text-center text-[12.5px] text-muted-foreground", children: "No field on the form matches." }),
235
+ $.map((r) => /* @__PURE__ */ e(V, { heading: r.label, children: r.options.map((o) => {
236
+ const i = o.writable === 0, N = U(o, c);
237
+ return /* @__PURE__ */ t(
238
+ Y,
239
+ {
240
+ value: `${r.label} ${o.label} ${o.field}`,
241
+ disabled: i,
242
+ onSelect: () => {
243
+ A(o), y(null);
244
+ },
245
+ "data-bulk-field-option": o.field,
246
+ className: "items-start py-1.5 text-[13px] data-[disabled=true]:opacity-100",
247
+ children: [
248
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
249
+ /* @__PURE__ */ e(
250
+ "span",
251
+ {
252
+ className: P(
253
+ "block truncate",
254
+ i ? "text-muted-foreground" : "text-foreground"
255
+ ),
256
+ children: o.label
257
+ }
258
+ ),
259
+ N && /* @__PURE__ */ e(
260
+ "span",
261
+ {
262
+ className: P(
263
+ "block truncate text-[11px] leading-4",
264
+ i ? "text-muted-foreground" : "text-amber-700 dark:text-amber-300"
265
+ ),
266
+ children: N.charAt(0).toUpperCase() + N.slice(1)
267
+ }
268
+ )
269
+ ] }),
270
+ i && /* @__PURE__ */ e(
271
+ j,
272
+ {
273
+ className: "mt-0.5 h-3.5 w-3.5 text-muted-foreground",
274
+ "aria-label": "Locked"
275
+ }
276
+ )
277
+ ]
278
+ },
279
+ o.field
280
+ );
281
+ }) }, r.key))
282
+ ] })
283
+ ] }),
284
+ ((L = a.data) == null ? void 0 : L.capped) && /* @__PURE__ */ e("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checked the first 1,000 selected records." })
285
+ ] });
286
+ }
287
+ export {
288
+ se as BulkFieldUpdate
289
+ };
@@ -0,0 +1,45 @@
1
+ import { formSections as i, mergeFormSections as a } from "../../lib/form-sections.js";
2
+ import { titleCase as d } from "../../lib/utils.js";
3
+ function u(e, f = {}) {
4
+ const t = e.forms.map(
5
+ (r) => i(r.groups, r.placements, { ungroupedSort: r.ungrouped_sort })
6
+ );
7
+ if (e.no_form > 0) {
8
+ const r = new Set(t.flat().flatMap((o) => o.fields.map((l) => l.field))), n = Object.keys(e.fields).filter((o) => !r.has(o)).sort((o, l) => (f[o] || o).localeCompare(f[l] || l));
9
+ n.length && t.push([
10
+ {
11
+ key: "__no_form__",
12
+ label: e.forms.length ? "Other fields" : "Fields",
13
+ fields: n.map((o) => ({ field: o, label: null }))
14
+ }
15
+ ]);
16
+ }
17
+ const s = [];
18
+ for (const r of a(t)) {
19
+ const n = r.fields.flatMap((o) => {
20
+ const l = e.fields[o.field];
21
+ return l ? [
22
+ {
23
+ field: o.field,
24
+ label: o.label || f[o.field] || d(o.field),
25
+ writable: Math.max(0, l.records - l.locked),
26
+ offForm: Math.max(0, e.readable - l.records),
27
+ locked: l.locked,
28
+ reason: l.reason
29
+ }
30
+ ] : [];
31
+ });
32
+ n.length && s.push({ key: r.key, label: r.label, options: n });
33
+ }
34
+ return s;
35
+ }
36
+ function p(e, f) {
37
+ const t = [];
38
+ return e.locked > 0 && t.push(
39
+ e.writable === 0 && e.offForm === 0 ? e.reason ?? "Locked" : `locked on ${e.locked}`
40
+ ), e.offForm > 0 && t.push(`not on the form of ${e.offForm}`), t.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? t[0] : `${e.writable} of ${f} — ${t.join(", ")}`;
41
+ }
42
+ export {
43
+ p as bulkFieldNote,
44
+ u as bulkFieldSections
45
+ };
@@ -0,0 +1,176 @@
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
+ import { useQuery as g } from "@tanstack/react-query";
3
+ import { useState as b, useMemo as u, useEffect as y } from "react";
4
+ import { useNivaroClient as k } from "../../context.js";
5
+ import { get as v } from "../../lib/commands.js";
6
+ import { cn as N } from "../../lib/utils.js";
7
+ import { Skeleton as h } from "../ui/skeleton.js";
8
+ import { RechartsGate as w } from "./RechartsGate.js";
9
+ const f = ["#6366f1", "#0ea5e9", "#8b5cf6", "#f59e0b", "#ec4899", "#64748b", "#f97316"], p = ["#8fa6c9", "#9a93c4", "#c4a78a", "#b58f9a", "#a3a8b8", "#c9b27f", "#8fb0a3"], A = "#15803d", C = "#9fbf8a";
10
+ function _() {
11
+ const a = () => typeof document < "u" && document.documentElement.classList.contains("dark"), [n, s] = b(a);
12
+ return y(() => {
13
+ if (typeof document > "u") return;
14
+ const o = new MutationObserver(() => s(a()));
15
+ return o.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => o.disconnect();
16
+ }, []), n;
17
+ }
18
+ function x(a, n, s) {
19
+ return a.is_terminal ? s ? C : A : s ? p[n % p.length] : a.color && /^#[0-9a-f]{3,8}$/i.test(a.color) ? a.color : f[n % f.length];
20
+ }
21
+ function S({
22
+ flow: a,
23
+ height: n = 260,
24
+ compact: s = !1
25
+ }) {
26
+ const o = _(), i = u(
27
+ () => [...a.states].sort(
28
+ (e, t) => e.is_terminal === t.is_terminal ? t.sort - e.sort : e.is_terminal ? -1 : 1
29
+ ),
30
+ [a.states]
31
+ ), m = u(() => a.days.map((e) => ({ day: e.day, ...e.counts })), [a.days]);
32
+ if (a.days.length === 0 || a.days.every((e) => e.total === 0))
33
+ return /* @__PURE__ */ r(
34
+ "p",
35
+ {
36
+ className: "py-6 text-center text-[12px] text-slate-500 dark:text-muted-foreground",
37
+ style: { minHeight: n / 2 },
38
+ children: "No records moved through this pipeline in the range."
39
+ }
40
+ );
41
+ const l = o ? "#94a3b8" : "#64748b";
42
+ return /* @__PURE__ */ d("div", { "data-nvr-cfd": !0, children: [
43
+ /* @__PURE__ */ r("div", { style: { height: n }, role: "img", "aria-label": "Cumulative flow diagram", children: /* @__PURE__ */ r(w, { fallback: /* @__PURE__ */ r(h, { className: "h-full w-full", "aria-busy": "true" }), children: (e) => /* @__PURE__ */ r(e.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ d(e.AreaChart, { data: m, margin: { top: 6, right: 8, left: 0, bottom: 0 }, children: [
44
+ /* @__PURE__ */ r(
45
+ e.CartesianGrid,
46
+ {
47
+ strokeDasharray: "3 3",
48
+ stroke: o ? "#334155" : "#e2e8f0",
49
+ vertical: !1
50
+ }
51
+ ),
52
+ /* @__PURE__ */ r(
53
+ e.XAxis,
54
+ {
55
+ dataKey: "day",
56
+ tick: { fontSize: 10, fill: l },
57
+ tickFormatter: (t) => t.slice(5),
58
+ minTickGap: 28,
59
+ stroke: l
60
+ }
61
+ ),
62
+ /* @__PURE__ */ r(
63
+ e.YAxis,
64
+ {
65
+ tick: { fontSize: 10, fill: l },
66
+ tickFormatter: (t) => F.format(t),
67
+ width: 40,
68
+ stroke: l
69
+ }
70
+ ),
71
+ /* @__PURE__ */ r(
72
+ e.Tooltip,
73
+ {
74
+ contentStyle: {
75
+ fontSize: 11,
76
+ borderRadius: 6,
77
+ background: o ? "#0f172a" : "#ffffff",
78
+ border: `1px solid ${o ? "#334155" : "#e2e8f0"}`
79
+ },
80
+ itemSorter: (t) => -t.value
81
+ }
82
+ ),
83
+ i.map((t) => {
84
+ const c = x(t, a.states.indexOf(t), o);
85
+ return /* @__PURE__ */ r(
86
+ e.Area,
87
+ {
88
+ type: "monotone",
89
+ dataKey: t.id,
90
+ name: t.label,
91
+ stackId: "cfd",
92
+ stroke: c,
93
+ fill: c,
94
+ fillOpacity: o ? 0.55 : 0.6,
95
+ isAnimationActive: !1
96
+ },
97
+ t.id
98
+ );
99
+ })
100
+ ] }) }) }) }),
101
+ !s && /* @__PURE__ */ r("ul", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1", children: [...a.states].sort((e, t) => e.sort - t.sort).map((e) => /* @__PURE__ */ d(
102
+ "li",
103
+ {
104
+ className: "flex items-center gap-1.5 text-[11px] text-slate-600 dark:text-muted-foreground",
105
+ children: [
106
+ /* @__PURE__ */ r(
107
+ "span",
108
+ {
109
+ className: "h-2 w-2 rounded-sm",
110
+ style: { background: x(e, a.states.indexOf(e), o) }
111
+ }
112
+ ),
113
+ e.label
114
+ ]
115
+ },
116
+ e.id
117
+ )) })
118
+ ] });
119
+ }
120
+ const D = [30, 90, 365], F = new Intl.NumberFormat(void 0, { notation: "compact", maximumFractionDigits: 1 });
121
+ function $({ templateId: a }) {
122
+ const n = k(), [s, o] = b(90), { data: i, isLoading: m, isError: l } = g({
123
+ queryKey: ["pipeline-cumulative-flow", a, s],
124
+ queryFn: () => n.request(
125
+ v(`/pipelines/${a}/cumulative-flow`, { days: s })
126
+ ).then((t) => t.data),
127
+ staleTime: 6e4,
128
+ retry: !1
129
+ }), e = i == null ? void 0 : i.summary;
130
+ return /* @__PURE__ */ d("div", { className: "rounded-xl border border-slate-200 bg-white p-6 dark:border-border dark:bg-card", children: [
131
+ /* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-3", children: [
132
+ /* @__PURE__ */ d("div", { children: [
133
+ /* @__PURE__ */ r("h2", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: "Cumulative flow" }),
134
+ /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Records in each state at the end of every day, for the records you can see. A widening band is work piling up there." })
135
+ ] }),
136
+ /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center rounded-lg border border-slate-200 p-0.5 dark:border-border", children: D.map((t) => /* @__PURE__ */ d(
137
+ "button",
138
+ {
139
+ type: "button",
140
+ onClick: () => o(t),
141
+ "aria-pressed": s === t,
142
+ "aria-label": `Last ${t} days`,
143
+ className: N(
144
+ "h-6 rounded-md px-2 text-[11px] font-medium",
145
+ s === t ? "bg-slate-900 text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
146
+ ),
147
+ children: [
148
+ t,
149
+ "d"
150
+ ]
151
+ },
152
+ t
153
+ )) })
154
+ ] }),
155
+ /* @__PURE__ */ d("div", { className: "mt-3", children: [
156
+ m && /* @__PURE__ */ r(h, { className: "h-[260px] w-full", "aria-busy": "true" }),
157
+ l && /* @__PURE__ */ r("p", { className: "py-6 text-center text-[12px] text-amber-700 dark:text-amber-400", children: "Could not load the diagram." }),
158
+ i && /* @__PURE__ */ r(S, { flow: i })
159
+ ] }),
160
+ e && /* @__PURE__ */ r("dl", { className: "mt-3 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border sm:grid-cols-4", children: [
161
+ ["Arrived", e.arrivals],
162
+ ["Finished", e.done],
163
+ ["Average in progress", e.avg_wip],
164
+ ["Lead time", e.lead_time_days == null ? "—" : `${e.lead_time_days} days`]
165
+ ].map(([t, c]) => /* @__PURE__ */ d("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
166
+ /* @__PURE__ */ r("dt", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: t }),
167
+ /* @__PURE__ */ r("dd", { className: "text-[15px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: typeof c == "number" ? c.toLocaleString() : c })
168
+ ] }, String(t))) }),
169
+ (i == null ? void 0 : i.source) === "rollup" && /* @__PURE__ */ r("p", { className: "mt-2 text-[11px] text-slate-500 dark:text-muted-foreground", children: "Long range read from last night's rollup." })
170
+ ] });
171
+ }
172
+ export {
173
+ S as CumulativeFlowChart,
174
+ $ as PipelineCumulativeFlowCard,
175
+ x as bandColor
176
+ };