Skip to content

Commit

Permalink
refactor(unused api): remove unused api references from code
Browse files Browse the repository at this point in the history
Changes to be committed:
modified:   docs/api.md
modified:   src/auro-menu-option.js
modified:   src/auro-menu.js
modified:   src/auro-sub-menu.js
  • Loading branch information
blackfalcon committed Jan 18, 2022
1 parent 136d69a commit 50da940
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 53 deletions.
39 changes: 18 additions & 21 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
# auro-menu-option

Auro-menu provides users a way to select one option from a pre-defined list of options.
The auro-menu element provides users a way to select one option from a pre-defined list of options.

## Properties

| Property | Attribute | Type | Default | Description |
|--------------------|--------------------|-----------|---------|--------------------------------------------------|
| `beingMouseOvered` | `beingMouseOvered` | `boolean` | | |
| `disabled` | `disabled` | `Boolean` | | When true specifies that the menu-option is disabled. |
| `hasFocus` | `hasFocus` | `boolean` | false | |
| `index` | `index` | `number` | | |
| `selected` | `selected` | `boolean` | | |
| Property | Attribute | Type | Description |
|------------|------------|-----------|--------------------------------------------------|
| `disabled` | `disabled` | `Boolean` | When true specifies that the menu-option is disabled. |
| `selected` | `selected` | `boolean` | |


# auro-menu

Auro-menu provides users a way to select one option from a pre-defined list of options.
The auro-menu element provides users a way to select one option from a pre-defined list of options.

## Attributes

| Attribute | Type | Description |
|-------------|-----------|--------------------------|
| `checkmark` | `Boolean` | Designates checkamrk UI. |
| Attribute | Type | Description |
|-----------|-----------|---------------------|
| `icon` | `Boolean` | Designates icon UI. |

## Properties

| Property | Attribute | Type | Default |
|-----------------------|-----------------------|----------|---------|
| `indexSelectedOption` | `indexSelectedOption` | `number` | |
| `options` | `options` | `array` | null |
| Property | Attribute | Type |
|-----------------------|-----------------------|----------|
| `indexSelectedOption` | `indexSelectedOption` | `number` |

## Events

Expand All @@ -46,10 +42,11 @@ Auro-menu provides users a way to select one option from a pre-defined list of o

# auro-sub-menu

The auro-sub-menu provides users a way to ....

## Properties

| Property | Attribute | Type | Default |
|--------------|--------------|-----------|---------|
| `hasFocus` | | `boolean` | false |
| `hideBottom` | `hideBottom` | `boolean` | |
| `hideTop` | `hideTop` | `boolean` | |
| Property | Attribute | Type | Description |
|--------------|--------------|-----------|------------------------------------------|
| `hideBottom` | `hideBottom` | `Boolean` | Removes hr line from bottom of sub-menu. |
| `hideTop` | `hideTop` | `Boolean` | Removes hr line from top of sub-menu |
10 changes: 6 additions & 4 deletions src/auro-menu-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import styleCssFixed from "./style-menu-option-fixed-css.js";
import check from '@alaskaairux/icons/dist/icons/interface/check-sm_es6';

/**
* Auro-menu provides users a way to select one option from a pre-defined list of options.
* The auro-menu element provides users a way to select one option from a pre-defined list of options.
*
* @attr {Boolean} disabled - When true specifies that the menu-option is disabled.
*/
class AuroMenuOption extends LitElement {
constructor() {
super();
this.hasFocus = false;

/**
* @private
Expand All @@ -31,9 +30,12 @@ class AuroMenuOption extends LitElement {

static get properties() {
return {
beingMouseOvered: { type: Boolean },
hasFocus: { type: Boolean },

/**
* @private
*/
index: { type: Number },

selected: { type: Boolean },
disabled: { type: Boolean }
};
Expand Down
32 changes: 8 additions & 24 deletions src/auro-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "focus-visible/dist/focus-visible.min.js";

// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
/**
* Auro-menu provides users a way to select one option from a pre-defined list of options.
* The auro-menu element provides users a way to select one option from a pre-defined list of options.
*
* @attr {Boolean} icon - Designates icon UI.
* @slot Open slot for insertion of menu options.
Expand All @@ -29,8 +29,12 @@ class AuroMenu extends LitElement {

static get properties() {
return {
options: { type: Array },
indexSelectedOption: { type: Number }
indexSelectedOption: { type: Number },

/**
* @private
*/
options: { type: Array }
};
}

Expand Down Expand Up @@ -102,22 +106,6 @@ class AuroMenu extends LitElement {
}
});

const funcFocus = (evt) => {
evt.setAttribute('hasfocus', '');
};

const funcBlur = (evt) => {
evt.removeAttribute('hasfocus');
};

const funcMouseOver = (evt) => {
evt.setAttribute('beingMouseOvered', '');
};

const funcMouseOut = (evt) => {
evt.removeAttribute('beingMouseOvered');
};

const handleKeyDown = (evt) => {
if (evt.key.toLowerCase() === 'enter' || evt.key.toLowerCase() === ' ') {
dispatchEventOptionSelected(Number(evt.target.getAttribute('index')), evt.target.getAttribute('data-value'), evt.target.innerText);
Expand Down Expand Up @@ -149,17 +137,13 @@ class AuroMenu extends LitElement {
}
};

// Prep each <li>. Give it an index, set its tabindex to -1, add 'keydown' and 'click' event listeners, inject a checkmark auro-icon
// Prep each <li>. Give it an index, set its tabindex to -1, add 'keydown' and 'click' event listeners, inject a check mark icon
for (let iter = 0; iter < this.options.length; iter += 1) {

// each option is tabbable
this.options[iter].setAttribute('tabindex', '0');
this.options[iter].addEventListener('keydown', (evt) => handleKeyDown(evt));
this.options[iter].addEventListener('click', (evt) => dispatchEventOptionSelected(Number(evt.target.getAttribute('index')), evt.target.getAttribute('data-value'), evt.target.innerText));
this.options[iter].addEventListener('focus', (evt) => funcFocus(evt.target));
this.options[iter].addEventListener('blur', (evt) => funcBlur(evt.target));
this.options[iter].addEventListener('mouseover', (evt) => funcMouseOver(evt.target));
this.options[iter].addEventListener('mouseout', (evt) => funcMouseOut(evt.target));
}
}

Expand Down
14 changes: 10 additions & 4 deletions src/auro-sub-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ import styleCss from "./style-sub-menu-css.js";
import styleCssFixed from "./style-sub-menu-fixed-css.js";
import "focus-visible/dist/focus-visible.min.js";

/**
* The auro-sub-menu provides users a way to ....
*
* @attr {Boolean} hideTop - Removes hr line from top of sub-menu
* @attr {Boolean} hideBottom - Removes hr line from bottom of sub-menu.
*/

class AuroSubMenu extends LitElement {
constructor() {
super();
this.hasFocus = false;
}
// constructor() {
// super();
// }

static get properties() {
return {
Expand Down

0 comments on commit 50da940

Please sign in to comment.