@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,16 +1,21 @@
1
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
- import { useQuery as K } from "@tanstack/react-query";
3
- import { X as L } from "lucide-react";
4
- import { useNivaroClient as P } from "../../../context.js";
5
- import { get as q } from "../../../lib/commands.js";
6
- import { cn as F, titleCase as I } from "../../../lib/utils.js";
7
- import { FieldDefaultValueControl as j } from "../editors/field-default-value.js";
8
- import { RoleConditionRow as B, PipelineStateConditionRow as V } from "../editors/lock-conditions.js";
9
- import { tintCard as D } from "../panel-style.js";
10
- import { useFieldCtx as E } from "./field-context.js";
11
- import { Toggle as m, Setting as f, Segmented as G, AddButton as Q, Section as O, TextInput as A, Choice as N } from "./kit.js";
12
- import { lockConditionsOf as W, layoutGrids as H, asObject as X, defaultValuesOf as z, withDefaultValue as J, lockConditionsColumn as U } from "./model.js";
13
- const Y = /* @__PURE__ */ new Set([
1
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import { useQuery as j } from "@tanstack/react-query";
3
+ import { X as B } from "lucide-react";
4
+ import { useNivaroClient as E } from "../../../context.js";
5
+ import { get as W } from "../../../lib/commands.js";
6
+ import { cn as D, titleCase as G } from "../../../lib/utils.js";
7
+ import { FieldRuleWriter as Q } from "../ai-rules/FieldRuleWriter.js";
8
+ import { RuleWriter as H } from "../ai-rules/RuleWriter.js";
9
+ import { ValidationSuggest as X } from "../ai-rules/ValidationSuggest.js";
10
+ import { FieldDefaultValueControl as z } from "../editors/field-default-value.js";
11
+ import { RoleConditionRow as J, PipelineStateConditionRow as U } from "../editors/lock-conditions.js";
12
+ import { useLayoutEditorHost as Y } from "../host.js";
13
+ import { tintCard as Z } from "../panel-style.js";
14
+ import { RecommendedToggle as ee, ConfirmChangeSetting as te, RepeatLastToggle as le } from "./BehaviourSettings.js";
15
+ import { useFieldCtx as ie } from "./field-context.js";
16
+ import { Toggle as g, Setting as f, Segmented as oe, AddButton as ae, Section as R, TextInput as S, Choice as T } from "./kit.js";
17
+ import { lockConditionsOf as ne, layoutGrids as re, asObject as de, defaultValuesOf as se, withDefaultValue as ce, lockConditionsColumn as ue } from "./model.js";
18
+ const L = /* @__PURE__ */ new Set([
14
19
  "inline-table",
15
20
  "inline-grid",
16
21
  "list-o2m",
@@ -20,64 +25,67 @@ const Y = /* @__PURE__ */ new Set([
20
25
  "o2m",
21
26
  "relation-path"
22
27
  ]);
23
- function Z(a, i) {
24
- const d = P();
25
- return K({
28
+ function pe(a, i) {
29
+ const u = E();
30
+ return j({
26
31
  queryKey: ["layout-editor", "field-rows", a, i ?? null],
27
- queryFn: () => d.request(
28
- q(`/field-config/${a}`, i ? { layout_id: i } : void 0)
29
- ).then((s) => Array.isArray(s.data) ? s.data : []),
32
+ queryFn: () => u.request(
33
+ W(`/field-config/${a}`, i ? { layout_id: i } : void 0)
34
+ ).then((m) => Array.isArray(m.data) ? m.data : []),
30
35
  enabled: !!a,
31
36
  staleTime: 6e4
32
37
  });
33
38
  }
34
- function pe() {
35
- const a = E(), { info: i, ov: d, opts: s, env: c, row: y } = a, l = i.label, w = c.bundle.layout, x = y.field.startsWith("__") || i.isPath, h = W(y), b = (e, o) => a.setPlacement({ lock_conditions: U(e) }, o), _ = (e, o, n) => b(
36
- h.map((u, C) => C === e ? { ...u, ...o } : u),
39
+ function Se() {
40
+ const a = ie(), { info: i, ov: u, opts: m, env: s, row: p } = a, o = i.label, y = s.bundle.layout, v = p.field.startsWith("__") || i.isPath, b = ne(p), _ = (e, l) => a.setPlacement({ lock_conditions: ue(e) }, l), w = (e, l, n) => _(
41
+ b.map((d, h) => h === e ? { ...d, ...l } : d),
37
42
  n
38
- ), g = H(c.bundle, a.globals, a.relations), $ = !x && i.relKind !== "M2M" && i.relKind !== "O2M" && !Y.has(i.iface ?? "") && g.length > 0, r = X(d.apply_to_lines), v = g.find((e) => e.field === r.grid) ?? null, { data: R = [] } = Z($ ? v == null ? void 0 : v.childCollection : null), S = R.filter(
43
+ ), x = re(s.bundle, a.globals, a.relations), M = !v && i.relKind !== "M2M" && i.relKind !== "O2M" && !L.has(i.iface ?? "") && x.length > 0, r = de(u.apply_to_lines), $ = x.find((e) => e.field === r.grid) ?? null, { data: K = [] } = pe(M ? $ == null ? void 0 : $.childCollection : null), P = K.filter(
39
44
  (e) => e.field !== "id" && !e.field.startsWith("__") && !e.field.includes(".") && !["alias", "o2m", "m2m"].includes(e.type ?? "")
40
- ), M = (e, o) => a.setOverride("apply_to_lines", e ?? void 0, o), T = z(w), k = typeof s.max_values == "number" ? s.max_values : null;
41
- return /* @__PURE__ */ p("div", { className: "space-y-5", children: [
45
+ ), N = (e, l) => a.setOverride("apply_to_lines", e ?? void 0, l), I = Y().isAdmin && !v && !i.relKind && !L.has(i.iface ?? "") && i.type !== "alias" && i.computedType !== "virtual", q = se(y), A = typeof m.max_values == "number" ? m.max_values : null;
46
+ return /* @__PURE__ */ c("div", { className: "space-y-5", children: [
42
47
  /* @__PURE__ */ t(
43
- m,
48
+ g,
44
49
  {
45
50
  k: "field.required",
46
51
  label: "Required",
47
52
  effect: "The form will not save without a value.",
48
- checked: d.required === !0,
53
+ checked: u.required === !0,
49
54
  onChange: (e) => a.setOverride(
50
55
  "required",
51
56
  e ? !0 : void 0,
52
- e ? `Make ${l} required` : `Make ${l} optional`
57
+ e ? `Make ${o} required` : `Make ${o} optional`
53
58
  )
54
59
  }
55
60
  ),
61
+ /* @__PURE__ */ t(ee, {}),
56
62
  /* @__PURE__ */ t(
57
- m,
63
+ g,
58
64
  {
59
65
  k: "field.readonly",
60
66
  label: "Read-only",
61
67
  effect: "Shown but not editable on this form.",
62
- checked: d.readonly === !0,
68
+ checked: u.readonly === !0,
63
69
  onChange: (e) => a.setOverride(
64
70
  "readonly",
65
71
  e ? !0 : void 0,
66
- e ? `Make ${l} read-only` : `Make ${l} editable`
72
+ e ? `Make ${o} read-only` : `Make ${o} editable`
67
73
  )
68
74
  }
69
75
  ),
76
+ /* @__PURE__ */ t(te, {}),
77
+ /* @__PURE__ */ t(le, {}),
70
78
  (i.computedType === "rollup" || i.computedType === "write") && /* @__PURE__ */ t(
71
- m,
79
+ g,
72
80
  {
73
81
  k: "field.editable_computed",
74
82
  label: "Allow manual entry",
75
83
  effect: "Lets people type over the calculated value here; the next recalculation still overwrites it.",
76
- checked: d.editable_computed === !0,
84
+ checked: u.editable_computed === !0,
77
85
  onChange: (e) => a.setOverride(
78
86
  "editable_computed",
79
87
  e ? !0 : void 0,
80
- e ? `Allow typing into ${l}` : `Keep ${l} calculated only`
88
+ e ? `Allow typing into ${o}` : `Keep ${o} calculated only`
81
89
  )
82
90
  }
83
91
  ),
@@ -87,26 +95,26 @@ function pe() {
87
95
  k: "field.lock_conditions",
88
96
  label: "Read-only when",
89
97
  effect: "Locks the field while any of these holds. No conditions: always editable.",
90
- children: /* @__PURE__ */ p("div", { className: "space-y-2", children: [
91
- h.map((e, o) => /* @__PURE__ */ p(
98
+ children: /* @__PURE__ */ c("div", { className: "space-y-2", children: [
99
+ b.map((e, l) => /* @__PURE__ */ c(
92
100
  "div",
93
101
  {
94
- className: F(D, "space-y-3 p-3"),
102
+ className: D(Z, "space-y-3 p-3"),
95
103
  children: [
96
- /* @__PURE__ */ p("div", { className: "flex items-center gap-1.5", children: [
104
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
97
105
  /* @__PURE__ */ t("div", { className: "flex-1", "data-setting": "field.lock_conditions.type", children: /* @__PURE__ */ t(
98
- G,
106
+ oe,
99
107
  {
100
108
  value: e.type,
101
109
  options: [
102
110
  { value: "pipeline_state", label: "Pipeline state" },
103
111
  { value: "role", label: "Role" }
104
112
  ],
105
- onChange: (n) => b(
106
- h.map(
107
- (u, C) => C === o ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : u
113
+ onChange: (n) => _(
114
+ b.map(
115
+ (d, h) => h === l ? n === "role" ? { type: "role", role_ids: [] } : { type: "pipeline_state", state_keys: [] } : d
108
116
  ),
109
- `Change a lock condition of ${l}`
117
+ `Change a lock condition of ${o}`
110
118
  )
111
119
  }
112
120
  ) }),
@@ -115,82 +123,125 @@ function pe() {
115
123
  {
116
124
  type: "button",
117
125
  "aria-label": "Remove condition",
118
- onClick: () => b(
119
- h.filter((n, u) => u !== o),
120
- `Remove a lock condition from ${l}`
126
+ onClick: () => _(
127
+ b.filter((n, d) => d !== l),
128
+ `Remove a lock condition from ${o}`
121
129
  ),
122
130
  "data-tip": "Remove condition",
123
131
  className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-slate-500 transition-colors hover:bg-slate-100 hover:text-red-600 dark:hover:bg-muted dark:hover:text-red-400",
124
- children: /* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" })
132
+ children: /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" })
125
133
  }
126
134
  )
127
135
  ] }),
128
136
  e.type === "role" ? /* @__PURE__ */ t("div", { "data-setting": "field.lock_conditions.role_ids", children: /* @__PURE__ */ t(
129
- B,
137
+ J,
130
138
  {
131
139
  roleIds: e.role_ids ?? [],
132
- onRoleIdsChange: (n) => _(o, { role_ids: n }, `Change the roles that lock ${l}`)
140
+ onRoleIdsChange: (n) => w(l, { role_ids: n }, `Change the roles that lock ${o}`)
133
141
  }
134
142
  ) }) : /* @__PURE__ */ t(
135
- V,
143
+ U,
136
144
  {
137
- collection: c.collection,
145
+ collection: s.collection,
138
146
  pipelineId: e.pipeline_id,
139
147
  stateKeys: e.state_keys ?? [],
140
- onPipelineChange: (n) => _(
141
- o,
148
+ onPipelineChange: (n) => w(
149
+ l,
142
150
  { pipeline_id: n, state_keys: [] },
143
- `Change the pipeline that locks ${l}`
151
+ `Change the pipeline that locks ${o}`
144
152
  ),
145
- onStateKeysChange: (n) => _(o, { state_keys: n }, `Change the states that lock ${l}`)
153
+ onStateKeysChange: (n) => w(l, { state_keys: n }, `Change the states that lock ${o}`)
146
154
  }
147
155
  )
148
156
  ]
149
157
  },
150
- o
158
+ l
151
159
  )),
152
- /* @__PURE__ */ t(
153
- Q,
154
- {
155
- onClick: () => b(
156
- [...h, { type: "pipeline_state", state_keys: [] }],
157
- `Add a lock condition to ${l}`
158
- ),
159
- children: "+ Add condition"
160
- }
161
- )
160
+ /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-1.5", children: [
161
+ /* @__PURE__ */ t(
162
+ ae,
163
+ {
164
+ onClick: () => _(
165
+ [...b, { type: "pipeline_state", state_keys: [] }],
166
+ `Add a lock condition to ${o}`
167
+ ),
168
+ children: "+ Add condition"
169
+ }
170
+ ),
171
+ !v && /* @__PURE__ */ t(
172
+ H,
173
+ {
174
+ layoutId: Number(y.id),
175
+ target: { kind: "lock", field: p.field },
176
+ bundle: s.bundle,
177
+ apply: (e, l) => s.apply(e, l),
178
+ disabled: a.readOnly
179
+ }
180
+ )
181
+ ] })
162
182
  ] })
163
183
  }
164
184
  ),
165
- !x && i.relKind !== "O2M" && /* @__PURE__ */ t(
185
+ !v && i.relKind !== "O2M" && /* @__PURE__ */ c(
166
186
  f,
167
187
  {
168
188
  k: "field.default_value",
169
189
  label: "Default for new records",
170
190
  effect: "Filled in when someone creates a record on this form.",
171
- children: /* @__PURE__ */ t("div", { onBlurCapture: () => c.flush(), children: /* @__PURE__ */ t(
172
- j,
191
+ children: [
192
+ /* @__PURE__ */ t("div", { onBlurCapture: () => s.flush(), children: /* @__PURE__ */ t(
193
+ z,
194
+ {
195
+ value: q[p.field],
196
+ onChange: (e, l) => s.apply(
197
+ [
198
+ {
199
+ op: "layout_update",
200
+ patch: { default_values: ce(y, p.field, e) }
201
+ }
202
+ ],
203
+ { label: `Change the default of ${o}`, text: l }
204
+ ),
205
+ isM2O: i.relKind === "M2O",
206
+ isM2M: i.relKind === "M2M",
207
+ relatedCollection: i.relatedCollection,
208
+ settings: { options: a.globalOptions, interface: i.iface },
209
+ abstractType: i.type
210
+ }
211
+ ) }),
212
+ /* @__PURE__ */ t("div", { className: "pt-1", children: /* @__PURE__ */ t(
213
+ Q,
214
+ {
215
+ layoutId: Number(y.id),
216
+ field: p.field,
217
+ disabled: a.readOnly
218
+ }
219
+ ) })
220
+ ]
221
+ }
222
+ ),
223
+ I && /* @__PURE__ */ t(
224
+ f,
225
+ {
226
+ k: "field.validation_rules",
227
+ label: "Checks",
228
+ scope: "field",
229
+ effect: "Learned from the values stored today, each with how many existing values it would refuse.",
230
+ children: /* @__PURE__ */ t(
231
+ X,
173
232
  {
174
- value: T[y.field],
175
- onChange: (e, o) => c.apply(
176
- [
177
- {
178
- op: "layout_update",
179
- patch: { default_values: J(w, y.field, e) }
180
- }
181
- ],
182
- { label: `Change the default of ${l}`, text: o }
183
- ),
184
- isM2O: i.relKind === "M2O",
185
- isM2M: i.relKind === "M2M",
186
- relatedCollection: i.relatedCollection,
187
- settings: { options: a.globalOptions, interface: i.iface },
188
- abstractType: i.type
233
+ layoutId: Number(y.id),
234
+ field: p.field,
235
+ disabled: a.readOnly,
236
+ onApply: (e, l, n) => a.proposeGlobal("field.validation_rules", e.length, n, (d) => {
237
+ const h = d.columns.validation_rules, O = Array.isArray(h) ? h : l, F = (k, C) => k.type === C.type && String(k.value ?? "") === String(C.value ?? ""), V = e.filter((k) => !O.some((C) => F(C, k)));
238
+ return { ...d, columns: { ...d.columns, validation_rules: [...O, ...V] } };
239
+ })
189
240
  }
190
- ) })
241
+ )
191
242
  }
192
243
  ),
193
- i.relKind === "M2M" && /* @__PURE__ */ p(O, { title: "How many", children: [
244
+ i.relKind === "M2M" && /* @__PURE__ */ c(R, { title: "How many", children: [
194
245
  /* @__PURE__ */ t(
195
246
  f,
196
247
  {
@@ -198,37 +249,37 @@ function pe() {
198
249
  label: "Most values",
199
250
  effect: "Empty: no limit. 1 makes it a single pick.",
200
251
  children: /* @__PURE__ */ t(
201
- A,
252
+ S,
202
253
  {
203
254
  type: "number",
204
255
  ariaLabel: "Most values",
205
- value: k == null ? "" : String(k),
256
+ value: A == null ? "" : String(A),
206
257
  placeholder: "No limit",
207
258
  onChange: (e) => {
208
- const o = e === "" ? void 0 : Math.max(1, Math.round(Number(e)));
209
- o !== void 0 && Number.isNaN(o) || a.setOption("max_values", o, `Limit how many ${l} can be picked`, !0);
259
+ const l = e === "" ? void 0 : Math.max(1, Math.round(Number(e)));
260
+ l !== void 0 && Number.isNaN(l) || a.setOption("max_values", l, `Limit how many ${o} can be picked`, !0);
210
261
  }
211
262
  }
212
263
  )
213
264
  }
214
265
  ),
215
- k != null && /* @__PURE__ */ t(
216
- m,
266
+ A != null && /* @__PURE__ */ t(
267
+ g,
217
268
  {
218
269
  k: "field.max_values_enforce_on_write",
219
270
  label: "Refuse more on the server too",
220
271
  effect: "Imports, the API and other forms cannot store more than the limit.",
221
272
  enforced: !0,
222
- checked: s.enforce_on_write === !0,
273
+ checked: m.enforce_on_write === !0,
223
274
  onChange: (e) => a.setOption(
224
275
  "enforce_on_write",
225
276
  e ? !0 : void 0,
226
- e ? `Enforce the limit of ${l} on the server` : `Stop enforcing the limit of ${l}`
277
+ e ? `Enforce the limit of ${o} on the server` : `Stop enforcing the limit of ${o}`
227
278
  )
228
279
  }
229
280
  )
230
281
  ] }),
231
- $ && /* @__PURE__ */ p(O, { title: "Apply to lines", children: [
282
+ M && /* @__PURE__ */ c(R, { title: "Apply to lines", children: [
232
283
  /* @__PURE__ */ t("p", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "A button beside the field copies its value into one column of every line of a grid." }),
233
284
  /* @__PURE__ */ t(
234
285
  f,
@@ -237,17 +288,17 @@ function pe() {
237
288
  label: "Grid",
238
289
  effect: "The grid whose lines get the value.",
239
290
  children: /* @__PURE__ */ t(
240
- N,
291
+ T,
241
292
  {
242
293
  ariaLabel: "Grid",
243
294
  value: r.grid ?? "",
244
295
  options: [
245
296
  { value: "", label: "Off" },
246
- ...g.map((e) => ({ value: e.field, label: e.label }))
297
+ ...x.map((e) => ({ value: e.field, label: e.label }))
247
298
  ],
248
- onChange: (e) => M(
299
+ onChange: (e) => N(
249
300
  e ? { grid: e, target: "", ...r.label ? { label: r.label } : {} } : null,
250
- e ? `Copy ${l} into lines` : `Stop copying ${l} into lines`
301
+ e ? `Copy ${o} into lines` : `Stop copying ${o} into lines`
251
302
  )
252
303
  }
253
304
  )
@@ -260,16 +311,16 @@ function pe() {
260
311
  label: "Column",
261
312
  effect: "The column of each line that receives the value.",
262
313
  children: /* @__PURE__ */ t(
263
- N,
314
+ T,
264
315
  {
265
316
  ariaLabel: "Column",
266
317
  disabled: !r.grid,
267
318
  value: r.target ?? "",
268
319
  options: [
269
320
  { value: "", label: r.grid ? "Pick a column…" : "Pick a grid first" },
270
- ...S.map((e) => ({ value: e.field, label: e.label || I(e.field) }))
321
+ ...P.map((e) => ({ value: e.field, label: e.label || G(e.field) }))
271
322
  ],
272
- onChange: (e) => M({ ...r, target: e }, `Copy ${l} into a column`)
323
+ onChange: (e) => N({ ...r, target: e }, `Copy ${o} into a column`)
273
324
  }
274
325
  )
275
326
  }
@@ -281,18 +332,18 @@ function pe() {
281
332
  label: "Button label",
282
333
  effect: "The words on the button.",
283
334
  children: /* @__PURE__ */ t(
284
- A,
335
+ S,
285
336
  {
286
337
  ariaLabel: "Button label",
287
338
  disabled: !r.grid,
288
339
  value: r.label ?? "",
289
340
  placeholder: "Apply to lines",
290
341
  onChange: (e) => {
291
- const { label: o, ...n } = r;
342
+ const { label: l, ...n } = r;
292
343
  a.setOverride(
293
344
  "apply_to_lines",
294
345
  e ? { ...n, label: e } : n,
295
- `Rename the apply-to-lines button of ${l}`,
346
+ `Rename the apply-to-lines button of ${o}`,
296
347
  !0
297
348
  );
298
349
  }
@@ -301,23 +352,23 @@ function pe() {
301
352
  }
302
353
  )
303
354
  ] }),
304
- c.layoutType === "addendum" && /* @__PURE__ */ t(
305
- m,
355
+ s.layoutType === "addendum" && /* @__PURE__ */ t(
356
+ g,
306
357
  {
307
358
  k: "field.prefill_from_parent",
308
359
  label: "Prefill from the record",
309
360
  effect: "A new addendum starts with the record's current value.",
310
- checked: d.prefill_from_parent !== !1,
361
+ checked: u.prefill_from_parent !== !1,
311
362
  onChange: (e) => a.setOverride(
312
363
  "prefill_from_parent",
313
364
  e ? void 0 : !1,
314
- e ? `Prefill ${l} from the record` : `Start ${l} empty on addendums`
365
+ e ? `Prefill ${o} from the record` : `Start ${o} empty on addendums`
315
366
  )
316
367
  }
317
368
  )
318
369
  ] });
319
370
  }
320
371
  export {
321
- pe as RulesTab,
322
- Z as useFieldRows
372
+ Se as RulesTab,
373
+ pe as useFieldRows
323
374
  };
@@ -0,0 +1,156 @@
1
+ import { jsx as s, jsxs as b } from "react/jsx-runtime";
2
+ import { readLayoutI18n as g, approveLayoutText as S, withLayoutText as k } from "../../../lib/layout-i18n.js";
3
+ import { titleCase as E } from "../../../lib/utils.js";
4
+ import { useTranslationSummary as C } from "../inspect/inspect-api.js";
5
+ import { effectText as w } from "../panel-style.js";
6
+ import { useFieldCtx as I } from "./field-context.js";
7
+ import { useInspectorEnv as j, Section as A, Setting as $, TextInput as T } from "./kit.js";
8
+ const l = (n) => n.toUpperCase();
9
+ function W() {
10
+ var N;
11
+ const n = I(), { info: c, ov: a, env: v } = n, { data: i } = C(v.collection), d = (i == null ? void 0 : i.locales) ?? [];
12
+ if (!d.length) return null;
13
+ const r = g(a.i18n), y = typeof a.label == "string" && a.label ? a.label : c.label, t = typeof a.note == "string" && a.note || ((N = c.global) == null ? void 0 : N.note) || "", p = d.reduce(
14
+ (e, o) => {
15
+ var f, m, u, L;
16
+ return e + ((f = r[o]) != null && f.label && !((m = r[o]) != null && m.draft) ? 0 : 1) + (t && !((u = r[o]) != null && u.help && !((L = r[o]) != null && L.draft)) ? 1 : 0);
17
+ },
18
+ 0
19
+ ), h = (e, o) => n.setOverride("i18n", e, o, !0), x = (e, o, f) => h(
20
+ k(g(a.i18n), e, o, f),
21
+ `Translate the ${o === "label" ? "label" : "help text"} of ${c.label} (${l(e)})`
22
+ );
23
+ return /* @__PURE__ */ b(
24
+ A,
25
+ {
26
+ title: p ? `Translations · ${p} missing` : "Translations",
27
+ collapsible: !0,
28
+ defaultOpen: !1,
29
+ children: [
30
+ /* @__PURE__ */ b("p", { className: w, children: [
31
+ "Shown to people reading in that language. Empty uses the text above (",
32
+ l((i == null ? void 0 : i.base) ?? "en"),
33
+ ")."
34
+ ] }),
35
+ d.map((e) => {
36
+ var o, f, m;
37
+ return /* @__PURE__ */ b("div", { "data-translation-locale": e, className: "space-y-3", children: [
38
+ ((o = r[e]) == null ? void 0 : o.draft) && /* @__PURE__ */ s(
39
+ O,
40
+ {
41
+ locale: e,
42
+ onApprove: () => n.setOverride(
43
+ "i18n",
44
+ S(g(a.i18n), e),
45
+ `Approve the ${l(e)} translation of ${c.label}`
46
+ )
47
+ }
48
+ ),
49
+ /* @__PURE__ */ s(
50
+ $,
51
+ {
52
+ k: "field.i18n.label",
53
+ label: `Label (${l(e)})`,
54
+ effect: `What this form calls the field in ${l(e)}.`,
55
+ children: /* @__PURE__ */ s(
56
+ T,
57
+ {
58
+ ariaLabel: `Label in ${l(e)}`,
59
+ value: ((f = r[e]) == null ? void 0 : f.label) ?? "",
60
+ placeholder: y,
61
+ onChange: (u) => x(e, "label", u)
62
+ }
63
+ )
64
+ }
65
+ ),
66
+ /* @__PURE__ */ s(
67
+ $,
68
+ {
69
+ k: "field.i18n.help",
70
+ label: `Help text (${l(e)})`,
71
+ effect: t ? "The line of help under the field." : "Shown only once the field has help.",
72
+ children: /* @__PURE__ */ s(
73
+ T,
74
+ {
75
+ ariaLabel: `Help text in ${l(e)}`,
76
+ value: ((m = r[e]) == null ? void 0 : m.help) ?? "",
77
+ placeholder: t,
78
+ onChange: (u) => x(e, "help", u)
79
+ }
80
+ )
81
+ }
82
+ )
83
+ ] }, e);
84
+ })
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ function q({ group: n }) {
90
+ const c = j(), { data: a } = C(c.collection), v = (a == null ? void 0 : a.locales) ?? [];
91
+ if (!v.length || !["section", "tab", "metadata"].includes(n.type)) return null;
92
+ const i = n.label || E(n.key);
93
+ if (!(a != null && a.groups_supported))
94
+ return /* @__PURE__ */ s("p", { "data-setting": "group.i18n", className: w, children: "Section names can be translated once the database is updated (migration 465)." });
95
+ const d = g(n.i18n), r = (t, p, h = !1) => c.apply(
96
+ [
97
+ {
98
+ op: "group_update",
99
+ key: n.key,
100
+ patch: { i18n: t ? JSON.stringify(t) : null }
101
+ }
102
+ ],
103
+ h ? { label: `Approve the ${l(p)} name of ${i}` } : { label: `Translate the name of ${i} (${l(p)})`, text: !0 }
104
+ ), y = (t, p) => r(k(g(n.i18n), t, "label", p), t);
105
+ return /* @__PURE__ */ s(A, { title: "Translations", collapsible: !0, defaultOpen: !1, children: v.map((t) => {
106
+ var p, h;
107
+ return /* @__PURE__ */ b("div", { className: "space-y-2", children: [
108
+ ((p = d[t]) == null ? void 0 : p.draft) && /* @__PURE__ */ s(O, { locale: t, onApprove: () => r(S(d, t), t, !0) }),
109
+ /* @__PURE__ */ s(
110
+ $,
111
+ {
112
+ k: "group.i18n.label",
113
+ label: `Name (${l(t)})`,
114
+ effect: `The heading people reading in ${l(t)} see. Empty uses the name above.`,
115
+ children: /* @__PURE__ */ s(
116
+ T,
117
+ {
118
+ ariaLabel: `Name in ${l(t)}`,
119
+ value: ((h = d[t]) == null ? void 0 : h.label) ?? "",
120
+ placeholder: i,
121
+ onChange: (x) => y(t, x)
122
+ }
123
+ )
124
+ }
125
+ )
126
+ ] }, t);
127
+ }) });
128
+ }
129
+ function O({ locale: n, onApprove: c }) {
130
+ return /* @__PURE__ */ b(
131
+ "p",
132
+ {
133
+ "data-translation-draft": n,
134
+ className: "flex flex-wrap items-center gap-x-2 text-[12px] leading-snug text-amber-700 dark:text-amber-300",
135
+ children: [
136
+ "Suggested ",
137
+ l(n),
138
+ " text, not shown on records yet.",
139
+ /* @__PURE__ */ s(
140
+ "button",
141
+ {
142
+ type: "button",
143
+ "data-approve-translation": n,
144
+ onClick: c,
145
+ className: "font-medium underline",
146
+ children: "Approve"
147
+ }
148
+ )
149
+ ]
150
+ }
151
+ );
152
+ }
153
+ export {
154
+ W as FieldTranslations,
155
+ q as GroupTranslations
156
+ };