private buildDefaultFormFields()

in packages/amplify-ui-components/src/components/amplify-sign-up/amplify-sign-up.tsx [222:333]


	private buildDefaultFormFields() {
		switch (this.usernameAlias) {
			case 'email':
				this.newFormFields = [
					{
						type: 'email',
						placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('email'),
						inputProps: {
							'data-test': 'sign-up-email-input',
							autocomplete: 'username',
						},
					},
					{
						type: 'password',
						placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('password'),
						inputProps: {
							'data-test': 'sign-up-password-input',
							autocomplete: 'new-password',
						},
					},
					{
						type: 'phone_number',
						required: true,
						handleInputChange: this.handleFormFieldInputChange('phone_number'),
						inputProps: {
							'data-test': 'sign-up-phone-number-input',
							autocomplete: 'tel-national',
						},
					},
				];
				break;
			case 'phone_number':
				this.newFormFields = [
					{
						type: 'phone_number',
						required: true,
						handleInputChange: this.handleFormFieldInputChange('phone_number'),
						inputProps: {
							'data-test': 'sign-up-phone-number-input',
							autocomplete: 'username',
						},
					},
					{
						type: 'password',
						placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('password'),
						inputProps: {
							'data-test': 'sign-up-password-input',
							autocomplete: 'new-password',
						},
					},
					{
						type: 'email',
						placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('email'),
						inputProps: {
							'data-test': 'sign-up-email-input',
							autocomplete: 'email',
						},
					},
				];
				break;
			case 'username':
			default:
				this.newFormFields = [
					{
						type: 'username',
						placeholder: I18n.get(Translations.SIGN_UP_USERNAME_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('username'),
						inputProps: {
							'data-test': 'sign-up-username-input',
							autocomplete: 'username',
						},
					},
					{
						type: 'password',
						placeholder: I18n.get(Translations.SIGN_UP_PASSWORD_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('password'),
						inputProps: {
							'data-test': 'sign-up-password-input',
							autocomplete: 'new-password',
						},
					},
					{
						type: 'email',
						placeholder: I18n.get(Translations.SIGN_UP_EMAIL_PLACEHOLDER),
						required: true,
						handleInputChange: this.handleFormFieldInputChange('email'),
						inputProps: {
							'data-test': 'sign-up-email-input',
						},
					},
					{
						type: 'phone_number',
						required: true,
						handleInputChange: this.handleFormFieldInputChange('phone_number'),
						inputProps: {
							'data-test': 'sign-up-phone-number-input',
						},
					},
				];
				break;
		}
	}