Skip to content

Commit

Permalink
Move inputComponent to signup types
Browse files Browse the repository at this point in the history
  • Loading branch information
amitbadala committed Oct 25, 2023
1 parent 31d6e29 commit 8d60068
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions lib/build/recipe/emailpassword/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions lib/build/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions lib/ts/recipe/emailpassword/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,23 @@ export type NormalisedEnterEmailForm = FeatureBaseConfig & {

type FormThemeBaseProps = ThemeBaseProps & {
/*
* Form fields to use in the signin form.
* Form fields to use in the signup form.
*/
formFields: FormFieldThemeProps[];

error: string | undefined;
};

export type SignInThemeProps = FormThemeBaseProps & {
type SignInFormThemeBaseProps = ThemeBaseProps & {
/*
* Form fields to use in the signin form. exclude custom component
*/
formFields: Omit<FormFieldThemeProps, "inputComponent">[];

error: string | undefined;
};

export type SignInThemeProps = SignInFormThemeBaseProps & {
recipeImplementation: RecipeInterface;
clearError: () => void;
onError: (error: string) => void;
Expand All @@ -260,7 +269,6 @@ export type SignUpThemeProps = FormThemeBaseProps & {
config: NormalisedConfig;
signInClicked?: () => void;
onSuccess: (result: { user: User }) => void;
formFields: (FormFieldThemeProps & { inputComponent?: React.FC<InputProps> })[];
};

export type SignInAndUpThemeProps = {
Expand Down Expand Up @@ -289,6 +297,11 @@ export type FormFieldThemeProps = NormalisedFormField & {
* Clears the field after calling the API.
*/
clearOnSubmit?: boolean;

/*
* Ability to add custom components
*/
inputComponent?: React.FC<InputProps>;
};

export type FormFieldError = {
Expand Down
6 changes: 0 additions & 6 deletions lib/ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* under the License.
*/

import type { InputProps } from "./recipe/emailpassword/components/library/input";
import type { BaseRecipeModule } from "./recipe/recipeModule/baseRecipeModule";
import type { NormalisedConfig as NormalisedRecipeModuleConfig } from "./recipe/recipeModule/types";
import type { TranslationFunc, TranslationStore } from "./translation/translationHelpers";
Expand Down Expand Up @@ -284,11 +283,6 @@ export type NormalisedFormField = {
* Moves focus to the input element when it mounts
*/
autofocus?: boolean;

/*
* Ability to add custom components
*/
inputComponent?: React.FC<InputProps>;
};

export type ReactComponentClass<P = any> = ComponentClass<P, any> | ((props: P) => JSX.Element);
Expand Down

0 comments on commit 8d60068

Please sign in to comment.