xertica-ui 1.7.0 → 1.7.3

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 (105) hide show
  1. package/components/Introduction.mdx +90 -0
  2. package/components/assistant/code-block/code-block.mdx +38 -38
  3. package/components/assistant/code-block/code-block.stories.tsx +57 -57
  4. package/components/assistant/formatted-document/FormattedDocument.tsx +7 -6
  5. package/components/assistant/formatted-document/formatted-document.mdx +31 -31
  6. package/components/assistant/formatted-document/formatted-document.stories.tsx +51 -51
  7. package/components/assistant/markdown-message/markdown-message.mdx +44 -44
  8. package/components/assistant/markdown-message/markdown-message.stories.tsx +50 -50
  9. package/components/assistant/modern-chat-input/modern-chat-input.mdx +38 -38
  10. package/components/assistant/modern-chat-input/modern-chat-input.stories.tsx +52 -52
  11. package/components/assistant/xertica-assistant/xertica-assistant.mdx +39 -39
  12. package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +74 -74
  13. package/components/blocks/audio-player/audio-player.mdx +31 -31
  14. package/components/blocks/document-editor/document-editor.mdx +31 -31
  15. package/components/blocks/podcast-player/podcast-player.mdx +38 -38
  16. package/components/brand/branding/branding.stories.tsx +55 -55
  17. package/components/brand/language-selector/LanguageSelector.tsx +4 -4
  18. package/components/brand/language-selector/language-selector.mdx +57 -57
  19. package/components/brand/language-selector/language-selector.stories.tsx +28 -28
  20. package/components/brand/theme-toggle/theme-toggle.mdx +47 -47
  21. package/components/brand/theme-toggle/theme-toggle.stories.tsx +34 -34
  22. package/components/brand/xertica-orbe/xertica-orbe.mdx +38 -38
  23. package/components/brand/xertica-orbe/xertica-orbe.stories.tsx +40 -40
  24. package/components/brand/xertica-provider/xertica-provider.mdx +55 -55
  25. package/components/layout/header/header.mdx +73 -73
  26. package/components/layout/header/header.stories.tsx +104 -104
  27. package/components/layout/sidebar/sidebar.mdx +117 -91
  28. package/components/layout/sidebar/sidebar.stories.tsx +257 -233
  29. package/components/layout/sidebar/sidebar.tsx +61 -56
  30. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +9 -9
  31. package/components/pages/login-page/LoginPage.mdx +31 -31
  32. package/components/pages/login-page/LoginPage.tsx +9 -9
  33. package/components/pages/reset-password-page/ResetPasswordPage.tsx +20 -21
  34. package/components/pages/template-content/TemplateContent.tsx +9 -9
  35. package/components/pages/verify-email-page/VerifyEmailPage.tsx +8 -8
  36. package/components/ui/accordion/accordion.mdx +41 -41
  37. package/components/ui/alert/alert.mdx +45 -45
  38. package/components/ui/alert-dialog/alert-dialog.mdx +31 -31
  39. package/components/ui/aspect-ratio/aspect-ratio.mdx +37 -37
  40. package/components/ui/assistant-chart/assistant-chart.mdx +30 -30
  41. package/components/ui/avatar/avatar.mdx +46 -46
  42. package/components/ui/badge/badge.mdx +43 -43
  43. package/components/ui/breadcrumb/breadcrumb.mdx +38 -38
  44. package/components/ui/button/button.mdx +73 -73
  45. package/components/ui/calendar/calendar.mdx +45 -45
  46. package/components/ui/card/card.mdx +45 -45
  47. package/components/ui/carousel/carousel.mdx +38 -38
  48. package/components/ui/chart/chart.mdx +38 -38
  49. package/components/ui/checkbox/checkbox.mdx +38 -38
  50. package/components/ui/collapsible/collapsible.mdx +30 -30
  51. package/components/ui/command/command.mdx +38 -38
  52. package/components/ui/context-menu/context-menu.mdx +31 -31
  53. package/components/ui/dialog/dialog.mdx +38 -38
  54. package/components/ui/drawer/drawer.mdx +31 -31
  55. package/components/ui/dropdown-menu/dropdown-menu.mdx +40 -40
  56. package/components/ui/empty/empty.mdx +45 -45
  57. package/components/ui/file-upload/file-upload.mdx +38 -38
  58. package/components/ui/file-upload/file-upload.tsx +2 -2
  59. package/components/ui/form/form.mdx +20 -20
  60. package/components/ui/hover-card/hover-card.mdx +31 -31
  61. package/components/ui/input/input.mdx +60 -60
  62. package/components/ui/input-otp/input-otp.mdx +38 -38
  63. package/components/ui/label/label.mdx +37 -37
  64. package/components/ui/map/map.mdx +38 -38
  65. package/components/ui/menubar/menubar.mdx +31 -31
  66. package/components/ui/navigation-menu/navigation-menu.mdx +31 -31
  67. package/components/ui/notification-badge/notification-badge.mdx +38 -38
  68. package/components/ui/page-header/page-header.mdx +43 -43
  69. package/components/ui/page-header/page-header.stories.tsx +68 -68
  70. package/components/ui/pagination/pagination.mdx +38 -38
  71. package/components/ui/popover/popover.mdx +38 -38
  72. package/components/ui/progress/progress.mdx +33 -33
  73. package/components/ui/radio-group/radio-group.mdx +38 -38
  74. package/components/ui/rating/rating.mdx +38 -38
  75. package/components/ui/resizable/resizable.mdx +38 -38
  76. package/components/ui/rich-text-editor/rich-text-editor.mdx +31 -31
  77. package/components/ui/route-map/route-map.mdx +38 -38
  78. package/components/ui/scroll-area/scroll-area.mdx +30 -30
  79. package/components/ui/search/search.mdx +38 -38
  80. package/components/ui/select/select.mdx +38 -38
  81. package/components/ui/separator/separator.mdx +37 -37
  82. package/components/ui/sheet/sheet.mdx +38 -38
  83. package/components/ui/simple-map/simple-map.mdx +37 -37
  84. package/components/ui/skeleton/skeleton.mdx +37 -37
  85. package/components/ui/slider/slider.mdx +38 -38
  86. package/components/ui/sonner/sonner.mdx +31 -31
  87. package/components/ui/stats-card/stats-card.mdx +38 -38
  88. package/components/ui/stepper/stepper.mdx +31 -31
  89. package/components/ui/switch/switch.mdx +37 -37
  90. package/components/ui/table/table.mdx +32 -32
  91. package/components/ui/tabs/tabs.mdx +38 -38
  92. package/components/ui/textarea/textarea.mdx +30 -30
  93. package/components/ui/timeline/timeline.mdx +31 -31
  94. package/components/ui/toggle/toggle.mdx +38 -38
  95. package/components/ui/toggle-group/toggle-group.mdx +38 -38
  96. package/components/ui/tooltip/tooltip.mdx +45 -45
  97. package/components/ui/tree-view/tree-view.mdx +31 -31
  98. package/dist/components/layout/sidebar/sidebar.d.ts +3 -1
  99. package/dist/index.es.js +20 -18
  100. package/dist/index.umd.js +20 -18
  101. package/dist/xertica-ui.css +1 -1
  102. package/package.json +5 -3
  103. package/styles/xertica/tokens.css +7 -7
  104. package/templates/package.json +2 -2
  105. package/templates/src/app/pages/Template/TemplateContent.tsx +1 -1
@@ -0,0 +1,90 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+ import { XerticaLogo } from './brand/xertica-logo/XerticaLogo';
3
+
4
+ <Meta title="Introduction" />
5
+
6
+ <div className="flex flex-col gap-8 py-12 max-w-4xl mx-auto">
7
+ <div className="flex flex-col items-center text-center space-y-4">
8
+ <div className="p-3">
9
+ <XerticaLogo className="h-16 w-auto" />
10
+ </div>
11
+ <h1 className="text-5xl font-extrabold tracking-tight text-foreground">Design System</h1>
12
+ <p className="text-xl text-muted-foreground max-w-2xl">
13
+ Official Design System for Xertica projects. Built with Tailwind CSS v4, Radix UI, and AI-first engineering.
14
+ </p>
15
+ <div className="flex gap-4 pt-4">
16
+ <a href="https://www.npmjs.com/package/xertica-ui" target="_blank" className="h-11 px-8 rounded-full border border-border bg-background text-foreground font-medium flex items-center hover:bg-accent transition-colors no-underline">
17
+ NPM
18
+ </a>
19
+ </div>
20
+ </div>
21
+
22
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6 pt-8">
23
+ <div className="p-6 rounded-[var(--radius-card)] border border-border bg-card shadow-sm hover:shadow-md transition-shadow">
24
+ <div className="w-10 h-10 bg-info/10 rounded-lg flex items-center justify-center mb-4 text-info">
25
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 2v8"/><path d="m16 6-4 4-4-4"/><rect width="20" height="8" x="2" y="14" rx="2"/></svg>
26
+ </div>
27
+ <h3 className="text-lg font-semibold mb-2">Instant Installation</h3>
28
+ <p className="text-sm text-muted-foreground leading-relaxed">
29
+ Add to your project with a single command. Integrated CLI for layout and theme scaffolding.
30
+ </p>
31
+ </div>
32
+
33
+ <div className="p-6 rounded-[var(--radius-card)] border border-border bg-card shadow-sm hover:shadow-md transition-shadow">
34
+ <div className="w-10 h-10 bg-success/10 rounded-lg flex items-center justify-center mb-4 text-success">
35
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/></svg>
36
+ </div>
37
+ <h3 className="text-lg font-semibold mb-2">Tailwind v4 Native</h3>
38
+ <p className="text-sm text-muted-foreground leading-relaxed">
39
+ Leverage the power of Tailwind CSS v4 with its new faster and more flexible engine.
40
+ </p>
41
+ </div>
42
+
43
+ <div className="p-6 rounded-[var(--radius-card)] border border-border bg-card shadow-sm hover:shadow-md transition-shadow">
44
+ <div className="w-10 h-10 bg-warning/10 rounded-lg flex items-center justify-center mb-4 text-warning">
45
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>
46
+ </div>
47
+ <h3 className="text-lg font-semibold mb-2">AI-Ready</h3>
48
+ <p className="text-sm text-muted-foreground leading-relaxed">
49
+ Documentation optimized for LLM prompt systems (Antigravity, Cursor, etc).
50
+ </p>
51
+ </div>
52
+ </div>
53
+
54
+ <div className="space-y-6 pt-12">
55
+ <h2 className="text-3xl font-bold border-b pb-2 border-border">Design Philosophy</h2>
56
+ <p className="text-lg leading-relaxed text-muted-foreground">
57
+ Xertica UI focuses on modularity and high performance for Xertica's ecosystem of products.
58
+ Our goal is to ensure functional consistency, accessibility (via Radix UI), and rapid development at scale.
59
+ </p>
60
+
61
+ <div className="bg-muted p-8 rounded-2xl space-y-4">
62
+ <h4 className="font-bold flex items-center gap-2">
63
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>
64
+ Ecosystem Highlights
65
+ </h4>
66
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
67
+ <div className="flex items-center gap-2 bg-background p-3 rounded-lg border border-border shadow-sm">
68
+ <span className="w-2 h-2 rounded-full bg-primary" />
69
+ <span><b>Radix UI</b> for accessible, unstyled primitives.</span>
70
+ </div>
71
+ <div className="flex items-center gap-2 bg-background p-3 rounded-lg border border-border shadow-sm">
72
+ <span className="w-2 h-2 rounded-full bg-primary" />
73
+ <span><b>Tailwind v4</b> ultra-fast engine.</span>
74
+ </div>
75
+ <div className="flex items-center gap-2 bg-background p-3 rounded-lg border border-border shadow-sm">
76
+ <span className="w-2 h-2 rounded-full bg-primary" />
77
+ <span><b>Dark Mode</b> native via CSS Tokens.</span>
78
+ </div>
79
+ <div className="flex items-center gap-2 bg-background p-3 rounded-lg border border-border shadow-sm">
80
+ <span className="w-2 h-2 rounded-full bg-primary" />
81
+ <span><b>Full Customization</b> via <code>tokens.css</code>.</span>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+
87
+ <div className="pt-12 text-center text-sm text-muted-foreground border-t border-border">
88
+ &copy; 2026 Xertica. All rights reserved.
89
+ </div>
90
+ </div>
@@ -1,38 +1,38 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
- import * as CodeBlockStories from './code-block.stories';
3
-
4
- <Meta of={CodeBlockStories} />
5
-
6
- <Title />
7
- <Subtitle>An elegant syntax highlighter with built-in copy functionality and Xertica branding.</Subtitle>
8
-
9
- <Description />
10
-
11
- <Primary />
12
-
13
- ---
14
-
15
- ## Usage Patterns
16
-
17
- ### Development Snippets
18
- Ideal for showing code examples with line numbers and filename headers.
19
-
20
- <Canvas>
21
- <CodeBlockStories.Default />
22
- </Canvas>
23
-
24
- ### Terminal Commands
25
- Compact view for shell commands or configuration highlights.
26
-
27
- <Canvas>
28
- <CodeBlockStories.Simple />
29
- </Canvas>
30
-
31
- ---
32
-
33
- ## AI Best Practices
34
-
35
- > [!IMPORTANT]
36
- > - **Language Selection** — Always specify the correct `language` prop to ensure accurate syntax highlighting.
37
- > - **Theme Consistency** — The underlying `elegantTheme` automatically maps to the system's CSS theme variables; ensure the `XerticaProvider` is wrapping the application for correct colors.
38
- > - **Clipboard Support** — Copy functionality includes progressive fallbacks for browsers with restricted clipboard permissions.
1
+ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as CodeBlockStories from './code-block.stories';
3
+
4
+ <Meta of={CodeBlockStories} />
5
+
6
+ <Title />
7
+ <Subtitle>An elegant syntax highlighter with built-in copy functionality and Xertica branding.</Subtitle>
8
+
9
+ <Description />
10
+
11
+ <Primary />
12
+
13
+ ---
14
+
15
+ ## Usage Patterns
16
+
17
+ ### Development Snippets
18
+ Ideal for showing code examples with line numbers and filename headers.
19
+
20
+ <Canvas>
21
+ <CodeBlockStories.Default />
22
+ </Canvas>
23
+
24
+ ### Terminal Commands
25
+ Compact view for shell commands or configuration highlights.
26
+
27
+ <Canvas>
28
+ <CodeBlockStories.Simple />
29
+ </Canvas>
30
+
31
+ ---
32
+
33
+ ## AI Best Practices
34
+
35
+ > [!IMPORTANT]
36
+ > - **Language Selection** — Always specify the correct `language` prop to ensure accurate syntax highlighting.
37
+ > - **Theme Consistency** — The underlying `elegantTheme` automatically maps to the system's CSS theme variables; ensure the `XerticaProvider` is wrapping the application for correct colors.
38
+ > - **Clipboard Support** — Copy functionality includes progressive fallbacks for browsers with restricted clipboard permissions.
@@ -1,57 +1,57 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { CodeBlock } from './CodeBlock';
3
- import React from 'react';
4
-
5
- const meta: Meta<typeof CodeBlock> = {
6
- title: 'High-Level/CodeBlock',
7
- component: CodeBlock,
8
- argTypes: {
9
- language: {
10
- control: 'select',
11
- options: ['typescript', 'tsx', 'css', 'bash', 'jsx'],
12
- },
13
- },
14
- };
15
-
16
- export default meta;
17
- type Story = StoryObj<typeof CodeBlock>;
18
-
19
- const exampleCode = `function HelloWorld() {
20
- const [count, setCount] = useState(0);
21
-
22
- return (
23
- <div className="flex flex-col gap-4">
24
- <h1 className="text-2xl font-bold">Counter</h1>
25
- <p>Current count: {count}</p>
26
- <Button onClick={() => setCount(count + 1)}>
27
- Increment
28
- </Button>
29
- </div>
30
- );
31
- }`;
32
-
33
- export const Default: Story = {
34
- args: {
35
- code: exampleCode,
36
- language: 'tsx',
37
- filename: 'Counter.tsx',
38
- showLineNumbers: true,
39
- },
40
- render: (args) => (
41
- <div className="w-full max-w-3xl">
42
- <CodeBlock {...args} />
43
- </div>
44
- ),
45
- };
46
-
47
- export const Simple: Story = {
48
- args: {
49
- code: 'npm install xertica-ui',
50
- language: 'bash',
51
- },
52
- render: (args) => (
53
- <div className="w-full max-w-xl">
54
- <CodeBlock {...args} />
55
- </div>
56
- ),
57
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { CodeBlock } from './CodeBlock';
3
+ import React from 'react';
4
+
5
+ const meta: Meta<typeof CodeBlock> = {
6
+ title: 'Assistant/CodeBlock',
7
+ component: CodeBlock,
8
+ argTypes: {
9
+ language: {
10
+ control: 'select',
11
+ options: ['typescript', 'tsx', 'css', 'bash', 'jsx'],
12
+ },
13
+ },
14
+ };
15
+
16
+ export default meta;
17
+ type Story = StoryObj<typeof CodeBlock>;
18
+
19
+ const exampleCode = `function HelloWorld() {
20
+ const [count, setCount] = useState(0);
21
+
22
+ return (
23
+ <div className="flex flex-col gap-4">
24
+ <h1 className="text-2xl font-bold">Counter</h1>
25
+ <p>Current count: {count}</p>
26
+ <Button onClick={() => setCount(count + 1)}>
27
+ Increment
28
+ </Button>
29
+ </div>
30
+ );
31
+ }`;
32
+
33
+ export const Default: Story = {
34
+ args: {
35
+ code: exampleCode,
36
+ language: 'tsx',
37
+ filename: 'Counter.tsx',
38
+ showLineNumbers: true,
39
+ },
40
+ render: (args) => (
41
+ <div className="w-full max-w-3xl">
42
+ <CodeBlock {...args} />
43
+ </div>
44
+ ),
45
+ };
46
+
47
+ export const Simple: Story = {
48
+ args: {
49
+ code: 'npm install xertica-ui',
50
+ language: 'bash',
51
+ },
52
+ render: (args) => (
53
+ <div className="w-full max-w-xl">
54
+ <CodeBlock {...args} />
55
+ </div>
56
+ ),
57
+ };
@@ -46,13 +46,14 @@ export function FormattedDocument({ content, maxPreviewLength = 500, className =
46
46
  // Italic
47
47
  html = html.replace(/\*(.*?)\*/g, '<em class="italic">$1</em>');
48
48
 
49
- // Lists
50
- html = html.replace(/^\- (.*$)/gim, '<li class="ml-4 my-0.5">• $1</li>');
51
- html = html.replace(/^\d+\. (.*$)/gim, '<li class="ml-4 my-0.5">$1</li>');
49
+ // Checkboxes (Process before lists to avoid collisions)
50
+ html = html.replace(/^[-*+] \[ \] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-1"><input type="checkbox" disabled class="rounded w-3.5 h-3.5 accent-primary" aria-label="$1" /> <span class="text-sm">$1</span></div>');
51
+ html = html.replace(/^[-*+] \[x\] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-1"><input type="checkbox" checked disabled class="rounded w-3.5 h-3.5 accent-primary" aria-label="$1" /> <span class="text-sm">$1</span></div>');
52
52
 
53
- // Checkboxes
54
- html = html.replace(/- \[ \] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-1"><input type="checkbox" disabled class="rounded w-3 h-3" aria-label="$1" /> <span class="text-sm">$1</span></div>');
55
- html = html.replace(/- \[x\] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-1"><input type="checkbox" checked disabled class="rounded w-3 h-3" aria-label="$1" /> <span class="text-sm">$1</span></div>');
53
+ // Lists (Bullet and Numbered)
54
+ // Using <li> with Tailwind list classes to avoid double-bullets while maintaining native flow
55
+ html = html.replace(/^[-*+] (.*$)/gim, '<li class="ml-6 my-1 list-disc">$1</li>');
56
+ html = html.replace(/^(\d+)\. (.*$)/gim, '<li class="ml-6 my-1 list-decimal">$2</li>');
56
57
 
57
58
  // Horizontal rule
58
59
  html = html.replace(/^---$/gim, '<hr class="my-3 border-border" />');
@@ -1,31 +1,31 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
- import * as FormattedDocumentStories from './formatted-document.stories';
3
-
4
- <Meta of={FormattedDocumentStories} />
5
-
6
- <Title />
7
- <Subtitle>A lightweight markdown renderer for displaying AI-generated summaries and documentation.</Subtitle>
8
-
9
- <Description />
10
-
11
- <Primary />
12
-
13
- ---
14
-
15
- ## Usage Patterns
16
-
17
- ### Collapsible Content
18
- Ideal for displaying long AI responses where a "See more" toggle is needed to preserve page verticality.
19
-
20
- <Canvas>
21
- <FormattedDocumentStories.Default />
22
- </Canvas>
23
-
24
- ---
25
-
26
- ## AI Best Practices
27
-
28
- > [!IMPORTANT]
29
- > - **Markdown Compatibility** — Supports basic markdown: headers (`#`), bold (`**`), lists (`-`), and checkboxes (`- [ ]`). It does not support complex nested tables or markdown-in-html.
30
- > - **Preview Mode** — Use `maxPreviewLength` to control the initial character count before truncation. Defaults to 500.
31
- > - **Safe Injection** — Content is rendered via `dangerouslySetInnerHTML`. Ensure the source content (e.g., from an AI API) is trustable and sanitized if necessary.
1
+ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as FormattedDocumentStories from './formatted-document.stories';
3
+
4
+ <Meta of={FormattedDocumentStories} />
5
+
6
+ <Title />
7
+ <Subtitle>A lightweight markdown renderer for displaying AI-generated summaries and documentation.</Subtitle>
8
+
9
+ <Description />
10
+
11
+ <Primary />
12
+
13
+ ---
14
+
15
+ ## Usage Patterns
16
+
17
+ ### Collapsible Content
18
+ Ideal for displaying long AI responses where a "See more" toggle is needed to preserve page verticality.
19
+
20
+ <Canvas>
21
+ <FormattedDocumentStories.Default />
22
+ </Canvas>
23
+
24
+ ---
25
+
26
+ ## AI Best Practices
27
+
28
+ > [!IMPORTANT]
29
+ > - **Markdown Compatibility** — Supports basic markdown: headers (`#`), bold (`**`), lists (`-`), and checkboxes (`- [ ]`). It does not support complex nested tables or markdown-in-html.
30
+ > - **Preview Mode** — Use `maxPreviewLength` to control the initial character count before truncation. Defaults to 500.
31
+ > - **Safe Injection** — Content is rendered via `dangerouslySetInnerHTML`. Ensure the source content (e.g., from an AI API) is trustable and sanitized if necessary.
@@ -1,51 +1,51 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { FormattedDocument } from './FormattedDocument';
3
- import React from 'react';
4
-
5
- const meta: Meta<typeof FormattedDocument> = {
6
- title: 'High-Level/FormattedDocument',
7
- component: FormattedDocument,
8
- argTypes: {
9
- maxPreviewLength: { control: 'number' },
10
- },
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof FormattedDocument>;
15
-
16
- const longContent = `# Proposta Estratégica Xertica
17
- ## Visão Geral
18
- Esta proposta descreve a implementação de uma camada de inteligência artificial generativa em toda a jornada do cliente.
19
-
20
- ### Objetivos Principais
21
- - Redução de latência no atendimento em até 40%
22
- - Aumento na taxa de conversão de leads qualificados
23
- - Automação de relatórios semanais para gestão
24
-
25
- ### Cronograma
26
- 1. **Semana 1-2:** Discovery e Mapeamento de Dados
27
- 2. **Semana 3-4:** Setup de Infraestrutura e Agentes
28
- 3. **Semana 5-8:** Implementação Pilot e Feedback Loop
29
-
30
- ## Detalhamento Técnico
31
- A arquitetura baseia-se em RAG (Retrieval Augmented Generation) utilizando bases vetoriais de alto desempenho. Os agentes são orquestrados em tempo real para garantir respostas precisas e contextuais.
32
-
33
- - [x] Definição de personas
34
- - [x] Configuração de guardrails
35
- - [ ] Integração com CRM
36
- - [ ] Deploy global
37
-
38
- ---
39
- **Nota:** Esta é uma versão preliminar para revisão da diretoria.`;
40
-
41
- export const Default: Story = {
42
- args: {
43
- content: longContent,
44
- maxPreviewLength: 200,
45
- },
46
- render: (args) => (
47
- <div className="w-full max-w-xl p-6 border rounded-xl bg-card">
48
- <FormattedDocument {...args} />
49
- </div>
50
- ),
51
- };
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { FormattedDocument } from './FormattedDocument';
3
+ import React from 'react';
4
+
5
+ const meta: Meta<typeof FormattedDocument> = {
6
+ title: 'Assistant/FormattedDocument',
7
+ component: FormattedDocument,
8
+ argTypes: {
9
+ maxPreviewLength: { control: 'number' },
10
+ },
11
+ };
12
+
13
+ export default meta;
14
+ type Story = StoryObj<typeof FormattedDocument>;
15
+
16
+ const longContent = `# Strategic Project Proposal
17
+ ## Overview
18
+ This proposal describes the implementation of a generative artificial intelligence layer across the entire customer journey.
19
+
20
+ ### Key Objectives
21
+ - Reduce service latency by up to 40%
22
+ - Increase qualified lead conversion rate
23
+ - Automate weekly management reports
24
+
25
+ ### Roadmap
26
+ 1. **Week 1-2:** Discovery and Data Mapping
27
+ 2. **Week 3-4:** Infrastructure and Agent Setup
28
+ 3. **Week 5-8:** Pilot Implementation and Feedback Loop
29
+
30
+ ## Technical Details
31
+ The architecture is based on RAG (Retrieval Augmented Generation) using high-performance vector databases. Agents are orchestrated in real-time to ensure accurate and contextual responses.
32
+
33
+ - [x] Persona definition
34
+ - [x] Guardrails configuration
35
+ - [ ] CRM integration
36
+ - [ ] Global deployment
37
+
38
+ ---
39
+ **Note:** This is a preliminary version for board review.`;
40
+
41
+ export const Default: Story = {
42
+ args: {
43
+ content: longContent,
44
+ maxPreviewLength: 200,
45
+ },
46
+ render: (args) => (
47
+ <div className="w-full max-w-xl p-6 border rounded-xl bg-card">
48
+ <FormattedDocument {...args} />
49
+ </div>
50
+ ),
51
+ };
@@ -1,44 +1,44 @@
1
- import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
- import * as MarkdownMessageStories from './markdown-message.stories';
3
-
4
- <Meta of={MarkdownMessageStories} />
5
-
6
- <Title />
7
- <Subtitle>Renders AI assistant messages as formatted Markdown with syntax-highlighted code blocks.</Subtitle>
8
-
9
- <Description />
10
-
11
- <Primary />
12
-
13
- ---
14
-
15
- ## Usage
16
-
17
- ```tsx
18
- import { MarkdownMessage } from 'xertica-ui';
19
-
20
- <MarkdownMessage content="**Hello!** Here is a `code` example." />
21
- ```
22
-
23
- ## Props
24
-
25
- | Prop | Type | Default | Description |
26
- |---|---|---|---|
27
- | `content` | `string` | _(required)_ | The Markdown string to render |
28
- | `className` | `string` | `''` | Additional CSS classes on the root container |
29
-
30
- ## Supported Markdown
31
-
32
- - **Bold**, _italic_, ~~strikethrough~~
33
- - `inline code` and fenced code blocks with syntax highlighting
34
- - Lists (ordered and unordered)
35
- - Headers (`# H1`, `## H2`, etc.)
36
- - Tables
37
- - Blockquotes
38
-
39
- ## AI Rules
40
-
41
- > [!IMPORTANT]
42
- > - This component is used **exclusively inside** `XerticaAssistant` message bubbles.
43
- > - Do not use it for general-purpose Markdown rendering outside the assistant context — use a standard Markdown library instead.
44
- > - Always sanitize content before passing it if coming from untrusted sources.
1
+ import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Canvas } from '@storybook/addon-docs/blocks';
2
+ import * as MarkdownMessageStories from './markdown-message.stories';
3
+
4
+ <Meta of={MarkdownMessageStories} />
5
+
6
+ <Title />
7
+ <Subtitle>Renders AI assistant messages as formatted Markdown with syntax-highlighted code blocks.</Subtitle>
8
+
9
+ <Description />
10
+
11
+ <Primary />
12
+
13
+ ---
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { MarkdownMessage } from 'xertica-ui';
19
+
20
+ <MarkdownMessage content="**Hello!** Here is a `code` example." />
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | Prop | Type | Default | Description |
26
+ |---|---|---|---|
27
+ | `content` | `string` | _(required)_ | The Markdown string to render |
28
+ | `className` | `string` | `''` | Additional CSS classes on the root container |
29
+
30
+ ## Supported Markdown
31
+
32
+ - **Bold**, _italic_, ~~strikethrough~~
33
+ - `inline code` and fenced code blocks with syntax highlighting
34
+ - Lists (ordered and unordered)
35
+ - Headers (`# H1`, `## H2`, etc.)
36
+ - Tables
37
+ - Blockquotes
38
+
39
+ ## AI Rules
40
+
41
+ > [!IMPORTANT]
42
+ > - This component is used **exclusively inside** `XerticaAssistant` message bubbles.
43
+ > - Do not use it for general-purpose Markdown rendering outside the assistant context — use a standard Markdown library instead.
44
+ > - Always sanitize content before passing it if coming from untrusted sources.