@nivaro/react 0.3.139 → 0.3.141

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 (100) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +39 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2702 -2671
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3475 -3458
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/RowPresence.js +83 -76
  23. package/dist/shared/components/SlaRulesView.js +73 -74
  24. package/dist/shared/components/UnseenDot.js +183 -22
  25. package/dist/shared/components/WidgetSlot.js +73 -73
  26. package/dist/shared/components/ai/AiChart.js +36 -32
  27. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  28. package/dist/shared/components/ai/TaskDo.js +87 -87
  29. package/dist/shared/components/ai/answer-formats.js +37 -30
  30. package/dist/shared/components/ai/call-log/format.js +17 -16
  31. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  32. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  33. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  34. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  35. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  36. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  37. package/dist/shared/components/cbv/column-totals.js +53 -51
  38. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  40. package/dist/shared/components/command-center/announce.js +7 -6
  41. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  42. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  43. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  44. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  45. package/dist/shared/components/delivery-analytics/drill.js +32 -32
  46. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  47. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  48. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  49. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  50. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  51. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  52. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  53. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  54. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  55. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  56. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  57. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  58. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  59. package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
  60. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  61. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  62. package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
  63. package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
  64. package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
  65. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  66. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  67. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
  68. package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
  69. package/dist/shared/components/layout-editor/settings/controls.js +98 -90
  70. package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
  71. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  72. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  73. package/dist/shared/components/ops-report/format.js +37 -36
  74. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  75. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  76. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  77. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  78. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  79. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  80. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  81. package/dist/shared/components/profile/DelegationCard.js +13 -12
  82. package/dist/shared/components/profile/PersonActivity.js +48 -48
  83. package/dist/shared/components/profile/PersonExtras.js +107 -107
  84. package/dist/shared/components/profile/PersonWeek.js +9 -9
  85. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  86. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  87. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  88. package/dist/shared/components/queue/QueueWorklist.js +884 -872
  89. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  90. package/dist/shared/components/support/RequestList.js +123 -123
  91. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  92. package/dist/shared/lib/activity-sentence.js +251 -229
  93. package/dist/shared/lib/format-value.js +5 -4
  94. package/dist/shared/lib/layout-resolve.js +64 -48
  95. package/dist/shared/lib/number-format.js +87 -0
  96. package/dist/shared/lib/number-kind.js +133 -0
  97. package/dist/shared/lib/utils.js +24 -20
  98. package/dist/shared/lib/watch-list.js +1 -1
  99. package/dist/shared/lib/widget-value-format.js +26 -12
  100. package/package.json +1 -1
@@ -1,75 +1,75 @@
1
- import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import { useQueryClient as U } from "@tanstack/react-query";
3
- import { Lock as P, Smartphone as _, Tablet as j } from "lucide-react";
4
- import { useState as x, useEffect as B } from "react";
5
- import { toast as E } from "sonner";
6
- import { useItemEditAuth as Q, useNivaroClient as G } from "../../../context.js";
7
- import { post as H, patch as J } from "../../../lib/commands.js";
8
- import { freezeOf as X, activeFreeze as Y, localDay as L, dayWords as k, freezePatch as I, activeWindowOf as Z, windowState as ee, windowWords as te, activeWindowPatch as ne, tabletOfPatch as oe, tabletOf as ae, phoneOfPatch as ie, phoneOf as le, screenVersionOf as re, conditionsWithKey as se } from "../../../lib/layout-resolve.js";
9
- import { cn as g } from "../../../lib/utils.js";
10
- import { useLayoutEditorHost as ce } from "../host.js";
11
- import { useInvalidateLayouts as de, apiFailure as me } from "../overview/overview-api.js";
12
- import { amberStrip as ue } from "../panel-style.js";
13
- import { Setting as C, smallBtn as y, quietText as N, inputCls as R, PickList as fe } from "./controls.js";
14
- import { useCollectionLayoutList as he, settingsKeys as pe } from "./settings-api.js";
15
- import { layoutKindOf as q } from "./settings-registry.js";
16
- const O = g(R, "h-8 w-[150px] font-mono dark:[color-scheme:dark]");
17
- function Te(c) {
18
- const { layout: r } = c, e = Z(r.conditions), [o, n] = x((e == null ? void 0 : e.from) ?? ""), [s, h] = x((e == null ? void 0 : e.until) ?? "");
19
- B(() => {
20
- n((e == null ? void 0 : e.from) ?? ""), h((e == null ? void 0 : e.until) ?? "");
21
- }, [e == null ? void 0 : e.from, e == null ? void 0 : e.until]);
22
- const u = !!o && !!s && o > s, m = (i, d) => {
23
- i && d && i > d || (i || null) === ((e == null ? void 0 : e.from) ?? null) && (d || null) === ((e == null ? void 0 : e.until) ?? null) || c.set(
24
- ne(r.conditions, { from: i || null, until: d || null }),
25
- i || d ? "Set active dates" : "Clear active dates"
1
+ import { jsx as n, jsxs as c } from "react/jsx-runtime";
2
+ import { useQueryClient as G } from "@tanstack/react-query";
3
+ import { Lock as q, Smartphone as H, Tablet as I } from "lucide-react";
4
+ import { useState as F, useEffect as J } from "react";
5
+ import { toast as D } from "sonner";
6
+ import { useItemEditAuth as X, useNivaroClient as Y } from "../../../context.js";
7
+ import { post as Z, patch as ee } from "../../../lib/commands.js";
8
+ import { freezeOf as te, activeFreeze as ne, localDay as R, dayWords as A, freezePatch as K, activeWindowOf as oe, windowState as ae, windowWords as ie, screenVersionOf as T, summaryForOf as P, activeWindowPatch as se, tabletOfPatch as re, tabletOf as le, phoneOfPatch as ce, phoneOf as de, summaryForPatch as me, conditionsWithKey as ue } from "../../../lib/layout-resolve.js";
9
+ import { cn as $ } from "../../../lib/utils.js";
10
+ import { useLayoutEditorHost as he } from "../host.js";
11
+ import { useInvalidateLayouts as fe, apiFailure as pe } from "../overview/overview-api.js";
12
+ import { amberStrip as ye } from "../panel-style.js";
13
+ import { Setting as z, smallBtn as k, quietText as L, inputCls as V, Chip as be, PickList as j } from "./controls.js";
14
+ import { useCollectionLayoutList as B, settingsKeys as ge } from "./settings-api.js";
15
+ import { layoutKindOf as C } from "./settings-registry.js";
16
+ const _ = $(V, "h-8 w-[150px] font-mono dark:[color-scheme:dark]");
17
+ function We(m) {
18
+ const { layout: r } = m, t = oe(r.conditions), [i, o] = F((t == null ? void 0 : t.from) ?? ""), [s, y] = F((t == null ? void 0 : t.until) ?? "");
19
+ J(() => {
20
+ o((t == null ? void 0 : t.from) ?? ""), y((t == null ? void 0 : t.until) ?? "");
21
+ }, [t == null ? void 0 : t.from, t == null ? void 0 : t.until]);
22
+ const b = !!i && !!s && i > s, f = (l, p) => {
23
+ l && p && l > p || (l || null) === ((t == null ? void 0 : t.from) ?? null) && (p || null) === ((t == null ? void 0 : t.until) ?? null) || m.set(
24
+ se(r.conditions, { from: l || null, until: p || null }),
25
+ l || p ? "Set active dates" : "Clear active dates"
26
26
  );
27
- }, f = ee(e, L());
28
- return /* @__PURE__ */ t(
29
- C,
27
+ }, g = ae(t, R());
28
+ return /* @__PURE__ */ n(
29
+ z,
30
30
  {
31
31
  k: "layout.conditions.active_window",
32
- note: u ? /* @__PURE__ */ t("span", { className: "text-amber-700 dark:text-amber-300", children: "The end comes before the start." }) : e && f ? /* @__PURE__ */ t("span", { "data-active-window-state": f, children: f === "open" ? `In use now, ${te(e)}.` : f === "before" ? `Not in use yet: starts ${k(e.from)}.` : `No longer in use: ended ${k(e.until)}.` }) : null,
33
- children: /* @__PURE__ */ l("div", { className: "flex flex-wrap items-end gap-2", children: [
34
- /* @__PURE__ */ l("label", { className: "flex flex-col gap-1", children: [
35
- /* @__PURE__ */ t("span", { className: N, children: "From" }),
36
- /* @__PURE__ */ t(
32
+ note: b ? /* @__PURE__ */ n("span", { className: "text-amber-700 dark:text-amber-300", children: "The end comes before the start." }) : t && g ? /* @__PURE__ */ n("span", { "data-active-window-state": g, children: g === "open" ? `In use now, ${ie(t)}.` : g === "before" ? `Not in use yet: starts ${A(t.from)}.` : `No longer in use: ended ${A(t.until)}.` }) : null,
33
+ children: /* @__PURE__ */ c("div", { className: "flex flex-wrap items-end gap-2", children: [
34
+ /* @__PURE__ */ c("label", { className: "flex flex-col gap-1", children: [
35
+ /* @__PURE__ */ n("span", { className: L, children: "From" }),
36
+ /* @__PURE__ */ n(
37
37
  "input",
38
38
  {
39
39
  type: "date",
40
40
  "aria-label": "Active from",
41
- value: o,
41
+ value: i,
42
42
  max: s || void 0,
43
- onChange: (i) => {
44
- n(i.target.value), m(i.target.value, s);
43
+ onChange: (l) => {
44
+ o(l.target.value), f(l.target.value, s);
45
45
  },
46
- className: O
46
+ className: _
47
47
  }
48
48
  )
49
49
  ] }),
50
- /* @__PURE__ */ l("label", { className: "flex flex-col gap-1", children: [
51
- /* @__PURE__ */ t("span", { className: N, children: "Until" }),
52
- /* @__PURE__ */ t(
50
+ /* @__PURE__ */ c("label", { className: "flex flex-col gap-1", children: [
51
+ /* @__PURE__ */ n("span", { className: L, children: "Until" }),
52
+ /* @__PURE__ */ n(
53
53
  "input",
54
54
  {
55
55
  type: "date",
56
56
  "aria-label": "Active until",
57
57
  value: s,
58
- min: o || void 0,
59
- onChange: (i) => {
60
- h(i.target.value), m(o, i.target.value);
58
+ min: i || void 0,
59
+ onChange: (l) => {
60
+ y(l.target.value), f(i, l.target.value);
61
61
  },
62
- className: O
62
+ className: _
63
63
  }
64
64
  )
65
65
  ] }),
66
- (o || s) && /* @__PURE__ */ t(
66
+ (i || s) && /* @__PURE__ */ n(
67
67
  "button",
68
68
  {
69
69
  type: "button",
70
- className: g(y, "mb-0.5"),
70
+ className: $(k, "mb-0.5"),
71
71
  onClick: () => {
72
- n(""), h(""), m("", "");
72
+ o(""), y(""), f("", "");
73
73
  },
74
74
  children: "Clear"
75
75
  }
@@ -78,211 +78,279 @@ function Te(c) {
78
78
  }
79
79
  );
80
80
  }
81
- const K = {
81
+ const U = {
82
82
  phone: {
83
83
  key: "phone_of",
84
- of: le,
85
- patch: ie,
84
+ of: de,
85
+ patch: ce,
86
86
  word: "phone",
87
87
  where: "small screens"
88
88
  },
89
89
  tablet: {
90
90
  key: "tablet_of",
91
- of: ae,
92
- patch: oe,
91
+ of: le,
92
+ patch: re,
93
93
  word: "tablet",
94
94
  where: "tablet-width screens"
95
95
  }
96
96
  };
97
- function Pe(c) {
98
- return /* @__PURE__ */ t(V, { ...c, screen: "phone" });
97
+ function Ee(m) {
98
+ return /* @__PURE__ */ n(Q, { ...m, screen: "phone" });
99
99
  }
100
- function Ee(c) {
101
- return /* @__PURE__ */ t(V, { ...c, screen: "tablet" });
100
+ function Me(m) {
101
+ return /* @__PURE__ */ n(Q, { ...m, screen: "tablet" });
102
102
  }
103
- function V(c) {
104
- const { layout: r, collection: e, screen: o } = c, n = K[o], s = K[o === "phone" ? "tablet" : "phone"], h = o === "phone" ? _ : j, u = Number(r.id), m = ce(), f = G(), i = U(), d = de(e), W = he(e), [F, T] = x(!1), A = q(r) === "summary" ? "summary" : "grouped", S = W.filter((a) => q(a) === A), p = n.of(r.conditions), D = s.of(r.conditions), w = S.find((a) => a.id !== u && n.of(a.conditions) === u) ?? null, b = p != null ? S.find((a) => a.id === p) ?? null : null, $ = (a) => {
105
- m.layoutLink && m.navigate(m.layoutLink(e, a));
106
- }, M = async () => {
107
- T(!0);
103
+ function Q(m) {
104
+ const { layout: r, collection: t, screen: i } = m, o = U[i], s = U[i === "phone" ? "tablet" : "phone"], y = i === "phone" ? H : I, b = Number(r.id), f = he(), g = Y(), l = G(), p = fe(t), O = B(t), [x, S] = F(!1), W = C(r) === "summary" ? "summary" : "grouped", w = O.filter((a) => C(a) === W), v = o.of(r.conditions), e = s.of(r.conditions), d = w.find((a) => a.id !== b && o.of(a.conditions) === b) ?? null, u = v != null ? w.find((a) => a.id === v) ?? null : null, h = (a) => {
105
+ f.layoutLink && f.navigate(f.layoutLink(t, a));
106
+ }, E = async () => {
107
+ S(!0);
108
108
  try {
109
- const a = String(r.name || "Form"), z = await f.request(
110
- H(`/collection-layouts/${u}/clone`, { name: `${a} (${n.word})`.slice(0, 255) })
111
- ), v = z == null ? void 0 : z.data;
112
- if (!(v != null && v.id)) throw new Error("No id came back");
113
- await f.request(
114
- J(`/collection-layouts/${v.id}`, {
115
- conditions: se(v.conditions, n.key, u)
109
+ const a = String(r.name || "Form"), M = await g.request(
110
+ Z(`/collection-layouts/${b}/clone`, { name: `${a} (${o.word})`.slice(0, 255) })
111
+ ), N = M == null ? void 0 : M.data;
112
+ if (!(N != null && N.id)) throw new Error("No id came back");
113
+ await g.request(
114
+ ee(`/collection-layouts/${N.id}`, {
115
+ conditions: ue(N.conditions, o.key, b)
116
116
  })
117
- ), i.invalidateQueries({ queryKey: pe.layouts(e) }), d(), E.success(
118
- o === "phone" ? "Phone version made: remove what a phone does not need" : "Tablet version made: arrange it for a tablet-width screen"
119
- ), $(Number(v.id));
117
+ ), l.invalidateQueries({ queryKey: ge.layouts(t) }), p(), D.success(
118
+ i === "phone" ? "Phone version made: remove what a phone does not need" : "Tablet version made: arrange it for a tablet-width screen"
119
+ ), h(Number(N.id));
120
120
  } catch (a) {
121
- E.error(me(a, `Could not make the ${n.word} version`).message);
121
+ D.error(pe(a, `Could not make the ${o.word} version`).message);
122
122
  } finally {
123
- T(!1);
123
+ S(!1);
124
124
  }
125
125
  };
126
- return D != null ? /* @__PURE__ */ t(C, { k: `layout.conditions.${n.key}`, children: /* @__PURE__ */ l("p", { className: N, "data-screen-version-blocked": o, children: [
126
+ return e != null ? /* @__PURE__ */ n(z, { k: `layout.conditions.${o.key}`, children: /* @__PURE__ */ c("p", { className: L, "data-screen-version-blocked": i, children: [
127
127
  "This form is the ",
128
128
  s.word,
129
129
  " version of another form, so it cannot have a ",
130
- n.word,
130
+ o.word,
131
131
  " ",
132
132
  "version."
133
- ] }) }) : /* @__PURE__ */ t(
134
- C,
133
+ ] }) }) : /* @__PURE__ */ n(
134
+ z,
135
135
  {
136
- k: `layout.conditions.${n.key}`,
137
- note: p != null ? /* @__PURE__ */ l(
136
+ k: `layout.conditions.${o.key}`,
137
+ note: v != null ? /* @__PURE__ */ c(
138
138
  "span",
139
139
  {
140
- "data-phone-of": o === "phone" ? p : void 0,
141
- "data-tablet-of": o === "tablet" ? p : void 0,
140
+ "data-phone-of": i === "phone" ? v : void 0,
141
+ "data-tablet-of": i === "tablet" ? v : void 0,
142
142
  children: [
143
143
  "This form opens instead of",
144
144
  " ",
145
- /* @__PURE__ */ t("strong", { className: "font-medium text-slate-700 dark:text-foreground", children: (b == null ? void 0 : b.name) ?? `form ${p}` }),
145
+ /* @__PURE__ */ n("strong", { className: "font-medium text-slate-700 dark:text-foreground", children: (u == null ? void 0 : u.name) ?? `form ${v}` }),
146
146
  " ",
147
147
  "on ",
148
- n.where,
148
+ o.where,
149
149
  ", for the records and roles that form gets."
150
150
  ]
151
151
  }
152
152
  ) : null,
153
- children: w ? /* @__PURE__ */ l(
153
+ children: d ? /* @__PURE__ */ c(
154
154
  "div",
155
155
  {
156
- "data-phone-version": o === "phone" ? w.id : void 0,
157
- "data-tablet-version": o === "tablet" ? w.id : void 0,
156
+ "data-phone-version": i === "phone" ? d.id : void 0,
157
+ "data-tablet-version": i === "tablet" ? d.id : void 0,
158
158
  className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-700 dark:text-foreground",
159
159
  children: [
160
- /* @__PURE__ */ t(h, { className: "h-3.5 w-3.5 shrink-0 text-slate-500 dark:text-muted-foreground" }),
161
- /* @__PURE__ */ t("span", { className: "min-w-0 truncate", children: w.name }),
162
- m.layoutLink && /* @__PURE__ */ t("button", { type: "button", className: y, onClick: () => $(w.id), children: "Open" })
160
+ /* @__PURE__ */ n(y, { className: "h-3.5 w-3.5 shrink-0 text-slate-500 dark:text-muted-foreground" }),
161
+ /* @__PURE__ */ n("span", { className: "min-w-0 truncate", children: d.name }),
162
+ f.layoutLink && /* @__PURE__ */ n("button", { type: "button", className: k, onClick: () => h(d.id), children: "Open" })
163
163
  ]
164
164
  }
165
- ) : /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-2", children: [
166
- /* @__PURE__ */ t(
167
- fe,
165
+ ) : /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
166
+ /* @__PURE__ */ n(
167
+ j,
168
168
  {
169
- ariaLabel: o === "phone" ? "Phone version of" : "Tablet version of",
170
- value: p != null ? String(p) : null,
171
- placeholder: `Not a ${n.word} version`,
172
- clearLabel: `Not a ${n.word} version`,
173
- options: S.filter((a) => a.id !== u && re(a.conditions) == null).map((a) => ({ value: String(a.id), label: a.name })),
174
- onChange: (a) => c.set(
175
- n.patch(r.conditions, a ? Number(a) : null),
176
- a ? `Make this a ${n.word} version` : `Stop being a ${n.word} version`
169
+ ariaLabel: i === "phone" ? "Phone version of" : "Tablet version of",
170
+ value: v != null ? String(v) : null,
171
+ placeholder: `Not a ${o.word} version`,
172
+ clearLabel: `Not a ${o.word} version`,
173
+ options: w.filter((a) => a.id !== b && T(a.conditions) == null).map((a) => ({ value: String(a.id), label: a.name })),
174
+ onChange: (a) => m.set(
175
+ o.patch(r.conditions, a ? Number(a) : null),
176
+ a ? `Make this a ${o.word} version` : `Stop being a ${o.word} version`
177
177
  ),
178
- className: "w-[220px]"
178
+ className: "w-[220px]",
179
+ matchTriggerWidth: !0
179
180
  }
180
181
  ),
181
- p == null && /* @__PURE__ */ l(
182
+ v == null && /* @__PURE__ */ c(
182
183
  "button",
183
184
  {
184
185
  type: "button",
185
- className: y,
186
- disabled: F,
187
- "data-action": `make-${n.word}-version`,
188
- onClick: () => void M(),
186
+ className: k,
187
+ disabled: x,
188
+ "data-action": `make-${o.word}-version`,
189
+ onClick: () => void E(),
189
190
  children: [
190
- /* @__PURE__ */ t(h, { className: "h-3.5 w-3.5" }),
191
- F ? "Making…" : `Make a ${n.word} version`
191
+ /* @__PURE__ */ n(y, { className: "h-3.5 w-3.5" }),
192
+ x ? "Making…" : `Make a ${o.word} version`
192
193
  ]
193
194
  }
194
195
  ),
195
- b && m.layoutLink && /* @__PURE__ */ l("button", { type: "button", className: y, onClick: () => $(b.id), children: [
196
+ u && f.layoutLink && /* @__PURE__ */ c("button", { type: "button", className: k, onClick: () => h(u.id), children: [
196
197
  "Open ",
197
- b.name
198
+ u.name
198
199
  ] })
199
200
  ] })
200
201
  }
201
202
  );
202
203
  }
203
- function Ie(c) {
204
- const { layout: r } = c, { userId: e } = Q(), o = X(r.conditions), n = Y(r.conditions), [s, h] = x(""), [u, m] = x(""), f = s > L() && u.trim().length >= 3, i = () => {
205
- f && (c.set(
206
- I(r.conditions, {
204
+ function Re(m) {
205
+ const { layout: r, collection: t } = m, i = B(t);
206
+ if (C(r) !== "summary" || T(r.conditions) != null) return null;
207
+ const o = Number(r.id), s = P(r.conditions), y = i.filter(
208
+ (e) => C(e) === "grouped" && T(e.conditions) == null
209
+ ), b = i.filter((e) => e.id !== o && C(e) === "summary"), f = (e, d) => m.set(me(r.conditions, e), d), g = (e) => [e.is_active ? 0 : 1, Number(e.sort ?? 0), Number(e.id)], l = (e, d) => {
210
+ const [u, h] = [g(e), g(d)];
211
+ return u[0] - h[0] || u[1] - h[1] || u[2] - h[2];
212
+ }, p = (e, d) => l(e, d) < 0, O = [r, ...b.filter((e) => T(e.conditions) == null)].sort(
213
+ l
214
+ ), x = O.find((e) => !!e.is_active || P(e.conditions).length === 0) ?? null, S = x != null && Number(x.id) === o, W = new Set(O.flatMap((e) => P(e.conditions))), w = s.length > 0 && !x ? y.filter((e) => !W.has(e.id)).length : 0, v = s.length > 0 ? S ? "Also the default: forms without their own Summary get this one." : null : S ? "This is the default Summary: every form without its own Summary gets it." : "Pick forms to give them this Summary instead of the default.";
215
+ return /* @__PURE__ */ n(z, { k: "layout.conditions.summary_for", note: v, children: /* @__PURE__ */ c("div", { className: "space-y-1.5", "data-summary-for": s.join(","), children: [
216
+ s.map((e) => {
217
+ const d = y.find((a) => a.id === e), u = (d == null ? void 0 : d.name) ?? `Form ${e}`, h = b.find((a) => P(a.conditions).includes(e)), E = h ? p(h, r) : !1;
218
+ return /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5", children: [
219
+ /* @__PURE__ */ n(
220
+ be,
221
+ {
222
+ label: u,
223
+ onRemove: () => f(
224
+ s.filter((a) => a !== e),
225
+ `Stop using for “${u}”`
226
+ )
227
+ }
228
+ ),
229
+ h && /* @__PURE__ */ n(
230
+ "span",
231
+ {
232
+ "data-summary-clash": e,
233
+ className: "basis-full text-[11.5px] text-amber-700 dark:text-amber-400",
234
+ children: E ? `Also pinned to “${h.name}”, which comes first, so “${h.name}” is used` : `Also pinned to “${h.name}”; this Summary comes first, so it is used`
235
+ }
236
+ )
237
+ ] }, e);
238
+ }),
239
+ /* @__PURE__ */ n(
240
+ j,
241
+ {
242
+ ariaLabel: "Add a form",
243
+ value: null,
244
+ placeholder: s.length ? "Add another form" : "Pick forms",
245
+ emptyText: "No more forms",
246
+ options: y.filter((e) => !s.includes(e.id)).map((e) => ({ value: String(e.id), label: e.name })),
247
+ onChange: (e) => {
248
+ var u;
249
+ if (!e) return;
250
+ const d = ((u = y.find((h) => String(h.id) === e)) == null ? void 0 : u.name) ?? `Form ${e}`;
251
+ f([...s, Number(e)], `Use for “${d}”`);
252
+ },
253
+ className: "w-[220px]",
254
+ matchTriggerWidth: !0
255
+ }
256
+ ),
257
+ w > 0 && /* @__PURE__ */ c(
258
+ "p",
259
+ {
260
+ "data-summary-orphans": w,
261
+ className: "text-[11.5px] text-amber-700 dark:text-amber-400",
262
+ children: [
263
+ w === 1 ? "Pinning this leaves 1 form with no Summary — it opens read-only." : `Pinning this leaves ${w} forms with no Summary — they open read-only.`,
264
+ " ",
265
+ "Make another Summary the default, or make this one the default to keep it for them."
266
+ ]
267
+ }
268
+ )
269
+ ] }) });
270
+ }
271
+ function _e(m) {
272
+ const { layout: r } = m, { userId: t } = X(), i = te(r.conditions), o = ne(r.conditions), [s, y] = F(""), [b, f] = F(""), g = s > R() && b.trim().length >= 3, l = () => {
273
+ g && (m.set(
274
+ K(r.conditions, {
207
275
  until: s,
208
- reason: u.trim().slice(0, 300),
209
- by: e || null,
276
+ reason: b.trim().slice(0, 300),
277
+ by: t || null,
210
278
  at: (/* @__PURE__ */ new Date()).toISOString()
211
279
  }),
212
- `Freeze edits until ${k(s)}`
213
- ), h(""), m(""));
280
+ `Freeze edits until ${A(s)}`
281
+ ), y(""), f(""));
214
282
  };
215
- return /* @__PURE__ */ t(C, { k: "layout.conditions.freeze", children: o ? /* @__PURE__ */ l(
283
+ return /* @__PURE__ */ n(z, { k: "layout.conditions.freeze", children: i ? /* @__PURE__ */ c(
216
284
  "div",
217
285
  {
218
- "data-layout-frozen": o.until,
219
- className: g(
286
+ "data-layout-frozen": i.until,
287
+ className: $(
220
288
  "flex flex-wrap items-center gap-2 rounded-md border px-2.5 py-2 text-[12.5px]",
221
- n ? ue : "border-slate-200 text-slate-600 dark:border-border dark:text-muted-foreground"
289
+ o ? ye : "border-slate-200 text-slate-600 dark:border-border dark:text-muted-foreground"
222
290
  ),
223
291
  children: [
224
- /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5 shrink-0" }),
225
- /* @__PURE__ */ l("span", { className: "min-w-0 flex-1", children: [
226
- n ? "Frozen until " : "The freeze ended on ",
227
- k(o.until),
228
- o.reason ? `: ${o.reason}` : ""
292
+ /* @__PURE__ */ n(q, { className: "h-3.5 w-3.5 shrink-0" }),
293
+ /* @__PURE__ */ c("span", { className: "min-w-0 flex-1", children: [
294
+ o ? "Frozen until " : "The freeze ended on ",
295
+ A(i.until),
296
+ i.reason ? `: ${i.reason}` : ""
229
297
  ] }),
230
- /* @__PURE__ */ t(
298
+ /* @__PURE__ */ n(
231
299
  "button",
232
300
  {
233
301
  type: "button",
234
- className: y,
302
+ className: k,
235
303
  "data-action": "lift-freeze",
236
- onClick: () => c.set(
237
- I(r.conditions, null),
238
- n ? "Lift the edit freeze" : "Remove the ended freeze"
304
+ onClick: () => m.set(
305
+ K(r.conditions, null),
306
+ o ? "Lift the edit freeze" : "Remove the ended freeze"
239
307
  ),
240
- children: n ? "Lift" : "Remove"
308
+ children: o ? "Lift" : "Remove"
241
309
  }
242
310
  )
243
311
  ]
244
312
  }
245
- ) : /* @__PURE__ */ l("div", { className: "flex flex-wrap items-end gap-2", children: [
246
- /* @__PURE__ */ l("label", { className: "flex flex-col gap-1", children: [
247
- /* @__PURE__ */ t("span", { className: N, children: "Until" }),
248
- /* @__PURE__ */ t(
313
+ ) : /* @__PURE__ */ c("div", { className: "flex flex-wrap items-end gap-2", children: [
314
+ /* @__PURE__ */ c("label", { className: "flex flex-col gap-1", children: [
315
+ /* @__PURE__ */ n("span", { className: L, children: "Until" }),
316
+ /* @__PURE__ */ n(
249
317
  "input",
250
318
  {
251
319
  type: "date",
252
320
  "aria-label": "Frozen until",
253
321
  value: s,
254
- min: L(),
255
- onChange: (d) => h(d.target.value),
256
- className: O
322
+ min: R(),
323
+ onChange: (p) => y(p.target.value),
324
+ className: _
257
325
  }
258
326
  )
259
327
  ] }),
260
- /* @__PURE__ */ l("label", { className: "flex min-w-[180px] flex-1 flex-col gap-1", children: [
261
- /* @__PURE__ */ t("span", { className: N, children: "Reason people see" }),
262
- /* @__PURE__ */ t(
328
+ /* @__PURE__ */ c("label", { className: "flex min-w-[180px] flex-1 flex-col gap-1", children: [
329
+ /* @__PURE__ */ n("span", { className: L, children: "Reason people see" }),
330
+ /* @__PURE__ */ n(
263
331
  "input",
264
332
  {
265
- value: u,
333
+ value: b,
266
334
  maxLength: 300,
267
335
  placeholder: "e.g. Go-live on Monday",
268
- onChange: (d) => m(d.target.value),
269
- onKeyDown: (d) => {
270
- d.key === "Enter" && i();
336
+ onChange: (p) => f(p.target.value),
337
+ onKeyDown: (p) => {
338
+ p.key === "Enter" && l();
271
339
  },
272
- className: g(R, "h-8")
340
+ className: $(V, "h-8")
273
341
  }
274
342
  )
275
343
  ] }),
276
- /* @__PURE__ */ l(
344
+ /* @__PURE__ */ c(
277
345
  "button",
278
346
  {
279
347
  type: "button",
280
- className: g(y, "mb-0.5"),
281
- disabled: !f,
348
+ className: $(k, "mb-0.5"),
349
+ disabled: !g,
282
350
  "data-action": "freeze",
283
- onClick: i,
351
+ onClick: l,
284
352
  children: [
285
- /* @__PURE__ */ t(P, { className: "h-3.5 w-3.5" }),
353
+ /* @__PURE__ */ n(q, { className: "h-3.5 w-3.5" }),
286
354
  "Freeze"
287
355
  ]
288
356
  }
@@ -290,8 +358,9 @@ function Ie(c) {
290
358
  ] }) });
291
359
  }
292
360
  export {
293
- Te as ActiveDatesSetting,
294
- Ie as FreezeSetting,
295
- Pe as PhoneVersionSetting,
296
- Ee as TabletVersionSetting
361
+ We as ActiveDatesSetting,
362
+ _e as FreezeSetting,
363
+ Ee as PhoneVersionSetting,
364
+ Re as SummaryForSetting,
365
+ Me as TabletVersionSetting
297
366
  };