xertica-ui 1.6.2 → 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 (138) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/bin/cli.ts +2 -1
  3. package/bin/generate-tokens.ts +24 -0
  4. package/components/Introduction.mdx +90 -0
  5. package/components/assistant/code-block/CodeBlock.tsx +1 -0
  6. package/components/assistant/code-block/code-block.mdx +38 -38
  7. package/components/assistant/code-block/code-block.stories.tsx +57 -57
  8. package/components/assistant/formatted-document/FormattedDocument.tsx +7 -6
  9. package/components/assistant/formatted-document/formatted-document.mdx +31 -31
  10. package/components/assistant/formatted-document/formatted-document.stories.tsx +51 -51
  11. package/components/assistant/markdown-message/markdown-message.mdx +44 -44
  12. package/components/assistant/markdown-message/markdown-message.stories.tsx +50 -50
  13. package/components/assistant/modern-chat-input/ModernChatInput.tsx +6 -0
  14. package/components/assistant/modern-chat-input/modern-chat-input.mdx +38 -38
  15. package/components/assistant/modern-chat-input/modern-chat-input.stories.tsx +52 -52
  16. package/components/assistant/xertica-assistant/xertica-assistant.mdx +39 -39
  17. package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +74 -74
  18. package/components/assistant/xertica-assistant/xertica-assistant.tsx +9 -0
  19. package/components/blocks/audio-player/AudioPlayer.tsx +10 -7
  20. package/components/blocks/audio-player/audio-player.mdx +31 -31
  21. package/components/blocks/document-editor/DocumentEditor.tsx +7 -0
  22. package/components/blocks/document-editor/document-editor.mdx +31 -31
  23. package/components/blocks/podcast-player/PodcastPlayer.tsx +86 -65
  24. package/components/blocks/podcast-player/podcast-player.mdx +38 -38
  25. package/components/brand/branding/branding.stories.tsx +55 -55
  26. package/components/brand/language-selector/LanguageSelector.tsx +7 -4
  27. package/components/brand/language-selector/language-selector.mdx +57 -57
  28. package/components/brand/language-selector/language-selector.stories.tsx +28 -28
  29. package/components/brand/theme-toggle/ThemeToggle.tsx +1 -0
  30. package/components/brand/theme-toggle/theme-toggle.mdx +47 -47
  31. package/components/brand/theme-toggle/theme-toggle.stories.tsx +34 -34
  32. package/components/brand/xertica-logo/XerticaLogo.tsx +1 -0
  33. package/components/brand/xertica-orbe/XerticaOrbe.tsx +1 -0
  34. package/components/brand/xertica-orbe/xertica-orbe.mdx +38 -38
  35. package/components/brand/xertica-orbe/xertica-orbe.stories.tsx +40 -40
  36. package/components/brand/xertica-provider/xertica-provider.mdx +55 -55
  37. package/components/examples/ApiKeyMapExample.tsx +1 -0
  38. package/components/examples/DrawingMapExample.tsx +1 -1
  39. package/components/examples/MapGmpExample.tsx +2 -1
  40. package/components/examples/MapShowcase.tsx +2 -0
  41. package/components/layout/header/header.mdx +73 -73
  42. package/components/layout/header/header.stories.tsx +104 -104
  43. package/components/layout/header/header.tsx +5 -1
  44. package/components/layout/sidebar/sidebar.mdx +117 -91
  45. package/components/layout/sidebar/sidebar.stories.tsx +257 -233
  46. package/components/layout/sidebar/sidebar.tsx +73 -54
  47. package/components/layout/sidebar-primitive/sidebar-primitive.tsx +1 -0
  48. package/components/media/AudioPlayer.tsx +18 -12
  49. package/components/media/FloatingMediaWrapper.tsx +4 -0
  50. package/components/media/VideoPlayer.tsx +6 -0
  51. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +9 -9
  52. package/components/pages/login-page/LoginPage.mdx +31 -31
  53. package/components/pages/login-page/LoginPage.tsx +9 -9
  54. package/components/pages/reset-password-page/ResetPasswordPage.tsx +20 -21
  55. package/components/pages/template-content/TemplateContent.tsx +27 -20
  56. package/components/pages/verify-email-page/VerifyEmailPage.tsx +8 -8
  57. package/components/ui/accordion/accordion.mdx +41 -41
  58. package/components/ui/alert/alert.mdx +45 -45
  59. package/components/ui/alert-dialog/alert-dialog.mdx +31 -31
  60. package/components/ui/aspect-ratio/aspect-ratio.mdx +37 -37
  61. package/components/ui/assistant-chart/assistant-chart.mdx +30 -30
  62. package/components/ui/avatar/avatar.mdx +46 -46
  63. package/components/ui/badge/badge.mdx +43 -43
  64. package/components/ui/breadcrumb/breadcrumb.mdx +38 -38
  65. package/components/ui/button/button.mdx +73 -73
  66. package/components/ui/calendar/calendar.mdx +45 -45
  67. package/components/ui/calendar/calendar.tsx +3 -1
  68. package/components/ui/card/card.mdx +45 -45
  69. package/components/ui/carousel/carousel.mdx +38 -38
  70. package/components/ui/chart/chart.mdx +38 -38
  71. package/components/ui/checkbox/checkbox.mdx +38 -38
  72. package/components/ui/collapsible/collapsible.mdx +30 -30
  73. package/components/ui/command/command.mdx +38 -38
  74. package/components/ui/context-menu/context-menu.mdx +31 -31
  75. package/components/ui/dialog/dialog.mdx +38 -38
  76. package/components/ui/drawer/drawer.mdx +31 -31
  77. package/components/ui/dropdown-menu/dropdown-menu.mdx +40 -40
  78. package/components/ui/empty/empty.mdx +45 -45
  79. package/components/ui/file-upload/file-upload.mdx +38 -38
  80. package/components/ui/file-upload/file-upload.tsx +2 -2
  81. package/components/ui/form/form.mdx +20 -20
  82. package/components/ui/hover-card/hover-card.mdx +31 -31
  83. package/components/ui/input/input.mdx +60 -60
  84. package/components/ui/input-otp/input-otp.mdx +38 -38
  85. package/components/ui/label/label.mdx +37 -37
  86. package/components/ui/map/map.mdx +38 -38
  87. package/components/ui/menubar/menubar.mdx +31 -31
  88. package/components/ui/navigation-menu/navigation-menu.mdx +31 -31
  89. package/components/ui/notification-badge/notification-badge.mdx +38 -38
  90. package/components/ui/page-header/page-header.mdx +43 -43
  91. package/components/ui/page-header/page-header.stories.tsx +68 -68
  92. package/components/ui/page-header/page-header.tsx +1 -0
  93. package/components/ui/pagination/pagination.mdx +38 -38
  94. package/components/ui/popover/popover.mdx +38 -38
  95. package/components/ui/progress/progress.mdx +33 -33
  96. package/components/ui/radio-group/radio-group.mdx +38 -38
  97. package/components/ui/rating/rating.mdx +38 -38
  98. package/components/ui/resizable/resizable.mdx +38 -38
  99. package/components/ui/rich-text-editor/rich-text-editor.mdx +31 -31
  100. package/components/ui/rich-text-editor/rich-text-editor.tsx +11 -8
  101. package/components/ui/route-map/route-map.mdx +38 -38
  102. package/components/ui/scroll-area/scroll-area.mdx +30 -30
  103. package/components/ui/search/search.mdx +38 -38
  104. package/components/ui/search/search.tsx +2 -0
  105. package/components/ui/select/select.mdx +38 -38
  106. package/components/ui/separator/separator.mdx +37 -37
  107. package/components/ui/sheet/sheet.mdx +38 -38
  108. package/components/ui/simple-map/simple-map.mdx +37 -37
  109. package/components/ui/skeleton/skeleton.mdx +37 -37
  110. package/components/ui/slider/slider.mdx +38 -38
  111. package/components/ui/sonner/sonner.mdx +31 -31
  112. package/components/ui/stats-card/stats-card.mdx +38 -38
  113. package/components/ui/stepper/stepper.mdx +31 -31
  114. package/components/ui/switch/switch.mdx +37 -37
  115. package/components/ui/table/table.mdx +32 -32
  116. package/components/ui/tabs/tabs.mdx +38 -38
  117. package/components/ui/textarea/textarea.mdx +30 -30
  118. package/components/ui/timeline/timeline.mdx +31 -31
  119. package/components/ui/toggle/toggle.mdx +38 -38
  120. package/components/ui/toggle-group/toggle-group.mdx +38 -38
  121. package/components/ui/tooltip/tooltip.mdx +45 -45
  122. package/components/ui/tree-view/tree-view.mdx +31 -31
  123. package/dist/cli.js +26 -2
  124. package/dist/components/layout/sidebar/sidebar.d.ts +3 -1
  125. package/dist/index.es.js +245 -131
  126. package/dist/index.umd.js +245 -131
  127. package/dist/xertica-ui.css +1 -1
  128. package/docs/components/input.md +13 -0
  129. package/docs/components/podcast-player.md +2 -0
  130. package/docs/getting-started.md +47 -0
  131. package/llms-full.txt +15 -0
  132. package/llms.txt +11 -5
  133. package/package.json +5 -3
  134. package/styles/xertica/tokens.css +24 -7
  135. package/templates/package.json +2 -2
  136. package/templates/src/app/pages/Template/TemplateContent.tsx +1 -1
  137. package/templates/src/styles/index.css +91 -47
  138. package/templates/src/styles/xertica/tokens.css +17 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.7.0] — 2026-04-23
11
+
12
+ ### Fixed
13
+ - **CLI CSS Theme Import** — Corrected `@theme` → `@theme inline` in both the library's `index.css` and the generated template `src/styles/index.css`. Plain `@theme {}` was causing Tailwind v4 to resolve color tokens statically at build time using the library's defaults, preventing consumer `tokens.css` overrides from propagating into utility classes (`bg-destructive`, `bg-primary`, alert colors, etc.).
14
+ - **Dark Mode `--primary`** — Added missing `--primary: var(--xertica-primary)` in the dark mode block of `tokens.css` (library, template, and generator). Components using `bg-primary` were not picking up the dark mode brand color.
15
+ - **Dark Mode Chart Tokens** — Generator (`bin/generate-tokens.ts`) now includes `--chart-1` through `--chart-5` in the dark mode section for all generated `tokens.css` files.
16
+
17
+ ### Added
18
+ - **CLI `update` command** — `npx xertica-ui@latest update` prompts the user to select a new color theme and overwrites `src/styles/xertica/tokens.css` with the newly generated tokens, preserving all other project files.
19
+ - **Template `@theme inline` mapping** — Generated `src/styles/index.css` now includes a complete `@theme inline {}` block mapping all tokens (sidebar, charts, gradients, brand, radii) to CSS variable aliases, ensuring full theme coverage for consumer projects.
20
+ - **Documentation** — `docs/getting-started.md` updated with CLI `update` command reference and a new "CSS Setup (Critical)" section explaining the `@theme inline` requirement.
21
+
22
+ ---
23
+
10
24
  ## [1.6.0] — 2026-04-20
11
25
 
12
26
  ### Added
package/bin/cli.ts CHANGED
@@ -18,7 +18,7 @@ const program = new Command();
18
18
  program
19
19
  .name('xertica-ui')
20
20
  .description('CLI to initialize Xertica UI projects')
21
- .version('1.0.0');
21
+ .version('1.7.0');
22
22
 
23
23
  program
24
24
  .command('init')
@@ -243,6 +243,7 @@ ${routes.join('\n')}
243
243
 
244
244
  program
245
245
  .command('update')
246
+ .alias('update-theme')
246
247
  .description('Update theme tokens in your project')
247
248
  .action(async () => {
248
249
  const targetDir = process.cwd();
@@ -66,6 +66,14 @@ export const generateTokensCss = (theme: ColorTheme): string => {
66
66
  --destructive: rgba(239, 68, 68, 1);
67
67
  --destructive-foreground: rgba(250, 250, 250, 1);
68
68
 
69
+ /* Semantic Status Colors */
70
+ --success: rgba(5, 150, 105, 1);
71
+ --success-foreground: rgba(250, 250, 250, 1);
72
+ --info: rgba(37, 99, 235, 1);
73
+ --info-foreground: rgba(250, 250, 250, 1);
74
+ --warning: rgba(245, 158, 11, 1);
75
+ --warning-foreground: rgba(24, 24, 27, 1);
76
+
69
77
  --border: rgba(228, 228, 231, 1);
70
78
  --input: rgba(244, 244, 245, 0.5);
71
79
  --input-background: rgba(244, 244, 245, 0.5);
@@ -162,6 +170,7 @@ export const generateTokensCss = (theme: ColorTheme): string => {
162
170
  .dark {
163
171
  /* Brand Tokens */
164
172
  --xertica-primary: ${rgba(colors.primaryDarkMode)};
173
+ --primary: var(--xertica-primary);
165
174
 
166
175
  /* Semantic Colors */
167
176
  --background: rgba(5, 5, 5, 1);
@@ -189,12 +198,27 @@ export const generateTokensCss = (theme: ColorTheme): string => {
189
198
  --destructive: rgba(239, 68, 68, 1);
190
199
  --destructive-foreground: rgba(250, 250, 250, 1);
191
200
 
201
+ /* Semantic Status Colors */
202
+ --success: rgba(34, 197, 94, 1);
203
+ --success-foreground: rgba(5, 5, 5, 1);
204
+ --info: rgba(96, 165, 250, 1);
205
+ --info-foreground: rgba(5, 5, 5, 1);
206
+ --warning: rgba(251, 191, 36, 1);
207
+ --warning-foreground: rgba(5, 5, 5, 1);
208
+
192
209
  --border: rgba(63, 63, 70, 1);
193
210
  --input: rgba(39, 39, 42, 0.5);
194
211
  --input-background: rgba(39, 39, 42, 0.5);
195
212
  --ring: ${rgba(colors.primaryDarkMode, 0.5)};
196
213
 
197
214
  --elevation-sm: 0px 0px 48px 0px rgba(0, 0, 0, 0.3);
215
+
216
+ /* Charts */
217
+ --chart-1: ${rgba(colors.chart1)};
218
+ --chart-2: ${rgba(colors.chart2)};
219
+ --chart-3: ${rgba(colors.chart3)};
220
+ --chart-4: ${rgba(colors.chart4)};
221
+ --chart-5: ${rgba(colors.chart5)};
198
222
 
199
223
  /* Sidebar */
200
224
  --sidebar: ${rgba(colors.sidebarDark)};
@@ -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>
@@ -229,6 +229,7 @@ export const CodeBlock = ({
229
229
  size="icon"
230
230
  className="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10 bg-background/80 hover:bg-background"
231
231
  onClick={handleCopy}
232
+ aria-label={copied ? "Copiado" : "Copiar código"}
232
233
  >
233
234
  {copied ? (
234
235
  <Check className="w-4 h-4 text-[var(--toast-success-icon)]" />
@@ -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" /> <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" /> <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
+ };