@uswds/web-components
Version:
> [!CAUTION] > Work on the next version of the Design System is happening in this repo. The code in this repository is not yet ready for production use.
29 lines (25 loc) • 1.46 kB
JavaScript
;var r=Object.defineProperty;var h=(t,e,s)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>h(t,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lit"),a=i.css`
:host {
a {
color: var(--theme-link-color, #005ea2);
text-decoration: underline;
}
a:visited {
color: var(--theme-link-visited-color, #54278f);
}
a:hover {
color: var(--theme-link-hover-color, #1a4480);
}
a:active {
color: var(--theme-link-active-color, #162e51);
}
a:focus {
/* @include focus-outline; */
outline: var(--theme-focus-width, 0.25rem) var(--theme-focus-style, solid)
var(--theme-focus-color, #2491ff);
outline-offset: var(--theme-focus-offset, 0);
}
}
`;class l extends i.LitElement{hasLinkChild(){const e=this.querySelector("a");if(!e)return!1;this.href=e.href,this.slottedChildren=e,this.shadowRoot.appendChild(this.slottedChildren)}constructor(){super()}templateWithChildren(){return i.html`<a class="usa-link" href="${this.href}"
>${this.slottedChildren}</a
>`}templateWithSlots(){return i.html`<a class="usa-link" href="${this.href}"><slot></slot></a>`}render(){return this.hasLinkChild()?this.templateWithChildren():this.templateWithSlots()}}o(l,"styles",[a]),o(l,"properties",{href:{}});window.customElements.define("usa-link",l);exports.UsaLink=l;