xertica-ui 1.8.1 → 1.9.1
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.
- package/CHANGELOG.md +25 -0
- package/components/assistant/modern-chat-input/ModernChatInput.tsx +84 -57
- package/components/assistant/modern-chat-input/modern-chat-input.mdx +33 -0
- package/components/assistant/modern-chat-input/modern-chat-input.stories.tsx +78 -0
- package/components/assistant/xertica-assistant/xertica-assistant.mdx +30 -1
- package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +98 -0
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +126 -59
- package/components/examples/SidebarLogoExample.tsx +1 -1
- package/components/layout/header/header.mdx +53 -9
- package/components/layout/header/header.stories.tsx +73 -12
- package/components/layout/header/header.tsx +78 -34
- package/components/layout/sidebar/sidebar.tsx +24 -7
- package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +1 -1
- package/components/pages/forgot-password-page/forgot-password-page.test.tsx +1 -1
- package/components/pages/home-content/HomeContent.tsx +10 -5
- package/components/pages/home-page/HomePage.tsx +12 -3
- package/components/pages/home-page/home-page.test.tsx +1 -1
- package/components/pages/login-page/LoginPage.tsx +1 -1
- package/components/pages/login-page/login-page.test.tsx +1 -1
- package/components/pages/reset-password-page/ResetPasswordPage.tsx +1 -1
- package/components/pages/template-content/TemplateContent.tsx +10 -27
- package/components/pages/template-page/TemplatePage.tsx +12 -3
- package/components/pages/template-page/template-page.test.tsx +1 -1
- package/components/pages/verify-email-page/VerifyEmailPage.tsx +1 -1
- package/components/ui/checkbox/checkbox.mdx +7 -0
- package/components/ui/checkbox/checkbox.stories.tsx +32 -8
- package/components/ui/checkbox/checkbox.test.tsx +11 -0
- package/components/ui/checkbox/checkbox.tsx +42 -18
- package/components/ui/input/input.mdx +7 -0
- package/components/ui/input/input.stories.tsx +43 -13
- package/components/ui/input-otp/input-otp.mdx +7 -0
- package/components/ui/input-otp/input-otp.stories.tsx +45 -0
- package/components/ui/input-otp/input-otp.test.tsx +43 -20
- package/components/ui/input-otp/input-otp.tsx +16 -1
- package/components/ui/label/label.mdx +7 -0
- package/components/ui/label/label.stories.tsx +28 -2
- package/components/ui/label/label.test.tsx +26 -2
- package/components/ui/label/label.tsx +21 -3
- package/components/ui/radio-group/radio-group.mdx +7 -0
- package/components/ui/radio-group/radio-group.stories.tsx +49 -1
- package/components/ui/radio-group/radio-group.test.tsx +26 -2
- package/components/ui/radio-group/radio-group.tsx +56 -32
- package/components/ui/search/search.mdx +5 -4
- package/components/ui/search/search.stories.tsx +68 -7
- package/components/ui/search/search.test.tsx +15 -2
- package/components/ui/search/search.tsx +39 -5
- package/components/ui/select/select.mdx +7 -0
- package/components/ui/select/select.stories.tsx +51 -2
- package/components/ui/select/select.test.tsx +40 -0
- package/components/ui/select/select.tsx +38 -24
- package/components/ui/switch/switch.mdx +7 -0
- package/components/ui/switch/switch.stories.tsx +27 -0
- package/components/ui/switch/switch.test.tsx +13 -2
- package/components/ui/switch/switch.tsx +46 -21
- package/components/ui/textarea/textarea.mdx +7 -0
- package/components/ui/textarea/textarea.stories.tsx +35 -3
- package/components/ui/textarea/textarea.test.tsx +18 -5
- package/components/ui/textarea/textarea.tsx +29 -6
- package/dist/components/assistant/modern-chat-input/ModernChatInput.d.ts +11 -1
- package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +36 -1
- package/dist/components/layout/header/header.d.ts +48 -7
- package/dist/components/layout/sidebar/sidebar.d.ts +6 -2
- package/dist/components/pages/home-content/HomeContent.d.ts +8 -1
- package/dist/components/pages/template-content/TemplateContent.d.ts +8 -1
- package/dist/components/ui/checkbox/checkbox.d.ts +11 -1
- package/dist/components/ui/input-otp/input-otp.d.ts +8 -1
- package/dist/components/ui/label/label.d.ts +11 -1
- package/dist/components/ui/radio-group/radio-group.d.ts +11 -1
- package/dist/components/ui/search/search.d.ts +9 -1
- package/dist/components/ui/select/select.d.ts +7 -1
- package/dist/components/ui/switch/switch.d.ts +11 -1
- package/dist/components/ui/textarea/textarea.d.ts +18 -2
- package/dist/index.es.js +337 -2229
- package/dist/index.umd.js +340 -2233
- package/dist/xertica-ui.css +1 -1
- package/docs/components/assistant.md +48 -0
- package/docs/components/checkbox.md +2 -0
- package/docs/components/header.md +116 -18
- package/docs/components/input-otp.md +5 -3
- package/docs/components/input.md +14 -0
- package/docs/components/label.md +6 -4
- package/docs/components/radio-group.md +7 -5
- package/docs/components/search.md +5 -3
- package/docs/components/select.md +6 -4
- package/docs/components/switch.md +3 -1
- package/docs/components/textarea.md +4 -0
- package/docs/form-sizing.md +154 -0
- package/docs/installation.md +1 -1
- package/guidelines/Guidelines.md +2 -2
- package/package.json +1 -1
- package/styles/xertica/theme-map.css +91 -91
- package/templates/package.json +2 -2
- package/templates/src/app/App.d.ts +1 -0
- package/templates/src/app/App.js +70 -0
- package/templates/src/app/pages/CrudTemplate.d.ts +1 -0
- package/templates/src/app/pages/CrudTemplate.js +6 -0
- package/templates/src/app/pages/DashboardTemplate.d.ts +1 -0
- package/templates/src/app/pages/DashboardTemplate.js +9 -0
- package/templates/src/app/pages/ForgotPassword/ForgotPasswordContent.d.ts +1 -0
- package/templates/src/app/pages/ForgotPassword/ForgotPasswordContent.js +21 -0
- package/templates/src/app/pages/ForgotPasswordPage.d.ts +1 -0
- package/templates/src/app/pages/ForgotPasswordPage.js +5 -0
- package/templates/src/app/pages/FormTemplate.d.ts +1 -0
- package/templates/src/app/pages/FormTemplate.js +23 -0
- package/templates/src/app/pages/Home/HomeContent.d.ts +1 -0
- package/templates/src/app/pages/Home/HomeContent.js +24 -0
- package/templates/src/app/pages/HomePage.d.ts +8 -0
- package/templates/src/app/pages/HomePage.js +24 -0
- package/templates/src/app/pages/Login/LoginContent.d.ts +5 -0
- package/templates/src/app/pages/Login/LoginContent.js +28 -0
- package/templates/src/app/pages/LoginPage.d.ts +5 -0
- package/templates/src/app/pages/LoginPage.js +5 -0
- package/templates/src/app/pages/LoginTemplate.d.ts +1 -0
- package/templates/src/app/pages/LoginTemplate.js +6 -0
- package/templates/src/app/pages/ResetPassword/ResetPasswordContent.d.ts +1 -0
- package/templates/src/app/pages/ResetPassword/ResetPasswordContent.js +73 -0
- package/templates/src/app/pages/ResetPasswordPage.d.ts +1 -0
- package/templates/src/app/pages/ResetPasswordPage.js +5 -0
- package/templates/src/app/pages/Template/TemplateContent.d.ts +1 -0
- package/templates/src/app/pages/Template/TemplateContent.js +75 -0
- package/templates/src/app/pages/TemplatePage.d.ts +8 -0
- package/templates/src/app/pages/TemplatePage.js +11 -0
- package/templates/src/app/pages/VerifyEmail/VerifyEmailContent.d.ts +1 -0
- package/templates/src/app/pages/VerifyEmail/VerifyEmailContent.js +24 -0
- package/templates/src/app/pages/VerifyEmailPage.d.ts +1 -0
- package/templates/src/app/pages/VerifyEmailPage.js +5 -0
- package/templates/src/app/routes.d.ts +10 -0
- package/templates/src/app/routes.js +22 -0
- package/templates/src/main.d.ts +1 -0
- package/templates/src/main.js +6 -0
- package/templates/tsconfig.json +16 -6
- package/templates/tsconfig.node.json +1 -1
- package/templates/tsconfig.node.tsbuildinfo +1 -1
- package/templates/tsconfig.tsbuildinfo +1 -1
- package/templates/vite.config.d.ts +2 -0
- package/templates/vite.config.js +6 -0
- package/utils/demo-responses.test.ts +2 -2
- package/utils/demo-responses.ts +1 -1
- package/dist/AssistantChart-BkwfdilF.js +0 -22
- package/dist/AssistantChart-G8I1Kfu4.js +0 -22
- package/dist/components/AssistenteXertica.d.ts +0 -17
- package/dist/components/AudioPlayer.d.ts +0 -35
- package/dist/components/CodeBlock.d.ts +0 -28
- package/dist/components/DocumentEditor.d.ts +0 -26
- package/dist/components/ForgotPasswordPage.d.ts +0 -13
- package/dist/components/FormattedDocument.d.ts +0 -25
- package/dist/components/Header.d.ts +0 -72
- package/dist/components/HomeContent.d.ts +0 -20
- package/dist/components/HomePage.d.ts +0 -26
- package/dist/components/LanguageSelector.d.ts +0 -26
- package/dist/components/LoginPage.d.ts +0 -25
- package/dist/components/MarkdownMessage.d.ts +0 -24
- package/dist/components/ModernChatInput.d.ts +0 -44
- package/dist/components/PodcastPlayer.d.ts +0 -41
- package/dist/components/ResetPasswordPage.d.ts +0 -14
- package/dist/components/Sidebar.d.ts +0 -126
- package/dist/components/TemplateContent.d.ts +0 -19
- package/dist/components/TemplatePage.d.ts +0 -24
- package/dist/components/ThemeToggle.d.ts +0 -26
- package/dist/components/VerifyEmailPage.d.ts +0 -14
- package/dist/components/XerticaLogo.d.ts +0 -24
- package/dist/components/XerticaOrbe.d.ts +0 -23
- package/dist/components/XerticaProvider.d.ts +0 -35
- package/dist/components/XerticaXLogo.d.ts +0 -23
- package/dist/components/assistant-utils.d.ts +0 -21
- package/dist/components/layout-constants.d.ts +0 -8
- package/dist/components/media/AudioPlayer.d.ts +0 -9
- package/dist/components/media/VideoPlayer.d.ts +0 -8
- package/dist/components/ui/AssistantChart.d.ts +0 -7
- package/dist/components/ui/accordion.d.ts +0 -20
- package/dist/components/ui/alert-dialog.d.ts +0 -26
- package/dist/components/ui/alert.d.ts +0 -25
- package/dist/components/ui/aspect-ratio.d.ts +0 -14
- package/dist/components/ui/avatar.d.ts +0 -20
- package/dist/components/ui/badge.d.ts +0 -22
- package/dist/components/ui/breadcrumb.d.ts +0 -23
- package/dist/components/ui/button.d.ts +0 -37
- package/dist/components/ui/calendar.d.ts +0 -20
- package/dist/components/ui/card.d.ts +0 -21
- package/dist/components/ui/carousel.d.ts +0 -31
- package/dist/components/ui/chart.d.ts +0 -55
- package/dist/components/ui/checkbox.d.ts +0 -16
- package/dist/components/ui/collapsible.d.ts +0 -16
- package/dist/components/ui/command.d.ts +0 -29
- package/dist/components/ui/context-menu.d.ts +0 -37
- package/dist/components/ui/dialog.d.ts +0 -33
- package/dist/components/ui/drawer.d.ts +0 -26
- package/dist/components/ui/dropdown-menu.d.ts +0 -37
- package/dist/components/ui/empty.d.ts +0 -22
- package/dist/components/ui/file-upload.d.ts +0 -24
- package/dist/components/ui/form.d.ts +0 -37
- package/dist/components/ui/google-maps-loader.d.ts +0 -33
- package/dist/components/ui/hover-card.d.ts +0 -18
- package/dist/components/ui/input-otp.d.ts +0 -23
- package/dist/components/ui/input.d.ts +0 -25
- package/dist/components/ui/label.d.ts +0 -15
- package/dist/components/ui/map-config.d.ts +0 -12
- package/dist/components/ui/map-layers.d.ts +0 -48
- package/dist/components/ui/map.d.ts +0 -82
- package/dist/components/ui/map.exports.d.ts +0 -25
- package/dist/components/ui/menubar.d.ts +0 -39
- package/dist/components/ui/navigation-menu.d.ts +0 -26
- package/dist/components/ui/notification-badge.d.ts +0 -24
- package/dist/components/ui/page-header.d.ts +0 -76
- package/dist/components/ui/pagination.d.ts +0 -25
- package/dist/components/ui/popover.d.ts +0 -19
- package/dist/components/ui/progress.d.ts +0 -15
- package/dist/components/ui/radio-group.d.ts +0 -17
- package/dist/components/ui/rating.d.ts +0 -24
- package/dist/components/ui/resizable.d.ts +0 -39
- package/dist/components/ui/route-map.d.ts +0 -41
- package/dist/components/ui/scroll-area.d.ts +0 -16
- package/dist/components/ui/search.d.ts +0 -20
- package/dist/components/ui/select.d.ts +0 -27
- package/dist/components/ui/separator.d.ts +0 -15
- package/dist/components/ui/sheet.d.ts +0 -26
- package/dist/components/ui/sidebar.d.ts +0 -69
- package/dist/components/ui/simple-map.d.ts +0 -57
- package/dist/components/ui/skeleton.d.ts +0 -14
- package/dist/components/ui/slider.d.ts +0 -16
- package/dist/components/ui/sonner.d.ts +0 -15
- package/dist/components/ui/stats-card.d.ts +0 -29
- package/dist/components/ui/stepper.d.ts +0 -31
- package/dist/components/ui/switch.d.ts +0 -15
- package/dist/components/ui/table.d.ts +0 -22
- package/dist/components/ui/tabs.d.ts +0 -19
- package/dist/components/ui/textarea.d.ts +0 -15
- package/dist/components/ui/timeline.d.ts +0 -24
- package/dist/components/ui/toggle-group.d.ts +0 -24
- package/dist/components/ui/toggle.d.ts +0 -23
- package/dist/components/ui/tooltip.d.ts +0 -19
- package/dist/components/ui/tree-view.d.ts +0 -28
- package/dist/components/ui/use-mobile.d.ts +0 -2
- package/dist/components/ui/utils.d.ts +0 -2
- package/dist/components/ui/xertica-assistant.d.ts +0 -241
- package/dist/contexts/ApiKeyContext.d.ts +0 -15
- package/dist/contexts/BrandColorsContext.d.ts +0 -19
- package/dist/contexts/LanguageContext.d.ts +0 -11
- package/dist/contexts/ThemeContext.d.ts +0 -16
- package/dist/contexts/index.d.ts +0 -7
- package/dist/contexts/theme-data.d.ts +0 -81
- package/dist/index-D6V_7QbH.js +0 -99663
- package/dist/index-DHlP-IBS.js +0 -99663
- package/dist/utils/demo-responses.d.ts +0 -2
- package/dist/utils/gemini.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,31 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.9.0] — 2026-05-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Standardized Form Sizing System** — Implemented a unified `size` prop (`sm`, `md`, `lg`) across all form-related components for perfect visual alignment in grid layouts:
|
|
14
|
+
- **Text Components** — `Input`, `SelectTrigger`, `Textarea`, `Search`, and `InputOTPSlot` now share consistent height/padding/font-size tokens.
|
|
15
|
+
- **Toggle Components** — `Checkbox`, `RadioGroupItem`, and `Switch` now feature dynamic sizing for both containers and internal indicators (check icon, dot, thumb).
|
|
16
|
+
- **Labels** — `Label` component now supports `size` to match the text size of the associated input.
|
|
17
|
+
- **Reference Guide** — Added `docs/form-sizing.md` as a comprehensive guide for the standardized sizing scale.
|
|
18
|
+
- **Assistant Individual Controls** — Added granular control props to `XerticaAssistant` to toggle specific features independently:
|
|
19
|
+
- `showHistory`, `showFavorites`, `allowAudioInput`, `allowFileUpload`, `allowDocCreation`, `allowPodcastGen`, `allowResearchGen`.
|
|
20
|
+
- **Header Breadcrumb Navigation** — Standardized `Header` to use breadcrumbs as the default navigation pattern:
|
|
21
|
+
- Added support for `react-router-dom` links in breadcrumbs to prevent page reloads.
|
|
22
|
+
- Configurable hierarchy levels and labels directly via props.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- **Form Component Architecture** — Migrated form elements from legacy tokens to standardized design system tokens (`bg-background`, `border-border`) for better theme consistency.
|
|
26
|
+
- **Documentation & Storybook** — Updated all 9 affected form components with new "Sizes" sections in Storybook (Stories + MDX) and enriched LLM-facing markdown documentation.
|
|
27
|
+
- **Unit Testing** — Updated test suites for `Checkbox`, `RadioGroup`, `Switch`, `InputOTP`, `Label`, `Search`, `Select`, and `Textarea` to verify sizing variant classes.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- **Search Component** — Removed obsolete `loading` prop which was causing TypeScript errors and was redundant with the current design system patterns.
|
|
31
|
+
- **SelectTrigger Sizing** — Standardized `md` height to `h-10` (40px) to match the rest of the form system.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
10
35
|
## [1.8.0] — 2026-04-27
|
|
11
36
|
|
|
12
37
|
### Added
|
|
@@ -35,6 +35,16 @@ interface ModernChatInputProps {
|
|
|
35
35
|
onVoiceRecording?: (transcript: string) => void;
|
|
36
36
|
/** Whether the input is being used in a full-page view (affects layout) */
|
|
37
37
|
isFullPage?: boolean;
|
|
38
|
+
/** Whether to show audio input (voice recording). @default true */
|
|
39
|
+
enableAudioInput?: boolean;
|
|
40
|
+
/** Whether to show the file attachment button. @default true */
|
|
41
|
+
enableFileAttachment?: boolean;
|
|
42
|
+
/** Whether to show the "Create document" action. @default true */
|
|
43
|
+
enableDocumentCreation?: boolean;
|
|
44
|
+
/** Whether to show the "Generate podcast" action. @default true */
|
|
45
|
+
enablePodcastGeneration?: boolean;
|
|
46
|
+
/** Whether to show the "Search" action. @default true */
|
|
47
|
+
enableSearch?: boolean;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
/**
|
|
@@ -58,7 +68,12 @@ export function ModernChatInput({
|
|
|
58
68
|
onFileUpload,
|
|
59
69
|
onAudioUpload,
|
|
60
70
|
onVoiceRecording,
|
|
61
|
-
isFullPage = false
|
|
71
|
+
isFullPage = false,
|
|
72
|
+
enableAudioInput = true,
|
|
73
|
+
enableFileAttachment = true,
|
|
74
|
+
enableDocumentCreation = true,
|
|
75
|
+
enablePodcastGeneration = true,
|
|
76
|
+
enableSearch = true,
|
|
62
77
|
}: ModernChatInputProps) {
|
|
63
78
|
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
64
79
|
const [isFocused, setIsFocused] = useState(false);
|
|
@@ -355,6 +370,7 @@ export function ModernChatInput({
|
|
|
355
370
|
<div className="flex items-center justify-between">
|
|
356
371
|
{/* Left Actions */}
|
|
357
372
|
<div className="flex items-center gap-1">
|
|
373
|
+
{(enableDocumentCreation || enablePodcastGeneration || enableSearch) && (
|
|
358
374
|
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
|
|
359
375
|
<PopoverTrigger asChild>
|
|
360
376
|
<Button
|
|
@@ -378,54 +394,62 @@ export function ModernChatInput({
|
|
|
378
394
|
side="top"
|
|
379
395
|
>
|
|
380
396
|
<div className="space-y-1">
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
<
|
|
387
|
-
|
|
388
|
-
<div className="flex-1">
|
|
389
|
-
<div>Criar documento</div>
|
|
390
|
-
<div className="text-xs text-muted-foreground">
|
|
391
|
-
Gere um documento completo
|
|
397
|
+
{enableDocumentCreation && (
|
|
398
|
+
<button
|
|
399
|
+
onClick={() => handleActionSelect('document')}
|
|
400
|
+
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group"
|
|
401
|
+
>
|
|
402
|
+
<div className="w-8 h-8 rounded-full bg-[var(--chart-4)]/20 flex items-center justify-center group-hover:bg-[var(--chart-4)] transition-colors">
|
|
403
|
+
<FileText className="w-4 h-4 text-[var(--chart-4)] group-hover:text-white" />
|
|
392
404
|
</div>
|
|
393
|
-
|
|
394
|
-
|
|
405
|
+
<div className="flex-1">
|
|
406
|
+
<div>Criar documento</div>
|
|
407
|
+
<div className="text-xs text-muted-foreground">
|
|
408
|
+
Gere um documento completo
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
</button>
|
|
412
|
+
)}
|
|
395
413
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
<
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
<div
|
|
405
|
-
|
|
406
|
-
|
|
414
|
+
{enablePodcastGeneration && (
|
|
415
|
+
<button
|
|
416
|
+
onClick={() => handleActionSelect('podcast')}
|
|
417
|
+
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group"
|
|
418
|
+
>
|
|
419
|
+
<div className="w-8 h-8 rounded-full bg-[var(--chart-1)]/20 flex items-center justify-center group-hover:bg-[var(--chart-1)] transition-colors">
|
|
420
|
+
<Radio className="w-4 h-4 text-[var(--chart-1)] group-hover:text-white" />
|
|
421
|
+
</div>
|
|
422
|
+
<div className="flex-1">
|
|
423
|
+
<div>Gerar podcast</div>
|
|
424
|
+
<div className="text-xs text-muted-foreground">
|
|
425
|
+
Crie um podcast de áudio
|
|
426
|
+
</div>
|
|
407
427
|
</div>
|
|
408
|
-
</
|
|
409
|
-
|
|
428
|
+
</button>
|
|
429
|
+
)}
|
|
410
430
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
<
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
<div>
|
|
420
|
-
|
|
421
|
-
|
|
431
|
+
{enableSearch && (
|
|
432
|
+
<button
|
|
433
|
+
onClick={() => handleActionSelect('search')}
|
|
434
|
+
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group"
|
|
435
|
+
>
|
|
436
|
+
<div className="w-8 h-8 rounded-full bg-[var(--chart-2)]/20 flex items-center justify-center group-hover:bg-[var(--chart-2)] transition-colors">
|
|
437
|
+
<Search className="w-4 h-4 text-[var(--chart-2)] group-hover:text-white" />
|
|
438
|
+
</div>
|
|
439
|
+
<div className="flex-1">
|
|
440
|
+
<div>Pesquisar</div>
|
|
441
|
+
<div className="text-xs text-muted-foreground">
|
|
442
|
+
Busque por informações relevantes
|
|
443
|
+
</div>
|
|
422
444
|
</div>
|
|
423
|
-
</
|
|
424
|
-
|
|
445
|
+
</button>
|
|
446
|
+
)}
|
|
425
447
|
</div>
|
|
426
448
|
</PopoverContent>
|
|
427
449
|
</Popover>
|
|
450
|
+
)}
|
|
428
451
|
|
|
452
|
+
{enableFileAttachment && (
|
|
429
453
|
<motion.div
|
|
430
454
|
whileHover={{ scale: 1.05 }}
|
|
431
455
|
whileTap={{ scale: 0.95 }}
|
|
@@ -440,29 +464,32 @@ export function ModernChatInput({
|
|
|
440
464
|
<Paperclip className="w-4 h-4" />
|
|
441
465
|
</Button>
|
|
442
466
|
</motion.div>
|
|
467
|
+
)}
|
|
443
468
|
</div>
|
|
444
469
|
|
|
445
470
|
{/* Right Actions */}
|
|
446
471
|
<div className="flex items-center gap-1">
|
|
447
472
|
{/* Voice Recording Button */}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
<Button
|
|
453
|
-
variant="ghost"
|
|
454
|
-
size="sm"
|
|
455
|
-
onClick={handleVoiceRecording}
|
|
456
|
-
className={`h-8 w-8 p-0 rounded-full transition-all duration-200 ${
|
|
457
|
-
isRecording
|
|
458
|
-
? 'bg-destructive hover:bg-destructive/90 text-white animate-pulse'
|
|
459
|
-
: 'text-muted-foreground hover:bg-accent hover:text-foreground'
|
|
460
|
-
}`}
|
|
461
|
-
aria-label={isRecording ? "Parar gravação" : "Sugerir com voz"}
|
|
473
|
+
{enableAudioInput && (
|
|
474
|
+
<motion.div
|
|
475
|
+
whileHover={{ scale: 1.05 }}
|
|
476
|
+
whileTap={{ scale: 0.95 }}
|
|
462
477
|
>
|
|
463
|
-
<
|
|
464
|
-
|
|
465
|
-
|
|
478
|
+
<Button
|
|
479
|
+
variant="ghost"
|
|
480
|
+
size="sm"
|
|
481
|
+
onClick={handleVoiceRecording}
|
|
482
|
+
className={`h-8 w-8 p-0 rounded-full transition-all duration-200 ${
|
|
483
|
+
isRecording
|
|
484
|
+
? 'bg-destructive hover:bg-destructive/90 text-white animate-pulse'
|
|
485
|
+
: 'text-muted-foreground hover:bg-accent hover:text-foreground'
|
|
486
|
+
}`}
|
|
487
|
+
aria-label={isRecording ? "Parar gravação" : "Sugerir com voz"}
|
|
488
|
+
>
|
|
489
|
+
<Mic className="w-4 h-4" />
|
|
490
|
+
</Button>
|
|
491
|
+
</motion.div>
|
|
492
|
+
)}
|
|
466
493
|
|
|
467
494
|
<AnimatePresence mode="wait">
|
|
468
495
|
<motion.div
|
|
@@ -30,9 +30,42 @@ Adjusts maximum width and alignment for use in standalone chat pages.
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## Feature Flags
|
|
34
|
+
|
|
35
|
+
Each input capability can be individually toggled via boolean props.
|
|
36
|
+
All flags default to `true` for full backward compatibility.
|
|
37
|
+
|
|
38
|
+
| Prop | Controls | Default |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `enableAudioInput` | Voice recording button | `true` |
|
|
41
|
+
| `enableFileAttachment` | File attachment (paperclip) button | `true` |
|
|
42
|
+
| `enableDocumentCreation` | "Create document" menu item | `true` |
|
|
43
|
+
| `enablePodcastGeneration` | "Generate podcast" menu item | `true` |
|
|
44
|
+
| `enableSearch` | "Search" menu item | `true` |
|
|
45
|
+
|
|
46
|
+
> [!NOTE]
|
|
47
|
+
> When all three action types (`enableDocumentCreation`, `enablePodcastGeneration`, `enableSearch`) are set to `false`, the "+" menu button is completely hidden.
|
|
48
|
+
|
|
49
|
+
### Text Only
|
|
50
|
+
All action buttons disabled — only the text input and send button remain.
|
|
51
|
+
|
|
52
|
+
<Canvas>
|
|
53
|
+
<ModernChatInputStories.TextOnly />
|
|
54
|
+
</Canvas>
|
|
55
|
+
|
|
56
|
+
### Selective Actions
|
|
57
|
+
Only document creation and search are enabled for a focused workflow.
|
|
58
|
+
|
|
59
|
+
<Canvas>
|
|
60
|
+
<ModernChatInputStories.SelectiveActions />
|
|
61
|
+
</Canvas>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
33
65
|
## AI Best Practices
|
|
34
66
|
|
|
35
67
|
> [!IMPORTANT]
|
|
36
68
|
> - **Action Workflow** — Handle the `onSubmit` callback's optional `action` parameter to distinguish between standard text messages and intent-driven generations (Documents, Podcasts, Search).
|
|
37
69
|
> - **State Sync** — Always maintain the `value` in a parent state and update it via `onChange` and `onVoiceRecording` to ensure consistent data binding.
|
|
38
70
|
> - **Dynamic Sizing** — The input automatically expands up to 100px based on content; ensure the parent container can accommodate these height changes without layout shift.
|
|
71
|
+
> - **Feature Flags** — Pass flags like `enableSearch={false}` or `enableAudioInput={false}` to tailor input capabilities per use-case. Flags are independent and can be combined freely.
|
|
@@ -8,6 +8,28 @@ const meta: Meta<typeof ModernChatInput> = {
|
|
|
8
8
|
parameters: {
|
|
9
9
|
layout: 'centered',
|
|
10
10
|
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
enableAudioInput: {
|
|
13
|
+
control: 'boolean',
|
|
14
|
+
description: 'Whether to show audio input (voice recording).',
|
|
15
|
+
},
|
|
16
|
+
enableFileAttachment: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
description: 'Whether to show the file attachment button.',
|
|
19
|
+
},
|
|
20
|
+
enableDocumentCreation: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Whether to show the "Create document" action.',
|
|
23
|
+
},
|
|
24
|
+
enablePodcastGeneration: {
|
|
25
|
+
control: 'boolean',
|
|
26
|
+
description: 'Whether to show the "Generate podcast" action.',
|
|
27
|
+
},
|
|
28
|
+
enableSearch: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether to show the "Search" action.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
11
33
|
};
|
|
12
34
|
|
|
13
35
|
export default meta;
|
|
@@ -51,3 +73,59 @@ export const FullPage: Story = {
|
|
|
51
73
|
);
|
|
52
74
|
},
|
|
53
75
|
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Text-only input: all action buttons and extras are disabled.
|
|
79
|
+
* Only the text input and send button remain.
|
|
80
|
+
*/
|
|
81
|
+
export const TextOnly: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
enableAudioInput: false,
|
|
84
|
+
enableFileAttachment: false,
|
|
85
|
+
enableDocumentCreation: false,
|
|
86
|
+
enablePodcastGeneration: false,
|
|
87
|
+
enableSearch: false,
|
|
88
|
+
},
|
|
89
|
+
render: (args) => {
|
|
90
|
+
const [value, setValue] = useState("");
|
|
91
|
+
return (
|
|
92
|
+
<div className="w-[600px]">
|
|
93
|
+
<ModernChatInput
|
|
94
|
+
{...args}
|
|
95
|
+
value={value}
|
|
96
|
+
onChange={setValue}
|
|
97
|
+
onSubmit={() => setValue("")}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Selective features: only document creation and search are enabled.
|
|
106
|
+
*/
|
|
107
|
+
export const SelectiveActions: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
enableAudioInput: false,
|
|
110
|
+
enableFileAttachment: false,
|
|
111
|
+
enableDocumentCreation: true,
|
|
112
|
+
enablePodcastGeneration: false,
|
|
113
|
+
enableSearch: true,
|
|
114
|
+
},
|
|
115
|
+
render: (args) => {
|
|
116
|
+
const [value, setValue] = useState("");
|
|
117
|
+
return (
|
|
118
|
+
<div className="w-[600px]">
|
|
119
|
+
<ModernChatInput
|
|
120
|
+
{...args}
|
|
121
|
+
value={value}
|
|
122
|
+
onChange={setValue}
|
|
123
|
+
onSubmit={(action) => {
|
|
124
|
+
alert(`Submitted: "${value}" ${action ? `with action: ${action}` : ""}`);
|
|
125
|
+
setValue("");
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
@@ -12,6 +12,35 @@ import * as AssistantStories from './xertica-assistant.stories';
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Feature Flags
|
|
16
|
+
|
|
17
|
+
Each assistant capability can be individually toggled on or off via boolean props.
|
|
18
|
+
All flags default to `true` for full backward compatibility.
|
|
19
|
+
|
|
20
|
+
| Prop | Controls | Default |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| `showHistory` | Conversation history tab and collapsed icon | `true` |
|
|
23
|
+
| `showFavorites` | Favorites tab and collapsed icon | `true` |
|
|
24
|
+
| `enableAudioInput` | Voice recording and audio upload | `true` |
|
|
25
|
+
| `enableFileAttachment` | File attachment button | `true` |
|
|
26
|
+
| `enableDocumentCreation` | "Create document" action in the input menu | `true` |
|
|
27
|
+
| `enablePodcastGeneration` | "Generate podcast" action and per-message button | `true` |
|
|
28
|
+
| `enableSearch` | "Search" action in the input menu | `true` |
|
|
29
|
+
|
|
30
|
+
### Chat Only
|
|
31
|
+
|
|
32
|
+
All extra features disabled — the assistant provides only a basic text chat.
|
|
33
|
+
|
|
34
|
+
<Canvas of={AssistantStories.ChatOnly} />
|
|
35
|
+
|
|
36
|
+
### Minimal Input
|
|
37
|
+
|
|
38
|
+
Only document creation and file attachment are enabled — ideal for document-focused workflows.
|
|
39
|
+
|
|
40
|
+
<Canvas of={AssistantStories.MinimalInput} />
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
15
44
|
## Workspace Integration
|
|
16
45
|
|
|
17
46
|
The assistant features specialized workspaces for different content types.
|
|
@@ -34,4 +63,4 @@ For focused work, the assistant can be expanded into a centered full-page layout
|
|
|
34
63
|
> - **Layout Context** — Use `useLayout()` to toggle the assistant's visibility and track its state across the application.
|
|
35
64
|
> - **Demo Mode** — Use `demoMode={true}` for prototyping; it provides rich mock responses for documents, charts, and media.
|
|
36
65
|
> - **Custom Responses** — Leverage `responseGenerator` to bridge the assistant with your backend or custom LLM logic.
|
|
37
|
-
|
|
66
|
+
> - **Feature Flags** — Pass individual flags like `showHistory={false}` or `enableSearch={false}` to tailor the assistant's capabilities per use-case. Flags can be combined freely.
|
|
@@ -28,6 +28,34 @@ const meta: Meta<typeof XerticaAssistant> = {
|
|
|
28
28
|
control: 'boolean',
|
|
29
29
|
description: 'Whether the assistant is initially expanded.',
|
|
30
30
|
},
|
|
31
|
+
showHistory: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Whether to show the conversation history tab and collapsed icon.',
|
|
34
|
+
},
|
|
35
|
+
showFavorites: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Whether to show the favorites tab and collapsed icon.',
|
|
38
|
+
},
|
|
39
|
+
enableAudioInput: {
|
|
40
|
+
control: 'boolean',
|
|
41
|
+
description: 'Whether to enable audio input (voice recording / audio upload) in the chat.',
|
|
42
|
+
},
|
|
43
|
+
enableFileAttachment: {
|
|
44
|
+
control: 'boolean',
|
|
45
|
+
description: 'Whether to enable file attachment in the chat input.',
|
|
46
|
+
},
|
|
47
|
+
enableDocumentCreation: {
|
|
48
|
+
control: 'boolean',
|
|
49
|
+
description: 'Whether to enable the "Create document" action in the chat input.',
|
|
50
|
+
},
|
|
51
|
+
enablePodcastGeneration: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
description: 'Whether to enable podcast generation (action chip + per-message button).',
|
|
54
|
+
},
|
|
55
|
+
enableSearch: {
|
|
56
|
+
control: 'boolean',
|
|
57
|
+
description: 'Whether to enable the "Search" action in the chat input.',
|
|
58
|
+
},
|
|
31
59
|
},
|
|
32
60
|
};
|
|
33
61
|
|
|
@@ -101,3 +129,73 @@ export const DocumentEditing: Story = {
|
|
|
101
129
|
},
|
|
102
130
|
};
|
|
103
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Chat-only mode: hides history, favorites, audio, file attachments,
|
|
134
|
+
* document creation, podcast generation, and search.
|
|
135
|
+
* Only the basic text chat remains.
|
|
136
|
+
*/
|
|
137
|
+
export const ChatOnly: Story = {
|
|
138
|
+
decorators: [
|
|
139
|
+
(Story) => {
|
|
140
|
+
return (
|
|
141
|
+
<div className="h-screen w-full flex relative overflow-hidden bg-muted/30">
|
|
142
|
+
<div className="flex-1 flex flex-col p-8 gap-4">
|
|
143
|
+
<h1 className="text-2xl font-bold text-foreground">Chat Only Mode</h1>
|
|
144
|
+
<p className="text-muted-foreground">
|
|
145
|
+
All extra features are disabled. The assistant provides only a plain text chat interface.
|
|
146
|
+
</p>
|
|
147
|
+
</div>
|
|
148
|
+
<Story />
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
args: {
|
|
154
|
+
mode: 'expanded',
|
|
155
|
+
isExpanded: true,
|
|
156
|
+
userName: 'Jane Smith',
|
|
157
|
+
demoMode: true,
|
|
158
|
+
showHistory: false,
|
|
159
|
+
showFavorites: false,
|
|
160
|
+
enableAudioInput: false,
|
|
161
|
+
enableFileAttachment: false,
|
|
162
|
+
enableDocumentCreation: false,
|
|
163
|
+
enablePodcastGeneration: false,
|
|
164
|
+
enableSearch: false,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Minimal input mode: only document creation and file attachment are enabled.
|
|
170
|
+
* No audio input, no podcast generation, no search, no history, no favorites.
|
|
171
|
+
*/
|
|
172
|
+
export const MinimalInput: Story = {
|
|
173
|
+
decorators: [
|
|
174
|
+
(Story) => {
|
|
175
|
+
return (
|
|
176
|
+
<div className="h-screen w-full flex relative overflow-hidden bg-muted/30">
|
|
177
|
+
<div className="flex-1 flex flex-col p-8 gap-4">
|
|
178
|
+
<h1 className="text-2xl font-bold text-foreground">Minimal Input Mode</h1>
|
|
179
|
+
<p className="text-muted-foreground">
|
|
180
|
+
Only document creation and file attachment are enabled — ideal for a focused document-generation workflow.
|
|
181
|
+
</p>
|
|
182
|
+
</div>
|
|
183
|
+
<Story />
|
|
184
|
+
</div>
|
|
185
|
+
);
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
args: {
|
|
189
|
+
mode: 'expanded',
|
|
190
|
+
isExpanded: true,
|
|
191
|
+
userName: 'Jane Smith',
|
|
192
|
+
demoMode: true,
|
|
193
|
+
showHistory: false,
|
|
194
|
+
showFavorites: false,
|
|
195
|
+
enableAudioInput: false,
|
|
196
|
+
enableFileAttachment: true,
|
|
197
|
+
enableDocumentCreation: true,
|
|
198
|
+
enablePodcastGeneration: false,
|
|
199
|
+
enableSearch: false,
|
|
200
|
+
},
|
|
201
|
+
};
|