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.
Files changed (105) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/README.md +33 -22
  3. package/bin/cli.ts +136 -47
  4. package/bin/language-config.ts +5 -8
  5. package/components/assistant/modern-chat-input/ModernChatInput.tsx +17 -7
  6. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +1 -3
  7. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +13 -3
  8. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +10 -6
  9. package/components/assistant/xertica-assistant/xertica-assistant.tsx +1 -3
  10. package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +1 -6
  11. package/components/blocks/card-patterns/ProfileCard.tsx +1 -3
  12. package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +1 -6
  13. package/components/brand/language-selector/language-selector.stories.tsx +1 -4
  14. package/components/brand/theme-toggle/ThemeToggle.tsx +5 -1
  15. package/components/brand/xertica-provider/XerticaProvider.tsx +1 -4
  16. package/components/index.ts +1 -5
  17. package/components/layout/sidebar/sidebar.tsx +9 -3
  18. package/components/media/audio-player/AudioPlayer.tsx +4 -2
  19. package/components/pages/forgot-password-page/ForgotPasswordPage.tsx +188 -188
  20. package/components/pages/home-content/HomeContent.tsx +55 -55
  21. package/components/pages/home-page/HomePage.tsx +5 -1
  22. package/components/pages/login-page/LoginPage.tsx +4 -2
  23. package/components/pages/reset-password-page/ResetPasswordPage.tsx +7 -3
  24. package/components/pages/template-content/TemplateContent.tsx +268 -149
  25. package/components/pages/verify-email-page/VerifyEmailPage.tsx +9 -9
  26. package/components/shared/error-boundary.stories.tsx +114 -132
  27. package/components/shared/error-boundary.tsx +150 -154
  28. package/components/shared/error-fallbacks.tsx +222 -226
  29. package/components/ui/stats-card/stats-card-skeleton.tsx +1 -3
  30. package/components/ui/stats-card/stats-card.stories.tsx +18 -0
  31. package/components/ui/stats-card/stats-card.tsx +18 -2
  32. package/components.json +512 -892
  33. package/contexts/AuthContext.tsx +121 -118
  34. package/contexts/LanguageContext.tsx +1 -2
  35. package/dist/AssistantChart-BKVtGUKF.js +3383 -0
  36. package/dist/AssistantChart-WeycT5Pd.cjs +3551 -0
  37. package/dist/VerifyEmailPage-Bp1XXl3H.cjs +3305 -0
  38. package/dist/VerifyEmailPage-DGhuIqkb.js +3296 -0
  39. package/dist/XerticaProvider-BErr83Bg.js +42 -0
  40. package/dist/XerticaProvider-CwOkHxiT.cjs +44 -0
  41. package/dist/XerticaXLogo-BX3ueACh.js +255 -0
  42. package/dist/XerticaXLogo-qBPhwK3g.cjs +260 -0
  43. package/dist/assistant.cjs.js +1 -1
  44. package/dist/assistant.es.js +1 -1
  45. package/dist/brand.cjs.js +2 -2
  46. package/dist/brand.es.js +2 -2
  47. package/dist/cli.js +90 -37
  48. package/dist/components/brand/theme-toggle/ThemeToggle.d.ts +1 -1
  49. package/dist/components/index.d.ts +1 -1
  50. package/dist/components/ui/stats-card/stats-card.d.ts +10 -0
  51. package/dist/index.cjs.js +6 -6
  52. package/dist/index.es.js +6 -6
  53. package/dist/layout.cjs.js +1 -1
  54. package/dist/layout.es.js +1 -1
  55. package/dist/pages.cjs.js +1 -1
  56. package/dist/pages.es.js +1 -1
  57. package/dist/sidebar-B4ZWaMrE.js +792 -0
  58. package/dist/sidebar-BS1p2V7t.cjs +795 -0
  59. package/dist/ui.cjs.js +1 -1
  60. package/dist/ui.es.js +1 -1
  61. package/dist/xertica-assistant-B1NaSFFj.js +2173 -0
  62. package/dist/xertica-assistant-CIaUlbIt.cjs +2180 -0
  63. package/dist/xertica-ui.css +1 -1
  64. package/docs/architecture-improvements.md +5 -5
  65. package/docs/architecture.md +16 -10
  66. package/docs/components/card-patterns.md +19 -17
  67. package/docs/components/error-boundary.md +201 -191
  68. package/docs/components/hooks.md +15 -13
  69. package/docs/components/language-selector.md +20 -16
  70. package/docs/components/pages.md +323 -309
  71. package/docs/components/stats-card.md +20 -2
  72. package/docs/doc-audit.md +12 -11
  73. package/docs/getting-started.md +41 -28
  74. package/docs/guidelines.md +14 -12
  75. package/docs/i18n.md +61 -57
  76. package/docs/installation.md +268 -267
  77. package/docs/llms.md +17 -17
  78. package/docs/state-management.md +17 -17
  79. package/guidelines/Guidelines.md +17 -14
  80. package/llms-compact.txt +1 -1
  81. package/llms-full.txt +11553 -7133
  82. package/llms.txt +1 -1
  83. package/package.json +1 -1
  84. package/styles/xertica/base.css +90 -84
  85. package/templates/CLAUDE.md +16 -1
  86. package/templates/guidelines/Guidelines.md +42 -18
  87. package/templates/package.json +3 -3
  88. package/templates/src/app/components/AuthGuard.tsx +131 -82
  89. package/templates/src/features/auth/ui/AuthPageShell.tsx +32 -32
  90. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +1 -3
  91. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +6 -2
  92. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +2 -6
  93. package/templates/src/features/home/data/mock.ts +41 -35
  94. package/templates/src/features/home/ui/HomeContent.tsx +62 -64
  95. package/templates/src/features/template/ui/CrudTemplate.tsx +1 -4
  96. package/templates/src/features/template/ui/LoginTemplate.tsx +1 -1
  97. package/templates/src/features/template/ui/TemplateContent.tsx +28 -20
  98. package/templates/src/locales/en/pages/templates.json +17 -17
  99. package/templates/src/locales/es/pages/templates.json +17 -17
  100. package/templates/src/locales/pt-BR/pages/templates.json +17 -17
  101. package/templates/src/pages/AssistantPage.tsx +26 -20
  102. package/templates/src/pages/HomePage.tsx +5 -1
  103. package/templates/src/shared/error-boundary.tsx +150 -154
  104. package/templates/src/shared/error-fallbacks.tsx +222 -226
  105. package/templates/vite.config.ts +12 -9
@@ -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 | 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
- 1. `AppErrorBoundary` — outermost; catches any crash including provider failures
115
- 2. `QueryClientProvider` — enables React Query for all nested components
116
- 3. `XerticaProvider` — theme, layout, toasts, tooltips, maps, assistant context
117
- 4. `Router` — required before `AuthProvider` (`useNavigate` dependency)
118
- 5. `AuthProvider` — session state and navigation guards
119
- 6. `PageErrorBoundary` — isolates page-level errors; app chrome stays alive
120
-
121
- ### Provider Props
122
-
123
- | Prop | Type | Default | Description |
124
- | ---------- | ----------- | ------------ | ------------------------------------------------ |
125
- | `children` | `ReactNode` | _(required)_ | Application content to wrap inside all providers |
126
-
127
- > **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.
128
-
129
- ---
130
-
131
- ## 4. CSS Token Customization
132
-
133
- ### Option A: Auto-Injected Tokens (Default)
134
-
135
- By default, `XerticaProvider` injects a default token set. The tokens respond to the `dark` class on `<html>`.
136
-
137
- ### Option B: Custom Token File
138
-
139
- Use `useCustomTokens={true}` to disable injection and provide your own token file:
140
-
141
- ```css
142
- /* tokens.css */
143
- :root {
144
- --background: 0 0% 100%;
145
- --foreground: 222.2 84% 4.9%;
146
- --primary: 221.2 83.2% 53.3%;
147
- --primary-foreground: 210 40% 98%;
148
- --card: 0 0% 100%;
149
- --card-foreground: 222.2 84% 4.9%;
150
- --border: 214.3 31.8% 91.4%;
151
- /* ... other tokens */
152
- }
153
-
154
- .dark {
155
- --background: 222.2 84% 4.9%;
156
- --foreground: 210 40% 98%;
157
- /* ... dark variants */
158
- }
159
- ```
160
-
161
- Import this file in your main entry:
162
-
163
- ```tsx
164
- import './styles/tokens.css';
165
- import 'xertica-ui/style.css';
166
- ```
167
-
168
- ---
169
-
170
- ## 5. CLI Setup (Alternative)
171
-
172
- For a fully scaffolded new project:
173
-
174
- ```bash
175
- npx xertica-ui@latest init
176
- ```
177
-
178
- The CLI will:
179
-
180
- - Scaffold a Vite + React + TypeScript project
181
- - Install all dependencies (including `@tanstack/react-query`, `zustand`, `i18next`, `react-i18next`)
182
- - Configure Tailwind CSS v4
183
- - Create the `tokens.css` token file and `src/locales/pt-BR.json`, `en.json`, `es.json`
184
- - Initialize `i18next` in `src/i18n.ts` and import it in `src/main.tsx`
185
- - Set up `XerticaProvider`, `QueryClientProvider`, `AuthProvider`, `AppErrorBoundary`, `PageErrorBoundary`, router, Sidebar, Header, and example pages
186
- - Create a `TemplatePage` with all components demonstrated
187
- - Generate the `features/` directory with mock data, React Query hooks, and Zustand stores ready to swap for real APIs
188
- - Create `src/shared/error-boundary.tsx` and `error-fallbacks.tsx` for all three granularity levels (`App`, `Page`, `Section`)
189
-
190
- ### Development Quality Scripts
191
-
192
- The scaffolded project includes these scripts in `package.json`:
193
-
194
- ```bash
195
- npm run dev # Vite dev server
196
- npm run build # Production build (TypeScript + Vite)
197
- npm run type-check # npx tsc --noEmit
198
- npm run lint # ESLint (flat config v9)
199
- npm run lint:fix # ESLint with auto-fix
200
- npm run format # Prettier --write
201
- npm run format:check # Prettier --check (for CI)
202
- npm run check # type-check + lint (runs before npm publish)
203
- ```
204
-
205
- ---
206
-
207
- ## 6. Tailwind CSS v4 Configuration
208
-
209
- If setting up Tailwind manually (not via CLI), configure it to scan both your app and the library:
210
-
211
- ```js
212
- // tailwind.config.js
213
- export default {
214
- content: ['./src/**/*.{ts,tsx}', './node_modules/xertica-ui/**/*.{js,ts,jsx,tsx}'],
215
- };
216
- ```
217
-
218
- ---
219
-
220
- ## 7. Subpath Imports (v2)
221
-
222
- Xertica UI v2 supports granular subpath imports per layer — useful in FSD/FDA architectures:
223
-
224
- ```tsx
225
- import { Button, Card, CardContent } from 'xertica-ui/ui';
226
- import { Sidebar, Header } from 'xertica-ui/layout';
227
- import { XerticaProvider } from 'xertica-ui/brand';
228
- import { XerticaAssistant } from 'xertica-ui/assistant';
229
- import { VideoPlayer } from 'xertica-ui/media';
230
- import { useLayout } from 'xertica-ui/hooks';
231
- ```
232
-
233
- The root `from 'xertica-ui'` barrel remains fully supported for backward compatibility.
234
-
235
- > **TypeScript**: Subpath exports require `"moduleResolution": "bundler"` in `tsconfig.json`.
236
-
237
- ---
238
-
239
- ## 8. Verification
240
-
241
- After setup, render a test component to verify the installation:
242
-
243
- ```tsx
244
- import { Button, Card, CardContent } from 'xertica-ui/ui';
245
-
246
- function Test() {
247
- return (
248
- <Card className="w-64 m-8">
249
- <CardContent className="p-6">
250
- <Button>Installation Success</Button>
251
- </CardContent>
252
- </Card>
253
- );
254
- }
255
- ```
256
-
257
- If the card has a white/dark background with a border and the button has a styled primary color, the installation is complete.
258
-
259
- ### Common Issues
260
-
261
- | Symptom | Cause | Fix |
262
- | ------------------------------------- | ------------------------------------- | --------------------------------------------- |
263
- | Components are transparent / unstyled | Missing CSS import | Add `import 'xertica-ui/style.css'` |
264
- | Dialogs/modals don't appear | Missing `<XerticaProvider>` | Wrap app root with provider |
265
- | Dark mode doesn't work | `useCustomTokens` without dark tokens | Add `.dark` class tokens to your CSS |
266
- | Toast notifications don't show | Missing provider | `XerticaProvider` auto-injects `<Toaster>` |
267
- | Type errors on components | Outdated `@types` | Run `npm install --save-dev @types/react@^18` |
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 | 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) |
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 | 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>` |
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