@djangocfg/layouts 1.4.27 → 1.4.29

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 (118) hide show
  1. package/package.json +8 -8
  2. package/src/auth/context/AuthContext.tsx +4 -1
  3. package/src/auth/hooks/index.ts +2 -0
  4. package/src/auth/hooks/useAuthForm.ts +2 -0
  5. package/src/auth/hooks/useAuthGuard.ts +2 -0
  6. package/src/auth/hooks/useAutoAuth.ts +16 -11
  7. package/src/auth/hooks/useLocalStorage.ts +2 -0
  8. package/src/auth/hooks/useProfileCache.ts +2 -0
  9. package/src/auth/hooks/useSessionStorage.ts +2 -0
  10. package/src/auth/middlewares/index.ts +1 -1
  11. package/src/auth/middlewares/proxy.ts +10 -2
  12. package/src/layouts/AppLayout/AppLayout.tsx +9 -7
  13. package/src/layouts/AppLayout/components/ErrorBoundary.tsx +6 -3
  14. package/src/layouts/AppLayout/components/PageProgress.tsx +2 -0
  15. package/src/layouts/AppLayout/components/Seo.tsx +2 -0
  16. package/src/layouts/AppLayout/components/UpdateNotifier/UpdateNotifier.tsx +3 -2
  17. package/src/layouts/AppLayout/hooks/index.ts +2 -0
  18. package/src/layouts/AppLayout/hooks/useNavigation.ts +3 -1
  19. package/src/layouts/AppLayout/layouts/AdminLayout/AdminLayout.tsx +1 -0
  20. package/src/layouts/AppLayout/layouts/AuthLayout/AuthContext.tsx +2 -0
  21. package/src/layouts/AppLayout/layouts/AuthLayout/IdentifierForm.tsx +2 -0
  22. package/src/layouts/AppLayout/layouts/AuthLayout/OTPForm.tsx +4 -0
  23. package/src/layouts/AppLayout/layouts/AuthLayout/index.ts +2 -0
  24. package/src/layouts/AppLayout/layouts/PrivateLayout/PrivateLayout.tsx +1 -0
  25. package/src/layouts/AppLayout/providers/CoreProviders.tsx +1 -0
  26. package/src/layouts/PaymentsLayout/PaymentsLayout.tsx +1 -0
  27. package/src/layouts/PaymentsLayout/components/CreatePaymentDialog.tsx +1 -0
  28. package/src/layouts/PaymentsLayout/events.ts +2 -0
  29. package/src/layouts/ProfileLayout/ProfileLayout.tsx +1 -0
  30. package/src/layouts/ProfileLayout/components/ProfileForm.tsx +1 -0
  31. package/src/layouts/SimpleLayout/SimpleLayout.tsx +72 -0
  32. package/src/layouts/SimpleLayout/index.ts +3 -0
  33. package/src/layouts/SupportLayout/SupportLayout.tsx +1 -0
  34. package/src/layouts/SupportLayout/components/CreateTicketDialog.tsx +1 -0
  35. package/src/layouts/SupportLayout/components/TicketList.tsx +6 -5
  36. package/src/layouts/SupportLayout/events.ts +2 -0
  37. package/src/layouts/index.ts +1 -3
  38. package/src/snippets/AuthDialog/useAuthDialog.ts +2 -0
  39. package/src/snippets/Chat/components/MessageList.tsx +12 -11
  40. package/src/snippets/Chat/index.tsx +1 -0
  41. package/src/snippets/ContactForm/ContactForm.tsx +7 -2
  42. package/src/snippets/ContactForm/ContactPage.tsx +16 -3
  43. package/src/snippets/VideoPlayer/README.md +35 -0
  44. package/src/snippets/VideoPlayer/VideoControls.tsx +13 -9
  45. package/src/snippets/VideoPlayer/VideoPlayer.tsx +159 -25
  46. package/src/snippets/VideoPlayer/index.ts +1 -1
  47. package/src/validation/utils/curl-generator.ts +5 -1
  48. package/src/layouts/UILayout/README.md +0 -267
  49. package/src/layouts/UILayout/SUMMARY.md +0 -298
  50. package/src/layouts/UILayout/TOOLS_INTEGRATION.md +0 -216
  51. package/src/layouts/UILayout/components/AutoComponentDemo.tsx +0 -77
  52. package/src/layouts/UILayout/components/CategoryRenderer.tsx +0 -45
  53. package/src/layouts/UILayout/components/TailwindGuideRenderer.tsx +0 -138
  54. package/src/layouts/UILayout/components/index.ts +0 -15
  55. package/src/layouts/UILayout/components/layout/Header/CopyAIButton.tsx +0 -58
  56. package/src/layouts/UILayout/components/layout/Header/Header.tsx +0 -60
  57. package/src/layouts/UILayout/components/layout/Header/HeaderDesktop.tsx +0 -51
  58. package/src/layouts/UILayout/components/layout/Header/HeaderMobile.tsx +0 -71
  59. package/src/layouts/UILayout/components/layout/Header/TestValidationButton.tsx +0 -268
  60. package/src/layouts/UILayout/components/layout/Header/index.ts +0 -11
  61. package/src/layouts/UILayout/components/layout/MobileOverlay/MobileOverlay.tsx +0 -47
  62. package/src/layouts/UILayout/components/layout/MobileOverlay/index.ts +0 -6
  63. package/src/layouts/UILayout/components/layout/Sidebar/Sidebar.tsx +0 -95
  64. package/src/layouts/UILayout/components/layout/Sidebar/SidebarCategory.tsx +0 -54
  65. package/src/layouts/UILayout/components/layout/Sidebar/SidebarContent.tsx +0 -93
  66. package/src/layouts/UILayout/components/layout/Sidebar/SidebarFooter.tsx +0 -49
  67. package/src/layouts/UILayout/components/layout/Sidebar/index.ts +0 -9
  68. package/src/layouts/UILayout/components/layout/index.ts +0 -8
  69. package/src/layouts/UILayout/components/shared/Badge/CountBadge.tsx +0 -38
  70. package/src/layouts/UILayout/components/shared/Badge/index.ts +0 -5
  71. package/src/layouts/UILayout/components/shared/CodeBlock/CodeBlock.tsx +0 -48
  72. package/src/layouts/UILayout/components/shared/CodeBlock/CopyButton.tsx +0 -49
  73. package/src/layouts/UILayout/components/shared/CodeBlock/index.ts +0 -6
  74. package/src/layouts/UILayout/components/shared/Section/Section.tsx +0 -63
  75. package/src/layouts/UILayout/components/shared/Section/index.ts +0 -5
  76. package/src/layouts/UILayout/components/shared/index.ts +0 -8
  77. package/src/layouts/UILayout/config/ai-export.config.ts +0 -89
  78. package/src/layouts/UILayout/config/categories.config.tsx +0 -122
  79. package/src/layouts/UILayout/config/components/blocks.config.tsx +0 -239
  80. package/src/layouts/UILayout/config/components/data.config.tsx +0 -433
  81. package/src/layouts/UILayout/config/components/feedback.config.tsx +0 -290
  82. package/src/layouts/UILayout/config/components/forms.config.tsx +0 -996
  83. package/src/layouts/UILayout/config/components/hooks.config.tsx +0 -168
  84. package/src/layouts/UILayout/config/components/index.ts +0 -72
  85. package/src/layouts/UILayout/config/components/layout.config.tsx +0 -246
  86. package/src/layouts/UILayout/config/components/navigation.config.tsx +0 -352
  87. package/src/layouts/UILayout/config/components/overlay.config.tsx +0 -569
  88. package/src/layouts/UILayout/config/components/specialized.config.tsx +0 -400
  89. package/src/layouts/UILayout/config/components/tools.config.tsx +0 -234
  90. package/src/layouts/UILayout/config/components/types.ts +0 -14
  91. package/src/layouts/UILayout/config/index.ts +0 -42
  92. package/src/layouts/UILayout/config/tailwind.config.ts +0 -131
  93. package/src/layouts/UILayout/constants.ts +0 -23
  94. package/src/layouts/UILayout/context/ShowcaseContext.tsx +0 -81
  95. package/src/layouts/UILayout/context/index.ts +0 -1
  96. package/src/layouts/UILayout/core/UIGuideApp.client.tsx +0 -18
  97. package/src/layouts/UILayout/core/UIGuideApp.tsx +0 -33
  98. package/src/layouts/UILayout/core/UIGuideLanding.tsx +0 -172
  99. package/src/layouts/UILayout/core/UIGuideView.tsx +0 -61
  100. package/src/layouts/UILayout/core/UILayout.tsx +0 -125
  101. package/src/layouts/UILayout/core/UILayoutSidebar.tsx +0 -11
  102. package/src/layouts/UILayout/core/index.ts +0 -10
  103. package/src/layouts/UILayout/hooks/index.ts +0 -9
  104. package/src/layouts/UILayout/hooks/useAIExport.ts +0 -78
  105. package/src/layouts/UILayout/hooks/useCategoryNavigation.ts +0 -92
  106. package/src/layouts/UILayout/hooks/useComponentSearch.ts +0 -81
  107. package/src/layouts/UILayout/hooks/useSidebarState.ts +0 -36
  108. package/src/layouts/UILayout/index.ts +0 -160
  109. package/src/layouts/UILayout/types/component.ts +0 -45
  110. package/src/layouts/UILayout/types/index.ts +0 -23
  111. package/src/layouts/UILayout/types/layout.ts +0 -57
  112. package/src/layouts/UILayout/types/navigation.ts +0 -33
  113. package/src/layouts/UILayout/utils/ai-export/formatters.ts +0 -71
  114. package/src/layouts/UILayout/utils/ai-export/index.ts +0 -5
  115. package/src/layouts/UILayout/utils/component-helpers/filter.ts +0 -109
  116. package/src/layouts/UILayout/utils/component-helpers/index.ts +0 -6
  117. package/src/layouts/UILayout/utils/component-helpers/search.ts +0 -95
  118. package/src/layouts/UILayout/utils/index.ts +0 -6
@@ -1,298 +0,0 @@
1
- # UILayout - Декомпозиция завершена ✅
2
-
3
- ## 🎉 Результат
4
-
5
- **TypeScript check: PASSED ✅**
6
-
7
- ```bash
8
- > pnpm check
9
- > tsc --noEmit
10
- # No errors!
11
- ```
12
-
13
- ## 📊 Финальная статистика
14
-
15
- ### Структура проекта
16
- ```
17
- UILayout/
18
- ├── 📁 core/ 5 файлов - Главные компоненты
19
- ├── 📁 types/ 4 файла - Структурированные типы
20
- ├── 📁 hooks/ 5 файлов - Custom hooks
21
- ├── 📁 components/
22
- │ ├── layout/ 13 файлов - Декомпозированные layout
23
- │ ├── shared/ 9 файлов - Переиспользуемые UI
24
- │ └── content/ 3 файла - Content компоненты
25
- ├── 📁 utils/ 7 файлов - AI export + helpers
26
- ├── 📁 config/ 15 файлов - Конфигурация (не изменена)
27
- ├── 📁 context/ 2 файла - React Context (не изменен)
28
- └── 📁 docs/ 4 файла - Документация
29
-
30
- Всего файлов: 65
31
- Новых файлов: ~48
32
- ```
33
-
34
- ### Созданные модули
35
-
36
- #### 1. **Types** (4 файла)
37
- - `component.ts` - ComponentConfig, ComponentCategory
38
- - `layout.ts` - UILayoutProps, LayoutConfig, UILayoutConfig
39
- - `navigation.ts` - NavigationState, SidebarState
40
- - `index.ts` - Re-exports
41
-
42
- #### 2. **Hooks** (5 файлов)
43
- - `useSidebarState.ts` - Управление sidebar
44
- - `useAIExport.ts` - AI экспорт с feedback
45
- - `useCategoryNavigation.ts` - Навигация с историей
46
- - `useComponentSearch.ts` - Поиск компонентов
47
- - `index.ts` - Re-exports
48
-
49
- #### 3. **Components**
50
-
51
- **Layout** (13 файлов):
52
- - `Header/` → 5 файлов (Header, HeaderDesktop, HeaderMobile, CopyAIButton, index)
53
- - `Sidebar/` → 5 файлов (Sidebar, SidebarContent, SidebarCategory, SidebarFooter, index)
54
- - `MobileOverlay/` → 2 файла (MobileOverlay, index)
55
- - `index.ts`
56
-
57
- **Shared** (9 файлов):
58
- - `Badge/` → 2 файла (CountBadge, index)
59
- - `CodeBlock/` → 3 файла (CodeBlock, CopyButton, index)
60
- - `Section/` → 2 файла (Section, index)
61
- - `index.ts`
62
-
63
- #### 4. **Utils** (7 файлов)
64
- - `ai-export/` → 3 файла (generators, formatters, index)
65
- - `component-helpers/` → 3 файла (search, filter, index)
66
- - `index.ts`
67
-
68
- #### 5. **Core** (5 файлов)
69
- - `UILayout.tsx` - Главный layout
70
- - `UIGuideApp.tsx` - App wrapper
71
- - `UIGuideView.tsx` - View component
72
- - `UIGuideLanding.tsx` - Landing page
73
- - `index.ts` - Re-exports
74
-
75
- ## 🔧 Ключевые улучшения
76
-
77
- ### 1. Декомпозиция компонентов
78
- ```
79
- Header: 1 файл (115 строк) → 5 файлов (декомпозировано)
80
- Sidebar: 1 файл (189 строк) → 5 файлов (декомпозировано)
81
- ```
82
-
83
- ### 2. Новые hooks
84
- ```typescript
85
- ✅ useSidebarState() - Управление sidebar
86
- ✅ useAIExport() - AI экспорт
87
- ✅ useCategoryNavigation() - Навигация с историей
88
- ✅ useComponentSearch() - Поиск компонентов
89
- ```
90
-
91
- ### 3. Shared компоненты
92
- ```typescript
93
- ✅ <CountBadge /> - Бейдж счетчика
94
- ✅ <CodeBlock /> - Блок кода с копированием
95
- ✅ <Section /> - Секция с заголовком
96
- ```
97
-
98
- ### 4. Utils функции (15+)
99
- ```typescript
100
- // AI Export
101
- ✅ generateAIContext()
102
- ✅ generateTailwindSection()
103
- ✅ formatComponentAsMarkdown()
104
- ✅ formatCodeBlock()
105
-
106
- // Component Helpers
107
- ✅ searchComponents()
108
- ✅ filterByCategory()
109
- ✅ filterByTags()
110
- ✅ applyFilters()
111
- ✅ sortComponents()
112
- ✅ groupComponentsBy()
113
- ```
114
-
115
- ## 📦 Публичные exports
116
-
117
- ### Полный список экспортов:
118
- ```typescript
119
- // Core
120
- export { UILayout, UIGuideApp, UIGuideView, UIGuideLanding } from '@djangocfg/layouts/UILayout';
121
-
122
- // Types
123
- export type {
124
- ComponentConfig,
125
- ComponentCategory,
126
- UILayoutProps,
127
- LayoutConfig,
128
- UILayoutConfig,
129
- NavigationState,
130
- SidebarState,
131
- } from '@djangocfg/layouts/UILayout';
132
-
133
- // Hooks
134
- export {
135
- useSidebarState,
136
- useAIExport,
137
- useCategoryNavigation,
138
- useComponentSearch,
139
- } from '@djangocfg/layouts/UILayout';
140
-
141
- // Layout Components
142
- export {
143
- Header,
144
- HeaderDesktop,
145
- HeaderMobile,
146
- CopyAIButton,
147
- Sidebar,
148
- SidebarContent,
149
- SidebarCategory,
150
- SidebarFooter,
151
- MobileOverlay,
152
- } from '@djangocfg/layouts/UILayout';
153
-
154
- // Shared Components
155
- export {
156
- CountBadge,
157
- CodeBlock,
158
- CopyButton,
159
- Section,
160
- } from '@djangocfg/layouts/UILayout';
161
-
162
- // Utils
163
- export {
164
- generateAIContext,
165
- searchComponents,
166
- filterByCategory,
167
- applyFilters,
168
- sortComponents,
169
- // ... и еще 10+
170
- } from '@djangocfg/layouts/UILayout';
171
-
172
- // Config
173
- export {
174
- CATEGORIES,
175
- COMPONENTS_CONFIG,
176
- TAILWIND_GUIDE,
177
- // ... весь config
178
- } from '@djangocfg/layouts/UILayout';
179
- ```
180
-
181
- ## ✨ Преимущества новой структуры
182
-
183
- ### 1. Модульность
184
- - ✅ Каждый компонент - отдельный файл
185
- - ✅ Логика вынесена в hooks
186
- - ✅ Утилиты изолированы
187
-
188
- ### 2. Переиспользование
189
- - ✅ Hooks можно использовать независимо
190
- - ✅ Shared компоненты универсальны
191
- - ✅ Utils работают с любыми данными
192
-
193
- ### 3. Тестируемость
194
- - ✅ Каждый модуль тестируется отдельно
195
- - ✅ Hooks изолированы
196
- - ✅ Utils - чистые функции
197
-
198
- ### 4. Масштабируемость
199
- - ✅ Легко добавлять hooks
200
- - ✅ Просто создавать shared компоненты
201
- - ✅ Удобно расширять utils
202
-
203
- ### 5. Типобезопасность
204
- - ✅ Структурированные types
205
- - ✅ Все типы экспортируются
206
- - ✅ TypeScript check проходит
207
-
208
- ## 🔄 Изменения
209
-
210
- ### Удалено
211
- - ❌ Backward compatibility (ComponentShowcaseLayout)
212
- - ❌ Старые файлы из корня
213
- - ❌ Дублирующиеся компоненты
214
- - ❌ Legacy exports
215
-
216
- ### Добавлено
217
- - ✅ 4 новых hooks
218
- - ✅ 3 shared компонента
219
- - ✅ 15+ utils функций
220
- - ✅ Структурированные types
221
- - ✅ Декомпозированные layout компоненты
222
-
223
- ## 📚 Документация
224
-
225
- Создано 4 документа:
226
- 1. **README.md** - Основная документация
227
- 2. **STRUCTURE.md** - Детальная структура (3 уровня)
228
- 3. **MIGRATION.md** - Руководство по использованию
229
- 4. **FINAL_REPORT.md** - Полный отчет о декомпозиции
230
- 5. **SUMMARY.md** - Этот краткий отчет
231
-
232
- ## 💡 Примеры использования
233
-
234
- ### 1. Использование hooks
235
- ```typescript
236
- import { useSidebarState, useAIExport } from '@djangocfg/layouts/UILayout';
237
-
238
- function MyComponent() {
239
- const sidebar = useSidebarState();
240
- const { exportForAI, copied } = useAIExport({
241
- generateContext: () => generateAIContext(),
242
- });
243
-
244
- return (
245
- <div>
246
- <button onClick={sidebar.toggle}>Toggle</button>
247
- <button onClick={exportForAI}>
248
- {copied ? 'Copied!' : 'Copy for AI'}
249
- </button>
250
- </div>
251
- );
252
- }
253
- ```
254
-
255
- ### 2. Использование shared компонентов
256
- ```typescript
257
- import { Section, CodeBlock, CountBadge } from '@djangocfg/layouts/UILayout';
258
-
259
- <Section title="API" description="Documentation">
260
- <CodeBlock code="npm install" language="bash" showCopy={true} />
261
- <CountBadge count={42} active={true} />
262
- </Section>
263
- ```
264
-
265
- ### 3. Использование utils
266
- ```typescript
267
- import { searchComponents, applyFilters } from '@djangocfg/layouts/UILayout';
268
-
269
- const results = searchComponents(COMPONENTS_CONFIG, 'button');
270
- const filtered = applyFilters(COMPONENTS_CONFIG, {
271
- category: 'forms',
272
- query: 'input',
273
- });
274
- ```
275
-
276
- ## 🎯 Итоги
277
-
278
- ### Достигнуто
279
- ✅ Полная декомпозиция UILayout
280
- ✅ Создано 48+ новых модульных файлов
281
- ✅ 4 новых custom hooks
282
- ✅ 3 переиспользуемых shared компонента
283
- ✅ 15+ utils функций
284
- ✅ Структурированные types
285
- ✅ TypeScript check проходит без ошибок
286
- ✅ Убрана backward compatibility
287
- ✅ Чистая модульная архитектура
288
-
289
- ### Качество кода
290
- ✅ Модульность: 100%
291
- ✅ Типобезопасность: 100%
292
- ✅ Тестируемость: Высокая
293
- ✅ Масштабируемость: Отличная
294
- ✅ Документация: Полная
295
-
296
- ## 🚀 Готово к использованию!
297
-
298
- Декомпозиция UILayout успешно завершена. Новая структура полностью готова к production использованию.
@@ -1,216 +0,0 @@
1
- # Developer Tools Integration
2
-
3
- ## Overview
4
-
5
- Successfully integrated three developer tool components into the UILayout showcase:
6
-
7
- 1. **JsonTree** - Interactive JSON viewer with expand/collapse functionality
8
- 2. **PrettyCode** - Syntax-highlighted code display
9
- 3. **Mermaid** - Diagram renderer with fullscreen support
10
-
11
- ## Changes Made
12
-
13
- ### 1. Created Tools Configuration
14
-
15
- **File**: `config/components/tools.config.tsx`
16
-
17
- - Defined 3 component configurations with examples and previews
18
- - Added sample data for demonstrations
19
- - Included comprehensive usage examples
20
-
21
- ### 2. Updated Components Index
22
-
23
- **File**: `config/components/index.ts`
24
-
25
- - Added `TOOLS_COMPONENTS` export
26
- - Integrated tools into `COMPONENTS_CONFIG` array
27
- - Tools now available in component registry
28
-
29
- ### 3. Added Developer Tools Category
30
-
31
- **File**: `config/categories.config.tsx`
32
-
33
- - Created new "Developer Tools" category
34
- - Added Wrench icon from lucide-react
35
- - Positioned between "Specialized" and "Blocks" categories
36
- - Description: "Developer utilities: JSON viewer, code syntax highlighting, Mermaid diagrams"
37
-
38
- ### 4. Updated Tools Exports
39
-
40
- **File**: `packages/ui/src/tools/index.ts`
41
-
42
- - Ensured all tools are properly exported as named exports
43
- - Exported TypeScript types (Language, JsonTreeConfig)
44
-
45
- ## Component Features
46
-
47
- ### JsonTree
48
-
49
- **Features:**
50
- - Expand/collapse all functionality
51
- - Smart auto-expansion based on depth and collection size
52
- - Collection info display (array length, object keys count)
53
- - Copy to clipboard
54
- - Download as JSON file
55
- - Theme-aware colors using CSS variables
56
- - String truncation for long values
57
- - Configurable expansion limits
58
-
59
- **Configuration Options:**
60
- - `maxAutoExpandDepth` - Maximum depth to auto-expand (default: 2)
61
- - `maxAutoExpandArrayItems` - Max array items to auto-expand (default: 10)
62
- - `maxAutoExpandObjectKeys` - Max object keys to auto-expand (default: 5)
63
- - `maxStringLength` - String truncation threshold (default: 200)
64
- - `collectionLimit` - Collection size limit for performance (default: 50)
65
- - `showCollectionInfo` - Display collection metadata
66
- - `showExpandControls` - Show expand/collapse buttons
67
- - `showActionButtons` - Show copy/download buttons
68
-
69
- ### PrettyCode
70
-
71
- **Features:**
72
- - Syntax highlighting with Prism
73
- - Automatic language detection
74
- - Theme support (dark/light)
75
- - Inline and block modes
76
- - Language badge display
77
- - Support for 15+ languages
78
- - Custom background colors
79
- - JSON auto-formatting
80
-
81
- **Supported Languages:**
82
- - JavaScript/TypeScript
83
- - Python
84
- - Bash/Shell
85
- - JSON, YAML, XML
86
- - HTML, CSS
87
- - SQL
88
- - Markdown
89
- - And more...
90
-
91
- ### Mermaid
92
-
93
- **Features:**
94
- - Fullscreen modal view
95
- - Click to expand
96
- - ESC key to close
97
- - Theme-aware rendering
98
- - Semantic color variables
99
- - Support for all Mermaid diagram types
100
- - Responsive SVG sizing
101
- - Error handling with user feedback
102
-
103
- **Supported Diagrams:**
104
- - Flowchart / Graph
105
- - Sequence diagram
106
- - Class diagram
107
- - State diagram
108
- - Entity Relationship diagram
109
- - User Journey
110
- - Gantt chart
111
- - Pie chart
112
- - Git graph
113
-
114
- ## Usage in UILayout
115
-
116
- The tools are now accessible through the UILayout navigation:
117
-
118
- 1. Navigate to **Developer Tools** category in sidebar
119
- 2. Click on any tool (JsonTree, PrettyCode, Mermaid)
120
- 3. View live preview and usage examples
121
- 4. Copy code examples for use in your project
122
-
123
- ## Import Examples
124
-
125
- ```tsx
126
- // Individual imports
127
- import { JsonTree } from '@djangocfg/ui';
128
- import { PrettyCode } from '@djangocfg/ui';
129
- import { Mermaid } from '@djangocfg/ui';
130
-
131
- // All at once
132
- import { JsonTree, PrettyCode, Mermaid } from '@djangocfg/ui';
133
- ```
134
-
135
- ## Preview Examples
136
-
137
- ### JsonTree Preview
138
- ```tsx
139
- <JsonTree
140
- title="User Data"
141
- data={{
142
- user: {
143
- id: 1,
144
- name: "John Doe",
145
- profile: { bio: "Software engineer" }
146
- }
147
- }}
148
- config={{
149
- maxAutoExpandDepth: 2,
150
- showCollectionInfo: true,
151
- showExpandControls: true,
152
- }}
153
- />
154
- ```
155
-
156
- ### PrettyCode Preview
157
- ```tsx
158
- <PrettyCode
159
- data={pythonCode}
160
- language="python"
161
- />
162
- ```
163
-
164
- ### Mermaid Preview
165
- ```tsx
166
- <Mermaid
167
- chart={`
168
- graph TD
169
- A[Start] --> B{Decision}
170
- B -->|Yes| C[OK]
171
- B -->|No| D[End]
172
- `}
173
- />
174
- ```
175
-
176
- ## File Structure
177
-
178
- ```
179
- UILayout/
180
- ├── config/
181
- │ ├── components/
182
- │ │ ├── tools.config.tsx # NEW - Tools configurations
183
- │ │ └── index.ts # UPDATED - Added tools export
184
- │ └── categories.config.tsx # UPDATED - Added tools category
185
- └── TOOLS_INTEGRATION.md # THIS FILE
186
- ```
187
-
188
- ## Testing
189
-
190
- To verify the integration:
191
-
192
- 1. Start the development server
193
- 2. Navigate to UILayout showcase
194
- 3. Check sidebar for "Developer Tools" category
195
- 4. Verify all 3 components render correctly
196
- 5. Test interactive features:
197
- - JsonTree: expand/collapse, copy, download
198
- - PrettyCode: syntax highlighting in different themes
199
- - Mermaid: fullscreen view, ESC key close
200
-
201
- ## Next Steps
202
-
203
- Potential enhancements:
204
- - Add search functionality to JsonTree
205
- - Add more code language examples to PrettyCode
206
- - Add more diagram type examples to Mermaid
207
- - Create composite examples combining multiple tools
208
- - Add performance benchmarks section
209
-
210
- ## Notes
211
-
212
- - All components are theme-aware using CSS variables
213
- - All components support both light and dark modes
214
- - All components are fully responsive
215
- - No breaking changes to existing components
216
- - Backward compatible with existing UILayout structure
@@ -1,77 +0,0 @@
1
- /**
2
- * AutoComponentDemo
3
- * Automatically renders component demos from configuration
4
- */
5
-
6
- 'use client';
7
-
8
- import React from 'react';
9
- import { Card, CardContent, CardDescription, CardHeader, CardTitle, Tabs, TabsContent, TabsList, TabsTrigger } from '@djangocfg/ui';
10
- import { PrettyCode } from '@djangocfg/ui/tools';
11
- import type { ComponentConfig } from '../config';
12
-
13
- interface AutoComponentDemoProps {
14
- component: ComponentConfig;
15
- }
16
-
17
- /**
18
- * AutoComponentDemo - Renders a component demo from config
19
- * This is the single component used to display all UI components
20
- */
21
- export function AutoComponentDemo({ component }: AutoComponentDemoProps) {
22
- return (
23
- <Card className="mb-6">
24
- <CardHeader>
25
- <CardTitle className="text-lg">{component.name}</CardTitle>
26
- <CardDescription>{component.description}</CardDescription>
27
- </CardHeader>
28
- <CardContent>
29
- <Tabs defaultValue="preview" className="w-full">
30
- <TabsList className="mb-4">
31
- <TabsTrigger value="preview">Preview</TabsTrigger>
32
- <TabsTrigger value="code">Code</TabsTrigger>
33
- </TabsList>
34
-
35
- <TabsContent value="preview" className="space-y-4">
36
- <div className="p-6 border rounded-md bg-card">
37
- {component.preview}
38
- </div>
39
- </TabsContent>
40
-
41
- <TabsContent value="code">
42
- <PrettyCode
43
- data={`${component.importPath}\n\n${component.example}`}
44
- language="tsx"
45
- className="text-sm"
46
- />
47
- </TabsContent>
48
- </Tabs>
49
- </CardContent>
50
- </Card>
51
- );
52
- }
53
-
54
- /**
55
- * CategorySection - Groups related component demos
56
- */
57
- interface CategorySectionProps {
58
- title: string;
59
- description?: string;
60
- children: React.ReactNode;
61
- }
62
-
63
- export function CategorySection({ title, description, children }: CategorySectionProps) {
64
- return (
65
- <div className="mb-12">
66
- <div className="mb-6">
67
- <h2 className="text-2xl font-bold tracking-tight">{title}</h2>
68
- {description && (
69
- <p className="text-muted-foreground mt-2">{description}</p>
70
- )}
71
- </div>
72
- <div className="space-y-6">
73
- {children}
74
- </div>
75
- </div>
76
- );
77
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * CategoryRenderer
3
- * Universal renderer for any category using config data
4
- */
5
-
6
- 'use client';
7
-
8
- import React from 'react';
9
- import { getComponentsByCategory, getCategoryById } from '../config';
10
- import { AutoComponentDemo, CategorySection } from './AutoComponentDemo';
11
-
12
- interface CategoryRendererProps {
13
- categoryId: string;
14
- }
15
-
16
- /**
17
- * CategoryRenderer - Dynamically renders all components in a category
18
- * No need for separate demo files - everything comes from config
19
- */
20
- export function CategoryRenderer({ categoryId }: CategoryRendererProps) {
21
- const category = getCategoryById(categoryId);
22
- const components = getComponentsByCategory(categoryId);
23
-
24
- if (!category || components.length === 0) {
25
- return (
26
- <div className="p-8 text-center text-muted-foreground">
27
- <p>No components found for this category</p>
28
- </div>
29
- );
30
- }
31
-
32
- return (
33
- <CategorySection
34
- title={category.label}
35
- description={category.description}
36
- >
37
- {components.map((component) => (
38
- <AutoComponentDemo
39
- key={component.name}
40
- component={component}
41
- />
42
- ))}
43
- </CategorySection>
44
- );
45
- }