@sqrzro/admin 4.0.0-alpha.1 → 4.0.0-alpha.13

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.
@@ -2,7 +2,8 @@ import type { AdminConfig, User } from '../../utility/interfaces';
2
2
  interface AdminAppLayoutProps {
3
3
  readonly children: React.ReactNode;
4
4
  readonly config?: AdminConfig;
5
+ readonly logo?: React.ReactNode;
5
6
  readonly userFn?: () => Promise<User>;
6
7
  }
7
- declare function AdminAppLayout({ children, config, userFn }: AdminAppLayoutProps): React.ReactElement;
8
+ declare function AdminAppLayout({ children, config, logo, userFn, }: AdminAppLayoutProps): React.ReactElement;
8
9
  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, config, userFn }) {
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: [_jsx(Link, { className: "h-9 w-9", href: "/", children: _jsx("span", { className: "sr-only", children: config?.app.name }) }), _jsx(AppNavigation, { data: config?.navigation || [] }), _jsx(Suspense, { children: _jsx(MePanel, { userFn: userFn }) })] }) }), _jsx("main", { className: "@container mb-10 block flex flex-1 flex-col", children: children })] }));
6
+ function AdminAppLayout({ children, config, logo, 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: config?.app.name })] }), _jsx(AppNavigation, { data: config?.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
- export type AdminLayoutProps<T> = Omit<PageProps<T>, 'children' | 'pageProps' | 'template'> & {
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
- export type AdminPageProps<T> = Omit<PageProps<T>, 'template'>;
3
- declare function AdminPage<T>(props: Readonly<AdminPageProps<T>>): React.ReactElement;
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: "@container -mt-16 flex flex-col gap-8", children: children }) })] }));
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,7 @@
1
+ interface AdminPanelProps {
2
+ actions?: React.ReactNode;
3
+ children: React.ReactNode;
4
+ title?: React.ReactNode;
5
+ }
6
+ declare function AdminPanel({ actions, children, title }: AdminPanelProps): React.ReactElement;
7
+ export default AdminPanel;
@@ -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,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RootLayout } from '@sqrzro/ui/components';
3
- import classNameConfig from '../../config';
3
+ import { registerClassNames } from '@sqrzro/ui/styles';
4
+ import classNameConfig from '../../styles/config';
5
+ registerClassNames(classNameConfig);
4
6
  function AdminRootLayout({ children }) {
5
- return _jsx(RootLayout, { classNameConfig: classNameConfig, children: children });
7
+ return _jsx(RootLayout, { children: children });
6
8
  }
7
9
  export default AdminRootLayout;
@@ -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 classNames } from './config';
2
+ export { default as classNames } from './styles/config';
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 classNames } from './config';
2
+ export { default as classNames } from './styles/config';
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,4 @@
1
+ import { WithAuthClassNames } from '@sqrzro/addon-auth';
2
+ import type { UIClassNames } from '@sqrzro/ui/styles';
3
+ declare const classNames: WithAuthClassNames<UIClassNames>;
4
+ export default classNames;
@@ -0,0 +1,280 @@
1
+ import { twx } from '@sqrzro/ui/styles';
2
+ const classNames = 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
+ },
17
+ auth: {
18
+ actions: 'mt-2 w-full',
19
+ footer: 'mt-2 text-center',
20
+ form: 'flex flex-col gap-6',
21
+ link: 'text-link font-semibold',
22
+ logo: 'row-start-2 mx-auto mx-auto flex h-12 w-32 w-48 items-end',
23
+ panel: 'row-start-3 flex w-screen max-w-sm flex-col gap-6 rounded-lg bg-white p-6 py-8 shadow-lg',
24
+ root: 'grid flex-1 grid-rows-[1fr_auto_auto_3fr] justify-center gap-8 bg-slate-800',
25
+ title: 'mb-1 text-center text-lg font-semibold leading-none',
26
+ },
27
+ badge: {
28
+ root: {
29
+ 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',
30
+ props: {
31
+ isDanger: 'border-red-300 from-red-100 to-red-200 text-red-700',
32
+ isError: 'border-red-300 from-red-100 to-red-200 text-red-700',
33
+ isInfo: 'border-sky-300 from-sky-100 to-sky-200 text-sky-700',
34
+ isSuccess: 'border-green-300 from-green-100 to-green-200 text-green-700',
35
+ isWarning: 'border-yellow-300 from-yellow-100 to-yellow-200 text-yellow-700',
36
+ },
37
+ },
38
+ dot: {
39
+ default: 'h-1.5 w-1.5 fill-slate-400',
40
+ props: {
41
+ isDanger: 'fill-red-400',
42
+ isError: 'fill-red-400',
43
+ isInfo: 'fill-sky-400',
44
+ isWarning: 'fill-yellow-400',
45
+ isSuccess: 'fill-green-400',
46
+ },
47
+ },
48
+ },
49
+ button: {
50
+ root: {
51
+ default: 'h-10 rounded border border-slate-300 bg-white px-5 text-sm text-slate-600',
52
+ props: {
53
+ isDanger: 'border-red-500 bg-white text-red-500',
54
+ isOnDark: 'border-slate-400 bg-transparent text-white hover:bg-white/10',
55
+ isPrimary: 'bg-linear-to-b hover:bg-button-bg-hover border border-none border-teal-500 from-teal-300 to-teal-400 font-semibold text-slate-800 shadow-sm transition-colors',
56
+ },
57
+ },
58
+ icon: '-ml-1.5 h-4 w-4',
59
+ },
60
+ calendar: {
61
+ header: 'relative mb-4 flex items-center justify-between',
62
+ title: 'absolute left-1/2 -translate-x-1/2 text-sm font-semibold',
63
+ day: { default: '', props: { isHighlighted: 'bg-red-200', isSelected: 'bg-blue-200' } },
64
+ control: 'h-4 w-4 rounded bg-red-200',
65
+ },
66
+ container: {
67
+ root: 'mx-auto w-full max-w-6xl px-8',
68
+ },
69
+ dropdown: {
70
+ item: {
71
+ default: 'block border-b border-slate-100 p-3 text-sm text-slate-700',
72
+ states: { isSelected: 'bg-slate-100' },
73
+ },
74
+ },
75
+ editableForm: {
76
+ root: 'page-content-block grid grid-cols-[25%_1fr] gap-20 rounded bg-white p-8 shadow',
77
+ title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
78
+ description: 'text-slate-600',
79
+ actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
80
+ },
81
+ editableFormField: {
82
+ root: 'grid grid-cols-[30%_1fr] gap-x-4 border-t border-slate-200 py-4',
83
+ label: 'flex items-center font-semibold',
84
+ field: 'col-start-2 flex min-h-10 items-center overflow-hidden',
85
+ },
86
+ emptyMessage: {
87
+ 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',
88
+ icon: {
89
+ default: 'mx-auto -mt-2 block block h-12 w-12 text-slate-300',
90
+ props: { isError: 'text-error' },
91
+ },
92
+ title: {
93
+ default: 'text-pretty text-xl font-semibold leading-tight',
94
+ props: { isError: 'text-error' },
95
+ },
96
+ description: 'text-pretty text-sm',
97
+ action: 'mt-2 flex justify-center',
98
+ },
99
+ filterBar: {
100
+ root: 'flex flex-wrap gap-2',
101
+ },
102
+ filterClear: {
103
+ root: 'absolute right-0 top-0 z-20 flex h-full w-8 select-none items-center justify-center',
104
+ icon: 'h-5 w-5 text-slate-100',
105
+ },
106
+ filterItem: {
107
+ root: {
108
+ 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',
109
+ props: {
110
+ isFocused: 'border-solid border-slate-400 bg-slate-700 pr-10',
111
+ isHighlighted: 'bg-slate-700',
112
+ },
113
+ },
114
+ value: 'border-l border-l-slate-300 pl-2 font-semibold',
115
+ },
116
+ filterPanel: {
117
+ root: 'min-w-56',
118
+ title: 'flex items-center gap-2 border-b border-slate-300 p-3 text-sm font-semibold',
119
+ footer: 'p-3',
120
+ },
121
+ filterSearch: {
122
+ icon: 'pointer-events-none absolute left-2 top-0 z-10 flex h-full items-center',
123
+ input: 'h-8 w-56 rounded-full border border-slate-400 pl-7 pr-3 text-xs text-white placeholder:text-slate-300',
124
+ },
125
+ form: {
126
+ root: 'flex flex-col gap-6',
127
+ },
128
+ formField: {
129
+ label: 'mb-2 flex justify-between font-semibold leading-none',
130
+ details: 'mb-2 text-xs font-normal text-slate-500',
131
+ optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
132
+ 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',
133
+ },
134
+ infoPanel: {
135
+ root: {
136
+ default: 'flex w-full gap-2 rounded border bg-gradient-to-br p-4 text-left',
137
+ props: {
138
+ isDanger: 'border-red-300 from-red-100 to-red-200 text-red-700',
139
+ isError: 'border-red-300 from-red-100 to-red-200 text-red-700',
140
+ isInfo: 'border-sky-300 from-sky-100 to-sky-200 text-sky-700',
141
+ isSuccess: 'border-green-300 from-green-100 to-green-200 text-green-700',
142
+ isWarning: 'border-yellow-300 from-yellow-100 to-yellow-200 text-yellow-700',
143
+ },
144
+ },
145
+ },
146
+ list: {
147
+ root: {
148
+ default: 'page-content-block flex flex-col gap-4',
149
+ props: { isMinimal: 'gap-0 border-t border-slate-200' },
150
+ },
151
+ },
152
+ listItem: {
153
+ root: {
154
+ default: 'rounded bg-white p-4 shadow',
155
+ props: {
156
+ isMinimal: 'border-b border-slate-200 pl-0 shadow-none',
157
+ isSelected: 'bg-primary/5',
158
+ },
159
+ },
160
+ actions: 'flex items-center justify-end pl-4',
161
+ primary: 'flex flex-col items-start gap-2',
162
+ secondary: 'flex flex-col items-end gap-1',
163
+ select: 'flex items-center px-4',
164
+ title: 'text-base font-semibold',
165
+ },
166
+ listItemMeta: {
167
+ root: 'flex flex-wrap items-center gap-x-4 gap-y-1 text-slate-500',
168
+ },
169
+ menu: {
170
+ link: 'block min-w-36 border-b border-slate-100 p-3 text-left text-sm text-slate-700',
171
+ },
172
+ modal: {
173
+ root: 'starting:open:backdrop:opacity-0 py-16 backdrop:bg-slate-700/50 backdrop:transition-all backdrop:duration-500 open:backdrop:opacity-100',
174
+ 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',
175
+ content: 'flex flex-col gap-6 [&_p]:text-pretty',
176
+ icon: 'text-slate-400',
177
+ title: 'flex items-center gap-2 border-b border-slate-200 pb-6 text-lg font-semibold',
178
+ actions: 'border-t border-slate-200 pt-6',
179
+ },
180
+ pagination: {
181
+ root: 'mx-auto flex w-full justify-between',
182
+ list: 'mx-auto flex flex-row items-center gap-1',
183
+ link: {
184
+ 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',
185
+ states: { isHighlighted: 'border-slate-200 bg-white shadow-sm' },
186
+ },
187
+ gap: 'flex h-9 w-9 items-center justify-center text-xs text-slate-400',
188
+ 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',
189
+ },
190
+ passwordInput: {
191
+ action: 'absolute inset-y-0 right-0 flex items-center px-3',
192
+ icon: {
193
+ default: 'h-6 w-6 overflow-hidden bg-red-500 bg-no-repeat indent-12',
194
+ states: { isSelected: 'bg-green-500' },
195
+ },
196
+ },
197
+ popover: {
198
+ root: {
199
+ default: 'show z-20 my-1 min-w-full rounded border border-slate-300 bg-white text-slate-700 shadow',
200
+ states: { isFocused: 'show-open' },
201
+ },
202
+ },
203
+ reference: {
204
+ root: { default: 'flex items-center gap-2', props: { isTitle: 'gap-4' } },
205
+ reference: {
206
+ default: 'rounded bg-slate-200 px-2 py-1 text-[70%]',
207
+ props: { isTitle: 'border border-slate-400 bg-transparent text-[60%] text-white' },
208
+ },
209
+ },
210
+ rootLayout: {
211
+ root: 'bg-slate-50 font-sans text-sm text-slate-800',
212
+ },
213
+ summary: {
214
+ root: 'relative grid gap-6',
215
+ item: 'relative rounded border border-slate-500 p-4 font-semibold text-white',
216
+ label: 'text-slate-300',
217
+ value: 'flex min-h-8 items-center text-2xl',
218
+ },
219
+ staticTextInput: {
220
+ root: {
221
+ default: 'text-md flex min-h-10 flex-col justify-center rounded border border-slate-300 bg-white p-3',
222
+ states: { isError: 'border-red-500' },
223
+ },
224
+ label: 'block leading-none',
225
+ details: 'mt-1.5 block text-xs leading-none text-slate-500',
226
+ placeholder: 'block leading-none text-slate-400',
227
+ },
228
+ switch: {
229
+ root: 'flex gap-4',
230
+ control: 'relative h-6 w-10 flex-none',
231
+ input: {
232
+ default: 'block h-full w-full cursor-pointer rounded-full bg-slate-300 transition-colors',
233
+ states: { isChecked: 'bg-primary' },
234
+ },
235
+ icon: {
236
+ 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',
237
+ states: { isChecked: 'translate-x-full' },
238
+ },
239
+ // label: 'flex min-h-6 flex-col justify-center',
240
+ // details: 'mt-1 block text-xs text-slate-500',
241
+ },
242
+ table: {
243
+ root: 'page-content-block rounded bg-white p-6 shadow',
244
+ row: {
245
+ default: 'bg-slate-50 odd:bg-slate-100',
246
+ props: { isSelected: 'bg-primary/10 odd:bg-primary/10' },
247
+ },
248
+ head: 'p-4 pt-0 text-left font-semibold leading-none',
249
+ cell: 'p-4',
250
+ actions: 'flex items-center justify-end',
251
+ },
252
+ tabs: {
253
+ root: '-mt-4 mb-8 border-b border-slate-700',
254
+ list: 'flex gap-4',
255
+ link: {
256
+ default: 'block border-b-4 border-transparent px-1 pb-2 font-semibold opacity-80 hover:opacity-100',
257
+ states: { isHighlighted: 'border-primary opacity-100' },
258
+ },
259
+ },
260
+ textArea: {
261
+ root: {
262
+ default: 'text-md focus:border-primary max-h-48 min-h-10 rounded border border-slate-300 px-3 py-2 placeholder-slate-400',
263
+ states: { isError: 'border-red-500' },
264
+ },
265
+ },
266
+ textInput: {
267
+ root: {
268
+ default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3 placeholder-slate-400',
269
+ states: { isError: 'border-red-500' },
270
+ },
271
+ prefix: {
272
+ default: 'peer-focus:border-primary relative -mr-1 rounded-l border border-slate-300 bg-white px-3 text-sm text-slate-600',
273
+ },
274
+ suffix: {
275
+ default: 'peer-focus:border-primary relative -ml-1 rounded-r border border-slate-300 bg-white px-3 text-sm text-slate-600',
276
+ },
277
+ loading: 'text-slate-400',
278
+ },
279
+ });
280
+ export default classNames;
@@ -0,0 +1,3 @@
1
+ @theme {
2
+ --color-primary: var(--color-teal-600);
3
+ }
@@ -1,4 +1,4 @@
1
- import { NavigationObject } from 'node_modules/@sqrzro/ui/dist/navigation/interfaces';
1
+ import type { NavigationObject } from '@sqrzro/ui/navigation';
2
2
  export interface AdminConfig {
3
3
  app: {
4
4
  name: string;
package/package.json CHANGED
@@ -1,33 +1,45 @@
1
1
  {
2
2
  "name": "@sqrzro/admin",
3
3
  "type": "module",
4
- "version": "4.0.0-alpha.1",
4
+ "version": "4.0.0-alpha.13",
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": {
12
21
  "next": "^16.1.6",
13
22
  "react": "^19.2.4",
14
- "react-dom": "^19.2.1",
15
- "@sqrzro/auth": "^4.0.0-alpha.1",
16
- "@sqrzro/ui": "^4.0.0-alpha.1"
23
+ "react-dom": "^19.2.4",
24
+ "tailwindcss": "^4.2.1",
25
+ "@sqrzro/addon-auth": "^4.0.0-alpha.3",
26
+ "@sqrzro/ui": "^4.0.0-alpha.38"
17
27
  },
18
28
  "devDependencies": {
19
- "@types/react": "^19.2.7",
29
+ "@types/react": "^19.2.14",
20
30
  "@types/react-dom": "^19.2.3",
21
31
  "concurrently": "^9.2.1",
22
- "prettier": "^3.7.4",
23
- "rimraf": "^6.1.2",
32
+ "cpx": "^1.5.0",
33
+ "prettier": "^3.8.1",
34
+ "rimraf": "^6.1.3",
24
35
  "tsc-alias": "^1.8.16",
25
36
  "typescript": "^5.9.3",
26
- "@sqrzro/prettier-config": "^4.0.0-alpha.1"
37
+ "@sqrzro/prettier-config": "^4.0.0-alpha.3"
27
38
  },
28
39
  "scripts": {
29
- "build": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias",
40
+ "build": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias && pnpm build:css",
41
+ "build:css": "cpx \"./src/**/*.css\" ./dist",
30
42
  "clean": "rimraf ./dist",
31
- "dev": "(concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -w\")"
43
+ "dev": "pnpm build:css && (concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -w\")"
32
44
  }
33
45
  }
package/dist/config.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { RegisteredClassNames } from '@sqrzro/ui/styles';
2
- declare const classNames: RegisteredClassNames;
3
- export default classNames;
package/dist/config.js DELETED
@@ -1,136 +0,0 @@
1
- import { tw, twx } from '@sqrzro/ui/styles';
2
- const classNames = twx({
3
- actionList: {
4
- root: tw('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
- highlighted: 'before:bg-primary text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-1',
13
- },
14
- },
15
- button: {
16
- root: {
17
- danger: 'border-red-500 bg-white text-red-500',
18
- default: 'h-10 rounded border border-slate-300 bg-white px-5 text-sm text-slate-600',
19
- primary: 'bg-button-bg hover:bg-button-bg-hover text-button-text border-none font-semibold transition-colors',
20
- link: 'text-link h-auto w-auto border-0 bg-transparent p-0',
21
- },
22
- icon: '-ml-1.5 h-4 w-4',
23
- },
24
- container: {
25
- root: 'mx-auto w-full max-w-6xl px-8',
26
- },
27
- dropdown: {
28
- item: {
29
- default: 'block border-b border-slate-100 p-3 text-sm text-slate-700',
30
- selected: 'bg-slate-100',
31
- },
32
- },
33
- editableForm: {
34
- root: 'grid grid-cols-[25%_1fr] gap-20 rounded bg-white p-8 shadow',
35
- title: 'mb-8 text-lg font-semibold leading-none text-slate-700',
36
- description: 'text-slate-600',
37
- actions: 'flex justify-end gap-2 border-t border-slate-200 pt-4',
38
- },
39
- editableFormField: {
40
- root: 'grid grid-cols-[30%_1fr] gap-x-4 border-t border-slate-200 py-4',
41
- label: 'flex items-center font-semibold',
42
- field: 'col-start-2 flex min-h-10 items-center overflow-hidden',
43
- },
44
- filterBar: {
45
- root: 'bg-red-500',
46
- },
47
- form: {
48
- root: 'flex flex-col gap-6',
49
- },
50
- formField: {
51
- label: 'mb-2 flex justify-between font-semibold leading-none',
52
- details: 'mb-2 text-xs font-normal text-slate-500',
53
- optional: 'pl-2 text-xs font-normal leading-none text-slate-500',
54
- 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',
55
- },
56
- listItem: {
57
- root: { default: 'bg-red-500' },
58
- },
59
- modal: {
60
- root: 'starting:open:backdrop:opacity-0 py-16 backdrop:bg-slate-700/50 backdrop:transition-all backdrop:duration-500 open:backdrop:opacity-100',
61
- panel: 'show row-start-2 mx-auto flex w-full max-w-lg flex-col gap-6 rounded bg-white p-6 shadow-xl',
62
- content: 'flex flex-col gap-6 [&_p]:text-pretty',
63
- icon: 'text-slate-400',
64
- title: 'flex items-center gap-2 border-b border-slate-200 pb-6 text-lg font-semibold',
65
- actions: 'border-t border-slate-200 pt-6',
66
- },
67
- pagination: {
68
- root: 'mx-auto flex w-full justify-between',
69
- list: 'mx-auto flex flex-row items-center gap-1',
70
- link: {
71
- 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',
72
- highlighted: 'border-slate-200 bg-white shadow-sm',
73
- },
74
- gap: 'flex h-9 w-9 items-center justify-center text-xs text-slate-400',
75
- 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',
76
- },
77
- popover: {
78
- root: { default: 'w-full bg-red-500' },
79
- },
80
- rootLayout: {
81
- root: 'overflow-x-hidden overflow-y-scroll bg-slate-50 font-sans text-sm text-slate-800 has-[[data-modal][open]]:overflow-hidden',
82
- content: 'flex min-h-screen flex-col',
83
- },
84
- staticTextInput: {
85
- root: {
86
- default: 'text-md flex min-h-10 flex-col justify-center rounded border border-slate-300 bg-white p-3',
87
- error: 'border-red-500',
88
- },
89
- label: 'block leading-none',
90
- meta: 'mt-1.5 block text-xs leading-none text-slate-500',
91
- placeholder: 'block leading-none text-slate-400',
92
- },
93
- switch: {
94
- root: tw('flex', 'gap-4'),
95
- control: tw('relative flex-none', 'h-6 w-10'),
96
- input: {
97
- default: tw('block h-full w-full cursor-pointer rounded-full transition-colors', 'bg-slate-300'),
98
- checked: tw('bg-primary'),
99
- },
100
- icon: {
101
- 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'),
102
- checked: tw('translate-x-full'),
103
- },
104
- label: 'flex min-h-6 flex-col justify-center',
105
- details: 'mt-1 block text-xs text-slate-500',
106
- },
107
- table: {
108
- root: 'rounded bg-white p-8 shadow',
109
- row: {
110
- default: 'odd:bg-slate-100',
111
- },
112
- cell: 'p-4',
113
- },
114
- tabs: {
115
- root: '-mt-4 mb-8 border-b border-slate-700',
116
- list: 'flex gap-4',
117
- link: {
118
- default: 'block border-b-4 border-transparent px-1 pb-2 font-semibold opacity-80 hover:opacity-100',
119
- highlighted: 'border-primary opacity-100',
120
- },
121
- },
122
- textInput: {
123
- root: {
124
- default: 'text-md focus:border-primary h-10 rounded border border-slate-300 px-3 placeholder-slate-400',
125
- error: 'border-red-500',
126
- },
127
- prefix: {
128
- default: 'peer-focus:border-primary relative -mr-1 rounded-l border border-slate-300 bg-white px-3 text-sm text-slate-600',
129
- },
130
- suffix: {
131
- default: 'peer-focus:border-primary relative -ml-1 rounded-r border border-slate-300 bg-white px-3 text-sm text-slate-600',
132
- },
133
- loading: 'text-slate-400',
134
- },
135
- });
136
- export default classNames;