Skip to content

Commit

Permalink
feat: add component name as attribute during custom registration
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 authored and jason-capsule42 committed Oct 1, 2024
1 parent a3118b7 commit e9b22f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/auro-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import styleCss from "./style-menu-css.js";
import colorCss from "./color-menu-css.js";
import tokensCss from "./tokens-css.js";

import AuroLibraryRuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';

import './auro-menuoption.js';
import "mark.js/dist/mark.es6.min.js";

Expand Down Expand Up @@ -50,6 +52,11 @@ export class AuroMenu extends LitElement {
* @private
*/
this.rootMenu = true;

/**
* @private
*/
this.runtimeUtils = new AuroLibraryRuntimeUtils();
}

static get properties() {
Expand Down Expand Up @@ -100,6 +107,9 @@ export class AuroMenu extends LitElement {
}

firstUpdated() {
// Add the tag name as an attribute if it is different than the component name
this.runtimeUtils.handleComponentTagRename(this, 'auro-menu');

this.addEventListener('keydown', this.handleKeyDown);
}

Expand Down
12 changes: 10 additions & 2 deletions src/auro-menuoption.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import styleCss from "./style-menuoption-css.js";
import colorCss from "./color-menuoption-css.js";
import tokensCss from "./tokens-css.js";


import AuroLibraryRuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';
import { AuroDependencyVersioning } from '@aurodesignsystem/auro-library/scripts/runtime/dependencyTagVersioning.mjs';

import { AuroIcon } from '@aurodesignsystem/auro-icon/src/auro-icon.js';
import iconVersion from './iconVersion';

Expand All @@ -32,7 +33,6 @@ class AuroMenuOption extends LitElement {
/**
* Generate unique names for dependency components.
*/

const versioning = new AuroDependencyVersioning();
this.iconTag = versioning.generateTag('auro-icon', iconVersion, AuroIcon);

Expand All @@ -44,6 +44,11 @@ class AuroMenuOption extends LitElement {
* @private
*/
this.tabIndex = -1;

/**
* @private
*/
this.runtimeUtils = new AuroLibraryRuntimeUtils();
}

static get properties() {
Expand Down Expand Up @@ -80,6 +85,9 @@ class AuroMenuOption extends LitElement {
}

firstUpdated() {
// Add the tag name as an attribute if it is different than the component name
this.runtimeUtils.handleComponentTagRename(this, 'auro-menuoption');

this.setAttribute('role', 'option');

this.addEventListener('mouseover', () => {
Expand Down

0 comments on commit e9b22f9

Please sign in to comment.