@wealthx/shadcn 1.5.40 → 1.5.42

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 +103 -103
  2. package/CHANGELOG.md +12 -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-B5PSUONN.mjs → chunk-TF5TOVIM.mjs} +1 -1
  6. package/dist/{chunk-STN5QIWN.mjs → chunk-THOHFAW2.mjs} +119 -46
  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 +218 -44
  17. package/dist/components/ui/support-agent/index.mjs +2 -2
  18. package/dist/index.js +3506 -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 +153 -46
  30. package/src/styles/styles-css.ts +1 -1
@@ -136,6 +136,17 @@ export interface SupportAgentPanelProps {
136
136
  onOpenConversation?: (id: string) => void;
137
137
  /** Called when the user clicks "View all conversations". */
138
138
  onViewAllConversations?: () => void;
139
+ /**
140
+ * Pagination for the all-conversations list. When true, a "Load more" control is
141
+ * shown at the bottom of the all-conversations view; clicking it fires
142
+ * {@link onLoadMoreConversations}. The consumer appends the next page to
143
+ * `recentConversations`.
144
+ */
145
+ hasMoreConversations?: boolean;
146
+ /** Called when the user requests the next page in the all-conversations view. */
147
+ onLoadMoreConversations?: () => void;
148
+ /** True while the next page is loading — shows a spinner on the "Load more" control. */
149
+ isLoadingMoreConversations?: boolean;
139
150
  className?: string;
140
151
  }
141
152
 
@@ -284,6 +295,54 @@ function RichContentRenderer({ richContent }: RichContentRendererProps) {
284
295
  return null;
285
296
  }
286
297
 
298
+ // ---------------------------------------------------------------------------
299
+ // Local sub-components
300
+ // ---------------------------------------------------------------------------
301
+
302
+ /** Reusable close button — consistent across all panel header variants. */
303
+ function CloseButton({ onClick }: { onClick: () => void }) {
304
+ return (
305
+ <Button
306
+ variant="ghost"
307
+ size="icon"
308
+ className="size-7 shrink-0"
309
+ onClick={onClick}
310
+ title="Close"
311
+ >
312
+ <X className="size-3.5" />
313
+ <span className="sr-only">Close</span>
314
+ </Button>
315
+ );
316
+ }
317
+
318
+ /** Single conversation row — used in both home recents and all-conversations list. */
319
+ function ConversationRow({
320
+ conv,
321
+ onClick,
322
+ className,
323
+ }: {
324
+ conv: SupportAgentRecentConversation;
325
+ onClick: () => void;
326
+ className?: string;
327
+ }) {
328
+ return (
329
+ <button
330
+ type="button"
331
+ onClick={onClick}
332
+ className={cn(
333
+ "flex w-full items-center justify-between gap-2 text-left text-sm text-foreground hover:bg-muted/50",
334
+ className,
335
+ )}
336
+ >
337
+ <span className="flex-1 truncate">{conv.title}</span>
338
+ <ChevronRight
339
+ className="size-3.5 shrink-0 text-muted-foreground"
340
+ aria-hidden="true"
341
+ />
342
+ </button>
343
+ );
344
+ }
345
+
287
346
  // ---------------------------------------------------------------------------
288
347
  // SupportAgentPanel
289
348
  // ---------------------------------------------------------------------------
@@ -305,9 +364,13 @@ export function SupportAgentPanel({
305
364
  onBack,
306
365
  onOpenConversation,
307
366
  onViewAllConversations,
367
+ hasMoreConversations = false,
368
+ onLoadMoreConversations,
369
+ isLoadingMoreConversations = false,
308
370
  className,
309
371
  }: SupportAgentPanelProps) {
310
372
  const [inputValue, setInputValue] = React.useState("");
373
+ const [showAllConversations, setShowAllConversations] = React.useState(false);
311
374
  const messagesEndRef = React.useRef<HTMLDivElement>(null);
312
375
 
313
376
  const hasMessages = messages.length > 0;
@@ -315,6 +378,11 @@ export function SupportAgentPanel({
315
378
  // Chat header mode: has messages AND a conversation title
316
379
  const isChatMode = hasMessages && !!conversationTitle;
317
380
 
381
+ // Reset "all conversations" view when panel closes
382
+ React.useEffect(() => {
383
+ if (!open) setShowAllConversations(false);
384
+ }, [open]);
385
+
318
386
  // Auto-scroll to latest message
319
387
  React.useEffect(() => {
320
388
  if (!messagesEndRef.current) return;
@@ -340,6 +408,16 @@ export function SupportAgentPanel({
340
408
  );
341
409
 
342
410
  const hasRecents = !!recentConversations?.length;
411
+ // Home state shows only the 3 most recent; "View all" expands to the full list.
412
+ const recentsPreview = React.useMemo(
413
+ () => recentConversations?.slice(0, 3) ?? [],
414
+ [recentConversations],
415
+ );
416
+
417
+ const handleViewAll = React.useCallback(() => {
418
+ setShowAllConversations(true);
419
+ onViewAllConversations?.(); // optional analytics callback
420
+ }, [onViewAllConversations]);
343
421
 
344
422
  return (
345
423
  <Sheet open={open} onOpenChange={(o) => !o && onClose()}>
@@ -354,7 +432,25 @@ export function SupportAgentPanel({
354
432
  >
355
433
  {/* ── Header ── */}
356
434
  <div className="shrink-0 border-b border-border px-3 py-2.5">
357
- {isChatMode ? (
435
+ {showAllConversations ? (
436
+ /* All-conversations mode: [←] All conversations [✕] */
437
+ <div className="flex items-center gap-1">
438
+ <Button
439
+ variant="ghost"
440
+ size="icon"
441
+ className="size-7 shrink-0"
442
+ onClick={() => setShowAllConversations(false)}
443
+ title="Back"
444
+ >
445
+ <ChevronLeft className="size-3.5" />
446
+ <span className="sr-only">Back</span>
447
+ </Button>
448
+ <span className="flex-1 truncate px-1 text-sm font-medium text-foreground">
449
+ All conversations
450
+ </span>
451
+ <CloseButton onClick={onClose} />
452
+ </div>
453
+ ) : isChatMode ? (
358
454
  /* Chat mode: [←] Conversation title [✕] */
359
455
  <div className="flex items-center gap-1">
360
456
  {onBack && (
@@ -372,16 +468,7 @@ export function SupportAgentPanel({
372
468
  <span className="flex-1 truncate px-1 text-sm font-medium text-foreground">
373
469
  {conversationTitle}
374
470
  </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>
471
+ <CloseButton onClick={onClose} />
385
472
  </div>
386
473
  ) : (
387
474
  /* Home mode: [Bot icon] Support Assistant [✕] */
@@ -397,20 +484,11 @@ export function SupportAgentPanel({
397
484
  Support Assistant
398
485
  </span>
399
486
  </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>
487
+ <CloseButton onClick={onClose} />
410
488
  </div>
411
489
  )}
412
- {/* Context chip — shown below header title in both modes */}
413
- {context && (
490
+ {/* Context chip — shown below header title in home and chat modes only */}
491
+ {context && !showAllConversations && (
414
492
  <div className="mt-2">
415
493
  <SupportContextChip context={context} />
416
494
  </div>
@@ -427,6 +505,42 @@ export function SupportAgentPanel({
427
505
  <p className="text-sm text-muted-foreground">Loading…</p>
428
506
  </div>
429
507
  </div>
508
+ ) : showAllConversations ? (
509
+ /* All conversations — full scrollable list (Jira Rovo pattern) */
510
+ <div className="flex flex-col">
511
+ {recentConversations?.length ? (
512
+ <>
513
+ {recentConversations.map((conv) => (
514
+ <ConversationRow
515
+ key={conv.id}
516
+ conv={conv}
517
+ onClick={() => {
518
+ setShowAllConversations(false);
519
+ onOpenConversation?.(conv.id);
520
+ }}
521
+ className="border-b border-border px-4 py-3"
522
+ />
523
+ ))}
524
+ {hasMoreConversations && (
525
+ <div className="border-t border-border p-3">
526
+ <Button
527
+ variant="outline"
528
+ size="sm"
529
+ className="w-full"
530
+ disabled={isLoadingMoreConversations}
531
+ onClick={onLoadMoreConversations}
532
+ >
533
+ {isLoadingMoreConversations ? "Loading..." : "Load more"}
534
+ </Button>
535
+ </div>
536
+ )}
537
+ </>
538
+ ) : (
539
+ <p className="p-4 text-sm text-muted-foreground">
540
+ No conversations yet.
541
+ </p>
542
+ )}
543
+ </div>
430
544
  ) : !hasMessages ? (
431
545
  /* Home state — Rovo pattern: New Chat CTA + Recents + Suggested */
432
546
  <div className="flex flex-col gap-5 p-4">
@@ -443,39 +557,31 @@ export function SupportAgentPanel({
443
557
  </Button>
444
558
  )}
445
559
 
446
- {/* Recents — previous conversations */}
560
+ {/* Recents — 3 most recent conversations */}
447
561
  {hasRecents && (
448
562
  <div className="flex flex-col gap-1">
449
563
  <p className="px-1 text-xs font-medium uppercase tracking-wide text-muted-foreground">
450
564
  Recents
451
565
  </p>
452
566
  <div className="flex flex-col">
453
- {recentConversations!.map((conv) => (
454
- <button
567
+ {recentsPreview.map((conv) => (
568
+ <ConversationRow
455
569
  key={conv.id}
456
- type="button"
570
+ conv={conv}
457
571
  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>
572
+ className="px-1 py-2.5"
573
+ />
466
574
  ))}
467
575
  </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
- )}
576
+ <Button
577
+ variant="ghost"
578
+ size="sm"
579
+ onClick={handleViewAll}
580
+ className="h-auto w-fit gap-0.5 px-1 py-1 text-xs text-muted-foreground hover:bg-transparent hover:text-foreground"
581
+ >
582
+ View all conversations
583
+ <ChevronRight className="size-3.5" aria-hidden="true" />
584
+ </Button>
479
585
  </div>
480
586
  )}
481
587
 
@@ -534,6 +640,7 @@ export function SupportAgentPanel({
534
640
  onAttachImage={onAttachImage}
535
641
  disabled={isLoading || isStreaming}
536
642
  placeholder="Ask anything…"
643
+ showMarkdownToolbar
537
644
  />
538
645
  </div>
539
646
  </SheetContent>