@nivaro/react 0.3.114 → 0.3.115
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.
- package/dist/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1717 -21
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4088 -3592
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +1 -0
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +1927 -1635
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { jsxs as l, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { History as C, X as P, Check as $ } from "lucide-react";
|
|
3
|
+
import { useState as p } from "react";
|
|
4
|
+
import { cn as S, formatDateTime as T } from "../../lib/utils.js";
|
|
5
|
+
import { Popover as H, PopoverTrigger as D, PopoverContent as _ } from "../ui/popover.js";
|
|
6
|
+
const d = "$changed", L = "Changed by others", x = [
|
|
7
|
+
{ value: "1h", label: "Last hour", short: "last hour" },
|
|
8
|
+
{ value: "24h", label: "Last 24 hours", short: "last 24 hours" },
|
|
9
|
+
{ value: "2d", label: "Last 2 days", short: "last 2 days" },
|
|
10
|
+
{ value: "5d", label: "Last 5 days", short: "last 5 days" },
|
|
11
|
+
{ value: "7d", label: "Last 7 days", short: "last 7 days" }
|
|
12
|
+
];
|
|
13
|
+
function M(e) {
|
|
14
|
+
return e.path[0] === d && e.path.length === 1;
|
|
15
|
+
}
|
|
16
|
+
function A(e, t) {
|
|
17
|
+
const n = e ? new Date(e) : null, r = t ? new Date(t) : null;
|
|
18
|
+
return !n || Number.isNaN(n.getTime()) || r && (Number.isNaN(r.getTime()) || r.getTime() < n.getTime()) ? null : `custom:${n.toISOString()}..${r ? r.toISOString() : ""}`;
|
|
19
|
+
}
|
|
20
|
+
function c(e) {
|
|
21
|
+
if (!e.startsWith("custom:")) return null;
|
|
22
|
+
const [t, n] = e.slice(7).split("..");
|
|
23
|
+
return t ? { since: t, until: n || null } : null;
|
|
24
|
+
}
|
|
25
|
+
function V(e) {
|
|
26
|
+
const t = String(e.value ?? "24h"), n = c(t), r = n ? { since: n.since, ...n.until ? { until: n.until } : {}, others: !0 } : { window: x.some((s) => s.value === t) ? t : "24h", others: !0 };
|
|
27
|
+
return { path: [d], op: e.not ? "_neq" : "_eq", value: r };
|
|
28
|
+
}
|
|
29
|
+
function b(e) {
|
|
30
|
+
var r;
|
|
31
|
+
const t = String(e ?? ""), n = c(t);
|
|
32
|
+
if (n) {
|
|
33
|
+
const s = T(n.since);
|
|
34
|
+
return n.until ? `${s} – ${T(n.until)}` : `since ${s}`;
|
|
35
|
+
}
|
|
36
|
+
return ((r = x.find((s) => s.value === t)) == null ? void 0 : r.short) ?? "last 24 hours";
|
|
37
|
+
}
|
|
38
|
+
const E = {
|
|
39
|
+
"1h": "1 hour",
|
|
40
|
+
"24h": "24 hours",
|
|
41
|
+
"2d": "2 days",
|
|
42
|
+
"5d": "5 days",
|
|
43
|
+
"7d": "7 days"
|
|
44
|
+
};
|
|
45
|
+
function F(e) {
|
|
46
|
+
const t = String(e ?? ""), n = c(t);
|
|
47
|
+
if (n) {
|
|
48
|
+
const r = (s) => new Date(s).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
49
|
+
return `${r(n.since)} – ${n.until ? r(n.until) : "now"}`;
|
|
50
|
+
}
|
|
51
|
+
return E[t] ?? "24 hours";
|
|
52
|
+
}
|
|
53
|
+
function R(e) {
|
|
54
|
+
const t = b(e.value), n = c(String(e.value ?? "")) ? t : `in the ${t}`;
|
|
55
|
+
return `Records someone else ${e.not ? "did not change" : "created, edited or moved"} ${n}. Click to change the period.`;
|
|
56
|
+
}
|
|
57
|
+
function X(e) {
|
|
58
|
+
const t = b(e.value), n = c(String(e.value ?? "")) ? t : `in the ${t}`;
|
|
59
|
+
return `${e.not ? "not " : ""}changed by others ${n}`;
|
|
60
|
+
}
|
|
61
|
+
function I(e, t) {
|
|
62
|
+
return {
|
|
63
|
+
id: t ?? `${d}-${Date.now()}`,
|
|
64
|
+
path: [d],
|
|
65
|
+
pathLabels: [L],
|
|
66
|
+
fieldType: "changed",
|
|
67
|
+
op: "_changed",
|
|
68
|
+
value: e
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function g(e) {
|
|
72
|
+
const t = (n) => String(n).padStart(2, "0");
|
|
73
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`;
|
|
74
|
+
}
|
|
75
|
+
function Y({
|
|
76
|
+
filter: e,
|
|
77
|
+
onChange: t
|
|
78
|
+
}) {
|
|
79
|
+
const [n, r] = p(!1), s = e ? String(e.value ?? "") : null, i = s ? c(s) : null, [v, y] = p(!1), [m, w] = p(""), [f, k] = p(""), O = (o) => {
|
|
80
|
+
if (r(o), o) {
|
|
81
|
+
y(!!i);
|
|
82
|
+
const h = /* @__PURE__ */ new Date();
|
|
83
|
+
w(
|
|
84
|
+
g(i ? new Date(i.since) : new Date(h.getTime() - 864e5))
|
|
85
|
+
), k(i != null && i.until ? g(new Date(i.until)) : "");
|
|
86
|
+
}
|
|
87
|
+
}, N = (o) => {
|
|
88
|
+
t(I(o, e == null ? void 0 : e.id)), r(!1);
|
|
89
|
+
}, u = A(m, f);
|
|
90
|
+
return /* @__PURE__ */ l(H, { open: n, onOpenChange: O, children: [
|
|
91
|
+
e ? /* @__PURE__ */ l(
|
|
92
|
+
"span",
|
|
93
|
+
{
|
|
94
|
+
"data-cbv-changed-chip": "on",
|
|
95
|
+
className: "nvr-pop-in inline-flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden whitespace-nowrap rounded-full border border-nvr-cyan/50 bg-nvr-cyan/10 pl-2.5 pr-1 text-[12px] font-medium text-slate-700 dark:text-slate-100",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ a(D, { asChild: !0, children: /* @__PURE__ */ l(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
"aria-label": `${e.not ? "Not changed" : "Changed"} by others, ${b(s)}. Change the period`,
|
|
102
|
+
"data-tip": R(e),
|
|
103
|
+
className: "inline-flex min-w-0 items-center gap-1",
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ a(
|
|
106
|
+
C,
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": !0,
|
|
109
|
+
className: "h-3.5 w-3.5 shrink-0 text-[#0089a8] dark:text-nvr-cyan"
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ a("span", { className: "ml-0.5 shrink-0", children: e.not ? "Not changed" : "Changed" }),
|
|
113
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 truncate", children: "by others" }),
|
|
114
|
+
/* @__PURE__ */ a("span", { "aria-hidden": !0, className: "shrink-0 text-slate-400", children: "·" }),
|
|
115
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 font-semibold text-[#04516b] dark:text-nvr-cyan", children: F(s) })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) }),
|
|
119
|
+
/* @__PURE__ */ a(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
type: "button",
|
|
123
|
+
onClick: () => t(null),
|
|
124
|
+
"aria-label": "Remove the changed by others filter",
|
|
125
|
+
className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-slate-400 hover:bg-white/60 hover:text-slate-700 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
126
|
+
children: /* @__PURE__ */ a(P, { className: "h-3 w-3" })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
) : /* @__PURE__ */ a(D, { asChild: !0, children: /* @__PURE__ */ l(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
type: "button",
|
|
135
|
+
"data-cbv-changed-chip": "off",
|
|
136
|
+
"data-tip": "Show only records other people changed recently",
|
|
137
|
+
className: "inline-flex h-8 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-dashed border-slate-300 px-2.5 text-[12.5px] text-slate-500 hover:border-slate-400 hover:text-slate-700 dark:border-slate-600 dark:text-slate-400 dark:hover:border-slate-500 dark:hover:text-slate-200",
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ a(C, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
|
|
140
|
+
L
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) }),
|
|
144
|
+
/* @__PURE__ */ l(
|
|
145
|
+
_,
|
|
146
|
+
{
|
|
147
|
+
align: "start",
|
|
148
|
+
collisionPadding: 16,
|
|
149
|
+
className: "w-64 max-w-[calc(100vw-32px)] p-1",
|
|
150
|
+
"data-cbv-changed-picker": "",
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ a("p", { className: "px-2 pb-1 pt-1.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Records someone else created, edited or moved" }),
|
|
153
|
+
x.map((o) => {
|
|
154
|
+
const h = s === o.value;
|
|
155
|
+
return /* @__PURE__ */ l(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
type: "button",
|
|
159
|
+
"aria-pressed": h,
|
|
160
|
+
"data-changed-period": o.value,
|
|
161
|
+
onClick: () => N(o.value),
|
|
162
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12.5px] hover:bg-muted",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ a($, { className: S("h-3.5 w-3.5 shrink-0", h ? "opacity-100" : "opacity-0") }),
|
|
165
|
+
o.label
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
o.value
|
|
169
|
+
);
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ l(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
type: "button",
|
|
175
|
+
"aria-pressed": !!i,
|
|
176
|
+
"aria-expanded": v,
|
|
177
|
+
"data-changed-period": "custom",
|
|
178
|
+
onClick: () => y((o) => !o),
|
|
179
|
+
className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12.5px] hover:bg-muted",
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ a($, { className: S("h-3.5 w-3.5 shrink-0", i ? "opacity-100" : "opacity-0") }),
|
|
182
|
+
"Custom range…"
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
v && /* @__PURE__ */ l("div", { className: "mx-1 mb-1 mt-0.5 space-y-2 rounded-md border border-slate-200 p-2 dark:border-slate-700", children: [
|
|
187
|
+
/* @__PURE__ */ l("label", { className: "block text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
188
|
+
"From",
|
|
189
|
+
/* @__PURE__ */ a(
|
|
190
|
+
"input",
|
|
191
|
+
{
|
|
192
|
+
type: "datetime-local",
|
|
193
|
+
value: m,
|
|
194
|
+
onChange: (o) => w(o.target.value),
|
|
195
|
+
className: "mt-0.5 h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] text-slate-800 outline-none focus:border-nvr-cyan/50 focus:ring-2 focus:ring-nvr-cyan/30 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:[color-scheme:dark]"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
] }),
|
|
199
|
+
/* @__PURE__ */ l("label", { className: "block text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
200
|
+
"To",
|
|
201
|
+
/* @__PURE__ */ a(
|
|
202
|
+
"input",
|
|
203
|
+
{
|
|
204
|
+
type: "datetime-local",
|
|
205
|
+
value: f,
|
|
206
|
+
onChange: (o) => k(o.target.value),
|
|
207
|
+
className: "mt-0.5 h-8 w-full rounded-md border border-slate-200 bg-white px-2 text-[12.5px] text-slate-800 outline-none focus:border-nvr-cyan/50 focus:ring-2 focus:ring-nvr-cyan/30 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100 dark:[color-scheme:dark]"
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ a("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Leave To empty to include everything up to now." }),
|
|
212
|
+
m && !u && /* @__PURE__ */ a("p", { className: "text-[11px] text-amber-700 dark:text-amber-400", children: "The end must come after the start." }),
|
|
213
|
+
/* @__PURE__ */ a(
|
|
214
|
+
"button",
|
|
215
|
+
{
|
|
216
|
+
type: "button",
|
|
217
|
+
disabled: !u,
|
|
218
|
+
onClick: () => u && N(u),
|
|
219
|
+
className: "h-7 w-full rounded-md bg-nvr-cyan text-[12px] font-medium text-white disabled:opacity-40",
|
|
220
|
+
children: "Apply range"
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] })
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
] });
|
|
228
|
+
}
|
|
229
|
+
function z(e, t) {
|
|
230
|
+
return [...e, { path: [d], op: "_eq", value: { since: t, others: !0 } }];
|
|
231
|
+
}
|
|
232
|
+
function J(e) {
|
|
233
|
+
return `${e.toLocaleString()} changed since you last opened this view`;
|
|
234
|
+
}
|
|
235
|
+
export {
|
|
236
|
+
L as CHANGED_LABEL,
|
|
237
|
+
d as CHANGED_PATH,
|
|
238
|
+
x as CHANGED_PERIODS,
|
|
239
|
+
Y as ChangedByOthersChip,
|
|
240
|
+
V as changedCondition,
|
|
241
|
+
I as changedFilterEntry,
|
|
242
|
+
X as changedPhrase,
|
|
243
|
+
R as changedTip,
|
|
244
|
+
F as changedWindowShort,
|
|
245
|
+
b as changedWindowText,
|
|
246
|
+
A as customChangedValue,
|
|
247
|
+
M as isChangedFilter,
|
|
248
|
+
c as parseCustomChanged,
|
|
249
|
+
z as viewChangedConditions,
|
|
250
|
+
J as viewChangedTip
|
|
251
|
+
};
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as D, useQueryClient as E, useMutation as K } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as Q, GitPullRequestArrow as T, Loader2 as y, Check as W, AlertTriangle as $, ArrowRight as j } from "lucide-react";
|
|
4
|
+
import { useState as f } from "react";
|
|
5
|
+
import { toast as w } from "sonner";
|
|
6
|
+
import { useNivaroClient as C } from "../../context.js";
|
|
7
|
+
import { get as F, post as L } from "../../lib/commands.js";
|
|
8
|
+
import { describeError as O } from "../../lib/error-message.js";
|
|
9
|
+
import { toastError as M } from "../../lib/error-toast.js";
|
|
10
|
+
import { noteOwnWrite as U } from "../../lib/own-writes.js";
|
|
11
|
+
import { invalidateRecordRow as B } from "../../lib/record-loader.js";
|
|
12
|
+
import { cn as N, formatRelative as P } from "../../lib/utils.js";
|
|
13
|
+
import { ProposalValue as v } from "./ProposalValue.js";
|
|
14
|
+
import { proposalsQueryKey as q } from "./types.js";
|
|
15
|
+
function G(t, r, o) {
|
|
16
|
+
const i = C();
|
|
17
|
+
return D({
|
|
18
|
+
queryKey: q(t, r ?? ""),
|
|
19
|
+
queryFn: () => i.request(
|
|
20
|
+
F(`/change-proposals/record/${t}/${encodeURIComponent(String(r))}`)
|
|
21
|
+
).then((n) => n.data).catch(() => null),
|
|
22
|
+
enabled: o && !!r,
|
|
23
|
+
staleTime: 15e3
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const _ = {
|
|
27
|
+
accepted: {
|
|
28
|
+
text: "Accepted",
|
|
29
|
+
cls: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
30
|
+
},
|
|
31
|
+
declined: { text: "Declined", cls: "bg-rose-500/10 text-rose-700 dark:text-rose-300" },
|
|
32
|
+
withdrawn: { text: "Withdrawn", cls: "bg-slate-500/10 text-slate-600 dark:text-slate-400" }
|
|
33
|
+
};
|
|
34
|
+
function S({ p: t }) {
|
|
35
|
+
return /* @__PURE__ */ a("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
|
|
36
|
+
/* @__PURE__ */ a("table", { className: "w-full table-fixed text-[12.5px]", children: [
|
|
37
|
+
/* @__PURE__ */ e("thead", { className: "bg-slate-50 text-left text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:bg-muted/40 dark:text-muted-foreground", children: /* @__PURE__ */ a("tr", { children: [
|
|
38
|
+
/* @__PURE__ */ e("th", { className: "w-[30%] px-3 py-1.5 font-medium", children: "Field" }),
|
|
39
|
+
/* @__PURE__ */ e("th", { className: "w-[30%] px-3 py-1.5 font-medium", children: "Before" }),
|
|
40
|
+
/* @__PURE__ */ e("th", { className: "w-5", "aria-hidden": !0 }),
|
|
41
|
+
/* @__PURE__ */ e("th", { className: "px-3 py-1.5 font-medium", children: "Proposed" })
|
|
42
|
+
] }) }),
|
|
43
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-100 dark:divide-border", children: t.changes.map((r) => /* @__PURE__ */ a("tr", { "data-proposal-change": r.field, className: "align-top", children: [
|
|
44
|
+
/* @__PURE__ */ a("td", { className: "px-3 py-2 font-medium text-slate-700 dark:text-slate-200", children: [
|
|
45
|
+
/* @__PURE__ */ e("span", { className: "break-words", children: r.label }),
|
|
46
|
+
r.stale && /* @__PURE__ */ a(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
className: "mt-0.5 flex items-center gap-1 text-[11px] font-normal text-amber-700 dark:text-amber-400",
|
|
50
|
+
"data-tip": "Someone changed this field after the proposal was made",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ e($, { className: "h-3 w-3" }),
|
|
53
|
+
" Changed since"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ e("td", { className: "px-3 py-2 text-slate-500 line-through decoration-slate-300 dark:text-slate-400 dark:decoration-slate-600", children: /* @__PURE__ */ e(
|
|
59
|
+
v,
|
|
60
|
+
{
|
|
61
|
+
value: r.from,
|
|
62
|
+
kind: r.kind,
|
|
63
|
+
relation: r.relation,
|
|
64
|
+
choices: r.choices
|
|
65
|
+
}
|
|
66
|
+
) }),
|
|
67
|
+
/* @__PURE__ */ e("td", { className: "py-2 text-slate-400", "aria-hidden": !0, children: /* @__PURE__ */ e(j, { className: "mt-0.5 h-3.5 w-3.5" }) }),
|
|
68
|
+
/* @__PURE__ */ e("td", { className: "px-3 py-2 font-medium text-slate-900 dark:text-slate-50", children: /* @__PURE__ */ e(
|
|
69
|
+
v,
|
|
70
|
+
{
|
|
71
|
+
value: r.to,
|
|
72
|
+
kind: r.kind,
|
|
73
|
+
relation: r.relation,
|
|
74
|
+
choices: r.choices
|
|
75
|
+
}
|
|
76
|
+
) })
|
|
77
|
+
] }, r.field)) })
|
|
78
|
+
] }),
|
|
79
|
+
t.hidden_fields > 0 && /* @__PURE__ */ a("p", { className: "border-t border-slate-100 px-3 py-1.5 text-[11.5px] text-slate-500 dark:border-border dark:text-muted-foreground", children: [
|
|
80
|
+
t.hidden_fields === 1 ? "One more field" : `${t.hidden_fields} more fields`,
|
|
81
|
+
" you can’t see."
|
|
82
|
+
] })
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
function V({
|
|
86
|
+
p: t,
|
|
87
|
+
collection: r,
|
|
88
|
+
item: o
|
|
89
|
+
}) {
|
|
90
|
+
const i = C(), n = E(), [u, m] = f(!1), [l, s] = f(""), [p, b] = f(null), k = () => {
|
|
91
|
+
n.invalidateQueries({ queryKey: q(r, o) }), n.invalidateQueries({ queryKey: ["my-work"] });
|
|
92
|
+
}, x = K({
|
|
93
|
+
onMutate: (d) => {
|
|
94
|
+
d.kind === "accept" && U(
|
|
95
|
+
r,
|
|
96
|
+
o,
|
|
97
|
+
void 0,
|
|
98
|
+
t.changes.map((h) => h.field)
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
mutationFn: (d) => i.request(
|
|
102
|
+
L(`/change-proposals/${t.id}/${d.kind}`, d.kind === "decline" ? { note: d.note } : {})
|
|
103
|
+
),
|
|
104
|
+
onSuccess: (d, h) => {
|
|
105
|
+
k(), h.kind === "accept" ? (n.invalidateQueries({ queryKey: ["item", r] }), n.invalidateQueries({ queryKey: ["comments-related", r] }), B(n, r, o), w.success("Accepted — the new values are on the record.")) : h.kind === "decline" ? w.success("Declined — the proposer has been told.") : w.success("Proposal withdrawn.");
|
|
106
|
+
},
|
|
107
|
+
onError: (d, h) => {
|
|
108
|
+
const A = O(d, "Could not do that");
|
|
109
|
+
h.kind === "decline" ? b(A.title) : M(d, "Could not do that"), k();
|
|
110
|
+
}
|
|
111
|
+
}), c = x.isPending, g = t.changes.some((d) => d.stale);
|
|
112
|
+
return /* @__PURE__ */ a(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
"data-change-proposal": t.id,
|
|
116
|
+
className: "rounded-lg border border-nvr-cyan/30 bg-white p-4 shadow-sm dark:border-nvr-cyan/25 dark:bg-card",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ a("div", { className: "mb-2 flex flex-wrap items-start justify-between gap-x-3 gap-y-1", children: [
|
|
119
|
+
/* @__PURE__ */ a("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
120
|
+
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/10 text-[#0e7490] dark:text-[#67e8f9]", children: /* @__PURE__ */ e(T, { className: "h-3.5 w-3.5" }) }),
|
|
121
|
+
/* @__PURE__ */ a("div", { className: "min-w-0", children: [
|
|
122
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-slate-50", children: "Proposed change" }),
|
|
123
|
+
/* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
124
|
+
t.created_by_name ?? "Someone",
|
|
125
|
+
" · ",
|
|
126
|
+
P(t.created_at)
|
|
127
|
+
] })
|
|
128
|
+
] })
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ e("span", { className: "rounded-full bg-amber-400/15 px-2 py-0.5 text-[11px] font-medium text-amber-800 dark:text-amber-300", children: "Waiting for a decision" })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ a("p", { className: "mb-3 max-w-[75ch] text-[12.5px] leading-relaxed text-slate-700 dark:text-slate-300", children: [
|
|
133
|
+
/* @__PURE__ */ e("span", { className: "mr-1.5 font-medium text-slate-500 dark:text-slate-400", children: "Why:" }),
|
|
134
|
+
t.reason
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ e(S, { p: t }),
|
|
137
|
+
(t.can_decide || t.can_withdraw) && /* @__PURE__ */ e("div", { className: "mt-3 space-y-2", children: u ? /* @__PURE__ */ a(
|
|
138
|
+
"form",
|
|
139
|
+
{
|
|
140
|
+
className: "space-y-2",
|
|
141
|
+
onSubmit: (d) => {
|
|
142
|
+
d.preventDefault(), !(l.trim().length < 3 || c) && (b(null), x.mutate({ kind: "decline", note: l.trim() }));
|
|
143
|
+
},
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ a("label", { className: "block", children: [
|
|
146
|
+
/* @__PURE__ */ e("span", { className: "mb-1 block text-[12px] font-medium text-slate-700 dark:text-slate-200", children: "Why are you declining it? The proposer sees this." }),
|
|
147
|
+
/* @__PURE__ */ e(
|
|
148
|
+
"textarea",
|
|
149
|
+
{
|
|
150
|
+
value: l,
|
|
151
|
+
onChange: (d) => s(d.target.value),
|
|
152
|
+
rows: 2,
|
|
153
|
+
maxLength: 2e3,
|
|
154
|
+
"data-proposal-decline-note": !0,
|
|
155
|
+
className: "w-full rounded-md border border-input bg-background px-2.5 py-2 text-[13px] leading-snug text-foreground shadow-sm outline-none focus-visible:border-nvr-cyan focus-visible:ring-2 focus-visible:ring-nvr-cyan/25"
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] }),
|
|
159
|
+
p && /* @__PURE__ */ e("p", { role: "alert", className: "text-[12px] text-rose-700 dark:text-rose-300", children: p }),
|
|
160
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
161
|
+
/* @__PURE__ */ a(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
type: "submit",
|
|
165
|
+
disabled: l.trim().length < 3 || c,
|
|
166
|
+
"data-proposal-decline-confirm": !0,
|
|
167
|
+
className: "inline-flex h-8 items-center gap-1.5 rounded-md bg-rose-600 px-3 text-[12.5px] font-semibold text-white shadow-sm transition-opacity hover:bg-rose-700 disabled:opacity-50",
|
|
168
|
+
children: [
|
|
169
|
+
c && /* @__PURE__ */ e(y, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
170
|
+
"Decline proposal"
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ e(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
onClick: () => {
|
|
179
|
+
m(!1), b(null);
|
|
180
|
+
},
|
|
181
|
+
className: "h-8 rounded-md px-3 text-[12.5px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
182
|
+
children: "Keep it"
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
] })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) : /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
189
|
+
t.can_decide && /* @__PURE__ */ a(R, { children: [
|
|
190
|
+
/* @__PURE__ */ a(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
type: "button",
|
|
194
|
+
disabled: c || g,
|
|
195
|
+
"data-tip": g ? "A field changed since this was proposed — decline it and ask for a new one" : void 0,
|
|
196
|
+
onClick: () => x.mutate({ kind: "accept" }),
|
|
197
|
+
"data-proposal-accept": !0,
|
|
198
|
+
className: "inline-flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white shadow-sm transition-opacity disabled:opacity-50",
|
|
199
|
+
children: [
|
|
200
|
+
c ? /* @__PURE__ */ e(y, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5" }),
|
|
201
|
+
"Accept and apply"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ e(
|
|
206
|
+
"button",
|
|
207
|
+
{
|
|
208
|
+
type: "button",
|
|
209
|
+
disabled: c,
|
|
210
|
+
onClick: () => m(!0),
|
|
211
|
+
"data-proposal-decline": !0,
|
|
212
|
+
className: "inline-flex h-8 items-center rounded-md border border-input bg-background px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:bg-muted disabled:opacity-50 dark:text-slate-200",
|
|
213
|
+
children: "Decline"
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
] }),
|
|
217
|
+
t.can_withdraw && /* @__PURE__ */ e(
|
|
218
|
+
"button",
|
|
219
|
+
{
|
|
220
|
+
type: "button",
|
|
221
|
+
disabled: c,
|
|
222
|
+
onClick: () => x.mutate({ kind: "withdraw" }),
|
|
223
|
+
"data-proposal-withdraw": !0,
|
|
224
|
+
className: "inline-flex h-8 items-center rounded-md border border-input bg-background px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:bg-muted disabled:opacity-50 dark:text-slate-200",
|
|
225
|
+
children: "Withdraw"
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] }) }),
|
|
229
|
+
t.can_decide && g && !u && /* @__PURE__ */ e(
|
|
230
|
+
"p",
|
|
231
|
+
{
|
|
232
|
+
className: "mt-2 text-[11.5px] text-amber-700 dark:text-amber-400",
|
|
233
|
+
"data-proposal-stale-note": !0,
|
|
234
|
+
children: "A field changed after this was proposed, so it can’t be applied as it stands. Decline it and ask for a new proposal."
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
!t.can_decide && !t.can_withdraw && t.decide_reason && /* @__PURE__ */ e("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: t.decide_reason }),
|
|
238
|
+
t.can_withdraw && t.decide_reason && /* @__PURE__ */ e("p", { className: "mt-2 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "The owners of this step will accept or decline it — you’ll get a notification." })
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function ie({
|
|
244
|
+
collection: t,
|
|
245
|
+
itemId: r,
|
|
246
|
+
enabled: o
|
|
247
|
+
}) {
|
|
248
|
+
const { data: i } = G(t, r, o), [n, u] = f(!1);
|
|
249
|
+
if (!(i != null && i.enabled) || !r) return null;
|
|
250
|
+
const m = i.proposals.filter((s) => s.status === "pending" || s.status === "accepting"), l = i.proposals.filter((s) => !m.includes(s));
|
|
251
|
+
return m.length === 0 && l.length === 0 ? null : /* @__PURE__ */ a(
|
|
252
|
+
"section",
|
|
253
|
+
{
|
|
254
|
+
className: "nvr-expand-in space-y-2",
|
|
255
|
+
"data-change-proposals": !0,
|
|
256
|
+
"aria-label": "Proposed changes",
|
|
257
|
+
children: [
|
|
258
|
+
m.map((s) => /* @__PURE__ */ e(V, { p: s, collection: t, item: r }, s.id)),
|
|
259
|
+
l.length > 0 && /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
260
|
+
/* @__PURE__ */ a(
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
type: "button",
|
|
264
|
+
onClick: () => u((s) => !s),
|
|
265
|
+
"aria-expanded": n,
|
|
266
|
+
className: "flex w-full items-center gap-1.5 px-4 py-2 text-left text-[12.5px] font-medium text-slate-600 hover:bg-muted dark:text-slate-300",
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ e(
|
|
269
|
+
Q,
|
|
270
|
+
{
|
|
271
|
+
className: N("h-3.5 w-3.5 transition-transform", n && "rotate-90")
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
"Earlier proposals (",
|
|
275
|
+
l.length,
|
|
276
|
+
")"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
n && /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 border-t border-slate-100 dark:divide-border dark:border-border", children: l.map((s) => {
|
|
281
|
+
const p = _[s.status] ?? _.withdrawn;
|
|
282
|
+
return /* @__PURE__ */ a("li", { className: "space-y-2 px-4 py-3", "data-change-proposal": s.id, children: [
|
|
283
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2 text-[12px]", children: [
|
|
284
|
+
/* @__PURE__ */ e(
|
|
285
|
+
"span",
|
|
286
|
+
{
|
|
287
|
+
className: N("rounded-full px-2 py-0.5 text-[11px] font-medium", p.cls),
|
|
288
|
+
children: p.text
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
/* @__PURE__ */ a("span", { className: "text-slate-600 dark:text-slate-300", children: [
|
|
292
|
+
s.created_by_name ?? "Someone",
|
|
293
|
+
" proposed · ",
|
|
294
|
+
P(s.created_at)
|
|
295
|
+
] }),
|
|
296
|
+
s.decided_by_name && s.status !== "withdrawn" && /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
297
|
+
"· ",
|
|
298
|
+
p.text.toLowerCase(),
|
|
299
|
+
" by ",
|
|
300
|
+
s.decided_by_name
|
|
301
|
+
] })
|
|
302
|
+
] }),
|
|
303
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-600 dark:text-slate-400", children: s.reason }),
|
|
304
|
+
s.decision_note && /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-600 dark:text-slate-400", children: [
|
|
305
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: "Note:" }),
|
|
306
|
+
" ",
|
|
307
|
+
s.decision_note
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ e(S, { p: s })
|
|
310
|
+
] }, s.id);
|
|
311
|
+
}) })
|
|
312
|
+
] })
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
export {
|
|
318
|
+
ie as ChangeProposalsPanel,
|
|
319
|
+
G as useRecordProposals
|
|
320
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as t, Fragment as e } from "react/jsx-runtime";
|
|
2
|
+
import { toLocalDateString as f, formatDateTime as s } from "../../lib/utils.js";
|
|
3
|
+
import { RelationLabel as c } from "../layout-editor/pickers/relation-label.js";
|
|
4
|
+
function g({
|
|
5
|
+
value: r,
|
|
6
|
+
kind: n,
|
|
7
|
+
relation: i,
|
|
8
|
+
choices: o
|
|
9
|
+
}) {
|
|
10
|
+
if (r == null || r === "")
|
|
11
|
+
return /* @__PURE__ */ t("span", { className: "italic text-slate-400 dark:text-slate-500", children: "empty" });
|
|
12
|
+
if (n === "relation" && i)
|
|
13
|
+
return /* @__PURE__ */ t(c, { relatedCollection: i, id: r });
|
|
14
|
+
if (n === "boolean" || typeof r == "boolean")
|
|
15
|
+
return /* @__PURE__ */ t(e, { children: r === !0 || r === 1 || r === "1" || r === "true" ? "Yes" : "No" });
|
|
16
|
+
if (n === "date") return /* @__PURE__ */ t(e, { children: f(r) || String(r) });
|
|
17
|
+
if (n === "datetime") return /* @__PURE__ */ t(e, { children: s(String(r)) || String(r) });
|
|
18
|
+
if (n === "number" && typeof r == "number")
|
|
19
|
+
return /* @__PURE__ */ t("span", { className: "tabular-nums", children: r.toLocaleString() });
|
|
20
|
+
if (o) {
|
|
21
|
+
const m = o.find((a) => String(a.value) === String(r));
|
|
22
|
+
if (m) return /* @__PURE__ */ t(e, { children: m.text });
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ t("span", { className: "break-words", children: String(r) });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
g as ProposalValue
|
|
28
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as n, Fragment as m, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { GitPullRequestArrow as c } from "lucide-react";
|
|
3
|
+
import { useState as l } from "react";
|
|
4
|
+
import { useRecordProposals as u } from "./ChangeProposalsPanel.js";
|
|
5
|
+
import { ProposeChangeDialog as h } from "./ProposeChangeDialog.js";
|
|
6
|
+
function v({
|
|
7
|
+
collection: o,
|
|
8
|
+
itemId: t,
|
|
9
|
+
enabled: a,
|
|
10
|
+
recordLabel: p
|
|
11
|
+
}) {
|
|
12
|
+
const { data: e } = u(o, t, a), [i, r] = l(!1);
|
|
13
|
+
return !(e != null && e.enabled) || !e.can_propose || !t ? null : /* @__PURE__ */ n(m, { children: [
|
|
14
|
+
/* @__PURE__ */ n(
|
|
15
|
+
"button",
|
|
16
|
+
{
|
|
17
|
+
type: "button",
|
|
18
|
+
"data-tip": "Suggest new values — the owners of this step accept or decline them",
|
|
19
|
+
"data-propose-change-button": !0,
|
|
20
|
+
onClick: () => r(!0),
|
|
21
|
+
className: "inline-flex h-9 shrink-0 items-center gap-1.5 rounded-md border border-nvr-cyan/50 bg-nvr-cyan/10 px-3 text-sm font-medium text-[#0e7490] shadow-sm transition-colors hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ s(c, { className: "h-3.5 w-3.5" }),
|
|
24
|
+
"Propose change"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ s(
|
|
29
|
+
h,
|
|
30
|
+
{
|
|
31
|
+
open: i,
|
|
32
|
+
onOpenChange: r,
|
|
33
|
+
collection: o,
|
|
34
|
+
item: t,
|
|
35
|
+
recordLabel: p,
|
|
36
|
+
step: e.step,
|
|
37
|
+
fields: e.fields ?? []
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
v as ProposeChangeButton
|
|
44
|
+
};
|