@djangocfg/layouts 1.0.6 → 1.2.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.
Files changed (51) hide show
  1. package/package.json +5 -5
  2. package/src/layouts/AppLayout/AppLayout.tsx +132 -28
  3. package/src/layouts/AppLayout/components/ErrorBoundary.tsx +99 -0
  4. package/src/layouts/AppLayout/components/PageProgress.tsx +28 -11
  5. package/src/layouts/AppLayout/components/index.ts +1 -0
  6. package/src/layouts/AppLayout/layouts/AuthLayout/AuthContext.tsx +1 -1
  7. package/src/layouts/AppLayout/layouts/AuthLayout/AuthHelp.tsx +5 -5
  8. package/src/layouts/AppLayout/layouts/AuthLayout/AuthLayout.tsx +2 -2
  9. package/src/layouts/AppLayout/layouts/AuthLayout/IdentifierForm.tsx +2 -2
  10. package/src/layouts/AppLayout/layouts/PrivateLayout/components/DashboardHeader.tsx +1 -1
  11. package/src/layouts/AppLayout/layouts/PublicLayout/components/Footer.tsx +1 -1
  12. package/src/layouts/AppLayout/layouts/PublicLayout/components/MobileMenu.tsx +53 -36
  13. package/src/layouts/AppLayout/layouts/PublicLayout/components/Navigation.tsx +64 -52
  14. package/src/layouts/AppLayout/types/config.ts +22 -0
  15. package/src/layouts/ErrorLayout/ErrorLayout.tsx +169 -0
  16. package/src/layouts/ErrorLayout/errorConfig.tsx +152 -0
  17. package/src/layouts/ErrorLayout/index.ts +8 -0
  18. package/src/layouts/UILayout/README.md +267 -0
  19. package/src/layouts/UILayout/REFACTORING.md +331 -0
  20. package/src/layouts/UILayout/UIGuideApp.tsx +18 -0
  21. package/src/layouts/UILayout/UIGuideLanding.tsx +198 -0
  22. package/src/layouts/UILayout/UIGuideView.tsx +61 -0
  23. package/src/layouts/UILayout/UILayout.tsx +122 -0
  24. package/src/layouts/UILayout/components/AutoComponentDemo.tsx +77 -0
  25. package/src/layouts/UILayout/components/CategoryRenderer.tsx +45 -0
  26. package/src/layouts/UILayout/components/Header.tsx +114 -0
  27. package/src/layouts/UILayout/components/MobileOverlay.tsx +33 -0
  28. package/src/layouts/UILayout/components/Sidebar.tsx +195 -0
  29. package/src/layouts/UILayout/components/TailwindGuideRenderer.tsx +138 -0
  30. package/src/layouts/UILayout/config/ai-export.config.ts +80 -0
  31. package/src/layouts/UILayout/config/categories.config.tsx +114 -0
  32. package/src/layouts/UILayout/config/components/blocks.config.tsx +233 -0
  33. package/src/layouts/UILayout/config/components/data.config.tsx +308 -0
  34. package/src/layouts/UILayout/config/components/feedback.config.tsx +246 -0
  35. package/src/layouts/UILayout/config/components/forms.config.tsx +171 -0
  36. package/src/layouts/UILayout/config/components/hooks.config.tsx +131 -0
  37. package/src/layouts/UILayout/config/components/index.ts +69 -0
  38. package/src/layouts/UILayout/config/components/layout.config.tsx +133 -0
  39. package/src/layouts/UILayout/config/components/navigation.config.tsx +244 -0
  40. package/src/layouts/UILayout/config/components/overlay.config.tsx +561 -0
  41. package/src/layouts/UILayout/config/components/specialized.config.tsx +125 -0
  42. package/src/layouts/UILayout/config/components/types.ts +14 -0
  43. package/src/layouts/UILayout/config/index.ts +42 -0
  44. package/src/layouts/UILayout/config/tailwind.config.ts +77 -0
  45. package/src/layouts/UILayout/constants.ts +23 -0
  46. package/src/layouts/UILayout/context/ShowcaseContext.tsx +53 -0
  47. package/src/layouts/UILayout/context/index.ts +1 -0
  48. package/src/layouts/UILayout/index.ts +64 -0
  49. package/src/layouts/UILayout/types.ts +13 -0
  50. package/src/layouts/index.ts +5 -1
  51. package/src/snippets/Chat/types.ts +3 -4
@@ -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';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * UILayout Types
3
+ */
4
+
5
+ import { ReactNode } from 'react';
6
+
7
+ export interface ComponentCategory {
8
+ id: string;
9
+ label: string;
10
+ icon: ReactNode;
11
+ count?: number;
12
+ description?: string;
13
+ }
@@ -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';
@@ -3,13 +3,13 @@
3
3
  * Type definitions for RAG-powered chat widget
4
4
  */
5
5
 
6
- import type { ChatMessage as BaseChatMessage, ChatSource } from '@djangocfg/api/cfg/contexts';
6
+ import type { ChatMessage, ChatSource } from '@djangocfg/api/cfg/contexts';
7
7
 
8
8
  // ─────────────────────────────────────────────────────────────────────────
9
9
  // Extended Message Type (for UI with sources)
10
10
  // ─────────────────────────────────────────────────────────────────────────
11
11
 
12
- export interface ChatMessageWithSources extends BaseChatMessage {
12
+ export interface ChatMessageWithSources extends ChatMessage {
13
13
  sources?: ChatSource[];
14
14
  }
15
15
 
@@ -74,6 +74,5 @@ export interface SessionListProps {
74
74
  // Re-export types from API
75
75
  // ─────────────────────────────────────────────────────────────────────────
76
76
 
77
- export type { ChatSource } from '@djangocfg/api/cfg/contexts';
78
- export type { ChatMessage as BaseChatMessage } from '@djangocfg/api/cfg/contexts';
77
+ export type { ChatSource, ChatMessage } from '@djangocfg/api/cfg/contexts';
79
78