@djangocfg/layouts 1.4.27 → 1.4.28
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/auth/middlewares/index.ts +1 -1
- package/src/auth/middlewares/proxy.ts +10 -2
- package/src/layouts/index.ts +0 -3
- package/src/snippets/ContactForm/ContactPage.tsx +16 -3
- package/src/layouts/UILayout/README.md +0 -267
- package/src/layouts/UILayout/SUMMARY.md +0 -298
- package/src/layouts/UILayout/TOOLS_INTEGRATION.md +0 -216
- package/src/layouts/UILayout/components/AutoComponentDemo.tsx +0 -77
- package/src/layouts/UILayout/components/CategoryRenderer.tsx +0 -45
- package/src/layouts/UILayout/components/TailwindGuideRenderer.tsx +0 -138
- package/src/layouts/UILayout/components/index.ts +0 -15
- package/src/layouts/UILayout/components/layout/Header/CopyAIButton.tsx +0 -58
- package/src/layouts/UILayout/components/layout/Header/Header.tsx +0 -60
- package/src/layouts/UILayout/components/layout/Header/HeaderDesktop.tsx +0 -51
- package/src/layouts/UILayout/components/layout/Header/HeaderMobile.tsx +0 -71
- package/src/layouts/UILayout/components/layout/Header/TestValidationButton.tsx +0 -268
- package/src/layouts/UILayout/components/layout/Header/index.ts +0 -11
- package/src/layouts/UILayout/components/layout/MobileOverlay/MobileOverlay.tsx +0 -47
- package/src/layouts/UILayout/components/layout/MobileOverlay/index.ts +0 -6
- package/src/layouts/UILayout/components/layout/Sidebar/Sidebar.tsx +0 -95
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarCategory.tsx +0 -54
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarContent.tsx +0 -93
- package/src/layouts/UILayout/components/layout/Sidebar/SidebarFooter.tsx +0 -49
- package/src/layouts/UILayout/components/layout/Sidebar/index.ts +0 -9
- package/src/layouts/UILayout/components/layout/index.ts +0 -8
- package/src/layouts/UILayout/components/shared/Badge/CountBadge.tsx +0 -38
- package/src/layouts/UILayout/components/shared/Badge/index.ts +0 -5
- package/src/layouts/UILayout/components/shared/CodeBlock/CodeBlock.tsx +0 -48
- package/src/layouts/UILayout/components/shared/CodeBlock/CopyButton.tsx +0 -49
- package/src/layouts/UILayout/components/shared/CodeBlock/index.ts +0 -6
- package/src/layouts/UILayout/components/shared/Section/Section.tsx +0 -63
- package/src/layouts/UILayout/components/shared/Section/index.ts +0 -5
- package/src/layouts/UILayout/components/shared/index.ts +0 -8
- package/src/layouts/UILayout/config/ai-export.config.ts +0 -89
- package/src/layouts/UILayout/config/categories.config.tsx +0 -122
- package/src/layouts/UILayout/config/components/blocks.config.tsx +0 -239
- package/src/layouts/UILayout/config/components/data.config.tsx +0 -433
- package/src/layouts/UILayout/config/components/feedback.config.tsx +0 -290
- package/src/layouts/UILayout/config/components/forms.config.tsx +0 -996
- package/src/layouts/UILayout/config/components/hooks.config.tsx +0 -168
- package/src/layouts/UILayout/config/components/index.ts +0 -72
- package/src/layouts/UILayout/config/components/layout.config.tsx +0 -246
- package/src/layouts/UILayout/config/components/navigation.config.tsx +0 -352
- package/src/layouts/UILayout/config/components/overlay.config.tsx +0 -569
- package/src/layouts/UILayout/config/components/specialized.config.tsx +0 -400
- package/src/layouts/UILayout/config/components/tools.config.tsx +0 -234
- package/src/layouts/UILayout/config/components/types.ts +0 -14
- package/src/layouts/UILayout/config/index.ts +0 -42
- package/src/layouts/UILayout/config/tailwind.config.ts +0 -131
- package/src/layouts/UILayout/constants.ts +0 -23
- package/src/layouts/UILayout/context/ShowcaseContext.tsx +0 -81
- package/src/layouts/UILayout/context/index.ts +0 -1
- package/src/layouts/UILayout/core/UIGuideApp.client.tsx +0 -18
- package/src/layouts/UILayout/core/UIGuideApp.tsx +0 -33
- package/src/layouts/UILayout/core/UIGuideLanding.tsx +0 -172
- package/src/layouts/UILayout/core/UIGuideView.tsx +0 -61
- package/src/layouts/UILayout/core/UILayout.tsx +0 -125
- package/src/layouts/UILayout/core/UILayoutSidebar.tsx +0 -11
- package/src/layouts/UILayout/core/index.ts +0 -10
- package/src/layouts/UILayout/hooks/index.ts +0 -9
- package/src/layouts/UILayout/hooks/useAIExport.ts +0 -78
- package/src/layouts/UILayout/hooks/useCategoryNavigation.ts +0 -92
- package/src/layouts/UILayout/hooks/useComponentSearch.ts +0 -81
- package/src/layouts/UILayout/hooks/useSidebarState.ts +0 -36
- package/src/layouts/UILayout/index.ts +0 -160
- package/src/layouts/UILayout/types/component.ts +0 -45
- package/src/layouts/UILayout/types/index.ts +0 -23
- package/src/layouts/UILayout/types/layout.ts +0 -57
- package/src/layouts/UILayout/types/navigation.ts +0 -33
- package/src/layouts/UILayout/utils/ai-export/formatters.ts +0 -71
- package/src/layouts/UILayout/utils/ai-export/index.ts +0 -5
- package/src/layouts/UILayout/utils/component-helpers/filter.ts +0 -109
- package/src/layouts/UILayout/utils/component-helpers/index.ts +0 -6
- package/src/layouts/UILayout/utils/component-helpers/search.ts +0 -95
- package/src/layouts/UILayout/utils/index.ts +0 -6
|
@@ -1,78 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UILayout Module Exports
|
|
3
|
-
* Декомпозированная, модульная архитектура для UI документации
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// CORE COMPONENTS
|
|
8
|
-
// ============================================================================
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
UILayout,
|
|
12
|
-
UILayoutSidebar,
|
|
13
|
-
UIGuideApp,
|
|
14
|
-
UIGuideView,
|
|
15
|
-
UIGuideLanding,
|
|
16
|
-
} from './core';
|
|
17
|
-
|
|
18
|
-
// ============================================================================
|
|
19
|
-
// TYPES
|
|
20
|
-
// ============================================================================
|
|
21
|
-
|
|
22
|
-
export type {
|
|
23
|
-
// Component types
|
|
24
|
-
ComponentConfig,
|
|
25
|
-
ComponentCategory,
|
|
26
|
-
// Layout types
|
|
27
|
-
UILayoutProps,
|
|
28
|
-
LayoutConfig,
|
|
29
|
-
UILayoutConfig,
|
|
30
|
-
// Navigation types
|
|
31
|
-
NavigationState,
|
|
32
|
-
SidebarState,
|
|
33
|
-
} from './types';
|
|
34
|
-
|
|
35
|
-
// ============================================================================
|
|
36
|
-
// HOOKS
|
|
37
|
-
// ============================================================================
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
useSidebarState,
|
|
41
|
-
useAIExport,
|
|
42
|
-
useCategoryNavigation,
|
|
43
|
-
useComponentSearch,
|
|
44
|
-
} from './hooks';
|
|
45
|
-
|
|
46
|
-
// ============================================================================
|
|
47
|
-
// COMPONENTS
|
|
48
|
-
// ============================================================================
|
|
49
|
-
|
|
50
|
-
// Layout components
|
|
51
|
-
export {
|
|
52
|
-
Header,
|
|
53
|
-
HeaderMobile,
|
|
54
|
-
HeaderDesktop,
|
|
55
|
-
CopyAIButton,
|
|
56
|
-
Sidebar,
|
|
57
|
-
SidebarContent,
|
|
58
|
-
SidebarCategory,
|
|
59
|
-
SidebarFooter,
|
|
60
|
-
MobileOverlay,
|
|
61
|
-
} from './components/layout';
|
|
62
|
-
|
|
63
|
-
export type {
|
|
64
|
-
HeaderProps,
|
|
65
|
-
SidebarProps,
|
|
66
|
-
MobileOverlayProps,
|
|
67
|
-
} from './components/layout';
|
|
68
|
-
|
|
69
|
-
// Shared components
|
|
70
|
-
export {
|
|
71
|
-
CountBadge,
|
|
72
|
-
CodeBlock,
|
|
73
|
-
CopyButton,
|
|
74
|
-
Section,
|
|
75
|
-
} from './components/shared';
|
|
76
|
-
|
|
77
|
-
// Content components
|
|
78
|
-
export {
|
|
79
|
-
AutoComponentDemo,
|
|
80
|
-
CategorySection,
|
|
81
|
-
CategoryRenderer,
|
|
82
|
-
TailwindGuideRenderer,
|
|
83
|
-
} from './components';
|
|
84
|
-
|
|
85
|
-
// ============================================================================
|
|
86
|
-
// CONFIGURATION
|
|
87
|
-
// ============================================================================
|
|
88
|
-
|
|
89
|
-
export {
|
|
90
|
-
// All components
|
|
91
|
-
COMPONENTS_CONFIG,
|
|
92
|
-
FORM_COMPONENTS,
|
|
93
|
-
LAYOUT_COMPONENTS,
|
|
94
|
-
NAVIGATION_COMPONENTS,
|
|
95
|
-
OVERLAY_COMPONENTS,
|
|
96
|
-
FEEDBACK_COMPONENTS,
|
|
97
|
-
DATA_COMPONENTS,
|
|
98
|
-
SPECIALIZED_COMPONENTS,
|
|
99
|
-
BLOCKS,
|
|
100
|
-
HOOKS,
|
|
101
|
-
// Utility functions
|
|
102
|
-
getComponentsByCategory,
|
|
103
|
-
getComponentByName,
|
|
104
|
-
getAllCategories,
|
|
105
|
-
getComponentCount,
|
|
106
|
-
// Categories
|
|
107
|
-
CATEGORIES,
|
|
108
|
-
getCategoryById,
|
|
109
|
-
getTotalComponentCount,
|
|
110
|
-
// Tailwind
|
|
111
|
-
TAILWIND_GUIDE,
|
|
112
|
-
// AI Export
|
|
113
|
-
UI_LIBRARY_CONFIG,
|
|
114
|
-
generateAIContext,
|
|
115
|
-
} from './config';
|
|
116
|
-
|
|
117
|
-
export type {
|
|
118
|
-
TailwindGuide,
|
|
119
|
-
UILibraryConfig,
|
|
120
|
-
} from './config';
|
|
121
|
-
|
|
122
|
-
// ============================================================================
|
|
123
|
-
// UTILITIES
|
|
124
|
-
// ============================================================================
|
|
125
|
-
|
|
126
|
-
export {
|
|
127
|
-
// AI Export utilities
|
|
128
|
-
formatComponentAsMarkdown,
|
|
129
|
-
formatComponentsAsMarkdownList,
|
|
130
|
-
formatImports,
|
|
131
|
-
formatCodeBlock,
|
|
132
|
-
formatSectionHeader,
|
|
133
|
-
formatList,
|
|
134
|
-
// Component helpers
|
|
135
|
-
searchComponents,
|
|
136
|
-
filterByCategory,
|
|
137
|
-
filterByTags,
|
|
138
|
-
getUniqueCategories,
|
|
139
|
-
getUniqueTags,
|
|
140
|
-
findComponentByName,
|
|
141
|
-
applyFilters,
|
|
142
|
-
sortComponents,
|
|
143
|
-
groupComponentsBy,
|
|
144
|
-
} from './utils';
|
|
145
|
-
|
|
146
|
-
export type {
|
|
147
|
-
FilterOptions,
|
|
148
|
-
} from './utils/component-helpers/filter';
|
|
149
|
-
|
|
150
|
-
// ============================================================================
|
|
151
|
-
// CONTEXT
|
|
152
|
-
// ============================================================================
|
|
153
|
-
|
|
154
|
-
export { ShowcaseProvider, useShowcase } from './context';
|
|
155
|
-
|
|
156
|
-
// ============================================================================
|
|
157
|
-
// CONSTANTS
|
|
158
|
-
// ============================================================================
|
|
159
|
-
|
|
160
|
-
export * from './constants';
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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';
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Navigation Types
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Navigation State
|
|
7
|
-
* Tracks navigation history and current position
|
|
8
|
-
*/
|
|
9
|
-
export interface NavigationState {
|
|
10
|
-
/** Current category ID */
|
|
11
|
-
currentCategory: string;
|
|
12
|
-
/** Navigation history */
|
|
13
|
-
history: string[];
|
|
14
|
-
/** Can navigate back */
|
|
15
|
-
canGoBack: boolean;
|
|
16
|
-
/** Can navigate forward */
|
|
17
|
-
canGoForward: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Sidebar State
|
|
22
|
-
* Tracks sidebar open/close state
|
|
23
|
-
*/
|
|
24
|
-
export interface SidebarState {
|
|
25
|
-
/** Is sidebar open (mobile) */
|
|
26
|
-
isOpen: boolean;
|
|
27
|
-
/** Toggle sidebar */
|
|
28
|
-
toggle: () => void;
|
|
29
|
-
/** Open sidebar */
|
|
30
|
-
open: () => void;
|
|
31
|
-
/** Close sidebar */
|
|
32
|
-
close: () => void;
|
|
33
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Export Formatters
|
|
3
|
-
* Formatting utilities for AI documentation
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ComponentConfig } from '../../types';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Format component as markdown
|
|
10
|
-
*/
|
|
11
|
-
export function formatComponentAsMarkdown(component: ComponentConfig): string {
|
|
12
|
-
return `
|
|
13
|
-
### ${component.name}
|
|
14
|
-
${component.description}
|
|
15
|
-
|
|
16
|
-
\`\`\`tsx
|
|
17
|
-
${component.importPath}
|
|
18
|
-
|
|
19
|
-
${component.example}
|
|
20
|
-
\`\`\`
|
|
21
|
-
`.trim();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Format multiple components as markdown list
|
|
26
|
-
*/
|
|
27
|
-
export function formatComponentsAsMarkdownList(
|
|
28
|
-
components: ComponentConfig[]
|
|
29
|
-
): string {
|
|
30
|
-
return components.map(formatComponentAsMarkdown).join('\n\n');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Format import statements
|
|
35
|
-
*/
|
|
36
|
-
export function formatImports(components: ComponentConfig[]): string {
|
|
37
|
-
const uniqueImports = new Set(components.map((c) => c.importPath));
|
|
38
|
-
return Array.from(uniqueImports).join('\n');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Format code block
|
|
43
|
-
*/
|
|
44
|
-
export function formatCodeBlock(code: string, language = 'tsx'): string {
|
|
45
|
-
return `\`\`\`${language}\n${code}\n\`\`\``;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Format section header
|
|
50
|
-
*/
|
|
51
|
-
export function formatSectionHeader(
|
|
52
|
-
title: string,
|
|
53
|
-
level: number = 2,
|
|
54
|
-
count?: number
|
|
55
|
-
): string {
|
|
56
|
-
const hashes = '#'.repeat(level);
|
|
57
|
-
const countStr = count !== undefined ? ` (${count})` : '';
|
|
58
|
-
return `${hashes} ${title}${countStr}`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Format list
|
|
63
|
-
*/
|
|
64
|
-
export function formatList(items: string[], ordered = false): string {
|
|
65
|
-
return items
|
|
66
|
-
.map((item, index) => {
|
|
67
|
-
const prefix = ordered ? `${index + 1}. ` : '- ';
|
|
68
|
-
return `${prefix}${item}`;
|
|
69
|
-
})
|
|
70
|
-
.join('\n');
|
|
71
|
-
}
|