@uh-design-system/component-library 0.2.4 → 0.4.0
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} +419 -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/00-foundations/typography/stories/typography.stories.js +110 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +101 -82
- 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 +168 -104
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +23 -2
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +6 -0
- package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +13 -7
- 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 +8 -5
- 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 +224 -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 +208 -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 +72 -48
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +44 -4
- 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/typography/typographyUtils.js +21 -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 +6 -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 +11 -13
- 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} +419 -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/00-foundations/typography/stories/typography.stories.d.ts +9 -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-button/ds-button.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +3 -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 +66 -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/typography/typographyUtils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -4
- 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
|
@@ -0,0 +1,224 @@
|
|
|
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-breakpoint-xSmall: 20rem;
|
|
20
|
+
--ds-breakpoint-small: 30rem;
|
|
21
|
+
--ds-breakpoint-medium: 60rem;
|
|
22
|
+
--ds-breakpoint-large: 75rem;
|
|
23
|
+
--ds-breakpoint-xLarge: 90rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:root {
|
|
27
|
+
--ds-fontFamily-heading: "Open Sans", sans-serif;
|
|
28
|
+
--ds-fontFamily-body: "Open Sans", sans-serif;
|
|
29
|
+
--ds-fontSize-12: 12px; /* 0.75rem */
|
|
30
|
+
--ds-fontSize-14: 14px; /* 0.875rem */
|
|
31
|
+
--ds-fontSize-16: 16px; /* 1rem */
|
|
32
|
+
--ds-fontSize-18: 18px; /* 1.125rem */
|
|
33
|
+
--ds-fontSize-20: 20px; /* 1.25rem */
|
|
34
|
+
--ds-fontSize-22: 22px; /* 1.375rem */
|
|
35
|
+
--ds-fontSize-24: 24px; /* 1.5rem */
|
|
36
|
+
--ds-fontSize-26: 26px; /* 1.625rem */
|
|
37
|
+
--ds-fontSize-30: 30px; /* 1.875rem */
|
|
38
|
+
--ds-fontSize-32: 32px; /* 2rem */
|
|
39
|
+
--ds-fontSize-36: 36px; /* 2.25rem */
|
|
40
|
+
--ds-fontSize-40: 40px; /* 2.5rem */
|
|
41
|
+
--ds-fontSize-48: 48px; /* 3rem */
|
|
42
|
+
--ds-fontSize-56: 56px; /* 3.5rem */
|
|
43
|
+
--ds-fontSize-64: 64px; /* 4rem */
|
|
44
|
+
--ds-fontWeight-regular: 400;
|
|
45
|
+
--ds-fontWeight-semibold: 600;
|
|
46
|
+
--ds-fontWeight-semiboldPlus: 650;
|
|
47
|
+
--ds-fontWeight-bold: 700;
|
|
48
|
+
--ds-letterSpacing-xTight: -2;
|
|
49
|
+
--ds-letterSpacing-tight: -1.4;
|
|
50
|
+
--ds-letterSpacing-normal: -0.4;
|
|
51
|
+
--ds-letterSpacing-wide: 0;
|
|
52
|
+
--ds-letterSpacing-xWide: 0.4;
|
|
53
|
+
--ds-lineHeight-small: 1;
|
|
54
|
+
--ds-lineHeight-medium: 1.2;
|
|
55
|
+
--ds-lineHeight-large: 1.5;
|
|
56
|
+
--ds-lineHeight-xLarge: 1.75;
|
|
57
|
+
--ds-fontWidth-normal: 100;
|
|
58
|
+
--ds-fontWidth-condense: 90;
|
|
59
|
+
--ds-number-style: proportional-figures; /* Varying spacing */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@supports (font-variation-settings: normal) {
|
|
63
|
+
:root {
|
|
64
|
+
--ds-fontFamily-heading: "Open Sans Variable", sans-serif;
|
|
65
|
+
--ds-fontFamily-body: "Open Sans Variable", sans-serif;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
:root {
|
|
69
|
+
--ds-breakpoint-xSmall: 20rem;
|
|
70
|
+
--ds-breakpoint-small: 30rem;
|
|
71
|
+
--ds-breakpoint-medium: 60rem;
|
|
72
|
+
--ds-breakpoint-large: 75rem;
|
|
73
|
+
--ds-breakpoint-xLarge: 90rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Body text styles */
|
|
77
|
+
.ds-bodyText--2xLarge {
|
|
78
|
+
color: var(--ds-textColor-default);
|
|
79
|
+
font-family: var(--ds-fontFamily-body);
|
|
80
|
+
font-size: var(--ds-fontSize-20);
|
|
81
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
82
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
83
|
+
line-height: var(--ds-lineHeight-large);
|
|
84
|
+
}
|
|
85
|
+
@media (min-width: 30rem) {
|
|
86
|
+
.ds-bodyText--2xLarge {
|
|
87
|
+
font-size: var(--ds-fontSize-22);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ds-bodyText--xLarge {
|
|
92
|
+
color: var(--ds-textColor-default);
|
|
93
|
+
font-family: var(--ds-fontFamily-body);
|
|
94
|
+
font-size: var(--ds-fontSize-18);
|
|
95
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
96
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
97
|
+
line-height: var(--ds-lineHeight-large);
|
|
98
|
+
}
|
|
99
|
+
@media (min-width: 30rem) {
|
|
100
|
+
.ds-bodyText--xLarge {
|
|
101
|
+
font-size: var(--ds-fontSize-20);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ds-bodyText--large {
|
|
106
|
+
color: var(--ds-textColor-default);
|
|
107
|
+
font-family: var(--ds-fontFamily-body);
|
|
108
|
+
font-size: var(--ds-fontSize-16);
|
|
109
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
110
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
111
|
+
line-height: var(--ds-lineHeight-large);
|
|
112
|
+
}
|
|
113
|
+
@media (min-width: 30rem) {
|
|
114
|
+
.ds-bodyText--large {
|
|
115
|
+
font-size: var(--ds-fontSize-18);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.ds-bodyText--medium {
|
|
120
|
+
color: var(--ds-textColor-default);
|
|
121
|
+
font-family: var(--ds-fontFamily-body);
|
|
122
|
+
font-size: var(--ds-fontSize-14);
|
|
123
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
124
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
125
|
+
line-height: var(--ds-lineHeight-large);
|
|
126
|
+
}
|
|
127
|
+
@media (min-width: 30rem) {
|
|
128
|
+
.ds-bodyText--medium {
|
|
129
|
+
font-size: var(--ds-fontSize-16);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ds-bodyText--small {
|
|
134
|
+
color: var(--ds-textColor-default);
|
|
135
|
+
font-family: var(--ds-fontFamily-body);
|
|
136
|
+
font-size: var(--ds-fontSize-12);
|
|
137
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
138
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
139
|
+
line-height: var(--ds-lineHeight-large);
|
|
140
|
+
}
|
|
141
|
+
@media (min-width: 30rem) {
|
|
142
|
+
.ds-bodyText--small {
|
|
143
|
+
font-size: var(--ds-fontSize-14);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host {
|
|
148
|
+
display: inline-block;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.ds-link {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
color: var(--ds-textColor-link);
|
|
155
|
+
font-weight: var(--ds-fontWeight-regular);
|
|
156
|
+
letter-spacing: var(--ds-letterSpacing-wide);
|
|
157
|
+
text-decoration-line: underline;
|
|
158
|
+
text-decoration-style: solid;
|
|
159
|
+
text-decoration-skip-ink: auto;
|
|
160
|
+
text-decoration-thickness: 7%;
|
|
161
|
+
text-underline-offset: 12%;
|
|
162
|
+
text-underline-position: from-font;
|
|
163
|
+
}
|
|
164
|
+
.ds-link:focus-visible, .ds-link:focus-within {
|
|
165
|
+
box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
|
|
166
|
+
outline-color: var(--ds-borderColor-black);
|
|
167
|
+
outline-offset: var(--ds-borderWidth-thin);
|
|
168
|
+
outline-style: solid;
|
|
169
|
+
outline-width: var(--ds-borderWidth-thin);
|
|
170
|
+
}
|
|
171
|
+
.ds-link--semibold {
|
|
172
|
+
font-weight: var(--ds-fontWeight-semibold);
|
|
173
|
+
}
|
|
174
|
+
.ds-link--bold {
|
|
175
|
+
font-weight: var(--ds-fontWeight-bold);
|
|
176
|
+
}
|
|
177
|
+
.ds-link__icon {
|
|
178
|
+
height: 1em;
|
|
179
|
+
width: 1em;
|
|
180
|
+
}
|
|
181
|
+
.ds-link__icon--start-inline {
|
|
182
|
+
margin-right: var(--ds-spacing-3xSmall);
|
|
183
|
+
}
|
|
184
|
+
.ds-link__icon--start-standalone {
|
|
185
|
+
margin-right: var(--ds-spacing-2xSmall);
|
|
186
|
+
}
|
|
187
|
+
.ds-link__icon--end-inline {
|
|
188
|
+
margin-left: var(--ds-spacing-3xSmall);
|
|
189
|
+
}
|
|
190
|
+
.ds-link__icon--end-standalone {
|
|
191
|
+
margin-left: var(--ds-spacing-2xSmall);
|
|
192
|
+
}
|
|
193
|
+
.ds-link:hover, .ds-link:active {
|
|
194
|
+
text-decoration-thickness: 13%;
|
|
195
|
+
text-underline-offset: 12%;
|
|
196
|
+
}
|
|
197
|
+
.ds-link:hover {
|
|
198
|
+
color: var(--ds-textColor-link-hover);
|
|
199
|
+
}
|
|
200
|
+
.ds-link:active {
|
|
201
|
+
color: var(--ds-textColor-link-active);
|
|
202
|
+
}
|
|
203
|
+
.ds-link:visited {
|
|
204
|
+
color: var(--ds-textColor-link-visited);
|
|
205
|
+
}
|
|
206
|
+
.ds-link--standalone {
|
|
207
|
+
color: var(--ds-textColor-link);
|
|
208
|
+
text-decoration-line: none;
|
|
209
|
+
}
|
|
210
|
+
.ds-link--standalone:hover, .ds-link--standalone:active {
|
|
211
|
+
text-decoration-line: underline;
|
|
212
|
+
}
|
|
213
|
+
.ds-link--standalone:hover {
|
|
214
|
+
color: var(--ds-textColor-link-hover);
|
|
215
|
+
}
|
|
216
|
+
.ds-link--standalone:active {
|
|
217
|
+
color: var(--ds-textColor-link-active);
|
|
218
|
+
}
|
|
219
|
+
.ds-link--standalone:focus-visible {
|
|
220
|
+
color: var(--ds-textColor-link);
|
|
221
|
+
}
|
|
222
|
+
.ds-link--standalone:visited {
|
|
223
|
+
color: var(--ds-textColor-link);
|
|
224
|
+
}
|
|
@@ -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
|
+
language;
|
|
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: 'd8922731378178b2c927796fdc636fc26d4cbaea', href: this.href, class: classes, rel: this.rel, target: this.target, download: this.download, ...this.inheritedAttributes }, h("slot", { key: 'dfbd079b80132f7751501da7e47bb0f1aec4590a', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '2b3d864df8c04b340b0251c9ac185be918f7bb16', name: this.icon, class: iconClasses, size: "1em" })), this.text, h("slot", { key: '2fc2e4a3be8b83d545b27ae19096ffc5fbb72c0e', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: '9592ce7c0222bd3c739943fb9b6a37b92e67618c', name: this.icon, class: iconClasses, size: "1em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '43c55dded281f4e3a084ceb64edf695707309494', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? 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
|
+
"language": {
|
|
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
|
+
};
|
package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { expect } from "@storybook/test";
|
|
2
|
+
import { getShadowRoot } from "../../../../utils/tests/testUtils";
|
|
3
|
+
import { html } from "lit";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Base Components/Link/Features',
|
|
6
|
+
component: 'ds-link',
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const Inline = {
|
|
10
|
+
args: {
|
|
11
|
+
text: 'Link text',
|
|
12
|
+
href: '#',
|
|
13
|
+
variant: 'inline'
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const Standalone = {
|
|
17
|
+
args: {
|
|
18
|
+
text: 'Link text',
|
|
19
|
+
href: '#',
|
|
20
|
+
variant: 'standalone'
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const Size = {
|
|
24
|
+
render: () => html `
|
|
25
|
+
<div>
|
|
26
|
+
<div><ds-link href="#" text="Link text" size="2xLarge"></ds-link></div>
|
|
27
|
+
<div><ds-link href="#" text="Link text" size="xLarge"></ds-link></div>
|
|
28
|
+
<div><ds-link href="#" text="Link text" size="large"></ds-link></div>
|
|
29
|
+
<div><ds-link href="#" text="Link text" size="medium"></ds-link></div>
|
|
30
|
+
<div><ds-link href="#" text="Link text" size="small"></ds-link></div>
|
|
31
|
+
<div><ds-link href="#" text="Link text" size="xSmall"></ds-link></div>
|
|
32
|
+
</div>
|
|
33
|
+
`
|
|
34
|
+
};
|
|
35
|
+
export const Weight = {
|
|
36
|
+
render: () => html `
|
|
37
|
+
<div>
|
|
38
|
+
<div><ds-link href="#" text="Link text" weight="regular"></ds-link></div>
|
|
39
|
+
<div><ds-link href="#" text="Link text" weight="semibold"></ds-link></div>
|
|
40
|
+
<div><ds-link href="#" text="Link text" weight="bold"></ds-link></div>
|
|
41
|
+
</div>
|
|
42
|
+
`
|
|
43
|
+
};
|
|
44
|
+
export const OpensInANewTab = {
|
|
45
|
+
args: {
|
|
46
|
+
text: 'Link text',
|
|
47
|
+
href: '#',
|
|
48
|
+
target: '_blank',
|
|
49
|
+
},
|
|
50
|
+
play: async ({ canvasElement, step }) => {
|
|
51
|
+
const shadowRoot = await getShadowRoot(canvasElement, 'ds-link');
|
|
52
|
+
const anchorElem = shadowRoot.querySelector('a');
|
|
53
|
+
const visuallyHiddenElem = shadowRoot.querySelector('ds-visually-hidden');
|
|
54
|
+
const iconEnd = shadowRoot.querySelector('slot[name=iconEnd]');
|
|
55
|
+
await step('Anchor should have attribute rel with value "noopener noreferrer"', () => {
|
|
56
|
+
expect(anchorElem.rel).toBe('noopener noreferrer');
|
|
57
|
+
});
|
|
58
|
+
await step('Anchor should have a visually hidden assistive text', () => {
|
|
59
|
+
expect(visuallyHiddenElem.textContent).toBe('Opens in a new tab');
|
|
60
|
+
});
|
|
61
|
+
await step('Has an end icon', async () => {
|
|
62
|
+
expect(iconEnd).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const IconPosition = {
|
|
67
|
+
render: () => html `
|
|
68
|
+
<div>
|
|
69
|
+
<div><ds-link href="#" text="Link text" icon="download" icon-position="start"></ds-link></div>
|
|
70
|
+
<div><ds-link href="#" text="Link text" icon="download" icon-position="end"></ds-link></div>
|
|
71
|
+
</div>
|
|
72
|
+
`
|
|
73
|
+
};
|