@sqrzro/admin 2.1.0-bz.0 → 2.1.0-bz.11
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/LICENSE +1 -1
- package/README.md +8 -5
- package/dist/components/AppLayout/index.d.ts +4 -1
- package/dist/components/AppLayout/index.js +7 -4
- package/dist/components/AppNavigation/index.js +4 -3
- package/dist/components/Auth/index.d.ts +5 -0
- package/dist/components/Auth/index.js +12 -0
- package/dist/components/Badge/index.d.ts +8 -0
- package/dist/components/Badge/index.js +11 -0
- package/dist/components/Dashboard/index.js +1 -1
- package/dist/components/DateFilter/index.js +0 -1
- package/dist/components/FilterBar/index.d.ts +4 -3
- package/dist/components/FilterBar/index.js +12 -3
- package/dist/components/FilterBarItem/index.d.ts +2 -1
- package/dist/components/FilterBarItem/index.js +2 -2
- package/dist/components/GridList/index.d.ts +2 -2
- package/dist/components/GridList/index.js +1 -1
- package/dist/components/GridListItem/index.d.ts +1 -1
- package/dist/components/GridListItem/index.js +3 -2
- package/dist/components/InfoPanel/index.d.ts +8 -0
- package/dist/components/InfoPanel/index.js +10 -0
- package/dist/components/List/index.d.ts +12 -10
- package/dist/components/List/index.js +7 -5
- package/dist/components/ListActions/index.js +1 -1
- package/dist/components/ListItem/index.d.ts +9 -6
- package/dist/components/ListItem/index.js +8 -4
- package/dist/components/MeActions/index.js +3 -10
- package/dist/components/MePanel/index.d.ts +6 -1
- package/dist/components/MePanel/index.js +2 -5
- package/dist/components/Page/index.d.ts +1 -1
- package/dist/components/Page/index.js +2 -2
- package/dist/components/Panel/index.d.ts +1 -1
- package/dist/components/Panel/index.js +1 -1
- package/dist/components/RootLayout/index.d.ts +2 -1
- package/dist/components/RootLayout/index.js +12 -5
- package/dist/components/SettingsForm/index.d.ts +2 -0
- package/dist/components/SettingsForm/index.js +9 -0
- package/dist/components/SettingsPage/index.d.ts +2 -0
- package/dist/components/SettingsPage/index.js +7 -0
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/TableClientComponent/index.d.ts +4 -4
- package/dist/components/TableClientComponent/index.js +17 -4
- package/dist/components/Tabs/index.js +20 -2
- package/dist/components/index.d.ts +12 -4
- package/dist/components/index.js +6 -2
- package/dist/services/ConfigService.d.ts +3 -1
- package/dist/services/ConfigService.js +5 -5
- package/dist/styles/config.js +94 -35
- package/dist/styles/postcss.d.ts +6 -0
- package/dist/styles/postcss.js +4 -0
- package/dist/styles/tailwind.d.ts +10 -0
- package/dist/styles/tailwind.js +72 -0
- package/package.json +66 -76
- package/postcss.js +3 -0
- package/tailwind.d.ts +1 -0
- package/tailwind.js +1 -0
- package/.babelrc.json +0 -16
- package/.eslintignore +0 -6
- package/.eslintrc +0 -5
- package/.sqrzrorc +0 -5
- package/.storybook/main.js +0 -11
- package/.storybook/preview-head.html +0 -3
- package/.storybook/preview.js +0 -1
- package/.turbo/turbo-build.log +0 -20
- package/.turbo/turbo-prettier.log +0 -43
- package/COMPONENTS.md +0 -45
- package/dist/components/LoginForm/index.d.ts +0 -6
- package/dist/components/LoginForm/index.js +0 -7
- package/dist/styles.css +0 -1723
- package/dist/utility/formatters.d.ts +0 -1
- package/dist/utility/formatters.js +0 -8
- package/next-env.d.ts +0 -5
- package/postcss.config.js +0 -3
- package/prettier.config.js +0 -1
- package/src/components/AppLayout/index.tsx +0 -32
- package/src/components/AppNavigation/index.tsx +0 -39
- package/src/components/BooleanFilter/index.tsx +0 -28
- package/src/components/Config/index.tsx +0 -17
- package/src/components/Dashboard/index.tsx +0 -15
- package/src/components/DateFilter/index.tsx +0 -49
- package/src/components/DropdownFilter/index.tsx +0 -19
- package/src/components/FilterBar/index.tsx +0 -35
- package/src/components/FilterBarItem/index.tsx +0 -126
- package/src/components/GridList/index.tsx +0 -11
- package/src/components/GridListItem/index.tsx +0 -31
- package/src/components/Icon/index.tsx +0 -33
- package/src/components/List/index.tsx +0 -70
- package/src/components/ListAction/index.tsx +0 -25
- package/src/components/ListActions/index.tsx +0 -43
- package/src/components/ListItem/index.tsx +0 -56
- package/src/components/LoginForm/index.tsx +0 -34
- package/src/components/MeActions/index.tsx +0 -21
- package/src/components/MePanel/index.tsx +0 -21
- package/src/components/Page/index.tsx +0 -60
- package/src/components/PageActions/index.tsx +0 -22
- package/src/components/Panel/Panel.spec.tsx +0 -10
- package/src/components/Panel/Panel.stories.tsx +0 -9
- package/src/components/Panel/index.tsx +0 -15
- package/src/components/RootLayout/index.tsx +0 -39
- package/src/components/Table/index.tsx +0 -34
- package/src/components/TableClientComponent/index.tsx +0 -112
- package/src/components/Tabs/index.tsx +0 -25
- package/src/components/index.ts +0 -68
- package/src/icons/ErrorIcon/index.tsx +0 -19
- package/src/icons/InfoIcon/index.tsx +0 -19
- package/src/icons/SuccessIcon/index.tsx +0 -19
- package/src/icons/WarningIcon/index.tsx +0 -19
- package/src/index.ts +0 -3
- package/src/interfaces.ts +0 -3
- package/src/react.d.ts +0 -12
- package/src/services/ConfigService.ts +0 -24
- package/src/styles/config.ts +0 -95
- package/src/styles/tailwind.css +0 -47
- package/src/utility/formatters.ts +0 -9
- package/tailwind.config.js +0 -16
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -18
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import { Link } from '@sqrzro/components';
|
|
4
|
+
import { Link, tw } from '@sqrzro/components';
|
|
6
5
|
import { usePathname, useSearchParams } from 'next/navigation';
|
|
7
6
|
function toggleArrayItem(array, item) {
|
|
8
7
|
if (array.includes(item)) {
|
|
@@ -33,12 +32,26 @@ function getSortIconProps(searchParams, sort) {
|
|
|
33
32
|
}
|
|
34
33
|
return { dir: null };
|
|
35
34
|
}
|
|
35
|
+
function isStringArray(array) {
|
|
36
|
+
return array.every((item) => typeof item === 'string');
|
|
37
|
+
}
|
|
38
|
+
function parseColumns(columns) {
|
|
39
|
+
if (columns.length === 0) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
if (isStringArray(columns)) {
|
|
43
|
+
return columns.map((key) => ({ key }));
|
|
44
|
+
}
|
|
45
|
+
return columns;
|
|
46
|
+
}
|
|
36
47
|
function TableClientComponent({ columns, data, }) {
|
|
37
48
|
const pathname = usePathname();
|
|
38
49
|
const searchParams = useSearchParams();
|
|
39
50
|
const [selected, setSelected] = useState([]);
|
|
40
|
-
|
|
51
|
+
const parsedColumns = parseColumns(columns);
|
|
52
|
+
const hasTitles = parsedColumns.some((column) => column.title);
|
|
53
|
+
return (_jsx("div", { className: "bg-white shadow-sm", children: _jsxs("table", { className: "w-full", children: [hasTitles ? (_jsx("thead", { children: _jsx("tr", { children: parsedColumns.map((column) => (_jsx("th", { className: tw('p-4', column.type === 'number' ? 'text-right' : 'text-left'), children: column.title ? (_jsxs(Link, { href: createSortLink(pathname, searchParams, column.key), children: [column.title, ' '] })) : null }, column.key))) }) })) : null, _jsx("tbody", { children: data.map((item) => (_jsx("tr", { className: "odd:bg-slate-100", children: parsedColumns.map((column) => (_jsx("td", { className: tw('border-x border-transparent p-4', getSortIconProps(searchParams, column.key).dir
|
|
41
54
|
? 'border-sky-300 bg-sky-300/10'
|
|
42
|
-
: ''), children: item[column.key] }, column.key))) }, item.id))) })] }) }));
|
|
55
|
+
: '', column.type === 'number' ? 'text-right' : 'text-left'), children: item[column.key] }, column.key))) }, item.id))) })] }) }));
|
|
43
56
|
}
|
|
44
57
|
export default TableClientComponent;
|
|
@@ -1,6 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Link } from '@sqrzro/components';
|
|
3
|
+
import { Link, tw } from '@sqrzro/components';
|
|
4
|
+
import { useNavigation } from '@sqrzro/hooks';
|
|
3
5
|
function Tabs({ basePath = '', data }) {
|
|
4
|
-
|
|
6
|
+
const navigation = useNavigation([basePath, data]);
|
|
7
|
+
return (_jsx("nav", { className: "border-b border-slate-700", children: _jsx("ul", { className: "flex gap-4", children: navigation.map(({ href, isActive, label }) => (_jsx("li", { children: _jsx(Link, { className: tw('block px-1 pb-2 font-semibold', isActive
|
|
8
|
+
? 'border-primary border-b-4 text-white'
|
|
9
|
+
: 'text-white/80 hover:text-white'), href: href, children: label }) }, href))) }) }));
|
|
10
|
+
// return (
|
|
11
|
+
// <nav className="border-y border-slate-700">
|
|
12
|
+
// <ul className="flex gap-4 font-semibold">
|
|
13
|
+
// {data.map(({ href, label }) => (
|
|
14
|
+
// <li key={href}>
|
|
15
|
+
// <Link className="block py-2 text-white" href={`${basePath}${href || ''}`}>
|
|
16
|
+
// {label}
|
|
17
|
+
// </Link>
|
|
18
|
+
// </li>
|
|
19
|
+
// ))}
|
|
20
|
+
// </ul>
|
|
21
|
+
// </nav>
|
|
22
|
+
// );
|
|
5
23
|
}
|
|
6
24
|
export default Tabs;
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, NumberInput, Switch, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
|
|
1
|
+
export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, DropdownFormField, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, MultiFormField, NumberFormField, NumberInput, Switch, SwitchFormField, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
|
|
2
2
|
export type { AppLayoutProps } from './AppLayout';
|
|
3
3
|
export { default as AppLayout } from './AppLayout';
|
|
4
|
+
export type { AuthProps } from './Auth';
|
|
5
|
+
export { default as Auth } from './Auth';
|
|
6
|
+
export type { BadgeProps } from './Badge';
|
|
7
|
+
export { default as Badge } from './Badge';
|
|
4
8
|
export type { DashboardProps } from './Dashboard';
|
|
5
9
|
export { default as Dashboard } from './Dashboard';
|
|
6
|
-
export type { FilterBarProps } from './FilterBar';
|
|
10
|
+
export type { FilterBarProps, FilterObject } from './FilterBar';
|
|
7
11
|
export { default as FilterBar } from './FilterBar';
|
|
8
12
|
export type { GridListProps } from './GridList';
|
|
9
13
|
export { default as GridList } from './GridList';
|
|
14
|
+
export type { InfoPanelProps } from './InfoPanel';
|
|
15
|
+
export { default as InfoPanel } from './InfoPanel';
|
|
10
16
|
export type { ListComponentProps, ListProps } from './List';
|
|
11
17
|
export { default as List } from './List';
|
|
12
18
|
export type { ListObject } from './ListItem';
|
|
13
19
|
export type { ListActionsProps } from './ListActions';
|
|
14
20
|
export { default as ListActions } from './ListActions';
|
|
15
|
-
export type { LoginFormProps } from './LoginForm';
|
|
16
|
-
export { default as LoginForm } from './LoginForm';
|
|
17
21
|
export type { PageProps } from './Page';
|
|
18
22
|
export { default as Page } from './Page';
|
|
23
|
+
export type { PanelProps } from './Panel';
|
|
24
|
+
export { default as Panel } from './Panel';
|
|
19
25
|
export type { PageActionsProps } from './PageActions';
|
|
20
26
|
export { default as PageActions } from './PageActions';
|
|
21
27
|
export type { RootLayoutProps } from './RootLayout';
|
|
22
28
|
export { default as RootLayout } from './RootLayout';
|
|
29
|
+
export { default as SettingsPage } from './SettingsPage';
|
|
30
|
+
export type { TableColumnObject } from './TableClientComponent';
|
|
23
31
|
export type { TableProps } from './Table';
|
|
24
32
|
export { default as Table } from './Table';
|
package/dist/components/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// Exported from @sqrzro/components
|
|
2
|
-
export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, NumberInput, Switch, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
|
|
2
|
+
export { Button, CalendarInput, ConnectedDropdown, DateFormField, DateInput, Dropdown, DropdownFormField, EditableDateFormField, EditableDropdownFormField, EditableForm, EditableFormField, EditableMultiFormField, EditableNumberFormField, EditableSwitchFormField, EditableTextFormField, Fieldset, Form, FormField, FormSubmit, ImageInput, ImageFormField, Link, ModalForm, MultiFormField, NumberFormField, NumberInput, Switch, SwitchFormField, TextFormField, TextInput, Toaster, } from '@sqrzro/components';
|
|
3
3
|
export { default as AppLayout } from './AppLayout';
|
|
4
|
+
export { default as Auth } from './Auth';
|
|
5
|
+
export { default as Badge } from './Badge';
|
|
4
6
|
export { default as Dashboard } from './Dashboard';
|
|
5
7
|
export { default as FilterBar } from './FilterBar';
|
|
6
8
|
export { default as GridList } from './GridList';
|
|
9
|
+
export { default as InfoPanel } from './InfoPanel';
|
|
7
10
|
export { default as List } from './List';
|
|
8
11
|
export { default as ListActions } from './ListActions';
|
|
9
|
-
export { default as LoginForm } from './LoginForm';
|
|
10
12
|
export { default as Page } from './Page';
|
|
13
|
+
export { default as Panel } from './Panel';
|
|
11
14
|
export { default as PageActions } from './PageActions';
|
|
12
15
|
export { default as RootLayout } from './RootLayout';
|
|
16
|
+
export { default as SettingsPage } from './SettingsPage';
|
|
13
17
|
export { default as Table } from './Table';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface Config {
|
|
2
3
|
app: {
|
|
3
4
|
name: string;
|
|
4
5
|
url: string;
|
|
5
6
|
};
|
|
7
|
+
logo?: () => React.ReactElement;
|
|
6
8
|
navigation: Record<string, string>;
|
|
7
9
|
}
|
|
8
|
-
export declare function setConfig(
|
|
10
|
+
export declare function setConfig(cfg: Config, logo?: () => React.ReactElement): Config;
|
|
9
11
|
export declare function getConfig(): Config;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
let
|
|
1
|
+
let config = {
|
|
2
2
|
app: {
|
|
3
3
|
name: 'Square Zero',
|
|
4
4
|
url: 'http://localhost:8080',
|
|
5
5
|
},
|
|
6
6
|
navigation: {},
|
|
7
7
|
};
|
|
8
|
-
export function setConfig(
|
|
9
|
-
|
|
10
|
-
return
|
|
8
|
+
export function setConfig(cfg, logo) {
|
|
9
|
+
config = { ...cfg, logo };
|
|
10
|
+
return config;
|
|
11
11
|
}
|
|
12
12
|
export function getConfig() {
|
|
13
|
-
return
|
|
13
|
+
return config;
|
|
14
14
|
}
|
package/dist/styles/config.js
CHANGED
|
@@ -1,82 +1,141 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
const classNames = {
|
|
2
|
+
import { tw, twx } from '@sqrzro/components';
|
|
3
|
+
const classNames = twx({
|
|
4
|
+
actionList: () => ({
|
|
5
|
+
root: 'flex gap-2',
|
|
6
|
+
}),
|
|
4
7
|
button: (props) => ({
|
|
5
8
|
root: {
|
|
6
|
-
danger: '
|
|
7
|
-
default:
|
|
8
|
-
primary: 'bg-
|
|
9
|
+
danger: 'border-red-500 bg-red-500 text-white',
|
|
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', // shadow-[inset_rgba(255,255,255,0.2)_0_20px]
|
|
9
12
|
},
|
|
10
13
|
}),
|
|
11
14
|
calendar: () => ({
|
|
12
|
-
root: 'text-sm text-slate-600
|
|
13
|
-
head: '
|
|
15
|
+
root: 'p-4 pb-3 text-sm text-slate-600',
|
|
16
|
+
head: 'pb-2 text-center text-xs text-slate-400',
|
|
14
17
|
month: 'w-full table-fixed',
|
|
15
18
|
day: {
|
|
16
|
-
default: 'h-10 border border-
|
|
17
|
-
highlighted: 'bg-
|
|
18
|
-
selected: 'bg-
|
|
19
|
+
default: 'h-10 border border-slate-200',
|
|
20
|
+
highlighted: 'bg-slate-100',
|
|
21
|
+
selected: 'bg-slate-200',
|
|
19
22
|
},
|
|
20
23
|
}),
|
|
21
24
|
calendarNavigation: () => ({
|
|
22
|
-
root: 'flex
|
|
23
|
-
title: 'font-semibold
|
|
24
|
-
control: 'h-6 w-6
|
|
25
|
+
root: 'mb-6 flex items-center justify-between',
|
|
26
|
+
title: 'text-base font-semibold',
|
|
27
|
+
control: 'h-6 w-6 rounded-full border border-slate-300',
|
|
25
28
|
previous: '-order-1',
|
|
26
29
|
}),
|
|
30
|
+
codeInput: () => ({
|
|
31
|
+
input: {
|
|
32
|
+
default: 'focus:border-primary h-10 rounded border border-slate-300 text-center',
|
|
33
|
+
error: 'border-red-700',
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
editableFieldset: () => ({
|
|
37
|
+
root: 'bg-panel grid grid-cols-[30%_1fr] rounded p-8 shadow',
|
|
38
|
+
title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
|
|
39
|
+
actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
|
|
40
|
+
}),
|
|
41
|
+
editableFormField: () => ({
|
|
42
|
+
root: 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4',
|
|
43
|
+
label: 'flex items-center font-semibold leading-none',
|
|
44
|
+
field: 'flex min-h-10 items-center',
|
|
45
|
+
}),
|
|
27
46
|
emptyMessage: () => ({
|
|
28
|
-
root: 'text-center text-slate-500
|
|
29
|
-
title: 'text-
|
|
47
|
+
root: 'relative mx-auto mt-4 w-full max-w-xl rounded bg-white py-16 text-center text-slate-500 shadow before:pointer-events-none before:absolute before:inset-2 before:border-2 before:border-dashed',
|
|
48
|
+
title: 'mb-2 text-xl font-semibold leading-none',
|
|
49
|
+
action: 'mt-6 flex justify-center',
|
|
30
50
|
}),
|
|
31
51
|
dropdown: () => ({
|
|
32
|
-
item: { default: '
|
|
52
|
+
item: { default: 'block p-3 text-sm text-slate-700', selected: 'bg-slate-100' },
|
|
53
|
+
title: 'block leading-none',
|
|
54
|
+
meta: 'mt-0.5 block text-xs leading-none text-slate-500',
|
|
33
55
|
}),
|
|
34
|
-
fieldset: (
|
|
35
|
-
root:
|
|
36
|
-
title: 'mb-8 text-
|
|
56
|
+
fieldset: () => ({
|
|
57
|
+
root: 'rounded bg-white p-8 shadow',
|
|
58
|
+
title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
|
|
59
|
+
}),
|
|
60
|
+
form: () => ({
|
|
61
|
+
root: 'flex flex-col gap-6',
|
|
37
62
|
}),
|
|
38
63
|
formField: (props) => ({
|
|
39
64
|
root: {
|
|
40
65
|
default: props?.isEditable
|
|
41
66
|
? 'grid grid-cols-[25%_1fr] border-t border-slate-200 py-4'
|
|
42
|
-
: '
|
|
67
|
+
: '',
|
|
43
68
|
},
|
|
44
|
-
label:
|
|
45
|
-
|
|
46
|
-
|
|
69
|
+
label: tw('flex font-semibold leading-none', props?.isEditable ? 'items-center' : 'mb-2 justify-between'),
|
|
70
|
+
details: 'mb-2 text-xs font-normal leading-none text-slate-500',
|
|
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/icons/error.svg)]',
|
|
73
|
+
}),
|
|
74
|
+
imageInput: () => ({
|
|
75
|
+
root: 'h-64 rounded border border-slate-300 bg-slate-50 p-8',
|
|
76
|
+
icon: 'mx-auto mb-2 block h-12 w-12 rounded-full border-2 border-slate-300',
|
|
77
|
+
title: 'mb-1 font-semibold',
|
|
78
|
+
description: 'text-xs italic text-slate-700',
|
|
47
79
|
}),
|
|
48
80
|
inputPanel: () => ({
|
|
49
|
-
root: '
|
|
81
|
+
root: 'show mt-1 origin-top rounded border border-slate-300 bg-white shadow-md',
|
|
50
82
|
}),
|
|
51
83
|
modal: () => ({
|
|
52
|
-
root:
|
|
53
|
-
|
|
84
|
+
root: 'open:backdrop:fade py-16 backdrop:bg-slate-700/50 backdrop:backdrop-blur-sm',
|
|
85
|
+
panel: 'show bg-panel row-start-2 mx-auto w-full max-w-lg rounded p-6 text-left shadow-xl',
|
|
86
|
+
title: 'mb-6 text-lg font-semibold',
|
|
87
|
+
actions: 'flex justify-end',
|
|
88
|
+
}),
|
|
89
|
+
multiInput: () => ({
|
|
90
|
+
root: 'flex flex-col gap-2',
|
|
91
|
+
row: 'grid grid-cols-[1fr_auto] has-[>_button]:gap-2',
|
|
92
|
+
}),
|
|
93
|
+
passwordInput: () => ({
|
|
94
|
+
action: {
|
|
95
|
+
default: 'mr-2 h-6 w-6 overflow-hidden bg-[url(/admin/images/eye.svg)] bg-no-repeat indent-12',
|
|
96
|
+
selected: 'bg-bottom',
|
|
54
97
|
},
|
|
55
|
-
title: 'text-2xl font-semibold text-center p-4 border-b border-slate-200 text-slate-700',
|
|
56
|
-
content: 'p-4',
|
|
57
|
-
actions: 'flex justify-end p-4 border-t border-slate-200',
|
|
58
98
|
}),
|
|
59
99
|
staticTextInput: () => ({
|
|
60
|
-
root: {
|
|
100
|
+
root: {
|
|
101
|
+
default: 'text-md h-10 rounded border border-slate-300 bg-white px-3',
|
|
102
|
+
error: 'border-red-700',
|
|
103
|
+
},
|
|
61
104
|
}),
|
|
62
105
|
switch: () => ({
|
|
63
|
-
root:
|
|
64
|
-
|
|
106
|
+
root: 'flex gap-4',
|
|
107
|
+
input: {
|
|
108
|
+
default: 'h-6 w-10 flex-none cursor-pointer rounded-full bg-slate-300 p-1 transition-colors',
|
|
65
109
|
checked: 'bg-green-500',
|
|
66
110
|
},
|
|
67
111
|
control: {
|
|
68
|
-
default: '
|
|
112
|
+
default: 'h-4 w-4 translate-x-0 transform rounded-full bg-white shadow-md transition-transform',
|
|
69
113
|
checked: 'translate-x-full',
|
|
70
114
|
},
|
|
115
|
+
label: 'font-semibold',
|
|
116
|
+
details: 'block text-xs text-slate-500',
|
|
117
|
+
}),
|
|
118
|
+
textArea: () => ({
|
|
119
|
+
root: {
|
|
120
|
+
default: 'text-md focus:border-primary rounded border border-slate-300 px-3 py-2',
|
|
121
|
+
error: 'border-red-700',
|
|
122
|
+
},
|
|
71
123
|
}),
|
|
72
124
|
textButton: () => ({
|
|
73
125
|
root: { danger: 'text-red-600' },
|
|
74
126
|
}),
|
|
75
127
|
textInput: () => ({
|
|
76
128
|
root: {
|
|
77
|
-
default: '
|
|
129
|
+
default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3',
|
|
78
130
|
error: 'border-red-700',
|
|
79
131
|
},
|
|
80
132
|
}),
|
|
81
|
-
|
|
133
|
+
toast: () => ({
|
|
134
|
+
root: {
|
|
135
|
+
default: 'rounded border px-4 py-2',
|
|
136
|
+
success: 'border-green-300 bg-green-100 text-green-700',
|
|
137
|
+
error: 'border-red-300 bg-red-100 text-red-700',
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
82
141
|
export default classNames;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import plugin from 'tailwindcss/plugin';
|
|
3
|
+
function config(resolves, customization) {
|
|
4
|
+
return {
|
|
5
|
+
content: [
|
|
6
|
+
'./app/**/*.tsx',
|
|
7
|
+
'./src/**/*.tsx',
|
|
8
|
+
...resolves.map((item) => path.join(item, '**/*.js')),
|
|
9
|
+
],
|
|
10
|
+
darkMode: 'class',
|
|
11
|
+
mode: 'jit',
|
|
12
|
+
theme: {
|
|
13
|
+
extend: {
|
|
14
|
+
colors: {
|
|
15
|
+
'button-bg': 'var(--color-button-bg)',
|
|
16
|
+
'button-text': 'var(--color-button-text)',
|
|
17
|
+
link: 'var(--color-link)',
|
|
18
|
+
panel: 'var(--color-panel)',
|
|
19
|
+
primary: 'var(--color-primary)',
|
|
20
|
+
},
|
|
21
|
+
fontFamily: {
|
|
22
|
+
sans: ['var(--font-inter)'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
plugins: [
|
|
27
|
+
plugin(({ addBase, addUtilities, theme }) => {
|
|
28
|
+
addBase({
|
|
29
|
+
body: {
|
|
30
|
+
'--color-button-bg': customization?.colors?.['button-bg'] ||
|
|
31
|
+
customization?.colors?.primary ||
|
|
32
|
+
theme('colors.indigo.800'),
|
|
33
|
+
'--color-button-text': customization?.colors?.['button-text'] || theme('colors.white'),
|
|
34
|
+
'--color-link': customization?.colors?.link || theme('colors.indigo.800'),
|
|
35
|
+
'--color-panel': theme('colors.white'),
|
|
36
|
+
'--color-primary': customization?.colors?.primary || theme('colors.indigo.800'),
|
|
37
|
+
},
|
|
38
|
+
'body.dark': {
|
|
39
|
+
'--color-panel': theme('colors.gray.700'),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
addUtilities({
|
|
43
|
+
'@keyframes show': {
|
|
44
|
+
from: {
|
|
45
|
+
opacity: '0',
|
|
46
|
+
transform: 'scale3d(.9,.9,.9)',
|
|
47
|
+
},
|
|
48
|
+
to: {
|
|
49
|
+
opacity: '1',
|
|
50
|
+
transform: 'scale3d(1,1,1)',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
'.show': {
|
|
54
|
+
animation: 'show 0.1s ease-in-out',
|
|
55
|
+
},
|
|
56
|
+
'@keyframes fade': {
|
|
57
|
+
from: {
|
|
58
|
+
opacity: '0',
|
|
59
|
+
},
|
|
60
|
+
to: {
|
|
61
|
+
opacity: '1',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
'.fade': {
|
|
65
|
+
animation: 'fade 0.2s ease-in-out',
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export default config;
|
package/package.json
CHANGED
|
@@ -1,77 +1,67 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"dev:ts": "tsc -p tsconfig.build.json -w",
|
|
69
|
-
"dev": "concurrently \"pnpm:dev:css\" \"pnpm:dev:ts\"",
|
|
70
|
-
"docs": "concurrently \"pnpm:dev:css\" \"pnpm:dev:storybook\"",
|
|
71
|
-
"lint": "tsc --noEmit && eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
|
|
72
|
-
"prepublishOnly": "pnpm build",
|
|
73
|
-
"prettier": "prettier --write \"./src/**/*.tsx\" \"./src/**/*.ts\"",
|
|
74
|
-
"start": "pnpm dev",
|
|
75
|
-
"test": "jest"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
2
|
+
"name": "@sqrzro/admin",
|
|
3
|
+
"version": "2.1.0-bz.11",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"postcss.js",
|
|
10
|
+
"tailwind.js",
|
|
11
|
+
"tailwind.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@sqrzro/components": "bz",
|
|
15
|
+
"@sqrzro/hooks": "bz",
|
|
16
|
+
"@sqrzro/interfaces": "bz",
|
|
17
|
+
"next": "^14.1.0",
|
|
18
|
+
"react": "^18.2.0",
|
|
19
|
+
"react-dom": "^18.2.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@babel/core": "^7.23.9",
|
|
23
|
+
"@babel/preset-env": "^7.23.9",
|
|
24
|
+
"@babel/preset-react": "^7.23.3",
|
|
25
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
26
|
+
"@sqrzro/eslint-plugin": "bz",
|
|
27
|
+
"@sqrzro/prettier-config": "bz",
|
|
28
|
+
"@sqrzro/tailwind-plugin": "bz",
|
|
29
|
+
"@storybook/addon-actions": "^7.6.17",
|
|
30
|
+
"@storybook/addon-essentials": "^7.6.17",
|
|
31
|
+
"@storybook/addon-interactions": "^7.6.17",
|
|
32
|
+
"@storybook/addon-links": "^7.6.17",
|
|
33
|
+
"@storybook/addon-mdx-gfm": "7.0.7",
|
|
34
|
+
"@storybook/react": "^7.6.17",
|
|
35
|
+
"@storybook/react-webpack5": "7.0.7",
|
|
36
|
+
"@storybook/testing-library": "^0.1.0",
|
|
37
|
+
"@testing-library/dom": "^8.20.1",
|
|
38
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
39
|
+
"@testing-library/react": "^13.4.0",
|
|
40
|
+
"@testing-library/user-event": "^14.5.2",
|
|
41
|
+
"@types/bcrypt": "^5.0.2",
|
|
42
|
+
"@types/jest": "^29.5.12",
|
|
43
|
+
"@types/node": "18.14.6",
|
|
44
|
+
"@types/react": "^18.2.57",
|
|
45
|
+
"babel-loader": "^8.3.0",
|
|
46
|
+
"concurrently": "^7.6.0",
|
|
47
|
+
"eslint": "^8.56.0",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"mockdate": "^3.0.5",
|
|
50
|
+
"prettier": "^3.2.5",
|
|
51
|
+
"rimraf": "^4.4.1",
|
|
52
|
+
"storybook": "^7.6.17",
|
|
53
|
+
"tailwindcss": "^3.4.1",
|
|
54
|
+
"typescript": "^5.3.3"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "pnpm clean && tsc -p tsconfig.build.json",
|
|
58
|
+
"clean": "rimraf ./dist",
|
|
59
|
+
"dev": "tsc -p tsconfig.build.json -w",
|
|
60
|
+
"docs": "storybook dev -p 6006",
|
|
61
|
+
"lint": "tsc --noEmit && eslint \"./src/**/*.tsx\" \"./src/**/*.ts\"",
|
|
62
|
+
"prettier": "prettier --write \"./src/**/*.tsx\" \"./src/**/*.ts\"",
|
|
63
|
+
"start": "pnpm dev",
|
|
64
|
+
"test": "jest",
|
|
65
|
+
"test:coverage": "jest --coverage"
|
|
66
|
+
}
|
|
67
|
+
}
|
package/postcss.js
ADDED
package/tailwind.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/styles/tailwind';
|
package/tailwind.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/styles/tailwind');
|
package/.babelrc.json
DELETED
package/.eslintignore
DELETED