@postnord/web-components
Version:
PostNord Web Components
320 lines (319 loc) • 11.4 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 {
hostElement;
/** The link text. */
label;
/** The URL string. */
href;
/** Use the light version of the link. @category Visual */
light = false;
/** SVG content of the icon. @category Visual */
icon;
/** Align the icon on the left. @category Visual */
leftIcon = false;
/** Treat the link as a download link. @category Link attributes */
download;
/** Set the hreflang of the URL destination. @category Link attributes */
hreflang;
/** Link media. @category Link attributes */
media;
/** Set referrerpolicy on the link. @category Link attributes */
referrerpolicy;
/** Set the rel of the link. @category Link attributes */
rel = 'noopener noreferrer';
/** Set the target of the link. @category Link attributes */
target;
/** Set a unique html ID of the a element. @category Link attributes */
linkid;
render() {
return (h("a", { key: '00ec79f634394a7a7aa40d0b5545cd45454851dd', 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: '9ac17c4c1c8e3866937eaf28a7cedcf1e2a41d0a' }), this.icon && h("pn-icon", { key: '29cd69e85bf4a3190f5e42a54e0b87ecd9a59745', 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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"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."
},
"getter": false,
"setter": false,
"attribute": "linkid",
"reflect": false
}
};
}
static get elementRef() { return "hostElement"; }
}
//# sourceMappingURL=pn-text-link.js.map