@duetds/components
Version:
This package includes Duet Core Components and related tools.
41 lines (40 loc) • 2.32 kB
JavaScript
import { r as registerInstance, h } from './core-12b6bfe8.js';
var DuetLink = /** @class */ (function () {
function DuetLink(hostRef) {
registerInstance(this, hostRef);
/**
* Theme of the button. Can be one of: "default", "turva".
*/
this.theme = "";
/**
* A destination to link to, rendered in the href attribute of a link.
*/
this.url = "#";
/**
* Forces URL to open in a new browser tab. Used together with URL prop.
*/
this.external = false;
}
/**
* Component lifecycle events.
*/
DuetLink.prototype.componentWillLoad = function () {
if (this.theme !== "default" && document.documentElement.classList.contains("duet-theme-turva")) {
this.theme = "turva";
}
};
/**
* render() function
* Always the last one in the class.
*/
DuetLink.prototype.render = function () {
return (h("a", { href: this.url, class: { "duet-link": true, "duet-theme-turva": this.theme === "turva" }, target: this.external ? "_blank" : "_self", "aria-label": this.accessibleLabel, id: this.identifier }, h("slot", null)));
};
Object.defineProperty(DuetLink, "style", {
get: function () { return ".duet-link,:host{-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent;border:0;padding:0;margin:0;display:inline}.duet-link{text-decoration:underline;font-style:normal;-webkit-transition:.3s ease;transition:.3s ease;font-family:localtapiola-sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;font-weight:400;color:#0077b3}.duet-link.duet-theme-turva,.duet-theme-turva .duet-link{color:#c60c30;font-family:turva-sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}.duet-link:hover{color:#004d80;text-decoration:none}.duet-link:hover.duet-theme-turva,.duet-theme-turva .duet-link:hover{color:#940925}.duet-link:active{-webkit-transition:none;transition:none;opacity:.75}"; },
enumerable: true,
configurable: true
});
return DuetLink;
}());
export { DuetLink as duet_link };