@nivaro/react 0.2.54 → 0.2.56

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 (151) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +367 -2
  4. package/dist/index.js +645 -616
  5. package/dist/layout-editor.d.ts +4 -0
  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/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/stale-chunk.js +60 -0
  150. package/dist/shared/lib/worker-socket.js +200 -0
  151. package/package.json +1 -1
@@ -0,0 +1,289 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import { useQuery as k } from "@tanstack/react-query";
3
+ import { ArrowLeft as K, Lock as j } from "lucide-react";
4
+ import { useState as w, useMemo as C } from "react";
5
+ import { useNivaroClient as B } from "../../context.js";
6
+ import { post as E, get as O } from "../../lib/commands.js";
7
+ import { cn as P } from "../../lib/utils.js";
8
+ import { FieldRenderer as D } from "../item-edit/FieldRenderer.js";
9
+ import { Command as G, CommandInput as M, CommandList as Q, CommandEmpty as R, CommandGroup as V, CommandItem as Y } from "../ui/command.js";
10
+ import { Popover as z, PopoverTrigger as H, PopoverContent as I } from "../ui/popover.js";
11
+ import { Skeleton as p } from "../ui/skeleton.js";
12
+ import { bulkFieldSections as J, bulkFieldNote as U } from "./bulk-field-options.js";
13
+ function se({
14
+ collection: d,
15
+ selectedIds: u,
16
+ disabled: h,
17
+ className: v,
18
+ onApply: x,
19
+ onSaveRecipe: m
20
+ }) {
21
+ const [g, a] = w(!1);
22
+ return /* @__PURE__ */ t(
23
+ z,
24
+ {
25
+ open: g,
26
+ onOpenChange: (l) => {
27
+ (!h || !l) && a(l);
28
+ },
29
+ children: [
30
+ /* @__PURE__ */ e(H, { asChild: !0, children: /* @__PURE__ */ e(
31
+ "button",
32
+ {
33
+ type: "button",
34
+ disabled: h,
35
+ "data-bulk-update-field": !0,
36
+ className: v,
37
+ "aria-haspopup": "dialog",
38
+ children: "Update Field"
39
+ }
40
+ ) }),
41
+ /* @__PURE__ */ e(
42
+ I,
43
+ {
44
+ side: "top",
45
+ align: "end",
46
+ sideOffset: 8,
47
+ className: "w-[380px] max-w-[calc(100vw-24px)] p-0",
48
+ onOpenAutoFocus: (l) => l.preventDefault(),
49
+ children: g && /* @__PURE__ */ e(
50
+ W,
51
+ {
52
+ collection: d,
53
+ selectedIds: u,
54
+ onCancel: () => a(!1),
55
+ onApply: (l, f) => {
56
+ a(!1), x(l, f);
57
+ },
58
+ onSaveRecipe: m ? (l, f) => {
59
+ a(!1), m(l, f);
60
+ } : void 0
61
+ }
62
+ )
63
+ }
64
+ )
65
+ ]
66
+ }
67
+ );
68
+ }
69
+ function W({
70
+ collection: d,
71
+ selectedIds: u,
72
+ onCancel: h,
73
+ onApply: v,
74
+ onSaveRecipe: x
75
+ }) {
76
+ var S, T, L;
77
+ const m = B(), g = C(() => u.map(String).join(","), [u]), a = k({
78
+ queryKey: ["bulk-fields", d, g],
79
+ queryFn: () => m.request(
80
+ E(`/items/${d}/bulk-fields`, { ids: u })
81
+ ).then((r) => r.data),
82
+ staleTime: 15e3,
83
+ retry: !1
84
+ }), l = k({
85
+ queryKey: ["bulk-fields-config", d],
86
+ queryFn: () => m.request(O(`/field-config/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
87
+ staleTime: 6e4
88
+ }), f = k({
89
+ queryKey: ["bulk-fields-relations", d],
90
+ queryFn: () => m.request(O(`/data-model/relations/for/${d}`)).then((r) => Array.isArray(r.data) ? r.data : []),
91
+ staleTime: 6e4
92
+ }), F = C(() => {
93
+ const r = {};
94
+ for (const o of l.data ?? []) r[o.field] = o.label;
95
+ return r;
96
+ }, [l.data]), $ = C(
97
+ () => a.data ? J(a.data, F) : [],
98
+ [a.data, F]
99
+ ), [n, A] = w(null), [s, y] = w(null), c = ((S = a.data) == null ? void 0 : S.readable) ?? u.length, b = ((T = a.data) == null ? void 0 : T.forms) ?? [], q = a.data ? b.length === 0 ? "These records have no form, so every field you may change is listed." : b.length === 1 ? `Fields on their form, ${b[0].name}.` : `Fields on their ${b.length} forms, ${b[0].name} first.` : null;
100
+ if (n) {
101
+ const r = (l.data ?? []).find((i) => i.field === n.field), o = U(n, c);
102
+ return /* @__PURE__ */ t("div", { className: "flex flex-col", "data-bulk-field-value": !0, children: [
103
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-2 border-b border-border px-3 py-2.5", children: [
104
+ /* @__PURE__ */ e(
105
+ "button",
106
+ {
107
+ type: "button",
108
+ onClick: () => {
109
+ A(null), y(null);
110
+ },
111
+ "aria-label": "Choose another field",
112
+ "data-tip": "Choose another field",
113
+ className: "rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
114
+ children: /* @__PURE__ */ e(K, { className: "h-3.5 w-3.5" })
115
+ }
116
+ ),
117
+ /* @__PURE__ */ t("div", { className: "min-w-0", children: [
118
+ /* @__PURE__ */ t("p", { className: "truncate text-[13px] font-semibold text-foreground", children: [
119
+ "Set ",
120
+ n.label
121
+ ] }),
122
+ /* @__PURE__ */ t("p", { className: "text-[11.5px] text-muted-foreground", children: [
123
+ "On ",
124
+ n.writable,
125
+ " of ",
126
+ c,
127
+ " record",
128
+ c === 1 ? "" : "s"
129
+ ] })
130
+ ] })
131
+ ] }),
132
+ /* @__PURE__ */ t("div", { className: "space-y-2 px-3 py-3", children: [
133
+ r ? /* @__PURE__ */ e(
134
+ D,
135
+ {
136
+ field: { ...r, readonly: !1 },
137
+ value: s,
138
+ onChange: y,
139
+ relations: f.data ?? [],
140
+ collection: d,
141
+ itemId: "new"
142
+ }
143
+ ) : /* @__PURE__ */ e(
144
+ "input",
145
+ {
146
+ autoFocus: !0,
147
+ value: s == null ? "" : String(s),
148
+ onChange: (i) => y(i.target.value),
149
+ "aria-label": `New ${n.label}`,
150
+ className: "h-9 w-full rounded-md border border-input bg-background px-3 text-[13px] text-foreground focus-visible:border-nvr-cyan focus-visible:outline-none"
151
+ }
152
+ ),
153
+ /* @__PURE__ */ e("p", { className: "text-[11.5px] leading-4 text-muted-foreground", children: s == null || s === "" ? `Leave it empty to clear ${n.label} on every record.` : "Records that already hold this value are left as they are." }),
154
+ o && /* @__PURE__ */ t(
155
+ "p",
156
+ {
157
+ className: "text-[11.5px] leading-4 text-amber-700 dark:text-amber-300",
158
+ "data-bulk-field-note": !0,
159
+ children: [
160
+ o.charAt(0).toUpperCase() + o.slice(1),
161
+ ". Those records are skipped."
162
+ ]
163
+ }
164
+ )
165
+ ] }),
166
+ /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 border-t border-border px-3 py-2", children: [
167
+ x && /* @__PURE__ */ e(
168
+ "button",
169
+ {
170
+ type: "button",
171
+ onClick: () => x(n.field, s),
172
+ "data-tip": "Save this update as a reusable recipe",
173
+ className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
174
+ children: "Save recipe"
175
+ }
176
+ ),
177
+ /* @__PURE__ */ e("span", { className: "flex-1" }),
178
+ /* @__PURE__ */ e(
179
+ "button",
180
+ {
181
+ type: "button",
182
+ onClick: h,
183
+ className: "h-8 rounded-md px-2.5 text-[12.5px] text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
184
+ children: "Cancel"
185
+ }
186
+ ),
187
+ /* @__PURE__ */ t(
188
+ "button",
189
+ {
190
+ type: "button",
191
+ disabled: n.writable === 0,
192
+ onClick: () => v(n.field, s),
193
+ "data-bulk-field-apply": !0,
194
+ className: "h-8 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white transition-colors hover:bg-nvr-cyan/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan focus-visible:ring-offset-2 disabled:opacity-40",
195
+ children: [
196
+ "Apply to ",
197
+ n.writable
198
+ ]
199
+ }
200
+ )
201
+ ] })
202
+ ] });
203
+ }
204
+ return /* @__PURE__ */ t("div", { className: "flex flex-col", "data-bulk-field-picker": !0, children: [
205
+ /* @__PURE__ */ t("div", { className: "border-b border-border px-3 py-2.5", children: [
206
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-foreground", children: [
207
+ "Update a field on ",
208
+ c,
209
+ " record",
210
+ c === 1 ? "" : "s"
211
+ ] }),
212
+ q ? /* @__PURE__ */ e("p", { className: "text-[11.5px] text-muted-foreground", children: q }) : /* @__PURE__ */ e(p, { className: "mt-1 h-3 w-48" })
213
+ ] }),
214
+ a.isLoading ? /* @__PURE__ */ t("div", { className: "space-y-2 p-3", "aria-busy": "true", children: [
215
+ /* @__PURE__ */ e(p, { className: "h-3 w-20" }),
216
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" }),
217
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" }),
218
+ /* @__PURE__ */ e(p, { className: "h-3 w-24" }),
219
+ /* @__PURE__ */ e(p, { className: "h-7 w-full" })
220
+ ] }) : a.isError ? /* @__PURE__ */ t("div", { className: "space-y-2 px-3 py-4 text-[12.5px] text-muted-foreground", children: [
221
+ /* @__PURE__ */ e("p", { children: "Could not read these records’ forms." }),
222
+ /* @__PURE__ */ e(
223
+ "button",
224
+ {
225
+ type: "button",
226
+ onClick: () => void a.refetch(),
227
+ className: "h-7 rounded-md border border-border px-2.5 text-[12px] font-medium text-foreground hover:bg-muted",
228
+ children: "Try again"
229
+ }
230
+ )
231
+ ] }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-5 text-[12.5px] leading-5 text-muted-foreground", children: c === 0 ? "You cannot open any of the selected records." : "Their form has no field you can change in bulk. Open a record to edit it there." }) : /* @__PURE__ */ t(G, { className: "rounded-none bg-transparent", children: [
232
+ /* @__PURE__ */ e(M, { placeholder: "Find a field…", className: "h-9 text-[13px]" }),
233
+ /* @__PURE__ */ t(Q, { className: "max-h-[320px]", children: [
234
+ /* @__PURE__ */ e(R, { className: "py-5 text-center text-[12.5px] text-muted-foreground", children: "No field on the form matches." }),
235
+ $.map((r) => /* @__PURE__ */ e(V, { heading: r.label, children: r.options.map((o) => {
236
+ const i = o.writable === 0, N = U(o, c);
237
+ return /* @__PURE__ */ t(
238
+ Y,
239
+ {
240
+ value: `${r.label} ${o.label} ${o.field}`,
241
+ disabled: i,
242
+ onSelect: () => {
243
+ A(o), y(null);
244
+ },
245
+ "data-bulk-field-option": o.field,
246
+ className: "items-start py-1.5 text-[13px] data-[disabled=true]:opacity-100",
247
+ children: [
248
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: [
249
+ /* @__PURE__ */ e(
250
+ "span",
251
+ {
252
+ className: P(
253
+ "block truncate",
254
+ i ? "text-muted-foreground" : "text-foreground"
255
+ ),
256
+ children: o.label
257
+ }
258
+ ),
259
+ N && /* @__PURE__ */ e(
260
+ "span",
261
+ {
262
+ className: P(
263
+ "block truncate text-[11px] leading-4",
264
+ i ? "text-muted-foreground" : "text-amber-700 dark:text-amber-300"
265
+ ),
266
+ children: N.charAt(0).toUpperCase() + N.slice(1)
267
+ }
268
+ )
269
+ ] }),
270
+ i && /* @__PURE__ */ e(
271
+ j,
272
+ {
273
+ className: "mt-0.5 h-3.5 w-3.5 text-muted-foreground",
274
+ "aria-label": "Locked"
275
+ }
276
+ )
277
+ ]
278
+ },
279
+ o.field
280
+ );
281
+ }) }, r.key))
282
+ ] })
283
+ ] }),
284
+ ((L = a.data) == null ? void 0 : L.capped) && /* @__PURE__ */ e("p", { className: "border-t border-border px-3 py-1.5 text-[11px] text-muted-foreground", children: "Checked the first 1,000 selected records." })
285
+ ] });
286
+ }
287
+ export {
288
+ se as BulkFieldUpdate
289
+ };
@@ -0,0 +1,45 @@
1
+ import { formSections as i, mergeFormSections as a } from "../../lib/form-sections.js";
2
+ import { titleCase as d } from "../../lib/utils.js";
3
+ function u(e, f = {}) {
4
+ const t = e.forms.map(
5
+ (r) => i(r.groups, r.placements, { ungroupedSort: r.ungrouped_sort })
6
+ );
7
+ if (e.no_form > 0) {
8
+ const r = new Set(t.flat().flatMap((o) => o.fields.map((l) => l.field))), n = Object.keys(e.fields).filter((o) => !r.has(o)).sort((o, l) => (f[o] || o).localeCompare(f[l] || l));
9
+ n.length && t.push([
10
+ {
11
+ key: "__no_form__",
12
+ label: e.forms.length ? "Other fields" : "Fields",
13
+ fields: n.map((o) => ({ field: o, label: null }))
14
+ }
15
+ ]);
16
+ }
17
+ const s = [];
18
+ for (const r of a(t)) {
19
+ const n = r.fields.flatMap((o) => {
20
+ const l = e.fields[o.field];
21
+ return l ? [
22
+ {
23
+ field: o.field,
24
+ label: o.label || f[o.field] || d(o.field),
25
+ writable: Math.max(0, l.records - l.locked),
26
+ offForm: Math.max(0, e.readable - l.records),
27
+ locked: l.locked,
28
+ reason: l.reason
29
+ }
30
+ ] : [];
31
+ });
32
+ n.length && s.push({ key: r.key, label: r.label, options: n });
33
+ }
34
+ return s;
35
+ }
36
+ function p(e, f) {
37
+ const t = [];
38
+ return e.locked > 0 && t.push(
39
+ e.writable === 0 && e.offForm === 0 ? e.reason ?? "Locked" : `locked on ${e.locked}`
40
+ ), e.offForm > 0 && t.push(`not on the form of ${e.offForm}`), t.length === 0 ? null : e.writable === 0 && e.offForm === 0 ? t[0] : `${e.writable} of ${f} — ${t.join(", ")}`;
41
+ }
42
+ export {
43
+ p as bulkFieldNote,
44
+ u as bulkFieldSections
45
+ };
@@ -0,0 +1,176 @@
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
+ import { useQuery as g } from "@tanstack/react-query";
3
+ import { useState as b, useMemo as u, useEffect as y } from "react";
4
+ import { useNivaroClient as k } from "../../context.js";
5
+ import { get as v } from "../../lib/commands.js";
6
+ import { cn as N } from "../../lib/utils.js";
7
+ import { Skeleton as h } from "../ui/skeleton.js";
8
+ import { RechartsGate as w } from "./RechartsGate.js";
9
+ const f = ["#6366f1", "#0ea5e9", "#8b5cf6", "#f59e0b", "#ec4899", "#64748b", "#f97316"], p = ["#8fa6c9", "#9a93c4", "#c4a78a", "#b58f9a", "#a3a8b8", "#c9b27f", "#8fb0a3"], A = "#15803d", C = "#9fbf8a";
10
+ function _() {
11
+ const a = () => typeof document < "u" && document.documentElement.classList.contains("dark"), [n, s] = b(a);
12
+ return y(() => {
13
+ if (typeof document > "u") return;
14
+ const o = new MutationObserver(() => s(a()));
15
+ return o.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => o.disconnect();
16
+ }, []), n;
17
+ }
18
+ function x(a, n, s) {
19
+ return a.is_terminal ? s ? C : A : s ? p[n % p.length] : a.color && /^#[0-9a-f]{3,8}$/i.test(a.color) ? a.color : f[n % f.length];
20
+ }
21
+ function S({
22
+ flow: a,
23
+ height: n = 260,
24
+ compact: s = !1
25
+ }) {
26
+ const o = _(), i = u(
27
+ () => [...a.states].sort(
28
+ (e, t) => e.is_terminal === t.is_terminal ? t.sort - e.sort : e.is_terminal ? -1 : 1
29
+ ),
30
+ [a.states]
31
+ ), m = u(() => a.days.map((e) => ({ day: e.day, ...e.counts })), [a.days]);
32
+ if (a.days.length === 0 || a.days.every((e) => e.total === 0))
33
+ return /* @__PURE__ */ r(
34
+ "p",
35
+ {
36
+ className: "py-6 text-center text-[12px] text-slate-500 dark:text-muted-foreground",
37
+ style: { minHeight: n / 2 },
38
+ children: "No records moved through this pipeline in the range."
39
+ }
40
+ );
41
+ const l = o ? "#94a3b8" : "#64748b";
42
+ return /* @__PURE__ */ d("div", { "data-nvr-cfd": !0, children: [
43
+ /* @__PURE__ */ r("div", { style: { height: n }, role: "img", "aria-label": "Cumulative flow diagram", children: /* @__PURE__ */ r(w, { fallback: /* @__PURE__ */ r(h, { className: "h-full w-full", "aria-busy": "true" }), children: (e) => /* @__PURE__ */ r(e.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ d(e.AreaChart, { data: m, margin: { top: 6, right: 8, left: 0, bottom: 0 }, children: [
44
+ /* @__PURE__ */ r(
45
+ e.CartesianGrid,
46
+ {
47
+ strokeDasharray: "3 3",
48
+ stroke: o ? "#334155" : "#e2e8f0",
49
+ vertical: !1
50
+ }
51
+ ),
52
+ /* @__PURE__ */ r(
53
+ e.XAxis,
54
+ {
55
+ dataKey: "day",
56
+ tick: { fontSize: 10, fill: l },
57
+ tickFormatter: (t) => t.slice(5),
58
+ minTickGap: 28,
59
+ stroke: l
60
+ }
61
+ ),
62
+ /* @__PURE__ */ r(
63
+ e.YAxis,
64
+ {
65
+ tick: { fontSize: 10, fill: l },
66
+ tickFormatter: (t) => F.format(t),
67
+ width: 40,
68
+ stroke: l
69
+ }
70
+ ),
71
+ /* @__PURE__ */ r(
72
+ e.Tooltip,
73
+ {
74
+ contentStyle: {
75
+ fontSize: 11,
76
+ borderRadius: 6,
77
+ background: o ? "#0f172a" : "#ffffff",
78
+ border: `1px solid ${o ? "#334155" : "#e2e8f0"}`
79
+ },
80
+ itemSorter: (t) => -t.value
81
+ }
82
+ ),
83
+ i.map((t) => {
84
+ const c = x(t, a.states.indexOf(t), o);
85
+ return /* @__PURE__ */ r(
86
+ e.Area,
87
+ {
88
+ type: "monotone",
89
+ dataKey: t.id,
90
+ name: t.label,
91
+ stackId: "cfd",
92
+ stroke: c,
93
+ fill: c,
94
+ fillOpacity: o ? 0.55 : 0.6,
95
+ isAnimationActive: !1
96
+ },
97
+ t.id
98
+ );
99
+ })
100
+ ] }) }) }) }),
101
+ !s && /* @__PURE__ */ r("ul", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1", children: [...a.states].sort((e, t) => e.sort - t.sort).map((e) => /* @__PURE__ */ d(
102
+ "li",
103
+ {
104
+ className: "flex items-center gap-1.5 text-[11px] text-slate-600 dark:text-muted-foreground",
105
+ children: [
106
+ /* @__PURE__ */ r(
107
+ "span",
108
+ {
109
+ className: "h-2 w-2 rounded-sm",
110
+ style: { background: x(e, a.states.indexOf(e), o) }
111
+ }
112
+ ),
113
+ e.label
114
+ ]
115
+ },
116
+ e.id
117
+ )) })
118
+ ] });
119
+ }
120
+ const D = [30, 90, 365], F = new Intl.NumberFormat(void 0, { notation: "compact", maximumFractionDigits: 1 });
121
+ function $({ templateId: a }) {
122
+ const n = k(), [s, o] = b(90), { data: i, isLoading: m, isError: l } = g({
123
+ queryKey: ["pipeline-cumulative-flow", a, s],
124
+ queryFn: () => n.request(
125
+ v(`/pipelines/${a}/cumulative-flow`, { days: s })
126
+ ).then((t) => t.data),
127
+ staleTime: 6e4,
128
+ retry: !1
129
+ }), e = i == null ? void 0 : i.summary;
130
+ return /* @__PURE__ */ d("div", { className: "rounded-xl border border-slate-200 bg-white p-6 dark:border-border dark:bg-card", children: [
131
+ /* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-3", children: [
132
+ /* @__PURE__ */ d("div", { children: [
133
+ /* @__PURE__ */ r("h2", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: "Cumulative flow" }),
134
+ /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Records in each state at the end of every day, for the records you can see. A widening band is work piling up there." })
135
+ ] }),
136
+ /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center rounded-lg border border-slate-200 p-0.5 dark:border-border", children: D.map((t) => /* @__PURE__ */ d(
137
+ "button",
138
+ {
139
+ type: "button",
140
+ onClick: () => o(t),
141
+ "aria-pressed": s === t,
142
+ "aria-label": `Last ${t} days`,
143
+ className: N(
144
+ "h-6 rounded-md px-2 text-[11px] font-medium",
145
+ s === t ? "bg-slate-900 text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-500 hover:text-slate-800 dark:text-muted-foreground dark:hover:text-foreground"
146
+ ),
147
+ children: [
148
+ t,
149
+ "d"
150
+ ]
151
+ },
152
+ t
153
+ )) })
154
+ ] }),
155
+ /* @__PURE__ */ d("div", { className: "mt-3", children: [
156
+ m && /* @__PURE__ */ r(h, { className: "h-[260px] w-full", "aria-busy": "true" }),
157
+ l && /* @__PURE__ */ r("p", { className: "py-6 text-center text-[12px] text-amber-700 dark:text-amber-400", children: "Could not load the diagram." }),
158
+ i && /* @__PURE__ */ r(S, { flow: i })
159
+ ] }),
160
+ e && /* @__PURE__ */ r("dl", { className: "mt-3 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border sm:grid-cols-4", children: [
161
+ ["Arrived", e.arrivals],
162
+ ["Finished", e.done],
163
+ ["Average in progress", e.avg_wip],
164
+ ["Lead time", e.lead_time_days == null ? "—" : `${e.lead_time_days} days`]
165
+ ].map(([t, c]) => /* @__PURE__ */ d("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
166
+ /* @__PURE__ */ r("dt", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: t }),
167
+ /* @__PURE__ */ r("dd", { className: "text-[15px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: typeof c == "number" ? c.toLocaleString() : c })
168
+ ] }, String(t))) }),
169
+ (i == null ? void 0 : i.source) === "rollup" && /* @__PURE__ */ r("p", { className: "mt-2 text-[11px] text-slate-500 dark:text-muted-foreground", children: "Long range read from last night's rollup." })
170
+ ] });
171
+ }
172
+ export {
173
+ S as CumulativeFlowChart,
174
+ $ as PipelineCumulativeFlowCard,
175
+ x as bandColor
176
+ };