@handled-ai/design-system 0.20.13 → 0.20.15

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.
@@ -113,9 +113,10 @@ function TimelineSection({
113
113
  setShowSystemEvents,
114
114
  attentionCount,
115
115
  sysEvtConfig,
116
- lastActivityTime
116
+ lastActivityTime,
117
+ isCasePanel = false
117
118
  }) {
118
- var _a;
119
+ var _a, _b, _c, _d;
119
120
  const visibleEvents = [];
120
121
  let hiddenCount = 0;
121
122
  for (const e of timelineEvents) {
@@ -124,74 +125,120 @@ function TimelineSection({
124
125
  }
125
126
  const hasSystemNoise = hiddenCount > 0;
126
127
  const toggleLabel = (_a = sysEvtConfig == null ? void 0 : sysEvtConfig.toggleLabel) != null ? _a : "System events";
128
+ const toggleHelp = showSystemEvents ? (_c = (_b = sysEvtConfig == null ? void 0 : sysEvtConfig.visibleHint) == null ? void 0 : _b.replace("{count}", String(hiddenCount))) != null ? _c : "Hide system events" : (_d = sysEvtConfig == null ? void 0 : sysEvtConfig.hiddenHint) != null ? _d : "Show system events";
127
129
  const firstVisibleTime = (!hasSystemNoise || showSystemEvents) && lastActivityTime ? lastActivityTime : visibleEvents.length > 0 ? visibleEvents[0].time : "";
128
130
  const visibleCount = visibleEvents.length;
129
131
  const eventCountLabel = `${visibleCount} ${visibleCount === 1 ? "event" : "events"}`;
130
- return /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
131
- /* @__PURE__ */ jsxs(
132
- "div",
133
- {
134
- className: "group/timeline flex w-full items-center justify-between gap-2 py-2 rounded-md transition-colors hover:bg-muted/40 -mx-2 px-2",
135
- "data-testid": "timeline-header",
136
- children: [
137
- /* @__PURE__ */ jsxs(
138
- "button",
139
- {
140
- type: "button",
141
- onClick: () => setShowTimeline((prev) => !prev),
142
- className: "flex items-center gap-2 cursor-pointer bg-transparent border-0 p-0",
143
- "data-testid": "timeline-collapse-btn",
144
- children: [
145
- /* @__PURE__ */ jsx("h3", { className: "text-xs font-bold text-muted-foreground uppercase tracking-wider group-hover/timeline:text-foreground transition-colors", children: "Activity timeline" }),
146
- !showTimeline && attentionCount != null && attentionCount > 0 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-1.5 py-0.5 text-[10px] font-semibold text-destructive border border-destructive/20", children: [
147
- attentionCount,
148
- " new"
149
- ] }),
150
- !showTimeline && firstVisibleTime && /* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground/60", "data-testid": "last-activity-hint", children: [
151
- "\xB7 Last activity ",
152
- firstVisibleTime
153
- ] }),
154
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
155
- /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-muted-foreground", "data-testid": "event-count", children: eventCountLabel }),
156
- /* @__PURE__ */ jsx(ChevronDown, { className: `h-3.5 w-3.5 text-muted-foreground transition-transform duration-200 ${showTimeline ? "rotate-180" : ""}` })
157
- ] })
158
- ]
159
- }
160
- ),
161
- hasSystemNoise && /* @__PURE__ */ jsxs(
162
- "button",
163
- {
164
- type: "button",
165
- onClick: () => setShowSystemEvents((prev) => !prev),
166
- className: cn(
167
- "flex shrink-0 cursor-pointer items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] font-medium transition-colors hover:text-foreground",
168
- showSystemEvents ? "border-primary/40 bg-primary/10 text-primary shadow-sm hover:bg-primary/15" : "border-border bg-background text-muted-foreground hover:bg-muted/40"
132
+ return /* @__PURE__ */ jsxs(
133
+ "div",
134
+ {
135
+ className: cn(
136
+ isCasePanel ? "mt-8 border-t border-border pt-8 pb-8" : "mb-8"
137
+ ),
138
+ children: [
139
+ /* @__PURE__ */ jsxs(
140
+ "div",
141
+ {
142
+ className: cn(
143
+ "flex w-full items-center justify-between",
144
+ isCasePanel ? "gap-4 border-b border-border pb-5" : "group/timeline gap-2 rounded-md py-2 transition-colors hover:bg-muted/40 -mx-2 px-2"
145
+ ),
146
+ "data-testid": "timeline-header",
147
+ children: [
148
+ /* @__PURE__ */ jsxs(
149
+ "button",
150
+ {
151
+ type: "button",
152
+ onClick: () => setShowTimeline((prev) => !prev),
153
+ className: "flex min-w-0 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-left",
154
+ "data-testid": "timeline-collapse-btn",
155
+ children: [
156
+ /* @__PURE__ */ jsx("h3", { className: "text-xs font-bold uppercase tracking-[0.16em] text-muted-foreground transition-colors group-hover/timeline:text-foreground", children: "ACTIVITY TIMELINE" }),
157
+ !showTimeline && attentionCount != null && attentionCount > 0 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 rounded-full bg-destructive/10 px-1.5 py-0.5 text-[10px] font-semibold text-destructive border border-destructive/20", children: [
158
+ attentionCount,
159
+ " new"
160
+ ] }),
161
+ !isCasePanel && !showTimeline && firstVisibleTime && /* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground/60", "data-testid": "last-activity-hint", children: [
162
+ "\xB7 Last activity ",
163
+ firstVisibleTime
164
+ ] })
165
+ ]
166
+ }
169
167
  ),
170
- "aria-pressed": showSystemEvents,
171
- "data-testid": "system-events-toggle",
172
- children: [
173
- toggleLabel,
174
- /* @__PURE__ */ jsx(
175
- "span",
168
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-4", children: [
169
+ hasSystemNoise && /* @__PURE__ */ jsxs(
170
+ "button",
176
171
  {
172
+ type: "button",
173
+ onClick: () => setShowSystemEvents((prev) => !prev),
177
174
  className: cn(
178
- "inline-flex min-w-[18px] items-center justify-center rounded-full px-1.5 text-[10px] font-semibold tabular-nums",
179
- showSystemEvents ? "bg-primary/15 text-primary ring-1 ring-primary/30" : "bg-muted text-muted-foreground ring-1 ring-border/70"
175
+ "inline-flex shrink-0 cursor-pointer items-center rounded-full border transition-colors",
176
+ isCasePanel ? "gap-2 px-2.5 py-1 text-xs font-medium" : "gap-3 px-3.5 py-2 text-sm font-semibold",
177
+ showSystemEvents ? isCasePanel ? "border-border bg-muted text-foreground shadow-sm hover:bg-muted/80" : "border-foreground bg-foreground text-background shadow-sm hover:bg-foreground/90" : "border-border bg-background text-muted-foreground shadow-sm hover:bg-muted/40 hover:text-foreground"
180
178
  ),
181
- "data-testid": "hidden-count-badge",
182
- children: hiddenCount
179
+ "aria-pressed": showSystemEvents,
180
+ "aria-label": toggleHelp,
181
+ title: toggleHelp,
182
+ "data-testid": "system-events-toggle",
183
+ children: [
184
+ /* @__PURE__ */ jsx(
185
+ "span",
186
+ {
187
+ className: cn(
188
+ "relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors",
189
+ isCasePanel ? "h-3.5 w-7" : "h-4 w-8",
190
+ showSystemEvents ? "bg-teal-600" : "bg-muted-foreground/25"
191
+ ),
192
+ "aria-hidden": "true",
193
+ "data-testid": "system-events-indicator",
194
+ children: /* @__PURE__ */ jsx(
195
+ "span",
196
+ {
197
+ className: cn(
198
+ "block rounded-full bg-white shadow-sm transition-transform",
199
+ isCasePanel ? "h-2.5 w-2.5" : "h-3 w-3",
200
+ showSystemEvents ? isCasePanel ? "translate-x-3.5" : "translate-x-4" : "translate-x-0"
201
+ )
202
+ }
203
+ )
204
+ }
205
+ ),
206
+ /* @__PURE__ */ jsx("span", { children: toggleLabel }),
207
+ !showSystemEvents ? /* @__PURE__ */ jsx(
208
+ "span",
209
+ {
210
+ className: cn("inline-flex items-center justify-center rounded-full bg-muted px-1.5 font-bold tabular-nums text-muted-foreground", isCasePanel ? "min-w-5 text-[11px]" : "min-w-[22px] text-xs"),
211
+ "data-testid": "hidden-count-badge",
212
+ children: hiddenCount
213
+ }
214
+ ) : null
215
+ ]
216
+ }
217
+ ),
218
+ /* @__PURE__ */ jsxs(
219
+ "button",
220
+ {
221
+ type: "button",
222
+ onClick: () => setShowTimeline((prev) => !prev),
223
+ className: cn(
224
+ "inline-flex shrink-0 cursor-pointer items-center border-0 bg-transparent p-0 text-muted-foreground transition-colors hover:text-foreground",
225
+ isCasePanel ? "gap-3 text-sm" : "gap-1.5 text-[11px]"
226
+ ),
227
+ "aria-label": showTimeline ? "Collapse activity timeline" : "Expand activity timeline",
228
+ children: [
229
+ /* @__PURE__ */ jsx("span", { className: "font-medium", "data-testid": "event-count", children: eventCountLabel }),
230
+ /* @__PURE__ */ jsx(ChevronDown, { className: `h-3.5 w-3.5 transition-transform duration-200 ${showTimeline ? "rotate-180" : ""}` })
231
+ ]
183
232
  }
184
233
  )
185
- ]
186
- }
187
- )
188
- ]
189
- }
190
- ),
191
- showTimeline && visibleEvents.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(TimelineActivity, { events: visibleEvents, variant: "case-panel" }) }),
192
- showTimeline && !showSystemEvents && (sysEvtConfig == null ? void 0 : sysEvtConfig.hiddenHint) && hasSystemNoise && /* @__PURE__ */ jsx("p", { className: "mt-2 text-[11px] text-muted-foreground/60 border-t border-dashed border-border pt-2", "data-testid": "timeline-footer-hint", children: sysEvtConfig.hiddenHint }),
193
- showTimeline && showSystemEvents && (sysEvtConfig == null ? void 0 : sysEvtConfig.visibleHint) && hasSystemNoise && /* @__PURE__ */ jsx("p", { className: "mt-2 text-[11px] text-muted-foreground/60 border-t border-dashed border-border pt-2", "data-testid": "timeline-footer-hint", children: sysEvtConfig.visibleHint.replace("{count}", String(hiddenCount)) })
194
- ] });
234
+ ] })
235
+ ]
236
+ }
237
+ ),
238
+ showTimeline && visibleEvents.length > 0 && /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(TimelineActivity, { events: visibleEvents, variant: "case-panel" }) })
239
+ ]
240
+ }
241
+ );
195
242
  }
196
243
  function DetailView({
197
244
  item,
@@ -260,6 +307,7 @@ function DetailView({
260
307
  timelineSystemEventsHiddenHint,
261
308
  timelineSystemEventsVisibleHint
262
309
  ]);
310
+ const isCasePanelV2 = sectionLayout === "case-panel-v2";
263
311
  const [showTimeline, setShowTimeline] = React.useState(false);
264
312
  const [extraActions, setExtraActions] = React.useState([]);
265
313
  const sysEvtDefaultVisible = (_a = sysEvtConfig == null ? void 0 : sysEvtConfig.defaultVisible) != null ? _a : false;
@@ -267,7 +315,8 @@ function DetailView({
267
315
  const [showSystemEvents, setShowSystemEvents] = React.useState(sysEvtDefaultVisible);
268
316
  const initialReadDoneRef = React.useRef(false);
269
317
  React.useEffect(() => {
270
- if (!sysEvtStorageKey) {
318
+ if (!sysEvtStorageKey || isCasePanelV2) {
319
+ setShowSystemEvents(sysEvtDefaultVisible);
271
320
  initialReadDoneRef.current = true;
272
321
  return;
273
322
  }
@@ -275,19 +324,22 @@ function DetailView({
275
324
  const stored = localStorage.getItem(sysEvtStorageKey);
276
325
  if (stored !== null) {
277
326
  setShowSystemEvents(stored === "true");
327
+ } else {
328
+ setShowSystemEvents(sysEvtDefaultVisible);
278
329
  }
279
330
  } catch (e) {
331
+ setShowSystemEvents(sysEvtDefaultVisible);
280
332
  }
281
333
  initialReadDoneRef.current = true;
282
- }, [sysEvtStorageKey]);
334
+ }, [isCasePanelV2, sysEvtDefaultVisible, sysEvtStorageKey]);
283
335
  React.useEffect(() => {
284
- if (!sysEvtStorageKey) return;
336
+ if (!sysEvtStorageKey || isCasePanelV2) return;
285
337
  if (!initialReadDoneRef.current) return;
286
338
  try {
287
339
  localStorage.setItem(sysEvtStorageKey, String(showSystemEvents));
288
340
  } catch (e) {
289
341
  }
290
- }, [showSystemEvents, sysEvtStorageKey]);
342
+ }, [isCasePanelV2, showSystemEvents, sysEvtStorageKey]);
291
343
  React.useEffect(() => {
292
344
  setShowTimeline(false);
293
345
  setExtraActions([]);
@@ -320,7 +372,6 @@ function DetailView({
320
372
  [suggestedActions]
321
373
  );
322
374
  const timeChipToneClass = signalData.timeChipTone === "red" ? "border-red-300 bg-red-50 text-red-700 hover:bg-red-50" : signalData.timeChipTone === "amber" ? "border-amber-300 bg-amber-50 text-amber-700 hover:bg-amber-50" : "hover:bg-muted/50";
323
- const isCasePanelV2 = sectionLayout === "case-panel-v2";
324
375
  const metadataChips = /* @__PURE__ */ jsxs(Fragment, { children: [
325
376
  /* @__PURE__ */ jsx(
326
377
  SignalPriorityPopover,
@@ -387,7 +438,8 @@ function DetailView({
387
438
  setShowSystemEvents,
388
439
  attentionCount,
389
440
  sysEvtConfig,
390
- lastActivityTime
441
+ lastActivityTime,
442
+ isCasePanel: isCasePanelV2
391
443
  }
392
444
  ) : null;
393
445
  const suggestedActionsSection = sections.suggestedActions ? /* @__PURE__ */ jsx(SignalApproval.Gate, { children: /* @__PURE__ */ jsx(
@@ -481,9 +533,11 @@ function DetailView({
481
533
  /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(SignalApproval.Actions, {}) })
482
534
  ] })
483
535
  ] }) : null,
484
- renderAfterScore == null ? void 0 : renderAfterScore(item),
485
- renderPrimaryAction == null ? void 0 : renderPrimaryAction(item),
486
- renderCommentArea == null ? void 0 : renderCommentArea(item),
536
+ /* @__PURE__ */ jsxs("div", { "data-slot": "case-panel-workflow-stack", className: "space-y-10", children: [
537
+ renderAfterScore == null ? void 0 : renderAfterScore(item),
538
+ renderPrimaryAction == null ? void 0 : renderPrimaryAction(item),
539
+ renderCommentArea ? /* @__PURE__ */ jsx("div", { "data-slot": "case-panel-comment-area", children: renderCommentArea(item) }) : null
540
+ ] }),
487
541
  timelineSection
488
542
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
489
543
  renderAfterScore == null ? void 0 : renderAfterScore(item),