@duetds/components
Version:
This package includes Duet Core Components and related tools.
42 lines (37 loc) • 2.17 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
const core = require('./core-e5cda7d4.js');
const DuetLink = class {
constructor(hostRef) {
core.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.
*/
componentWillLoad() {
if (this.theme !== "default" && document.documentElement.classList.contains("duet-theme-turva")) {
this.theme = "turva";
}
}
/**
* render() function
* Always the last one in the class.
*/
render() {
return (core.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 }, core.h("slot", null)));
}
static get style() { 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}"; }
};
exports.duet_link = DuetLink;