@uh-design-system/component-library 0.5.3 → 0.6.0

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 (217) hide show
  1. package/dist/cjs/{utils-3412cbed.js → attributes-BMbXzbwU.js} +2 -28
  2. package/dist/cjs/component-library.cjs.js +7 -7
  3. package/dist/cjs/controlUtils-ofqiQxRF.js +42 -0
  4. package/dist/cjs/ds-accordion.cjs.entry.js +79 -0
  5. package/dist/cjs/ds-button.cjs.entry.js +107 -0
  6. package/dist/cjs/ds-card.cjs.entry.js +58 -0
  7. package/dist/cjs/ds-checkbox-group.cjs.entry.js +82 -32
  8. package/dist/cjs/ds-checkbox.cjs.entry.js +70 -64
  9. package/dist/cjs/ds-icon.cjs.entry.js +943 -0
  10. package/dist/cjs/ds-input-validity.cjs.entry.js +13 -14
  11. package/dist/cjs/ds-link-with-arrow.cjs.entry.js +21 -20
  12. package/dist/cjs/ds-link.cjs.entry.js +34 -31
  13. package/dist/cjs/ds-radio-button-group.cjs.entry.js +72 -30
  14. package/dist/cjs/ds-radio-button.cjs.entry.js +60 -59
  15. package/dist/cjs/ds-spinner.cjs.entry.js +62 -0
  16. package/dist/cjs/ds-text-input.cjs.entry.js +89 -77
  17. package/dist/cjs/ds-visually-hidden.cjs.entry.js +17 -0
  18. package/dist/cjs/index-Bp6Dd2i1.js +94 -0
  19. package/dist/cjs/{store-e8e87298.js → index-DwLFyR5p.js} +6 -2
  20. package/dist/cjs/{index-947af833.js → index-Mjp9Y-Sw.js} +666 -52
  21. package/dist/cjs/index.cjs.js +3 -5
  22. package/dist/cjs/{linkUtils-695da37c.js → linkUtils-onlbgKdI.js} +4 -2
  23. package/dist/cjs/loader.cjs.js +3 -5
  24. package/dist/cjs/utils-BjZTECpy.js +29 -0
  25. package/dist/collection/accessibility/stories/naming.stories.js +3 -3
  26. package/dist/collection/collection-manifest.json +74 -2
  27. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.css +7 -6
  28. package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +88 -45
  29. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.examples.stories.js +6 -6
  30. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.features.stories.js +14 -14
  31. package/dist/collection/components/01-base-components/ds-accordion/stories/ds-accordion.stories.js +24 -66
  32. package/dist/collection/components/01-base-components/ds-button/ds-button.css +38 -70
  33. package/dist/collection/components/01-base-components/ds-button/ds-button.js +91 -91
  34. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.examples.stories.js +84 -52
  35. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.features.stories.js +49 -42
  36. package/dist/collection/components/01-base-components/ds-button/stories/ds-button.stories.js +16 -75
  37. package/dist/collection/components/01-base-components/ds-card/ds-card.css +127 -0
  38. package/dist/collection/components/01-base-components/ds-card/ds-card.js +303 -0
  39. package/dist/collection/components/01-base-components/ds-card/stories/ds-card.examples.stories.js +92 -0
  40. package/dist/collection/components/01-base-components/ds-card/stories/ds-card.features.stories.js +66 -0
  41. package/dist/collection/components/01-base-components/ds-card/stories/ds-card.stories.js +71 -0
  42. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +23 -30
  43. package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +112 -84
  44. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.features.stories.js +20 -20
  45. package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +12 -25
  46. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -2
  47. package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +170 -45
  48. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.js +153 -44
  49. package/dist/collection/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.stories.js +30 -28
  50. package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +36 -31
  51. package/dist/collection/components/01-base-components/ds-icon/stories/ds-icon.stories.js +10 -37
  52. package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +60 -30
  53. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.features.stories.js +4 -4
  54. package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +4 -9
  55. package/dist/collection/components/01-base-components/ds-link/ds-link.css +13 -3
  56. package/dist/collection/components/01-base-components/ds-link/ds-link.js +74 -75
  57. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.examples.stories.js +27 -27
  58. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.features.stories.js +38 -21
  59. package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +8 -67
  60. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +1 -3
  61. package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +30 -52
  62. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.examples.stories.js +4 -4
  63. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.features.stories.js +6 -6
  64. package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -28
  65. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.css +26 -27
  66. package/dist/collection/components/01-base-components/ds-radio-button/ds-radio-button.js +98 -117
  67. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.js +29 -27
  68. package/dist/collection/components/01-base-components/ds-radio-button/stories/ds-radio-button.stories.js +9 -23
  69. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.css +1 -2
  70. package/dist/collection/components/01-base-components/ds-radio-button-group/ds-radio-button-group.js +111 -38
  71. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.examples.stories.js +16 -25
  72. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.js +40 -27
  73. package/dist/collection/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.stories.js +23 -22
  74. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.css +34 -64
  75. package/dist/collection/components/01-base-components/ds-spinner/ds-spinner.js +42 -42
  76. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.examples.stories.js +15 -17
  77. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.features.stories.js +8 -8
  78. package/dist/collection/components/01-base-components/ds-spinner/stories/ds-spinner.stories.js +4 -49
  79. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.css +45 -78
  80. package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +229 -155
  81. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +26 -21
  82. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.features.stories.js +40 -40
  83. package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +30 -56
  84. package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
  85. package/dist/collection/store.js +7 -1
  86. package/dist/collection/utils/attributes/attributes.js +2 -2
  87. package/dist/collection/utils/controls/controlUtils.js +35 -1
  88. package/dist/collection/utils/link/linkUtils.js +3 -2
  89. package/dist/collection/utils/utils.js +10 -9
  90. package/dist/component-library/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +1 -1
  91. package/dist/component-library/component-library.css +1 -1
  92. package/dist/component-library/component-library.esm.js +1 -1
  93. package/dist/component-library/controlUtils-CNER0MvM.js +1 -0
  94. package/dist/component-library/ds-accordion.entry.js +1 -0
  95. package/dist/component-library/ds-button.entry.js +1 -0
  96. package/dist/component-library/ds-card.entry.js +1 -0
  97. package/dist/component-library/ds-checkbox-group.entry.js +1 -1
  98. package/dist/component-library/ds-checkbox.entry.js +1 -1
  99. package/dist/component-library/ds-icon.entry.js +1 -0
  100. package/dist/component-library/ds-input-validity.entry.js +1 -1
  101. package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
  102. package/dist/component-library/ds-link.entry.js +1 -1
  103. package/dist/component-library/ds-radio-button-group.entry.js +1 -1
  104. package/dist/component-library/ds-radio-button.entry.js +1 -1
  105. package/dist/component-library/ds-spinner.entry.js +1 -0
  106. package/dist/component-library/ds-text-input.entry.js +1 -1
  107. package/dist/component-library/ds-visually-hidden.entry.js +1 -0
  108. package/dist/component-library/index-BfTCfPZ1.js +6 -0
  109. package/dist/component-library/index-Cm7V4EAn.js +2 -0
  110. package/dist/component-library/index-DuYjhvTn.js +1 -0
  111. package/dist/component-library/index.esm.js +1 -1
  112. package/dist/component-library/linkUtils-02nCfO0F.js +1 -0
  113. package/dist/component-library/utils-CqaqnfY4.js +1 -0
  114. package/dist/components/attributes.js +3 -3
  115. package/dist/components/controlUtils.js +35 -2
  116. package/dist/components/ds-accordion.js +39 -33
  117. package/dist/components/ds-button2.js +49 -51
  118. package/dist/components/ds-card.d.ts +11 -0
  119. package/dist/components/ds-card.js +91 -0
  120. package/dist/components/ds-checkbox-group.js +88 -39
  121. package/dist/components/ds-checkbox2.js +73 -64
  122. package/dist/components/ds-icon2.js +292 -292
  123. package/dist/components/ds-input-validity2.js +16 -13
  124. package/dist/components/ds-link-with-arrow.js +22 -22
  125. package/dist/components/ds-link.js +43 -40
  126. package/dist/components/ds-radio-button-group.js +72 -34
  127. package/dist/components/ds-radio-button.js +63 -61
  128. package/dist/components/ds-spinner2.js +31 -32
  129. package/dist/components/ds-text-input.js +114 -99
  130. package/dist/components/ds-visually-hidden2.js +2 -3
  131. package/dist/components/index.js +208 -2
  132. package/dist/components/index2.js +679 -36
  133. package/dist/components/index3.js +69 -57
  134. package/dist/components/linkUtils.js +4 -2
  135. package/dist/docs.d.ts +443 -0
  136. package/dist/docs.json +4790 -0
  137. package/dist/esm/{utils-cfc536bc.js → attributes-BD_lNRxn.js} +3 -26
  138. package/dist/esm/component-library.js +6 -5
  139. package/dist/esm/controlUtils-CNER0MvM.js +37 -0
  140. package/dist/esm/ds-accordion.entry.js +77 -0
  141. package/dist/esm/ds-button.entry.js +105 -0
  142. package/dist/esm/ds-card.entry.js +56 -0
  143. package/dist/esm/ds-checkbox-group.entry.js +81 -29
  144. package/dist/esm/ds-checkbox.entry.js +60 -52
  145. package/dist/esm/ds-icon.entry.js +941 -0
  146. package/dist/esm/ds-input-validity.entry.js +13 -12
  147. package/dist/esm/ds-link-with-arrow.entry.js +21 -18
  148. package/dist/esm/ds-link.entry.js +34 -29
  149. package/dist/esm/ds-radio-button-group.entry.js +71 -27
  150. package/dist/esm/ds-radio-button.entry.js +52 -49
  151. package/dist/esm/ds-spinner.entry.js +60 -0
  152. package/dist/esm/ds-text-input.entry.js +87 -73
  153. package/dist/esm/ds-visually-hidden.entry.js +15 -0
  154. package/dist/esm/index-BfTCfPZ1.js +92 -0
  155. package/dist/esm/{index-84fd0ee9.js → index-Cm7V4EAn.js} +665 -31
  156. package/dist/{components/store.js → esm/index-DuYjhvTn.js} +6 -3
  157. package/dist/esm/index.js +2 -2
  158. package/dist/esm/{linkUtils-3d1b28cf.js → linkUtils-02nCfO0F.js} +4 -2
  159. package/dist/esm/loader.js +4 -4
  160. package/dist/esm/utils-CqaqnfY4.js +25 -0
  161. package/dist/hydrate/index.d.ts +271 -0
  162. package/dist/hydrate/index.js +22280 -0
  163. package/dist/hydrate/index.mjs +22272 -0
  164. package/dist/hydrate/package.json +12 -0
  165. package/dist/styles/helpers.css +9 -1
  166. package/dist/styles/helpers.css.map +1 -1
  167. package/dist/styles/mixins/_breakpoints.scss +1 -2
  168. package/dist/styles/mixins/_focus.scss +3 -5
  169. package/dist/styles/mixins.scss +8 -6
  170. package/dist/styles/variables.css +32 -24
  171. package/dist/styles/variables.css.map +1 -1
  172. package/dist/types/components/01-base-components/ds-accordion/ds-accordion.d.ts +11 -8
  173. package/dist/types/components/01-base-components/ds-button/ds-button.d.ts +14 -14
  174. package/dist/types/components/01-base-components/ds-button/stories/ds-button.features.stories.d.ts +1 -0
  175. package/dist/types/components/01-base-components/ds-card/ds-card.d.ts +20 -0
  176. package/dist/types/components/01-base-components/ds-card/stories/ds-card.examples.stories.d.ts +8 -0
  177. package/dist/types/components/01-base-components/ds-card/stories/ds-card.features.stories.d.ts +8 -0
  178. package/dist/types/components/01-base-components/ds-card/stories/ds-card.stories.d.ts +7 -0
  179. package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +16 -13
  180. package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +16 -7
  181. package/dist/types/components/01-base-components/ds-checkbox-group/stories/ds-checkbox-group.features.stories.d.ts +3 -0
  182. package/dist/types/components/01-base-components/ds-icon/ds-icon.d.ts +7 -5
  183. package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +5 -6
  184. package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +13 -14
  185. package/dist/types/components/01-base-components/ds-link/stories/ds-link.features.stories.d.ts +2 -0
  186. package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +5 -7
  187. package/dist/types/components/01-base-components/ds-radio-button/ds-radio-button.d.ts +14 -14
  188. package/dist/types/components/01-base-components/ds-radio-button/stories/ds-radio-button.features.stories.d.ts +1 -1
  189. package/dist/types/components/01-base-components/ds-radio-button-group/ds-radio-button-group.d.ts +16 -6
  190. package/dist/types/components/01-base-components/ds-radio-button-group/stories/ds-radio-button-group.features.stories.d.ts +1 -0
  191. package/dist/types/components/01-base-components/ds-spinner/ds-spinner.d.ts +7 -7
  192. package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +37 -32
  193. package/dist/types/components.d.ts +1225 -281
  194. package/dist/types/stencil-public-runtime.d.ts +22 -0
  195. package/dist/types/store.d.ts +6 -1
  196. package/dist/types/utils/attributes/attributes.d.ts +1 -1
  197. package/dist/types/utils/controls/controlUtils.d.ts +2 -0
  198. package/dist/types/utils/link/linkUtils.d.ts +1 -1
  199. package/dist/types/utils/utils.d.ts +2 -1
  200. package/package.json +28 -24
  201. package/dist/cjs/controlUtils-8bf55ef0.js +0 -7
  202. package/dist/cjs/ds-accordion_5.cjs.entry.js +0 -1190
  203. package/dist/cjs/index-5b0b9d4c.js +0 -82
  204. package/dist/component-library/controlUtils-c2ba44bd.js +0 -1
  205. package/dist/component-library/ds-accordion_5.entry.js +0 -1
  206. package/dist/component-library/index-72ac5051.js +0 -6
  207. package/dist/component-library/index-84fd0ee9.js +0 -2
  208. package/dist/component-library/linkUtils-3d1b28cf.js +0 -1
  209. package/dist/component-library/store-73a56075.js +0 -1
  210. package/dist/esm/controlUtils-c2ba44bd.js +0 -4
  211. package/dist/esm/ds-accordion_5.entry.js +0 -1182
  212. package/dist/esm/index-72ac5051.js +0 -80
  213. package/dist/esm/store-73a56075.js +0 -204
  214. package/dist/loader/package.json +0 -11
  215. /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
  216. /package/dist/component-library/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  217. /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
@@ -3,7 +3,7 @@ import classNames from "classnames";
3
3
  import { inheritAriaAttributes, inheritAttributes } from "../../../utils/attributes/attributes";
4
4
  import { getOptionalText, getRequiredText } from "../../../utils/controls/controlUtils";
5
5
  import { isValidation } from "../../../store";
6
- import { getAriaLabel, idGenerator } from "../../../utils/utils";
6
+ import { idGenerator } from "../../../utils/utils";
7
7
  const checkboxIdGenerator = idGenerator('ds-checkbox');
8
8
  export class DsCheckbox {
9
9
  checkboxGroup = null;
@@ -15,59 +15,60 @@ export class DsCheckbox {
15
15
  labelClicked = false;
16
16
  el;
17
17
  internals;
18
- identifier = checkboxIdGenerator.next().value;
19
- checked = false;
20
- legend;
21
- assistiveText;
22
- text;
23
- indeterminate = false;
24
- disabled = false;
25
- errorText = '';
26
- errorsDisabled = false;
27
- required = false;
28
- optional = false;
29
- optionalText;
30
- ariaLabel;
31
- invalid = !!this.errorText;
32
- initialChecked = this.checked;
18
+ dsId = checkboxIdGenerator.next().value;
19
+ dsChecked = false;
20
+ dsLegend;
21
+ dsAssistiveText;
22
+ dsText;
23
+ dsIndeterminate = false;
24
+ dsDisabled = false;
25
+ dsErrorText = '';
26
+ dsErrorsDisabled = false;
27
+ dsRequired = false;
28
+ dsOptional = false;
29
+ dsOptionalText;
30
+ dsAriaLabel;
31
+ dsChange;
32
+ invalid = !!this.dsErrorText;
33
+ initialChecked = this.dsChecked;
33
34
  validationMessage;
34
35
  setIds = () => {
35
- this.labelId = `${this.identifier}-label`;
36
- this.inputValidityId = `${this.identifier}-validity`;
37
- this.assistiveTextId = `${this.identifier}-assistive-text`;
36
+ this.labelId = `${this.dsId}-label`;
37
+ this.inputValidityId = `${this.dsId}-validity`;
38
+ this.assistiveTextId = `${this.dsId}-assistive-text`;
38
39
  };
39
- getValidationMessage = () => (!this.errorsDisabled ? this.errorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
40
+ getValidationMessage = () => (!this.dsErrorsDisabled ? this.dsErrorText || this.internals?.validationMessage || this.inputElem?.validationMessage : '');
40
41
  getLegendText = () => {
41
- if (this.required) {
42
- return getRequiredText(this.legend);
42
+ if (this.dsRequired) {
43
+ return getRequiredText(this.dsLegend);
43
44
  }
44
- if (this.optional) {
45
- return getOptionalText(this.legend, this.optionalText);
45
+ if (this.dsOptional) {
46
+ return getOptionalText(this.dsLegend, this.dsOptionalText);
46
47
  }
47
- return this.legend;
48
+ return this.dsLegend;
48
49
  };
49
50
  getCheckboxText = () => {
50
- if (this.legend) {
51
- return this.text;
51
+ if (this.dsLegend) {
52
+ return this.dsText;
52
53
  }
53
- if (this.required) {
54
- return getRequiredText(this.text);
54
+ if (this.dsRequired) {
55
+ return getRequiredText(this.dsText);
55
56
  }
56
- if (this.optional) {
57
- return getOptionalText(this.text, this.optionalText);
57
+ if (this.dsOptional) {
58
+ return getOptionalText(this.dsText, this.dsOptionalText);
58
59
  }
59
- return this.text;
60
+ return this.dsText;
60
61
  };
61
- getAriaDescribedBy = () => [Boolean(this.assistiveText) && this.assistiveTextId, Boolean(this.getValidationMessage()) && this.inputValidityId].filter(Boolean).join(' ');
62
+ getAriaDescribedBy = () => [Boolean(this.dsAssistiveText) && this.assistiveTextId, Boolean(this.getValidationMessage()) && this.inputValidityId].filter(Boolean).join(' ');
62
63
  formResetCallback() {
63
- this.checked = this.initialChecked;
64
+ this.dsChecked = this.initialChecked;
64
65
  this.internals?.setValidity({});
65
- this.internals?.setFormValue(this.checked.toString());
66
+ this.internals?.setFormValue(this.dsChecked.toString());
66
67
  }
67
68
  connectedCallback() {
68
69
  this.checkboxGroup = this.el.closest('ds-checkbox-group');
69
70
  if (this.checkboxGroup) {
70
- this.invalid = !!this.checkboxGroup.errorText;
71
+ this.invalid = !!this.checkboxGroup.dsErrorText;
71
72
  this.checkboxGroup.addEventListener('dsCheckboxGroupInvalidStateChange', this.updateInvalidState);
72
73
  }
73
74
  }
@@ -86,13 +87,16 @@ export class DsCheckbox {
86
87
  ...inheritAriaAttributes(this.el, ['aria-label', 'aria-describedby', 'aria-hidden', 'aria-invalid']),
87
88
  ...inheritAttributes(this, this.el),
88
89
  };
89
- if (isValidation('server') || this.errorText) {
90
+ if (isValidation('server') || this.dsErrorText) {
90
91
  this.validationMessage = this.getValidationMessage();
91
92
  }
92
93
  }
94
+ dsCheckedObserver(isChecked) {
95
+ this.dsChange.emit(isChecked);
96
+ }
93
97
  handleInput = (e) => {
94
98
  const target = e.target;
95
- this.checked = target.checked;
99
+ this.dsChecked = target.checked;
96
100
  this.internals?.setFormValue(target.checked.toString());
97
101
  if (isValidation('client') && this.validationMessage) {
98
102
  this.validationMessage = this.getValidationMessage();
@@ -100,7 +104,7 @@ export class DsCheckbox {
100
104
  };
101
105
  handleKeyUp = (event) => {
102
106
  if (event.key === 'Enter') {
103
- this.inputElem.dispatchEvent(new Event('input'));
107
+ this.inputElem.click();
104
108
  }
105
109
  };
106
110
  handleBlur = () => {
@@ -117,26 +121,26 @@ export class DsCheckbox {
117
121
  };
118
122
  renderCheckbox() {
119
123
  const classes = classNames('ds-checkbox', {
120
- 'ds-checkbox--disabled': this.disabled,
121
- 'ds-checkbox--no-margin': Boolean(!this.text),
124
+ 'ds-checkbox--disabled': this.dsDisabled,
125
+ 'ds-checkbox--no-margin': Boolean(!this.dsText),
122
126
  });
123
127
  const inputClasses = classNames('ds-checkbox__input', {
124
- 'ds-checkbox__input--invalid': Boolean(this.errorText) || this.invalid,
128
+ 'ds-checkbox__input--invalid': Boolean(this.dsErrorText) || this.invalid,
125
129
  });
126
130
  const errorClasses = classNames('ds-checkbox-error', {
127
131
  'ds-checkbox-error--visible': Boolean(this.validationMessage),
128
132
  });
129
133
  const ariaDescribedBy = this.getAriaDescribedBy();
130
- 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.checked.toString(), 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" })))));
134
+ 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.dsChecked, indeterminate: this.dsIndeterminate, onInput: this.handleInput, onKeyUp: this.handleKeyUp, onBlur: this.handleBlur, value: this.dsChecked.toString(), disabled: this.dsDisabled, required: this.dsRequired, id: this.dsId, "aria-describedby": ariaDescribedBy, "aria-label": this.dsAriaLabel, "aria-invalid": this.dsErrorText ? true : undefined, ...this.inheritedAttributes }), this.getCheckboxText())), !this.dsErrorsDisabled && (h("div", { class: errorClasses }, h("ds-input-validity", { id: this.inputValidityId, dsText: this.validationMessage, dsType: "error", dsAriaLive: "polite", dsAriaAtomic: "true" })))));
131
135
  }
132
136
  renderFieldset() {
133
137
  const fieldsetClasses = classNames('ds-checkbox-fieldset');
134
138
  const legendClasses = classNames('ds-checkbox-fieldset__legend');
135
139
  const assistiveTextClasses = classNames('ds-checkbox-fieldset__assistive-text');
136
- return (h("fieldset", { class: fieldsetClasses }, h("legend", { class: legendClasses }, this.getLegendText()), this.assistiveText && (h("small", { class: assistiveTextClasses, id: this.assistiveTextId }, this.assistiveText)), this.renderCheckbox()));
140
+ return (h("fieldset", { class: fieldsetClasses }, h("legend", { class: legendClasses }, this.getLegendText()), this.dsAssistiveText && (h("small", { class: assistiveTextClasses, id: this.assistiveTextId }, this.dsAssistiveText)), this.renderCheckbox()));
137
141
  }
138
142
  render() {
139
- if (this.legend) {
143
+ if (this.dsLegend) {
140
144
  return this.renderFieldset();
141
145
  }
142
146
  return this.renderCheckbox();
@@ -156,8 +160,9 @@ export class DsCheckbox {
156
160
  }
157
161
  static get properties() {
158
162
  return {
159
- "identifier": {
163
+ "dsId": {
160
164
  "type": "string",
165
+ "attribute": "ds-id",
161
166
  "mutable": false,
162
167
  "complexType": {
163
168
  "original": "string",
@@ -168,16 +173,16 @@ export class DsCheckbox {
168
173
  "optional": true,
169
174
  "docs": {
170
175
  "tags": [],
171
- "text": ""
176
+ "text": "Passed to the `id` attribute of the `input` element of the rendered checkbox."
172
177
  },
173
178
  "getter": false,
174
179
  "setter": false,
175
- "attribute": "id",
176
180
  "reflect": false,
177
181
  "defaultValue": "checkboxIdGenerator.next().value as string"
178
182
  },
179
- "checked": {
183
+ "dsChecked": {
180
184
  "type": "boolean",
185
+ "attribute": "ds-checked",
181
186
  "mutable": true,
182
187
  "complexType": {
183
188
  "original": "boolean",
@@ -188,16 +193,16 @@ export class DsCheckbox {
188
193
  "optional": false,
189
194
  "docs": {
190
195
  "tags": [],
191
- "text": ""
196
+ "text": "Passed to the `checked` attriubte of the `input` element of the rendered checkbox."
192
197
  },
193
198
  "getter": false,
194
199
  "setter": false,
195
- "attribute": "checked",
196
200
  "reflect": false,
197
201
  "defaultValue": "false"
198
202
  },
199
- "legend": {
203
+ "dsLegend": {
200
204
  "type": "string",
205
+ "attribute": "ds-legend",
201
206
  "mutable": false,
202
207
  "complexType": {
203
208
  "original": "string",
@@ -208,15 +213,15 @@ export class DsCheckbox {
208
213
  "optional": true,
209
214
  "docs": {
210
215
  "tags": [],
211
- "text": ""
216
+ "text": "Label of the checkbox"
212
217
  },
213
218
  "getter": false,
214
219
  "setter": false,
215
- "attribute": "legend",
216
220
  "reflect": false
217
221
  },
218
- "assistiveText": {
222
+ "dsAssistiveText": {
219
223
  "type": "string",
224
+ "attribute": "ds-assistive-text",
220
225
  "mutable": false,
221
226
  "complexType": {
222
227
  "original": "string",
@@ -227,15 +232,15 @@ export class DsCheckbox {
227
232
  "optional": true,
228
233
  "docs": {
229
234
  "tags": [],
230
- "text": ""
235
+ "text": "Text for additional information shown below label"
231
236
  },
232
237
  "getter": false,
233
238
  "setter": false,
234
- "attribute": "assistive-text",
235
239
  "reflect": false
236
240
  },
237
- "text": {
241
+ "dsText": {
238
242
  "type": "string",
243
+ "attribute": "ds-text",
239
244
  "mutable": false,
240
245
  "complexType": {
241
246
  "original": "string",
@@ -246,15 +251,15 @@ export class DsCheckbox {
246
251
  "optional": true,
247
252
  "docs": {
248
253
  "tags": [],
249
- "text": ""
254
+ "text": "The text of the checkbox"
250
255
  },
251
256
  "getter": false,
252
257
  "setter": false,
253
- "attribute": "text",
254
258
  "reflect": false
255
259
  },
256
- "indeterminate": {
260
+ "dsIndeterminate": {
257
261
  "type": "boolean",
262
+ "attribute": "ds-indeterminate",
258
263
  "mutable": false,
259
264
  "complexType": {
260
265
  "original": "boolean",
@@ -265,16 +270,16 @@ export class DsCheckbox {
265
270
  "optional": false,
266
271
  "docs": {
267
272
  "tags": [],
268
- "text": ""
273
+ "text": "Mainly used in a nested checkbox group to display a parent\ncheckbox in a partially selected state if some but not\nall of the nested checkbox group's checkboxes are selected."
269
274
  },
270
275
  "getter": false,
271
276
  "setter": false,
272
- "attribute": "indeterminate",
273
277
  "reflect": false,
274
278
  "defaultValue": "false"
275
279
  },
276
- "disabled": {
280
+ "dsDisabled": {
277
281
  "type": "boolean",
282
+ "attribute": "ds-disabled",
278
283
  "mutable": false,
279
284
  "complexType": {
280
285
  "original": "boolean",
@@ -285,16 +290,16 @@ export class DsCheckbox {
285
290
  "optional": false,
286
291
  "docs": {
287
292
  "tags": [],
288
- "text": ""
293
+ "text": "Passed to the `disabled` attribute of the `input` element of the rendered checkbox."
289
294
  },
290
295
  "getter": false,
291
296
  "setter": false,
292
- "attribute": "disabled",
293
297
  "reflect": false,
294
298
  "defaultValue": "false"
295
299
  },
296
- "errorText": {
300
+ "dsErrorText": {
297
301
  "type": "string",
302
+ "attribute": "ds-error-text",
298
303
  "mutable": false,
299
304
  "complexType": {
300
305
  "original": "string",
@@ -305,16 +310,16 @@ export class DsCheckbox {
305
310
  "optional": false,
306
311
  "docs": {
307
312
  "tags": [],
308
- "text": ""
313
+ "text": "Error message shown below the text input.\nIf set, the checkbox is shown in an invalid state."
309
314
  },
310
315
  "getter": false,
311
316
  "setter": false,
312
- "attribute": "error-text",
313
317
  "reflect": false,
314
318
  "defaultValue": "''"
315
319
  },
316
- "errorsDisabled": {
320
+ "dsErrorsDisabled": {
317
321
  "type": "boolean",
322
+ "attribute": "ds-errors-disabled",
318
323
  "mutable": false,
319
324
  "complexType": {
320
325
  "original": "boolean",
@@ -325,16 +330,16 @@ export class DsCheckbox {
325
330
  "optional": false,
326
331
  "docs": {
327
332
  "tags": [],
328
- "text": ""
333
+ "text": "Used internally in checkbox group to disable error messages\nfor a single checkbox."
329
334
  },
330
335
  "getter": false,
331
336
  "setter": false,
332
- "attribute": "data-errors-disabled",
333
337
  "reflect": false,
334
338
  "defaultValue": "false"
335
339
  },
336
- "required": {
340
+ "dsRequired": {
337
341
  "type": "boolean",
342
+ "attribute": "ds-required",
338
343
  "mutable": false,
339
344
  "complexType": {
340
345
  "original": "boolean",
@@ -345,16 +350,16 @@ export class DsCheckbox {
345
350
  "optional": false,
346
351
  "docs": {
347
352
  "tags": [],
348
- "text": ""
353
+ "text": "Passed to the `required` attribute of the `input` element of the rendered checkbox."
349
354
  },
350
355
  "getter": false,
351
356
  "setter": false,
352
- "attribute": "required",
353
357
  "reflect": false,
354
358
  "defaultValue": "false"
355
359
  },
356
- "optional": {
360
+ "dsOptional": {
357
361
  "type": "boolean",
362
+ "attribute": "ds-optional",
358
363
  "mutable": false,
359
364
  "complexType": {
360
365
  "original": "boolean",
@@ -365,16 +370,16 @@ export class DsCheckbox {
365
370
  "optional": false,
366
371
  "docs": {
367
372
  "tags": [],
368
- "text": ""
373
+ "text": "Displays indicator that the checkbox is optional alongside label."
369
374
  },
370
375
  "getter": false,
371
376
  "setter": false,
372
- "attribute": "optional",
373
377
  "reflect": false,
374
378
  "defaultValue": "false"
375
379
  },
376
- "optionalText": {
380
+ "dsOptionalText": {
377
381
  "type": "string",
382
+ "attribute": "ds-optional-text",
378
383
  "mutable": false,
379
384
  "complexType": {
380
385
  "original": "string",
@@ -385,15 +390,15 @@ export class DsCheckbox {
385
390
  "optional": true,
386
391
  "docs": {
387
392
  "tags": [],
388
- "text": ""
393
+ "text": "Text shown alongside label, if the checkbox is set as optional."
389
394
  },
390
395
  "getter": false,
391
396
  "setter": false,
392
- "attribute": "optional-text",
393
397
  "reflect": false
394
398
  },
395
- "ariaLabel": {
399
+ "dsAriaLabel": {
396
400
  "type": "string",
401
+ "attribute": "ds-aria-label",
397
402
  "mutable": false,
398
403
  "complexType": {
399
404
  "original": "string",
@@ -404,11 +409,10 @@ export class DsCheckbox {
404
409
  "optional": false,
405
410
  "docs": {
406
411
  "tags": [],
407
- "text": ""
412
+ "text": "Passed to the `aria-label` attribute of the `input` element of the rendered checkbox."
408
413
  },
409
414
  "getter": false,
410
415
  "setter": false,
411
- "attribute": "aria-label",
412
416
  "reflect": false
413
417
  }
414
418
  };
@@ -420,6 +424,30 @@ export class DsCheckbox {
420
424
  "validationMessage": {}
421
425
  };
422
426
  }
427
+ static get events() {
428
+ return [{
429
+ "method": "dsChange",
430
+ "name": "dsChange",
431
+ "bubbles": true,
432
+ "cancelable": true,
433
+ "composed": true,
434
+ "docs": {
435
+ "tags": [],
436
+ "text": "The `dsChange` event is fired each time the `value` property of\nthe `ds-checkbox` element is changed."
437
+ },
438
+ "complexType": {
439
+ "original": "boolean",
440
+ "resolved": "boolean",
441
+ "references": {}
442
+ }
443
+ }];
444
+ }
423
445
  static get elementRef() { return "el"; }
446
+ static get watchers() {
447
+ return [{
448
+ "propName": "dsChecked",
449
+ "methodName": "dsCheckedObserver"
450
+ }];
451
+ }
424
452
  static get attachInternalsMemberName() { return "internals"; }
425
453
  }
@@ -7,41 +7,41 @@ const meta = {
7
7
  export default meta;
8
8
  export const Unchecked = {
9
9
  args: {
10
- text: 'Checkbox text',
11
- checked: false,
10
+ dsText: 'Checkbox text',
11
+ dsChecked: false,
12
12
  },
13
13
  };
14
14
  export const Checked = {
15
15
  args: {
16
- text: 'Checkbox text',
17
- checked: true,
16
+ dsText: 'Checkbox text',
17
+ dsChecked: true,
18
18
  },
19
19
  };
20
20
  export const Indeterminate = {
21
21
  args: {
22
- text: 'Checkbox text',
23
- indeterminate: true,
22
+ dsText: 'Checkbox text',
23
+ dsIndeterminate: true,
24
24
  },
25
25
  };
26
26
  export const Disabled = {
27
27
  args: {
28
- text: 'Checkbox text',
29
- checked: false,
30
- disabled: true
28
+ dsText: 'Checkbox text',
29
+ dsChecked: false,
30
+ dsDisabled: true
31
31
  },
32
32
  };
33
33
  export const Invalid = {
34
34
  args: {
35
- text: 'Checkbox text',
36
- checked: false,
37
- errorText: 'Error text',
35
+ dsText: 'Checkbox text',
36
+ dsChecked: false,
37
+ dsErrorText: 'Error text',
38
38
  },
39
39
  };
40
40
  const withoutValueTextDOM = html `
41
41
  <div class="ds-sb-without-value-text">
42
- <ds-checkbox checked="false" aria-label="Checkbox text"></ds-checkbox>
43
- <ds-checkbox disabled="true" aria-label="Checkbox text"></ds-checkbox>
44
- <ds-checkbox error-text="Error text" aria-label="Checkbox text"></ds-checkbox>
42
+ <ds-checkbox ds-checked="false" ds-aria-label="Checkbox text"></ds-checkbox>
43
+ <ds-checkbox ds-disabled="true" ds-aria-label="Checkbox text"></ds-checkbox>
44
+ <ds-checkbox ds-error-text="Error text" ds-aria-label="Checkbox text"></ds-checkbox>
45
45
  </div>
46
46
  `;
47
47
  export const WithoutValueText = {
@@ -64,8 +64,8 @@ export const WithoutValueText = {
64
64
  };
65
65
  const requiredAndOptionalDOM = html `
66
66
  <div class="ds-sb-required-and-optional">
67
- <ds-checkbox required="true" text="Checkbox text"></ds-checkbox>
68
- <ds-checkbox optional="true" text="Checkbox text"></ds-checkbox>
67
+ <ds-checkbox ds-required="true" ds-text="Checkbox text"></ds-checkbox>
68
+ <ds-checkbox ds-optional="true" ds-text="Checkbox text"></ds-checkbox>
69
69
  <div>
70
70
  `;
71
71
  export const RequiredAndOptional = {
@@ -89,9 +89,9 @@ export const RequiredAndOptional = {
89
89
  };
90
90
  const withLegendAndAssistiveTextDOM = html `
91
91
  <div class="ds-sb-with-legend-and-assistive-text">
92
- <ds-checkbox legend="Legend text" assistive-text="Assistive text" text="Checkbox text"></ds-checkbox>
93
- <ds-checkbox legend="Legend text" assistive-text="Assistive text" text="Checkbox text" required="true"></ds-checkbox>
94
- <ds-checkbox legend="Legend text" assistive-text="Assistive text" text="Checkbox text" optional="true"></ds-checkbox>
92
+ <ds-checkbox ds-legend="Legend text" ds-assistive-text="Assistive text" ds-text="Checkbox text"></ds-checkbox>
93
+ <ds-checkbox ds-legend="Legend text" ds-assistive-text="Assistive text" ds-text="Checkbox text" ds-required="true"></ds-checkbox>
94
+ <ds-checkbox ds-legend="Legend text" ds-assistive-text="Assistive text" ds-text="Checkbox text" ds-optional="true"></ds-checkbox>
95
95
  </div>
96
96
  `;
97
97
  export const WithLegendAndAssistiveText = {
@@ -5,34 +5,21 @@ const meta = {
5
5
  export default meta;
6
6
  export const Default = {
7
7
  args: {
8
- text: 'Checkbox text',
9
- checked: false,
8
+ dsText: 'Checkbox text',
9
+ dsChecked: false,
10
10
  },
11
11
  };
12
12
  export const Playground = {
13
13
  args: {
14
- text: 'Checkbox text',
15
- checked: false,
16
- indeterminate: false,
17
- disabled: false,
18
- errorText: '',
19
- required: false,
20
- optional: false,
21
- legend: '',
22
- assistiveText: '',
23
- optionalText: '',
24
- },
25
- argTypes: {
26
- text: { control: 'text' },
27
- checked: { control: 'boolean' },
28
- indeterminate: { control: 'boolean' },
29
- disabled: { control: 'boolean' },
30
- errorText: { control: 'text' },
31
- required: { control: 'boolean' },
32
- optional: { control: 'boolean' },
33
- legend: { control: 'text' },
34
- assistiveText: { control: 'text' },
35
- optionalText: { control: 'text' },
36
- ariaLabel: { name: 'aria-label', control: 'text' },
14
+ dsText: 'Checkbox text',
15
+ dsChecked: false,
16
+ dsIndeterminate: false,
17
+ dsDisabled: false,
18
+ dsErrorText: '',
19
+ dsRequired: false,
20
+ dsOptional: false,
21
+ dsLegend: '',
22
+ dsAssistiveText: '',
23
+ dsOptionalText: '',
37
24
  },
38
25
  };
@@ -32,7 +32,6 @@
32
32
  margin-left: var(--ds-spacing-large);
33
33
  }
34
34
  .ds-checkbox-group--horizontal > .ds-checkbox-group__checkboxes {
35
- flex-direction: row;
35
+ flex-flow: row wrap;
36
36
  gap: var(--ds-spacing-small);
37
- flex-wrap: wrap;
38
37
  }