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

Upgrade to auro-library 3.0.1 #237

Merged
merged 2 commits into from
Nov 15, 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
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The README.md file is a compiled document. No edits should be made directly to t
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`
`https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README_updated_paths.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:
Expand All @@ -19,12 +19,12 @@ The following sections are editable by making changes to the following files:

# Hyperlink

<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/description.md) -->
<!-- The below content is automatically added from ./../docs/partials/description.md -->
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
<!-- The below content is automatically added from ./docs/partials/description.md -->
`<auro-hyperlink>` is a wrapper components for an HTML `<a>` element containing styling and behavior.
<!-- 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: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 -->

Expand Down Expand Up @@ -72,8 +72,8 @@ import "@aurodesignsystem/auro-hyperlink";

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

```html
<auro-hyperlink>No href supplied</auro-hyperlink><br>
Expand Down Expand Up @@ -104,8 +104,8 @@ In cases where the project is not able to process JS assets, there are pre-proce

## auro-hyperlink use cases

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

* stand-alone link element for navigation
Expand All @@ -117,8 +117,8 @@ The `<auro-hyperlink>` elements should be used in situations where users may:

### Default auro-hyperlink

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

```html
<auro-hyperlink>No href supplied</auro-hyperlink><br>
Expand Down
136 changes: 68 additions & 68 deletions demo/api.md

Large diffs are not rendered by default.

78 changes: 74 additions & 4 deletions demo/api.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShad

/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */

class AuroLibraryRuntimeUtils {
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {

/* eslint-disable jsdoc/require-param */

Expand Down Expand Up @@ -118,7 +118,7 @@ class AuroLibraryRuntimeUtils {

return elemTag === tag || elem.hasAttribute(tag);
}
}
};

var externalLink = {"role":"img","color":"currentColor","title":"Link to external site.","desc":"This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","type":"icon","name":"external-link-stroke","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"external-link-stroke__title external-link-stroke__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\" part=\"svg\"><title id=\"external-link-stroke__title\">Link to external site.</title><desc id=\"external-link-stroke__desc\">This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.</desc><path d=\"M7 6.25h5a.75.75 0 0 1 .102 1.494L12 7.75H7a1.25 1.25 0 0 0-1.244 1.123L5.75 9v8c0 .648.492 1.18 1.122 1.244L7 18.25h8a1.25 1.25 0 0 0 1.244-1.122L16.25 17v-5a.75.75 0 0 1 1.493-.101l.007.101v5a2.75 2.75 0 0 1-2.582 2.745L15 19.75H7a2.75 2.75 0 0 1-2.745-2.582L4.25 17V9a2.75 2.75 0 0 1 2.582-2.745zh5zm12.025-2 .125.015.11.032.128.061c.18.108.317.29.353.522l.009.12v5a.75.75 0 0 1-1.493.102L18.25 10V6.811l-6.72 6.72a.75.75 0 0 1-1.133-.977l.073-.084 6.718-6.72H14a.75.75 0 0 1-.743-.648L13.25 5a.75.75 0 0 1 .648-.743L14 4.25z\"/></svg>"};

Expand Down Expand Up @@ -158,7 +158,7 @@ class ComponentBase extends h {
/**
* @private
*/
this.runtimeUtils = new AuroLibraryRuntimeUtils();
this.runtimeUtils = new AuroLibraryRuntimeUtils$1();

/*
If the component requires a touch detection,
Expand Down Expand Up @@ -667,6 +667,76 @@ var tokensCss$1 = i$1`:host{--ds-auro-icon-color: var(--ds-color-icon-primary-de

var colorCss$1 = i$1`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-default, #a2c270)}:host(:not([onDark])[disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-default, #adadad)}:host(:not([onDark])[emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-default, #2a2a2a)}:host(:not([onDark])[error]){--ds-auro-icon-color: var(--ds-color-icon-error-default, #cc1816)}:host(:not([onDark])[info]){--ds-auro-icon-color: var(--ds-color-icon-info-default, #326aa5)}:host(:not([onDark])[secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-default, #7e8894)}:host(:not([onDark])[subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-default, #a0c9f1)}:host(:not([onDark])[success]){--ds-auro-icon-color: var(--ds-color-icon-success-default, #40a080)}:host(:not([onDark])[tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-default, #afb9c6)}:host(:not([onDark])[warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-default, #c49432)}:host([onDark]){--ds-auro-icon-color: var(--ds-color-icon-primary-inverse, #f7f7f7)}:host([onDark][accent]){--ds-auro-icon-color: var(--ds-color-icon-accent-inverse, #badd81)}:host([onDark][disabled]){--ds-auro-icon-color: var(--ds-color-icon-ui-primary-disabled-inverse, #7e7e7e)}:host([onDark][emphasis]){--ds-auro-icon-color: var(--ds-color-icon-emphasis-inverse, #ffffff)}:host([onDark][error]){--ds-auro-icon-color: var(--ds-color-icon-error-inverse, #f9aca6)}:host([onDark][info]){--ds-auro-icon-color: var(--ds-color-icon-info-inverse, #89b2d4)}:host([onDark][secondary]){--ds-auro-icon-color: var(--ds-color-icon-secondary-inverse, #ccd2db)}:host([onDark][subtle]){--ds-auro-icon-color: var(--ds-color-icon-subtle-inverse, #326aa5)}:host([onDark][success]){--ds-auro-icon-color: var(--ds-color-icon-success-inverse, #8eceb9)}:host([onDark][tertiary]){--ds-auro-icon-color: var(--ds-color-icon-tertiary-inverse, #939fad)}:host([onDark][warning]){--ds-auro-icon-color: var(--ds-color-icon-warning-inverse, #f2c153)}`;

// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------

/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */

class AuroLibraryRuntimeUtils {

/* eslint-disable jsdoc/require-param */

/**
* This will register a new custom element with the browser.
* @param {String} name - The name of the custom element.
* @param {Object} componentClass - The class to register as a custom element.
* @returns {void}
*/
registerComponent(name, componentClass) {
if (!customElements.get(name)) {
customElements.define(name, class extends componentClass {});
}
}

/**
* Finds and returns the closest HTML Element based on a selector.
* @returns {void}
*/
closestElement(
selector, // selector like in .closest()
base = this, // extra functionality to skip a parent
__Closest = (el, found = el && el.closest(selector)) =>
!el || el === document || el === window
? null // standard .closest() returns null for non-found selectors also
: found
? found // found a selector INside this element
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
DukeFerdinand marked this conversation as resolved.
Show resolved Hide resolved
) {
return __Closest(base);
}
/* eslint-enable jsdoc/require-param */

/**
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
* @param {Object} elem - The element to check.
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
* @returns {void}
*/
handleComponentTagRename(elem, tagName) {
const tag = tagName.toLowerCase();
const elemTag = elem.tagName.toLowerCase();

if (elemTag !== tag) {
elem.setAttribute(tag, true);
}
}

/**
* Validates if an element is a specific Auro component.
* @param {Object} elem - The element to validate.
* @param {String} tagName - The name of the Auro component to check against.
* @returns {Boolean} - Returns true if the element is the specified Auro component.
*/
elementMatch(elem, tagName) {
const tag = tagName.toLowerCase();
const elemTag = elem.tagName.toLowerCase();

return elemTag === tag || elem.hasAttribute(tag);
}
}

// Copyright (c) 2020 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

Expand Down Expand Up @@ -937,7 +1007,7 @@ class AuroHyperlink extends ComponentBase {
*
*/
static register(name = "auro-hyperlink") {
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroHyperlink);
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroHyperlink);
}

/**
Expand Down
Loading