xertica-ui 1.3.5 → 1.3.7

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.
@@ -51,6 +51,10 @@ export function HomePage({ user, onLogout }: HomePageProps) {
51
51
  responseGenerator={generateDemoResponse}
52
52
  richSuggestions={richSuggestions}
53
53
  feedbackOptions={feedbackOptions}
54
+ onEvaluation={(messageId, type, reason) => {
55
+ console.log(`Avaliação recebida: ${type} na mensagem ${messageId}. Motivo: ${reason}`);
56
+ // Aqui você implementaria a lógica para salvar no backend
57
+ }}
54
58
  />
55
59
  </div>
56
60
  );
@@ -41,7 +41,6 @@ export function TemplateContent({ }: TemplateContentProps) {
41
41
  return (
42
42
  <div
43
43
  className={`flex-1 flex flex-col overflow-hidden transition-all duration-300 ${sidebarExpanded ? 'md:pl-64' : 'md:pl-20'
44
- } ${assistenteExpanded ? 'md:pr-[420px]' : 'md:pr-20'
45
44
  }`}
46
45
  >
47
46
  {/* Header fixo */}
@@ -2,14 +2,8 @@ import React from 'react';
2
2
  import { useLocation, useNavigate } from 'react-router';
3
3
  import { Sidebar } from './Sidebar';
4
4
  import { TemplateContent } from './TemplateContent';
5
- import { AssistenteXertica } from './AssistenteXertica';
5
+ import { XerticaAssistant } from './ui/xertica-assistant';
6
6
  import { routes } from '../routes';
7
-
8
- interface TemplatePageProps {
9
- user: { email: string } | null;
10
- onLogout: () => void;
11
- }
12
-
13
7
  import { useLayout } from '../contexts/LayoutContext';
14
8
 
15
9
  interface TemplatePageProps {
@@ -18,7 +12,7 @@ interface TemplatePageProps {
18
12
  }
19
13
 
20
14
  export function TemplatePage({ user, onLogout }: TemplatePageProps) {
21
- const { sidebarExpanded, assistenteExpanded, toggleSidebar, toggleAssistente, toggleAssistenteWithTab } = useLayout();
15
+ const { sidebarExpanded, assistenteExpanded, toggleSidebar, toggleAssistente } = useLayout();
22
16
  const location = useLocation();
23
17
  const navigate = useNavigate();
24
18
 
@@ -34,10 +28,10 @@ export function TemplatePage({ user, onLogout }: TemplatePageProps) {
34
28
  routes={routes}
35
29
  />
36
30
  <TemplateContent />
37
- <AssistenteXertica
31
+ <XerticaAssistant
38
32
  isExpanded={assistenteExpanded}
39
33
  onToggle={toggleAssistente}
40
- onToggleWithTab={toggleAssistenteWithTab}
34
+ onEvaluation={(id, type, reason) => console.log('Feedback:', id, type, reason)}
41
35
  />
42
36
  </div>
43
37
  );
@@ -45,9 +45,6 @@ export { Sidebar } from './Sidebar';
45
45
  export { ThemeToggle } from './ThemeToggle';
46
46
  export { LanguageSelector } from './LanguageSelector';
47
47
 
48
- // Connected Components (require Providers)
49
- export { AssistenteXertica } from './AssistenteXertica';
50
-
51
48
  // State Management & Contexts
52
49
  export * from '../contexts';
53
50
 
@@ -487,9 +487,9 @@ export function XerticaAssistant({
487
487
  }
488
488
  }, [mensagens, abaSelecionada]);
489
489
 
490
- // Sincronizar mensagens iniciais
490
+ // Sincronizar mensagens iniciais apenas quando elas mudarem e não forem vazias
491
491
  useEffect(() => {
492
- if (initialMessages.length > 0) {
492
+ if (initialMessages && initialMessages.length > 0) {
493
493
  setMensagens(initialMessages);
494
494
  }
495
495
  }, [initialMessages]);
@@ -875,17 +875,22 @@ export function XerticaAssistant({
875
875
  {/* Header - Toggle Button - Apenas visível quando não está em fullPage */}
876
876
  {!isFullPage && (
877
877
  <div
878
- className="border-b border-border flex items-center justify-between px-[22px] py-[16px]"
878
+ className={cn(
879
+ "border-b border-border flex items-center py-3",
880
+ isExpanded ? "justify-between px-4 py-4" : "justify-center px-0"
881
+ )}
879
882
  >
880
883
  {isExpanded && (
881
884
  <motion.div
882
- initial={{ opacity: 0, x: 20 }}
885
+ initial={{ opacity: 0, x: -10 }}
883
886
  animate={{ opacity: 1, x: 0 }}
884
- exit={{ opacity: 0, x: 20 }}
885
- className="flex items-center gap-2"
887
+ exit={{ opacity: 0, x: -10 }}
888
+ className="flex items-center gap-2 overflow-hidden"
886
889
  >
887
- <XerticaOrbe size={32} />
888
- <span className="text-foreground">Assistente Xertica</span>
890
+ <div className="flex-shrink-0">
891
+ <XerticaOrbe size={32} />
892
+ </div>
893
+ <span className="text-foreground font-medium truncate">Assistente Xertica</span>
889
894
  </motion.div>
890
895
  )}
891
896
 
@@ -895,7 +900,7 @@ export function XerticaAssistant({
895
900
  variant="ghost"
896
901
  size="sm"
897
902
  onClick={onNavigateFullPage}
898
- className="p-2 text-muted-foreground"
903
+ className="h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-full"
899
904
  title="Expandir assistente"
900
905
  >
901
906
  <Maximize2 className="w-4 h-4" />
@@ -906,7 +911,10 @@ export function XerticaAssistant({
906
911
  variant="ghost"
907
912
  size="sm"
908
913
  onClick={handleToggle}
909
- className="p-2 text-muted-foreground"
914
+ className={cn(
915
+ "h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-full",
916
+ !isExpanded && "w-10 h-10" // Slightly larger touch target when collapsed if desired, or keep consistent
917
+ )}
910
918
  >
911
919
  {isExpanded ? (
912
920
  <ChevronRight className="w-4 h-4" />
@@ -926,7 +934,7 @@ export function XerticaAssistant({
926
934
  <TooltipTrigger asChild>
927
935
  <button
928
936
  onClick={handleToggle}
929
- className="flex items-center justify-center hover:opacity-90 transition-opacity duration-200 cursor-pointer"
937
+ className="w-10 h-10 rounded-full flex items-center justify-center hover:bg-accent/50 transition-colors duration-200 cursor-pointer mx-auto"
930
938
  >
931
939
  <XerticaOrbe size={32} />
932
940
  </button>
@@ -4,11 +4,5 @@ interface TemplatePageProps {
4
4
  } | null;
5
5
  onLogout: () => void;
6
6
  }
7
- interface TemplatePageProps {
8
- user: {
9
- email: string;
10
- } | null;
11
- onLogout: () => void;
12
- }
13
7
  export declare function TemplatePage({ user, onLogout }: TemplatePageProps): import("react/jsx-runtime").JSX.Element;
14
8
  export {};
@@ -13,7 +13,6 @@ export { XerticaOrbe } from './XerticaOrbe';
13
13
  export { Sidebar } from './Sidebar';
14
14
  export { ThemeToggle } from './ThemeToggle';
15
15
  export { LanguageSelector } from './LanguageSelector';
16
- export { AssistenteXertica } from './AssistenteXertica';
17
16
  export * from '../contexts';
18
17
  export { Header } from './Header';
19
18
  export { DocumentEditor } from './DocumentEditor';
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const alertVariants: (props?: ({
4
- variant?: "default" | "error" | "success" | "info" | "warning" | null | undefined;
4
+ variant?: "default" | "error" | "success" | "warning" | "info" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Alert({ className, variant, children, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | "success" | "info" | "warning" | null | undefined;
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | "success" | "warning" | "info" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export declare function Badge({ className, variant, asChild, children, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
7
7
  asChild?: boolean;