@wealthx/shadcn 1.5.40 → 1.5.41

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 (30) hide show
  1. package/.turbo/turbo-build.log +84 -84
  2. package/CHANGELOG.md +6 -0
  3. package/dist/{chunk-MGIDYXOP.mjs → chunk-DWNLBUDC.mjs} +459 -67
  4. package/dist/{chunk-EFHPSKVF.mjs → chunk-EGM4DARZ.mjs} +110 -1
  5. package/dist/{chunk-STN5QIWN.mjs → chunk-GIQGZFP6.mjs} +102 -45
  6. package/dist/{chunk-B5PSUONN.mjs → chunk-TF5TOVIM.mjs} +1 -1
  7. package/dist/{chunk-RRROLESJ.mjs → chunk-XHZONBL4.mjs} +1 -1
  8. package/dist/components/ui/ai-assistant-drawer.js +101 -0
  9. package/dist/components/ui/ai-assistant-drawer.mjs +2 -2
  10. package/dist/components/ui/ai-conversations/index.js +101 -0
  11. package/dist/components/ui/ai-conversations/index.mjs +2 -2
  12. package/dist/components/ui/chat-input-area.js +101 -0
  13. package/dist/components/ui/chat-input-area.mjs +1 -1
  14. package/dist/components/ui/policy-ai/index.js +818 -261
  15. package/dist/components/ui/policy-ai/index.mjs +11 -2
  16. package/dist/components/ui/support-agent/index.js +202 -44
  17. package/dist/components/ui/support-agent/index.mjs +2 -2
  18. package/dist/index.js +3490 -3329
  19. package/dist/index.mjs +5 -5
  20. package/dist/styles.css +1 -1
  21. package/package.json +1 -1
  22. package/src/components/ui/chat-input-area.tsx +181 -2
  23. package/src/components/ui/policy-ai/index.tsx +12 -0
  24. package/src/components/ui/policy-ai/policy-ai-context-sidebar.tsx +231 -0
  25. package/src/components/ui/policy-ai/policy-ai-history-panel.tsx +175 -0
  26. package/src/components/ui/policy-ai/policy-ai-page.tsx +243 -0
  27. package/src/components/ui/policy-ai/policy-ai-panel.tsx +64 -57
  28. package/src/components/ui/policy-ai/policy-ai-responses.tsx +8 -12
  29. package/src/components/ui/support-agent/support-agent-panel.tsx +124 -46
  30. package/src/styles/styles-css.ts +1 -1
@@ -284,6 +284,54 @@ function RichContentRenderer({ richContent }: RichContentRendererProps) {
284
284
  return null;
285
285
  }
286
286
 
287
+ // ---------------------------------------------------------------------------
288
+ // Local sub-components
289
+ // ---------------------------------------------------------------------------
290
+
291
+ /** Reusable close button — consistent across all panel header variants. */
292
+ function CloseButton({ onClick }: { onClick: () => void }) {
293
+ return (
294
+ <Button
295
+ variant="ghost"
296
+ size="icon"
297
+ className="size-7 shrink-0"
298
+ onClick={onClick}
299
+ title="Close"
300
+ >
301
+ <X className="size-3.5" />
302
+ <span className="sr-only">Close</span>
303
+ </Button>
304
+ );
305
+ }
306
+
307
+ /** Single conversation row — used in both home recents and all-conversations list. */
308
+ function ConversationRow({
309
+ conv,
310
+ onClick,
311
+ className,
312
+ }: {
313
+ conv: SupportAgentRecentConversation;
314
+ onClick: () => void;
315
+ className?: string;
316
+ }) {
317
+ return (
318
+ <button
319
+ type="button"
320
+ onClick={onClick}
321
+ className={cn(
322
+ "flex w-full items-center justify-between gap-2 text-left text-sm text-foreground hover:bg-muted/50",
323
+ className,
324
+ )}
325
+ >
326
+ <span className="flex-1 truncate">{conv.title}</span>
327
+ <ChevronRight
328
+ className="size-3.5 shrink-0 text-muted-foreground"
329
+ aria-hidden="true"
330
+ />
331
+ </button>
332
+ );
333
+ }
334
+
287
335
  // ---------------------------------------------------------------------------
288
336
  // SupportAgentPanel
289
337
  // ---------------------------------------------------------------------------
@@ -308,6 +356,7 @@ export function SupportAgentPanel({
308
356
  className,
309
357
  }: SupportAgentPanelProps) {
310
358
  const [inputValue, setInputValue] = React.useState("");
359
+ const [showAllConversations, setShowAllConversations] = React.useState(false);
311
360
  const messagesEndRef = React.useRef<HTMLDivElement>(null);
312
361
 
313
362
  const hasMessages = messages.length > 0;
@@ -315,6 +364,11 @@ export function SupportAgentPanel({
315
364
  // Chat header mode: has messages AND a conversation title
316
365
  const isChatMode = hasMessages && !!conversationTitle;
317
366
 
367
+ // Reset "all conversations" view when panel closes
368
+ React.useEffect(() => {
369
+ if (!open) setShowAllConversations(false);
370
+ }, [open]);
371
+
318
372
  // Auto-scroll to latest message
319
373
  React.useEffect(() => {
320
374
  if (!messagesEndRef.current) return;
@@ -340,6 +394,16 @@ export function SupportAgentPanel({
340
394
  );
341
395
 
342
396
  const hasRecents = !!recentConversations?.length;
397
+ // Home state shows only the 3 most recent; "View all" expands to the full list.
398
+ const recentsPreview = React.useMemo(
399
+ () => recentConversations?.slice(0, 3) ?? [],
400
+ [recentConversations],
401
+ );
402
+
403
+ const handleViewAll = React.useCallback(() => {
404
+ setShowAllConversations(true);
405
+ onViewAllConversations?.(); // optional analytics callback
406
+ }, [onViewAllConversations]);
343
407
 
344
408
  return (
345
409
  <Sheet open={open} onOpenChange={(o) => !o && onClose()}>
@@ -354,7 +418,25 @@ export function SupportAgentPanel({
354
418
  >
355
419
  {/* ── Header ── */}
356
420
  <div className="shrink-0 border-b border-border px-3 py-2.5">
357
- {isChatMode ? (
421
+ {showAllConversations ? (
422
+ /* All-conversations mode: [←] All conversations [✕] */
423
+ <div className="flex items-center gap-1">
424
+ <Button
425
+ variant="ghost"
426
+ size="icon"
427
+ className="size-7 shrink-0"
428
+ onClick={() => setShowAllConversations(false)}
429
+ title="Back"
430
+ >
431
+ <ChevronLeft className="size-3.5" />
432
+ <span className="sr-only">Back</span>
433
+ </Button>
434
+ <span className="flex-1 truncate px-1 text-sm font-medium text-foreground">
435
+ All conversations
436
+ </span>
437
+ <CloseButton onClick={onClose} />
438
+ </div>
439
+ ) : isChatMode ? (
358
440
  /* Chat mode: [←] Conversation title [✕] */
359
441
  <div className="flex items-center gap-1">
360
442
  {onBack && (
@@ -372,16 +454,7 @@ export function SupportAgentPanel({
372
454
  <span className="flex-1 truncate px-1 text-sm font-medium text-foreground">
373
455
  {conversationTitle}
374
456
  </span>
375
- <Button
376
- variant="ghost"
377
- size="icon"
378
- className="size-7 shrink-0"
379
- onClick={onClose}
380
- title="Close"
381
- >
382
- <X className="size-3.5" />
383
- <span className="sr-only">Close</span>
384
- </Button>
457
+ <CloseButton onClick={onClose} />
385
458
  </div>
386
459
  ) : (
387
460
  /* Home mode: [Bot icon] Support Assistant [✕] */
@@ -397,20 +470,11 @@ export function SupportAgentPanel({
397
470
  Support Assistant
398
471
  </span>
399
472
  </div>
400
- <Button
401
- variant="ghost"
402
- size="icon"
403
- className="size-7"
404
- onClick={onClose}
405
- title="Close"
406
- >
407
- <X className="size-3.5" />
408
- <span className="sr-only">Close</span>
409
- </Button>
473
+ <CloseButton onClick={onClose} />
410
474
  </div>
411
475
  )}
412
- {/* Context chip — shown below header title in both modes */}
413
- {context && (
476
+ {/* Context chip — shown below header title in home and chat modes only */}
477
+ {context && !showAllConversations && (
414
478
  <div className="mt-2">
415
479
  <SupportContextChip context={context} />
416
480
  </div>
@@ -427,6 +491,27 @@ export function SupportAgentPanel({
427
491
  <p className="text-sm text-muted-foreground">Loading…</p>
428
492
  </div>
429
493
  </div>
494
+ ) : showAllConversations ? (
495
+ /* All conversations — full scrollable list (Jira Rovo pattern) */
496
+ <div className="flex flex-col">
497
+ {recentConversations?.length ? (
498
+ recentConversations.map((conv) => (
499
+ <ConversationRow
500
+ key={conv.id}
501
+ conv={conv}
502
+ onClick={() => {
503
+ setShowAllConversations(false);
504
+ onOpenConversation?.(conv.id);
505
+ }}
506
+ className="border-b border-border px-4 py-3"
507
+ />
508
+ ))
509
+ ) : (
510
+ <p className="p-4 text-sm text-muted-foreground">
511
+ No conversations yet.
512
+ </p>
513
+ )}
514
+ </div>
430
515
  ) : !hasMessages ? (
431
516
  /* Home state — Rovo pattern: New Chat CTA + Recents + Suggested */
432
517
  <div className="flex flex-col gap-5 p-4">
@@ -443,39 +528,31 @@ export function SupportAgentPanel({
443
528
  </Button>
444
529
  )}
445
530
 
446
- {/* Recents — previous conversations */}
531
+ {/* Recents — 3 most recent conversations */}
447
532
  {hasRecents && (
448
533
  <div className="flex flex-col gap-1">
449
534
  <p className="px-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">
450
535
  Recents
451
536
  </p>
452
537
  <div className="flex flex-col">
453
- {recentConversations!.map((conv) => (
454
- <button
538
+ {recentsPreview.map((conv) => (
539
+ <ConversationRow
455
540
  key={conv.id}
456
- type="button"
541
+ conv={conv}
457
542
  onClick={() => onOpenConversation?.(conv.id)}
458
- className="flex w-full items-center justify-between gap-2 px-1 py-2.5 text-left text-sm text-foreground hover:bg-muted/50"
459
- >
460
- <span className="flex-1 truncate">{conv.title}</span>
461
- <ChevronRight
462
- className="size-3.5 shrink-0 text-muted-foreground"
463
- aria-hidden="true"
464
- />
465
- </button>
543
+ className="px-1 py-2.5"
544
+ />
466
545
  ))}
467
546
  </div>
468
- {onViewAllConversations && (
469
- <Button
470
- variant="ghost"
471
- size="sm"
472
- onClick={onViewAllConversations}
473
- className="h-auto w-fit gap-0.5 px-1 py-1 text-xs text-muted-foreground hover:bg-transparent hover:text-foreground"
474
- >
475
- View all conversations
476
- <ChevronRight className="size-3.5" aria-hidden="true" />
477
- </Button>
478
- )}
547
+ <Button
548
+ variant="ghost"
549
+ size="sm"
550
+ onClick={handleViewAll}
551
+ className="h-auto w-fit gap-0.5 px-1 py-1 text-xs text-muted-foreground hover:bg-transparent hover:text-foreground"
552
+ >
553
+ View all conversations
554
+ <ChevronRight className="size-3.5" aria-hidden="true" />
555
+ </Button>
479
556
  </div>
480
557
  )}
481
558
 
@@ -534,6 +611,7 @@ export function SupportAgentPanel({
534
611
  onAttachImage={onAttachImage}
535
612
  disabled={isLoading || isStreaming}
536
613
  placeholder="Ask anything…"
614
+ showMarkdownToolbar
537
615
  />
538
616
  </div>
539
617
  </SheetContent>