@djangocfg/layouts 1.2.17 → 1.2.19
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/package.json +5 -5
- package/src/layouts/AppLayout/components/PackageVersions/packageVersions.config.ts +8 -8
- package/src/layouts/UILayout/SUMMARY.md +298 -0
- package/src/layouts/UILayout/components/index.ts +15 -0
- package/src/layouts/UILayout/components/layout/Header/CopyAIButton.tsx +58 -0
- package/src/layouts/UILayout/components/layout/Header/Header.tsx +53 -0
- package/src/layouts/UILayout/components/layout/Header/HeaderDesktop.tsx +44 -0
- package/src/layouts/UILayout/components/layout/Header/HeaderMobile.tsx +71 -0
- package/src/layouts/UILayout/components/layout/Header/index.ts +9 -0
- package/src/layouts/UILayout/components/layout/MobileOverlay/MobileOverlay.tsx +46 -0
- package/src/layouts/UILayout/components/layout/MobileOverlay/index.ts +6 -0
- package/src/layouts/UILayout/components/layout/Sidebar/Sidebar.tsx +94 -0
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarCategory.tsx +54 -0
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarContent.tsx +86 -0
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarFooter.tsx +49 -0
- package/src/layouts/UILayout/components/layout/Sidebar/index.ts +9 -0
- package/src/layouts/UILayout/components/layout/index.ts +8 -0
- package/src/layouts/UILayout/components/shared/Badge/CountBadge.tsx +38 -0
- package/src/layouts/UILayout/components/shared/Badge/index.ts +5 -0
- package/src/layouts/UILayout/components/shared/CodeBlock/CodeBlock.tsx +48 -0
- package/src/layouts/UILayout/components/shared/CodeBlock/CopyButton.tsx +49 -0
- package/src/layouts/UILayout/components/shared/CodeBlock/index.ts +6 -0
- package/src/layouts/UILayout/components/shared/Section/Section.tsx +63 -0
- package/src/layouts/UILayout/components/shared/Section/index.ts +5 -0
- package/src/layouts/UILayout/components/shared/index.ts +8 -0
- package/src/layouts/UILayout/config/components/navigation.config.tsx +29 -8
- package/src/layouts/UILayout/context/ShowcaseContext.tsx +1 -11
- package/src/layouts/UILayout/{UIGuideLanding.tsx → core/UIGuideLanding.tsx} +1 -1
- package/src/layouts/UILayout/{UIGuideView.tsx → core/UIGuideView.tsx} +6 -6
- package/src/layouts/UILayout/core/UILayout.tsx +102 -0
- package/src/layouts/UILayout/core/index.ts +9 -0
- package/src/layouts/UILayout/hooks/index.ts +9 -0
- package/src/layouts/UILayout/hooks/useAIExport.ts +78 -0
- package/src/layouts/UILayout/hooks/useCategoryNavigation.ts +92 -0
- package/src/layouts/UILayout/hooks/useComponentSearch.ts +81 -0
- package/src/layouts/UILayout/hooks/useSidebarState.ts +36 -0
- package/src/layouts/UILayout/index.ts +121 -22
- package/src/layouts/UILayout/types/component.ts +45 -0
- package/src/layouts/UILayout/types/index.ts +23 -0
- package/src/layouts/UILayout/types/layout.ts +57 -0
- package/src/layouts/UILayout/types/navigation.ts +33 -0
- package/src/layouts/UILayout/utils/ai-export/formatters.ts +71 -0
- package/src/layouts/UILayout/utils/ai-export/generators.ts +130 -0
- package/src/layouts/UILayout/utils/ai-export/index.ts +6 -0
- package/src/layouts/UILayout/utils/component-helpers/filter.ts +109 -0
- package/src/layouts/UILayout/utils/component-helpers/index.ts +6 -0
- package/src/layouts/UILayout/utils/component-helpers/search.ts +95 -0
- package/src/layouts/UILayout/utils/index.ts +6 -0
- package/src/layouts/UILayout/REFACTORING.md +0 -331
- package/src/layouts/UILayout/UILayout.tsx +0 -122
- package/src/layouts/UILayout/components/Header.tsx +0 -114
- package/src/layouts/UILayout/components/MobileOverlay.tsx +0 -33
- package/src/layouts/UILayout/components/Sidebar.tsx +0 -188
- package/src/layouts/UILayout/types.ts +0 -13
- /package/src/layouts/UILayout/{UIGuideApp.tsx → core/UIGuideApp.tsx} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UILayout
|
|
3
|
+
* Modern, config-driven layout for UI component documentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Tabs, TabsList, TabsTrigger } from '@djangocfg/ui';
|
|
10
|
+
import { Header } from '../components/layout/Header';
|
|
11
|
+
import { generateAIContext } from '../config';
|
|
12
|
+
import type { UILayoutProps } from '../types';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* UILayout - Main layout component for UI documentation
|
|
17
|
+
*
|
|
18
|
+
* Features:
|
|
19
|
+
* - Config-driven: All component data comes from centralized config
|
|
20
|
+
* - "Copy for AI": One-click export of all documentation
|
|
21
|
+
* - Responsive: Auto-converts to mobile sheet menu on mobile
|
|
22
|
+
* - Type-safe: Full TypeScript support
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <UILayout
|
|
27
|
+
* title="UI Components"
|
|
28
|
+
* categories={CATEGORIES}
|
|
29
|
+
* currentCategory={category}
|
|
30
|
+
* onCategoryChange={setCategory}
|
|
31
|
+
* >
|
|
32
|
+
* <CategoryRenderer categoryId={category} />
|
|
33
|
+
* </UILayout>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function UILayout({
|
|
37
|
+
children,
|
|
38
|
+
title = "UI Component Library",
|
|
39
|
+
description,
|
|
40
|
+
categories,
|
|
41
|
+
currentCategory,
|
|
42
|
+
onCategoryChange,
|
|
43
|
+
logo,
|
|
44
|
+
projectName = "Django CFG UI",
|
|
45
|
+
}: UILayoutProps) {
|
|
46
|
+
const handleCopyForAI = () => {
|
|
47
|
+
return generateAIContext();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className="flex flex-col min-h-screen bg-background">
|
|
52
|
+
{/* Header with Copy for AI button */}
|
|
53
|
+
<Header
|
|
54
|
+
title={title}
|
|
55
|
+
projectName={projectName}
|
|
56
|
+
logo={logo}
|
|
57
|
+
onCopyForAI={handleCopyForAI}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
{/* Category Navigation Tabs */}
|
|
61
|
+
<div className="container mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-3">
|
|
62
|
+
<Tabs
|
|
63
|
+
value={currentCategory}
|
|
64
|
+
onValueChange={onCategoryChange}
|
|
65
|
+
mobileSheet
|
|
66
|
+
mobileTitleText="UI Library"
|
|
67
|
+
mobileSheetTitle="Categories"
|
|
68
|
+
sticky
|
|
69
|
+
>
|
|
70
|
+
<TabsList fullWidth className="h-auto flex-wrap">
|
|
71
|
+
{categories.map((category) => (
|
|
72
|
+
<TabsTrigger
|
|
73
|
+
key={category.id}
|
|
74
|
+
value={category.id}
|
|
75
|
+
flexEqual
|
|
76
|
+
className="gap-2 whitespace-nowrap"
|
|
77
|
+
>
|
|
78
|
+
{category.icon}
|
|
79
|
+
<span>{category.label}</span>
|
|
80
|
+
{category.count !== undefined && (
|
|
81
|
+
<span className="ml-1 text-xs opacity-60">({category.count})</span>
|
|
82
|
+
)}
|
|
83
|
+
</TabsTrigger>
|
|
84
|
+
))}
|
|
85
|
+
</TabsList>
|
|
86
|
+
</Tabs>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{/* Main Content */}
|
|
90
|
+
<main className="flex-1">
|
|
91
|
+
<div className="container max-w-7xl mx-auto p-6">
|
|
92
|
+
{description && (
|
|
93
|
+
<p className="text-sm text-muted-foreground mb-6">
|
|
94
|
+
{description}
|
|
95
|
+
</p>
|
|
96
|
+
)}
|
|
97
|
+
{children}
|
|
98
|
+
</div>
|
|
99
|
+
</main>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UILayout Hooks
|
|
3
|
+
* Custom hooks for UILayout functionality
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export { useAIExport } from './useAIExport';
|
|
7
|
+
export { useCategoryNavigation } from './useCategoryNavigation';
|
|
8
|
+
export { useComponentSearch } from './useComponentSearch';
|
|
9
|
+
export { useSidebarState } from './useSidebarState';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useAIExport Hook
|
|
3
|
+
* Handles AI context export with copy to clipboard
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import { useState, useCallback } from 'react';
|
|
9
|
+
import { useCopy } from '@djangocfg/ui';
|
|
10
|
+
|
|
11
|
+
interface UseAIExportOptions {
|
|
12
|
+
/** Function to generate AI context */
|
|
13
|
+
generateContext?: () => string;
|
|
14
|
+
/** Success callback */
|
|
15
|
+
onSuccess?: () => void;
|
|
16
|
+
/** Error callback */
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
/** Duration to show "copied" state (ms) */
|
|
19
|
+
copiedDuration?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface UseAIExportReturn {
|
|
23
|
+
/** Is currently in "copied" state */
|
|
24
|
+
copied: boolean;
|
|
25
|
+
/** Export function */
|
|
26
|
+
exportForAI: () => Promise<void>;
|
|
27
|
+
/** Reset copied state */
|
|
28
|
+
reset: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook for AI export functionality
|
|
33
|
+
* Handles copying AI context to clipboard with visual feedback
|
|
34
|
+
*/
|
|
35
|
+
export function useAIExport(options: UseAIExportOptions = {}): UseAIExportReturn {
|
|
36
|
+
const {
|
|
37
|
+
generateContext,
|
|
38
|
+
onSuccess,
|
|
39
|
+
onError,
|
|
40
|
+
copiedDuration = 2000,
|
|
41
|
+
} = options;
|
|
42
|
+
|
|
43
|
+
const [copied, setCopied] = useState(false);
|
|
44
|
+
const { copyToClipboard } = useCopy();
|
|
45
|
+
|
|
46
|
+
const exportForAI = useCallback(async () => {
|
|
47
|
+
try {
|
|
48
|
+
// Generate context
|
|
49
|
+
const context = generateContext?.() || '';
|
|
50
|
+
|
|
51
|
+
// Copy to clipboard
|
|
52
|
+
await copyToClipboard(context);
|
|
53
|
+
|
|
54
|
+
// Set copied state
|
|
55
|
+
setCopied(true);
|
|
56
|
+
|
|
57
|
+
// Reset after duration
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
setCopied(false);
|
|
60
|
+
}, copiedDuration);
|
|
61
|
+
|
|
62
|
+
// Success callback
|
|
63
|
+
onSuccess?.();
|
|
64
|
+
} catch (error) {
|
|
65
|
+
onError?.(error as Error);
|
|
66
|
+
}
|
|
67
|
+
}, [generateContext, copyToClipboard, copiedDuration, onSuccess, onError]);
|
|
68
|
+
|
|
69
|
+
const reset = useCallback(() => {
|
|
70
|
+
setCopied(false);
|
|
71
|
+
}, []);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
copied,
|
|
75
|
+
exportForAI,
|
|
76
|
+
reset,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCategoryNavigation Hook
|
|
3
|
+
* Manages category navigation with history
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
9
|
+
import type { NavigationState } from '../types';
|
|
10
|
+
|
|
11
|
+
interface UseCategoryNavigationOptions {
|
|
12
|
+
/** Initial category */
|
|
13
|
+
initialCategory?: string;
|
|
14
|
+
/** On category change callback */
|
|
15
|
+
onCategoryChange?: (categoryId: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface UseCategoryNavigationReturn extends NavigationState {
|
|
19
|
+
/** Navigate to a category */
|
|
20
|
+
navigateTo: (categoryId: string) => void;
|
|
21
|
+
/** Go back in history */
|
|
22
|
+
goBack: () => void;
|
|
23
|
+
/** Go forward in history */
|
|
24
|
+
goForward: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Hook for category navigation with history support
|
|
29
|
+
*/
|
|
30
|
+
export function useCategoryNavigation(
|
|
31
|
+
options: UseCategoryNavigationOptions = {}
|
|
32
|
+
): UseCategoryNavigationReturn {
|
|
33
|
+
const { initialCategory = 'overview', onCategoryChange } = options;
|
|
34
|
+
|
|
35
|
+
const [currentCategory, setCurrentCategory] = useState(initialCategory);
|
|
36
|
+
const [history, setHistory] = useState<string[]>([initialCategory]);
|
|
37
|
+
const [historyIndex, setHistoryIndex] = useState(0);
|
|
38
|
+
|
|
39
|
+
const canGoBack = useMemo(() => historyIndex > 0, [historyIndex]);
|
|
40
|
+
const canGoForward = useMemo(
|
|
41
|
+
() => historyIndex < history.length - 1,
|
|
42
|
+
[historyIndex, history.length]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const navigateTo = useCallback(
|
|
46
|
+
(categoryId: string) => {
|
|
47
|
+
if (categoryId === currentCategory) return;
|
|
48
|
+
|
|
49
|
+
// Remove forward history if we're not at the end
|
|
50
|
+
const newHistory = history.slice(0, historyIndex + 1);
|
|
51
|
+
newHistory.push(categoryId);
|
|
52
|
+
|
|
53
|
+
setHistory(newHistory);
|
|
54
|
+
setHistoryIndex(newHistory.length - 1);
|
|
55
|
+
setCurrentCategory(categoryId);
|
|
56
|
+
onCategoryChange?.(categoryId);
|
|
57
|
+
},
|
|
58
|
+
[currentCategory, history, historyIndex, onCategoryChange]
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const goBack = useCallback(() => {
|
|
62
|
+
if (!canGoBack) return;
|
|
63
|
+
|
|
64
|
+
const newIndex = historyIndex - 1;
|
|
65
|
+
const categoryId = history[newIndex];
|
|
66
|
+
|
|
67
|
+
setHistoryIndex(newIndex);
|
|
68
|
+
setCurrentCategory(categoryId);
|
|
69
|
+
onCategoryChange?.(categoryId);
|
|
70
|
+
}, [canGoBack, historyIndex, history, onCategoryChange]);
|
|
71
|
+
|
|
72
|
+
const goForward = useCallback(() => {
|
|
73
|
+
if (!canGoForward) return;
|
|
74
|
+
|
|
75
|
+
const newIndex = historyIndex + 1;
|
|
76
|
+
const categoryId = history[newIndex];
|
|
77
|
+
|
|
78
|
+
setHistoryIndex(newIndex);
|
|
79
|
+
setCurrentCategory(categoryId);
|
|
80
|
+
onCategoryChange?.(categoryId);
|
|
81
|
+
}, [canGoForward, historyIndex, history, onCategoryChange]);
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
currentCategory,
|
|
85
|
+
history,
|
|
86
|
+
canGoBack,
|
|
87
|
+
canGoForward,
|
|
88
|
+
navigateTo,
|
|
89
|
+
goBack,
|
|
90
|
+
goForward,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useComponentSearch Hook
|
|
3
|
+
* Search and filter components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
9
|
+
import type { ComponentConfig } from '../types';
|
|
10
|
+
|
|
11
|
+
interface UseComponentSearchOptions {
|
|
12
|
+
/** All available components */
|
|
13
|
+
components: ComponentConfig[];
|
|
14
|
+
/** Search in these fields */
|
|
15
|
+
searchFields?: Array<keyof ComponentConfig>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface UseComponentSearchReturn {
|
|
19
|
+
/** Search query */
|
|
20
|
+
query: string;
|
|
21
|
+
/** Set search query */
|
|
22
|
+
setQuery: (query: string) => void;
|
|
23
|
+
/** Filtered results */
|
|
24
|
+
results: ComponentConfig[];
|
|
25
|
+
/** Clear search */
|
|
26
|
+
clear: () => void;
|
|
27
|
+
/** Is searching */
|
|
28
|
+
isSearching: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Hook for searching components
|
|
33
|
+
* Supports fuzzy search across multiple fields
|
|
34
|
+
*/
|
|
35
|
+
export function useComponentSearch(
|
|
36
|
+
options: UseComponentSearchOptions
|
|
37
|
+
): UseComponentSearchReturn {
|
|
38
|
+
const {
|
|
39
|
+
components,
|
|
40
|
+
searchFields = ['name', 'description', 'category'],
|
|
41
|
+
} = options;
|
|
42
|
+
|
|
43
|
+
const [query, setQuery] = useState('');
|
|
44
|
+
|
|
45
|
+
const results = useMemo(() => {
|
|
46
|
+
if (!query.trim()) {
|
|
47
|
+
return components;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const lowerQuery = query.toLowerCase();
|
|
51
|
+
|
|
52
|
+
return components.filter((component) => {
|
|
53
|
+
return searchFields.some((field) => {
|
|
54
|
+
const value = component[field];
|
|
55
|
+
if (typeof value === 'string') {
|
|
56
|
+
return value.toLowerCase().includes(lowerQuery);
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
return value.some((item) =>
|
|
60
|
+
String(item).toLowerCase().includes(lowerQuery)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}, [query, components, searchFields]);
|
|
67
|
+
|
|
68
|
+
const clear = useCallback(() => {
|
|
69
|
+
setQuery('');
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const isSearching = useMemo(() => query.trim().length > 0, [query]);
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
query,
|
|
76
|
+
setQuery,
|
|
77
|
+
results,
|
|
78
|
+
clear,
|
|
79
|
+
isSearching,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSidebarState Hook
|
|
3
|
+
* Manages sidebar open/close state
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import { useState, useCallback } from 'react';
|
|
9
|
+
import type { SidebarState } from '../types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Hook for managing sidebar state
|
|
13
|
+
* Provides open/close/toggle functionality
|
|
14
|
+
*/
|
|
15
|
+
export function useSidebarState(): SidebarState {
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
|
+
|
|
18
|
+
const toggle = useCallback(() => {
|
|
19
|
+
setIsOpen(prev => !prev);
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
const open = useCallback(() => {
|
|
23
|
+
setIsOpen(true);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
const close = useCallback(() => {
|
|
27
|
+
setIsOpen(false);
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
isOpen,
|
|
32
|
+
toggle,
|
|
33
|
+
open,
|
|
34
|
+
close,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,29 +1,90 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* UILayout Module Exports
|
|
3
|
-
*
|
|
3
|
+
* Декомпозированная, модульная архитектура для UI документации
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// CORE COMPONENTS
|
|
8
|
+
// ============================================================================
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export {
|
|
11
|
+
UILayout,
|
|
12
|
+
UIGuideApp,
|
|
13
|
+
UIGuideView,
|
|
14
|
+
UIGuideLanding,
|
|
15
|
+
} from './core';
|
|
16
|
+
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// TYPES
|
|
19
|
+
// ============================================================================
|
|
20
|
+
|
|
21
|
+
export type {
|
|
22
|
+
// Component types
|
|
23
|
+
ComponentConfig,
|
|
24
|
+
ComponentCategory,
|
|
25
|
+
// Layout types
|
|
26
|
+
UILayoutProps,
|
|
27
|
+
LayoutConfig,
|
|
28
|
+
UILayoutConfig,
|
|
29
|
+
// Navigation types
|
|
30
|
+
NavigationState,
|
|
31
|
+
SidebarState,
|
|
32
|
+
} from './types';
|
|
12
33
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export { UIGuideApp } from './UIGuideApp';
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// HOOKS
|
|
36
|
+
// ============================================================================
|
|
17
37
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
export {
|
|
39
|
+
useSidebarState,
|
|
40
|
+
useAIExport,
|
|
41
|
+
useCategoryNavigation,
|
|
42
|
+
useComponentSearch,
|
|
43
|
+
} from './hooks';
|
|
44
|
+
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// COMPONENTS
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
49
|
+
// Layout components
|
|
50
|
+
export {
|
|
51
|
+
Header,
|
|
52
|
+
HeaderMobile,
|
|
53
|
+
HeaderDesktop,
|
|
54
|
+
CopyAIButton,
|
|
55
|
+
Sidebar,
|
|
56
|
+
SidebarContent,
|
|
57
|
+
SidebarCategory,
|
|
58
|
+
SidebarFooter,
|
|
59
|
+
MobileOverlay,
|
|
60
|
+
} from './components/layout';
|
|
61
|
+
|
|
62
|
+
export type {
|
|
63
|
+
HeaderProps,
|
|
64
|
+
SidebarProps,
|
|
65
|
+
MobileOverlayProps,
|
|
66
|
+
} from './components/layout';
|
|
67
|
+
|
|
68
|
+
// Shared components
|
|
69
|
+
export {
|
|
70
|
+
CountBadge,
|
|
71
|
+
CodeBlock,
|
|
72
|
+
CopyButton,
|
|
73
|
+
Section,
|
|
74
|
+
} from './components/shared';
|
|
75
|
+
|
|
76
|
+
// Content components
|
|
77
|
+
export {
|
|
78
|
+
AutoComponentDemo,
|
|
79
|
+
CategorySection,
|
|
80
|
+
CategoryRenderer,
|
|
81
|
+
TailwindGuideRenderer,
|
|
82
|
+
} from './components';
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// CONFIGURATION
|
|
86
|
+
// ============================================================================
|
|
25
87
|
|
|
26
|
-
// Configuration (Single Source of Truth)
|
|
27
88
|
export {
|
|
28
89
|
// All components
|
|
29
90
|
COMPONENTS_CONFIG,
|
|
@@ -52,13 +113,51 @@ export {
|
|
|
52
113
|
generateAIContext,
|
|
53
114
|
} from './config';
|
|
54
115
|
|
|
55
|
-
// Types
|
|
56
116
|
export type {
|
|
57
|
-
ComponentConfig,
|
|
58
|
-
ComponentCategory,
|
|
59
117
|
TailwindGuide,
|
|
60
118
|
UILibraryConfig,
|
|
61
119
|
} from './config';
|
|
62
120
|
|
|
63
|
-
//
|
|
121
|
+
// ============================================================================
|
|
122
|
+
// UTILITIES
|
|
123
|
+
// ============================================================================
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
// AI Export utilities
|
|
127
|
+
generateAIContext as generateAIContextNew,
|
|
128
|
+
generateTailwindSection,
|
|
129
|
+
generateComponentsSection,
|
|
130
|
+
generateComponentDoc,
|
|
131
|
+
formatComponentAsMarkdown,
|
|
132
|
+
formatComponentsAsMarkdownList,
|
|
133
|
+
formatImports,
|
|
134
|
+
formatCodeBlock,
|
|
135
|
+
formatSectionHeader,
|
|
136
|
+
formatList,
|
|
137
|
+
// Component helpers
|
|
138
|
+
searchComponents,
|
|
139
|
+
filterByCategory,
|
|
140
|
+
filterByTags,
|
|
141
|
+
getUniqueCategories,
|
|
142
|
+
getUniqueTags,
|
|
143
|
+
findComponentByName,
|
|
144
|
+
applyFilters,
|
|
145
|
+
sortComponents,
|
|
146
|
+
groupComponentsBy,
|
|
147
|
+
} from './utils';
|
|
148
|
+
|
|
149
|
+
export type {
|
|
150
|
+
FilterOptions,
|
|
151
|
+
} from './utils/component-helpers/filter';
|
|
152
|
+
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// CONTEXT
|
|
155
|
+
// ============================================================================
|
|
156
|
+
|
|
157
|
+
export { ShowcaseProvider, useShowcase } from './context';
|
|
158
|
+
|
|
159
|
+
// ============================================================================
|
|
160
|
+
// CONSTANTS
|
|
161
|
+
// ============================================================================
|
|
162
|
+
|
|
64
163
|
export * from './constants';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Component Configuration
|
|
9
|
+
* Defines metadata and content for a single component
|
|
10
|
+
*/
|
|
11
|
+
export interface ComponentConfig {
|
|
12
|
+
/** Component name (e.g., "Button") */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Category ID this component belongs to */
|
|
15
|
+
category: string;
|
|
16
|
+
/** Short description of the component */
|
|
17
|
+
description: string;
|
|
18
|
+
/** Import statement (e.g., "import { Button } from '@djangocfg/ui';") */
|
|
19
|
+
importPath: string;
|
|
20
|
+
/** Code example as string */
|
|
21
|
+
example: string;
|
|
22
|
+
/** Live preview component */
|
|
23
|
+
preview: ReactNode;
|
|
24
|
+
/** Optional tags for filtering */
|
|
25
|
+
tags?: string[];
|
|
26
|
+
/** Optional dependencies */
|
|
27
|
+
dependencies?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Component Category
|
|
32
|
+
* Defines a category in the sidebar navigation
|
|
33
|
+
*/
|
|
34
|
+
export interface ComponentCategory {
|
|
35
|
+
/** Unique category ID */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Display label */
|
|
38
|
+
label: string;
|
|
39
|
+
/** Icon component */
|
|
40
|
+
icon: ReactNode;
|
|
41
|
+
/** Number of components in this category */
|
|
42
|
+
count?: number;
|
|
43
|
+
/** Category description */
|
|
44
|
+
description?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UILayout Types
|
|
3
|
+
* Centralized type definitions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Component types
|
|
7
|
+
export type {
|
|
8
|
+
ComponentConfig,
|
|
9
|
+
ComponentCategory,
|
|
10
|
+
} from './component';
|
|
11
|
+
|
|
12
|
+
// Layout types
|
|
13
|
+
export type {
|
|
14
|
+
UILayoutProps,
|
|
15
|
+
LayoutConfig,
|
|
16
|
+
UILayoutConfig,
|
|
17
|
+
} from './layout';
|
|
18
|
+
|
|
19
|
+
// Navigation types
|
|
20
|
+
export type {
|
|
21
|
+
NavigationState,
|
|
22
|
+
SidebarState,
|
|
23
|
+
} from './navigation';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Configuration Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ReactNode } from 'react';
|
|
6
|
+
import type { ComponentCategory } from './component';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* UILayout Props
|
|
10
|
+
* Main layout component props
|
|
11
|
+
*/
|
|
12
|
+
export interface UILayoutProps {
|
|
13
|
+
/** Content to render in the main area */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** Page title */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Page description */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Available categories */
|
|
20
|
+
categories: ComponentCategory[];
|
|
21
|
+
/** Current selected category */
|
|
22
|
+
currentCategory?: string;
|
|
23
|
+
/** Callback when category changes */
|
|
24
|
+
onCategoryChange?: (categoryId: string) => void;
|
|
25
|
+
/** Logo component */
|
|
26
|
+
logo?: ReactNode;
|
|
27
|
+
/** Project name */
|
|
28
|
+
projectName?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Layout Configuration
|
|
33
|
+
* Defines layout dimensions and behavior
|
|
34
|
+
*/
|
|
35
|
+
export interface LayoutConfig {
|
|
36
|
+
/** Header height in pixels */
|
|
37
|
+
headerHeight?: number;
|
|
38
|
+
/** Container max width */
|
|
39
|
+
containerMaxWidth?: string;
|
|
40
|
+
/** Enable sticky header */
|
|
41
|
+
stickyHeader?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* UILayout Configuration
|
|
46
|
+
* Complete configuration for UILayout
|
|
47
|
+
*/
|
|
48
|
+
export interface UILayoutConfig {
|
|
49
|
+
/** Layout configuration */
|
|
50
|
+
layout?: LayoutConfig;
|
|
51
|
+
/** Default category to show */
|
|
52
|
+
defaultCategory?: string;
|
|
53
|
+
/** Enable search */
|
|
54
|
+
enableSearch?: boolean;
|
|
55
|
+
/** Enable breadcrumbs */
|
|
56
|
+
enableBreadcrumbs?: boolean;
|
|
57
|
+
}
|