Amount
1 month ago
Consent
1 year ago
utils
1 year ago
Checkbox.tsx
1 year ago
Date.tsx
1 year ago
Email.tsx
1 year ago
File.tsx
1 year ago
Gateways.tsx
1 year ago
Hidden.tsx
2 years ago
Honeypot.tsx
1 year ago
MultiSelect.tsx
2 years ago
Password.tsx
2 years ago
Phone.tsx
1 year ago
Radio.tsx
2 years ago
Select.tsx
1 year ago
Text.tsx
1 year ago
TextArea.tsx
2 years ago
Url.tsx
2 years ago
Email.tsx
34 lines
| 1 | import {FieldHasDescriptionProps} from '@givewp/forms/propTypes'; |
| 2 | import autoCompleteAttr from '@givewp/forms/registrars/templates/fields/utils/autoCompleteAttr'; |
| 3 | |
| 4 | /** |
| 5 | * @since 4.3.0 Add autoComplete support |
| 6 | */ |
| 7 | export default function Email({ |
| 8 | Label, |
| 9 | ErrorMessage, |
| 10 | description, |
| 11 | placeholder, |
| 12 | fieldError, |
| 13 | inputProps, |
| 14 | }: FieldHasDescriptionProps) { |
| 15 | const autoComplete = autoCompleteAttr(inputProps?.name); |
| 16 | const FieldDescription = window.givewp.form.templates.layouts.fieldDescription; |
| 17 | |
| 18 | return ( |
| 19 | <label className={fieldError && 'givewp-field-error-label'}> |
| 20 | <Label /> |
| 21 | {description && <FieldDescription description={description} />} |
| 22 | <input |
| 23 | type="email" |
| 24 | aria-invalid={fieldError ? 'true' : 'false'} |
| 25 | placeholder={placeholder} |
| 26 | {...inputProps} |
| 27 | autoComplete={autoComplete} |
| 28 | /> |
| 29 | |
| 30 | <ErrorMessage /> |
| 31 | </label> |
| 32 | ); |
| 33 | } |
| 34 |