@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.
Files changed (108) 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} +418 -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/01-base-components/ds-accordion/ds-accordion.css +92 -81
  19. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +41 -9
  20. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +15 -0
  21. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +1 -1
  22. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +10 -1
  23. package/dist/collection/components/01-base-components/ds-button/ds-button.css +55 -55
  24. package/dist/collection/components/01-base-components/ds-button/ds-button.js +2 -2
  25. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +4 -8
  26. package/dist/collection/components/01-base-components/ds-icon/ds-icon.css +5 -1
  27. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +9 -6
  28. package/dist/collection/components/01-base-components/ds-icon/ds-icon.stories.js +2 -2
  29. package/dist/collection/components/01-base-components/ds-link/ds-link.css +158 -0
  30. package/dist/collection/components/01-base-components/ds-link/ds-link.js +281 -0
  31. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +53 -0
  32. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +73 -0
  33. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +72 -0
  34. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +142 -0
  35. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +161 -0
  36. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.js +33 -0
  37. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.js +19 -0
  38. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.js +40 -0
  39. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +45 -40
  40. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +43 -3
  41. 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
  42. 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
  43. package/dist/collection/components/01-base-components/ds-text-input/{ds-text-input.stories.js → stories/ds-text-input.stories.js} +2 -2
  44. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  45. package/dist/collection/introduction/introduction.stories.js +9 -0
  46. package/dist/collection/utils/link/linkUtils.js +11 -0
  47. package/dist/collection/utils/utils.js +5 -0
  48. package/dist/component-library/attributes-9419ac39.js +1 -0
  49. package/dist/component-library/component-library.css +1 -1
  50. package/dist/component-library/component-library.esm.js +1 -1
  51. package/dist/component-library/ds-accordion_3.entry.js +1 -0
  52. package/dist/component-library/ds-link-with-arrow.entry.js +1 -0
  53. package/dist/component-library/ds-link.entry.js +1 -0
  54. package/dist/component-library/ds-text-input.entry.js +1 -1
  55. package/dist/component-library/ds-visually-hidden.entry.js +1 -0
  56. package/dist/component-library/{index-4200d514.js → index-42701395.js} +2 -2
  57. package/dist/component-library/linkUtils-3d1b28cf.js +1 -0
  58. package/dist/component-library/utils-cca2a41a.js +1 -0
  59. package/dist/components/attributes.js +154 -0
  60. package/dist/components/ds-accordion.js +31 -12
  61. package/dist/components/ds-button2.js +4 -78
  62. package/dist/components/ds-icon2.js +320 -231
  63. package/dist/components/ds-link-with-arrow.d.ts +11 -0
  64. package/dist/components/ds-link-with-arrow.js +78 -0
  65. package/dist/components/ds-link.d.ts +11 -0
  66. package/dist/components/ds-link.js +90 -0
  67. package/dist/components/ds-text-input.js +10 -12
  68. package/dist/components/ds-visually-hidden2.js +1 -1
  69. package/dist/components/index2.js +7 -10
  70. package/dist/components/linkUtils.js +13 -0
  71. package/dist/components/utils.js +8 -0
  72. package/dist/esm/attributes-9419ac39.js +75 -0
  73. package/dist/esm/component-library.js +4 -4
  74. package/dist/esm/{ds-accordion_2.entry.js → ds-accordion_3.entry.js} +418 -242
  75. package/dist/esm/ds-link-with-arrow.entry.js +43 -0
  76. package/dist/esm/ds-link.entry.js +50 -0
  77. package/dist/esm/ds-text-input.entry.js +8 -12
  78. package/dist/esm/ds-visually-hidden.entry.js +16 -0
  79. package/dist/esm/{index-4200d514.js → index-42701395.js} +17 -11
  80. package/dist/esm/linkUtils-3d1b28cf.js +13 -0
  81. package/dist/esm/loader.js +3 -3
  82. package/dist/esm/utils-cca2a41a.js +8 -0
  83. package/dist/types/components/00-foundations/icons/categories/social.d.ts +5 -0
  84. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +2 -0
  85. package/dist/types/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.d.ts +1 -0
  86. package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +1 -1
  87. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +25 -0
  88. package/dist/types/components/01-base-components/ds-link/stories/ds-link.examples.stories.d.ts +11 -0
  89. package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +11 -0
  90. package/dist/types/components/01-base-components/ds-link/stories/ds-link.stories.d.ts +7 -0
  91. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +18 -0
  92. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.examples.stories.d.ts +7 -0
  93. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.features.stories.d.ts +7 -0
  94. package/dist/types/components/01-base-components/ds-link-with-arrow/stories/ds-arrow-link.stories.d.ts +7 -0
  95. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -0
  96. 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
  97. 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
  98. 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
  99. package/dist/types/components.d.ts +64 -2
  100. package/dist/types/introduction/introduction.stories.d.ts +10 -0
  101. package/dist/types/utils/link/linkUtils.d.ts +2 -0
  102. package/dist/types/utils/utils.d.ts +1 -0
  103. package/package.json +2 -2
  104. package/dist/cjs/ds-button_2.cjs.entry.js +0 -170
  105. package/dist/component-library/ds-accordion_2.entry.js +0 -1
  106. package/dist/component-library/ds-button_2.entry.js +0 -1
  107. package/dist/components/index3.js +0 -80
  108. package/dist/esm/ds-button_2.entry.js +0 -165
@@ -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
+ };
@@ -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
+ lang: {
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,142 @@
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-with-arrow {
87
+ display: inline-flex;
88
+ align-items: center;
89
+ color: var(--ds-textColor-link);
90
+ letter-spacing: var(--ds-letterSpacing-wide);
91
+ font-weight: var(--ds-fontWeight-semibold);
92
+ font-size: var(--ds-fontSize-16);
93
+ text-decoration-line: none;
94
+ }
95
+ @media (min-width: 30rem) {
96
+ .ds-link-with-arrow {
97
+ font-size: var(--ds-fontSize-18);
98
+ }
99
+ }
100
+ .ds-link-with-arrow__icon {
101
+ display: inline-flex;
102
+ width: 2em;
103
+ height: 2em;
104
+ line-height: 0;
105
+ align-items: center;
106
+ justify-content: center;
107
+ color: var(--ds-textColor-white);
108
+ background-color: var(--ds-bgColor-primary);
109
+ }
110
+ .ds-link-with-arrow__icon--start {
111
+ margin-right: var(--ds-spacing-xSmall);
112
+ }
113
+ .ds-link-with-arrow__icon--end {
114
+ margin-left: var(--ds-spacing-xSmall);
115
+ }
116
+ :hover slot > .ds-link-with-arrow__icon {
117
+ outline: 10px solid;
118
+ background-color: var(--ds-bgColor-primary-hover);
119
+ }
120
+ :active slot > .ds-link-with-arrow__icon {
121
+ background-color: var(--ds-bgColor-primary-active);
122
+ }
123
+ .ds-link-with-arrow:hover, .ds-link-with-arrow:active {
124
+ text-decoration-line: underline;
125
+ text-decoration-style: solid;
126
+ text-decoration-skip-ink: auto;
127
+ text-decoration-thickness: 7%;
128
+ text-underline-offset: 12%;
129
+ text-underline-position: from-font;
130
+ }
131
+ .ds-link-with-arrow:hover {
132
+ color: var(--ds-textColor-link-hover);
133
+ }
134
+ .ds-link-with-arrow:active, .ds-link-with-arrow:focus-visible {
135
+ color: var(--ds-textColor-link-active);
136
+ }
137
+ .ds-link-with-arrow:focus-visible {
138
+ outline-style: solid;
139
+ outline-width: var(--ds-borderWidth-thin);
140
+ outline-offset: var(--ds-borderWidth-thin);
141
+ outline-color: var(--ds-palette-black);
142
+ }
@@ -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
+ lang;
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: '57aac1b83578c9067b7b49404dd098940d1617bf', href: this.href, class: classes, rel: this.rel, target: this.target, ...this.inheritedAttributes }, h("slot", { key: '8e7ef7f70709c62337ea15df531dc10dcd51dacc', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: '3ba6529c60900085941555c5eea469c6f91b4d2f', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: '69b8b9149b4cdf0dc541e67dd853fd024c9ee79b', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: 'ba872300195a151cd308dc56263fa7a7915c5782', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'dcbe006abbf064856849132b291e1372a743582e', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.lang ?? 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
+ "lang": {
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
+ lang: {
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
+ };