1.3.6 • Published 4 years ago

@alaskaairux/auro-input v1.3.6

Weekly downloads
57
License
Apache-2.0
Repository
github
Last release
4 years ago

auro-input

<auro-input> is a HTML custom element containing styling and behavior for a HTML <input> element and associated <label>. You can pass helper text to be displayed with the input. It will also perform client-side validation of the input and display any resulting errors.

UI development browser support

For the most up to date information on UI development browser support

Install

Build Status See it on NPM! License

$ npm i @alaskaairux/auro-input

Installing as a direct, dev or peer dependency is up to the user installing the package. If you are unsure as to what type of dependency you should use, consider reading this stack overflow answer.

Design Token CSS Custom Property dependency

The use of any Auro custom element has a dependency on the Auro Design Tokens.

CSS Custom Property fallbacks

CSS custom properties are not supported in older browsers. For this, fallback properties are pre-generated and included with the npm.

Any update to the Auro Design Tokens will be immediately reflected with browsers that support CSS custom properties, legacy browsers will require updated components with pre-generated fallback properties.

Define dependency in project component

Defining the component dependency within each component that is using the <auro-input> component.

import "@alaskaairux/auro-input";

Install bundled assets from CDN

In cases where the project is not able to process JS assets, there are pre-processed assets available for use.

<link rel="stylesheet" href="https://unpkg.com/@alaskaairux/orion-design-tokens@latest/dist/tokens/CSSTokenProperties.css" />
<link rel="stylesheet" href="https://unpkg.com/@alaskaairux/orion-web-core-style-sheets@latest/dist/bundled/baseline.css" />

<script src="https://unpkg.com/@alaskaairux/auro-input@latest/dist/polyfills.js"></script>
<script src="https://unpkg.com/@alaskaairux/auro-input@latest/dist/auro-input__bundled.js"></script>

polyfills.js

The polyfills.js is packaged with this component, but IT IS NOT NEEDED to load a polyfill per component. The polyfills.js will work for all additional components added to the project.

IE11 Support

Displaimer: While these components are supported in IE, there may be issues with loading the web components polyfill. Please consult their documentation when supporting IE11.

auro-input use cases

The <auro-input> element should be used in situations where users may:

  • enter a single line of text into a form
  • enter their email into a form

API Code Examples

<auro-input label="First name" required></auro-input>

Required input with label and help text

<auro-input label="First name" helptext="Enter your first name" required></auro-input>

Required input with label and value

<auro-input label="First name" value="Alaska" required></auro-input>

Optional input with label

<auro-input label="First name"></auro-input>

Required email input

<auro-input type="email" label="Email" required></auro-input>

Disabled input

<auro-input label="First name" disabled required></auro-input>

Input with persistent error

<auro-input label="First name" value="Alaska" error="This name already exists" required></auro-input>

Development

In order to develop against this project, if you are not part of the core team, you will be required to fork the project prior to submitting a pull request.

Please be sure to review the contribution guidelines for this project. Please make sure to pay special attention to the conventional commits section of the document.

Start development environment

Once the project has been cloned to your local resource and you have installed all the dependencies you will need to open two different shell sessions. One is for the npm tasks, the second is to run the server.

// shell terminal one
$ npm run dev

// shell terminal two
$ npm run serve

Open localhost:8000

Testing

Automated tests are required for every Auro component. See .\test\auro-input.test.js for the tests for this component. Run npm test to run the tests and check code coverage. Tests must pass and meet a certain coverage threshold to commit. See the testing documentation for more details.