@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,181 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { Check as p, Lock as f, Asterisk as h, EyeOff as g, PenLine as v } from "lucide-react";
3
+ import { useState as k, useRef as y, useCallback as N } from "react";
4
+ import { cn as u } from "../../../lib/utils.js";
5
+ import { Popover as w, PopoverContent as C, PopoverAnchor as O } from "../../ui/popover.js";
6
+ const T = {
7
+ normal: "text-slate-500 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted",
8
+ readonly: "bg-amber-50 text-amber-800 hover:bg-amber-100 dark:bg-amber-500/15 dark:text-amber-200 dark:hover:bg-amber-500/25",
9
+ required: "bg-rose-50 text-rose-700 hover:bg-rose-100 dark:bg-rose-500/15 dark:text-rose-200 dark:hover:bg-rose-500/25",
10
+ hidden: "bg-slate-100 text-slate-600 hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700"
11
+ };
12
+ function m({ tone: t, className: a }) {
13
+ const n = u("h-3.5 w-3.5 shrink-0", a);
14
+ return t === "readonly" ? /* @__PURE__ */ r(f, { "aria-hidden": !0, className: n }) : t === "required" ? /* @__PURE__ */ r(h, { "aria-hidden": !0, className: n }) : t === "hidden" ? /* @__PURE__ */ r(g, { "aria-hidden": !0, className: n }) : /* @__PURE__ */ r(v, { "aria-hidden": !0, className: u(n, "opacity-60") });
15
+ }
16
+ const z = "sticky top-0 z-20 h-9 border-b border-slate-200 bg-slate-50 px-2 text-left text-[11.5px] font-semibold text-slate-600 dark:border-border dark:bg-card dark:text-muted-foreground", q = u(z, "left-0 z-30 min-w-[220px]"), R = "sticky left-0 z-10 min-w-[220px] max-w-[300px] border-b border-r border-slate-100 bg-white px-3 py-1 text-left align-middle dark:border-border/60 dark:bg-card", $ = "border-b border-slate-100 px-1 py-1 text-center align-middle dark:border-border/60", E = "sticky left-0 z-10 border-b border-slate-200 bg-slate-100 px-3 py-1.5 text-left text-[12px] font-semibold text-slate-700 dark:border-border dark:bg-muted dark:text-foreground";
17
+ function I() {
18
+ const [t, a] = k(null);
19
+ return { open: t, setOpen: a };
20
+ }
21
+ function L({
22
+ cellKey: t,
23
+ tone: a,
24
+ word: n,
25
+ tip: c,
26
+ conflict: i,
27
+ locked: o,
28
+ label: d,
29
+ menu: x
30
+ }) {
31
+ const e = x.open === t, l = /* @__PURE__ */ s(
32
+ "button",
33
+ {
34
+ type: "button",
35
+ "data-matrix-cell": t,
36
+ "data-tone": a,
37
+ "aria-label": d,
38
+ "aria-haspopup": o ? void 0 : "dialog",
39
+ "aria-expanded": o ? void 0 : e,
40
+ "aria-disabled": o ? !0 : void 0,
41
+ "data-tip": o ?? c,
42
+ onClick: () => {
43
+ o || x.setOpen(e ? null : t);
44
+ },
45
+ className: u(
46
+ "relative inline-flex h-7 w-full min-w-[96px] items-center justify-center gap-1 rounded-md px-2 text-[12px] font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan",
47
+ T[a],
48
+ o && "cursor-not-allowed opacity-55",
49
+ e && "outline outline-2 outline-nvr-cyan"
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ r(m, { tone: a }),
53
+ /* @__PURE__ */ r("span", { className: "truncate", children: n }),
54
+ i && /* @__PURE__ */ r(
55
+ "span",
56
+ {
57
+ "data-matrix-conflict": "",
58
+ className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500",
59
+ children: /* @__PURE__ */ r("span", { className: "sr-only", children: i })
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ return e ? /* @__PURE__ */ r(O, { asChild: !0, children: l }) : l;
66
+ }
67
+ function B({
68
+ menu: t,
69
+ title: a,
70
+ choices: n,
71
+ current: c,
72
+ onPick: i,
73
+ children: o
74
+ }) {
75
+ const d = y(null);
76
+ t.open && (d.current = t.open);
77
+ const x = N(() => t.setOpen(null), [t]);
78
+ return /* @__PURE__ */ s(w, { open: t.open != null, onOpenChange: (e) => !e && x(), children: [
79
+ o,
80
+ /* @__PURE__ */ s(
81
+ C,
82
+ {
83
+ align: "center",
84
+ className: "w-[280px] p-1.5",
85
+ "data-matrix-menu": "",
86
+ onCloseAutoFocus: (e) => {
87
+ e.preventDefault();
88
+ const l = d.current;
89
+ if (l) {
90
+ for (const b of document.querySelectorAll("[data-matrix-cell]"))
91
+ if (b.dataset.matrixCell === l) return b.focus({ preventScroll: !0 });
92
+ }
93
+ },
94
+ children: [
95
+ /* @__PURE__ */ r("p", { className: "px-2 pb-1 pt-0.5 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: a }),
96
+ /* @__PURE__ */ r("div", { role: "listbox", "aria-label": "Set to", className: "flex flex-col", children: n.map((e) => {
97
+ const l = e.value === c;
98
+ return /* @__PURE__ */ s(
99
+ "button",
100
+ {
101
+ type: "button",
102
+ role: "option",
103
+ "aria-selected": l,
104
+ "aria-disabled": e.blocked ? !0 : void 0,
105
+ "data-matrix-choice": e.value,
106
+ "data-tip": e.blocked ?? void 0,
107
+ onClick: () => {
108
+ e.blocked || (i(e.value), x());
109
+ },
110
+ className: u(
111
+ "flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors",
112
+ e.blocked ? "cursor-not-allowed opacity-45" : "hover:bg-muted",
113
+ l && "bg-accent"
114
+ ),
115
+ children: [
116
+ /* @__PURE__ */ r(m, { tone: e.tone, className: "mt-0.5" }),
117
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
118
+ /* @__PURE__ */ r("span", { className: "block text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.label }),
119
+ /* @__PURE__ */ r("span", { className: "block text-[11.5px] leading-snug text-slate-500 dark:text-muted-foreground", children: e.blocked ?? e.effect })
120
+ ] }),
121
+ l && /* @__PURE__ */ r(p, { "aria-hidden": !0, className: "mt-0.5 h-3.5 w-3.5 text-nvr-cyan" })
122
+ ]
123
+ },
124
+ e.value
125
+ );
126
+ }) })
127
+ ]
128
+ }
129
+ )
130
+ ] });
131
+ }
132
+ function D({
133
+ kind: t,
134
+ parentName: a,
135
+ action: n,
136
+ actionLabel: c,
137
+ actionTip: i,
138
+ blocked: o = !1,
139
+ onAction: d
140
+ }) {
141
+ return /* @__PURE__ */ s("span", { className: "mt-0.5 flex items-center gap-1.5", "data-inherit": t, children: [
142
+ /* @__PURE__ */ r(
143
+ "span",
144
+ {
145
+ "data-tip": t === "inherited" ? `Comes from ${a}` : `Changed on this form; ${a} has its own`,
146
+ className: "inline-flex items-center rounded bg-slate-100 px-1 text-[11px] text-slate-600 dark:bg-slate-800 dark:text-slate-300",
147
+ children: t === "inherited" ? `from ${a}` : "overrides parent"
148
+ }
149
+ ),
150
+ /* @__PURE__ */ r(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ "data-inherit-action": n,
155
+ "aria-label": c,
156
+ "data-tip": i,
157
+ "aria-disabled": o ? !0 : void 0,
158
+ onClick: () => {
159
+ o || d();
160
+ },
161
+ className: u(
162
+ "text-[11px] font-medium text-slate-500 underline-offset-2 dark:text-muted-foreground",
163
+ o ? "cursor-not-allowed opacity-50" : "hover:text-slate-900 hover:underline dark:hover:text-foreground"
164
+ ),
165
+ children: n === "reset" ? "Reset" : "Override"
166
+ }
167
+ )
168
+ ] });
169
+ }
170
+ export {
171
+ D as InheritChip,
172
+ L as MatrixCellButton,
173
+ B as MatrixMenu,
174
+ m as ToneIcon,
175
+ $ as matrixCellTd,
176
+ q as matrixCorner,
177
+ R as matrixRowHead,
178
+ z as matrixTh,
179
+ E as matrixZoneTd,
180
+ I as useCellMenu
181
+ };
@@ -0,0 +1,147 @@
1
+ import { jsxs as g, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as b } from "react";
3
+ import { cn as A, titleCase as L } from "../../../lib/utils.js";
4
+ import { Skeleton as O } from "../../ui/skeleton.js";
5
+ import { fieldZones as R } from "../field-zones.js";
6
+ import { resetGroupPlan as T } from "../inheritance.js";
7
+ import { overrideGroupOps as _ } from "../inspector/model.js";
8
+ import { LoadError as M } from "../load-error.js";
9
+ import { useCellMenu as F, MatrixMenu as I, matrixCorner as P, matrixTh as j, matrixRowHead as B, InheritChip as G, matrixCellTd as K, MatrixCellButton as z } from "./MatrixGrid.js";
10
+ import { useMatrixRoles as D } from "./matrix-api.js";
11
+ import { roleAccess as $, ACCESS_LABEL as w, roleAccessOps as H, roleAccessLabel as U, ROLE_ACCESS as W, ROLE_SECTION_TYPES as Y } from "./role-matrix.js";
12
+ const v = {
13
+ edit: "normal",
14
+ readonly: "readonly",
15
+ hidden: "hidden"
16
+ }, C = {
17
+ edit: "Sees the section; their field permissions decide the rest",
18
+ readonly: "Sees it but cannot change it; the server drops their writes",
19
+ hidden: "Does not see the section at all"
20
+ };
21
+ function Z(r, o) {
22
+ const m = new Set((o == null ? void 0 : o.groups.map((l) => l.key)) ?? []), y = [], u = (l, h) => {
23
+ for (const k of R(l)) {
24
+ if (k.key == null) continue;
25
+ const c = l.groups.find((f) => f.key === k.key);
26
+ if (!c || !Y.has(c.type)) continue;
27
+ const p = h(c);
28
+ p && y.push({ group: c, label: k.label, source: p });
29
+ }
30
+ };
31
+ if (u(r, (l) => m.has(l.key) ? "override" : "own"), o) {
32
+ const l = new Set(r.groups.map((h) => h.key));
33
+ u(o, (h) => l.has(h.key) ? null : "inherited");
34
+ }
35
+ return y;
36
+ }
37
+ function le({ bundle: r, parent: o, apply: m, onSelect: y }) {
38
+ const { data: u = [], isLoading: l, isError: h, refetch: k } = D(), c = F(), p = b(() => Z(r, o), [r, o]), f = String((o == null ? void 0 : o.layout.name) ?? "the parent layout"), x = (e) => e.label || L(e.key), n = b(() => {
39
+ if (!c.open) return null;
40
+ const [e, a] = c.open.split("|"), t = p.find((d) => d.group.key === e && d.source !== "inherited"), s = u.find((d) => d.id === a);
41
+ return t && s ? { row: t, role: s } : null;
42
+ }, [c.open, p, u]), S = W.map((e) => ({
43
+ value: e,
44
+ label: w[e],
45
+ tone: v[e],
46
+ effect: C[e],
47
+ blocked: null
48
+ })), N = (e) => {
49
+ if (!n) return;
50
+ const a = H(n.row.group, n.role.id, e);
51
+ a.length && m(a, { label: U(x(n.row.group), n.role.name, e) });
52
+ };
53
+ return /* @__PURE__ */ g("div", { "data-role-section-matrix": "", className: "flex min-h-full flex-col gap-2 p-4", children: [
54
+ /* @__PURE__ */ i("p", { className: "m-0 text-[12px] text-slate-500 dark:text-muted-foreground", children: "Who sees and edits each section. Field permissions still apply inside a section; administrators always see and edit everything." }),
55
+ l ? /* @__PURE__ */ i(O, { className: "h-48 w-full rounded-lg" }) : h ? /* @__PURE__ */ i(M, { what: "the roles", onRetry: () => void k() }) : /* @__PURE__ */ i(
56
+ I,
57
+ {
58
+ menu: c,
59
+ title: n ? `${x(n.row.group)} · ${n.role.name}` : "",
60
+ choices: S,
61
+ current: n ? $(n.row.group, n.role.id) : null,
62
+ onPick: N,
63
+ children: /* @__PURE__ */ i("div", { className: "min-h-0 flex-1 overflow-auto rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: /* @__PURE__ */ g("table", { className: "border-separate border-spacing-0 text-[12.5px]", children: [
64
+ /* @__PURE__ */ i("thead", { children: /* @__PURE__ */ g("tr", { children: [
65
+ /* @__PURE__ */ i("th", { className: P, children: "Section" }),
66
+ u.map((e) => /* @__PURE__ */ i(
67
+ "th",
68
+ {
69
+ "data-matrix-role": e.id,
70
+ className: A(j, "text-center"),
71
+ "data-tip": e.admin_access ? "Administrators see and edit every section" : void 0,
72
+ children: e.name
73
+ },
74
+ e.id
75
+ ))
76
+ ] }) }),
77
+ /* @__PURE__ */ g("tbody", { children: [
78
+ p.map((e) => {
79
+ const a = x(e.group), t = e.source === "override" && o ? T(r, o, e.group.key) : null;
80
+ return /* @__PURE__ */ g("tr", { "data-matrix-row": e.group.key, children: [
81
+ /* @__PURE__ */ g("th", { scope: "row", className: B, children: [
82
+ /* @__PURE__ */ i(
83
+ "button",
84
+ {
85
+ type: "button",
86
+ onClick: () => y({ kind: "group", key: e.group.key }),
87
+ "data-tip": "Select it on the form",
88
+ className: "block max-w-full truncate text-left font-medium text-slate-800 hover:underline dark:text-foreground",
89
+ children: e.label
90
+ }
91
+ ),
92
+ e.source !== "own" && o && /* @__PURE__ */ i(
93
+ G,
94
+ {
95
+ kind: e.source === "inherited" ? "inherited" : "override",
96
+ parentName: f,
97
+ action: e.source === "inherited" ? "override" : "reset",
98
+ actionLabel: e.source === "inherited" ? `Override ${a} on this form` : `Reset ${a} to ${f}`,
99
+ actionTip: e.source === "inherited" ? "Copy the section onto this form to change it here" : t != null && t.ok ? q(t.ungrouped.length, f) : (t == null ? void 0 : t.why) ?? "",
100
+ blocked: e.source === "override" && !(t != null && t.ok),
101
+ onAction: () => {
102
+ e.source === "inherited" ? m(_(r, o, e.group), {
103
+ label: `Override ${a} on this form`
104
+ }) : t != null && t.ok && m(t.ops, { label: `Reset ${a} to ${f}` });
105
+ }
106
+ }
107
+ )
108
+ ] }),
109
+ u.map((s) => {
110
+ const d = $(e.group, s.id), E = s.admin_access ? "Administrators see and edit every section" : e.source === "inherited" ? `From ${f} — override it to change it here` : null;
111
+ return /* @__PURE__ */ i("td", { className: K, children: /* @__PURE__ */ i(
112
+ z,
113
+ {
114
+ cellKey: `${e.group.key}|${s.id}`,
115
+ tone: s.admin_access ? "normal" : v[d],
116
+ word: s.admin_access ? "Can edit" : w[d],
117
+ tip: `${s.name}: ${C[d].toLowerCase()}`,
118
+ locked: E,
119
+ label: `${a} for ${s.name}: ${w[d]}`,
120
+ menu: c
121
+ }
122
+ ) }, s.id);
123
+ })
124
+ ] }, `${e.source}:${e.group.key}`);
125
+ }),
126
+ p.length === 0 && /* @__PURE__ */ i("tr", { children: /* @__PURE__ */ i(
127
+ "td",
128
+ {
129
+ colSpan: u.length + 1,
130
+ className: "px-3 py-6 text-center text-[12.5px] text-slate-500 dark:text-muted-foreground",
131
+ children: "No sections on this form. Fields outside sections follow field permissions only."
132
+ }
133
+ ) })
134
+ ] })
135
+ ] }) })
136
+ }
137
+ )
138
+ ] });
139
+ }
140
+ function q(r, o) {
141
+ const m = `Take ${o}'s section again`;
142
+ return r ? `${m}; ${r} ${r === 1 ? "field" : "fields"} only this form places move to Ungrouped` : m;
143
+ }
144
+ export {
145
+ le as RoleSectionMatrix,
146
+ Z as sectionRows
147
+ };
@@ -0,0 +1,48 @@
1
+ import { useQueryClient as o, useQuery as u } from "@tanstack/react-query";
2
+ import { useCallback as m } from "react";
3
+ import { useNivaroClient as s } from "../../../context.js";
4
+ import { patch as l, get as c } from "../../../lib/commands.js";
5
+ import { previewKeys as y } from "../preview/preview-api.js";
6
+ const p = {
7
+ roles: () => ["layout-editor", "matrix-roles"]
8
+ };
9
+ function C(t = !0) {
10
+ const r = s();
11
+ return u({
12
+ queryKey: p.roles(),
13
+ queryFn: () => r.request(
14
+ c("/roles")
15
+ ).then(
16
+ (e) => (Array.isArray(e == null ? void 0 : e.data) ? e.data : []).map((i) => ({
17
+ id: String(i.id),
18
+ name: String(i.name ?? i.id),
19
+ admin_access: !!i.admin_access
20
+ }))
21
+ ),
22
+ enabled: t,
23
+ staleTime: 5 * 6e4
24
+ });
25
+ }
26
+ function Q(t) {
27
+ const r = s(), e = o();
28
+ return m(
29
+ async (i, a = "after") => {
30
+ try {
31
+ for (const n of i)
32
+ await r.request(
33
+ l(`/pipelines/transitions/${encodeURIComponent(n.transitionId)}`, {
34
+ requirements: n[a]
35
+ })
36
+ );
37
+ } finally {
38
+ e.invalidateQueries({ queryKey: y.pipelines(t) }), e.invalidateQueries({ queryKey: ["pipeline-detail-lock"] });
39
+ }
40
+ },
41
+ [r, e, t]
42
+ );
43
+ }
44
+ export {
45
+ p as matrixKeys,
46
+ C as useMatrixRoles,
47
+ Q as useSaveRequirements
48
+ };
@@ -0,0 +1,36 @@
1
+ import { asArray as a } from "../inspector/model.js";
2
+ const l = ["edit", "readonly", "hidden"], d = (e, n) => a(e).some((r) => String(r).toUpperCase() === n.toUpperCase()), _ = /* @__PURE__ */ new Set(["section", "metadata", "tab"]);
3
+ function f(e, n) {
4
+ return d(e.hidden_for_roles, n) ? "hidden" : d(e.locked_for_roles, n) ? "readonly" : "edit";
5
+ }
6
+ const i = (e) => e.length ? JSON.stringify(e) : null;
7
+ function s(e, n) {
8
+ return a(e).map(String).filter((r) => r.toUpperCase() !== n.toUpperCase());
9
+ }
10
+ function h(e, n, r) {
11
+ if (f(e, n) === r) return [];
12
+ const t = s(e.hidden_for_roles, n), o = s(e.locked_for_roles, n);
13
+ return r === "hidden" && t.push(n), r === "readonly" && o.push(n), [
14
+ {
15
+ op: "group_update",
16
+ key: e.key,
17
+ patch: { hidden_for_roles: i(t), locked_for_roles: i(o) }
18
+ }
19
+ ];
20
+ }
21
+ const u = {
22
+ edit: "Can edit",
23
+ readonly: "Read-only",
24
+ hidden: "Hidden"
25
+ };
26
+ function p(e, n, r) {
27
+ return r === "hidden" ? `Hide ${e} from ${n}` : r === "readonly" ? `Make ${e} read-only for ${n}` : `Let ${n} edit ${e}`;
28
+ }
29
+ export {
30
+ u as ACCESS_LABEL,
31
+ l as ROLE_ACCESS,
32
+ _ as ROLE_SECTION_TYPES,
33
+ f as roleAccess,
34
+ p as roleAccessLabel,
35
+ h as roleAccessOps
36
+ };
@@ -0,0 +1,145 @@
1
+ import { keyOf as A } from "../field-zones.js";
2
+ import { readOverrides as E, lockConditionsOf as L, withKey as O, lockConditionsColumn as F } from "../inspector/model.js";
3
+ const D = ["normal", "readonly", "required", "hidden"], y = { ok: !0 }, h = (e) => ({ ok: !1, why: e });
4
+ function b(e) {
5
+ const n = E(e);
6
+ return n.hidden === !0 ? "hidden" : n.readonly === !0 ? "readonly" : n.required === !0 ? "required" : "normal";
7
+ }
8
+ function H(e, n) {
9
+ if (b(e) === n) return [];
10
+ let t = E(e);
11
+ for (const r of ["hidden", "readonly", "required"])
12
+ t = O(t ?? {}, r, n === r ? !0 : void 0);
13
+ return [{ op: "update_placement", at: A(e), patch: { overrides: t } }];
14
+ }
15
+ function $(e, n) {
16
+ return L(e).some(
17
+ (t) => t.type === "pipeline_state" && (t.state_keys ?? []).includes(n)
18
+ );
19
+ }
20
+ function j(e, n, t, r) {
21
+ const s = L(e).map((i) => ({ ...i }));
22
+ if (r) {
23
+ if ($(e, t)) return s;
24
+ const i = s.find(
25
+ (o) => o.type === "pipeline_state" && (!o.pipeline_id || o.pipeline_id === n)
26
+ );
27
+ return i ? i.state_keys = [...i.state_keys ?? [], t] : s.push({ type: "pipeline_state", pipeline_id: n, state_keys: [t] }), s;
28
+ }
29
+ return s.flatMap((i) => {
30
+ if (i.type !== "pipeline_state" || !(i.state_keys ?? []).includes(t)) return [i];
31
+ const o = (i.state_keys ?? []).filter((a) => a !== t);
32
+ return o.length ? [{ ...i, state_keys: o }] : [];
33
+ });
34
+ }
35
+ function _(e, n, t, r) {
36
+ return $(e, t) === r ? [] : [
37
+ {
38
+ op: "update_placement",
39
+ at: A(e),
40
+ patch: { lock_conditions: F(j(e, n, t, r)) }
41
+ }
42
+ ];
43
+ }
44
+ const k = (e) => e && e.type === "record_fields" && e.optional !== !0 && Array.isArray(e.fields) ? e.fields.map(String) : [], C = (e, n) => (e.requirements ?? []).some((t) => k(t).includes(n)), S = (e, n) => e.filter((t) => t.from_state != null && String(t.from_state) === n.id), x = (e, n) => e.filter((t) => t.from_state == null && C(t, n));
45
+ function M(e, n, t) {
46
+ return S(e, n).filter((r) => C(r, t));
47
+ }
48
+ const m = {
49
+ normal: "editable",
50
+ hidden: "hidden",
51
+ readonly: "read-only",
52
+ required: "required"
53
+ }, v = (e) => e.map((n) => `"${n.label}"`).join(", ");
54
+ function N(e, n, t) {
55
+ const r = b(e), s = $(e, n.key), i = M(t, n, e.field), o = x(t, e.field), a = S(t, n), u = i.length > 0 || o.length > 0, l = h(
56
+ `${m[r][0].toUpperCase()}${m[r].slice(1)} on every state — change it in Every state`
57
+ ), f = h(
58
+ "A field cannot be hidden in one state only. Hide it in Every state, or put it in a section with a Show when rule."
59
+ );
60
+ if (r === "hidden" || r === "readonly")
61
+ return {
62
+ value: r,
63
+ because: `${m[r][0].toUpperCase()}${m[r].slice(1)} on every state`,
64
+ conflict: null,
65
+ options: {
66
+ normal: l,
67
+ readonly: r === "readonly" ? y : l,
68
+ required: l,
69
+ hidden: r === "hidden" ? y : l
70
+ }
71
+ };
72
+ let c = "normal", d = "Editable in this state";
73
+ s ? (c = "readonly", d = `Read-only in ${n.label} (Read-only when)`) : r === "required" ? (c = "required", d = "Required on every state") : i.length ? (c = "required", d = `Required to leave ${n.label}: ${v(i)} asks for it`) : o.length && (c = "required", d = `Required by ${v(o)}, a move from any state`);
74
+ const p = s && (u || r === "required") ? `Read-only in ${n.label} but required${u ? " to move on" : ""}: nobody can fill it in here` : null, R = r === "required" ? l : o.length ? h(`Required by ${v(o)}, a move from any state — change it in the pipeline`) : y, q = r === "required" || i.length || o.length ? y : a.length === 0 ? h(`No move leaves ${n.label}, so nothing can ask for it here`) : y;
75
+ return {
76
+ value: c,
77
+ because: d,
78
+ conflict: p,
79
+ options: { normal: R, readonly: y, required: q, hidden: f }
80
+ };
81
+ }
82
+ function g(e, n, t, r) {
83
+ const s = [];
84
+ for (const i of S(e, n)) {
85
+ if (i.id == null || C(i, t) === r) continue;
86
+ const o = i.requirements ?? null, a = (o ?? []).map((l) => ({ ...l }));
87
+ let u;
88
+ if (r) {
89
+ const l = a.find(
90
+ (f) => f.type === "record_fields" && f.optional !== !0 && f.optional_when == null
91
+ );
92
+ l ? (l.fields = [...k(l), t], u = a) : u = [...a, { type: "record_fields", fields: [t] }];
93
+ } else
94
+ u = a.flatMap((l) => {
95
+ if (!k(l).includes(t)) return [l];
96
+ const f = k(l).filter((d) => d !== t);
97
+ if (f.length === 0) return [];
98
+ const c = { ...l, fields: f };
99
+ for (const d of ["labels", "copy_to_lines"]) {
100
+ const p = l[d];
101
+ if (p && typeof p == "object" && !Array.isArray(p) && t in p) {
102
+ const { [t]: R, ...q } = p;
103
+ c[d] = q;
104
+ }
105
+ }
106
+ return [c];
107
+ });
108
+ s.push({
109
+ transitionId: String(i.id),
110
+ label: i.label,
111
+ before: o,
112
+ after: u.length ? u : null
113
+ });
114
+ }
115
+ return s;
116
+ }
117
+ function T(e, n, t, r, s) {
118
+ const i = N(e, n, r);
119
+ if (!i.options[s].ok || i.value === s) return null;
120
+ const o = b(e);
121
+ return s === "readonly" ? {
122
+ ops: _(e, t, n.key, !0),
123
+ requirements: g(r, n, e.field, !1)
124
+ } : s === "required" ? {
125
+ ops: _(e, t, n.key, !1),
126
+ requirements: o === "required" ? [] : g(r, n, e.field, !0)
127
+ } : {
128
+ ops: _(e, t, n.key, !1),
129
+ requirements: g(r, n, e.field, !1)
130
+ };
131
+ }
132
+ export {
133
+ D as CELL_KINDS,
134
+ x as anyStateAsks,
135
+ T as cellChange,
136
+ H as everyStateOps,
137
+ b as everyStateValue,
138
+ _ as lockOps,
139
+ $ as lockedIn,
140
+ S as movesFrom,
141
+ M as requiredToLeave,
142
+ g as requirementChanges,
143
+ N as stateCell,
144
+ j as withStateLock
145
+ };
@@ -0,0 +1,109 @@
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
+ import { Search as y, EyeOff as w } from "lucide-react";
3
+ import { useState as x, useRef as p, useMemo as v, useEffect as h } from "react";
4
+ import { cn as N } from "../../../lib/utils.js";
5
+ import { findHits as $, kindWord as D } from "./find.js";
6
+ const A = "h-8 w-full rounded-md border border-slate-200 bg-white pl-7 pr-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground";
7
+ function M({
8
+ nodes: c,
9
+ onPick: u,
10
+ focusSeq: g = 0
11
+ }) {
12
+ const [a, b] = x(""), [o, s] = x(0), i = p(null), f = p(null), n = v(() => $(c, a), [c, a]), m = n.filter((e) => e.node.hidden).length;
13
+ h(() => {
14
+ var e, t;
15
+ (e = i.current) == null || e.focus(), (t = i.current) == null || t.select();
16
+ }, [g]);
17
+ const k = (e) => {
18
+ b(e), s(0);
19
+ };
20
+ return h(() => {
21
+ var e, t, l;
22
+ (l = (t = (e = f.current) == null ? void 0 : e.querySelector(`[data-find-index="${o}"]`)) == null ? void 0 : t.scrollIntoView) == null || l.call(t, { block: "nearest" });
23
+ }, [o]), /* @__PURE__ */ d("div", { "data-editor-find": "", className: "flex flex-col", children: [
24
+ /* @__PURE__ */ d("div", { className: "relative p-2", children: [
25
+ /* @__PURE__ */ r(y, { className: "pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-400" }),
26
+ /* @__PURE__ */ r(
27
+ "input",
28
+ {
29
+ ref: i,
30
+ value: a,
31
+ onChange: (e) => k(e.target.value),
32
+ onKeyDown: (e) => {
33
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
34
+ if (e.preventDefault(), n.length === 0) return;
35
+ const t = e.key === "ArrowDown" ? 1 : -1;
36
+ s((l) => (l + t + n.length) % n.length);
37
+ } else if (e.key === "Enter") {
38
+ e.preventDefault();
39
+ const t = n[o];
40
+ t && u(t);
41
+ }
42
+ },
43
+ placeholder: "Find a field by label or key",
44
+ "aria-label": "Find on the form",
45
+ "aria-controls": "layout-find-results",
46
+ "aria-activedescendant": n[o] ? `layout-find-${o}` : void 0,
47
+ className: A
48
+ }
49
+ )
50
+ ] }),
51
+ a.trim() !== "" && /* @__PURE__ */ r(
52
+ "p",
53
+ {
54
+ role: "status",
55
+ "data-find-count": n.length,
56
+ className: "px-3 pb-1 text-[11.5px] text-slate-500 dark:text-muted-foreground",
57
+ children: n.length === 0 ? "Nothing on this form matches." : `${n.length === 50 ? "50+" : n.length} ${n.length === 1 ? "match" : "matches"}${m > 0 ? ` · ${m} hidden` : ""}`
58
+ }
59
+ ),
60
+ /* @__PURE__ */ r(
61
+ "div",
62
+ {
63
+ ref: f,
64
+ id: "layout-find-results",
65
+ role: "listbox",
66
+ "aria-label": "Matches",
67
+ className: "max-h-[320px] overflow-y-auto overscroll-contain px-1 pb-1",
68
+ children: n.map((e, t) => /* @__PURE__ */ d(
69
+ "button",
70
+ {
71
+ id: `layout-find-${t}`,
72
+ type: "button",
73
+ role: "option",
74
+ "aria-selected": t === o,
75
+ "data-find-index": t,
76
+ "data-find-hit": e.node.id,
77
+ onMouseEnter: () => s(t),
78
+ onClick: () => u(e),
79
+ className: N(
80
+ "flex w-full flex-col items-start rounded-md px-2 py-1.5 text-left",
81
+ t === o ? "bg-accent" : "hover:bg-muted"
82
+ ),
83
+ children: [
84
+ /* @__PURE__ */ d("span", { className: "flex w-full min-w-0 items-center gap-1.5", children: [
85
+ /* @__PURE__ */ r("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: e.node.label }),
86
+ e.node.hidden && /* @__PURE__ */ d("span", { className: "inline-flex shrink-0 items-center gap-0.5 rounded bg-slate-100 px-1 text-[10.5px] font-medium text-slate-600 dark:bg-muted dark:text-muted-foreground", children: [
87
+ /* @__PURE__ */ r(w, { className: "h-2.5 w-2.5" }),
88
+ "Hidden"
89
+ ] }),
90
+ e.node.inherited && /* @__PURE__ */ r("span", { className: "shrink-0 rounded bg-violet-50 px-1 text-[10.5px] font-medium text-violet-700 dark:bg-violet-500/15 dark:text-violet-300", children: "Inherited" })
91
+ ] }),
92
+ /* @__PURE__ */ d("span", { className: "w-full truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: [
93
+ D(e.node),
94
+ e.where && ` · ${e.where}`,
95
+ " · ",
96
+ /* @__PURE__ */ r("span", { className: "font-mono", children: e.node.key })
97
+ ] })
98
+ ]
99
+ },
100
+ e.node.id
101
+ ))
102
+ }
103
+ ),
104
+ /* @__PURE__ */ r("p", { className: "border-t border-slate-100 px-3 py-1.5 text-[11px] leading-snug text-slate-500 dark:border-border dark:text-muted-foreground", children: "Hidden fields, and fields a rule hides, are found too. Picking one turns on Show hidden when the form would not show it." })
105
+ ] });
106
+ }
107
+ export {
108
+ M as FindPanel
109
+ };