@fluid-topics/ft-link 1.1.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/build/ft-link.light.js +292 -0
- package/build/ft-link.min.js +520 -0
- package/build/ftds-link.d.ts +25 -0
- package/build/ftds-link.js +92 -0
- package/build/ftds-link.properties.d.ts +4 -0
- package/build/ftds-link.properties.js +1 -0
- package/build/ftds-link.styles.d.ts +2 -0
- package/build/ftds-link.styles.js +98 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +6 -0
- package/package.json +28 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ElementDefinitionsMap, FtdsBase } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
import { FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
3
|
+
import { ClassInfo } from "lit/directives/class-map";
|
|
4
|
+
import { FtdsLinkProperties } from "./ftds-link.properties";
|
|
5
|
+
export declare enum LinkTarget {
|
|
6
|
+
SELF = "_self",
|
|
7
|
+
BLANK = "_blank"
|
|
8
|
+
}
|
|
9
|
+
export declare class FtdsLink extends FtdsBase implements FtdsLinkProperties {
|
|
10
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
11
|
+
get linkClasses(): ClassInfo;
|
|
12
|
+
href: string;
|
|
13
|
+
variant: FtTypographyVariants;
|
|
14
|
+
underlined: boolean;
|
|
15
|
+
openInNewTabLabel: string;
|
|
16
|
+
target: LinkTarget;
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
private readonly icon;
|
|
19
|
+
protected render(): import("lit").TemplateResult<1>;
|
|
20
|
+
private resolveIcon;
|
|
21
|
+
get resolveVariantClasses(): {
|
|
22
|
+
[x: string]: boolean;
|
|
23
|
+
};
|
|
24
|
+
private onSlotchange;
|
|
25
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
10
|
+
import { FtdsBase, isSafari, safariEllipsisFix } from "@fluid-topics/ft-wc-utils";
|
|
11
|
+
import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
|
|
12
|
+
import { FtIcon, FtIconVariants } from "@fluid-topics/ft-icon";
|
|
13
|
+
import { designSystemStyles } from "./ftds-link.styles";
|
|
14
|
+
export var LinkTarget;
|
|
15
|
+
(function (LinkTarget) {
|
|
16
|
+
LinkTarget["SELF"] = "_self";
|
|
17
|
+
LinkTarget["BLANK"] = "_blank";
|
|
18
|
+
})(LinkTarget || (LinkTarget = {}));
|
|
19
|
+
class FtdsLink extends FtdsBase {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.href = "";
|
|
23
|
+
this.variant = FtTypographyVariants.body2medium;
|
|
24
|
+
this.underlined = false;
|
|
25
|
+
this.openInNewTabLabel = "This link will be opened in a new tab";
|
|
26
|
+
this.target = LinkTarget.SELF;
|
|
27
|
+
this.icon = "extlink-light";
|
|
28
|
+
}
|
|
29
|
+
get linkClasses() {
|
|
30
|
+
return {
|
|
31
|
+
"ftds-link": true,
|
|
32
|
+
"ftds-link--underlined": this.underlined,
|
|
33
|
+
...this.resolveVariantClasses,
|
|
34
|
+
...this.getDesignSystemBaseClasses(),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return html `
|
|
39
|
+
<a part="link"
|
|
40
|
+
target="${this.target}"
|
|
41
|
+
href="${this.href}"
|
|
42
|
+
class="${classMap(this.linkClasses)}">
|
|
43
|
+
<ft-typography part="label"
|
|
44
|
+
variant=${this.variant}
|
|
45
|
+
element="span"
|
|
46
|
+
class="ftds-link--label ${isSafari ? "ft-safari-ellipsis-fix" : ""}">
|
|
47
|
+
<span><slot @slotchange=${this.onSlotchange}></slot></span>
|
|
48
|
+
</ft-typography>
|
|
49
|
+
${this.resolveIcon()}
|
|
50
|
+
</a>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
resolveIcon() {
|
|
54
|
+
return this.target === LinkTarget.BLANK ? html `
|
|
55
|
+
<ft-icon aria-label="${this.openInNewTabLabel}" part="icon" .variant="${FtIconVariants.fluid_topics}" .value="${this.icon}">
|
|
56
|
+
</ft-icon>
|
|
57
|
+
` : html ``;
|
|
58
|
+
}
|
|
59
|
+
get resolveVariantClasses() {
|
|
60
|
+
let prefix = "ftds-link--variant-";
|
|
61
|
+
return {
|
|
62
|
+
[prefix + this.variant]: true
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
onSlotchange() {
|
|
66
|
+
this.requestUpdate();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
FtdsLink.elementDefinitions = {
|
|
70
|
+
"ft-typography": FtTypography,
|
|
71
|
+
"ft-icon": FtIcon
|
|
72
|
+
};
|
|
73
|
+
FtdsLink.styles = [
|
|
74
|
+
safariEllipsisFix,
|
|
75
|
+
designSystemStyles
|
|
76
|
+
];
|
|
77
|
+
__decorate([
|
|
78
|
+
property()
|
|
79
|
+
], FtdsLink.prototype, "href", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property()
|
|
82
|
+
], FtdsLink.prototype, "variant", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
property({ type: Boolean })
|
|
85
|
+
], FtdsLink.prototype, "underlined", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
property()
|
|
88
|
+
], FtdsLink.prototype, "openInNewTabLabel", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property()
|
|
91
|
+
], FtdsLink.prototype, "target", void 0);
|
|
92
|
+
export { FtdsLink };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { link } from "@fluid-topics/design-system-variables";
|
|
3
|
+
import { FtIconCssVariables } from "@fluid-topics/ft-icon";
|
|
4
|
+
import { designSystemVariables, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
5
|
+
export { link as FtdsLinkCssVariables } from "@fluid-topics/design-system-variables";
|
|
6
|
+
// language=CSS
|
|
7
|
+
export const designSystemStyles = css `
|
|
8
|
+
|
|
9
|
+
.ftds-link {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: baseline;
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ftds-link.ftds-link--underlined .ftds-link--label {
|
|
16
|
+
text-decoration: underline;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ftds-link:focus-visible {
|
|
20
|
+
outline: 2px solid;
|
|
21
|
+
outline-offset: 2px;
|
|
22
|
+
border-radius: ${designSystemVariables.borderRadiusS};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ftds-link--variant-caption-2-medium,
|
|
26
|
+
.ftds-link--variant-caption-2-semibold,
|
|
27
|
+
.ftds-link--variant-caption-2-bold
|
|
28
|
+
{
|
|
29
|
+
${setVariable(FtIconCssVariables.size, '14px')};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ftds-link--variant-caption-1-medium,
|
|
33
|
+
.ftds-link--variant-caption-1-semibold,
|
|
34
|
+
.ftds-link--variant-caption-1-bold
|
|
35
|
+
{
|
|
36
|
+
${setVariable(FtIconCssVariables.size, '16px')};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ftds-link--variant-body-2-medium,
|
|
40
|
+
.ftds-link--variant-body-2-semibold,
|
|
41
|
+
.ftds-link--variant-body-2-regular
|
|
42
|
+
{
|
|
43
|
+
${setVariable(FtIconCssVariables.size, '18px')};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ftds--family-neutral {
|
|
47
|
+
color: ${link.neutralDefaultColor};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ftds--family-neutral:hover {
|
|
51
|
+
color: ${link.neutralHoverColor};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ftds--family-neutral:focus-visible {
|
|
55
|
+
color: ${link.neutralFocusColor};
|
|
56
|
+
outline-color: ${link.neutralFocusFocusRingColor};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ftds--family-neutral:active {
|
|
60
|
+
color: ${link.neutralActiveColor};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ftds--family-info {
|
|
64
|
+
color: ${link.infoDefaultColor};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ftds--family-info:hover {
|
|
68
|
+
color: ${link.infoHoverColor};
|
|
69
|
+
opacity: ${link.infoHoverOpacity};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ftds--family-info:focus-visible {
|
|
73
|
+
color: ${link.infoFocusColor};
|
|
74
|
+
outline-color: ${link.infoFocusFocusRingColor};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ftds--family-info:active {
|
|
78
|
+
color: ${link.infoActiveColor};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ftds--family-brand {
|
|
82
|
+
color: ${link.brandDefaultColor};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ftds--family-brand:hover {
|
|
86
|
+
color: ${link.brandHoverColor};
|
|
87
|
+
opacity: ${link.brandHoverOpacity};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ftds--family-brand:focus-visible {
|
|
91
|
+
color: ${link.brandFocusColor};
|
|
92
|
+
outline-color: ${link.brandFocusFocusRingColor};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ftds--family-brand:active {
|
|
96
|
+
color: ${link.infoActiveColor};
|
|
97
|
+
}
|
|
98
|
+
`;
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fluid-topics/ft-link",
|
|
3
|
+
"version": "1.1.111",
|
|
4
|
+
"description": "Generic link component",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Lit"
|
|
7
|
+
],
|
|
8
|
+
"author": "Fluid Topics <devtopics@antidot.net>",
|
|
9
|
+
"license": "ISC",
|
|
10
|
+
"main": "build/index.js",
|
|
11
|
+
"web": "build/ft-link.min.js",
|
|
12
|
+
"typings": "build/index",
|
|
13
|
+
"files": [
|
|
14
|
+
"build/**/*.ts",
|
|
15
|
+
"build/**/*.js"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@fluid-topics/ft-icon": "1.1.111",
|
|
23
|
+
"@fluid-topics/ft-typography": "1.1.111",
|
|
24
|
+
"@fluid-topics/ft-wc-utils": "1.1.111",
|
|
25
|
+
"lit": "3.1.0"
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "23129f0e44db11e1d2c0431cedc4dde05c3241ee"
|
|
28
|
+
}
|