@uh-design-system/component-library 0.4.0 → 0.4.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 (151) hide show
  1. package/dist/cjs/component-library.cjs.js +2 -2
  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-b1d61146.js} +116 -2
  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 +3 -0
  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 +315 -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 -1
  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 +11 -3
  48. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +1 -1
  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} +1 -3
  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-aaccd233.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 +104 -4
  93. package/dist/components/index3.js +80 -0
  94. package/dist/components/linkUtils.js +10 -1
  95. package/dist/esm/component-library.js +3 -3
  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-aaccd233.js} +116 -3
  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 +3 -2
  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
+ role = '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.role }, 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
+ "role": {
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
+ };
@@ -161,7 +161,7 @@
161
161
  text-underline-offset: 12%;
162
162
  text-underline-position: from-font;
163
163
  }
164
- .ds-link:focus-visible, .ds-link:focus-within {
164
+ .ds-link:focus-visible {
165
165
  box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
166
166
  outline-color: var(--ds-borderColor-black);
167
167
  outline-offset: var(--ds-borderWidth-thin);
@@ -174,6 +174,24 @@
174
174
  .ds-link--bold {
175
175
  font-weight: var(--ds-fontWeight-bold);
176
176
  }
177
+ .ds-link--2xLarge {
178
+ font-size: var(--ds-fontSize-22);
179
+ }
180
+ .ds-link--xLarge {
181
+ font-size: var(--ds-fontSize-20);
182
+ }
183
+ .ds-link--large {
184
+ font-size: var(--ds-fontSize-18);
185
+ }
186
+ .ds-link--medium {
187
+ font-size: var(--ds-fontSize-16);
188
+ }
189
+ .ds-link--small {
190
+ font-size: var(--ds-fontSize-14);
191
+ }
192
+ .ds-link--xSmall {
193
+ font-size: var(--ds-fontSize-12);
194
+ }
177
195
  .ds-link__icon {
178
196
  height: 1em;
179
197
  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
+ ariaLabel;
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: '8ac4ff399eabfbe264f031b0cf7192ee1f9f2725', href: this.href, class: classes, rel: this.rel, target: this.target, download: this.download, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: '2301357ed75faeb5037c71f5da4fb8c3f8c76b6d', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '2d478d2cf110107d5ea31b1ea44b4904377d686b', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), this.text, h("slot", { key: 'a132464b8b41499c2f8b9da6f22f09d133d86219', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: '5fff8019a4d810e4b686f09e204cf457783d1907', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'cc773ec9fb38d1aa042f812187389e75aab511b2', 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
+ "ariaLabel": {
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,18 @@
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
6
  'aria-label',
8
- 'aria-labelledby'
9
7
  ];
10
8
  const anchorAriaAttributeArgTypes = getAriaAttributeArgTypes(anchorAriaAttributes);
11
9
  const meta = {
12
10
  title: 'Base Components/Link',
13
11
  component: 'ds-link',
12
+ argTypes: {
13
+ text: { control: 'text' },
14
+ href: { control: 'text' },
15
+ }
14
16
  };
15
17
  export default meta;
16
18
  export const Default = {
@@ -60,6 +62,12 @@ export const Playground = {
60
62
  control: 'select',
61
63
  options: ['start', 'end'],
62
64
  },
65
+ iconTitle: {
66
+ control: 'text',
67
+ },
68
+ iconHidden: {
69
+ control: 'boolean',
70
+ },
63
71
  download: {
64
72
  control: 'boolean'
65
73
  },
@@ -157,7 +157,7 @@
157
157
  font-size: var(--ds-fontSize-16);
158
158
  text-decoration-line: none;
159
159
  }
160
- .ds-link-with-arrow:focus-visible, .ds-link-with-arrow:focus-within {
160
+ .ds-link-with-arrow:focus-visible {
161
161
  box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
162
162
  outline-color: var(--ds-borderColor-black);
163
163
  outline-offset: var(--ds-borderWidth-thin);
@@ -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 DsLinkWithArrow {
8
8
  inheritedAttributes = {};
@@ -15,8 +15,9 @@ export class DsLinkWithArrow {
15
15
  href;
16
16
  target;
17
17
  language;
18
+ ariaLabel;
18
19
  componentWillLoad() {
19
- this.inheritedAttributes = inheritAriaAttributes(this.el);
20
+ this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
20
21
  if (opensInNewTab(this.target)) {
21
22
  this.icon = 'arrow_outward';
22
23
  this.rel = 'noopener noreferrer';
@@ -28,7 +29,7 @@ export class DsLinkWithArrow {
28
29
  'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
29
30
  'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
30
31
  });
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
+ return (h("a", { key: 'a5773a53bca7c886919e79f668604db1b97f825b', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: '2205bd5ee34150f491824520278b8de44d73f44f', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: '56402edf3a1e50da213931530318f58bc5288b3b', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: '5df46dff1abe8821533b0c09be9987ce32ea135c', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: 'a5c9a78865619a1bebbb0e3587466b2b77160c0c', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '9222ab3fd72b597b314e5bdb97b4467ec5ec41a9', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
32
33
  }
33
34
  static get is() { return "ds-link-with-arrow"; }
34
35
  static get encapsulation() { return "shadow"; }
@@ -154,6 +155,25 @@ export class DsLinkWithArrow {
154
155
  "setter": false,
155
156
  "attribute": "lang",
156
157
  "reflect": false
158
+ },
159
+ "ariaLabel": {
160
+ "type": "string",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "string",
164
+ "resolved": "string",
165
+ "references": {}
166
+ },
167
+ "required": false,
168
+ "optional": true,
169
+ "docs": {
170
+ "tags": [],
171
+ "text": ""
172
+ },
173
+ "getter": false,
174
+ "setter": false,
175
+ "attribute": "aria-label",
176
+ "reflect": false
157
177
  }
158
178
  };
159
179
  }
@@ -1,6 +1,7 @@
1
1
  import { expect } from "@storybook/test";
2
2
  import { html } from "lit";
3
3
  import { getShadowRoot } from "../../../../utils/tests/testUtils";
4
+ import { litTemplateResultToString } from "../../../../utils/utils";
4
5
  const meta = {
5
6
  title: 'Base Components/LinkWithArrow/Examples',
6
7
  component: 'ds-link-with-arrow',
@@ -24,10 +25,32 @@ export const OpenInANewTab = {
24
25
  });
25
26
  }
26
27
  };
28
+ const iconAtTheEndDOM = html `
29
+ <div class="ds-sb-icon-at-the-end">
30
+ <ds-link-with-arrow text="Link with arrow icon" href="#" icon-position="end"></ds-link-with-arrow>
31
+ </div>
32
+ `;
27
33
  export const IconAtTheEnd = {
34
+ parameters: {
35
+ docs: {
36
+ source: {
37
+ code: litTemplateResultToString(iconAtTheEndDOM),
38
+ },
39
+ },
40
+ },
28
41
  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>
42
+ <style>
43
+ .ds-sb-icon-at-the-end {
44
+ display: flex;
45
+ background-color: #f7f7f7;
46
+ justify-content: end;
47
+ align-items: end;
48
+ outline: 1px solid;
49
+ padding: 1em 0.6em;
50
+ height: 200px;
51
+ width: 100%;
52
+ }
53
+ </style>
54
+ ${iconAtTheEndDOM}
32
55
  `
33
56
  };
@@ -1,10 +1,8 @@
1
- import { getAriaAttributeArgTypes } from "../../../../utils/attributes";
1
+ import { getAriaAttributeArgTypes } from "../../../../utils/attributes/attributes";
2
2
  const anchorAriaAttributes = [
3
3
  'aria-current',
4
- 'aria-describedby',
5
4
  'aria-haspopup',
6
5
  'aria-label',
7
- 'aria-labelledby'
8
6
  ];
9
7
  const anchorAriaAttributeArgTypes = getAriaAttributeArgTypes(anchorAriaAttributes);
10
8
  const meta = {
@@ -27,16 +27,6 @@
27
27
  line-height: var(--ds-lineHeight-large);
28
28
  color: var(--ds-textColor-default);
29
29
  }
30
- .ds-input--label-container label.required::after {
31
- content: " *";
32
- color: var(--ds-textColor-secondary);
33
- }
34
- .ds-input--label-container label.optional::after {
35
- content: " (" attr(data-optional-text, "optional") ")";
36
- color: var(--ds-textColor-secondary);
37
- font-size: var(--ds-fontSize-14);
38
- font-weight: var(--ds-fontWeight-regular);
39
- }
40
30
  .ds-input--label-container small {
41
31
  font-family: var(--ds-fontFamily-body);
42
32
  font-size: var(--ds-fontSize-14);
@@ -58,7 +48,14 @@
58
48
  border-color: var(--ds-borderColor-default);
59
49
  padding-inline: var(--ds-spacing-xSmall);
60
50
  }
61
- .ds-input--container:focus-visible, .ds-input--container:focus-within {
51
+ .ds-input--container:focus-visible {
52
+ box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
53
+ outline-color: var(--ds-borderColor-black);
54
+ outline-offset: var(--ds-borderWidth-thin);
55
+ outline-style: solid;
56
+ outline-width: var(--ds-borderWidth-thin);
57
+ }
58
+ .ds-input--container:focus-within {
62
59
  box-shadow: 0 0 0 var(--ds-borderWidth-thin) var(--ds-borderColor-white);
63
60
  outline-color: var(--ds-borderColor-black);
64
61
  outline-offset: var(--ds-borderWidth-thin);
@@ -1,6 +1,7 @@
1
1
  import { Fragment, h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
- import { idGenerator } from "./utils";
3
+ import { idGenerator } from "../../../utils/utils";
4
+ import { getOptionalText, getRequiredText } from "../../../utils/controls/controlUtils";
4
5
  const INPUT_TYPE_ICONS_MAP = {
5
6
  search: 'search',
6
7
  };
@@ -8,6 +9,7 @@ const INPUT_TYPE_ACTION_BUTTON_ICON_MAP = {
8
9
  search: ({ clearButtonVisible }) => (clearButtonVisible ? 'cancel_fill' : ''),
9
10
  password: ({ passwordInputVisible }) => (passwordInputVisible ? 'visibility_off_fill' : 'visibility_fill'),
10
11
  };
12
+ const inputIdGenerator = idGenerator('ds-input');
11
13
  const assistiveTextIdGenerator = idGenerator('ds-assistive-text');
12
14
  const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
13
15
  const successTextIdGenerator = idGenerator('success-text');
@@ -19,9 +21,12 @@ export class DsTextInput {
19
21
  visuallyHiddenAssistiveTextId = visuallyHiddenAssistiveTextIdGenerator.next().value;
20
22
  successTextId = successTextIdGenerator.next().value;
21
23
  errorTextId = errorTextIdGenerator.next().value;
24
+ hasPrefixSlot = false;
25
+ hasSuffixSlot = false;
26
+ el;
22
27
  label;
23
28
  placeholder;
24
- dsId = 'input';
29
+ dsId = inputIdGenerator.next().value;
25
30
  name;
26
31
  disabled;
27
32
  optional;
@@ -58,6 +63,19 @@ export class DsTextInput {
58
63
  this.inputElement.focus();
59
64
  this.clearButtonVisible = false;
60
65
  }
66
+ getLabelText = () => {
67
+ if (this.required) {
68
+ return getRequiredText(this.label);
69
+ }
70
+ if (this.optional) {
71
+ return getOptionalText(this.label, this.optionalText);
72
+ }
73
+ return this.label;
74
+ };
75
+ componentWillLoad() {
76
+ this.hasPrefixSlot = !!this.el.querySelector('[slot="prefix"]');
77
+ this.hasSuffixSlot = !!this.el.querySelector('[slot="suffix"]');
78
+ }
61
79
  onActionButtonClicked = (e) => {
62
80
  e.stopPropagation();
63
81
  switch (this.type) {
@@ -77,6 +95,9 @@ export class DsTextInput {
77
95
  return (h("slot", { name: className }, text && (h("div", { class: `${className}--container` }, h("ds-icon", { name: icon }), h("small", { id: textId, class: className }, text)))));
78
96
  }
79
97
  renderPrefixContent() {
98
+ if (this.hasPrefixSlot) {
99
+ return h("slot", { name: "prefix" });
100
+ }
80
101
  if (this.prefixText) {
81
102
  return (h("slot", { name: "prefix" }, h("span", { class: "prefix" }, this.prefixText)));
82
103
  }
@@ -87,6 +108,9 @@ export class DsTextInput {
87
108
  return null;
88
109
  }
89
110
  renderSuffixContent() {
111
+ if (this.hasSuffixSlot) {
112
+ return h("slot", { name: "suffix" });
113
+ }
90
114
  if (this.suffixText) {
91
115
  return (h("slot", { name: "suffix" }, h("span", { class: "suffix" }, this.suffixText)));
92
116
  }
@@ -104,14 +128,14 @@ export class DsTextInput {
104
128
  }
105
129
  render() {
106
130
  const inputType = this.type === 'password' && this.passwordInputVisible ? 'text' : this.type;
107
- return (h(Fragment, { key: 'fe9d038685d4912e0b760bed83e21a6ae8582535' }, h("div", { key: '4c4a662fcbcbf2c9a04986ad44b018736c8ba0d7', class: "ds-input--label-container" }, h("slot", { key: '8fea3c6a05e3f5314eae43c2f2eeedc47735278a', name: "label" }, h("label", { key: '33aa9fa1ab0eba6c36b0e882d8a71000a2a2ff40', "data-optional-text": this.optionalText, class: classNames({ required: this.required, optional: this.optional }), htmlFor: this.dsId }, this.label)), h("slot", { key: '13f7adf5a85a2f2d8d5f3e7b829ff86707f75a3d', name: "help-text" }, h("small", { key: '3595ee7deb43919aeabb938a2f0cc0ce78ca181d', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '001fd7a38ef2034f7e650e86d00d5a30ee217c17', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: 'ec9f2c0d6ff40bd6c8a4618ec238e966a0756c19', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input--container', {
131
+ return (h(Fragment, { key: '4d3ad7cc3f0d7c6aba4bcb8e5b05d0794b614f32' }, h("div", { key: '1cad6e50d1a9c0f4214824d1ff46a8418a095790', class: "ds-input--label-container" }, h("slot", { key: '67d096bb1eecd6ac492a5dcd14bd6f9bda21eb2c', name: "label" }, h("label", { key: 'cfffb9b06f2122dd80e4ad94831ca69b71e5a0de', htmlFor: this.dsId }, this.getLabelText())), h("slot", { key: '2256dfda0cf19eae50307b9badc2a2a97d9e190b', name: "help-text" }, h("small", { key: 'b9496a9afec60a4a64a0ff66505a7572362387ac', id: this.assistiveTextId }, this.assistiveText), h("ds-visually-hidden", { key: '23026b2453728e607802aabb7760f07229edeb7c', id: this.visuallyHiddenAssistiveTextId }, this.hiddenAssistiveText))), h("div", { key: '161a4d4eed706c5fd6ba2af90029e68b1c6b95c9', onMouseDown: () => (this.inputActive = true), onMouseUp: () => (this.inputActive = false), onClick: e => this.handleInputContainerClick(e), class: classNames('ds-input--container', {
108
132
  disabled: this.disabled,
109
133
  readonly: this.readonly,
110
134
  valid: !!this.successText,
111
135
  invalid: !!this.errorText,
112
136
  focus: this.hasFocus,
113
137
  active: !!this.inputActive,
114
- }) }, this.renderPrefixContent(), h("input", { key: '1cd22b415c330cb50c4c9663f6dec3a1e99e256b', ref: e => (this.inputElement = e), id: this.dsId, name: this.name, "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
138
+ }) }, this.renderPrefixContent(), h("input", { key: 'a04e9ed4de86a65290206ca62efde1c27d76aa80', ref: e => (this.inputElement = e), id: this.dsId, name: this.name, "aria-label": this.ariaLabel, "aria-labelledby": this.ariaLabelledBy, "aria-describedby": this.ariaDescribedby ||
115
139
  classNames(this.assistiveTextId, this.visuallyHiddenAssistiveTextId, {
116
140
  [this.successTextId]: this.successText,
117
141
  [this.errorTextId]: this.errorText,
@@ -187,7 +211,7 @@ export class DsTextInput {
187
211
  "setter": false,
188
212
  "attribute": "id",
189
213
  "reflect": false,
190
- "defaultValue": "'input'"
214
+ "defaultValue": "inputIdGenerator.next().value as string"
191
215
  },
192
216
  "name": {
193
217
  "type": "string",
@@ -701,4 +725,5 @@ export class DsTextInput {
701
725
  }
702
726
  };
703
727
  }
728
+ static get elementRef() { return "el"; }
704
729
  }