@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.
Files changed (116) hide show
  1. package/dist/cjs/attributes-f7831329.js +78 -0
  2. package/dist/cjs/component-library.cjs.js +3 -3
  3. package/dist/cjs/{ds-accordion_2.cjs.entry.js → ds-accordion_3.cjs.entry.js} +419 -241
  4. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +47 -0
  5. package/dist/cjs/ds-link.cjs.entry.js +54 -0
  6. package/dist/cjs/ds-text-input.cjs.entry.js +12 -16
  7. package/dist/cjs/ds-visually-hidden.cjs.entry.js +20 -0
  8. package/dist/cjs/{index-fd4f6cd2.js → index-bfa0f441.js} +17 -11
  9. package/dist/cjs/linkUtils-695da37c.js +16 -0
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/utils-8b73aa91.js +10 -0
  12. package/dist/collection/collection-manifest.json +3 -1
  13. package/dist/collection/components/00-foundations/icons/categories/arrows.js +6 -0
  14. package/dist/collection/components/00-foundations/icons/categories/information.js +12 -0
  15. package/dist/collection/components/00-foundations/icons/categories/media.js +4 -0
  16. package/dist/collection/components/00-foundations/icons/categories/social.js +17 -0
  17. package/dist/collection/components/00-foundations/icons/iconList.js +2 -0
  18. package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +110 -0
  19. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +101 -82
  20. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +41 -9
  21. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +15 -0
  22. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +1 -1
  23. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +10 -1
  24. package/dist/collection/components/01-base-components/ds-button/ds-button.css +168 -104
  25. package/dist/collection/components/01-base-components/ds-button/ds-button.js +23 -2
  26. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +6 -0
  27. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +13 -7
  28. package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +5 -1
  29. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +8 -5
  30. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +2 -2
  31. package/dist/collection/components/01-base-components/ds-link/ds-link.css +224 -0
  32. package/dist/collection/components/01-base-components/ds-link/ds-link.js +281 -0
  33. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +53 -0
  34. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +73 -0
  35. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +72 -0
  36. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +208 -0
  37. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +161 -0
  38. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.js +33 -0
  39. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.js +19 -0
  40. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.js +40 -0
  41. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +72 -48
  42. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +44 -4
  43. 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
  44. 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
  45. package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.stories.js → stories/ds-text-input.stories.js} +2 -2
  46. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  47. package/dist/collection/introduction/introduction.stories.js +9 -0
  48. package/dist/collection/utils/link/linkUtils.js +11 -0
  49. package/dist/collection/utils/typography/typographyUtils.js +21 -0
  50. package/dist/collection/utils/utils.js +5 -0
  51. package/dist/component-library/attributes-9419ac39.js +1 -0
  52. package/dist/component-library/component-library.css +1 -1
  53. package/dist/component-library/component-library.esm.js +1 -1
  54. package/dist/component-library/ds-accordion_3.entry.js +1 -0
  55. package/dist/component-library/ds-link-with-arrow.entry.js +1 -0
  56. package/dist/component-library/ds-link.entry.js +1 -0
  57. package/dist/component-library/ds-text-input.entry.js +1 -1
  58. package/dist/component-library/ds-visually-hidden.entry.js +1 -0
  59. package/dist/component-library/{index-4200d514.js → index-42701395.js} +2 -2
  60. package/dist/component-library/linkUtils-3d1b28cf.js +1 -0
  61. package/dist/component-library/utils-cca2a41a.js +1 -0
  62. package/dist/components/attributes.js +154 -0
  63. package/dist/components/ds-accordion.js +31 -12
  64. package/dist/components/ds-button2.js +6 -78
  65. package/dist/components/ds-icon2.js +320 -231
  66. package/dist/components/ds-link-with-arrow.d.ts +11 -0
  67. package/dist/components/ds-link-with-arrow.js +78 -0
  68. package/dist/components/ds-link.d.ts +11 -0
  69. package/dist/components/ds-link.js +90 -0
  70. package/dist/components/ds-text-input.js +11 -13
  71. package/dist/components/ds-visually-hidden2.js +1 -1
  72. package/dist/components/index2.js +7 -10
  73. package/dist/components/linkUtils.js +13 -0
  74. package/dist/components/utils.js +8 -0
  75. package/dist/esm/attributes-9419ac39.js +75 -0
  76. package/dist/esm/component-library.js +4 -4
  77. package/dist/esm/{ds-accordion_2.entry.js → ds-accordion_3.entry.js} +419 -242
  78. package/dist/esm/ds-link-with-arrow.entry.js +43 -0
  79. package/dist/esm/ds-link.entry.js +50 -0
  80. package/dist/esm/ds-text-input.entry.js +8 -12
  81. package/dist/esm/ds-visually-hidden.entry.js +16 -0
  82. package/dist/esm/{index-4200d514.js → index-42701395.js} +17 -11
  83. package/dist/esm/linkUtils-3d1b28cf.js +13 -0
  84. package/dist/esm/loader.js +3 -3
  85. package/dist/esm/utils-cca2a41a.js +8 -0
  86. package/dist/types/components/00-foundations/icons/categories/social.d.ts +5 -0
  87. package/dist/types/components/00-foundations/typography/stories/typography.stories.d.ts +9 -0
  88. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +2 -0
  89. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +1 -0
  90. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +1 -0
  91. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +1 -0
  92. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +3 -0
  93. package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +1 -1
  94. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +25 -0
  95. package/dist/types/components/01-base-components/ds-link/stories/ds-link.examples.stories.d.ts +11 -0
  96. package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +11 -0
  97. package/dist/types/components/01-base-components/ds-link/stories/ds-link.stories.d.ts +7 -0
  98. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +18 -0
  99. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.d.ts +7 -0
  100. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.d.ts +7 -0
  101. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.d.ts +7 -0
  102. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -0
  103. 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
  104. 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
  105. 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
  106. package/dist/types/components.d.ts +66 -2
  107. package/dist/types/introduction/introduction.stories.d.ts +10 -0
  108. package/dist/types/utils/link/linkUtils.d.ts +2 -0
  109. package/dist/types/utils/typography/typographyUtils.d.ts +1 -0
  110. package/dist/types/utils/utils.d.ts +1 -0
  111. package/package.json +2 -4
  112. package/dist/cjs/ds-button_2.cjs.entry.js +0 -170
  113. package/dist/component-library/ds-accordion_2.entry.js +0 -1
  114. package/dist/component-library/ds-button_2.entry.js +0 -1
  115. package/dist/components/index3.js +0 -80
  116. package/dist/esm/ds-button_2.entry.js +0 -165
@@ -0,0 +1,72 @@
1
+ import { icons } from "../../../00-foundations/icons/iconList";
2
+ import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
3
+ const anchorAriaAttributes = [
4
+ 'aria-current',
5
+ 'aria-describedby',
6
+ 'aria-haspopup',
7
+ 'aria-label',
8
+ 'aria-labelledby'
9
+ ];
10
+ const anchorAriaAttributeArgTypes = getAriaAttributeArgTypes(anchorAriaAttributes);
11
+ const meta = {
12
+ title: 'Base Components/Link',
13
+ component: 'ds-link',
14
+ };
15
+ export default meta;
16
+ export const Default = {
17
+ args: {
18
+ text: 'Link text',
19
+ href: '#',
20
+ },
21
+ };
22
+ export const Playground = {
23
+ args: {
24
+ text: 'Link text',
25
+ href: '#',
26
+ },
27
+ argTypes: {
28
+ text: { control: 'text' },
29
+ href: { control: 'text' },
30
+ target: { control: 'text' },
31
+ size: {
32
+ control: 'select',
33
+ options: ['2xLarge', 'xLarge', 'large', 'medium', 'small', 'xSmall'],
34
+ table: {
35
+ type: { summary: 'select' },
36
+ defaultValue: { summary: 'medium' },
37
+ },
38
+ },
39
+ variant: {
40
+ control: 'select',
41
+ options: ['inline', 'standalone'],
42
+ table: {
43
+ type: { summary: 'select' },
44
+ defaultValue: { summary: 'inline' },
45
+ },
46
+ },
47
+ weight: {
48
+ control: 'select',
49
+ options: ['regular', 'semibold', 'bold'],
50
+ table: {
51
+ type: { summary: 'select' },
52
+ defaultValue: { summary: 'regular' },
53
+ },
54
+ },
55
+ icon: {
56
+ control: 'select',
57
+ options: icons.map(icon => icon.name),
58
+ },
59
+ iconPosition: {
60
+ control: 'select',
61
+ options: ['start', 'end'],
62
+ },
63
+ download: {
64
+ control: 'boolean'
65
+ },
66
+ language: {
67
+ control: 'text',
68
+ description: 'ISO 639 language code. Known languages are: "en", "fi", "sv". When undefined will use browser\'s language.',
69
+ },
70
+ ...anchorAriaAttributeArgTypes,
71
+ },
72
+ };
@@ -0,0 +1,208 @@
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-with-arrow {
152
+ display: inline-flex;
153
+ align-items: center;
154
+ color: var(--ds-textColor-link);
155
+ letter-spacing: var(--ds-letterSpacing-wide);
156
+ font-weight: var(--ds-fontWeight-semibold);
157
+ font-size: var(--ds-fontSize-16);
158
+ text-decoration-line: none;
159
+ }
160
+ .ds-link-with-arrow:focus-visible, .ds-link-with-arrow:focus-within {
161
+ box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
162
+ outline-color: var(--ds-borderColor-black);
163
+ outline-offset: var(--ds-borderWidth-thin);
164
+ outline-style: solid;
165
+ outline-width: var(--ds-borderWidth-thin);
166
+ }
167
+ @media (min-width: 30rem) {
168
+ .ds-link-with-arrow {
169
+ font-size: var(--ds-fontSize-18);
170
+ }
171
+ }
172
+ .ds-link-with-arrow__icon {
173
+ display: inline-flex;
174
+ width: 2em;
175
+ height: 2em;
176
+ line-height: 0;
177
+ align-items: center;
178
+ justify-content: center;
179
+ color: var(--ds-textColor-white);
180
+ background-color: var(--ds-bgColor-primary);
181
+ }
182
+ .ds-link-with-arrow__icon--start {
183
+ margin-right: var(--ds-spacing-xSmall);
184
+ }
185
+ .ds-link-with-arrow__icon--end {
186
+ margin-left: var(--ds-spacing-xSmall);
187
+ }
188
+ :hover slot > .ds-link-with-arrow__icon {
189
+ outline: 10px solid;
190
+ background-color: var(--ds-bgColor-primary-hover);
191
+ }
192
+ :active slot > .ds-link-with-arrow__icon {
193
+ background-color: var(--ds-bgColor-primary-active);
194
+ }
195
+ .ds-link-with-arrow:hover, .ds-link-with-arrow:active {
196
+ text-decoration-line: underline;
197
+ text-decoration-style: solid;
198
+ text-decoration-skip-ink: auto;
199
+ text-decoration-thickness: 7%;
200
+ text-underline-offset: 12%;
201
+ text-underline-position: from-font;
202
+ }
203
+ .ds-link-with-arrow:hover {
204
+ color: var(--ds-textColor-link-hover);
205
+ }
206
+ .ds-link-with-arrow:active, .ds-link-with-arrow:focus-visible {
207
+ color: var(--ds-textColor-link-active);
208
+ }
@@ -0,0 +1,161 @@
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 DsLinkWithArrow {
8
+ inheritedAttributes = {};
9
+ icon = 'arrow_forward';
10
+ rel;
11
+ visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
12
+ el;
13
+ text;
14
+ iconPosition = 'start';
15
+ href;
16
+ target;
17
+ language;
18
+ componentWillLoad() {
19
+ this.inheritedAttributes = inheritAriaAttributes(this.el);
20
+ if (opensInNewTab(this.target)) {
21
+ this.icon = 'arrow_outward';
22
+ this.rel = 'noopener noreferrer';
23
+ }
24
+ }
25
+ render() {
26
+ const classes = classNames('ds-link-with-arrow');
27
+ const iconClasses = classNames('ds-link-with-arrow__icon', {
28
+ 'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
29
+ 'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
30
+ });
31
+ return (h("a", { key: 'aa1a1272c0323f286e590f1a366f2101410a58c3', href: this.href, class: classes, rel: this.rel, target: this.target, ...this.inheritedAttributes }, h("slot", { key: 'e348b24c8c5418cf0f33e18c5337066b6eb579a2', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: 'e523092b3dc32f936139c53e74195b927a219c0f', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: '0ec9d65ee348aa75108f9d87474551b6b3c4a0bb', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: '55b5ef6cc061bea9f68d784e4e9fb0ebdac0002c', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '8c92b801ac0a1d52e12fead3c89703d41f90fa6a', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
32
+ }
33
+ static get is() { return "ds-link-with-arrow"; }
34
+ static get encapsulation() { return "shadow"; }
35
+ static get originalStyleUrls() {
36
+ return {
37
+ "$": ["ds-link-with-arrow.scss"]
38
+ };
39
+ }
40
+ static get styleUrls() {
41
+ return {
42
+ "$": ["ds-link-with-arrow.css"]
43
+ };
44
+ }
45
+ static get properties() {
46
+ return {
47
+ "text": {
48
+ "type": "string",
49
+ "mutable": false,
50
+ "complexType": {
51
+ "original": "string",
52
+ "resolved": "string",
53
+ "references": {}
54
+ },
55
+ "required": false,
56
+ "optional": true,
57
+ "docs": {
58
+ "tags": [],
59
+ "text": ""
60
+ },
61
+ "getter": false,
62
+ "setter": false,
63
+ "attribute": "text",
64
+ "reflect": false
65
+ },
66
+ "iconPosition": {
67
+ "type": "string",
68
+ "mutable": false,
69
+ "complexType": {
70
+ "original": "LinkIconPosition",
71
+ "resolved": "\"end\" | \"start\"",
72
+ "references": {
73
+ "LinkIconPosition": {
74
+ "location": "global",
75
+ "id": "global::LinkIconPosition"
76
+ }
77
+ }
78
+ },
79
+ "required": false,
80
+ "optional": false,
81
+ "docs": {
82
+ "tags": [],
83
+ "text": ""
84
+ },
85
+ "getter": false,
86
+ "setter": false,
87
+ "attribute": "icon-position",
88
+ "reflect": false,
89
+ "defaultValue": "'start'"
90
+ },
91
+ "href": {
92
+ "type": "string",
93
+ "mutable": false,
94
+ "complexType": {
95
+ "original": "string",
96
+ "resolved": "string",
97
+ "references": {}
98
+ },
99
+ "required": true,
100
+ "optional": false,
101
+ "docs": {
102
+ "tags": [],
103
+ "text": ""
104
+ },
105
+ "getter": false,
106
+ "setter": false,
107
+ "attribute": "href",
108
+ "reflect": false
109
+ },
110
+ "target": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "LinkTarget",
115
+ "resolved": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\" | \"_unfencedTop\"",
116
+ "references": {
117
+ "LinkTarget": {
118
+ "location": "global",
119
+ "id": "global::LinkTarget"
120
+ }
121
+ }
122
+ },
123
+ "required": false,
124
+ "optional": true,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": ""
128
+ },
129
+ "getter": false,
130
+ "setter": false,
131
+ "attribute": "target",
132
+ "reflect": false
133
+ },
134
+ "language": {
135
+ "type": "string",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "LinkLang",
139
+ "resolved": "\"en\" | \"fi\" | \"sv\"",
140
+ "references": {
141
+ "LinkLang": {
142
+ "location": "global",
143
+ "id": "global::LinkLang"
144
+ }
145
+ }
146
+ },
147
+ "required": false,
148
+ "optional": true,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": ""
152
+ },
153
+ "getter": false,
154
+ "setter": false,
155
+ "attribute": "lang",
156
+ "reflect": false
157
+ }
158
+ };
159
+ }
160
+ static get elementRef() { return "el"; }
161
+ }
@@ -0,0 +1,33 @@
1
+ import { expect } from "@storybook/test";
2
+ import { html } from "lit";
3
+ import { getShadowRoot } from "../../../../utils/tests/testUtils";
4
+ const meta = {
5
+ title: 'Base Components/LinkWithArrow/Examples',
6
+ component: 'ds-link-with-arrow',
7
+ };
8
+ export default meta;
9
+ export const OpenInANewTab = {
10
+ args: {
11
+ text: 'Link with arrow icon',
12
+ href: '#',
13
+ target: '_blank',
14
+ },
15
+ play: async ({ canvasElement, step }) => {
16
+ const shadowRoot = await getShadowRoot(canvasElement, 'ds-link-with-arrow');
17
+ const anchorElem = shadowRoot.querySelector('a');
18
+ const visuallyHiddenElem = shadowRoot.querySelector('ds-visually-hidden');
19
+ await step('Anchor should have attribute rel with value "noopener noreferrer"', () => {
20
+ expect(anchorElem.rel).toBe('noopener noreferrer');
21
+ });
22
+ await step('Anchor should have a visually hidden assistive text', () => {
23
+ expect(visuallyHiddenElem.textContent).toBe('Opens in a new tab');
24
+ });
25
+ }
26
+ };
27
+ export const IconAtTheEnd = {
28
+ render: () => html `
29
+ <div style="display: flex; background-color: #F7F7F7; justify-content: end; align-items: end; outline: 1px solid; padding: 1em 0.6em; height: 200px; width: 100%;">
30
+ <ds-link-with-arrow text="Link with arrow icon" href="#" icon-position="end"></ds-link-with-arrow>
31
+ </div>
32
+ `
33
+ };
@@ -0,0 +1,19 @@
1
+ const meta = {
2
+ title: 'Base Components/LinkWithArrow/Features',
3
+ component: 'ds-link-with-arrow',
4
+ };
5
+ export default meta;
6
+ export const IconPositionStart = {
7
+ args: {
8
+ text: 'Link with arrow icon',
9
+ href: '#',
10
+ iconPosition: 'start',
11
+ },
12
+ };
13
+ export const IconPositionEnd = {
14
+ args: {
15
+ text: 'Link with arrow icon',
16
+ href: '#',
17
+ iconPosition: 'end',
18
+ },
19
+ };
@@ -0,0 +1,40 @@
1
+ import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
2
+ const anchorAriaAttributes = [
3
+ 'aria-current',
4
+ 'aria-describedby',
5
+ 'aria-haspopup',
6
+ 'aria-label',
7
+ 'aria-labelledby'
8
+ ];
9
+ const anchorAriaAttributeArgTypes = getAriaAttributeArgTypes(anchorAriaAttributes);
10
+ const meta = {
11
+ title: 'Base Components/LinkWithArrow',
12
+ component: 'ds-link-with-arrow',
13
+ };
14
+ export default meta;
15
+ export const Default = {
16
+ args: {
17
+ text: 'Link with arrow icon',
18
+ href: '#',
19
+ },
20
+ };
21
+ export const Playground = {
22
+ args: {
23
+ text: 'Link with arrow icon',
24
+ href: '#',
25
+ },
26
+ argTypes: {
27
+ text: { control: 'text' },
28
+ href: { control: 'text' },
29
+ target: { control: 'text' },
30
+ iconPosition: {
31
+ control: 'select',
32
+ options: ['start', 'end'],
33
+ },
34
+ language: {
35
+ control: 'text',
36
+ description: 'ISO 639 language code. Known languages are: "en", "fi", "sv". When undefined will use browser\'s language.',
37
+ },
38
+ ...anchorAriaAttributeArgTypes,
39
+ },
40
+ };