@uh-design-system/component-library 0.4.2 → 0.5.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 (100) hide show
  1. package/dist/cjs/component-library.cjs.js +2 -2
  2. package/dist/cjs/ds-accordion_3.cjs.entry.js +11 -11
  3. package/dist/cjs/ds-checkbox-group.cjs.entry.js +15 -16
  4. package/dist/cjs/ds-checkbox.cjs.entry.js +42 -35
  5. package/dist/cjs/ds-input-validity.cjs.entry.js +4 -6
  6. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -5
  7. package/dist/cjs/ds-link.cjs.entry.js +5 -5
  8. package/dist/cjs/ds-text-input.cjs.entry.js +52 -24
  9. package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
  10. package/dist/cjs/{index-b2bddcf4.js → index-bf84b124.js} +16 -0
  11. package/dist/cjs/index.cjs.js +8 -0
  12. package/dist/cjs/{linkUtils-e911e899.js → linkUtils-695da37c.js} +0 -10
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/store-9bd20f3c.js +207 -0
  15. package/dist/cjs/{utils-c9113835.js → utils-2ba5e075.js} +10 -0
  16. package/dist/collection/collection-manifest.json +1 -1
  17. package/dist/collection/components/00-foundations/icons/icons.stories.js +1 -0
  18. package/dist/collection/components/00-foundations/types.js +1 -0
  19. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
  20. package/dist/collection/components/01-base-components/ds-button/ds-button.css +6 -0
  21. package/dist/collection/components/01-base-components/ds-button/ds-button.js +1 -1
  22. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +1 -1
  23. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +68 -56
  24. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +1 -0
  25. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +27 -67
  26. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
  27. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +5 -8
  28. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +1 -0
  29. package/dist/collection/components/01-base-components/ds-link/ds-link.js +6 -6
  30. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +1 -1
  31. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +6 -6
  32. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +1 -1
  33. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +6 -0
  34. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +73 -27
  35. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +82 -13
  36. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +6 -7
  37. package/dist/collection/components/01-base-components/ds-text-input/utils.js +1 -10
  38. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  39. package/dist/collection/index.js +1 -1
  40. package/dist/collection/store.js +13 -0
  41. package/dist/collection/utils/link/linkUtils.js +0 -9
  42. package/dist/collection/utils/utils.js +9 -0
  43. package/dist/component-library/component-library.esm.js +1 -1
  44. package/dist/component-library/ds-accordion_3.entry.js +1 -1
  45. package/dist/component-library/ds-checkbox-group.entry.js +1 -1
  46. package/dist/component-library/ds-checkbox.entry.js +1 -1
  47. package/dist/component-library/ds-input-validity.entry.js +1 -1
  48. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  49. package/dist/component-library/ds-link.entry.js +1 -1
  50. package/dist/component-library/ds-text-input.entry.js +1 -1
  51. package/dist/component-library/ds-visually-hidden.entry.js +1 -1
  52. package/dist/component-library/{index-50783b0c.js → index-434995e1.js} +2 -2
  53. package/dist/component-library/index.esm.js +1 -0
  54. package/dist/component-library/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -1
  55. package/dist/component-library/store-b8d17c10.js +1 -0
  56. package/dist/component-library/utils-5daa5bc0.js +1 -0
  57. package/dist/components/ds-accordion.js +6 -6
  58. package/dist/components/ds-button2.js +2 -2
  59. package/dist/components/ds-checkbox-group.js +21 -23
  60. package/dist/components/ds-checkbox2.js +44 -37
  61. package/dist/components/ds-icon2.js +11 -2
  62. package/dist/components/ds-input-validity2.js +4 -6
  63. package/dist/components/ds-link-with-arrow.js +5 -5
  64. package/dist/components/ds-link.js +5 -5
  65. package/dist/components/ds-text-input.js +58 -29
  66. package/dist/components/ds-visually-hidden2.js +1 -1
  67. package/dist/components/index.js +1 -0
  68. package/dist/components/index2.js +15 -1
  69. package/dist/components/linkUtils.js +1 -10
  70. package/dist/components/store.js +204 -0
  71. package/dist/esm/component-library.js +3 -3
  72. package/dist/esm/ds-accordion_3.entry.js +11 -11
  73. package/dist/esm/ds-checkbox-group.entry.js +15 -16
  74. package/dist/esm/ds-checkbox.entry.js +42 -35
  75. package/dist/esm/ds-input-validity.entry.js +4 -6
  76. package/dist/esm/ds-link-with-arrow.entry.js +5 -5
  77. package/dist/esm/ds-link.entry.js +5 -5
  78. package/dist/esm/ds-text-input.entry.js +52 -24
  79. package/dist/esm/ds-visually-hidden.entry.js +2 -2
  80. package/dist/esm/{index-50783b0c.js → index-434995e1.js} +15 -1
  81. package/dist/esm/index.js +2 -1
  82. package/dist/esm/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -10
  83. package/dist/esm/loader.js +3 -3
  84. package/dist/esm/store-b8d17c10.js +204 -0
  85. package/dist/esm/{utils-b5843ae1.js → utils-5daa5bc0.js} +10 -1
  86. package/dist/types/components/00-foundations/types.d.ts +3 -0
  87. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +14 -14
  88. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +14 -16
  89. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
  90. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
  91. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +17 -8
  92. package/dist/types/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.d.ts +1 -0
  93. package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +1 -1
  94. package/dist/types/components.d.ts +42 -28
  95. package/dist/types/index.d.ts +1 -0
  96. package/dist/types/store.d.ts +10 -0
  97. package/dist/types/utils/link/linkUtils.d.ts +0 -1
  98. package/dist/types/utils/utils.d.ts +1 -0
  99. package/package.json +3 -2
  100. package/dist/component-library/utils-b5843ae1.js +0 -1
@@ -1,21 +1,22 @@
1
1
  import { Fragment, h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
4
- import { idGenerator } from "../../../utils/utils";
5
4
  import { getOptionalText, getRequiredText } from "../../../utils/controls/controlUtils";
5
+ import { isValidation } from "../../../store";
6
+ import { getAriaLabel, idGenerator } from "../../../utils/utils";
6
7
  const checkboxIdGenerator = idGenerator('ds-checkbox');
7
8
  export class DsCheckbox {
9
+ inputElem;
8
10
  labelId;
9
- errorTextId;
11
+ inputValidityId;
10
12
  assistiveTextId;
11
13
  inheritedAttributes = {};
12
14
  initialChecked;
13
- inputElem;
15
+ labelClicked = false;
14
16
  el;
15
17
  internals;
16
- dsCheckboxChange;
17
- dsCheckboxError;
18
- checkboxId;
18
+ dsCheckboxInput;
19
+ identifier = checkboxIdGenerator.next().value;
19
20
  checked = false;
20
21
  legend;
21
22
  assistiveText;
@@ -31,12 +32,11 @@ export class DsCheckbox {
31
32
  value = this.checked.toString();
32
33
  validationMessage;
33
34
  setIds = () => {
34
- this.checkboxId = this.checkboxId || checkboxIdGenerator.next().value;
35
- this.labelId = `${this.checkboxId}-label`;
36
- this.errorTextId = `${this.checkboxId}-error`;
37
- this.assistiveTextId = `${this.checkboxId}-assistive-text`;
35
+ this.labelId = `${this.identifier}-label`;
36
+ this.inputValidityId = `${this.identifier}-validity`;
37
+ this.assistiveTextId = `${this.identifier}-assistive-text`;
38
38
  };
39
- getErrorText = () => (!this.errorsDisabled ? this.errorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
39
+ getValidationMessage = () => (!this.errorsDisabled ? this.errorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
40
40
  getLegendText = () => {
41
41
  if (this.required) {
42
42
  return getRequiredText(this.legend);
@@ -58,7 +58,7 @@ export class DsCheckbox {
58
58
  }
59
59
  return this.text;
60
60
  };
61
- getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getErrorText()) && this.errorTextId].filter(Boolean).join(' ');
61
+ getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getValidationMessage()) && this.inputValidityId].filter(Boolean).join(' ');
62
62
  restoreInitialState = () => {
63
63
  this.checked = this.initialChecked;
64
64
  this.value = this.checked.toString();
@@ -70,34 +70,43 @@ export class DsCheckbox {
70
70
  this.value = this.checked.toString();
71
71
  this.internals?.setFormValue(this.value);
72
72
  };
73
- emitCheckboxError = () => {
74
- this.dsCheckboxError.emit(this.getErrorText());
75
- };
76
73
  formResetCallback() {
77
74
  this.restoreInitialState();
78
75
  }
79
76
  componentWillLoad() {
80
77
  this.setInitialState();
81
78
  this.setIds();
82
- this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden']);
83
- }
84
- componentDidLoad() {
85
- this.ariaLabel = this.el.getAttribute('aria-label');
86
- this.el.removeAttribute('aria-label');
87
- }
88
- componentDidUpdate() {
89
- this.emitCheckboxError();
79
+ this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden', 'aria-invalid']);
80
+ if (isValidation('server') || this.errorText) {
81
+ this.validationMessage = this.getValidationMessage();
82
+ }
90
83
  }
91
- handleChange = () => {
92
- this.checked = !this.checked;
93
- this.value = this.checked.toString();
84
+ handleInput = (e) => {
85
+ const target = e.target;
86
+ this.checked = target.checked;
87
+ this.value = target.checked.toString();
94
88
  this.internals?.setFormValue(this.value);
95
- this.dsCheckboxChange.emit({ id: this.checkboxId, checked: this.checked });
89
+ this.dsCheckboxInput.emit({ id: this.identifier, checked: target.checked });
90
+ if (isValidation('client') && this.validationMessage) {
91
+ this.validationMessage = this.getValidationMessage();
92
+ }
96
93
  };
97
94
  handleKeyUp = (event) => {
98
95
  if (event.key === 'Enter') {
99
- this.handleChange();
96
+ this.inputElem.dispatchEvent(new Event('input'));
97
+ }
98
+ };
99
+ handleBlur = () => {
100
+ if (isValidation('client') && !this.labelClicked) {
101
+ this.validationMessage = this.getValidationMessage();
100
102
  }
103
+ this.labelClicked = false;
104
+ };
105
+ handleMouseDown = () => {
106
+ this.labelClicked = true;
107
+ };
108
+ handleMouseUp = () => {
109
+ this.labelClicked = false;
101
110
  };
102
111
  renderCheckbox() {
103
112
  const classes = classNames('ds-checkbox', {
@@ -107,12 +116,11 @@ export class DsCheckbox {
107
116
  const inputClasses = classNames('ds-checkbox__input', {
108
117
  'ds-checkbox__input--invalid': Boolean(this.errorText),
109
118
  });
110
- const errorText = this.getErrorText();
111
119
  const errorClasses = classNames('ds-checkbox-error', {
112
- 'ds-checkbox-error--visible': Boolean(errorText),
120
+ 'ds-checkbox-error--visible': Boolean(this.validationMessage),
113
121
  });
114
122
  const ariaDescribedBy = this.getAriaDescribedBy();
115
- return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onChange: this.handleChange, onKeyUp: this.handleKeyUp, value: this.value, disabled: this.disabled, required: this.required, id: this.checkboxId, "aria-describedby": ariaDescribedBy, "aria-label": this.ariaLabel, ...this.inheritedAttributes }), this.getCheckboxText())), !this.errorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.errorTextId, text: errorText, type: "error" })))));
123
+ return (h(Fragment, null, h("div", null, h("label", { id: this.labelId, class: classes, onMouseDown: this.handleMouseDown, onMouseUp: this.handleMouseUp }, h("input", { ref: inputElem => (this.inputElem = inputElem), type: "checkbox", class: inputClasses, checked: this.checked, indeterminate: this.indeterminate, onInput: this.handleInput, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, value: this.value, disabled: this.disabled, required: this.required, id: this.identifier, "aria-describedby": ariaDescribedBy, "aria-label": getAriaLabel(this.getCheckboxText(), this.ariaLabel), "aria-invalid": this.errorText ? true : undefined, ...this.inheritedAttributes }), this.getCheckboxText())), !this.errorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.inputValidityId, text: this.validationMessage, type: "error", role: "alert" })))));
116
124
  }
117
125
  renderFieldset() {
118
126
  const fieldsetClasses = classNames('ds-checkbox-fieldset');
@@ -141,9 +149,9 @@ export class DsCheckbox {
141
149
  }
142
150
  static get properties() {
143
151
  return {
144
- "checkboxId": {
152
+ "identifier": {
145
153
  "type": "string",
146
- "mutable": true,
154
+ "mutable": false,
147
155
  "complexType": {
148
156
  "original": "string",
149
157
  "resolved": "string",
@@ -158,7 +166,8 @@ export class DsCheckbox {
158
166
  "getter": false,
159
167
  "setter": false,
160
168
  "attribute": "id",
161
- "reflect": false
169
+ "reflect": false,
170
+ "defaultValue": "checkboxIdGenerator.next().value as string"
162
171
  },
163
172
  "checked": {
164
173
  "type": "boolean",
@@ -375,20 +384,38 @@ export class DsCheckbox {
375
384
  "setter": false,
376
385
  "attribute": "optional-text",
377
386
  "reflect": false
387
+ },
388
+ "ariaLabel": {
389
+ "type": "string",
390
+ "mutable": false,
391
+ "complexType": {
392
+ "original": "string",
393
+ "resolved": "string",
394
+ "references": {}
395
+ },
396
+ "required": false,
397
+ "optional": false,
398
+ "docs": {
399
+ "tags": [],
400
+ "text": ""
401
+ },
402
+ "getter": false,
403
+ "setter": false,
404
+ "attribute": "aria-label",
405
+ "reflect": false
378
406
  }
379
407
  };
380
408
  }
381
409
  static get states() {
382
410
  return {
383
- "ariaLabel": {},
384
411
  "value": {},
385
412
  "validationMessage": {}
386
413
  };
387
414
  }
388
415
  static get events() {
389
416
  return [{
390
- "method": "dsCheckboxChange",
391
- "name": "dsCheckboxChange",
417
+ "method": "dsCheckboxInput",
418
+ "name": "dsCheckboxInput",
392
419
  "bubbles": true,
393
420
  "cancelable": true,
394
421
  "composed": true,
@@ -397,31 +424,16 @@ export class DsCheckbox {
397
424
  "text": ""
398
425
  },
399
426
  "complexType": {
400
- "original": "CheckboxChangeEvent",
401
- "resolved": "CheckboxChangeEvent",
427
+ "original": "DsCheckboxInputEvent",
428
+ "resolved": "DsCheckboxInputEvent",
402
429
  "references": {
403
- "CheckboxChangeEvent": {
430
+ "DsCheckboxInputEvent": {
404
431
  "location": "local",
405
432
  "path": "/Users/teemuparssinen/hy/uh-design-system/component-library/packages/component-library/src/components/01-base-components/ds-checkbox/ds-checkbox.tsx",
406
- "id": "src/components/01-base-components/ds-checkbox/ds-checkbox.tsx::CheckboxChangeEvent"
433
+ "id": "src/components/01-base-components/ds-checkbox/ds-checkbox.tsx::DsCheckboxInputEvent"
407
434
  }
408
435
  }
409
436
  }
410
- }, {
411
- "method": "dsCheckboxError",
412
- "name": "dsCheckboxError",
413
- "bubbles": true,
414
- "cancelable": true,
415
- "composed": true,
416
- "docs": {
417
- "tags": [],
418
- "text": ""
419
- },
420
- "complexType": {
421
- "original": "string",
422
- "resolved": "string",
423
- "references": {}
424
- }
425
437
  }];
426
438
  }
427
439
  static get elementRef() { return "el"; }
@@ -33,5 +33,6 @@ export const Playground = {
33
33
  legend: { control: 'text' },
34
34
  assistiveText: { control: 'text' },
35
35
  optionalText: { control: 'text' },
36
+ ariaLabel: { name: 'aria-label', control: 'text' },
36
37
  },
37
38
  };
@@ -19,10 +19,9 @@ export class DsCheckboxGroup {
19
19
  errorText = '';
20
20
  text = '';
21
21
  checked = false;
22
- checkedChildElementCount = 0;
23
22
  disabled = false;
24
- parentCheckedCount = 0;
25
23
  childElementsCount = 0;
24
+ checkedChildElementCount = 0;
26
25
  isIndeterminate = false;
27
26
  indeterminateChildCheckboxCount = 0;
28
27
  elementIs = (localName) => (element) => element.localName === localName;
@@ -56,21 +55,21 @@ export class DsCheckboxGroup {
56
55
  async setChecked(newValue) {
57
56
  this.updateChildElementsChecked(newValue);
58
57
  }
59
- handleCheckboxDisabledChange(newValue) {
58
+ watchCheckboxDisabledChange(newValue) {
60
59
  this.updateChildElements((element) => {
61
60
  element.disabled = newValue;
62
61
  });
63
62
  }
64
- handleCheckedChange(newValue) {
63
+ watchCheckedChange(newValue) {
65
64
  this.updateChildElementsChecked(newValue);
66
65
  }
67
- handleIndeterminateChange(newValue) {
66
+ watchIndeterminateChange(newValue) {
68
67
  this.dsCheckboxGroupIndeterminateChildChange.emit({ id: this.fieldsetId, indeterminate: newValue });
69
68
  }
70
- handleIndeterminateChildChange(event) {
69
+ listenIndeterminateChildChange(event) {
71
70
  this.indeterminateChildCheckboxCount = event.detail.indeterminate ? this.indeterminateChildCheckboxCount + 1 : this.indeterminateChildCheckboxCount - 1;
72
71
  }
73
- handleCheckedChildElementCountChange(newValue, oldValue) {
72
+ watchCheckedChildElementCountChange(newValue, oldValue) {
74
73
  this.isIndeterminate =
75
74
  this.checkedChildElementCount !== this.childElementsCount && this.checkedChildElementCount < this.childElementsCount && this.checkedChildElementCount > 0;
76
75
  if (newValue === this.childElementsCount && newValue > oldValue) {
@@ -88,7 +87,7 @@ export class DsCheckboxGroup {
88
87
  this.checkedChildElementCount = this.checkedChildElementCount === 0 ? 0 : this.checkedChildElementCount - 1;
89
88
  }
90
89
  };
91
- handleCheckboxChange(event) {
90
+ listenCheckboxChange(event) {
92
91
  if (event.detail.id === this.checkboxId) {
93
92
  this.updateChildElementsChecked(event.detail.checked);
94
93
  return;
@@ -97,7 +96,7 @@ export class DsCheckboxGroup {
97
96
  this.updateCheckedChildElementCount(event);
98
97
  }
99
98
  }
100
- handleCheckboxGroupChange(event) {
99
+ listenCheckboxGroupChange(event) {
101
100
  if (this.getChildElements().includes(event.target)) {
102
101
  this.updateCheckedChildElementCount(event);
103
102
  }
@@ -129,7 +128,7 @@ export class DsCheckboxGroup {
129
128
  const nestedClasses = classNames('ds-checkbox-group', 'ds-checkbox-group--inset');
130
129
  const checkboxesClasses = classNames('ds-checkbox-group__checkboxes');
131
130
  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" }))));
131
+ return (h("fieldset", { key: '1029763130b4d2d138679c9f84ec72c0231fcc83', id: this.fieldsetId, class: classes, "aria-describedby": ariaDescribedBy, ...this.inheritedAttributes }, this.legend && h("legend", { key: 'a9be37aab510d5e402841c8bbda64190548bc1ea', class: legendClasses }, this.legend), this.assistiveText && (h("small", { key: '0ae42c2b46e52dad0570ad120180e662db43f2fa', 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: '3ea5bb7991a99c676cb50a24d1a679b6f68c96bf', class: errorClasses }, h("ds-input-validity", { key: '8d5ca5e80b2a5f985e09bf7039538a5a13278e8e', id: this.errorTextId, text: this.errorText, type: "error" }))));
133
132
  }
134
133
  static get is() { return "ds-checkbox-group"; }
135
134
  static get encapsulation() { return "shadow"; }
@@ -245,7 +244,7 @@ export class DsCheckboxGroup {
245
244
  },
246
245
  "checked": {
247
246
  "type": "boolean",
248
- "mutable": true,
247
+ "mutable": false,
249
248
  "complexType": {
250
249
  "original": "boolean",
251
250
  "resolved": "boolean",
@@ -263,26 +262,6 @@ export class DsCheckboxGroup {
263
262
  "reflect": false,
264
263
  "defaultValue": "false"
265
264
  },
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
265
  "disabled": {
287
266
  "type": "boolean",
288
267
  "mutable": false,
@@ -302,32 +281,13 @@ export class DsCheckboxGroup {
302
281
  "attribute": "disabled",
303
282
  "reflect": false,
304
283
  "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
284
  }
326
285
  };
327
286
  }
328
287
  static get states() {
329
288
  return {
330
289
  "childElementsCount": {},
290
+ "checkedChildElementCount": {},
331
291
  "isIndeterminate": {},
332
292
  "indeterminateChildCheckboxCount": {}
333
293
  };
@@ -344,13 +304,13 @@ export class DsCheckboxGroup {
344
304
  "text": ""
345
305
  },
346
306
  "complexType": {
347
- "original": "CheckboxGroupChangeEvent",
348
- "resolved": "CheckboxGroupChangeEvent",
307
+ "original": "DsCheckboxGroupChangeEvent",
308
+ "resolved": "DsCheckboxGroupChangeEvent",
349
309
  "references": {
350
- "CheckboxGroupChangeEvent": {
310
+ "DsCheckboxGroupChangeEvent": {
351
311
  "location": "local",
352
312
  "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"
313
+ "id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::DsCheckboxGroupChangeEvent"
354
314
  }
355
315
  }
356
316
  }
@@ -365,13 +325,13 @@ export class DsCheckboxGroup {
365
325
  "text": ""
366
326
  },
367
327
  "complexType": {
368
- "original": "CheckboxGroupIndeterminateChildChangeEvent",
369
- "resolved": "CheckboxGroupIndeterminateChildChangeEvent",
328
+ "original": "DsCheckboxGroupIndeterminateChildChangeEvent",
329
+ "resolved": "DsCheckboxGroupIndeterminateChildChangeEvent",
370
330
  "references": {
371
- "CheckboxGroupIndeterminateChildChangeEvent": {
331
+ "DsCheckboxGroupIndeterminateChildChangeEvent": {
372
332
  "location": "local",
373
333
  "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"
334
+ "id": "src/components/01-base-components/ds-checkbox-group/ds-checkbox-group.tsx::DsCheckboxGroupIndeterminateChildChangeEvent"
375
335
  }
376
336
  }
377
337
  }
@@ -409,34 +369,34 @@ export class DsCheckboxGroup {
409
369
  static get watchers() {
410
370
  return [{
411
371
  "propName": "disabled",
412
- "methodName": "handleCheckboxDisabledChange"
372
+ "methodName": "watchCheckboxDisabledChange"
413
373
  }, {
414
374
  "propName": "checked",
415
- "methodName": "handleCheckedChange"
375
+ "methodName": "watchCheckedChange"
416
376
  }, {
417
377
  "propName": "isIndeterminate",
418
- "methodName": "handleIndeterminateChange"
378
+ "methodName": "watchIndeterminateChange"
419
379
  }, {
420
380
  "propName": "checkedChildElementCount",
421
- "methodName": "handleCheckedChildElementCountChange"
381
+ "methodName": "watchCheckedChildElementCountChange"
422
382
  }];
423
383
  }
424
384
  static get listeners() {
425
385
  return [{
426
386
  "name": "dsCheckboxGroupIndeterminateChildChange",
427
- "method": "handleIndeterminateChildChange",
387
+ "method": "listenIndeterminateChildChange",
428
388
  "target": undefined,
429
389
  "capture": false,
430
390
  "passive": false
431
391
  }, {
432
- "name": "dsCheckboxChange",
433
- "method": "handleCheckboxChange",
392
+ "name": "dsCheckboxInput",
393
+ "method": "listenCheckboxChange",
434
394
  "target": undefined,
435
395
  "capture": false,
436
396
  "passive": false
437
397
  }, {
438
398
  "name": "dsCheckboxGroupChange",
439
- "method": "handleCheckboxGroupChange",
399
+ "method": "listenCheckboxGroupChange",
440
400
  "target": undefined,
441
401
  "capture": false,
442
402
  "passive": false
@@ -48,7 +48,7 @@ export class DsIcon {
48
48
  }
49
49
  }
50
50
  render() {
51
- return (h(Fragment, { key: '3f68a522cda5ce59a62a8afa72c0c3305b0fb6e0' }, h("span", { key: 'cb6c204588d641e847c78bab7860e859d96dd300', class: "ds-icon--container", innerHTML: this.getIcon(), "aria-hidden": this.hidden ? 'true' : 'false' })));
51
+ return (h(Fragment, { key: '58309a22dafbad09a1f9e884657aad264261174e' }, h("span", { key: '3295d61af901e74ea7c39d1e7a4b7e083f44794f', 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,10 +1,11 @@
1
- import { Fragment, h } from "@stencil/core";
1
+ import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
+ import { isValidation } from "../../../store";
3
4
  export class DsInputValidity {
4
5
  el;
5
6
  text;
6
7
  type = 'error';
7
- validityRole = 'status';
8
+ validityRole;
8
9
  identifier;
9
10
  componentDidLoad() {
10
11
  this.identifier = this.el.getAttribute('id');
@@ -16,10 +17,7 @@ export class DsInputValidity {
16
17
  'ds-input-validity--success': this.type === 'success',
17
18
  });
18
19
  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)))));
20
+ return (h("div", { key: '2eca152eca6e7b4d7e894ff8aaf50a6d03c3e44f', role: isValidation('client') ? this.validityRole : undefined }, this.text && (h("div", { key: '73e4cd1b3af6a84b9c7cbca813c166bc10e9dd26', class: classes }, h("ds-icon", { key: '4eaad4001e758837f9e8b1aae48292a1c5a1a08f', name: icon }), h("small", { key: '3ee5d39785454b9aab9ae6012f3ad940c1f18df0', id: this.identifier }, this.text)))));
23
21
  }
24
22
  static get is() { return "ds-input-validity"; }
25
23
  static get originalStyleUrls() {
@@ -100,8 +98,7 @@ export class DsInputValidity {
100
98
  "getter": false,
101
99
  "setter": false,
102
100
  "attribute": "role",
103
- "reflect": false,
104
- "defaultValue": "'status'"
101
+ "reflect": false
105
102
  }
106
103
  };
107
104
  }
@@ -17,5 +17,6 @@ export const Playground = {
17
17
  argTypes: {
18
18
  text: { control: 'text' },
19
19
  type: { control: 'select', options: ['error', 'success'] },
20
+ validityRole: { name: 'role', control: 'radio', options: ['alert', 'status'] },
20
21
  },
21
22
  };
@@ -1,8 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
4
- import { getAriaLabel, opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
5
- import { idGenerator } from "../../../utils/utils";
4
+ import { opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
5
+ import { getAriaLabel, idGenerator } from "../../../utils/utils";
6
6
  const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
7
7
  export class DsLink {
8
8
  inheritedAttributes = {};
@@ -21,7 +21,7 @@ export class DsLink {
21
21
  target;
22
22
  download;
23
23
  language;
24
- linkAriaLabel;
24
+ ariaLabel;
25
25
  componentWillLoad() {
26
26
  this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
27
27
  if (opensInNewTab(this.target)) {
@@ -38,7 +38,7 @@ export class DsLink {
38
38
  [`ds-link__icon--start-${this.variant}`]: this.iconPosition === 'start',
39
39
  [`ds-link__icon--end-${this.variant}`]: this.iconPosition === 'end',
40
40
  });
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)))));
41
+ return (h("a", { key: 'f8e36a029709033379e53cc1c409bc9c0069820e', 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: '88f90209b6557942dd956585b5f77632aa647c8e', name: "iconStart" }, this.icon && this.iconPosition === 'start' && h("ds-icon", { key: '87169acfb32913d10d27b35a9c6f714385979aa7', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), this.text, h("slot", { key: 'b38677240eb8bd7c1200c8dc08876ba75e7b3e81', name: "iconEnd" }, this.icon && this.iconPosition === 'end' && h("ds-icon", { key: 'c3088e302a43b4cbc5601a9adff54a3dc27a59dc', name: this.icon, class: iconClasses, size: "1em", title: this.iconTitle, hidden: this.iconHidden })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '25ac189fd216148a05fddfc6e384cfbde59e0e22', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
42
42
  }
43
43
  static get is() { return "ds-link"; }
44
44
  static get encapsulation() { return "shadow"; }
@@ -316,7 +316,7 @@ export class DsLink {
316
316
  "attribute": "lang",
317
317
  "reflect": false
318
318
  },
319
- "linkAriaLabel": {
319
+ "ariaLabel": {
320
320
  "type": "string",
321
321
  "mutable": false,
322
322
  "complexType": {
@@ -325,7 +325,7 @@ export class DsLink {
325
325
  "references": {}
326
326
  },
327
327
  "required": false,
328
- "optional": true,
328
+ "optional": false,
329
329
  "docs": {
330
330
  "tags": [],
331
331
  "text": ""
@@ -74,7 +74,7 @@ export const Playground = {
74
74
  control: 'text',
75
75
  description: 'ISO 639 language code. Known languages are: "en", "fi", "sv". When undefined will use browser\'s language.',
76
76
  },
77
- linkAriaLabel: {
77
+ ariaLabel: {
78
78
  name: 'aria-label',
79
79
  control: 'text',
80
80
  },
@@ -1,8 +1,8 @@
1
1
  import { h } from "@stencil/core";
2
2
  import classNames from "classnames";
3
3
  import { inheritAriaAttributes } from "../../../utils/attributes/attributes";
4
- import { getAriaLabel, opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
5
- import { idGenerator } from "../../../utils/utils";
4
+ import { opensInNewTab, visuallyHiddenAssistiveText } from "../../../utils/link/linkUtils";
5
+ import { getAriaLabel, idGenerator } from "../../../utils/utils";
6
6
  const visuallyHiddenAssistiveTextIdGenerator = idGenerator('visually-hidden-assistive-text');
7
7
  export class DsLinkWithArrow {
8
8
  inheritedAttributes = {};
@@ -15,7 +15,7 @@ export class DsLinkWithArrow {
15
15
  href;
16
16
  target;
17
17
  language;
18
- linkAriaLabel;
18
+ ariaLabel;
19
19
  componentWillLoad() {
20
20
  this.inheritedAttributes = inheritAriaAttributes(this.el, ['aria-label']);
21
21
  if (opensInNewTab(this.target)) {
@@ -29,7 +29,7 @@ export class DsLinkWithArrow {
29
29
  'ds-link-with-arrow__icon--start': this.iconPosition === 'start',
30
30
  'ds-link-with-arrow__icon--end': this.iconPosition === 'end',
31
31
  });
32
- return (h("a", { key: '5f43cc989011db22bd8f547957c76289e7bbbf45', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.linkAriaLabel), ...this.inheritedAttributes }, h("slot", { key: '26615467438d0ae98a8138165cf5152796f2ab00', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: 'f34a2d05ed9c991e98aaa89f547bde0c1b677115', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: 'be1ccadeaca632961ed3d44d1d94a26bf35d2963', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: '7bccce249754d661d9faeddbad2f9c4d8c207cfb', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: '4e864244ee939591f435715889e2f9a240f86d36', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
32
+ return (h("a", { key: 'bce4a90f9cc5113ab3d5b300d791d2299e22b7ad', href: this.href, class: classes, rel: this.rel, target: this.target, "aria-label": getAriaLabel(this.text, this.ariaLabel), ...this.inheritedAttributes }, h("slot", { key: '96ba4a33114443aab36d1301cf65c56437b9a85b', name: "iconStart" }, this.iconPosition === 'start' && h("ds-icon", { key: '86d8029de69c1ecb3002a97f5bc0cdbf899b7f91', name: this.icon, class: iconClasses, size: "1.4em" })), this.text, h("slot", { key: '7c2dafaee60253b1f5c22819b1afec83d106234b', name: "iconStart" }, this.iconPosition === 'end' && h("ds-icon", { key: 'a9fb3e2ddee16cce7c6b8fc0fba0b11970567276', name: this.icon, class: iconClasses, size: "1.4em" })), opensInNewTab(this.target) && (h("ds-visually-hidden", { key: 'f93f37d0d10d7a2d51980ff8feb76915cc4823b2', id: this.visuallyHiddenAssistiveTextId }, visuallyHiddenAssistiveText(this.language ?? document.documentElement.lang)))));
33
33
  }
34
34
  static get is() { return "ds-link-with-arrow"; }
35
35
  static get encapsulation() { return "shadow"; }
@@ -156,7 +156,7 @@ export class DsLinkWithArrow {
156
156
  "attribute": "lang",
157
157
  "reflect": false
158
158
  },
159
- "linkAriaLabel": {
159
+ "ariaLabel": {
160
160
  "type": "string",
161
161
  "mutable": false,
162
162
  "complexType": {
@@ -165,7 +165,7 @@ export class DsLinkWithArrow {
165
165
  "references": {}
166
166
  },
167
167
  "required": false,
168
- "optional": true,
168
+ "optional": false,
169
169
  "docs": {
170
170
  "tags": [],
171
171
  "text": ""
@@ -32,7 +32,7 @@ export const Playground = {
32
32
  control: 'text',
33
33
  description: 'ISO 639 language code. Known languages are: "en", "fi", "sv". When undefined will use browser\'s language.',
34
34
  },
35
- linkAriaLabel: {
35
+ ariaLabel: {
36
36
  name: 'aria-label',
37
37
  control: 'text',
38
38
  },
@@ -6,6 +6,12 @@
6
6
  --ds-breakpoint-xLarge: 90rem;
7
7
  }
8
8
 
9
+ .no-style-leak *, :host * {
10
+ all: unset;
11
+ box-sizing: border-box;
12
+ display: block;
13
+ }
14
+
9
15
  :host {
10
16
  display: block;
11
17
  width: 288px;