@uh-design-system/component-library 0.2.4 → 0.3.1
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/dist/cjs/attributes-f7831329.js +78 -0
- package/dist/cjs/component-library.cjs.js +3 -3
- package/dist/cjs/{ds-accordion_2.cjs.entry.js → ds-accordion_3.cjs.entry.js} +418 -241
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +47 -0
- package/dist/cjs/ds-link.cjs.entry.js +54 -0
- package/dist/cjs/ds-text-input.cjs.entry.js +12 -16
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +20 -0
- package/dist/cjs/{index-fd4f6cd2.js → index-bfa0f441.js} +17 -11
- package/dist/cjs/linkUtils-695da37c.js +16 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/utils-8b73aa91.js +10 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/00-foundations/icons/categories/arrows.js +6 -0
- package/dist/collection/components/00-foundations/icons/categories/information.js +12 -0
- package/dist/collection/components/00-foundations/icons/categories/media.js +4 -0
- package/dist/collection/components/00-foundations/icons/categories/social.js +17 -0
- package/dist/collection/components/00-foundations/icons/iconList.js +2 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +92 -81
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +41 -9
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +15 -0
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +1 -1
- package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +10 -1
- package/dist/collection/components/01-base-components/ds-button/ds-button.css +55 -55
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +2 -2
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +4 -8
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +5 -1
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +9 -6
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +2 -2
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +158 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +281 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +53 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +73 -0
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +72 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +142 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +161 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.js +33 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.js +19 -0
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.js +40 -0
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +45 -40
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +43 -3
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.examples.stories.js → stories/ds-text-input.examples.stories.js} +13 -0
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.features.stories.js → stories/ds-text-input.features.stories.js} +18 -4
- package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.stories.js → stories/ds-text-input.stories.js} +2 -2
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/introduction/introduction.stories.js +9 -0
- package/dist/collection/utils/link/linkUtils.js +11 -0
- package/dist/collection/utils/utils.js +5 -0
- package/dist/component-library/attributes-9419ac39.js +1 -0
- package/dist/component-library/component-library.css +1 -1
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -0
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -0
- package/dist/component-library/ds-link.entry.js +1 -0
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -0
- package/dist/component-library/{index-4200d514.js → index-42701395.js} +2 -2
- package/dist/component-library/linkUtils-3d1b28cf.js +1 -0
- package/dist/component-library/utils-cca2a41a.js +1 -0
- package/dist/components/attributes.js +154 -0
- package/dist/components/ds-accordion.js +31 -12
- package/dist/components/ds-button2.js +4 -78
- package/dist/components/ds-icon2.js +320 -231
- package/dist/components/ds-link-with-arrow.d.ts +11 -0
- package/dist/components/ds-link-with-arrow.js +78 -0
- package/dist/components/ds-link.d.ts +11 -0
- package/dist/components/ds-link.js +90 -0
- package/dist/components/ds-text-input.js +10 -12
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index2.js +7 -10
- package/dist/components/linkUtils.js +13 -0
- package/dist/components/utils.js +8 -0
- package/dist/esm/attributes-9419ac39.js +75 -0
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/{ds-accordion_2.entry.js → ds-accordion_3.entry.js} +418 -242
- package/dist/esm/ds-link-with-arrow.entry.js +43 -0
- package/dist/esm/ds-link.entry.js +50 -0
- package/dist/esm/ds-text-input.entry.js +8 -12
- package/dist/esm/ds-visually-hidden.entry.js +16 -0
- package/dist/esm/{index-4200d514.js → index-42701395.js} +17 -11
- package/dist/esm/linkUtils-3d1b28cf.js +13 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/utils-cca2a41a.js +8 -0
- package/dist/types/components/00-foundations/icons/categories/social.d.ts +5 -0
- package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +25 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.examples.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +11 -0
- package/dist/types/components/01-base-components/ds-link/stories/ds-link.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +18 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.d.ts +7 -0
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -0
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.examples.stories.d.ts → stories/ds-text-input.examples.stories.d.ts} +2 -1
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.features.stories.d.ts → stories/ds-text-input.features.stories.d.ts} +4 -1
- package/dist/types/components/01-base-components/ds-text-input/{ds-text-input.stories.d.ts → stories/ds-text-input.stories.d.ts} +1 -1
- package/dist/types/components.d.ts +64 -2
- package/dist/types/introduction/introduction.stories.d.ts +10 -0
- package/dist/types/utils/link/linkUtils.d.ts +2 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/ds-button_2.cjs.entry.js +0 -170
- package/dist/component-library/ds-accordion_2.entry.js +0 -1
- package/dist/component-library/ds-button_2.entry.js +0 -1
- package/dist/components/index3.js +0 -80
- package/dist/esm/ds-button_2.entry.js +0 -165
|
@@ -57,14 +57,14 @@ export class DsButton {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
render() {
|
|
60
|
-
const classes = classNames(
|
|
60
|
+
const classes = classNames(`ds-button ${this.variant} ${this.colour} ${this.size}`, {
|
|
61
61
|
'icon-start': this.icon && this.iconPosition === 'start' && this.value,
|
|
62
62
|
'icon-end': this.icon && this.iconPosition === 'end' && this.value,
|
|
63
63
|
'icon-only': this.icon && !this.value,
|
|
64
64
|
});
|
|
65
65
|
const iconSize = this.size === 'small' ? '1rem' : undefined;
|
|
66
66
|
const isDisabled = this.disabled || this.ariaDisabled === 'true';
|
|
67
|
-
return (h("button", { key: '
|
|
67
|
+
return (h("button", { key: '46e6657656748f136011c38efecbd65ccfd68f71', ref: el => (this.buttonEl = el), onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, class: classes, style: { fontWeight: this.fontWeight }, type: this.type, "aria-disabled": isDisabled ? 'true' : 'false', ...this.inheritedAttributes }, h("slot", { key: '564dbf073e00ffb607ad590ec733feec0d48561a', name: "prefix" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '9a52ef760ad5e040d5c6a80522271c13c67b76ab', name: this.icon, size: iconSize })), this.value && h("span", { key: '68d704a53e9afe7d27c022f58be47df3d0fe4de6', class: "button-value" }, this.value), h("slot", { key: 'd529e83212c31f7502afc748e9666b30a276c99c', name: "suffix" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: '08969d9219026744a7eec5a3d5928b4b4ceb6298', name: this.icon, size: iconSize }))));
|
|
68
68
|
}
|
|
69
69
|
static get is() { return "ds-button"; }
|
|
70
70
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
1
|
const meta = {
|
|
3
2
|
title: 'Base Components/Button/Features',
|
|
4
3
|
component: 'ds-button',
|
|
@@ -56,13 +55,10 @@ Small.args = {
|
|
|
56
55
|
value: 'Small',
|
|
57
56
|
size: 'small',
|
|
58
57
|
};
|
|
59
|
-
export const Disabled = {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<ds-button aria-disabled="true" value="aria-disabled"></ds-button>
|
|
64
|
-
</div>
|
|
65
|
-
`,
|
|
58
|
+
export const Disabled = {};
|
|
59
|
+
Disabled.args = {
|
|
60
|
+
value: 'Disabled',
|
|
61
|
+
disabled: true,
|
|
66
62
|
};
|
|
67
63
|
export const IconStart = {};
|
|
68
64
|
IconStart.args = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Fragment, h } from "@stencil/core";
|
|
2
2
|
import { icons } from "../../../components/00-foundations/icons/iconList";
|
|
3
|
+
import { remToPx } from "../../../utils/utils";
|
|
3
4
|
export class DsIcon {
|
|
4
5
|
name;
|
|
5
6
|
colour;
|
|
6
7
|
size = '1.5rem';
|
|
7
|
-
|
|
8
|
+
dsTitle = 'Icon';
|
|
8
9
|
role = 'img';
|
|
9
10
|
hidden = true;
|
|
10
11
|
message = '';
|
|
@@ -33,7 +34,9 @@ export class DsIcon {
|
|
|
33
34
|
const size = this.size || '1.5rem';
|
|
34
35
|
const colour = this.getIconColour() || 'currentColor';
|
|
35
36
|
const role = this.role || 'img';
|
|
36
|
-
const title = this.
|
|
37
|
+
const title = this.dsTitle || '';
|
|
38
|
+
svgElement.setAttribute('width', remToPx(size));
|
|
39
|
+
svgElement.setAttribute('height', remToPx(size));
|
|
37
40
|
svgElement.setAttribute('style', `fill: ${colour}; width: ${size}; height: ${size};`);
|
|
38
41
|
svgElement.setAttribute('role', role);
|
|
39
42
|
const titleText = title || 'Icon';
|
|
@@ -45,13 +48,13 @@ export class DsIcon {
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
render() {
|
|
48
|
-
return (h(Fragment, { key: '
|
|
51
|
+
return (h(Fragment, { key: '237ef9992d67c967fe88d108c8bc2e38ce5c32bf' }, h("span", { key: '995f53c4fe20d616270f2d70e927065f794c5860', class: 'ds-icon--container', innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
|
|
49
52
|
}
|
|
50
53
|
static get is() { return "ds-icon"; }
|
|
51
54
|
static get encapsulation() { return "shadow"; }
|
|
52
55
|
static get originalStyleUrls() {
|
|
53
56
|
return {
|
|
54
|
-
"$": ["ds-icon.
|
|
57
|
+
"$": ["ds-icon.scss"]
|
|
55
58
|
};
|
|
56
59
|
}
|
|
57
60
|
static get styleUrls() {
|
|
@@ -119,7 +122,7 @@ export class DsIcon {
|
|
|
119
122
|
"reflect": false,
|
|
120
123
|
"defaultValue": "'1.5rem'"
|
|
121
124
|
},
|
|
122
|
-
"
|
|
125
|
+
"dsTitle": {
|
|
123
126
|
"type": "string",
|
|
124
127
|
"mutable": false,
|
|
125
128
|
"complexType": {
|
|
@@ -135,7 +138,7 @@ export class DsIcon {
|
|
|
135
138
|
},
|
|
136
139
|
"getter": false,
|
|
137
140
|
"setter": false,
|
|
138
|
-
"attribute": "title",
|
|
141
|
+
"attribute": "ds-title",
|
|
139
142
|
"reflect": false,
|
|
140
143
|
"defaultValue": "'Icon'"
|
|
141
144
|
},
|
|
@@ -25,7 +25,7 @@ const meta = {
|
|
|
25
25
|
},
|
|
26
26
|
name: 'Size',
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
dsTitle: {
|
|
29
29
|
control: {
|
|
30
30
|
type: 'text',
|
|
31
31
|
},
|
|
@@ -50,6 +50,6 @@ export const Default = {};
|
|
|
50
50
|
Default.args = {
|
|
51
51
|
name: 'archive',
|
|
52
52
|
role: 'img',
|
|
53
|
-
|
|
53
|
+
dsTitle: 'Icon',
|
|
54
54
|
hidden: true,
|
|
55
55
|
};
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--ds-breakpoint-xSmall: 20rem;
|
|
3
|
+
--ds-breakpoint-small: 30rem;
|
|
4
|
+
--ds-breakpoint-medium: 60rem;
|
|
5
|
+
--ds-breakpoint-large: 75rem;
|
|
6
|
+
--ds-breakpoint-xLarge: 90rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:root {
|
|
10
|
+
--ds-borderWidth-none: 0px;
|
|
11
|
+
--ds-borderWidth-hairline: 1px;
|
|
12
|
+
--ds-borderWidth-thin: 2px;
|
|
13
|
+
--ds-borderWidth-thick: 4px;
|
|
14
|
+
--ds-borderWidth-xThick: 8px;
|
|
15
|
+
--ds-borderRadius-none: 0px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:root {
|
|
19
|
+
--ds-fontFamily-heading: "Open Sans", sans-serif;
|
|
20
|
+
--ds-fontFamily-body: "Open Sans", sans-serif;
|
|
21
|
+
--ds-fontSize-12: 12px; /* 0.75rem */
|
|
22
|
+
--ds-fontSize-14: 14px; /* 0.875rem */
|
|
23
|
+
--ds-fontSize-16: 16px; /* 1rem */
|
|
24
|
+
--ds-fontSize-18: 18px; /* 1.125rem */
|
|
25
|
+
--ds-fontSize-20: 20px; /* 1.25rem */
|
|
26
|
+
--ds-fontSize-22: 22px; /* 1.375rem */
|
|
27
|
+
--ds-fontSize-24: 24px; /* 1.5rem */
|
|
28
|
+
--ds-fontSize-26: 26px; /* 1.625rem */
|
|
29
|
+
--ds-fontSize-30: 30px; /* 1.875rem */
|
|
30
|
+
--ds-fontSize-32: 32px; /* 2rem */
|
|
31
|
+
--ds-fontSize-36: 36px; /* 2.25rem */
|
|
32
|
+
--ds-fontSize-40: 40px; /* 2.5rem */
|
|
33
|
+
--ds-fontSize-48: 48px; /* 3rem */
|
|
34
|
+
--ds-fontSize-56: 56px; /* 3.5rem */
|
|
35
|
+
--ds-fontSize-64: 64px; /* 4rem */
|
|
36
|
+
--ds-fontWeight-regular: 400;
|
|
37
|
+
--ds-fontWeight-semibold: 600;
|
|
38
|
+
--ds-fontWeight-semiboldPlus: 650;
|
|
39
|
+
--ds-fontWeight-bold: 700;
|
|
40
|
+
--ds-letterSpacing-xTight: -2;
|
|
41
|
+
--ds-letterSpacing-tight: -1.4;
|
|
42
|
+
--ds-letterSpacing-normal: -0.4;
|
|
43
|
+
--ds-letterSpacing-wide: 0;
|
|
44
|
+
--ds-letterSpacing-xWide: 0.4;
|
|
45
|
+
--ds-lineHeight-small: 1;
|
|
46
|
+
--ds-lineHeight-medium: 1.2;
|
|
47
|
+
--ds-lineHeight-large: 1.5;
|
|
48
|
+
--ds-lineHeight-xLarge: 1.75;
|
|
49
|
+
--ds-fontWidth-normal: 100;
|
|
50
|
+
--ds-fontWidth-condense: 90;
|
|
51
|
+
--ds-number-style: proportional-figures; /* Varying spacing */
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@supports (font-variation-settings: normal) {
|
|
55
|
+
:root {
|
|
56
|
+
--ds-fontFamily-heading: "Open Sans Variable", sans-serif;
|
|
57
|
+
--ds-fontFamily-body: "Open Sans Variable", sans-serif;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
.bodyText {
|
|
61
|
+
line-height: 1.5;
|
|
62
|
+
}
|
|
63
|
+
.bodyText--2xLarge {
|
|
64
|
+
font-size: 1.375rem;
|
|
65
|
+
}
|
|
66
|
+
.bodyText--xLarge {
|
|
67
|
+
font-size: 1.25rem;
|
|
68
|
+
}
|
|
69
|
+
.bodyText--large {
|
|
70
|
+
font-size: 1.125rem;
|
|
71
|
+
}
|
|
72
|
+
.bodyText--medium {
|
|
73
|
+
font-size: 1rem;
|
|
74
|
+
}
|
|
75
|
+
.bodyText--small {
|
|
76
|
+
font-size: 0.875rem;
|
|
77
|
+
}
|
|
78
|
+
.bodyText--xSmall {
|
|
79
|
+
font-size: 0.75rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ds-link {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
color: var(--ds-textColor-link);
|
|
90
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
91
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
92
|
+
text-decoration-line: underline;
|
|
93
|
+
text-decoration-style: solid;
|
|
94
|
+
text-decoration-skip-ink: auto;
|
|
95
|
+
text-decoration-thickness: 7%;
|
|
96
|
+
text-underline-offset: 12%;
|
|
97
|
+
text-underline-position: from-font;
|
|
98
|
+
}
|
|
99
|
+
.ds-link--semibold {
|
|
100
|
+
font-weight: var(--ds-fontWeight-semibold);
|
|
101
|
+
}
|
|
102
|
+
.ds-link--bold {
|
|
103
|
+
font-weight: var(--ds-fontWeight-bold);
|
|
104
|
+
}
|
|
105
|
+
.ds-link__icon {
|
|
106
|
+
height: 1em;
|
|
107
|
+
width: 1em;
|
|
108
|
+
}
|
|
109
|
+
.ds-link__icon--start-inline {
|
|
110
|
+
margin-right: var(--ds-spacing-3xSmall);
|
|
111
|
+
}
|
|
112
|
+
.ds-link__icon--start-standalone {
|
|
113
|
+
margin-right: var(--ds-spacing-2xSmall);
|
|
114
|
+
}
|
|
115
|
+
.ds-link__icon--end-inline {
|
|
116
|
+
margin-left: var(--ds-spacing-3xSmall);
|
|
117
|
+
}
|
|
118
|
+
.ds-link__icon--end-standalone {
|
|
119
|
+
margin-left: var(--ds-spacing-2xSmall);
|
|
120
|
+
}
|
|
121
|
+
.ds-link:hover, .ds-link:active {
|
|
122
|
+
text-decoration-thickness: 13%;
|
|
123
|
+
text-underline-offset: 12%;
|
|
124
|
+
}
|
|
125
|
+
.ds-link:hover {
|
|
126
|
+
color: var(--ds-textColor-link-hover);
|
|
127
|
+
}
|
|
128
|
+
.ds-link:active {
|
|
129
|
+
color: var(--ds-textColor-link-active);
|
|
130
|
+
}
|
|
131
|
+
.ds-link:focus-visible {
|
|
132
|
+
outline-style: solid;
|
|
133
|
+
outline-width: var(--ds-borderWidth-thin);
|
|
134
|
+
outline-offset: var(--ds-borderWidth-thin);
|
|
135
|
+
outline-color: var(--ds-palette-black);
|
|
136
|
+
}
|
|
137
|
+
.ds-link:visited {
|
|
138
|
+
color: var(--ds-textColor-link-visited);
|
|
139
|
+
}
|
|
140
|
+
.ds-link--standalone {
|
|
141
|
+
color: var(--ds-textColor-link--standalone);
|
|
142
|
+
text-decoration-line: none;
|
|
143
|
+
}
|
|
144
|
+
.ds-link--standalone:hover, .ds-link--standalone:active {
|
|
145
|
+
text-decoration-line: underline;
|
|
146
|
+
}
|
|
147
|
+
.ds-link--standalone:hover {
|
|
148
|
+
color: var(--ds-textColor-link--standalone-hover);
|
|
149
|
+
}
|
|
150
|
+
.ds-link--standalone:active {
|
|
151
|
+
color: var(--ds-textColor-link--standalone-active);
|
|
152
|
+
}
|
|
153
|
+
.ds-link--standalone:focus-visible {
|
|
154
|
+
color: var(--ds-textColor-link--standalone-focus);
|
|
155
|
+
}
|
|
156
|
+
.ds-link--standalone:visited {
|
|
157
|
+
color: var(--ds-textColor-link--standalone);
|
|
158
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { inheritAriaAttributes } from "../../../utils/attributes";
|
|
4
|
+
import { idGenerator } from "../ds-text-input/utils";
|
|
5
|
+
import { opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
|
|
6
|
+
const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
|
|
7
|
+
export class DsLink {
|
|
8
|
+
inheritedAttributes = {};
|
|
9
|
+
rel;
|
|
10
|
+
visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
|
|
11
|
+
el;
|
|
12
|
+
text;
|
|
13
|
+
size;
|
|
14
|
+
variant = 'inline';
|
|
15
|
+
weight = 'regular';
|
|
16
|
+
icon = '';
|
|
17
|
+
iconPosition = 'end';
|
|
18
|
+
href;
|
|
19
|
+
target;
|
|
20
|
+
download;
|
|
21
|
+
lang;
|
|
22
|
+
componentWillLoad() {
|
|
23
|
+
this.inheritedAttributes = inheritAriaAttributes(this.el);
|
|
24
|
+
if (opensInNewTab(this.target)) {
|
|
25
|
+
this.icon = 'open_in_new';
|
|
26
|
+
this.iconPosition = 'end';
|
|
27
|
+
this.rel = 'noopener noreferrer';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const classes = classNames('ds-link', `ds-link--${this.weight}`, `ds-link--${this.variant}`, {
|
|
32
|
+
[`bodyText--${this.size}`]: Boolean(this.size),
|
|
33
|
+
});
|
|
34
|
+
const iconClasses = classNames('ds-link__icon', {
|
|
35
|
+
[`ds-link__icon--start-${this.variant}`]: this.iconPosition === 'start',
|
|
36
|
+
[`ds-link__icon--end-${this.variant}`]: this.iconPosition === 'end',
|
|
37
|
+
});
|
|
38
|
+
return (h("a", { key: '58a12ff2e845e9acf84c3917b5826b014ffb0919', href: this.href, class: classes, rel: this.rel, target: this.target, download: this.download, ...this.inheritedAttributes }, h("slot", { key: '88f6f827f0d37bb358a596c61a27778d3e7e9032', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '82ae7997d3e03e89260f3aabd9fe953d4f252f79', name: this.icon, class: iconClasses, size: "1em" })), this.text, h("slot", { key: 'ad1dc790a43c467d40a40882a55b5f7ad26d52fa', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'fbecfd82f1cf0994bde85d554a07e6210370f457', name: this.icon, class: iconClasses, size: "1em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'f3de3a15b89e77f2838173a541a83c938f19b10d', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.lang ?? document.documentElement.lang)))));
|
|
39
|
+
}
|
|
40
|
+
static get is() { return "ds-link"; }
|
|
41
|
+
static get encapsulation() { return "shadow"; }
|
|
42
|
+
static get originalStyleUrls() {
|
|
43
|
+
return {
|
|
44
|
+
"$": ["ds-link.scss"]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static get styleUrls() {
|
|
48
|
+
return {
|
|
49
|
+
"$": ["ds-link.css"]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
static get properties() {
|
|
53
|
+
return {
|
|
54
|
+
"text": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"mutable": false,
|
|
57
|
+
"complexType": {
|
|
58
|
+
"original": "string",
|
|
59
|
+
"resolved": "string",
|
|
60
|
+
"references": {}
|
|
61
|
+
},
|
|
62
|
+
"required": false,
|
|
63
|
+
"optional": true,
|
|
64
|
+
"docs": {
|
|
65
|
+
"tags": [],
|
|
66
|
+
"text": ""
|
|
67
|
+
},
|
|
68
|
+
"getter": false,
|
|
69
|
+
"setter": false,
|
|
70
|
+
"attribute": "text",
|
|
71
|
+
"reflect": false
|
|
72
|
+
},
|
|
73
|
+
"size": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "LinkSize",
|
|
78
|
+
"resolved": "\"2xLarge\" | \"large\" | \"medium\" | \"small\" | \"xLarge\" | \"xSmall\"",
|
|
79
|
+
"references": {
|
|
80
|
+
"LinkSize": {
|
|
81
|
+
"location": "global",
|
|
82
|
+
"id": "global::LinkSize"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"optional": true,
|
|
88
|
+
"docs": {
|
|
89
|
+
"tags": [],
|
|
90
|
+
"text": ""
|
|
91
|
+
},
|
|
92
|
+
"getter": false,
|
|
93
|
+
"setter": false,
|
|
94
|
+
"attribute": "size",
|
|
95
|
+
"reflect": false
|
|
96
|
+
},
|
|
97
|
+
"variant": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "LinkVariant",
|
|
102
|
+
"resolved": "\"inline\" | \"standalone\"",
|
|
103
|
+
"references": {
|
|
104
|
+
"LinkVariant": {
|
|
105
|
+
"location": "global",
|
|
106
|
+
"id": "global::LinkVariant"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": ""
|
|
115
|
+
},
|
|
116
|
+
"getter": false,
|
|
117
|
+
"setter": false,
|
|
118
|
+
"attribute": "variant",
|
|
119
|
+
"reflect": false,
|
|
120
|
+
"defaultValue": "'inline'"
|
|
121
|
+
},
|
|
122
|
+
"weight": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"mutable": false,
|
|
125
|
+
"complexType": {
|
|
126
|
+
"original": "LinkWeight",
|
|
127
|
+
"resolved": "\"bold\" | \"regular\" | \"semibold\"",
|
|
128
|
+
"references": {
|
|
129
|
+
"LinkWeight": {
|
|
130
|
+
"location": "global",
|
|
131
|
+
"id": "global::LinkWeight"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": ""
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"attribute": "weight",
|
|
144
|
+
"reflect": false,
|
|
145
|
+
"defaultValue": "'regular'"
|
|
146
|
+
},
|
|
147
|
+
"icon": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"mutable": true,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string",
|
|
152
|
+
"resolved": "string",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": ""
|
|
160
|
+
},
|
|
161
|
+
"getter": false,
|
|
162
|
+
"setter": false,
|
|
163
|
+
"attribute": "icon",
|
|
164
|
+
"reflect": false,
|
|
165
|
+
"defaultValue": "''"
|
|
166
|
+
},
|
|
167
|
+
"iconPosition": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": true,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "LinkIconPosition",
|
|
172
|
+
"resolved": "\"end\" | \"start\"",
|
|
173
|
+
"references": {
|
|
174
|
+
"LinkIconPosition": {
|
|
175
|
+
"location": "global",
|
|
176
|
+
"id": "global::LinkIconPosition"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": ""
|
|
185
|
+
},
|
|
186
|
+
"getter": false,
|
|
187
|
+
"setter": false,
|
|
188
|
+
"attribute": "icon-position",
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"defaultValue": "'end'"
|
|
191
|
+
},
|
|
192
|
+
"href": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "string",
|
|
197
|
+
"resolved": "string",
|
|
198
|
+
"references": {}
|
|
199
|
+
},
|
|
200
|
+
"required": true,
|
|
201
|
+
"optional": false,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [],
|
|
204
|
+
"text": ""
|
|
205
|
+
},
|
|
206
|
+
"getter": false,
|
|
207
|
+
"setter": false,
|
|
208
|
+
"attribute": "href",
|
|
209
|
+
"reflect": false
|
|
210
|
+
},
|
|
211
|
+
"target": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "LinkTarget",
|
|
216
|
+
"resolved": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\" | \"_unfencedTop\"",
|
|
217
|
+
"references": {
|
|
218
|
+
"LinkTarget": {
|
|
219
|
+
"location": "global",
|
|
220
|
+
"id": "global::LinkTarget"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"required": false,
|
|
225
|
+
"optional": true,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": ""
|
|
229
|
+
},
|
|
230
|
+
"getter": false,
|
|
231
|
+
"setter": false,
|
|
232
|
+
"attribute": "target",
|
|
233
|
+
"reflect": false
|
|
234
|
+
},
|
|
235
|
+
"download": {
|
|
236
|
+
"type": "boolean",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "boolean",
|
|
240
|
+
"resolved": "boolean",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": true,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": ""
|
|
248
|
+
},
|
|
249
|
+
"getter": false,
|
|
250
|
+
"setter": false,
|
|
251
|
+
"attribute": "download",
|
|
252
|
+
"reflect": false
|
|
253
|
+
},
|
|
254
|
+
"lang": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "LinkLang",
|
|
259
|
+
"resolved": "\"en\" | \"fi\" | \"sv\"",
|
|
260
|
+
"references": {
|
|
261
|
+
"LinkLang": {
|
|
262
|
+
"location": "global",
|
|
263
|
+
"id": "global::LinkLang"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": true,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": ""
|
|
272
|
+
},
|
|
273
|
+
"getter": false,
|
|
274
|
+
"setter": false,
|
|
275
|
+
"attribute": "lang",
|
|
276
|
+
"reflect": false
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
static get elementRef() { return "el"; }
|
|
281
|
+
}
|
package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Base Components/Link/Examples',
|
|
4
|
+
component: 'ds-link',
|
|
5
|
+
};
|
|
6
|
+
export default meta;
|
|
7
|
+
export const Inline = {
|
|
8
|
+
render: () => html `
|
|
9
|
+
Text with <ds-link href="#" text="inline link"></ds-link>.
|
|
10
|
+
`
|
|
11
|
+
};
|
|
12
|
+
export const OpenInANewTab = {
|
|
13
|
+
render: () => html `
|
|
14
|
+
Text with <ds-link href="#" target="_blank" text="open in a new tab inline link"></ds-link>.
|
|
15
|
+
`
|
|
16
|
+
};
|
|
17
|
+
export const Back = {
|
|
18
|
+
args: {
|
|
19
|
+
text: 'Back',
|
|
20
|
+
href: '#',
|
|
21
|
+
icon: 'arrow_back',
|
|
22
|
+
iconPosition: 'start'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const Download = {
|
|
26
|
+
args: {
|
|
27
|
+
text: 'Link to download a file',
|
|
28
|
+
href: '#',
|
|
29
|
+
icon: 'download',
|
|
30
|
+
iconPosition: 'start',
|
|
31
|
+
variant: 'standalone',
|
|
32
|
+
size: 'xLarge',
|
|
33
|
+
weight: 'semibold',
|
|
34
|
+
download: true
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export const StandaloneBoldLinkWithIcon = {
|
|
38
|
+
args: {
|
|
39
|
+
text: 'Standalone bold link with icon',
|
|
40
|
+
href: '#',
|
|
41
|
+
icon: 'arrow_forward',
|
|
42
|
+
variant: 'standalone',
|
|
43
|
+
size: '2xLarge',
|
|
44
|
+
weight: 'bold'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const NavigationLink = {
|
|
48
|
+
args: {
|
|
49
|
+
text: 'Navigation link',
|
|
50
|
+
href: '#',
|
|
51
|
+
variant: 'standalone'
|
|
52
|
+
}
|
|
53
|
+
};
|