@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,54 @@
1
+ import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
+ import { badgeClasses as m } from "../../../lib/entry-badge-style.js";
3
+ import { cn as o } from "../../../lib/utils.js";
4
+ function u({
5
+ badge: t,
6
+ mode: r,
7
+ auto: s,
8
+ onMode: d
9
+ }) {
10
+ if (!t && !r) return null;
11
+ const n = (e, l, p) => /* @__PURE__ */ a(
12
+ "button",
13
+ {
14
+ type: "button",
15
+ "aria-pressed": r === e,
16
+ "data-tip": p,
17
+ "data-entry-mode": e,
18
+ onClick: () => d(e === s ? null : e),
19
+ className: o(
20
+ "h-6 rounded px-2 text-[11.5px] font-medium transition-colors",
21
+ r === e ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
22
+ ),
23
+ children: l
24
+ }
25
+ );
26
+ return /* @__PURE__ */ i("div", { "data-entry-strip": "", className: "flex flex-wrap items-center justify-between gap-2", children: [
27
+ t ? /* @__PURE__ */ a(
28
+ "span",
29
+ {
30
+ "data-form-badge": "",
31
+ "data-tip": "The form this record is open in",
32
+ className: o(
33
+ "inline-flex h-5 items-center rounded-full px-2 text-[11px] font-medium",
34
+ m(t.color)
35
+ ),
36
+ children: t.tag
37
+ }
38
+ ) : /* @__PURE__ */ a("span", {}),
39
+ r && /* @__PURE__ */ i(
40
+ "fieldset",
41
+ {
42
+ "aria-label": "How to show this form",
43
+ className: "m-0 inline-flex min-w-0 items-center gap-0.5 rounded-md border-0 bg-slate-100 p-0.5 dark:bg-muted",
44
+ children: [
45
+ n("beginner", "Guided steps", "One step at a time, with Next and Back"),
46
+ n("expert", "Tabs", "Every tab open, in any order")
47
+ ]
48
+ }
49
+ )
50
+ ] });
51
+ }
52
+ export {
53
+ u as EntryStrip
54
+ };
@@ -0,0 +1,27 @@
1
+ function s(t, e) {
2
+ if (!(e != null && e.length)) return t;
3
+ const o = new Set(t), n = e.filter((r) => o.has(r)), i = new Set(n);
4
+ return [...n, ...t.filter((r) => !i.has(r))];
5
+ }
6
+ function a(t, e, o) {
7
+ const n = t.indexOf(e);
8
+ return n < 0 ? null : t[n + o] ?? null;
9
+ }
10
+ const u = (t) => t == null || t === "" || Array.isArray(t) && t.length === 0;
11
+ function l(t, e, o) {
12
+ for (const n of t) if (e.has(n) && u(o[n])) return n;
13
+ return null;
14
+ }
15
+ const c = 'input:not([type=hidden]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [role="combobox"]:not([disabled]), [contenteditable="true"], button:not([disabled])';
16
+ function f(t) {
17
+ const e = t.tagName;
18
+ return !!(e === "TEXTAREA" || e === "BUTTON" || e === "A" || e === "SELECT" || t.isContentEditable || t.closest('[role="listbox"], [role="menu"], [role="dialog"][data-state="open"] .cm-editor') || t.getAttribute("aria-expanded") === "true" || t.getAttribute("role") === "combobox" && t.tagName !== "INPUT");
19
+ }
20
+ export {
21
+ c as FOCUSABLE,
22
+ f as enterIsTaken,
23
+ s as entrySequence,
24
+ l as firstEmptyRequired,
25
+ u as isEmptyValue,
26
+ a as stepField
27
+ };
@@ -0,0 +1,70 @@
1
+ import { useRef as _, useEffect as k } from "react";
2
+ import { firstEmptyRequired as F, entrySequence as L, enterIsTaken as R, stepField as q, FOCUSABLE as S } from "./entry-keys.js";
3
+ const O = (o) => Array.from(document.querySelectorAll("[data-field]")).filter(
4
+ (t) => {
5
+ var n;
6
+ return t.getAttribute("data-field-collection") === o && // Fields of a nested form (a record shown inside a field) are not this form's.
7
+ ((n = t.parentElement) == null ? void 0 : n.closest("[data-field]")) == null && t.getClientRects().length > 0;
8
+ }
9
+ ), C = (o) => Array.from(o.querySelectorAll(S)).filter(
10
+ (t) => t.getClientRects().length > 0 && t.tabIndex !== -1
11
+ );
12
+ function v(o, t = !1) {
13
+ var d;
14
+ if (!o) return !1;
15
+ const n = C(o), r = t ? n[n.length - 1] : n[0];
16
+ return r ? (r.focus(), r instanceof HTMLInputElement && r.type === "text" && ((d = r.select) == null || d.call(r)), !0) : !1;
17
+ }
18
+ function B(o) {
19
+ var E;
20
+ const { collection: t, config: n, enabled: r, ready: d, recordKey: g } = o, m = _(o);
21
+ m.current = o;
22
+ const b = _(null);
23
+ k(() => {
24
+ if (!r || !d || !n.focus_first || b.current === g) return;
25
+ let y = 0;
26
+ const e = window.setInterval(() => {
27
+ y++;
28
+ const i = m.current, c = O(t);
29
+ if (c.length > 0) {
30
+ window.clearInterval(e), b.current = g;
31
+ const s = document.activeElement;
32
+ if (s && s !== document.body && s.closest("input, textarea, select")) return;
33
+ const f = c.map((p) => p.getAttribute("data-field")), a = F(f, i.required, i.draft);
34
+ a && v(c[f.indexOf(a)]);
35
+ } else y > 12 && window.clearInterval(e);
36
+ }, 150);
37
+ return () => window.clearInterval(e);
38
+ }, [r, d, n.focus_first, g, t]);
39
+ const x = r && (n.enter_next === !0 || !!((E = n.tab_order) != null && E.length));
40
+ k(() => {
41
+ if (!x) return;
42
+ const y = (e) => {
43
+ var w, h;
44
+ if (e.defaultPrevented || e.isComposing) return;
45
+ const i = e.target, c = i == null ? void 0 : i.closest("[data-field]");
46
+ if (!i || !c || c.getAttribute("data-field-collection") !== t || (w = c.parentElement) != null && w.closest("[data-field]")) return;
47
+ const s = m.current.config, f = O(t), a = f.map((l) => l.getAttribute("data-field")), p = L(a, s.tab_order), K = c.getAttribute("data-field");
48
+ if (e.key === "Enter" && s.enter_next) {
49
+ if (e.ctrlKey || e.metaKey) {
50
+ e.preventDefault(), m.current.save();
51
+ return;
52
+ }
53
+ if (e.shiftKey || e.altKey || R(i)) return;
54
+ const l = q(p, K, 1), u = l ? f[a.indexOf(l)] : void 0;
55
+ u && v(u) && e.preventDefault();
56
+ return;
57
+ }
58
+ if (e.key === "Tab" && ((h = s.tab_order) != null && h.length) && !e.ctrlKey && !e.metaKey && !e.altKey) {
59
+ const l = C(c), u = l.indexOf(i);
60
+ if (u >= 0 && (e.shiftKey ? u > 0 : u < l.length - 1)) return;
61
+ const A = q(p, K, e.shiftKey ? -1 : 1), I = A ? f[a.indexOf(A)] : void 0;
62
+ I && v(I, e.shiftKey) && e.preventDefault();
63
+ }
64
+ };
65
+ return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
66
+ }, [x, t]);
67
+ }
68
+ export {
69
+ B as useEntryKeyboard
70
+ };
@@ -0,0 +1,59 @@
1
+ import { useQuery as h } from "@tanstack/react-query";
2
+ import { useState as b, useEffect as k, useCallback as v } from "react";
3
+ import { useNivaroClient as S } from "../../../context.js";
4
+ import { get as q } from "../../../lib/commands.js";
5
+ import { isBeginner as x } from "../../../lib/entry-config.js";
6
+ const I = (t, e) => `nivaro:entry-mode:${t || "anon"}:${e ?? "x"}`;
7
+ function y(t) {
8
+ try {
9
+ const e = localStorage.getItem(t);
10
+ return e === "beginner" || e === "expert" ? e : null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ function w(t, e, a, s) {
16
+ const n = S();
17
+ return h({
18
+ queryKey: ["entry-records-made", t, e, a],
19
+ enabled: s && !!e && !!t,
20
+ staleTime: 5 * 6e4,
21
+ retry: !1,
22
+ queryFn: async () => {
23
+ var c;
24
+ try {
25
+ const o = await n.request(
26
+ q(`/items/${encodeURIComponent(t)}`, {
27
+ limit: a,
28
+ fields: "id",
29
+ filter: JSON.stringify({ user_created: { _eq: e } })
30
+ })
31
+ );
32
+ return ((c = o == null ? void 0 : o.data) == null ? void 0 : c.length) ?? 0;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ });
38
+ }
39
+ function N(t) {
40
+ const { collection: e, layoutId: a, userId: s, config: n, hasTabs: c, enabled: o } = t, l = o && n.adaptive === !0 && c, p = n.adaptive_threshold ?? 3, { data: u } = w(e, s, p, l), r = I(s, a), [g, d] = b(() => y(r));
41
+ k(() => d(y(r)), [r]);
42
+ const m = v(
43
+ (i) => {
44
+ d(i);
45
+ try {
46
+ i ? localStorage.setItem(r, i) : localStorage.removeItem(r);
47
+ } catch {
48
+ }
49
+ },
50
+ [r]
51
+ );
52
+ if (!l || u == null) return { mode: null, switchable: !1, auto: null, set: m };
53
+ const f = x(u, n) ? "beginner" : "expert";
54
+ return { mode: g ?? f, switchable: !0, auto: f, set: m };
55
+ }
56
+ export {
57
+ N as useEntryMode,
58
+ w as useRecordsMade
59
+ };
@@ -0,0 +1,105 @@
1
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
+ import { ChevronUp as b, ChevronDown as v } from "lucide-react";
3
+ import { useId as f } from "react";
4
+ import { foldLabel as p } from "../../lib/form-structure.js";
5
+ import { cn as u, titleCase as N } from "../../lib/utils.js";
6
+ import { Label as g } from "../ui/label.js";
7
+ const G = (t) => ({ ...t, label: "" }), c = (t) => t.label || N(t.field);
8
+ function w(t) {
9
+ let e = t.options;
10
+ if (typeof e == "string")
11
+ try {
12
+ e = JSON.parse(e);
13
+ } catch {
14
+ e = null;
15
+ }
16
+ const r = e == null ? void 0 : e.col_span;
17
+ return typeof r == "number" && [3, 4, 6].includes(r) ? r : 4;
18
+ }
19
+ function L({
20
+ row: t,
21
+ members: e,
22
+ containerWidth: r,
23
+ renderMember: m,
24
+ errors: o
25
+ }) {
26
+ const s = f(), d = e.some((l) => l.required), a = r > 0 && r < 480, x = t.label.trim() || e.map(c).join(" / "), h = e.some((l) => o == null ? void 0 : o[l.field]);
27
+ return /* @__PURE__ */ i(
28
+ "fieldset",
29
+ {
30
+ "aria-labelledby": s,
31
+ "data-row-group": t.key,
32
+ style: { gridColumn: "span 12" },
33
+ className: "min-w-0 space-y-1.5",
34
+ children: [
35
+ /* @__PURE__ */ n("div", { className: "flex min-h-[1.5rem] items-center", children: /* @__PURE__ */ i(g, { id: s, className: u("text-sm font-medium", h && "text-destructive"), children: [
36
+ x,
37
+ d && /* @__PURE__ */ n("span", { className: "ml-0.5 text-destructive", children: "*" })
38
+ ] }) }),
39
+ /* @__PURE__ */ n("div", { className: u("flex gap-3", a ? "flex-col" : "flex-row items-start"), children: e.map((l) => /* @__PURE__ */ i(
40
+ "fieldset",
41
+ {
42
+ "aria-label": c(l),
43
+ "data-row-member": l.field,
44
+ className: "min-w-0",
45
+ style: a ? void 0 : { flex: `${w(l)} 1 0%` },
46
+ children: [
47
+ m(l),
48
+ /* @__PURE__ */ n("p", { className: "mt-1 truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: c(l) })
49
+ ]
50
+ },
51
+ l.field
52
+ )) })
53
+ ]
54
+ }
55
+ );
56
+ }
57
+ function S({
58
+ count: t,
59
+ open: e,
60
+ forcedOpen: r,
61
+ design: m,
62
+ onToggle: o,
63
+ children: s
64
+ }) {
65
+ const d = f();
66
+ if (t === 0) return null;
67
+ if (m)
68
+ return /* @__PURE__ */ i("div", { "data-form-fold": "design", className: "mt-4", children: [
69
+ /* @__PURE__ */ i("div", { className: "mb-3 flex items-center gap-2 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
70
+ /* @__PURE__ */ i("span", { children: [
71
+ "Behind “",
72
+ p(t),
73
+ "” while empty"
74
+ ] }),
75
+ /* @__PURE__ */ n("span", { className: "h-px flex-1 bg-slate-200 dark:bg-border" })
76
+ ] }),
77
+ s
78
+ ] });
79
+ const a = e || r;
80
+ return /* @__PURE__ */ i("div", { "data-form-fold": a ? "open" : "closed", className: "mt-3", children: [
81
+ a && /* @__PURE__ */ n("div", { id: d, className: "nvr-expand-in", children: s }),
82
+ !r && /* @__PURE__ */ i(
83
+ "button",
84
+ {
85
+ type: "button",
86
+ "aria-expanded": a,
87
+ "aria-controls": a ? d : void 0,
88
+ onClick: o,
89
+ className: u(
90
+ "-ml-1.5 inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[12px] font-medium text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 focus-visible:outline focus-visible:outline-2 focus-visible:outline-nvr-cyan dark:text-muted-foreground dark:hover:text-foreground motion-reduce:transition-none",
91
+ a && "mt-3"
92
+ ),
93
+ children: [
94
+ a ? /* @__PURE__ */ n(b, { "aria-hidden": !0, className: "h-3.5 w-3.5" }) : /* @__PURE__ */ n(v, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
95
+ a ? "Show fewer" : p(t)
96
+ ]
97
+ }
98
+ )
99
+ ] });
100
+ }
101
+ export {
102
+ S as FoldArea,
103
+ L as RowGroupCell,
104
+ G as rowMemberField
105
+ };
@@ -0,0 +1,36 @@
1
+ import { lazySectionsOf as y } from "../../lib/layout-resolve.js";
2
+ const r = { groups: /* @__PURE__ */ new Set(), fields: /* @__PURE__ */ new Set() };
3
+ function g(s) {
4
+ let n = s;
5
+ if (typeof n == "string")
6
+ try {
7
+ n = JSON.parse(n);
8
+ } catch {
9
+ return [];
10
+ }
11
+ return Array.isArray(n) ? n.flatMap(
12
+ (t) => typeof t == "string" ? [t] : t && typeof t == "object" && typeof t.field == "string" ? [t.field] : []
13
+ ) : [];
14
+ }
15
+ function S(s, n, t = {}) {
16
+ var a, d;
17
+ if (!s || t.design) return r;
18
+ const f = new Set(
19
+ y((a = s.layout) == null ? void 0 : a.conditions)
20
+ );
21
+ if (f.size === 0) return r;
22
+ const p = !!((d = s.layout) != null && d.accordion_mode), i = /* @__PURE__ */ new Set();
23
+ for (const e of s.groups ?? [])
24
+ !f.has(e.key) || n.has(e.key) || e.type !== "section" && e.type !== "metadata" || (e.is_collapsed || p) && i.add(e.key);
25
+ if (i.size === 0) return r;
26
+ const o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
27
+ for (const e of s.assignments ?? [])
28
+ e.is_visible === !1 || e.is_visible === 0 || (e.group_key && i.has(e.group_key) ? c.add(e.field) : o.add(e.field));
29
+ for (const e of s.groups ?? [])
30
+ if (i.has(e.key)) for (const l of g(e.summary_fields)) o.add(l);
31
+ const u = new Set([...c].filter((e) => !o.has(e)));
32
+ return { groups: i, fields: u };
33
+ }
34
+ export {
35
+ S as deferredSections
36
+ };
@@ -0,0 +1,94 @@
1
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
+ import { useQuery as h } from "@tanstack/react-query";
3
+ import { EyeOff as x } from "lucide-react";
4
+ import { useState as c, useCallback as b, useMemo as m } from "react";
5
+ import { useNivaroClient as y } from "../../context.js";
6
+ import { get as g } from "../../lib/commands.js";
7
+ import { currentViewport as k } from "../../lib/layout-resolve.js";
8
+ import { describeShowWhen as w } from "../layout-editor/show-when.js";
9
+ import { Popover as v, PopoverTrigger as N, PopoverContent as L } from "../ui/popover.js";
10
+ function P(t, r, l) {
11
+ const s = y(), [d, a] = c(!1), o = r == null || r === "" ? null : String(r), [e] = c(k), n = h({
12
+ queryKey: ["layout-why", t, o, e],
13
+ enabled: l.enabled && !!o && (l.eager || d),
14
+ staleTime: 6e4,
15
+ retry: !1,
16
+ queryFn: () => s.request(
17
+ g("/collection-layouts/why", {
18
+ collection: t,
19
+ item: o,
20
+ ...e ? { viewport: e } : {}
21
+ })
22
+ ).then((p) => p.data ?? null)
23
+ }), f = b(() => a(!0), []);
24
+ return { data: n.data ?? null, want: f };
25
+ }
26
+ const O = /^(Locked for your role|Locked while the record is in |Locked by the record’s current state|The ".*" section is locked for your role|Read-only field)/;
27
+ function W(t, r) {
28
+ var s;
29
+ if (!r) return t;
30
+ const l = { ...t };
31
+ for (const [d, a] of Object.entries(t)) {
32
+ if (!O.test(a)) continue;
33
+ const o = ((s = r.locks[d]) == null ? void 0 : s.text) ?? (a === "Read-only field" ? r.record_lock : null);
34
+ o && (l[d] = o);
35
+ }
36
+ return l;
37
+ }
38
+ function B({
39
+ why: t,
40
+ fields: r,
41
+ stepVisible: l
42
+ }) {
43
+ const [s, d] = c(!1), a = m(() => {
44
+ const e = new Map(r.map((n) => [n.field, n.label || n.field]));
45
+ return (n) => e.get(n) ?? n;
46
+ }, [r]), o = m(
47
+ () => (t.hidden ?? []).filter(
48
+ (e) => e.kind !== "step_rule" || !l({ visible_when: JSON.stringify(e.rules ?? []) })
49
+ ).map((e) => {
50
+ const n = e.kind === "step_rule" ? w(e.rules, r) : null;
51
+ return {
52
+ ...e,
53
+ words: e.kind === "step_rule" ? `“${e.section_label ?? e.section}” shows only when ${n ?? "its rule matches"}` : e.text
54
+ };
55
+ }),
56
+ [t.hidden, l, r]
57
+ );
58
+ return o.length ? /* @__PURE__ */ u(v, { open: s, onOpenChange: d, children: [
59
+ /* @__PURE__ */ i(N, { asChild: !0, children: /* @__PURE__ */ u(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ "data-hidden-by-rules": o.length,
64
+ className: "inline-flex items-center gap-1.5 self-start rounded-md border border-slate-200 bg-white px-2 py-1 text-[12px] text-slate-600 transition-colors hover:bg-muted dark:border-border dark:bg-card dark:text-muted-foreground",
65
+ children: [
66
+ /* @__PURE__ */ i(x, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
67
+ o.length,
68
+ " ",
69
+ o.length === 1 ? "field" : "fields",
70
+ " hidden by rules"
71
+ ]
72
+ }
73
+ ) }),
74
+ /* @__PURE__ */ u(L, { align: "start", className: "w-[360px] p-0", children: [
75
+ /* @__PURE__ */ u("div", { className: "border-b border-slate-200 px-3 py-2 text-[12px] text-slate-500 dark:border-border dark:text-muted-foreground", children: [
76
+ "This record opens with the",
77
+ " ",
78
+ /* @__PURE__ */ i("b", { className: "font-medium text-slate-800 dark:text-foreground", children: t.layout.name }),
79
+ " form",
80
+ t.layout.why ? ` because ${t.layout.why}` : "",
81
+ ". Only admins see this list."
82
+ ] }),
83
+ /* @__PURE__ */ i("ul", { className: "max-h-[320px] divide-y divide-slate-100 overflow-y-auto overscroll-contain dark:divide-border", children: o.map((e) => /* @__PURE__ */ u("li", { className: "px-3 py-2 text-[12.5px]", children: [
84
+ /* @__PURE__ */ i("span", { className: "font-medium text-slate-800 dark:text-foreground", children: a(e.field) }),
85
+ /* @__PURE__ */ i("p", { className: "m-0 text-[12px] text-slate-500 dark:text-muted-foreground", children: e.words })
86
+ ] }, `${e.kind}:${e.field}`)) })
87
+ ] })
88
+ ] }) : null;
89
+ }
90
+ export {
91
+ B as HiddenByRulesNote,
92
+ W as refineLockReasons,
93
+ P as useLockWhy
94
+ };
@@ -0,0 +1,26 @@
1
+ import { useRef as f, useEffect as s } from "react";
2
+ import { useNivaroClient as m } from "../../context.js";
3
+ import { post as p } from "../../lib/commands.js";
4
+ function g(u) {
5
+ const l = m(), t = f([]), { placement: e, open: n, search: c, settled: o, count: i } = u;
6
+ s(() => {
7
+ if (!e || !n || !o || i > 0) return;
8
+ const r = c.trim();
9
+ r.length < 2 || t.current.includes(r) || (t.current = [...t.current, r].slice(-6));
10
+ }, [e, n, c, o, i]), s(() => {
11
+ if (n || t.current.length === 0) return;
12
+ const r = t.current;
13
+ t.current = [], e && l.request(
14
+ p("/layout-usage/picker-miss", {
15
+ layout_id: e.layoutId,
16
+ collection: e.collection,
17
+ field: e.field,
18
+ terms: r
19
+ })
20
+ ).catch(() => {
21
+ });
22
+ }, [n]);
23
+ }
24
+ export {
25
+ g as usePickerMissReport
26
+ };
@@ -0,0 +1,196 @@
1
+ import { jsx as s, jsxs as d } from "react/jsx-runtime";
2
+ import { Loader2 as y, Repeat2 as v, Sigma as b } from "lucide-react";
3
+ import { useContext as h, createContext as g, useState as k, useMemo as _ } from "react";
4
+ import { toast as u } from "sonner";
5
+ import { useNivaroClient as w } from "../../context.js";
6
+ import { get as C } from "../../lib/commands.js";
7
+ import { parseExpression as N, readPath as F, evaluateExpression as R } from "../../lib/expression.js";
8
+ import { textRulesOf as $, isRecommended as T, resolvePlacementText as j, counterError as D, confirmChangeApplies as E, isEmptyValue as f, isDisplayFormulaField as S, counterOf as A, displayFormulaOf as c, formatDisplayValue as L, countValue as P, counterState as V } from "../../lib/placement-behaviour.js";
9
+ import { cn as p, formatRelative as B } from "../../lib/utils.js";
10
+ import { useFieldAffordances as O } from "./FieldAffordances.js";
11
+ const q = g(null);
12
+ function I() {
13
+ const e = O(), o = h(q);
14
+ return (e == null ? void 0 : e.placementText) ?? o;
15
+ }
16
+ function ee(e, o) {
17
+ const r = { label: e.label, note: e.note };
18
+ if (!o || !e._overrides) return r;
19
+ const t = j(e._overrides, o);
20
+ return {
21
+ // A hidden label ('') stays hidden: rules change words, not the layout.
22
+ label: t.label !== void 0 && e.label !== "" ? t.label : r.label,
23
+ note: t.note ?? r.note
24
+ };
25
+ }
26
+ function te(e) {
27
+ let o = !1, r = !1;
28
+ for (const t of e) {
29
+ if (!t._overrides) continue;
30
+ for (const l of $(t._overrides))
31
+ l.type === "role" ? o = !0 : r = !0;
32
+ const a = t._overrides.confirm_change;
33
+ if (a && typeof a == "object" && Array.isArray(a.state_keys) && a.state_keys.length && (r = !0), o && r) break;
34
+ }
35
+ return { role: o, state: r };
36
+ }
37
+ const M = (e) => !e.required && T(e._overrides);
38
+ function re(e, o, r, t) {
39
+ return e.filter((a) => M(a) && !a.hidden && !a.readonly && r(a)).filter((a) => f(o[a.field])).map(t);
40
+ }
41
+ function oe(e, o, r) {
42
+ return e.filter((t) => o.has(t.field) && E(t._overrides, r)).map((t) => t.field);
43
+ }
44
+ function ae(e, o, r) {
45
+ return e._overrides ? D(o, e._overrides, r) : null;
46
+ }
47
+ function ne(e) {
48
+ return e.interface === "display-formula" || S(e.field);
49
+ }
50
+ function le() {
51
+ return /* @__PURE__ */ s(
52
+ "span",
53
+ {
54
+ "data-recommended": "",
55
+ role: "img",
56
+ "aria-label": "Recommended",
57
+ "data-tip": "Recommended — fill it in if you can; saving still works without it",
58
+ className: "ml-1 inline-block h-1.5 w-1.5 translate-y-[-1px] rounded-full bg-amber-500 align-middle dark:bg-amber-400"
59
+ }
60
+ );
61
+ }
62
+ function ie({
63
+ collection: e,
64
+ itemId: o,
65
+ field: r,
66
+ label: t,
67
+ onFill: a
68
+ }) {
69
+ const l = w(), [i, m] = k(!1), x = async () => {
70
+ m(!0);
71
+ try {
72
+ const n = await l.request(
73
+ C("/revisions/my-last-value", {
74
+ collection: e,
75
+ field: r,
76
+ ...o && o !== "new" ? { exclude: o } : {}
77
+ })
78
+ );
79
+ if (!n.data) {
80
+ u.info(`Nothing to repeat — you have not filled ${t} on another record yet`);
81
+ return;
82
+ }
83
+ a(n.data.value), u.success(
84
+ `Filled ${t} from your last record${n.data.at ? ` (${B(n.data.at)})` : ""}`
85
+ );
86
+ } catch (n) {
87
+ u.error((n == null ? void 0 : n.message) || "Could not read your last value");
88
+ } finally {
89
+ m(!1);
90
+ }
91
+ };
92
+ return /* @__PURE__ */ d(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ onClick: () => void x(),
97
+ disabled: i,
98
+ "data-repeat-last": r,
99
+ "aria-label": `Repeat the last ${t} you entered`,
100
+ "data-tip": "Fill in what you entered on your previous record",
101
+ className: "inline-flex items-center gap-0.5 rounded px-1 py-0.5 text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground",
102
+ children: [
103
+ i ? /* @__PURE__ */ s(y, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ s(v, { className: "h-3 w-3" }),
104
+ "Repeat last"
105
+ ]
106
+ }
107
+ );
108
+ }
109
+ function se({ value: e, config: o }) {
110
+ const r = P(e, o.unit), t = V(r, o.limit), a = o.unit === "words" ? r === 1 ? "word" : "words" : "characters";
111
+ return /* @__PURE__ */ d(
112
+ "p",
113
+ {
114
+ "data-field-counter": t,
115
+ "aria-live": "polite",
116
+ className: p(
117
+ "text-right text-[11px] tabular-nums",
118
+ t === "over" ? "font-medium text-red-600 dark:text-red-400" : t === "near" ? "text-amber-700 dark:text-amber-300" : "text-slate-500 dark:text-muted-foreground"
119
+ ),
120
+ children: [
121
+ r.toLocaleString(),
122
+ o.limit != null ? ` / ${o.limit.toLocaleString()}` : "",
123
+ " ",
124
+ a,
125
+ t === "over" && " — over the limit"
126
+ ]
127
+ }
128
+ );
129
+ }
130
+ function ue(e) {
131
+ return e._overrides ? A(e._overrides) : null;
132
+ }
133
+ function z(e, o) {
134
+ if (!e.trim()) return { value: null, error: "No formula yet" };
135
+ const r = N(e);
136
+ if (!r.ok) return { value: null, error: r.error };
137
+ if (r.tokens.length && r.tokens.every((a) => f(F(o, a))))
138
+ return { value: null, error: null };
139
+ const t = R(e, o);
140
+ return typeof t == "boolean" ? { value: t ? 1 : 0, error: null } : { value: typeof t == "number" && Number.isFinite(t) ? t : null, error: null };
141
+ }
142
+ function de({
143
+ field: e,
144
+ values: o
145
+ }) {
146
+ const r = _(() => {
147
+ const i = e.options && typeof e.options == "object" ? e.options : null;
148
+ return c(e._overrides) ?? c({ display_formula: i == null ? void 0 : i.display_formula });
149
+ }, [e._overrides, e.options]), t = (r == null ? void 0 : r.expr) ?? "", { value: a, error: l } = z(t, o);
150
+ return /* @__PURE__ */ d(
151
+ "div",
152
+ {
153
+ "data-display-formula": e.field,
154
+ className: "flex h-9 items-center justify-between gap-2 rounded-md border border-slate-200 bg-slate-50 px-3 dark:border-border dark:bg-muted/40",
155
+ children: [
156
+ /* @__PURE__ */ s(
157
+ "span",
158
+ {
159
+ className: p(
160
+ "min-w-0 truncate text-sm tabular-nums",
161
+ l ? "text-[12px] text-amber-700 dark:text-amber-300" : "font-medium text-slate-900 dark:text-foreground"
162
+ ),
163
+ children: l ? t.trim() ? "This formula needs fixing" : "No formula yet" : L(a, r ?? { format: "", currency: null })
164
+ }
165
+ ),
166
+ t.trim() && /* @__PURE__ */ s(
167
+ "span",
168
+ {
169
+ "data-tip": `Calculated on this page: ${t}`,
170
+ "aria-label": `Calculated on this page: ${t}`,
171
+ role: "img",
172
+ className: "shrink-0 text-slate-400 dark:text-muted-foreground",
173
+ children: /* @__PURE__ */ s(b, { className: "h-3.5 w-3.5" })
174
+ }
175
+ )
176
+ ]
177
+ }
178
+ );
179
+ }
180
+ export {
181
+ de as DisplayFormulaValue,
182
+ se as FieldCounter,
183
+ q as PlacementTextContext,
184
+ le as RecommendedMarker,
185
+ ie as RepeatLastButton,
186
+ oe as confirmChangeFields,
187
+ z as evaluateDisplayFormula,
188
+ ue as fieldCounterConfig,
189
+ ae as fieldCounterError,
190
+ M as fieldIsRecommended,
191
+ ne as isDisplayFormulaRow,
192
+ re as missingRecommended,
193
+ te as placementBehaviourNeeds,
194
+ ee as placementFieldText,
195
+ I as usePlacementTextContext
196
+ };