@kirill.konshin/mui 0.0.3 → 0.0.4
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/README.md +87 -0
- package/dist/admin/appProvider.d.ts +18 -0
- package/dist/admin/appProvider.d.ts.map +1 -0
- package/dist/admin/appProvider.js +32 -0
- package/dist/admin/appProvider.js.map +1 -0
- package/dist/admin/dashboardLayout.d.ts +8 -0
- package/dist/admin/dashboardLayout.d.ts.map +1 -0
- package/dist/admin/dashboardLayout.js +17 -0
- package/dist/admin/dashboardLayout.js.map +1 -0
- package/dist/admin/index.d.ts +4 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/signInPage.d.ts +22 -0
- package/dist/admin/signInPage.d.ts.map +1 -0
- package/dist/admin/signInPage.js +60 -0
- package/dist/admin/signInPage.js.map +1 -0
- package/dist/appBarOffset.d.ts.map +1 -1
- package/dist/appBarOffset.js.map +1 -1
- package/dist/formControlFieldset.d.ts.map +1 -1
- package/dist/formControlFieldset.js.map +1 -1
- package/dist/formControlFieldset.stories.d.ts.map +1 -1
- package/dist/formLabelLegend.d.ts.map +1 -1
- package/dist/formLabelLegend.js.map +1 -1
- package/dist/formLabelLegend.stories.d.ts.map +1 -1
- package/dist/genericControl.d.ts.map +1 -1
- package/dist/genericControl.js +1 -1
- package/dist/genericControl.js.map +1 -1
- package/dist/genericControl.stories.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/readOnly.d.ts.map +1 -1
- package/dist/readOnly.js.map +1 -1
- package/dist/readOnly.stories.d.ts.map +1 -1
- package/package.json +23 -2
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @kirill.konshin/mui
|
|
2
|
+
|
|
3
|
+
MUI utilities (main entry) and Toolpad admin components (`/admin` entry).
|
|
4
|
+
|
|
5
|
+
# Admin — `@kirill.konshin/mui/admin`
|
|
6
|
+
|
|
7
|
+
Preconfigured [`@toolpad/core`](https://mui.com/toolpad/core/introduction/) building blocks for password-protected admin apps, wired to [`@kirill.konshin/auth`](https://github.com/kirill-konshin/utils/tree/main/packages/auth):
|
|
8
|
+
|
|
9
|
+
- `AdminAppProvider` — `NextAppProvider` with sign-out built from a `logoutAction` server action
|
|
10
|
+
- `AdminDashboardLayout` — `DashboardLayout` (sidebar collapsed by default) wrapping children in `PageContainer`; also works around Toolpad 0.16 modules missing `'use client'` banners
|
|
11
|
+
- `AdminSignInPage` — `SignInPage` for password-only login: single credentials provider, no email/rememberMe, takes `auth.loginFormAction`, renders setup instructions when `isConfigured` is false; on a dedicated login page pass `state={auth.getReturnTo(await searchParams)}` to return users to the page they came from
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
// app/admin/layout.tsx — Server Component, passes the actions from @/auth down as props
|
|
15
|
+
import { auth, loginAction, logoutAction } from '@/auth';
|
|
16
|
+
import { AdminShell } from './AdminShell';
|
|
17
|
+
import { AdminSignIn } from './AdminSignIn';
|
|
18
|
+
|
|
19
|
+
export default async function AdminLayout({ children }: LayoutProps<'/admin'>) {
|
|
20
|
+
const isConfigured = auth.isConfigured();
|
|
21
|
+
if (!isConfigured || !(await auth.isAuthenticated())) {
|
|
22
|
+
return <AdminSignIn loginAction={loginAction} isConfigured={isConfigured} />;
|
|
23
|
+
}
|
|
24
|
+
return <AdminShell logoutAction={logoutAction}>{children}</AdminShell>;
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
// app/admin/AdminShell.tsx — theme/navigation/branding stay app-specific
|
|
30
|
+
'use client';
|
|
31
|
+
|
|
32
|
+
import type { PasswordAuth } from '@kirill.konshin/auth';
|
|
33
|
+
import { AdminAppProvider, AdminDashboardLayout } from '@kirill.konshin/mui/admin';
|
|
34
|
+
import DashboardIcon from '@mui/icons-material/Dashboard';
|
|
35
|
+
|
|
36
|
+
const NAVIGATION = [{ segment: 'admin', title: 'Dashboard', icon: <DashboardIcon /> }];
|
|
37
|
+
|
|
38
|
+
export function AdminShell({
|
|
39
|
+
children,
|
|
40
|
+
logoutAction,
|
|
41
|
+
}: {
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
logoutAction: PasswordAuth['logout'];
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<AdminAppProvider
|
|
47
|
+
branding={{ title: 'Admin', homeUrl: '/admin' }}
|
|
48
|
+
navigation={NAVIGATION}
|
|
49
|
+
logoutAction={logoutAction}
|
|
50
|
+
>
|
|
51
|
+
<AdminDashboardLayout>{children}</AdminDashboardLayout>
|
|
52
|
+
</AdminAppProvider>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
// app/admin/AdminSignIn.tsx
|
|
59
|
+
'use client';
|
|
60
|
+
|
|
61
|
+
import type { PasswordAuth } from '@kirill.konshin/auth';
|
|
62
|
+
import { AdminAppProvider, AdminSignInPage } from '@kirill.konshin/mui/admin';
|
|
63
|
+
|
|
64
|
+
export function AdminSignIn({
|
|
65
|
+
loginAction,
|
|
66
|
+
isConfigured,
|
|
67
|
+
}: {
|
|
68
|
+
loginAction: PasswordAuth['loginFormAction'];
|
|
69
|
+
isConfigured: boolean;
|
|
70
|
+
}) {
|
|
71
|
+
return (
|
|
72
|
+
<AdminAppProvider branding={{ title: 'Admin' }}>
|
|
73
|
+
<AdminSignInPage loginAction={loginAction} isConfigured={isConfigured} />
|
|
74
|
+
</AdminAppProvider>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Root layout still needs `AppRouterCacheProvider` from `@mui/material-nextjs/v15-appRouter` (with `options={{ enableCssLayer: true }}`) and your theme.
|
|
80
|
+
|
|
81
|
+
# Utilities (main entry)
|
|
82
|
+
|
|
83
|
+
`AppBarOffset`, `FormControlFieldset`, `FormLabelLegend`, `GenericControl`, `ReadOnly` — see stories.
|
|
84
|
+
|
|
85
|
+
## Prior Art
|
|
86
|
+
|
|
87
|
+
https://codesandbox.io/p/sandbox/l7vykxl57q MUI v4
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { NextAppProvider } from '@toolpad/core/nextjs';
|
|
3
|
+
export type AdminAppProviderProps = ComponentProps<typeof NextAppProvider> & {
|
|
4
|
+
/** Server action that destroys the session, wired into Toolpad `authentication.signOut` */
|
|
5
|
+
logoutAction?: () => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Login page (`auth.urls.login`) — Toolpad calls `authentication.signIn` from the account menu
|
|
8
|
+
* when no session is present, and the sign-in UI is `AdminSignInPage` living there. Default `/login`
|
|
9
|
+
*/
|
|
10
|
+
loginUrl?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* `NextAppProvider` preconfigured for password-protected admin apps: pass `logoutAction` (e.g.
|
|
14
|
+
* `auth.logout` re-exported from a `'use server'` file) to get a sign-out button with a default
|
|
15
|
+
* `Admin` session; `authentication`/`session` props still win when provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AdminAppProvider: FC<AdminAppProviderProps>;
|
|
18
|
+
//# sourceMappingURL=appProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appProvider.d.ts","sourceRoot":"","sources":["../../src/admin/appProvider.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,cAAc,EAAE,KAAK,EAAE,EAAiB,MAAM,OAAO,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IACzE,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAyBrD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { memo, useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { NextAppProvider } from "@toolpad/core/nextjs";
|
|
5
|
+
import { useRouter } from "next/navigation";
|
|
6
|
+
//#region src/admin/appProvider.tsx
|
|
7
|
+
var DEFAULT_SESSION = { user: { name: "Admin" } };
|
|
8
|
+
/**
|
|
9
|
+
* `NextAppProvider` preconfigured for password-protected admin apps: pass `logoutAction` (e.g.
|
|
10
|
+
* `auth.logout` re-exported from a `'use server'` file) to get a sign-out button with a default
|
|
11
|
+
* `Admin` session; `authentication`/`session` props still win when provided.
|
|
12
|
+
*/
|
|
13
|
+
var AdminAppProvider = memo(function AdminAppProvider({ logoutAction, loginUrl = "/login", authentication, session, ...props }) {
|
|
14
|
+
const router = useRouter();
|
|
15
|
+
const defaultAuthentication = useMemo(() => logoutAction && {
|
|
16
|
+
signIn: () => router.push(loginUrl),
|
|
17
|
+
signOut: () => void logoutAction()
|
|
18
|
+
}, [
|
|
19
|
+
logoutAction,
|
|
20
|
+
loginUrl,
|
|
21
|
+
router
|
|
22
|
+
]);
|
|
23
|
+
return /* @__PURE__ */ jsx(NextAppProvider, {
|
|
24
|
+
authentication: authentication ?? defaultAuthentication,
|
|
25
|
+
session: session ?? (logoutAction ? DEFAULT_SESSION : void 0),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { AdminAppProvider };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=appProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appProvider.js","names":[],"sources":["../../src/admin/appProvider.tsx"],"sourcesContent":["'use client';\n\nimport React, { type ComponentProps, type FC, memo, useMemo } from 'react';\n\nimport { type Authentication, type Session } from '@toolpad/core/AppProvider';\nimport { NextAppProvider } from '@toolpad/core/nextjs';\nimport { useRouter } from 'next/navigation';\n\nexport type AdminAppProviderProps = ComponentProps<typeof NextAppProvider> & {\n /** Server action that destroys the session, wired into Toolpad `authentication.signOut` */\n logoutAction?: () => Promise<void>;\n /**\n * Login page (`auth.urls.login`) — Toolpad calls `authentication.signIn` from the account menu\n * when no session is present, and the sign-in UI is `AdminSignInPage` living there. Default `/login`\n */\n loginUrl?: string;\n};\n\nconst DEFAULT_SESSION: Session = { user: { name: 'Admin' } };\n\n/**\n * `NextAppProvider` preconfigured for password-protected admin apps: pass `logoutAction` (e.g.\n * `auth.logout` re-exported from a `'use server'` file) to get a sign-out button with a default\n * `Admin` session; `authentication`/`session` props still win when provided.\n */\nexport const AdminAppProvider: FC<AdminAppProviderProps> = memo(function AdminAppProvider({\n logoutAction,\n loginUrl = '/login',\n authentication,\n session,\n ...props\n}) {\n const router = useRouter();\n\n const defaultAuthentication = useMemo<Authentication | undefined>(\n () =>\n logoutAction && {\n signIn: () => router.push(loginUrl), // the login page renders AdminSignInPage\n signOut: () => void logoutAction(),\n },\n [logoutAction, loginUrl, router],\n );\n\n return (\n <NextAppProvider\n authentication={authentication ?? defaultAuthentication}\n session={session ?? (logoutAction ? DEFAULT_SESSION : undefined)}\n {...props}\n />\n );\n});\n"],"mappings":";;;;;;AAkBA,IAAM,kBAA2B,EAAE,MAAM,EAAE,MAAM,QAAQ,EAAE;;;;;;AAO3D,IAAa,mBAA8C,KAAK,SAAS,iBAAiB,EACtF,cACA,WAAW,UACX,gBACA,SACA,GAAG,SACJ;CACC,MAAM,SAAS,UAAU;CAEzB,MAAM,wBAAwB,cAEtB,gBAAgB;EACZ,cAAc,OAAO,KAAK,QAAQ;EAClC,eAAe,KAAK,aAAa;CACrC,GACJ;EAAC;EAAc;EAAU;CAAM,CACnC;CAEA,OACI,oBAAC,iBAAD;EACI,gBAAgB,kBAAkB;EAClC,SAAS,YAAY,eAAe,kBAAkB,KAAA;EACtD,GAAI;CACP,CAAA;AAET,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { DashboardLayout } from '@toolpad/core/DashboardLayout';
|
|
3
|
+
export type AdminDashboardLayoutProps = ComponentProps<typeof DashboardLayout> & {
|
|
4
|
+
/** Wrap children in Toolpad `PageContainer`, default true */
|
|
5
|
+
pageContainer?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const AdminDashboardLayout: FC<AdminDashboardLayoutProps>;
|
|
8
|
+
//# sourceMappingURL=dashboardLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboardLayout.d.ts","sourceRoot":"","sources":["../../src/admin/dashboardLayout.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,cAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,GAAG;IAC7E,6DAA6D;IAC7D,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAKF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAU7D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { DashboardLayout } from "@toolpad/core/DashboardLayout";
|
|
5
|
+
import { PageContainer } from "@toolpad/core/PageContainer";
|
|
6
|
+
//#region src/admin/dashboardLayout.tsx
|
|
7
|
+
var AdminDashboardLayout = memo(function AdminDashboardLayout({ children, pageContainer = true, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(DashboardLayout, {
|
|
9
|
+
defaultSidebarCollapsed: true,
|
|
10
|
+
...props,
|
|
11
|
+
children: pageContainer ? /* @__PURE__ */ jsx(PageContainer, { children }) : children
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AdminDashboardLayout };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=dashboardLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboardLayout.js","names":[],"sources":["../../src/admin/dashboardLayout.tsx"],"sourcesContent":["'use client';\n\nimport React, { type ComponentProps, type FC, memo } from 'react';\n\nimport { DashboardLayout } from '@toolpad/core/DashboardLayout';\nimport { PageContainer } from '@toolpad/core/PageContainer';\n\nexport type AdminDashboardLayoutProps = ComponentProps<typeof DashboardLayout> & {\n /** Wrap children in Toolpad `PageContainer`, default true */\n pageContainer?: boolean;\n};\n\n// Client wrapper is mandatory: @toolpad/core ships some DashboardLayout modules without\n// 'use client' banners (AppTitle, DashboardHeader — verified still missing in 0.16), which crash\n// when evaluated in the server graph. Re-check on Toolpad upgrades.\nexport const AdminDashboardLayout: FC<AdminDashboardLayoutProps> = memo(function AdminDashboardLayout({\n children,\n pageContainer = true,\n ...props\n}) {\n return (\n <DashboardLayout defaultSidebarCollapsed {...props}>\n {pageContainer ? <PageContainer>{children}</PageContainer> : children}\n </DashboardLayout>\n );\n});\n"],"mappings":";;;;;;AAeA,IAAa,uBAAsD,KAAK,SAAS,qBAAqB,EAClG,UACA,gBAAgB,MAChB,GAAG,SACJ;CACC,OACI,oBAAC,iBAAD;EAAiB,yBAAA;EAAwB,GAAI;YACxC,gBAAgB,oBAAC,eAAD,EAAgB,SAAwB,CAAA,IAAI;CAChD,CAAA;AAEzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps, FC } from 'react';
|
|
2
|
+
import { PasswordAuth } from '@kirill.konshin/auth';
|
|
3
|
+
import { SignInPage } from '@toolpad/core/SignInPage';
|
|
4
|
+
type SignInPageProps = ComponentProps<typeof SignInPage>;
|
|
5
|
+
export type AdminSignInPageProps = Omit<SignInPageProps, 'signIn'> & {
|
|
6
|
+
/** `auth.loginFormAction` from `@kirill.konshin/auth`, re-exported from a `'use server'` file */
|
|
7
|
+
loginAction: PasswordAuth['loginFormAction'];
|
|
8
|
+
/** Pass `auth.isConfigured()` to render setup instructions instead of the form, default true */
|
|
9
|
+
isConfigured?: boolean;
|
|
10
|
+
/** Subtitle shown when not configured */
|
|
11
|
+
notConfiguredSubtitle?: string;
|
|
12
|
+
/** Sanitized return URL (`auth.getState(await searchParams)`), threaded into the login form */
|
|
13
|
+
state?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Toolpad `SignInPage` preconfigured for the password-only login of `@kirill.konshin/auth`: single
|
|
17
|
+
* credentials provider, no email/rememberMe fields, errors surfaced through the form. On success
|
|
18
|
+
* `loginAction` redirects (handled by Next.js), on failure its message is shown.
|
|
19
|
+
*/
|
|
20
|
+
export declare const AdminSignInPage: FC<AdminSignInPageProps>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=signInPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signInPage.d.ts","sourceRoot":"","sources":["../../src/admin/signInPage.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,KAAK,cAAc,EAAE,KAAK,EAAE,EAAqB,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GAAG;IACjE,iGAAiG;IACjG,WAAW,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC7C,gGAAgG;IAChG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA2DnD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { STATE_PARAM } from "@kirill.konshin/auth/client";
|
|
5
|
+
import { formLabelClasses } from "@mui/material/FormLabel";
|
|
6
|
+
import { SignInPage } from "@toolpad/core/SignInPage";
|
|
7
|
+
//#region src/admin/signInPage.tsx
|
|
8
|
+
var DEFAULT_PROVIDERS = [{
|
|
9
|
+
id: "credentials",
|
|
10
|
+
name: "password"
|
|
11
|
+
}];
|
|
12
|
+
var NOT_CONFIGURED_SUBTITLE = "Set ADMIN_PASSWORD and a SESSION_SECRET of at least 32 characters, then restart.";
|
|
13
|
+
/**
|
|
14
|
+
* Toolpad `SignInPage` preconfigured for the password-only login of `@kirill.konshin/auth`: single
|
|
15
|
+
* credentials provider, no email/rememberMe fields, errors surfaced through the form. On success
|
|
16
|
+
* `loginAction` redirects (handled by Next.js), on failure its message is shown.
|
|
17
|
+
*/
|
|
18
|
+
var AdminSignInPage = memo(function AdminSignInPage({ loginAction, isConfigured = true, notConfiguredSubtitle = NOT_CONFIGURED_SUBTITLE, providers = DEFAULT_PROVIDERS, state, localeText, slots, slotProps, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(SignInPage, {
|
|
20
|
+
signIn: useCallback(async (_provider, formData) => {
|
|
21
|
+
if (!(formData instanceof FormData)) return { error: "Password is required" };
|
|
22
|
+
if (state) formData.set(STATE_PARAM, state);
|
|
23
|
+
const error = await loginAction(null, formData);
|
|
24
|
+
return error ? { error } : {};
|
|
25
|
+
}, [loginAction, state]),
|
|
26
|
+
providers: isConfigured ? providers : [],
|
|
27
|
+
localeText: isConfigured ? localeText : {
|
|
28
|
+
signInTitle: "Authentication needs configuration",
|
|
29
|
+
signInSubtitle: notConfiguredSubtitle,
|
|
30
|
+
...localeText
|
|
31
|
+
},
|
|
32
|
+
slots: {
|
|
33
|
+
emailField: () => null,
|
|
34
|
+
rememberMe: () => null,
|
|
35
|
+
subtitle: () => null,
|
|
36
|
+
...slots
|
|
37
|
+
},
|
|
38
|
+
slotProps: {
|
|
39
|
+
...slotProps,
|
|
40
|
+
form: {
|
|
41
|
+
noValidate: true,
|
|
42
|
+
...slotProps?.form
|
|
43
|
+
},
|
|
44
|
+
passwordField: {
|
|
45
|
+
autoFocus: true,
|
|
46
|
+
sx: { [`& .${formLabelClasses.root}`]: { top: "-2px" } },
|
|
47
|
+
...slotProps?.passwordField
|
|
48
|
+
},
|
|
49
|
+
submitButton: {
|
|
50
|
+
variant: "contained",
|
|
51
|
+
...slotProps?.submitButton
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
//#endregion
|
|
58
|
+
export { AdminSignInPage };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=signInPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signInPage.js","names":[],"sources":["../../src/admin/signInPage.tsx"],"sourcesContent":["'use client';\n\nimport React, { type ComponentProps, type FC, memo, useCallback } from 'react';\n\nimport { type PasswordAuth } from '@kirill.konshin/auth';\nimport { STATE_PARAM } from '@kirill.konshin/auth/client';\nimport { formLabelClasses } from '@mui/material/FormLabel';\nimport { SignInPage } from '@toolpad/core/SignInPage';\n\ntype SignInPageProps = ComponentProps<typeof SignInPage>;\n\nexport type AdminSignInPageProps = Omit<SignInPageProps, 'signIn'> & {\n /** `auth.loginFormAction` from `@kirill.konshin/auth`, re-exported from a `'use server'` file */\n loginAction: PasswordAuth['loginFormAction'];\n /** Pass `auth.isConfigured()` to render setup instructions instead of the form, default true */\n isConfigured?: boolean;\n /** Subtitle shown when not configured */\n notConfiguredSubtitle?: string;\n /** Sanitized return URL (`auth.getState(await searchParams)`), threaded into the login form */\n state?: string;\n};\n\nconst DEFAULT_PROVIDERS: SignInPageProps['providers'] = [{ id: 'credentials', name: 'password' }];\n\nconst NOT_CONFIGURED_SUBTITLE = 'Set ADMIN_PASSWORD and a SESSION_SECRET of at least 32 characters, then restart.';\n\n/**\n * Toolpad `SignInPage` preconfigured for the password-only login of `@kirill.konshin/auth`: single\n * credentials provider, no email/rememberMe fields, errors surfaced through the form. On success\n * `loginAction` redirects (handled by Next.js), on failure its message is shown.\n */\nexport const AdminSignInPage: FC<AdminSignInPageProps> = memo(function AdminSignInPage({\n loginAction,\n isConfigured = true,\n notConfiguredSubtitle = NOT_CONFIGURED_SUBTITLE,\n providers = DEFAULT_PROVIDERS,\n state,\n localeText,\n slots,\n slotProps,\n ...props\n}) {\n const signIn = useCallback<NonNullable<SignInPageProps['signIn']>>(\n async (_provider, formData) => {\n if (!(formData instanceof FormData)) return { error: 'Password is required' };\n // thread the return URL through the form only — never store it in the session,\n // multiple tabs logging in concurrently would clash\n if (state) formData.set(STATE_PARAM, state);\n const error = await loginAction(null, formData);\n return error ? { error } : {};\n },\n [loginAction, state],\n );\n\n return (\n <SignInPage\n signIn={signIn}\n providers={isConfigured ? providers : []}\n localeText={\n isConfigured\n ? localeText\n : {\n signInTitle: 'Authentication needs configuration',\n signInSubtitle: notConfiguredSubtitle,\n ...localeText,\n }\n }\n slots={{\n emailField: () => null,\n rememberMe: () => null,\n subtitle: () => null,\n ...slots,\n }}\n slotProps={{\n ...slotProps,\n // FIXME https://github.com/mui/toolpad/issues/4572 — still relevant in 0.16:\n // browser validation popups fight the server-side errors (noValidate is settable\n // declaratively through the form slot) and the password label renders misaligned;\n // re-check on Toolpad upgrades\n form: { noValidate: true, ...slotProps?.form },\n passwordField: {\n autoFocus: true,\n sx: { [`& .${formLabelClasses.root}`]: { top: '-2px' } },\n ...slotProps?.passwordField,\n },\n submitButton: { variant: 'contained', ...slotProps?.submitButton },\n }}\n {...props}\n />\n );\n});\n"],"mappings":";;;;;;;AAsBA,IAAM,oBAAkD,CAAC;CAAE,IAAI;CAAe,MAAM;AAAW,CAAC;AAEhG,IAAM,0BAA0B;;;;;;AAOhC,IAAa,kBAA4C,KAAK,SAAS,gBAAgB,EACnF,aACA,eAAe,MACf,wBAAwB,yBACxB,YAAY,mBACZ,OACA,YACA,OACA,WACA,GAAG,SACJ;CAaC,OACI,oBAAC,YAAD;EACY,QAdD,YACX,OAAO,WAAW,aAAa;GAC3B,IAAI,EAAE,oBAAoB,WAAW,OAAO,EAAE,OAAO,uBAAuB;GAG5E,IAAI,OAAO,SAAS,IAAI,aAAa,KAAK;GAC1C,MAAM,QAAQ,MAAM,YAAY,MAAM,QAAQ;GAC9C,OAAO,QAAQ,EAAE,MAAM,IAAI,CAAC;EAChC,GACA,CAAC,aAAa,KAAK,CAKP;EACR,WAAW,eAAe,YAAY,CAAC;EACvC,YACI,eACM,aACA;GACI,aAAa;GACb,gBAAgB;GAChB,GAAG;EACP;EAEV,OAAO;GACH,kBAAkB;GAClB,kBAAkB;GAClB,gBAAgB;GAChB,GAAG;EACP;EACA,WAAW;GACP,GAAG;GAKH,MAAM;IAAE,YAAY;IAAM,GAAG,WAAW;GAAK;GAC7C,eAAe;IACX,WAAW;IACX,IAAI,GAAG,MAAM,iBAAiB,SAAS,EAAE,KAAK,OAAO,EAAE;IACvD,GAAG,WAAW;GAClB;GACA,cAAc;IAAE,SAAS;IAAa,GAAG,WAAW;GAAa;EACrE;EACA,GAAI;CACP,CAAA;AAET,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appBarOffset.d.ts","sourceRoot":"","sources":["../src/appBarOffset.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"appBarOffset.d.ts","sourceRoot":"","sources":["../src/appBarOffset.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEzC,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAE7C,CAAC"}
|
package/dist/appBarOffset.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appBarOffset.js","names":[],"sources":["../src/appBarOffset.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport { default as Box
|
|
1
|
+
{"version":3,"file":"appBarOffset.js","names":[],"sources":["../src/appBarOffset.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { type BoxProps, default as Box } from '@mui/material/Box';\n\nexport type AppBarOffsetProps = BoxProps;\n\nexport const AppBarOffset: FC<AppBarOffsetProps> = memo(function AppBarOffset({ sx, ...props }) {\n return <Box {...props} sx={[({ mixins }) => mixins.toolbar, ...(Array.isArray(sx) ? sx : [sx])]} />;\n});\n"],"mappings":";;;;AAMA,IAAa,eAAsC,KAAK,SAAS,aAAa,EAAE,IAAI,GAAG,SAAS;CAC5F,OAAO,oBAAC,KAAD;EAAK,GAAI;EAAO,IAAI,EAAE,EAAE,aAAa,OAAO,SAAS,GAAI,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,EAAE,CAAE;CAAI,CAAA;AACtG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formControlFieldset.d.ts","sourceRoot":"","sources":["../src/formControlFieldset.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"formControlFieldset.d.ts","sourceRoot":"","sources":["../src/formControlFieldset.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAI7C,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAmB3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formControlFieldset.js","names":[],"sources":["../src/formControlFieldset.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"formControlFieldset.js","names":[],"sources":["../src/formControlFieldset.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { inputClasses } from '@mui/material/Input';\n\nimport { GenericControl, type GenericControlProps } from './genericControl';\n\nexport type FormControlFieldsetProps = GenericControlProps;\n\nexport const FormControlFieldset: FC<FormControlFieldsetProps> = memo(function FormControlFieldset({\n children,\n sx,\n ...props\n}) {\n return (\n <GenericControl\n {...props}\n component=\"fieldset\"\n sx={{\n ...sx,\n [`legend + .${inputClasses.root}`]: {\n marginTop: 2, //FIXME 16px, hardcoded from @mui/material/Input/Input.js @ 59\n },\n }}\n >\n {children}\n </GenericControl>\n );\n});\n"],"mappings":";;;;;AAQA,IAAa,sBAAoD,KAAK,SAAS,oBAAoB,EAC/F,UACA,IACA,GAAG,SACJ;CACC,OACI,oBAAC,gBAAD;EACI,GAAI;EACJ,WAAU;EACV,IAAI;GACA,GAAG;IACF,aAAa,aAAa,SAAS,EAChC,WAAW,EACf;EACJ;EAEC;CACW,CAAA;AAExB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formControlFieldset.stories.d.ts","sourceRoot":"","sources":["../src/formControlFieldset.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formControlFieldset.stories.d.ts","sourceRoot":"","sources":["../src/formControlFieldset.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CA6CC,CAAC;AAExC,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAQnC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formLabelLegend.d.ts","sourceRoot":"","sources":["../src/formLabelLegend.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"formLabelLegend.d.ts","sourceRoot":"","sources":["../src/formLabelLegend.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEnD,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAOnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formLabelLegend.js","names":[],"sources":["../src/formLabelLegend.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport { default as InputLabel, type InputLabelProps } from '@mui/material/InputLabel';\n\nexport type FormLabelLegendProps = InputLabelProps;\n\nexport const FormLabelLegend: FC<FormLabelLegendProps> = memo(function FormLabelLegend({ children, ...props }) {\n return (\n // sx={(theme) => theme.typography.caption}\n <InputLabel {...props} shrink={true} component={'legend' as any}>\n {children}\n </InputLabel>\n );\n});\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"formLabelLegend.js","names":[],"sources":["../src/formLabelLegend.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { default as InputLabel, type InputLabelProps } from '@mui/material/InputLabel';\n\nexport type FormLabelLegendProps = InputLabelProps;\n\nexport const FormLabelLegend: FC<FormLabelLegendProps> = memo(function FormLabelLegend({ children, ...props }) {\n return (\n // sx={(theme) => theme.typography.caption}\n <InputLabel {...props} shrink={true} component={'legend' as any}>\n {children}\n </InputLabel>\n );\n});\n"],"mappings":";;;;AAMA,IAAa,kBAA4C,KAAK,SAAS,gBAAgB,EAAE,UAAU,GAAG,SAAS;CAC3G,OAEI,oBAAC,YAAD;EAAY,GAAI;EAAO,QAAQ;EAAM,WAAW;EAC3C;CACO,CAAA;AAEpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formLabelLegend.stories.d.ts","sourceRoot":"","sources":["../src/formLabelLegend.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formLabelLegend.stories.d.ts","sourceRoot":"","sources":["../src/formLabelLegend.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIpD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,eAAe,CAatC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAa5B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,KAqBtC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAoB/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericControl.d.ts","sourceRoot":"","sources":["../src/genericControl.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"genericControl.d.ts","sourceRoot":"","sources":["../src/genericControl.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAE7C,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG1F,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAejD,CAAC"}
|
package/dist/genericControl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import FormControl from "@mui/material/FormControl";
|
|
4
3
|
import { inputClasses } from "@mui/material/Input";
|
|
4
|
+
import FormControl from "@mui/material/FormControl";
|
|
5
5
|
//#region src/genericControl.tsx
|
|
6
6
|
var GenericControl = memo(function GenericControl({ children, sx, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsx(FormControl, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericControl.js","names":[],"sources":["../src/genericControl.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"genericControl.js","names":[],"sources":["../src/genericControl.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { default as FormControl, type FormControlProps } from '@mui/material/FormControl';\nimport { inputClasses } from '@mui/material/Input';\n\nexport type GenericControlProps = FormControlProps & { children: any };\n\nexport const GenericControl: FC<GenericControlProps> = memo(function GenericControl({ children, sx, ...props }) {\n return (\n <FormControl\n variant=\"standard\"\n sx={{\n ...sx,\n [`& .${inputClasses.root}`]: {\n '&:before, &:after': { display: 'none' },\n },\n }}\n {...props}\n >\n {children}\n </FormControl>\n );\n});\n"],"mappings":";;;;;AAOA,IAAa,iBAA0C,KAAK,SAAS,eAAe,EAAE,UAAU,IAAI,GAAG,SAAS;CAC5G,OACI,oBAAC,aAAD;EACI,SAAQ;EACR,IAAI;GACA,GAAG;IACF,MAAM,aAAa,SAAS,EACzB,qBAAqB,EAAE,SAAS,OAAO,EAC3C;EACJ;EACA,GAAI;EAEH;CACQ,CAAA;AAErB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericControl.stories.d.ts","sourceRoot":"","sources":["../src/genericControl.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"genericControl.stories.d.ts","sourceRoot":"","sources":["../src/genericControl.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAarC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAS/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAUvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAiBvB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAkBrC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,8 @@ import { GenericControl } from "./genericControl.js";
|
|
|
3
3
|
import { FormControlFieldset } from "./formControlFieldset.js";
|
|
4
4
|
import { FormLabelLegend } from "./formLabelLegend.js";
|
|
5
5
|
import { ReadOnly } from "./readOnly.js";
|
|
6
|
-
|
|
6
|
+
import { AdminAppProvider } from "./admin/appProvider.js";
|
|
7
|
+
import { AdminDashboardLayout } from "./admin/dashboardLayout.js";
|
|
8
|
+
import { AdminSignInPage } from "./admin/signInPage.js";
|
|
9
|
+
import "./admin/index.js";
|
|
10
|
+
export { AdminAppProvider, AdminDashboardLayout, AdminSignInPage, AppBarOffset, FormControlFieldset, FormLabelLegend, GenericControl, ReadOnly };
|
package/dist/readOnly.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnly.d.ts","sourceRoot":"","sources":["../src/readOnly.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"readOnly.d.ts","sourceRoot":"","sources":["../src/readOnly.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,EAAE,EAAQ,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,CAAC;AAE3D,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAErC,CAAC"}
|
package/dist/readOnly.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnly.js","names":[],"sources":["../src/readOnly.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\nimport { default as Input, type InputProps } from '@mui/material/Input';\n\nexport type ReadOnlyProps = InputProps & { children: any };\n\nexport const ReadOnly: FC<ReadOnlyProps> = memo(function ReadOnly({ children, inputProps, ...props }) {\n return <Input {...props} inputComponent={'div' as any} inputProps={{ ...inputProps, children }}></Input>;\n});\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"readOnly.js","names":[],"sources":["../src/readOnly.tsx"],"sourcesContent":["import React, { type FC, memo } from 'react';\n\nimport { default as Input, type InputProps } from '@mui/material/Input';\n\nexport type ReadOnlyProps = InputProps & { children: any };\n\nexport const ReadOnly: FC<ReadOnlyProps> = memo(function ReadOnly({ children, inputProps, ...props }) {\n return <Input {...props} inputComponent={'div' as any} inputProps={{ ...inputProps, children }}></Input>;\n});\n"],"mappings":";;;;AAMA,IAAa,WAA8B,KAAK,SAAS,SAAS,EAAE,UAAU,YAAY,GAAG,SAAS;CAClG,OAAO,oBAAC,OAAD;EAAO,GAAI;EAAO,gBAAgB;EAAc,YAAY;GAAE,GAAG;GAAY;EAAS;CAAU,CAAA;AAC3G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readOnly.stories.d.ts","sourceRoot":"","sources":["../src/readOnly.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"readOnly.stories.d.ts","sourceRoot":"","sources":["../src/readOnly.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAY/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAS7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAqB5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,KAyBrC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirill.konshin/mui",
|
|
3
3
|
"description": "Utilities",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"hasStorybook": true,
|
|
7
7
|
"scripts": {
|
|
@@ -20,18 +20,33 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@emotion/react": "^11.14.0",
|
|
22
22
|
"@emotion/styled": "^11.14.0",
|
|
23
|
+
"@kirill.konshin/auth": "*",
|
|
23
24
|
"@kirill.konshin/utils-private": "*",
|
|
24
25
|
"@mui/material": "^7.3.0",
|
|
26
|
+
"@toolpad/core": "^0.16.0",
|
|
27
|
+
"next": "^16.2.12",
|
|
25
28
|
"react": "^19.1.1"
|
|
26
29
|
},
|
|
27
30
|
"peerDependencies": {
|
|
31
|
+
"@kirill.konshin/auth": "*",
|
|
28
32
|
"@mui/material": "^7",
|
|
33
|
+
"@toolpad/core": "^0.16",
|
|
34
|
+
"next": "^16",
|
|
29
35
|
"react": "^19"
|
|
30
36
|
},
|
|
31
37
|
"peerDependenciesMeta": {
|
|
38
|
+
"@kirill.konshin/auth": {
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
32
41
|
"@mui/material": {
|
|
33
42
|
"optional": true
|
|
34
43
|
},
|
|
44
|
+
"@toolpad/core": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"next": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
35
50
|
"react": {
|
|
36
51
|
"optional": true
|
|
37
52
|
}
|
|
@@ -42,6 +57,12 @@
|
|
|
42
57
|
"author": "Kirill Konshin <kirill@konshin.org> (https://konshin.org)",
|
|
43
58
|
"license": "MIT",
|
|
44
59
|
"exports": {
|
|
60
|
+
"./admin": {
|
|
61
|
+
"import": {
|
|
62
|
+
"import": "./dist/admin/index.js",
|
|
63
|
+
"types": "./dist/admin/index.d.ts"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
45
66
|
".": {
|
|
46
67
|
"import": {
|
|
47
68
|
"import": "./dist/index.js",
|
|
@@ -59,7 +80,7 @@
|
|
|
59
80
|
},
|
|
60
81
|
"nx": {
|
|
61
82
|
"tags": [
|
|
62
|
-
"platform:
|
|
83
|
+
"platform:next"
|
|
63
84
|
]
|
|
64
85
|
},
|
|
65
86
|
"files": [
|