xertica-ui 1.8.1 → 1.9.0
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/README.md +184 -184
- package/components/assistant/modern-chat-input/ModernChatInput.tsx +84 -57
- package/components/assistant/modern-chat-input/modern-chat-input.mdx +71 -38
- package/components/assistant/modern-chat-input/modern-chat-input.stories.tsx +131 -53
- package/components/assistant/xertica-assistant/xertica-assistant.mdx +66 -37
- package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +201 -103
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +126 -59
- package/components/layout/header/header.mdx +117 -73
- package/components/layout/header/header.stories.tsx +165 -104
- package/components/layout/header/header.tsx +78 -34
- package/components/ui/checkbox/checkbox.mdx +7 -0
- package/components/ui/checkbox/checkbox.stories.tsx +83 -59
- 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 +108 -78
- package/components/ui/input-otp/input-otp.mdx +7 -0
- package/components/ui/input-otp/input-otp.stories.tsx +120 -75
- package/components/ui/input-otp/input-otp.test.tsx +79 -56
- 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 +73 -47
- package/components/ui/label/label.test.tsx +27 -3
- 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 +105 -57
- package/components/ui/radio-group/radio-group.test.tsx +78 -54
- 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 +107 -46
- 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 +148 -99
- package/components/ui/select/select.test.tsx +41 -1
- package/components/ui/select/select.tsx +38 -24
- package/components/ui/switch/switch.mdx +7 -0
- package/components/ui/switch/switch.stories.tsx +67 -40
- package/components/ui/switch/switch.test.tsx +14 -3
- package/components/ui/switch/switch.tsx +46 -21
- package/components/ui/textarea/textarea.mdx +7 -0
- package/components/ui/textarea/textarea.stories.tsx +66 -34
- package/components/ui/textarea/textarea.test.tsx +41 -28
- 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/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 +245 -138
- package/dist/index.umd.js +245 -138
- 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 +214 -116
- 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/package.json +1 -1
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
|
package/README.md
CHANGED
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
# Xertica UI
|
|
2
|
-
|
|
3
|
-
> **Enterprise-grade React design system** built on Tailwind CSS v4, Radix UI, and Lucide Icons — with a robust AI-first documentation layer for precise LLM-driven composition and autonomous agent interaction.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/xertica-ui)
|
|
6
|
-
[](./LICENSE)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🤖 AI-First Single Source of Truth
|
|
11
|
-
|
|
12
|
-
Xertica UI is specifically designed to be consumed by AI Agents (LLMs, code assistants, autonomous agents). We provide dedicated entry points for AI context:
|
|
13
|
-
|
|
14
|
-
| File | Purpose |
|
|
15
|
-
|---|---|
|
|
16
|
-
| [`llms.txt`](./llms.txt) | Standard index for AI crawlers and context-aware agents. |
|
|
17
|
-
| [`llms-full.txt`](./llms-full.txt) | **Complete documentation** of all 96 components in a single file for large-context LLMs. |
|
|
18
|
-
| `docs/llms.md` | Master index for agents to navigate the documentation folder. |
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## 🚀 Quick Start — CLI (Recommended)
|
|
23
|
-
|
|
24
|
-
Scaffold a full application with pre-configured routing, layout, and components:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npx xertica-ui@latest init my-app
|
|
28
|
-
cd my-app
|
|
29
|
-
npm run dev
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
The CLI scaffolds a complete Vite + React + TypeScript project with Portuguese UI localization and English AI-ready documentation.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 📦 Installation as a Library
|
|
37
|
-
|
|
38
|
-
To add Xertica UI to an existing React project:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install xertica-ui
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**1. Import the stylesheet** in your entry file (`main.tsx` or `App.tsx`):
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import 'xertica-ui/style.css';
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**2. Wrap your app** with `XerticaProvider`:
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
import { XerticaProvider } from 'xertica-ui';
|
|
54
|
-
|
|
55
|
-
function App() {
|
|
56
|
-
return (
|
|
57
|
-
<XerticaProvider>
|
|
58
|
-
<YourApp />
|
|
59
|
-
</XerticaProvider>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## 🛠️ The Layout System
|
|
67
|
-
|
|
68
|
-
Xertica UI features an autonomous layout system managed by `LayoutContext`.
|
|
69
|
-
|
|
70
|
-
### Mandatory Page Structure
|
|
71
|
-
Every page **must** use the `<PageHeader>` component for its title and primary actions. Never use raw `h1` or `div` for headers.
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { PageHeader, PageHeaderHeading, Button } from 'xertica-ui';
|
|
75
|
-
|
|
76
|
-
export function MyPage() {
|
|
77
|
-
return (
|
|
78
|
-
<>
|
|
79
|
-
<PageHeader>
|
|
80
|
-
<PageHeaderHeading>Dashboard</PageHeaderHeading>
|
|
81
|
-
<Button>Action</Button>
|
|
82
|
-
</PageHeader>
|
|
83
|
-
<div className="p-6">
|
|
84
|
-
{/* Page Content */}
|
|
85
|
-
</div>
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### `useLayout()` Hook
|
|
92
|
-
Access the sidebar state, width, and toggle functions anywhere in the component tree:
|
|
93
|
-
```tsx
|
|
94
|
-
const { sidebarWidth, isSidebarOpen, toggleSidebar } = useLayout();
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## 🧩 Component Catalog (96 Components)
|
|
100
|
-
|
|
101
|
-
### Layout & Navigation
|
|
102
|
-
`Header` · `Sidebar` · `PageHeader` · `Breadcrumb` · `NavigationMenu` · `Tabs` · `Pagination` · `Accordion` · `Collapsible`
|
|
103
|
-
|
|
104
|
-
### Core Surfaces
|
|
105
|
-
`Card` · `Separator` · `ScrollArea` · `AspectRatio` · `Resizable` · `Skeleton` · `Empty`
|
|
106
|
-
|
|
107
|
-
### Forms & Inputs
|
|
108
|
-
`Form` · `Input` · `Textarea` · `RichTextEditor` · `Label` · `Checkbox` · `RadioGroup` · `Switch` · `Select` · `Slider` · `Calendar` · `InputOTP` · `FileUpload` · `Search`
|
|
109
|
-
|
|
110
|
-
### Actions & Data
|
|
111
|
-
`Button` · `Toggle` · `ToggleGroup` · `Rating` · `Table` · `Badge` · `Avatar` · `Progress` · `StatsCard` · `Timeline` · `Stepper` · `TreeView` · `NotificationBadge` · `Chart`
|
|
112
|
-
|
|
113
|
-
### Overlays & Feedback
|
|
114
|
-
`Dialog` · `AlertDialog` · `Sheet` · `Drawer` · `Popover` · `HoverCard` · `Tooltip` · `Alert` · `Sonner (Toast)` · `Command`
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## 🌟 Specialized Modules
|
|
119
|
-
|
|
120
|
-
### 🤖 AI Assistant
|
|
121
|
-
Integrated AI chat panel with workspace support.
|
|
122
|
-
- `XerticaAssistant` · `MarkdownMessage` · `CodeBlock` · `AssistantChart`
|
|
123
|
-
|
|
124
|
-
### 🗺️ Maps & Geolocation
|
|
125
|
-
First-class Google Maps integration.
|
|
126
|
-
- `Map` · `RouteMap` · `SimpleMap` · `GoogleMapsLoader`
|
|
127
|
-
|
|
128
|
-
### 🎙️ Media
|
|
129
|
-
- `AudioPlayer` · `VideoPlayer` · `FloatingMediaWrapper`
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## 🎨 Design Tokens
|
|
134
|
-
|
|
135
|
-
Xertica UI uses semantic CSS tokens. **Never use raw colors or generic Tailwind color classes**:
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
Background: bg-background text-foreground
|
|
139
|
-
Card surface: bg-card text-card-foreground
|
|
140
|
-
Muted area: bg-muted text-muted-foreground
|
|
141
|
-
Primary action: bg-primary text-primary-foreground
|
|
142
|
-
Destructive: bg-destructive text-destructive-foreground
|
|
143
|
-
Border: border-border
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## 🌍 Localization
|
|
149
|
-
|
|
150
|
-
- **UI Components**: Fully localized in **Portuguese (pt-BR)** for end-users.
|
|
151
|
-
- **Documentation/Code**: Strictly maintained in **English** for AI Agent compatibility and global developer standard.
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## 💻 Tech Stack
|
|
156
|
-
|
|
157
|
-
| Technology | Version |
|
|
158
|
-
|---|---|
|
|
159
|
-
| React | 18.3 |
|
|
160
|
-
| TypeScript | 5.7 |
|
|
161
|
-
| Tailwind CSS | 4.0 |
|
|
162
|
-
| Vite | 6.0 |
|
|
163
|
-
| Radix UI | Latest |
|
|
164
|
-
| Lucide React | 0.469+ |
|
|
165
|
-
| Vitest | 4.1 |
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
## 📜 Scripts
|
|
170
|
-
|
|
171
|
-
| Command | Description |
|
|
172
|
-
|---|---|
|
|
173
|
-
| `npm run dev` | Start development server |
|
|
174
|
-
| `npm run build` | Production bundle |
|
|
175
|
-
| `npm run storybook` | Launch component library documentation |
|
|
176
|
-
| `npm run test` | Run unit tests via Vitest |
|
|
177
|
-
| `npm run type-check` | TypeScript validation |
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## ⚖️ License
|
|
182
|
-
|
|
183
|
-
Proprietary — Xertica AI Team.
|
|
184
|
-
|
|
1
|
+
# Xertica UI
|
|
2
|
+
|
|
3
|
+
> **Enterprise-grade React design system** built on Tailwind CSS v4, Radix UI, and Lucide Icons — with a robust AI-first documentation layer for precise LLM-driven composition and autonomous agent interaction.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/xertica-ui)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🤖 AI-First Single Source of Truth
|
|
11
|
+
|
|
12
|
+
Xertica UI is specifically designed to be consumed by AI Agents (LLMs, code assistants, autonomous agents). We provide dedicated entry points for AI context:
|
|
13
|
+
|
|
14
|
+
| File | Purpose |
|
|
15
|
+
|---|---|
|
|
16
|
+
| [`llms.txt`](./llms.txt) | Standard index for AI crawlers and context-aware agents. |
|
|
17
|
+
| [`llms-full.txt`](./llms-full.txt) | **Complete documentation** of all 96 components in a single file for large-context LLMs. |
|
|
18
|
+
| `docs/llms.md` | Master index for agents to navigate the documentation folder. |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🚀 Quick Start — CLI (Recommended)
|
|
23
|
+
|
|
24
|
+
Scaffold a full application with pre-configured routing, layout, and components:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx xertica-ui@latest init my-app
|
|
28
|
+
cd my-app
|
|
29
|
+
npm run dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The CLI scaffolds a complete Vite + React + TypeScript project with Portuguese UI localization and English AI-ready documentation.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📦 Installation as a Library
|
|
37
|
+
|
|
38
|
+
To add Xertica UI to an existing React project:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install xertica-ui
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**1. Import the stylesheet** in your entry file (`main.tsx` or `App.tsx`):
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import 'xertica-ui/style.css';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**2. Wrap your app** with `XerticaProvider`:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { XerticaProvider } from 'xertica-ui';
|
|
54
|
+
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<XerticaProvider>
|
|
58
|
+
<YourApp />
|
|
59
|
+
</XerticaProvider>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 🛠️ The Layout System
|
|
67
|
+
|
|
68
|
+
Xertica UI features an autonomous layout system managed by `LayoutContext`.
|
|
69
|
+
|
|
70
|
+
### Mandatory Page Structure
|
|
71
|
+
Every page **must** use the `<PageHeader>` component for its title and primary actions. Never use raw `h1` or `div` for headers.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { PageHeader, PageHeaderHeading, Button } from 'xertica-ui';
|
|
75
|
+
|
|
76
|
+
export function MyPage() {
|
|
77
|
+
return (
|
|
78
|
+
<>
|
|
79
|
+
<PageHeader>
|
|
80
|
+
<PageHeaderHeading>Dashboard</PageHeaderHeading>
|
|
81
|
+
<Button>Action</Button>
|
|
82
|
+
</PageHeader>
|
|
83
|
+
<div className="p-6">
|
|
84
|
+
{/* Page Content */}
|
|
85
|
+
</div>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `useLayout()` Hook
|
|
92
|
+
Access the sidebar state, width, and toggle functions anywhere in the component tree:
|
|
93
|
+
```tsx
|
|
94
|
+
const { sidebarWidth, isSidebarOpen, toggleSidebar } = useLayout();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🧩 Component Catalog (96 Components)
|
|
100
|
+
|
|
101
|
+
### Layout & Navigation
|
|
102
|
+
`Header` · `Sidebar` · `PageHeader` · `Breadcrumb` · `NavigationMenu` · `Tabs` · `Pagination` · `Accordion` · `Collapsible`
|
|
103
|
+
|
|
104
|
+
### Core Surfaces
|
|
105
|
+
`Card` · `Separator` · `ScrollArea` · `AspectRatio` · `Resizable` · `Skeleton` · `Empty`
|
|
106
|
+
|
|
107
|
+
### Forms & Inputs
|
|
108
|
+
`Form` · `Input` · `Textarea` · `RichTextEditor` · `Label` · `Checkbox` · `RadioGroup` · `Switch` · `Select` · `Slider` · `Calendar` · `InputOTP` · `FileUpload` · `Search`
|
|
109
|
+
|
|
110
|
+
### Actions & Data
|
|
111
|
+
`Button` · `Toggle` · `ToggleGroup` · `Rating` · `Table` · `Badge` · `Avatar` · `Progress` · `StatsCard` · `Timeline` · `Stepper` · `TreeView` · `NotificationBadge` · `Chart`
|
|
112
|
+
|
|
113
|
+
### Overlays & Feedback
|
|
114
|
+
`Dialog` · `AlertDialog` · `Sheet` · `Drawer` · `Popover` · `HoverCard` · `Tooltip` · `Alert` · `Sonner (Toast)` · `Command`
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🌟 Specialized Modules
|
|
119
|
+
|
|
120
|
+
### 🤖 AI Assistant
|
|
121
|
+
Integrated AI chat panel with workspace support.
|
|
122
|
+
- `XerticaAssistant` · `MarkdownMessage` · `CodeBlock` · `AssistantChart`
|
|
123
|
+
|
|
124
|
+
### 🗺️ Maps & Geolocation
|
|
125
|
+
First-class Google Maps integration.
|
|
126
|
+
- `Map` · `RouteMap` · `SimpleMap` · `GoogleMapsLoader`
|
|
127
|
+
|
|
128
|
+
### 🎙️ Media
|
|
129
|
+
- `AudioPlayer` · `VideoPlayer` · `FloatingMediaWrapper`
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 🎨 Design Tokens
|
|
134
|
+
|
|
135
|
+
Xertica UI uses semantic CSS tokens. **Never use raw colors or generic Tailwind color classes**:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Background: bg-background text-foreground
|
|
139
|
+
Card surface: bg-card text-card-foreground
|
|
140
|
+
Muted area: bg-muted text-muted-foreground
|
|
141
|
+
Primary action: bg-primary text-primary-foreground
|
|
142
|
+
Destructive: bg-destructive text-destructive-foreground
|
|
143
|
+
Border: border-border
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 🌍 Localization
|
|
149
|
+
|
|
150
|
+
- **UI Components**: Fully localized in **Portuguese (pt-BR)** for end-users.
|
|
151
|
+
- **Documentation/Code**: Strictly maintained in **English** for AI Agent compatibility and global developer standard.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 💻 Tech Stack
|
|
156
|
+
|
|
157
|
+
| Technology | Version |
|
|
158
|
+
|---|---|
|
|
159
|
+
| React | 18.3 |
|
|
160
|
+
| TypeScript | 5.7 |
|
|
161
|
+
| Tailwind CSS | 4.0 |
|
|
162
|
+
| Vite | 6.0 |
|
|
163
|
+
| Radix UI | Latest |
|
|
164
|
+
| Lucide React | 0.469+ |
|
|
165
|
+
| Vitest | 4.1 |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 📜 Scripts
|
|
170
|
+
|
|
171
|
+
| Command | Description |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `npm run dev` | Start development server |
|
|
174
|
+
| `npm run build` | Production bundle |
|
|
175
|
+
| `npm run storybook` | Launch component library documentation |
|
|
176
|
+
| `npm run test` | Run unit tests via Vitest |
|
|
177
|
+
| `npm run type-check` | TypeScript validation |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## ⚖️ License
|
|
182
|
+
|
|
183
|
+
Proprietary — Xertica AI Team.
|
|
184
|
+
|
|
@@ -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
|