@djangocfg/layouts 1.0.6 → 1.1.0
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/AppLayout.tsx +126 -28
- package/src/layouts/AppLayout/components/ErrorBoundary.tsx +99 -0
- package/src/layouts/AppLayout/components/PageProgress.tsx +28 -11
- package/src/layouts/AppLayout/components/index.ts +1 -0
- package/src/layouts/AppLayout/layouts/AuthLayout/AuthContext.tsx +1 -1
- package/src/layouts/AppLayout/layouts/AuthLayout/AuthHelp.tsx +5 -5
- package/src/layouts/AppLayout/layouts/AuthLayout/AuthLayout.tsx +2 -2
- package/src/layouts/AppLayout/layouts/AuthLayout/IdentifierForm.tsx +2 -2
- package/src/layouts/AppLayout/layouts/PrivateLayout/components/DashboardHeader.tsx +1 -1
- package/src/layouts/AppLayout/layouts/PublicLayout/components/Footer.tsx +1 -1
- package/src/layouts/AppLayout/layouts/PublicLayout/components/MobileMenu.tsx +53 -36
- package/src/layouts/AppLayout/layouts/PublicLayout/components/Navigation.tsx +64 -52
- package/src/layouts/AppLayout/types/config.ts +22 -0
- package/src/layouts/ErrorLayout/ErrorLayout.tsx +169 -0
- package/src/layouts/ErrorLayout/errorConfig.tsx +152 -0
- package/src/layouts/ErrorLayout/index.ts +8 -0
- package/src/layouts/UILayout/README.md +267 -0
- package/src/layouts/UILayout/REFACTORING.md +331 -0
- package/src/layouts/UILayout/UIGuideApp.tsx +18 -0
- package/src/layouts/UILayout/UIGuideLanding.tsx +198 -0
- package/src/layouts/UILayout/UIGuideView.tsx +61 -0
- package/src/layouts/UILayout/UILayout.tsx +122 -0
- package/src/layouts/UILayout/components/AutoComponentDemo.tsx +77 -0
- package/src/layouts/UILayout/components/CategoryRenderer.tsx +45 -0
- package/src/layouts/UILayout/components/Header.tsx +114 -0
- package/src/layouts/UILayout/components/MobileOverlay.tsx +33 -0
- package/src/layouts/UILayout/components/Sidebar.tsx +195 -0
- package/src/layouts/UILayout/components/TailwindGuideRenderer.tsx +138 -0
- package/src/layouts/UILayout/config/ai-export.config.ts +80 -0
- package/src/layouts/UILayout/config/categories.config.tsx +114 -0
- package/src/layouts/UILayout/config/components/blocks.config.tsx +233 -0
- package/src/layouts/UILayout/config/components/data.config.tsx +308 -0
- package/src/layouts/UILayout/config/components/feedback.config.tsx +246 -0
- package/src/layouts/UILayout/config/components/forms.config.tsx +171 -0
- package/src/layouts/UILayout/config/components/hooks.config.tsx +131 -0
- package/src/layouts/UILayout/config/components/index.ts +69 -0
- package/src/layouts/UILayout/config/components/layout.config.tsx +133 -0
- package/src/layouts/UILayout/config/components/navigation.config.tsx +244 -0
- package/src/layouts/UILayout/config/components/overlay.config.tsx +561 -0
- package/src/layouts/UILayout/config/components/specialized.config.tsx +125 -0
- package/src/layouts/UILayout/config/components/types.ts +14 -0
- package/src/layouts/UILayout/config/index.ts +42 -0
- package/src/layouts/UILayout/config/tailwind.config.ts +77 -0
- package/src/layouts/UILayout/constants.ts +23 -0
- package/src/layouts/UILayout/context/ShowcaseContext.tsx +53 -0
- package/src/layouts/UILayout/context/index.ts +1 -0
- package/src/layouts/UILayout/index.ts +64 -0
- package/src/layouts/UILayout/types.ts +13 -0
- package/src/layouts/index.ts +5 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Module Exports
|
|
3
|
+
* Single source of truth for all UI documentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Components configuration
|
|
7
|
+
export {
|
|
8
|
+
COMPONENTS_CONFIG,
|
|
9
|
+
FORM_COMPONENTS,
|
|
10
|
+
LAYOUT_COMPONENTS,
|
|
11
|
+
NAVIGATION_COMPONENTS,
|
|
12
|
+
OVERLAY_COMPONENTS,
|
|
13
|
+
FEEDBACK_COMPONENTS,
|
|
14
|
+
DATA_COMPONENTS,
|
|
15
|
+
SPECIALIZED_COMPONENTS,
|
|
16
|
+
BLOCKS,
|
|
17
|
+
HOOKS,
|
|
18
|
+
getComponentsByCategory,
|
|
19
|
+
getComponentByName,
|
|
20
|
+
getAllCategories,
|
|
21
|
+
getComponentCount,
|
|
22
|
+
} from './components';
|
|
23
|
+
export type { ComponentConfig } from './components';
|
|
24
|
+
|
|
25
|
+
// Categories configuration
|
|
26
|
+
export {
|
|
27
|
+
CATEGORIES,
|
|
28
|
+
getCategoryById,
|
|
29
|
+
getTotalComponentCount,
|
|
30
|
+
} from './categories.config';
|
|
31
|
+
export type { ComponentCategory } from './categories.config';
|
|
32
|
+
|
|
33
|
+
// Tailwind configuration
|
|
34
|
+
export { TAILWIND_GUIDE } from './tailwind.config';
|
|
35
|
+
export type { TailwindGuide } from './tailwind.config';
|
|
36
|
+
|
|
37
|
+
// AI Export configuration
|
|
38
|
+
export {
|
|
39
|
+
UI_LIBRARY_CONFIG,
|
|
40
|
+
generateAIContext,
|
|
41
|
+
} from './ai-export.config';
|
|
42
|
+
export type { UILibraryConfig } from './ai-export.config';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tailwind CSS v4 Configuration & Guidelines
|
|
3
|
+
* Documentation for Tailwind CSS v4 best practices
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface TailwindGuide {
|
|
7
|
+
version: string;
|
|
8
|
+
keyChanges: string[];
|
|
9
|
+
bestPractices: string[];
|
|
10
|
+
migrationSteps: string[];
|
|
11
|
+
examples: {
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
code: string;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const TAILWIND_GUIDE: TailwindGuide = {
|
|
19
|
+
version: "4.0",
|
|
20
|
+
|
|
21
|
+
keyChanges: [
|
|
22
|
+
"CSS-First Configuration: Theme is now defined using CSS custom properties in an @theme block instead of JavaScript",
|
|
23
|
+
"New Import Syntax: Use @import \"tailwindcss\" instead of @tailwind directives",
|
|
24
|
+
"Simplified PostCSS Setup: Use @tailwindcss/postcss plugin",
|
|
25
|
+
"Performance Improvements: 10x faster build times, significantly smaller CSS bundles",
|
|
26
|
+
"Modern Browser Support: Optimized for Safari 16.4+, Chrome 111+, Firefox 128+"
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
bestPractices: [
|
|
30
|
+
"Use standard Tailwind classes only: py-16 sm:py-20 md:py-24 lg:py-32",
|
|
31
|
+
"Responsive patterns: px-4 sm:px-6 lg:px-8",
|
|
32
|
+
"Container pattern: container max-w-7xl mx-auto",
|
|
33
|
+
"Avoid custom utilities like: section-padding, animate-*, shadow-brand",
|
|
34
|
+
"Mobile-first approach with breakpoints: sm: (640px), md: (768px), lg: (1024px), xl: (1280px)",
|
|
35
|
+
"Use CSS variables: var(--color-primary), var(--font-family-sans)"
|
|
36
|
+
],
|
|
37
|
+
|
|
38
|
+
migrationSteps: [
|
|
39
|
+
"Update dependencies: npm install tailwindcss@latest postcss@latest",
|
|
40
|
+
"Replace JavaScript config with CSS @theme block",
|
|
41
|
+
"Update import directives: @import \"tailwindcss\"",
|
|
42
|
+
"Configure PostCSS: use @tailwindcss/postcss plugin",
|
|
43
|
+
"Test and refactor: remove custom utilities and use standard Tailwind classes"
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
examples: [
|
|
47
|
+
{
|
|
48
|
+
title: "CSS-First Configuration",
|
|
49
|
+
description: "Define theme using CSS custom properties",
|
|
50
|
+
code: `@import "tailwindcss";
|
|
51
|
+
|
|
52
|
+
@theme {
|
|
53
|
+
--color-primary: #3b82f6;
|
|
54
|
+
--color-secondary: #8b5cf6;
|
|
55
|
+
--font-family-sans: ui-sans-serif, system-ui, sans-serif;
|
|
56
|
+
}`
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: "Responsive Spacing",
|
|
60
|
+
description: "Mobile-first responsive padding and spacing",
|
|
61
|
+
code: `<section className="py-16 sm:py-20 md:py-24 lg:py-32">
|
|
62
|
+
<div className="container max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
63
|
+
<h1 className="text-4xl sm:text-5xl md:text-6xl lg:text-7xl">
|
|
64
|
+
Title
|
|
65
|
+
</h1>
|
|
66
|
+
</div>
|
|
67
|
+
</section>`
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "Component Styling",
|
|
71
|
+
description: "Standard Tailwind classes for components",
|
|
72
|
+
code: `<button className="px-6 py-3 bg-primary text-primary-foreground rounded-md shadow-lg hover:shadow-xl transition-all duration-300">
|
|
73
|
+
Click me
|
|
74
|
+
</button>`
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for UILayout
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export const MOBILE_BREAKPOINT = 768; // px
|
|
6
|
+
export const SIDEBAR_WIDTH = 256; // px (w-64)
|
|
7
|
+
export const HEADER_HEIGHT = 56; // px (h-14)
|
|
8
|
+
|
|
9
|
+
export const ANIMATION_DURATION = {
|
|
10
|
+
fast: 150,
|
|
11
|
+
normal: 300,
|
|
12
|
+
slow: 500,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export const Z_INDEX = {
|
|
16
|
+
sidebar: 30,
|
|
17
|
+
overlay: 20,
|
|
18
|
+
header: 40,
|
|
19
|
+
dropdown: 50,
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export const DEFAULT_PROJECT_NAME = 'Django CFG UI';
|
|
23
|
+
export const DEFAULT_DESCRIPTION = 'Explore our comprehensive collection of 56+ React components built with Radix UI and Tailwind CSS';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showcase Context
|
|
3
|
+
* Manages navigation state for ComponentShowcaseLayout
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import React, { createContext, useContext, useState, ReactNode } from 'react';
|
|
9
|
+
|
|
10
|
+
interface ShowcaseContextValue {
|
|
11
|
+
currentCategory: string;
|
|
12
|
+
setCurrentCategory: (category: string) => void;
|
|
13
|
+
isSidebarOpen: boolean;
|
|
14
|
+
toggleSidebar: () => void;
|
|
15
|
+
closeSidebar: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ShowcaseContext = createContext<ShowcaseContextValue | undefined>(undefined);
|
|
19
|
+
|
|
20
|
+
interface ShowcaseProviderProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
defaultCategory?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function ShowcaseProvider({ children, defaultCategory = 'overview' }: ShowcaseProviderProps) {
|
|
26
|
+
const [currentCategory, setCurrentCategory] = useState(defaultCategory);
|
|
27
|
+
const [isSidebarOpen, setIsSidebarOpen] = useState(false);
|
|
28
|
+
|
|
29
|
+
const toggleSidebar = () => setIsSidebarOpen(prev => !prev);
|
|
30
|
+
const closeSidebar = () => setIsSidebarOpen(false);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<ShowcaseContext.Provider
|
|
34
|
+
value={{
|
|
35
|
+
currentCategory,
|
|
36
|
+
setCurrentCategory,
|
|
37
|
+
isSidebarOpen,
|
|
38
|
+
toggleSidebar,
|
|
39
|
+
closeSidebar,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</ShowcaseContext.Provider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function useShowcase() {
|
|
48
|
+
const context = useContext(ShowcaseContext);
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error('useShowcase must be used within ShowcaseProvider');
|
|
51
|
+
}
|
|
52
|
+
return context;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShowcaseProvider, useShowcase } from './ShowcaseContext';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UILayout Module Exports
|
|
3
|
+
* Config-driven UI documentation layout
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Main Layout Component
|
|
7
|
+
export { UILayout, ComponentShowcaseLayout } from './UILayout';
|
|
8
|
+
export type { UILayoutProps, ComponentShowcaseLayoutProps } from './UILayout';
|
|
9
|
+
|
|
10
|
+
// Context for navigation management
|
|
11
|
+
export { ShowcaseProvider, useShowcase } from './context';
|
|
12
|
+
|
|
13
|
+
// UI Guide View (specific implementation for Django CFG UI)
|
|
14
|
+
export { default as UIGuideView } from './UIGuideView';
|
|
15
|
+
export { UIGuideLanding } from './UIGuideLanding';
|
|
16
|
+
export { UIGuideApp } from './UIGuideApp';
|
|
17
|
+
|
|
18
|
+
// Components
|
|
19
|
+
export { AutoComponentDemo, CategorySection } from './components/AutoComponentDemo';
|
|
20
|
+
export { CategoryRenderer } from './components/CategoryRenderer';
|
|
21
|
+
export { TailwindGuideRenderer } from './components/TailwindGuideRenderer';
|
|
22
|
+
export { Sidebar } from './components/Sidebar';
|
|
23
|
+
export { Header } from './components/Header';
|
|
24
|
+
export { MobileOverlay } from './components/MobileOverlay';
|
|
25
|
+
|
|
26
|
+
// Configuration (Single Source of Truth)
|
|
27
|
+
export {
|
|
28
|
+
// All components
|
|
29
|
+
COMPONENTS_CONFIG,
|
|
30
|
+
FORM_COMPONENTS,
|
|
31
|
+
LAYOUT_COMPONENTS,
|
|
32
|
+
NAVIGATION_COMPONENTS,
|
|
33
|
+
OVERLAY_COMPONENTS,
|
|
34
|
+
FEEDBACK_COMPONENTS,
|
|
35
|
+
DATA_COMPONENTS,
|
|
36
|
+
SPECIALIZED_COMPONENTS,
|
|
37
|
+
BLOCKS,
|
|
38
|
+
HOOKS,
|
|
39
|
+
// Utility functions
|
|
40
|
+
getComponentsByCategory,
|
|
41
|
+
getComponentByName,
|
|
42
|
+
getAllCategories,
|
|
43
|
+
getComponentCount,
|
|
44
|
+
// Categories
|
|
45
|
+
CATEGORIES,
|
|
46
|
+
getCategoryById,
|
|
47
|
+
getTotalComponentCount,
|
|
48
|
+
// Tailwind
|
|
49
|
+
TAILWIND_GUIDE,
|
|
50
|
+
// AI Export
|
|
51
|
+
UI_LIBRARY_CONFIG,
|
|
52
|
+
generateAIContext,
|
|
53
|
+
} from './config';
|
|
54
|
+
|
|
55
|
+
// Types
|
|
56
|
+
export type {
|
|
57
|
+
ComponentConfig,
|
|
58
|
+
ComponentCategory,
|
|
59
|
+
TailwindGuide,
|
|
60
|
+
UILibraryConfig,
|
|
61
|
+
} from './config';
|
|
62
|
+
|
|
63
|
+
// Constants
|
|
64
|
+
export * from './constants';
|
package/src/layouts/index.ts
CHANGED
|
@@ -6,4 +6,8 @@
|
|
|
6
6
|
export * from './ProfileLayout';
|
|
7
7
|
export * from './SupportLayout';
|
|
8
8
|
export * from './PaymentsLayout';
|
|
9
|
-
export * from './AppLayout';
|
|
9
|
+
export * from './AppLayout';
|
|
10
|
+
export * from './ErrorLayout';
|
|
11
|
+
|
|
12
|
+
// UILayout - Config-driven UI documentation layout
|
|
13
|
+
export * from './UILayout';
|