xertica-ui 2.3.0 → 2.4.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 +22 -2
- package/README.md +33 -22
- package/bin/cli.ts +136 -47
- package/bin/language-config.ts +5 -8
- package/components/assistant/modern-chat-input/ModernChatInput.tsx +17 -7
- package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +1 -3
- package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +13 -3
- package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +10 -6
- package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -3
- package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +1 -6
- package/components/blocks/card-patterns/ProfileCard.tsx +1 -3
- package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +1 -6
- package/components/brand/language-selector/language-selector.stories.tsx +1 -4
- package/components/brand/theme-toggle/ThemeToggle.tsx +5 -1
- package/components/brand/xertica-provider/XerticaProvider.tsx +1 -4
- package/components/index.ts +1 -5
- package/components/layout/sidebar/sidebar.tsx +9 -3
- package/components/media/audio-player/AudioPlayer.tsx +4 -2
- package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
- package/components/pages/home-content/HomeContent.tsx +55 -55
- package/components/pages/home-page/HomePage.tsx +5 -1
- package/components/pages/login-page/LoginPage.tsx +4 -2
- package/components/pages/reset-password-page/ResetPasswordPage.tsx +7 -3
- package/components/pages/template-content/TemplateContent.tsx +268 -149
- package/components/pages/verify-email-page/VerifyEmailPage.tsx +9 -9
- package/components/shared/error-boundary.stories.tsx +114 -132
- package/components/shared/error-boundary.tsx +150 -154
- package/components/shared/error-fallbacks.tsx +222 -226
- package/components/ui/stats-card/stats-card-skeleton.tsx +1 -3
- package/components/ui/stats-card/stats-card.stories.tsx +18 -0
- package/components/ui/stats-card/stats-card.tsx +18 -2
- package/components.json +512 -892
- package/contexts/AuthContext.tsx +121 -118
- package/contexts/LanguageContext.tsx +1 -2
- package/dist/AssistantChart-BKVtGUKF.js +3383 -0
- package/dist/AssistantChart-WeycT5Pd.cjs +3551 -0
- package/dist/VerifyEmailPage-Bp1XXl3H.cjs +3305 -0
- package/dist/VerifyEmailPage-DGhuIqkb.js +3296 -0
- package/dist/XerticaProvider-BErr83Bg.js +42 -0
- package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
- package/dist/XerticaXLogo-BX3ueACh.js +255 -0
- package/dist/XerticaXLogo-qBPhwK3g.cjs +260 -0
- package/dist/assistant.cjs.js +1 -1
- package/dist/assistant.es.js +1 -1
- package/dist/brand.cjs.js +2 -2
- package/dist/brand.es.js +2 -2
- package/dist/cli.js +90 -37
- package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/ui/stats-card/stats-card.d.ts +10 -0
- package/dist/index.cjs.js +6 -6
- package/dist/index.es.js +6 -6
- package/dist/layout.cjs.js +1 -1
- package/dist/layout.es.js +1 -1
- package/dist/pages.cjs.js +1 -1
- package/dist/pages.es.js +1 -1
- package/dist/sidebar-B4ZWaMrE.js +792 -0
- package/dist/sidebar-BS1p2V7t.cjs +795 -0
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +1 -1
- package/dist/xertica-assistant-B1NaSFFj.js +2173 -0
- package/dist/xertica-assistant-CIaUlbIt.cjs +2180 -0
- package/dist/xertica-ui.css +1 -1
- package/docs/architecture-improvements.md +5 -5
- package/docs/architecture.md +16 -10
- package/docs/components/card-patterns.md +19 -17
- package/docs/components/error-boundary.md +201 -191
- package/docs/components/hooks.md +15 -13
- package/docs/components/language-selector.md +20 -16
- package/docs/components/pages.md +323 -309
- package/docs/components/stats-card.md +20 -2
- package/docs/doc-audit.md +12 -11
- package/docs/getting-started.md +41 -28
- package/docs/guidelines.md +14 -12
- package/docs/i18n.md +61 -57
- package/docs/installation.md +268 -267
- package/docs/llms.md +17 -17
- package/docs/state-management.md +17 -17
- package/guidelines/Guidelines.md +17 -14
- package/llms-compact.txt +1 -1
- package/llms-full.txt +11553 -7133
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/styles/xertica/base.css +90 -84
- package/templates/CLAUDE.md +16 -1
- package/templates/guidelines/Guidelines.md +42 -18
- package/templates/package.json +3 -3
- package/templates/src/app/components/AuthGuard.tsx +131 -82
- package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
- package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +1 -3
- package/templates/src/features/auth/ui/ResetPasswordContent.tsx +6 -2
- package/templates/src/features/auth/ui/VerifyEmailContent.tsx +2 -6
- package/templates/src/features/home/data/mock.ts +41 -35
- package/templates/src/features/home/ui/HomeContent.tsx +62 -64
- package/templates/src/features/template/ui/CrudTemplate.tsx +1 -4
- package/templates/src/features/template/ui/LoginTemplate.tsx +1 -1
- package/templates/src/features/template/ui/TemplateContent.tsx +28 -20
- package/templates/src/locales/en/pages/templates.json +17 -17
- package/templates/src/locales/es/pages/templates.json +17 -17
- package/templates/src/locales/pt-BR/pages/templates.json +17 -17
- package/templates/src/pages/AssistantPage.tsx +26 -20
- package/templates/src/pages/HomePage.tsx +5 -1
- package/templates/src/shared/error-boundary.tsx +150 -154
- package/templates/src/shared/error-fallbacks.tsx +222 -226
- package/templates/vite.config.ts +12 -9
package/docs/installation.md
CHANGED
|
@@ -1,267 +1,268 @@
|
|
|
1
|
-
# Installation Guide — Xertica UI
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## 1. Package Installation
|
|
6
|
-
|
|
7
|
-
Install the library via npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install xertica-ui
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or with other package managers:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pnpm add xertica-ui
|
|
17
|
-
yarn add xertica-ui
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Peer Dependencies
|
|
21
|
-
|
|
22
|
-
The following packages must be present in your project. They are not auto-installed:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install react@^18 react-dom@^18 react-router-dom@^7
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Recommended Companion Packages
|
|
29
|
-
|
|
30
|
-
These are not peer dependencies but are expected in projects using the CLI scaffold or the `features/` architecture:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm install @tanstack/react-query zustand i18next react-i18next
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
| Package
|
|
37
|
-
|
|
38
|
-
| `@tanstack/react-query` | `^5.x`
|
|
39
|
-
| `zustand`
|
|
40
|
-
| `i18next`
|
|
41
|
-
| `react-i18next`
|
|
42
|
-
|
|
43
|
-
See [`docs/state-management.md`](../state-management.md) and [`docs/i18n.md`](../i18n.md) for the full guides.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## 2. CSS Import (Required)
|
|
48
|
-
|
|
49
|
-
You **must** import the library's stylesheet. Without it, components will render without backgrounds, borders, or correct spacing:
|
|
50
|
-
|
|
51
|
-
```tsx
|
|
52
|
-
// main.tsx or index.tsx
|
|
53
|
-
import 'xertica-ui/style.css';
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
> **For AI agents**: If components look transparent or unstyled, the CSS import is almost always the cause.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 3. Provider Setup (Required)
|
|
61
|
-
|
|
62
|
-
Wrap your entire application in `<XerticaProvider>`. This must be done once at the root level:
|
|
63
|
-
|
|
64
|
-
```tsx
|
|
65
|
-
// main.tsx
|
|
66
|
-
import React from 'react';
|
|
67
|
-
import ReactDOM from 'react-dom/client';
|
|
68
|
-
import { XerticaProvider } from 'xertica-ui/brand';
|
|
69
|
-
import 'xertica-ui/style.css';
|
|
70
|
-
import './i18n'; // initialize i18next before any component renders
|
|
71
|
-
import App from './App';
|
|
72
|
-
|
|
73
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
74
|
-
<React.StrictMode>
|
|
75
|
-
<App />
|
|
76
|
-
</React.StrictMode>
|
|
77
|
-
);
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Full recommended stack (with Router, Auth, Query, ErrorBoundary, i18n)
|
|
81
|
-
|
|
82
|
-
```tsx
|
|
83
|
-
// App.tsx
|
|
84
|
-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
85
|
-
import { XerticaProvider } from 'xertica-ui/brand';
|
|
86
|
-
import { BrowserRouter as Router } from 'react-router-dom';
|
|
87
|
-
import { AppErrorBoundary, PageErrorBoundary } from './shared/error-boundary';
|
|
88
|
-
import { AuthProvider } from './app/context/AuthContext';
|
|
89
|
-
|
|
90
|
-
const queryClient = new QueryClient({
|
|
91
|
-
defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: false } },
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
function App() {
|
|
95
|
-
return (
|
|
96
|
-
<AppErrorBoundary>
|
|
97
|
-
<QueryClientProvider client={queryClient}>
|
|
98
|
-
<XerticaProvider>
|
|
99
|
-
<Router>
|
|
100
|
-
<AuthProvider>
|
|
101
|
-
<PageErrorBoundary>
|
|
102
|
-
<YourRoutes />
|
|
103
|
-
</PageErrorBoundary>
|
|
104
|
-
</AuthProvider>
|
|
105
|
-
</Router>
|
|
106
|
-
</XerticaProvider>
|
|
107
|
-
</QueryClientProvider>
|
|
108
|
-
</AppErrorBoundary>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Provider stack order matters:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
--
|
|
146
|
-
--
|
|
147
|
-
--primary
|
|
148
|
-
--
|
|
149
|
-
--card
|
|
150
|
-
--
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
--
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
import '
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
npm run
|
|
197
|
-
npm run
|
|
198
|
-
npm run
|
|
199
|
-
npm run lint
|
|
200
|
-
npm run
|
|
201
|
-
npm run format
|
|
202
|
-
npm run check
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
import {
|
|
227
|
-
import {
|
|
228
|
-
import {
|
|
229
|
-
import {
|
|
230
|
-
import {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
267
|
-
|
|
|
1
|
+
# Installation Guide — Xertica UI
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Package Installation
|
|
6
|
+
|
|
7
|
+
Install the library via npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install xertica-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or with other package managers:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add xertica-ui
|
|
17
|
+
yarn add xertica-ui
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Peer Dependencies
|
|
21
|
+
|
|
22
|
+
The following packages must be present in your project. They are not auto-installed:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install react@^18 react-dom@^18 react-router-dom@^7
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Recommended Companion Packages
|
|
29
|
+
|
|
30
|
+
These are not peer dependencies but are expected in projects using the CLI scaffold or the `features/` architecture:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install @tanstack/react-query zustand i18next react-i18next
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
| Package | Version | Purpose |
|
|
37
|
+
| ----------------------- | ------- | ----------------------------------------------------------------- |
|
|
38
|
+
| `@tanstack/react-query` | `^5.x` | Server state — data fetching, caching, background refetch |
|
|
39
|
+
| `zustand` | `^5.x` | Client UI state — filters, toggles, form controls |
|
|
40
|
+
| `i18next` | `^26.x` | i18n engine — translation key resolution, language switching |
|
|
41
|
+
| `react-i18next` | `^17.x` | React binding for i18next — `useTranslation()`, `I18nextProvider` |
|
|
42
|
+
|
|
43
|
+
See [`docs/state-management.md`](../state-management.md) and [`docs/i18n.md`](../i18n.md) for the full guides.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 2. CSS Import (Required)
|
|
48
|
+
|
|
49
|
+
You **must** import the library's stylesheet. Without it, components will render without backgrounds, borders, or correct spacing:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
// main.tsx or index.tsx
|
|
53
|
+
import 'xertica-ui/style.css';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
> **For AI agents**: If components look transparent or unstyled, the CSS import is almost always the cause.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 3. Provider Setup (Required)
|
|
61
|
+
|
|
62
|
+
Wrap your entire application in `<XerticaProvider>`. This must be done once at the root level:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
// main.tsx
|
|
66
|
+
import React from 'react';
|
|
67
|
+
import ReactDOM from 'react-dom/client';
|
|
68
|
+
import { XerticaProvider } from 'xertica-ui/brand';
|
|
69
|
+
import 'xertica-ui/style.css';
|
|
70
|
+
import './i18n'; // initialize i18next before any component renders
|
|
71
|
+
import App from './App';
|
|
72
|
+
|
|
73
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
74
|
+
<React.StrictMode>
|
|
75
|
+
<App />
|
|
76
|
+
</React.StrictMode>
|
|
77
|
+
);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Full recommended stack (with Router, Auth, Query, ErrorBoundary, i18n)
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
// App.tsx
|
|
84
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
85
|
+
import { XerticaProvider } from 'xertica-ui/brand';
|
|
86
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
87
|
+
import { AppErrorBoundary, PageErrorBoundary } from './shared/error-boundary';
|
|
88
|
+
import { AuthProvider } from './app/context/AuthContext';
|
|
89
|
+
|
|
90
|
+
const queryClient = new QueryClient({
|
|
91
|
+
defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: false } },
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
function App() {
|
|
95
|
+
return (
|
|
96
|
+
<AppErrorBoundary>
|
|
97
|
+
<QueryClientProvider client={queryClient}>
|
|
98
|
+
<XerticaProvider>
|
|
99
|
+
<Router>
|
|
100
|
+
<AuthProvider>
|
|
101
|
+
<PageErrorBoundary>
|
|
102
|
+
<YourRoutes />
|
|
103
|
+
</PageErrorBoundary>
|
|
104
|
+
</AuthProvider>
|
|
105
|
+
</Router>
|
|
106
|
+
</XerticaProvider>
|
|
107
|
+
</QueryClientProvider>
|
|
108
|
+
</AppErrorBoundary>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Provider stack order matters:
|
|
114
|
+
|
|
115
|
+
1. `AppErrorBoundary` — outermost; catches any crash including provider failures
|
|
116
|
+
2. `QueryClientProvider` — enables React Query for all nested components
|
|
117
|
+
3. `XerticaProvider` — theme, layout, toasts, tooltips, maps, assistant context
|
|
118
|
+
4. `Router` — required before `AuthProvider` (`useNavigate` dependency)
|
|
119
|
+
5. `AuthProvider` — session state and navigation guards
|
|
120
|
+
6. `PageErrorBoundary` — isolates page-level errors; app chrome stays alive
|
|
121
|
+
|
|
122
|
+
### Provider Props
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| ---------- | ----------- | ------------ | ------------------------------------------------ |
|
|
126
|
+
| `children` | `ReactNode` | _(required)_ | Application content to wrap inside all providers |
|
|
127
|
+
|
|
128
|
+
> **Note**: `XerticaProvider` is a minimal wrapper that initializes `LayoutProvider`, `TooltipProvider`, `GoogleMapsLoaderProvider`, and `Toaster`. Theme configuration is done via CSS tokens in your project's stylesheet. See `docs/guidelines.md` for token customization.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 4. CSS Token Customization
|
|
133
|
+
|
|
134
|
+
### Option A: Auto-Injected Tokens (Default)
|
|
135
|
+
|
|
136
|
+
By default, `XerticaProvider` injects a default token set. The tokens respond to the `dark` class on `<html>`.
|
|
137
|
+
|
|
138
|
+
### Option B: Custom Token File
|
|
139
|
+
|
|
140
|
+
Use `useCustomTokens={true}` to disable injection and provide your own token file:
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
/* tokens.css */
|
|
144
|
+
:root {
|
|
145
|
+
--background: 0 0% 100%;
|
|
146
|
+
--foreground: 222.2 84% 4.9%;
|
|
147
|
+
--primary: 221.2 83.2% 53.3%;
|
|
148
|
+
--primary-foreground: 210 40% 98%;
|
|
149
|
+
--card: 0 0% 100%;
|
|
150
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
151
|
+
--border: 214.3 31.8% 91.4%;
|
|
152
|
+
/* ... other tokens */
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.dark {
|
|
156
|
+
--background: 222.2 84% 4.9%;
|
|
157
|
+
--foreground: 210 40% 98%;
|
|
158
|
+
/* ... dark variants */
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Import this file in your main entry:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import './styles/tokens.css';
|
|
166
|
+
import 'xertica-ui/style.css';
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 5. CLI Setup (Alternative)
|
|
172
|
+
|
|
173
|
+
For a fully scaffolded new project:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx xertica-ui@latest init
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The CLI will:
|
|
180
|
+
|
|
181
|
+
- Scaffold a Vite + React + TypeScript project
|
|
182
|
+
- Install all dependencies (including `@tanstack/react-query`, `zustand`, `i18next`, `react-i18next`)
|
|
183
|
+
- Configure Tailwind CSS v4
|
|
184
|
+
- Create the `tokens.css` token file and `src/locales/pt-BR.json`, `en.json`, `es.json`
|
|
185
|
+
- Initialize `i18next` in `src/i18n.ts` and import it in `src/main.tsx`
|
|
186
|
+
- Set up `XerticaProvider`, `QueryClientProvider`, `AuthProvider`, `AppErrorBoundary`, `PageErrorBoundary`, router, Sidebar, Header, and example pages
|
|
187
|
+
- Create a `TemplatePage` with all components demonstrated
|
|
188
|
+
- Generate the `features/` directory with mock data, React Query hooks, and Zustand stores ready to swap for real APIs
|
|
189
|
+
- Create `src/shared/error-boundary.tsx` and `error-fallbacks.tsx` for all three granularity levels (`App`, `Page`, `Section`)
|
|
190
|
+
|
|
191
|
+
### Development Quality Scripts
|
|
192
|
+
|
|
193
|
+
The scaffolded project includes these scripts in `package.json`:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm run dev # Vite dev server
|
|
197
|
+
npm run build # Production build (TypeScript + Vite)
|
|
198
|
+
npm run type-check # npx tsc --noEmit
|
|
199
|
+
npm run lint # ESLint (flat config v9)
|
|
200
|
+
npm run lint:fix # ESLint with auto-fix
|
|
201
|
+
npm run format # Prettier --write
|
|
202
|
+
npm run format:check # Prettier --check (for CI)
|
|
203
|
+
npm run check # type-check + lint (runs before npm publish)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 6. Tailwind CSS v4 Configuration
|
|
209
|
+
|
|
210
|
+
If setting up Tailwind manually (not via CLI), configure it to scan both your app and the library:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
// tailwind.config.js
|
|
214
|
+
export default {
|
|
215
|
+
content: ['./src/**/*.{ts,tsx}', './node_modules/xertica-ui/**/*.{js,ts,jsx,tsx}'],
|
|
216
|
+
};
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 7. Subpath Imports (v2)
|
|
222
|
+
|
|
223
|
+
Xertica UI v2 supports granular subpath imports per layer — useful in FSD/FDA architectures:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import { Button, Card, CardContent } from 'xertica-ui/ui';
|
|
227
|
+
import { Sidebar, Header } from 'xertica-ui/layout';
|
|
228
|
+
import { XerticaProvider } from 'xertica-ui/brand';
|
|
229
|
+
import { XerticaAssistant } from 'xertica-ui/assistant';
|
|
230
|
+
import { VideoPlayer } from 'xertica-ui/media';
|
|
231
|
+
import { useLayout } from 'xertica-ui/hooks';
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The root `from 'xertica-ui'` barrel remains fully supported for backward compatibility.
|
|
235
|
+
|
|
236
|
+
> **TypeScript**: Subpath exports require `"moduleResolution": "bundler"` in `tsconfig.json`.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 8. Verification
|
|
241
|
+
|
|
242
|
+
After setup, render a test component to verify the installation:
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { Button, Card, CardContent } from 'xertica-ui/ui';
|
|
246
|
+
|
|
247
|
+
function Test() {
|
|
248
|
+
return (
|
|
249
|
+
<Card className="w-64 m-8">
|
|
250
|
+
<CardContent className="p-6">
|
|
251
|
+
<Button>Installation Success</Button>
|
|
252
|
+
</CardContent>
|
|
253
|
+
</Card>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
If the card has a white/dark background with a border and the button has a styled primary color, the installation is complete.
|
|
259
|
+
|
|
260
|
+
### Common Issues
|
|
261
|
+
|
|
262
|
+
| Symptom | Cause | Fix |
|
|
263
|
+
| ------------------------------------- | ------------------------------------- | --------------------------------------------- |
|
|
264
|
+
| Components are transparent / unstyled | Missing CSS import | Add `import 'xertica-ui/style.css'` |
|
|
265
|
+
| Dialogs/modals don't appear | Missing `<XerticaProvider>` | Wrap app root with provider |
|
|
266
|
+
| Dark mode doesn't work | `useCustomTokens` without dark tokens | Add `.dark` class tokens to your CSS |
|
|
267
|
+
| Toast notifications don't show | Missing provider | `XerticaProvider` auto-injects `<Toaster>` |
|
|
268
|
+
| Type errors on components | Outdated `@types` | Run `npm install --save-dev @types/react@^18` |
|
package/docs/llms.md
CHANGED
|
@@ -165,18 +165,18 @@ Follow this order when onboarding to a project that uses `xertica-ui`:
|
|
|
165
165
|
|
|
166
166
|
### Hooks
|
|
167
167
|
|
|
168
|
-
| Hook | Doc
|
|
169
|
-
| --------------------------- |
|
|
170
|
-
| `useMobile` / `useIsMobile` | [use-mobile.md](./components/use-mobile.md)
|
|
171
|
-
| `useLayout` | [layout.md](../layout.md)
|
|
172
|
-
| `useTheme` | [hooks.md](./components/hooks.md#usetheme)
|
|
173
|
-
| `useLanguage` | [hooks.md](./components/hooks.md#uselanguage)
|
|
174
|
-
| `useAuth` | [state-management.md](../state-management.md#authcontext) | Current user, login, logout — from `AuthContext`
|
|
175
|
-
| `useBrandColors` | [hooks.md](./components/hooks.md#usebrandcolors)
|
|
176
|
-
| `useAssistente` | [hooks.md](./components/hooks.md#useassistente)
|
|
177
|
-
| `useApiKey` | [hooks.md](./components/hooks.md#useapikey)
|
|
178
|
-
| `useAudioPlayer` | [hooks.md](./components/hooks.md#useaudioplayer)
|
|
179
|
-
| `useLayoutShortcuts` | [hooks.md](./components/hooks.md#uselayoutshortcuts)
|
|
168
|
+
| Hook | Doc | Purpose |
|
|
169
|
+
| --------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
170
|
+
| `useMobile` / `useIsMobile` | [use-mobile.md](./components/use-mobile.md) | Detects mobile viewport for conditional rendering |
|
|
171
|
+
| `useLayout` | [layout.md](../layout.md) | Accesses sidebar width, state, and toggle functions |
|
|
172
|
+
| `useTheme` | [hooks.md](./components/hooks.md#usetheme) | Reads and toggles the current color theme (light/dark) |
|
|
173
|
+
| `useLanguage` | [hooks.md](./components/hooks.md#uselanguage) | Reads and sets the current UI language; calls `i18n.changeLanguage` |
|
|
174
|
+
| `useAuth` | [state-management.md](../state-management.md#authcontext) | Current user, login, logout — from `AuthContext` |
|
|
175
|
+
| `useBrandColors` | [hooks.md](./components/hooks.md#usebrandcolors) | Reads and modifies brand color CSS variables |
|
|
176
|
+
| `useAssistente` | [hooks.md](./components/hooks.md#useassistente) | Accesses the global AI assistant context |
|
|
177
|
+
| `useApiKey` | [hooks.md](./components/hooks.md#useapikey) | Manages API keys for Xertica, Gemini, and Google Maps |
|
|
178
|
+
| `useAudioPlayer` | [hooks.md](./components/hooks.md#useaudioplayer) | Headless hook for building custom audio player UIs |
|
|
179
|
+
| `useLayoutShortcuts` | [hooks.md](./components/hooks.md#uselayoutshortcuts) | Registers global keyboard shortcuts (Ctrl+B = sidebar toggle) |
|
|
180
180
|
|
|
181
181
|
### Page Templates
|
|
182
182
|
|
|
@@ -215,12 +215,12 @@ Follow this order when onboarding to a project that uses `xertica-ui`:
|
|
|
215
215
|
|
|
216
216
|
### Shared Utilities
|
|
217
217
|
|
|
218
|
-
| Component / Utility
|
|
219
|
-
|
|
220
|
-
| `AppErrorBoundary`
|
|
221
|
-
| `PageErrorBoundary`
|
|
218
|
+
| Component / Utility | Doc | Purpose |
|
|
219
|
+
| ---------------------- | --------------------------------------------------- | ------------------------------------------------------------------- |
|
|
220
|
+
| `AppErrorBoundary` | [error-boundary.md](./components/error-boundary.md) | Root-level error boundary — wraps entire app outside all providers |
|
|
221
|
+
| `PageErrorBoundary` | [error-boundary.md](./components/error-boundary.md) | Route-level error boundary — wraps `<Routes>` / `<AuthGuard>` |
|
|
222
222
|
| `SectionErrorBoundary` | [error-boundary.md](./components/error-boundary.md) | Section-level error boundary — wraps data tables, charts, assistant |
|
|
223
|
-
| `ErrorBoundary` (base) | [error-boundary.md](./components/error-boundary.md) | Raw class component with custom `fallback` prop
|
|
223
|
+
| `ErrorBoundary` (base) | [error-boundary.md](./components/error-boundary.md) | Raw class component with custom `fallback` prop |
|
|
224
224
|
|
|
225
225
|
### Blocks (Rich Components)
|
|
226
226
|
|