@payloadcms/next
Advanced tools
Comparing version 3.0.0-beta.73 to 3.0.0-beta.74
@@ -49,2 +49,3 @@ 'use client'; | ||
onClick: onCancel, | ||
size: "large", | ||
children: t('general:stayOnThisPage') | ||
@@ -54,2 +55,3 @@ }), | ||
onClick: onConfirm, | ||
size: "large", | ||
children: t('general:leaveAnyway') | ||
@@ -56,0 +58,0 @@ }) |
@@ -5,3 +5,2 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import { buildComponentMap } from '@payloadcms/ui/utilities/buildComponentMap'; | ||
import { Merriweather } from 'next/font/google'; | ||
import { headers as getHeaders, cookies as nextCookies } from 'next/headers.js'; | ||
@@ -15,17 +14,2 @@ import { createClientConfig, parseCookies } from 'payload'; | ||
import { DefaultListView } from '../../views/List/Default/index.js'; | ||
const merriweather = Merriweather({ | ||
display: 'swap', | ||
style: [ | ||
'normal', | ||
'italic' | ||
], | ||
subsets: [ | ||
'latin' | ||
], | ||
variable: '--font-serif', | ||
weight: [ | ||
'400', | ||
'900' | ||
] | ||
}); | ||
export const metadata = { | ||
@@ -88,3 +72,2 @@ description: 'Generated by Next.js', | ||
return /*#__PURE__*/ _jsx("html", { | ||
className: merriweather.variable, | ||
"data-theme": theme, | ||
@@ -91,0 +74,0 @@ dir: dir, |
@@ -1,9 +0,8 @@ | ||
import type { FormState } from 'payload'; | ||
import type { FormState, LoginWithUsernameOptions } from 'payload'; | ||
import React from 'react'; | ||
export declare const CreateFirstUserClient: React.FC<{ | ||
initialState: FormState; | ||
loginType: 'email' | 'emailOrUsername' | 'username'; | ||
requireEmail?: boolean; | ||
loginWithUsername?: LoginWithUsernameOptions | false; | ||
userSlug: string; | ||
}>; | ||
//# sourceMappingURL=index.client.d.ts.map |
@@ -6,4 +6,4 @@ 'use client'; | ||
import React from 'react'; | ||
import { LoginField } from '../Login/LoginField/index.js'; | ||
export const CreateFirstUserClient = ({ initialState, loginType, requireEmail = true, userSlug })=>{ | ||
import { RenderEmailAndUsernameFields } from '../../elements/EmailAndUsername/index.js'; | ||
export const CreateFirstUserClient = ({ initialState, loginWithUsername, userSlug })=>{ | ||
const { getFieldMap } = useComponentMap(); | ||
@@ -39,15 +39,8 @@ const { routes: { admin, api: apiRoute }, serverURL } = useConfig(); | ||
children: [ | ||
[ | ||
'emailOrUsername', | ||
'username' | ||
].includes(loginType) && /*#__PURE__*/ _jsx(LoginField, { | ||
type: "username" | ||
/*#__PURE__*/ _jsx(RenderEmailAndUsernameFields, { | ||
className: "emailAndUsername", | ||
loginWithUsername: loginWithUsername, | ||
operation: "create", | ||
readOnly: false | ||
}), | ||
[ | ||
'email', | ||
'emailOrUsername' | ||
].includes(loginType) && /*#__PURE__*/ _jsx(LoginField, { | ||
required: requireEmail, | ||
type: "email" | ||
}), | ||
/*#__PURE__*/ _jsx(PasswordField, { | ||
@@ -69,2 +62,3 @@ label: t('authentication:newPassword'), | ||
/*#__PURE__*/ _jsx(FormSubmit, { | ||
size: "large", | ||
children: t('general:create') | ||
@@ -71,0 +65,0 @@ }) |
@@ -11,7 +11,2 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
const loginWithUsername = authOptions.loginWithUsername; | ||
const emailRequired = loginWithUsername && loginWithUsername.requireEmail; | ||
let loginType = loginWithUsername ? 'username' : 'email'; | ||
if (loginWithUsername && (loginWithUsername.allowEmailLogin || loginWithUsername.requireEmail)) { | ||
loginType = 'emailOrUsername'; | ||
} | ||
const { formState } = await getDocumentData({ | ||
@@ -34,4 +29,3 @@ collectionConfig, | ||
initialState: formState, | ||
loginType: loginType, | ||
requireEmail: emailRequired, | ||
loginWithUsername: loginWithUsername, | ||
userSlug: userSlug | ||
@@ -38,0 +32,0 @@ }) |
'use client'; | ||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
import { Button, CheckboxField, ConfirmPasswordField, EmailField, PasswordField, TextField, useAuth, useConfig, useDocumentInfo, useFormFields, useFormModified, useTranslation } from '@payloadcms/ui'; | ||
import { email as emailValidation } from 'payload/shared'; | ||
import { Button, CheckboxField, ConfirmPasswordField, PasswordField, useAuth, useConfig, useDocumentInfo, useFormFields, useFormModified, useTranslation } from '@payloadcms/ui'; | ||
import React, { useCallback, useEffect, useMemo, useState } from 'react'; | ||
import { toast } from 'sonner'; | ||
import { RenderEmailAndUsernameFields } from '../../../../elements/EmailAndUsername/index.js'; | ||
import { APIKey } from './APIKey.js'; | ||
@@ -18,3 +18,3 @@ const baseClass = 'auth-fields'; | ||
const { i18n, t } = useTranslation(); | ||
const { isInitializing } = useDocumentInfo(); | ||
const { docPermissions, isInitializing } = useDocumentInfo(); | ||
const { routes: { api }, serverURL } = useConfig(); | ||
@@ -123,30 +123,8 @@ const hasPermissionToUnlock = useMemo(()=>{ | ||
children: [ | ||
Boolean(loginWithUsername) && /*#__PURE__*/ _jsx(TextField, { | ||
disabled: disabled, | ||
label: t('authentication:username'), | ||
name: "username", | ||
readOnly: readOnly, | ||
required: true | ||
/*#__PURE__*/ _jsx(RenderEmailAndUsernameFields, { | ||
loginWithUsername: loginWithUsername, | ||
operation: operation, | ||
permissions: docPermissions?.fields, | ||
readOnly: readOnly | ||
}), | ||
(!loginWithUsername || loginWithUsername?.allowEmailLogin || loginWithUsername?.requireEmail) && /*#__PURE__*/ _jsx(EmailField, { | ||
autoComplete: "email", | ||
disabled: disabled, | ||
label: t('general:email'), | ||
name: "email", | ||
readOnly: readOnly, | ||
required: !loginWithUsername || loginWithUsername?.requireEmail, | ||
validate: (value)=>emailValidation(value, { | ||
name: 'email', | ||
type: 'email', | ||
data: {}, | ||
preferences: { | ||
fields: {} | ||
}, | ||
req: { | ||
t | ||
}, | ||
required: true, | ||
siblingData: {} | ||
}) | ||
}), | ||
(showPasswordFields || requirePassword) && /*#__PURE__*/ _jsxs("div", { | ||
@@ -174,3 +152,3 @@ className: `${baseClass}__changing-password`, | ||
onClick: ()=>handleChangePassword(false), | ||
size: "small", | ||
size: "medium", | ||
children: t('general:cancel') | ||
@@ -183,3 +161,3 @@ }), | ||
onClick: ()=>handleChangePassword(true), | ||
size: "small", | ||
size: "medium", | ||
children: t('authentication:changePassword') | ||
@@ -191,3 +169,3 @@ }), | ||
onClick: ()=>void unlock(), | ||
size: "small", | ||
size: "medium", | ||
children: t('authentication:forceUnlock') | ||
@@ -194,0 +172,0 @@ }) |
@@ -39,2 +39,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
el: "link", | ||
size: "large", | ||
to: adminRoute, | ||
@@ -41,0 +42,0 @@ children: i18n.t('general:backToDashboard') |
@@ -0,1 +1,2 @@ | ||
import type { Validate } from 'payload'; | ||
import React from 'react'; | ||
@@ -5,4 +6,5 @@ export type LoginFieldProps = { | ||
type: 'email' | 'emailOrUsername' | 'username'; | ||
validate?: Validate; | ||
}; | ||
export declare const LoginField: React.FC<LoginFieldProps>; | ||
//# sourceMappingURL=index.d.ts.map |
'use client'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { EmailField, TextField, useConfig, useTranslation } from '@payloadcms/ui'; | ||
import { EmailField, TextField, useTranslation } from '@payloadcms/ui'; | ||
import { email, username } from 'payload/shared'; | ||
@@ -8,3 +8,2 @@ import React from 'react'; | ||
const { t } = useTranslation(); | ||
const config = useConfig(); | ||
if (type === 'email') { | ||
@@ -17,15 +16,3 @@ return /*#__PURE__*/ _jsx(EmailField, { | ||
required: required, | ||
validate: (value)=>email(value, { | ||
name: 'email', | ||
type: 'email', | ||
data: {}, | ||
preferences: { | ||
fields: {} | ||
}, | ||
req: { | ||
t | ||
}, | ||
required: true, | ||
siblingData: {} | ||
}) | ||
validate: email | ||
}); | ||
@@ -38,19 +25,4 @@ } | ||
path: "username", | ||
required: true, | ||
validate: (value)=>username(value, { | ||
name: 'username', | ||
type: 'text', | ||
data: {}, | ||
preferences: { | ||
fields: {} | ||
}, | ||
req: { | ||
payload: { | ||
config | ||
}, | ||
t | ||
}, | ||
required: true, | ||
siblingData: {} | ||
}) | ||
required: required, | ||
validate: username | ||
}); | ||
@@ -63,36 +35,6 @@ } | ||
path: "username", | ||
required: true, | ||
validate: (value)=>{ | ||
const passesUsername = username(value, { | ||
name: 'username', | ||
type: 'text', | ||
data: {}, | ||
preferences: { | ||
fields: {} | ||
}, | ||
req: { | ||
payload: { | ||
config | ||
}, | ||
t | ||
}, | ||
required: true, | ||
siblingData: {} | ||
}); | ||
const passesEmail = email(value, { | ||
name: 'username', | ||
type: 'email', | ||
data: {}, | ||
preferences: { | ||
fields: {} | ||
}, | ||
req: { | ||
payload: { | ||
config | ||
}, | ||
t | ||
}, | ||
required: true, | ||
siblingData: {} | ||
}); | ||
required: required, | ||
validate: (value, options)=>{ | ||
const passesUsername = username(value, options); | ||
const passesEmail = email(value, options); | ||
if (!passesEmail && !passesUsername) { | ||
@@ -99,0 +41,0 @@ return `${t('general:email')}: ${passesEmail} ${t('general:username')}: ${passesUsername}`; |
@@ -74,2 +74,3 @@ 'use client'; | ||
/*#__PURE__*/ _jsx(FormSubmit, { | ||
size: "large", | ||
children: t('authentication:login') | ||
@@ -76,0 +77,0 @@ }) |
@@ -16,3 +16,3 @@ 'use client'; | ||
setIsLoggingOut(true); | ||
logOut(); | ||
void logOut(); | ||
} | ||
@@ -36,2 +36,3 @@ }, [ | ||
el: "link", | ||
size: "large", | ||
url: formatAdminURL({ | ||
@@ -38,0 +39,0 @@ adminRoute, |
@@ -41,2 +41,3 @@ 'use client'; | ||
el: "link", | ||
size: "large", | ||
to: adminRoute, | ||
@@ -43,0 +44,0 @@ children: t('general:backToDashboard') |
@@ -62,2 +62,3 @@ 'use client'; | ||
/*#__PURE__*/ _jsx(FormSubmit, { | ||
size: "large", | ||
children: i18n.t('authentication:resetPassword') | ||
@@ -64,0 +65,0 @@ }) |
@@ -23,2 +23,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
el: "link", | ||
size: "large", | ||
to: logoutRoute, | ||
@@ -25,0 +26,0 @@ children: i18n.t('authentication:logOut') |
@@ -49,3 +49,3 @@ 'use client'; | ||
const canUpdate = docPermissions?.update?.permission; | ||
const localeValues = locales.map((locale)=>locale.value); | ||
const localeValues = locales && locales.map((locale)=>locale.value); | ||
return /*#__PURE__*/ _jsxs("main", { | ||
@@ -52,0 +52,0 @@ className: baseClass, |
@@ -22,6 +22,11 @@ /** | ||
'drizzle-kit', | ||
'drizzle-kit/payload', | ||
'libsql' | ||
'drizzle-kit/api' | ||
] | ||
}, | ||
outputFileTracingIncludes: { | ||
'**/*': [ | ||
...nextConfig.experimental?.outputFileTracingIncludes?.['**/*'] || [], | ||
'@libsql/client' | ||
] | ||
}, | ||
turbo: { | ||
@@ -61,5 +66,5 @@ ...nextConfig?.experimental?.turbo || {}, | ||
'drizzle-kit', | ||
'drizzle-kit/payload', | ||
'drizzle-kit/api', | ||
'pino', | ||
'libsql', | ||
'pino', | ||
'pino-pretty', | ||
@@ -75,3 +80,3 @@ 'graphql' | ||
'drizzle-kit', | ||
'drizzle-kit/payload', | ||
'drizzle-kit/api', | ||
'sharp', | ||
@@ -78,0 +83,0 @@ 'libsql' |
{ | ||
"name": "@payloadcms/next", | ||
"version": "3.0.0-beta.73", | ||
"version": "3.0.0-beta.74", | ||
"homepage": "https://payloadcms.com", | ||
@@ -66,5 +66,5 @@ "repository": { | ||
"ws": "^8.16.0", | ||
"@payloadcms/graphql": "3.0.0-beta.73", | ||
"@payloadcms/ui": "3.0.0-beta.73", | ||
"@payloadcms/translations": "3.0.0-beta.73" | ||
"@payloadcms/graphql": "3.0.0-beta.74", | ||
"@payloadcms/translations": "3.0.0-beta.74", | ||
"@payloadcms/ui": "3.0.0-beta.74" | ||
}, | ||
@@ -82,3 +82,3 @@ "devDependencies": { | ||
"@payloadcms/eslint-config": "3.0.0-beta.59", | ||
"payload": "3.0.0-beta.73" | ||
"payload": "3.0.0-beta.74" | ||
}, | ||
@@ -88,3 +88,3 @@ "peerDependencies": { | ||
"next": "^15.0.0-canary.53", | ||
"payload": "3.0.0-beta.73" | ||
"payload": "3.0.0-beta.74" | ||
}, | ||
@@ -91,0 +91,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1720456
930
13656
+ Added@payloadcms/graphql@3.0.0-beta.74(transitive)
+ Added@payloadcms/translations@3.0.0-beta.74(transitive)
+ Added@payloadcms/ui@3.0.0-beta.74(transitive)
+ Addedpayload@3.0.0-beta.74(transitive)
- Removed@payloadcms/graphql@3.0.0-beta.73(transitive)
- Removed@payloadcms/translations@3.0.0-beta.73(transitive)
- Removed@payloadcms/ui@3.0.0-beta.73(transitive)
- Removedpayload@3.0.0-beta.73(transitive)
Updated@payloadcms/ui@3.0.0-beta.74