From 50da94069e76139ee8b44465b2e201176fa834d9 Mon Sep 17 00:00:00 2001 From: Dale Sande Date: Tue, 18 Jan 2022 12:24:05 -0800 Subject: [PATCH] refactor(unused api): remove unused api references from code 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 --- docs/api.md | 39 ++++++++++++++++++--------------------- src/auro-menu-option.js | 10 ++++++---- src/auro-menu.js | 32 ++++++++------------------------ src/auro-sub-menu.js | 14 ++++++++++---- 4 files changed, 42 insertions(+), 53 deletions(-) diff --git a/docs/api.md b/docs/api.md index 40b2e8e..f1bbd97 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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 @@ -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 | diff --git a/src/auro-menu-option.js b/src/auro-menu-option.js index 667ca87..a742b97 100644 --- a/src/auro-menu-option.js +++ b/src/auro-menu-option.js @@ -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 @@ -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 } }; diff --git a/src/auro-menu.js b/src/auro-menu.js index 16be1a1..6dc46a7 100644 --- a/src/auro-menu.js +++ b/src/auro-menu.js @@ -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. @@ -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 } }; } @@ -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); @@ -149,17 +137,13 @@ class AuroMenu extends LitElement { } }; - // Prep each
  • . Give it an index, set its tabindex to -1, add 'keydown' and 'click' event listeners, inject a checkmark auro-icon + // Prep each
  • . 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)); } } diff --git a/src/auro-sub-menu.js b/src/auro-sub-menu.js index f023240..249f676 100644 --- a/src/auro-sub-menu.js +++ b/src/auro-sub-menu.js @@ -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 {