Skip to content

Commit

Permalink
fix: Minimise breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatkashyap committed Feb 12, 2025
1 parent b8bfcde commit 5d1fe9e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export default function SlotPropsSignIn() {
}
return undefined;
}}
slots={{ checkbox: RememberMeCheckbox }}
slots={{ rememberMe: RememberMeCheckbox }}
slotProps={{
form: { noValidate: true },
emailField: { variant: 'standard', autoFocus: false },
passwordField: { variant: 'standard' },
submitButton: { variant: 'outlined' },
oauthButton: { variant: 'contained' },
checkbox: {
rememberMe: {
control: (
<Checkbox
name="tandc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export default function SlotPropsSignIn() {
}
return undefined;
}}
slots={{ checkbox: RememberMeCheckbox }}
slots={{ rememberMe: RememberMeCheckbox }}
slotProps={{
form: { noValidate: true },
emailField: { variant: 'standard', autoFocus: false },
passwordField: { variant: 'standard' },
submitButton: { variant: 'outlined' },
oauthButton: { variant: 'contained' },
checkbox: {
rememberMe: {
control: (
<Checkbox
name="tandc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function SlotsSignIn() {
passwordField: CustomPasswordField,
submitButton: CustomButton,
signUpLink: SignUpLink,
checkbox: RememberMeCheckbox,
rememberMe: RememberMeCheckbox,
forgotPasswordLink: ForgotPasswordLink,
}}
slotProps={{ form: { noValidate: true } }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function SlotsSignIn() {
passwordField: CustomPasswordField,
submitButton: CustomButton,
signUpLink: SignUpLink,
checkbox: RememberMeCheckbox,
rememberMe: RememberMeCheckbox,
forgotPasswordLink: ForgotPasswordLink,
}}
slotProps={{ form: { noValidate: true } }}
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/toolpad/core/api/sign-in-page.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"slotProps": {
"type": {
"name": "shape",
"description": "{ checkbox?: object, emailField?: object, forgotPasswordLink?: object, form?: object, oauthButton?: object, passwordField?: object, signUpLink?: object, submitButton?: object }"
"description": "{ emailField?: object, forgotPasswordLink?: object, form?: object, oauthButton?: object, passwordField?: object, rememberMe?: object, signUpLink?: object, submitButton?: object }"
},
"default": "{}"
},
"slots": {
"type": {
"name": "shape",
"description": "{ checkbox?: elementType, emailField?: elementType, forgotPasswordLink?: elementType, passwordField?: elementType, signUpLink?: elementType, submitButton?: elementType, subtitle?: elementType, title?: elementType }"
"description": "{ emailField?: elementType, forgotPasswordLink?: elementType, passwordField?: elementType, rememberMe?: elementType, signUpLink?: elementType, submitButton?: elementType, subtitle?: elementType, title?: elementType }"
},
"default": "{}",
"additionalInfo": { "slotsApi": true }
Expand Down Expand Up @@ -84,7 +84,7 @@
"class": null
},
{
"name": "checkbox",
"name": "rememberMe",
"description": "A custom checkbox placed in the credentials form",
"default": "FormControlLabel",
"class": null
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/sign-in-page/sign-in-page.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
},
"classDescriptions": {},
"slotDescriptions": {
"checkbox": "A custom checkbox placed in the credentials form",
"emailField": "The custom email field component used in the credentials form.",
"forgotPasswordLink": "The custom forgot password link component used in the credentials form.",
"passwordField": "The custom password field component used in the credentials form.",
"rememberMe": "A custom checkbox placed in the credentials form",
"signUpLink": "The custom sign up link component used in the credentials form.",
"submitButton": "The custom submit button component used in the credentials form.",
"subtitle": "A component to override the default subtitle section",
Expand Down
12 changes: 6 additions & 6 deletions packages/toolpad-core/src/SignInPage/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export interface SignInPageSlots {
* A custom checkbox placed in the credentials form
* @default FormControlLabel
*/
checkbox?: React.ElementType;
rememberMe?: React.ElementType;
}

export interface SignInPageProps {
Expand Down Expand Up @@ -254,7 +254,7 @@ export interface SignInPageProps {
oauthButton?: LoadingButtonProps;
forgotPasswordLink?: LinkProps;
signUpLink?: LinkProps;
checkbox?: Partial<FormControlLabelProps>;
rememberMe?: Partial<FormControlLabelProps>;
form?: Partial<React.FormHTMLAttributes<HTMLFormElement>>;
};
/**
Expand Down Expand Up @@ -611,7 +611,7 @@ function SignInPage(props: SignInPageProps) {
/>
)}
</Stack>
{slots?.forgotPasswordLink || slots?.checkbox ? (
{slots?.forgotPasswordLink || slots?.rememberMe ? (
<Stack
direction="row"
justifyContent="space-between"
Expand All @@ -622,7 +622,7 @@ function SignInPage(props: SignInPageProps) {
justifyContent: 'space-between',
}}
>
{slots?.checkbox ? <slots.checkbox {...slotProps?.checkbox} /> : null}
{slots?.rememberMe ? <slots.rememberMe {...slotProps?.rememberMe} /> : null}
{slots?.forgotPasswordLink ? (
<slots.forgotPasswordLink {...slotProps?.forgotPasswordLink} />
) : null}
Expand Down Expand Up @@ -697,12 +697,12 @@ SignInPage.propTypes /* remove-proptypes */ = {
* @example { emailField: { autoFocus: false }, passwordField: { variant: 'outlined' } }
*/
slotProps: PropTypes.shape({
checkbox: PropTypes.object,
emailField: PropTypes.object,
forgotPasswordLink: PropTypes.object,
form: PropTypes.object,
oauthButton: PropTypes.object,
passwordField: PropTypes.object,
rememberMe: PropTypes.object,
signUpLink: PropTypes.object,
submitButton: PropTypes.object,
}),
Expand All @@ -713,10 +713,10 @@ SignInPage.propTypes /* remove-proptypes */ = {
* @example { signUpLink: <Link href="/sign-up">Sign up</Link> }
*/
slots: PropTypes.shape({
checkbox: PropTypes.elementType,
emailField: PropTypes.elementType,
forgotPasswordLink: PropTypes.elementType,
passwordField: PropTypes.elementType,
rememberMe: PropTypes.elementType,
signUpLink: PropTypes.elementType,
submitButton: PropTypes.elementType,
subtitle: PropTypes.elementType,
Expand Down

0 comments on commit 5d1fe9e

Please sign in to comment.