Skip to content

Commit

Permalink
feat(rounded): add new rounded button #212
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Jun 8, 2023
1 parent dd8fa44 commit 6c6e8fb
Show file tree
Hide file tree
Showing 41 changed files with 3,698 additions and 620 deletions.
209 changes: 129 additions & 80 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,149 +1,198 @@
# auro-button

`<auro-button>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose of containing styling and behavior.

<!--
The README.md file is a compiled document. No edits should be made directly to this file.
README.md is created by running `npm run build:docs`.
This file is generated based on a template fetched from
`https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README.md`
and copied to `./componentDocs/README.md` each time the the docs are compiled.
The following sections are editable by making changes to the following files:
| SECTION | DESCRIPTION | FILE LOCATION |
|------------------------|---------------------------------------------------|-------------------------------------|
| Description | Description of the component | `./docs/partials/description.md` |
| Use Cases | Examples for when to use this component | `./docs/partials/useCases.md` |
| Additional Information | For use to add any component specific information | `./docs/partials/readmeAddlInfo.md` |
| Component Example Code | HTML sample code of the components use | `./apiExamples/basic.html` |
-->

# Button

<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
<!-- The below content is automatically added from ./../docs/partials/description.md -->
`<auro-button>` is a [HTML custom element](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) for the purpose being a clickable element to trigger a specific action.
<!-- AURO-GENERATED-CONTENT:END -->
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/readmeAddlInfo.md) -->
<!-- The below content is automatically added from ./../docs/partials/readmeAddlInfo.md -->
<!-- AURO-GENERATED-CONTENT This file is to be used for any additional content that should be included in the README.md which is specific to this component. -->
<!-- AURO-GENERATED-CONTENT:END -->

## UI development browser support

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/browserSupport.md) -->
For the most up to date information on [UI development browser support](https://auro.alaskaair.com/support/browsersSupport)

<!-- AURO-GENERATED-CONTENT:END -->

## Install

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/componentInstall.md) -->
[![Build Status](https://img.shields.io/github/actions/workflow/status/AlaskaAirlines/auro-button/testPublish.yml?style=for-the-badge)](https://github.com/AlaskaAirlines/auro-button/actions/workflows/testPublish.yml)
[![See it on NPM!](https://img.shields.io/npm/v/@aurodesignsystem/auro-button?style=for-the-badge&color=orange)](https://www.npmjs.com/package/@aurodesignsystem/auro-button)
[![License](https://img.shields.io/npm/l/@aurodesignsystem/auro-button?color=blue&style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0)
[![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@aurodesignsystem/auro-button?style=for-the-badge)](https://snyk.io/test/npm/@aurodesignsystem/auro-button?tab=issues)

```shell
$ npm i @aurodesignsystem/auro-button
```

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](https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies) answer.

<!-- AURO-GENERATED-CONTENT:END -->

### Design Token CSS Custom Property dependency

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/designTokens.md) -->
The use of any Auro custom element has a dependency on the [Auro Design Tokens](https://auro.alaskaair.com/getting-started/developers/design-tokens).

<!-- AURO-GENERATED-CONTENT:END -->

### CSS Custom Property fallbacks

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/cssFallbacks.md) -->
[CSS custom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) are [not supported](https://auro.alaskaair.com/support/custom-properties) 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.

<!-- AURO-GENERATED-CONTENT:END -->

### Define dependency in project component

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/componentImportDescription.md) -->
Defining the component dependency within each component that is using the `<auro-button>` component.

```javascript
<!-- AURO-GENERATED-CONTENT:END -->
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/componentImport.md) -->

```js
import "@aurodesignsystem/auro-button";
```

<!-- AURO-GENERATED-CONTENT:END -->
**Reference component in HTML**

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->

```html
<auro-button>Hello World</auro-button>
```

## CDN Use
<auro-button>Primary</auro-button>
<auro-button variant="secondary">Secondary</auro-button>
<auro-button variant="tertiary">Tertiary</auro-button>
```
<!-- AURO-GENERATED-CONTENT:END -->

## 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.
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/bundleInstallDescription.md) -->
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. See -- `auro-button__bundled.js` for modern browsers. Legacy browsers such as IE11 are no longer supported.

### Install
We recommend you load these bundles using [differential serving](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/) so that the browser only loads the bundle correctly. To accomplish this, the script tag for the modern bundle should have `type="module"` and the script tag.

Include the following example HTML code in the `<head>` element of your page.
<!-- AURO-GENERATED-CONTENT:END -->

### Bundle example code

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/usage/bundleUse.md) -->

```html
<!-- **NOTE:** Be sure to replace `@latest` in the URL with the version of the asset you want. @latest is NOT aware of any MAJOR releases, use at your own risk. -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/tokens/CSSCustomProperties.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/essentials.css" />

<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/dist/auro-button__bundled.js" type="module"></script>
```

**NOTE:** Be sure to replace `@latest` in the URL with the version of the asset you want. @latest is NOT aware of any MAJOR releases, use at your own risk.

## Responsive support

`<auro-button>` is responsive by default. The button will assume 100% of the width of its container for views less than [auro_breakpoint--sm](https://alaskaairlines.github.io/WebCoreStyleSheets/#responsive-mixin-auro_breakpoint--sm).

Beyond that breakpoint `<auro-button>` will assume the width of the content or a min-width of `8.75rem`, which ever is greater.

If the desired appearance of the `<auro-button>` is to be placed in the reverse direction of natural content, then the attributes of `responsive` and `reverse` are needed on the `<auro-button>` element.

## Multi button support

When the UI requires the use of multiple buttons within the same space, with the use of the [Auro Web Core Style Sheets](https://alaskaairlines.github.io/WebCoreStyleSheets/#utility-auro-css-#{$scope}.auro_containedButtons), and the `auro_containedButtons` .

## Light DOM Support
`<auro-button-light>` are included in this package for [light DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom#lightdom) support.

To pass content to the <auro-button-light>, use the content prop.

```html
<auro-button-light content="Default value"></auro-button-light>
```

### Native form attribute support

The auro-button shadow DOM web component does not support all the native form attributes that a `<button>` element would. But the light DOM version does. These attributes require access to the full light DOM.

* form
* formaction
* formenctype
* formmethod
* formtarget
* formnovalidate
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/essentials.css" />
<script src="https://cdn.jsdelivr.net/@aurodesignsystem/auro-button@latest/dist/auro-button__bundled.js" type="module"></script>
```

<!-- AURO-GENERATED-CONTENT:END -->

## auro-button use cases

The `<auro-button>` element should be used in situations where users may:
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/useCases.md) -->
<!-- The below content is automatically added from ./../docs/partials/useCases.md -->
The auro-button element should be used in situations where users may:

* submit a form
* begin a new task
* trigger a new UI element to appear on the page
* specify a new or next step in a process

## API Code Examples

Default auro-button

* trigger a new UI element to appear to the page
* specificy a new or next step in a process
<!-- AURO-GENERATED-CONTENT:END -->

## API Code Examples

### Default auro-button

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/basic.html) -->
<!-- The below code snippet is automatically added from ./../apiExamples/basic.html -->

```html
<auro-button>Primary</auro-button>
<auro-button disabled>Primary</auro-button>
```

```html
<auro-button secondary>Secondary</auro-button>
<auro-button secondary disabled>Secondary</auro-button>
```

```html
<auro-button tertiary>Tertiary</auro-button>
<auro-button tertiary disabled>Tertiary</auro-button>
```

<auro-button variant="secondary">Secondary</auro-button>
<auro-button variant="tertiary">Tertiary</auro-button>
```
<!-- AURO-GENERATED-CONTENT:END -->

## Development

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/developmentDescription.md) -->
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](https://auro.alaskaair.com/getting-started/developers/contributing) for this project. Please make sure to **pay special attention** to the **conventional commits** section of the document.
Please be sure to review the [contribution guidelines](https://auro.alaskaair.com/contributing) for this project. Please make sure to **pay special attention** to the **conventional commits** section of the document.

<!-- AURO-GENERATED-CONTENT:END -->

### 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 three different shell sessions. One is for the **Gulp tasks**, the second is for a series of **npm tasks** and the last is to run the **Polymer server**.

**Peer dependency:** Please make sure Polymer is installed globally in order to run the Polymer server. See [Auro Component Development Details](https://github.com/AlaskaAirlines/auro_docs/blob/master/src/TECH_DETAILS.md) for more information.
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/localhost.md) -->
Once the project has been cloned to your local resource and you have installed all the dependencies you will need to open a shell session to run the **dev server**.

```shell
// shell terminal one
$ npm run dev
```

Open [localhost:8000](http://localhost:8000/)

If running separate sessions is preferred, please run the following commands in individual terminal shells.

```shell
$ npm run build:watch

// shell terminal two
$ npm run serve
```

Open [localhost:8000](http://localhost:8000/)
<!-- AURO-GENERATED-CONTENT:END -->

### API generation

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/api.md) -->
The custom element API file is generated in the build and committed back to the repo with a version change. If the API doc has changed without a version change, author's are to run `npm run build:api` to generate the doc and commit to version control.

<!-- AURO-GENERATED-CONTENT:END -->

### Testing

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/testing.md) -->
Automated tests are required for every Auro component. See `.\test\auro-button.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](https://auro.alaskaair.com/support/tests) for more details.

<!-- AURO-GENERATED-CONTENT:END -->

### Bundled assets

<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/bundles.md) -->
Bundled assets are only generated in the remote and not merged back to this repo. To review and/or test a bundled asset locally, run `$ npm run bundler` to generate assets.

<!-- AURO-GENERATED-CONTENT:END -->

### Demo deployment

To deploy a demo version of the component for review, run `npm run demo:build` to create a `./build` directory that can be pushed to any static server.
<!-- AURO-GENERATED-CONTENT:START (REMOTE:url=https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/partials/development/deploymentDemo.md) -->
To deploy a demo version of the component for review, run `npm run build:demo` to create a `./build` directory that can be pushed to any static server.

<!-- AURO-GENERATED-CONTENT:END -->
4 changes: 4 additions & 0 deletions apiExamples/basic.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<auro-button>Primary</auro-button>
<auro-button variant="secondary">Secondary</auro-button>
<auro-button variant="tertiary">Tertiary</auro-button>

3 changes: 3 additions & 0 deletions apiExamples/disabled.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button disabled>Primary</auro-button>
<auro-button variant="secondary" disabled>Secondary</auro-button>
<auro-button variant="tertiary" disabled>Tertiary</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/disabledOnDark.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button disabled ondark>Primary</auro-button>
<auro-button variant="secondary" disabled ondark>Secondary</auro-button>
<auro-button variant="tertiary" disabled ondark>Tertiary</auro-button>
6 changes: 6 additions & 0 deletions apiExamples/doAndDont.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<auro-alerts error noIcon>
<auro-button loading disabled>Primary</auro-button>
</auro-alerts>
<auro-alerts success noIcon style="padding-top: 5px;">
<auro-button loading>Primary</auro-button>
</auro-alerts>
3 changes: 3 additions & 0 deletions apiExamples/fluid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button fluid>Primary</auro-button>
<auro-button variant="secondary" fluid>Secondary</auro-button>
<auro-button variant="tertiary" fluid>Tertiary</auro-button>
12 changes: 12 additions & 0 deletions apiExamples/icon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<auro-button>
Activate WiFi
<auro-icon customColor category="in-flight" name="wifi"></auro-icon>
</auro-button>
<auro-button variant="secondary">
Previous action
<auro-icon customcolor category="interface" name="arrow-left"></auro-icon>
</auro-button>
<auro-button variant="tertiary">
Love this ...
<auro-icon customcolor category="interface" name="heart-filled"></auro-icon>
</auro-button>
24 changes: 24 additions & 0 deletions apiExamples/iconOnly.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<auro-button aria-label="home-filled" iconOnly>
<auro-icon
customColor
customSize
category="interface"
name="home-filled">
</auro-icon>
</auro-button>
<auro-button aria-label="arrow-left" variant="secondary" iconOnly>
<auro-icon
customColor
customSize
category="interface"
name="arrow-left">
</auro-icon>
</auro-button>
<auro-button aria-label="heart-filled" variant="tertiary" iconOnly>
<auro-icon
customColor
customSize
category="interface"
name="heart-filled">
</auro-icon>
</auro-button>
24 changes: 24 additions & 0 deletions apiExamples/iconOnlySlim.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<auro-button aria-label="home-filled" iconOnly slim>
<auro-icon
customColor
customSize
category="interface"
name="home-filled">
</auro-icon>
</auro-button>
<auro-button aria-label="arrow-left" variant="secondary" iconOnly slim>
<auro-icon
customColor
customSize
category="interface"
name="arrow-left">
</auro-icon>
</auro-button>
<auro-button aria-label="heart-filled" variant="tertiary" iconOnly slim>
<auro-icon
customColor
customSize
category="interface"
name="heart-filled">
</auro-icon>
</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/loading.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button loading>Primary</auro-button>
<auro-button variant="secondary" loading>Secondary</auro-button>
<auro-button variant="tertiary" loading>Tertiary</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/loadingOnDark.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button ondark loading>Primary</auro-button>
<auro-button variant="secondary" ondark loading>Secondary</auro-button>
<auro-button variant="tertiary" ondark loading>Tertiary</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/onDark.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button ondark>Primary</auro-button>
<auro-button variant="secondary" ondark>Secondary</auro-button>
<auro-button variant="tertiary" ondark>Tertiary</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/passFunction.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
<auro-button disabled onclick="alert('YOU CLICKED ME!');">Primary</auro-button>
<auro-button loading onclick="alert('YOU CLICKED ME!');">Primary</auro-button
4 changes: 4 additions & 0 deletions apiExamples/rounded.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<auro-button aria-label="in-flight" rounded>
Activate WiFi
<auro-icon customSize customcolor category="in-flight" name="wifi" slot="icon"></auro-icon>
</auro-button>
4 changes: 4 additions & 0 deletions apiExamples/roundedHideText.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<auro-button aria-label="in-flight" rounded hideText>
Activate WiFi
<auro-icon customSize customcolor category="in-flight" name="wifi" slot="icon"></auro-icon>
</auro-button>
3 changes: 3 additions & 0 deletions apiExamples/slim.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<auro-button slim>Primary</auro-button>
<auro-button slim variant="secondary">Secondary</auro-button>
<auro-button slim variant="tertiary">Tertiary</auro-button>
Loading

0 comments on commit 6c6e8fb

Please sign in to comment.