@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,445 @@
1
+ import { Fragment, h } from "@stencil/core";
2
+ import classNames from "classnames";
3
+ import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
4
+ import { idGenerator } from "../../../utils/utils";
5
+ const fieldsetIdGenerator = idGenerator('ds-checkbox-group');
6
+ export class DsCheckboxGroup {
7
+ fieldsetId = fieldsetIdGenerator.next().value;
8
+ checkboxId = `${this.fieldsetId}-checkbox`;
9
+ errorTextId = `${this.fieldsetId}-error`;
10
+ assistiveTextId = `${this.fieldsetId}-assistive-text`;
11
+ nestedId = `${this.fieldsetId}-nested`;
12
+ inheritedAttributes = {};
13
+ el;
14
+ dsCheckboxGroupChange;
15
+ dsCheckboxGroupIndeterminateChildChange;
16
+ legend;
17
+ assistiveText;
18
+ direction = 'vertical';
19
+ errorText = '';
20
+ text = '';
21
+ checked = false;
22
+ checkedChildElementCount = 0;
23
+ disabled = false;
24
+ parentCheckedCount = 0;
25
+ childElementsCount = 0;
26
+ isIndeterminate = false;
27
+ indeterminateChildCheckboxCount = 0;
28
+ elementIs = (localName) => (element) => element.localName === localName;
29
+ elementIsCheckbox = this.elementIs('ds-checkbox');
30
+ elementIsCheckboxGroup = this.elementIs('ds-checkbox-group');
31
+ getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.errorText) && this.errorTextId].filter(Boolean).join(' ');
32
+ getChildElements = () => {
33
+ const slot = this.el.shadowRoot.querySelector('slot');
34
+ return (slot?.assignedElements() || []);
35
+ };
36
+ getChildCheckboxElements = () => {
37
+ return this.getChildElements().filter(this.elementIsCheckbox);
38
+ };
39
+ updateChildElements = (updateFn) => {
40
+ this.getChildElements().forEach(updateFn);
41
+ };
42
+ updateChildCheckboxes = (updateFn) => {
43
+ this.getChildCheckboxElements().forEach(updateFn);
44
+ };
45
+ updateChildElementsChecked = (checked) => {
46
+ this.checkedChildElementCount = checked ? this.childElementsCount : 0;
47
+ this.updateChildElements((element) => {
48
+ element.checked = checked;
49
+ if (this.elementIsCheckboxGroup(element)) {
50
+ (async () => {
51
+ await element.setChecked(checked);
52
+ })();
53
+ }
54
+ });
55
+ };
56
+ async setChecked(newValue) {
57
+ this.updateChildElementsChecked(newValue);
58
+ }
59
+ handleCheckboxDisabledChange(newValue) {
60
+ this.updateChildElements((element) => {
61
+ element.disabled = newValue;
62
+ });
63
+ }
64
+ handleCheckedChange(newValue) {
65
+ this.updateChildElementsChecked(newValue);
66
+ }
67
+ handleIndeterminateChange(newValue) {
68
+ this.dsCheckboxGroupIndeterminateChildChange.emit({ id: this.fieldsetId, indeterminate: newValue });
69
+ }
70
+ handleIndeterminateChildChange(event) {
71
+ this.indeterminateChildCheckboxCount = event.detail.indeterminate ? this.indeterminateChildCheckboxCount + 1 : this.indeterminateChildCheckboxCount - 1;
72
+ }
73
+ handleCheckedChildElementCountChange(newValue, oldValue) {
74
+ this.isIndeterminate =
75
+ this.checkedChildElementCount !== this.childElementsCount && this.checkedChildElementCount < this.childElementsCount && this.checkedChildElementCount > 0;
76
+ if (newValue === this.childElementsCount && newValue > oldValue) {
77
+ this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: true });
78
+ }
79
+ else if (oldValue === this.childElementsCount && newValue < oldValue) {
80
+ this.dsCheckboxGroupChange.emit({ id: this.fieldsetId, checked: false });
81
+ }
82
+ }
83
+ updateCheckedChildElementCount = (event) => {
84
+ if (event.detail.checked) {
85
+ this.checkedChildElementCount = this.checkedChildElementCount === this.childElementsCount ? this.checkedChildElementCount : this.checkedChildElementCount + 1;
86
+ }
87
+ else {
88
+ this.checkedChildElementCount = this.checkedChildElementCount === 0 ? 0 : this.checkedChildElementCount - 1;
89
+ }
90
+ };
91
+ handleCheckboxChange(event) {
92
+ if (event.detail.id === this.checkboxId) {
93
+ this.updateChildElementsChecked(event.detail.checked);
94
+ return;
95
+ }
96
+ if (this.getChildCheckboxElements().includes(event.target)) {
97
+ this.updateCheckedChildElementCount(event);
98
+ }
99
+ }
100
+ handleCheckboxGroupChange(event) {
101
+ if (this.getChildElements().includes(event.target)) {
102
+ this.updateCheckedChildElementCount(event);
103
+ }
104
+ }
105
+ setChildElementCount = () => {
106
+ this.childElementsCount = this.getChildElements().length;
107
+ };
108
+ componentWillLoad() {
109
+ this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-labelledby']);
110
+ }
111
+ componentDidLoad() {
112
+ this.setChildElementCount();
113
+ this.updateChildCheckboxes(element => {
114
+ element.setAttribute('data-errors-disabled', 'true');
115
+ });
116
+ }
117
+ componentDidUpdate() {
118
+ this.setChildElementCount();
119
+ }
120
+ render() {
121
+ const classes = classNames('ds-checkbox-group', {
122
+ 'ds-checkbox-group--horizontal': this.direction === 'horizontal',
123
+ });
124
+ const legendClasses = classNames('ds-checkbox-group__legend');
125
+ const assistiveTextClasses = classNames('ds-checkbox-group__assistive-text');
126
+ const errorClasses = classNames('ds-checkbox-group__error', {
127
+ 'ds-checkbox-group__error--visible': Boolean(this.errorText),
128
+ });
129
+ const nestedClasses = classNames('ds-checkbox-group', 'ds-checkbox-group--inset');
130
+ const checkboxesClasses = classNames('ds-checkbox-group__checkboxes');
131
+ const ariaDescribedBy = this.getAriaDescribedBy();
132
+ return (h("fieldset", { key: '2080f4f193fe5bb3a6702287cebcf5d7dcc4a9b7', id: this.fieldsetId, class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, this.legend && h("legend", { key: '15754cea90c38ad46ff41196b0de108f10f007a9', class: legendClasses }, this.legend), this.assistiveText && (h("small", { key: '7dde97170e62d0668a52b3a21256be65e04ae811', class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.text ? (h(Fragment, null, h("ds-checkbox", { id: this.checkboxId, text: this.text, checked: this.checkedChildElementCount === this.childElementsCount, disabled: this.disabled, indeterminate: this.indeterminateChildCheckboxCount > 0 || this.isIndeterminate }), h("fieldset", { id: this.nestedId, "aria-labelledby": this.checkboxId, class: nestedClasses }, h("slot", null)))) : (h("div", { class: checkboxesClasses }, h("slot", null))), h("div", { key: 'b2e23012afd2f5439c89d5683f8b3776cf438ce5', class: errorClasses }, h("ds-input-validity", { key: 'cfb43cc67a907b7685d55f1ffdd86eb3f73f1bd0', id: this.errorTextId, text: this.errorText, type: "error" }))));
133
+ }
134
+ static get is() { return "ds-checkbox-group"; }
135
+ static get encapsulation() { return "shadow"; }
136
+ static get originalStyleUrls() {
137
+ return {
138
+ "$": ["ds-checkbox-group.scss"]
139
+ };
140
+ }
141
+ static get styleUrls() {
142
+ return {
143
+ "$": ["ds-checkbox-group.css"]
144
+ };
145
+ }
146
+ static get properties() {
147
+ return {
148
+ "legend": {
149
+ "type": "string",
150
+ "mutable": false,
151
+ "complexType": {
152
+ "original": "string",
153
+ "resolved": "string",
154
+ "references": {}
155
+ },
156
+ "required": false,
157
+ "optional": true,
158
+ "docs": {
159
+ "tags": [],
160
+ "text": ""
161
+ },
162
+ "getter": false,
163
+ "setter": false,
164
+ "attribute": "legend",
165
+ "reflect": false
166
+ },
167
+ "assistiveText": {
168
+ "type": "string",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "string",
172
+ "resolved": "string",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": true,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": ""
180
+ },
181
+ "getter": false,
182
+ "setter": false,
183
+ "attribute": "assistive-text",
184
+ "reflect": false
185
+ },
186
+ "direction": {
187
+ "type": "string",
188
+ "mutable": false,
189
+ "complexType": {
190
+ "original": "'horizontal' | 'vertical'",
191
+ "resolved": "\"horizontal\" | \"vertical\"",
192
+ "references": {}
193
+ },
194
+ "required": false,
195
+ "optional": false,
196
+ "docs": {
197
+ "tags": [],
198
+ "text": ""
199
+ },
200
+ "getter": false,
201
+ "setter": false,
202
+ "attribute": "direction",
203
+ "reflect": false,
204
+ "defaultValue": "'vertical'"
205
+ },
206
+ "errorText": {
207
+ "type": "string",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "string",
211
+ "resolved": "string",
212
+ "references": {}
213
+ },
214
+ "required": false,
215
+ "optional": false,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": ""
219
+ },
220
+ "getter": false,
221
+ "setter": false,
222
+ "attribute": "error-text",
223
+ "reflect": false,
224
+ "defaultValue": "''"
225
+ },
226
+ "text": {
227
+ "type": "string",
228
+ "mutable": false,
229
+ "complexType": {
230
+ "original": "string",
231
+ "resolved": "string",
232
+ "references": {}
233
+ },
234
+ "required": false,
235
+ "optional": false,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": ""
239
+ },
240
+ "getter": false,
241
+ "setter": false,
242
+ "attribute": "text",
243
+ "reflect": false,
244
+ "defaultValue": "''"
245
+ },
246
+ "checked": {
247
+ "type": "boolean",
248
+ "mutable": true,
249
+ "complexType": {
250
+ "original": "boolean",
251
+ "resolved": "boolean",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": ""
259
+ },
260
+ "getter": false,
261
+ "setter": false,
262
+ "attribute": "checked",
263
+ "reflect": false,
264
+ "defaultValue": "false"
265
+ },
266
+ "checkedChildElementCount": {
267
+ "type": "number",
268
+ "mutable": true,
269
+ "complexType": {
270
+ "original": "number",
271
+ "resolved": "number",
272
+ "references": {}
273
+ },
274
+ "required": false,
275
+ "optional": false,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": ""
279
+ },
280
+ "getter": false,
281
+ "setter": false,
282
+ "attribute": "checked-child-element-count",
283
+ "reflect": false,
284
+ "defaultValue": "0"
285
+ },
286
+ "disabled": {
287
+ "type": "boolean",
288
+ "mutable": false,
289
+ "complexType": {
290
+ "original": "boolean",
291
+ "resolved": "boolean",
292
+ "references": {}
293
+ },
294
+ "required": false,
295
+ "optional": false,
296
+ "docs": {
297
+ "tags": [],
298
+ "text": ""
299
+ },
300
+ "getter": false,
301
+ "setter": false,
302
+ "attribute": "disabled",
303
+ "reflect": false,
304
+ "defaultValue": "false"
305
+ },
306
+ "parentCheckedCount": {
307
+ "type": "number",
308
+ "mutable": false,
309
+ "complexType": {
310
+ "original": "number",
311
+ "resolved": "number",
312
+ "references": {}
313
+ },
314
+ "required": false,
315
+ "optional": false,
316
+ "docs": {
317
+ "tags": [],
318
+ "text": ""
319
+ },
320
+ "getter": false,
321
+ "setter": false,
322
+ "attribute": "parent-checked-count",
323
+ "reflect": false,
324
+ "defaultValue": "0"
325
+ }
326
+ };
327
+ }
328
+ static get states() {
329
+ return {
330
+ "childElementsCount": {},
331
+ "isIndeterminate": {},
332
+ "indeterminateChildCheckboxCount": {}
333
+ };
334
+ }
335
+ static get events() {
336
+ return [{
337
+ "method": "dsCheckboxGroupChange",
338
+ "name": "dsCheckboxGroupChange",
339
+ "bubbles": true,
340
+ "cancelable": true,
341
+ "composed": true,
342
+ "docs": {
343
+ "tags": [],
344
+ "text": ""
345
+ },
346
+ "complexType": {
347
+ "original": "CheckboxGroupChangeEvent",
348
+ "resolved": "CheckboxGroupChangeEvent",
349
+ "references": {
350
+ "CheckboxGroupChangeEvent": {
351
+ "location": "local",
352
+ "path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx",
353
+ "id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::CheckboxGroupChangeEvent"
354
+ }
355
+ }
356
+ }
357
+ }, {
358
+ "method": "dsCheckboxGroupIndeterminateChildChange",
359
+ "name": "dsCheckboxGroupIndeterminateChildChange",
360
+ "bubbles": true,
361
+ "cancelable": true,
362
+ "composed": true,
363
+ "docs": {
364
+ "tags": [],
365
+ "text": ""
366
+ },
367
+ "complexType": {
368
+ "original": "CheckboxGroupIndeterminateChildChangeEvent",
369
+ "resolved": "CheckboxGroupIndeterminateChildChangeEvent",
370
+ "references": {
371
+ "CheckboxGroupIndeterminateChildChangeEvent": {
372
+ "location": "local",
373
+ "path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx",
374
+ "id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::CheckboxGroupIndeterminateChildChangeEvent"
375
+ }
376
+ }
377
+ }
378
+ }];
379
+ }
380
+ static get methods() {
381
+ return {
382
+ "setChecked": {
383
+ "complexType": {
384
+ "signature": "(newValue: boolean) => Promise<void>",
385
+ "parameters": [{
386
+ "name": "newValue",
387
+ "type": "boolean",
388
+ "docs": "New checked state."
389
+ }],
390
+ "references": {
391
+ "Promise": {
392
+ "location": "global",
393
+ "id": "global::Promise"
394
+ }
395
+ },
396
+ "return": "Promise<void>"
397
+ },
398
+ "docs": {
399
+ "text": "Updates child elements' checked state.",
400
+ "tags": [{
401
+ "name": "param",
402
+ "text": "newValue New checked state."
403
+ }]
404
+ }
405
+ }
406
+ };
407
+ }
408
+ static get elementRef() { return "el"; }
409
+ static get watchers() {
410
+ return [{
411
+ "propName": "disabled",
412
+ "methodName": "handleCheckboxDisabledChange"
413
+ }, {
414
+ "propName": "checked",
415
+ "methodName": "handleCheckedChange"
416
+ }, {
417
+ "propName": "isIndeterminate",
418
+ "methodName": "handleIndeterminateChange"
419
+ }, {
420
+ "propName": "checkedChildElementCount",
421
+ "methodName": "handleCheckedChildElementCountChange"
422
+ }];
423
+ }
424
+ static get listeners() {
425
+ return [{
426
+ "name": "dsCheckboxGroupIndeterminateChildChange",
427
+ "method": "handleIndeterminateChildChange",
428
+ "target": undefined,
429
+ "capture": false,
430
+ "passive": false
431
+ }, {
432
+ "name": "dsCheckboxChange",
433
+ "method": "handleCheckboxChange",
434
+ "target": undefined,
435
+ "capture": false,
436
+ "passive": false
437
+ }, {
438
+ "name": "dsCheckboxGroupChange",
439
+ "method": "handleCheckboxGroupChange",
440
+ "target": undefined,
441
+ "capture": false,
442
+ "passive": false
443
+ }];
444
+ }
445
+ }
@@ -0,0 +1,89 @@
1
+ import { html } from "lit";
2
+ const meta = {
3
+ title: 'Base Components/CheckboxGroup/Features',
4
+ component: 'ds-checkbox-group',
5
+ render: (args) => html `
6
+ <ds-checkbox-group
7
+ legend=${args.legend}
8
+ assistive-text=${args.assistiveText}
9
+ direction=${args.direction}
10
+ error-text=${args.errorText}
11
+ >
12
+ <ds-checkbox text="Value text"></ds-checkbox>
13
+ <ds-checkbox text="Value text"></ds-checkbox>
14
+ <ds-checkbox text="Value text"></ds-checkbox>
15
+ </ds-checkbox-group>
16
+ `,
17
+ };
18
+ export default meta;
19
+ export const Vertical = {
20
+ args: {
21
+ legend: 'Group legend',
22
+ assistiveText: 'Assistive text',
23
+ direction: 'vertical',
24
+ },
25
+ };
26
+ export const VerticalInvalid = {
27
+ args: {
28
+ legend: 'Group legend',
29
+ assistiveText: 'Assistive text',
30
+ direction: 'vertical',
31
+ errorText: 'Error text',
32
+ },
33
+ };
34
+ export const Horizontal = {
35
+ args: {
36
+ legend: 'Group legend',
37
+ assistiveText: 'Assistive text',
38
+ direction: 'horizontal',
39
+ },
40
+ };
41
+ export const HorizontalInvalid = {
42
+ args: {
43
+ legend: 'Group legend',
44
+ assistiveText: 'Assistive text',
45
+ direction: 'horizontal',
46
+ errorText: 'Error text',
47
+ },
48
+ };
49
+ export const Nested = {
50
+ args: {
51
+ text: 'Parent checkbox',
52
+ checked: false,
53
+ disabled: false,
54
+ },
55
+ render: (args) => html `
56
+ <ds-checkbox-group
57
+ text=${args.text}
58
+ checked=${args.checked}
59
+ disabled=${args.disabled}
60
+ >
61
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
62
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
63
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
64
+ </ds-checkbox-group>
65
+ `,
66
+ };
67
+ export const DeeplyNested = {
68
+ render: () => html `
69
+ <ds-checkbox-group
70
+ legend="Grandparent legend"
71
+ assistive-text="Grandparent assistive text"
72
+ error-text="Grandparent error text"
73
+ text="Grandparent checkbox"
74
+ checked="false"
75
+ disabled="false"
76
+ >
77
+ <ds-checkbox text="Parent checkbox"></ds-checkbox>
78
+ <ds-checkbox-group
79
+ text="Parent checkbox"
80
+ checked="false"
81
+ disabled="false"
82
+ >
83
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
84
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
85
+ <ds-checkbox text="Child checkbox"></ds-checkbox>
86
+ </ds-checkbox-group>
87
+ </ds-checkbox-group>
88
+ `,
89
+ };
@@ -0,0 +1,47 @@
1
+ import { html } from "lit";
2
+ const meta = {
3
+ title: 'Base Components/CheckboxGroup',
4
+ component: 'ds-checkbox-group',
5
+ render: (args) => html `
6
+ <ds-checkbox-group
7
+ legend=${args.legend}
8
+ assistive-text=${args.assistiveText}
9
+ direction=${args.direction}
10
+ error-text=${args.errorText}
11
+ text=${args.text}
12
+ checked=${args.checked}
13
+ disabled=${args.disabled}
14
+ >
15
+ <ds-checkbox text="Value text"></ds-checkbox>
16
+ <ds-checkbox text="Value text"></ds-checkbox>
17
+ <ds-checkbox text="Value text"></ds-checkbox>
18
+ </ds-checkbox-group>
19
+ `,
20
+ };
21
+ export default meta;
22
+ export const Default = {
23
+ args: {
24
+ legend: 'Group legend',
25
+ assistiveText: 'Assistive text',
26
+ },
27
+ };
28
+ export const Playground = {
29
+ args: {
30
+ legend: 'Group legend',
31
+ assistiveText: 'Assistive text',
32
+ direction: 'vertical',
33
+ errorText: '',
34
+ text: '',
35
+ checked: false,
36
+ disabled: false,
37
+ },
38
+ argTypes: {
39
+ legend: { control: 'text' },
40
+ assistiveText: { control: 'text' },
41
+ direction: { control: 'radio', options: ['horizontal', 'vertical'] },
42
+ errorText: { control: 'text' },
43
+ text: { control: 'text' },
44
+ checked: { control: 'boolean' },
45
+ disabled: { control: 'boolean' },
46
+ },
47
+ };
@@ -48,7 +48,7 @@ export class DsIcon {
48
48
  }
49
49
  }
50
50
  render() {
51
- return (h(Fragment, { key: 'cc6f636f46e631b82570aaa156bbced5e7c23fc6' }, h("span", { key: 'c3305714b164807c119ff1e9ab4d9496dd3eb105', class: 'ds-icon--container', innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
51
+ return (h(Fragment, { key: '3f68a522cda5ce59a62a8afa72c0c3305b0fb6e0' }, h("span", { key: 'cb6c204588d641e847c78bab7860e859d96dd300', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
52
52
  }
53
53
  static get is() { return "ds-icon"; }
54
54
  static get encapsulation() { return "shadow"; }
@@ -1,5 +1,5 @@
1
- import { icons } from "../../../components/00-foundations/icons/iconList";
2
- import { getColourVariables } from "../../../utils/colours/colourUtils";
1
+ import { icons } from "../../../00-foundations/icons/iconList";
2
+ import { getColourVariables } from "../../../../utils/colours/colourUtils";
3
3
  const meta = {
4
4
  title: 'Base Components/Icon',
5
5
  component: 'ds-icon',
@@ -53,3 +53,13 @@ Default.args = {
53
53
  dsTitle: 'Icon',
54
54
  hidden: true,
55
55
  };
56
+ export const Playground = {
57
+ args: {
58
+ name: 'archive',
59
+ colour: 'primary',
60
+ size: '1.5rem',
61
+ dsTitle: 'Icon',
62
+ role: 'img',
63
+ hidden: true,
64
+ },
65
+ };
@@ -0,0 +1,31 @@
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
+ .ds-input-validity {
10
+ display: flex;
11
+ align-items: center;
12
+ margin-top: var(--ds-spacing-2xSmall);
13
+ gap: var(--ds-spacing-2xSmall);
14
+ }
15
+ .ds-input-validity--error {
16
+ color: var(--ds-textColor-danger);
17
+ }
18
+ .ds-input-validity--success {
19
+ color: var(--ds-textColor-success);
20
+ }
21
+ .ds-input-validity ds-icon {
22
+ display: block;
23
+ height: 1.5rem;
24
+ }
25
+ .ds-input-validity small {
26
+ font-family: var(--ds-fontFamily-body);
27
+ font-size: var(--ds-fontSize-16);
28
+ font-weight: var(--ds-fontWeight-regular);
29
+ letter-spacing: var(--ds-letterSpacing-wide);
30
+ line-height: var(--ds-lineHeight-large);
31
+ }