@sqrzro/admin 4.0.0-alpha.2 → 4.0.0-alpha.20
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/components/AdminAppLayout/index.d.ts +9 -3
- package/dist/components/AdminAppLayout/index.js +2 -2
- package/dist/components/AdminLayout/index.d.ts +3 -2
- package/dist/components/AdminPage/index.d.ts +3 -2
- package/dist/components/AdminPageComponent/index.js +1 -1
- package/dist/components/AdminPanel/index.d.ts +7 -0
- package/dist/components/AdminPanel/index.js +5 -0
- package/dist/components/AdminRootLayout/index.js +3 -3
- package/dist/components/AdminUIProvider/index.d.ts +4 -0
- package/dist/components/AdminUIProvider/index.js +9 -0
- package/dist/components/MePanel/index.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/styles/classnames.d.ts +4 -0
- package/dist/styles/classnames.js +336 -0
- package/dist/styles/icons.d.ts +3 -0
- package/dist/styles/icons.js +18 -0
- package/dist/styles/styles.css +3 -0
- package/dist/utility/interfaces.d.ts +0 -8
- package/package.json +24 -10
- package/dist/config.d.ts +0 -3
- package/dist/config.js +0 -141
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { NavigationObject } from '@sqrzro/ui/navigation';
|
|
2
|
+
import type { User } from '../../utility/interfaces';
|
|
2
3
|
interface AdminAppLayoutProps {
|
|
3
4
|
readonly children: React.ReactNode;
|
|
4
|
-
readonly
|
|
5
|
+
readonly logo?: React.ReactNode;
|
|
6
|
+
readonly navigation?: NavigationObject[];
|
|
7
|
+
readonly site?: {
|
|
8
|
+
name: string;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
5
11
|
readonly userFn?: () => Promise<User>;
|
|
6
12
|
}
|
|
7
|
-
declare function AdminAppLayout({ children,
|
|
13
|
+
declare function AdminAppLayout({ children, logo, navigation, site, userFn, }: AdminAppLayoutProps): React.ReactElement;
|
|
8
14
|
export default AdminAppLayout;
|
|
@@ -3,7 +3,7 @@ import { Suspense } from 'react';
|
|
|
3
3
|
import { Link } from '@sqrzro/ui/components';
|
|
4
4
|
import { AppNavigation } from '@sqrzro/ui/navigation';
|
|
5
5
|
import MePanel from '../MePanel';
|
|
6
|
-
function AdminAppLayout({ children,
|
|
7
|
-
return (_jsxs("div", { className: "flex flex-1 flex-col", children: [_jsx("header", { className: "bg-slate-800", children: _jsxs("div", { className: "flex h-16 items-center border-b border-slate-700 px-4", children: [
|
|
6
|
+
function AdminAppLayout({ children, logo, navigation, site, userFn, }) {
|
|
7
|
+
return (_jsxs("div", { className: "flex flex-1 flex-col", children: [_jsx("header", { className: "relative bg-slate-800 shadow-lg", children: _jsxs("div", { className: "flex h-16 items-center border-b border-slate-700 px-4", children: [_jsxs(Link, { className: "h-9 w-9", href: "/", children: [logo, _jsx("span", { className: "sr-only", children: site?.name })] }), _jsx(AppNavigation, { data: navigation || [] }), _jsx(Suspense, { children: _jsx(MePanel, { userFn: userFn }) })] }) }), _jsx("main", { className: "mb-10 flex flex-1 flex-col", children: children })] }));
|
|
8
8
|
}
|
|
9
9
|
export default AdminAppLayout;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PageProps } from '@sqrzro/ui/components';
|
|
2
2
|
import { NextLayoutProps } from '@sqrzro/ui/utility';
|
|
3
|
-
|
|
3
|
+
type Fn = (...args: any[]) => Promise<any>;
|
|
4
|
+
export type AdminLayoutProps<T extends Fn | undefined = undefined> = Omit<PageProps<T>, 'children' | 'pageProps' | 'template'> & {
|
|
4
5
|
readonly layoutProps: NextLayoutProps;
|
|
5
6
|
};
|
|
6
|
-
declare function AdminLayout<T>(props: Readonly<AdminLayoutProps<T>>): React.ReactElement;
|
|
7
|
+
declare function AdminLayout<T extends Fn | undefined = undefined>(props: Readonly<AdminLayoutProps<T>>): React.ReactElement;
|
|
7
8
|
export default AdminLayout;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PageProps } from '@sqrzro/ui/components';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Fn = (...args: any[]) => Promise<any>;
|
|
3
|
+
export type AdminPageProps<T extends Fn | undefined = undefined> = Omit<PageProps<T>, 'template'>;
|
|
4
|
+
declare function AdminPage<T extends Fn | undefined = undefined>(props: Readonly<AdminPageProps<T>>): React.ReactElement;
|
|
4
5
|
export default AdminPage;
|
|
@@ -3,6 +3,6 @@ import { Fragment } from 'react';
|
|
|
3
3
|
import { Container } from '@sqrzro/ui/components';
|
|
4
4
|
import { Tabs } from '@sqrzro/ui/navigation';
|
|
5
5
|
function AdminPageComponent({ children, tabs, title, }) {
|
|
6
|
-
return (_jsxs(Fragment, { children: [_jsx("header", { className: "bg-slate-800 pb-16 text-white", children: _jsxs(Container, { children: [_jsxs("div", { className: "flex items-center justify-between py-10", children: [_jsx("h1", { className: "flex min-h-10 items-center text-3xl font-semibold", children: title }), _jsx("div", { className: "flex gap-2", id: "page-actions" })] }), tabs ? _jsx(Tabs, { data: tabs }) : null] }) }), _jsx(Container, { children: _jsx("div", { className: "
|
|
6
|
+
return (_jsxs(Fragment, { children: [_jsx("header", { className: "bg-linear-to-b from-slate-700 to-slate-800 pb-16 text-white", children: _jsxs(Container, { children: [_jsxs("div", { className: "flex items-center justify-between py-10", children: [_jsx("h1", { className: "flex min-h-10 items-center text-3xl font-semibold", children: title }), _jsx("div", { className: "flex gap-2", id: "page-actions" })] }), tabs ? _jsx(Tabs, { data: tabs }) : null] }) }), _jsx(Container, { children: _jsx("div", { className: "-mt-16 flex flex-col gap-8 [&>.page-content-block]:relative [&>.page-content-block]:before:absolute [&>.page-content-block]:before:bottom-full [&>.page-content-block]:before:left-[calc(50%-50vw)] [&>.page-content-block]:before:-z-10 [&>.page-content-block]:before:-mb-16 [&>.page-content-block]:before:h-96 [&>.page-content-block]:before:w-screen [&>.page-content-block]:before:bg-slate-800 [&>.page-content-block~.page-content-block]:before:content-none", children: children }) })] }));
|
|
7
7
|
}
|
|
8
8
|
export default AdminPageComponent;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function AdminPanel({ actions, children, title }) {
|
|
3
|
+
return (_jsxs("section", { className: "page-content-block rounded bg-white p-6 shadow", children: [title ? (_jsxs("header", { className: "-mt-6 mb-6 flex h-16 items-center justify-between border-b border-slate-200", children: [_jsx("h3", { className: "text-lg font-semibold leading-none", children: title }), actions] })) : null, _jsx("div", { className: "flex flex-col gap-6", children: children })] }));
|
|
4
|
+
}
|
|
5
|
+
export default AdminPanel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { AppBody } from '@sqrzro/ui/components';
|
|
3
|
+
import AdminUIProvider from '../AdminUIProvider';
|
|
4
4
|
function AdminRootLayout({ children }) {
|
|
5
|
-
return _jsx(
|
|
5
|
+
return (_jsx("html", { lang: "en", children: _jsx("body", { className: "overflow-x-hidden overflow-y-scroll bg-slate-50 font-sans text-sm text-slate-800 has-[[data-modal][open]]:overflow-hidden", children: _jsx(AdminUIProvider, { children: _jsx(AppBody, { children: children }) }) }) }));
|
|
6
6
|
}
|
|
7
7
|
export default AdminRootLayout;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { UIProvider } from '@sqrzro/ui/styles';
|
|
4
|
+
import classNameConfig from '../../styles/classnames';
|
|
5
|
+
import iconConfig from '../../styles/icons';
|
|
6
|
+
function AdminUIProvider({ children }) {
|
|
7
|
+
return (_jsx(UIProvider, { data: { classNames: classNameConfig, icons: iconConfig }, children: children }));
|
|
8
|
+
}
|
|
9
|
+
export default AdminUIProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { LogoutButton } from '@sqrzro/auth';
|
|
2
|
+
import { LogoutButton } from '@sqrzro/addon-auth';
|
|
3
3
|
async function MePanel({ userFn }) {
|
|
4
4
|
const user = await userFn?.();
|
|
5
5
|
return (_jsxs("div", { className: "ml-auto flex items-center gap-3", children: [_jsxs("div", { className: "flex flex-col items-end gap-0.5 text-white", children: [_jsx("strong", { children: user?.name }), _jsx("div", { className: "text-xs text-slate-300", children: _jsx(LogoutButton, {}) })] }), _jsx("div", { className: "h-9 w-9 flex-none rounded-full border-4 border-slate-500" })] }));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './utility/interfaces';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as classNameConfig } from './styles/classnames';
|
|
3
3
|
export { default as AdminAppLayout } from './components/AdminAppLayout';
|
|
4
4
|
export { default as AdminLayout } from './components/AdminLayout';
|
|
5
5
|
export { default as AdminPage } from './components/AdminPage';
|
|
6
6
|
export { default as AdminPageActions } from './components/AdminPageActions';
|
|
7
|
+
export { default as AdminPanel } from './components/AdminPanel';
|
|
7
8
|
export { default as AdminRootLayout } from './components/AdminRootLayout';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './utility/interfaces';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as classNameConfig } from './styles/classnames';
|
|
3
3
|
export { default as AdminAppLayout } from './components/AdminAppLayout';
|
|
4
4
|
export { default as AdminLayout } from './components/AdminLayout';
|
|
5
5
|
export { default as AdminPage } from './components/AdminPage';
|
|
6
6
|
export { default as AdminPageActions } from './components/AdminPageActions';
|
|
7
|
+
export { default as AdminPanel } from './components/AdminPanel';
|
|
7
8
|
export { default as AdminRootLayout } from './components/AdminRootLayout';
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { twx } from '@sqrzro/ui/styles';
|
|
2
|
+
const classNameConfig = twx({
|
|
3
|
+
actionList: {
|
|
4
|
+
root: 'flex items-center gap-2 [&_li]:first:mr-auto',
|
|
5
|
+
},
|
|
6
|
+
appNavigation: {
|
|
7
|
+
root: 'h-full pl-6',
|
|
8
|
+
list: 'flex h-full items-center gap-4',
|
|
9
|
+
item: { default: 'relative h-full' },
|
|
10
|
+
link: {
|
|
11
|
+
default: 'relative flex h-full items-center px-1 font-semibold text-white/80 hover:text-white',
|
|
12
|
+
states: {
|
|
13
|
+
isHighlighted: 'before:bg-primary text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-1',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
icon: {
|
|
17
|
+
default: 'ml-1.5 h-4 w-4 rounded-full bg-slate-600 text-slate-100 transition-all ease-in-out',
|
|
18
|
+
states: { isSelected: 'rotate-180' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
auth: {
|
|
22
|
+
actions: 'mt-2 w-full',
|
|
23
|
+
content: 'flex flex-col gap-4',
|
|
24
|
+
footer: 'mt-2 text-center',
|
|
25
|
+
form: 'flex flex-col gap-6',
|
|
26
|
+
link: 'text-link font-semibold',
|
|
27
|
+
logo: 'row-start-2 mx-auto mx-auto flex h-12 w-32 w-48 items-end',
|
|
28
|
+
panel: 'row-start-3 flex w-screen max-w-sm flex-col gap-6 rounded-lg bg-white p-6 py-8 shadow-lg',
|
|
29
|
+
root: 'grid flex-1 grid-rows-[1fr_auto_auto_3fr] justify-center gap-8 bg-slate-800',
|
|
30
|
+
title: 'mb-1 text-center text-lg font-semibold leading-none',
|
|
31
|
+
},
|
|
32
|
+
badge: {
|
|
33
|
+
root: {
|
|
34
|
+
default: 'inline-flex items-center gap-1.5 rounded-full bg-slate-100 bg-gradient-to-br px-2 py-1 text-xs font-medium text-slate-600',
|
|
35
|
+
props: {
|
|
36
|
+
isDanger: 'border-red-300 from-red-100 to-red-200 text-red-700',
|
|
37
|
+
isError: 'border-red-300 from-red-100 to-red-200 text-red-700',
|
|
38
|
+
isInfo: 'border-sky-300 from-sky-100 to-sky-200 text-sky-700',
|
|
39
|
+
isSuccess: 'border-green-300 from-green-100 to-green-200 text-green-700',
|
|
40
|
+
isWarning: 'border-yellow-300 from-yellow-100 to-yellow-200 text-yellow-700',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
dot: {
|
|
44
|
+
default: 'h-1.5 w-1.5 fill-slate-400',
|
|
45
|
+
props: {
|
|
46
|
+
isDanger: 'fill-red-400',
|
|
47
|
+
isError: 'fill-red-400',
|
|
48
|
+
isInfo: 'fill-sky-400',
|
|
49
|
+
isWarning: 'fill-yellow-400',
|
|
50
|
+
isSuccess: 'fill-green-400',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
button: {
|
|
55
|
+
root: {
|
|
56
|
+
default: 'h-10 rounded border border-slate-300 bg-white px-5 text-sm text-slate-600',
|
|
57
|
+
props: {
|
|
58
|
+
isDanger: 'border-red-500 bg-white text-red-500',
|
|
59
|
+
isOnDark: 'border-slate-400 bg-transparent text-white hover:bg-white/10',
|
|
60
|
+
isPrimary: 'bg-button-bg hover:bg-button-bg-hover text-button-text border-none font-semibold shadow-sm transition-colors',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
icon: '-ml-1.5 h-4 w-4',
|
|
64
|
+
},
|
|
65
|
+
calendar: {
|
|
66
|
+
root: 'p-4 pb-3 text-sm text-slate-600',
|
|
67
|
+
header: 'relative mb-4 flex items-center justify-between',
|
|
68
|
+
title: 'absolute left-1/2 -translate-x-1/2 text-sm font-semibold',
|
|
69
|
+
navigation: 'h-6 w-6 rounded-full bg-slate-400 text-slate-100 hover:bg-slate-500',
|
|
70
|
+
month: 'w-full table-fixed',
|
|
71
|
+
head: 'pb-2 text-center text-xs text-slate-400',
|
|
72
|
+
day: 'border border-slate-200 py-1',
|
|
73
|
+
control: {
|
|
74
|
+
default: 'mx-auto block h-8 w-full',
|
|
75
|
+
props: {
|
|
76
|
+
isSelected: 'bg-primary w-8 rounded-full text-white',
|
|
77
|
+
isInRange: 'bg-primary w-full text-white',
|
|
78
|
+
isStart: 'bg-primary ml-1 w-[calc(100%-.25rem)] rounded-l-full text-white [&_span]:-ml-1',
|
|
79
|
+
isEnd: 'bg-primary mx-0 w-[calc(100%-.25rem)] rounded-r-full text-white [&_span]:ml-1',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
container: {
|
|
84
|
+
root: 'mx-auto w-full max-w-6xl px-8',
|
|
85
|
+
},
|
|
86
|
+
csvInput: {
|
|
87
|
+
root: 'w-full rounded border border-slate-300 bg-slate-50 p-8',
|
|
88
|
+
icon: {
|
|
89
|
+
default: 'mx-auto mb-3 block h-10 w-10 rounded-full text-slate-400',
|
|
90
|
+
states: { isHighlighted: 'text-green-500' },
|
|
91
|
+
},
|
|
92
|
+
title: 'mb-1 font-semibold',
|
|
93
|
+
description: 'mb-2 text-xs italic text-slate-700',
|
|
94
|
+
},
|
|
95
|
+
dropdown: {
|
|
96
|
+
item: {
|
|
97
|
+
default: 'flex flex-col items-start justify-center gap-1.5 border-b border-slate-100 p-3',
|
|
98
|
+
states: { isSelected: 'bg-slate-100' },
|
|
99
|
+
},
|
|
100
|
+
details: 'text-xs leading-none text-slate-500',
|
|
101
|
+
},
|
|
102
|
+
editableForm: {
|
|
103
|
+
root: 'page-content-block grid grid-cols-[25%_1fr] gap-20 rounded bg-white p-8 shadow',
|
|
104
|
+
title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
|
|
105
|
+
description: 'text-slate-600',
|
|
106
|
+
actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
|
|
107
|
+
},
|
|
108
|
+
editableFormField: {
|
|
109
|
+
root: 'grid grid-cols-[30%_1fr] gap-x-4 border-t border-slate-200 py-4',
|
|
110
|
+
label: 'flex items-center font-semibold',
|
|
111
|
+
field: 'col-start-2 flex min-h-10 items-center overflow-hidden',
|
|
112
|
+
},
|
|
113
|
+
emptyMessage: {
|
|
114
|
+
root: 'page-content-block relative mx-auto flex w-full max-w-2xl flex-col gap-4 rounded bg-white p-16 text-center text-slate-500 shadow',
|
|
115
|
+
icon: {
|
|
116
|
+
default: 'mx-auto -mt-2 block block h-12 w-12 text-slate-300',
|
|
117
|
+
props: { isError: 'text-error' },
|
|
118
|
+
},
|
|
119
|
+
title: {
|
|
120
|
+
default: 'text-pretty text-xl font-semibold leading-tight',
|
|
121
|
+
props: { isError: 'text-error' },
|
|
122
|
+
},
|
|
123
|
+
description: 'text-pretty text-sm',
|
|
124
|
+
action: 'mt-2 flex justify-center',
|
|
125
|
+
},
|
|
126
|
+
filterBar: {
|
|
127
|
+
root: 'flex flex-wrap gap-2',
|
|
128
|
+
},
|
|
129
|
+
filterClear: {
|
|
130
|
+
root: 'absolute right-0 top-0 z-20 flex h-full w-8 select-none items-center justify-center',
|
|
131
|
+
icon: 'h-5 w-5 text-slate-100',
|
|
132
|
+
},
|
|
133
|
+
filterItem: {
|
|
134
|
+
root: {
|
|
135
|
+
default: 'relative inline-flex h-8 items-center gap-2 rounded-full border border-dashed border-slate-400 px-5 text-xs text-slate-300 text-white transition-all',
|
|
136
|
+
props: {
|
|
137
|
+
isFocused: 'border-solid border-slate-400 bg-slate-700 pr-9',
|
|
138
|
+
isHighlighted: 'bg-slate-700',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
value: 'border-l border-l-slate-300 pl-2 font-semibold',
|
|
142
|
+
},
|
|
143
|
+
filterPanel: {
|
|
144
|
+
root: { default: 'min-w-56', props: { isLarge: 'min-w-96' } },
|
|
145
|
+
title: 'flex items-center gap-2 border-b border-slate-300 p-3 text-sm font-semibold',
|
|
146
|
+
footer: 'p-3',
|
|
147
|
+
},
|
|
148
|
+
filterSearch: {
|
|
149
|
+
icon: 'pointer-events-none absolute left-2 top-0 z-10 flex h-full items-center',
|
|
150
|
+
input: 'h-8 w-56 rounded-full border border-slate-400 pl-7 pr-3 text-xs text-white placeholder:text-slate-300',
|
|
151
|
+
},
|
|
152
|
+
form: {
|
|
153
|
+
root: 'flex flex-col gap-6',
|
|
154
|
+
},
|
|
155
|
+
formField: {
|
|
156
|
+
root: {
|
|
157
|
+
default: '',
|
|
158
|
+
props: {
|
|
159
|
+
isEditable: 'grid grid-cols-[30%_1fr] gap-x-4 border-t border-slate-200 py-4',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
label: {
|
|
163
|
+
default: 'mb-2 flex justify-between font-semibold leading-none',
|
|
164
|
+
props: { isEditable: 'mb-0 items-center' },
|
|
165
|
+
},
|
|
166
|
+
details: 'mb-2 text-xs font-normal text-slate-500',
|
|
167
|
+
optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
|
|
168
|
+
error: {
|
|
169
|
+
default: 'text-error mt-2 flex items-start gap-1.5',
|
|
170
|
+
props: { isEditable: 'col-start-2' },
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
infoPanel: {
|
|
174
|
+
root: {
|
|
175
|
+
default: 'flex w-full gap-2 rounded border bg-gradient-to-br p-4 text-left',
|
|
176
|
+
props: {
|
|
177
|
+
isDanger: 'border-red-300 from-red-100 to-red-200 text-red-700',
|
|
178
|
+
isError: 'border-red-300 from-red-100 to-red-200 text-red-700',
|
|
179
|
+
isInfo: 'border-sky-300 from-sky-100 to-sky-200 text-sky-700',
|
|
180
|
+
isSuccess: 'border-green-300 from-green-100 to-green-200 text-green-700',
|
|
181
|
+
isWarning: 'border-yellow-300 from-yellow-100 to-yellow-200 text-yellow-700',
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
list: {
|
|
186
|
+
root: {
|
|
187
|
+
default: 'page-content-block flex flex-col gap-4',
|
|
188
|
+
props: { isMinimal: 'gap-0 border-t border-slate-200' },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
listItem: {
|
|
192
|
+
root: {
|
|
193
|
+
default: 'rounded bg-white p-4 shadow',
|
|
194
|
+
props: {
|
|
195
|
+
isMinimal: 'border-b border-slate-200 pl-0 shadow-none',
|
|
196
|
+
isSelected: 'bg-primary/5',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
actions: 'flex items-center justify-end pl-4',
|
|
200
|
+
primary: 'flex flex-col items-start gap-2',
|
|
201
|
+
secondary: 'flex flex-col items-end gap-1',
|
|
202
|
+
select: 'flex items-center px-4',
|
|
203
|
+
title: 'text-base font-semibold',
|
|
204
|
+
},
|
|
205
|
+
listItemMeta: {
|
|
206
|
+
root: 'flex flex-wrap items-center gap-x-4 gap-y-1 text-slate-500',
|
|
207
|
+
},
|
|
208
|
+
menu: {
|
|
209
|
+
link: 'block min-w-36 whitespace-nowrap border-b border-slate-100 p-3 pr-5 text-left text-sm text-slate-700',
|
|
210
|
+
},
|
|
211
|
+
modal: {
|
|
212
|
+
root: 'starting:open:backdrop:opacity-0 py-16 backdrop:bg-slate-700/50 backdrop:transition-all backdrop:duration-500 open:backdrop:opacity-100',
|
|
213
|
+
panel: 'show show-open row-start-2 mx-auto flex w-full max-w-lg flex-col gap-6 rounded bg-white p-6 shadow-xl',
|
|
214
|
+
content: 'flex flex-col gap-6 [&_p]:text-pretty',
|
|
215
|
+
icon: 'text-slate-400',
|
|
216
|
+
title: 'flex items-center gap-2 border-b border-slate-200 pb-6 text-lg font-semibold',
|
|
217
|
+
actions: 'border-t border-slate-200 pt-6',
|
|
218
|
+
},
|
|
219
|
+
pagination: {
|
|
220
|
+
root: 'mx-auto flex w-full justify-between',
|
|
221
|
+
list: 'mx-auto flex flex-row items-center gap-1',
|
|
222
|
+
link: {
|
|
223
|
+
default: 'inline-flex h-9 w-9 items-center justify-center whitespace-nowrap rounded-md border border-transparent text-sm font-medium hover:bg-slate-100 disabled:pointer-events-none disabled:opacity-30',
|
|
224
|
+
states: { isHighlighted: 'border-slate-200 bg-white shadow-sm' },
|
|
225
|
+
},
|
|
226
|
+
gap: 'flex h-9 w-9 items-center justify-center text-xs text-slate-400',
|
|
227
|
+
navigation: 'inline-flex h-9 items-center justify-center gap-1 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium hover:bg-slate-100',
|
|
228
|
+
},
|
|
229
|
+
passwordComplexity: {
|
|
230
|
+
root: {
|
|
231
|
+
default: 'mt-2 rounded border border-slate-300 p-3',
|
|
232
|
+
props: { isValid: 'border-green-400 bg-green-50' },
|
|
233
|
+
},
|
|
234
|
+
list: 'flex flex-col gap-1',
|
|
235
|
+
item: {
|
|
236
|
+
default: 'flex items-center gap-2 text-slate-400',
|
|
237
|
+
props: { isValid: 'text-green-600' },
|
|
238
|
+
},
|
|
239
|
+
icon: { default: 'h-5 w-5 text-slate-400', props: { isValid: 'text-green-600' } },
|
|
240
|
+
},
|
|
241
|
+
passwordInput: {
|
|
242
|
+
action: 'absolute inset-y-0 right-0 flex items-center px-3',
|
|
243
|
+
icon: 'h-6 w-6 overflow-hidden bg-no-repeat indent-12 text-slate-700',
|
|
244
|
+
},
|
|
245
|
+
popover: {
|
|
246
|
+
root: {
|
|
247
|
+
default: 'show z-20 my-1 min-w-full rounded border border-slate-300 bg-white text-slate-700 shadow',
|
|
248
|
+
states: { isFocused: 'show-open' },
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
reference: {
|
|
252
|
+
root: { default: 'inline-flex items-center gap-2', props: { isTitle: 'gap-4' } },
|
|
253
|
+
reference: {
|
|
254
|
+
default: 'rounded bg-slate-200 px-2 py-1 text-[70%] font-semibold',
|
|
255
|
+
props: { isTitle: 'border border-slate-400 bg-transparent text-[60%] text-white' },
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
summary: {
|
|
259
|
+
root: 'relative grid gap-6',
|
|
260
|
+
item: 'relative rounded border border-slate-500 p-4 font-semibold text-white',
|
|
261
|
+
label: 'text-slate-300',
|
|
262
|
+
value: 'flex min-h-8 items-center text-2xl',
|
|
263
|
+
},
|
|
264
|
+
staticTextInput: {
|
|
265
|
+
root: {
|
|
266
|
+
default: 'text-md flex min-h-10 flex-col items-start justify-center gap-1.5 rounded border border-slate-300 bg-white p-3',
|
|
267
|
+
states: { isError: 'border-red-500' },
|
|
268
|
+
},
|
|
269
|
+
label: 'block leading-none',
|
|
270
|
+
details: 'block text-xs leading-none text-slate-500',
|
|
271
|
+
placeholder: 'block leading-none text-slate-400',
|
|
272
|
+
icon: 'mr-2 h-4 w-4 rounded-full bg-slate-500 text-white',
|
|
273
|
+
clear: 'mr-2 h-4 w-4 flex-none rounded-full border border-slate-500 text-slate-600',
|
|
274
|
+
},
|
|
275
|
+
switch: {
|
|
276
|
+
root: 'flex gap-4',
|
|
277
|
+
control: 'relative h-6 w-10 flex-none',
|
|
278
|
+
input: {
|
|
279
|
+
default: 'block h-full w-full cursor-pointer rounded-full bg-slate-300 transition-colors',
|
|
280
|
+
states: { isChecked: 'bg-primary' },
|
|
281
|
+
},
|
|
282
|
+
icon: {
|
|
283
|
+
default: 'pointer-events-none absolute left-1 top-1/2 h-4 w-4 -translate-y-1/2 translate-x-0 transform rounded-full bg-white shadow-md transition-transform duration-100',
|
|
284
|
+
states: { isChecked: 'translate-x-full' },
|
|
285
|
+
},
|
|
286
|
+
// label: 'flex min-h-6 flex-col justify-center',
|
|
287
|
+
// details: 'mt-1 block text-xs text-slate-500',
|
|
288
|
+
},
|
|
289
|
+
table: {
|
|
290
|
+
root: 'page-content-block rounded bg-white p-6 shadow',
|
|
291
|
+
row: {
|
|
292
|
+
default: 'bg-slate-50 odd:bg-slate-100',
|
|
293
|
+
props: { isSelected: 'bg-primary/10 odd:bg-primary/10' },
|
|
294
|
+
},
|
|
295
|
+
head: 'p-4 pt-0 text-left font-semibold leading-none',
|
|
296
|
+
cell: 'p-4',
|
|
297
|
+
actions: 'flex items-center justify-end',
|
|
298
|
+
},
|
|
299
|
+
tabs: {
|
|
300
|
+
root: '-mt-4 mb-8 border-b border-slate-700',
|
|
301
|
+
list: 'flex gap-4',
|
|
302
|
+
link: {
|
|
303
|
+
default: 'block border-b-4 border-transparent px-1 pb-2 font-semibold opacity-80 hover:opacity-100',
|
|
304
|
+
states: { isHighlighted: 'border-primary opacity-100' },
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
textArea: {
|
|
308
|
+
root: {
|
|
309
|
+
default: 'text-md focus:border-primary max-h-48 min-h-10 rounded border border-slate-300 px-3 py-2 placeholder-slate-400',
|
|
310
|
+
states: { isError: 'border-red-500' },
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
textInput: {
|
|
314
|
+
root: {
|
|
315
|
+
default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3 placeholder-slate-400',
|
|
316
|
+
states: { isError: 'border-red-500' },
|
|
317
|
+
},
|
|
318
|
+
prefix: {
|
|
319
|
+
default: 'peer-focus:border-primary relative -mr-1 rounded-l border border-slate-300 bg-white px-3 text-sm text-slate-600',
|
|
320
|
+
},
|
|
321
|
+
suffix: {
|
|
322
|
+
default: 'peer-focus:border-primary relative -ml-1 rounded-r border border-slate-300 bg-white px-3 text-sm text-slate-600',
|
|
323
|
+
},
|
|
324
|
+
loading: 'text-slate-400',
|
|
325
|
+
},
|
|
326
|
+
toast: {
|
|
327
|
+
root: {
|
|
328
|
+
default: 'show show-open left-1/2 top-24 -translate-x-1/2 translate-y-5 rounded border px-4 py-2',
|
|
329
|
+
props: {
|
|
330
|
+
isSuccess: 'border-green-300 bg-green-100 text-green-700',
|
|
331
|
+
isError: 'border-red-300 bg-red-100 text-red-700',
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
});
|
|
336
|
+
export default classNameConfig;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, EyeIcon, EyeSlashIcon, XMarkIcon, } from '@heroicons/react/16/solid';
|
|
2
|
+
import { ArrowUpTrayIcon, CheckCircleIcon, ExclamationCircleIcon, XCircleIcon, } from '@heroicons/react/24/outline';
|
|
3
|
+
const iconConfig = {
|
|
4
|
+
'appNavigation.menu': ChevronDownIcon,
|
|
5
|
+
'calendar.next': ChevronRightIcon,
|
|
6
|
+
'calendar.previous': ChevronLeftIcon,
|
|
7
|
+
'csvInput.success': CheckCircleIcon,
|
|
8
|
+
'csvInput.upload': ArrowUpTrayIcon,
|
|
9
|
+
'dropdown.control': ChevronDownIcon,
|
|
10
|
+
'filter.clear': XCircleIcon,
|
|
11
|
+
'formField.error': ExclamationCircleIcon,
|
|
12
|
+
'passwordComplexity.invalid': XCircleIcon,
|
|
13
|
+
'passwordComplexity.valid': CheckCircleIcon,
|
|
14
|
+
'passwordInput.visible': EyeIcon,
|
|
15
|
+
'passwordInput.hidden': EyeSlashIcon,
|
|
16
|
+
'staticTextInput.clear': XMarkIcon,
|
|
17
|
+
};
|
|
18
|
+
export default iconConfig;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import { NavigationObject } from 'node_modules/@sqrzro/ui/dist/navigation/interfaces';
|
|
2
|
-
export interface AdminConfig {
|
|
3
|
-
app: {
|
|
4
|
-
name: string;
|
|
5
|
-
url: string;
|
|
6
|
-
};
|
|
7
|
-
navigation: NavigationObject[];
|
|
8
|
-
}
|
|
9
1
|
export interface User {
|
|
10
2
|
id: string;
|
|
11
3
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,33 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqrzro/admin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.20",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "ISC",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./styles.css": {
|
|
14
|
+
"default": "./dist/styles/styles.css"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
8
17
|
"files": [
|
|
9
18
|
"dist/**/*"
|
|
10
19
|
],
|
|
11
20
|
"dependencies": {
|
|
21
|
+
"@heroicons/react": "^2.2.0",
|
|
12
22
|
"next": "^16.1.6",
|
|
13
23
|
"react": "^19.2.4",
|
|
14
|
-
"react-dom": "^19.2.
|
|
15
|
-
"
|
|
16
|
-
"@sqrzro/auth": "^4.0.0-alpha.
|
|
24
|
+
"react-dom": "^19.2.4",
|
|
25
|
+
"tailwindcss": "^4.2.1",
|
|
26
|
+
"@sqrzro/addon-auth": "^4.0.0-alpha.10",
|
|
27
|
+
"@sqrzro/ui": "^4.0.0-alpha.48"
|
|
17
28
|
},
|
|
18
29
|
"devDependencies": {
|
|
19
|
-
"@types/react": "^19.2.
|
|
30
|
+
"@types/react": "^19.2.14",
|
|
20
31
|
"@types/react-dom": "^19.2.3",
|
|
21
32
|
"concurrently": "^9.2.1",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
33
|
+
"cpx": "^1.5.0",
|
|
34
|
+
"prettier": "^3.8.1",
|
|
35
|
+
"rimraf": "^6.1.3",
|
|
24
36
|
"tsc-alias": "^1.8.16",
|
|
25
37
|
"typescript": "^5.9.3",
|
|
26
|
-
"@sqrzro/prettier-config": "^4.0.0-alpha.
|
|
38
|
+
"@sqrzro/prettier-config": "^4.0.0-alpha.5"
|
|
27
39
|
},
|
|
28
40
|
"scripts": {
|
|
29
|
-
"build": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias",
|
|
41
|
+
"build": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias && pnpm build:css",
|
|
42
|
+
"build:css": "cpx \"./src/**/*.css\" ./dist",
|
|
30
43
|
"clean": "rimraf ./dist",
|
|
31
|
-
"dev": "(concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -w\")"
|
|
44
|
+
"dev": "pnpm build:css && (concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -w\")",
|
|
45
|
+
"prettier": "prettier --write \"**/*.(cjs|cts|js|jsx|mjs|mts|ts|tsx)\""
|
|
32
46
|
}
|
|
33
47
|
}
|
package/dist/config.d.ts
DELETED
package/dist/config.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { tw, twx } from '@sqrzro/ui/styles';
|
|
2
|
-
const showClosed = 'transition-discrete transition-all duration-100 invisible opacity-0 ease-in-out scale-90';
|
|
3
|
-
const showOpen = 'starting:opacity-0 starting:scale-90 visible opacity-100 scale-100';
|
|
4
|
-
const classNames = twx({
|
|
5
|
-
actionList: {
|
|
6
|
-
root: tw('flex items-center gap-2 [&_li]:first:mr-auto'),
|
|
7
|
-
},
|
|
8
|
-
appNavigation: {
|
|
9
|
-
root: 'h-full pl-6',
|
|
10
|
-
list: 'flex h-full items-center gap-4',
|
|
11
|
-
item: { default: 'relative h-full' },
|
|
12
|
-
link: {
|
|
13
|
-
default: 'relative flex h-full items-center px-1 font-semibold text-white/80 hover:text-white',
|
|
14
|
-
highlighted: 'before:bg-primary text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-1',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
button: {
|
|
18
|
-
root: {
|
|
19
|
-
danger: 'border-red-500 bg-white text-red-500',
|
|
20
|
-
default: 'h-10 rounded border border-slate-300 bg-white px-5 text-sm text-slate-600',
|
|
21
|
-
primary: 'bg-button-bg hover:bg-button-bg-hover text-button-text border-none font-semibold transition-colors',
|
|
22
|
-
link: 'text-link h-auto w-auto border-0 bg-transparent p-0',
|
|
23
|
-
},
|
|
24
|
-
icon: '-ml-1.5 h-4 w-4',
|
|
25
|
-
},
|
|
26
|
-
container: {
|
|
27
|
-
root: 'mx-auto w-full max-w-6xl px-8',
|
|
28
|
-
},
|
|
29
|
-
dropdown: {
|
|
30
|
-
item: {
|
|
31
|
-
default: 'block border-b border-slate-100 p-3 text-sm text-slate-700',
|
|
32
|
-
selected: 'bg-slate-100',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
editableForm: {
|
|
36
|
-
root: 'grid grid-cols-[25%_1fr] gap-20 rounded bg-white p-8 shadow',
|
|
37
|
-
title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
|
|
38
|
-
description: 'text-slate-600',
|
|
39
|
-
actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
|
|
40
|
-
},
|
|
41
|
-
editableFormField: {
|
|
42
|
-
root: 'grid grid-cols-[30%_1fr] gap-x-4 border-t border-slate-200 py-4',
|
|
43
|
-
label: 'flex items-center font-semibold',
|
|
44
|
-
field: 'col-start-2 flex min-h-10 items-center overflow-hidden',
|
|
45
|
-
},
|
|
46
|
-
filterBar: {
|
|
47
|
-
root: 'bg-red-500',
|
|
48
|
-
},
|
|
49
|
-
form: {
|
|
50
|
-
root: 'flex flex-col gap-6',
|
|
51
|
-
},
|
|
52
|
-
formField: {
|
|
53
|
-
label: 'mb-2 flex justify-between font-semibold leading-none',
|
|
54
|
-
details: 'mb-2 text-xs font-normal text-slate-500',
|
|
55
|
-
optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
|
|
56
|
-
error: 'text-error mt-2 flex items-start gap-1.5 before:mt-0.5 before:h-4 before:w-4 before:flex-none before:rounded-full before:bg-[url(/admin/images/danger.svg)] before:bg-contain',
|
|
57
|
-
},
|
|
58
|
-
listItem: {
|
|
59
|
-
root: { default: 'bg-red-500' },
|
|
60
|
-
},
|
|
61
|
-
modal: {
|
|
62
|
-
root: 'starting:open:backdrop:opacity-0 py-16 backdrop:bg-slate-700/50 backdrop:transition-all backdrop:duration-500 open:backdrop:opacity-100',
|
|
63
|
-
panel: `${showOpen} row-start-2 mx-auto flex w-full max-w-lg flex-col gap-6 rounded bg-white p-6 shadow-xl`,
|
|
64
|
-
content: 'flex flex-col gap-6 [&_p]:text-pretty',
|
|
65
|
-
icon: 'text-slate-400',
|
|
66
|
-
title: 'flex items-center gap-2 border-b border-slate-200 pb-6 text-lg font-semibold',
|
|
67
|
-
actions: 'border-t border-slate-200 pt-6',
|
|
68
|
-
},
|
|
69
|
-
pagination: {
|
|
70
|
-
root: 'mx-auto flex w-full justify-between',
|
|
71
|
-
list: 'mx-auto flex flex-row items-center gap-1',
|
|
72
|
-
link: {
|
|
73
|
-
default: 'inline-flex h-9 w-9 items-center justify-center whitespace-nowrap rounded-md border border-transparent text-sm font-medium hover:bg-slate-100 disabled:pointer-events-none disabled:opacity-30',
|
|
74
|
-
highlighted: 'border-slate-200 bg-white shadow-sm',
|
|
75
|
-
},
|
|
76
|
-
gap: 'flex h-9 w-9 items-center justify-center text-xs text-slate-400',
|
|
77
|
-
navigation: 'inline-flex h-9 items-center justify-center gap-1 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium hover:bg-slate-100',
|
|
78
|
-
},
|
|
79
|
-
popover: {
|
|
80
|
-
root: {
|
|
81
|
-
default: `${showClosed} z-20 my-1.5 w-full rounded border border-slate-300 bg-white text-slate-700 shadow-md`,
|
|
82
|
-
focused: `${showOpen}`,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
rootLayout: {
|
|
86
|
-
root: 'overflow-x-hidden overflow-y-scroll bg-slate-50 font-sans text-sm text-slate-800 has-[[data-modal][open]]:overflow-hidden',
|
|
87
|
-
content: 'flex min-h-screen flex-col',
|
|
88
|
-
},
|
|
89
|
-
staticTextInput: {
|
|
90
|
-
root: {
|
|
91
|
-
default: 'text-md flex min-h-10 flex-col justify-center rounded border border-slate-300 bg-white p-3',
|
|
92
|
-
error: 'border-red-500',
|
|
93
|
-
},
|
|
94
|
-
label: 'block leading-none',
|
|
95
|
-
meta: 'mt-1.5 block text-xs leading-none text-slate-500',
|
|
96
|
-
placeholder: 'block leading-none text-slate-400',
|
|
97
|
-
},
|
|
98
|
-
switch: {
|
|
99
|
-
root: tw('flex', 'gap-4'),
|
|
100
|
-
control: tw('relative flex-none', 'h-6 w-10'),
|
|
101
|
-
input: {
|
|
102
|
-
default: tw('block h-full w-full cursor-pointer rounded-full transition-colors', 'bg-slate-300'),
|
|
103
|
-
checked: tw('bg-primary'),
|
|
104
|
-
},
|
|
105
|
-
icon: {
|
|
106
|
-
default: tw('pointer-events-none absolute top-1/2 -translate-y-1/2 translate-x-0 transform rounded-full transition-transform duration-100', 'left-1 h-4 w-4 bg-white shadow-md'),
|
|
107
|
-
checked: tw('translate-x-full'),
|
|
108
|
-
},
|
|
109
|
-
label: 'flex min-h-6 flex-col justify-center',
|
|
110
|
-
details: 'mt-1 block text-xs text-slate-500',
|
|
111
|
-
},
|
|
112
|
-
table: {
|
|
113
|
-
root: 'rounded bg-white p-8 shadow',
|
|
114
|
-
row: {
|
|
115
|
-
default: 'odd:bg-slate-100',
|
|
116
|
-
},
|
|
117
|
-
cell: 'p-4',
|
|
118
|
-
},
|
|
119
|
-
tabs: {
|
|
120
|
-
root: '-mt-4 mb-8 border-b border-slate-700',
|
|
121
|
-
list: 'flex gap-4',
|
|
122
|
-
link: {
|
|
123
|
-
default: 'block border-b-4 border-transparent px-1 pb-2 font-semibold opacity-80 hover:opacity-100',
|
|
124
|
-
highlighted: 'border-primary opacity-100',
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
textInput: {
|
|
128
|
-
root: {
|
|
129
|
-
default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3 placeholder-slate-400',
|
|
130
|
-
error: 'border-red-500',
|
|
131
|
-
},
|
|
132
|
-
prefix: {
|
|
133
|
-
default: 'peer-focus:border-primary relative -mr-1 rounded-l border border-slate-300 bg-white px-3 text-sm text-slate-600',
|
|
134
|
-
},
|
|
135
|
-
suffix: {
|
|
136
|
-
default: 'peer-focus:border-primary relative -ml-1 rounded-r border border-slate-300 bg-white px-3 text-sm text-slate-600',
|
|
137
|
-
},
|
|
138
|
-
loading: 'text-slate-400',
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
export default classNames;
|