@postnord/web-components
Version:
PostNord Web Components
322 lines (321 loc) • 11.5 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. @since v7.5.0 */
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: '0641c9d91a5652eba8498546f1c2e64b3bf5c7f4', 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: 'dd448ea86844b810197fb2735025b9213984918f' }), this.icon && h("pn-icon", { key: '4350858f2f87b0c35e472078ea30eb252a894651', 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": [{
"name": "since",
"text": "v7.5.0"
}],
"text": "The link text."
},
"getter": false,
"setter": false,
"reflect": false,
"attribute": "label"
},
"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,
"reflect": false,
"attribute": "href"
},
"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,
"reflect": false,
"attribute": "light",
"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,
"reflect": false,
"attribute": "icon"
},
"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,
"reflect": false,
"attribute": "left-icon",
"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,
"reflect": false,
"attribute": "download"
},
"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,
"reflect": false,
"attribute": "hreflang"
},
"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,
"reflect": false,
"attribute": "media"
},
"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,
"reflect": false,
"attribute": "referrerpolicy"
},
"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,
"reflect": false,
"attribute": "rel",
"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,
"reflect": false,
"attribute": "target"
},
"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,
"reflect": false,
"attribute": "linkid"
}
};
}
static get elementRef() { return "hostElement"; }
}