@uh-design-system/component-library 0.4.0 → 0.4.2

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 (151) hide show
  1. package/dist/cjs/component-library.cjs.js +3 -3
  2. package/dist/cjs/controlUtils-041de0fd.js +7 -0
  3. package/dist/cjs/ds-accordion_3.cjs.entry.js +27 -20
  4. package/dist/cjs/ds-checkbox-group.cjs.entry.js +156 -0
  5. package/dist/cjs/ds-checkbox.cjs.entry.js +153 -0
  6. package/dist/cjs/ds-input-validity.cjs.entry.js +38 -0
  7. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +8 -7
  8. package/dist/cjs/ds-link.cjs.entry.js +11 -8
  9. package/dist/cjs/ds-text-input.cjs.entry.js +30 -6
  10. package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
  11. package/dist/cjs/{index-bfa0f441.js → index-b2bddcf4.js} +326 -125
  12. package/dist/cjs/{linkUtils-695da37c.js → linkUtils-e911e899.js} +10 -0
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/utils-c9113835.js +18 -0
  15. package/dist/collection/accessibility/accessibility.stories.js +10 -0
  16. package/dist/collection/accessibility/stories/ariaLabel.stories.js +19 -0
  17. package/dist/collection/accessibility/stories/ariaLabelledBy.stories.js +49 -0
  18. package/dist/collection/accessibility/stories/naming.stories.js +39 -0
  19. package/dist/collection/collection-manifest.json +4 -1
  20. package/dist/collection/components/00-foundations/icons/categories/information.js +4 -0
  21. package/dist/collection/components/00-foundations/typography/stories/typography.stories.js +133 -48
  22. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +1 -1
  23. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
  24. package/dist/collection/components/01-base-components/ds-button/ds-button.css +9 -9
  25. package/dist/collection/components/01-base-components/ds-button/ds-button.js +2 -2
  26. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +53 -12
  27. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +88 -55
  28. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +1 -1
  29. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +144 -0
  30. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +429 -0
  31. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +115 -0
  32. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +37 -0
  33. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +38 -0
  34. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +445 -0
  35. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +89 -0
  36. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +47 -0
  37. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
  38. package/dist/collection/components/01-base-components/ds-icon/{ds-icon.stories.js → stories/ds-icon.stories.js} +12 -2
  39. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.css +31 -0
  40. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +114 -0
  41. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +17 -0
  42. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +21 -0
  43. package/dist/collection/components/01-base-components/ds-link/ds-link.css +19 -139
  44. package/dist/collection/components/01-base-components/ds-link/ds-link.js +68 -8
  45. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +6 -2
  46. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +2 -2
  47. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +15 -4
  48. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +1 -139
  49. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +25 -5
  50. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.js → ds-link-with-arrow.examples.stories.js} +26 -3
  51. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.js → ds-link-with-arrow.stories.js} +5 -4
  52. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +8 -11
  53. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +30 -5
  54. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +29 -7
  55. package/dist/collection/components/01-base-components/ds-text-input/utils.js +0 -6
  56. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  57. package/dist/collection/utils/controls/controlUtils.js +2 -0
  58. package/dist/collection/utils/link/linkUtils.js +9 -0
  59. package/dist/collection/utils/typography/typographyUtils.js +39 -0
  60. package/dist/collection/utils/utils.js +24 -6
  61. package/dist/component-library/component-library.css +1 -1
  62. package/dist/component-library/component-library.esm.js +1 -1
  63. package/dist/component-library/controlUtils-9ca4087b.js +1 -0
  64. package/dist/component-library/ds-accordion_3.entry.js +1 -1
  65. package/dist/component-library/ds-checkbox-group.entry.js +1 -0
  66. package/dist/component-library/ds-checkbox.entry.js +1 -0
  67. package/dist/component-library/ds-input-validity.entry.js +1 -0
  68. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  69. package/dist/component-library/ds-link.entry.js +1 -1
  70. package/dist/component-library/ds-text-input.entry.js +1 -1
  71. package/dist/component-library/ds-visually-hidden.entry.js +1 -1
  72. package/dist/component-library/index-50783b0c.js +2 -0
  73. package/dist/component-library/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +1 -1
  74. package/dist/component-library/utils-b5843ae1.js +1 -0
  75. package/dist/components/attributes.js +1 -80
  76. package/dist/components/controlUtils.js +4 -0
  77. package/dist/components/ds-accordion.js +8 -8
  78. package/dist/components/ds-button2.js +4 -3
  79. package/dist/components/ds-checkbox-group.d.ts +11 -0
  80. package/dist/components/ds-checkbox-group.js +206 -0
  81. package/dist/components/ds-checkbox.d.ts +11 -0
  82. package/dist/components/ds-checkbox.js +6 -0
  83. package/dist/components/ds-checkbox2.js +185 -0
  84. package/dist/components/ds-icon2.js +24 -4
  85. package/dist/components/ds-input-validity.d.ts +11 -0
  86. package/dist/components/ds-input-validity.js +6 -0
  87. package/dist/components/ds-input-validity2.js +59 -0
  88. package/dist/components/ds-link-with-arrow.js +10 -8
  89. package/dist/components/ds-link.js +15 -9
  90. package/dist/components/ds-text-input.js +30 -7
  91. package/dist/components/ds-visually-hidden2.js +1 -1
  92. package/dist/components/index2.js +298 -130
  93. package/dist/components/index3.js +80 -0
  94. package/dist/components/linkUtils.js +10 -1
  95. package/dist/esm/component-library.js +4 -4
  96. package/dist/esm/controlUtils-9ca4087b.js +4 -0
  97. package/dist/esm/ds-accordion_3.entry.js +25 -18
  98. package/dist/esm/ds-checkbox-group.entry.js +152 -0
  99. package/dist/esm/ds-checkbox.entry.js +149 -0
  100. package/dist/esm/ds-input-validity.entry.js +34 -0
  101. package/dist/esm/ds-link-with-arrow.entry.js +8 -7
  102. package/dist/esm/ds-link.entry.js +11 -8
  103. package/dist/esm/ds-text-input.entry.js +30 -6
  104. package/dist/esm/ds-visually-hidden.entry.js +2 -2
  105. package/dist/esm/{index-42701395.js → index-50783b0c.js} +326 -126
  106. package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-fe63ff72.js} +10 -1
  107. package/dist/esm/loader.js +3 -3
  108. package/dist/esm/utils-b5843ae1.js +15 -0
  109. package/dist/types/accessibility/accessibility.stories.d.ts +3 -0
  110. package/dist/types/accessibility/stories/ariaLabel.stories.d.ts +5 -0
  111. package/dist/types/accessibility/stories/ariaLabelledBy.stories.d.ts +4 -0
  112. package/dist/types/accessibility/stories/naming.stories.d.ts +4 -0
  113. package/dist/types/components/00-foundations/typography/stories/typography.stories.d.ts +1 -0
  114. package/dist/types/components/01-base-components/ds-button/stories/ds-button.examples.stories.d.ts +2 -0
  115. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +4 -1
  116. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +49 -0
  117. package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.d.ts +13 -0
  118. package/dist/types/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.d.ts +7 -0
  119. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +56 -0
  120. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +11 -0
  121. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.d.ts +7 -0
  122. package/dist/types/components/01-base-components/ds-icon/{ds-icon.stories.d.ts → stories/ds-icon.stories.d.ts} +2 -1
  123. package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +12 -0
  124. package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.d.ts +7 -0
  125. package/dist/types/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.d.ts +7 -0
  126. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +4 -1
  127. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -0
  128. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +5 -0
  129. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +0 -1
  130. package/dist/types/components.d.ts +142 -2
  131. package/dist/types/utils/controls/controlUtils.d.ts +2 -0
  132. package/dist/types/utils/link/linkUtils.d.ts +1 -0
  133. package/dist/types/utils/typography/typographyUtils.d.ts +5 -0
  134. package/dist/types/utils/utils.d.ts +10 -3
  135. package/package.json +19 -18
  136. package/dist/cjs/utils-8b73aa91.js +0 -10
  137. package/dist/collection/components/00-foundations/typography/typography.stories.js +0 -68
  138. package/dist/component-library/index-42701395.js +0 -2
  139. package/dist/component-library/utils-cca2a41a.js +0 -1
  140. package/dist/components/utils.js +0 -8
  141. package/dist/esm/utils-cca2a41a.js +0 -8
  142. package/dist/types/components/00-foundations/typography/typography.stories.d.ts +0 -7
  143. /package/dist/cjs/{attributes-f7831329.js → attributes-5f5b58be.js} +0 -0
  144. /package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.js → ds-link-with-arrow.features.stories.js} +0 -0
  145. /package/dist/collection/utils/{attributes.js → attributes/attributes.js} +0 -0
  146. /package/dist/component-library/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
  147. /package/dist/esm/{attributes-9419ac39.js → attributes-7d09be1b.js} +0 -0
  148. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.examples.stories.d.ts → ds-link-with-arrow.examples.stories.d.ts} +0 -0
  149. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.features.stories.d.ts → ds-link-with-arrow.features.stories.d.ts} +0 -0
  150. /package/dist/types/components/01-base-components/ds-link-with-arrow/stories/{ds-arrow-link.stories.d.ts → ds-link-with-arrow.stories.d.ts} +0 -0
  151. /package/dist/types/utils/{attributes.d.ts → attributes/attributes.d.ts} +0 -0
@@ -0,0 +1,114 @@
1
+ import { Fragment, h } from "@stencil/core";
2
+ import classNames from "classnames";
3
+ export class DsInputValidity {
4
+ el;
5
+ text;
6
+ type = 'error';
7
+ validityRole = 'status';
8
+ identifier;
9
+ componentDidLoad() {
10
+ this.identifier = this.el.getAttribute('id');
11
+ this.el.removeAttribute('id');
12
+ }
13
+ render() {
14
+ const classes = classNames('ds-input-validity', {
15
+ 'ds-input-validity--error': this.type === 'error',
16
+ 'ds-input-validity--success': this.type === 'success',
17
+ });
18
+ const icon = this.type === 'success' ? 'check_circle_fill' : 'warning_fill';
19
+ if (!this.text) {
20
+ return null;
21
+ }
22
+ return (h(Fragment, null, this.text && (h("div", { class: classes, role: this.validityRole }, h("ds-icon", { name: icon }), h("small", { id: this.identifier }, this.text)))));
23
+ }
24
+ static get is() { return "ds-input-validity"; }
25
+ static get originalStyleUrls() {
26
+ return {
27
+ "$": ["ds-input-validity.scss"]
28
+ };
29
+ }
30
+ static get styleUrls() {
31
+ return {
32
+ "$": ["ds-input-validity.css"]
33
+ };
34
+ }
35
+ static get properties() {
36
+ return {
37
+ "text": {
38
+ "type": "string",
39
+ "mutable": false,
40
+ "complexType": {
41
+ "original": "string",
42
+ "resolved": "string",
43
+ "references": {}
44
+ },
45
+ "required": false,
46
+ "optional": false,
47
+ "docs": {
48
+ "tags": [],
49
+ "text": ""
50
+ },
51
+ "getter": false,
52
+ "setter": false,
53
+ "attribute": "text",
54
+ "reflect": false
55
+ },
56
+ "type": {
57
+ "type": "string",
58
+ "mutable": false,
59
+ "complexType": {
60
+ "original": "InputValidityType",
61
+ "resolved": "\"error\" | \"success\"",
62
+ "references": {
63
+ "InputValidityType": {
64
+ "location": "global",
65
+ "id": "global::InputValidityType"
66
+ }
67
+ }
68
+ },
69
+ "required": false,
70
+ "optional": false,
71
+ "docs": {
72
+ "tags": [],
73
+ "text": ""
74
+ },
75
+ "getter": false,
76
+ "setter": false,
77
+ "attribute": "type",
78
+ "reflect": false,
79
+ "defaultValue": "'error'"
80
+ },
81
+ "validityRole": {
82
+ "type": "string",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "InputValidityRole",
86
+ "resolved": "\"alert\" | \"status\"",
87
+ "references": {
88
+ "InputValidityRole": {
89
+ "location": "global",
90
+ "id": "global::InputValidityRole"
91
+ }
92
+ }
93
+ },
94
+ "required": false,
95
+ "optional": true,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": ""
99
+ },
100
+ "getter": false,
101
+ "setter": false,
102
+ "attribute": "role",
103
+ "reflect": false,
104
+ "defaultValue": "'status'"
105
+ }
106
+ };
107
+ }
108
+ static get states() {
109
+ return {
110
+ "identifier": {}
111
+ };
112
+ }
113
+ static get elementRef() { return "el"; }
114
+ }
@@ -0,0 +1,17 @@
1
+ const meta = {
2
+ title: 'Base Components/InputValidity/Features',
3
+ component: 'ds-input-validity',
4
+ };
5
+ export default meta;
6
+ export const Error = {
7
+ args: {
8
+ text: 'Link text',
9
+ type: 'error'
10
+ },
11
+ };
12
+ export const Success = {
13
+ args: {
14
+ text: 'Link text',
15
+ type: 'success',
16
+ },
17
+ };
@@ -0,0 +1,21 @@
1
+ const meta = {
2
+ title: 'Base Components/InputValidity',
3
+ component: 'ds-input-validity',
4
+ };
5
+ export default meta;
6
+ export const Default = {
7
+ args: {
8
+ text: 'Error text',
9
+ type: 'error',
10
+ },
11
+ };
12
+ export const Playground = {
13
+ args: {
14
+ text: 'Error text',
15
+ type: 'error',
16
+ },
17
+ argTypes: {
18
+ text: { control: 'text' },
19
+ type: { control: 'select', options: ['error', 'success'] },
20
+ },
21
+ };
@@ -6,144 +6,6 @@
6
6
  --ds-breakpoint-xLarge: 90rem;
7
7
  }
8
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
9
  :host {
148
10
  display: inline-block;
149
11
  }
@@ -161,7 +23,7 @@
161
23
  text-underline-offset: 12%;
162
24
  text-underline-position: from-font;
163
25
  }
164
- .ds-link:focus-visible, .ds-link:focus-within {
26
+ .ds-link:focus-visible {
165
27
  box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
166
28
  outline-color: var(--ds-borderColor-black);
167
29
  outline-offset: var(--ds-borderWidth-thin);
@@ -174,6 +36,24 @@
174
36
  .ds-link--bold {
175
37
  font-weight: var(--ds-fontWeight-bold);
176
38
  }
39
+ .ds-link--2xLarge {
40
+ font-size: var(--ds-fontSize-22);
41
+ }
42
+ .ds-link--xLarge {
43
+ font-size: var(--ds-fontSize-20);
44
+ }
45
+ .ds-link--large {
46
+ font-size: var(--ds-fontSize-18);
47
+ }
48
+ .ds-link--medium {
49
+ font-size: var(--ds-fontSize-16);
50
+ }
51
+ .ds-link--small {
52
+ font-size: var(--ds-fontSize-14);
53
+ }
54
+ .ds-link--xSmall {
55
+ font-size: var(--ds-fontSize-12);
56
+ }
177
57
  .ds-link__icon {
178
58
  height: 1em;
179
59
  width: 1em;
@@ -1,8 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
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";
3
+ import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
4
+ import { getAriaLabel, opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
5
+ import { idGenerator } from "../../../utils/utils";
6
6
  const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
7
7
  export class DsLink {
8
8
  inheritedAttributes = {};
@@ -15,12 +15,15 @@ export class DsLink {
15
15
  weight = 'regular';
16
16
  icon = '';
17
17
  iconPosition = 'end';
18
+ iconTitle;
19
+ iconHidden;
18
20
  href;
19
21
  target;
20
22
  download;
21
23
  language;
24
+ linkAriaLabel;
22
25
  componentWillLoad() {
23
- this.inheritedAttributes = inheritAriaAttributes(this.el);
26
+ this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
24
27
  if (opensInNewTab(this.target)) {
25
28
  this.icon = 'open_in_new';
26
29
  this.iconPosition = 'end';
@@ -29,13 +32,13 @@ export class DsLink {
29
32
  }
30
33
  render() {
31
34
  const classes = classNames('ds-link', `ds-link--${this.weight}`, `ds-link--${this.variant}`, {
32
- [`bodyText--${this.size}`]: Boolean(this.size),
35
+ [`ds-link--${this.size}`]: Boolean(this.size),
33
36
  });
34
37
  const iconClasses = classNames('ds-link__icon', {
35
38
  [`ds-link__icon--start-${this.variant}`]: this.iconPosition === 'start',
36
39
  [`ds-link__icon--end-${this.variant}`]: this.iconPosition === 'end',
37
40
  });
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)))));
41
+ return (h("a", { key: '92b52d7b61888dd8d39841afe9823286356ec231', href: this.href, class: classes, rel: this.rel, target: this.target, download: this.download, "aria-label": getAriaLabel(this.text, this.linkAriaLabel), ...this.inheritedAttributes }, h("slot", { key: '9125a3b98ed37f1e71a922a071c07f2ad270a661', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '5d08c8501703a7d8cf4bb3386d6368047e75f8fe', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), this.text, h("slot", { key: '6bd3f8fda1ad927ceba8612503dddabb188be692', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'e6b7de1ca80eb3485083f5ff1902ebf66821c707', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'b7ffb5a0cfa2e02ef793150bd9ea6886e02c7cac', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
39
42
  }
40
43
  static get is() { return "ds-link"; }
41
44
  static get encapsulation() { return "shadow"; }
@@ -59,8 +62,8 @@ export class DsLink {
59
62
  "resolved": "string",
60
63
  "references": {}
61
64
  },
62
- "required": false,
63
- "optional": true,
65
+ "required": true,
66
+ "optional": false,
64
67
  "docs": {
65
68
  "tags": [],
66
69
  "text": ""
@@ -189,6 +192,44 @@ export class DsLink {
189
192
  "reflect": false,
190
193
  "defaultValue": "'end'"
191
194
  },
195
+ "iconTitle": {
196
+ "type": "string",
197
+ "mutable": false,
198
+ "complexType": {
199
+ "original": "string",
200
+ "resolved": "string",
201
+ "references": {}
202
+ },
203
+ "required": false,
204
+ "optional": true,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": ""
208
+ },
209
+ "getter": false,
210
+ "setter": false,
211
+ "attribute": "icon-title",
212
+ "reflect": false
213
+ },
214
+ "iconHidden": {
215
+ "type": "boolean",
216
+ "mutable": false,
217
+ "complexType": {
218
+ "original": "boolean",
219
+ "resolved": "boolean",
220
+ "references": {}
221
+ },
222
+ "required": false,
223
+ "optional": true,
224
+ "docs": {
225
+ "tags": [],
226
+ "text": ""
227
+ },
228
+ "getter": false,
229
+ "setter": false,
230
+ "attribute": "icon-hidden",
231
+ "reflect": false
232
+ },
192
233
  "href": {
193
234
  "type": "string",
194
235
  "mutable": false,
@@ -274,6 +315,25 @@ export class DsLink {
274
315
  "setter": false,
275
316
  "attribute": "lang",
276
317
  "reflect": false
318
+ },
319
+ "linkAriaLabel": {
320
+ "type": "string",
321
+ "mutable": false,
322
+ "complexType": {
323
+ "original": "string",
324
+ "resolved": "string",
325
+ "references": {}
326
+ },
327
+ "required": false,
328
+ "optional": true,
329
+ "docs": {
330
+ "tags": [],
331
+ "text": ""
332
+ },
333
+ "getter": false,
334
+ "setter": false,
335
+ "attribute": "aria-label",
336
+ "reflect": false
277
337
  }
278
338
  };
279
339
  }
@@ -19,15 +19,18 @@ export const Back = {
19
19
  text: 'Back',
20
20
  href: '#',
21
21
  icon: 'arrow_back',
22
- iconPosition: 'start'
22
+ iconPosition: 'start',
23
+ iconTitle: 'Arrow back',
23
24
  }
24
25
  };
25
26
  export const Download = {
26
27
  args: {
27
- text: 'Link to download a file',
28
+ text: 'Brand book (pdf)',
28
29
  href: '#',
29
30
  icon: 'download',
30
31
  iconPosition: 'start',
32
+ iconTitle: 'Download',
33
+ iconHidden: false,
31
34
  variant: 'standalone',
32
35
  size: 'xLarge',
33
36
  weight: 'semibold',
@@ -39,6 +42,7 @@ export const StandaloneBoldLinkWithIcon = {
39
42
  text: 'Standalone bold link with icon',
40
43
  href: '#',
41
44
  icon: 'arrow_forward',
45
+ iconTitle: 'Arrow forward',
42
46
  variant: 'standalone',
43
47
  size: '2xLarge',
44
48
  weight: 'bold'
@@ -66,8 +66,8 @@ export const OpensInANewTab = {
66
66
  export const IconPosition = {
67
67
  render: () => html `
68
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>
69
+ <div><ds-link href="#" text="Link text" icon="download" icon-position="start" icon-title="Download icon"></ds-link></div>
70
+ <div><ds-link href="#" text="Link text" icon="download" icon-position="end" icon-title="Download icon"></ds-link></div>
71
71
  </div>
72
72
  `
73
73
  };
@@ -1,16 +1,17 @@
1
1
  import { icons } from "../../../00-foundations/icons/iconList";
2
- import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
2
+ import { getAriaAttributeArgTypes } from "../../../../utils/attributes/attributes";
3
3
  const anchorAriaAttributes = [
4
4
  'aria-current',
5
- 'aria-describedby',
6
5
  'aria-haspopup',
7
- 'aria-label',
8
- 'aria-labelledby'
9
6
  ];
10
7
  const anchorAriaAttributeArgTypes = getAriaAttributeArgTypes(anchorAriaAttributes);
11
8
  const meta = {
12
9
  title: 'Base Components/Link',
13
10
  component: 'ds-link',
11
+ argTypes: {
12
+ text: { control: 'text' },
13
+ href: { control: 'text' },
14
+ }
14
15
  };
15
16
  export default meta;
16
17
  export const Default = {
@@ -60,6 +61,12 @@ export const Playground = {
60
61
  control: 'select',
61
62
  options: ['start', 'end'],
62
63
  },
64
+ iconTitle: {
65
+ control: 'text',
66
+ },
67
+ iconHidden: {
68
+ control: 'boolean',
69
+ },
63
70
  download: {
64
71
  control: 'boolean'
65
72
  },
@@ -67,6 +74,10 @@ export const Playground = {
67
74
  control: 'text',
68
75
  description: 'ISO 639 language code. Known languages are: "en", "fi", "sv". When undefined will use browser\'s language.',
69
76
  },
77
+ linkAriaLabel: {
78
+ name: 'aria-label',
79
+ control: 'text',
80
+ },
70
81
  ...anchorAriaAttributeArgTypes,
71
82
  },
72
83
  };