Skip to content

Adding property autoComplete to FormInput #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions components/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,51 @@ export const INPUT_TYPES = [
"file"
];

export const AUTOCOMPLETE_TYPES = [
"on",
"off",
"name",
"email",
"username",
"new-password",
"current-password",
"one-time-code",
"organization-title",
"organization",
"street-address",
"address-line1",
"address-line2",
"address-line3",
"address-level1",
"address-level2",
"address-level3",
"address-level4",
"country",
"country-name",
"postal-code",
"cc-name",
"cc-given-name",
"cc-additional-name",
"cc-family-name",
"cc-number",
"cc-exp",
"cc-exp-month",
"cc-exp-year",
"cc-csc",
"cc-type",
"transaction-currency",
"transaction-amount",
"language",
"bday",
"bday-day",
"bday-month",
"bday-year",
"sex",
"tel",
"tel-extension",
"impp",
"url",
"photo"
];

export const INPUT_GROUP_ADDON_TYPES = ["prepend", "append"];
9 changes: 7 additions & 2 deletions components/form-input/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames";

import { INPUT_TYPES } from "../constants";
import { INPUT_TYPES, AUTOCOMPLETE_TYPES } from "../constants";

/**
* The form input allows you to create various text style inputs such as `text`, `password`, `email`, `number`, `url`, `search` and more.
Expand Down Expand Up @@ -35,6 +35,7 @@ class FormInput extends React.Component {
const {
className,
plaintext,
autoComplete,
size,
invalid,
valid,
Expand All @@ -51,7 +52,7 @@ class FormInput extends React.Component {
invalid && "is-invalid"
);

return <input {...attrs} ref={innerRef} className={classes} />;
return <input {...attrs} ref={innerRef} className={classes} autoComplete={autoComplete} />;
}
}

Expand All @@ -76,6 +77,10 @@ FormInput.propTypes = {
* Whether it is plaintext, or not.
*/
plaintext: PropTypes.bool,
/**
* Whether it is plaintext, or not.
*/
autoComplete: PropTypes.oneOf(AUTOCOMPLETE_TYPES),
/**
* The input's size.
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shards-react",
"version": "1.0.3",
"version": "1.0.4",
"description": "A free, beautiful and modern React UI kit powered by Bootstrap 4 and the Shards UI kit.",
"main": "dist/shards-react.common.js",
"jsnext:main": "dist/shards-react.es.js",
Expand Down