@sqrzro/admin 2.1.0-bz.14 → 2.1.0-bz.15
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.
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export interface AppLayoutProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
+
layout?: string;
|
|
4
5
|
user?: {
|
|
5
6
|
name: string;
|
|
6
7
|
} | null;
|
|
7
8
|
}
|
|
8
|
-
declare function AppLayout({ children, user }: Readonly<AppLayoutProps>): React.ReactElement;
|
|
9
|
+
declare function AppLayout({ children, layout, user }: Readonly<AppLayoutProps>): React.ReactElement;
|
|
9
10
|
export default AppLayout;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Container, Link, tw } from '@sqrzro/components';
|
|
3
|
-
import { cookies } from 'next/headers';
|
|
4
3
|
import { getConfig } from '../../services/ConfigService';
|
|
5
4
|
import AppNavigation from '../AppNavigation';
|
|
6
5
|
import MePanel from '../MePanel';
|
|
7
|
-
function AppLayout({ children, user }) {
|
|
6
|
+
function AppLayout({ children, layout, user }) {
|
|
8
7
|
const config = getConfig();
|
|
9
|
-
const layout = cookies().get('layout')?.value || 'topbar';
|
|
10
8
|
return (_jsxs("div", { className: tw('', layout === 'sidebar' ? 'grid grid-cols-[12rem_1fr]' : null), children: [_jsx("header", { className: "bg-slate-800", children: _jsx(Container, { isFullWidth: true, children: _jsxs("div", { className: tw('flex h-16 items-center border-b border-slate-700', layout === 'sidebar' ? 'h-screen flex-col' : null), children: [_jsxs(Link, { className: "h-9 w-9", href: "/", children: [config.logo?.(), _jsx("span", { className: "sr-only", children: config.app.name })] }), _jsx(AppNavigation, {}), _jsx(MePanel, { user: user })] }) }) }), _jsx("main", { className: "mb-10 block", children: children })] }));
|
|
11
9
|
}
|
|
12
10
|
export default AppLayout;
|
|
@@ -3,8 +3,11 @@ import { Auth as AuthComponent } from '@sqrzro/components';
|
|
|
3
3
|
const classNames = {
|
|
4
4
|
root: 'bg-slate-800 gap-8',
|
|
5
5
|
logo: 'mx-auto flex h-12 w-32 items-end',
|
|
6
|
-
panel: 'rounded bg-white p-8 shadow-lg',
|
|
7
|
-
title: 'text-lg font-semibold mb-
|
|
6
|
+
panel: 'rounded bg-white p-8 shadow-lg pb-10',
|
|
7
|
+
title: 'text-lg font-semibold mb-6 leading-none',
|
|
8
|
+
link: 'font-semibold text-link',
|
|
9
|
+
actions: 'pt-2 w-full',
|
|
10
|
+
footer: '-mb-2',
|
|
8
11
|
};
|
|
9
12
|
function Auth(props) {
|
|
10
13
|
return _jsx(AuthComponent, { ...props, classNames: classNames });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import { EmptyMessage, tw } from '@sqrzro/components';
|
|
4
|
-
import { headers } from 'next/headers';
|
|
5
4
|
import FilterBar from '../FilterBar';
|
|
6
5
|
import ListItem from '../ListItem';
|
|
7
6
|
function defaultTransformer() {
|
|
@@ -11,7 +10,14 @@ function defaultTransformer() {
|
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
async function List({ actions, columns, emptyMessageProps, filters, fn, hasSearch, params, renderItem = ListItem, transformer, }) {
|
|
14
|
-
|
|
13
|
+
let searchParams;
|
|
14
|
+
try {
|
|
15
|
+
const { headers } = await import('next/headers');
|
|
16
|
+
searchParams = new URLSearchParams(headers().get('x-search-params') || '');
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
searchParams = new URLSearchParams();
|
|
20
|
+
}
|
|
15
21
|
const [response, error] = await fn(params || {}, searchParams);
|
|
16
22
|
if (error) {
|
|
17
23
|
return _jsx("div", { children: "Error" });
|
package/dist/styles/config.js
CHANGED
|
@@ -8,7 +8,7 @@ const classNames = twx({
|
|
|
8
8
|
root: {
|
|
9
9
|
danger: 'border-red-500 bg-red-500 text-white',
|
|
10
10
|
default: tw('text-md h-10 rounded border border-slate-300 bg-white px-5 text-slate-600', props?.isFullWidth ? 'w-full' : null),
|
|
11
|
-
primary: 'bg-button-bg text-button-text border-none font-semibold',
|
|
11
|
+
primary: 'bg-button-bg text-button-text border-none font-semibold',
|
|
12
12
|
},
|
|
13
13
|
}),
|
|
14
14
|
calendar: () => ({
|
|
@@ -30,7 +30,7 @@ const classNames = twx({
|
|
|
30
30
|
codeInput: () => ({
|
|
31
31
|
input: {
|
|
32
32
|
default: 'focus:border-primary h-10 rounded border border-slate-300 text-center',
|
|
33
|
-
error: 'border-red-
|
|
33
|
+
error: 'border-red-500',
|
|
34
34
|
},
|
|
35
35
|
}),
|
|
36
36
|
editableFieldset: () => ({
|
|
@@ -69,7 +69,7 @@ const classNames = twx({
|
|
|
69
69
|
label: tw('flex font-semibold leading-none', props?.isEditable ? 'items-center' : 'mb-2 justify-between'),
|
|
70
70
|
details: 'mb-2 text-xs font-normal leading-none text-slate-500',
|
|
71
71
|
optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
|
|
72
|
-
error: 'mt-2 flex items-center gap-2 text-red-700 before:h-4 before:w-4 before:rounded-full before:bg-[url(/images/
|
|
72
|
+
error: 'mt-2 flex items-center gap-2 text-red-700 before:h-4 before:w-4 before:rounded-full before:bg-[url(/admin/images/error.svg)]',
|
|
73
73
|
}),
|
|
74
74
|
imageInput: () => ({
|
|
75
75
|
root: 'h-64 rounded border border-slate-300 bg-slate-50 p-8',
|
|
@@ -99,7 +99,7 @@ const classNames = twx({
|
|
|
99
99
|
staticTextInput: () => ({
|
|
100
100
|
root: {
|
|
101
101
|
default: 'text-md h-10 rounded border border-slate-300 bg-white px-3',
|
|
102
|
-
error: 'border-red-
|
|
102
|
+
error: 'border-red-500',
|
|
103
103
|
},
|
|
104
104
|
}),
|
|
105
105
|
switch: () => ({
|
|
@@ -118,7 +118,7 @@ const classNames = twx({
|
|
|
118
118
|
textArea: () => ({
|
|
119
119
|
root: {
|
|
120
120
|
default: 'text-md focus:border-primary rounded border border-slate-300 px-3 py-2',
|
|
121
|
-
error: 'border-red-
|
|
121
|
+
error: 'border-red-500',
|
|
122
122
|
},
|
|
123
123
|
}),
|
|
124
124
|
textButton: () => ({
|
|
@@ -127,7 +127,7 @@ const classNames = twx({
|
|
|
127
127
|
textInput: () => ({
|
|
128
128
|
root: {
|
|
129
129
|
default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3',
|
|
130
|
-
error: 'border-red-
|
|
130
|
+
error: 'border-red-500',
|
|
131
131
|
},
|
|
132
132
|
}),
|
|
133
133
|
toast: () => ({
|