@postnord/web-components
Version:
PostNord Web Components
286 lines (285 loc) • 10.1 kB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { h } from "@stencil/core";
/** The `pn-text-link` is a styled `a` element with some extra functionality built in. Such as `icon` and `light` support. */
export class PnTextLink {
constructor() {
this.label = undefined;
this.href = undefined;
this.light = false;
this.icon = undefined;
this.leftIcon = false;
this.download = undefined;
this.hreflang = undefined;
this.media = undefined;
this.referrerpolicy = undefined;
this.rel = 'noopener noreferrer';
this.target = undefined;
this.linkid = undefined;
}
hostElement;
render() {
return (h("a", { key: '5bec8afa95c166c57377f89d77ef198176029283', id: this.linkid, class: "pn-text-link", href: this.href, rel: this.rel, target: this.target, download: this.download, hreflang: this.hreflang, media: this.media, referrerPolicy: this.referrerpolicy, "data-icon": !!this.icon, "data-icon-left": this.leftIcon, "data-light": this.light }, this.label, h("slot", { key: '9cac93829518f6285b5685d7c944e920726c3304' }), this.icon && h("pn-icon", { key: 'b124775fae4cdae11e3818901360e6db51299601', icon: this.icon })));
}
static get is() { return "pn-text-link"; }
static get originalStyleUrls() {
return {
"$": ["pn-text-link.scss"]
};
}
static get styleUrls() {
return {
"$": ["pn-text-link.css"]
};
}
static get properties() {
return {
"label": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [],
"text": "The link text."
},
"attribute": "label",
"reflect": false
},
"href": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": "The URL string."
},
"attribute": "href",
"reflect": false
},
"light": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [{
"name": "category",
"text": "Visual"
}],
"text": "Use the light version of the link."
},
"attribute": "light",
"reflect": false,
"defaultValue": "false"
},
"icon": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Visual"
}],
"text": "SVG content of the icon."
},
"attribute": "icon",
"reflect": false
},
"leftIcon": {
"type": "boolean",
"mutable": false,
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [{
"name": "category",
"text": "Visual"
}],
"text": "Align the icon on the left."
},
"attribute": "left-icon",
"reflect": false,
"defaultValue": "false"
},
"download": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Treat the link as a download link."
},
"attribute": "download",
"reflect": false
},
"hreflang": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Set the hreflang of the URL destination."
},
"attribute": "hreflang",
"reflect": false
},
"media": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Link media."
},
"attribute": "media",
"reflect": false
},
"referrerpolicy": {
"type": "string",
"mutable": false,
"complexType": {
"original": "ReferrerPolicy",
"resolved": "\"\" | \"no-referrer\" | \"no-referrer-when-downgrade\" | \"origin\" | \"origin-when-cross-origin\" | \"same-origin\" | \"strict-origin\" | \"strict-origin-when-cross-origin\" | \"unsafe-url\"",
"references": {
"ReferrerPolicy": {
"location": "global",
"id": "global::ReferrerPolicy"
}
}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Set referrerpolicy on the link."
},
"attribute": "referrerpolicy",
"reflect": false
},
"rel": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Set the rel of the link."
},
"attribute": "rel",
"reflect": false,
"defaultValue": "'noopener noreferrer'"
},
"target": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Set the target of the link."
},
"attribute": "target",
"reflect": false
},
"linkid": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": true,
"docs": {
"tags": [{
"name": "category",
"text": "Link attributes"
}],
"text": "Set a unique html ID of the a element."
},
"attribute": "linkid",
"reflect": false
}
};
}
static get elementRef() { return "hostElement"; }
}
//# sourceMappingURL=pn-text-link.js.map