Skip to content
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

Add programmatic value example and edit docs #158

Merged
merged 5 commits into from
Feb 19, 2024
Merged
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ For the most up to date information on [UI development browser support](https://

## Install

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

![ESM supported](https://img.shields.io/badge/ESM-compatible-FFE900?style=for-the-badge)

```shell
$ npm i @aurodesignsystem/auro-combobox
```
Expand Down
12 changes: 12 additions & 0 deletions apiExamples/programmaticValue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<auro-combobox value="Apples">
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption value="Prefer Alaska" id="option-5">Prefer Alaska</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
8 changes: 4 additions & 4 deletions apiExamples/swapValue.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<auro-button id="swapExampleBtn" iconOnly secondary>
<auro-button id="swapExampleBtn" iconOnly>
<auro-icon
customColor
customSize
customColor
category="terminal"
name="round-trip-arrows">
name="round-trip-arrows"
slot="icon">
</auro-icon>
</auro-button>
<auro-combobox id="swapExampleRight">
Expand Down
83 changes: 62 additions & 21 deletions demo/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,22 @@

### Basic

<div class="twoColDemoRow">
<div>
<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
<!-- The below content is automatically added from ./../../apiExamples/basic.html -->
<auro-combobox>
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<!-- AURO-GENERATED-CONTENT:END -->
</div>
<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
<!-- The below content is automatically added from ./../../apiExamples/basic.html -->
<auro-combobox>
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<!-- AURO-GENERATED-CONTENT:END -->
</div>
<auro-accordion alignRight>
<span slot="trigger">See code</span>
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/basic.html) -->
Expand All @@ -85,7 +83,7 @@
<!-- AURO-GENERATED-CONTENT:END -->
</auro-accordion>

#### Dynamic Menu
### Dynamic Menu

This example demonstrates a data driven combobox. The data is used to populate the `auro-menu`. In this example, each time the input's value changes, the data is updated and the menu is recreated.

Expand Down Expand Up @@ -406,7 +404,50 @@ Populates the `required` attribute on the input. Used for client-side validation

#### value

Value selected for the dropdown menu.
Use the `value` attribute to programmatically set the value of the combobox.

<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/programmaticValue.html) -->
<!-- The below content is automatically added from ./../../apiExamples/programmaticValue.html -->
<auro-combobox value="Apples">
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption value="Prefer Alaska" id="option-5">Prefer Alaska</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<!-- AURO-GENERATED-CONTENT:END -->
</div>
<auro-accordion alignRight>
<span slot="trigger">See code</span>
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/programmaticValue.html) -->
<!-- The below code snippet is automatically added from ./../../apiExamples/programmaticValue.html -->

```html
<auro-combobox value="Apples">
<span slot="label">Name</span>
<auro-menu>
<auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
<auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
<auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
<auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
<auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
<auro-menuoption value="Prefer Alaska" id="option-5">Prefer Alaska</auro-menuoption>
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
```
<!-- AURO-GENERATED-CONTENT:END -->
</auro-accordion>

#### Dynamically Set Value

Use the `value` attribute in combination with another element to dynamically set the value of the combobox.

Can be used in the following ways:
* Preset the value of the combobox to valid menu option
Expand Down Expand Up @@ -435,7 +476,7 @@ Note: using a value that does not match a menu option will reset the combobox va
</auro-menu>
</auro-combobox>
<!-- AURO-GENERATED-CONTENT:END -->
</div>
</div>
<auro-accordion alignRight>
<span slot="trigger">See code</span>
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/value.html) -->
Expand Down
16 changes: 8 additions & 8 deletions demo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,12 @@ This example illustrates using a JavaScript function attached to an auro-button
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<auro-button id="swapExampleBtn" iconOnly secondary>
<auro-button id="swapExampleBtn" iconOnly>
<auro-icon
customColor
customSize
customColor
category="terminal"
name="round-trip-arrows">
name="round-trip-arrows"
slot="icon">
</auro-icon>
</auro-button>
<auro-combobox id="swapExampleRight">
Expand Down Expand Up @@ -531,12 +531,12 @@ This example illustrates using a JavaScript function attached to an auro-button
<auro-menuoption static nomatch>No matching option</auro-menuoption>
</auro-menu>
</auro-combobox>
<auro-button id="swapExampleBtn" iconOnly secondary>
<auro-button id="swapExampleBtn" iconOnly>
<auro-icon
customColor
customSize
customColor
category="terminal"
name="round-trip-arrows">
name="round-trip-arrows"
slot="icon">
</auro-icon>
</auro-button>
<auro-combobox id="swapExampleRight">
Expand Down
33 changes: 25 additions & 8 deletions docs/partials/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

### Basic

<div class="twoColDemoRow">
<div>
<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
<!-- AURO-GENERATED-CONTENT:END -->
</div>
<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/basic.html) -->
<!-- AURO-GENERATED-CONTENT:END -->
</div>

<auro-accordion alignRight>
<span slot="trigger">See code</span>

Expand All @@ -20,7 +19,7 @@

</auro-accordion>

#### Dynamic Menu
### Dynamic Menu

This example demonstrates a data driven combobox. The data is used to populate the `auro-menu`. In this example, each time the input's value changes, the data is updated and the menu is recreated.

Expand Down Expand Up @@ -126,7 +125,24 @@ Populates the `required` attribute on the input. Used for client-side validation

#### value

Value selected for the dropdown menu.
Use the `value` attribute to programmatically set the value of the combobox.

<div class="exampleWrapper">
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/programmaticValue.html) -->
<!-- AURO-GENERATED-CONTENT:END -->
</div>

<auro-accordion alignRight>
<span slot="trigger">See code</span>

<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../../apiExamples/programmaticValue.html) -->
<!-- AURO-GENERATED-CONTENT:END -->

</auro-accordion>

#### Dynamically Set Value

Use the `value` attribute in combination with another element to dynamically set the value of the combobox.

Can be used in the following ways:
* Preset the value of the combobox to valid menu option
Expand All @@ -139,6 +155,7 @@ Note: using a value that does not match a menu option will reset the combobox va
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../../apiExamples/value.html) -->
<!-- AURO-GENERATED-CONTENT:END -->
</div>

<auro-accordion alignRight>
<span slot="trigger">See code</span>

Expand Down
Loading