@orion-studios/payload-admin-components 0.1.0 → 0.2.0-beta.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/dist/admin.css +68 -57
- package/dist/index.d.mts +119 -1
- package/dist/index.d.ts +119 -1
- package/dist/index.js +1233 -76
- package/dist/index.mjs +1220 -75
- package/dist/styles/admin.css +85 -0
- package/dist/styles/overrides.css +375 -0
- package/dist/styles/themes/brand-dark.css +69 -0
- package/dist/styles/themes/brand-light.css +69 -0
- package/dist/styles/themes/dark.css +68 -0
- package/dist/styles/themes/light.css +68 -0
- package/package.json +3 -3
- package/src/components/BlockPicker.tsx +167 -0
- package/src/components/Dashboard.tsx +415 -0
- package/src/components/EmptyState.tsx +86 -0
- package/src/components/HelpTooltip.tsx +121 -0
- package/src/components/Icon.tsx +16 -0
- package/src/components/Logo.tsx +52 -0
- package/src/components/SectionTabs.tsx +84 -0
- package/src/components/StatusBadge.tsx +49 -0
- package/src/components/ThemeSwitcher.tsx +120 -0
- package/src/components/WelcomeHeader.tsx +54 -0
- package/src/fields/themePreference.ts +22 -0
- package/src/helpers/configureAdmin.ts +122 -0
- package/src/helpers/withTooltips.ts +91 -0
- package/src/hooks/useTheme.ts +128 -0
- package/src/index.ts +27 -0
- package/src/styles/admin.css +68 -57
- package/src/styles/overrides.css +375 -0
- package/src/styles/themes/brand-dark.css +69 -0
- package/src/styles/themes/brand-light.css +69 -0
- package/src/styles/themes/dark.css +68 -0
- package/src/styles/themes/light.css +68 -0
package/dist/admin.css
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Override Payload's default CSS variables to match your brand
|
|
2
|
+
* Orion Studios Admin Theme System
|
|
5
3
|
*
|
|
4
|
+
* Import all theme files and overrides.
|
|
6
5
|
* Usage in payload.config.ts:
|
|
7
6
|
* export default buildConfig({
|
|
8
7
|
* admin: {
|
|
@@ -11,64 +10,76 @@
|
|
|
11
10
|
* })
|
|
12
11
|
*/
|
|
13
12
|
|
|
13
|
+
/* Default brand colors (overridden by configureAdmin) */
|
|
14
14
|
:root {
|
|
15
|
-
/* Brand colors - customize these */
|
|
16
15
|
--brand-primary: #3b82f6;
|
|
17
|
-
--brand-
|
|
18
|
-
--brand-primary-light: #60a5fa;
|
|
19
|
-
|
|
20
|
-
/* Override Payload theme colors */
|
|
21
|
-
--theme-bg: #ffffff;
|
|
22
|
-
--theme-elevation-50: #f9fafb;
|
|
23
|
-
--theme-elevation-100: #f3f4f6;
|
|
24
|
-
--theme-elevation-150: #e5e7eb;
|
|
25
|
-
--theme-elevation-200: #d1d5db;
|
|
26
|
-
--theme-elevation-300: #9ca3af;
|
|
27
|
-
--theme-elevation-400: #6b7280;
|
|
28
|
-
--theme-elevation-500: #4b5563;
|
|
29
|
-
--theme-elevation-600: #374151;
|
|
30
|
-
--theme-elevation-700: #1f2937;
|
|
31
|
-
--theme-elevation-800: #111827;
|
|
32
|
-
--theme-elevation-900: #030712;
|
|
33
|
-
|
|
34
|
-
/* Text colors */
|
|
35
|
-
--theme-text: #111827;
|
|
36
|
-
--theme-text-muted: #6b7280;
|
|
37
|
-
|
|
38
|
-
/* Success/warning/error colors */
|
|
39
|
-
--theme-success-50: #f0fdf4;
|
|
40
|
-
--theme-success-500: #22c55e;
|
|
41
|
-
--theme-success-600: #16a34a;
|
|
42
|
-
|
|
43
|
-
--theme-warning-50: #fffbeb;
|
|
44
|
-
--theme-warning-500: #f59e0b;
|
|
45
|
-
--theme-warning-600: #d97706;
|
|
46
|
-
|
|
47
|
-
--theme-error-50: #fef2f2;
|
|
48
|
-
--theme-error-500: #ef4444;
|
|
49
|
-
--theme-error-600: #dc2626;
|
|
50
|
-
|
|
51
|
-
/* Use brand color for primary actions */
|
|
52
|
-
--theme-input-border-color: var(--brand-primary);
|
|
16
|
+
--brand-secondary: #8b5cf6;
|
|
53
17
|
}
|
|
54
18
|
|
|
55
|
-
/*
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
19
|
+
/* Theme files */
|
|
20
|
+
@import './themes/light.css';
|
|
21
|
+
@import './themes/dark.css';
|
|
22
|
+
@import './themes/brand-light.css';
|
|
23
|
+
@import './themes/brand-dark.css';
|
|
60
24
|
|
|
61
|
-
|
|
62
|
-
.
|
|
63
|
-
background-color: var(--brand-primary-dark) !important;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* Customize the sidebar */
|
|
67
|
-
.nav {
|
|
68
|
-
background-color: var(--theme-elevation-50);
|
|
69
|
-
}
|
|
25
|
+
/* Payload UI overrides */
|
|
26
|
+
@import './overrides.css';
|
|
70
27
|
|
|
71
|
-
/*
|
|
72
|
-
|
|
73
|
-
|
|
28
|
+
/* Default to light theme when no data-theme attribute is set */
|
|
29
|
+
:root:not([data-theme]) {
|
|
30
|
+
--admin-bg: #ffffff;
|
|
31
|
+
--admin-surface: #f9fafb;
|
|
32
|
+
--admin-surface-elevated: #ffffff;
|
|
33
|
+
--admin-border: #e5e7eb;
|
|
34
|
+
--admin-border-subtle: #f3f4f6;
|
|
35
|
+
--admin-text: #111827;
|
|
36
|
+
--admin-text-secondary: #4b5563;
|
|
37
|
+
--admin-text-muted: #9ca3af;
|
|
38
|
+
--admin-text-inverse: #ffffff;
|
|
39
|
+
--admin-accent: #3b82f6;
|
|
40
|
+
--admin-accent-hover: #2563eb;
|
|
41
|
+
--admin-accent-subtle: #eff6ff;
|
|
42
|
+
--admin-accent-secondary: #8b5cf6;
|
|
43
|
+
--admin-accent-secondary-hover: #7c3aed;
|
|
44
|
+
--admin-accent-secondary-subtle: #f5f3ff;
|
|
45
|
+
--admin-nav-bg: #f8fafc;
|
|
46
|
+
--admin-nav-text: #374151;
|
|
47
|
+
--admin-nav-text-active: #111827;
|
|
48
|
+
--admin-nav-item-hover: #f1f5f9;
|
|
49
|
+
--admin-nav-item-active: #e0e7ff;
|
|
50
|
+
--admin-nav-group-text: #6b7280;
|
|
51
|
+
--admin-nav-border: #e2e8f0;
|
|
52
|
+
--admin-input-bg: #ffffff;
|
|
53
|
+
--admin-input-border: #d1d5db;
|
|
54
|
+
--admin-input-border-focus: var(--admin-accent);
|
|
55
|
+
--admin-input-placeholder: #9ca3af;
|
|
56
|
+
--admin-card-bg: #ffffff;
|
|
57
|
+
--admin-card-border: #e5e7eb;
|
|
58
|
+
--admin-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
59
|
+
--admin-card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
|
|
60
|
+
--admin-success: #16a34a;
|
|
61
|
+
--admin-success-bg: #f0fdf4;
|
|
62
|
+
--admin-warning: #d97706;
|
|
63
|
+
--admin-warning-bg: #fffbeb;
|
|
64
|
+
--admin-error: #dc2626;
|
|
65
|
+
--admin-error-bg: #fef2f2;
|
|
66
|
+
--admin-info: #0284c7;
|
|
67
|
+
--admin-info-bg: #f0f9ff;
|
|
68
|
+
--admin-tooltip-bg: #1f2937;
|
|
69
|
+
--admin-tooltip-text: #f9fafb;
|
|
70
|
+
--admin-overlay: rgba(0, 0, 0, 0.3);
|
|
71
|
+
--admin-scrollbar-track: #f1f5f9;
|
|
72
|
+
--admin-scrollbar-thumb: #cbd5e1;
|
|
73
|
+
--admin-scrollbar-thumb-hover: #94a3b8;
|
|
74
|
+
--admin-focus-ring: 0 0 0 2px #eff6ff, 0 0 0 4px #3b82f6;
|
|
75
|
+
--admin-radius-sm: 6px;
|
|
76
|
+
--admin-radius-md: 8px;
|
|
77
|
+
--admin-radius-lg: 12px;
|
|
78
|
+
--admin-radius-xl: 16px;
|
|
79
|
+
--admin-badge-draft-bg: #fef3c7;
|
|
80
|
+
--admin-badge-draft-text: #92400e;
|
|
81
|
+
--admin-badge-published-bg: #dcfce7;
|
|
82
|
+
--admin-badge-published-text: #166534;
|
|
83
|
+
--admin-badge-changed-bg: #dbeafe;
|
|
84
|
+
--admin-badge-changed-text: #1e40af;
|
|
74
85
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { CollectionConfig, GlobalConfig, Field } from 'payload';
|
|
2
4
|
|
|
3
5
|
declare function Logo(): react_jsx_runtime.JSX.Element;
|
|
4
6
|
|
|
@@ -6,4 +8,120 @@ declare function Icon(): react_jsx_runtime.JSX.Element;
|
|
|
6
8
|
|
|
7
9
|
declare function Dashboard(): react_jsx_runtime.JSX.Element;
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
declare function ThemeSwitcher(): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function ThemeProvider({ children }: {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
declare function HelpTooltip({ content, position, }: {
|
|
17
|
+
content: string;
|
|
18
|
+
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
type BadgeStatus = 'draft' | 'published' | 'changed';
|
|
22
|
+
declare function StatusBadge({ status, size, }: {
|
|
23
|
+
status: BadgeStatus;
|
|
24
|
+
size?: 'sm' | 'md';
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
declare function EmptyState({ icon, title, description, actionLabel, actionHref, }: {
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
actionLabel?: string;
|
|
32
|
+
actionHref?: string;
|
|
33
|
+
}): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
interface BlockOption {
|
|
36
|
+
slug: string;
|
|
37
|
+
label: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
imageURL?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function BlockPicker({ blocks, onSelect, }: {
|
|
43
|
+
blocks: BlockOption[];
|
|
44
|
+
onSelect: (slug: string) => void;
|
|
45
|
+
}): react_jsx_runtime.JSX.Element;
|
|
46
|
+
|
|
47
|
+
interface TabConfig {
|
|
48
|
+
label: string;
|
|
49
|
+
icon?: React.ReactNode;
|
|
50
|
+
content: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare function SectionTabs({ tabs, defaultTab, }: {
|
|
53
|
+
tabs: TabConfig[];
|
|
54
|
+
defaultTab?: number;
|
|
55
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
56
|
+
|
|
57
|
+
declare function WelcomeHeader({ title, description, tooltip, actions, }: {
|
|
58
|
+
title: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
tooltip?: string;
|
|
61
|
+
actions?: React.ReactNode;
|
|
62
|
+
}): react_jsx_runtime.JSX.Element;
|
|
63
|
+
|
|
64
|
+
interface AdminConfig {
|
|
65
|
+
brandName: string;
|
|
66
|
+
brandPrimary?: string;
|
|
67
|
+
brandSecondary?: string;
|
|
68
|
+
logoUrl?: string;
|
|
69
|
+
}
|
|
70
|
+
declare function configureAdmin(config: AdminConfig): {
|
|
71
|
+
admin: {
|
|
72
|
+
components: {
|
|
73
|
+
graphics: {
|
|
74
|
+
Logo: {
|
|
75
|
+
exportName: string;
|
|
76
|
+
path: string;
|
|
77
|
+
};
|
|
78
|
+
Icon: {
|
|
79
|
+
exportName: string;
|
|
80
|
+
path: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
views: {
|
|
84
|
+
dashboard: {
|
|
85
|
+
Component: {
|
|
86
|
+
exportName: string;
|
|
87
|
+
path: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
providers: {
|
|
92
|
+
exportName: string;
|
|
93
|
+
path: string;
|
|
94
|
+
}[];
|
|
95
|
+
afterNavLinks: {
|
|
96
|
+
exportName: string;
|
|
97
|
+
path: string;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
meta: {
|
|
101
|
+
titleSuffix: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
brandName: string;
|
|
105
|
+
brandPrimary: string;
|
|
106
|
+
brandSecondary: string;
|
|
107
|
+
brandCssVars: string;
|
|
108
|
+
wrapUsers(usersCollection: CollectionConfig): CollectionConfig;
|
|
109
|
+
wrapGlobals(globals: GlobalConfig[]): GlobalConfig[];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
declare function withTooltips(fields: Field[], customTooltips?: Record<string, string>): Field[];
|
|
113
|
+
|
|
114
|
+
type ThemeOption = 'light' | 'dark' | 'brand-light' | 'brand-dark';
|
|
115
|
+
declare function useTheme(): {
|
|
116
|
+
theme: ThemeOption;
|
|
117
|
+
setTheme: (newTheme: ThemeOption) => void;
|
|
118
|
+
isDark: boolean;
|
|
119
|
+
isBrand: boolean;
|
|
120
|
+
isLoading: boolean;
|
|
121
|
+
toggleDarkMode: () => void;
|
|
122
|
+
toggleBrandMode: () => void;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
declare const themePreferenceField: Field;
|
|
126
|
+
|
|
127
|
+
export { type AdminConfig, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, configureAdmin, themePreferenceField, useTheme, withTooltips };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { CollectionConfig, GlobalConfig, Field } from 'payload';
|
|
2
4
|
|
|
3
5
|
declare function Logo(): react_jsx_runtime.JSX.Element;
|
|
4
6
|
|
|
@@ -6,4 +8,120 @@ declare function Icon(): react_jsx_runtime.JSX.Element;
|
|
|
6
8
|
|
|
7
9
|
declare function Dashboard(): react_jsx_runtime.JSX.Element;
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
declare function ThemeSwitcher(): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function ThemeProvider({ children }: {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
declare function HelpTooltip({ content, position, }: {
|
|
17
|
+
content: string;
|
|
18
|
+
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
19
|
+
}): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
type BadgeStatus = 'draft' | 'published' | 'changed';
|
|
22
|
+
declare function StatusBadge({ status, size, }: {
|
|
23
|
+
status: BadgeStatus;
|
|
24
|
+
size?: 'sm' | 'md';
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
declare function EmptyState({ icon, title, description, actionLabel, actionHref, }: {
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
actionLabel?: string;
|
|
32
|
+
actionHref?: string;
|
|
33
|
+
}): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
interface BlockOption {
|
|
36
|
+
slug: string;
|
|
37
|
+
label: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
imageURL?: string;
|
|
41
|
+
}
|
|
42
|
+
declare function BlockPicker({ blocks, onSelect, }: {
|
|
43
|
+
blocks: BlockOption[];
|
|
44
|
+
onSelect: (slug: string) => void;
|
|
45
|
+
}): react_jsx_runtime.JSX.Element;
|
|
46
|
+
|
|
47
|
+
interface TabConfig {
|
|
48
|
+
label: string;
|
|
49
|
+
icon?: React.ReactNode;
|
|
50
|
+
content: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
declare function SectionTabs({ tabs, defaultTab, }: {
|
|
53
|
+
tabs: TabConfig[];
|
|
54
|
+
defaultTab?: number;
|
|
55
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
56
|
+
|
|
57
|
+
declare function WelcomeHeader({ title, description, tooltip, actions, }: {
|
|
58
|
+
title: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
tooltip?: string;
|
|
61
|
+
actions?: React.ReactNode;
|
|
62
|
+
}): react_jsx_runtime.JSX.Element;
|
|
63
|
+
|
|
64
|
+
interface AdminConfig {
|
|
65
|
+
brandName: string;
|
|
66
|
+
brandPrimary?: string;
|
|
67
|
+
brandSecondary?: string;
|
|
68
|
+
logoUrl?: string;
|
|
69
|
+
}
|
|
70
|
+
declare function configureAdmin(config: AdminConfig): {
|
|
71
|
+
admin: {
|
|
72
|
+
components: {
|
|
73
|
+
graphics: {
|
|
74
|
+
Logo: {
|
|
75
|
+
exportName: string;
|
|
76
|
+
path: string;
|
|
77
|
+
};
|
|
78
|
+
Icon: {
|
|
79
|
+
exportName: string;
|
|
80
|
+
path: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
views: {
|
|
84
|
+
dashboard: {
|
|
85
|
+
Component: {
|
|
86
|
+
exportName: string;
|
|
87
|
+
path: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
providers: {
|
|
92
|
+
exportName: string;
|
|
93
|
+
path: string;
|
|
94
|
+
}[];
|
|
95
|
+
afterNavLinks: {
|
|
96
|
+
exportName: string;
|
|
97
|
+
path: string;
|
|
98
|
+
}[];
|
|
99
|
+
};
|
|
100
|
+
meta: {
|
|
101
|
+
titleSuffix: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
brandName: string;
|
|
105
|
+
brandPrimary: string;
|
|
106
|
+
brandSecondary: string;
|
|
107
|
+
brandCssVars: string;
|
|
108
|
+
wrapUsers(usersCollection: CollectionConfig): CollectionConfig;
|
|
109
|
+
wrapGlobals(globals: GlobalConfig[]): GlobalConfig[];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
declare function withTooltips(fields: Field[], customTooltips?: Record<string, string>): Field[];
|
|
113
|
+
|
|
114
|
+
type ThemeOption = 'light' | 'dark' | 'brand-light' | 'brand-dark';
|
|
115
|
+
declare function useTheme(): {
|
|
116
|
+
theme: ThemeOption;
|
|
117
|
+
setTheme: (newTheme: ThemeOption) => void;
|
|
118
|
+
isDark: boolean;
|
|
119
|
+
isBrand: boolean;
|
|
120
|
+
isLoading: boolean;
|
|
121
|
+
toggleDarkMode: () => void;
|
|
122
|
+
toggleBrandMode: () => void;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
declare const themePreferenceField: Field;
|
|
126
|
+
|
|
127
|
+
export { type AdminConfig, BlockPicker, Dashboard, EmptyState, HelpTooltip, Icon, Logo, SectionTabs, StatusBadge, type ThemeOption, ThemeProvider, ThemeSwitcher, WelcomeHeader, configureAdmin, themePreferenceField, useTheme, withTooltips };
|