@djangocfg/layouts 2.1.256 → 2.1.259

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 (36) hide show
  1. package/README.md +101 -203
  2. package/package.json +18 -18
  3. package/src/index.ts +4 -1
  4. package/src/layouts/AppLayout/AppLayout.tsx +97 -8
  5. package/src/layouts/AppLayout/BaseApp.tsx +2 -0
  6. package/src/layouts/AppLayout/index.ts +6 -0
  7. package/src/layouts/PrivateLayout/PrivateLayout.tsx +3 -1
  8. package/src/layouts/PrivateLayout/components/PrivateContent.tsx +15 -4
  9. package/src/layouts/PrivateLayout/components/PrivateSidebar.tsx +3 -3
  10. package/src/layouts/PublicLayout/PublicLayout.tsx +82 -17
  11. package/src/layouts/PublicLayout/components/PublicFooter/FooterProjectInfo.tsx +17 -24
  12. package/src/layouts/PublicLayout/components/PublicFooter/PublicFooter.tsx +79 -95
  13. package/src/layouts/PublicLayout/components/PublicFooter/index.ts +2 -0
  14. package/src/layouts/PublicLayout/components/PublicFooter/types.ts +41 -31
  15. package/src/layouts/PublicLayout/components/PublicMobileDrawer.tsx +84 -40
  16. package/src/layouts/PublicLayout/components/PublicNavbar.tsx +22 -35
  17. package/src/layouts/PublicLayout/components/PublicNavigation.tsx +184 -98
  18. package/src/layouts/PublicLayout/components/ThemeBrandMark.tsx +83 -0
  19. package/src/layouts/PublicLayout/components/index.ts +2 -0
  20. package/src/layouts/PublicLayout/context.tsx +5 -0
  21. package/src/layouts/PublicLayout/hooks/index.ts +1 -1
  22. package/src/layouts/PublicLayout/hooks/useMobileNavPanel.ts +55 -0
  23. package/src/layouts/PublicLayout/index.ts +8 -0
  24. package/src/layouts/PublicLayout/navbarTypes.ts +20 -0
  25. package/src/layouts/PublicLayout/publicShellShadow.ts +12 -0
  26. package/src/layouts/_components/PrivateSidebarAccount.tsx +16 -3
  27. package/src/layouts/_components/UserMenu.tsx +133 -30
  28. package/src/layouts/types/index.ts +10 -1
  29. package/src/layouts/types/providers.types.ts +10 -0
  30. package/src/layouts/types/ui.types.ts +9 -0
  31. package/src/theme/ThemeStyleBridge.tsx +41 -0
  32. package/src/theme/buildThemeStyleSheet.ts +71 -0
  33. package/src/theme/index.ts +16 -0
  34. package/src/theme/themeStyle.types.ts +89 -0
  35. package/src/theme/themeStylePresets.ts +202 -0
  36. package/src/layouts/PublicLayout/hooks/useFloatingPanel.ts +0 -61
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Curated presets for `BaseApp` `theme.style` — small deltas over `ui-core` globals.
3
+ * For full token matrices (shadows, type scale, …) use the playground Theme Configurator → export CSS.
4
+ */
5
+
6
+ import type { ThemeCssVarMap, ThemeStylePresetId } from './themeStyle.types';
7
+
8
+ /** Stable order for UI lists / docs (every `ThemeStylePresetId` appears once). */
9
+ export const THEME_STYLE_PRESET_ORDER = [
10
+ 'default',
11
+ 'django-cfg',
12
+ 'ios',
13
+ 'soft',
14
+ 'dense',
15
+ 'high-contrast',
16
+ ] as const satisfies readonly ThemeStylePresetId[];
17
+
18
+ export const THEME_STYLE_PRESETS: Record<
19
+ ThemeStylePresetId,
20
+ { light: ThemeCssVarMap; dark: ThemeCssVarMap }
21
+ > = {
22
+ /** No extra rules — same as globals only (`vars` may still apply). */
23
+ default: {
24
+ light: {},
25
+ dark: {},
26
+ },
27
+
28
+ /**
29
+ * DjangoCFG brand: deeper cyan primary on light, bright cyan + dark label on dark
30
+ * (aligned with current `ui-core` theme files when globals are loaded).
31
+ */
32
+ 'django-cfg': {
33
+ light: {
34
+ primary: '192 90% 35%',
35
+ 'primary-foreground': '0 0% 100%',
36
+ ring: '192 90% 35%',
37
+ 'sidebar-primary': '192 90% 35%',
38
+ 'sidebar-ring': '192 90% 35%',
39
+ 'chart-1': '192 90% 35%',
40
+ },
41
+ dark: {
42
+ primary: '189 100% 50%',
43
+ 'primary-foreground': '0 0% 9%',
44
+ ring: '189 100% 50%',
45
+ 'sidebar-primary': '189 100% 50%',
46
+ 'sidebar-primary-foreground': '0 0% 9%',
47
+ 'sidebar-ring': '189 100% 50%',
48
+ 'chart-1': '189 100% 50%',
49
+ },
50
+ },
51
+
52
+ /**
53
+ * Apple-style system UI: #007AFF primary, very light chrome, ~12pt corners, hairline separators.
54
+ * (Inspired by `apps/playground` `macos` preset, mapped to semantic `--*` vars only.)
55
+ */
56
+ ios: {
57
+ light: {
58
+ background: '0 0% 98%',
59
+ foreground: '220 9% 12%',
60
+ card: '0 0% 100%',
61
+ 'card-foreground': '220 9% 12%',
62
+ popover: '0 0% 100%',
63
+ 'popover-foreground': '220 9% 12%',
64
+ primary: '211 100% 50%',
65
+ 'primary-foreground': '0 0% 100%',
66
+ secondary: '220 9% 92%',
67
+ 'secondary-foreground': '220 9% 12%',
68
+ muted: '220 9% 94%',
69
+ 'muted-foreground': '220 9% 40%',
70
+ accent: '220 9% 94%',
71
+ 'accent-foreground': '220 9% 12%',
72
+ destructive: '0 100% 58%',
73
+ 'destructive-foreground': '0 0% 100%',
74
+ border: '220 9% 88%',
75
+ input: '220 9% 88%',
76
+ ring: '211 100% 50%',
77
+ radius: '0.75rem',
78
+ 'sidebar-background': '0 0% 99%',
79
+ 'sidebar-foreground': '220 9% 12%',
80
+ 'sidebar-primary': '211 100% 50%',
81
+ 'sidebar-primary-foreground': '0 0% 100%',
82
+ 'sidebar-accent': '220 9% 94%',
83
+ 'sidebar-accent-foreground': '220 9% 12%',
84
+ 'sidebar-border': '220 9% 88%',
85
+ 'sidebar-ring': '211 100% 50%',
86
+ 'chart-1': '211 100% 50%',
87
+ 'chart-2': '145 63% 42%',
88
+ 'chart-3': '262 83% 58%',
89
+ 'chart-4': '35 100% 50%',
90
+ 'chart-5': '346 77% 50%',
91
+ },
92
+ dark: {
93
+ background: '240 6% 10%',
94
+ foreground: '0 0% 96%',
95
+ card: '240 6% 14%',
96
+ 'card-foreground': '0 0% 96%',
97
+ popover: '240 6% 16%',
98
+ 'popover-foreground': '0 0% 96%',
99
+ primary: '211 100% 55%',
100
+ 'primary-foreground': '0 0% 100%',
101
+ secondary: '240 5% 26%',
102
+ 'secondary-foreground': '0 0% 96%',
103
+ muted: '240 5% 16%',
104
+ 'muted-foreground': '240 5% 64%',
105
+ accent: '240 5% 18%',
106
+ 'accent-foreground': '0 0% 96%',
107
+ destructive: '0 100% 67%',
108
+ 'destructive-foreground': '0 0% 100%',
109
+ border: '240 5% 22%',
110
+ input: '240 5% 22%',
111
+ ring: '211 100% 55%',
112
+ radius: '0.75rem',
113
+ 'sidebar-background': '240 6% 8%',
114
+ 'sidebar-foreground': '0 0% 96%',
115
+ 'sidebar-primary': '211 100% 55%',
116
+ 'sidebar-primary-foreground': '0 0% 100%',
117
+ 'sidebar-accent': '240 5% 16%',
118
+ 'sidebar-accent-foreground': '0 0% 96%',
119
+ 'sidebar-border': '240 5% 22%',
120
+ 'sidebar-ring': '211 100% 55%',
121
+ 'chart-1': '211 100% 55%',
122
+ 'chart-2': '145 65% 52%',
123
+ 'chart-3': '262 83% 65%',
124
+ 'chart-4': '35 100% 58%',
125
+ 'chart-5': '346 77% 58%',
126
+ },
127
+ },
128
+
129
+ /** Soft, friendly surfaces: larger radius, low-contrast borders (product / marketing). */
130
+ soft: {
131
+ light: {
132
+ background: '0 0% 98%',
133
+ foreground: '240 6% 10%',
134
+ card: '0 0% 100%',
135
+ 'card-foreground': '240 6% 10%',
136
+ muted: '240 5% 96%',
137
+ 'muted-foreground': '240 4% 46%',
138
+ accent: '240 5% 94%',
139
+ 'accent-foreground': '240 6% 10%',
140
+ border: '240 5% 91%',
141
+ input: '240 5% 91%',
142
+ radius: '1rem',
143
+ 'sidebar-accent': '240 5% 94%',
144
+ 'sidebar-border': '240 5% 91%',
145
+ },
146
+ dark: {
147
+ background: '240 6% 8%',
148
+ foreground: '0 0% 96%',
149
+ card: '240 5% 12%',
150
+ 'card-foreground': '0 0% 96%',
151
+ muted: '240 4% 16%',
152
+ 'muted-foreground': '240 5% 64%',
153
+ accent: '240 5% 16%',
154
+ 'accent-foreground': '0 0% 96%',
155
+ border: '240 5% 20%',
156
+ input: '240 5% 20%',
157
+ radius: '1rem',
158
+ 'sidebar-background': '240 6% 6%',
159
+ 'sidebar-accent': '240 5% 14%',
160
+ 'sidebar-border': '240 5% 20%',
161
+ },
162
+ },
163
+
164
+ /** Compact controls: small radius, stronger borders (tables, admin, IDE-like). */
165
+ dense: {
166
+ light: {
167
+ radius: '0.25rem',
168
+ border: '0 0% 82%',
169
+ input: '0 0% 82%',
170
+ muted: '0 0% 94%',
171
+ card: '0 0% 100%',
172
+ accent: '0 0% 93%',
173
+ },
174
+ dark: {
175
+ radius: '0.25rem',
176
+ border: '0 0% 24%',
177
+ input: '0 0% 24%',
178
+ muted: '0 0% 12%',
179
+ card: '0 0% 10%',
180
+ accent: '0 0% 14%',
181
+ },
182
+ },
183
+
184
+ /** Stronger borders and text for glare / accessibility. */
185
+ 'high-contrast': {
186
+ light: {
187
+ border: '0 0% 72%',
188
+ input: '0 0% 72%',
189
+ 'muted-foreground': '0 0% 32%',
190
+ foreground: '0 0% 6%',
191
+ ring: '0 0% 20%',
192
+ },
193
+ dark: {
194
+ border: '0 0% 38%',
195
+ input: '0 0% 38%',
196
+ 'muted-foreground': '0 0% 78%',
197
+ foreground: '0 0% 100%',
198
+ background: '0 0% 6%',
199
+ ring: '0 0% 85%',
200
+ },
201
+ },
202
+ };
@@ -1,61 +0,0 @@
1
- 'use client';
2
-
3
- import { useEffect, useRef, useState } from 'react';
4
-
5
- interface UseFloatingPanelOptions {
6
- isOpen: boolean;
7
- onClose: () => void;
8
- }
9
-
10
- export function useFloatingPanel({
11
- isOpen,
12
- onClose,
13
- }: UseFloatingPanelOptions) {
14
- const [isRendered, setIsRendered] = useState(isOpen);
15
- const [isActive, setIsActive] = useState(isOpen);
16
- const rafRef = useRef<number | null>(null);
17
-
18
- useEffect(() => {
19
- if (isOpen) {
20
- setIsRendered(true);
21
- if (rafRef.current) window.cancelAnimationFrame(rafRef.current);
22
- rafRef.current = window.requestAnimationFrame(() => {
23
- setIsActive(true);
24
- });
25
- return;
26
- }
27
-
28
- if (!isRendered) return;
29
- setIsActive(false);
30
- }, [isOpen, isRendered]);
31
-
32
- useEffect(() => {
33
- return () => {
34
- if (rafRef.current) window.cancelAnimationFrame(rafRef.current);
35
- };
36
- }, []);
37
-
38
- useEffect(() => {
39
- if (!isOpen) return;
40
- const onKeyDown = (event: KeyboardEvent) => {
41
- if (event.key === 'Escape') onClose();
42
- };
43
- window.addEventListener('keydown', onKeyDown);
44
- return () => window.removeEventListener('keydown', onKeyDown);
45
- }, [isOpen, onClose]);
46
-
47
- const onTransitionEnd = (event: React.TransitionEvent<HTMLElement>) => {
48
- if (event.target !== event.currentTarget) return;
49
- if (event.propertyName !== 'transform') return;
50
- if (!isOpen && !isActive) {
51
- setIsRendered(false);
52
- }
53
- };
54
-
55
- return {
56
- isRendered,
57
- isActive,
58
- onTransitionEnd,
59
- };
60
- }
61
-