xertica-ui 2.1.2 → 2.1.4

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 (181) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -1
  3. package/bin/cli.ts +1 -1
  4. package/bin/generate-tokens.ts +13 -7
  5. package/components/assistant/xertica-assistant/index.ts +2 -0
  6. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +97 -0
  7. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -0
  8. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -0
  9. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +86 -0
  10. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +77 -0
  11. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +573 -0
  12. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +65 -0
  13. package/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.tsx +41 -0
  14. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +98 -0
  15. package/components/assistant/xertica-assistant/parts/index.ts +16 -0
  16. package/components/assistant/xertica-assistant/types.ts +139 -0
  17. package/components/assistant/xertica-assistant/use-assistant.ts +559 -0
  18. package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +200 -0
  19. package/components/assistant/xertica-assistant/xertica-assistant.tsx +198 -1460
  20. package/components/brand/theme-toggle/ThemeToggle.tsx +8 -27
  21. package/components/hooks/index.ts +3 -0
  22. package/components/hooks/use-layout-shortcuts.ts +46 -0
  23. package/components/layout/sidebar/index.ts +2 -0
  24. package/components/layout/sidebar/sidebar.stories.tsx +160 -8
  25. package/components/layout/sidebar/sidebar.tsx +606 -497
  26. package/components/layout/sidebar/use-sidebar.ts +104 -0
  27. package/components/media/audio-player/AudioPlayer.tsx +131 -206
  28. package/components/media/audio-player/use-audio-player.ts +298 -0
  29. package/components/pages/home-page/HomePage.tsx +1 -1
  30. package/components/pages/template-content/TemplateContent.tsx +5 -5
  31. package/components/pages/template-page/TemplatePage.tsx +5 -5
  32. package/components/shared/CustomTooltipContent.tsx +52 -0
  33. package/components/shared/layout-constants.ts +1 -1
  34. package/components/ui/chart/chart.stories.tsx +966 -7
  35. package/components/ui/chart/chart.tsx +918 -45
  36. package/components/ui/file-upload/file-upload.stories.tsx +100 -0
  37. package/components/ui/file-upload/file-upload.tsx +14 -74
  38. package/components/ui/file-upload/index.ts +1 -0
  39. package/components/ui/file-upload/use-file-upload.ts +181 -0
  40. package/components/ui/pagination/index.ts +2 -0
  41. package/components/ui/pagination/pagination.stories.tsx +94 -0
  42. package/components/ui/pagination/use-pagination.ts +194 -0
  43. package/components/ui/rich-text-editor/index.ts +2 -0
  44. package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +129 -1
  45. package/components/ui/rich-text-editor/rich-text-editor.tsx +86 -305
  46. package/components/ui/rich-text-editor/use-rich-text-editor.ts +439 -0
  47. package/components/ui/stepper/index.ts +3 -1
  48. package/components/ui/stepper/stepper.stories.tsx +116 -0
  49. package/components/ui/stepper/stepper.tsx +4 -4
  50. package/components/ui/stepper/use-stepper.ts +137 -0
  51. package/components/ui/tree-view/index.ts +4 -1
  52. package/components/ui/tree-view/tree-view.stories.tsx +110 -4
  53. package/components/ui/tree-view/tree-view.tsx +17 -125
  54. package/components/ui/tree-view/use-tree-view.ts +229 -0
  55. package/contexts/AssistenteContext.tsx +17 -54
  56. package/contexts/BrandColorsContext.tsx +6 -17
  57. package/contexts/LayoutContext.tsx +5 -31
  58. package/dist/AssistantChart-BAudAfne.cjs +3591 -0
  59. package/dist/AssistantChart-BP8upjMk.js +3565 -0
  60. package/dist/AudioPlayer-1ypwE2Wh.cjs +936 -0
  61. package/dist/AudioPlayer-DuKXrCfy.js +937 -0
  62. package/dist/CustomTooltipContent-DHjkY0ww.js +40 -0
  63. package/dist/CustomTooltipContent-c_K-DWRr.cjs +56 -0
  64. package/dist/LanguageContext-BwhwC3G2.js +657 -0
  65. package/dist/LanguageContext-DvUt5jBg.cjs +656 -0
  66. package/dist/LayoutContext-BDmcZfMH.cjs +84 -0
  67. package/dist/LayoutContext-dbQvdC4O.js +85 -0
  68. package/dist/ThemeContext-RTy1m2Uq.js +82 -0
  69. package/dist/ThemeContext-bSzuOit2.cjs +81 -0
  70. package/dist/VerifyEmailPage-C_ihbcth.js +2828 -0
  71. package/dist/VerifyEmailPage-Dt7zgA4w.cjs +2827 -0
  72. package/dist/XerticaProvider-CW9hpCdF.cjs +39 -0
  73. package/dist/XerticaProvider-siSt9uG2.js +40 -0
  74. package/dist/XerticaXLogo-D8jf0SNv.cjs +214 -0
  75. package/dist/XerticaXLogo-fAJMy3H4.js +215 -0
  76. package/dist/assistant.cjs.js +2 -1
  77. package/dist/assistant.es.js +3 -2
  78. package/dist/brand.cjs.js +2 -2
  79. package/dist/brand.es.js +2 -2
  80. package/dist/cli.js +14 -8
  81. package/dist/components/assistant/xertica-assistant/index.d.ts +2 -0
  82. package/dist/components/assistant/xertica-assistant/parts/AssistantCollapsedView.d.ts +13 -0
  83. package/dist/components/assistant/xertica-assistant/parts/AssistantConversationList.d.ts +16 -0
  84. package/dist/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.d.ts +17 -0
  85. package/dist/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.d.ts +19 -0
  86. package/dist/components/assistant/xertica-assistant/parts/AssistantHeader.d.ts +11 -0
  87. package/dist/components/assistant/xertica-assistant/parts/AssistantMessageBubble.d.ts +29 -0
  88. package/dist/components/assistant/xertica-assistant/parts/AssistantTabBar.d.ts +13 -0
  89. package/dist/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.d.ts +4 -0
  90. package/dist/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.d.ts +17 -0
  91. package/dist/components/assistant/xertica-assistant/parts/index.d.ts +16 -0
  92. package/dist/components/assistant/xertica-assistant/types.d.ts +106 -0
  93. package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +125 -0
  94. package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +8 -97
  95. package/dist/components/hooks/index.d.ts +3 -0
  96. package/dist/components/hooks/use-layout-shortcuts.d.ts +22 -0
  97. package/dist/components/layout/sidebar/index.d.ts +2 -0
  98. package/dist/components/layout/sidebar/sidebar.d.ts +80 -0
  99. package/dist/components/layout/sidebar/use-sidebar.d.ts +22 -0
  100. package/dist/components/media/audio-player/AudioPlayer.d.ts +4 -1
  101. package/dist/components/media/audio-player/use-audio-player.d.ts +72 -0
  102. package/dist/components/shared/CustomTooltipContent.d.ts +20 -0
  103. package/dist/components/shared/layout-constants.d.ts +1 -1
  104. package/dist/components/ui/alert/alert.d.ts +1 -1
  105. package/dist/components/ui/badge/badge.d.ts +1 -1
  106. package/dist/components/ui/button/button.d.ts +2 -2
  107. package/dist/components/ui/chart/chart.d.ts +162 -5
  108. package/dist/components/ui/file-upload/file-upload.d.ts +2 -0
  109. package/dist/components/ui/file-upload/index.d.ts +1 -0
  110. package/dist/components/ui/file-upload/use-file-upload.d.ts +49 -0
  111. package/dist/components/ui/pagination/index.d.ts +2 -0
  112. package/dist/components/ui/pagination/use-pagination.d.ts +78 -0
  113. package/dist/components/ui/rich-text-editor/index.d.ts +2 -0
  114. package/dist/components/ui/rich-text-editor/use-rich-text-editor.d.ts +107 -0
  115. package/dist/components/ui/stepper/index.d.ts +3 -1
  116. package/dist/components/ui/stepper/stepper.d.ts +2 -2
  117. package/dist/components/ui/stepper/use-stepper.d.ts +60 -0
  118. package/dist/components/ui/tree-view/index.d.ts +4 -1
  119. package/dist/components/ui/tree-view/tree-view.d.ts +4 -6
  120. package/dist/components/ui/tree-view/use-tree-view.d.ts +60 -0
  121. package/dist/contexts/AssistenteContext.d.ts +10 -49
  122. package/dist/hooks.cjs.js +30 -10
  123. package/dist/hooks.es.js +25 -4
  124. package/dist/index.cjs.js +20 -9
  125. package/dist/index.es.js +38 -27
  126. package/dist/layout.cjs.js +82 -1
  127. package/dist/layout.es.js +83 -2
  128. package/dist/media.cjs.js +1 -1
  129. package/dist/media.es.js +1 -1
  130. package/dist/pages.cjs.js +1 -1
  131. package/dist/pages.es.js +1 -1
  132. package/dist/rich-text-editor-BmsjY03B.js +2949 -0
  133. package/dist/rich-text-editor-GS2kpTAK.cjs +2966 -0
  134. package/dist/sidebar-CVUGHOS_.cjs +756 -0
  135. package/dist/sidebar-CmvwjnVb.js +757 -0
  136. package/dist/ui.cjs.js +12 -2
  137. package/dist/ui.es.js +24 -14
  138. package/dist/use-audio-player-Bkh23vQ3.js +177 -0
  139. package/dist/use-audio-player-Dn1NR9xN.cjs +176 -0
  140. package/dist/utils/color-utils.d.ts +51 -0
  141. package/dist/xertica-assistant-BMqdyRVi.js +2082 -0
  142. package/dist/xertica-assistant-Bj3vBCq_.cjs +2081 -0
  143. package/dist/xertica-ui.css +1 -1
  144. package/docs/ai-usage.md +28 -10
  145. package/docs/architecture-improvements.md +463 -0
  146. package/docs/architecture.md +77 -1
  147. package/docs/components/assistant-chart.md +1 -1
  148. package/docs/components/assistant.md +159 -0
  149. package/docs/components/audio-player.md +46 -0
  150. package/docs/components/branding.md +251 -0
  151. package/docs/components/chart.md +354 -39
  152. package/docs/components/code-block.md +108 -0
  153. package/docs/components/file-upload.md +119 -2
  154. package/docs/components/formatted-document.md +113 -0
  155. package/docs/components/hooks.md +430 -0
  156. package/docs/components/image-with-fallback.md +106 -0
  157. package/docs/components/map-layers.md +140 -0
  158. package/docs/components/modern-chat-input.md +163 -0
  159. package/docs/components/pages.md +351 -0
  160. package/docs/components/pagination.md +187 -0
  161. package/docs/components/rich-text-editor.md +164 -0
  162. package/docs/components/sidebar.md +153 -4
  163. package/docs/components/stepper.md +157 -12
  164. package/docs/components/tree-view.md +164 -6
  165. package/docs/doc-audit.md +223 -0
  166. package/docs/getting-started.md +155 -1
  167. package/docs/guidelines.md +14 -8
  168. package/docs/layout.md +2 -2
  169. package/docs/llms.md +29 -9
  170. package/docs/patterns/detail-page.md +276 -0
  171. package/docs/patterns/settings.md +346 -0
  172. package/docs/patterns/wizard.md +217 -0
  173. package/guidelines/Guidelines.md +5 -3
  174. package/llms.txt +1 -1
  175. package/package.json +10 -10
  176. package/styles/xertica/tokens.css +41 -12
  177. package/templates/CLAUDE.md +16 -6
  178. package/templates/guidelines/Guidelines.md +16 -4
  179. package/templates/package.json +3 -3
  180. package/templates/src/styles/xertica/tokens.css +39 -10
  181. package/utils/color-utils.ts +72 -0
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { motion } from 'framer-motion';
3
+ import { XerticaOrbe } from '../../../brand/xertica-orbe';
4
+
5
+ /**
6
+ * AssistantTypingIndicator — Animated three-dot indicator shown while the assistant is processing.
7
+ */
8
+ export function AssistantTypingIndicator() {
9
+ return (
10
+ <motion.div
11
+ initial={{ opacity: 0, y: 10 }}
12
+ animate={{ opacity: 1, y: 0 }}
13
+ className="flex gap-2 justify-start"
14
+ >
15
+ {/* Avatar do Assistente */}
16
+ <div className="flex-shrink-0 pt-1">
17
+ <XerticaOrbe size={32} />
18
+ </div>
19
+
20
+ <div className="px-4 py-3 bg-muted rounded-2xl">
21
+ <div className="flex gap-1">
22
+ <motion.div
23
+ className="w-2 h-2 rounded-full bg-muted-foreground"
24
+ animate={{ y: [0, -8, 0] }}
25
+ transition={{ repeat: Infinity, duration: 0.6, delay: 0 }}
26
+ />
27
+ <motion.div
28
+ className="w-2 h-2 rounded-full bg-muted-foreground"
29
+ animate={{ y: [0, -8, 0] }}
30
+ transition={{ repeat: Infinity, duration: 0.6, delay: 0.2 }}
31
+ />
32
+ <motion.div
33
+ className="w-2 h-2 rounded-full bg-muted-foreground"
34
+ animate={{ y: [0, -8, 0] }}
35
+ transition={{ repeat: Infinity, duration: 0.6, delay: 0.4 }}
36
+ />
37
+ </div>
38
+ </div>
39
+ </motion.div>
40
+ );
41
+ }
@@ -0,0 +1,98 @@
1
+ import React from 'react';
2
+ import { MoreHorizontal, ChevronLeft, BarChart3, Table as TableIcon } from 'lucide-react';
3
+ import { Button } from '../../../ui/button';
4
+ import { XerticaOrbe } from '../../../brand/xertica-orbe';
5
+ import type { Suggestion } from '../types';
6
+
7
+ interface AssistantWelcomeScreenProps {
8
+ userName: string;
9
+ welcomeMessage: string;
10
+ suggestions: Suggestion[];
11
+ richSuggestions: Suggestion[];
12
+ showMoreSuggestions: boolean;
13
+ onSetShowMoreSuggestions: (show: boolean) => void;
14
+ onSendSuggestion: (text: string) => void;
15
+ onRichSuggestionClick: (suggestion: Suggestion) => void;
16
+ }
17
+
18
+ /**
19
+ * AssistantWelcomeScreen — Empty state shown when there are no messages yet.
20
+ * Displays the Xertica Orbe, a greeting, and suggestion chips.
21
+ */
22
+ export function AssistantWelcomeScreen({
23
+ userName,
24
+ welcomeMessage,
25
+ suggestions,
26
+ richSuggestions,
27
+ showMoreSuggestions,
28
+ onSetShowMoreSuggestions,
29
+ onSendSuggestion,
30
+ onRichSuggestionClick,
31
+ }: AssistantWelcomeScreenProps) {
32
+ return (
33
+ <div className="flex-1 overflow-y-auto min-h-0">
34
+ {/* Welcome Message */}
35
+ <div className="p-6 text-center">
36
+ <div className="mx-auto mb-4 flex items-center justify-center">
37
+ <XerticaOrbe size={64} />
38
+ </div>
39
+ <h3 className="mb-2 text-foreground">Olá, {userName}</h3>
40
+ <p className="text-muted-foreground">{welcomeMessage}</p>
41
+ </div>
42
+
43
+ {/* Suggestions */}
44
+ {(suggestions.length > 0 || richSuggestions.length > 0) && (
45
+ <div className="px-4 pb-4 space-y-2">
46
+ {suggestions.map((sugestao) => (
47
+ <button
48
+ key={sugestao.id}
49
+ onClick={() => onSendSuggestion(sugestao.text)}
50
+ className="w-full p-3 text-left rounded-[var(--radius-card)] bg-muted text-foreground transition-colors duration-200 hover:bg-muted/80"
51
+ >
52
+ {sugestao.text}
53
+ </button>
54
+ ))}
55
+
56
+ {richSuggestions.length > 0 && (
57
+ !showMoreSuggestions ? (
58
+ <Button
59
+ variant="ghost"
60
+ size="sm"
61
+ onClick={() => onSetShowMoreSuggestions(true)}
62
+ className="w-full justify-start text-muted-foreground"
63
+ >
64
+ <MoreHorizontal className="w-4 h-4 mr-2" />
65
+ Mais sugestões
66
+ </Button>
67
+ ) : (
68
+ <div className="space-y-2 pt-2 border-t border-border mt-2 animate-in slide-in-from-top-2">
69
+ {richSuggestions.map((sugestao) => (
70
+ <button
71
+ key={sugestao.id}
72
+ onClick={() => onRichSuggestionClick(sugestao)}
73
+ className="w-full p-3 text-left rounded-[var(--radius-card)] bg-muted/50 border border-border text-foreground transition-all duration-200 hover:bg-primary/5 hover:border-primary/50 group"
74
+ >
75
+ <div className="flex items-center gap-2">
76
+ {sugestao.id.includes('chart') && <BarChart3 className="w-4 h-4 text-primary" />}
77
+ {sugestao.id.includes('table') && <TableIcon className="w-4 h-4 text-primary" />}
78
+ <span className="font-medium">{sugestao.text}</span>
79
+ </div>
80
+ </button>
81
+ ))}
82
+ <Button
83
+ variant="ghost"
84
+ size="sm"
85
+ onClick={() => onSetShowMoreSuggestions(false)}
86
+ className="w-full justify-center text-muted-foreground mt-2"
87
+ >
88
+ <ChevronLeft className="w-4 h-4 mr-2" />
89
+ Voltar
90
+ </Button>
91
+ </div>
92
+ )
93
+ )}
94
+ </div>
95
+ )}
96
+ </div>
97
+ );
98
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Sub-components for XerticaAssistant.
3
+ *
4
+ * These are internal building blocks — not part of the public library API.
5
+ * Import them only from within the `xertica-assistant` directory.
6
+ */
7
+ export { AssistantCollapsedView } from './AssistantCollapsedView';
8
+ export { AssistantHeader } from './AssistantHeader';
9
+ export { AssistantTabBar } from './AssistantTabBar';
10
+ export { AssistantWelcomeScreen } from './AssistantWelcomeScreen';
11
+ export { AssistantMessageBubble } from './AssistantMessageBubble';
12
+ export { AssistantTypingIndicator } from './AssistantTypingIndicator';
13
+ export { AssistantConversationList } from './AssistantConversationList';
14
+ export { AssistantFeedbackDialog } from './AssistantFeedbackDialog';
15
+ export { AssistantDocumentEditor } from './AssistantDocumentEditor';
16
+ export type { EvaluationState } from './AssistantFeedbackDialog';
@@ -0,0 +1,139 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ /**
4
+ * @file types.ts
5
+ * Shared TypeScript types for the XerticaAssistant component and related hooks/contexts.
6
+ *
7
+ * These types are the single source of truth — imported by:
8
+ * - `xertica-assistant.tsx`
9
+ * - `use-assistant.ts`
10
+ * - `contexts/AssistenteContext.tsx`
11
+ */
12
+
13
+ // ─────────────────────────────────────────────────────────────────────────────
14
+ // Primitive union types
15
+ // ─────────────────────────────────────────────────────────────────────────────
16
+
17
+ /** Supported message sender types in the assistant */
18
+ export type MessageType = 'user' | 'assistant' | 'system';
19
+
20
+ /** Supported attachment types that can be included in messages */
21
+ export type AttachmentType =
22
+ | 'file'
23
+ | 'audio'
24
+ | 'image'
25
+ | 'video'
26
+ | 'document'
27
+ | 'podcast'
28
+ | 'search';
29
+
30
+ /** Supported search result categories */
31
+ export type SearchResultType =
32
+ | 'document'
33
+ | 'project'
34
+ | 'conversation'
35
+ | 'file'
36
+ | 'contact';
37
+
38
+ /** Layout mode for the assistant panel */
39
+ export type AssistantMode = 'collapsed' | 'expanded' | 'fullPage';
40
+
41
+ /** Available tabs in the assistant panel */
42
+ export type AssistantTab = 'chat' | 'historico' | 'favoritos';
43
+
44
+ // ─────────────────────────────────────────────────────────────────────────────
45
+ // Domain interfaces
46
+ // ─────────────────────────────────────────────────────────────────────────────
47
+
48
+ /**
49
+ * Individual search result item returned by an assistant search query.
50
+ */
51
+ export interface SearchResult {
52
+ id: string;
53
+ type: SearchResultType;
54
+ title: string;
55
+ description: string;
56
+ path: string;
57
+ relevance: number;
58
+ lastModified?: string;
59
+ }
60
+
61
+ /**
62
+ * Metadata about a search source (e.g., a document repository or knowledge base).
63
+ */
64
+ export interface SearchSource {
65
+ name: string;
66
+ count: number;
67
+ }
68
+
69
+ /**
70
+ * A quick-action command shown below a search result message.
71
+ */
72
+ export interface SearchCommand {
73
+ id: string;
74
+ icon: string;
75
+ label: string;
76
+ description: string;
77
+ }
78
+
79
+ /**
80
+ * A single chat message in the assistant conversation.
81
+ */
82
+ export interface Message {
83
+ id: string;
84
+ type: MessageType;
85
+ content: string;
86
+ timestamp: Date;
87
+ isFavorite?: boolean;
88
+ attachmentType?: AttachmentType;
89
+ attachmentName?: string;
90
+ documentContent?: string;
91
+ documentTitle?: string;
92
+ audioUrl?: string;
93
+ searchResults?: SearchResult[];
94
+ searchSources?: SearchSource[];
95
+ searchCommands?: SearchCommand[];
96
+ chartData?: any[];
97
+ chartConfig?: any;
98
+ tableData?: {
99
+ caption?: string;
100
+ headers: string[];
101
+ rows: (string | ReactNode)[][];
102
+ };
103
+ evaluation?: 'like' | 'dislike';
104
+ evaluationReason?: string;
105
+ }
106
+
107
+ /**
108
+ * A saved conversation entry shown in the history panel.
109
+ */
110
+ export interface Conversation {
111
+ id: string;
112
+ title: string;
113
+ lastMessage?: string;
114
+ timestamp: string;
115
+ isFavorite: boolean;
116
+ messages: Message[];
117
+ }
118
+
119
+ /**
120
+ * A suggested prompt shown to the user in the chat input area.
121
+ */
122
+ export interface Suggestion {
123
+ id: string;
124
+ text: string;
125
+ icon?: ReactNode;
126
+ }
127
+
128
+ /**
129
+ * A mock response entry used in demo mode.
130
+ * Matches a user message via `trigger` and returns a predefined `response`.
131
+ */
132
+ export interface MockResponse {
133
+ /** String or regex to match against the user's message */
134
+ trigger: string | RegExp;
135
+ /** Response content — either a plain string or a partial Message object */
136
+ response: string | Partial<Message>;
137
+ /** Optional delay in milliseconds before the response appears */
138
+ delay?: number;
139
+ }